diff --git a/core/libs/prx/libSceAgcDriver/tests/Recorder.cpp b/core/libs/prx/libSceAgcDriver/tests/Recorder.cpp index fd907a1040..f2ab3c7593 100644 --- a/core/libs/prx/libSceAgcDriver/tests/Recorder.cpp +++ b/core/libs/prx/libSceAgcDriver/tests/Recorder.cpp @@ -11087,7 +11087,7 @@ void pipelineCacheHeaderTests(const Device& device) { Require(versionDirectory.native().size() >= 220 && versionDirectory.native().size() <= 249, "the pipeline cache directory is not between 220 and 249 characters"); #ifdef _WIN32 _putenv_s("ANYPS5_NO_SHADER_CACHE", "0"); - _putenv_s("ANYPS5_SHADER_CACHE_DIR", directory.string().c_str()); + _wputenv_s(L"ANYPS5_SHADER_CACHE_DIR", directory.c_str()); #else setenv("ANYPS5_NO_SHADER_CACHE", "0", 1); setenv("ANYPS5_SHADER_CACHE_DIR", directory.string().c_str(), 1); diff --git a/core/libs/prx/libSceAgcDriver/tests/execution/LazyResolvedAbi.cpp b/core/libs/prx/libSceAgcDriver/tests/execution/LazyResolvedAbi.cpp index aad7c87ddb..923ff59054 100644 --- a/core/libs/prx/libSceAgcDriver/tests/execution/LazyResolvedAbi.cpp +++ b/core/libs/prx/libSceAgcDriver/tests/execution/LazyResolvedAbi.cpp @@ -602,7 +602,11 @@ int main(int argc, char** argv) { std::filesystem::create_directories(cache); SetEnvironment("LAZY_RESOLVED_ABI_REFERENCE", reference.string()); SetEnvironment("ANYPS5_NO_SHADER_CACHE", "0"); +#ifdef _WIN32 + _wputenv_s(L"ANYPS5_SHADER_CACHE_DIR", cache.c_str()); +#else SetEnvironment("ANYPS5_SHADER_CACHE_DIR", cache.string()); +#endif SetEnvironment("APS5_NO_PIPELINE_JOURNAL", "1"); ClearEnvironment("APS5_LAZY_SHADER_PREPARE"); const std::string command = "\"" + std::string(argv[0]) + "\" --eager-reference"; diff --git a/core/libs/tests/GuestAudio3dPort.cpp b/core/libs/tests/GuestAudio3dPort.cpp index 5dea9e7bdd..0cc56ad6fd 100644 --- a/core/libs/tests/GuestAudio3dPort.cpp +++ b/core/libs/tests/GuestAudio3dPort.cpp @@ -16,6 +16,15 @@ #include #include #include +#ifdef _WIN32 +#ifndef NOMINMAX +#define NOMINMAX +#endif +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#endif namespace { @@ -655,11 +664,15 @@ int RunAsPs4Process(const char* program) { file << std::string("TITLE\0TITLE_ID\0\0\0\0\0\0", 20) << std::string("Example\0", 8) << "CUSA00000" << std::string("\0\0\0", 3); } #ifdef _WIN32 - const std::string command = "\"cd /d \"" + directory.string() + "\" && \"" + program + "\" ps4-process\""; + static_cast(program); + std::wstring executable(32768, L'\0'); + executable.resize(GetModuleFileNameW(nullptr, executable.data(), static_cast(executable.size()))); + const std::wstring command = L"\"cd /d \"" + directory.wstring() + L"\" && \"" + executable + L"\" ps4-process\""; + const int status = _wsystem(command.c_str()); #else const std::string command = "cd \"" + directory.string() + "\" && \"" + program + "\" ps4-process"; -#endif const int status = std::system(command.c_str()); +#endif std::filesystem::remove_all(directory); return status; } diff --git a/core/libs/tests/GuestKernelSysConsoleIdentity.cpp b/core/libs/tests/GuestKernelSysConsoleIdentity.cpp index dc953c7fbb..3dacd9e8b6 100644 --- a/core/libs/tests/GuestKernelSysConsoleIdentity.cpp +++ b/core/libs/tests/GuestKernelSysConsoleIdentity.cpp @@ -11,6 +11,15 @@ #include #include #include +#ifdef _WIN32 +#ifndef NOMINMAX +#define NOMINMAX +#endif +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include +#endif namespace { @@ -103,11 +112,14 @@ int main(int argc, char** argv) { file << std::string("TITLE\0TITLE_ID\0\0\0\0\0\0", 20) << std::string("Example\0", 8) << "CUSA00000" << std::string("\0\0\0", 3); } #ifdef _WIN32 - const std::string command = "\"cd /d \"" + directory.string() + "\" && \"" + argv[0] + "\" ps4-child\""; + std::wstring executable(32768, L'\0'); + executable.resize(GetModuleFileNameW(nullptr, executable.data(), static_cast(executable.size()))); + const std::wstring command = L"\"cd /d \"" + directory.wstring() + L"\" && \"" + executable + L"\" ps4-child\""; + const int status = _wsystem(command.c_str()); #else const std::string command = "cd \"" + directory.string() + "\" && \"" + argv[0] + "\" ps4-child"; -#endif const int status = std::system(command.c_str()); +#endif std::filesystem::remove_all(directory); Require(status == 0, "the PS4 child process must succeed"); return 0; diff --git a/core/libs/tests/GuestSyslog.cpp b/core/libs/tests/GuestSyslog.cpp index c0a954c07a..8d541a4401 100644 --- a/core/libs/tests/GuestSyslog.cpp +++ b/core/libs/tests/GuestSyslog.cpp @@ -1,5 +1,6 @@ #include "prx/libc/include/Api.hpp" #include "prx/libc/include/general/VabiMacros.hpp" +#include "tests/TemporaryFile.hpp" #include #include #include @@ -14,7 +15,7 @@ static void Require(bool value) { if (!value) std::abort(); } int main() { - auto* captured = std::tmpfile(); + auto* captured = TemporaryFile::Open(); Require(captured != nullptr); std::fflush(stderr); #ifdef _WIN32