static int lua_setCpuSpeed(lua_State *L) { int argc = lua_gettop(L); if (argc != 1) return luaL_error(L, "System.setCpuSpeed(speed) takes only 1 argument (ie. System.setCpuSpeed(333) )"); unsigned int speed = luaL_checkint(L, 1); switch (speed) { case 100 : scePowerSetClockFrequency(100, 100, 100); break; case 222 : scePowerSetClockFrequency(222, 222, 111); break; case 266 : scePowerSetClockFrequency(266, 266, 133); break; case 333 : scePowerSetClockFrequency(333, 333, 166); break; } return 0; }
void PowerCallback (int unknown, int pwrflags) { if (pwrflags & PSP_POWER_CB_HOLD_SWITCH) { extern bool8 g_bShowProfilerIno; g_bShowProfilerInfo = (! g_bShowProfilerInfo); } if (pwrflags & PSP_POWER_CB_POWER_SWITCH){ if (g_bROMLoaded) { scePowerSetClockFrequency (222, 222, 111); S9xSetSoundMute (TRUE); g_bSleep = true; save_config (); Memory.SaveSRAM (S9xGetFilename ("srm")); } } else if (pwrflags & PSP_POWER_CB_RESUME_COMPLETE) { g_bSleep = false; } if (pwrflags & PSP_POWER_CB_BATTERY_LOW){ scePowerSetClockFrequency (222,222,111); S9xSetInfoString ("WARNING: PSP Battery is Low! (Automatically Throttling CPU)"); } int cbid; cbid = sceKernelCreateCallback ("Power Callback", (SceKernelCallbackFunction)PowerCallback, NULL); scePowerRegisterCallback (0, cbid); }
void cpu_clock_set_minimum() { //if (current_speed.cpu<120) current_speed.cpu=120; //if (current_speed.ram<222) current_speed.ram=222; //if (current_speed.bus<60) current_speed.bus=60; if ( current_speed.cpu > 222 ) scePowerSetClockFrequency(current_speed.cpu, current_speed.ram, current_speed.bus); else { scePowerSetClockFrequency(222,222,111); scePowerSetCpuClockFrequency(current_speed.cpu); scePowerSetBusClockFrequency(current_speed.bus); } }
int main(void) { //change clock rate to 333mhz scePowerSetClockFrequency(333, 333, 166); PowerManager::instance(); // Setup power manager SetupCallbacks(); static const char *argv[] = { "scummvm", NULL }; static int argc = sizeof(argv) / sizeof(char *) - 1; g_system = new OSystem_PSP(); assert(g_system); #ifdef DYNAMIC_MODULES PluginManager::instance().addPluginProvider(new PSPPluginProvider()); #endif /* unit/speed tests */ #if defined (PSP_ENABLE_UNIT_TESTS) || defined (PSP_ENABLE_SPEED_TESTS) PSP_INFO_PRINT("running tests\n"); psp_tests(); sceKernelSleepThread(); // that's it. That's all we're doing #endif int res = scummvm_main(argc, argv); g_system->quit(); // TODO: Consider removing / replacing this! PowerManager::destroy(); // get rid of PowerManager sceKernelSleepThread(); return res; }
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 }
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 }
int psp_set_cpu_clock(int clock) { int ret = scePowerSetClockFrequency(clock, clock, clock/2); if (ret != 0) lprintf("failed to set clock: %i\n", ret); return ret; }
static int lua_setHigh(lua_State *L) { if (lua_gettop(L) != 0) return luaL_error(L, "no arguments expected."); if (scePowerGetCpuClockFrequencyInt() != 333){ scePowerSetClockFrequency(333,333,166); } return 0; }
void MP3Player::Stop() { scePowerSetClockFrequency(222, 222, 111); PlayBackMP3::Stop(); lcd->SetDefaultText("MP3 Player"); DriverInit = 0; Playback = 0; Paused = 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); }
//add by cooleyes 2006/12/19 void cpu_clock_set_cpu_speed( int cpu ) { if ( cpu >= 333 ) { current_speed.cpu = 333; current_speed.ram = 333; current_speed.bus = 166; } else if ( cpu >= 266 ) { current_speed.cpu = 266; current_speed.ram = 266; current_speed.bus = 133; } else if ( cpu >= 222 ) { current_speed.cpu = 222; current_speed.ram = 222; current_speed.bus = 111; } else if ( cpu >= 133 ) { current_speed.cpu = 133; current_speed.ram = 222; current_speed.bus = 66; } else if ( cpu >= 120 ){ current_speed.cpu = 120; current_speed.ram = 222; current_speed.bus = 60; } else { current_speed.cpu = 66; current_speed.ram = 222; current_speed.bus = 33; } if ( current_speed.cpu > 222 ) scePowerSetClockFrequency(current_speed.cpu, current_speed.ram, current_speed.bus); else { scePowerSetClockFrequency(222,222,111); scePowerSetCpuClockFrequency(current_speed.cpu); scePowerSetBusClockFrequency(current_speed.bus); } }
int testFrequencies() { int result = 1; scePowerSetClockFrequency(333, 333, 166); printf("scePowerGetCpuClockFrequency = 333..."); int cpu = scePowerGetCpuClockFrequency(); if (cpu < 332 ||cpu > 334) { result = error(); } else { ok(); } return result; }
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 }
//main function int main(int argc, char **argv) { mx::mxDisplay display; // display instance mx::mxController controller; if(display.initCallbacks() && display.initDisplay()) { scePowerSetClockFrequency(333, 333, 166); loadSurfaces(); scrambleSurface(); while(display.active()) { display.clearBuffer(); morphSurface(); blendSurface(&images[rand()%4]); display.end(); display.start(); display.copySurface(&back_surface, 0, 0); display.flipBuffer(); } } return 0; }
int main() { pspDebugScreenInit(); SetupCallbacks(); scePowerSetClockFrequency(333, 333, 166); pspAudioInit(); SceCtrlData pad; int i; tzset(); printf("Hello World\n"); time_t now; now = time(NULL); printf("Started %s\n", ctime(&now)); MP3_Init(1); MP3_Load("test.mp3"); MP3_Play(); while(1) { sceCtrlReadBufferPositive(&pad, 1); if(pad.Buttons & PSP_CTRL_CROSS) { break; } else if(pad.Buttons & PSP_CTRL_CIRCLE) { MP3_Pause(); for(i=0; i<10; i++) { sceDisplayWaitVblankStart(); } } if (MP3_EndOfStream() == 1) { MP3_Stop(); } } MP3_Stop(); MP3_FreeTune(); sceKernelSleepThread(); return 0; }
void MP3Player::Play() { if(_files->FileCount() > 0) { AFile* file = _files->GetCurrentFile(); if (!file) { _files->Reset(); file = _files->GetCurrentFile(); if (!file) return; } scePowerSetClockFrequency(333, 333, 166); if (DriverInit == 0) PlayBackMP3::Init(0); DriverInit = 1; PlayBackMP3::Load(file->FullPath.c_str()); PlayBackMP3::Play(); Playback = 1; lcd->SetDefaultText(file->Filename); } else lcd->PrintMessage("No Files"); }
static void process_key( int key, int down, int repeat ) { if ( !down ) return ; switch( nGameStage ) { /* ---------------------------- Main Menu ---------------------------- */ case 1: //ui_mainmenu_select switch( key ) { case PSP_CTRL_UP: if (ui_mainmenu_select <= 0) break; ui_mainmenu_select--; draw_ui_main(); break; case PSP_CTRL_DOWN: if (ui_mainmenu_select >=9 ) break; ui_mainmenu_select++; draw_ui_main(); break; case PSP_CTRL_LEFT: switch(ui_mainmenu_select) { case 7: if ( cpu_speeds_select > 0 ) { cpu_speeds_select--; draw_ui_main(); } break; } break; case PSP_CTRL_RIGHT: switch(ui_mainmenu_select) { case 7: if ( cpu_speeds_select < 3 ) { cpu_speeds_select++; draw_ui_main(); } break; } break; case PSP_CTRL_CIRCLE: switch( ui_mainmenu_select ) { case 0: nGameStage = 2; strcpy(ui_current_path, szAppRomPath); //ui_current_path[strlen(ui_current_path)-1] = 0; draw_ui_browse(true); break; case 8: // Return to Game if ( nPrevGame < nBurnDrvCount ) { scePowerSetClockFrequency( cpu_speeds[cpu_speeds_select].cpu, cpu_speeds[cpu_speeds_select].cpu, cpu_speeds[cpu_speeds_select].bus ); nGameStage = 0; } break; case 9: // Exit bGameRunning = 0; break; } break; } break; /* ---------------------------- Rom Browse ---------------------------- */ case 2: switch( key ) { case PSP_CTRL_UP: if (find_rom_select == 0) break; if (find_rom_top >= find_rom_select) find_rom_top--; find_rom_select--; draw_ui_browse(false); break; case PSP_CTRL_DOWN: if ((find_rom_select+1) >= find_rom_count) break; find_rom_select++; if ((find_rom_top + find_rom_list_cnt) <= find_rom_select) find_rom_top++; draw_ui_browse(false); break; case PSP_CTRL_CIRCLE: switch( getRomsFileStat(find_rom_select) ) { case -1: // directry { // printf("change dir %s\n", getRomsFileName(find_rom_select) ); char * pn = getRomsFileName(find_rom_select); if ( strcmp("..", pn) ) { strcat(ui_current_path, getRomsFileName(find_rom_select)); strcat(ui_current_path, "/"); } else { if (strlen(strstr(ui_current_path, ":/")) == 2) break; // "ROOT:/" for(int l = strlen(ui_current_path)-1; l>1; l-- ) { ui_current_path[l] = 0; if (ui_current_path[l-1] == '/') break; } } //printf("change dir to %s\n", ui_current_path ); find_rom_count = 0; find_rom_select = 0; find_rom_top = 0; draw_ui_browse(true); } break; default: // rom zip file { nBurnDrvSelect = (unsigned int)getRomsFileStat( find_rom_select ); if (nBurnDrvSelect <= nBurnDrvCount && BurnDrvIsWorking() ) { if ( DrvInit( nBurnDrvSelect, false ) == 0 ) { BurnRecalcPal(); InpInit(); InpDIP(); scePowerSetClockFrequency( cpu_speeds[cpu_speeds_select].cpu, cpu_speeds[cpu_speeds_select].cpu, cpu_speeds[cpu_speeds_select].bus ); nGameStage = 0; } else nBurnDrvSelect = ~0U; } else nBurnDrvSelect = ~0U; nPrevGame = nBurnDrvSelect; //if (nBurnDrvSelect == ~0U) { // bprintf(0, "unkown rom %s", getRomsFileName(find_rom_select)); //} } } break; case PSP_CTRL_CROSS: // cancel nGameStage = 1; draw_ui_main(); break; } break; /* ---------------------------- DIP Setting ---------------------------- */ case 3: break; } }
void MP3Play(char * path) { struct ID3Tag ID3; nowplaying = oslLoadImageFilePNG(nowplayingBgPath, OSL_IN_RAM, OSL_PF_8888); mp3Play = oslLoadImageFilePNG("system/app/apollo/play.png", OSL_IN_RAM, OSL_PF_8888); mp3Pause = oslLoadImageFilePNG("system/app/apollo/pause.png", OSL_IN_RAM, OSL_PF_8888); if (!nowplaying) debugDisplay(); scePowerSetClockFrequency(333, 333, 166); pspAudioInit(); int i, mp3Min = 0; MP3ME_Init(1); ParseID3(path, &ID3); MP3ME_Load(path); MP3ME_Play(); isPlaying = 1; while (!osl_quit) { LowMemExit(); oslStartDrawing(); oslClearScreen(RGB(0,0,0)); oslReadKeys(); oslIntraFontSetStyle(Roboto, fontSize, BLACK, 0, 0); if (MP3ME_playingTime > 59) { mp3Min += 1; MP3ME_playingTime = 0; } oslDrawImageXY(nowplaying, 0, 0); oslDrawStringf(240,76, "Playing: %.19s", folderIcons[current].name); oslDrawStringf(240,96, "Title: %.21s", ID3.ID3Title); oslDrawStringf(240,116, "Artist: %.20s", ID3.ID3Artist); oslDrawStringf(240,136, "Album: %.21s", ID3.ID3Album); oslDrawStringf(240,156, "Year: %.22s", ID3.ID3Year); oslDrawStringf(240,176, "Genre: %.21s", ID3.ID3GenreText); oslDrawStringf(435,206, "0%d:%.f", mp3Min, MP3ME_playingTime); if (MP3ME_isPlaying == 1) oslDrawImageXY(mp3Play, 230, 224); if (MP3ME_isPlaying == 0) oslDrawImageXY(mp3Pause, 230, 224); battery(370,2,1); digitaltime(420,4,0,hrTime); volumeController(); if(osl_keys->pressed.select) { oslDeleteImage(nowplaying); oslDeleteImage(mp3Play); oslDeleteImage(mp3Pause); return; } if(MP3ME_isPlaying == 1 && osl_keys->pressed.cross) { oslPlaySound(KeypressStandard, 1); MP3ME_Pause(); for(i=0; i<10; i++) { sceDisplayWaitVblankStart(); } } else if (MP3ME_isPlaying == 0 && osl_keys->pressed.cross) { MP3ME_Play(); } if (MP3ME_EndOfStream() == 1) { isPlaying = 0; endAudioLib(); MP3ME_Stop(); releaseAudio(); MP3ME_Play(); } if(osl_keys->pressed.circle) { endAudioLib(); MP3ME_Stop(); releaseAudio(); oslDeleteImage(nowplaying); oslDeleteImage(mp3Play); oslDeleteImage(mp3Pause); isPlaying = 0; setCpuBoot(); //Restore previous CPU state return; } if (osl_keys->pressed.square) { powermenu(); } if (osl_keys->pressed.L) { oslPlaySound(Lock, 1); lockscreen(); } captureScreenshot(); oslEndDrawing(); oslEndFrame(); oslSyncFrame(); } }
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; }
//************************************************************************************* // //************************************************************************************* 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; }
s32 load_config_file() { u8 config_path[512]; #if defined(PSP_BUILD) || defined(ZAURUS) sprintf(config_path, "%s/%s", main_path, GPSP_CONFIG_FILENAME); #else sprintf(config_path, "%s\\%s", main_path, GPSP_CONFIG_FILENAME); #endif file_open(config_file, config_path, read); if(file_check_valid(config_file)) { u32 file_size = file_length(config_path, config_file); // Sanity check: File size must be the right size if(file_size == 92) { u32 file_options[file_size / 4]; u32 i; s32 menu_button = -1; file_read_array(config_file, file_options); screen_scale = file_options[0] % 3; // 2 screen_filter = file_options[1] % 2; global_enable_audio = file_options[2] % 2; #if defined(ZAURUS) || defined(DINGUX_ON_WIN32) audio_buffer_size_number = file_options[3] % 4; #else audio_buffer_size_number = file_options[3] % 11; #endif update_backup_flag = file_options[4] % 2; global_enable_analog = file_options[5] % 2; analog_sensitivity_level = file_options[6] % 8; #ifdef PSP_BUILD scePowerSetClockFrequency(clock_speed, clock_speed, clock_speed / 2); #endif // Sanity check: Make sure there's a MENU or FRAMESKIP // key, if not assign to triangle for(i = 0; i < 16; i++) { gamepad_config_map[i] = file_options[7 + i] % (BUTTON_ID_NONE + 1); if(gamepad_config_map[i] == BUTTON_ID_MENU) { menu_button = i; } } if(menu_button == -1) { gamepad_config_map[0] = BUTTON_ID_MENU; } file_close(config_file); } return 0; } return -1; }
int main(int argc, char** argv) { SceCtrlData pad; getcwd(currentPath, MAX_PATH - 1); strcat(currentPath, "/"); strcpy(szAppRomPath, currentPath); strcat(szAppRomPath, "ROMS/"); int thid = sceKernelCreateThread(PBPNAME, CallbackThread, 0x11, 0xFA0, 0, 0); if(thid >= 0) sceKernelStartThread(thid, 0, 0); nGameStage = 1; init_gui(); BurnLibInit(); for (nBurnDrvSelect=0; nBurnDrvSelect<nBurnDrvCount; nBurnDrvSelect++) if ( strcmp("aerofgt", BurnDrvGetText(DRV_NAME)) == 0 ) break; if (nBurnDrvSelect >= nBurnDrvCount) nBurnDrvSelect = ~0U; bBurnUseASMCPUEmulation = false; nInterpolation = 3; pBurnSoundOut = 0; //&mixbuf[0]; nBurnSoundRate = SND_RATE; nBurnSoundLen = 0; //SND_FRAME_SIZE; //BurnDrvGetFullSize(&VideoBufferWidth, &VideoBufferHeight); //printf("%d x %d \n", VideoBufferWidth, VideoBufferHeight); nBurnBpp = 2; nBurnPitch = 512 * 2; BurnHighCol = HighCol16; int ret = 0; //DrvInit(nBurnDrvSelect, false); //if (nRet != 0) return 0; //BurnRecalcPal(); //InpInit(); //InpDIP(); pBurnDraw = (unsigned char *) video_frame_addr(tex_frame, 0, 0); //szAppRomPath //strcat(ui_current_path, "roms"); draw_ui_main(); bGameRunning = 1; while( bGameRunning ) { sceCtrlReadBufferPositive(&pad, 1); if ( nGameStage ) { do_ui_key( pad.Buttons ); update_gui(); sceDisplayWaitVblankStart(); } else { if ( pad.Buttons & PSP_CTRL_LTRIGGER ) { scePowerSetClockFrequency(222, 222, 111); nGameStage = 1; draw_ui_main(); continue; } InpMake(pad.Buttons); nFramesEmulated++; nCurrentFrame++; nFramesRendered++; pBurnDraw = (unsigned char *) video_frame_addr(tex_frame, 0, 0); BurnDrvFrame(); pBurnDraw = NULL; update_gui(); //sceDisplayWaitVblankStart(); } show_frame = draw_frame; draw_frame = sceGuSwapBuffers(); } scePowerSetClockFrequency(222, 222, 111); exit_gui(); DrvExit(); BurnLibExit(); InpExit(); sceKernelExitGame(); }
void cpu_clock_set_maximum() { scePowerSetClockFrequency(333, 333, 166); }
int main(int argc, char *argv[]) { char romName[512]; #ifdef TARGET_PSP SetupCallbacks(); scePowerSetClockFrequency(222, 222, 111); //scePowerSetClockFrequency(266, 266, 133); //scePowerSetClockFrequency(333, 333, 166); #endif if (SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO|SDL_INIT_JOYSTICK) < 0) { printf("SDL_Init failed!\n"); #ifdef TARGET_PSP sceKernelExitGame(); #endif return -1; } // Set up quiting so that it automatically runs on exit. atexit(SDL_Quit); PSP_JoystickOpen(); actualScreen = SDL_SetVideoMode (SIZEX, SIZEY, 16, SDL_SWSURFACE); if (actualScreen == NULL) { printf("SDL_SetVideoMode failed!\n"); #ifdef TARGET_PSP sceKernelExitGame(); #endif return -1; } else { dbg_print("screen params: bpp=%d\n", actualScreen->format->BitsPerPixel); } #ifdef ZOOM_SUPPORT screen = SDL_CreateRGBSurface (actualScreen->flags, actualScreen->w, actualScreen->h, actualScreen->format->BitsPerPixel, actualScreen->format->Rmask, actualScreen->format->Gmask, actualScreen->format->Bmask, actualScreen->format->Amask); if (screen == NULL) { printf("SDL_CreateRGBSurface failed!\n"); #ifdef TARGET_PSP sceKernelExitGame(); #endif return -1; } #else screen = actualScreen; #endif SDL_ShowCursor(0); //disable the cursor /* Set up the SDL_TTF */ TTF_Init(); atexit(TTF_Quit); //printTTF("calling LoadRomFromPSP", 10, TEXT_HEIGHT*1, white, 1, actualScreen, 1); sound_system_init(); while(!exitNow) { #ifdef TARGET_WIN strncpy(romName, argv[1], 500); dbg_print("Starting emulation on file \"%s\"\n"); #endif if(LoadRomFromPSP(romName, actualScreen)<=0) { break; } SDL_FillRect(actualScreen, NULL, SDL_MapRGB(screen->format,0,0,0));//fill black SDL_Flip(actualScreen); //printTTF(romName, 20, TEXT_HEIGHT*16, white, 1, actualScreen, 1); system_sound_chipreset(); //Resets chips handleInputFile(romName); InitInput(NULL); dbg_print("Running NGPC Emulation\n"); SDL_PauseAudio(0); //run audio #ifdef TARGET_PSP switch(options[PSP_MHZ_OPTION]) { case PSP_MHZ_222: scePowerSetClockFrequency(222, 222, 111); break; case PSP_MHZ_266: scePowerSetClockFrequency(266, 266, 133); break; default: case PSP_MHZ_333: scePowerSetClockFrequency(333, 333, 166); break; } #endif ngpc_run(); #ifdef TARGET_PSP scePowerSetClockFrequency(222, 222, 111); #endif SDL_PauseAudio(1); //pause audio flashShutdown(); } //printTTF("EXITING", 10, TEXT_HEIGHT*10, white, 1); #ifdef TARGET_PSP sceKernelExitGame(); //Exit the program when it is done. #endif return 0; }
int main(int argc, char *argv[]) { int doScale=0; // 0=Undefined, 1=320x240, -1=OpenGL, >1=SwScale char* dumpPack=NULL; int state=1; //Game, Menu, Editor, Quit int sdlVideoModeFlags = SDL_SWSURFACE; #ifdef PSP //Note to PSP porter, please test if HW is actually faster, Wizznic does a lot of memory-manipulation in the screen-surface, each call might initiate a full copy back/forth from video memory. Remove comment when read. :) sdlVideoModeFlags = (SDL_HWSURFACE | SDL_DOUBLEBUF |SDL_HWACCEL); SetupCallbacks();//Callbacks actifs scePowerSetClockFrequency(333,333,166); #endif // #ifdef WIN32 //Redirect stdout to console on windows, so we can see what's going in. // FILE *stream; // stream = freopen("CON", "w", stdout); // #endif //Print welcome message printf( "Wizznic "VERSION_STRING". GPLv3 or newer Copyleft 2010-2013\n\n"); //initialize path strings initUserPaths(); //Tell where stuff's at. printf("Directories:\n Settings: %s\n DLC: %s\n Highscores: %s\n Editorlevels: %s\n Datafiles: %s\n\n", \ getConfigDir(), getUsrPackDir(), getHighscoreDir(), getUserLevelDir(), (!strlen(DATADIR))?".":DATADIR); //Print the command line parameters printf("Command-line parameters:\n"STR_VID_OPTIONS); //Quit if user wants help if( argc > 1 && ( strcmp(argv[1], "-h")==0 || strcmp(argv[1], "--help")==0 || strcmp(argv[1], "-help")==0 )) { printf("Please see readme.txt or http://wizznic.org/ for more help.\n"); return(0); } //Read settings printf("Loading settings...\n"); initSettings(); #if defined(WITH_OPENGL) //We start by enabling glScaling if it was enabled in settings, it can then be overwritten by command line options. if( setting()->glEnable && doScale==0 ) doScale=-1; #endif //Set scaling setting()->scaleFactor=1.0; atexit(SDL_Quit); //Init SDL if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK | SDL_INIT_TIMER ) <0 ) { printf("SDL_Init failed: %s\n",SDL_GetError()); return(-1); } //Setup display #if defined (GP2X) || defined (PSP) || defined (WIZ) SDL_Surface* screen = SDL_SetVideoMode(SCREENW,SCREENH,16, sdlVideoModeFlags); #else SDL_Surface* screen=NULL; int i; for( i=0; i < argc; i++ ) { if( strcmp( argv[i], "-sw" ) == 0 ) { setting()->glEnable=0; doScale=0; saveSettings(); } else if( strcmp( argv[i], "-gl" ) == 0 ) { setting()->glEnable=1; doScale=-1; saveSettings(); } else if( strcmp( argv[i], "-z" ) == 0 ) { if( i+1 < argc ) { doScale = atoi( argv[i+1] ); setting()->glEnable=0; i++; saveSettings(); } else { printf(" -z requires zoom level ( -z 2 for example ).\n"); return(1); } } else if( strcmp( argv[i], "-f" ) == 0 ) { setting()->fullScreen=1; saveSettings(); } else if( strcmp( argv[i], "-w" ) == 0 ) { setting()->fullScreen=0; saveSettings(); } else if( strcmp( argv[i], "-glheight" ) == 0 ) { if( i+1 < argc ) { setting()->glHeight = atoi( argv[i+1] ); setting()->glEnable=1; doScale=-1; i++; printf("Setting OpenGL window height to %i.\n", setting()->glHeight); saveSettings(); } else { printf(" -glheight requires an argument (-1 or size in pixels).\n"); return(1); } } else if( strcmp( argv[i], "-glwidth" ) == 0 ) { if( i+1 < argc ) { setting()->glWidth = atoi( argv[i+1] ); setting()->glEnable=1; doScale=-1; i++; printf("Setting OpenGL window width to %i.\n", setting()->glWidth); saveSettings(); } else { printf(" -glwidth requires an argument (-1 or size in pixels).\n"); return(1); } } else if( strcmp( argv[i], "-glfilter" ) == 0 ) { if( i+1 < argc ) { setting()->glFilter=atoi(argv[i+1]); printf("OpenGL texture filtering set to %s.\n", (setting()->glFilter)?"Smooth":"Off"); i++; saveSettings(); } else { printf("-glfilter requires 0 or 1 as argument.\n"); return(1); } } else if( strcmp( argv[i] , "-d" ) == 0 ) { if( argc == 3 && i < argc+1 ) { dumpPack = malloc( sizeof(char)*strlen(argv[i+1])+1 ); strcpy( dumpPack, argv[i+1] ); doScale=0; setting()->glEnable=0; i++; } else { printf("-d requires a packname, and must not be used with other parameters.\n"); return(1); } } else if( strcmp( argv[i], "-rift") == 0 ) { setting()->glWidth = 1280; setting()->glHeight = 800; setting()->glEnable=1; setting()->rift=1; doScale=-1; } else if( i > 0 ) { printf("\nError: Invalid argument '%s', quitting.\n", argv[i]); return(1); } } if( setting()->fullScreen ) { sdlVideoModeFlags |= SDL_FULLSCREEN; } if(doScale) { //Hardware accelerated scaling if( doScale == -1 ) { #ifdef HAVE_ACCELERATION printf("Enabling platform specific accelerated scaling.\n"); screen = platformInitAccel(sdlVideoModeFlags); if( !screen ) { printf("Failed to set platform accelerated scaling, falling back to software window.\n"); screen=swScreen(SDL_SWSURFACE); doScale=0; } #else printf("\nError:\n Not compiled with hardware-scaling support, don't give me -z -1\n Exiting...\n"); return(-1); #endif } else if( doScale > 0 ) { #ifdef WANT_SWSCALE //Set up software scaling printf("Enabling slow software-based scaling to %ix%i.\n",320*doScale, 240*doScale); screen = swScaleInit(sdlVideoModeFlags,doScale); #else printf("\nError:\n I don't support software scaling, don't give me any -z options\n Exiting...\n"); return(-1); #endif } } else { screen=swScreen(sdlVideoModeFlags); doScale=0; } printf("Scaling factor: %f\n", setting()->scaleFactor); if( screen == NULL ) { printf("ERROR: Couldn't init video.\n"); return(-1); } //Set window title SDL_WM_SetCaption("Wizznic!", "Wizznic!"); //Set window icon SDL_Surface* icon = IMG_Load( DATADIR"data/wmicon.png"); SDL_WM_SetIcon(icon, NULL); SDL_FreeSurface(icon); #endif setting()->bpp = screen->format->BytesPerPixel; setAlphaCol( setting()->bpp ); printf("Screen surface using %i bytes per pixel.\n",setting()->bpp); //Open Joysticks (for wiz) if (SDL_NumJoysticks() > 0) SDL_JoystickOpen(0); //Hide mouse cursor SDL_ShowCursor(SDL_DISABLE); //Load fonts txtInit(); //Load sounds if(!initSound()) { printf("Couldn't init sound.\n"); return(-1); } //Menu Graphics if(!initMenu(screen)) { printf("Couldn't load menu graphics.\n"); return(-1); } //Init controls initControls(); //Init stats statsInit(); //Init packs packInit(); //Scan userlevels dir makeUserLevelList(screen); //Init particles initParticles(screen); //Seed the pseudo random number generator (for particles 'n' stuff) srand( (int)time(NULL) ); #if defined(PC) //Need to dump level-screenshots? if(dumpPack) { printf("Dumping level-images for pack: %s\n", dumpPack); dumplevelimages(screen, dumpPack, 0); return(0); } #endif //init starfield initStars(screen); //Init pointer initPointer(screen); printf("Applying settings..\n"); //Apply settings (has to be done after packs are inited) applySettings(); //Set Pack packSetByPath( setting()->packDir ); #if defined( PLATFORM_SUPPORTS_STATSUPLOAD ) if( (setting()->uploadStats) && !(setting()->firstRun) ) { statsUpload(0,0,0,0,0,"check",1, &(setting()->session) ); statsUpload(0,0,0,0,0,"q_solved",1, &(setting()->solvedWorldWide) ); //DLC only works when stats-uploading is enabled so we can use the same nag-screen. dlcCheckOnline(); } #endif printf("Setting Music...\n"); //Start playing music (has to be done after readong settings) soundSetMusic(); //Initialize credits initCredits(screen); initTransition(); #if SCREENW != 320 || SCREENH != 240 SDL_Rect *borderSrcRect = malloc(sizeof(SDL_Rect)); SDL_Surface* border = loadImg( BORDER_IMAGE ); if( border ) { printf("Border image loaded.\n"); borderSrcRect->x=(border->w-SCREENW)/2; borderSrcRect->y=(border->h-SCREENH)/2; borderSrcRect->w=SCREENW; borderSrcRect->h=SCREENH; SDL_BlitSurface( border, borderSrcRect, screen, NULL ); SDL_FreeSurface(border); } else { printf("Could not load border image: %s\n", BORDER_IMAGE); SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0,0,0)); } free(borderSrcRect); borderSrcRect=NULL; #endif int lastTick; while(state!=STATEQUIT) { lastTick=SDL_GetTicks(); frameStart(); if(runControls()) state=STATEQUIT; switch(state) { case STATEPLAY: state = runGame(screen); break; case STATEMENU: state = runMenu(screen); break; case STATEEDIT: state=runEditor(screen); break; } drawPointer(screen); soundRun(screen,state); runTransition(screen); if(setting()->showFps) drawFPS(screen); switch( doScale ) { #if defined(HAVE_ACCELERATION) case -1: platformDrawScaled(screen); break; #endif case 0: SDL_Flip(screen); break; #if defined(WANT_SWSCALE) default: swScale(screen,doScale); break; #else default: state=STATEQUIT; break; #endif } #if defined(CRUDE_TIMING) //Oh how I loathe this, is there no better way? while(SDL_GetTicks()-lastTick <= PLATFORM_CRUDE_TIMING_TICKS) { //Burn, burn baby burn! } #else int t=SDL_GetTicks()-lastTick; if(t < 20) { SDL_Delay( 20 -t); } #endif } #if defined(PLATFORM_NEEDS_EXIT) platformExit(); #endif SDL_Quit(); return(0); }
int main(void) { int err = 0; scePowerSetClockFrequency(333, 333, 166); pspDebugScreenInit(); printf("#### PSCRYPTER v2.0 by Carlosgs ####\nEncrypt EBOOT.PBP files directly from the PSP\nUses the code made by 'bbtgp' and parts of the PSPSDK\nv2.0 added realocation fixing by JJS\nTHANK YOU!\n\n"); sceIoMkdir("./sign/", 0777); chdir("./sign/"); sceIoRemove("EBOOT_signed.PBP"); sceIoRemove("param.sfo"); sceIoRemove("icon0.png"); sceIoRemove("icon1.pmf"); sceIoRemove("pic0.png"); sceIoRemove("pic1.png"); sceIoRemove("snd0.at3"); sceIoRemove("data.psp"); sceIoRemove("data_unsigned.psp"); sceIoRemove("data.psar"); printf("Unpacking EBOOT file...\n"); err = main_unpack_pbp(); if(err != 0) { printf("Error while unpacking: %d\n",err); myexit(); } printf("\nFixing PRX realocations...\n"); err = main_fix_realocations(); if(err != 0) { printf("Error while fixing realocations: %d\n",err); myexit(); } printf("\nCrypting PRX file...\n"); err = main_crypter(); if(err != 0) { printf("Error while crypting: %d\n",err); myexit(); } printf("\nPacking new EBOOT file...\n"); err = main_pack_pbp(10, filename_list); if(err != 0) { printf("Error while packing: %d\n",err); myexit(); } printf("\n\nFinished! Hope it works!\n"); myexit(); return 0; }
int main(int argc, char *argv[]) #endif { #ifdef PSP SetupCallbacks(); scePowerSetClockFrequency(333, 333, 166); #endif for (int i=0; i<FLAG_COUNT; i++) { GAME_FLAGS[i] = false; } UNUSED(argc); string argvString = ""; #ifndef WII argvString = string(argv[0]); #else if (!fatInitDefault()) { printf("fatInitDefault ERROR #1"); std::fflush(stdout); timer.delay(500); exit(-1); } #endif get_filepath(); // fallback in case getcwd returns null if (FILEPATH.size() == 0) { std::cout << "Could not read path, fallback to using argv" << std::endl; FILEPATH = argvString.substr(0, argvString.size()-EXEC_NAME.size()); } std::cout << "main - argvString: '" << argvString << "', FILEPATH: '" << FILEPATH << "'" << std::endl; std::fflush(stdout); #ifdef PLAYSTATION2 std::cout << "PS2.DEBUG #1" << std::endl; std::fflush(stdout); #ifndef PS2LINK SifIopReset(NULL, 0); // clean previous loading of irx by apps like ulaunchElf. Comment this line to get cout on ps2link #endif printf("DEBUG.PS2 #1.1\n"); /* SP193: Being creative (Do something while waiting for the slow IOP to be reset). =D */ int main_id = GetThreadId(); ChangeThreadPriority(main_id, 72); std::cout << "PS2.DEBUG #1.1" << std::endl; std::fflush(stdout); printf("DEBUG.PS2 #1.2\n"); #ifndef PS2LINK while(SifIopSync()) { std::cout << "PS2.SifIopSync()" << std::endl; } #endif /* Initialize and connect to all SIF services on the IOP. */ SifInitRpc(0); SifInitIopHeap(); SifLoadFileInit(); fioInit(); printf("DEBUG.PS2 #1.3\n"); /* Apply the SBV LMB patch to allow modules to be loaded from a buffer in EE RAM. */ sbv_patch_enable_lmb(); // --- DEBUG --- // //FILEPATH = "cdfs:/"; // --- DEBUG --- // std::cout << "PS2.DEBUG #2" << std::endl; std::fflush(stdout); if (FILEPATH.find("mass:") != std::string::npos) { printf("DEBUG.PS2 #1.4\n"); std::cout << "PS2.DEBUG Load USB" << std::endl; std::fflush(stdout); PS2_load_USB(); } if (FILEPATH.find("cdfs") != std::string::npos || FILEPATH.find("cdrom") != std::string::npos) { printf("DEBUG.PS2 #1.5\n"); std::cout << "PS2.DEBUG Load CDROM" << std::endl; std::fflush(stdout); FILEPATH = "cdfs:"; PS2_load_CDROM(); } printf("DEBUG.PS2 #2\n"); std::cout << "PS2.DEBUG #3" << std::endl; std::fflush(stdout); #endif // check command-line paramethers if (argc > 1) { for (int i=1; i<argc; i++) { std::string temp_argv(argv[i]); if (temp_argv == "--fullscreen") { } else if (temp_argv == "--quickload") { GAME_FLAGS[FLAG_QUICKLOAD] = true; } else if (temp_argv == "--invencible") { // player have infinite HP GAME_FLAGS[FLAG_INVENCIBLE] = true; } else if (temp_argv == "--allweapons") { // player have all weapons available even if GAME_FLAGS[FLAG_ALLWEAPONS] = true; } else if (temp_argv == "--infinitejump") { // player can jump again and again GAME_FLAGS[FLAG_INFINITE_JUMP] = true; } } } std::cout << "PS2.DEBUG #7" << std::endl; std::fflush(stdout); //fio.check_conversion(); fio.read_game(game_data); //GAME_FLAGS[FLAG_INFINITE_HP] = true; // DEBUG gameControl.get_drop_item_ids(); soundManager.init_audio_system(); // PS2 version have to load config AFTER SDL_Init due to SDK issues #ifdef LINUX SAVEPATH = std::string(getenv("HOME")) + "/.rockbot/"; mkdir(SAVEPATH.c_str(), 0777); //std::cout << "SAVEPATH: " << SAVEPATH << ", mkdir-res: " << res << ", errno: " << errno << std::endl; #elif WIN32 SAVEPATH = std::string(getenv("APPDATA")) + "/rockbot"; std::cout << "SAVEPATH: " << SAVEPATH << std::endl; _mkdir(SAVEPATH.c_str()); #else SAVEPATH = FILEPATH; #endif #ifndef PLAYSTATION2 fio.load_config(game_config); #endif // INIT GRAPHICS if (graphLib.initGraphics() != true) { printf("ERROR intializing graphic\n"); return -1; } // define SAVEPATH #ifdef PLAYSTATION2 PS2_load_MC(); SAVEPATH = "mc0:Rockbot/"; if (fioMkdir(SAVEPATH.c_str()) < 0) { std::cout << "main - warning: could not create '" << SAVEPATH << "' folder" << std::endl; std::fflush(stdout); /// @TODO - check if directory exists } else { std::cout << "Folder '" << SAVEPATH << "' created" << std::endl; std::fflush(stdout); } #endif have_save = fio.save_exists(); #ifndef DEBUG_OUTPUT // redirect output to null std::string cout_file = "/dev/null"; std::ofstream out(cout_file.c_str()); std::cout.rdbuf(out.rdbuf()); #else // --- REDIRECT STDOUT TO A FILE --- // #if defined(PSP) || defined(WII) || defined(ANDROID) || defined(DINGUX) || defined(PLAYSTATION2) //std::string cout_file = SAVEPATH + "/stdout.txt"; std::string cout_file = FILEPATH + "/stdout.txt"; std::streambuf *coutbuf = std::cout.rdbuf(); std::ofstream out(cout_file.c_str()); std::cout.rdbuf(out.rdbuf()); //redirect std::cout to out.txt! #endif #endif graphLib.preload(); #ifdef PLAYSTATION2 fio.load_config(game_config); PS2_create_save_icons(); #endif draw_lib.preload(); gameControl.currentStage = APEBOT; // INIT GAME if (GAME_FLAGS[FLAG_QUICKLOAD] == false) { if (gameControl.showIntro() == false) { std::cout << "ERROR SHOWING INTRO" << std::endl; return 0; } } else { gameControl.quick_load_game(); //ending end_obj; //end_obj.start(); //return 1; } input.clean(); input.p1_input[BTN_START] = 0; input.waitTime(200); input.clean(); bool run_game = true; while (run_game) { #if !defined(PSP) && !defined(DINGUX) timer.start_ticker(); #endif #ifdef PLAYSTATION2 RotateThreadReadyQueue(_MIXER_THREAD_PRIORITY); #endif gameControl.showGame(); #ifdef DEBUG_SHOW_FPS gameControl.fps_count(); #endif draw_lib.update_screen(); if (input.p1_input[BTN_QUIT] == 1) { //std::cout << "LEAVE #3" << std::endl; std::fflush(stdout); gameControl.leave_game(); } unsigned int now_ticks = timer.get_ticks(); if (now_ticks < (1000 / FRAMES_PER_SECOND)) { timer.delay((1000 / FRAMES_PER_SECOND) - now_ticks); } } /// @TODO: sdl quit sub-systems #ifdef PSP sceKernelExitGame(); return 0; #else SDL_Quit(); #endif return 1; }
void OSPC_Play(char *fname,int release,int vol) { u16 *menu_bg; u16 *dst,*src; int i,j,pollcpt; char str[256]; char *emulator[3]={"Unknown","Zsnes","Snes9x"}; uint8 *scr; OSPC_Init(); if (i=OSPC_Load(fname)) { sprintf(str,"Error at SPC loading, code : %d",i); msgBoxLines(str,60); //gp32_pause(); //GpAppExit(); return; } OSPC_id=OSPC_GetID666(spc_data); OSPC_sound_fd = sceAudioChReserve( -1, 1024, 0 ); OSPC_exit=0; OSPC_volume=vol; OSPC_thread = sceKernelCreateThread( "OSPC Thread", (SceKernelThreadEntry)OSPC_PlayThread, 0x8, 256*1024, 0, 0 ); if (OSPC_thread<0) { msgBoxLines("Cannot create OSPC playback thread",60); } else { //init start time scePowerSetClockFrequency(266,266,133); sceKernelLibcGettimeofday( &OSPC_start_time, 0 ); sceKernelStartThread( OSPC_thread, 0, 0 ); if (release) return; //init bg menu_bg=(u16*)malloc_64(480*272*2); dst=menu_bg; show_background(bg_img_mul,(os9x_lowbat?0x600000:0)); for (i=0;i<272;i++) { src = (u16*)pgGetVramAddr(0,i); memcpy(dst,src,480*2); dst+=480; } //init fx fx_init(); for (;;) { //show bg OSPC_show_bg(menu_bg); //show bg fx fx_main(pgGetVramAddr(0,0)); //batt infos show_batteryinfo(); //music info //draw frame pgDrawFrame(14,14,20+230+5+1,75+1,12|(12<<5)|(12<<10)); pgDrawFrame(13,13,20+230+5+2,75+2,30|(30<<5)|(30<<10)); pgDrawFrame(12,12,20+230+5+3,75+3,12|(12<<5)|(12<<10)); pgFillBoxHalfer(15,15,20+230+5,75); // if (strlen(OSPC_id->gametitle)) sprintf(str,"Game : %s",OSPC_id->gametitle); else sprintf(str,"Game : unknown"); mh_print(20,20,(char*)str,30|(30<<5)|(30<<10)); if (strlen(OSPC_id->songname)) sprintf(str,"Song : %s",OSPC_id->songname); else sprintf(str,"Song : unknown"); mh_print(20,30,(char*)str,30|(30<<5)|(30<<10)); if (strlen(OSPC_id->dumper)) sprintf(str,"Dumper : %s",OSPC_id->dumper); else sprintf(str,"Dumper : unknown"); mh_print(20,40,(char*)str,30|(30<<5)|(30<<10)); if (strlen(OSPC_id->comments)) sprintf(str,"Comments : %s",OSPC_id->comments); else sprintf(str,"Comments : unknown"); mh_print(20,50,(char*)str,30|(30<<5)|(30<<10)); if (strlen(OSPC_id->author)) sprintf(str,"Author : %s",OSPC_id->author); else sprintf(str,"Author : unknown"); mh_print(20,60,(char*)str,30|(30<<5)|(30<<10)); //time infos //draw frame //draw frame pgDrawFrame(14,94,20+65+5+1,116,8|(8<<5)|(16<<10)); pgDrawFrame(13,93,20+65+5+2,117,28|(28<<5)|(31<<10)); pgDrawFrame(12,92,20+65+5+3,118,8|(8<<5)|(16<<10)); pgFillBoxHalfer(15,95,20+65+5,115); sceKernelLibcGettimeofday( &OSPC_cur_time, 0 ); i=(OSPC_cur_time.tv_sec-OSPC_start_time.tv_sec)+(OSPC_cur_time.tv_usec-OSPC_start_time.tv_usec)/1000000; sprintf(str,"%2d%c%.2d / %2d:%.2d",i/60,((i&1)?':':' '),i%60,OSPC_id->playtime/60,OSPC_id->playtime%60); mh_print(20,100,(char*)str,(20)|(31<<5)|(18<<10)); if (get_pad()) break; pgScreenFlip(); } OSPC_exit=1; sceKernelWaitThreadEnd( OSPC_thread, NULL ); sceKernelDeleteThread( OSPC_thread ); OSPC_thread=-1; free(menu_bg); fx_close(); } sceAudioChRelease( OSPC_sound_fd ); OSPC_Stop(); OSPC_Close(); if (OSPC_id) free(OSPC_id); }