Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GUI scaling #4

Open
halamix2 opened this issue Nov 8, 2020 · 5 comments
Open

Fix GUI scaling #4

halamix2 opened this issue Nov 8, 2020 · 5 comments

Comments

@halamix2
Copy link

halamix2 commented Nov 8, 2020

There should be one float 0.0015625 (CD CC CC 3A) in exe that controls GUI scaling . When set to half of the original value ~0.0007625 the GUI and menus are centered and taking half of the screen on X axis.
Problem: how to decide correct value for widescreen
(4/3)*(21/9)*0.0015625 // for 21/9 screens

Offsets:

  • International
    • D3D: 0x46E69C
    • Glide: 0x46D754
  • Polish
    • D3D: 0x46f634
    • Glide: 0x46D6EC

Example with 21:9 widescreen fix and the float set to 0.0007625:

widescreen

@halamix2
Copy link
Author

halamix2 commented Nov 8, 2020

Mainly creating issue to keep notes here for later, I might try programming that in a week or two, (alongside with converting widescreen fix to loadable dll, as version detection currently used in other things, like autosplitter, is based on exe MD5 sum)

@SuiMachine
Copy link
Owner

SuiMachine commented Nov 8, 2020

Mainly creating issue to keep notes here for later, I might try programming that in a week or two, (alongside with converting widescreen fix to loadable dll, as version detection currently used in other things, like autosplitter, is based on exe MD5 sum)

https://github.com/ThirteenAG/Ultimate-ASI-Loader should make it easy in that case unless you really need it to be one dll.

@halamix2
Copy link
Author

halamix2 commented Nov 8, 2020

I kinda already done something like original WormKit (haven't yet published that, only internal development on Discord for now), a launcher that loads all sk*.dll libraries inside game directory; and tested that with library replacing 4:3 float with one for 21:9 ratio.

@halamix2
Copy link
Author

I managed to make widescreen fix in a form of loadable dll module, but it needs original .exe to work (version is checked by executable hash)
loader for module
module itself

@halamix2
Copy link
Author

halamix2 commented Nov 22, 2020

Finding 8988083B CDCCCC3A (2 floats, ~0.0020833334 and ~0.0015625) is easy, there is only one occurrence in all exe I've tested (interntional/pl, d3d/glide)
These are two floats for Y and X 2D scaling, I've used something like this in skScreen:

float ratio43 = 4.0f / 3.0f;
float ratioWanted = gameConfig.getWidth() / gameConfig.getHeight();
// is new resolution wider than 4:3?
if (ratio43 < ratioWanted)
{
    // make UI shorter in X axis
    float ratio = ratio43 / ratioWanted * 0.0015625f; // 0.0015625 is magic
    // replace original magic value wiith calculated one
    replaceMemory(addressX, ratio);
}
else
{
    // make UI shorter in Y axis
    float ratio = ratioWanted / ratio43 * 0.0020833334f; // 0.0020833334 is magic
    // replace original magic value wiith calculated one
    replaceMemory(addressY, ratio);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants