From 1ab25d5b4107d97826f172c0e317d8bb6b63ab94 Mon Sep 17 00:00:00 2001 From: Skyth <19259897+blueskythlikesclouds@users.noreply.github.com> Date: Fri, 13 Dec 2024 18:33:51 +0300 Subject: [PATCH] Update recompiler submodules. --- .../apu/driver/miniaudio_driver.cpp | 2 +- UnleashedRecomp/apu/driver/xaudio_driver.cpp | 2 +- UnleashedRecomp/framework.h | 6 --- UnleashedRecomp/kernel/io/file_system.cpp | 22 +++++----- UnleashedRecomp/kernel/xam.cpp | 44 +++++++++---------- UnleashedRecomp/main.cpp | 6 +-- UnleashedRecomp/misc_impl.cpp | 4 +- thirdparty/PowerRecomp | 2 +- thirdparty/ShaderRecomp | 2 +- vcpkg.json | 3 +- 10 files changed, 44 insertions(+), 49 deletions(-) diff --git a/UnleashedRecomp/apu/driver/miniaudio_driver.cpp b/UnleashedRecomp/apu/driver/miniaudio_driver.cpp index fb4ba39..5b806fd 100644 --- a/UnleashedRecomp/apu/driver/miniaudio_driver.cpp +++ b/UnleashedRecomp/apu/driver/miniaudio_driver.cpp @@ -35,7 +35,7 @@ void XAudioInitializeSystem() void XAudioRegisterClient(PPCFunc* callback, uint32_t param) { auto* pClientParam = static_cast(g_userHeap.Alloc(sizeof(param))); - ByteSwap(param); + ByteSwapInplace(param); *pClientParam = param; g_clientCallbackParam = g_memory.MapVirtual(pClientParam); g_clientCallback = callback; diff --git a/UnleashedRecomp/apu/driver/xaudio_driver.cpp b/UnleashedRecomp/apu/driver/xaudio_driver.cpp index a492e88..2e4e58e 100644 --- a/UnleashedRecomp/apu/driver/xaudio_driver.cpp +++ b/UnleashedRecomp/apu/driver/xaudio_driver.cpp @@ -96,7 +96,7 @@ void XAudioInitializeSystem() void XAudioRegisterClient(PPCFunc* callback, uint32_t param) { auto* pClientParam = static_cast(g_userHeap.Alloc(sizeof(param))); - ByteSwap(param); + ByteSwapInplace(param); *pClientParam = param; g_clientCallbackParam = g_memory.MapVirtual(pClientParam); diff --git a/UnleashedRecomp/framework.h b/UnleashedRecomp/framework.h index 8bff546..a823411 100644 --- a/UnleashedRecomp/framework.h +++ b/UnleashedRecomp/framework.h @@ -21,12 +21,6 @@ typedef returnType _##procName(__VA_ARGS__); \ _##procName* procName = (_##procName*)PROC_ADDRESS(libraryName, #procName); -template -inline void ByteSwap(T& value) -{ - value = std::byteswap(value); -} - template inline T RoundUp(const T& in_rValue, uint32_t in_round) { diff --git a/UnleashedRecomp/kernel/io/file_system.cpp b/UnleashedRecomp/kernel/io/file_system.cpp index 16c5ed4..956379c 100644 --- a/UnleashedRecomp/kernel/io/file_system.cpp +++ b/UnleashedRecomp/kernel/io/file_system.cpp @@ -134,11 +134,11 @@ uint32_t XFindFirstFileA(LPCSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData) if (handle == INVALID_HANDLE_VALUE) return 0xFFFFFFFF; - ByteSwap(data.dwFileAttributes); - ByteSwap(*(uint64_t*)&data.ftCreationTime); - ByteSwap(*(uint64_t*)&data.ftLastAccessTime); - ByteSwap(*(uint64_t*)&data.ftLastWriteTime); - ByteSwap(*(uint64_t*)&data.nFileSizeHigh); + ByteSwapInplace(data.dwFileAttributes); + ByteSwapInplace(*(uint64_t*)&data.ftCreationTime); + ByteSwapInplace(*(uint64_t*)&data.ftLastAccessTime); + ByteSwapInplace(*(uint64_t*)&data.ftLastWriteTime); + ByteSwapInplace(*(uint64_t*)&data.nFileSizeHigh); return GUEST_HANDLE(ObInsertObject(handle, FindHandleCloser)); } @@ -149,11 +149,11 @@ uint32_t XFindNextFileA(uint32_t Handle, LPWIN32_FIND_DATAA lpFindFileData) auto& data = *lpFindFileData; const auto result = FindNextFileA(handle, &data); - ByteSwap(data.dwFileAttributes); - ByteSwap(*(uint64_t*)&data.ftCreationTime); - ByteSwap(*(uint64_t*)&data.ftLastAccessTime); - ByteSwap(*(uint64_t*)&data.ftLastWriteTime); - ByteSwap(*(uint64_t*)&data.nFileSizeHigh); + ByteSwapInplace(data.dwFileAttributes); + ByteSwapInplace(*(uint64_t*)&data.ftCreationTime); + ByteSwapInplace(*(uint64_t*)&data.ftLastAccessTime); + ByteSwapInplace(*(uint64_t*)&data.ftLastWriteTime); + ByteSwapInplace(*(uint64_t*)&data.nFileSizeHigh); return result; } @@ -194,7 +194,7 @@ BOOL XWriteFile(uint32_t hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, L BOOL result = WriteFile((HANDLE)hFile, lpBuffer, nNumberOfBytesToWrite, lpNumberOfBytesWritten, nullptr); if (result && lpNumberOfBytesWritten != nullptr) - ByteSwap(*lpNumberOfBytesWritten); + ByteSwapInplace(*lpNumberOfBytesWritten); return result; } diff --git a/UnleashedRecomp/kernel/xam.cpp b/UnleashedRecomp/kernel/xam.cpp index 82a7324..9541b4d 100644 --- a/UnleashedRecomp/kernel/xam.cpp +++ b/UnleashedRecomp/kernel/xam.cpp @@ -144,7 +144,7 @@ SWA_API uint32_t XamShowMessageBoxUI(DWORD dwUserIndex, XWORD* wszTitle, XWORD* for (auto& text : texts) { for (size_t i = 0; i < text.size(); i++) - ByteSwap(text[i]); + ByteSwapInplace(text[i]); } for (size_t i = 0; i < cButtons; i++) @@ -305,14 +305,14 @@ SWA_API uint32_t XamInputGetCapabilities(uint32_t unk, uint32_t userIndex, uint3 if (result == ERROR_SUCCESS) { - ByteSwap(caps->Flags); - ByteSwap(caps->Gamepad.wButtons); - ByteSwap(caps->Gamepad.sThumbLX); - ByteSwap(caps->Gamepad.sThumbLY); - ByteSwap(caps->Gamepad.sThumbRX); - ByteSwap(caps->Gamepad.sThumbRY); - ByteSwap(caps->Vibration.wLeftMotorSpeed); - ByteSwap(caps->Vibration.wRightMotorSpeed); + ByteSwapInplace(caps->Flags); + ByteSwapInplace(caps->Gamepad.wButtons); + ByteSwapInplace(caps->Gamepad.sThumbLX); + ByteSwapInplace(caps->Gamepad.sThumbLY); + ByteSwapInplace(caps->Gamepad.sThumbRX); + ByteSwapInplace(caps->Gamepad.sThumbRY); + ByteSwapInplace(caps->Vibration.wLeftMotorSpeed); + ByteSwapInplace(caps->Vibration.wRightMotorSpeed); } return result; @@ -324,12 +324,12 @@ SWA_API uint32_t XamInputGetState(uint32_t userIndex, uint32_t flags, XAMINPUT_S if (result == ERROR_SUCCESS) { - ByteSwap(state->dwPacketNumber); - ByteSwap(state->Gamepad.wButtons); - ByteSwap(state->Gamepad.sThumbLX); - ByteSwap(state->Gamepad.sThumbLY); - ByteSwap(state->Gamepad.sThumbRX); - ByteSwap(state->Gamepad.sThumbRY); + ByteSwapInplace(state->dwPacketNumber); + ByteSwapInplace(state->Gamepad.wButtons); + ByteSwapInplace(state->Gamepad.sThumbLX); + ByteSwapInplace(state->Gamepad.sThumbLY); + ByteSwapInplace(state->Gamepad.sThumbRX); + ByteSwapInplace(state->Gamepad.sThumbRY); } else if (userIndex == 0) { @@ -377,11 +377,11 @@ SWA_API uint32_t XamInputGetState(uint32_t userIndex, uint32_t flags, XAMINPUT_S if (GetAsyncKeyState(VK_BACK) & 0x8000) state->Gamepad.wButtons |= XAMINPUT_GAMEPAD_BACK; - ByteSwap(state->Gamepad.wButtons); - ByteSwap(state->Gamepad.sThumbLX); - ByteSwap(state->Gamepad.sThumbLY); - ByteSwap(state->Gamepad.sThumbRX); - ByteSwap(state->Gamepad.sThumbRY); + ByteSwapInplace(state->Gamepad.wButtons); + ByteSwapInplace(state->Gamepad.sThumbLX); + ByteSwapInplace(state->Gamepad.sThumbLY); + ByteSwapInplace(state->Gamepad.sThumbRX); + ByteSwapInplace(state->Gamepad.sThumbRY); result = ERROR_SUCCESS; } @@ -391,8 +391,8 @@ SWA_API uint32_t XamInputGetState(uint32_t userIndex, uint32_t flags, XAMINPUT_S SWA_API uint32_t XamInputSetState(uint32_t userIndex, uint32_t flags, XAMINPUT_VIBRATION* vibration) { - ByteSwap(vibration->wLeftMotorSpeed); - ByteSwap(vibration->wRightMotorSpeed); + ByteSwapInplace(vibration->wLeftMotorSpeed); + ByteSwapInplace(vibration->wRightMotorSpeed); return hid::SetState(userIndex, vibration); } diff --git a/UnleashedRecomp/main.cpp b/UnleashedRecomp/main.cpp index 2dc8ab3..a847bee 100644 --- a/UnleashedRecomp/main.cpp +++ b/UnleashedRecomp/main.cpp @@ -94,20 +94,20 @@ void KiSystemStartup() uint32_t LdrLoadModule(const char* path) { auto loadResult = LoadFile(FileSystem::TransformPath(GAME_XEX_PATH)); - if (!loadResult.has_value()) + if (loadResult.empty()) { assert("Failed to load module" && false); return 0; } - auto* xex = reinterpret_cast(loadResult->data()); + auto* xex = reinterpret_cast(loadResult.data()); auto security = reinterpret_cast((char*)xex + xex->AddressOfSecurityInfo); g_memory.Alloc(security->ImageBase, security->SizeOfImage, MEM_COMMIT); auto format = Xex2FindOptionalHeader(xex, XEX_HEADER_FILE_FORMAT_INFO); auto entry = *Xex2FindOptionalHeader(xex, XEX_HEADER_ENTRY_POINT); - ByteSwap(entry); + ByteSwapInplace(entry); auto srcData = (char *)xex + xex->SizeOfHeader; auto destData = (char *)g_memory.Translate(security->ImageBase); diff --git a/UnleashedRecomp/misc_impl.cpp b/UnleashedRecomp/misc_impl.cpp index 451f001..a89f266 100644 --- a/UnleashedRecomp/misc_impl.cpp +++ b/UnleashedRecomp/misc_impl.cpp @@ -4,14 +4,14 @@ BOOL QueryPerformanceCounterImpl(LARGE_INTEGER* lpPerformanceCount) { BOOL result = QueryPerformanceCounter(lpPerformanceCount); - ByteSwap(lpPerformanceCount->QuadPart); + ByteSwapInplace(lpPerformanceCount->QuadPart); return result; } BOOL QueryPerformanceFrequencyImpl(LARGE_INTEGER* lpFrequency) { BOOL result = QueryPerformanceFrequency(lpFrequency); - ByteSwap(lpFrequency->QuadPart); + ByteSwapInplace(lpFrequency->QuadPart); return result; } diff --git a/thirdparty/PowerRecomp b/thirdparty/PowerRecomp index 02d23b3..847842c 160000 --- a/thirdparty/PowerRecomp +++ b/thirdparty/PowerRecomp @@ -1 +1 @@ -Subproject commit 02d23b3463ca2048a0d60f67e46df12fdba31369 +Subproject commit 847842cd28a2427b9db520d2aaa7416e5dec3822 diff --git a/thirdparty/ShaderRecomp b/thirdparty/ShaderRecomp index f936ed2..12b3814 160000 --- a/thirdparty/ShaderRecomp +++ b/thirdparty/ShaderRecomp @@ -1 +1 @@ -Subproject commit f936ed2212d8291439003eb0c0d8edc0ecafd24d +Subproject commit 12b38144b9ff5d131e0d30af22bd38607d07d9fd diff --git a/vcpkg.json b/vcpkg.json index 6771cfa..b1e348a 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -24,6 +24,7 @@ "magic-enum", "nativefiledialog-extended", "freetype", - "libvorbis" + "libvorbis", + "fmt" ] }