diff --git a/changelog.txt b/changelog.txt index 3b7d9c16..30d73b14 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,7 @@ +02-Feb-2013 - AnS - Added "TV Aspect (4:3)" to Video Config +21-Jan-2013 - AnS - Taseditor: fixed Bookmarks List height on Windows 7 +21-Jan-2013 - AnS - Taseditor: fixed bug with adding new item to History Log +20-Jan-2013 - AnS - Taseditor: changed the logic by which the Piano Roll follows Playback cursor, now it doesn't follow it while seeking 15-Jan-2013 - AnS - Lua: removed "shadow pixels" from gui.text(), made gui.parsecolor() function available for users 10-Jan-2013 - AnS - Taseditor: Config->Project file saving options 01-Jan-2013 - zeromus - NameTableViewer: do something reasonable if a 4-screen, table2, table3 mirror mode is chosen when the corresponding nametable ram is not available on the cart (instead of crashing) @@ -16,7 +20,7 @@ 13-Dec-2012 - AnS - win32: added NES->Emulation Speed->Set Custom Speed 12-Dec-2012 - CaH4e3 - finish with mapper to boards conversion 07-Dec-2012 - CaH4e3 - Tracer: fixed RAM-located code logging when CDLogger options are enabled -05-Dec-2012 - AnS - fixed zapper and mouse positioning in fullscreen and bestfit mode +05-Dec-2012 - AnS - fixed zapper and mouse positioning in fullscreen 04-Dec-2012 - AnS - speed up HUD text drawing 04-Dec-2012 - AnS - Taseditor: speed up consecutive Recordings (when combining) 03-Dec-2012 - AnS - Taseditor: fixed accelerators when editing Notes diff --git a/src/drivers/win/common.h b/src/drivers/win/common.h index 78b0fe44..bd1632e1 100644 --- a/src/drivers/win/common.h +++ b/src/drivers/win/common.h @@ -49,6 +49,7 @@ extern int eoptions; #define EO_BESTFIT 65536 #define EO_BGCOLOR 131072 #define EO_HIDEMOUSE 262144 +#define EO_TVASPECT 524288 bool directoryExists(const char* dirname); void WindowBoundsCheckResize(int &windowPosX, int &windowPosY, int windowSizeX, long windowRight); diff --git a/src/drivers/win/main.cpp b/src/drivers/win/main.cpp index 8fd34230..5fe8ec5b 100644 --- a/src/drivers/win/main.cpp +++ b/src/drivers/win/main.cpp @@ -122,7 +122,7 @@ void ApplyDefaultCommandMapping(void); // Internal variables int frameSkipAmt = 18; uint8 *xbsave = NULL; -int eoptions = EO_BGRUN | EO_NOSPRLIM | EO_FORCEISCALE | EO_BESTFIT | EO_BGCOLOR; +int eoptions = EO_BGRUN | EO_FORCEISCALE | EO_BESTFIT | EO_BGCOLOR; //global variables 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? -double saspectw = 1, saspecth = 1; -double winsizemulx = 1, winsizemuly = 1; +double saspectw = 1.0, saspecth = 1.0; +double winsizemulx = 1.0, winsizemuly = 1.0; int genie = 0; int pal_emulation = 0; int pal_setting_specified = 0; diff --git a/src/drivers/win/res.rc b/src/drivers/win/res.rc index 6c65dc2e..adec76dc 100644 --- a/src/drivers/win/res.rc +++ b/src/drivers/win/res.rc @@ -1764,9 +1764,9 @@ BEGIN EDITTEXT IDC_WINSIZE_MUL_X,244,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, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,189,36,145,12 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,196,50,136,12 CONTROL "Force aspect ratio correction",IDC_FORCE_ASPECT_CORRECTION, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,189,50,145,12 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,196,64,136,12 LTEXT "Special scaler:",65429,189,91,51,9 COMBOBOX IDC_VIDEOCONFIG_SCALER_WIN,245,89,93,47,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP LTEXT "Sync method:",65437,189,108,51,9 @@ -1788,12 +1788,13 @@ BEGIN CONTROL "Allow more than 8 sprites per scanline",IDC_VIDEOCONFIG_NO8LIM, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,359,124,138,11 GROUPBOX "Emulation",65430,351,113,154,27,WS_GROUP - CONTROL "Always maintain correct aspect ratio",IDC_VIDEOCONFIG_BESTFIT, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,359,14,136,12 + CONTROL "Best Fit",IDC_VIDEOCONFIG_BESTFIT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,359,14,66,12 CONTROL "Hide mouse cursor",IDC_VIDEOCONFIG_HIDEMOUSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,43,87,12 - GROUPBOX "Best Fit",65495,351,3,154,42,WS_GROUP + GROUPBOX "Aspect ratio",65495,351,3,154,42,WS_GROUP CONTROL "Use console BG color for empty areas",IDC_VIDEOCONFIG_CONSOLE_BGCOLOR, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,359,28,136,12 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,359,28,137,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 END IDD_RAMSEARCH DIALOGEX 0, 0, 287, 292 diff --git a/src/drivers/win/resource.h b/src/drivers/win/resource.h index 23fde68a..31ed6cdd 100644 --- a/src/drivers/win/resource.h +++ b/src/drivers/win/resource.h @@ -111,6 +111,8 @@ #define IDC_ADDBP_MODE_X2 109 #define IDC_ADDBP_MODE_F 109 #define BTN_CDLOGGER_SAVE_UNUSED 109 +#define IDC_VIDEOCONFIG_43 109 +#define IDC_VIDEOCONFIG_TVASPECT 109 #define IDC_CHEAT_VAL_LT_BY 110 #define MENU_SAVE_STATE 110 #define CB_ASK_EXIT 110 @@ -717,7 +719,6 @@ #define IDC_TASEDITOR_NAME 1280 #define ID_CANCEL 1281 #define IDC_AUTOSAVE_PROJECT 1282 -#define IDC_AUTOSAVE_PROJECT2 1283 #define IDC_SILENT_AUTOSAVE 1283 #define MENU_NETWORK 40040 #define MENU_PALETTE 40041 diff --git a/src/drivers/win/video.cpp b/src/drivers/win/video.cpp index 7820cb36..cbcc0bbd 100644 --- a/src/drivers/win/video.cpp +++ b/src/drivers/win/video.cpp @@ -274,6 +274,8 @@ void RecreateResizableSurface(int width, int height) // calculate resizable_surface_rect double current_aspectratio = (double)width / (double)height; double needed_aspectratio = (double)(VNSWID) / (double)(FSettings.TotalScanlines()); + if (eoptions & EO_TVASPECT) + needed_aspectratio = ((double)VNSWID / 256) * ((double)4 / 3); if (current_aspectratio == needed_aspectratio) { resizable_surface_rect.left = 0; @@ -286,18 +288,18 @@ void RecreateResizableSurface(int width, int height) 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); + double new_width = ((double)height * needed_aspectratio); + resizable_surface_rect.left = center_x - (new_width / 2); + resizable_surface_rect.right = resizable_surface_rect.left + new_width; } 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); + double new_height = ((double)width / needed_aspectratio); + resizable_surface_rect.top = center_y - (new_height / 2); + resizable_surface_rect.bottom = resizable_surface_rect.top + new_height; } } @@ -448,18 +450,6 @@ int SetVideoMode(int fs) } HideFWindow(1); - if ((vmodes[vmod].flags & VMDF_STRFS) && (eoptions & EO_BESTFIT)) - { - ddrval = IDirectDraw7_SetCooperativeLevel ( lpDD7, hAppWnd, DDSCL_NORMAL); - if (ddrval != DD_OK) - { - //ShowDDErr("Error setting cooperative level."); - FCEU_printf("Error setting cooperative level.\n"); - return 0; - } - RecreateResizableSurface(vmodes[vmod].x, vmodes[vmod].y); - } - ddrval = IDirectDraw7_SetCooperativeLevel ( lpDD7, hAppWnd,DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN | DDSCL_ALLOWREBOOT); if (ddrval != DD_OK) { @@ -497,6 +487,12 @@ int SetVideoMode(int fs) } } + if ((vmodes[vmod].flags & VMDF_STRFS) && (eoptions & EO_BESTFIT)) + { + RecreateResizableSurface(vmodes[vmod].x, vmodes[vmod].y); + } + + // create foreground surface memset(&ddsd,0,sizeof(ddsd)); @@ -722,7 +718,7 @@ static void BlitScreenFull(uint8 *XBuf) char *ScreenLoc; //unsigned long x; //mbg merge 7/17/06 removed //uint8 y; //mbg merge 7/17/06 removed - RECT srect,drect; + RECT srect, drect; LPDIRECTDRAWSURFACE7 lpDDSVPrimary; int specmul; // Special scaler size multiplier // -Video Modes Tag- @@ -971,7 +967,7 @@ static void BlitScreenFull(uint8 *XBuf) if (eoptions & EO_BESTFIT && (resizable_surface_rect.top || resizable_surface_rect.left) && !vmod) { - // clear lpDDSResizable surface + // clear lpDDSResizable surface RecolorResizableSurface(); // blit from lpDDSBack to lpDDSResizable using best fit if (IDirectDrawSurface7_Blt(lpDDSResizable, &resizable_surface_rect, lpDDSBack, &srect, DDBLT_ASYNC, 0) != DD_OK) @@ -1257,6 +1253,9 @@ BOOL CALLBACK VideoConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara if(eoptions&EO_BESTFIT) CheckDlgButton(hwndDlg, IDC_VIDEOCONFIG_BESTFIT, BST_CHECKED); + if(eoptions&EO_TVASPECT) + CheckDlgButton(hwndDlg, IDC_VIDEOCONFIG_TVASPECT, BST_CHECKED); + if(eoptions&EO_BGCOLOR) CheckDlgButton(hwndDlg,IDC_VIDEOCONFIG_CONSOLE_BGCOLOR,BST_CHECKED); @@ -1342,6 +1341,11 @@ gornk: else 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) eoptions |= EO_BGCOLOR; else diff --git a/src/drivers/win/window.cpp b/src/drivers/win/window.cpp index 8c6d76e6..8b389b41 100644 --- a/src/drivers/win/window.cpp +++ b/src/drivers/win/window.cpp @@ -336,9 +336,16 @@ static void ConvertFCM(HWND hwndOwner) void CalcWindowSize(RECT *al) { al->left = 0; - al->right = VNSWID * winsizemulx; al->top = 0; - al->bottom = (FSettings.TotalScanlines() * winsizemuly) + menuYoffset; + + al->bottom = FSettings.TotalScanlines(); + 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, GetWindowLong(hAppWnd, GWL_STYLE), @@ -1377,11 +1384,15 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) { case SIZE_MAXIMIZED: ismaximized = 1; + changerecursive = 1; SetMainWindowStuff(); + changerecursive = 0; break; case SIZE_RESTORED: ismaximized = 0; + changerecursive = 1; SetMainWindowStuff(); + changerecursive = 0; break; } } @@ -2411,7 +2422,7 @@ proco: 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 it so that it doesn't break everything. @@ -2427,8 +2438,7 @@ void FixWXY(int pref, bool shift_held) if(!pref) { winsizemuly = winsizemulx * (saspecth / saspectw); - } - else + } else { winsizemulx = winsizemuly * (saspectw / saspecth); } @@ -2439,6 +2449,7 @@ void FixWXY(int pref, bool shift_held) if(winsizemuly<0.1) winsizemuly=0.1; + // round to integer values if (((eoptions & EO_FORCEISCALE) && !shift_held) || (!(eoptions & EO_FORCEISCALE) && shift_held)) { int x,y; @@ -2604,6 +2615,7 @@ void SetMainWindowStuff() ShowWindow(hAppWnd, SW_SHOWNORMAL); } + if (eoptions & EO_BESTFIT && !windowedfailed) { RECT client_recr; diff --git a/vc/Help/fceux.hnd b/vc/Help/fceux.hnd index 1727f31e..8d39449a 100644 Binary files a/vc/Help/fceux.hnd and b/vc/Help/fceux.hnd differ