mirror of https://github.com/AxioDL/metaforce.git
Use new VI methods from Aurora
This commit is contained in:
parent
1e9d96c906
commit
94645de53e
|
@ -2,13 +2,13 @@
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "Runtime/CInfiniteLoopDetector.hpp"
|
|
||||||
|
|
||||||
#include "ImGuiEngine.hpp"
|
#include "ImGuiEngine.hpp"
|
||||||
#include "Runtime/Graphics/CGraphics.hpp"
|
#include "Runtime/Graphics/CGraphics.hpp"
|
||||||
#include "Runtime/MP1/MP1.hpp"
|
#include "Runtime/MP1/MP1.hpp"
|
||||||
#include "Runtime/ConsoleVariables/FileStoreManager.hpp"
|
#include "Runtime/ConsoleVariables/FileStoreManager.hpp"
|
||||||
#include "Runtime/ConsoleVariables/CVarManager.hpp"
|
#include "Runtime/ConsoleVariables/CVarManager.hpp"
|
||||||
|
#include "Runtime/CInfiniteLoopDetector.hpp"
|
||||||
#include "amuse/BooBackend.hpp"
|
#include "amuse/BooBackend.hpp"
|
||||||
|
|
||||||
#include "logvisor/logvisor.hpp"
|
#include "logvisor/logvisor.hpp"
|
||||||
|
@ -31,6 +31,7 @@
|
||||||
|
|
||||||
#include <aurora/event.h>
|
#include <aurora/event.h>
|
||||||
#include <aurora/main.h>
|
#include <aurora/main.h>
|
||||||
|
#include <dolphin/vi.h>
|
||||||
|
|
||||||
using namespace std::literals;
|
using namespace std::literals;
|
||||||
|
|
||||||
|
@ -181,12 +182,36 @@ public:
|
||||||
, m_cvarCommons(cvarCmns)
|
, m_cvarCommons(cvarCmns)
|
||||||
, m_imGuiConsole(cvarMgr, cvarCmns) {}
|
, m_imGuiConsole(cvarMgr, cvarCmns) {}
|
||||||
|
|
||||||
void onAppLaunched() noexcept {
|
void onAppLaunched(const AuroraInfo& info) noexcept {
|
||||||
initialize();
|
initialize();
|
||||||
|
|
||||||
// TODO
|
std::string_view backend;
|
||||||
// auto backend = static_cast<std::string>(aurora::get_backend_string());
|
switch (info.backend) {
|
||||||
// aurora::set_window_title(fmt::format(FMT_STRING("Metaforce {} [{}]"), METAFORCE_WC_DESCRIBE, backend));
|
case BACKEND_D3D12:
|
||||||
|
backend = "D3D12"sv;
|
||||||
|
break;
|
||||||
|
case BACKEND_METAL:
|
||||||
|
backend = "Metal"sv;
|
||||||
|
break;
|
||||||
|
case BACKEND_VULKAN:
|
||||||
|
backend = "Vulkan"sv;
|
||||||
|
break;
|
||||||
|
case BACKEND_OPENGL:
|
||||||
|
backend = "OpenGL"sv;
|
||||||
|
break;
|
||||||
|
case BACKEND_OPENGLES:
|
||||||
|
backend = "OpenGL ES"sv;
|
||||||
|
break;
|
||||||
|
case BACKEND_WEBGPU:
|
||||||
|
backend = "WebGPU"sv;
|
||||||
|
break;
|
||||||
|
case BACKEND_NULL:
|
||||||
|
backend = "Null"sv;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
VISetWindowTitle(fmt::format(FMT_STRING("Metaforce {} [{}]"), METAFORCE_WC_DESCRIBE, backend).c_str());
|
||||||
|
|
||||||
m_voiceEngine = boo::NewAudioVoiceEngine("metaforce", "Metaforce");
|
m_voiceEngine = boo::NewAudioVoiceEngine("metaforce", "Metaforce");
|
||||||
m_voiceEngine->setVolume(0.7f);
|
m_voiceEngine->setVolume(0.7f);
|
||||||
|
@ -216,6 +241,16 @@ public:
|
||||||
Log.report(logvisor::Info, FMT_STRING("CPU Features: {}"), CPUFeatureString(cpuInf));
|
Log.report(logvisor::Info, FMT_STRING("CPU Features: {}"), CPUFeatureString(cpuInf));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void onSdlEvent(const SDL_Event& event) noexcept {
|
||||||
|
switch (event.type) {
|
||||||
|
case SDL_KEYDOWN:
|
||||||
|
// Toggle fullscreen on ALT+ENTER
|
||||||
|
if (event.key.keysym.sym == SDLK_RETURN && (event.key.keysym.mod & KMOD_ALT) != 0u && event.key.repeat == 0u) {
|
||||||
|
m_cvarCommons.m_fullscreen->fromBoolean(!m_cvarCommons.m_fullscreen->toBoolean());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool onAppIdle(float realDt) noexcept {
|
bool onAppIdle(float realDt) noexcept {
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
/* Ping the watchdog to let it know we're still alive */
|
/* Ping the watchdog to let it know we're still alive */
|
||||||
|
@ -262,8 +297,7 @@ public:
|
||||||
|
|
||||||
// Check if the user has modified the fullscreen CVar, if so set fullscreen state accordingly
|
// Check if the user has modified the fullscreen CVar, if so set fullscreen state accordingly
|
||||||
if (m_cvarCommons.m_fullscreen->isModified()) {
|
if (m_cvarCommons.m_fullscreen->isModified()) {
|
||||||
// TODO
|
VISetWindowFullscreen(m_cvarCommons.getFullscreen());
|
||||||
// aurora::set_fullscreen(m_cvarCommons.getFullscreen());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Let CVarManager inform all CVar listeners of the CVar's state and clear all mdoified flags if necessary
|
// Let CVarManager inform all CVar listeners of the CVar's state and clear all mdoified flags if necessary
|
||||||
|
@ -504,7 +538,7 @@ int main(int argc, char** argv) {
|
||||||
};
|
};
|
||||||
const auto info = aurora_initialize(argc, argv, &config);
|
const auto info = aurora_initialize(argc, argv, &config);
|
||||||
g_app->onImGuiAddTextures();
|
g_app->onImGuiAddTextures();
|
||||||
g_app->onAppLaunched();
|
g_app->onAppLaunched(info);
|
||||||
g_app->onAppWindowResized(info.windowSize);
|
g_app->onAppWindowResized(info.windowSize);
|
||||||
while (true) {
|
while (true) {
|
||||||
const auto* event = aurora_update();
|
const auto* event = aurora_update();
|
||||||
|
@ -514,6 +548,9 @@ int main(int argc, char** argv) {
|
||||||
case AURORA_EXIT:
|
case AURORA_EXIT:
|
||||||
exiting = true;
|
exiting = true;
|
||||||
break;
|
break;
|
||||||
|
case AURORA_SDL_EVENT:
|
||||||
|
g_app->onSdlEvent(event->sdl);
|
||||||
|
break;
|
||||||
case AURORA_WINDOW_RESIZED:
|
case AURORA_WINDOW_RESIZED:
|
||||||
g_app->onAppWindowResized(event->windowSize);
|
g_app->onAppWindowResized(event->windowSize);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 928b34ce767e160cb4b0d7db1f1f09e10cc64ef3
|
Subproject commit e22541f1750128a4386759ee4f8c21565619a020
|
Loading…
Reference in New Issue