Fixed switch compilation and other weird quirks with deps

This commit is contained in:
KiritoDv 2024-04-09 12:49:20 -06:00 committed by Sonic Dreamcaster
parent 1940c26bce
commit af9c94351e
4 changed files with 91 additions and 5 deletions

1
.gitignore vendored
View File

@ -33,3 +33,4 @@ torch.hash.yml
cmake-build-*/
.idea/
.vs
build*

View File

@ -250,6 +250,74 @@ add_subdirectory(libultraship ${CMAKE_CURRENT_SOURCE_DIR}/libultraship)
add_dependencies(${PROJECT_NAME} libultraship)
target_link_libraries(${PROJECT_NAME} PRIVATE libultraship)
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
find_package(glfw3 REQUIRED)
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
set(ADDITIONAL_LIBRARY_DEPENDENCIES
"libultraship;"
"ZAPDUtils;"
"ZAPDLib;"
"glu32;"
"SDL2::SDL2;"
"SDL2::SDL2main;"
"$<$<BOOL:${BUILD_REMOTE_CONTROL}>:SDL2_net::SDL2_net-static>"
"glfw;"
"winmm;"
"imm32;"
"version;"
"setupapi"
)
elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
set(ADDITIONAL_LIBRARY_DEPENDENCIES
"libultraship;"
"ZAPDUtils;"
"ZAPDLib;"
"glu32;"
"SDL2::SDL2;"
"SDL2::SDL2main;"
"glfw;"
"winmm;"
"imm32;"
"version;"
"setupapi"
)
endif()
elseif(CMAKE_SYSTEM_NAME STREQUAL "NintendoSwitch")
find_package(SDL2)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
set(ADDITIONAL_LIBRARY_DEPENDENCIES
"libultraship;"
"ZAPDUtils;"
SDL2::SDL2
-lglad
Threads::Threads
)
elseif(CMAKE_SYSTEM_NAME STREQUAL "CafeOS")
find_package(SDL2 REQUIRED)
set(ADDITIONAL_LIBRARY_DEPENDENCIES
"libultraship;"
SDL2::SDL2-static
"$<$<CONFIG:Debug>:-Wl,--wrap=abort>"
)
target_include_directories(${PROJECT_NAME} PRIVATE
${DEVKITPRO}/portlibs/wiiu/include/
)
else()
find_package(SDL2)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
set(ADDITIONAL_LIBRARY_DEPENDENCIES
"libultraship;"
"ZAPDUtils;"
"ZAPDLib;"
SDL2::SDL2
"$<$<BOOL:${BUILD_REMOTE_CONTROL}>:SDL2_net::SDL2_net>"
${CMAKE_DL_LIBS}
Threads::Threads
)
endif()
if(USE_NETWORKING)
if(MSVC)
@ -261,6 +329,23 @@ if(USE_NETWORKING)
target_compile_definitions(${PROJECT_NAME} PRIVATE USE_NETWORKING)
endif()
target_link_libraries(${PROJECT_NAME} PRIVATE "${ADDITIONAL_LIBRARY_DEPENDENCIES}")
if(CMAKE_SYSTEM_NAME MATCHES "NintendoSwitch")
nx_generate_nacp(Lylat.nacp
NAME "Lylat64"
AUTHOR "${PROJECT_TEAM}"
VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}"
)
nx_create_nro(${PROJECT_NAME}
NACP Lylat.nacp
)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lylat64.nro DESTINATION . COMPONENT ${PROJECT_NAME})
endif()
################################################################################
# Compile and link options
################################################################################

View File

@ -154,11 +154,11 @@ extern "C" uint8_t GameEngine_OTRSigCheck(const char* data) {
}
extern "C" float __cosf(float angle) {
return std::cosf(angle);
return cosf(angle);
}
extern "C" float __sinf(float angle) {
return std::sinf(angle);
return sinf(angle);
}
extern "C" float SIN_DEG(float angle) {
@ -183,7 +183,7 @@ uint64_t Timer_GetCurrentMillis() {
return SDL_GetTicks();
}
extern "C" int32_t Timer_CreateTask(uint64_t time, TimerAction action, int32_t* address, int32_t value) {
extern "C" s32 Timer_CreateTask(u64 time, TimerAction action, s32* address, s32 value) {
const auto millis = Timer_GetCurrentMillis();
TimedEntry entry = {
.duration = millis + CYCLES_TO_MSEC_PC(time),

View File

@ -1,8 +1,8 @@
#include "MessageLookupFactory.h"
#include "../type/Message.h"
#include "spdlog/spdlog.h"
#include "resourcebridge.h"
#include "ResourceUtil.h"
namespace SF64 {
std::shared_ptr<LUS::IResource> ResourceFactoryBinaryMessageLookupV0::ReadResource(std::shared_ptr<LUS::File> file) {
@ -18,7 +18,7 @@ std::shared_ptr<LUS::IResource> ResourceFactoryBinaryMessageLookupV0::ReadResour
SPDLOG_INFO("Reading message lookup table entry {}", i);
auto id = reader->ReadInt32();
uint16_t* ptr = static_cast<uint16_t*>(ResourceGetDataByCrc(reader->ReadUInt64()));
uint16_t* ptr = LoadChild<uint16_t*>(reader->ReadUInt64());
table->mLookupTable.push_back({ id, ptr });
}