Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 3ds docker toolchain #2701

Open
wants to merge 34 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
29a5933
update 3ds docker
Miguel-hrvs Oct 7, 2024
1aec950
try to fix 3ds lua error
Miguel-hrvs Oct 7, 2024
e79bd65
revert and try to fix wren error
Miguel-hrvs Oct 7, 2024
3f57f81
disable lua and scheme for 3ds
Miguel-hrvs Oct 7, 2024
9e6f48a
try to fix lua
Miguel-hrvs Oct 7, 2024
d35c48a
try to fix lua
Miguel-hrvs Oct 7, 2024
9bcd480
try to fix lua
Miguel-hrvs Oct 7, 2024
218eef0
test
Miguel-hrvs Oct 7, 2024
c5169ff
revert
Miguel-hrvs Oct 7, 2024
35136d4
try to fix lua
Miguel-hrvs Oct 7, 2024
2ed74c3
test
Miguel-hrvs Oct 7, 2024
5638e43
test
Miguel-hrvs Oct 7, 2024
32ddf85
continue
Miguel-hrvs Oct 7, 2024
a629776
possible last lua fix
Miguel-hrvs Oct 7, 2024
218b866
disable javascript in 3ds
Miguel-hrvs Oct 7, 2024
b0e6274
disable js correctly
Miguel-hrvs Oct 7, 2024
ffa001f
disable python for 3ds
Miguel-hrvs Oct 7, 2024
617ba06
try to fix script.c
Miguel-hrvs Oct 7, 2024
216d468
try to fix another error
Miguel-hrvs Oct 7, 2024
8371209
test
Miguel-hrvs Oct 7, 2024
3cd6832
try to fix miniaudio
Miguel-hrvs Oct 7, 2024
33c107e
test
Miguel-hrvs Oct 7, 2024
bcdea08
test
Miguel-hrvs Oct 7, 2024
77a3569
test
Miguel-hrvs Oct 7, 2024
2fd5ffa
test
Miguel-hrvs Oct 7, 2024
c57616e
test
Miguel-hrvs Oct 7, 2024
f176d22
test
Miguel-hrvs Oct 7, 2024
894119c
try to fix gif errors
Miguel-hrvs Oct 7, 2024
6df8151
test
Miguel-hrvs Oct 7, 2024
410f912
test
Miguel-hrvs Oct 7, 2024
123ce09
test
Miguel-hrvs Oct 7, 2024
119c3e7
continue
Miguel-hrvs Oct 8, 2024
0f0a4e8
try with official devkitarm docker image
Miguel-hrvs Oct 8, 2024
c009e35
test
Miguel-hrvs Oct 9, 2024
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
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -316,10 +316,10 @@ jobs:
# === Nintendo 3DS build ===
nintendo-3ds:
runs-on: ubuntu-latest
container: nesbox/devkitpro-tic80:latest
container: devkitpro/devkitarm:latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
Expand All @@ -332,11 +332,11 @@ jobs:
- name: Build
run: |
cd build
cmake -DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/3ds.cmake -DN3DS=TRUE -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_ALL=ON ..
cmake -DCMAKE_TOOLCHAIN_FILE=$DEVKITPRO/cmake/3DS.cmake -DN3DS=TRUE -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_WITH_ALL=ON -DBUILD_WITH_SCHEME=OFF -DBUILD_WITH_JS=OFF -DBUILD_WITH_PYTHON=OFF ..
make -j$(nproc)

- name: Deploy
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: "tic80-nintendo-3ds"
path: build/bin/tic80.3dsx
Expand Down
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ cmake_minimum_required(VERSION 3.3)

include(cmake/version.cmake)

if (N3DS)
add_compile_options(-w)
endif()

project(TIC-80 VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION} LANGUAGES C CXX)

if(APPLE)
Expand Down
2 changes: 1 addition & 1 deletion build/n3ds/elf_to_3dsx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/
10 changes: 5 additions & 5 deletions src/api/luaapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1595,14 +1595,14 @@ static s32 lua_ffts(lua_State* lua)
return 0;
}

static s32 lua_dofile(lua_State *lua)
static int lua_dofile(lua_State *lua)
{
luaL_error(lua, "unknown method: \"dofile\"\n");

return 0;
}

static s32 lua_loadfile(lua_State *lua)
static int lua_loadfile(lua_State *lua)
{
luaL_error(lua, "unknown method: \"loadfile\"\n");

Expand Down Expand Up @@ -1634,12 +1634,12 @@ void luaapi_init(tic_core* core)
{
static const struct{lua_CFunction func; const char* name;} ApiItems[] =
{
#define API_FUNC_DEF(name, ...) {lua_ ## name, #name},
#define API_FUNC_DEF(name, ...) {(lua_CFunction)(lua_ ## name), #name},
TIC_API_LIST(API_FUNC_DEF)
#undef API_FUNC_DEF

#if defined(BUILD_DEPRECATED)
{lua_textri, "textri"},
{(lua_CFunction)lua_textri, "textri"},
#endif
};

Expand All @@ -1665,7 +1665,7 @@ void luaapi_close(tic_mem* tic)
** Message handler which appends stract trace to exceptions.
** This function was extractred from lua.c.
*/
static s32 msghandler (lua_State *lua)
static int msghandler (lua_State *lua)
{
const char *msg = lua_tostring(lua, 1);
if (msg == NULL) /* is error object not a string? */
Expand Down
2 changes: 1 addition & 1 deletion src/api/wren.c
Original file line number Diff line number Diff line change
Expand Up @@ -1664,7 +1664,7 @@ static void initAPI(tic_core* core)
}
}

static void reportError(WrenVM* vm, WrenErrorType type, const char* module, s32 line, const char* message)
static void reportError(WrenVM* vm, WrenErrorType type, const char* module, int line, const char* message)
{
tic_core* core = getWrenCore(vm);

Expand Down
9 changes: 5 additions & 4 deletions src/ext/gif.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ static gif_image* readGif(GifFileType *gif)
{
gif_image* image = NULL;

s32 error = 0;
int error = 0;

if(gif)
{
Expand Down Expand Up @@ -101,7 +101,7 @@ static gif_image* readGif(GifFileType *gif)

case EXTENSION_RECORD_TYPE:
{
s32 extCode = 0;
int extCode = 0;
GifByteType* extension = NULL;

if (DGifGetExtension(gif, &extCode, &extension) == GIF_ERROR)
Expand Down Expand Up @@ -167,7 +167,7 @@ typedef struct
s32 pos;
} GifBuffer;

static s32 readBuffer(GifFileType* gif, GifByteType* data, s32 size)
static int readBuffer(GifFileType* gif, GifByteType* data, int size)
{
GifBuffer* buffer = (GifBuffer*)gif->UserData;

Expand All @@ -177,14 +177,15 @@ static s32 readBuffer(GifFileType* gif, GifByteType* data, s32 size)
return size;
}

gif_image* gif_read_data(const void* data, s32 size)
gif_image* gif_read_data(const void* data, int size)
{
GifBuffer buffer = {data, 0};
GifFileType *gif = DGifOpen(&buffer, readBuffer, NULL);

return readGif(gif);
}


void gif_close(gif_image* image)
{
if(image)
Expand Down
2 changes: 1 addition & 1 deletion src/ext/gif.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ typedef struct
s32 colors;
} gif_image;

gif_image* gif_read_data(const void* buffer, s32 size);
gif_image* gif_read_data(const void* buffer, int size);
void gif_close(gif_image* image);
83 changes: 2 additions & 81 deletions src/ext/miniaudio.h
Original file line number Diff line number Diff line change
Expand Up @@ -16137,88 +16137,9 @@ static ma_result ma_thread_create__posix(ma_thread* pThread, ma_thread_priority
int result;
pthread_attr_t* pAttr = NULL;

#if !defined(__EMSCRIPTEN__)
/* Try setting the thread priority. It's not critical if anything fails here. */
pthread_attr_t attr;
if (pthread_attr_init(&attr) == 0) {
int scheduler = -1;

/* We successfully initialized our attributes object so we can assign the pointer so it's passed into pthread_create(). */
pAttr = &attr;

/* We need to set the scheduler policy. Only do this if the OS supports pthread_attr_setschedpolicy() */
#if !defined(MA_BEOS)
{
if (priority == ma_thread_priority_idle) {
#ifdef SCHED_IDLE
if (pthread_attr_setschedpolicy(&attr, SCHED_IDLE) == 0) {
scheduler = SCHED_IDLE;
}
#endif
} else if (priority == ma_thread_priority_realtime) {
#ifdef SCHED_FIFO
if (pthread_attr_setschedpolicy(&attr, SCHED_FIFO) == 0) {
scheduler = SCHED_FIFO;
}
#endif
#ifdef MA_LINUX
} else {
scheduler = sched_getscheduler(0);
#endif
}
}
#endif

if (stackSize > 0) {
pthread_attr_setstacksize(&attr, stackSize);
}

if (scheduler != -1) {
int priorityMin = sched_get_priority_min(scheduler);
int priorityMax = sched_get_priority_max(scheduler);
int priorityStep = (priorityMax - priorityMin) / 7; /* 7 = number of priorities supported by miniaudio. */

struct sched_param sched;
if (pthread_attr_getschedparam(&attr, &sched) == 0) {
if (priority == ma_thread_priority_idle) {
sched.sched_priority = priorityMin;
} else if (priority == ma_thread_priority_realtime) {
#if defined(MA_PTHREAD_REALTIME_THREAD_PRIORITY)
{
sched.sched_priority = MA_PTHREAD_REALTIME_THREAD_PRIORITY;
}
#else
{
sched.sched_priority = priorityMax;
}
#endif
} else {
sched.sched_priority += ((int)priority + 5) * priorityStep; /* +5 because the lowest priority is -5. */
}

if (sched.sched_priority < priorityMin) {
sched.sched_priority = priorityMin;
}
if (sched.sched_priority > priorityMax) {
sched.sched_priority = priorityMax;
}

/* I'm not treating a failure of setting the priority as a critical error so not aborting on failure here. */
if (pthread_attr_setschedparam(&attr, &sched) == 0) {
#if !defined(MA_ANDROID) || (defined(__ANDROID_API__) && __ANDROID_API__ >= 28)
{
pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
}
#endif
}
}
}
}
#else
/* It's the emscripten build. We'll have a few unused parameters. */
(void)priority;
(void)stackSize;
#endif

result = pthread_create((pthread_t*)pThread, pAttr, entryProc, pData);

Expand Down Expand Up @@ -17864,7 +17785,7 @@ Dynamic Linking
#ifdef MA_POSIX
/* No need for dlfcn.h if we're not using runtime linking. */
#ifndef MA_NO_RUNTIME_LINKING
#include <dlfcn.h>
#include "../../vendor/dlfcn/src/dlfcn.h"
#endif
#endif

Expand Down Expand Up @@ -17995,7 +17916,7 @@ DEVICE I/O

/* No need for dlfcn.h if we're not using runtime linking. */
#ifndef MA_NO_RUNTIME_LINKING
#include <dlfcn.h>
#include "../../vendor/dlfcn/src/dlfcn.h"
#endif
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/script.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ void tic_add_script(const tic_script* script)
if(index < MAX_SUPPORTED_LANGS)
{
Scripts[index] = script;
qsort(Scripts, index + 1, sizeof Scripts[0], compareScripts);
qsort(Scripts, index + 1, sizeof Scripts[0], (int (*)(const void *, const void *))compareScripts);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/studio/editors/code.c
Original file line number Diff line number Diff line change
Expand Up @@ -1695,7 +1695,7 @@ static void setGotoMode(Code* code)
code->jump.line = -1;
}

static s32 funcCompare(const void* a, const void* b)
static int funcCompare(const void* a, const void* b)
{
const tic_outline_item* item1 = (const tic_outline_item*)a;
const tic_outline_item* item2 = (const tic_outline_item*)b;
Expand Down
6 changes: 3 additions & 3 deletions src/studio/screens/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -1498,7 +1498,7 @@ static s32 casecmp(const char *str1, const char *str2)
return (s32) ((u8) tolower(*str1) - (u8) tolower(*str2));
}

static inline s32 itemcmp(const void* a, const void* b)
static inline int itemcmp(const void* a, const void* b)
{
const FileItem* item1 = a;
const FileItem* item2 = b;
Expand Down Expand Up @@ -4489,12 +4489,12 @@ void forceAutoSave(Console* console, const char* cart_name)
commandDone(console);
}

static s32 cmdcmp(const void* a, const void* b)
static int cmdcmp(const void* a, const void* b)
{
return strcmp(((const Command*)a)->name, ((const Command*)b)->name);
}

static s32 apicmp(const void* a, const void* b)
static int apicmp(const void* a, const void* b)
{
return strcmp(((const ApiItem*)a)->name, ((const ApiItem*)b)->name);
}
Expand Down
2 changes: 1 addition & 1 deletion src/studio/screens/surf.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ static bool addMenuItem(const char* name, const char* title, const char* hash, s
return true;
}

static s32 itemcmp(const void* a, const void* b)
static int itemcmp(const void* a, const void* b)
{
const SurfItem* item1 = a;
const SurfItem* item2 = b;
Expand Down
Loading