void clearScreenPrintHeader(int y) { i = 0; sceGuStart(GU_DIRECT, list); sceGuClear(GU_COLOR_BUFFER_BIT); drawStringCenter("warPSP", y, 0xFF990000, 0); drawStringCenter("warXing Suite", y ? y + 20 : y + 10, 0xFF550000, 0); drawStringCenter("Easy Installation Program", y ? y + 40 : y + 30, 0xFF000000, 0); drawStringCenter("by caliFrag", y ? y + 80 : y + 20, 0xFF006600, 0); }
// doDraw //--------------------------------------------------------------------------- void ControlsView::doDraw() { MenuTemplateView::doDraw(); //char strBuf[256]; // //const int arrowButtonWidth = 16; // //int optionsMeterWidth = 220; //iRect visualMeter; //int meterUsageXSize = 0; //float percent = 0.0f; //int x = optionsMeterStartX + arrowButtonWidth; //int y = bodyTextStartY; //int yOffset = 15; // //Surface tempSurface(optionsMeterWidth, 14, optionsMeterWidth, 1); // // Joystick State //tempSurface.fill(meterColor); //sprintf(strBuf, "%s", getJoystickState()); //tempSurface.bltStringCenter(strBuf, meterTextColor); //tempSurface.blt(clientArea, x, y); // //y += yOffset; drawStringCenter("Not available for preview", Color::white); } // end ControlsView::doDraw
void DisconectedView::doDraw() { drawTransRect(*this); drawStringCenter(disconectMsg.c_str(), Color::white); View::doDraw(); }
// doDraw //--------------------------------------------------------------------------- void AreYouSureResignView::doDraw() { //iRect r(min, max); drawTransRect(*this); drawStringCenter("Are you sure you wish to Resign?", Color::white); View::doDraw(); } // end AreYouSureResignView::doDraw
static void LCDTask(void *pvParameters) { portTickType ui32WakeTime; while(1) { ui32WakeTime = xTaskGetTickCount(); fillScreen(ILI9341_RED); drawStringCenter("PLEXUS", 1, ILI9341_WHITE, ILI9341_WHITE); vTaskDelayUntil(&ui32WakeTime, 1000 / portTICK_RATE_MS); //every 3 seconds } }
void initialize_LCD(void) { // LCD initialization gpio_enable_port(GPIOB_BASE); // Configure SPI CLK gpio_config_digital_enable(LCD_GPIO_BASE, LCD_CLK_PIN); gpio_config_alternate_function(LCD_GPIO_BASE, LCD_CLK_PIN); gpio_config_port_control(LCD_GPIO_BASE, LCD_CLK_PIN_PCTL); // Configure SPI MISO gpio_config_digital_enable(LCD_GPIO_BASE, LCD_MISO_PIN); gpio_config_alternate_function(LCD_GPIO_BASE, LCD_MISO_PIN); gpio_config_port_control(LCD_GPIO_BASE, LCD_MISO_PIN_PCTL); // Configure SPI MOSI gpio_config_digital_enable(LCD_GPIO_BASE, LCD_MOSI_PIN); gpio_config_alternate_function(LCD_GPIO_BASE, LCD_MOSI_PIN); gpio_config_port_control(LCD_GPIO_BASE, LCD_MOSI_PIN_PCTL); // Configure CS to be a normal GPIO pin that is controlled // explicitly by software gpio_config_digital_enable(LCD_GPIO_BASE,LCD_CS_PIN); gpio_config_enable_output(LCD_GPIO_BASE,LCD_CS_PIN); // Configure RST, BL_EN, and CMD_SEL to be normal GPIO pins gpio_config_digital_enable(LCD_GPIO_BASE, LCD_RST_PIN | LCD_BL_EN_PIN | LCD_CMD_SEL_PIN); gpio_config_enable_output(LCD_GPIO_BASE, LCD_RST_PIN | LCD_BL_EN_PIN | LCD_CMD_SEL_PIN); initialize_spi2(); //ILI9341_Initial(); init_lcd2(); setRotation(0); fillScreen(ILI9341_RED); drawStringCenter(" P L E X U S", 0, ILI9341_WHITE, ILI9341_WHITE); drawStringCenter(" ADJUST YAW", 3, ILI9341_WHITE, ILI9341_WHITE); drawStringCenter("THEN", 5, ILI9341_WHITE, ILI9341_WHITE); drawStringCenter(" ADJUST PITCH", 7, ILI9341_WHITE, ILI9341_WHITE); drawStringCenter("AND", 9, ILI9341_WHITE, ILI9341_WHITE); drawStringCenter("FIRE", 11, ILI9341_WHITE,ILI9341_WHITE); }
void WorldTask::render() { aabb = {x - player_width/2, y, z - player_width/2, x + player_width/2, y + player_height, z + player_width/2}; //printf("X: %f Y: %f Z: %f XR: %d YR: %d\n", x.toFloat(), y.toFloat(), z.toFloat(), xr.toInt(), yr.toInt()); glColor3f(0.4f, 0.6f, 0.8f); //Blue background glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPushMatrix(); //Inverted rotation of the world nglRotateX((GLFix(359) - xr).normaliseAngle()); nglRotateY((GLFix(359) - yr).normaliseAngle()); //Inverted translation of the world glTranslatef(-x, -y - eye_pos, -z); glBindTexture(terrain_current); world.render(); //Draw indication glBindTexture(&blockselection); glBegin(GL_QUADS); //Do a quick animation const unsigned int blockselection_frame_width = blockselection.width / blockselection_frames; TextureAtlasEntry tex = textureArea(0, 0, blockselection_frame_width, blockselection.height); tex.left += blockselection_frame_width * blockselection_frame; tex.right += blockselection_frame_width * blockselection_frame; //Only increment the frame nr each 5 frames if(++blockselection_frame_fraction == 5) { blockselection_frame_fraction = 0; if(++blockselection_frame == blockselection_frames) blockselection_frame = 0; } const GLFix indicator_x = selection_pos.x * BLOCK_SIZE, indicator_y = selection_pos.y * BLOCK_SIZE, indicator_z = selection_pos.z * BLOCK_SIZE; const GLFix selection_offset = 3; //Needed to prevent Z-fighting switch(selection_side) { case AABB::FRONT: nglAddVertex({indicator_x, indicator_y, selection_pos_abs.z - selection_offset, tex.left, tex.bottom, TEXTURE_TRANSPARENT}); nglAddVertex({indicator_x, indicator_y + BLOCK_SIZE, selection_pos_abs.z - selection_offset, tex.left, tex.top, TEXTURE_TRANSPARENT}); nglAddVertex({indicator_x + BLOCK_SIZE, indicator_y + BLOCK_SIZE, selection_pos_abs.z - selection_offset, tex.right, tex.top, TEXTURE_TRANSPARENT}); nglAddVertex({indicator_x + BLOCK_SIZE, indicator_y, selection_pos_abs.z - selection_offset, tex.right, tex.bottom, TEXTURE_TRANSPARENT}); break; case AABB::BACK: nglAddVertex({indicator_x + BLOCK_SIZE, indicator_y, selection_pos_abs.z + selection_offset, tex.left, tex.bottom, TEXTURE_TRANSPARENT}); nglAddVertex({indicator_x + BLOCK_SIZE, indicator_y + BLOCK_SIZE, selection_pos_abs.z + selection_offset, tex.left, tex.top, TEXTURE_TRANSPARENT}); nglAddVertex({indicator_x, indicator_y + BLOCK_SIZE, selection_pos_abs.z + selection_offset, tex.right, tex.top, TEXTURE_TRANSPARENT}); nglAddVertex({indicator_x, indicator_y, selection_pos_abs.z + selection_offset, tex.right, tex.bottom, TEXTURE_TRANSPARENT}); break; case AABB::RIGHT: nglAddVertex({selection_pos_abs.x + selection_offset, indicator_y, indicator_z, tex.right, tex.bottom, TEXTURE_TRANSPARENT}); nglAddVertex({selection_pos_abs.x + selection_offset, indicator_y + BLOCK_SIZE, indicator_z, tex.right, tex.top, TEXTURE_TRANSPARENT}); nglAddVertex({selection_pos_abs.x + selection_offset, indicator_y + BLOCK_SIZE, indicator_z + BLOCK_SIZE, tex.left, tex.top, TEXTURE_TRANSPARENT}); nglAddVertex({selection_pos_abs.x + selection_offset, indicator_y, indicator_z + BLOCK_SIZE, tex.left, tex.bottom, TEXTURE_TRANSPARENT}); break; case AABB::LEFT: nglAddVertex({selection_pos_abs.x - selection_offset, indicator_y, indicator_z + BLOCK_SIZE, tex.left, tex.bottom, TEXTURE_TRANSPARENT}); nglAddVertex({selection_pos_abs.x - selection_offset, indicator_y + BLOCK_SIZE, indicator_z + BLOCK_SIZE, tex.left, tex.top, TEXTURE_TRANSPARENT}); nglAddVertex({selection_pos_abs.x - selection_offset, indicator_y + BLOCK_SIZE, indicator_z, tex.right, tex.top, TEXTURE_TRANSPARENT}); nglAddVertex({selection_pos_abs.x - selection_offset, indicator_y, indicator_z, tex.right, tex.bottom, TEXTURE_TRANSPARENT}); break; case AABB::TOP: nglAddVertex({indicator_x, selection_pos_abs.y + selection_offset, indicator_z, tex.left, tex.bottom, TEXTURE_TRANSPARENT}); nglAddVertex({indicator_x, selection_pos_abs.y + selection_offset, indicator_z + BLOCK_SIZE, tex.left, tex.top, TEXTURE_TRANSPARENT}); nglAddVertex({indicator_x + BLOCK_SIZE, selection_pos_abs.y + selection_offset, indicator_z + BLOCK_SIZE, tex.right, tex.top, TEXTURE_TRANSPARENT}); nglAddVertex({indicator_x + BLOCK_SIZE, selection_pos_abs.y + selection_offset, indicator_z, tex.right, tex.bottom, TEXTURE_TRANSPARENT}); break; case AABB::BOTTOM: nglAddVertex({indicator_x + BLOCK_SIZE, selection_pos_abs.y - selection_offset, indicator_z, tex.left, tex.bottom, TEXTURE_TRANSPARENT}); nglAddVertex({indicator_x + BLOCK_SIZE, selection_pos_abs.y - selection_offset, indicator_z + BLOCK_SIZE, tex.left, tex.top, TEXTURE_TRANSPARENT}); nglAddVertex({indicator_x, selection_pos_abs.y - selection_offset, indicator_z + BLOCK_SIZE, tex.right, tex.top, TEXTURE_TRANSPARENT}); nglAddVertex({indicator_x, selection_pos_abs.y - selection_offset, indicator_z, tex.right, tex.bottom, TEXTURE_TRANSPARENT}); break; case AABB::NONE: break; } glEnd(); glPopMatrix(); crosshairPixel(0, 0); crosshairPixel(-1, 0); crosshairPixel(-2, 0); crosshairPixel(0, -1); crosshairPixel(0, -2); crosshairPixel(1, 0); crosshairPixel(2, 0); crosshairPixel(0, 1); crosshairPixel(0, 2); //Don't draw the inventory if the block list will be opened, it will draw the inventory itself if(!keyPressed(KEY_NSPIRE_PERIOD) || key_held_down) { current_inventory.draw(*screen); drawStringCenter(global_block_renderer.getName(current_inventory.currentSlot()), 0xFFFF, *screen, SCREEN_WIDTH / 2, SCREEN_HEIGHT - current_inventory.height() - fontHeight()); } if(message_timeout > 0) { drawString(message, 0xFFFF, *screen, 2, 5); --message_timeout; } }
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; }
/* Write files to or from the flash0. */ int fileCopy(const char* sFileSrc , const char* sFileDest) { if (fileExist(sFileSrc)) { int fd1, fd2, len; char buf[128*1024]; sceIoUnassign("flash0:"); sceIoAssign("flash0:", "lflash0:0,0", "flashfat0:", 0, NULL, 0); fd1 = sceIoOpen(sFileSrc, PSP_O_RDONLY, 0); fd2 = sceIoOpen(sFileDest, PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC, 0777); while(1) { len = sceIoRead(fd1, buf, sizeof(buf)); if (len == 0) break; sceIoWrite(fd2, buf, len); } sceIoClose(fd1); sceIoClose(fd2); sceIoUnassign("flash0:"); sprintf(buffer, " %s > %s Done.", sFileSrc, sFileDest); swapBuffers(); sceGuStart(GU_DIRECT, list); drawStringCenter(buffer, 50 + (10 * i), 0xFF000000, 7); drawObjects(); i++; return 1; } else { sprintf(buffer, " File not found: %s", sFileSrc); swapBuffers(); sceGuStart(GU_DIRECT, list); drawStringCenter(buffer, 50 + (10 * i), 0xFF000099, 7); drawObjects(); i++; return 0; } i++; }