Skip to content

Commit ed70630

Browse files
committed
Merge branch 'develop' of github.com:Malkierian/Ghostship into imgui-extract
2 parents b0ed23f + 6e37f50 commit ed70630

42 files changed

Lines changed: 621 additions & 106 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ jobs:
208208
sudo apt-get update
209209
sudo apt-get install -y ninja-build
210210
sudo apt-get remove -y cmake
211-
git -C libultraship remote add nx https://github.com/Net64DD/libultraship.git
211+
git -C libultraship remote add nx https://github.com/YoshiCrystal9/libultraship.git
212212
git -C libultraship fetch nx
213213
git -C libultraship checkout nx/main-nx
214214
wget https://github.com/Kitware/CMake/releases/download/v3.28.3/cmake-3.28.3-linux-x86_64.sh -O /tmp/cmake.sh

.github/workflows/switch.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
sudo apt-get update
1717
sudo apt-get install -y ninja-build
1818
sudo apt-get remove -y cmake
19-
git -C libultraship remote add nx https://github.com/Net64DD/libultraship.git
19+
git -C libultraship remote add nx https://github.com/YoshiCrystal9/libultraship.git
2020
git -C libultraship fetch nx
2121
git -C libultraship checkout nx/main-nx
2222
wget https://github.com/Kitware/CMake/releases/download/v3.28.3/cmake-3.28.3-linux-x86_64.sh -O /tmp/cmake.sh

CMakeLists.txt

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ set(CMAKE_C_FLAGS_DEBUG "-g -ffast-math -DDEBUG")
136136
set(CMAKE_CXX_FLAGS_DEBUG "-g -ffast-math -DDEBUG")
137137
set(CMAKE_C_FLAGS_RELEASE "-O3 -ffast-math -DNDEBUG")
138138
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -ffast-math -DNDEBUG")
139+
add_compile_definitions(
140+
_LARGEFILE64_SOURCE=1
141+
_POSIX_C_SOURCE=200809L
142+
)
139143
else()
140144
set(CMAKE_C_FLAGS_RELEASE "-O1 -DNDEBUG")
141145
set(CMAKE_CXX_FLAGS_RELEASE "-O1 -DNDEBUG")
@@ -153,7 +157,6 @@ add_compile_definitions(
153157
ENABLE_RUMBLE=1
154158
F3D_OLD=1
155159
F3D_GBI=1
156-
USE_GBI_TRACE=1
157160
GBI_FLOATS=1
158161
_LANGUAGE_C
159162
_USE_MATH_DEFINES
@@ -300,13 +303,27 @@ endif()
300303
# Libultraship Integration #
301304
#==============================================================================#
302305

306+
# Removes MPQ/OTR support
307+
set(EXCLUDE_MPQ_SUPPORT TRUE CACHE BOOL "")
308+
set(ENABLE_EXP_AUTO_CONFIGURE_CONTROLLERS ON CACHE BOOL "")
309+
add_compile_definitions(EXCLUDE_MPQ_SUPPORT)
310+
311+
if(CMAKE_SYSTEM_NAME STREQUAL "NintendoSwitch")
312+
find_package(SDL2)
313+
endif()
314+
315+
include_directories(
316+
${CMAKE_CURRENT_SOURCE_DIR}
317+
${CMAKE_CURRENT_SOURCE_DIR}/libultraship/include
318+
${CMAKE_CURRENT_SOURCE_DIR}/libultraship/include/libultraship
319+
${SDL2_INCLUDE_DIRS}
320+
${GLEW_INCLUDE_DIRS}
321+
${dr_libs_SOURCE_DIR}
322+
)
323+
303324
add_subdirectory(libultraship ${CMAKE_CURRENT_SOURCE_DIR}/libultraship)
304325
add_dependencies(${PROJECT_NAME} libultraship)
305326
target_link_libraries(${PROJECT_NAME} PRIVATE libultraship)
306-
target_include_directories(${PROJECT_NAME} PRIVATE
307-
${CMAKE_CURRENT_SOURCE_DIR}/libultraship/include
308-
${CMAKE_CURRENT_SOURCE_DIR}/libultraship/include/libultraship
309-
)
310327

311328
if(${CMAKE_SYSTEM_NAME} STREQUAL "iOS")
312329
get_property(IOS_TOOLCHAIN_FILE GLOBAL PROPERTY IOS_TOOLCHAIN_FILE)
@@ -397,19 +414,7 @@ if(USE_NETWORKING)
397414
target_compile_definitions(${PROJECT_NAME} PRIVATE USE_NETWORKING)
398415
endif()
399416

400-
option(USE_STANDALONE "Build as a standalone executable" OFF)
401-
option(BUILD_STORMLIB "Build with StormLib support" OFF)
402-
403-
option(BUILD_SM64 "Build with Super Mario 64 support" ON)
404-
option(BUILD_MK64 "Build with Mario Kart 64 support" OFF)
405-
option(BUILD_SF64 "Build with Star Fox 64 support" OFF)
406-
option(BUILD_FZERO "Build with F-Zero X support" OFF)
407-
option(BUILD_MARIO_ARTIST "Build with Mario Artist support" OFF)
408-
add_subdirectory(Torch)
409-
target_link_libraries(${PROJECT_NAME} PRIVATE torch "${ADDITIONAL_LIBRARY_DEPENDENCIES}")
410-
411417
if(CMAKE_SYSTEM_NAME MATCHES "NintendoSwitch")
412-
413418
nx_generate_nacp(${PROJECT_NAME}.nacp
414419
NAME "${PROJECT_NAME}"
415420
AUTHOR "${PROJECT_TEAM}"
@@ -422,8 +427,20 @@ nx_create_nro(${PROJECT_NAME}
422427
)
423428

424429
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.nro DESTINATION . COMPONENT ${PROJECT_NAME})
430+
else()
431+
option(USE_STANDALONE "Build as a standalone executable" OFF)
432+
option(BUILD_STORMLIB "Build with StormLib support" OFF)
433+
434+
option(BUILD_SM64 "Build with Super Mario 64 support" ON)
435+
option(BUILD_MK64 "Build with Mario Kart 64 support" OFF)
436+
option(BUILD_SF64 "Build with Star Fox 64 support" OFF)
437+
option(BUILD_FZERO "Build with F-Zero X support" OFF)
438+
option(BUILD_MARIO_ARTIST "Build with Mario Artist support" OFF)
439+
add_subdirectory(Torch)
440+
list(APPEND ADDITIONAL_LIBRARY_DEPENDENCIES torch)
425441
endif()
426442

443+
target_link_libraries(${PROJECT_NAME} PRIVATE "${ADDITIONAL_LIBRARY_DEPENDENCIES}")
427444
################################################################################
428445
# Compile and link options
429446
################################################################################
@@ -518,7 +535,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang")
518535
-Wno-missing-braces
519536
-Wno-int-conversion
520537
$<$<COMPILE_LANGUAGE:C>:
521-
-Werror-implicit-function-declaration
538+
-Wno-implicit-function-declaration
522539
-Wno-incompatible-pointer-types
523540
-fpermissive
524541
>

include/macros.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@
4747
#define ALIGNED16
4848
#endif
4949

50+
#define ROUND_UP_64(v) (((v) + 63) & ~63)
51+
#define ROUND_UP_32(v) (((v) + 31) & ~31)
52+
#define ROUND_UP_16(v) (((v) + 15) & ~15)
53+
#define ROUND_UP_8(v) (((v) + 7) & ~7)
54+
#define ROUND_DOWN_16(v) ((v) & ~0xf)
55+
5056
// no conversion needed other than cast
5157
#define VIRTUAL_TO_PHYSICAL(addr) ((uintptr_t)(addr))
5258
#define PHYSICAL_TO_VIRTUAL(addr) ((uintptr_t)(addr))

include/segments.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef SEGMENTS_H
22
#define SEGMENTS_H
33

4-
#include "config.h"
4+
#include "sm64_config.h"
55

66
/*
77
* Memory addresses for segments. Ideally, this header file would not be

include/sm64.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77
#include <PR/ucode.h>
88
#include "port/Engine.h"
99
#include <libultra/os.h>
10+
#include "variables.h"
1011

1112
// Global header for Super Mario 64
1213
#ifdef __cplusplus
1314
extern "C" {
1415
#endif
15-
#include "config.h"
16+
#include "sm64_config.h"
1617
#include "object_fields.h"
1718
#include "object_constants.h"
1819
#include "sounds.h"
@@ -29,7 +30,7 @@ extern "C" {
2930
#define GAME_VERSION GameEngine_GetGameVersion()
3031
#define ROM_JP (GAME_VERSION == 0xE3DAA4E)
3132

32-
#ifdef _WIN32
33+
#if defined(_WIN32) || defined(__SWITCH__)
3334
#define bzero(b,len) (memset((b), '\0', (len)), (void) 0)
3435
#define bcopy(b1, b2, len) (memmove((b2), (b1), (len)), (void) 0)
3536
#endif
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define CONFIG_H
33

44
/**
5-
* @file config.h
5+
* @file sm64_config.h
66
* A catch-all file for configuring various bugfixes and other settings
77
* (maybe eventually) in SM64
88
*/

include/types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include <libultraship.h>
88
#include <libultra/gbi.h>
99
#include "macros.h"
10-
#include "config.h"
10+
#include "sm64_config.h"
1111

1212
// Certain functions are marked as having return values, but do not
1313
// actually return a value. This causes undefined behavior, which we'd rather

0 commit comments

Comments
 (0)