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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ jobs:
# === Nintendo 3DS build ===
nintendo-3ds:
runs-on: ubuntu-latest
container: devkitpro/devkitarm:20250102
container: devkitpro/devkitarm:20250728

steps:
- uses: actions/checkout@v4
Expand All @@ -345,7 +345,9 @@ jobs:

- name: Build
run: |
cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/cmake/3DS.cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_ALL=ON -DBUILD_WITH_SCHEME=OFF -DBUILD_WITH_JS=OFF -DBUILD_WITH_PYTHON=OFF ..
cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/cmake/3DS.cmake \
-DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_ALL=ON \
-DBUILD_WITH_SCHEME=OFF -DBUILD_WITH_JS=OFF -DBUILD_WITH_PYTHON=OFF
cmake --build build --parallel

- name: Deploy
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,6 @@ build/mruby_vendor-prefix/
# byte battle / test files
/*.lua
/*.tic
# 3ds files
*.3dsx
*.smdh
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,14 @@ message("BUILD_WITH_ALL: ${BUILD_WITH_ALL}")

if (NINTENDO_3DS)
set(BUILD_SDL OFF)
set(PREFER_SYSTEM_LIBRARIES ON)
endif()

if (BAREMETALPI)
set(BUILD_SDL OFF)
endif()

if(UNIX AND NOT APPLE AND NOT EMSCRIPTEN AND NOT ANDROID AND NOT NINTENDO_3DS)
if(UNIX AND NOT APPLE AND NOT EMSCRIPTEN AND NOT ANDROID)
set(LINUX TRUE)

if(CMAKE_HOST_SYSTEM_NAME STREQUAL "FreeBSD")
Expand Down
13 changes: 0 additions & 13 deletions build/n3ds/Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion build/n3ds/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Requirements

* devkitARM (tested on release 65, please use latest) + the 3ds-dev meta package
* devkitARM + the 3ds-dev meta package
* the following additional packages:
* 3ds-libpng
* 3ds-zlib
Expand Down
4 changes: 4 additions & 0 deletions cmake/moon.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ if(BUILD_WITH_MOON)
add_library(lpeg STATIC ${LPEG_SRC})
target_include_directories(lpeg PRIVATE ${LUA_DIR})

if(NINTENDO_3DS)
target_compile_definitions(lpeg PUBLIC LUA_32BITS)
endif()

add_library(moon ${TIC_RUNTIME} ${CMAKE_SOURCE_DIR}/src/api/moonscript.c)

if(NOT BUILD_STATIC)
Expand Down
35 changes: 15 additions & 20 deletions cmake/n3ds.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,28 @@
################################

if(NINTENDO_3DS)
set(TIC80_SRC ${TIC80_SRC}
if(BUILD_EDITORS)
target_sources(tic80studio PRIVATE
src/system/n3ds/net.c)
target_include_directories(tic80studio
PRIVATE ${TIC80LIB_DIR}/studio)
endif()

add_executable(${TIC80_TARGET} ${TIC80_SRC}
${CMAKE_SOURCE_DIR}/src/system/n3ds/utils.c
${CMAKE_SOURCE_DIR}/src/system/n3ds/keyboard.c
${CMAKE_SOURCE_DIR}/src/system/n3ds/main.c
)

add_executable(tic80 ${TIC80_SRC})
${CMAKE_SOURCE_DIR}/src/system/n3ds/main.c)

target_include_directories(tic80 PRIVATE
${DEVKITPRO}/portlibs/3ds/include
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/src)

target_link_directories(tic80 PRIVATE ${DEVKITPRO}/libctru/lib ${DEVKITPRO}/portlibs/3ds/lib)
target_link_libraries(tic80 tic80studio png citro3d)
target_link_libraries(${TIC80_TARGET} tic80studio png citro3d)

ctr_generate_smdh(tic80.smdh
NAME "TIC-80 tiny computer"
DESCRIPTION "Fantasy computer for making, playing and sharing tiny games"
AUTHOR "Nesbox"
ICON ${CMAKE_SOURCE_DIR}/build/n3ds/icon.png
)
AUTHOR "Nesbox, asie"
ICON ${CMAKE_SOURCE_DIR}/build/n3ds/icon.png)

ctr_create_3dsx(tic80
ctr_create_3dsx(${TIC80_TARGET}
SMDH tic80.smdh
ROMFS ${CMAKE_SOURCE_DIR}/build/n3ds/romfs
OUTPUT ${CMAKE_SOURCE_DIR}/build/bin/tic80.3dsx
)

endif()
OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/tic80.3dsx)
endif()
5 changes: 5 additions & 0 deletions cmake/wasm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ if(BUILD_WITH_WASM)

add_library(wasm ${TIC_RUNTIME} ${WASM_SRC})

if(NINTENDO_3DS)
# TODO: seems to be broken with gcc 15.1
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DM3_HAS_TAIL_CALL=0")
endif()

if(NOT BUILD_STATIC)
set_target_properties(wasm PROPERTIES PREFIX "")
else()
Expand Down
1 change: 1 addition & 0 deletions cmake/yue.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ if(BUILD_WITH_YUE)
)

if(NINTENDO_3DS)
# TODO: check if this really works
target_compile_options(yuescript PRIVATE -ftls-model=initial-exec)
endif()

Expand Down
10 changes: 0 additions & 10 deletions cmake/zlib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ if(PREFER_SYSTEM_LIBRARIES)
endif()
endif()

if (NOT NINTENDO_3DS)

set(ZLIB_DIR ${THIRDPARTY_DIR}/zlib)
set(ZLIB_SRC
${ZLIB_DIR}/adler32.c
Expand All @@ -33,11 +31,3 @@ set(ZLIB_SRC

add_library(zlib STATIC ${ZLIB_SRC})
target_include_directories(zlib INTERFACE ${THIRDPARTY_DIR}/zlib)

else ()

add_library(zlib STATIC IMPORTED)
set_target_properties( zlib PROPERTIES IMPORTED_LOCATION ${DEVKITPRO}/portlibs/3ds/lib/libz.a )
target_include_directories(zlib INTERFACE ${DEVKITPRO}/portlibs/3ds/include)

endif ()
2 changes: 1 addition & 1 deletion include/tic80_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,6 @@
# endif
#endif

#if defined(ANDROID) || defined(__ANDROID__) || defined(BAREMETALPI) || defined(_3DS)
#if defined(ANDROID) || defined(__ANDROID__) || defined(BAREMETALPI) || defined(__3DS__)
# define TIC80_FFT_UNSUPPORTED 1
#endif
6 changes: 3 additions & 3 deletions src/core/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

#include "tic_assert.h"

#ifdef _3DS
#ifdef __3DS__
#include <3ds.h>
#endif

Expand Down Expand Up @@ -535,7 +535,7 @@ void tic_core_close(tic_mem* memory)
blip_delete(core->blip.left);
blip_delete(core->blip.right);

#ifdef _3DS
#ifdef __3DS__
linearFree(memory->product.screen);
#else
free(memory->product.screen);
Expand Down Expand Up @@ -726,7 +726,7 @@ tic_mem* tic_core_create(s32 samplerate, tic80_pixel_color_format format)
core->samplerate = samplerate;

memset(core->memory.ram, 0, sizeof(tic_ram));
#ifdef _3DS
#ifdef __3DS__
// To feed texture data directly to the 3DS GPU, linearly allocated memory is required, which is
// not guaranteed by malloc.
// Additionally, allocate TIC80_FULLHEIGHT + 1 lines to minimize glitches in linear scaling mode.
Expand Down
2 changes: 1 addition & 1 deletion src/studio/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "net.h"
#include "ext/json.h"

#if defined(BAREMETALPI) || defined(_3DS)
#if defined(BAREMETALPI)
#ifdef EN_DEBUG
#define dbg(...) printf(__VA_ARGS__)
#else
Expand Down
Loading
Loading