diff --git a/README.md b/README.md index 1705e52f..baa76d5d 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ This program creates a randomized version of The Legend of Zelda: The Minish Cap. -Current version: `0.2.0a` +Current version: `0.2.1a` ### Logic The following things are randomized: diff --git a/Resources/Patches/asm/gripScrub1.dmp b/Resources/Patches/asm/gripScrub1.dmp new file mode 100644 index 00000000..74f97c3b Binary files /dev/null and b/Resources/Patches/asm/gripScrub1.dmp differ diff --git a/Resources/Patches/asm/gripScrub1.s b/Resources/Patches/asm/gripScrub1.s new file mode 100644 index 00000000..762a6f9e --- /dev/null +++ b/Resources/Patches/asm/gripScrub1.s @@ -0,0 +1,25 @@ +.thumb +push {lr} +ldr r0,[r0,#0x7C] +ldrb r0,[r0,#8] +cmp r0,#0x44 +bne vanilla + +ldr r0,=#0x2002EA4 +ldr r1,=#10 +ldr r3,=#0x801D5E0 @vanilla flag check routine +mov lr,r3 +.short 0xF800 +cmp r0,#0 +beq invert +mov r0,#0 +b end +invert: +mov r0,#1 +end: +pop {pc} + +vanilla: +ldr r3,=#0x8029139 +cmp r0,#0x5C +bx r3 diff --git a/Resources/Patches/asm/gripScrub2.dmp b/Resources/Patches/asm/gripScrub2.dmp new file mode 100644 index 00000000..4287f67e Binary files /dev/null and b/Resources/Patches/asm/gripScrub2.dmp differ diff --git a/Resources/Patches/asm/gripScrub2.s b/Resources/Patches/asm/gripScrub2.s new file mode 100644 index 00000000..20f4f5a1 --- /dev/null +++ b/Resources/Patches/asm/gripScrub2.s @@ -0,0 +1,27 @@ +.thumb +push {lr} +mov r2,r0 +ldrb r1,[r2] +mov r0,#0xFC +and r0,r1 +cmp r0,#0xC +beq goto802919E + +ldrb r0,[r2,#8] +cmp r0,#0x44 +bne vanilla + +ldr r0,=#0x2002EA4 +ldr r1,=#10 +ldr r3,=#0x801D5E0 @vanilla flag check routine +mov lr,r3 +.short 0xF800 +pop {pc} + +goto802919E: +ldr r3,=#0x802919F +bx r3 + +vanilla: +ldr r3,=#0x802917D +bx r3 diff --git a/Resources/Patches/asm/gripScrub3.dmp b/Resources/Patches/asm/gripScrub3.dmp new file mode 100644 index 00000000..1f932a5c Binary files /dev/null and b/Resources/Patches/asm/gripScrub3.dmp differ diff --git a/Resources/Patches/asm/gripScrub3.s b/Resources/Patches/asm/gripScrub3.s new file mode 100644 index 00000000..f622b360 --- /dev/null +++ b/Resources/Patches/asm/gripScrub3.s @@ -0,0 +1,23 @@ +.thumb +push {r4,lr} +mov r4,r0 +mov r0,#0 +mov r1,#6 +strb r1,[r4,#0xC] +mov r1,r4 +add r1,#0x81 +strb r0,[r1] +ldr r0,[r4,#0x7C] +ldrb r0,[r0,#8] +cmp r0,#0x44 +bne end + +ldr r0,=#0x2002EA4 +mov r1,#10 +ldr r3,=#0x801D5F4 @vanilla flag set routine +mov lr,r3 +.short 0xF800 + +end: +ldr r3,=#0x8029215 +bx r3 diff --git a/Resources/Patches/improvements/asm/dungeonDisplay.dmp b/Resources/Patches/improvements/asm/dungeonDisplay.dmp index 1b5474cb..9360020d 100644 Binary files a/Resources/Patches/improvements/asm/dungeonDisplay.dmp and b/Resources/Patches/improvements/asm/dungeonDisplay.dmp differ diff --git a/Resources/Patches/improvements/asm/dungeonDisplay.s b/Resources/Patches/improvements/asm/dungeonDisplay.s index 2d62ae8f..4cb4c123 100644 --- a/Resources/Patches/improvements/asm/dungeonDisplay.s +++ b/Resources/Patches/improvements/asm/dungeonDisplay.s @@ -8,6 +8,17 @@ ldr r3,=#0x801D668 mov lr,r3 .short 0xF800 +clean: +ldr r0,=#0x2034CB0 +ldr r1,=#0x440 +add r1,r0 +mov r2,#0 +cleanLoop: +str r2,[r0] +add r0,#4 +cmp r0,r1 +bne cleanLoop + @check current map mode ldr r2,=#0x20344A4 ldrb r2,[r2] @@ -21,7 +32,7 @@ and r4,r1 loop: ldrb r1,[r0] cmp r1,#0 -beq clean +beq end cmp r1,r4 beq match add r0,#2 @@ -103,17 +114,6 @@ add r0,r5 bl draw b end -clean: -ldr r0,=#0x2034CB0 -ldr r1,=#0x440 -add r1,r0 -mov r2,#0 -cleanLoop: -str r2,[r0] -add r0,#4 -cmp r0,r1 -bne cleanLoop - end: pop {r4-r7} ldr r3,=#0x80A6807 diff --git a/Resources/Patches/improvements/installer.event b/Resources/Patches/improvements/installer.event index 7a3e071c..13312e4b 100644 --- a/Resources/Patches/improvements/installer.event +++ b/Resources/Patches/improvements/installer.event @@ -146,3 +146,6 @@ BYTE 0x1A 0x1C //pow BYTE 0x12 0x1D //dhc BYTE 0x0F 0x1E //rc BYTE 0x00 0x00 //terminator + +//element object can have sub ids +PUSH; ORG $9FB64; SHORT 0x7AE1; POP diff --git a/Resources/Patches/logicfixes/asm/elementsFix.dmp b/Resources/Patches/logicfixes/asm/elementsFix.dmp new file mode 100644 index 00000000..677e0f15 Binary files /dev/null and b/Resources/Patches/logicfixes/asm/elementsFix.dmp differ diff --git a/Resources/Patches/logicfixes/asm/elementsFix.s b/Resources/Patches/logicfixes/asm/elementsFix.s new file mode 100644 index 00000000..fe0407f4 --- /dev/null +++ b/Resources/Patches/logicfixes/asm/elementsFix.s @@ -0,0 +1,38 @@ +.thumb +mov r1,r4 +add r1,#0x6A +mov r0,#0x40 +strb r0,[r1] +ldrb r0,[r4,#0x0A] + +ldr r0,=#0x3000BF0 +ldrb r1,[r0,#4] +ldrb r2,[r0,#5] +ldr r3,poin +loop: +ldrb r0,[r3] +cmp r0,#0 +beq noMatch +cmp r0,r1 +bne next +ldrb r0,[r3,#1] +cmp r0,r2 +beq match +next: +add r3,#3 +b loop + +noMatch: +mov r0,#0x40 +b end + +match: +ldrb r0,[r3,#2] + +end: +ldr r3,=#0x809FA7B +bx r3 + +.align +.ltorg +poin: diff --git a/Resources/Patches/logicfixes/installer.event b/Resources/Patches/logicfixes/installer.event index c342636a..2ec8490d 100644 --- a/Resources/Patches/logicfixes/installer.event +++ b/Resources/Patches/logicfixes/installer.event @@ -228,3 +228,17 @@ PUSH; ORG $9E2A27; String("You should try"); BYTE 0x20 2 1; String("Figuresanity PUSH; ORG $9E39AA; String("You should try"); BYTE 0x20 2 1; String("Figuresanity"); BYTE 2 0 0x2E 0x0A; String("You'll"); BYTE 0x20 2 1; String("love"); BYTE 0x20 2 0; String("it, trust me"); BYTE 0; POP PUSH; ORG $9E4A08; String("You should try"); BYTE 0x20 2 1; String("Figuresanity"); BYTE 2 0 0x2E 0x0A; String("You'll"); BYTE 0x20 2 1; String("love"); BYTE 0x20 2 0; String("it, trust me"); BYTE 0; POP PUSH; ORG $9E54A7; String("You should try"); BYTE 0x20 2 1; String("Figuresanity"); BYTE 2 0 0x2E 0x0A; String("You'll"); BYTE 0x20 2 1; String("love"); BYTE 0x20 2 0; String("it, trust me"); BYTE 0; POP + +//fix elements hardcoded movement +PUSH; ORG $9FA70; jumpToHack(elementsFix); POP +ALIGN 4 +elementsFix: +#incbin "asm/elementsFix.dmp" +POIN elementsTable +ALIGN 4 +elementsTable: +BYTE 0x49 0x00 0x40 +BYTE 0x51 0x00 0x41 +BYTE 0x60 0x0E 0x42 +BYTE 0x70 0x00 0x43 +BYTE 0x00 0x00 0x00 //terminator diff --git a/Resources/Patches/scrubs.event b/Resources/Patches/scrubs.event index 1cffd6b3..36d8a890 100644 --- a/Resources/Patches/scrubs.event +++ b/Resources/Patches/scrubs.event @@ -44,3 +44,17 @@ POIN $CC0B8; SHORT bottleScrubItem bottleScrubSub POIN $CC0A0; SHORT gripScrubItem gripScrubSub //POIN $CC0DC; SHORT stoneScrubItem stoneScrubSub WORD 0 0 //terminator + +//fix grip scrub flag +PUSH; ORG $29130; jumpToHack(gripScrub1); POP +ALIGN 4 +gripScrub1: +#incbin "asm/gripScrub1.dmp" +PUSH; ORG $2916C; jumpToHack(gripScrub2); POP +ALIGN 4 +gripScrub2: +#incbin "asm/gripScrub2.dmp" +PUSH; ORG $29200; jumpToHack(gripScrub3); POP +ALIGN 4 +gripScrub3: +#incbin "asm/gripScrub3.dmp" diff --git a/Resources/default.logic b/Resources/default.logic index 75951557..6360cec8 100644 --- a/Resources/default.logic +++ b/Resources/default.logic @@ -116,7 +116,6 @@ CrenelHeartCaveHeartPiece; Minor; 0FB32B; Locations.AccessLowerCrenel, Items.Bom CrenelFairyHeartPiece; Minor; 0FB0BB; Locations.AccessCrenel, Items.BombBag CrenelGripScrub; Major; gripScrubItem:Define:FirstByte, gripScrubSub:Define:SecondByte; Locations.AccessCrenel, Items.Shield, Items.BombBag; Items.GripRing GraybladeLeft; Minor; 25-00-00; Locations.AccessCrenel, Helpers.CanSplit2, Items.GripRing -GraybladeLeft; Minor; 25-00-00; Locations.AccessCrenel, Helpers.CanSplit2, Items.GripRing GraybladeRight; Minor; 25-00-01; Locations.AccessCrenel, Helpers.CanSplit2, Items.GripRing GraybladeHeartPiece; Minor; 0D752B; Locations.AccessCrenel, Helpers.CanSplit2, Items.GripRing CrenelBombFairy; Major; 00B828; Locations.AccessCrenel, Items.BombBag, Items.GripRing