Added 1 new NID of OpenPSID Service, also added Init & Shutdown function

This commit is contained in:
ANR2ME 2020-08-07 20:09:14 +07:00
parent d465ce5123
commit 051bbb6e14
4 changed files with 72 additions and 19 deletions

View file

@ -304,6 +304,7 @@ void RegisterAllModules() {
Register_sceUsbMic();
Register_sceOpenPSID_driver();
Register_semaphore();
Register_sceDdrdb();
// add new modules here.
}

View file

@ -85,6 +85,7 @@
#include "sceHeap.h"
#include "sceDmac.h"
#include "sceMp4.h"
#include "sceOpenPSID.h"
#include "../Util/PPGeDraw.h"
@ -150,6 +151,7 @@ void __KernelInit()
__UsbGpsInit();
__UsbCamInit();
__UsbMicInit();
__OpenPSIDInit();
SaveState::Init(); // Must be after IO, as it may create a directory
Reporting::Init();
@ -173,6 +175,7 @@ void __KernelShutdown()
hleCurrentThreadName = NULL;
kernelObjects.Clear();
__OpenPSIDShutdown();
__UsbCamShutdown();
__UsbMicShutdown();
__UsbGpsShutdown();

View file

@ -18,44 +18,69 @@
#include "Core/HLE/HLE.h"
#include "Core/HLE/FunctionWrappers.h"
#include "Core/HLE/sceOpenPSID.h"
#include "Core/MemMap.h"
#include "Core/MemMapHelpers.h"
#include <Core/HLE/proAdhoc.h>
u8 dummyOpenPSID[16] = { 0x10, 0x02, 0xA3, 0x44, 0x13, 0xF5, 0x93, 0xB0, 0xCC, 0x6E, 0xD1, 0x32, 0x27, 0x85, 0x0F, 0x9D };
SceOpenPSID dummyOpenPSID = { 0x10, 0x02, 0xA3, 0x44, 0x13, 0xF5, 0x93, 0xB0, 0xCC, 0x6E, 0xD1, 0x32, 0x27, 0x85, 0x0F, 0x9D };
void __OpenPSIDInit() {
// Making sure the ID is unique
getLocalMac((SceNetEtherAddr*)&dummyOpenPSID);
return;
}
void __OpenPSIDShutdown() {
return;
}
static int sceOpenPSIDGetOpenPSID(u32 OpenPSIDPtr)
{
WARN_LOG(HLE, "UNTESTED sceOpenPSIDGetOpenPSID(%d)", OpenPSIDPtr);
getLocalMac((SceNetEtherAddr*)&dummyOpenPSID);
WARN_LOG(HLE, "UNTESTED %s(%08x)", __FUNCTION__, OpenPSIDPtr);
if (Memory::IsValidAddress(OpenPSIDPtr))
{
for (int i = 0; i < 16; i++)
{
Memory::Write_U8(dummyOpenPSID[i], OpenPSIDPtr+i);
}
Memory::WriteStruct(OpenPSIDPtr, &dummyOpenPSID);
}
return 0;
}
static int sceOpenPSID_driver_0x19D579F0(u32 OpenPSIDPtr,u32 unknown)
static int sceOpenPSIDGetPSID(u32 OpenPSIDPtr,u32 unknown)
{
WARN_LOG(HLE, "UNTESTED sceOpenPSID_driver_0x19D579F0(%d,%d)", OpenPSIDPtr,unknown);
getLocalMac((SceNetEtherAddr*)&dummyOpenPSID);
WARN_LOG(HLE, "UNTESTED %s(%08x, %08x)", __FUNCTION__, OpenPSIDPtr, unknown);
if (Memory::IsValidAddress(OpenPSIDPtr))
{
for (int i = 0; i < 16; i++)
{
Memory::Write_U8(dummyOpenPSID[i], OpenPSIDPtr + i);
}
Memory::WriteStruct(OpenPSIDPtr, &dummyOpenPSID);
}
return 0;
}
/*
Verify if the provided signature is valid for the specified data. The public key
is provided by the system software.
Note:
The ECDSA algorithm is used to verify a signature.
Parameters:
pData Pointer to data the signature has to be verified for. Data length: KIRK_ECDSA_SRC_DATA_LEN.
pSig Pointer to the signature to verify. Signature length: KIRK_ECDSA_SIG_LEN.
Returns:
0 on success, otherwise < 0.
*/
static s32 sceDdrdb_F013F8BF(u32 pDataPtr, u32 pSigPtr) {
ERROR_LOG(HLE, "UNIMPL %s(%08x, %08x)", __FUNCTION__, pDataPtr, pSigPtr);
return 0;
}
const HLEFunction sceOpenPSID[] =
{
{0XC69BEBCE, &WrapI_U<sceOpenPSIDGetOpenPSID>, "sceOpenPSIDGetOpenPSID", 'i', "x"},
{0XC69BEBCE, &WrapI_U<sceOpenPSIDGetOpenPSID>, "sceOpenPSIDGetOpenPSID", 'i', "x" },
};
void Register_sceOpenPSID()
@ -63,12 +88,24 @@ void Register_sceOpenPSID()
RegisterModule("sceOpenPSID", ARRAY_SIZE(sceOpenPSID), sceOpenPSID);
}
// According to https://playstationdev.wiki/pspprxlibraries/5.00/kd/openpsid.xml
// sceOpenPSID_driver library seems to contains a duplicate of sceOpenPSIDGetOpenPSID just like sceOpenPSID library, is this allowed here?
const HLEFunction sceOpenPSID_driver[] =
{
{0x19D579F0, &WrapI_UU<sceOpenPSID_driver_0x19D579F0>, "sceOpenPSID_driver_0x19D579F0", 'i', "xx" },
{0x19D579F0, &WrapI_UU<sceOpenPSIDGetPSID>, "sceOpenPSIDGetPSID", 'i', "xx" },
{0XC69BEBCE, &WrapI_U<sceOpenPSIDGetOpenPSID>, "sceOpenPSIDGetOpenPSID", 'i', "x" },
};
void Register_sceOpenPSID_driver()
{
RegisterModule("sceOpenPSID_driver", ARRAY_SIZE(sceOpenPSID_driver), sceOpenPSID_driver);
}
const HLEFunction sceDdrdb[] =
{
{0xF013F8BF, &WrapI_UU<sceDdrdb_F013F8BF>, "sceDdrdb_F013F8BF", 'i', "xx" },
};
void Register_sceDdrdb()
{
RegisterModule("sceDdrdb", ARRAY_SIZE(sceDdrdb), sceDdrdb);
}

View file

@ -17,7 +17,19 @@
#pragma once
void __sceOpenPSIDInit();
#define PSP_DNAS_USER_DATA_MAX_LEN 2048
#define PSP_OPENPSID_SIZE 16
typedef struct SceOpenPSID {
u8 data[PSP_OPENPSID_SIZE];
} SceOpenPSID;
void __OpenPSIDInit();
void __OpenPSIDShutdown();
void Register_sceOpenPSID();
void Register_sceOpenPSID_driver();
void Register_sceOpenPSID_driver();
void Register_sceDdrdb();
static int sceOpenPSIDGetOpenPSID(u32 OpenPSIDPtr);
static int sceOpenPSIDGetPSID(u32 OpenPSIDPtr, u32 unknown);