SDL_bool SDL_GetPowerInfo_PSP(SDL_PowerState * state, int *seconds, int *percent) { int battery = scePowerIsBatteryExist(); int plugged = scePowerIsPowerOnline(); int charging = scePowerIsBatteryCharging(); *state = SDL_POWERSTATE_UNKNOWN; *seconds = -1; *percent = -1; if (!battery) { *state = SDL_POWERSTATE_NO_BATTERY; *seconds = -1; *percent = -1; } else if (charging) { *state = SDL_POWERSTATE_CHARGING; *percent = scePowerGetBatteryLifePercent(); *seconds = scePowerGetBatteryLifeTime()*60; } else if (plugged) { *state = SDL_POWERSTATE_CHARGED; *percent = scePowerGetBatteryLifePercent(); *seconds = scePowerGetBatteryLifeTime()*60; } else { *state = SDL_POWERSTATE_ON_BATTERY; *percent = scePowerGetBatteryLifePercent(); *seconds = scePowerGetBatteryLifeTime()*60; } return SDL_TRUE; /* always the definitive answer on PSP. */ }
void CSystem::GetBattery() { if (scePowerGetBatteryLifePercent() <= 100) { batt.Y[1] = 395; batt.Y[0] = 384; } if (scePowerGetBatteryLifePercent() <= 80) { batt.Y[1] = 413; batt.Y[0] = 402; } if (scePowerGetBatteryLifePercent() <= 50) { batt.Y[1] = 431; batt.Y[0] = 420; } if (scePowerGetBatteryLifePercent() <= 30) { batt.Y[1] = 448; batt.Y[0] = 437; } if (scePowerGetBatteryLifePercent() <= 10) { batt.Y[1] = 466; batt.Y[0] = 455; } }
static enum frontend_powerstate frontend_psp_get_powerstate(int *seconds, int *percent) { enum frontend_powerstate ret = FRONTEND_POWERSTATE_NONE; #ifndef VITA int battery = scePowerIsBatteryExist(); #endif int plugged = scePowerIsPowerOnline(); int charging = scePowerIsBatteryCharging(); *percent = scePowerGetBatteryLifePercent(); *seconds = scePowerGetBatteryLifeTime() * 60; #ifndef VITA if (!battery) { ret = FRONTEND_POWERSTATE_NO_SOURCE; *seconds = -1; *percent = -1; } else #endif if (charging) ret = FRONTEND_POWERSTATE_CHARGING; else if (plugged) ret = FRONTEND_POWERSTATE_CHARGED; else ret = FRONTEND_POWERSTATE_ON_POWER_SOURCE; return ret; }
char * psp_get_battery_string() { strcpy(loc_batt_str, "none"); # ifndef LINUX_MODE char tmp[128]; int ret; if (scePowerIsBatteryExist()) { ret = scePowerGetBatteryLifePercent(); if (ret >= 0) { sprintf(tmp, "%d", ret); strcpy(loc_batt_str,tmp); strcat(loc_batt_str,"%"); if(!scePowerIsPowerOnline()){ if((ret=scePowerGetBatteryLifeTime()) >= 0){ sprintf(tmp, " %dh", ret/60); strcat(loc_batt_str,tmp); sprintf(tmp, "%d", (ret%60) + 100); strcat(loc_batt_str,tmp+1); } } } } # endif return loc_batt_str; }
/* ============== SCR_DrawBAT Crow_bar ============== */ void SCR_DrawBAT (void) { extern cvar_t show_bat; int x, y, i; char stA[80],stB[80]; if (!show_bat.value) return; if (!scePowerIsBatteryExist()) { // Don't report anything. return; } const int level = scePowerGetBatteryLifePercent(); const bool charging = scePowerGetBatteryChargingStatus(); // Is the level not sensible? if ((level < 0) || (level > 100)) { // Hopefully it will be sensible soon. return; } sprintf(stA, "Battery %d%%\n",level); sprintf(stB, "Battery %d%% (charging)\n",level); if(!charging) x = vid.width - strlen(stA) * 16 - 70; else x = vid.width - strlen(stB) * 16 - 70; y = 2 ; //vid.height - (sb_lines * (vid.height/240) )- 16; if(show_bat.value == 2) { if(!charging) Draw_String(x, y, stA); else Draw_String(x, y, stB); } else { if(charging) { Draw_Fill (240, y, level, 5, 12+((int)(realtime*8)&120)); } else Draw_Fill (240, y, level, 5, level); } }
static JSBool xgg_system_power_propop_percentremaining_get(JSContext *pcxa, JSObject *pobja, jsval id, jsval *vp) { #ifdef XTPF_Linux *vp = INT_TO_JSVAL(33); #endif //XTPF_Linux #ifdef XTPF_PSP *vp = INT_TO_JSVAL(scePowerGetBatteryLifePercent()); #endif //XTPF_PSP return JS_TRUE; }
int psp_is_low_battery() { int ret = 0; # ifndef LINUX_MODE if (scePowerIsBatteryExist()) { ret = scePowerGetBatteryLifePercent(); if ((ret > 0) && (ret < 4)) return 1; } # endif return 0; }
static JSBool xgg_system_power_propop_timetotal_get(JSContext *pcxa, JSObject *pobja, jsval id, jsval *vp) { #ifdef XTPF_Linux *vp = INT_TO_JSVAL(60 * 60); // seconds #endif //XTPF_Linux #ifdef XTPF_PSP // reverse calc. xjse_int_t npercent = scePowerGetBatteryLifePercent(); *vp = BOOLEAN_TO_JSVAL(scePowerGetBatteryLifeTime() * npercent / 100); #endif //XTPF_PSP return JS_TRUE; }
int draw_battery_status(int draw) { static UINT32 counter = 0; static int prev_bat = 0, prev_charging = 0; int width, icon, update = 0; int bat = scePowerGetBatteryLifePercent(); int charging = scePowerIsBatteryCharging(); char bat_left[4]; counter++; if (draw) { if (bat > 66) icon = ICON_BATTERY1; else if (bat > 33) icon = ICON_BATTERY2; else if (bat >= 10) icon = ICON_BATTERY3; else icon = ICON_BATTERY4; if ((charging && (counter % 60 < 40)) || !charging) small_icon_shadow(407, 3, UI_COLOR(UI_PAL_TITLE), icon); uifont_print_shadow(432, 5, UI_COLOR(UI_PAL_TITLE), "["); uifont_print_shadow(462, 5, UI_COLOR(UI_PAL_TITLE), "%]"); if (bat >= 0 && bat <= 100) sprintf(bat_left, "%3d", bat); else strcpy(bat_left, "---"); width = uifont_get_string_width(bat_left); uifont_print_shadow(462 - width, 5, UI_COLOR(UI_PAL_TITLE), bat_left); if (!charging && (bat < 10) && (counter % 120 < 40)) { int sx, sy, ex, ey; char message[128]; sprintf(message, TEXT(WARNING_BATTERY_IS_LOW_PLEASE_CHARGE_BATTERY), bat); width = uifont_get_string_width(message); sx = (SCR_WIDTH - width) >> 1; sy = (SCR_HEIGHT - FONTSIZE) >> 1; ex = sx + width; ey = sy + FONTSIZE; draw_dialog(sx - FONTSIZE/2, sy - FONTSIZE/2, ex + FONTSIZE/2, ey + FONTSIZE/2); uifont_print_shadow_center(sy, UI_COLOR(UI_PAL_WARNING), message); } }
void LCD::RenderStatusBattery() { // blit background to buffer Graphics::BlitAlphaImageToImage(0, 0, _bg->imageWidth, _bg->imageHeight, _bg, 0, 0, _buffer); int bp = scePowerGetBatteryLifePercent() / 10; string out = "Battery: "; for (int i=0; i < bp; i++) out += "i"; Font::PrintImage(out.c_str(), 5, textoffsety, _buffer, _textColor, 3); if (scePowerIsBatteryCharging() == 1) Font::PrintImage("Charging", 85, textoffsety, _buffer, _textColor, 3); else Font::PrintImage("Not Charging", 85, textoffsety, _buffer, _textColor, 3); }
char *psp_get_status_line(void) { static char buff[64]; int ret, bat_percent, bat_time; pspTime time; ret = sceRtcGetCurrentClockLocalTime(&time); bat_percent = scePowerGetBatteryLifePercent(); bat_time = scePowerGetBatteryLifeTime(); if (ret < 0 || bat_percent < 0 || bat_time < 0) return NULL; snprintf(buff, sizeof(buff), "%02i:%02i bat: %3i%%", time.hour, time.minutes, bat_percent); if (!scePowerIsPowerOnline()) snprintf(buff+strlen(buff), sizeof(buff)-strlen(buff), " (%i:%02i)", bat_time/60, bat_time%60); return buff; }
void CSystem::GetSystemInfo() { /**BATTERY*/ /**PERCENTUALE CARICA DELLA BATTERIA*/ BatteryLifePerc = L"Battery charge percentage: "; BatteryLifePerc += scePowerGetBatteryLifePercent(); BatteryLifePerc += L"%"; /**PERCENTUALE CARICA DELLA BATTERIA*/ BatteryLifeTime = L"Battery Life Time: "; BatteryLifeTime += scePowerGetBatteryLifeTime() / 3600; BatteryLifeTime += L"m"; /**TEMPERATURA DELLA BATTERIA*/ BatteryTemp = L"Temperature of the battery: "; BatteryTemp += scePowerGetBatteryTemp(); BatteryTemp += L"deg C"; /**EXTERNAL POWER*/ IsPowerOnline = scePowerIsPowerOnline() ? L"External Power: Yes" : L"External Power: No "; /**BATTERY PRESENT*/ IsBatteryExist = scePowerIsBatteryExist() ? L"Battery Present: Yes" : L"Battery Present: No "; /**FREEMEMORY*/ FreeMemory = L"Free Memory: "; FreeMemory += __freemem(); /**CPU BUS*/ CpuClock = L"CPU: "; CpuClock += scePowerGetCpuClockFrequency(); CpuClock += " MHZ"; BusClock = L"BUS: "; BusClock += scePowerGetBusClockFrequency(); BusClock += " MHZ"; }
static void show_battery_warning(void) { if (!scePowerIsBatteryCharging()) { int bat = scePowerGetBatteryLifePercent(); if (bat < 10) { static UINT32 counter = 0; counter++; if ((counter % 120) < 80) { char warning[128]; boxfill_alpha(0, 254, SCR_WIDTH-1, SCR_HEIGHT-1, COLOR_BLACK, 12); sprintf(warning, TEXT(WARNING_BATTERY_IS_LOW_PLEASE_CHARGE_BATTERY), bat); uifont_print_center(256, UI_COLOR(UI_PAL_WARNING), warning); } } } }
static int lua_powerGetBatteryLifePercent(lua_State *L) { if (lua_gettop(L) != 0) return luaL_error(L, "System.powerGetBatteryLifePercent() takes no arguments"); lua_pushnumber(L, scePowerGetBatteryLifePercent()); return 1; }
void check() { // No battery? if (!scePowerIsBatteryExist()) { // Don't report anything. return; } // Get the new battery status. const int level = scePowerGetBatteryLifePercent(); const bool charging = scePowerGetBatteryChargingStatus(); // Is the level not sensible? if ((level < 0) || (level > 100)) { // Hopefully it will be sensible soon. return; } // Has the battery status changed? if ((level != lastLevel) || (charging != lastCharging)) { // Charging? if (charging) { // Inform the player. Con_Printf("Battery %d%% (charging)\n", level); } else { // How much time is left? const int timeLeft = scePowerGetBatteryLifeTime(); // Is the time sensible? if (timeLeft > 0) { // Convert the time to something readable. const int hoursLeft = timeLeft / 60; const int minutesLeft = timeLeft % 60; // Inform the player. Con_Printf("Battery %d%% (%d hour%s %d minute%s)\n", level, hoursLeft, (hoursLeft == 1) ? "" : "s", // Handle pluralisation of hour(s). minutesLeft, (minutesLeft == 1) ? "" : "s"); // Handle pluralisation of minute(s). } else { // It's a silly time, just report the battery level. Con_Printf("Battery %d%%\n", level); } } // Remember the status for next frame. lastLevel = level; lastCharging = charging; } }
int main() { SceCtrlData pad; int cancel = 0, uninstall = 0, reinstall = 0, lftv = 0, ok = 0, installed = 0, uninstalled = 0, autoExit = 0; SetupCallbacks(); sceCtrlSetSamplingCycle(0); sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG); sceCtrlReadBufferPositive(&pad, 1); if (pad.Buttons & PSP_CTRL_LTRIGGER) { quickinstall = 1; lftv = 1; } else if (pad.Buttons & PSP_CTRL_RTRIGGER) { quickinstall = 1; } if (fileExist(PRX_LFTVBACKUP) | fileExist(PRX_RPLYBACKUP)) uninstall = 1; sceGuInit(); sceGuStart(GU_DIRECT, list); sceGuClearColor(0xFFFFFFFF); sceGuDrawBuffer(GU_PSM_8888, (void*)0, BUF_WIDTH); sceGuDispBuffer(SCR_WIDTH, SCR_HEIGHT, (void*)0x88000, BUF_WIDTH); sceGuDepthBuffer((void*)0x110000, BUF_WIDTH); sceGuOffset(2048 - (SCR_WIDTH / 2), 2048 - (SCR_HEIGHT / 2)); sceGuViewport(2048, 2048, SCR_WIDTH, SCR_HEIGHT); sceGuDepthRange(0xc350, 0x2710); sceGuScissor(0, 0, SCR_WIDTH, SCR_HEIGHT); sceGuEnable(GU_SCISSOR_TEST); sceGuDisable(GU_DEPTH_TEST); sceGuShadeModel(GU_SMOOTH); sceGuEnable(GU_BLEND); sceGuBlendFunc(GU_ADD, GU_SRC_ALPHA, GU_ONE_MINUS_SRC_ALPHA, 0, 0); sceGuEnable(GU_TEXTURE_2D); sceGuTexMode(GU_PSM_8888, 0, 0, 0); sceGuTexImage(0, 256, 128, 256, font); sceGuTexFunc(GU_TFX_MODULATE, GU_TCC_RGBA); sceGuTexEnvColor(0x0); sceGuTexOffset(0.0f, 0.0f); sceGuTexScale(1.0f / 256.0f, 1.0f / 128.0f); sceGuTexWrap(GU_REPEAT, GU_REPEAT); sceGuTexFilter(GU_NEAREST, GU_NEAREST); sceGuFinish(); sceGuSync(0,0); sceGuDisplay(GU_TRUE); // Check for low battery. if ((scePowerGetBatteryLifePercent() < 25) & !scePowerIsPowerOnline()) { sceGuStart(GU_DIRECT, list); sceGuClear(GU_COLOR_BUFFER_BIT); drawStringCenter("Battery charge should be at least 25% when modifying flash!", 40 + (10 * i), 0xFF0000FF, 8); i += 2; drawStringCenter("Connect the AC adapter to ignore this warning and continue!", 40 + (10 * i), 0xFF0000FF, 8); i += 2; drawStringCenter(uninstall ? "Press any button to cancel uninstallation of warPSP." : "Press any button to cancel installation of warPSP.", 50 + (10 * i), 0xFF0000FF, 8); i += 2; drawObjects(); while (!scePowerIsPowerOnline()) { sceCtrlReadBufferPositive(&pad, 1); if (pad.Buttons) { cancel = 1; break; } } } if (!cancel) { float c = 0.0; for (c = 10.0; c <= 100.0; c++) { unsigned int col = 0xFF000000 | (unsigned int)((c / 100.0) * 255.0f) << 16 | (unsigned int)((c / 100.0) * 255.0f) << 8 | (unsigned int)((c / 100.0) * 255.0f) << 0; sceGuClearColor(col); clearScreenPrintHeader(90); if (quickinstall & (c > 50)) drawStringCenter("Quick Install Activated!", 250, 0xFF006600, 8); drawObjects(); } sceKernelDelayThread(3000000); for (c = 100.0; c >= 10.0; c--) { unsigned int col = 0xFF000000 | (unsigned int)((c / 100.0) * 255.0f) << 16 | (unsigned int)((c / 100.0) * 255.0f) << 8 | (unsigned int)((c / 100.0) * 255.0f) << 0; sceGuClearColor(col); clearScreenPrintHeader(90); drawObjects(); } } sceGuClearColor(0xFFFFFFFF); // Show disclaimer and options. if (!cancel & !quickinstall) { sceGuStart(GU_DIRECT, list); sceGuClear(GU_COLOR_BUFFER_BIT); drawStringCenter("!!! DISCLAIMER !!!", 40 + (10 * i), 0xFF0000FF, 10); i += 2; drawStringCenter("This program modifies the flash drive of your Sony PSP.", 60 + (10 * i), 0xFF0000FF, 8); i++; drawStringCenter("You accept the risk when running this installation app.", 60 + (10 * i), 0xFF0000FF, 8); i += 2; drawStringCenter("DO NOT REMOVE THE MEMORY STICK WHEN ORANGE LED FLASHES.", 60 + (10 * i), 0xFF0000FF, 8); i++; drawStringCenter("DO NOT TURN OFF THE PSP SYSTEM WHEN ORANGE LED FLASHES.", 60 + (10 * i), 0xFF0000FF, 8); i += 2; drawStringCenter("Press START to acknowledge and to continue to briefing.", 60 + (10 * i), 0xFF0000FF, 8); i++; drawStringCenter("Press SELECT to decline and to abort installing warPSP.", 60 + (10 * i), 0xFF0000FF, 8); i += 2; drawStringCenter("THE AUTHOR DOES NOT HOLD RESPONSIBILITY FOR ANY DAMAGE.", 60 + (10 * i), 0xFF0000FF, 8); i++; drawStringCenter("THIS SOFTWARE IS PRESENTED WITHOUT WARRANTY/GUARANTEES.", 60 + (10 * i), 0xFF0000FF, 8); i += 4; drawObjects(); while (1) { sceCtrlReadBufferPositive(&pad, 1); if (pad.Buttons & PSP_CTRL_START) { break; } if (pad.Buttons & PSP_CTRL_SELECT) { cancel = 1; break; } } } // Check if backup file exists. if (!cancel & !quickinstall) { swapBuffers(); clearScreenPrintHeader(0); drawObjects(); clearScreenPrintHeader(0); drawStringCenter("Briefing", 50 + (10 * i), 0xFF000000, 0); i+= 2; drawStringCenter("Thanks for your interest in the warPSP Software Suite!", 50 + (10 * i), 0xFF006600, 0); i += 2; drawStringCenter("warPSP is an advanced warXing utility for the Sony PSP.", 50 + (10 * i), 0xFF000000, 8); i += 2; drawStringCenter("Please see the README.TXT file for more information.", 50 + (10 * i), 0xFF660000, 8); i += 3; drawStringCenter("Options", 50 + (10 * i), 0xFF000000, 0); i += 2; if (uninstall) { drawStringCenter("Press SQUARE to uninstall warPSP and restore backup files.", 50 + (10 * i), 0xFF000000, 8); i++; drawStringCenter("Press CIRCLE to reinstall warPSP to the last slot selected.", 50 + (10 * i), 0xFF000000, 8); i++; } else { drawStringCenter("Press SQUARE to install warPSP to the LFTV Player slot.", 50 + (10 * i), 0xFF000000, 8); i++; drawStringCenter("Press CIRCLE to install warPSP to the Remote Play slot.", 50 + (10 * i), 0xFF000000, 8); i++; } drawStringCenter(uninstall ? "Press SELECT to cancel uninstallation of warPSP and exit." : "Press SELECT to cancel installation of warPSP and exit.", 50 + (10 * i), 0xFF000099, 8); i += 2; drawObjects(); while (1) { sceCtrlReadBufferPositive(&pad, 1); if (uninstall) { if (pad.Buttons & PSP_CTRL_SQUARE) { break; } if (pad.Buttons & PSP_CTRL_CIRCLE) { uninstall = 0; reinstall = 1; if (fileExist(PRX_LFTVBACKUP)) lftv = 1; else lftv = 0; break; } } else { if (pad.Buttons & PSP_CTRL_SQUARE) { lftv = 1; break; } if (pad.Buttons & PSP_CTRL_CIRCLE) { lftv = 0; break; } } if (pad.Buttons & PSP_CTRL_SELECT) { cancel = 1; break; } } } if (!cancel) { if ((scePowerGetBatteryLifePercent() < 25) & !scePowerIsPowerOnline()) { swapBuffers(); sceGuStart(GU_DIRECT, list); drawStringCenter(" Battery is below 25%% and AC adapter is not connected!", 50 + (10 * i), 0xFF000099, 0); i += 2; cancel = 1; drawObjects(); } } if (cancel) { swapBuffers(); sceGuStart(GU_DIRECT, list); sprintf(buffer, "%sstallation cancelled!", uninstall ? "Unin" : "In"); drawStringCenter(buffer, 50 + (10 * i), 0xFF0000FF, 0); i += 2; drawObjects(); sceKernelDelayThread(1000000); } // Perform installation, uninstallation or reinstallation. if (!cancel) { scePowerLock(0); swapBuffers(); clearScreenPrintHeader(0); drawObjects(); clearScreenPrintHeader(0); drawObjects(); swapBuffers(); sceGuStart(GU_DIRECT, list); drawStringCenter(uninstall ? "Uninstallation" : "Installation", 50 + (10 * i), 0xFF990000, 0); i += 2; if (quickinstall) { drawStringCenter("Quick installing warPSP to the location free player slot.", 50 + (10 * i), 0xFF990000, 0); i += 2; } drawObjects(); swapBuffers(); sceGuStart(GU_DIRECT, list); if (uninstall) { if (fileExist(PRX_LFTVBACKUP)) { lftv = 1; ok = 1; } else if (fileExist(PRX_RPLYBACKUP)) { lftv = 0; ok = 1; } if (ok) { drawStringCenter("Backup prx found. Ok to uninstall!", 50 + (10 * i), 0xFF990000, 8); i++; drawStringCenter("The backup prx will be copied to the flash drive of your PSP!", 50 + (10 * i), 0xFF000000, 8); i += 2; drawObjects(); if (fileCopy(lftv ? PRX_LFTVBACKUP : PRX_RPLYBACKUP, lftv ? PRX_LFTVPLAYER : PRX_REMOTEPLAY)) { swapBuffers(); sceGuStart(GU_DIRECT, list); drawStringCenter("Backup file reinstalled successfully!", 50 + (10 * i), 0xFF006600, 8); sceIoRemove(lftv ? PRX_LFTVBACKUP : PRX_RPLYBACKUP); uninstalled = 1; } else { swapBuffers(); sceGuStart(GU_DIRECT, list); drawStringCenter("Backup file reinstallation failed!", 50 + (10 * i), 0xFF000099, 8); } i += 2; drawObjects(); if (uninstalled) { swapBuffers(); sceGuStart(GU_DIRECT, list); drawStringCenter("To reinstall warPSP, rerun the Easy Installation Program.", 50 + (10 * i), 0xFF990000, 8); i += 2; drawObjects(); } } } else { if (fileExist(PRX_WARPSP_XMB)) { sceIoRemove(PRX_WARPSP_XMB); sceKernelDelayThread(1000000); } drawStringCenter("Extracting warPSP.prx to the root of the memory stick.", 50 + (10 * i), 0xFF000000, 8); i += 2; drawObjects(); sceKernelDelayThread(2000000); // Open PBP file and read contents into the buffer. int pbpFile, prxFile, pkgSize = 0, prxSize = 0; char buf[1024*1024]; pbpFile = sceIoOpen(PBP_WARPSP_EIP, PSP_O_RDONLY, 0); sceKernelDelayThread(1000000); if (pbpFile) { // Get size of entire package. pkgSize = sceIoRead(pbpFile, buf, sizeof(buf)); sceKernelDelayThread(1000000); if (pkgSize > 0) { swapBuffers(); sceGuStart(GU_DIRECT, list); drawStringCenter("EBOOT.PBP loaded into memory successfully!", 50 + (10 * i), 0xFF006600, 8); i += 2; drawObjects(); // Calculate size of prx to extract (size of entire package - size of eboot.pbp). prxSize = pkgSize - pbpSize; // Open PRX file and write buffer into the contents. prxFile = sceIoOpen(PRX_WARPSP_XMB, PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC, 0777); sceKernelDelayThread(100000); if (prxFile) { // Write prx file from end of eboot.pbp. sceIoWrite(prxFile, buf + pbpSize, prxSize); sceKernelDelayThread(1000000); sceIoClose(prxFile); sceKernelDelayThread(1000000); swapBuffers(); sceGuStart(GU_DIRECT, list); drawStringCenter("warPSP.prx extracted from memory successfully!", 50 + (10 * i), 0xFF006600, 8); drawObjects(); } else { swapBuffers(); sceGuStart(GU_DIRECT, list); drawStringCenter("warPSP.prx extraction from memory failed!", 50 + (10 * i), 0xFF000099, 8); drawObjects(); } i += 2; } sceIoClose(pbpFile); sceKernelDelayThread(1000000); } else { swapBuffers(); sceGuStart(GU_DIRECT, list); drawStringCenter("EBOOT.PBP load into memory failed!", 50 + (10 * i), 0xFF000099, 8); i += 2; drawObjects(); } buf[0] = (char)"\0"; swapBuffers(); sceGuStart(GU_DIRECT, list); if (!fileExist(PRX_WARPSP_XMB)) { drawStringCenter("warPSP.prx not found! Install cancelled!", 50 + (10 * i), 0xFF000099, 8); } else { drawStringCenter("warPSP.prx found. Ok to install!", 50 + (10 * i), 0xFF006600, 8); ok = 1; } i += 2; drawObjects(); // Create backup of original file and install warPSP. if (ok) { if (!reinstall) { swapBuffers(); sceGuStart(GU_DIRECT, list); drawStringCenter("The backup file will be copied to the memory stick!", 50 + (10 * i), 0xFF990000, 8); i++; drawObjects(); if (fileCopy(lftv ? PRX_LFTVPLAYER : PRX_REMOTEPLAY, lftv ? PRX_LFTVBACKUP : PRX_RPLYBACKUP)) { swapBuffers(); sceGuStart(GU_DIRECT, list); drawStringCenter("Original prx file backed up successfully!", 50 + (10 * i), 0xFF006600, 8); } else { swapBuffers(); sceGuStart(GU_DIRECT, list); drawStringCenter("Original prx file back up failed!", 50 + (10 * i), 0xFF000099, 8); } i += 2; drawObjects(); } if (fileCopy(PRX_WARPSP_XMB, lftv ? PRX_LFTVPLAYER : PRX_REMOTEPLAY)) { swapBuffers(); sceGuStart(GU_DIRECT, list); drawStringCenter("warPSP^xmb installed successfully!", 50 + (10 * i), 0xFF006600, 8); sceIoRemove(PRX_WARPSP_XMB); installed = 1; } else { swapBuffers(); sceGuStart(GU_DIRECT, list); drawStringCenter("warPSP^xmb installation failed!", 50 + (10 * i), 0xFF000099, 8); installed = 0; } i += 2; drawObjects(); } } scePowerUnlock(0); } if (installed | uninstalled) { sceKernelDelayThread(1000000); } if (!quickinstall) { swapBuffers(); sceGuStart(GU_DIRECT, list); sprintf(buffer, "Press any button to %s! (Auto-Exit in 10s).", (installed | uninstalled) ? "restart the PSP" : "return to the xmb"); drawStringCenter(buffer, 50 + (10 * i), 0xFF000000, 8); i++; if (installed) { drawStringCenter("Happy warXing!", 50 + (10 * i), 0xFF006600, 8); i++; } else if (uninstalled) { drawStringCenter("Thank you for using warPSP", 50 + (10 * i), 0xFF990000, 8); i++; } drawObjects(); // Wait for exit. while (1) { if (autoExit >= 1000) break; sceCtrlReadBufferPositive(&pad, 1); if (pad.Buttons) break; sceKernelDelayThread(10000); autoExit++; } } if (quickinstall) { sceKernelDelayThread(1000000); } swapBuffers(); sceGuStart(GU_DIRECT, list); drawStringCenter("Exiting!", 50 + (10 * i), (installed | uninstalled) ? 0xFF990000 : 0xFF0000FF, 8); drawObjects(); if (installed | uninstalled) { sceKernelExitGame(); scePower_0442D852(50000); } else { sceKernelExitGame(); } return 0; }