mirror of
https://github.com/libretro/beetle-psx-libretro.git
synced 2024-11-26 18:30:26 +00:00
Cleanups - get rid of stdio.h in many places
This commit is contained in:
parent
ccca81930a
commit
e74142b9dd
1
Makefile
1
Makefile
@ -52,7 +52,6 @@ endif
|
||||
NEED_CD = 1
|
||||
NEED_TREMOR = 1
|
||||
NEED_BPP = 32
|
||||
WANT_NEW_API = 1
|
||||
NEED_DEINTERLACER = 1
|
||||
NEED_THREADING = 1
|
||||
SET_HAVE_HW = 0
|
||||
|
@ -127,10 +127,6 @@ ifeq ($(NEED_BPP), 32)
|
||||
FLAGS += -DWANT_32BPP
|
||||
endif
|
||||
|
||||
ifeq ($(WANT_NEW_API), 1)
|
||||
FLAGS += -DWANT_NEW_API
|
||||
endif
|
||||
|
||||
ifeq ($(NO_COMPUTED_GOTO), 1)
|
||||
FLAGS += -DNO_COMPUTED_GOTO
|
||||
endif
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include "libretro.h"
|
||||
#include "mednafen/mednafen-types.h"
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <algorithm>
|
||||
#include "mednafen/git.h"
|
||||
#include "mednafen/psx/frontio.h"
|
||||
|
@ -6,7 +6,6 @@ DEBUG := 0
|
||||
FRONTEND_SUPPORTS_RGB565 := 1
|
||||
NEED_CD := 1
|
||||
NEED_BPP := 32
|
||||
WANT_NEW_API := 1
|
||||
NEED_DEINTERLACER := 1
|
||||
NEED_THREADING := 1
|
||||
NEED_TREMOR := 1
|
||||
|
@ -1559,7 +1559,7 @@ Breakout:
|
||||
static unsigned CalcDiscSCEx(void)
|
||||
{
|
||||
const char *prev_valid_id = NULL;
|
||||
unsigned ret_region = MDFN_GetSettingI("psx.region_default");
|
||||
unsigned ret_region = MDFN_GetSettingI("psx.region_default");
|
||||
|
||||
cdifs_scex_ids.clear();
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
#ifndef __MDFN_CDROMFILE_H
|
||||
#define __MDFN_CDROMFILE_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <boolean.h>
|
||||
|
@ -279,7 +279,6 @@ bool CDAccess_Image::ParseTOCFileLineInfo(CDRFILE_TRACK_INFO *track, const int t
|
||||
|
||||
track->FileOffset = offset; // Make sure this is set before calling GetSectorCount()!
|
||||
sectors = GetSectorCount(track);
|
||||
//printf("Track: %d, offset: %ld, %ld\n", tracknum, offset, sectors);
|
||||
|
||||
if(length)
|
||||
{
|
||||
@ -354,7 +353,6 @@ int CDAccess_Image::LoadSBI(const char* sbi_path)
|
||||
memcpy(SubQReplaceMap[aba].data, tmpq, 12);
|
||||
}
|
||||
|
||||
//MDFN_printf("Loaded Q subchannel replacements for %zu sectors.\n", SubQReplaceMap.size());
|
||||
log_cb(RETRO_LOG_INFO, "[Image] Loaded SBI file %s\n", sbi_path);
|
||||
filestream_close(sbis);
|
||||
return 0;
|
||||
@ -442,8 +440,6 @@ bool CDAccess_Image::ImageOpen(const char *path, bool image_memcache)
|
||||
MDFN_strtoupper(cmdbuf);
|
||||
}
|
||||
|
||||
//printf("%s\n", cmdbuf.c_str()); //: %s %s %s %s\n", cmdbuf.c_str(), args[0].c_str(), args[1].c_str(), args[2].c_str(), args[3].c_str());
|
||||
|
||||
if(IsTOC)
|
||||
{
|
||||
if(cmdbuf == "TRACK")
|
||||
@ -526,7 +522,6 @@ bool CDAccess_Image::ImageOpen(const char *path, bool image_memcache)
|
||||
msfoffset = args[1].c_str();
|
||||
length = args[2].c_str();
|
||||
}
|
||||
//printf("%s, %s, %s, %s\n", args[0].c_str(), binoffset, msfoffset, length);
|
||||
ParseTOCFileLineInfo(&TmpTrack, active_track, args[0], binoffset, msfoffset, length, image_memcache, toc_streamcache);
|
||||
}
|
||||
else if(cmdbuf == "DATAFILE")
|
||||
@ -893,12 +888,9 @@ bool CDAccess_Image::ImageOpen(const char *path, bool image_memcache)
|
||||
Tracks[x].sectors = Tracks[x + 1].index[0] - Tracks[x].index[1]; //Tracks[x + 1].index - Tracks[x].index;
|
||||
}
|
||||
|
||||
//printf("Poo: %d %d\n", x, Tracks[x].sectors);
|
||||
RunningLBA += Tracks[x].sectors;
|
||||
RunningLBA += Tracks[x].postgap;
|
||||
|
||||
//printf("%d, %ld %d %d %d %d\n", x, FileOffset, Tracks[x].index, Tracks[x].pregap, Tracks[x].sectors, Tracks[x].LBA);
|
||||
|
||||
FileOffset += Tracks[x].sectors * DI_Size_Table[Tracks[x].DIFormat];
|
||||
} // end to cue sheet handling
|
||||
} // end to track loop
|
||||
@ -994,7 +986,6 @@ bool CDAccess_Image::Read_Raw_Sector(uint8 *buf, int32 lba)
|
||||
// Handle pregap and postgap reading
|
||||
if(lba < (ct->LBA - ct->pregap_dv) || lba >= (ct->LBA + ct->sectors))
|
||||
{
|
||||
//printf("Pre/post-gap read, LBA=%d(LBA-track_start_LBA=%d)\n", lba, lba - ct->LBA);
|
||||
memset(buf, 0, 2352); // Null sector data, per spec
|
||||
}
|
||||
else
|
||||
@ -1007,10 +998,7 @@ bool CDAccess_Image::Read_Raw_Sector(uint8 *buf, int32 lba)
|
||||
ct->LastSamplePos += frames_read;
|
||||
|
||||
if(frames_read < 0 || frames_read > 588) // This shouldn't happen.
|
||||
{
|
||||
printf("Error: frames_read out of range: %d\n", frames_read);
|
||||
frames_read = 0;
|
||||
}
|
||||
|
||||
if(frames_read < 588)
|
||||
memset((uint8 *)AudioBuf + frames_read * 2 * sizeof(int16), 0, (588 - frames_read) * 2 * sizeof(int16));
|
||||
@ -1083,34 +1071,6 @@ bool CDAccess_Image::Read_Raw_Sector(uint8 *buf, int32 lba)
|
||||
return false;
|
||||
}
|
||||
|
||||
#if 0
|
||||
if(qbuf[0] & 0x40)
|
||||
{
|
||||
uint8 dummy_buf[2352 + 96];
|
||||
bool any_mismatch = false;
|
||||
|
||||
memcpy(dummy_buf + 16, buf + 16, 2048);
|
||||
memset(dummy_buf + 2352, 0, 96);
|
||||
|
||||
MakeSubPQ(lba, dummy_buf + 2352);
|
||||
encode_mode1_sector(lba + 150, dummy_buf);
|
||||
|
||||
for(int i = 0; i < 2352 + 96; i++)
|
||||
{
|
||||
if(dummy_buf[i] != buf[i])
|
||||
{
|
||||
printf("Mismatch at %d, %d: %02x:%02x; ", lba, i, dummy_buf[i], buf[i]);
|
||||
any_mismatch = true;
|
||||
}
|
||||
}
|
||||
if(any_mismatch)
|
||||
puts("\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
//subq_deinterleave(buf + 2352, qbuf);
|
||||
//printf("%02x\n", qbuf[0]);
|
||||
//printf("%02x\n", buf[12 + 3]);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1136,13 +1096,8 @@ void CDAccess_Image::MakeSubPQ(int32 lba, uint8 *SubPWBuf)
|
||||
}
|
||||
}
|
||||
|
||||
//printf("%d %d\n", Tracks[1].LBA, Tracks[1].sectors);
|
||||
|
||||
if(!track_found)
|
||||
{
|
||||
printf("MakeSubPQ error for sector %u!", lba);
|
||||
track = FirstTrack;
|
||||
}
|
||||
|
||||
lba_relative = abs((int32)lba - Tracks[track].LBA);
|
||||
|
||||
@ -1159,10 +1114,7 @@ void CDAccess_Image::MakeSubPQ(int32 lba, uint8 *SubPWBuf)
|
||||
|
||||
// Handle pause(D7 of interleaved subchannel byte) bit, should be set to 1 when in pregap or postgap.
|
||||
if((lba < Tracks[track].LBA) || (lba >= Tracks[track].LBA + Tracks[track].sectors))
|
||||
{
|
||||
//printf("pause_or = 0x80 --- %d\n", lba);
|
||||
pause_or = 0x80;
|
||||
}
|
||||
|
||||
// Handle pregap between audio->data track
|
||||
{
|
||||
@ -1176,10 +1128,7 @@ void CDAccess_Image::MakeSubPQ(int32 lba, uint8 *SubPWBuf)
|
||||
if(pg_offset < -150)
|
||||
{
|
||||
if((Tracks[track].subq_control & SUBQ_CTRLF_DATA) && (FirstTrack < track) && !(Tracks[track - 1].subq_control & SUBQ_CTRLF_DATA))
|
||||
{
|
||||
//printf("Pregap part 1 audio->data: lba=%d track_lba=%d\n", lba, Tracks[track].LBA);
|
||||
control = Tracks[track - 1].subq_control;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1206,14 +1155,10 @@ void CDAccess_Image::MakeSubPQ(int32 lba, uint8 *SubPWBuf)
|
||||
|
||||
if(!SubQReplaceMap.empty())
|
||||
{
|
||||
//printf("%d\n", lba);
|
||||
std::map<uint32, cpp11_array_doodad>::const_iterator it = SubQReplaceMap.find(LBA_to_ABA(lba));
|
||||
|
||||
if(it != SubQReplaceMap.end())
|
||||
{
|
||||
//printf("Replace: %d\n", lba);
|
||||
memcpy(buf, it->second.data, 12);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 96; i++)
|
||||
|
@ -568,10 +568,7 @@ int CDIF::ReadSector(uint8* pBuf, uint32 lba, uint32 nSectors)
|
||||
uint8_t tmpbuf[2352 + 96];
|
||||
|
||||
if(!ReadRawSector(tmpbuf, lba))
|
||||
{
|
||||
puts("CDIF Raw Read error");
|
||||
return(false);
|
||||
}
|
||||
|
||||
if(!ValidateRawSector(tmpbuf))
|
||||
return(false);
|
||||
@ -605,8 +602,6 @@ int CDIF::ReadSector(uint8* pBuf, uint32 lba, uint32 nSectors)
|
||||
|
||||
CDIF_ST::CDIF_ST(CDAccess *cda) : disc_cdaccess(cda)
|
||||
{
|
||||
//puts("***WARNING USING SINGLE-THREADED CD READER***");
|
||||
|
||||
UnrecoverableError = false;
|
||||
DiscEjected = false;
|
||||
|
||||
|
@ -22,7 +22,6 @@
|
||||
* or direct your browser at http://www.gnu.org.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "galois.h"
|
||||
|
||||
|
@ -1323,11 +1323,6 @@ int32_t PS_CDC::Update(const int32_t timestamp)
|
||||
else if(ArgsReceiveIn < Commands[PendingCommand].args_min ||
|
||||
ArgsReceiveIn > Commands[PendingCommand].args_max)
|
||||
{
|
||||
PSX_DBG(PSX_DBG_WARNING, "[CDC] Bad number(%d) of args(first check) for command 0x%02x", ArgsReceiveIn, PendingCommand);
|
||||
for(unsigned int i = 0; i < ArgsReceiveIn; i++)
|
||||
PSX_DBG(PSX_DBG_WARNING, " 0x%02x", ArgsReceiveBuf[i]);
|
||||
PSX_DBG(PSX_DBG_WARNING, "\n");
|
||||
|
||||
WriteResult(MakeStatus(true));
|
||||
WriteResult(ERRCODE_BAD_NUMARGS);
|
||||
WriteIRQ(CDCIRQ_DISC_ERROR);
|
||||
@ -1335,12 +1330,6 @@ int32_t PS_CDC::Update(const int32_t timestamp)
|
||||
else
|
||||
{
|
||||
const CDC_CTEntry *command = &Commands[PendingCommand];
|
||||
|
||||
PSX_DBG(PSX_DBG_SPARSE, "[CDC] Command: %s --- ", command->name);
|
||||
for(unsigned int i = 0; i < ArgsReceiveIn; i++)
|
||||
PSX_DBG(PSX_DBG_SPARSE, " 0x%02x", ArgsReceiveBuf[i]);
|
||||
PSX_DBG(PSX_DBG_SPARSE, "\n");
|
||||
|
||||
next_time = (this->*(command->func))(ArgsReceiveIn, ArgsReceiveBuf);
|
||||
PendingCommandPhase = 2;
|
||||
}
|
||||
@ -1680,9 +1669,6 @@ int32 PS_CDC::CalcSeekTime(int32 initial, int32 target, bool motor_on, bool paus
|
||||
// ret += 1000000;
|
||||
|
||||
ret += PSX_GetRandU32(0, 25000);
|
||||
|
||||
PSX_DBG(PSX_DBG_SPARSE, "[CDC] CalcSeekTime() %d->%d = %d\n", initial, target, ret);
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
@ -56,12 +56,6 @@ bool PS_CPU::Halted;
|
||||
struct PS_CPU::CP0 PS_CPU::CP0;
|
||||
char PS_CPU::cache_buf[64 * 1024];
|
||||
|
||||
#if 0
|
||||
#define EXP_ILL_CHECK(n) {n;}
|
||||
#else
|
||||
#define EXP_ILL_CHECK(n) {}
|
||||
#endif
|
||||
|
||||
#define BIU_ENABLE_ICACHE_S1 0x00000800 // Enable I-cache, set 1
|
||||
#define BIU_ICACHE_FSIZE_MASK 0x00000300 // I-cache fill size mask; 0x000 = 2 words, 0x100 = 4 words, 0x200 = 8 words, 0x300 = 16 words
|
||||
#define BIU_ENABLE_DCACHE 0x00000080 // Enable D-cache
|
||||
@ -332,8 +326,6 @@ void PS_CPU::SetBIU(uint32 val)
|
||||
ICache[i].TV |= 0x1;
|
||||
}
|
||||
}
|
||||
|
||||
PSX_DBG(PSX_DBG_SPARSE, "[CPU] Set BIU=0x%08x\n", BIU);
|
||||
}
|
||||
|
||||
uint32 PS_CPU::GetBIU(void)
|
||||
@ -623,19 +615,6 @@ uint32 NO_INLINE PS_CPU::Exception(uint32 code, uint32 PC, const uint32 NP, cons
|
||||
|
||||
assert(code < 16);
|
||||
|
||||
#ifdef DEBUG
|
||||
if(code != EXCEPTION_INT && code != EXCEPTION_BP && code != EXCEPTION_SYSCALL)
|
||||
{
|
||||
static const char* exmne[16] =
|
||||
{
|
||||
"INT", "MOD", "TLBL", "TLBS", "ADEL", "ADES", "IBE", "DBE", "SYSCALL", "BP", "RI", "COPU", "OV", NULL, NULL, NULL
|
||||
};
|
||||
|
||||
PSX_DBG(PSX_DBG_WARNING, "[CPU] Exception %s(0x%02x) @ PC=0x%08x(NP=0x%08x, BDBT=0x%02x), Instr=0x%08x, IPCache=0x%02x, CAUSE=0x%08x, SR=0x%08x, IRQC_Status=0x%04x, IRQC_Mask=0x%04x\n",
|
||||
exmne[code], code, PC, NP, BDBT, instr, IPCache, CP0.CAUSE, CP0.SR, IRQ_GetRegister(IRQ_GSREG_STATUS, NULL, 0), IRQ_GetRegister(IRQ_GSREG_MASK, NULL, 0));
|
||||
}
|
||||
#endif
|
||||
|
||||
if(CP0.SR & (1 << 22)) // BEV
|
||||
handler = 0xBFC00180;
|
||||
|
||||
@ -682,10 +661,9 @@ uint32 NO_INLINE PS_CPU::Exception(uint32 code, uint32 PC, const uint32 NP, cons
|
||||
BACKED_LDValue = LDValue;
|
||||
|
||||
//
|
||||
// Should come before DO_LDS() so the EXP_ILL_CHECK() emulator debugging macro in GPR_DEP() will work properly.
|
||||
//
|
||||
#define GPR_DEPRES_BEGIN { uint8 back = ReadAbsorb[0];
|
||||
#define GPR_DEP(n) { unsigned tn = (n); ReadAbsorb[tn] = 0; EXP_ILL_CHECK(if(LDWhich > 0 && LDWhich < 0x20 && LDWhich == tn) { PSX_DBG(PSX_DBG_WARNING, "[CPU] Instruction at PC=0x%08x in load delay slot has dependency on load target register(0x%02x): SR=0x%08x\n", PC, LDWhich, CP0.SR); }) }
|
||||
#define GPR_DEP(n) { unsigned tn = (n); ReadAbsorb[tn] = 0; }
|
||||
#define GPR_RES(n) { unsigned tn = (n); ReadAbsorb[tn] = 0; }
|
||||
#define GPR_DEPRES_END ReadAbsorb[0] = back; }
|
||||
|
||||
@ -814,9 +792,6 @@ pscpu_timestamp_t PS_CPU::RunReal(pscpu_timestamp_t timestamp_in)
|
||||
const uint32 offset = (arg_offset); \
|
||||
const uint32 mask = (arg_mask); \
|
||||
const uint32 old_PC = PC; \
|
||||
\
|
||||
EXP_ILL_CHECK(if(BDBT) { PSX_DBG(PSX_DBG_WARNING, "[CPU] Branch instruction at PC=0x%08x in branch delay slot: SR=0x%08x\n", PC, CP0.SR);}) \
|
||||
\
|
||||
PC = new_PC; \
|
||||
new_PC += 4; \
|
||||
BDBT = 2; \
|
||||
@ -1212,7 +1187,6 @@ pscpu_timestamp_t PS_CPU::RunReal(pscpu_timestamp_t timestamp_in)
|
||||
default:
|
||||
// Tested to be rather NOPish
|
||||
DO_LDS();
|
||||
PSX_DBG(PSX_DBG_WARNING, "[CPU] MFC0 from unmapped CP0 register %u.\n", rd);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@ -1238,12 +1212,6 @@ pscpu_timestamp_t PS_CPU::RunReal(pscpu_timestamp_t timestamp_in)
|
||||
break;
|
||||
|
||||
case CP0REG_DCIC:
|
||||
#ifdef DEBUG
|
||||
if(val)
|
||||
{
|
||||
PSX_DBG(PSX_DBG_WARNING, "[CPU] Non-zero write to DCIC: 0x%08x\n", val);
|
||||
}
|
||||
#endif
|
||||
CP0.DCIC = val & 0xFF80003F;
|
||||
break;
|
||||
|
||||
@ -1274,11 +1242,6 @@ pscpu_timestamp_t PS_CPU::RunReal(pscpu_timestamp_t timestamp_in)
|
||||
{
|
||||
const uint32 immediate = (int32)(int16)(instr & 0xFFFF);
|
||||
const bool result = (false == (bool)(instr & (1U << 16)));
|
||||
|
||||
#ifdef DEBUG
|
||||
PSX_DBG(PSX_DBG_WARNING, "[CPU] BC0x instruction(0x%08x) @ PC=0x%08x\n", instr, PC);
|
||||
#endif
|
||||
|
||||
DO_BRANCH(result, (immediate << 2), ~0U, false, 0);
|
||||
}
|
||||
break;
|
||||
@ -1400,11 +1363,6 @@ pscpu_timestamp_t PS_CPU::RunReal(pscpu_timestamp_t timestamp_in)
|
||||
{
|
||||
const uint32 immediate = (int32)(int16)(instr & 0xFFFF);
|
||||
const bool result = (false == (bool)(instr & (1U << 16)));
|
||||
|
||||
#ifdef DEBUG
|
||||
PSX_DBG(PSX_DBG_WARNING, "[CPU] BC2x instruction(0x%08x) @ PC=0x%08x\n", instr, PC);
|
||||
#endif
|
||||
|
||||
DO_BRANCH(result, (immediate << 2), ~0U, false, 0);
|
||||
}
|
||||
break;
|
||||
@ -1433,11 +1391,6 @@ pscpu_timestamp_t PS_CPU::RunReal(pscpu_timestamp_t timestamp_in)
|
||||
else
|
||||
{
|
||||
const uint32 sub_op = (instr >> 21) & 0x1F;
|
||||
|
||||
#ifdef DEBUG
|
||||
PSX_DBG(PSX_DBG_WARNING, "[CPU] COP%u instruction(0x%08x) @ PC=0x%08x\n", (instr >> 26) & 0x3, instr, PC);
|
||||
#endif
|
||||
|
||||
if(sub_op == 0x08 || sub_op == 0x0C)
|
||||
{
|
||||
const uint32 immediate = (int32)(int16)(instr & 0xFFFF);
|
||||
@ -1469,13 +1422,7 @@ pscpu_timestamp_t PS_CPU::RunReal(pscpu_timestamp_t timestamp_in)
|
||||
new_PC = Exception(EXCEPTION_ADEL, PC, new_PC, instr);
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef DEBUG
|
||||
PSX_DBG(PSX_DBG_WARNING, "[CPU] LWC%u instruction(0x%08x) @ PC=0x%08x\n", (instr >> 26) & 0x3, instr, PC);
|
||||
#endif
|
||||
|
||||
ReadMemory<uint32>(timestamp, address, false, true);
|
||||
}
|
||||
}
|
||||
END_OPF;
|
||||
|
||||
@ -1528,13 +1475,6 @@ pscpu_timestamp_t PS_CPU::RunReal(pscpu_timestamp_t timestamp_in)
|
||||
CP0.BADA = address;
|
||||
new_PC = Exception(EXCEPTION_ADES, PC, new_PC, instr);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
else
|
||||
{
|
||||
PSX_DBG(PSX_DBG_WARNING, "[CPU] SWC%u instruction(0x%08x) @ PC=0x%08x\n", (instr >> 26) & 0x3, instr, PC);
|
||||
//WriteMemory<uint32>(timestamp, address, SOMETHING);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
END_OPF;
|
||||
|
||||
|
@ -36,11 +36,6 @@
|
||||
|
||||
#include "input/multitap.h"
|
||||
|
||||
//#define PSX_FIODBGINFO(format, ...) { /* printf(format " -- timestamp=%d -- PAD temp\n", ## __VA_ARGS__, timestamp); */ }
|
||||
static void PSX_FIODBGINFO(const char *format, ...)
|
||||
{
|
||||
}
|
||||
|
||||
InputDevice::InputDevice() :
|
||||
chair_r(0),
|
||||
chair_g(0),
|
||||
@ -543,7 +538,6 @@ INLINE void FrontIO::DoDSRIRQ(void)
|
||||
{
|
||||
if(Control & 0x1000)
|
||||
{
|
||||
PSX_FIODBGINFO("[DSR] IRQ");
|
||||
istatus = true;
|
||||
::IRQ_Assert(IRQ_SIO, true);
|
||||
}
|
||||
@ -554,8 +548,6 @@ void FrontIO::Write(int32_t timestamp, uint32_t A, uint32_t V)
|
||||
{
|
||||
assert(!(A & 0x1));
|
||||
|
||||
PSX_FIODBGINFO("[FIO] Write: %08x %08x", A, V);
|
||||
|
||||
Update(timestamp);
|
||||
|
||||
switch(A & 0xF)
|
||||
@ -571,12 +563,6 @@ void FrontIO::Write(int32_t timestamp, uint32_t A, uint32_t V)
|
||||
break;
|
||||
|
||||
case 0xa:
|
||||
#if 0
|
||||
if(ClockDivider > 0 && ((V & 0x2000) != (Control & 0x2000)) && ((Control & 0x2) == (V & 0x2)) )
|
||||
PSX_DBG(PSX_DBG_WARNING, "FIO device selection changed during comm %04x->%04x\n", Control, V);
|
||||
#endif
|
||||
|
||||
//printf("Control: %d, %04x\n", timestamp, V);
|
||||
Control = V & 0x3F2F;
|
||||
|
||||
if(V & 0x10)
|
||||
@ -700,9 +686,6 @@ uint32_t FrontIO::Read(int32_t timestamp, uint32_t A)
|
||||
break;
|
||||
}
|
||||
|
||||
if((A & 0xF) != 0x4)
|
||||
PSX_FIODBGINFO("[FIO] Read: %08x %08x", A, ret);
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
@ -759,7 +742,6 @@ int32_t FrontIO::Update(int32_t timestamp)
|
||||
if(!TransmitBitCounter)
|
||||
{
|
||||
need_start_stop_check = true;
|
||||
PSX_FIODBGINFO("[FIO] Data transmitted: %08x", TransmitBuffer);
|
||||
TransmitInProgress = false;
|
||||
|
||||
if(Control & 0x400)
|
||||
@ -783,8 +765,6 @@ int32_t FrontIO::Update(int32_t timestamp)
|
||||
if(!ReceiveBitCounter)
|
||||
{
|
||||
need_start_stop_check = true;
|
||||
PSX_FIODBGINFO("[FIO] Data received: %08x", ReceiveBuffer);
|
||||
|
||||
ReceiveInProgress = false;
|
||||
ReceiveBufferAvail = true;
|
||||
|
||||
|
@ -181,7 +181,6 @@ static void Command_FBFill(PS_GPU* gpu, const uint32 *cb)
|
||||
int32_t width = (((cb[2] >> 0) & 0x3FF) + 0xF) & ~0xF;
|
||||
int32_t height = (cb[2] >> 16) & 0x1FF;
|
||||
|
||||
//printf("[GPU] FB Fill %d:%d w=%d, h=%d\n", destX, destY, width, height);
|
||||
gpu->DrawTimeAvail -= 46; // Approximate
|
||||
|
||||
for(y = 0; y < height; y++)
|
||||
@ -222,7 +221,6 @@ static void Command_FBCopy(PS_GPU* g, const uint32 *cb)
|
||||
height = 0x200;
|
||||
|
||||
InvalidateTexCache(g);
|
||||
//printf("FB Copy: %d %d %d %d %d %d\n", sourceX, sourceY, destX, destY, width, height);
|
||||
|
||||
g->DrawTimeAvail -= (width * height) * 2;
|
||||
|
||||
@ -313,15 +311,11 @@ static void Command_FBRead(PS_GPU* g, const uint32 *cb)
|
||||
|
||||
if (!rsx_intf_has_software_renderer())
|
||||
{
|
||||
//fprintf(stderr, "Hard GPU readback (X: %d, Y: %d, W: %d, H: %d)\n", g->FBRW_X, g->FBRW_Y, g->FBRW_W, g->FBRW_H);
|
||||
/* Need a hard readback from GPU renderer. */
|
||||
bool supported = rsx_intf_read_vram(
|
||||
g->FBRW_X, g->FBRW_Y,
|
||||
g->FBRW_W, g->FBRW_H,
|
||||
g->vram);
|
||||
|
||||
//if (!supported)
|
||||
// fprintf(stderr, "Game is trying to reading back from VRAM, but SW rendering is not enabled, and RSX backend does not support it.\n");
|
||||
}
|
||||
}
|
||||
|
||||
@ -336,12 +330,7 @@ static void Command_DrawMode(PS_GPU* g, const uint32 *cb)
|
||||
g->dfe = (cmdw >> 10) & 1;
|
||||
|
||||
if (g->dfe)
|
||||
{
|
||||
GPU.display_possibly_dirty = true;
|
||||
//printf("Display possibly dirty this frame\n");
|
||||
}
|
||||
|
||||
//printf("*******************DFE: %d -- scanline=%d\n", dfe, scanline);
|
||||
}
|
||||
|
||||
static void Command_TexWindow(PS_GPU* g, const uint32 *cb)
|
||||
@ -375,13 +364,10 @@ static void Command_DrawingOffset(PS_GPU* g, const uint32 *cb)
|
||||
{
|
||||
g->OffsX = sign_x_to_s32(11, (*cb & 2047));
|
||||
g->OffsY = sign_x_to_s32(11, ((*cb >> 11) & 2047));
|
||||
|
||||
//fprintf(stderr, "[GPU] Drawing offset: %d(raw=%d) %d(raw=%d) -- %d\n", OffsX, *cb, OffsY, *cb >> 11, scanline);
|
||||
}
|
||||
|
||||
static void Command_MaskSetting(PS_GPU* g, const uint32 *cb)
|
||||
{
|
||||
//printf("Mask setting: %08x\n", *cb);
|
||||
g->MaskSetOR = (*cb & 1) ? 0x8000 : 0x0000;
|
||||
g->MaskEvalAND = (*cb & 2) ? 0x8000 : 0x0000;
|
||||
|
||||
@ -1112,10 +1098,7 @@ static INLINE void GPU_WriteCB(uint32_t InData, uint32_t addr)
|
||||
if(GPU_BlitterFIFO.in_count >= 0x10
|
||||
&& (GPU.InCmd != INCMD_NONE ||
|
||||
(GPU_BlitterFIFO.in_count - 0x10) >= Commands[GPU_BlitterFIFO.Peek() >> 24].fifo_fb_len))
|
||||
{
|
||||
PSX_DBG(PSX_DBG_WARNING, "GPU FIFO overflow!!!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if(PGXP_enabled())
|
||||
PGXP_WriteFIFO(ReadMem(addr), GPU_BlitterFIFO.write_pos);
|
||||
@ -1146,7 +1129,6 @@ void GPU_Write(const int32_t timestamp, uint32_t A, uint32_t V)
|
||||
PSX_WARNING("[GPU] Unknown control command %02x - %06x", command, V);
|
||||
break;
|
||||
case 0x00: // Reset GPU
|
||||
//printf("\n\n************ Soft Reset %u ********* \n\n", scanline);
|
||||
GPU_SoftReset();
|
||||
rsx_intf_set_draw_area(GPU.ClipX0, GPU.ClipY0,
|
||||
GPU.ClipX1, GPU.ClipY1);
|
||||
@ -1198,7 +1180,6 @@ void GPU_Write(const int32_t timestamp, uint32_t A, uint32_t V)
|
||||
break;
|
||||
|
||||
case 0x08:
|
||||
//printf("\n\nDISPLAYMODE SET: 0x%02x, %u *************************\n\n\n", V & 0xFF, scanline);
|
||||
GPU.DisplayMode = V & 0xFF;
|
||||
RSX_UpdateDisplayMode();
|
||||
break;
|
||||
@ -1252,9 +1233,6 @@ void GPU_Write(const int32_t timestamp, uint32_t A, uint32_t V)
|
||||
}
|
||||
else // GP0 ("Data")
|
||||
{
|
||||
//uint32_t command = V >> 24;
|
||||
//printf("Meow command: %02x\n", command);
|
||||
//assert(!(GPU.DMAControl & 2));
|
||||
GPU_WriteCB(V, A);
|
||||
}
|
||||
}
|
||||
@ -1422,8 +1400,6 @@ int32_t GPU_Update(const int32_t sys_timestamp)
|
||||
const uint32_t dmw = 2800 / DotClockRatios[dmc]; // Must be <= 768
|
||||
int32_t sys_clocks = sys_timestamp - GPU.lastts;
|
||||
|
||||
//printf("GPUISH: %d\n", sys_timestamp - GPU.lastts);
|
||||
|
||||
if(!sys_clocks)
|
||||
goto TheEnd;
|
||||
|
||||
@ -1448,10 +1424,7 @@ int32_t GPU_Update(const int32_t sys_timestamp)
|
||||
int32 dot_clocks;
|
||||
|
||||
if(chunk_clocks > GPU.LineClockCounter)
|
||||
{
|
||||
//printf("Chunk: %u, LCC: %u\n", chunk_clocks, LineClockCounter);
|
||||
chunk_clocks = GPU.LineClockCounter;
|
||||
}
|
||||
|
||||
gpu_clocks -= chunk_clocks;
|
||||
GPU.LineClockCounter -= chunk_clocks;
|
||||
@ -1514,19 +1487,13 @@ int32_t GPU_Update(const int32_t sys_timestamp)
|
||||
if(GPU.scanline == (GPU.HardwarePALType ? 308 : 256)) // Will need to be redone if we ever allow for visible vertical overscan with NTSC.
|
||||
{
|
||||
if(GPU.sl_zero_reached)
|
||||
{
|
||||
//printf("Req Exit(visible fallthrough case): %u\n", GPU.scanline);
|
||||
PSX_RequestMLExit();
|
||||
}
|
||||
}
|
||||
|
||||
if(GPU.scanline == (GPU.LinesPerField - 1))
|
||||
{
|
||||
if(GPU.sl_zero_reached)
|
||||
{
|
||||
//printf("Req Exit(final fallthrough case): %u\n", GPU.scanline);
|
||||
PSX_RequestMLExit();
|
||||
}
|
||||
|
||||
if(GPU.DisplayMode & DISP_INTERLACED)
|
||||
GPU.field = !GPU.field;
|
||||
@ -1574,11 +1541,6 @@ int32_t GPU_Update(const int32_t sys_timestamp)
|
||||
|
||||
memset(dest, 0, 384 * sizeof(int32));
|
||||
}
|
||||
|
||||
//char buffer[256];
|
||||
//snprintf(buffer, sizeof(buffer), "VIDEO STANDARD MISMATCH");
|
||||
//DrawTextTrans(surface->pixels + ((DisplayRect->h / 2) - (13 / 2)) * surface->pitch32, surface->pitch32 << 2, DisplayRect->w, (UTF8*)buffer,
|
||||
//MAKECOLOR(0x00, 0xFF, 0x00), true, MDFN_FONT_6x13_12x13, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1619,19 +1581,9 @@ int32_t GPU_Update(const int32_t sys_timestamp)
|
||||
// FMV(which we don't handle here because low-latency in that case is not so important).
|
||||
//
|
||||
if(GPU.scanline >= (GPU.HardwarePALType ? 260 : 232))
|
||||
{
|
||||
//printf("Req Exit(vblank case): %u\n", GPU.scanline);
|
||||
PSX_RequestMLExit();
|
||||
}
|
||||
#if 0
|
||||
else
|
||||
{
|
||||
//printf("VBlank too early, chickening out early exit: %u!\n", GPU.scanline);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//printf("VBLANK: %u\n", GPU.scanline);
|
||||
GPU.InVBlank = true;
|
||||
|
||||
GPU.DisplayFB_CurYOffset = 0;
|
||||
@ -1714,8 +1666,6 @@ int32_t GPU_Update(const int32_t sys_timestamp)
|
||||
|
||||
GPU.LineWidths[dest_line] = dmw;
|
||||
|
||||
//printf("dx_start base: %d, dmw: %d\n", dx_start, dmw);
|
||||
|
||||
if (rsx_intf_is_type() == RSX_SOFTWARE)
|
||||
{
|
||||
// Convert the necessary variables to the upscaled version
|
||||
@ -1732,15 +1682,10 @@ int32_t GPU_Update(const int32_t sys_timestamp)
|
||||
const uint16_t *src = GPU.vram +
|
||||
((y + i) << (10 + GPU.upscale_shift));
|
||||
|
||||
// printf("surface: %dx%d (%d) %u %u + %u\n",
|
||||
// surface->w, surface->h, surface->pitchinpix,
|
||||
// dest_line, y, i);
|
||||
|
||||
dest = GPU.surface->pixels +
|
||||
((dest_line << GPU.upscale_shift) + i) * GPU.surface->pitch32;
|
||||
memset(dest, 0, udx_start * sizeof(int32));
|
||||
|
||||
//printf("%d %d %d - %d %d\n", scanline, dx_start, dx_end, HorizStart, HorizEnd);
|
||||
ReorderRGB_Var(
|
||||
RED_SHIFT,
|
||||
GREEN_SHIFT,
|
||||
@ -1754,8 +1699,6 @@ int32_t GPU_Update(const int32_t sys_timestamp)
|
||||
GPU.upscale_shift,
|
||||
_upscale);
|
||||
|
||||
//printf("dx_end: %d, dmw: %d\n", udx_end, udmw);
|
||||
//
|
||||
for(x = udx_end; x < udmw; x++)
|
||||
dest[x] = 0;
|
||||
}
|
||||
@ -1764,9 +1707,6 @@ int32_t GPU_Update(const int32_t sys_timestamp)
|
||||
dest = GPU.surface->pixels + ((dest_line << GPU.upscale_shift) * GPU.surface->pitch32);
|
||||
}
|
||||
|
||||
//if(GPU.scanline == 64)
|
||||
// printf("%u\n", sys_timestamp - ((uint64)gpu_clocks * 65536) / GPU.GPUClockRatio);
|
||||
|
||||
dmw_width = dmw;
|
||||
pix_clock_offset = (488 - 146) / DotClockRatios[dmc];
|
||||
pix_clock = (GPU.HardwarePALType ? 53203425 : 53693182) / DotClockRatios[dmc];
|
||||
@ -1820,8 +1760,6 @@ TheEnd:
|
||||
next_dt = std::max<int32>(1, next_dt);
|
||||
next_dt = std::min<int32>(EventCycles, next_dt);
|
||||
|
||||
//printf("%d\n", next_dt);
|
||||
|
||||
return(sys_timestamp + next_dt);
|
||||
}
|
||||
|
||||
|
@ -76,11 +76,6 @@
|
||||
uint32_t IntermediateBufferPos;
|
||||
int16_t IntermediateBuffer[4096][2];
|
||||
|
||||
//#define SPUIRQ_DBG(format, ...) { printf("[SPUIRQDBG] " format " -- Voice 22 CA=0x%06x,LA=0x%06x\n", ## __VA_ARGS__, Voices[22].CurAddr, Voices[22].LoopAddr); }
|
||||
|
||||
static INLINE void SPUIRQ_DBG(const char *fmt, ...)
|
||||
{
|
||||
}
|
||||
|
||||
static const int16 FIR_Table[256][4] =
|
||||
{
|
||||
@ -252,7 +247,6 @@ void SPU_Sweep::Clock()
|
||||
int divinco;
|
||||
|
||||
CalcVCDelta(0x7F, Control & 0x7F, log_mode, dec_mode, inv_increment, (int16)(Current ^ vc_cv_xor), increment, divinco);
|
||||
//printf("%d %d\n", divinco, increment);
|
||||
|
||||
if((dec_mode & !(inv_mode & log_mode)) && ((Current & 0x8000) == (inv_mode ? 0x0000 : 0x8000) || (Current == 0)))
|
||||
{
|
||||
@ -274,8 +268,6 @@ void SPU_Sweep::Clock()
|
||||
uint16 PrevCurrent = Current;
|
||||
Current = Current + increment;
|
||||
|
||||
//printf("%04x %04x\n", PrevCurrent, Current);
|
||||
|
||||
if(!dec_mode && ((Current ^ PrevCurrent) & 0x8000) && ((Current ^ TestInvert) & 0x8000))
|
||||
Current = 0x7FFF ^ TestInvert;
|
||||
}
|
||||
@ -312,7 +304,6 @@ void PS_SPU::RunDecoder(SPU_Voice *voice)
|
||||
unsigned test_addr = (voice->CurAddr - 1) & 0x3FFFF;
|
||||
if(IRQAddr == test_addr || IRQAddr == (test_addr & 0x3FFF8))
|
||||
{
|
||||
//SPUIRQ_DBG("SPU IRQ (VDA): 0x%06x", addr);
|
||||
IRQAsserted = true;
|
||||
IRQ_Assert(IRQ_SPU, IRQAsserted);
|
||||
}
|
||||
@ -355,7 +346,6 @@ void PS_SPU::RunDecoder(SPU_Voice *voice)
|
||||
unsigned test_addr = voice->CurAddr & 0x3FFFF;
|
||||
if(IRQAddr == test_addr || IRQAddr == (test_addr & 0x3FFF8))
|
||||
{
|
||||
//SPUIRQ_DBG("SPU IRQ: 0x%06x", addr);
|
||||
IRQAsserted = true;
|
||||
IRQ_Assert(IRQ_SPU, IRQAsserted);
|
||||
}
|
||||
@ -372,15 +362,6 @@ void PS_SPU::RunDecoder(SPU_Voice *voice)
|
||||
{
|
||||
if(!voice->IgnoreSampLA)
|
||||
voice->LoopAddr = voice->CurAddr;
|
||||
#if 0
|
||||
else
|
||||
{
|
||||
if((voice->LoopAddr ^ voice->CurAddr) & ~0x7)
|
||||
{
|
||||
PSX_DBG(PSX_DBG_FLOOD, "[SPU] Ignore: LoopAddr=0x%08x, SampLA=0x%08x\n", voice->LoopAddr, voice->CurAddr);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
voice->CurAddr = (voice->CurAddr + 1) & 0x3FFFF;
|
||||
}
|
||||
@ -402,8 +383,6 @@ void PS_SPU::RunDecoder(SPU_Voice *voice)
|
||||
|
||||
if(MDFN_UNLIKELY(shift > 12))
|
||||
{
|
||||
//PSX_DBG(PSX_DBG_FLOOD, "[SPU] Buggy/Illegal ADPCM block shift value on voice %u: %u\n", (unsigned)(voice - Voices), shift);
|
||||
|
||||
shift = 8;
|
||||
CV &= 0x8888;
|
||||
}
|
||||
@ -542,7 +521,6 @@ INLINE void PS_SPU::CheckIRQAddr(uint32 addr)
|
||||
if(IRQAddr != addr)
|
||||
return;
|
||||
|
||||
//SPUIRQ_DBG("SPU IRQ (ALT): 0x%06x", addr);
|
||||
IRQAsserted = true;
|
||||
IRQ_Assert(IRQ_SPU, IRQAsserted);
|
||||
}
|
||||
@ -581,11 +559,6 @@ INLINE uint32 PS_SPU::Get_Reverb_Offset(uint32 in_offset)
|
||||
offset += ReverbWA & ((int32)(offset << 13) >> 31);
|
||||
offset &= 0x3FFFF;
|
||||
|
||||
// For debugging in case there are any problems with games misprogramming the reverb registers in a race-conditiony manner that
|
||||
// causes important data in SPU RAM to be trashed:
|
||||
//if(offset < ReverbWA)
|
||||
// printf("BARF: offset=%05x reverbwa=%05x reverbcur=%05x in_offset=%05x\n", offset, ReverbWA, ReverbCur, in_offset & 0x3FFFF);
|
||||
|
||||
return(offset);
|
||||
}
|
||||
|
||||
@ -950,23 +923,13 @@ int32 PS_SPU::UpdateFromCDC(int32 clocks)
|
||||
//
|
||||
if(voice->DecodePlayDelay < 3)
|
||||
{
|
||||
#if 0
|
||||
if(voice->DecodePlayDelay)
|
||||
PSX_DBG(PSX_DBG_WARNING, "[SPU] Voice %u off maybe should be ignored, but isn't due to current emulation code limitations; dpd=%u\n", voice_num, voice->DecodePlayDelay);
|
||||
#endif
|
||||
ReleaseEnvelope(voice);
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
else
|
||||
PSX_DBG(PSX_DBG_WARNING, "[SPU] Voice %u off ignored.\n", voice_num);
|
||||
#endif
|
||||
}
|
||||
|
||||
if(VoiceOn & (1U << voice_num))
|
||||
{
|
||||
//printf("Voice On: %u\n", voice_num);
|
||||
|
||||
ResetEnvelope(voice);
|
||||
|
||||
voice->DecodeFlags = 0;
|
||||
@ -1084,7 +1047,6 @@ int32 PS_SPU::UpdateFromCDC(int32 clocks)
|
||||
|
||||
void PS_SPU::WriteDMA(uint32 V)
|
||||
{
|
||||
//SPUIRQ_DBG("DMA Write, RWAddr after=0x%06x", RWAddr);
|
||||
WriteSPURAM(RWAddr, V);
|
||||
RWAddr = (RWAddr + 1) & 0x3FFFF;
|
||||
|
||||
@ -1105,7 +1067,6 @@ uint32 PS_SPU::ReadDMA(void)
|
||||
|
||||
CheckIRQAddr(RWAddr);
|
||||
|
||||
//SPUIRQ_DBG("DMA Read, RWAddr after=0x%06x", RWAddr);
|
||||
|
||||
return(ret);
|
||||
}
|
||||
@ -1119,7 +1080,6 @@ void PS_SPU::Write(int32_t timestamp, uint32 A, uint16 V)
|
||||
|
||||
if(A >= 0x200)
|
||||
{
|
||||
//printf("Write: %08x %04x\n", A, V);
|
||||
if(A < 0x260)
|
||||
{
|
||||
SPU_Voice *voice = &Voices[(A - 0x200) >> 2];
|
||||
@ -1163,16 +1123,6 @@ void PS_SPU::Write(int32_t timestamp, uint32 A, uint16 V)
|
||||
case 0x0E:
|
||||
voice->LoopAddr = (V << 2) & 0x3FFFF;
|
||||
voice->IgnoreSampLA = true;
|
||||
#if 0
|
||||
if(voice->DecodePlayDelay || (VoiceOn & (1U << (voice - Voices))))
|
||||
{
|
||||
PSX_WARNING("[SPU] Loop address for voice %u written during voice on delay.", (unsigned)(voice - Voices));
|
||||
}
|
||||
if((voice - Voices) == 22)
|
||||
{
|
||||
SPUIRQ_DBG("Manual loop address setting for voice %d: %04x", (int)(voice - Voices), V);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1248,13 +1198,11 @@ void PS_SPU::Write(int32_t timestamp, uint32 A, uint16 V)
|
||||
case 0x24:
|
||||
IRQAddr = (V << 2) & 0x3FFFF;
|
||||
CheckIRQAddr(RWAddr);
|
||||
//SPUIRQ_DBG("Set IRQAddr=0x%06x", IRQAddr);
|
||||
break;
|
||||
|
||||
case 0x26:
|
||||
RWAddr = (V << 2) & 0x3FFFF;
|
||||
CheckIRQAddr(RWAddr);
|
||||
//SPUIRQ_DBG("Set RWAddr=0x%06x", RWAddr);
|
||||
break;
|
||||
|
||||
case 0x28: WriteSPURAM(RWAddr, V);
|
||||
@ -1262,12 +1210,9 @@ void PS_SPU::Write(int32_t timestamp, uint32 A, uint16 V)
|
||||
CheckIRQAddr(RWAddr);
|
||||
break;
|
||||
|
||||
case 0x2A: //if((SPUControl & 0x80) && !(V & 0x80))
|
||||
// printf("\n\n\n\n ************** REVERB PROCESSING DISABLED\n\n\n\n");
|
||||
case 0x2A:
|
||||
|
||||
SPUControl = V;
|
||||
//SPUIRQ_DBG("Set SPUControl=0x%04x -- IRQA=%06x, RWA=%06x", V, IRQAddr, RWAddr);
|
||||
//printf("SPU control write: %04x\n", V);
|
||||
if(!(V & 0x40))
|
||||
{
|
||||
IRQAsserted = false;
|
||||
@ -1305,16 +1250,11 @@ uint16 PS_SPU::Read(int32_t timestamp, uint32 A)
|
||||
{
|
||||
A &= 0x3FF;
|
||||
|
||||
//PSX_DBGINFO("[SPU] Read: %08x", A);
|
||||
|
||||
if(A >= 0x200)
|
||||
{
|
||||
if(A < 0x260)
|
||||
{
|
||||
SPU_Voice *voice = &Voices[(A - 0x200) >> 2];
|
||||
|
||||
//printf("Read: %08x %04x\n", A, voice->Sweep[(A & 2) >> 1].ReadVolume());
|
||||
|
||||
return voice->Sweep[(A & 2) >> 1].ReadVolume();
|
||||
}
|
||||
else if(A < 0x280)
|
||||
|
@ -173,15 +173,6 @@ static bool MDFN_FASTCALL TimerMatch(unsigned i)
|
||||
if(Timers[i].Counter == 0 || Timers[i].Counter == Timers[i].Target)
|
||||
irq_exact = true;
|
||||
|
||||
#if 0
|
||||
{
|
||||
const uint16_t lateness = (Timers[i].Mode & 0x008) ? Timers[i].Counter : (Timers[i].Counter - Timers[i].Target);
|
||||
|
||||
if(lateness > ((i == 1 && (Timers[i].Mode & 0x100)) ? 0 : 3))
|
||||
PSX_DBG(PSX_DBG_WARNING, "[TIMER] Timer %d match IRQ trigger late: %u\n", i, lateness);
|
||||
}
|
||||
#endif
|
||||
|
||||
Timers[i].IRQDone = true;
|
||||
IRQ_Assert(IRQ_TIMER_0 + i, true);
|
||||
IRQ_Assert(IRQ_TIMER_0 + i, false);
|
||||
@ -202,11 +193,6 @@ static bool MDFN_FASTCALL TimerOverflow(unsigned i)
|
||||
if(Timers[i].Counter == 0)
|
||||
irq_exact = true;
|
||||
|
||||
#if 0
|
||||
if(Timers[i].Counter > ((i == 1 && (Timers[i].Mode & 0x100)) ? 0 : 3))
|
||||
PSX_DBG(PSX_DBG_WARNING, "[TIMER] Timer %d overflow IRQ trigger late: %u\n", i, Timers[i].Counter);
|
||||
#endif
|
||||
|
||||
Timers[i].IRQDone = true;
|
||||
IRQ_Assert(IRQ_TIMER_0 + i, true);
|
||||
IRQ_Assert(IRQ_TIMER_0 + i, false);
|
||||
@ -395,10 +381,6 @@ void MDFN_FASTCALL TIMER_Write(const int32_t timestamp, uint32_t A, uint16_t V)
|
||||
|
||||
V <<= (A & 3) * 8;
|
||||
|
||||
/*
|
||||
PSX_DBGINFO("[TIMER] Write: %08x %04x\n", A, V);
|
||||
*/
|
||||
|
||||
if(which >= 3)
|
||||
return;
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -28,6 +28,10 @@
|
||||
|
||||
#include "state.h"
|
||||
|
||||
#define SSEEK_END 2
|
||||
#define SSEEK_CUR 1
|
||||
#define SSEEK_SET 0
|
||||
|
||||
#define RLSB MDFNSTATE_RLSB /* 0x80000000 */
|
||||
|
||||
/* Forward declaration */
|
||||
@ -87,13 +91,13 @@ static int32_t smem_seek(StateMem *st, uint32_t offset, int whence)
|
||||
{
|
||||
switch(whence)
|
||||
{
|
||||
case SEEK_SET:
|
||||
case SSEEK_SET:
|
||||
st->loc = offset;
|
||||
break;
|
||||
case SEEK_END:
|
||||
case SSEEK_END:
|
||||
st->loc = st->len - offset;
|
||||
break;
|
||||
case SEEK_CUR:
|
||||
case SSEEK_CUR:
|
||||
st->loc += offset;
|
||||
break;
|
||||
}
|
||||
@ -129,7 +133,7 @@ static int smem_read32le(StateMem *st, uint32_t *b)
|
||||
return(4);
|
||||
}
|
||||
|
||||
static bool SubWrite(StateMem *st, SFORMAT *sf, const char *name_prefix)
|
||||
static bool SubWrite(StateMem *st, SFORMAT *sf)
|
||||
{
|
||||
while(sf->size || sf->name) /* Size can sometimes be zero, so also check for the text name. These two should both be zero only at the end of a struct. */
|
||||
{
|
||||
@ -141,7 +145,7 @@ static bool SubWrite(StateMem *st, SFORMAT *sf, const char *name_prefix)
|
||||
|
||||
if(sf->size == (uint32_t)~0) /* Link to another struct. */
|
||||
{
|
||||
if(!SubWrite(st, (SFORMAT *)sf->v, name_prefix))
|
||||
if(!SubWrite(st, (SFORMAT *)sf->v))
|
||||
return(0);
|
||||
|
||||
sf++;
|
||||
@ -154,16 +158,8 @@ static bool SubWrite(StateMem *st, SFORMAT *sf, const char *name_prefix)
|
||||
if (!FastSaveStates)
|
||||
{
|
||||
char nameo[1 + 256];
|
||||
int slen;
|
||||
|
||||
if (name_prefix)
|
||||
slen = snprintf(
|
||||
nameo + 1, 256, "%s%s", name_prefix, sf->name);
|
||||
else
|
||||
{
|
||||
slen = strlcpy(nameo + 1, sf->name, 255);
|
||||
nameo[256] = 0;
|
||||
}
|
||||
int slen = strlcpy(nameo + 1, sf->name, 255);
|
||||
nameo[256] = 0;
|
||||
nameo[0] = slen;
|
||||
|
||||
smem_write(st, nameo, 1 + nameo[0]);
|
||||
@ -231,14 +227,14 @@ static int WriteStateChunk(StateMem *st, const char *sname, SFORMAT *sf)
|
||||
|
||||
data_start_pos = st->loc;
|
||||
|
||||
if(!SubWrite(st, sf, NULL))
|
||||
if(!SubWrite(st, sf))
|
||||
return(0);
|
||||
|
||||
end_pos = st->loc;
|
||||
|
||||
smem_seek(st, data_start_pos - 4, SEEK_SET);
|
||||
smem_seek(st, data_start_pos - 4, SSEEK_SET);
|
||||
smem_write32le(st, end_pos - data_start_pos);
|
||||
smem_seek(st, end_pos, SEEK_SET);
|
||||
smem_seek(st, end_pos, SSEEK_SET);
|
||||
|
||||
return(end_pos - data_start_pos);
|
||||
}
|
||||
@ -318,7 +314,7 @@ static int ReadStateChunk(StateMem *st, SFORMAT *sf, int size)
|
||||
|
||||
if(recorded_size != expected_size)
|
||||
{
|
||||
if(smem_seek(st, recorded_size, SEEK_CUR) < 0)
|
||||
if(smem_seek(st, recorded_size, SSEEK_CUR) < 0)
|
||||
return(0);
|
||||
}
|
||||
else
|
||||
@ -347,7 +343,7 @@ static int ReadStateChunk(StateMem *st, SFORMAT *sf, int size)
|
||||
}
|
||||
else
|
||||
{
|
||||
if(smem_seek(st, recorded_size, SEEK_CUR) < 0)
|
||||
if(smem_seek(st, recorded_size, SSEEK_CUR) < 0)
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
@ -386,11 +382,11 @@ static int MDFNSS_StateAction_internal(void *st_p, int load, int data_only, stru
|
||||
}
|
||||
else
|
||||
{
|
||||
if(smem_seek(st, tmp_size, SEEK_CUR) < 0)
|
||||
if(smem_seek(st, tmp_size, SSEEK_CUR) < 0)
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
if(smem_seek(st, -total, SEEK_CUR) < 0)
|
||||
if(smem_seek(st, -total, SSEEK_CUR) < 0)
|
||||
return(0);
|
||||
if(!found && !section->optional) /* Not found. We are sad! */
|
||||
return(0);
|
||||
@ -438,7 +434,7 @@ int MDFNSS_SaveSM(void *st_p, int a, int b, const void *c, const void *d,
|
||||
return(0);
|
||||
|
||||
sizy = st->loc;
|
||||
smem_seek(st, 16 + 4, SEEK_SET);
|
||||
smem_seek(st, 16 + 4, SSEEK_SET);
|
||||
smem_write32le(st, sizy);
|
||||
|
||||
return(1);
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
********************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "ogg.h"
|
||||
|
@ -17,7 +17,6 @@
|
||||
********************************************************************/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
@ -1,7 +1,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <compat/strl.h>
|
||||
#include <string/stdstring.h>
|
||||
#include <ugui.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define UGUI_MAX_OBJECTS 2
|
||||
static UG_GUI gui;
|
||||
@ -57,7 +58,7 @@ void gui_set_message(const char *message)
|
||||
{
|
||||
memset(gui_message, 0, sizeof(gui_message));
|
||||
|
||||
snprintf(gui_message, sizeof(gui_message), "%s", message);
|
||||
strlcpy(gui_message, message, sizeof(gui_message));
|
||||
|
||||
gui_message[sizeof(gui_message) - 1] = '\0';
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user