little fix to more correct fds cdl

This commit is contained in:
g0me3 2021-05-07 20:11:01 +02:00
parent 0b689d65c4
commit a4fa6225a0
2 changed files with 45 additions and 15 deletions

View File

@ -214,12 +214,23 @@ int GetPRGAddress(int A){
int result;
if(A > 0xFFFF)
return -1;
if (GameInfo->type == GIT_FDS) {
if (A >= 0xE000)
return -1;
result = &Page[A >> 11][A] - PRGptr[1];
if ((result > (int)PRGsize[1]) || (result < 0))
return -1;
else
return result;
}
else {
result = &Page[A >> 11][A] - PRGptr[0];
if ((result > (int)PRGsize[0]) || (result < 0))
return -1;
else
return result;
}
}
/**
* Returns the bank for a given offset.
@ -481,6 +492,7 @@ void LogCDData(uint8 *opcode, uint16 A, int size) {
}
if((j = GetPRGAddress(A)) != -1) {
if (opwrite[opcode[0]] == 0) {
if (!(cdloggerdata[j] & 2)) {
cdloggerdata[j] |= 2;
cdloggerdata[j] |= (A >> 11) & 0x0c;
@ -488,6 +500,17 @@ void LogCDData(uint8 *opcode, uint16 A, int size) {
datacount++;
if (!(cdloggerdata[j] & 1))undefinedcount--;
}
} /* else {
if (cdloggerdata[j] & 1) {
codecount--;
if (!(cdloggerdata[j] & 2))undefinedcount--;
}
if (cdloggerdata[j] & 2) {
datacount--;
if (!(cdloggerdata[j] & 1))undefinedcount--;
}
cdloggerdata[j] = 0;
} */
}
}

View File

@ -448,12 +448,16 @@ void SaveStrippedROM(int invert)
fwrite(&cdlhead,1,16,fp);
int rom_sel = 0;
if (GameInfo->type == GIT_FDS)
rom_sel = 1;
cdloggerdataSize = PRGsize[rom_sel];
for(i = 0; i < (int)cdloggerdataSize; i++){
unsigned char pchar;
if(cdloggerdata[i] & 3)
pchar = invert?0:PRGptr[0][i];
pchar = invert?0:PRGptr[rom_sel][i];
else
pchar = invert?PRGptr[0][i]:0;
pchar = invert?PRGptr[rom_sel][i]:0;
fputc(pchar, fp);
}
@ -555,7 +559,10 @@ void FreeCDLog()
void InitCDLog()
{
cdloggerdataSize = PRGsize[0];
int rom_sel = 0;
if (GameInfo->type == GIT_FDS)
rom_sel = 1;
cdloggerdataSize = PRGsize[rom_sel];
cdloggerdata = (unsigned char*)malloc(cdloggerdataSize);
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];