Merge pull request #1641 from LuigiBlood/ddrevamp

[64DD] Updated 64DD emulation
This commit is contained in:
zilmar 2019-08-21 07:08:37 +09:30 committed by GitHub
commit b57250427b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 1171 additions and 679 deletions

View File

@ -1849,7 +1849,6 @@ Clear Frame=2
[4D3E622E-9B828B4E-C:4A]
Good Name=F-ZERO X (J)
Internal Name=F-ZERO X
RDRAM Size=8
Fixed Audio=0
Status=Compatible
Plugin Note=[Glide64] missing menu effects
@ -5892,7 +5891,6 @@ SMM-PI DMA=0
SMM-Protect=1
SMM-TLB=0
Self Texture=1
RDRAM Size=8
[D43DA81F-021E1E19-C:45]
Good Name=The Legend of Zelda - Ocarina of Time (U) (V1.1)
@ -5909,7 +5907,6 @@ SMM-PI DMA=0
SMM-Protect=1
SMM-TLB=0
Self Texture=1
RDRAM Size=8
[693BA2AE-B7F14E9F-C:45]
Good Name=The Legend of Zelda - Ocarina of Time (U) (V1.2)
@ -5926,7 +5923,6 @@ SMM-PI DMA=0
SMM-Protect=1
SMM-TLB=0
Self Texture=1
RDRAM Size=8
[1D4136F3-AF63EEA9-C:50]
Good Name=The Legend of Zelda - Ocarina of Time - Master Quest (E) (GC)
@ -7063,7 +7059,6 @@ SMM-PI DMA=0
SMM-Protect=1
SMM-TLB=0
Self Texture=1
RDRAM Size=8
[D43DA81F-021E1E19-C:4A]
Good Name=Zelda no Densetsu - Toki no Ocarina (J) (V1.1)
@ -7077,7 +7072,6 @@ SMM-PI DMA=0
SMM-Protect=1
SMM-TLB=0
Self Texture=1
RDRAM Size=8
[693BA2AE-B7F14E9F-C:4A]
Good Name=Zelda no Densetsu - Toki no Ocarina (J) (V1.2)
@ -7091,7 +7085,6 @@ SMM-PI DMA=0
SMM-Protect=1
SMM-TLB=0
Self Texture=1
RDRAM Size=8
[F7F52DB8-2195E636-C:4A]
Good Name=Zelda no Densetsu - Toki no Ocarina - Zelda Collection Version (J) (GC)
@ -7141,21 +7134,28 @@ Status=Compatible
//
// ROMs below are 64DD content
[00000000-00000000-C:4A]
[E1F9D977-33E17503-C:4A]
32bit=No
Fixed Audio=0
Good Name=64DD IPL (JPN)
RDRAM Size=8
Status=Compatible
[00000000-00000000-C:45]
[A91EAC78-1A22D1D7-C:45]
32bit=No
Fixed Audio=0
Good Name=64DD IPL (USA)
RDRAM Size=8
Status=Compatible
[E848D316-444D504A-C:4A]
[968BFE04-014A96F5-C:4A]
32bit=No
Fixed Audio=0
Good Name=64DD TOOL IPL (JPN)
RDRAM Size=8
Status=Compatible
[D06F15D7-2F90EA28-C:4A]
32bit=No
Core Note=Cannot use Capture Pak functionality.
Fixed Audio=0
@ -7163,7 +7163,7 @@ Good Name=Mario Artist Paint Studio (J)
RDRAM Size=8
Status=Compatible
[E848D316-444D544A-C:4A]
[56A227D6-A95DD829-C:4A]
32bit=No
Core Note=Cannot use Capture Pak functionality.
Fixed Audio=0
@ -7171,7 +7171,7 @@ Good Name=Mario Artist Talent Studio (J)
RDRAM Size=8
Status=Compatible
[E848D316-444D424A-C:4A]
[30B9A412-CF465BED-C:4A]
32bit=No
Core Note=Cannot use Randnet & Capture Pak functionality.
Fixed Audio=0
@ -7179,7 +7179,7 @@ Good Name=Mario Artist Communication Kit (J)
RDRAM Size=8
Status=Compatible
[E848D316-444D474A-C:4A]
[2E91FFC8-D16E0037-C:4A]
32bit=No
Fixed Audio=0
Good Name=Mario Artist Polygon Studio (J)
@ -7187,7 +7187,7 @@ Plugin Note=[Video] Cannot model on HLE plugins.
RDRAM Size=8
Status=Issues (plugin)
[E848D316-4453434A-C:4A]
[7BD92DC6-8426D239-C:4A]
32bit=No
Fixed Audio=1
Good Name=Sim City 64 (J)
@ -7196,7 +7196,7 @@ Plugin Note=[Video] Very slow, city is not rendering properly in HLE
RDRAM Size=8
Status=Issues (plugin)
[E848D316-4450474A-C:4A]
[905063EB-6FAF9C14-C:4A]
32bit=No
Fixed Audio=0
Good Name=Nihon Pro Golf Tour 64 (J)
@ -7204,29 +7204,37 @@ Counter Factor=1
RDRAM Size=8
Status=Compatible
[E848D316-444B444A-C:4A]
[A11940D1-5EE6BF2E-C:4A]
32bit=No
Fixed Audio=0
Good Name=Kyojin no Doshin 1 (J)
RDRAM Size=8
Status=Compatible
[E848D316-444B494A-C:4A]
[A1193471-5EE6CB8E-C:4A]
32bit=No
Fixed Audio=0
Good Name=Kyojin no Doshin 1 (J) (Store Demo)
RDRAM Size=8
Status=Compatible
[E848D316-4452444A-C:4A]
[8EFB4B2D-7104B4D2-C:4A]
32bit=No
Core Note=Modem Pak is required
Fixed Audio=0
Good Name=Randnet Disk (J)
Good Name=Randnet Disk (J) [Rev. 00]
RDRAM Size=8
Status=Only intro/part OK
[E848D316-444B4B4A-C:4A]
[8EFC7632-710389CD-C:4A]
32bit=No
Core Note=Modem Pak is required
Fixed Audio=0
Good Name=Randnet Disk (J) [Rev. 01]
RDRAM Size=8
Status=Only intro/part OK
[B75CBC4E-48A343B1-C:4A]
32bit=No
Core Note=Expansion Disk for Kyojin no Doshin 1. Use the Disk Swap feature to play.
Fixed Audio=0
@ -7234,21 +7242,28 @@ Good Name=Kyojin no Doshin - Kaihou Sensen Chibikkochikko Dai Shuugou (J)
RDRAM Size=8
Status=Compatible
[E848D316-45465A4A-C:4A]
[CD999CC9-32666336-C:4A]
32bit=No
Core Note=Expansion Disk for F-Zero X. Play F-Zero X (J) with this disk loaded.
Fixed Audio=0
Good Name=F-ZERO X Expansion Kit (J)
RDRAM Size=8
Status=Compatible
Culling=1
[E848D316-7AB0252F-C:0]
[41252DA2-BEDAD25D-C:0]
32bit=No
Fixed Audio=0
Good Name=Super Mario 64 Disk Version (J) (Spaceworld 1996 Demo)
RDRAM Size=8
Status=Compatible
[87FAF438-78050BC7-C:41]
Good Name=Dezaemon 3D Expansion Disk (J) (Proto)
RDRAM Size=8
Status=Compatible
Save Type=Sram
//================ PD ================
//

View File

@ -202,6 +202,7 @@
#410# "Status"
#411# "Recompiler"
#412# "Defaults"
#413# "64DD"
//Plugin Dialog
#420# "About"
@ -238,7 +239,10 @@
#466# "Speed display:"
#467# "Check if Project64 is already running"
#468# "Unique Game Save Directory"
#469# "64DD IPL ROM Path:"
#469# "Japanese Retail 64DD IPL ROM Path:"
#470# "American Retail 64DD IPL ROM Path:"
#471# "Development 64DD IPL ROM Path:"
#472# "Disk Save Type:"
//ROM Browser Tab
#480# "Max # of ROMs remembered (0-10):"
@ -366,6 +370,10 @@
#722# "Apply"
#723# "Close"
//Disk Save Type
#730# "Full Disk Copy"
#731# "Save Area Only"
/*********************************************************************************
* ROM Information *
*********************************************************************************/
@ -520,7 +528,9 @@
#2056# "Audio High-Level Emulation"
#2057# "Audio HLE requires a third-party plugin!!!\nIf you do not use a third-party audio plugin that supports HLE, you will hear no sound.\n\nChange to audio HLE?"
#2058# "File loaded does not appear to be a valid 64DD IPL ROM.\n\nVerify your ROMs with GoodN64."
#2059# "Nintendo 64DD IPL ROM not found.\nIt is required to play 64DD disks.\n\nPlease select the required ROM."
#2059# "Nintendo 64DD Japanese Retail IPL ROM not found.\nIt is required to play japanese region 64DD disk images.\n\nPlease select the required ROM in the Settings."
#2061# "Nintendo 64DD American Retail IPL ROM not found.\nIt is required to play american region 64DD disk images.\n\nPlease select the required ROM in the Settings."
#2062# "Nintendo 64DD Development IPL ROM not found.\nIt is required to play development 64DD disk images.\n\nPlease select the required ROM in the Settings."
/*********************************************************************************

View File

@ -201,6 +201,8 @@
#409# "Raccourcis clavier"
#410# "Statut"
#411# "Recompilateur"
#412# "Par Défaut"
#413# "64DD"
//Plugin Dialog
#420# "À propos"
@ -237,7 +239,10 @@
#466# "Vitesse affichée :"
#467# "Vérifier si Project64 est déjà lancé"
#468# "Répertoire de sauvegarde unique"
#469# "Chemin vers 64DD IPL ROM:"
#469# "Chemin vers 64DD IPL ROM Japonais:"
#470# "Chemin vers 64DD IPL ROM Américain:"
#471# "Chemin vers 64DD IPL ROM Développement:"
#472# "Type de sauvegarde:"
//ROM Browser Tab
#480# "Max de ROM à retenir (0-10) :"
@ -365,6 +370,10 @@
#722# "Appliquer"
#723# "Fermer"
//Disk Save Type
#730# "Copie Complète du Disque"
#731# "Zone Sauvegarde Uniquement"
/*********************************************************************************
* ROM Information *
*********************************************************************************/
@ -519,7 +528,9 @@
#2056# "Émulation audio haut niveau (HLE)"
#2057# "Laudio HLE nécessite un plugin tiers !!!\nSi vous nutilisez pas un plugin audio tiers qui supporte le HLE, vous nentendrez aucun son.\n\nChanger pour laudio en mode HLE ?"
#2058# "Le fichier chargé ne semble pas être une ROM IPL 64DD valide.\n\nVérifiez vos ROM avec GoodN64."
#2059# "La ROM IPL 64DD na pas pu être trouvée.\nIl est nécéssaire pour jouer avec des disques 64DD.\n\nVeuillez sélectionner la ROM demandée."
#2059# "La ROM IPL 64DD Japonaise na pas pu être trouvée.\nIl est nécéssaire pour jouer avec des disques 64DD japonais.\n\nVeuillez sélectionner la ROM requise dans les paramètres."
#2061# "La ROM IPL 64DD Américaine na pas pu être trouvée.\nIl est nécéssaire pour jouer avec des disques 64DD américain.\n\nVeuillez sélectionner la ROM requise dans les paramètres."
#2062# "La ROM IPL 64DD Développement na pas pu être trouvée.\nIl est nécéssaire pour jouer avec des disques 64DD de développement.\n\nVeuillez sélectionner la ROM requise dans les paramètres."
/*********************************************************************************

View File

@ -234,6 +234,7 @@ enum LanguageStringID
TAB_ROMSTATUS = 410,
TAB_RECOMPILER = 411,
TAB_DEFAULTS = 412,
TAB_DISKDRIVE = 413,
//Plugin Dialog
PLUG_ABOUT = 420,
@ -270,7 +271,11 @@ enum LanguageStringID
OPTION_CHANGE_FR = 466,
OPTION_CHECK_RUNNING = 467,
OPTION_UNIQUE_SAVE_DIR = 468,
OPTION_IPL_ROM_PATH = 469,
OPTION_IPL_ROM_USA_PATH = 470,
OPTION_IPL_ROM_TOOL_PATH = 471,
OPTION_DISKSAVETYPE = 472,
//Rom Browser Tab
RB_MAX_ROMS = 480,
@ -402,6 +407,10 @@ enum LanguageStringID
BOTTOM_RESET_ALL = 721,
BOTTOM_APPLY = 722,
BOTTOM_CLOSE = 723,
//Disk Save Type
DISKSAVE_SHADOW = 730,
DISKSAVE_RAM = 731,
/*********************************************************************************
* ROM Information *
@ -559,6 +568,8 @@ enum LanguageStringID
MSG_FAIL_IMAGE_IPL = 2058,
MSG_IPL_REQUIRED = 2059,
MSG_MSGBOX_WARNING_TITLE = 2060,
MSG_USA_IPL_REQUIRED = 2061,
MSG_TOOL_IPL_REQUIRED = 2062,
/*********************************************************************************
* Android *

View File

@ -201,6 +201,7 @@ void CLanguage::LoadDefaultStrings(void)
DEF_STR(TAB_ROMSTATUS, "Status");
DEF_STR(TAB_RECOMPILER, "Recompiler");
DEF_STR(TAB_DEFAULTS, "Defaults");
DEF_STR(TAB_DISKDRIVE, "64DD");
//Plugin Dialog
DEF_STR(PLUG_ABOUT, "About");
@ -237,7 +238,10 @@ void CLanguage::LoadDefaultStrings(void)
DEF_STR(OPTION_CHECK_RUNNING, "Check if Project64 is already running");
DEF_STR(OPTION_UNIQUE_SAVE_DIR, "Unique Game Save Directory");
DEF_STR(OPTION_CHANGE_FR, "Speed display:");
DEF_STR(OPTION_IPL_ROM_PATH, "64DD IPL ROM Path:");
DEF_STR(OPTION_IPL_ROM_PATH, "Japanese Retail 64DD IPL ROM Path:");
DEF_STR(OPTION_IPL_ROM_USA_PATH, "American Retail 64DD IPL ROM Path:");
DEF_STR(OPTION_IPL_ROM_TOOL_PATH, "Development 64DD IPL ROM Path:");
DEF_STR(OPTION_DISKSAVETYPE, "Disk Save Type:");
//ROM Browser Tab
DEF_STR(RB_MAX_ROMS, "Max # of ROMs remembered (0-10):");
@ -369,6 +373,10 @@ void CLanguage::LoadDefaultStrings(void)
DEF_STR(BOTTOM_APPLY, "Apply");
DEF_STR(BOTTOM_CLOSE, "Close");
//Disk Save Type
DEF_STR(DISKSAVE_SHADOW, "Full Disk Copy");
DEF_STR(DISKSAVE_RAM, "Save Area Only");
/*********************************************************************************
* ROM Information *
*********************************************************************************/
@ -524,7 +532,9 @@ void CLanguage::LoadDefaultStrings(void)
DEF_STR(MSG_SET_HLE_AUD_TITLE, "Audio High-Level Emulation");
DEF_STR(MSG_SET_HLE_AUD_MSG, "Audio HLE requires a third-party plugin!!!\nIf you do not use a third-party audio plugin that supports HLE, you will hear no sound.\n\nChange to audio HLE?");
DEF_STR(MSG_FAIL_IMAGE_IPL, "File loaded does not appear to be a valid 64DD IPL ROM.\n\nVerify your ROMs with GoodN64.");
DEF_STR(MSG_IPL_REQUIRED, "Nintendo 64DD IPL ROM not found.\nIt is required to play 64DD disks.\n\nPlease select the required ROM.");
DEF_STR(MSG_IPL_REQUIRED, "Nintendo 64DD Japanese Retail IPL ROM not found.\nIt is required to play japanese region 64DD disk images.\n\nPlease select the required ROM in the Settings.");
DEF_STR(MSG_USA_IPL_REQUIRED, "Nintendo 64DD American Retail IPL ROM not found.\nIt is required to play american region 64DD disk images.\n\nPlease select the required ROM in the Settings.");
DEF_STR(MSG_TOOL_IPL_REQUIRED, "Nintendo 64DD Development IPL ROM not found.\nIt is required to play development 64DD disk images.\n\nPlease select the required ROM in the Settings.");
/*********************************************************************************
* Android *

View File

@ -33,7 +33,7 @@ void DiskCommand()
{
//ASIC_CMD_STATUS - Commands
uint32_t cmd = g_Reg->ASIC_CMD;
WriteTrace(TraceN64System, TraceDebug, "DD CMD %08X", cmd);
WriteTrace(TraceN64System, TraceDebug, "DD CMD %08X - DATA %08X", cmd, g_Reg->ASIC_DATA);
#ifdef _WIN32
SYSTEMTIME sysTime;
@ -67,13 +67,11 @@ void DiskCommand()
case 0x00010000:
//Seek Read
g_Reg->ASIC_CUR_TK = g_Reg->ASIC_DATA | 0x60000000;
DiskSetOffset();
dd_write = false;
break;
case 0x00020000:
//Seek Write
g_Reg->ASIC_CUR_TK = g_Reg->ASIC_DATA | 0x60000000;
DiskSetOffset();
dd_write = true;
break;
case 0x00080000:
@ -192,9 +190,9 @@ void DiskBMUpdate()
//Write Data
if (dd_current < SECTORS_PER_BLOCK)
{
DiskBMWrite();
if (!DiskBMReadWrite(true))
g_Reg->ASIC_STATUS |= DD_STATUS_DATA_RQ;
dd_current += 1;
g_Reg->ASIC_STATUS |= DD_STATUS_DATA_RQ;
}
else if (dd_current < SECTORS_PER_BLOCK + 1)
{
@ -202,10 +200,10 @@ void DiskBMUpdate()
{
dd_start_block = 1 - dd_start_block;
dd_current = 0;
DiskBMWrite();
if (!DiskBMReadWrite(true))
g_Reg->ASIC_STATUS |= DD_STATUS_DATA_RQ;
dd_current += 1;
g_Reg->ASIC_BM_STATUS &= ~DD_BM_STATUS_BLOCK;
g_Reg->ASIC_STATUS |= DD_STATUS_DATA_RQ;
}
else
{
@ -222,16 +220,17 @@ void DiskBMUpdate()
else
{
//Read Data
if (((g_Reg->ASIC_CUR_TK >> 16) & 0x1FFF) == 6 && g_Reg->ASIC_CUR_SECTOR == 0)
if (((g_Reg->ASIC_CUR_TK >> 16) & 0x1FFF) == 6 && g_Reg->ASIC_CUR_SECTOR == 0 && g_Disk->GetCountry() != Country::UnknownCountry)
{
//Copy Protection
g_Reg->ASIC_STATUS &= ~DD_STATUS_DATA_RQ;
g_Reg->ASIC_BM_STATUS |= DD_BM_STATUS_MICRO;
}
else if (dd_current < SECTORS_PER_BLOCK)
{
DiskBMRead();
if (!DiskBMReadWrite(false))
g_Reg->ASIC_STATUS |= DD_STATUS_DATA_RQ;
dd_current += 1;
g_Reg->ASIC_STATUS |= DD_STATUS_DATA_RQ;
}
else if (dd_current < SECTORS_PER_BLOCK + 4)
{
@ -260,76 +259,27 @@ void DiskBMUpdate()
}
}
void DiskBMRead()
bool DiskBMReadWrite(bool write)
{
uint32_t sector = 0;
sector += dd_track_offset;
sector += dd_start_block * SECTORS_PER_BLOCK * ddZoneSecSize[dd_zone];
sector += (dd_current) * (((g_Reg->ASIC_HOST_SECBYTE & 0x00FF0000) >> 16) + 1);
//WriteTrace(TraceN64System, TraceDebug, "READ Block %d Sector %02X - %08X", ((g_Reg->ASIC_CUR_TK & 0x0FFF0000) >> 15) | dd_start_block, dd_current, sector);
g_Disk->SetDiskAddressBuffer(sector);
return;
}
void DiskBMWrite()
{
uint32_t sector = 0;
sector += dd_track_offset;
sector += dd_start_block * SECTORS_PER_BLOCK * ddZoneSecSize[dd_zone];
sector += (dd_current) * (((g_Reg->ASIC_HOST_SECBYTE & 0x00FF0000) >> 16) + 1);
//WriteTrace(TraceN64System, TraceDebug, "WRITE Block %d Sector %02X - %08X", ((g_Reg->ASIC_CUR_TK & 0x0FFF0000) >> 15) | dd_start_block, dd_current, sector);
g_Disk->SetDiskAddressBuffer(sector);
return;
}
void DiskSetOffset()
{
uint16_t head = ((g_Reg->ASIC_CUR_TK >> 16) & 0x1000) >> 9; // Head * 8
//Returns true if error
uint16_t head = ((g_Reg->ASIC_CUR_TK >> 16) / 0x1000) & 1;
uint16_t track = (g_Reg->ASIC_CUR_TK >> 16) & 0xFFF;
uint16_t tr_off = 0;
uint16_t block = dd_start_block;
uint16_t sector = dd_current;
uint16_t sectorsize = (((g_Reg->ASIC_HOST_SECBYTE & 0x00FF0000) >> 16) + 1);
uint32_t addr = g_Disk->GetDiskAddressBlock(head, track, block, sector, sectorsize);
if (track >= 0x425)
if (addr == 0xFFFFFFFF)
{
dd_zone = 7 + head;
tr_off = track - 0x425;
}
else if (track >= 0x390)
{
dd_zone = 6 + head;
tr_off = track - 0x390;
}
else if (track >= 0x2FB)
{
dd_zone = 5 + head;
tr_off = track - 0x2FB;
}
else if (track >= 0x266)
{
dd_zone = 4 + head;
tr_off = track - 0x266;
}
else if (track >= 0x1D1)
{
dd_zone = 3 + head;
tr_off = track - 0x1D1;
}
else if (track >= 0x13C)
{
dd_zone = 2 + head;
tr_off = track - 0x13C;
}
else if (track >= 0x9E)
{
dd_zone = 1 + head;
tr_off = track - 0x9E;
//Error
return true;
}
else
{
dd_zone = 0 + head;
tr_off = track;
g_Disk->SetDiskAddressBuffer(addr);
return false;
}
dd_track_offset = ddStartOffset[dd_zone] + tr_off * ddZoneSecSize[dd_zone] * SECTORS_PER_BLOCK * BLOCKS_PER_TRACK;
}
void DiskDMACheck(void)

View File

@ -18,9 +18,7 @@ void DiskReset(void);
void DiskBMControl(void);
void DiskGapSectorCheck(void);
void DiskBMUpdate(void);
void DiskBMRead(void);
void DiskBMWrite(void);
void DiskSetOffset(void);
bool DiskBMReadWrite(bool write);
void DiskDMACheck(void);
extern bool dd_write;

View File

@ -38,6 +38,7 @@ void CDMA::OnFirstDMA()
case CIC_NUS_5167: offset = +0x0318; break;
case CIC_NUS_8303: offset = +0x0318; break;
case CIC_NUS_DDUS: offset = +0x0318; break;
case CIC_NUS_DDTL: offset = +0x0318; break;
case CIC_UNKNOWN:
case CIC_NUS_6102: offset = +0x0318; break;
case CIC_NUS_6103: offset = +0x0318; break;

View File

@ -336,12 +336,17 @@ bool CN64System::LoadFileImage(const char * FileLoc)
g_DDRom = new CN64Rom();
}
g_DDRom->LoadN64ImageIPL(FileLoc);
g_Settings->SaveString(File_DiskIPLPath, FileLoc);
if (g_DDRom->CicChipID() == CIC_NUS_8303)
g_Settings->SaveString(File_DiskIPLPath, FileLoc);
else if (g_DDRom->CicChipID() == CIC_NUS_DDUS)
g_Settings->SaveString(File_DiskIPLUSAPath, FileLoc);
else if (g_DDRom->CicChipID() == CIC_NUS_DDTL)
g_Settings->SaveString(File_DiskIPLTOOLPath, FileLoc);
}
g_System->RefreshGameSettings();
if (!g_Rom->IsLoadedRomDDIPL())
if (g_Disk == NULL || !g_Rom->IsLoadedRomDDIPL())
{
g_Settings->SaveString(Game_File, FileLoc);
}
@ -403,7 +408,12 @@ bool CN64System::LoadFileImageIPL(const char * FileLoc)
g_System->RefreshGameSettings();
g_Settings->SaveString(File_DiskIPLPath, FileLoc);
if (g_DDRom->CicChipID() == CIC_NUS_8303)
g_Settings->SaveString(File_DiskIPLPath, FileLoc);
else if (g_DDRom->CicChipID() == CIC_NUS_DDUS)
g_Settings->SaveString(File_DiskIPLUSAPath, FileLoc);
else if (g_DDRom->CicChipID() == CIC_NUS_DDTL)
g_Settings->SaveString(File_DiskIPLTOOLPath, FileLoc);
//g_Settings->SaveString(Game_File, FileLoc);
g_Settings->SaveBool(GameRunning_LoadingInProgress, false);
@ -486,7 +496,17 @@ bool CN64System::RunFileImage(const char * FileLoc)
{
return false;
}
g_Settings->SaveBool(Setting_EnableDisk, false);
g_Settings->SaveBool(Setting_EnableDisk, g_Rom->IsLoadedRomDDIPL());
if (g_Rom->IsLoadedRomDDIPL())
{
if (g_Rom->CicChipID() == CIC_NUS_8303)
g_Settings->SaveString(File_DiskIPLPath, FileLoc);
else if (g_Rom->CicChipID() == CIC_NUS_DDUS)
g_Settings->SaveString(File_DiskIPLUSAPath, FileLoc);
else if (g_Rom->CicChipID() == CIC_NUS_DDTL)
g_Settings->SaveString(File_DiskIPLTOOLPath, FileLoc);
}
if (g_Settings->LoadBool(Setting_AutoStart) != 0)
{
WriteTrace(TraceN64System, TraceDebug, "Automattically starting rom");
@ -497,24 +517,17 @@ bool CN64System::RunFileImage(const char * FileLoc)
bool CN64System::RunDiskImage(const char * FileLoc)
{
if (!LoadFileImage(g_Settings->LoadStringVal(File_DiskIPLPath).c_str()))
{
g_Settings->SaveString(File_DiskIPLPath, "");
return false;
}
else
{
if (!g_Rom->IsLoadedRomDDIPL())
{
g_Notify->DisplayError(MSG_FAIL_IMAGE_IPL);
g_Settings->SaveString(File_DiskIPLPath, "");
return false;
}
}
if (!LoadDiskImage(FileLoc, false))
{
return false;
}
//Select IPL ROM depending on Disk Country Code
if (!SelectAndLoadFileImageIPL(g_Disk->GetCountry(), false))
{
return false;
}
g_Settings->SaveBool(Setting_EnableDisk, true);
if (g_Settings->LoadBool(Setting_AutoStart) != 0)
{
@ -526,11 +539,6 @@ bool CN64System::RunDiskImage(const char * FileLoc)
bool CN64System::RunDiskComboImage(const char * FileLoc, const char * FileLocDisk)
{
if (!LoadFileImageIPL(g_Settings->LoadStringVal(File_DiskIPLPath).c_str()))
{
g_Settings->SaveString(File_DiskIPLPath, "");
return false;
}
if (!LoadDiskImage(FileLocDisk, true))
{
return false;
@ -539,6 +547,13 @@ bool CN64System::RunDiskComboImage(const char * FileLoc, const char * FileLocDis
{
return false;
}
//Select IPL ROM depending on Disk Country Code
if (!SelectAndLoadFileImageIPL(g_Disk->GetCountry(), true))
{
return false;
}
g_Settings->SaveBool(Setting_EnableDisk, true);
if (g_Settings->LoadBool(Setting_AutoStart) != 0)
{
@ -576,6 +591,75 @@ void CN64System::CloseSystem()
WriteTrace(TraceN64System, TraceDebug, "Done");
}
bool CN64System::SelectAndLoadFileImageIPL(Country country, bool combo)
{
delete g_DDRom;
g_DDRom = NULL;
SettingID IPLROMPathSetting;
LanguageStringID IPLROMError;
switch (country)
{
case Country::Japan:
IPLROMPathSetting = File_DiskIPLPath;
IPLROMError = MSG_IPL_REQUIRED;
break;
case Country::USA:
IPLROMPathSetting = File_DiskIPLUSAPath;
IPLROMError = MSG_USA_IPL_REQUIRED;
break;
case Country::UnknownCountry:
default:
IPLROMPathSetting = File_DiskIPLTOOLPath;
IPLROMError = MSG_TOOL_IPL_REQUIRED;
if (combo && !CPath(g_Settings->LoadStringVal(File_DiskIPLTOOLPath).c_str()).Exists())
{
//Development IPL is not needed for combo ROM + Disk loading
if (CPath(g_Settings->LoadStringVal(File_DiskIPLPath).c_str()).Exists())
IPLROMPathSetting = File_DiskIPLPath;
else if (CPath(g_Settings->LoadStringVal(File_DiskIPLUSAPath).c_str()).Exists())
IPLROMPathSetting = File_DiskIPLUSAPath;
}
break;
}
if (!CPath(g_Settings->LoadStringVal(IPLROMPathSetting).c_str()).Exists())
{
g_Notify->DisplayWarning(IPLROMError);
return false;
}
if (combo)
{
if (!LoadFileImageIPL(g_Settings->LoadStringVal(IPLROMPathSetting).c_str()))
{
g_Settings->SaveString(IPLROMPathSetting, "");
g_Notify->DisplayWarning(IPLROMError);
return false;
}
}
else
{
if (!LoadFileImage(g_Settings->LoadStringVal(IPLROMPathSetting).c_str()))
{
g_Settings->SaveString(IPLROMPathSetting, "");
g_Notify->DisplayWarning(IPLROMError);
return false;
}
else
{
if (!g_Rom->IsLoadedRomDDIPL())
{
//g_Notify->DisplayError(MSG_FAIL_IMAGE_IPL);
g_Notify->DisplayWarning(IPLROMError);
g_Settings->SaveString(IPLROMPathSetting, "");
return false;
}
}
}
return true;
}
bool CN64System::EmulationStarting(CThread * thread)
{
WriteTrace(TraceN64System, TraceDebug, "Starting (hThread: %p ThreadId: %d)", thread, thread->ThreadID());
@ -903,6 +987,8 @@ void CN64System::InitRegisters(bool bPostPif, CMipsMemoryVM & MMU)
//64DD Registers
m_Reg.ASIC_STATUS = DD_STATUS_RST_STATE;
m_Reg.ASIC_ID_REG = 0x00030000;
if (g_DDRom && (g_DDRom->CicChipID() == CIC_NUS_DDTL || (g_Disk && g_Disk->GetCountry() == Country::UnknownCountry)))
m_Reg.ASIC_ID_REG = 0x00040000;
//m_Reg.REVISION_REGISTER = 0x00000511;
m_Reg.FixFpuLocations();
@ -989,6 +1075,7 @@ void CN64System::InitRegisters(bool bPostPif, CMipsMemoryVM & MMU)
case CIC_NUS_5167:
case CIC_NUS_8303:
case CIC_NUS_DDUS:
case CIC_NUS_DDTL:
default:
//no specific values
break;
@ -1005,6 +1092,7 @@ void CN64System::InitRegisters(bool bPostPif, CMipsMemoryVM & MMU)
m_Reg.m_GPR[22].DW = 0x000000000000003F;
break;
case CIC_NUS_8303: //64DD IPL CIC
case CIC_NUS_DDTL: //64DD IPL TOOL CIC
case CIC_NUS_5167: //64DD CONVERSION CIC
m_Reg.m_GPR[22].DW = 0x00000000000000DD;
break;

View File

@ -60,6 +60,7 @@ public:
static bool LoadFileImage(const char * FileLoc);
static bool LoadFileImageIPL(const char * FileLoc);
static bool LoadDiskImage(const char * FileLoc, const bool Expansion);
static bool SelectAndLoadFileImageIPL(Country country, bool combo);
static bool RunFileImage(const char * FileLoc);
static bool RunDiskImage(const char * FileLoc);
static bool RunDiskComboImage(const char * FileLoc, const char * FileLocDisk);

File diff suppressed because it is too large Load Diff

View File

@ -22,13 +22,19 @@ public:
bool LoadDiskImage(const char * FileLoc);
bool SaveDiskImage();
void SwapDiskImage(const char * FileLoc);
static bool IsValidDiskImage(uint8_t Test[4]);
static bool IsValidDiskImage(uint8_t Test[0x20]);
void SaveDiskSettingID(bool temp);
void ClearDiskSettingID();
uint8_t * GetDiskAddress() { return m_DiskImage; }
uint8_t * GetDiskAddressBuffer() { return m_DiskImage + m_DiskBufAddress; }
uint8_t * GetDiskAddressSys() { return m_DiskImage + m_DiskSysAddress; }
uint8_t * GetDiskAddressID() { return m_DiskImage + m_DiskIDAddress; }
uint8_t * GetDiskAddressRom() { return m_DiskImage + m_DiskRomAddress; }
uint8_t * GetDiskAddressRam() { return m_DiskImage + m_DiskRamAddress; }
uint8_t * GetDiskHeader() { return m_DiskHeader; }
void SetDiskAddressBuffer(uint32_t address) { m_DiskBufAddress = address; }
uint32_t GetDiskAddressBlock(uint16_t head, uint16_t track, uint16_t block, uint16_t sector, uint16_t sectorsize);
uint32_t CalculateCrc();
stdstr GetRomName() const { return m_RomName; }
stdstr GetFileName() const { return m_FileName; }
stdstr GetDiskIdent() const { return m_DiskIdent; }
@ -41,15 +47,26 @@ private:
bool AllocateDiskImage(uint32_t DiskFileSize);
bool AllocateDiskHeader();
bool AllocateAndLoadDiskImage(const char * FileLoc);
bool LoadDiskRAMImage();
void ByteSwapDisk();
void ForceByteSwapDisk();
void SetError(LanguageStringID ErrorMsg);
void ConvertDiskFormat();
void ConvertDiskFormatBack();
void DetectSystemArea();
bool IsSysSectorGood(uint32_t block, uint32_t sectorsize);
Country GetDiskCountryCode();
void InitSysDataD64();
void DeinitSysDataD64();
void GenerateLBAToPhysTable();
void DetectRamAddress();
uint32_t LBAToVZone(uint32_t lba);
uint32_t LBAToByte(uint32_t lba, uint32_t nlbas);
uint16_t LBAToPhys(uint32_t lba);
uint16_t PhysToLBA(uint16_t head, uint16_t track, uint16_t block);
//constant values
enum { ReadFromRomSection = 0x400000, MameFormatSize = 0x0435B0C0, SDKFormatSize = 0x03DEC800,
DiskFormatMAME = 0x0, DiskFormatSDK = 0x1 };
DiskFormatMAME = 0x0, DiskFormatSDK = 0x1, DiskFormatD64 = 0x2 };
//class variables
CFile m_DiskFile;
@ -59,17 +76,79 @@ private:
uint8_t * m_DiskHeaderBase;
uint32_t m_DiskFileSize;
uint32_t m_DiskBufAddress;
uint32_t m_DiskSysAddress;
uint32_t m_DiskIDAddress;
uint32_t m_DiskRomAddress;
uint32_t m_DiskRamAddress;
LanguageStringID m_ErrorMsg;
Country m_Country;
stdstr m_RomName, m_FileName, m_DiskIdent;
uint8_t m_DiskFormat; //0 = MAME, 1 = SDK
uint8_t m_DiskFormat; //0 = MAME, 1 = SDK, 2 = D64
uint8_t m_DiskType;
bool m_isShadowDisk;
//Disk Defines
#define MAX_LBA 0x10DB
#define SIZE_LBA MAX_LBA+1
#define SYSTEM_LBAS 24
#define DISKID_LBA 14
#define DISK_COUNTRY_JPN 0xE848D316
#define DISK_COUNTRY_USA 0x2263EE56
#define DISK_COUNTRY_DEV 0x00000000
//disk convert
#define SECTORS_PER_BLOCK 85
#define BLOCKS_PER_TRACK 2
#define BLOCKSIZE(_zone) ZoneSecSize[_zone] * SECTORS_PER_BLOCK
const uint32_t SECTORSIZE[16] = { 232, 216, 208, 192, 176, 160, 144, 128,
216, 208, 192, 176, 160, 144, 128, 112 };
const uint32_t SECTORSIZE_P[9] = { 232, 216, 208, 192, 176, 160, 144, 128, 112 };
const uint32_t ZoneTracks[16] = { 158, 158, 149, 149, 149, 149, 149, 114,
158, 158, 149, 149, 149, 149, 149, 114 };
const uint16_t VZONE_LBA_TBL[7][16] = {
{0x0124, 0x0248, 0x035A, 0x047E, 0x05A2, 0x06B4, 0x07C6, 0x08D8, 0x09EA, 0x0AB6, 0x0B82, 0x0C94, 0x0DA6, 0x0EB8, 0x0FCA, 0x10DC},
{0x0124, 0x0248, 0x035A, 0x046C, 0x057E, 0x06A2, 0x07C6, 0x08D8, 0x09EA, 0x0AFC, 0x0BC8, 0x0C94, 0x0DA6, 0x0EB8, 0x0FCA, 0x10DC},
{0x0124, 0x0248, 0x035A, 0x046C, 0x057E, 0x0690, 0x07A2, 0x08C6, 0x09EA, 0x0AFC, 0x0C0E, 0x0CDA, 0x0DA6, 0x0EB8, 0x0FCA, 0x10DC},
{0x0124, 0x0248, 0x035A, 0x046C, 0x057E, 0x0690, 0x07A2, 0x08B4, 0x09C6, 0x0AEA, 0x0C0E, 0x0D20, 0x0DEC, 0x0EB8, 0x0FCA, 0x10DC},
{0x0124, 0x0248, 0x035A, 0x046C, 0x057E, 0x0690, 0x07A2, 0x08B4, 0x09C6, 0x0AD8, 0x0BEA, 0x0D0E, 0x0E32, 0x0EFE, 0x0FCA, 0x10DC},
{0x0124, 0x0248, 0x035A, 0x046C, 0x057E, 0x0690, 0x07A2, 0x086E, 0x0980, 0x0A92, 0x0BA4, 0x0CB6, 0x0DC8, 0x0EEC, 0x1010, 0x10DC},
{0x0124, 0x0248, 0x035A, 0x046C, 0x057E, 0x0690, 0x07A2, 0x086E, 0x093A, 0x0A4C, 0x0B5E, 0x0C70, 0x0D82, 0x0E94, 0x0FB8, 0x10DC}
};
const uint8_t VZONE_PZONE_TBL[7][16] = {
{0x0, 0x1, 0x2, 0x9, 0x8, 0x3, 0x4, 0x5, 0x6, 0x7, 0xF, 0xE, 0xD, 0xC, 0xB, 0xA},
{0x0, 0x1, 0x2, 0x3, 0xA, 0x9, 0x8, 0x4, 0x5, 0x6, 0x7, 0xF, 0xE, 0xD, 0xC, 0xB},
{0x0, 0x1, 0x2, 0x3, 0x4, 0xB, 0xA, 0x9, 0x8, 0x5, 0x6, 0x7, 0xF, 0xE, 0xD, 0xC},
{0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0xC, 0xB, 0xA, 0x9, 0x8, 0x6, 0x7, 0xF, 0xE, 0xD},
{0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0xD, 0xC, 0xB, 0xA, 0x9, 0x8, 0x7, 0xF, 0xE},
{0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0xE, 0xD, 0xC, 0xB, 0xA, 0x9, 0x8, 0xF},
{0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0xF, 0xE, 0xD, 0xC, 0xB, 0xA, 0x9, 0x8}
};
const uint16_t SCYL_ZONE_TBL[2][8] = {
{0x000, 0x09E, 0x13C, 0x1D1, 0x266, 0x2FB, 0x390, 0x425},
{0x091, 0x12F, 0x1C4, 0x259, 0x2EE, 0x383, 0x418, 0x48A}
};
const uint16_t OUTERCYL_TBL[8] = { 0x000, 0x09E, 0x13C, 0x1D1, 0x266, 0x2FB, 0x390, 0x425 };
const uint16_t RAM_START_LBA[7] = { 0x5A2, 0x7C6, 0x9EA, 0xC0E, 0xE32, 0x1010, 0x10DC };
const uint32_t RAM_SIZES[7] = { 0x24A9DC0, 0x1C226C0, 0x1450F00, 0xD35680, 0x6CFD40, 0x1DA240, 0x0 };
#define BLOCKSIZE(_zone) SECTORSIZE[_zone] * SECTORS_PER_BLOCK
#define TRACKSIZE(_zone) BLOCKSIZE(_zone) * BLOCKS_PER_TRACK
#define ZONESIZE(_zone) TRACKSIZE(_zone) * ZoneTracks[_zone]
#define VZONESIZE(_zone) TRACKSIZE(_zone) * (ZoneTracks[_zone] - 0xC)
#define VZoneToPZone(x, y) VZONE_PZONE_TBL[y][x]
//Used for MAME format
const uint32_t MAMEStartOffset[16] =
{ 0x0, 0x5F15E0, 0xB79D00, 0x10801A0, 0x1523720, 0x1963D80, 0x1D414C0, 0x20BBCE0,
0x23196E0, 0x28A1E00, 0x2DF5DC0, 0x3299340, 0x36D99A0, 0x3AB70E0, 0x3E31900, 0x4149200 };
//Used for SDK and D64 format
uint16_t LBAToPhysTable[SIZE_LBA];
};

View File

@ -289,7 +289,7 @@ CICChip CN64Rom::GetCicChipID(uint8_t * RomData, uint64_t * CRC)
case 0x000000D6D5BE5580: return CIC_NUS_6106;
case 0x000001053BC19870: return CIC_NUS_5167; //64DD CONVERSION CIC
case 0x000000D2E53EF008: return CIC_NUS_8303; //64DD IPL
case 0x000000D2E53EF39F: return CIC_NUS_8303; //64DD IPL TOOL
case 0x000000D2E53EF39F: return CIC_NUS_DDTL; //64DD IPL TOOL
case 0x000000D2E53E5DDA: return CIC_NUS_DDUS; //64DD IPL US (different CIC)
default:
return CIC_UNKNOWN;
@ -321,6 +321,7 @@ void CN64Rom::CalculateRomCrc()
uint32_t a0, a1, a2, a3;
uint32_t s0;
uint32_t v0, v1;
uint32_t length = 0x00100000;
// CIC_NUS_6101 at=0x5D588B65 , s6=0x3F
// CIC_NUS_6102 at=0x5D588B65 , s6=0x3F
@ -328,9 +329,11 @@ void CN64Rom::CalculateRomCrc()
// CIC_NUS_6105 at=0x5d588b65 , s6=0x91
// CIC_NUS_6106 at=0x6C078965 , s6=0x85
// 64DD IPL at=0x02E90EDD , s6=0xdd
// 64DD IPL (JPN) at=0x02E90EDD , s6=0xdd
// 64DD IPL (USA) at=0x02E90EDD , s6=0xde
// 64DD TOOL IPL at=0x0260BCD5 , s6=0xdd
//v0 = 0xFFFFFFFF & (0x3F * at) + 1;
//v0 = 0xFFFFFFFF & (s6 * at) + 1;
switch (m_CicChip)
{
case CIC_NUS_6101:
@ -338,6 +341,9 @@ void CN64Rom::CalculateRomCrc()
case CIC_NUS_6103: v0 = 0xA3886759; break;
case CIC_NUS_6105: v0 = 0xDF26F436; break;
case CIC_NUS_6106: v0 = 0x1FEA617A; break;
case CIC_NUS_DDUS: length = 0x000A0000; v0 = 0x861AE3A7; break;
case CIC_NUS_8303: length = 0x000A0000; v0 = 0x8331D4CA; break;
case CIC_NUS_DDTL: length = 0x000A0000; v0 = 0x0D8303E2; break;
default:
return;
}
@ -355,14 +361,23 @@ void CN64Rom::CalculateRomCrc()
a2 = v0;
t4 = v0;
for (t0 = 0; t0 < 0x00100000; t0 += 4)
for (t0 = 0; t0 < length; t0 += 4)
{
v0 = *(uint32_t *)(m_ROMImage + t0 + 0x1000);
v1 = a3 + v0;
a1 = v1;
if (v1 < a3) t2 += 0x1;
if (v1 < a3) {
if (m_CicChip == CIC_NUS_DDUS || m_CicChip == CIC_NUS_8303)
{
t2 = t2 ^ t3;
}
else
{
t2 += 0x1;
}
}
v1 = v0 & 0x001F;
a0 = (v0 << v1) | (v0 >> (t5 - v1));
@ -371,8 +386,17 @@ void CN64Rom::CalculateRomCrc()
t3 = t3 ^ v0;
s0 = s0 + a0;
if (a2 < v0) a2 = a3 ^ v0 ^ a2;
else a2 = a2 ^ a0;
if (a2 < v0)
{
a2 = a3 ^ v0 ^ a2;
}
else
{
if (m_CicChip == CIC_NUS_8303)
a2 = a2 + a0;
else
a2 = a2 ^ a0;
}
if (m_CicChip == CIC_NUS_6105)
{
@ -422,6 +446,7 @@ bool CN64Rom::IsLoadedRomDDIPL()
{
case CIC_NUS_8303:
case CIC_NUS_DDUS:
case CIC_NUS_DDTL:
return true;
default:
return false;
@ -612,14 +637,31 @@ bool CN64Rom::LoadN64Image(const char * FileLoc, bool LoadBootCodeOnly)
}
m_Country = (Country)m_ROMImage[0x3D];
m_RomIdent.Format("%08X-%08X-C:%X", *(uint32_t *)(&m_ROMImage[0x10]), *(uint32_t *)(&m_ROMImage[0x14]), m_ROMImage[0x3D]);
WriteTrace(TraceN64System, TraceDebug, "Ident: %s", m_RomIdent.c_str());
CalculateCicChip();
uint32_t CRC1, CRC2;
if (IsLoadedRomDDIPL())
{
//Handle CRC differently if 64DD IPL
CRC1 = (*(uint16_t *)(&m_ROMImage[0x608]) << 16) | *(uint16_t *)(&m_ROMImage[0x60C]);
CRC2 = (*(uint16_t *)(&m_ROMImage[0x638]) << 16) | *(uint16_t *)(&m_ROMImage[0x63C]);
}
else
{
CRC1 = *(uint32_t *)(&m_ROMImage[0x10]);
CRC2 = *(uint32_t *)(&m_ROMImage[0x14]);
}
m_RomIdent.Format("%08X-%08X-C:%X", CRC1, CRC2, m_ROMImage[0x3D]);
WriteTrace(TraceN64System, TraceDebug, "Ident: %s", m_RomIdent.c_str());
if (!LoadBootCodeOnly && g_Rom == this)
{
g_Settings->SaveBool(GameRunning_LoadingInProgress, false);
SaveRomSettingID(false);
if (!g_Disk)
SaveRomSettingID(false);
else if (!IsLoadedRomDDIPL())
g_Settings->SaveString(Game_GameName, m_RomName.c_str()); //Use Base Game's Save File if loaded in combo
}
if (g_Settings->LoadBool(Game_CRC_Recalc))
@ -756,9 +798,23 @@ bool CN64Rom::LoadN64ImageIPL(const char * FileLoc, bool LoadBootCodeOnly)
}
m_Country = (Country)m_ROMImage[0x3D];
m_RomIdent.Format("%08X-%08X-C:%X", *(uint32_t *)(&m_ROMImage[0x10]), *(uint32_t *)(&m_ROMImage[0x14]), m_ROMImage[0x3D]);
WriteTrace(TraceN64System, TraceDebug, "Ident: %s", m_RomIdent.c_str());
CalculateCicChip();
uint32_t CRC1, CRC2;
if (IsLoadedRomDDIPL())
{
//Handle CRC differently if 64DD IPL
CRC1 = (*(uint16_t *)(&m_ROMImage[0x608]) << 16) | *(uint16_t *)(&m_ROMImage[0x60C]);
CRC2 = (*(uint16_t *)(&m_ROMImage[0x638]) << 16) | *(uint16_t *)(&m_ROMImage[0x63C]);
}
else
{
CRC1 = *(uint32_t *)(&m_ROMImage[0x10]);
CRC2 = *(uint32_t *)(&m_ROMImage[0x14]);
}
m_RomIdent.Format("%08X-%08X-C:%X", CRC1, CRC2, m_ROMImage[0x3D]);
WriteTrace(TraceN64System, TraceDebug, "Ident: %s", m_RomIdent.c_str());
if (!IsLoadedRomDDIPL())
{
@ -769,7 +825,6 @@ bool CN64Rom::LoadN64ImageIPL(const char * FileLoc, bool LoadBootCodeOnly)
if (!LoadBootCodeOnly && g_DDRom == this)
{
g_Settings->SaveBool(GameRunning_LoadingInProgress, false);
SaveRomSettingID(false);
}
if (g_Settings->LoadBool(Game_CRC_Recalc))

View File

@ -53,6 +53,11 @@ enum SAVE_CHIP_TYPE
SaveChip_Auto = -1, SaveChip_Eeprom_4K, SaveChip_Eeprom_16K, SaveChip_Sram, SaveChip_FlashRam
};
enum SAVE_DISK_TYPE
{
SaveDisk_ShadowFile = 0, SaveDisk_RAMFile = 1,
};
enum FUNC_LOOKUP_METHOD
{
FuncFind_Default = -1, FuncFind_PhysicalLookup = 1, FuncFind_VirtualLookup = 2, FuncFind_ChangeMemory = 3,
@ -67,7 +72,7 @@ enum CICChip
{
CIC_UNKNOWN = -1, CIC_NUS_6101 = 1, CIC_NUS_6102 = 2, CIC_NUS_6103 = 3,
CIC_NUS_6104 = 4, CIC_NUS_6105 = 5, CIC_NUS_6106 = 6, CIC_NUS_5167 = 7,
CIC_NUS_8303 = 8, CIC_NUS_DDUS = 9
CIC_NUS_8303 = 8, CIC_NUS_DDUS = 9, CIC_NUS_DDTL = 10
};
enum Country

View File

@ -34,6 +34,7 @@ static const char* ROM_extensions[] =
"eur",
"bin",
"ndd",
"d64",
};
CRomList::CRomList() :
@ -340,7 +341,7 @@ void CRomList::RefreshRomListStatic(CRomList * _this)
bool CRomList::LoadDataFromRomFile(const char * FileName, uint8_t * Data, int32_t DataLen, int32_t * RomSize, FILE_FORMAT & FileFormat)
{
uint8_t Test[4];
uint8_t Test[0x20];
if (_strnicmp(&FileName[strlen(FileName) - 4], ".ZIP", 4) == 0)
{
@ -411,10 +412,6 @@ bool CRomList::LoadDataFromRomFile(const char * FileName, uint8_t * Data, int32_
{
return false;
}
if (!CN64Rom::IsValidRomImage(Test) && !CN64Disk::IsValidDiskImage(Test))
{
return false;
}
if (CN64Rom::IsValidRomImage(Test))
{
@ -424,21 +421,85 @@ bool CRomList::LoadDataFromRomFile(const char * FileName, uint8_t * Data, int32_
return false;
}
}
if (CN64Disk::IsValidDiskImage(Test))
else if (!CN64Disk::IsValidDiskImage(Test) && (File.GetLength() == DISKSIZE_MAME || File.GetLength() == DISKSIZE_SDK))
{
//Is a Disk Image
File.SeekToBegin();
uint32_t sysdataoffset = 0;
uint32_t diskidoffset = 0x43670;
uint32_t romdataoffset = 0x738C0;
bool isValidDisk = false;
//Could still be a Disk Image
//System Data
const uint8_t blocks[7] = { 2, 3, 10, 11, 1, 8, 9 };
for (int i = 0; i < 7; i++)
{
sysdataoffset = 0x4D08 * blocks[i];
File.Seek(sysdataoffset, CFileBase::begin);
if (File.Read(Test, sizeof(Test)) != sizeof(Test))
{
return false;
}
isValidDisk = CN64Disk::IsValidDiskImage(Test);
if (isValidDisk)
break;
}
if (!isValidDisk)
{
return false;
}
File.Seek(sysdataoffset, CFileBase::begin);
if (!File.Read(Data, 0x100))
{
return false;
}
File.Seek(0x43670, CFileBase::begin);
File.Seek(diskidoffset, CFileBase::begin);
if (!File.Read(Data + 0x100, 0x20))
{
return false;
}
File.Seek(romdataoffset, CFileBase::begin);
if (!File.Read(Data + 0x200, 0x200))
{
return false;
}
}
else if (CN64Disk::IsValidDiskImage(Test))
{
//Is a Disk Image
uint32_t sysdataoffset = 0;
uint32_t diskidoffset = 0x100;
uint32_t romdataoffset = 0x200;
if ((File.GetLength() == DISKSIZE_MAME) || (File.GetLength() == DISKSIZE_SDK))
{
diskidoffset = 0x43670;
romdataoffset = 0x738C0;
}
File.Seek(sysdataoffset, CFileBase::begin);
if (!File.Read(Data, 0x100))
{
return false;
}
File.Seek(diskidoffset, CFileBase::begin);
if (!File.Read(Data + 0x100, 0x20))
{
return false;
}
File.Seek(romdataoffset, CFileBase::begin);
if (!File.Read(Data + 0x200, 0x200))
{
return false;
}
}
else
{
return false;
}
*RomSize = File.GetLength();
FileFormat = Format_Uncompressed;
}
@ -461,7 +522,7 @@ bool CRomList::FillRomInfo(ROM_INFO * pRomInfo)
strncpy(pRomInfo->FileName, g_Settings->LoadBool(RomList_ShowFileExtensions) ? CPath(pRomInfo->szFullFileName).GetNameExtension().c_str() : CPath(pRomInfo->szFullFileName).GetName().c_str(), sizeof(pRomInfo->FileName) / sizeof(pRomInfo->FileName[0]));
}
if (CPath(pRomInfo->szFullFileName).GetExtension() != "ndd")
if ((CPath(pRomInfo->szFullFileName).GetExtension() != "ndd") && (CPath(pRomInfo->szFullFileName).GetExtension() != "d64"))
{
char InternalName[22];
memcpy(InternalName, (void *)(RomData + 0x20), 20);
@ -475,6 +536,12 @@ bool CRomList::FillRomInfo(ROM_INFO * pRomInfo)
pRomInfo->CRC1 = *(uint32_t *)(RomData + 0x10);
pRomInfo->CRC2 = *(uint32_t *)(RomData + 0x14);
pRomInfo->CicChip = CN64Rom::GetCicChipID(RomData);
if (pRomInfo->CicChip == CIC_NUS_8303 || pRomInfo->CicChip == CIC_NUS_DDUS || pRomInfo->CicChip == CIC_NUS_DDTL)
{
pRomInfo->CRC1 = (*(uint16_t *)(RomData + 0x608) << 16) | *(uint16_t *)(RomData + 0x60C);
pRomInfo->CRC2 = (*(uint16_t *)(RomData + 0x638) << 16) | *(uint16_t *)(RomData + 0x63C);
}
FillRomExtensionInfo(pRomInfo);
}
else
@ -487,15 +554,12 @@ bool CRomList::FillRomInfo(ROM_INFO * pRomInfo)
pRomInfo->CartID[2] = *(RomData + 0x102);
pRomInfo->Manufacturer = '\0';
pRomInfo->Country = *(RomData + 0x100);
pRomInfo->CRC1 = *(uint32_t *)(RomData + 0x00);
pRomInfo->CRC2 = *(uint32_t *)(RomData + 0x100);
if (pRomInfo->CRC2 == 0)
pRomInfo->CRC1 = 0;
for (uint32_t i = 0; i < 0x200; i += 4)
{
for (uint8_t i = 0; i < 0xE8; i += 4)
{
pRomInfo->CRC2 += *(uint32_t *)(RomData + i);
}
pRomInfo->CRC1 += *(uint32_t *)(&RomData[0x200 + i]);
}
pRomInfo->CRC2 = ~pRomInfo->CRC1;
pRomInfo->CicChip = CIC_NUS_8303;
FillRomExtensionInfo(pRomInfo);
}
@ -589,6 +653,7 @@ void CRomList::ByteSwapRomData(uint8_t * Data, int32_t DataLen)
case 0x16D348E8: //64DD JP Disk
case 0x56EE6322: //64DD US Disk
case 0x40123780:
case 0x00000000: //64DD DEV Disk
for (count = 0; count < DataLen; count += 4)
{
Data[count] ^= Data[count + 3];

View File

@ -85,7 +85,7 @@ private:
static void RefreshSettings(CRomList *);
static void NotificationCB(const char * Status, CRomList * _this);
static void RefreshRomListStatic(CRomList * _this);
static void ByteSwapRomData(uint8_t * Data, int DataLen);
static void ByteSwapRomData(uint8_t * Data, int32_t DataLen);
CPath m_GameDir;
CIniFile * m_NotesIniFile;
@ -95,4 +95,7 @@ private:
CIniFile * m_ZipIniFile;
#endif
CThread m_RefreshThread;
#define DISKSIZE_MAME 0x0435B0C0
#define DISKSIZE_SDK 0x03DEC800
};

View File

@ -137,6 +137,7 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
AddHandler(Setting_LanguageDirDefault, new CSettingTypeRelativePath("Lang", ""));
AddHandler(Setting_LanguageDir, new CSettingTypeApplicationPath("Lang Directory", "Directory", Setting_LanguageDirDefault));
AddHandler(Setting_SyncViaAudioEnabled, new CSettingTypeTempBool(false, "SyncViaAudioEnabled"));
AddHandler(Setting_DiskSaveType, new CSettingTypeApplication("Settings", "Disk Save Type", (uint32_t)1));
AddHandler(Default_RDRamSize, new CSettingTypeApplication("Defaults", "RDRAM Size", 0x400000u));
AddHandler(Default_UseHleGfx, new CSettingTypeApplication("Defaults", "HLE GFX Default", true));
@ -328,6 +329,8 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
AddHandler(UserInterface_BasicMode, new CSettingTypeApplication("Settings", "Basic Mode", (uint32_t)true));
AddHandler(File_DiskIPLPath, new CSettingTypeApplicationPath("Settings", "Disk IPL ROM Path", Default_None));
AddHandler(File_DiskIPLUSAPath, new CSettingTypeApplicationPath("Settings", "Disk IPL USA ROM Path", Default_None));
AddHandler(File_DiskIPLTOOLPath, new CSettingTypeApplicationPath("Settings", "Disk IPL TOOL ROM Path", Default_None));
AddHandler(Debugger_Enabled, new CSettingTypeApplication("Debugger", "Debugger", false));
AddHandler(Debugger_ShowTLBMisses, new CSettingTypeApplication("Debugger", "Show TLB Misses", false));

View File

@ -64,6 +64,7 @@ enum SettingID
Setting_EnableDisk,
Setting_SyncViaAudioEnabled,
Setting_Enhancement,
Setting_DiskSaveType,
//Default Settings
Default_RDRamSize,
@ -232,6 +233,8 @@ enum SettingID
//File Info
File_DiskIPLPath,
File_DiskIPLUSAPath,
File_DiskIPLTOOLPath,
//Debugger
Debugger_Enabled,

View File

@ -118,6 +118,7 @@
<ClCompile Include="UserInterface\Settings\SettingsPage-AdvancedOptions.cpp" />
<ClCompile Include="UserInterface\Settings\SettingsPage-Defaults.cpp" />
<ClCompile Include="UserInterface\Settings\SettingsPage-Directories.cpp" />
<ClCompile Include="UserInterface\Settings\SettingsPage-DiskDrive.cpp" />
<ClCompile Include="UserInterface\Settings\SettingsPage-Game-General.cpp" />
<ClCompile Include="UserInterface\Settings\SettingsPage-Game-Plugin.cpp" />
<ClCompile Include="UserInterface\Settings\SettingsPage-Game-Recompiler.cpp" />
@ -187,6 +188,7 @@
<ClInclude Include="UserInterface\Settings\SettingsPage-AdvancedOptions.h" />
<ClInclude Include="UserInterface\Settings\SettingsPage-Defaults.h" />
<ClInclude Include="UserInterface\Settings\SettingsPage-Directories.h" />
<ClInclude Include="UserInterface\Settings\SettingsPage-DiskDrive.h" />
<ClInclude Include="UserInterface\Settings\SettingsPage-Game-General.h" />
<ClInclude Include="UserInterface\Settings\SettingsPage-Game-Plugin.h" />
<ClInclude Include="UserInterface\Settings\SettingsPage-Game-Recompiler.h" />

View File

@ -234,6 +234,9 @@
<ClCompile Include="UserInterface\Debugger\Debugger-ExceptionBreakpoints.cpp">
<Filter>Source Files\User Interface Source\Debugger Source</Filter>
</ClCompile>
<ClCompile Include="UserInterface\Settings\SettingsPage-DiskDrive.cpp">
<Filter>Source Files\User Interface Source\Settings Source</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="UserInterface\resource.h">
@ -449,6 +452,9 @@
<ClInclude Include="UserInterface\Debugger\Debugger-ExceptionBreakpoints.h">
<Filter>Header Files\User Interface Headers\Debugger Headers</Filter>
</ClInclude>
<ClInclude Include="UserInterface\Settings\SettingsPage-DiskDrive.h">
<Filter>Header Files\User Interface Headers\Settings Header</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="res\divider.cur">

View File

@ -117,25 +117,16 @@ void CMainMenu::OnOpenRom(HWND hWnd)
{
return;
}
stdstr ext = CPath(File).GetExtension();
if (_stricmp(ext.c_str(), "ndd") != 0)
if ((_stricmp(ext.c_str(), "ndd") != 0) && (_stricmp(ext.c_str(), "d64") != 0))
{
delete g_DDRom;
g_DDRom = NULL;
g_BaseSystem->RunFileImage(File.c_str());
return;
}
// Open Disk
if (!CPath(g_Settings->LoadStringVal(File_DiskIPLPath)).Exists() || !g_BaseSystem->RunDiskImage(File.c_str()))
else
{
if (!CPath(g_Settings->LoadStringVal(File_DiskIPLPath)).Exists()) { g_Notify->DisplayWarning(MSG_IPL_REQUIRED); }
CPath FileNameIPL;
const char * Filter = "64DD IPL ROM Image (*.zip, *.7z, *.?64, *.rom, *.usa, *.jap, *.pal, *.bin)\0*.?64;*.zip;*.7z;*.bin;*.rom;*.usa;*.jap;*.pal\0All files (*.*)\0*.*\0";
if (FileNameIPL.SelectFile(hWnd, g_Settings->LoadStringVal(RomList_GameDir).c_str(), Filter, true))
{
g_Settings->SaveString(File_DiskIPLPath, (const char *)FileNameIPL);
g_BaseSystem->RunDiskImage(File.c_str());
}
g_BaseSystem->RunDiskImage(File.c_str());
}
}
@ -303,7 +294,7 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
{
// Open Disk
CPath FileName;
const char * Filter = "N64DD Disk Image (*.ndd)\0*.ndd\0All files (*.*)\0*.*\0";
const char * Filter = "N64DD Disk Image (*.ndd, *.d64)\0*.ndd;*.d64\0All files (*.*)\0*.*\0";
if (FileName.SelectFile(hWnd, g_Settings->LoadStringVal(RomList_GameDir).c_str(), Filter, true))
{
g_Disk->SaveDiskImage();
@ -547,22 +538,10 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
if (UISettingsLoadStringIndex(File_RecentGameFileIndex, MenuID - ID_RECENT_ROM_START, FileName) &&
FileName.length() > 0)
{
if (CPath(FileName).GetExtension() != "ndd")
if ((CPath(FileName).GetExtension() != "ndd") && (CPath(FileName).GetExtension() != "d64"))
g_BaseSystem->RunFileImage(FileName.c_str());
else
{
if (!CPath(g_Settings->LoadStringVal(File_DiskIPLPath)).Exists() || !g_BaseSystem->RunDiskImage(FileName.c_str()))
{
if (!CPath(g_Settings->LoadStringVal(File_DiskIPLPath)).Exists()) { g_Notify->DisplayWarning(MSG_IPL_REQUIRED); }
CPath FileNameIPL;
const char * Filter = "64DD IPL ROM Image (*.zip, *.7z, *.?64, *.rom, *.usa, *.jap, *.pal, *.bin)\0*.?64;*.zip;*.7z;*.bin;*.rom;*.usa;*.jap;*.pal\0All files (*.*)\0*.*\0";
if (FileNameIPL.SelectFile(hWnd, g_Settings->LoadStringVal(RomList_GameDir).c_str(), Filter, true))
{
g_Settings->SaveString(File_DiskIPLPath, (const char *)FileNameIPL);
g_BaseSystem->RunDiskImage(FileName.c_str());
}
}
}
g_BaseSystem->RunDiskImage(FileName.c_str());
}
}
if (MenuID >= ID_RECENT_DIR_START && MenuID < ID_RECENT_DIR_END)

View File

@ -987,43 +987,23 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO
switch (LOWORD(wParam)) {
case ID_POPUPMENU_PLAYGAME:
{
if (CPath(_this->CurrentedSelectedRom()).GetExtension() != "ndd")
if ((CPath(_this->CurrentedSelectedRom()).GetExtension() != "ndd") && (CPath(_this->CurrentedSelectedRom()).GetExtension() != "d64"))
{
g_BaseSystem->RunFileImage(_this->CurrentedSelectedRom());
}
else
{
if (!CPath(g_Settings->LoadStringVal(File_DiskIPLPath)).Exists() || !g_BaseSystem->RunDiskImage(_this->CurrentedSelectedRom()))
{
if (!CPath(g_Settings->LoadStringVal(File_DiskIPLPath)).Exists()) { g_Notify->DisplayWarning(MSG_IPL_REQUIRED); }
CPath FileName;
const char * Filter = "64DD IPL ROM Image (*.zip, *.7z, *.?64, *.rom, *.usa, *.jap, *.pal, *.bin)\0*.?64;*.zip;*.7z;*.bin;*.rom;*.usa;*.jap;*.pal\0All files (*.*)\0*.*\0";
if (FileName.SelectFile(hWnd, g_Settings->LoadStringVal(RomList_GameDir).c_str(), Filter, true))
{
g_Settings->SaveString(File_DiskIPLPath, (const char *)FileName);
g_BaseSystem->RunDiskImage(_this->CurrentedSelectedRom());
}
}
g_BaseSystem->RunDiskImage(_this->CurrentedSelectedRom());
}
break;
}
case ID_POPUPMENU_PLAYGAMEWITHDISK:
{
CPath FileName;
const char * Filter = "N64DD Disk Image (*.ndd)\0*.ndd\0All files (*.*)\0*.*\0";
const char * Filter = "N64DD Disk Image (*.ndd, *.d64)\0*.ndd;*.d64\0All files (*.*)\0*.*\0";
if (FileName.SelectFile(hWnd, g_Settings->LoadStringVal(RomList_GameDir).c_str(), Filter, true))
{
if (!CPath(g_Settings->LoadStringVal(File_DiskIPLPath)).Exists() || !g_BaseSystem->RunDiskComboImage(_this->CurrentedSelectedRom(), FileName))
{
if (!CPath(g_Settings->LoadStringVal(File_DiskIPLPath)).Exists()) { g_Notify->DisplayWarning(MSG_IPL_REQUIRED); }
CPath FileNameIPL;
const char * Filter = "64DD IPL ROM Image (*.zip, *.7z, *.?64, *.rom, *.usa, *.jap, *.pal, *.bin)\0*.?64;*.zip;*.7z;*.bin;*.rom;*.usa;*.jap;*.pal\0All files (*.*)\0*.*\0";
if (FileNameIPL.SelectFile(hWnd, g_Settings->LoadStringVal(RomList_GameDir).c_str(), Filter, true))
{
g_Settings->SaveString(File_DiskIPLPath, (const char *)FileNameIPL);
g_BaseSystem->RunDiskComboImage(_this->CurrentedSelectedRom(), FileName);
}
}
g_BaseSystem->RunDiskComboImage(_this->CurrentedSelectedRom(), FileName);
}
}
break;
@ -1039,7 +1019,7 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO
case ID_POPUPMENU_EDITCHEATS:
case ID_POPUPMENU_CHOOSEENHANCEMENT:
{
if (CPath(_this->CurrentedSelectedRom()).GetExtension() != "ndd")
if ((CPath(_this->CurrentedSelectedRom()).GetExtension() != "ndd") && (CPath(_this->CurrentedSelectedRom()).GetExtension() != "d64"))
{
CN64Rom Rom;
Rom.LoadN64Image(_this->CurrentedSelectedRom(), true);
@ -1172,26 +1152,13 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO
DragFinish(hDrop);
stdstr ext = CPath(filename).GetExtension();
if (!(_stricmp(ext.c_str(), "ndd") == 0))
if ((!(_stricmp(ext.c_str(), "ndd") == 0)) && (!(_stricmp(ext.c_str(), "d64") == 0)))
{
delete g_DDRom;
g_DDRom = NULL;
CN64System::RunFileImage(filename);
}
else
{
// Open Disk
if (!CPath(g_Settings->LoadStringVal(File_DiskIPLPath)).Exists() || !g_BaseSystem->RunDiskImage(filename))
{
if (!CPath(g_Settings->LoadStringVal(File_DiskIPLPath)).Exists()) { g_Notify->DisplayWarning(MSG_IPL_REQUIRED); }
CPath FileName;
const char * Filter = "64DD IPL ROM Image (*.zip, *.7z, *.?64, *.rom, *.usa, *.jap, *.pal, *.bin)\0*.?64;*.zip;*.7z;*.bin;*.rom;*.usa;*.jap;*.pal\0All files (*.*)\0*.*\0";
if (FileName.SelectFile(hWnd, g_Settings->LoadStringVal(RomList_GameDir).c_str(), Filter, true))
{
g_Settings->SaveString(File_DiskIPLPath, (const char *)FileName);
g_BaseSystem->RunDiskImage(filename);
}
}
CN64System::RunDiskImage(filename);
}
}
break;

View File

@ -804,25 +804,11 @@ void CRomBrowser::RomList_OpenRom(uint32_t /*pnmh*/)
if (!pRomInfo) { return; }
m_StopRefresh = true;
delete g_DDRom;
g_DDRom = NULL;
if (CPath(pRomInfo->szFullFileName).GetExtension() != "ndd")
if ((CPath(pRomInfo->szFullFileName).GetExtension() != "ndd") && (CPath(pRomInfo->szFullFileName).GetExtension() != "d64"))
CN64System::RunFileImage(pRomInfo->szFullFileName);
else
{
if (!CPath(g_Settings->LoadStringVal(File_DiskIPLPath)).Exists() || !g_BaseSystem->RunDiskImage(pRomInfo->szFullFileName))
{
if (!CPath(g_Settings->LoadStringVal(File_DiskIPLPath)).Exists()) { g_Notify->DisplayWarning(MSG_IPL_REQUIRED); }
CPath FileName;
const char * Filter = "64DD IPL ROM Image (*.zip, *.7z, *.?64, *.rom, *.usa, *.jap, *.pal, *.bin)\0*.?64;*.zip;*.7z;*.bin;*.rom;*.usa;*.jap;*.pal\0All files (*.*)\0*.*\0";
if (FileName.SelectFile(m_MainWindow, g_Settings->LoadStringVal(RomList_GameDir).c_str(), Filter, true))
{
g_Settings->SaveString(File_DiskIPLPath, (const char *)FileName);
g_BaseSystem->RunDiskImage(pRomInfo->szFullFileName);
}
}
}
CN64System::RunDiskImage(pRomInfo->szFullFileName);
}
void CRomBrowser::RomList_PopupMenu(uint32_t /*pnmh*/)
@ -885,7 +871,7 @@ void CRomBrowser::RomList_PopupMenu(uint32_t /*pnmh*/)
if (inBasicMode) { DeleteMenu(hPopupMenu, 9, MF_BYPOSITION); }
if (inBasicMode && !CheatsRemembered) { DeleteMenu(hPopupMenu, 8, MF_BYPOSITION); }
DeleteMenu(hPopupMenu, 7, MF_BYPOSITION);
if (CPath(m_SelectedRom).GetExtension() == "ndd") { DeleteMenu(hPopupMenu, 1, MF_BYPOSITION); }
if ((CPath(m_SelectedRom).GetExtension() == "ndd") || (CPath(m_SelectedRom).GetExtension() == "d64")) { DeleteMenu(hPopupMenu, 1, MF_BYPOSITION); }
if (!inBasicMode && g_Plugins && g_Plugins->Gfx() && g_Plugins->Gfx()->GetRomBrowserMenu != NULL)
{
HMENU GfxMenu = (HMENU)g_Plugins->Gfx()->GetRomBrowserMenu();

View File

@ -20,7 +20,7 @@ m_pRomInfo(NULL),
m_pDiskInfo(NULL)
{
if (m_FileName.length() == 0) { return; }
if (CPath(m_FileName).GetExtension() != "ndd")
if ((CPath(m_FileName).GetExtension() != "ndd") && (CPath(m_FileName).GetExtension() != "d64"))
{
m_pRomInfo = new CN64Rom;
if (!m_pRomInfo->LoadN64Image(m_FileName.c_str()))
@ -137,8 +137,20 @@ DWORD CALLBACK RomInfoProc(HWND hDlg, DWORD uMsg, DWORD wParam, DWORD lParam)
default:
SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, stdstr_f(" Unknown %c (%02X)", RomHeader[0x3D], RomHeader[0x3D]).ToUTF16().c_str());
}
SetDlgItemTextW(hDlg, IDC_INFO_CRC1, stdstr_f("0x%08X", *(uint32_t *)(RomHeader + 0x10)).ToUTF16().c_str());
SetDlgItemTextW(hDlg, IDC_INFO_CRC2, stdstr_f("0x%08X", *(DWORD *)(RomHeader + 0x14)).ToUTF16().c_str());
switch (_this->m_pRomInfo->CicChipID())
{
case CIC_NUS_8303:
case CIC_NUS_DDUS:
case CIC_NUS_DDTL:
SetDlgItemTextW(hDlg, IDC_INFO_CRC1, stdstr_f("0x%08X", (*(uint16_t *)(RomHeader + 0x608) << 16) | *(uint16_t *)(RomHeader + 0x60C)).ToUTF16().c_str());
SetDlgItemTextW(hDlg, IDC_INFO_CRC2, stdstr_f("0x%08X", (*(uint16_t *)(RomHeader + 0x638) << 16) | *(uint16_t *)(RomHeader + 0x63C)).ToUTF16().c_str());
break;
default:
SetDlgItemTextW(hDlg, IDC_INFO_CRC1, stdstr_f("0x%08X", *(uint32_t *)(RomHeader + 0x10)).ToUTF16().c_str());
SetDlgItemTextW(hDlg, IDC_INFO_CRC2, stdstr_f("0x%08X", *(DWORD *)(RomHeader + 0x14)).ToUTF16().c_str());
break;
}
std::wstring CicChip;
switch (_this->m_pRomInfo->CicChipID())
@ -147,6 +159,7 @@ DWORD CALLBACK RomInfoProc(HWND hDlg, DWORD uMsg, DWORD wParam, DWORD lParam)
case CIC_NUS_8303: CicChip = L"CIC-NUS-8303"; break;
case CIC_NUS_5167: CicChip = L"CIC-NUS-5167"; break;
case CIC_NUS_DDUS: CicChip = L"CIC-NUS-????"; break;
case CIC_NUS_DDTL: CicChip = L"CIC-NUS-????"; break;
default: CicChip = stdstr_f("CIC-NUS-610%d", _this->m_pRomInfo->CicChipID()).ToUTF16(); break;
}
SetDlgItemTextW(hDlg, IDC_INFO_CIC, CicChip.c_str());
@ -176,7 +189,7 @@ DWORD CALLBACK RomInfoProc(HWND hDlg, DWORD uMsg, DWORD wParam, DWORD lParam)
//SetDlgItemTextW(hDlg, IDC_INFO_MD5, _this->m_pRomInfo->GetRomMD5().ToUTF16().c_str());
//SetDlgItemTextW(hDlg, IDC_INFO_ROMSIZE, stdstr_f("%.1f MBit", (float)_this->m_pDiskInfo->GetRomSize() / 0x20000).ToUTF16().c_str());
BYTE * DiskHeader = _this->m_pDiskInfo->GetDiskAddress() + 0x43670;
BYTE * DiskHeader = _this->m_pDiskInfo->GetDiskAddressID();
SetDlgItemTextW(hDlg, IDC_INFO_CARTID, stdstr_f("%c%c", DiskHeader[0x02], DiskHeader[0x01]).ToUTF16().c_str());
/*switch (DiskHeader[0x00])
@ -204,8 +217,8 @@ DWORD CALLBACK RomInfoProc(HWND hDlg, DWORD uMsg, DWORD wParam, DWORD lParam)
default:
SetDlgItemTextW(hDlg, IDC_INFO_COUNTRY, stdstr_f(" Unknown %c (%02X)", DiskHeader[0x03], DiskHeader[0x03]).ToUTF16().c_str());
}
SetDlgItemTextW(hDlg, IDC_INFO_CRC1, stdstr_f("0x%08X", *(uint32_t *)(_this->m_pDiskInfo->GetDiskAddress())).ToUTF16().c_str());
SetDlgItemTextW(hDlg, IDC_INFO_CRC2, stdstr_f("0x%08X", *(DWORD *)(DiskHeader)).ToUTF16().c_str());
SetDlgItemTextW(hDlg, IDC_INFO_CRC1, stdstr_f("0x%08X", (_this->m_pDiskInfo->CalculateCrc())).ToUTF16().c_str());
SetDlgItemTextW(hDlg, IDC_INFO_CRC2, stdstr_f("0x%08X", (~_this->m_pDiskInfo->CalculateCrc())).ToUTF16().c_str());
/*
std::wstring CicChip;
switch (_this->m_pRomInfo->CicChipID())

View File

@ -27,7 +27,6 @@ CAdvancedOptionsPage::CAdvancedOptionsPage(HWND hParent, const RECT & rcDispay)
SetDlgItemTextW(m_hWnd, IDC_UNIQUE_SAVE_DIR, wGS(OPTION_UNIQUE_SAVE_DIR).c_str());
SetDlgItemTextW(m_hWnd, IDC_CHECK_RUNNING, wGS(OPTION_CHECK_RUNNING).c_str());
SetDlgItemTextW(m_hWnd, IDC_DISPLAY_FRAMERATE, wGS(OPTION_CHANGE_FR).c_str());
SetDlgItemTextW(m_hWnd, IDC_IPLDIR_TXT, wGS(OPTION_IPL_ROM_PATH).c_str());
AddModCheckBox(GetDlgItem(IDC_START_ON_ROM_OPEN), Setting_AutoStart);
AddModCheckBox(GetDlgItem(IDC_ZIP), Setting_AutoZipInstantSave);
@ -48,8 +47,6 @@ CAdvancedOptionsPage::CAdvancedOptionsPage(HWND hParent, const RECT & rcDispay)
ComboBox->AddItemW(wGS(STR_FR_DLS_VIS).c_str(), FR_VIs_DLs);
}
m_IplDir.Attach(GetDlgItem(IDC_IPL_DIR));
UpdatePageSettings();
}
@ -65,16 +62,6 @@ void CAdvancedOptionsPage::ShowPage()
void CAdvancedOptionsPage::ApplySettings(bool UpdateScreen)
{
if (m_IplDir.IsChanged())
{
stdstr file = m_IplDir.GetWindowText();
g_Settings->SaveString(File_DiskIPLPath, file.c_str());
}
if (m_IplDir.IsReset())
{
g_Settings->DeleteSetting(File_DiskIPLPath);
}
CSettingsPageImpl<CAdvancedOptionsPage>::ApplySettings(UpdateScreen);
}
@ -89,39 +76,9 @@ void CAdvancedOptionsPage::ResetPage()
CSettingsPageImpl<CAdvancedOptionsPage>::ResetPage();
}
void CAdvancedOptionsPage::SelectIplDir(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
{
SelectFile(DIR_SELECT_PLUGIN, m_IplDir);
}
void CAdvancedOptionsPage::IplDirChanged(UINT /*Code*/, int /*id*/, HWND /*ctl*/)
{
if (m_InUpdateSettings) { return; }
m_IplDir.SetChanged(true);
SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0);
}
void CAdvancedOptionsPage::UpdatePageSettings(void)
{
m_InUpdateSettings = true;
CSettingsPageImpl<CAdvancedOptionsPage>::UpdatePageSettings();
stdstr File;
g_Settings->LoadStringVal(File_DiskIPLPath, File);
m_IplDir.SetWindowText(File.c_str());
m_InUpdateSettings = false;
}
void CAdvancedOptionsPage::SelectFile(LanguageStringID /*Title*/, CModifiedEditBox & EditBox)
{
const char * Filter = "64DD IPL ROM Image (*.zip, *.7z, *.?64, *.rom, *.usa, *.jap, *.pal, *.bin)\0*.?64;*.zip;*.7z;*.bin;*.rom;*.usa;*.jap;*.pal\0All files (*.*)\0*.*\0";
CPath FileName;
if (FileName.SelectFile(m_hWnd, g_Settings->LoadStringVal(RomList_GameDir).c_str(), Filter, true))
{
EditBox.SetChanged(true);
EditBox.SetWindowText(FileName);
SendMessage(GetParent(), PSM_CHANGED, (WPARAM)m_hWnd, 0);
}
}

View File

@ -24,8 +24,6 @@ class CAdvancedOptionsPage :
COMMAND_ID_HANDLER_EX(IDC_CHECK_RUNNING, CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_UNIQUE_SAVE_DIR, CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_DISPLAY_FRAMERATE, CheckBoxChanged)
COMMAND_ID_HANDLER_EX(IDC_SELECT_IPL_DIR, SelectIplDir)
COMMAND_HANDLER_EX(IDC_IPL_DIR, EN_UPDATE, IplDirChanged)
COMMAND_HANDLER_EX(IDC_FRAME_DISPLAY_TYPE,LBN_SELCHANGE,ComboBoxChanged)
END_MSG_MAP()
@ -42,11 +40,7 @@ public:
void ResetPage ( void );
private:
void SelectIplDir(UINT Code, int id, HWND ctl);
void IplDirChanged(UINT Code, int id, HWND ctl);
void UpdatePageSettings(void);
void SelectFile(LanguageStringID Title, CModifiedEditBox & EditBox);
CModifiedEditBox m_IplDir;
bool m_InUpdateSettings;
};

View File

@ -592,3 +592,4 @@ public:
#include "SettingsPage-KeyboardShortcuts.h"
#include "SettingsPage-Options.h"
#include "SettingsPage-Plugin.h"
#include "SettingsPage-DiskDrive.h"

View File

@ -131,12 +131,14 @@ LRESULT CSettingConfig::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*
m_GeneralOptionsPage = new CGeneralOptionsPage(this, this->m_hWnd, rcSettingInfo);
m_AdvancedPage = new CAdvancedOptionsPage(this->m_hWnd, rcSettingInfo);
m_DefaultsPage = new CDefaultsOptionsPage(this->m_hWnd, rcSettingInfo);
m_DiskDrivePage = new CDiskDrivePage(this->m_hWnd, rcSettingInfo);
SettingsSection = new CConfigSettingSection(wGS(TAB_OPTIONS).c_str());
SettingsSection->AddPage(m_GeneralOptionsPage);
SettingsSection->AddPage(m_AdvancedPage);
SettingsSection->AddPage(m_DefaultsPage);
SettingsSection->AddPage(new COptionsDirectoriesPage(this->m_hWnd, rcSettingInfo));
SettingsSection->AddPage(m_DiskDrivePage);
m_Sections.push_back(SettingsSection);
SettingsSection = new CConfigSettingSection(wGS(TAB_ROMSELECTION).c_str());

View File

@ -42,7 +42,7 @@ private:
CTreeViewCtrl m_PagesTreeList;
SETTING_SECTIONS m_Sections;
CSettingsPage * m_CurrentPage, *m_GeneralOptionsPage, *m_AdvancedPage, *m_DefaultsPage;
CSettingsPage * m_CurrentPage, *m_GeneralOptionsPage, *m_AdvancedPage, *m_DefaultsPage, *m_DiskDrivePage;
bool m_GameConfig;
bool m_bTVNSelChangedSupported;
};

View File

@ -343,9 +343,6 @@ BEGIN
CONTROL "Frame rate display",IDC_DISPLAY_FRAMERATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,113,86,10
COMBOBOX IDC_FRAME_DISPLAY_TYPE,101,112,99,57,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
CONTROL "Unique Game Save Directory",IDC_UNIQUE_SAVE_DIR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,98,189,10
EDITTEXT IDC_IPL_DIR,4,140,184,12,ES_AUTOHSCROLL
PUSHBUTTON "...",IDC_SELECT_IPL_DIR,194,140,14,12
LTEXT "64DD IPL ROM Path:",IDC_IPLDIR_TXT,6,130,145,10
CONTROL "Always use interpreter core",IDC_INTERPRETER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,53,191,10
END
@ -1368,6 +1365,24 @@ BEGIN
COMBOBOX IDC_CMB_VALUE,7,18,95,13,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
END
IDD_Settings_DiskDrive DIALOGEX 0, 0, 220, 155
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
EDITTEXT IDC_IPL_JP_DIR,7,20,184,12,ES_AUTOHSCROLL
PUSHBUTTON "...",IDC_SELECT_IPL_JP_DIR,197,20,14,12
LTEXT "Japanese 64DD IPL ROM Path:",IDC_IPLDIR_JP_TXT,9,10,145,10
EDITTEXT IDC_IPL_US_DIR,7,49,184,12,ES_AUTOHSCROLL
PUSHBUTTON "...",IDC_SELECT_IPL_US_DIR,197,49,14,12
LTEXT "American 64DD IPL ROM Path:",IDC_IPLDIR_US_TXT,9,38,145,10
EDITTEXT IDC_IPL_TL_DIR,7,78,184,12,ES_AUTOHSCROLL
PUSHBUTTON "...",IDC_SELECT_IPL_TL_DIR,197,78,14,12
LTEXT "Development 64DD IPL ROM Path:",IDC_IPLDIR_TL_TXT,9,67,145,10
LTEXT "Save File Type:",IDC_DISKSAVETYPE_TXT,9,106,83,10
COMBOBOX IDC_DISKSAVETYPE,95,104,115,30,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
END
/////////////////////////////////////////////////////////////////////////////
//
@ -1834,6 +1849,14 @@ BEGIN
TOPMARGIN, 7
BOTTOMMARGIN, 49
END
IDD_Settings_DiskDrive, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 213
TOPMARGIN, 7
BOTTOMMARGIN, 148
END
END
#endif // APSTUDIO_INVOKED

View File

@ -81,6 +81,7 @@
#define IDD_Enhancement_GS 205
#define IDD_Debugger_ExceptionBP 207
#define IDD_Debugger_Search_SetValue 210
#define IDD_Settings_DiskDrive 215
#define IDC_MENU_ITEM_TEXT 1000
#define IDC_CLOSE_BUTTON 1001
#define IDC_LIST2 1003
@ -685,6 +686,17 @@
#define IDC_CHK_UNSIGNED 1535
#define IDC_CHK_IGNORECASE 1536
#define IDC_CHK_UNKENCODING 1537
#define IDC_IPLDIR_JP_TXT 1538
#define IDC_IPL_JP_DIR 1539
#define IDC_SELECT_IPL_JP_DIR 1540
#define IDC_IPL_US_DIR 1541
#define IDC_SELECT_IPL_US_DIR 1542
#define IDC_IPLDIR_US_TXT 1543
#define IDC_IPL_TL_DIR 1544
#define IDC_SELECT_IPL_TL_DIR 1545
#define IDC_IPLDIR_TL_TXT 1546
#define IDC_DISKSAVETYPE_TXT 1547
#define IDC_DISKSAVETYPE 1548
#define ID_POPUPMENU_PLAYGAMEWITHDISK 40008
#define ID_POPUPMENU_ADDSYMBOL 40013
#define ID_POPUPMENU_VIEWDISASM 40017
@ -743,9 +755,9 @@
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 213
#define _APS_NEXT_RESOURCE_VALUE 219
#define _APS_NEXT_COMMAND_VALUE 40092
#define _APS_NEXT_CONTROL_VALUE 1538
#define _APS_NEXT_CONTROL_VALUE 1549
#define _APS_NEXT_SYMED_VALUE 102
#endif
#endif

View File

@ -29,25 +29,15 @@ int WINAPI WinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPSTR /
MainWindow.Show(true); //Show the main window
//N64 ROM or 64DD Disk
stdstr ext = CPath(g_Settings->LoadStringVal(Cmd_RomFile)).GetExtension();
if (!(_stricmp(ext.c_str(), "ndd") == 0))
if ((!(_stricmp(ext.c_str(), "ndd") == 0)) && (!(_stricmp(ext.c_str(), "d64") == 0)))
{
//File Extension is not *.ndd so it should be a N64 ROM
CN64System::RunFileImage(g_Settings->LoadStringVal(Cmd_RomFile).c_str());
}
else
{
//Ext is *.ndd, so it should be a disk file.
if (!CPath(g_Settings->LoadStringVal(File_DiskIPLPath)).Exists() || !g_BaseSystem->RunDiskImage(g_Settings->LoadStringVal(Cmd_RomFile).c_str()))
{
if (!CPath(g_Settings->LoadStringVal(File_DiskIPLPath)).Exists()) { g_Notify->DisplayWarning(MSG_IPL_REQUIRED); }
CPath FileNameIPL;
const char * Filter = "64DD IPL ROM Image (*.zip, *.7z, *.?64, *.rom, *.usa, *.jap, *.pal, *.bin)\0*.?64;*.zip;*.7z;*.bin;*.rom;*.usa;*.jap;*.pal\0All files (*.*)\0*.*\0";
if (FileNameIPL.SelectFile(NULL, g_Settings->LoadStringVal(RomList_GameDir).c_str(), Filter, true))
{
g_Settings->SaveString(File_DiskIPLPath, (const char *)FileNameIPL);
g_BaseSystem->RunDiskImage(g_Settings->LoadStringVal(Cmd_RomFile).c_str());
}
}
//Ext is *.ndd/*.d64, so it should be a disk file.
CN64System::RunDiskImage(g_Settings->LoadStringVal(Cmd_RomFile).c_str());
}
}
else