Reinitialize the GE on sceKernelLoadExec().

Mostly, reset the lists and draw completion, etc.

May be required for Capcom Classic Collection Reloaded to work.
This commit is contained in:
Unknown W. Brackets 2013-11-28 15:34:41 -08:00
parent a29f1a9192
commit 435115441d
6 changed files with 27 additions and 9 deletions

View File

@ -47,6 +47,8 @@
#include "Core/HLE/sceIo.h" #include "Core/HLE/sceIo.h"
#include "Core/HLE/KernelWaitHelpers.h" #include "Core/HLE/KernelWaitHelpers.h"
#include "GPU/GPUState.h"
enum { enum {
PSP_THREAD_ATTR_USER = 0x80000000 PSP_THREAD_ATTR_USER = 0x80000000
}; };
@ -1223,6 +1225,7 @@ bool __KernelLoadExec(const char *filename, u32 paramPtr, std::string *error_str
//HLE needs to be reset here //HLE needs to be reset here
HLEShutdown(); HLEShutdown();
HLEInit(); HLEInit();
GPU_Reinitialize();
} }
__KernelModuleInit(); __KernelModuleInit();

View File

@ -15,22 +15,28 @@
#include "Core/HLE/sceGe.h" #include "Core/HLE/sceGe.h"
GPUCommon::GPUCommon() : GPUCommon::GPUCommon() :
nextListID(0),
currentList(NULL),
isbreak(false),
drawCompleteTicks(0),
busyTicks(0),
dumpNextFrame_(false), dumpNextFrame_(false),
dumpThisFrame_(false), dumpThisFrame_(false)
interruptsEnabled_(true),
curTickEst_(0)
{ {
Reinitialize();
SetThreadEnabled(g_Config.bSeparateCPUThread);
}
void GPUCommon::Reinitialize() {
easy_guard guard(listLock);
memset(dls, 0, sizeof(dls)); memset(dls, 0, sizeof(dls));
for (int i = 0; i < DisplayListMaxCount; ++i) { for (int i = 0; i < DisplayListMaxCount; ++i) {
dls[i].state = PSP_GE_DL_STATE_NONE; dls[i].state = PSP_GE_DL_STATE_NONE;
dls[i].waitTicks = 0; dls[i].waitTicks = 0;
} }
SetThreadEnabled(g_Config.bSeparateCPUThread);
nextListID = 0;
currentList = NULL;
isbreak = false;
drawCompleteTicks = 0;
busyTicks = 0;
interruptsEnabled_ = true;
UpdateTickEstimate(0);
} }
void GPUCommon::PopDLQueue() { void GPUCommon::PopDLQueue() {

View File

@ -19,6 +19,7 @@ class GPUCommon : public GPUThreadEventQueue, public GPUDebugInterface
public: public:
GPUCommon(); GPUCommon();
virtual ~GPUCommon() {} virtual ~GPUCommon() {}
virtual void Reinitialize();
virtual void InterruptStart(int listid); virtual void InterruptStart(int listid);
virtual void InterruptEnd(int listid); virtual void InterruptEnd(int listid);

View File

@ -184,6 +184,7 @@ public:
// Initialization // Initialization
virtual void InitClear() = 0; virtual void InitClear() = 0;
virtual void Reinitialize() = 0;
virtual void RunEventsUntil(u64 globalticks) = 0; virtual void RunEventsUntil(u64 globalticks) = 0;
virtual void FinishEventLoop() = 0; virtual void FinishEventLoop() = 0;

View File

@ -81,6 +81,12 @@ void GPU_Shutdown() {
gpuDebug = 0; gpuDebug = 0;
} }
void GPU_Reinitialize() {
if (gpu) {
gpu->Reinitialize();
}
}
void InitGfxState() { void InitGfxState() {
memset(&gstate, 0, sizeof(gstate)); memset(&gstate, 0, sizeof(gstate));
memset(&gstate_c, 0, sizeof(gstate_c)); memset(&gstate_c, 0, sizeof(gstate_c));

View File

@ -522,6 +522,7 @@ struct GPUStatistics {
bool GPU_Init(); bool GPU_Init();
void GPU_Shutdown(); void GPU_Shutdown();
void GPU_Reinitialize();
void InitGfxState(); void InitGfxState();
void ShutdownGfxState(); void ShutdownGfxState();