From 948697d3d80a04f74e3d64877fa9a06818d2c79a Mon Sep 17 00:00:00 2001 From: Ethan Roseman Date: Sat, 17 Oct 2020 16:37:46 -0400 Subject: [PATCH] Initial work --- Makefile | 8 +- asm/nonmatchings/code_16F740/end_battle.s | 8 +- asm/nonmatchings/code_16F740/func_80241190.s | 8 +- asm/nonmatchings/code_16F740/func_80248B08.s | 4 +- .../code_16c8e0/draw_main_battle_ui.s | 4 +- asm/nonmatchings/code_16c8e0/func_8023ED5C.s | 4 +- .../code_16c8e0/update_battle_state.s | 12 +- asm/nonmatchings/code_181810/ActorSpeak.s | 44 +- asm/nonmatchings/code_181810/EndActorSpeech.s | 36 +- .../code_181810/LoadBattleDmaData.s | 4 +- .../code_181810/ShowBattleChoice.s | 4 +- asm/nonmatchings/code_18F340/func_8026127C.s | 4 +- asm/nonmatchings/code_190B20/func_80263464.s | 4 +- asm/nonmatchings/code_197F40/func_8026E198.s | 4 +- .../os/code_4ac90_len_3910/func_80072B30.s | 4 +- .../os/code_4ac90_len_3910/load_battle.s | 4 +- tools/Makefile | 9 + tools/Yay0compress | Bin 0 -> 21968 bytes tools/Yay0compress.c | 316 +++++++++++ tools/find_bogus_functions.py | 119 ----- tools/find_yay0_size | Bin 17272 -> 0 bytes tools/find_yay0_size.c | 168 ------ tools/glabel.py | 22 - tools/old/fix_asm.py | 66 --- tools/old/reg_convert.py | 17 - tools/postprocess.py | 45 -- tools/splat.yaml | 492 +++++++++--------- tools/yay0_decompress | Bin 17376 -> 0 bytes tools/yay0_decompress.c | 159 ------ 29 files changed, 652 insertions(+), 917 deletions(-) create mode 100644 tools/Makefile create mode 100755 tools/Yay0compress create mode 100644 tools/Yay0compress.c delete mode 100755 tools/find_bogus_functions.py delete mode 100755 tools/find_yay0_size delete mode 100644 tools/find_yay0_size.c delete mode 100755 tools/glabel.py delete mode 100755 tools/old/fix_asm.py delete mode 100755 tools/old/reg_convert.py delete mode 100755 tools/postprocess.py delete mode 100755 tools/yay0_decompress delete mode 100644 tools/yay0_decompress.c diff --git a/Makefile b/Makefile index 7d3b41a03c..42f458a3ab 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,7 @@ ifdef PM_HEADER_REBUILD H_FILES := $(foreach dir,$(INCLUDE_DIRS),$(wildcard $(dir)/*.h)) endif DATA_FILES := $(foreach dir,$(DATA_DIRS),$(wildcard $(dir)/*.bin)) +YAY0_FILES := $(foreach dir,$(YAY0_DIRS),$(wildcard $(dir)/*.bin)) # Object files O_FILES := $(foreach file,$(C_FILES),$(BUILD_DIR)/$(file:.c=.o)) \ @@ -77,13 +78,14 @@ $(TARGET).ld: tools/splat.yaml ./tools/n64splat/split.py baserom.z64 tools/splat.yaml . --modes ld setup: clean submodules split + make -C tools print-% : ; $(info $* is a $(flavor $*) variable set to [$($*)]) @true $(BUILD_DIR): mkdir -p $(BUILD_DIR) -$(BUILD_DIR)/$(TARGET).elf: $(O_FILES) $(LD_SCRIPT) +$(BUILD_DIR)/$(TARGET).elf: $(O_FILES) $(YAY0_FILES) $(LD_SCRIPT) @$(LD) $(LDFLAGS) -o $@ $(O_FILES) $(BUILD_DIR)/%.o: %.s @@ -95,6 +97,10 @@ $(BUILD_DIR)/%.o: %.c $(H_FILES) $(BUILD_DIR)/%.o: %.bin $(LD) -r -b binary -o $@ $< +$(BUILD_DIR)/%.Yay0: %.bin + tools/Yay0compress $< $@ + $(LD) -r -b binary -o $@ $< + $(BUILD_DIR)/$(TARGET).bin: $(BUILD_DIR)/$(TARGET).elf $(OBJCOPY) $< $@ -O binary diff --git a/asm/nonmatchings/code_16F740/end_battle.s b/asm/nonmatchings/code_16F740/end_battle.s index 60bb366684..57a9f4a015 100644 --- a/asm/nonmatchings/code_16F740/end_battle.s +++ b/asm/nonmatchings/code_16F740/end_battle.s @@ -189,8 +189,8 @@ glabel end_battle /* 1735E0 80244D00 3C04802A */ lui $a0, 0x802a /* 1735E4 80244D04 2484CAAC */ addiu $a0, $a0, -0x3554 /* 1735E8 80244D08 27A50010 */ addiu $a1, $sp, 0x10 -/* 1735EC 80244D0C 3C02800E */ lui $v0, 0x800e -/* 1735F0 80244D10 8C42C068 */ lw $v0, -0x3f98($v0) +/* 1735EC 80244D0C 3C02800E */ lui $v0, %hi(gBattleState) +/* 1735F0 80244D10 8C42C068 */ lw $v0, %lo(gBattleState)($v0) /* 1735F4 80244D14 3C01800E */ lui $at, 0x800e /* 1735F8 80244D18 AC22C4D0 */ sw $v0, -0x3b30($at) /* 1735FC 80244D1C 0C016AFE */ jal get_map_IDs_by_name @@ -207,8 +207,8 @@ glabel end_battle .L80244D48: /* 173628 80244D48 0C090464 */ jal func_80241190 /* 17362C 80244D4C 0000202D */ daddu $a0, $zero, $zero -/* 173630 80244D50 3C02800E */ lui $v0, 0x800e -/* 173634 80244D54 8C42C068 */ lw $v0, -0x3f98($v0) +/* 173630 80244D50 3C02800E */ lui $v0, %hi(gBattleState) +/* 173634 80244D54 8C42C068 */ lw $v0, %lo(gBattleState)($v0) /* 173638 80244D58 3C01800E */ lui $at, 0x800e /* 17363C 80244D5C AC22C4D0 */ sw $v0, -0x3b30($at) /* 173640 80244D60 0C00F945 */ jal func_8003E514 diff --git a/asm/nonmatchings/code_16F740/func_80241190.s b/asm/nonmatchings/code_16F740/func_80241190.s index 9452cfa8e9..fc069d84c5 100644 --- a/asm/nonmatchings/code_16F740/func_80241190.s +++ b/asm/nonmatchings/code_16F740/func_80241190.s @@ -5,8 +5,8 @@ glabel func_80241190 /* 16FA70 80241190 3C03800E */ lui $v1, 0x800e /* 16FA74 80241194 8C63C074 */ lw $v1, -0x3f8c($v1) /* 16FA78 80241198 24020001 */ addiu $v0, $zero, 1 -/* 16FA7C 8024119C 3C01800E */ lui $at, 0x800e -/* 16FA80 802411A0 AC24C068 */ sw $a0, -0x3f98($at) +/* 16FA7C 8024119C 3C01800E */ lui $at, %hi(gBattleState) +/* 16FA80 802411A0 AC24C068 */ sw $a0, %lo(gBattleState)($at) /* 16FA84 802411A4 3C01800E */ lui $at, 0x800e /* 16FA88 802411A8 AC22C4E0 */ sw $v0, -0x3b20($at) /* 16FA8C 802411AC 3C01800E */ lui $at, 0x800e @@ -36,8 +36,8 @@ glabel func_80241190 .L80241204: /* 16FAE4 80241204 24040007 */ addiu $a0, $zero, 7 .L80241208: -/* 16FAE8 80241208 3C01800E */ lui $at, 0x800e -/* 16FAEC 8024120C AC24C068 */ sw $a0, -0x3f98($at) +/* 16FAE8 80241208 3C01800E */ lui $at, %hi(gBattleState) +/* 16FAEC 8024120C AC24C068 */ sw $a0, %lo(gBattleState)($at) .L80241210: /* 16FAF0 80241210 03E00008 */ jr $ra /* 16FAF4 80241214 00000000 */ nop diff --git a/asm/nonmatchings/code_16F740/func_80248B08.s b/asm/nonmatchings/code_16F740/func_80248B08.s index a858e00857..acf01c1536 100644 --- a/asm/nonmatchings/code_16F740/func_80248B08.s +++ b/asm/nonmatchings/code_16F740/func_80248B08.s @@ -159,8 +159,8 @@ glabel func_80248B08 .L80248D40: /* 177620 80248D40 0C090464 */ jal func_80241190 /* 177624 80248D44 0000202D */ daddu $a0, $zero, $zero -/* 177628 80248D48 3C02800E */ lui $v0, 0x800e -/* 17762C 80248D4C 8C42C068 */ lw $v0, -0x3f98($v0) +/* 177628 80248D48 3C02800E */ lui $v0, %hi(gBattleState) +/* 17762C 80248D4C 8C42C068 */ lw $v0, %lo(gBattleState)($v0) /* 177630 80248D50 3C01800E */ lui $at, 0x800e /* 177634 80248D54 AC22C4D0 */ sw $v0, -0x3b30($at) /* 177638 80248D58 0C00CD3C */ jal set_game_mode diff --git a/asm/nonmatchings/code_16c8e0/draw_main_battle_ui.s b/asm/nonmatchings/code_16c8e0/draw_main_battle_ui.s index 83a53dda77..0056a774df 100644 --- a/asm/nonmatchings/code_16c8e0/draw_main_battle_ui.s +++ b/asm/nonmatchings/code_16c8e0/draw_main_battle_ui.s @@ -7,8 +7,8 @@ glabel draw_main_battle_ui /* 16D364 8023EA84 0000882D */ daddu $s1, $zero, $zero /* 16D368 8023EA88 AFBF0018 */ sw $ra, 0x18($sp) /* 16D36C 8023EA8C AFB00010 */ sw $s0, 0x10($sp) -/* 16D370 8023EA90 3C10800E */ lui $s0, 0x800e -/* 16D374 8023EA94 8E10C068 */ lw $s0, -0x3f98($s0) +/* 16D370 8023EA90 3C10800E */ lui $s0, %hi(gBattleState) +/* 16D374 8023EA94 8E10C068 */ lw $s0, %lo(gBattleState)($s0) /* 16D378 8023EA98 3C04800E */ lui $a0, 0x800e /* 16D37C 8023EA9C 2484C4D0 */ addiu $a0, $a0, -0x3b30 /* 16D380 8023EAA0 8C820000 */ lw $v0, ($a0) diff --git a/asm/nonmatchings/code_16c8e0/func_8023ED5C.s b/asm/nonmatchings/code_16c8e0/func_8023ED5C.s index 6063f962ca..ad38659215 100644 --- a/asm/nonmatchings/code_16c8e0/func_8023ED5C.s +++ b/asm/nonmatchings/code_16c8e0/func_8023ED5C.s @@ -2,8 +2,8 @@ .set noreorder # don't insert nops after branches glabel func_8023ED5C -/* 16D63C 8023ED5C 3C02800E */ lui $v0, 0x800e -/* 16D640 8023ED60 8C42C068 */ lw $v0, -0x3f98($v0) +/* 16D63C 8023ED5C 3C02800E */ lui $v0, %hi(gBattleState) +/* 16D640 8023ED60 8C42C068 */ lw $v0, %lo(gBattleState)($v0) /* 16D644 8023ED64 27BDFFB8 */ addiu $sp, $sp, -0x48 /* 16D648 8023ED68 AFB40030 */ sw $s4, 0x30($sp) /* 16D64C 8023ED6C 3C14800E */ lui $s4, %hi(gBattleStatus) diff --git a/asm/nonmatchings/code_16c8e0/update_battle_state.s b/asm/nonmatchings/code_16c8e0/update_battle_state.s index 5096f193f8..2718d53107 100644 --- a/asm/nonmatchings/code_16c8e0/update_battle_state.s +++ b/asm/nonmatchings/code_16c8e0/update_battle_state.s @@ -92,13 +92,13 @@ glabel update_battle_state /* 16CE64 8023E584 82030095 */ lb $v1, 0x95($s0) /* 16CE68 8023E588 10600005 */ beqz $v1, .L8023E5A0 /* 16CE6C 8023E58C 24110001 */ addiu $s1, $zero, 1 -/* 16CE70 8023E590 3C02800E */ lui $v0, 0x800e -/* 16CE74 8023E594 8C42C068 */ lw $v0, -0x3f98($v0) +/* 16CE70 8023E590 3C02800E */ lui $v0, %hi(gBattleState) +/* 16CE74 8023E594 8C42C068 */ lw $v0, %lo(gBattleState)($v0) /* 16CE78 8023E598 10620092 */ beq $v1, $v0, .L8023E7E4 /* 16CE7C 8023E59C 00000000 */ nop .L8023E5A0: -/* 16CE80 8023E5A0 3C02800E */ lui $v0, 0x800e -/* 16CE84 8023E5A4 8C42C068 */ lw $v0, -0x3f98($v0) +/* 16CE80 8023E5A0 3C02800E */ lui $v0, %hi(gBattleState) +/* 16CE84 8023E5A4 8C42C068 */ lw $v0, %lo(gBattleState)($v0) /* 16CE88 8023E5A8 24430001 */ addiu $v1, $v0, 1 /* 16CE8C 8023E5AC 2C620025 */ sltiu $v0, $v1, 0x25 /* 16CE90 8023E5B0 1040008C */ beqz $v0, .L8023E7E4 @@ -383,8 +383,8 @@ glabel update_battle_state .L8023E9E0: /* 16D2C0 8023E9E0 1485000A */ bne $a0, $a1, .L8023EA0C /* 16D2C4 8023E9E4 2462000A */ addiu $v0, $v1, 0xa -/* 16D2C8 8023E9E8 3C03800E */ lui $v1, 0x800e -/* 16D2CC 8023E9EC 8C63C068 */ lw $v1, -0x3f98($v1) +/* 16D2C8 8023E9E8 3C03800E */ lui $v1, %hi(gBattleState) +/* 16D2CC 8023E9EC 8C63C068 */ lw $v1, %lo(gBattleState)($v1) /* 16D2D0 8023E9F0 24020023 */ addiu $v0, $zero, 0x23 /* 16D2D4 8023E9F4 1062001B */ beq $v1, $v0, .L8023EA64 /* 16D2D8 8023E9F8 00000000 */ nop diff --git a/asm/nonmatchings/code_181810/ActorSpeak.s b/asm/nonmatchings/code_181810/ActorSpeak.s index 3ce3f4d62b..4b7235830f 100644 --- a/asm/nonmatchings/code_181810/ActorSpeak.s +++ b/asm/nonmatchings/code_181810/ActorSpeak.s @@ -30,13 +30,13 @@ glabel ActorSpeak /* 181874 80252F94 0260202D */ daddu $a0, $s3, $zero /* 181878 80252F98 0C0B1EAF */ jal get_variable /* 18187C 80252F9C 0040A02D */ daddu $s4, $v0, $zero -/* 181880 80252FA0 3C01802A */ lui $at, 0x802a -/* 181884 80252FA4 AC22FA6C */ sw $v0, -0x594($at) +/* 181880 80252FA0 3C01802A */ lui $at, %hi(gSpeakingActorTalkAnim) +/* 181884 80252FA4 AC22FA6C */ sw $v0, %lo(gSpeakingActorTalkAnim)($at) /* 181888 80252FA8 8E250000 */ lw $a1, ($s1) /* 18188C 80252FAC 0C0B1EAF */ jal get_variable /* 181890 80252FB0 0260202D */ daddu $a0, $s3, $zero -/* 181894 80252FB4 3C01802A */ lui $at, 0x802a -/* 181898 80252FB8 AC22FA70 */ sw $v0, -0x590($at) +/* 181894 80252FB4 3C01802A */ lui $at, %hi(gSpeakingActorIdleAnim) +/* 181898 80252FB8 AC22FA70 */ sw $v0, %lo(gSpeakingActorIdleAnim)($at) /* 18189C 80252FBC 2402FF81 */ addiu $v0, $zero, -0x7f /* 1818A0 80252FC0 16420002 */ bne $s2, $v0, .L80252FCC /* 1818A4 80252FC4 00000000 */ nop @@ -52,8 +52,8 @@ glabel ActorSpeak /* 1818C8 80252FE8 86230150 */ lh $v1, 0x150($s1) /* 1818CC 80252FEC C6200144 */ lwc1 $f0, 0x144($s1) /* 1818D0 80252FF0 8E220000 */ lw $v0, ($s1) -/* 1818D4 80252FF4 3C01802A */ lui $at, 0x802a -/* 1818D8 80252FF8 AC31FA74 */ sw $s1, -0x58c($at) +/* 1818D4 80252FF4 3C01802A */ lui $at, %hi(gSpeakingActor) +/* 1818D8 80252FF8 AC31FA74 */ sw $s1, %lo(gSpeakingActor)($at) /* 1818DC 80252FFC 3C01802A */ lui $at, 0x802a /* 1818E0 80253000 AC32FA78 */ sw $s2, -0x588($at) /* 1818E4 80253004 44831000 */ mtc1 $v1, $f2 @@ -106,23 +106,23 @@ glabel ActorSpeak /* 181998 802530B8 0C00B94E */ jal get_screen_coords /* 18199C 802530BC AFA20018 */ sw $v0, 0x18($sp) /* 1819A0 802530C0 0200202D */ daddu $a0, $s0, $zero -/* 1819A4 802530C4 3C05802A */ lui $a1, 0x802a -/* 1819A8 802530C8 24A5FA68 */ addiu $a1, $a1, -0x598 +/* 1819A4 802530C4 3C05802A */ lui $a1, %hi(gSpeakingActorPrintIsDone) +/* 1819A8 802530C8 24A5FA68 */ addiu $a1, $a1, %lo(gSpeakingActorPrintIsDone) /* 1819AC 802530CC 0C049640 */ jal load_string /* 1819B0 802530D0 ACA00000 */ sw $zero, ($a1) /* 1819B4 802530D4 8FA50020 */ lw $a1, 0x20($sp) /* 1819B8 802530D8 8FA60024 */ lw $a2, 0x24($sp) /* 1819BC 802530DC 0040202D */ daddu $a0, $v0, $zero -/* 1819C0 802530E0 3C01802A */ lui $at, 0x802a -/* 1819C4 802530E4 AC24FA60 */ sw $a0, -0x5a0($at) +/* 1819C0 802530E0 3C01802A */ lui $at, %hi(gSpeakingActorPrintCtx) +/* 1819C4 802530E4 AC24FA60 */ sw $a0, %lo(gSpeakingActorPrintCtx)($at) /* 1819C8 802530E8 0C0496AE */ jal clamp_printer_coords /* 1819CC 802530EC 00000000 */ nop /* 1819D0 802530F0 3C03800A */ lui $v1, %hi(D_8009A650) /* 1819D4 802530F4 2463A650 */ addiu $v1, $v1, %lo(D_8009A650) /* 1819D8 802530F8 AE600070 */ sw $zero, 0x70($s3) /* 1819DC 802530FC 8C620000 */ lw $v0, ($v1) -/* 1819E0 80253100 3C06802A */ lui $a2, 0x802a -/* 1819E4 80253104 8CC6FA6C */ lw $a2, -0x594($a2) +/* 1819E0 80253100 3C06802A */ lui $a2, %hi(gSpeakingActorTalkAnim) +/* 1819E4 80253104 8CC6FA6C */ lw $a2, %lo(gSpeakingActorTalkAnim)($a2) /* 1819E8 80253108 34420010 */ ori $v0, $v0, 0x10 /* 1819EC 8025310C 04C00004 */ bltz $a2, .L80253120 /* 1819F0 80253110 AC620000 */ sw $v0, ($v1) @@ -136,8 +136,8 @@ glabel ActorSpeak /* 181A08 80253128 8E620070 */ lw $v0, 0x70($s3) /* 181A0C 8025312C 14400060 */ bnez $v0, .L802532B0 /* 181A10 80253130 0000102D */ daddu $v0, $zero, $zero -/* 181A14 80253134 3C11802A */ lui $s1, 0x802a -/* 181A18 80253138 8E31FA74 */ lw $s1, -0x58c($s1) +/* 181A14 80253134 3C11802A */ lui $s1, %hi(gSpeakingActor) +/* 181A18 80253138 8E31FA74 */ lw $s1, %lo(gSpeakingActor)($s1) /* 181A1C 8025313C 3C12802A */ lui $s2, 0x802a /* 181A20 80253140 8E52FA78 */ lw $s2, -0x588($s2) /* 181A24 80253144 86220150 */ lh $v0, 0x150($s1) @@ -192,8 +192,8 @@ glabel ActorSpeak /* 181AE0 80253200 27A20028 */ addiu $v0, $sp, 0x28 /* 181AE4 80253204 0C00B94E */ jal get_screen_coords /* 181AE8 80253208 AFA20018 */ sw $v0, 0x18($sp) -/* 181AEC 8025320C 3C10802A */ lui $s0, 0x802a -/* 181AF0 80253210 2610FA60 */ addiu $s0, $s0, -0x5a0 +/* 181AEC 8025320C 3C10802A */ lui $s0, %hi(gSpeakingActorPrintCtx) +/* 181AF0 80253210 2610FA60 */ addiu $s0, $s0, %lo(gSpeakingActorPrintCtx) /* 181AF4 80253214 8E040000 */ lw $a0, ($s0) /* 181AF8 80253218 8FA50020 */ lw $a1, 0x20($sp) /* 181AFC 8025321C 0C0496AE */ jal clamp_printer_coords @@ -210,21 +210,21 @@ glabel ActorSpeak .L80253248: /* 181B28 80253248 10400005 */ beqz $v0, .L80253260 /* 181B2C 8025324C 00000000 */ nop -/* 181B30 80253250 3C06802A */ lui $a2, 0x802a -/* 181B34 80253254 8CC6FA6C */ lw $a2, -0x594($a2) +/* 181B30 80253250 3C06802A */ lui $a2, %hi(gSpeakingActorTalkAnim) +/* 181B34 80253254 8CC6FA6C */ lw $a2, %lo(gSpeakingActorTalkAnim)($a2) /* 181B38 80253258 08094C9A */ j .L80253268 /* 181B3C 8025325C 00000000 */ nop .L80253260: -/* 181B40 80253260 3C06802A */ lui $a2, 0x802a -/* 181B44 80253264 8CC6FA70 */ lw $a2, -0x590($a2) +/* 181B40 80253260 3C06802A */ lui $a2, %hi(gSpeakingActorIdleAnim) +/* 181B44 80253264 8CC6FA70 */ lw $a2, %lo(gSpeakingActorIdleAnim)($a2) .L80253268: /* 181B48 80253268 04C00003 */ bltz $a2, .L80253278 /* 181B4C 8025326C 0220202D */ daddu $a0, $s1, $zero /* 181B50 80253270 0C098F82 */ jal func_80263E08 /* 181B54 80253274 0240282D */ daddu $a1, $s2, $zero .L80253278: -/* 181B58 80253278 3C03802A */ lui $v1, 0x802a -/* 181B5C 8025327C 8C63FA68 */ lw $v1, -0x598($v1) +/* 181B58 80253278 3C03802A */ lui $v1, %hi(gSpeakingActorPrintIsDone) +/* 181B5C 8025327C 8C63FA68 */ lw $v1, %lo(gSpeakingActorPrintIsDone)($v1) /* 181B60 80253280 24020001 */ addiu $v0, $zero, 1 /* 181B64 80253284 1462000A */ bne $v1, $v0, .L802532B0 /* 181B68 80253288 0000102D */ daddu $v0, $zero, $zero diff --git a/asm/nonmatchings/code_181810/EndActorSpeech.s b/asm/nonmatchings/code_181810/EndActorSpeech.s index 6e5da8ba30..4a2ec08a22 100644 --- a/asm/nonmatchings/code_181810/EndActorSpeech.s +++ b/asm/nonmatchings/code_181810/EndActorSpeech.s @@ -24,13 +24,13 @@ glabel EndActorSpeech /* 181BFC 8025331C 0240202D */ daddu $a0, $s2, $zero /* 181C00 80253320 0C0B1EAF */ jal get_variable /* 181C04 80253324 0040982D */ daddu $s3, $v0, $zero -/* 181C08 80253328 3C01802A */ lui $at, 0x802a -/* 181C0C 8025332C AC22FA6C */ sw $v0, -0x594($at) +/* 181C08 80253328 3C01802A */ lui $at, %hi(gSpeakingActorTalkAnim) +/* 181C0C 8025332C AC22FA6C */ sw $v0, %lo(gSpeakingActorTalkAnim)($at) /* 181C10 80253330 8E050000 */ lw $a1, ($s0) /* 181C14 80253334 0C0B1EAF */ jal get_variable /* 181C18 80253338 0240202D */ daddu $a0, $s2, $zero -/* 181C1C 8025333C 3C01802A */ lui $at, 0x802a -/* 181C20 80253340 AC22FA70 */ sw $v0, -0x590($at) +/* 181C1C 8025333C 3C01802A */ lui $at, %hi(gSpeakingActorIdleAnim) +/* 181C20 80253340 AC22FA70 */ sw $v0, %lo(gSpeakingActorIdleAnim)($at) /* 181C24 80253344 2402FF81 */ addiu $v0, $zero, -0x7f /* 181C28 80253348 16220002 */ bne $s1, $v0, .L80253354 /* 181C2C 8025334C 00000000 */ nop @@ -42,10 +42,10 @@ glabel EndActorSpeech /* 181C40 80253360 0220202D */ daddu $a0, $s1, $zero /* 181C44 80253364 0C099117 */ jal get_actor_part /* 181C48 80253368 0260282D */ daddu $a1, $s3, $zero -/* 181C4C 8025336C 3C04802A */ lui $a0, 0x802a -/* 181C50 80253370 8C84FA60 */ lw $a0, -0x5a0($a0) -/* 181C54 80253374 3C01802A */ lui $at, 0x802a -/* 181C58 80253378 AC31FA74 */ sw $s1, -0x58c($at) +/* 181C4C 8025336C 3C04802A */ lui $a0, %hi(gSpeakingActorPrintCtx) +/* 181C50 80253370 8C84FA60 */ lw $a0, %lo(gSpeakingActorPrintCtx)($a0) +/* 181C54 80253374 3C01802A */ lui $at, %hi(gSpeakingActor) +/* 181C58 80253378 AC31FA74 */ sw $s1, %lo(gSpeakingActor)($at) /* 181C5C 8025337C 3C01802A */ lui $at, 0x802a /* 181C60 80253380 AC22FA78 */ sw $v0, -0x588($at) /* 181C64 80253384 0C04971C */ jal close_message @@ -56,8 +56,8 @@ glabel EndActorSpeech /* 181C74 80253394 8E420070 */ lw $v0, 0x70($s2) /* 181C78 80253398 14400060 */ bnez $v0, .L8025351C /* 181C7C 8025339C 0000102D */ daddu $v0, $zero, $zero -/* 181C80 802533A0 3C11802A */ lui $s1, 0x802a -/* 181C84 802533A4 8E31FA74 */ lw $s1, -0x58c($s1) +/* 181C80 802533A0 3C11802A */ lui $s1, %hi(gSpeakingActor) +/* 181C84 802533A4 8E31FA74 */ lw $s1, %lo(gSpeakingActor)($s1) /* 181C88 802533A8 3C12802A */ lui $s2, 0x802a /* 181C8C 802533AC 8E52FA78 */ lw $s2, -0x588($s2) /* 181C90 802533B0 86220150 */ lh $v0, 0x150($s1) @@ -112,8 +112,8 @@ glabel EndActorSpeech /* 181D4C 8025346C 27A20028 */ addiu $v0, $sp, 0x28 /* 181D50 80253470 0C00B94E */ jal get_screen_coords /* 181D54 80253474 AFA20018 */ sw $v0, 0x18($sp) -/* 181D58 80253478 3C10802A */ lui $s0, 0x802a -/* 181D5C 8025347C 2610FA60 */ addiu $s0, $s0, -0x5a0 +/* 181D58 80253478 3C10802A */ lui $s0, %hi(gSpeakingActorPrintCtx) +/* 181D5C 8025347C 2610FA60 */ addiu $s0, $s0, %lo(gSpeakingActorPrintCtx) /* 181D60 80253480 8E040000 */ lw $a0, ($s0) /* 181D64 80253484 8FA50020 */ lw $a1, 0x20($sp) /* 181D68 80253488 0C0496AE */ jal clamp_printer_coords @@ -130,21 +130,21 @@ glabel EndActorSpeech .L802534B4: /* 181D94 802534B4 10400005 */ beqz $v0, .L802534CC /* 181D98 802534B8 00000000 */ nop -/* 181D9C 802534BC 3C06802A */ lui $a2, 0x802a -/* 181DA0 802534C0 8CC6FA6C */ lw $a2, -0x594($a2) +/* 181D9C 802534BC 3C06802A */ lui $a2, %hi(gSpeakingActorTalkAnim) +/* 181DA0 802534C0 8CC6FA6C */ lw $a2, %lo(gSpeakingActorTalkAnim)($a2) /* 181DA4 802534C4 08094D35 */ j .L802534D4 /* 181DA8 802534C8 00000000 */ nop .L802534CC: -/* 181DAC 802534CC 3C06802A */ lui $a2, 0x802a -/* 181DB0 802534D0 8CC6FA70 */ lw $a2, -0x590($a2) +/* 181DAC 802534CC 3C06802A */ lui $a2, %hi(gSpeakingActorIdleAnim) +/* 181DB0 802534D0 8CC6FA70 */ lw $a2, %lo(gSpeakingActorIdleAnim)($a2) .L802534D4: /* 181DB4 802534D4 04C00003 */ bltz $a2, .L802534E4 /* 181DB8 802534D8 0220202D */ daddu $a0, $s1, $zero /* 181DBC 802534DC 0C098F82 */ jal func_80263E08 /* 181DC0 802534E0 0240282D */ daddu $a1, $s2, $zero .L802534E4: -/* 181DC4 802534E4 3C03802A */ lui $v1, 0x802a -/* 181DC8 802534E8 8C63FA68 */ lw $v1, -0x598($v1) +/* 181DC4 802534E4 3C03802A */ lui $v1, %hi(gSpeakingActorPrintIsDone) +/* 181DC8 802534E8 8C63FA68 */ lw $v1, %lo(gSpeakingActorPrintIsDone)($v1) /* 181DCC 802534EC 24020001 */ addiu $v0, $zero, 1 /* 181DD0 802534F0 1462000A */ bne $v1, $v0, .L8025351C /* 181DD4 802534F4 0000102D */ daddu $v0, $zero, $zero diff --git a/asm/nonmatchings/code_181810/LoadBattleDmaData.s b/asm/nonmatchings/code_181810/LoadBattleDmaData.s index b16584cf76..8e549b9480 100644 --- a/asm/nonmatchings/code_181810/LoadBattleDmaData.s +++ b/asm/nonmatchings/code_181810/LoadBattleDmaData.s @@ -19,8 +19,8 @@ glabel LoadBattleDmaData /* 181F3C 8025365C 00431021 */ addu $v0, $v0, $v1 /* 181F40 80253660 5040000E */ beql $v0, $zero, .L8025369C /* 181F44 80253664 24020002 */ addiu $v0, $zero, 2 -/* 181F48 80253668 3C068028 */ lui $a2, 0x8028 -/* 181F4C 8025366C 8CC64000 */ lw $a2, 0x4000($a2) +/* 181F48 80253668 3C068028 */ lui $a2, %hi(gBattleDmaDest) +/* 181F4C 8025366C 8CC64000 */ lw $a2, %lo(gBattleDmaDest)($a2) /* 181F50 80253670 14C00005 */ bnez $a2, .L80253688 /* 181F54 80253674 00000000 */ nop /* 181F58 80253678 8C440000 */ lw $a0, ($v0) diff --git a/asm/nonmatchings/code_181810/ShowBattleChoice.s b/asm/nonmatchings/code_181810/ShowBattleChoice.s index 70c4b30185..98bca31fee 100644 --- a/asm/nonmatchings/code_181810/ShowBattleChoice.s +++ b/asm/nonmatchings/code_181810/ShowBattleChoice.s @@ -23,8 +23,8 @@ glabel ShowBattleChoice /* 181E5C 8025357C 0000102D */ daddu $v0, $zero, $zero /* 181E60 80253580 3C02802A */ lui $v0, 0x802a /* 181E64 80253584 8C42FA64 */ lw $v0, -0x59c($v0) -/* 181E68 80253588 3C04802A */ lui $a0, 0x802a -/* 181E6C 8025358C 8C84FA60 */ lw $a0, -0x5a0($a0) +/* 181E68 80253588 3C04802A */ lui $a0, %hi(gSpeakingActorPrintCtx) +/* 181E6C 8025358C 8C84FA60 */ lw $a0, %lo(gSpeakingActorPrintCtx)($a0) /* 181E70 80253590 904304E8 */ lbu $v1, 0x4e8($v0) /* 181E74 80253594 24020001 */ addiu $v0, $zero, 1 /* 181E78 80253598 A08304E8 */ sb $v1, 0x4e8($a0) diff --git a/asm/nonmatchings/code_18F340/func_8026127C.s b/asm/nonmatchings/code_18F340/func_8026127C.s index 3896485a55..975765ae23 100644 --- a/asm/nonmatchings/code_18F340/func_8026127C.s +++ b/asm/nonmatchings/code_18F340/func_8026127C.s @@ -15,8 +15,8 @@ glabel func_8026127C /* 18FB84 802612A4 AFBF0018 */ sw $ra, 0x18($sp) /* 18FB88 802612A8 AFB10014 */ sw $s1, 0x14($sp) /* 18FB8C 802612AC A2000099 */ sb $zero, 0x99($s0) -/* 18FB90 802612B0 3C01800E */ lui $at, 0x800e -/* 18FB94 802612B4 AC22C068 */ sw $v0, -0x3f98($at) +/* 18FB90 802612B0 3C01800E */ lui $at, %hi(gBattleState) +/* 18FB94 802612B4 AC22C068 */ sw $v0, %lo(gBattleState)($at) /* 18FB98 802612B8 8E020000 */ lw $v0, ($s0) /* 18FB9C 802612BC 3C118011 */ lui $s1, %hi(gPlayerData) /* 18FBA0 802612C0 2631F290 */ addiu $s1, $s1, %lo(gPlayerData) diff --git a/asm/nonmatchings/code_190B20/func_80263464.s b/asm/nonmatchings/code_190B20/func_80263464.s index fa0d7781a9..574798d6fd 100644 --- a/asm/nonmatchings/code_190B20/func_80263464.s +++ b/asm/nonmatchings/code_190B20/func_80263464.s @@ -7,8 +7,8 @@ glabel func_80263464 /* 191D4C 8026346C 27BDFFE8 */ addiu $sp, $sp, -0x18 /* 191D50 80263470 1C40000D */ bgtz $v0, .L802634A8 /* 191D54 80263474 AFBF0010 */ sw $ra, 0x10($sp) -/* 191D58 80263478 3C02800E */ lui $v0, 0x800e -/* 191D5C 8026347C 8C42C068 */ lw $v0, -0x3f98($v0) +/* 191D58 80263478 3C02800E */ lui $v0, %hi(gBattleState) +/* 191D5C 8026347C 8C42C068 */ lw $v0, %lo(gBattleState)($v0) /* 191D60 80263480 3C03800E */ lui $v1, 0x800e /* 191D64 80263484 8C63C4DC */ lw $v1, -0x3b24($v1) /* 191D68 80263488 3C01800E */ lui $at, 0x800e diff --git a/asm/nonmatchings/code_197F40/func_8026E198.s b/asm/nonmatchings/code_197F40/func_8026E198.s index 55e77859c1..35733e152e 100644 --- a/asm/nonmatchings/code_197F40/func_8026E198.s +++ b/asm/nonmatchings/code_197F40/func_8026E198.s @@ -20,8 +20,8 @@ glabel func_8026E198 /* 19CAB0 8026E1D0 82030095 */ lb $v1, 0x95($s0) /* 19CAB4 8026E1D4 50600008 */ beql $v1, $zero, .L8026E1F8 /* 19CAB8 8026E1D8 24020002 */ addiu $v0, $zero, 2 -/* 19CABC 8026E1DC 3C02800E */ lui $v0, 0x800e -/* 19CAC0 8026E1E0 8C42C068 */ lw $v0, -0x3f98($v0) +/* 19CABC 8026E1DC 3C02800E */ lui $v0, %hi(gBattleState) +/* 19CAC0 8026E1E0 8C42C068 */ lw $v0, %lo(gBattleState)($v0) /* 19CAC4 8026E1E4 00431026 */ xor $v0, $v0, $v1 /* 19CAC8 8026E1E8 2C420001 */ sltiu $v0, $v0, 1 /* 19CACC 8026E1EC 0809B87E */ j .L8026E1F8 diff --git a/asm/nonmatchings/os/code_4ac90_len_3910/func_80072B30.s b/asm/nonmatchings/os/code_4ac90_len_3910/func_80072B30.s index f5f3b161fc..9f23aa6307 100644 --- a/asm/nonmatchings/os/code_4ac90_len_3910/func_80072B30.s +++ b/asm/nonmatchings/os/code_4ac90_len_3910/func_80072B30.s @@ -6,8 +6,8 @@ glabel func_80072B30 /* 4DF34 80072B34 8C42419C */ lw $v0, %lo(gGameStatusPtr)($v0) /* 4DF38 80072B38 A04000AA */ sb $zero, 0xaa($v0) /* 4DF3C 80072B3C 24020001 */ addiu $v0, $zero, 1 -/* 4DF40 80072B40 3C01800E */ lui $at, 0x800e -/* 4DF44 80072B44 AC20C068 */ sw $zero, -0x3f98($at) +/* 4DF40 80072B40 3C01800E */ lui $at, %hi(gBattleState) +/* 4DF44 80072B44 AC20C068 */ sw $zero, %lo(gBattleState)($at) /* 4DF48 80072B48 3C01800E */ lui $at, 0x800e /* 4DF4C 80072B4C AC22C4E0 */ sw $v0, -0x3b20($at) /* 4DF50 80072B50 3C01800E */ lui $at, 0x800e diff --git a/asm/nonmatchings/os/code_4ac90_len_3910/load_battle.s b/asm/nonmatchings/os/code_4ac90_len_3910/load_battle.s index 076b5ac9a4..5c5d3e18f9 100644 --- a/asm/nonmatchings/os/code_4ac90_len_3910/load_battle.s +++ b/asm/nonmatchings/os/code_4ac90_len_3910/load_battle.s @@ -9,8 +9,8 @@ glabel load_battle /* 4E0A0 80072CA0 0C00CD3C */ jal set_game_mode /* 4E0A4 80072CA4 24040008 */ addiu $a0, $zero, 8 /* 4E0A8 80072CA8 8FBF0010 */ lw $ra, 0x10($sp) -/* 4E0AC 80072CAC 3C01800E */ lui $at, 0x800e -/* 4E0B0 80072CB0 AC20C068 */ sw $zero, -0x3f98($at) +/* 4E0AC 80072CAC 3C01800E */ lui $at, %hi(gBattleState) +/* 4E0B0 80072CB0 AC20C068 */ sw $zero, %lo(gBattleState)($at) /* 4E0B4 80072CB4 3C01800E */ lui $at, 0x800e /* 4E0B8 80072CB8 AC20C4D0 */ sw $zero, -0x3b30($at) /* 4E0BC 80072CBC 3C01800E */ lui $at, 0x800e diff --git a/tools/Makefile b/tools/Makefile new file mode 100644 index 0000000000..35893a733c --- /dev/null +++ b/tools/Makefile @@ -0,0 +1,9 @@ +default: all + +all: Yay0compress + +Yay0compress: + gcc Yay0compress.c -o Yay0compress + +clean: + rm -f Yay0compress diff --git a/tools/Yay0compress b/tools/Yay0compress new file mode 100755 index 0000000000000000000000000000000000000000..a3ffcb67ab9a8bb0418a54319d630dbeb45adaff GIT binary patch literal 21968 zcmeHP4Rlo1oxd~T2`FSnN-ToP*y0vHhyekKh$g_pmu`R*iPcpclbH$0Az#i%1q%X> zP+p&DST{{wHr9 znYO39XV30Ab79{9{(t|Ed+-0=cjvyFd3UQ>yTb4D2~H*A79qJQ3aQe9;40P-qDm|h zlX0CXt`HXh9*0kr7JKP&zY;K=p!G^X$!;2D#-NueSTN-p5+%DrY0*R_VJd=(Cp&|( zn)lL_#+kA_S6+qkBRq7UZXZ*(9mS?@iL$F(nNPd5-6B~j$aMJxlihvV?mlhDbVvt+ zDaVsyLZ3xCo?aS)j8aHmh49+lsqMUUxz=Y&Wl*~Ptz`7CDX&i3C3PInqsqNVYRct( z26hyezclG^iZ!~tLjAz~##Dz_T;JN#xN!dUt;o&*v6KmXzJ*UwTq@?thH5y!--@=WJ5U8 zydm7w(9$a6v4+;xj);gT(v*nBHi)LqR5Bu(BCQ>Xm}payL^2wS$3@cv@s?yvG{G(k zy?9G|vI$-z8ymt+E$t1hEf2=PQbnkwcrx79(9$k$tF2kOEIhA#el9n!e1QnptX&y~ z*Vy`&L^2j%yK-4;M|*5-Lt`uXSl`ysu6=}+>X?c$1b*Bne%vpL(v|L<(SM5b0r5e? z^TE`XmdSLNJ)yDG^cH+$_{BG+Pt4bPzUBD#>rTDXgFmV937-C7{y5z*NOaFq`JDP) z_;?0EGcKI&O-@5D+&#WVTsX}IoOpcDyhQT@r)I5BWxD5=P8ZH|7ujrd;WSTi+UCOf ztBYj2T)2Cl-tEFUrlh~eh3l_ug2j_A{6dMS%XeJ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ro3OF#Zs5^L_diSZ4IzJKPNH`LFP`m zc~ygWCneARPRzrUn9fpc?#kao4AdawE}x$}nTA+VQ?LDJf#Wrz4z54%!!Vt#?eum; zZr_I8HXuWLFl^7yu}nuOxJXn-%5wX8zoZ2iHJR=Cd6y~g^FT!=?T%S-KXSB(!uI@J z%=8+q$@OPFrVl|*dos-P^D|SuJUXxbT!AiRD5h-B&)H0QpNPx%w*Mcs{Zj3apU0W< zJ{8$h%)Itr2Szbr|5zfZq^b7_)7$@F_1K5B9n&H0j)}*;P|t6pWBW6%2;Im(Kfddq*!W6%2@OpkbO7;pJ+!Ja~-r=8sX2%kUb)n}gR8Q2C~_PmdB zC*Crr#CnPwG8N6AFe;oza-|mD@}FntWk8UN66)}F5Rvk6)E~{t +#include +#include + +int main(int argc, const char **argv, const char **envp); +void encode(); +void search(unsigned int a1, int a2, int *a3, unsigned int *a4); +int mischarsearch(unsigned char *a1, int a2, unsigned char *a3, int a4); +void initskip(unsigned char *a1, int a2); +void writeshort(short a1); +void writeint4(int a1); + +unsigned short skip[256]; // idb +int cp; // weak +int ndp; // weak +FILE *fp; // idb +unsigned char *def; +unsigned short *pol; +int pp; // weak +int insize; // idb +int ncp; // weak +int npp; // weak +unsigned char *bz; +int dp; // idb +unsigned int *cmd; + +int main(int argc, const char **argv, const char **envp) +{ + char src[999]; + char dest[999]; + + + if (argc < 3) + { + fprintf(stderr, "Yay0decompress [infile] [outfile]\n"); + return 1; + } + + strcpy(src, argv[1]); + strcpy(dest, argv[2]); + + if ((fp = fopen(src, "rb")) == NULL) + { + fprintf(stderr, "FILE OPEN ERROR![%s]\n", src); + return 1; + } + + fseek(fp, 0, SEEK_END); + insize = ftell(fp); + fseek(fp, 0, SEEK_SET); + + bz = malloc(insize); + fread(bz, 1, insize, fp); + fclose(fp); + + for (int i = 0; src[i]; i++) + { + if (src[i] == '.') + { + src[i] = 0; + break; + } + } + + if ((fp = fopen(dest, "wb")) == NULL) + { + fprintf(stderr, "FILE CREATE ERROR![%s]\n", dest); + exit(1); + } + + encode(); + + fprintf(fp, "Yay0"); + + writeint4(insize); + + writeint4(4 * cp + 16); + writeint4(2 * pp + 4 * cp + 16); + + for (int i = 0; i < cp; i++) + writeint4(cmd[i]); + + for (int i = 0; i < pp; i++) + writeshort(pol[i]); + + fwrite(def, 1u, dp, fp); + fclose(fp); + + return 0; +} + +void encode() +{ + unsigned int v0; // esi + unsigned int v1; // edi + int v2; // edx + int v3; // ebx + int v4; // edx + char v5; // [esp+Ch] [ebp-18h] + unsigned int v6; // [esp+10h] [ebp-14h] + unsigned int v7; // [esp+14h] [ebp-10h] + int v8; // [esp+18h] [ebp-Ch] + unsigned int a4; // [esp+1Ch] [ebp-8h] + int a3; // [esp+20h] [ebp-4h] + + dp = 0; + pp = 0; + cp = 0; + npp = 4096; + ndp = 4096; + ncp = 4096; + cmd = calloc(0x4000u, 1u); + pol = malloc(2 * npp); + def = malloc(4 * ndp); + v0 = 0; + v6 = 1024; + v1 = 2147483648; + while ( insize > v0 ) + { + if ( v6 < v0 ) + v6 += 1024; + search(v0, insize, &a3, &a4); + if ( a4 <= 2 ) + { + cmd[cp] |= v1; + def[dp++] = bz[v0++]; + if ( ndp == dp ) + { + ndp = dp + 4096; + def = realloc(def, dp + 4096); + } + } + else + { + search(v0 + 1, insize, &v8, &v7); + if ( v7 > a4 + 1 ) + { + cmd[cp] |= v1; + def[dp++] = bz[v0++]; + if ( ndp == dp ) + { + ndp = dp + 4096; + def = realloc(def, dp + 4096); + } + v1 >>= 1; + if ( !v1 ) + { + v1 = 2147483648; + v2 = cp++; + if ( cp == ncp ) + { + ncp = v2 + 1025; + cmd = realloc(cmd, 4 * (v2 + 1025)); + } + cmd[cp] = 0; + } + a4 = v7; + a3 = v8; + } + v3 = v0 - a3 - 1; + a3 = v0 - a3 - 1; + v5 = a4; + if ( a4 > 0x11 ) + { + pol[pp++] = v3; + def[dp++] = v5 - 18; + if ( ndp == dp ) + { + ndp = dp + 4096; + def = realloc(def, dp + 4096); + } + } + else + { + pol[pp++] = v3 | (((short)a4 - 2) << 12); + } + if ( npp == pp ) + { + npp = pp + 4096; + pol = realloc(pol, 2 * (pp + 4096)); + } + v0 += a4; + } + v1 >>= 1; + if ( !v1 ) + { + v1 = 2147483648; + v4 = cp++; + if ( cp == ncp ) + { + ncp = v4 + 1025; + cmd = realloc(cmd, 4 * (v4 + 1025)); + } + cmd[cp] = 0; + } + } + if ( v1 != 0x80000000 ) + ++cp; + fprintf(stderr, "IN=%d OUT=%d\n", insize, dp + 2 * pp + 4 * cp + 16); +} + +void search(unsigned int a1, int a2, int *a3, unsigned int *a4) +{ + unsigned int v4; // ebx + unsigned int v5; // esi + unsigned int *v6; // edi + unsigned int v7; // [esp+Ch] [ebp-10h] + int v8; // [esp+14h] [ebp-8h] + unsigned int v9; // [esp+18h] [ebp-4h] + + v4 = 3; + v5 = 0; + if ( a1 > 0x1000 ) + v5 = a1 - 4096; + v9 = 273; + if ( a2 - a1 <= 0x111 ) + v9 = a2 - a1; + if ( v9 > 2 ) + { + while ( a1 > v5 ) + { + v7 = mischarsearch(&bz[a1], v4, &bz[v5], v4 + a1 - v5); + if ( v7 >= a1 - v5 ) + break; + for ( ; v9 > v4; ++v4 ) + { + if ( bz[v4 + v5 + v7] != bz[v4 + a1] ) + break; + } + if ( v9 == v4 ) + { + *a3 = v7 + v5; + goto LABEL_17; + } + v8 = v5 + v7; + ++v4; + v5 += v7 + 1; + } + *a3 = v8; + if ( v4 > 3 ) + { + --v4; +LABEL_17: + *a4 = v4; + return; + } + v6 = a4; + } + else + { + *a4 = 0; + v6 = a3; + } + *v6 = 0; +} + +int mischarsearch(unsigned char *pattern, int patternlen, unsigned char *data, int datalen) +{ + int result; // eax + int i; // ebx + int v6; // eax + int j; // ecx + + result = datalen; + if ( patternlen <= datalen ) + { + initskip(pattern, patternlen); + for ( i = patternlen - 1; ; i += v6 ) + { + if ( pattern[patternlen - 1] == data[i] ) + { + --i; + j = patternlen - 2; + if ( patternlen - 2 < 0 ) + return i + 1; + while ( pattern[j] == data[i] ) + { + --i; + if ( --j < 0 ) + return i + 1; + } + v6 = patternlen - j; + if ( skip[data[i]] > patternlen - j ) + v6 = skip[data[i]]; + } + else + { + v6 = skip[data[i]]; + } + } + } + return result; +} + +void initskip(unsigned char *pattern, int len) +{ + for (int i = 0; i < 256; i++) + skip[i] = len; + + for (int i = 0; i < len; i++) + skip[pattern[i]] = len - i - 1; +} + +void writeshort(short val) +{ + fputc((val & 0xff00) >> 8, fp); + fputc((val & 0x00ff) >> 0, fp); +} + +void writeint4(int val) +{ + fputc((val & 0x00ff000000) >> 24, fp); + fputc((val & 0x0000ff0000) >> 16, fp); + fputc((val & 0x000000ff00) >> 8, fp); + fputc((val & 0x00000000ff) >> 0, fp); +} diff --git a/tools/find_bogus_functions.py b/tools/find_bogus_functions.py deleted file mode 100755 index bc95fa5c5a..0000000000 --- a/tools/find_bogus_functions.py +++ /dev/null @@ -1,119 +0,0 @@ -#!/usr/bin/python3 - -import os -import re - -script_dir = os.path.dirname(os.path.realpath(__file__)) -asm_dir = script_dir + "/../asm/" - -js = set() -jals = set() -bs = set() -bals = set() - -debug = False - -renames = [] - - -def dprint(string): - if debug: - print(string) - - -def scan_file(path): - with open(path) as f: - file_lines = f.readlines() - - for line in file_lines: - line = line.strip() - if re.findall(r'\sj\s+.*', line): - target = line.split()[-1] - js.add(target) - if re.findall(r'\sjal\s+.*', line): - target = line.split()[-1] - jals.add(target) - if re.findall(r'\sb.*', line): - target = line.split()[-1] - bs.add(target) - if re.findall(r'\sbal\s+.*', line): - target = line.split()[-1] - bals.add(target) - - -def get_linked_flags(label): - return (label in js or label in bs), (label in jals or label in bals) - - -def process_file(path): - print("Processing " + path) - with open(path) as fi: - file_lines = fi.readlines() - - skip_next = False - to_delete = [] - for i, line in enumerate(file_lines): - if skip_next: - skip_next = False - continue - line = line.strip() - - if line.endswith(":") and not line.startswith(".L"): - func_preamble = line.startswith("func_") - label = line[:-1] - linked_to, linked_al_to = get_linked_flags(label) - - if func_preamble: - # func_12345689 - - # Delete redundant label below - # if file_lines[i + 1].strip() == ".L" + label[5:13] + ":": - # to_delete.append(i + 1) - # skip_next = True - - if linked_al_to: - # Seems to be legit. Do nothing for now - continue - elif linked_to: - # j / b 'd to, rename as label - renames.append((label, ".L" + label[5:])) - else: - # Not referenced by anything. Delete - to_delete.append(i) - - if len(to_delete) > 0: - print("\tDeleting " + str(len(to_delete)) + " lines...") - for i in reversed(to_delete): - del file_lines[i] - with open(path, "w") as fo: - fo.writelines(file_lines) - - -# Collect all branches and jumps -for root, dirs, files in os.walk(asm_dir): - for file in files: - if file.endswith(".s"): - scan_file(os.path.join(root, file)) - -print("Scanned all files") - -# Process files -for root, dirs, files in os.walk(asm_dir): - for file in files: - if file.endswith(".s") and "boot" not in file: - process_file(os.path.join(root, file)) - -if len(renames) > 0: - print("Renaming " + str(len(renames)) + " labels...") - for root, dirs, files in os.walk(asm_dir): - for file in files: - if file.endswith(".s"): - file_path = os.path.join(root, file) - with open(file_path) as f: - orig_file_text = f.read() - file_text = orig_file_text - for rename in renames: - file_text = file_text.replace(rename[0], rename[1]) - if file_text != orig_file_text: - with open(file_path, "w") as f: - f.write(file_text) diff --git a/tools/find_yay0_size b/tools/find_yay0_size deleted file mode 100755 index b37664af3f97694782293f89b66c8ddf71b0f125..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 17272 zcmeHOe{5UFeLsr+AtyE^J5Hk}PW|HAfW1Vt96O$!%rzc^8U&cJ4O=!Coi`MTkgY8h7nYM1DD4HFy1AHEq%DinH{<`EVuM(L@-m6p{D4iswbMXDC2dr=7nJm#S9~|!pyZgcheS!QR+?OC zbC?R%4$@mrELC>XDdiYb=9lZ!NEu0!{}-w9UodslN3kik+VaJHmGn6!f6k>xMbcYP zdJ9UA=`1;f#FXPnF`?fNlsz}?ASEQGBulC1XI7ZeoOj++U&?7%TYT~dT zRrS@1ON;WKscNp+9*>>ey=!|s+!~K1GQ+LIdv>?(-sM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*u90!q5g zrbDX8g!P!d4Te*n=iNg}pVw(_eJ;O;4B2A;PX%nwDW&i3Z>r0g-baBjC0=H+{*E$Y zXIS4!%VXCeJE;uH6C=RsI`-qo?dJO@z0YIcku4`}kDc|om|QOl()8RVB3b?iYzePR I!BrIh1>!&q(f|Me diff --git a/tools/find_yay0_size.c b/tools/find_yay0_size.c deleted file mode 100644 index ec1175cbf4..0000000000 --- a/tools/find_yay0_size.c +++ /dev/null @@ -1,168 +0,0 @@ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#define U32(s) ((uint32_t)(*(s) << 24 | *((s) + 1) << 16 | *((s) + 2) << 8 | *((s) + 3))) -#define ALIGN(n, s) ((n) + (s)-1) & ~((s)-1) - -#define ERROR_UNSUPPORTED -1 -#define ERROR_CORRUPTED -2 -#define ERROR_UNRECOGNIZED -3 -#define ERROR_MEMORY -4 -#define ERROR_BACKREFERENCE_TOO_DISTANT -5 -#define ERROR_OVERFLOW -6 - - -uint8_t yay0_magic[] = {0x59, 0x61, 0x79, 0x30}; - -typedef struct __attribute__ ((packed)) yay0_header -{ - uint8_t magic[4]; - uint32_t size; - uint32_t count_offset; - uint32_t data_offset; -} yay0_header_t; - -typedef struct -{ - uint8_t *control; - uint8_t *count; - uint8_t *data; - int64_t error; -} yay0_info; - -yay0_info *yay0_decompress(void* _in, void** _out, int64_t stop_after_size); - -size_t get_file_size(char *filename) -{ - struct stat file_stat; - if(stat(filename, &file_stat) < 0) - { - printf("Failed to get file size!\n"); - exit(1); - } - - return file_stat.st_size; -} - -int main(int argc, char **argv) -{ - if(argc < 2) - return 1; - FILE *rom_f = fopen(argv[1], "rb"); - if(!rom_f) - printf("Failed to open input file...\n"); - size_t romSize = get_file_size(argv[1]); - uint8_t *romData = malloc(romSize); - fread(romData, 1, romSize, rom_f); - - for(int i = 0; i < romSize - 4; i++) - { - if(!memcmp(yay0_magic, &romData[i], 4)) - { - yay0_header_t *header = (yay0_header_t *)&romData[i]; - size_t decomp_size = U32((uint8_t *)&header->size); - uint8_t *dest = NULL; - yay0_info *info = yay0_decompress(&romData[i], (void **)&dest, decomp_size); - free(dest); - uintptr_t start = (uintptr_t)i; - uintptr_t end = ((uintptr_t)info->data - (uintptr_t)&romData[i]) + i; - printf(" - [0x%X, 0x%0X, \"COMPRESSED.YAY\", \"yay_%x_len_%x\"]\n", start, ALIGN(end, 2), start, ALIGN(end, 2) - start); - } - } - free(romData); - fclose(rom_f); - - return 0; -} - -yay0_info *yay0_decompress(void* _in, void** _out, int64_t stop_after_size) -{ - yay0_info *info = malloc(sizeof(yay0_info)); - yay0_header_t* header = (yay0_header_t*)_in; - if (memcmp(yay0_magic, &header->magic[0], 4)) - { - info->error = ERROR_UNRECOGNIZED; - return info; - } - - uint32_t total_size = U32((uint8_t *)&header->size); - if (total_size == 0) { - return info; - } - if (stop_after_size && total_size > stop_after_size) { - total_size = stop_after_size; - } - - *_out = malloc(total_size); - if (!*_out) - { - info->error = ERROR_MEMORY; - return info; - } - - uint32_t count_offset = U32((uint8_t *)&header->count_offset); - uint32_t data_offset = U32((uint8_t *)&header->data_offset); - - info->control = (uint8_t*)(_in + sizeof(yay0_header_t)); - info->count = (uint8_t*)_in + count_offset; - info->data = (uint8_t*)_in + data_offset; - uint8_t* out_stream = (uint8_t*)*_out; - - uint32_t bytes_written = 0; - uint8_t control_bits_remaining = 0; - uint8_t control_byte; - - while (bytes_written < total_size) { - - if (control_bits_remaining == 0) { - control_byte = *(info->control++); - control_bits_remaining = 8; - } - - if ((control_byte & 0x80) != 0) { - out_stream[bytes_written] = *(info->data++); - bytes_written++; - - } else { - uint16_t nr = (*(info->count++) << 8); - nr |= *(info->count++); - uint16_t r = (nr & 0x0FFF) + 1; - uint16_t n = (nr & 0xF000) >> 12; - if (n == 0) - n = *(info->data++) + 0x12; // TODO is this really read from the data stream? (not the count stream?) - else - n += 2; - - if (r > bytes_written) - { - info->error = ERROR_BACKREFERENCE_TOO_DISTANT; - return info; - } - - if (bytes_written + n > total_size && stop_after_size == total_size) - { - info->error = ERROR_OVERFLOW; - return info; - } - - for (; n > 0; n--) - { - out_stream[bytes_written] = out_stream[bytes_written - r]; - bytes_written++; - } - } - - control_byte <<= 1; - control_bits_remaining--; - } - - return info; -} \ No newline at end of file diff --git a/tools/glabel.py b/tools/glabel.py deleted file mode 100755 index 5911b6404e..0000000000 --- a/tools/glabel.py +++ /dev/null @@ -1,22 +0,0 @@ -import os -import re - -def replace_func(match): - match = match.group() - - if match.startswith("."): - return match - return "glabel " + match[:-1] - -for root, dirs, files in os.walk("asm"): - for file in files: - for file in files: - if file.endswith(".s"): - with open(os.path.join(root, file)) as f: - old_file_text = f.read() - - new_file_text = re.sub(".*:", replace_func, old_file_text) - - if old_file_text != new_file_text: - with open(os.path.join(root, file), "w", newline="\n") as f: - f.write(new_file_text) diff --git a/tools/old/fix_asm.py b/tools/old/fix_asm.py deleted file mode 100755 index fb2b433b79..0000000000 --- a/tools/old/fix_asm.py +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/python3 - -import os -import re - -script_dir = os.path.dirname(os.path.realpath(__file__)) -asm_dir = script_dir + "/asm/" - - -def replace_move_daddu(match): - match = match.group() - match = re.sub("\\s+", " ", match) - match_split = match.split(" ") - ret = "daddu " + match_split[1] + " " + match_split[2] + ", $zero" - return ret - - -def replace_move_addu(match): - match = match.group() - match = re.sub("\\s+", " ", match) - match_split = match.split(" ") - ret = "addu " + match_split[1] + " " + match_split[2] + ", $zero" - return ret - - -def replace_move_or(match): - match = match.group() - match = re.sub("\\s+", " ", match) - match_split = match.split(" ") - ret = "or " + match_split[1] + " " + match_split[2] + ", $zero" - return ret - - -adds = ["4a140", "4a1b0"] -ors = ["4a360"] - -range_start = int("3bde0", 16) -range_end = int("48be0", 16) - -for root, dirs, files in os.walk(asm_dir): - for file in files: - if file.endswith(".s"): - dumb_split = file.split("_") - if len(dumb_split) > 2: - file_num = dumb_split[1] - try: - test = int(file_num, 16) - except ValueError: - file_num = "" - else: - file_num = "" - with open(os.path.join(root, file)) as f: - file_text_orig = f.read() - file_text = file_text_orig - - # Fix instructions - if file == "boot.s" or file_num in ors: - file_text = re.sub("move\\s+\\$.+,\\s\\$.+", replace_move_or, file_text) - elif file_num != "" and ((range_start <= int(file_num, 16) <= range_end) or file_num in adds): - file_text = re.sub("move\\s+\\$.+,\\s\\$.+", replace_move_addu, file_text) - else: - file_text = re.sub("move\\s+\\$.+,\\s\\$.+", replace_move_daddu, file_text) - - if file_text != file_text_orig: - with open(os.path.join(root, file), "w") as f: - f.write(file_text) diff --git a/tools/old/reg_convert.py b/tools/old/reg_convert.py deleted file mode 100755 index 94f58d2fa2..0000000000 --- a/tools/old/reg_convert.py +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/python3 -import fileinput -import os -import re - -script_dir = os.path.dirname(os.path.realpath(__file__)) -asm_dir = script_dir + "/asm/" - -regs = ["zero", "at", "v0", "v1", "a0", "a1", "a2", "a3", "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", "s0", - "s1", "s2", "s3", "s4", "s5", "s6", "s7", "t8", "t9", "k0", "k1", "gp", "sp", "fp", "ra"] - - -for line in fileinput.input(): - for reg in regs: - regex = re.compile("\\$" + reg) - line = re.sub(regex, "$" + str(regs.index(reg)), line) - print(line.rstrip()) diff --git a/tools/postprocess.py b/tools/postprocess.py deleted file mode 100755 index 491b89d2e2..0000000000 --- a/tools/postprocess.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/python3 -import fileinput -import os - -script_dir = os.path.dirname(os.path.realpath(__file__)) -asm_dir = script_dir + "/../asm/" - - -def tohex(val, nbits): - return hex((val + (1 << nbits)) % (1 << nbits)) - - -def gen_lui_addiu(line): - line = line.strip() - line_bits = line.split("\t")[1] - reg, addr = line_bits.split(",") - upper_addr = tohex(int(addr) >> 16, 16) - lower_addr = tohex(int(addr) & 0xFFFF, 16) - ret = "lui\t" + reg + "," + upper_addr + "\n" + \ - "addiu\t" + reg + ", $zero, " + lower_addr - return ret - - -def main(): - skip_next = False - for line in fileinput.input(): - line = line.strip() - if skip_next: - skip_next = False - continue - - # Don't print the line after this - if line == "#NO_APP": - skip_next = True - - # Transform la - if line.startswith("la\t"): - print(gen_lui_addiu(line)) - continue - - print(line) - - -if __name__ == '__main__': - main() diff --git a/tools/splat.yaml b/tools/splat.yaml index 8cbeeeac63..296b4bb128 100644 --- a/tools/splat.yaml +++ b/tools/splat.yaml @@ -516,253 +516,253 @@ segments: - [0xFAD8F0, "bin", "SMW_Remix_2F"] - [0xFADE70, "bin", "New_Partner_82"] # BGM end - [0xFAE860, "bin"] - - [0x19E09A8, "bin", "Yay0_19e09a8_len_1206"] - - [0x19E1390, "bin", "Yay0_19e1390_len_806"] - - [0x19E1888, "bin", "Yay0_19e1888_len_2324"] - - [0x19E2330, "bin", "Yay0_19e2330_len_cc0"] - - [0x19E2DE0, "bin", "Yay0_19e2de0_len_1206"] - - [0x19E3208, "bin", "Yay0_19e3208_len_9a6"] - - [0x19E3BA8, "bin", "Yay0_19e3ba8_len_456"] - - [0x19E3FD8, "bin", "Yay0_19e3fd8_len_4024"] - - [0x19E4828, "bin", "Yay0_19e4828_len_3c0"] - - [0x19E4BE0, "bin", "Yay0_19e4be0_len_1416"] - - [0x19E5758, "bin", "Yay0_19e5758_len_802"] - - [0x19E5950, "bin", "Yay0_19e5950_len_22a0"] - - [0x19E62A0, "bin", "Yay0_19e62a0_len_512"] + - [0x19E09A8, "Yay0"] + - [0x19E1390, "Yay0"] + - [0x19E1888, "Yay0"] + - [0x19E2330, "Yay0"] + - [0x19E2DE0, "Yay0"] + - [0x19E3208, "Yay0"] + - [0x19E3BA8, "Yay0"] + - [0x19E3FD8, "Yay0"] + - [0x19E4828, "Yay0"] + - [0x19E4BE0, "Yay0"] + - [0x19E5758, "Yay0"] + - [0x19E5950, "Yay0"] + - [0x19E62A0, "Yay0"] - [0x19E67B2, "bin"] - - [0x19E6B60, "bin", "Yay0_19e6b60_len_1406"] - - [0x19E7528, "bin", "Yay0_19e7528_len_8256"] - - [0x19E9778, "bin", "Yay0_19e9778_len_2800"] - - [0x19EAF38, "bin", "Yay0_19eaf38_len_40c0"] - - [0x19EC4E0, "bin", "Yay0_19ec4e0_len_1910"] - - [0x19EDD30, "bin", "Yay0_19edd30_len_2204"] - - [0x19EEB18, "bin", "Yay0_19eeb18_len_10062"] - - [0x19F0070, "bin", "Yay0_19f0070_len_158c"] - - [0x19F15A0, "bin", "Yay0_19f15a0_len_2252"] - - [0x19F26D8, "bin", "Yay0_19f26d8_len_5102"] - - [0x19F5390, "bin", "Yay0_19f5390_len_2002"] - - [0x19F7398, "bin", "Yay0_19f7398_len_8024"] - - [0x19FA128, "bin", "Yay0_19fa128_len_4ac6"] - - [0x19FCAE8, "bin", "Yay0_19fcae8_len_2502"] - - [0x19FED70, "bin", "Yay0_19fed70_len_200004"] - - [0x1A00958, "bin", "Yay0_1a00958_len_24a2"] - - [0x1A02D00, "bin", "Yay0_1a02d00_len_4000"] - - [0x1A04400, "bin", "Yay0_1a04400_len_114c"] - - [0x1A05550, "bin", "Yay0_1a05550_len_2280"] - - [0x1A06390, "bin", "Yay0_1a06390_len_c04"] - - [0x1A06F98, "bin", "Yay0_1a06f98_len_1066"] - - [0x1A07B68, "bin", "Yay0_1a07b68_len_8092"] - - [0x1A0A0A0, "bin", "Yay0_1a0a0a0_len_c46"] - - [0x1A0ACC8, "bin", "Yay0_1a0acc8_len_1300"] - - [0x1A0B780, "bin", "Yay0_1a0b780_len_85c"] - - [0x1A0BBE0, "bin", "Yay0_1a0bbe0_len_4000"] - - [0x1A0C000, "bin", "Yay0_1a0c000_len_438"] - - [0x1A0C438, "bin", "Yay0_1a0c438_len_842"] - - [0x1A0C860, "bin", "Yay0_1a0c860_len_1186"] - - [0x1A0D1E8, "bin", "Yay0_1a0d1e8_len_406"] - - [0x1A0D5B0, "bin", "Yay0_1a0d5b0_len_840"] - - [0x1A0D970, "bin", "Yay0_1a0d970_len_268e"] - - [0x1A0EF00, "bin", "Yay0_1a0ef00_len_11020"] - - [0x1A13920, "bin", "Yay0_1a13920_len_404c"] - - [0x1A15850, "bin", "Yay0_1a15850_len_83a4"] - - [0x1A183F8, "bin", "Yay0_1a183f8_len_2404"] - - [0x1A1A608, "bin", "Yay0_1a1a608_len_41e2"] - - [0x1A1C5E8, "bin", "Yay0_1a1c5e8_len_1202"] - - [0x1A1D6D0, "bin", "Yay0_1a1d6d0_len_2028"] - - [0x1A1E478, "bin", "Yay0_1a1e478_len_1306"] - - [0x1A1F370, "bin", "Yay0_1a1f370_len_2048c"] - - [0x1A226B0, "bin", "Yay0_1a226b0_len_4908"] - - [0x1A249B8, "bin", "Yay0_1a249b8_len_1644"] - - [0x1A25E78, "bin", "Yay0_1a25e78_len_2186"] - - [0x1A27FF0, "bin", "Yay0_1a27ff0_len_800a"] - - [0x1A28BE0, "bin", "Yay0_1a28be0_len_1400"] - - [0x1A29680, "bin", "Yay0_1a29680_len_2862"] - - [0x1A2BC68, "bin", "Yay0_1a2bc68_len_4112"] - - [0x1A2E120, "bin", "Yay0_1a2e120_len_12d8"] - - [0x1A2F3F8, "bin", "Yay0_1a2f3f8_len_10c06"] - - [0x1A31D18, "bin", "Yay0_1a31d18_len_22a6"] - - [0x1A33AB0, "bin", "Yay0_1a33ab0_len_4106"] - - [0x1A35BB8, "bin", "Yay0_1a35bb8_len_2006"] - - [0x1A369A8, "bin", "Yay0_1a369a8_len_9600"] - - [0x1A39600, "bin", "Yay0_1a39600_len_2014"] - - [0x1A3B018, "bin", "Yay0_1a3b018_len_4300"] - - [0x1A3C310, "bin", "Yay0_1a3c310_len_3cc2"] - - [0x1A3FCC8, "bin", "Yay0_1a3fcc8_len_40314"] - - [0x1A423D8, "bin", "Yay0_1a423d8_len_4822"] - - [0x1A449C0, "bin", "Yay0_1a449c0_len_2422"] - - [0x1A46568, "bin", "Yay0_1a46568_len_9212"] - - [0x1A49340, "bin", "Yay0_1a49340_len_2c88"] - - [0x1A4AC88, "bin", "Yay0_1a4ac88_len_5362"] - - [0x1A4D7E8, "bin", "Yay0_1a4d7e8_len_2006"] - - [0x1A4E028, "bin", "Yay0_1a4e028_len_1a56"] - - [0x1A4FA60, "bin", "Yay0_1a4fa60_len_10190"] - - [0x1A531D0, "bin", "Yay0_1a531d0_len_c08"] - - [0x1A53D48, "bin", "Yay0_1a53d48_len_4032"] - - [0x1A56C80, "bin", "Yay0_1a56c80_len_8358"] - - [0x1A58F58, "bin", "Yay0_1a58f58_len_20a4"] - - [0x1A5A5A8, "bin", "Yay0_1a5a5a8_len_20a14"] - - [0x1A62B40, "bin", "Yay0_1a62b40_len_40b6"] - - [0x1A641F8, "bin", "Yay0_1a641f8_len_2602"] - - [0x1A666F0, "bin", "Yay0_1a666f0_len_8800"] - - [0x1A68870, "bin", "Yay0_1a68870_len_460a"] - - [0x1A6C630, "bin", "Yay0_1a6c630_len_118c"] - - [0x1A6D5A0, "bin", "Yay0_1a6d5a0_len_2a4c"] - - [0x1A6EF50, "bin", "Yay0_1a6ef50_len_100ae"] - - [0x1A70FF0, "bin", "Yay0_1a70ff0_len_4000"] - - [0x1A74FC0, "bin", "Yay0_1a74fc0_len_803a"] - - [0x1A78A40, "bin", "Yay0_1a78a40_len_1100"] - - [0x1A79900, "bin", "Yay0_1a79900_len_4698"] - - [0x1A7D798, "bin", "Yay0_1a7d798_len_2804"] - - [0x1A7EEA0, "bin", "Yay0_1a7eea0_len_158"] - - [0x1A7EFD8, "bin", "Yay0_1a7efd8_len_81002"] - - [0x1A83450, "bin", "Yay0_1a83450_len_4226"] - - [0x1A85668, "bin", "Yay0_1a85668_len_2910"] - - [0x1A87958, "bin", "Yay0_1a87958_len_8680"] - - [0x1A8BF98, "bin", "Yay0_1a8bf98_len_4020"] - - [0x1A8FE28, "bin", "Yay0_1a8fe28_len_10096"] - - [0x1A93EA0, "bin", "Yay0_1a93ea0_len_4102"] - - [0x1A94188, "bin", "Yay0_1a94188_len_476"] - - [0x1A94480, "bin", "Yay0_1a94480_len_226"] - - [0x1A946A8, "bin", "Yay0_1a946a8_len_956"] - - [0x1A94A00, "bin", "Yay0_1a94a00_len_456"] - - [0x1A94C58, "bin", "Yay0_1a94c58_len_8184"] - - [0x1A98D98, "bin", "Yay0_1a98d98_len_3264"] - - [0x1A9BA80, "bin", "Yay0_1a9ba80_len_4168"] - - [0x1A9DB68, "bin", "Yay0_1a9db68_len_20004"] - - [0x1AA0048, "bin", "Yay0_1aa0048_len_692"] - - [0x1AA0698, "bin", "Yay0_1aa0698_len_1000"] - - [0x1AA1008, "bin", "Yay0_1aa1008_len_6d54"] - - [0x1AA6D58, "bin", "Yay0_1aa6d58_len_90a4"] - - [0x1AAD600, "bin", "Yay0_1aad600_len_109f0"] - - [0x1AB1BF0, "bin", "Yay0_1ab1bf0_len_2004"] - - [0x1AB2368, "bin", "Yay0_1ab2368_len_8086"] - - [0x1ABA290, "bin", "Yay0_1aba290_len_41422"] - - [0x1AC14A8, "bin", "Yay0_1ac14a8_len_2902"] - - [0x1AC3910, "bin", "Yay0_1ac3910_len_8488"] - - [0x1ACBC98, "bin", "Yay0_1acbc98_len_4042"] - - [0x1ACE058, "bin", "Yay0_1ace058_len_1902"] - - [0x1ACF910, "bin", "Yay0_1acf910_len_106c8"] - - [0x1AD06D8, "bin", "Yay0_1ad06d8_len_904"] - - [0x1AD0B98, "bin", "Yay0_1ad0b98_len_1400"] - - [0x1AD1E90, "bin", "Yay0_1ad1e90_len_2146"] - - [0x1AD2348, "bin", "Yay0_1ad2348_len_4b2"] - - [0x1AD27F8, "bin", "Yay0_1ad27f8_len_800"] - - [0x1AD28A8, "bin", "Yay0_1ad28a8_len_4446"] - - [0x1AD44F0, "bin", "Yay0_1ad44f0_len_304"] - - [0x1AD4758, "bin", "Yay0_1ad4758_len_1080"] - - [0x1AD57C0, "bin", "Yay0_1ad57c0_len_880c"] - - [0x1AD9D50, "bin", "Yay0_1ad9d50_len_2082"] - - [0x1ADA498, "bin", "Yay0_1ada498_len_4b26"] - - [0x1ADCFC0, "bin", "Yay0_1adcfc0_len_22024"] - - [0x1AE2168, "bin", "Yay0_1ae2168_len_e96"] - - [0x1AE2EA0, "bin", "Yay0_1ae2ea0_len_4058"] - - [0x1AE6A58, "bin", "Yay0_1ae6a58_len_9524"] - - [0x1AEB778, "bin", "Yay0_1aeb778_len_14802"] - - [0x1AF4958, "bin", "Yay0_1af4958_len_8202"] - - [0x1AFCB18, "bin", "Yay0_1afcb18_len_3442"] - - [0x1AFF748, "bin", "Yay0_1aff748_len_100000"] - - [0x1B00640, "bin", "Yay0_1b00640_len_118a"] - - [0x1B01390, "bin", "Yay0_1b01390_len_c04"] - - [0x1B01C08, "bin", "Yay0_1b01c08_len_2120"] - - [0x1B02128, "bin", "Yay0_1b02128_len_844"] - - [0x1B02970, "bin", "Yay0_1b02970_len_1004"] - - [0x1B03118, "bin", "Yay0_1b03118_len_c04"] - - [0x1B03C18, "bin", "Yay0_1b03c18_len_41e2"] - - [0x1B045E8, "bin", "Yay0_1b045e8_len_a12"] - - [0x1B04FC0, "bin", "Yay0_1b04fc0_len_1012"] - - [0x1B05998, "bin", "Yay0_1b05998_len_2400"] - - [0x1B06C88, "bin", "Yay0_1b06c88_len_1046"] - - [0x1B07C48, "bin", "Yay0_1b07c48_len_8034"] - - [0x1B09440, "bin", "Yay0_1b09440_len_228e"] - - [0x1B0B290, "bin", "Yay0_1b0b290_len_90c"] - - [0x1B0B9A0, "bin", "Yay0_1b0b9a0_len_4448"] - - [0x1B0C548, "bin", "Yay0_1b0c548_len_ab4"] - - [0x1B0CAC0, "bin", "Yay0_1b0cac0_len_1130"] - - [0x1B0D130, "bin", "Yay0_1b0d130_len_2a4c"] - - [0x1B0EB80, "bin", "Yay0_1b0eb80_len_1043e"] - - [0x1B10CC0, "bin", "Yay0_1b10cc0_len_2120"] - - [0x1B129A0, "bin", "Yay0_1b129a0_len_1444"] - - [0x1B13548, "bin", "Yay0_1b13548_len_4016"] - - [0x1B16420, "bin", "Yay0_1b16420_len_1104"] - - [0x1B17128, "bin", "Yay0_1b17128_len_814"] - - [0x1B17840, "bin", "Yay0_1b17840_len_8316"] - - [0x1B19318, "bin", "Yay0_1b19318_len_2020"] - - [0x1B1A030, "bin", "Yay0_1b1a030_len_18c6"] - - [0x1B1B8C8, "bin", "Yay0_1b1b8c8_len_402"] - - [0x1B1BC88, "bin", "Yay0_1b1bc88_len_4316"] - - [0x1B1C7A0, "bin", "Yay0_1b1c7a0_len_808"] - - [0x1B1CD28, "bin", "Yay0_1b1cd28_len_21040"] - - [0x1B21C48, "bin", "Yay0_1b21c48_len_2290"] - - [0x1B23290, "bin", "Yay0_1b23290_len_414c"] - - [0x1B253E0, "bin", "Yay0_1b253e0_len_241c"] - - [0x1B26660, "bin", "Yay0_1b26660_len_8192"] - - [0x1B283F8, "bin", "Yay0_1b283f8_len_1c02"] - - [0x1B29C60, "bin", "Yay0_1b29c60_len_2284"] - - [0x1B2A688, "bin", "Yay0_1b2a688_len_1166"] - - [0x1B2B3E8, "bin", "Yay0_1b2b3e8_len_4810"] - - [0x1B2C8D8, "bin", "Yay0_1b2c8d8_len_1722"] - - [0x1B2D7B0, "bin", "Yay0_1b2d7b0_len_2006"] - - [0x1B2E328, "bin", "Yay0_1b2e328_len_c52"] - - [0x1B2ED60, "bin", "Yay0_1b2ed60_len_1218"] - - [0x1B2FA18, "bin", "Yay0_1b2fa18_len_10002"] - - [0x1B31A18, "bin", "Yay0_1b31a18_len_25e2"] - - [0x1B33000, "bin", "Yay0_1b33000_len_4096"] - - [0x1B34098, "bin", "Yay0_1b34098_len_920"] - - [0x1B34928, "bin", "Yay0_1b34928_len_2d4"] - - [0x1B34C00, "bin", "Yay0_1b34c00_len_107e"] - - [0x1B35480, "bin", "Yay0_1b35480_len_2040"] - - [0x1B36440, "bin", "Yay0_1b36440_len_8306"] - - [0x1B38748, "bin", "Yay0_1b38748_len_1894"] - - [0x1B39A98, "bin", "Yay0_1b39a98_len_2062"] - - [0x1B3A2E8, "bin", "Yay0_1b3a2e8_len_816"] - - [0x1B3A818, "bin", "Yay0_1b3a818_len_4482"] - - [0x1B3C488, "bin", "Yay0_1b3c488_len_a44"] - - [0x1B3CAC8, "bin", "Yay0_1b3cac8_len_1012"] - - [0x1B3D0A0, "bin", "Yay0_1b3d0a0_len_91a"] - - [0x1B3D920, "bin", "Yay0_1b3d920_len_205c"] - - [0x1B3F060, "bin", "Yay0_1b3f060_len_40008"] - - [0x1B40048, "bin", "Yay0_1b40048_len_714"] - - [0x1B40720, "bin", "Yay0_1b40720_len_904e"] - - [0x1B49570, "bin", "Yay0_1b49570_len_4288"] - - [0x1B4C3E8, "bin", "Yay0_1b4c3e8_len_1c12"] - - [0x1B4DEA0, "bin", "Yay0_1b4dea0_len_2116"] - - [0x1B4FD98, "bin", "Yay0_1b4fd98_len_10040"] - - [0x1B50CD8, "bin", "Yay0_1b50cd8_len_1302"] - - [0x1B51B08, "bin", "Yay0_1b51b08_len_4052"] - - [0x1B54258, "bin", "Yay0_1b54258_len_8082"] - - [0x1B580A0, "bin", "Yay0_1b580a0_len_2242"] - - [0x1B5A248, "bin", "Yay0_1b5a248_len_1980"] - - [0x1B5BB88, "bin", "Yay0_1b5bb88_len_4406"] - - [0x1B5CC90, "bin", "Yay0_1b5cc90_len_2168"] - - [0x1B5E968, "bin", "Yay0_1b5e968_len_482"] - - [0x1B5ED88, "bin", "Yay0_1b5ed88_len_20040"] - - [0x1B608C0, "bin", "Yay0_1b608c0_len_2534"] - - [0x1B625F8, "bin", "Yay0_1b625f8_len_1202"] - - [0x1B633D0, "bin", "Yay0_1b633d0_len_4824"] - - [0x1B64878, "bin", "Yay0_1b64878_len_1786"] - - [0x1B657E0, "bin", "Yay0_1b657e0_len_808"] - - [0x1B65A08, "bin", "Yay0_1b65a08_len_444"] - - [0x1B65E50, "bin", "Yay0_1b65e50_len_2024"] - - [0x1B66238, "bin", "Yay0_1b66238_len_9542"] - - [0x1B69580, "bin", "Yay0_1b69580_len_4218"] - - [0x1B6C318, "bin", "Yay0_1b6c318_len_1c80"] - - [0x1B6DD98, "bin", "Yay0_1b6dd98_len_2046"] - - [0x1B6F150, "bin", "Yay0_1b6f150_len_10608"] - - [0x1B71618, "bin", "Yay0_1b71618_len_2882"] - - [0x1B72890, "bin", "Yay0_1b72890_len_1302"] - - [0x1B73B08, "bin", "Yay0_1b73b08_len_44b0"] - - [0x1B747B8, "bin", "Yay0_1b747b8_len_2800"] - - [0x1B76E30, "bin", "Yay0_1b76e30_len_808a"] - - [0x1B78EC0, "bin", "Yay0_1b78ec0_len_101c"] - - [0x1B79A20, "bin", "Yay0_1b79a20_len_508"] - - [0x1B79F08, "bin", "Yay0_1b79f08_len_2004"] - - [0x1B7AA08, "bin", "Yay0_1b7aa08_len_1000"] - - [0x1B7B008, "bin", "Yay0_1b7b008_len_b44"] - - [0x1B7BB50, "bin", "Yay0_1b7bb50_len_4424"] - - [0x1B7EC68, "bin", "Yay0_1b7ec68_len_1300"] - - [0x1B7FF48, "bin", "Yay0_1b7ff48_len_80086"] - - [0x1B81E88, "bin", "Yay0_1b81e88_len_2050"] - - [0x1B82058, "bin", "Yay0_1b82058_len_202"] + - [0x19E6B60, "Yay0"] + - [0x19E7528, "Yay0"] + - [0x19E9778, "Yay0"] + - [0x19EAF38, "Yay0"] + - [0x19EC4E0, "Yay0"] + - [0x19EDD30, "Yay0"] + - [0x19EEB18, "Yay0"] + - [0x19F0070, "Yay0"] + - [0x19F15A0, "Yay0"] + - [0x19F26D8, "Yay0"] + - [0x19F5390, "Yay0"] + - [0x19F7398, "Yay0"] + - [0x19FA128, "Yay0"] + - [0x19FCAE8, "Yay0"] + - [0x19FED70, "Yay0"] + - [0x1A00958, "Yay0"] + - [0x1A02D00, "Yay0"] + - [0x1A04400, "Yay0"] + - [0x1A05550, "Yay0"] + - [0x1A06390, "Yay0"] + - [0x1A06F98, "Yay0"] + - [0x1A07B68, "Yay0"] + - [0x1A0A0A0, "Yay0"] + - [0x1A0ACC8, "Yay0"] + - [0x1A0B780, "Yay0"] + - [0x1A0BBE0, "Yay0"] + - [0x1A0C000, "Yay0"] + - [0x1A0C438, "Yay0"] + - [0x1A0C860, "Yay0"] + - [0x1A0D1E8, "Yay0"] + - [0x1A0D5B0, "Yay0"] + - [0x1A0D970, "Yay0"] + - [0x1A0EF00, "Yay0"] + - [0x1A13920, "Yay0"] + - [0x1A15850, "Yay0"] + - [0x1A183F8, "Yay0"] + - [0x1A1A608, "Yay0"] + - [0x1A1C5E8, "Yay0"] + - [0x1A1D6D0, "Yay0"] + - [0x1A1E478, "Yay0"] + - [0x1A1F370, "Yay0"] + - [0x1A226B0, "Yay0"] + - [0x1A249B8, "Yay0"] + - [0x1A25E78, "Yay0"] + - [0x1A27FF0, "Yay0"] + - [0x1A28BE0, "Yay0"] + - [0x1A29680, "Yay0"] + - [0x1A2BC68, "Yay0"] + - [0x1A2E120, "Yay0"] + - [0x1A2F3F8, "Yay0"] + - [0x1A31D18, "Yay0"] + - [0x1A33AB0, "Yay0"] + - [0x1A35BB8, "Yay0"] + - [0x1A369A8, "Yay0"] + - [0x1A39600, "Yay0"] + - [0x1A3B018, "Yay0"] + - [0x1A3C310, "Yay0"] + - [0x1A3FCC8, "Yay0"] + - [0x1A423D8, "Yay0"] + - [0x1A449C0, "Yay0"] + - [0x1A46568, "Yay0"] + - [0x1A49340, "Yay0"] + - [0x1A4AC88, "Yay0"] + - [0x1A4D7E8, "Yay0"] + - [0x1A4E028, "Yay0"] + - [0x1A4FA60, "Yay0"] + - [0x1A531D0, "Yay0"] + - [0x1A53D48, "Yay0"] + - [0x1A56C80, "Yay0"] + - [0x1A58F58, "Yay0"] + - [0x1A5A5A8, "Yay0"] + - [0x1A62B40, "Yay0"] + - [0x1A641F8, "Yay0"] + - [0x1A666F0, "Yay0"] + - [0x1A68870, "Yay0"] + - [0x1A6C630, "Yay0"] + - [0x1A6D5A0, "Yay0"] + - [0x1A6EF50, "Yay0"] + - [0x1A70FF0, "Yay0"] + - [0x1A74FC0, "Yay0"] + - [0x1A78A40, "Yay0"] + - [0x1A79900, "Yay0"] + - [0x1A7D798, "Yay0"] + - [0x1A7EEA0, "Yay0"] + - [0x1A7EFD8, "Yay0"] + - [0x1A83450, "Yay0"] + - [0x1A85668, "Yay0"] + - [0x1A87958, "Yay0"] + - [0x1A8BF98, "Yay0"] + - [0x1A8FE28, "Yay0"] + - [0x1A93EA0, "Yay0"] + - [0x1A94188, "Yay0"] + - [0x1A94480, "Yay0"] + - [0x1A946A8, "Yay0"] + - [0x1A94A00, "Yay0"] + - [0x1A94C58, "Yay0"] + - [0x1A98D98, "Yay0"] + - [0x1A9BA80, "Yay0"] + - [0x1A9DB68, "Yay0"] + - [0x1AA0048, "Yay0"] + - [0x1AA0698, "Yay0"] + - [0x1AA1008, "Yay0"] + - [0x1AA6D58, "Yay0"] + - [0x1AAD600, "Yay0"] + - [0x1AB1BF0, "Yay0"] + - [0x1AB2368, "Yay0"] + - [0x1ABA290, "Yay0"] + - [0x1AC14A8, "Yay0"] + - [0x1AC3910, "Yay0"] + - [0x1ACBC98, "Yay0"] + - [0x1ACE058, "Yay0"] + - [0x1ACF910, "Yay0"] + - [0x1AD06D8, "Yay0"] + - [0x1AD0B98, "Yay0"] + - [0x1AD1E90, "Yay0"] + - [0x1AD2348, "Yay0"] + - [0x1AD27F8, "Yay0"] + - [0x1AD28A8, "Yay0"] + - [0x1AD44F0, "Yay0"] + - [0x1AD4758, "Yay0"] + - [0x1AD57C0, "Yay0"] + - [0x1AD9D50, "Yay0"] + - [0x1ADA498, "Yay0"] + - [0x1ADCFC0, "Yay0"] + - [0x1AE2168, "Yay0"] + - [0x1AE2EA0, "Yay0"] + - [0x1AE6A58, "Yay0"] + - [0x1AEB778, "Yay0"] + - [0x1AF4958, "Yay0"] + - [0x1AFCB18, "Yay0"] + - [0x1AFF748, "Yay0"] + - [0x1B00640, "Yay0"] + - [0x1B01390, "Yay0"] + - [0x1B01C08, "Yay0"] + - [0x1B02128, "Yay0"] + - [0x1B02970, "Yay0"] + - [0x1B03118, "Yay0"] + - [0x1B03C18, "Yay0"] + - [0x1B045E8, "Yay0"] + - [0x1B04FC0, "Yay0"] + - [0x1B05998, "Yay0"] + - [0x1B06C88, "Yay0"] + - [0x1B07C48, "Yay0"] + - [0x1B09440, "Yay0"] + - [0x1B0B290, "Yay0"] + - [0x1B0B9A0, "Yay0"] + - [0x1B0C548, "Yay0"] + - [0x1B0CAC0, "Yay0"] + - [0x1B0D130, "Yay0"] + - [0x1B0EB80, "Yay0"] + - [0x1B10CC0, "Yay0"] + - [0x1B129A0, "Yay0"] + - [0x1B13548, "Yay0"] + - [0x1B16420, "Yay0"] + - [0x1B17128, "Yay0"] + - [0x1B17840, "Yay0"] + - [0x1B19318, "Yay0"] + - [0x1B1A030, "Yay0"] + - [0x1B1B8C8, "Yay0"] + - [0x1B1BC88, "Yay0"] + - [0x1B1C7A0, "Yay0"] + - [0x1B1CD28, "Yay0"] + - [0x1B21C48, "Yay0"] + - [0x1B23290, "Yay0"] + - [0x1B253E0, "Yay0"] + - [0x1B26660, "Yay0"] + - [0x1B283F8, "Yay0"] + - [0x1B29C60, "Yay0"] + - [0x1B2A688, "Yay0"] + - [0x1B2B3E8, "Yay0"] + - [0x1B2C8D8, "Yay0"] + - [0x1B2D7B0, "Yay0"] + - [0x1B2E328, "Yay0"] + - [0x1B2ED60, "Yay0"] + - [0x1B2FA18, "Yay0"] + - [0x1B31A18, "Yay0"] + - [0x1B33000, "Yay0"] + - [0x1B34098, "Yay0"] + - [0x1B34928, "Yay0"] + - [0x1B34C00, "Yay0"] + - [0x1B35480, "Yay0"] + - [0x1B36440, "Yay0"] + - [0x1B38748, "Yay0"] + - [0x1B39A98, "Yay0"] + - [0x1B3A2E8, "Yay0"] + - [0x1B3A818, "Yay0"] + - [0x1B3C488, "Yay0"] + - [0x1B3CAC8, "Yay0"] + - [0x1B3D0A0, "Yay0"] + - [0x1B3D920, "Yay0"] + - [0x1B3F060, "Yay0"] + - [0x1B40048, "Yay0"] + - [0x1B40720, "Yay0"] + - [0x1B49570, "Yay0"] + - [0x1B4C3E8, "Yay0"] + - [0x1B4DEA0, "Yay0"] + - [0x1B4FD98, "Yay0"] + - [0x1B50CD8, "Yay0"] + - [0x1B51B08, "Yay0"] + - [0x1B54258, "Yay0"] + - [0x1B580A0, "Yay0"] + - [0x1B5A248, "Yay0"] + - [0x1B5BB88, "Yay0"] + - [0x1B5CC90, "Yay0"] + - [0x1B5E968, "Yay0"] + - [0x1B5ED88, "Yay0"] + - [0x1B608C0, "Yay0"] + - [0x1B625F8, "Yay0"] + - [0x1B633D0, "Yay0"] + - [0x1B64878, "Yay0"] + - [0x1B657E0, "Yay0"] + - [0x1B65A08, "Yay0"] + - [0x1B65E50, "Yay0"] + - [0x1B66238, "Yay0"] + - [0x1B69580, "Yay0"] + - [0x1B6C318, "Yay0"] + - [0x1B6DD98, "Yay0"] + - [0x1B6F150, "Yay0"] + - [0x1B71618, "Yay0"] + - [0x1B72890, "Yay0"] + - [0x1B73B08, "Yay0"] + - [0x1B747B8, "Yay0"] + - [0x1B76E30, "Yay0"] + - [0x1B78EC0, "Yay0"] + - [0x1B79A20, "Yay0"] + - [0x1B79F08, "Yay0"] + - [0x1B7AA08, "Yay0"] + - [0x1B7B008, "Yay0"] + - [0x1B7BB50, "Yay0"] + - [0x1B7EC68, "Yay0"] + - [0x1B7FF48, "Yay0"] + - [0x1B81E88, "Yay0"] + - [0x1B82058, "Yay0"] - [0x1B82202, "bin"] - [0x1E40000, "bin", "map_assets.fs"] # todo add fs support - [0x27FEE22, "bin"] diff --git a/tools/yay0_decompress b/tools/yay0_decompress deleted file mode 100755 index 74652f9f48ea09e1c861fd7bec0aac4787867158..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 17376 zcmeHPeQX=Yl^=@!kR6+nUE9$m>6uC6JEe_j`7?HNZb(^_SA~?Qsgh=7gdWVf|lH3(eyu0h$L>5)w?QPZYX za*cVvH#3i1u1H*g!`&YRN8rABzj^P?o42#OGrKeTbg;L($>kE9+~Olba;p^L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zwVT0p6LbXV3b+b=XveiMzU7vFN&-1 ztbYXs)OWakp8xXy2gqyxxqq=9_k*87mqb{f=gC*}z_T4?_Qd*3e}O`~e))uTD6L7m zGV-j)^i5!P{Yk%4nAG|_|5Ip1pZT|uAzSSKQNJoVs`Z`co9eQscfk;*#mhykzqyR4 z4C~uzx$oL!&ufEU)z=SQ$3FbH-F*L~_lE4dO -#include -#include -#include -#include -#include - -#include -#include -#include - -#define U32(s) ((uint32_t)(*(s) << 24 | *((s) + 1) << 16 | *((s) + 2) << 8 | *((s) + 3))) - -#define ERROR_UNSUPPORTED -1 -#define ERROR_CORRUPTED -2 -#define ERROR_UNRECOGNIZED -3 -#define ERROR_MEMORY -4 -#define ERROR_BACKREFERENCE_TOO_DISTANT -5 -#define ERROR_OVERFLOW -6 - -uint8_t yay0_magic[] = {0x59, 0x61, 0x79, 0x30}; - -typedef struct __attribute__ ((packed)) yay0_header -{ - uint8_t magic[4]; - uint32_t size; - uint32_t count_offset; - uint32_t data_offset; -} yay0_header_t; - -typedef struct -{ - uint8_t *control; - uint8_t *count; - uint8_t *data; - size_t error; -} yay0_info; - -size_t yay0_decompress(void* _in, void** _out, size_t stop_after_size); - -size_t get_file_size(char *filename) -{ - struct stat file_stat; - if(stat(filename, &file_stat) < 0) - { - printf("Failed to get file size!\n"); - exit(1); - } - - return file_stat.st_size; -} - -int main(int argc, char **argv) -{ - if(argc < 2) - return 1; - FILE *rom_f = fopen(argv[1], "rb"); - if(!rom_f) - { - printf("Failed to open input file...\n"); - return 1; - } - size_t romSize = get_file_size(argv[1]); - uint8_t *romData = malloc(romSize); - fread(romData, 1, romSize, rom_f); - yay0_header_t *header = (yay0_header_t *)romData; - size_t decomp_size = U32((uint8_t *)&header->size); - uint8_t *dest = NULL; - size_t bytes_written = yay0_decompress(&romData[0], (void **)&dest, decomp_size); - char *out_path = malloc(strlen(argv[1]) + strlen(".dec") + 2); - strcpy(out_path, argv[1]); - strcat(out_path, ".dec"); - FILE *out_f = fopen(out_path, "wb"); - fwrite(dest, 1, bytes_written, out_f); - free(dest); - free(romData); - fclose(rom_f); - fclose(out_f); - - return 0; -} - -size_t yay0_decompress(void* _in, void** _out, size_t stop_after_size) -{ - yay0_info *info = malloc(sizeof(yay0_info)); - yay0_header_t* header = (yay0_header_t*)_in; - - if (memcmp(yay0_magic, &header->magic[0], 4)) - return ERROR_UNRECOGNIZED; - - uint32_t total_size = U32((uint8_t *)&header->size); - if (total_size == 0) { - return 0; - } - if (stop_after_size && total_size > stop_after_size) { - total_size = stop_after_size; - } - - *_out = malloc(total_size); - if (!*_out) - return ERROR_MEMORY; - - uint32_t count_offset = U32((uint8_t *)&header->count_offset); - uint32_t data_offset = U32((uint8_t *)&header->data_offset); - - info->control = (uint8_t*)(_in + sizeof(yay0_header_t)); - info->count = (uint8_t*)_in + count_offset; - info->data = (uint8_t*)_in + data_offset; - uint8_t* out_stream = (uint8_t*)*_out; - - size_t bytes_written = 0; - uint8_t control_bits_remaining = 0; - uint8_t control_byte; - - while (bytes_written < total_size) - { - - if (control_bits_remaining == 0) - { - control_byte = *(info->control++); - control_bits_remaining = 8; - } - - if ((control_byte & 0x80) != 0) - { - out_stream[bytes_written] = *(info->data++); - bytes_written++; - - } - else - { - uint16_t nr = (*(info->count++) << 8); - nr |= *(info->count++); - uint16_t r = (nr & 0x0FFF) + 1; - uint16_t n = (nr & 0xF000) >> 12; - if (n == 0) - n = *(info->data++) + 0x12; // TODO is this really read from the data stream? (not the count stream?) - else - n += 2; - - if (r > bytes_written) - return ERROR_BACKREFERENCE_TOO_DISTANT; - - if (bytes_written + n > total_size && stop_after_size == total_size) - return ERROR_OVERFLOW; - - for (; n > 0; n--) - { - out_stream[bytes_written] = out_stream[bytes_written - r]; - bytes_written++; - } - } - - control_byte <<= 1; - control_bits_remaining--; - } - - return bytes_written; -} \ No newline at end of file