* "Maintain aspect ratio (best fit)" option in Video config
* updated docs [[Split portion of a mixed commit.]]
This commit is contained in:
parent
6e10ed264a
commit
b8594bf3d8
|
@ -1,3 +1,4 @@
|
|||
19-Aug-2012 - AnS - win32: "Maintain aspect ratio (best fit)" option in Video config
|
||||
12-Aug-2012 - AnS - Debugger: "Display ROM offsets" option
|
||||
12-Aug-2012 - AnS - Debugger: double-click breakpoint also adds current bank number to breakpoint condition
|
||||
12-Aug-2012 - AnS - Added FPS display to Win32 port (Config->Display->FPS)
|
||||
|
|
|
@ -46,6 +46,7 @@ extern int eoptions;
|
|||
#define EO_FORCEASPECT 8192
|
||||
#define EO_FORCEISCALE 16384
|
||||
#define EO_FOURSCORE 32768
|
||||
#define EO_BESTFIT 65536
|
||||
|
||||
bool directoryExists(const char* dirname);
|
||||
void WindowBoundsCheckResize(int &windowPosX, int &windowPosY, int windowSizeX, long windowRight);
|
||||
|
|
Binary file not shown.
|
@ -121,7 +121,7 @@ void ApplyDefaultCommandMapping(void);
|
|||
// Internal variables
|
||||
int frameSkipAmt = 18;
|
||||
uint8 *xbsave = NULL;
|
||||
int eoptions = EO_BGRUN | EO_NOSPRLIM | EO_FORCEISCALE;
|
||||
int eoptions = EO_BGRUN | EO_NOSPRLIM | EO_FORCEISCALE | EO_BESTFIT;
|
||||
|
||||
//global variables
|
||||
int soundoptions = SO_SECONDARY | SO_GFOCUS;
|
||||
|
|
|
@ -1705,73 +1705,75 @@ BEGIN
|
|||
PUSHBUTTON "Edit",IDC_BUTTON_LUAEDIT,58,31,46,16
|
||||
END
|
||||
|
||||
VIDEOCONFIG DIALOGEX 65520, 76, 384, 296
|
||||
VIDEOCONFIG DIALOGEX 65520, 76, 384, 292
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Video Configuration"
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x0
|
||||
BEGIN
|
||||
GROUPBOX "Full Screen Settings",65453,10,8,364,115,WS_GROUP
|
||||
CONTROL "Full Screen",IDC_VIDEOCONFIG_FS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,23,145,12
|
||||
GROUPBOX "Full Screen Settings",65453,10,7,364,115,WS_GROUP
|
||||
CONTROL "Full Screen",IDC_VIDEOCONFIG_FS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,22,145,12
|
||||
CONTROL "Enter full screen mode after game is loaded.",IDC_VIDEOCONFIG_AUTO_FS,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,39,151,12
|
||||
LTEXT "Sync Method:",65452,20,82,48,10
|
||||
COMBOBOX IDC_VIDEOCONFIG_SYNC_METHOD_FS,72,79,93,50,CBS_DROPDOWNLIST | WS_TABSTOP
|
||||
LTEXT "Video Mode:",65451,20,62,42,10
|
||||
COMBOBOX IDC_VIDEOCONFIG_MODE,72,59,93,52,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,38,151,12
|
||||
LTEXT "Sync Method:",65452,20,81,48,10
|
||||
COMBOBOX IDC_VIDEOCONFIG_SYNC_METHOD_FS,72,78,93,50,CBS_DROPDOWNLIST | WS_TABSTOP
|
||||
LTEXT "Video Mode:",65451,20,61,42,10
|
||||
COMBOBOX IDC_VIDEOCONFIG_MODE,72,58,93,52,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
CONTROL "Disable hardware acceleration.",IDC_DISABLE_HW_ACCEL_FS,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,103,145,12
|
||||
GROUPBOX "Custom Video Mode",65450,177,18,186,97,WS_GROUP
|
||||
LTEXT "Mode:",13,186,32,25,8
|
||||
EDITTEXT IDC_VIDEOCONFIG_XRES,214,30,27,12,ES_RIGHT
|
||||
LTEXT "by",12,244,32,11,8
|
||||
EDITTEXT IDC_VIDEOCONFIG_YRES,258,30,27,12,ES_RIGHT
|
||||
LTEXT "@",11,289,32,12,8
|
||||
COMBOBOX IDC_VIDEOCONFIG_BPP,302,30,35,60,CBS_DROPDOWNLIST | WS_TABSTOP
|
||||
LTEXT "bpp",10,341,32,17,8
|
||||
GROUPBOX "Image Size Transform",65445,185,47,170,61,WS_GROUP
|
||||
LTEXT "Special scaler:",65444,192,61,60,8
|
||||
COMBOBOX IDC_VIDEOCONFIG_SCALER_FS,281,58,65,46,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
CONTROL "Scale dimensions by:",IDC_RADIO_SCALE,"Button",BS_AUTORADIOBUTTON,192,76,85,12
|
||||
CONTROL "Stretch to Fill Screen",IDC_RADIO_STRETCH,"Button",BS_AUTORADIOBUTTON,192,91,88,12
|
||||
LTEXT "X:",65443,282,78,10,8
|
||||
EDITTEXT IDC_VIDEOCONFIG_XSCALE,292,76,20,12
|
||||
LTEXT "Y:",65442,316,78,11,8
|
||||
EDITTEXT IDC_VIDEOCONFIG_YSCALE,326,76,20,12
|
||||
GROUPBOX "Windowed Settings",65441,10,127,178,141,WS_GROUP
|
||||
LTEXT "Size Multiplier:",65440,20,149,50,8
|
||||
CTEXT "X:",65439,83,137,42,8
|
||||
CTEXT "Y:",65438,134,137,42,8
|
||||
EDITTEXT IDC_WINSIZE_MUL_X,83,148,42,12,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_WINSIZE_MUL_Y,134,148,42,12,ES_AUTOHSCROLL
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,102,145,12
|
||||
GROUPBOX "Custom Video Mode",65450,177,17,186,97,WS_GROUP
|
||||
LTEXT "Mode:",13,186,31,25,8
|
||||
EDITTEXT IDC_VIDEOCONFIG_XRES,214,29,27,12,ES_RIGHT
|
||||
LTEXT "by",12,244,31,11,8
|
||||
EDITTEXT IDC_VIDEOCONFIG_YRES,258,29,27,12,ES_RIGHT
|
||||
LTEXT "@",11,289,31,12,8
|
||||
COMBOBOX IDC_VIDEOCONFIG_BPP,302,29,35,60,CBS_DROPDOWNLIST | WS_TABSTOP
|
||||
LTEXT "bpp",10,341,31,17,8
|
||||
GROUPBOX "Image Size Transform",65445,185,46,170,61,WS_GROUP
|
||||
LTEXT "Special scaler:",65444,192,60,60,8
|
||||
COMBOBOX IDC_VIDEOCONFIG_SCALER_FS,281,57,65,46,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
CONTROL "Scale dimensions by:",IDC_RADIO_SCALE,"Button",BS_AUTORADIOBUTTON,192,75,85,12
|
||||
CONTROL "Stretch to Fill Screen",IDC_RADIO_STRETCH,"Button",BS_AUTORADIOBUTTON,192,90,88,12
|
||||
LTEXT "X:",65443,282,77,10,8
|
||||
EDITTEXT IDC_VIDEOCONFIG_XSCALE,292,75,20,12
|
||||
LTEXT "Y:",65442,316,77,11,8
|
||||
EDITTEXT IDC_VIDEOCONFIG_YSCALE,326,75,20,12
|
||||
GROUPBOX "Windowed Settings",65441,10,126,179,158,WS_GROUP
|
||||
LTEXT "Size Multiplier:",65440,20,148,50,8
|
||||
CTEXT "X:",65439,83,136,42,8
|
||||
CTEXT "Y:",65438,134,136,42,8
|
||||
EDITTEXT IDC_WINSIZE_MUL_X,83,147,42,12,ES_AUTOHSCROLL
|
||||
EDITTEXT IDC_WINSIZE_MUL_Y,134,147,42,12,ES_AUTOHSCROLL
|
||||
CONTROL "Force integral scaling factors.",IDC_FORCE_INT_VIDEO_SCALARS,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,164,145,12
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,163,145,12
|
||||
CONTROL "Force aspect ratio correction.",IDC_FORCE_ASPECT_CORRECTION,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,179,145,12
|
||||
LTEXT "Special scaler:",65429,20,215,51,8
|
||||
COMBOBOX IDC_VIDEOCONFIG_SCALER_WIN,83,213,93,47,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Sync Method:",65437,20,235,51,8
|
||||
COMBOBOX IDC_VIDEOCONFIG_SYNC_METHOD_WIN,83,233,93,47,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,178,145,12
|
||||
LTEXT "Special scaler:",65429,20,229,51,8
|
||||
COMBOBOX IDC_VIDEOCONFIG_SCALER_WIN,83,227,93,47,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Sync Method:",65437,20,249,51,8
|
||||
COMBOBOX IDC_VIDEOCONFIG_SYNC_METHOD_WIN,83,247,93,47,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
CONTROL "Disable hardware acceleration.",IDC_DISABLE_HW_ACCEL_WIN,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,250,145,12
|
||||
GROUPBOX "Drawing Area",65494,196,127,178,86,WS_GROUP
|
||||
LTEXT "First Line:",65436,218,153,39,8
|
||||
LTEXT "Last Line:",65435,218,173,43,8
|
||||
CTEXT "NTSC",65434,262,140,27,8
|
||||
CTEXT "PAL",65433,313,140,27,8
|
||||
EDITTEXT IDC_SCANLINE_FIRST_NTSC,263,152,27,12,ES_RIGHT
|
||||
EDITTEXT IDC_SCANLINE_LAST_NTSC,263,171,27,12,ES_RIGHT
|
||||
EDITTEXT IDC_SCANLINE_FIRST_PAL,313,152,27,12,ES_RIGHT
|
||||
EDITTEXT IDC_SCANLINE_LAST_PAL,313,171,27,12,ES_RIGHT
|
||||
CONTROL "Clip left and right sides (8 columns on each).",IDC_VIDEOCONFIG_CLIPSIDES,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,206,192,157,12
|
||||
DEFPUSHBUTTON "Close",BTN_CLOSE,318,274,56,14
|
||||
LTEXT "Current Pixel Aspect Ratio:",65432,20,197,88,8
|
||||
EDITTEXT IDC_VIDEOCONFIG_ASPECT_X,109,195,28,12,ES_AUTOHSCROLL
|
||||
CTEXT ":",65431,139,197,8,8
|
||||
EDITTEXT IDC_VIDEOCONFIG_ASPECT_Y,148,195,28,12,ES_AUTOHSCROLL
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,266,145,12
|
||||
GROUPBOX "Drawing Area",65494,196,126,178,83,WS_GROUP
|
||||
LTEXT "First Line:",65436,218,152,39,8
|
||||
LTEXT "Last Line:",65435,218,172,43,8
|
||||
CTEXT "NTSC",65434,262,139,27,8
|
||||
CTEXT "PAL",65433,313,139,27,8
|
||||
EDITTEXT IDC_SCANLINE_FIRST_NTSC,263,151,27,12,ES_RIGHT
|
||||
EDITTEXT IDC_SCANLINE_LAST_NTSC,263,170,27,12,ES_RIGHT
|
||||
EDITTEXT IDC_SCANLINE_FIRST_PAL,313,151,27,12,ES_RIGHT
|
||||
EDITTEXT IDC_SCANLINE_LAST_PAL,313,170,27,12,ES_RIGHT
|
||||
CONTROL "Clip left and right sides (8 columns on each)",IDC_VIDEOCONFIG_CLIPSIDES,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,206,191,157,12
|
||||
DEFPUSHBUTTON "Close",BTN_CLOSE,318,269,56,14
|
||||
LTEXT "Current Pixel Aspect Ratio:",65432,20,211,88,8
|
||||
EDITTEXT IDC_VIDEOCONFIG_ASPECT_X,110,209,28,12,ES_AUTOHSCROLL
|
||||
CTEXT ":",65431,139,196,8,8
|
||||
EDITTEXT IDC_VIDEOCONFIG_ASPECT_Y,148,209,28,12,ES_AUTOHSCROLL
|
||||
CONTROL "Allow more than 8 sprites per scanline.",IDC_VIDEOCONFIG_NO8LIM,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,206,250,157,11
|
||||
GROUPBOX "Emulation",65430,196,236,178,32,WS_GROUP
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,206,230,157,11
|
||||
GROUPBOX "Emulation",65430,196,215,178,32,WS_GROUP
|
||||
CONTROL "Maintain aspect ratio (best fit)",IDC_VIDEOCONFIG_BESTFIT,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,20,193,146,12
|
||||
END
|
||||
|
||||
IDD_RAMSEARCH DIALOGEX 0, 0, 287, 292
|
||||
|
@ -2105,7 +2107,6 @@ BEGIN
|
|||
LEFTMARGIN, 10
|
||||
RIGHTMARGIN, 374
|
||||
TOPMARGIN, 8
|
||||
BOTTOMMARGIN, 268
|
||||
END
|
||||
|
||||
IDD_PROMPT, DIALOG
|
||||
|
|
|
@ -94,6 +94,8 @@
|
|||
#define IDC_DEBUGGER_STEP_OVER 107
|
||||
#define IDC_ADDBP_MEM_SPR 107
|
||||
#define IDC_ROMPATCHER_DISASSEMBLY 107
|
||||
#define IDC_VIDEOCONFIG_MAINTAIN_ASPECT_RATIO 107
|
||||
#define IDC_VIDEOCONFIG_BESTFIT 107
|
||||
#define IDR_ACCELERATOR1 108
|
||||
#define BTN_CDLOGGER_SAVE_STRIPPED 108
|
||||
#define IDC_CHEAT_VAL_NE_BY 108
|
||||
|
@ -251,7 +253,6 @@
|
|||
#define IDC_DEBUGGER_ENABLE_SYMBOLIC 208
|
||||
#define IDB_TE_GREEN_BLUE_ARROW 208
|
||||
#define IDB_PIANO_0 209
|
||||
#define IDC_DEBUGGER_ENABLE_SYMBOLIC2 209
|
||||
#define IDC_DEBUGGER_ROM_OFFSETS 209
|
||||
#define IDB_PIANO_1 210
|
||||
#define IDB_PIANO_2 211
|
||||
|
|
|
@ -69,11 +69,19 @@ LPDIRECTDRAW7 lpDD7=0;
|
|||
LPDIRECTDRAWPALETTE lpddpal = 0;
|
||||
|
||||
DDSURFACEDESC2 ddsd;
|
||||
|
||||
DDSURFACEDESC2 ddsdback;
|
||||
DDSURFACEDESC2 ddsd_Resizable;
|
||||
|
||||
LPDIRECTDRAWSURFACE7 lpDDSPrimary=0;
|
||||
LPDIRECTDRAWSURFACE7 lpDDSDBack=0;
|
||||
LPDIRECTDRAWSURFACE7 lpDDSBack=0;
|
||||
LPDIRECTDRAWSURFACE7 lpDDSResizable=0;
|
||||
|
||||
DDBLTFX blitfx = { sizeof(DDBLTFX) };
|
||||
|
||||
RECT resizable_surface_rect = {0};
|
||||
|
||||
#define RELEASE(x) if(x) { x->Release(); x = 0; }
|
||||
|
||||
static void ShowDDErr(char *s)
|
||||
{
|
||||
|
@ -84,12 +92,15 @@ static void ShowDDErr(char *s)
|
|||
|
||||
int RestoreDD(int w)
|
||||
{
|
||||
if(w)
|
||||
if (w == 2) // lpDDSResizable
|
||||
{
|
||||
if(!lpDDSResizable) return 0;
|
||||
if(IDirectDrawSurface7_Restore(lpDDSResizable)!=DD_OK) return 0;
|
||||
} else if (w == 1) // lpDDSBack
|
||||
{
|
||||
if(!lpDDSBack) return 0;
|
||||
if(IDirectDrawSurface7_Restore(lpDDSBack)!=DD_OK) return 0;
|
||||
}
|
||||
else
|
||||
} else // 0 means lpDDSPrimary
|
||||
{
|
||||
if(!lpDDSPrimary) return 0;
|
||||
if(IDirectDrawSurface7_Restore(lpDDSPrimary)!=DD_OK) return 0;
|
||||
|
@ -215,11 +226,73 @@ static int InitBPPStuff(int fs)
|
|||
return 1;
|
||||
}
|
||||
|
||||
int RecreateResizableSurface()
|
||||
{
|
||||
if (!lpDD7)
|
||||
return 1; // DirectDraw isn't initialized yet
|
||||
|
||||
// check if new size is the same as old
|
||||
|
||||
|
||||
// delete old surface
|
||||
RELEASE(lpDDSResizable);
|
||||
// create new surface
|
||||
memset(&ddsd_Resizable, 0, sizeof(ddsd_Resizable));
|
||||
ddsd_Resizable.dwSize = sizeof(ddsd_Resizable);
|
||||
ddsd_Resizable.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
||||
ddsd_Resizable.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
||||
RECT client_recr;
|
||||
GetClientRect(hAppWnd, &client_recr);
|
||||
int width = client_recr.right - client_recr.left;
|
||||
int height = client_recr.bottom - client_recr.top;
|
||||
ddsd_Resizable.dwWidth = width;
|
||||
ddsd_Resizable.dwHeight = height;
|
||||
ddrval = IDirectDraw7_CreateSurface(lpDD7, &ddsd_Resizable, &lpDDSResizable, (IUnknown FAR*)NULL);
|
||||
if (ddrval != DD_OK)
|
||||
{
|
||||
void FCEU_PrintError(char *format, ...);
|
||||
FCEU_PrintError("%08x, %d\n", ddrval, lpDD7);
|
||||
ShowDDErr("Error creating resizable surface.");
|
||||
return 1;
|
||||
}
|
||||
// fill the surface with black color
|
||||
blitfx.dwFillColor = 0;
|
||||
ddrval = IDirectDrawSurface7_Blt(lpDDSResizable, NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &blitfx);
|
||||
// calculate resizable_surface_rect
|
||||
double current_aspectratio = (double)width / (double)height;
|
||||
double needed_aspectratio = (double)(VNSWID) / (double)(FSettings.TotalScanlines());
|
||||
if (current_aspectratio == needed_aspectratio)
|
||||
{
|
||||
resizable_surface_rect.left = 0;
|
||||
resizable_surface_rect.right = width;
|
||||
resizable_surface_rect.top = 0;
|
||||
resizable_surface_rect.bottom = height;
|
||||
} else if (current_aspectratio > needed_aspectratio)
|
||||
{
|
||||
// the window is wider than emulated screen
|
||||
resizable_surface_rect.top = 0;
|
||||
resizable_surface_rect.bottom = height;
|
||||
int center_x = width / 2;
|
||||
width = (double)((double)height * needed_aspectratio);
|
||||
resizable_surface_rect.left = center_x - (width / 2);
|
||||
resizable_surface_rect.right = center_x + (width / 2);
|
||||
} else
|
||||
{
|
||||
// the window is taller than emulated screen
|
||||
resizable_surface_rect.left = 0;
|
||||
resizable_surface_rect.right = width;
|
||||
int center_y = height / 2;
|
||||
height = (double)((double)width / needed_aspectratio);
|
||||
resizable_surface_rect.top = center_y - (height / 2);
|
||||
resizable_surface_rect.bottom = center_y + (height / 2);
|
||||
}
|
||||
return 1; // all ok
|
||||
}
|
||||
|
||||
int SetVideoMode(int fs)
|
||||
{
|
||||
int specmul = 1; // Special scaler size multiplier
|
||||
|
||||
|
||||
if(fs)
|
||||
if(!vmod)
|
||||
if(!RecalcCustom())
|
||||
|
@ -480,7 +553,7 @@ static void BlitScreenWindow(unsigned char *XBuf)
|
|||
int pitch;
|
||||
unsigned char *ScreenLoc;
|
||||
static RECT srect;
|
||||
RECT drect;
|
||||
RECT wrect;
|
||||
int specialmul;
|
||||
|
||||
if (!lpDDSBack) return;
|
||||
|
@ -502,7 +575,7 @@ static void BlitScreenWindow(unsigned char *XBuf)
|
|||
PaletteChanged=0;
|
||||
}
|
||||
|
||||
if(!GetClientAbsRect(&drect)) return;
|
||||
if(!GetClientAbsRect(&wrect)) return;
|
||||
|
||||
ddrval=IDirectDrawSurface7_Lock(lpDDSBack,NULL,&ddsdback, 0, NULL);
|
||||
if(ddrval!=DD_OK)
|
||||
|
@ -523,15 +596,47 @@ static void BlitScreenWindow(unsigned char *XBuf)
|
|||
|
||||
IDirectDrawSurface7_Unlock(lpDDSBack, NULL);
|
||||
|
||||
//aquanull 2011-11-28 fix tearing
|
||||
FCEUD_VerticalSync();
|
||||
|
||||
if(IDirectDrawSurface7_Blt(lpDDSPrimary, &drect,lpDDSBack,&srect,DDBLT_ASYNC,0)!=DD_OK)
|
||||
if (eoptions & EO_BESTFIT && (resizable_surface_rect.top || resizable_surface_rect.left))
|
||||
{
|
||||
ddrval=IDirectDrawSurface7_Blt(lpDDSPrimary, &drect,lpDDSBack,&srect,DDBLT_WAIT,0);
|
||||
if(ddrval!=DD_OK)
|
||||
// blit from lpDDSBack to lpDDSResizable using best fit
|
||||
if (IDirectDrawSurface7_Blt(lpDDSResizable, &resizable_surface_rect, lpDDSBack, &srect, DDBLT_ASYNC, 0) != DD_OK)
|
||||
{
|
||||
if(ddrval==DDERR_SURFACELOST)
|
||||
ddrval = IDirectDrawSurface7_Blt(lpDDSResizable, &resizable_surface_rect, lpDDSBack, &srect, DDBLT_WAIT, 0);
|
||||
if(ddrval != DD_OK)
|
||||
{
|
||||
if(ddrval == DDERR_SURFACELOST)
|
||||
{
|
||||
RestoreDD(2);
|
||||
RestoreDD(1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
// blit from lpDDSResizable to screen (lpDDSPrimary)
|
||||
FCEUD_VerticalSync(); // aquanull 2011-11-28 fix tearing
|
||||
if (IDirectDrawSurface7_Blt(lpDDSPrimary, &wrect, lpDDSResizable, NULL, DDBLT_ASYNC, 0) != DD_OK)
|
||||
{
|
||||
ddrval = IDirectDrawSurface7_Blt(lpDDSPrimary, &wrect, lpDDSResizable, NULL, DDBLT_WAIT, 0);
|
||||
if(ddrval != DD_OK)
|
||||
{
|
||||
if(ddrval == DDERR_SURFACELOST)
|
||||
{
|
||||
RestoreDD(2);
|
||||
RestoreDD(0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
// blit directly from lpDDSBack to screen (lpDDSPrimary)
|
||||
FCEUD_VerticalSync(); // aquanull 2011-11-28 fix tearing
|
||||
if(IDirectDrawSurface7_Blt(lpDDSPrimary, &wrect, lpDDSBack, &srect, DDBLT_ASYNC, 0) != DD_OK)
|
||||
{
|
||||
ddrval = IDirectDrawSurface7_Blt(lpDDSPrimary, &wrect, lpDDSBack, &srect, DDBLT_WAIT, 0);
|
||||
if(ddrval != DD_OK)
|
||||
{
|
||||
if(ddrval == DDERR_SURFACELOST)
|
||||
{
|
||||
RestoreDD(1);
|
||||
RestoreDD(0);
|
||||
|
@ -539,6 +644,7 @@ static void BlitScreenWindow(unsigned char *XBuf)
|
|||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void DD_FillRect(LPDIRECTDRAWSURFACE7 surf, int left, int top, int right, int bottom, DWORD color)
|
||||
|
@ -842,8 +948,6 @@ static void BlitScreenFull(uint8 *XBuf)
|
|||
}
|
||||
}
|
||||
|
||||
#define RELEASE(x) if(x) { x->Release(); x = 0; }
|
||||
|
||||
void ResetVideo(void)
|
||||
{
|
||||
ShowCursorAbs(1);
|
||||
|
@ -858,6 +962,7 @@ void ResetVideo(void)
|
|||
RELEASE(lpddpal);
|
||||
RELEASE(lpDDSBack);
|
||||
RELEASE(lpDDSPrimary);
|
||||
RELEASE(lpDDSResizable);
|
||||
RELEASE(lpClipper);
|
||||
RELEASE(lpDD7);
|
||||
}
|
||||
|
@ -1026,6 +1131,9 @@ BOOL CALLBACK VideoConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
|||
if(eoptions&EO_CLIPSIDES)
|
||||
CheckDlgButton(hwndDlg,IDC_VIDEOCONFIG_CLIPSIDES,BST_CHECKED);
|
||||
|
||||
if(eoptions&EO_BESTFIT)
|
||||
CheckDlgButton(hwndDlg, IDC_VIDEOCONFIG_BESTFIT, BST_CHECKED);
|
||||
|
||||
if(disvaccel&1)
|
||||
CheckDlgButton(hwndDlg,IDC_DISABLE_HW_ACCEL_WIN,BST_CHECKED);
|
||||
|
||||
|
@ -1087,6 +1195,11 @@ gornk:
|
|||
ClipSidesOffset = 0;
|
||||
}
|
||||
|
||||
if (IsDlgButtonChecked(hwndDlg, IDC_VIDEOCONFIG_BESTFIT) == BST_CHECKED)
|
||||
eoptions |= EO_BESTFIT;
|
||||
else
|
||||
eoptions &= ~EO_BESTFIT;
|
||||
|
||||
if(IsDlgButtonChecked(hwndDlg,IDC_VIDEOCONFIG_NO8LIM)==BST_CHECKED)
|
||||
eoptions|=EO_NOSPRLIM;
|
||||
else
|
||||
|
|
|
@ -49,6 +49,7 @@ extern int winsync;
|
|||
void SetFSVideoMode();
|
||||
void FCEUD_BlitScreen(uint8 *XBuf);
|
||||
void ConfigVideo();
|
||||
int RecreateResizableSurface();
|
||||
int SetVideoMode(int fs);
|
||||
void DoVideoConfigFix();
|
||||
void FCEUD_BlitScreen(uint8 *XBuf);
|
||||
|
|
|
@ -1354,8 +1354,10 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
|
|||
winsizemulx*= (double)w/winwidth;
|
||||
if(how & 2)
|
||||
winsizemuly*= (double)h/winheight;
|
||||
if(how & 1) FixWXY(0);
|
||||
else FixWXY(1);
|
||||
if(how & 1)
|
||||
FixWXY(0);
|
||||
else
|
||||
FixWXY(1);
|
||||
|
||||
CalcWindowSize(&srect);
|
||||
winwidth=srect.right;
|
||||
|
@ -2314,13 +2316,16 @@ void FixWXY(int pref)
|
|||
|
||||
if(!pref)
|
||||
{
|
||||
winsizemuly = winsizemulx * 256 / FSettings.TotalScanlines() * 3 / 4 * saspectw / saspecth;
|
||||
winsizemuly = winsizemulx * (saspecth / saspectw);
|
||||
}
|
||||
else
|
||||
{
|
||||
winsizemulx = winsizemuly * FSettings.TotalScanlines() / 256 * 4 / 3 * saspecth / saspectw;
|
||||
winsizemulx = winsizemuly * (saspectw / saspecth);
|
||||
}
|
||||
}
|
||||
|
||||
// AnS: removed unnecessary restrictions of window size
|
||||
/*
|
||||
if(winspecial)
|
||||
{
|
||||
// -Video Modes Tag-
|
||||
|
@ -2352,6 +2357,7 @@ void FixWXY(int pref)
|
|||
winsizemuly = mult;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if(winsizemulx<0.1)
|
||||
winsizemulx=0.1;
|
||||
|
@ -2487,8 +2493,7 @@ void SetMainWindowStuff()
|
|||
winheight = tmp.bottom - tmp.top;
|
||||
|
||||
ShowWindow(hAppWnd, SW_SHOWMAXIMIZED);
|
||||
}
|
||||
else
|
||||
} else
|
||||
{
|
||||
RECT srect;
|
||||
|
||||
|
@ -2524,6 +2529,10 @@ void SetMainWindowStuff()
|
|||
|
||||
ShowWindow(hAppWnd, SW_SHOWNORMAL);
|
||||
}
|
||||
if (eoptions & EO_BESTFIT)
|
||||
{
|
||||
RecreateResizableSurface();
|
||||
}
|
||||
}
|
||||
|
||||
/// @return Flag that indicates failure (0) or success (1).
|
||||
|
@ -2540,18 +2549,18 @@ int GetClientAbsRect(LPRECT lpRect)
|
|||
lpRect->top = point.y;
|
||||
lpRect->left = point.x;
|
||||
|
||||
if(ismaximized)
|
||||
{
|
||||
//if(ismaximized)
|
||||
//{
|
||||
RECT al;
|
||||
GetClientRect(hAppWnd, &al);
|
||||
lpRect->right = point.x + al.right;
|
||||
lpRect->bottom = point.y + al.bottom;
|
||||
}
|
||||
else
|
||||
{
|
||||
lpRect->right = point.x + VNSWID * winsizemulx;
|
||||
lpRect->bottom = point.y + FSettings.TotalScanlines() * winsizemuly;
|
||||
}
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// lpRect->right = point.x + VNSWID * winsizemulx;
|
||||
// lpRect->bottom = point.y + FSettings.TotalScanlines() * winsizemuly;
|
||||
//}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -761,7 +761,7 @@ void ShowFPS(void)
|
|||
boop[boopcount] = FCEUD_GetTime();
|
||||
|
||||
sprintf(fpsmsg, "%7.1f",(double)booplimit / ((double)da / FCEUD_GetTimeFreq()));
|
||||
DrawTextTrans(ClipSidesOffset + XBuf + (256 - 7*8) + (FSettings.FirstSLine+4)*256, 256, (uint8*)fpsmsg, 4);
|
||||
DrawTextTrans(ClipSidesOffset + XBuf + ((256 - 2 * ClipSidesOffset) - 7 * 8) + (FSettings.FirstSLine+4)*256, 256, (uint8*)fpsmsg, 4);
|
||||
// It's not averaging FPS over exactly 1 second, but it's close enough.
|
||||
boopcount = (boopcount + 1) % booplimit;
|
||||
}
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue