ArmInterface: return ref instead of copy for GetTimer (#5227)
* ArmInterface: return ref instead of copy for GetTimer * ArmInterface: add const ref GetTimer * ArmInterface: return raw pointer instead of shared_ptr in GetTimer * remove more unnecessary shared_ptr usage * Fix save states * fix unit tests
This commit is contained in:
parent
38c3c9c74b
commit
39463f1f6d
9 changed files with 46 additions and 32 deletions
|
@ -93,7 +93,7 @@ void KernelSystem::SetCPUs(std::vector<std::shared_ptr<ARM_Interface>> cpus) {
|
|||
}
|
||||
}
|
||||
|
||||
void KernelSystem::SetRunningCPU(std::shared_ptr<ARM_Interface> cpu) {
|
||||
void KernelSystem::SetRunningCPU(ARM_Interface* cpu) {
|
||||
if (current_process) {
|
||||
stored_processes[current_cpu->GetID()] = current_process;
|
||||
}
|
||||
|
|
|
@ -218,7 +218,7 @@ public:
|
|||
|
||||
void SetCPUs(std::vector<std::shared_ptr<ARM_Interface>> cpu);
|
||||
|
||||
void SetRunningCPU(std::shared_ptr<ARM_Interface> cpu);
|
||||
void SetRunningCPU(ARM_Interface* cpu);
|
||||
|
||||
ThreadManager& GetThreadManager(u32 core_id);
|
||||
const ThreadManager& GetThreadManager(u32 core_id) const;
|
||||
|
@ -257,7 +257,7 @@ public:
|
|||
/// Map of named ports managed by the kernel, which can be retrieved using the ConnectToPort
|
||||
std::unordered_map<std::string, std::shared_ptr<ClientPort>> named_ports;
|
||||
|
||||
std::shared_ptr<ARM_Interface> current_cpu;
|
||||
ARM_Interface* current_cpu = nullptr;
|
||||
|
||||
Memory::MemorySystem& memory;
|
||||
|
||||
|
|
|
@ -1254,10 +1254,10 @@ void SVC::SleepThread(s64 nanoseconds) {
|
|||
/// This returns the total CPU ticks elapsed since the CPU was powered-on
|
||||
s64 SVC::GetSystemTick() {
|
||||
// TODO: Use globalTicks here?
|
||||
s64 result = system.GetRunningCore().GetTimer()->GetTicks();
|
||||
s64 result = system.GetRunningCore().GetTimer().GetTicks();
|
||||
// Advance time to defeat dumb games (like Cubic Ninja) that busy-wait for the frame to end.
|
||||
// Measured time between two calls on a 9.2 o3DS with Ninjhax 1.1b
|
||||
system.GetRunningCore().GetTimer()->AddTicks(150);
|
||||
system.GetRunningCore().GetTimer().AddTicks(150);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue