bool8_32 S9xDeinitUpdate (int Width, int Height, bool8_32) { if(mInMenu) return TRUE; u32 newTimer; if (mMenuOptions.showFps) { mFps++; newTimer=sal_TimerRead(); if(newTimer-mLastTimer>Memory.ROMFramesPerSecond) { mLastTimer=newTimer; sprintf(mFpsDisplay,"FPS: %d / %d", mFps, Memory.ROMFramesPerSecond); mFps=0; } sal_VideoDrawRect(0,0,13*8,8,SAL_RGB(0,0,0)); sal_VideoPrint(0,0,mFpsDisplay,SAL_RGB(31,31,31)); } if(mVolumeDisplayTimer>0) { sal_VideoDrawRect(100,0,8*8,8,SAL_RGB(0,0,0)); sal_VideoPrint(100,0,mVolumeDisplay,SAL_RGB(31,31,31)); } if(mQuickStateTimer>0) { sal_VideoDrawRect(200,0,8*8,8,SAL_RGB(0,0,0)); sal_VideoPrint(200,0,mQuickStateDisplay,SAL_RGB(31,31,31)); } sal_VideoFlip(0); }
static s32 SaveStateSelect(s32 mode) { s8 text[128]; s32 action=11; s32 saveno=0; u32 keys=0; u16 *pixTo,*pixFrom; if(mRomName[0]==0) { // no rom loaded // display error message and exit return(0); } // Allow the emulator to back out of loading a saved state for previewing. SaveStateTemp(); ScanSaveStates(mRomName); sal_InputIgnore(); while (action!=0&&action!=100) { keys=sal_InputPollRepeat(); if(keys&SAL_INPUT_UP) {saveno--; action=1;} if(keys&SAL_INPUT_DOWN) {saveno++; action=1;} if(saveno<-1) saveno=9; if(saveno>9) saveno=-1; if(keys&INP_BUTTON_MENU_CANCEL) action=0; // exit else if((keys&INP_BUTTON_MENU_SELECT)&&(saveno==-1)) action=0; // exit else if((keys&INP_BUTTON_MENU_SELECT)&&(mode==0)&&((action==2)||(action==5))) action=6; // pre-save mode else if((keys&INP_BUTTON_MENU_SELECT)&&(mode==1)&&(action==5)) action=8; // pre-load mode else if((keys&INP_BUTTON_MENU_SELECT)&&(mode==2)&&(action==5)) { if(MenuMessageBox("Are you sure you want to delete","this save?","",MENU_MESSAGE_BOX_MODE_YESNO)==SAL_OK) action=13; //delete slot with no preview } else if((keys&INP_BUTTON_MENU_PREVIEW_SAVESTATE)&&(action==12)) action=3; // preview slot mode else if((keys&INP_BUTTON_MENU_SELECT)&&(mode==1)&&(action==12)) action=8; //load slot with no preview else if((keys&INP_BUTTON_MENU_SELECT)&&(mode==0)&&(action==12)) action=6; //save slot with no preview else if((keys&INP_BUTTON_MENU_SELECT)&&(mode==2)&&(action==12)) { if(MenuMessageBox("Are you sure you want to delete","this save?","",MENU_MESSAGE_BOX_MODE_YESNO)==SAL_OK) action=13; //delete slot with no preview } PrintTitle("Save States"); sal_VideoPrint(36,4,"UP/DOWN to choose a slot",SAL_RGB(31,8,8)); if(saveno==-1) { if(action!=10&&action!=0) { action=10; } } else { sal_VideoDrawRect(0, 16, 262, 16, SAL_RGB(22,0,0)); sprintf(text,"SLOT %d",saveno); sal_VideoPrint(107,20,text,SAL_RGB(31,31,31)); } switch(action) { case 1: //sal_VideoPrint(112,145-36,14,"Checking....",(unsigned short)SAL_RGB(31,31,31)); break; case 2: sal_VideoPrint(115,145-36,"FREE",SAL_RGB(31,31,31)); break; case 3: sal_VideoPrint(75,145-36,"Previewing...",SAL_RGB(31,31,31)); break; case 4: sal_VideoPrint(59,145-36,"Previewing failed",SAL_RGB(31,8,8)); break; case 5: { u32 DestWidth = 205, DestHeight = 154; sal_VideoBitmapScale(0, 0, SNES_WIDTH, SNES_HEIGHT, DestWidth, DestHeight, SAL_SCREEN_WIDTH - DestWidth, &mTempFb[0], (u16*)sal_VideoGetBuffer()+(SAL_SCREEN_WIDTH*(((202 + 16) - DestHeight)/2))+((262 - DestWidth)/2)); sal_VideoDrawRect(0, 186, 262, 16, SAL_RGB(22,0,0)); if(mode==1) sal_VideoPrint((262-(strlen(MENU_TEXT_LOAD_SAVESTATE)<<3))>>1,190,MENU_TEXT_LOAD_SAVESTATE,SAL_RGB(31,31,31)); else if(mode==0) sal_VideoPrint((262-(strlen(MENU_TEXT_OVERWRITE_SAVESTATE)<<3))>>1,190,MENU_TEXT_OVERWRITE_SAVESTATE,SAL_RGB(31,31,31)); else if(mode==2) sal_VideoPrint((262-(strlen(MENU_TEXT_DELETE_SAVESTATE)<<3))>>1,190,MENU_TEXT_DELETE_SAVESTATE,SAL_RGB(31,31,31)); break; } case 6: sal_VideoPrint(95,145-36,"Saving...",SAL_RGB(31,31,31)); break; case 7: sal_VideoPrint(95,145-36,"Saving failed",SAL_RGB(31,8,8)); break; case 8: sal_VideoPrint(87,145-36,"Loading...",SAL_RGB(31,31,31)); break; case 9: sal_VideoPrint(87,145-36,"Loading failed",SAL_RGB(31,8,8)); break; case 10: PrintBar(145-36-4); sal_VideoPrint(75,145-36,"Return to menu",SAL_RGB(31,31,31)); break; case 12: sal_VideoPrint(95,145-36,"Slot used",SAL_RGB(31,31,31)); sal_VideoPrint((262-(strlen(MENU_TEXT_PREVIEW_SAVESTATE)<<3))>>1,165,MENU_TEXT_PREVIEW_SAVESTATE,SAL_RGB(31,31,31)); if(mode==1) sal_VideoPrint((262-(strlen(MENU_TEXT_LOAD_SAVESTATE)<<3))>>1,175,MENU_TEXT_LOAD_SAVESTATE,SAL_RGB(31,31,31)); else if(mode==0) sal_VideoPrint((262-(strlen(MENU_TEXT_OVERWRITE_SAVESTATE)<<3))>>1,175,MENU_TEXT_OVERWRITE_SAVESTATE,SAL_RGB(31,31,31));
bool8_32 S9xDeinitUpdate (int Width, int Height, bool8_32) { if(mInMenu) return TRUE; // After returning from the menu, clear the background of 3 frames. // This prevents remnants of the menu from appearing. if (mFramesCleared < 3) { sal_VideoClear(0); mFramesCleared++; } // If the height changed from 224 to 239, or from 239 to 224, // possibly change the resolution. bool PAL = !!(Memory.FillRAM[0x2133] & 4); if (PAL != LastPAL) { sal_VideoSetPAL(mMenuOptions.fullScreen, PAL); LastPAL = PAL; } switch (mMenuOptions.fullScreen) { case 0: /* No scaling */ case 3: /* Hardware scaling */ { u32 h = PAL ? SNES_HEIGHT_EXTENDED : SNES_HEIGHT; u32 y, pitch = sal_VideoGetPitch(); u8 *src = (u8*) IntermediateScreen, *dst = (u8*) sal_VideoGetBuffer() + ((sal_VideoGetWidth() - SNES_WIDTH) / 2) * sizeof(u16) + ((sal_VideoGetHeight() - h) / 2) * pitch; for (y = 0; y < h; y++) { memcpy(dst, src, SNES_WIDTH * sizeof(u16)); src += SNES_WIDTH * sizeof(u16); dst += pitch; } break; } case 1: /* Fast software scaling */ if (PAL) { upscale_256x240_to_320x240((uint32_t*) sal_VideoGetBuffer(), (uint32_t*) IntermediateScreen, SNES_WIDTH); } else { upscale_p((uint32_t*) sal_VideoGetBuffer(), (uint32_t*) IntermediateScreen, SNES_WIDTH); } break; case 2: /* Smooth software scaling */ if (PAL) { upscale_256x240_to_320x240_bilinearish((uint32_t*) sal_VideoGetBuffer() + 160, (uint32_t*) IntermediateScreen, SNES_WIDTH); } else { upscale_256x224_to_320x240_bilinearish((uint32_t*) sal_VideoGetBuffer() + 160, (uint32_t*) IntermediateScreen, SNES_WIDTH); } break; } u32 newTimer; if (mMenuOptions.showFps) { mFps++; newTimer=sal_TimerRead(); if(newTimer-mLastTimer>Memory.ROMFramesPerSecond) { mLastTimer=newTimer; sprintf(mFpsDisplay,"%2d/%2d", mFps, Memory.ROMFramesPerSecond); mFps=0; } sal_VideoDrawRect(0,0,5*8,8,SAL_RGB(0,0,0)); sal_VideoPrint(0,0,mFpsDisplay,SAL_RGB(31,31,31)); } if(mVolumeDisplayTimer>0) { sal_VideoDrawRect(100,0,8*8,8,SAL_RGB(0,0,0)); sal_VideoPrint(100,0,mVolumeDisplay,SAL_RGB(31,31,31)); } if(mQuickStateTimer>0) { sal_VideoDrawRect(200,0,8*8,8,SAL_RGB(0,0,0)); sal_VideoPrint(200,0,mQuickStateDisplay,SAL_RGB(31,31,31)); } sal_VideoFlip(0); }