From 5db06a0645b769fa8e5e0361fd12c016fc592187 Mon Sep 17 00:00:00 2001 From: Raimon Zamora Date: Wed, 25 Feb 2026 11:53:15 +0100 Subject: [PATCH] - [FIX] sys.subpal() now clamps values for safety --- mini.cpp | 2 +- vscode/library.lua | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mini.cpp b/mini.cpp index e73b292..b32eb58 100644 --- a/mini.cpp +++ b/mini.cpp @@ -726,7 +726,7 @@ uint8_t gettrans() { } void subpal(uint8_t index, uint8_t color) { - ds::draw_palette[index] = color; + ds::draw_palette[SDL_clamp(index,0,255)] = SDL_clamp(color,0,255); } void reset_subpal() { diff --git a/vscode/library.lua b/vscode/library.lua index 10e5230..820b77b 100644 --- a/vscode/library.lua +++ b/vscode/library.lua @@ -436,7 +436,8 @@ function sys.time() end ---Reset chrono time (with offset in seconds) (with decimals) function sys.chrono(offset) end ----Get chrono time since last chrono reset in seconds (with decimals) +---@return number +---@---Get chrono time since last chrono reset in seconds (with decimals) function sys.chrono() end ---@return boolean