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/addin.h

204 lines
5.4 KiB
C

/* *****************************************************************************
* libg1m/format/addin.h -- the G1M add-in format description.
* Copyright (C) 2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libg1m.
* libg1m is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libg1m is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libg1m; if not, see <http://www.gnu.org/licenses/>.
* ************************************************************************** */
#ifndef LIBG1M_FORMAT_ADDIN_H
# define LIBG1M_FORMAT_ADDIN_H
# include <stdint.h>
# pragma pack(1)
/* Add-ins are compiled programs. They only have one G1M part,
* These add-ins usually have the `g1a`, `g3a` or `c1a` extension. */
/* ************************************************************************** */
/* Legacy fx systems add-ins (G1A) */
/* ************************************************************************** */
/* G1A subheader is the following: */
# define G1A_ICON_WIDTH 30
# define G1A_ICON_HEIGHT 17
struct g1a_subheader {
/* the internal name, of format "@APPNAME".
* useful for add-ins calling themselves... I guess? */
uint8_t internal_name[8];
/* spacing */
uint8_t _spacing[3];
/* the number of estrips (I don't know yet) */
uint8_t estrips_count;
/* spacing */
uint8_t _spacing2[4];
/* the add-in version, of format "01.23.4567"
* the "01.23" will be displayed in SYSTEM > VERSION */
uint8_t version[10];
/* spacing */
uint8_t _spacing3[2];
/* the add-in creation type, of format "YYYY.MMDD.HHMM" */
uint8_t creation_date[14];
/* spacing */
uint8_t _spacing4[2];
/* 30x17 pixel menu icon bitmap */
uint8_t icon[68];
/* spacing */
uint8_t _spacing5[0x144];
/* program title */
uint8_t title[8];
/* spacing */
uint8_t _spacing6[0x14];
/* and the filesize of the part! */
uint32_t filesize;
/* spacing */
uint8_t _spacing7[0xc];
};
/* Then the G1A file will just contain the add-in code and stop. */
/* ************************************************************************** */
/* Classpad and Prizm add-ins (C1A, G3A) */
/* ************************************************************************** */
/* The two formats are identified the same way in the standard header, but
* some of the header parts are different, until the header just stops being
* the same.
*
* Here's the common parts of their headers: */
struct addin_cp_subheader {
/* byte checksum: 0x0000 to 0x001F (standard header)
* and 0x0024 to EOF (everything after this checksum), minus 4. */
uint32_t checksum;
/* magic sequence to identify addin type:
* - {0x01, 0x01} for the Prizm (G3A);
* - {0x01, 0x00} for C1A. */
uint8_t magic[2];
/* undocumented */
uint8_t _unknown[8];
/* control:
* - for a G3A: filesize - 0x7000 - 4
* - for a C1A: filesize - 0x1000 - 4*/
uint32_t control;
/* undocumented */
uint8_t _unknown2[8];
/* for C1A: "GY437" */
uint8_t model[6];
/* title (zero terminated) */
uint8_t title[16];
/* undocumented */
uint8_t undocumented3[12];
/* filesize */
uint32_t filesize;
/* internal name (preceded by @, filled up with zeros */
uint8_t internal_name[11];
/* language labels */
uint8_t language_1_label[24];
uint8_t language_2_label[24];
uint8_t language_3_label[24];
uint8_t language_4_label[24];
uint8_t language_5_label[24];
uint8_t language_6_label[24];
uint8_t language_7_label[24];
uint8_t language_8_label[24];
/* eAct strip flag (0x00: cannot be used, 0x01: can be used) */
uint8_t eact_strip_flag;
/* some null bytes */
uint8_t zeroes[4];
/* version: "01.00.0000" then zeroes */
uint8_t version[12];
/* timestamp: "2012.0903.1652" */
uint8_t stamp[14];
};
/* Then from here, the two formats diverge.
* G3A subheader goes like this: */
# define G3A_ICON_WIDTH 92
# define G3A_ICON_HEIGHT 64
struct g3a_subheader {
/* null bytes, again */
uint8_t zeroes2[38];
/* eAct strip labels */
uint8_t eact_strip_label_1[36];
uint8_t eact_strip_label_2[36];
uint8_t eact_strip_label_3[36];
uint8_t eact_strip_label_4[36];
uint8_t eact_strip_label_5[36];
uint8_t eact_strip_label_6[36];
uint8_t eact_strip_label_7[36];
uint8_t eact_strip_label_8[36];
/* eAct icon */
uint8_t icon[0x300];
/* unused */
uint8_t unused[0x92c];
/* G3A filename (seriously?!) */
uint8_t g3a_filename[0x144];
/* selected and unselected icon image */
uint8_t selected_icon_image[0x3000];
uint8_t unselected_icon_image[0x3000];
};
/* And the C1A header goes like this: */
# define C1A_ICON_WIDTH 46
# define C1A_ICON_HEIGHT 30
struct c1a_subheader {
/* unknown bytes */
uint8_t _unknown[0x46];
/* the C1A filename - the size is guessed with the other formats aside. */
uint8_t filename[0x144];
/* again, unknown bytes */
uint8_t _unknown2[0x2C];
/* this is an approximation (46x30 pixels, packed 1-bit) */
uint8_t icon[172];
/* unknown */
uint8_t _unknown3[0xC54];
};
# pragma pack()
#endif /* LIBG1M_FORMAT_ADDIN_H */