mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-05 20:45:43 +00:00
fix(game-env): full FEX x87 precision for PlayStation PC SDK games
This commit is contained in:
1 parent
b072cedd16
commit
ada91bf042
3 files changed
+56
No files matched your search
@@ -193,6 +193,14 @@ A Unity game under FEX (`UnityPlayer.dll` for Windows builds under Proton,
|
||||
turns it off: without TSO such games can deadlock or crash (seen with Megabonk
|
||||
and Crab Game). A FEX preset chosen for the game itself still applies.
|
||||
|
||||
A game that ships the PlayStation PC SDK runtime installer
|
||||
(`install_pspc_sdk_runtime.bat`, `PsPcSdkRuntimeInstaller.msi` or
|
||||
`PsPcSdkRuntimeManager.msi`, next to the executable, one folder below, or in an
|
||||
Unreal launcher's `<Project>/Binaries/Win64`) gets FEX's full x87 precision.
|
||||
The SDK's obfuscated x87 code depends on full precision; with reduced precision
|
||||
the game crashes or hangs at startup (FEX-Emu/FEX#4556, FEX-Emu/FEX#5988). A
|
||||
FEX preset or value chosen for the game itself still applies.
|
||||
|
||||
An Inno Setup installer added as a game runs with the Stability preset's FEX
|
||||
settings (full TSO, full x87 precision, no multiblock). Under the default
|
||||
Performance + TSO preset the 32-bit setup stub corrupts its own paths and stops
|
||||
|
||||
@@ -91,6 +91,7 @@ XBOX_BACK_COMPAT_ENV = dict(
|
||||
VKD3D_INTEROP_PRESENT="1",
|
||||
VKD3D_PACKED_422="1",
|
||||
)
|
||||
PSPC_SDK_FILES = {"install_pspc_sdk_runtime.bat", "pspcsdkruntimeinstaller.msi", "pspcsdkruntimemanager.msi"}
|
||||
# Setup loader offset-table IDs, as innoextract's known_setup_loader_versions lists them. Loaders
|
||||
# from 5.1.5 keep the table in a resource; older ones also put "Inno" at file offset 0x30.
|
||||
INNO_LOADER_IDS = (b"rDlPtS", b"nS5W7dT\x83\xaa\x1b\x0fj")
|
||||
@@ -173,6 +174,15 @@ def game_files(exe):
|
||||
return names
|
||||
|
||||
|
||||
def unreal_binary_files(exe):
|
||||
project = os.path.splitext(os.path.basename(exe))[0]
|
||||
try:
|
||||
with os.scandir(os.path.join(os.path.dirname(exe), project, "Binaries", "Win64")) as folder:
|
||||
return {entry.name.lower() for entry in folder}
|
||||
except OSError:
|
||||
return set()
|
||||
|
||||
|
||||
def xbox_identity(exe):
|
||||
"""The identity name in the MicrosoftGame.config of the Xbox package the executable is in, or ""."""
|
||||
folder = os.path.dirname(exe)
|
||||
@@ -305,6 +315,12 @@ def arkham_city_x87(game):
|
||||
return {"FEX_X87REDUCEDPRECISION": "0"}, [], "Batman: Arkham City: FEX with full x87 precision"
|
||||
|
||||
|
||||
@fix
|
||||
def playstation_pc_sdk_x87(game):
|
||||
if PSPC_SDK_FILES & (game.files | unreal_binary_files(game.exe)):
|
||||
return {"FEX_X87REDUCEDPRECISION": "0"}, [], "PlayStation PC SDK: FEX with full x87 precision"
|
||||
|
||||
|
||||
@fix
|
||||
def split_second_x87_fip(game):
|
||||
if game.app_id == "297860" or game.stem == "splitsecond":
|
||||
|
||||
@@ -1793,6 +1793,38 @@ class GameEnvironmentTest(unittest.TestCase):
|
||||
(asylum / name).touch()
|
||||
self.assertEqual(MODULE["engine_fixes"](str(asylum / "BmLauncher.exe"), []), ({}, [], []))
|
||||
|
||||
def test_playstation_pc_sdk_games_get_full_x87_precision_over_the_preset(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
unreal = Path(tmp) / "StellarBlade"
|
||||
binaries = unreal / "SB/Binaries/Win64"
|
||||
binaries.mkdir(parents=True)
|
||||
for name in ("SB-Win64-Shipping.exe", "PsPcSdkRuntimeInstaller.msi"):
|
||||
(binaries / name).touch()
|
||||
(unreal / "SB.exe").touch()
|
||||
for exe in (unreal / "SB.exe", binaries / "SB-Win64-Shipping.exe"):
|
||||
env, extra, notes = MODULE["engine_fixes"](str(exe), [])
|
||||
self.assertEqual((env, extra), ({"FEX_X87REDUCEDPRECISION": "0"}, []))
|
||||
self.assertIn("PlayStation PC SDK: FEX with full x87 precision", notes)
|
||||
config = {"version": 1, "shared": {"FEX_X87REDUCEDPRECISION": "1"}}
|
||||
self.assertEqual(MODULE["apply_config"]({}, config, "3489700", env)["FEX_X87REDUCEDPRECISION"], "0")
|
||||
config["games"] = {"3489700": {"FEX_X87REDUCEDPRECISION": "1"}}
|
||||
self.assertEqual(MODULE["apply_config"]({}, config, "3489700", env)["FEX_X87REDUCEDPRECISION"], "1")
|
||||
|
||||
port = Path(tmp) / "Port"
|
||||
port.mkdir()
|
||||
for name in ("Game.exe", "install_pspc_sdk_runtime.bat"):
|
||||
(port / name).touch()
|
||||
self.assertEqual(MODULE["engine_fixes"](str(port / "Game.exe"), [])[0], {"FEX_X87REDUCEDPRECISION": "0"})
|
||||
|
||||
other = Path(tmp) / "OtherUnreal"
|
||||
other_binaries = other / "Other/Binaries/Win64"
|
||||
other_binaries.mkdir(parents=True)
|
||||
(other_binaries / "Other-Win64-Shipping.exe").touch()
|
||||
(other / "Other.exe").touch()
|
||||
(other / "Other/Binaries/Win64/PsPcSdkRuntimeInstaller.txt").touch()
|
||||
for exe in (other / "Other.exe", other_binaries / "Other-Win64-Shipping.exe"):
|
||||
self.assertEqual(MODULE["engine_fixes"](str(exe), []), ({}, [], []))
|
||||
|
||||
def test_store_launcher_resolves_the_game_executable_from_the_sidecar(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
root = Path(tmp) / "BatmanArkhamCity"
|
||||
|
||||
Reference in new issue
Block a user