@gaialabs/core 0.2.12 → 0.2.14
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 +346 -277
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +840 -823
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +840 -823
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +346 -276
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -255,6 +255,7 @@ declare class DbFile {
|
|
|
255
255
|
upper?: boolean;
|
|
256
256
|
group?: string;
|
|
257
257
|
scene?: string;
|
|
258
|
+
base?: number;
|
|
258
259
|
constructor(data: Partial<DbFile>);
|
|
259
260
|
}
|
|
260
261
|
declare class DbFileType {
|
|
@@ -265,6 +266,8 @@ declare class DbFileType {
|
|
|
265
266
|
isBlock: boolean;
|
|
266
267
|
header: number;
|
|
267
268
|
compressed?: boolean;
|
|
269
|
+
struct?: string;
|
|
270
|
+
base?: number;
|
|
268
271
|
constructor(data: Partial<DbFileType>);
|
|
269
272
|
}
|
|
270
273
|
//#endregion
|
|
@@ -328,70 +331,116 @@ interface ICompressionProvider {
|
|
|
328
331
|
compact(srcData: Uint8Array, srcPosition?: number, srcLen?: number): Uint8Array;
|
|
329
332
|
}
|
|
330
333
|
//#endregion
|
|
331
|
-
//#region src/
|
|
334
|
+
//#region src/database/entrypoints.d.ts
|
|
332
335
|
/**
|
|
333
|
-
*
|
|
334
|
-
* Converted from GaiaLib/
|
|
336
|
+
* Database entry point definition
|
|
337
|
+
* Converted from GaiaLib/Database/DbEntryPoint.cs
|
|
335
338
|
*/
|
|
336
|
-
|
|
339
|
+
interface DbEntryPoint {
|
|
340
|
+
location: number;
|
|
341
|
+
name: string;
|
|
342
|
+
}
|
|
343
|
+
//#endregion
|
|
344
|
+
//#region src/database/config.d.ts
|
|
345
|
+
/**
|
|
346
|
+
* Database configuration
|
|
347
|
+
* Converted from GaiaLib/Database/DbConfig.cs
|
|
348
|
+
*/
|
|
349
|
+
interface DbConfig {
|
|
350
|
+
sfxLocation: number;
|
|
351
|
+
sfxCount: number;
|
|
352
|
+
sfxType: string;
|
|
353
|
+
sfxPack: string;
|
|
354
|
+
compression: string;
|
|
355
|
+
uncompress: boolean;
|
|
356
|
+
entryPoints: DbEntryPoint[];
|
|
357
|
+
memoryMode: MemoryMapMode;
|
|
358
|
+
cpuMode: CpuMode;
|
|
359
|
+
chipset: number;
|
|
360
|
+
ramSize: number;
|
|
361
|
+
defaultBank?: number;
|
|
362
|
+
}
|
|
363
|
+
//#endregion
|
|
364
|
+
//#region src/database/structs.d.ts
|
|
365
|
+
/**
|
|
366
|
+
* Database structure definition
|
|
367
|
+
* Converted from GaiaLib/Database/DbStruct.cs
|
|
368
|
+
*/
|
|
369
|
+
declare class DbStruct {
|
|
370
|
+
name: string;
|
|
371
|
+
types?: string[];
|
|
372
|
+
parent?: string;
|
|
373
|
+
delimiter?: number;
|
|
374
|
+
discriminator?: number;
|
|
375
|
+
discriminatorLogic?: string;
|
|
376
|
+
null?: number;
|
|
377
|
+
constructor(data: Partial<DbStruct>);
|
|
378
|
+
}
|
|
379
|
+
//#endregion
|
|
380
|
+
//#region src/database/addressingMode.d.ts
|
|
381
|
+
declare class DbAddressingMode {
|
|
337
382
|
name: string;
|
|
383
|
+
shorthand: string;
|
|
384
|
+
operands: string[];
|
|
338
385
|
size: number;
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
includeLookup?: Map<string, AsmBlock>;
|
|
344
|
-
bank?: number;
|
|
345
|
-
compressed?: boolean;
|
|
346
|
-
upper?: boolean;
|
|
347
|
-
rawData?: Uint8Array | null;
|
|
348
|
-
textData?: string;
|
|
349
|
-
transforms?: {
|
|
350
|
-
key: string;
|
|
351
|
-
value: string;
|
|
352
|
-
}[];
|
|
353
|
-
postProcess?: string;
|
|
354
|
-
mnemonics: Record<number, string>;
|
|
355
|
-
group?: string;
|
|
356
|
-
scene?: string;
|
|
357
|
-
constructor(name: string, size: number, location: number, type: DbFileType);
|
|
386
|
+
formatString?: string;
|
|
387
|
+
parseRegex?: string;
|
|
388
|
+
instructions: Record<string, number>;
|
|
389
|
+
constructor(data: Partial<DbAddressingMode>);
|
|
358
390
|
}
|
|
359
|
-
|
|
360
|
-
|
|
391
|
+
//#endregion
|
|
392
|
+
//#region src/database/strings.d.ts
|
|
361
393
|
/**
|
|
362
|
-
*
|
|
394
|
+
* Database string command definition
|
|
395
|
+
* Converted from GaiaLib/Database/DbStringCommand.cs
|
|
363
396
|
*/
|
|
364
|
-
declare class
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
397
|
+
declare class DbStringCommand {
|
|
398
|
+
id: number;
|
|
399
|
+
name: string;
|
|
400
|
+
types: string[];
|
|
401
|
+
delimiter?: number;
|
|
402
|
+
halt: boolean;
|
|
403
|
+
dictionary?: DbStringDictionary;
|
|
404
|
+
constructor(data: Partial<DbStringCommand>);
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Database string layer definition
|
|
408
|
+
* Converted from GaiaLib/Database/DbStringLayer.cs
|
|
409
|
+
*/
|
|
410
|
+
interface DbStringLayer {
|
|
411
|
+
base?: number;
|
|
412
|
+
range?: number;
|
|
413
|
+
on?: number;
|
|
414
|
+
shiftBit?: number;
|
|
415
|
+
map: string[];
|
|
416
|
+
}
|
|
417
|
+
declare class DbStringDictionary {
|
|
418
|
+
base?: number;
|
|
419
|
+
command?: number;
|
|
420
|
+
commandName?: string;
|
|
421
|
+
name: string;
|
|
422
|
+
entries: string[];
|
|
423
|
+
constructor(data: Partial<DbStringDictionary>);
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Database string type definition
|
|
427
|
+
* Converted from GaiaLib/Database/DbStringType.cs
|
|
428
|
+
*/
|
|
429
|
+
declare class DbStringType {
|
|
430
|
+
name: string;
|
|
431
|
+
delimiter: string;
|
|
432
|
+
terminator: number;
|
|
433
|
+
commands: Record<string, DbStringCommand>;
|
|
434
|
+
commandLookup: Record<number, DbStringCommand>;
|
|
435
|
+
layers: DbStringLayer[];
|
|
436
|
+
greedyTerminator: boolean;
|
|
437
|
+
dictionaries: Record<string, DbStringDictionary>;
|
|
438
|
+
dictionaryLookup: {
|
|
439
|
+
text: string;
|
|
440
|
+
id: number;
|
|
441
|
+
}[];
|
|
442
|
+
modifiers?: Record<number, Record<string, string>>;
|
|
443
|
+
constructor(data: Partial<DbStringType>);
|
|
395
444
|
}
|
|
396
445
|
//#endregion
|
|
397
446
|
//#region src/database/cop.d.ts
|
|
@@ -405,8 +454,15 @@ declare class CopDef {
|
|
|
405
454
|
size: number;
|
|
406
455
|
parts: string[];
|
|
407
456
|
halt: boolean;
|
|
457
|
+
conditions?: CopCondition[];
|
|
408
458
|
constructor(data: Partial<CopDef>);
|
|
409
459
|
}
|
|
460
|
+
interface CopCondition {
|
|
461
|
+
offset: number;
|
|
462
|
+
value: number;
|
|
463
|
+
size: number;
|
|
464
|
+
parts: string[];
|
|
465
|
+
}
|
|
410
466
|
//#endregion
|
|
411
467
|
//#region src/database/opcode.d.ts
|
|
412
468
|
declare class OpCode {
|
|
@@ -416,537 +472,83 @@ declare class OpCode {
|
|
|
416
472
|
constructor(code: number, mnem: string, mode: string);
|
|
417
473
|
}
|
|
418
474
|
//#endregion
|
|
419
|
-
//#region src/
|
|
475
|
+
//#region src/database/assets.d.ts
|
|
476
|
+
interface DbAsset {
|
|
477
|
+
index: number;
|
|
478
|
+
type: string;
|
|
479
|
+
file: string;
|
|
480
|
+
scene: string;
|
|
481
|
+
meta: any;
|
|
482
|
+
}
|
|
483
|
+
//#endregion
|
|
484
|
+
//#region src/database/scenes.d.ts
|
|
485
|
+
declare class DbScene {
|
|
486
|
+
name: string;
|
|
487
|
+
id: number;
|
|
488
|
+
description?: string;
|
|
489
|
+
assets: DbAsset[];
|
|
490
|
+
constructor(data: Partial<DbScene>);
|
|
491
|
+
}
|
|
492
|
+
//#endregion
|
|
493
|
+
//#region src/database/groups.d.ts
|
|
494
|
+
declare class DbGroup {
|
|
495
|
+
name: string;
|
|
496
|
+
prefix: string;
|
|
497
|
+
description?: string;
|
|
498
|
+
scenes: Record<string, DbScene>;
|
|
499
|
+
constructor(data: Partial<DbGroup>);
|
|
500
|
+
}
|
|
501
|
+
//#endregion
|
|
502
|
+
//#region src/supabase/types.d.ts
|
|
420
503
|
/**
|
|
421
|
-
*
|
|
504
|
+
* TypeScript interfaces for Supabase API responses
|
|
505
|
+
* These types represent the structured data returned from ROM database queries
|
|
422
506
|
*/
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
507
|
+
interface PlatformData {
|
|
508
|
+
id: string;
|
|
509
|
+
name: string;
|
|
510
|
+
meta: any | null;
|
|
511
|
+
createdAt: string;
|
|
512
|
+
updatedAt: string;
|
|
513
|
+
}
|
|
514
|
+
interface BranchBaseData {
|
|
515
|
+
id: string;
|
|
516
|
+
name: string | null;
|
|
517
|
+
version: number | null;
|
|
518
|
+
isActive?: boolean | null;
|
|
519
|
+
notes?: string[] | null;
|
|
520
|
+
createdAt: string;
|
|
521
|
+
updatedAt: string;
|
|
522
|
+
}
|
|
523
|
+
interface FileBaseData {
|
|
524
|
+
id: string;
|
|
525
|
+
name: string;
|
|
526
|
+
type: string;
|
|
527
|
+
version: number | null;
|
|
528
|
+
crc: number | null;
|
|
529
|
+
meta: any | null;
|
|
530
|
+
isText: boolean;
|
|
531
|
+
text: string | null;
|
|
532
|
+
data: Uint8Array | null;
|
|
533
|
+
createdAt: string;
|
|
534
|
+
updatedAt: string;
|
|
535
|
+
}
|
|
536
|
+
interface FileBaseRaw extends Omit<FileBaseData, 'data'> {
|
|
537
|
+
data: string | null;
|
|
429
538
|
}
|
|
430
539
|
/**
|
|
431
|
-
*
|
|
540
|
+
* Platform branch information containing instruction set and addressing modes
|
|
432
541
|
*/
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
bank?: number;
|
|
441
|
-
includes?: Set<{
|
|
442
|
-
block: ChunkFile;
|
|
443
|
-
part: AsmBlock;
|
|
444
|
-
}>;
|
|
445
|
-
constructor(location?: number, size?: number, isString?: boolean, label?: string, structName?: string, bank?: number);
|
|
542
|
+
interface PlatformBranchData extends BranchBaseData {
|
|
543
|
+
platformId: string;
|
|
544
|
+
addressingModes: any | null;
|
|
545
|
+
headers: any | null;
|
|
546
|
+
vectors: any | null;
|
|
547
|
+
types: any | null;
|
|
548
|
+
platform: PlatformData;
|
|
446
549
|
}
|
|
447
550
|
/**
|
|
448
|
-
*
|
|
449
|
-
*/
|
|
450
|
-
declare class AsmBlockUtils {
|
|
451
|
-
/**
|
|
452
|
-
* Check if a location is inside this part
|
|
453
|
-
*/
|
|
454
|
-
static isInside(part: AsmBlock, location: number): boolean;
|
|
455
|
-
/**
|
|
456
|
-
* Check if a location is outside this part
|
|
457
|
-
*/
|
|
458
|
-
static isOutside(part: AsmBlock, location: number): boolean;
|
|
459
|
-
}
|
|
460
|
-
//#endregion
|
|
461
|
-
//#region src/types/bitstream.d.ts
|
|
462
|
-
/**
|
|
463
|
-
* Bit stream for reading/writing binary data at bit level
|
|
464
|
-
* Converted from GaiaLib/Types/BitStream.cs
|
|
465
|
-
*/
|
|
466
|
-
declare class BitStream {
|
|
467
|
-
private static readonly NIBBLE_MASK;
|
|
468
|
-
private static readonly NIBBLE_PERFECT_POSITION;
|
|
469
|
-
private data;
|
|
470
|
-
private position;
|
|
471
|
-
private bitFlag;
|
|
472
|
-
private writeSample;
|
|
473
|
-
constructor(data: Uint8Array, position?: number);
|
|
474
|
-
get dataArray(): Uint8Array;
|
|
475
|
-
get currentPosition(): number;
|
|
476
|
-
set currentPosition(value: number);
|
|
477
|
-
/**
|
|
478
|
-
* Read a byte from the stream
|
|
479
|
-
* @returns The byte read, or -1 if the end of the data has been reached
|
|
480
|
-
*/
|
|
481
|
-
readByte(): number;
|
|
482
|
-
/**
|
|
483
|
-
* Read a ushort from the stream (ignores the current bit flag)
|
|
484
|
-
* @returns The short read, or -1 if the end of the data has been reached
|
|
485
|
-
*/
|
|
486
|
-
readShort(): number;
|
|
487
|
-
/**
|
|
488
|
-
* Read a bit from the stream
|
|
489
|
-
* @returns True if the current bit at bitFlag is set, false otherwise
|
|
490
|
-
*/
|
|
491
|
-
readBit(): boolean;
|
|
492
|
-
/**
|
|
493
|
-
* Read a nibble from the stream
|
|
494
|
-
* @returns The nibble read, or -1 if the end of the data has been reached
|
|
495
|
-
*/
|
|
496
|
-
readNibble(): number;
|
|
497
|
-
/**
|
|
498
|
-
* Write a bit to the stream
|
|
499
|
-
* @param set True if the current bit should be set, false otherwise
|
|
500
|
-
*/
|
|
501
|
-
writeBit(set: boolean): void;
|
|
502
|
-
/**
|
|
503
|
-
* Write a byte to the stream
|
|
504
|
-
* @param value The byte to write
|
|
505
|
-
*/
|
|
506
|
-
writeByte(value: number): void;
|
|
507
|
-
/**
|
|
508
|
-
* Write a nibble to the stream
|
|
509
|
-
* @param value The nibble to write
|
|
510
|
-
*/
|
|
511
|
-
writeNibble(value: number): void;
|
|
512
|
-
flush(): void;
|
|
513
|
-
}
|
|
514
|
-
//#endregion
|
|
515
|
-
//#region src/types/compression-registry.d.ts
|
|
516
|
-
/**
|
|
517
|
-
* Registry for compression providers
|
|
518
|
-
* Allows registration of compression implementations by string ID
|
|
519
|
-
*/
|
|
520
|
-
declare class CompressionRegistry {
|
|
521
|
-
private static providers;
|
|
522
|
-
/**
|
|
523
|
-
* Register a compression provider
|
|
524
|
-
* @param id String identifier for the compression type
|
|
525
|
-
* @param factory Factory function that creates the compression provider
|
|
526
|
-
*/
|
|
527
|
-
static register(id: string, factory: () => ICompressionProvider): void;
|
|
528
|
-
/**
|
|
529
|
-
* Get a compression provider by ID
|
|
530
|
-
* @param id String identifier for the compression type
|
|
531
|
-
* @returns Compression provider instance
|
|
532
|
-
*/
|
|
533
|
-
static get(id: string): ICompressionProvider;
|
|
534
|
-
/**
|
|
535
|
-
* Check if a compression provider is registered
|
|
536
|
-
* @param id String identifier for the compression type
|
|
537
|
-
* @returns True if provider is registered
|
|
538
|
-
*/
|
|
539
|
-
static has(id: string): boolean;
|
|
540
|
-
/**
|
|
541
|
-
* Get list of registered provider IDs
|
|
542
|
-
* @returns Array of registered provider IDs
|
|
543
|
-
*/
|
|
544
|
-
static getRegisteredIds(): string[];
|
|
545
|
-
/**
|
|
546
|
-
* Clear all registered providers (mainly for testing)
|
|
547
|
-
*/
|
|
548
|
-
static clear(): void;
|
|
549
|
-
}
|
|
550
|
-
//#endregion
|
|
551
|
-
//#region src/types/constants.d.ts
|
|
552
|
-
/**
|
|
553
|
-
* ROM processing constants
|
|
554
|
-
* Converted from GaiaLib/Types/RomProcessingConstants.cs
|
|
555
|
-
*/
|
|
556
|
-
declare class RomProcessingConstants {
|
|
557
|
-
static readonly PAGE_SIZE = 32768;
|
|
558
|
-
static readonly SNES_HEADER_SIZE = 80;
|
|
559
|
-
static readonly DICTIONARIES: string[];
|
|
560
|
-
static readonly DICT_COMMANDS: number[];
|
|
561
|
-
static readonly END_CHARS: number[];
|
|
562
|
-
static readonly WHITESPACE: string[];
|
|
563
|
-
static readonly OPERATORS: string[];
|
|
564
|
-
static readonly COMMA_SPACE: string[];
|
|
565
|
-
static readonly ADDRESS_SPACE: string[];
|
|
566
|
-
static readonly SYMBOL_SPACE: string[];
|
|
567
|
-
static readonly LABEL_SPACE: string[];
|
|
568
|
-
static readonly OBJECT_SPACE: string[];
|
|
569
|
-
static readonly COP_SPLIT_CHARS: string[];
|
|
570
|
-
static readonly WHITESPACE_REGEX: RegExp;
|
|
571
|
-
static readonly COMMA_SPACE_REGEX: RegExp;
|
|
572
|
-
static readonly SYMBOL_SPACE_REGEX: RegExp;
|
|
573
|
-
static readonly LABEL_SPACE_REGEX: RegExp;
|
|
574
|
-
static readonly OBJECT_SPACE_REGEX: RegExp;
|
|
575
|
-
static readonly ADDRESS_SPACE_REGEX: RegExp;
|
|
576
|
-
static readonly COP_SPLIT_REGEX: RegExp;
|
|
577
|
-
static readonly COMMA_SPACE_TRIM_REGEX: RegExp;
|
|
578
|
-
/**
|
|
579
|
-
* Gets the size of an object for processing purposes
|
|
580
|
-
* @param obj The object to get the size for
|
|
581
|
-
* @returns Size in bytes
|
|
582
|
-
* @throws Error when unable to determine size
|
|
583
|
-
*/
|
|
584
|
-
static getSize(obj: unknown): number;
|
|
585
|
-
}
|
|
586
|
-
/**
|
|
587
|
-
* BlockReader specific constants
|
|
588
|
-
*/
|
|
589
|
-
declare class BlockReaderConstants {
|
|
590
|
-
static readonly REF_SEARCH_MAX_RANGE = 416;
|
|
591
|
-
static readonly BANK_MASK_CHECK = 64;
|
|
592
|
-
static readonly BYTE_DELIMITER_THRESHOLD = 256;
|
|
593
|
-
static readonly BANK_HIGH_MEMORY_1 = 126;
|
|
594
|
-
static readonly BANK_HIGH_MEMORY_2 = 127;
|
|
595
|
-
static readonly POINTER_CHARACTERS: string[];
|
|
596
|
-
static readonly WIDE_STRING_TYPE = "WideString";
|
|
597
|
-
static readonly BINARY_TYPE = "Binary";
|
|
598
|
-
static readonly CODE_TYPE = "Code";
|
|
599
|
-
static readonly LOCATION_FORMAT = "loc_{0:X6}";
|
|
600
|
-
static readonly TYPE_NAME_FORMAT = "{0}_{1:X6}";
|
|
601
|
-
static readonly OFFSET_FORMAT = "+{0:X}";
|
|
602
|
-
static readonly MARKER_FORMAT = "+M";
|
|
603
|
-
static readonly NEGATIVE_OFFSET_FORMAT = "-{0:X}";
|
|
604
|
-
static readonly NEGATIVE_MARKER_FORMAT = "-M";
|
|
605
|
-
}
|
|
606
|
-
//#endregion
|
|
607
|
-
//#region src/types/location.d.ts
|
|
608
|
-
/**
|
|
609
|
-
* Location wrapper for additional metadata
|
|
610
|
-
* Converted from GaiaLib/Types/LocationWrapper.cs
|
|
611
|
-
*/
|
|
612
|
-
declare class LocationWrapper {
|
|
613
|
-
location: number;
|
|
614
|
-
type: AddressType;
|
|
615
|
-
constructor(location: number, type: AddressType);
|
|
616
|
-
}
|
|
617
|
-
//#endregion
|
|
618
|
-
//#region src/database/strings.d.ts
|
|
619
|
-
/**
|
|
620
|
-
* Database string command definition
|
|
621
|
-
* Converted from GaiaLib/Database/DbStringCommand.cs
|
|
622
|
-
*/
|
|
623
|
-
declare class DbStringCommand {
|
|
624
|
-
id: number;
|
|
625
|
-
name: string;
|
|
626
|
-
types: string[];
|
|
627
|
-
delimiter?: number;
|
|
628
|
-
halt: boolean;
|
|
629
|
-
dictionary?: DbStringDictionary;
|
|
630
|
-
constructor(data: Partial<DbStringCommand>);
|
|
631
|
-
}
|
|
632
|
-
/**
|
|
633
|
-
* Database string layer definition
|
|
634
|
-
* Converted from GaiaLib/Database/DbStringLayer.cs
|
|
635
|
-
*/
|
|
636
|
-
interface DbStringLayer {
|
|
637
|
-
base?: number;
|
|
638
|
-
range?: number;
|
|
639
|
-
on?: number;
|
|
640
|
-
shiftBit?: number;
|
|
641
|
-
map: string[];
|
|
642
|
-
}
|
|
643
|
-
declare class DbStringDictionary {
|
|
644
|
-
command?: number;
|
|
645
|
-
commandName?: string;
|
|
646
|
-
name: string;
|
|
647
|
-
entries: string[];
|
|
648
|
-
constructor(data: Partial<DbStringDictionary>);
|
|
649
|
-
}
|
|
650
|
-
/**
|
|
651
|
-
* Database string type definition
|
|
652
|
-
* Converted from GaiaLib/Database/DbStringType.cs
|
|
653
|
-
*/
|
|
654
|
-
declare class DbStringType {
|
|
655
|
-
name: string;
|
|
656
|
-
delimiter: string;
|
|
657
|
-
terminator: number;
|
|
658
|
-
commands: Record<string, DbStringCommand>;
|
|
659
|
-
commandLookup: Record<number, DbStringCommand>;
|
|
660
|
-
layers: DbStringLayer[];
|
|
661
|
-
greedyTerminator: boolean;
|
|
662
|
-
dictionaries: Record<string, DbStringDictionary>;
|
|
663
|
-
dictionaryLookup: {
|
|
664
|
-
text: string;
|
|
665
|
-
id: number;
|
|
666
|
-
}[];
|
|
667
|
-
constructor(data: Partial<DbStringType>);
|
|
668
|
-
}
|
|
669
|
-
//#endregion
|
|
670
|
-
//#region src/types/strings.d.ts
|
|
671
|
-
/**
|
|
672
|
-
* String marker for positioning
|
|
673
|
-
* Converted from GaiaLib/Types/StringMarker.cs
|
|
674
|
-
*/
|
|
675
|
-
interface StringMarker {
|
|
676
|
-
offset: number;
|
|
677
|
-
}
|
|
678
|
-
/**
|
|
679
|
-
* String wrapper with type and location information
|
|
680
|
-
* Converted from GaiaLib/Types/StringWrapper.cs
|
|
681
|
-
*/
|
|
682
|
-
interface StringWrapper {
|
|
683
|
-
string: string;
|
|
684
|
-
type: DbStringType;
|
|
685
|
-
marker: number;
|
|
686
|
-
location: number;
|
|
687
|
-
fixedSize: number;
|
|
688
|
-
}
|
|
689
|
-
/**
|
|
690
|
-
* String entry (commented out in original C# code)
|
|
691
|
-
* Converted from GaiaLib/Types/StringEntry.cs
|
|
692
|
-
*/
|
|
693
|
-
interface StringEntry {
|
|
694
|
-
block: AsmBlock;
|
|
695
|
-
index: number;
|
|
696
|
-
size: number;
|
|
697
|
-
data: Uint8Array;
|
|
698
|
-
}
|
|
699
|
-
/**
|
|
700
|
-
* String size comparer utility
|
|
701
|
-
* Converted from GaiaLib/Types/StringSizeComparer.cs
|
|
702
|
-
*/
|
|
703
|
-
declare class StringSizeComparer {
|
|
704
|
-
/**
|
|
705
|
-
* Compare two strings by length
|
|
706
|
-
*/
|
|
707
|
-
static compare(a: string, b: string): number;
|
|
708
|
-
/**
|
|
709
|
-
* Compare two StringWrapper objects by string length
|
|
710
|
-
*/
|
|
711
|
-
static compareWrappers(a: StringWrapper, b: StringWrapper): number;
|
|
712
|
-
}
|
|
713
|
-
//#endregion
|
|
714
|
-
//#region src/types/structs.d.ts
|
|
715
|
-
/**
|
|
716
|
-
* Structure definition
|
|
717
|
-
* Converted from GaiaLib/Types/StructDef.cs
|
|
718
|
-
*/
|
|
719
|
-
interface StructDef {
|
|
720
|
-
name: string;
|
|
721
|
-
parts: unknown[];
|
|
722
|
-
}
|
|
723
|
-
//#endregion
|
|
724
|
-
//#region src/types/tables.d.ts
|
|
725
|
-
declare class TableEntry {
|
|
726
|
-
location: number;
|
|
727
|
-
object: unknown;
|
|
728
|
-
constructor(location: number);
|
|
729
|
-
}
|
|
730
|
-
//#endregion
|
|
731
|
-
//#region src/types/operands.d.ts
|
|
732
|
-
declare class TypedNumber {
|
|
733
|
-
value: number;
|
|
734
|
-
size: number;
|
|
735
|
-
constructor(value: number, size: number);
|
|
736
|
-
}
|
|
737
|
-
declare class Byte extends TypedNumber {
|
|
738
|
-
constructor(value: number);
|
|
739
|
-
}
|
|
740
|
-
declare class Word extends TypedNumber {
|
|
741
|
-
constructor(value: number);
|
|
742
|
-
}
|
|
743
|
-
declare class Long extends TypedNumber {
|
|
744
|
-
constructor(value: number);
|
|
745
|
-
}
|
|
746
|
-
//#endregion
|
|
747
|
-
//#region src/assembly/Registers.d.ts
|
|
748
|
-
/**
|
|
749
|
-
* Manages the 65816 processor registers and status flags
|
|
750
|
-
*/
|
|
751
|
-
declare class Registers {
|
|
752
|
-
value: Record<string, number>;
|
|
753
|
-
stack: Stack;
|
|
754
|
-
mode: MemoryMapMode;
|
|
755
|
-
constructor(mode: MemoryMapMode);
|
|
756
|
-
}
|
|
757
|
-
//#endregion
|
|
758
|
-
//#region src/rom/extraction/processor.d.ts
|
|
759
|
-
declare class MapExt<K, V> extends Map<K, V> {
|
|
760
|
-
constructor();
|
|
761
|
-
tryAdd(key: K, value: V): boolean;
|
|
762
|
-
setFlag(key: K, flag: number, value?: boolean): void;
|
|
763
|
-
clearFlag(key: K, flag: number): void;
|
|
764
|
-
}
|
|
765
|
-
/**
|
|
766
|
-
* Manages CPU processor state during ROM analysis
|
|
767
|
-
* Converted from GaiaLib/Rom/Extraction/ProcessorStateManager.cs
|
|
768
|
-
*/
|
|
769
|
-
declare class ProcessorStateManager {
|
|
770
|
-
readonly stackPositions: MapExt<number, number>;
|
|
771
|
-
private readonly _buckets;
|
|
772
|
-
get(key: string): MapExt<number, number>;
|
|
773
|
-
/**
|
|
774
|
-
* Hydrate processor registers with stored state
|
|
775
|
-
* Uses Registers from gaia-core/assembly for processor state management
|
|
776
|
-
*/
|
|
777
|
-
hydrateRegisters(position: number, reg: Registers): void;
|
|
778
|
-
getStackPosition(location: number): number | undefined;
|
|
779
|
-
setStackPosition(location: number, value: number): void;
|
|
780
|
-
tryAddStackPosition(location: number, value: number): boolean;
|
|
781
|
-
}
|
|
782
|
-
//#endregion
|
|
783
|
-
//#region src/rom/extraction/reader.d.ts
|
|
784
|
-
/**
|
|
785
|
-
* Provides low-level ROM data reading functionality
|
|
786
|
-
* Converted from GaiaLib/Rom/Extraction/RomDataReader.cs
|
|
787
|
-
*/
|
|
788
|
-
declare class RomDataReader {
|
|
789
|
-
readonly romData: Uint8Array;
|
|
790
|
-
position: number;
|
|
791
|
-
constructor(romData: Uint8Array);
|
|
792
|
-
readByte(): number;
|
|
793
|
-
readSByte(): number;
|
|
794
|
-
readUShort(): number;
|
|
795
|
-
readShort(): number;
|
|
796
|
-
readAddress(): number;
|
|
797
|
-
readInt(): number;
|
|
798
|
-
peekByte(): number;
|
|
799
|
-
peekShort(): number;
|
|
800
|
-
peekAddress(): number;
|
|
801
|
-
}
|
|
802
|
-
//#endregion
|
|
803
|
-
//#region src/database/entrypoints.d.ts
|
|
804
|
-
/**
|
|
805
|
-
* Database entry point definition
|
|
806
|
-
* Converted from GaiaLib/Database/DbEntryPoint.cs
|
|
807
|
-
*/
|
|
808
|
-
interface DbEntryPoint {
|
|
809
|
-
location: number;
|
|
810
|
-
name: string;
|
|
811
|
-
}
|
|
812
|
-
//#endregion
|
|
813
|
-
//#region src/database/paths.d.ts
|
|
814
|
-
/**
|
|
815
|
-
* Database path configuration
|
|
816
|
-
* Converted from GaiaLib/Database/DbPath.cs
|
|
817
|
-
*/
|
|
818
|
-
interface DbPath {
|
|
819
|
-
folder: string;
|
|
820
|
-
extension: string;
|
|
821
|
-
}
|
|
822
|
-
/**
|
|
823
|
-
* Creates a default DbPath
|
|
824
|
-
*/
|
|
825
|
-
declare function createDbPath(folder?: string, extension?: string): DbPath;
|
|
826
|
-
//#endregion
|
|
827
|
-
//#region src/database/config.d.ts
|
|
828
|
-
/**
|
|
829
|
-
* Database configuration
|
|
830
|
-
* Converted from GaiaLib/Database/DbConfig.cs
|
|
831
|
-
*/
|
|
832
|
-
interface DbConfig {
|
|
833
|
-
sfxLocation: number;
|
|
834
|
-
sfxCount: number;
|
|
835
|
-
sfxType: string;
|
|
836
|
-
sfxPack: string;
|
|
837
|
-
compression: string;
|
|
838
|
-
uncompress: boolean;
|
|
839
|
-
entryPoints: DbEntryPoint[];
|
|
840
|
-
paths: Record<BinType, DbPath>;
|
|
841
|
-
memoryMode: MemoryMapMode;
|
|
842
|
-
cpuMode: CpuMode;
|
|
843
|
-
chipset: number;
|
|
844
|
-
ramSize: number;
|
|
845
|
-
}
|
|
846
|
-
//#endregion
|
|
847
|
-
//#region src/database/structs.d.ts
|
|
848
|
-
/**
|
|
849
|
-
* Database structure definition
|
|
850
|
-
* Converted from GaiaLib/Database/DbStruct.cs
|
|
851
|
-
*/
|
|
852
|
-
declare class DbStruct {
|
|
853
|
-
name: string;
|
|
854
|
-
types?: string[];
|
|
855
|
-
parent?: string;
|
|
856
|
-
delimiter?: number;
|
|
857
|
-
discriminator?: number;
|
|
858
|
-
constructor(data: Partial<DbStruct>);
|
|
859
|
-
}
|
|
860
|
-
//#endregion
|
|
861
|
-
//#region src/database/addressingMode.d.ts
|
|
862
|
-
declare class DbAddressingMode {
|
|
863
|
-
name: string;
|
|
864
|
-
shorthand: string;
|
|
865
|
-
operands: string[];
|
|
866
|
-
size: number;
|
|
867
|
-
formatString?: string;
|
|
868
|
-
parseRegex?: string;
|
|
869
|
-
instructions: Record<string, number>;
|
|
870
|
-
constructor(data: Partial<DbAddressingMode>);
|
|
871
|
-
}
|
|
872
|
-
//#endregion
|
|
873
|
-
//#region src/database/assets.d.ts
|
|
874
|
-
interface DbAsset {
|
|
875
|
-
index: number;
|
|
876
|
-
type: string;
|
|
877
|
-
file: string;
|
|
878
|
-
scene: string;
|
|
879
|
-
meta: any;
|
|
880
|
-
}
|
|
881
|
-
//#endregion
|
|
882
|
-
//#region src/database/scenes.d.ts
|
|
883
|
-
declare class DbScene {
|
|
884
|
-
name: string;
|
|
885
|
-
id: number;
|
|
886
|
-
description?: string;
|
|
887
|
-
assets: DbAsset[];
|
|
888
|
-
constructor(data: Partial<DbScene>);
|
|
889
|
-
}
|
|
890
|
-
//#endregion
|
|
891
|
-
//#region src/database/groups.d.ts
|
|
892
|
-
declare class DbGroup {
|
|
893
|
-
name: string;
|
|
894
|
-
prefix: string;
|
|
895
|
-
description?: string;
|
|
896
|
-
scenes: Record<string, DbScene>;
|
|
897
|
-
constructor(data: Partial<DbGroup>);
|
|
898
|
-
}
|
|
899
|
-
//#endregion
|
|
900
|
-
//#region src/supabase/types.d.ts
|
|
901
|
-
/**
|
|
902
|
-
* TypeScript interfaces for Supabase API responses
|
|
903
|
-
* These types represent the structured data returned from ROM database queries
|
|
904
|
-
*/
|
|
905
|
-
interface PlatformData {
|
|
906
|
-
id: string;
|
|
907
|
-
name: string;
|
|
908
|
-
meta: any | null;
|
|
909
|
-
createdAt: string;
|
|
910
|
-
updatedAt: string;
|
|
911
|
-
}
|
|
912
|
-
interface BranchBaseData {
|
|
913
|
-
id: string;
|
|
914
|
-
name: string | null;
|
|
915
|
-
version: number | null;
|
|
916
|
-
isActive?: boolean | null;
|
|
917
|
-
notes?: string[] | null;
|
|
918
|
-
createdAt: string;
|
|
919
|
-
updatedAt: string;
|
|
920
|
-
}
|
|
921
|
-
interface FileBaseData {
|
|
922
|
-
id: string;
|
|
923
|
-
name: string;
|
|
924
|
-
type: string;
|
|
925
|
-
version: number | null;
|
|
926
|
-
crc: number | null;
|
|
927
|
-
meta: any | null;
|
|
928
|
-
isText: boolean;
|
|
929
|
-
text: string | null;
|
|
930
|
-
data: Uint8Array | null;
|
|
931
|
-
createdAt: string;
|
|
932
|
-
updatedAt: string;
|
|
933
|
-
}
|
|
934
|
-
interface FileBaseRaw extends Omit<FileBaseData, 'data'> {
|
|
935
|
-
data: string | null;
|
|
936
|
-
}
|
|
937
|
-
/**
|
|
938
|
-
* Platform branch information containing instruction set and addressing modes
|
|
939
|
-
*/
|
|
940
|
-
interface PlatformBranchData extends BranchBaseData {
|
|
941
|
-
platformId: string;
|
|
942
|
-
addressingModes: any | null;
|
|
943
|
-
headers: any | null;
|
|
944
|
-
vectors: any | null;
|
|
945
|
-
types: any | null;
|
|
946
|
-
platform: PlatformData;
|
|
947
|
-
}
|
|
948
|
-
/**
|
|
949
|
-
* Game ROM branch information with platform reference
|
|
551
|
+
* Game ROM branch information with platform reference
|
|
950
552
|
*/
|
|
951
553
|
interface GameRomBranchData extends BranchBaseData {
|
|
952
554
|
gameRomId: string;
|
|
@@ -1058,26 +660,125 @@ interface BaseRomFileRaw extends FileBaseRaw {
|
|
|
1058
660
|
baseRomId: string;
|
|
1059
661
|
}
|
|
1060
662
|
/**
|
|
1061
|
-
* Complete ROM payload containing branch data and files
|
|
663
|
+
* Complete ROM payload containing branch data and files
|
|
664
|
+
*/
|
|
665
|
+
interface BaseRomPayload {
|
|
666
|
+
baseRomBranch: BaseRomBranchData;
|
|
667
|
+
files: BaseRomFileData[];
|
|
668
|
+
}
|
|
669
|
+
/**
|
|
670
|
+
* Options for loading ROM data by name
|
|
671
|
+
*/
|
|
672
|
+
interface FromSupabaseByNameOptions {
|
|
673
|
+
/**
|
|
674
|
+
* Name of the game to load
|
|
675
|
+
* @default 'Illusion of Gaia'
|
|
676
|
+
*/
|
|
677
|
+
gameName: string;
|
|
678
|
+
/**
|
|
679
|
+
* Name of the base ROM to load
|
|
680
|
+
* @default 'GaiaLabs BaseROM'
|
|
681
|
+
*/
|
|
682
|
+
baseRomName: string;
|
|
683
|
+
/**
|
|
684
|
+
* Name of the branch to load
|
|
685
|
+
* Set to null to load the main/develop branch
|
|
686
|
+
* Set to undefined to not filter by branch name
|
|
687
|
+
*/
|
|
688
|
+
branchName?: string | null;
|
|
689
|
+
/**
|
|
690
|
+
* Version of the branch to load
|
|
691
|
+
* Set to null to load the latest/main version
|
|
692
|
+
* Set to undefined to not filter by version
|
|
693
|
+
*/
|
|
694
|
+
branchVersion?: number | null;
|
|
695
|
+
}
|
|
696
|
+
/**
|
|
697
|
+
* Error codes for Supabase operations
|
|
698
|
+
*/
|
|
699
|
+
declare enum SupabaseErrorCode {
|
|
700
|
+
BRANCH_NOT_FOUND = "BRANCH_NOT_FOUND",
|
|
701
|
+
ROM_NOT_FOUND = "ROM_NOT_FOUND",
|
|
702
|
+
FILES_NOT_FOUND = "FILES_NOT_FOUND",
|
|
703
|
+
NETWORK_ERROR = "NETWORK_ERROR",
|
|
704
|
+
INVALID_DATA = "INVALID_DATA",
|
|
705
|
+
ENVIRONMENT_ERROR = "ENVIRONMENT_ERROR",
|
|
706
|
+
PERMISSION_ERROR = "PERMISSION_ERROR"
|
|
707
|
+
}
|
|
708
|
+
/**
|
|
709
|
+
* Custom error class for Supabase operations
|
|
710
|
+
*/
|
|
711
|
+
declare class SupabaseFromError extends Error {
|
|
712
|
+
readonly code: SupabaseErrorCode;
|
|
713
|
+
readonly details?: any | undefined;
|
|
714
|
+
constructor(message: string, code: SupabaseErrorCode, details?: any | undefined);
|
|
715
|
+
}
|
|
716
|
+
/**
|
|
717
|
+
* Result type for async operations that may fail
|
|
718
|
+
*/
|
|
719
|
+
type SupabaseResult<T> = {
|
|
720
|
+
data: T;
|
|
721
|
+
error: null;
|
|
722
|
+
} | {
|
|
723
|
+
data: null;
|
|
724
|
+
error: SupabaseFromError;
|
|
725
|
+
};
|
|
726
|
+
/**
|
|
727
|
+
* Project information
|
|
728
|
+
*/
|
|
729
|
+
interface ProjectData {
|
|
730
|
+
id: string;
|
|
731
|
+
name: string;
|
|
732
|
+
meta: any | null;
|
|
733
|
+
gameId: string;
|
|
734
|
+
baseRomId: string;
|
|
735
|
+
createdAt: string;
|
|
736
|
+
updatedAt: string;
|
|
737
|
+
}
|
|
738
|
+
/**
|
|
739
|
+
* Project branch with complete relationship chain
|
|
740
|
+
*/
|
|
741
|
+
interface ProjectBranchData extends BranchBaseData {
|
|
742
|
+
projectId: string;
|
|
743
|
+
baseRomBranchId: string;
|
|
744
|
+
modules: any[];
|
|
745
|
+
project: ProjectData;
|
|
746
|
+
baseRomBranch: BaseRomBranchData;
|
|
747
|
+
}
|
|
748
|
+
/**
|
|
749
|
+
* Project file containing binary data
|
|
750
|
+
*/
|
|
751
|
+
interface ProjectFileData extends FileBaseData {
|
|
752
|
+
module: string | null;
|
|
753
|
+
projectId: string;
|
|
754
|
+
}
|
|
755
|
+
interface ProjectBranchFileRaw {
|
|
756
|
+
id: string;
|
|
757
|
+
branchId: string;
|
|
758
|
+
fileId: string;
|
|
759
|
+
file: ProjectFileRaw;
|
|
760
|
+
}
|
|
761
|
+
/**
|
|
762
|
+
* Raw ProjectFile data as returned from Supabase (before conversion)
|
|
763
|
+
*/
|
|
764
|
+
interface ProjectFileRaw extends FileBaseRaw {
|
|
765
|
+
module: string | null;
|
|
766
|
+
projectId: string;
|
|
767
|
+
}
|
|
768
|
+
/**
|
|
769
|
+
* Complete Project payload containing branch data and files
|
|
1062
770
|
*/
|
|
1063
|
-
interface
|
|
771
|
+
interface ProjectPayload {
|
|
772
|
+
projectBranch: ProjectBranchData;
|
|
773
|
+
projectFiles: ProjectFileData[];
|
|
1064
774
|
baseRomBranch: BaseRomBranchData;
|
|
1065
|
-
|
|
775
|
+
baseRomFiles: BaseRomFileData[];
|
|
1066
776
|
}
|
|
1067
777
|
/**
|
|
1068
|
-
* Options for loading
|
|
778
|
+
* Options for loading Project data by name
|
|
1069
779
|
*/
|
|
1070
|
-
interface
|
|
1071
|
-
|
|
1072
|
-
* Name of the game to load
|
|
1073
|
-
* @default 'Illusion of Gaia'
|
|
1074
|
-
*/
|
|
1075
|
-
gameName: string;
|
|
1076
|
-
/**
|
|
1077
|
-
* Name of the base ROM to load
|
|
1078
|
-
* @default 'GaiaLabs BaseROM'
|
|
1079
|
-
*/
|
|
1080
|
-
baseRomName: string;
|
|
780
|
+
interface FromSupabaseByProjectOptions {
|
|
781
|
+
projectName: string;
|
|
1081
782
|
/**
|
|
1082
783
|
* Name of the branch to load
|
|
1083
784
|
* Set to null to load the main/develop branch
|
|
@@ -1092,290 +793,608 @@ interface FromSupabaseByNameOptions {
|
|
|
1092
793
|
branchVersion?: number | null;
|
|
1093
794
|
}
|
|
1094
795
|
/**
|
|
1095
|
-
*
|
|
796
|
+
* Query statistics for performance monitoring
|
|
1096
797
|
*/
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
798
|
+
interface QueryStats {
|
|
799
|
+
branchQueryTime: number;
|
|
800
|
+
fileQueryTime: number;
|
|
801
|
+
totalTime: number;
|
|
802
|
+
fileCount: number;
|
|
803
|
+
}
|
|
804
|
+
//#endregion
|
|
805
|
+
//#region src/database/modules.d.ts
|
|
806
|
+
interface DbGameRomModule {
|
|
807
|
+
supaProjectFiles?: ProjectFileData[];
|
|
808
|
+
supaBaseRomFiles?: BaseRomFileData[];
|
|
809
|
+
mnemonics: Record<number, string>;
|
|
810
|
+
overrides: Record<number, Record<string, number>>;
|
|
811
|
+
rewrites: Record<string, number>;
|
|
812
|
+
blocks: Record<string, Record<string, Partial<DbBlock>>>;
|
|
813
|
+
files: Record<string, Record<string, Record<string, Partial<DbFile>>>>;
|
|
814
|
+
config: DbConfig;
|
|
815
|
+
labels: Record<number, string>;
|
|
816
|
+
structs: Record<string, DbStruct>;
|
|
817
|
+
copdef: Record<string, Partial<CopDef>>;
|
|
818
|
+
strings: Record<string, Partial<DbStringType>>;
|
|
819
|
+
transforms: Record<string, Partial<DbTransform>[]>;
|
|
820
|
+
addrModes: Record<string, Partial<DbAddressingMode>>;
|
|
821
|
+
headers: Partial<DbHeader>[];
|
|
822
|
+
groups: Record<string, Partial<DbGroup>>;
|
|
823
|
+
fileTypes: Record<string, Partial<DbFileType>>;
|
|
824
|
+
}
|
|
825
|
+
interface DbBaseRomModule extends DbGameRomModule {
|
|
826
|
+
baseRomFiles: ChunkFile[];
|
|
827
|
+
}
|
|
828
|
+
interface DbProjectModule extends DbBaseRomModule {
|
|
829
|
+
projectFiles: ChunkFile[];
|
|
830
|
+
}
|
|
831
|
+
//#endregion
|
|
832
|
+
//#region src/database/header.d.ts
|
|
833
|
+
declare class DbHeader {
|
|
834
|
+
bank: number;
|
|
835
|
+
address: number;
|
|
836
|
+
condition?: string;
|
|
837
|
+
parts: DbHeaderPart[];
|
|
838
|
+
constructor(data: Partial<DbHeader>);
|
|
839
|
+
}
|
|
840
|
+
declare class DbHeaderPart {
|
|
841
|
+
name: string;
|
|
842
|
+
size: number;
|
|
843
|
+
type: string;
|
|
844
|
+
value?: any;
|
|
845
|
+
constructor(data: Partial<DbHeaderPart>);
|
|
1105
846
|
}
|
|
847
|
+
//#endregion
|
|
848
|
+
//#region src/database/root.d.ts
|
|
1106
849
|
/**
|
|
1107
|
-
*
|
|
850
|
+
* Main database root class
|
|
851
|
+
* Converted from GaiaLib/Database/DbRoot.cs
|
|
1108
852
|
*/
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
853
|
+
interface DbRoot {
|
|
854
|
+
copDef: Record<number, CopDef>;
|
|
855
|
+
copLookup: Record<string, CopDef>;
|
|
856
|
+
mnemonics: Record<number, string>;
|
|
857
|
+
structs: Record<string, DbStruct>;
|
|
858
|
+
stringTypes: Record<string, DbStringType>;
|
|
859
|
+
stringDelimiters: string[];
|
|
860
|
+
stringDelimiterLookup: Record<string, DbStringType>;
|
|
861
|
+
headers: DbHeader[];
|
|
862
|
+
files: DbFile[];
|
|
863
|
+
config: DbConfig;
|
|
864
|
+
blocks: DbBlock[];
|
|
865
|
+
overrides: Record<number, Record<string, any>>;
|
|
866
|
+
labels: Record<number, string>;
|
|
867
|
+
rewrites: Record<number, number>;
|
|
868
|
+
entryPoints: DbEntryPoint[];
|
|
869
|
+
opCodes: Record<number, OpCode>;
|
|
870
|
+
opLookup: Record<string, OpCode[]>;
|
|
871
|
+
addrLookup: Record<string, DbAddressingMode>;
|
|
872
|
+
compression?: ICompressionProvider;
|
|
873
|
+
baseRomFiles?: ChunkFile[];
|
|
874
|
+
projectFiles?: ChunkFile[];
|
|
875
|
+
groups: Record<string, DbGroup>;
|
|
876
|
+
scenes: Record<number, DbScene>;
|
|
877
|
+
fileTypes: Record<string, DbFileType>;
|
|
878
|
+
fileExtLookup: Record<string, DbFileType>;
|
|
1113
879
|
}
|
|
1114
880
|
/**
|
|
1115
|
-
*
|
|
881
|
+
* Database root utilities
|
|
1116
882
|
*/
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
883
|
+
declare class DbRootUtils {
|
|
884
|
+
/**
|
|
885
|
+
* JSON serialization options
|
|
886
|
+
*/
|
|
887
|
+
static fromGameModule(module: DbGameRomModule): DbRoot;
|
|
888
|
+
static applyFolder(root: DbRoot, folderPath: string, sourceFiles?: ChunkFile[], group?: string): Promise<ChunkFile[]>;
|
|
889
|
+
static extractAllContent(root: DbRoot, romPath: string, outPath: string): Promise<void>;
|
|
890
|
+
static rebuildAllContent(root: DbRoot, inPath: string[], outPath: string): Promise<ChunkFile[]>;
|
|
891
|
+
}
|
|
892
|
+
//#endregion
|
|
893
|
+
//#region src/database/labels.d.ts
|
|
1124
894
|
/**
|
|
1125
|
-
*
|
|
895
|
+
* Database label definition
|
|
896
|
+
* Converted from GaiaLib/Database/DbLabel.cs
|
|
1126
897
|
*/
|
|
1127
|
-
interface
|
|
1128
|
-
|
|
898
|
+
interface DbLabel {
|
|
899
|
+
location: number;
|
|
900
|
+
label: string;
|
|
901
|
+
}
|
|
902
|
+
//#endregion
|
|
903
|
+
//#region src/database/mnemonics.d.ts
|
|
904
|
+
/**
|
|
905
|
+
* Database mnemonic definition
|
|
906
|
+
* Converted from GaiaLib/Database/DbMnemonic.cs
|
|
907
|
+
*/
|
|
908
|
+
interface DbMnemonic {
|
|
909
|
+
key: number;
|
|
910
|
+
value: string;
|
|
911
|
+
metadata?: string;
|
|
912
|
+
}
|
|
913
|
+
//#endregion
|
|
914
|
+
//#region src/database/overrides.d.ts
|
|
915
|
+
declare class DbOverride {
|
|
916
|
+
location: number;
|
|
917
|
+
register: string;
|
|
918
|
+
value: number;
|
|
919
|
+
constructor(values: Partial<DbOverride>);
|
|
920
|
+
}
|
|
921
|
+
//#endregion
|
|
922
|
+
//#region src/database/paths.d.ts
|
|
923
|
+
/**
|
|
924
|
+
* Database path configuration
|
|
925
|
+
* Converted from GaiaLib/Database/DbPath.cs
|
|
926
|
+
*/
|
|
927
|
+
interface DbPath {
|
|
928
|
+
folder: string;
|
|
929
|
+
extension: string;
|
|
930
|
+
}
|
|
931
|
+
/**
|
|
932
|
+
* Creates a default DbPath
|
|
933
|
+
*/
|
|
934
|
+
declare function createDbPath(folder?: string, extension?: string): DbPath;
|
|
935
|
+
//#endregion
|
|
936
|
+
//#region src/database/rewrites.d.ts
|
|
937
|
+
/**
|
|
938
|
+
* Database rewrite rule definition
|
|
939
|
+
* Converted from GaiaLib/Database/DbRewrite.cs
|
|
940
|
+
*/
|
|
941
|
+
interface DbRewrite {
|
|
942
|
+
location: number;
|
|
943
|
+
value: number;
|
|
944
|
+
}
|
|
945
|
+
//#endregion
|
|
946
|
+
//#region src/database/sfx.d.ts
|
|
947
|
+
/**
|
|
948
|
+
* Database sound effect definition
|
|
949
|
+
* Converted from GaiaLib/Database/DbSfx.cs
|
|
950
|
+
*/
|
|
951
|
+
interface DbSfx {
|
|
952
|
+
location: number;
|
|
953
|
+
size: number;
|
|
954
|
+
names: string[];
|
|
955
|
+
}
|
|
956
|
+
//#endregion
|
|
957
|
+
//#region src/rom/extraction/references.d.ts
|
|
958
|
+
/**
|
|
959
|
+
* Manages references, chunks, and markers during ROM analysis
|
|
960
|
+
* Converted from GaiaLib/Rom/Extraction/ReferenceManager.cs
|
|
961
|
+
*/
|
|
962
|
+
declare class ReferenceManager {
|
|
963
|
+
readonly structTable: Map<number, string>;
|
|
964
|
+
readonly markerTable: Map<number, number>;
|
|
965
|
+
readonly nameTable: Map<number, string>;
|
|
966
|
+
readonly fileTable: Map<number, string>;
|
|
967
|
+
private readonly root;
|
|
968
|
+
constructor(root: DbRoot);
|
|
969
|
+
tryGetStruct(location: number): {
|
|
970
|
+
found: boolean;
|
|
971
|
+
chunkType?: string;
|
|
972
|
+
};
|
|
973
|
+
tryAddStruct(location: number, chunkType: string): boolean;
|
|
974
|
+
containsStruct(location: number): boolean;
|
|
975
|
+
tryGetName(location: number): {
|
|
976
|
+
found: boolean;
|
|
977
|
+
referenceName?: string;
|
|
978
|
+
};
|
|
979
|
+
tryAddName(location: number, referenceName: string): boolean;
|
|
980
|
+
tryGetMarker(location: number): {
|
|
981
|
+
found: boolean;
|
|
982
|
+
offset?: number;
|
|
983
|
+
};
|
|
984
|
+
setMarker(location: number, offset: number): void;
|
|
985
|
+
createBranchLabel(location: number): string;
|
|
986
|
+
createTypeName(type: string, location: number): string;
|
|
987
|
+
createFallbackName(location: number): string;
|
|
988
|
+
/**
|
|
989
|
+
* Finds a reference location by its assigned name.
|
|
990
|
+
*/
|
|
991
|
+
findLocationByName(name: string): number | undefined;
|
|
992
|
+
resolveName(location: number, type: AddressType, isBranch: boolean): string;
|
|
993
|
+
findClosestReference(location: number): string | null;
|
|
994
|
+
private processRewrite;
|
|
995
|
+
private processClosestMatch;
|
|
996
|
+
}
|
|
997
|
+
//#endregion
|
|
998
|
+
//#region src/types/files.d.ts
|
|
999
|
+
/**
|
|
1000
|
+
* Chunk file for ROM processing
|
|
1001
|
+
* Converted from GaiaLib/Types/ChunkFile.cs
|
|
1002
|
+
*/
|
|
1003
|
+
declare class ChunkFile {
|
|
1129
1004
|
name: string;
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1005
|
+
size: number;
|
|
1006
|
+
location: number;
|
|
1007
|
+
type: DbFileType;
|
|
1008
|
+
parts?: AsmBlock[];
|
|
1009
|
+
includes?: Set<string>;
|
|
1010
|
+
includeLookup?: Map<string, AsmBlock>;
|
|
1011
|
+
bank?: number;
|
|
1012
|
+
compressed?: boolean;
|
|
1013
|
+
upper?: boolean;
|
|
1014
|
+
rawData?: Uint8Array | null;
|
|
1015
|
+
textData?: string;
|
|
1016
|
+
transforms?: {
|
|
1017
|
+
key: string;
|
|
1018
|
+
value: string;
|
|
1019
|
+
}[];
|
|
1020
|
+
postProcess?: string;
|
|
1021
|
+
mnemonics: Record<number, string>;
|
|
1022
|
+
group?: string;
|
|
1023
|
+
scene?: string;
|
|
1024
|
+
base?: number;
|
|
1025
|
+
referenceManager?: ReferenceManager;
|
|
1026
|
+
constructor(type: DbFileType, name: string, size?: number, location?: number);
|
|
1027
|
+
enrichWithRawDataFromDbFile(file: DbFile, rom: Uint8Array, compression: ICompressionProvider | undefined): void;
|
|
1028
|
+
enrichWithAsmBlocksFromDbBlock(block: DbBlock, memoryMode: MemoryMapMode): void;
|
|
1135
1029
|
}
|
|
1030
|
+
declare function combineHeader(data: Uint8Array, position: number, length: number, header: Uint8Array | null, type: BinType): Uint8Array;
|
|
1136
1031
|
/**
|
|
1137
|
-
*
|
|
1032
|
+
* Chunk file utilities
|
|
1138
1033
|
*/
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1034
|
+
declare class ChunkFileUtils {
|
|
1035
|
+
/**
|
|
1036
|
+
* Rebase blocks to a new location
|
|
1037
|
+
*/
|
|
1038
|
+
static rebase(chunkFile: ChunkFile, newLocation?: number): void;
|
|
1039
|
+
/**
|
|
1040
|
+
* Calculate the total size of all blocks
|
|
1041
|
+
*/
|
|
1042
|
+
static calculateSize(chunkFile: ChunkFile): number;
|
|
1043
|
+
/**
|
|
1044
|
+
* Check if a location is outside this block and return the part (matches C# IsOutside)
|
|
1045
|
+
* Returns [isOutside, part] where part is the part containing the location
|
|
1046
|
+
*/
|
|
1047
|
+
static isOutsideWithPart(root: ChunkFile[], block: ChunkFile, location: number): [boolean, ChunkFile | null, AsmBlock | null];
|
|
1048
|
+
/**
|
|
1049
|
+
* Check if a location is inside this block and return the part (matches C# IsInside)
|
|
1050
|
+
* Returns [isInside, part] where part is the part containing the location
|
|
1051
|
+
*/
|
|
1052
|
+
static isInsideWithPart(block: ChunkFile, location: number): [boolean, AsmBlock | null];
|
|
1053
|
+
/**
|
|
1054
|
+
* Check if a location is outside this block (shorthand version)
|
|
1055
|
+
*/
|
|
1056
|
+
static isOutside(block: ChunkFile, location: number): boolean;
|
|
1057
|
+
/**
|
|
1058
|
+
* Check if a location is inside this block (shorthand version)
|
|
1059
|
+
*/
|
|
1060
|
+
static isInside(block: ChunkFile, location: number): boolean;
|
|
1061
|
+
/**
|
|
1062
|
+
* Get all included blocks
|
|
1063
|
+
*/
|
|
1064
|
+
static getIncludes(chunkFile: ChunkFile): ChunkFile[];
|
|
1145
1065
|
}
|
|
1066
|
+
//#endregion
|
|
1067
|
+
//#region src/types/assembly.d.ts
|
|
1146
1068
|
/**
|
|
1147
|
-
*
|
|
1069
|
+
* Represents a single assembly operation/instruction
|
|
1148
1070
|
*/
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
branchId: string;
|
|
1156
|
-
fileId: string;
|
|
1157
|
-
file: ProjectFileRaw;
|
|
1071
|
+
declare class Op extends OpCode {
|
|
1072
|
+
location: number;
|
|
1073
|
+
operands: unknown[];
|
|
1074
|
+
size: number;
|
|
1075
|
+
copDef?: CopDef;
|
|
1076
|
+
constructor(code: OpCode, location?: number, operands?: unknown[], size?: number);
|
|
1158
1077
|
}
|
|
1159
1078
|
/**
|
|
1160
|
-
*
|
|
1079
|
+
* Represents a block of assembly code or data
|
|
1161
1080
|
*/
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1081
|
+
declare class AsmBlock {
|
|
1082
|
+
label?: string;
|
|
1083
|
+
location: number;
|
|
1084
|
+
size: number;
|
|
1085
|
+
isString: boolean;
|
|
1086
|
+
objList: any[];
|
|
1087
|
+
structName?: string;
|
|
1088
|
+
bank?: number;
|
|
1089
|
+
includes?: Set<{
|
|
1090
|
+
block: ChunkFile;
|
|
1091
|
+
part: AsmBlock;
|
|
1092
|
+
}>;
|
|
1093
|
+
constructor(location?: number, size?: number, isString?: boolean, label?: string, structName?: string, bank?: number);
|
|
1165
1094
|
}
|
|
1166
1095
|
/**
|
|
1167
|
-
*
|
|
1096
|
+
* Database part utilities
|
|
1168
1097
|
*/
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1098
|
+
declare class AsmBlockUtils {
|
|
1099
|
+
/**
|
|
1100
|
+
* Check if a location is inside this part
|
|
1101
|
+
*/
|
|
1102
|
+
static isInside(part: AsmBlock, location: number): boolean;
|
|
1103
|
+
/**
|
|
1104
|
+
* Check if a location is outside this part
|
|
1105
|
+
*/
|
|
1106
|
+
static isOutside(part: AsmBlock, location: number): boolean;
|
|
1174
1107
|
}
|
|
1108
|
+
//#endregion
|
|
1109
|
+
//#region src/types/bitstream.d.ts
|
|
1175
1110
|
/**
|
|
1176
|
-
*
|
|
1111
|
+
* Bit stream for reading/writing binary data at bit level
|
|
1112
|
+
* Converted from GaiaLib/Types/BitStream.cs
|
|
1177
1113
|
*/
|
|
1178
|
-
|
|
1179
|
-
|
|
1114
|
+
declare class BitStream {
|
|
1115
|
+
private static readonly NIBBLE_MASK;
|
|
1116
|
+
private static readonly NIBBLE_PERFECT_POSITION;
|
|
1117
|
+
private data;
|
|
1118
|
+
private position;
|
|
1119
|
+
private bitFlag;
|
|
1120
|
+
private writeSample;
|
|
1121
|
+
constructor(data: Uint8Array, position?: number);
|
|
1122
|
+
get dataArray(): Uint8Array;
|
|
1123
|
+
get currentPosition(): number;
|
|
1124
|
+
set currentPosition(value: number);
|
|
1180
1125
|
/**
|
|
1181
|
-
*
|
|
1182
|
-
*
|
|
1183
|
-
* Set to undefined to not filter by branch name
|
|
1126
|
+
* Read a byte from the stream
|
|
1127
|
+
* @returns The byte read, or -1 if the end of the data has been reached
|
|
1184
1128
|
*/
|
|
1185
|
-
|
|
1129
|
+
readByte(): number;
|
|
1186
1130
|
/**
|
|
1187
|
-
*
|
|
1188
|
-
*
|
|
1189
|
-
* Set to undefined to not filter by version
|
|
1131
|
+
* Read a ushort from the stream (ignores the current bit flag)
|
|
1132
|
+
* @returns The short read, or -1 if the end of the data has been reached
|
|
1190
1133
|
*/
|
|
1191
|
-
|
|
1134
|
+
readShort(): number;
|
|
1135
|
+
/**
|
|
1136
|
+
* Read a bit from the stream
|
|
1137
|
+
* @returns True if the current bit at bitFlag is set, false otherwise
|
|
1138
|
+
*/
|
|
1139
|
+
readBit(): boolean;
|
|
1140
|
+
/**
|
|
1141
|
+
* Read a nibble from the stream
|
|
1142
|
+
* @returns The nibble read, or -1 if the end of the data has been reached
|
|
1143
|
+
*/
|
|
1144
|
+
readNibble(): number;
|
|
1145
|
+
/**
|
|
1146
|
+
* Write a bit to the stream
|
|
1147
|
+
* @param set True if the current bit should be set, false otherwise
|
|
1148
|
+
*/
|
|
1149
|
+
writeBit(set: boolean): void;
|
|
1150
|
+
/**
|
|
1151
|
+
* Write a byte to the stream
|
|
1152
|
+
* @param value The byte to write
|
|
1153
|
+
*/
|
|
1154
|
+
writeByte(value: number): void;
|
|
1155
|
+
/**
|
|
1156
|
+
* Write a nibble to the stream
|
|
1157
|
+
* @param value The nibble to write
|
|
1158
|
+
*/
|
|
1159
|
+
writeNibble(value: number): void;
|
|
1160
|
+
flush(): void;
|
|
1192
1161
|
}
|
|
1162
|
+
//#endregion
|
|
1163
|
+
//#region src/types/compression-registry.d.ts
|
|
1193
1164
|
/**
|
|
1194
|
-
*
|
|
1165
|
+
* Registry for compression providers
|
|
1166
|
+
* Allows registration of compression implementations by string ID
|
|
1195
1167
|
*/
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1168
|
+
declare class CompressionRegistry {
|
|
1169
|
+
private static providers;
|
|
1170
|
+
/**
|
|
1171
|
+
* Register a compression provider
|
|
1172
|
+
* @param id String identifier for the compression type
|
|
1173
|
+
* @param factory Factory function that creates the compression provider
|
|
1174
|
+
*/
|
|
1175
|
+
static register(id: string, factory: () => ICompressionProvider): void;
|
|
1176
|
+
/**
|
|
1177
|
+
* Get a compression provider by ID
|
|
1178
|
+
* @param id String identifier for the compression type
|
|
1179
|
+
* @returns Compression provider instance
|
|
1180
|
+
*/
|
|
1181
|
+
static get(id: string): ICompressionProvider;
|
|
1182
|
+
/**
|
|
1183
|
+
* Check if a compression provider is registered
|
|
1184
|
+
* @param id String identifier for the compression type
|
|
1185
|
+
* @returns True if provider is registered
|
|
1186
|
+
*/
|
|
1187
|
+
static has(id: string): boolean;
|
|
1188
|
+
/**
|
|
1189
|
+
* Get list of registered provider IDs
|
|
1190
|
+
* @returns Array of registered provider IDs
|
|
1191
|
+
*/
|
|
1192
|
+
static getRegisteredIds(): string[];
|
|
1193
|
+
/**
|
|
1194
|
+
* Clear all registered providers (mainly for testing)
|
|
1195
|
+
*/
|
|
1196
|
+
static clear(): void;
|
|
1201
1197
|
}
|
|
1202
1198
|
//#endregion
|
|
1203
|
-
//#region src/
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1199
|
+
//#region src/types/constants.d.ts
|
|
1200
|
+
/**
|
|
1201
|
+
* ROM processing constants
|
|
1202
|
+
* Converted from GaiaLib/Types/RomProcessingConstants.cs
|
|
1203
|
+
*/
|
|
1204
|
+
declare class RomProcessingConstants {
|
|
1205
|
+
static readonly PAGE_SIZE = 32768;
|
|
1206
|
+
static readonly SNES_HEADER_SIZE = 80;
|
|
1207
|
+
static readonly DICTIONARIES: string[];
|
|
1208
|
+
static readonly DICT_COMMANDS: number[];
|
|
1209
|
+
static readonly END_CHARS: number[];
|
|
1210
|
+
static readonly WHITESPACE: string[];
|
|
1211
|
+
static readonly OPERATORS: string[];
|
|
1212
|
+
static readonly COMMA_SPACE: string[];
|
|
1213
|
+
static readonly ADDRESS_SPACE: string[];
|
|
1214
|
+
static readonly SYMBOL_SPACE: string[];
|
|
1215
|
+
static readonly LABEL_SPACE: string[];
|
|
1216
|
+
static readonly OBJECT_SPACE: string[];
|
|
1217
|
+
static readonly COP_SPLIT_CHARS: string[];
|
|
1218
|
+
static readonly WHITESPACE_REGEX: RegExp;
|
|
1219
|
+
static readonly COMMA_SPACE_REGEX: RegExp;
|
|
1220
|
+
static readonly SYMBOL_SPACE_REGEX: RegExp;
|
|
1221
|
+
static readonly LABEL_SPACE_REGEX: RegExp;
|
|
1222
|
+
static readonly OBJECT_SPACE_REGEX: RegExp;
|
|
1223
|
+
static readonly ADDRESS_SPACE_REGEX: RegExp;
|
|
1224
|
+
static readonly COP_SPLIT_REGEX: RegExp;
|
|
1225
|
+
static readonly COMMA_SPACE_TRIM_REGEX: RegExp;
|
|
1226
|
+
/**
|
|
1227
|
+
* Gets the size of an object for processing purposes
|
|
1228
|
+
* @param obj The object to get the size for
|
|
1229
|
+
* @returns Size in bytes
|
|
1230
|
+
* @throws Error when unable to determine size
|
|
1231
|
+
*/
|
|
1232
|
+
static getSize(obj: unknown): number;
|
|
1222
1233
|
}
|
|
1223
|
-
|
|
1224
|
-
|
|
1234
|
+
/**
|
|
1235
|
+
* BlockReader specific constants
|
|
1236
|
+
*/
|
|
1237
|
+
declare class BlockReaderConstants {
|
|
1238
|
+
static readonly REF_SEARCH_MAX_RANGE = 896;
|
|
1239
|
+
static readonly BANK_MASK_CHECK = 64;
|
|
1240
|
+
static readonly BYTE_DELIMITER_THRESHOLD = 256;
|
|
1241
|
+
static readonly BANK_HIGH_MEMORY_1 = 126;
|
|
1242
|
+
static readonly BANK_HIGH_MEMORY_2 = 127;
|
|
1243
|
+
static readonly POINTER_CHARACTERS: string[];
|
|
1244
|
+
static readonly WIDE_STRING_TYPE = "WideString";
|
|
1245
|
+
static readonly BINARY_TYPE = "Binary";
|
|
1246
|
+
static readonly CODE_TYPE = "Code";
|
|
1247
|
+
static readonly LOCATION_FORMAT = "loc_{0:X6}";
|
|
1248
|
+
static readonly TYPE_NAME_FORMAT = "{0}_{1:X6}";
|
|
1249
|
+
static readonly OFFSET_FORMAT = "+{0:X}";
|
|
1250
|
+
static readonly MARKER_FORMAT = "+M";
|
|
1251
|
+
static readonly NEGATIVE_OFFSET_FORMAT = "-{0:X}";
|
|
1252
|
+
static readonly NEGATIVE_MARKER_FORMAT = "-M";
|
|
1225
1253
|
}
|
|
1226
|
-
|
|
1227
|
-
|
|
1254
|
+
//#endregion
|
|
1255
|
+
//#region src/types/location.d.ts
|
|
1256
|
+
/**
|
|
1257
|
+
* Location wrapper for additional metadata
|
|
1258
|
+
* Converted from GaiaLib/Types/LocationWrapper.cs
|
|
1259
|
+
*/
|
|
1260
|
+
declare class LocationWrapper {
|
|
1261
|
+
location: number;
|
|
1262
|
+
type: AddressType;
|
|
1263
|
+
constructor(location: number, type: AddressType);
|
|
1228
1264
|
}
|
|
1229
1265
|
//#endregion
|
|
1230
|
-
//#region src/
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1266
|
+
//#region src/types/strings.d.ts
|
|
1267
|
+
/**
|
|
1268
|
+
* String marker for positioning
|
|
1269
|
+
* Converted from GaiaLib/Types/StringMarker.cs
|
|
1270
|
+
*/
|
|
1271
|
+
interface StringMarker {
|
|
1272
|
+
offset: number;
|
|
1237
1273
|
}
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1274
|
+
/**
|
|
1275
|
+
* String wrapper with type and location information
|
|
1276
|
+
* Converted from GaiaLib/Types/StringWrapper.cs
|
|
1277
|
+
*/
|
|
1278
|
+
interface StringWrapper {
|
|
1279
|
+
string: string;
|
|
1280
|
+
type: DbStringType;
|
|
1281
|
+
marker: number;
|
|
1282
|
+
location: number;
|
|
1283
|
+
fixedSize: number;
|
|
1244
1284
|
}
|
|
1245
|
-
//#endregion
|
|
1246
|
-
//#region src/database/root.d.ts
|
|
1247
1285
|
/**
|
|
1248
|
-
*
|
|
1249
|
-
* Converted from GaiaLib/
|
|
1286
|
+
* String entry (commented out in original C# code)
|
|
1287
|
+
* Converted from GaiaLib/Types/StringEntry.cs
|
|
1250
1288
|
*/
|
|
1251
|
-
interface
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
stringTypes: Record<string, DbStringType>;
|
|
1257
|
-
stringDelimiters: string[];
|
|
1258
|
-
stringDelimiterLookup: Record<string, DbStringType>;
|
|
1259
|
-
headers: DbHeader[];
|
|
1260
|
-
files: DbFile[];
|
|
1261
|
-
config: DbConfig;
|
|
1262
|
-
blocks: DbBlock[];
|
|
1263
|
-
overrides: Record<number, Record<string, any>>;
|
|
1264
|
-
labels: Record<number, string>;
|
|
1265
|
-
rewrites: Record<number, number>;
|
|
1266
|
-
entryPoints: DbEntryPoint[];
|
|
1267
|
-
opCodes: Record<number, OpCode>;
|
|
1268
|
-
opLookup: Record<string, OpCode[]>;
|
|
1269
|
-
addrLookup: Record<string, DbAddressingMode>;
|
|
1270
|
-
compression?: ICompressionProvider;
|
|
1271
|
-
baseRomFiles?: ChunkFile[];
|
|
1272
|
-
projectFiles?: ChunkFile[];
|
|
1273
|
-
groups: Record<string, DbGroup>;
|
|
1274
|
-
scenes: Record<number, DbScene>;
|
|
1275
|
-
fileTypes: Record<string, DbFileType>;
|
|
1276
|
-
fileExtLookup: Record<string, DbFileType>;
|
|
1289
|
+
interface StringEntry {
|
|
1290
|
+
block: AsmBlock;
|
|
1291
|
+
index: number;
|
|
1292
|
+
size: number;
|
|
1293
|
+
data: Uint8Array;
|
|
1277
1294
|
}
|
|
1278
1295
|
/**
|
|
1279
|
-
*
|
|
1296
|
+
* String size comparer utility
|
|
1297
|
+
* Converted from GaiaLib/Types/StringSizeComparer.cs
|
|
1280
1298
|
*/
|
|
1281
|
-
declare class
|
|
1299
|
+
declare class StringSizeComparer {
|
|
1282
1300
|
/**
|
|
1283
|
-
*
|
|
1301
|
+
* Compare two strings by length
|
|
1284
1302
|
*/
|
|
1285
|
-
static
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1303
|
+
static compare(a: string, b: string): number;
|
|
1304
|
+
/**
|
|
1305
|
+
* Compare two StringWrapper objects by string length
|
|
1306
|
+
*/
|
|
1307
|
+
static compareWrappers(a: StringWrapper, b: StringWrapper): number;
|
|
1289
1308
|
}
|
|
1290
1309
|
//#endregion
|
|
1291
|
-
//#region src/
|
|
1310
|
+
//#region src/types/structs.d.ts
|
|
1292
1311
|
/**
|
|
1293
|
-
*
|
|
1294
|
-
* Converted from GaiaLib/
|
|
1312
|
+
* Structure definition
|
|
1313
|
+
* Converted from GaiaLib/Types/StructDef.cs
|
|
1295
1314
|
*/
|
|
1296
|
-
interface
|
|
1297
|
-
|
|
1298
|
-
|
|
1315
|
+
interface StructDef {
|
|
1316
|
+
name: string;
|
|
1317
|
+
parts: unknown[];
|
|
1299
1318
|
}
|
|
1300
1319
|
//#endregion
|
|
1301
|
-
//#region src/
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
interface DbMnemonic {
|
|
1307
|
-
key: number;
|
|
1308
|
-
value: string;
|
|
1309
|
-
metadata?: string;
|
|
1320
|
+
//#region src/types/tables.d.ts
|
|
1321
|
+
declare class TableEntry {
|
|
1322
|
+
location: number;
|
|
1323
|
+
object: unknown;
|
|
1324
|
+
constructor(location: number);
|
|
1310
1325
|
}
|
|
1311
1326
|
//#endregion
|
|
1312
|
-
//#region src/
|
|
1313
|
-
declare class
|
|
1314
|
-
location: number;
|
|
1315
|
-
register: string;
|
|
1327
|
+
//#region src/types/operands.d.ts
|
|
1328
|
+
declare class TypedNumber {
|
|
1316
1329
|
value: number;
|
|
1317
|
-
|
|
1330
|
+
size: number;
|
|
1331
|
+
constructor(value: number, size: number);
|
|
1332
|
+
}
|
|
1333
|
+
declare class Byte extends TypedNumber {
|
|
1334
|
+
constructor(value: number);
|
|
1335
|
+
}
|
|
1336
|
+
declare class Word extends TypedNumber {
|
|
1337
|
+
constructor(value: number);
|
|
1338
|
+
}
|
|
1339
|
+
declare class Long extends TypedNumber {
|
|
1340
|
+
constructor(value: number);
|
|
1318
1341
|
}
|
|
1319
1342
|
//#endregion
|
|
1320
|
-
//#region src/
|
|
1343
|
+
//#region src/assembly/Registers.d.ts
|
|
1321
1344
|
/**
|
|
1322
|
-
*
|
|
1323
|
-
* Converted from GaiaLib/Database/DbRewrite.cs
|
|
1345
|
+
* Manages the 65816 processor registers and status flags
|
|
1324
1346
|
*/
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1347
|
+
declare class Registers {
|
|
1348
|
+
value: Record<string, number>;
|
|
1349
|
+
stack: Stack;
|
|
1350
|
+
mode: MemoryMapMode;
|
|
1351
|
+
constructor(mode: MemoryMapMode);
|
|
1328
1352
|
}
|
|
1329
1353
|
//#endregion
|
|
1330
|
-
//#region src/
|
|
1354
|
+
//#region src/rom/extraction/processor.d.ts
|
|
1355
|
+
declare class MapExt<K, V> extends Map<K, V> {
|
|
1356
|
+
constructor();
|
|
1357
|
+
tryAdd(key: K, value: V): boolean;
|
|
1358
|
+
setFlag(key: K, flag: number, value?: boolean): void;
|
|
1359
|
+
clearFlag(key: K, flag: number): void;
|
|
1360
|
+
}
|
|
1331
1361
|
/**
|
|
1332
|
-
*
|
|
1333
|
-
* Converted from GaiaLib/
|
|
1362
|
+
* Manages CPU processor state during ROM analysis
|
|
1363
|
+
* Converted from GaiaLib/Rom/Extraction/ProcessorStateManager.cs
|
|
1334
1364
|
*/
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1365
|
+
declare class ProcessorStateManager {
|
|
1366
|
+
readonly stackPositions: MapExt<number, number>;
|
|
1367
|
+
private readonly _buckets;
|
|
1368
|
+
get(key: string): MapExt<number, number>;
|
|
1369
|
+
/**
|
|
1370
|
+
* Hydrate processor registers with stored state
|
|
1371
|
+
* Uses Registers from gaia-core/assembly for processor state management
|
|
1372
|
+
*/
|
|
1373
|
+
hydrateRegisters(position: number, reg: Registers): void;
|
|
1374
|
+
getStackPosition(location: number): number | undefined;
|
|
1375
|
+
setStackPosition(location: number, value: number): void;
|
|
1376
|
+
tryAddStackPosition(location: number, value: number): boolean;
|
|
1339
1377
|
}
|
|
1340
1378
|
//#endregion
|
|
1341
|
-
//#region src/rom/extraction/
|
|
1379
|
+
//#region src/rom/extraction/reader.d.ts
|
|
1342
1380
|
/**
|
|
1343
|
-
*
|
|
1344
|
-
* Converted from GaiaLib/Rom/Extraction/
|
|
1381
|
+
* Provides low-level ROM data reading functionality
|
|
1382
|
+
* Converted from GaiaLib/Rom/Extraction/RomDataReader.cs
|
|
1345
1383
|
*/
|
|
1346
|
-
declare class
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
referenceName?: string;
|
|
1361
|
-
};
|
|
1362
|
-
tryAddName(location: number, referenceName: string): boolean;
|
|
1363
|
-
tryGetMarker(location: number): {
|
|
1364
|
-
found: boolean;
|
|
1365
|
-
offset?: number;
|
|
1366
|
-
};
|
|
1367
|
-
setMarker(location: number, offset: number): void;
|
|
1368
|
-
createBranchLabel(location: number): string;
|
|
1369
|
-
createTypeName(type: string, location: number): string;
|
|
1370
|
-
createFallbackName(location: number): string;
|
|
1371
|
-
/**
|
|
1372
|
-
* Finds a reference location by its assigned name.
|
|
1373
|
-
*/
|
|
1374
|
-
findLocationByName(name: string): number | undefined;
|
|
1375
|
-
resolveName(location: number, type: AddressType, isBranch: boolean): string;
|
|
1376
|
-
findClosestReference(location: number): string | null;
|
|
1377
|
-
private processRewrite;
|
|
1378
|
-
private processClosestMatch;
|
|
1384
|
+
declare class RomDataReader {
|
|
1385
|
+
romData: Uint8Array;
|
|
1386
|
+
position: number;
|
|
1387
|
+
offset: number;
|
|
1388
|
+
constructor(romData: Uint8Array, offset?: number);
|
|
1389
|
+
readByte(): number;
|
|
1390
|
+
readSByte(): number;
|
|
1391
|
+
readUShort(): number;
|
|
1392
|
+
readShort(): number;
|
|
1393
|
+
readAddress(): number;
|
|
1394
|
+
readInt(): number;
|
|
1395
|
+
peekByte(): number;
|
|
1396
|
+
peekShort(): number;
|
|
1397
|
+
peekAddress(): number;
|
|
1379
1398
|
}
|
|
1380
1399
|
//#endregion
|
|
1381
1400
|
//#region src/rom/extraction/strings.d.ts
|
|
@@ -1452,10 +1471,10 @@ declare class BlockReader {
|
|
|
1452
1471
|
readonly _root: DbRoot;
|
|
1453
1472
|
readonly _stringReader: StringReader;
|
|
1454
1473
|
readonly _asmReader: AsmReader;
|
|
1455
|
-
|
|
1456
|
-
|
|
1474
|
+
_typeParser: TypeParser;
|
|
1475
|
+
_romDataReader: RomDataReader;
|
|
1457
1476
|
readonly _stateManager: ProcessorStateManager;
|
|
1458
|
-
|
|
1477
|
+
_referenceManager: ReferenceManager;
|
|
1459
1478
|
_partEnd: number;
|
|
1460
1479
|
_currentChunk: ChunkFile | null;
|
|
1461
1480
|
_currentAsmBlock: AsmBlock | null;
|
|
@@ -1468,7 +1487,6 @@ declare class BlockReader {
|
|
|
1468
1487
|
/**
|
|
1469
1488
|
* Processes predefined file references
|
|
1470
1489
|
*/
|
|
1471
|
-
private initializeFileReferences;
|
|
1472
1490
|
/**
|
|
1473
1491
|
* Resolves mnemonic for a given address
|
|
1474
1492
|
*/
|
|
@@ -1476,7 +1494,6 @@ declare class BlockReader {
|
|
|
1476
1494
|
/**
|
|
1477
1495
|
* Resolves name for a location (delegated to ReferenceManager)
|
|
1478
1496
|
*/
|
|
1479
|
-
resolveName(location: number, type: AddressType, isBranch: boolean): string;
|
|
1480
1497
|
/**
|
|
1481
1498
|
* Resolves include for a location
|
|
1482
1499
|
*/
|
|
@@ -1505,7 +1522,7 @@ declare class BlockReader {
|
|
|
1505
1522
|
/**
|
|
1506
1523
|
* Processes a single part
|
|
1507
1524
|
*/
|
|
1508
|
-
|
|
1525
|
+
processPart(part: AsmBlock): void;
|
|
1509
1526
|
/**
|
|
1510
1527
|
* Processes a continuous entry (same type as previous)
|
|
1511
1528
|
*/
|
|
@@ -1768,16 +1785,16 @@ declare class RomWriter {
|
|
|
1768
1785
|
* Parse assembly blocks and write binary data to output buffer
|
|
1769
1786
|
* Converted from ext/GaiaLib/Rom/Rebuild/RomWriter.cs ParseAssembly method
|
|
1770
1787
|
*/
|
|
1771
|
-
|
|
1788
|
+
static parseAssembly(root: DbRoot, blocks: AsmBlock[], fileLookup: Map<string, number>, includeLookup: Map<string, AsmBlock>, outBuffer: Uint8Array, addrOffset?: number): void;
|
|
1772
1789
|
/**
|
|
1773
1790
|
* Helper method to find index of any character from an array in a string
|
|
1774
1791
|
*/
|
|
1775
|
-
|
|
1792
|
+
static indexOfAny(str: string, chars: string[]): number;
|
|
1776
1793
|
/**
|
|
1777
1794
|
* Helper method to check if an object is a StringMarker
|
|
1778
1795
|
*/
|
|
1779
|
-
|
|
1780
|
-
|
|
1796
|
+
static isStringMarker(obj: unknown): obj is StringMarker;
|
|
1797
|
+
static isTableEntry(obj: unknown): obj is TableEntry;
|
|
1781
1798
|
}
|
|
1782
1799
|
//#endregion
|
|
1783
1800
|
//#region src/rom/rebuild/processor.d.ts
|
|
@@ -3159,5 +3176,5 @@ declare const snes: {
|
|
|
3159
3176
|
};
|
|
3160
3177
|
declare const isPlatformNode: string | false;
|
|
3161
3178
|
//#endregion
|
|
3162
|
-
export { Address, AddressSpace, AddressType, AddressingModeHandler, AsmBlock, AsmBlockUtils, AsmReader, Assembler, 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, DbHeader, DbHeaderPart, DbLabel, DbMnemonic, DbOverride, DbPart, DbPath, DbProjectModule, DbRewrite, DbRoot, DbRootUtils, DbScene, DbSfx, DbStringCommand, DbStringDictionary, DbStringLayer, DbStringType, DbStruct, DbTransform, DeveloperData, DirectoryEntry, FileBaseData, FileBaseRaw, FileReadOptions, FromSupabaseByNameOptions, FromSupabaseByProjectOptions, GameData, GameDeveloperData, 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,
|
|
3179
|
+
export { Address, AddressSpace, AddressType, AddressingModeHandler, AsmBlock, AsmBlockUtils, AsmReader, Assembler, AssemblerState, BaseRomBranchData, BaseRomBranchFileRaw, BaseRomData, BaseRomFileData, BaseRomFileRaw, BaseRomPayload, BinType, BitStream, BlockReader, BlockReaderConstants, BlockWriter, BranchBaseData, Byte, ChunkFile, ChunkFileUtils, CollaborationConfig, CompressionAlgorithms, CompressionRegistry, CopCommandProcessor, CopCondition, CopDef, CpuMode, Database, DbAddressingMode, DbAsset, DbBaseRomModule, DbBlock, DbConfig, DbEntryPoint, DbFile, DbFileType, DbGameRomModule, DbGroup, DbHeader, DbHeaderPart, DbLabel, DbMnemonic, DbOverride, DbPart, DbPath, DbProjectModule, DbRewrite, DbRoot, DbRootUtils, DbScene, DbSfx, DbStringCommand, DbStringDictionary, DbStringLayer, DbStringType, DbStruct, DbTransform, DeveloperData, DirectoryEntry, FileBaseData, FileBaseRaw, FileReadOptions, FromSupabaseByNameOptions, FromSupabaseByProjectOptions, GameData, GameDeveloperData, 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, combineHeader, crc32_buffer, crc32_text_utf16, crc32_text_utf8, createDbPath, createSupabaseClient, createTempDirectory, decodeBase64, decodeBase64String, decodeDataString, encodeBase64, encodeBase64String, fileExists, fromSupabaseByGameRom, fromSupabaseById, fromSupabaseByName, fromSupabaseByProject, getDirectory, getEnvVar, getNestedProperty, getSupabaseClient, hexToBytes, hexToUint8Array, indexOfAny, isPlatformNode, isValidBase64, listDirectory, readFileAsBinary, readFileAsText, readJsonFile, removeDirectory, resetSupabaseClient, saveFileAsBinary, saveFileAsText, snes, summaryFromSupabaseByProject, uint8ArrayToBase64, validateEnvironmentVariables };
|
|
3163
3180
|
//# sourceMappingURL=index.d.cts.map
|