int is_ta88v3(void) { u32 model, tachyon; tachyon = sceSysregGetTachyonVersion(); model = kuKernelGetModel(); if(model == 1 && tachyon == 0x00600000) { return 1; } return 0; }
//Get PSP Model static int lua_getModel(lua_State *L) { char stringa[256]; int argc = lua_gettop(L); if (argc > 0) { return luaL_error(L, "System.getModel() takes no argument"); } int model; model = ((kuKernelGetModel() + 1) * 1000); if (model == 4000){ sprintf(stringa, "N1000"); }else{ sprintf(stringa, "%i", model); } lua_pushstring(L, stringa); return 1; }
int main_thread(SceSize size, void *argp) { int thid; u32 psp_model; thid = get_thread_id("SCE_VSH_GRAPHICS"); if(thid < 0) { no_vsh = 1; } sctrlSEGetConfig(&g_config); vpl_init(); suspend_vsh_thread(); proDebugScreenInit(); psp_model = kuKernelGetModel(); fontlist_init(&g_font_list); get_fontlist(&g_font_list, fontpath); get_fontlist(&g_font_list, fontgopath); load_recovery_font_select(); if(g_cur_font_select[0] != '\0') { proDebugScreenSetFontFile(g_cur_font_select, 1); } if(zenkaku!=0){ fontlist_init(&g_font_list); get_fontlist(&g_font_list, kanji); get_fontlist(&g_font_list, kanjigo); } proDebugScreenClearLineDisable(); get_confirm_button(); main_menu(); recovery_exit(); return 0; }
static void conf_default(p_conf conf) { memset(conf, 0, sizeof(t_conf)); STRCPY_S(conf->path, "ms0:/"); STRCPY_S(conf->shortpath, "ms0:/"); STRCPY_S(conf->lastfile, ""); STRCPY_S(conf->bgarch, ""); STRCPY_S(conf->bgfile, scene_appdir()); STRCAT_S(conf->bgfile, "bg.png"); conf->bgwhere = scene_in_zip; conf->confver = XREADER_VERSION_NUM; conf->forecolor = 0xFFFFFFFF; conf->giftranscolor = 0xFFFFFFFF; conf->bgcolor = 0; conf->have_bg = true; conf->rowspace = 2; conf->wordspace = 0; conf->borderspace = 0; conf->vertread = 0; conf->infobar = conf_infobar_info; conf->infobar_style = 0; conf->rlastrow = false; conf->autobm = true; conf->encode = conf_encode_gbk; conf->fit = conf_fit_none; conf->imginfobar = false; conf->scrollbar = false; conf->scale = 0; conf->rotate = conf_rotate_0; conf->enable_analog = true; conf->img_enable_analog = true; conf->txtkey[0] = PSP_CTRL_SQUARE; conf->txtkey[1] = PSP_CTRL_LTRIGGER; conf->txtkey[2] = PSP_CTRL_RTRIGGER; conf->txtkey[3] = PSP_CTRL_UP | PSP_CTRL_CIRCLE; conf->txtkey[4] = PSP_CTRL_DOWN | PSP_CTRL_CIRCLE; conf->txtkey[5] = PSP_CTRL_LEFT | PSP_CTRL_CIRCLE; conf->txtkey[6] = PSP_CTRL_RIGHT | PSP_CTRL_CIRCLE; conf->txtkey[7] = PSP_CTRL_LTRIGGER | PSP_CTRL_CIRCLE; conf->txtkey[8] = PSP_CTRL_RTRIGGER | PSP_CTRL_CIRCLE; conf->txtkey[9] = 0; conf->txtkey[10] = 0; conf->txtkey[11] = PSP_CTRL_CROSS; conf->txtkey[12] = PSP_CTRL_TRIANGLE; conf->imgkey[0] = PSP_CTRL_LTRIGGER; conf->imgkey[1] = PSP_CTRL_RTRIGGER; conf->imgkey[2] = PSP_CTRL_TRIANGLE; conf->imgkey[3] = PSP_CTRL_UP | PSP_CTRL_CIRCLE; conf->imgkey[4] = PSP_CTRL_DOWN | PSP_CTRL_CIRCLE; conf->imgkey[5] = PSP_CTRL_LEFT | PSP_CTRL_CIRCLE; conf->imgkey[6] = PSP_CTRL_RIGHT | PSP_CTRL_CIRCLE; conf->imgkey[7] = PSP_CTRL_SQUARE; conf->imgkey[8] = PSP_CTRL_CIRCLE; conf->imgkey[9] = PSP_CTRL_CROSS; conf->imgkey[10] = PSP_CTRL_LTRIGGER | PSP_CTRL_CIRCLE; conf->imgkey[11] = 0; conf->imgkey[12] = PSP_CTRL_UP; conf->imgkey[13] = PSP_CTRL_DOWN; conf->imgkey[14] = PSP_CTRL_LEFT; conf->imgkey[15] = PSP_CTRL_RIGHT; conf->flkey[0] = PSP_CTRL_CIRCLE; conf->flkey[1] = PSP_CTRL_LTRIGGER; conf->flkey[2] = PSP_CTRL_RTRIGGER; conf->flkey[3] = PSP_CTRL_CROSS; conf->flkey[4] = 0; conf->flkey[5] = PSP_CTRL_TRIANGLE; conf->flkey[6] = PSP_CTRL_SQUARE; conf->flkey[7] = PSP_CTRL_LTRIGGER | PSP_CTRL_RTRIGGER; conf->bicubic = false; conf->mp3encode = conf_encode_gbk; conf->lyricencode = conf_encode_gbk; conf->mp3cycle = conf_cycle_repeat; conf->isreading = false; conf->slideinterval = 5; conf->hprmctrl = false; conf->grayscale = 30; conf->showhidden = true; conf->showunknown = true; conf->showfinfo = true; conf->allowdelete = true; conf->arrange = conf_arrange_name; conf->enableusb = false; conf->viewpos = conf_viewpos_leftup; conf->imgmvspd = 8; conf->imgpaging = conf_imgpaging_direct; conf->imgpaging_spd = 8; conf->imgpaging_interval = 10; conf->imgpaging_duration = 10; conf->fontsize = 12; conf->bookfontsize = 12; conf->reordertxt = false; conf->pagetonext = false; conf->autopage = 0; conf->autopagetype = 2; conf->autolinedelay = 0; conf->thumb = conf_thumb_scroll; conf->imgpagereserve = 0; #if defined(ENABLE_MUSIC) && defined(ENABLE_LYRIC) conf->lyricex = 1; #else conf->lyricex = 0; #endif conf->autoplay = false; conf->usettf = 0; conf->freqs[0] = 1; conf->freqs[1] = 5; conf->freqs[2] = 8; conf->imgbrightness = 100; conf->dis_scrsave = false; conf->autosleep = 0; conf->load_exif = true; conf->prev_autopage = 2; conf->launchtype = 2; /* conf->titlecolor = RGB(0x80, 0x10, 0x10); conf->menutextcolor = RGB(0xDF, 0xDF, 0xDF); conf->menubcolor = RGB(0x40, 0x10, 0x10); conf->selicolor = RGB(0xFF, 0xFF, 0x40); conf->selbcolor = RGB(0x20, 0x20, 0xDF); conf->msgbcolor = RGB(0x18, 0x28, 0x50); */ conf->titlecolor = RGB(0x30, 0x60, 0x30); conf->menutextcolor = RGB(0xDF, 0xDF, 0xDF); conf->menubcolor = RGB(0x10, 0x30, 0x20); conf->selicolor = RGB(0xFF, 0xFF, 0x40); conf->selbcolor = RGB(0x20, 0x20, 0xDF); conf->msgbcolor = RGB(0x18, 0x28, 0x50); conf->usedyncolor = false; STRCPY_S(conf->cttfpath, scene_appdir()); STRCAT_S(conf->cttfpath, "fonts/gbk.ttf"); STRCPY_S(conf->ettfpath, scene_appdir()); STRCAT_S(conf->ettfpath, "fonts/asc.ttf"); conf->infobar_use_ttf_mode = true; conf->img_no_repeat = false; conf->hide_flash = true; conf->tabstop = 4; conf->apetagorder = true; STRCPY_S(conf->language, "zh_CN"); conf->filelistwidth = 160; if (kuKernelGetModel() == PSP_MODEL_STANDARD) { conf->ttf_load_to_memory = false; } else { conf->ttf_load_to_memory = true; } conf->save_password = true; conf->scrollbar_width = 5; conf->hide_last_row = false; conf->infobar_show_timer = true; conf->infobar_fontsize = 12; conf->englishtruncate = true; conf->image_scroll_chgn_speed = true; conf->ttf_haste_up = true; conf->linenum_style = false; conf->infobar_align = conf_align_left; conf->show_encoder_msg = false; SPRINTF_S(conf->musicdrv_opts, "mp3_brute_mode=off mp3_use_me=on mp3_check_crc=off mp3_buffer_size=%d " "wma_buffer_size=%d aac_buffer_size=%d wav_buffer_size=%d wv_buffer_size=%d " "aa3_buffer_size=%d at3_buffer_size=%d m4a_buffer_size=%d " "flac_buffer_size=%d", BUFFERED_READER_BUFFER_SIZE, BUFFERED_READER_BUFFER_SIZE, BUFFERED_READER_BUFFER_SIZE, BUFFERED_READER_BUFFER_SIZE, WVPACK_BUFFERED_READER_BUFFER_SIZE, BUFFERED_READER_BUFFER_SIZE, BUFFERED_READER_BUFFER_SIZE, BUFFERED_READER_BUFFER_SIZE, BUFFERED_READER_BUFFER_SIZE); conf->magnetic_scrolling = true; conf->use_image_queue = true; conf->max_cache_img = 10; }
int main(int argc, char *argv[]) { int ret = 0; struct SceIoStat stat; SceCtrlData ctl; u32 key; memset(&stat, 0, sizeof(stat)); pspDebugScreenInit(); psp_fw_version = sceKernelDevkitVersion(); #ifdef CONFIG_620 if(psp_fw_version == FW_620) { goto version_OK; } #endif #ifdef CONFIG_635 if(psp_fw_version == FW_635) { goto version_OK; } #endif #ifdef CONFIG_639 if(psp_fw_version == FW_639) { goto version_OK; } #endif #if defined(CONFIG_660) || defined(CONFIG_661) if((psp_fw_version == FW_660) || (psp_fw_version == FW_661)) { goto version_OK; } #endif printf("Sorry. This program doesn't support your FW(0x%08X).\n", (uint)psp_fw_version); goto exit; version_OK: psp_model = kuKernelGetModel(); scePowerSetClockFrequency(333, 333, 166); init_flash(); usage(); printf("Press X to launch CFW.\n"); printf("Press Triangle to uninstall CFW.\n"); printf("Hold L to reinstall CFW.\n"); printf("Press R to exit.\n"); sceCtrlReadBufferPositive(&ctl, 1); key = ctl.Buttons; while (0 == (key & (PSP_CTRL_CROSS | PSP_CTRL_RTRIGGER | PSP_CTRL_TRIANGLE))) { sceKernelDelayThread(50000); sceCtrlReadBufferPositive(&ctl, 1); key = ctl.Buttons; } if (key & PSP_CTRL_RTRIGGER) { printf("Exiting...\n"); cleanup_exit(); sceKernelDelayThread(100000); sceKernelExitGame(); } switch(psp_model) { case PSP_GO: printf("PSP GO BRITE Detected ....\n"); break; case PSP_9000: printf("PSP BRITE 3000(09g) Detected ....\n"); break; case PSP_7000: printf("PSP BRITE 3000(07g) Detected ....\n"); break; case PSP_4000: printf("PSP BRITE 3000(04g) Detected ....\n"); break; case PSP_3000: printf("PSP BRITE 3000 Detected ....\n"); break; case PSP_2000: printf("PSP SLIM 2000 Detected ....\n"); break; case PSP_1000: printf("PSP FAT 1000 Detected ....\n"); break; case PSP_11000: printf("PSP STREET E1000 Detected ....\n"); break; default: printf("Unknown PSP model 0%dg\n", psp_model+1); break; } sceCtrlReadBufferPositive(&ctl, 1); if (ctl.Buttons & PSP_CTRL_LTRIGGER) { disable_smart = 1; } if (key & PSP_CTRL_CROSS) { ret = install_cfw(); if (ret == 0) { printf(" Completed.\nPress X to start CFW.\n"); sceCtrlReadBufferPositive(&ctl, 1); key = ctl.Buttons; while (0 == (key & PSP_CTRL_CROSS)) { sceKernelDelayThread(50000); sceCtrlReadBufferPositive(&ctl, 1); key = ctl.Buttons; } printf("Now reboot to " VERSION_STR " :)\n"); start_reboot(1); } } else if (key & PSP_CTRL_TRIANGLE) { ret = uninstall_cfw(); printf("Now reboot to OFW :)\n"); sceKernelDelayThread(1000000); start_reboot(0); } exit: printf("Press X to exit.\n"); sceCtrlReadBufferPositive(&ctl, 1); key = ctl.Buttons; while (0 == (key & PSP_CTRL_CROSS)) { sceKernelDelayThread(50000); sceCtrlReadBufferPositive(&ctl, 1); key = ctl.Buttons; } cleanup_exit(); 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; }
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; }
//************************************************************************************* // //************************************************************************************* static bool Initialize() { strcpy(gDaedalusExePath, DAEDALUS_PSP_PATH( "" )); printf( "Cpu was: %dMHz, Bus: %dMHz\n", scePowerGetCpuClockFrequency(), scePowerGetBusClockFrequency() ); if (scePowerSetClockFrequency(333, 333, 166) != 0) { printf( "Could not set CPU to 333MHz\n" ); } printf( "Cpu now: %dMHz, Bus: %dMHz\n", scePowerGetCpuClockFrequency(), scePowerGetBusClockFrequency() ); // Set up our Kernel Home button //ToDo: This doesn't work properly for Vita, there's no longer a "home" button available InitHomeButton(); // If (o) is pressed during boot the Emulator will use 32bit // else use default 16bit color mode SceCtrlData pad; sceCtrlPeekBufferPositive(&pad, 1); if( pad.Buttons & PSP_CTRL_CIRCLE ) g32bitColorMode = true; else g32bitColorMode = false; // Check for unsupported FW >=4.01 (We use M33 SDK 4.01) // Otherwise PSP model can't be detected correctly DaedalusFWCheck(); // Initiate MediaEngine //Note: Media Engine is not available for Vita bool bMeStarted = InitialiseJobManager(); // Disable for profiling // srand(time(0)); //Set the debug output to default if( g32bitColorMode ) pspDebugScreenInit(); else pspDebugScreenInitEx( NULL , GU_PSM_5650, 1); //Sets debug output to 16bit mode // This Breaks gdb, better disable it in debug build // #ifndef DAEDALUS_DEBUG_CONSOLE initExceptionHandler(); #endif _DisableFPUExceptions(); //Init Panic button thread SetupPanic(); // Init volatile memory VolatileMemInit(); #ifdef DAEDALUS_CALLBACKS //Set up callback for our thread SetupCallbacks(); #endif //Set up the DveMgr (TV Display) and Detect PSP Slim /3K/ Go if ( kuKernelGetModel() > PSP_MODEL_STANDARD ) { // Can't use extra memory if ME isn't available if( bMeStarted ) PSP_IS_SLIM = true; HAVE_DVE = CModule::Load("dvemgr.prx"); if (HAVE_DVE >= 0) PSP_TV_CABLE = pspDveMgrCheckVideoOut(); if (PSP_TV_CABLE == 1) PSP_TV_LACED = 1; // composite cable => interlaced else if( PSP_TV_CABLE == 0 ) CModule::Unload( HAVE_DVE ); // Stop and unload dvemgr.prx since if no video cable is connected } HAVE_DVE = (HAVE_DVE < 0) ? 0 : 1; // 0 == no dvemgr, 1 == dvemgr sceCtrlSetSamplingCycle(0); sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG); // Init the savegame directory strcpy( g_DaedalusConfig.mSaveDir, DAEDALUS_PSP_PATH( "SaveGames/" ) ); if (!System_Init()) return false; return true; }