diff --git a/desmume/src/windows/fsnitroView.cpp b/desmume/src/windows/fsnitroView.cpp index d67962299..056a5de68 100644 --- a/desmume/src/windows/fsnitroView.cpp +++ b/desmume/src/windows/fsnitroView.cpp @@ -76,6 +76,28 @@ void extractCallback(u32 current, u32 num) SendMessage(hBar, PBM_SETPOS, current, 0); } +void refreshQView(HWND hWnd, u16 id) +{ + HWND ctrl = GetDlgItem(hWnd, IDC_FILE_QVIEW); + + if (id < 0xF000) + { + char buf[256] = {0}; + memset(buf, 0, sizeof(buf)); + u32 len = std::min(sizeof(buf), fs->getFileSizeById(id)); + u32 start = fs->getStartAddrById(id); + + memcpy(&buf[0], &MMU.CART_ROM[start], len); + + for (u32 i = 0; i < len; i++) + if (buf[i] < 0x20) buf[i] = 0x20; + + SetWindowText(ctrl, buf); + } + else + SetWindowText(ctrl, ""); +} + BOOL CALLBACK ViewFSNitroProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) @@ -304,6 +326,7 @@ BOOL CALLBACK ViewFSNitroProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam TreeView_GetItem(GetDlgItem(hWnd, IDC_FILES_TREE), &pitem); currentFileID = pitem.lParam; + refreshQView(hWnd, currentFileID); EnableMenuItem(popupMenu, ID_EXTRACTFILE, MF_BYCOMMAND | ((currentFileID < 0xF000)?MF_ENABLED:MF_GRAYED)); EnableMenuItem(popupMenu, ID_FSNITRO_VIEW, MF_BYCOMMAND | ((currentFileID < 0xF000)?MF_ENABLED:MF_GRAYED)); SetMenuDefaultItem(GetSubMenu(popupMenu, 0), ID_FSNITRO_VIEW, FALSE); @@ -317,6 +340,7 @@ BOOL CALLBACK ViewFSNitroProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam char buf[256] = {0}; currentFileID = sel->itemNew.lParam; + refreshQView(hWnd, currentFileID); if ((currentFileID & 0xF000) == 0xF000) { diff --git a/desmume/src/windows/resource.h b/desmume/src/windows/resource.h index 3fcbb406d..190fdd21c 100644 --- a/desmume/src/windows/resource.h +++ b/desmume/src/windows/resource.h @@ -459,6 +459,7 @@ #define IDC_MESSAGE 1058 #define IDC_IMP_MANUAL_SIZE 1059 #define IDC_BREMOVE 1060 +#define IDC_FILE_QVIEW 1060 #define IDC_BEDIT 1061 #define IDC_STATIC_S1 1061 #define IDC_STATIC_S2 1062 diff --git a/desmume/src/windows/resources.rc b/desmume/src/windows/resources.rc index fe5bfb7d9..6edc6d161 100644 Binary files a/desmume/src/windows/resources.rc and b/desmume/src/windows/resources.rc differ