JHGuitarFreak / UQM-MegaMod

A fork of The Ur-Quan Masters + HD-mod that remasters the HD graphics with a veritable smorgasbord of extra features, options, QoL improvements, and much more...
https://uqm-mods.sourceforge.net
GNU General Public License v2.0
78 stars 22 forks source link

Bug: Save game > filename caret is misaligned #252

Closed DanSorrell closed 1 month ago

DanSorrell commented 2 months ago

./src/uqm/gameopt.c

static BOOLEAN DrawSaveNameString (UNICODE *Str, COUNT CursorPos, COUNT state, COUNT gameIndex) {

Currently line 494 ...

Change this: FullCursorPos = CursorPos + (COUNT)strlen(dateStr) - 1;

To this: FullCursorPos = CursorPos + (COUNT)strlen(dateStr);

JHGuitarFreak commented 2 months ago

Taking out the -1 causes all kinds of problems for me when editing save names.
2024-08-08_18-20-23 v0 8 3 HD MegaMod Debug

DanSorrell commented 1 month ago

My initial, low effort, analysis started with me implementing the ISO date format in my local copy of the game’s code:

ISO-Date

I then “fixed” the caret on my end by deleting the minus one. The real solution is to change the line to: FullCursorPos = CursorPos + (COUNT)utf8StringCount(dateStr);

Explanation:

JHGuitarFreak commented 1 month ago

Ah, there we go, I knew there had to be a more elegant solution.
Implemented in commit 4e12529