-
Notifications
You must be signed in to change notification settings - Fork 9
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
Fix decrypt compatibility with .NET6 and above #24
Conversation
have you made sure this works in game after decrypting and re-encrypting the file? do you mind attaching a sample savegame for which this issue arises? the reason I'm suspicious about this is because the code you're modifying is literally copied from the game's code after decompiling. So if this code really is buggy, the game itself should have trouble parsing the file as well |
Another thing that may have happened is that some recent patch modified this code and introduced the possibility of non 16 bytes aligned savegames. Assuming you have a recently patched Overcooked 2 installation, do you mind opening the executable with ILSpy and checking if the |
Unfortunately I cannot attach the random file types. So I've attached the json file, which you can manually encrypt and decrypt and see if the content says the same. This issue might an artifact of switching to .NET 8.0 runtime. |
Thanks; is this JSON file the output you got when decrypting with or without this patch? I don't see any extra bytes at the end as you described in the issue |
That's the correct file. If you encrypt it and then immediately decrypt it using the old tool, do you get the same file size? |
It seems .NET6+ change in behavior: dotnet/core#6895 |
I don't have the game installed; can you check what they did on their code? Was the game even upgraded to .NET >= 6 or is it on some older version that doesn't have this change? |
As .NET3 is obsolete I've been using OvercookedTool with .NET8 and run into that problem. My change should be compatible with .NET3 framework as well, but I do not have it to verify. |
I understand, but I'm afraid of diverging much from the original code as this is decompiled code. Can you make this change as small as possible (e.g. just add a second |
.NET 6 changed `System.Security.Cryptography.CryptoStream.Read()` such that it may produce short reads (i.e. read less than the requested number of bytes) before the end of the stream is reached. This is documented in [Partial and zero-byte reads in DeflateStream, GZipStream, and CryptoStream][partial-reads]. To support .NET 6 and later versions, call .Read() repeatedly, until the expected number of bytes has been read or end-of-stream has been reached. [partial-reads]: https://learn.microsoft.com/dotnet/core/compatibility/core-libraries/6.0/partial-byte-reads-in-streams Fixes: hadeutscher#23 Signed-off-by: Kevin Locke <kevin@kevinlocke.name> Based-on: hadeutscher#24 Based-on-patch-by: Sergej Salnikov <sergejkiller@gmail.com>
Superseded by #27 |
No description provided.