@gaialabs/core 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +6598 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2452 -0
- package/dist/index.d.mts +1590 -1508
- package/dist/index.mjs +5880 -6649
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -11
- package/dist/index.d.ts +0 -2370
- package/dist/index.js +0 -7368
- package/dist/index.js.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,174 +1,135 @@
|
|
|
1
|
-
import { SupabaseClient } from
|
|
1
|
+
import { SupabaseClient } from "@supabase/supabase-js";
|
|
2
2
|
|
|
3
|
+
//#region src/rom/state.d.ts
|
|
3
4
|
/**
|
|
4
5
|
* Lightweight ROM state placeholder used during early development.
|
|
5
6
|
* This stub will be expanded as the ROM extraction pipeline matures.
|
|
6
7
|
*/
|
|
7
8
|
declare class RomState {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
readonly cgram: Uint8Array<ArrayBuffer>;
|
|
10
|
+
readonly vram: Uint8Array<ArrayBuffer>;
|
|
11
|
+
/**
|
|
12
|
+
* Create ROM state from scene metadata.
|
|
13
|
+
* Parameters are currently unused but kept for future implementation.
|
|
14
|
+
*/
|
|
15
|
+
static fromScene(_baseDir: string, _root: unknown, _metaFile: string, _id: number): Promise<RomState>;
|
|
15
16
|
}
|
|
16
17
|
/**
|
|
17
18
|
* Utility helpers for working with RomState.
|
|
18
19
|
*/
|
|
19
20
|
declare class RomStateUtils {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
/** Create an empty ROM state */
|
|
22
|
+
static createEmpty(): RomState;
|
|
23
|
+
/** Clear all data in the given ROM state */
|
|
24
|
+
static clear(state: RomState): void;
|
|
24
25
|
}
|
|
25
|
-
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/assembly/Stack.d.ts
|
|
26
28
|
/**
|
|
27
29
|
* Represents the stack for the 65816 processor
|
|
28
30
|
*/
|
|
29
31
|
declare class Stack {
|
|
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
|
-
* Manages the 65816 processor registers and status flags
|
|
57
|
-
*/
|
|
58
|
-
declare class Registers {
|
|
59
|
-
value: Record<string, number>;
|
|
60
|
-
stack: Stack;
|
|
61
|
-
constructor();
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
declare class MapExt<K, V> extends Map<K, V> {
|
|
65
|
-
constructor();
|
|
66
|
-
tryAdd(key: K, value: V): boolean;
|
|
67
|
-
setFlag(key: K, flag: number, value?: boolean): void;
|
|
68
|
-
clearFlag(key: K, flag: number): void;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Manages CPU processor state during ROM analysis
|
|
72
|
-
* Converted from GaiaLib/Rom/Extraction/ProcessorStateManager.cs
|
|
73
|
-
*/
|
|
74
|
-
declare class ProcessorStateManager {
|
|
75
|
-
readonly stackPositions: MapExt<number, number>;
|
|
76
|
-
private readonly _buckets;
|
|
77
|
-
get(key: string): MapExt<number, number>;
|
|
78
|
-
/**
|
|
79
|
-
* Hydrate processor registers with stored state
|
|
80
|
-
* Uses Registers from gaia-core/assembly for processor state management
|
|
81
|
-
*/
|
|
82
|
-
hydrateRegisters(position: number, reg: Registers): void;
|
|
83
|
-
getStackPosition(location: number): number | undefined;
|
|
84
|
-
setStackPosition(location: number, value: number): void;
|
|
85
|
-
tryAddStackPosition(location: number, value: number): boolean;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Provides low-level ROM data reading functionality
|
|
90
|
-
* Converted from GaiaLib/Rom/Extraction/RomDataReader.cs
|
|
91
|
-
*/
|
|
92
|
-
declare class RomDataReader {
|
|
93
|
-
readonly romData: Uint8Array;
|
|
94
|
-
position: number;
|
|
95
|
-
constructor(romData: Uint8Array);
|
|
96
|
-
readByte(): number;
|
|
97
|
-
readSByte(): number;
|
|
98
|
-
readUShort(): number;
|
|
99
|
-
readShort(): number;
|
|
100
|
-
readAddress(): number;
|
|
101
|
-
readInt(): number;
|
|
102
|
-
peekByte(): number;
|
|
103
|
-
peekShort(): number;
|
|
104
|
-
peekAddress(): number;
|
|
105
|
-
}
|
|
106
|
-
|
|
32
|
+
bytes: Uint8Array;
|
|
33
|
+
location: number;
|
|
34
|
+
constructor();
|
|
35
|
+
/**
|
|
36
|
+
* Push a byte onto the stack
|
|
37
|
+
*/
|
|
38
|
+
push(value: number): void;
|
|
39
|
+
/**
|
|
40
|
+
* Push a 16-bit value onto the stack (little-endian)
|
|
41
|
+
*/
|
|
42
|
+
pushUInt16(value: number): void;
|
|
43
|
+
/**
|
|
44
|
+
* Pop a byte from the stack
|
|
45
|
+
*/
|
|
46
|
+
popByte(): number;
|
|
47
|
+
/**
|
|
48
|
+
* Pop a 16-bit value from the stack (little-endian)
|
|
49
|
+
*/
|
|
50
|
+
popUInt16(): number;
|
|
51
|
+
/**
|
|
52
|
+
* Reset the stack to initial state
|
|
53
|
+
*/
|
|
54
|
+
reset(): void;
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
//#region src/types/addressing.d.ts
|
|
107
58
|
/**
|
|
108
59
|
* Address type classifications
|
|
109
60
|
* Converted from GaiaLib/Enum/AddressType.cs
|
|
110
61
|
*/
|
|
111
62
|
declare enum AddressType {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
63
|
+
Unknown = "Unknown",
|
|
64
|
+
Bank = "Bank",
|
|
65
|
+
Offset = "Offset",
|
|
66
|
+
Address = "Address",
|
|
67
|
+
WBank = "WBank",
|
|
68
|
+
Relative = "Relative",
|
|
69
|
+
Location = "Location",
|
|
118
70
|
}
|
|
119
71
|
/**
|
|
120
72
|
* Address space types
|
|
121
73
|
* Converted from GaiaLib/Types/Address.cs
|
|
122
74
|
*/
|
|
123
75
|
declare enum AddressSpace {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
76
|
+
None = "None",
|
|
77
|
+
ROM = "ROM",
|
|
78
|
+
WRAM = "WRAM",
|
|
79
|
+
SRAM = "SRAM",
|
|
80
|
+
System = "System",
|
|
81
|
+
}
|
|
82
|
+
declare enum MemoryMapMode {
|
|
83
|
+
Lo = "Lo",
|
|
84
|
+
Hi = "Hi",
|
|
85
|
+
ExHi = "ExHi",
|
|
129
86
|
}
|
|
130
87
|
/**
|
|
131
88
|
* SNES address structure
|
|
132
89
|
* Converted from GaiaLib/Types/Address.cs
|
|
133
90
|
*/
|
|
134
91
|
declare class Address {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
92
|
+
offset: number;
|
|
93
|
+
bank: number;
|
|
94
|
+
mode: MemoryMapMode;
|
|
95
|
+
static readonly UPPER_BANK = 32768;
|
|
96
|
+
static readonly DATA_BANK_FLAG = 64;
|
|
97
|
+
static readonly FAST_BANK_FLAG = 128;
|
|
98
|
+
constructor(bank: number, offset: number, mode: MemoryMapMode);
|
|
99
|
+
get isROM(): boolean;
|
|
100
|
+
get isCodeBank(): boolean;
|
|
101
|
+
toInt(): number;
|
|
102
|
+
static fromInt(value: number, mode: MemoryMapMode): Address;
|
|
103
|
+
static resolveBank(value: number, mode: MemoryMapMode): number;
|
|
104
|
+
toString(): string;
|
|
105
|
+
static typeFromCode(code: string): AddressType;
|
|
106
|
+
static codeFromType(type: AddressType): string | null;
|
|
107
|
+
}
|
|
108
|
+
//#endregion
|
|
109
|
+
//#region src/types/members.d.ts
|
|
151
110
|
/**
|
|
152
111
|
* Member type definitions for data structures
|
|
153
112
|
* Converted from GaiaLib/Enum/MemberType.cs
|
|
154
113
|
*/
|
|
155
114
|
declare enum MemberType {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
115
|
+
Byte = "Byte",
|
|
116
|
+
Word = "Word",
|
|
117
|
+
Offset = "Offset",
|
|
118
|
+
Address = "Address",
|
|
119
|
+
Binary = "Binary",
|
|
120
|
+
Code = "Code",
|
|
121
|
+
Location = "Location",
|
|
162
122
|
}
|
|
163
|
-
|
|
123
|
+
//#endregion
|
|
124
|
+
//#region src/types/processor.d.ts
|
|
164
125
|
/**
|
|
165
126
|
* Processor register type definitions
|
|
166
127
|
* Converted from GaiaLib/Enum/RegisterType.cs
|
|
167
128
|
*/
|
|
168
129
|
declare enum RegisterType {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
130
|
+
M = "M",
|
|
131
|
+
X = "X",
|
|
132
|
+
B = "B",
|
|
172
133
|
}
|
|
173
134
|
/**
|
|
174
135
|
* Status flags for 65816 processor
|
|
@@ -185,198 +146,207 @@ declare enum RegisterType {
|
|
|
185
146
|
* c = Carry
|
|
186
147
|
*/
|
|
187
148
|
declare enum StatusFlags {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
}
|
|
238
|
-
|
|
149
|
+
/**
|
|
150
|
+
* Clear before starting addition or subtraction.
|
|
151
|
+
* Arithmetic overflow:
|
|
152
|
+
* [addition - carry out of high bit:]
|
|
153
|
+
* 0 = no carry
|
|
154
|
+
* 1 = carry
|
|
155
|
+
* [subtraction - borrow required to subtract:]
|
|
156
|
+
* 0 = borrow required
|
|
157
|
+
* 1 = no borrow required
|
|
158
|
+
* [Logic:]
|
|
159
|
+
* receives bit shifted or rotated out;
|
|
160
|
+
* source of bit rotated in
|
|
161
|
+
*/
|
|
162
|
+
Carry = 1,
|
|
163
|
+
/**
|
|
164
|
+
* Indicates zero or non-zero result:
|
|
165
|
+
* 0 = non-zero result
|
|
166
|
+
* 1 = zero result
|
|
167
|
+
*/
|
|
168
|
+
Zero = 2,
|
|
169
|
+
/**
|
|
170
|
+
* Enables or disables processor's IRQ interrupt line:
|
|
171
|
+
* Set to disable interrupts by masking the IRQ line
|
|
172
|
+
* Clear to enable IRQ interrupts
|
|
173
|
+
*/
|
|
174
|
+
IrqDisable = 4,
|
|
175
|
+
/**
|
|
176
|
+
* Determines mode for add/subtract (not increment/decrement, though):
|
|
177
|
+
* Set to force decimal operation (BCD)
|
|
178
|
+
* Clear to return to binary operation
|
|
179
|
+
*/
|
|
180
|
+
DecimalMode = 8,
|
|
181
|
+
IndexMode = 16,
|
|
182
|
+
AccumulatorMode = 32,
|
|
183
|
+
/**
|
|
184
|
+
* Clear to reverse "set-overflow" hardware input.
|
|
185
|
+
* Indicates invalid carry into high bit of arithmetic
|
|
186
|
+
* result (two's-complement overflow):
|
|
187
|
+
* 0 = two's-complement result ok
|
|
188
|
+
* 1 = error if two's-complement arithmetic
|
|
189
|
+
*/
|
|
190
|
+
Overflow = 64,
|
|
191
|
+
/**
|
|
192
|
+
* Reflects most significant bit of result
|
|
193
|
+
* (the sign of a two's-complement binary number):
|
|
194
|
+
* 0 = high bit clear (positive result)
|
|
195
|
+
* 1 = high bit set (negative result)
|
|
196
|
+
*/
|
|
197
|
+
Negative = 128,
|
|
198
|
+
}
|
|
199
|
+
//#endregion
|
|
200
|
+
//#region src/types/resources.d.ts
|
|
239
201
|
/**
|
|
240
202
|
* Binary resource type definitions
|
|
241
203
|
* Converted from GaiaLib/Enum/BinType.cs
|
|
242
204
|
*/
|
|
243
205
|
declare enum BinType {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
}
|
|
257
|
-
|
|
206
|
+
Bitmap = "Bitmap",
|
|
207
|
+
Tilemap = "Tilemap",
|
|
208
|
+
Tileset = "Tileset",
|
|
209
|
+
Palette = "Palette",
|
|
210
|
+
Sound = "Sound",
|
|
211
|
+
Music = "Music",
|
|
212
|
+
Unknown = "Unknown",
|
|
213
|
+
Meta17 = "Meta17",
|
|
214
|
+
Spritemap = "Spritemap",
|
|
215
|
+
Assembly = "Assembly",
|
|
216
|
+
Patch = "Patch",
|
|
217
|
+
Transform = "Transform",
|
|
218
|
+
}
|
|
219
|
+
//#endregion
|
|
220
|
+
//#region src/types/transforms.d.ts
|
|
258
221
|
/**
|
|
259
222
|
* Transform type definitions
|
|
260
223
|
* Converted from GaiaLib/Enum/XformType.cs
|
|
261
224
|
*/
|
|
262
225
|
declare enum XformType {
|
|
263
|
-
|
|
264
|
-
|
|
226
|
+
Lookup = "Lookup",
|
|
227
|
+
Replace = "Replace",
|
|
265
228
|
}
|
|
266
229
|
/**
|
|
267
230
|
* Transform definition
|
|
268
231
|
* Converted from GaiaLib/Types/XformDef.cs
|
|
269
232
|
*/
|
|
270
233
|
interface XformDef {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
}
|
|
277
|
-
|
|
234
|
+
type: XformType;
|
|
235
|
+
key?: string;
|
|
236
|
+
value?: string;
|
|
237
|
+
keyIx?: number;
|
|
238
|
+
valueIx?: number;
|
|
239
|
+
}
|
|
240
|
+
//#endregion
|
|
241
|
+
//#region src/database/files.d.ts
|
|
278
242
|
declare class DbFile {
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
243
|
+
name: string;
|
|
244
|
+
type: string;
|
|
245
|
+
start: number;
|
|
246
|
+
end: number;
|
|
247
|
+
compressed?: boolean;
|
|
248
|
+
upper?: boolean;
|
|
249
|
+
group?: string;
|
|
250
|
+
scene?: string;
|
|
251
|
+
constructor(data: Partial<DbFile>);
|
|
288
252
|
}
|
|
289
253
|
declare class DbFileType {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
254
|
+
name: string;
|
|
255
|
+
extension: string;
|
|
256
|
+
type: string;
|
|
257
|
+
isPatch: boolean;
|
|
258
|
+
isBlock: boolean;
|
|
259
|
+
header: number;
|
|
260
|
+
constructor(data: Partial<DbFileType>);
|
|
297
261
|
}
|
|
298
|
-
|
|
262
|
+
//#endregion
|
|
263
|
+
//#region src/database/parts.d.ts
|
|
299
264
|
/**
|
|
300
265
|
* Database part definition
|
|
301
266
|
* Converted from GaiaLib/Database/DbPart.cs
|
|
302
267
|
*/
|
|
303
268
|
declare class DbPart {
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
}
|
|
312
|
-
|
|
269
|
+
name: string;
|
|
270
|
+
start: number;
|
|
271
|
+
end: number;
|
|
272
|
+
type: string;
|
|
273
|
+
bank?: number;
|
|
274
|
+
order?: number;
|
|
275
|
+
constructor(data: Partial<DbPart>);
|
|
276
|
+
}
|
|
277
|
+
//#endregion
|
|
278
|
+
//#region src/database/transforms.d.ts
|
|
313
279
|
declare class DbTransform {
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
280
|
+
key: string;
|
|
281
|
+
value: string;
|
|
282
|
+
constructor(data: Partial<DbTransform>);
|
|
317
283
|
}
|
|
318
|
-
|
|
284
|
+
//#endregion
|
|
285
|
+
//#region src/database/blocks.d.ts
|
|
319
286
|
/**
|
|
320
287
|
* Database block definition
|
|
321
288
|
* Converted from GaiaLib/Database/DbBlock.cs
|
|
322
289
|
*/
|
|
323
290
|
declare class DbBlock {
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
291
|
+
name: string;
|
|
292
|
+
movable: boolean;
|
|
293
|
+
group?: string;
|
|
294
|
+
scene?: string;
|
|
295
|
+
parts: DbPart[];
|
|
296
|
+
transforms?: DbTransform[];
|
|
297
|
+
postProcess?: string;
|
|
298
|
+
order?: number;
|
|
299
|
+
constructor(data: Partial<DbBlock>);
|
|
300
|
+
}
|
|
301
|
+
//#endregion
|
|
302
|
+
//#region src/types/compression.d.ts
|
|
334
303
|
/**
|
|
335
304
|
* Interface for compression providers
|
|
336
305
|
*/
|
|
337
306
|
interface ICompressionProvider {
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
}
|
|
353
|
-
|
|
307
|
+
/**
|
|
308
|
+
* Expand (decompress) data
|
|
309
|
+
* @param srcData Source data buffer
|
|
310
|
+
* @param srcPosition Starting position in source data
|
|
311
|
+
* @param srcLen Length of source data to process
|
|
312
|
+
* @returns Expanded data
|
|
313
|
+
*/
|
|
314
|
+
expand(srcData: Uint8Array, srcPosition?: number, srcLen?: number): Uint8Array;
|
|
315
|
+
/**
|
|
316
|
+
* Compact (compress) data
|
|
317
|
+
* @param srcData Source data to compress
|
|
318
|
+
* @returns Compressed data
|
|
319
|
+
*/
|
|
320
|
+
compact(srcData: Uint8Array): Uint8Array;
|
|
321
|
+
}
|
|
322
|
+
//#endregion
|
|
323
|
+
//#region src/types/files.d.ts
|
|
354
324
|
/**
|
|
355
325
|
* Chunk file for ROM processing
|
|
356
326
|
* Converted from GaiaLib/Types/ChunkFile.cs
|
|
357
327
|
*/
|
|
358
328
|
declare class ChunkFile {
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
329
|
+
name: string;
|
|
330
|
+
size: number;
|
|
331
|
+
location: number;
|
|
332
|
+
type: DbFileType;
|
|
333
|
+
parts?: AsmBlock[];
|
|
334
|
+
includes?: Set<string>;
|
|
335
|
+
includeLookup?: Map<string, AsmBlock>;
|
|
336
|
+
bank?: number;
|
|
337
|
+
compressed?: boolean;
|
|
338
|
+
upper?: boolean;
|
|
339
|
+
rawData?: Uint8Array | null;
|
|
340
|
+
textData?: string;
|
|
341
|
+
transforms?: {
|
|
342
|
+
key: string;
|
|
343
|
+
value: string;
|
|
344
|
+
}[];
|
|
345
|
+
postProcess?: string;
|
|
346
|
+
mnemonics: Record<number, string>;
|
|
347
|
+
group?: string;
|
|
348
|
+
scene?: string;
|
|
349
|
+
constructor(name: string, size: number, location: number, type: DbFileType);
|
|
380
350
|
}
|
|
381
351
|
declare function createChunkFileFromDbFile(rom: Uint8Array, compression: ICompressionProvider, dbFile: DbFile, fileType: DbFileType): ChunkFile;
|
|
382
352
|
declare function createChunkFileFromDbBlock(block: DbBlock, fileType: DbFileType): ChunkFile;
|
|
@@ -384,1642 +354,1752 @@ declare function createChunkFileFromDbBlock(block: DbBlock, fileType: DbFileType
|
|
|
384
354
|
* Chunk file utilities
|
|
385
355
|
*/
|
|
386
356
|
declare class ChunkFileUtils {
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
}
|
|
418
|
-
|
|
357
|
+
/**
|
|
358
|
+
* Rebase blocks to a new location
|
|
359
|
+
*/
|
|
360
|
+
static rebase(chunkFile: ChunkFile, newLocation?: number): void;
|
|
361
|
+
/**
|
|
362
|
+
* Calculate the total size of all blocks
|
|
363
|
+
*/
|
|
364
|
+
static calculateSize(chunkFile: ChunkFile): number;
|
|
365
|
+
/**
|
|
366
|
+
* Check if a location is outside this block and return the part (matches C# IsOutside)
|
|
367
|
+
* Returns [isOutside, part] where part is the part containing the location
|
|
368
|
+
*/
|
|
369
|
+
static isOutsideWithPart(root: ChunkFile[], block: ChunkFile, location: number): [boolean, ChunkFile | null, AsmBlock | null];
|
|
370
|
+
/**
|
|
371
|
+
* Check if a location is inside this block and return the part (matches C# IsInside)
|
|
372
|
+
* Returns [isInside, part] where part is the part containing the location
|
|
373
|
+
*/
|
|
374
|
+
static isInsideWithPart(block: ChunkFile, location: number): [boolean, AsmBlock | null];
|
|
375
|
+
/**
|
|
376
|
+
* Check if a location is outside this block (shorthand version)
|
|
377
|
+
*/
|
|
378
|
+
static isOutside(block: ChunkFile, location: number): boolean;
|
|
379
|
+
/**
|
|
380
|
+
* Check if a location is inside this block (shorthand version)
|
|
381
|
+
*/
|
|
382
|
+
static isInside(block: ChunkFile, location: number): boolean;
|
|
383
|
+
/**
|
|
384
|
+
* Get all included blocks
|
|
385
|
+
*/
|
|
386
|
+
static getIncludes(chunkFile: ChunkFile): ChunkFile[];
|
|
387
|
+
}
|
|
388
|
+
//#endregion
|
|
389
|
+
//#region src/database/cop.d.ts
|
|
419
390
|
/**
|
|
420
391
|
* COP instruction definition
|
|
421
392
|
* Converted from GaiaLib/Database/CopDef.cs
|
|
422
393
|
*/
|
|
423
394
|
declare class CopDef {
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
}
|
|
431
|
-
|
|
395
|
+
id: number;
|
|
396
|
+
name: string;
|
|
397
|
+
size: number;
|
|
398
|
+
parts: string[];
|
|
399
|
+
halt: boolean;
|
|
400
|
+
constructor(data: Partial<CopDef>);
|
|
401
|
+
}
|
|
402
|
+
//#endregion
|
|
403
|
+
//#region src/database/opcode.d.ts
|
|
432
404
|
declare class OpCode {
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
405
|
+
code: number;
|
|
406
|
+
mnem: string;
|
|
407
|
+
mode: string;
|
|
408
|
+
constructor(code: number, mnem: string, mode: string);
|
|
437
409
|
}
|
|
438
|
-
|
|
410
|
+
//#endregion
|
|
411
|
+
//#region src/types/assembly.d.ts
|
|
439
412
|
/**
|
|
440
413
|
* Represents a single assembly operation/instruction
|
|
441
414
|
*/
|
|
442
415
|
declare class Op extends OpCode {
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
416
|
+
location: number;
|
|
417
|
+
operands: unknown[];
|
|
418
|
+
size: number;
|
|
419
|
+
copDef?: CopDef;
|
|
420
|
+
constructor(code: OpCode, location?: number, operands?: unknown[], size?: number);
|
|
448
421
|
}
|
|
449
422
|
/**
|
|
450
423
|
* Represents a block of assembly code or data
|
|
451
424
|
*/
|
|
452
425
|
declare class AsmBlock {
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
426
|
+
label?: string;
|
|
427
|
+
location: number;
|
|
428
|
+
size: number;
|
|
429
|
+
isString: boolean;
|
|
430
|
+
objList: any[];
|
|
431
|
+
structName?: string;
|
|
432
|
+
bank?: number;
|
|
433
|
+
includes?: Set<{
|
|
434
|
+
block: ChunkFile;
|
|
435
|
+
part: AsmBlock;
|
|
436
|
+
}>;
|
|
437
|
+
constructor(location?: number, size?: number, isString?: boolean, label?: string, structName?: string, bank?: number);
|
|
465
438
|
}
|
|
466
439
|
/**
|
|
467
440
|
* Database part utilities
|
|
468
441
|
*/
|
|
469
442
|
declare class AsmBlockUtils {
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
}
|
|
479
|
-
|
|
443
|
+
/**
|
|
444
|
+
* Check if a location is inside this part
|
|
445
|
+
*/
|
|
446
|
+
static isInside(part: AsmBlock, location: number): boolean;
|
|
447
|
+
/**
|
|
448
|
+
* Check if a location is outside this part
|
|
449
|
+
*/
|
|
450
|
+
static isOutside(part: AsmBlock, location: number): boolean;
|
|
451
|
+
}
|
|
452
|
+
//#endregion
|
|
453
|
+
//#region src/types/bitstream.d.ts
|
|
480
454
|
/**
|
|
481
455
|
* Bit stream for reading/writing binary data at bit level
|
|
482
456
|
* Converted from GaiaLib/Types/BitStream.cs
|
|
483
457
|
*/
|
|
484
458
|
declare class BitStream {
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
}
|
|
532
|
-
|
|
459
|
+
private static readonly NIBBLE_MASK;
|
|
460
|
+
private static readonly NIBBLE_PERFECT_POSITION;
|
|
461
|
+
private data;
|
|
462
|
+
private position;
|
|
463
|
+
private bitFlag;
|
|
464
|
+
private writeSample;
|
|
465
|
+
constructor(data: Uint8Array, position?: number);
|
|
466
|
+
get dataArray(): Uint8Array;
|
|
467
|
+
get currentPosition(): number;
|
|
468
|
+
set currentPosition(value: number);
|
|
469
|
+
/**
|
|
470
|
+
* Read a byte from the stream
|
|
471
|
+
* @returns The byte read, or -1 if the end of the data has been reached
|
|
472
|
+
*/
|
|
473
|
+
readByte(): number;
|
|
474
|
+
/**
|
|
475
|
+
* Read a ushort from the stream (ignores the current bit flag)
|
|
476
|
+
* @returns The short read, or -1 if the end of the data has been reached
|
|
477
|
+
*/
|
|
478
|
+
readShort(): number;
|
|
479
|
+
/**
|
|
480
|
+
* Read a bit from the stream
|
|
481
|
+
* @returns True if the current bit at bitFlag is set, false otherwise
|
|
482
|
+
*/
|
|
483
|
+
readBit(): boolean;
|
|
484
|
+
/**
|
|
485
|
+
* Read a nibble from the stream
|
|
486
|
+
* @returns The nibble read, or -1 if the end of the data has been reached
|
|
487
|
+
*/
|
|
488
|
+
readNibble(): number;
|
|
489
|
+
/**
|
|
490
|
+
* Write a bit to the stream
|
|
491
|
+
* @param set True if the current bit should be set, false otherwise
|
|
492
|
+
*/
|
|
493
|
+
writeBit(set: boolean): void;
|
|
494
|
+
/**
|
|
495
|
+
* Write a byte to the stream
|
|
496
|
+
* @param value The byte to write
|
|
497
|
+
*/
|
|
498
|
+
writeByte(value: number): void;
|
|
499
|
+
/**
|
|
500
|
+
* Write a nibble to the stream
|
|
501
|
+
* @param value The nibble to write
|
|
502
|
+
*/
|
|
503
|
+
writeNibble(value: number): void;
|
|
504
|
+
flush(): void;
|
|
505
|
+
}
|
|
506
|
+
//#endregion
|
|
507
|
+
//#region src/types/compression-registry.d.ts
|
|
533
508
|
/**
|
|
534
509
|
* Registry for compression providers
|
|
535
510
|
* Allows registration of compression implementations by string ID
|
|
536
511
|
*/
|
|
537
512
|
declare class CompressionRegistry {
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
}
|
|
567
|
-
|
|
513
|
+
private static providers;
|
|
514
|
+
/**
|
|
515
|
+
* Register a compression provider
|
|
516
|
+
* @param id String identifier for the compression type
|
|
517
|
+
* @param factory Factory function that creates the compression provider
|
|
518
|
+
*/
|
|
519
|
+
static register(id: string, factory: () => ICompressionProvider): void;
|
|
520
|
+
/**
|
|
521
|
+
* Get a compression provider by ID
|
|
522
|
+
* @param id String identifier for the compression type
|
|
523
|
+
* @returns Compression provider instance
|
|
524
|
+
*/
|
|
525
|
+
static get(id: string): ICompressionProvider;
|
|
526
|
+
/**
|
|
527
|
+
* Check if a compression provider is registered
|
|
528
|
+
* @param id String identifier for the compression type
|
|
529
|
+
* @returns True if provider is registered
|
|
530
|
+
*/
|
|
531
|
+
static has(id: string): boolean;
|
|
532
|
+
/**
|
|
533
|
+
* Get list of registered provider IDs
|
|
534
|
+
* @returns Array of registered provider IDs
|
|
535
|
+
*/
|
|
536
|
+
static getRegisteredIds(): string[];
|
|
537
|
+
/**
|
|
538
|
+
* Clear all registered providers (mainly for testing)
|
|
539
|
+
*/
|
|
540
|
+
static clear(): void;
|
|
541
|
+
}
|
|
542
|
+
//#endregion
|
|
543
|
+
//#region src/types/constants.d.ts
|
|
568
544
|
/**
|
|
569
545
|
* ROM processing constants
|
|
570
546
|
* Converted from GaiaLib/Types/RomProcessingConstants.cs
|
|
571
547
|
*/
|
|
572
548
|
declare class RomProcessingConstants {
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
549
|
+
static readonly PAGE_SIZE = 32768;
|
|
550
|
+
static readonly SNES_HEADER_SIZE = 80;
|
|
551
|
+
static readonly DICTIONARIES: string[];
|
|
552
|
+
static readonly DICT_COMMANDS: number[];
|
|
553
|
+
static readonly END_CHARS: number[];
|
|
554
|
+
static readonly WHITESPACE: string[];
|
|
555
|
+
static readonly OPERATORS: string[];
|
|
556
|
+
static readonly COMMA_SPACE: string[];
|
|
557
|
+
static readonly ADDRESS_SPACE: string[];
|
|
558
|
+
static readonly SYMBOL_SPACE: string[];
|
|
559
|
+
static readonly LABEL_SPACE: string[];
|
|
560
|
+
static readonly OBJECT_SPACE: string[];
|
|
561
|
+
static readonly COP_SPLIT_CHARS: string[];
|
|
562
|
+
static readonly WHITESPACE_REGEX: RegExp;
|
|
563
|
+
static readonly COMMA_SPACE_REGEX: RegExp;
|
|
564
|
+
static readonly SYMBOL_SPACE_REGEX: RegExp;
|
|
565
|
+
static readonly LABEL_SPACE_REGEX: RegExp;
|
|
566
|
+
static readonly OBJECT_SPACE_REGEX: RegExp;
|
|
567
|
+
static readonly ADDRESS_SPACE_REGEX: RegExp;
|
|
568
|
+
static readonly COP_SPLIT_REGEX: RegExp;
|
|
569
|
+
static readonly COMMA_SPACE_TRIM_REGEX: RegExp;
|
|
570
|
+
/**
|
|
571
|
+
* Gets the size of an object for processing purposes
|
|
572
|
+
* @param obj The object to get the size for
|
|
573
|
+
* @returns Size in bytes
|
|
574
|
+
* @throws Error when unable to determine size
|
|
575
|
+
*/
|
|
576
|
+
static getSize(obj: unknown): number;
|
|
601
577
|
}
|
|
602
578
|
/**
|
|
603
579
|
* BlockReader specific constants
|
|
604
580
|
*/
|
|
605
581
|
declare class BlockReaderConstants {
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
}
|
|
622
|
-
|
|
582
|
+
static readonly REF_SEARCH_MAX_RANGE = 416;
|
|
583
|
+
static readonly BANK_MASK_CHECK = 64;
|
|
584
|
+
static readonly BYTE_DELIMITER_THRESHOLD = 256;
|
|
585
|
+
static readonly BANK_HIGH_MEMORY_1 = 126;
|
|
586
|
+
static readonly BANK_HIGH_MEMORY_2 = 127;
|
|
587
|
+
static readonly POINTER_CHARACTERS: string[];
|
|
588
|
+
static readonly WIDE_STRING_TYPE = "WideString";
|
|
589
|
+
static readonly BINARY_TYPE = "Binary";
|
|
590
|
+
static readonly CODE_TYPE = "Code";
|
|
591
|
+
static readonly LOCATION_FORMAT = "loc_{0:X6}";
|
|
592
|
+
static readonly TYPE_NAME_FORMAT = "{0}_{1:X6}";
|
|
593
|
+
static readonly OFFSET_FORMAT = "+{0:X}";
|
|
594
|
+
static readonly MARKER_FORMAT = "+M";
|
|
595
|
+
static readonly NEGATIVE_OFFSET_FORMAT = "-{0:X}";
|
|
596
|
+
static readonly NEGATIVE_MARKER_FORMAT = "-M";
|
|
597
|
+
}
|
|
598
|
+
//#endregion
|
|
599
|
+
//#region src/types/location.d.ts
|
|
623
600
|
/**
|
|
624
601
|
* Location wrapper for additional metadata
|
|
625
602
|
* Converted from GaiaLib/Types/LocationWrapper.cs
|
|
626
603
|
*/
|
|
627
604
|
declare class LocationWrapper {
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
605
|
+
location: number;
|
|
606
|
+
type: AddressType;
|
|
607
|
+
constructor(location: number, type: AddressType);
|
|
631
608
|
}
|
|
632
|
-
|
|
609
|
+
//#endregion
|
|
610
|
+
//#region src/database/strings.d.ts
|
|
633
611
|
/**
|
|
634
612
|
* Database string command definition
|
|
635
613
|
* Converted from GaiaLib/Database/DbStringCommand.cs
|
|
636
614
|
*/
|
|
637
615
|
declare class DbStringCommand {
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
616
|
+
id: number;
|
|
617
|
+
name: string;
|
|
618
|
+
types: MemberType[];
|
|
619
|
+
delimiter?: number;
|
|
620
|
+
halt: boolean;
|
|
621
|
+
constructor(data: Partial<DbStringCommand>);
|
|
644
622
|
}
|
|
645
623
|
/**
|
|
646
624
|
* Database string layer definition
|
|
647
625
|
* Converted from GaiaLib/Database/DbStringLayer.cs
|
|
648
626
|
*/
|
|
649
627
|
interface DbStringLayer {
|
|
650
|
-
|
|
651
|
-
|
|
628
|
+
base: number;
|
|
629
|
+
map: string[];
|
|
630
|
+
}
|
|
631
|
+
declare class DbStringDictionary {
|
|
632
|
+
base: number;
|
|
633
|
+
range: number;
|
|
634
|
+
command: number;
|
|
635
|
+
name: string;
|
|
636
|
+
suffix: string;
|
|
637
|
+
entries: string[];
|
|
638
|
+
constructor(data: Partial<DbStringDictionary>);
|
|
652
639
|
}
|
|
653
640
|
/**
|
|
654
641
|
* Database string type definition
|
|
655
642
|
* Converted from GaiaLib/Database/DbStringType.cs
|
|
656
643
|
*/
|
|
657
644
|
declare class DbStringType {
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
645
|
+
name: string;
|
|
646
|
+
delimiter: string;
|
|
647
|
+
terminator: number;
|
|
648
|
+
shiftType?: string;
|
|
649
|
+
characterMap: string[];
|
|
650
|
+
commands: Record<string, DbStringCommand>;
|
|
651
|
+
commandLookup: Record<number, DbStringCommand>;
|
|
652
|
+
layers: DbStringLayer[];
|
|
653
|
+
greedyTerminator: boolean;
|
|
654
|
+
dictionaries: Record<string, DbStringDictionary>;
|
|
655
|
+
constructor(data: Partial<DbStringType>);
|
|
668
656
|
}
|
|
669
657
|
/**
|
|
670
658
|
* String type utilities
|
|
671
659
|
*/
|
|
672
660
|
declare class DbStringTypeUtils {
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
661
|
+
private static readonly shiftDownFunctions;
|
|
662
|
+
private static readonly shiftUpFunctions;
|
|
663
|
+
static getShiftDown(shiftType?: string): (x: number) => number;
|
|
664
|
+
static getShiftUp(shiftType?: string): (x: number) => number;
|
|
677
665
|
}
|
|
678
|
-
|
|
666
|
+
//#endregion
|
|
667
|
+
//#region src/types/strings.d.ts
|
|
679
668
|
/**
|
|
680
669
|
* String marker for positioning
|
|
681
670
|
* Converted from GaiaLib/Types/StringMarker.cs
|
|
682
671
|
*/
|
|
683
672
|
interface StringMarker {
|
|
684
|
-
|
|
673
|
+
offset: number;
|
|
685
674
|
}
|
|
686
675
|
/**
|
|
687
676
|
* String wrapper with type and location information
|
|
688
677
|
* Converted from GaiaLib/Types/StringWrapper.cs
|
|
689
678
|
*/
|
|
690
679
|
interface StringWrapper {
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
680
|
+
string: string;
|
|
681
|
+
type: DbStringType;
|
|
682
|
+
marker: number;
|
|
683
|
+
location: number;
|
|
684
|
+
fixedSize: number;
|
|
695
685
|
}
|
|
696
686
|
/**
|
|
697
687
|
* String entry (commented out in original C# code)
|
|
698
688
|
* Converted from GaiaLib/Types/StringEntry.cs
|
|
699
689
|
*/
|
|
700
690
|
interface StringEntry {
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
691
|
+
block: AsmBlock;
|
|
692
|
+
index: number;
|
|
693
|
+
size: number;
|
|
694
|
+
data: Uint8Array;
|
|
705
695
|
}
|
|
706
696
|
/**
|
|
707
697
|
* String size comparer utility
|
|
708
698
|
* Converted from GaiaLib/Types/StringSizeComparer.cs
|
|
709
699
|
*/
|
|
710
700
|
declare class StringSizeComparer {
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
}
|
|
720
|
-
|
|
701
|
+
/**
|
|
702
|
+
* Compare two strings by length
|
|
703
|
+
*/
|
|
704
|
+
static compare(a: string, b: string): number;
|
|
705
|
+
/**
|
|
706
|
+
* Compare two StringWrapper objects by string length
|
|
707
|
+
*/
|
|
708
|
+
static compareWrappers(a: StringWrapper, b: StringWrapper): number;
|
|
709
|
+
}
|
|
710
|
+
//#endregion
|
|
711
|
+
//#region src/types/structs.d.ts
|
|
721
712
|
/**
|
|
722
713
|
* Structure definition
|
|
723
714
|
* Converted from GaiaLib/Types/StructDef.cs
|
|
724
715
|
*/
|
|
725
716
|
interface StructDef {
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
/**
|
|
739
|
-
* Creates a new TableEntry
|
|
740
|
-
*/
|
|
741
|
-
declare function createTableEntry(location: number, object?: unknown): TableEntry;
|
|
742
|
-
|
|
717
|
+
name: string;
|
|
718
|
+
parts: unknown[];
|
|
719
|
+
}
|
|
720
|
+
//#endregion
|
|
721
|
+
//#region src/types/tables.d.ts
|
|
722
|
+
declare class TableEntry {
|
|
723
|
+
location: number;
|
|
724
|
+
object: unknown;
|
|
725
|
+
constructor(location: number);
|
|
726
|
+
}
|
|
727
|
+
//#endregion
|
|
728
|
+
//#region src/types/operands.d.ts
|
|
743
729
|
declare class TypedNumber {
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
730
|
+
value: number;
|
|
731
|
+
size: number;
|
|
732
|
+
constructor(value: number, size: number);
|
|
747
733
|
}
|
|
748
734
|
declare class Byte extends TypedNumber {
|
|
749
|
-
|
|
735
|
+
constructor(value: number);
|
|
750
736
|
}
|
|
751
737
|
declare class Word extends TypedNumber {
|
|
752
|
-
|
|
738
|
+
constructor(value: number);
|
|
753
739
|
}
|
|
754
740
|
declare class Long extends TypedNumber {
|
|
755
|
-
|
|
741
|
+
constructor(value: number);
|
|
756
742
|
}
|
|
757
|
-
|
|
743
|
+
//#endregion
|
|
744
|
+
//#region src/assembly/Registers.d.ts
|
|
745
|
+
/**
|
|
746
|
+
* Manages the 65816 processor registers and status flags
|
|
747
|
+
*/
|
|
748
|
+
declare class Registers {
|
|
749
|
+
value: Record<string, number>;
|
|
750
|
+
stack: Stack;
|
|
751
|
+
mode: MemoryMapMode;
|
|
752
|
+
constructor(mode: MemoryMapMode);
|
|
753
|
+
}
|
|
754
|
+
//#endregion
|
|
755
|
+
//#region src/rom/extraction/processor.d.ts
|
|
756
|
+
declare class MapExt<K, V> extends Map<K, V> {
|
|
757
|
+
constructor();
|
|
758
|
+
tryAdd(key: K, value: V): boolean;
|
|
759
|
+
setFlag(key: K, flag: number, value?: boolean): void;
|
|
760
|
+
clearFlag(key: K, flag: number): void;
|
|
761
|
+
}
|
|
762
|
+
/**
|
|
763
|
+
* Manages CPU processor state during ROM analysis
|
|
764
|
+
* Converted from GaiaLib/Rom/Extraction/ProcessorStateManager.cs
|
|
765
|
+
*/
|
|
766
|
+
declare class ProcessorStateManager {
|
|
767
|
+
readonly stackPositions: MapExt<number, number>;
|
|
768
|
+
private readonly _buckets;
|
|
769
|
+
get(key: string): MapExt<number, number>;
|
|
770
|
+
/**
|
|
771
|
+
* Hydrate processor registers with stored state
|
|
772
|
+
* Uses Registers from gaia-core/assembly for processor state management
|
|
773
|
+
*/
|
|
774
|
+
hydrateRegisters(position: number, reg: Registers): void;
|
|
775
|
+
getStackPosition(location: number): number | undefined;
|
|
776
|
+
setStackPosition(location: number, value: number): void;
|
|
777
|
+
tryAddStackPosition(location: number, value: number): boolean;
|
|
778
|
+
}
|
|
779
|
+
//#endregion
|
|
780
|
+
//#region src/rom/extraction/reader.d.ts
|
|
781
|
+
/**
|
|
782
|
+
* Provides low-level ROM data reading functionality
|
|
783
|
+
* Converted from GaiaLib/Rom/Extraction/RomDataReader.cs
|
|
784
|
+
*/
|
|
785
|
+
declare class RomDataReader {
|
|
786
|
+
readonly romData: Uint8Array;
|
|
787
|
+
position: number;
|
|
788
|
+
constructor(romData: Uint8Array);
|
|
789
|
+
readByte(): number;
|
|
790
|
+
readSByte(): number;
|
|
791
|
+
readUShort(): number;
|
|
792
|
+
readShort(): number;
|
|
793
|
+
readAddress(): number;
|
|
794
|
+
readInt(): number;
|
|
795
|
+
peekByte(): number;
|
|
796
|
+
peekShort(): number;
|
|
797
|
+
peekAddress(): number;
|
|
798
|
+
}
|
|
799
|
+
//#endregion
|
|
800
|
+
//#region src/database/entrypoints.d.ts
|
|
758
801
|
/**
|
|
759
802
|
* Database entry point definition
|
|
760
803
|
* Converted from GaiaLib/Database/DbEntryPoint.cs
|
|
761
804
|
*/
|
|
762
805
|
interface DbEntryPoint {
|
|
763
|
-
|
|
764
|
-
|
|
806
|
+
location: number;
|
|
807
|
+
name: string;
|
|
765
808
|
}
|
|
766
|
-
|
|
809
|
+
//#endregion
|
|
810
|
+
//#region src/database/paths.d.ts
|
|
767
811
|
/**
|
|
768
812
|
* Database path configuration
|
|
769
813
|
* Converted from GaiaLib/Database/DbPath.cs
|
|
770
814
|
*/
|
|
771
815
|
interface DbPath {
|
|
772
|
-
|
|
773
|
-
|
|
816
|
+
folder: string;
|
|
817
|
+
extension: string;
|
|
774
818
|
}
|
|
775
819
|
/**
|
|
776
820
|
* Creates a default DbPath
|
|
777
821
|
*/
|
|
778
822
|
declare function createDbPath(folder?: string, extension?: string): DbPath;
|
|
779
|
-
|
|
823
|
+
//#endregion
|
|
824
|
+
//#region src/database/config.d.ts
|
|
780
825
|
/**
|
|
781
826
|
* Database configuration
|
|
782
827
|
* Converted from GaiaLib/Database/DbConfig.cs
|
|
783
828
|
*/
|
|
784
829
|
interface DbConfig {
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
830
|
+
sfxLocation: number;
|
|
831
|
+
sfxCount: number;
|
|
832
|
+
compression: string;
|
|
833
|
+
entryPoints: DbEntryPoint[];
|
|
834
|
+
paths: Record<BinType, DbPath>;
|
|
835
|
+
memoryMode: MemoryMapMode;
|
|
790
836
|
}
|
|
791
|
-
|
|
837
|
+
//#endregion
|
|
838
|
+
//#region src/database/structs.d.ts
|
|
792
839
|
/**
|
|
793
840
|
* Database structure definition
|
|
794
841
|
* Converted from GaiaLib/Database/DbStruct.cs
|
|
795
842
|
*/
|
|
796
843
|
declare class DbStruct {
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
}
|
|
804
|
-
|
|
844
|
+
name: string;
|
|
845
|
+
types?: string[];
|
|
846
|
+
parent?: string;
|
|
847
|
+
delimiter?: number;
|
|
848
|
+
discriminator?: number;
|
|
849
|
+
constructor(data: Partial<DbStruct>);
|
|
850
|
+
}
|
|
851
|
+
//#endregion
|
|
852
|
+
//#region src/database/addressingMode.d.ts
|
|
805
853
|
declare class DbAddressingMode {
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
}
|
|
815
|
-
|
|
854
|
+
name: string;
|
|
855
|
+
shorthand: string;
|
|
856
|
+
operands: string[];
|
|
857
|
+
size: number;
|
|
858
|
+
formatString?: string;
|
|
859
|
+
parseRegex?: string;
|
|
860
|
+
instructions: Record<string, number>;
|
|
861
|
+
constructor(data: Partial<DbAddressingMode>);
|
|
862
|
+
}
|
|
863
|
+
//#endregion
|
|
864
|
+
//#region src/database/assets.d.ts
|
|
816
865
|
interface DbAsset {
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
}
|
|
823
|
-
|
|
866
|
+
index: number;
|
|
867
|
+
type: string;
|
|
868
|
+
file: string;
|
|
869
|
+
scene: string;
|
|
870
|
+
meta: any;
|
|
871
|
+
}
|
|
872
|
+
//#endregion
|
|
873
|
+
//#region src/database/scenes.d.ts
|
|
824
874
|
declare class DbScene {
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
}
|
|
831
|
-
|
|
875
|
+
name: string;
|
|
876
|
+
id: number;
|
|
877
|
+
description?: string;
|
|
878
|
+
assets: DbAsset[];
|
|
879
|
+
constructor(data: Partial<DbScene>);
|
|
880
|
+
}
|
|
881
|
+
//#endregion
|
|
882
|
+
//#region src/database/groups.d.ts
|
|
832
883
|
declare class DbGroup {
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
}
|
|
839
|
-
|
|
884
|
+
name: string;
|
|
885
|
+
prefix: string;
|
|
886
|
+
description?: string;
|
|
887
|
+
scenes: Record<string, DbScene>;
|
|
888
|
+
constructor(data: Partial<DbGroup>);
|
|
889
|
+
}
|
|
890
|
+
//#endregion
|
|
891
|
+
//#region src/database/modules.d.ts
|
|
840
892
|
interface DbGameRomModule {
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
893
|
+
mnemonics: Record<number, string>;
|
|
894
|
+
overrides: Record<number, Record<string, number>>;
|
|
895
|
+
rewrites: Record<string, number>;
|
|
896
|
+
blocks: Record<string, Record<string, Partial<DbBlock>>>;
|
|
897
|
+
files: Record<string, Record<string, Record<string, Partial<DbFile>>>>;
|
|
898
|
+
config: DbConfig;
|
|
899
|
+
labels: DbLabel[];
|
|
900
|
+
structs: Record<string, DbStruct>;
|
|
901
|
+
copdef: Record<string, Partial<CopDef>>;
|
|
902
|
+
strings: Record<string, Partial<DbStringType>>;
|
|
903
|
+
transforms: Record<string, Partial<DbTransform>[]>;
|
|
904
|
+
addrModes: Record<string, Partial<DbAddressingMode>>;
|
|
905
|
+
groups: Record<string, Partial<DbGroup>>;
|
|
906
|
+
fileTypes: Record<string, Partial<DbFileType>>;
|
|
855
907
|
}
|
|
856
908
|
interface DbBaseRomModule extends DbGameRomModule {
|
|
857
|
-
|
|
909
|
+
baseRomFiles: ChunkFile[];
|
|
858
910
|
}
|
|
859
|
-
|
|
911
|
+
//#endregion
|
|
912
|
+
//#region src/database/root.d.ts
|
|
860
913
|
/**
|
|
861
914
|
* Main database root class
|
|
862
915
|
* Converted from GaiaLib/Database/DbRoot.cs
|
|
863
916
|
*/
|
|
864
917
|
interface DbRoot {
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
918
|
+
copDef: Record<number, CopDef>;
|
|
919
|
+
copLookup: Record<string, CopDef>;
|
|
920
|
+
mnemonics: Record<number, string>;
|
|
921
|
+
structs: Record<string, DbStruct>;
|
|
922
|
+
stringTypes: Record<string, DbStringType>;
|
|
923
|
+
stringDelimiters: string[];
|
|
924
|
+
files: DbFile[];
|
|
925
|
+
config: DbConfig;
|
|
926
|
+
blocks: DbBlock[];
|
|
927
|
+
overrides: Record<number, Record<string, any>>;
|
|
928
|
+
labels: Record<number, string>;
|
|
929
|
+
rewrites: Record<number, number>;
|
|
930
|
+
entryPoints: DbEntryPoint[];
|
|
931
|
+
opCodes: Record<number, OpCode>;
|
|
932
|
+
opLookup: Record<string, OpCode[]>;
|
|
933
|
+
addrLookup: Record<string, DbAddressingMode>;
|
|
934
|
+
compression: ICompressionProvider;
|
|
935
|
+
baseRomFiles?: ChunkFile[];
|
|
936
|
+
projectFiles?: ChunkFile[];
|
|
937
|
+
groups: Record<string, DbGroup>;
|
|
938
|
+
scenes: Record<number, DbScene>;
|
|
939
|
+
fileTypes: Record<string, DbFileType>;
|
|
940
|
+
fileExtLookup: Record<string, DbFileType>;
|
|
888
941
|
}
|
|
889
942
|
/**
|
|
890
943
|
* Database root utilities
|
|
891
944
|
*/
|
|
892
945
|
declare class DbRootUtils {
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
}
|
|
909
|
-
|
|
946
|
+
/**
|
|
947
|
+
* JSON serialization options
|
|
948
|
+
*/
|
|
949
|
+
/**
|
|
950
|
+
* Load database from a single file
|
|
951
|
+
*/
|
|
952
|
+
static fromFolder(folderPath: string, systemPath: string): Promise<DbRoot>;
|
|
953
|
+
/**
|
|
954
|
+
* Load database from folder structure
|
|
955
|
+
*/
|
|
956
|
+
static gameModuleFromFolder(folderPath: string, systemPath: string): Promise<DbGameRomModule>;
|
|
957
|
+
static fromGameModule(module: DbGameRomModule): DbRoot;
|
|
958
|
+
static applyFolder(root: DbRoot, folderPath: string, sourceFiles?: ChunkFile[]): Promise<ChunkFile[]>;
|
|
959
|
+
static extractAllContent(root: DbRoot, romPath: string, outPath: string): Promise<void>;
|
|
960
|
+
static rebuildAllContent(root: DbRoot, inPath: string[], outPath: string): Promise<void>;
|
|
961
|
+
}
|
|
962
|
+
//#endregion
|
|
963
|
+
//#region src/database/labels.d.ts
|
|
910
964
|
/**
|
|
911
965
|
* Database label definition
|
|
912
966
|
* Converted from GaiaLib/Database/DbLabel.cs
|
|
913
967
|
*/
|
|
914
968
|
interface DbLabel {
|
|
915
|
-
|
|
916
|
-
|
|
969
|
+
location: number;
|
|
970
|
+
label: string;
|
|
917
971
|
}
|
|
918
|
-
|
|
972
|
+
//#endregion
|
|
973
|
+
//#region src/database/mnemonics.d.ts
|
|
919
974
|
/**
|
|
920
975
|
* Database mnemonic definition
|
|
921
976
|
* Converted from GaiaLib/Database/DbMnemonic.cs
|
|
922
977
|
*/
|
|
923
978
|
interface DbMnemonic {
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
979
|
+
key: number;
|
|
980
|
+
value: string;
|
|
981
|
+
metadata?: string;
|
|
927
982
|
}
|
|
928
|
-
|
|
983
|
+
//#endregion
|
|
984
|
+
//#region src/database/overrides.d.ts
|
|
929
985
|
declare class DbOverride {
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
986
|
+
location: number;
|
|
987
|
+
register: string;
|
|
988
|
+
value: number;
|
|
989
|
+
constructor(values: Partial<DbOverride>);
|
|
934
990
|
}
|
|
935
|
-
|
|
991
|
+
//#endregion
|
|
992
|
+
//#region src/database/rewrites.d.ts
|
|
936
993
|
/**
|
|
937
994
|
* Database rewrite rule definition
|
|
938
995
|
* Converted from GaiaLib/Database/DbRewrite.cs
|
|
939
996
|
*/
|
|
940
997
|
interface DbRewrite {
|
|
941
|
-
|
|
942
|
-
|
|
998
|
+
location: number;
|
|
999
|
+
value: number;
|
|
943
1000
|
}
|
|
944
|
-
|
|
1001
|
+
//#endregion
|
|
1002
|
+
//#region src/database/sfx.d.ts
|
|
945
1003
|
/**
|
|
946
1004
|
* Database sound effect definition
|
|
947
1005
|
* Converted from GaiaLib/Database/DbSfx.cs
|
|
948
1006
|
*/
|
|
949
1007
|
interface DbSfx {
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
1008
|
+
location: number;
|
|
1009
|
+
size: number;
|
|
1010
|
+
names: string[];
|
|
953
1011
|
}
|
|
954
|
-
|
|
1012
|
+
//#endregion
|
|
1013
|
+
//#region src/rom/extraction/references.d.ts
|
|
955
1014
|
/**
|
|
956
1015
|
* Manages references, chunks, and markers during ROM analysis
|
|
957
1016
|
* Converted from GaiaLib/Rom/Extraction/ReferenceManager.cs
|
|
958
1017
|
*/
|
|
959
1018
|
declare class ReferenceManager {
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
}
|
|
993
|
-
|
|
1019
|
+
readonly structTable: Map<number, string>;
|
|
1020
|
+
readonly markerTable: Map<number, number>;
|
|
1021
|
+
readonly nameTable: Map<number, string>;
|
|
1022
|
+
private readonly root;
|
|
1023
|
+
constructor(root: DbRoot);
|
|
1024
|
+
tryGetStruct(location: number): {
|
|
1025
|
+
found: boolean;
|
|
1026
|
+
chunkType?: string;
|
|
1027
|
+
};
|
|
1028
|
+
tryAddStruct(location: number, chunkType: string): boolean;
|
|
1029
|
+
containsStruct(location: number): boolean;
|
|
1030
|
+
tryGetName(location: number): {
|
|
1031
|
+
found: boolean;
|
|
1032
|
+
referenceName?: string;
|
|
1033
|
+
};
|
|
1034
|
+
tryAddName(location: number, referenceName: string): boolean;
|
|
1035
|
+
tryGetMarker(location: number): {
|
|
1036
|
+
found: boolean;
|
|
1037
|
+
offset?: number;
|
|
1038
|
+
};
|
|
1039
|
+
setMarker(location: number, offset: number): void;
|
|
1040
|
+
createBranchLabel(location: number): string;
|
|
1041
|
+
createTypeName(type: string, location: number): string;
|
|
1042
|
+
createFallbackName(location: number): string;
|
|
1043
|
+
/**
|
|
1044
|
+
* Finds a reference location by its assigned name.
|
|
1045
|
+
*/
|
|
1046
|
+
findLocationByName(name: string): number | undefined;
|
|
1047
|
+
resolveName(location: number, type: AddressType, isBranch: boolean): string;
|
|
1048
|
+
findClosestReference(location: number): string | null;
|
|
1049
|
+
private processRewrite;
|
|
1050
|
+
private processClosestMatch;
|
|
1051
|
+
}
|
|
1052
|
+
//#endregion
|
|
1053
|
+
//#region src/rom/extraction/strings.d.ts
|
|
994
1054
|
/**
|
|
995
1055
|
* Reads and processes strings from ROM data
|
|
996
1056
|
* Converted from GaiaLib/Rom/Extraction/StringReader.cs
|
|
997
1057
|
*/
|
|
998
1058
|
declare class StringReader {
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
* Handles character shifting based on string type
|
|
1007
|
-
* This is a simplified implementation of the shift logic
|
|
1008
|
-
*/
|
|
1009
|
-
private shiftDown;
|
|
1010
|
-
resolveString(sw: StringWrapper, isBranch: boolean): void;
|
|
1059
|
+
static readonly STRING_REFERENCE_CHARACTERS: string[];
|
|
1060
|
+
private readonly _blockReader;
|
|
1061
|
+
private readonly _romDataReader;
|
|
1062
|
+
constructor(blockReader: BlockReader);
|
|
1063
|
+
private resolveCommand;
|
|
1064
|
+
parseString(stringType: DbStringType, fixedSize: number): StringWrapper;
|
|
1065
|
+
resolveString(sw: StringWrapper, isBranch: boolean): void;
|
|
1011
1066
|
}
|
|
1012
|
-
|
|
1067
|
+
//#endregion
|
|
1068
|
+
//#region src/rom/extraction/asm.d.ts
|
|
1013
1069
|
/**
|
|
1014
1070
|
* Parses assembly instructions from ROM data, handling different addressing modes
|
|
1015
1071
|
* and maintaining CPU register state during analysis.
|
|
1016
1072
|
* Converted from GaiaLib/Rom/Extraction/AsmReader.cs
|
|
1017
1073
|
*/
|
|
1018
1074
|
declare class AsmReader {
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
}
|
|
1034
|
-
|
|
1075
|
+
private static readonly STATUS_OP_MASK;
|
|
1076
|
+
private static readonly STATUS_OP_VALUE;
|
|
1077
|
+
private static readonly ACCUMULATOR_OP_MASK;
|
|
1078
|
+
private static readonly ACCUMULATOR_OP_VALUE;
|
|
1079
|
+
static readonly VARIABLE_SIZE_INDICATOR = -2;
|
|
1080
|
+
private readonly _blockReader;
|
|
1081
|
+
private readonly _transformProcessor;
|
|
1082
|
+
private readonly _addressingModeHandler;
|
|
1083
|
+
private readonly _romDataReader;
|
|
1084
|
+
constructor(blockReader: BlockReader);
|
|
1085
|
+
parseAsm(reg: Registers): Op;
|
|
1086
|
+
clearDestinationRegister(code: OpCode, reg: Registers): void;
|
|
1087
|
+
private initializeOperation;
|
|
1088
|
+
private calculateInstructionSize;
|
|
1089
|
+
}
|
|
1090
|
+
//#endregion
|
|
1091
|
+
//#region src/rom/extraction/parser.d.ts
|
|
1035
1092
|
/**
|
|
1036
1093
|
* Handles parsing of different data types from ROM
|
|
1037
1094
|
* Converted from GaiaLib/Rom/Extraction/TypeParser.cs
|
|
1038
1095
|
*/
|
|
1039
1096
|
declare class TypeParser {
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
}
|
|
1053
|
-
|
|
1097
|
+
private readonly _blockReader;
|
|
1098
|
+
private readonly _romDataReader;
|
|
1099
|
+
private readonly _stringReader;
|
|
1100
|
+
private readonly _stringTypes;
|
|
1101
|
+
private readonly _referenceManager;
|
|
1102
|
+
constructor(blockReader: BlockReader);
|
|
1103
|
+
parseType(typeName: string, reg: Registers | null, depth: number, bank?: number): unknown;
|
|
1104
|
+
private tryParseMemberType;
|
|
1105
|
+
private parseWordSafe;
|
|
1106
|
+
private parseBinary;
|
|
1107
|
+
private parseLocation;
|
|
1108
|
+
private parseCode;
|
|
1109
|
+
}
|
|
1110
|
+
//#endregion
|
|
1111
|
+
//#region src/rom/extraction/blocks.d.ts
|
|
1054
1112
|
/**
|
|
1055
1113
|
* Central class for reading and analyzing ROM blocks
|
|
1056
1114
|
* Converted from GaiaLib/Rom/Extraction/BlockReader.cs
|
|
1057
1115
|
*/
|
|
1058
1116
|
declare class BlockReader {
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
}
|
|
1172
|
-
|
|
1117
|
+
private static readonly REF_SEARCH_MAX_RANGE;
|
|
1118
|
+
private static readonly BANK_MASK_CHECK;
|
|
1119
|
+
private static readonly BYTE_DELIMITER_THRESHOLD;
|
|
1120
|
+
private static readonly BANK_HIGH_MEMORY_1;
|
|
1121
|
+
private static readonly BANK_HIGH_MEMORY_2;
|
|
1122
|
+
private static readonly POINTER_CHARACTERS;
|
|
1123
|
+
private static readonly LOCATION_REGEX;
|
|
1124
|
+
readonly _root: DbRoot;
|
|
1125
|
+
readonly _stringReader: StringReader;
|
|
1126
|
+
readonly _asmReader: AsmReader;
|
|
1127
|
+
readonly _typeParser: TypeParser;
|
|
1128
|
+
readonly _romDataReader: RomDataReader;
|
|
1129
|
+
readonly _stateManager: ProcessorStateManager;
|
|
1130
|
+
readonly _referenceManager: ReferenceManager;
|
|
1131
|
+
_partEnd: number;
|
|
1132
|
+
_currentChunk: ChunkFile | null;
|
|
1133
|
+
_currentAsmBlock: AsmBlock | null;
|
|
1134
|
+
_enrichedChunks: ChunkFile[];
|
|
1135
|
+
constructor(romData: Uint8Array, root: DbRoot);
|
|
1136
|
+
/**
|
|
1137
|
+
* Processes predefined overrides for registers and bank notes
|
|
1138
|
+
*/
|
|
1139
|
+
private initializeOverrides;
|
|
1140
|
+
/**
|
|
1141
|
+
* Processes predefined file references
|
|
1142
|
+
*/
|
|
1143
|
+
private initializeFileReferences;
|
|
1144
|
+
/**
|
|
1145
|
+
* Resolves mnemonic for a given address
|
|
1146
|
+
*/
|
|
1147
|
+
resolveMnemonic(addr: Address): void;
|
|
1148
|
+
/**
|
|
1149
|
+
* Resolves name for a location (delegated to ReferenceManager)
|
|
1150
|
+
*/
|
|
1151
|
+
resolveName(location: number, type: AddressType, isBranch: boolean): string;
|
|
1152
|
+
/**
|
|
1153
|
+
* Resolves include for a location
|
|
1154
|
+
*/
|
|
1155
|
+
resolveInclude(loc: number, isBranch: boolean): void;
|
|
1156
|
+
/**
|
|
1157
|
+
* Notes a type at a location and manages chunk references
|
|
1158
|
+
*/
|
|
1159
|
+
noteType(loc: number, type: string, silent?: boolean, reg?: Registers): string;
|
|
1160
|
+
updateRegisterState(loc: number, reg: Registers): void;
|
|
1161
|
+
/**
|
|
1162
|
+
* Checks if a delimiter has been reached
|
|
1163
|
+
*/
|
|
1164
|
+
delimiterReached(delimiter?: number): boolean;
|
|
1165
|
+
/**
|
|
1166
|
+
* Checks if processing of the current part can continue
|
|
1167
|
+
*/
|
|
1168
|
+
partCanContinue(): boolean;
|
|
1169
|
+
analyzeAndResolve(): ChunkFile[];
|
|
1170
|
+
/**
|
|
1171
|
+
* Analyzes all blocks in the ROM
|
|
1172
|
+
*/
|
|
1173
|
+
/**
|
|
1174
|
+
* Initializes blocks and parts with base references
|
|
1175
|
+
*/
|
|
1176
|
+
private initializeBlocksAndParts;
|
|
1177
|
+
/**
|
|
1178
|
+
* Processes a single part
|
|
1179
|
+
*/
|
|
1180
|
+
private processPart;
|
|
1181
|
+
/**
|
|
1182
|
+
* Processes a continuous entry (same type as previous)
|
|
1183
|
+
*/
|
|
1184
|
+
private processContinuousEntry;
|
|
1185
|
+
/**
|
|
1186
|
+
* Processes a new entry
|
|
1187
|
+
*/
|
|
1188
|
+
private processNewEntry;
|
|
1189
|
+
/**
|
|
1190
|
+
* Creates ChunkFile objects from database structure
|
|
1191
|
+
*/
|
|
1192
|
+
private createChunkFilesFromDatabase;
|
|
1193
|
+
/**
|
|
1194
|
+
* Creates binary ChunkFiles from DbFiles (enriched with rawData)
|
|
1195
|
+
*/
|
|
1196
|
+
private createChunkFilesFromSfx;
|
|
1197
|
+
/**
|
|
1198
|
+
* Creates binary ChunkFiles from DbFiles (enriched with rawData)
|
|
1199
|
+
*/
|
|
1200
|
+
private createChunkFilesFromDbFiles;
|
|
1201
|
+
/**
|
|
1202
|
+
* Creates assembly ChunkFiles from DbBlocks (enriched with parts)
|
|
1203
|
+
*/
|
|
1204
|
+
private createChunkFilesFromDbBlocks;
|
|
1205
|
+
/**
|
|
1206
|
+
* Analyzes only assembly ChunkFiles (those with parts from DbBlocks)
|
|
1207
|
+
*/
|
|
1208
|
+
private analyzeChunkFiles;
|
|
1209
|
+
/**
|
|
1210
|
+
* Resolves references in assembly ChunkFiles only
|
|
1211
|
+
*/
|
|
1212
|
+
private resolveReferences;
|
|
1213
|
+
/**
|
|
1214
|
+
* Resolves a single object and its references
|
|
1215
|
+
*/
|
|
1216
|
+
private resolveObject;
|
|
1217
|
+
/**
|
|
1218
|
+
* Resolves references in an operation object
|
|
1219
|
+
*/
|
|
1220
|
+
private resolveOperationObject;
|
|
1221
|
+
/**
|
|
1222
|
+
* Checks if an operation is a branch operation
|
|
1223
|
+
*/
|
|
1224
|
+
private isBranchOperation;
|
|
1225
|
+
/**
|
|
1226
|
+
* Hydrates registers with stored state
|
|
1227
|
+
*/
|
|
1228
|
+
hydrateRegisters(reg: Registers): void;
|
|
1229
|
+
}
|
|
1230
|
+
//#endregion
|
|
1231
|
+
//#region src/rom/extraction/transforms.d.ts
|
|
1173
1232
|
/**
|
|
1174
1233
|
* Handles transform processing for assembly instructions
|
|
1175
1234
|
* Converted from GaiaLib/Rom/Extraction/TransformProcessor.cs
|
|
1176
1235
|
*/
|
|
1177
1236
|
declare class TransformProcessor {
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
}
|
|
1197
|
-
|
|
1237
|
+
private readonly _blockReader;
|
|
1238
|
+
private readonly _romDataReader;
|
|
1239
|
+
private readonly _referenceManager;
|
|
1240
|
+
private readonly _labelLookup;
|
|
1241
|
+
private static readonly LOCATION_REGEX;
|
|
1242
|
+
constructor(romReader: BlockReader);
|
|
1243
|
+
/**
|
|
1244
|
+
* Retrieves transform information for the current ROM position
|
|
1245
|
+
*/
|
|
1246
|
+
getTransform(): string | null;
|
|
1247
|
+
/**
|
|
1248
|
+
* Applies transforms to operands
|
|
1249
|
+
*/
|
|
1250
|
+
applyTransforms(op1Label: string | null, op2Label: string | null, operands: unknown[]): void;
|
|
1251
|
+
private applyTransform;
|
|
1252
|
+
private applyDefaultTransform;
|
|
1253
|
+
private cleanTransformName;
|
|
1254
|
+
private resolveTransformReference;
|
|
1255
|
+
}
|
|
1256
|
+
//#endregion
|
|
1257
|
+
//#region src/rom/extraction/addressing.d.ts
|
|
1198
1258
|
/**
|
|
1199
1259
|
* Context information for an operation being processed
|
|
1200
1260
|
* Converted from GaiaLib/Rom/Extraction/AsmReader.cs OperationContext
|
|
1201
1261
|
*/
|
|
1202
1262
|
declare class OperationContext {
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1263
|
+
size: number;
|
|
1264
|
+
nextAddress: number;
|
|
1265
|
+
xForm1: string | null;
|
|
1266
|
+
xForm2: string | null;
|
|
1267
|
+
copDef: CopDef | null;
|
|
1208
1268
|
}
|
|
1209
1269
|
/**
|
|
1210
1270
|
* Handles different addressing modes for assembly instructions
|
|
1211
1271
|
* Converted from GaiaLib/Rom/Extraction/AddressingModeHandler.cs
|
|
1212
1272
|
*/
|
|
1213
1273
|
declare class AddressingModeHandler {
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
}
|
|
1235
|
-
|
|
1274
|
+
private readonly _blockReader;
|
|
1275
|
+
private readonly _transformProcessor;
|
|
1276
|
+
private readonly _copProcessor;
|
|
1277
|
+
private readonly _dataReader;
|
|
1278
|
+
constructor(blockReader: BlockReader, transformProcessor: TransformProcessor);
|
|
1279
|
+
processAddressingMode(code: OpCode, context: OperationContext, reg: Registers): unknown[];
|
|
1280
|
+
private handleImmediateMode;
|
|
1281
|
+
private readImmediateOperand;
|
|
1282
|
+
private updateRegisterForImmediateInstruction;
|
|
1283
|
+
private calculateRegisterValue;
|
|
1284
|
+
private handleAbsoluteLongMode;
|
|
1285
|
+
private handleBlockMoveMode;
|
|
1286
|
+
private handleDirectPageMode;
|
|
1287
|
+
private handlePCRelativeMode;
|
|
1288
|
+
private handleStackRelativeMode;
|
|
1289
|
+
private handleStackInterruptMode;
|
|
1290
|
+
private handleStackOrImpliedMode;
|
|
1291
|
+
private handleAbsoluteMode;
|
|
1292
|
+
private isJumpInstruction;
|
|
1293
|
+
private isPushInstruction;
|
|
1294
|
+
}
|
|
1295
|
+
//#endregion
|
|
1296
|
+
//#region src/rom/extraction/stack.d.ts
|
|
1236
1297
|
/**
|
|
1237
1298
|
* Handles stack operations for various stack-related instructions
|
|
1238
1299
|
* Converted from GaiaLib/Rom/Extraction/StackOperations.cs
|
|
1239
1300
|
*/
|
|
1240
1301
|
declare class StackOperations {
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
}
|
|
1253
|
-
|
|
1302
|
+
private readonly _registers;
|
|
1303
|
+
private readonly _blockReader;
|
|
1304
|
+
constructor(registers: Registers, blockReader: BlockReader);
|
|
1305
|
+
handleStackOperation(mnemonic: string): void;
|
|
1306
|
+
private handleAccumulatorPush;
|
|
1307
|
+
private handleAccumulatorPull;
|
|
1308
|
+
private handleXIndexPush;
|
|
1309
|
+
private handleXIndexPull;
|
|
1310
|
+
private handleYIndexPush;
|
|
1311
|
+
private handleYIndexPull;
|
|
1312
|
+
private handleExchangeBytes;
|
|
1313
|
+
}
|
|
1314
|
+
//#endregion
|
|
1315
|
+
//#region src/rom/extraction/cop.d.ts
|
|
1254
1316
|
/**
|
|
1255
1317
|
* Handles COP (Coprocessor) command processing
|
|
1256
1318
|
* Converted from GaiaLib/Rom/Extraction/CopCommandProcessor.cs
|
|
1257
1319
|
*/
|
|
1258
1320
|
declare class CopCommandProcessor {
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
}
|
|
1272
|
-
|
|
1321
|
+
private readonly _blockReader;
|
|
1322
|
+
private readonly _romDataReader;
|
|
1323
|
+
constructor(blockReader: BlockReader);
|
|
1324
|
+
/**
|
|
1325
|
+
* Parses a COP command based on its definition
|
|
1326
|
+
*/
|
|
1327
|
+
parseCopCommand(copDef: CopDef, operands: unknown[]): void;
|
|
1328
|
+
private tryParseMemberType;
|
|
1329
|
+
private getMemberTypeSize;
|
|
1330
|
+
private readMemberTypeValue;
|
|
1331
|
+
private createCopLocation;
|
|
1332
|
+
private tryParseAddressType;
|
|
1333
|
+
}
|
|
1334
|
+
//#endregion
|
|
1335
|
+
//#region src/rom/extraction/writer.d.ts
|
|
1273
1336
|
declare enum ObjectType {
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1337
|
+
TableEntryArray = "TableEntryArray",
|
|
1338
|
+
StructDef = "StructDef",
|
|
1339
|
+
OpArray = "OpArray",
|
|
1340
|
+
LocationWrapper = "LocationWrapper",
|
|
1341
|
+
Address = "Address",
|
|
1342
|
+
StringWrapper = "StringWrapper",
|
|
1343
|
+
ByteArray = "ByteArray",
|
|
1344
|
+
Array = "Array",
|
|
1345
|
+
String = "String",
|
|
1346
|
+
Number = "Number",
|
|
1347
|
+
TypedNumber = "TypedNumber",
|
|
1285
1348
|
}
|
|
1286
1349
|
declare class BlockWriter {
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
}
|
|
1311
|
-
|
|
1350
|
+
private _root;
|
|
1351
|
+
private _blockReader;
|
|
1352
|
+
private _referenceManager;
|
|
1353
|
+
private _postProcessor;
|
|
1354
|
+
private _isInline;
|
|
1355
|
+
private _currentPart;
|
|
1356
|
+
constructor(reader: BlockReader);
|
|
1357
|
+
generateAllAsm(chunkFiles: ChunkFile[]): any[];
|
|
1358
|
+
generateAsm(block: ChunkFile): string;
|
|
1359
|
+
private getMnemonicsForBlock;
|
|
1360
|
+
private resolveOperand;
|
|
1361
|
+
private getObjectType;
|
|
1362
|
+
private writeObject;
|
|
1363
|
+
private writeTableEntryArray;
|
|
1364
|
+
private writeStructDef;
|
|
1365
|
+
private writeOpArray;
|
|
1366
|
+
private formatDefaultOperand;
|
|
1367
|
+
private writeStringWrapper;
|
|
1368
|
+
private writeArray;
|
|
1369
|
+
private writeNumber;
|
|
1370
|
+
private formatTypedNumber;
|
|
1371
|
+
private writeTypedNumber;
|
|
1372
|
+
private formatOperand;
|
|
1373
|
+
}
|
|
1374
|
+
//#endregion
|
|
1375
|
+
//#region src/rom/extraction/postprocessor.d.ts
|
|
1312
1376
|
/**
|
|
1313
1377
|
* Handles post processing of extracted blocks.
|
|
1314
1378
|
* Mirrors functionality of GaiaLib.Rom.Extraction.PostProcessor.
|
|
1315
1379
|
*/
|
|
1316
1380
|
declare class PostProcessor {
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
}
|
|
1329
|
-
|
|
1381
|
+
private readonly _referenceManager;
|
|
1382
|
+
constructor(reader: BlockReader);
|
|
1383
|
+
/**
|
|
1384
|
+
* Execute post process directive on a block if present.
|
|
1385
|
+
*/
|
|
1386
|
+
process(block: ChunkFile): void;
|
|
1387
|
+
/**
|
|
1388
|
+
* Builds a lookup table from struct entries.
|
|
1389
|
+
* Equivalent to PostProcessor.Lookup in C# implementation.
|
|
1390
|
+
*/
|
|
1391
|
+
Lookup(block: ChunkFile, keyIx: string, valueIx: string): void;
|
|
1392
|
+
}
|
|
1393
|
+
//#endregion
|
|
1394
|
+
//#region src/rom/rebuild/layout.d.ts
|
|
1330
1395
|
/**
|
|
1331
1396
|
* ROM layout planner
|
|
1332
1397
|
* Converted from ext/GaiaLib/Rom/Rebuild/RomLayout.cs
|
|
1333
1398
|
*/
|
|
1334
1399
|
declare class RomLayout {
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
}
|
|
1349
|
-
|
|
1400
|
+
private static readonly MIN_ACCEPTED_REMAINING;
|
|
1401
|
+
readonly unmatchedFiles: ChunkFile[];
|
|
1402
|
+
private readonly bestResult;
|
|
1403
|
+
private readonly bestSample;
|
|
1404
|
+
private currentBank;
|
|
1405
|
+
private currentUpper;
|
|
1406
|
+
private bestDepth;
|
|
1407
|
+
private bestOffset;
|
|
1408
|
+
private bestRemain;
|
|
1409
|
+
constructor(files: Iterable<ChunkFile>);
|
|
1410
|
+
organize(): void;
|
|
1411
|
+
private testDepth;
|
|
1412
|
+
private commitPage;
|
|
1413
|
+
}
|
|
1414
|
+
//#endregion
|
|
1415
|
+
//#region src/rom/rebuild/writer.d.ts
|
|
1350
1416
|
/**
|
|
1351
1417
|
* ROM writer (binary)
|
|
1352
1418
|
* Converted from ext/GaiaLib/Rom/Rebuild/RomWriter.cs (subset: binary write only)
|
|
1353
1419
|
*/
|
|
1354
1420
|
declare class RomWriter {
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
}
|
|
1382
|
-
|
|
1421
|
+
bpsPath?: string;
|
|
1422
|
+
readonly outBuffer: Uint8Array;
|
|
1423
|
+
readonly cartName: string;
|
|
1424
|
+
readonly makerCode: string;
|
|
1425
|
+
readonly root: DbRoot;
|
|
1426
|
+
constructor(root: DbRoot, cartName: string, makerCode: string);
|
|
1427
|
+
repack(files: ChunkFile[]): Promise<Uint8Array>;
|
|
1428
|
+
writeHeader(): void;
|
|
1429
|
+
writeChecksum(): void;
|
|
1430
|
+
writeEntryPoints(asmFiles: ChunkFile[]): void;
|
|
1431
|
+
writeFile(file: ChunkFile, _chunkLookup: Map<string, number>): Promise<number>;
|
|
1432
|
+
private writeAscii;
|
|
1433
|
+
/**
|
|
1434
|
+
* Parse assembly blocks and write binary data to output buffer
|
|
1435
|
+
* Converted from ext/GaiaLib/Rom/Rebuild/RomWriter.cs ParseAssembly method
|
|
1436
|
+
*/
|
|
1437
|
+
private parseAssembly;
|
|
1438
|
+
/**
|
|
1439
|
+
* Helper method to find index of any character from an array in a string
|
|
1440
|
+
*/
|
|
1441
|
+
private indexOfAny;
|
|
1442
|
+
/**
|
|
1443
|
+
* Helper method to check if an object is a StringMarker
|
|
1444
|
+
*/
|
|
1445
|
+
private isStringMarker;
|
|
1446
|
+
private isTableEntry;
|
|
1447
|
+
}
|
|
1448
|
+
//#endregion
|
|
1449
|
+
//#region src/rom/rebuild/processor.d.ts
|
|
1383
1450
|
/**
|
|
1384
1451
|
* ROM rebuild processor
|
|
1385
1452
|
* Converted from ext/GaiaLib/Rom/Rebuild/RomProcessor.cs
|
|
1386
1453
|
*/
|
|
1387
1454
|
declare class RomProcessor {
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1455
|
+
private readonly writer;
|
|
1456
|
+
constructor(writer: RomWriter);
|
|
1457
|
+
repack(allFiles: ChunkFile[]): Promise<void>;
|
|
1458
|
+
static applyPatches(asmFiles: ChunkFile[], patches: ChunkFile[]): void;
|
|
1392
1459
|
}
|
|
1393
|
-
|
|
1460
|
+
//#endregion
|
|
1461
|
+
//#region src/rom/rebuild/assembler-context.d.ts
|
|
1394
1462
|
/**
|
|
1395
1463
|
* Shared context interface for assembler components
|
|
1396
1464
|
* This eliminates circular dependencies between Assembler, AssemblerState, and StringProcessor
|
|
1397
1465
|
*/
|
|
1398
1466
|
interface AssemblerContext {
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
}
|
|
1412
|
-
|
|
1467
|
+
readonly root: DbRoot;
|
|
1468
|
+
readonly stringProcessor: StringProcessor;
|
|
1469
|
+
currentBlock: AsmBlock | null;
|
|
1470
|
+
lineBuffer: string;
|
|
1471
|
+
blockIndex: number;
|
|
1472
|
+
lastDelimiter: number | null;
|
|
1473
|
+
blocks: AsmBlock[];
|
|
1474
|
+
eof: boolean;
|
|
1475
|
+
lineCount: number;
|
|
1476
|
+
getLine(): boolean;
|
|
1477
|
+
processRawData(): void;
|
|
1478
|
+
parseOperand(operand: string): unknown;
|
|
1479
|
+
}
|
|
1480
|
+
//#endregion
|
|
1481
|
+
//#region src/rom/rebuild/string-processor.d.ts
|
|
1413
1482
|
/**
|
|
1414
1483
|
* String processor for assembly parsing
|
|
1415
1484
|
* Converted from GaiaLib/Rom/Rebuild/StringProcessor.cs
|
|
1416
1485
|
*/
|
|
1417
1486
|
declare class StringProcessor {
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1487
|
+
private memBuffer;
|
|
1488
|
+
private totalSize;
|
|
1489
|
+
private fixedStr;
|
|
1490
|
+
private readonly context;
|
|
1491
|
+
private readonly root;
|
|
1492
|
+
private readonly stringCharLookup;
|
|
1493
|
+
constructor(context: AssemblerContext);
|
|
1494
|
+
consumeString(typeChar: string): void;
|
|
1495
|
+
private flushBuffer;
|
|
1496
|
+
private processString;
|
|
1497
|
+
private applyLayers;
|
|
1498
|
+
private applyMap;
|
|
1499
|
+
private processStringCommand;
|
|
1500
|
+
}
|
|
1501
|
+
//#endregion
|
|
1502
|
+
//#region src/rom/rebuild/sorted-map.d.ts
|
|
1432
1503
|
/**
|
|
1433
1504
|
* A map that sorts keys by length in descending order, then alphabetically
|
|
1434
1505
|
* This is used for tag replacement where longer tags should be replaced first
|
|
1435
1506
|
* to avoid conflicts (e.g., "ABCD" should be replaced before "ABC")
|
|
1436
1507
|
*/
|
|
1437
1508
|
declare class SortedMap<V> {
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
}
|
|
1452
|
-
|
|
1509
|
+
private map;
|
|
1510
|
+
private _keys;
|
|
1511
|
+
get size(): number;
|
|
1512
|
+
set(key: string, value: V): this;
|
|
1513
|
+
get(key: string): V | undefined;
|
|
1514
|
+
has(key: string): boolean;
|
|
1515
|
+
delete(key: string): boolean;
|
|
1516
|
+
clear(): void;
|
|
1517
|
+
keys(): string[];
|
|
1518
|
+
values(): V[];
|
|
1519
|
+
entries(): [string, V][];
|
|
1520
|
+
[Symbol.iterator](): Generator<[string, V], void, unknown>;
|
|
1521
|
+
private sortKeys;
|
|
1522
|
+
}
|
|
1523
|
+
//#endregion
|
|
1524
|
+
//#region src/rom/rebuild/assembler.d.ts
|
|
1453
1525
|
/**
|
|
1454
1526
|
* Main assembler class for parsing assembly files
|
|
1455
1527
|
* Converted from GaiaLib/Rom/Rebuild/Assembler.cs
|
|
1456
1528
|
*/
|
|
1457
1529
|
declare class Assembler implements AssemblerContext {
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1530
|
+
readonly root: DbRoot;
|
|
1531
|
+
private readonly lines;
|
|
1532
|
+
private currentLineIndex;
|
|
1533
|
+
readonly stringProcessor: StringProcessor;
|
|
1534
|
+
lineBuffer: string;
|
|
1535
|
+
includes: Set<string>;
|
|
1536
|
+
blocks: AsmBlock[];
|
|
1537
|
+
tags: SortedMap<string>;
|
|
1538
|
+
currentBlock: AsmBlock | null;
|
|
1539
|
+
lineCount: number;
|
|
1540
|
+
blockIndex: number;
|
|
1541
|
+
lastDelimiter: number | null;
|
|
1542
|
+
reqBank: number | null;
|
|
1543
|
+
eof: boolean;
|
|
1544
|
+
strDelimRegex: RegExp;
|
|
1545
|
+
constructor(dbRoot: DbRoot, textData: string);
|
|
1546
|
+
parseAssembly(): {
|
|
1464
1547
|
blocks: AsmBlock[];
|
|
1465
|
-
|
|
1466
|
-
currentBlock: AsmBlock | null;
|
|
1467
|
-
lineCount: number;
|
|
1468
|
-
blockIndex: number;
|
|
1469
|
-
lastDelimiter: number | null;
|
|
1548
|
+
includes: Set<string>;
|
|
1470
1549
|
reqBank: number | null;
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
private resolveTags;
|
|
1484
|
-
parseOperand(opnd: string): unknown;
|
|
1485
|
-
processRawData(): void;
|
|
1486
|
-
private hexStringToBytes;
|
|
1487
|
-
}
|
|
1488
|
-
|
|
1550
|
+
};
|
|
1551
|
+
getLine(): boolean;
|
|
1552
|
+
private trimComments;
|
|
1553
|
+
private processDirectives;
|
|
1554
|
+
private processTags;
|
|
1555
|
+
private resolveTags;
|
|
1556
|
+
parseOperand(opnd: string): unknown;
|
|
1557
|
+
processRawData(): void;
|
|
1558
|
+
private hexStringToBytes;
|
|
1559
|
+
}
|
|
1560
|
+
//#endregion
|
|
1561
|
+
//#region src/rom/rebuild/assembler-state.d.ts
|
|
1489
1562
|
/**
|
|
1490
1563
|
* Assembler state machine for processing assembly text
|
|
1491
1564
|
* Converted from GaiaLib/Rom/Rebuild/AssemblerState.cs
|
|
1492
1565
|
*/
|
|
1493
1566
|
declare class AssemblerState {
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
}
|
|
1513
|
-
|
|
1567
|
+
private readonly dbStruct;
|
|
1568
|
+
private readonly parentStruct;
|
|
1569
|
+
private readonly root;
|
|
1570
|
+
private readonly discriminator;
|
|
1571
|
+
private delimiter;
|
|
1572
|
+
private memberOffset;
|
|
1573
|
+
private dataOffset;
|
|
1574
|
+
private readonly memberTypes;
|
|
1575
|
+
private currentType;
|
|
1576
|
+
private readonly context;
|
|
1577
|
+
constructor(context: AssemblerContext, structType?: string | null, saveDelimiter?: boolean);
|
|
1578
|
+
private checkDisc;
|
|
1579
|
+
private advancePart;
|
|
1580
|
+
private processOrigin;
|
|
1581
|
+
private static doMath;
|
|
1582
|
+
private tryCreateLabel;
|
|
1583
|
+
processText(openTag?: string): void;
|
|
1584
|
+
private hexStringToBytes;
|
|
1585
|
+
}
|
|
1586
|
+
//#endregion
|
|
1587
|
+
//#region src/rom/generator.d.ts
|
|
1514
1588
|
declare class RomGenerator {
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
}
|
|
1529
|
-
|
|
1589
|
+
readonly projectName?: string;
|
|
1590
|
+
crc: number;
|
|
1591
|
+
branchId: string;
|
|
1592
|
+
dbRoot: DbRoot;
|
|
1593
|
+
private sourceData;
|
|
1594
|
+
constructor(projectName?: string);
|
|
1595
|
+
initialize(): Promise<void>;
|
|
1596
|
+
generateProject(modules: string[], manualFiles?: ChunkFile[], unshiftManualFiles?: boolean): Promise<Uint8Array>;
|
|
1597
|
+
private applyProjectInit;
|
|
1598
|
+
private assembleCodeFromText;
|
|
1599
|
+
private generateAsmIncludeLookups;
|
|
1600
|
+
applyPatchFile(chunkFile: ChunkFile, chunkFiles: ChunkFile[], asmFiles: ChunkFile[], patchFiles: ChunkFile[]): void;
|
|
1601
|
+
private writeRom;
|
|
1602
|
+
}
|
|
1603
|
+
//#endregion
|
|
1604
|
+
//#region src/compression/QuintetLZ.d.ts
|
|
1530
1605
|
/**
|
|
1531
1606
|
* QuintetLZ compression algorithm implementation
|
|
1532
1607
|
* Dictionary-based compression used in Quintet games
|
|
1533
1608
|
*/
|
|
1534
1609
|
declare class QuintetLZ implements ICompressionProvider {
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
}
|
|
1554
|
-
|
|
1610
|
+
static readonly DICTIONARY_SIZE = 256;
|
|
1611
|
+
static readonly DICTIONARY_INIT = 32;
|
|
1612
|
+
static readonly DICTIONARY_OFFSET = 239;
|
|
1613
|
+
private static readonly DEFAULT_PAGE_SIZE;
|
|
1614
|
+
/**
|
|
1615
|
+
* Expand (decompress) data using QuintetLZ algorithm
|
|
1616
|
+
* @param srcData Source data buffer
|
|
1617
|
+
* @param srcPosition Starting position in source data
|
|
1618
|
+
* @param srcLen Length of source data to process
|
|
1619
|
+
* @returns Expanded data
|
|
1620
|
+
*/
|
|
1621
|
+
expand(srcData: Uint8Array, srcPosition?: number, srcLen?: number): Uint8Array;
|
|
1622
|
+
/**
|
|
1623
|
+
* Compact (compress) data using QuintetLZ algorithm
|
|
1624
|
+
* @param srcData Source data to compress
|
|
1625
|
+
* @returns Compressed data
|
|
1626
|
+
*/
|
|
1627
|
+
compact(srcData: Uint8Array): Uint8Array;
|
|
1628
|
+
}
|
|
1629
|
+
//#endregion
|
|
1630
|
+
//#region src/compression/index.d.ts
|
|
1555
1631
|
declare const CompressionAlgorithms: Record<string, () => ICompressionProvider>;
|
|
1556
|
-
|
|
1632
|
+
//#endregion
|
|
1633
|
+
//#region src/sprites/SpriteFrame.d.ts
|
|
1557
1634
|
/**
|
|
1558
1635
|
* Represents a single frame in a sprite animation sequence
|
|
1559
1636
|
*/
|
|
1560
1637
|
declare class SpriteFrame {
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1638
|
+
duration: number;
|
|
1639
|
+
groupIndex: number;
|
|
1640
|
+
/**
|
|
1641
|
+
* Internal offset to the group data (not serialized)
|
|
1642
|
+
*/
|
|
1643
|
+
groupOffset: number;
|
|
1644
|
+
constructor(duration?: number, groupIndex?: number, groupOffset?: number);
|
|
1568
1645
|
}
|
|
1569
|
-
|
|
1646
|
+
//#endregion
|
|
1647
|
+
//#region src/sprites/SpritePart.d.ts
|
|
1570
1648
|
/**
|
|
1571
1649
|
* Represents a single part/piece of a sprite
|
|
1572
1650
|
*/
|
|
1573
1651
|
declare class SpritePart {
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
}
|
|
1586
|
-
|
|
1652
|
+
isLarge: boolean;
|
|
1653
|
+
xOffset: number;
|
|
1654
|
+
xOffsetMirror: number;
|
|
1655
|
+
yOffset: number;
|
|
1656
|
+
yOffsetMirror: number;
|
|
1657
|
+
vMirror: boolean;
|
|
1658
|
+
hMirror: boolean;
|
|
1659
|
+
someOffset: number;
|
|
1660
|
+
paletteIndex: number;
|
|
1661
|
+
tileIndex: number;
|
|
1662
|
+
constructor();
|
|
1663
|
+
}
|
|
1664
|
+
//#endregion
|
|
1665
|
+
//#region src/sprites/SpriteGroup.d.ts
|
|
1587
1666
|
/**
|
|
1588
1667
|
* Represents a group of sprite parts that form a complete sprite frame
|
|
1589
1668
|
*/
|
|
1590
1669
|
declare class SpriteGroup {
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
}
|
|
1606
|
-
|
|
1670
|
+
xOffset: number;
|
|
1671
|
+
xOffsetMirror: number;
|
|
1672
|
+
yOffset: number;
|
|
1673
|
+
yOffsetMirror: number;
|
|
1674
|
+
xRecoilHitboxOffset: number;
|
|
1675
|
+
yRecoilHitboxOffset: number;
|
|
1676
|
+
xRecoilHitboxTilesize: number;
|
|
1677
|
+
yRecoilHitboxTilesize: number;
|
|
1678
|
+
xHostileHitboxOffset: number;
|
|
1679
|
+
xHostileHitboxSize: number;
|
|
1680
|
+
yHostileHitboxOffset: number;
|
|
1681
|
+
yHostileHitboxSize: number;
|
|
1682
|
+
parts: SpritePart[];
|
|
1683
|
+
constructor();
|
|
1684
|
+
}
|
|
1685
|
+
//#endregion
|
|
1686
|
+
//#region src/sprites/SpriteMap.d.ts
|
|
1607
1687
|
/**
|
|
1608
1688
|
* Represents a complete sprite map with frame sets and groups
|
|
1609
1689
|
*/
|
|
1610
1690
|
declare class SpriteMap {
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
}
|
|
1626
|
-
|
|
1691
|
+
frameSets: SpriteFrame[][];
|
|
1692
|
+
groups: SpriteGroup[];
|
|
1693
|
+
constructor();
|
|
1694
|
+
/**
|
|
1695
|
+
* Create a SpriteMap from binary data
|
|
1696
|
+
* @param data Binary data buffer
|
|
1697
|
+
* @returns SpriteMap instance
|
|
1698
|
+
*/
|
|
1699
|
+
static fromBytes(data: Uint8Array): SpriteMap;
|
|
1700
|
+
/**
|
|
1701
|
+
* Convert this SpriteMap to binary data
|
|
1702
|
+
* @returns Binary data buffer
|
|
1703
|
+
*/
|
|
1704
|
+
toBytes(): Uint8Array;
|
|
1705
|
+
}
|
|
1706
|
+
//#endregion
|
|
1707
|
+
//#region src/project/config.d.ts
|
|
1627
1708
|
/**
|
|
1628
1709
|
* Project configuration types
|
|
1629
1710
|
* TODO: Implement comprehensive project configuration
|
|
1630
1711
|
*/
|
|
1631
1712
|
interface ProjectConfig {
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1713
|
+
name: string;
|
|
1714
|
+
version: string;
|
|
1715
|
+
description?: string;
|
|
1635
1716
|
}
|
|
1636
|
-
|
|
1717
|
+
//#endregion
|
|
1718
|
+
//#region src/collaboration/index.d.ts
|
|
1637
1719
|
/**
|
|
1638
1720
|
* Collaboration types and utilities
|
|
1639
1721
|
* TODO: Implement collaboration functionality
|
|
1640
1722
|
*/
|
|
1641
1723
|
interface CollaborationConfig {
|
|
1642
|
-
|
|
1724
|
+
enabled: boolean;
|
|
1643
1725
|
}
|
|
1644
|
-
|
|
1726
|
+
//#endregion
|
|
1727
|
+
//#region src/supabase/types.d.ts
|
|
1645
1728
|
/**
|
|
1646
1729
|
* TypeScript interfaces for Supabase API responses
|
|
1647
1730
|
* These types represent the structured data returned from ROM database queries
|
|
1648
1731
|
*/
|
|
1649
1732
|
interface PlatformData {
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1733
|
+
id: string;
|
|
1734
|
+
name: string;
|
|
1735
|
+
meta: any | null;
|
|
1736
|
+
createdAt: string;
|
|
1737
|
+
updatedAt: string;
|
|
1655
1738
|
}
|
|
1656
1739
|
interface BranchBaseData {
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1740
|
+
id: string;
|
|
1741
|
+
name: string | null;
|
|
1742
|
+
version: number | null;
|
|
1743
|
+
isActive?: boolean | null;
|
|
1744
|
+
notes?: string[] | null;
|
|
1745
|
+
createdAt: string;
|
|
1746
|
+
updatedAt: string;
|
|
1664
1747
|
}
|
|
1665
1748
|
interface FileBaseData {
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1749
|
+
id: string;
|
|
1750
|
+
name: string;
|
|
1751
|
+
type: string;
|
|
1752
|
+
version: number | null;
|
|
1753
|
+
crc: number | null;
|
|
1754
|
+
meta: any | null;
|
|
1755
|
+
isText: boolean;
|
|
1756
|
+
text: string | null;
|
|
1757
|
+
data: Uint8Array | null;
|
|
1758
|
+
createdAt: string;
|
|
1759
|
+
updatedAt: string;
|
|
1677
1760
|
}
|
|
1678
1761
|
interface FileBaseRaw extends Omit<FileBaseData, 'data'> {
|
|
1679
|
-
|
|
1762
|
+
data: string | null;
|
|
1680
1763
|
}
|
|
1681
1764
|
/**
|
|
1682
1765
|
* Platform branch information containing instruction set and addressing modes
|
|
1683
1766
|
*/
|
|
1684
1767
|
interface PlatformBranchData extends BranchBaseData {
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1768
|
+
platformId: string;
|
|
1769
|
+
addressingModes: any | null;
|
|
1770
|
+
instructionSet: any | null;
|
|
1771
|
+
vectors: any | null;
|
|
1772
|
+
types: any | null;
|
|
1773
|
+
platform: PlatformData;
|
|
1691
1774
|
}
|
|
1692
1775
|
/**
|
|
1693
1776
|
* Game ROM branch information with platform reference
|
|
1694
1777
|
*/
|
|
1695
1778
|
interface GameRomBranchData extends BranchBaseData {
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1779
|
+
gameRomId: string;
|
|
1780
|
+
platformBranchId: string;
|
|
1781
|
+
coplib: any | null;
|
|
1782
|
+
config: any | null;
|
|
1783
|
+
files: any | null;
|
|
1784
|
+
blocks: any | null;
|
|
1785
|
+
fixups: any | null;
|
|
1786
|
+
strings: any | null;
|
|
1787
|
+
structs: any | null;
|
|
1788
|
+
scenes: any | null;
|
|
1789
|
+
gameRom: GameRomData;
|
|
1790
|
+
platformBranch: PlatformBranchData;
|
|
1708
1791
|
}
|
|
1709
1792
|
interface GameRomArtifactData extends FileBaseData {
|
|
1710
|
-
|
|
1793
|
+
gameRomId: string;
|
|
1711
1794
|
}
|
|
1712
1795
|
interface GameRomArtifactRaw extends FileBaseRaw {
|
|
1713
|
-
|
|
1796
|
+
gameRomId: string;
|
|
1714
1797
|
}
|
|
1715
1798
|
interface GameRomBranchArtifactRaw {
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1799
|
+
id: string;
|
|
1800
|
+
branchId: string;
|
|
1801
|
+
artifactId: string;
|
|
1802
|
+
artifact: GameRomArtifactRaw;
|
|
1720
1803
|
}
|
|
1721
1804
|
/**
|
|
1722
1805
|
* Base ROM information
|
|
1723
1806
|
*/
|
|
1724
1807
|
interface BaseRomData {
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1808
|
+
id: string;
|
|
1809
|
+
name: string;
|
|
1810
|
+
gameId: string;
|
|
1811
|
+
gameRomId: string;
|
|
1812
|
+
createdAt: string;
|
|
1813
|
+
updatedAt: string;
|
|
1731
1814
|
}
|
|
1732
1815
|
interface GameData {
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1816
|
+
id: string;
|
|
1817
|
+
name: string;
|
|
1818
|
+
createdAt: string;
|
|
1819
|
+
updatedAt: string;
|
|
1737
1820
|
}
|
|
1738
1821
|
interface RegionData {
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1822
|
+
id: string;
|
|
1823
|
+
name: string;
|
|
1824
|
+
meta: any | null;
|
|
1825
|
+
platformId: string;
|
|
1826
|
+
createdAt: string;
|
|
1827
|
+
updatedAt: string;
|
|
1745
1828
|
}
|
|
1746
1829
|
interface GameRomData {
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1830
|
+
id: string;
|
|
1831
|
+
crc: number;
|
|
1832
|
+
meta: any | null;
|
|
1833
|
+
gameId: string;
|
|
1834
|
+
regionId: string;
|
|
1835
|
+
createdAt: string;
|
|
1836
|
+
updatedAt: string;
|
|
1837
|
+
game: GameData;
|
|
1838
|
+
region: RegionData;
|
|
1756
1839
|
}
|
|
1757
1840
|
/**
|
|
1758
1841
|
* Base ROM branch with complete relationship chain
|
|
1759
1842
|
*/
|
|
1760
1843
|
interface BaseRomBranchData extends BranchBaseData {
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1844
|
+
baseRomId: string;
|
|
1845
|
+
gameRomBranchId: string;
|
|
1846
|
+
gameRomBranch: GameRomBranchData;
|
|
1847
|
+
baseRom: BaseRomData;
|
|
1765
1848
|
}
|
|
1766
1849
|
/**
|
|
1767
1850
|
* Base ROM file containing binary data
|
|
1768
1851
|
*/
|
|
1769
1852
|
interface BaseRomFileData extends FileBaseData {
|
|
1770
|
-
|
|
1853
|
+
baseRomId: string;
|
|
1771
1854
|
}
|
|
1772
1855
|
interface BaseRomBranchFileRaw {
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1856
|
+
id: string;
|
|
1857
|
+
branchId: string;
|
|
1858
|
+
fileId: string;
|
|
1859
|
+
file: BaseRomFileRaw;
|
|
1777
1860
|
}
|
|
1778
1861
|
/**
|
|
1779
1862
|
* Raw BaseRomFile data as returned from Supabase (before conversion)
|
|
1780
1863
|
*/
|
|
1781
1864
|
interface BaseRomFileRaw extends FileBaseRaw {
|
|
1782
|
-
|
|
1865
|
+
baseRomId: string;
|
|
1783
1866
|
}
|
|
1784
1867
|
/**
|
|
1785
1868
|
* Complete ROM payload containing branch data and files
|
|
1786
1869
|
*/
|
|
1787
1870
|
interface BaseRomPayload {
|
|
1788
|
-
|
|
1789
|
-
|
|
1871
|
+
baseRomBranch: BaseRomBranchData;
|
|
1872
|
+
files: BaseRomFileData[];
|
|
1790
1873
|
}
|
|
1791
1874
|
/**
|
|
1792
1875
|
* Options for loading ROM data by name
|
|
1793
1876
|
*/
|
|
1794
1877
|
interface FromSupabaseByNameOptions {
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1878
|
+
/**
|
|
1879
|
+
* Name of the game to load
|
|
1880
|
+
* @default 'Illusion of Gaia'
|
|
1881
|
+
*/
|
|
1882
|
+
gameName: string;
|
|
1883
|
+
/**
|
|
1884
|
+
* Name of the base ROM to load
|
|
1885
|
+
* @default 'GaiaLabs BaseROM'
|
|
1886
|
+
*/
|
|
1887
|
+
baseRomName: string;
|
|
1888
|
+
/**
|
|
1889
|
+
* Name of the branch to load
|
|
1890
|
+
* Set to null to load the main/develop branch
|
|
1891
|
+
* Set to undefined to not filter by branch name
|
|
1892
|
+
*/
|
|
1893
|
+
branchName?: string | null;
|
|
1894
|
+
/**
|
|
1895
|
+
* Version of the branch to load
|
|
1896
|
+
* Set to null to load the latest/main version
|
|
1897
|
+
* Set to undefined to not filter by version
|
|
1898
|
+
*/
|
|
1899
|
+
branchVersion?: number | null;
|
|
1817
1900
|
}
|
|
1818
1901
|
/**
|
|
1819
1902
|
* Error codes for Supabase operations
|
|
1820
1903
|
*/
|
|
1821
1904
|
declare enum SupabaseErrorCode {
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1905
|
+
BRANCH_NOT_FOUND = "BRANCH_NOT_FOUND",
|
|
1906
|
+
ROM_NOT_FOUND = "ROM_NOT_FOUND",
|
|
1907
|
+
FILES_NOT_FOUND = "FILES_NOT_FOUND",
|
|
1908
|
+
NETWORK_ERROR = "NETWORK_ERROR",
|
|
1909
|
+
INVALID_DATA = "INVALID_DATA",
|
|
1910
|
+
ENVIRONMENT_ERROR = "ENVIRONMENT_ERROR",
|
|
1911
|
+
PERMISSION_ERROR = "PERMISSION_ERROR",
|
|
1829
1912
|
}
|
|
1830
1913
|
/**
|
|
1831
1914
|
* Custom error class for Supabase operations
|
|
1832
1915
|
*/
|
|
1833
1916
|
declare class SupabaseFromError extends Error {
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1917
|
+
readonly code: SupabaseErrorCode;
|
|
1918
|
+
readonly details?: any;
|
|
1919
|
+
constructor(message: string, code: SupabaseErrorCode, details?: any);
|
|
1837
1920
|
}
|
|
1838
1921
|
/**
|
|
1839
1922
|
* Result type for async operations that may fail
|
|
1840
1923
|
*/
|
|
1841
1924
|
type SupabaseResult<T> = {
|
|
1842
|
-
|
|
1843
|
-
|
|
1925
|
+
data: T;
|
|
1926
|
+
error: null;
|
|
1844
1927
|
} | {
|
|
1845
|
-
|
|
1846
|
-
|
|
1928
|
+
data: null;
|
|
1929
|
+
error: SupabaseFromError;
|
|
1847
1930
|
};
|
|
1848
1931
|
/**
|
|
1849
1932
|
* Project information
|
|
1850
1933
|
*/
|
|
1851
1934
|
interface ProjectData {
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1935
|
+
id: string;
|
|
1936
|
+
name: string;
|
|
1937
|
+
meta: any | null;
|
|
1938
|
+
gameId: string;
|
|
1939
|
+
baseRomId: string;
|
|
1940
|
+
createdAt: string;
|
|
1941
|
+
updatedAt: string;
|
|
1859
1942
|
}
|
|
1860
1943
|
/**
|
|
1861
1944
|
* Project branch with complete relationship chain
|
|
1862
1945
|
*/
|
|
1863
1946
|
interface ProjectBranchData extends BranchBaseData {
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1947
|
+
projectId: string;
|
|
1948
|
+
baseRomBranchId: string;
|
|
1949
|
+
modules: any[];
|
|
1950
|
+
project: ProjectData;
|
|
1951
|
+
baseRomBranch: BaseRomBranchData;
|
|
1869
1952
|
}
|
|
1870
1953
|
/**
|
|
1871
1954
|
* Project file containing binary data
|
|
1872
1955
|
*/
|
|
1873
1956
|
interface ProjectFileData extends FileBaseData {
|
|
1874
|
-
|
|
1875
|
-
|
|
1957
|
+
module: string | null;
|
|
1958
|
+
projectId: string;
|
|
1876
1959
|
}
|
|
1877
1960
|
interface ProjectBranchFileRaw {
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1961
|
+
id: string;
|
|
1962
|
+
branchId: string;
|
|
1963
|
+
fileId: string;
|
|
1964
|
+
file: ProjectFileRaw;
|
|
1882
1965
|
}
|
|
1883
1966
|
/**
|
|
1884
1967
|
* Raw ProjectFile data as returned from Supabase (before conversion)
|
|
1885
1968
|
*/
|
|
1886
1969
|
interface ProjectFileRaw extends FileBaseRaw {
|
|
1887
|
-
|
|
1888
|
-
|
|
1970
|
+
module: string | null;
|
|
1971
|
+
projectId: string;
|
|
1889
1972
|
}
|
|
1890
1973
|
/**
|
|
1891
1974
|
* Complete Project payload containing branch data and files
|
|
1892
1975
|
*/
|
|
1893
1976
|
interface ProjectPayload {
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1977
|
+
projectBranch: ProjectBranchData;
|
|
1978
|
+
projectFiles: ProjectFileData[];
|
|
1979
|
+
baseRomBranch: BaseRomBranchData;
|
|
1980
|
+
baseRomFiles: BaseRomFileData[];
|
|
1898
1981
|
}
|
|
1899
1982
|
/**
|
|
1900
1983
|
* Options for loading Project data by name
|
|
1901
1984
|
*/
|
|
1902
1985
|
interface FromSupabaseByProjectOptions {
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1986
|
+
projectName: string;
|
|
1987
|
+
/**
|
|
1988
|
+
* Name of the branch to load
|
|
1989
|
+
* Set to null to load the main/develop branch
|
|
1990
|
+
* Set to undefined to not filter by branch name
|
|
1991
|
+
*/
|
|
1992
|
+
branchName?: string | null;
|
|
1993
|
+
/**
|
|
1994
|
+
* Version of the branch to load
|
|
1995
|
+
* Set to null to load the latest/main version
|
|
1996
|
+
* Set to undefined to not filter by version
|
|
1997
|
+
*/
|
|
1998
|
+
branchVersion?: number | null;
|
|
1916
1999
|
}
|
|
1917
2000
|
/**
|
|
1918
2001
|
* Query statistics for performance monitoring
|
|
1919
2002
|
*/
|
|
1920
2003
|
interface QueryStats {
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
2004
|
+
branchQueryTime: number;
|
|
2005
|
+
fileQueryTime: number;
|
|
2006
|
+
totalTime: number;
|
|
2007
|
+
fileCount: number;
|
|
1925
2008
|
}
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
* Supabase client configuration and initialization
|
|
1929
|
-
*/
|
|
1930
|
-
|
|
2009
|
+
//#endregion
|
|
2010
|
+
//#region src/supabase/client.d.ts
|
|
1931
2011
|
/**
|
|
1932
2012
|
* Database interface definitions based on Prisma schema
|
|
1933
2013
|
* These types represent the structure of data returned from Supabase queries
|
|
1934
2014
|
*/
|
|
1935
2015
|
interface Database {
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
};
|
|
2020
|
-
};
|
|
2016
|
+
public: {
|
|
2017
|
+
Tables: {
|
|
2018
|
+
BaseRom: {
|
|
2019
|
+
Row: {
|
|
2020
|
+
id: string;
|
|
2021
|
+
name: string;
|
|
2022
|
+
gameId: string;
|
|
2023
|
+
gameRomId: string;
|
|
2024
|
+
createdAt: string;
|
|
2025
|
+
updatedAt: string;
|
|
2026
|
+
};
|
|
2027
|
+
};
|
|
2028
|
+
BaseRomBranch: {
|
|
2029
|
+
Row: {
|
|
2030
|
+
id: string;
|
|
2031
|
+
name: string | null;
|
|
2032
|
+
version: number | null;
|
|
2033
|
+
isPublic: boolean;
|
|
2034
|
+
baseRomId: string;
|
|
2035
|
+
gameRomBranchId: string;
|
|
2036
|
+
fileCrcs: number[];
|
|
2037
|
+
createdAt: string;
|
|
2038
|
+
updatedAt: string;
|
|
2039
|
+
};
|
|
2040
|
+
};
|
|
2041
|
+
GameRomBranch: {
|
|
2042
|
+
Row: {
|
|
2043
|
+
id: string;
|
|
2044
|
+
name: string | null;
|
|
2045
|
+
version: number | null;
|
|
2046
|
+
isPublic: boolean;
|
|
2047
|
+
gameRomId: string;
|
|
2048
|
+
platformBranchId: string;
|
|
2049
|
+
coplib: any | null;
|
|
2050
|
+
config: any | null;
|
|
2051
|
+
files: any | null;
|
|
2052
|
+
blocks: any | null;
|
|
2053
|
+
fixups: any | null;
|
|
2054
|
+
strings: any | null;
|
|
2055
|
+
structs: any | null;
|
|
2056
|
+
scenes: any | null;
|
|
2057
|
+
createdAt: string;
|
|
2058
|
+
updatedAt: string;
|
|
2059
|
+
};
|
|
2060
|
+
};
|
|
2061
|
+
GameRomBranchAsset: {
|
|
2062
|
+
Row: {
|
|
2063
|
+
id: string;
|
|
2064
|
+
name: string;
|
|
2065
|
+
type: string;
|
|
2066
|
+
gameRomBranchId: string;
|
|
2067
|
+
text: string | null;
|
|
2068
|
+
data: string | null;
|
|
2069
|
+
createdAt: string;
|
|
2070
|
+
updatedAt: string;
|
|
2071
|
+
};
|
|
2072
|
+
};
|
|
2073
|
+
PlatformBranch: {
|
|
2074
|
+
Row: {
|
|
2075
|
+
id: string;
|
|
2076
|
+
name: string | null;
|
|
2077
|
+
version: number | null;
|
|
2078
|
+
isPublic: boolean;
|
|
2079
|
+
platformId: string;
|
|
2080
|
+
addressingModes: any | null;
|
|
2081
|
+
instructionSet: any | null;
|
|
2082
|
+
vectors: any | null;
|
|
2083
|
+
createdAt: string;
|
|
2084
|
+
updatedAt: string;
|
|
2085
|
+
};
|
|
2086
|
+
};
|
|
2087
|
+
BaseRomFile: {
|
|
2088
|
+
Row: {
|
|
2089
|
+
id: string;
|
|
2090
|
+
name: string;
|
|
2091
|
+
type: string;
|
|
2092
|
+
version: number | null;
|
|
2093
|
+
crc: number | null;
|
|
2094
|
+
meta: any | null;
|
|
2095
|
+
baseRomId: string;
|
|
2096
|
+
data: string;
|
|
2097
|
+
createdAt: string;
|
|
2098
|
+
updatedAt: string;
|
|
2021
2099
|
};
|
|
2100
|
+
};
|
|
2022
2101
|
};
|
|
2102
|
+
};
|
|
2023
2103
|
}
|
|
2024
2104
|
/**
|
|
2025
2105
|
* Create and configure a Supabase client instance
|
|
@@ -2036,14 +2116,8 @@ declare function getSupabaseClient(): SupabaseClient<Database>;
|
|
|
2036
2116
|
* Reset the singleton client instance (useful for testing)
|
|
2037
2117
|
*/
|
|
2038
2118
|
declare function resetSupabaseClient(): void;
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
* ROM data loading functions for Supabase integration
|
|
2042
|
-
*
|
|
2043
|
-
* This module provides functions to load ROM branch data and files from Supabase,
|
|
2044
|
-
* enabling cloud-based ROM database functionality for the GaiaLabs platform.
|
|
2045
|
-
*/
|
|
2046
|
-
|
|
2119
|
+
//#endregion
|
|
2120
|
+
//#region src/supabase/rom-loader.d.ts
|
|
2047
2121
|
/**
|
|
2048
2122
|
* Load ROM data from Supabase using a BaseRomBranch ID
|
|
2049
2123
|
*
|
|
@@ -2116,7 +2190,8 @@ declare function fromSupabaseByName(options: FromSupabaseByNameOptions): Promise
|
|
|
2116
2190
|
declare function fromSupabaseByProject(projectName?: string, branchId?: string): Promise<ProjectPayload>;
|
|
2117
2191
|
declare function fromSupabaseByGameRom(gameName?: string, regionName?: string, platformName?: string, branchId?: string): Promise<ProjectPayload>;
|
|
2118
2192
|
declare function summaryFromSupabaseByProject(projectName?: string): Promise<ProjectBranchData>;
|
|
2119
|
-
|
|
2193
|
+
//#endregion
|
|
2194
|
+
//#region src/supabase/utils.d.ts
|
|
2120
2195
|
/**
|
|
2121
2196
|
* Utility functions for Supabase integration
|
|
2122
2197
|
*/
|
|
@@ -2158,13 +2233,14 @@ declare function uint8ArrayToBase64(uint8Array: Uint8Array): string;
|
|
|
2158
2233
|
* @throws {Error} If any required environment variable is missing
|
|
2159
2234
|
*/
|
|
2160
2235
|
declare function validateEnvironmentVariables(requiredVars: string[]): void;
|
|
2161
|
-
|
|
2236
|
+
//#endregion
|
|
2237
|
+
//#region src/utils/file.d.ts
|
|
2162
2238
|
/**
|
|
2163
2239
|
* Universal file reading utilities
|
|
2164
2240
|
* Works in both Node.js and browser environments
|
|
2165
2241
|
*/
|
|
2166
2242
|
interface FileReadOptions {
|
|
2167
|
-
|
|
2243
|
+
encoding?: 'utf8' | 'binary';
|
|
2168
2244
|
}
|
|
2169
2245
|
/**
|
|
2170
2246
|
* Read a file as text
|
|
@@ -2212,10 +2288,10 @@ declare function createTempDirectory(prefix: string): Promise<string>;
|
|
|
2212
2288
|
*/
|
|
2213
2289
|
declare function removeDirectory(dirPath: string): Promise<void>;
|
|
2214
2290
|
interface DirectoryEntry {
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2291
|
+
name: string;
|
|
2292
|
+
path: string;
|
|
2293
|
+
isDirectory: boolean;
|
|
2294
|
+
isFile: boolean;
|
|
2219
2295
|
}
|
|
2220
2296
|
/**
|
|
2221
2297
|
* List directory contents
|
|
@@ -2225,9 +2301,9 @@ interface DirectoryEntry {
|
|
|
2225
2301
|
* @returns Promise<DirectoryEntry[]>
|
|
2226
2302
|
*/
|
|
2227
2303
|
declare function listDirectory(dirPath: string, options?: {
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2304
|
+
recursive?: boolean;
|
|
2305
|
+
filter?: (entry: DirectoryEntry) => boolean;
|
|
2306
|
+
extension?: string;
|
|
2231
2307
|
}): Promise<DirectoryEntry[]>;
|
|
2232
2308
|
/**
|
|
2233
2309
|
* Save text content to a file
|
|
@@ -2245,11 +2321,13 @@ declare function saveFileAsText(path: string, text: string): Promise<void>;
|
|
|
2245
2321
|
* @returns Promise<void>
|
|
2246
2322
|
*/
|
|
2247
2323
|
declare function saveFileAsBinary(path: string, data: Uint8Array): Promise<void>;
|
|
2248
|
-
|
|
2324
|
+
//#endregion
|
|
2325
|
+
//#region src/utils/crc.d.ts
|
|
2249
2326
|
declare function crc32_buffer(data: Uint8Array): number;
|
|
2250
2327
|
declare function crc32_text_utf8(text: string): number;
|
|
2251
2328
|
declare function crc32_text_utf16(text: string): number;
|
|
2252
|
-
|
|
2329
|
+
//#endregion
|
|
2330
|
+
//#region src/utils/base64.d.ts
|
|
2253
2331
|
/**
|
|
2254
2332
|
* Base64 encoding and decoding utilities for Uint8Arrays
|
|
2255
2333
|
* Works in both Node.js and browser environments
|
|
@@ -2286,25 +2364,27 @@ declare function encodeBase64String(text: string): string;
|
|
|
2286
2364
|
* @throws {Error} If the input is not a valid base64 string or doesn't contain valid UTF-8
|
|
2287
2365
|
*/
|
|
2288
2366
|
declare function decodeBase64String(base64String: string): string;
|
|
2289
|
-
|
|
2367
|
+
//#endregion
|
|
2368
|
+
//#region src/utils/debug-export.d.ts
|
|
2290
2369
|
/**
|
|
2291
2370
|
* Debug utility to export processing results as JSON for comparison
|
|
2292
2371
|
*/
|
|
2293
2372
|
declare class DebugExporter {
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
}
|
|
2307
|
-
|
|
2373
|
+
/**
|
|
2374
|
+
* Export chunk files to JSON for comparison with C# output
|
|
2375
|
+
*/
|
|
2376
|
+
static exportChunkFiles(files: ChunkFile[], filename: string): void;
|
|
2377
|
+
/**
|
|
2378
|
+
* Export patch application summary
|
|
2379
|
+
*/
|
|
2380
|
+
static exportPatchSummary(originalFiles: ChunkFile[], patchedFiles: ChunkFile[], patches: ChunkFile[], filename: string): void;
|
|
2381
|
+
/**
|
|
2382
|
+
* Export layout debugging information
|
|
2383
|
+
*/
|
|
2384
|
+
static exportLayoutDebug(files: ChunkFile[], filename: string): void;
|
|
2385
|
+
}
|
|
2386
|
+
//#endregion
|
|
2387
|
+
//#region src/utils/index.d.ts
|
|
2308
2388
|
/**
|
|
2309
2389
|
* Convert bytes to hex string
|
|
2310
2390
|
*/
|
|
@@ -2345,7 +2425,8 @@ declare function binaryToUtf8String(binaryData: Uint8Array): string;
|
|
|
2345
2425
|
*/
|
|
2346
2426
|
declare function getNestedProperty(obj: any, path: string): any;
|
|
2347
2427
|
declare function indexOfAny(str: string, chars: string[], startIndex?: number): number;
|
|
2348
|
-
|
|
2428
|
+
//#endregion
|
|
2429
|
+
//#region src/index.d.ts
|
|
2349
2430
|
/**
|
|
2350
2431
|
* GaiaCore - Universal ROM processing engine
|
|
2351
2432
|
*
|
|
@@ -2366,5 +2447,6 @@ declare const GAIA_CORE_VERSION = "0.1.6";
|
|
|
2366
2447
|
declare const isPlatformBrowser: boolean;
|
|
2367
2448
|
declare const isPlatformNode: string;
|
|
2368
2449
|
declare const isPlatformWebWorker: boolean;
|
|
2369
|
-
|
|
2370
|
-
export { Address, AddressSpace, AddressType, AddressingModeHandler, AsmBlock, AsmBlockUtils, AsmReader, Assembler,
|
|
2450
|
+
//#endregion
|
|
2451
|
+
export { Address, AddressSpace, AddressType, AddressingModeHandler, AsmBlock, AsmBlockUtils, AsmReader, Assembler, AssemblerContext, AssemblerState, BaseRomBranchData, BaseRomBranchFileRaw, BaseRomData, BaseRomFileData, BaseRomFileRaw, BaseRomPayload, BinType, BitStream, BlockReader, BlockReaderConstants, BlockWriter, BranchBaseData, Byte, ChunkFile, ChunkFileUtils, CollaborationConfig, CompressionAlgorithms, CompressionRegistry, CopCommandProcessor, CopDef, Database, DbAddressingMode, DbAsset, DbBaseRomModule, DbBlock, DbConfig, DbEntryPoint, DbFile, DbFileType, DbGameRomModule, DbGroup, DbLabel, DbMnemonic, DbOverride, DbPart, DbPath, DbRewrite, DbRoot, DbRootUtils, DbScene, DbSfx, DbStringCommand, DbStringDictionary, DbStringLayer, DbStringType, DbStringTypeUtils, DbStruct, DbTransform, DebugExporter, DirectoryEntry, FileBaseData, FileBaseRaw, FileReadOptions, FromSupabaseByNameOptions, FromSupabaseByProjectOptions, GAIA_CORE_VERSION, GameData, GameRomArtifactData, GameRomArtifactRaw, GameRomBranchArtifactRaw, GameRomBranchData, GameRomData, ICompressionProvider, LocationWrapper, Long, MapExt, MemberType, MemoryMapMode, ObjectType, Op, OpCode, OperationContext, PlatformBranchData, PlatformData, PostProcessor, ProcessorStateManager, ProjectBranchData, ProjectBranchFileRaw, ProjectConfig, ProjectData, ProjectFileData, ProjectFileRaw, ProjectPayload, QueryStats, QuintetLZ, ReferenceManager, RegionData, RegisterType, Registers, RomDataReader, RomGenerator, RomLayout, RomProcessingConstants, RomProcessor, RomState, RomStateUtils, RomWriter, SortedMap, SpriteFrame, SpriteGroup, SpriteMap, SpritePart, Stack, StackOperations, StatusFlags, StringEntry, StringMarker, StringProcessor, StringReader, StringSizeComparer, StringWrapper, StructDef, SupabaseErrorCode, SupabaseFromError, SupabaseResult, TableEntry, TransformProcessor, TypeParser, TypedNumber, Word, XformDef, XformType, base64ToUint8Array, binaryToUtf8String, bytesToHex, clamp, crc32_buffer, crc32_text_utf16, crc32_text_utf8, createChunkFileFromDbBlock, createChunkFileFromDbFile, createDbPath, createSupabaseClient, createTempDirectory, decodeBase64, decodeBase64String, decodeDataString, encodeBase64, encodeBase64String, fileExists, fromSupabaseByGameRom, fromSupabaseById, fromSupabaseByName, fromSupabaseByProject, getDirectory, getEnvVar, getNestedProperty, getSupabaseClient, hexToBytes, hexToUint8Array, indexOfAny, isPlatformBrowser, isPlatformNode, isPlatformWebWorker, isValidBase64, listDirectory, readFileAsBinary, readFileAsText, readJsonFile, removeDirectory, resetSupabaseClient, saveFileAsBinary, saveFileAsText, summaryFromSupabaseByProject, uint8ArrayToBase64, validateEnvironmentVariables };
|
|
2452
|
+
//# sourceMappingURL=index.d.mts.map
|