summaryrefslogtreecommitdiff
path: root/src/port/Engine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/port/Engine.cpp')
-rw-r--r--src/port/Engine.cpp33
1 files changed, 19 insertions, 14 deletions
diff --git a/src/port/Engine.cpp b/src/port/Engine.cpp
index 5b3b1bcac..23036adcb 100644
--- a/src/port/Engine.cpp
+++ b/src/port/Engine.cpp
@@ -27,6 +27,8 @@
#include <ship/window/gui/Fonts.h>
#include "ship/window/gui/resource/Font.h"
#include "ship/window/gui/resource/FontFactory.h"
+#include "libultraship/window/gui/InputEditorWindow.h"
+#include "libultraship/window/gui/GfxDebuggerWindow.h"
#include "libultraship/controller/controldeck/ControlDeck.h"
#include "SpaghettiGui.h"
@@ -58,7 +60,7 @@ float gInterpolationStep = 0.0f;
}
Fast::Interpreter* GetInterpreter() {
- return static_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetInstance()->GetWindow())
+ return static_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetRawInstance()->GetWindow())
->GetInterpreterWeak()
.lock()
.get();
@@ -174,21 +176,24 @@ GameEngine::GameEngine() {
auto wnd = std::make_shared<Fast::Fast3dWindow>(gui);
// auto wnd = std::make_shared<Fast::Fast3dWindow>(std::vector<std::shared_ptr<Ship::GuiWindow>>({}));
- // auto wnd = std::dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetInstance()->GetWindow());
+ // auto wnd = std::dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetRawInstance()->GetWindow());
+
+ gui->AddGuiWindow(std::make_shared<LUS::InputEditorWindow>(CVAR_CONTROLLER_CONFIGURATION_WINDOW_OPEN, "Input Editor"));
+ gui->AddGuiWindow(std::make_shared<LUS::GfxDebuggerWindow>(CVAR_GFX_DEBUGGER_WINDOW_OPEN, "GfxDebuggerWindow", ImVec2(520, 600)));
this->context->Init({assets_path}, {}, 3, { 26800, 512, 1100 }, wnd, controlDeck);
#ifndef __SWITCH__
- Ship::Context::GetInstance()->GetLogger()->set_level(
+ Ship::Context::GetRawInstance()->GetLogger()->set_level(
(spdlog::level::level_enum) CVarGetInteger("gDeveloperTools.LogLevel", 1));
- Ship::Context::GetInstance()->GetLogger()->set_pattern("[%H:%M:%S.%e] [%s:%#] [%l] %v");
+ Ship::Context::GetRawInstance()->GetLogger()->set_pattern("[%H:%M:%S.%e] [%s:%#] [%l] %v");
#endif
SPDLOG_INFO("Spaghetti Kart " SPAGHETTI_VERSION);
SPDLOG_INFO(CVarGetInteger("gEnableDebugMode", 0) == 0 ? "Debug Mode deactivated" : "Debug Mode activated");
wnd->SetRendererUCode(ucode_f3dex);
- this->context->InitGfxDebugger();
+ //this->context->InitGfxDebugger();
auto loader = context->GetResourceManager()->GetResourceLoader();
loader->RegisterResourceFactory(std::make_shared<SM64::AudioBankFactoryV0>(), RESOURCE_FORMAT_BINARY, "AudioBank",
@@ -290,11 +295,11 @@ bool GameEngine::GenAssetFile() {
uint32_t GameEngine::GetInterpolationFPS() {
if (CVarGetInteger("gMatchRefreshRate", 0)) {
- return Ship::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate();
+ return Ship::Context::GetRawInstance()->GetWindow()->GetCurrentRefreshRate();
} else if (CVarGetInteger("gVsyncEnabled", 1) ||
- !Ship::Context::GetInstance()->GetWindow()->CanDisableVerticalSync()) {
- return std::min<uint32_t>(Ship::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate(),
+ !Ship::Context::GetRawInstance()->GetWindow()->CanDisableVerticalSync()) {
+ return std::min<uint32_t>(Ship::Context::GetRawInstance()->GetWindow()->GetCurrentRefreshRate(),
CVarGetInteger("gInterpolationFPS", 30));
}
@@ -395,7 +400,7 @@ void GameEngine::StartFrame() const {
// }
void GameEngine::RunCommands(Gfx* pool, const std::vector<std::unordered_map<Mtx*, MtxF>>& mtx_replacements) {
- auto wnd = std::dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetInstance()->GetWindow());
+ auto wnd = std::dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetRawInstance()->GetWindow());
if (wnd == nullptr) {
return;
@@ -416,7 +421,7 @@ void GameEngine::RunCommands(Gfx* pool, const std::vector<std::unordered_map<Mtx
bool curAltAssets = CVarGetInteger("gEnhancements.Mods.AlternateAssets", 0);
if (prevAltAssets != curAltAssets) {
prevAltAssets = curAltAssets;
- Ship::Context::GetInstance()->GetResourceManager()->SetAltAssetsEnabled(curAltAssets);
+ Ship::Context::GetRawInstance()->GetResourceManager()->SetAltAssetsEnabled(curAltAssets);
gfx_texture_cache_clear();
}
}
@@ -462,7 +467,7 @@ void GameEngine::ProcessGfxCommands(Gfx* pool) {
time -= fps;
- auto wnd = std::dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetInstance()->GetWindow());
+ auto wnd = std::dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetRawInstance()->GetWindow());
if (wnd != nullptr) {
wnd->SetTargetFps(GetInterpolationFPS());
wnd->SetMaximumFrameLatency(1);
@@ -533,7 +538,7 @@ void GameEngine::EndAudioFrame() {
}
void GameEngine::AudioInit() {
- const auto resourceMgr = Ship::Context::GetInstance()->GetResourceManager();
+ const auto resourceMgr = Ship::Context::GetRawInstance()->GetResourceManager();
resourceMgr->LoadResources("sound");
const auto banksFiles = resourceMgr->GetArchiveManager()->ListFiles("sound/banks/*");
const auto sequences_files = resourceMgr->GetArchiveManager()->ListFiles("sound/sequences/*");
@@ -610,7 +615,7 @@ ImFont* GameEngine::CreateFontWithSize(float size, std::string fontPath) {
initData->ResourceVersion = 0;
initData->Path = fontPath;
std::shared_ptr<Ship::Font> fontData = std::static_pointer_cast<Ship::Font>(
- Ship::Context::GetInstance()->GetResourceManager()->LoadResource(fontPath, false, initData));
+ Ship::Context::GetRawInstance()->GetResourceManager()->LoadResource(fontPath, false, initData));
char* fontDataPtr = (char*) malloc(fontData->DataSize);
memcpy(fontDataPtr, fontData->Data, fontData->DataSize);
ImFontConfig fontCfg = ImFontConfig();
@@ -633,7 +638,7 @@ ImFont* GameEngine::CreateFontWithSize(float size, std::string fontPath) {
// End
extern "C" uint32_t GameEngine_GetSampleRate() {
- auto player = Ship::Context::GetInstance()->GetAudio()->GetAudioPlayer();
+ auto player = Ship::Context::GetRawInstance()->GetAudio()->GetAudioPlayer();
if (player == nullptr) {
return 0;
}