Skip to content

Commit a555fe8

Browse files
committed
Partially implement sceReg
1 parent 78141d6 commit a555fe8

18 files changed

+762
-3
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2298,6 +2298,8 @@ add_library(${CoreLibName} ${CoreLinkType}
22982298
Core/HLE/scePower.h
22992299
Core/HLE/scePsmf.cpp
23002300
Core/HLE/scePsmf.h
2301+
Core/HLE/sceReg.cpp
2302+
Core/HLE/sceReg.h
23012303
Core/HLE/sceRtc.cpp
23022304
Core/HLE/sceRtc.h
23032305
Core/HLE/sceSas.cpp

Common/StringUtils.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ inline bool endsWithNoCase(std::string_view str, std::string_view key) {
6363
return strncasecmp(str.data() + offset, key.data(), key.size()) == 0;
6464
}
6565

66+
inline bool equals(std::string_view str, std::string_view key) {
67+
return str == key;
68+
}
69+
6670
inline bool equalsNoCase(std::string_view str, std::string_view key) {
6771
if (str.size() != key.size())
6872
return false;

Core/Core.vcxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,7 @@
578578
<ClCompile Include="HLE\sceNetInet.cpp" />
579579
<ClCompile Include="HLE\sceNetResolver.cpp" />
580580
<ClCompile Include="HLE\sceNp2.cpp" />
581+
<ClCompile Include="HLE\sceReg.cpp" />
581582
<ClCompile Include="HLE\sceUsbAcc.cpp" />
582583
<ClCompile Include="HLE\sceUsbCam.cpp" />
583584
<ClCompile Include="HLE\sceUsbMic.cpp" />
@@ -1201,6 +1202,7 @@
12011202
<ClInclude Include="HLE\sceNetInet.h" />
12021203
<ClInclude Include="HLE\sceNetResolver.h" />
12031204
<ClInclude Include="HLE\sceNp2.h" />
1205+
<ClInclude Include="HLE\sceReg.h" />
12041206
<ClInclude Include="HLE\sceUsbAcc.h" />
12051207
<ClInclude Include="HLE\sceUsbCam.h" />
12061208
<ClInclude Include="HLE\sceUsbMic.h" />

Core/Core.vcxproj.filters

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1348,6 +1348,9 @@
13481348
<ClCompile Include="LuaContext.cpp">
13491349
<Filter>Core</Filter>
13501350
</ClCompile>
1351+
<ClCompile Include="HLE\sceReg.cpp">
1352+
<Filter>HLE\Libraries</Filter>
1353+
</ClCompile>
13511354
</ItemGroup>
13521355
<ItemGroup>
13531356
<ClInclude Include="ELF\ElfReader.h">
@@ -2181,6 +2184,9 @@
21812184
<ClInclude Include="HLE\PSPThreadContext.h">
21822185
<Filter>HLE\Kernel</Filter>
21832186
</ClInclude>
2187+
<ClInclude Include="HLE\sceReg.h">
2188+
<Filter>HLE\Libraries</Filter>
2189+
</ClInclude>
21842190
</ItemGroup>
21852191
<ItemGroup>
21862192
<None Include="..\LICENSE.TXT" />

Core/HLE/AtracCtx2.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,7 @@ void Atrac2::CheckForSas() {
10481048
if (info.state != 0x10) {
10491049
WARN_LOG(Log::ME, "Caller forgot to set state to 0x10");
10501050
}
1051-
sas_.isStreaming = info.fileDataEnd > info.bufferByte;
1051+
sas_.isStreaming = info.fileDataEnd > (s32)info.bufferByte;
10521052
if (sas_.isStreaming) {
10531053
INFO_LOG(Log::ME, "SasAtrac stream mode");
10541054
} else {

Core/HLE/ErrorCodes.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,4 +495,10 @@ enum PSPErrorCode : u32 {
495495
SCE_SAS_ERROR_NOT_INIT = 0x80420100,
496496

497497
SCE_AVCODEC_ERROR_INVALID_DATA = 0x807f00fd,
498+
499+
// These are inferred from behavior.
500+
SCE_REG_ERROR_CATEGORY_INACCESSIBLE = 0x80082712,
501+
SCE_REG_ERROR_REGISTRY_NOT_FOUND = 0x80082715,
502+
SCE_REG_ERROR_ROOT_NOT_ACCESSIBLE = 0x80082716,
503+
SCE_REG_ERROR_CATEGORY_NOT_FOUND = 0x80082718,
498504
};

Core/HLE/FunctionWrappers.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,21 @@ template<int func(int, const char *, int, u32)> void WrapI_ICIU() {
523523
RETURN(retval);
524524
}
525525

526+
template<int func(int, const char *, u32, u32)> void WrapI_ICUU() {
527+
int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2), PARAM(3));
528+
RETURN(retval);
529+
}
530+
531+
template<int func(int, const char *, u32, u32, u32)> void WrapI_ICUUU() {
532+
int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2), PARAM(3), PARAM(4));
533+
RETURN(retval);
534+
}
535+
536+
template<int func(int, int, u32, u32)> void WrapI_IIUU() {
537+
int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
538+
RETURN(retval);
539+
}
540+
526541
template<int func(const char *, int, u32)> void WrapI_CIU() {
527542
int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2));
528543
RETURN(retval);

Core/HLE/HLETables.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
#include "scePower.h"
6565
#include "scePspNpDrm_user.h"
6666
#include "scePsmf.h"
67+
#include "sceReg.h"
6768
#include "sceRtc.h"
6869
#include "sceSas.h"
6970
#include "sceSircs.h"
@@ -323,6 +324,7 @@ void RegisterAllModules() {
323324
Register_InterruptManagerForKernel();
324325
Register_sceSircs();
325326
Register_sceNet_lib();
327+
Register_sceReg();
326328
// Not ready to enable this due to apparent softlocks in Patapon 3.
327329
// Register_sceNpMatching2();
328330

Core/HLE/sceKernel.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
#include "scePower.h"
7676
#include "sceUtility.h"
7777
#include "sceUmd.h"
78+
#include "sceReg.h"
7879
#include "sceRtc.h"
7980
#include "sceSsl.h"
8081
#include "sceSas.h"
@@ -164,6 +165,7 @@ void __KernelInit()
164165
__OpenPSIDInit();
165166
__HttpInit();
166167
__NpInit();
168+
__RegInit();
167169

168170
SaveState::Init(); // Must be after IO, as it may create a directory
169171
Reporting::Init();
@@ -188,6 +190,7 @@ void __KernelShutdown()
188190
hleCurrentThreadName = NULL;
189191
kernelObjects.Clear();
190192

193+
__RegShutdown();
191194
__HttpShutdown();
192195
__OpenPSIDShutdown();
193196
__UsbCamShutdown();
@@ -303,6 +306,7 @@ void __KernelDoState(PointerWrap &p)
303306
__AACDoState(p);
304307
__UsbGpsDoState(p);
305308
__UsbMicDoState(p);
309+
__RegDoState(p);
306310

307311
// IMPORTANT! Add new sections last!
308312
}
@@ -1492,6 +1496,10 @@ const char *KernelErrorToString(u32 err) {
14921496

14931497
case SCE_AVCODEC_ERROR_INVALID_DATA: return "SCE_AVCODEC_ERROR_INVALID_DATA";
14941498

1499+
case SCE_REG_ERROR_CATEGORY_INACCESSIBLE: return "SCE_REG_ERROR_CATEGORY_INACCESSIBLE";
1500+
case SCE_REG_ERROR_CATEGORY_NOT_FOUND: return "SCE_REG_ERROR_CATEGORY_NOT_FOUND";
1501+
case SCE_REG_ERROR_REGISTRY_NOT_FOUND: return "SCE_REG_ERROR_REGISTRY_NOT_FOUND";
1502+
14951503
default:
14961504
return nullptr;
14971505
}

Core/HLE/sceKernelModule.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ void ExportFuncSymbol(const FuncSymbolExport &func) {
715715
for (SceUID moduleId : loadedModules) {
716716
PSPModule *module = kernelObjects.Get<PSPModule>(moduleId, error);
717717
if (!module || !module->ImportsOrExportsModuleName(func.moduleName)) {
718-
continue;
718+
continue;
719719
}
720720

721721
// Look for imports currently loaded modules already have, hook it up right away.

0 commit comments

Comments
 (0)