SilentPatchME icon indicating copy to clipboard operation
SilentPatchME copied to clipboard

Not an issue, just a suggestion for the next step

Open adolfintel opened this issue 3 years ago • 87 comments

First of all, congratulations on fixing this problem. I tried fixing this game a few years ago but I was only able to determine that the game was not using 3DNow at all and that the problem was some incorrect calculation. I loved your article, very well written, great fix.

The next logical step now would be... Mass Effect 2: determining what causes the crashes on Illium (when you walk under Liara's office and at the end of Kasumi's loyalty mission). The first one I think is just memory corruption caused by some incorrect handling of pointers, as it can be worked around by switching between fullscreen and borderless; the second one I haven't got a clue, but it might be somethng inside the bink playback code in the game, since it crashes when a bik file is supposed to play.

Again, congratulations on this massive achievement :heart:

adolfintel avatar Jul 20 '20 09:07 adolfintel

Silent doesn't really care much for the games... And besides, I believe those crashes are fairly "normal" matter/oversights (like when you turn some texture group size limits too high or low), not the rocket science he usually bang his head against.

mirh avatar Jul 20 '20 12:07 mirh

@mirh I see your point. Those crashes are almost 100% reproducible on all modern hardware though, especially the one under liara's office which is also mentioned on PCGW.

adolfintel avatar Jul 20 '20 13:07 adolfintel

I'm sure of it, but I don't really think that's a bug to be fixed in the executable. It's probably something in the 3D models or game scripts, that should be handles in ME2Recalibrated.. or whatever other mod actually fixing the game.

mirh avatar Jul 20 '20 14:07 mirh

Can you provide saves that repro this quickly?

riverar avatar Jul 20 '20 15:07 riverar

Here's a save on Illium under Liara's office: Cleaner_13_Vanguard_271216.zip
Go through the door in front of you, if you're in fullscreen, the game crashes before you can make it to the end of the corridor. This bug was introduced when The Lair of the Shadow Broker was released in 2010.

Here's another save at the end of Kasumi's loyalty mission: Jane_32_Soldato_221110.zip
This is a very old save but it can be used to trigger the bug, at least on my machine. You'll have to defeat the boss and reach the shuttle, when you do, the game crashes on some machines. I wasn't able to figure out exactly why, and it doesn't happen on specific hardware, some machines are just "cursed" and do it. If you launch the game with -nomoviestartup it won't crash so it must have something to do with bink. The crash is caused by a null pointer inside MassEffect2.exe. It might be trying to play a nonexistent file.

To use the saves, extract the 2 folders into My Documents\BioWare\Mass Effect 2\Save
Copy the entire folder, not just the .pcsav file inside it.

adolfintel avatar Jul 20 '20 16:07 adolfintel

It might be trying to play a nonexistent file.

If that's the case, then it should be pretty easy to spot files not found with procmon. Do you have a modded game (like for example with shorter videos?)?. I remember older versions of such mods were bugged with DLCs.

mirh avatar Jul 20 '20 19:07 mirh

I'm not using mods at all, just the game, fully patched and with all the DLC installed. You can replicate the problem on the origin version. When I tried to investigate this issue 4 years ago, I used a tool similar to strace to intercept system calls (I don't remember the exact name of the tool) and there were a lot of file not found errors, even during normal gameplay: missing packages, missing cutscenes, missing loading screens. I imagine they're leftovers from early versions of the game because the game plays normally.

adolfintel avatar Jul 20 '20 19:07 adolfintel

From what I can tell this only happens to users in full screen mode.

The engine will look in multiple locations to find files, it not finding them at the first location is normal.

Mgamerz avatar Jul 21 '20 02:07 Mgamerz

@adolfintel Do you have a workaround for the "Unable to authorize the listed DLC"? I used an option in Mass Effect 1 to bypass this, does one exist for Mass Effect 2?

riverar avatar Jul 21 '20 04:07 riverar

@adolfintel Do you have a workaround for the "Unable to authorize the listed DLC"? I used an option in Mass Effect 1 to bypass this, does one exist for Mass Effect 2?

I have it but I don't know if it's a good idea to post it here since it's technically a crack. Do you need it?

adolfintel avatar Jul 21 '20 04:07 adolfintel

@adolfintel No worries, got the DLC unlocker!

riverar avatar Jul 21 '20 05:07 riverar

@adolfintel Can't reproduce the crashes sadly. :(

riverar avatar Jul 21 '20 05:07 riverar

That's good to know. What resolution are you playing at? Did you try fullscreen and borderless modes? The issue has been known for years and I've always been able to replicate it: https://www.pcgamingwiki.com/wiki/Mass_Effect_2#Game_freeze_on_Illium

adolfintel avatar Jul 21 '20 05:07 adolfintel

Still can't reproduce this, any other ideas? Tried windowed, fullscreen windowed, fullscreen, various resolutions. I'm using the latest Steam version of the executable, with ME2 DLC Unlocker.exe applied to make life easier. (This makes the file version 1.2.1604.0.)

SHA-256 of MassEffect2.exe: C78DB175B4296E403561AEC336BAA02E32E3677C3A374A795FD39C0FD4A85090

Example of one tested configuration image

riverar avatar Nov 08 '20 04:11 riverar

Some questions:

  • Do you have any gamepad or other input devices plugged in? Joysticks? Controllers?
  • Any mods installed? Trainers in use? NOCDs?
  • What's the full name of the default/primary audio device? (i.e. where do you hear game audio from?)
  • What version of binkw32.dll do you have in the Binaries folder?

riverar avatar Nov 08 '20 05:11 riverar

Some questions:

* Do you have any gamepad or other input devices plugged in? Joysticks? Controllers?

Nope, just mouse and keyboard

* Any mods installed? Trainers in use? NOCDs?

No mods, I'm using a cracked exe with the binkw32.dll that unlock all the DLC. I was also able to replicate the issue with the origin version so the crack is not to blame.

* What's the full name of the default/primary audio device? (i.e. where do you hear game audio from?)

Nothing special, Realtek HD Audio. The device is set to its default 44100Hz 16bit stereo configuration. NVIDIA HDMI Audio is also installed but not in use.

* What version of `binkw32.dll` do you have in the Binaries folder?

https://github.com/Erik-JS/masseffect-binkw32

I know the kasumi crash is kinda rare but the crash on Illium can be replicated on all of my machines.

adolfintel avatar Nov 08 '20 06:11 adolfintel

@riverar By the way, I have some experience with tools like IDA pro. I wasn't able to find out anything useful by myself but you clearly know more about it than I do, so if you give me a few pointers I might be able to investigate it further

adolfintel avatar Nov 08 '20 06:11 adolfintel

I have no insight to share on this issue, ha! At this point, I'm just trying to reproduce the issue so we have somewhere to start.

Can you perform the following steps and reproduce the crash? We'll at least have a stack to look at.

  1. Open Regedit, navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps (create the LocalDumps key if needed).
  2. Create a REG_DWORD value named DumpType and set its data to 2.
  3. Reproduce the crash.
  4. Find the MassEffect2.exe.dmp in %LOCALAPPDATA%\CrashDumps, zip it up and upload it to OneDrive/send me a copy ([email protected]). (It may contain PII, so do not recommend attaching it here.)
  5. Repeat step 1 above then delete DumpType to clean up.

riverar avatar Nov 08 '20 08:11 riverar

Ok, I'll get back to you in a day or two with all the info I can find.

By the way, can you make a pastebin with the hashes of all the files in your ME2 installation? Especially those regarding the Kasumi DLC

adolfintel avatar Nov 08 '20 08:11 adolfintel

@adolfintel Per request report.zip

riverar avatar Nov 10 '20 00:11 riverar

@riverar Thank you. Did you get my email with the dumps?

adolfintel avatar Nov 10 '20 05:11 adolfintel

@adolfintel oops just dug it out of my junk folder, let's take a peek!

riverar avatar Nov 10 '20 05:11 riverar

@adolfintel Thanks, sent you a few emails back. Just a heads up, in case those end in the junk mail folder.

riverar avatar Nov 10 '20 06:11 riverar

I got them, running the tests now. I can tell you right away that RTSS was not the problem and OBS was not running

adolfintel avatar Nov 10 '20 06:11 adolfintel

@riverar Check your email :)

adolfintel avatar Nov 10 '20 07:11 adolfintel

@riverar I sent you another email with a full dump of a kasumi crash, hope that helps

adolfintel avatar Nov 11 '20 11:11 adolfintel

So, I'm 90% sure that the kasumi crash is caused by some Windows update that came out between 2014 and 2016.

I have some old hardware and software here so I decided to try various combinations:

  • Windows 10 LTSC 1809 + Modern hardware (6700k+GTX1080): crash occurs
  • Windows 10 LTSC 1809 + Old hardware (Q6600+HD6970): crash occurs
  • Windows 7, fully updated + Modern hardware: crash occurs
  • Windows 7, fully updated + Old hardware: crash occurs
  • Windows 7, SP1 only (2011) + Modern hardware: no crash but driver issues, not recommended
  • Windows 7, SP1 only (2011) + Old hardware: no crash
  • Windows 8.1 Update 1 (2014), no updates + Modern hardware: no crash

Personally, I recall playing the game without issues in 2014, but having the crash in 2016, and this matches what I'm seeing here.

Thoughts?

adolfintel avatar Nov 15 '20 09:11 adolfintel

@riverar Don't get your hopes up, but I think I fixed the kasumi crash!

I'm sending you an email with a modified exe and more info, but here's what I found out: The kasumi crash is caused by a null pointer being dereferenced. There is a piece of code that does something like this:

struct stuff=myFunction();
if(stuff.a==NULL) return; else{code...}
if(stuff.b==NULL) return; else{more code...}
...

The thing is: it never checks if stuff is NULL in the first place. So, I modified it so that after getting the value of stuff, it would jump to a small piece of code that I put in one of the empty areas in the exe where it checks if it's NULL, and if it is it returns from the function, otherwise it runs the original code

The crash seems to have been fixed, and while I haven't played through the entire game yet, it doesn't seem to cause problems so far.

Now obviously I can't post a cracked exe on github, even if it's just a fix, so with your help, I'd like to make something like SilentPatch that injects the modified code. Can you do that?

adolfintel avatar Nov 15 '20 11:11 adolfintel

There are really countless of reports before 2014, so I'm afraid it's not Windows (also, I don't think 2011 drivers should have problems with a 2010 game?).

Also.. Maybe the issue isn't that the NULL pointer has no checks, but rather that sometimes it ends up being NULL? Anyway, I don't think silent's interested in any further ME'ing, especially if we are talking about something this "mundane".

But I'm sure @Mgamerz will have some ideas (hex editing seems a no-go on origin stupidly obfuscated exe, but maybe the binkw32 loader could come to the rescue)

mirh avatar Nov 15 '20 12:11 mirh

@mirh True, reports of it exist as back as 2010, but as I remember, it was a rare issue, now all of my machines are affected, which is what made me think of a windows update.

Anyway, I'm starting a playthrough with my modified exe to see if it's stable or not. Would you like to try it?

adolfintel avatar Nov 15 '20 12:11 adolfintel