int c_gamePKG::DeletePDBFiles(int nId) { if(bDeleting) return 0; bDeleting = true; char szPDB[256] = ""; char szIconFile[256] = ""; sprintf(szPDB, "/dev_hdd0/vsh/game_pkg/%d/d0.pdb", nId); sprintf(szIconFile, "/dev_hdd0/vsh/game_pkg/%d/ICON_FILE", nId); FILE *fpPDB, *fpIcon; if((fpPDB = fopen(szPDB, "r"))) { fclose(fpPDB); fpPDB = NULL; cellFsUnlink(szPDB); } if((fpIcon = fopen(szIconFile, "r"))) { fclose(fpIcon); fpIcon = NULL; cellFsUnlink(szIconFile); } bDeleting = false; return 1; }
int c_gamePKG::RemoveAllDirFiles(char* szDirectory) { int fd; CellFsDirent dirEntry; CellFsErrno res = cellFsOpendir(szDirectory, &fd); if (res == CELL_FS_SUCCEEDED) { uint64_t nread; while(cellFsReaddir(fd, &dirEntry, &nread) == CELL_FS_SUCCEEDED) { if(nread == 0) break; if (dirEntry.d_type == CELL_FS_TYPE_DIRECTORY) { // DIRECTORY } else { if(dirEntry.d_type != CELL_FS_TYPE_REGULAR) break; // FILE char szFile[256] = ""; sprintf(szFile, "%s/%s", szDirectory, dirEntry.d_name); cellFsUnlink(szFile); } } } cellFsClosedir(fd); return 1; }
void c_gamePKG::RemovePKG(int nId) { if(bDeleting) return; bDeleting = true; char szPKG[256] = ""; sprintf(szPKG, "/dev_hdd0/vsh/game_pkg/%d/%s", nId, pkglst[nSelectedPKG].title); FILE *fpPKG; if((fpPKG = fopen(szPKG, "r"))) { fclose(fpPKG); fpPKG = NULL; cellFsUnlink(szPKG); } bDeleting = false; }
int disable_cobra_stage() { cellFsUtilMount_h("CELL_FS_IOS:BUILTIN_FLSH1", "CELL_FS_FAT", "/dev_habib", 0, 0, 0, 0, 0); CellFsStat stat; cellFsStat(CB_LOCATION, &stat); uint64_t len=stat.st_size; uint8_t *buf; uint64_t size; int src; int dst; page_allocate_auto(NULL, 0x40000, 0x2F, (void **)&buf); if (cellFsOpen(CB_LOCATION, CELL_FS_O_RDONLY, &src, 0, NULL, 0) == 0) { cellFsRead(src, buf, len, &size); cellFsClose(src); } else { page_free(NULL, buf, 0x2F); return -1; } if (cellFsOpen(CB_LOCATION".bak", CELL_FS_O_WRONLY | CELL_FS_O_CREAT | CELL_FS_O_TRUNC, &dst, 0666, NULL, 0) == 0) { cellFsWrite(dst, buf, len, &size); cellFsClose(dst); } else { page_free(NULL, buf, 0x2F); return -1; } page_free(NULL, buf, 0x2F); cellFsUnlink(CB_LOCATION); size=0x5343450000000000; cellFsOpen("/dev_hdd0/tmp/loadoptical", CELL_FS_O_WRONLY | CELL_FS_O_CREAT | CELL_FS_O_TRUNC, &dst, 0666, NULL, 0); cellFsWrite(dst, &size, 4, &size); cellFsClose(dst); return 0; }
int ps3_soft_restart(void) { cellFsUnlink((char*)"/dev_hdd0/tmp/turnoff"); system_call_3(379, 0x200 , NULL, 0); return_to_user_prog(int); }
int ps3_shutdown(void) { cellFsUnlink((char*)"/dev_hdd0/tmp/turnoff"); system_call_4(379, 0x1100, 0, 0, 0); return_to_user_prog(int); }
void thread_FileCopy(uint64_t /*arg*/) { gamePKG->nStatus = STATUS_COPY_START; FILE *filer = NULL; FILE *filew = NULL; uint64_t numr = 0; // elements read uint64_t numw = 0; // elements wrote uint64_t nTotalRead = 0; double nCopyPct = 0.0f; double nTotDelta = 0.0f; uint32_t nApproxTotDelta = 0; char *buffer = NULL; buffer = (char*)malloc(BUFF_SIZE); filer = fopen(gamePKG->pkglst[gamePKG->nSelectedPKG].path,"rb"); char szFileOut[256] =""; sprintf( szFileOut, "/dev_hdd0/vsh/game_pkg/%d/%s", gamePKG->pkglst[gamePKG->nSelectedPKG].nPKGID, gamePKG->pkglst[gamePKG->nSelectedPKG].title ); filew = fopen(szFileOut, "wb"); if(filer != NULL && filew != NULL) { bool bCopyError = false; while(feof(filer) == 0) { // read if((numr = fread(buffer, 1, BUFF_SIZE, filer)) != BUFF_SIZE) { if(ferror(filer) != 0) { bCopyError = true; break; } else if(feof(filer) != 0) { // ... } } // write if((numw = fwrite(buffer, 1, numr, filew)) != numr) { bCopyError = true; break; } nTotalRead += numr; nCopyPct = (double)(((double)numr / (double)gamePKG->pkglst[gamePKG->nSelectedPKG].nSize) * 100.0f); double nTotalPct = (double)((double)nTotalRead / (double)gamePKG->pkglst[gamePKG->nSelectedPKG].nSize) * 100.0f; nTotDelta += nCopyPct; nApproxTotDelta += (uint32_t)round(nCopyPct); if((double)nApproxTotDelta < nTotalPct) { // Compensate loss of float/double data, as for example: approx 70% vs. precise 95% nApproxTotDelta += (uint32_t)(nTotalPct - (double)nApproxTotDelta); nCopyPct += (nTotalPct - (double)nApproxTotDelta); } cellMsgDialogProgressBarInc(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE, (uint32_t)nCopyPct); char msg[256] = ""; sprintf( msg, //"%.2f %s / %.2f %s (%.1f %%)(delta: %d %%)", "%.2f %s / %.2f %s", GetByteUnit(nTotalRead), GetByteUnitStr(nTotalRead), GetByteUnit(gamePKG->pkglst[gamePKG->nSelectedPKG].nSize), GetByteUnitStr(gamePKG->pkglst[gamePKG->nSelectedPKG].nSize) //, //nTotalPct, //nApproxTotDelta ); cellMsgDialogProgressBarSetMsg(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE, msg); } nCopyPct = (double)(((double)numr / (double)gamePKG->pkglst[gamePKG->nSelectedPKG].nSize) * 100.0f); double nTotalPct = (double)((double)nTotalRead / (double)gamePKG->pkglst[gamePKG->nSelectedPKG].nSize) * 100.0f; nTotDelta += nCopyPct; nApproxTotDelta += (uint32_t)round(nCopyPct); if((double)nApproxTotDelta < nTotalPct) { // Compensate loss of float/double data, as for example: approx 70% vs. precise 95% nApproxTotDelta += (uint32_t)(nTotalPct - (double)nApproxTotDelta); nCopyPct += (nTotalPct - (double)nApproxTotDelta); } cellMsgDialogProgressBarInc(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE, (uint32_t)nCopyPct); char msg[256] = ""; sprintf( msg, //"%.2f %s / %.2f %s (%.1f %%)(delta: %d %%)", "%.2f %s / %.2f %s", GetByteUnit(nTotalRead), GetByteUnitStr(nTotalRead), GetByteUnit(gamePKG->pkglst[gamePKG->nSelectedPKG].nSize), GetByteUnitStr(gamePKG->pkglst[gamePKG->nSelectedPKG].nSize) //, //nTotalPct, //nApproxTotDelta ); cellMsgDialogProgressBarSetMsg(CELL_MSGDIALOG_PROGRESSBAR_INDEX_SINGLE, msg); if(filer) fclose(filer); if(filew) fclose(filew); if(bCopyError) { cellFsUnlink(szFileOut); // delete file gamePKG->nStatus = STATUS_COPY_ERROR; sys_ppu_thread_exit(0); return; } } else { if(buffer) free(buffer); buffer = NULL; if(filer) fclose(filer); if(filew) { fclose(filew); cellFsUnlink(szFileOut); // delete file } gamePKG->nStatus = STATUS_COPY_ERROR; sys_ppu_thread_exit(0); return; } if(buffer) { free(buffer); buffer = NULL; } sys_timer_usleep(1000000); // wait 1 second gamePKG->nStatus = STATUS_COPY_OK; sys_ppu_thread_exit(0); }
void ExitDlgCallbackFunction(int buttonType, void *userData) { int nDialog = (int)userData; switch( buttonType ) { case CELL_MSGDIALOG_BUTTON_YES: { if(nDialog == STATUS_ROMSCAN_DLG) { cellMsgDialogAbort(); iniWrite(); // save settings // delete old cache cellFsUnlink("/dev_hdd0/game/FBAL00123/USRDIR/FBA.GAMELIST.CACHE.DAT"); fbaRL->RefreshGameList(); // Refresh gamelist break; } if(nDialog == STATUS_EXIT_MMAN) { cellMsgDialogAbort(); iniWrite(); // save settings app.onShutdown(); char path[] = "/dev_hdd0/game/BLES80608/USRDIR/RELOAD.SELF"; if(fbaRL->FileExist(path)) { sys_game_process_exitspawn(path, NULL, NULL, NULL, 0, 1000, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); } fbaRL->EndMainMenu(); break; } if(nDialog == STATUS_EXIT_IMANAGER) { cellMsgDialogAbort(); iniWrite(); // save settings app.onShutdown(); char path[] = "/dev_hdd0/game/IMANAGER4/USRDIR/iris_manager.self"; if(fbaRL->FileExist(path)) { sys_game_process_exitspawn(path, NULL, NULL, NULL, 0, 1000, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); } fbaRL->EndMainMenu(); break; } if(nDialog == STATUS_EXIT_FBARL_RA) { cellMsgDialogAbort(); iniWrite(); // save settings app.onShutdown(); char fba_rl_path[] = "/dev_hdd0/game/FBAL00123/USRDIR/RELOAD.SELF"; char rom_path[] = "DUMMY_ARG"; char preset_cfg[] = "DUMMY_ARG"; char aspect_ratio[] = "DUMMY_ARG"; if(fbaRL->FileExist(fba_rl_path)) { fbaRL->LaunchFBACore( (char*)rom_path, (char*)fba_rl_path, (char*)preset_cfg, (char*)aspect_ratio, (char*)(g_opt_bUseAltMenuKeyCombo ? "yes" : "no") ); } fbaRL->EndMainMenu(); break; } if(nDialog == STATUS_EXIT) { cellMsgDialogAbort(); iniWrite(); // save settings app.onShutdown(); exit(0); fbaRL->EndMainMenu(); break; } break; } case CELL_MSGDIALOG_BUTTON_NO: case CELL_MSGDIALOG_BUTTON_ESCAPE: case CELL_MSGDIALOG_BUTTON_NONE: break; default: break; } }
void c_fbaRL::DlgDisplayFrame() { switch(nStatus) { case STATUS_ROMPATH_CHANGED: { //::cellMsgDialogOpen2( // CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL, // "Remeber to rescan ROMs after you finish configuring all paths,\nyou can do so at the Game List section.", // DlgCallbackFunction, (void*)STATUS_ROMPATH_CHANGED, NULL //); // Force Re-Scan // delete old cache cellFsUnlink("/dev_hdd0/game/FBAL00123/USRDIR/FBA.GAMELIST.CACHE.DAT"); break; } case STATUS_ROMSCAN_DLG: { ::cellMsgDialogOpen2( CELL_MSGDIALOG_TYPE_BUTTON_TYPE_YESNO| CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NO, "Do you want to Rescan all configured paths for ROM(s) ?", ExitDlgCallbackFunction, (void*)STATUS_ROMSCAN_DLG, NULL ); break; } case STATUS_MISSING_GAME_DLG: { ::cellMsgDialogOpen2( CELL_MSGDIALOG_TYPE_BUTTON_TYPE_YESNO| CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NO, "Error: There was a problem locating the specified game, if you had it on a USB Storage Device, \n" "make sure it is properly connected.\n\n" "Do you want to Re-Scan all configured paths for ROM(s) ?", ExitDlgCallbackFunction, (void*)STATUS_ROMSCAN_DLG, NULL ); break; } case STATUS_CORRUPT_APP_DLG: { ::cellMsgDialogOpen2( CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL |CELL_MSGDIALOG_TYPE_BUTTON_TYPE_OK |CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_ON |CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_OK, "Error: FB Alpha RL installation is corrupted, please re-install it.", ExitDlgCallbackFunction, (void*)STATUS_EXIT, NULL ); break; } case STATUS_EXIT: { ::cellMsgDialogOpen2( CELL_MSGDIALOG_TYPE_BUTTON_TYPE_YESNO| CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NO, "Do you want to exit FB Alpha RL and return to XMB ?", ExitDlgCallbackFunction, (void*)STATUS_EXIT, NULL ); break; } case STATUS_EXIT_FBARL_RA: { ::cellMsgDialogOpen2( CELL_MSGDIALOG_TYPE_BUTTON_TYPE_YESNO| CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NO, "Do you want to exit and load FB Alpha RetroArch (modified core / fb_alpha.SELF) ?", ExitDlgCallbackFunction, (void*)STATUS_EXIT_FBARL_RA, NULL ); break; } case STATUS_EXIT_MMAN: { ::cellMsgDialogOpen2( CELL_MSGDIALOG_TYPE_BUTTON_TYPE_YESNO| CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NO, "Do you want to exit and load \"multiMAN\" ?", ExitDlgCallbackFunction, (void*)STATUS_EXIT_MMAN, NULL ); break; } case STATUS_EXIT_IMANAGER: { ::cellMsgDialogOpen2( CELL_MSGDIALOG_TYPE_BUTTON_TYPE_YESNO| CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NO, "Do you want to exit and load \"Iris Manager\" ?", ExitDlgCallbackFunction, (void*)STATUS_EXIT_IMANAGER, NULL ); break; } case STATUS_UPDATEPREVIEW: { UpdateBurnSelected(fgames[nSelectedGame]->zipname); UpdatePreviewImage(); break; } case STATUS_RESETPREVIEW: { ResetPreviewImage(); break; } case STATUS_ROMSCAN_START: { char szMsg[256] = ""; sprintf(szMsg, "Scanning ROM(s), please wait...\n\nNotice: If you have MAME complete romset, be patient, the process could take a few minutes."); ::cellMsgDialogOpen2( CELL_MSGDIALOG_TYPE_SE_TYPE_NORMAL |CELL_MSGDIALOG_TYPE_BUTTON_TYPE_NONE |CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_ON |CELL_MSGDIALOG_TYPE_DEFAULT_CURSOR_NONE |CELL_MSGDIALOG_TYPE_PROGRESSBAR_SINGLE, szMsg, DlgCallbackFunction, NULL, NULL ); sys_ppu_thread_t thread_id; sys_ppu_thread_create( &thread_id, _ScanROMs, // callback function 0x1337, // arg 0, // priority 0x300000, // stack size SYS_PPU_THREAD_CREATE_JOINABLE, // "ROMScan" // name ); break; } case STATUS_ROMSCAN_END: { cellMsgDialogAbort(); SaveGameListCache(); fbaRL->InitFilterList(); break; } } nStatus = STATUS_NORMAL; }
int main(int argc, char* argv[]) { init_log(); (void)argc; (void)argv; // [cobralib] unmount iso / eject cobra_send_fake_disc_eject_event(); cobra_umount_disc_image(); // Check if isolist.self is launching this app... FILE* fp_flag = fopen("/dev_hdd0/game/SISO00123/USRDIR/isolist_finished", "r"); if(fp_flag) { // load normally... fclose(fp_flag); *&fp_flag = NULL; // remove the launch flag... cellFsUnlink("/dev_hdd0/game/SISO00123/USRDIR/isolist_finished"); } else { // generate ISO list... sys_game_process_exitspawn((char*)ISOLIST_SELF, NULL, NULL, NULL, 0, 1000, SYS_PROCESS_PRIMARY_STACK_SIZE_1M); } if(!LoadModules()) { // error... (void)exit_app(); return 0; } // setup sys callback if(cellSysutilRegisterCallback(0, callback_sysutil_exit, NULL) != CELL_OK) { // error... (void)exit_app(); return 0; } InputInit(); if(InitPSGLVideo(device, context, screen_width, screen_height, render_width, render_height)) { // clear vid on startup (void)render(true); // init font if(!font_init(render_width, render_height)) { bRun = false; } // init app core modules, ftp, settings, etc... if(!init_core()) { bRun = false; } // loop while(bRun) { cellSysutilCheckCallback(); (void)input(); (void)render(false); } } else { // error msg here... } (void)exit_app(); return 0; }