From 5b80639b01c77bbb92b371bd48170e50af545ff4 Mon Sep 17 00:00:00 2001 From: Chris Maltby Date: Sat, 23 Nov 2024 11:02:07 +0000 Subject: [PATCH] Fix UI palette text control code. Palette indices now go from 1 to 8 --- CHANGELOG.md | 1 + appData/src/gb/engine.json | 2 +- appData/src/gb/src/core/ui.c | 2 +- src/lib/project/ejectEngineChangelog.ts | 7 +++++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 851a3482e..a5bf19ae6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,6 +57,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix issue where changing the dimensions of a sprite png image could cause the sprite editor's tile palette to display incorrectly - Fix line numbers in code editor for GBVM scripts with more than 999 lines - Fix issue preventing projects being created with the name "project" +- Fix UI palette text control code. Palette indices now go from 1 to 8, because zero byte is a string terminator [@untoxa](https://github.com/untoxa) ## [4.1.3] - 2024-09-16 diff --git a/appData/src/gb/engine.json b/appData/src/gb/engine.json index 0495c441f..b99b8a737 100644 --- a/appData/src/gb/engine.json +++ b/appData/src/gb/engine.json @@ -1,5 +1,5 @@ { - "version": "4.2.0-e4", + "version": "4.2.0-e5", "fields": [ { "key": "INPUT_PLATFORM_JUMP", diff --git a/appData/src/gb/src/core/ui.c b/appData/src/gb/src/core/ui.c index 12a03b79b..4ab7ccca3 100644 --- a/appData/src/gb/src/core/ui.c +++ b/appData/src/gb/src/core/ui.c @@ -389,7 +389,7 @@ UBYTE ui_draw_text_buffer_char(void) BANKED { if (vwf_current_offset) ui_print_reset(); break; case 0x0b: - text_palette = (*++ui_text_ptr & 0x07); + text_palette = (((*++ui_text_ptr) - 1u) & 0x07u); break; case '\r': // 0x0d // line feed diff --git a/src/lib/project/ejectEngineChangelog.ts b/src/lib/project/ejectEngineChangelog.ts index 39855c761..f179b657f 100644 --- a/src/lib/project/ejectEngineChangelog.ts +++ b/src/lib/project/ejectEngineChangelog.ts @@ -793,6 +793,13 @@ const changes: EngineChange[] = [ "src/core/vm_music.c", ], }, + { + version: "4.2.0-e5", + description: createDescription("Fixes", [ + "Fix UI palette text control code. Palette indices now go from 1 to 8, because zero byte is a string terminator", + ]), + modifiedFiles: ["src/core/ui.c"], + }, ]; export const isKnownEngineVersion = (currentVersion: string): boolean => {