From 172c4ba06919b674fb8d1d72e753a720189fa8a6 Mon Sep 17 00:00:00 2001 From: getdls <25286924+getdls@users.noreply.github.com> Date: Fri, 8 May 2020 16:21:00 +0200 Subject: [PATCH] Hyrule warriors - 60fps w Cemu patch format --- Mods/HyruleWarriors_60FPS/patch_staticFPS.asm | 49 +++++++++++++++++++ Mods/HyruleWarriors_60FPS/patches.txt | 40 --------------- Mods/HyruleWarriors_60FPS/rules.txt | 6 +-- 3 files changed, 52 insertions(+), 43 deletions(-) create mode 100644 Mods/HyruleWarriors_60FPS/patch_staticFPS.asm delete mode 100644 Mods/HyruleWarriors_60FPS/patches.txt diff --git a/Mods/HyruleWarriors_60FPS/patch_staticFPS.asm b/Mods/HyruleWarriors_60FPS/patch_staticFPS.asm new file mode 100644 index 00000000..1659d4ef --- /dev/null +++ b/Mods/HyruleWarriors_60FPS/patch_staticFPS.asm @@ -0,0 +1,49 @@ +[HW60FPSFixv208] +moduleMatches = 0xE159AE91 + +# change SetBaseFramePerSec(2) calls to SetBaseFramePerSec(1), fixes UI being too fast and allows ingame to go beyond 30FPS +# (SetBaseFramePerSec divides the number 60 by the parameter to get the target framerate, so 2 = 30FPS, 1 = 60FPS) +0x0219D7B0 = li r3, 1 # Main::init +0x02438340 = li r3, 1 # CDemoEventManager::TermRead() +0x02438864 = li r3, 1 # CDemoEventManager::ChangeFPS() + +# Set swap interval to 1 (needed since cemu 1.15.7) +0x02831FB4 = li r4, 1 +0x02833B00 = nop #nopesync + +#0x100995A8 = .float 200.0 + +[ZeldaMusou_JPNv16] +moduleMatches = 0xf290aea8 +#.origin = codecave + +#_fps: +#.float 120.0 + +#_fps60: +#lis r12, _fps@h +#stfs f0, _fps@l(r12) +#blr + + +#0x0221AB14 = bla _fps60 +#0x0221AB1C = nop #setFramePerSec +#0x0221AB7C = nop +#0x0221AB80 = bla _fps60 + +0x02788D24 = li r4, 1 +##0x02788570 = li r3, 1 # +0x0278A8F4 = nop # Uncomment to kill vsync +# +# +0x02186A2C = li r3, 1 # Main::init +## +#0x021BA474 = li r3, 1 #Mr, CViewModuleDefeat::lave Unstable +0x021C4148 = li r3, 1 #Mr, CViewModuleMgr::Term +0x021C6D88 = li r3, 1 #Mr, CViewModuleMotionLave +#0x0221AB18 = li r3, 1 #mr, CViewModuleDefeat infunction +# +#0x023FA0D4 = li r3, 1 # lvzCDemoEventManager switch to gameplay not neede with cor main? +#0x023F9BEC = li r3, 1 # CDemoEventManager::TermRead() +#0x023FA07C = li r3, 1 # CDemoEventManager::ChangeFPS() + diff --git a/Mods/HyruleWarriors_60FPS/patches.txt b/Mods/HyruleWarriors_60FPS/patches.txt deleted file mode 100644 index aa5e3acd..00000000 --- a/Mods/HyruleWarriors_60FPS/patches.txt +++ /dev/null @@ -1,40 +0,0 @@ -[HW60FPSFixv208] -moduleMatches = 0xE159AE91 - -# CInterMission::UpdateFrameCount() patch to halve the number of frames added, keeps the story intermission text + images in sync with the audio -# NOTE: NOT FRAMERATE INDEPENDENT - REQUIRES 60FPS! though you can probably mod it for higher framerates if you want - -# address of a float with constant 2.0 value (if you want, find one with 4.0 for 120fps) -_frameDivisor = 0x1009391C - -# luckily no need for a code-cave since UpdateFrameCount has a redundant 3 instruction load, which we can replace with our division code -0x02198378 = lis r12, 1 -0x0219837C = addi r12, r12, 0x4C48 -0x02198380 = lfsx f0, r11, r12 ; f0 = r11[0x14C48] (number of frames elapsed since last update?) -0x02198384 = lis r12, _frameDivisor@h -0x02198388 = lfs f13, _frameDivisor@l(r12) -0x0219838C = fdivs f0, f0, f13 ; halves number of elapsed frames -0x02198390 = lis r12, 1 ; 0x14C24 -0x02198394 = addi r12, r12, 0x4C24 -0x02198398 = lfsx f13, r11, r12 ; f13 = r11[0x14C24] (total number of frames elapsed / frame counter) -0x0219839C = fadds f13, f0, f13 ; add our modified count to the total count -0x021983A0 = lis r12, 1 ; 0x14C24 -0x021983A4 = addi r12, r12, 0x4C24 -0x021983A8 = stfsx f13, r11, r12 ; r11[0x14C24] = f13 (stores the modified total count), with the total count remaining in f13 for the later instructions to use - -# change SetBaseFramePerSec(2) calls to SetBaseFramePerSec(1), fixes UI being too fast and allows ingame to go beyond 30FPS -# (SetBaseFramePerSec divides the number 60 by the parameter to get the target framerate, so 2 = 30FPS, 1 = 60FPS) -0x0219D7B0 = li r3, 1 ; CMain::InitSys() -0x02438340 = li r3, 1 ; CDemoEventManager::TermRead() -0x02438864 = li r3, 1 ; CDemoEventManager::ChangeFPS() - -# SetBaseFramePerSec defaults, these get overridden by the above changes, but we'll change them anyway to be safe -0x10142EBC = .long 1 -0x10142EC0 = .long 60 -0x10142EC4 = .float 60.0 -0x10142EC8 = .long 1 -0x10142ECC = .long 60 -0x10142ED0 = .float 60.0 - -# Set swap interval to 1 (needed since cemu 1.15.7) -0x02831FB4 = li r4, 1 diff --git a/Mods/HyruleWarriors_60FPS/rules.txt b/Mods/HyruleWarriors_60FPS/rules.txt index 41a03de3..10cd6197 100644 --- a/Mods/HyruleWarriors_60FPS/rules.txt +++ b/Mods/HyruleWarriors_60FPS/rules.txt @@ -1,6 +1,6 @@ -[Definition] +[Definition] titleIds = 000500001017D800,000500001017D900,000500001017CD00 -name = 60FPS +name = 60 FPS # path = "Hyrule Warriors/Mods/60FPS" -description = Important: This patches the gameplay to be in 60fps. Getting under 60fps will slow down the game's speed. +description = Getting under 60fps will slow down the game's speed. version = 4