From 5876c2b65820df6b92d07d467f7d812e7e90f257 Mon Sep 17 00:00:00 2001 From: Skyth <19259897+blueskythlikesclouds@users.noreply.github.com> Date: Wed, 4 Dec 2024 12:48:38 +0300 Subject: [PATCH 1/3] Add missing files. --- UnleashedRecomp/CMakeLists.txt | 1 + UnleashedRecomp/framework.h | 9 ++++++++- UnleashedRecomp/kernel/platform.cpp | 24 ++++++++++++++++++++++++ UnleashedRecomp/kernel/platform.h | 11 +++++++++++ 4 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 UnleashedRecomp/kernel/platform.cpp create mode 100644 UnleashedRecomp/kernel/platform.h diff --git a/UnleashedRecomp/CMakeLists.txt b/UnleashedRecomp/CMakeLists.txt index 26909056..72975fd8 100644 --- a/UnleashedRecomp/CMakeLists.txt +++ b/UnleashedRecomp/CMakeLists.txt @@ -41,6 +41,7 @@ set(SWA_KERNEL_CXX_SOURCES "kernel/xdm.cpp" "kernel/heap.cpp" "kernel/memory.cpp" + "kernel/platform.cpp" "kernel/xam.cpp" "kernel/io/file_system.cpp" ) diff --git a/UnleashedRecomp/framework.h b/UnleashedRecomp/framework.h index a8a87599..e870fec3 100644 --- a/UnleashedRecomp/framework.h +++ b/UnleashedRecomp/framework.h @@ -14,6 +14,13 @@ #define SWA_API extern "C" SWA_DLLIMPORT #endif +#define PROC_ADDRESS(libraryName, procName) \ + GetProcAddress(LoadLibrary(TEXT(libraryName)), procName) + +#define LIB_FUNCTION(returnType, libraryName, procName, ...) \ + typedef returnType _##procName(__VA_ARGS__); \ + _##procName* procName = (_##procName*)PROC_ADDRESS(libraryName, #procName); + template void ByteSwap(T& value) { @@ -66,4 +73,4 @@ constexpr size_t FirstBitLow(TValue value) } return 0; -} \ No newline at end of file +} diff --git a/UnleashedRecomp/kernel/platform.cpp b/UnleashedRecomp/kernel/platform.cpp new file mode 100644 index 00000000..97c072f4 --- /dev/null +++ b/UnleashedRecomp/kernel/platform.cpp @@ -0,0 +1,24 @@ +#include + +#if _WIN32 +LIB_FUNCTION(LONG, "ntdll.dll", RtlGetVersion, PRTL_OSVERSIONINFOW); +#endif + +PlatformVersion GetPlatformVersion() +{ + auto result = PlatformVersion{}; + +#if _WIN32 + OSVERSIONINFOEXW osvi = { 0 }; + osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXW); + + if (RtlGetVersion((PRTL_OSVERSIONINFOW)&osvi) != 0) + return result; + + result.Major = osvi.dwMajorVersion; + result.Minor = osvi.dwMinorVersion; + result.Build = osvi.dwBuildNumber; +#endif + + return result; +} diff --git a/UnleashedRecomp/kernel/platform.h b/UnleashedRecomp/kernel/platform.h new file mode 100644 index 00000000..a03379a1 --- /dev/null +++ b/UnleashedRecomp/kernel/platform.h @@ -0,0 +1,11 @@ +#pragma once + +struct PlatformVersion +{ +public: + uint32_t Major{}; + uint32_t Minor{}; + uint32_t Build{}; +}; + +extern PlatformVersion GetPlatformVersion(); From b4296ff7019d1a7282ec2031db8672a5238c1c93 Mon Sep 17 00:00:00 2001 From: Skyth <19259897+blueskythlikesclouds@users.noreply.github.com> Date: Wed, 4 Dec 2024 12:48:46 +0300 Subject: [PATCH 2/3] Update PowerRecomp submodule. --- thirdparty/PowerRecomp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thirdparty/PowerRecomp b/thirdparty/PowerRecomp index 675b482e..02d23b34 160000 --- a/thirdparty/PowerRecomp +++ b/thirdparty/PowerRecomp @@ -1 +1 @@ -Subproject commit 675b482ec4852b873590fb999d24b426bade2b3a +Subproject commit 02d23b3463ca2048a0d60f67e46df12fdba31369 From b0562b43609ae0325b99ed4ba29d363c0cddf40d Mon Sep 17 00:00:00 2001 From: Hyper <34012267+hyperbx@users.noreply.github.com> Date: Fri, 6 Dec 2024 13:45:17 +0000 Subject: [PATCH 3/3] Remove storage device prompt on new game MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A.K.A. The Fucking Thing™️ --- UnleashedRecomp/patches/misc_patches.cpp | 2 ++ UnleashedRecompLib/config/SWA.toml | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/UnleashedRecomp/patches/misc_patches.cpp b/UnleashedRecomp/patches/misc_patches.cpp index 3a523ef4..1caac4b3 100644 --- a/UnleashedRecomp/patches/misc_patches.cpp +++ b/UnleashedRecomp/patches/misc_patches.cpp @@ -32,6 +32,8 @@ void WerehogBattleMusicMidAsmHook(PPCRegister& r11) r11.u8 = 3; } +void StorageDevicePromptMidAsmHook() {} + /* Hook function that gets the game region and force result to zero for Japanese to display the correct logos. */ diff --git a/UnleashedRecompLib/config/SWA.toml b/UnleashedRecompLib/config/SWA.toml index 0e2e975e..a3c67743 100644 --- a/UnleashedRecompLib/config/SWA.toml +++ b/UnleashedRecompLib/config/SWA.toml @@ -447,3 +447,9 @@ registers = ["r1", "r29"] name = "GetDatabaseDataMidAsmHook" address = 0x827D6018 # Particle Material XML registers = ["r1", "r30"] + +# Removes the storage device prompt on new game +[[midasm_hook]] +name = "StorageDevicePromptMidAsmHook" +address = 0x822C53CC +jump_address = 0x822C53F8