mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-04-28 05:11:37 +00:00
Fix Windows compilation errors & unicode converter crash.
This commit is contained in:
parent
d67ff448e2
commit
c9ef09b1ab
5 changed files with 22 additions and 7 deletions
|
|
@ -38,7 +38,6 @@ function(BIN2C)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
add_compile_options(
|
add_compile_options(
|
||||||
-ffp-model=strict
|
|
||||||
-march=sandybridge
|
-march=sandybridge
|
||||||
-fno-strict-aliasing
|
-fno-strict-aliasing
|
||||||
|
|
||||||
|
|
@ -53,6 +52,12 @@ add_compile_options(
|
||||||
-Wno-null-conversion
|
-Wno-null-conversion
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (WIN32)
|
||||||
|
add_compile_options(/fp:strict)
|
||||||
|
else()
|
||||||
|
add_compile_options(-ffp-model=strict)
|
||||||
|
endif()
|
||||||
|
|
||||||
add_compile_definitions(
|
add_compile_definitions(
|
||||||
SWA_IMPL
|
SWA_IMPL
|
||||||
SDL_MAIN_HANDLED
|
SDL_MAIN_HANDLED
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,10 @@
|
||||||
#include <user/config.h>
|
#include <user/config.h>
|
||||||
#include <os/logger.h>
|
#include <os/logger.h>
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <ntstatus.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
struct Event final : KernelObject, HostObject<XKEVENT>
|
struct Event final : KernelObject, HostObject<XKEVENT>
|
||||||
{
|
{
|
||||||
bool manualReset;
|
bool manualReset;
|
||||||
|
|
@ -1259,17 +1263,18 @@ uint32_t RtlMultiByteToUnicodeN(wchar_t* UnicodeString, uint32_t MaxBytesInUnico
|
||||||
MultiByteString, MultiByteString + BytesInMultiByteString
|
MultiByteString, MultiByteString + BytesInMultiByteString
|
||||||
);
|
);
|
||||||
|
|
||||||
uint32_t bytesRequired = static_cast<uint32_t>(wideString.size() * sizeof(wchar_t));
|
uint32_t bytesRequired = static_cast<uint32_t>((wideString.size() + 1) * sizeof(wchar_t));
|
||||||
|
|
||||||
uint32_t bytesToCopy = (bytesRequired > MaxBytesInUnicodeString)
|
uint32_t bytesToCopy = (bytesRequired > MaxBytesInUnicodeString)
|
||||||
? MaxBytesInUnicodeString
|
? MaxBytesInUnicodeString
|
||||||
: bytesRequired;
|
: bytesRequired;
|
||||||
|
|
||||||
memcpy(UnicodeString, wideString.data(), bytesToCopy);
|
memcpy(UnicodeString, wideString.data(), bytesToCopy);
|
||||||
for (size_t i = 0; i < bytesToCopy; i += sizeof(uint16_t))
|
for (size_t i = 0; i < bytesToCopy / 2; i++)
|
||||||
UnicodeString[i] = ByteSwap(UnicodeString[i]);
|
UnicodeString[i] = ByteSwap(UnicodeString[i]);
|
||||||
|
|
||||||
*BytesInUnicodeString = bytesToCopy;
|
if (BytesInUnicodeString != nullptr)
|
||||||
|
*BytesInUnicodeString = bytesToCopy;
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ public:
|
||||||
: 19; // DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1
|
: 19; // DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1
|
||||||
|
|
||||||
const DWORD useImmersiveDarkMode = isEnabled;
|
const DWORD useImmersiveDarkMode = isEnabled;
|
||||||
DwmSetWindowAttribute(s_handle, flag, &useImmersiveDarkMode, sizeof(useImmersiveDarkMode));
|
DwmSetWindowAttribute(s_renderWindow, flag, &useImmersiveDarkMode, sizeof(useImmersiveDarkMode));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,17 @@
|
||||||
project("UnleashedRecompLib")
|
project("UnleashedRecompLib")
|
||||||
|
|
||||||
add_compile_options(
|
add_compile_options(
|
||||||
-ffp-model=strict
|
|
||||||
-march=sandybridge
|
-march=sandybridge
|
||||||
-mlzcnt
|
-mlzcnt
|
||||||
-fno-strict-aliasing
|
-fno-strict-aliasing
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (WIN32)
|
||||||
|
add_compile_options(/fp:strict)
|
||||||
|
else()
|
||||||
|
add_compile_options(-ffp-model=strict)
|
||||||
|
endif()
|
||||||
|
|
||||||
target_compile_definitions(PowerRecomp PRIVATE CONFIG_FILE_PATH=\"${CMAKE_CURRENT_SOURCE_DIR}/config/SWA.toml\")
|
target_compile_definitions(PowerRecomp PRIVATE CONFIG_FILE_PATH=\"${CMAKE_CURRENT_SOURCE_DIR}/config/SWA.toml\")
|
||||||
|
|
||||||
set(SWA_PPC_RECOMPILED_SOURCES
|
set(SWA_PPC_RECOMPILED_SOURCES
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit 472f5cc4c69d232d759df6ddbd68032193804a94
|
Subproject commit 20bf4654480aad68940c2bf019f2fc7cdde60b79
|
||||||
Loading…
Add table
Reference in a new issue