* Video config: added "Square pixels" option, enabled by default
* Video config: renamed "Use console BG color for empty areas" option to just "BG color" * Video config: added aspect ratio fields for customizing "TV Aspect" ratio, by default it's 4/3
This commit is contained in:
parent
510b8a770b
commit
d962178d15
|
@ -33,23 +33,24 @@ extern int NoWaiting;
|
||||||
|
|
||||||
extern int eoptions;
|
extern int eoptions;
|
||||||
|
|
||||||
#define EO_BGRUN 1
|
#define EO_BGRUN 1
|
||||||
|
|
||||||
#define EO_CPALETTE 4
|
#define EO_CPALETTE 4
|
||||||
#define EO_NOSPRLIM 8
|
#define EO_NOSPRLIM 8
|
||||||
#define EO_FSAFTERLOAD 32
|
#define EO_FSAFTERLOAD 32
|
||||||
#define EO_FOAFTERSTART 64
|
#define EO_FOAFTERSTART 64
|
||||||
#define EO_NOTHROTTLE 128
|
#define EO_NOTHROTTLE 128
|
||||||
#define EO_CLIPSIDES 256
|
#define EO_CLIPSIDES 256
|
||||||
#define EO_HIDEMENU 2048
|
#define EO_HIDEMENU 2048
|
||||||
#define EO_HIGHPRIO 4096
|
#define EO_HIGHPRIO 4096
|
||||||
#define EO_FORCEASPECT 8192
|
#define EO_FORCEASPECT 8192
|
||||||
#define EO_FORCEISCALE 16384
|
#define EO_FORCEISCALE 16384
|
||||||
#define EO_FOURSCORE 32768
|
#define EO_FOURSCORE 32768
|
||||||
#define EO_BESTFIT 65536
|
#define EO_BESTFIT 65536
|
||||||
#define EO_BGCOLOR 131072
|
#define EO_BGCOLOR 131072
|
||||||
#define EO_HIDEMOUSE 262144
|
#define EO_HIDEMOUSE 262144
|
||||||
#define EO_TVASPECT 524288
|
#define EO_TVASPECT 524288
|
||||||
|
#define EO_SQUAREPIXELS 1048576
|
||||||
|
|
||||||
bool directoryExists(const char* dirname);
|
bool directoryExists(const char* dirname);
|
||||||
void WindowBoundsCheckResize(int &windowPosX, int &windowPosY, int windowSizeX, long windowRight);
|
void WindowBoundsCheckResize(int &windowPosX, int &windowPosY, int windowSizeX, long windowRight);
|
||||||
|
|
|
@ -203,8 +203,8 @@ static CFGSTRUCT fceuconfig[] =
|
||||||
AC(NTSCwinspecial),
|
AC(NTSCwinspecial),
|
||||||
AC(winsizemulx),
|
AC(winsizemulx),
|
||||||
AC(winsizemuly),
|
AC(winsizemuly),
|
||||||
NAC("saspectw987",saspectw),
|
AC(tvAspectX),
|
||||||
NAC("saspecth987",saspecth),
|
AC(tvAspectY),
|
||||||
|
|
||||||
AC(soundrate),
|
AC(soundrate),
|
||||||
AC(soundbuftime),
|
AC(soundbuftime),
|
||||||
|
|
|
@ -122,7 +122,7 @@ void ApplyDefaultCommandMapping(void);
|
||||||
// Internal variables
|
// Internal variables
|
||||||
int frameSkipAmt = 18;
|
int frameSkipAmt = 18;
|
||||||
uint8 *xbsave = NULL;
|
uint8 *xbsave = NULL;
|
||||||
int eoptions = EO_BGRUN | EO_FORCEISCALE | EO_BESTFIT | EO_BGCOLOR;
|
int eoptions = EO_BGRUN | EO_FORCEISCALE | EO_BESTFIT | EO_BGCOLOR | EO_SQUAREPIXELS;
|
||||||
|
|
||||||
//global variables
|
//global variables
|
||||||
int soundoptions = SO_SECONDARY | SO_GFOCUS;
|
int soundoptions = SO_SECONDARY | SO_GFOCUS;
|
||||||
|
@ -141,8 +141,8 @@ int soundPCMvol = 256; //Sound channel PCM - volume control
|
||||||
|
|
||||||
int KillFCEUXonFrame = 0; //TODO: clean up, this is used in fceux, move it over there?
|
int KillFCEUXonFrame = 0; //TODO: clean up, this is used in fceux, move it over there?
|
||||||
|
|
||||||
double saspectw = 1.0, saspecth = 1.0;
|
|
||||||
double winsizemulx = 1.0, winsizemuly = 1.0;
|
double winsizemulx = 1.0, winsizemuly = 1.0;
|
||||||
|
double tvAspectX = TV_ASPECT_DEFAULT_X, tvAspectY = TV_ASPECT_DEFAULT_Y;
|
||||||
int genie = 0;
|
int genie = 0;
|
||||||
int pal_emulation = 0;
|
int pal_emulation = 0;
|
||||||
int pal_setting_specified = 0;
|
int pal_setting_specified = 0;
|
||||||
|
|
|
@ -82,8 +82,11 @@ static const char *default_directory_names[13] = {
|
||||||
#define NUMBER_OF_DIRECTORIES sizeof(directory_names) / sizeof(*directory_names)
|
#define NUMBER_OF_DIRECTORIES sizeof(directory_names) / sizeof(*directory_names)
|
||||||
#define NUMBER_OF_DEFAULT_DIRECTORIES sizeof(default_directory_names) / sizeof(*default_directory_names)
|
#define NUMBER_OF_DEFAULT_DIRECTORIES sizeof(default_directory_names) / sizeof(*default_directory_names)
|
||||||
|
|
||||||
extern double saspectw, saspecth;
|
#define TV_ASPECT_DEFAULT_X 4.0
|
||||||
|
#define TV_ASPECT_DEFAULT_Y 3.0
|
||||||
|
|
||||||
extern double winsizemulx, winsizemuly;
|
extern double winsizemulx, winsizemuly;
|
||||||
|
extern double tvAspectX, tvAspectY;
|
||||||
|
|
||||||
extern int ismaximized;
|
extern int ismaximized;
|
||||||
extern int soundoptions;
|
extern int soundoptions;
|
||||||
|
|
|
@ -1746,67 +1746,70 @@ BEGIN
|
||||||
PUSHBUTTON "Edit",IDC_BUTTON_LUAEDIT,58,31,46,16
|
PUSHBUTTON "Edit",IDC_BUTTON_LUAEDIT,58,31,46,16
|
||||||
END
|
END
|
||||||
|
|
||||||
VIDEOCONFIG DIALOGEX 65520, 76, 511, 166
|
VIDEOCONFIG DIALOGEX 65520, 76, 511, 170
|
||||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||||
CAPTION "Video Configuration"
|
CAPTION "Video Configuration"
|
||||||
FONT 8, "MS Sans Serif", 0, 0, 0x0
|
FONT 8, "MS Sans Serif", 0, 0, 0x0
|
||||||
BEGIN
|
BEGIN
|
||||||
GROUPBOX "Full Screen Settings",65453,5,3,171,137,WS_GROUP
|
GROUPBOX "Full Screen Settings",65453,5,3,171,141,WS_GROUP
|
||||||
CONTROL "Full Screen (Alt + Enter or double-click)",IDC_VIDEOCONFIG_FS,
|
CONTROL "Full Screen (Alt + Enter or double-click)",IDC_VIDEOCONFIG_FS,
|
||||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,15,157,12
|
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,15,157,12
|
||||||
CONTROL "Enter full screen mode after game is loaded",IDC_VIDEOCONFIG_AUTO_FS,
|
CONTROL "Enter full screen mode after game is loaded",IDC_VIDEOCONFIG_AUTO_FS,
|
||||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,29,154,12
|
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,29,154,12
|
||||||
LTEXT "Sync method:",65452,12,108,51,10
|
LTEXT "Sync method:",65452,11,112,51,10
|
||||||
COMBOBOX IDC_VIDEOCONFIG_SYNC_METHOD_FS,67,106,95,50,CBS_DROPDOWNLIST | WS_TABSTOP
|
COMBOBOX IDC_VIDEOCONFIG_SYNC_METHOD_FS,66,110,95,50,CBS_DROPDOWNLIST | WS_TABSTOP
|
||||||
CONTROL "Disable hardware acceleration",IDC_DISABLE_HW_ACCEL_FS,
|
CONTROL "Disable hardware acceleration",IDC_DISABLE_HW_ACCEL_FS,
|
||||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,123,147,12
|
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,127,147,12
|
||||||
LTEXT "Mode:",13,12,67,23,9
|
LTEXT "Mode:",13,11,67,23,9
|
||||||
EDITTEXT IDC_VIDEOCONFIG_XRES,37,65,27,13,ES_RIGHT
|
EDITTEXT IDC_VIDEOCONFIG_XRES,36,65,27,13,ES_RIGHT
|
||||||
LTEXT "by",12,68,67,11,9
|
LTEXT "by",12,67,67,11,9
|
||||||
EDITTEXT IDC_VIDEOCONFIG_YRES,80,65,27,13,ES_RIGHT
|
EDITTEXT IDC_VIDEOCONFIG_YRES,79,65,27,13,ES_RIGHT
|
||||||
LTEXT "@",11,111,67,11,9
|
LTEXT "@",11,110,67,11,9
|
||||||
COMBOBOX IDC_VIDEOCONFIG_BPP,123,65,32,12,CBS_DROPDOWNLIST | WS_TABSTOP
|
COMBOBOX IDC_VIDEOCONFIG_BPP,122,65,32,12,CBS_DROPDOWNLIST | WS_TABSTOP
|
||||||
LTEXT "bpp",10,158,67,14,9
|
LTEXT "bpp",10,157,67,14,9
|
||||||
LTEXT "Special scaler:",65444,12,91,52,9
|
LTEXT "Special scaler:",65444,11,95,52,9
|
||||||
COMBOBOX IDC_VIDEOCONFIG_SCALER_FS,67,89,95,46,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
COMBOBOX IDC_VIDEOCONFIG_SCALER_FS,66,93,95,46,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||||
GROUPBOX "Windowed Settings",65441,182,3,164,137,WS_GROUP
|
GROUPBOX "Windowed Settings",65441,182,3,164,141,WS_GROUP
|
||||||
LTEXT "Size Multiplier:",65440,189,21,50,8
|
LTEXT "Size Multiplier:",65440,190,22,50,8
|
||||||
CTEXT "X:",65439,253,10,26,8
|
CTEXT "X:",65439,253,10,26,8
|
||||||
CTEXT "Y:",65438,304,10,26,8
|
CTEXT "Y:",65438,304,10,26,8
|
||||||
EDITTEXT IDC_WINSIZE_MUL_X,244,20,44,12,ES_AUTOHSCROLL
|
EDITTEXT IDC_WINSIZE_MUL_X,244,20,44,12,ES_AUTOHSCROLL
|
||||||
EDITTEXT IDC_WINSIZE_MUL_Y,295,20,44,12,ES_AUTOHSCROLL
|
EDITTEXT IDC_WINSIZE_MUL_Y,295,20,44,12,ES_AUTOHSCROLL
|
||||||
CONTROL "Force integral scaling factors",IDC_FORCE_INT_VIDEO_SCALARS,
|
CONTROL "Force integral scaling factors",IDC_FORCE_INT_VIDEO_SCALARS,
|
||||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,196,50,136,12
|
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,195,50,136,12
|
||||||
CONTROL "Force aspect ratio correction",IDC_FORCE_ASPECT_CORRECTION,
|
CONTROL "Force aspect ratio correction",IDC_FORCE_ASPECT_CORRECTION,
|
||||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,196,64,136,12
|
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,195,64,136,12
|
||||||
LTEXT "Special scaler:",65429,189,91,51,9
|
LTEXT "Special scaler:",65429,188,95,51,9
|
||||||
COMBOBOX IDC_VIDEOCONFIG_SCALER_WIN,245,89,93,47,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
COMBOBOX IDC_VIDEOCONFIG_SCALER_WIN,243,93,93,47,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||||
LTEXT "Sync method:",65437,189,108,51,9
|
LTEXT "Sync method:",65437,188,112,51,9
|
||||||
COMBOBOX IDC_VIDEOCONFIG_SYNC_METHOD_WIN,245,106,93,47,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
COMBOBOX IDC_VIDEOCONFIG_SYNC_METHOD_WIN,243,110,93,47,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||||
CONTROL "Disable hardware acceleration",IDC_DISABLE_HW_ACCEL_WIN,
|
CONTROL "Disable hardware acceleration",IDC_DISABLE_HW_ACCEL_WIN,
|
||||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,189,123,146,12
|
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,188,127,146,12
|
||||||
GROUPBOX "Drawing Area",65494,351,46,154,65,WS_GROUP
|
GROUPBOX "Drawing Area",65494,351,50,154,65,WS_GROUP
|
||||||
LTEXT "First line:",65436,371,64,40,9
|
LTEXT "First line:",65436,367,68,40,9
|
||||||
LTEXT "Last line:",65435,371,80,40,9
|
LTEXT "Last line:",65435,367,84,40,9
|
||||||
CTEXT "NTSC",65434,417,53,27,8
|
CTEXT "NTSC",65434,413,57,27,8
|
||||||
CTEXT "PAL",65433,471,53,27,8
|
CTEXT "PAL",65433,465,57,27,8
|
||||||
EDITTEXT IDC_SCANLINE_FIRST_NTSC,418,62,27,12,ES_RIGHT
|
EDITTEXT IDC_SCANLINE_FIRST_NTSC,414,66,27,12,ES_RIGHT
|
||||||
EDITTEXT IDC_SCANLINE_LAST_NTSC,418,79,27,12,ES_RIGHT
|
EDITTEXT IDC_SCANLINE_LAST_NTSC,414,83,27,12,ES_RIGHT
|
||||||
EDITTEXT IDC_SCANLINE_FIRST_PAL,471,62,27,12,ES_RIGHT
|
EDITTEXT IDC_SCANLINE_FIRST_PAL,465,66,27,12,ES_RIGHT
|
||||||
EDITTEXT IDC_SCANLINE_LAST_PAL,471,79,27,12,ES_RIGHT
|
EDITTEXT IDC_SCANLINE_LAST_PAL,465,83,27,12,ES_RIGHT
|
||||||
CONTROL "Clip left and right sides (8 px on each)",IDC_VIDEOCONFIG_CLIPSIDES,
|
CONTROL "Clip left and right sides (8 px on each)",IDC_VIDEOCONFIG_CLIPSIDES,
|
||||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,359,94,140,12
|
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,357,98,140,12
|
||||||
DEFPUSHBUTTON "Close",ID_CANCEL,449,146,56,14
|
DEFPUSHBUTTON "Close",ID_CANCEL,449,150,56,14
|
||||||
CONTROL "Allow more than 8 sprites per scanline",IDC_VIDEOCONFIG_NO8LIM,
|
CONTROL "Allow more than 8 sprites per scanline",IDC_VIDEOCONFIG_NO8LIM,
|
||||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,359,124,138,11
|
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,357,128,138,11
|
||||||
GROUPBOX "Emulation",65430,351,113,154,27,WS_GROUP
|
GROUPBOX "Emulation",65430,351,117,154,27,WS_GROUP
|
||||||
CONTROL "Best Fit",IDC_VIDEOCONFIG_BESTFIT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,359,14,66,12
|
CONTROL "Best Fit",IDC_VIDEOCONFIG_BESTFIT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,357,14,41,12
|
||||||
CONTROL "Hide mouse cursor",IDC_VIDEOCONFIG_HIDEMOUSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,43,87,12
|
CONTROL "Hide mouse cursor",IDC_VIDEOCONFIG_HIDEMOUSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,43,87,12
|
||||||
GROUPBOX "Aspect ratio",65495,351,3,154,42,WS_GROUP
|
GROUPBOX "Aspect ratio",65495,351,3,154,45,WS_GROUP
|
||||||
CONTROL "Use console BG color for empty areas",IDC_VIDEOCONFIG_CONSOLE_BGCOLOR,
|
CONTROL "BG color",IDC_VIDEOCONFIG_CONSOLE_BGCOLOR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,401,14,44,12
|
||||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,359,28,137,12
|
CONTROL "TV Aspect",IDC_VIDEOCONFIG_TVASPECT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,357,29,48,12
|
||||||
CONTROL "TV Aspect (4:3)",IDC_VIDEOCONFIG_TVASPECT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,431,14,66,12
|
|
||||||
GROUPBOX "When resizing the window",65431,188,38,152,43,WS_GROUP
|
GROUPBOX "When resizing the window",65431,188,38,152,43,WS_GROUP
|
||||||
|
CONTROL "Square pixels",IDC_VIDEOCONFIG_SQUARE_PIXELS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,448,14,55,12
|
||||||
|
EDITTEXT IDC_TVASPECT_X,407,28,41,12,ES_AUTOHSCROLL
|
||||||
|
EDITTEXT IDC_TVASPECT_Y,458,28,41,12,ES_AUTOHSCROLL
|
||||||
|
CTEXT "/",IDC_STATIC_SLASHTEXT,449,31,8,8
|
||||||
END
|
END
|
||||||
|
|
||||||
IDD_RAMSEARCH DIALOGEX 0, 0, 287, 292
|
IDD_RAMSEARCH DIALOGEX 0, 0, 287, 292
|
||||||
|
|
|
@ -122,6 +122,7 @@
|
||||||
#define IDC_DEBUGGER_BREAK_ON_BAD_OP 110
|
#define IDC_DEBUGGER_BREAK_ON_BAD_OP 110
|
||||||
#define IDC_ROMPATCHER_BTN_APPLY 110
|
#define IDC_ROMPATCHER_BTN_APPLY 110
|
||||||
#define LBL_CDLOGGER_RENDERCOUNT 110
|
#define LBL_CDLOGGER_RENDERCOUNT 110
|
||||||
|
#define IDC_VIDEOCONFIG_SQUARE_PIXELS 110
|
||||||
#define MENU_LOAD_STATE 111
|
#define MENU_LOAD_STATE 111
|
||||||
#define CB_DISABLE_SCREEN_SAVER 111
|
#define CB_DISABLE_SCREEN_SAVER 111
|
||||||
#define BTN_FAM 111
|
#define BTN_FAM 111
|
||||||
|
@ -162,7 +163,7 @@
|
||||||
#define CHEAT_CONTEXT_GOTOINHEXEDITOR 119
|
#define CHEAT_CONTEXT_GOTOINHEXEDITOR 119
|
||||||
#define IDC_DEBUGGER_BREAK_ON_INSTRUCTIONS 119
|
#define IDC_DEBUGGER_BREAK_ON_INSTRUCTIONS 119
|
||||||
#define IDC_CHECK_LOG_FRAME_NUMBER 119
|
#define IDC_CHECK_LOG_FRAME_NUMBER 119
|
||||||
#define IDC_CHECK_LOG_FRAMES_COUNT 119
|
#define IDC_CHECK_LOG_FRAMES_COUNT 119
|
||||||
#define IDC_CHECK_LOG_CYCLES_COUNT 120
|
#define IDC_CHECK_LOG_CYCLES_COUNT 120
|
||||||
#define IDC_CHECK_LOG_FRAME_NUMBER3 121
|
#define IDC_CHECK_LOG_FRAME_NUMBER3 121
|
||||||
#define IDC_CHECK_LOG_INSTRUCTIONS_COUNT 121
|
#define IDC_CHECK_LOG_INSTRUCTIONS_COUNT 121
|
||||||
|
@ -430,8 +431,11 @@
|
||||||
#define IDC_FORCE_ASPECT_CORRECTION 403
|
#define IDC_FORCE_ASPECT_CORRECTION 403
|
||||||
#define IDC_DEBUGGER_VAL_S 403
|
#define IDC_DEBUGGER_VAL_S 403
|
||||||
#define IDC_VIDEOCONFIG_ASPECT_X 404
|
#define IDC_VIDEOCONFIG_ASPECT_X 404
|
||||||
|
#define IDC_TVASPECT_X 404
|
||||||
#define IDC_VIDEOCONFIG_ASPECT_Y 405
|
#define IDC_VIDEOCONFIG_ASPECT_Y 405
|
||||||
#define IDC_DEBUGGER_VAL_S2 405
|
#define IDC_DEBUGGER_VAL_S2 405
|
||||||
|
#define IDC_TVASPECT_HEIGHT 405
|
||||||
|
#define IDC_TVASPECT_Y 405
|
||||||
#define IDC_VIDEOCONFIG_SCALER_WIN 406
|
#define IDC_VIDEOCONFIG_SCALER_WIN 406
|
||||||
#define CHECK_ENABLE_MICROPHONE 407
|
#define CHECK_ENABLE_MICROPHONE 407
|
||||||
#define CTL_TINT_TRACKBAR 500
|
#define CTL_TINT_TRACKBAR 500
|
||||||
|
@ -1179,6 +1183,7 @@
|
||||||
#define IDC_DEBUGGER_ICONTRAY 55535
|
#define IDC_DEBUGGER_ICONTRAY 55535
|
||||||
#define MW_ValueLabel2 65423
|
#define MW_ValueLabel2 65423
|
||||||
#define MW_ValueLabel1 65426
|
#define MW_ValueLabel1 65426
|
||||||
|
#define IDC_STATIC_SLASHTEXT 65442
|
||||||
#define IDC_BOOKMARK_NAME_TEXT 65535
|
#define IDC_BOOKMARK_NAME_TEXT 65535
|
||||||
#define ID_CDL 65535
|
#define ID_CDL 65535
|
||||||
|
|
||||||
|
|
|
@ -248,34 +248,59 @@ void recalculateBestFitRect(int width, int height)
|
||||||
{
|
{
|
||||||
if (!lpDD7)
|
if (!lpDD7)
|
||||||
return; // DirectDraw isn't initialized yet
|
return; // DirectDraw isn't initialized yet
|
||||||
|
|
||||||
|
double screen_width = VNSWID;
|
||||||
|
double screen_height = FSettings.TotalScanlines();
|
||||||
|
if (eoptions & EO_TVASPECT)
|
||||||
|
screen_width = ceil(screen_height * (screen_width / 256) * (tvAspectX / tvAspectY));
|
||||||
|
|
||||||
|
int center_x = width / 2;
|
||||||
|
int center_y = height / 2;
|
||||||
|
|
||||||
// calculate bestfitRect
|
// calculate bestfitRect
|
||||||
double current_aspectratio = (double)width / (double)height;
|
double current_aspectratio = (double)width / (double)height;
|
||||||
double needed_aspectratio = (double)(VNSWID) / (double)(FSettings.TotalScanlines());
|
double needed_aspectratio = screen_width / screen_height;
|
||||||
if (eoptions & EO_TVASPECT)
|
if (current_aspectratio >= needed_aspectratio)
|
||||||
needed_aspectratio = ((double)VNSWID / 256) * ((double)4 / 3);
|
|
||||||
if (current_aspectratio == needed_aspectratio)
|
|
||||||
{
|
|
||||||
bestfitRect.left = 0;
|
|
||||||
bestfitRect.right = width;
|
|
||||||
bestfitRect.top = 0;
|
|
||||||
bestfitRect.bottom = height;
|
|
||||||
} else if (current_aspectratio > needed_aspectratio)
|
|
||||||
{
|
{
|
||||||
// the window is wider than emulated screen
|
// the window is wider than emulated screen
|
||||||
bestfitRect.top = 0;
|
double new_height = height;
|
||||||
bestfitRect.bottom = height;
|
if (eoptions & EO_SQUAREPIXELS)
|
||||||
int center_x = width / 2;
|
{
|
||||||
double new_width = ((double)height * needed_aspectratio);
|
new_height = int((double)height / screen_height) * screen_height;
|
||||||
bestfitRect.left = center_x - (new_width / 2);
|
if (new_height == 0)
|
||||||
|
new_height = height;
|
||||||
|
}
|
||||||
|
bestfitRect.top = center_y - (int)(new_height / 2);
|
||||||
|
bestfitRect.bottom = bestfitRect.top + new_height;
|
||||||
|
double new_width = (new_height * needed_aspectratio);
|
||||||
|
if (eoptions & EO_SQUAREPIXELS && !(eoptions & EO_TVASPECT))
|
||||||
|
{
|
||||||
|
int new_width_integer = int((double)new_width / screen_width) * screen_width;
|
||||||
|
if (new_width_integer > 0)
|
||||||
|
new_width = new_width_integer;
|
||||||
|
}
|
||||||
|
bestfitRect.left = center_x - (int)(new_width / 2);
|
||||||
bestfitRect.right = bestfitRect.left + new_width;
|
bestfitRect.right = bestfitRect.left + new_width;
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
// the window is taller than emulated screen
|
// the window is taller than emulated screen
|
||||||
bestfitRect.left = 0;
|
double new_width = width;
|
||||||
bestfitRect.right = width;
|
if (eoptions & EO_SQUAREPIXELS)
|
||||||
int center_y = height / 2;
|
{
|
||||||
double new_height = ((double)width / needed_aspectratio);
|
new_width = int((double)width / screen_width) * screen_width;
|
||||||
bestfitRect.top = center_y - (new_height / 2);
|
if (new_width == 0)
|
||||||
|
new_width = width;
|
||||||
|
}
|
||||||
|
bestfitRect.left = center_x - (int)(new_width / 2);
|
||||||
|
bestfitRect.right = bestfitRect.left + new_width;
|
||||||
|
double new_height = (new_width / needed_aspectratio);
|
||||||
|
if (eoptions & EO_SQUAREPIXELS && !(eoptions & EO_TVASPECT))
|
||||||
|
{
|
||||||
|
int new_height_integer = int((double)new_height / screen_height) * screen_height;
|
||||||
|
if (new_height_integer > 0)
|
||||||
|
new_height = new_height_integer;
|
||||||
|
}
|
||||||
|
bestfitRect.top = center_y - (int)(new_height / 2);
|
||||||
bestfitRect.bottom = bestfitRect.top + new_height;
|
bestfitRect.bottom = bestfitRect.top + new_height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -646,7 +671,8 @@ static void BlitScreenWindow(unsigned char *XBuf)
|
||||||
blitRect.top += bestfitRect.bottom;
|
blitRect.top += bestfitRect.bottom;
|
||||||
blitRect.bottom = wrect.bottom;
|
blitRect.bottom = wrect.bottom;
|
||||||
IDirectDrawSurface7_Blt(lpDDSPrimary, &blitRect, NULL, NULL, DDBLT_COLORFILL | DDBLT_ASYNC, &blitfx);
|
IDirectDrawSurface7_Blt(lpDDSPrimary, &blitRect, NULL, NULL, DDBLT_COLORFILL | DDBLT_ASYNC, &blitfx);
|
||||||
} else
|
}
|
||||||
|
if (bestfitRect.left)
|
||||||
{
|
{
|
||||||
// left border
|
// left border
|
||||||
blitRect.top = wrect.top;
|
blitRect.top = wrect.top;
|
||||||
|
@ -984,7 +1010,8 @@ static void BlitScreenFull(uint8 *XBuf)
|
||||||
borderRect.top += bestfitRect.bottom;
|
borderRect.top += bestfitRect.bottom;
|
||||||
borderRect.bottom = drect.bottom;
|
borderRect.bottom = drect.bottom;
|
||||||
IDirectDrawSurface7_Blt(lpDDSPrimary, &borderRect, NULL, NULL, DDBLT_COLORFILL | DDBLT_ASYNC, &blitfx);
|
IDirectDrawSurface7_Blt(lpDDSPrimary, &borderRect, NULL, NULL, DDBLT_COLORFILL | DDBLT_ASYNC, &blitfx);
|
||||||
} else
|
}
|
||||||
|
if (bestfitRect.left)
|
||||||
{
|
{
|
||||||
// left border
|
// left border
|
||||||
borderRect.top = drect.top;
|
borderRect.top = drect.top;
|
||||||
|
@ -1169,17 +1196,17 @@ static int RecalcCustom(void)
|
||||||
|
|
||||||
BOOL SetDlgItemDouble(HWND hDlg, int item, double value)
|
BOOL SetDlgItemDouble(HWND hDlg, int item, double value)
|
||||||
{
|
{
|
||||||
char buf[9]; //mbg merge 7/19/06 changed to 9 to leave room for \0
|
char buf[16];
|
||||||
sprintf(buf,"%.6f",value);
|
sprintf(buf,"%.6f",value);
|
||||||
return SetDlgItemText(hDlg, item, buf); //mbg merge 7/17/06 added this return value
|
return SetDlgItemText(hDlg, item, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
double GetDlgItemDouble(HWND hDlg, int item)
|
double GetDlgItemDouble(HWND hDlg, int item)
|
||||||
{
|
{
|
||||||
char buf[8];
|
char buf[16];
|
||||||
double ret = 0;
|
double ret = 0;
|
||||||
|
|
||||||
GetDlgItemText(hDlg, item, buf, 8);
|
GetDlgItemText(hDlg, item, buf, 15);
|
||||||
sscanf(buf,"%lf",&ret);
|
sscanf(buf,"%lf",&ret);
|
||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
|
@ -1248,12 +1275,15 @@ BOOL CALLBACK VideoConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
||||||
if(eoptions&EO_BESTFIT)
|
if(eoptions&EO_BESTFIT)
|
||||||
CheckDlgButton(hwndDlg, IDC_VIDEOCONFIG_BESTFIT, BST_CHECKED);
|
CheckDlgButton(hwndDlg, IDC_VIDEOCONFIG_BESTFIT, BST_CHECKED);
|
||||||
|
|
||||||
if(eoptions&EO_TVASPECT)
|
|
||||||
CheckDlgButton(hwndDlg, IDC_VIDEOCONFIG_TVASPECT, BST_CHECKED);
|
|
||||||
|
|
||||||
if(eoptions&EO_BGCOLOR)
|
if(eoptions&EO_BGCOLOR)
|
||||||
CheckDlgButton(hwndDlg,IDC_VIDEOCONFIG_CONSOLE_BGCOLOR,BST_CHECKED);
|
CheckDlgButton(hwndDlg,IDC_VIDEOCONFIG_CONSOLE_BGCOLOR,BST_CHECKED);
|
||||||
|
|
||||||
|
if(eoptions&EO_SQUAREPIXELS)
|
||||||
|
CheckDlgButton(hwndDlg, IDC_VIDEOCONFIG_SQUARE_PIXELS, BST_CHECKED);
|
||||||
|
|
||||||
|
if(eoptions&EO_TVASPECT)
|
||||||
|
CheckDlgButton(hwndDlg, IDC_VIDEOCONFIG_TVASPECT, BST_CHECKED);
|
||||||
|
|
||||||
if(disvaccel&1)
|
if(disvaccel&1)
|
||||||
CheckDlgButton(hwndDlg,IDC_DISABLE_HW_ACCEL_WIN,BST_CHECKED);
|
CheckDlgButton(hwndDlg,IDC_DISABLE_HW_ACCEL_WIN,BST_CHECKED);
|
||||||
|
|
||||||
|
@ -1275,8 +1305,8 @@ BOOL CALLBACK VideoConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara
|
||||||
|
|
||||||
SetDlgItemDouble(hwndDlg, IDC_WINSIZE_MUL_X, winsizemulx);
|
SetDlgItemDouble(hwndDlg, IDC_WINSIZE_MUL_X, winsizemulx);
|
||||||
SetDlgItemDouble(hwndDlg, IDC_WINSIZE_MUL_Y, winsizemuly);
|
SetDlgItemDouble(hwndDlg, IDC_WINSIZE_MUL_Y, winsizemuly);
|
||||||
//SetDlgItemDouble(hwndDlg, IDC_VIDEOCONFIG_ASPECT_X, saspectw);
|
SetDlgItemDouble(hwndDlg, IDC_TVASPECT_X, tvAspectX);
|
||||||
//SetDlgItemDouble(hwndDlg, IDC_VIDEOCONFIG_ASPECT_Y, saspecth);
|
SetDlgItemDouble(hwndDlg, IDC_TVASPECT_Y, tvAspectY);
|
||||||
|
|
||||||
SendDlgItemMessage(hwndDlg,IDC_VIDEOCONFIG_SYNC_METHOD_WIN,CB_ADDSTRING,0,(LPARAM)(LPSTR)"<none>");
|
SendDlgItemMessage(hwndDlg,IDC_VIDEOCONFIG_SYNC_METHOD_WIN,CB_ADDSTRING,0,(LPARAM)(LPSTR)"<none>");
|
||||||
SendDlgItemMessage(hwndDlg,IDC_VIDEOCONFIG_SYNC_METHOD_FS,CB_ADDSTRING,0,(LPARAM)(LPSTR)"<none>");
|
SendDlgItemMessage(hwndDlg,IDC_VIDEOCONFIG_SYNC_METHOD_FS,CB_ADDSTRING,0,(LPARAM)(LPSTR)"<none>");
|
||||||
|
@ -1336,16 +1366,21 @@ gornk:
|
||||||
else
|
else
|
||||||
eoptions &= ~EO_BESTFIT;
|
eoptions &= ~EO_BESTFIT;
|
||||||
|
|
||||||
if (IsDlgButtonChecked(hwndDlg, IDC_VIDEOCONFIG_TVASPECT) == BST_CHECKED)
|
|
||||||
eoptions |= EO_TVASPECT;
|
|
||||||
else
|
|
||||||
eoptions &= ~EO_TVASPECT;
|
|
||||||
|
|
||||||
if (IsDlgButtonChecked(hwndDlg, IDC_VIDEOCONFIG_CONSOLE_BGCOLOR) == BST_CHECKED)
|
if (IsDlgButtonChecked(hwndDlg, IDC_VIDEOCONFIG_CONSOLE_BGCOLOR) == BST_CHECKED)
|
||||||
eoptions |= EO_BGCOLOR;
|
eoptions |= EO_BGCOLOR;
|
||||||
else
|
else
|
||||||
eoptions &= ~EO_BGCOLOR;
|
eoptions &= ~EO_BGCOLOR;
|
||||||
|
|
||||||
|
if (IsDlgButtonChecked(hwndDlg, IDC_VIDEOCONFIG_SQUARE_PIXELS) == BST_CHECKED)
|
||||||
|
eoptions |= EO_SQUAREPIXELS;
|
||||||
|
else
|
||||||
|
eoptions &= ~EO_SQUAREPIXELS;
|
||||||
|
|
||||||
|
if (IsDlgButtonChecked(hwndDlg, IDC_VIDEOCONFIG_TVASPECT) == BST_CHECKED)
|
||||||
|
eoptions |= EO_TVASPECT;
|
||||||
|
else
|
||||||
|
eoptions &= ~EO_TVASPECT;
|
||||||
|
|
||||||
if(IsDlgButtonChecked(hwndDlg,IDC_VIDEOCONFIG_NO8LIM)==BST_CHECKED)
|
if(IsDlgButtonChecked(hwndDlg,IDC_VIDEOCONFIG_NO8LIM)==BST_CHECKED)
|
||||||
eoptions|=EO_NOSPRLIM;
|
eoptions|=EO_NOSPRLIM;
|
||||||
else
|
else
|
||||||
|
@ -1410,11 +1445,15 @@ gornk:
|
||||||
if(IsDlgButtonChecked(hwndDlg,IDC_FORCE_ASPECT_CORRECTION)==BST_CHECKED)
|
if(IsDlgButtonChecked(hwndDlg,IDC_FORCE_ASPECT_CORRECTION)==BST_CHECKED)
|
||||||
eoptions|=EO_FORCEASPECT;
|
eoptions|=EO_FORCEASPECT;
|
||||||
|
|
||||||
winsizemulx=GetDlgItemDouble(hwndDlg, IDC_WINSIZE_MUL_X);
|
winsizemulx = GetDlgItemDouble(hwndDlg, IDC_WINSIZE_MUL_X);
|
||||||
winsizemuly=GetDlgItemDouble(hwndDlg, IDC_WINSIZE_MUL_Y);
|
winsizemuly = GetDlgItemDouble(hwndDlg, IDC_WINSIZE_MUL_Y);
|
||||||
//saspectw=GetDlgItemDouble(hwndDlg, IDC_VIDEOCONFIG_ASPECT_X);
|
|
||||||
//saspecth=GetDlgItemDouble(hwndDlg, IDC_VIDEOCONFIG_ASPECT_Y);
|
|
||||||
FixWXY(0);
|
FixWXY(0);
|
||||||
|
tvAspectX = GetDlgItemDouble(hwndDlg, IDC_TVASPECT_X);
|
||||||
|
tvAspectY = GetDlgItemDouble(hwndDlg, IDC_TVASPECT_Y);
|
||||||
|
if (tvAspectX < 0.1)
|
||||||
|
tvAspectX = 0.1;
|
||||||
|
if (tvAspectY < 0.1)
|
||||||
|
tvAspectY = 0.1;
|
||||||
|
|
||||||
winsync=SendDlgItemMessage(hwndDlg,IDC_VIDEOCONFIG_SYNC_METHOD_WIN,CB_GETCURSEL,0,(LPARAM)(LPSTR)0);
|
winsync=SendDlgItemMessage(hwndDlg,IDC_VIDEOCONFIG_SYNC_METHOD_WIN,CB_GETCURSEL,0,(LPARAM)(LPSTR)0);
|
||||||
fssync=SendDlgItemMessage(hwndDlg,IDC_VIDEOCONFIG_SYNC_METHOD_FS,CB_GETCURSEL,0,(LPARAM)(LPSTR)0);
|
fssync=SendDlgItemMessage(hwndDlg,IDC_VIDEOCONFIG_SYNC_METHOD_FS,CB_GETCURSEL,0,(LPARAM)(LPSTR)0);
|
||||||
|
|
|
@ -335,17 +335,15 @@ static void ConvertFCM(HWND hwndOwner)
|
||||||
|
|
||||||
void CalcWindowSize(RECT *al)
|
void CalcWindowSize(RECT *al)
|
||||||
{
|
{
|
||||||
|
double screen_width = VNSWID;
|
||||||
|
double screen_height = FSettings.TotalScanlines();
|
||||||
|
if (eoptions & EO_TVASPECT)
|
||||||
|
screen_width = ceil(screen_height * (screen_width / 256) * (tvAspectX / tvAspectY));
|
||||||
|
|
||||||
al->left = 0;
|
al->left = 0;
|
||||||
al->top = 0;
|
al->top = 0;
|
||||||
|
al->right = ceil(screen_width * winsizemulx);
|
||||||
al->bottom = FSettings.TotalScanlines();
|
al->bottom = menuYoffset + ceil(screen_height * winsizemuly);
|
||||||
if (eoptions & EO_TVASPECT)
|
|
||||||
al->right = al->bottom * winsizemulx * ((double)VNSWID / 256) * ((double)4 / 3);
|
|
||||||
else
|
|
||||||
al->right = VNSWID * winsizemulx;
|
|
||||||
al->bottom *= winsizemuly;
|
|
||||||
al->bottom += menuYoffset;
|
|
||||||
|
|
||||||
|
|
||||||
AdjustWindowRectEx(al,
|
AdjustWindowRectEx(al,
|
||||||
GetWindowLong(hAppWnd, GWL_STYLE),
|
GetWindowLong(hAppWnd, GWL_STYLE),
|
||||||
|
@ -1123,6 +1121,9 @@ void GetMouseData(uint32 (&md)[3])
|
||||||
{
|
{
|
||||||
extern RECT bestfitRect;
|
extern RECT bestfitRect;
|
||||||
|
|
||||||
|
double screen_width = VNSWID;
|
||||||
|
double screen_height = FSettings.TotalScanlines();
|
||||||
|
|
||||||
if (eoptions & EO_BESTFIT && (bestfitRect.top || bestfitRect.left))
|
if (eoptions & EO_BESTFIT && (bestfitRect.top || bestfitRect.left))
|
||||||
{
|
{
|
||||||
if ((int)mousex <= bestfitRect.left)
|
if ((int)mousex <= bestfitRect.left)
|
||||||
|
@ -1130,20 +1131,20 @@ void GetMouseData(uint32 (&md)[3])
|
||||||
md[0] = 0;
|
md[0] = 0;
|
||||||
} else if ((int)mousex >= bestfitRect.right)
|
} else if ((int)mousex >= bestfitRect.right)
|
||||||
{
|
{
|
||||||
md[0] = VNSWID;
|
md[0] = screen_width - 1;
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
md[0] = VNSWID * (mousex - bestfitRect.left) / (bestfitRect.right - bestfitRect.left);
|
md[0] = screen_width * (mousex - bestfitRect.left) / (bestfitRect.right - bestfitRect.left);
|
||||||
}
|
}
|
||||||
if ((int)mousey <= bestfitRect.top)
|
if ((int)mousey <= bestfitRect.top)
|
||||||
{
|
{
|
||||||
md[1] = 0;
|
md[1] = 0;
|
||||||
} else if ((int)mousey >= bestfitRect.bottom)
|
} else if ((int)mousey >= bestfitRect.bottom)
|
||||||
{
|
{
|
||||||
md[1] = FSettings.TotalScanlines();
|
md[1] = screen_height - 1;
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
md[1] = FSettings.TotalScanlines() * (mousey - bestfitRect.top) / (bestfitRect.bottom - bestfitRect.top);
|
md[1] = screen_height * (mousey - bestfitRect.top) / (bestfitRect.bottom - bestfitRect.top);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
|
@ -1154,20 +1155,20 @@ void GetMouseData(uint32 (&md)[3])
|
||||||
md[0] = 0;
|
md[0] = 0;
|
||||||
} else if ((int)mousex >= client_rect.right)
|
} else if ((int)mousex >= client_rect.right)
|
||||||
{
|
{
|
||||||
md[0] = VNSWID;
|
md[0] = screen_width - 1;
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
md[0] = VNSWID * (mousex - client_rect.left) / (client_rect.right - client_rect.left);
|
md[0] = screen_width * (mousex - client_rect.left) / (client_rect.right - client_rect.left);
|
||||||
}
|
}
|
||||||
if ((int)mousey <= client_rect.top)
|
if ((int)mousey <= client_rect.top)
|
||||||
{
|
{
|
||||||
md[1] = 0;
|
md[1] = 0;
|
||||||
} else if ((int)mousey >= client_rect.bottom)
|
} else if ((int)mousey >= client_rect.bottom)
|
||||||
{
|
{
|
||||||
md[1] = FSettings.TotalScanlines();
|
md[1] = screen_height - 1;
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
md[1] = FSettings.TotalScanlines() * (mousey - client_rect.top) / (client_rect.bottom - client_rect.top);
|
md[1] = screen_height * (mousey - client_rect.top) / (client_rect.bottom - client_rect.top);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
md[0] += VNSCLIP;
|
md[0] += VNSCLIP;
|
||||||
|
@ -2431,30 +2432,15 @@ void FixWXY(int pref, bool shift_held)
|
||||||
{
|
{
|
||||||
if (eoptions & EO_FORCEASPECT)
|
if (eoptions & EO_FORCEASPECT)
|
||||||
{
|
{
|
||||||
/* First, make sure the ratio is valid, and if it's not, change
|
if (pref == 0)
|
||||||
it so that it doesn't break everything.
|
winsizemuly = winsizemulx;
|
||||||
*/
|
else
|
||||||
if(saspectw < 0.01) saspectw = 0.01;
|
winsizemulx = winsizemuly;
|
||||||
if(saspecth < 0.01) saspecth = 0.01;
|
|
||||||
if((saspectw / saspecth) > 100) saspecth = saspectw;
|
|
||||||
if((saspecth / saspectw) > 100) saspectw = saspecth;
|
|
||||||
|
|
||||||
if((saspectw / saspecth) < 0.1) saspecth = saspectw;
|
|
||||||
if((saspecth / saspectw) > 0.1) saspectw = saspecth;
|
|
||||||
|
|
||||||
if(!pref)
|
|
||||||
{
|
|
||||||
winsizemuly = winsizemulx * (saspecth / saspectw);
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
winsizemulx = winsizemuly * (saspectw / saspecth);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (winsizemulx < 0.1)
|
||||||
if(winsizemulx<0.1)
|
winsizemulx = 0.1;
|
||||||
winsizemulx=0.1;
|
if (winsizemuly < 0.1)
|
||||||
if(winsizemuly<0.1)
|
winsizemuly = 0.1;
|
||||||
winsizemuly=0.1;
|
|
||||||
|
|
||||||
// round to integer values
|
// round to integer values
|
||||||
if (((eoptions & EO_FORCEISCALE) && !shift_held) || (!(eoptions & EO_FORCEISCALE) && shift_held))
|
if (((eoptions & EO_FORCEISCALE) && !shift_held) || (!(eoptions & EO_FORCEISCALE) && shift_held))
|
||||||
|
@ -2474,8 +2460,13 @@ void FixWXY(int pref, bool shift_held)
|
||||||
winsizemuly = y;
|
winsizemuly = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(winsizemulx > 100) winsizemulx = 100;
|
/*
|
||||||
if(winsizemuly > 100) winsizemuly = 100;
|
// is this really necessary?
|
||||||
|
if (winsizemulx > 100)
|
||||||
|
winsizemulx = 100;
|
||||||
|
if (winsizemuly > 100)
|
||||||
|
winsizemuly = 100;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateFCEUWindow(void)
|
void UpdateFCEUWindow(void)
|
||||||
|
|
Loading…
Reference in New Issue