Oblivion
NorthernUI - xxnFontPath

Image information

Added on

Uploaded by

DavidJCobb

About this image

The vanilla game can only load five fonts, which must be specified in Oblivion.ini; to use them on a tile (a single element in the user interface), we must set the tile’s font trait to a number between 1 and 5; choosing an out-of-bounds number will crash the game. The popular MenuQue add-on allows us to use up to 24 additional fonts loaded from the Data/Fonts/Extra folder; however, we must set these fonts by using OBSE-augmented scripts to tamper with the font trait at run-time, to avoid out-of-bounds crashes that occur when MenuQue is not installed.

This is less than ideal, which is why I’ve patched the game to use a new trait: xxnFontPath, which takes a string denoting the path of a font file. The prefix denotes a trait patched into the game as part of NorthernUI.dll’s operation. If I specify xxnFontPath and NorthernUI’s DLL isn’t running, then the trait simply does nothing and the game uses the font trait as before. This should allow me to use fonts by name, without requiring INI edits during development or for installation; and it should allow me to use as many fonts as I need, without any extra dependencies. (Caveat: once extra fonts are loaded, they will not be unloaded until the game is closed; and while there are protections against missing FNT files, missing TEX files will still crash the game as in vanilla.)

Particular difficulty arose in getting the game to recognize the new trait when loading a menu file. Registering it isn’t enough (though with it registered, you can forcibly set it from an OBSE-augmented script); you also need to patch two distinct checks in the game’s XML parsing code just to make the game recognize the trait as valid; and for a string trait, you must patch several more places in order to make the game recognize it as a string. I’ve decoded almost all of Bethesda’s XML parsing code and I understand about 70% of it, which was enough to get the job done.

Now, technically, the only way to prove I’ve done all this (before releasing the mod and source) would be to convert several dozen fonts to Oblivion’s proprietary format, and then take a screenshot showing all of them… and I don’t care nearly enough to do that. You’ll just have to take my word for it when I tell you that in the above screenshot, the fonts overlaid on the character are all handled using my DLL.

1 comment

  1. jobra888
    jobra888
    • premium
    • 86 kudos
    that ui looks very good
    a couple of months ago when i fiddled around with the user interface you could have helped me ^^