aboutsummaryrefslogtreecommitdiff
path: root/include/libcasio/format/fxi.h.draft
blob: 438a94f74cbe45d4400c03bf0f25f30be7a69dc8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/* ****************************************************************************
 * libcasio/format/fxi.h -- the FXI file format description.
 * Copyright (C) 2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
 *
 * This file is part of libcasio.
 * libcasio 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.
 *
 * libcasio 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 libcasio; if not, see <http://www.gnu.org/licenses/>.
 * ************************************************************************* */
#ifndef  LIBCASIO_FORMAT_FXI_H
# define LIBCASIO_FORMAT_FXI_H
# include "../cdefs.h"
# pragma pack(1)
CASIO_BEGIN_NAMESPACE

/* FXI is obfuscated with a symetrical obfuscation algorithm:
 *		byte = byte ^ ~24;
 *
 * Once the format is deobfuscated, this is the header structure: */

typedef struct casio_fxi_header_s {
	/* unknown - probably part of the magic? "\xD5\xD7\x1F" "f" */
	casio_uint8_t  _unknown[4];

	/* description: the description of the format (probably part of the
	 * magic too): "FX-INTERFACE - YELLOW COMPUTING" */
	casio_uint8_t  description[31];
	casio_uint8_t  _unused[40];

	/* the number of meta entries */
	casio_uint8_t  num;
	casio_uint8_t  _unused2[80];

	/* sum of the number of meta entries and records */
	casio_uint16_t sum;
	casio_uint8_t  _unused3;

	/* 0xFF, 0xFF, 0, 0, 0x0F, 0 */
	casio_uint8_t  _blackmagic[6];

	/* board type? CY */
	casio_uint8_t  board[2];

	/* introduction? */
	casio_uint8_t  type[11];
} casio_fxi_header_t;

/* Then come the meta-entries, which have this structure: */

typedef struct casio_fxi_entry_s {
	/* entry type: first type is 'NP', then {0x01, 0x80}. */
	casio_uint8_t  type[2];
	casio_uint8_t  _unused[2];

	/* entry number */
	casio_uint8_t  number;
	casio_uint8_t  _unused2[3];

	/* unknown: either 0x00, 0x01, 0x02 */
	casio_uint8_t  _unknown;
	casio_uint8_t  _unused3;

	/* unknown: either 0x00, 0x02, 0x03 */
	casio_uint8_t  _unknown2;
	casio_uint8_t  _unused4;

	/* unknown: checksum? */
	casio_uint16_t checksum;
	casio_uint8_t  _unused5[2];

	/* unknown: some sort of type? */
	casio_uint8_t  typeid;
	casio_uint8_t  _unused6;

	/* size of the file name */
	casio_uint8_t  filename_size;

	/* TODO: finish me */
} casio_fxi_entry_t;

CASIO_END_NAMESPACE
# pragma pack()
#endif