Skip to content

Commit

Permalink
sceKernelModule: allow a module to override the HLE implement. this m…
Browse files Browse the repository at this point in the history
…ake libfont.prx load and works

sceReg: path fix
add registry.txt(dump from a real PSP)
  • Loading branch information
tpunix committed Oct 6, 2013
1 parent cbce552 commit 3ca4e02
Show file tree
Hide file tree
Showing 3 changed files with 778 additions and 19 deletions.
25 changes: 13 additions & 12 deletions Core/HLE/sceKernelModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ static const char *lieAboutSuccessModules[] = {

static const char *blacklistedModules[] = {
"sceATRAC3plus_Library",
"sceFont_Library",
"SceFont_Library",
//"sceFont_Library",
//"SceFont_Library",
"SceHttp_Library",
"sceMpeg_library",
"sceNetAdhocctl_Library",
Expand Down Expand Up @@ -582,13 +582,6 @@ void UnexportVarSymbol(const VarSymbolExport &var) {
}

void ImportFuncSymbol(const FuncSymbolImport &func) {
// Prioritize HLE implementations.
// TODO: Or not?
if (FuncImportIsSyscall(func.moduleName, func.nid)) {
WriteSyscall(func.moduleName, func.nid, func.stubAddr);
currentMIPS->InvalidateICache(func.stubAddr, 8);
return;
}

u32 error;
for (auto mod = loadedModules.begin(), modend = loadedModules.end(); mod != modend; ++mod) {
Expand All @@ -607,6 +600,14 @@ void ImportFuncSymbol(const FuncSymbolImport &func) {
}
}

// Prioritize HLE implementations.
// TODO: Or not?
if (FuncImportIsSyscall(func.moduleName, func.nid)) {
WriteSyscall(func.moduleName, func.nid, func.stubAddr);
currentMIPS->InvalidateICache(func.stubAddr, 8);
return;
}

// It hasn't been exported yet, but hopefully it will later.
if (GetModuleIndex(func.moduleName) != -1) {
WARN_LOG_REPORT(LOADER, "Unknown syscall in known module: %s 0x%08x", func.moduleName, func.nid);
Expand All @@ -620,8 +621,8 @@ void ImportFuncSymbol(const FuncSymbolImport &func) {
void ExportFuncSymbol(const FuncSymbolExport &func) {
if (FuncImportIsSyscall(func.moduleName, func.nid)) {
// Oops, HLE covers this.
WARN_LOG_REPORT(LOADER, "Ignoring func export %s/%08x, already implemented in HLE.", func.moduleName, func.nid);
return;
WARN_LOG_REPORT(LOADER, "Func export %s/%08x override implemented in HLE.", func.moduleName, func.nid);
//return;
}

u32 error;
Expand All @@ -645,7 +646,7 @@ void ExportFuncSymbol(const FuncSymbolExport &func) {
void UnexportFuncSymbol(const FuncSymbolExport &func) {
if (FuncImportIsSyscall(func.moduleName, func.nid)) {
// Oops, HLE covers this.
return;
//return;
}

u32 error;
Expand Down
18 changes: 11 additions & 7 deletions Core/HLE/sceReg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ typedef struct {
char value[32];
}SCEREG_OBJ;

std::map<int, SCEREG_OBJ> scereg_objects;
IniFile iniFile;
static std::map<int, SCEREG_OBJ> scereg_objects;
static IniFile iniFile;

static const char registry_name[] = "registry.txt";
static std::string registry_name;
static int scereg_id;
static int scereg_load;
static int scereg_open;
Expand All @@ -35,6 +35,9 @@ static int scereg_open;

void __RegInit()
{
std::string tmp = "flash0:/registry.txt";
pspFileSystem.GetHostPath(tmp, registry_name);

scereg_id = 1;
scereg_load = 0;
scereg_open = 0;
Expand All @@ -57,7 +60,7 @@ void __RegDoState(PointerWrap &p)
p.DoMarker("sceReg");

if(scereg_open){
iniFile.Load(registry_name);
iniFile.Load(registry_name.c_str());
scereg_load = 1;
}
}
Expand Down Expand Up @@ -187,8 +190,8 @@ int sceRegOpenRegistry(u32 reg_ptr, int mode, u32 h_ptr)
INFO_LOG(HLE, "sceRegOpenRegistry()");

if(scereg_load==0){
if (!iniFile.Load(registry_name)) {
ERROR_LOG(HLE, "sceRegOpenRegistry: Failed to read %s", registry_name);
if (!iniFile.Load(registry_name.c_str())) {
ERROR_LOG(HLE, "sceRegOpenRegistry: Failed to read %s", registry_name.c_str());
return -1;
}
scereg_load = 1;
Expand Down Expand Up @@ -365,4 +368,5 @@ const HLEFunction sceReg[] = {

void Register_sceReg() {
RegisterModule("sceReg", ARRAY_SIZE(sceReg), sceReg);
}
}

Loading

0 comments on commit 3ca4e02

Please sign in to comment.