News: 11 March 2016 - Forum Rules

Author Topic: [NDS] Fixed string length limit  (Read 2133 times)

Darukeru

  • Jr. Member
  • **
  • Posts: 9
    • View Profile
[NDS] Fixed string length limit
« on: February 05, 2021, 08:42:52 pm »
Hi, currently I'm translating the Nora and the Time Studio game, and I've faced a problem related to the number of characters displayed on screen for a certain list of items, even when where is space left on screen the game refuses to print more than 16 characters (spaces included), and I'm not sure if this is a recurrent practice in NDS games, and if you were to have some idea of how could I overcome this problem. In the following screenshot (bottom) the selected item name isn't displayed completely, the last word should be mushroom. And btw, pointers aren't the problem, if that were the case the items list would be a mess.



I must mention that this game contain certain files with extension .hwtd, these files seem to serve as templates to render text and assets on screen. For example, I was able to modify the initial position where some texts are drawn, so that I could arrange them correctly after the translation. I tried to find this number 16 as a hex value in this file, even considering the number of pixels that 16 characters would occupy, but I couldn't find anything that increased or decreased the number of characters displayed on screen; and in a different screen there seem to be a different maximum number of characters or pixels as the last character is displayed incomplete when there is enough space to print at least a few more characters (Look at the character noble title).


Any advice or comments are welcome.
« Last Edit: February 06, 2021, 02:18:08 pm by Darukeru »

FAST6191

  • Hero Member
  • *****
  • Posts: 3348
    • View Profile
Re: [NDS] Fixed string length limit
« Reply #1 on: February 06, 2021, 10:11:31 am »
It is less that it is common in DS games and more anythin with a menu on any system going can be subject to fixed display limits (though RPGs are particularly prone to it). Don't know that I have seen standalone files to indicate locations in that manner before though; happens enough with general tile maps but layout like that is normally buried in the binary.

If it is this generous* I would opt for reworking things (fungi rather than mushroom to start with, though button in this seems redundant in the name, even more so if you have a nice description you could include it in).

*some 8 and 16 bit era peeps where Japanese stuff got away with maybe 4 characters would probably dearly love to be in your position. Or if you prefer see even why on official translations spell names where the devs presumably had source code and a budget are often clipped in such games, or clipped vs what they would later be known as in later entries on later systems.

If not then you get to figure out what it does and how you might get past it (if it is a window to lower layers then increase window size, and posssibly rework background graphics to still do things, possibly also deal with memory issues), possibly implement hover over scrolling/bouncing back and forth (which is about as fun as it sounds if the game does not do it already).

Sometimes it can be a character limit but more often it is pixel based -- easy enough to calculate such things and it also speaks to graphics/layer windows in the hardware itself which has no conception of characters.

Darukeru

  • Jr. Member
  • **
  • Posts: 9
    • View Profile
Re: [NDS] Fixed string length limit
« Reply #2 on: February 08, 2021, 09:10:36 pm »
It is less that it is common in DS games and more anythin with a menu on any system going can be subject to fixed display limits (though RPGs are particularly prone to it). Don't know that I have seen standalone files to indicate locations in that manner before though; happens enough with general tile maps but layout like that is normally buried in the binary.

If it is this generous* I would opt for reworking things (fungi rather than mushroom to start with, though button in this seems redundant in the name, even more so if you have a nice description you could include it in).

*some 8 and 16 bit era peeps where Japanese stuff got away with maybe 4 characters would probably dearly love to be in your position. Or if you prefer see even why on official translations spell names where the devs presumably had source code and a budget are often clipped in such games, or clipped vs what they would later be known as in later entries on later systems.

If not then you get to figure out what it does and how you might get past it (if it is a window to lower layers then increase window size, and posssibly rework background graphics to still do things, possibly also deal with memory issues), possibly implement hover over scrolling/bouncing back and forth (which is about as fun as it sounds if the game does not do it already).

Sometimes it can be a character limit but more often it is pixel based -- easy enough to calculate such things and it also speaks to graphics/layer windows in the hardware itself which has no conception of characters.

Thanks for your explanation. Probably it is as you say, I also considered the option of abbreviating the necessary texts to make them fit just in place. The percentage of long names is very low, probably messing with window layers and memory management might be a little overkill, at least in terms of results.

Kajitani-Eizan

  • Hero Member
  • *****
  • Posts: 554
  • You couldn't kill me if I tried to let you
    • View Profile
    • KAJITANI-EIZAN's Patch Site: Reimagination
Re: [NDS] Fixed string length limit
« Reply #3 on: February 18, 2021, 07:08:28 pm »
You'll want to use No$GBA debugger to try to figure out what the problem is:
  • Is the game using a fixed size buffer during the string processing? (char buffer[16] or char buffer[32])
  • Is the game displaying text as tilemapped data and is only reading the first 16 characters?
  • Is the game properly rendering text in a proportional/VWF-compatible way and would be out of VRAM if you expanded it?

You can start by examining the VRAM/Tile/OAM viewer, and working backwards from there to figure out file loading/string processing functions, etc. It will likely require learning some ARM assembly, good luck!

Rhys

  • Hero Member
  • *****
  • Posts: 710
    • View Profile
    • CN
Re: [NDS] Fixed string length limit
« Reply #4 on: February 24, 2021, 06:57:21 pm »
An alternative might be doing what some existing DS hacks do, which is to create composite tiles of letter pairs so you can try to compress the text down a bit, e.g. tt could be merged into a single tile as its own character.

Darukeru

  • Jr. Member
  • **
  • Posts: 9
    • View Profile
Re: [NDS] Fixed string length limit
« Reply #5 on: March 07, 2021, 05:11:04 pm »
You'll want to use No$GBA debugger to try to figure out what the problem is:
  • Is the game using a fixed size buffer during the string processing? (char buffer[16] or char buffer[32])
  • Is the game displaying text as tilemapped data and is only reading the first 16 characters?
  • Is the game properly rendering text in a proportional/VWF-compatible way and would be out of VRAM if you expanded it?

You can start by examining the VRAM/Tile/OAM viewer, and working backwards from there to figure out file loading/string processing functions, etc. It will likely require learning some ARM assembly, good luck!

Thank you for the suggestions, might give it a try and look at what is located in ram. But I don't know if I'm brave enough to learn ASM for this purpose haha

March 07, 2021, 05:13:19 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
An alternative might be doing what some existing DS hacks do, which is to create composite tiles of letter pairs so you can try to compress the text down a bit, e.g. tt could be merged into a single tile as its own character.
I did consider that option too, but I might be overcomplicating the situation, probably abbreviating terms here and there might do the trick.

[Unknown]

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
    • PPSSPP
Re: [NDS] Fixed string length limit
« Reply #6 on: April 04, 2021, 08:41:04 pm »
Thank you for the suggestions, might give it a try and look at what is located in ram. But I don't know if I'm brave enough to learn ASM for this purpose haha

Well, you could do a test without any special ASM knowledge.  Rename an item to something like "iiiiiiiiiiiiiiiiABC".  Look at the VRAM / tile viewer.

https://problemkaputt.de/gbapics.htm

From your screenshot, it looks like the letters are fixed width, though.  I'd guess the price has room to go to 5 digits, and so probably overlaps/erases the actual names.  But there's room on the right - if nothing every goes there, you might be able to buy a letter or two by moving it rightward.  That would require some looking at ASM, though.

-[Unknown]