@gaialabs/core 0.1.0
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/browser.d.mts +2 -0
- package/dist/browser.d.ts +2 -0
- package/dist/browser.js +4 -0
- package/dist/browser.js.map +1 -0
- package/dist/browser.mjs +3 -0
- package/dist/browser.mjs.map +1 -0
- package/dist/index.d.mts +1015 -0
- package/dist/index.d.ts +1015 -0
- package/dist/index.js +3603 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +3561 -0
- package/dist/index.mjs.map +1 -0
- package/dist/node.d.mts +2 -0
- package/dist/node.d.ts +2 -0
- package/dist/node.js +4 -0
- package/dist/node.js.map +1 -0
- package/dist/node.mjs +3 -0
- package/dist/node.mjs.map +1 -0
- package/dist/worker.d.mts +2 -0
- package/dist/worker.d.ts +2 -0
- package/dist/worker.js +4 -0
- package/dist/worker.js.map +1 -0
- package/dist/worker.mjs +3 -0
- package/dist/worker.mjs.map +1 -0
- package/package.json +69 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1015 @@
|
|
|
1
|
+
import { DbRoot, BinType, DbPath, AddressingMode, AddressType, StatusFlags, CopDef, DbStringType, StringWrapper, DbBlock, DbPart, Address } from 'gaia-shared';
|
|
2
|
+
export { DbRoot } from 'gaia-shared';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Represents a single frame in a sprite animation sequence
|
|
6
|
+
*/
|
|
7
|
+
declare class SpriteFrame {
|
|
8
|
+
duration: number;
|
|
9
|
+
groupIndex: number;
|
|
10
|
+
/**
|
|
11
|
+
* Internal offset to the group data (not serialized)
|
|
12
|
+
*/
|
|
13
|
+
groupOffset: number;
|
|
14
|
+
constructor(duration?: number, groupIndex?: number, groupOffset?: number);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Represents a single part/piece of a sprite
|
|
19
|
+
*/
|
|
20
|
+
declare class SpritePart {
|
|
21
|
+
isLarge: boolean;
|
|
22
|
+
xOffset: number;
|
|
23
|
+
xOffsetMirror: number;
|
|
24
|
+
yOffset: number;
|
|
25
|
+
yOffsetMirror: number;
|
|
26
|
+
vMirror: boolean;
|
|
27
|
+
hMirror: boolean;
|
|
28
|
+
someOffset: number;
|
|
29
|
+
paletteIndex: number;
|
|
30
|
+
tileIndex: number;
|
|
31
|
+
constructor();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Represents a group of sprite parts that form a complete sprite frame
|
|
36
|
+
*/
|
|
37
|
+
declare class SpriteGroup {
|
|
38
|
+
xOffset: number;
|
|
39
|
+
xOffsetMirror: number;
|
|
40
|
+
yOffset: number;
|
|
41
|
+
yOffsetMirror: number;
|
|
42
|
+
xRecoilHitboxOffset: number;
|
|
43
|
+
yRecoilHitboxOffset: number;
|
|
44
|
+
xRecoilHitboxTilesize: number;
|
|
45
|
+
yRecoilHitboxTilesize: number;
|
|
46
|
+
xHostileHitboxOffset: number;
|
|
47
|
+
xHostileHitboxSize: number;
|
|
48
|
+
yHostileHitboxOffset: number;
|
|
49
|
+
yHostileHitboxSize: number;
|
|
50
|
+
parts: SpritePart[];
|
|
51
|
+
constructor();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Represents a complete sprite map with frame sets and groups
|
|
56
|
+
*/
|
|
57
|
+
declare class SpriteMap {
|
|
58
|
+
frameSets: SpriteFrame[][];
|
|
59
|
+
groups: SpriteGroup[];
|
|
60
|
+
constructor();
|
|
61
|
+
/**
|
|
62
|
+
* Create a SpriteMap from binary data
|
|
63
|
+
* @param data Binary data buffer
|
|
64
|
+
* @returns SpriteMap instance
|
|
65
|
+
*/
|
|
66
|
+
static fromBytes(data: Uint8Array): SpriteMap;
|
|
67
|
+
/**
|
|
68
|
+
* Convert this SpriteMap to binary data
|
|
69
|
+
* @returns Binary data buffer
|
|
70
|
+
*/
|
|
71
|
+
toBytes(): Uint8Array;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* ROM state management for SNES hardware emulation
|
|
76
|
+
* Converted from GaiaLib/Rom/RomState.cs
|
|
77
|
+
*/
|
|
78
|
+
declare class RomState {
|
|
79
|
+
readonly cgram: Uint8Array<ArrayBuffer>;
|
|
80
|
+
readonly vram: Uint8Array<ArrayBuffer>;
|
|
81
|
+
readonly mainTileset: Uint8Array<ArrayBuffer>;
|
|
82
|
+
readonly effectTileset: Uint8Array<ArrayBuffer>;
|
|
83
|
+
mainTilesetPath?: string;
|
|
84
|
+
effectTilesetPath?: string;
|
|
85
|
+
mainTilemap: Uint8Array<ArrayBuffer>;
|
|
86
|
+
mainTilemapW: number;
|
|
87
|
+
mainTilemapH: number;
|
|
88
|
+
mainTilemapPath?: string;
|
|
89
|
+
effectTilemap: Uint8Array<ArrayBuffer>;
|
|
90
|
+
effectTilemapW: number;
|
|
91
|
+
effectTilemapH: number;
|
|
92
|
+
effectTilemapPath?: string;
|
|
93
|
+
static spriteMap: SpriteMap | null;
|
|
94
|
+
static spriteMapPath: string | null;
|
|
95
|
+
/**
|
|
96
|
+
* Strip address space prefixes from names
|
|
97
|
+
*/
|
|
98
|
+
static stripName(name: string): string;
|
|
99
|
+
/**
|
|
100
|
+
* Create ROM state from scene metadata
|
|
101
|
+
* Simplified version of the C# implementation
|
|
102
|
+
*/
|
|
103
|
+
static fromScene(baseDir: string, root: DbRoot, metaFile: string, id: number): Promise<RomState>;
|
|
104
|
+
/**
|
|
105
|
+
* Process scene command (simplified version)
|
|
106
|
+
* TODO: Implement full command processing
|
|
107
|
+
*/
|
|
108
|
+
private static processCommand;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* ROM state utilities
|
|
112
|
+
*/
|
|
113
|
+
declare class RomStateUtils {
|
|
114
|
+
/**
|
|
115
|
+
* Create empty ROM state
|
|
116
|
+
*/
|
|
117
|
+
static createEmpty(): RomState;
|
|
118
|
+
/**
|
|
119
|
+
* Clear all data in ROM state
|
|
120
|
+
*/
|
|
121
|
+
static clear(state: RomState): void;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Interface for compression providers
|
|
126
|
+
*/
|
|
127
|
+
interface ICompressionProvider {
|
|
128
|
+
/**
|
|
129
|
+
* Expand (decompress) data
|
|
130
|
+
* @param srcData Source data buffer
|
|
131
|
+
* @param srcPosition Starting position in source data
|
|
132
|
+
* @param srcLen Length of source data to process
|
|
133
|
+
* @returns Expanded data
|
|
134
|
+
*/
|
|
135
|
+
expand(srcData: Uint8Array, srcPosition?: number, srcLen?: number): Uint8Array;
|
|
136
|
+
/**
|
|
137
|
+
* Compact (compress) data
|
|
138
|
+
* @param srcData Source data to compress
|
|
139
|
+
* @returns Compressed data
|
|
140
|
+
*/
|
|
141
|
+
compact(srcData: Uint8Array): Uint8Array;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* QuintetLZ compression algorithm implementation
|
|
146
|
+
* Dictionary-based compression used in Quintet games
|
|
147
|
+
*/
|
|
148
|
+
declare class QuintetLZ implements ICompressionProvider {
|
|
149
|
+
static readonly DICTIONARY_SIZE = 256;
|
|
150
|
+
static readonly DICTIONARY_INIT = 32;
|
|
151
|
+
static readonly DICTIONARY_OFFSET = 239;
|
|
152
|
+
private static readonly DEFAULT_PAGE_SIZE;
|
|
153
|
+
/**
|
|
154
|
+
* Expand (decompress) data using QuintetLZ algorithm
|
|
155
|
+
* @param srcData Source data buffer
|
|
156
|
+
* @param srcPosition Starting position in source data
|
|
157
|
+
* @param srcLen Length of source data to process
|
|
158
|
+
* @returns Expanded data
|
|
159
|
+
*/
|
|
160
|
+
expand(srcData: Uint8Array, srcPosition?: number, srcLen?: number): Uint8Array;
|
|
161
|
+
/**
|
|
162
|
+
* Compact (compress) data using QuintetLZ algorithm
|
|
163
|
+
* @param srcData Source data to compress
|
|
164
|
+
* @returns Compressed data
|
|
165
|
+
*/
|
|
166
|
+
compact(srcData: Uint8Array): Uint8Array;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Main project management class
|
|
171
|
+
* Converted from GaiaLib/ProjectRoot.cs
|
|
172
|
+
*/
|
|
173
|
+
interface ProjectConfig {
|
|
174
|
+
name: string;
|
|
175
|
+
romPath: string;
|
|
176
|
+
baseDir: string;
|
|
177
|
+
system?: string;
|
|
178
|
+
database: string;
|
|
179
|
+
flipsPath?: string;
|
|
180
|
+
resources: Record<BinType, DbPath>;
|
|
181
|
+
databasePath?: string;
|
|
182
|
+
systemPath?: string;
|
|
183
|
+
compression?: string;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Project root management
|
|
187
|
+
*/
|
|
188
|
+
declare class ProjectRoot {
|
|
189
|
+
config: ProjectConfig;
|
|
190
|
+
name: string;
|
|
191
|
+
romPath: string;
|
|
192
|
+
baseDir: string;
|
|
193
|
+
system?: string;
|
|
194
|
+
database: string;
|
|
195
|
+
flipsPath?: string;
|
|
196
|
+
resources: Record<BinType, DbPath>;
|
|
197
|
+
databasePath?: string;
|
|
198
|
+
systemPath?: string;
|
|
199
|
+
compression?: string;
|
|
200
|
+
constructor(config: ProjectConfig);
|
|
201
|
+
/**
|
|
202
|
+
* Get compression provider
|
|
203
|
+
*/
|
|
204
|
+
getCompression(): ICompressionProvider;
|
|
205
|
+
/**
|
|
206
|
+
* Load project from file or directory
|
|
207
|
+
*/
|
|
208
|
+
static load(path?: string): Promise<ProjectRoot>;
|
|
209
|
+
/**
|
|
210
|
+
* Build the ROM (simplified)
|
|
211
|
+
*/
|
|
212
|
+
build(): Promise<void>;
|
|
213
|
+
/**
|
|
214
|
+
* Dump database and extract ROM data
|
|
215
|
+
*/
|
|
216
|
+
dumpDatabase(): Promise<DbRoot>;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Unified ROM processor providing high-level APIs for common ROM processing workflows
|
|
221
|
+
* This is the main entry point for ROM processing operations
|
|
222
|
+
*/
|
|
223
|
+
declare class RomProcessor {
|
|
224
|
+
private projectRoot;
|
|
225
|
+
private dbRoot;
|
|
226
|
+
private romData;
|
|
227
|
+
private romState;
|
|
228
|
+
constructor(projectConfig: ProjectConfig);
|
|
229
|
+
/**
|
|
230
|
+
* Create ROM processor from project file or directory
|
|
231
|
+
*/
|
|
232
|
+
static fromProject(path?: string): Promise<RomProcessor>;
|
|
233
|
+
/**
|
|
234
|
+
* Load ROM data from file or URL
|
|
235
|
+
*/
|
|
236
|
+
loadRom(romPath?: string): Promise<void>;
|
|
237
|
+
/**
|
|
238
|
+
* Initialize database and load ROM metadata
|
|
239
|
+
*/
|
|
240
|
+
initialize(): Promise<void>;
|
|
241
|
+
/**
|
|
242
|
+
* Analyze ROM structure and extract metadata
|
|
243
|
+
*/
|
|
244
|
+
analyze(): Promise<RomAnalysisResult>;
|
|
245
|
+
/**
|
|
246
|
+
* Extract files from ROM data
|
|
247
|
+
*/
|
|
248
|
+
extract(outputDir: string): Promise<ExtractionResult>;
|
|
249
|
+
/**
|
|
250
|
+
* Process scene data for a specific scene ID
|
|
251
|
+
*/
|
|
252
|
+
processScene(sceneId: number, metaFile: string): Promise<RomState>;
|
|
253
|
+
/**
|
|
254
|
+
* Build ROM from extracted files
|
|
255
|
+
*/
|
|
256
|
+
build(outputPath: string): Promise<BuildResult>;
|
|
257
|
+
/**
|
|
258
|
+
* Get compression provider for the project
|
|
259
|
+
*/
|
|
260
|
+
getCompression(): QuintetLZ;
|
|
261
|
+
/**
|
|
262
|
+
* Get current ROM state
|
|
263
|
+
*/
|
|
264
|
+
getRomState(): RomState | null;
|
|
265
|
+
/**
|
|
266
|
+
* Get database root
|
|
267
|
+
*/
|
|
268
|
+
getDatabase(): DbRoot | null;
|
|
269
|
+
/**
|
|
270
|
+
* Get project configuration
|
|
271
|
+
*/
|
|
272
|
+
getProject(): ProjectRoot;
|
|
273
|
+
private analyzeHeader;
|
|
274
|
+
private detectCompression;
|
|
275
|
+
private analyzeOpcodes;
|
|
276
|
+
}
|
|
277
|
+
interface RomAnalysisResult {
|
|
278
|
+
romSize: number;
|
|
279
|
+
headerInfo: RomHeaderInfo;
|
|
280
|
+
entryPoints: any[];
|
|
281
|
+
fileCount: number;
|
|
282
|
+
blockCount: number;
|
|
283
|
+
compressionUsed: boolean;
|
|
284
|
+
spriteMapFound: boolean;
|
|
285
|
+
opcodeStats: OpcodeStats;
|
|
286
|
+
}
|
|
287
|
+
interface RomHeaderInfo {
|
|
288
|
+
title: string;
|
|
289
|
+
mapMode: number;
|
|
290
|
+
cartridgeType: number;
|
|
291
|
+
romSize: number;
|
|
292
|
+
ramSize: number;
|
|
293
|
+
isValid: boolean;
|
|
294
|
+
}
|
|
295
|
+
interface ExtractionResult {
|
|
296
|
+
extractedFiles: string[];
|
|
297
|
+
errors: string[];
|
|
298
|
+
totalSize: number;
|
|
299
|
+
}
|
|
300
|
+
interface BuildResult {
|
|
301
|
+
success: boolean;
|
|
302
|
+
outputPath: string;
|
|
303
|
+
romSize: number;
|
|
304
|
+
errors: string[];
|
|
305
|
+
}
|
|
306
|
+
interface OpcodeStats {
|
|
307
|
+
totalOpcodes: number;
|
|
308
|
+
uniqueOpcodes: number;
|
|
309
|
+
coverage: number;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Project lifecycle management events
|
|
314
|
+
*/
|
|
315
|
+
interface ProjectEvents {
|
|
316
|
+
onLoadStart?: () => void;
|
|
317
|
+
onLoadComplete?: (processor: RomProcessor) => void;
|
|
318
|
+
onLoadError?: (error: Error) => void;
|
|
319
|
+
onAnalysisStart?: () => void;
|
|
320
|
+
onAnalysisComplete?: (results: any) => void;
|
|
321
|
+
onExtractionStart?: () => void;
|
|
322
|
+
onExtractionComplete?: (results: any) => void;
|
|
323
|
+
onBuildStart?: () => void;
|
|
324
|
+
onBuildComplete?: (results: any) => void;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Project status tracking
|
|
328
|
+
*/
|
|
329
|
+
interface ProjectStatus {
|
|
330
|
+
isLoaded: boolean;
|
|
331
|
+
isAnalyzed: boolean;
|
|
332
|
+
isExtracted: boolean;
|
|
333
|
+
canBuild: boolean;
|
|
334
|
+
lastError?: Error;
|
|
335
|
+
progress: number;
|
|
336
|
+
currentTask?: string;
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Unified project manager for complete project lifecycle management
|
|
340
|
+
* This is the highest-level API for managing ROM hacking projects
|
|
341
|
+
*/
|
|
342
|
+
declare class ProjectManager {
|
|
343
|
+
private processor;
|
|
344
|
+
private status;
|
|
345
|
+
private events;
|
|
346
|
+
constructor(events?: ProjectEvents);
|
|
347
|
+
/**
|
|
348
|
+
* Create project manager from existing project configuration
|
|
349
|
+
*/
|
|
350
|
+
static fromConfig(config: ProjectConfig, events?: ProjectEvents): Promise<ProjectManager>;
|
|
351
|
+
/**
|
|
352
|
+
* Create project manager from project file or directory
|
|
353
|
+
*/
|
|
354
|
+
static fromPath(path: string, events?: ProjectEvents): Promise<ProjectManager>;
|
|
355
|
+
/**
|
|
356
|
+
* Load project from configuration
|
|
357
|
+
*/
|
|
358
|
+
loadProject(config: ProjectConfig): Promise<void>;
|
|
359
|
+
/**
|
|
360
|
+
* Load project from file or directory path
|
|
361
|
+
*/
|
|
362
|
+
loadProjectFromPath(path: string): Promise<void>;
|
|
363
|
+
/**
|
|
364
|
+
* Analyze ROM structure and extract metadata
|
|
365
|
+
*/
|
|
366
|
+
analyzeRom(): Promise<any>;
|
|
367
|
+
/**
|
|
368
|
+
* Extract files from ROM
|
|
369
|
+
*/
|
|
370
|
+
extractFiles(outputDir: string): Promise<any>;
|
|
371
|
+
/**
|
|
372
|
+
* Build ROM from extracted files
|
|
373
|
+
*/
|
|
374
|
+
buildRom(outputPath: string): Promise<any>;
|
|
375
|
+
/**
|
|
376
|
+
* Process specific scene
|
|
377
|
+
*/
|
|
378
|
+
processScene(sceneId: number, metaFile: string): Promise<RomState>;
|
|
379
|
+
/**
|
|
380
|
+
* Get current project status
|
|
381
|
+
*/
|
|
382
|
+
getStatus(): ProjectStatus;
|
|
383
|
+
/**
|
|
384
|
+
* Get the ROM processor instance
|
|
385
|
+
*/
|
|
386
|
+
getProcessor(): RomProcessor | null;
|
|
387
|
+
/**
|
|
388
|
+
* Get project configuration
|
|
389
|
+
*/
|
|
390
|
+
getProjectConfig(): ProjectConfig | null;
|
|
391
|
+
/**
|
|
392
|
+
* Get database root
|
|
393
|
+
*/
|
|
394
|
+
getDatabase(): DbRoot | null;
|
|
395
|
+
/**
|
|
396
|
+
* Get ROM state
|
|
397
|
+
*/
|
|
398
|
+
getRomState(): RomState | null;
|
|
399
|
+
/**
|
|
400
|
+
* Reset project to initial state
|
|
401
|
+
*/
|
|
402
|
+
reset(): void;
|
|
403
|
+
/**
|
|
404
|
+
* Complete workflow: load, analyze, extract, and build
|
|
405
|
+
*/
|
|
406
|
+
completeWorkflow(projectPath: string, outputDir: string, outputRomPath: string): Promise<any>;
|
|
407
|
+
private updateStatus;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* Represents a 65816 processor opcode
|
|
412
|
+
*/
|
|
413
|
+
declare class OpCode {
|
|
414
|
+
code: number;
|
|
415
|
+
mnem: string;
|
|
416
|
+
mode: AddressingMode;
|
|
417
|
+
size: number;
|
|
418
|
+
constructor(code: number, mnem: string, mode: AddressingMode, size: number);
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* Complete 65816 instruction set lookup table
|
|
422
|
+
*/
|
|
423
|
+
declare const ALL_OPCODES: Record<number, OpCode>;
|
|
424
|
+
/**
|
|
425
|
+
* Grouped opcodes by mnemonic
|
|
426
|
+
*/
|
|
427
|
+
declare const GROUPED_OPCODES: Record<string, OpCode[]>;
|
|
428
|
+
/**
|
|
429
|
+
* Regular expressions for parsing addressing modes
|
|
430
|
+
*/
|
|
431
|
+
declare const ADDRESSING_REGEX: Record<AddressingMode, RegExp>;
|
|
432
|
+
/**
|
|
433
|
+
* Hex character validation regex
|
|
434
|
+
*/
|
|
435
|
+
declare const HEX_REGEX: RegExp;
|
|
436
|
+
/**
|
|
437
|
+
* Utility methods for OpCode class
|
|
438
|
+
*/
|
|
439
|
+
declare class OpCodeUtils {
|
|
440
|
+
/**
|
|
441
|
+
* Get all available opcodes
|
|
442
|
+
*/
|
|
443
|
+
static getAllOpcodes(): OpCode[];
|
|
444
|
+
/**
|
|
445
|
+
* Get opcodes by mnemonic
|
|
446
|
+
*/
|
|
447
|
+
static getByMnemonic(mnemonic: string): OpCode[];
|
|
448
|
+
/**
|
|
449
|
+
* Find opcode by hex value
|
|
450
|
+
*/
|
|
451
|
+
static findByCode(code: number): OpCode | undefined;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
/**
|
|
455
|
+
* Manages CPU processor state during ROM analysis
|
|
456
|
+
* Converted from GaiaLib/Rom/Extraction/ProcessorStateManager.cs
|
|
457
|
+
*/
|
|
458
|
+
declare class ProcessorStateManager {
|
|
459
|
+
readonly accumulatorFlags: Map<number, boolean | null>;
|
|
460
|
+
readonly indexFlags: Map<number, boolean | null>;
|
|
461
|
+
readonly bankNotes: Map<number, number | null>;
|
|
462
|
+
readonly stackPositions: Map<number, number>;
|
|
463
|
+
/**
|
|
464
|
+
* Hydrate processor registers with stored state
|
|
465
|
+
* Uses Registers from gaia-core/assembly for processor state management
|
|
466
|
+
*/
|
|
467
|
+
hydrateRegisters(position: number, reg: any): void;
|
|
468
|
+
getAccumulatorFlag(location: number): boolean | null | undefined;
|
|
469
|
+
setAccumulatorFlag(location: number, value: boolean | null): void;
|
|
470
|
+
tryAddAccumulatorFlag(location: number, value: boolean | null): boolean;
|
|
471
|
+
getIndexFlag(location: number): boolean | null | undefined;
|
|
472
|
+
setIndexFlag(location: number, value: boolean | null): void;
|
|
473
|
+
tryAddIndexFlag(location: number, value: boolean | null): boolean;
|
|
474
|
+
getBankNote(location: number): number | null | undefined;
|
|
475
|
+
setBankNote(location: number, value: number | null): void;
|
|
476
|
+
getStackPosition(location: number): number | undefined;
|
|
477
|
+
setStackPosition(location: number, value: number): void;
|
|
478
|
+
tryAddStackPosition(location: number, value: number): boolean;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
/**
|
|
482
|
+
* Provides low-level ROM data reading functionality
|
|
483
|
+
* Converted from GaiaLib/Rom/Extraction/RomDataReader.cs
|
|
484
|
+
*/
|
|
485
|
+
declare class RomDataReader {
|
|
486
|
+
readonly romData: Uint8Array;
|
|
487
|
+
position: number;
|
|
488
|
+
constructor(romData: Uint8Array);
|
|
489
|
+
readByte(): number;
|
|
490
|
+
readSByte(): number;
|
|
491
|
+
readUShort(): number;
|
|
492
|
+
readShort(): number;
|
|
493
|
+
readAddress(): number;
|
|
494
|
+
readInt(): number;
|
|
495
|
+
peekByte(): number;
|
|
496
|
+
peekShort(): number;
|
|
497
|
+
peekAddress(): number;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* Manages references, chunks, and markers during ROM analysis
|
|
502
|
+
* Converted from GaiaLib/Rom/Extraction/ReferenceManager.cs
|
|
503
|
+
*/
|
|
504
|
+
declare class ReferenceManager {
|
|
505
|
+
readonly structTable: Map<number, string>;
|
|
506
|
+
readonly markerTable: Map<number, number>;
|
|
507
|
+
readonly nameTable: Map<number, string>;
|
|
508
|
+
private readonly root;
|
|
509
|
+
constructor(root: DbRoot);
|
|
510
|
+
tryGetStruct(location: number): {
|
|
511
|
+
found: boolean;
|
|
512
|
+
chunkType?: string;
|
|
513
|
+
};
|
|
514
|
+
tryAddStruct(location: number, chunkType: string): boolean;
|
|
515
|
+
containsStruct(location: number): boolean;
|
|
516
|
+
tryGetName(location: number): {
|
|
517
|
+
found: boolean;
|
|
518
|
+
referenceName?: string;
|
|
519
|
+
};
|
|
520
|
+
tryAddName(location: number, referenceName: string): boolean;
|
|
521
|
+
tryGetMarker(location: number): {
|
|
522
|
+
found: boolean;
|
|
523
|
+
offset?: number;
|
|
524
|
+
};
|
|
525
|
+
setMarker(location: number, offset: number): void;
|
|
526
|
+
createBranchLabel(location: number): string;
|
|
527
|
+
createTypeName(type: string, location: number): string;
|
|
528
|
+
createFallbackName(location: number): string;
|
|
529
|
+
/**
|
|
530
|
+
* Finds a reference location by its assigned name.
|
|
531
|
+
*/
|
|
532
|
+
findLocationByName(name: string): number | undefined;
|
|
533
|
+
resolveName(location: number, type: AddressType, isBranch: boolean): string;
|
|
534
|
+
findClosestReference(location: number): string | null;
|
|
535
|
+
private processRewrite;
|
|
536
|
+
private processClosestMatch;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
|
+
* Represents the stack for the 65816 processor
|
|
541
|
+
*/
|
|
542
|
+
declare class Stack {
|
|
543
|
+
bytes: Uint8Array;
|
|
544
|
+
location: number;
|
|
545
|
+
constructor();
|
|
546
|
+
/**
|
|
547
|
+
* Push a byte onto the stack
|
|
548
|
+
*/
|
|
549
|
+
push(value: number): void;
|
|
550
|
+
/**
|
|
551
|
+
* Push a 16-bit value onto the stack (little-endian)
|
|
552
|
+
*/
|
|
553
|
+
pushUInt16(value: number): void;
|
|
554
|
+
/**
|
|
555
|
+
* Pop a byte from the stack
|
|
556
|
+
*/
|
|
557
|
+
popByte(): number;
|
|
558
|
+
/**
|
|
559
|
+
* Pop a 16-bit value from the stack (little-endian)
|
|
560
|
+
*/
|
|
561
|
+
popUInt16(): number;
|
|
562
|
+
/**
|
|
563
|
+
* Reset the stack to initial state
|
|
564
|
+
*/
|
|
565
|
+
reset(): void;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
/**
|
|
569
|
+
* Manages the 65816 processor registers and status flags
|
|
570
|
+
*/
|
|
571
|
+
declare class Registers {
|
|
572
|
+
accumulatorFlag?: boolean;
|
|
573
|
+
indexFlag?: boolean;
|
|
574
|
+
direct?: number;
|
|
575
|
+
dataBank?: number;
|
|
576
|
+
accumulator?: number;
|
|
577
|
+
xIndex?: number;
|
|
578
|
+
yIndex?: number;
|
|
579
|
+
stack: Stack;
|
|
580
|
+
constructor();
|
|
581
|
+
/**
|
|
582
|
+
* Get the current status flags
|
|
583
|
+
*/
|
|
584
|
+
get statusFlags(): StatusFlags;
|
|
585
|
+
/**
|
|
586
|
+
* Set the status flags
|
|
587
|
+
*/
|
|
588
|
+
set statusFlags(value: StatusFlags);
|
|
589
|
+
/**
|
|
590
|
+
* Reset all registers to initial state
|
|
591
|
+
*/
|
|
592
|
+
reset(): void;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
/**
|
|
596
|
+
* Represents a single assembly operation/instruction
|
|
597
|
+
*/
|
|
598
|
+
declare class Op {
|
|
599
|
+
code: OpCode;
|
|
600
|
+
location: number;
|
|
601
|
+
operands: unknown[];
|
|
602
|
+
size: number;
|
|
603
|
+
copDef?: CopDef;
|
|
604
|
+
constructor(code: OpCode, location?: number, operands?: unknown[], size?: number);
|
|
605
|
+
/**
|
|
606
|
+
* Get the formatted string representation of this operation
|
|
607
|
+
*/
|
|
608
|
+
toString(): string;
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
/**
|
|
612
|
+
* Reads and processes strings from ROM data
|
|
613
|
+
* Converted from GaiaLib/Rom/Extraction/StringReader.cs
|
|
614
|
+
*/
|
|
615
|
+
declare class StringReader {
|
|
616
|
+
static readonly STRING_REFERENCE_CHARACTERS: string[];
|
|
617
|
+
private readonly _blockReader;
|
|
618
|
+
private readonly _romDataReader;
|
|
619
|
+
constructor(blockReader: BlockReader);
|
|
620
|
+
private resolveCommand;
|
|
621
|
+
parseString(stringType: DbStringType): StringWrapper;
|
|
622
|
+
/**
|
|
623
|
+
* Handles character shifting based on string type
|
|
624
|
+
* This is a simplified implementation of the shift logic
|
|
625
|
+
*/
|
|
626
|
+
private shiftDown;
|
|
627
|
+
resolveString(sw: StringWrapper, isBranch: boolean): void;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
/**
|
|
631
|
+
* Parses assembly instructions from ROM data, handling different addressing modes
|
|
632
|
+
* and maintaining CPU register state during analysis.
|
|
633
|
+
* Converted from GaiaLib/Rom/Extraction/AsmReader.cs
|
|
634
|
+
*/
|
|
635
|
+
declare class AsmReader {
|
|
636
|
+
private static readonly ACCUMULATOR_OP_MASK;
|
|
637
|
+
private static readonly ACCUMULATOR_OP_VALUE;
|
|
638
|
+
private static readonly VARIABLE_SIZE_INDICATOR;
|
|
639
|
+
private static readonly TWO_BYTES_SIZE;
|
|
640
|
+
private static readonly THREE_BYTES_SIZE;
|
|
641
|
+
private readonly _blockReader;
|
|
642
|
+
private readonly _transformProcessor;
|
|
643
|
+
private readonly _addressingModeHandler;
|
|
644
|
+
private readonly _romDataReader;
|
|
645
|
+
constructor(blockReader: BlockReader);
|
|
646
|
+
parseAsm(reg: Registers): Op;
|
|
647
|
+
clearDestinationRegister(code: OpCode, reg: Registers): void;
|
|
648
|
+
private initializeOperation;
|
|
649
|
+
private calculateInstructionSize;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
/**
|
|
653
|
+
* Handles parsing of different data types from ROM
|
|
654
|
+
* Converted from GaiaLib/Rom/Extraction/TypeParser.cs
|
|
655
|
+
*/
|
|
656
|
+
declare class TypeParser {
|
|
657
|
+
private readonly _blockReader;
|
|
658
|
+
private readonly _romDataReader;
|
|
659
|
+
private readonly _stringReader;
|
|
660
|
+
private readonly _stringTypes;
|
|
661
|
+
private readonly _referenceManager;
|
|
662
|
+
constructor(blockReader: BlockReader);
|
|
663
|
+
parseType(typeName: string, reg: Registers | null, depth: number, bank?: number): unknown;
|
|
664
|
+
private tryParseMemberType;
|
|
665
|
+
private parseWordSafe;
|
|
666
|
+
private parseBinary;
|
|
667
|
+
private parseLocation;
|
|
668
|
+
private parseCode;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
/**
|
|
672
|
+
* Central class for reading and analyzing ROM blocks
|
|
673
|
+
* Converted from GaiaLib/Rom/Extraction/BlockReader.cs
|
|
674
|
+
*/
|
|
675
|
+
declare class BlockReader {
|
|
676
|
+
private static readonly REF_SEARCH_MAX_RANGE;
|
|
677
|
+
private static readonly BANK_MASK_CHECK;
|
|
678
|
+
private static readonly BYTE_DELIMITER_THRESHOLD;
|
|
679
|
+
private static readonly BANK_HIGH_MEMORY_1;
|
|
680
|
+
private static readonly BANK_HIGH_MEMORY_2;
|
|
681
|
+
private static readonly POINTER_CHARACTERS;
|
|
682
|
+
private static readonly LOCATION_REGEX;
|
|
683
|
+
readonly _root: DbRoot;
|
|
684
|
+
readonly _stringReader: StringReader;
|
|
685
|
+
readonly _asmReader: AsmReader;
|
|
686
|
+
readonly _typeParser: TypeParser;
|
|
687
|
+
readonly _romDataReader: RomDataReader;
|
|
688
|
+
readonly _stateManager: ProcessorStateManager;
|
|
689
|
+
readonly _referenceManager: ReferenceManager;
|
|
690
|
+
get AccumulatorFlags(): Map<number, boolean | null>;
|
|
691
|
+
get IndexFlags(): Map<number, boolean | null>;
|
|
692
|
+
get BankNotes(): Map<number, number | null>;
|
|
693
|
+
get StackPosition(): Map<number, number>;
|
|
694
|
+
get _structTable(): Map<number, string>;
|
|
695
|
+
get _markerTable(): Map<number, number>;
|
|
696
|
+
get _nameTable(): Map<number, string>;
|
|
697
|
+
_currentBlock: DbBlock;
|
|
698
|
+
_currentPart: DbPart | null;
|
|
699
|
+
_partEnd: number;
|
|
700
|
+
constructor(romData: Uint8Array, root: DbRoot);
|
|
701
|
+
/**
|
|
702
|
+
* Processes predefined overrides for registers and bank notes
|
|
703
|
+
*/
|
|
704
|
+
private initializeOverrides;
|
|
705
|
+
/**
|
|
706
|
+
* Processes predefined file references
|
|
707
|
+
*/
|
|
708
|
+
private initializeFileReferences;
|
|
709
|
+
/**
|
|
710
|
+
* Resolves mnemonic for a given address
|
|
711
|
+
*/
|
|
712
|
+
resolveMnemonic(addr: Address): void;
|
|
713
|
+
/**
|
|
714
|
+
* Resolves name for a location (delegated to ReferenceManager)
|
|
715
|
+
*/
|
|
716
|
+
resolveName(location: number, type: AddressType, isBranch: boolean): string;
|
|
717
|
+
/**
|
|
718
|
+
* Resolves include for a location
|
|
719
|
+
*/
|
|
720
|
+
resolveInclude(loc: number, isBranch: boolean): void;
|
|
721
|
+
/**
|
|
722
|
+
* Notes a type at a location and manages chunk references
|
|
723
|
+
*/
|
|
724
|
+
noteType(loc: number, type: string, silent?: boolean, reg?: Registers): string;
|
|
725
|
+
private updateRegisterState;
|
|
726
|
+
/**
|
|
727
|
+
* Checks if a delimiter has been reached
|
|
728
|
+
*/
|
|
729
|
+
delimiterReached(delimiter?: number): boolean;
|
|
730
|
+
/**
|
|
731
|
+
* Checks if processing of the current part can continue
|
|
732
|
+
*/
|
|
733
|
+
partCanContinue(): boolean;
|
|
734
|
+
/**
|
|
735
|
+
* Main analysis entry point
|
|
736
|
+
*/
|
|
737
|
+
analyzeAndResolve(): void;
|
|
738
|
+
/**
|
|
739
|
+
* Analyzes all blocks in the ROM
|
|
740
|
+
*/
|
|
741
|
+
private analyzeBlocks;
|
|
742
|
+
/**
|
|
743
|
+
* Initializes blocks and parts with base references
|
|
744
|
+
*/
|
|
745
|
+
private initializeBlocksAndParts;
|
|
746
|
+
/**
|
|
747
|
+
* Processes a single part
|
|
748
|
+
*/
|
|
749
|
+
private processPart;
|
|
750
|
+
/**
|
|
751
|
+
* Processes a continuous entry (same type as previous)
|
|
752
|
+
*/
|
|
753
|
+
private processContinuousEntry;
|
|
754
|
+
/**
|
|
755
|
+
* Processes a new entry
|
|
756
|
+
*/
|
|
757
|
+
private processNewEntry;
|
|
758
|
+
/**
|
|
759
|
+
* Resolves all references after analysis
|
|
760
|
+
*/
|
|
761
|
+
private resolveReferences;
|
|
762
|
+
/**
|
|
763
|
+
* Resolves a single object and its references
|
|
764
|
+
*/
|
|
765
|
+
private resolveObject;
|
|
766
|
+
/**
|
|
767
|
+
* Resolves references in an operation object
|
|
768
|
+
*/
|
|
769
|
+
private resolveOperationObject;
|
|
770
|
+
/**
|
|
771
|
+
* Checks if an operation is a branch operation
|
|
772
|
+
*/
|
|
773
|
+
private isBranchOperation;
|
|
774
|
+
/**
|
|
775
|
+
* Hydrates registers with stored state
|
|
776
|
+
*/
|
|
777
|
+
hydrateRegisters(reg: Registers): void;
|
|
778
|
+
/**
|
|
779
|
+
* PascalCase wrapper for hydrateRegisters (for C# compatibility)
|
|
780
|
+
*/
|
|
781
|
+
HydrateRegisters(reg: Registers): void;
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
/**
|
|
785
|
+
* Handles transform processing for assembly instructions
|
|
786
|
+
* Converted from GaiaLib/Rom/Extraction/TransformProcessor.cs
|
|
787
|
+
*/
|
|
788
|
+
declare class TransformProcessor {
|
|
789
|
+
private readonly _blockReader;
|
|
790
|
+
private readonly _romDataReader;
|
|
791
|
+
private readonly _referenceManager;
|
|
792
|
+
private readonly _labelLookup;
|
|
793
|
+
private static readonly LOCATION_REGEX;
|
|
794
|
+
constructor(romReader: BlockReader);
|
|
795
|
+
/**
|
|
796
|
+
* Retrieves transform information for the current ROM position
|
|
797
|
+
*/
|
|
798
|
+
getTransform(): string | null;
|
|
799
|
+
/**
|
|
800
|
+
* Applies transforms to operands
|
|
801
|
+
*/
|
|
802
|
+
applyTransforms(op1Label: string | null, op2Label: string | null, operands: unknown[]): void;
|
|
803
|
+
private applyTransform;
|
|
804
|
+
private applyDefaultTransform;
|
|
805
|
+
private cleanTransformName;
|
|
806
|
+
private resolveTransformReference;
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
/**
|
|
810
|
+
* Context information for an operation being processed
|
|
811
|
+
* Converted from GaiaLib/Rom/Extraction/AsmReader.cs OperationContext
|
|
812
|
+
*/
|
|
813
|
+
declare class OperationContext {
|
|
814
|
+
size: number;
|
|
815
|
+
nextAddress: number;
|
|
816
|
+
xForm1: string | null;
|
|
817
|
+
xForm2: string | null;
|
|
818
|
+
copDef: any;
|
|
819
|
+
}
|
|
820
|
+
/**
|
|
821
|
+
* Handles different addressing modes for assembly instructions
|
|
822
|
+
* Converted from GaiaLib/Rom/Extraction/AddressingModeHandler.cs
|
|
823
|
+
*/
|
|
824
|
+
declare class AddressingModeHandler {
|
|
825
|
+
private readonly _blockReader;
|
|
826
|
+
private readonly _transformProcessor;
|
|
827
|
+
private readonly _copProcessor;
|
|
828
|
+
private readonly _dataReader;
|
|
829
|
+
constructor(blockReader: BlockReader, transformProcessor: TransformProcessor);
|
|
830
|
+
processAddressingMode(code: OpCode, context: OperationContext, reg: Registers): unknown[];
|
|
831
|
+
private handleImmediateMode;
|
|
832
|
+
private readImmediateOperand;
|
|
833
|
+
private updateRegisterForImmediateInstruction;
|
|
834
|
+
private calculateRegisterValue;
|
|
835
|
+
private updateStatusFlags;
|
|
836
|
+
private handleAbsoluteLongMode;
|
|
837
|
+
private handleBlockMoveMode;
|
|
838
|
+
private handleDirectPageMode;
|
|
839
|
+
private handlePCRelativeMode;
|
|
840
|
+
private handleStackRelativeMode;
|
|
841
|
+
private handleStackInterruptMode;
|
|
842
|
+
private handleStackOrImpliedMode;
|
|
843
|
+
private handleAbsoluteMode;
|
|
844
|
+
private isJumpInstruction;
|
|
845
|
+
private isPushInstruction;
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
/**
|
|
849
|
+
* Handles stack operations for various stack-related instructions
|
|
850
|
+
* Converted from GaiaLib/Rom/Extraction/StackOperations.cs
|
|
851
|
+
*/
|
|
852
|
+
declare class StackOperations {
|
|
853
|
+
private readonly _registers;
|
|
854
|
+
private readonly _blockReader;
|
|
855
|
+
constructor(registers: Registers, blockReader: BlockReader);
|
|
856
|
+
handleStackOperation(mnemonic: string): void;
|
|
857
|
+
private handleAccumulatorPush;
|
|
858
|
+
private handleAccumulatorPull;
|
|
859
|
+
private handleXIndexPush;
|
|
860
|
+
private handleXIndexPull;
|
|
861
|
+
private handleYIndexPush;
|
|
862
|
+
private handleYIndexPull;
|
|
863
|
+
private handleExchangeBytes;
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
/**
|
|
867
|
+
* Reads and extracts SFX data from ROM
|
|
868
|
+
* Converted from GaiaLib/Rom/Extraction/SfxReader.cs
|
|
869
|
+
*/
|
|
870
|
+
declare class SfxReader {
|
|
871
|
+
private readonly _romData;
|
|
872
|
+
private readonly _dbRoot;
|
|
873
|
+
private _location;
|
|
874
|
+
private _count;
|
|
875
|
+
constructor(romData: Uint8Array, dbRoot: DbRoot);
|
|
876
|
+
/**
|
|
877
|
+
* Reads a byte from the rom data
|
|
878
|
+
*/
|
|
879
|
+
private readByte;
|
|
880
|
+
/**
|
|
881
|
+
* Reads a short from the rom data
|
|
882
|
+
*/
|
|
883
|
+
private readShort;
|
|
884
|
+
/**
|
|
885
|
+
* Extracts the sfx from the rom data to the given output path
|
|
886
|
+
*/
|
|
887
|
+
extract(outPath: string): Promise<void>;
|
|
888
|
+
/**
|
|
889
|
+
* Gets the path information for a binary type
|
|
890
|
+
* TODO: This should be implemented in DbRoot
|
|
891
|
+
*/
|
|
892
|
+
private getPath;
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
/**
|
|
896
|
+
* Reads and extracts files from ROM
|
|
897
|
+
* Converted from GaiaLib/Rom/Extraction/FileReader.cs
|
|
898
|
+
*/
|
|
899
|
+
declare class FileReader {
|
|
900
|
+
static readonly PALETTE_MIN_SIZE = 512;
|
|
901
|
+
private readonly _romData;
|
|
902
|
+
private readonly _dbRoot;
|
|
903
|
+
private readonly _compression;
|
|
904
|
+
constructor(romData: Uint8Array, dbRoot: DbRoot, provider: ICompressionProvider);
|
|
905
|
+
/**
|
|
906
|
+
* Extracts all files from the ROM to the given output path
|
|
907
|
+
*/
|
|
908
|
+
extract(outPath: string): Promise<void>;
|
|
909
|
+
private processFileData;
|
|
910
|
+
/**
|
|
911
|
+
* Gets the path information for a binary type from DbRoot configuration
|
|
912
|
+
*/
|
|
913
|
+
private getPath;
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
/**
|
|
917
|
+
* Handles COP (Coprocessor) command processing
|
|
918
|
+
* Converted from GaiaLib/Rom/Extraction/CopCommandProcessor.cs
|
|
919
|
+
*/
|
|
920
|
+
declare class CopCommandProcessor {
|
|
921
|
+
private readonly _blockReader;
|
|
922
|
+
private readonly _romDataReader;
|
|
923
|
+
constructor(blockReader: BlockReader);
|
|
924
|
+
/**
|
|
925
|
+
* Parses a COP command based on its definition
|
|
926
|
+
*/
|
|
927
|
+
parseCopCommand(copDef: CopDef, operands: unknown[]): void;
|
|
928
|
+
private tryParseMemberType;
|
|
929
|
+
private getMemberTypeSize;
|
|
930
|
+
private readMemberTypeValue;
|
|
931
|
+
private createCopLocation;
|
|
932
|
+
private tryParseAddressType;
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
declare enum ObjectType {
|
|
936
|
+
TableEntryArray = "TableEntryArray",
|
|
937
|
+
StructDef = "StructDef",
|
|
938
|
+
OpArray = "OpArray",
|
|
939
|
+
LocationWrapper = "LocationWrapper",
|
|
940
|
+
Address = "Address",
|
|
941
|
+
StringWrapper = "StringWrapper",
|
|
942
|
+
ByteArray = "ByteArray",
|
|
943
|
+
Array = "Array",
|
|
944
|
+
String = "String",
|
|
945
|
+
Number = "Number",
|
|
946
|
+
TypedNumber = "TypedNumber"
|
|
947
|
+
}
|
|
948
|
+
declare class BlockWriter {
|
|
949
|
+
private _root;
|
|
950
|
+
private _blockReader;
|
|
951
|
+
private _referenceManager;
|
|
952
|
+
private _postProcessor;
|
|
953
|
+
private _isInline;
|
|
954
|
+
private _currentPart;
|
|
955
|
+
constructor(reader: BlockReader);
|
|
956
|
+
writeBlocks(outPath: string): Promise<void>;
|
|
957
|
+
generateAsm(block: DbBlock): string;
|
|
958
|
+
private getMnemonicsForBlock;
|
|
959
|
+
private resolveOperand;
|
|
960
|
+
private getObjectType;
|
|
961
|
+
private writeObject;
|
|
962
|
+
private writeTableEntryArray;
|
|
963
|
+
private writeStructDef;
|
|
964
|
+
private writeOpArray;
|
|
965
|
+
private formatDefaultOperand;
|
|
966
|
+
private writeStringWrapper;
|
|
967
|
+
private writeArray;
|
|
968
|
+
private writeNumber;
|
|
969
|
+
private formatTypedNumber;
|
|
970
|
+
private writeTypedNumber;
|
|
971
|
+
private formatOperand;
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
/**
|
|
975
|
+
* Handles post processing of extracted blocks.
|
|
976
|
+
* Mirrors functionality of GaiaLib.Rom.Extraction.PostProcessor.
|
|
977
|
+
*/
|
|
978
|
+
declare class PostProcessor {
|
|
979
|
+
private readonly _referenceManager;
|
|
980
|
+
constructor(reader: BlockReader);
|
|
981
|
+
/**
|
|
982
|
+
* Execute post process directive on a block if present.
|
|
983
|
+
*/
|
|
984
|
+
process(block: DbBlock): void;
|
|
985
|
+
/**
|
|
986
|
+
* Builds a lookup table from struct entries.
|
|
987
|
+
* Equivalent to PostProcessor.Lookup in C# implementation.
|
|
988
|
+
*/
|
|
989
|
+
Lookup(block: DbBlock, keyIx: string, valueIx: string): void;
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
declare const ROM_REBUILD_MODULE = "gaia-core/rom/rebuild";
|
|
993
|
+
|
|
994
|
+
/**
|
|
995
|
+
* GaiaCore - Universal ROM processing engine
|
|
996
|
+
*
|
|
997
|
+
* This package provides the core functionality for ROM processing
|
|
998
|
+
* that can run in both browser (Web Worker) and Node.js environments.
|
|
999
|
+
*
|
|
1000
|
+
* High-level APIs:
|
|
1001
|
+
* - RomProcessor: Unified ROM processing workflows
|
|
1002
|
+
* - ProjectManager: Complete project lifecycle management
|
|
1003
|
+
*
|
|
1004
|
+
* Low-level modules:
|
|
1005
|
+
* - ROM: ROM state management, project configuration
|
|
1006
|
+
* - Assembly: 65816 instruction set, stack operations
|
|
1007
|
+
* - Compression: QuintetLZ compression algorithm
|
|
1008
|
+
* - Sprites: Sprite animation system
|
|
1009
|
+
*/
|
|
1010
|
+
declare const GAIA_CORE_VERSION = "0.1.0";
|
|
1011
|
+
declare const isPlatformBrowser: boolean;
|
|
1012
|
+
declare const isPlatformNode: string | false;
|
|
1013
|
+
declare const isPlatformWebWorker: boolean;
|
|
1014
|
+
|
|
1015
|
+
export { ADDRESSING_REGEX, ALL_OPCODES, AddressingModeHandler, AsmReader, BlockReader, BlockWriter, type BuildResult, CopCommandProcessor, type ExtractionResult, FileReader, GAIA_CORE_VERSION, GROUPED_OPCODES, HEX_REGEX, type ICompressionProvider, ObjectType, Op, OpCode, OpCodeUtils, type OpcodeStats, OperationContext, PostProcessor, ProcessorStateManager, type ProjectConfig, type ProjectEvents, ProjectManager, ProjectRoot, type ProjectStatus, QuintetLZ, ROM_REBUILD_MODULE, ReferenceManager, Registers, type RomAnalysisResult, RomDataReader, type RomHeaderInfo, RomProcessor, RomState, RomStateUtils, SfxReader, SpriteFrame, SpriteGroup, SpriteMap, SpritePart, Stack, StackOperations, StringReader, TransformProcessor, TypeParser, isPlatformBrowser, isPlatformNode, isPlatformWebWorker };
|