Fix missing logging on memory manager initalization.

This commit is contained in:
squidbus 2024-07-15 14:22:47 -07:00 committed by TheTurtle
parent 4fd3af995e
commit 685b0bfd5e
2 changed files with 14 additions and 9 deletions

View File

@ -32,10 +32,7 @@ namespace Core {
static constexpr s32 WindowWidth = 1280; static constexpr s32 WindowWidth = 1280;
static constexpr s32 WindowHeight = 720; static constexpr s32 WindowHeight = 720;
Emulator::Emulator() Emulator::Emulator() {
: memory{Core::Memory::Instance()}, window{WindowWidth, WindowHeight, controller} {
g_window = &window;
// Read configuration file. // Read configuration file.
const auto config_dir = Common::FS::GetUserPath(Common::FS::PathType::UserDir); const auto config_dir = Common::FS::GetUserPath(Common::FS::PathType::UserDir);
Config::load(config_dir / "config.toml"); Config::load(config_dir / "config.toml");
@ -49,6 +46,14 @@ Emulator::Emulator()
Common::Log::Initialize(); Common::Log::Initialize();
Common::Log::Start(); Common::Log::Start();
LOG_INFO(Loader, "Starting shadps4 emulator v{} ", Common::VERSION); LOG_INFO(Loader, "Starting shadps4 emulator v{} ", Common::VERSION);
// Defer until after logging is initialized.
memory = Core::Memory::Instance();
controller = Common::Singleton<Input::GameController>::Instance();
linker = Common::Singleton<Core::Linker>::Instance();
window = std::make_unique<Frontend::WindowSDL>(WindowWidth, WindowHeight, controller);
g_window = window.get();
} }
Emulator::~Emulator() { Emulator::~Emulator() {
@ -134,8 +139,8 @@ void Emulator::Run(const std::filesystem::path& file) {
// Begin main window loop until the application exits // Begin main window loop until the application exits
static constexpr std::chrono::milliseconds FlipPeriod{16}; static constexpr std::chrono::milliseconds FlipPeriod{16};
while (window.isOpen()) { while (window->isOpen()) {
window.waitEvent(); window->waitEvent();
Libraries::VideoOut::Flip(FlipPeriod); Libraries::VideoOut::Flip(FlipPeriod);
Libraries::VideoOut::Vblank(); Libraries::VideoOut::Vblank();
FRAME_END; FRAME_END;

View File

@ -31,9 +31,9 @@ private:
void LoadSystemModules(const std::filesystem::path& file); void LoadSystemModules(const std::filesystem::path& file);
Core::MemoryManager* memory; Core::MemoryManager* memory;
Input::GameController* controller = Common::Singleton<Input::GameController>::Instance(); Input::GameController* controller;
Core::Linker* linker = Common::Singleton<Core::Linker>::Instance(); Core::Linker* linker;
Frontend::WindowSDL window; std::unique_ptr<Frontend::WindowSDL> window;
}; };
} // namespace Core } // namespace Core