int load_me_prx(void) { int result; if (me_prx_loaded) return 0; #if (PSP_FW_VERSION >= 300) result = xrUtilityLoadAvModule(PSP_AV_MODULE_AVCODEC); #else result = pspSdkLoadStartModule("flash0:/kd/avcodec.prx", PSP_MEMORY_PARTITION_KERNEL); #endif if (result < 0) return -1; #if (PSP_FW_VERSION >= 300) result = xrUtilityLoadAvModule(PSP_AV_MODULE_ATRAC3PLUS); if (result < 0) return -2; #endif me_prx_loaded = true; return 0; }
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 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 start_usb() { pspSdkLoadStartModule("flash0:/kd/semawm.prx", PSP_MEMORY_PARTITION_KERNEL); pspSdkLoadStartModule("flash0:/kd/usbstor.prx", PSP_MEMORY_PARTITION_KERNEL); pspSdkLoadStartModule("flash0:/kd/usbstormgr.prx", PSP_MEMORY_PARTITION_KERNEL); pspSdkLoadStartModule("flash0:/kd/usbstorms.prx", PSP_MEMORY_PARTITION_KERNEL); pspSdkLoadStartModule("flash0:/kd/usbstorboot.prx", PSP_MEMORY_PARTITION_KERNEL); sceUsbStart(PSP_USBBUS_DRIVERNAME, 0, 0); sceUsbStart(PSP_USBSTOR_DRIVERNAME, 0, 0); sceUsbstorBootSetCapacity(0x800000); sceUsbActivate(0x1c8); usbStarted = 1; }
int main(int argc, char *argv[]) { SceUID mod; char s[255]; int r; int SDCB1, SDCB2; sceKernelDelayThread(7000000); mod = pspSdkLoadStartModule("ms0:/seplugins/deemerd.prx", PSP_MEMORY_PARTITION_KERNEL); if (mod < 0) { sprintf(s, "Error 0x%08X loading/starting deemerd.prx.\n", mod); debugIssueError(s); } SDCB1 = sceKernelCreateCallback("SaveDataStartCallback", hcDeemerCapturedSDParamsCallback, NULL ); SDCB2 = sceKernelCreateCallback("SaveDataGetStatusCallback", hcDeemerSavedataGetStatusCallback, NULL ); hcDeemerDriverSetupCallbackCapturedSDParams(SDCB1, SDCB2); r = hcDeemerDriverPatchSavedataInitStart(); sceKernelSleepThreadCB(); return 0; }
/* Must be called from KERNEL thread */ int pspAdhocLoadDrivers() { _net_adhoc_matching_start = 0; _net_adhoc_matching_create = 0; _net_adhoc_matching_init = 0; _net_adhoc_pdp_create = 0; _net_adhoc_ctl_connect = 0; _net_adhoc_ctl_init = 0; _net_adhoc_init = 0; _net_init = 0; #if (_PSP_FW_VERSION < 200) int modID; modID = pspSdkLoadStartModule("flash0:/kd/ifhandle.prx", PSP_MEMORY_PARTITION_KERNEL); if (modID < 0) return modID; modID = pspSdkLoadStartModule("flash0:/kd/memab.prx", PSP_MEMORY_PARTITION_KERNEL); if (modID < 0) return modID; modID = pspSdkLoadStartModule("flash0:/kd/pspnet_adhoc_auth.prx", PSP_MEMORY_PARTITION_KERNEL); if (modID < 0) return modID; modID = pspSdkLoadStartModule("flash0:/kd/pspnet.prx", PSP_MEMORY_PARTITION_USER); if (modID < 0) return modID; else pspSdkFixupImports(modID); modID = pspSdkLoadStartModule("flash0:/kd/pspnet_adhoc.prx", PSP_MEMORY_PARTITION_USER); if (modID < 0) return modID; else pspSdkFixupImports(modID); modID = pspSdkLoadStartModule("flash0:/kd/pspnet_adhocctl.prx", PSP_MEMORY_PARTITION_USER); if (modID < 0) return modID; else pspSdkFixupImports(modID); modID = pspSdkLoadStartModule("flash0:/kd/pspnet_adhoc_matching.prx", PSP_MEMORY_PARTITION_USER); if (modID < 0) return modID; else pspSdkFixupImports(modID); sceKernelDcacheWritebackAll(); sceKernelIcacheInvalidateAll(); #else sceUtilityLoadNetModule(PSP_NET_MODULE_COMMON); sceUtilityLoadNetModule(PSP_NET_MODULE_ADHOC); #endif return 1; }
void usbStorage() { pspSdkLoadStartModule("flash0:/kd/chkreg.prx",PSP_MEMORY_PARTITION_KERNEL); pspSdkLoadStartModule("flash0:/kd/npdrm.prx",PSP_MEMORY_PARTITION_KERNEL); pspSdkLoadStartModule("flash0:/kd/semawm.prx",PSP_MEMORY_PARTITION_KERNEL); pspSdkLoadStartModule("flash0:/kd/usbstor.prx",PSP_MEMORY_PARTITION_KERNEL); pspSdkLoadStartModule("flash0:/kd/usbstormgr.prx",PSP_MEMORY_PARTITION_KERNEL); pspSdkLoadStartModule("flash0:/kd/usbstorms.prx",PSP_MEMORY_PARTITION_KERNEL); pspSdkLoadStartModule("flash0:/kd/usbstorboot.prx",PSP_MEMORY_PARTITION_KERNEL); pspSdkLoadStartModule("flash0:/kd/usbdevice.prx",PSP_MEMORY_PARTITION_KERNEL); sceUsbStart(PSP_USBBUS_DRIVERNAME,0,0); sceUsbStart(PSP_USBSTOR_DRIVERNAME,0,0); sceUsbstorBootSetCapacity(0x800000); sceUsbActivate(0x1c8); }
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 pspSdkLoadAdhocModules(void) { int modID; adhoc_modules_loaded = -1; modID = pspSdkLoadStartModule("flash0:/kd/ifhandle.prx", PSP_MEMORY_PARTITION_KERNEL); if (modID < 0) return modID; modID = pspSdkLoadStartModule("flash0:/kd/memab.prx", PSP_MEMORY_PARTITION_KERNEL); if (modID < 0) return modID; modID = pspSdkLoadStartModule("flash0:/kd/pspnet_adhoc_auth.prx", PSP_MEMORY_PARTITION_KERNEL); if (modID < 0) return modID; modID = pspSdkLoadStartModule("flash0:/kd/pspnet.prx", PSP_MEMORY_PARTITION_USER); if (modID < 0) return modID; else pspSdkFixupImports(modID); modID = pspSdkLoadStartModule("flash0:/kd/pspnet_adhoc.prx", PSP_MEMORY_PARTITION_USER); if (modID < 0) return modID; else pspSdkFixupImports(modID); modID = pspSdkLoadStartModule("flash0:/kd/pspnet_adhocctl.prx", PSP_MEMORY_PARTITION_USER); if (modID < 0) return modID; else pspSdkFixupImports(modID); modID = pspSdkLoadStartModule("flash0:/kd/pspnet_adhoc_matching.prx", PSP_MEMORY_PARTITION_USER); if (modID < 0) return modID; else pspSdkFixupImports(modID); adhoc_modules_loaded = 0; 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; }
int main(void) { SetupCallbacks(); int result = pspSdkLoadStartModule("flash0:/kd/audiocodec.prx", PSP_MEMORY_PARTITION_KERNEL); pspSdkFixupImports(result); SceUID at3_handle = sceIoOpen("ms0:/Test.AT3", PSP_O_RDONLY, 0777); if ( ! at3_handle ) goto wait; u32 riff_header[2]; if ( sceIoRead( at3_handle, riff_header, 8 ) != 8 ) goto wait; if ( riff_header[0] != 0x46464952 ) goto wait; u32 wavefmt_header[3]; if ( sceIoRead( at3_handle, wavefmt_header, 12 ) != 12 ) goto wait; if ( wavefmt_header[0] != 0x45564157 || wavefmt_header[1] != 0x20746D66 ) goto wait; u8* wavefmt_data = (u8*)malloc(wavefmt_header[2]); if ( wavefmt_data == NULL ) goto wait; if ( sceIoRead( at3_handle, wavefmt_data, wavefmt_header[2] ) != wavefmt_header[2] ) { free(wavefmt_data); goto wait; } at3_type = *((u16*)wavefmt_data); at3_channels = *((u16*)(wavefmt_data+2)); at3_samplerate = *((u32*)(wavefmt_data+4)); at3_data_align = *((u16*)(wavefmt_data+12)); if ( at3_type == TYPE_ATRAC3PLUS) { at3_at3plus_flagdata[0] = wavefmt_data[42]; at3_at3plus_flagdata[1] = wavefmt_data[43]; } free(wavefmt_data); u32 data_header[2]; if ( sceIoRead( at3_handle, data_header, 8 ) != 8 ) goto wait; while(data_header[0] != 0x61746164 ) { sceIoLseek32(at3_handle, data_header[1], PSP_SEEK_CUR); if ( sceIoRead( at3_handle, data_header, 8 ) != 8 ) goto wait; } at3_data_start = sceIoLseek32(at3_handle, 0, PSP_SEEK_CUR); at3_data_size = data_header[1]; if ( at3_data_size % at3_data_align != 0 ) goto wait; memset(at3_codec_buffer, 0, sizeof(at3_codec_buffer)); if ( at3_type == TYPE_ATRAC3 ) { at3_channel_mode = 0x0; if ( at3_data_align == 0xC0 ) // atract3 have 3 bitrate, 132k,105k,66k, 132k align=0x180, 105k align = 0x130, 66k align = 0xc0 at3_channel_mode = 0x1; at3_sample_per_frame = 1024; at3_data_buffer = (u8*)memalign(64, 0x180); if ( at3_data_buffer == NULL) goto wait; at3_codec_buffer[26] = 0x20; if ( sceAudiocodecCheckNeedMem(at3_codec_buffer, 0x1001) < 0 ) goto wait; if ( sceAudiocodecGetEDRAM(at3_codec_buffer, 0x1001) < 0 ) goto wait; at3_getEDRAM = 1; at3_codec_buffer[10] = 4; at3_codec_buffer[44] = 2; if ( at3_data_align == 0x130 ) at3_codec_buffer[10] = 6; if ( sceAudiocodecInit(at3_codec_buffer, 0x1001) < 0 ) { goto wait; } } else if ( at3_type == TYPE_ATRAC3PLUS ) { at3_sample_per_frame = 2048; int temp_size = at3_data_align+8; int mod_64 = temp_size & 0x3f; if (mod_64 != 0) temp_size += 64 - mod_64; at3_data_buffer = (u8*)memalign(64, temp_size); if ( at3_data_buffer == NULL) goto wait; at3_codec_buffer[5] = 0x1; at3_codec_buffer[10] = at3_at3plus_flagdata[1]; at3_codec_buffer[10] = (at3_codec_buffer[10] << 8 ) | at3_at3plus_flagdata[0]; at3_codec_buffer[12] = 0x1; at3_codec_buffer[14] = 0x1; if ( sceAudiocodecCheckNeedMem(at3_codec_buffer, 0x1000) < 0 ) goto wait; if ( sceAudiocodecGetEDRAM(at3_codec_buffer, 0x1000) < 0 ) goto wait; at3_getEDRAM = 1; if ( sceAudiocodecInit(at3_codec_buffer, 0x1000) < 0 ) { goto wait; } } else goto wait; int eof = 0; while( !eof ) { int samplesdecoded; memset(at3_mix_buffer, 0, 2048*2*2); unsigned long decode_type = 0x1001; if ( at3_type == TYPE_ATRAC3 ) { memset( at3_data_buffer, 0, 0x180); if (sceIoRead( at3_handle, at3_data_buffer, at3_data_align ) != at3_data_align) { eof = 1; continue; } if ( at3_channel_mode ) { memcpy(at3_data_buffer+at3_data_align, at3_data_buffer, at3_data_align); } decode_type = 0x1001; } else { memset( at3_data_buffer, 0, at3_data_align+8); at3_data_buffer[0] = 0x0F; at3_data_buffer[1] = 0xD0; at3_data_buffer[2] = at3_at3plus_flagdata[0]; at3_data_buffer[3] = at3_at3plus_flagdata[1]; if (sceIoRead( at3_handle, at3_data_buffer+8, at3_data_align ) != at3_data_align) { eof = 1; continue; } decode_type = 0x1000; } at3_codec_buffer[6] = (unsigned long)at3_data_buffer; at3_codec_buffer[8] = (unsigned long)at3_mix_buffer; int res = sceAudiocodecDecode(at3_codec_buffer, decode_type); if ( res < 0 ) { eof = 1; continue; } samplesdecoded = at3_sample_per_frame; } wait: if ( at3_handle ) { sceIoClose(at3_handle); } if ( at3_data_buffer) { free(at3_data_buffer); } if ( at3_getEDRAM ) { sceAudiocodecReleaseEDRAM(at3_codec_buffer); } sceCtrlReadBufferPositive(&input, 1); while(!(input.Buttons & PSP_CTRL_TRIANGLE)) { sceKernelDelayThread(10000); // wait 10 milliseconds sceCtrlReadBufferPositive(&input, 1); } sceKernelExitGame(); return 0; }
int main() { initOSLib(); //Initializes OsLib oslIntraFontInit(INTRAFONT_CACHE_ALL | INTRAFONT_STRING_UTF8); //Initializes OSL fonts //Loads our audio tones camera_click = oslLoadSoundFile("system/media/audio/ui/camera_click.wav", OSL_FMT_NONE); KeypressStandard = oslLoadSoundFile("system/media/audio/ui/KeypressStandard.wav", OSL_FMT_NONE); Lock = oslLoadSoundFile("system/media/audio/ui/Lock.wav", OSL_FMT_NONE); Unlock = oslLoadSoundFile("system/media/audio/ui/Unlock.wav", OSL_FMT_NONE); strcpy(backgroundPath, setFileDefaultsChar("system/settings/background.bin", "system/framework/framework-res/res/background1.png", backgroundPath)); strcpy(fontPath, setFileDefaultsChar("system/settings/font.bin", "system/fonts/Roboto.pgf", fontPath)); hrTime = setFileDefaultsInt("system/app/clock/timeSet.bin", 0, hrTime); language = setFileDefaultsInt("system/settings/language.bin", 0, language); batteryM = setFileDefaultsInt("system/settings/battery.bin", 1, batteryM); experimentalF = setFileDefaultsInt("system/settings/experimentalFeatures.bin", 0, experimentalF); DARK = setFileDefaultsInt("system/settings/darkTheme.bin", 0, DARK); fontSize = setFileDefaultsFloat("system/settings/fontSize.bin", 0.5, fontSize); checkGBootActivation(); createDirs(); themesLoad(); FILE *temp; if (!(fileExists(rgbValuesPath))) { temp = fopen(rgbValuesPath, "w"); fprintf(temp, "0\n149\n135"); fclose(temp); } temp = fopen(rgbValuesPath, "r"); fscanf(temp, "%d %d %d", &r, &g, &b); fclose(temp); quickSettings = oslLoadImageFile(quickSettingsBgPath, OSL_IN_VRAM, OSL_PF_8888); batt100 = oslLoadImageFile("system/home/icons/100.png", OSL_IN_VRAM, OSL_PF_8888); batt80 = oslLoadImageFile("system/home/icons/80.png", OSL_IN_VRAM, OSL_PF_8888); batt60 = oslLoadImageFile("system/home/icons/60.png", OSL_IN_VRAM, OSL_PF_8888); batt40 = oslLoadImageFile("system/home/icons/40.png", OSL_IN_VRAM, OSL_PF_8888); batt20 = oslLoadImageFile("system/home/icons/20.png", OSL_IN_VRAM, OSL_PF_8888); batt10 = oslLoadImageFile("system/home/icons/10.png", OSL_IN_VRAM, OSL_PF_8888); batt0 = oslLoadImageFile("system/home/icons/0.png", OSL_IN_VRAM, OSL_PF_8888); battcharge = oslLoadImageFile("system/home/icons/charge.png", OSL_IN_VRAM, OSL_PF_8888); volumeBar = oslLoadImageFilePNG("system/home/menu/volumeBar.png", OSL_IN_RAM, OSL_PF_8888); volumeControl = oslLoadImageFile(volumeControlPath, OSL_IN_RAM, OSL_PF_8888); layerA = oslLoadImageFilePNG("system/home/icons/layerA.png", OSL_IN_RAM, OSL_PF_8888); layerB = oslLoadImageFilePNG("system/home/icons/layerB.png", OSL_IN_RAM, OSL_PF_8888); navbarHighlight = oslLoadImageFilePNG(navbarHighlightPath, OSL_IN_RAM, OSL_PF_8888); navbarHighlight2 = oslLoadImageFilePNG(navbarHighlight2Path, OSL_IN_RAM, OSL_PF_8888); Roboto = oslLoadIntraFontFile(fontPath, INTRAFONT_CACHE_ALL | INTRAFONT_STRING_UTF8); oslSetFont(Roboto); //Load and set font SceUID kModule[3]; kModule[0] = pspSdkLoadStartModule("modules/display.prx", PSP_MEMORY_PARTITION_KERNEL); kModule[1] = pspSdkLoadStartModule("modules/control.prx", PSP_MEMORY_PARTITION_KERNEL); kModule[2] = pspSdkLoadStartModule("modules/impose.prx", PSP_MEMORY_PARTITION_KERNEL); int i; for (i = 0; i < 3; i++) { if (kModule[i] < 0) { pspDebugScreenPrintf("Error 0x%08X starting module.\n", kModule[i]); break; } } deleteUpdateFile(); //Delete update.zip setCpuBoot(); //Set default CPU or load pre-existing value setPowerManagement(); //Set default power save settings or load pre-existing values. getPSPNickname(); //Get PSP name before hand strcpy (pspname, nickname); //Main loop to run the program while (!osl_quit) { bootAnimation(); //Ends Printing and Drawing oslEndDrawing(); //End's Frame oslEndFrame(); //Synchronizes the screen oslSyncFrame(); } //Terminates/Ends the program oslQuit(); return 0; }
int main() { int devkit, size; SceUID kpspident; SceUID mod; (void)size_ipl_block_large; CHS_ScreenInit();///|pspDebugScreenInit(); CHS_ScreenSetTextColor(WHITE);///|pspDebugScreenSetTextColor(WHITE); devkit = sceKernelDevkitVersion(); if(devkit != DEVKIT_VER ) { ErrorExit(5000,"FW错误!\n");///|ErrorExit(5000,"FW ERROR!\n"); } kpspident = pspSdkLoadStartModule("kpspident.prx", PSP_MEMORY_PARTITION_KERNEL); if (kpspident < 0) { ErrorExit(5000, "kpspident.prx 加载失败\n");///|ErrorExit(5000, "kpspident.prx loaded failed\n"); } model = kuKernelGetModel(); if(!(model == 0 || model == 1) || is_ta88v3()) { ErrorExit(5000,"此安装程序不支持此模式。\n");///|ErrorExit(5000,"This installer does not support this model.\n"); } if( model == 0 ) { memcpy( ipl_block_large , ipl_block_01g, 0x4000); } //load module mod = sceKernelLoadModule("ipl_update.prx", 0, NULL); if (mod < 0) { ErrorExit(5000,"无法加载ipl_update.prx!\n");///|ErrorExit(5000,"Could not load ipl_update.prx!\n"); } mod = sceKernelStartModule(mod, 0, NULL, NULL, NULL); if (mod < 0) { ErrorExit(5000,"无法启动模块!\n");///|ErrorExit(5000,"Could not start module!\n"); } size = pspIplUpdateGetIpl(orig_ipl); if(size < 0) { ErrorExit(5000,"无法获得 ipl!\n");///|ErrorExit(5000,"Failed to get ipl!\n"); } printf("\n自定义ipl Flasher 为"VERSION_STR"。\n\n\n");///|printf("\nCustom ipl Flasher for "VERSION_STR".\n\n\n"); int ipl_type = 0; if( size == 0x24000 ) { printf("安装自定义ipl\n");///|printf("Custom ipl is installed\n"); size -= 0x4000; memmove( ipl_block_large + 0x4000 , orig_ipl + 0x4000 , size); ipl_type = 1; } else if( size == 0x20000 ) { printf("原ipl \n");///|printf("Raw ipl \n"); memmove( ipl_block_large + 0x4000, orig_ipl, size); } else { printf("ipl 大小;%08X\n", size);///|printf("ipl size;%08X\n", size); ErrorExit(5000,"未知 ipl!\n");///|ErrorExit(5000,"Unknown ipl!\n"); } printf(" 按X键");///|printf(" Press X to "); if( ipl_type ) { printf("重新");///|printf("Re"); } printf("安装CIPL\n");///|printf("install CIPL\n"); if( ipl_type ) { printf(" 按O键擦除CIPL和还原原IPL\n");///|printf(" Press O to Erase CIPL and Restore Raw IPL\n"); } printf(" 按R键取消\n\n");///|printf(" Press R to cancel\n\n"); while (1) { SceCtrlData pad; sceCtrlReadBufferPositive(&pad, 1); if (pad.Buttons & PSP_CTRL_CROSS) { flash_ipl( size ); break; } else if ( (pad.Buttons & PSP_CTRL_CIRCLE) && ipl_type ) { printf("Flashing IPL..."); if(pspIplUpdateClearIpl() < 0) { ErrorExit(5000,"无法清除 ipl!\n");///|ErrorExit(5000,"Failed to clear ipl!\n"); } if (pspIplUpdateSetIpl( ipl_block_large + 0x4000 , size ) < 0) { ErrorExit(5000,"无法写入 ipl!\n");///|ErrorExit(5000,"Failed to write ipl!\n"); } printf("完成。\n");///|printf("Done.\n"); break; } else if (pad.Buttons & PSP_CTRL_RTRIGGER) { ErrorExit(2000,"用户取消。\n");///|ErrorExit(2000,"Cancelled by user.\n"); } sceKernelDelayThread(10000); } ErrorExit(5000,"\n安装完成。 5秒内重新启动...\n");///|ErrorExit(5000,"\nInstall complete. Restarting in 5 seconds...\n"); return 0; }
int main(int argc, char *argv[]) { char *at3_data; int at3_size; char *decode_data; int decode_size; int n; FILE *file; int atracID; int maxSamples = 0; int result; int channel; u32 puiPosition; u32 puiDataByte; if ((file = fopen("sample.at3", "rb")) != NULL) { fseek(file, 0, SEEK_END); at3_size = ftell(file); fseek(file, 0, SEEK_SET); at3_data = malloc(at3_size); decode_data = malloc(decode_size = 512 * 1024); memset(at3_data, 0, at3_size); memset(decode_data, 0, decode_size); fread(at3_data, at3_size, 1, file); fclose(file); } pspSdkLoadStartModule("flash0:/kd/audiocodec.prx", PSP_MEMORY_PARTITION_KERNEL); pspSdkLoadStartModule("flash0:/kd/libatrac3plus.prx", PSP_MEMORY_PARTITION_KERNEL); printf("at3: %08X, %08X\n", (unsigned int)at3_data, at3_size); printf("Header: %s\n", (char *)at3_data); atracID = sceAtracSetDataAndGetID(at3_data, at3_size); result = sceAtracSetLoopNum(atracID, 2); printf("sceAtracSetLoopNum: %08X\n", result); printf("sceAtracSetDataAndGetID: %08X\n", atracID); result = sceAtracGetMaxSample(atracID, &maxSamples); printf("sceAtracGetMaxSample: %08X, %d\n", result, maxSamples); channel = sceAudioChReserve(0, maxSamples, PSP_AUDIO_FORMAT_STEREO); result = sceAtracGetSecondBufferInfo(atracID, &puiPosition, &puiDataByte); printf("sceAtracGetSecondBufferInfo: %08X, %u, %u\n", result, (unsigned int)puiPosition, (unsigned int)puiDataByte); int end = 0; int steps = 0; while (!end) { //int remainFrame = -1; int remainFrame = 0; //int decodeBufferPosition = 0; int samples = 0; int nextSample = 0; u32 nextPosition = 0; if (steps < 4) { result = sceAtracGetNextSample(atracID, &nextSample); printf("sceAtracGetNextSample(%d): %d\n", result, nextSample); result = sceAtracGetNextDecodePosition(atracID, &nextPosition); printf("sceAtracGetNextDecodePosition(%d): %u\n", result, (unsigned int)nextPosition); } result = sceAtracDecodeData(atracID, (u16 *)decode_data, &samples, &end, &remainFrame); if (steps < 4) { } sceAudioSetChannelDataLen(channel, samples); sceAudioOutputBlocking(channel, 0x8000, decode_data); result = sceAtracGetRemainFrame(atracID, &remainFrame); if (steps < 4) { printf("sceAtracDecodeData: %08X, at3_size: %d, decode_size: %d, samples: %d, end: %d, remainFrame: %d\n\n", result, at3_size, decode_size, samples, end, remainFrame); if (steps == 1) { for (n = 0; n < 32; n++) printf("%04X ", (u16)decode_data[n]); } printf("sceAtracGetRemainFrame: %08X\n", result); } steps++; } sceAudioChRelease(channel); result = sceAtracReleaseAtracID(atracID); printf("sceAtracGetRemainFrame: %08X\n", result); return 0; }
int main(void) { SetupCallbacks(); int result = pspSdkLoadStartModule("flash0:/kd/audiocodec.prx", PSP_MEMORY_PARTITION_KERNEL); pspSdkFixupImports(result); SceUID aa3_handle = sceIoOpen("ms0:/Test.AA3", PSP_O_RDONLY, 0777); // or ms0:/Test.OMA if ( ! aa3_handle ) goto wait; sceIoLseek32(aa3_handle, 0x0C00, PSP_SEEK_SET); u8 ea3_header[0x60]; if ( sceIoRead( aa3_handle, ea3_header, 0x60 ) != 0x60 ) goto wait; if ( ea3_header[0] != 0x45 || ea3_header[1] != 0x41 || ea3_header[2] != 0x33 || ea3_header[3] != 0x01 ) goto wait; aa3_at3plus_flagdata[0] = ea3_header[0x22]; aa3_at3plus_flagdata[1] = ea3_header[0x23]; aa3_type = (ea3_header[0x22] == 0x20) ? TYPE_ATRAC3 : ((ea3_header[0x22] == 0x28) ? TYPE_ATRAC3PLUS : 0x0); if ( aa3_type != TYPE_ATRAC3 && aa3_type != TYPE_ATRAC3PLUS ) goto wait; aa3_channels = 2; aa3_samplerate = 44100; if ( aa3_type == TYPE_ATRAC3 ) aa3_data_align = ea3_header[0x23]*8; else aa3_data_align = (ea3_header[0x23]+1)*8; aa3_data_start = 0x0C60; aa3_data_size = sceIoLseek32(aa3_handle, 0, PSP_SEEK_END) - aa3_data_start; if ( aa3_data_size % aa3_data_align != 0 ) goto wait; sceIoLseek32(aa3_handle, aa3_data_start, PSP_SEEK_SET); memset(aa3_codec_buffer, 0, sizeof(aa3_codec_buffer)); if ( aa3_type == TYPE_ATRAC3 ) { aa3_channel_mode = 0x0; if ( aa3_data_align == 0xC0 ) // atract3 have 3 bitrate, 132k,105k,66k, 132k align=0x180, 105k align = 0x130, 66k align = 0xc0 aa3_channel_mode = 0x1; aa3_sample_per_frame = 1024; aa3_data_buffer = (u8*)memalign(64, 0x180); if ( aa3_data_buffer == NULL) goto wait; aa3_codec_buffer[26] = 0x20; if ( sceAudiocodecCheckNeedMem(aa3_codec_buffer, 0x1001) < 0 ) goto wait; if ( sceAudiocodecGetEDRAM(aa3_codec_buffer, 0x1001) < 0 ) goto wait; aa3_getEDRAM = 1; aa3_codec_buffer[10] = 4; aa3_codec_buffer[44] = 2; if ( aa3_data_align == 0x130 ) aa3_codec_buffer[10] = 6; if ( sceAudiocodecInit(aa3_codec_buffer, 0x1001) < 0 ) { goto wait; } } else if ( aa3_type == TYPE_ATRAC3PLUS ) { aa3_sample_per_frame = 2048; int temp_size = aa3_data_align+8; int mod_64 = temp_size & 0x3f; if (mod_64 != 0) temp_size += 64 - mod_64; aa3_data_buffer = (u8*)memalign(64, temp_size); if ( aa3_data_buffer == NULL) goto wait; aa3_codec_buffer[5] = 0x1; aa3_codec_buffer[10] = aa3_at3plus_flagdata[1]; aa3_codec_buffer[10] = (aa3_codec_buffer[10] << 8 ) | aa3_at3plus_flagdata[0]; aa3_codec_buffer[12] = 0x1; aa3_codec_buffer[14] = 0x1; if ( sceAudiocodecCheckNeedMem(aa3_codec_buffer, 0x1000) < 0 ) goto wait; if ( sceAudiocodecGetEDRAM(aa3_codec_buffer, 0x1000) < 0 ) goto wait; aa3_getEDRAM = 1; if ( sceAudiocodecInit(aa3_codec_buffer, 0x1000) < 0 ) { goto wait; } } else goto wait; int eof = 0; while( !eof ) { int samplesdecoded; memset(aa3_mix_buffer, 0, 2048*2*2); unsigned long decode_type = 0x1001; if ( aa3_type == TYPE_ATRAC3 ) { memset( aa3_data_buffer, 0, 0x180); if (sceIoRead( aa3_handle, aa3_data_buffer, aa3_data_align ) != aa3_data_align) { eof = 1; continue; } if ( aa3_channel_mode ) { memcpy(aa3_data_buffer+aa3_data_align, aa3_data_buffer, aa3_data_align); } decode_type = 0x1001; } else { memset( aa3_data_buffer, 0, aa3_data_align+8); aa3_data_buffer[0] = 0x0F; aa3_data_buffer[1] = 0xD0; aa3_data_buffer[2] = aa3_at3plus_flagdata[0]; aa3_data_buffer[3] = aa3_at3plus_flagdata[1]; if (sceIoRead( aa3_handle, aa3_data_buffer+8, aa3_data_align ) != aa3_data_align) { eof = 1; continue; } decode_type = 0x1000; } aa3_codec_buffer[6] = (unsigned long)aa3_data_buffer; aa3_codec_buffer[8] = (unsigned long)aa3_mix_buffer; int res = sceAudiocodecDecode(aa3_codec_buffer, decode_type); if ( res < 0 ) { eof = 1; continue; } samplesdecoded = aa3_sample_per_frame; } wait: if ( aa3_handle ) { sceIoClose(aa3_handle); } if ( aa3_data_buffer) { free(aa3_data_buffer); } if ( aa3_getEDRAM ) { sceAudiocodecReleaseEDRAM(aa3_codec_buffer); } sceCtrlReadBufferPositive(&input, 1); while(!(input.Buttons & PSP_CTRL_TRIANGLE)) { sceKernelDelayThread(10000); // wait 10 milliseconds sceCtrlReadBufferPositive(&input, 1); } sceKernelExitGame(); return 0; }
int main_thread(SceSize _argc, ScePVoid _argp) { char *arg = *(char**)_argp; char jpcspConnectorPrx[256] = { 0 }; debug("Starting main_thread"); if(arg) { char *p = strrchr(arg, '/'); if (p != NULL) { *(p+1) = 0; strcpy(jpcspConnectorPrx, arg); } } strcat(jpcspConnectorPrx, "JpcspConnector.prx"); pspDebugScreenInit(); debug("Loading audiocodec.prx"); if(pspSdkLoadStartModule("flash0:/kd/audiocodec.prx", PSP_MEMORY_PARTITION_KERNEL) < 0) { pspDebugScreenPrintf("Error loading module audiocodec.prx\n"); return -1; } debug("Loading videocodec.prx"); if(pspSdkLoadStartModule("flash0:/kd/videocodec.prx", PSP_MEMORY_PARTITION_KERNEL) < 0) { pspDebugScreenPrintf("Error loading module videocodec.prx\n"); return -1; } debug("Loading mpegbase.prx"); if(pspSdkLoadStartModule("flash0:/kd/mpegbase.prx", PSP_MEMORY_PARTITION_KERNEL) < 0) { pspDebugScreenPrintf("Error loading module mpegbase.prx\n"); return -1; } debug("Loading mpeg_vsh.prx"); if(pspSdkLoadStartModule("flash0:/kd/mpeg_vsh.prx", PSP_MEMORY_PARTITION_USER) < 0) { pspDebugScreenPrintf("Error loading module mpeg_vsh.prx\n"); return -1; } debug("Loading semawm.prx"); if(pspSdkLoadStartModule("flash0:/kd/semawm.prx", PSP_MEMORY_PARTITION_KERNEL) < 0) { pspDebugScreenPrintf("Error loading module semawm.prx\n"); return -1; } debug("Loading usbstor.prx"); if(pspSdkLoadStartModule("flash0:/kd/usbstor.prx", PSP_MEMORY_PARTITION_KERNEL) < 0) { pspDebugScreenPrintf("Error loading module usbstor.prx\n"); return -1; } debug("Loading usbstormgr.prx"); if(pspSdkLoadStartModule("flash0:/kd/usbstormgr.prx", PSP_MEMORY_PARTITION_KERNEL) < 0) { pspDebugScreenPrintf("Error loading module usbstormgr.prx\n"); return -1; } debug("Loading usbstorms.prx"); if(pspSdkLoadStartModule("flash0:/kd/usbstorms.prx", PSP_MEMORY_PARTITION_KERNEL) < 0) { pspDebugScreenPrintf("Error loading module usbstorms.prx\n"); return -1; } debug("Loading usbstorboot.prx"); if(pspSdkLoadStartModule("flash0:/kd/usbstorboot.prx", PSP_MEMORY_PARTITION_KERNEL) < 0) { pspDebugScreenPrintf("Error loading module usbstorboot.prx\n"); return -1; } debug("Loading JpcspConnector.prx"); char* file = "ms0:/movie.pmf"; if(pspSdkLoadStartModuleWithArgs(jpcspConnectorPrx, PSP_MEMORY_PARTITION_USER, 1, &file) < 0) { pspDebugScreenPrintf("Error loading module JpcspConnector.prx\n"); return -1; } sceKernelExitGame(); return 0; }