progress towards baremetal

This commit is contained in:
2025-07-09 17:19:30 +02:00
parent 6cfdd67cf0
commit fbae5a5a53
9 changed files with 68 additions and 46 deletions

View File

@@ -1,5 +1,4 @@
#include "../neonucleus.h"
#include <stdio.h>
#include <string.h>
void nn_drive_destroy(void *_, nn_component *component, nn_drive *drive) {

View File

@@ -1,5 +1,4 @@
#include "../neonucleus.h"
#include <stdio.h>
#include <string.h>
void nn_fs_destroy(void *_, nn_component *component, nn_filesystem *fs) {

View File

@@ -1,7 +1,5 @@
#include "../neonucleus.h"
#include "screen.h"
#include <stdio.h>
#include <string.h>
typedef struct nni_gpu {
nn_Alloc alloc;
@@ -173,7 +171,7 @@ void nni_gpu_get(nni_gpu *gpu, void *_, nn_component *component, nn_computer *co
void nni_gpu_getScreen(nni_gpu *gpu, void *_, nn_component *component, nn_computer *computer) {
if(gpu->screenAddress == NULL) return;
nn_return_string(computer, gpu->screenAddress, strlen(gpu->screenAddress));
nn_return_string(computer, gpu->screenAddress, nn_strlen(gpu->screenAddress));
}
void nni_gpu_maxResolution(nni_gpu *gpu, void *_, nn_component *component, nn_computer *computer) {

View File

@@ -1,6 +1,4 @@
#include "screen.h"
#include <stdio.h>
#include <string.h>
nn_screen *nn_newScreen(nn_Context *context, int maxWidth, int maxHeight, int maxDepth, int editableColors, int paletteColors) {
nn_Alloc *alloc = &context->allocator;
@@ -20,7 +18,7 @@ nn_screen *nn_newScreen(nn_Context *context, int maxWidth, int maxHeight, int ma
screen->editableColors = editableColors;
screen->paletteColors = paletteColors;
screen->palette = nn_alloc(alloc, sizeof(int) * screen->paletteColors);
memset(screen->palette, 0, sizeof(int) * screen->paletteColors);
nn_memset(screen->palette, 0, sizeof(int) * screen->paletteColors);
screen->aspectRatioWidth = 1;
screen->aspectRatioHeight = 1;
screen->isOn = true;
@@ -97,7 +95,7 @@ void nn_addKeyboard(nn_screen *screen, nn_address address) {
void nn_removeKeyboard(nn_screen *screen, nn_address address) {
size_t j = 0;
for(size_t i = 0; i < screen->keyboardCount; i++) {
if(strcmp(screen->keyboards[i], address) == 0) {
if(nn_strcmp(screen->keyboards[i], address) == 0) {
nn_deallocStr(&screen->ctx.allocator, screen->keyboards[i]);
} else {
screen->keyboards[j] = screen->keyboards[i];
@@ -217,7 +215,7 @@ void nn_screenComp_getKeyboards(nn_screen *screen, void *_, nn_component *compon
size_t len = arr.array->len;
for(size_t i = 0; i < len; i++) {
size_t addrlen = strlen(nn_getKeyboard(screen, i));
size_t addrlen = nn_strlen(nn_getKeyboard(screen, i));
nn_value addr = nn_values_string(&screen->ctx.allocator, nn_getKeyboard(screen, i), addrlen);
nn_values_set(arr, i, addr);
}