Page 4 of 6

Re: XWA Custom & Widescreen Resolutions

Posted: Mon Dec 31, 2018 10:55 pm
by Justagai

Code: Select all

<Patch Name="1600x1200 to 1920x1080 Resolution - HUD Scale 1.49">
    <Item Offset="10A3BC" From="4006" To="8007"/>
    <Item Offset="10A3C1" From="B0" To= "38"/>
    <Item Offset="10F500" From="00000040" To= "52B8BE3F"/>
    <Item Offset="10F50A" From="0005" To= "8004"/>
Based on what I've found...

The first and second offsets modifies the width and height of the resolution in the 1600x1200 spot. The third is what sets the time scale and the last sets the FOV.

The original bytes are correct, and so are the new bytes. The HUD scale gets set to 1.49 with the third offset.

Each resolution setting has their own hud scale and fov that can be set. I've gotten the HUD scale and FOV of the rest of the resolutions since it looks like you have the height and width for the others already.

Code: Select all

640x480:
HUD Scale: 0000803F (10F428)
FOV: 00020000 (10F432)

800x600:
HUD Scale: 0000803F (10F455)
FOV: 80020000 (10F45F)

1024x768
HUD Scale: 0AD7A33F (10F482)
FOV: 33030000 (10F48C)

1152x864
HUD Scale: EC51B83F (10F4AC)
FOV: 9A030000 (10F4B6)

1280x1024
HUD Scale: 6666E63F (10F4D6)
FOV: C0030000 (10F4E0)

Re: XWA Custom & Widescreen Resolutions

Posted: Tue Jan 01, 2019 10:12 am
by Bman
Great DS & Justagai, thanks for posting that. For the TFTC project, I was using the Backdrop scaling factor from 256.0f to 64.0f, because I was using larger .dat files like 2048x2048 for sharper background images, but I'm thinking of readjusting back to the newer standard of DTM's 128.0f. I haven't mentioned this before, but I think I recall another solution is using AlliED to scale the .dat images referenced as BackDrop Flight Groups. Instead of using whole integer numbers size = 1, 2, 3 etc. we can use decimals to tweak the scaling of backdrops i.e. 2.34 on a per mission basis. I'll revisit this but it seemed to work when I tested it two years ago. My power went out the other night in middle of testing, so either my .exe is now corrupted or my .plt file is. When I launch a skirmish test mission it crashes to desktop. :-( Anyway, I'll be back up running soon.

Re: XWA Custom & Widescreen Resolutions

Posted: Tue Jan 01, 2019 4:12 pm
by Reimar
I am not entirely following the discussion, but just to make sure you're not duplicating effort, xwahacker calculates default fov and HUD scale like this:

GUI_EXPORT int default_fov(int height) {
int fov = height * 1.0666f + 0.5f;
return fov > 0 ? fov : 1;
}

GUI_EXPORT float default_hud_scale(int height) {
float res = height / 600.0f;
return res > 1.0f ? res : 1.0f;
}

General FOV calculation:

GUI_EXPORT float fov2deg(int fov, int height) {
return atan((float)height / fov) * 2 / pi * 180;
}

GUI_EXPORT int deg2fov(float deg, int height) {
int fov = height / tan(deg / 180 * pi / 2) + 0.5f;
return fov > 0 ? fov : 1;
}

Re: XWA Custom & Widescreen Resolutions

Posted: Tue Jan 01, 2019 4:15 pm
by Darksaber
EDIT: Thanks Reimer, but I just don't understand what you have there, but... I did use XWAHacker to input the resolutions below, and as you say it calculates the FOV and HUD, the only HUD's I changed was 1440x900, 1680x1050, 1920x1080 due to the reason below , so thanks)

Update on the Wide Screen Resolutions

The Most common Screen Resolution I could find (remember these a few years old now) are :-

1280x720
1280x768
1280x800
1366x768
1440x900
1680x1050
1920x1080

All these work OK, but anything larger and I just can't test as my monitor max is 1920x1080, I felt there wasn't a need to change or edit 640x480, 800x600 or 1024x768, as most people these day I imagine have a screen with a better resolution

Code: Select all

  <Patch Name="1152x864 to 1280x720 Resolution, FOV 86.30, HUD Scale 1.20">
    <Item Offset="10A37D" From="8004" To="0005"/>
    <Item Offset="10A382" From="6003" To= "D002"/>
    <Item Offset="10F4B6" From="9A" To= "00"/>
    <Item Offset="10F4AC" From="EC51B8" To= "9A9999"/>
  </Patch>
  <Patch Name="1152x864 to 1280x768 Resolution, FOV 86.32, HUD Scale 1.28">
    <Item Offset="10A37D" From="8004" To="0005"/>
    <Item Offset="10A382" From="6003" To= "0003"/>
    <Item Offset="10F4B6" From="9A" To= "33"/>
    <Item Offset="10F4AC" From="EC51B8" To= "0AD7A3"/>
  </Patch>
  <Patch Name="1152x864 to 1280x800 Resolution, FOV 86.33, HUD Scale 1.33">
    <Item Offset="10A37D" From="8004" To="0005"/>
    <Item Offset="10A382" From="60" To= "20"/>
    <Item Offset="10F4B6" From="9A" To= "55"/>
    <Item Offset="10F4AC" From="EC51B8" To= "ABAAAA"/>
  </Patch>
  <Patch Name="1152x864 to 1366x768 Resolution, FOV 86.32, HUD Scale 1.28">
    <Item Offset="10A37D" From="8004" To="5605"/>
    <Item Offset="10A382" From="60" To= "00"/>
    <Item Offset="10F4B6" From="9A" To= "33"/>
    <Item Offset="10F4AC" From="EC51B8" To= "0AD7A3"/>
  </Patch>
  <Patch Name="1152x864 to 1440x900 Resolution, FOV 86.30, HUD Scale 1.49">
    <Item Offset="10A37D" From="8004" To="A005"/>
    <Item Offset="10A382" From="60" To= "84"/>
    <Item Offset="10F4B6" From="9A" To= "C0"/>
    <Item Offset="10F4AC" From="EC51B8" To= "0000C0"/>
  </Patch>
  <Patch Name="1600x1200 to 1680x1050 Resolution, FOV 86.30, HUD Scale 1.49">
    <Item Offset="10A3BC" From="40" To="90"/>
    <Item Offset="10A3C1" From="B0" To= "1A"/>
    <Item Offset="10F50A" From="0005" To= "6004"/>
    <Item Offset="10F500" From="00000040" To= "52BBBE3F"/>
  </Patch>
  <Patch Name="1600x1200 to 1920x1080 Resolution, FOV 86.30, HUD Scale 1.49">
    <Item Offset="10A3BC" From="4006" To="8007"/>
    <Item Offset="10A3C1" From="B0" To= "38"/>
    <Item Offset="10F50A" From="0005" To= "8004"/>
    <Item Offset="10F500" From="00000040" To= "52B8BE3F"/>
  </Patch>
I could add these to both the XWACP and DSUCP, but I'll also add an option for NO Change to the Resolutions, so the user can download XWAHacker and manually change to there preferred resolution.

I should explain the for Hud Scale setting it to 1.49 is due to the XWA FONT FIX as seen here is states
***************************
X-Wing: Alliance
***************************

Title: High Resolution fonts for Nvidia Cards
Author: Behelith

IMPORTANT NOTICE:
If you're playing X-Wing Alliance with XWA Upgrade and XWAhacker you'll probably notice some cut fonts. To solve the problem reduce the HUD scale to lower than 1.50 (e.g. 1.49 or lower) in XWA hacker. The only resolution where the HUD scale is set higher than 1.49 by default is 1600x1200. I set mine to 1.49 and all the characters are rendered correctly, the HUD is a little bit smaller but you'll be able top read all the characters correctly. Another option is to use 1152x864 resolution which I also find very nice on my 2560x1600 monitor as the HUD will be a bit larger. This trick will probably work all 3rd party font files.

Re: XWA Custom & Widescreen Resolutions

Posted: Tue Jan 01, 2019 6:36 pm
by keiranhalcyon7
Is there any interest in a hook that just reads the values to use out of a text file? With the offsets known, I could probably write it, if I can find the time.

Re: XWA Custom & Widescreen Resolutions

Posted: Tue Jan 01, 2019 7:03 pm
by Darksaber
Thanks, but no thanks, personally I'll keep this as patch files thanks again though

Re: XWA Custom & Widescreen Resolutions

Posted: Wed Jan 02, 2019 5:51 pm
by JeremyaFr
Hello,
Have you considered calling GetSystemMetrics( SM_CXSCREEN ) and GetSystemMetrics( SM_CYSCREEN ) to get the screen resolution and then choose which patch to apply based on that.

Re: XWA Custom & Widescreen Resolutions

Posted: Sat Jan 26, 2019 5:50 pm
by JeremyaFr
Hello,
Here is a hook that displays the screen resolution in the video options screen.

xwa_hook_resolution.zip

Instead of the default screen resolutions, the resolutions set with XWA Hacker with be displayed.

Re: XWA Custom & Widescreen Resolutions

Posted: Sat Jan 26, 2019 6:55 pm
by Darksaber
Oh I thought that was done through the Frontxt.txt file?

I can soon remove my text changes from my script :)

Re: XWA Custom & Widescreen Resolutions

Posted: Sat Jan 26, 2019 7:17 pm
by JeremyaFr
Yes, the game reads the resolution texts from "Fronttxt.txt". My hook overrides that.

Re: XWA Custom & Widescreen Resolutions

Posted: Sat Jan 26, 2019 7:34 pm
by keiranhalcyon7
Aw, crap, now I gotta rename my work in progress...

Re: XWA Custom & Widescreen Resolutions

Posted: Sat Jan 26, 2019 9:54 pm
by Reimar
On that topic, if someone is interested in XWAHacker, I released a new version.
The GUI will now warn about needing the hook for height > 1200 and suggest a HUD scale <= 1.49.
And it supports setting the FPS limit.
The command-line version also allows setting the FPS limit for the other games in the series, but I have not tested that properly.
(and in case anyone actually prefers the UWP version via Windows store, I updated it as well, but it's a typical Microsoft experience - i.e. in particular decidedly developer-unfriendly and slow, so expect it to take a week to actually become available...)

Re: XWA Custom & Widescreen Resolutions

Posted: Sun Jan 27, 2019 3:53 pm
by Bman
Thanks Reimar, and Jeremy. Both are great.

Re: XWA Custom & Widescreen Resolutions

Posted: Tue Jan 29, 2019 8:11 am
by Darksaber
JeremyaFr wrote:
Sat Jan 26, 2019 5:50 pm
Hello,
Here is a hook that displays the screen resolution in the video options screen.

xwa_hook_resolution.zip

Instead of the default screen resolutions, the resolutions set with XWA Hacker with be displayed.
Jeremy is this Hook going to be added to your GitHub, OneDrive and your Hook Setup tool ???

Thanks

Re: XWA Custom & Widescreen Resolutions

Posted: Tue Jan 29, 2019 9:30 am
by JeremyaFr
UPDATE
Hello,
I've uploaded the resolution hook to GitHub and OneDrive.

Re: XWA Custom & Widescreen Resolutions

Posted: Tue Jan 29, 2019 2:20 pm
by Darksaber
Thanks :)

Re: XWA Custom & Widescreen Resolutions

Posted: Tue Feb 26, 2019 6:40 am
by Murdokk
Hey guys, I'm brand new to these forums and have just finally got around to picking up an old copy of XWA. I've been a huge fan of space sims but for whatever reason never got around to playing this one until now. Very excited to start my journey with this one! I've got it all installed and modded up fully with the most recent packs, wanted to say a huge THANKS to all the hard work you guys have put in here - truly monumental effort, and wow it's just awesome to see. The help guides have all been perfect so far, everything has run smoothly and it looks beautful for me. Runs fantastic so far and I'm amazed at how easy the mod installs have gone. I've flown just the first 3 intro missions so far, and can tell I'm going to be hooked on XWA, just love it so far.

Quick question for the wise Gurus out there: Widescreen settings - how to fully squeeze the best out of them?

My system is pretty decent, while not super top-end it's definitely got more than enough horsepower for XWA:
Monitor: 3440x1440 Ultrawide (21:9) 34"
CPU: AMD FX-9590 8-core
VID: AMD RX-580 8-GB OC
RAM: 16GB Overclocked

I am using XWA Hacker (the new Windows gui ver0.32 just out last month) and so far have these settings:

2200x1200 res ; FOV=104.45 ; HUD=1.49

I have chosen them because while my Ultrawide monitor natively displays 3440x1440, that's very probably asking way too much from XWA and given the HUD font issue, would make the text super small if I went higher than 1200 on the height. However at 1920x1200 (a setting discussed in these forums) - things still look very stretched. So I have increased the numbers on width and increased the FOV - and so far things look pretty good. At 2200x1200 this ratio gives me 16.5:9 - which looks good but it doesn't appear to change much if I increase the numbers (resolution and FOV) beyond that. Is XWA limited to a 16:9 maximum ratio? Is there a max useable FOV?

Any advice would be appreciated from anyone having success with wide/Ultrawide resolutions. Many thanks - and once again FANTASTIC WORK to all the modders that have contributed to this project, I am super impressed!

Cheers

Re: XWA Custom & Widescreen Resolutions

Posted: Tue Feb 26, 2019 9:27 pm
by Reimar
FOV to my knowledge is actual vertical FOV, you I think you normally shouldn't touch it when changing resolution.
The aspect of the resolution you specify should match the aspect of your screen (and you have the ddraw.dll set to preserve aspect you'll see the black bars if that is not the case instead of it being stretched). That would mean something around 2860x1200 in your case.
Note that this only affects the resolution of 2D things like HUD etc, so it might actually look nicer to your eye if you just go for some nice round scale factor like 2x, e.g. use 1720x720...

Re: XWA Custom & Widescreen Resolutions

Posted: Thu Feb 28, 2019 10:50 pm
by Murdokk
Alright - well I've done more testing and here's what I've found out, hopefully this helps some other newcomers as well:

Initially I did not want to put my vertical resolution higher than 1200, as there were lots of notes in help guides suggesting this was a hard limit, the game would crash if values were set higher than this. Turns out (thanks to the GENIUS of the hook files written by Jérémy Ansel) there is now a hook file that overcomes this limit, so I am able to run XWA at full 3440x1440 Ultrawide resolution. This file is "Hook_Res1200.dll" and of course it is included in the latest XWAU v1.6 and also the DSUCP v2.6 (which is what I am using). If you don't have it - I'd suggest installing either of those packs or checking Jeremy's GitHub to download the latest version of his hooks there. Link below:

https://github.com/JeremyAnsel/xwa_hooks

So as for the FOV setting - it does not only affect the vertical, but of course the horizontal FOV as well. As I have found it can be modified much higher for wider, larger views (I have tried values up to 120) and can be set to values much lower (I have tested as low as 70) and you get narrower more "zoomed in" views with lower settings. Seems to me this can be changed around to suit your personal preference. Below I have a link to some screenshots I took, both with my Max resolution set at 3440x1440, the first image has FOV 86 (default value) and the second a wider FOV of 111. As you can see, with FOV of 111, it appears more "zoomed out" and you can see more of the interior cockpit, and a wider view from side to side:

https://imgur.com/gallery/Oqc5lcg


Reimar - you are exactly correct!! Thankyou for this tip - that the resolution you set doesn't actually affect the 3D gameplay resolution, it only affects the resolution of 2D things like HUD etc. So by setting a lower resolution than my monitor is capable of (like setting half, as you suggested) the HUD screens are larger, the text printing on the HUD is much easier to read, and the 3D gameplay looks exactly the same.

So bottom line, I have gone with setting 1720 x 720 (half of my monitor's 3440 x 1440) ; to get a slightly wider view I have increased my FOV slightly to 94 (it just looks better to me like this so far); and I have left the default HUD setting at 1.2. The game really looks fantastic at these settings for me.

While this might be old news to the veterans here, hopefully this helps someone else out there which is why I have posted. Thanks again for the advice Reimar!
Cheers all, MTFBWY! :D

Re: XWA Custom & Widescreen Resolutions

Posted: Mon May 20, 2019 2:50 pm
by ffaaway
Murdokk wrote:
Thu Feb 28, 2019 10:50 pm

So bottom line, I have gone with setting 1720 x 720 (half of my monitor's 3440 x 1440) ; to get a slightly wider view I have increased my FOV slightly to 94 (it just looks better to me like this so far); and I have left the default HUD setting at 1.2. The game really looks fantastic at these settings for me.

While this might be old news to the veterans here, hopefully this helps someone else out there which is why I have posted.
Thanks Murdokk for posting this info here so I didn't have to spend a week fiddling with hex trying to figure out how to get 3440x1440 21:9 working. :D

Thank you to Reimar for the new and improved XWA Hacker w/GUI that made this process super easy!

Thank you Jeremyafr for the hook allowing more than 1200px height!

I thought my XWA days were truly over due to this limitation but the XWAUP team just keep pulling off miracles that keep XWA alive and better than EVER!!

Image

Full size image

With these xwahacker-gui-0.32-win settings:
Image

Re: XWA Custom & Widescreen Resolutions

Posted: Tue Apr 07, 2020 8:15 pm
by JeremyaFr
Hello,

Here is a modifield version of the resolution hook (which show the resolutions in the game menu) to auto set the game resolution to the native screen resolution.

EDIT: link removed

The resolution variables are set as follow:

Code: Select all

	int cx = GetSystemMetrics(SM_CXSCREEN);
	int cy = GetSystemMetrics(SM_CYSCREEN);

	*(float*)0x06002B8 = cy / 600.0f;
	*(int*)0x091AB6C = (int)(cy * 1.0666f + 0.5f);
	*(int*)0x07B33CC = *(int*)0x091AB6C / 2;
	*(float*)0x07D4B78 = *(float*)0x06002B8 * 1.25f;

	*(float*)0x08B94CC = (float)*(int*)0x091AB6C;
	*(float*)0x08B94BC = *(int*)0x091AB6C * 0.001953125f;

	*(int*)0x091AD34 = cx;
	*(int*)0x091AD3C = cy;
	*(int*)0x06002B0 = cx;
	*(int*)0x06002B4 = cy;
	*(int*)0x05FFDB4 = cx;

Re: XWA Custom & Widescreen Resolutions

Posted: Tue Apr 07, 2020 9:31 pm
by keiranhalcyon7
Is there a setting somewhere to enable this? I know some people deliberately undersize their 2d resolution in order to take advantage of ddraw's HUD upscaling without breaking the fonts, or for VR-related reasons.

Re: XWA Custom & Widescreen Resolutions

Posted: Tue Apr 07, 2020 11:16 pm
by m0rgg
Hi JeremyaFr,

I'm trying to figure out how to set the render parameters automatically using the HMD info provided by the HMD driver through the OpenVR/SteamVR API.

Is it possible to set the resolution (and especially aspect ratio) dynamically from ddraw.dll, based on the values provided by the HMD driver?
Alternatively, would it be possible to have a mode in this hook to read the values from OpenVR?

Is the target render FOV in xwingalliance.exe still relevant or can it be completely overriden by the D3D11 ddraw.dll wrapper?
Does it need to be similar, or at least larger than the one used for the final D3D rendering (to avoid culling issues, although I ignore if the engine does any of this)

Finally, anyone knows if it is possible to change the scale and position of the HUD independently of the resolution?

Thanks!

Re: XWA Custom & Widescreen Resolutions

Posted: Wed Apr 08, 2020 2:09 pm
by JeremyaFr
keiranhalcyon7 wrote:
Tue Apr 07, 2020 9:31 pm
Is there a setting somewhere to enable this?
I will add a setting to disable/enable the auto resolution feature.
I will also add settings to define the width and height.

Re: XWA Custom & Widescreen Resolutions

Posted: Wed Apr 08, 2020 2:29 pm
by Darksaber
Tried the resolution hook, but to be honest I don't see anything different from the previous version, I already have slot 5 set to 1920x1080, so maybe this is the reason :?