mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-25 21:06:58 -05:00
Merge pull request #11129 from liamwhite/dynamic_cast
general: remove uses of dynamic_cast
This commit is contained in:
commit
39edd2ff82
10 changed files with 34 additions and 18 deletions
|
@ -449,7 +449,7 @@ private:
|
||||||
loader->ReadTitle(entry.title);
|
loader->ReadTitle(entry.title);
|
||||||
loader->ReadIcon(entry.icon);
|
loader->ReadIcon(entry.icon);
|
||||||
if (loader->GetFileType() == Loader::FileType::NRO) {
|
if (loader->GetFileType() == Loader::FileType::NRO) {
|
||||||
jauto loader_nro = dynamic_cast<Loader::AppLoader_NRO*>(loader.get());
|
jauto loader_nro = reinterpret_cast<Loader::AppLoader_NRO*>(loader.get());
|
||||||
entry.isHomebrew = loader_nro->IsHomebrew();
|
entry.isHomebrew = loader_nro->IsHomebrew();
|
||||||
} else {
|
} else {
|
||||||
entry.isHomebrew = false;
|
entry.isHomebrew = false;
|
||||||
|
|
|
@ -346,11 +346,11 @@ void ARM_Dynarmic_32::RewindBreakpointInstruction() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ARM_Dynarmic_32::ARM_Dynarmic_32(System& system_, bool uses_wall_clock_,
|
ARM_Dynarmic_32::ARM_Dynarmic_32(System& system_, bool uses_wall_clock_,
|
||||||
ExclusiveMonitor& exclusive_monitor_, std::size_t core_index_)
|
DynarmicExclusiveMonitor& exclusive_monitor_,
|
||||||
|
std::size_t core_index_)
|
||||||
: ARM_Interface{system_, uses_wall_clock_}, cb(std::make_unique<DynarmicCallbacks32>(*this)),
|
: ARM_Interface{system_, uses_wall_clock_}, cb(std::make_unique<DynarmicCallbacks32>(*this)),
|
||||||
cp15(std::make_shared<DynarmicCP15>(*this)), core_index{core_index_},
|
cp15(std::make_shared<DynarmicCP15>(*this)), core_index{core_index_},
|
||||||
exclusive_monitor{dynamic_cast<DynarmicExclusiveMonitor&>(exclusive_monitor_)},
|
exclusive_monitor{exclusive_monitor_}, null_jit{MakeJit(nullptr)}, jit{null_jit.get()} {}
|
||||||
null_jit{MakeJit(nullptr)}, jit{null_jit.get()} {}
|
|
||||||
|
|
||||||
ARM_Dynarmic_32::~ARM_Dynarmic_32() = default;
|
ARM_Dynarmic_32::~ARM_Dynarmic_32() = default;
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "common/hash.h"
|
#include "common/hash.h"
|
||||||
#include "core/arm/arm_interface.h"
|
#include "core/arm/arm_interface.h"
|
||||||
#include "core/arm/exclusive_monitor.h"
|
#include "core/arm/dynarmic/dynarmic_exclusive_monitor.h"
|
||||||
|
|
||||||
namespace Core::Memory {
|
namespace Core::Memory {
|
||||||
class Memory;
|
class Memory;
|
||||||
|
@ -28,8 +28,8 @@ class System;
|
||||||
|
|
||||||
class ARM_Dynarmic_32 final : public ARM_Interface {
|
class ARM_Dynarmic_32 final : public ARM_Interface {
|
||||||
public:
|
public:
|
||||||
ARM_Dynarmic_32(System& system_, bool uses_wall_clock_, ExclusiveMonitor& exclusive_monitor_,
|
ARM_Dynarmic_32(System& system_, bool uses_wall_clock_,
|
||||||
std::size_t core_index_);
|
DynarmicExclusiveMonitor& exclusive_monitor_, std::size_t core_index_);
|
||||||
~ARM_Dynarmic_32() override;
|
~ARM_Dynarmic_32() override;
|
||||||
|
|
||||||
void SetPC(u64 pc) override;
|
void SetPC(u64 pc) override;
|
||||||
|
|
|
@ -405,11 +405,11 @@ void ARM_Dynarmic_64::RewindBreakpointInstruction() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ARM_Dynarmic_64::ARM_Dynarmic_64(System& system_, bool uses_wall_clock_,
|
ARM_Dynarmic_64::ARM_Dynarmic_64(System& system_, bool uses_wall_clock_,
|
||||||
ExclusiveMonitor& exclusive_monitor_, std::size_t core_index_)
|
DynarmicExclusiveMonitor& exclusive_monitor_,
|
||||||
|
std::size_t core_index_)
|
||||||
: ARM_Interface{system_, uses_wall_clock_},
|
: ARM_Interface{system_, uses_wall_clock_},
|
||||||
cb(std::make_unique<DynarmicCallbacks64>(*this)), core_index{core_index_},
|
cb(std::make_unique<DynarmicCallbacks64>(*this)), core_index{core_index_},
|
||||||
exclusive_monitor{dynamic_cast<DynarmicExclusiveMonitor&>(exclusive_monitor_)},
|
exclusive_monitor{exclusive_monitor_}, null_jit{MakeJit(nullptr, 48)}, jit{null_jit.get()} {}
|
||||||
null_jit{MakeJit(nullptr, 48)}, jit{null_jit.get()} {}
|
|
||||||
|
|
||||||
ARM_Dynarmic_64::~ARM_Dynarmic_64() = default;
|
ARM_Dynarmic_64::~ARM_Dynarmic_64() = default;
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "common/hash.h"
|
#include "common/hash.h"
|
||||||
#include "core/arm/arm_interface.h"
|
#include "core/arm/arm_interface.h"
|
||||||
#include "core/arm/exclusive_monitor.h"
|
#include "core/arm/dynarmic/dynarmic_exclusive_monitor.h"
|
||||||
|
|
||||||
namespace Core::Memory {
|
namespace Core::Memory {
|
||||||
class Memory;
|
class Memory;
|
||||||
|
@ -25,8 +25,8 @@ class System;
|
||||||
|
|
||||||
class ARM_Dynarmic_64 final : public ARM_Interface {
|
class ARM_Dynarmic_64 final : public ARM_Interface {
|
||||||
public:
|
public:
|
||||||
ARM_Dynarmic_64(System& system_, bool uses_wall_clock_, ExclusiveMonitor& exclusive_monitor_,
|
ARM_Dynarmic_64(System& system_, bool uses_wall_clock_,
|
||||||
std::size_t core_index_);
|
DynarmicExclusiveMonitor& exclusive_monitor_, std::size_t core_index_);
|
||||||
~ARM_Dynarmic_64() override;
|
~ARM_Dynarmic_64() override;
|
||||||
|
|
||||||
void SetPC(u64 pc) override;
|
void SetPC(u64 pc) override;
|
||||||
|
|
|
@ -6,8 +6,6 @@
|
||||||
#include <dynarmic/interface/exclusive_monitor.h>
|
#include <dynarmic/interface/exclusive_monitor.h>
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "core/arm/dynarmic/arm_dynarmic_32.h"
|
|
||||||
#include "core/arm/dynarmic/arm_dynarmic_64.h"
|
|
||||||
#include "core/arm/exclusive_monitor.h"
|
#include "core/arm/exclusive_monitor.h"
|
||||||
|
|
||||||
namespace Core::Memory {
|
namespace Core::Memory {
|
||||||
|
@ -16,6 +14,9 @@ class Memory;
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
|
class ARM_Dynarmic_32;
|
||||||
|
class ARM_Dynarmic_64;
|
||||||
|
|
||||||
class DynarmicExclusiveMonitor final : public ExclusiveMonitor {
|
class DynarmicExclusiveMonitor final : public ExclusiveMonitor {
|
||||||
public:
|
public:
|
||||||
explicit DynarmicExclusiveMonitor(Memory::Memory& memory_, std::size_t core_count_);
|
explicit DynarmicExclusiveMonitor(Memory::Memory& memory_, std::size_t core_count_);
|
||||||
|
|
|
@ -880,6 +880,14 @@ const FileSys::ContentProvider& System::GetContentProvider() const {
|
||||||
return *impl->content_provider;
|
return *impl->content_provider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FileSys::ContentProviderUnion& System::GetContentProviderUnion() {
|
||||||
|
return *impl->content_provider;
|
||||||
|
}
|
||||||
|
|
||||||
|
const FileSys::ContentProviderUnion& System::GetContentProviderUnion() const {
|
||||||
|
return *impl->content_provider;
|
||||||
|
}
|
||||||
|
|
||||||
Service::FileSystem::FileSystemController& System::GetFileSystemController() {
|
Service::FileSystem::FileSystemController& System::GetFileSystemController() {
|
||||||
return impl->fs_controller;
|
return impl->fs_controller;
|
||||||
}
|
}
|
||||||
|
|
|
@ -381,6 +381,9 @@ public:
|
||||||
[[nodiscard]] FileSys::ContentProvider& GetContentProvider();
|
[[nodiscard]] FileSys::ContentProvider& GetContentProvider();
|
||||||
[[nodiscard]] const FileSys::ContentProvider& GetContentProvider() const;
|
[[nodiscard]] const FileSys::ContentProvider& GetContentProvider() const;
|
||||||
|
|
||||||
|
[[nodiscard]] FileSys::ContentProviderUnion& GetContentProviderUnion();
|
||||||
|
[[nodiscard]] const FileSys::ContentProviderUnion& GetContentProviderUnion() const;
|
||||||
|
|
||||||
[[nodiscard]] Service::FileSystem::FileSystemController& GetFileSystemController();
|
[[nodiscard]] Service::FileSystem::FileSystemController& GetFileSystemController();
|
||||||
[[nodiscard]] const Service::FileSystem::FileSystemController& GetFileSystemController() const;
|
[[nodiscard]] const Service::FileSystem::FileSystemController& GetFileSystemController() const;
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,9 @@ PhysicalCore::PhysicalCore(std::size_t core_index, Core::System& system, KSchedu
|
||||||
// a 32-bit instance of Dynarmic. This should be abstracted out to a CPU manager.
|
// a 32-bit instance of Dynarmic. This should be abstracted out to a CPU manager.
|
||||||
auto& kernel = system.Kernel();
|
auto& kernel = system.Kernel();
|
||||||
m_arm_interface = std::make_unique<Core::ARM_Dynarmic_64>(
|
m_arm_interface = std::make_unique<Core::ARM_Dynarmic_64>(
|
||||||
system, kernel.IsMulticore(), kernel.GetExclusiveMonitor(), m_core_index);
|
system, kernel.IsMulticore(),
|
||||||
|
reinterpret_cast<Core::DynarmicExclusiveMonitor&>(kernel.GetExclusiveMonitor()),
|
||||||
|
m_core_index);
|
||||||
#else
|
#else
|
||||||
#error Platform not supported yet.
|
#error Platform not supported yet.
|
||||||
#endif
|
#endif
|
||||||
|
@ -31,7 +33,9 @@ void PhysicalCore::Initialize(bool is_64_bit) {
|
||||||
if (!is_64_bit) {
|
if (!is_64_bit) {
|
||||||
// We already initialized a 64-bit core, replace with a 32-bit one.
|
// We already initialized a 64-bit core, replace with a 32-bit one.
|
||||||
m_arm_interface = std::make_unique<Core::ARM_Dynarmic_32>(
|
m_arm_interface = std::make_unique<Core::ARM_Dynarmic_32>(
|
||||||
m_system, kernel.IsMulticore(), kernel.GetExclusiveMonitor(), m_core_index);
|
m_system, kernel.IsMulticore(),
|
||||||
|
reinterpret_cast<Core::DynarmicExclusiveMonitor&>(kernel.GetExclusiveMonitor()),
|
||||||
|
m_core_index);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#error Platform not supported yet.
|
#error Platform not supported yet.
|
||||||
|
|
|
@ -235,7 +235,7 @@ GameListWorker::~GameListWorker() = default;
|
||||||
void GameListWorker::AddTitlesToGameList(GameListDir* parent_dir) {
|
void GameListWorker::AddTitlesToGameList(GameListDir* parent_dir) {
|
||||||
using namespace FileSys;
|
using namespace FileSys;
|
||||||
|
|
||||||
const auto& cache = dynamic_cast<ContentProviderUnion&>(system.GetContentProvider());
|
const auto& cache = system.GetContentProviderUnion();
|
||||||
|
|
||||||
auto installed_games = cache.ListEntriesFilterOrigin(std::nullopt, TitleType::Application,
|
auto installed_games = cache.ListEntriesFilterOrigin(std::nullopt, TitleType::Application,
|
||||||
ContentRecordType::Program);
|
ContentRecordType::Program);
|
||||||
|
|
Loading…
Reference in a new issue