-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Removed duplicate field in CShotgun save data table. #233
Removed duplicate field in CShotgun save data table. #233
Conversation
Won't it break save files? |
It would probably break existing saves, but loading and resaving the game should fix it. |
Better not break save files for no reason. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be compatible with original unmodified Half-Life DLL saves.
I have a proposal. |
I've been thinking a lot on this lately. On games that old as Half-Life, some of the bugs are became features. Like it happened with Quake's unintended bunnyhop, Half-Life has I see the same problem with keeping compatibility, though it's much easier to decide. If it doesn't load, then it's broken. In my opinion, such changes can be maintained in same branch and toggled with one macro. For those who want to develop a mod and don't care and those who want their save files back. Like the ReHLDS team does with REHLDS_FIXES macro. |
I did several tests by outputting the majority of restored fields to a text file - See the attached files below. reference.txt
Note: The following tests were made using this SDK, which is identical to ValveSoftware/halflife but has been modified to compile under newer versions of VS. Note: Test 1: Remove 2nd field Result:
Test 2: Remove 1st field Result:
Test 3: Remove all Result:
Test 4: Declare int m_fInReload;
int m_iShell;
float m_flNextReload; // Declared after m_iShell Result:
Test 5: Remove member variable int m_fInReload;
// float m_flNextReload;
int m_iShell; Result:
Test 6: Swap position of float m_flTimeWeaponIdle; // m_flNextPrimaryAttack was originally here.
float m_flNextSecondaryAttack;
float m_flNextPrimaryAttack; // m_flTimeWeaponIdle was originally here. Result:
In this case all fields are correctly restored, even after removing variables and changing offset. Note: these results are only for |
Below are additional details on Save/Restore analysis. In the CRestore::ReadField, it compares the field name defined in the DLL save data table against the one from the saved file (without case sensitivity). then sets the following pointers to output and input:
Since it looks for the field name, this allows the code to correctly apply the input value relative to So far of my understanding, the following changes would break compatibility with older saves:
|
Nice research. To my understanding even the resaved save (with the proposed change) should stay compatible with original, so it's compatible on both ends. |
See ValveSoftware/halflife#3206.