From a812244d8848db8240f622018bfdd90240dac5e5 Mon Sep 17 00:00:00 2001 From: Andrew Cook Date: Mon, 30 Mar 2020 16:40:55 +1100 Subject: [PATCH 1/8] Re-arrange Unknown_113b8e Part of an MD5 implementation --- lib/mobile/main.asm | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/lib/mobile/main.asm b/lib/mobile/main.asm index e03484aca61..ebb038bebe8 100644 --- a/lib/mobile/main.asm +++ b/lib/mobile/main.asm @@ -8983,23 +8983,23 @@ Unknown_113b7e: db $01, $23, $45, $67, $89, $ab, $cd, $ef db $fe, $dc, $ba, $98, $76, $54, $32, $10 -Unknown_113b8e: - db $78, $a4, $6a, $d7, $56, $b7, $c7, $e8, $db, $70, $20, $24, $ee, $ce, $bd, $c1 - db $af, $0f, $7c, $f5, $2a, $c6, $87, $47, $13, $46, $30, $a8, $01, $95, $46, $fd - db $d8, $98, $80, $69, $af, $f7, $44, $8b, $b1, $5b, $ff, $ff, $be, $d7, $5c, $89 - db $22, $11, $90, $6b, $93, $71, $98, $fd, $8e, $43, $79, $a6, $21, $08, $b4, $49 - db $62, $25, $1e, $f6, $40, $b3, $40, $c0, $51, $5a, $5e, $26, $aa, $c7, $b6, $e9 - db $5d, $10, $2f, $d6, $53, $14, $44, $02, $81, $e6, $a1, $d8, $c8, $fb, $d3, $e7 - db $e6, $cd, $e1, $21, $d6, $07, $37, $c3, $87, $0d, $d5, $f4, $ed, $14, $5a, $45 - db $05, $e9, $e3, $a9, $f8, $a3, $ef, $fc, $d9, $02, $6f, $67, $8a, $4c, $2a, $8d - db $42, $39, $fa, $ff, $81, $f6, $71, $87, $22, $61, $9d, $6d, $0c, $38, $e5, $fd - db $44, $ea, $be, $a4, $a9, $cf, $de, $4b, $60, $4b, $bb, $f6, $70, $bc, $bf, $be - db $c6, $7e, $9b, $28, $fa, $27, $a1, $ea, $85, $30, $ef, $d4, $05, $1d, $88, $04 - db $39, $d0, $d4, $d9, $e5, $99, $db, $e6, $f8, $7c, $a2, $1f, $65, $56, $ac, $c4 - db $44, $22, $29, $f4, $97, $ff, $2a, $43, $a7, $23, $94, $ab, $39, $a0, $93, $fc - db $c3, $59, $5b, $65, $92, $cc, $0c, $8f, $7d, $f4, $ef, $ff, $d1, $5d, $84, $85 - db $4f, $7e, $a8, $6f, $e0, $e6, $2c, $fe, $14, $43, $01, $a3, $a1, $11, $08, $4e - db $82, $7e, $53, $f7, $35, $f2, $3a, $bd, $bb, $d2, $d7, $2a, $91, $d3, $86, $eb +Unknown_113b8e: ; MD5 k table + dl $d76aa478, $e8c7b756, $242070db, $c1bdceee + dl $f57c0faf, $4787c62a, $a8304613, $fd469501 + dl $698098d8, $8b44f7af, $ffff5bb1, $895cd7be + dl $6b901122, $fd987193, $a679438e, $49b40821 + dl $f61e2562, $c040b340, $265e5a51, $e9b6c7aa + dl $d62f105d, $02441453, $d8a1e681, $e7d3fbc8 + dl $21e1cde6, $c33707d6, $f4d50d87, $455a14ed + dl $a9e3e905, $fcefa3f8, $676f02d9, $8d2a4c8a + dl $fffa3942, $8771f681, $6d9d6122, $fde5380c + dl $a4beea44, $4bdecfa9, $f6bb4b60, $bebfbc70 + dl $289b7ec6, $eaa127fa, $d4ef3085, $04881d05 + dl $d9d4d039, $e6db99e5, $1fa27cf8, $c4ac5665 + dl $f4292244, $432aff97, $ab9423a7, $fc93a039 + dl $655b59c3, $8f0ccc92, $ffeff47d, $85845dd1 + dl $6fa87e4f, $fe2ce6e0, $a3014314, $4e0811a1 + dl $f7537e82, $bd3af235, $2ad7d2bb, $eb86d391 Function113c8e: ld a, c From cf03f158e9b9ba26736e866f0509d2813dd816ad Mon Sep 17 00:00:00 2001 From: Andrew Cook Date: Mon, 30 Mar 2020 17:16:57 +1100 Subject: [PATCH 2/8] Label a number of random mobile thing --- mobile/mobile_12_2.asm | 12 +++--- mobile/mobile_22.asm | 20 +++++----- mobile/mobile_22_2.asm | 4 +- mobile/mobile_45.asm | 20 +++++----- mobile/mobile_46.asm | 84 +++++++++++++++++++++--------------------- mobile/mobile_5f.asm | 4 +- mobile/news/news.asm | 12 +++--- 7 files changed, 78 insertions(+), 78 deletions(-) diff --git a/mobile/mobile_12_2.asm b/mobile/mobile_12_2.asm index 6b328b36aff..1c8173dbc5c 100644 --- a/mobile/mobile_12_2.asm +++ b/mobile/mobile_12_2.asm @@ -267,24 +267,24 @@ Function4a9d7: call GetNick ld h, d ld l, e - ld de, wd006 - ld bc, 6 + ld de, wMobileParticipant1Nickname + ld bc, NAME_LENGTH_JAPANESE call CopyBytes ld a, [wd003] ld hl, wPartyMonNicknames call GetNick ld h, d ld l, e - ld de, wd00c - ld bc, 6 + ld de, wMobileParticipant2Nickname + ld bc, NAME_LENGTH_JAPANESE call CopyBytes ld a, [wd004] ld hl, wPartyMonNicknames call GetNick ld h, d ld l, e - ld de, wd012 - ld bc, 6 + ld de, wMobileParticipant3Nickname + ld bc, NAME_LENGTH_JAPANESE call CopyBytes ld hl, MobileUseTheseThreeMonText call PrintText diff --git a/mobile/mobile_22.asm b/mobile/mobile_22.asm index 4efd50659ba..54c762c9a5c 100644 --- a/mobile/mobile_22.asm +++ b/mobile/mobile_22.asm @@ -142,12 +142,12 @@ Function891fe: pop bc ret -Function89209: +Mobile_EnableSpriteUpdates: ld a, 1 ld [wSpriteUpdatesEnabled], a ret -Function8920f: +Mobile_DisableSpriteUpdates: ld a, 0 ld [wSpriteUpdatesEnabled], a ret @@ -237,13 +237,13 @@ Function89261: ld [wMenuCursorBuffer], a call PushWindow call Mobile22_SetBGMapMode0 - call Function89209 + call Mobile_EnableSpriteUpdates call VerticalMenu push af ld c, $a call DelayFrames call CloseWindow - call Function8920f + call Mobile_DisableSpriteUpdates pop af jr c, .done ld a, [wMenuCursorY] @@ -2514,9 +2514,9 @@ Function89ff6: Function8a03d: ld hl, MobileCardFolderIntro2Text - call Function89209 + call Mobile_EnableSpriteUpdates call PrintText - call Function8920f + call Mobile_DisableSpriteUpdates jp Function89e36 Function8a04c: @@ -2690,9 +2690,9 @@ Function8a116: and a ret .asm_8a16b - call Function89209 + call Mobile_EnableSpriteUpdates call CloseWindow - call Function8920f + call Mobile_DisableSpriteUpdates scf ret @@ -3726,9 +3726,9 @@ Function8a999: pop bc jr .asm_8a9a1 .asm_8a9bb - call Function89209 + call Mobile_EnableSpriteUpdates call CloseWindow - call Function8920f + call Mobile_DisableSpriteUpdates ret Jumptable_8a9c5: diff --git a/mobile/mobile_22_2.asm b/mobile/mobile_22_2.asm index f9d071e3935..d1f65c4c4e7 100644 --- a/mobile/mobile_22_2.asm +++ b/mobile/mobile_22_2.asm @@ -796,9 +796,9 @@ Function8b7bd: call Function8b703 call Function8b75d call UpdateSprites - call Function89209 + call Mobile_EnableSpriteUpdates call ScrollingMenu - call Function8920f + call Mobile_DisableSpriteUpdates ld a, [wMenuJoypad] cp $2 jr z, .asm_8b823 diff --git a/mobile/mobile_45.asm b/mobile/mobile_45.asm index 58f552259fe..f74807807c7 100644 --- a/mobile/mobile_45.asm +++ b/mobile/mobile_45.asm @@ -5026,27 +5026,27 @@ endr jp nz, .asm_115c64 ret -Function115cfd: - cp $2b +Function115cfd: ; Base64 + cp $2b ; "+" jr c, .asm_115d27 jr z, .asm_115d2f - cp $2f + cp $2f ; "/" jr c, .asm_115d27 jr z, .asm_115d32 - cp $30 + cp $30 ; "0" jr c, .asm_115d27 - cp $3a + cp $3a ; "9" + 1 jr c, .asm_115d35 - cp $3d + cp $3d ; "=" jr c, .asm_115d27 jr z, .asm_115d38 - cp $41 + cp $41 ; "A" jr c, .asm_115d27 - cp $5b + cp $5b ; "Z" + 1 jr c, .asm_115d4d - cp $61 + cp $61 ; "a" jr c, .asm_115d27 - cp $7b + cp $7b ; "z" + 1 jr c, .asm_115d50 .asm_115d27 diff --git a/mobile/mobile_46.asm b/mobile/mobile_46.asm index 283f3b02095..ae4ee5f6334 100644 --- a/mobile/mobile_46.asm +++ b/mobile/mobile_46.asm @@ -956,7 +956,7 @@ Function11878d: .asm_118803 ld a, $d3 -Function118805: +Mobile46_SetErrorCode: ld [wMobileErrorCodeBuffer], a xor a ld [wMobileErrorCodeBuffer + 1], a @@ -1388,7 +1388,7 @@ Function118ae4: cp $a6 jr c, .asm_118af5 ld a, $da - jp Function118805 + jp Mobile46_SetErrorCode .asm_118b06 call Function118b24 @@ -1478,7 +1478,7 @@ Function118b9a: cp $e0 ret c ld a, $d3 - call Function118805 + call Mobile46_SetErrorCode and a ret @@ -1542,7 +1542,7 @@ Unreferenced_Function118d35: .asm_118d7b ld a, $d3 - jp Function118805 + jp Mobile46_SetErrorCode Function118d80: call Function118e06 @@ -2117,7 +2117,7 @@ Function119192: .asm_1191a6 ld a, $d3 - call Function118805 + call Mobile46_SetErrorCode scf ret @@ -2137,7 +2137,7 @@ Function1191ad: cp $a6 jr c, .asm_1191b4 ld a, $da - call Function118805 + call Mobile46_SetErrorCode ld a, BANK("Battle Tower RAM") ldh [rSVBK], a pop bc @@ -2272,7 +2272,7 @@ Function119223: and a jr z, .asm_119266 ld a, $d3 - call Function118805 + call Mobile46_SetErrorCode scf ret @@ -2537,7 +2537,7 @@ Function119451: and $1 jr z, .asm_11945d ld a, $d3 - jp Function118805 + jp Mobile46_SetErrorCode .asm_11945d xor a ld [wcd50], a @@ -2717,7 +2717,7 @@ endr ret .asm_119571 ld a, $d8 - jp Function118805 + jp Mobile46_SetErrorCode .asm_119576 ld a, $10 jr .asm_11957c @@ -2805,7 +2805,7 @@ Function1195c4: ret .asm_1195f3 ld a, $d8 - jp Function118805 + jp Mobile46_SetErrorCode Function1195f8: ld a, $11 @@ -2991,7 +2991,7 @@ Function1196f2: cp $a jr nz, .asm_119722 ld a, $b - jp Function118805 + jp Mobile46_SetErrorCode .asm_119722 call Random @@ -3055,7 +3055,7 @@ Function1196f2: .asm_119770 ld a, $d3 - jp Function118805 + jp Mobile46_SetErrorCode .asm_119775 ld a, b @@ -3712,27 +3712,27 @@ Function119b6b: call CopyBytes jp BattleTowerRoomMenu_IncrementJumptable -Function119c3e: - cp $2b +Function119c3e: ; Base64 + cp $2b ; "+" jr c, .asm_119c68 jr z, .asm_119c80 - cp $2f + cp $2f ; "/" jr c, .asm_119c68 jr z, .asm_119c84 - cp $30 + cp $30 ; "0" jr c, .asm_119c68 - cp $3a + cp $3a ; "9" + 1 jr c, .asm_119c88 - cp $3d + cp $3d ; "=" jr c, .asm_119c68 jr z, .asm_119c8c - cp $41 + cp $41 ; "A" jr c, .asm_119c68 - cp $5b + cp $5b ; "Z" + 1 jr c, .asm_119c8f - cp $61 + cp $61 ; "a" jr c, .asm_119c68 - cp $7b + cp $7b ; "z" + 1 jr c, .asm_119c93 .asm_119c68 @@ -4469,7 +4469,7 @@ Function11a1d6: cp $50 jr nz, .asm_11a1e4 ld a, $d3 - call Function118805 + call Mobile46_SetErrorCode scf ret @@ -4913,16 +4913,16 @@ Function11a4fe: Function11a536: ld hl, hJoyPressed ld a, [hl] - and $1 + and A_BUTTON jr nz, .asm_11a5a7 ld a, [hl] - and $2 + and B_BUTTON jr nz, .asm_11a5a2 ld a, [hl] - and $40 + and D_UP jr nz, .asm_11a564 ld a, [hl] - and $80 + and D_DOWN jr nz, .asm_11a583 .asm_11a54d ld a, [wBattleTowerRoomMenu2JumptableIndex] @@ -5401,7 +5401,7 @@ Function11a9f4: bit 7, h ret nz ld a, $d6 - call Function118805 + call Mobile46_SetErrorCode and a ret @@ -5631,7 +5631,7 @@ Function11ad1b: ld a, BANK(LoadMenuMonIcon) ld e, MONICON_MOBILE2 rst FarCall - ld hl, $c6d0 + ld hl, wPokedexOrder ld bc, $0115 xor a call ByteFill @@ -5641,8 +5641,8 @@ Function11ad1b: ld [wcf65], a ld [wcf66], a ld [wcd30], a - ld a, $2 - ld [wc7d4], a + ld a, DEXMODE_ABC + ld [wCurDexMode], a farcall Pokedex_OrderMonsByMode ret @@ -5696,16 +5696,16 @@ Function11adc4: and a ret z ld a, [hl] - and $40 + and D_UP jr nz, .asm_11ade6 ld a, [hl] - and $80 + and D_DOWN jr nz, .asm_11aded ld a, [hl] - and $1 + and A_BUTTON jr nz, .asm_11ae06 ld a, [hl] - and $2 + and B_BUTTON ret z call PlayClickSFX xor a @@ -6119,7 +6119,7 @@ Function11b099: ld a, [wc7d0] ld e, a ld d, $0 - ld hl, wc6d0 + ld hl, wPokedexOrder add hl, de ld e, l ld d, h @@ -6183,10 +6183,10 @@ Function11b099: Function11b0ff: ld hl, hJoyPressed ld a, [hl] - and $2 + and B_BUTTON jr nz, .asm_11b141 ld a, [hl] - and $1 + and A_BUTTON jr nz, .asm_11b131 call Function11b175 jr nc, .asm_11b125 @@ -6265,19 +6265,19 @@ Function11b175: ld e, a ld hl, hJoyLast ld a, [hl] - and $40 + and D_UP jr nz, .asm_11b19a ld a, [hl] - and $80 + and D_DOWN jr nz, .asm_11b1ae ld a, d cp e jr nc, .asm_11b1ed ld a, [hl] - and $20 + and D_LEFT jr nz, .asm_11b1c6 ld a, [hl] - and $10 + and D_RIGHT jr nz, .asm_11b1d8 jr .asm_11b1ed diff --git a/mobile/mobile_5f.asm b/mobile/mobile_5f.asm index 1184a85ed44..fefc4d10498 100644 --- a/mobile/mobile_5f.asm +++ b/mobile/mobile_5f.asm @@ -507,9 +507,9 @@ Function17d2c0: ret Function17d2ce: - ld a, $5 + ld a, BANK(s5_aa72) call GetSRAMBank - ld a, [$aa72] + ld a, [s5_aa72] call CloseSRAM and a jr nz, .asm_17d2e2 diff --git a/mobile/news/news.asm b/mobile/news/news.asm index 868556bdd16..8875b087155 100644 --- a/mobile/news/news.asm +++ b/mobile/news/news.asm @@ -3,10 +3,10 @@ db $cc, $6b, $1e ; unused Unreferenced_Function1f4003: - ld a, $6 + ld a, BANK(s6_a000) call GetSRAMBank ld hl, .news_data - ld de, $a000 + ld de, s6_a000 ld bc, $1000 call CopyBytes call CloseSRAM @@ -16,10 +16,10 @@ Unreferenced_Function1f4003: INCBIN "mobile/news/news_1.bin" Unreferenced_Function1f4dbe: - ld a, $6 + ld a, BANK(s6_a000) call GetSRAMBank ld hl, .news_data - ld de, $a000 + ld de, s6_a000 ld bc, $1000 call CopyBytes call CloseSRAM @@ -29,10 +29,10 @@ Unreferenced_Function1f4dbe: INCBIN "mobile/news/news_2.bin" Function1f5d9f: - ld a, $6 + ld a, BANK(s6_a000) call GetSRAMBank ld hl, .news_data - ld de, $a000 + ld de, s6_a000 ld bc, $1000 call CopyBytes call CloseSRAM From 4fc3e93ce750487ade55bd016cf0cd88d883aeaf Mon Sep 17 00:00:00 2001 From: Andrew Cook Date: Tue, 31 Mar 2020 10:18:35 +1100 Subject: [PATCH 3/8] Use ascii charmap for mobile_45 --- mobile/mobile_45.asm | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/mobile/mobile_45.asm b/mobile/mobile_45.asm index f74807807c7..b008697efed 100644 --- a/mobile/mobile_45.asm +++ b/mobile/mobile_45.asm @@ -124,8 +124,6 @@ String_114228: String_114232: db "=?ISO-2022-JP?B?", 0 -popc - Function114243:: ld a, SRAM_ENABLE ld [MBC3SRamEnable], a @@ -514,9 +512,9 @@ Function114412: jr z, .asm_1144c2 inc e call z, Function1144c8 - cp $61 ; "a" + cp "a" jr c, .asm_114462 - cp $7b ; "z" + 1 + cp "z" + 1 jr nc, .asm_114462 sub $20 @@ -540,10 +538,10 @@ Function114412: jr .asm_11446e .asm_114476 - ld a, $20 ; " " + ld a, " " cp b jr z, .asm_114481 - ld a, $a ; NL + ld a, "\n" cp b jr z, .asm_114481 dec de @@ -559,18 +557,18 @@ Function114412: inc bc inc e call z, Function1144c8 - cp $d ; CR + cp $d ; "\r" jr nz, .asm_114486 ld a, [de] inc bc inc e call z, Function1144c8 - cp $a ; NL + cp "\n" jr nz, .asm_114486 ld a, [de] - cp $20 ; " " + cp " " jr z, .asm_114486 - cp $9 ; TAB + cp "\t" jr z, .asm_114486 ld d, h ld e, l @@ -5027,26 +5025,26 @@ endr ret Function115cfd: ; Base64 - cp $2b ; "+" + cp "+" jr c, .asm_115d27 jr z, .asm_115d2f - cp $2f ; "/" + cp "/" jr c, .asm_115d27 jr z, .asm_115d32 - cp $30 ; "0" + cp "0" jr c, .asm_115d27 - cp $3a ; "9" + 1 + cp "9" + 1 jr c, .asm_115d35 - cp $3d ; "=" + cp "=" jr c, .asm_115d27 jr z, .asm_115d38 - cp $41 ; "A" + cp "A" jr c, .asm_115d27 - cp $5b ; "Z" + 1 + cp "Z" + 1 jr c, .asm_115d4d - cp $61 ; "a" + cp "a" jr c, .asm_115d27 - cp $7b ; "z" + 1 + cp "z" + 1 jr c, .asm_115d50 .asm_115d27 @@ -5156,3 +5154,5 @@ Function115d80: ld d, $a0 ld e, $0 ret + +popc From c662b33b8f8d374a4b3078d1c83f74b77224e097 Mon Sep 17 00:00:00 2001 From: Andrew Cook Date: Tue, 31 Mar 2020 10:20:01 +1100 Subject: [PATCH 4/8] Rename Unknown_113b8e to MD5_K_Table --- lib/mobile/main.asm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/mobile/main.asm b/lib/mobile/main.asm index ebb038bebe8..eee2a67d6d2 100644 --- a/lib/mobile/main.asm +++ b/lib/mobile/main.asm @@ -8440,9 +8440,9 @@ Function1136c1: .asm_113734 ld hl, $cc0c - ld a, LOW(Unknown_113b8e) + ld a, LOW(MD5_K_Table) ld [hli], a - ld a, HIGH(Unknown_113b8e) + ld a, HIGH(MD5_K_Table) ld [hl], a ld hl, $cc0e ld a, LOW(Unknown_113a70) @@ -8529,7 +8529,7 @@ endr ld [$cc0d], a ld a, l ld [$cc0c], a - cp $8e ; XXX LOW(Unknown_113b8e + $100) ??? + cp $8e ; XXX LOW(MD5_K_Table + $100) ??? jp nz, .asm_113751 ld de, $cc18 ld hl, $cbe7 @@ -8983,7 +8983,7 @@ Unknown_113b7e: db $01, $23, $45, $67, $89, $ab, $cd, $ef db $fe, $dc, $ba, $98, $76, $54, $32, $10 -Unknown_113b8e: ; MD5 k table +MD5_K_Table: dl $d76aa478, $e8c7b756, $242070db, $c1bdceee dl $f57c0faf, $4787c62a, $a8304613, $fd469501 dl $698098d8, $8b44f7af, $ffff5bb1, $895cd7be From 31bcd03412cd291fd5b3295e6cae4b0b2d8fa297 Mon Sep 17 00:00:00 2001 From: Andrew Cook Date: Tue, 31 Mar 2020 10:55:07 +1100 Subject: [PATCH 5/8] Use ascii charmap in mobile_46 --- data/mobile/x-game-code-prefix.txt | 1 - data/mobile/x-game-code.txt | Bin 12 -> 0 bytes data/mobile/x-game-result-prefix.txt | 1 - data/mobile/x-game-result.txt | Bin 16 -> 0 bytes mobile/mobile_46.asm | 42 ++++++++++++++++++--------- 5 files changed, 29 insertions(+), 15 deletions(-) delete mode 100644 data/mobile/x-game-code-prefix.txt delete mode 100644 data/mobile/x-game-code.txt delete mode 100644 data/mobile/x-game-result-prefix.txt delete mode 100644 data/mobile/x-game-result.txt diff --git a/data/mobile/x-game-code-prefix.txt b/data/mobile/x-game-code-prefix.txt deleted file mode 100644 index 61012198d56..00000000000 --- a/data/mobile/x-game-code-prefix.txt +++ /dev/null @@ -1 +0,0 @@ -X-Game-code: diff --git a/data/mobile/x-game-code.txt b/data/mobile/x-game-code.txt deleted file mode 100644 index 91fc69604ea9199c9a52a0d6a0c8fe9ddbb349e9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12 TcmZ>EchYr=2=UT2Fkk=x6YK)N diff --git a/data/mobile/x-game-result-prefix.txt b/data/mobile/x-game-result-prefix.txt deleted file mode 100644 index e9627d29db6..00000000000 --- a/data/mobile/x-game-result-prefix.txt +++ /dev/null @@ -1 +0,0 @@ -X-Game-result: diff --git a/data/mobile/x-game-result.txt b/data/mobile/x-game-result.txt deleted file mode 100644 index 3cebbf213feaee612d813894a4b33001157bac79..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16 XcmXTO&rZ$F&x=nksw^%^%wYfkIVJ{M diff --git a/mobile/mobile_46.asm b/mobile/mobile_46.asm index ae4ee5f6334..d4f3469b73d 100644 --- a/mobile/mobile_46.asm +++ b/mobile/mobile_46.asm @@ -3524,10 +3524,16 @@ Function119ac9: ld [wBattleTowerRoomMenuJumptableIndex], a ret +pushc +setcharmap ascii + XGameCode: -INCBIN "data/mobile/x-game-code.txt" + db "CGB-BXTJ-00", $0 + XGameResult: -INCBIN "data/mobile/x-game-result.txt" + db "pokemon_crystal", $0 + +popc Function119b0d: ld a, $8 @@ -3712,29 +3718,34 @@ Function119b6b: call CopyBytes jp BattleTowerRoomMenu_IncrementJumptable +pushc +setcharmap ascii + Function119c3e: ; Base64 - cp $2b ; "+" + cp "+" jr c, .asm_119c68 jr z, .asm_119c80 - cp $2f ; "/" + cp "/" jr c, .asm_119c68 jr z, .asm_119c84 - cp $30 ; "0" + cp "0" jr c, .asm_119c68 - cp $3a ; "9" + 1 + cp "9" + 1 jr c, .asm_119c88 - cp $3d ; "=" + cp "=" jr c, .asm_119c68 jr z, .asm_119c8c - cp $41 ; "A" + cp "A" jr c, .asm_119c68 - cp $5b ; "Z" + 1 + cp "Z" + 1 jr c, .asm_119c8f - cp $61 ; "a" + cp "a" jr c, .asm_119c68 - cp $7b ; "z" + 1 + cp "z" + 1 jr c, .asm_119c93 +popc + .asm_119c68 ld a, $19 ld [wBattleTowerRoomMenuJumptableIndex], a @@ -3989,11 +4000,16 @@ BattleTowerRoomMenu_IncrementJumptable: inc [hl] ret +pushc +setcharmap ascii + XGameCodePrefix: -INCBIN "data/mobile/x-game-code-prefix.txt" + db "X-Game-code:\n" XGameResultPrefix: -INCBIN "data/mobile/x-game-result-prefix.txt" + db "X-Game-result:\n" + +popc Function119e4f: push bc From 43e0ce2ca5e3eeccca1c5c551aabd1d8e7712967 Mon Sep 17 00:00:00 2001 From: Andrew Cook Date: Tue, 31 Mar 2020 11:03:34 +1100 Subject: [PATCH 6/8] Use charmap ascii in mobile_45_stadium --- data/mobile/ascii-alpha.txt | 1 - data/mobile/ascii-sym.txt | 1 - mobile/mobile_45_stadium.asm | 12 ++++++++++-- 3 files changed, 10 insertions(+), 4 deletions(-) delete mode 100644 data/mobile/ascii-alpha.txt delete mode 100644 data/mobile/ascii-sym.txt diff --git a/data/mobile/ascii-alpha.txt b/data/mobile/ascii-alpha.txt deleted file mode 100644 index 0f6cc8680b8..00000000000 --- a/data/mobile/ascii-alpha.txt +++ /dev/null @@ -1 +0,0 @@ -ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz \ No newline at end of file diff --git a/data/mobile/ascii-sym.txt b/data/mobile/ascii-sym.txt deleted file mode 100644 index dae18019903..00000000000 --- a/data/mobile/ascii-sym.txt +++ /dev/null @@ -1 +0,0 @@ -0123456789 !"#$%&'()*+ ,-./:;<=>?@ [\]^_`{|}~ \ No newline at end of file diff --git a/mobile/mobile_45_stadium.asm b/mobile/mobile_45_stadium.asm index ffae225b170..e9dcba54da7 100644 --- a/mobile/mobile_45_stadium.asm +++ b/mobile/mobile_45_stadium.asm @@ -486,11 +486,19 @@ MobilePassword_IncrementJumptable: inc [hl] ret +pushc +setcharmap ascii + Unknown_117a0f: -INCBIN "data/mobile/ascii-alpha.txt" + db "ABCDEFGHIJKLMNOPQRSTUVWXYZ " + db "abcdefghijklmnopqrstuvwxyz " Unknown_117a47: -INCBIN "data/mobile/ascii-sym.txt" + db "0123456789 " + db "!\"#$%&'()*+ " + db ",-./:;<=>?@ " + db "[\\]^_`\{|}~ " +popc ; everything from here to the end of the bank is related to the ; Mobile Stadium option from the continue/newgame menu. From 0e78609f5510d84679d3a1b4e9d325b1d7dc4161 Mon Sep 17 00:00:00 2001 From: Andrew Cook Date: Wed, 1 Apr 2020 11:37:02 +1100 Subject: [PATCH 7/8] Rename stuff, make base64 decoding chunks local --- mobile/mobile_45.asm | 8 ++++---- mobile/mobile_46.asm | 38 +++++++++++++++++++------------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/mobile/mobile_45.asm b/mobile/mobile_45.asm index b008697efed..b2737a5bca3 100644 --- a/mobile/mobile_45.asm +++ b/mobile/mobile_45.asm @@ -442,7 +442,7 @@ Function1143b7: jp Function11425c Function1143f3: - call Function114412 + call .asm_114412 and a jr nz, .asm_11440d ld a, $4 @@ -468,7 +468,7 @@ Function1143f3: ld b, $84 ret -Function114412: +.asm_114412: ld a, c ld [$dc00], a ldh [hSRAMBank], a @@ -4924,7 +4924,7 @@ Function115c49: .asm_115c77 ld a, [de] inc de - call Function115cfd + call .asm_115cfd ld [hli], a dec b jr nz, .asm_115c77 @@ -5024,7 +5024,7 @@ endr jp nz, .asm_115c64 ret -Function115cfd: ; Base64 +.asm_115cfd cp "+" jr c, .asm_115d27 jr z, .asm_115d2f diff --git a/mobile/mobile_46.asm b/mobile/mobile_46.asm index d4f3469b73d..e2a5e5e24e1 100644 --- a/mobile/mobile_46.asm +++ b/mobile/mobile_46.asm @@ -956,7 +956,7 @@ Function11878d: .asm_118803 ld a, $d3 -Mobile46_SetErrorCode: +SetMobileErrorCode: ld [wMobileErrorCodeBuffer], a xor a ld [wMobileErrorCodeBuffer + 1], a @@ -1388,7 +1388,7 @@ Function118ae4: cp $a6 jr c, .asm_118af5 ld a, $da - jp Mobile46_SetErrorCode + jp SetMobileErrorCode .asm_118b06 call Function118b24 @@ -1478,7 +1478,7 @@ Function118b9a: cp $e0 ret c ld a, $d3 - call Mobile46_SetErrorCode + call SetMobileErrorCode and a ret @@ -1542,7 +1542,7 @@ Unreferenced_Function118d35: .asm_118d7b ld a, $d3 - jp Mobile46_SetErrorCode + jp SetMobileErrorCode Function118d80: call Function118e06 @@ -2117,7 +2117,7 @@ Function119192: .asm_1191a6 ld a, $d3 - call Mobile46_SetErrorCode + call SetMobileErrorCode scf ret @@ -2137,7 +2137,7 @@ Function1191ad: cp $a6 jr c, .asm_1191b4 ld a, $da - call Mobile46_SetErrorCode + call SetMobileErrorCode ld a, BANK("Battle Tower RAM") ldh [rSVBK], a pop bc @@ -2272,7 +2272,7 @@ Function119223: and a jr z, .asm_119266 ld a, $d3 - call Mobile46_SetErrorCode + call SetMobileErrorCode scf ret @@ -2537,7 +2537,7 @@ Function119451: and $1 jr z, .asm_11945d ld a, $d3 - jp Mobile46_SetErrorCode + jp SetMobileErrorCode .asm_11945d xor a ld [wcd50], a @@ -2717,7 +2717,7 @@ endr ret .asm_119571 ld a, $d8 - jp Mobile46_SetErrorCode + jp SetMobileErrorCode .asm_119576 ld a, $10 jr .asm_11957c @@ -2805,7 +2805,7 @@ Function1195c4: ret .asm_1195f3 ld a, $d8 - jp Mobile46_SetErrorCode + jp SetMobileErrorCode Function1195f8: ld a, $11 @@ -2991,7 +2991,7 @@ Function1196f2: cp $a jr nz, .asm_119722 ld a, $b - jp Mobile46_SetErrorCode + jp SetMobileErrorCode .asm_119722 call Random @@ -3055,7 +3055,7 @@ Function1196f2: .asm_119770 ld a, $d3 - jp Mobile46_SetErrorCode + jp SetMobileErrorCode .asm_119775 ld a, b @@ -3619,22 +3619,22 @@ Function119b6b: inc de cp $d jr z, .asm_119bfa - call Function119c3e + call .asm_119c3e ret c ld [hli], a ld a, [de] inc de - call Function119c3e + call .asm_119c3e ret c ld [hli], a ld a, [de] inc de - call Function119c3e + call .asm_119c3e ret c ld [hli], a ld a, [de] inc de - call Function119c3e + call .asm_119c3e ret c ld [hl], a push de @@ -3721,7 +3721,7 @@ Function119b6b: pushc setcharmap ascii -Function119c3e: ; Base64 +.asm_119c3e cp "+" jr c, .asm_119c68 jr z, .asm_119c80 @@ -4485,7 +4485,7 @@ Function11a1d6: cp $50 jr nz, .asm_11a1e4 ld a, $d3 - call Mobile46_SetErrorCode + call SetMobileErrorCode scf ret @@ -5417,7 +5417,7 @@ Function11a9f4: bit 7, h ret nz ld a, $d6 - call Mobile46_SetErrorCode + call SetMobileErrorCode and a ret From da2faa3210660b04d66a87f278420e520d1820fc Mon Sep 17 00:00:00 2001 From: Andrew Cook Date: Wed, 1 Apr 2020 11:44:54 +1100 Subject: [PATCH 8/8] Rename base64 functions --- mobile/mobile_45.asm | 4 ++-- mobile/mobile_46.asm | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mobile/mobile_45.asm b/mobile/mobile_45.asm index b2737a5bca3..25ccb0ff09a 100644 --- a/mobile/mobile_45.asm +++ b/mobile/mobile_45.asm @@ -4924,7 +4924,7 @@ Function115c49: .asm_115c77 ld a, [de] inc de - call .asm_115cfd + call .decodeBase64Character ld [hli], a dec b jr nz, .asm_115c77 @@ -5024,7 +5024,7 @@ endr jp nz, .asm_115c64 ret -.asm_115cfd +.decodeBase64Character cp "+" jr c, .asm_115d27 jr z, .asm_115d2f diff --git a/mobile/mobile_46.asm b/mobile/mobile_46.asm index e2a5e5e24e1..793cf7c21e7 100644 --- a/mobile/mobile_46.asm +++ b/mobile/mobile_46.asm @@ -3619,22 +3619,22 @@ Function119b6b: inc de cp $d jr z, .asm_119bfa - call .asm_119c3e + call .decodeBase64Character ret c ld [hli], a ld a, [de] inc de - call .asm_119c3e + call .decodeBase64Character ret c ld [hli], a ld a, [de] inc de - call .asm_119c3e + call .decodeBase64Character ret c ld [hli], a ld a, [de] inc de - call .asm_119c3e + call .decodeBase64Character ret c ld [hl], a push de @@ -3721,7 +3721,7 @@ Function119b6b: pushc setcharmap ascii -.asm_119c3e +.decodeBase64Character cp "+" jr c, .asm_119c68 jr z, .asm_119c80