mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-12-01 10:13:43 +01:00
Merge branch 'master' into mediaengine.
Note: doesn't compile, just fixes conflicts. Conflicts: Core/HLE/sceKernel.cpp Core/HLE/sceKernelThread.cpp Core/HLE/sceKernelThread.h
This commit is contained in:
commit
6f9f9e1c98
212 files changed
+11915
-5209
No files matched your search
+155
-14
@@ -24,13 +24,17 @@
|
||||
#include "../FileSystems/MetaFileSystem.h"
|
||||
#include "../PSPLoaders.h"
|
||||
#include "../../Core/CoreTiming.h"
|
||||
#include "../../Core/SaveState.h"
|
||||
#include "../../Core/System.h"
|
||||
#include "../../GPU/GPUInterface.h"
|
||||
#include "../../GPU/GPUState.h"
|
||||
|
||||
|
||||
#include "__sceAudio.h"
|
||||
#include "sceAudio.h"
|
||||
#include "sceCtrl.h"
|
||||
#include "sceDisplay.h"
|
||||
#include "sceFont.h"
|
||||
#include "sceGe.h"
|
||||
#include "sceIo.h"
|
||||
#include "sceKernel.h"
|
||||
@@ -53,11 +57,11 @@
|
||||
#include "sceSsl.h"
|
||||
#include "sceSas.h"
|
||||
#include "scePsmf.h"
|
||||
#include "sceImpose.h"
|
||||
#include "sceUsb.h"
|
||||
|
||||
#include "../Util/PPGeDraw.h"
|
||||
|
||||
extern MetaFileSystem pspFileSystem;
|
||||
|
||||
/*
|
||||
17: [MIPS32 R4K 00000000 ]: Loader: Type: 1 Vaddr: 00000000 Filesz: 2856816 Memsz: 2856816
|
||||
18: [MIPS32 R4K 00000000 ]: Loader: Loadable Segment Copied to 0898dab0, size 002b9770
|
||||
@@ -66,6 +70,7 @@ extern MetaFileSystem pspFileSystem;
|
||||
*/
|
||||
|
||||
static bool kernelRunning = false;
|
||||
KernelObjectPool kernelObjects;
|
||||
|
||||
void __KernelInit()
|
||||
{
|
||||
@@ -75,13 +80,19 @@ void __KernelInit()
|
||||
return;
|
||||
}
|
||||
|
||||
SaveState::Init();
|
||||
__InterruptsInit();
|
||||
__KernelMemoryInit();
|
||||
__KernelThreadingInit();
|
||||
__KernelAlarmInit();
|
||||
__KernelEventFlagInit();
|
||||
__KernelMbxInit();
|
||||
__KernelMutexInit();
|
||||
__KernelSemaInit();
|
||||
__IoInit();
|
||||
__AudioInit();
|
||||
__SasInit();
|
||||
__DisplayInit();
|
||||
__InterruptsInit();
|
||||
__GeInit();
|
||||
__PowerInit();
|
||||
__UtilityInit();
|
||||
@@ -90,6 +101,9 @@ void __KernelInit()
|
||||
__PsmfInit();
|
||||
__CtrlInit();
|
||||
__SslInit();
|
||||
__ImposeInit();
|
||||
__UsbInit();
|
||||
__FontInit();
|
||||
|
||||
// "Internal" PSP libraries
|
||||
__PPGeInit();
|
||||
@@ -113,13 +127,17 @@ void __KernelShutdown()
|
||||
__PsmfShutdown();
|
||||
__PPGeShutdown();
|
||||
|
||||
__CtrlShutdown();
|
||||
__UtilityShutdown();
|
||||
__GeShutdown();
|
||||
__SasShutdown();
|
||||
__DisplayShutdown();
|
||||
__AudioShutdown();
|
||||
__IoShutdown();
|
||||
__InterruptsShutdown();
|
||||
__KernelMutexShutdown();
|
||||
__KernelThreadingShutdown();
|
||||
__KernelMemoryShutdown();
|
||||
__InterruptsShutdown();
|
||||
|
||||
CoreTiming::ClearPendingEvents();
|
||||
CoreTiming::UnregisterAllEvents();
|
||||
@@ -127,6 +145,42 @@ void __KernelShutdown()
|
||||
kernelRunning = false;
|
||||
}
|
||||
|
||||
void __KernelDoState(PointerWrap &p)
|
||||
{
|
||||
p.Do(kernelRunning);
|
||||
kernelObjects.DoState(p);
|
||||
p.DoMarker("KernelObjects");
|
||||
|
||||
__InterruptsDoState(p);
|
||||
__KernelMemoryDoState(p);
|
||||
__KernelThreadingDoState(p);
|
||||
__KernelAlarmDoState(p);
|
||||
__KernelEventFlagDoState(p);
|
||||
__KernelMbxDoState(p);
|
||||
__KernelModuleDoState(p);
|
||||
__KernelMutexDoState(p);
|
||||
__KernelSemaDoState(p);
|
||||
|
||||
__AudioDoState(p);
|
||||
__CtrlDoState(p);
|
||||
__DisplayDoState(p);
|
||||
__FontDoState(p);
|
||||
__GeDoState(p);
|
||||
__ImposeDoState(p);
|
||||
__IoDoState(p);
|
||||
__PowerDoState(p);
|
||||
__SasDoState(p);
|
||||
__SslDoState(p);
|
||||
__UmdDoState(p);
|
||||
__UtilityDoState(p);
|
||||
__UsbDoState(p);
|
||||
|
||||
__PPGeDoState(p);
|
||||
|
||||
__InterruptsDoStateLate(p);
|
||||
__KernelThreadingDoStateLate(p);
|
||||
}
|
||||
|
||||
bool __KernelIsRunning() {
|
||||
return kernelRunning;
|
||||
}
|
||||
@@ -189,22 +243,27 @@ void sceKernelGetGPI()
|
||||
}
|
||||
|
||||
// Don't even log these, they're spammy and we probably won't
|
||||
// need to emulate them.
|
||||
// need to emulate them. Might be useful for invalidating cached
|
||||
// textures, and in the future display lists, in some cases though.
|
||||
void sceKernelDcacheInvalidateRange(u32 addr, int size)
|
||||
{
|
||||
gpu->InvalidateCache(addr, size);
|
||||
}
|
||||
void sceKernelDcacheWritebackAll()
|
||||
{
|
||||
}
|
||||
void sceKernelDcacheWritebackRange()
|
||||
void sceKernelDcacheWritebackRange(u32 addr, int size)
|
||||
{
|
||||
}
|
||||
void sceKernelDcacheWritebackInvalidateRange()
|
||||
void sceKernelDcacheWritebackInvalidateRange(u32 addr, int size)
|
||||
{
|
||||
gpu->InvalidateCache(addr, size);
|
||||
}
|
||||
void sceKernelDcacheWritebackInvalidateAll()
|
||||
{
|
||||
gpu->InvalidateCache(0, -1);
|
||||
}
|
||||
|
||||
KernelObjectPool kernelObjects;
|
||||
|
||||
KernelObjectPool::KernelObjectPool()
|
||||
{
|
||||
memset(occupied, 0, sizeof(bool)*maxCount);
|
||||
@@ -267,12 +326,12 @@ void KernelObjectPool::List()
|
||||
if (pool[i])
|
||||
{
|
||||
pool[i]->GetQuickInfo(buffer,256);
|
||||
INFO_LOG(HLE, "KO %i: %s \"%s\": %s", i + handleOffset, pool[i]->GetTypeName(), pool[i]->GetName(), buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(buffer,"WTF? Zero Pointer");
|
||||
}
|
||||
INFO_LOG(HLE, "KO %i: %s \"%s\": %s", i + handleOffset, pool[i]->GetTypeName(), pool[i]->GetName(), buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -288,6 +347,88 @@ int KernelObjectPool::GetCount()
|
||||
return count;
|
||||
}
|
||||
|
||||
void KernelObjectPool::DoState(PointerWrap &p)
|
||||
{
|
||||
int _maxCount = maxCount;
|
||||
p.Do(_maxCount);
|
||||
|
||||
if (_maxCount != maxCount)
|
||||
ERROR_LOG(HLE, "Unable to load state: different kernel object storage.");
|
||||
|
||||
if (p.mode == p.MODE_READ)
|
||||
kernelObjects.Clear();
|
||||
|
||||
p.DoArray(occupied, maxCount);
|
||||
for (int i = 0; i < maxCount; ++i)
|
||||
{
|
||||
if (!occupied[i])
|
||||
continue;
|
||||
|
||||
int type;
|
||||
if (p.mode == p.MODE_READ)
|
||||
{
|
||||
p.Do(type);
|
||||
pool[i] = CreateByIDType(type);
|
||||
pool[i]->uid = i + handleOffset;
|
||||
|
||||
// Already logged an error.
|
||||
if (pool[i] == NULL)
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
type = pool[i]->GetIDType();
|
||||
p.Do(type);
|
||||
}
|
||||
pool[i]->DoState(p);
|
||||
}
|
||||
p.DoMarker("KernelObjectPool");
|
||||
}
|
||||
|
||||
KernelObject *KernelObjectPool::CreateByIDType(int type)
|
||||
{
|
||||
// Used for save states. This is ugly, but what other way is there?
|
||||
switch (type)
|
||||
{
|
||||
case SCE_KERNEL_TMID_Alarm:
|
||||
return __KernelAlarmObject();
|
||||
case SCE_KERNEL_TMID_EventFlag:
|
||||
return __KernelEventFlagObject();
|
||||
case SCE_KERNEL_TMID_Mbox:
|
||||
return __KernelMbxObject();
|
||||
case SCE_KERNEL_TMID_Fpl:
|
||||
return __KernelMemoryFPLObject();
|
||||
case SCE_KERNEL_TMID_Vpl:
|
||||
return __KernelMemoryVPLObject();
|
||||
case PPSSPP_KERNEL_TMID_PMB:
|
||||
return __KernelMemoryPMBObject();
|
||||
case PPSSPP_KERNEL_TMID_Module:
|
||||
return __KernelModuleObject();
|
||||
case SCE_KERNEL_TMID_Mpipe:
|
||||
return __KernelMsgPipeObject();
|
||||
case SCE_KERNEL_TMID_Mutex:
|
||||
return __KernelMutexObject();
|
||||
case SCE_KERNEL_TMID_LwMutex:
|
||||
return __KernelLwMutexObject();
|
||||
case SCE_KERNEL_TMID_Semaphore:
|
||||
return __KernelSemaphoreObject();
|
||||
case SCE_KERNEL_TMID_Callback:
|
||||
return __KernelCallbackObject();
|
||||
case SCE_KERNEL_TMID_Thread:
|
||||
return __KernelThreadObject();
|
||||
case SCE_KERNEL_TMID_VTimer:
|
||||
return __KernelVTimerObject();
|
||||
case PPSSPP_KERNEL_TMID_File:
|
||||
return __KernelFileNodeObject();
|
||||
case PPSSPP_KERNEL_TMID_DirList:
|
||||
return __KernelDirListingObject();
|
||||
|
||||
default:
|
||||
ERROR_LOG(COMMON, "Unable to load state: could not find object type %d.", type);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void sceKernelIcacheInvalidateAll()
|
||||
{
|
||||
DEBUG_LOG(CPU, "Icache invalidated - should clear JIT someday");
|
||||
@@ -418,10 +559,10 @@ const HLEFunction ThreadManForUser[] =
|
||||
{0x64D4540E,0,"sceKernelReferThreadProfiler"},
|
||||
|
||||
//Fifa Street 2 uses alarms
|
||||
{0x6652b8ca,sceKernelSetAlarm,"sceKernelSetAlarm"},
|
||||
{0xB2C25152,sceKernelSetSysClockAlarm,"sceKernelSetSysClockAlarm"},
|
||||
{0x7e65b999,sceKernelCancelAlarm,"sceKernelCancelAlarm"},
|
||||
{0xDAA3F564,sceKernelReferAlarmStatus,"sceKernelReferAlarmStatus"},
|
||||
{0x6652b8ca,WrapI_UUU<sceKernelSetAlarm>,"sceKernelSetAlarm"},
|
||||
{0xB2C25152,WrapI_UUU<sceKernelSetSysClockAlarm>,"sceKernelSetSysClockAlarm"},
|
||||
{0x7e65b999,WrapI_I<sceKernelCancelAlarm>,"sceKernelCancelAlarm"},
|
||||
{0xDAA3F564,WrapI_IU<sceKernelReferAlarmStatus>,"sceKernelReferAlarmStatus"},
|
||||
|
||||
{0xba6b92e2,sceKernelSysClock2USec,"sceKernelSysClock2USec"},
|
||||
{0x110DEC9A,0,"sceKernelUSec2SysClock"},
|
||||
|
||||
Reference in new issue
Block a user