mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Use *_le for the sceKernel* funcs.
This commit is contained in:
1 parent
f1c354607e
commit
81f7103e0b
17 files changed
+234
-212
No files matched your search
+1
-1
@@ -1610,7 +1610,7 @@ int __IoIoctl(u32 id, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 out
|
||||
// Get UMD file offset
|
||||
case 0x01020004:
|
||||
{
|
||||
s32 offset = pspFileSystem.GetSeekPos(f->handle);
|
||||
u32 offset = (u32)pspFileSystem.GetSeekPos(f->handle);
|
||||
INFO_LOG(HLE, "sceIoIoCtl: Asked for file offset of file %i", id);
|
||||
if (Memory::IsValidAddress(outdataPtr) && outlen >= 4) {
|
||||
Memory::Write_U32(offset, outdataPtr);
|
||||
|
||||
+12
-4
@@ -346,12 +346,20 @@ typedef int SceMode;
|
||||
typedef s64 SceOff;
|
||||
typedef u64 SceIores;
|
||||
|
||||
typedef s32_le SceUID_le;
|
||||
typedef u32_le SceSize_le;
|
||||
typedef s32_le SceSSize_le;
|
||||
typedef u32_le SceUInt_le;
|
||||
typedef s32_le SceMode_le;
|
||||
typedef s64_le SceOff_le;
|
||||
typedef s64_le SceIores_le;
|
||||
|
||||
struct SceKernelLoadExecParam
|
||||
{
|
||||
SceSize size; // Size of the structure
|
||||
SceSize args; // Size of the arg string
|
||||
u32 argp; // Pointer to the arg string
|
||||
u32 keyp; // Encryption key? Not yet used
|
||||
SceSize_le size; // Size of the structure
|
||||
SceSize_le args; // Size of the arg string
|
||||
u32_le argp; // Pointer to the arg string
|
||||
u32_le keyp; // Encryption key? Not yet used
|
||||
};
|
||||
|
||||
void __KernelInit();
|
||||
|
||||
@@ -29,10 +29,10 @@ std::list<SceUID> triggeredAlarm;
|
||||
|
||||
struct NativeAlarm
|
||||
{
|
||||
SceSize size;
|
||||
u64 schedule;
|
||||
u32 handlerPtr;
|
||||
u32 commonPtr;
|
||||
SceSize_le size;
|
||||
u64_le schedule;
|
||||
u32_le handlerPtr;
|
||||
u32_le commonPtr;
|
||||
};
|
||||
|
||||
struct Alarm : public KernelObject
|
||||
|
||||
@@ -31,12 +31,12 @@ void __KernelEventFlagTimeout(u64 userdata, int cycleslate);
|
||||
|
||||
struct NativeEventFlag
|
||||
{
|
||||
u32 size;
|
||||
u32_le size;
|
||||
char name[KERNELOBJECT_MAX_NAME_LENGTH + 1];
|
||||
u32 attr;
|
||||
u32 initPattern;
|
||||
u32 currentPattern;
|
||||
int numWaitThreads;
|
||||
u32_le attr;
|
||||
u32_le initPattern;
|
||||
u32_le currentPattern;
|
||||
s32_le numWaitThreads;
|
||||
};
|
||||
|
||||
struct EventFlagTh
|
||||
|
||||
@@ -40,12 +40,12 @@ static int mbxWaitTimer = -1;
|
||||
|
||||
struct NativeMbx
|
||||
{
|
||||
SceSize size;
|
||||
SceSize_le size;
|
||||
char name[KERNELOBJECT_MAX_NAME_LENGTH + 1];
|
||||
SceUInt attr;
|
||||
int numWaitThreads;
|
||||
int numMessages;
|
||||
u32 packetListHead;
|
||||
SceUInt_le attr;
|
||||
s32_le numWaitThreads;
|
||||
s32_le numMessages;
|
||||
u32_le packetListHead;
|
||||
};
|
||||
|
||||
struct Mbx : public KernelObject
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
struct NativeMbxPacket
|
||||
{
|
||||
u32 next;
|
||||
u32_le next;
|
||||
u8 priority;
|
||||
u8 padding[3];
|
||||
};
|
||||
|
||||
@@ -49,15 +49,15 @@ int compilerVersion_;
|
||||
|
||||
struct NativeFPL
|
||||
{
|
||||
u32 size;
|
||||
u32_le size;
|
||||
char name[KERNELOBJECT_MAX_NAME_LENGTH+1];
|
||||
SceUID mpid;
|
||||
u32 attr;
|
||||
SceUID_le mpid;
|
||||
u32_le attr;
|
||||
|
||||
int blocksize;
|
||||
int numBlocks;
|
||||
int numFreeBlocks;
|
||||
int numWaitThreads;
|
||||
s32_le blocksize;
|
||||
s32_le numBlocks;
|
||||
s32_le numFreeBlocks;
|
||||
s32_le numWaitThreads;
|
||||
};
|
||||
|
||||
//FPL - Fixed Length Dynamic Memory Pool - every item has the same length
|
||||
@@ -121,12 +121,12 @@ struct VplWaitingThread
|
||||
|
||||
struct SceKernelVplInfo
|
||||
{
|
||||
SceSize size;
|
||||
SceSize_le size;
|
||||
char name[KERNELOBJECT_MAX_NAME_LENGTH+1];
|
||||
SceUInt attr;
|
||||
int poolSize;
|
||||
int freeSize;
|
||||
int numWaitThreads;
|
||||
SceUInt_le attr;
|
||||
s32_le poolSize;
|
||||
s32_le freeSize;
|
||||
s32_le numWaitThreads;
|
||||
};
|
||||
|
||||
struct VPL : public KernelObject
|
||||
@@ -1319,14 +1319,14 @@ enum
|
||||
|
||||
struct NativeTls
|
||||
{
|
||||
SceSize size;
|
||||
SceSize_le size;
|
||||
char name[32];
|
||||
SceUInt attr;
|
||||
int index;
|
||||
u32 blockSize;
|
||||
u32 totalBlocks;
|
||||
u32 freeBlocks;
|
||||
u32 numWaitThreads;
|
||||
SceUInt_le attr;
|
||||
s32_le index;
|
||||
u32_le blockSize;
|
||||
u32_le totalBlocks;
|
||||
u32_le freeBlocks;
|
||||
u32_le numWaitThreads;
|
||||
};
|
||||
|
||||
struct TLS : public KernelObject
|
||||
|
||||
@@ -97,57 +97,57 @@ struct VarSymbol {
|
||||
};
|
||||
|
||||
struct NativeModule {
|
||||
u32 next;
|
||||
u16 attribute;
|
||||
u32_le next;
|
||||
u16_le attribute;
|
||||
u8 version[2];
|
||||
char name[28];
|
||||
u32 status;
|
||||
u32 unk1;
|
||||
u32 usermod_thid;
|
||||
u32 memid;
|
||||
u32 mpidtext;
|
||||
u32 mpiddata;
|
||||
u32 ent_top;
|
||||
u32 ent_size;
|
||||
u32 stub_top;
|
||||
u32 stub_size;
|
||||
u32 module_start_func;
|
||||
u32 module_stop_func;
|
||||
u32 module_bootstart_func;
|
||||
u32 module_reboot_before_func;
|
||||
u32 module_reboot_phase_func;
|
||||
u32 entry_addr;
|
||||
u32 gp_value;
|
||||
u32 text_addr;
|
||||
u32 text_size;
|
||||
u32 data_size;
|
||||
u32 bss_size;
|
||||
u32 nsegment;
|
||||
u32 segmentaddr[4];
|
||||
u32 segmentsize[4];
|
||||
u32 module_start_thread_priority;
|
||||
u32 module_start_thread_stacksize;
|
||||
u32 module_start_thread_attr;
|
||||
u32 module_stop_thread_priority;
|
||||
u32 module_stop_thread_stacksize;
|
||||
u32 module_stop_thread_attr;
|
||||
u32 module_reboot_before_thread_priority;
|
||||
u32 module_reboot_before_thread_stacksize;
|
||||
u32 module_reboot_before_thread_attr;
|
||||
u32_le status;
|
||||
u32_le unk1;
|
||||
u32_le usermod_thid;
|
||||
u32_le memid;
|
||||
u32_le mpidtext;
|
||||
u32_le mpiddata;
|
||||
u32_le ent_top;
|
||||
u32_le ent_size;
|
||||
u32_le stub_top;
|
||||
u32_le stub_size;
|
||||
u32_le module_start_func;
|
||||
u32_le module_stop_func;
|
||||
u32_le module_bootstart_func;
|
||||
u32_le module_reboot_before_func;
|
||||
u32_le module_reboot_phase_func;
|
||||
u32_le entry_addr;
|
||||
u32_le gp_value;
|
||||
u32_le text_addr;
|
||||
u32_le text_size;
|
||||
u32_le data_size;
|
||||
u32_le bss_size;
|
||||
u32_le nsegment;
|
||||
u32_le segmentaddr[4];
|
||||
u32_le segmentsize[4];
|
||||
u32_le module_start_thread_priority;
|
||||
u32_le module_start_thread_stacksize;
|
||||
u32_le module_start_thread_attr;
|
||||
u32_le module_stop_thread_priority;
|
||||
u32_le module_stop_thread_stacksize;
|
||||
u32_le module_stop_thread_attr;
|
||||
u32_le module_reboot_before_thread_priority;
|
||||
u32_le module_reboot_before_thread_stacksize;
|
||||
u32_le module_reboot_before_thread_attr;
|
||||
};
|
||||
|
||||
// by QueryModuleInfo
|
||||
struct ModuleInfo {
|
||||
u32 nsegment;
|
||||
u32 segmentaddr[4];
|
||||
u32 segmentsize[4];
|
||||
u32 entry_addr;
|
||||
u32 gp_value;
|
||||
u32 text_addr;
|
||||
u32 text_size;
|
||||
u32 data_size;
|
||||
u32 bss_size;
|
||||
u16 attribute;
|
||||
u32_le nsegment;
|
||||
u32_le segmentaddr[4];
|
||||
u32_le segmentsize[4];
|
||||
u32_le entry_addr;
|
||||
u32_le gp_value;
|
||||
u32_le text_addr;
|
||||
u32_le text_size;
|
||||
u32_le data_size;
|
||||
u32_le bss_size;
|
||||
u16_le attribute;
|
||||
u8 version[2];
|
||||
char name[28];
|
||||
};
|
||||
@@ -234,29 +234,29 @@ void AfterModuleEntryCall::run(MipsCall &call) {
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
struct StartModuleInfo
|
||||
{
|
||||
u32 size;
|
||||
u32 mpidtext;
|
||||
u32 mpiddata;
|
||||
u32 threadpriority;
|
||||
u32 threadattributes;
|
||||
u32_le size;
|
||||
u32_le mpidtext;
|
||||
u32_le mpiddata;
|
||||
u32_le threadpriority;
|
||||
u32_le threadattributes;
|
||||
};
|
||||
|
||||
struct SceKernelLMOption {
|
||||
SceSize size;
|
||||
SceUID mpidtext;
|
||||
SceUID mpiddata;
|
||||
unsigned int flags;
|
||||
SceSize_le size;
|
||||
SceUID_le mpidtext;
|
||||
SceUID_le mpiddata;
|
||||
u32_le flags;
|
||||
char position;
|
||||
char access;
|
||||
char creserved[2];
|
||||
};
|
||||
|
||||
struct SceKernelSMOption {
|
||||
SceSize size;
|
||||
SceUID mpidstack;
|
||||
SceSize stacksize;
|
||||
int priority;
|
||||
unsigned int attribute;
|
||||
SceSize_le size;
|
||||
SceUID_le mpidstack;
|
||||
SceSize_le stacksize;
|
||||
s32_le priority;
|
||||
u32_le attribute;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@@ -443,11 +443,12 @@ Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, std::string *erro
|
||||
memset(&module->nm, 0, sizeof(module->nm));
|
||||
|
||||
u8 *newptr = 0;
|
||||
if (*(u32*)ptr == 0x4543537e) { // "~SCE"
|
||||
u32_le *magicPtr = (u32_le *) ptr;
|
||||
if (*magicPtr == 0x4543537e) { // "~SCE"
|
||||
INFO_LOG(HLE, "~SCE module, skipping header");
|
||||
ptr += *(u32*)(ptr + 4);
|
||||
}
|
||||
*magic = *(u32*)ptr;
|
||||
*magic = *magicPtr;
|
||||
if (*magic == 0x5053507e) { // "~PSP"
|
||||
INFO_LOG(HLE, "Decrypting ~PSP file");
|
||||
PSP_Header *head = (PSP_Header*)ptr;
|
||||
@@ -480,7 +481,7 @@ Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, std::string *erro
|
||||
}
|
||||
|
||||
// DO NOT change to else if, see above.
|
||||
if (*(u32*)ptr != 0x464c457f) {
|
||||
if (*magicPtr != 0x464c457f) {
|
||||
ERROR_LOG_REPORT(HLE, "Wrong magic number %08x", *(u32*)ptr);
|
||||
*error_string = "File corrupt";
|
||||
if (newptr)
|
||||
@@ -504,15 +505,15 @@ Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, std::string *erro
|
||||
struct PspModuleInfo
|
||||
{
|
||||
// 0, 0, 1, 1 ?
|
||||
u16 moduleAttrs; //0x0000 User Mode, 0x1000 Kernel Mode
|
||||
u16 moduleVersion;
|
||||
u16_le moduleAttrs; //0x0000 User Mode, 0x1000 Kernel Mode
|
||||
u16_le moduleVersion;
|
||||
// 28 bytes of module name, packed with 0's.
|
||||
char name[28];
|
||||
u32 gp; // ptr to MIPS GOT data (global offset table)
|
||||
u32 libent; // ptr to .lib.ent section
|
||||
u32 libentend; // ptr to end of .lib.ent section
|
||||
u32 libstub; // ptr to .lib.stub section
|
||||
u32 libstubend; // ptr to end of .lib.stub section
|
||||
u32_le gp; // ptr to MIPS GOT data (global offset table)
|
||||
u32_le libent; // ptr to .lib.ent section
|
||||
u32_le libentend; // ptr to end of .lib.ent section
|
||||
u32_le libstub; // ptr to .lib.stub section
|
||||
u32_le libstubend; // ptr to end of .lib.stub section
|
||||
};
|
||||
|
||||
SectionID sceModuleInfoSection = reader.GetSectionByName(".rodata.sceModuleInfo");
|
||||
@@ -555,12 +556,12 @@ Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, std::string *erro
|
||||
|
||||
struct PspLibStubEntry
|
||||
{
|
||||
u32 name;
|
||||
u16 version;
|
||||
u16 flags;
|
||||
u32_le name;
|
||||
u16_le version;
|
||||
u16_le flags;
|
||||
u8 size;
|
||||
u8 numVars;
|
||||
u16 numFuncs;
|
||||
u16_le numFuncs;
|
||||
// each symbol has an associated nid; nidData is a pointer
|
||||
// (in .rodata.sceNid section) to an array of longs, one
|
||||
// for each function, which identifies the function whose
|
||||
@@ -569,23 +570,23 @@ Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, std::string *erro
|
||||
// The hash is the first 4 bytes of a SHA-1 hash of the function
|
||||
// name. (Represented as a little-endian long, so the order
|
||||
// of the bytes is reversed.)
|
||||
u32 nidData;
|
||||
u32_le nidData;
|
||||
// the address of the function stubs where the function address jumps
|
||||
// should be filled in
|
||||
u32 firstSymAddr;
|
||||
u32_le firstSymAddr;
|
||||
// Optional, this is where var relocations are.
|
||||
// They use the format: u32 addr, u32 nid, ...
|
||||
// WARNING: May have garbage if size < 6.
|
||||
u32 varData;
|
||||
u32_le varData;
|
||||
// Not sure what this is yet, assume garbage for now.
|
||||
// TODO: Tales of the World: Radiant Mythology 2 has something here?
|
||||
u32 extra;
|
||||
u32_le extra;
|
||||
};
|
||||
|
||||
DEBUG_LOG(LOADER,"===================================================");
|
||||
|
||||
u32 *entryPos = (u32 *)Memory::GetPointer(modinfo->libstub);
|
||||
u32 *entryEnd = (u32 *)Memory::GetPointer(modinfo->libstubend);
|
||||
u32_le *entryPos = (u32_le *)Memory::GetPointer(modinfo->libstub);
|
||||
u32_le *entryEnd = (u32_le *)Memory::GetPointer(modinfo->libstubend);
|
||||
|
||||
bool needReport = false;
|
||||
while (entryPos < entryEnd) {
|
||||
@@ -614,7 +615,7 @@ Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, std::string *erro
|
||||
continue;
|
||||
}
|
||||
|
||||
u32 *nidDataPtr = (u32 *)Memory::GetPointer(entry->nidData);
|
||||
u32_le *nidDataPtr = (u32_le *)Memory::GetPointer(entry->nidData);
|
||||
for (int i = 0; i < entry->numFuncs; ++i) {
|
||||
u32 addrToWriteSyscall = entry->firstSymAddr + i * 8;
|
||||
DEBUG_LOG(LOADER, "%s : %08x", GetFuncName(modulename, nidDataPtr[i]), addrToWriteSyscall);
|
||||
@@ -649,7 +650,7 @@ Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, std::string *erro
|
||||
continue;
|
||||
}
|
||||
|
||||
u32 *varRef = (u32 *)Memory::GetPointer(varRefsPtr);
|
||||
u32_le *varRef = (u32_le *)Memory::GetPointer(varRefsPtr);
|
||||
for (; *varRef != 0; ++varRef) {
|
||||
ImportVarSymbol(modulename, nid, (*varRef & 0x03FFFFFF) << 2, *varRef >> 26);
|
||||
}
|
||||
@@ -664,7 +665,7 @@ Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, std::string *erro
|
||||
|
||||
if (needReport) {
|
||||
std::string debugInfo;
|
||||
entryPos = (u32 *)Memory::GetPointer(modinfo->libstub);
|
||||
entryPos = (u32_le *)Memory::GetPointer(modinfo->libstub);
|
||||
while (entryPos < entryEnd) {
|
||||
PspLibStubEntry *entry = (PspLibStubEntry *)entryPos;
|
||||
entryPos += entry->size;
|
||||
@@ -689,17 +690,17 @@ Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, std::string *erro
|
||||
|
||||
struct PspLibEntEntry
|
||||
{
|
||||
u32 name; /* ent's name (module name) address */
|
||||
u16 version;
|
||||
u16 flags;
|
||||
u32_le name; /* ent's name (module name) address */
|
||||
u16_le version;
|
||||
u16_le flags;
|
||||
u8 size;
|
||||
u8 vcount;
|
||||
u16 fcount;
|
||||
u32 resident;
|
||||
u16_le fcount;
|
||||
u32_le resident;
|
||||
};
|
||||
|
||||
u32 *entPos = (u32 *)Memory::GetPointer(modinfo->libent);
|
||||
u32 *entEnd = (u32 *)Memory::GetPointer(modinfo->libentend);
|
||||
u32_le *entPos = (u32_le *)Memory::GetPointer(modinfo->libent);
|
||||
u32_le *entEnd = (u32_le *)Memory::GetPointer(modinfo->libentend);
|
||||
for (int m = 0; entPos < entEnd; ++m) {
|
||||
PspLibEntEntry *ent = (PspLibEntEntry *)entPos;
|
||||
entPos += ent->size;
|
||||
@@ -727,8 +728,8 @@ Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, std::string *erro
|
||||
continue;
|
||||
}
|
||||
|
||||
u32 *residentPtr = (u32 *)Memory::GetPointer(ent->resident);
|
||||
u32 *exportPtr = residentPtr + ent->fcount + ent->vcount;
|
||||
u32_le *residentPtr = (u32_le *)Memory::GetPointer(ent->resident);
|
||||
u32_le *exportPtr = residentPtr + ent->fcount + ent->vcount;
|
||||
|
||||
for (u32 j = 0; j < ent->fcount; j++) {
|
||||
u32 nid = residentPtr[j];
|
||||
@@ -850,9 +851,9 @@ Module *__KernelLoadModule(u8 *fileptr, SceKernelLMOption *options, std::string
|
||||
if (memcmp(fileptr, "\0PBP", 4) == 0)
|
||||
{
|
||||
// PBP!
|
||||
u32 version;
|
||||
u32_le version;
|
||||
memcpy(&version, fileptr + 4, 4);
|
||||
u32 offset0, offsets[16];
|
||||
u32_le offset0, offsets[16];
|
||||
int numfiles;
|
||||
|
||||
memcpy(&offset0, fileptr + 8, 4);
|
||||
|
||||
@@ -31,13 +31,13 @@
|
||||
|
||||
struct NativeMsgPipe
|
||||
{
|
||||
SceSize size;
|
||||
SceSize_le size;
|
||||
char name[32];
|
||||
SceUInt attr;
|
||||
int bufSize;
|
||||
int freeSize;
|
||||
int numSendWaitThreads;
|
||||
int numReceiveWaitThreads;
|
||||
SceUInt_le attr;
|
||||
s32_le bufSize;
|
||||
s32_le freeSize;
|
||||
s32_le numSendWaitThreads;
|
||||
s32_le numReceiveWaitThreads;
|
||||
};
|
||||
|
||||
struct MsgPipeWaitingThread
|
||||
@@ -46,7 +46,7 @@ struct MsgPipeWaitingThread
|
||||
u32 bufAddr;
|
||||
u32 bufSize;
|
||||
u32 freeSize;
|
||||
int waitMode;
|
||||
s32 waitMode;
|
||||
u32 transferredBytesAddr;
|
||||
};
|
||||
|
||||
|
||||
+19
-19
@@ -49,14 +49,14 @@
|
||||
|
||||
struct NativeMutex
|
||||
{
|
||||
SceSize size;
|
||||
SceSize_le size;
|
||||
char name[KERNELOBJECT_MAX_NAME_LENGTH + 1];
|
||||
SceUInt attr;
|
||||
int initialCount;
|
||||
int lockLevel;
|
||||
SceUID lockThread;
|
||||
SceUInt_le attr;
|
||||
s32_le initialCount;
|
||||
s32_le lockLevel;
|
||||
SceUID_le lockThread;
|
||||
// Not kept up to date.
|
||||
int numWaitThreads;
|
||||
s32_le numWaitThreads;
|
||||
};
|
||||
|
||||
struct Mutex : public KernelObject
|
||||
@@ -85,12 +85,12 @@ struct Mutex : public KernelObject
|
||||
|
||||
struct NativeLwMutexWorkarea
|
||||
{
|
||||
int lockLevel;
|
||||
SceUID lockThread;
|
||||
int attr;
|
||||
int numWaitThreads;
|
||||
SceUID uid;
|
||||
int pad[3];
|
||||
s32_le lockLevel;
|
||||
SceUID_le lockThread;
|
||||
u32_le attr;
|
||||
s32_le numWaitThreads;
|
||||
SceUID_le uid;
|
||||
s32_le pad[3];
|
||||
|
||||
void init()
|
||||
{
|
||||
@@ -107,18 +107,18 @@ struct NativeLwMutexWorkarea
|
||||
|
||||
struct NativeLwMutex
|
||||
{
|
||||
SceSize size;
|
||||
SceSize_le size;
|
||||
char name[KERNELOBJECT_MAX_NAME_LENGTH + 1];
|
||||
SceUInt attr;
|
||||
SceUID uid;
|
||||
SceUInt_le attr;
|
||||
SceUID_le uid;
|
||||
PSPPointer<NativeLwMutexWorkarea> workarea;
|
||||
int initialCount;
|
||||
s32_le initialCount;
|
||||
// Not kept up to date.
|
||||
int currentCount;
|
||||
s32_le currentCount;
|
||||
// Not kept up to date.
|
||||
SceUID lockThread;
|
||||
SceUID_le lockThread;
|
||||
// Not kept up to date.
|
||||
int numWaitThreads;
|
||||
s32_le numWaitThreads;
|
||||
};
|
||||
|
||||
struct LwMutex : public KernelObject
|
||||
|
||||
@@ -35,19 +35,19 @@
|
||||
struct NativeSemaphore
|
||||
{
|
||||
/** Size of the ::SceKernelSemaInfo structure. */
|
||||
SceSize size;
|
||||
SceSize_le size;
|
||||
/** NUL-terminated name of the semaphore. */
|
||||
char name[KERNELOBJECT_MAX_NAME_LENGTH + 1];
|
||||
/** Attributes. */
|
||||
SceUInt attr;
|
||||
SceUInt_le attr;
|
||||
/** The initial count the semaphore was created with. */
|
||||
int initCount;
|
||||
s32_le initCount;
|
||||
/** The current count. */
|
||||
int currentCount;
|
||||
s32_le currentCount;
|
||||
/** The maximum count. */
|
||||
int maxCount;
|
||||
s32_le maxCount;
|
||||
/** The number of threads waiting on the semaphore. */
|
||||
int numWaitThreads;
|
||||
s32_le numWaitThreads;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -97,14 +97,14 @@ enum {
|
||||
|
||||
struct NativeCallback
|
||||
{
|
||||
SceUInt size;
|
||||
SceUInt_le size;
|
||||
char name[32];
|
||||
SceUID threadId;
|
||||
u32 entrypoint;
|
||||
u32 commonArgument;
|
||||
SceUID_le threadId;
|
||||
u32_le entrypoint;
|
||||
u32_le commonArgument;
|
||||
|
||||
int notifyCount;
|
||||
int notifyArg;
|
||||
s32_le notifyCount;
|
||||
s32_le notifyArg;
|
||||
};
|
||||
|
||||
class Callback : public KernelObject
|
||||
@@ -149,30 +149,36 @@ public:
|
||||
u32 savedIdRegister;
|
||||
};
|
||||
|
||||
#if !defined(BIG_ENDIAN) && !defined(__BIG_ENDIAN__)
|
||||
typedef WaitType WaitType_le;
|
||||
#else
|
||||
#error FIX ME
|
||||
#endif
|
||||
|
||||
// Real PSP struct, don't change the fields
|
||||
struct NativeThread
|
||||
{
|
||||
u32 nativeSize;
|
||||
u32_le nativeSize;
|
||||
char name[KERNELOBJECT_MAX_NAME_LENGTH+1];
|
||||
|
||||
// Threading stuff
|
||||
u32 attr;
|
||||
u32 status;
|
||||
u32 entrypoint;
|
||||
u32 initialStack;
|
||||
u32 stackSize;
|
||||
u32 gpreg;
|
||||
u32_le attr;
|
||||
u32_le status;
|
||||
u32_le entrypoint;
|
||||
u32_le initialStack;
|
||||
u32_le stackSize;
|
||||
u32_le gpreg;
|
||||
|
||||
int initialPriority;
|
||||
int currentPriority;
|
||||
s32_le initialPriority;
|
||||
s32_le currentPriority;
|
||||
WaitType waitType;
|
||||
SceUID waitID;
|
||||
int wakeupCount;
|
||||
int exitStatus;
|
||||
SceUID_le waitID;
|
||||
s32_le wakeupCount;
|
||||
s32_le exitStatus;
|
||||
SceKernelSysClock runForClocks;
|
||||
int numInterruptPreempts;
|
||||
int numThreadPreempts;
|
||||
int numReleases;
|
||||
s32_le numInterruptPreempts;
|
||||
s32_le numThreadPreempts;
|
||||
s32_le numReleases;
|
||||
};
|
||||
|
||||
struct ThreadWaitInfo {
|
||||
@@ -937,7 +943,7 @@ void __KernelThreadingInit()
|
||||
};
|
||||
|
||||
// Yeah, this is straight out of JPCSP, I should be ashamed.
|
||||
const static u32 idleThreadCode[] = {
|
||||
const static u32_le idleThreadCode[] = {
|
||||
MIPS_MAKE_ADDIU(MIPS_REG_A0, MIPS_REG_ZERO, 0),
|
||||
MIPS_MAKE_LUI(MIPS_REG_RA, 0x0800),
|
||||
MIPS_MAKE_JR_RA(),
|
||||
|
||||
@@ -62,8 +62,8 @@ u32 sceKernelGetThreadmanIdList(u32 type, u32 readBufPtr, u32 readBufSize, u32 i
|
||||
u32 sceKernelExtendThreadStack(u32 size, u32 entryAddr, u32 entryParameter);
|
||||
|
||||
struct SceKernelSysClock {
|
||||
u32 lo;
|
||||
u32 hi;
|
||||
u32_le lo;
|
||||
u32_le hi;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -55,8 +55,8 @@ void __KernelTimeDoState(PointerWrap &p)
|
||||
|
||||
struct SceKernelSysClock
|
||||
{
|
||||
u32 lo;
|
||||
u32 hi;
|
||||
u32_le lo;
|
||||
u32_le hi;
|
||||
};
|
||||
|
||||
int sceKernelGetSystemTime(u32 sysclockPtr)
|
||||
@@ -160,7 +160,7 @@ u32 sceKernelLibcGettimeofday(u32 timeAddr, u32 tzAddr)
|
||||
// TODO: tzAddr?
|
||||
if (Memory::IsValidAddress(timeAddr))
|
||||
{
|
||||
timeval *tv = (timeval *)Memory::GetPointer(timeAddr);
|
||||
PSPTimeval *tv = (PSPTimeval *)Memory::GetPointer(timeAddr);
|
||||
__RtcTimeOfDay(tv);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,14 +28,14 @@ static int vtimerTimer = -1;
|
||||
static std::list<SceUID> vtimers;
|
||||
|
||||
struct NativeVTimer {
|
||||
SceSize size;
|
||||
SceSize_le size;
|
||||
char name[KERNELOBJECT_MAX_NAME_LENGTH+1];
|
||||
int active;
|
||||
u64 base;
|
||||
u64 current;
|
||||
u64 schedule;
|
||||
u32 handlerAddr;
|
||||
u32 commonAddr;
|
||||
s32_le active;
|
||||
u64_le base;
|
||||
u64_le current;
|
||||
u64_le schedule;
|
||||
u32_le handlerAddr;
|
||||
u32_le commonAddr;
|
||||
};
|
||||
|
||||
struct VTimer : public KernelObject {
|
||||
|
||||
+8
-5
@@ -34,7 +34,7 @@
|
||||
|
||||
// This is a base time that everything is relative to.
|
||||
// This way, time doesn't move strangely with savestates, turbo speed, etc.
|
||||
static timeval rtcBaseTime;
|
||||
static PSPTimeval rtcBaseTime;
|
||||
|
||||
// Grabbed from JPSCP
|
||||
// This is the # of microseconds between January 1, 0001 and January 1, 1970.
|
||||
@@ -110,7 +110,10 @@ void __RtcInit()
|
||||
{
|
||||
// This is the base time, the only case we use gettimeofday() for.
|
||||
// Everything else is relative to that, "virtual time."
|
||||
gettimeofday(&rtcBaseTime, NULL);
|
||||
timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
rtcBaseTime.tv_sec = tv.tv_sec;
|
||||
rtcBaseTime.tv_usec = tv.tv_usec;
|
||||
}
|
||||
|
||||
void __RtcDoState(PointerWrap &p)
|
||||
@@ -120,7 +123,7 @@ void __RtcDoState(PointerWrap &p)
|
||||
p.DoMarker("sceRtc");
|
||||
}
|
||||
|
||||
void __RtcTimeOfDay(timeval *tv)
|
||||
void __RtcTimeOfDay(PSPTimeval *tv)
|
||||
{
|
||||
s64 additionalUs = cyclesToUs(CoreTiming::GetTicks());
|
||||
*tv = rtcBaseTime;
|
||||
@@ -236,7 +239,7 @@ u64 sceRtcGetAcculumativeTime()
|
||||
u32 sceRtcGetCurrentClock(u32 pspTimePtr, int tz)
|
||||
{
|
||||
DEBUG_LOG(HLE, "sceRtcGetCurrentClock(%08x, %d)", pspTimePtr, tz);
|
||||
timeval tv;
|
||||
PSPTimeval tv;
|
||||
__RtcTimeOfDay(&tv);
|
||||
|
||||
time_t sec = (time_t) tv.tv_sec;
|
||||
@@ -265,7 +268,7 @@ u32 sceRtcGetCurrentClock(u32 pspTimePtr, int tz)
|
||||
u32 sceRtcGetCurrentClockLocalTime(u32 pspTimePtr)
|
||||
{
|
||||
DEBUG_LOG(HLE, "sceRtcGetCurrentClockLocalTime(%08x)", pspTimePtr);
|
||||
timeval tv;
|
||||
PSPTimeval tv;
|
||||
__RtcTimeOfDay(&tv);
|
||||
|
||||
time_t sec = (time_t) tv.tv_sec;
|
||||
|
||||
+13
-9
@@ -17,19 +17,23 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
struct timeval;
|
||||
void __RtcTimeOfDay(timeval *tv);
|
||||
struct PSPTimeval {
|
||||
s32_le tv_sec;
|
||||
s32_le tv_usec;
|
||||
};
|
||||
|
||||
void __RtcTimeOfDay(PSPTimeval *tv);
|
||||
|
||||
void Register_sceRtc();
|
||||
void __RtcInit();
|
||||
void __RtcDoState(PointerWrap &p);
|
||||
|
||||
struct ScePspDateTime {
|
||||
unsigned short year;
|
||||
unsigned short month;
|
||||
unsigned short day;
|
||||
unsigned short hour;
|
||||
unsigned short minute;
|
||||
unsigned short second;
|
||||
unsigned int microsecond;
|
||||
s16_le year;
|
||||
s16_le month;
|
||||
s16_le day;
|
||||
s16_le hour;
|
||||
s16_le minute;
|
||||
s16_le second;
|
||||
u32_le microsecond;
|
||||
};
|
||||
Reference in new issue
Block a user