diff --git a/include/libg1m.h b/include/libg1m.h index fcfa4ea..bb77b29 100644 --- a/include/libg1m.h +++ b/include/libg1m.h @@ -166,7 +166,8 @@ typedef enum { g1m_type_eact = 0x04, g1m_type_pict = 0x08, g1m_type_lang = 0x10, - g1m_type_fkey = 0x20 + g1m_type_fkey = 0x20, + g1m_type_storage = 0x40 } g1m_type_t; /* platform */ @@ -174,9 +175,7 @@ typedef enum { g1m_platform_none = 0x00, g1m_platform_fx = 0x01, g1m_platform_cp = 0x02, - g1m_platform_cg = 0x04, - - g1m_platform_fx_raw = 0x08 + g1m_platform_cg = 0x04 } g1m_platform_t; /* handle */ diff --git a/include/libg1m/format.h b/include/libg1m/format.h index fb558b0..67cb75e 100644 --- a/include/libg1m/format.h +++ b/include/libg1m/format.h @@ -82,7 +82,7 @@ struct standard_header { # include # include # include -# include +# include # include # include # include diff --git a/include/libg1m/format/mcsraw.h b/include/libg1m/format/storage.h similarity index 82% rename from include/libg1m/format/mcsraw.h rename to include/libg1m/format/storage.h index ce5d47b..f6c6a30 100644 --- a/include/libg1m/format/mcsraw.h +++ b/include/libg1m/format/storage.h @@ -1,16 +1,16 @@ /* ************************************************************************** */ /* _____ _ */ -/* libg1m/format/mcsraw.h |_ _|__ _ _| |__ ___ _ _ */ +/* libg1m/format/storage.h |_ _|__ _ _| |__ ___ _ _ */ /* | Project: libg1m | |/ _ \| | | | '_ \ / _ \ | | | */ /* | | (_) | |_| | | | | __/ |_| | */ /* By: thomas |_|\___/ \__,_|_| |_|\___|\__, |.fr */ /* Last updated: 2016/12/25 13:39:13 |___/ */ /* */ /* ************************************************************************** */ -#ifndef LIBG1M_FORMAT_MCSRAW_H -# define LIBG1M_FORMAT_MCSRAW_H +#ifndef LIBG1M_FORMAT_STORAGE_H +# define LIBG1M_FORMAT_STORAGE_H -/* Raw MCS files (G1S) contain backups of the raw MCS. +/* Storage files (G1S) contain backups of the storage memory. * * According to Simon Lothar, the files contain zeroes up to 0x00270000 * (the location of the MCS in real fx-9860 calculators), then it has the @@ -20,4 +20,4 @@ * The structure has been documented by Simon Lothar, but I haven't * worked on it yet: TODO. */ -#endif /* LIBG1M_FORMAT_MCSRAW_H */ +#endif /* LIBG1M_FORMAT_STORAGE_H */ diff --git a/include/libg1m/internals.h b/include/libg1m/internals.h index 44ad115..25e7fac 100644 --- a/include/libg1m/internals.h +++ b/include/libg1m/internals.h @@ -77,8 +77,6 @@ int g1m_parse_c2p(g1m_t *handle, FILE *stream, struct standard_header *std); int g1m_parse_mcs(g1m_t *handle, FILE *stream, struct standard_header *std); -int g1m_parse_mcsraw(g1m_t *handle, FILE *stream, - struct standard_header *std); int g1m_parse_eact(g1m_t * handle, FILE *stream, struct standard_header *std); int g1m_parse_addin(g1m_t *handle, FILE *stream, @@ -91,6 +89,8 @@ int g1m_parse_lang_cg(g1m_t *handle, FILE *stream, struct standard_header *std); int g1m_parse_fkey(g1m_t *handle, FILE *stream, struct standard_header *std); +int g1m_parse_storage(g1m_t *handle, FILE *stream, + struct standard_header *std); /* others */ int g1m_parse_fkey_cg_content(g1m_t *handle, FILE *stream, diff --git a/src/parse/main.c b/src/parse/main.c index bf35b21..81ba1aa 100644 --- a/src/parse/main.c +++ b/src/parse/main.c @@ -34,8 +34,6 @@ static struct corresp parsing_functions[] = { g1m_parse_mcs}, {g1m_platform_cg, g1m_type_mcs, g1m_parse_mcs}, - {g1m_platform_fx_raw, g1m_type_mcs, - g1m_parse_mcsraw}, /* language files */ {g1m_platform_fx, g1m_type_lang, @@ -59,6 +57,10 @@ static struct corresp parsing_functions[] = { {g1m_platform_cp, g1m_type_pict, g1m_parse_c2p}, + /* storage */ + {g1m_platform_none, g1m_type_storage, + g1m_parse_storage}, + {0, 0, NULL} }; diff --git a/src/parse/mcsraw.c b/src/parse/storage.c similarity index 82% rename from src/parse/mcsraw.c rename to src/parse/storage.c index 66f69e8..3c8cf52 100644 --- a/src/parse/mcsraw.c +++ b/src/parse/storage.c @@ -1,6 +1,6 @@ /* ************************************************************************** */ /* _____ _ */ -/* parse/mcsraw.c |_ _|__ _ _| |__ ___ _ _ */ +/* parse/storage.c |_ _|__ _ _| |__ ___ _ _ */ /* | Project: libg1m | |/ _ \| | | | '_ \ / _ \ | | | */ /* | | (_) | |_| | | | | __/ |_| | */ /* By: thomas |_|\___/ \__,_|_| |_|\___|\__, |.fr */ @@ -10,8 +10,8 @@ #include /** - * g1m_parse_mcsraw: - * Parse archives. + * g1m_parse_storage: + * Parse storage files. * * @arg handle the libg1m handle. * @arg stream the stream to read from. @@ -19,7 +19,7 @@ * @return the error code (0 if ok). */ -int g1m_parse_mcsraw(g1m_t *handle, FILE *stream, +int g1m_parse_storage(g1m_t *handle, FILE *stream, struct standard_header *std) { (void)std; @@ -27,8 +27,8 @@ int g1m_parse_mcsraw(g1m_t *handle, FILE *stream, SKIP(0x270000 - sizeof(struct standard_header)) /* then read and stuff... not yet. */ - log_error("Raw MCS archives are not managed yet."); - (void)handle; + log_error("Storage files are not managed yet."); + handle->type = 0x00; /* no error */ return (0); diff --git a/src/utils/type.c b/src/utils/type.c index 1d09195..7413a3c 100644 --- a/src/utils/type.c +++ b/src/utils/type.c @@ -121,7 +121,7 @@ struct ext_corresp { /* Extension correspondances */ static struct ext_corresp ext_types[] = { /* raw MCS */ - {"g1s", "Raw Bfile backup", g1m_platform_fx_raw, g1m_type_mcs}, + {"g1s", "Storage file", g1m_platform_none, g1m_type_storage}, /* fx types with non-checked header */ {"g1l", "fx language file", g1m_platform_fx, g1m_type_lang},