diff --git a/pcsx2/CDVD/CDVD.cpp b/pcsx2/CDVD/CDVD.cpp index 62535d754d..14a47044ec 100644 --- a/pcsx2/CDVD/CDVD.cpp +++ b/pcsx2/CDVD/CDVD.cpp @@ -35,6 +35,12 @@ #include "Recording/InputRecording.h" #endif +#ifndef PCSX2_CORE +#include "System/SysThreads.h" +#else +#include "VMManager.h" +#endif + // This typically reflects the Sony-assigned serial code for the Disc, if one exists. // (examples: SLUS-2113, etc). // If the disc is homebrew then it probably won't have a valid serial; in which case @@ -492,8 +498,18 @@ void cdvdReloadElfInfo(wxString elfoverride) } catch (Exception::FileNotFound& e) { +#ifdef PCSX2_CORE + Console.Error("Failed to load ELF info"); + LastELF.clear(); + DiscSerial.clear(); + ElfCRC = 0; + ElfEntry = 0; + ElfTextRange = {}; + return; +#else pxFail("Not in my back yard!"); Cpu->ThrowException(e); +#endif } } @@ -2146,7 +2162,11 @@ static void cdvdWrite16(u8 rt) // SCOMMAND case 0x0F: // sceCdPowerOff (0:1)- Call74 from Xcdvdman Console.WriteLn(Color_StrongBlack, "sceCdPowerOff called. Resetting VM."); +#ifndef PCSX2_CORE GetCoreThread().Reset(); +#else + VMManager::Reset(); +#endif break; case 0x12: // sceCdReadILinkId (0:9) diff --git a/pcsx2/CDVD/GzippedFileReader.cpp b/pcsx2/CDVD/GzippedFileReader.cpp index d2a996520d..642be669dd 100644 --- a/pcsx2/CDVD/GzippedFileReader.cpp +++ b/pcsx2/CDVD/GzippedFileReader.cpp @@ -173,9 +173,13 @@ static void TestTemplate(const wxDirName &base, const wxString &fname, bool canE static std::string iso2indexname(const std::string& isoname) { +#ifndef PCSX2_CORE //testTemplate(isoname); wxDirName appRoot = // TODO: have only one of this in PCSX2. Right now have few... (wxDirName)(wxFileName(wxStandardPaths::Get().GetExecutablePath()).GetPath()); +#else + const wxDirName& appRoot = EmuFolders::DataRoot; +#endif //TestTemplate(appRoot, isoname, false); return StringUtil::wxStringToUTF8String(ApplyTemplate(L"gzip index", appRoot, EmuConfig.GzipIsoIndexTemplate, isoname, false)); } diff --git a/pcsx2/DebugTools/Breakpoints.cpp b/pcsx2/DebugTools/Breakpoints.cpp index 3191834ef1..f69314ea70 100644 --- a/pcsx2/DebugTools/Breakpoints.cpp +++ b/pcsx2/DebugTools/Breakpoints.cpp @@ -408,8 +408,10 @@ const std::vector CBreakPoints::GetBreakpoints() } // including them earlier causes some ambiguities +#ifndef PCSX2_CORE #include "gui/App.h" #include "gui/Debugger/DisassemblyDialog.h" +#endif void CBreakPoints::Update(BreakPointCpu cpu, u32 addr) { @@ -427,7 +429,10 @@ void CBreakPoints::Update(BreakPointCpu cpu, u32 addr) if (resume) r5900Debug.resumeCpu(); + +#ifndef PCSX2_CORE auto disassembly_window = wxGetApp().GetDisassemblyPtr(); if (disassembly_window) // make sure that valid pointer is recieved to prevent potential NULL dereference. disassembly_window->update(); +#endif } diff --git a/pcsx2/DebugTools/DebugInterface.cpp b/pcsx2/DebugTools/DebugInterface.cpp index eeedeb33af..19ea388c27 100644 --- a/pcsx2/DebugTools/DebugInterface.cpp +++ b/pcsx2/DebugTools/DebugInterface.cpp @@ -167,26 +167,38 @@ private: bool DebugInterface::isAlive() { +#ifndef PCSX2_CORE return GetCoreThread().IsOpen() && g_FrameCount > 0; +#else + return false; +#endif } bool DebugInterface::isCpuPaused() { +#ifndef PCSX2_CORE return GetCoreThread().IsPaused(); +#else + return false; +#endif } void DebugInterface::pauseCpu() { +#ifndef PCSX2_CORE SysCoreThread& core = GetCoreThread(); if (!core.IsPaused()) core.Pause({}, true); +#endif } void DebugInterface::resumeCpu() { +#ifndef PCSX2_CORE SysCoreThread& core = GetCoreThread(); if (core.IsPaused()) core.Resume(); +#endif } diff --git a/pcsx2/Elfheader.cpp b/pcsx2/Elfheader.cpp index 7edf8485d2..9279fd52f7 100644 --- a/pcsx2/Elfheader.cpp +++ b/pcsx2/Elfheader.cpp @@ -20,7 +20,10 @@ #include "GS.h" // for sending game crc to mtgs #include "Elfheader.h" #include "DebugTools/SymbolMap.h" + +#ifndef PCSX2_CORE #include "gui/AppCoreThread.h" +#endif u32 ElfCRC; u32 ElfEntry; @@ -353,7 +356,9 @@ int GetPS2ElfName( wxString& name ) else if( parts.lvalue == L"VER" ) { Console.WriteLn( Color_Blue, L"(SYSTEM.CNF) Software version = " + parts.rvalue ); +#ifndef PCSX2_CORE GameInfo::gameVersion = parts.rvalue; +#endif } } diff --git a/pcsx2/Interpreter.cpp b/pcsx2/Interpreter.cpp index 1f51f12ff0..ca4e842d43 100644 --- a/pcsx2/Interpreter.cpp +++ b/pcsx2/Interpreter.cpp @@ -19,7 +19,11 @@ #include "R5900OpcodeTables.h" #include "R5900Exceptions.h" +#ifndef PCSX2_CORE #include "System/SysThreads.h" +#else +#include "VMManager.h" +#endif #include "Elfheader.h" @@ -60,7 +64,9 @@ void intBreakpoint(bool memcheck) } CBreakPoints::SetBreakpointTriggered(true); +#ifndef PCSX2_CORE GetCoreThread().PauseSelfDebug(); +#endif throw Exception::ExitCpuExecute(); } @@ -582,8 +588,13 @@ static void intExecute() static void intCheckExecutionState() { +#ifndef PCSX2_CORE if( GetCoreThread().HasPendingStateChangeRequest() ) throw Exception::ExitCpuExecute(); +#else + if (VMManager::Internal::IsExecutionInterrupted()) + throw Exception::ExitCpuExecute(); +#endif } static void intStep() diff --git a/pcsx2/MemoryCardFile.cpp b/pcsx2/MemoryCardFile.cpp index aaab745a06..8e2ab86c6c 100644 --- a/pcsx2/MemoryCardFile.cpp +++ b/pcsx2/MemoryCardFile.cpp @@ -316,9 +316,11 @@ void FileMemoryCard::Open() if (!Create(str, 8)) { +#ifndef PCSX2_CORE Msgbox::Alert( wxsFormat(_("Could not create a memory card: \n\n%s\n\n"), str.c_str()) + GetDisabledMessage(slot)); +#endif } } @@ -345,9 +347,11 @@ void FileMemoryCard::Open() { // Translation note: detailed description should mention that the memory card will be disabled // for the duration of this session. +#ifndef PCSX2_CORE Msgbox::Alert( wxsFormat(_("Access denied to memory card: \n\n%s\n\n"), str.c_str()) + GetDisabledMessage(slot)); +#endif } else // Load checksum { diff --git a/pcsx2/Patch.h b/pcsx2/Patch.h index 59044a8d68..d3f3db205e 100644 --- a/pcsx2/Patch.h +++ b/pcsx2/Patch.h @@ -126,8 +126,10 @@ extern void ForgetLoadedPatches(); extern const IConsoleWriter *PatchesCon; +#ifndef PCSX2_CORE // Patch loading is verbose only once after the crc changes, this makes it think that the crc changed. extern void PatchesVerboseReset(); +#endif // The following prototypes seem unused in PCSX2, but maybe part of the cheats browser? // regardless, they don't seem to have an implementation anywhere. diff --git a/pcsx2/R3000AInterpreter.cpp b/pcsx2/R3000AInterpreter.cpp index b15ca2b0c5..6f62fad37f 100644 --- a/pcsx2/R3000AInterpreter.cpp +++ b/pcsx2/R3000AInterpreter.cpp @@ -17,7 +17,7 @@ #include "PrecompiledHeader.h" #include "IopCommon.h" #include "Config.h" -#include "gui/AppCoreThread.h" +#include "System/SysThreads.h" #include "R5900OpcodeTables.h" #include "DebugTools/Breakpoints.h" @@ -141,7 +141,9 @@ void psxBreakpoint(bool memcheck) } CBreakPoints::SetBreakpointTriggered(true); +#ifndef PCSX2_CORE GetCoreThread().PauseSelfDebug(); +#endif throw Exception::ExitCpuExecute(); } diff --git a/pcsx2/R5900.cpp b/pcsx2/R5900.cpp index 2da3cfc42a..61cf8ba66b 100644 --- a/pcsx2/R5900.cpp +++ b/pcsx2/R5900.cpp @@ -17,6 +17,7 @@ #include "PrecompiledHeader.h" #include "Common.h" +#include "common/StringUtil.h" #include "ps2/BiosTools.h" #include "R5900.h" #include "R3000A.h" @@ -25,7 +26,11 @@ #include "COP0.h" #include "MTVU.h" +#ifndef PCSX2_CORE #include "System/SysThreads.h" +#else +#include "VMManager.h" +#endif #include "R5900Exceptions.h" #include "Hardware.h" @@ -38,6 +43,8 @@ #include "GameDatabase.h" #include "DebugTools/Breakpoints.h" +#include "DebugTools/MIPSAnalyst.h" +#include "DebugTools/SymbolMap.h" #include "R5900OpcodeTables.h" using namespace R5900; // for R5900 disasm tools @@ -547,7 +554,12 @@ void __fastcall eeGameStarting() //Console.WriteLn( Color_Green, "(R5900) ELF Entry point! [addr=0x%08X]", ElfEntry ); g_GameStarted = true; g_GameLoading = false; +#ifndef PCSX2_CORE GetCoreThread().GameStartingInThread(); +#else + VMManager::Internal::GameStartingOnCPUThread(); +#endif + // GameStartingInThread may issue a reset of the cpu and/or recompilers. Check for and // handle such things here: @@ -605,7 +617,11 @@ int ParseArgumentString(u32 arg_block) // Called from recompilers; __fastcall define is mandatory. void __fastcall eeloadHook() { +#ifndef PCSX2_CORE const wxString &elf_override = GetCoreThread().GetElfOverride(); +#else + const wxString elf_override(StringUtil::UTF8StringToWxString(VMManager::Internal::GetElfOverride())); +#endif if (!elf_override.IsEmpty()) cdvdReloadElfInfo(L"host:" + elf_override); diff --git a/pcsx2/Recording/InputRecording.cpp b/pcsx2/Recording/InputRecording.cpp index abb9d042d4..67bceceec8 100644 --- a/pcsx2/Recording/InputRecording.cpp +++ b/pcsx2/Recording/InputRecording.cpp @@ -16,13 +16,16 @@ #include "PrecompiledHeader.h" #include "common/StringUtil.h" +#include "SaveState.h" #include "Counters.h" #include "SaveState.h" #ifndef DISABLE_RECORDING -#include "GameDatabase.h" +#include "gui/App.h" +#include "gui/AppSaveStates.h" #include "DebugTools/Debug.h" +#include "GameDatabase.h" #include "InputRecording.h" #include "InputRecordingControls.h" diff --git a/pcsx2/SourceLog.cpp b/pcsx2/SourceLog.cpp index 7ccb954c54..031aa0a79e 100644 --- a/pcsx2/SourceLog.cpp +++ b/pcsx2/SourceLog.cpp @@ -106,9 +106,11 @@ static const TraceLogDescriptor TLD_sysoutConsole = {L"SYSout", L"System Out", pxDt("Shows strings printed to the system output stream.")}, - TLD_Pgif = {L"PGIFout", L"&PGIF Console", pxDt("Shows output from pgif the emulated ps1 gpu")}, + TLD_Pgif = {L"PGIFout", L"&PGIF Console", pxDt("Shows output from pgif the emulated ps1 gpu")} #ifndef DISABLE_RECORDING + , + TLD_recordingConsole = {L"Input Recording", L"Input Recording Console", pxDt("Shows recording related logs and information.")}, TLD_controlInfo = {L"Controller Info", L"Controller Info", pxDt("Shows detailed controller input values for port 1, every frame.")} diff --git a/pcsx2/System.cpp b/pcsx2/System.cpp index 5736267905..d461947349 100644 --- a/pcsx2/System.cpp +++ b/pcsx2/System.cpp @@ -241,7 +241,7 @@ void SysLogMachineCaps() Console.Newline(); -#ifdef _WIN32 +#if defined(_WIN32) && !defined(PCSX2_CORE) CheckIsUserOnHighPerfPowerPlan(); #endif } diff --git a/pcsx2/System/SysThreadBase.cpp b/pcsx2/System/SysThreadBase.cpp index d070e181a9..1bf651c589 100644 --- a/pcsx2/System/SysThreadBase.cpp +++ b/pcsx2/System/SysThreadBase.cpp @@ -332,6 +332,7 @@ bool SysThreadBase::StateCheckInThread() m_RunningLock.Acquire(); if (m_ExecMode != ExecMode_Closing) { +#ifndef PCSX2_CORE if (g_CDVDReset) // AppCoreThread deals with Reseting CDVD // Reinit all but GS, USB, DEV9, CDVD (just like with isSuspend = false previously) @@ -341,6 +342,7 @@ bool SysThreadBase::StateCheckInThread() OnResumeInThread(systemsToTearDown); g_CDVDReset = false; +#endif break; } m_sem_ChangingExecMode.Post(); @@ -363,7 +365,9 @@ bool SysThreadBase::StateCheckInThread() m_RunningLock.Acquire(); OnResumeInThread(static_cast(-1)); // All systems +#ifndef PCSX2_CORE g_CDVDReset = false; +#endif break; jNO_DEFAULT; diff --git a/pcsx2/System/SysThreads.h b/pcsx2/System/SysThreads.h index bdcc2d1d5b..8153a68209 100644 --- a/pcsx2/System/SysThreads.h +++ b/pcsx2/System/SysThreads.h @@ -171,7 +171,7 @@ protected: virtual void OnResumeInThread(SystemsMask systemsToReinstate) = 0; }; - +#ifndef PCSX2_CORE // -------------------------------------------------------------------------------------- // SysCoreThread class // -------------------------------------------------------------------------------------- @@ -249,6 +249,7 @@ private: }; + struct SysStateUnlockedParams { SysStateUnlockedParams() {} @@ -288,3 +289,5 @@ namespace PINESettings { extern unsigned int slot; }; + +#endif diff --git a/pcsx2/windows/Optimus.cpp b/pcsx2/windows/Optimus.cpp index 4ead3a6d38..86f80e6d12 100644 --- a/pcsx2/windows/Optimus.cpp +++ b/pcsx2/windows/Optimus.cpp @@ -16,6 +16,7 @@ #include "PrecompiledHeader.h" #ifdef _WIN32 +#include "common/RedtapeWindows.h" //This ensures that the nVidia graphics card is used for PCSX2 on an Optimus-enabled system. //302 or higher driver required. diff --git a/pcsx2/x86/iR3000A.cpp b/pcsx2/x86/iR3000A.cpp index bbd0cc00e6..5706e9a1d0 100644 --- a/pcsx2/x86/iR3000A.cpp +++ b/pcsx2/x86/iR3000A.cpp @@ -1127,7 +1127,9 @@ void psxDynarecCheckBreakpoint() return; CBreakPoints::SetBreakpointTriggered(true); +#ifndef PCSX2_CORE GetCoreThread().PauseSelfDebug(); +#endif iopBreakpoint = true; } @@ -1138,7 +1140,9 @@ void psxDynarecMemcheck() return; CBreakPoints::SetBreakpointTriggered(true); +#ifndef PCSX2_CORE GetCoreThread().PauseSelfDebug(); +#endif iopBreakpoint = true; } diff --git a/pcsx2/x86/ix86-32/iR5900-32.cpp b/pcsx2/x86/ix86-32/iR5900-32.cpp index 3fa907b43c..3cb12f98d4 100644 --- a/pcsx2/x86/ix86-32/iR5900-32.cpp +++ b/pcsx2/x86/ix86-32/iR5900-32.cpp @@ -27,7 +27,11 @@ #include "vtlb.h" #include "Dump.h" +#ifndef PCSX2_CORE #include "System/SysThreads.h" +#else +#include "VMManager.h" +#endif #include "GS.h" #include "CDVD/CDVD.h" #include "Elfheader.h" @@ -727,7 +731,11 @@ static void recExitExecution() static void recCheckExecutionState() { +#ifndef PCSX2_CORE if (SETJMP_CODE(m_cpuException || m_Exception ||) eeRecIsReset || GetCoreThread().HasPendingStateChangeRequest()) +#else + if (SETJMP_CODE(m_cpuException || m_Exception ||) eeRecIsReset || VMManager::Internal::IsExecutionInterrupted()) +#endif { recExitExecution(); } @@ -1307,7 +1315,9 @@ void dynarecCheckBreakpoint() return; CBreakPoints::SetBreakpointTriggered(true); +#ifndef PCSX2_CORE GetCoreThread().PauseSelfDebug(); +#endif recExitExecution(); } @@ -1318,7 +1328,9 @@ void dynarecMemcheck() return; CBreakPoints::SetBreakpointTriggered(true); +#ifndef PCSX2_CORE GetCoreThread().PauseSelfDebug(); +#endif recExitExecution(); }