cake
/
libg1m
Archived
1
0
Fork 0
This repository has been archived on 2024-03-16. You can view files and clone it, but cannot push or open issues or pull requests.
libg1m/include/libg1m/format/lang.h

135 lines
3.9 KiB
C

/* ************************************************************************** */
/* _____ _ */
/* libg1m/format/lang.h |_ _|__ _ _| |__ ___ _ _ */
/* | Project: libg1m | |/ _ \| | | | '_ \ / _ \ | | | */
/* | | (_) | |_| | | | | __/ |_| | */
/* By: thomas <thomas@touhey.fr> |_|\___/ \__,_|_| |_|\___|\__, |.fr */
/* Last updated: 2016/11/24 17:56:34 |___/ */
/* */
/* ************************************************************************** */
#ifndef LIBG1M_FORMAT_LANG_H
# define LIBG1M_FORMAT_LANG_H
# include <libg1m.h>
# pragma pack(1)
/* ************************************************************************** */
/* G1L - Language files for fx calculators */
/* ************************************************************************** */
/* It all starts with a header: */
struct g1l_subheader {
/* identifier: is "PowerUSB" on original things */
uint8_t identifier[8];
/* OS information (raw binary format), e.g. 0x02,0x09 for 2.09. */
uint8_t os_major;
uint8_t os_minor;
/* unknown bytes */
uint8_t _unknown[2];
/* message count */
uint16_t message_count;
};
/* Then comes a list of offsets, and the messages.
*
* Each element of the offsets list is 16-bytes long.
* It is relative to the first element (which starts right after the
* offsets list - no alignment).
*
* The messages are null-terminated - once you get the offsets, you get
* them completely. */
/* ************************************************************************** */
/* G3L - Language files for Prizm */
/* ************************************************************************** */
/* Thanks to amazonka for his (minimalist) description of the G3L format
* at Cemetech. So the G3L format starts off with a header: */
struct g3l_subheader {
/* a checksum */
uint32_t checksum;
/* magic:
* - 0x04, 0x01, 0x00, 0x00 for language files;
* - 0x02, 0x01, 0x00, 0x00 for function key files. */
uint8_t magic[4];
/* lol */
uint8_t undocumented[14];
/* size of the message zone size - unreliable (valid could have zero) */
uint32_t message_zone_size;
/* undocumented, again */
uint8_t undocumented5[6];
/* name of the language */
uint8_t language_name2[28];
/* size of the entire file */
uint32_t filesize;
/* size of the entire file - starts with an '@' */
uint8_t internal_name[8];
/* undocumented */
uint8_t undocumented2[200];
/* version number string: "XX.XX.XXXX" */
uint8_t version[10];
/* unused */
uint8_t unused2[2];
/* creation time: "YYYY.MMDD.HHMM" */
uint8_t datetime[14];
/* big undocumented thing */
uint8_t undocumented3[3410];
/* language name (zero terminated) */
uint8_t language_name[16];
/* language salutation (zero terminated) */
uint8_t language_salutation[16];
/* filename (extension included) */
uint8_t g3l_filename[16];
/* undocumented */
uint8_t undocumented4[308];
};
/* Then there is something amazonka names the "executable code section".
* This is in fact the message zone. */
struct g3l_lang_header {
/* sequence: '4C 59 37 35 35 00 00 00 02' (LY755 ) */
uint8_t sequence[9];
/* unused byte. */
uint8_t unused;
/* number of messages ("possibly 0 base indexed") */
uint32_t num;
/* unused bytes */
uint8_t unused2[2];
};
/* Then we have offsets of all messages (4 bytes each),
* then messages themselves, zero-terminated.
*
* The four last bytes of the files are a little footer, which is: */
struct g3l_footer {
/* copy of the first checksum in the subheader */
uint32_t checksum;
};
/* This footer is not counted as part of the file. */
# pragma pack()
#endif /* LIBG1M_FORMAT_LANG_H */