void loadmenu_dispupdate(int romcount) { //draw blue screen for(int y=0;y<240;y++){ for(int x=0;x<256*2;x+=2){ memset(GFX.Screen + 320*y*2+x,0x11,2); } } strcpy(disptxt[0]," Snes9x4P v20120226"); //copy roms filenames to disp[] cache for(int i=0;i<=romcount_maxrows;i++) { if (loadcursor>romcount_maxrows) { if((i+(loadcursor-romcount_maxrows))==loadcursor) sprintf(temp," >%s",namelist[ i+(loadcursor-romcount_maxrows) ]->d_name); else sprintf(temp," %s",namelist[ i+(loadcursor-romcount_maxrows) ]->d_name); strncpy(disptxt[i+2],temp,34); disptxt[i+2][34]='\0'; } else if (i<romcount) { if(i==loadcursor) sprintf(temp," >%s",namelist[i]->d_name); else sprintf(temp," %s",namelist[i]->d_name); strncpy(disptxt[i+2],temp,34); disptxt[i+2][34]='\0'; } } //draw 20 lines on screen for(int i=0;i<19;i++) { S9xDisplayString (disptxt[i], GFX.Screen, 640,i*10+64); } //update screen S9xDeinitUpdate (320, 240); }
static void S9xEndScreenRefresh (void) { FLUSH_REDRAW(); PPU.GunVLatch = 1000; /* i.e., never latch */ PPU.GunHLatch = 0; if (!Settings.NormalControls && pad_read) S9xControlEOF(); pad_read = FALSE; if(Settings.SpeedhackGameID > SPEEDHACK_NONE) speedhacks_manager(); if (!(GFX.DoInterlace && GFX.InterlaceFrame == 0)) S9xDeinitUpdate(IPPU.RenderedScreenWidth, IPPU.RenderedScreenHeight); S9xApplyCheats(); }
void Snes9xPreferences::get_settings_from_dialog (void) { int sound_needs_restart = 0; int gfx_needs_restart = 0; if ((config->sound_driver != get_combo ("sound_driver")) || (config->mute_sound != get_check ("mute_sound_check")) || (config->sound_buffer_size != (int) get_spin ("sound_buffer_size"))|| (Settings.Stereo != get_check ("stereo_check")) || (config->sound_playback_rate != (7 - (get_combo ("playback_combo")))) || (config->sound_input_rate != get_slider ("sound_input_rate")) || (Settings.SoundSync != get_check ("sync_sound")) ) { sound_needs_restart = 1; } #ifdef USE_XRANDR if ((config->change_display_resolution != get_check ("change_display_resolution") || (config->change_display_resolution && (config->xrr_index != get_combo ("resolution_combo")))) && config->fullscreen) { top_level->leave_fullscreen_mode (); config->xrr_index = get_combo ("resolution_combo"); config->xrr_width = config->xrr_sizes[config->xrr_index].width; config->xrr_height = config->xrr_sizes[config->xrr_index].height; config->change_display_resolution = get_check ("change_display_resolution"); top_level->enter_fullscreen_mode (); } else { config->xrr_index = get_combo ("resolution_combo"); config->xrr_width = config->xrr_sizes[config->xrr_index].width; config->xrr_height = config->xrr_sizes[config->xrr_index].height; } #endif config->change_display_resolution = get_check ("change_display_resolution"); if (config->multithreading != get_check ("multithreading")) gfx_needs_restart = 1; if (config->hw_accel != hw_accel_value (get_combo ("hw_accel"))) gfx_needs_restart = 1; if (config->force_inverted_byte_order != get_check ("force_inverted_byte_order")) gfx_needs_restart = 1; #ifdef USE_OPENGL #endif config->full_screen_on_open = get_check ("full_screen_on_open"); Settings.DisplayFrameRate = get_check ("show_frame_rate"); config->scale_to_fit = get_check ("scale_to_fit"); config->overscan = get_check ("overscan"); config->maintain_aspect_ratio = get_check ("maintain_aspect_ratio"); config->aspect_ratio = get_combo ("aspect_ratio"); config->scale_method = get_combo ("scale_method_combo"); config->hires_effect = get_combo ("hires_effect"); config->force_inverted_byte_order = get_check ("force_inverted_byte_order"); Settings.AutoSaveDelay = get_entry_value ("save_sram_after_sec"); config->multithreading = get_check ("multithreading"); config->pause_emulation_on_switch = get_check ("pause_emulation_on_switch"); Settings.SkipFrames = get_combo ("frameskip_combo"); Settings.BlockInvalidVRAMAccessMaster = get_check ("block_invalid_vram_access"); Settings.UpAndDown = get_check ("upanddown"); config->sound_driver = get_combo ("sound_driver"); Settings.Stereo = get_check ("stereo_check"); config->sound_playback_rate = 7 - (get_combo ("playback_combo")); config->sound_buffer_size = get_spin ("sound_buffer_size"); config->sound_input_rate = get_slider ("sound_input_rate"); Settings.SoundSync = get_check ("sync_sound"); config->mute_sound = get_check ("mute_sound_check"); config->mute_sound_turbo = get_check ("mute_sound_turbo_check"); store_ntsc_settings (); config->ntsc_scanline_intensity = get_combo ("ntsc_scanline_intensity"); config->scanline_filter_intensity = get_combo ("scanline_filter_intensity"); config->hw_accel = hw_accel_value (get_combo ("hw_accel")); config->bilinear_filter = get_check ("bilinear_filter"); config->num_threads = get_spin ("num_threads"); config->default_esc_behavior = get_combo ("default_esc_behavior"); config->prevent_screensaver = get_check ("prevent_screensaver"); config->rewind_buffer_size = get_spin ("rewind_buffer_size"); config->rewind_granularity = get_spin ("rewind_granularity"); #ifdef USE_JOYSTICK config->joystick_threshold = get_spin ("joystick_threshold"); #endif #ifdef USE_OPENGL if (config->sync_to_vblank != get_check ("sync_to_vblank") || config->npot_textures != get_check ("npot_textures") || config->use_pbos != get_check ("use_pbos") || config->pbo_format != get_combo ("pixel_format") || config->use_shaders != get_check ("use_shaders") || get_check ("use_shaders")) { gfx_needs_restart = 1; } config->sync_to_vblank = get_check ("sync_to_vblank"); config->use_pbos = get_check ("use_pbos"); config->npot_textures = get_check ("npot_textures"); config->use_shaders = get_check ("use_shaders"); config->sync_every_frame = get_check ("sync_every_frame"); strncpy (config->fragment_shader, get_entry_text ("fragment_shader"), PATH_MAX); config->pbo_format = get_combo ("pixel_format"); #endif char safety_sram_directory [PATH_MAX]; strncpy (safety_sram_directory, get_entry_text ("sram_directory"), PATH_MAX); strncpy (config->savestate_directory, get_entry_text ("savestate_directory"), PATH_MAX); strncpy (config->patch_directory, get_entry_text ("patch_directory"), PATH_MAX); strncpy (config->cheat_directory, get_entry_text ("cheat_directory"), PATH_MAX); strncpy (config->export_directory, get_entry_text ("export_directory"), PATH_MAX); if (!strcmp (safety_sram_directory, SAME_GAME)) safety_sram_directory[0] = '\0'; if (!strcmp (config->savestate_directory, SAME_GAME)) config->savestate_directory[0] = '\0'; if (!strcmp (config->patch_directory, SAME_GAME)) config->patch_directory[0] = '\0'; if (!strcmp (config->cheat_directory, SAME_GAME)) config->cheat_directory[0] = '\0'; if (!strcmp (config->export_directory, SAME_GAME)) config->export_directory[0] = '\0'; if (strcmp (safety_sram_directory, config->sram_directory) && config->rom_loaded) { GtkWidget *msg; int responseid; msg = gtk_message_dialog_new (GTK_WINDOW (this->window), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK_CANCEL, _("Changing the SRAM directory with a game loaded will replace the .srm file in the selected directory with the SRAM from the running game. If this is not what you want, click 'cancel'.")); gtk_window_set_title (GTK_WINDOW (msg), _("Warning: Possible File Overwrite")); responseid = gtk_dialog_run (GTK_DIALOG (msg)); if (responseid == GTK_RESPONSE_OK) { strncpy (config->sram_directory, safety_sram_directory, PATH_MAX); } else { if (config->sram_directory[0] == '\0') set_entry_text ("sram_directory", SAME_GAME); else set_entry_text ("sram_directory", config->sram_directory); } gtk_widget_destroy (msg); } else { strncpy (config->sram_directory, safety_sram_directory, PATH_MAX); } if (Settings.SkipFrames == 0) Settings.SkipFrames = AUTO_FRAMERATE; else Settings.SkipFrames--; memcpy (config->pad, pad, (sizeof (JoypadBinding)) * NUM_JOYPADS); memcpy (config->shortcut, shortcut, (sizeof (Binding)) * NUM_EMU_LINKS); if (sound_needs_restart) { S9xPortSoundReinit (); } if (gfx_needs_restart) { S9xReinitDisplay (); } S9xDisplayReconfigure (); S9xDisplayRefresh (top_level->last_width, top_level->last_height); S9xDeinitUpdate (top_level->last_width, top_level->last_height); top_level->configure_widgets (); if (config->default_esc_behavior != ESC_TOGGLE_MENUBAR) top_level->leave_fullscreen_mode (); return; }
void ShowCredit() { uint8 *keyssnes = 0; int line=0,ypix=0,maxlines=26; char disptxt[100][256]={ "", "", " Thank you for using this Emulator! ", "", "", " Created by the Snes9x team.", "", " Port to libSDL by SiENcE", " crankgaming.blogspot.com", "", " regards to joyrider & g17", "", "", " Pandora port started by:", " skeezix", "", " Further work and maintenance:", " Ivanovic", "", " Special thanks to:", " EvilDragon (picklelauncher theme)", " john4p (cutting borders)", " Notaz (modified libSDL for Pandora)", " pickle (picklelauncher, Scale2x)", " WizardStan (smooth scaler)", "", }; do { SDL_Event event; SDL_PollEvent(&event); keyssnes = SDL_GetKeyState(NULL); //draw blue screen for(int y=0;y<240;y++){ for(int x=0;x<256*2;x+=2){ memset(GFX.Screen + 320*y*2+x,0x11,2); } } for(int i=0;i<=16;i++){ int j=i+line; if(j>=maxlines) j-=maxlines; S9xDisplayString (disptxt[j], GFX.Screen, 640,i*10+80-ypix); } ypix+=2; if(ypix==12) { line++; ypix=0; } if(line == maxlines) line = 0; S9xDeinitUpdate (320, 240); sys_sleep(3000); } while(keyssnes[sfc_key[B_1]] != SDL_PRESSED); return; }
void menu_loop(void) { bool8_32 exit_loop = false; char fname[256], ext[8]; char snapscreen_tmp[17120]; uint8 *keyssnes = 0; SaveSlotNum_old = -1; Scale_org = Scale; highres_current=Settings.SupportHiRes; capt_screenshot(); memcpy(snapscreen_tmp,snapscreen,17120); Scale = false; Settings.SupportHiRes=FALSE; S9xDeinitDisplay(); S9xInitDisplay(0, 0); menu_dispupdate(); sys_sleep(100000); SDL_Event event; do { while(SDL_PollEvent(&event)==1) { //PANDORA & DINGOO & WIN32 ----------------------------------------------------- keyssnes = SDL_GetKeyState(NULL); if(keyssnes[sfc_key[UP_1]] == SDL_PRESSED) cursor--; else if(keyssnes[sfc_key[DOWN_1]] == SDL_PRESSED) cursor++; else if( (keyssnes[sfc_key[A_1]] == SDL_PRESSED) || (keyssnes[sfc_key[LEFT_1]] == SDL_PRESSED) || (keyssnes[sfc_key[RIGHT_1]] == SDL_PRESSED) ) { switch(cursor) { case 2: //exit snes9x if (keyssnes[sfc_key[A_1]] == SDL_PRESSED) S9xExit(); break; case 3: //reset snes9x if ((keyssnes[sfc_key[A_1]] == SDL_PRESSED)) { //make sure the sram is stored before resetting the console //it should work without, but better safe than sorry... Memory.SaveSRAM (S9xGetFilename (".srm")); S9xReset(); exit_loop = TRUE; } break; case 4: if (keyssnes[sfc_key[A_1]] == SDL_PRESSED) ShowCredit(); break; case 6: //save state if (keyssnes[sfc_key[A_1]] == SDL_PRESSED) { memcpy(snapscreen,snapscreen_tmp,16050); show_screenshot(); strcpy(fname," Saving..."); S9xDisplayString (temp, GFX.Screen +320/*280*/, 640,80/*204*/); S9xDeinitUpdate (320, 240); sprintf(ext, ".s0%d", SaveSlotNum); strcpy(fname, S9xGetFilename (ext)); save_screenshot(fname); sprintf(ext, ".00%d", SaveSlotNum); strcpy(fname, S9xGetFilename (ext)); S9xFreezeGame (fname); sync(); exit_loop = TRUE; } break; case 7: //load state if (keyssnes[sfc_key[A_1]] == SDL_PRESSED) { sprintf(ext, ".00%d", SaveSlotNum); strcpy(fname, S9xGetFilename (ext)); S9xLoadSnapshot (fname); exit_loop = TRUE; } break; case 8: //select save state slot if (keyssnes[sfc_key[LEFT_1]] == SDL_PRESSED) { if ( SaveSlotNum == 0 ) SaveSlotNum = MAX_SAVE_SLOTS-1; // slots start at 0, so 10 slots means slot 0 to 9 else --SaveSlotNum; } else if (keyssnes[sfc_key[RIGHT_1]] == SDL_PRESSED) { if ( SaveSlotNum == MAX_SAVE_SLOTS-1 ) // slots start at 0, so 10 slots means slot 0 to 9 SaveSlotNum = 0; else ++SaveSlotNum; } break; case 10: // rotate through scalers if (keyssnes[sfc_key[RIGHT_1]] == SDL_PRESSED) { do { g_scale = (blit_scaler_e) ( ( g_scale + 1 ) % bs_max ); } while ( ( blit_scalers [ g_scale ].valid == bs_invalid ) || ( highres_current && !(blit_scalers [ g_scale ].support_hires) ) ); } else if (keyssnes[sfc_key[LEFT_1]] == SDL_PRESSED) { do { g_scale = (blit_scaler_e) ( g_scale - 1 ); if (g_scale < 1) g_scale = (blit_scaler_e)(bs_max-1); } while ( ( blit_scalers [ g_scale ].valid == bs_invalid ) || ( highres_current && !(blit_scalers [ g_scale ].support_hires) ) ); } // now force update the display, so that the new scaler is directly used (fixes some glitches) S9xDeinitDisplay(); S9xInitDisplay(0, 0); break; case 11: // set frameskip if (Settings.SkipFrames == AUTO_FRAMERATE) Settings.SkipFrames = 10; if (keyssnes[sfc_key[LEFT_1]] == SDL_PRESSED) Settings.SkipFrames--; else Settings.SkipFrames++; if(Settings.SkipFrames<=0 || Settings.SkipFrames==10) Settings.SkipFrames = AUTO_FRAMERATE; else if (Settings.SkipFrames>=11) Settings.SkipFrames = 1; break; case 12: // set vsync if (g_vsync) g_vsync = 0; else g_vsync = 1; break; case 13: // set display fps Settings.DisplayFrameRate = !Settings.DisplayFrameRate; break; case 14: // set transparency Settings.Transparency = !Settings.Transparency; break; case 15: // cut lines from top if (keyssnes[sfc_key[RIGHT_1]] == SDL_PRESSED) cut_top++; else if (keyssnes[sfc_key[LEFT_1]] == SDL_PRESSED && cut_top>0) cut_top--; // now force update the display, so that the new scaler is directly used (fixes some glitches) S9xDeinitDisplay(); S9xInitDisplay(0, 0); break; case 16: // cut lines from bottom if (keyssnes[sfc_key[RIGHT_1]] == SDL_PRESSED) cut_bottom++; else if (keyssnes[sfc_key[LEFT_1]] == SDL_PRESSED && cut_bottom>0) cut_bottom--; S9xDeinitDisplay(); S9xInitDisplay(0, 0); break; case 17: // cut from the left if (keyssnes[sfc_key[RIGHT_1]] == SDL_PRESSED) cut_left++; else if (keyssnes[sfc_key[LEFT_1]] == SDL_PRESSED && cut_left>0) cut_left--; S9xDeinitDisplay(); S9xInitDisplay(0, 0); break; case 18: // cut from the right if (keyssnes[sfc_key[RIGHT_1]] == SDL_PRESSED) cut_right++; else if (keyssnes[sfc_key[LEFT_1]] == SDL_PRESSED && cut_right>0) cut_right--; S9xDeinitDisplay(); S9xInitDisplay(0, 0); break; case 20: //offer an option to change to alternative sample decoding //cf. http://www.gp32x.com/board/index.php?/topic/55378-snes9x4d4p-another-new-build-now-with-hi-res-and-new-rom-picker/page__view__findpost__p__958860 if (Settings.AltSampleDecode) Settings.AltSampleDecode = 0; else Settings.AltSampleDecode = 1; break; } } if(cursor==1) cursor=20; else if(cursor==21) cursor=2; if(cursor==5 || cursor==9 || cursor==19) { if(keyssnes[sfc_key[UP_1]] == SDL_PRESSED) cursor--; else if(keyssnes[sfc_key[DOWN_1]] == SDL_PRESSED) cursor++; } menu_dispupdate(); sys_sleep(1000); break; } } while( exit_loop!=TRUE && keyssnes[sfc_key[B_1]] != SDL_PRESSED ); Scale = Scale_org; Settings.SupportHiRes=highres_current; S9xDeinitDisplay(); S9xInitDisplay(0, 0); }
void menu_dispupdate(void) { // char temp[256]; // char disptxt[20][256]; //memset(GFX.Screen + 320*12*2,0x11,320*200*2); //draw blue screen for(int y=0;y<240;y++){ for(int x=0;x<256*2;x+=2){ memset(GFX.Screen + 320*y*2+x,0x11,2); } } strcpy(disptxt[0],"Snes9x4P v20120226"); strcpy(disptxt[1],"------------------"); strcpy(disptxt[2],"Exit Emulator"); strcpy(disptxt[3],"Reset Game"); strcpy(disptxt[4],"Credits"); strcpy(disptxt[5],"------------------"); strcpy(disptxt[6],"Save State"); strcpy(disptxt[7],"Load State"); strcpy(disptxt[8],"State Slot No."); sprintf(temp,"%s%d",disptxt[8],SaveSlotNum); strcpy(disptxt[8],temp); strcpy(disptxt[9],"------------------"); strcpy(disptxt[10],"Display mode "); sprintf ( temp, "%s%s", disptxt [10], blit_scalers [ g_scale ].desc_en ); strcpy ( disptxt[10], temp ); strcpy(disptxt[11],"Frameskip "); if (Settings.SkipFrames == AUTO_FRAMERATE) sprintf(temp,"%s Auto",disptxt[11]); else sprintf(temp,"%s %02d/%d",disptxt[11],(int) Memory.ROMFramesPerSecond, Settings.SkipFrames); strcpy(disptxt[11],temp); strcpy(disptxt[12],"V-Sync "); if(g_vsync) sprintf(temp,"%s On",disptxt[12]); else sprintf(temp,"%s Off",disptxt[12]); strcpy(disptxt[12],temp); strcpy(disptxt[13],"Display Frame Rate "); if(Settings.DisplayFrameRate) sprintf(temp,"%s On",disptxt[13]); else sprintf(temp,"%s Off",disptxt[13]); strcpy(disptxt[13],temp); strcpy(disptxt[14],"Transparency "); if(Settings.Transparency) sprintf(temp,"%s On",disptxt[14]); else sprintf(temp,"%s Off",disptxt[14]); strcpy(disptxt[14],temp); strcpy(disptxt[15],"Cut Top "); sprintf(temp,"%s%d",disptxt[15],cut_top); strcpy(disptxt[15],temp); strcpy(disptxt[16],"Cut Bottom "); sprintf(temp,"%s%d",disptxt[16],cut_bottom); strcpy(disptxt[16],temp); strcpy(disptxt[17],"Cut Left "); sprintf(temp,"%s%d",disptxt[17],cut_left); strcpy(disptxt[17],temp); strcpy(disptxt[18],"Cut Right "); sprintf(temp,"%s%d",disptxt[18],cut_right); strcpy(disptxt[18],temp); strcpy(disptxt[19],"------------------"); strcpy(disptxt[20],"Alt. Sample Decoding "); if(Settings.AltSampleDecode) sprintf(temp,"%s On",disptxt[20]); else sprintf(temp,"%s Off",disptxt[20]); strcpy(disptxt[20],temp); strcpy(disptxt[21],""); battery_level = batt_level(); strcpy(disptxt[22]," Battery:"); if (battery_level >= 100) sprintf(temp,"%s %d%%",disptxt[22],battery_level); else if (battery_level >=10) sprintf(temp,"%s %d%%",disptxt[22],battery_level); else sprintf(temp,"%s %d%%",disptxt[22],battery_level); strcpy(disptxt[22],temp); for(int i=0;i<=22;i++) { if(i==cursor) sprintf(temp," >%s",disptxt[i]); else sprintf(temp," %s",disptxt[i]); strcpy(disptxt[i],temp); if ( i<=21 ) S9xDisplayString (disptxt[i], GFX.Screen, 640,i*10+50); else //put the last line (for the battery indicator) a little lower than the rest S9xDisplayString (disptxt[i], GFX.Screen, 640,i*10+55); } //show screen shot for snapshot if(SaveSlotNum_old != SaveSlotNum) { strcpy(temp," Loading..."); S9xDisplayString (temp, GFX.Screen +320/*280*/, 640,80/*204*/); //S9xDeinitUpdate (320, 240); char fname[256], ext[8]; sprintf(ext, ".s0%d", SaveSlotNum); strcpy(fname, S9xGetFilename (ext)); load_screenshot(fname); SaveSlotNum_old = SaveSlotNum; } show_screenshot(); S9xDeinitUpdate (320, 240); }