/* ***************************************************************************** * libg1m/format/std/mcs.h -- the G1M MCS file format description. * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey * * 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 . * ************************************************************************** */ #ifndef LIBG1M_FORMAT_STD_MCS_H # define LIBG1M_FORMAT_STD_MCS_H # include # pragma pack(1) /* MCS is the main filesystem on CASIO calculators. They contain settings, * programs, lists, pictures, captures, matrixes, and other data CASIO * calculators own. * Keep in mind that all numbers in the MCS format are BCD-encoded. * Because of some precision issue (0.3), we'll deliver them to the user * almost as is. * * MCS files have a group, a directory, a name and a type. This type depends * on the group it's in. So for example, the 0xFE type in the 'S-SHEET' group * will correspond to a spreadsheet! In an MCS G1M file, files are more or less * regrouped by their group (but sometimes they're not, there are several * 'PROGRAM' groups with one element for example). * * The `number` field in the Standard Header corresponds to the total number * of MCS files, not group instances! * * Each group instance have a header, and here it is: */ struct mcs_subheader { /* group name (e.g. "PROGRAM", zero padded) */ uint8_t intname[16]; /* subitem count */ uint32_t subcount; }; /* Then follows the files, with their headers and contents. * And the header iiiiiiis: */ struct mcs_fileheader { /* the directory name (zero-padded).*/ uint8_t dirname[8]; /* the file name (item name) */ uint8_t filename[8]; /* the file type. */ uint8_t filetype; /* the size of the part data, without the part header. */ uint32_t datalength; /* some alignment */ uint8_t align[3]; }; # pragma pack() /* Beneath the file header, the file have different structures according to * their group name and MCS type. Pick your poison, once again! */ # include # include # include # include # include # include #endif /* LIBG1M_FORMAT_STD_MCS_H */