VOGONS


First post, by Nicknine

User metadata
Rank Newbie
Rank
Newbie

I've been looking into Spider-Man game based on 2002 movie and its issues. Now, most people who played this game are likely aware of the issue with black screen softlock that happens in most training levels and some of the story levels. This bug has been fixed in 1.3 patch (attached) but there's a question that has been bothering me: what exactly causes this issue?

This black screen not just a graphical issue, the game breaks entirely - you can't move, sounds from every object in the level play at maximum volume, health bars for bosses that are supposed to be encountered at the end of the level appear immediately, in some levels you just die instantly and even without black screen some enemies fail to spawn properly. I've dealt with plenty of old games on newer hardware and I've never heard of compatibility issues causing weird shit like that.

Did anyone try investigating this bug? The official patch notes state that it occurs on "newer Pentium 4 processors", it presumably first manifested itself somewhere in 2003, shortly before 1.3 patch came out, but what is it about newer P4s that could break this game? At first I thought there was some race condition but looking at the game in IDA has shown that it doesn't use multi-threading outside of Bink FMV playback. Then I thought there might have been a change in extended instruction sets but this game doesn't use any x86 extensions outside of Direct3D rendering pipeline which must have been statically linked from DirectX SDK. It sounds like a floating point calculations issue, maybe a bunch of values like entity coordinates get set to NaN which would explain why you can't move and why you hear sounds from all level entities at once. But that doesn't get me any closer to the root cause so I'm at a loss here.

Out of curiosity, I tried using tools like MoSlo and those didn't fix the issue. Another person has also tried reducing FSB speed on an Intel Core 2 Duo CPU and that also didn't fix it even with clock speed reduced to the point of causing heavy framerate drops in-game. Makes me wonder if it really has anything to do with CPU performance or if it's caused by something else entirely.

Reply 1 of 3, by BEEN_Nath_58

User metadata
Rank l33t
Rank
l33t

I did some initial research and it seems like the game, with the previous version, doesn't want to do anything to display on the screen, if I interpret it right.
The old game doesn't support all Device Formats as well

In the old game, the game receives a CheckDeviceFormat and when it succeeds, it goes for a GetDirect3D. On the newer game, the game does a QueryInterface followed by a CopyRect on the screen. I only see a different method to achieve a thing, and whether the former is problematic isn't something I know

Not sure if they are the correct points to look into. If Direct3D is really the issue, and what I said isn't one, Dege could know better.

previously known as Discrete_BOB_058

Reply 2 of 3, by Nicknine

User metadata
Rank Newbie
Rank
Newbie

This isn't a graphical issue as I described in detail in the OP.

Reply 3 of 3, by Nicknine

User metadata
Rank Newbie
Rank
Newbie

Figured this out, it's floating point shenanigans just as I thought, specifically a divide by zero issue. The game uses timeGetTime function to keep track of time which returns time in integer milliseconds. The problem is that somewhere during the loading time, the game divides a value by delta time which can be zero on faster CPUs - so you get division by zero resulting in some entities (including the player) spawning at NaN coordinates.

Capping the game's FPS through conventional means doesn't solve this bug but it can be fixed by adding a delay to the main loop in WinMain (which is what the developers' fix in 1.3 does). If you have 1.0 exe, go to 0x42F19F in hex editor and replace 8A 82 84 01 00 00 84 C0 75 53 with 6A 05 E8 D4 74 00 00 90 90 90 (this adds Sleep(5) call).