Add support for 2011 Portal 2 #315
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Apologies for the essay...
Minimum effort changes to make things work on the April 27th, 2011 build of the game. LP hud is broken (I'm guessing the field for the Portal count was added with the CM update?), the way I disabled the ""broken"" aspect of it (ie constant console spam due to the missing field) is probably not ideal but I didn't feel like putting further thought into it lol. TAS tools won't work due to SteamControllerMove not existing at all, there's also a crash around line 384 or so of TasPlayer.cpp when trying to play a TAS that I didn't care enough to figure out. SAR's strategy for injecting data into demos won't work either, as this version of the game doesn't save the radial menu cursor position to the demo.
restart_levelandselect_mapdon't exist on this version of the game which is probably relevant for a few SAR/srconfigs features.Otherwise, I was able to play a full AMC run with bill, record/play demos, render a demo, and do other things without any obvious issues. The minor angle decay patch even worked once I fixed the ApplyMouse offset, so clearly we are gaming Kappa
I cannot verify the integrity of the game is fully intact (when it comes to potentially incorrect vtable offsets or the like causing wrong functions to be hooked), but I will leave that to someone more familiar with the codebase/features to look into. I left my notes for what I checked/went through in the offsets file so whoever works on this (presumably AMJ) won't have to look through stuff I already did.
The following is mostly repeating what I already said or alluded to in p2sr, but just putting this here for anyone in the future who may have questions about the particular game version choice or Portal 2 versions of this era in general:
It's possible a later (early) version of the game may be more optimal or ideal to use with regards to stability or features (though when it comes to random crashes, this seems night and day compared to the day 1 build of the game, as I haven't experienced any crashes outside of stuff caused by SAR).
For example, the May 6th 2011 update apparently fixes a rare crash when painting hard light bridges (as well as some other potentially beneficial fixes), the May 12th update removes the devonly flag from
cl_fov(obviously SAR could just do that, and ofcsar_force_fovexists regardless), May 20th update fixes the crosshair not drawing on "extra wide" resolutions, May 26th update fixes a "rare case where the final section could not be completed" (?? monkaS), as well as an "invalid memory read in the paint shader".However, despite having all of the Steam2-era game files available, the versions that are actually playable is limited, as Portal 2's client and server dlls were protected by CEG until 2014 or so, so we can only play versions that had CEG cracked/bypassed on the respective dll's (and the downloads for those need to have survived online to the current year, ofc). You also can't just crack the dlls as they are from the depot, as the dlls downloaded from Steam are incomplete, so when you launched the game back in the day for the first time (or after a game update), the missing 4kb or so of machine code was streamed/added back into the relevant files, along with the "personalization" (so that those dlls only worked on your computer and nobody else's).
Therefore, if someone wants to play the earliest builds with Challenge Mode/course 6 for shits and giggles, they should look for Portal 2 depot 624 v17/v18/v19 cracks (Oct 6th, 7th, and 21st 2011 updates). With that being said, the only other versions newer than this build that can be played at this time are the May 6th and September 27th builds (apparently the May 10th and 25th dlls were also recovered, but they weren't verified by someone else yet, and I'm too lazy to do that myself, so, shrug). A handful of other versions between release and the CM/course 6 update had complete/personalized (but uncracked) dlls recovered, but I doubt anyone will want to go through the effort of cracking those. (Technically, if you have an Intel Mac that is still on whatever update that supports 32-bit software, you can play any of these game versions, since CEG was only a thing for Windows).
The only reason I did stuff with this particular version is because it's what I randomly decided to extract and mess with on my computer back in September when I first got access to the files. At this point, I don't feel like trying one of the later (potentially better) versions and getting instant depression when an offset breaks. If it turns out this game version sucks badly for whatever reason, then I can look into a different game version later on.
Anyways, this was a fun way to spend like 5 entire afternoons/evenings after work.