0.9.39-2 : cdc and cpu

This commit is contained in:
zeromus 2020-04-05 23:48:26 -04:00
parent d2d4a41544
commit 51efb03419
5 changed files with 37 additions and 8 deletions

View File

@ -110,4 +110,9 @@
[OK] psx/timer : (c), comments
0.9.39-unstable -> 0.9.39-1
[NO] mednafen : just org stuff
[??] cdrom/ccd : something about track AA
[??] cdrom/ccd : something about track AA
0.9.39-1 -> 0.9.39-2
[NO] drivers/main : nothing useful
[NO] mednafen : nothing useful
[OK] psx/cdc : loadstate, type change
[OK] psx/cpu : type change, loadstate tweak. ATTN: note about GTE_StateAction

View File

@ -368,6 +368,22 @@ SYNCFUNC(PS_CDC)
NSS(ReportLastF);
//(%= crap about file format recovery in case SectorPipe_Pos changes)
if(isReader)
{
if(AudioBuffer.Size > sizeof(AudioBuffer.Samples[0]) / sizeof(AudioBuffer.Samples[0][0]))
AudioBuffer.Size = sizeof(AudioBuffer.Samples[0]) / sizeof(AudioBuffer.Samples[0][0]);
if(AudioBuffer.ReadPos > AudioBuffer.Size)
AudioBuffer.ReadPos = AudioBuffer.Size;
ResultsRP &= 0xF;
ResultsWP &= 0xF;
ResultsIn &= 0x1F;
ADPCM_ResampCurPos &= 0x1F;
ADPCM_ResampCurPhase %= 7;
}
}
void PS_CDC::ResetTS(void)

View File

@ -13,9 +13,9 @@ namespace MDFN_IEN_PSX
struct CD_Audio_Buffer
{
int16 Samples[2][0x1000]; // [0][...] = l, [1][...] = r
int32 Size;
uint32 Size;
uint32 Freq;
int32 ReadPos;
uint32 ReadPos;
};
class PS_CDC

View File

@ -102,7 +102,7 @@ void PS_CPU::SetFastMap(void *region_mem, uint32 region_address, uint32 region_s
for(uint64 A = region_address; A < (uint64)region_address + region_size; A += FAST_MAP_PSIZE)
{
FastMap[A >> FAST_MAP_SHIFT] = ((uint8 *)region_mem - region_address);
FastMap[A >> FAST_MAP_SHIFT] = ((uintptr_t)region_mem - region_address);
}
}
@ -433,13 +433,13 @@ INLINE uint32 PS_CPU::ReadInstruction(pscpu_timestamp_t &timestamp, uint32 addre
if(address >= 0xA0000000 || !(BIU & 0x800))
{
instr = MDFN_de32lsb<true>(&FastMap[address >> FAST_MAP_SHIFT][address]);
instr = MDFN_de32lsb<true>((uint8*)(FastMap[address >> FAST_MAP_SHIFT] + address));
timestamp += 4; // Approximate best-case cache-disabled time, per PS1 tests(executing out of 0xA0000000+); it can be 5 in *some* sequences of code(like a lot of sequential "nop"s, probably other simple instructions too).
}
else
{
__ICache *ICI = &ICache[((address & 0xFF0) >> 2)];
const uint8 *FMP = &FastMap[(address & 0xFFFFFFF0) >> FAST_MAP_SHIFT][address & 0xFFFFFFF0];
const uint8 *FMP = (uint8*)(FastMap[(address & 0xFFFFFFF0) >> FAST_MAP_SHIFT] + (address & 0xFFFFFFF0));
// | 0x2 to simulate (in)validity bits.
ICI[0x00].TV = (address & 0xFFFFFFF0) | 0x0 | 0x2;
@ -669,7 +669,7 @@ pscpu_timestamp_t PS_CPU::RunReal(pscpu_timestamp_t timestamp_in)
{ \
if(old_PC == (((new_PC - 4) & mask) + offset)) \
{ \
if(MDFN_densb<uint32, true>(&FastMap[PC >> FAST_MAP_SHIFT][PC]) == 0) \
if(MDFN_densb<uint32, true>((uint8*)(FastMap[PC >> FAST_MAP_SHIFT] + PC)) == 0) \
{ \
if(next_event_ts > timestamp) /* Necessary since next_event_ts might be set to something like "0" to force a call to the event handler. */ \
{ \
@ -2806,6 +2806,14 @@ SYNCFUNC(PS_CPU)
NSS(ScratchRAM.data8);
//ZERO - REMINDER - GTE_StateAction was here. is it important?
if(isReader)
{
ReadAbsorbWhich &= 0x1F;
BACKED_LDWhich %= 0x21;
}
} //SYNCFUNC(CPU)
} //namespace MDFN_IEN_PSX

View File

@ -201,7 +201,7 @@ class PS_CPU
//PS_GTE GTE;
uint8 *FastMap[1 << (32 - FAST_MAP_SHIFT)];
uintptr_t FastMap[1 << (32 - FAST_MAP_SHIFT)];
uint8 DummyPage[FAST_MAP_PSIZE];
enum