Compare commits

..
Author SHA1 Message Date
refractionpcsx2 6db638dc03 SPU2: Pass IOP cycle count at 64bit 2026-08-19 14:00:41 +02:00
9 changed files with 14 additions and 31 deletions
+4 -7
View File
@@ -468,7 +468,7 @@ u32 cdvdGetElfCRC(const std::string& path)
return elfo.GetCRC();
}
static CDVDDiscType GetPS2ElfName(IsoReader& isor, std::string* name, std::string* version, std::string* vmode, Error* error)
static CDVDDiscType GetPS2ElfName(IsoReader& isor, std::string* name, std::string* version, Error* error)
{
CDVDDiscType retype = CDVDDiscType::Other;
name->clear();
@@ -510,7 +510,6 @@ static CDVDDiscType GetPS2ElfName(IsoReader& isor, std::string* name, std::strin
else if (key == "VMODE")
{
DevCon.WriteLn(Color_Blue, fmt::format("(SYSTEM.CNF) Disc region type = {}", value));
*vmode = value;
}
else if (key == "VER")
{
@@ -575,15 +574,15 @@ static std::string ExecutablePathToSerial(const std::string& path)
return serial;
}
void cdvdGetDiscInfo(std::string* out_serial, std::string* out_elf_path, std::string* out_version, std::string* out_region, u32* out_crc,
void cdvdGetDiscInfo(std::string* out_serial, std::string* out_elf_path, std::string* out_version, u32* out_crc,
CDVDDiscType* out_disc_type)
{
Error error;
IsoReader isor;
std::string elfpath, version, vmode;
std::string elfpath, version;
CDVDDiscType disc_type = CDVDDiscType::Other;
if (!isor.Open(&error) || (disc_type = GetPS2ElfName(isor, &elfpath, &version, &vmode, &error)) == CDVDDiscType::Other)
if (!isor.Open(&error) || (disc_type = GetPS2ElfName(isor, &elfpath, &version, &error)) == CDVDDiscType::Other)
Console.Error(fmt::format("Failed to get ELF name: {}", error.GetDescription()));
// Don't bother parsing it if we don't need the CRC.
@@ -617,8 +616,6 @@ void cdvdGetDiscInfo(std::string* out_serial, std::string* out_elf_path, std::st
*out_version = std::move(version);
if (out_disc_type)
*out_disc_type = disc_type;
if (out_region)
*out_region = vmode;
}
void cdvdReadKey(u8, u16, u32 arg2, u8* key)
+1 -1
View File
@@ -179,7 +179,7 @@ extern void cdvdNewDiskCB();
extern u8 cdvdRead(u8 key);
extern void cdvdWrite(u8 key, u8 rt);
extern void cdvdGetDiscInfo(std::string* out_serial, std::string* out_elf_path, std::string* out_version, std::string* out_region, u32* out_crc,
extern void cdvdGetDiscInfo(std::string* out_serial, std::string* out_elf_path, std::string* out_version, u32* out_crc,
CDVDDiscType* out_disc_type);
extern u32 cdvdGetElfCRC(const std::string& path);
extern bool cdvdLoadElf(ElfObject* elfo, const std::string_view elfpath, bool isPSXElf, Error* error);
+4 -6
View File
@@ -215,7 +215,7 @@ static void vSyncInfoCalc(vSyncTimingInfo* info, double framesPerSecond, u32 sca
// Dynasty Warriors 3 Xtreme Legends - fake save corruption when loading save
// Jak II - random speedups
// Shadow of Rome - FMV audio issues
const bool ntsc_hblank = gsVideoMode != GS_VideoMode::PAL && gsVideoMode != GS_VideoMode::DVD_PAL && (gsVideoMode != GS_VideoMode::Uninitialized || framesPerSecond != (Pcsx2Config::GSOptions::DEFAULT_FRAME_RATE_PAL / 2));
const bool ntsc_hblank = gsVideoMode != GS_VideoMode::PAL && gsVideoMode != GS_VideoMode::DVD_PAL;
const u64 HalfFrame = Frame / 2;
const float extra_scanlines = static_cast<float>(IsProgressiveVideoMode()) * (ntsc_hblank ? 0.5f : 1.5f);
const u64 Blank = Scanline * ((ntsc_hblank ? 22.5f : 24.5f) + extra_scanlines);
@@ -307,12 +307,10 @@ double GetVerticalFrequency()
// https://web.archive.org/web/20120629231826fw_/http://ntsc-tv.com/index.html
// https://web.archive.org/web/20200831051302/https://www.hdretrovision.com/240p/
std::string cur_region = VMManager::Internal::GetCurrentRegion();
switch (gsVideoMode)
{
case GS_VideoMode::Uninitialized: // SetGsCrt hasn't executed yet, give some temporary values.
return (cur_region == "PAL") ? Pcsx2Config::GSOptions::DEFAULT_FRAME_RATE_PAL : Pcsx2Config::GSOptions::DEFAULT_FRAME_RATE_NTSC;
return 60.00;
case GS_VideoMode::PAL:
case GS_VideoMode::DVD_PAL:
return (IsProgressiveVideoMode() == false) ? EmuConfig.GS.FrameratePAL : EmuConfig.GS.FrameratePAL - 0.24f;
@@ -354,9 +352,9 @@ void UpdateVSyncRate(bool force)
{
case GS_VideoMode::Uninitialized: // SYSCALL instruction hasn't executed yet, give some temporary values.
if (gsIsInterlaced)
total_scanlines = (vertical_frequency == Pcsx2Config::GSOptions::DEFAULT_FRAME_RATE_PAL) ? SCANLINES_TOTAL_PAL_I : SCANLINES_TOTAL_NTSC_I;
total_scanlines = SCANLINES_TOTAL_NTSC_I;
else
total_scanlines = (vertical_frequency == Pcsx2Config::GSOptions::DEFAULT_FRAME_RATE_PAL) ? SCANLINES_TOTAL_PAL_NI : SCANLINES_TOTAL_NTSC_NI;
total_scanlines = SCANLINES_TOTAL_NTSC_NI;
break;
case GS_VideoMode::PAL:
case GS_VideoMode::DVD_PAL:
+1 -1
View File
@@ -267,7 +267,7 @@ bool GameList::GetIsoSerialAndCRC(const std::string& path, s32* disc_type, std::
// TODO: we could include the version in the game list?
*disc_type = DoCDVDdetectDiskType();
cdvdGetDiscInfo(serial, nullptr, nullptr, nullptr, crc, nullptr);
cdvdGetDiscInfo(serial, nullptr, nullptr, crc, nullptr);
DoCDVDclose();
return true;
}
+1 -1
View File
@@ -679,7 +679,7 @@ void eeloadHook()
{
CDVDDiscType disc_type;
std::string disc_elf;
cdvdGetDiscInfo(nullptr, &disc_elf, nullptr, nullptr, nullptr, &disc_type);
cdvdGetDiscInfo(nullptr, &disc_elf, nullptr, nullptr, &disc_type);
if (disc_type == CDVDDiscType::PS2Disc)
{
// only allow fast boot for PS2 games
+1 -1
View File
@@ -81,6 +81,6 @@ void SPU2writeDMA7Mem(u16* pMem, u32 size);
extern u64 lClocks;
extern void CounterUpdate(u32 DMAICounter);
extern void TimeUpdate(u32 cClocks);
extern void TimeUpdate(u64 cClocks);
extern void SPU2_FastWrite(u32 rmem, u16 value);
+1 -1
View File
@@ -314,7 +314,7 @@ __forceinline void CheckDMAProgress(int cid)
static constexpr uint TickInterval = 768;
static constexpr int SanityInterval = 4800;
__forceinline void TimeUpdate(u32 cClocks)
__forceinline void TimeUpdate(u64 cClocks)
{
u32 dClocks = cClocks - lClocks;
+1 -10
View File
@@ -171,7 +171,6 @@ static std::string s_disc_version;
static std::string s_title;
static std::string s_title_en_search;
static std::string s_title_en_replace;
static std::string s_cur_region;
static u32 s_disc_crc;
static u32 s_current_crc;
static u32 s_elf_entry_point = 0xFFFFFFFFu;
@@ -1052,12 +1051,11 @@ void VMManager::UpdateDiscDetails(bool booting)
s_disc_crc = GSDumpReplayer::GetDumpCRC();
s_disc_elf = {};
s_disc_version = {};
s_cur_region = "NTSC";
serial_is_valid = !s_disc_serial.empty();
}
else if (CDVDsys_GetSourceType() != CDVD_SourceType::NoDisc)
{
cdvdGetDiscInfo(&s_disc_serial, &s_disc_elf, &s_disc_version, &s_cur_region, &s_disc_crc, nullptr);
cdvdGetDiscInfo(&s_disc_serial, &s_disc_elf, &s_disc_version, &s_disc_crc, nullptr);
serial_is_valid = !s_disc_serial.empty();
}
else if (!s_elf_override.empty())
@@ -1065,14 +1063,12 @@ void VMManager::UpdateDiscDetails(bool booting)
s_disc_serial = Path::GetFileTitle(s_elf_override);
s_disc_version = {};
s_disc_crc = 0; // set below
s_cur_region = "NTSC";
}
else
{
s_disc_serial = BiosSerial;
s_disc_version = {};
s_disc_crc = 0;
s_cur_region = (BiosZone == "Europe") ? "PAL" : "NTSC";
title = fmt::format(TRANSLATE_FS("VMManager", "PS2 BIOS ({})"), BiosZone);
}
@@ -2822,11 +2818,6 @@ bool VMManager::Internal::IsFastBootInProgress()
return s_fast_boot_requested && !HasBootedELF();
}
std::string VMManager::Internal::GetCurrentRegion()
{
return s_cur_region;
}
void VMManager::Internal::DisableFastBoot()
{
if (!s_fast_boot_requested)
-3
View File
@@ -306,9 +306,6 @@ namespace VMManager
/// Returns true if fast booting is active (requested but ELF not started).
bool IsFastBootInProgress();
// Returns the current disc/BIOS region, if set.
std::string GetCurrentRegion();
/// Disables fast boot if it was requested, and found to be incompatible.
void DisableFastBoot();