RAM initialization options: default (00 00 00 00 FF FF FF FF as always), all FF, all 00, random.

This commit is contained in:
rainwarrior 2016-08-24 22:42:21 +00:00
parent ed3783db55
commit 74139bf111
5 changed files with 56 additions and 15 deletions

View File

@ -73,6 +73,7 @@ extern int palsharpness;
extern int palcontrast; extern int palcontrast;
extern int palbrightness; extern int palbrightness;
extern bool paldeemphswap; extern bool paldeemphswap;
extern int RAMInitOption;
extern TASEDITOR_CONFIG taseditorConfig; extern TASEDITOR_CONFIG taseditorConfig;
extern char* recentProjectsArray[]; extern char* recentProjectsArray[];
@ -123,6 +124,9 @@ extern int HexFreezeColorB;
extern int RomFreezeColorR; extern int RomFreezeColorR;
extern int RomFreezeColorG; extern int RomFreezeColorG;
extern int RomFreezeColorB; extern int RomFreezeColorB;
extern int HexBoundColorR;
extern int HexBoundColorG;
extern int HexBoundColorB;
//adelikat: Hacky fix for Ram Watch recent menu //adelikat: Hacky fix for Ram Watch recent menu
char* ramWatchRecent[] = {0, 0, 0, 0, 0}; char* ramWatchRecent[] = {0, 0, 0, 0, 0};
@ -183,6 +187,7 @@ static CFGSTRUCT fceuconfig[] =
AC(ntsccol_enable),AC(ntsctint),AC(ntschue), AC(ntsccol_enable),AC(ntsctint),AC(ntschue),
AC(force_grayscale), AC(force_grayscale),
AC(dendy), AC(dendy),
AC(RAMInitOption),
AC(postrenderscanlines), AC(postrenderscanlines),
AC(vblankscanlines), AC(vblankscanlines),
AC(overclock_enabled), AC(overclock_enabled),
@ -444,6 +449,9 @@ static CFGSTRUCT fceuconfig[] =
AC(RomFreezeColorR), AC(RomFreezeColorR),
AC(RomFreezeColorG), AC(RomFreezeColorG),
AC(RomFreezeColorB), AC(RomFreezeColorB),
AC(HexBoundColorR),
AC(HexBoundColorG),
AC(HexBoundColorB),
//ACS(memwLastfile[2048]), //ACS(memwLastfile[2048]),
AC(AutoRWLoad), AC(AutoRWLoad),

View File

@ -1871,6 +1871,13 @@ BEGIN
MENUITEM "Old PPU", ID_OLDPPU MENUITEM "Old PPU", ID_OLDPPU
MENUITEM "New PPU", ID_NEWPPU MENUITEM "New PPU", ID_NEWPPU
END END
POPUP "RAM Init"
BEGIN
MENUITEM "&Default", MENU_RAMINIT_DEFAULT
MENUITEM "Fill $&FF", MENU_RAMINIT_FF
MENUITEM "Fill $&00", MENU_RAMINIT_00
MENUITEM "&Random", MENU_RAMINIT_RANDOM
END
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "&Directories...", MENU_DIRECTORIES MENUITEM "&Directories...", MENU_DIRECTORIES
MENUITEM "&GUI...", MENU_GUI_OPTIONS MENUITEM "&GUI...", MENU_GUI_OPTIONS

View File

@ -1229,6 +1229,10 @@
#define MENU_MV_FILE_DUMP_64K 40590 #define MENU_MV_FILE_DUMP_64K 40590
#define ID_CONFIG_REGION 40591 #define ID_CONFIG_REGION 40591
#define MENU_MV_FILE_DUMP_OAM 40592 #define MENU_MV_FILE_DUMP_OAM 40592
#define MENU_RAMINIT_DEFAULT 40593
#define MENU_RAMINIT_FF 40594
#define MENU_RAMINIT_00 40595
#define MENU_RAMINIT_RANDOM 40596
#define IDC_DEBUGGER_ICONTRAY 55535 #define IDC_DEBUGGER_ICONTRAY 55535
#define MW_ValueLabel2 65423 #define MW_ValueLabel2 65423
#define MW_ValueLabel1 65426 #define MW_ValueLabel1 65426

View File

@ -121,6 +121,7 @@ extern int newppu;
extern BOOL CALLBACK ReplayMetadataDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); //Metadata dialog extern BOOL CALLBACK ReplayMetadataDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); //Metadata dialog
extern bool CheckFileExists(const char* filename); //Receives a filename (fullpath) and checks to see if that file exists extern bool CheckFileExists(const char* filename); //Receives a filename (fullpath) and checks to see if that file exists
extern bool oldInputDisplay; extern bool oldInputDisplay;
extern int RAMInitOption;
//AutoFire----------------------------------------------- //AutoFire-----------------------------------------------
void ShowNetplayConsole(void); //mbg merge 7/17/06 YECH had to add void ShowNetplayConsole(void); //mbg merge 7/17/06 YECH had to add
@ -453,6 +454,9 @@ void UpdateCheckedMenuItems()
else else
CheckMenuRadioItem(fceumenu, MENU_NTSC, MENU_DENDY, MENU_NTSC, MF_BYCOMMAND); CheckMenuRadioItem(fceumenu, MENU_NTSC, MENU_DENDY, MENU_NTSC, MF_BYCOMMAND);
//Config - RAM Init SubMenu
CheckMenuRadioItem(fceumenu, MENU_RAMINIT_DEFAULT, MENU_RAMINIT_RANDOM, MENU_RAMINIT_DEFAULT + RAMInitOption, MF_BYCOMMAND);
// Tools Menu // Tools Menu
CheckMenuItem(fceumenu, MENU_ALTERNATE_AB, GetAutoFireDesynch() ? MF_CHECKED : MF_UNCHECKED); CheckMenuItem(fceumenu, MENU_ALTERNATE_AB, GetAutoFireDesynch() ? MF_CHECKED : MF_UNCHECKED);
CheckedAutoFirePattern = GetCheckedAutoFirePattern(); CheckedAutoFirePattern = GetCheckedAutoFirePattern();
@ -1994,6 +1998,13 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
case MENU_DENDY: case MENU_DENDY:
FCEUI_SetRegion(2); FCEUI_SetRegion(2);
break; break;
case MENU_RAMINIT_DEFAULT:
case MENU_RAMINIT_FF:
case MENU_RAMINIT_00:
case MENU_RAMINIT_RANDOM:
RAMInitOption = LOWORD(wParam) - MENU_RAMINIT_DEFAULT;
UpdateCheckedMenuItems();
break;
case MENU_DIRECTORIES: case MENU_DIRECTORIES:
ConfigDirectories(); ConfigDirectories();
break; break;

View File

@ -797,17 +797,35 @@ void ResetNES(void) {
FCEU_DispMessage("Reset", 0); FCEU_DispMessage("Reset", 0);
} }
int RAMInitOption = 0;
// Note: this option does not currently apply to WRAM.
// Would it be appropriate to call FCEU_MemoryRand inside FCEU_gmalloc to initialize them?
void FCEU_MemoryRand(uint8 *ptr, uint32 size) { void FCEU_MemoryRand(uint8 *ptr, uint32 size) {
int x = 0; int x = 0;
while (size) { while (size) {
*ptr = (x & 4) ? 0xFF : 0x00; // Huang Di DEBUG MODE enabled by default uint8 v = 0;
// Cybernoid NO MUSIC by default switch (RAMInitOption)
// *ptr = (x & 4) ? 0x7F : 0x00; // Huang Di DEBUG MODE enabled by default {
// Minna no Taabou no Nakayoshi Daisakusen DOESN'T BOOT default:
// Cybernoid NO MUSIC by default case 0: v = (x & 4) ? 0xFF : 0x00; break;
// *ptr = (x & 1) ? 0x55 : 0xAA; // F-15 Sity War HISCORE is screwed... case 1: v = 0xFF; break;
// 1942 SCORE/HISCORE is screwed... case 2: v = 0x00; break;
// *ptr = 0xFF; // Work for all cases case 3: v = uint8(rand()); break;
// the default is this 8 byte pattern: 00 00 00 00 FF FF FF FF
// it has been used in FCEUX since time immemorial
// Some games to examine uninitialied RAM problems with:
// * Cybernoid - music option starts turned off with default pattern
// * Huang Di - debug mode is enabled with default pattern
// * Minna no Taabou no Nakayoshi Daisakusen - fails to boot with some patterns
// * F-15 City War - high score table
// * 1942 - high score table
// * Cheetahmen II - may start in different levels with different RAM startup
}
*ptr = v;
x++; x++;
size--; size--;
ptr++; ptr++;
@ -826,13 +844,6 @@ void PowerNES(void) {
FCEU_GeniePower(); FCEU_GeniePower();
//dont do this, it breaks some games: Cybernoid; Minna no Taabou no Nakayoshi Daisakusen; and maybe mechanized attack
//memset(RAM,0xFF,0x800);
//this fixes the above, but breaks Huang Di, which expects $100 to be non-zero or else it believes it has debug cheats enabled, giving you moon jump and other great but likely unwanted things
//FCEU_MemoryRand(RAM,0x800);
//this should work better, based on observational evidence. fixes all of the above:
//for(int i=0;i<0x800;i++) if(i&1) RAM[i] = 0xAA; else RAM[i] = 0x55;
//but we're leaving this for now until we collect some more data
FCEU_MemoryRand(RAM, 0x800); FCEU_MemoryRand(RAM, 0x800);
SetReadHandler(0x0000, 0xFFFF, ANull); SetReadHandler(0x0000, 0xFFFF, ANull);