Add support for sceGeGetStack() for debugging.

This commit is contained in:
Unknown W. Brackets 2013-09-21 10:03:49 -07:00
parent e6ef2621ee
commit 863eb83e4c
4 changed files with 36 additions and 0 deletions

View file

@ -552,6 +552,12 @@ u32 sceGeGetCmd(int cmd)
return gstate.cmdmem[cmd]; // Does not mask away the high bits.
}
int sceGeGetStack(int index, u32 stackPtr)
{
WARN_LOG_REPORT(SCEGE, "sceGeGetStack(%i, %08x)", index, stackPtr);
return gpu->GetStack(index, stackPtr);
}
u32 sceGeEdramSetAddrTranslation(int new_size)
{
bool outsideRange = new_size != 0 && (new_size < 0x200 || new_size > 0x1000);
@ -588,6 +594,7 @@ const HLEFunction sceGe_user[] =
{0x438A385A, WrapU_U<sceGeSaveContext>, "sceGeSaveContext"},
{0x0BF608FB, WrapU_U<sceGeRestoreContext>, "sceGeRestoreContext"},
{0x5FB86AB0, WrapI_U<sceGeListDeQueue>, "sceGeListDeQueue"},
{0xE66CB92E, WrapI_IU<sceGeGetStack>, "sceGeGetStack"},
};
void Register_sceGe_user()

View file

@ -157,6 +157,33 @@ int GPUCommon::ListSync(int listid, int mode) {
return PSP_GE_LIST_COMPLETED;
}
int GPUCommon::GetStack(int index, u32 stackPtr) {
easy_guard guard(listLock);
if (currentList == NULL) {
// Seems like it doesn't return an error code?
return 0;
}
if (currentList->stackptr <= index) {
return SCE_KERNEL_ERROR_INVALID_INDEX;
}
if (index >= 0) {
PSPPointer<u32> stack;
stack = stackPtr;
if (stack.IsValid()) {
auto entry = currentList->stack[index];
// Not really sure what most of these values are.
stack[0] = 0;
stack[1] = entry.pc + 4;
stack[2] = entry.offsetAddr;
stack[7] = entry.baseAddr;
}
}
return currentList->stackptr;
}
u32 GPUCommon::EnqueueList(u32 listpc, u32 stall, int subIntrBase, PSPPointer<PspGeListArgs> args, bool head) {
easy_guard guard(listLock);
// TODO Check the stack values in missing arg and ajust the stack depth

View file

@ -34,6 +34,7 @@ public:
virtual u32 DequeueList(int listid);
virtual int ListSync(int listid, int mode);
virtual u32 DrawSync(int mode);
virtual int GetStack(int index, u32 stackPtr);
virtual void DoState(PointerWrap &p);
virtual bool FramebufferDirty() {
SyncThread();

View file

@ -197,6 +197,7 @@ public:
virtual int ListSync(int listid, int mode) = 0;
virtual u32 Continue() = 0;
virtual u32 Break(int mode) = 0;
virtual int GetStack(int index, u32 stackPtr) = 0;
virtual void InterruptStart(int listid) = 0;
virtual void InterruptEnd(int listid) = 0;