Remove redundant Rom Info Dialog

This commit is contained in:
Barry Harris 2015-01-05 16:12:18 +00:00
parent e6a6cfdd7e
commit f2e1d96836
3 changed files with 0 additions and 348 deletions

View File

@ -481,18 +481,6 @@ BEGIN
CONTROL "",IDC_MESSAGE_EDIT_ENG,"RICHEDIT20A",ES_MULTILINE | ES_READONLY | ES_WANTRETURN | ES_NOIME | WS_TABSTOP,38,7,4,2 | ES_EX_NOCALLOLEINIT
END
IDD_ROMINFO DIALOGEX 0, 0, 496, 204
STYLE DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Game Information"
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
CONTROL "Tab1",IDC_TAB1,"SysTabControl32",TCS_SINGLELINE | WS_TABSTOP,4,6,488,176
CONTROL "List1",IDC_LIST1,"SysListView32",LVS_REPORT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,8,24,480,153
CONTROL "List2",IDC_LIST2,"SysListView32",LVS_REPORT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,8,24,480,153
DEFPUSHBUTTON "Rescan Romset",IDRESCAN,369,186,60,14
DEFPUSHBUTTON "Close",IDCANCEL,432,186,60,14
END
IDD_SUPPORTDIR DIALOGEX 0, 0, 242, 81
STYLE DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Edit support file paths"

View File

@ -42,7 +42,6 @@
#define IDD_POPUP 73
#define IDD_SUPPORTDIR 74
#define IDD_PALETTEVIEWER 75
#define IDD_ROMINFO 76
#define IDD_IPS_MANAGER 77
#define IDD_MVS_SELECT_CARTS 78
#define IDD_NCD_DLG 79

View File

@ -41,8 +41,6 @@ int nIconsYDiff;
static HICON hDrvIcon[9999];
bool bGameInfoOpen = false;
static int RomInfoDialog();
// Dialog Sizing
int nSelDlgWidth = 750;
int nSelDlgHeight = 588;
@ -1600,7 +1598,6 @@ static INT_PTR CALLBACK DialogProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lP
break;
case IDGAMEINFO:
if (bDrvSelected) {
//RomInfoDialog();
GameInfoDialogCreate(hSelDlg, nBurnDrvActive);
} else {
MessageBox(hSelDlg, FBALoadStringEx(hAppInst, IDS_ERR_NO_DRIVER_SELECTED, true), FBALoadStringEx(hAppInst, IDS_ERR_ERROR, true), MB_OK);
@ -2149,338 +2146,6 @@ int SelDialog(int nMVSCartsOnly, HWND hParentWND)
return nDialogSelect;
}
// Rom Info Dialog
static HWND hTabControl = NULL;
static int nRInBurnDrvActive = 0; // see comments in RomInfoDialog()
static INT_PTR CALLBACK RomInfoDialogProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
{
switch (Msg) {
case WM_INITDIALOG: {
TCHAR szText[1024] = _T("");
TCHAR szFullName[1024] = _T("");
TCHAR* pszPosition = szText;
TCHAR* pszName = BurnDrvGetText(DRV_FULLNAME);
pszPosition += _sntprintf(szText, 1024, pszName);
pszName = BurnDrvGetText(DRV_FULLNAME);
while ((pszName = BurnDrvGetText(DRV_NEXTNAME | DRV_FULLNAME)) != NULL) {
if (pszPosition + _tcslen(pszName) - 1024 > szText) {
break;
}
pszPosition += _stprintf(pszPosition, _T(SEPERATOR_2) _T("%s"), pszName);
}
_tcscpy(szFullName, szText);
_stprintf(szText, _T("%s") _T(SEPERATOR_1) _T("%s"), FBALoadStringEx(hAppInst, IDS_ROMINFO_DIALOGTITLE, true), szFullName);
SetWindowText(hDlg, szText);
// Setup the tabs
hTabControl = GetDlgItem(hDlg, IDC_TAB1);
TC_ITEM tcItem;
tcItem.mask = TCIF_TEXT;
UINT idsString[2] = { IDS_ROMINFO_ROMS, IDS_ROMINFO_SAMPLES };
for(int nIndex = 0; nIndex < 2; nIndex++) {
tcItem.pszText = FBALoadStringEx(hAppInst, idsString[nIndex], true);
TabCtrl_InsertItem(hTabControl, nIndex, &tcItem);
}
// Set up the rom info list
HWND hList = GetDlgItem(hDlg, IDC_LIST1);
LV_COLUMN LvCol;
LV_ITEM LvItem;
ListView_SetExtendedListViewStyle(hList, LVS_EX_FULLROWSELECT);
memset(&LvCol, 0, sizeof(LvCol));
LvCol.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
LvCol.cx = 200;
LvCol.pszText = FBALoadStringEx(hAppInst, IDS_ROMINFO_NAME, true);
SendMessage(hList, LVM_INSERTCOLUMN , 0, (LPARAM)&LvCol);
LvCol.cx = 100;
LvCol.pszText = FBALoadStringEx(hAppInst, IDS_ROMINFO_SIZE, true);
SendMessage(hList, LVM_INSERTCOLUMN , 1, (LPARAM)&LvCol);
LvCol.cx = 100;
LvCol.pszText = FBALoadStringEx(hAppInst, IDS_ROMINFO_CRC32, true);
SendMessage(hList, LVM_INSERTCOLUMN , 2, (LPARAM)&LvCol);
LvCol.cx = 200;
LvCol.pszText = FBALoadStringEx(hAppInst, IDS_ROMINFO_TYPE, true);
SendMessage(hList, LVM_INSERTCOLUMN , 3, (LPARAM)&LvCol);
LvCol.cx = 100;
LvCol.pszText = FBALoadStringEx(hAppInst, IDS_ROMINFO_FLAGS, true);
SendMessage(hList, LVM_INSERTCOLUMN , 4, (LPARAM)&LvCol);
LvCol.cx = 100;
memset(&LvItem, 0, sizeof(LvItem));
LvItem.mask= LVIF_TEXT;
LvItem.cchTextMax = 256;
int RomPos = 0;
for (int i = 0; i < 0x100; i++) { // assume max 0x100 roms per game
int nRet;
struct BurnRomInfo ri;
char nLen[16] = "";
char nCrc[16] = "";
char *szRomName = NULL;
TCHAR Type[100] = _T("");
TCHAR FormatType[100] = _T("");
memset(&ri, 0, sizeof(ri));
nRet = BurnDrvGetRomInfo(&ri, i);
nRet += BurnDrvGetRomName(&szRomName, i, 0);
if (ri.nLen == 0) continue;
if (ri.nType & BRF_BIOS) continue;
LvItem.iItem = RomPos;
LvItem.iSubItem = 0;
LvItem.pszText = ANSIToTCHAR(szRomName, NULL, 0);
SendMessage(hList, LVM_INSERTITEM, 0, (LPARAM)&LvItem);
sprintf(nLen, "%d", ri.nLen);
LvItem.iSubItem = 1;
LvItem.pszText = ANSIToTCHAR(nLen, NULL, 0);
SendMessage(hList, LVM_SETITEM, 0, (LPARAM)&LvItem);
sprintf(nCrc, "%08X", ri.nCrc);
if (!(ri.nType & BRF_NODUMP)) {
LvItem.iSubItem = 2;
LvItem.pszText = ANSIToTCHAR(nCrc, NULL, 0);
SendMessage(hList, LVM_SETITEM, 0, (LPARAM)&LvItem);
}
if (ri.nType & BRF_ESS) _stprintf(Type, FBALoadStringEx(hAppInst, IDS_ROMINFO_ESSENTIAL, true), Type);
if (ri.nType & BRF_OPT) _stprintf(Type, FBALoadStringEx(hAppInst, IDS_ROMINFO_OPTIONAL, true), Type);
if (ri.nType & BRF_PRG) _stprintf(Type, FBALoadStringEx(hAppInst, IDS_ROMINFO_PROGRAM, true), Type);
if (ri.nType & BRF_GRA) _stprintf(Type, FBALoadStringEx(hAppInst, IDS_ROMINFO_GRAPHICS, true), Type);
if (ri.nType & BRF_SND) _stprintf(Type, FBALoadStringEx(hAppInst, IDS_ROMINFO_SOUND, true), Type);
if (ri.nType & BRF_BIOS) _stprintf(Type, FBALoadStringEx(hAppInst, IDS_ROMINFO_BIOS, true), Type);
for (int j = 0; j < 98; j++) {
FormatType[j] = Type[j + 2];
}
LvItem.iSubItem = 3;
LvItem.pszText = FormatType;
SendMessage(hList, LVM_SETITEM, 0, (LPARAM)&LvItem);
LvItem.iSubItem = 4;
LvItem.pszText = _T("");
if (ri.nType & BRF_NODUMP) LvItem.pszText = FBALoadStringEx(hAppInst, IDS_ROMINFO_NODUMP, true);
SendMessage(hList, LVM_SETITEM, 0, (LPARAM)&LvItem);
RomPos++;
}
// Check for board roms
if (BurnDrvGetTextA(DRV_BOARDROM)) {
char szBoardName[8] = "";
unsigned int nOldDrvSelect = nBurnDrvActive;
strcpy(szBoardName, BurnDrvGetTextA(DRV_BOARDROM));
for (unsigned int i = 0; i < nBurnDrvCount; i++) {
nBurnDrvActive = i;
if (!strcmp(szBoardName, BurnDrvGetTextA(DRV_NAME))) break;
}
for (int j = 0; j < 0x100; j++) {
int nRetBoard;
struct BurnRomInfo riBoard;
char nLenBoard[16] = "";
char nCrcBoard[16] = "";
char *szBoardRomName = NULL;
TCHAR BoardType[100] = _T("");
TCHAR BoardFormatType[100] = _T("");
memset(&riBoard, 0, sizeof(riBoard));
nRetBoard = BurnDrvGetRomInfo(&riBoard, j);
nRetBoard += BurnDrvGetRomName(&szBoardRomName, j, 0);
if (riBoard.nLen == 0) continue;
LvItem.iItem = RomPos;
LvItem.iSubItem = 0;
LvItem.pszText = ANSIToTCHAR(szBoardRomName, NULL, 0);
SendMessage(hList, LVM_INSERTITEM, 0, (LPARAM)&LvItem);
sprintf(nLenBoard, "%d", riBoard.nLen);
LvItem.iSubItem = 1;
LvItem.pszText = ANSIToTCHAR(nLenBoard, NULL, 0);
SendMessage(hList, LVM_SETITEM, 0, (LPARAM)&LvItem);
sprintf(nCrcBoard, "%08X", riBoard.nCrc);
if (!(riBoard.nType & BRF_NODUMP)) {
LvItem.iSubItem = 2;
LvItem.pszText = ANSIToTCHAR(nCrcBoard, NULL, 0);
SendMessage(hList, LVM_SETITEM, 0, (LPARAM)&LvItem);
}
if (riBoard.nType & BRF_ESS) _stprintf(BoardType, FBALoadStringEx(hAppInst, IDS_ROMINFO_ESSENTIAL, true), BoardType);
if (riBoard.nType & BRF_OPT) _stprintf(BoardType, FBALoadStringEx(hAppInst, IDS_ROMINFO_OPTIONAL, true), BoardType);
if (riBoard.nType & BRF_PRG) _stprintf(BoardType, FBALoadStringEx(hAppInst, IDS_ROMINFO_PROGRAM, true), BoardType);
if (riBoard.nType & BRF_GRA) _stprintf(BoardType, FBALoadStringEx(hAppInst, IDS_ROMINFO_GRAPHICS, true), BoardType);
if (riBoard.nType & BRF_SND) _stprintf(BoardType, FBALoadStringEx(hAppInst, IDS_ROMINFO_SOUND, true), BoardType);
if (riBoard.nType & BRF_BIOS) _stprintf(BoardType, FBALoadStringEx(hAppInst, IDS_ROMINFO_BIOS, true), BoardType);
for (int k = 0; k < 98; k++) {
BoardFormatType[k] = BoardType[k + 2];
}
LvItem.iSubItem = 3;
LvItem.pszText = BoardFormatType;
SendMessage(hList, LVM_SETITEM, 0, (LPARAM)&LvItem);
LvItem.iSubItem = 4;
LvItem.pszText = _T("");
if (riBoard.nType & BRF_NODUMP) LvItem.pszText = FBALoadStringEx(hAppInst, IDS_ROMINFO_NODUMP, true);
SendMessage(hList, LVM_SETITEM, 0, (LPARAM)&LvItem);
RomPos++;
}
nBurnDrvActive = nOldDrvSelect;
}
// Set up the sample info list
hList = GetDlgItem(hDlg, IDC_LIST2);
ListView_SetExtendedListViewStyle(hList, LVS_EX_FULLROWSELECT);
memset(&LvCol, 0, sizeof(LvCol));
LvCol.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
LvCol.cx = 200;
LvCol.pszText = FBALoadStringEx(hAppInst, IDS_ROMINFO_NAME, true);
SendMessage(hList, LVM_INSERTCOLUMN , 0, (LPARAM)&LvCol);
memset(&LvItem, 0, sizeof(LvItem));
LvItem.mask= LVIF_TEXT;
LvItem.cchTextMax = 256;
int SamplePos = 0;
if (BurnDrvGetTextA(DRV_SAMPLENAME) != NULL) {
for (int i = 0; i < 0x100; i++) { // assume max 0x100 samples per game
int nRet;
struct BurnSampleInfo si;
char *szSampleName = NULL;
memset(&si, 0, sizeof(si));
nRet = BurnDrvGetSampleInfo(&si, i);
nRet += BurnDrvGetSampleName(&szSampleName, i, 0);
if (si.nFlags == 0) continue;
LvItem.iItem = SamplePos;
LvItem.iSubItem = 0;
LvItem.pszText = ANSIToTCHAR(szSampleName, NULL, 0);
SendMessage(hList, LVM_INSERTITEM, 0, (LPARAM)&LvItem);
SamplePos++;
}
}
ShowWindow(GetDlgItem(hDlg, IDC_LIST1), SW_SHOW);
ShowWindow(GetDlgItem(hDlg, IDC_LIST2), SW_HIDE);
UpdateWindow(hDlg);
WndInMid(hDlg, hSelDlg);
SetFocus(hDlg); // Enable Esc=close
return TRUE;
}
case WM_COMMAND: {
int Id = LOWORD(wParam);
int Notify = HIWORD(wParam);
if (Id == IDCANCEL && Notify == BN_CLICKED) {
SendMessage(hDlg, WM_CLOSE, 0, 0);
return 0;
}
if (Id == IDRESCAN && Notify == BN_CLICKED) {
nBurnDrvActive = nRInBurnDrvActive;
// use the nBurnDrvActive value from when the Rom Info button was clicked, because it can/will change
// even though the selection list [window below it] doesn't have focus. -dink
// for proof/symptoms - uncomment the line below and click the 'rescan' button after moving the window to different places on the screen.
//bprintf(0, _T("nBurnDrvActive %d nRInBurnDrvActive %d\n"), nBurnDrvActive, nRInBurnDrvActive);
switch (BzipOpen(1)) {
case 0:
gameAv[nRInBurnDrvActive] = 3;
break;
case 2:
gameAv[nRInBurnDrvActive] = 1;
break;
case 1:
gameAv[nRInBurnDrvActive] = 0;
BzipClose();
BzipOpen(0); // this time, get the missing roms/error message.
{
HWND hScrnWndtmp = hScrnWnd; // Crash preventer: Make the rominfo dialog (this one) the parent modal for the popup message
hScrnWnd = hDlg;
FBAPopupDisplay(PUF_TYPE_ERROR);
hScrnWnd = hScrnWndtmp;
}
break;
}
if (gameAv[nRInBurnDrvActive] > 0) {
// if the romset is OK, just say so in the rom info dialog (instead of popping up a window)
HWND hList = GetDlgItem(hDlg, IDC_LIST1);
LV_ITEM LvItem;
memset(&LvItem, 0, sizeof(LvItem));
LvItem.mask= LVIF_TEXT;
LvItem.cchTextMax = 256;
LvItem.iSubItem = 4;
LvItem.pszText = _T("Romset OK!");
SendMessage(hList, LVM_SETITEM, 0, (LPARAM)&LvItem);
UpdateWindow(hDlg);
}
BzipClose();
WriteGameAvb();
return 0;
}
}
case WM_NOTIFY: {
NMHDR* pNmHdr = (NMHDR*)lParam;
if (pNmHdr->code == TCN_SELCHANGE) {
int TabPage = TabCtrl_GetCurSel(hTabControl);
ShowWindow(GetDlgItem(hDlg, IDC_LIST1), SW_HIDE);
ShowWindow(GetDlgItem(hDlg, IDC_LIST2), SW_HIDE);
if (TabPage == 0) ShowWindow(GetDlgItem(hDlg, IDC_LIST1), SW_SHOW);
if (TabPage == 1) ShowWindow(GetDlgItem(hDlg, IDC_LIST2), SW_SHOW);
UpdateWindow(hDlg);
return FALSE;
}
break;
}
case WM_CLOSE: {
EndDialog(hDlg, 0);
break;
}
}
return 0;
}
static int RomInfoDialog()
{
nRInBurnDrvActive = nBurnDrvActive; // clicking a button on this dialog somehow also clicks through to the list below it, thus changing nBurnDrvActive. Original value needed for rescan romset button. -dink
FBADialogBox(hAppInst, MAKEINTRESOURCE(IDD_ROMINFO), hSelDlg, (DLGPROC)RomInfoDialogProc);
SetFocus(hSelList);
return 1;
}
// -----------------------------------------------------------------------------
static HBITMAP hMVSpreview[6];