/* * Copyright (C) 2021 Andy Nguyen * Copyright (C) 2021-2022 Rinnegatamante * Copyright (C) 2022-2024 Volodymyr Atamanenko * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. */ #include "utils/init.h" #include "utils/dialog.h" #include "utils/glutil.h" #include "utils/logger.h" #include "utils/utils.h" #include "utils/settings.h" #include #include #include #include #include #include #include #include #include // Base address for the Android .so to be loaded at #define LOAD_ADDRESS_VITA 0x98000000 #define LOAD_ADDRESS_VITA3K 0x90000000 extern so_module so_mod; void soloader_init_all() { // Launch `app0:configurator.bin` on `-config` init param sceAppUtilInit(&(SceAppUtilInitParam){}, &(SceAppUtilBootParam){}); SceAppUtilAppEventParam eventParam; sceClibMemset(&eventParam, 0, sizeof(SceAppUtilAppEventParam)); sceAppUtilReceiveAppEvent(&eventParam); if (eventParam.type == 0x05) { char buffer[2048]; sceAppUtilAppEventParseLiveArea(&eventParam, buffer); if (strstr(buffer, "-config")) sceAppMgrLoadExec("app0:/configurator.bin", NULL, NULL); } // Set default overclock values scePowerSetArmClockFrequency(444); scePowerSetBusClockFrequency(222); scePowerSetGpuClockFrequency(222); scePowerSetGpuXbarClockFrequency(166); #ifdef USE_SCELIBC_IO if (fios_init(DATA_PATH) == 0) l_success("FIOS initialized."); #endif if (!module_loaded("kubridge")) { l_fatal("kubridge is not loaded."); fatal_error("Error: kubridge.skprx is not installed."); } l_success("kubridge check passed."); if (!file_exists(SO_PATH)) { fatal_error("Looks like you haven't installed the data files for this " "port, or they are in an incorrect location. Please make " "sure that you have %s file exactly at that path.", SO_PATH); } int so_result = so_file_load(&so_mod, SO_PATH, LOAD_ADDRESS_VITA); if (so_result < 0) { l_warn("SO load at 0x%08x failed=0x%08x; retrying Vita3K-compatible base 0x%08x", LOAD_ADDRESS_VITA, so_result, LOAD_ADDRESS_VITA3K); so_result = so_file_load(&so_mod, SO_PATH, LOAD_ADDRESS_VITA3K); } if (so_result < 0) { l_fatal("SO could not be loaded at either supported base (error=0x%08x).", so_result); fatal_error("Error: could not load %s.", SO_PATH); } l_info("SO selected load address=0x%08x", (unsigned)so_mod.load_addr); settings_load(); l_success("Settings loaded."); so_relocate(&so_mod); l_success("SO relocated."); resolve_imports(&so_mod); l_success("SO imports resolved."); so_patch(); l_success("SO patched."); so_flush_caches(&so_mod); l_success("SO caches flushed."); so_initialize(&so_mod); l_success("SO initialized."); gl_preload(); l_success("OpenGL preloaded."); jni_init(); l_success("FalsoJNI initialized."); #ifndef NDK_PORT controls_init(); l_success("Controls initialized."); #endif }