mirror of
https://github.com/NeoFlock/neonucleus.git
synced 2025-09-24 09:03:32 +02:00
magic
OpenOS boots but can't render it
This commit is contained in:
parent
4cfb4f74a6
commit
e9de55dbc2
@ -51,7 +51,10 @@ void nn_fs_writeCost(nn_filesystem *fs, size_t count, nn_component *component, n
|
|||||||
|
|
||||||
void nn_fs_seekCost(nn_filesystem *fs, size_t count, nn_component *component, nn_computer *computer) {
|
void nn_fs_seekCost(nn_filesystem *fs, size_t count, nn_component *component, nn_computer *computer) {
|
||||||
nn_filesystemControl control = nn_fs_getControl(component, fs);
|
nn_filesystemControl control = nn_fs_getControl(component, fs);
|
||||||
double seekLatency = ((double)control.pretendRPM / 60) * control.pretendChunkSize / fs->spaceTotal(component, fs->userdata);
|
if(control.pretendRPM == 0) return; // disabled, likely SSD
|
||||||
|
double rps = (double)control.pretendRPM / 60;
|
||||||
|
double seekLatency = 1.0 / ((double)fs->spaceTotal(component, fs->userdata) / control.pretendChunkSize) / rps;
|
||||||
|
printf("Seek Latency: %lf\n", seekLatency);
|
||||||
|
|
||||||
nn_randomLatency(control.randomLatencyMin, control.randomLatencyMax);
|
nn_randomLatency(control.randomLatencyMin, control.randomLatencyMax);
|
||||||
nn_busySleep(seekLatency * count);
|
nn_busySleep(seekLatency * count);
|
||||||
|
@ -81,7 +81,7 @@ typedef struct ne_fs {
|
|||||||
nn_filesystemControl ne_fs_getControl(nn_component *component, ne_fs *_) {
|
nn_filesystemControl ne_fs_getControl(nn_component *component, ne_fs *_) {
|
||||||
return (nn_filesystemControl) {
|
return (nn_filesystemControl) {
|
||||||
.pretendChunkSize = 512,
|
.pretendChunkSize = 512,
|
||||||
.pretendRPM = 1800,
|
.pretendRPM = 12,
|
||||||
.writeHeatPerChunk = 0.01,
|
.writeHeatPerChunk = 0.01,
|
||||||
.writeCostPerChunk = 3,
|
.writeCostPerChunk = 3,
|
||||||
.writeEnergyCost = 0.015,
|
.writeEnergyCost = 0.015,
|
||||||
@ -197,6 +197,12 @@ bool ne_fs_makeDirectory(nn_component *component, ne_fs *fs, const char *path) {
|
|||||||
return MakeDirectory(p) == 0;
|
return MakeDirectory(p) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ne_fs_exists(nn_component *component, ne_fs *fs, const char *path) {
|
||||||
|
const char *p = ne_fs_diskPath(component, path);
|
||||||
|
|
||||||
|
return FileExists(p) || DirectoryExists(p);
|
||||||
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
printf("Setting up universe\n");
|
printf("Setting up universe\n");
|
||||||
nn_universe *universe = nn_newUniverse();
|
nn_universe *universe = nn_newUniverse();
|
||||||
@ -249,9 +255,9 @@ int main() {
|
|||||||
.remove = NULL,
|
.remove = NULL,
|
||||||
.lastModified = NULL,
|
.lastModified = NULL,
|
||||||
.rename = NULL,
|
.rename = NULL,
|
||||||
.exists = NULL,
|
.exists = (void *)ne_fs_exists,
|
||||||
.isDirectory = (void *)ne_fs_isDirectory,
|
.isDirectory = (void *)ne_fs_isDirectory,
|
||||||
.makeDirectory = NULL,
|
.makeDirectory = (void *)ne_fs_makeDirectory,
|
||||||
.list = (void *)ne_fs_list,
|
.list = (void *)ne_fs_list,
|
||||||
.open = (void *)ne_fs_open,
|
.open = (void *)ne_fs_open,
|
||||||
.close = (void *)ne_fs_close,
|
.close = (void *)ne_fs_close,
|
||||||
|
@ -59,6 +59,7 @@
|
|||||||
#define NN_MAX_USER_SIZE 128
|
#define NN_MAX_USER_SIZE 128
|
||||||
#define NN_MAX_SIGNAL_SIZE 8192
|
#define NN_MAX_SIGNAL_SIZE 8192
|
||||||
#define NN_MAX_OPEN_FILES 128
|
#define NN_MAX_OPEN_FILES 128
|
||||||
|
#define NN_MAX_SCREEN_KEYBOARDS 64
|
||||||
|
|
||||||
#define NN_OVERHEAT_MIN 100
|
#define NN_OVERHEAT_MIN 100
|
||||||
#define NN_CALL_HEAT 0.05
|
#define NN_CALL_HEAT 0.05
|
||||||
@ -526,4 +527,66 @@ typedef struct nn_drive {
|
|||||||
nn_drive *nn_volatileDrive(size_t capacity, size_t platterCount, nn_driveControl *control);
|
nn_drive *nn_volatileDrive(size_t capacity, size_t platterCount, nn_driveControl *control);
|
||||||
nn_component *nn_addDrive(nn_computer *computer, nn_address address, int slot, nn_drive *drive);
|
nn_component *nn_addDrive(nn_computer *computer, nn_address address, int slot, nn_drive *drive);
|
||||||
|
|
||||||
|
// Screens and GPUs
|
||||||
|
typedef struct nn_screen nn_screen;
|
||||||
|
|
||||||
|
typedef struct nn_screenChar {
|
||||||
|
int codepoint;
|
||||||
|
int fg;
|
||||||
|
int bg;
|
||||||
|
bool isFgPalette;
|
||||||
|
bool isBgPalette;
|
||||||
|
} nn_screenChar;
|
||||||
|
|
||||||
|
nn_screen *nn_newScreen(int maxWidth, int maxHeight, int maxDepth, int editableColors, int paletteColors);
|
||||||
|
|
||||||
|
void nn_retainScreen(nn_screen *screen);
|
||||||
|
void nn_destroyScreen(nn_screen *screen);
|
||||||
|
|
||||||
|
void nn_lockScreen(nn_screen *screen);
|
||||||
|
void nn_unlockScreen(nn_screen *screen);
|
||||||
|
|
||||||
|
void nn_getResolution(nn_screen *screen, int *width, int *height);
|
||||||
|
void nn_maxResolution(nn_screen *screen, int *width, int *height);
|
||||||
|
bool nn_setResolution(nn_screen *screen, int width, int height);
|
||||||
|
|
||||||
|
void nn_getViewport(nn_screen *screen, int *width, int *height);
|
||||||
|
bool nn_setViewport(nn_screen *screen, int width, int height);
|
||||||
|
|
||||||
|
void nn_getAspectRatio(nn_screen *screen, int *width, int *height);
|
||||||
|
void nn_setAspectRatio(nn_screen *screen, int width, int height);
|
||||||
|
|
||||||
|
void nn_addKeyboard(nn_screen *screen, nn_address address);
|
||||||
|
void nn_removeKeyboard(nn_screen *screen, nn_address address);
|
||||||
|
nn_address nn_getKeyboard(nn_screen *screen, size_t idx);
|
||||||
|
size_t nn_getKeyboardCount(nn_screen *screen);
|
||||||
|
|
||||||
|
void nn_setEditableColors(nn_screen *screen, int count);
|
||||||
|
int nn_getEditableColors(nn_screen *screen);
|
||||||
|
void nn_setPaletteColor(nn_screen *screen, int );
|
||||||
|
|
||||||
|
int nn_maxDepth(nn_screen *screen);
|
||||||
|
int nn_getDepth(nn_screen *screen);
|
||||||
|
void nn_setDepth(nn_screen *screen, int depth);
|
||||||
|
|
||||||
|
void nn_set(nn_screen *screen, int x, int y, nn_screenChar pixel);
|
||||||
|
nn_screenChar nn_get(nn_screen *screen, int x, int y);
|
||||||
|
|
||||||
|
bool nn_isDirty(nn_screen *screen);
|
||||||
|
void nn_setDirty(nn_screen *screen, bool dirty);
|
||||||
|
bool nn_isPrecise(nn_screen *screen);
|
||||||
|
void nn_setPrecise(nn_screen *screen, bool precise);
|
||||||
|
bool nn_isTouchModeInverted(nn_screen *screen);
|
||||||
|
void nn_setTouchModeInverted(nn_screen *screen, bool touchModeInverted);
|
||||||
|
bool nn_isOn(nn_screen *buffer);
|
||||||
|
void nn_setOn(nn_screen *buffer, bool on);
|
||||||
|
|
||||||
|
// Easy setup shortcuts. 1-4 are valid.
|
||||||
|
// Basic tiers:
|
||||||
|
// - Tier 1 has 50x16 max resolution, 1 bit color depth. 1 editable palette color, used as the accent color.
|
||||||
|
// - Tier 2 has 80x25 max resolution, 4 bit color depth. 16 fixed palette colors.
|
||||||
|
// - Tier 3 has 160x50 max resolution, 8 bit color depth. 256 palette colors, 16 are editable, 240 are fixed.
|
||||||
|
// - Tier 4 has 240x80 max resolution, 16 bit color depth. 256 editable palette colors.
|
||||||
|
void nn_screen_setBasicTier(nn_screen *screen, int tier);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -390,7 +390,7 @@ sandbox = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
utf8 = copy(utf8),
|
utf8 = copy(utf8),
|
||||||
unicode = copy(unicode),
|
unicode = copy(string),
|
||||||
checkArg = checkArg,
|
checkArg = checkArg,
|
||||||
component = libcomponent,
|
component = libcomponent,
|
||||||
computer = libcomputer,
|
computer = libcomputer,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user