Comments (5)
I'll look into this. But I'm afraid I don't have time until next week at least.
Here's my initial guesses:
- Something is wrong with ACB reader in libcgss; not sure about the HCA part.
- Out-of-range error usually means invalid state during decoding (e.g. given wrong decryption keys). DereTore has strict index range check (obviously) but libcgss does not. In other words, in common cases you can access OOR block data as long as it is in process memory, but you'll never know. And if those data happens to store next to each other, an output with inaudible errors might be generated. In a "normal" decoding process, value lookup should not trigger OOR access. So maybe the input(s), or some code somewhere caused it. I assume the latter one. It is hard to debug though.
from libcgss.
During the first tests I found that this bug is like a ghost. The debug target is apparently acb2wavs
. When I use Cygwin toolchain, and execute inside the IDE, it returns code 127
running in "Run" mode and 0
in "Debug" mode. In either situation, both ACBs are correctly decoded. But if I copy the executable to somewhere else and run with the same arguments, it crashes when decoding the 2nd (i.e. index 1) waveform in vo_708_000_004
. However it can still decode vo_900841090
. When I use other toolchains, it acts the same with the second case, crashes on vo_708_000_004
and succeeds on vo_900841090
. The return code is 0xC0000005
(access violation).
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 this[1]
. Rewriting all methods into static solves this issue (67cb7c4). But I'm not clear why it happens, because this[1]
is a valid syntax and the result should point to the next object (type CHcaChannel
). Notice that CHcaChannel
does not have virtual functions so the pointer should have moved like visiting a struct. But the pointer moved more than it should.
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.
from libcgss.
I found the cause of the exception in DereTore. When decoding vo_708_000_004
, just after the last AddBits
operation of CHcaData
(or DataBits
, in DereTore) makes the object enter an invalid state. More precisely, this line, where the data
contains 204 bytes and it tries to access the 205th (i.e. index=204) byte.
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.
from libcgss.
Can you also test in your environment and confirm the issue solved?
from libcgss.
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.
from libcgss.
Related Issues (9)
- [hcacc] Fails to change crypto type for hca files that loop HOT 2
- Not all HCA files are exported from ACB HOT 10
- Compatibility issue when one Cue has multiple sub wav files HOT 1
- Feature: Add prefix to Cue name HOT 6
- ACB Ver.1.40.00 support
- Decrypt errors for latest ADX2 SDK ver (v2.98) HOT 37
- acb2wavs doesn't support looping? HOT 13
- Error with reading Dragalia acb file HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libcgss.