static void frontend_psp_init(void *data) { #ifndef IS_SALAMANDER #ifndef VITA (void)data; /* TODO/FIXME - Err on the safe side for now and * assume these aren't there with the PSP2/Vita SDKs. */ /* initialize debug screen */ pspDebugScreenInit(); pspDebugScreenClear(); setup_callback(); pspFpuSetEnable(0); /* disable FPU exceptions */ scePowerSetClockFrequency(333,333,166); #else scePowerSetArmClockFrequency(444); #endif #endif #if defined(HAVE_KERNEL_PRX) || defined(IS_SALAMANDER) #ifndef VITA pspSdkLoadStartModule("kernel_functions.prx", PSP_MEMORY_PARTITION_KERNEL); #endif #endif }
void cefiveuiRedraw(CEFiveUi *prUi) { CEFiveConfig* prCfg = NULL; ColorConfig* prColor = NULL; if (prUi == NULL) { return; } prCfg = prUi->prCEConfig; if (prCfg != NULL) { prColor = cefiveconfig_get_panelcolor(prCfg); } else { prColor = &prUi->config.color; } if (prUi->drawn == 0) { //pspDebugScreenInitEx(prUi->vram, 0, 0); pspDebugScreenSetBackColor(prColor->background); pspDebugScreenClear(); } if (prUi->appletmenu.visible == 1) { draw_applet_menu(prUi); } else { draw_titlebar(prUi); draw_applet(prUi); } prUi->drawn = 1; }
static void frontend_psp_init(void *data) { #ifndef IS_SALAMANDER #ifdef VITA scePowerSetArmClockFrequency(444); sceSysmoduleLoadModule(SCE_SYSMODULE_NET); pthread_init(); #else (void)data; /* initialize debug screen */ pspDebugScreenInit(); pspDebugScreenClear(); setup_callback(); pspFpuSetEnable(0); /* disable FPU exceptions */ scePowerSetClockFrequency(333,333,166); #endif #endif #if defined(HAVE_KERNEL_PRX) || defined(IS_SALAMANDER) #ifndef VITA pspSdkLoadStartModule("kernel_functions.prx", PSP_MEMORY_PARTITION_KERNEL); #endif #endif }
static void system_init(void) { //initialize debug screen pspDebugScreenInit(); pspDebugScreenClear(); setup_callback(); }
void dispException() { // BSOD ! HAHAHA pspDebugScreenInit(); pspDebugScreenSetBackColor(BLUE); pspDebugScreenSetTextColor(WHITE); pspDebugScreenClear(); pspDebugScreenPrintf(exit_err); }
/* main routine */ int gui_main(void) { char rootpath[200]; int filenum; int stubnum; pspDebugScreenInit(); pspDebugScreenClear(); sprintf(rootpath, "ms0:/PSP/MUSIC/"); fillmedialist(rootpath); loopmode = !0; // Loop around, offering a mod, till they cancel filenum = 1; forceskip = 0; while (filenum >= 0) { // Setup screen so it doesnt get messy pspDebugScreenClear(); printf("%s\n\n", banner); { // Print out a list of the file extensions supported int c; printf("filetypes : "); for (c = 0; c < codecnum; c++) { unsigned char *ptr = stubs[c].extension; while (*ptr != 0) { printf("%s ", ptr); ptr += 4; } } printf("\n\n"); } // Filetype list printf("Media Path: %s\n\n", rootpath); filenum = selectmedia(); if (filenum >= 0) { playmedia(files_info[filenum].pathname, files_info[filenum].filename); } } return 0; }
static void frontend_psp_init(void *data) { (void)data; //initialize debug screen pspDebugScreenInit(); pspDebugScreenClear(); setup_callback(); pspFpuSetEnable(0);//disable FPU exceptions scePowerSetClockFrequency(333,333,166); }
void ExceptionHandler(PspDebugRegBlock * regs) { int i; SceCtrlData pad; pspDebugScreenInit(); pspDebugScreenSetBackColor(0x00FF0000); pspDebugScreenSetTextColor(0xFFFFFFFF); pspDebugScreenClear(); pspDebugScreenPrintf("Your PSP has just crashed!\n"); pspDebugScreenPrintf("Exception details:\n\n"); pspDebugScreenPrintf("Exception - %s\n", codeTxt[(regs->cause >> 2) & 31]); pspDebugScreenPrintf("EPC - %08X / %s.text + %08X\n", (int)regs->epc, module_info.modname, (unsigned int)(regs->epc-(int)&_ftext)); pspDebugScreenPrintf("Cause - %08X\n", (int)regs->cause); pspDebugScreenPrintf("Status - %08X\n", (int)regs->status); pspDebugScreenPrintf("BadVAddr - %08X\n", (int)regs->badvaddr); for(i=0; i<32; i+=4) pspDebugScreenPrintf("%s:%08X %s:%08X %s:%08X %s:%08X\n", regName[i], (int)regs->r[i], regName[i+1], (int)regs->r[i+1], regName[i+2], (int)regs->r[i+2], regName[i+3], (int)regs->r[i+3]); sceKernelDelayThread(1000000); pspDebugScreenPrintf("\n\nPress X to dump information on file exception.log and quit"); pspDebugScreenPrintf("\nPress O to quit"); for (;;){ sceCtrlReadBufferPositive(&pad, 1); if (pad.Buttons & PSP_CTRL_CROSS){ char filename[MAX_FILE]; sprintf(filename, "%s/exception.log", main_path); FILE *log = fopen(filename, "w"); if (log != NULL){ char testo[512]; sprintf(testo, "Exception details:\n\n"); fwrite(testo, 1, strlen(testo), log); sprintf(testo, "Exception - %s\n", codeTxt[(regs->cause >> 2) & 31]); fwrite(testo, 1, strlen(testo), log); sprintf(testo, "EPC - %08X / %s.text + %08X\n", (int)regs->epc, module_info.modname, (unsigned int)(regs->epc-(int)&_ftext)); fwrite(testo, 1, strlen(testo), log); sprintf(testo, "Cause - %08X\n", (int)regs->cause); fwrite(testo, 1, strlen(testo), log); sprintf(testo, "Status - %08X\n", (int)regs->status); fwrite(testo, 1, strlen(testo), log); sprintf(testo, "BadVAddr - %08X\n", (int)regs->badvaddr); fwrite(testo, 1, strlen(testo), log); for(i=0; i<32; i+=4){ sprintf(testo, "%s:%08X %s:%08X %s:%08X %s:%08X\n", regName[i], (int)regs->r[i], regName[i+1], (int)regs->r[i+1], regName[i+2], (int)regs->r[i+2], regName[i+3], (int)regs->r[i+3]); fwrite(testo, 1, strlen(testo), log); } fclose(log); } break; }else if (pad.Buttons & PSP_CTRL_CIRCLE){
void MyExceptionHandler(PspDebugRegBlock *regs) { /* Do normal initial dump, setup screen etc */ pspDebugScreenInit(); pspDebugScreenSetBackColor(0x00FF0000); pspDebugScreenSetTextColor(0xFFFFFFFF); pspDebugScreenClear(); pspDebugScreenPrintf("Exception Details:\n"); pspDebugDumpException(regs); while (1) ; }
void _main(SceSize args, void *argp) { static SceUID modid; static int retVal, status; static SceKernelLMOption option; extern u8 *payload; extern u32 size_payload; extern u32 size_payload_uncomp; u8 *buffer; SceUID bufferBlock; pspDebugScreenInit(); pspDebugScreenClear(); pspDebugInstallKprintfHandler(NULL); //pspDebugInstallErrorHandler(NULL); pspSdkInstallNoPlainModuleCheckPatch(); memset(&option, 0, sizeof(option)); option.size = sizeof(option); option.mpidtext = 1; option.mpiddata = 1; option.position = 0; option.access = 1; bufferBlock = sceKernelAllocPartitionMemory(2, "PSPPackerBuffer", PSP_SMEM_High, size_payload_uncomp, NULL); if (bufferBlock < 0) { printf("allocpartitionmemory failed with 0x%08X\n", bufferBlock); goto exit; } buffer = sceKernelGetBlockHeadAddr(bufferBlock); retVal = sceKernelGzipDecompress(buffer, size_payload_uncomp, (u8*)&payload, 0); if (retVal < 0) { printf("sceKernelGzipDecompress failed with 0x%08X\n", retVal); goto exit; } modid = sceKernelLoadModuleBufferUsbWlan(size_payload, buffer, 0, &option); retVal = sceKernelFreePartitionMemory(bufferBlock); if (retVal < 0) printf("Error freeing decompress buffer (0x%08X)\n", retVal); if(modid > 0) retVal = sceKernelStartModule(modid, 0, NULL, &status, NULL); exit: /* Let's bug out */ //sceKernelSelfStopUnloadModule(0, 0, NULL); //return 0; sceKernelExitDeleteThread(0); }
// Print out an error message and quit after user input void error( char* msg ) { SceCtrlData pad; pspDebugScreenClear(); pspDebugScreenSetXY(0, 0); printf(msg); printf("Press X to quit.\n"); while (isrunning) { sceCtrlReadBufferPositive(&pad, 1); if (pad.Buttons & PSP_CTRL_CROSS) break; sceDisplayWaitVblankStart(); } sceKernelExitGame(); }
void throwError(int milisecs, char *fmt, ...) { va_list list; char msg[256]; va_start(list, fmt); vsprintf(msg, fmt, list); va_end(list); pspDebugScreenInit(); pspDebugScreenClear(); pspDebugScreenPrintf(msg); sceKernelDelayThread(milisecs * 1000); sceKernelExitGame(); }
/* Example custom exception handler */ void MyExceptionHandler(PspDebugRegBlock *regs) { /* Do normal initial dump, setup screen etc */ pspDebugScreenInit(); /* I always felt BSODs were more interesting that white on black */ pspDebugScreenSetBackColor(0x00FF0000); pspDebugScreenSetTextColor(0xFFFFFFFF); pspDebugScreenClear(); pspDebugScreenPrintf("I regret to inform you your psp has just crashed\n"); pspDebugScreenPrintf("Please contact Sony technical support for further information\n\n"); pspDebugScreenPrintf("Exception Details:\n"); pspDebugDumpException(regs); pspDebugScreenPrintf("\nBlame the 3rd party software, it cannot possibly be our fault!\n"); }
static void frontend_psp_init(void *data) { #ifndef IS_SALAMANDER (void)data; //initialize debug screen pspDebugScreenInit(); pspDebugScreenClear(); setup_callback(); pspFpuSetEnable(0);//disable FPU exceptions scePowerSetClockFrequency(333,333,166); #endif #if defined(HAVE_KERNEL_PRX) || defined(IS_SALAMANDER) pspSdkLoadStartModule("kernel_functions.prx", PSP_MEMORY_PARTITION_KERNEL); #endif }
int main(int argc, char *argv[]) { SceCtrlData pad; char *dir, *slash; pspDebugScreenInit(); pspDebugScreenClear(); printf("Testing HBL\n\n"); testFreeRam(); testFrequencies(); testMd5(); dir = argv[0]; if (dir == NULL) { puts("error: argv[0] == NULL"); goto skipDread; } slash = strrchr(dir, '/'); if (slash == NULL) { printf("error: no slash in argv[0]: %s\n", dir); goto skipDread; } *slash = 0; testIoDread(dir); skipDread: printf("\nPress X to exit\n\n"); do { sceCtrlReadBufferPositive(&pad, 1); } while(!(pad.Buttons & PSP_CTRL_CROSS)); printf("Exiting...\n"); sceKernelExitGame(); return 0; }
int main(int argc, char *argv[]) { int i; pspDebugScreenInit(); SceUID mod = pspSdkLoadStartModule ("flash0:/kd/chnnlsv.prx",PSP_MEMORY_PARTITION_KERNEL); if (mod < 0) { printf("Error 0x%08X loading/starting chnnlsv.prx.\n", mod); } mod = pspSdkLoadStartModule ("kernelcall.prx",PSP_MEMORY_PARTITION_KERNEL); if (mod < 0) { printf("Error 0x%08X loading/starting kernelcall.prx.\n", mod); } sceCtrlSetSamplingCycle(0); sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG); for(;;) { printf("===================================================================="); printf("PPSSPP Save Tool\n"); printf("====================================================================\n\n\n"); switch(currentMenu) { case 0: { int maxOption = 0; for(i = 0; menuList0[i]; i++) { if(i == selectedOption) printf(" > %s\n",menuList0[i]); else printf(" %s\n",menuList0[i]); maxOption++; } int input = ProcessInput(maxOption, &selectedOption); if(input == 0) { currentMenu = 1; selectedOption = 0; } else if(input == 1) { currentMenu = 4; selectedOption = 0; } else if(input == 2) { sceKernelExitGame(); } } break; case 4: case 1: { int maxOption = 0; printf("PPSSPP Decrypted Save Directory : \n"); for(i = 0; menuList1[i]; i++) { if(i == selectedOption) printf(" > %s\n",menuList1[i]); else printf(" %s\n",menuList1[i]); maxOption++; } int input = ProcessInput(maxOption, &selectedOption); if(input == maxOption-1) { if(currentMenu == 1) selectedOption = 0; else selectedOption = 1; currentMenu = 0; } else if(input >= 0) { basePath = selectedOption; if(currentMenu == 1) { currentMenu = 2; UpdateValidDir(1); } else { currentMenu = 5; UpdateValidDir(0); } selectedOption = 0; } } break; case 5: case 2: { int maxOption = 0; if(currentMenu == 2) printf("Save to encrypt : \n"); else printf("Save to decrypt : \n"); if(numDirList == 0) { printf("No compatible data, see README for help on use\n"); } for(i = 0; i < numDirList; i++) { if(i == selectedOption) printf(" > %s\n",dirList[i].name); else printf(" %s\n",dirList[i].name); maxOption++; } for(i = 0; menuList2[i]; i++) { if((i+numDirList) == selectedOption) printf(" > %s\n",menuList2[i]); else printf(" %s\n",menuList2[i]); maxOption++; } printf("\n Invalid path : \n"); for(i = 0; i < numInvalidDirList && i < (22-numDirList); i++) { switch(invalidDirList[i].errorId) { case 1: printf(" %s : ENCRYPT_INFO.BIN not found\n",invalidDirList[i].name); break; case 2: printf(" %s : ENCRYPT_INFO.BIN read error\n",invalidDirList[i].name); break; case 3: printf(" %s : ENCRYPT_INFO.BIN wrong version\n",invalidDirList[i].name); break; case 4: printf(" %s : PARAM.SFO not found\n",invalidDirList[i].name); break; case 5: printf(" %s : PARAM.SFO read error\n",invalidDirList[i].name); break; case 6: printf(" %s : SAVEDATA_FILE_LIST not found in PARAM.SFO\n",invalidDirList[i].name); break; case 7: printf(" %s : no save name in SAVEDATA_FILE_LIST\n",invalidDirList[i].name); break; case 8: printf(" %s : no save found\n",invalidDirList[i].name); break; default: break; } } int input = ProcessInput(maxOption, &selectedOption); if(input == numDirList) { if(currentMenu == 2) currentMenu = 1; else currentMenu = 4; selectedOption = basePath; } else if(input >= 0) { if(currentMenu == 2) currentMenu = 3; else currentMenu = 6; workDir = input; selectedOption = 0; } } break; case 6: case 3: { EncryptFileInfo encryptInfo; if(FileRead(menuList1[basePath], dirList[workDir].name, "ENCRYPT_INFO.BIN",(u8*)&encryptInfo,sizeof(encryptInfo)) < 0) { printf("Can't read encrypt file\n"); } else { printf("Key : "); for(i = 0; i < 16; i++) printf(" %02x",(u8)encryptInfo.key[i]); printf("\n"); printf("SDK Version : 0x%x\n",encryptInfo.sdkVersion); char srcPath[128]; char dstPath[128]; if(currentMenu == 3) { sprintf(srcPath,"%s%s",menuList1[basePath], dirList[workDir].name); sprintf(dstPath,"ms0:/PSP/SAVEDATA/%s",dirList[workDir].name); sceIoMkdir(dstPath,0777); } else { sprintf(srcPath,"ms0:/PSP/SAVEDATA/%s",dirList[workDir].name); sprintf(dstPath,"%s%s",menuList1[basePath], dirList[workDir].name); } int dfd; dfd = sceIoDopen(srcPath); if(dfd >= 0) { SceIoDirent dirinfo; while(sceIoDread(dfd, &dirinfo) > 0) { if(!(dirinfo.d_stat.st_mode & 0x2000)) // is not a file continue; if(strcmp(dirinfo.d_name,"ENCRYPT_INFO.BIN") == 0) // don't copy encrypt info continue; FileCopy(srcPath, dstPath, dirinfo.d_name); } sceIoDclose(dfd); } if(currentMenu == 3) { char decryptedFile[258], encryptedFile[258], srcSFO[258], dstSFO[258]; sprintf(decryptedFile,"%s/%s",srcPath ,dirList[workDir].saveFile); sprintf(srcSFO,"%s/PARAM.SFO",srcPath); sprintf(encryptedFile,"%s/%s",dstPath ,dirList[workDir].saveFile); sprintf(dstSFO,"%s/PARAM.SFO",dstPath); printf("Encoding %s into %s\n",decryptedFile, encryptedFile); int ret = encrypt_file(decryptedFile, encryptedFile, dirList[workDir].saveFile, srcSFO, dstSFO, encryptInfo.key[0] != 0 ? encryptInfo.key : NULL, GetSDKMainVersion(encryptInfo.sdkVersion) ); if(ret < 0) { printf("Error: encrypt_file() returned %d\n\n", ret); } else { printf("Successfully wrote %d bytes to\n", ret); printf(" %s\n", encryptedFile); printf("and updated hashes in\n"); printf(" %s\n\n", dstSFO); } } else { char decryptedFile[258], encryptedFile[258]; sprintf(encryptedFile,"%s/%s",srcPath ,dirList[workDir].saveFile); sprintf(decryptedFile,"%s/%s",dstPath ,dirList[workDir].saveFile); printf("Decoding %s into %s\n",encryptedFile, decryptedFile); int ret = decrypt_file(decryptedFile, encryptedFile, encryptInfo.key[0] != 0 ? encryptInfo.key : NULL, GetSDKMainVersion(encryptInfo.sdkVersion)); if(ret < 0) { printf("Error: decrypt_file() returned %d\n\n", ret); } else { printf("Successfully wrote %d bytes to\n", ret); printf(" %s\n", decryptedFile); } } printf(" > Back\n"); int input = ProcessInput(1, &selectedOption); if(input >= 0) { if(currentMenu == 3) currentMenu = 2; else currentMenu = 5; selectedOption = 0; } } } break; default: sceKernelExitGame(); break; } pspDebugScreenClear(); sceDisplayWaitVblankStart(); sceGuSwapBuffers(); } return 0; }
/* main routine */ int main(int argc, char *argv[]) { SceCtrlData pad; //init screen and callbacks pspDebugScreenInit(); pspDebugScreenClear(); SetupCallbacks(); // Setup Pad sceCtrlSetSamplingCycle(0); sceCtrlSetSamplingMode(0); // Load modules int status = sceUtilityLoadModule(PSP_MODULE_AV_AVCODEC); if (status<0) { ERRORMSG("ERROR: sceUtilityLoadModule(PSP_MODULE_AV_AVCODEC) returned 0x%08X\n", status); } status = sceUtilityLoadModule(PSP_MODULE_AV_MP3); if (status<0) { ERRORMSG("ERROR: sceUtilityLoadModule(PSP_MODULE_AV_MP3) returned 0x%08X\n", status); } // Open the input file int fd = sceIoOpen( MP3FILE, PSP_O_RDONLY, 0777 ); if (fd<0) { ERRORMSG("ERROR: Could not open file '%s' - 0x%08X\n", MP3FILE, fd); } // Init mp3 resources status = sceMp3InitResource(); if (status<0) { ERRORMSG("ERROR: sceMp3InitResource returned 0x%08X\n", status); } // Reserve a mp3 handle for our playback SceMp3InitArg mp3Init; mp3Init.mp3StreamStart = 0; mp3Init.mp3StreamEnd = sceIoLseek32( fd, 0, SEEK_END ); mp3Init.unk1 = 0; mp3Init.unk2 = 0; mp3Init.mp3Buf = mp3Buf; mp3Init.mp3BufSize = sizeof(mp3Buf); mp3Init.pcmBuf = pcmBuf; mp3Init.pcmBufSize = sizeof(pcmBuf); int handle = sceMp3ReserveMp3Handle( &mp3Init ); if (handle<0) { ERRORMSG("ERROR: sceMp3ReserveMp3Handle returned 0x%08X\n", handle); } // Fill the stream buffer with some data so that sceMp3Init has something to work with fillStreamBuffer( fd, handle ); status = sceMp3Init( handle ); if (status<0) { ERRORMSG("ERROR: sceMp3Init returned 0x%08X\n", status); } int channel = -1; int samplingRate = sceMp3GetSamplingRate( handle ); int numChannels = sceMp3GetMp3ChannelNum( handle ); int lastDecoded = 0; int volume = PSP_AUDIO_VOLUME_MAX; int numPlayed = 0; int paused = 0; int lastButtons = 0; int loop = 0; while (isrunning) { sceDisplayWaitVblankStart(); pspDebugScreenSetXY(0, 0); printf("PSP Mp3 Sample v1.0 by Raphael\n\n"); printf("Playing '%s'...\n", MP3FILE); printf(" %i Hz\n", samplingRate); printf(" %i kbit/s\n", sceMp3GetBitRate( handle )); printf(" %s\n", numChannels==2?"Stereo":"Mono"); printf(" %s\n\n", loop==0?"No loop":"Loop"); int playTime = samplingRate>0?numPlayed / samplingRate:0; printf(" Playtime: %02i:%02i\n", playTime/60, playTime%60 ); printf("\n\n\nPress CIRCLE to Pause/Resume playback\nPress TRIANGLE to reset playback\nPress CROSS to switch loop mode\nPress SQUARE to stop playback and quit\n"); if (!paused) { // Check if we need to fill our stream buffer if (sceMp3CheckStreamDataNeeded( handle )>0) { fillStreamBuffer( fd, handle ); } // Decode some samples short* buf; int bytesDecoded; int retries = 0; // We retry in case it's just that we reached the end of the stream and need to loop for (; retries<1; retries++) { bytesDecoded = sceMp3Decode( handle, &buf ); if (bytesDecoded>0) break; if (sceMp3CheckStreamDataNeeded( handle )<=0) break; if (!fillStreamBuffer( fd, handle )) { numPlayed = 0; } } if (bytesDecoded<0 && bytesDecoded!=0x80671402) { ERRORMSG("ERROR: sceMp3Decode returned 0x%08X\n", bytesDecoded); } // Nothing more to decode? Must have reached end of input buffer if (bytesDecoded==0 || bytesDecoded==0x80671402) { paused = 1; sceMp3ResetPlayPosition( handle ); numPlayed = 0; } else { // Reserve the Audio channel for our output if not yet done if (channel<0 || lastDecoded!=bytesDecoded) { if (channel>=0) sceAudioSRCChRelease(); channel = sceAudioSRCChReserve( bytesDecoded/(2*numChannels), samplingRate, numChannels ); } // Output the decoded samples and accumulate the number of played samples to get the playtime numPlayed += sceAudioSRCOutputBlocking( volume, buf ); } } sceCtrlPeekBufferPositive(&pad, 1); if (pad.Buttons!=lastButtons) { if (pad.Buttons & PSP_CTRL_CIRCLE) { paused ^= 1; } if (pad.Buttons & PSP_CTRL_TRIANGLE) { // Reset the stream and playback status sceMp3ResetPlayPosition( handle ); numPlayed = 0; } if (pad.Buttons & PSP_CTRL_CROSS) { loop = (loop==0?-1:0); status = sceMp3SetLoopNum( handle, loop ); if (status<0) { ERRORMSG("ERROR: sceMp3SetLoopNum returned 0x%08X\n", status); } } if (pad.Buttons & PSP_CTRL_SQUARE) { break; } lastButtons = pad.Buttons; } } // Cleanup time... if (channel>=0) sceAudioSRCChRelease(); status = sceMp3ReleaseMp3Handle( handle ); if (status<0) { ERRORMSG("ERROR: sceMp3ReleaseMp3Handle returned 0x%08X\n", status); } status = sceMp3TermResource(); if (status<0) { ERRORMSG("ERROR: sceMp3TermResource returned 0x%08X\n", status); } status = sceIoClose( fd ); if (status<0) { ERRORMSG("ERROR: sceIoClose returned 0x%08X\n", status); } sceKernelExitGame(); return 0; }
int main() { pspDebugScreenInit(); pspDebugScreenSetBackColor(0xFF0000); pspDebugScreenSetTextColor(0x00FFFF); pspDebugScreenClear(); printf("Recovery Mode by Dark_Alex, in-eboot by BlackSith\n\n\n\n"); printf("Press start to activate USB Mass.\n"); printf("Press triangle to flash ms0:/index.dat to flash0.\n"); printf("Press cross to start the program under ms0:/PSP/GAME/UPDATE/EBOOT.PBP\n"); printf("Press home to exit.\n\n\n\n"); sceIoUnassign("flash0:"); sceIoAssign("flash0:", "lflash0:0,0", "flashfat0:", IOASSIGN_RDWR, NULL, 0); while (1) { SceCtrlData pad; int keyprocessed = 0; sceCtrlReadBufferPositive(&pad, 1); if (pad.Buttons & PSP_CTRL_START) { start_usb(); printf("Usb started.\n"); keyprocessed = 1; } else if (pad.Buttons & PSP_CTRL_TRIANGLE) { if (copy_file("ms0:/index.dat", "flash0:/vsh/etc/index.dat") < 0) printf("Cannot copy file. (file missing?).\n"); else printf("File copied succesfully.\n"); keyprocessed = 1; } else if (pad.Buttons & PSP_CTRL_CROSS) { struct SceKernelLoadExecParam param; memset(¶m, 0, sizeof(param)); param.size = sizeof(param); param.args = strlen(PROGRAM)+1; param.argp = PROGRAM; param.key = "updater"; printf("Starting program...\n"); sceKernelLoadExec(PROGRAM, ¶m); keyprocessed = 1; } else if (pad.Buttons & PSP_CTRL_HOME) { break; } sceKernelDelayThread((keyprocessed) ? 200000 : 50000); } sceKernelExitGame(); return 0; }
int main_thread(SceSize args, void *argp) { sceKernelDelayThread(3000000); u32 keycombination; SceCtrlData pad; u32 oldButtons = 0; int extra = 0; keycombination = PSP_CTRL_RTRIGGER; //Button to start interpreter (Basic) u32 keycombination2 = PSP_CTRL_RTRIGGER + PSP_CTRL_LTRIGGER; // Button to start interpreter (Extra PSP Go) while(1){ oldButtons = pad.Buttons; if (go==0){ sceCtrlPeekBufferPositive(&pad, 1); if(oldButtons != pad.Buttons) { if(pad.Buttons & keycombination2) { pauseGame(thid1); go=1; extra=1; pspDebugScreenInit(); pspDebugScreenClear(); oldButtons = pad.Buttons; }else if(pad.Buttons & keycombination) { pauseGame(thid1); go=1; pspDebugScreenInit(); pspDebugScreenClear(); oldButtons = pad.Buttons; } } } if (go ==1){ pspDebugScreenSetXY(0,0); pspDebugScreenSetTextColor(0xffffff); int go2=1; SceUID id; if (((kuKernelGetModel() + 1) == 4) || ((kuKernelGetModel() + 1) == 5)){ if (extra==1){ id = sceIoDopen("ms0:/seplugins/script"); //PSP Go MS Support }else{ id = sceIoDopen("ef0:/seplugins/script"); //PSP Go Internal HD Support } }else{ id = sceIoDopen("ms0:/seplugins/script"); } SceIoDirent entry; int script_files = -2; memset(&entry, 0, sizeof(SceIoDirent)); while (sceIoDread(id, &entry) > 0) { script_files = script_files+1; memset(&entry, 0, sizeof(SceIoDirent)); } sceIoDclose(id); char script[256]; if (((kuKernelGetModel() + 1) == 4) || ((kuKernelGetModel() + 1) == 5)){ if (extra==1){ strcpy(script,"ms0:/seplugins/script/index.lua"); //PSP Go MS Support }else{ strcpy(script,"ef0:/seplugins/script/index.lua"); //PSP Go Internal HD Support } }else{ strcpy(script,"ms0:/seplugins/script/index.lua"); } while(go2==1) { const char *errMsg; if (script_files>1){ errMsg = runScript(extralibs, true); }else{ SceUID fp = sceIoOpen(script, PSP_O_RDONLY,0777); int size = sceIoLseek(fp, 0, SEEK_END); sceIoLseek(fp, 0, SEEK_SET); unsigned char *buffer; buffer = malloc((size+1) * sizeof (char)); sceIoRead(fp, buffer, size); buffer[size]=0; sceIoClose(fp); errMsg = runScript(buffer, true); free(buffer); } // System.restart sourcecode if (strstr(errMsg, "lpp_restart")){ go2=0; // End System.restart sources // Temp replacing for loadfile/dofile functions: System.protodofile }else if (strstr(errMsg, "lpp_open")){ char dum1[20], dum2[20], dum3[20]; char script_path2[256]; sscanf( errMsg, "%s %s %s %s", dum1, dum2, dum3, script_path2 ); strcpy(script,script_path2); script_files=1; // End System.protodofile sources }else if (strstr(errMsg, "resumeThread")){ go=0; go2=0; }else{ if (errMsg != NULL); { pspDebugScreenClear(); pspDebugScreenSetTextColor(0xffffff); debugOutput("\nError: %s\n", errMsg); } debugOutput("\nPress start to restart\nPress select to resume thread\n"); SceCtrlData pad; int restore = 0; while(restore==0){ sceCtrlPeekBufferPositive(&pad, 1); if (pad.Buttons&PSP_CTRL_START){ restore=1; go2=0; } if (pad.Buttons&PSP_CTRL_SELECT){ resumeGame(thid1); restore=1; go=0; go2=0; } } } } } sceDisplayWaitVblankStart(); } sceKernelSleepThread(); return 0; }
static void playmedia(char *rootpath, char *modname) { char filename[200]; u32 buttonsold; SceCtrlData pad; u32 remoteButtons, remoteButtonsOld = 0; int codec; int finished = 0; filename[0] = 0; strcat2(filename, rootpath); strcat2(filename, modname); pspDebugScreenClear(); printf("%s\n\n", banner); printf("loading media File : %s\n", modname); //determine codec of the file for (codec = 0; codec <= codecnum; codec++) { char *ptr = &(stubs[codec].extension[0]); while (*ptr != 0) { if (strncasecmp(&modname[strlen(modname) - 3], ptr, 3) == 0) { decoder = &stubs[codec]; break; } ptr += 4; } } decoder->init(0); if (decoder->load(filename)) { decoder->play(); pspDebugScreenSetXY(0, 32); printf("X = Pause/Resume. START = Tune Select\n"); pspDebugScreenSetXY(0, 26); printf("Playing\n\n"); forceskip = 0; sceCtrlReadBufferPositive(&pad, 1); sceHprmPeekCurrentKey(&remoteButtons); buttonsold = pad.Buttons; remoteButtonsOld = remoteButtons; while (finished == 0) { sceDisplayWaitVblankStart(); sceCtrlReadBufferPositive(&pad, 1); sceHprmPeekCurrentKey(&remoteButtons); // Check if we have hit the end of tune if (loopmode != 0) { if (decoder->eos != 0) { if (decoder->eos() == 1) { // End of file, advance in playlist pad.Buttons = PSP_CTRL_RTRIGGER; } } } if (pad.Buttons != buttonsold) { if (pad.Buttons & PSP_CTRL_LTRIGGER) { // Previous tune forceskip = 1; finished = 1; } if (pad.Buttons & PSP_CTRL_RTRIGGER) { // Next tune forceskip = 2; finished = 1; } if (pad.Buttons & PSP_CTRL_TRIANGLE) loopmode = !loopmode; if (pad.Buttons & PSP_CTRL_CIRCLE) decoder->stop(); if (pad.Buttons & PSP_CTRL_CROSS) decoder->pause(); if (pad.Buttons & PSP_CTRL_START) finished = 1; buttonsold = pad.Buttons; } if (remoteButtons != remoteButtonsOld && !(remoteButtons & PSP_HPRM_HOLD)) { if (remoteButtons & PSP_HPRM_PLAYPAUSE) decoder->pause(); if (remoteButtons & PSP_HPRM_BACK) { forceskip = 1; finished = 1; } if (remoteButtons & PSP_HPRM_FORWARD) { forceskip = 2; finished = 1; } remoteButtonsOld = remoteButtons; } // Show loop status pspDebugScreenSetXY(58, 1); if (loopmode == 0) { printf(" LOOP "); } else { printf("ADVANCE"); } // Show the time if (decoder->time != NULL) { char time[200]; decoder->time(time); pspDebugScreenSetXY(58, 0); printf("%s", time); pspDebugScreenSetXY(0, 32); } } decoder->stop(); decoder->end(); } }
//************************************************************************************* //Used to check for compatible FW, we don't allow anything lower than 4.01 //************************************************************************************* static void DaedalusFWCheck() { // ##define PSP_FIRMWARE Borrowed from Davee #define PSP_FIRMWARE(f) ((((f >> 8) & 0xF) << 24) | (((f >> 4) & 0xF) << 16) | ((f & 0xF) << 8) | 0x10) u32 ver = sceKernelDevkitVersion(); /* FILE * fh = fopen( "firmware.txt", "a" ); if ( fh ) { fprintf( fh, "version=%d, firmware=0x%08x\n", kuKernelGetModel(), ver ); fclose(fh); } */ if( (ver < PSP_FIRMWARE(0x401)) ) { pspDebugScreenInit(); pspDebugScreenSetTextColor(0xffffff); pspDebugScreenSetBackColor(0x000000); pspDebugScreenSetXY(0, 0); pspDebugScreenClear(); pspDebugScreenPrintf( "\n" ); pspDebugScreenPrintf("XXXXXXX XXXXXXX 66666666 444444444\n" ); pspDebugScreenPrintf("X:::::X X:::::X 6::::::6 4::::::::4\n" ); pspDebugScreenPrintf("X:::::X X:::::X 6::::::6 4:::::::::4\n" ); pspDebugScreenPrintf("X::::::X X::::::X 6::::::6 4::::44::::4\n" ); pspDebugScreenPrintf("XXX:::::X X:::::XXX 6::::::6 4::::4 4::::4\n" ); pspDebugScreenPrintf(" X:::::X X:::::X 6::::::6 4::::4 4::::4\n" ); pspDebugScreenPrintf(" X:::::X:::::X 6::::::6 4::::4 4::::4\n" ); pspDebugScreenPrintf(" X:::::::::X 6::::::::66666 4::::444444::::444\n" ); pspDebugScreenPrintf(" X:::::::::X 6::::::::::::::66 4::::::::::::::::4\n" ); pspDebugScreenPrintf( " X:::::X:::::X 6::::::66666:::::64444444444:::::444\n" ); pspDebugScreenPrintf(" X:::::X X:::::X 6:::::6 6:::::6 4::::4\n" ); pspDebugScreenPrintf("XXX:::::X X:::::XXX6:::::6 6:::::6 4::::4\n" ); pspDebugScreenPrintf("X::::::X X::::::X6::::::66666::::::6 4::::4\n" ); pspDebugScreenPrintf("X:::::X X:::::X 66:::::::::::::66 44::::::44\n" ); pspDebugScreenPrintf("X:::::X X:::::X 66:::::::::66 4::::::::4\n" ); pspDebugScreenPrintf("XXXXXXX XXXXXXX 666666666 4444444444\n" ); pspDebugScreenPrintf( "\n" ); pspDebugScreenPrintf( "\n" ); pspDebugScreenPrintf( "--------------------------------------------------------------------\n" ); pspDebugScreenPrintf( "\n" ); pspDebugScreenPrintf( " Unsupported Firmware Detected : 0x%08X\n", ver ); pspDebugScreenPrintf( "\n" ); pspDebugScreenPrintf( " Daedalus requires atleast 4.01 M33 Custom Firmware\n" ); pspDebugScreenPrintf( "\n" ); pspDebugScreenPrintf( "--------------------------------------------------------------------\n" ); sceKernelDelayThread(1000000); pspDebugScreenPrintf( "\n" ); pspDebugScreenPrintf( "\n" ); pspDebugScreenPrintf( "\n" ); pspDebugScreenPrintf("\nPress O to Exit or [] to Ignore"); for (;;) { SceCtrlData pad; sceCtrlPeekBufferPositive(&pad, 1); if (pad.Buttons & PSP_CTRL_CIRCLE) break; if (pad.Buttons & PSP_CTRL_SQUARE) return; } sceKernelExitGame(); } }