chkreg: Initial impl of sceChkregCheckRegion

This commit is contained in:
Joel16 2020-10-09 23:16:36 -04:00
parent edafa38bea
commit 904621bdf9
2 changed files with 60 additions and 11 deletions

View File

@ -6,6 +6,6 @@ OBJS = chkreg.o
#DEBUG = 1
LIBS = -lThreadManForKernel -lsceIdStorage_driver -lpspsemaphore
LIBS = -lsceIdStorage_driver -lThreadManForKernel -lpspsemaphore
include ../../lib/build.mak

View File

@ -1,22 +1,41 @@
#include <common_imp.h>
#include <threadman_kernel.h>
SCE_MODULE_INFO("sceChkreg", SCE_MODULE_KERNEL | SCE_MODULE_KIRK_SEMAPHORE_LIB | SCE_MODULE_ATTR_EXCLUSIVE_LOAD
| SCE_MODULE_ATTR_EXCLUSIVE_START, 1, 9);
SCE_SDK_VERSION(SDK_VERSION);
typedef struct {
SceUID sema;
} g_chkreg_struct;
g_chkreg_struct g_chkreg = {0};
// Declarations
s32 sceIdStorageReadLeaf(u16 key, void *buf);
s32 sceIdStorageLookup(u16 key, u32 offset, void *buf, u32 len);
s32 sceUtilsBufferCopyWithRange(void* outBuf, s32 outsize, void* inBuf, s32 insize, s32 cmd);
s32 sub_00000000(void)
{
return 0;
}
s32 sub_00000128(s32 unk1, s32 unk2)
{
return 0;
}
// Subroutine sub_00000190 - Address 0x00000190
s32 sub_00000190(void)
{
s32 ret = SCE_ERROR_OK;
ret = sceIdStorageLookup(0x100, 0x38, 0xa80, 0xb8);
if (ret < 0)
return SCE_ERROR_NOT_FOUND;
ret = sceIdStorageLookup(0x120, 0x38, 0xa80, 0xb8);
if (ret < 0)
if (sceIdStorageLookup(0x100, 0x38, 0xa80, 0xb8) < 0)
return SCE_ERROR_NOT_FOUND;
return ret;
if (sceIdStorageLookup(0x120, 0x38, 0xa80, 0xb8) < 0)
return SCE_ERROR_NOT_FOUND;
return SCE_ERROR_OK;
}
// Subroutine sub_0000020C - Address 0x0000020C
@ -44,6 +63,36 @@ s32 module_stop(SceSize args __attribute__((unused)), void *argp __attribute__((
}
// Subroutine sceChkreg_driver_59F8491D - Address 0x00000438
s32 sceChkregGetPsCode(u8 *code) {
s32 sceChkregGetPsCode(u8 *code)
{
return 0;
}
// Subroutine sceChkreg_driver_54495B19 - Address 0x00000390
s32 sceChkregCheckRegion(u32 unk1, u32 unk2)
{
s32 ret = SCE_ERROR_SEMAPHORE;
if (sceKernelWaitSema(g_chkreg.sema, 1, NULL) == 0)
{
if (/*(DAT_00000044 != 0) ||*/ (ret = sub_00000000(), ret == 0))
ret = sub_00000128(0x80000000, (unk1 | unk2));
if (sceKernelSignalSema(g_chkreg.sema, 1) != 0)
ret = SCE_ERROR_SEMAPHORE;
}
return ret;
}
s32 sceChkreg_driver_6894A027(void) {
return 0;
}
s32 sceChkreg_driver_7939C851(void) {
return 0;
}
s32 sceChkreg_driver_9C6E1D34(void) {
return 0;
}