From d3e5d7dee9c709537219343f95f8f359060adca6 Mon Sep 17 00:00:00 2001 From: owomomo Date: Tue, 8 Jan 2019 00:42:57 +0800 Subject: [PATCH] 1. Fix Map Hotkey dialog list header and add sort icon to the header of Map Hotkeys. 2. Fix Nametable Viwer checkbox state mismatch when closing and opening again. 3. Fix linux build error. --- src/drivers/win/archive.cpp | 2 +- src/drivers/win/mapinput.cpp | 21 ++++++++++++++++++++- src/drivers/win/mapinput.h | 1 + src/drivers/win/ntview.cpp | 8 +++++--- src/drivers/win/res.rc | 18 +++++++++--------- src/drivers/win/resource.h | 9 +++++---- src/fceu.cpp | 5 +++++ src/file.h | 1 + vc/vc14_fceux.vcxproj | 15 +++++++++++++-- vc/vc14_fceux.vcxproj.filters | 11 +++++++++++ 10 files changed, 71 insertions(+), 20 deletions(-) diff --git a/src/drivers/win/archive.cpp b/src/drivers/win/archive.cpp index 9e945a80..d4eb94e4 100644 --- a/src/drivers/win/archive.cpp +++ b/src/drivers/win/archive.cpp @@ -277,7 +277,7 @@ public: // indicator for the open in archive dialog that if the load was canceled by the user. // TODO: Since I can't think of a better way to indicate it, hope someone could imporve it. -bool archiveManuallyCanceled; +// bool archiveManuallyCanceled; static BOOL CALLBACK ArchiveFileSelectorCallback(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { diff --git a/src/drivers/win/mapinput.cpp b/src/drivers/win/mapinput.cpp index 013b8ada..5e499a99 100644 --- a/src/drivers/win/mapinput.cpp +++ b/src/drivers/win/mapinput.cpp @@ -579,6 +579,7 @@ void PopulateMappingDisplay(HWND hwndDlg) listView.iSubItem = mapInputSortCol; SendMessage(hwndListView, LVM_SORTITEMS, (WPARAM)&listView, (LPARAM)ItemSortFunc); + UpdateSortColumnIcon(hwndListView); } } @@ -810,8 +811,8 @@ BOOL CALLBACK MapInputDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM else lpListView->iSubItem = mapInputSortCol; - // TODO: Add an icon to show which column the sorting is currently based on SendMessage(hwndListView, LVM_SORTITEMS, (WPARAM)lpListView, (LPARAM)ItemSortFunc); + UpdateSortColumnIcon(hwndListView); } return TRUE; } @@ -892,4 +893,22 @@ int CALLBACK ItemSortFunc(LPARAM lp1, LPARAM lp2, LPARAM lpSort) delete[] item2.pszText; return ret; +} + +int UpdateSortColumnIcon(HWND hwndListView) +{ + HWND header = (HWND)SendMessage(hwndListView, LVM_GETHEADER, 0, 0); + for (int i = SendMessage(header, HDM_GETITEMCOUNT, 0, 0) - 1; i >= 0; --i) + { + HDITEM hdItem = { 0 }; + hdItem.mask = HDI_FORMAT; + if (SendMessage(header, HDM_GETITEM, i, (LPARAM)&hdItem)) + { + hdItem.fmt &= ~(HDF_SORTUP | HDF_SORTDOWN); + if (i == mapInputSortCol) + hdItem.fmt |= mapInputSortAsc ? HDF_SORTUP : HDF_SORTDOWN; + SendMessage(header, HDM_SETITEM, i, (LPARAM)&hdItem); + } + } + return 0; } \ No newline at end of file diff --git a/src/drivers/win/mapinput.h b/src/drivers/win/mapinput.h index ff22569a..dc7734bf 100644 --- a/src/drivers/win/mapinput.h +++ b/src/drivers/win/mapinput.h @@ -2,4 +2,5 @@ #define WIN_MAPINPUT_h char* GetKeyComboName(int c); int CALLBACK ItemSortFunc(LPARAM lp1, LPARAM lp2, LPARAM lpSort); +int UpdateSortColumnIcon(HWND hwndListView); #endif diff --git a/src/drivers/win/ntview.cpp b/src/drivers/win/ntview.cpp index 0ebb504e..9a820c3d 100644 --- a/src/drivers/win/ntview.cpp +++ b/src/drivers/win/ntview.cpp @@ -478,9 +478,11 @@ BOOL CALLBACK NTViewCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) SelectObject (pDC, CreatePen (PS_SOLID, 2, RGB (255, 255, 255))) ; - CheckDlgButton(hwndDlg, IDC_NTVIEW_SHOW_SCROLL_LINES, BST_CHECKED); - CheckDlgButton(hwndDlg, IDC_NTVIEW_SHOW_ATTRIBUTES, BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_NTVIEW_HIDE_PALETTES, BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_NTVIEW_SHOW_SCROLL_LINES, scrolllines ? BST_CHECKED : BST_UNCHECKED); + EnableWindow(GetDlgItem(hwndDlg, IDC_NTVIEW_SCANLINE_TEXT), scrolllines); + EnableWindow(GetDlgItem(hwndDlg, IDC_NTVIEW_SCANLINE), scrolllines); + CheckDlgButton(hwndDlg, IDC_NTVIEW_SHOW_ATTRIBUTES, attview ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_NTVIEW_HIDE_PALETTES, hidepal ? BST_CHECKED : BST_UNCHECKED); //clear cache memset(palcache,0,32); diff --git a/src/drivers/win/res.rc b/src/drivers/win/res.rc index 970d5099..c9af15fd 100644 --- a/src/drivers/win/res.rc +++ b/src/drivers/win/res.rc @@ -297,7 +297,7 @@ FONT 8, "Tahoma", 0, 0, 0x0 BEGIN DEFPUSHBUTTON "OK",IDOK,261,274,50,14 PUSHBUTTON "Cancel",BTN_CANCEL,205,274,50,14 - CONTROL "List2",LV_MAPPING,"SysListView32",LVS_REPORT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,7,304,243 + CONTROL "List2",LV_MAPPING,"SysListView32",LVS_REPORT | WS_BORDER | WS_TABSTOP,7,7,304,243 PUSHBUTTON "Restore Defaults",BTN_RESTORE_DEFAULTS,7,274,75,14 COMBOBOX COMBO_FILTER,32,255,279,193,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP RTEXT "Filter:",65484,6,255,21,12,SS_CENTERIMAGE | NOT WS_GROUP @@ -578,10 +578,10 @@ BEGIN CONTROL "Set high-priority thread.",CB_SET_HIGH_PRIORITY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,24,102,12 CONTROL "Overclocking (old PPU only).",CB_OVERCLOCKING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,41,101,10 EDITTEXT IDC_EXTRA_SCANLINES,104,55,84,14,ES_AUTOHSCROLL | WS_DISABLED - LTEXT "Post-render scanlines:",IDC_EXTRA_SCANLINES_TEXT,21,57,74,8, WS_DISABLED + LTEXT "Post-render scanlines:",IDC_EXTRA_SCANLINES_TEXT,21,57,74,8,WS_DISABLED CONTROL "Don't overclock 7-bit samples.",CB_SKIP_7BIT,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,10,87,111,10 EDITTEXT IDC_VBLANK_SCANLINES,104,68,84,14,ES_AUTOHSCROLL | WS_DISABLED - LTEXT "VBlank scanlines:",IDC_VBLANK_SCANLINES_TEXT,21,71,76,8, WS_DISABLED + LTEXT "VBlank scanlines:",IDC_VBLANK_SCANLINES_TEXT,21,71,76,8,WS_DISABLED END MOVIEOPTIONS DIALOGEX 65520, 76, 147, 222 @@ -864,15 +864,15 @@ CAPTION "Name Table Viewer" FONT 8, "Tahoma", 0, 0, 0x0 BEGIN GROUPBOX "Name Tables",IDC_NTVIEW_TABLE_BOX,2,0,347,251,WS_TABSTOP - LTEXT "Refresh: More",-1,225,254,50,9 + LTEXT "Refresh: More",IDC_STATIC,225,254,50,9 CONTROL "",IDC_NTVIEW_REFRESH_TRACKBAR,"msctls_trackbar32",WS_TABSTOP,275,254,50,11 - LTEXT "Less",-1,325,254,18,10 + LTEXT "Less",IDC_STATIC,325,254,18,10 LTEXT "Display on scanline:",IDC_NTVIEW_SCANLINE_TEXT,253,269,65,9 EDITTEXT IDC_NTVIEW_SCANLINE,315,267,27,12 CONTROL "Show Scroll Lines",IDC_NTVIEW_SHOW_SCROLL_LINES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,254,69,10 CONTROL "Show Attributes",IDC_NTVIEW_SHOW_ATTRIBUTES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,265,69,10 CONTROL "Ignore Palettes",IDC_NTVIEW_HIDE_PALETTES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,276,69,10 - GROUPBOX "Current Mirroring",-1,2,289,170,59 + GROUPBOX "Current Mirroring",IDC_STATIC,2,289,170,59 CONTROL "Horizontal",IDC_NTVIEW_MIRROR_HORIZONTAL,"Button",BS_AUTORADIOBUTTON,6,300,47,10 CONTROL "Vertical",IDC_NTVIEW_MIRROR_VERTICAL,"Button",BS_AUTORADIOBUTTON,6,311,39,10 CONTROL "Four Screen",IDC_NTVIEW_MIRROR_FOUR_SCREEN,"Button",BS_AUTORADIOBUTTON,6,322,55,10 @@ -880,7 +880,7 @@ BEGIN CONTROL "Single Screen 1",IDC_NTVIEW_MIRROR_SS_TABLE_1,"Button",BS_AUTORADIOBUTTON,85,311,75,10 CONTROL "Single Screen 2",IDC_NTVIEW_MIRROR_SS_TABLE_2,"Button",BS_AUTORADIOBUTTON,85,322,75,10 CONTROL "Single Screen 3",IDC_NTVIEW_MIRROR_SS_TABLE_3,"Button",BS_AUTORADIOBUTTON,85,333,75,10 - GROUPBOX "Properties",-1,174,289,175,59 + GROUPBOX "Properties",IDC_STATIC,174,289,175,59 LTEXT "Tile ID:",IDC_NTVIEW_PROPERTIES_LINE_1,184,300,150,10 LTEXT "X / Y:",IDC_NTVIEW_PROPERTIES_LINE_2,184,311,150,10 LTEXT "PPU Address:",IDC_NTVIEW_PROPERTIES_LINE_3,184,322,150,10 @@ -1838,12 +1838,12 @@ BEGIN POPUP "E&mulation Speed" BEGIN MENUITEM "&Pause", ID_NES_PAUSE - MENUITEM "&Turbo", ID_NES_TURBO + MENUITEM "&Turbo", ID_NES_TURBO MENUITEM SEPARATOR MENUITEM "Speed &Up", ID_NES_SPEEDUP MENUITEM "Slow &Down", ID_NES_SLOWDOWN MENUITEM "&Slowest Speed", ID_NES_SLOWESTSPEED - MENUITEM "&Normal Speed", ID_NES_NORMALSPEED + MENUITEM "&Normal Speed", ID_NES_NORMALSPEED MENUITEM "Set &Custom Speed", ID_EMULATIONSPEED_CUSTOMSPEED MENUITEM SEPARATOR MENUITEM "Set FrameAdvance Delay", ID_EMULATIONSPEED_SETFRAMEADVANCEDELAY diff --git a/src/drivers/win/resource.h b/src/drivers/win/resource.h index 1839a585..8c8adc06 100644 --- a/src/drivers/win/resource.h +++ b/src/drivers/win/resource.h @@ -366,6 +366,7 @@ #define IDD_TASEDITOR_SAVINGOPTIONS 289 #define IDD_SYMBOLIC_DEBUG_NAMING 290 #define DLG_SNESPAD 291 +#define IDB_PNG2 298 #define MENU_HIDE_MENU 300 #define COMBO_FILTER 300 #define IDC_EDIT_AUTHORINFO 300 @@ -1273,15 +1274,15 @@ #define MW_ValueLabel2 65423 #define MW_ValueLabel1 65426 #define IDC_STATIC_SLASHTEXT 65442 -#define IDC_BOOKMARK_NAME_TEXT 65535 -#define ID_CDL 65535 -#define IDC_NTVIEW_SCANLINE_TEXT 65535 +#define IDC_BOOKMARK_NAME_TEXT 65532 +#define ID_CDL 65533 +#define IDC_NTVIEW_SCANLINE_TEXT 65534 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 296 +#define _APS_NEXT_RESOURCE_VALUE 302 #define _APS_NEXT_COMMAND_VALUE 40600 #define _APS_NEXT_CONTROL_VALUE 1310 #define _APS_NEXT_SYMED_VALUE 101 diff --git a/src/fceu.cpp b/src/fceu.cpp index f6763d43..36e43013 100644 --- a/src/fceu.cpp +++ b/src/fceu.cpp @@ -114,6 +114,11 @@ bool AutoResumePlay = false; char romNameWhenClosingEmulator[2048] = {0}; bool togglePausedRequested = false; //Flaged true to pause at frame boundary + +// indicator for the open in archive dialog that if the load was canceled by the user. +// TODO: Since I can't think of a better way to indicate it, hope someone could imporve it. +bool archiveManuallyCanceled = false; + FCEUGI::FCEUGI() : filename(0), archiveFilename(0) { diff --git a/src/file.h b/src/file.h index 539936a9..5a6a5d4a 100644 --- a/src/file.h +++ b/src/file.h @@ -15,6 +15,7 @@ extern bool bindSavestate; // TODO: Since I can't think of a better way to indicate it, hope someone could imporve it. extern bool archiveManuallyCanceled; + struct FCEUFILE { //the stream you can use to access the data //std::iostream *stream; diff --git a/vc/vc14_fceux.vcxproj b/vc/vc14_fceux.vcxproj index e29d1bb6..72656b32 100644 --- a/vc/vc14_fceux.vcxproj +++ b/vc/vc14_fceux.vcxproj @@ -75,8 +75,8 @@ v141_xp - - + + @@ -1439,6 +1439,17 @@ + + + + + + + + + + + diff --git a/vc/vc14_fceux.vcxproj.filters b/vc/vc14_fceux.vcxproj.filters index 0e466f6b..6c8ce36d 100644 --- a/vc/vc14_fceux.vcxproj.filters +++ b/vc/vc14_fceux.vcxproj.filters @@ -1939,4 +1939,15 @@ + + + + + + + + + + + \ No newline at end of file