win/video cleanup
This commit is contained in:
parent
0d3ed22d62
commit
8a2a96bd1f
|
@ -25,6 +25,9 @@ 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);
|
||||||
|
|
||||||
|
@ -259,6 +262,9 @@ 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
|
||||||
|
|
|
@ -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,6 +292,7 @@ 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)
|
||||||
{
|
{
|
||||||
|
|
|
@ -185,8 +185,8 @@ static CFGSTRUCT fceuconfig[] =
|
||||||
|
|
||||||
NAC("palyo",pal_emulation),
|
NAC("palyo",pal_emulation),
|
||||||
NAC("genie",genie),
|
NAC("genie",genie),
|
||||||
NAC("fs",fullscreen),
|
NAC("fs",_FIXME_getFullscreenVar()),
|
||||||
NAC("vgamode",vmod),
|
NAC("vgamode",_FIXME_getVModeIdxVar()),
|
||||||
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]),
|
||||||
|
|
||||||
AC(winspecial),
|
NAC("winspecial", _FIXME_getFilterModeWindowedIdxVar()),
|
||||||
AC(NTSCwinspecial),
|
NAC("NTSCwinspecial", _FIXME_getFilterOptionVar()),
|
||||||
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",vmodes[0].x),
|
NAC("vmcx",_FIXME_getCustomVideoModeVar().width),
|
||||||
NAC("vmcy",vmodes[0].y),
|
NAC("vmcy",_FIXME_getCustomVideoModeVar().height),
|
||||||
NAC("vmcb",vmodes[0].bpp),
|
NAC("vmcb",_FIXME_getCustomVideoModeVar().bpp),
|
||||||
NAC("vmcf",vmodes[0].flags),
|
NAC("vmcf",_FIXME_getCustomVideoModeVar().flags),
|
||||||
NAC("vmcxs",vmodes[0].xscale),
|
NAC("vmcxs",_FIXME_getCustomVideoModeVar().xscale),
|
||||||
NAC("vmcys",vmodes[0].yscale),
|
NAC("vmcys",_FIXME_getCustomVideoModeVar().yscale),
|
||||||
NAC("vmspecial",vmodes[0].special),
|
NAC("vmspecial",_FIXME_getCustomVideoModeVar().filter),
|
||||||
|
|
||||||
NAC("srendline",srendlinen),
|
NAC("srendline",srendlinen),
|
||||||
NAC("erendline",erendlinen),
|
NAC("erendline",erendlinen),
|
||||||
NAC("srendlinep",srendlinep),
|
NAC("srendlinep",srendlinep),
|
||||||
NAC("erendlinep",erendlinep),
|
NAC("erendlinep",erendlinep),
|
||||||
|
|
||||||
AC(directDrawModeWindowed),
|
NAC("directDrawModeWindowed", _FIXME_getDDrawModeWindowedVar()),
|
||||||
AC(directDrawModeFullscreen),
|
NAC("directDrawModeFullscreen", _FIXME_getDDrawModeFullscreenVar()),
|
||||||
AC(winsync),
|
NAC("winsync", _FIXME_getWindowedSyncModeIdxVar()),
|
||||||
NAC("988fssync",fssync),
|
NAC("988fssync",_FIXME_getFullscreenSyncModeIdxVar()),
|
||||||
|
|
||||||
AC(ismaximized),
|
AC(ismaximized),
|
||||||
AC(maxconbskip),
|
AC(maxconbskip),
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
// 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);
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#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"
|
||||||
|
@ -42,9 +43,8 @@ LPDIRECTINPUT7 lpDI=0;
|
||||||
|
|
||||||
void InitInputPorts(bool fourscore);
|
void InitInputPorts(bool fourscore);
|
||||||
|
|
||||||
int tempwinsync = 0; //Temp variable used by turbo to turn of sync settings
|
VSYNCMODE tempwinsync = SYNCMODE_NONE; //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
|
||||||
|
@ -1571,8 +1571,8 @@ int FCEUD_TestCommandState(int c)
|
||||||
|
|
||||||
void FCEUD_TurboOn (void)
|
void FCEUD_TurboOn (void)
|
||||||
{
|
{
|
||||||
tempwinsync = winsync; //Store winsync setting
|
tempwinsync = GetWindowedSyncModeIdx(); //Store wndSyncMode setting
|
||||||
winsync = 0; //turn off winsync for turbo (so that turbo can function even with VBlank sync methods
|
SetWindowedSyncModeIdx(SYNCMODE_NONE); //turn off wndSyncMode 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;
|
||||||
|
@ -1580,7 +1580,7 @@ void FCEUD_TurboOn (void)
|
||||||
}
|
}
|
||||||
void FCEUD_TurboOff (void)
|
void FCEUD_TurboOff (void)
|
||||||
{
|
{
|
||||||
winsync = tempwinsync; //Restore winsync setting
|
SetWindowedSyncModeIdx(tempwinsync); //Restore wndSyncMode setting
|
||||||
soundquality = tempsoundquality; //Restore sound quality settings
|
soundquality = tempsoundquality; //Restore sound quality settings
|
||||||
FCEUI_SetSoundQuality(soundquality);
|
FCEUI_SetSoundQuality(soundquality);
|
||||||
turbo = false;
|
turbo = false;
|
||||||
|
@ -1589,15 +1589,15 @@ void FCEUD_TurboOff (void)
|
||||||
void FCEUD_TurboToggle(void)
|
void FCEUD_TurboToggle(void)
|
||||||
{
|
{
|
||||||
if (turbo) {
|
if (turbo) {
|
||||||
winsync = tempwinsync; //If turbo was on, restore winsync
|
SetWindowedSyncModeIdx(tempwinsync); //If turbo was on, restore wndSyncMode
|
||||||
soundquality = tempsoundquality; //and restore sound quality setting
|
soundquality = tempsoundquality; //and restore sound quality setting
|
||||||
FCEUI_SetSoundQuality(soundquality);
|
FCEUI_SetSoundQuality(soundquality);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tempwinsync = winsync; //Store video sync settings
|
tempwinsync = GetWindowedSyncModeIdx(); //Store video sync settings
|
||||||
tempsoundquality = soundquality; //Store sound quality settings
|
tempsoundquality = soundquality; //Store sound quality settings
|
||||||
winsync = 0; //If turbo was off, turn off winsync (so that turbo can function even with VBlank sync methods
|
SetWindowedSyncModeIdx(SYNCMODE_NONE); //If turbo was off, turn off wndSyncMode (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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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);
|
void InputScreenChanged(int fs); // FIXME defined nowhere used nowhere
|
||||||
void SetAutoFireDesynch(int DesynchOn);
|
void SetAutoFireDesynch(int DesynchOn);
|
||||||
int GetAutoFireDesynch();
|
int GetAutoFireDesynch();
|
||||||
uint32 GetGamepadPressedImmediate();
|
uint32 GetGamepadPressedImmediate();
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
#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"
|
||||||
|
@ -109,7 +110,6 @@ 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,15 +167,12 @@ 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
|
||||||
|
|
||||||
|
@ -390,12 +387,12 @@ void FCEUD_PrintError(const char *errormsg)
|
||||||
{
|
{
|
||||||
AddLogText(errormsg, 1);
|
AddLogText(errormsg, 1);
|
||||||
|
|
||||||
if (fullscreen && (eoptions & EO_HIDEMOUSE))
|
if (GetIsFullscreen() && (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 (fullscreen && (eoptions & EO_HIDEMOUSE))
|
if (GetIsFullscreen() && (eoptions & EO_HIDEMOUSE))
|
||||||
ShowCursorAbs(0);
|
ShowCursorAbs(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -491,7 +488,7 @@ int DriverInitialize()
|
||||||
if(soundo)
|
if(soundo)
|
||||||
soundo = InitSound();
|
soundo = InitSound();
|
||||||
|
|
||||||
SetVideoMode(fullscreen);
|
InitVideoDriver();
|
||||||
InitInputStuff(); /* Initialize DInput interfaces. */
|
InitInputStuff(); /* Initialize DInput interfaces. */
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -506,7 +503,7 @@ static void DriverKill(void)
|
||||||
|
|
||||||
DestroyInput();
|
DestroyInput();
|
||||||
|
|
||||||
ResetVideo();
|
ShutdownVideoDriver();
|
||||||
|
|
||||||
if(soundo)
|
if(soundo)
|
||||||
{
|
{
|
||||||
|
@ -649,7 +646,6 @@ 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;
|
||||||
|
@ -687,7 +683,7 @@ int main(int argc,char *argv[])
|
||||||
|
|
||||||
if(!t)
|
if(!t)
|
||||||
{
|
{
|
||||||
fullscreen=0;
|
SetIsFullscreen(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
CreateMainWindow();
|
CreateMainWindow();
|
||||||
|
@ -919,8 +915,10 @@ 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();
|
||||||
|
|
|
@ -34,7 +34,6 @@ 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;
|
||||||
|
@ -55,8 +54,6 @@ 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
|
||||||
|
@ -123,13 +120,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();
|
||||||
|
|
|
@ -22,6 +22,7 @@ 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"
|
||||||
|
@ -56,7 +57,6 @@ 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,7 +883,6 @@ 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();
|
||||||
|
|
|
@ -19,6 +19,8 @@ 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;
|
||||||
|
@ -91,7 +93,7 @@ void POPUP_DISPLAY::init()
|
||||||
{
|
{
|
||||||
free();
|
free();
|
||||||
// fill scr_bmp palette with current palette colors
|
// fill scr_bmp palette with current palette colors
|
||||||
extern PALETTEENTRY *color_palette;
|
PALETTEENTRY* color_palette = GetPalette();
|
||||||
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;
|
||||||
|
|
|
@ -46,7 +46,6 @@
|
||||||
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
|
@ -1,71 +1,96 @@
|
||||||
#ifndef WIN_VIDEO_H
|
#ifndef WIN_VIDEO_H
|
||||||
#define WIN_VIDEO_H
|
#define WIN_VIDEO_H
|
||||||
|
|
||||||
#include "common.h"
|
#include <Windows.h>
|
||||||
|
#include "types.h"
|
||||||
|
|
||||||
// I like hacks.
|
typedef enum
|
||||||
#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,
|
DIRECTDRAW_MODE_SOFTWARE = 0, // all features are emulated in software
|
||||||
DIRECTDRAW_MODE_SURFACE_IN_RAM,
|
DIRECTDRAW_MODE_SURFACE_IN_RAM, // place offscreen surface in RAM rather than in VRAM; may or may not use hardware acceleration
|
||||||
DIRECTDRAW_MODE_FULL,
|
DIRECTDRAW_MODE_FULL, // use available hardware features, emulate the rest
|
||||||
// ...
|
// ...
|
||||||
DIRECTDRAW_MODES_TOTAL
|
DIRECTDRAW_MODES_TOTAL
|
||||||
};
|
} DIRECTDRAW_MODE;
|
||||||
|
|
||||||
#define VF_DDSTRETCHED 1
|
#define VIDEOMODEFLAG_DXBLT 1
|
||||||
|
#define VIDEOMODEFLAG_STRFS 2
|
||||||
|
|
||||||
#define VEF_LOSTSURFACE 1
|
typedef enum
|
||||||
#define VEF____INTERNAL 2
|
{
|
||||||
|
FILTER_NONE = 0,
|
||||||
#define VMDF_DXBLT 1
|
FILTER_HQ2X,
|
||||||
#define VMDF_STRFS 2
|
FILTER_SCALE2X,
|
||||||
|
FILTER_NTSC2X,
|
||||||
|
FILTER_HQ3X,
|
||||||
|
FILTER_SCALE3X
|
||||||
|
} VFILTER;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int x;
|
int width;
|
||||||
int y;
|
int height;
|
||||||
int bpp;
|
int bpp;
|
||||||
int flags;
|
int flags;
|
||||||
int xscale;
|
int xscale;
|
||||||
int yscale;
|
int yscale;
|
||||||
RECT srect;
|
RECT srcRect;
|
||||||
RECT drect;
|
RECT dstRect;
|
||||||
int special;
|
VFILTER filter;
|
||||||
} vmdef;
|
} VideoMode;
|
||||||
|
|
||||||
// left, top, right, bottom
|
typedef enum {
|
||||||
extern vmdef vmodes[11];
|
SYNCMODE_NONE = 0,
|
||||||
extern int winspecial;
|
SYNCMODE_WAIT,
|
||||||
extern int NTSCwinspecial;
|
SYNCMODE_LAZYWAIT,
|
||||||
|
SYNCMODE_DOUBLEBUF
|
||||||
|
} VSYNCMODE;
|
||||||
|
|
||||||
extern int directDrawModeWindowed;
|
void InitVideoDriver(void);
|
||||||
extern int directDrawModeFullscreen;
|
void ShutdownVideoDriver();
|
||||||
|
|
||||||
extern int fssync;
|
// Recalculate blit rectangle within window of given size
|
||||||
extern int winsync;
|
void OnWindowSizeChange(int width, int height);
|
||||||
|
|
||||||
void SetFSVideoMode();
|
// Get current blit rectangle
|
||||||
void FCEUD_BlitScreen(uint8 *XBuf);
|
RECT GetActiveRect(void);
|
||||||
void ConfigVideo();
|
|
||||||
void recalculateBestFitRect(int width, int height);
|
// Get driver palette
|
||||||
int SetVideoMode(int fs);
|
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();
|
void DoVideoConfigFix();
|
||||||
|
|
||||||
|
|
||||||
|
// Implements FCEUD requirements
|
||||||
|
bool FCEUD_ShouldDrawInputAids(void);
|
||||||
void FCEUD_BlitScreen(uint8 *XBuf);
|
void FCEUD_BlitScreen(uint8 *XBuf);
|
||||||
void ResetVideo();
|
void FCEUD_VideoChanged(void); // this one should be declared here
|
||||||
void SetFSVideoMode();
|
void FCEUD_SetPalette(unsigned char index, unsigned char r, unsigned char g, unsigned char b);
|
||||||
void PushCurrentVideoSettings();
|
void FCEUD_GetPalette(unsigned char i, unsigned char *r, unsigned char *g, unsigned char *b);
|
||||||
void ResetCustomMode();
|
|
||||||
|
|
||||||
|
// see win/config.h
|
||||||
|
bool& _FIXME_getFullscreenVar(void);
|
||||||
|
int& _FIXME_getVModeIdxVar(void);
|
||||||
|
VSYNCMODE& _FIXME_getFullscreenSyncModeIdxVar(void);
|
||||||
|
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
|
||||||
|
|
|
@ -83,8 +83,6 @@ 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
|
||||||
|
@ -995,7 +993,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(!fullscreen && !nofocus && (GameInfo || tog))
|
if(!GetIsFullscreen() && !nofocus && (GameInfo || tog))
|
||||||
{
|
{
|
||||||
tog ^= 1;
|
tog ^= 1;
|
||||||
HideMenu(tog);
|
HideMenu(tog);
|
||||||
|
@ -1034,7 +1032,7 @@ bool ALoad(const char *nameo, char* innerFilename, bool silent)
|
||||||
|
|
||||||
UpdateCheckedMenuItems();
|
UpdateCheckedMenuItems();
|
||||||
|
|
||||||
PushCurrentVideoSettings();
|
FCEUD_VideoChanged();
|
||||||
|
|
||||||
std::string recentFileName = nameo;
|
std::string recentFileName = nameo;
|
||||||
if(GameInfo->archiveFilename && GameInfo->archiveCount>1)
|
if(GameInfo->archiveFilename && GameInfo->archiveCount>1)
|
||||||
|
@ -1053,7 +1051,10 @@ bool ALoad(const char *nameo, char* innerFilename, bool silent)
|
||||||
|
|
||||||
if(eoptions & EO_FSAFTERLOAD)
|
if(eoptions & EO_FSAFTERLOAD)
|
||||||
{
|
{
|
||||||
SetFSVideoMode();
|
changerecursive=1;
|
||||||
|
SetIsFullscreen(true);
|
||||||
|
FCEUD_VideoChanged();
|
||||||
|
changerecursive=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1119,7 +1120,7 @@ void LoadNewGamey(HWND hParent, const char *initialdir)
|
||||||
|
|
||||||
void GetMouseData(uint32 (&md)[3])
|
void GetMouseData(uint32 (&md)[3])
|
||||||
{
|
{
|
||||||
extern RECT bestfitRect;
|
RECT bestfitRect = GetActiveRect();
|
||||||
|
|
||||||
double screen_width = VNSWID;
|
double screen_width = VNSWID;
|
||||||
double screen_height = FSettings.TotalScanlines();
|
double screen_height = FSettings.TotalScanlines();
|
||||||
|
@ -1271,8 +1272,10 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
||||||
{
|
{
|
||||||
if (fullscreenByDoubleclick)
|
if (fullscreenByDoubleclick)
|
||||||
{
|
{
|
||||||
extern void ToggleFullscreen();
|
changerecursive=1;
|
||||||
ToggleFullscreen();
|
SetIsFullscreen(!GetIsFullscreen());
|
||||||
|
FCEUD_VideoChanged();
|
||||||
|
changerecursive=0;
|
||||||
return 0;
|
return 0;
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
|
@ -1379,7 +1382,7 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
||||||
goto proco;
|
goto proco;
|
||||||
|
|
||||||
case WM_SIZE:
|
case WM_SIZE:
|
||||||
if (!fullscreen && !changerecursive && !windowedfailed)
|
if (!GetIsFullscreen() && !changerecursive && !windowedfailed)
|
||||||
{
|
{
|
||||||
switch(wParam)
|
switch(wParam)
|
||||||
{
|
{
|
||||||
|
@ -1439,7 +1442,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(!fullscreen && !changerecursive)
|
if(!GetIsFullscreen() && !changerecursive)
|
||||||
vchanged=1;
|
vchanged=1;
|
||||||
goto proco;
|
goto proco;
|
||||||
case WM_DROPFILES:
|
case WM_DROPFILES:
|
||||||
|
@ -1970,7 +1973,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();
|
||||||
PushCurrentVideoSettings();
|
FCEUD_VideoChanged();
|
||||||
break;
|
break;
|
||||||
case MENU_DIRECTORIES:
|
case MENU_DIRECTORIES:
|
||||||
ConfigDirectories();
|
ConfigDirectories();
|
||||||
|
@ -1994,7 +1997,7 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
||||||
ConfigTiming();
|
ConfigTiming();
|
||||||
break;
|
break;
|
||||||
case MENU_VIDEO:
|
case MENU_VIDEO:
|
||||||
ConfigVideo();
|
ShowConfigVideoDialog();
|
||||||
break;
|
break;
|
||||||
case MENU_HOTKEYS:
|
case MENU_HOTKEYS:
|
||||||
MapInput();
|
MapInput();
|
||||||
|
@ -2292,14 +2295,14 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
||||||
{
|
{
|
||||||
if(GameInfo && ((InputType[2]==SIFC_FKB) || (InputType[2]==SIFC_SUBORKB)) && cidisabled)
|
if(GameInfo && ((InputType[2]==SIFC_FKB) || (InputType[2]==SIFC_SUBORKB)) && cidisabled)
|
||||||
break;
|
break;
|
||||||
if(lParam == VK_RETURN || fullscreen || tog) break;
|
if(lParam == VK_RETURN || GetIsFullscreen() || tog) break;
|
||||||
}
|
}
|
||||||
goto proco;
|
goto proco;
|
||||||
case WM_SYSKEYDOWN:
|
case WM_SYSKEYDOWN:
|
||||||
if(GameInfo && ((InputType[2]==SIFC_FKB) || (InputType[2]==SIFC_SUBORKB)) && cidisabled)
|
if(GameInfo && ((InputType[2]==SIFC_FKB) || (InputType[2]==SIFC_SUBORKB)) && cidisabled)
|
||||||
break; // Hopefully this won't break DInput...
|
break; // Hopefully this won't break DInput...
|
||||||
|
|
||||||
if(fullscreen || tog)
|
if(GetIsFullscreen() || tog)
|
||||||
{
|
{
|
||||||
if(wParam==VK_MENU)
|
if(wParam==VK_MENU)
|
||||||
break;
|
break;
|
||||||
|
@ -2472,9 +2475,10 @@ void FixWXY(int pref, bool shift_held)
|
||||||
|
|
||||||
void UpdateFCEUWindow(void)
|
void UpdateFCEUWindow(void)
|
||||||
{
|
{
|
||||||
if(vchanged && !fullscreen && !changerecursive && !nofocus)
|
if(vchanged && !GetIsFullscreen() && !changerecursive && !nofocus)
|
||||||
{
|
{
|
||||||
SetVideoMode(0);
|
SetIsFullscreen(false);
|
||||||
|
FCEUD_VideoChanged();
|
||||||
vchanged = 0;
|
vchanged = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2615,11 +2619,13 @@ void SetMainWindowStuff()
|
||||||
ShowWindow(hAppWnd, SW_SHOWNORMAL);
|
ShowWindow(hAppWnd, SW_SHOWNORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eoptions & EO_BESTFIT && !windowedfailed)
|
// removed check for EO_BESTFIT flag
|
||||||
|
// 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);
|
||||||
recalculateBestFitRect(client_recr.right - client_recr.left, client_recr.bottom - client_recr.top);
|
OnWindowSizeChange(client_recr.right - client_recr.left, client_recr.bottom - client_recr.top);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2987,6 +2993,10 @@ 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()
|
||||||
|
|
|
@ -40,6 +40,10 @@ 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];
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
|
|
||||||
#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"
|
||||||
|
@ -1175,15 +1176,13 @@ 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;
|
|
||||||
|
|
||||||
int oldmode = fullscreen;
|
changerecursive=1;
|
||||||
if(!SetVideoMode(oldmode ^ 1))
|
SetIsFullscreen(!GetIsFullscreen());
|
||||||
SetVideoMode(oldmode);
|
FCEUD_VideoChanged();
|
||||||
changerecursive=0;
|
changerecursive=0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
#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>
|
||||||
|
@ -243,7 +244,11 @@ 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)
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
#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
|
Loading…
Reference in New Issue