2012-12-19 09:30:18 +00:00
|
|
|
/****************************************************************************
|
|
|
|
* *
|
|
|
|
* Project 64 - A Nintendo 64 emulator. *
|
|
|
|
* http://www.pj64-emu.com/ *
|
|
|
|
* Copyright (C) 2012 Project64. All rights reserved. *
|
|
|
|
* *
|
|
|
|
* License: *
|
|
|
|
* GNU/GPLv2 http://www.gnu.org/licenses/gpl-2.0.html *
|
|
|
|
* *
|
|
|
|
****************************************************************************/
|
2010-06-07 02:23:58 +00:00
|
|
|
#include "stdafx.h"
|
2008-09-18 03:15:49 +00:00
|
|
|
|
2010-05-22 04:47:15 +00:00
|
|
|
RomInformation::RomInformation (const char * RomFile):
|
2008-09-18 03:15:49 +00:00
|
|
|
m_DeleteRomInfo(true),
|
|
|
|
m_FileName(RomFile? RomFile : ""),
|
|
|
|
m_pRomInfo(NULL)
|
|
|
|
{
|
|
|
|
if (m_FileName.length() == 0) { return; }
|
2010-05-22 04:47:15 +00:00
|
|
|
m_pRomInfo = new CN64Rom;
|
2008-09-18 03:15:49 +00:00
|
|
|
if (!m_pRomInfo->LoadN64Image(m_FileName.c_str())) {
|
|
|
|
delete m_pRomInfo;
|
|
|
|
m_pRomInfo = NULL;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-05-22 04:47:15 +00:00
|
|
|
RomInformation::RomInformation (CN64Rom * RomInfo) :
|
2008-09-18 03:15:49 +00:00
|
|
|
m_DeleteRomInfo(false),
|
|
|
|
m_FileName(RomInfo ? RomInfo->GetFileName().c_str() : ""),
|
|
|
|
m_pRomInfo(RomInfo)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
RomInformation::~RomInformation(void) {
|
|
|
|
if (m_DeleteRomInfo) {
|
|
|
|
delete m_pRomInfo;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#include <windows.h>
|
2015-01-27 05:07:44 +00:00
|
|
|
void RomInformation::DisplayInformation(HWND hParent) const {
|
2008-09-18 03:15:49 +00:00
|
|
|
if (m_FileName.length() == 0) { return; }
|
|
|
|
|
|
|
|
DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_Rom_Information),
|
|
|
|
(HWND)hParent, (DLGPROC)RomInfoProc, (DWORD)this);
|
|
|
|
}
|
|
|
|
|
2015-01-27 05:07:44 +00:00
|
|
|
DWORD CALLBACK RomInfoProc (HWND hDlg, DWORD uMsg, DWORD wParam, DWORD lParam) {
|
2008-09-18 03:15:49 +00:00
|
|
|
switch (uMsg) {
|
|
|
|
case WM_INITDIALOG:
|
|
|
|
{
|
|
|
|
//record class for future usage
|
2015-03-04 09:36:08 +00:00
|
|
|
SetProp(hDlg,"this",(RomInformation *)lParam);
|
2008-09-18 03:15:49 +00:00
|
|
|
RomInformation * _this = (RomInformation *)lParam;
|
|
|
|
|
2015-03-04 09:36:08 +00:00
|
|
|
SetWindowTextW(hDlg, GS(INFO_TITLE));
|
|
|
|
SetDlgItemTextW(hDlg, IDC_ROM_NAME, GS(INFO_ROM_NAME_TEXT));
|
|
|
|
SetDlgItemTextW(hDlg, IDC_FILE_NAME, GS(INFO_FILE_NAME_TEXT));
|
|
|
|
SetDlgItemTextW(hDlg, IDC_LOCATION, GS(INFO_LOCATION_TEXT));
|
|
|
|
SetDlgItemTextW(hDlg, IDC_ROM_MD5, GS(INFO_MD5_TEXT));
|
|
|
|
SetDlgItemTextW(hDlg, IDC_ROM_SIZE, GS(INFO_SIZE_TEXT));
|
|
|
|
SetDlgItemTextW(hDlg, IDC_CART_ID, GS(INFO_CART_ID_TEXT));
|
|
|
|
SetDlgItemTextW(hDlg, IDC_MANUFACTURER, GS(INFO_MANUFACTURER_TEXT));
|
|
|
|
SetDlgItemTextW(hDlg, IDC_COUNTRY, GS(INFO_COUNTRY_TEXT));
|
|
|
|
SetDlgItemTextW(hDlg, IDC_CRC1, GS(INFO_CRC1_TEXT));
|
|
|
|
SetDlgItemTextW(hDlg, IDC_CRC2, GS(INFO_CRC2_TEXT));
|
|
|
|
SetDlgItemTextW(hDlg, IDC_CIC_CHIP, GS(INFO_CIC_CHIP_TEXT));
|
2008-09-18 03:15:49 +00:00
|
|
|
|
2015-03-04 09:36:08 +00:00
|
|
|
SetDlgItemText(hDlg,IDC_INFO_ROMNAME,_this->m_pRomInfo->GetRomName().c_str());
|
2008-09-18 03:15:49 +00:00
|
|
|
|
|
|
|
char path[_MAX_PATH], drive[_MAX_DRIVE],dir[_MAX_DIR], fname[_MAX_FNAME],ext[_MAX_EXT];
|
|
|
|
_splitpath(_this->m_pRomInfo->GetFileName().c_str(), drive, dir, fname, ext);
|
|
|
|
_makepath(path, drive, dir, "", "");
|
|
|
|
|
2015-03-04 09:36:08 +00:00
|
|
|
SetDlgItemText(hDlg,IDC_INFO_FILENAME,fname);
|
|
|
|
SetDlgItemText(hDlg,IDC_INFO_LOCATION,path);
|
2008-09-18 03:15:49 +00:00
|
|
|
|
2015-03-04 09:36:08 +00:00
|
|
|
SetDlgItemText(hDlg,IDC_INFO_MD5,_this->m_pRomInfo->GetRomMD5().c_str());
|
2008-09-18 03:15:49 +00:00
|
|
|
|
|
|
|
char String[255] = " ";
|
|
|
|
sprintf(&String[1],"%.1f MBit",(float)_this->m_pRomInfo->GetRomSize()/0x20000);
|
2015-03-04 09:36:08 +00:00
|
|
|
SetDlgItemText(hDlg,IDC_INFO_ROMSIZE,String);
|
2008-09-18 03:15:49 +00:00
|
|
|
|
|
|
|
BYTE * RomHeader = _this->m_pRomInfo->GetRomAddress();
|
|
|
|
String[1] = RomHeader[0x3F];
|
|
|
|
String[2] = RomHeader[0x3E];
|
|
|
|
String[3] = '\0';
|
2015-03-04 09:36:08 +00:00
|
|
|
SetDlgItemText(hDlg,IDC_INFO_CARTID,String);
|
2008-09-18 03:15:49 +00:00
|
|
|
|
|
|
|
switch (RomHeader[0x38]) {
|
2015-03-04 09:36:08 +00:00
|
|
|
case 'N': SetDlgItemText(hDlg,IDC_INFO_MANUFACTURER," Nintendo"); break;
|
|
|
|
case 0: SetDlgItemText(hDlg,IDC_INFO_MANUFACTURER," None"); break;
|
|
|
|
default: SetDlgItemText(hDlg,IDC_INFO_MANUFACTURER," (Unknown)"); break;
|
2008-09-18 03:15:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
switch (RomHeader[0x3D]) {
|
2015-03-04 09:36:08 +00:00
|
|
|
case NTSC_BETA: SetDlgItemText(hDlg,IDC_INFO_COUNTRY," Beta"); break;
|
|
|
|
case X_NTSC: SetDlgItemText(hDlg,IDC_INFO_COUNTRY," NTSC"); break;
|
|
|
|
case Germany: SetDlgItemText(hDlg,IDC_INFO_COUNTRY," Germany"); break;
|
|
|
|
case USA: SetDlgItemText(hDlg,IDC_INFO_COUNTRY," America"); break;
|
|
|
|
case french: SetDlgItemText(hDlg,IDC_INFO_COUNTRY," France"); break;
|
|
|
|
case Italian: SetDlgItemText(hDlg,IDC_INFO_COUNTRY," Italy"); break;
|
|
|
|
case Japan: SetDlgItemText(hDlg,IDC_INFO_COUNTRY," Japan"); break;
|
|
|
|
case Europe: SetDlgItemText(hDlg,IDC_INFO_COUNTRY," Europe"); break;
|
|
|
|
case Spanish: SetDlgItemText(hDlg,IDC_INFO_COUNTRY," Spain"); break;
|
|
|
|
case Australia: SetDlgItemText(hDlg,IDC_INFO_COUNTRY," Australia"); break;
|
|
|
|
case X_PAL: SetDlgItemText(hDlg,IDC_INFO_COUNTRY," PAL"); break;
|
|
|
|
case Y_PAL: SetDlgItemText(hDlg,IDC_INFO_COUNTRY," PAL"); break;
|
|
|
|
case 0: SetDlgItemText(hDlg,IDC_INFO_COUNTRY," None"); break;
|
2008-09-18 03:15:49 +00:00
|
|
|
default:
|
|
|
|
sprintf(&String[1]," Unknown %c (%02X)",RomHeader[0x3D],RomHeader[0x3D]);
|
2015-03-04 09:36:08 +00:00
|
|
|
SetDlgItemText(hDlg,IDC_INFO_COUNTRY,String);
|
2008-09-18 03:15:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sprintf(&String[1],"0x%08X",*(DWORD *)(RomHeader + 0x10));
|
2015-03-04 09:36:08 +00:00
|
|
|
SetDlgItemText(hDlg,IDC_INFO_CRC1,String);
|
2008-09-18 03:15:49 +00:00
|
|
|
|
|
|
|
sprintf(&String[1],"0x%08X",*(DWORD *)(RomHeader + 0x14));
|
2015-03-04 09:36:08 +00:00
|
|
|
SetDlgItemText(hDlg,IDC_INFO_CRC2,String);
|
2008-09-18 03:15:49 +00:00
|
|
|
|
|
|
|
if (_this->m_pRomInfo->CicChipID() == CIC_UNKNOWN) {
|
|
|
|
sprintf(&String[1],"Unknown");
|
|
|
|
} else {
|
|
|
|
sprintf(&String[1],"CIC-NUS-610%d",_this->m_pRomInfo->CicChipID());
|
|
|
|
}
|
2015-03-04 09:36:08 +00:00
|
|
|
SetDlgItemText(hDlg,IDC_INFO_CIC,String);
|
2008-09-18 03:15:49 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case WM_COMMAND:
|
|
|
|
switch (LOWORD(wParam)) {
|
|
|
|
case IDCANCEL:
|
2015-03-04 09:36:08 +00:00
|
|
|
RemoveProp(hDlg,"this");
|
|
|
|
EndDialog(hDlg,0);
|
2008-09-18 03:15:49 +00:00
|
|
|
break;
|
|
|
|
case IDC_CLOSE_BUTTON:
|
2015-03-04 09:36:08 +00:00
|
|
|
RemoveProp(hDlg,"this");
|
|
|
|
EndDialog(hDlg,0);
|
2008-09-18 03:15:49 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
2015-01-31 19:27:27 +00:00
|
|
|
}
|