Added "AllowROMWrites" RDB setting, DMA READ to ROM and updated RDB file

This commit is contained in:
LuigiBlood 2015-05-14 14:34:45 +02:00 committed by luigiblood
parent e4310dafdd
commit 61c7f5ed78
4 changed files with 58 additions and 3 deletions

View File

@ -2806,6 +2806,7 @@ Core Note=Saves not supported
Counter Factor=1
RDRAM Size=8
Sync Audio=0
AllowROMWrites=Yes
[69256460-B9A3F586-C:45]
Good Name=Jeopardy! (U)
@ -3139,20 +3140,22 @@ RDRAM Size=8
Save Type=16kbit Eeprom
[0837F87A-D1436FF8-C:4A]
Good Name=Kyojin no Doshin 1 (J) [CART HACK]
Good Name=Kyojin no Doshin (J) [CART HACK]
Status=Issues (core)
Core Note=Saves not supported
Counter Factor=1
RDRAM Size=8
Sync Audio=0
AllowROMWrites=Yes
[E7BDA0BE-ADA09CAC-C:4A]
Good Name=Kyojin no Doshin 1 (J) (Kiosk Demo) [CART HACK]
Good Name=Kyojin no Doshin (J) (Kiosk Demo) [CART HACK]
Status=Issues (core)
Core Note=Saves not supported
Counter Factor=1
RDRAM Size=8
Sync Audio=0
AllowROMWrites=Yes
[8C47CE8B-06019FEF-C:4A]
Good Name=Kyojin no Doshin - Kaihou Sensen Chibikko Chikko Daishuugou (J) [CART HACK]
@ -3161,6 +3164,7 @@ Core Note=Saves not supported
Counter Factor=1
RDRAM Size=8
Sync Audio=0
AllowROMWrites=Yes
//================ L ================
[7F304099-52CF5276-C:4A]
@ -3354,12 +3358,13 @@ Status=Issues (plugin)
Plugin Note=[video] slow; use 1.6 plugin (see GameFAQ)
[AB9EB27D-5F05605F-C:4A]
Good Name=Mario Artist - Communications Kit (J) [CART HACK]
Good Name=Mario Artist - Communication Kit (J) [CART HACK]
Status=Issues (core)
Core Note=Saves not supported
Counter Factor=1
RDRAM Size=8
Sync Audio=0
AllowROMWrites=Yes
[3A3EB7FB-0DDD515C-C:4A]
Good Name=Mario Artist - Paint Studio (J) [CART HACK]
@ -3368,6 +3373,7 @@ Core Note=Saves not supported
Counter Factor=1
RDRAM Size=8
Sync Audio=0
AllowROMWrites=Yes
[2D5EFCC5-98CF79D2-C:4A]
Good Name=Mario Artist - Polygon Studio (J) [CART HACK]
@ -3375,6 +3381,7 @@ Status=Issues (core)
Core Note=Saves not supported
Counter Factor=1
RDRAM Size=8
AllowROMWrites=Yes
[4CBC3B56-FDB69B1C-C:4A]
Good Name=Mario Artist - Talent Studio (J) [CART HACK]
@ -3384,6 +3391,7 @@ Core Note=Saves not supported
Counter Factor=1
RDRAM Size=8
Sync Audio=0
AllowROMWrites=Yes
[62E957D0-7FC15A5D-C:50]
Good Name=Mario Golf (E)

View File

@ -48,6 +48,47 @@ void CDMA::PI_DMA_READ()
return;
}
if (g_Reg->PI_CART_ADDR_REG >= 0x10000000 && g_Reg->PI_CART_ADDR_REG <= 0x1FBFFFFF && g_Settings->LoadBool(Game_AllowROMWrites))
{
DWORD i;
BYTE * ROM = g_Rom->GetRomAddress();
BYTE * RDRAM = g_MMU->Rdram();
DWORD OldProtect;
VirtualProtect(ROM, g_Rom->GetRomSize(), PAGE_READWRITE, &OldProtect);
g_Reg->PI_CART_ADDR_REG -= 0x10000000;
if (g_Reg->PI_CART_ADDR_REG + g_Reg->PI_RD_LEN_REG < g_Rom->GetRomSize())
{
for (i = 0; i < g_Reg->PI_RD_LEN_REG; i++)
{
*(ROM + ((g_Reg->PI_CART_ADDR_REG + i) ^ 3)) = *(RDRAM + ((g_Reg->PI_DRAM_ADDR_REG + i) ^ 3));
}
}
else
{
DWORD Len;
Len = g_Rom->GetRomSize() - g_Reg->PI_CART_ADDR_REG;
for (i = 0; i < Len; i++)
{
*(ROM + ((g_Reg->PI_CART_ADDR_REG + i) ^ 3)) = *(RDRAM + ((g_Reg->PI_DRAM_ADDR_REG + i) ^ 3));
}
}
g_Reg->PI_CART_ADDR_REG += 0x10000000;
if (!g_System->DmaUsed())
{
g_System->SetDmaUsed(true);
OnFirstDMA();
}
if (g_Recompiler && g_System->bSMM_PIDMA())
{
g_Recompiler->ClearRecompCode_Phys(g_Reg->PI_DRAM_ADDR_REG, g_Reg->PI_WR_LEN_REG, CRecompiler::Remove_DMA);
}
VirtualProtect(ROM, g_Rom->GetRomSize(), PAGE_READONLY, &OldProtect);
}
if ( g_Reg->PI_CART_ADDR_REG >= 0x08000000 && g_Reg->PI_CART_ADDR_REG <= 0x08010000)
{
if (g_System->m_SaveUsing == SaveChip_Auto)
@ -151,6 +192,7 @@ void CDMA::PI_DMA_WRITE()
if ( g_Reg->PI_CART_ADDR_REG >= 0x10000000 && g_Reg->PI_CART_ADDR_REG <= 0x1FBFFFFF)
{
DWORD i;
#ifdef tofix
#ifdef ROM_IN_MAPSPACE
if (WrittenToRom)
@ -160,6 +202,7 @@ void CDMA::PI_DMA_WRITE()
}
#endif
#endif
BYTE * ROM = g_Rom->GetRomAddress();
BYTE * RDRAM = g_MMU->Rdram();
g_Reg->PI_CART_ADDR_REG -= 0x10000000;

View File

@ -96,6 +96,7 @@ enum SettingID {
Rdb_ViRefreshRate,
Rdb_AiCountPerBytes,
Rdb_AudioResetOnLoad,
Rdb_AllowROMWrites,
//Individual Game Settings
Game_IniKey,
@ -141,6 +142,7 @@ enum SettingID {
Game_ViRefreshRate,
Game_AiCountPerBytes,
Game_AudioResetOnLoad,
Game_AllowROMWrites,
// General Game running info
GameRunning_LoadingInProgress,

View File

@ -168,6 +168,7 @@ void CSettings::AddHowToHandleSetting ()
AddHandler(Rdb_ViRefreshRate, new CSettingTypeRomDatabase("ViRefresh",1500));
AddHandler(Rdb_AiCountPerBytes, new CSettingTypeRomDatabase("AiCountPerBytes",400));
AddHandler(Rdb_AudioResetOnLoad, new CSettingTypeRDBYesNo("AudioResetOnLoad", false));
AddHandler(Rdb_AllowROMWrites, new CSettingTypeRDBYesNo("AllowROMWrites", false));
AddHandler(Game_IniKey, new CSettingTypeTempString(""));
AddHandler(Game_GameName, new CSettingTypeTempString(""));
@ -212,6 +213,7 @@ void CSettings::AddHowToHandleSetting ()
AddHandler(Game_ViRefreshRate, new CSettingTypeGame("ViRefresh",Rdb_ViRefreshRate));
AddHandler(Game_AiCountPerBytes, new CSettingTypeGame("AiCountPerBytes",Rdb_AiCountPerBytes));
AddHandler(Game_AudioResetOnLoad, new CSettingTypeGame("AudioResetOnLoad", Rdb_AudioResetOnLoad));
AddHandler(Game_AllowROMWrites, new CSettingTypeGame("AllowROMWrites", Rdb_AllowROMWrites));
//User Interface
AddHandler(UserInterface_BasicMode, new CSettingTypeApplication("","Basic Mode", (DWORD)true));