minor tweaks

This commit is contained in:
2026-04-02 21:26:38 +02:00
parent 97a2e34f2e
commit a2069eea74
3 changed files with 43 additions and 7 deletions

View File

@@ -58,7 +58,10 @@ fn compileRaylib(b: *std.Build, os: std.Target.Os.Tag, buildOpts: LibBuildOpts,
const targetArg = std.fmt.allocPrint(b.allocator, "-Dtarget={s}", .{targetStr}) catch unreachable;
defer b.allocator.free(targetArg);
const raylib = b.addSystemCommand(&.{ "zig", "build", targetArg });
// passing it breaks it for some reason?
// TODO: make it not break
const raylib = b.addSystemCommand(&.{ "zig", "build"});
raylib.setCwd(b.path("foreign/raylib/"));
raylib.stdio = .inherit;

View File

@@ -1035,8 +1035,17 @@ nn_Component *ncl_createFilesystem(nn_Universe *universe, const char *address, c
return c;
}
nn_Component *ncl_createTmpFS(nn_Universe *universe, const nn_Filesystem *fs);
nn_Component *ncl_createDrive(nn_Universe *universe, const char *address, const char *path, const nn_Drive *drive, bool isReadonly);
nn_Component *ncl_createTmpDrive(nn_Universe *universe, const nn_EEPROM *eeprom, const char *data, size_t datalen);
nn_Component *ncl_createEEPROM(nn_Universe *universe, const char *address, const char *path, bool isReadonly);
nn_Component *ncl_createTmpEEPROM(nn_Universe *universe, const nn_EEPROM *eeprom, const char *code, size_t codelen);
size_t ncl_getEEPROMData(nn_Component *component, char *buf);
void ncl_setEEPROMData(nn_Component *component, const char *data, size_t len);
ncl_VFS ncl_getVFS(nn_Component *component);
ncl_VFS ncl_setVFS(nn_Component *component, ncl_VFS vfs);
@@ -1347,6 +1356,14 @@ const char *ncl_getKeyboard(ncl_ScreenState *state, size_t idx);
// general stuff
bool ncl_isNCLID(const char *type) {
return strncmp(NCL_PREFIX, type, strlen(NCL_PREFIX));
}
bool ncl_isNCLComponent(nn_Component *component) {
return ncl_isNCLID(nn_getComponentTypeID(component));
}
void ncl_statComponent(nn_Component *component, ncl_ComponentStat *stat) {
stat->labellen = 0;
stat->isReadonly = false;
@@ -1425,14 +1442,18 @@ bool ncl_makeReadonly(nn_Component *component) {
}
if(strcmp(ty, NCL_DRIVE) == 0) {
ncl_DriveState *drv = state;
nn_lock(drv->ctx, drv->lock);
drv->isReadonly = true;
drv->usage++;
nn_unlock(drv->ctx, drv->lock);
return true;
}
if(strcmp(ty, NCL_EEPROM) == 0) {
ncl_EEState *ee = state;
nn_lock(ee->ctx, ee->lock);
ee->isReadonly = true;
ee->usage++;
nn_unlock(ee->ctx, ee->lock);
return true;
}
return false;
@@ -1444,3 +1465,5 @@ nn_Exit ncl_encodeComponentState(nn_Universe *universe, nn_Component *comp, ncl_
void ncl_freeEncodedState(nn_Universe *universe, ncl_EncodedState *state);
nn_Exit ncl_loadComponentState(nn_Component *comp, const ncl_EncodedState *state);
size_t ncl_getLabel(nn_Component *c, char buf[NN_MAX_LABEL]);
size_t ncl_setLabel(nn_Component *c, const char *label, size_t len);

View File

@@ -3,6 +3,8 @@
#include "neonucleus.h"
#define NCL_PREFIX "ncl-"
#define NCL_EEPROM "ncl-eeprom"
#define NCL_FS "ncl-filesystem"
#define NCL_DRIVE "ncl-drive"
@@ -194,9 +196,6 @@ size_t ncl_getLabel(nn_Component *c, char buf[NN_MAX_LABEL]);
size_t ncl_setLabel(nn_Component *c, const char *label, size_t len);
nn_Component *ncl_createFilesystem(nn_Universe *universe, const char *address, const char *path, const nn_Filesystem *fs, bool isReadonly);
nn_Component *ncl_createDrive(nn_Universe *universe, const char *address, const char *path, const nn_Drive *drive, bool isReadonly);
// data is stored interally
nn_Component *ncl_createEEPROM(nn_Universe *universe, const char *address, const char *path, bool isReadonly);
#define NCL_VFS_NAMEMAX 32
@@ -207,13 +206,17 @@ nn_Component *ncl_createEEPROM(nn_Universe *universe, const char *address, const
// and tmpfs.
nn_Component *ncl_createTmpFS(nn_Universe *universe, const nn_Filesystem *fs);
// creates a temporary EEPROM, with some initial code
// the data is stored internally
nn_Component *ncl_createTmpEEPROM(nn_Universe *universe, const nn_EEPROM *eeprom, const char *code, size_t codelen);
nn_Component *ncl_createDrive(nn_Universe *universe, const char *address, const char *path, const nn_Drive *drive, bool isReadonly);
// creates a temporary drive, with some initial data
nn_Component *ncl_createTmpDrive(nn_Universe *universe, const nn_EEPROM *eeprom, const char *data, size_t datalen);
// data is stored interally
nn_Component *ncl_createEEPROM(nn_Universe *universe, const char *address, const char *path, bool isReadonly);
// creates a temporary EEPROM, with some initial code
// the data is stored internally
nn_Component *ncl_createTmpEEPROM(nn_Universe *universe, const nn_EEPROM *eeprom, const char *code, size_t codelen);
// Gets the VFS bound to a filesystem, drive or eeprom.
// Returns the default FS if the component is not recognized.
ncl_VFS ncl_getVFS(nn_Component *component);
@@ -293,11 +296,18 @@ typedef struct ncl_ComponentStat {
};
} ncl_ComponentStat;
bool ncl_isNCLID(const char *type);
bool ncl_isNCLComponent(nn_Component *component);
void ncl_statComponent(nn_Component *component, ncl_ComponentStat *stat);
// For EEPROMs, filesystems, drives
// Returns whether it was successful or not.
bool ncl_makeReadonly(nn_Component *component);
// Returns the amount of data written.
// The capacity MUST be at least the data size of the EEPROM.
size_t ncl_getEEPROMData(nn_Component *component, char *buf);
void ncl_setEEPROMData(nn_Component *component, const char *data, size_t len);
void ncl_lockScreen(ncl_ScreenState *state);
void ncl_unlockScreen(ncl_ScreenState *state);
void ncl_resetScreen(ncl_ScreenState *state);