mirror of
https://github.com/wiiu-env/WUMSLoader.git
synced 2026-09-05 10:04:31 -05:00
Formatting
This commit is contained in:
@@ -26,20 +26,20 @@
|
||||
|
||||
bool CheckRunning() {
|
||||
|
||||
switch(ProcUIProcessMessages(true)) {
|
||||
case PROCUI_STATUS_EXITING: {
|
||||
return false;
|
||||
}
|
||||
case PROCUI_STATUS_RELEASE_FOREGROUND: {
|
||||
ProcUIDrawDoneRelease();
|
||||
break;
|
||||
}
|
||||
case PROCUI_STATUS_IN_FOREGROUND: {
|
||||
break;
|
||||
}
|
||||
case PROCUI_STATUS_IN_BACKGROUND:
|
||||
default:
|
||||
break;
|
||||
switch (ProcUIProcessMessages(true)) {
|
||||
case PROCUI_STATUS_EXITING: {
|
||||
return false;
|
||||
}
|
||||
case PROCUI_STATUS_RELEASE_FOREGROUND: {
|
||||
ProcUIDrawDoneRelease();
|
||||
break;
|
||||
}
|
||||
case PROCUI_STATUS_IN_FOREGROUND: {
|
||||
break;
|
||||
}
|
||||
case PROCUI_STATUS_IN_BACKGROUND:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -50,8 +50,8 @@ static_assert(sizeof(module_information_t) <= 0x80000);
|
||||
|
||||
extern "C" uint32_t textStart();
|
||||
|
||||
bool doRelocation(std::vector<RelocationData> &relocData, relocation_trampolin_entry_t * tramp_data, uint32_t tramp_length) {
|
||||
for (auto const& curReloc : relocData) {
|
||||
bool doRelocation(std::vector<RelocationData> &relocData, relocation_trampolin_entry_t *tramp_data, uint32_t tramp_length) {
|
||||
for (auto const &curReloc : relocData) {
|
||||
std::string functionName = curReloc.getName();
|
||||
std::string rplName = curReloc.getImportRPLInformation().getName();
|
||||
int32_t isData = curReloc.getImportRPLInformation().isData();
|
||||
@@ -59,11 +59,11 @@ bool doRelocation(std::vector<RelocationData> &relocData, relocation_trampolin_e
|
||||
OSDynLoad_Acquire(rplName.c_str(), &rplHandle);
|
||||
|
||||
uint32_t functionAddress = 0;
|
||||
OSDynLoad_FindExport(rplHandle, isData, functionName.c_str(), (void**) &functionAddress);
|
||||
if(functionAddress == 0) {
|
||||
OSDynLoad_FindExport(rplHandle, isData, functionName.c_str(), (void **) &functionAddress);
|
||||
if (functionAddress == 0) {
|
||||
return false;
|
||||
}
|
||||
if(!ElfUtils::elfLinkOne(curReloc.getType(), curReloc.getOffset(), curReloc.getAddend(), (uint32_t) curReloc.getDestination(), functionAddress, tramp_data, tramp_length, RELOC_TYPE_IMPORT)) {
|
||||
if (!ElfUtils::elfLinkOne(curReloc.getType(), curReloc.getOffset(), curReloc.getAddend(), (uint32_t) curReloc.getDestination(), functionAddress, tramp_data, tramp_length, RELOC_TYPE_IMPORT)) {
|
||||
DEBUG_FUNCTION_LINE("Relocation failed\n");
|
||||
return false;
|
||||
}
|
||||
@@ -74,7 +74,7 @@ bool doRelocation(std::vector<RelocationData> &relocData, relocation_trampolin_e
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int main(int argc, char **argv) {
|
||||
WHBLogUdpInit();
|
||||
|
||||
// 0x100 because before the .text section is a .init section
|
||||
@@ -84,45 +84,45 @@ int main(int argc, char **argv) {
|
||||
DirList setupModules("fs:/vol/external01/wiiu/modules/setup", ".rpx", DirList::Files, 1);
|
||||
setupModules.SortList();
|
||||
|
||||
for(int i = 0; i < setupModules.GetFilecount(); i++) {
|
||||
memset((void*)gModuleData, 0, sizeof(module_information_t));
|
||||
DEBUG_FUNCTION_LINE("Trying to run %s",setupModules.GetFilepath(i));
|
||||
for (int i = 0; i < setupModules.GetFilecount(); i++) {
|
||||
memset((void *) gModuleData, 0, sizeof(module_information_t));
|
||||
DEBUG_FUNCTION_LINE("Trying to run %s", setupModules.GetFilepath(i));
|
||||
std::optional<ModuleData> moduleData = ModuleDataFactory::load(setupModules.GetFilepath(i), 0x00900000, 0x01000000 - textSectionStart, gModuleData->trampolines, DYN_LINK_TRAMPOLIN_LIST_LENGTH);
|
||||
if(!moduleData) {
|
||||
if (!moduleData) {
|
||||
DEBUG_FUNCTION_LINE("Failed to load %s", setupModules.GetFilepath(i));
|
||||
continue;
|
||||
}
|
||||
DEBUG_FUNCTION_LINE("Loaded module data");
|
||||
std::vector<RelocationData> relocData = moduleData->getRelocationDataList();
|
||||
if(!doRelocation(relocData, gModuleData->trampolines,DYN_LINK_TRAMPOLIN_LIST_LENGTH)) {
|
||||
if (!doRelocation(relocData, gModuleData->trampolines, DYN_LINK_TRAMPOLIN_LIST_LENGTH)) {
|
||||
DEBUG_FUNCTION_LINE("relocations failed\n");
|
||||
}
|
||||
if(moduleData->getBSSAddr() != 0) {
|
||||
if (moduleData->getBSSAddr() != 0) {
|
||||
DEBUG_FUNCTION_LINE("memset .bss %08X (%d)", moduleData->getBSSAddr(), moduleData->getBSSSize());
|
||||
memset((void*)moduleData->getBSSAddr(), 0, moduleData->getBSSSize());
|
||||
memset((void *) moduleData->getBSSAddr(), 0, moduleData->getBSSSize());
|
||||
}
|
||||
if(moduleData->getSBSSAddr() != 0) {
|
||||
if (moduleData->getSBSSAddr() != 0) {
|
||||
DEBUG_FUNCTION_LINE("memset .sbss %08X (%d)", moduleData->getSBSSAddr(), moduleData->getSBSSSize());
|
||||
memset((void*)moduleData->getSBSSAddr(), 0, moduleData->getSBSSSize());
|
||||
memset((void *) moduleData->getSBSSAddr(), 0, moduleData->getSBSSSize());
|
||||
}
|
||||
DCFlushRange((void*)0x00800000, 0x00800000);
|
||||
ICInvalidateRange((void*)0x00800000, 0x00800000);
|
||||
DCFlushRange((void *) 0x00800000, 0x00800000);
|
||||
ICInvalidateRange((void *) 0x00800000, 0x00800000);
|
||||
DEBUG_FUNCTION_LINE("Calling %08X", moduleData->getEntrypoint());
|
||||
((int (*)(int, char **))moduleData->getEntrypoint())(argc, argv);
|
||||
((int (*)(int, char **)) moduleData->getEntrypoint())(argc, argv);
|
||||
DEBUG_FUNCTION_LINE("Back from module");
|
||||
}
|
||||
|
||||
memset((void*)gModuleData, 0, sizeof(module_information_t));
|
||||
memset((void *) gModuleData, 0, sizeof(module_information_t));
|
||||
|
||||
DirList modules("fs:/vol/external01/wiiu/modules", ".rpx", DirList::Files, 1);
|
||||
modules.SortList();
|
||||
|
||||
for(int i = 0; i < modules.GetFilecount(); i++) {
|
||||
DEBUG_FUNCTION_LINE("Loading module %s",modules.GetFilepath(i));
|
||||
for (int i = 0; i < modules.GetFilecount(); i++) {
|
||||
DEBUG_FUNCTION_LINE("Loading module %s", modules.GetFilepath(i));
|
||||
|
||||
std::optional<ModuleData> moduleData = ModuleDataFactory::load(modules.GetFilepath(i), 0x00900000, 0x01000000 - textSectionStart, gModuleData->trampolines, DYN_LINK_TRAMPOLIN_LIST_LENGTH);
|
||||
|
||||
if(moduleData) {
|
||||
if (moduleData) {
|
||||
DEBUG_FUNCTION_LINE("Successfully loaded %s", modules.GetFilepath(i));
|
||||
ModuleDataPersistence::saveModuleData(gModuleData, moduleData.value());
|
||||
} else {
|
||||
@@ -136,7 +136,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
ProcUIInit(OSSavesDone_ReadyToRelease);
|
||||
SYSLaunchMenu();
|
||||
while(CheckRunning()) {
|
||||
while (CheckRunning()) {
|
||||
// wait.
|
||||
OSSleepTicks(OSMillisecondsToTicks(100));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user