Posted December 17, 2023
Ignore this post, these are just my notes for myself if I ever have to enable widescreen again.
Summary:
User Hex-Editor and search/replace f30f101dc8217c110f2fc30f87830000000f2fd8 => f30f101dc8217c110f2fc39090909090900f2fd8
Then set resolution with regedit "HKEY_CURRENT_USER\Software\Failbetter Games\Sunless Skies", "Screenmanager Resolution Width_h182942802", "Screenmanager Resolution Height_h2627697771"
--------------
Notes:
Search for "1.777778" or " * 100.0) / 100.0" or " * 0.5,0x3f800000,1.0 - " in Ghidra works
private void UpdateCamera()
{
if (!ResolutionManager.FixedAspectRatio || !cam) return;
float currentAspectRatio = (float)Screen.width / Screen.height;
// If the current aspect ratio is already approximately equal to the desired aspect ratio,
// use a full-screen Rect (in case it was set to something else previously)
if ((int)(currentAspectRatio * 100) / 100.0f == (int)(ResolutionManager.TargetAspectRatio * 100) / 100.0f)
{
cam.rect = new Rect(0.0f, 0.0f, 1.0f, 1.0f);
if (backgroundCam)
{
Destroy(backgroundCam.gameObject);
}
return;
}
// Pillarbox
//Patch here
/*if (currentAspectRatio > ResolutionManager.TargetAspectRatio)
{
float inset = 1.0f - ResolutionManager.TargetAspectRatio / currentAspectRatio;
cam.rect = new Rect(inset / 2, 0.0f, 1.0f - inset, 1.0f);
}
// Letterbox
else*/
{
float inset = 1.0f - currentAspectRatio / ResolutionManager.TargetAspectRatio;
cam.rect = new Rect(0.0f, inset / 2, 1.0f, 1.0f - inset);
}
if (!backgroundCam)
{
// Make a new camera behind the normal camera which displays black; otherwise the unused space is undefined
backgroundCam = new GameObject("BackgroundCam", typeof(Camera)).GetComponent<Camera>();
backgroundCam.depth = int.MinValue;
backgroundCam.clearFlags = CameraClearFlags.SolidColor;
backgroundCam.backgroundColor = Color.black;
backgroundCam.cullingMask = 0;
}
}
Summary:
User Hex-Editor and search/replace f30f101dc8217c110f2fc30f87830000000f2fd8 => f30f101dc8217c110f2fc39090909090900f2fd8
Then set resolution with regedit "HKEY_CURRENT_USER\Software\Failbetter Games\Sunless Skies", "Screenmanager Resolution Width_h182942802", "Screenmanager Resolution Height_h2627697771"
--------------
Notes:
Search for "1.777778" or " * 100.0) / 100.0" or " * 0.5,0x3f800000,1.0 - " in Ghidra works
private void UpdateCamera()
{
if (!ResolutionManager.FixedAspectRatio || !cam) return;
float currentAspectRatio = (float)Screen.width / Screen.height;
// If the current aspect ratio is already approximately equal to the desired aspect ratio,
// use a full-screen Rect (in case it was set to something else previously)
if ((int)(currentAspectRatio * 100) / 100.0f == (int)(ResolutionManager.TargetAspectRatio * 100) / 100.0f)
{
cam.rect = new Rect(0.0f, 0.0f, 1.0f, 1.0f);
if (backgroundCam)
{
Destroy(backgroundCam.gameObject);
}
return;
}
// Pillarbox
//Patch here
/*if (currentAspectRatio > ResolutionManager.TargetAspectRatio)
{
float inset = 1.0f - ResolutionManager.TargetAspectRatio / currentAspectRatio;
cam.rect = new Rect(inset / 2, 0.0f, 1.0f - inset, 1.0f);
}
// Letterbox
else*/
{
float inset = 1.0f - currentAspectRatio / ResolutionManager.TargetAspectRatio;
cam.rect = new Rect(0.0f, inset / 2, 1.0f, 1.0f - inset);
}
if (!backgroundCam)
{
// Make a new camera behind the normal camera which displays black; otherwise the unused space is undefined
backgroundCam = new GameObject("BackgroundCam", typeof(Camera)).GetComponent<Camera>();
backgroundCam.depth = int.MinValue;
backgroundCam.clearFlags = CameraClearFlags.SolidColor;
backgroundCam.backgroundColor = Color.black;
backgroundCam.cullingMask = 0;
}
}