Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 22 additions & 13 deletions src/port/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
#endif

const float imguiScaleOptionToValue[4] = { 0.75f, 1.0f, 1.5f, 2.0f };
std::shared_ptr<Fast::Fast3dWindow> gsFast3dWindow;
const uint32_t defaultImGuiScale = 1;
int32_t previousImGuiScaleIndex = -1;
float previousImGuiScale = defaultImGuiScale;
Expand All @@ -62,6 +63,7 @@ extern "C" {
#include "audio/external.h"
#include "audio/internal.h"
#include "game/ingame_menu.h"
#include "variables.h"
bool prevAltAssets = false;
}

Expand Down Expand Up @@ -129,27 +131,34 @@ GameEngine::GameEngine() : dictionary(nullptr) {
// ShipDeviceIndexMappingManager::UpdateControllerNamesFromConfig()

auto controlDeck = std::make_shared<LUS::ControlDeck>();
this->context->InitControlDeck(controlDeck);

this->context->InitResourceManager(archiveFiles, {}, 3);
this->context->InitConsole();

auto window = std::make_shared<Fast::Fast3dWindow>(std::vector<std::shared_ptr<Ship::GuiWindow>>({}));
#if (_DEBUG)
auto defaultLogLevel = spdlog::level::debug;
#else
auto defaultLogLevel = spdlog::level::info;
#endif
auto logLevel =
static_cast<spdlog::level::level_enum>(CVarGetInteger(CVAR_DEVELOPER_TOOLS("LogLevel"), defaultLogLevel));
context->InitLogging(logLevel, logLevel);
Ship::Context::GetInstance()->GetLogger()->set_pattern("[%H:%M:%S.%e] [%s:%#] [%l] %v");
SPDLOG_INFO("Starting Ghostship version {} (Branch: {} | Commit: {})", (char*)gBuildVersion, (char*)gGitBranch,
(char*)gGitCommitHash);

this->context->Init(archiveFiles, {}, 3, { 32000, 512, 1100 }, window, controlDeck);
gsFast3dWindow = std::make_shared<Fast::Fast3dWindow>(std::vector<std::shared_ptr<Ship::GuiWindow>>({}));
this->context->InitWindow(gsFast3dWindow);

#ifndef __SWITCH__
Ship::Context::GetInstance()->GetLogger()->set_level(
(spdlog::level::level_enum)CVarGetInteger("gDeveloperTools.LogLevel", 1));
Ship::Context::GetInstance()->GetLogger()->set_pattern("[%H:%M:%S.%e] [%s:%#] [%l] %v");
#endif
context->InitGfxDebugger();
context->InitFileDropMgr();

Ship::Context::GetInstance()->GetLogger()->set_level(
(spdlog::level::level_enum)CVarGetInteger("gDeveloperTools.LogLevel", 1));
Ship::Context::GetInstance()->GetLogger()->set_pattern("[%H:%M:%S.%e] [%s:%#] [%l] %v");
this->context->InitAudio({ .SampleRate = 32000, .SampleLength = 512, .DesiredBuffered = 1100 });

window->SetTargetFps(60);
window->SetMaximumFrameLatency(1);
window->SetRendererUCode(ucode_f3d);
gsFast3dWindow->SetTargetFps(60);
gsFast3dWindow->SetMaximumFrameLatency(1);
gsFast3dWindow->SetRendererUCode(ucode_f3d);

auto loader = context->GetResourceManager()->GetResourceLoader();
auto blobFactory = std::make_shared<Ship::ResourceFactoryBinaryBlobV0>();
Expand Down
2 changes: 1 addition & 1 deletion src/port/ui/GhostshipMenuDevTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ static const std::unordered_map<int32_t, const char*> language = {
};

#ifdef _DEBUG
DebugLogOption defaultLogLevel = DEBUG_LOG_TRACE;
DebugLogOption defaultLogLevel = DEBUG_LOG_DEBUG;
#else
DebugLogOption defaultLogLevel = DEBUG_LOG_INFO;
#endif
Expand Down
Loading