diff --git a/Core/HLE/sceCtrl.cpp b/Core/HLE/sceCtrl.cpp index b79c9733db..53623bfdce 100644 --- a/Core/HLE/sceCtrl.cpp +++ b/Core/HLE/sceCtrl.cpp @@ -32,7 +32,6 @@ #define CTRL_MODE_DIGITAL 0 #define CTRL_MODE_ANALOG 1 -const int PSP_CTRL_ERROR_INVALID_MODE = 0x80000107; const int PSP_CTRL_ERROR_INVALID_IDLE_PTR = 0x80000023; const u32 NUM_CTRL_BUFFERS = 64; @@ -351,7 +350,7 @@ u32 sceCtrlSetSamplingMode(u32 mode) DEBUG_LOG(HLE, "sceCtrlSetSamplingMode(%i)", mode); if (mode > 1) - return PSP_CTRL_ERROR_INVALID_MODE; + return SCE_KERNEL_ERROR_INVALID_MODE; retVal = analogEnabled == true ? CTRL_MODE_ANALOG : CTRL_MODE_DIGITAL; analogEnabled = mode == CTRL_MODE_ANALOG ? true : false; diff --git a/Core/HLE/sceGe.cpp b/Core/HLE/sceGe.cpp index 43bdbccf5a..c4f46fd3cd 100644 --- a/Core/HLE/sceGe.cpp +++ b/Core/HLE/sceGe.cpp @@ -188,48 +188,39 @@ u32 sceGeListEnQueueHead(u32 listAddress, u32 stallAddress, int callbackId, int sceGeListDeQueue(u32 listID) { ERROR_LOG(HLE, "UNIMPL sceGeListDeQueue(%08x)", listID); - return 0; + return gpu->DequeueList(listID); } int sceGeListUpdateStallAddr(u32 displayListID, u32 stallAddress) { - DEBUG_LOG(HLE, "sceGeListUpdateStallAddr(dlid=%i,stalladdr=%08x)", - displayListID, stallAddress); - - gpu->UpdateStall(displayListID, stallAddress); - return 0; + DEBUG_LOG(HLE, "sceGeListUpdateStallAddr(dlid=%i,stalladdr=%08x)", displayListID, stallAddress); + return gpu->UpdateStall(displayListID, stallAddress); } int sceGeListSync(u32 displayListID, u32 mode) //0 : wait for completion 1:check and return { DEBUG_LOG(HLE, "sceGeListSync(dlid=%08x, mode=%08x)", displayListID, mode); - if(mode == 1) { - return gpu->listStatus(displayListID); - } - return 0; + return gpu->ListSync(displayListID, mode); } u32 sceGeDrawSync(u32 mode) { //wait/check entire drawing state - DEBUG_LOG(HLE, "FAKE sceGeDrawSync(mode=%d) (0=wait for completion)", - mode); - gpu->DrawSync(mode); - return 0; + DEBUG_LOG(HLE, "FAKE sceGeDrawSync(mode=%d) (0=wait for completion)", mode); + return gpu->DrawSync(mode); } int sceGeContinue() { DEBUG_LOG(HLE, "UNIMPL sceGeContinue"); - // no arguments - return 0; + return gpu->Continue(); } int sceGeBreak(u32 mode) { //mode => 0 : current dlist 1: all drawing DEBUG_LOG(HLE, "UNIMPL sceGeBreak(mode=%d)", mode); - return 0; + return gpu->Break(mode); } u32 sceGeSetCallback(u32 structAddr) diff --git a/Core/HLE/sceKernel.h b/Core/HLE/sceKernel.h index c133b18f23..ffedb37e3f 100644 --- a/Core/HLE/sceKernel.h +++ b/Core/HLE/sceKernel.h @@ -30,6 +30,7 @@ enum SCE_KERNEL_ERROR_OUT_OF_MEMORY = 0x80000022, SCE_KERNEL_ERROR_INVALID_ID = 0x80000100, SCE_KERNEL_ERROR_INVALID_SIZE = 0x80000104, + SCE_KERNEL_ERROR_INVALID_MODE = 0x80000107, SCE_KERNEL_ERROR_INVALID_VALUE = 0x800001fe, SCE_KERNEL_ERROR_INVALID_ARGUMENT = 0x800001ff, SCE_KERNEL_ERROR_ERROR = 0x80020001, diff --git a/Core/HLE/scePower.cpp b/Core/HLE/scePower.cpp index d29b04c515..ead31b33c8 100644 --- a/Core/HLE/scePower.cpp +++ b/Core/HLE/scePower.cpp @@ -29,7 +29,6 @@ const int PSP_POWER_ERROR_PRIVATE_SLOT = 0x80000023; const int PSP_POWER_ERROR_EMPTY_SLOT = 0x80000025; const int PSP_POWER_ERROR_INVALID_CB = 0x80000100; const int PSP_POWER_ERROR_INVALID_SLOT = 0x80000102; -const int PSP_POWER_ERROR_INVALID_TYPE = 0x80000107; const int PSP_POWER_CB_AC_POWER = 0x00001000; const int PSP_POWER_CB_BATTERY_EXIST = 0x00000080; @@ -167,7 +166,7 @@ int sceKernelPowerLock(int lockType) { if (lockType == 0) { return 0; } else { - return PSP_POWER_ERROR_INVALID_TYPE; + return SCE_KERNEL_ERROR_INVALID_MODE; } } @@ -176,7 +175,7 @@ int sceKernelPowerUnlock(int lockType) { if (lockType == 0) { return 0; } else { - return PSP_POWER_ERROR_INVALID_TYPE; + return SCE_KERNEL_ERROR_INVALID_MODE; } } diff --git a/GPU/GLES/DisplayListInterpreter.cpp b/GPU/GLES/DisplayListInterpreter.cpp index 85cf120b05..5cf982c71d 100644 --- a/GPU/GLES/DisplayListInterpreter.cpp +++ b/GPU/GLES/DisplayListInterpreter.cpp @@ -164,8 +164,7 @@ static const u8 flushBeforeCommandList[] = { }; GLES_GPU::GLES_GPU() -: interruptsEnabled_(true), - resized_(false) +: resized_(false) { shaderManager_ = new ShaderManager(); transformDraw_.SetShaderManager(shaderManager_); @@ -280,17 +279,10 @@ void GLES_GPU::CopyDisplayToOutput() { // Render queue -void GLES_GPU::DrawSync(int mode) +u32 GLES_GPU::DrawSync(int mode) { transformDraw_.Flush(); -} - -void GLES_GPU::Continue() { - -} - -void GLES_GPU::Break() { - + return GPUCommon::DrawSync(mode); } void GLES_GPU::PreExecuteOp(u32 op, u32 diff) { @@ -386,121 +378,6 @@ void GLES_GPU::ExecuteOp(u32 op, u32 diff) { } break; - case GE_CMD_JUMP: - { - u32 target = gstate_c.getRelativeAddress(data); - if (Memory::IsValidAddress(target)) { - currentList->pc = target - 4; // pc will be increased after we return, counteract that - } else { - ERROR_LOG(G3D, "JUMP to illegal address %08x - ignoring! data=%06x", target, data); - } - } - break; - - case GE_CMD_CALL: - { - // Saint Seiya needs correct support for relative calls. - u32 retval = currentList->pc + 4; - u32 target = gstate_c.getRelativeAddress(data); - if (stackptr == ARRAY_SIZE(stack)) { - ERROR_LOG(G3D, "CALL: Stack full!"); - } else if (!Memory::IsValidAddress(target)) { - ERROR_LOG(G3D, "CALL to illegal address %08x - ignoring! data=%06x", target, data); - } else { - stack[stackptr++] = retval; - currentList->pc = target - 4; // pc will be increased after we return, counteract that - } - } - break; - - case GE_CMD_RET: - { - if (stackptr == 0) { - ERROR_LOG(G3D, "RET: Stack empty!"); - } else { - u32 target = (currentList->pc & 0xF0000000) | (stack[--stackptr] & 0x0FFFFFFF); - //target = (target + gstate_c.originAddr) & 0xFFFFFFF; - currentList->pc = target - 4; - if (!Memory::IsValidAddress(currentList->pc)) { - ERROR_LOG(G3D, "Invalid DL PC %08x on return", currentList->pc); - finished = true; - } - } - } - break; - - case GE_CMD_OFFSETADDR: - gstate_c.offsetAddr = data << 8; - // ??? - break; - - case GE_CMD_ORIGIN: - gstate_c.offsetAddr = currentList->pc; - break; - - - case GE_CMD_SIGNAL: - { - // Processed in GE_END. Has data. - currentList->subIntrToken = data & 0xFFFF; - } - break; - - case GE_CMD_FINISH: - currentList->subIntrToken = data & 0xFFFF; - // TODO: Should this run while interrupts are suspended? - if (interruptsEnabled_) - __GeTriggerInterrupt(currentList->id, currentList->pc, currentList->subIntrBase, currentList->subIntrToken); - break; - - case GE_CMD_END: - switch (prev >> 24) { - case GE_CMD_SIGNAL: - { - currentList->status = PSP_GE_LIST_END_REACHED; - // TODO: see http://code.google.com/p/jpcsp/source/detail?r=2935# - int behaviour = (prev >> 16) & 0xFF; - int signal = prev & 0xFFFF; - int enddata = data & 0xFFFF; - // We should probably defer to sceGe here, no sense in implementing this stuff in every GPU - switch (behaviour) { - case 1: // Signal with Wait - ERROR_LOG(G3D, "Signal with Wait UNIMPLEMENTED! signal/end: %04x %04x", signal, enddata); - break; - case 2: - ERROR_LOG(G3D, "Signal without wait. signal/end: %04x %04x", signal, enddata); - break; - case 3: - ERROR_LOG(G3D, "Signal with Pause UNIMPLEMENTED! signal/end: %04x %04x", signal, enddata); - break; - case 0x10: - ERROR_LOG(G3D, "Signal with Jump UNIMPLEMENTED! signal/end: %04x %04x", signal, enddata); - break; - case 0x11: - ERROR_LOG(G3D, "Signal with Call UNIMPLEMENTED! signal/end: %04x %04x", signal, enddata); - break; - case 0x12: - ERROR_LOG(G3D, "Signal with Return UNIMPLEMENTED! signal/end: %04x %04x", signal, enddata); - break; - default: - ERROR_LOG(G3D, "UNKNOWN Signal UNIMPLEMENTED %i ! signal/end: %04x %04x", behaviour, signal, enddata); - break; - } - // TODO: Should this run while interrupts are suspended? - if (interruptsEnabled_) - __GeTriggerInterrupt(currentList->id, currentList->pc, currentList->subIntrBase, currentList->subIntrToken); - } - break; - case GE_CMD_FINISH: - currentList->status = PSP_GE_LIST_DONE; - finished = true; - break; - default: - DEBUG_LOG(G3D,"Ah, not finished: %06x", prev & 0xFFFFFF); - break; - } - break; - case GE_CMD_BJUMP: // bounding box jump. Let's just not jump, for now. break; @@ -974,7 +851,7 @@ void GLES_GPU::ExecuteOp(u32 op, u32 diff) { break; default: - DEBUG_LOG(G3D,"DL Unknown: %08x @ %08x", op, currentList == NULL ? 0 : currentList->pc); + GPUCommon::ExecuteOp(op, diff); break; } } diff --git a/GPU/GLES/DisplayListInterpreter.h b/GPU/GLES/DisplayListInterpreter.h index 9b30cab7b5..9fb250e617 100644 --- a/GPU/GLES/DisplayListInterpreter.h +++ b/GPU/GLES/DisplayListInterpreter.h @@ -38,12 +38,7 @@ public: virtual void InitClear(); virtual void PreExecuteOp(u32 op, u32 diff); virtual void ExecuteOp(u32 op, u32 diff); - virtual void DrawSync(int mode); - virtual void Continue(); - virtual void Break(); - virtual void EnableInterrupts(bool enable) { - interruptsEnabled_ = enable; - } + virtual u32 DrawSync(int mode); virtual void SetDisplayFramebuffer(u32 framebuf, u32 stride, int format); virtual void CopyDisplayToOutput(); @@ -81,6 +76,5 @@ private: ShaderManager *shaderManager_; u8 *flushBeforeCommand_; - bool interruptsEnabled_; bool resized_; }; diff --git a/GPU/GPUCommon.cpp b/GPU/GPUCommon.cpp index 5c5f98b38b..09c9f14b4c 100644 --- a/GPU/GPUCommon.cpp +++ b/GPU/GPUCommon.cpp @@ -1,12 +1,13 @@ #include "base/timeutil.h" -#include "../Core/MemMap.h" #include "GeDisasm.h" #include "GPUCommon.h" #include "GPUState.h" #include "ChunkFile.h" -#if defined(USING_QT_UI) +#include "Core/MemMap.h" #include "Core/Host.h" -#endif +#include "Core/HLE/sceKernelThread.h" +#include "Core/HLE/sceKernelInterrupt.h" +#include "Core/HLE/sceGe.h" static int dlIdGenerator = 1; @@ -14,8 +15,23 @@ void init() { dlIdGenerator = 1; } -int GPUCommon::listStatus(int listid) +u32 GPUCommon::DrawSync(int mode) { + if (mode < 0 || mode > 1) + return SCE_KERNEL_ERROR_INVALID_MODE; + + return 0; +} + +int GPUCommon::ListSync(int listid, int mode) { + if (mode < 0 || mode > 1) + return SCE_KERNEL_ERROR_INVALID_MODE; + + // TODO + if (mode == 0) + return 0; + + return 0; for(DisplayListQueue::iterator it(dlQueue.begin()); it != dlQueue.end(); ++it) { if(it->id == listid) @@ -35,6 +51,7 @@ u32 GPUCommon::EnqueueList(u32 listpc, u32 stall, int subIntrBase, bool head) dl.stall = stall & 0xFFFFFFF; dl.status = PSP_GE_LIST_QUEUED; dl.subIntrBase = subIntrBase; + dl.stackptr = 0; if(head) dlQueue.push_front(dl); else @@ -43,7 +60,13 @@ u32 GPUCommon::EnqueueList(u32 listpc, u32 stall, int subIntrBase, bool head) return dl.id; } -void GPUCommon::UpdateStall(int listid, u32 newstall) +u32 GPUCommon::DequeueList(int listid) +{ + // TODO + return 0; +} + +u32 GPUCommon::UpdateStall(int listid, u32 newstall) { for (auto iter = dlQueue.begin(); iter != dlQueue.end(); ++iter) { @@ -55,6 +78,23 @@ void GPUCommon::UpdateStall(int listid, u32 newstall) } ProcessDLQueue(); + + return 0; +} + +u32 GPUCommon::Continue() +{ + // TODO + return 0; +} + +u32 GPUCommon::Break(int mode) +{ + if (mode < 0 || mode > 1) + return SCE_KERNEL_ERROR_INVALID_MODE; + + // TODO + return 0; } bool GPUCommon::InterpretList(DisplayList &list) @@ -62,8 +102,6 @@ bool GPUCommon::InterpretList(DisplayList &list) time_update(); double start = time_now_d(); currentList = &list; - // Reset stackptr for safety - stackptr = 0; u32 op = 0; prev = 0; finished = false; @@ -147,6 +185,135 @@ void GPUCommon::PreExecuteOp(u32 op, u32 diff) { // Nothing to do } +void GPUCommon::ExecuteOp(u32 op, u32 diff) { + u32 cmd = op >> 24; + u32 data = op & 0xFFFFFF; + + // Handle control and drawing commands here directly. The others we delegate. + switch (cmd) { + case GE_CMD_NOP: + break; + + case GE_CMD_OFFSETADDR: + gstate_c.offsetAddr = data << 8; + // ??? + break; + + case GE_CMD_ORIGIN: + gstate_c.offsetAddr = currentList->pc; + break; + + case GE_CMD_JUMP: + { + u32 target = gstate_c.getRelativeAddress(data); + if (Memory::IsValidAddress(target)) { + currentList->pc = target - 4; // pc will be increased after we return, counteract that + } else { + ERROR_LOG(G3D, "JUMP to illegal address %08x - ignoring! data=%06x", target, data); + } + } + break; + + case GE_CMD_CALL: + { + // Saint Seiya needs correct support for relative calls. + u32 retval = currentList->pc + 4; + u32 target = gstate_c.getRelativeAddress(data); + if (currentList->stackptr == ARRAY_SIZE(currentList->stack)) { + ERROR_LOG(G3D, "CALL: Stack full!"); + } else if (!Memory::IsValidAddress(target)) { + ERROR_LOG(G3D, "CALL to illegal address %08x - ignoring! data=%06x", target, data); + } else { + currentList->stack[currentList->stackptr++] = retval; + currentList->pc = target - 4; // pc will be increased after we return, counteract that + } + } + break; + + case GE_CMD_RET: + { + if (currentList->stackptr == 0) { + ERROR_LOG(G3D, "RET: Stack empty!"); + } else { + u32 target = (currentList->pc & 0xF0000000) | (currentList->stack[--currentList->stackptr] & 0x0FFFFFFF); + //target = (target + gstate_c.originAddr) & 0xFFFFFFF; + currentList->pc = target - 4; + if (!Memory::IsValidAddress(currentList->pc)) { + ERROR_LOG(G3D, "Invalid DL PC %08x on return", currentList->pc); + finished = true; + } + } + } + break; + + case GE_CMD_SIGNAL: + { + // Processed in GE_END. Has data. + currentList->subIntrToken = data & 0xFFFF; + } + break; + + case GE_CMD_FINISH: + currentList->subIntrToken = data & 0xFFFF; + // TODO: Should this run while interrupts are suspended? + if (interruptsEnabled_) + __GeTriggerInterrupt(currentList->id, currentList->pc, currentList->subIntrBase, currentList->subIntrToken); + break; + + case GE_CMD_END: + switch (prev >> 24) { + case GE_CMD_SIGNAL: + { + currentList->status = PSP_GE_LIST_END_REACHED; + // TODO: see http://code.google.com/p/jpcsp/source/detail?r=2935# + int behaviour = (prev >> 16) & 0xFF; + int signal = prev & 0xFFFF; + int enddata = data & 0xFFFF; + // We should probably defer to sceGe here, no sense in implementing this stuff in every GPU + switch (behaviour) { + case 1: // Signal with Wait + ERROR_LOG(G3D, "Signal with Wait UNIMPLEMENTED! signal/end: %04x %04x", signal, enddata); + break; + case 2: + ERROR_LOG(G3D, "Signal without wait. signal/end: %04x %04x", signal, enddata); + break; + case 3: + ERROR_LOG(G3D, "Signal with Pause UNIMPLEMENTED! signal/end: %04x %04x", signal, enddata); + break; + case 0x10: + ERROR_LOG(G3D, "Signal with Jump UNIMPLEMENTED! signal/end: %04x %04x", signal, enddata); + break; + case 0x11: + ERROR_LOG(G3D, "Signal with Call UNIMPLEMENTED! signal/end: %04x %04x", signal, enddata); + break; + case 0x12: + ERROR_LOG(G3D, "Signal with Return UNIMPLEMENTED! signal/end: %04x %04x", signal, enddata); + break; + default: + ERROR_LOG(G3D, "UNKNOWN Signal UNIMPLEMENTED %i ! signal/end: %04x %04x", behaviour, signal, enddata); + break; + } + // TODO: Should this run while interrupts are suspended? + if (interruptsEnabled_) + __GeTriggerInterrupt(currentList->id, currentList->pc, currentList->subIntrBase, currentList->subIntrToken); + } + break; + case GE_CMD_FINISH: + currentList->status = PSP_GE_LIST_DONE; + finished = true; + break; + default: + DEBUG_LOG(G3D,"Ah, not finished: %06x", prev & 0xFFFFFF); + break; + } + break; + + default: + DEBUG_LOG(G3D,"DL Unknown: %08x @ %08x", op, currentList == NULL ? 0 : currentList->pc); + break; + } +} + void GPUCommon::DoState(PointerWrap &p) { p.Do(dlIdGenerator); p.Do(dlQueue); @@ -164,8 +331,6 @@ void GPUCommon::DoState(PointerWrap &p) { } p.Do(interruptRunning); p.Do(prev); - p.Do(stack); - p.Do(stackptr); p.Do(finished); p.DoMarker("GPUCommon"); } diff --git a/GPU/GPUCommon.h b/GPU/GPUCommon.h index 88aa151a8d..14afff7cbf 100644 --- a/GPU/GPUCommon.h +++ b/GPU/GPUCommon.h @@ -8,22 +8,30 @@ public: GPUCommon() : dlIdGenerator(1), currentList(NULL), - stackptr(0), dumpNextFrame_(false), - dumpThisFrame_(false) + dumpThisFrame_(false), + interruptsEnabled_(true) {} virtual void InterruptStart(); virtual void InterruptEnd(); + virtual void EnableInterrupts(bool enable) { + interruptsEnabled_ = enable; + } + virtual void ExecuteOp(u32 op, u32 diff); virtual void PreExecuteOp(u32 op, u32 diff); virtual bool InterpretList(DisplayList &list); virtual bool ProcessDLQueue(); - virtual void UpdateStall(int listid, u32 newstall); + virtual u32 UpdateStall(int listid, u32 newstall); virtual u32 EnqueueList(u32 listpc, u32 stall, int subIntrBase, bool head); - virtual int listStatus(int listid); + virtual u32 DequeueList(int listid); + virtual int ListSync(int listid, int mode); + virtual u32 DrawSync(int mode); virtual void DoState(PointerWrap &p); virtual bool FramebufferDirty() { return true; } + virtual u32 Continue(); + virtual u32 Break(int mode); protected: typedef std::deque DisplayListQueue; @@ -34,13 +42,11 @@ protected: bool interruptRunning; u32 prev; - u32 stack[2]; - u32 stackptr; bool finished; bool dumpNextFrame_; bool dumpThisFrame_; - + bool interruptsEnabled_; public: virtual DisplayList* getList(int listid) diff --git a/GPU/GPUInterface.h b/GPU/GPUInterface.h index f558e3ceb8..ad5fbf64cf 100644 --- a/GPU/GPUInterface.h +++ b/GPU/GPUInterface.h @@ -54,6 +54,8 @@ struct DisplayList DisplayListStatus status; int subIntrBase; u16 subIntrToken; + u32 stack[32]; + int stackptr; }; class GPUInterface @@ -68,9 +70,11 @@ public: virtual DisplayList* getList(int listid) = 0; // TODO: Much of this should probably be shared between the different GPU implementations. virtual u32 EnqueueList(u32 listpc, u32 stall, int subIntrBase, bool head) = 0; - virtual void UpdateStall(int listid, u32 newstall) = 0; - virtual void DrawSync(int mode) = 0; - virtual void Continue() = 0; + virtual u32 UpdateStall(int listid, u32 newstall) = 0; + virtual u32 DequeueList(int listid) = 0; + virtual u32 DrawSync(int mode) = 0; + virtual u32 Continue() = 0; + virtual u32 Break(int mode) = 0; virtual void InterruptStart() = 0; virtual void InterruptEnd() = 0; @@ -78,7 +82,7 @@ public: virtual void PreExecuteOp(u32 op, u32 diff) = 0; virtual void ExecuteOp(u32 op, u32 diff) = 0; virtual bool InterpretList(DisplayList& list) = 0; - virtual int listStatus(int listid) = 0; + virtual int ListSync(int listid, int mode) = 0; // Framebuffer management virtual void SetDisplayFramebuffer(u32 framebuf, u32 stride, int format) = 0; diff --git a/GPU/GeDisasm.h b/GPU/GeDisasm.h index 6badfc49a3..aa9aba955d 100644 --- a/GPU/GeDisasm.h +++ b/GPU/GeDisasm.h @@ -15,4 +15,6 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. +#include "Common/CommonTypes.h" + void GeDisassembleOp(u32 pc, u32 op, u32 prev, char *buffer); diff --git a/GPU/Null/NullGpu.cpp b/GPU/Null/NullGpu.cpp index f9153be506..88aec51ed7 100644 --- a/GPU/Null/NullGpu.cpp +++ b/GPU/Null/NullGpu.cpp @@ -25,24 +25,20 @@ NullGPU::NullGPU() { - interruptsEnabled_ = true; } NullGPU::~NullGPU() { } -void NullGPU::DrawSync(int mode) +u32 NullGPU::DrawSync(int mode) { if (mode == 0) // Wait for completion { __RunOnePendingInterrupt(); } -} - -void NullGPU::Continue() -{ + return GPUCommon::DrawSync(mode); } void NullGPU::ExecuteOp(u32 op, u32 diff) @@ -104,60 +100,6 @@ void NullGPU::ExecuteOp(u32 op, u32 diff) } break; - case GE_CMD_JUMP: - { - u32 target = (((gstate.base & 0x00FF0000) << 8) | (op & 0xFFFFFC)) & 0x0FFFFFFF; - DEBUG_LOG(G3D,"DL CMD JUMP - %08x to %08x", currentList->pc, target); - currentList->pc = target - 4; // pc will be increased after we return, counteract that - if (!Memory::IsValidAddress(currentList->pc)) - { - ERROR_LOG(G3D, "Invalid DL PC %08x on jump", currentList->pc); - finished = true; - } - } - break; - - case GE_CMD_CALL: - { - u32 retval = currentList->pc + 4; - stack[stackptr++] = retval; - u32 target = (((gstate.base & 0x00FF0000) << 8) | (op & 0xFFFFFC)) & 0xFFFFFFF; - DEBUG_LOG(G3D,"DL CMD CALL - %08x to %08x, ret=%08x", currentList->pc, target, retval); - currentList->pc = target - 4; // pc will be increased after we return, counteract that - if (!Memory::IsValidAddress(currentList->pc)) - { - ERROR_LOG(G3D, "Invalid DL PC %08x on call", currentList->pc); - finished = true; - } - } - break; - - case GE_CMD_RET: - //TODO : debug! - { - u32 target = stack[--stackptr] & 0xFFFFFFF; - DEBUG_LOG(G3D,"DL CMD RET - from %08x to %08x", currentList->pc, target); - currentList->pc = target - 4; - if (!Memory::IsValidAddress(currentList->pc)) - { - ERROR_LOG(G3D, "Invalid DL PC %08x on return", currentList->pc); - finished = true; - } - } - break; - - case GE_CMD_SIGNAL: - { - ERROR_LOG(G3D, "DL GE_CMD_SIGNAL %08x", data & 0xFFFFFF); - int behaviour = (data >> 16) & 0xFF; - currentList->subIntrToken = data & 0xFFFF; - - // TODO: Should this run while interrupts are suspended? - if (interruptsEnabled_) - __GeTriggerInterrupt(currentList->id, currentList->pc, currentList->subIntrBase, currentList->subIntrToken); - } - break; - case GE_CMD_BJUMP: // bounding box jump. Let's just not jump, for now. DEBUG_LOG(G3D,"DL BBOX JUMP - unimplemented"); @@ -168,49 +110,11 @@ void NullGPU::ExecuteOp(u32 op, u32 diff) DEBUG_LOG(G3D,"DL BBOX TEST - unimplemented"); break; - case GE_CMD_ORIGIN: - gstate.offsetAddr = currentList->pc & 0xFFFFFF; - gstate_c.offsetAddr = currentList->pc; - break; - case GE_CMD_VERTEXTYPE: DEBUG_LOG(G3D,"DL SetVertexType: %06x", data); // This sets through-mode or not, as well. break; - case GE_CMD_OFFSETADDR: - // offsetAddr = data<<8; - break; - - - case GE_CMD_FINISH: - DEBUG_LOG(G3D,"DL CMD FINISH"); - currentList->subIntrToken = data & 0xFFFF; - // TODO: Should this run while interrupts are suspended? - if (interruptsEnabled_) - __GeTriggerInterrupt(currentList->id, currentList->pc, currentList->subIntrBase, currentList->subIntrToken); - break; - - case GE_CMD_END: - DEBUG_LOG(G3D,"DL CMD END"); - { - switch (prev >> 24) - { - case GE_CMD_FINISH: - finished = true; - break; - default: - DEBUG_LOG(G3D,"Ah, not finished: %06x", prev & 0xFFFFFF); - break; - } - } - - // This should generate a Reading Ended interrupt - // if (interruptsEnabled_) - // __TriggerInterrupt(PSP_GE_INTR); - - break; - case GE_CMD_REGION1: { int x1 = data & 0x3ff; @@ -744,10 +648,8 @@ void NullGPU::ExecuteOp(u32 op, u32 diff) break; default: - DEBUG_LOG(G3D,"DL Unknown: %08x @ %08x", op, currentList->pc); + GPUCommon::ExecuteOp(op, diff); break; - - //ETC... } } diff --git a/GPU/Null/NullGpu.h b/GPU/Null/NullGpu.h index 0b50aa83a2..41093c0fdc 100644 --- a/GPU/Null/NullGpu.h +++ b/GPU/Null/NullGpu.h @@ -28,11 +28,7 @@ public: ~NullGPU(); virtual void InitClear() {} virtual void ExecuteOp(u32 op, u32 diff); - virtual void Continue(); - virtual void DrawSync(int mode); - virtual void EnableInterrupts(bool enable) { - interruptsEnabled_ = enable; - } + virtual u32 DrawSync(int mode); virtual void BeginFrame() {} virtual void SetDisplayFramebuffer(u32 framebuf, u32 stride, int format) {} @@ -46,7 +42,4 @@ public: virtual void DumpNextFrame() {} virtual void Resized() {} - -private: - bool interruptsEnabled_; };