Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .build_counter
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1838
1839
10 changes: 9 additions & 1 deletion .clang-format
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
BasedOnStyle: WebKit
BasedOnStyle: WebKit
QualifierAlignment: Left
NamespaceIndentation: All
BreakBeforeBraces: Custom
BraceWrapping:
AfterEnum: true
AfterFunction: false
AfterClass: false
SplitEmptyFunction: false
29 changes: 21 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,37 @@
name: build

on: [workflow_dispatch, push]
on: [workflow_dispatch, push, pull_request]

jobs:
build:
runs-on: self-hosted
container: pixelkiri/devkitpro-alpine-switch:latest
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Set up dependencies
run: |
sudo apt-get update
sudo apt-get install -y python3 python3-pip git wget
python sys/tools/setup_libcxx_prepackaged.py
python sys/tools/setup_sail.py
git clone https://github.com/switchbrew/switch-tools && cd switch-tools && ./autogen.sh && ./configure && make -j $(nproc) && cd ..
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 19
sudo apt-get install -y clang-19 llvm-19 lld-19
python3 -m pip install pyelftools mmh lz4
- name: Build
run: |
make -j $(nproc)
export SWITCHTOOLS=$(pwd)/switch-tools
cmake -B build -DCMAKE_BUILD_TYPE="Debug" -DCMAKE_C_COMPILER=clang-19 -DCMAKE_CXX_COMPILER=clang++-19 -DCMAKE_ASM_COMPILER=clang-19 -DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld-19" -DCMAKE_MODULE_LINKER_FLAGS="-fuse-ld=lld-19" -DCMAKE_SHARED_LINKER_FLAGS="-fuse-ld=lld-19"
cmake --build build -j $(nproc)
- name: Upload Artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: build
path: |
build/subsdk9
build/subsdk9.nss
build/subsdk9.npdm
build/*.nss
build/main.npdm
build/*.nso
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,6 @@ build.sh
.vscode/
.clangd/
.idea/
cmake-build-debug/
cmake-build-debug/

lib/std
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@
[submodule "server/Library/json"]
path = server/Library/json
url = https://github.com/nlohmann/json
[submodule "sys"]
path = sys
url = https://github.com/fruityloops1/LibHakkun
80 changes: 22 additions & 58 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,34 +1,23 @@
cmake_minimum_required(VERSION 3.21)
project(subsdk)
cmake_minimum_required(VERSION 3.16)

## Error if not using switch toolchain file
if (NOT SWITCH)
message(FATAL_ERROR "Not targeting switch, make sure to specify -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain.cmake")
endif()

set(CMAKE_C_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_TOOLCHAIN_FILE "${CMAKE_SOURCE_DIR}/sys/cmake/toolchain.cmake")
project(BowsersFuryMultiplayer VERSION 1.0 LANGUAGES ASM C CXX)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
enable_language(ASM C CXX)

## Title Id
set(CONFIG_TITLE_ID 0x010028600ebda000)
add_compile_definitions(EXL_PROGRAM_ID=${CONFIG_TITLE_ID} EXL_LOAD_KIND=Module EXL_LOAD_KIND_ENUM=2 NNSDK IMGUI_USER_CONFIG="imgui_backend/nvn_imgui_config.h" private=public protected=public DEBUGMENU)

set(NN_SDK_MAJOR 4) # idk
set(NN_SDK_MINOR 0) # idk
set(NN_SDK_PATCH 0) # idk
set(NN_SDK_TYPE "Release")
set(NN_WARE_MAJOR 4) # idk
set(NN_WARE_MINOR 0) # idk
set(NN_WARE_PATCH 0) # idk
include(config/config.cmake)

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/module/subsdk9.json.template ${CMAKE_CURRENT_BINARY_DIR}/subsdk9.json)
file(GLOB_RECURSE SOURCES_ASM ${PROJECT_SOURCE_DIR}/src/*.S)
file(GLOB_RECURSE SOURCES_C ${PROJECT_SOURCE_DIR}/src/*.c)
file(GLOB_RECURSE SOURCES_CXX ${PROJECT_SOURCE_DIR}/src/*.cpp)
file(GLOB IMGUI_SOURCES ${PROJECT_SOURCE_DIR}/lib/imgui/*.cpp)
file(GLOB ENET_SOURCES ${PROJECT_SOURCE_DIR}/lib/enet-nx/source/*.c ${PROJECT_SOURCE_DIR}/lib/enet-nx/source/*.cpp)
set(SOURCES ${SOURCES_ASM} ${SOURCES_C} ${SOURCES_CXX} ${IMGUI_SOURCES} ${ENET_SOURCES})

add_subdirectory(${PROJECT_SOURCE_DIR}/lib/penet)

## Project sources
set (INCLUDE_DIRS
add_executable(${PROJECT_NAME} ${SOURCES})

set(INCLUDE_DIRS
${PROJECT_SOURCE_DIR}/src/
${PROJECT_SOURCE_DIR}/src/lib
${PROJECT_SOURCE_DIR}/include
Expand All @@ -38,43 +27,18 @@ set (INCLUDE_DIRS
${PROJECT_SOURCE_DIR}/lib/imgui
${PROJECT_SOURCE_DIR}/lib/enet-nx/include
${PROJECT_SOURCE_DIR}/lib/penet/Include
${PROJECT_SOURCE_DIR}/sys/hakkun/include
)
include_directories(${INCLUDE_DIRS})

file(GLOB_RECURSE SOURCES_ASM ${PROJECT_SOURCE_DIR}/src/*.s)
file(GLOB_RECURSE SOURCES_C ${PROJECT_SOURCE_DIR}/src/*.c)
file(GLOB_RECURSE SOURCES_CXX ${PROJECT_SOURCE_DIR}/src/*.cpp)

file(GLOB IMGUI_SOURCES ${PROJECT_SOURCE_DIR}/lib/imgui/*.cpp)
file(GLOB ENET_SOURCES ${PROJECT_SOURCE_DIR}/lib/enet-nx/source/*.c ${PROJECT_SOURCE_DIR}/lib/enet-nx/source/*.cpp)

## Include nx tools
include(${CMAKE_SOURCE_DIR}/cmake/SwitchTools.cmake)
include_directories(
${INCLUDE_DIRS}
)

## subsdk9
set(CMAKE_EXECUTABLE_SUFFIX ".nss")
add_executable(subsdk9 ${SOURCES_ASM} ${SOURCES_C} ${SOURCES_CXX} ${IMGUI_SOURCES} ${ENET_SOURCES})
target_link_libraries(subsdk9 PUBLIC penet)
target_include_directories(penet PUBLIC ${INCLUDE_DIRS})

target_link_libraries(${PROJECT_NAME} PUBLIC penet)

## Prepare subsdk ld
set(SUBSDK_LD_PATH ${CMAKE_CURRENT_SOURCE_DIR}/module/subsdk9.ld)
set(GAME_VERSION 110)
set(SYMS_PATH "${CMAKE_CURRENT_SOURCE_DIR}/syms/${GAME_VERSION}")

execute_process(
COMMAND bash -c "find ${SYMS_PATH} -type f -name '*.sym' -exec cat {} + > ${CMAKE_BINARY_DIR}/syms.ld"
)

execute_process(COMMAND uname OUTPUT_VARIABLE uname)
if (uname MATCHES "^MINGW")
string(REGEX REPLACE "^/([a-zA-Z])/" "\\1:/" SUBSDK_LD_PATH "${SUBSDK_LD_PATH}")
endif ()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/module/subsdk9.specs.template ${CMAKE_CURRENT_BINARY_DIR}/subsdk9.specs)

## Build nso & generate npdm
add_nso_target_subsdk(subsdk9)
set_target_properties(subsdk9 PROPERTIES CONFIG_JSON "${CMAKE_CURRENT_BINARY_DIR}/subsdk9.json")
__generate_npdm(subsdk9)
set_target_properties(subsdk9 PROPERTIES LINK_FLAGS "-specs ${CMAKE_BINARY_DIR}/subsdk9.specs -g ${ARCH} -nostartfiles -nostdlib")
include(sys/cmake/module.cmake)
include(sys/cmake/deploy.cmake)
include(sys/cmake/sail.cmake)
usesail(${PROJECT_NAME})
17 changes: 0 additions & 17 deletions Makefile

This file was deleted.

3 changes: 3 additions & 0 deletions config/ModuleList.sym
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
rtld = 0
game = 1
sdk = 3
2 changes: 2 additions & 0 deletions config/VersionList.sym
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@game
110 = 891687f016a18f1773d4a88ebf8a973c
29 changes: 29 additions & 0 deletions config/config.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
set(LINKFLAGS -nodefaultlibs)
set(LLDFLAGS --no-demangle --gc-sections)

set(OPTIMIZE_OPTIONS_DEBUG -O2 -gdwarf-4)
set(OPTIMIZE_OPTIONS_RELEASE -O3 -ffast-math -flto)
set(WARN_OPTIONS -Werror=return-type -Wno-invalid-offsetof)

set(INCLUDES include include/agl)
set(DEFINITIONS DEBUGMENU private=public protected=public)

set(ASM_OPTIONS "")
set(C_OPTIONS -ffunction-sections -fdata-sections)
set(CXX_OPTIONS "")
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)

set(IS_32_BIT FALSE)
set(TARGET_IS_STATIC FALSE)
set(MODULE_NAME BowsersFuryMultiplayer)
set(TITLE_ID 0x010028600EBDA000)
set(MODULE_BINARY subsdk4)
set(SDK_PAST_1900 FALSE)
set(USE_SAIL TRUE)

set(TRAMPOLINE_POOL_SIZE 0x40)
set(BAKE_SYMBOLS FALSE)

set(HAKKUN_ADDONS HeapSourceDynamic LogManager)
set(HAKKUN_BSS_HEAP_SIZE 0x100000)
2 changes: 1 addition & 1 deletion module/subsdk9.json.template → config/npdm.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name":"Application",
"title_id":"@CONFIG_TITLE_ID@",
"title_id":"@TITLE_ID@",
"title_id_range_min":"0x0100000000010000",
"title_id_range_max":"0x01ffffffffffffff",
"main_thread_stack_size":"0x00100000",
Expand Down
2 changes: 1 addition & 1 deletion include/pe/Util/BuildId.h
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#pragma once
#define BUILD_ID 1838
#define BUILD_ID 1839
4 changes: 2 additions & 2 deletions include/pe/Util/Hooks.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once

#include "al/LiveActor/LiveActor.h"
#include "hk/ro/RoUtil.h"
#include "pe/Util/Nerve.h"
#include "util/modules.hpp"

namespace pe {
namespace util {
Expand All @@ -28,7 +28,7 @@ namespace util {
F ptrType;
uintptr_t offset;
} conv { ptr };
return conv.offset - exl::util::modules::GetTargetStart();
return conv.offset - hk::ro::getMainModule()->range().start();
}

} // namespace
Expand Down
1 change: 0 additions & 1 deletion include/pe/Util/Nerve.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include "al/Nerve/Nerve.h"
#include "al/Nerve/NerveFunction.h"
#include "util/modules.hpp"
#include <cstdint>

class ProductSequence;
Expand Down
4 changes: 2 additions & 2 deletions include/pe/Util/Type.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "Game/Player/PlayerActor.h"
#include "al/LiveActor/LiveActor.h"
#include "util/modules.hpp"
#include "hk/ro/RoUtil.h"
#include <type_traits>

namespace pe {
Expand All @@ -18,7 +18,7 @@ namespace util {
template <typename T>
ptrdiff_t getVftOffsetMain(const T* instance)
{
return getVft(instance) - exl::util::modules::GetTargetStart();
return getVft(instance) - hk::ro::getMainModule()->range().start();
}

template <typename T, typename F>
Expand Down
18 changes: 9 additions & 9 deletions include/sys/socket.h
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#pragma once

#include "types.h"
#include <stdint.h>

typedef u32 socklen_t;
typedef uint32_t socklen_t;

struct in_addr {
u32 data; // 0
uint32_t data; // 0
};

struct sockaddr {
u8 _0; // 0
u8 family; // 1
u16 port; // 2
in_addr address; // 4
u8 _8[8]; // 8
uint8_t _0; // 0
uint8_t family; // 1
uint16_t port; // 2
struct in_addr address; // 4
uint8_t _8[8]; // 8
};

struct pollfd {
Expand All @@ -22,7 +22,7 @@ struct pollfd {
short int revents;
};

using sockaddr_in = sockaddr;
typedef struct sockaddr sockaddr_in;

#define POLLIN 1
#define POLLOUT 4
Expand Down
3 changes: 3 additions & 0 deletions include/types.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#pragma once

#include "hk/types.h"
2 changes: 1 addition & 1 deletion lib/NintendoSDK
2 changes: 1 addition & 1 deletion lib/enet-nx
Submodule enet-nx updated 1 files
+1 −0 source/nx.cpp
2 changes: 1 addition & 1 deletion lib/imgui
Submodule imgui updated 143 files
10 changes: 5 additions & 5 deletions lib/penet/Include/pe/Enet/Impls.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#pragma once

#ifdef NNSDK
#include "diag/assert.hpp"
#include "hk/diag/diag.h"
#include "pe/Enet/Enet.h"
#include "pe/Util/Log.h"
#define PENET_ABORT(FMT, ...) \
{ \
pe::err(FMT, __VA_ARGS__); \
EXL_ABORT(0x402); \
#define PENET_ABORT(FMT, ...) \
{ \
pe::err(FMT, __VA_ARGS__); \
HK_ABORT(FMT, __VA_ARGS__); \
}
#define PENET_WARN(FMT, ...) \
{ \
Expand Down
2 changes: 1 addition & 1 deletion lib/sead
Submodule sead updated 50 files
+1 −1 .github/workflows/lint_pr.yml
+4 −1 CMakeLists.txt
+1 −1 README.md
+5 −7 include/container/seadRingBuffer.h
+32 −36 include/container/seadStrTreeMap.h
+4 −0 include/container/seadTList.h
+20 −13 include/container/seadTreeMap.h
+57 −2 include/controller/nin/seadNinJoyNpadDevice.h
+3 −2 include/controller/seadController.h
+0 −1 include/controller/seadControllerBase.h
+9 −6 include/controller/seadControllerDefine.h
+2 −2 include/controller/seadControllerMgr.h
+2 −0 include/devenv/seadEnvUtil.h
+0 −77 include/devenv/seadFontMgr.h
+1 −1 include/filedevice/nin/seadNinFileDeviceBaseNin.h
+120 −0 include/framework/nx/seadGameFrameworkNx.h
+1 −0 include/framework/seadGameFramework.h
+0 −48 include/framework/seadGameFrameworkNx.h
+36 −0 include/framework/seadTask.h
+83 −0 include/gfx/nvn/seadDebugFontMgrNvn.h
+11 −2 include/gfx/seadCamera.h
+156 −24 include/gfx/seadProjection.h
+5 −7 include/gfx/seadTextWriter.h
+4 −3 include/heap/seadHeapMgr.h
+1 −1 include/math/seadMathCalcCommon.hpp
+16 −0 include/math/seadMatrix.h
+88 −0 include/math/seadMatrix.hpp
+6 −0 include/math/seadMatrixCalcCommon.h
+61 −19 include/math/seadMatrixCalcCommon.hpp
+2 −1 include/math/seadQuat.h
+6 −0 include/math/seadQuat.hpp
+3 −0 include/math/seadQuatCalcCommon.h
+23 −7 include/math/seadQuatCalcCommon.hpp
+27 −2 include/math/seadVector.h
+105 −3 include/math/seadVector.hpp
+13 −0 include/math/seadVectorCalcCommon.h
+103 −9 include/math/seadVectorCalcCommon.hpp
+3 −0 include/math/seadVectorFwd.h
+12 −0 include/prim/seadDelegate.h
+18 −1 include/prim/seadSafeString.h
+19 −1 include/prim/seadSafeString.hpp
+2 −0 include/prim/seadStorageFor.h
+2 −2 modules/src/controller/seadControllerBase.cpp
+2 −2 modules/src/controller/seadControllerWrapper.cpp
+0 −236 modules/src/devenv/seadFontMgr.cpp
+5 −2 modules/src/filedevice/nin/seadNinFileDeviceBaseNin.cpp
+2 −0 modules/src/filedevice/nin/seadNinSaveFileDeviceNin.cpp
+3 −1 modules/src/filedevice/seadFileDeviceMgr.cpp
+239 −0 modules/src/gfx/nvn/seadDebugFontMgrNvn.cpp
+1 −1 modules/src/math/seadQuat.cpp
Loading