This repository has been archived on 2024-03-23. You can view files and clone it, but cannot push or open issues or pull requests.
2020-01-26 18:07:22 +00:00
|
|
|
// Copyright 2018 yuzu emulator team
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <array>
|
|
|
|
#include <memory>
|
2020-02-11 23:56:24 +00:00
|
|
|
#include "core/hardware_properties.h"
|
2020-01-26 18:07:22 +00:00
|
|
|
|
|
|
|
namespace Core {
|
|
|
|
|
|
|
|
class CoreManager;
|
|
|
|
class System;
|
|
|
|
|
|
|
|
class CpuManager {
|
|
|
|
public:
|
|
|
|
explicit CpuManager(System& system);
|
|
|
|
CpuManager(const CpuManager&) = delete;
|
|
|
|
CpuManager(CpuManager&&) = delete;
|
|
|
|
|
|
|
|
~CpuManager();
|
|
|
|
|
|
|
|
CpuManager& operator=(const CpuManager&) = delete;
|
|
|
|
CpuManager& operator=(CpuManager&&) = delete;
|
|
|
|
|
|
|
|
void Initialize();
|
|
|
|
void Shutdown();
|
|
|
|
|
|
|
|
CoreManager& GetCoreManager(std::size_t index);
|
|
|
|
const CoreManager& GetCoreManager(std::size_t index) const;
|
|
|
|
|
|
|
|
CoreManager& GetCurrentCoreManager();
|
|
|
|
const CoreManager& GetCurrentCoreManager() const;
|
|
|
|
|
|
|
|
std::size_t GetActiveCoreIndex() const {
|
|
|
|
return active_core;
|
|
|
|
}
|
|
|
|
|
|
|
|
void RunLoop(bool tight_loop);
|
|
|
|
|
|
|
|
private:
|
2020-02-11 23:56:24 +00:00
|
|
|
std::array<std::unique_ptr<CoreManager>, Hardware::NUM_CPU_CORES> core_managers;
|
2020-01-26 18:07:22 +00:00
|
|
|
std::size_t active_core{}; ///< Active core, only used in single thread mode
|
|
|
|
|
|
|
|
System& system;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Core
|