Skip to content

Commit

Permalink
Add FastChimecho patch (#535)
Browse files Browse the repository at this point in the history
* Add FastChimecho patch

* Fix typo

* formatting, localization

---------

Co-authored-by: Capypara <hello@capypara.de>
  • Loading branch information
irdkwia and theCapypara authored Aug 6, 2024
1 parent ef70269 commit b068b9d
Show file tree
Hide file tree
Showing 8 changed files with 288 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
; For use with ARMIPS
; 2024/08/04
; For Explorers of Sky All Versions
; ------------------------------------------------------------------------------
; Makes Chimecho Assembly Menu Faster
; ------------------------------------------------------------------------------

; Make Leader
.org LD1
.area 0x4
mov r3,#0x0
.endarea

.org LD2
.area 0x8
nop
nop
.endarea

.org LD3
.area 0x10
nop
nop
nop
nop
.endarea

.org LD4
.area 0x4
mov r1,#0xC
.endarea

; Add to party
.org AP1
.area 0x4
mov r3,#0x0
.endarea

.org AP2
.area 0x4
mov r1,#0xC
.endarea


; Remove from party
.org RP1
.area 0x4
mov r3,#0x0
.endarea

.org RP2
.area 0x4
nop
.endarea

.org RP3
.area 0xC
nop
nop
nop
.endarea

.org RP4
.area 0x8
nop
nop
.endarea

.org RP5
.area 0x10
nop
nop
nop
nop
.endarea

.org RP6
.area 0x4
mov r1,#0xC
.endarea


; Remove permanently

.org DL1
.area 0x4
mov r0,#0xC
.endarea

.org DL2
.area 0x4
moveq r1,#0xC
.endarea
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
; For use with ARMIPS
; 2024/08/04
; For Explorers of Sky All Versions
; ------------------------------------------------------------------------------
; Makes Chimecho Assembly Menu Faster
; ------------------------------------------------------------------------------


.relativeinclude on
.nds
.arm

.definelabel LD1, 0x0238C01C
.definelabel LD2, 0x0238C054
.definelabel LD3, 0x0238C078
.definelabel LD4, 0x0238C0A8

.definelabel AP1, 0x0238C0C4
.definelabel AP2, 0x0238C128

.definelabel RP1, 0x0238C144
.definelabel RP2, 0x0238C14C
.definelabel RP3, 0x0238C168
.definelabel RP4, 0x0238C1CC
.definelabel RP5, 0x0238C1F0
.definelabel RP6, 0x0238C204

.definelabel DL1, 0x0238C2B4
.definelabel DL2, 0x0238C3A8
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
; For use with ARMIPS
; 2024/08/04
; For Explorers of Sky All Versions
; ------------------------------------------------------------------------------
; Makes Chimecho Assembly Menu Faster
; ------------------------------------------------------------------------------


.relativeinclude on
.nds
.arm

.definelabel LD1, 0x0238CA3C
.definelabel LD2, 0x0238CA74
.definelabel LD3, 0x0238CA98
.definelabel LD4, 0x0238CAC8

.definelabel AP1, 0x0238CAE4
.definelabel AP2, 0x0238CB48

.definelabel RP1, 0x0238CB64
.definelabel RP2, 0x0238CB6C
.definelabel RP3, 0x0238CB88
.definelabel RP4, 0x0238CBEC
.definelabel RP5, 0x0238CC10
.definelabel RP6, 0x0238CC24

.definelabel DL1, 0x0238CCD4
.definelabel DL2, 0x0238CDC4
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
; For use with ARMIPS
; 2024/08/04
; For Explorers of Sky All Versions
; ------------------------------------------------------------------------------
; Makes Chimecho Assembly Menu Faster
; ------------------------------------------------------------------------------


.relativeinclude on
.nds
.arm

.definelabel LD1, 0x0238B4DC
.definelabel LD2, 0x0238B514
.definelabel LD3, 0x0238B538
.definelabel LD4, 0x0238B568

.definelabel AP1, 0x0238B584
.definelabel AP2, 0x0238B5E8

.definelabel RP1, 0x0238B604
.definelabel RP2, 0x0238B60C
.definelabel RP3, 0x0238B628
.definelabel RP4, 0x0238B68C
.definelabel RP5, 0x0238B6B0
.definelabel RP6, 0x0238B6C4

.definelabel DL1, 0x0238B774
.definelabel DL2, 0x0238B868
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
; For use with ARMIPS
; 2024/08/04
; For Explorers of Sky All Versions
; ------------------------------------------------------------------------------
; Selects the correct version to use
; ------------------------------------------------------------------------------

.relativeinclude on

; Selects the correct region to apply the patch
.if PPMD_GameVer == GameVer_EoS_NA
.include "na/offsets.asm"
.include "common/patch.asm"
.elseif PPMD_GameVer == GameVer_EoS_EU
.include "eu/offsets.asm"
.include "common/patch.asm"
.elseif PPMD_GameVer == GameVer_EoS_JP
.include "jp/offsets.asm"
.include "common/patch.asm"
.endif

.relativeinclude off
7 changes: 7 additions & 0 deletions skytemple_files/_resources/ppmdu_config/pmd2data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1355,6 +1355,13 @@
</Replace>
</SimplePatch>

<!-- A patch to make Chimecho assembly menu faster-->
<Patch id="FastChimecho" >
<OpenBin filepath="overlay/overlay_0017.bin">
<Include filename ="anonymous_asm_mods/fast_chimecho/selector_overlay17.asm"/>
</OpenBin>
</Patch>

</Game>
</Patches>

Expand Down
77 changes: 77 additions & 0 deletions skytemple_files/patch/handler/fast_chimecho.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Copyright 2020-2024 Capypara and the SkyTemple Contributors
#
# This file is part of SkyTemple.
#
# SkyTemple is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# SkyTemple is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with SkyTemple. If not, see <https://www.gnu.org/licenses/>.
from typing import Callable

from ndspy.rom import NintendoDSRom

from skytemple_files.common.util import read_u32
from skytemple_files.common.ppmdu_config.data import (
Pmd2Data,
GAME_VERSION_EOS,
GAME_REGION_US,
GAME_REGION_EU,
GAME_REGION_JP,
)
from skytemple_files.patch.category import PatchCategory
from skytemple_files.patch.handler.abstract import AbstractPatchHandler
from skytemple_files.common.i18n_util import _

ORIGINAL_INSTRUCTION = 0xE3A03003
OFFSET_US = 0x139C
OFFSET_EU = 0x139C
OFFSET_JP = 0x139C


class FastChimechoPatchHandler(AbstractPatchHandler):
@property
def name(self) -> str:
return "FastChimecho"

@property
def description(self) -> str:
return _(
"Shorten Chimecho Team Assembly menu interactions. Adding, removing and making leader are now fast interactions that immediately go back to the team member selection menu."
)

@property
def category(self) -> PatchCategory:
return PatchCategory.IMPROVEMENT_TWEAK

@property
def author(self) -> str:
return ""

@property
def version(self) -> str:
return "0.8.6"

def is_applied(self, rom: NintendoDSRom, config: Pmd2Data) -> bool:
if config.game_version == GAME_VERSION_EOS:
if config.game_region == GAME_REGION_US:
return read_u32(rom.loadArm9Overlays([17])[17].data, OFFSET_US) != ORIGINAL_INSTRUCTION
elif config.game_region == GAME_REGION_EU:
return read_u32(rom.loadArm9Overlays([17])[17].data, OFFSET_EU) != ORIGINAL_INSTRUCTION
elif config.game_region == GAME_REGION_JP:
return read_u32(rom.loadArm9Overlays([17])[17].data, OFFSET_JP) != ORIGINAL_INSTRUCTION
raise NotImplementedError()

def apply(self, apply: Callable[[], None], rom: NintendoDSRom, config: Pmd2Data) -> None:
# Apply the patch
apply()

def unapply(self, unapply: Callable[[], None], rom: NintendoDSRom, config: Pmd2Data):
raise NotImplementedError()
2 changes: 2 additions & 0 deletions skytemple_files/patch/patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
ImplementFairyGummiesPatchHandler,
)
from skytemple_files.patch.handler.far_off_pal_overdrive import FarOffPalOverdrive
from skytemple_files.patch.handler.fast_chimecho import FastChimechoPatchHandler
from skytemple_files.patch.handler.fix_evolution import FixEvolutionPatchHandler
from skytemple_files.patch.handler.fix_memory_softlock import (
FixMemorySoftlockPatchHandler,
Expand Down Expand Up @@ -207,6 +208,7 @@ class PatchType(Enum):
CHANGE_PORTRAIT = ChangePortraitPatchHandler
NEGATIVE_ENEMY_DENSITY = NegativeEnemyDensityPatchHandler
REMOVE_BODY_SIZE_CHECK = RemoveBodySizeCheckPatchHandler
FAST_CHIMECHO = FastChimechoPatchHandler


class Patcher:
Expand Down

0 comments on commit b068b9d

Please sign in to comment.