-
Notifications
You must be signed in to change notification settings - Fork 8
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
Failed decryption and inconsistencies between libcgss and DereTore #7
Comments
I'll look into this. But I'm afraid I don't have time until next week at least. Here's my initial guesses:
|
During the first tests I found that this bug is like a ghost. The debug target is apparently I doubted if the decipher function was only a partial one so I checked the intermediate states against AtomViewer. Everything is the same. I also thought about if this raised some unfound bugs inside any of the runtimes. Also, Cygwin 2.x and 3.0 seems to yield the same result. At last by debugging on Visual C++ it turned out to be incorrect addressing of About DereTore I'll look into it later. It uses bounded array + index so that's stricter constraint, which may not be 100% compatible with the C/C++ version. |
I found the cause of the exception in DereTore. When decoding Usually these accesses do not go out of range. I guess that's why the original code does not check the index. But in a rare case it does go into the illegal zone. In C/C++, this is direct memory access and in most of the cases the address to access is still inside the allocated zone of the process address space. Then this problem is hindered because accessing that address does not throw illegal memory access error, and a decoding error in the last byte of the wave data is not usually audible. However in C# array access is strictly checked and then this problem is revealed. To solve this problem I commited 0494231 in this repo and OpenCGSS/DereTore@e104bc6 in DereTore. They are not published as releases yet but you can download them through CI autobuilds. In DereTore I also changed the decoding process using pointers in C#. It should then be more similar to the C/C++ version in memory layout; but the drawback is access errors is harder to detect. |
Can you also test in your environment and confirm the issue solved? |
I tested both libcgss and DereTore, both are capable of extracting all the files I was working with. I don't think there are any garbage output errors but I only checked a few. I had to build them both (Windows10/VS2017); the libcgss release still produced occasional errors (apparently the commits from this morning fixed something). Issue seems to be resolved. |
I've been using this library and DereTore for extracting sound files from Shadowverse (another Cygames project which also uses the key
00003657 F27E3B22
). I was updating my scripts for the new CriWare setup, but I had some errors with file decryption. Most files work fine either way, but I found some files which error on one or the other method.I was able to decrypt this with DereTore but libcgss picks up the wrong number of internal wav files and outputs garbage: (there are four wav files and they sound something like a sick elephant)
vo_900841090.zip
I was able to decrypt this with libcgss but DereTore outputs an index access error: (there is one wav file with someone saying "Good work")
vo_708_000_004.zip
The text was updated successfully, but these errors were encountered: