aboutsummaryrefslogtreecommitdiff
path: root/mpiosh
diff options
context:
space:
mode:
Diffstat (limited to 'mpiosh')
-rw-r--r--mpiosh/callback.c59
-rw-r--r--mpiosh/callback.h3
-rw-r--r--mpiosh/global.c5
3 files changed, 57 insertions, 10 deletions
diff --git a/mpiosh/callback.c b/mpiosh/callback.c
index 768222a..70c2e5a 100644
--- a/mpiosh/callback.c
+++ b/mpiosh/callback.c
@@ -2,7 +2,7 @@
*
* Author: Andreas Büsching <crunchy@tzi.de>
*
- * $Id: callback.c,v 1.41 2003/04/19 23:58:02 germeier Exp $
+ * $Id: callback.c,v 1.42 2003/06/26 19:53:58 germeier Exp $
*
* Copyright (C) 2001 Andreas Büsching <crunchy@tzi.de>
*
@@ -651,8 +651,8 @@ void
mpiosh_cmd_format(char *args[])
{
char answer[512];
- BYTE *config, *fmconfig, *rconfig;
- int csize, fmsize, rsize;
+ BYTE *config, *fmconfig, *rconfig, *fontconfig;
+ int csize, fmsize, rsize, fontsize;
MPIOSH_CHECK_CONNECTION_CLOSED;
@@ -665,10 +665,13 @@ mpiosh_cmd_format(char *args[])
if (answer[0] == 'y' || answer[0] == 'Y') {
if (mpiosh.card == MPIO_INTERNAL_MEM) {
- /* save config files and write them back after formatting */
- config = NULL;
- fmconfig = NULL;
- rconfig = NULL;
+ printf("read config files from player\n");
+
+ /* save config files and write them back after formatting */
+ config = NULL;
+ fmconfig = NULL;
+ rconfig = NULL;
+ fontconfig = NULL;
csize = mpio_file_get_to_memory(mpiosh.dev, MPIO_INTERNAL_MEM,
MPIO_CONFIG_FILE, NULL, &config);
@@ -676,8 +679,12 @@ mpiosh_cmd_format(char *args[])
MPIO_CHANNEL_FILE, NULL, &fmconfig);
rsize = mpio_file_get_to_memory(mpiosh.dev, MPIO_INTERNAL_MEM,
MPIO_MPIO_RECORD, NULL, &rconfig);
+ fontsize = mpio_file_get_to_memory(mpiosh.dev, MPIO_INTERNAL_MEM,
+ MPIO_FONT_FON, NULL, &fontconfig);
}
+ printf("formatting memory...\n");
+
if (mpio_memory_format(mpiosh.dev, mpiosh.card,
mpiosh_callback_format) == -1)
printf("\nfailed\n");
@@ -685,6 +692,7 @@ mpiosh_cmd_format(char *args[])
printf("\n");
if (mpiosh.card == MPIO_INTERNAL_MEM) {
+ printf("restoring saved config files\n");
/* restore everything we saved */
if (config)
if (mpio_file_put_from_memory(mpiosh.dev, MPIO_INTERNAL_MEM,
@@ -700,8 +708,13 @@ mpiosh_cmd_format(char *args[])
if (mpio_directory_make(mpiosh.dev, MPIO_INTERNAL_MEM,
MPIO_MPIO_RECORD)!=MPIO_OK)
mpio_perror("error");
+ if (fontconfig)
+ if (mpio_file_put_from_memory(mpiosh.dev, MPIO_INTERNAL_MEM,
+ MPIO_FONT_FON, FTYPE_FONT,
+ NULL, fontconfig, fontsize)==-1)
+ mpio_perror("error");
- if (config || fmconfig || rconfig)
+ if (config || fmconfig || rconfig || fontconfig)
mpio_sync(mpiosh.dev, MPIO_INTERNAL_MEM);
if (config)
free(config);
@@ -709,6 +722,8 @@ mpiosh_cmd_format(char *args[])
free(fmconfig);
if (rconfig)
free(rconfig);
+ if (fontconfig)
+ free(fontconfig);
}
}
@@ -1099,5 +1114,33 @@ mpiosh_cmd_id3_format(char *args[])
}
}
+void
+mpiosh_cmd_font_upload(char *args[])
+{
+ BYTE * p;
+ int size;
+
+ MPIOSH_CHECK_CONNECTION_CLOSED;
+ MPIOSH_CHECK_ARG;
+
+ /* check if fonts file already exists */
+ p = mpio_file_exists(mpiosh.dev, MPIO_INTERNAL_MEM,
+ MPIO_FONT_FON);
+ if (p) {
+ printf("Fontsfile already exists. Please delete it first!\n");
+ return;
+ }
+
+ printf("writing new font file ...\n");
+ if (mpio_file_put_as(mpiosh.dev, MPIO_INTERNAL_MEM,
+ args[0], MPIO_FONT_FON,
+ FTYPE_FONT, mpiosh_callback_put)==-1)
+ mpio_perror("error");
+
+ printf("\n");
+ mpio_sync(mpiosh.dev, MPIO_INTERNAL_MEM);
+
+}
+
/* end of callback.c */
diff --git a/mpiosh/callback.h b/mpiosh/callback.h
index 3d1c8f8..f0e2b61 100644
--- a/mpiosh/callback.h
+++ b/mpiosh/callback.h
@@ -2,7 +2,7 @@
*
* Author: Andreas Büsching <crunchy@tzi.de>
*
- * $Id: callback.h,v 1.11 2003/04/19 23:58:02 germeier Exp $
+ * $Id: callback.h,v 1.12 2003/06/26 19:53:59 germeier Exp $
*
* Copyright (C) 2001 Andreas Büsching <crunchy@tzi.de>
*
@@ -56,6 +56,7 @@ void mpiosh_cmd_config(char *args[]);
void mpiosh_cmd_channel(char *args[]);
void mpiosh_cmd_id3(char *args[]);
void mpiosh_cmd_id3_format(char *args[]);
+void mpiosh_cmd_font_upload(char *args[]);
/* local command callbacks */
void mpiosh_cmd_ldir(char *args[]);
diff --git a/mpiosh/global.c b/mpiosh/global.c
index e1215f1..dc4ad45 100644
--- a/mpiosh/global.c
+++ b/mpiosh/global.c
@@ -2,7 +2,7 @@
*
* Author: Andreas Buesching <crunchy@tzi.de>
*
- * $Id: global.c,v 1.12 2003/04/23 08:34:15 crunchy Exp $
+ * $Id: global.c,v 1.13 2003/06/26 19:53:59 germeier Exp $
*
* Copyright (C) 2001 Andreas Büsching <crunchy@tzi.de>
*
@@ -129,6 +129,9 @@ struct mpiosh_cmd_t commands[] = {
{ "id3_format", NULL, "[<format>]",
" define/show the format line for ID3 rewriting",
mpiosh_cmd_id3_format, NULL },
+ { "font_upload", NULL, "[<fontfile>]",
+ " upload the give fontfile to the internal memory",
+ mpiosh_cmd_font_upload, NULL },
{ "dump_memory", NULL, NULL,
" dump FAT, directory, spare area and the first 0x100 of the\n"
" selected memory card",