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/KernelWaitHelpers.h"
#include "GPU/GPUState.h"
enum {
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
HLEShutdown();
HLEInit();
GPU_Reinitialize();
}
__KernelModuleInit();

View File

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

View File

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

View File

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

View File

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

View File

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