psx - update to mednafen 0.9.38.4
This commit is contained in:
parent
e2aabbab60
commit
f2c62161a9
Binary file not shown.
|
@ -218,6 +218,22 @@ INLINE T PS_CPU::PeekMemory(uint32 address)
|
|||
return(ret);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void PS_CPU::PokeMemory(uint32 address, T value)
|
||||
{
|
||||
address &= addr_mask[address >> 29];
|
||||
|
||||
if(address >= 0x1F800000 && address <= 0x1F8003FF)
|
||||
return ScratchRAM.Write<T>(address & 0x3FF, value);
|
||||
|
||||
if(sizeof(T) == 1)
|
||||
PSX_MemPoke8(address, value);
|
||||
else if(sizeof(T) == 2)
|
||||
PSX_MemPoke16(address, value);
|
||||
else
|
||||
PSX_MemPoke32(address, value);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
INLINE T PS_CPU::ReadMemory(pscpu_timestamp_t ×tamp, uint32 address, bool DS24, bool LWC_timing)
|
||||
{
|
||||
|
@ -2382,6 +2398,20 @@ uint32 PS_CPU::PeekMem32(uint32 A)
|
|||
return PeekMemory<uint32>(A);
|
||||
}
|
||||
|
||||
void PS_CPU::PokeMem8(uint32 A, uint8 V)
|
||||
{
|
||||
PokeMemory<uint8>(A, V);
|
||||
}
|
||||
|
||||
void PS_CPU::PokeMem16(uint32 A, uint16 V)
|
||||
{
|
||||
PokeMemory<uint16>(A, V);
|
||||
}
|
||||
|
||||
void PS_CPU::PokeMem32(uint32 A, uint32 V)
|
||||
{
|
||||
PokeMemory<uint32>(A, V);
|
||||
}
|
||||
|
||||
#undef BEGIN_OPF
|
||||
#undef END_OPF
|
||||
|
|
|
@ -214,6 +214,7 @@ class PS_CPU
|
|||
template<bool DebugMode, bool BIOSPrintMode, bool ILHMode> pscpu_timestamp_t RunReal(pscpu_timestamp_t timestamp_in) NO_INLINE;
|
||||
|
||||
template<typename T> T PeekMemory(uint32 address) MDFN_COLD;
|
||||
template<typename T> void PokeMemory(uint32 address, T value) MDFN_COLD;
|
||||
template<typename T> T ReadMemory(pscpu_timestamp_t ×tamp, uint32 address, bool DS24 = false, bool LWC_timing = false);
|
||||
template<typename T> void WriteMemory(pscpu_timestamp_t ×tamp, uint32 address, uint32 value, bool DS24 = false);
|
||||
|
||||
|
@ -243,9 +244,15 @@ class PS_CPU
|
|||
uint32 GetRegister(unsigned int which, char *special, const uint32 special_len);
|
||||
void SetRegister(unsigned int which, uint32 value);
|
||||
bool PeekCheckICache(uint32 PC, uint32 *iw);
|
||||
|
||||
uint8 PeekMem8(uint32 A);
|
||||
uint16 PeekMem16(uint32 A);
|
||||
uint32 PeekMem32(uint32 A);
|
||||
|
||||
void PokeMem8(uint32 A, uint8 V);
|
||||
void PokeMem16(uint32 A, uint16 V);
|
||||
void PokeMem32(uint32 A, uint32 V);
|
||||
|
||||
private:
|
||||
void (*CPUHook)(const pscpu_timestamp_t timestamp, uint32 pc);
|
||||
void (*ADDBT)(uint32 from, uint32 to, bool exception);
|
||||
|
|
|
@ -259,12 +259,18 @@ static void PutAddressSpaceBytes(const char *name, uint32 Address, uint32 Length
|
|||
{
|
||||
while(Length--)
|
||||
{
|
||||
pscpu_timestamp_t dummy = 0;
|
||||
Address &= 0xFFFFFFFF;
|
||||
|
||||
// TODO
|
||||
PSX_MemWrite8(dummy, Address, *Buffer);
|
||||
|
||||
CPU->PokeMem8(Address, *Buffer);
|
||||
Address++;
|
||||
Buffer++;
|
||||
}
|
||||
}
|
||||
else if(!strcmp(name, "ram"))
|
||||
{
|
||||
while(Length--)
|
||||
{
|
||||
Address &= 0x1FFFFF;
|
||||
CPU->PokeMem8(Address, *Buffer);
|
||||
Address++;
|
||||
Buffer++;
|
||||
}
|
||||
|
@ -662,7 +668,7 @@ bool DBG_Init(void)
|
|||
MDFNDBG_AddRegGroup(&SPURegsGroup);
|
||||
MDFNDBG_AddRegGroup(&SPUVoicesRegsGroup);
|
||||
ASpace_Add(GetAddressSpaceBytes, PutAddressSpaceBytes, "cpu", "CPU Physical", 32);
|
||||
ASpace_Add(GetAddressSpaceBytes, PutAddressSpaceBytes, "ram", "CPU Main Ram", 21);
|
||||
ASpace_Add(GetAddressSpaceBytes, PutAddressSpaceBytes, "ram", "CPU Main RAM", 21);
|
||||
ASpace_Add(GetAddressSpaceBytes, PutAddressSpaceBytes, "spu", "SPU RAM", 19);
|
||||
ASpace_Add(GetAddressSpaceBytes, PutAddressSpaceBytes, "gpu", "GPU RAM", 20);
|
||||
return(true);
|
||||
|
|
|
@ -169,7 +169,7 @@ void PS_GPU::FillVideoParams(MDFNGI* gi)
|
|||
// For Justifier and Guncon.
|
||||
//
|
||||
gi->mouse_scale_x = (float)gi->lcm_width / gi->nominal_width;
|
||||
gi->mouse_offs_x = 0;
|
||||
gi->mouse_offs_x = (float)(2800 - gi->lcm_width) / 2;
|
||||
|
||||
gi->mouse_scale_y = 1.0;
|
||||
gi->mouse_offs_y = LineVisFirst;
|
||||
|
@ -401,6 +401,7 @@ INLINE void PS_GPU::Command_FBCopy(const uint32 *cb)
|
|||
if(!height)
|
||||
height = 0x200;
|
||||
|
||||
InvalidateTexCache();
|
||||
//printf("FB Copy: %d %d %d %d %d %d\n", sourceX, sourceY, destX, destY, width, height);
|
||||
|
||||
DrawTimeAvail -= (width * height) * 2;
|
||||
|
@ -453,6 +454,8 @@ INLINE void PS_GPU::Command_FBWrite(const uint32 *cb)
|
|||
FBRW_CurX = FBRW_X;
|
||||
FBRW_CurY = FBRW_Y;
|
||||
|
||||
InvalidateTexCache();
|
||||
|
||||
if(FBRW_W != 0 && FBRW_H != 0)
|
||||
InCmd = INCMD_FBWRITE;
|
||||
}
|
||||
|
@ -491,28 +494,50 @@ INLINE void PS_GPU::RecalcTexPageStuff(uint32 tpage)
|
|||
|
||||
}
|
||||
*/
|
||||
|
||||
INLINE void PS_GPU::SetTPage(const uint32 cmdw)
|
||||
{
|
||||
const unsigned NewTexPageX = (cmdw & 0xF) * 64;
|
||||
const unsigned NewTexPageY = (cmdw & 0x10) * 16;
|
||||
const unsigned NewTexMode = (cmdw >> 7) & 0x3;
|
||||
|
||||
abr = (cmdw >> 5) & 0x3;
|
||||
|
||||
if(!NewTexMode != !TexMode || NewTexPageX != TexPageX || NewTexPageY != TexPageY)
|
||||
{
|
||||
InvalidateTexCache();
|
||||
}
|
||||
|
||||
if(TexDisableAllowChange)
|
||||
{
|
||||
bool NewTexDisable = (cmdw >> 11) & 1;
|
||||
|
||||
if(NewTexDisable != TexDisable)
|
||||
InvalidateTexCache();
|
||||
|
||||
TexDisable = NewTexDisable;
|
||||
//printf("TexDisable: %02x\n", TexDisable);
|
||||
}
|
||||
|
||||
TexPageX = NewTexPageX;
|
||||
TexPageY = NewTexPageY;
|
||||
TexMode = NewTexMode;
|
||||
|
||||
//
|
||||
//
|
||||
RecalcTexWindowStuff();
|
||||
}
|
||||
|
||||
INLINE void PS_GPU::Command_DrawMode(const uint32 *cb)
|
||||
{
|
||||
const uint32 cmdw = *cb;
|
||||
|
||||
TexPageX = (cmdw & 0xF) * 64;
|
||||
TexPageY = (cmdw & 0x10) * 16;
|
||||
SetTPage(cmdw);
|
||||
|
||||
SpriteFlip = cmdw & 0x3000;
|
||||
|
||||
abr = (cmdw >> 5) & 0x3;
|
||||
TexMode = (cmdw >> 7) & 0x3;
|
||||
|
||||
dtd = (cmdw >> 9) & 1;
|
||||
dfe = (cmdw >> 10) & 1;
|
||||
|
||||
if(TexDisableAllowChange)
|
||||
{
|
||||
TexDisable = (cmdw >> 11) & 1;
|
||||
//printf("TexDisable: %02x\n", TexDisable);
|
||||
}
|
||||
|
||||
RecalcTexWindowStuff();
|
||||
//printf("*******************DFE: %d -- scanline=%d\n", dfe, scanline);
|
||||
}
|
||||
|
||||
|
@ -557,12 +582,18 @@ INLINE void PS_GPU::Command_MaskSetting(const uint32 *cb)
|
|||
MaskEvalAND = (*cb & 2) ? 0x8000 : 0x0000;
|
||||
}
|
||||
|
||||
INLINE void PS_GPU::InvalidateTexCache(void)
|
||||
{
|
||||
for(int i=0;i<ARRAY_SIZE(TexCache);i++)
|
||||
TexCache[i].Tag = ~0U;
|
||||
}
|
||||
|
||||
|
||||
void PS_GPU::InvalidateCache(void)
|
||||
{
|
||||
CLUT_Cache_VB = ~0U;
|
||||
|
||||
for(int i=0;i<ARRAY_SIZE(TexCache);i++)
|
||||
TexCache[i].Tag = ~0U;
|
||||
InvalidateTexCache();
|
||||
}
|
||||
|
||||
INLINE void PS_GPU::Command_ClearCache(const uint32 *cb)
|
||||
|
@ -818,14 +849,7 @@ void PS_GPU::ProcessFIFO(void)
|
|||
//
|
||||
// Don't alter SpriteFlip here.
|
||||
//
|
||||
const uint32 tpage = CB[4 + ((cc >> 4) & 0x1)] >> 16;
|
||||
|
||||
TexPageX = (tpage & 0xF) * 64;
|
||||
TexPageY = (tpage & 0x10) * 16;
|
||||
|
||||
abr = (tpage >> 5) & 0x3;
|
||||
TexMode = (tpage >> 7) & 0x3;
|
||||
RecalcTexWindowStuff();
|
||||
SetTPage(CB[4 + ((cc >> 4) & 0x1)] >> 16);
|
||||
}
|
||||
|
||||
if(!command->func[abr][TexMode])
|
||||
|
|
|
@ -131,8 +131,11 @@ class PS_GPU
|
|||
uint32 Tag;
|
||||
} TexCache[256];
|
||||
|
||||
void InvalidateTexCache(void);
|
||||
void InvalidateCache(void);
|
||||
|
||||
void SetTPage(uint32);
|
||||
|
||||
void ProcessFIFO(void);
|
||||
void WriteCB(uint32 data);
|
||||
uint32 ReadData(void);
|
||||
|
|
|
@ -134,7 +134,7 @@ void InputDevice_Multitap::Power(void)
|
|||
|
||||
fm_dp = 0;
|
||||
memset(fm_buffer, 0, sizeof(fm_buffer));
|
||||
fm_deferred_error_temp = false;
|
||||
fm_command_error = false;
|
||||
|
||||
for(int i = 0; i < 4; i++)
|
||||
{
|
||||
|
|
|
@ -46,8 +46,6 @@ class InputDevice_Multitap final : public InputDevice
|
|||
|
||||
uint8 sb[4][8];
|
||||
|
||||
bool fm_deferred_error_temp;
|
||||
bool fm_deferred_error;
|
||||
bool fm_command_error;
|
||||
|
||||
uint8 command;
|
||||
|
|
|
@ -403,7 +403,7 @@ void PSX_RequestMLExit(void)
|
|||
//
|
||||
|
||||
|
||||
// Remember to update MemPeek<>() when we change address decoding in MemRW()
|
||||
// Remember to update MemPeek<>() and MemPoke<>() when we change address decoding in MemRW()
|
||||
template<typename T, bool IsWrite, bool Access24> static INLINE void MemRW(pscpu_timestamp_t ×tamp, uint32 A, uint32 &V)
|
||||
{
|
||||
#if 0
|
||||
|
@ -918,6 +918,60 @@ uint32 PSX_MemPeek32(uint32 A)
|
|||
return MemPeek<uint32, false>(0, A);
|
||||
}
|
||||
|
||||
template<typename T, bool Access24> static INLINE void MemPoke(pscpu_timestamp_t timestamp, uint32 A, T V)
|
||||
{
|
||||
if(A < 0x00800000)
|
||||
{
|
||||
if(Access24)
|
||||
MainRAM.WriteU24(A & 0x1FFFFF, V);
|
||||
else
|
||||
MainRAM.Write<T>(A & 0x1FFFFF, V);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(A >= 0x1FC00000 && A <= 0x1FC7FFFF)
|
||||
{
|
||||
if(Access24)
|
||||
BIOSROM->WriteU24(A & 0x7FFFF, V);
|
||||
else
|
||||
BIOSROM->Write<T>(A & 0x7FFFF, V);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(A >= 0x1F801000 && A <= 0x1F802FFF)
|
||||
{
|
||||
if(A >= 0x1F801000 && A <= 0x1F801023)
|
||||
{
|
||||
unsigned index = (A & 0x1F) >> 2;
|
||||
SysControl.Regs[index] = (V << ((A & 3) * 8)) & SysControl_Mask[index];
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(A == 0xFFFE0130)
|
||||
{
|
||||
CPU->SetBIU(V);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void PSX_MemPoke8(uint32 A, uint8 V)
|
||||
{
|
||||
MemPoke<uint8, false>(0, A, V);
|
||||
}
|
||||
|
||||
void PSX_MemPoke16(uint32 A, uint16 V)
|
||||
{
|
||||
MemPoke<uint16, false>(0, A, V);
|
||||
}
|
||||
|
||||
void PSX_MemPoke32(uint32 A, uint32 V)
|
||||
{
|
||||
MemPoke<uint32, false>(0, A, V);
|
||||
}
|
||||
|
||||
static void PSX_Power(bool powering_up)
|
||||
{
|
||||
PSX_PRNG.ResetState(); // Should occur first!
|
||||
|
|
|
@ -64,11 +64,9 @@ namespace MDFN_IEN_PSX
|
|||
uint32 PSX_MemPeek32(uint32 A);
|
||||
|
||||
// Should write to WO-locations if possible
|
||||
#if 0
|
||||
void PSX_MemPoke8(uint32 A, uint8 V);
|
||||
void PSX_MemPoke16(uint32 A, uint16 V);
|
||||
void PSX_MemPoke32(uint32 A, uint32 V);
|
||||
#endif
|
||||
|
||||
void PSX_RequestMLExit(void);
|
||||
void ForceEventUpdates(const pscpu_timestamp_t timestamp);
|
||||
|
|
Loading…
Reference in New Issue