2012-11-01 15:19:01 +00:00
|
|
|
// 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
|
2012-11-04 22:01:49 +00:00
|
|
|
// the Free Software Foundation, version 2.0 or later versions.
|
2012-11-01 15:19:01 +00:00
|
|
|
|
|
|
|
// 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 "HLETables.h"
|
|
|
|
|
|
|
|
#include "sceCtrl.h"
|
|
|
|
#include "sceDisplay.h"
|
|
|
|
#include "sceHttp.h"
|
|
|
|
#include "sceAtrac.h"
|
|
|
|
#include "sceIo.h"
|
|
|
|
#include "sceHprm.h"
|
|
|
|
#include "scePower.h"
|
2012-11-22 21:29:51 +00:00
|
|
|
#include "sceFont.h"
|
2012-11-01 15:19:01 +00:00
|
|
|
#include "sceNet.h"
|
|
|
|
#include "sceMpeg.h"
|
2012-11-09 11:31:58 +00:00
|
|
|
#include "sceImpose.h"
|
2012-11-01 15:19:01 +00:00
|
|
|
#include "sceGe.h"
|
|
|
|
#include "scePsmf.h"
|
|
|
|
#include "sceRtc.h"
|
|
|
|
#include "sceSas.h"
|
|
|
|
#include "sceUmd.h"
|
|
|
|
#include "sceDmac.h"
|
2012-11-22 21:29:51 +00:00
|
|
|
#include "sceRtc.h"
|
2012-12-06 15:24:25 +00:00
|
|
|
#include "sceOpenPSID.h"
|
2012-11-01 15:19:01 +00:00
|
|
|
#include "sceKernel.h"
|
|
|
|
#include "sceKernelEventFlag.h"
|
|
|
|
#include "sceKernelMemory.h"
|
|
|
|
#include "sceKernelInterrupt.h"
|
|
|
|
#include "sceKernelModule.h"
|
|
|
|
#include "sceKernelSemaphore.h"
|
|
|
|
#include "sceKernelThread.h"
|
|
|
|
#include "sceKernelTime.h"
|
|
|
|
#include "sceAudio.h"
|
|
|
|
#include "sceUtility.h"
|
2012-12-06 15:24:25 +00:00
|
|
|
#include "sceParseUri.h"
|
|
|
|
#include "sceSsl.h"
|
|
|
|
#include "sceParseHttp.h"
|
2012-12-06 17:44:33 +00:00
|
|
|
#include "sceVaudio.h"
|
2012-12-17 20:45:32 +00:00
|
|
|
#include "sceUsb.h"
|
2013-01-28 23:11:02 +00:00
|
|
|
#include "sceChnnlsv.h"
|
2013-02-24 17:27:37 +00:00
|
|
|
#include "scePspNpDrm_user.h"
|
2013-03-15 12:07:54 +00:00
|
|
|
#include "sceP3da.h"
|
2013-03-19 00:00:29 +00:00
|
|
|
#include "sceGameUpdate.h"
|
2013-04-05 05:26:54 +00:00
|
|
|
#include "sceDeflt.h"
|
2013-04-28 00:23:58 +00:00
|
|
|
#include "sceMp4.h"
|
2013-05-06 13:09:40 +00:00
|
|
|
#include "sceMp3.h"
|
2013-04-29 03:40:09 +00:00
|
|
|
#include "scePauth.h"
|
|
|
|
#include "sceNp.h"
|
2013-05-15 11:49:34 +00:00
|
|
|
#include "sceMd5.h"
|
|
|
|
#include "sceJpeg.h"
|
2012-11-01 15:19:01 +00:00
|
|
|
|
|
|
|
#define N(s) s
|
|
|
|
|
|
|
|
//\*\*\ found\:\ {[a-zA-Z]*}\ {0x[a-zA-Z0-9]*}\ \*\*
|
|
|
|
//{FID(\2),0,N("\1")},
|
|
|
|
|
|
|
|
//Metal Gear Acid modules:
|
|
|
|
//kjfs
|
|
|
|
//sound
|
|
|
|
//zlibdec
|
2013-05-19 22:56:37 +00:00
|
|
|
const HLEFunction FakeSysCalls[] = {
|
2012-12-06 15:24:25 +00:00
|
|
|
{NID_THREADRETURN, __KernelReturnFromThread, "__KernelReturnFromThread"},
|
|
|
|
{NID_CALLBACKRETURN, __KernelReturnFromMipsCall, "__KernelReturnFromMipsCall"},
|
2012-11-07 14:44:48 +00:00
|
|
|
{NID_INTERRUPTRETURN, __KernelReturnFromInterrupt, "__KernelReturnFromInterrupt"},
|
2013-05-19 03:16:01 +00:00
|
|
|
{NID_EXTENDRETURN, __KernelReturnFromExtendStack, "__KernelReturnFromExtendStack"},
|
2012-12-06 15:24:25 +00:00
|
|
|
{NID_IDLE, __KernelIdle, "_sceKernelIdle"},
|
2012-11-01 15:19:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const HLEFunction UtilsForUser[] =
|
|
|
|
{
|
2012-11-20 09:59:23 +00:00
|
|
|
{0x91E4F6A7, WrapU_V<sceKernelLibcClock>, "sceKernelLibcClock"},
|
2013-01-02 05:27:18 +00:00
|
|
|
{0x27CC57F0, WrapU_U<sceKernelLibcTime>, "sceKernelLibcTime"},
|
2013-05-05 06:14:28 +00:00
|
|
|
{0x71EC4271, WrapU_UU<sceKernelLibcGettimeofday>, "sceKernelLibcGettimeofday"},
|
2013-01-12 18:07:50 +00:00
|
|
|
{0xBFA98062, WrapI_UI<sceKernelDcacheInvalidateRange>, "sceKernelDcacheInvalidateRange"},
|
2012-11-01 15:19:01 +00:00
|
|
|
{0xC8186A58, 0, "sceKernelUtilsMd5Digest"},
|
|
|
|
{0x9E5C5086, 0, "sceKernelUtilsMd5BlockInit"},
|
|
|
|
{0x61E1E525, 0, "sceKernelUtilsMd5BlockUpdate"},
|
|
|
|
{0xB8D24E78, 0, "sceKernelUtilsMd5BlockResult"},
|
|
|
|
{0x840259F1, 0, "sceKernelUtilsSha1Digest"},
|
|
|
|
{0xF8FCD5BA, 0, "sceKernelUtilsSha1BlockInit"},
|
|
|
|
{0x346F6DA8, 0, "sceKernelUtilsSha1BlockUpdate"},
|
|
|
|
{0x585F1C09, 0, "sceKernelUtilsSha1BlockResult"},
|
2013-05-19 22:56:37 +00:00
|
|
|
{0xE860E75E, WrapU_UU<sceKernelUtilsMt19937Init>, "sceKernelUtilsMt19937Init"},
|
|
|
|
{0x06FB8A63, WrapU_U<sceKernelUtilsMt19937UInt>, "sceKernelUtilsMt19937UInt"},
|
2013-01-12 18:07:50 +00:00
|
|
|
{0x37FB5C42, WrapU_V<sceKernelGetGPI>, "sceKernelGetGPI"},
|
|
|
|
{0x6AD345D7, WrapV_U<sceKernelSetGPO>, "sceKernelSetGPO"},
|
|
|
|
{0x79D1C3FA, WrapI_V<sceKernelDcacheWritebackAll>, "sceKernelDcacheWritebackAll"},
|
|
|
|
{0xB435DEC5, WrapI_V<sceKernelDcacheWritebackInvalidateAll>, "sceKernelDcacheWritebackInvalidateAll"},
|
|
|
|
{0x3EE30821, WrapI_UI<sceKernelDcacheWritebackRange>, "sceKernelDcacheWritebackRange"},
|
|
|
|
{0x34B9FA9E, WrapI_UI<sceKernelDcacheWritebackInvalidateRange>, "sceKernelDcacheWritebackInvalidateRange"},
|
2013-03-16 08:38:50 +00:00
|
|
|
{0xC2DF770E, WrapI_UI<sceKernelIcacheInvalidateRange>, "sceKernelIcacheInvalidateRange"},
|
2012-11-01 15:19:01 +00:00
|
|
|
{0x80001C4C, 0, "sceKernelDcacheProbe"},
|
|
|
|
{0x16641D70, 0, "sceKernelDcacheReadTag"},
|
|
|
|
{0x4FD31C9D, 0, "sceKernelIcacheProbe"},
|
|
|
|
{0xFB05FAD0, 0, "sceKernelIcacheReadTag"},
|
2013-01-12 18:07:50 +00:00
|
|
|
{0x920f104a, WrapU_V<sceKernelIcacheInvalidateAll>, "sceKernelIcacheInvalidateAll"}
|
2012-11-01 15:19:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const HLEFunction IoFileMgrForKernel[] =
|
|
|
|
{
|
2012-12-06 15:24:25 +00:00
|
|
|
{0xa905b705, 0, "sceIoCloseAll"},
|
|
|
|
{0x411106BA, 0, "sceIoGetThreadCwd"},
|
|
|
|
{0xCB0A151F, 0, "sceIoChangeThreadCwd"},
|
|
|
|
{0x8E982A74, 0, "sceIoAddDrv"},
|
|
|
|
{0xC7F35804, 0, "sceIoDelDrv"},
|
|
|
|
{0x3C54E908, 0, "sceIoReopen"},
|
2012-11-01 15:19:01 +00:00
|
|
|
};
|
|
|
|
const HLEFunction StdioForKernel[] =
|
|
|
|
{
|
2012-12-06 15:24:25 +00:00
|
|
|
{0x98220F3E, 0, "sceKernelStdoutReopen"},
|
|
|
|
{0xFB5380C5, 0, "sceKernelStderrReopen"},
|
|
|
|
{0x2CCF071A, 0, "fdprintf"},
|
2012-11-01 15:19:01 +00:00
|
|
|
};
|
|
|
|
const HLEFunction LoadCoreForKernel[] =
|
|
|
|
{
|
2012-12-06 15:24:25 +00:00
|
|
|
{0xACE23476, 0, "sceKernelCheckPspConfig"},
|
|
|
|
{0x7BE1421C, 0, "sceKernelCheckExecFile"},
|
|
|
|
{0xBF983EF2, 0, "sceKernelProbeExecutableObject"},
|
|
|
|
{0x7068E6BA, 0, "sceKernelLoadExecutableObject"},
|
|
|
|
{0xB4D6FECC, 0, "sceKernelApplyElfRelSection"},
|
|
|
|
{0x54AB2675, 0, "LoadCoreForKernel_54AB2675"},
|
|
|
|
{0x2952F5AC, 0, "sceKernelDcacheWBinvAll"},
|
2013-01-12 18:07:50 +00:00
|
|
|
{0xD8779AC6, WrapU_V<sceKernelIcacheClearAll>, "sceKernelIcacheClearAll"},
|
2012-12-06 15:24:25 +00:00
|
|
|
{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"},
|
2013-05-20 00:54:14 +00:00
|
|
|
{0xCF8A41B1, WrapU_C<sceKernelFindModuleByName>,"sceKernelFindModuleByName"},
|
2012-11-01 15:19:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const HLEFunction KDebugForKernel[] =
|
|
|
|
{
|
|
|
|
{0xE7A3874D, 0, "sceKernelRegisterAssertHandler"},
|
|
|
|
{0x2FF4E9F9, 0, "sceKernelAssert"},
|
|
|
|
{0x9B868276, 0, "sceKernelGetDebugPutchar"},
|
|
|
|
{0xE146606D, 0, "sceKernelRegisterDebugPutchar"},
|
2013-01-12 18:07:50 +00:00
|
|
|
{0x7CEB2C09, WrapU_V<sceKernelRegisterKprintfHandler>, "sceKernelRegisterKprintfHandler"},
|
2012-11-01 15:19:01 +00:00
|
|
|
{0x84F370BC, 0, "Kprintf"},
|
|
|
|
{0x5CE9838B, 0, "sceKernelDebugWrite"},
|
|
|
|
{0x66253C4E, 0, "sceKernelRegisterDebugWrite"},
|
|
|
|
{0xDBB5597F, 0, "sceKernelDebugRead"},
|
|
|
|
{0xE6554FDA, 0, "sceKernelRegisterDebugRead"},
|
|
|
|
{0xB9C643C9, 0, "sceKernelDebugEcho"},
|
|
|
|
{0x7D1C74F0, 0, "sceKernelDebugEchoSet"},
|
|
|
|
{0x24C32559, 0, "KDebugForKernel_24C32559"},
|
|
|
|
{0xD636B827, 0, "sceKernelRemoveByDebugSection"},
|
|
|
|
{0x5282DD5E, 0, "KDebugForKernel_5282DD5E"},
|
|
|
|
{0x9F8703E4, 0, "KDebugForKernel_9F8703E4"},
|
|
|
|
{0x333DCEC7, 0, "KDebugForKernel_333DCEC7"},
|
|
|
|
{0xE892D9A1, 0, "KDebugForKernel_E892D9A1"},
|
|
|
|
{0xA126F497, 0, "KDebugForKernel_A126F497"},
|
|
|
|
{0xB7251823, 0, "sceKernelAcceptMbogoSig"},
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#define SZ(a) sizeof(a)/sizeof(HLEFunction)
|
|
|
|
|
|
|
|
const HLEFunction pspeDebug[] =
|
|
|
|
{
|
|
|
|
{0xDEADBEAF, 0, "pspeDebugWrite"},
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const HLEModule moduleList[] =
|
|
|
|
{
|
|
|
|
{"FakeSysCalls", SZ(FakeSysCalls), FakeSysCalls},
|
|
|
|
{"UtilsForUser",SZ(UtilsForUser),UtilsForUser},
|
|
|
|
{"KDebugForKernel",SZ(KDebugForKernel),KDebugForKernel},
|
|
|
|
{"sceSAScore"},
|
|
|
|
{"SceBase64_Library"},
|
|
|
|
{"sceCert_Loader"},
|
|
|
|
{"SceFont_Library"},
|
|
|
|
{"sceNetApctl"},
|
|
|
|
{"sceSIRCS_IrDA_Driver"},
|
|
|
|
{"Pspnet_Scan"},
|
|
|
|
{"Pspnet_Show_MacAddr"},
|
|
|
|
{"pspeDebug", SZ(pspeDebug), pspeDebug},
|
|
|
|
{"StdioForKernel", SZ(StdioForKernel), StdioForKernel},
|
|
|
|
{"LoadCoreForKernel", SZ(LoadCoreForKernel), LoadCoreForKernel},
|
|
|
|
{"IoFileMgrForKernel", SZ(IoFileMgrForKernel), IoFileMgrForKernel},
|
|
|
|
};
|
|
|
|
|
|
|
|
static const int numModules = sizeof(moduleList)/sizeof(HLEModule);
|
|
|
|
|
|
|
|
void RegisterAllModules() {
|
2012-12-06 15:24:25 +00:00
|
|
|
Register_Kernel_Library();
|
|
|
|
Register_ThreadManForUser();
|
|
|
|
Register_LoadExecForUser();
|
|
|
|
Register_SysMemUserForUser();
|
|
|
|
Register_InterruptManager();
|
|
|
|
Register_IoFileMgrForUser();
|
|
|
|
Register_ModuleMgrForUser();
|
|
|
|
Register_StdioForUser();
|
2012-11-01 15:19:01 +00:00
|
|
|
|
2012-12-06 15:24:25 +00:00
|
|
|
Register_sceHprm();
|
|
|
|
Register_sceCtrl();
|
|
|
|
Register_sceDisplay();
|
|
|
|
Register_sceAudio();
|
|
|
|
Register_sceSasCore();
|
2012-11-22 21:29:51 +00:00
|
|
|
Register_sceFont();
|
|
|
|
Register_sceNet();
|
2012-12-06 15:24:25 +00:00
|
|
|
Register_sceRtc();
|
|
|
|
Register_sceWlanDrv();
|
|
|
|
Register_sceMpeg();
|
|
|
|
Register_sceMp3();
|
|
|
|
Register_sceHttp();
|
|
|
|
Register_scePower();
|
2012-11-09 11:31:58 +00:00
|
|
|
Register_sceImpose();
|
2012-12-06 15:24:25 +00:00
|
|
|
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();
|
2012-12-06 17:44:33 +00:00
|
|
|
Register_sceVaudio();
|
2012-12-17 20:45:32 +00:00
|
|
|
Register_sceUsb();
|
2013-01-28 23:11:02 +00:00
|
|
|
Register_sceChnnlsv();
|
2013-03-04 22:34:17 +00:00
|
|
|
Register_sceNpDrm();
|
2013-03-15 12:07:54 +00:00
|
|
|
Register_sceP3da();
|
2013-03-19 00:00:29 +00:00
|
|
|
Register_sceGameUpdate();
|
2013-04-05 05:26:54 +00:00
|
|
|
Register_sceDeflt();
|
2013-04-28 00:23:58 +00:00
|
|
|
Register_sceMp4();
|
2013-04-29 03:40:09 +00:00
|
|
|
Register_scePauth();
|
|
|
|
Register_sceNp();
|
|
|
|
Register_sceNpCommerce2();
|
|
|
|
Register_sceNpService();
|
2013-05-15 11:49:34 +00:00
|
|
|
Register_sceNpAuth();
|
|
|
|
Register_sceMd5();
|
|
|
|
Register_sceJpeg();
|
2012-11-01 15:19:01 +00:00
|
|
|
|
2012-12-06 15:24:25 +00:00
|
|
|
for (int i = 0; i < numModules; i++)
|
|
|
|
{
|
|
|
|
RegisterModule(moduleList[i].name, moduleList[i].numFunctions, moduleList[i].funcTable);
|
|
|
|
}
|
2012-11-01 15:19:01 +00:00
|
|
|
}
|
|
|
|
|