Author Topic: Character encoding  (Read 3850 times)

0 Members and 1 Guest are viewing this topic.

Offline Mart

Character encoding
« on: December 14, 2014, 08:15:20 PM »
Does anyone have any info on how SMAC or SMAX works with text character sets?
Is that some option in a file other than exe?
Thank you!
« Last Edit: December 15, 2014, 01:11:16 PM by sisko »

Online Buster's Uncle

  • In Buster's Orbit, I
  • Ascend
  • *
  • Posts: 49272
  • €442
  • View Inventory
  • Send /Gift
  • Because there are times when people just need a cute puppy  Soft kitty, warm kitty, little ball of fur  A WONDERFUL concept, Unity - & a 1-way trip that cost 400 trillion & 40 yrs.  
  • AC2 is my instrument, my heart, as I play my song.
  • Planet tales writer Smilie Artist Custom Faction Modder AC2 Wiki contributor Downloads Contributor
    • View Profile
    • My Custom Factions
    • Awards
Re: Character encoding
« Reply #1 on: December 14, 2014, 08:21:43 PM »
There's a thread somewhere in here where Davyboy found out some about manipulating the text/font/color at the end of secret project movies, but that's as close as I know of to what I think you're asking about...

Offline Mart

Re: Character encoding
« Reply #2 on: December 14, 2014, 08:53:27 PM »
The file: movlist.txt has some settings where there is Arial font indicated with a bunch of numbers. Probably this is the place for adjusting such text properties.
But I found no character set over there.

Offline ete

Re: Character encoding
« Reply #3 on: December 14, 2014, 09:31:57 PM »
http://alphacentauri2.info/wiki/Datalinks_syntax

"The game text files are encoded in Windows-1252."

Offline Mart

Re: Character encoding
« Reply #4 on: December 14, 2014, 09:49:51 PM »
Is this hardcoded in exe file?
If so, knowing the offset would be easy to replace to another encoding.

Offline ete

Re: Character encoding
« Reply #5 on: December 14, 2014, 11:50:00 PM »
Unless it interacts with loads of places, which seems plausible. Could get someone to look at it though, and maybe with the decompilation thing going well it'll become a lot easier.

Offline Yitzi

Re: Character encoding
« Reply #6 on: December 14, 2014, 11:53:27 PM »
It looks like it comes from the Windows kernel's font management system; if you make a Windows-compatible ttf file, it should be usable by the game.

Offline Mart

Re: Character encoding
« Reply #7 on: December 15, 2014, 01:12:59 AM »
Using hex editor, I found 4 occurrences of "arial" in terranx.exe:
arialn.ttf
Arial Narrow
Arial
Arial

and it seems like the last one could be garbage code, from the "surrounding" stuff.
In terran.exe there are only 3.

It looks like they hardcoded font type.
So let's say I instal additional font in windows with characters edited to a set I want.
Then replacing in exe (hex editing would be enough I guess) arial name with that special font ttf file name, we can get this new font to work?

Offline Yitzi

Re: Character encoding
« Reply #8 on: December 15, 2014, 01:35:24 AM »
Using hex editor, I found 4 occurrences of "arial" in terranx.exe:
arialn.ttf
Arial Narrow
Arial
Arial

and it seems like the last one could be garbage code, from the "surrounding" stuff.
In terran.exe there are only 3.

It looks like they hardcoded font type.
So let's say I instal additional font in windows with characters edited to a set I want.
Then replacing in exe (hex editing would be enough I guess) arial name with that special font ttf file name, we can get this new font to work?

I can't think of any reason it wouldn't work.

Offline Mart

Re: Character encoding
« Reply #9 on: December 15, 2014, 06:27:48 AM »
Ok, it looks like it works! :)
And it took me some time to find a good ttf editor, that would do what's needed. These fonts have a lot of parameters, not an easy thing to work with if you are new in this.

However, there will be needed like 4 font files:
- regular
- bold
- italic
- italic bold

A bit of work, but then we would have possibility to apply various character sets with appropriate mapping.
From a user side, he/she would need to:
- install ttf fonts to windows system (like: smac1.ttf or smacf.ttf)
- patch the exe, so it refers to that new font.

I can use for my game hex editor for patching, but ultimately a short executable replacing these font name strings would be better. I can write it.

So for now, the issue is solved, but I still do not know, how bold, italics and bold-italics would behave, just I haven't tested it yet.


Offline Yitzi

Re: Character encoding
« Reply #10 on: December 15, 2014, 12:33:36 PM »
I can use for my game hex editor for patching, but ultimately a short executable replacing these font name strings would be better. I can write it.

Alternatively, I can add 4 new lines to labels.txt, and have it use those instead.  Actually, I think it also uses some other fonts, but I could replace those as well.

Offline Mart

Re: Character encoding
« Reply #11 on: December 15, 2014, 12:57:14 PM »

Alternatively, I can add 4 new lines to labels.txt, and have it use those instead.  Actually, I think it also uses some other fonts, but I could replace those as well.
movlist.txt has font type in there, it's Arial
Other fonts are ttf? I found only one occurence of ".ttf"

Offline gwillybj

Re: Character encoding
« Reply #12 on: December 15, 2014, 02:07:12 PM »
The font used for the closing credits is "Alpha Centauri", ALPHC___.TTF
I don't think I've seen it anywhere during the game.
I'd love to use it for the basename in the F4 screen.
Two possibilities exist: Either we are alone in the Universe or we are not. Both are equally terrifying. ― Arthur C. Clarke
I am on a mission to see how much coffee it takes to actually achieve time travel. :wave:

Offline Yitzi

Re: Character encoding
« Reply #13 on: December 15, 2014, 02:51:00 PM »

Alternatively, I can add 4 new lines to labels.txt, and have it use those instead.  Actually, I think it also uses some other fonts, but I could replace those as well.
movlist.txt has font type in there, it's Arial
Other fonts are ttf? I found only one occurence of ".ttf"

I only saw it for Arial too, but there are mentions of other font names, and I think all fonts in Windows are ttf (though I may be mistaken there.)

Offline scient

Re: Character encoding
« Reply #14 on: December 15, 2014, 04:24:16 PM »
Font::init(LPCSTR fontName, int height, int style) : 0x00618F40
Font::init(LPCSTR fontNameTTF, LPCSTR fontName, int height, int style) : 0x006190D0

The first function initializes font class, the second overload calls the first function in addition to registering the font with the system. This is only used for arialn.ttf.

The height parameter sets lfHeight field inside LOGFONT struct. The style parameter affects lfItalic and lfWeight. lfOutPrecision is set to OUT_TT_ONLY_PRECIS. All other parameters are set to zero.

http://msdn.microsoft.com/en-us/library/windows/desktop/dd145037(v=vs.85).aspx


Globals:
LPSTR g_FONT_SMAC :  0x00691B28 // used for credits only
LPSTR g_FONT_ARIAL : 0x00691B2C // used for base, datalinks, map, and lots of other places
LPSTR g_FONT_ARIALN : 0x00691B30 // used only for council, social engineering and certain popups

All offsets are referencing the SMACX v2.0 exe.

 

* User

Welcome, Guest. Please login or register.
Did you miss your activation email?


Login with username, password and session length

Select language:

* Community poll

SMAC v.4 SMAX v.2 (or previous versions)
-=-
24 (7%)
XP Compatibility patch
-=-
9 (2%)
Gog version for Windows
-=-
103 (32%)
Scient (unofficial) patch
-=-
40 (12%)
Kyrub's latest patch
-=-
14 (4%)
Yitzi's latest patch
-=-
89 (28%)
AC for Mac
-=-
3 (0%)
AC for Linux
-=-
6 (1%)
Gog version for Mac
-=-
10 (3%)
No patch
-=-
16 (5%)
Total Members Voted: 314
AC2 Wiki Logo
-click pic for wik-

* Random quote

The ancient Chinese had a name for it: Feng Shui. We call it energy flow. It is the same thing, the same thought: energy is everywhere, but only a fraction of it is tapped by humans for their purposes. Now the Progenitors have taught us that we can tap not only our own latent abilities, but the latent abilities of the Universe itself.
~Prophet Cha Dawn 'Planet Rising'

* Select your theme

*
Templates: 5: index (default), PortaMx/Mainindex (default), PortaMx/Frames (default), Display (default), GenericControls (default).
Sub templates: 8: init, html_above, body_above, portamx_above, main, portamx_below, body_below, html_below.
Language files: 4: index+Modifications.english (default), TopicRating/.english (default), PortaMx/PortaMx.english (default), OharaYTEmbed.english (default).
Style sheets: 0: .
Files included: 45 - 1228KB. (show)
Queries used: 41.

[Show Queries]