From 20de40a59792bdf7ba6d52022c6057befaa2a42a Mon Sep 17 00:00:00 2001 From: Stenzek Date: Mon, 20 Nov 2023 20:56:21 +1000 Subject: [PATCH] RegTest: Fix build on Mac --- scripts/run_regression_tests.py | 2 +- src/core/cpu_newrec_compiler.cpp | 1 + src/core/cpu_recompiler_code_generator.cpp | 11 ++++++----- src/core/pgxp.cpp | 2 +- src/duckstation-nogui/CMakeLists.txt | 2 ++ src/duckstation-regtest/CMakeLists.txt | 2 ++ src/duckstation-regtest/regtest_host.cpp | 14 ++++++++------ 7 files changed, 21 insertions(+), 13 deletions(-) diff --git a/scripts/run_regression_tests.py b/scripts/run_regression_tests.py index ff0eb2498..2d1fd169b 100644 --- a/scripts/run_regression_tests.py +++ b/scripts/run_regression_tests.py @@ -41,7 +41,7 @@ def run_regression_tests(runner, gamedir, destdir, dump_interval, frames, parall if parallel <= 1: for game in gamepaths: - run_regression_test(runner, destdir, dump_interval, frames, game) + run_regression_test(runner, destdir, dump_interval, frames, renderer, game) else: print("Processing %u games on %u processors" % (len(gamepaths), parallel)) func = partial(run_regression_test, runner, destdir, dump_interval, frames, renderer) diff --git a/src/core/cpu_newrec_compiler.cpp b/src/core/cpu_newrec_compiler.cpp index 26a413de0..02032e16d 100644 --- a/src/core/cpu_newrec_compiler.cpp +++ b/src/core/cpu_newrec_compiler.cpp @@ -991,6 +991,7 @@ bool CPU::NewRec::Compiler::TryRenameMIPSReg(Reg to, Reg from, u32 fromhost, Reg // remove all references to renamed-to register DeleteMIPSReg(to, false); + CancelLoadDelaysToReg(to); // and do the actual rename, new register has been modified. m_host_regs[fromhost].reg = to; diff --git a/src/core/cpu_recompiler_code_generator.cpp b/src/core/cpu_recompiler_code_generator.cpp index c7f1d746c..3ed3d5efd 100644 --- a/src/core/cpu_recompiler_code_generator.cpp +++ b/src/core/cpu_recompiler_code_generator.cpp @@ -972,6 +972,10 @@ void CodeGenerator::GenerateExceptionExit(Instruction instruction, const CodeCac void CodeGenerator::BlockPrologue() { +#if 0 + EmitFunctionCall(nullptr, &CodeCache::LogCurrentState); +#endif + InitSpeculativeRegs(); if (m_block->protection == CodeCache::PageProtectionMode::ManualCheck) @@ -992,10 +996,6 @@ void CodeGenerator::BlockPrologue() EmitFunctionCall(nullptr, &CPU::HandleB0Syscall); } -#if 0 - EmitFunctionCall(nullptr, &CodeCache::LogCurrentState); -#endif - if (m_block->uncached_fetch_ticks > 0 || m_block->icache_line_count > 0) EmitICacheCheckAndUpdate(); @@ -2745,7 +2745,8 @@ bool CodeGenerator::Compile_cop0(Instruction instruction, const CodeCache::Instr EmitBranch(GetCurrentFarCodePointer()); SwitchToFarCode(); m_register_cache.PushState(); - WriteNewPC(CalculatePC(), false); + if (!info.is_last_instruction) + WriteNewPC(CalculatePC(), false); EmitStoreCPUStructField(offsetof(State, downcount), Value::FromConstantU32(0)); EmitExceptionExit(); m_register_cache.PopState(); diff --git a/src/core/pgxp.cpp b/src/core/pgxp.cpp index 5fb5f0176..68629d304 100644 --- a/src/core/pgxp.cpp +++ b/src/core/pgxp.cpp @@ -134,7 +134,7 @@ ALWAYS_INLINE_RELEASE void MaskValidate(PGXP_value* pV, u32 psxV, u32 mask, u32 ALWAYS_INLINE_RELEASE double f16Sign(double in) { - const s32 s = static_cast(static_cast(in * (USHRT_MAX + 1))); + const s32 s = static_cast(static_cast(in * (USHRT_MAX + 1))); return static_cast(s) / static_cast(USHRT_MAX + 1); } ALWAYS_INLINE_RELEASE double f16Unsign(double in) diff --git a/src/duckstation-nogui/CMakeLists.txt b/src/duckstation-nogui/CMakeLists.txt index ecb12b7ca..2615eed09 100644 --- a/src/duckstation-nogui/CMakeLists.txt +++ b/src/duckstation-nogui/CMakeLists.txt @@ -7,6 +7,8 @@ add_executable(duckstation-nogui target_precompile_headers(duckstation-nogui PRIVATE "pch.h") target_link_libraries(duckstation-nogui PRIVATE core util common imgui scmversion) +add_core_resources(duckstation-nogui) + if(WIN32) message(STATUS "Building Win32 NoGUI Platform.") target_sources(duckstation-nogui PRIVATE diff --git a/src/duckstation-regtest/CMakeLists.txt b/src/duckstation-regtest/CMakeLists.txt index 5555e0918..47a6903bb 100644 --- a/src/duckstation-regtest/CMakeLists.txt +++ b/src/duckstation-regtest/CMakeLists.txt @@ -3,3 +3,5 @@ add_executable(duckstation-regtest ) target_link_libraries(duckstation-regtest PRIVATE core common scmversion) + +add_core_resources(duckstation-regtest) \ No newline at end of file diff --git a/src/duckstation-regtest/regtest_host.cpp b/src/duckstation-regtest/regtest_host.cpp index fd5931525..974ba5ad9 100644 --- a/src/duckstation-regtest/regtest_host.cpp +++ b/src/duckstation-regtest/regtest_host.cpp @@ -53,13 +53,15 @@ bool RegTestHost::SetFolders() EmuFolders::AppRoot = Path::Canonicalize(Path::GetDirectory(program_path)); EmuFolders::DataRoot = EmuFolders::AppRoot; -#ifndef __APPLE__ +#ifdef __APPLE__ + static constexpr char MAC_DATA_DIR[] = "Library/Application Support/DuckStation"; + const char* home_dir = getenv("HOME"); + if (home_dir) + EmuFolders::DataRoot = Path::Combine(home_dir, MAC_DATA_DIR); +#endif + // On Windows/Linux, these are in the binary directory. EmuFolders::Resources = Path::Combine(EmuFolders::AppRoot, "resources"); -#else - // On macOS, this is in the bundle resources directory. - EmuFolders::Resources = Path::Canonicalize(Path::Combine(EmuFolders::AppRoot, "../Resources")); -#endif Log_DevPrintf("AppRoot Directory: %s", EmuFolders::AppRoot.c_str()); Log_DevPrintf("DataRoot Directory: %s", EmuFolders::DataRoot.c_str()); @@ -71,7 +73,7 @@ bool RegTestHost::SetFolders() // the resources directory should exist, bail out if not if (!FileSystem::DirectoryExists(EmuFolders::Resources.c_str())) { - Log_ErrorPrintf("Error", "Resources directory is missing, your installation is incomplete."); + Log_ErrorPrint("Resources directory is missing, your installation is incomplete."); return false; }