Add some missing sce* Functions

Add the missing functions to sceHttp
Create sceOpenPSID and add what jpcsp is doing
Create sceParseHttp.cpp
Create sceParseUri.cpp
Create sceSsl.cpp and add what jpcsp is doing
reindent some files.

in an attempt to try and get a few games doing more.
This commit is contained in:
TMaul 2012-12-06 15:24:25 +00:00
parent 257fd29e52
commit 9bcb67f90b
14 changed files with 438 additions and 89 deletions

View file

@ -50,6 +50,10 @@ set(SRCS
HLE/sceSas.cpp
HLE/sceUmd.cpp
HLE/sceUtility.cpp
HLE/sceParseUri.cpp
HLE/sceSsl.cpp
HLE/sceParseUri.cpp
HLE/sceParseHttp.cpp
HW/MemoryStick.cpp
FileSystems/BlockDevices.cpp
FileSystems/ISOFileSystem.cpp

View file

@ -154,10 +154,14 @@
<ClCompile Include="HLE\sceKernelVTimer.cpp" />
<ClCompile Include="HLE\sceMpeg.cpp" />
<ClCompile Include="HLE\sceNet.cpp" />
<ClCompile Include="HLE\sceOpenPSID.cpp" />
<ClCompile Include="HLE\sceParseHttp.cpp" />
<ClCompile Include="HLE\sceParseUri.cpp" />
<ClCompile Include="HLE\scePower.cpp" />
<ClCompile Include="HLE\scePsmf.cpp" />
<ClCompile Include="HLE\sceRtc.cpp" />
<ClCompile Include="HLE\sceSas.cpp" />
<ClCompile Include="HLE\sceSsl.cpp" />
<ClCompile Include="HLE\sceUmd.cpp" />
<ClCompile Include="HLE\sceUtility.cpp" />
<ClCompile Include="HLE\__sceAudio.cpp" />
@ -287,10 +291,14 @@
<ClInclude Include="HLE\sceKernelTime.h" />
<ClInclude Include="HLE\sceMpeg.h" />
<ClInclude Include="HLE\sceNet.h" />
<ClInclude Include="HLE\sceOpenPSID.h" />
<ClInclude Include="HLE\sceParseHttp.h" />
<ClInclude Include="HLE\sceParseUri.h" />
<ClInclude Include="HLE\scePower.h" />
<ClInclude Include="HLE\scePsmf.h" />
<ClInclude Include="HLE\sceRtc.h" />
<ClInclude Include="HLE\sceSas.h" />
<ClInclude Include="HLE\sceSsl.h" />
<ClInclude Include="HLE\sceUmd.h" />
<ClInclude Include="HLE\sceUtility.h" />
<ClInclude Include="HLE\sceKernelVTimer.h" />

View file

@ -303,6 +303,18 @@
<ClCompile Include="ELF\ParamSFO.cpp">
<Filter>ELF</Filter>
</ClCompile>
<ClCompile Include="HLE\sceOpenPSID.cpp">
<Filter>HLE\Libraries</Filter>
</ClCompile>
<ClCompile Include="HLE\sceParseUri.cpp">
<Filter>HLE\Libraries</Filter>
</ClCompile>
<ClCompile Include="HLE\sceSsl.cpp">
<Filter>HLE\Libraries</Filter>
</ClCompile>
<ClCompile Include="HLE\sceParseHttp.cpp">
<Filter>HLE\Libraries</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="ELF\ElfReader.h">
@ -554,6 +566,18 @@
<ClInclude Include="ELF\ParamSFO.h">
<Filter>ELF</Filter>
</ClInclude>
<ClInclude Include="HLE\sceOpenPSID.h">
<Filter>HLE\Libraries</Filter>
</ClInclude>
<ClInclude Include="HLE\sceParseUri.h">
<Filter>HLE\Libraries</Filter>
</ClInclude>
<ClInclude Include="HLE\sceSsl.h">
<Filter>HLE\Libraries</Filter>
</ClInclude>
<ClInclude Include="HLE\sceParseHttp.h">
<Filter>HLE\Libraries</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="CMakeLists.txt" />

View file

@ -37,6 +37,7 @@
#include "sceUmd.h"
#include "sceDmac.h"
#include "sceRtc.h"
#include "sceOpenPSID.h"
#include "sceKernel.h"
#include "sceKernelEventFlag.h"
#include "sceKernelMemory.h"
@ -47,6 +48,9 @@
#include "sceKernelTime.h"
#include "sceAudio.h"
#include "sceUtility.h"
#include "sceParseUri.h"
#include "sceSsl.h"
#include "sceParseHttp.h"
#define N(s) s
@ -59,10 +63,10 @@
//zlibdec
const HLEFunction FakeSysCalls[] =
{
{NID_THREADRETURN, __KernelReturnFromThread, "__KernelReturnFromThread"},
{NID_CALLBACKRETURN, __KernelReturnFromMipsCall, "__KernelReturnFromMipsCall"},
{NID_THREADRETURN, __KernelReturnFromThread, "__KernelReturnFromThread"},
{NID_CALLBACKRETURN, __KernelReturnFromMipsCall, "__KernelReturnFromMipsCall"},
{NID_INTERRUPTRETURN, __KernelReturnFromInterrupt, "__KernelReturnFromInterrupt"},
{NID_IDLE, __KernelIdle, "_sceKernelIdle"},
{NID_IDLE, __KernelIdle, "_sceKernelIdle"},
};
const HLEFunction UtilsForUser[] =
@ -98,51 +102,51 @@ const HLEFunction UtilsForUser[] =
const HLEFunction IoFileMgrForKernel[] =
{
{0xa905b705, 0, "sceIoCloseAll"},
{0x411106BA, 0, "sceIoGetThreadCwd"},
{0xCB0A151F, 0, "sceIoChangeThreadCwd"},
{0x8E982A74, 0, "sceIoAddDrv"},
{0xC7F35804, 0, "sceIoDelDrv"},
{0x3C54E908, 0, "sceIoReopen"},
{0xa905b705, 0, "sceIoCloseAll"},
{0x411106BA, 0, "sceIoGetThreadCwd"},
{0xCB0A151F, 0, "sceIoChangeThreadCwd"},
{0x8E982A74, 0, "sceIoAddDrv"},
{0xC7F35804, 0, "sceIoDelDrv"},
{0x3C54E908, 0, "sceIoReopen"},
};
const HLEFunction StdioForKernel[] =
{
{0x98220F3E, 0, "sceKernelStdoutReopen"},
{0xFB5380C5, 0, "sceKernelStderrReopen"},
{0x2CCF071A, 0, "fdprintf"},
{0x98220F3E, 0, "sceKernelStdoutReopen"},
{0xFB5380C5, 0, "sceKernelStderrReopen"},
{0x2CCF071A, 0, "fdprintf"},
};
const HLEFunction LoadCoreForKernel[] =
{
{0xACE23476, 0, "sceKernelCheckPspConfig"},
{0x7BE1421C, 0, "sceKernelCheckExecFile"},
{0xBF983EF2, 0, "sceKernelProbeExecutableObject"},
{0x7068E6BA, 0, "sceKernelLoadExecutableObject"},
{0xB4D6FECC, 0, "sceKernelApplyElfRelSection"},
{0x54AB2675, 0, "LoadCoreForKernel_54AB2675"},
{0x2952F5AC, 0, "sceKernelDcacheWBinvAll"},
{0xD8779AC6, sceKernelIcacheClearAll, "sceKernelIcacheClearAll"},
{0x99A695F0, 0, "sceKernelRegisterLibrary"},
{0x5873A31F, 0, "sceKernelRegisterLibraryForUser"},
{0x0B464512, 0, "sceKernelReleaseLibrary"},
{0x9BAF90F6, 0, "sceKernelCanReleaseLibrary"},
{0x0E760DBA, 0, "sceKernelLinkLibraryEntries"},
{0x0DE1F600, 0, "sceKernelLinkLibraryEntriesForUser"},
{0xDA1B09AA, 0, "sceKernelUnLinkLibraryEntries"},
{0xC99DD47A, 0, "sceKernelQueryLoadCoreCB"},
{0x616FCCCD, 0, "sceKernelSetBootCallbackLevel"},
{0xF32A2940, 0, "sceKernelModuleFromUID"},
{0xCD0F3BAC, 0, "sceKernelCreateModule"},
{0x6B2371C2, 0, "sceKernelDeleteModule"},
{0x7320D964, 0, "sceKernelModuleAssign"},
{0x44B292AB, 0, "sceKernelAllocModule"},
{0xBD61D4D5, 0, "sceKernelFreeModule"},
{0xAE7C6E76, 0, "sceKernelRegisterModule"},
{0x74CF001A, 0, "sceKernelReleaseModule"},
{0xFB8AE27D, 0, "sceKernelFindModuleByAddress"},
{0xCCE4A157, 0, "sceKernelFindModuleByUID"},
{0x82CE54ED, 0, "sceKernelModuleCount"},
{0xC0584F0C, 0, "sceKernelGetModuleList"},
{0xCF8A41B1, sceKernelFindModuleByName,"sceKernelFindModuleByName"},
{0xACE23476, 0, "sceKernelCheckPspConfig"},
{0x7BE1421C, 0, "sceKernelCheckExecFile"},
{0xBF983EF2, 0, "sceKernelProbeExecutableObject"},
{0x7068E6BA, 0, "sceKernelLoadExecutableObject"},
{0xB4D6FECC, 0, "sceKernelApplyElfRelSection"},
{0x54AB2675, 0, "LoadCoreForKernel_54AB2675"},
{0x2952F5AC, 0, "sceKernelDcacheWBinvAll"},
{0xD8779AC6, sceKernelIcacheClearAll, "sceKernelIcacheClearAll"},
{0x99A695F0, 0, "sceKernelRegisterLibrary"},
{0x5873A31F, 0, "sceKernelRegisterLibraryForUser"},
{0x0B464512, 0, "sceKernelReleaseLibrary"},
{0x9BAF90F6, 0, "sceKernelCanReleaseLibrary"},
{0x0E760DBA, 0, "sceKernelLinkLibraryEntries"},
{0x0DE1F600, 0, "sceKernelLinkLibraryEntriesForUser"},
{0xDA1B09AA, 0, "sceKernelUnLinkLibraryEntries"},
{0xC99DD47A, 0, "sceKernelQueryLoadCoreCB"},
{0x616FCCCD, 0, "sceKernelSetBootCallbackLevel"},
{0xF32A2940, 0, "sceKernelModuleFromUID"},
{0xCD0F3BAC, 0, "sceKernelCreateModule"},
{0x6B2371C2, 0, "sceKernelDeleteModule"},
{0x7320D964, 0, "sceKernelModuleAssign"},
{0x44B292AB, 0, "sceKernelAllocModule"},
{0xBD61D4D5, 0, "sceKernelFreeModule"},
{0xAE7C6E76, 0, "sceKernelRegisterModule"},
{0x74CF001A, 0, "sceKernelReleaseModule"},
{0xFB8AE27D, 0, "sceKernelFindModuleByAddress"},
{0xCCE4A157, 0, "sceKernelFindModuleByUID"},
{0x82CE54ED, 0, "sceKernelModuleCount"},
{0xC0584F0C, 0, "sceKernelGetModuleList"},
{0xCF8A41B1, sceKernelFindModuleByName,"sceKernelFindModuleByName"},
};
@ -191,7 +195,6 @@ const HLEFunction sceUsb[] =
{0x5be0e002, 0, "sceUsbWaitState"},
{0x1c360735, 0, "sceUsbWaitCancel"},
};
const HLEFunction sceUsbstor[] =
{
@ -208,20 +211,11 @@ const HLEFunction sceUsbstorBoot[] =
{0xA55C9E16, 0, "sceUsbstorBootUnregisterNotify"},
};
const HLEFunction sceOpenPSID[] =
{
{0xc69bebce, 0, "sceOpenPSID_c69bebce"},
};
const HLEModule moduleList[] =
{
{"FakeSysCalls", SZ(FakeSysCalls), FakeSysCalls},
{"sceOpenPSID", SZ(sceOpenPSID), sceOpenPSID},
{"UtilsForUser",SZ(UtilsForUser),UtilsForUser},
{"KDebugForKernel",SZ(KDebugForKernel),KDebugForKernel},
{"sceParseUri"},
{"sceSAScore"},
{"sceUsbstor",SZ(sceUsbstor),sceUsbstor},
{"sceUsbstorBoot",SZ(sceUsbstorBoot),sceUsbstorBoot},
@ -230,9 +224,6 @@ const HLEModule moduleList[] =
{"sceCert_Loader"},
{"SceFont_Library"},
{"sceNetApctl"},
{"sceOpenPSID"},
{"sceParseHttp"},
{"sceSsl"},
{"sceSIRCS_IrDA_Driver"},
{"Pspnet_Scan"},
{"Pspnet_Show_MacAddr"},
@ -245,41 +236,45 @@ const HLEModule moduleList[] =
static const int numModules = sizeof(moduleList)/sizeof(HLEModule);
void RegisterAllModules() {
Register_Kernel_Library();
Register_ThreadManForUser();
Register_LoadExecForUser();
Register_SysMemUserForUser();
Register_InterruptManager();
Register_IoFileMgrForUser();
Register_ModuleMgrForUser();
Register_StdioForUser();
Register_Kernel_Library();
Register_ThreadManForUser();
Register_LoadExecForUser();
Register_SysMemUserForUser();
Register_InterruptManager();
Register_IoFileMgrForUser();
Register_ModuleMgrForUser();
Register_StdioForUser();
Register_sceHprm();
Register_sceCtrl();
Register_sceDisplay();
Register_sceAudio();
Register_sceSasCore();
Register_sceHprm();
Register_sceCtrl();
Register_sceDisplay();
Register_sceAudio();
Register_sceSasCore();
Register_sceFont();
Register_sceNet();
Register_sceRtc();
Register_sceWlanDrv();
Register_sceMpeg();
Register_sceMp3();
Register_sceHttp();
Register_scePower();
Register_sceRtc();
Register_sceWlanDrv();
Register_sceMpeg();
Register_sceMp3();
Register_sceHttp();
Register_scePower();
Register_sceImpose();
Register_sceSuspendForUser();
Register_sceGe_user();
Register_sceUmdUser();
Register_sceDmac();
Register_sceUtility();
Register_sceAtrac3plus();
Register_scePsmf();
Register_scePsmfPlayer();
Register_sceSuspendForUser();
Register_sceGe_user();
Register_sceUmdUser();
Register_sceDmac();
Register_sceUtility();
Register_sceAtrac3plus();
Register_scePsmf();
Register_scePsmfPlayer();
Register_sceOpenPSID();
Register_sceParseUri();
Register_sceSsl();
Register_sceParseHttp();
for (int i = 0; i < numModules; i++)
{
RegisterModule(moduleList[i].name, moduleList[i].numFunctions, moduleList[i].funcTable);
}
for (int i = 0; i < numModules; i++)
{
RegisterModule(moduleList[i].name, moduleList[i].numFunctions, moduleList[i].funcTable);
}
}

View file

@ -65,9 +65,16 @@ const HLEFunction sceHttp[] =
{0xae948fee,0,"sceHttpDisableAuth"},
{0xccbd167a,0,"sceHttpDisableCache"},
{0xd081ec8f,0,"sceHttpGetNetworkErrno"},
{0x76d1363b,0,"sceHttp_76d1363b"},
{0x87797bdd,0,"sceHttp_87797bdd"},
{0xf1657b22,0,"sceHttp_f1657b22"},
{0x76d1363b,0,"sceHttpSaveSystemCookie"},
{0x87797bdd,0,"sceHttpsLoadDefaultCert"},
{0xf1657b22,0,"sceHttpLoadSystemCookie"},
{0x9B1F1F36,0,"sceHttpCreateTemplate"},
{0xB509B09E,0,"sceHttpCreateRequestWithURL"},
{0xCDF8ECB9,0,"sceHttpCreateConnectionWithURL"},
{0x1F0FC3E3,0,"sceHttpSetRecvTimeOut"},
{0xDB266CCF,0,"sceHttpGetAllHeader"},
{0x68AB0F86,0,"sceHttpsInitWithPath"},
{0xB3FAF831,0,"sceHttpsDisableOption"},
};
void Register_sceHttp()

View file

@ -49,6 +49,7 @@
#include "scePower.h"
#include "sceUtility.h"
#include "sceUmd.h"
#include "sceSsl.h"
#include "../Util/PPGeDraw.h"
@ -82,6 +83,7 @@ void __KernelInit()
__UtilityInit();
__UmdInit();
__CtrlInit();
__SslInit();
// "Internal" PSP libraries
__PPGeInit();

45
Core/HLE/sceOpenPSID.cpp Normal file
View file

@ -0,0 +1,45 @@
// Copyright (c) 2012- PPSSPP Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0 or later versions.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "HLE.h"
#include "sceOpenPSID.h"
int sceOpenPSIDGetOpenPSID(u32 OpenPSIDPtr)
{
ERROR_LOG(HLE, "UNTESTED sceOpenPSIDGetOpenPSID(%d)", OpenPSIDPtr);
u8 dummyOpenPSID[16] = {0x10, 0x02, 0xA3, 0x44, 0x13, 0xF5, 0x93, 0xB0, 0xCC, 0x6E, 0xD1, 0x32, 0x27, 0x85, 0x0F, 0x9D};
if (Memory::IsValidAddress(OpenPSIDPtr))
{
for (int i = 0; i < 16; i++)
{
Memory::Write_U8(dummyOpenPSID[i], OpenPSIDPtr+i);
}
}
return 0;
}
const HLEFunction sceOpenPSID[] =
{
{0xc69bebce, WrapI_U<sceOpenPSIDGetOpenPSID>, "sceOpenPSIDGetOpenPSID"},
};
void Register_sceOpenPSID()
{
RegisterModule("sceOpenPSID", ARRAY_SIZE(sceOpenPSID), sceOpenPSID);
}

22
Core/HLE/sceOpenPSID.h Normal file
View file

@ -0,0 +1,22 @@
// Copyright (c) 2012- PPSSPP Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0 or later versions.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#pragma once
void __sceOpenPSIDInit();
void Register_sceOpenPSID();

31
Core/HLE/sceParseHttp.cpp Normal file
View file

@ -0,0 +1,31 @@
// Copyright (c) 2012- PPSSPP Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0 or later versions.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "HLE.h"
#include "sceParseHttp.h"
const HLEFunction sceParseHttp [] =
{
{0x8077A433, 0, "sceParseHttpStatusLineFunction"},
{0xAD7BFDEF, 0, "sceParseHttpResponseHeaderFunction"},
};
void Register_sceParseHttp()
{
RegisterModule("sceParseHttp", ARRAY_SIZE(sceParseHttp), sceParseHttp);
}

20
Core/HLE/sceParseHttp.h Normal file
View file

@ -0,0 +1,20 @@
// Copyright (c) 2012- PPSSPP Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0 or later versions.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#pragma once
void Register_sceParseHttp();

33
Core/HLE/sceParseUri.cpp Normal file
View file

@ -0,0 +1,33 @@
// Copyright (c) 2012- PPSSPP Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0 or later versions.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "HLE.h"
#include "sceParseUri.h"
const HLEFunction sceParseUri[] =
{
{0x49E950EC, 0, "sceUriEscapeFunction"},
{0x062BB07E, 0, "sceUriUnescapeFunction"},
{0x568518C9, 0, "sceUriParseFunction"},
{0x7EE318AF, 0, "sceUriBuildFunction"},
};
void Register_sceParseUri()
{
RegisterModule("sceParseUri", ARRAY_SIZE(sceParseUri), sceParseUri);
}

20
Core/HLE/sceParseUri.h Normal file
View file

@ -0,0 +1,20 @@
// Copyright (c) 2012- PPSSPP Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0 or later versions.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#pragma once
void Register_sceParseUri();

116
Core/HLE/sceSsl.cpp Normal file
View file

@ -0,0 +1,116 @@
// Copyright (c) 2012- PPSSPP Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0 or later versions.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "HLE.h"
#include "sceSsl.h"
#define ERROR_SSL_NOT_INIT 0x80435001;
#define ERROR_SSL_ALREADY_INIT 0x80435020;
#define ERROR_SSL_OUT_OF_MEMORY 0x80435022;
#define ERROR_SSL_INVALID_PARAMETER 0x804351FE;
bool isSslInit;
u32 maxMemSize;
u32 currentMemSize;
void __SslInit()
{
isSslInit = 0;
maxMemSize = 0;
currentMemSize = 0;
}
int sceSslInit(int heapSize)
{
DEBUG_LOG(HLE, "sceSslInit %d", heapSize);
if (isSslInit)
{
return ERROR_SSL_ALREADY_INIT;
}
if (heapSize <= 0)
{
return ERROR_SSL_INVALID_PARAMETER;
}
maxMemSize = heapSize;
currentMemSize = heapSize / 2; // As per jpcsp
isSslInit = true;
return 0;
}
int sceSslEnd()
{
DEBUG_LOG(HLE, "sceSslEnd");
if (!isSslInit)
{
return ERROR_SSL_NOT_INIT;
}
isSslInit = false;
return 0;
}
int sceSslGetUsedMemoryMax(u32 maxMemPtr)
{
DEBUG_LOG(HLE, "sceSslGetUsedMemoryMax %d", maxMemPtr);
if (!isSslInit)
{
return ERROR_SSL_NOT_INIT;
}
if (Memory::IsValidAddress(maxMemPtr))
{
Memory::Write_U32(maxMemSize, maxMemPtr);
}
return 0;
}
int sceSslGetUsedMemoryCurrent(u32 currentMemPtr)
{
DEBUG_LOG(HLE, "sceSslGetUsedMemoryCurrent %d", currentMemPtr);
if (!isSslInit)
{
return ERROR_SSL_NOT_INIT;
}
if (Memory::IsValidAddress(currentMemPtr))
{
Memory::Write_U32(currentMemSize, currentMemPtr);
}
return 0;
}
const HLEFunction sceSsl[] =
{
{0x957ECBE2, WrapI_I<sceSslInit>, "sceSslInit"},
{0x191CDEFF, WrapI_V<sceSslEnd>, "sceSslEnd"},
{0x5BFB6B61, 0, "sceSslGetNotAfter"},
{0x17A10DCC, 0, "sceSslGetNotBefore"},
{0x3DD5E023, 0, "sceSslGetSubjectName"},
{0x1B7C8191, 0, "sceSslGetIssuerName"},
{0xCC0919B0, 0, "sceSslGetSerialNumber"},
{0x058D21C0, 0, "sceSslGetNameEntryCount"},
{0xD6D097B4, 0, "sceSslGetNameEntryInfo"},
{0xB99EDE6A, WrapI_U<sceSslGetUsedMemoryMax>, "sceSslGetUsedMemoryMax"},
{0x0EB43B06, WrapI_U<sceSslGetUsedMemoryCurrent>, "sceSslGetUsedMemoryCurrent"},
{0xF57765D3, 0, "sceSslGetKeyUsage"},
};
void Register_sceSsl()
{
RegisterModule("sceSsl", ARRAY_SIZE(sceSsl), sceSsl);
}

22
Core/HLE/sceSsl.h Normal file
View file

@ -0,0 +1,22 @@
// Copyright (c) 2012- PPSSPP Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0 or later versions.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#pragma once
void Register_sceSsl();
void __SslInit();