From e12b032f8ecfeda71ed88f64f212c7f35810f015 Mon Sep 17 00:00:00 2001 From: nesbox Date: Sat, 15 Jul 2023 18:40:18 +0200 Subject: [PATCH] 3ds build test --- build/n3ds/README.md | 4 ++-- build/n3ds/elf_to_3dsx.sh | 2 +- src/core/core.c | 6 +++--- src/studio/fs.c | 2 +- src/studio/net.c | 2 +- src/system/n3ds/main.c | 7 +++++-- 6 files changed, 13 insertions(+), 10 deletions(-) diff --git a/build/n3ds/README.md b/build/n3ds/README.md index 6180b0966..b61cd631d 100644 --- a/build/n3ds/README.md +++ b/build/n3ds/README.md @@ -2,7 +2,7 @@ ## Requirements -* devkitARM (tested on release 54, please use latest) + the 3ds-dev meta package +* devkitARM (tested on release 60, please use latest) + the 3ds-dev meta package * the following additional packages: * devkitpro-pkgbuild-helpers * 3ds-libpng @@ -13,7 +13,7 @@ ``` cd build -cmake .. -DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/3ds.cmake -DN3DS=TRUE +cmake .. -DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/cmake/3DS.cmake -DN3DS=TRUE make ``` diff --git a/build/n3ds/elf_to_3dsx.sh b/build/n3ds/elf_to_3dsx.sh index b3638136c..0ee748c62 100755 --- a/build/n3ds/elf_to_3dsx.sh +++ b/build/n3ds/elf_to_3dsx.sh @@ -2,4 +2,4 @@ echo "[3DSX] Building metadata" ${DEVKITPRO}/tools/bin/smdhtool --create "TIC-80 tiny computer" "Fantasy computer for making, playing and sharing tiny games" "Nesbox" "n3ds/icon.png" tic80.smdh echo "[3DSX] Building binary" -${DEVKITPRO}/tools/bin/3dsxtool bin/tic80_n3ds bin/tic80.3dsx --smdh=tic80.smdh --romfs=n3ds/romfs/ +${DEVKITPRO}/tools/bin/3dsxtool bin/tic80_n3ds.elf bin/tic80.3dsx --smdh=tic80.smdh --romfs=n3ds/romfs/ diff --git a/src/core/core.c b/src/core/core.c index 13d1ea535..5ef9f5be5 100644 --- a/src/core/core.c +++ b/src/core/core.c @@ -34,7 +34,7 @@ #include "tic_assert.h" -#ifdef _3DS +#ifdef __3DS__ #include <3ds.h> #endif @@ -551,7 +551,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); @@ -742,7 +742,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. diff --git a/src/studio/fs.c b/src/studio/fs.c index 83492be6c..827738e8e 100644 --- a/src/studio/fs.c +++ b/src/studio/fs.c @@ -24,7 +24,7 @@ #include "fs.h" #include "net.h" -#if defined(BAREMETALPI) || defined(_3DS) +#if defined(BAREMETALPI) || defined(__3DS__) #ifdef EN_DEBUG #define dbg(...) printf(__VA_ARGS__) #else diff --git a/src/studio/net.c b/src/studio/net.c index af13fc4e3..83941a5df 100644 --- a/src/studio/net.c +++ b/src/studio/net.c @@ -144,7 +144,7 @@ void tic_net_close(tic_net* net) free(net); } -#elif defined(_3DS) +#elif defined(__3DS__) #include <3ds.h> diff --git a/src/system/n3ds/main.c b/src/system/n3ds/main.c index 3b51f122e..9202907bd 100644 --- a/src/system/n3ds/main.c +++ b/src/system/n3ds/main.c @@ -163,7 +163,10 @@ void tic_sys_clipboard_set(const char* text) platform.clipboard = NULL; } - platform.clipboard = strdup(text); + if(text) + { + platform.clipboard = strdup(text); + } } bool tic_sys_clipboard_has() @@ -576,7 +579,7 @@ int main(int argc, char **argv) { romfsInit(); memset(&platform, 0, sizeof(platform)); - + n3ds_draw_init(); n3ds_keyboard_init(&platform.keyboard);