From 21cfd087e16864bad46638e3d7660a13780c7753 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 6 Jan 2013 15:53:44 -0800 Subject: [PATCH] Move Action out of Common, don't use savedV0. Compiler error was annoying me anyway. --- CMakeLists.txt | 2 -- Common/Action.cpp | 1 - Common/Action.h | 23 ----------------------- Common/CMakeLists.txt | 1 - Common/Common.vcxproj | 2 -- Common/Common.vcxproj.filters | 2 -- Core/HLE/sceKernelInterrupt.cpp | 1 - Core/HLE/sceKernelModule.cpp | 1 - Core/HLE/sceKernelThread.cpp | 8 ++++++-- Core/HLE/sceKernelThread.h | 10 ++++++++++ Core/HLE/sceMpeg.cpp | 3 +-- Qt/Common.pro | 6 ++---- 12 files changed, 19 insertions(+), 41 deletions(-) delete mode 100644 Common/Action.cpp delete mode 100644 Common/Action.h diff --git a/CMakeLists.txt b/CMakeLists.txt index ee595982ce..caa6fb6fee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -193,8 +193,6 @@ endif() add_library(Common STATIC ${CommonExtra} - Common/Action.cpp - Common/Action.h Common/ColorUtil.cpp Common/ColorUtil.h Common/ConsoleListener.cpp diff --git a/Common/Action.cpp b/Common/Action.cpp deleted file mode 100644 index c8f7218a8c..0000000000 --- a/Common/Action.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "Action.h" diff --git a/Common/Action.h b/Common/Action.h deleted file mode 100644 index 18a8a115be..0000000000 --- a/Common/Action.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -#include -#include "ChunkFile.h" - -// Sometimes you want to set something to happen later, without that later place really needing -// to know about all the things that might happen. That's when you use an Action, and add it -// to the appropriate ActionSet. -// -// Unlike CoreTiming events, these are not timed in any way and do not care about the time. -// This code also doesn't depend on anything in PPSSPP so it can live in Common. - -struct MipsCall; - -// Pretty much a Runnable. Similar to Action from JPCSP. -class Action -{ -public: - virtual ~Action() {} - virtual void run(MipsCall &call) = 0; - virtual void DoState(PointerWrap &p) = 0; - int actionTypeID; -}; diff --git a/Common/CMakeLists.txt b/Common/CMakeLists.txt index dbef1688d4..1f29b49e3b 100644 --- a/Common/CMakeLists.txt +++ b/Common/CMakeLists.txt @@ -1,5 +1,4 @@ set(SRCS - Action.cpp ColorUtil.cpp ConsoleListener.cpp ExtendedTrace.cpp diff --git a/Common/Common.vcxproj b/Common/Common.vcxproj index c61737636a..8bc466d54b 100644 --- a/Common/Common.vcxproj +++ b/Common/Common.vcxproj @@ -140,7 +140,6 @@ - true true @@ -196,7 +195,6 @@ - true true diff --git a/Common/Common.vcxproj.filters b/Common/Common.vcxproj.filters index 93673cb372..a9b4e859bc 100644 --- a/Common/Common.vcxproj.filters +++ b/Common/Common.vcxproj.filters @@ -43,7 +43,6 @@ - @@ -72,7 +71,6 @@ - diff --git a/Core/HLE/sceKernelInterrupt.cpp b/Core/HLE/sceKernelInterrupt.cpp index ddec34669c..2eb73d1b5e 100644 --- a/Core/HLE/sceKernelInterrupt.cpp +++ b/Core/HLE/sceKernelInterrupt.cpp @@ -22,7 +22,6 @@ #include "HLE.h" #include "../MIPS/MIPS.h" -#include "Action.h" #include "sceKernel.h" #include "sceKernelThread.h" #include "sceKernelInterrupt.h" diff --git a/Core/HLE/sceKernelModule.cpp b/Core/HLE/sceKernelModule.cpp index bc4deae317..3a5907dd40 100644 --- a/Core/HLE/sceKernelModule.cpp +++ b/Core/HLE/sceKernelModule.cpp @@ -19,7 +19,6 @@ #include #include "HLE.h" -#include "Common/Action.h" #include "Common/FileUtil.h" #include "../Host.h" #include "../MIPS/MIPS.h" diff --git a/Core/HLE/sceKernelThread.cpp b/Core/HLE/sceKernelThread.cpp index 86e35062cc..5beb86cee8 100644 --- a/Core/HLE/sceKernelThread.cpp +++ b/Core/HLE/sceKernelThread.cpp @@ -26,7 +26,6 @@ #include "../MIPS/MIPS.h" #include "../../Core/CoreTiming.h" #include "../../Core/MemMap.h" -#include "../../Common/Action.h" #include "sceAudio.h" #include "sceKernel.h" @@ -545,6 +544,11 @@ void MipsCall::DoState(PointerWrap &p) } } +void MipsCall::setReturnValue(u32 value) +{ + savedV0 = value; +} + // TODO: Should move to this wrapper so we can keep the current thread as a SceUID instead // of a dangerous raw pointer. Thread *__GetCurrentThread() { @@ -2013,7 +2017,7 @@ void Thread::setReturnValue(u32 retval) int callId = this->currentCallbackId; MipsCall *call = mipsCalls.get(callId); if (call) { - call->savedV0 = retval; + call->setReturnValue(retval); } else { ERROR_LOG(HLE, "Failed to inject return value %08x in thread", retval); } diff --git a/Core/HLE/sceKernelThread.h b/Core/HLE/sceKernelThread.h index bc9b1b05c3..e501f9d5cd 100644 --- a/Core/HLE/sceKernelThread.h +++ b/Core/HLE/sceKernelThread.h @@ -221,6 +221,16 @@ struct MipsCall { bool reschedAfter; void DoState(PointerWrap &p); + void setReturnValue(u32 value); +}; + +class Action +{ +public: + virtual ~Action() {} + virtual void run(MipsCall &call) = 0; + virtual void DoState(PointerWrap &p) = 0; + int actionTypeID; }; enum ThreadStatus diff --git a/Core/HLE/sceMpeg.cpp b/Core/HLE/sceMpeg.cpp index ec4c6585a9..2fc53623a2 100644 --- a/Core/HLE/sceMpeg.cpp +++ b/Core/HLE/sceMpeg.cpp @@ -23,7 +23,6 @@ #include "sceKernelThread.h" #include "HLE.h" #include "../HW/MediaEngine.h" -#include "../../Common/Action.h" static bool useMediaEngine; @@ -803,7 +802,7 @@ void PostPutAction::run(MipsCall &call) { } Memory::WriteStruct(ringAddr_, &ringbuffer); - call.savedV0 = packetsAdded; + call.setReturnValue(packetsAdded); } diff --git a/Qt/Common.pro b/Qt/Common.pro index 7817c8ab3e..ee93af7868 100755 --- a/Qt/Common.pro +++ b/Qt/Common.pro @@ -32,8 +32,7 @@ win32 { HEADERS += ../Common/stdafx.h } -SOURCES += ../Common/Action.cpp \ - ../Common/ColorUtil.cpp \ +SOURCES += ../Common/ColorUtil.cpp \ ../Common/ConsoleListener.cpp \ ../Common/Crypto/aes_cbc.cpp \ ../Common/Crypto/aes_core.cpp \ @@ -57,8 +56,7 @@ SOURCES += ../Common/Action.cpp \ ../Common/Thread.cpp \ ../Common/Timer.cpp \ ../Common/Version.cpp -HEADERS += ../Common/Action.h \ - ../Common/ColorUtil.h \ +HEADERS += ../Common/ColorUtil.h \ ../Common/ConsoleListener.h \ ../Common/Crypto/md5.h \ ../Common/Crypto/sha1.h \