diff --git a/arm9/source/patches/arm9/OverlayPatches/PokemonIR/PokemonIrApPatch.cpp b/arm9/source/patches/arm9/OverlayPatches/PokemonIR/PokemonIrApPatch.cpp deleted file mode 100644 index 0d5ebda..0000000 --- a/arm9/source/patches/arm9/OverlayPatches/PokemonIR/PokemonIrApPatch.cpp +++ /dev/null @@ -1,45 +0,0 @@ -#include "common.h" -#include "../../../PatchContext.h" -#include "PokemonIrApPatchAsm.h" -#include "PokemonIrApPatch.h" - -const void* PokemonIrApPatch::InsertPatch(PatchContext& patchContext) -{ - ConfigurePatch(); - return patchContext.GetPatchCodeCollection().AddUniquePatchCode - ( - patchContext.GetPatchHeap(), - next ? next->InsertPatch(patchContext) : nullptr - )->GetPatchFunction(); -} - -void PokemonIrApPatch::ConfigurePatch() const { - switch (_version) - { - // All of these offsets are luckily region-independent - case PokemonIrVersion::Hgss: - { - pokemonirappatch_overlayId = 1; - pokemonirappatch_offset = 0xD2C + 0x12; - break; - } - case PokemonIrVersion::Bw1: - { - pokemonirappatch_overlayId = 231; - pokemonirappatch_offset = 0x1B8 + 0x12; - break; - } - case PokemonIrVersion::Bw2: - { - pokemonirappatch_overlayId = 338; - pokemonirappatch_offset = 0x1B8 + 0x12; - break; - } - default: - { - LOG_WARNING("Unsupported Pokemon IR version\n"); - pokemonirappatch_overlayId = 0xFFFFFFFF; - break; - } - } -} diff --git a/arm9/source/patches/arm9/OverlayPatches/PokemonIR/PokemonIrApPatch.h b/arm9/source/patches/arm9/OverlayPatches/PokemonIR/PokemonIrApPatch.h deleted file mode 100644 index 2d6fe29..0000000 --- a/arm9/source/patches/arm9/OverlayPatches/PokemonIR/PokemonIrApPatch.h +++ /dev/null @@ -1,16 +0,0 @@ -#pragma once -#include "../OverlayPatch.h" -#include "PokemonIrVersion.h" - -/// @brief Arm9 overlay patch to disable the IR-sensor anti-piracy in Pokemon HeartGold, SoulSilver, Black, White, Black 2, and White 2. -class PokemonIrApPatch : public OverlayPatch -{ -public: - PokemonIrApPatch(PokemonIrVersion version) : _version(version) { } - const void* InsertPatch(PatchContext& patchContext) override; - -private: - PokemonIrVersion _version; - - void ConfigurePatch() const; -}; diff --git a/arm9/source/patches/arm9/OverlayPatches/PokemonIR/PokemonIrApPatchAsm.h b/arm9/source/patches/arm9/OverlayPatches/PokemonIR/PokemonIrApPatchAsm.h deleted file mode 100644 index 9bcddaa..0000000 --- a/arm9/source/patches/arm9/OverlayPatches/PokemonIR/PokemonIrApPatchAsm.h +++ /dev/null @@ -1,26 +0,0 @@ -#pragma once -#include "sections.h" -#include "../../../PatchCode.h" - -DEFINE_SECTION_SYMBOLS(pokemonirappatch); - -extern "C" void pokemonirappatch_entry(); - -extern u32 pokemonirappatch_overlayId; -extern u32 pokemonirappatch_offset; -extern u32 pokemonirappatch_nextAddress; - -class PokemonIrApPatchCode : public PatchCode -{ -public: - PokemonIrApPatchCode(PatchHeap& patchHeap, const void* nextPatch) - : PatchCode(SECTION_START(pokemonirappatch), SECTION_SIZE(pokemonirappatch), patchHeap) - { - pokemonirappatch_nextAddress = (u32)nextPatch; - } - - const void* GetPatchFunction() const - { - return GetAddressAtTarget((void*)pokemonirappatch_entry); - } -}; diff --git a/arm9/source/patches/arm9/OverlayPatches/PokemonIR/PokemonIrApPatchAsm.s b/arm9/source/patches/arm9/OverlayPatches/PokemonIR/PokemonIrApPatchAsm.s deleted file mode 100644 index a966f8f..0000000 --- a/arm9/source/patches/arm9/OverlayPatches/PokemonIR/PokemonIrApPatchAsm.s +++ /dev/null @@ -1,40 +0,0 @@ -.cpu arm946e-s -.syntax unified -.section "pokemonirappatch", "ax" -.thumb - -.global pokemonirappatch_entry -.type pokemonirappatch_entry, %function -pokemonirappatch_entry: - push {r5,lr} - - ldmia r5!, {r1, r2} // overlay id, ram address - ldr r0, pokemonirappatch_overlayId - cmp r0, r1 - bne continue_to_next - - ldr r1, pokemonirappatch_offset - movs r0, #1 // force return value of function to 1 instead of 0 - strb r0, [r2, r1] - -continue_to_next: - ldr r0, pokemonirappatch_nextAddress - pop {r5,pc} - -.balign 4 - -.global pokemonirappatch_overlayId -pokemonirappatch_overlayId: - .word 0 - -.global pokemonirappatch_offset -pokemonirappatch_offset: - .word 0 - -.global pokemonirappatch_nextAddress -pokemonirappatch_nextAddress: - .word 0 - -.pool - -.end