diff --git a/Core/MIPS/IR/IRCompVFPU.cpp b/Core/MIPS/IR/IRCompVFPU.cpp index 8638abae0b..af89d6cb47 100644 --- a/Core/MIPS/IR/IRCompVFPU.cpp +++ b/Core/MIPS/IR/IRCompVFPU.cpp @@ -333,7 +333,6 @@ namespace MIPSComp { case 53: // lvl/lvr.q - highly unusual case 61: // svl/svr.q - highly unusual - logBlocks = 1; DISABLE; break; diff --git a/Core/System.cpp b/Core/System.cpp index 0e223ad79d..cc41c39313 100644 --- a/Core/System.cpp +++ b/Core/System.cpp @@ -29,6 +29,7 @@ #include #include +#include "base/timeutil.h" #include "math/math_util.h" #include "thread/threadutil.h" #include "util/text/utf8.h" @@ -465,7 +466,8 @@ bool PSP_Init(const CoreParameter &coreParam, std::string *error_string) { CPU_WaitStatus(cpuThreadReplyCond, &CPU_IsReady); } - PSP_InitUpdate(error_string); + while (!PSP_InitUpdate(error_string)) + sleep_ms(10); return pspIsInited; } diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index bef66c4c0f..34fec613b6 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -1219,14 +1219,7 @@ void DeveloperToolsScreen::CreateViews() { Choice *cpuTests = new Choice(dev->T("Run CPU Tests")); list->Add(cpuTests)->OnClick.Handle(this, &DeveloperToolsScreen::OnRunCPUTests); -#ifdef IOS - const std::string testDirectory = g_Config.flash0Directory + "../"; -#else - const std::string testDirectory = g_Config.memStickDirectory; -#endif - if (!File::Exists(testDirectory + "pspautotests/tests/")) { - cpuTests->SetEnabled(false); - } + cpuTests->SetEnabled(TestsAvailable()); #endif list->Add(new CheckBox(&g_Config.bEnableLogging, dev->T("Enable Logging")))->OnClick.Handle(this, &DeveloperToolsScreen::OnLoggingChanged); diff --git a/android/jni/TestRunner.cpp b/android/jni/TestRunner.cpp index 29ca2b2a0c..c58aa8e9e4 100644 --- a/android/jni/TestRunner.cpp +++ b/android/jni/TestRunner.cpp @@ -25,11 +25,12 @@ #include #include +#include "ppsspp_config.h" #include "base/basictypes.h" #include "base/display.h" #include "base/logging.h" -#include "gfx/gl_common.h" +#include "Common/FileUtil.h" #include "Core/Core.h" #include "Core/System.h" #include "Core/Config.h" @@ -58,21 +59,37 @@ static std::string TrimNewlines(const std::string &s) { return s.substr(0, p + 1); } -void RunTests() -{ +bool TestsAvailable() { +#ifdef IOS + std::string testDirectory = g_Config.flash0Directory + "../"; +#else + std::string testDirectory = g_Config.memStickDirectory; +#endif + // Hack to easily run the tests on Windows from the submodule + if (File::IsDirectory("../pspautotests")) { + testDirectory = "../"; + } + return File::Exists(testDirectory + "pspautotests/tests/"); +} + +bool RunTests() { std::string output; #ifdef IOS - const std::string baseDirectory = g_Config.flash0Directory + "../"; + std::string baseDirectory = g_Config.flash0Directory + "../"; #else - const std::string baseDirectory = g_Config.memStickDirectory; + std::string baseDirectory = g_Config.memStickDirectory; + // Hack to easily run the tests on Windows from the submodule + if (File::IsDirectory("../pspautotests")) { + baseDirectory = "../"; + } #endif CoreParameter coreParam; coreParam.cpuCore = (CPUCore)g_Config.iCpuCore; - coreParam.gpuCore = g_Config.bSoftwareRendering ? GPUCORE_SOFTWARE : GPUCORE_GLES; + coreParam.gpuCore = GPUCORE_NULL; coreParam.enableSound = g_Config.bEnableSound; - coreParam.graphicsContext = PSP_CoreParameter().graphicsContext; + coreParam.graphicsContext = nullptr; coreParam.mountIso = ""; coreParam.mountRoot = baseDirectory + "pspautotests/"; coreParam.startPaused = false; @@ -95,17 +112,20 @@ void RunTests() coreParam.fileToStart = baseDirectory + "pspautotests/tests/" + testName + ".prx"; std::string expectedFile = baseDirectory + "pspautotests/tests/" + testName + ".expected"; - ILOG("Preparing to execute %s", testName); + ILOG("Preparing to execute '%s'", testName); std::string error_string; output = ""; if (!PSP_Init(coreParam, &error_string)) { ELOG("Failed to init unittest %s : %s", testsToRun[i], error_string.c_str()); PSP_CoreParameter().pixelWidth = pixel_xres; PSP_CoreParameter().pixelHeight = pixel_yres; - return; + return false; } + PSP_BeginHostFrame(); + // Run the emu until the test exits + ILOG("Test: Entering runloop."); while (true) { int blockTicks = usToCycles(1000000 / 10); while (coreState == CORE_RUNNING) { @@ -120,6 +140,7 @@ void RunTests() break; } } + PSP_EndHostFrame(); std::ifstream expected(expectedFile.c_str(), std::ios_base::in); if (!expected) { @@ -152,9 +173,9 @@ void RunTests() } PSP_Shutdown(); } - glViewport(0,0,pixel_xres,pixel_yres); PSP_CoreParameter().pixelWidth = pixel_xres; PSP_CoreParameter().pixelHeight = pixel_yres; PSP_CoreParameter().headLess = false; g_Config.sReportHost = savedReportHost; + return true; // Managed to execute the tests. Says nothing about the result. } diff --git a/android/jni/TestRunner.h b/android/jni/TestRunner.h index 50f4546a6f..b7bd7f53c8 100644 --- a/android/jni/TestRunner.h +++ b/android/jni/TestRunner.h @@ -17,4 +17,5 @@ #pragma once -void RunTests(); +bool RunTests(); +bool TestsAvailable();