From 9bcb67f90b55d3462e69902bcbacc6c435541096 Mon Sep 17 00:00:00 2001 From: TMaul Date: Thu, 6 Dec 2012 15:24:25 +0000 Subject: [PATCH] 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. --- Core/CMakeLists.txt | 4 + Core/Core.vcxproj | 8 ++ Core/Core.vcxproj.filters | 24 ++++++ Core/HLE/HLETables.cpp | 167 ++++++++++++++++++-------------------- Core/HLE/sceHttp.cpp | 13 ++- Core/HLE/sceKernel.cpp | 2 + Core/HLE/sceOpenPSID.cpp | 45 ++++++++++ Core/HLE/sceOpenPSID.h | 22 +++++ Core/HLE/sceParseHttp.cpp | 31 +++++++ Core/HLE/sceParseHttp.h | 20 +++++ Core/HLE/sceParseUri.cpp | 33 ++++++++ Core/HLE/sceParseUri.h | 20 +++++ Core/HLE/sceSsl.cpp | 116 ++++++++++++++++++++++++++ Core/HLE/sceSsl.h | 22 +++++ 14 files changed, 438 insertions(+), 89 deletions(-) create mode 100644 Core/HLE/sceOpenPSID.cpp create mode 100644 Core/HLE/sceOpenPSID.h create mode 100644 Core/HLE/sceParseHttp.cpp create mode 100644 Core/HLE/sceParseHttp.h create mode 100644 Core/HLE/sceParseUri.cpp create mode 100644 Core/HLE/sceParseUri.h create mode 100644 Core/HLE/sceSsl.cpp create mode 100644 Core/HLE/sceSsl.h diff --git a/Core/CMakeLists.txt b/Core/CMakeLists.txt index 8428959a2f..2eccf3734d 100644 --- a/Core/CMakeLists.txt +++ b/Core/CMakeLists.txt @@ -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 diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj index 6b8f518c3d..26009c4320 100644 --- a/Core/Core.vcxproj +++ b/Core/Core.vcxproj @@ -154,10 +154,14 @@ + + + + @@ -287,10 +291,14 @@ + + + + diff --git a/Core/Core.vcxproj.filters b/Core/Core.vcxproj.filters index 65452343d1..dec29d774c 100644 --- a/Core/Core.vcxproj.filters +++ b/Core/Core.vcxproj.filters @@ -303,6 +303,18 @@ ELF + + HLE\Libraries + + + HLE\Libraries + + + HLE\Libraries + + + HLE\Libraries + @@ -554,6 +566,18 @@ ELF + + HLE\Libraries + + + HLE\Libraries + + + HLE\Libraries + + + HLE\Libraries + diff --git a/Core/HLE/HLETables.cpp b/Core/HLE/HLETables.cpp index f3b1fb7d71..6b99782d2f 100644 --- a/Core/HLE/HLETables.cpp +++ b/Core/HLE/HLETables.cpp @@ -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); + } } diff --git a/Core/HLE/sceHttp.cpp b/Core/HLE/sceHttp.cpp index 8fbf7b90ab..ffc1205528 100644 --- a/Core/HLE/sceHttp.cpp +++ b/Core/HLE/sceHttp.cpp @@ -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() diff --git a/Core/HLE/sceKernel.cpp b/Core/HLE/sceKernel.cpp index 955c89c771..d1d783b288 100644 --- a/Core/HLE/sceKernel.cpp +++ b/Core/HLE/sceKernel.cpp @@ -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(); diff --git a/Core/HLE/sceOpenPSID.cpp b/Core/HLE/sceOpenPSID.cpp new file mode 100644 index 0000000000..41241440ba --- /dev/null +++ b/Core/HLE/sceOpenPSID.cpp @@ -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"}, +}; + +void Register_sceOpenPSID() +{ + RegisterModule("sceOpenPSID", ARRAY_SIZE(sceOpenPSID), sceOpenPSID); +} \ No newline at end of file diff --git a/Core/HLE/sceOpenPSID.h b/Core/HLE/sceOpenPSID.h new file mode 100644 index 0000000000..07c5171e59 --- /dev/null +++ b/Core/HLE/sceOpenPSID.h @@ -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(); diff --git a/Core/HLE/sceParseHttp.cpp b/Core/HLE/sceParseHttp.cpp new file mode 100644 index 0000000000..6ad04ec026 --- /dev/null +++ b/Core/HLE/sceParseHttp.cpp @@ -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); +} \ No newline at end of file diff --git a/Core/HLE/sceParseHttp.h b/Core/HLE/sceParseHttp.h new file mode 100644 index 0000000000..6c67a246b2 --- /dev/null +++ b/Core/HLE/sceParseHttp.h @@ -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(); \ No newline at end of file diff --git a/Core/HLE/sceParseUri.cpp b/Core/HLE/sceParseUri.cpp new file mode 100644 index 0000000000..10268b47a9 --- /dev/null +++ b/Core/HLE/sceParseUri.cpp @@ -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); +} \ No newline at end of file diff --git a/Core/HLE/sceParseUri.h b/Core/HLE/sceParseUri.h new file mode 100644 index 0000000000..5108cd0219 --- /dev/null +++ b/Core/HLE/sceParseUri.h @@ -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(); \ No newline at end of file diff --git a/Core/HLE/sceSsl.cpp b/Core/HLE/sceSsl.cpp new file mode 100644 index 0000000000..0a762af122 --- /dev/null +++ b/Core/HLE/sceSsl.cpp @@ -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"}, + {0x191CDEFF, WrapI_V, "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"}, + {0x0EB43B06, WrapI_U, "sceSslGetUsedMemoryCurrent"}, + {0xF57765D3, 0, "sceSslGetKeyUsage"}, +}; + +void Register_sceSsl() +{ + RegisterModule("sceSsl", ARRAY_SIZE(sceSsl), sceSsl); +} \ No newline at end of file diff --git a/Core/HLE/sceSsl.h b/Core/HLE/sceSsl.h new file mode 100644 index 0000000000..c8e46f976b --- /dev/null +++ b/Core/HLE/sceSsl.h @@ -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(); \ No newline at end of file