@gaialabs/core 0.1.13 → 0.1.15

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.d.mts CHANGED
@@ -771,7 +771,7 @@ declare class RomGenerator {
771
771
  constructor(projectName?: string);
772
772
  initialize(): Promise<void>;
773
773
  validateAndDownload(sourceData: Uint8Array): Promise<boolean>;
774
- generateProject(modules: string[], manualFiles?: ChunkFile[]): Promise<Uint8Array>;
774
+ generateProject(modules: string[], manualFiles?: ChunkFile[], unshiftManualFiles?: boolean): Promise<Uint8Array>;
775
775
  private applyProjectInit;
776
776
  private assembleCodeFromText;
777
777
  private generateAsmIncludeLookups;
package/dist/index.d.ts CHANGED
@@ -771,7 +771,7 @@ declare class RomGenerator {
771
771
  constructor(projectName?: string);
772
772
  initialize(): Promise<void>;
773
773
  validateAndDownload(sourceData: Uint8Array): Promise<boolean>;
774
- generateProject(modules: string[], manualFiles?: ChunkFile[]): Promise<Uint8Array>;
774
+ generateProject(modules: string[], manualFiles?: ChunkFile[], unshiftManualFiles?: boolean): Promise<Uint8Array>;
775
775
  private applyProjectInit;
776
776
  private assembleCodeFromText;
777
777
  private generateAsmIncludeLookups;
package/dist/index.js CHANGED
@@ -2671,11 +2671,15 @@ var RomWriter = class {
2671
2671
  }
2672
2672
  writeChecksum() {
2673
2673
  const buf = this.outBuffer;
2674
+ buf[65500] = 255;
2675
+ buf[65501] = 255;
2676
+ buf[65502] = 0;
2677
+ buf[65503] = 0;
2674
2678
  let sum = 0;
2675
- for (let i = 0; i < buf.length; i++) sum += buf[i] & 255;
2679
+ for (let i = 0; i < buf.length; i++) sum += buf[i];
2676
2680
  buf[65502] = sum & 255;
2677
2681
  buf[65503] = sum >> 8 & 255;
2678
- const comp = ~sum & 65535;
2682
+ const comp = ~sum;
2679
2683
  buf[65500] = comp & 255;
2680
2684
  buf[65501] = comp >> 8 & 255;
2681
2685
  }
@@ -3686,7 +3690,7 @@ var RomGenerator = class {
3686
3690
  }
3687
3691
  return false;
3688
3692
  }
3689
- async generateProject(modules, manualFiles) {
3693
+ async generateProject(modules, manualFiles, unshiftManualFiles = false) {
3690
3694
  if (!this.dbRoot) throw new Error("Database not initialized");
3691
3695
  if (!this.sourceData) throw new Error("Source data not initialized");
3692
3696
  const reader = new BlockReader(this.sourceData, this.dbRoot);
@@ -3697,10 +3701,15 @@ var RomGenerator = class {
3697
3701
  for (const block of asmFiles) block.textData = writer.generateAsm(block);
3698
3702
  for (const chunkFile of this.dbRoot.baseRomFiles) this.applyPatchFile(chunkFile, chunkFiles, asmFiles, patchFiles);
3699
3703
  const moduleLookup = this.applyProjectInit(chunkFiles, asmFiles, patchFiles);
3704
+ if (unshiftManualFiles) {
3705
+ for (const file of manualFiles ?? []) this.applyPatchFile(file, chunkFiles, asmFiles, patchFiles);
3706
+ }
3700
3707
  for (const module of modules) {
3701
3708
  for (const file of moduleLookup.get(module)) this.applyPatchFile(file, chunkFiles, asmFiles, patchFiles);
3702
3709
  }
3703
- for (const file of manualFiles ?? []) this.applyPatchFile(file, chunkFiles, asmFiles, patchFiles);
3710
+ if (!unshiftManualFiles) {
3711
+ for (const file of manualFiles ?? []) this.applyPatchFile(file, chunkFiles, asmFiles, patchFiles);
3712
+ }
3704
3713
  this.assembleCodeFromText(asmFiles);
3705
3714
  RomProcessor.applyPatches(asmFiles, patchFiles);
3706
3715
  for (const asm of chunkFiles) shared.ChunkFileUtils.calculateSize(asm);