Update recompiler submodules.

This commit is contained in:
Skyth 2024-12-13 18:33:51 +03:00
parent 6d1d5ff33a
commit 1ab25d5b41
10 changed files with 44 additions and 49 deletions

View file

@ -35,7 +35,7 @@ void XAudioInitializeSystem()
void XAudioRegisterClient(PPCFunc* callback, uint32_t param)
{
auto* pClientParam = static_cast<uint32_t*>(g_userHeap.Alloc(sizeof(param)));
ByteSwap(param);
ByteSwapInplace(param);
*pClientParam = param;
g_clientCallbackParam = g_memory.MapVirtual(pClientParam);
g_clientCallback = callback;

View file

@ -96,7 +96,7 @@ void XAudioInitializeSystem()
void XAudioRegisterClient(PPCFunc* callback, uint32_t param)
{
auto* pClientParam = static_cast<uint32_t*>(g_userHeap.Alloc(sizeof(param)));
ByteSwap(param);
ByteSwapInplace(param);
*pClientParam = param;
g_clientCallbackParam = g_memory.MapVirtual(pClientParam);

View file

@ -21,12 +21,6 @@
typedef returnType _##procName(__VA_ARGS__); \
_##procName* procName = (_##procName*)PROC_ADDRESS(libraryName, #procName);
template<typename T>
inline void ByteSwap(T& value)
{
value = std::byteswap(value);
}
template<typename T>
inline T RoundUp(const T& in_rValue, uint32_t in_round)
{

View file

@ -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;
}

View file

@ -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);
}

View file

@ -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<XEX_HEADER*>(loadResult->data());
auto* xex = reinterpret_cast<XEX_HEADER*>(loadResult.data());
auto security = reinterpret_cast<XEX2_SECURITY_INFO*>((char*)xex + xex->AddressOfSecurityInfo);
g_memory.Alloc(security->ImageBase, security->SizeOfImage, MEM_COMMIT);
auto format = Xex2FindOptionalHeader<XEX_FILE_FORMAT_INFO>(xex, XEX_HEADER_FILE_FORMAT_INFO);
auto entry = *Xex2FindOptionalHeader<uint32_t>(xex, XEX_HEADER_ENTRY_POINT);
ByteSwap(entry);
ByteSwapInplace(entry);
auto srcData = (char *)xex + xex->SizeOfHeader;
auto destData = (char *)g_memory.Translate(security->ImageBase);

View file

@ -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;
}

@ -1 +1 @@
Subproject commit 02d23b3463ca2048a0d60f67e46df12fdba31369
Subproject commit 847842cd28a2427b9db520d2aaa7416e5dec3822

@ -1 +1 @@
Subproject commit f936ed2212d8291439003eb0c0d8edc0ecafd24d
Subproject commit 12b38144b9ff5d131e0d30af22bd38607d07d9fd

View file

@ -24,6 +24,7 @@
"magic-enum",
"nativefiledialog-extended",
"freetype",
"libvorbis"
"libvorbis",
"fmt"
]
}