Repository: dots-tb/LOLIcon Branch: master Commit: cc0b1d0b3ae2 Files: 10 Total size: 41.6 KB Directory structure: gitextract_c4yn0b6h/ ├── CMakeLists.txt ├── LICENSE.md ├── LOLIcon.c ├── LOLIcon.yml ├── README.md ├── blit.c ├── blit.h ├── font.c ├── utils.c └── utils.h ================================================ FILE CONTENTS ================================================ ================================================ FILE: CMakeLists.txt ================================================ cmake_minimum_required(VERSION 2.8) if(NOT DEFINED CMAKE_TOOLCHAIN_FILE) if(DEFINED ENV{VITASDK}) set(CMAKE_TOOLCHAIN_FILE "$ENV{VITASDK}/share/vita.toolchain.cmake" CACHE PATH "toolchain file") else() message(FATAL_ERROR "Please define VITASDK to point to your SDK path!") endif() endif() project(LOLIcon) include("$ENV{VITASDK}/share/vita.cmake" REQUIRED) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-q -Wall -O3 -std=gnu99") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -nostdlib") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-rtti -fno-exceptions") link_directories( ${CMAKE_CURRENT_BINARY_DIR} ) add_executable(${PROJECT_NAME} LOLIcon.c blit.c font.c utils.c ) target_link_libraries(${PROJECT_NAME} k SceAppMgrForDriver_stub SceSysmemForDriver_stub SceProcessmgrForKernel_stub SceThreadmgrForDriver_stub SceIofilemgrForDriver_stub SceCpuForDriver_stub taihenForKernel_stub SceDebugForDriver_stub SceDisplayForDriver_stub SceModulemgrForKernel_stub SceCtrlForDriver_stub SceDebugForDriver_stub ScePowerForDriver_stub SceSysrootForKernel_stub SceProcessmgrForDriver_stub taihenModuleUtils_stub SceSysconForDriver_stub gcc -nostdlib ) vita_create_self(${PROJECT_NAME}.skprx ${PROJECT_NAME} UNSAFE CONFIG ${CMAKE_SOURCE_DIR}/LOLIcon.yml ) ================================================ FILE: LICENSE.md ================================================ MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: LOLIcon.c ================================================ // LOLIcon // by @dots_tb // Thanks to: // @CelesteBlue123 partner in crime, shh he doesn't know I added his namespace // Our testing team, especially: @Yoyogames28 castelo // @Cimmerian_Iter is also worth mentioning... // @frangar for original oclockvita // HENkaku wiki and its contributors (especially yifan lu for Pervasive RE) // Team Molecule (because everyone does) // Scorp for Button Swap // Please read the readme for more credits //MADE IN THE USA #include #include #include #include #include "blit.h" #include "utils.h" #define LEFT_LABEL_X CENTER(24) #define RIGHT_LABEL_X CENTER(0) #define printf ksceDebugPrintf static SceUID g_hooks[14]; static const char *ERRORS[5]={ #define NO_ERROR 0 "No error.", #define SAVE_ERROR 1 "There was a problem saving.", #define SAVE_GOOD 2 "Configuration saved.", #define LOAD_ERROR 3 "There was a problem loading.", #define LOAD_GOOD 4 "Configuration loaded." }; int error_code = NO_ERROR; #define CONFIG_PATH "ur0:LOLIcon/" typedef struct titleid_config { int mode; int hideErrors; int showBat; int buttonSwap; int showFPS; } titleid_config; static char config_path[PATH_MAX]; static titleid_config current_config; static char titleid[32]; uint32_t current_pid = 0, shell_pid = 0; int showMenu = 0, pos = 0, isReseting = 0, forceReset = 0, isPspEmu = 0, isShell = 1; int page = 0; int willexit = 0; static uint64_t ctrl_timestamp, msg_time = 0; uint32_t *clock_speed; unsigned int *clock_r1; unsigned int *clock_r2; #define TIMER_SECOND 1000000 // 1 second int fps; long curTime = 0, lateTime = 0, fps_count = 0; static int profile_default[] = {266, 166, 166, 111, 166}; static int profile_game[] = {444, 222, 222, 166, 222}; static int profile_max_performance[] = {444, 222, 222, 166, 333}; static int profile_holy_shit_performance[] = {500, 222, 222, 166, 333}; static int profile_max_battery[] = {111, 111, 111, 111, 111}; static int* profiles[5] = {profile_default,profile_game,profile_max_performance, profile_holy_shit_performance, profile_max_battery}; int (*_kscePowerGetGpuEs4ClockFrequency)(int*, int*); int (*_kscePowerSetGpuEs4ClockFrequency)(int, int); int (*_kscePowerGetGpuClockFrequency)(void); int (*_kscePowerSetGpuClockFrequency)(int); int (*_ksceKernelGetModuleInfo)(SceUID, SceUID, SceKernelModuleInfo *); int (*_ksceKernelGetModuleList)(SceUID pid, int flags1, int flags2, SceUID *modids, size_t *num); int (*_ksceKernelExitProcess)(int); #define ksceKernelExitProcess _ksceKernelExitProcess #define ksceKernelGetModuleInfo _ksceKernelGetModuleInfo #define ksceKernelGetModuleList _ksceKernelGetModuleList #define kscePowerGetGpuEs4ClockFrequency _kscePowerGetGpuEs4ClockFrequency #define kscePowerSetGpuEs4ClockFrequency _kscePowerSetGpuEs4ClockFrequency #define kscePowerGetGpuClockFrequency _kscePowerGetGpuClockFrequency #define kscePowerSetGpuClockFrequency _kscePowerSetGpuClockFrequency void reset_config() { memset(¤t_config, 0, sizeof(current_config)); } int load_config() { snprintf(config_path, sizeof(config_path), CONFIG_PATH"%s/config.bin", titleid); printf("loaded %s\n", config_path); if(ReadFile(config_path, ¤t_config, sizeof(current_config))<0) { snprintf(config_path, sizeof(config_path), CONFIG_PATH"default.bin"); if(ReadFile(config_path, ¤t_config, sizeof(current_config))<0) { reset_config(); return -1; } } return 0; } int save_config() { snprintf(config_path, sizeof(config_path), CONFIG_PATH"%s", titleid); ksceIoMkdir(config_path, 6); snprintf(config_path, sizeof(config_path), CONFIG_PATH"%s/config.bin", titleid); if(WriteFile(config_path, ¤t_config, sizeof(current_config))<0) return -1; return 0; } int save_default_config() { snprintf(config_path, sizeof(config_path), CONFIG_PATH"default.bin"); if(WriteFile(config_path, ¤t_config, sizeof(current_config))<0) return -1; return 0; } void refreshClocks() { isReseting = 1; kscePowerSetArmClockFrequency(profiles[current_config.mode][0]); kscePowerSetBusClockFrequency(profiles[current_config.mode][1]); kscePowerSetGpuEs4ClockFrequency(profiles[current_config.mode][2], profiles[current_config.mode][2]); kscePowerSetGpuXbarClockFrequency(profiles[current_config.mode][3]); kscePowerSetGpuClockFrequency(profiles[current_config.mode][4]); isReseting = 0; } void load_and_refresh() { error_code = LOAD_GOOD; if(load_config()<0) error_code = LOAD_ERROR; refreshClocks(); printf("forcing reset\n"); } // This function is from VitaJelly by DrakonPL and Rinne's framecounter void doFps() { fps_count++; if ((curTime - lateTime) > TIMER_SECOND) { lateTime = curTime; fps = (int)fps_count; fps_count = 0; } blit_stringf(20, 15, "%d", fps); } void drawErrors() { if(error_code > 0) { if(!curTime || (msg_time == 0 && !showMenu)) msg_time = (curTime = ksceKernelGetProcessTimeWideCore()) + TIMER_SECOND * 2; if((!current_config.hideErrors && curTime < msg_time) || showMenu) blit_stringf(20, 0, "%s : %d", ERRORS[error_code], error_code); } } int kscePowerSetClockFrequency_patched(tai_hook_ref_t ref_hook, int port, int freq){ int ret = 0; if(!isReseting) profile_default[port] = freq; if(port==0) { if(freq == 500) { ret = TAI_CONTINUE(int, ref_hook, 444); ksceKernelDelayThread(10000); *clock_speed = profiles[current_config.mode][port]; *clock_r1 = 0xF; *clock_r2 = 0x0; return ret; } } if(port==2) { ret = TAI_CONTINUE(int, ref_hook, profiles[current_config.mode][port], profiles[current_config.mode][port]); } else ret = TAI_CONTINUE(int, ref_hook, profiles[current_config.mode][port]); return ret; } static tai_hook_ref_t power_hook1; static int power_patched1(int freq) { return kscePowerSetClockFrequency_patched(power_hook1,0,freq); } static tai_hook_ref_t power_hook2; static int power_patched2(int freq) { return kscePowerSetClockFrequency_patched(power_hook2,1,freq); } static tai_hook_ref_t power_hook3; static int power_patched3(int freq) { return kscePowerSetClockFrequency_patched(power_hook3,2,freq); } static tai_hook_ref_t power_hook4; static int power_patched4(int freq) { return kscePowerSetClockFrequency_patched(power_hook4,3,freq); } int checkButtons(int port, tai_hook_ref_t ref_hook, SceCtrlData *ctrl, int count) { int ret = 0, state; if (ref_hook == 0) ret = 1; else { ret = TAI_CONTINUE(int, ref_hook, port, ctrl, count); if(!showMenu){ if (!isPspEmu && (ctrl->buttons & SCE_CTRL_UP)&&(ctrl->buttons & SCE_CTRL_SELECT)) ctrl_timestamp = showMenu = 1; if (current_config.buttonSwap && ((isShell && shell_pid == ksceKernelGetProcessId())||(!isShell && current_pid == ksceKernelGetProcessId())) && (ctrl->buttons & 0x6000) && ((ctrl->buttons & 0x6000) != 0x6000)) ctrl->buttons = ctrl->buttons ^ 0x6000; } else { unsigned int buttons = ctrl->buttons; ctrl->buttons = 0; if(ctrl->timeStamp > ctrl_timestamp + 300*1000) { if( ksceKernelGetProcessId() == shell_pid) { if (buttons & SCE_CTRL_LEFT){ switch(page) { case 1: if(current_config.mode > 0) { ctrl_timestamp = ctrl->timeStamp; current_config.mode--; refreshClocks(); } break; } } else if ((buttons & SCE_CTRL_RIGHT)){ switch(page) { case 1: if(current_config.mode <4) { ctrl_timestamp = ctrl->timeStamp; current_config.mode++; refreshClocks(); } break; } } else if((buttons & SCE_CTRL_UP) && pos > 0) { ctrl_timestamp = ctrl->timeStamp; pos--; } else if (buttons & SCE_CTRL_CIRCLE) page = pos = 0; else if (buttons & SCE_CTRL_CROSS) { switch(page) { case 0: switch(pos) { case 0: error_code = SAVE_GOOD; if(save_config() < 0) error_code = SAVE_ERROR; break; case 1: { error_code = SAVE_GOOD; if(save_default_config() < 0) error_code = SAVE_ERROR; } break; case 2: reset_config(); refreshClocks(); break; case 3: page = 1; pos = 0; break; case 4: page = 2; pos = 0; break; case 5: page = 3; pos = 0; break; case 6: willexit = current_pid; break; case 7: kscePowerRequestSuspend(); break; case 8: kscePowerRequestColdReset(); break; case 9: kscePowerRequestStandby(); break; } break; case 2: switch(pos) { case 0: current_config.showFPS = !current_config.showFPS; break; case 1: current_config.showBat = !current_config.showBat; break; case 2: current_config.hideErrors = !current_config.hideErrors; break; } break; case 3: switch(pos) { case 0: current_config.buttonSwap = !current_config.buttonSwap; break; } break; } ctrl_timestamp = ctrl->timeStamp; } else if (buttons & SCE_CTRL_DOWN) { pos++; ctrl_timestamp = ctrl->timeStamp; } } if((buttons & SCE_CTRL_SELECT)&&(buttons & SCE_CTRL_DOWN)) error_code = showMenu = 0; } } if(KERNEL_PID!=ksceKernelGetProcessId()&& shell_pid!=ksceKernelGetProcessId()) { if(forceReset == 1) { if(current_pid==ksceKernelGetProcessId()) { if(ksceKernelGetProcessTitleId(current_pid, titleid, sizeof(titleid))==0 && titleid[0] != 0) forceReset = 2; } else current_pid=ksceKernelGetProcessId(); } if(willexit == current_pid && current_pid == ksceKernelGetProcessId()) ksceKernelExitProcess(0); else willexit = 0; } else if(forceReset == 2) { isShell = 0; load_and_refresh(); msg_time = curTime = fps_count = lateTime = forceReset = 0; } } return ret; } static tai_hook_ref_t ref_hook1; static int keys_patched1(int port, SceCtrlData *ctrl, int count) { int ret, state; if(isPspEmu) { ENTER_SYSCALL(state); ret = TAI_CONTINUE(int, ref_hook1, port, ctrl, count); EXIT_SYSCALL(state); } else ret = checkButtons(port, ref_hook1, ctrl, count); return ret; } static tai_hook_ref_t ref_hook2; static int keys_patched2(int port, SceCtrlData *ctrl, int count) { return checkButtons(port, ref_hook2, ctrl, count); } static tai_hook_ref_t ref_hook3; static int keys_patched3(int port, SceCtrlData *ctrl, int count) { return checkButtons(port, ref_hook3, ctrl, count); } static tai_hook_ref_t ref_hook4; static int keys_patched4(int port, SceCtrlData *ctrl, int count) { return checkButtons(port, ref_hook4, ctrl, count); } static tai_hook_ref_t ref_hook5; static int keys_patched5(int port, SceCtrlData *ctrl, int count) { return checkButtons(port, ref_hook5, ctrl, count); } static tai_hook_ref_t ref_hook6; static int keys_patched6(int port, SceCtrlData *ctrl, int count) { return checkButtons(port, ref_hook6, ctrl, count); } static tai_hook_ref_t ref_hook7; static int keys_patched7(int port, SceCtrlData *ctrl, int count) { return checkButtons(port, ref_hook7, ctrl, count); } static tai_hook_ref_t ref_hook8; static int keys_patched8(int port, SceCtrlData *ctrl, int count) { return checkButtons(port, ref_hook8, ctrl, count); } void drawMenu() { int entries = 0; #define MENU_OPTION_F(TEXT,...)\ blit_set_color(0x00FFFFFF, (pos != entries) ? 0x00FF0000 : 0x0000FF00);\ blit_stringf(LEFT_LABEL_X, 120+16*entries++, (TEXT), __VA_ARGS__); #define MENU_OPTION(TEXT,...)\ blit_set_color(0x00FFFFFF, (pos != entries) ? 0x00FF0000 : 0x0000FF00);\ blit_stringf(LEFT_LABEL_X, 120+16*entries++, (TEXT)); blit_set_color(0x00FFFFFF, 0x00FF0000); switch(page) { case 0: blit_stringf(LEFT_LABEL_X, 88, "LOLIcon by @dots_tb"); MENU_OPTION_F("Save for %s", titleid); MENU_OPTION("Save as Default"); MENU_OPTION("Clear settings"); MENU_OPTION("Oclock Options"); MENU_OPTION("OSD Options"); MENU_OPTION("Ctrl Options"); MENU_OPTION("Exit Game"); MENU_OPTION("Suspend vita"); MENU_OPTION("Restart vita"); MENU_OPTION("Shutdown vita"); break; case 1: blit_stringf(LEFT_LABEL_X, 88, "ACTUAL OVERCLOCK"); blit_stringf(LEFT_LABEL_X, 120, "PROFILE "); switch(current_config.mode) { case 4: blit_stringf(RIGHT_LABEL_X, 120, "Max Batt."); break; case 3: blit_stringf(RIGHT_LABEL_X, 120, "Holy Shit."); break; case 2: blit_stringf(RIGHT_LABEL_X, 120, "Max Perf."); break; case 1: blit_stringf(RIGHT_LABEL_X, 120, "Game Def."); break; case 0: blit_stringf(RIGHT_LABEL_X, 120, "Default "); break; } blit_stringf(LEFT_LABEL_X, 136, "CPU CLOCK "); blit_stringf(RIGHT_LABEL_X, 136, "%-4d MHz - %d:%d", kscePowerGetArmClockFrequency(), *clock_r1, *clock_r2); blit_stringf(LEFT_LABEL_X, 152, "BUS CLOCK "); blit_stringf(RIGHT_LABEL_X, 152, "%-4d MHz", kscePowerGetBusClockFrequency()); blit_stringf(LEFT_LABEL_X, 168, "GPUes4CLK "); int r1, r2; kscePowerGetGpuEs4ClockFrequency(&r1, &r2); blit_stringf(RIGHT_LABEL_X, 168, "%-d MHz", r1); blit_stringf(LEFT_LABEL_X, 184, "XBAR CLK "); blit_stringf(RIGHT_LABEL_X, 184, "%-4d MHz", kscePowerGetGpuXbarClockFrequency()); blit_stringf(LEFT_LABEL_X, 200, "GPU CLOCK "); blit_stringf(RIGHT_LABEL_X, 200, "%-4d MHz", kscePowerGetGpuClockFrequency()); break; case 2: blit_stringf(LEFT_LABEL_X, 88, "OSD"); MENU_OPTION_F("Show FPS %d",current_config.showFPS); MENU_OPTION_F("Show Battery %d",current_config.showBat); MENU_OPTION_F("Hide Errors %d",current_config.hideErrors); break; case 3: blit_stringf(LEFT_LABEL_X, 88, "CONTROL"); MENU_OPTION_F("BUTTON SWAP %d",current_config.buttonSwap); break; } if(pos >= entries) pos = entries -1; } static tai_hook_ref_t ref_hook0; int _sceDisplaySetFrameBufInternalForDriver(int fb_id1, int fb_id2, const SceDisplayFrameBuf *pParam, int sync){ if(!isPspEmu && fb_id1 && pParam) { if(!shell_pid && fb_id2) {//3.68 fix if(ksceKernelGetProcessTitleId(ksceKernelGetProcessId(), titleid, sizeof(titleid))==0 && titleid[0] != 0) { if(strncmp("main",titleid, sizeof(titleid))==0) { shell_pid = ksceKernelGetProcessId(); load_and_refresh(); } } } SceDisplayFrameBuf kfb; memset(&kfb,0,sizeof(kfb)); memcpy(&kfb, pParam, sizeof(SceDisplayFrameBuf)); blit_set_frame_buf(&kfb); if(showMenu) drawMenu(); blit_set_color(0x0000FF00, 0xff000000); if((isShell && shell_pid == ksceKernelGetProcessId())||(!isShell && current_pid == ksceKernelGetProcessId())) { drawErrors(); curTime = ksceKernelGetProcessTimeWideCore(); if(current_config.showFPS) doFps(); if(current_config.showBat) blit_stringf(20, 30, "%02d\%", kscePowerGetBatteryLifePercent()); } } return TAI_CONTINUE(int, ref_hook0, fb_id1, fb_id2, pParam, sync); } int getFindModNameFromPID(int pid, char *mod_name, int size) { SceKernelModuleInfo sceinfo; sceinfo.size = sizeof(sceinfo); int ret; size_t count; SceUID modids[128]; if((ret = ksceKernelGetModuleList(pid, 0xff, 1, modids, &count)) == 0) { for(int i = 0; i < count; i++) { if((ret = ksceKernelGetModuleInfo(pid, modids[count - 1], &sceinfo))==0) { if(strncmp(mod_name, sceinfo.module_name, size)==0) return 1; } } return 0; } return ret; } static tai_hook_ref_t process_hook0; int SceProcEventForDriver_414CC813(int pid, int id, int r3, int r4, int r5, int r6){ SceKernelProcessInfo info; info.size = 0xE8; char module_name[28]; if(strncmp("main",titleid, sizeof(titleid))==0) { switch(id) { case 0x1://startup if(!shell_pid && ksceKernelGetProcessInfo(pid, &info) ==0 ) { if(info.ppid == KERNEL_PID) { shell_pid = pid; strncpy(titleid, "main", sizeof("main")); load_and_refresh(); break; } } case 0x5: isPspEmu = getFindModNameFromPID(pid, "adrenaline", sizeof("adrenaline"))||getFindModNameFromPID(pid, "ScePspemu", sizeof("ScePspemu")); current_pid = pid; if(!isPspEmu) forceReset = 1; else { ksceKernelGetProcessTitleId(pid, titleid, sizeof(titleid)); showMenu = isShell = current_config.mode = 0; } break; } } else { if((id==0x4 || id == 0x3)&& (current_pid==pid||isPspEmu)) { msg_time = curTime = fps_count = lateTime = 0; isShell = 1; strncpy(titleid, "main", sizeof("main")); isPspEmu =0; load_and_refresh(); } } return TAI_CONTINUE(int, process_hook0, pid, id, r3, r4, r5, r6); } void _start() __attribute__ ((weak, alias ("module_start"))); int module_start(SceSize argc, const void *args) { ksceIoMkdir(CONFIG_PATH,6); module_get_export_func(KERNEL_PID, "ScePower", 0x1590166F, 0x475BCC82, &_kscePowerGetGpuEs4ClockFrequency); module_get_export_func(KERNEL_PID, "ScePower", 0x1590166F, 0x264C24FC, &_kscePowerSetGpuEs4ClockFrequency); module_get_export_func(KERNEL_PID, "ScePower", 0x1590166F, 0x64641E6A, &_kscePowerGetGpuClockFrequency); module_get_export_func(KERNEL_PID, "ScePower", 0x1590166F, 0x621BD8FD , &_kscePowerSetGpuClockFrequency); tai_module_info_t tai_info; tai_info.size = sizeof(tai_module_info_t); clock_r1 = (unsigned int *)pa2va(0xE3103000); clock_r2 = (unsigned int *)pa2va(0xE3103004); taiGetModuleInfoForKernel(KERNEL_PID, "ScePower", &tai_info); module_get_offset(KERNEL_PID, tai_info.modid, 1, 0x4124 + 0xA4, (uintptr_t)&clock_speed); memset(&titleid, 0, sizeof(titleid)); strncpy(titleid, "main", sizeof(titleid)); reset_config(); current_config.mode = 3; refreshClocks(); if(module_get_export_func(KERNEL_PID, "SceKernelModulemgr", 0xC445FA63, 0xD269F915 , &_ksceKernelGetModuleInfo)) module_get_export_func(KERNEL_PID, "SceKernelModulemgr", 0x92C9FFC2, 0xDAA90093 , &_ksceKernelGetModuleInfo); if(module_get_export_func(KERNEL_PID, "SceKernelModulemgr", 0xC445FA63, 0x97CF7B4E , &_ksceKernelGetModuleList)) module_get_export_func(KERNEL_PID, "SceKernelModulemgr", 0x92C9FFC2, 0xB72C75A4 , &_ksceKernelGetModuleList); if(module_get_export_func(KERNEL_PID, "SceProcessmgr", 0x7A69DE86, 0x4CA7DC42 , &_ksceKernelExitProcess)) module_get_export_func(KERNEL_PID, "SceProcessmgr", 0xEB1F8EF7, 0x905621F9 , &_ksceKernelExitProcess); g_hooks[0] = taiHookFunctionExportForKernel(KERNEL_PID, &ref_hook0, "SceDisplay",0x9FED47AC,0x16466675, _sceDisplaySetFrameBufInternalForDriver); g_hooks[10] = taiHookFunctionExportForKernel(KERNEL_PID, &power_hook1, "ScePower", 0x1590166F, 0x74DB5AE5,power_patched1); // scePowerSetArmClockFrequency g_hooks[11] = taiHookFunctionExportForKernel(KERNEL_PID, &power_hook2, "ScePower", 0x1590166F, 0xB8D7B3FB, power_patched2); // scePowerSetBusClockFrequency g_hooks[12] = taiHookFunctionExportForKernel(KERNEL_PID, &power_hook3, "ScePower", 0x1590166F, 0x264C24FC, power_patched3); // scePowerSetGpuClockFrequency g_hooks[13] = taiHookFunctionExportForKernel(KERNEL_PID, &power_hook4, "ScePower", 0x1590166F, 0xA7739DBE, power_patched4); // scePowerSetGpuXbarClockFrequency taiGetModuleInfoForKernel(KERNEL_PID, "SceCtrl", &tai_info); g_hooks[1] = taiHookFunctionExportForKernel(KERNEL_PID, &ref_hook1, "SceCtrl", TAI_ANY_LIBRARY, 0xEA1D3A34, keys_patched1); // sceCtrlPeekBufferPositive g_hooks[2] = taiHookFunctionOffsetForKernel(KERNEL_PID, &ref_hook2, tai_info.modid, 0, 0x3EF8, 1, keys_patched2); // sceCtrlPeekBufferPositive2 g_hooks[3] = taiHookFunctionExportForKernel(KERNEL_PID, &ref_hook3, "SceCtrl", TAI_ANY_LIBRARY, 0x9B96A1AA, keys_patched3); // sceCtrlReadBufferPositive g_hooks[4] = taiHookFunctionOffsetForKernel(KERNEL_PID, &ref_hook4, tai_info.modid, 0, 0x4E14, 1, keys_patched4); // sceCtrlReadBufferPositiveExt2 g_hooks[5] = taiHookFunctionOffsetForKernel(KERNEL_PID, &ref_hook5, tai_info.modid, 0, 0x4B48, 1, keys_patched5); // sceCtrlPeekBufferPositiveExt2 g_hooks[6] = taiHookFunctionOffsetForKernel(KERNEL_PID, &ref_hook6, tai_info.modid, 0, 0x3928, 1, keys_patched6); // sceCtrlPeekBufferPositiveExt g_hooks[7] = taiHookFunctionOffsetForKernel(KERNEL_PID, &ref_hook7, tai_info.modid, 0, 0x449C, 1, keys_patched7); // sceCtrlReadBufferPositive2 g_hooks[8] = taiHookFunctionOffsetForKernel(KERNEL_PID, &ref_hook8, tai_info.modid, 0, 0x3BCC, 1, keys_patched8); // sceCtrlReadBufferPositiveExt g_hooks[9] = taiHookFunctionImportForKernel(KERNEL_PID, &process_hook0, "SceProcessmgr", TAI_ANY_LIBRARY, 0x414CC813, SceProcEventForDriver_414CC813); return SCE_KERNEL_START_SUCCESS; } int module_stop(SceSize argc, const void *args) { // free hooks that didn't fail if (g_hooks[0] >= 0) taiHookReleaseForKernel(g_hooks[0], ref_hook0); if (g_hooks[1] >= 0) taiHookReleaseForKernel(g_hooks[1], ref_hook1); if (g_hooks[2] >= 0) taiHookReleaseForKernel(g_hooks[2], ref_hook2); if (g_hooks[3] >= 0) taiHookReleaseForKernel(g_hooks[3], ref_hook3); if (g_hooks[4] >= 0) taiHookReleaseForKernel(g_hooks[4], ref_hook4); if (g_hooks[5] >= 0) taiHookReleaseForKernel(g_hooks[5], ref_hook5); if (g_hooks[6] >= 0) taiHookReleaseForKernel(g_hooks[6], ref_hook6); if (g_hooks[7] >= 0) taiHookReleaseForKernel(g_hooks[7], ref_hook7); if (g_hooks[8] >= 0) taiHookReleaseForKernel(g_hooks[8], ref_hook8); if (g_hooks[9] >= 0) taiHookReleaseForKernel(g_hooks[9], process_hook0); if (g_hooks[10] >= 0) taiHookReleaseForKernel(g_hooks[10], power_hook1); if (g_hooks[11] >= 0) taiHookReleaseForKernel(g_hooks[11], power_hook2); if (g_hooks[12] >= 0) taiHookReleaseForKernel(g_hooks[12], power_hook3); if (g_hooks[13] >= 0) taiHookReleaseForKernel(g_hooks[13], power_hook4); return SCE_KERNEL_STOP_SUCCESS; } ================================================ FILE: LOLIcon.yml ================================================ LOLIcon: attributes: 0 version: major: 1 minor: 2 main: start: module_start stop: module_stop ================================================ FILE: README.md ================================================ # LOLIcon ## (LOLIconsole Offends Little Idiots Console) by @dots_tb A small onscreen console that runs from the kernel level. So it probably won't crash games as many certain user plugins do. It also removes dependency of kuio. (Also some advice FOR DEVS, use ioPlus which allows you to use normal sceIo functions in user plugins ). Oh yeah, and it adds 500mhz (aka real overclocking). Enjoy...The kernel level allows for more options in regards to overclocking. ### (The menu may lag, but it will go fullspeed when you exit). ### WARNING: THIS IS OBVIOUSLY EXPERIMENTAL AND CARRIES THE DANGERS OF OVERCLOCKING (FOR REAL OVERCLOCKING). Please proceed with caution. ### Further note: Yifan Lu has labeled this mode as 494mhz, but seeing how the rest of the pervasive values correspond to a value slightly off, Celeste and I have decided to label it 500mhz instead. ### PS: Userland apps will report false speeds, this is LIBEL and FAKE NEWS. We have provided an indicator for the direct registers that control the ARM clock speeds on the overclock page to compare to the wikipage located below. Other features: Quickly exit game, maintains configuration for each process(including shell)*, FPS counter, x and o button swap, allows for proper default game clocking, you can also overclock shell's boot up. There might be more... and more to come. *Suspending to shell and resuming game will LOAD A CONFIGURATION (DEFAULT OR SAVED). You will lose your changes when changing a task (including suspending to shell) unless you save. Video courtesy of @Yoyogames28 : https://www.youtube.com/watch?v=mNPscIVubOY Video courtesy of castelo: https://www.youtube.com/watch?v=ATiv301_eOA Installation -------------------------------------------------------------------------------- Put "lolicon.skprx" in 'tai' folder in the root of your Vita. (Or just use autoplugin, because I'm sure a ver that supports this is out already) ```text *KERNEL ur0:tai/lolicon.skprx ``` After that just reboot and press SELECT + UP to enable menu. Press SELECT + DOWN to close menu. Thanks to: https://wiki.henkaku.xyz/vita/Pervasive#ARM_Clocks https://github.com/frangarcj/oclockvita https://github.com/Scorpeg https://github.com/BeatPlay/BetterAmphetaminPlugin https://github.com/DrakonPL/VitaJelly https://github.com/Rinnegatamante/Framecounter/blob/master/main.c https://github.com/joel16/PSV-VSH-Menu/tree/master/source ## Major Thanks: @CelesteBlue123 - Help. TREMENDOUS and loyal DEV. Only the BEST! I recommend you retain the services of this man. HE DOES NOT CRACK! @nyassen (sys) - some guy @SilicaVita - this mysterious person helped with the name, not afraid to keep spamming that he did. ## PR and special testing: @Yoyogames28 - Discount DF and cute boi castelo - Great tester, thanks to @Cimmerian_Iter for letters of rec. @froid_san 3.68 tester... I forgot to test on 3.68. Sad! ## Testing team: @juliosueiras GrandMaster @nkekev @coburn64 Orphen07 CrossFusionX ================================================ FILE: blit.c ================================================ /* PSP VSH 24bpp text bliter */ #include #include #include #include "blit.h" #define ALPHA_BLEND 1 extern unsigned char msx[]; ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// static int pwidth, pheight, bufferwidth, pixelformat; static unsigned int* vram32; static uint32_t fcolor = 0x00ffffff; static uint32_t bcolor = 0xff000000; #if ALPHA_BLEND ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// static uint32_t adjust_alpha(uint32_t col) { uint32_t alpha = col>>24; uint8_t mul; uint32_t c1,c2; if(alpha==0) return col; if(alpha==0xff) return col; c1 = col & 0x00ff00ff; c2 = col & 0x0000ff00; mul = (uint8_t)(255-alpha); c1 = ((c1*mul)>>8)&0x00ff00ff; c2 = ((c2*mul)>>8)&0x0000ff00; return (alpha<<24)|c1|c2; } #endif #define printf ksceDebugPrintf ///////////////////////////////////////////////////////////////////////////// // blit text ///////////////////////////////////////////////////////////////////////////// void blit_set_color(int fg_col,int bg_col) { fcolor = fg_col; bcolor = bg_col; } ///////////////////////////////////////////////////////////////////////////// // blit text ///////////////////////////////////////////////////////////////////////////// int blit_string(int sx,int sy,const char *msg) { int x,y,p; int offset; char code; unsigned char font; uint32_t fg_col,bg_col; #if ALPHA_BLEND uint32_t col,c1,c2; uint32_t alpha; fg_col = adjust_alpha(fcolor); bg_col = adjust_alpha(bcolor); #else fg_col = fcolor; bg_col = bcolor; #endif //Kprintf("MODE %d WIDTH %d\n",pixelformat,bufferwidth); if( (bufferwidth==0) || (pixelformat!=0)) return -1; for(x=0;msg[x] && x<(pwidth/16);x++) { code = msg[x] & 0x7f; // 7bit ANK for(y=0;y<8;y++) { offset = (sy+(y*2))*bufferwidth + sx+x*16; font = y>=7 ? 0x00 : msx[ code*8 + y ]; for(p=0;p<8;p++) { #if ALPHA_BLEND col = (font & 0x80) ? fg_col : bg_col; alpha = col>>24; if(alpha==0) { ksceKernelMemcpyKernelToUser((uintptr_t)(&vram32[offset]), &col, sizeof(col)); ksceKernelMemcpyKernelToUser((uintptr_t)(&vram32[offset + 1]), &col, sizeof(col)); ksceKernelMemcpyKernelToUser((uintptr_t)(&vram32[offset + bufferwidth]), &col, sizeof(col)); ksceKernelMemcpyKernelToUser((uintptr_t)(&vram32[offset + bufferwidth + 1]), &col, sizeof(col)); } else if(alpha!=0xff) { ksceKernelMemcpyUserToKernel(&c2, (uintptr_t)(vram32[offset]), sizeof(unsigned int)); c1 = c2 & 0x00ff00ff; c2 = c2 & 0x0000ff00; c1 = ((c1*alpha)>>8)&0x00ff00ff; c2 = ((c2*alpha)>>8)&0x0000ff00; uint32_t color = (col&0xffffff) + c1 + c2; ksceKernelMemcpyKernelToUser((uintptr_t)(vram32 + offset), &color, sizeof(uint32_t)); ksceKernelMemcpyKernelToUser((uintptr_t)(vram32 + offset + 1), &color, sizeof(uint32_t)); ksceKernelMemcpyKernelToUser((uintptr_t)(vram32 + offset + bufferwidth), &color, sizeof(uint32_t)); ksceKernelMemcpyKernelToUser((uintptr_t)(vram32 + offset + bufferwidth + 1), &color, sizeof(uint32_t)); } #else uint32_t color = (font & 0x80) ? fg_col : bg_col; ksceKernelMemcpyKernelToUser((uintptr_t)(vram32 + offset + 1), &color, sizeof(uint32_t)); ksceKernelMemcpyKernelToUser((uintptr_t)(vram32 + offset + bufferwidth), &color, sizeof(uint32_t)); ksceKernelMemcpyKernelToUser((uintptr_t)(vram32 + offset + bufferwidth + 1), &color, sizeof(uint32_t)); #endif font <<= 1; offset+=2; } } } return x; } int blit_string_ctr(int sy,const char *msg) { int sx = (960 / 2) - (strlen(msg) * (16 / 2)); return blit_string(sx,sy,msg); } int blit_stringf(int sx, int sy, const char *msg, ...) { va_list list; char string[512]; va_start(list, msg); vsnprintf(string, 512, msg, list); va_end(list); return blit_string(sx, sy, string); } int blit_set_frame_buf(const SceDisplayFrameBuf *param) { pwidth = param->width; pheight = param->height; vram32 = param->base; bufferwidth = param->pitch; pixelformat = param->pixelformat; if( (bufferwidth==0) || (pixelformat!=0)) return -1; fcolor = 0x00ffffff; bcolor = 0xff000000; return 0; } ================================================ FILE: blit.h ================================================ #ifndef __BLIT_H__ #define __BLIT_H__ #include #define COLOR_CYAN 0x00ffff00 #define COLOR_MAGENDA 0x00ff00ff #define COLOR_YELLOW 0x0000ffff #define RGB(R,G,B) (((B)<<16)|((G)<<8)|(R)) #define RGBT(R,G,B,T) (((T)<<24)|((B)<<16)|((G)<<8)|(R)) #define CENTER(num) ((960/2)-(num*(16/2))) void blit_set_color(int fg_col,int bg_col); int blit_string(int sx,int sy,const char *msg); int blit_string_ctr(int sy,const char *msg); int blit_stringf(int sx, int sy, const char *msg, ...); int blit_set_frame_buf(const SceDisplayFrameBuf *param); #endif ================================================ FILE: font.c ================================================ /* * PSP Software Development Kit - http://www.pspdev.org * ----------------------------------------------------------------------- * Licensed under the BSD license, see LICENSE in PSPSDK root for details. * * font.c - Debug Font. * * Copyright (c) 2005 Marcus R. Brown * Copyright (c) 2005 James Forshaw * Copyright (c) 2005 John Kelley * * $Id: font.c 339 2005-06-27 02:24:25Z warren $ */ #include const uint8_t msx[]= "\x00\x00\x00\x00\x00\x00\x00\x00\x3c\x42\xa5\x81\xa5\x99\x42\x3c" "\x3c\x7e\xdb\xff\xff\xdb\x66\x3c\x6c\xfe\xfe\xfe\x7c\x38\x10\x00" "\x10\x38\x7c\xfe\x7c\x38\x10\x00\x10\x38\x54\xfe\x54\x10\x38\x00" "\x10\x38\x7c\xfe\xfe\x10\x38\x00\x00\x00\x00\x30\x30\x00\x00\x00" "\xff\xff\xff\xe7\xe7\xff\xff\xff\x38\x44\x82\x82\x82\x44\x38\x00" "\xc7\xbb\x7d\x7d\x7d\xbb\xc7\xff\x0f\x03\x05\x79\x88\x88\x88\x70" "\x38\x44\x44\x44\x38\x10\x7c\x10\x30\x28\x24\x24\x28\x20\xe0\xc0" "\x3c\x24\x3c\x24\x24\xe4\xdc\x18\x10\x54\x38\xee\x38\x54\x10\x00" "\x10\x10\x10\x7c\x10\x10\x10\x10\x10\x10\x10\xff\x00\x00\x00\x00" "\x00\x00\x00\xff\x10\x10\x10\x10\x10\x10\x10\xf0\x10\x10\x10\x10" "\x10\x10\x10\x1f\x10\x10\x10\x10\x10\x10\x10\xff\x10\x10\x10\x10" "\x10\x10\x10\x10\x10\x10\x10\x10\x00\x00\x00\xff\x00\x00\x00\x00" "\x00\x00\x00\x1f\x10\x10\x10\x10\x00\x00\x00\xf0\x10\x10\x10\x10" "\x10\x10\x10\x1f\x00\x00\x00\x00\x10\x10\x10\xf0\x00\x00\x00\x00" "\x81\x42\x24\x18\x18\x24\x42\x81\x01\x02\x04\x08\x10\x20\x40\x80" "\x80\x40\x20\x10\x08\x04\x02\x01\x00\x10\x10\xff\x10\x10\x00\x00" "\x00\x00\x00\x00\x00\x00\x00\x00\x20\x20\x20\x20\x00\x00\x20\x00" "\x50\x50\x50\x00\x00\x00\x00\x00\x50\x50\xf8\x50\xf8\x50\x50\x00" "\x20\x78\xa0\x70\x28\xf0\x20\x00\xc0\xc8\x10\x20\x40\x98\x18\x00" "\x40\xa0\x40\xa8\x90\x98\x60\x00\x10\x20\x40\x00\x00\x00\x00\x00" "\x10\x20\x40\x40\x40\x20\x10\x00\x40\x20\x10\x10\x10\x20\x40\x00" "\x20\xa8\x70\x20\x70\xa8\x20\x00\x00\x20\x20\xf8\x20\x20\x00\x00" "\x00\x00\x00\x00\x00\x20\x20\x40\x00\x00\x00\x78\x00\x00\x00\x00" "\x00\x00\x00\x00\x00\x60\x60\x00\x00\x00\x08\x10\x20\x40\x80\x00" "\x70\x88\x98\xa8\xc8\x88\x70\x00\x20\x60\xa0\x20\x20\x20\xf8\x00" "\x70\x88\x08\x10\x60\x80\xf8\x00\x70\x88\x08\x30\x08\x88\x70\x00" "\x10\x30\x50\x90\xf8\x10\x10\x00\xf8\x80\xe0\x10\x08\x10\xe0\x00" "\x30\x40\x80\xf0\x88\x88\x70\x00\xf8\x88\x10\x20\x20\x20\x20\x00" "\x70\x88\x88\x70\x88\x88\x70\x00\x70\x88\x88\x78\x08\x10\x60\x00" "\x00\x00\x20\x00\x00\x20\x00\x00\x00\x00\x20\x00\x00\x20\x20\x40" "\x18\x30\x60\xc0\x60\x30\x18\x00\x00\x00\xf8\x00\xf8\x00\x00\x00" "\xc0\x60\x30\x18\x30\x60\xc0\x00\x70\x88\x08\x10\x20\x00\x20\x00" "\x70\x88\x08\x68\xa8\xa8\x70\x00\x20\x50\x88\x88\xf8\x88\x88\x00" "\xf0\x48\x48\x70\x48\x48\xf0\x00\x30\x48\x80\x80\x80\x48\x30\x00" "\xe0\x50\x48\x48\x48\x50\xe0\x00\xf8\x80\x80\xf0\x80\x80\xf8\x00" "\xf8\x80\x80\xf0\x80\x80\x80\x00\x70\x88\x80\xb8\x88\x88\x70\x00" "\x88\x88\x88\xf8\x88\x88\x88\x00\x70\x20\x20\x20\x20\x20\x70\x00" "\x38\x10\x10\x10\x90\x90\x60\x00\x88\x90\xa0\xc0\xa0\x90\x88\x00" "\x80\x80\x80\x80\x80\x80\xf8\x00\x88\xd8\xa8\xa8\x88\x88\x88\x00" "\x88\xc8\xc8\xa8\x98\x98\x88\x00\x70\x88\x88\x88\x88\x88\x70\x00" "\xf0\x88\x88\xf0\x80\x80\x80\x00\x70\x88\x88\x88\xa8\x90\x68\x00" "\xf0\x88\x88\xf0\xa0\x90\x88\x00\x70\x88\x80\x70\x08\x88\x70\x00" "\xf8\x20\x20\x20\x20\x20\x20\x00\x88\x88\x88\x88\x88\x88\x70\x00" "\x88\x88\x88\x88\x50\x50\x20\x00\x88\x88\x88\xa8\xa8\xd8\x88\x00" "\x88\x88\x50\x20\x50\x88\x88\x00\x88\x88\x88\x70\x20\x20\x20\x00" "\xf8\x08\x10\x20\x40\x80\xf8\x00\x70\x40\x40\x40\x40\x40\x70\x00" "\x00\x00\x80\x40\x20\x10\x08\x00\x70\x10\x10\x10\x10\x10\x70\x00" "\x20\x50\x88\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf8\x00" "\x40\x20\x10\x00\x00\x00\x00\x00\x00\x00\x70\x08\x78\x88\x78\x00" "\x80\x80\xb0\xc8\x88\xc8\xb0\x00\x00\x00\x70\x88\x80\x88\x70\x00" "\x08\x08\x68\x98\x88\x98\x68\x00\x00\x00\x70\x88\xf8\x80\x70\x00" "\x10\x28\x20\xf8\x20\x20\x20\x00\x00\x00\x68\x98\x98\x68\x08\x70" "\x80\x80\xf0\x88\x88\x88\x88\x00\x20\x00\x60\x20\x20\x20\x70\x00" "\x10\x00\x30\x10\x10\x10\x90\x60\x40\x40\x48\x50\x60\x50\x48\x00" "\x60\x20\x20\x20\x20\x20\x70\x00\x00\x00\xd0\xa8\xa8\xa8\xa8\x00" "\x00\x00\xb0\xc8\x88\x88\x88\x00\x00\x00\x70\x88\x88\x88\x70\x00" "\x00\x00\xb0\xc8\xc8\xb0\x80\x80\x00\x00\x68\x98\x98\x68\x08\x08" "\x00\x00\xb0\xc8\x80\x80\x80\x00\x00\x00\x78\x80\xf0\x08\xf0\x00" "\x40\x40\xf0\x40\x40\x48\x30\x00\x00\x00\x90\x90\x90\x90\x68\x00" "\x00\x00\x88\x88\x88\x50\x20\x00\x00\x00\x88\xa8\xa8\xa8\x50\x00" "\x00\x00\x88\x50\x20\x50\x88\x00\x00\x00\x88\x88\x98\x68\x08\x70" "\x00\x00\xf8\x10\x20\x40\xf8\x00\x18\x20\x20\x40\x20\x20\x18\x00" "\x20\x20\x20\x00\x20\x20\x20\x00\xc0\x20\x20\x10\x20\x20\xc0\x00" "\x40\xa8\x10\x00\x00\x00\x00\x00\x00\x00\x20\x50\xf8\x00\x00\x00" "\x70\x88\x80\x80\x88\x70\x20\x60\x90\x00\x00\x90\x90\x90\x68\x00" "\x10\x20\x70\x88\xf8\x80\x70\x00\x20\x50\x70\x08\x78\x88\x78\x00" "\x48\x00\x70\x08\x78\x88\x78\x00\x20\x10\x70\x08\x78\x88\x78\x00" "\x20\x00\x70\x08\x78\x88\x78\x00\x00\x70\x80\x80\x80\x70\x10\x60" "\x20\x50\x70\x88\xf8\x80\x70\x00\x50\x00\x70\x88\xf8\x80\x70\x00" "\x20\x10\x70\x88\xf8\x80\x70\x00\x50\x00\x00\x60\x20\x20\x70\x00" "\x20\x50\x00\x60\x20\x20\x70\x00\x40\x20\x00\x60\x20\x20\x70\x00" "\x50\x00\x20\x50\x88\xf8\x88\x00\x20\x00\x20\x50\x88\xf8\x88\x00" "\x10\x20\xf8\x80\xf0\x80\xf8\x00\x00\x00\x6c\x12\x7e\x90\x6e\x00" "\x3e\x50\x90\x9c\xf0\x90\x9e\x00\x60\x90\x00\x60\x90\x90\x60\x00" "\x90\x00\x00\x60\x90\x90\x60\x00\x40\x20\x00\x60\x90\x90\x60\x00" "\x40\xa0\x00\xa0\xa0\xa0\x50\x00\x40\x20\x00\xa0\xa0\xa0\x50\x00" "\x90\x00\x90\x90\xb0\x50\x10\xe0\x50\x00\x70\x88\x88\x88\x70\x00" "\x50\x00\x88\x88\x88\x88\x70\x00\x20\x20\x78\x80\x80\x78\x20\x20" "\x18\x24\x20\xf8\x20\xe2\x5c\x00\x88\x50\x20\xf8\x20\xf8\x20\x00" "\xc0\xa0\xa0\xc8\x9c\x88\x88\x8c\x18\x20\x20\xf8\x20\x20\x20\x40" "\x10\x20\x70\x08\x78\x88\x78\x00\x10\x20\x00\x60\x20\x20\x70\x00" "\x20\x40\x00\x60\x90\x90\x60\x00\x20\x40\x00\x90\x90\x90\x68\x00" "\x50\xa0\x00\xa0\xd0\x90\x90\x00\x28\x50\x00\xc8\xa8\x98\x88\x00" "\x00\x70\x08\x78\x88\x78\x00\xf8\x00\x60\x90\x90\x90\x60\x00\xf0" "\x20\x00\x20\x40\x80\x88\x70\x00\x00\x00\x00\xf8\x80\x80\x00\x00" "\x00\x00\x00\xf8\x08\x08\x00\x00\x84\x88\x90\xa8\x54\x84\x08\x1c" "\x84\x88\x90\xa8\x58\xa8\x3c\x08\x20\x00\x00\x20\x20\x20\x20\x00" "\x00\x00\x24\x48\x90\x48\x24\x00\x00\x00\x90\x48\x24\x48\x90\x00" "\x28\x50\x20\x50\x88\xf8\x88\x00\x28\x50\x70\x08\x78\x88\x78\x00" "\x28\x50\x00\x70\x20\x20\x70\x00\x28\x50\x00\x20\x20\x20\x70\x00" "\x28\x50\x00\x70\x88\x88\x70\x00\x50\xa0\x00\x60\x90\x90\x60\x00" "\x28\x50\x00\x88\x88\x88\x70\x00\x50\xa0\x00\xa0\xa0\xa0\x50\x00" "\xfc\x48\x48\x48\xe8\x08\x50\x20\x00\x50\x00\x50\x50\x50\x10\x20" "\xc0\x44\xc8\x54\xec\x54\x9e\x04\x10\xa8\x40\x00\x00\x00\x00\x00" "\x00\x20\x50\x88\x50\x20\x00\x00\x88\x10\x20\x40\x80\x28\x00\x00" "\x7c\xa8\xa8\x68\x28\x28\x28\x00\x38\x40\x30\x48\x48\x30\x08\x70" "\x00\x00\x00\x00\x00\x00\xff\xff\xf0\xf0\xf0\xf0\x0f\x0f\x0f\x0f" "\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00" "\x00\x00\x00\x3c\x3c\x00\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00" "\xc0\xc0\xc0\xc0\xc0\xc0\xc0\xc0\x0f\x0f\x0f\x0f\xf0\xf0\xf0\xf0" "\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\x03\x03\x03\x03\x03\x03\x03\x03" "\x3f\x3f\x3f\x3f\x3f\x3f\x3f\x3f\x11\x22\x44\x88\x11\x22\x44\x88" "\x88\x44\x22\x11\x88\x44\x22\x11\xfe\x7c\x38\x10\x00\x00\x00\x00" "\x00\x00\x00\x00\x10\x38\x7c\xfe\x80\xc0\xe0\xf0\xe0\xc0\x80\x00" "\x01\x03\x07\x0f\x07\x03\x01\x00\xff\x7e\x3c\x18\x18\x3c\x7e\xff" "\x81\xc3\xe7\xff\xff\xe7\xc3\x81\xf0\xf0\xf0\xf0\x00\x00\x00\x00" "\x00\x00\x00\x00\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x00\x00\x00\x00" "\x00\x00\x00\x00\xf0\xf0\xf0\xf0\x33\x33\xcc\xcc\x33\x33\xcc\xcc" "\x00\x20\x20\x50\x50\x88\xf8\x00\x20\x20\x70\x20\x70\x20\x20\x00" "\x00\x00\x00\x50\x88\xa8\x50\x00\xff\xff\xff\xff\xff\xff\xff\xff" "\x00\x00\x00\x00\xff\xff\xff\xff\xf0\xf0\xf0\xf0\xf0\xf0\xf0\xf0" "\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\xff\xff\xff\xff\x00\x00\x00\x00" "\x00\x00\x68\x90\x90\x90\x68\x00\x30\x48\x48\x70\x48\x48\x70\xc0" "\xf8\x88\x80\x80\x80\x80\x80\x00\xf8\x50\x50\x50\x50\x50\x98\x00" "\xf8\x88\x40\x20\x40\x88\xf8\x00\x00\x00\x78\x90\x90\x90\x60\x00" "\x00\x50\x50\x50\x50\x68\x80\x80\x00\x50\xa0\x20\x20\x20\x20\x00" "\xf8\x20\x70\xa8\xa8\x70\x20\xf8\x20\x50\x88\xf8\x88\x50\x20\x00" "\x70\x88\x88\x88\x50\x50\xd8\x00\x30\x40\x40\x20\x50\x50\x50\x20" "\x00\x00\x00\x50\xa8\xa8\x50\x00\x08\x70\xa8\xa8\xa8\x70\x80\x00" "\x38\x40\x80\xf8\x80\x40\x38\x00\x70\x88\x88\x88\x88\x88\x88\x00" "\x00\xf8\x00\xf8\x00\xf8\x00\x00\x20\x20\xf8\x20\x20\x00\xf8\x00" "\xc0\x30\x08\x30\xc0\x00\xf8\x00\x18\x60\x80\x60\x18\x00\xf8\x00" "\x10\x28\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\xa0\x40" "\x00\x20\x00\xf8\x00\x20\x00\x00\x00\x50\xa0\x00\x50\xa0\x00\x00" "\x00\x18\x24\x24\x18\x00\x00\x00\x00\x30\x78\x78\x30\x00\x00\x00" "\x00\x00\x00\x00\x30\x00\x00\x00\x3e\x20\x20\x20\xa0\x60\x20\x00" "\xa0\x50\x50\x50\x00\x00\x00\x00\x40\xa0\x20\x40\xe0\x00\x00\x00" "\x00\x38\x38\x38\x38\x38\x38\x00\x00\x00\x00\x00\x00\x00\x00"; ================================================ FILE: utils.c ================================================ #include #include #include int ReadFile(const char *file, void *buf, int size) { SceUID fd = ksceIoOpen(file, SCE_O_RDONLY, 0); if (fd < 0) return fd; int read = ksceIoRead(fd, buf, size); ksceIoClose(fd); return read; } int WriteFile(const char *file, void *buf, int size) { SceUID fd = ksceIoOpen(file, SCE_O_WRONLY | SCE_O_CREAT | SCE_O_TRUNC, 0777); if (fd < 0) return fd; int written = ksceIoWrite(fd, buf, size); ksceIoClose(fd); return written; } unsigned int pa2va(unsigned int pa) { unsigned int va; unsigned int vaddr; unsigned int paddr; unsigned int i; va = 0; for (i = 0; i < 0x100000; i++) { vaddr = i << 12; __asm__("mcr p15,0,%1,c7,c8,0\n\t" "mrc p15,0,%0,c7,c4,0\n\t" : "=r" (paddr) : "r" (vaddr)); if ((pa & 0xFFFFF000) == (paddr & 0xFFFFF000)) { va = vaddr + (pa & 0xFFF); break; } } return va; } ================================================ FILE: utils.h ================================================ unsigned int pa2va(unsigned int pa); int WriteFile(const char *file, void *buf, int size); int ReadFile(const char *file, void *buf, int size);