diff --git a/CMakeLists.txt b/CMakeLists.txt index ac7dd0d476..cd162a0bdf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -916,8 +916,6 @@ endif() # SHARED on ANDROID, STATIC everywhere else add_library(${CoreLibName} ${CoreLinkType} ${CoreExtra} - Core/CPU.cpp - Core/CPU.h Core/Config.cpp Core/Config.h Core/Core.cpp diff --git a/Core/CPU.cpp b/Core/CPU.cpp deleted file mode 100644 index 923971085e..0000000000 --- a/Core/CPU.cpp +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) 2012- PPSSPP Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0 or later versions. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official git repository and contact information can be found at -// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. - - -#include "CPU.h" - -// See the MIPS folder, the real stuff is there. - -MIPSState *currentCPU = 0; - -int numCPUs; diff --git a/Core/CPU.h b/Core/CPU.h deleted file mode 100644 index ebc28caffb..0000000000 --- a/Core/CPU.h +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) 2012- PPSSPP Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0 or later versions. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official git repository and contact information can be found at -// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. - -#pragma once - -#include "../Globals.h" - -#include "MemMap.h" -#include "Core.h" - -enum -{ - GPR_SIZE_32=0, - GPR_SIZE_64=1 -}; - -#define MAX_NUM_CPU 2 - -class MIPSState; - -extern MIPSState *currentCPU; -extern int numCPUs; diff --git a/Core/Core.cpp b/Core/Core.cpp index f4064c4f75..2f2fbf15fe 100644 --- a/Core/Core.cpp +++ b/Core/Core.cpp @@ -29,6 +29,7 @@ #include "Core/SaveState.h" #include "Core/System.h" #include "Core/MIPS/MIPS.h" + #ifdef _WIN32 #include "Windows/OpenGLBase.h" #include "Windows/InputDevice.h" @@ -258,7 +259,6 @@ reswitch: goto reswitch; } - currentCPU = &mipsr4k; Core_SingleStep(); // update disasm dialog #if defined(USING_QT_UI) || defined(_DEBUG) diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj index 9a0941038d..51e2d85f90 100644 --- a/Core/Core.vcxproj +++ b/Core/Core.vcxproj @@ -168,7 +168,6 @@ - @@ -437,7 +436,6 @@ - diff --git a/Core/Core.vcxproj.filters b/Core/Core.vcxproj.filters index 65e9c17a0e..e65f97e13f 100644 --- a/Core/Core.vcxproj.filters +++ b/Core/Core.vcxproj.filters @@ -249,9 +249,6 @@ Core - - Core - Core @@ -714,9 +711,6 @@ Core - - Core - Core diff --git a/Core/CwCheat.cpp b/Core/CwCheat.cpp index e1154e4c13..33c6d29775 100644 --- a/Core/CwCheat.cpp +++ b/Core/CwCheat.cpp @@ -6,6 +6,8 @@ #include "Core/CwCheat.h" #include "Core/Config.h" #include "Core/MIPS/MIPS.h" +#include "Core/ELF/ParamSFO.h" +#include "Core/System.h" static int CheatEvent = -1; std::string gameTitle; diff --git a/Core/Debugger/DebugInterface.h b/Core/Debugger/DebugInterface.h index 12605c86b5..56a89529df 100644 --- a/Core/Debugger/DebugInterface.h +++ b/Core/Debugger/DebugInterface.h @@ -22,6 +22,11 @@ struct MemMap; +enum { + GPR_SIZE_32, + GPR_SIZE_64, +}; + class DebugInterface { public: diff --git a/Core/FileSystems/MetaFileSystem.cpp b/Core/FileSystems/MetaFileSystem.cpp index 2975258b45..7c996e931c 100644 --- a/Core/FileSystems/MetaFileSystem.cpp +++ b/Core/FileSystems/MetaFileSystem.cpp @@ -539,15 +539,15 @@ size_t MetaFileSystem::SeekFile(u32 handle, s32 position, FileMove type) int MetaFileSystem::ReadEntireFile(const std::string &filename, std::vector &data) { int error = 0; - u32 handle = pspFileSystem.OpenWithError(error, filename, FILEACCESS_READ); + u32 handle = OpenWithError(error, filename, FILEACCESS_READ); if (handle == 0) return error; - size_t dataSize = (size_t)pspFileSystem.GetFileInfo(filename).size; + size_t dataSize = (size_t)GetFileInfo(filename).size; data.resize(dataSize); - size_t result = pspFileSystem.ReadFile(handle, (u8 *)&data[0], dataSize); - pspFileSystem.CloseFile(handle); + size_t result = ReadFile(handle, (u8 *)&data[0], dataSize); + CloseFile(handle); if (result != dataSize) return SCE_KERNEL_ERROR_ERROR; @@ -557,7 +557,7 @@ int MetaFileSystem::ReadEntireFile(const std::string &filename, std::vector void MetaFileSystem::DoState(PointerWrap &p) { lock_guard guard(lock); - + auto s = p.Section("MetaFileSystem", 1); if (!s) return; diff --git a/Core/HLE/HLE.cpp b/Core/HLE/HLE.cpp index 1746338f19..0b65e3b0f1 100644 --- a/Core/HLE/HLE.cpp +++ b/Core/HLE/HLE.cpp @@ -15,26 +15,30 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#include "base/timeutil.h" -#include "HLE.h" #include #include #include -#include "../MemMap.h" -#include "../Config.h" + +#include "base/timeutil.h" + +#include "Core/Config.h" #include "Core/CoreTiming.h" +#include "Core/MemMap.h" #include "Core/Reporting.h" -#include "HLETables.h" -#include "../System.h" -#include "sceDisplay.h" -#include "sceIo.h" -#include "sceAudio.h" -#include "sceKernelMemory.h" -#include "sceKernelThread.h" -#include "sceKernelInterrupt.h" -#include "../MIPS/MIPSCodeUtils.h" -#include "../Host.h" +#include "Core/Core.h" +#include "Core/Host.h" +#include "Core/System.h" +#include "Core/MIPS/MIPS.h" +#include "Core/MIPS/MIPSCodeUtils.h" +#include "Core/HLE/HLETables.h" +#include "Core/HLE/sceDisplay.h" +#include "Core/HLE/sceIo.h" +#include "Core/HLE/sceAudio.h" +#include "Core/HLE/sceKernelMemory.h" +#include "Core/HLE/sceKernelThread.h" +#include "Core/HLE/sceKernelInterrupt.h" +#include "Core/HLE/HLE.h" enum { diff --git a/Core/HLE/sceIo.cpp b/Core/HLE/sceIo.cpp index c2e622ccf5..cd24485562 100644 --- a/Core/HLE/sceIo.cpp +++ b/Core/HLE/sceIo.cpp @@ -17,8 +17,10 @@ #include #include + #include "native/thread/thread.h" #include "native/thread/threadutil.h" +#include "Core/Core.h" #include "Core/Config.h" #include "Core/System.h" #include "Core/Host.h" diff --git a/Core/HLE/sceKernel.cpp b/Core/HLE/sceKernel.cpp index 347a3a0970..4da22a73fe 100644 --- a/Core/HLE/sceKernel.cpp +++ b/Core/HLE/sceKernel.cpp @@ -15,6 +15,7 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. +#include "Core/Core.h" #include "Core/Config.h" #include "Core/CwCheat.h" #include "Core/HLE/HLE.h" @@ -33,8 +34,6 @@ #include "GPU/GPUInterface.h" #include "GPU/GPUState.h" -#include "util/random/rng.h" - #include "__sceAudio.h" #include "sceAtrac.h" #include "sceAudio.h" @@ -947,4 +946,4 @@ void Register_ThreadManForKernel() { RegisterModule("ThreadManForKernel", ARRAY_SIZE(ThreadManForKernel), ThreadManForKernel); -} \ No newline at end of file +} diff --git a/Core/HLE/scePauth.cpp b/Core/HLE/scePauth.cpp index 4c5399cae5..8c362595f3 100644 --- a/Core/HLE/scePauth.cpp +++ b/Core/HLE/scePauth.cpp @@ -17,6 +17,7 @@ #include "zlib.h" +#include "Core/System.h" #include "Core/FileSystems/MetaFileSystem.h" #include "Core/HLE/scePauth.h" #include "Core/HLE/HLE.h" diff --git a/Core/HLE/scePsmf.cpp b/Core/HLE/scePsmf.cpp index 950577e225..57727294c5 100644 --- a/Core/HLE/scePsmf.cpp +++ b/Core/HLE/scePsmf.cpp @@ -19,6 +19,7 @@ #include "Common/ChunkFile.h" #include "Core/Reporting.h" +#include "Core/System.h" #include "Core/FileSystems/MetaFileSystem.h" #include "Core/HLE/scePsmf.h" #include "Core/HLE/sceMpeg.h" diff --git a/Core/HLE/sceUmd.cpp b/Core/HLE/sceUmd.cpp index 67cbc9aa30..f5568369dd 100644 --- a/Core/HLE/sceUmd.cpp +++ b/Core/HLE/sceUmd.cpp @@ -15,11 +15,16 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. +#include + +#include "file/file_util.h" + #include "Common/ChunkFile.h" -#include "Core/HLE/HLE.h" -#include "Core/MIPS/MIPS.h" +#include "Core/System.h" #include "Core/CoreTiming.h" #include "Core/Reporting.h" +#include "Core/MIPS/MIPS.h" +#include "Core/HLE/HLE.h" #include "Core/HLE/sceUmd.h" #include "Core/HLE/sceKernelThread.h" #include "Core/HLE/sceKernelInterrupt.h" @@ -30,8 +35,6 @@ #include "Core/FileSystems/ISOFileSystem.h" #include "Core/FileSystems/VirtualDiscFileSystem.h" -#include "file/file_util.h" - const u64 MICRO_DELAY_ACTIVATE = 4000; static u8 umdActivated = 1; diff --git a/Core/HLE/sceUtility.cpp b/Core/HLE/sceUtility.cpp index 02288f658c..ac0c2f4146 100644 --- a/Core/HLE/sceUtility.cpp +++ b/Core/HLE/sceUtility.cpp @@ -15,6 +15,7 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. +#include #include #include "file/ini_file.h" diff --git a/Core/HLE/sceUtility.h b/Core/HLE/sceUtility.h index b519a0030d..0256a47666 100644 --- a/Core/HLE/sceUtility.h +++ b/Core/HLE/sceUtility.h @@ -17,6 +17,9 @@ #pragma once +#include +#include + class PointerWrap; // Valid values for PSP_SYSTEMPARAM_ID_INT_LANGUAGE diff --git a/Core/MIPS/MIPS.h b/Core/MIPS/MIPS.h index 3714b04b88..869fe4579c 100644 --- a/Core/MIPS/MIPS.h +++ b/Core/MIPS/MIPS.h @@ -17,10 +17,8 @@ #pragma once -#include "Globals.h" -#include "Core/MemMap.h" -#include "Core/CPU.h" #include "util/random/rng.h" +#include "Core/MemMap.h" typedef Memory::Opcode MIPSOpcode; @@ -164,7 +162,7 @@ public: bool inDelaySlot; int llBit; // ll/sc u32 temp; // can be used to save temporaries during calculations when we need more than R0 and R1 - + GMRng rng; // VFPU hardware random number generator. Probably not the right type. // Debug stuff diff --git a/Core/MIPS/MIPSAnalyst.cpp b/Core/MIPS/MIPSAnalyst.cpp index 7921d52497..ebca989568 100644 --- a/Core/MIPS/MIPSAnalyst.cpp +++ b/Core/MIPS/MIPSAnalyst.cpp @@ -21,6 +21,7 @@ #include "ext/cityhash/city.h" #include "Common/FileUtil.h" #include "Core/Config.h" +#include "Core/System.h" #include "Core/MIPS/MIPS.h" #include "Core/MIPS/MIPSTables.h" #include "Core/MIPS/MIPSAnalyst.h" @@ -42,13 +43,13 @@ static std::vector functions; static std::map> hashToFunction; struct HashMapFunc { - char name[64]; - u64 hash; - u32 size; //number of bytes + char name[64]; + u64 hash; + u32 size; //number of bytes - bool operator < (const HashMapFunc &other) const { - return hash < other.hash || (hash == other.hash && size < other.size); - } + bool operator < (const HashMapFunc &other) const { + return hash < other.hash || (hash == other.hash && size < other.size); + } }; static std::set hashMap; @@ -233,7 +234,7 @@ namespace MIPSAnalyst { f.hasHash = false; goto skip; } - + MIPSInfo flags = MIPSGetInfo(instr); if (flags & IN_IMM16) validbits &= ~0xFFFF; diff --git a/Core/MIPS/MIPSDebugInterface.cpp b/Core/MIPS/MIPSDebugInterface.cpp index 0819eebc82..6c672edf07 100644 --- a/Core/MIPS/MIPSDebugInterface.cpp +++ b/Core/MIPS/MIPSDebugInterface.cpp @@ -175,19 +175,16 @@ private: -const char *MIPSDebugInterface::disasm(unsigned int address, unsigned int align) +const char *MIPSDebugInterface::disasm(unsigned int address, unsigned int align) { - MIPSState *x = currentCPU; - currentCPU = cpu; - - static char mojs[256]; + static char mojs[256]; if (Memory::IsValidAddress(address)) MIPSDisAsm(Memory::Read_Opcode_JIT(address), address, mojs); else strcpy(mojs, "-"); - currentCPU = x; return mojs; } + unsigned int MIPSDebugInterface::readMemory(unsigned int address) { return Memory::Read_Instruction(address).encoding; diff --git a/Core/MIPS/MIPSDebugInterface.h b/Core/MIPS/MIPSDebugInterface.h index 20ae2a74fd..c83ffa99d0 100644 --- a/Core/MIPS/MIPSDebugInterface.h +++ b/Core/MIPS/MIPSDebugInterface.h @@ -18,7 +18,7 @@ #pragma once #include "MIPS.h" -#include "../Debugger/DebugInterface.h" +#include "Core/Debugger/DebugInterface.h" class MIPSDebugInterface : public DebugInterface { diff --git a/Core/MIPS/MIPSTables.cpp b/Core/MIPS/MIPSTables.cpp index d6603c7a31..5a29d34903 100644 --- a/Core/MIPS/MIPSTables.cpp +++ b/Core/MIPS/MIPSTables.cpp @@ -15,6 +15,7 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. +#include "Core/Core.h" #include "Core/System.h" #include "Core/MIPS/MIPS.h" #include "Core/MIPS/MIPSDis.h" diff --git a/Core/MIPS/MIPSVFPUUtils.cpp b/Core/MIPS/MIPSVFPUUtils.cpp index d503fd4313..47368f501f 100644 --- a/Core/MIPS/MIPSVFPUUtils.cpp +++ b/Core/MIPS/MIPSVFPUUtils.cpp @@ -15,7 +15,6 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#include "Core/CPU.h" #include "Core/Reporting.h" #include "Core/MIPS/MIPS.h" #include "Core/MIPS/MIPSVFPUUtils.h" diff --git a/Core/MemMap.cpp b/Core/MemMap.cpp index 703ce79ff4..9af4b58d8b 100644 --- a/Core/MemMap.cpp +++ b/Core/MemMap.cpp @@ -27,7 +27,6 @@ #include "MIPS/JitCommon/JitCommon.h" #include "HLE/HLE.h" -#include "Core/CPU.h" #include "Core/Core.h" #include "Core/Debugger/SymbolMap.h" #include "Core/Debugger/Breakpoints.h" diff --git a/Core/MemMapFunctions.cpp b/Core/MemMapFunctions.cpp index c8fa0b6a4a..172d761b1e 100644 --- a/Core/MemMapFunctions.cpp +++ b/Core/MemMapFunctions.cpp @@ -18,6 +18,7 @@ #include "Common/Common.h" #include "Common/Atomics.h" +#include "Core/Core.h" #include "Core/MemMap.h" #include "Core/Config.h" #include "Core/Host.h" diff --git a/Core/Reporting.cpp b/Core/Reporting.cpp index 27228070ba..fb851a8eb7 100644 --- a/Core/Reporting.cpp +++ b/Core/Reporting.cpp @@ -23,6 +23,7 @@ #include "Core/System.h" #include "Core/HLE/sceDisplay.h" #include "Core/HLE/sceKernelMemory.h" +#include "Core/ELF/ParamSFO.h" #include "GPU/GPUInterface.h" #include "GPU/GPUState.h" #include "GPU/GLES/Framebuffer.h" diff --git a/Core/SaveState.cpp b/Core/SaveState.cpp index b869658405..e31e9260f1 100644 --- a/Core/SaveState.cpp +++ b/Core/SaveState.cpp @@ -31,6 +31,7 @@ #include "Core/Host.h" #include "Core/System.h" #include "Core/FileSystems/MetaFileSystem.h" +#include "Core/ELF/ParamSFO.h" #include "Core/HLE/HLE.h" #include "Core/HLE/sceKernel.h" #include "Core/MemMap.h" diff --git a/Core/System.cpp b/Core/System.cpp index 03d7a35585..71244d9232 100644 --- a/Core/System.cpp +++ b/Core/System.cpp @@ -159,8 +159,7 @@ void CPU_Shutdown(); void CPU_Init() { coreState = CORE_POWERUP; - currentCPU = &mipsr4k; - numCPUs = 1; + currentMIPS = &mipsr4k; // Default memory settings // Seems to be the safest place currently.. @@ -237,7 +236,6 @@ void CPU_Shutdown() { } pspFileSystem.Shutdown(); Memory::Shutdown(); - currentCPU = 0; } void CPU_RunLoop() { @@ -331,7 +329,7 @@ bool PSP_Init(const CoreParameter &coreParam, std::string *error_string) { } bool PSP_IsInited() { - return currentCPU != 0; + return currentMIPS != 0; } void PSP_Shutdown() { @@ -354,6 +352,7 @@ void PSP_Shutdown() { } GPU_Shutdown(); host->SetWindowTitle(0); + currentMIPS = 0; } void PSP_RunLoopUntil(u64 globalticks) { diff --git a/Core/System.h b/Core/System.h index da9a2b17d5..c9010eb5ec 100644 --- a/Core/System.h +++ b/Core/System.h @@ -17,10 +17,11 @@ #pragma once +#include "Common/CommonTypes.h" #include "Core/CoreParameter.h" -#include "Core/ELF/ParamSFO.h" class MetaFileSystem; +class ParamSFOData; extern MetaFileSystem pspFileSystem; extern ParamSFOData g_paramSFO; diff --git a/UI/DevScreens.cpp b/UI/DevScreens.cpp index 64f5c0030f..8526dd4b62 100644 --- a/UI/DevScreens.cpp +++ b/UI/DevScreens.cpp @@ -29,6 +29,7 @@ #include "Common/LogManager.h" #include "Core/MemMap.h" #include "Core/Config.h" +#include "Core/System.h" #include "Core/CoreParameter.h" #include "Core/MIPS/MIPSTables.h" #include "Core/MIPS/JitCommon/JitCommon.h" diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index c9ab0661b6..dadeeaa475 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -57,12 +57,12 @@ #include "Common/FileUtil.h" #include "Common/LogManager.h" -#include "Core/PSPMixer.h" -#include "Core/CPU.h" #include "Core/Config.h" -#include "Core/HLE/sceCtrl.h" #include "Core/Host.h" +#include "Core/PSPMixer.h" #include "Core/SaveState.h" +#include "Core/System.h" +#include "Core/HLE/sceCtrl.h" #include "Core/Util/GameManager.h" #include "Common/MemArena.h" diff --git a/android/jni/Android.mk b/android/jni/Android.mk index 04441c8a67..82453f5690 100644 --- a/android/jni/Android.mk +++ b/android/jni/Android.mk @@ -169,7 +169,6 @@ EXEC_AND_LIB_FILES := \ $(SRC)/Core/Core.cpp \ $(SRC)/Core/Config.cpp \ $(SRC)/Core/CoreTiming.cpp \ - $(SRC)/Core/CPU.cpp \ $(SRC)/Core/CwCheat.cpp \ $(SRC)/Core/HDRemaster.cpp \ $(SRC)/Core/Host.cpp \