tmp fix to shit

This commit is contained in:
IonutParau 2025-06-30 18:17:25 +02:00
parent 5184d880fa
commit b7b1b9acbf
4 changed files with 22 additions and 5 deletions

View File

@ -128,6 +128,8 @@ void nn_fs_size(nn_filesystem *fs, void *_, nn_component *component, nn_computer
size_t byteSize = fs->size(component, fs->userdata, path);
nn_return(computer, nn_values_integer(byteSize));
nn_fs_readCost(fs, 1, component, computer);
}
@ -162,7 +164,14 @@ void nn_fs_lastModified(nn_filesystem *fs, void *_, nn_component *component, nn_
return;
}
nn_return(computer, nn_values_integer(fs->lastModified(component, fs->userdata, path)));
size_t t = fs->lastModified(component, fs->userdata, path);
// OpenOS does BULLSHIT with this thing, dividing it by 1000 and expecting it to be
// fucking usable as a date, meaning it needs to be an int.
// Because of that, we ensure it is divisible by 1000
t -= t % 1000;
nn_return(computer, nn_values_integer(t));
nn_fs_readCost(fs, 1, component, computer);
}

View File

@ -680,7 +680,11 @@ render:
Color heatColor = GREEN;
if(heat > 60) heatColor = YELLOW;
if(heat > 80) heatColor = RED;
DrawText(TextFormat("Heat: %lf\n", heat), 10, GetScreenHeight() - 30, 20, heatColor);
size_t memUsage = nn_getComputerMemoryUsed(computer);
size_t memTotal = nn_getComputerMemoryTotal(computer);
DrawText(TextFormat("Heat: %.02lf Memory Used: %.2lf%%", heat, (double)memUsage / memTotal * 100), 10, GetScreenHeight() - 30, 20, heatColor);
EndDrawing();
}

View File

@ -8,9 +8,7 @@ local function copy(v, p)
end
if p then
for key, val in pairs(p) do
if not rawget(t, key) then
t[key] = copy(val)
end
t[key] = copy(val)
end
end
return t
@ -434,6 +432,8 @@ sandbox = {
}
sandbox._G = sandbox
print("oh gosh", sandbox.unicode.sub("abc", 1, 0))
local function bootstrap()
local eeprom = libcomponent.list("eeprom")()
assert(eeprom, "no eeprom")

View File

@ -444,6 +444,10 @@ int testLuaArch_unicode_sub(lua_State *L) {
return 1;
}
// Lua indexing bullshit
if(stop == 0) {
lua_pushstring(L, "");
return 1;
}
if(start > 0) {
start -= 1;
} else if(start < 0) {