revert r3037 (video-related 'refactors'). seemed to go ok, didnt touch as much stuff as the input-related stuff)

This commit is contained in:
zeromus 2014-11-22 01:29:32 +00:00
parent f19171451e
commit efa98aafe3
18 changed files with 1200 additions and 1035 deletions

View File

@ -25,9 +25,6 @@ void FCEU_printf(char *format, ...);
#define FCEUI_printf FCEU_printf #define FCEUI_printf FCEU_printf
//Video interface //Video interface
// FIXME: these functions are declared in windows video driver header, but not in linux video driver header;
// eventually both platform video drivers should be brought to same set of functions and single shared header,
// which then can be included where access to video driver functions is needed instead of driver.h
void FCEUD_SetPalette(uint8 index, uint8 r, uint8 g, uint8 b); void FCEUD_SetPalette(uint8 index, uint8 r, uint8 g, uint8 b);
void FCEUD_GetPalette(uint8 i,uint8 *r, uint8 *g, uint8 *b); void FCEUD_GetPalette(uint8 i,uint8 *r, uint8 *g, uint8 *b);
@ -262,9 +259,6 @@ void FCEUI_SetEmulationPaused(int val);
void FCEUI_ToggleEmulationPause(); void FCEUI_ToggleEmulationPause();
//indicates whether input aids should be drawn (such as crosshairs, etc; usually in fullscreen mode) //indicates whether input aids should be drawn (such as crosshairs, etc; usually in fullscreen mode)
// FIXME: this function is already declared in both platform video driver headers;
// eventually both platform video drivers should be brought to same set of functions and single shared header,
// which then can be included where access to video driver functions is needed instead of driver.h
bool FCEUD_ShouldDrawInputAids(); bool FCEUD_ShouldDrawInputAids();
///called when the emulator closes a game ///called when the emulator closes a game

View File

@ -4,8 +4,8 @@
#include "common.h" #include "common.h"
#include "fceu.h" #include "fceu.h"
#include "drivers/win/video.h"
extern PALETTEENTRY *color_palette;
//extern WAVEFORMATEX wf; //extern WAVEFORMATEX wf;
//extern int soundo; //extern int soundo;
@ -292,7 +292,6 @@ static void do_video_conversion(const unsigned char* buffer)
// memset(avi_file->convert_buffer, 0, VIDEO_WIDTH*(avi_file->end_scanline-avi_file->start_scanline)*3); // memset(avi_file->convert_buffer, 0, VIDEO_WIDTH*(avi_file->end_scanline-avi_file->start_scanline)*3);
buffer += avi_file->start_scanline * VIDEO_WIDTH; buffer += avi_file->start_scanline * VIDEO_WIDTH;
PALETTEENTRY* color_palette = GetPalette();
for(int y=avi_file->start_scanline; y<avi_file->end_scanline; ++y) for(int y=avi_file->start_scanline; y<avi_file->end_scanline; ++y)
{ {

View File

@ -185,8 +185,8 @@ static CFGSTRUCT fceuconfig[] =
NAC("palyo",pal_emulation), NAC("palyo",pal_emulation),
NAC("genie",genie), NAC("genie",genie),
NAC("fs",_FIXME_getFullscreenVar()), NAC("fs",fullscreen),
NAC("vgamode",_FIXME_getVModeIdxVar()), NAC("vgamode",vmod),
NAC("sound",soundo), NAC("sound",soundo),
NAC("sicon",status_icon), NAC("sicon",status_icon),
@ -206,8 +206,8 @@ static CFGSTRUCT fceuconfig[] =
NACS("odavi",directory_names[12]), NACS("odavi",directory_names[12]),
NACS("odbase",directory_names[13]), NACS("odbase",directory_names[13]),
NAC("winspecial", _FIXME_getFilterModeWindowedIdxVar()), AC(winspecial),
NAC("NTSCwinspecial", _FIXME_getFilterOptionVar()), AC(NTSCwinspecial),
AC(winsizemulx), AC(winsizemulx),
AC(winsizemuly), AC(winsizemuly),
AC(tvAspectX), AC(tvAspectX),
@ -231,23 +231,23 @@ static CFGSTRUCT fceuconfig[] =
NACA("InputType",InputType), NACA("InputType",InputType),
NAC("vmcx",_FIXME_getCustomVideoModeVar().width), NAC("vmcx",vmodes[0].x),
NAC("vmcy",_FIXME_getCustomVideoModeVar().height), NAC("vmcy",vmodes[0].y),
NAC("vmcb",_FIXME_getCustomVideoModeVar().bpp), NAC("vmcb",vmodes[0].bpp),
NAC("vmcf",_FIXME_getCustomVideoModeVar().flags), NAC("vmcf",vmodes[0].flags),
NAC("vmcxs",_FIXME_getCustomVideoModeVar().xscale), NAC("vmcxs",vmodes[0].xscale),
NAC("vmcys",_FIXME_getCustomVideoModeVar().yscale), NAC("vmcys",vmodes[0].yscale),
NAC("vmspecial",_FIXME_getCustomVideoModeVar().filter), NAC("vmspecial",vmodes[0].special),
NAC("srendline",srendlinen), NAC("srendline",srendlinen),
NAC("erendline",erendlinen), NAC("erendline",erendlinen),
NAC("srendlinep",srendlinep), NAC("srendlinep",srendlinep),
NAC("erendlinep",erendlinep), NAC("erendlinep",erendlinep),
NAC("directDrawModeWindowed", _FIXME_getDDrawModeWindowedVar()), AC(directDrawModeWindowed),
NAC("directDrawModeFullscreen", _FIXME_getDDrawModeFullscreenVar()), AC(directDrawModeFullscreen),
NAC("winsync", _FIXME_getWindowedSyncModeIdxVar()), AC(winsync),
NAC("988fssync",_FIXME_getFullscreenSyncModeIdxVar()), NAC("988fssync",fssync),
AC(ismaximized), AC(ismaximized),
AC(maxconbskip), AC(maxconbskip),

View File

@ -1,7 +1,3 @@
// FIXME for Windows, make use of Config class the way linux version does
// old config registers variables by placing their addresses into static array, which makes
// many modules expose their internal vars and pollute globals; there is also no way to know when a
// setting was changed by it, which spawns auxillary functions intended to push new values through
void SaveConfig(const char *filename); void SaveConfig(const char *filename);
void LoadConfig(const char *filename); void LoadConfig(const char *filename);

View File

@ -28,7 +28,6 @@
#include <windows.h> #include <windows.h>
#include <commctrl.h> #include <commctrl.h>
#include "video.h"
#include "input.h" #include "input.h"
#include "keyboard.h" #include "keyboard.h"
#include "joystick.h" #include "joystick.h"
@ -43,8 +42,9 @@ LPDIRECTINPUT7 lpDI=0;
void InitInputPorts(bool fourscore); void InitInputPorts(bool fourscore);
VSYNCMODE tempwinsync = SYNCMODE_NONE; //Temp variable used by turbo to turn of sync settings int tempwinsync = 0; //Temp variable used by turbo to turn of sync settings
int tempsoundquality = 0; //Temp variable used by turbo to turn of sound quality settings int tempsoundquality = 0; //Temp variable used by turbo to turn of sound quality settings
extern int winsync;
extern int soundquality; extern int soundquality;
extern bool replaceP2StartWithMicrophone; extern bool replaceP2StartWithMicrophone;
//UsrInputType[] is user-specified. InputType[] is current //UsrInputType[] is user-specified. InputType[] is current
@ -1575,8 +1575,8 @@ int FCEUD_TestCommandState(int c)
void FCEUD_TurboOn (void) void FCEUD_TurboOn (void)
{ {
tempwinsync = GetWindowedSyncModeIdx(); //Store wndSyncMode setting tempwinsync = winsync; //Store winsync setting
SetWindowedSyncModeIdx(SYNCMODE_NONE); //turn off wndSyncMode for turbo (so that turbo can function even with VBlank sync methods winsync = 0; //turn off winsync for turbo (so that turbo can function even with VBlank sync methods
tempsoundquality = soundquality; //Store sound quality settings tempsoundquality = soundquality; //Store sound quality settings
FCEUI_SetSoundQuality(0); //Turn sound quality to low FCEUI_SetSoundQuality(0); //Turn sound quality to low
turbo = true; turbo = true;
@ -1584,7 +1584,7 @@ void FCEUD_TurboOn (void)
} }
void FCEUD_TurboOff (void) void FCEUD_TurboOff (void)
{ {
SetWindowedSyncModeIdx(tempwinsync); //Restore wndSyncMode setting winsync = tempwinsync; //Restore winsync setting
soundquality = tempsoundquality; //Restore sound quality settings soundquality = tempsoundquality; //Restore sound quality settings
FCEUI_SetSoundQuality(soundquality); FCEUI_SetSoundQuality(soundquality);
turbo = false; turbo = false;
@ -1593,15 +1593,15 @@ void FCEUD_TurboOff (void)
void FCEUD_TurboToggle(void) void FCEUD_TurboToggle(void)
{ {
if (turbo) { if (turbo) {
SetWindowedSyncModeIdx(tempwinsync); //If turbo was on, restore wndSyncMode winsync = tempwinsync; //If turbo was on, restore winsync
soundquality = tempsoundquality; //and restore sound quality setting soundquality = tempsoundquality; //and restore sound quality setting
FCEUI_SetSoundQuality(soundquality); FCEUI_SetSoundQuality(soundquality);
} }
else else
{ {
tempwinsync = GetWindowedSyncModeIdx(); //Store video sync settings tempwinsync = winsync; //Store video sync settings
tempsoundquality = soundquality; //Store sound quality settings tempsoundquality = soundquality; //Store sound quality settings
SetWindowedSyncModeIdx(SYNCMODE_NONE); //If turbo was off, turn off wndSyncMode (so that turbo can function even with VBlank sync methods winsync = 0; //If turbo was off, turn off winsync (so that turbo can function even with VBlank sync methods
FCEUI_SetSoundQuality(0); //Set sound quality to low FCEUI_SetSoundQuality(0); //Set sound quality to low
} }

View File

@ -19,7 +19,7 @@ int InitDInput(void);
void CreateInputStuff(void); void CreateInputStuff(void);
void InitInputStuff(void); void InitInputStuff(void);
void DestroyInput(void); void DestroyInput(void);
void InputScreenChanged(int fs); // FIXME defined nowhere used nowhere void InputScreenChanged(int fs);
void SetAutoFireDesynch(int DesynchOn); void SetAutoFireDesynch(int DesynchOn);
int GetAutoFireDesynch(); int GetAutoFireDesynch();
uint32 GetGamepadPressedImmediate(); uint32 GetGamepadPressedImmediate();

View File

@ -43,7 +43,6 @@
#include "../../movie.h" #include "../../movie.h"
#include "../../fceulua.h" #include "../../fceulua.h"
#include "window.h"
#include "archive.h" #include "archive.h"
#include "input.h" #include "input.h"
#include "netplay.h" #include "netplay.h"
@ -110,6 +109,7 @@ extern bool taseditorEnableAcceleratorKeys;
// External functions // External functions
extern std::string cfgFile; //Contains the filename of the config file used. extern std::string cfgFile; //Contains the filename of the config file used.
extern bool turbo; //Is game in turbo mode? extern bool turbo; //Is game in turbo mode?
void ResetVideo(void);
void ShowCursorAbs(int w); void ShowCursorAbs(int w);
void HideFWindow(int h); void HideFWindow(int h);
void FixWXY(int pref, bool shift_held); void FixWXY(int pref, bool shift_held);
@ -167,12 +167,15 @@ int ffbskip = 32; //Blit skips per blit when FF-ing
HINSTANCE fceu_hInstance; HINSTANCE fceu_hInstance;
HACCEL fceu_hAccel; HACCEL fceu_hAccel;
HRESULT ddrval;
static char TempArray[2048]; static char TempArray[2048];
static int exiting = 0; static int exiting = 0;
static volatile int moocow = 0; static volatile int moocow = 0;
int windowedfailed = 0; int windowedfailed = 0;
int fullscreen = 0; //Windows files only, variable that keeps track of fullscreen status
static volatile int _userpause = 0; //mbg merge 7/18/06 changed tasbuild was using this only in a couple of places static volatile int _userpause = 0; //mbg merge 7/18/06 changed tasbuild was using this only in a couple of places
@ -387,12 +390,12 @@ void FCEUD_PrintError(const char *errormsg)
{ {
AddLogText(errormsg, 1); AddLogText(errormsg, 1);
if (GetIsFullscreen() && (eoptions & EO_HIDEMOUSE)) if (fullscreen && (eoptions & EO_HIDEMOUSE))
ShowCursorAbs(1); ShowCursorAbs(1);
MessageBox(0, errormsg, FCEU_NAME" Error", MB_ICONERROR | MB_OK | MB_SETFOREGROUND | MB_TOPMOST); MessageBox(0, errormsg, FCEU_NAME" Error", MB_ICONERROR | MB_OK | MB_SETFOREGROUND | MB_TOPMOST);
if (GetIsFullscreen() && (eoptions & EO_HIDEMOUSE)) if (fullscreen && (eoptions & EO_HIDEMOUSE))
ShowCursorAbs(0); ShowCursorAbs(0);
} }
@ -488,7 +491,7 @@ int DriverInitialize()
if(soundo) if(soundo)
soundo = InitSound(); soundo = InitSound();
InitVideoDriver(); SetVideoMode(fullscreen);
InitInputStuff(); /* Initialize DInput interfaces. */ InitInputStuff(); /* Initialize DInput interfaces. */
return 1; return 1;
@ -503,7 +506,7 @@ static void DriverKill(void)
DestroyInput(); DestroyInput();
ShutdownVideoDriver(); ResetVideo();
if(soundo) if(soundo)
{ {
@ -646,6 +649,7 @@ int main(int argc,char *argv[])
{ {
FCEUI_SetGameGenie(genie!=0); FCEUI_SetGameGenie(genie!=0);
fullscreen = !!fullscreen;
soundo = !!soundo; soundo = !!soundo;
frame_display = !!frame_display; frame_display = !!frame_display;
allowUDLR = !!allowUDLR; allowUDLR = !!allowUDLR;
@ -683,7 +687,7 @@ int main(int argc,char *argv[])
if(!t) if(!t)
{ {
SetIsFullscreen(false); fullscreen=0;
} }
CreateMainWindow(); CreateMainWindow();
@ -915,10 +919,8 @@ void FCEUD_Update(uint8 *XBuf, int32 *Buffer, int Count)
} }
//blit the framebuffer //blit the framebuffer
if(XBuf) { if(XBuf)
xbsave = XBuf;
FCEUD_BlitScreen(XBuf); FCEUD_BlitScreen(XBuf);
}
//update debugging displays //update debugging displays
_updateWindow(); _updateWindow();

View File

@ -34,6 +34,7 @@ extern int maxconbskip;
extern int ffbskip; extern int ffbskip;
extern void LoadNewGamey(HWND hParent, const char *initialdir); extern void LoadNewGamey(HWND hParent, const char *initialdir);
extern void CloseGame(); extern void CloseGame();
extern int fullscreen; //Windows files only, keeps track of fullscreen status
// Flag that indicates whether Game Genie is enabled or not. // Flag that indicates whether Game Genie is enabled or not.
extern int genie; extern int genie;
@ -54,6 +55,8 @@ extern int AFon;
extern int AFoff; extern int AFoff;
extern int AutoFireOffset; extern int AutoFireOffset;
extern int vmod;
extern char* directory_names[14]; extern char* directory_names[14];
char *GetRomName(); //Checks if rom is loaded, if so, outputs the Rom name with no directory path or file extension char *GetRomName(); //Checks if rom is loaded, if so, outputs the Rom name with no directory path or file extension
@ -120,13 +123,13 @@ extern int soundo;
extern int eoptions; extern int eoptions;
extern int soundoptions; extern int soundoptions;
extern uint8 *xbsave; extern uint8 *xbsave;
extern HRESULT ddrval;
extern int windowedfailed; extern int windowedfailed;
extern uint32 goptions; extern uint32 goptions;
void DoFCEUExit(); void DoFCEUExit();
void ShowAboutBox(); void ShowAboutBox();
int BlockingCheck(); int BlockingCheck();
void UpdateRendBounds(void);
void DoPriority(); void DoPriority();
void RemoveDirs(); void RemoveDirs();
void CreateDirs(); void CreateDirs();

View File

@ -22,7 +22,6 @@ Main - Main gate between emulator and Taseditor
#include "main.h" // for GetRomName #include "main.h" // for GetRomName
#include "taseditor.h" #include "taseditor.h"
#include "window.h" #include "window.h"
#include "video.h"
#include "../../input.h" #include "../../input.h"
#include "../keyboard.h" #include "../keyboard.h"
#include "../joystick.h" #include "../joystick.h"
@ -57,6 +56,7 @@ extern int joysticksPerFrame[INPUT_TYPES_TOTAL];
extern bool turbo; extern bool turbo;
extern int pal_emulation; extern int pal_emulation;
extern int newppu; extern int newppu;
extern void PushCurrentVideoSettings();
extern void RefreshThrottleFPS(); extern void RefreshThrottleFPS();
extern bool LoadFM2(MovieData& movieData, EMUFILE* fp, int size, bool stopAfterHeader); extern bool LoadFM2(MovieData& movieData, EMUFILE* fp, int size, bool stopAfterHeader);
// temporarily saved FCEUX config // temporarily saved FCEUX config
@ -883,6 +883,7 @@ void applyMovieInputConfig()
pal_emulation = currMovieData.palFlag; pal_emulation = currMovieData.palFlag;
FCEUI_SetVidSystem(pal_emulation); FCEUI_SetVidSystem(pal_emulation);
RefreshThrottleFPS(); RefreshThrottleFPS();
PushCurrentVideoSettings();
// update PPU type // update PPU type
newppu = currMovieData.PPUflag; newppu = currMovieData.PPUflag;
SetMainWindowText(); SetMainWindowText();

View File

@ -19,8 +19,6 @@ Popup display - Manager of popup windows
#include "taseditor_project.h" #include "taseditor_project.h"
#include "zlib.h" #include "zlib.h"
#include "drivers/win/video.h"
extern TASEDITOR_CONFIG taseditorConfig; extern TASEDITOR_CONFIG taseditorConfig;
extern TASEDITOR_WINDOW taseditorWindow; extern TASEDITOR_WINDOW taseditorWindow;
extern BOOKMARKS bookmarks; extern BOOKMARKS bookmarks;
@ -93,7 +91,7 @@ void POPUP_DISPLAY::init()
{ {
free(); free();
// fill scr_bmp palette with current palette colors // fill scr_bmp palette with current palette colors
PALETTEENTRY* color_palette = GetPalette(); extern PALETTEENTRY *color_palette;
for (int i = 0; i < 256; ++i) for (int i = 0; i < 256; ++i)
{ {
screenshotBmi->bmiColors[i].rgbRed = color_palette[i].peRed; screenshotBmi->bmiColors[i].rgbRed = color_palette[i].peRed;

View File

@ -46,6 +46,7 @@
char *textToTrans; // buffer to hold the text that needs translating char *textToTrans; // buffer to hold the text that needs translating
char *transText; //holds the translated text char *transText; //holds the translated text
extern void FCEUD_BlitScreen(uint8 *XBuf); //needed for pause, not sure where this is defined...
//adelikat merge 7/1/08 - had to add these extern variables //adelikat merge 7/1/08 - had to add these extern variables
//------------------------------ //------------------------------
extern uint8 PALRAM[0x20]; extern uint8 PALRAM[0x20];

File diff suppressed because it is too large Load Diff

View File

@ -1,96 +1,71 @@
#ifndef WIN_VIDEO_H #ifndef WIN_VIDEO_H
#define WIN_VIDEO_H #define WIN_VIDEO_H
#include <Windows.h> #include "common.h"
#include "types.h"
typedef enum // I like hacks.
#define uint8 __UNO492032
#include <winsock.h>
#include "ddraw.h"
#undef LPCWAVEFORMATEX
#include "dsound.h"
#include "dinput.h"
#include <commctrl.h>
#include <shlobj.h> // For directories configuration dialog.
#undef uint8
#include "main.h"
#include "window.h"
enum DIRECTDRAW_MODES
{ {
DIRECTDRAW_MODE_SOFTWARE = 0, // all features are emulated in software DIRECTDRAW_MODE_SOFTWARE,
DIRECTDRAW_MODE_SURFACE_IN_RAM, // place offscreen surface in RAM rather than in VRAM; may or may not use hardware acceleration DIRECTDRAW_MODE_SURFACE_IN_RAM,
DIRECTDRAW_MODE_FULL, // use available hardware features, emulate the rest DIRECTDRAW_MODE_FULL,
// ... // ...
DIRECTDRAW_MODES_TOTAL DIRECTDRAW_MODES_TOTAL
} DIRECTDRAW_MODE; };
#define VIDEOMODEFLAG_DXBLT 1 #define VF_DDSTRETCHED 1
#define VIDEOMODEFLAG_STRFS 2
typedef enum #define VEF_LOSTSURFACE 1
{ #define VEF____INTERNAL 2
FILTER_NONE = 0,
FILTER_HQ2X, #define VMDF_DXBLT 1
FILTER_SCALE2X, #define VMDF_STRFS 2
FILTER_NTSC2X,
FILTER_HQ3X,
FILTER_SCALE3X
} VFILTER;
typedef struct { typedef struct {
int width; int x;
int height; int y;
int bpp; int bpp;
int flags; int flags;
int xscale; int xscale;
int yscale; int yscale;
RECT srcRect; RECT srect;
RECT dstRect; RECT drect;
VFILTER filter; int special;
} VideoMode; } vmdef;
typedef enum { // left, top, right, bottom
SYNCMODE_NONE = 0, extern vmdef vmodes[11];
SYNCMODE_WAIT, extern int winspecial;
SYNCMODE_LAZYWAIT, extern int NTSCwinspecial;
SYNCMODE_DOUBLEBUF
} VSYNCMODE;
void InitVideoDriver(void); extern int directDrawModeWindowed;
void ShutdownVideoDriver(); extern int directDrawModeFullscreen;
// Recalculate blit rectangle within window of given size extern int fssync;
void OnWindowSizeChange(int width, int height); extern int winsync;
// Get current blit rectangle void SetFSVideoMode();
RECT GetActiveRect(void);
// Get driver palette
PALETTEENTRY* GetPalette(void);
// Returns true when in fullscreen mode, false when in windowed
bool GetIsFullscreen(void);
// Set fullscreen mode flag
// FCEUD_VideoChanged() must be called in order to make value take effect
void SetIsFullscreen(bool f);
VSYNCMODE GetWindowedSyncModeIdx(void);
void SetWindowedSyncModeIdx(VSYNCMODE idx);
// Bring up the Video configuration dialog
void ShowConfigVideoDialog();
// (Re)apply render lines and sprite limitation to FCE
void DoVideoConfigFix();
// Implements FCEUD requirements
bool FCEUD_ShouldDrawInputAids(void);
void FCEUD_BlitScreen(uint8 *XBuf); void FCEUD_BlitScreen(uint8 *XBuf);
void FCEUD_VideoChanged(void); // this one should be declared here void ConfigVideo();
void FCEUD_SetPalette(unsigned char index, unsigned char r, unsigned char g, unsigned char b); void recalculateBestFitRect(int width, int height);
void FCEUD_GetPalette(unsigned char i, unsigned char *r, unsigned char *g, unsigned char *b); int SetVideoMode(int fs);
void DoVideoConfigFix();
void FCEUD_BlitScreen(uint8 *XBuf);
// see win/config.h void ResetVideo();
bool& _FIXME_getFullscreenVar(void); void SetFSVideoMode();
int& _FIXME_getVModeIdxVar(void); void PushCurrentVideoSettings();
VSYNCMODE& _FIXME_getFullscreenSyncModeIdxVar(void); void ResetCustomMode();
VSYNCMODE& _FIXME_getWindowedSyncModeIdxVar(void);
VFILTER& _FIXME_getFilterModeWindowedIdxVar(void);
int& _FIXME_getFilterOptionVar(void);
DIRECTDRAW_MODE& _FIXME_getDDrawModeWindowedVar(void);
DIRECTDRAW_MODE& _FIXME_getDDrawModeFullscreenVar(void);
VideoMode& _FIXME_getCustomVideoModeVar(void);
#endif #endif

View File

@ -83,6 +83,8 @@ extern PLAYBACK playback;
#include "Win32InputBox.h" #include "Win32InputBox.h"
extern int32 fps_scale_unpaused; extern int32 fps_scale_unpaused;
//extern void ToggleFullscreen();
using namespace std; using namespace std;
//----Context Menu - Some dynamically added menu items //----Context Menu - Some dynamically added menu items
@ -993,7 +995,7 @@ void HideFWindow(int h)
//Toggles the display status of the main menu. //Toggles the display status of the main menu.
void ToggleHideMenu(void) void ToggleHideMenu(void)
{ {
if(!GetIsFullscreen() && !nofocus && (GameInfo || tog)) if(!fullscreen && !nofocus && (GameInfo || tog))
{ {
tog ^= 1; tog ^= 1;
HideMenu(tog); HideMenu(tog);
@ -1032,7 +1034,7 @@ bool ALoad(const char *nameo, char* innerFilename, bool silent)
UpdateCheckedMenuItems(); UpdateCheckedMenuItems();
FCEUD_VideoChanged(); PushCurrentVideoSettings();
std::string recentFileName = nameo; std::string recentFileName = nameo;
if(GameInfo->archiveFilename && GameInfo->archiveCount>1) if(GameInfo->archiveFilename && GameInfo->archiveCount>1)
@ -1051,10 +1053,7 @@ bool ALoad(const char *nameo, char* innerFilename, bool silent)
if(eoptions & EO_FSAFTERLOAD) if(eoptions & EO_FSAFTERLOAD)
{ {
changerecursive=1; SetFSVideoMode();
SetIsFullscreen(true);
FCEUD_VideoChanged();
changerecursive=0;
} }
@ -1120,7 +1119,7 @@ void LoadNewGamey(HWND hParent, const char *initialdir)
void GetMouseData(uint32 (&md)[3]) void GetMouseData(uint32 (&md)[3])
{ {
RECT bestfitRect = GetActiveRect(); extern RECT bestfitRect;
double screen_width = VNSWID; double screen_width = VNSWID;
double screen_height = FSettings.TotalScanlines(); double screen_height = FSettings.TotalScanlines();
@ -1272,10 +1271,8 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
{ {
if (fullscreenByDoubleclick) if (fullscreenByDoubleclick)
{ {
changerecursive=1; extern void ToggleFullscreen();
SetIsFullscreen(!GetIsFullscreen()); ToggleFullscreen();
FCEUD_VideoChanged();
changerecursive=0;
return 0; return 0;
} else } else
{ {
@ -1382,7 +1379,7 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
goto proco; goto proco;
case WM_SIZE: case WM_SIZE:
if (!GetIsFullscreen() && !changerecursive && !windowedfailed) if (!fullscreen && !changerecursive && !windowedfailed)
{ {
switch(wParam) switch(wParam)
{ {
@ -1442,7 +1439,7 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
//break; //break;
goto proco; goto proco;
case WM_DISPLAYCHANGE: case WM_DISPLAYCHANGE:
if(!GetIsFullscreen() && !changerecursive) if(!fullscreen && !changerecursive)
vchanged=1; vchanged=1;
goto proco; goto proco;
case WM_DROPFILES: case WM_DROPFILES:
@ -1973,7 +1970,7 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
FCEUI_SetVidSystem(pal_emulation); FCEUI_SetVidSystem(pal_emulation);
RefreshThrottleFPS(); RefreshThrottleFPS();
UpdateCheckedMenuItems(); UpdateCheckedMenuItems();
FCEUD_VideoChanged(); PushCurrentVideoSettings();
break; break;
case MENU_DIRECTORIES: case MENU_DIRECTORIES:
ConfigDirectories(); ConfigDirectories();
@ -1997,7 +1994,7 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
ConfigTiming(); ConfigTiming();
break; break;
case MENU_VIDEO: case MENU_VIDEO:
ShowConfigVideoDialog(); ConfigVideo();
break; break;
case MENU_HOTKEYS: case MENU_HOTKEYS:
MapInput(); MapInput();
@ -2295,14 +2292,14 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
{ {
if(GameInfo && ((InputType[2]==SIFC_FKB) || (InputType[2]==SIFC_SUBORKB) || (InputType[2]==SIFC_PEC586KB)) && cidisabled) if(GameInfo && ((InputType[2]==SIFC_FKB) || (InputType[2]==SIFC_SUBORKB) || (InputType[2]==SIFC_PEC586KB)) && cidisabled)
break; break;
if(lParam == VK_RETURN || GetIsFullscreen() || tog) break; if(lParam == VK_RETURN || fullscreen || tog) break;
} }
goto proco; goto proco;
case WM_SYSKEYDOWN: case WM_SYSKEYDOWN:
if(GameInfo && ((InputType[2]==SIFC_FKB) || (InputType[2]==SIFC_SUBORKB) || (InputType[2]==SIFC_PEC586KB)) && cidisabled) if(GameInfo && ((InputType[2]==SIFC_FKB) || (InputType[2]==SIFC_SUBORKB) || (InputType[2]==SIFC_PEC586KB)) && cidisabled)
break; // Hopefully this won't break DInput... break; // Hopefully this won't break DInput...
if(GetIsFullscreen() || tog) if(fullscreen || tog)
{ {
if(wParam==VK_MENU) if(wParam==VK_MENU)
break; break;
@ -2465,10 +2462,9 @@ void FixWXY(int pref, bool shift_held)
void UpdateFCEUWindow(void) void UpdateFCEUWindow(void)
{ {
if(vchanged && !GetIsFullscreen() && !changerecursive && !nofocus) if(vchanged && !fullscreen && !changerecursive && !nofocus)
{ {
SetIsFullscreen(false); SetVideoMode(0);
FCEUD_VideoChanged();
vchanged = 0; vchanged = 0;
} }
@ -2609,13 +2605,11 @@ void SetMainWindowStuff()
ShowWindow(hAppWnd, SW_SHOWNORMAL); ShowWindow(hAppWnd, SW_SHOWNORMAL);
} }
// removed check for EO_BESTFIT flag if (eoptions & EO_BESTFIT && !windowedfailed)
// OnWindowSizeChange() now is a general purpose window resize handler on video driver side
if (!windowedfailed)
{ {
RECT client_recr; RECT client_recr;
GetClientRect(hAppWnd, &client_recr); GetClientRect(hAppWnd, &client_recr);
OnWindowSizeChange(client_recr.right - client_recr.left, client_recr.bottom - client_recr.top); recalculateBestFitRect(client_recr.right - client_recr.left, client_recr.bottom - client_recr.top);
} }
} }
@ -2983,10 +2977,6 @@ void UpdateMenuHotkeys()
ChangeMenuItemText(MENU_CDLOGGER, combined); ChangeMenuItemText(MENU_CDLOGGER, combined);
} }
bool GetIsFullscreenOnDoubleclick() {
return fullscreenByDoubleclick;
}
//This function is for the context menu item Save Movie As... //This function is for the context menu item Save Movie As...
//It gets a filename from the user then calls CreateMovie() //It gets a filename from the user then calls CreateMovie()
void SaveMovieAs() void SaveMovieAs()

View File

@ -40,10 +40,6 @@ void GetMouseData(uint32 (&md)[3]);
//void ChangeMenuItemText(int menuitem, string text); //void ChangeMenuItemText(int menuitem, string text);
void UpdateMenuHotkeys(); void UpdateMenuHotkeys();
// Returns true if fullscreen via double click is enabled
// TODO: replace fullscreenByDoubleclick references with a call to this
bool GetIsFullscreenOnDoubleclick(void);
template<int BUFSIZE> template<int BUFSIZE>
inline std::string GetDlgItemText(HWND hDlg, int nIDDlgItem) { inline std::string GetDlgItemText(HWND hDlg, int nIDDlgItem) {
char buf[BUFSIZE]; char buf[BUFSIZE];

View File

@ -38,7 +38,6 @@
#ifdef WIN32 #ifdef WIN32
#include "drivers/win/main.h" #include "drivers/win/main.h"
#include "drivers/win/video.h"
#include "drivers/win/memwatch.h" #include "drivers/win/memwatch.h"
#include "drivers/win/cheat.h" #include "drivers/win/cheat.h"
#include "drivers/win/debugger.h" #include "drivers/win/debugger.h"
@ -1182,13 +1181,15 @@ static void FCEUI_DoExit(void)
void ToggleFullscreen() void ToggleFullscreen()
{ {
#ifdef WIN32 #ifdef WIN32
extern int SetVideoMode(int fs); //adelikat: Yeah, I know, hacky
extern void UpdateCheckedMenuItems(); extern void UpdateCheckedMenuItems();
UpdateCheckedMenuItems(); UpdateCheckedMenuItems();
changerecursive=1; changerecursive=1;
SetIsFullscreen(!GetIsFullscreen());
FCEUD_VideoChanged(); int oldmode = fullscreen;
if(!SetVideoMode(oldmode ^ 1))
SetVideoMode(oldmode);
changerecursive=0; changerecursive=0;
#endif #endif
} }

View File

@ -47,7 +47,6 @@
#include "drivers/win/main.h" #include "drivers/win/main.h"
#include "drivers/win/ram_search.h" #include "drivers/win/ram_search.h"
#include "drivers/win/ramwatch.h" #include "drivers/win/ramwatch.h"
#include "drivers/win/video.h"
#endif #endif
#include <string> #include <string>
@ -244,11 +243,7 @@ static bool ReadStateChunk(EMUFILE* is, SFORMAT *sf, int size)
static int read_sfcpuc=0, read_snd=0; static int read_sfcpuc=0, read_snd=0;
#ifndef WIN32
// included corresponding header on Windows, no longer needed
// TODO do the same for SDL and remove declaration completely
void FCEUD_BlitScreen(uint8 *XBuf); //mbg merge 7/17/06 YUCKY had to add void FCEUD_BlitScreen(uint8 *XBuf); //mbg merge 7/17/06 YUCKY had to add
#endif
void UpdateFCEUWindow(void); //mbg merge 7/17/06 YUCKY had to add void UpdateFCEUWindow(void); //mbg merge 7/17/06 YUCKY had to add
static bool ReadStateChunks(EMUFILE* is, int32 totalsize) static bool ReadStateChunks(EMUFILE* is, int32 totalsize)
{ {

View File

@ -1,10 +0,0 @@
#ifndef BITFLAGS_H
#define BITFLAGS_H
// Flag test / set / clear macros for convenience and clarity
#define FL_TEST(var, mask) (var & mask)
#define FL_SET(var, mask) (var |= mask)
#define FL_CLEAR(var, mask) (var &= ~mask)
#define FL_FROMBOOL(var, mask, b) (var = (b)? var|mask:var&(~mask))
#endif // BITFLAGS_H