diff --git a/core/libs/prx/libSceAgcDriver/CMakeLists.txt b/core/libs/prx/libSceAgcDriver/CMakeLists.txt index 83d79012a9..ef5cdb8cf6 100644 --- a/core/libs/prx/libSceAgcDriver/CMakeLists.txt +++ b/core/libs/prx/libSceAgcDriver/CMakeLists.txt @@ -2696,6 +2696,9 @@ add_executable(agc_pm4_replay EXCLUDE_FROM_ALL target_include_directories(agc_pm4_replay PRIVATE ${LIBS_INCLUDE_DIR}) target_link_libraries(agc_pm4_replay PRIVATE libSceAgcDriver libc) set_target_properties(agc_pm4_replay PROPERTIES CXX_EXTENSIONS OFF) +if(MINGW) + target_link_options(agc_pm4_replay PRIVATE -municode) +endif() configure_windows_unwind(agc_pm4_replay) if(BUILD_TESTING) diff --git a/core/libs/prx/libSceAgcDriver/tests/Pm4ReplayTool.cmake b/core/libs/prx/libSceAgcDriver/tests/Pm4ReplayTool.cmake index bc30109c2f..d578167acf 100644 --- a/core/libs/prx/libSceAgcDriver/tests/Pm4ReplayTool.cmake +++ b/core/libs/prx/libSceAgcDriver/tests/Pm4ReplayTool.cmake @@ -27,3 +27,12 @@ execute_process(COMMAND "${TOOL}" "${CAPTURE}/missing" RESULT_VARIABLE code OUTP if(NOT code STREQUAL "2" OR NOT errors MATCHES "cannot open") message(FATAL_ERROR "agc_pm4_replay exited with ${code} instead of 2 on a missing capture:\n${output}${errors}") endif() + +set(unicodeCapture "${CAPTURE}-ação-日本") +file(REMOVE_RECURSE "${unicodeCapture}") +file(COPY "${CAPTURE}/" DESTINATION "${unicodeCapture}") +execute_process(COMMAND "${TOOL}" "${unicodeCapture}" RESULT_VARIABLE code OUTPUT_VARIABLE output ERROR_VARIABLE errors) +file(REMOVE_RECURSE "${unicodeCapture}") +if(NOT code STREQUAL "1" OR NOT output MATCHES "unreleased 1\n") + message(FATAL_ERROR "agc_pm4_replay exited with ${code} on a copy of the capture under a non-ASCII path:\n${output}${errors}") +endif() diff --git a/core/libs/prx/libSceAgcDriver/tools/Pm4Replay.cpp b/core/libs/prx/libSceAgcDriver/tools/Pm4Replay.cpp index 7c44c8da28..742fab2a5c 100644 --- a/core/libs/prx/libSceAgcDriver/tools/Pm4Replay.cpp +++ b/core/libs/prx/libSceAgcDriver/tools/Pm4Replay.cpp @@ -1,4 +1,5 @@ #include "Pm4Analysis.hpp" +#include #include #include #include @@ -14,15 +15,15 @@ int usage() { return 2; } -} - -int main(int argc, char** argv) { +template +int run(int argc, TChar** argv) { + constexpr std::string_view Full = "--full"; std::filesystem::path directory; bool full = false; for (int index = 1; index < argc; ++index) { - const std::string_view argument = argv[index]; - if (argument == "--full") full = true; - else if (!argument.starts_with("-") && directory.empty()) directory = argument; + const std::basic_string_view argument = argv[index]; + if (std::ranges::equal(argument, Full)) full = true; + else if (!argument.starts_with(TChar('-')) && directory.empty()) directory = argument; else return usage(); } if (directory.empty()) return usage(); @@ -33,3 +34,15 @@ int main(int argc, char** argv) { return 2; } } + +} + +#ifdef _WIN32 +int wmain(int argc, wchar_t** argv) { + return run(argc, argv); +} +#else +int main(int argc, char** argv) { + return run(argc, argv); +} +#endif