Update files for cross compilation fixes; add dockerfiles for windows/linux/emscripten builds; add commands to makefile to build via dockerfiles
Some checks failed
Build and Deploy / build-macos (push) Failing after 29s
Build and Deploy / build-windows (CLANG64) (push) Has been cancelled
Build and Deploy / package-dist (push) Has been cancelled
Build and Deploy / deploy-itch (push) Has been cancelled
Build and Deploy / deploy-gitea (push) Has been cancelled
Build and Deploy / build-linux (push) Has been cancelled
Some checks failed
Build and Deploy / build-macos (push) Failing after 29s
Build and Deploy / build-windows (CLANG64) (push) Has been cancelled
Build and Deploy / package-dist (push) Has been cancelled
Build and Deploy / deploy-itch (push) Has been cancelled
Build and Deploy / deploy-gitea (push) Has been cancelled
Build and Deploy / build-linux (push) Has been cancelled
This commit is contained in:
@@ -20,10 +20,6 @@
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#if !defined(__APPLE__) && !defined(_WIN32) && !defined(__linux__)
|
||||
#include <sys/ptrace.h>
|
||||
#endif
|
||||
|
||||
#include <SDL3/SDL_atomic.h>
|
||||
|
||||
#define WOTA_IMPLEMENTATION
|
||||
@@ -119,7 +115,6 @@ void actor_free(cell_rt *actor)
|
||||
// Delete it out of actors first so it can no longer get messages
|
||||
SDL_LockMutex(actors_mutex);
|
||||
shdel(actors, actor->id);
|
||||
int remaining = shlen(actors);
|
||||
SDL_UnlockMutex(actors_mutex);
|
||||
|
||||
// If in a queue, remove it
|
||||
@@ -664,7 +659,11 @@ JSValue js_actor_removetimer(JSContext *js, JSValue self, int argc, JSValue *arg
|
||||
|
||||
// Wrapper struct to keep the array pointer stable
|
||||
typedef struct {
|
||||
#ifdef TRACY_ENABLE
|
||||
TracyCZoneCtx *arr; // stb_ds dynamic array
|
||||
#else
|
||||
void *arr;
|
||||
#endif
|
||||
} tracy_stack_t;
|
||||
|
||||
// Global TLS ID for the Tracy stack
|
||||
@@ -695,6 +694,7 @@ static tracy_stack_t *get_tracy_stack(void)
|
||||
|
||||
void tracy_call_hook(JSContext *js, JSValue fn)
|
||||
{
|
||||
#ifdef TRACY_ENABLE
|
||||
if (!tracy_profiling_enabled)
|
||||
return;
|
||||
|
||||
@@ -706,16 +706,19 @@ void tracy_call_hook(JSContext *js, JSValue fn)
|
||||
arrput(stack->arr, ___tracy_emit_zone_begin_alloc(srcloc, 1));
|
||||
|
||||
free_js_debug_info(js, &debug);
|
||||
#endif
|
||||
}
|
||||
|
||||
void tracy_end_hook(JSContext *js, JSValue fn)
|
||||
{
|
||||
#ifdef TRACY_ENABLE
|
||||
if (!tracy_profiling_enabled)
|
||||
return;
|
||||
|
||||
tracy_stack_t *stack = get_tracy_stack();
|
||||
if (arrlen(stack->arr) > 0)
|
||||
___tracy_emit_zone_end(arrpop(stack->arr));
|
||||
#endif
|
||||
}
|
||||
|
||||
void actor_disrupt(cell_rt *crt)
|
||||
|
||||
@@ -32,9 +32,9 @@
|
||||
|
||||
#include "qjs_blob.h"
|
||||
#include "qjs_dmon.h"
|
||||
#include "qjs_enet.h"
|
||||
#include "qjs_nota.h"
|
||||
#include "qjs_wota.h"
|
||||
#include "qjs_enet.h"
|
||||
#include "qjs_soloud.h"
|
||||
#include "qjs_qr.h"
|
||||
#include "qjs_sdl.h"
|
||||
@@ -1608,7 +1608,7 @@ void ffi_load(JSContext *js)
|
||||
arrput(rt->module_registry, MISTLINE(http));
|
||||
arrput(rt->module_registry, MISTLINE(crypto));
|
||||
arrput(rt->module_registry, MISTLINE(miniz));
|
||||
arrput(rt->module_registry, MISTLINE(num));
|
||||
// arrput(rt->module_registry, MISTLINE(num));
|
||||
arrput(rt->module_registry, MISTLINE(kim));
|
||||
arrput(rt->module_registry, MISTLINE(utf8));
|
||||
arrput(rt->module_registry, MISTLINE(fit));
|
||||
@@ -1619,7 +1619,11 @@ void ffi_load(JSContext *js)
|
||||
// power user
|
||||
arrput(rt->module_registry, MISTLINE(js));
|
||||
arrput(rt->module_registry, MISTLINE(debug));
|
||||
|
||||
#ifndef __EMSCRIPTEN__
|
||||
arrput(rt->module_registry, MISTLINE(dmon));
|
||||
#endif
|
||||
|
||||
arrput(rt->module_registry, MISTLINE(util));
|
||||
|
||||
// prosperon
|
||||
@@ -1672,7 +1676,10 @@ void ffi_load(JSContext *js)
|
||||
JS_SetPropertyStr(js, hidden_fn, "wota", js_wota_use(js));
|
||||
JS_SetPropertyStr(js, hidden_fn, "console", js_console_use(js));
|
||||
JS_SetPropertyStr(js, hidden_fn, "nota", js_nota_use(js));
|
||||
|
||||
#ifndef __EMSCRIPTEN__
|
||||
JS_SetPropertyStr(js, hidden_fn, "enet", js_enet_use(js));
|
||||
#endif
|
||||
|
||||
// Add functions that should only be accessible to engine.js
|
||||
JS_SetPropertyStr(js, hidden_fn, "use_dyn", JS_NewCFunction(js, js_os_use_dyn, "use_dyn", 1));
|
||||
|
||||
@@ -3,14 +3,27 @@
|
||||
#include "jsffi.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <io.h>
|
||||
#include <direct.h>
|
||||
#define mkdir(path, mode) _mkdir(path)
|
||||
#define rmdir _rmdir
|
||||
#define getcwd _getcwd
|
||||
#define PATH_MAX _MAX_PATH
|
||||
#define fsync(fd) _commit(fd)
|
||||
#define S_ISLNK(m) 0
|
||||
#define S_ISSOCK(m) 0
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
|
||||
// Helper to convert JS value to file descriptor
|
||||
static int js2fd(JSContext *ctx, JSValueConst val)
|
||||
{
|
||||
@@ -180,8 +193,13 @@ JSC_CCALL(fd_fstat,
|
||||
JS_SetPropertyStr(js, obj, "ino", JS_NewInt64(js, st.st_ino));
|
||||
JS_SetPropertyStr(js, obj, "dev", JS_NewInt32(js, st.st_dev));
|
||||
JS_SetPropertyStr(js, obj, "rdev", JS_NewInt32(js, st.st_rdev));
|
||||
#ifndef _WIN32
|
||||
JS_SetPropertyStr(js, obj, "blksize", JS_NewInt32(js, st.st_blksize));
|
||||
JS_SetPropertyStr(js, obj, "blocks", JS_NewInt64(js, st.st_blocks));
|
||||
#else
|
||||
JS_SetPropertyStr(js, obj, "blksize", JS_NewInt32(js, 4096));
|
||||
JS_SetPropertyStr(js, obj, "blocks", JS_NewInt64(js, st.st_size / 512));
|
||||
#endif
|
||||
|
||||
// Add boolean properties for file type
|
||||
JS_SetPropertyStr(js, obj, "isFile", JS_NewBool(js, S_ISREG(st.st_mode)));
|
||||
|
||||
@@ -9,6 +9,28 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined(__MINGW32__) || defined(__MINGW64__)
|
||||
static void *memmem(const void *hay, size_t haylen,
|
||||
const void *ndl, size_t ndllen) {
|
||||
const unsigned char *h = hay, *n = ndl;
|
||||
if (!ndllen) return (void*)h;
|
||||
haylen -= ndllen - 1;
|
||||
for (size_t i = 0; i < haylen; i++)
|
||||
if (memcmp(h + i, n, ndllen) == 0)
|
||||
return (void*)(h + i);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static char *strndup(const char *s, size_t n) {
|
||||
size_t len = strnlen(s, n);
|
||||
char *d = malloc(len + 1);
|
||||
if (!d) return NULL;
|
||||
memcpy(d, s, len);
|
||||
d[len] = '\0';
|
||||
return d;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Simple dynamic buffer for reading the response
|
||||
typedef struct {
|
||||
char *data;
|
||||
|
||||
@@ -219,7 +219,7 @@ static JSValue js_os_rusage(JSContext *js, JSValue self, int argc, JSValue *argv
|
||||
JSValue ret = JS_NULL;
|
||||
ret = JS_NewObject(js);
|
||||
|
||||
#ifndef _WIN32
|
||||
#if defined(__linux__) || defined(__APPLE__)
|
||||
struct rusage jsmem;
|
||||
getrusage(RUSAGE_SELF, &jsmem);
|
||||
JSJMEMRET(ru_maxrss);
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <SDL3/SDL_properties.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include "qjs_sdl.h"
|
||||
|
||||
// SDL Window free function
|
||||
|
||||
@@ -2,12 +2,26 @@
|
||||
#include "jsffi.h"
|
||||
#include "qjs_blob.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#include <windows.h>
|
||||
#pragma comment(lib, "ws2_32.lib")
|
||||
#define close closesocket
|
||||
#define SHUT_RD SD_RECEIVE
|
||||
#define SHUT_WR SD_SEND
|
||||
#define SHUT_RDWR SD_BOTH
|
||||
#ifndef AF_UNIX
|
||||
#define AF_UNIX 1
|
||||
#endif
|
||||
#else
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/in.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
@@ -291,7 +305,7 @@ JSC_CCALL(socket_send,
|
||||
JS_FreeCString(js, data);
|
||||
} else {
|
||||
unsigned char *data = js_get_blob_data(js, &len, argv[1]);
|
||||
sent = send(sockfd, data, len, flags);
|
||||
sent = send(sockfd, (const char *)data, len, flags);
|
||||
}
|
||||
|
||||
if (sent < 0) {
|
||||
@@ -373,7 +387,7 @@ JSC_CCALL(socket_sendto,
|
||||
JS_FreeCString(js, data);
|
||||
} else {
|
||||
unsigned char *data = js_get_blob_data(js, &len, argv[1]);
|
||||
sent = sendto(sockfd, data, len, flags, to_addr, to_len);
|
||||
sent = sendto(sockfd, (const char *)data, len, flags, to_addr, to_len);
|
||||
}
|
||||
|
||||
if (sent < 0) {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "stb_ds.h"
|
||||
|
||||
/* Global timer state */
|
||||
static timer_t *timers = NULL;
|
||||
static cell_timer_t *timers = NULL;
|
||||
static Uint32 next_timer_id = 1;
|
||||
static SDL_Mutex *timer_mutex = NULL;
|
||||
static SDL_Condition *timer_cond = NULL;
|
||||
@@ -59,7 +59,7 @@ uint64_t get_time_ns(void)
|
||||
|
||||
Uint32 add_timer_ns(uint64_t delay_ns, TimerCallback callback, void *param)
|
||||
{
|
||||
timer_t t;
|
||||
cell_timer_t t;
|
||||
SDL_LockMutex(timer_mutex);
|
||||
t.id = next_timer_id++;
|
||||
t.interval_ns = delay_ns;
|
||||
@@ -90,7 +90,7 @@ void process_due_timers(void)
|
||||
SDL_LockMutex(timer_mutex);
|
||||
for (int i = 0; i < arrlen(timers); i++) {
|
||||
if (timers[i].due_ns <= now) {
|
||||
timer_t t = timers[i];
|
||||
cell_timer_t t = timers[i];
|
||||
arrdel(timers, i);
|
||||
SDL_UnlockMutex(timer_mutex);
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ typedef struct {
|
||||
uint64_t interval_ns;
|
||||
TimerCallback callback;
|
||||
void *param;
|
||||
} timer_t;
|
||||
} cell_timer_t;
|
||||
|
||||
/* Initialize timer system - must be called once */
|
||||
void timer_init(void);
|
||||
|
||||
Reference in New Issue
Block a user