ValveSoftware / halflife

Half-Life 1 engine based games
Other
3.67k stars 619 forks source link

DMC & Ricochet - Memory access violation in Debug & mouse issues in Release #1622

Open JoelTroch opened 9 years ago

JoelTroch commented 9 years ago

Deathmatch Classic and Ricochet's source codes have problems.

This is what I have done :

  1. Cloned the master branch of this repository.
  2. Opened projects.sln in Visual Studio 2010.
  3. Built the solution (no errors but warnings).
  4. Disabled in DMC, HL & Ricochet's projects the warnings C4018 ('<' signed/unsigned mismatch), C4258 ('X' : definition from the for loop is ignored; the definition from the enclosing scope is used) and C4996 ('_X': This function or variable may be unsafe. Consider using '_X_s' instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.).
  5. Cleaned the solution.
  6. Built the solution again (no errors & no warnings).
  7. Copied and pasted both dmc and ricochet game folders in my Half-Life folder.
  8. Renamed my copied "dmc" as dmcmod and my copied ricochet as ricochetmod.
  9. Tweaked the game key of liblist.gam of dmcmod & ricochetmod, Steam now shows me Deathmatch Classic (Mod source code) & Ricochet (Mod source code).
  10. Placed the compiled DLLs in their appropriate folders (dmc.dll into dmcmod\dlls, mp.dll into ricochetmod\dlls, etc...)
  11. Started the mod through Steam.
  12. "Create Server" --> "Start game"

And here are the results : DMC & Ricochet Debug : crash at "Starting local game server...", WinDBG tells me there is a memory access violation at line 1509 in dlls/sound.cpp (if ( pMemFile[i] == '\n' )) DMC & Ricochet Release : working but has issue #1546 except that it also happens when m_rawinput is 0

dtugend commented 9 years ago

I cannot comment on the crash atm, since I did not look enough into that yet.

Regarding the mouse issues: DMC & Ricochet client DLLs don't support the m_rawinput cvar, the input is always raw, as you can see in their inputw32.cpp. The bug with the mouse being trapped in the window rectangle has been fixed in pull request #1559 which has not been accepted so far though.

dtugend commented 9 years ago

Hello.

Apparently the crash is a mistake in the code that has been fixed for Half-Life but not for DMC and Ricochet: filePos is not initialized to 0 for DMC and Ricochet, while it is for Half-Life.

Question is if you want to make a pull request fixing it or if I should? I really don't care who does, if you have fun fixing it, then go for it.

However this re-raises a serious question that I already raised in issue #1557 - Is the code for DMC and ricochet really the code they used for their Steam builds, or did they check a wrong (old) version into github????!!!!

JoelTroch commented 9 years ago

Since you found the fix, I let you the honor to make the PR ^_^

I asked WinMerge to compare DMC 2.3 and DMC GitHub source codes, the report is there

However, the only differences I've found out so far are:

dtugend commented 9 years ago

Ok, thank you, done :-)