CDLogger VRAM issue fix
This commit is contained in:
parent
cc8e3e0e0c
commit
fe057f4bfd
|
@ -246,7 +246,7 @@ static void UNLOneBusPower(void) {
|
|||
memset(ppu201x, 0x00, sizeof(ppu201x));
|
||||
memset(apu40xx, 0x00, sizeof(apu40xx));
|
||||
|
||||
SetupCartCHRMapping(0, PRGptr[0], PRGsize[0], 0);
|
||||
SetupCartCHRMapping(0, PRGptr[0], PRGsize[0], 1); // Actually, one bus have special flag to that, but some roms haven't using it at all, so hack applied
|
||||
|
||||
for (i = 0; i < 64; i++) {
|
||||
defapuread[i] = GetReadHandler(0x4000 | i);
|
||||
|
|
|
@ -46,8 +46,8 @@ uint8 *MMC5BGVPage[8];
|
|||
static uint8 PRGIsRAM[32]; /* This page is/is not PRG RAM. */
|
||||
|
||||
/* 16 are (sort of) reserved for UNIF/iNES and 16 to map other stuff. */
|
||||
static int CHRram[32];
|
||||
static int PRGram[32];
|
||||
uint8 CHRram[32];
|
||||
uint8 PRGram[32];
|
||||
|
||||
uint8 *PRGptr[32];
|
||||
uint8 *CHRptr[32];
|
||||
|
|
|
@ -34,6 +34,9 @@ DECLFR(CartBROB);
|
|||
DECLFR(CartBR);
|
||||
DECLFW(CartBW);
|
||||
|
||||
extern uint8 PRGram[32];
|
||||
extern uint8 CHRram[32];
|
||||
|
||||
extern uint8 *PRGptr[32];
|
||||
extern uint8 *CHRptr[32];
|
||||
|
||||
|
|
|
@ -451,12 +451,12 @@ void SaveStrippedROM(int invert)
|
|||
cdlhead.ID[2] = 'S';
|
||||
cdlhead.ID[3] = 0x1A;
|
||||
|
||||
cdlhead.ROM_size = PRGsize[0] >> 14;
|
||||
cdlhead.VROM_size = CHRsize[0] >> 13;
|
||||
cdlhead.ROM_size = cdloggerdataSize >> 14;
|
||||
cdlhead.VROM_size = cdloggerVideoDataSize >> 13;
|
||||
|
||||
fwrite(&cdlhead,1,16,fp);
|
||||
|
||||
for(i = 0; i < (int)PRGsize[0]; i++){
|
||||
for(i = 0; i < (int)cdloggerdataSize; i++){
|
||||
unsigned char pchar;
|
||||
if(cdloggerdata[i] & 3)
|
||||
pchar = invert?0:PRGptr[0][i];
|
||||
|
@ -468,7 +468,7 @@ void SaveStrippedROM(int invert)
|
|||
if(cdloggerVideoDataSize != 0)
|
||||
{
|
||||
// since the OldPPU at least logs the $2007 read accesses, we should save the data anyway
|
||||
for(i = 0; i < (int)CHRsize[0]; i++) {
|
||||
for(i = 0; i < (int)cdloggerVideoDataSize; i++) {
|
||||
unsigned char vchar;
|
||||
if(cdloggervdata[i] & 3)
|
||||
vchar = invert?0:CHRptr[0][i];
|
||||
|
@ -511,15 +511,6 @@ void CDLoggerROMChanged()
|
|||
strcat(nameo, GetRomName());
|
||||
strcat(nameo, ".cdl");
|
||||
|
||||
/*
|
||||
// if the new CDL is the same (and arrays size is the same), don't do anything
|
||||
if (hCDLogger
|
||||
&& strcmp(loadedcdfile, nameo) == 0
|
||||
&& PRGsize[0] == cdloggerdataSize
|
||||
&& CHRsize[0] == cdloggerVideoDataSize)
|
||||
return;
|
||||
*/
|
||||
|
||||
FILE *FP;
|
||||
FP = fopen(nameo, "rb");
|
||||
if (FP != NULL)
|
||||
|
@ -532,6 +523,7 @@ void CDLoggerROMChanged()
|
|||
StartCDLogging();
|
||||
}
|
||||
}
|
||||
|
||||
void CDLoggerPPUChanged()
|
||||
{
|
||||
if (newppu)
|
||||
|
@ -553,6 +545,7 @@ bool PauseCDLogging()
|
|||
SetDlgItemText(hCDLogger, BTN_CDLOGGER_START_PAUSE, "Start");
|
||||
return true;
|
||||
}
|
||||
|
||||
void StartCDLogging()
|
||||
{
|
||||
FCEUI_SetLoggingCD(1);
|
||||
|
@ -575,14 +568,18 @@ void FreeCDLog()
|
|||
cdloggerVideoDataSize = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void InitCDLog()
|
||||
{
|
||||
cdloggerdataSize = PRGsize[0];
|
||||
cdloggerdata = (unsigned char*)malloc(cdloggerdataSize);
|
||||
cdloggerVideoDataSize = CHRsize[0];
|
||||
if(cdloggerVideoDataSize != 0)
|
||||
if(!CHRram[0] || (CHRptr[0] == PRGptr[0])) { // Some kind of workaround for my OneBus VRAM hack, will remove it if I find another solution for that
|
||||
cdloggerVideoDataSize = CHRsize[0];
|
||||
cdloggervdata = (unsigned char*)malloc(cdloggerVideoDataSize);
|
||||
} else
|
||||
cdloggerVideoDataSize = 0;
|
||||
}
|
||||
|
||||
void ResetCDLog()
|
||||
{
|
||||
codecount = datacount = rendercount = vromreadcount = 0;
|
||||
|
@ -594,6 +591,7 @@ void ResetCDLog()
|
|||
ZeroMemory(cdloggervdata, cdloggerVideoDataSize);
|
||||
}
|
||||
}
|
||||
|
||||
void RenameCDLog(const char* newName)
|
||||
{
|
||||
strcpy(loadedcdfile, newName);
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Íåéòðàëüíûé resources
|
||||
// Neutral resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
|
||||
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
||||
|
@ -1582,7 +1582,7 @@ FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
|||
BEGIN
|
||||
PUSHBUTTON "Load...",BTN_CDLOGGER_LOAD,7,122,50,14
|
||||
PUSHBUTTON "Save",BTN_CDLOGGER_SAVE,249,105,50,14
|
||||
GROUPBOX "Code/Data Log Status",ID_CDL,3,5,300,195,BS_CENTER
|
||||
GROUPBOX "Code/Data Log Status",-1,3,5,300,195,BS_CENTER
|
||||
DEFPUSHBUTTON "Start",BTN_CDLOGGER_START_PAUSE,127,105,50,14
|
||||
GROUPBOX "Address Label Logger",65534,3,201,300,49,BS_CENTER
|
||||
PUSHBUTTON "Load...",111,7,231,50,14,WS_DISABLED
|
||||
|
@ -1597,8 +1597,8 @@ BEGIN
|
|||
LTEXT "Itsa me, the Code/Data Logger! Press Start to play!",65530,67,78,172,11
|
||||
PUSHBUTTON "Reset Log",BTN_CDLOGGER_RESET,7,105,50,14
|
||||
PUSHBUTTON "Save as...",BTN_CDLOGGER_SAVE_AS,250,122,50,14
|
||||
PUSHBUTTON "Save Stripped Data...",BTN_CDLOGGER_SAVE_STRIPPED,204,158,90,14
|
||||
PUSHBUTTON "Save Unused Data...",BTN_CDLOGGER_SAVE_UNUSED,204,175,90,14
|
||||
PUSHBUTTON "Save Stripped Data...",BTN_CDLOGGER_SAVE_STRIPPED,196,155,90,14
|
||||
PUSHBUTTON "Save Unused Data...",BTN_CDLOGGER_SAVE_UNUSED,196,172,90,14
|
||||
LTEXT "4067 - 29.5%",LBL_CDLOGGER_RENDERCOUNT,34,56,72,11
|
||||
GROUPBOX "CHR Rendered",ID_CHR1,25,45,84,27
|
||||
GROUPBOX "CHR Logged as Data",ID_CHR2,113,45,84,27
|
||||
|
@ -1611,10 +1611,10 @@ BEGIN
|
|||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,179,153,11
|
||||
CONTROL " Auto-save .CDL when closing ROMs",IDC_AUTOSAVECDL,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,153,143,11
|
||||
CONTROL " Auto-load .CDL when opening the window",IDC_AUTOLOADCDL,
|
||||
CONTROL " Auto-load .CDL when opening this window",IDC_AUTOLOADCDL,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,166,154,11
|
||||
GROUPBOX "Generate ROM",ID_CDL,199,148,99,46
|
||||
GROUPBOX "Logging workflow options",ID_CDL,8,142,162,52
|
||||
GROUPBOX "Generate ROM",65529,183,142,116,52
|
||||
GROUPBOX "Logging workflow options",65528,8,142,171,52
|
||||
END
|
||||
|
||||
PPUVIEW DIALOGEX 44, 38, 355, 246
|
||||
|
@ -2134,12 +2134,12 @@ BEGIN
|
|||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#endif // Íåéòðàëüíûé resources
|
||||
#endif // Neutral resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Ðóññêèé (Ðîññèÿ) resources
|
||||
// Russian (Russia) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
|
||||
LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
|
||||
|
@ -2192,12 +2192,12 @@ BEGIN
|
|||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#endif // Ðóññêèé (Ðîññèÿ) resources
|
||||
#endif // Russian (Russia) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Àíãëèéñêèé (ÑØÀ) resources
|
||||
// English (United States) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
|
@ -2431,7 +2431,7 @@ IDB_BITMAP_SELECTED17 BITMAP "res\\te_17_selected.bmp"
|
|||
IDB_BITMAP_SELECTED18 BITMAP "res\\te_18_selected.bmp"
|
||||
IDB_BITMAP_SELECTED19 BITMAP "res\\te_19_selected.bmp"
|
||||
IDB_BRANCH_SPRITESHEET BITMAP "res\\branch_spritesheet.bmp"
|
||||
#endif // Àíãëèéñêèé (ÑØÀ) resources
|
||||
#endif // English (United States) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
|
14
src/ppu.cpp
14
src/ppu.cpp
|
@ -441,12 +441,14 @@ unsigned char *cdloggervdata;
|
|||
unsigned int cdloggerVideoDataSize = 0;
|
||||
|
||||
int GetCHRAddress(int A){
|
||||
int result;
|
||||
if((A > 0x1fff))return -1;
|
||||
if(CHRsize[0] == 0)return -1;
|
||||
result = &VPage[A>>10][A]-CHRptr[0];
|
||||
if((result > (int)CHRsize[0]) || (result < 0))return -1;
|
||||
else return result;
|
||||
if(A < 0x2000) { // Mapper 90 can map nametables from the VROM
|
||||
if(cdloggerVideoDataSize) {
|
||||
int result = &VPage[A>>10][A] - CHRptr[0];
|
||||
if((result >= 0) && (result < (int)cdloggerVideoDataSize))
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
uint8 FASTCALL FFCEUX_PPURead_Default(uint32 A) {
|
||||
|
|
Loading…
Reference in New Issue