mirror of
https://github.com/wiiu-env/WUMSLoader.git
synced 2024-12-25 15:41:50 +01:00
Modules do now have a flag if they should be run before their entrypoint.
This commit is contained in:
parent
6a6a41bf1d
commit
e70ec9b345
@ -31,7 +31,7 @@ std::vector<ModuleData> ModuleDataPersistence::loadModuleData(module_information
|
|||||||
moduleData.setEntrypoint(module_data->entrypoint);
|
moduleData.setEntrypoint(module_data->entrypoint);
|
||||||
moduleData.setStartAddress(module_data->startAddress);
|
moduleData.setStartAddress(module_data->startAddress);
|
||||||
moduleData.setEndAddress(module_data->endAddress);
|
moduleData.setEndAddress(module_data->endAddress);
|
||||||
|
moduleData.setInitBeforeEntrypoint(module_data->initBeforeEntrypoint);
|
||||||
|
|
||||||
moduleData.setExportName(module_data->module_export_name);
|
moduleData.setExportName(module_data->module_export_name);
|
||||||
|
|
||||||
|
@ -151,36 +151,8 @@ extern "C" void doStart(int argc, char **argv) {
|
|||||||
DEBUG_FUNCTION_LINE("Try to call kernel init\n");
|
DEBUG_FUNCTION_LINE("Try to call kernel init\n");
|
||||||
// Call init hook of kernel
|
// Call init hook of kernel
|
||||||
for (auto &curModule : loadedModules) {
|
for (auto &curModule : loadedModules) {
|
||||||
if (curModule.getExportName().compare("homebrew_kernel") == 0) {
|
if (curModule.isInitBeforeEntrypoint()) {
|
||||||
CallHook(curModule, WUMS_HOOK_INIT);
|
CallHook(curModule, WUMS_HOOK_INIT);
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DEBUG_FUNCTION_LINE("Try to call homebrew_functionpatcher init\n");
|
|
||||||
// Call init hook of memory mapping
|
|
||||||
for (auto &curModule : loadedModules) {
|
|
||||||
if (curModule.getExportName().compare("homebrew_functionpatcher") == 0) {
|
|
||||||
CallHook(curModule, WUMS_HOOK_INIT);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DEBUG_FUNCTION_LINE("Try to call dynloadpatch init\n");
|
|
||||||
// Call init hook of memory mapping
|
|
||||||
for (auto &curModule : loadedModules) {
|
|
||||||
if (curModule.getExportName().compare("homebrew_dynloadpatch") == 0) {
|
|
||||||
CallHook(curModule, WUMS_HOOK_INIT);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DEBUG_FUNCTION_LINE("Try to call memory mapping init\n");
|
|
||||||
// Call init hook of memory mapping
|
|
||||||
for (auto &curModule : loadedModules) {
|
|
||||||
if (curModule.getExportName().compare("homebrew_memorymapping") == 0) {
|
|
||||||
CallHook(curModule, WUMS_HOOK_INIT);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,11 +166,7 @@ extern "C" void doStart(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (auto &curModule : loadedModules) {
|
for (auto &curModule : loadedModules) {
|
||||||
if ((curModule.getExportName().compare("homebrew_memorymapping") != 0) &&
|
if (!curModule.isInitBeforeEntrypoint()) {
|
||||||
(curModule.getExportName().compare("homebrew_functionpatcher") != 0) &&
|
|
||||||
(curModule.getExportName().compare("homebrew_dynloadpatch") != 0) &&
|
|
||||||
(curModule.getExportName().compare("homebrew_kernel") != 0)
|
|
||||||
) {
|
|
||||||
CallHook(curModule, WUMS_HOOK_INIT);
|
CallHook(curModule, WUMS_HOOK_INIT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -265,4 +233,4 @@ std::vector<ModuleData> OrderModulesByDependencies(const std::vector<ModuleData>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return finalOrder;
|
return finalOrder;
|
||||||
}
|
}
|
@ -70,6 +70,7 @@ public:
|
|||||||
const std::vector<ExportData> &getExportDataList() const {
|
const std::vector<ExportData> &getExportDataList() const {
|
||||||
return export_data_list;
|
return export_data_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
void addHookData(const HookData &data) {
|
void addHookData(const HookData &data) {
|
||||||
hook_data_list.push_back(data);
|
hook_data_list.push_back(data);
|
||||||
}
|
}
|
||||||
@ -131,6 +132,14 @@ public:
|
|||||||
return this->export_name;
|
return this->export_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isInitBeforeEntrypoint() const {
|
||||||
|
return this->initBeforeEntrypoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setInitBeforeEntrypoint(bool value) {
|
||||||
|
this->initBeforeEntrypoint = value;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<RelocationData> relocation_data_list;
|
std::vector<RelocationData> relocation_data_list;
|
||||||
std::vector<ExportData> export_data_list;
|
std::vector<ExportData> export_data_list;
|
||||||
@ -146,4 +155,5 @@ private:
|
|||||||
uint32_t startAddress = 0;
|
uint32_t startAddress = 0;
|
||||||
uint32_t endAddress = 0;
|
uint32_t endAddress = 0;
|
||||||
uint32_t entrypoint = 0;
|
uint32_t entrypoint = 0;
|
||||||
|
bool initBeforeEntrypoint = false;
|
||||||
};
|
};
|
||||||
|
@ -184,7 +184,12 @@ std::optional<ModuleData> ModuleDataFactory::load(std::string path, uint32_t* de
|
|||||||
if (key.compare("export_name") == 0) {
|
if (key.compare("export_name") == 0) {
|
||||||
DEBUG_FUNCTION_LINE("export_name = %s", value.c_str());
|
DEBUG_FUNCTION_LINE("export_name = %s", value.c_str());
|
||||||
moduleData.setExportName(value);
|
moduleData.setExportName(value);
|
||||||
}else if (key.compare("wums") == 0) {
|
}else if (key.compare("initBeforeEntrypoint") == 0) {
|
||||||
|
if (value.compare("true") == 0) {
|
||||||
|
DEBUG_FUNCTION_LINE("initBeforeEntrypoint = %s", value.c_str());
|
||||||
|
moduleData.setInitBeforeEntrypoint(true);
|
||||||
|
}
|
||||||
|
}if (key.compare("wums") == 0) {
|
||||||
if (value.compare("0.1") != 0) {
|
if (value.compare("0.1") != 0) {
|
||||||
DEBUG_FUNCTION_LINE("Warning: Ignoring module - Unsupported WUMS version: %s.\n", value.c_str());
|
DEBUG_FUNCTION_LINE("Warning: Ignoring module - Unsupported WUMS version: %s.\n", value.c_str());
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
|
@ -70,8 +70,8 @@ bool ModuleDataPersistence::saveModuleData(module_information_t *moduleInformati
|
|||||||
module_data->sbssSize = module.getSBSSSize();
|
module_data->sbssSize = module.getSBSSSize();
|
||||||
module_data->startAddress = module.getStartAddress();
|
module_data->startAddress = module.getStartAddress();
|
||||||
module_data->endAddress = module.getEndAddress();
|
module_data->endAddress = module.getEndAddress();
|
||||||
|
|
||||||
module_data->entrypoint = module.getEntrypoint();
|
module_data->entrypoint = module.getEntrypoint();
|
||||||
|
module_data->initBeforeEntrypoint = module.isInitBeforeEntrypoint();
|
||||||
|
|
||||||
moduleInformation->number_used_modules++;
|
moduleInformation->number_used_modules++;
|
||||||
|
|
||||||
@ -104,8 +104,8 @@ std::vector<ModuleData> ModuleDataPersistence::loadModuleData(module_information
|
|||||||
moduleData.setEntrypoint(module_data->entrypoint);
|
moduleData.setEntrypoint(module_data->entrypoint);
|
||||||
moduleData.setStartAddress(module_data->startAddress);
|
moduleData.setStartAddress(module_data->startAddress);
|
||||||
moduleData.setEndAddress(module_data->endAddress);
|
moduleData.setEndAddress(module_data->endAddress);
|
||||||
|
|
||||||
moduleData.setExportName(module_data->module_export_name);
|
moduleData.setExportName(module_data->module_export_name);
|
||||||
|
moduleData.setInitBeforeEntrypoint(module_data->initBeforeEntrypoint);
|
||||||
|
|
||||||
for (uint32_t j = 0; j < EXPORT_ENTRY_LIST_LENGTH; j++) {
|
for (uint32_t j = 0; j < EXPORT_ENTRY_LIST_LENGTH; j++) {
|
||||||
export_data_t *export_entry = &(module_data->export_entries[j]);
|
export_data_t *export_entry = &(module_data->export_entries[j]);
|
||||||
|
Loading…
Reference in New Issue
Block a user