mirror of https://github.com/PCSX2/pcsx2.git
Build: Fix up various warnings, increase variable readability
This commit is contained in:
parent
312a583092
commit
88f8ef0244
|
@ -40,6 +40,17 @@
|
|||
}; \
|
||||
};
|
||||
|
||||
template<typename T> static T GetBufferT(u8* buffer, u32 offset) {
|
||||
T value;
|
||||
std::memcpy(&value, buffer + offset, sizeof(value));
|
||||
return value;
|
||||
}
|
||||
|
||||
static u8 GetBufferU8(u8* buffer, u32 offset) { return GetBufferT<u8>(buffer, offset); }
|
||||
static u16 GetBufferU16(u8* buffer, u32 offset) { return GetBufferT<u16>(buffer, offset); }
|
||||
static u32 GetBufferU32(u8* buffer, u32 offset) { return GetBufferT<u32>(buffer, offset); }
|
||||
static u64 GetBufferU64(u8* buffer, u32 offset) { return GetBufferT<u64>(buffer, offset); }
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// PageProtectionMode
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -28,7 +28,7 @@ class IsoReader;
|
|||
#define btoi(b) ((b) / 16 * 10 + (b) % 16) /* BCD to u_char */
|
||||
#define itob(i) ((i) / 10 * 16 + (i) % 10) /* u_char to BCD */
|
||||
|
||||
static __fi s32 msf_to_lsn(u8* Time)
|
||||
static __fi s32 msf_to_lsn(const u8* Time) noexcept
|
||||
{
|
||||
u32 lsn;
|
||||
|
||||
|
@ -38,7 +38,7 @@ static __fi s32 msf_to_lsn(u8* Time)
|
|||
return lsn;
|
||||
}
|
||||
|
||||
static __fi s32 msf_to_lba(u8 m, u8 s, u8 f)
|
||||
static __fi s32 msf_to_lba(const u8 m, const u8 s, const u8 f) noexcept
|
||||
{
|
||||
u32 lsn;
|
||||
lsn = f;
|
||||
|
@ -47,7 +47,7 @@ static __fi s32 msf_to_lba(u8 m, u8 s, u8 f)
|
|||
return lsn;
|
||||
}
|
||||
|
||||
static __fi void lsn_to_msf(u8* Time, s32 lsn)
|
||||
static __fi void lsn_to_msf(u8* Time, s32 lsn) noexcept
|
||||
{
|
||||
u8 m, s, f;
|
||||
|
||||
|
@ -61,7 +61,7 @@ static __fi void lsn_to_msf(u8* Time, s32 lsn)
|
|||
Time[2] = itob(f);
|
||||
}
|
||||
|
||||
static __fi void lba_to_msf(s32 lba, u8* m, u8* s, u8* f)
|
||||
static __fi void lba_to_msf(s32 lba, u8* m, u8* s, u8* f) noexcept
|
||||
{
|
||||
lba += 150;
|
||||
*m = lba / (60 * 75);
|
||||
|
@ -111,22 +111,22 @@ struct cdvdStruct
|
|||
u8 IntrStat;
|
||||
u8 Status;
|
||||
u8 StatusSticky;
|
||||
u8 Type;
|
||||
u8 DiscType;
|
||||
u8 sCommand;
|
||||
u8 sDataIn;
|
||||
u8 sDataOut;
|
||||
u8 HowTo;
|
||||
|
||||
u8 NCMDParam[16];
|
||||
u8 SCMDParam[16];
|
||||
u8 SCMDResult[16];
|
||||
u8 NCMDParamBuff[16];
|
||||
u8 SCMDParamBuff[16];
|
||||
u8 SCMDResultBuff[16];
|
||||
|
||||
u8 NCMDParamC;
|
||||
u8 NCMDParamP;
|
||||
u8 SCMDParamC;
|
||||
u8 SCMDParamP;
|
||||
u8 SCMDResultC;
|
||||
u8 SCMDResultP;
|
||||
u8 NCMDParamCnt;
|
||||
u8 NCMDParamPos;
|
||||
u8 SCMDParamCnt;
|
||||
u8 SCMDParamPos;
|
||||
u8 SCMDResultCnt;
|
||||
u8 SCMDResultPos;
|
||||
|
||||
u8 CBlockIndex;
|
||||
u8 COffset;
|
||||
|
@ -138,17 +138,17 @@ struct cdvdStruct
|
|||
int RTCcount;
|
||||
cdvdRTC RTC;
|
||||
|
||||
u32 Sector;
|
||||
int nSectors;
|
||||
int Readed; // change to bool. --arcum42
|
||||
u32 CurrentSector;
|
||||
int SectorCnt;
|
||||
int SeekCompleted; // change to bool. --arcum42
|
||||
int Reading; // same here.
|
||||
int WaitingDMA;
|
||||
int ReadMode;
|
||||
int BlockSize; // Total bytes transfered at 1x speed
|
||||
int Speed;
|
||||
int RetryCnt;
|
||||
int RetryCntP;
|
||||
int RErr;
|
||||
int RetryCntMax;
|
||||
int CurrentRetryCnt;
|
||||
int ReadErr;
|
||||
int SpindlCtrl;
|
||||
|
||||
u8 Key[16];
|
||||
|
|
|
@ -135,8 +135,8 @@ enum CDVD_MODE_TYPE
|
|||
MODE_DVDROM,
|
||||
};
|
||||
|
||||
static const uint tbl_FastSeekDelta[3] =
|
||||
{
|
||||
static constexpr uint tbl_FastSeekDelta[3] =
|
||||
{
|
||||
4371, // CD-ROM
|
||||
14764, // Single-layer DVD-ROM
|
||||
13360 // dual-layer DVD-ROM [currently unused]
|
||||
|
@ -144,31 +144,31 @@ static const uint tbl_FastSeekDelta[3] =
|
|||
|
||||
// if a seek is within this many blocks, read instead of seek.
|
||||
// These values are arbitrary assumptions. Not sure what the real PS2 uses.
|
||||
static const uint tbl_ContigiousSeekDelta[3] =
|
||||
{
|
||||
static constexpr uint tbl_ContigiousSeekDelta[3] =
|
||||
{
|
||||
8, // CD-ROM
|
||||
16, // single-layer DVD-ROM
|
||||
16, // dual-layer DVD-ROM [currently unused]
|
||||
};
|
||||
|
||||
static const uint PSX_CD_READSPEED = 153600; // Bytes per second, rough values from outer CD (CAV).
|
||||
static const uint PSX_DVD_READSPEED = 1382400; // Bytes per second, rough values from outer DVD (CAV).
|
||||
static constexpr uint PSX_CD_READSPEED = 153600; // Bytes per second, rough values from outer CD (CAV).
|
||||
static constexpr uint PSX_DVD_READSPEED = 1382400; // Bytes per second, rough values from outer DVD (CAV).
|
||||
|
||||
static const uint CD_SECTORS_PERSECOND = 75;
|
||||
static const uint DVD_SECTORS_PERSECOND = 675;
|
||||
static constexpr uint CD_SECTORS_PERSECOND = 75;
|
||||
static constexpr uint DVD_SECTORS_PERSECOND = 675;
|
||||
|
||||
// Rotations per minute.
|
||||
static const uint CD_MIN_ROTATION_X1 = 214;
|
||||
static const uint CD_MAX_ROTATION_X1 = 497;
|
||||
static constexpr uint CD_MIN_ROTATION_X1 = 214;
|
||||
static constexpr uint CD_MAX_ROTATION_X1 = 497;
|
||||
|
||||
static const uint DVD_MIN_ROTATION_X1 = 570;
|
||||
static const uint DVD_MAX_ROTATION_X1 = 1515;
|
||||
static constexpr uint DVD_MIN_ROTATION_X1 = 570;
|
||||
static constexpr uint DVD_MAX_ROTATION_X1 = 1515;
|
||||
|
||||
// Legacy Note: FullSeek timing causes many games to load very slow, but it likely not the real problem.
|
||||
// Games breaking with it set to PSXCLK*40 : "wrath unleashed" and "Shijou Saikyou no Deshi Kenichi".
|
||||
|
||||
static const uint Cdvd_FullSeek_Cycles = (PSXCLK * 100) / 1000; // average number of cycles per fullseek (100ms)
|
||||
static const uint Cdvd_FastSeek_Cycles = (PSXCLK * 30) / 1000; // average number of cycles per fastseek (37ms)
|
||||
static constexpr uint Cdvd_FullSeek_Cycles = (36864000UL * 100UL) / 1000UL; // average number of cycles per fullseek (100ms)
|
||||
static constexpr uint Cdvd_FastSeek_Cycles = (36864000UL * 30UL) / 1000UL; // average number of cycles per fastseek (37ms)
|
||||
bool trayState = 0; // Used to check if the CD tray status has changed since the last time
|
||||
|
||||
static const char* mg_zones[8] = {"Japan", "USA", "Europe", "Oceania", "Asia", "Russia", "China", "Mexico"};
|
||||
|
|
|
@ -32,7 +32,7 @@ enum isoType
|
|||
ISOTYPE_DVDDL
|
||||
};
|
||||
|
||||
static const int CD_FRAMESIZE_RAW = 2448;
|
||||
static constexpr int CD_FRAMESIZE_RAW = 2448;
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// isoFile
|
||||
|
@ -73,9 +73,9 @@ public:
|
|||
|
||||
bool IsOpened() const;
|
||||
|
||||
isoType GetType() const { return m_type; }
|
||||
uint GetBlockCount() const { return m_blocks; }
|
||||
int GetBlockOffset() const { return m_blockofs; }
|
||||
isoType GetType() const noexcept { return m_type; }
|
||||
uint GetBlockCount() const noexcept { return m_blocks; }
|
||||
int GetBlockOffset() const noexcept { return m_blockofs; }
|
||||
|
||||
const std::string& GetFilename() const
|
||||
{
|
||||
|
@ -127,7 +127,7 @@ public:
|
|||
bool IsOpened() const;
|
||||
u32 GetBlockSize() const;
|
||||
|
||||
const std::string& GetFilename() const
|
||||
const std::string& GetFilename() const noexcept
|
||||
{
|
||||
return m_filename;
|
||||
}
|
||||
|
|
|
@ -875,7 +875,7 @@ void cdrWrite1(u8 rt)
|
|||
if (cdr.Mode & MODE_CDDA)
|
||||
{
|
||||
StopCdda();
|
||||
cdvd.Type = CDVD_TYPE_PSCDDA;
|
||||
cdvd.DiscType = CDVD_TYPE_PSCDDA;
|
||||
}
|
||||
|
||||
setPs1CDVDSpeed(cdvd.Speed);
|
||||
|
|
|
@ -881,7 +881,7 @@ void GSState::ApplyTEX0(GIFRegTEX0& TEX0)
|
|||
|
||||
if (wt)
|
||||
{
|
||||
GIFRegBITBLTBUF BITBLTBUF;
|
||||
GIFRegBITBLTBUF BITBLTBUF = {};
|
||||
GSVector4i r;
|
||||
|
||||
if (TEX0.CSM == 0)
|
||||
|
@ -4689,10 +4689,10 @@ void GSState::GSPCRTCRegs::CalculateDisplayOffset(bool scanmask)
|
|||
// Offset is not screen based, but relative to each other.
|
||||
if (both_enabled)
|
||||
{
|
||||
GSVector2i offset;
|
||||
|
||||
offset.x = (PCRTCDisplays[1 - zeroDisplay.x].displayOffset.x - PCRTCDisplays[zeroDisplay.x].displayOffset.x) / (VideoModeDividers[videomode].x + 1);
|
||||
offset.y = (PCRTCDisplays[1 - zeroDisplay.y].displayOffset.y - PCRTCDisplays[zeroDisplay.y].displayOffset.y) / (VideoModeDividers[videomode].y + 1);
|
||||
GSVector2i offset = {
|
||||
(PCRTCDisplays[1 - zeroDisplay.x].displayOffset.x - PCRTCDisplays[zeroDisplay.x].displayOffset.x) / (VideoModeDividers[videomode].x + 1),
|
||||
(PCRTCDisplays[1 - zeroDisplay.y].displayOffset.y - PCRTCDisplays[zeroDisplay.y].displayOffset.y) / (VideoModeDividers[videomode].y + 1)
|
||||
};
|
||||
|
||||
if (offset.x >= 4 || !GSConfig.PCRTCAntiBlur || scanmask)
|
||||
{
|
||||
|
@ -4724,7 +4724,6 @@ void GSState::GSPCRTCRegs::CalculateDisplayOffset(bool scanmask)
|
|||
else // We're using screen offsets, so just calculate the entire offset.
|
||||
{
|
||||
const GSVector4i offsets = !GSConfig.PCRTCOverscan ? VideoModeOffsets[videomode] : VideoModeOffsetsOverscan[videomode];
|
||||
GSVector2i offset = { 0, 0 };
|
||||
GSVector2i zeroDisplay = NearestToZeroOffset();
|
||||
|
||||
if (both_enabled)
|
||||
|
@ -4742,8 +4741,10 @@ void GSState::GSPCRTCRegs::CalculateDisplayOffset(bool scanmask)
|
|||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
// Should this be MAGV/H in the DISPLAY register rather than the "default" magnification?
|
||||
offset.x = (static_cast<int>(PCRTCDisplays[i].displayOffset.x) - offsets.z) / (VideoModeDividers[videomode].x + 1);
|
||||
offset.y = (static_cast<int>(PCRTCDisplays[i].displayOffset.y) - (offsets.w * (interlaced + 1))) / (VideoModeDividers[videomode].y + 1);
|
||||
const GSVector2i offset = {
|
||||
(static_cast<int>(PCRTCDisplays[i].displayOffset.x) - offsets.z) / (VideoModeDividers[videomode].x + 1),
|
||||
(static_cast<int>(PCRTCDisplays[i].displayOffset.y) - (offsets.w * (interlaced + 1))) / (VideoModeDividers[videomode].y + 1)
|
||||
};
|
||||
|
||||
PCRTCDisplays[i].displayRect.x += offset.x;
|
||||
PCRTCDisplays[i].displayRect.z += offset.x;
|
||||
|
@ -4753,10 +4754,10 @@ void GSState::GSPCRTCRegs::CalculateDisplayOffset(bool scanmask)
|
|||
|
||||
if (both_enabled)
|
||||
{
|
||||
GSVector2i offset;
|
||||
|
||||
offset.x = (PCRTCDisplays[1 - zeroDisplay.x].displayRect.x - PCRTCDisplays[zeroDisplay.x].displayRect.x);
|
||||
offset.y = (PCRTCDisplays[1 - zeroDisplay.y].displayRect.y - PCRTCDisplays[zeroDisplay.y].displayRect.y);
|
||||
const GSVector2i offset = {
|
||||
(PCRTCDisplays[1 - zeroDisplay.x].displayRect.x - PCRTCDisplays[zeroDisplay.x].displayRect.x),
|
||||
(PCRTCDisplays[1 - zeroDisplay.y].displayRect.y - PCRTCDisplays[zeroDisplay.y].displayRect.y)
|
||||
};
|
||||
|
||||
if (offset.x > 0 && offset.x < 4 && GSConfig.PCRTCAntiBlur)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue