Fixed some compilation errors

This commit is contained in:
KiritoDv 2025-03-05 18:31:53 -06:00
parent 4b49902ba6
commit f500ac3a4a
5 changed files with 61 additions and 13 deletions

View file

@ -14,6 +14,10 @@ set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment ve
# Set the C++ standard and enable the MSVC parallel build option
set(CMAKE_CXX_STANDARD 20 CACHE STRING "The C++ standard to use")
set(CMAKE_C_STANDARD 11 CACHE STRING "The C standard to use")
set(PROJECT_TEAM "Lywx & YoshiCrystal")
set(PROJECT_VERSION_MAJOR 2)
set(PROJECT_VERSION_MINOR 0)
set(PROJECT_VERSION_PATCH 0)
#add_compile_options(-fsanitize=address)
#add_link_options(-fsanitize=address)
@ -69,6 +73,20 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
endif()
endif()
################################################################################
# Global configuration types
################################################################################
if (CMAKE_SYSTEM_NAME STREQUAL "NintendoSwitch")
set(CMAKE_C_FLAGS_DEBUG "-g -ffast-math -DDEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "-g -ffast-math -DDEBUG")
set(CMAKE_C_FLAGS_RELEASE "-O3 -ffast-math -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -ffast-math -DNDEBUG")
else()
set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
set(CMAKE_OBJCXX_FLAGS_RELEASE "-O2 -DNDEBUG")
endif()
# Set game compilation version
set(VERSION us)
set(USE_NETWORKING OFF)
@ -309,8 +327,16 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
"Vorbis::vorbisfile"
)
elseif(CMAKE_SYSTEM_NAME STREQUAL "NintendoSwitch")
find_package(SDL2)
find_package(Vorbis REQUIRED)
link_libraries(Vorbis::vorbisfile)
find_package(Ogg REQUIRED)
link_libraries(Ogg::ogg)
set(ADDITIONAL_LIBRARY_DEPENDENCIES
-lglad
SDL2::SDL2
"Ogg::ogg"
"Vorbis::vorbisfile"
)
elseif(CMAKE_SYSTEM_NAME STREQUAL "CafeOS")
set(ADDITIONAL_LIBRARY_DEPENDENCIES
@ -360,6 +386,7 @@ nx_generate_nacp(${PROJECT_NAME}.nacp
nx_create_nro(${PROJECT_NAME}
NACP ${PROJECT_NAME}.nacp
ICON ${CMAKE_CURRENT_SOURCE_DIR}/nx-logo.jpg
)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.nro DESTINATION . COMPONENT ${PROJECT_NAME})

BIN
nx-logo.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

View file

@ -44,6 +44,10 @@
#include <Fast3D/gfx_pc.h>
#include <filesystem>
#ifdef __SWITCH__
#include <port/switch/SwitchImpl.h>
#endif
namespace fs = std::filesystem;
extern "C" {
@ -59,6 +63,11 @@ std::vector<uint8_t*> MemoryPool;
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("sf64.o2r");
const std::string assets_path = Ship::Context::GetPathRelativeToAppDirectory("starship.o2r");
@ -159,9 +168,11 @@ GameEngine::GameEngine() {
this->context->Init(archiveFiles, {}, 3, { 32000, 1024, 1680 }, window, controlDeck);
#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
auto loader = context->GetResourceManager()->GetResourceLoader();
loader->RegisterResourceFactory(std::make_shared<SF64::ResourceFactoryBinaryAnimV0>(), RESOURCE_FORMAT_BINARY,
@ -289,6 +300,9 @@ void GameEngine::Destroy() {
free(ptr);
}
MemoryPool.clear();
#ifdef __SWITCH__
Ship::Switch::Exit();
#endif
}
void GameEngine::StartFrame() const {

View file

@ -4,8 +4,10 @@
#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 = {
{ "d8b1088520f7c5f81433292a9258c1184afa1457", "Star Fox 64 (U) (V1.0)" },
@ -21,7 +23,7 @@ std::unordered_map<std::string, std::string> mGameList = {
};
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()) {

View file

@ -14,6 +14,11 @@
#include "port/notification/notification.h"
#include "utils/StringHelper.h"
#ifdef __SWITCH__
#include <port/switch/SwitchImpl.h>
#include <port/switch/SwitchPerformanceProfiles.h>
#endif
extern "C" {
#include "sys.h"
#include <sf64audio_provisional.h>
@ -192,20 +197,10 @@ void DrawSettingsMenu(){
UIWidgets::Spacer(0);
#ifndef __SWITCH__
UIWidgets::CVarCheckbox("Menubar Controller Navigation", "gControlNav", {
.tooltip = "Allows controller navigation of the SOH menu bar (Settings, Enhancements,...)\nCAUTION: This will disable game inputs while the menubar is visible.\n\nD-pad to move between items, A to select, and X to grab focus on the menu bar"
});
#endif
// UIWidgets::CVarCheckbox("Show Inputs", "gInputEnabled", {
// .tooltip = "Shows currently pressed inputs on the bottom right of the screen"
// });
if (CVarGetInteger("gInputEnabled", 0)) {
UIWidgets::CVarSliderFloat("Input Scale", "gInputScale", 1.0f, 3.0f, 1.0f, {
.tooltip = "Sets the on screen size of the displayed inputs from the Show Inputs setting",
.format = "%.1fx",
});
}
UIWidgets::CVarCheckbox("Invert Y Axis", "gInvertYAxis",{
.tooltip = "Inverts the Y axis for controlling vehicles"
});
@ -648,6 +643,16 @@ void DrawDebugMenu() {
Ship::Context::GetInstance()->GetLogger()->set_level((spdlog::level::level_enum)CVarGetInteger("gDeveloperTools.LogLevel", 1));
}
#ifdef __SWITCH__
if (UIWidgets::CVarCombobox("Switch CPU Profile", "gSwitchPerfMode", SWITCH_CPU_PROFILES, {
.tooltip = "Switches the CPU profile to a different one",
.defaultIndex = (int)Ship::SwitchProfiles::STOCK
})) {
SPDLOG_INFO("Profile:: %s", SWITCH_CPU_PROFILES[CVarGetInteger("gSwitchPerfMode", (int)Ship::SwitchProfiles::STOCK)]);
Ship::Switch::ApplyOverclock();
}
#endif
UIWidgets::WindowButton("Gfx Debugger", "gGfxDebuggerEnabled", GameUI::mGfxDebuggerWindow, {
.tooltip = "Enables the Gfx Debugger window, allowing you to input commands, type help for some examples"
});