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