From 24d257d42101745d737da6d63198ec5b84bb9336 Mon Sep 17 00:00:00 2001 From: Skyth <19259897+blueskythlikesclouds@users.noreply.github.com> Date: Sun, 27 Oct 2024 18:48:09 +0300 Subject: [PATCH] Fix a bunch of warnings. --- UnleashedRecomp/CMakeLists.txt | 17 +++++++++++++---- UnleashedRecomp/apu/driver/xaudio_driver.cpp | 16 ++++++++-------- UnleashedRecomp/cpu/code_cache.cpp | 6 +++--- UnleashedRecomp/gpu/video.cpp | 2 +- UnleashedRecomp/kernel/function.h | 2 -- UnleashedRecomp/kernel/imports.cpp | 2 +- UnleashedRecomp/kernel/io/file_system.cpp | 2 +- UnleashedRecomp/kernel/memory.cpp | 2 +- UnleashedRecomp/kernel/memory.h | 2 +- thirdparty/PowerRecomp | 2 +- 10 files changed, 30 insertions(+), 23 deletions(-) diff --git a/UnleashedRecomp/CMakeLists.txt b/UnleashedRecomp/CMakeLists.txt index d09d1fb..36cca31 100644 --- a/UnleashedRecomp/CMakeLists.txt +++ b/UnleashedRecomp/CMakeLists.txt @@ -2,9 +2,17 @@ project("UnleashedRecomp") set(TARGET_NAME "SWA") add_compile_options( - "/fp:strict" - "-march=sandybridge" - "-fno-strict-aliasing") + /fp:strict + -march=sandybridge + -fno-strict-aliasing + + -Wno-switch + -Wno-unused-function + -Wno-unused-variable + -Wno-unused-but-set-variable + -Wno-void-pointer-to-int-cast + -Wno-int-to-void-pointer-cast +) add_compile_definitions( SWA_IMPL @@ -127,7 +135,8 @@ target_link_libraries(UnleashedRecomp PRIVATE ) target_include_directories(UnleashedRecomp PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/api ${SWA_THIRDPARTY_ROOT}/ddspp ${Stb_INCLUDE_DIR} ) diff --git a/UnleashedRecomp/apu/driver/xaudio_driver.cpp b/UnleashedRecomp/apu/driver/xaudio_driver.cpp index 151c401..c305bf9 100644 --- a/UnleashedRecomp/apu/driver/xaudio_driver.cpp +++ b/UnleashedRecomp/apu/driver/xaudio_driver.cpp @@ -26,19 +26,19 @@ uint32_t g_audioFrameIndex = 0; class VoiceCallback : public IXAudio2VoiceCallback { - void OnVoiceProcessingPassStart(UINT32 BytesRequired) override {} - void OnVoiceProcessingPassEnd() override {} + STDMETHOD_(void, OnVoiceProcessingPassStart)(UINT32 BytesRequired) override {} + STDMETHOD_(void, OnVoiceProcessingPassEnd)() override {} - void OnBufferStart(void* pBufferContext) override {} - void OnBufferEnd(void* pBufferContext) override + STDMETHOD_(void, OnBufferStart)(void* pBufferContext) override {} + STDMETHOD_(void, OnBufferEnd)(void* pBufferContext) override { ReleaseSemaphore(g_audioSemaphore, 1, nullptr); } - void OnStreamEnd() override {} + STDMETHOD_(void, OnStreamEnd)() override {} - void OnLoopEnd(void* pBufferContext) override {} - void OnVoiceError(void* pBufferContext, HRESULT Error) override {} + STDMETHOD_(void, OnLoopEnd)(void* pBufferContext) override {} + STDMETHOD_(void, OnVoiceError)(void* pBufferContext, HRESULT Error) override {} } gVoiceCallback; PPC_FUNC(DriverLoop) @@ -57,7 +57,7 @@ PPC_FUNC(DriverLoop) WaitForSingleObject(g_audioSemaphore, INFINITE); ctx.r3.u64 = g_clientCallbackParam; - GuestCode::Run(g_clientCallback, &ctx); + GuestCode::Run((void*)g_clientCallback, &ctx); } } diff --git a/UnleashedRecomp/cpu/code_cache.cpp b/UnleashedRecomp/cpu/code_cache.cpp index f23a924..2175f0b 100644 --- a/UnleashedRecomp/cpu/code_cache.cpp +++ b/UnleashedRecomp/cpu/code_cache.cpp @@ -20,7 +20,7 @@ void CodeCache::Init() if (PPCFuncMappings[i].host != nullptr) { VirtualAlloc(bucket + PPCFuncMappings[i].guest * 2, sizeof(void*), MEM_COMMIT, PAGE_READWRITE); - *(void**)(bucket + PPCFuncMappings[i].guest * 2) = PPCFuncMappings[i].host; + *(void**)(bucket + PPCFuncMappings[i].guest * 2) = (void*)PPCFuncMappings[i].host; } } } @@ -38,10 +38,10 @@ void* CodeCache::Find(uint32_t guest) const SWA_API PPCFunc* KeFindHostFunction(uint32_t guest) { - return static_cast(g_codeCache.Find(guest)); + return reinterpret_cast(g_codeCache.Find(guest)); } SWA_API void KeInsertHostFunction(uint32_t guest, PPCFunc* function) { - g_codeCache.Insert(guest, function); + g_codeCache.Insert(guest, (const void*)function); } diff --git a/UnleashedRecomp/gpu/video.cpp b/UnleashedRecomp/gpu/video.cpp index f15f2aa..779d3a5 100644 --- a/UnleashedRecomp/gpu/video.cpp +++ b/UnleashedRecomp/gpu/video.cpp @@ -993,7 +993,7 @@ static uint32_t CreateDevice(uint32_t a1, uint32_t a2, uint32_t a3, uint32_t a4, auto device = g_userHeap.AllocPhysical(); memset(device, 0, sizeof(*device)); - uint32_t functionOffset = 'D3D'; + uint32_t functionOffset = 0x443344; // D3D g_codeCache.Insert(functionOffset, reinterpret_cast(GuestFunction)); for (size_t i = 0; i < _countof(device->setRenderStateFunctions); i++) diff --git a/UnleashedRecomp/kernel/function.h b/UnleashedRecomp/kernel/function.h index 089e5f8..14eb09c 100644 --- a/UnleashedRecomp/kernel/function.h +++ b/UnleashedRecomp/kernel/function.h @@ -119,7 +119,6 @@ constexpr std::array::value> GatherFunctionArguments { std::array::value> args{}; - int intOrdinal{}; int floatOrdinal{}; size_t i{}; @@ -135,7 +134,6 @@ constexpr std::array::value> GatherFunctionArguments } else { - intOrdinal++; args[i] = { 0, static_cast(i) }; // what the fuck } diff --git a/UnleashedRecomp/kernel/imports.cpp b/UnleashedRecomp/kernel/imports.cpp index 7b7d8c5..c760bec 100644 --- a/UnleashedRecomp/kernel/imports.cpp +++ b/UnleashedRecomp/kernel/imports.cpp @@ -1336,7 +1336,7 @@ void ExTerminateThread() uint32_t ExCreateThread(XLPDWORD handle, uint32_t stackSize, XLPDWORD threadId, uint32_t xApiThreadStartup, uint32_t startAddress, uint32_t startContext, uint32_t creationFlags) { - printf("ExCreateThread(): %x %x %x %x %x %x %x\n", handle, stackSize, threadId, xApiThreadStartup, startAddress, startContext, creationFlags); + printf("ExCreateThread(): %p %x %p %x %x %x %x\n", handle, stackSize, threadId, xApiThreadStartup, startAddress, startContext, creationFlags); DWORD hostThreadId; *handle = (uint32_t)GuestThread::Start(startAddress, startContext, creationFlags, &hostThreadId); diff --git a/UnleashedRecomp/kernel/io/file_system.cpp b/UnleashedRecomp/kernel/io/file_system.cpp index fa2cde5..7d5ded7 100644 --- a/UnleashedRecomp/kernel/io/file_system.cpp +++ b/UnleashedRecomp/kernel/io/file_system.cpp @@ -29,7 +29,7 @@ SWA_API uint32_t XCreateFileA( nullptr); GuestThread::SetLastError(GetLastError()); - printf("CreateFileA(%s, %x, %x, %x, %x, %x): %x\n", lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, handle); + printf("CreateFileA(%s, %lx, %lx, %p, %lx, %lx): %x\n", lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, handle); return handle; } diff --git a/UnleashedRecomp/kernel/memory.cpp b/UnleashedRecomp/kernel/memory.cpp index 1bb3d36..1e7b12e 100644 --- a/UnleashedRecomp/kernel/memory.cpp +++ b/UnleashedRecomp/kernel/memory.cpp @@ -24,7 +24,7 @@ void* Memory::Reserve(size_t offset, size_t size) return Alloc(offset, size, MEM_RESERVE); } -SWA_API void* MmGetHostAddress(uint32_t ptr) +void* MmGetHostAddress(uint32_t ptr) { return g_memory.Translate(ptr); } diff --git a/UnleashedRecomp/kernel/memory.h b/UnleashedRecomp/kernel/memory.h index d9a5af2..8cea4c4 100644 --- a/UnleashedRecomp/kernel/memory.h +++ b/UnleashedRecomp/kernel/memory.h @@ -25,5 +25,5 @@ public: } }; -SWA_API void* MmGetHostAddress(uint32_t ptr); +extern "C" void* MmGetHostAddress(uint32_t ptr); extern Memory g_memory; diff --git a/thirdparty/PowerRecomp b/thirdparty/PowerRecomp index 6810be7..a7c970d 160000 --- a/thirdparty/PowerRecomp +++ b/thirdparty/PowerRecomp @@ -1 +1 @@ -Subproject commit 6810be731556182e939ad29f51c3e7b13d7ab491 +Subproject commit a7c970d32497b7f1624a2871fdd67435d724b1ef