PPCenter :: devblog

PPcenter. Arts and craft for my Sega Saturn. Since 1847 !

The quick lazy brown dog jumps over the foxes ?

Written by cafealpha no comments
The quick lazy brown dog jumps over the foxes ?
The brown fox quick lazy jump jumps over the ?
The ... well, I forgot what it was, but just to say that I spent a some time in messing with fonts in my Save Data Manager application
In fact, it would be more accurate to speak about code pages (*), because I finally added support for Japanese text display :]

(*) For those who forgot what code pages was :
Once upon a time, before Unicode unified every characters, (and also made strlen function not working correctly on UTF-8 text), there was a custom for all countries in the developed world to define up to 128 extra characters that would be used in second half of ASCII character table.
Of course, Japan wanted to do the same, so it added poor looking "1 byte kana" characters on this extra 128 character page, and also added the remaining characters (including kanjis) after that, which gave birth to Shift-JIS encoding.

Since Saturn was developed, during this prehistoric "codepage" era, it is normal to find can find some code page remnants in Saturn software

One of these "code page remnants" is the comment string stored in each Saturn saves : didn't you noticed that sometimes BIOS displays Japanese characters in its save management screen ?

So, Save Data Manager must display Japanese characters instead of garbage characters when showing comment in save data selection menu !

data/images/20150704_save_delete_menu.png
What save comment looked like before
adding Japanese characters display ...
(It's a 6 months old screenshot)

How to do this ?
First, I need to verify that BIOS was defining characters according to Shift-JIS charset, and the best way to do this was to modify some save states and see what BIOS is displaying on screen.

And if possible, displaying as much as possible characters at once would improve the job's efficiency, so I choose to modify Keio Flying Squadron saves since they take only 32 bytes each.

So here comes the reason I choose a such weird title for this article : I wanted to display all font characters at once on screen
In the facts, I didn't used such a complex "lazy brown dog jump blah blah blah" sentence. I just displayed all the character in ascending order, and here is what it looked like in BIOS screen :

data/images/20160203_chars_katakana_raw.png
Repeat after me : -アイウエオカキクケコサシスセソ...
Looks good  That's definitely 1 byte kana characters in typical order.

Saturn BIOS also has ability to display European (accented) character, and switching from a codepage to another is just the matter of changing a byte per save data, so let's try and see what it looks likes :
data/images/20160203_chars_francais_raw.png
Same text as above, I just changed the language value

Oh, it looks like the good old ISO 8859-1 (latin1) charset

The picture above was displayed by setting French (my native language) language code in save, and setting to another language code (I tried with Spanish) gave unsurprisingly the same results.

So in the Saturn world, one byte equals one character, and there are two codepages to handle in order to display save comment string.
I first feared I had to deal with multi-byte characters (that is a real pain to handle when coding software), but that's not the case, and in fact it's relatively easy to do.

(2 hours later)
data/images/20160203_font_katakana.png data/images/20160203_font_francais.png
Katakana and European fonts

Hmm, theses characters are looking cute :)
It's seems that it is time to feed my image conversion tool ^^

(5 minutes later)
Okay, latin.bin and katakana.bin files are ready, I should add some codepage stuff in my text display code now !

(1 hour later)
data/images/20160203_font_test3_katakana_text_and_menu.png
Finally some exotic language displayed !
I lost 30 minutes in wondering why application wasn't
initially showing Japanese characters ... and it appears that
I was "cleaning up" the comment string by replacing exotic
character into space character
"It wasn't a bug, it was a feature "

It made sense when Japanese character wasn't displayed
correctly, but it was time to remove this string cleanup code.


Job complete ? Well, there are still some details to fix, and this is what take the most of time when developing software, but at least the boring part of the job is done :]



As a reward for me, I can now set save comment to a cool one when importing save data and that comment isn't defined.
I initially used a dummy "ImportData" string, but the holy "セガサターン,シロ" string defined in hitomi2500's ss-save-parser project is definitely better.
data/images/20160203_save_default_comment.png
セガサターン,シロ !


Last but not least : finishing this main quest opens doors to firmware translation side quest !
Well, Japanese translation would be ugly, because kanji characters are not available (just old-looking katakana characters : this article title would look like ザレージフォックスジャンプオーバーザブラウンドッグ on firmware :D), and on software side, handling multi byte characters is a real mess, so I don't want to do make a Japanese version of Pseudo Saturn Kai and Save Game Manager.

However, translation for European languages is now technically possible
Well, "possible" doesn't means I will do this right now  This is a low priority job, so I will do it when I will have enough time and motivation for it.

BTW, in order to test if exotic character display was OK on Pseudo Saturn, I tried to print "beta" glyph (defined in European codepage) on the title bar :
data/images/20160211_pskai_main_menu.png
Pseudo Saturn Kai main menu
Without any surprises (text display routines are common between Pseudo Saturn Kai and Save Data Manager), it works !
I can finally indicate that this is a beta version ^^





Edit : oops, the feature to inform me when a comment is posted seems (once again) not to work, and consequently I didn't noticed new comments :/

Here are the comments I replied so far. Since I'm late, they deserve to be re-posted here :

I am really happy to hear that you don't have cancer anymore!! Congratulations! I wish you a really long and happy life! :)     Anon

@Anon : It doesn't guarantee I'm cancer free !
CT scans indicate that there is no evidence of cancer relapse, but CT scan has limits (it doesn't shows millimeter-order tumors), so I continue regular cancer screening and taking care in everyday life

--------------
Hey @Spawn, could you upload those Saturn saves you have on your PC?
I have been looking for an archive of Saturn game saves for months now and I haven't found any.
Maybe with the save states I have, and your saves I can upload them somewhere and start an archive? I'll give you credit for it of course.     ReyVGM
@ReyVGM : Thank you for sharing your saves on segaxtreme !
They will be available for everybody on Save Data Manager, so that it will be easy to import on Saturn or emulator.

--------------
best wishes for 2016 !!!     vbt
@vbt : Thank you ! Best wishes for 2016 too !!!
Well, we are already in February, sorry ^^;


--------------
It's great to see your active development, cause my saturn projects are almost in hibernation today (i'm a bit in a time trouble). And i'm glad my code is of some use.
Good luck!     hitomi2500
@hitomi2500 : Hehe, I got some free time until end of March ... I don't know what it will be after that, but what's sure is that I will continue to have fun with my Saturn  Please keep continuing the good work too :]

--------------

stunned and confused

last night I went on a sega saturn nostalgia trip.

I had to catch up with 8+ years @ segaxtreme.
I found antime's usbcart, hitomi2500's fork, hitomi2500's new "wasca" and your stuff here.

sounds great ...
I need to dig up my saturn and finally start something.
I have a usb-cart from 2006 from pinchy (he seems inactive since 2007).     seal1
@seal1 : Hey, I remember seeing your nick in segaxtreme thread about yano/Freewing transfer device (I built a Freewing device at that time).
It was a long time before I made my first USB dev cart ... nostalgia.
Many members forgot about Saturn and left segaxtreme, but luckily vbt and antime are still active.
You're always welcome on segaxtreme, even if it just to say "hi"

Read more The quick lazy brown dog jumps over the foxes ?

Some fun with yabause on my laptop

Written by cafealpha 2 comments
Today, I made fixes to :
 - yabause (debug version for personal use), because UBC doesn't works well on it.
 - SatLink, because mkdir function returns -1 when folder already exist
 - PseudoSaturn, various features additions, fixes, as usual
 - BackupManager, in order to display some debug informations.
 - Vmem module, various fixes, especially one that took me a couple of hours to understand

data/images/20150630_bug_fix.gif
Me when debugging my Saturn projects
(Video grabbed from 9gag.com)


But at least, virtual memory cart is ready for debugging now
data/images/20150630_vmem_test.tb.png
Debug session with yabause and SatLink
NiGHTs Xmas header data (bottom of screenshot) was copied
from internal memory to laptop HDD


So, everything don't work right now, but UBC related things and log message output are nearly OK, so that debugging this vmem project will be (maybe ?) comfortable from now :]

... I'm tired No more debugging for today ^^

Read more Some fun with yabause on my laptop

Rss feed of the tag