mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-10 14:39:01 +01:00
SI_DeviceGBAEmu: Remove global system accessors
We can pass the system timer instance in from the existing system instance instead of the global accessor.
This commit is contained in:
parent
63453bda4d
commit
7398d0b6ef
@ -22,9 +22,9 @@
|
|||||||
|
|
||||||
namespace SerialInterface
|
namespace SerialInterface
|
||||||
{
|
{
|
||||||
static s64 GetSyncInterval()
|
static s64 GetSyncInterval(const SystemTimers::SystemTimersManager& timers)
|
||||||
{
|
{
|
||||||
return Core::System::GetInstance().GetSystemTimers().GetTicksPerSecond() / 1000;
|
return timers.GetTicksPerSecond() / 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
CSIDevice_GBAEmu::CSIDevice_GBAEmu(Core::System& system, SIDevices device, int device_number)
|
CSIDevice_GBAEmu::CSIDevice_GBAEmu(Core::System& system, SIDevices device, int device_number)
|
||||||
@ -34,7 +34,8 @@ CSIDevice_GBAEmu::CSIDevice_GBAEmu(Core::System& system, SIDevices device, int d
|
|||||||
m_core->Start(system.GetCoreTiming().GetTicks());
|
m_core->Start(system.GetCoreTiming().GetTicks());
|
||||||
m_gbahost = Host_CreateGBAHost(m_core);
|
m_gbahost = Host_CreateGBAHost(m_core);
|
||||||
m_core->SetHost(m_gbahost);
|
m_core->SetHost(m_gbahost);
|
||||||
system.GetSerialInterface().ScheduleEvent(m_device_number, GetSyncInterval());
|
system.GetSerialInterface().ScheduleEvent(m_device_number,
|
||||||
|
GetSyncInterval(system.GetSystemTimers()));
|
||||||
}
|
}
|
||||||
|
|
||||||
CSIDevice_GBAEmu::~CSIDevice_GBAEmu()
|
CSIDevice_GBAEmu::~CSIDevice_GBAEmu()
|
||||||
@ -61,7 +62,8 @@ int CSIDevice_GBAEmu::RunBuffer(u8* buffer, int request_length)
|
|||||||
|
|
||||||
auto& si = m_system.GetSerialInterface();
|
auto& si = m_system.GetSerialInterface();
|
||||||
si.RemoveEvent(m_device_number);
|
si.RemoveEvent(m_device_number);
|
||||||
si.ScheduleEvent(m_device_number, TransferInterval() + GetSyncInterval());
|
si.ScheduleEvent(m_device_number,
|
||||||
|
TransferInterval() + GetSyncInterval(m_system.GetSystemTimers()));
|
||||||
for (int i = 0; i < MAX_SI_CHANNELS; ++i)
|
for (int i = 0; i < MAX_SI_CHANNELS; ++i)
|
||||||
{
|
{
|
||||||
if (i == m_device_number || si.GetDeviceType(i) != GetDeviceType())
|
if (i == m_device_number || si.GetDeviceType(i) != GetDeviceType())
|
||||||
@ -165,6 +167,8 @@ void CSIDevice_GBAEmu::DoState(PointerWrap& p)
|
|||||||
void CSIDevice_GBAEmu::OnEvent(u64 userdata, s64 cycles_late)
|
void CSIDevice_GBAEmu::OnEvent(u64 userdata, s64 cycles_late)
|
||||||
{
|
{
|
||||||
m_core->SendJoybusCommand(m_system.GetCoreTiming().GetTicks() + userdata, 0, nullptr, m_keys);
|
m_core->SendJoybusCommand(m_system.GetCoreTiming().GetTicks() + userdata, 0, nullptr, m_keys);
|
||||||
m_system.GetSerialInterface().ScheduleEvent(m_device_number, userdata + GetSyncInterval());
|
|
||||||
|
const auto num_cycles = userdata + GetSyncInterval(m_system.GetSystemTimers());
|
||||||
|
m_system.GetSerialInterface().ScheduleEvent(m_device_number, num_cycles);
|
||||||
}
|
}
|
||||||
} // namespace SerialInterface
|
} // namespace SerialInterface
|
||||||
|
Loading…
x
Reference in New Issue
Block a user