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,11 +214,22 @@ int GetPRGAddress(int A){
int result; int result;
if(A > 0xFFFF) if(A > 0xFFFF)
return -1; return -1;
result = &Page[A>>11][A]-PRGptr[0]; if (GameInfo->type == GIT_FDS) {
if((result > (int)PRGsize[0]) || (result < 0)) if (A >= 0xE000)
return -1; return -1;
else result = &Page[A >> 11][A] - PRGptr[1];
return result; 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;
}
} }
/** /**
@ -481,13 +492,25 @@ void LogCDData(uint8 *opcode, uint16 A, int size) {
} }
if((j = GetPRGAddress(A)) != -1) { if((j = GetPRGAddress(A)) != -1) {
if(!(cdloggerdata[j] & 2)) { if (opwrite[opcode[0]] == 0) {
cdloggerdata[j] |= 2; if (!(cdloggerdata[j] & 2)) {
cdloggerdata[j] |=(A>>11)&0x0c; cdloggerdata[j] |= 2;
cdloggerdata[j] |= memop; cdloggerdata[j] |= (A >> 11) & 0x0c;
datacount++; cdloggerdata[j] |= memop;
if(!(cdloggerdata[j] & 1))undefinedcount--; 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); 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++){ for(i = 0; i < (int)cdloggerdataSize; i++){
unsigned char pchar; unsigned char pchar;
if(cdloggerdata[i] & 3) if(cdloggerdata[i] & 3)
pchar = invert?0:PRGptr[0][i]; pchar = invert?0:PRGptr[rom_sel][i];
else else
pchar = invert?PRGptr[0][i]:0; pchar = invert?PRGptr[rom_sel][i]:0;
fputc(pchar, fp); fputc(pchar, fp);
} }
@ -555,7 +559,10 @@ void FreeCDLog()
void InitCDLog() 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); 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 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]; cdloggerVideoDataSize = CHRsize[0];