mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Merge pull request #6132 from unknownbrackets/module-ver
Report devkit for blacklisted modules too
This commit is contained in:
commit
cc8ae194da
1 changed files with 47 additions and 33 deletions
|
@ -308,12 +308,18 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExportFunc(const FuncSymbolExport &func) {
|
void ExportFunc(const FuncSymbolExport &func) {
|
||||||
|
if (isFake) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
exportedFuncs.push_back(func);
|
exportedFuncs.push_back(func);
|
||||||
impExpModuleNames.insert(func.moduleName);
|
impExpModuleNames.insert(func.moduleName);
|
||||||
ExportFuncSymbol(func);
|
ExportFuncSymbol(func);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExportVar(const VarSymbolExport &var) {
|
void ExportVar(const VarSymbolExport &var) {
|
||||||
|
if (isFake) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
exportedVars.push_back(var);
|
exportedVars.push_back(var);
|
||||||
impExpModuleNames.insert(var.moduleName);
|
impExpModuleNames.insert(var.moduleName);
|
||||||
ExportVarSymbol(var);
|
ExportVarSymbol(var);
|
||||||
|
@ -812,6 +818,7 @@ Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, std::string *erro
|
||||||
memset(&module->nm, 0, sizeof(module->nm));
|
memset(&module->nm, 0, sizeof(module->nm));
|
||||||
|
|
||||||
bool reportedModule = false;
|
bool reportedModule = false;
|
||||||
|
u32 devkitVersion = 0;
|
||||||
u8 *newptr = 0;
|
u8 *newptr = 0;
|
||||||
u32_le *magicPtr = (u32_le *) ptr;
|
u32_le *magicPtr = (u32_le *) ptr;
|
||||||
if (*magicPtr == 0x4543537e) { // "~SCE"
|
if (*magicPtr == 0x4543537e) { // "~SCE"
|
||||||
|
@ -823,6 +830,7 @@ Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, std::string *erro
|
||||||
if (*magic == 0x5053507e) { // "~PSP"
|
if (*magic == 0x5053507e) { // "~PSP"
|
||||||
DEBUG_LOG(SCEMODULE, "Decrypting ~PSP file");
|
DEBUG_LOG(SCEMODULE, "Decrypting ~PSP file");
|
||||||
PSP_Header *head = (PSP_Header*)ptr;
|
PSP_Header *head = (PSP_Header*)ptr;
|
||||||
|
devkitVersion = head->devkitversion;
|
||||||
|
|
||||||
if (IsHLEVersionedModule(head->modname)) {
|
if (IsHLEVersionedModule(head->modname)) {
|
||||||
int ver = (head->module_ver_hi << 8) | head->module_ver_lo;
|
int ver = (head->module_ver_hi << 8) | head->module_ver_lo;
|
||||||
|
@ -934,33 +942,18 @@ Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, std::string *erro
|
||||||
char moduleName[29] = {0};
|
char moduleName[29] = {0};
|
||||||
strncpy(moduleName, modinfo->name, ARRAY_SIZE(module->nm.name));
|
strncpy(moduleName, modinfo->name, ARRAY_SIZE(module->nm.name));
|
||||||
|
|
||||||
if (!reportedModule && IsHLEVersionedModule(modinfo->name)) {
|
|
||||||
char temp[256];
|
|
||||||
snprintf(temp, sizeof(temp), "Loading module %s with version %%04x", modinfo->name);
|
|
||||||
INFO_LOG_REPORT(SCEMODULE, temp, modinfo->moduleVersion);
|
|
||||||
|
|
||||||
if (!strcmp(modinfo->name, "sceMpeg_library")) {
|
|
||||||
__MpegLoadModule(modinfo->moduleVersion);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for module blacklist - we don't allow games to load these modules from disc
|
// Check for module blacklist - we don't allow games to load these modules from disc
|
||||||
// as we have HLE implementations and the originals won't run in the emu because they
|
// as we have HLE implementations and the originals won't run in the emu because they
|
||||||
// directly access hardware or for other reasons.
|
// directly access hardware or for other reasons.
|
||||||
for (u32 i = 0; i < ARRAY_SIZE(blacklistedModules); i++) {
|
for (u32 i = 0; i < ARRAY_SIZE(blacklistedModules); i++) {
|
||||||
if (strncmp(modinfo->name, blacklistedModules[i], ARRAY_SIZE(modinfo->name)) == 0) {
|
if (strncmp(modinfo->name, blacklistedModules[i], ARRAY_SIZE(modinfo->name)) == 0) {
|
||||||
*error_string = "Blacklisted";
|
|
||||||
if (newptr)
|
|
||||||
{
|
|
||||||
delete [] newptr;
|
|
||||||
}
|
|
||||||
module->isFake = true;
|
module->isFake = true;
|
||||||
module->nm.entry_addr = -1;
|
|
||||||
return module;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!module->isFake) {
|
||||||
symbolMap.AddModule(moduleName, module->memoryBlockAddr, module->memoryBlockSize);
|
symbolMap.AddModule(moduleName, module->memoryBlockAddr, module->memoryBlockSize);
|
||||||
|
}
|
||||||
|
|
||||||
SectionID textSection = reader.GetSectionByName(".text");
|
SectionID textSection = reader.GetSectionByName(".text");
|
||||||
|
|
||||||
|
@ -975,6 +968,7 @@ Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, std::string *erro
|
||||||
// TODO: It seems like the data size excludes the text size, which kinda makes sense?
|
// TODO: It seems like the data size excludes the text size, which kinda makes sense?
|
||||||
module->nm.data_size -= textSize;
|
module->nm.data_size -= textSize;
|
||||||
|
|
||||||
|
if (!module->isFake) {
|
||||||
#if !defined(MOBILE_DEVICE)
|
#if !defined(MOBILE_DEVICE)
|
||||||
bool gotSymbols = reader.LoadSymbols();
|
bool gotSymbols = reader.LoadSymbols();
|
||||||
MIPSAnalyst::ScanForFunctions(module->textStart, module->textEnd, !gotSymbols);
|
MIPSAnalyst::ScanForFunctions(module->textStart, module->textEnd, !gotSymbols);
|
||||||
|
@ -985,6 +979,7 @@ Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, std::string *erro
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
INFO_LOG(LOADER, "Module %s: %08x %08x %08x", modinfo->name, modinfo->gp, modinfo->libent, modinfo->libstub);
|
INFO_LOG(LOADER, "Module %s: %08x %08x %08x", modinfo->name, modinfo->gp, modinfo->libent, modinfo->libstub);
|
||||||
|
|
||||||
|
@ -1136,6 +1131,8 @@ Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, std::string *erro
|
||||||
if (textSection == -1) {
|
if (textSection == -1) {
|
||||||
module->textStart = reader.GetVaddr();
|
module->textStart = reader.GetVaddr();
|
||||||
module->textEnd = firstImportStubAddr - 4;
|
module->textEnd = firstImportStubAddr - 4;
|
||||||
|
|
||||||
|
if (!module->isFake) {
|
||||||
#if !defined(MOBILE_DEVICE)
|
#if !defined(MOBILE_DEVICE)
|
||||||
bool gotSymbols = reader.LoadSymbols();
|
bool gotSymbols = reader.LoadSymbols();
|
||||||
MIPSAnalyst::ScanForFunctions(module->textStart, module->textEnd, !gotSymbols);
|
MIPSAnalyst::ScanForFunctions(module->textStart, module->textEnd, !gotSymbols);
|
||||||
|
@ -1146,6 +1143,7 @@ Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, std::string *erro
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Look at the exports, too.
|
// Look at the exports, too.
|
||||||
|
|
||||||
|
@ -1242,6 +1240,7 @@ Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, std::string *erro
|
||||||
int size;
|
int size;
|
||||||
switch (nid) {
|
switch (nid) {
|
||||||
case NID_MODULE_INFO:
|
case NID_MODULE_INFO:
|
||||||
|
// Points to a PspModuleInfo, often the exact one .rodata.sceModuleInfo points to.
|
||||||
break;
|
break;
|
||||||
case NID_MODULE_START_THREAD_PARAMETER:
|
case NID_MODULE_START_THREAD_PARAMETER:
|
||||||
size = Memory::Read_U32(exportAddr);
|
size = Memory::Read_U32(exportAddr);
|
||||||
|
@ -1275,6 +1274,7 @@ Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, std::string *erro
|
||||||
break;
|
break;
|
||||||
case NID_MODULE_SDK_VERSION:
|
case NID_MODULE_SDK_VERSION:
|
||||||
DEBUG_LOG(LOADER, "Module SDK: %08x", Memory::Read_U32(exportAddr));
|
DEBUG_LOG(LOADER, "Module SDK: %08x", Memory::Read_U32(exportAddr));
|
||||||
|
devkitVersion = Memory::Read_U32(exportAddr);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
var.nid = nid;
|
var.nid = nid;
|
||||||
|
@ -1285,15 +1285,29 @@ Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, std::string *erro
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!module->isFake) {
|
||||||
module->nm.entry_addr = reader.GetEntryPoint();
|
module->nm.entry_addr = reader.GetEntryPoint();
|
||||||
|
|
||||||
// use module_start_func instead of entry_addr if entry_addr is 0
|
// use module_start_func instead of entry_addr if entry_addr is 0
|
||||||
if (module->nm.entry_addr == 0)
|
if (module->nm.entry_addr == 0)
|
||||||
module->nm.entry_addr = module->nm.module_start_func;
|
module->nm.entry_addr = module->nm.module_start_func;
|
||||||
|
} else {
|
||||||
|
module->nm.entry_addr = -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (newptr)
|
if (newptr)
|
||||||
delete [] newptr;
|
delete [] newptr;
|
||||||
|
|
||||||
|
if (!reportedModule && IsHLEVersionedModule(modinfo->name)) {
|
||||||
|
char temp[256];
|
||||||
|
snprintf(temp, sizeof(temp), "Loading module %s with version %%04x, devkit %%08x", modinfo->name);
|
||||||
|
INFO_LOG_REPORT(SCEMODULE, temp, modinfo->moduleVersion, devkitVersion);
|
||||||
|
|
||||||
|
if (!strcmp(modinfo->name, "sceMpeg_library")) {
|
||||||
|
__MpegLoadModule(modinfo->moduleVersion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return module;
|
return module;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue