Fixed compilation

This commit is contained in:
KiritoDv
2025-03-07 17:39:58 -06:00
committed by Lywx
parent 629125110d
commit 5f8550790a
6 changed files with 97 additions and 25 deletions
+25 -10
View File
@@ -29,6 +29,10 @@
#include <utility>
#ifdef __SWITCH__
#include <port/switch/SwitchImpl.h>
#endif
extern "C" {
bool prevAltAssets = false;
float gInterpolationStep = 0.0f;
@@ -46,6 +50,10 @@ float gInterpolationStep = 0.0f;
GameEngine* GameEngine::Instance;
GameEngine::GameEngine() {
#ifdef __SWITCH__
Ship::Switch::Init(Ship::PreInitPhase);
Ship::Switch::Init(Ship::PostInitPhase);
#endif
std::vector<std::string> archiveFiles;
const std::string main_path = Ship::Context::GetPathRelativeToAppDirectory("spaghetti.o2r");
@@ -102,10 +110,11 @@ GameEngine::GameEngine() {
this->context->Init(archiveFiles, {}, 3, { 26800, 512, 1100 }, wnd, controlDeck);
// this->context = Ship::Context::CreateInstance("Spaghettify", "skart64", "spaghettify.cfg.json", OTRFiles, {}, 3,
// { 26800, 512, 1100 });
#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
wnd->SetRendererUCode(ucode_f3dex);
this->context->InitGfxDebugger();
@@ -193,18 +202,21 @@ bool GameEngine::GenAssetFile() {
}
void GameEngine::ShowMessage(const char* title, const char* message, SDL_MessageBoxFlags type) {
#if defined(__SWITCH__)
SPDLOG_ERROR(message);
#else
SDL_ShowSimpleMessageBox(type, title, message, nullptr);
SPDLOG_ERROR(message);
#endif
#if defined(__SWITCH__)
SPDLOG_ERROR(message);
#else
SDL_ShowSimpleMessageBox(type, title, message, nullptr);
SPDLOG_ERROR(message);
#endif
}
int GameEngine::ShowYesNoBox(const char* title, const char* box) {
int ret;
#ifdef _WIN32
ret = MessageBoxA(nullptr, box, title, MB_YESNO | MB_ICONQUESTION);
#elif defined(__SWITCH__)
SPDLOG_ERROR(box);
return IDYES;
#else
SDL_MessageBoxData boxData = { 0 };
SDL_MessageBoxButtonData buttons[2] = { { 0 } };
@@ -236,6 +248,9 @@ void GameEngine::Create() {
void GameEngine::Destroy() {
AudioExit();
#ifdef __SWITCH__
Ship::Switch::Exit();
#endif
}
bool ShouldClearTextureCacheAtEndOfFrame = false;
+5 -2
View File
@@ -5,15 +5,18 @@
#include "Context.h"
#include "spdlog/spdlog.h"
#include "portable-file-dialogs.h"
#include <port/Engine.h>
#if !defined(__IOS__) && !defined(__ANDROID__) && !defined(__SWITCH__)
#include "portable-file-dialogs.h"
#endif
std::unordered_map<std::string, std::string> mGameList = {
{ "579c48e211ae952530ffc8738709f078d5dd215e", "Mario Kart 64 (US)" },
};
bool GameExtractor::SelectGameFromUI() {
#if !defined(__IOS__) || !defined(__ANDROID__) || !defined(__SWITCH__)
#if !defined(__IOS__) && !defined(__ANDROID__) && !defined(__SWITCH__)
auto selection = pfd::open_file("Select a file", ".", { "N64 Roms", "*.z64" }).result();
if (selection.empty()) {
+25
View File
@@ -10,6 +10,10 @@
#include <tuple>
#include "ResolutionEditor.h"
#ifdef __SWITCH__
#include <port/switch/SwitchImpl.h>
#endif
extern "C" {
extern s32 gGamestateNext;
extern s32 gMenuSelection;
@@ -362,10 +366,31 @@ void PortMenu::AddEnhancements() {
.Tooltip("When Disable Wall Collision are enable what is the minimal height you can get."));
}
#ifdef __SWITCH__
static const std::unordered_map<int32_t, const char*> switchCPUProfiles = {
{ Ship::SwitchProfiles::MAXIMUM, "Maximum Performance" },
{ Ship::SwitchProfiles::HIGH, "High Performance" },
{ Ship::SwitchProfiles::BOOST, "Boost Performance" },
{ Ship::SwitchProfiles::STOCK, "Stock Performance" },
{ Ship::SwitchProfiles::POWERSAVINGM1, "Powersaving Mode 1" },
{ Ship::SwitchProfiles::POWERSAVINGM2, "Powersaving Mode 2" },
{ Ship::SwitchProfiles::POWERSAVINGM3, "Powersaving Mode 3" }
};
#endif
void PortMenu::AddDevTools() {
AddMenuEntry("Developer", "gSettings.Menu.DevToolsSidebarSection");
AddSidebarEntry("Developer", "General", 3);
WidgetPath path = { "Developer", "General", SECTION_COLUMN_1 };
#ifdef __SWITCH__
AddWidget(path, "Switch CPU Profile", WIDGET_CVAR_COMBOBOX)
.CVar("gSwitchPerfMode")
.Options(ComboboxOptions()
.Tooltip("Switches the CPU profile to a different one")
.ComboMap(switchCPUProfiles)
.DefaultIndex(Ship::SwitchProfiles::STOCK))
.Callback([](WidgetInfo& info) { Ship::Switch::ApplyOverclock(); });
#endif
AddWidget(path, "Popout Menu", WIDGET_CVAR_CHECKBOX)
.CVar("gSettings.Menu.Popout")
.Options(CheckboxOptions().Tooltip("Changes the menu display from overlay to windowed."));
+2
View File
@@ -96,8 +96,10 @@ s32 osPfsAllocateFile(OSPfs* pfs, u16 company_code, u32 game_code, u8* game_name
return PFS_NO_ERROR;
}
#ifndef __SWITCH__
void osSetTime(OSTime time) {
}
#endif
s32 osPfsIsPlug(OSMesgQueue* queue, u8* pattern) {
}