[Project64] Cleanup RomInformationClass.cpp
This commit is contained in:
parent
6ffd1663ca
commit
50df137466
|
@ -10,10 +10,10 @@
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
|
||||||
RomInformation::RomInformation (const char * RomFile):
|
RomInformation::RomInformation(const char * RomFile) :
|
||||||
m_DeleteRomInfo(true),
|
m_DeleteRomInfo(true),
|
||||||
m_FileName(RomFile? RomFile : ""),
|
m_FileName(RomFile ? RomFile : ""),
|
||||||
m_pRomInfo(NULL)
|
m_pRomInfo(NULL)
|
||||||
{
|
{
|
||||||
if (m_FileName.length() == 0) { return; }
|
if (m_FileName.length() == 0) { return; }
|
||||||
m_pRomInfo = new CN64Rom;
|
m_pRomInfo = new CN64Rom;
|
||||||
|
@ -24,10 +24,10 @@ RomInformation::RomInformation (const char * RomFile):
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RomInformation::RomInformation (CN64Rom * RomInfo) :
|
RomInformation::RomInformation(CN64Rom * RomInfo) :
|
||||||
m_DeleteRomInfo(false),
|
m_DeleteRomInfo(false),
|
||||||
m_FileName(RomInfo ? RomInfo->GetFileName().c_str() : ""),
|
m_FileName(RomInfo ? RomInfo->GetFileName().c_str() : ""),
|
||||||
m_pRomInfo(RomInfo)
|
m_pRomInfo(RomInfo)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,16 +45,16 @@ void RomInformation::DisplayInformation(HWND hParent) const {
|
||||||
(HWND)hParent, (DLGPROC)RomInfoProc, (DWORD)this);
|
(HWND)hParent, (DLGPROC)RomInfoProc, (DWORD)this);
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD CALLBACK RomInfoProc (HWND hDlg, DWORD uMsg, DWORD wParam, DWORD lParam) {
|
DWORD CALLBACK RomInfoProc(HWND hDlg, DWORD uMsg, DWORD wParam, DWORD lParam) {
|
||||||
switch (uMsg) {
|
switch (uMsg) {
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
{
|
{
|
||||||
//record class for future usage
|
//record class for future usage
|
||||||
SetProp(hDlg,"this",(RomInformation *)lParam);
|
SetProp(hDlg, "this", (RomInformation *)lParam);
|
||||||
RomInformation * _this = (RomInformation *)lParam;
|
RomInformation * _this = (RomInformation *)lParam;
|
||||||
|
|
||||||
LONG_PTR originalWndProc = GetWindowLongPtrW(hDlg, GWLP_WNDPROC);
|
LONG_PTR originalWndProc = GetWindowLongPtrW(hDlg, GWLP_WNDPROC);
|
||||||
SetWindowLongPtrW(hDlg, GWLP_WNDPROC, (LONG_PTR) DefWindowProcW);
|
SetWindowLongPtrW(hDlg, GWLP_WNDPROC, (LONG_PTR)DefWindowProcW);
|
||||||
SetWindowTextW(hDlg, GS(INFO_TITLE));
|
SetWindowTextW(hDlg, GS(INFO_TITLE));
|
||||||
SetWindowLongPtrW(hDlg, GWLP_WNDPROC, originalWndProc);
|
SetWindowLongPtrW(hDlg, GWLP_WNDPROC, originalWndProc);
|
||||||
|
|
||||||
|
@ -73,58 +73,58 @@ DWORD CALLBACK RomInfoProc (HWND hDlg, DWORD uMsg, DWORD wParam, DWORD lParam) {
|
||||||
|
|
||||||
SetDlgItemTextW(hDlg, IDC_INFO_ROMNAME, _this->m_pRomInfo->GetRomName().ToUTF16(stdstr::CODEPAGE_932).c_str());
|
SetDlgItemTextW(hDlg, IDC_INFO_ROMNAME, _this->m_pRomInfo->GetRomName().ToUTF16(stdstr::CODEPAGE_932).c_str());
|
||||||
|
|
||||||
char path[_MAX_PATH], drive[_MAX_DRIVE],dir[_MAX_DIR], fname[_MAX_FNAME],ext[_MAX_EXT];
|
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);
|
_splitpath(_this->m_pRomInfo->GetFileName().c_str(), drive, dir, fname, ext);
|
||||||
_makepath(path, drive, dir, "", "");
|
_makepath(path, drive, dir, "", "");
|
||||||
|
|
||||||
SetDlgItemText(hDlg, IDC_INFO_FILENAME, stdstr_f("%s%s", fname, ext).c_str());
|
SetDlgItemText(hDlg, IDC_INFO_FILENAME, stdstr_f("%s%s", fname, ext).c_str());
|
||||||
SetDlgItemText(hDlg, IDC_INFO_LOCATION, path);
|
SetDlgItemText(hDlg, IDC_INFO_LOCATION, path);
|
||||||
|
|
||||||
SetDlgItemText(hDlg,IDC_INFO_MD5,_this->m_pRomInfo->GetRomMD5().c_str());
|
SetDlgItemText(hDlg, IDC_INFO_MD5, _this->m_pRomInfo->GetRomMD5().c_str());
|
||||||
|
|
||||||
char String[255] = " ";
|
char String[255] = " ";
|
||||||
sprintf(&String[1],"%.1f MBit",(float)_this->m_pRomInfo->GetRomSize()/0x20000);
|
sprintf(&String[1], "%.1f MBit", (float)_this->m_pRomInfo->GetRomSize() / 0x20000);
|
||||||
SetDlgItemText(hDlg,IDC_INFO_ROMSIZE,String);
|
SetDlgItemText(hDlg, IDC_INFO_ROMSIZE, String);
|
||||||
|
|
||||||
BYTE * RomHeader = _this->m_pRomInfo->GetRomAddress();
|
BYTE * RomHeader = _this->m_pRomInfo->GetRomAddress();
|
||||||
String[1] = RomHeader[0x3F];
|
String[1] = RomHeader[0x3F];
|
||||||
String[2] = RomHeader[0x3E];
|
String[2] = RomHeader[0x3E];
|
||||||
String[3] = '\0';
|
String[3] = '\0';
|
||||||
SetDlgItemText(hDlg,IDC_INFO_CARTID,String);
|
SetDlgItemText(hDlg, IDC_INFO_CARTID, String);
|
||||||
|
|
||||||
switch (RomHeader[0x38]) {
|
switch (RomHeader[0x38]) {
|
||||||
case 'N': SetDlgItemText(hDlg,IDC_INFO_MANUFACTURER," Nintendo"); break;
|
case 'N': SetDlgItemText(hDlg, IDC_INFO_MANUFACTURER, " Nintendo"); break;
|
||||||
case 0: SetDlgItemText(hDlg,IDC_INFO_MANUFACTURER," None"); break;
|
case 0: SetDlgItemText(hDlg, IDC_INFO_MANUFACTURER, " None"); break;
|
||||||
default: SetDlgItemText(hDlg,IDC_INFO_MANUFACTURER," (Unknown)"); break;
|
default: SetDlgItemText(hDlg, IDC_INFO_MANUFACTURER, " (Unknown)"); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (RomHeader[0x3D]) {
|
switch (RomHeader[0x3D]) {
|
||||||
case NTSC_BETA: SetDlgItemText(hDlg,IDC_INFO_COUNTRY," Beta"); break;
|
case NTSC_BETA: SetDlgItemText(hDlg, IDC_INFO_COUNTRY, " Beta"); break;
|
||||||
case X_NTSC: SetDlgItemText(hDlg,IDC_INFO_COUNTRY," NTSC"); break;
|
case X_NTSC: SetDlgItemText(hDlg, IDC_INFO_COUNTRY, " NTSC"); break;
|
||||||
case Germany: SetDlgItemText(hDlg,IDC_INFO_COUNTRY," Germany"); break;
|
case Germany: SetDlgItemText(hDlg, IDC_INFO_COUNTRY, " Germany"); break;
|
||||||
case USA: SetDlgItemText(hDlg,IDC_INFO_COUNTRY," America"); break;
|
case USA: SetDlgItemText(hDlg, IDC_INFO_COUNTRY, " America"); break;
|
||||||
case french: SetDlgItemText(hDlg,IDC_INFO_COUNTRY," France"); break;
|
case french: SetDlgItemText(hDlg, IDC_INFO_COUNTRY, " France"); break;
|
||||||
case Italian: SetDlgItemText(hDlg,IDC_INFO_COUNTRY," Italy"); break;
|
case Italian: SetDlgItemText(hDlg, IDC_INFO_COUNTRY, " Italy"); break;
|
||||||
case Japan: SetDlgItemText(hDlg,IDC_INFO_COUNTRY," Japan"); break;
|
case Japan: SetDlgItemText(hDlg, IDC_INFO_COUNTRY, " Japan"); break;
|
||||||
case Europe: SetDlgItemText(hDlg,IDC_INFO_COUNTRY," Europe"); break;
|
case Europe: SetDlgItemText(hDlg, IDC_INFO_COUNTRY, " Europe"); break;
|
||||||
case Spanish: SetDlgItemText(hDlg,IDC_INFO_COUNTRY," Spain"); break;
|
case Spanish: SetDlgItemText(hDlg, IDC_INFO_COUNTRY, " Spain"); break;
|
||||||
case Australia: SetDlgItemText(hDlg,IDC_INFO_COUNTRY," Australia"); break;
|
case Australia: SetDlgItemText(hDlg, IDC_INFO_COUNTRY, " Australia"); break;
|
||||||
case X_PAL: SetDlgItemText(hDlg,IDC_INFO_COUNTRY," PAL"); break;
|
case X_PAL: SetDlgItemText(hDlg, IDC_INFO_COUNTRY, " PAL"); break;
|
||||||
case Y_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;
|
case 0: SetDlgItemText(hDlg, IDC_INFO_COUNTRY, " None"); break;
|
||||||
default:
|
default:
|
||||||
sprintf(&String[1]," Unknown %c (%02X)",RomHeader[0x3D],RomHeader[0x3D]);
|
sprintf(&String[1], " Unknown %c (%02X)", RomHeader[0x3D], RomHeader[0x3D]);
|
||||||
SetDlgItemText(hDlg,IDC_INFO_COUNTRY,String);
|
SetDlgItemText(hDlg, IDC_INFO_COUNTRY, String);
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(&String[1],"0x%08X",*(DWORD *)(RomHeader + 0x10));
|
sprintf(&String[1], "0x%08X", *(DWORD *)(RomHeader + 0x10));
|
||||||
SetDlgItemText(hDlg,IDC_INFO_CRC1,String);
|
SetDlgItemText(hDlg, IDC_INFO_CRC1, String);
|
||||||
|
|
||||||
sprintf(&String[1],"0x%08X",*(DWORD *)(RomHeader + 0x14));
|
sprintf(&String[1], "0x%08X", *(DWORD *)(RomHeader + 0x14));
|
||||||
SetDlgItemText(hDlg,IDC_INFO_CRC2,String);
|
SetDlgItemText(hDlg, IDC_INFO_CRC2, String);
|
||||||
|
|
||||||
if (_this->m_pRomInfo->CicChipID() == CIC_UNKNOWN) {
|
if (_this->m_pRomInfo->CicChipID() == CIC_UNKNOWN) {
|
||||||
sprintf(&String[1],"Unknown");
|
sprintf(&String[1], "Unknown");
|
||||||
}
|
}
|
||||||
else if (_this->m_pRomInfo->CicChipID() == CIC_NUS_8303) {
|
else if (_this->m_pRomInfo->CicChipID() == CIC_NUS_8303) {
|
||||||
sprintf(&String[1], "CIC-NUS-8303");
|
sprintf(&String[1], "CIC-NUS-8303");
|
||||||
|
@ -133,22 +133,20 @@ DWORD CALLBACK RomInfoProc (HWND hDlg, DWORD uMsg, DWORD wParam, DWORD lParam) {
|
||||||
sprintf(&String[1], "CIC-NUS-5167");
|
sprintf(&String[1], "CIC-NUS-5167");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sprintf(&String[1],"CIC-NUS-610%d",_this->m_pRomInfo->CicChipID());
|
sprintf(&String[1], "CIC-NUS-610%d", _this->m_pRomInfo->CicChipID());
|
||||||
}
|
}
|
||||||
SetDlgItemText(hDlg,IDC_INFO_CIC,String);
|
SetDlgItemText(hDlg, IDC_INFO_CIC, String);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
switch (LOWORD(wParam)) {
|
switch (LOWORD(wParam)) {
|
||||||
case IDCANCEL:
|
case IDCANCEL:
|
||||||
RemoveProp(hDlg,"this");
|
RemoveProp(hDlg, "this");
|
||||||
EndDialog(hDlg,0);
|
EndDialog(hDlg, 0);
|
||||||
break;
|
break;
|
||||||
case IDC_CLOSE_BUTTON:
|
case IDC_CLOSE_BUTTON:
|
||||||
RemoveProp(hDlg,"this");
|
RemoveProp(hDlg, "this");
|
||||||
EndDialog(hDlg,0);
|
EndDialog(hDlg, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -16,7 +16,7 @@ class RomInformation
|
||||||
stdstr const m_FileName;
|
stdstr const m_FileName;
|
||||||
CN64Rom * m_pRomInfo;
|
CN64Rom * m_pRomInfo;
|
||||||
|
|
||||||
friend DWORD CALLBACK RomInfoProc ( HWND, DWORD, DWORD, DWORD );
|
friend DWORD CALLBACK RomInfoProc(HWND, DWORD, DWORD, DWORD);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RomInformation(const char* RomFile);
|
RomInformation(const char* RomFile);
|
||||||
|
|
Loading…
Reference in New Issue