openswe1r
openswe1r copied to clipboard
Video settings are not saved
When quitting after changing video settings; then restarting the game, the previous video settings are not restored. Instead, they are returned to the initial state they were before making any changes.
This probably happens because of crashes while exiting the game:
Unknown function!
Stack at 0xC07FFE78; returning EAX: 0x0DDE1000
463142 Emulation at 484A17 ('IA3dListener__2') from 484A17
openswe1r: /home/fox/Data/Projects/OpenSWE1R/main.c:3682: UnknownImport: Assertion `false' failed.
The video config might not have been written at this point.
IA3dListener__2
is IA3dListener::Release
, and IA3d4__2
is IA3d4::Release
. I think it may use the stub to avoid the assert(false)
.
diff --git a/com/a3d.c b/com/a3d.c
index 5cdf154..375581e 100644
--- a/com/a3d.c
+++ b/com/a3d.c
@@ -232,6 +232,13 @@ HACKY_COM_BEGIN(IA3d4, 0)
esp += 3 * 4;
HACKY_COM_END()
+// IA3d4 -> STDMETHOD_(ULONG,Release) (THIS) PURE; //2
+HACKY_COM_BEGIN(IA3d4, 2)
+ hacky_printf("p 0x%" PRIX32 "\n", stack[1]);
+ eax = 0; // FIXME: No idea what this expects to return..
+ esp += 1 * 4;
+HACKY_COM_END()
+
// IA3d4 -> STDMETHOD(GetHardwareCaps) (THIS_ LPA3DCAPS_HARDWARE) PURE; // 11
HACKY_COM_BEGIN(IA3d4, 11)
hacky_printf("GetHardwareCaps\n");
@@ -666,6 +673,13 @@ HACKY_COM_END()
+// IA3dListener -> STDMETHOD_(ULONG,Release) (THIS) PURE; //2
+HACKY_COM_BEGIN(IA3dListener, 2)
+ hacky_printf("p 0x%" PRIX32 "\n", stack[1]);
+ eax = 0; // FIXME: No idea what this expects to return..
+ esp += 1 * 4;
+HACKY_COM_END()
+
// IA3dListener -> STDMETHOD(SetPosition3f) (THIS_ A3DVAL, A3DVAL, A3DVAL) PURE; // 3
HACKY_COM_BEGIN(IA3dListener, 3)
hacky_printf("SetPosition3f\n");
If you want to submit changes, please send a PR. For something minor like this I'll probably just hit merge. Review of existing PRs by other people is also welcome.
Note that there's also a WIP branch which includes this fix: https://github.com/JayFoxRox/openswe1r/pull/16 However, I don't have time or motivation for coding, reviewing or testing larger changes for OpenSWE1R right now.