BleachFan 3 Share Posted November 29, 2010 The UI is defined in XML files located in pak\skin-xml.zip\Windows. Of these files, some describe controls, various small windows, indicators, etc. while others describe whole screens. I'm only interested in these screen XML files at the moment. In the game's UI files, screens are defined as CWindow elements with dimensions 1280x1024. This is an arbitrary resolution that gets scaled up or down to fit the game's resolution setting. Meaning, every element of the CWindow will be scaled to appropriate dimensions. <?xml version="1.0" encoding="utf-8" ?> <suixml version="0.0.1.0"> <templatesource filename="Visuals/VisualTemplates.xml" type="CXMLSerializer"/> <CWindow Name="OutGameMenu" HAlign="Center" VALign="Center"> <rect x="0" y="0" width="=1280" height="=1024" HAlign="center" valign="center"/> Sadly, this means whenever the game's resolution setting is lower than 1280x1024, everything -- every control, every bit of text -- gets downscaled. The game's UI downscaling is horrible. It cuts off multiple rows of pixels from text, stretches or squashes individual characters, distorts all UI controls like checkboxes and sliders, etc. When you also upscale the downscaled UI (e.g. playing 1024x768 fullscreen on a larger monitor) the UI becomes nearly unreadable. But fortunately the UI upscaler is excellent. From what I remember, it's smart enough to draw fonts at larger point sizes (instead of upscaling the pixels), fetch and scale the original bitmaps, etc. Very nice. So I got the idea to rewrite the screen XML files so that they used the smallest supported logical resolution, which works out to 1024x720, and this way the game would never need to downscale anything. Even if you played at 1024x768 or 1280x720, the UI would be drawn 1:1 pixel mapped. At higher resolutions the UI upscaler would kick in. No downscaling! <?xml version="1.0" encoding="utf-8" ?> <suixml version="0.0.1.0"> <templatesource filename="Visuals/VisualTemplates.xml" type="CXMLSerializer"/> <CWindow name="OutGameMenu" halign="center" valign="center"> <rect width="1024" height="720"/> However, the game still downscales the new 1024x720 UI to fit in a tiny part of a 1024x720 window. (See the text I added to display the corners of the 1024x720 CWindow?) Does the game assume the UI is defined with 1280x1024 dimensions? Or have I missed a file/setting somewhere? Any theories? Link to comment
BleachFan 3 Author Share Posted November 29, 2010 To test, I created a CWindow with size 1600x1200 and much of the content was off the screen. This means the game has a constant viewport of 1280x1024. This value must exist somewhere in the game's installation folder. A search of the game files revealed no 1280 or 1024 values (except unrelated things like some creature IDs?). The next most likely place would be the .data section of the .exe or .dll files in the game's system folder. Most of the viewers I tried became unstable and/or display nothing of interest. All that's needed is to enumerate the values and sizes of variables stored in the .data sections. Finding a >= 2 byte variable with static value of 1280 or 1024 would be great. Before you ask: Searching the game's .exe/dll files for the (little-endian) values 0x00050000 and 0x00040000 produces hundreds of matches. Searching the game's memory for 0x0005000000040000 reveals some 900+ locations not to mention all the individual references. Without some good advice to narrow the search, it would be a waste of time. Can anyone recommend a good PE (Portable Executable) file viewer? Link to comment
BleachFan 3 Author Share Posted December 2, 2010 (edited) Try exescope? Thanks, I'll look into it. I did manage to make a proof-of-concept hack. It's very glitchy -- I.e. drawing is off-center, input coordinates aren't adjust to match, etc. -- but it did get the engine rendering 1024x720 UI at 1:1 in a 1024x720 window. This means it IS possible to eliminate downscaling. Look at the text rendering quality! Hacked 1:1 rendering to 1024x720: Stock UI rendering downscaled to 1024x720: Also pay attention to the sliders, checkboxes, etc. No distortion. Edited December 2, 2010 by BleachFan Link to comment
Dragon Brother 620 Share Posted December 2, 2010 Yours does look alot better...now I guess you need to work on getting it to fit... Link to comment
BleachFan 3 Author Share Posted January 20, 2011 (bump) Out of frustration I quit working on this mod. The variables that control various parts of GUI rendering and input seem to move around in memory while the sources (I.e. constants stored in a file somewhere) are nowhere to be found. Anyone have experience hacking games? Knowledge of x86 disassembly is required. Link to comment