From a5ed8b5bda1af615ca008eae77ce430ae0279255 Mon Sep 17 00:00:00 2001 From: The Gears of Progress Date: Fri, 26 Jul 2024 12:13:39 -0400 Subject: [PATCH] Prep for Z80-ASM --- audio/unused audio/Looker.mid | Bin 0 -> 8838 bytes audio/unused audio/LookerShort.mid | Bin 0 -> 3455 bytes include/gb_rom_values/base_gb_rom_struct.h | 1 + include/gb_rom_values/eng_gb_rom_values.h | 2 + include/payload_builder.h | 8 +- source/main.cpp | 2 +- source/payload_builder.cpp | 623 ++++++++++++--------- source/pokemon_data.cpp | 4 +- source/pokemon_party.cpp | 4 +- 9 files changed, 376 insertions(+), 268 deletions(-) create mode 100644 audio/unused audio/Looker.mid create mode 100644 audio/unused audio/LookerShort.mid diff --git a/audio/unused audio/Looker.mid b/audio/unused audio/Looker.mid new file mode 100644 index 0000000000000000000000000000000000000000..58d3ef17e0fb122a5a6fe9800701fcb7def2dc03 GIT binary patch literal 8838 zcmds++fQ8A6~@m5hH1{>h$fLbK2;k}42gWrFa%@p7&2Uk+t{@SJ89L(rZK6J(J`{8 zbt_pJz|hEV9xg^a^u3P^S4FDSd!zmrZF+m{TOa9f-{!^`f#W{3Qt3Bq?X}ll>s$NV zgGp-a&TY%G>a2ieTg|Dl`**RPS$o-rV8gdsnq%$nHplp1pa$33V8gl8Hg8}$$O`)y$@?^Upe+Q>tDf7v#-|t+uFNY zQ}@joYcFc4>S}&T>R_Syj)>l2o>PRHwY_15}3mi6m)YdwG&x@G;@N?7Z5r}gxzZ|&7Ir2DVl{Lbjj z!S2g_=_{#zT(6DYAOHC7#Ypo{V$HFZp4JPtGjlZ&AYP#RG!3S)6}nHyu*a|!dQY$W zP3xiC!S&EoXg!p1X09jP_0Xr*(|*5hJ@km5%rTJl?B$t$_I3NwnQpMx56|?1{eDvV zhw%?%kAkD%Fzdn|^dHU)f&=&mq#YJE`7C108RVa?=PZ66QAhSN^{{pe{|)RBumfxY zZ7}4Jn>xuc>f_6jFGKtkpYO0PQ07U?T821#sH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W}%)CqExtBIp0b z=lVaPOh;upD$`M!j=tX~WjZRWLsHiE%b%Nc)X{%Tn_TTRcYN9_+G;=8FR!c)fCHez zwbeoRAo*c%ShTVlS&Njl06UNT-^J^C{b?(`R_L`tuN8W&(CdR{snBahwd61QtZ2{v zRE9&xG`V-c^nG?f6c_b-2Hb!_Iy6~pHhoLYqPuu-jrYnD@0Z6IfCu3Jg|xUti))+X KTDM)DFWtZ6OVZ>3 literal 0 HcmV?d00001 diff --git a/include/gb_rom_values/base_gb_rom_struct.h b/include/gb_rom_values/base_gb_rom_struct.h index b3aecd3..fe4408c 100644 --- a/include/gb_rom_values/base_gb_rom_struct.h +++ b/include/gb_rom_values/base_gb_rom_struct.h @@ -48,6 +48,7 @@ public: word Bankswitch; // location of the Bankswitch function in the ROM word SoftReset; // location of the SoftReset function in the ROM word garbageDataLocation; // location of random data starting with 0xFD in the ROM + word CloseSRAM; // location of the OpenSRAM function in the ROM word wRemoveMonFromBox; // location of wRemoveMonFromBox in RAM word wBoxCount; // location of wBoxCount in RAM diff --git a/include/gb_rom_values/eng_gb_rom_values.h b/include/gb_rom_values/eng_gb_rom_values.h index b7574a9..4ce9d0b 100644 --- a/include/gb_rom_values/eng_gb_rom_values.h +++ b/include/gb_rom_values/eng_gb_rom_values.h @@ -90,9 +90,11 @@ const struct GB_ROM ENG_YELLOW = { .Serial_ExchangeBytes = 0x1FCB, ._RemovePokemon = 0x7A0F, .SaveSAVtoSRAM1 = 0x1C1B32, + .OpenSRAM = 0x3E99, .Bankswitch = 0x3E84, .SoftReset = 0x1D05, .garbageDataLocation = 0x0161, + .CloseSRAM = 0x3EA9, .wRemoveMonFromBox = 0xCF94, .wBoxCount = 0xDA7F, .wWhichPokemon = 0xCF91, diff --git a/include/payload_builder.h b/include/payload_builder.h index 3bbeb54..2744cbe 100644 --- a/include/payload_builder.h +++ b/include/payload_builder.h @@ -1,9 +1,15 @@ #ifndef PAYLOAD_BUILDER_H #define PAYLOAD_BUILDER_H +#define TRANSFER 1 +#define EVENT 2 + #include "gb_rom_values/base_gb_rom_struct.h" -byte *generate_payload(GB_ROM curr_rom, bool debug); +byte *generate_payload(GB_ROM curr_rom, int type, bool debug); void write_call(int generation, byte array_data[], int& offset, word call_location); +void insert_ext_copy_cmd(int *offset, word source, hword destination, byte size); +void insert_int_copy_cmd(int *offset, hword destination, byte size, byte data[]); + #endif \ No newline at end of file diff --git a/source/main.cpp b/source/main.cpp index 0c92b08..7e7e9b8 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -191,7 +191,7 @@ int credits() "Development\nassistance:\n\n-im a blisy\n-rileyk64\n-Shao", "Built using:\n\n\n-DevkitPro\n-LibTonc\n-LibGBA", "Inspired by the\nworks of:\n\n-Goppier\n-Lorenzooone\n-im a blisy\n-RETIRE", - "Programs used:\n\n\n-HexManiacAdvance\n-PKHeX\n-WC3Tool\n-Usenti\n", + "Programs used:\n\n\n-HexManiacAdvance\n-PKHeX\n-WC3Tool\n-Usenti\n-SappyMidToAGB", "Open Source Code and\nLibraries:\n\n-libtonc-examples\n-PokemonGen3toGenX\n-gba-link-connection\n-awesome-gbadev\n-arduino-poke-gen2", "Research resources:\n\n-arm-docs\n-PokemonGen3toGenX\n\nFull links can be\nfound on this\nprogram's GitHub", "ROM data obtained\nfrom decompilations created by the PRET team", diff --git a/source/payload_builder.cpp b/source/payload_builder.cpp index 5780d25..7b5d8bf 100644 --- a/source/payload_builder.cpp +++ b/source/payload_builder.cpp @@ -9,7 +9,11 @@ byte payload_storage[PAYLOAD_SIZE] = {}; -byte *generate_payload(GB_ROM curr_rom, bool debug) +byte copy_table_storage[0x40] = {}; +int copy_table_offset = 0; +#define copy_table_start 0xBF00 + +byte *generate_payload(GB_ROM curr_rom, int type, bool debug) { /* 10 RNG bytes 8 Preamble bytes @@ -21,7 +25,6 @@ byte *generate_payload(GB_ROM curr_rom, bool debug) */ int offset = 0; - if ((curr_rom.generation == 1 && curr_rom.method == METHOD_NEWLINE)) { @@ -478,284 +481,346 @@ byte *generate_payload(GB_ROM curr_rom, bool debug) int offset = 0x1BB; - // ld a, 0x01 - payload_storage[offset++] = 0x3E; - payload_storage[offset++] = 0x01; - - // call BankswitchCommon - payload_storage[offset++] = 0xCD; - payload_storage[offset++] = 0x7E; - payload_storage[offset++] = 0x3E; - - /* Write transferring message to screen: */ - // call ClearScreen - payload_storage[offset++] = 0xCD; - payload_storage[offset++] = (curr_rom.clearScreen >> 0) & 0xFF; - payload_storage[offset++] = (curr_rom.clearScreen >> 8) & 0xFF; - - // ld hl, [upper left textbox corner in VRAM] - payload_storage[offset++] = 0x21; - payload_storage[offset++] = (curr_rom.textBorderUppLeft >> 0) & 0xFF; - payload_storage[offset++] = (curr_rom.textBorderUppLeft >> 8) & 0xFF; - - // ld b, 3 [height] - payload_storage[offset++] = 0x06; - payload_storage[offset++] = (curr_rom.textBorderWidth >> 0) & 0xFF; - - // ld c, 14 [width] - payload_storage[offset++] = 0x0E; - payload_storage[offset++] = (curr_rom.textBorderHeight >> 0) & 0xFF; - - // call CableClub_TextBoxBorder - payload_storage[offset++] = 0xCD; - payload_storage[offset++] = (curr_rom.CableClub_TextBoxBorder >> 0) & 0xFF; - payload_storage[offset++] = (curr_rom.CableClub_TextBoxBorder >> 8) & 0xFF; - - // ld hl, [transfer string location] - payload_storage[offset++] = 0x21; - payload_storage[offset++] = (curr_rom.transferStringLocation >> 0) & 0xFF; - payload_storage[offset++] = (curr_rom.transferStringLocation >> 8) & 0xFF; - - // ld de, TransferWaitString - payload_storage[offset++] = 0x11; - payload_storage[offset++] = (curr_rom.transferWaitString >> 0) & 0xFF; - payload_storage[offset++] = (curr_rom.transferWaitString >> 8) & 0xFF; - - // call PlaceString - payload_storage[offset++] = 0xCD; - payload_storage[offset++] = (curr_rom.placeString >> 0) & 0xFF; - payload_storage[offset++] = (curr_rom.placeString >> 8) & 0xFF; - - /* Transfer box data: */ - // ld hl, hSerialConnectionStatus - payload_storage[offset++] = 0x21; - payload_storage[offset++] = (curr_rom.hSerialConnectionStatus >> 0) & 0xFF; - payload_storage[offset++] = (curr_rom.hSerialConnectionStatus >> 8) & 0xFF; - - // ld [hl], 0x01 [Make sure GB is the slave, master if debug] - payload_storage[offset++] = 0x36; - payload_storage[offset++] = (debug ? 0x02 : 0x01); - - // ld hl, (wBoxDataStart - 1) [data to send] - payload_storage[offset++] = 0x21; - payload_storage[offset++] = ((curr_rom.wBoxDataStart - 1) >> 0) & 0xFF; - payload_storage[offset++] = ((curr_rom.wBoxDataStart - 1) >> 8) & 0xFF; - - // ld [hl], 0xFD [set the start of the data to 0xFD so Serial_ExchangeBytes is happy] - payload_storage[offset++] = 0x36; - payload_storage[offset++] = 0xFD; - - // ld de, (wBoxDataStart - 3) [location to put stored data] - payload_storage[offset++] = 0x11; - payload_storage[offset++] = ((curr_rom.wBoxDataStart - (debug ? 2 : 3)) >> 0) & 0xFF; - payload_storage[offset++] = ((curr_rom.wBoxDataStart - (debug ? 2 : 3)) >> 8) & 0xFF; - - // ld bc, (wBoxDataEnd - wBoxDataStart) + 2 - payload_storage[offset++] = 0x01; - payload_storage[offset++] = (((curr_rom.wBoxDataEnd - curr_rom.wBoxDataStart) + 2) >> 0) & 0xFF; - payload_storage[offset++] = (((curr_rom.wBoxDataEnd - curr_rom.wBoxDataStart) + 2) >> 8) & 0xFF; - - // call Serial_ExchangeBytes [Send the box data] (unless Debug) - if (debug) - { - offset += 3; - } - else + if (type == TRANSFER) { + + // ld a, 0x01 + payload_storage[offset++] = 0x3E; + payload_storage[offset++] = 0x01; + + // call BankswitchCommon payload_storage[offset++] = 0xCD; - payload_storage[offset++] = (curr_rom.Serial_ExchangeBytes >> 0) & 0xFF; - payload_storage[offset++] = (curr_rom.Serial_ExchangeBytes >> 8) & 0xFF; - } - /* Recieve the Pokemon to remove */ - // ld hl, hSerialConnectionStatus - payload_storage[offset++] = 0x21; - payload_storage[offset++] = (curr_rom.hSerialConnectionStatus >> 0) & 0xFF; - payload_storage[offset++] = (curr_rom.hSerialConnectionStatus >> 8) & 0xFF; + payload_storage[offset++] = 0x7E; + payload_storage[offset++] = 0x3E; - // ld [hl], 0x01 [Make sure GB is the slave, master if debug] - payload_storage[offset++] = 0x36; - payload_storage[offset++] = (debug ? 0x02 : 0x01); - - // ld hl, 0x0161 [data to send, garbage data] - payload_storage[offset++] = 0x21; - payload_storage[offset++] = (curr_rom.garbageDataLocation >> 0) & 0xFF; - payload_storage[offset++] = (curr_rom.garbageDataLocation >> 8) & 0xFF; - - // ld de, 0xC651 [data to recieve] - payload_storage[offset++] = 0x11; - payload_storage[offset++] = (curr_rom.pkmnTransferArray >> 0) & 0xFF; - payload_storage[offset++] = (curr_rom.pkmnTransferArray >> 8) & 0xFF; - - // ld bc, 0x001E [size of data] - Preamble does *not* count - payload_storage[offset++] = 0x01; - payload_storage[offset++] = 0x1E; - payload_storage[offset++] = 0x00; - - // call Serial_ExchangeBytes [Recieve the removal array] - if (debug) - { - offset += 3; // Don't add in the Serial_ExchangeBytes call if in debug - } - else - { + /* Write transferring message to screen: */ + // call ClearScreen payload_storage[offset++] = 0xCD; - payload_storage[offset++] = (curr_rom.Serial_ExchangeBytes >> 0) & 0xFF; - payload_storage[offset++] = (curr_rom.Serial_ExchangeBytes >> 8) & 0xFF; - } + payload_storage[offset++] = (curr_rom.clearScreen >> 0) & 0xFF; + payload_storage[offset++] = (curr_rom.clearScreen >> 8) & 0xFF; - /* Remove the transfered Pokemon */ - // ld hl, wRemoveMonFromBox - payload_storage[offset++] = 0x21; - payload_storage[offset++] = (curr_rom.wRemoveMonFromBox >> 0) & 0xFF; - payload_storage[offset++] = (curr_rom.wRemoveMonFromBox >> 8) & 0xFF; + // ld hl, [upper left textbox corner in VRAM] + payload_storage[offset++] = 0x21; + payload_storage[offset++] = (curr_rom.textBorderUppLeft >> 0) & 0xFF; + payload_storage[offset++] = (curr_rom.textBorderUppLeft >> 8) & 0xFF; - // ld [hl], [!= 0x00 specifies the current box] - payload_storage[offset++] = 0x36; - payload_storage[offset++] = 0x01; + // ld b, 3 [height] + payload_storage[offset++] = 0x06; + payload_storage[offset++] = (curr_rom.textBorderWidth >> 0) & 0xFF; - // ld a, [arrayCounter] - payload_storage[offset++] = 0xFA; - payload_storage[offset++] = (curr_rom.arrayCounter >> 0) & 0xFF; - payload_storage[offset++] = (curr_rom.arrayCounter >> 8) & 0xFF; + // ld c, 14 [width] + payload_storage[offset++] = 0x0E; + payload_storage[offset++] = (curr_rom.textBorderHeight >> 0) & 0xFF; - // ld e, a - payload_storage[offset++] = 0x5F; - - // ld d, 0x00 - payload_storage[offset++] = 0x16; - payload_storage[offset++] = 0x00; - - // ld hl, [removalArray] - payload_storage[offset++] = 0x21; - payload_storage[offset++] = (curr_rom.pkmnTransferArray >> 0) & 0xFF; - payload_storage[offset++] = (curr_rom.pkmnTransferArray >> 8) & 0xFF; - - // add hl, de - payload_storage[offset++] = 0x19; - - // ld e, 0xFF - payload_storage[offset++] = 0x1E; - payload_storage[offset++] = 0xFF; - - // inc a - payload_storage[offset++] = 0x3C; - - // ld [arrayCounter], a - payload_storage[offset++] = 0xEA; - payload_storage[offset++] = (curr_rom.arrayCounter >> 0) & 0xFF; - payload_storage[offset++] = (curr_rom.arrayCounter >> 8) & 0xFF; - - // ld a, [wBoxCount] - payload_storage[offset++] = 0xFA; - payload_storage[offset++] = (curr_rom.wBoxCount >> 0) & 0xFF; - payload_storage[offset++] = (curr_rom.wBoxCount >> 8) & 0xFF; - - // ld b, a - payload_storage[offset++] = 0x47; - - // ld a, [hl] - payload_storage[offset++] = 0x2A; - - // cp a, e - payload_storage[offset++] = 0xBB; - - // jr z, 12 - payload_storage[offset++] = 0x28; - payload_storage[offset++] = 0x0C; - - // cp a, b - payload_storage[offset++] = 0xB8; - - // jr nc, -27 - payload_storage[offset++] = 0x30; - payload_storage[offset++] = 0xE5; - - // ld hl, wWhichPokemon - payload_storage[offset++] = 0x21; - payload_storage[offset++] = (curr_rom.wWhichPokemon >> 0) & 0xFF; - payload_storage[offset++] = (curr_rom.wWhichPokemon >> 8) & 0xFF; - - // ld [hl], a - payload_storage[offset++] = 0x77; - // call _RemovePokemon - if (DONT_REMOVE_PKMN) - { - offset += 3; - } - else - { + // call CableClub_TextBoxBorder payload_storage[offset++] = 0xCD; - payload_storage[offset++] = (curr_rom._RemovePokemon >> 0) & 0xFF; - payload_storage[offset++] = (curr_rom._RemovePokemon >> 8) & 0xFF; - } + payload_storage[offset++] = (curr_rom.CableClub_TextBoxBorder >> 0) & 0xFF; + payload_storage[offset++] = (curr_rom.CableClub_TextBoxBorder >> 8) & 0xFF; - // jr, -36 - payload_storage[offset++] = 0x18; - payload_storage[offset++] = 0xDC; + // ld hl, [transfer string location] + payload_storage[offset++] = 0x21; + payload_storage[offset++] = (curr_rom.transferStringLocation >> 0) & 0xFF; + payload_storage[offset++] = (curr_rom.transferStringLocation >> 8) & 0xFF; - /* Save the current box */ - // ld a, 0x1C - payload_storage[offset++] = 0x3E; - payload_storage[offset++] = (curr_rom.SaveSAVtoSRAM1 >> 16) & 0xFF; + // ld de, TransferWaitString + payload_storage[offset++] = 0x11; + payload_storage[offset++] = (curr_rom.transferWaitString >> 0) & 0xFF; + payload_storage[offset++] = (curr_rom.transferWaitString >> 8) & 0xFF; - // call BankswitchCommon - payload_storage[offset++] = 0xCD; - payload_storage[offset++] = 0x7E; - payload_storage[offset++] = 0x3E; + // call PlaceString + payload_storage[offset++] = 0xCD; + payload_storage[offset++] = (curr_rom.placeString >> 0) & 0xFF; + payload_storage[offset++] = (curr_rom.placeString >> 8) & 0xFF; - // call SaveSAVtoSRAM1 - payload_storage[offset++] = 0xCD; - payload_storage[offset++] = 0x32; - payload_storage[offset++] = 0x7B; + /* Transfer box data: */ + // ld hl, hSerialConnectionStatus + payload_storage[offset++] = 0x21; + payload_storage[offset++] = (curr_rom.hSerialConnectionStatus >> 0) & 0xFF; + payload_storage[offset++] = (curr_rom.hSerialConnectionStatus >> 8) & 0xFF; - // call SaveSAVtoSRAM2 - payload_storage[offset++] = 0xCD; - payload_storage[offset++] = 0x56; - payload_storage[offset++] = 0x7B; + // ld [hl], 0x01 [Make sure GB is the slave, master if debug] + payload_storage[offset++] = 0x36; + payload_storage[offset++] = (debug ? 0x02 : 0x01); - // jp SoftReset - payload_storage[offset++] = 0xC3; - payload_storage[offset++] = (curr_rom.SoftReset >> 0) & 0xFF; - payload_storage[offset++] = (curr_rom.SoftReset >> 8) & 0xFF; + // ld hl, (wBoxDataStart - 1) [data to send] + payload_storage[offset++] = 0x21; + payload_storage[offset++] = ((curr_rom.wBoxDataStart - 1) >> 0) & 0xFF; + payload_storage[offset++] = ((curr_rom.wBoxDataStart - 1) >> 8) & 0xFF; - // 1 byte to store the current array counter - // $C650 - if (offset > (0x1BB + (194 - 72))) - { - std::cout << "Error: Script exceeded by " << offset - (0x1BB + (194 - 72)) << " bytes!" << std::endl; - } - offset = 0x1BB + (194 - 72); - payload_storage[offset++] = 0x00; + // ld [hl], 0xFD [set the start of the data to 0xFD so Serial_ExchangeBytes is happy] + payload_storage[offset++] = 0x36; + payload_storage[offset++] = 0xFD; - // 40 byte storage for list of Pokemon to remove - // $C651 - for (int i = 0; i < 40; i++) - { + // ld de, (wBoxDataStart - 3) [location to put stored data] + payload_storage[offset++] = 0x11; + payload_storage[offset++] = ((curr_rom.wBoxDataStart - (debug ? 2 : 3)) >> 0) & 0xFF; + payload_storage[offset++] = ((curr_rom.wBoxDataStart - (debug ? 2 : 3)) >> 8) & 0xFF; + + // ld bc, (wBoxDataEnd - wBoxDataStart) + 2 + payload_storage[offset++] = 0x01; + payload_storage[offset++] = (((curr_rom.wBoxDataEnd - curr_rom.wBoxDataStart) + 2) >> 0) & 0xFF; + payload_storage[offset++] = (((curr_rom.wBoxDataEnd - curr_rom.wBoxDataStart) + 2) >> 8) & 0xFF; + + // call Serial_ExchangeBytes [Send the box data] (unless Debug) if (debug) { - payload_storage[offset++] = (i < 30 ? (29 - i) : 0xFF); + offset += 3; } else { - payload_storage[offset++] = (i < 30 ? 0xFD : 0xFF); + payload_storage[offset++] = 0xCD; + payload_storage[offset++] = (curr_rom.Serial_ExchangeBytes >> 0) & 0xFF; + payload_storage[offset++] = (curr_rom.Serial_ExchangeBytes >> 8) & 0xFF; } + /* Recieve the Pokemon to remove */ + // ld hl, hSerialConnectionStatus + payload_storage[offset++] = 0x21; + payload_storage[offset++] = (curr_rom.hSerialConnectionStatus >> 0) & 0xFF; + payload_storage[offset++] = (curr_rom.hSerialConnectionStatus >> 8) & 0xFF; + + // ld [hl], 0x01 [Make sure GB is the slave, master if debug] + payload_storage[offset++] = 0x36; + payload_storage[offset++] = (debug ? 0x02 : 0x01); + + // ld hl, 0x0161 [data to send, garbage data] + payload_storage[offset++] = 0x21; + payload_storage[offset++] = (curr_rom.garbageDataLocation >> 0) & 0xFF; + payload_storage[offset++] = (curr_rom.garbageDataLocation >> 8) & 0xFF; + + // ld de, 0xC651 [data to recieve] + payload_storage[offset++] = 0x11; + payload_storage[offset++] = (curr_rom.pkmnTransferArray >> 0) & 0xFF; + payload_storage[offset++] = (curr_rom.pkmnTransferArray >> 8) & 0xFF; + + // ld bc, 0x001E [size of data] - Preamble does *not* count + payload_storage[offset++] = 0x01; + payload_storage[offset++] = 0x1E; + payload_storage[offset++] = 0x00; + + // call Serial_ExchangeBytes [Recieve the removal array] + if (debug) + { + offset += 3; // Don't add in the Serial_ExchangeBytes call if in debug + } + else + { + payload_storage[offset++] = 0xCD; + payload_storage[offset++] = (curr_rom.Serial_ExchangeBytes >> 0) & 0xFF; + payload_storage[offset++] = (curr_rom.Serial_ExchangeBytes >> 8) & 0xFF; + } + + /* Remove the transfered Pokemon */ + // ld hl, wRemoveMonFromBox + payload_storage[offset++] = 0x21; + payload_storage[offset++] = (curr_rom.wRemoveMonFromBox >> 0) & 0xFF; + payload_storage[offset++] = (curr_rom.wRemoveMonFromBox >> 8) & 0xFF; + + // ld [hl], [!= 0x00 specifies the current box] + payload_storage[offset++] = 0x36; + payload_storage[offset++] = 0x01; + + // ld a, [arrayCounter] + payload_storage[offset++] = 0xFA; + payload_storage[offset++] = (curr_rom.arrayCounter >> 0) & 0xFF; + payload_storage[offset++] = (curr_rom.arrayCounter >> 8) & 0xFF; + + // ld e, a + payload_storage[offset++] = 0x5F; + + // ld d, 0x00 + payload_storage[offset++] = 0x16; + payload_storage[offset++] = 0x00; + + // ld hl, [removalArray] + payload_storage[offset++] = 0x21; + payload_storage[offset++] = (curr_rom.pkmnTransferArray >> 0) & 0xFF; + payload_storage[offset++] = (curr_rom.pkmnTransferArray >> 8) & 0xFF; + + // add hl, de + payload_storage[offset++] = 0x19; + + // ld e, 0xFF + payload_storage[offset++] = 0x1E; + payload_storage[offset++] = 0xFF; + + // inc a + payload_storage[offset++] = 0x3C; + + // ld [arrayCounter], a + payload_storage[offset++] = 0xEA; + payload_storage[offset++] = (curr_rom.arrayCounter >> 0) & 0xFF; + payload_storage[offset++] = (curr_rom.arrayCounter >> 8) & 0xFF; + + // ld a, [wBoxCount] + payload_storage[offset++] = 0xFA; + payload_storage[offset++] = (curr_rom.wBoxCount >> 0) & 0xFF; + payload_storage[offset++] = (curr_rom.wBoxCount >> 8) & 0xFF; + + // ld b, a + payload_storage[offset++] = 0x47; + + // ld a, [hl] + payload_storage[offset++] = 0x2A; + + // cp a, e + payload_storage[offset++] = 0xBB; + + // jr z, 12 + payload_storage[offset++] = 0x28; + payload_storage[offset++] = 0x0C; + + // cp a, b + payload_storage[offset++] = 0xB8; + + // jr nc, -27 + payload_storage[offset++] = 0x30; + payload_storage[offset++] = 0xE5; + + // ld hl, wWhichPokemon + payload_storage[offset++] = 0x21; + payload_storage[offset++] = (curr_rom.wWhichPokemon >> 0) & 0xFF; + payload_storage[offset++] = (curr_rom.wWhichPokemon >> 8) & 0xFF; + + // ld [hl], a + payload_storage[offset++] = 0x77; + // call _RemovePokemon + if (DONT_REMOVE_PKMN) + { + offset += 3; + } + else + { + payload_storage[offset++] = 0xCD; + payload_storage[offset++] = (curr_rom._RemovePokemon >> 0) & 0xFF; + payload_storage[offset++] = (curr_rom._RemovePokemon >> 8) & 0xFF; + } + + // jr, -36 + payload_storage[offset++] = 0x18; + payload_storage[offset++] = 0xDC; + + /* Save the current box */ + // ld a, 0x1C + payload_storage[offset++] = 0x3E; + payload_storage[offset++] = (curr_rom.SaveSAVtoSRAM1 >> 16) & 0xFF; + + // call BankswitchCommon + payload_storage[offset++] = 0xCD; + payload_storage[offset++] = 0x7E; + payload_storage[offset++] = 0x3E; + + // call SaveSAVtoSRAM1 + payload_storage[offset++] = 0xCD; + payload_storage[offset++] = 0x32; + payload_storage[offset++] = 0x7B; + + // call SaveSAVtoSRAM2 + payload_storage[offset++] = 0xCD; + payload_storage[offset++] = 0x56; + payload_storage[offset++] = 0x7B; + + // jp SoftReset + payload_storage[offset++] = 0xC3; + payload_storage[offset++] = (curr_rom.SoftReset >> 0) & 0xFF; + payload_storage[offset++] = (curr_rom.SoftReset >> 8) & 0xFF; + + // 1 byte to store the current array counter + // $C650 + if (offset > (0x1BB + (194 - 72))) + { + std::cout << "Error: Script exceeded by " << offset - (0x1BB + (194 - 72)) << " bytes!" << std::endl; + } + offset = 0x1BB + (194 - 72); + payload_storage[offset++] = 0x00; + + // 40 byte storage for list of Pokemon to remove + // $C651 + for (int i = 0; i < 40; i++) + { + if (debug) + { + payload_storage[offset++] = (i < 30 ? (29 - i) : 0xFF); + } + else + { + payload_storage[offset++] = (i < 30 ? 0xFD : 0xFF); + } + } + + // permanent array terminator, just in case + // $C679 + payload_storage[offset++] = 0xFF; + + // TransferWaitString + // $C67A + for (int i = 0; i < 30; i++) + { + payload_storage[offset++] = curr_rom.transferString[i]; + } + + // This payload works by placing Pokemon ID 0xFC's name in the stack, and causing a return to CD8E, + // which is part of the RNG seed. From there we can jump anywhere- and we choose to jump to D887, + // which is the rival's name. This code fixes the stack and jumps to the patchlist, which is where + // our final code is. } - - // permanent array terminator, just in case - // $C679 - payload_storage[offset++] = 0xFF; - - // TransferWaitString - // $C67A - for (int i = 0; i < 30; i++) + else if (type == EVENT) { - payload_storage[offset++] = curr_rom.transferString[i]; - } + // ld a, $03 + payload_storage[offset++] = 0x3A; + payload_storage[offset++] = 0x03; - // This payload works by placing Pokemon ID 0xFC's name in the stack, and causing a return to CD8E, - // which is part of the RNG seed. From there we can jump anywhere- and we choose to jump to D887, - // which is the rival's name. This code fixes the stack and jumps to the patchlist, which is where - // our final code is. + // call OpenSRAM + payload_storage[offset++] = 0xC3; + payload_storage[offset++] = (curr_rom.OpenSRAM >> 0) & 0xFF; + payload_storage[offset++] = (curr_rom.OpenSRAM >> 8) & 0xFF; + + // ld de, $BEB0 + payload_storage[offset++] = 0x11; + payload_storage[offset++] = 0xB0; + payload_storage[offset++] = 0xBE; + + // ld bc, $150 + payload_storage[offset++] = 0x01; + payload_storage[offset++] = 0x50; + payload_storage[offset++] = 0x01; + + // ld hl, ??? + payload_storage[offset++] = 0x21; + payload_storage[offset++] = 0x00; + payload_storage[offset++] = 0x00; + + // CUSTOM EVENT SCRIPT: + // Start with the table data + int init_offset = offset; + insert_ext_copy_cmd(&offset, 0x11410E, 0xD930, 18); // Copy text pointers + insert_ext_copy_cmd(&offset, 0x00C120, 0xC140, 10); // + insert_ext_copy_cmd(&offset, 0x00C220, 0xC240, 16); // + byte temp[] = {0xD0, 0x0A}; + insert_int_copy_cmd(&offset, 0xD4E9, 2, temp); // + byte temp1[] = {0x15, 0x05}; + insert_int_copy_cmd(&offset, 0xD517, 2, temp1); // + byte temp2[] = {0x30, 0xD9}; + insert_int_copy_cmd(&offset, 0xD36B, 2, temp2); // + byte temp3[] = {0x0B, 0xF0, 0xFF}; + insert_int_copy_cmd(&offset, 0xD5D3, 3, temp3); // + byte temp4[] = {0x05}; + insert_int_copy_cmd(&offset, 0xD4E0, 1, temp4); // + byte temp5[] = {0x44, 0xD9, 0x08, 0x21, 0x54, 0xD9, 0xCD, 0x68, 0x31, 0x21, 0xB0, 0xC1, 0x00, 0x00, 0xC3, 0xD2, 0x23, 0x01, 0x00, 0x5E, 0xD8, 0xD8, 0xC9, 0xD8, 0xC9, 0xD8, 0xC9, 0xD8, 0xC9, 0x00, 0x8C, 0xB8, 0xB4, 0xB4, 0xE7, 0x50, 0x08, 0x3E, 0x83, 0xCD, 0x8B, 0x11, 0xCD, 0x3E, 0x37, 0xC3, 0xD2, 0x23}; + insert_int_copy_cmd(&offset, 0xD942, 48, temp5); // + payload_storage[offset++] = 0xFF; + + /* + // call CloseSRAM + payload_storage[offset++] = 0xC3; + payload_storage[offset++] = (curr_rom.CloseSRAM >> 0) & 0xFF; + payload_storage[offset++] = (curr_rom.CloseSRAM >> 8) & 0xFF; + + // call SoftReset + payload_storage[offset++] = 0xC3; + payload_storage[offset++] = (curr_rom.SoftReset >> 0) & 0xFF; + payload_storage[offset++] = (curr_rom.SoftReset >> 8) & 0xFF; + */ + } } else if (curr_rom.generation == 2) { @@ -1009,7 +1074,7 @@ byte *generate_payload(GB_ROM curr_rom, bool debug) } else { - //write_call(curr_rom.generation, payload_storage, offset, 0x046C60); + // write_call(curr_rom.generation, payload_storage, offset, 0x046C60); write_call(curr_rom.generation, payload_storage, offset, curr_rom._RemovePokemon); } @@ -1091,19 +1156,53 @@ void write_call(int generation, byte array_data[], int &offset, word call_locati } }; +void insert_ext_copy_cmd(int *offset, word source, hword destination, byte size) +{ + payload_storage[(*offset)++] = size; + payload_storage[(*offset)++] = destination >> 8; + payload_storage[(*offset)++] = destination >> 0; + payload_storage[(*offset)++] = source >> 16; + payload_storage[(*offset)++] = source >> 8; + payload_storage[(*offset)++] = source >> 0; +} + +void insert_int_copy_cmd(int *offset, hword destination, byte size, byte data[]) +{ + insert_ext_copy_cmd(offset, copy_table_start + copy_table_offset, destination, size); + for (int i = 0; i < size; i++){ + copy_table_storage[copy_table_offset + i]; + } + copy_table_offset += size; +} + int test_main() // Rename to "main" to send the payload to test_payload.txt { freopen("test_payload.txt", "w", stdout); std::cout << std::endl; - byte *payload = generate_payload(ENG_CRYSTAL, true); - for (int i = 0; i < PAYLOAD_SIZE; i++) + byte *payload = generate_payload(ENG_YELLOW, EVENT, true); + if (!EVENT) { - std::cout << "0x" << std::setfill('0') << std::setw(2) << std::hex << std::uppercase << (unsigned int)payload[i] << ", "; - if (i % 0x10 == 0xF) + for (int i = 0; i < PAYLOAD_SIZE; i++) { - std::cout << std::endl - << "# 0x" << std::hex << i + 1 << std::endl; + + std::cout << "0x" << std::setfill('0') << std::setw(2) << std::hex << std::uppercase << (unsigned int)payload[i] << ", "; + if (i % 0x10 == 0xF) + { + std::cout << std::endl + << "# 0x" << std::hex << i + 1 << std::endl; + } } } - return 0; + else + { + for (int i = 0; i < 0x150; i++) + { + std::cout << std::setfill('0') << std::setw(2) << std::hex << std::uppercase << (unsigned int)payload[i + ((0x10 * 28) + 9)] << " "; + if (i % 0x10 == 0xF) + { + std::cout << std::endl; + } + } + return 0; + } } \ No newline at end of file diff --git a/source/pokemon_data.cpp b/source/pokemon_data.cpp index ed0d58b..e95effe 100644 --- a/source/pokemon_data.cpp +++ b/source/pokemon_data.cpp @@ -3630,8 +3630,8 @@ const byte MOVESETS[252][32] = { {0b00000000, 0b00000000, 0b00010000, 0b00000001, 0b00000010, 0b00010100, 0b00000000, 0b00000001, 0b11000000, 0b00000000, 0b00000000, 0b00001000, 0b01000010, 0b10000000, 0b00000001, 0b00000000, 0b01000000, 0b00000000, 0b00000000, 0b00001000, 0b00001000, 0b10000100, 0b00000010, 0b00000100, 0b00000000, 0b00010001, 0b00010110, 0b10100000, 0b00001000, 0b00000100, 0b11000000, 0b00000000}, // Fearow {0b00000000, 0b00000000, 0b00000100, 0b00000000, 0b00110010, 0b10011000, 0b00010000, 0b00000000, 0b00000010, 0b00000000, 0b00000000, 0b01011000, 0b00000011, 0b10000000, 0b00100000, 0b00000000, 0b00000000, 0b01000000, 0b00000000, 0b00001100, 0b00001000, 0b10000100, 0b00001010, 0b00001000, 0b00000000, 0b00110001, 0b00000110, 0b10100000, 0b00001001, 0b00000100, 0b11000000, 0b00010000}, // Ekans {0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00110010, 0b10011000, 0b00010000, 0b00000001, 0b00000010, 0b00000000, 0b00000000, 0b01011000, 0b00000011, 0b10000000, 0b00100000, 0b00000000, 0b00000000, 0b01000000, 0b00000000, 0b00001100, 0b00001000, 0b10000100, 0b00000010, 0b00001000, 0b00000000, 0b00110001, 0b00000110, 0b10100000, 0b00000001, 0b00000100, 0b11000000, 0b00000000}, // Arbok - {0b00000100, 0b01000000, 0b00000100, 0b01000000, 0b00100011, 0b00000100, 0b00000000, 0b01000000, 0b00001110, 0b00000000, 0b00001111, 0b00011000, 0b01100010, 0b10000001, 0b01000000, 0b00000000, 0b01000000, 0b00000000, 0b00001000, 0b00001000, 0b00001000, 0b00000100, 0b00000010, 0b00000100, 0b00000000, 0b00010101, 0b00000110, 0b10100001, 0b00000001, 0b00000100, 0b10000000, 0b01000000}, // Pikachu - {0b00000100, 0b01000000, 0b00000000, 0b01000000, 0b00100011, 0b00000000, 0b00000000, 0b01000001, 0b00001110, 0b00000000, 0b00001111, 0b00011000, 0b00100010, 0b10000001, 0b01000000, 0b00000000, 0b01000000, 0b00000000, 0b00001000, 0b00001000, 0b00001000, 0b10000100, 0b00000010, 0b00000100, 0b00000000, 0b00010101, 0b00000110, 0b10100001, 0b00000001, 0b00000100, 0b10000000, 0b01000000}, // Raichu + {0b00000100, 0b01000000, 0b00000100, 0b01000000, 0b00100011, 0b00000100, 0b00000000, 0b00000000, 0b00001110, 0b00000000, 0b00001111, 0b00011000, 0b01100010, 0b10000001, 0b01000000, 0b00000000, 0b01000000, 0b00000000, 0b00001000, 0b00001000, 0b00001000, 0b00000100, 0b00000010, 0b00000100, 0b00000000, 0b00010101, 0b00000110, 0b10100001, 0b00000001, 0b00000100, 0b10000000, 0b01000000}, // Pikachu + {0b00000100, 0b01000000, 0b00000000, 0b01000000, 0b00100011, 0b00000000, 0b00000000, 0b00000001, 0b00001110, 0b00000000, 0b00001111, 0b00011000, 0b00100010, 0b10000001, 0b01000000, 0b00000000, 0b01000000, 0b00000000, 0b00001000, 0b00001000, 0b00001000, 0b10000100, 0b00000010, 0b00000100, 0b00000000, 0b00010101, 0b00000110, 0b10100001, 0b00000001, 0b00000100, 0b10000000, 0b01000000}, // Raichu {0b00000000, 0b00100011, 0b00000000, 0b00001000, 0b00100010, 0b10000000, 0b00000000, 0b00000000, 0b00001110, 0b00000000, 0b00000000, 0b01011000, 0b00000010, 0b10000001, 0b00000000, 0b00000000, 0b01000000, 0b00000000, 0b00000000, 0b00101100, 0b00011000, 0b10000101, 0b00000010, 0b00000100, 0b00000000, 0b01010101, 0b00100110, 0b10110001, 0b00000101, 0b10000100, 0b01000000, 0b01000000}, // Sandshrew {0b00000000, 0b00100011, 0b00000000, 0b00001000, 0b00100010, 0b10000000, 0b00000000, 0b00000001, 0b00001110, 0b00000000, 0b00000000, 0b01011000, 0b00000010, 0b10000001, 0b00000000, 0b00000000, 0b01000000, 0b00000000, 0b00000000, 0b00101100, 0b00011000, 0b10000100, 0b00000010, 0b00000100, 0b00000000, 0b01010101, 0b00100110, 0b10100001, 0b00000001, 0b00000100, 0b01000000, 0b01000000}, // Sandslash {0b00000000, 0b00100001, 0b00000000, 0b10000000, 0b00101011, 0b10001100, 0b10100000, 0b00110000, 0b00001010, 0b00000000, 0b00000101, 0b00011000, 0b00000010, 0b10000001, 0b00001000, 0b00000000, 0b00000000, 0b00000000, 0b00000000, 0b00101000, 0b00001000, 0b10000100, 0b00000010, 0b00001100, 0b00000000, 0b00011001, 0b00000110, 0b10100000, 0b00000001, 0b00000100, 0b11100000, 0b01010000}, // Nidoran-f diff --git a/source/pokemon_party.cpp b/source/pokemon_party.cpp index cb62d1c..8e71a8d 100644 --- a/source/pokemon_party.cpp +++ b/source/pokemon_party.cpp @@ -179,7 +179,7 @@ void Pokemon_Party::start_link() else { setup(); - last_error = loop(&box_data_array[0], generate_payload(curr_gb_rom, false), &curr_gb_rom, simple_pkmn_array, false); + last_error = loop(&box_data_array[0], generate_payload(curr_gb_rom, TRANSFER, false), &curr_gb_rom, simple_pkmn_array, false); } } @@ -187,7 +187,7 @@ void Pokemon_Party::continue_link(bool cancel_connection) { if (!IGNORE_LINK_CABLE) { - last_error = loop(&box_data_array[0], generate_payload(curr_gb_rom, false), &curr_gb_rom, simple_pkmn_array, cancel_connection); + last_error = loop(&box_data_array[0], generate_payload(curr_gb_rom, TRANSFER, false), &curr_gb_rom, simple_pkmn_array, cancel_connection); } }