From 1ac06a6e66449b2acd341beabe367ea8b1c2ad89 Mon Sep 17 00:00:00 2001 From: squall-leonhart Date: Thu, 19 Mar 2015 01:44:47 +0000 Subject: [PATCH] XBRZ 1.2 added as a built in filter git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@1233 a31d4220-a93d-0410-bf67-fe4944624d44 --- CMakeLists.txt | 2 ++ project/vc2008_mfc/VBA2008.vcproj | 20 ++++++++++++++++++ project/vs2010_mfc/VBA2010.vcxproj | 6 +++++- project/vs2010_mfc/VBA2010.vcxproj.filters | 15 ++++++++++++++ src/gtk/filters.cpp | 4 +++- src/gtk/filters.h | 3 ++- src/sdl/filters.cpp | 10 ++++++++- src/sdl/filters.h | 2 +- src/sdl/vbam.cfg-example | 7 ++++--- src/win32/Commands.cpp | 4 ++++ src/win32/MainWnd.cpp | 2 ++ src/win32/MainWndOptions.cpp | 24 ++++++++++++++++++++++ src/win32/VBA.cpp | 24 ++++++++++++++++++++-- src/win32/VBA.h | 10 ++++++--- src/win32/VBA.rc | 7 +++++++ src/win32/resource.h | 6 +++++- 16 files changed, 132 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d5bf7c2e..6c8298f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -303,6 +303,8 @@ SET(SRC_FILTERS src/filters/pixel.cpp src/filters/scanline.cpp src/filters/simpleFilter.cpp + src/filters/xbrzfilter.cpp + src/filters/xBRZ/xbrz.cpp ) SET(SRC_HQ_C diff --git a/project/vc2008_mfc/VBA2008.vcproj b/project/vc2008_mfc/VBA2008.vcproj index 7dcbc0ee..46e483a8 100644 --- a/project/vc2008_mfc/VBA2008.vcproj +++ b/project/vc2008_mfc/VBA2008.vcproj @@ -765,6 +765,26 @@ + + + + + + + + + + + @@ -183,6 +183,8 @@ + + @@ -322,6 +324,8 @@ + + diff --git a/project/vs2010_mfc/VBA2010.vcxproj.filters b/project/vs2010_mfc/VBA2010.vcxproj.filters index 689f593f..ec1637f6 100644 --- a/project/vs2010_mfc/VBA2010.vcxproj.filters +++ b/project/vs2010_mfc/VBA2010.vcxproj.filters @@ -29,6 +29,9 @@ {443f5282-9e21-46cb-b187-746986699f99} + + {5ab58341-15e1-499c-9fee-7695e1a98161} + {b9123fa0-e9e8-444a-a69c-82a2d3bee747} @@ -397,6 +400,12 @@ MFC\GB + + Pixel Filter\xBRZ + + + Pixel Filter\xBRZ + @@ -562,6 +571,12 @@ Pixel Filter\HQ\3x_4x_asm + + Pixel Filter\xBRZ + + + Pixel Filter\xBRZ + Functionality diff --git a/src/gtk/filters.cpp b/src/gtk/filters.cpp index fae36529..f1e47d75 100644 --- a/src/gtk/filters.cpp +++ b/src/gtk/filters.cpp @@ -41,6 +41,7 @@ void hq2x (u8 *, u32, u8 *, u8 *, u32, int, int); void hq2x32 (u8 *, u32, u8 *, u8 *, u32, int, int); void lq2x (u8 *, u32, u8 *, u8 *, u32, int, int); void lq2x32 (u8 *, u32, u8 *, u8 *, u32, int, int); +void xbrz2x32 (u8 *, u32, u8 *, u8 *, u32, int, int); void SmartIB (u8 *, u32, int, int); void SmartIB32 (u8 *, u32, int, int); @@ -68,7 +69,8 @@ static const astFilters[] = { N_("Scanlines"), 2, { Scanlines, Scanlines32 } }, { N_("TV Mode"), 2, { ScanlinesTV, ScanlinesTV32 } }, { N_("hq2x"), 2, { hq2x, hq2x32 } }, - { N_("lq2x"), 2, { lq2x, lq2x32 } } + { N_("lq2x"), 2, { lq2x, lq2x32 } }, + { N_("xbrz2x"), 2, { 0, xbrz2x32 } } }; struct { diff --git a/src/gtk/filters.h b/src/gtk/filters.h index bc4dea60..0986a40f 100644 --- a/src/gtk/filters.h +++ b/src/gtk/filters.h @@ -45,7 +45,8 @@ enum EFilter FilterScanlinesTV, FilterHq2x, FilterLq2x, - LastFilter = FilterLq2x + FilterxBRZ2x, + LastFilter = FilterxBRZ2x }; enum EFilterIB diff --git a/src/sdl/filters.cpp b/src/sdl/filters.cpp index 503f8b0a..a00cb12d 100644 --- a/src/sdl/filters.cpp +++ b/src/sdl/filters.cpp @@ -56,6 +56,10 @@ extern void hq3x16(u8*,u32,u8*,u8*,u32,int,int); extern void hq4x16(u8*,u32,u8*,u8*,u32,int,int); extern void hq3x32_32(u8*,u32,u8*,u8*,u32,int,int); extern void hq4x32_32(u8*,u32,u8*,u8*,u32,int,int); +extern void xbrz2x32(u8*,u32,u8*,u8*,u32,int,int); +extern void xbrz3x32(u8*,u32,u8*,u8*,u32,int,int); +extern void xbrz4x32(u8*,u32,u8*,u8*,u32,int,int); +extern void xbrz5x32(u8*,u32,u8*,u8*,u32,int,int); struct FilterDesc { char name[30]; @@ -79,10 +83,14 @@ const FilterDesc Filters[] = { { "TV Mode", 2, ScanlinesTV, 0, ScanlinesTV32 }, { "lq2x", 2, lq2x, 0, lq2x32 }, { "hq2x", 2, hq2x, 0, hq2x32 }, + { "xbrz2x", 2, 0, 0, xbrz2x32 }, { "Stretch 3x", 3, sdlStretch3x, sdlStretch3x, sdlStretch3x }, { "hq3x", 3, hq3x16, 0, hq3x32_32 }, + { "xbrz3x", 3, 0, 0, xbrz3x32 }, { "Stretch 4x", 4, sdlStretch4x, sdlStretch4x, sdlStretch4x }, - { "hq4x", 4, hq4x16, 0, hq4x32_32 } + { "hq4x", 4, hq4x16, 0, hq4x32_32 }, + { "xbrz4x", 4, 0, 0, xbrz4x32 }, + { "xbrz5x", 5, 0, 0, xbrz5x32 } }; int getFilterEnlargeFactor(const Filter f) diff --git a/src/sdl/filters.h b/src/sdl/filters.h index 9733e453..8550a4bf 100644 --- a/src/sdl/filters.h +++ b/src/sdl/filters.h @@ -28,7 +28,7 @@ // List of available filters enum Filter { kStretch1x, kStretch2x, k2xSaI, kSuper2xSaI, kSuperEagle, kPixelate, kAdMame2x, kBilinear, kBilinearPlus, kScanlines, kScanlinesTV, - klq2x, khq2x, kStretch3x, khq3x, kStretch4x, khq4x, kInvalidFilter }; + klq2x, khq2x, xbrz2x, kStretch3x, khq3x, xbrz3x, kStretch4x, khq4x, xbrz4x, xbrz5x, kInvalidFilter }; // Function pointer type for a filter function typedef void(*FilterFunc)(u8*, u32, u8*, u8*, u32, int, int); diff --git a/src/sdl/vbam.cfg-example b/src/sdl/vbam.cfg-example index 97c2053c..89770cae 100644 --- a/src/sdl/vbam.cfg-example +++ b/src/sdl/vbam.cfg-example @@ -98,9 +98,10 @@ skipBios=0 # Filter to use: # 0 = Stretch 1x (no filter), 1 = Stretch 2x, 2 = 2xSaI, 3 = Super 2xSaI, -# 4 = Super Eagle, 5 = Pixelate, 6 = Motion Blur, 7 = AdvanceMAME Scale2x, -# 8 = Bilinear, 9 = Bilinear Plus, 10 = Scanlines, 11 = TV Mode, 12 = lq2x, -# 13 = hq2x, 14 = Stretch 3x, 15 = hq3x, 16 = Stretch 4x, 17 = hq4x +# 4 = Super Eagle, 5 = Pixelate, 6 = AdvanceMAME Scale2x, 7 = Bilinear, +# 8 = Bilinear Plus, 9 = Scanlines, 10 = TV Mode, 11 = lq2x, 12 = hq2x, +# 13 = xbrz2x, 14 = Stretch 3x, 15 = hq3x, 16 = xbrz3x, 17 = Stretch 4x, +# 18 = hq4x, 19 = xbrz4x, 20 = xbrz5x filter=1 # Disable status messages. 0=false, any other value means true diff --git a/src/win32/Commands.cpp b/src/win32/Commands.cpp index 454d5b1a..a2fa6f38 100644 --- a/src/win32/Commands.cpp +++ b/src/win32/Commands.cpp @@ -151,6 +151,10 @@ struct { { "OptionsFilterScanlines", ID_OPTIONS_FILTER_SCANLINES }, { "OptionsFilterHq2x", ID_OPTIONS_FILTER_HQ2X }, { "OptionsFilterLq2x", ID_OPTIONS_FILTER_LQ2X }, + { "OptionsFilterxBRZ2x", ID_OPTIONS_FILTER_XBRZ2X }, + { "OptionsFilterxBRZ3x", ID_OPTIONS_FILTER_XBRZ3X }, + { "OptionsFilterxBRZ4x", ID_OPTIONS_FILTER_XBRZ4X }, + { "OptionsFilterxBRZ5x", ID_OPTIONS_FILTER_XBRZ5X }, { "OptionsFilterIFBNone", ID_OPTIONS_FILTER_INTERFRAMEBLENDING_NONE }, { "OptionsFilterIFBMotionBlur", ID_OPTIONS_FILTER_INTERFRAMEBLENDING_MOTIONBLUR }, { "OptionsFilterIFBSmart", ID_OPTIONS_FILTER_INTERFRAMEBLENDING_SMART }, diff --git a/src/win32/MainWnd.cpp b/src/win32/MainWnd.cpp index 73416365..7b7f8744 100644 --- a/src/win32/MainWnd.cpp +++ b/src/win32/MainWnd.cpp @@ -352,6 +352,7 @@ BEGIN_MESSAGE_MAP(MainWnd, CWnd) ON_COMMAND_EX_RANGE(ID_OPTIONS_FILTER_BILINEAR, ID_OPTIONS_FILTER_BILINEARPLUS, OnOptionsFilter) ON_COMMAND_EX_RANGE(ID_OPTIONS_FILTER_SCANLINES, ID_OPTIONS_FILTER_SCANLINES, OnOptionsFilter) ON_COMMAND_EX_RANGE(ID_OPTIONS_FILTER_HQ2X, ID_OPTIONS_FILTER_LQ2X, OnOptionsFilter) + ON_COMMAND_EX_RANGE(ID_OPTIONS_FILTER_XBRZ2X, ID_OPTIONS_FILTER_XBRZ5X, OnOptionsFilter) ON_COMMAND_EX(ID_OPTIONS_FILTER_PLUGIN, OnOptionsFilter) ON_UPDATE_COMMAND_UI(ID_OPTIONS_FILTER_PLUGIN, OnUpdateOptionsFilter) ON_COMMAND_EX(ID_OPTIONS_FILTER_HQ3X, OnOptionsFilter) @@ -364,6 +365,7 @@ BEGIN_MESSAGE_MAP(MainWnd, CWnd) ON_UPDATE_COMMAND_UI_RANGE(ID_OPTIONS_FILTER_BILINEAR, ID_OPTIONS_FILTER_BILINEARPLUS, OnUpdateOptionsFilter) ON_UPDATE_COMMAND_UI_RANGE(ID_OPTIONS_FILTER_SCANLINES, ID_OPTIONS_FILTER_SCANLINES, OnUpdateOptionsFilter) ON_UPDATE_COMMAND_UI_RANGE(ID_OPTIONS_FILTER_HQ2X, ID_OPTIONS_FILTER_LQ2X, OnUpdateOptionsFilter) + ON_UPDATE_COMMAND_UI_RANGE(ID_OPTIONS_FILTER_XBRZ2X, ID_OPTIONS_FILTER_XBRZ5X, OnUpdateOptionsFilter) ON_UPDATE_COMMAND_UI(ID_OPTIONS_FILTER_SIMPLE3X, OnUpdateOptionsFilter) ON_UPDATE_COMMAND_UI(ID_OPTIONS_FILTER_SIMPLE4X, OnUpdateOptionsFilter) ON_UPDATE_COMMAND_UI(ID_OPTIONS_FILTER_HQ3X, OnUpdateOptionsFilter) diff --git a/src/win32/MainWndOptions.cpp b/src/win32/MainWndOptions.cpp index ddb87c5e..efce4465 100644 --- a/src/win32/MainWndOptions.cpp +++ b/src/win32/MainWndOptions.cpp @@ -1246,6 +1246,18 @@ BOOL MainWnd::OnOptionsFilter(UINT nID) case ID_OPTIONS_FILTER_HQ4X: theApp.filterType = FILTER_HQ4X; break; + case ID_OPTIONS_FILTER_XBRZ2X: + theApp.filterType = FILTER_XBRZ2X; + break; + case ID_OPTIONS_FILTER_XBRZ3X: + theApp.filterType = FILTER_XBRZ3X; + break; + case ID_OPTIONS_FILTER_XBRZ4X: + theApp.filterType = FILTER_XBRZ4X; + break; + case ID_OPTIONS_FILTER_XBRZ5X: + theApp.filterType = FILTER_XBRZ5X; + break; default: return FALSE; } @@ -1313,6 +1325,18 @@ void MainWnd::OnUpdateOptionsFilter(CCmdUI *pCmdUI) case ID_OPTIONS_FILTER_HQ4X: pCmdUI->SetCheck(theApp.filterType == FILTER_HQ4X); break; + case ID_OPTIONS_FILTER_XBRZ2X: + pCmdUI->SetCheck(theApp.filterType == FILTER_XBRZ2X); + break; + case ID_OPTIONS_FILTER_XBRZ3X: + pCmdUI->SetCheck(theApp.filterType == FILTER_XBRZ3X); + break; + case ID_OPTIONS_FILTER_XBRZ4X: + pCmdUI->SetCheck(theApp.filterType == FILTER_XBRZ4X); + break; + case ID_OPTIONS_FILTER_XBRZ5X: + pCmdUI->SetCheck(theApp.filterType == FILTER_XBRZ5X); + break; } } diff --git a/src/win32/VBA.cpp b/src/win32/VBA.cpp index 0977987e..912fb2b8 100644 --- a/src/win32/VBA.cpp +++ b/src/win32/VBA.cpp @@ -77,6 +77,10 @@ extern void hq4x16(u8*,u32,u8*,u8*,u32,int,int); extern void hq3x32(u8*,u32,u8*,u8*,u32,int,int); extern void hq4x32(u8*,u32,u8*,u8*,u32,int,int); #endif +extern void xbrz2x32(u8*,u32,u8*,u8*,u32,int,int); +extern void xbrz3x32(u8*,u32,u8*,u8*,u32,int,int); +extern void xbrz4x32(u8*,u32,u8*,u8*,u32,int,int); +extern void xbrz5x32(u8*,u32,u8*,u8*,u32,int,int); extern void SmartIB(u8*,u32,int,int); extern void SmartIB32(u8*,u32,int,int); @@ -807,6 +811,22 @@ void VBA::updateFilter() #endif break; #endif + case FILTER_XBRZ2X: + filterFunction = xbrz2x32; + filterMagnification = 2; + break; + case FILTER_XBRZ3X: + filterFunction = xbrz3x32; + filterMagnification = 3; + break; + case FILTER_XBRZ4X: + filterFunction = xbrz4x32; + filterMagnification = 4; + break; + case FILTER_XBRZ5X: + filterFunction = xbrz5x32; + filterMagnification = 5; + break; } } } @@ -1482,8 +1502,8 @@ void VBA::loadSettings() filterType = regQueryDwordValue("filter", 0); - if(filterType < 0 || filterType > 17) - filterType = 0; + if(filterType < FILTER_NONE || filterType > FILTER_LAST) + filterType = FILTER_NONE; filterMT = ( 1 == regQueryDwordValue("filterEnableMultiThreading", 0) ); diff --git a/src/win32/VBA.h b/src/win32/VBA.h index 0f8c3a8e..96f5bba0 100644 --- a/src/win32/VBA.h +++ b/src/win32/VBA.h @@ -31,11 +31,15 @@ enum pixelFilterType FILTER_SIMPLE2X, FILTER_PIXELATE, FILTER_TVMODE, FILTER_SCANLINES, FILTER_PLUGIN, FILTER_BILINEAR, FILTER_BILINEARPLUS, FILTER_MAMESCALE2X, - FILTER_2XSAI, FILTER_SUPER2XSAI, FILTER_SUPEREAGLE, FILTER_LQ2X, FILTER_HQ2X, + FILTER_2XSAI, FILTER_SUPER2XSAI, FILTER_SUPEREAGLE, FILTER_LQ2X, FILTER_HQ2X, FILTER_XBRZ2X, - FILTER_SIMPLE3X, FILTER_HQ3X, + FILTER_SIMPLE3X, FILTER_HQ3X, FILTER_XBRZ3X, - FILTER_SIMPLE4X, FILTER_HQ4X + FILTER_SIMPLE4X, FILTER_HQ4X, FILTER_XBRZ4X, + + FILTER_XBRZ5X, + + FILTER_LAST = FILTER_XBRZ5X }; enum AUDIO_API { diff --git a/src/win32/VBA.rc b/src/win32/VBA.rc index ffe5573f..a75299af 100644 --- a/src/win32/VBA.rc +++ b/src/win32/VBA.rc @@ -1786,18 +1786,25 @@ BEGIN MENUITEM "Super &Eagle", ID_OPTIONS_FILTER_SUPEREAGLE MENUITEM "&LQ2x", ID_OPTIONS_FILTER_LQ2X MENUITEM "&HQ2x", ID_OPTIONS_FILTER_HQ2X + MENUITEM "&xBRZ2x", ID_OPTIONS_FILTER_XBRZ2X END POPUP "&3X" BEGIN MENUITEM "&Simple 3x", ID_OPTIONS_FILTER_SIMPLE3X MENUITEM SEPARATOR MENUITEM "&HQ3x", ID_OPTIONS_FILTER_HQ3X + MENUITEM "&xBRZ3x", ID_OPTIONS_FILTER_XBRZ3X END POPUP "&4X" BEGIN MENUITEM "&Simple 4x", ID_OPTIONS_FILTER_SIMPLE4X MENUITEM SEPARATOR MENUITEM "&HQ4x", ID_OPTIONS_FILTER_HQ4X + MENUITEM "&xBRZ4x", ID_OPTIONS_FILTER_XBRZ4X + END + POPUP "&5X" + BEGIN + MENUITEM "&xBRZ5x", ID_OPTIONS_FILTER_XBRZ5X END END MENUITEM SEPARATOR diff --git a/src/win32/resource.h b/src/win32/resource.h index 493aaba5..dc6d820e 100644 --- a/src/win32/resource.h +++ b/src/win32/resource.h @@ -883,13 +883,17 @@ #define ID_OPTIONS_EMULATOR_DIRECTORIES 40374 #define ID_Menu40375 40375 #define ID_OPTIONS_JOYBUS 40376 +#define ID_OPTIONS_FILTER_XBRZ2X 40377 +#define ID_OPTIONS_FILTER_XBRZ3X 40378 +#define ID_OPTIONS_FILTER_XBRZ4X 40379 +#define ID_OPTIONS_FILTER_XBRZ5X 40380 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 166 -#define _APS_NEXT_COMMAND_VALUE 40377 +#define _APS_NEXT_COMMAND_VALUE 40381 #define _APS_NEXT_CONTROL_VALUE 1299 #define _APS_NEXT_SYMED_VALUE 103 #endif