Theater*.wch file data limitation
-
A few years ago I found an issue with the Theater*.wch file(not the Strings.wch, it is fine).
There is a data limit on it, which if exceeded will cause Falcon to CTD. I was hoping with the release of BMS that possibly it had been resolved, but it’s still restricted in the BMS code.
I’ve spoke to Sakis(Monster) and Yoni(I-Hawk) and they both have spotted it in the code and both agree on a resolution to overcome the limitation.
As you can see:
_"The string index is stored as a signed short integer (2 bytes). That means the value range is -32,767 to 32,767. Since negative values have no meaning to size, the effective range is 0 to 32,767. That means the wch file max size should be 32,767 bytes (or 32KB - 1 byte).
This I’m afraid, can only be fixed with a code edit. Here is a suggested fix by me if you want to talk to a developer:
The error occurs at the CampLib –> Name.cpp file at the LoadNameStream function.
The specific line is:
NameStream = new _TCHAR [NameIndex[NameEntries-1]];
NameIndex is a pointer to signed short and the last values in that “array” (for a “big” wch file) exceed the signed short range, so they become negative.
NameIndex should be declared as unsigned short (it would be better to be long but that means we need to change the idx format), so it can hold values up to 65535. Now, I can’t be sure where else in code that might interfere, especially in BMS, since I don’t have the code…"
And:
"Hey,
Yes I can see indeed that they used short integer as an index… so short is a 16 bit type so it can never be more than 32,768 (Because it’s a signed int, although used to save a length, so they should have used unsigned which would have at least doubled size, but this is old code)
Anyway, I assume changing the type from short to unsigned short and maybe even to unsigned int, will give you a huge size which should never run out."_
Thank You for your attention and look forward to a possible resolution,
C9
-
Thanx for report!
(And I also said that they are Idiots :mrgreen:)
-
Thanx for report!
(And I also said that they are Idiots :mrgreen:)
HAHA, I edited that, didn’t want anyone to get their feelings hurt!!!
Here ya go: “but this is old code –> IDIOTS)” :lol:
Cheers,
C9
-
Done, size doubled.
Check next release (In about 3-4 weeks :mrgreen:)
If in the future it won’t be enough, then we will need to change to unsigned int instead, but that will require some more investigation time.
-
Thank You very much Yoni and BMS team!!
And a Thank you to Monster for his GREAT assistance in the matter.
Cheers,
C9