psx - update to mednafen 0.9.38.4

This commit is contained in:
zeromus 2015-06-16 09:44:50 +00:00
parent e2aabbab60
commit f2c62161a9
10 changed files with 850 additions and 730 deletions

Binary file not shown.

View File

@ -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 &timestamp, uint32 address, bool DS24, bool LWC_timing)
{
@ -2381,7 +2397,21 @@ 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

View File

@ -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 &timestamp, uint32 address, bool DS24 = false, bool LWC_timing = false);
template<typename T> void WriteMemory(pscpu_timestamp_t &timestamp, 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);

File diff suppressed because it is too large Load Diff

View File

@ -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])

View File

@ -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);

View File

@ -118,32 +118,32 @@ void InputDevice_Multitap::SetSubDevice(unsigned int sub_index, InputDevice *dev
}
void InputDevice_Multitap::Power(void)
{
selected_device = -1;
bit_counter = 0;
receive_buffer = 0;
byte_counter = 0;
mc_mode = false;
full_mode = false;
full_mode_setting = false;
prev_fm_success = false;
memset(sb, 0, sizeof(sb));
fm_dp = 0;
memset(fm_buffer, 0, sizeof(fm_buffer));
fm_deferred_error_temp = false;
for(int i = 0; i < 4; i++)
{
if(pad_devices[i])
pad_devices[i]->Power();
if(mc_devices[i])
mc_devices[i]->Power();
}
void InputDevice_Multitap::Power(void)
{
selected_device = -1;
bit_counter = 0;
receive_buffer = 0;
byte_counter = 0;
mc_mode = false;
full_mode = false;
full_mode_setting = false;
prev_fm_success = false;
memset(sb, 0, sizeof(sb));
fm_dp = 0;
memset(fm_buffer, 0, sizeof(fm_buffer));
fm_command_error = false;
for(int i = 0; i < 4; i++)
{
if(pad_devices[i])
pad_devices[i]->Power();
if(mc_devices[i])
mc_devices[i]->Power();
}
}
//void InputDevice_Multitap::StateAction(StateMem* sm, const unsigned load, const bool data_only, const char* sname_prefix)

View File

@ -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;

View File

@ -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 &timestamp, 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!

View File

@ -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);