Jul 8, 2010 at 7:22 AM
Join Date: May 28, 2008
Location: PMMM MMO
Posts: 3713
Age: 32
carrotlord said:The TSC research is starting to get interesting. It turns out that each TSC file is encoded with a special character within the file itself. The character is always located in the middle of the TSC file. That also means, if you change the filesize of the TSC file, you change the way it's encoded.
For example, in the exact middle of the ArmsItem.tsc file, there is a (space) character. Now, the ascii code for the (space) character is 0x20. In the actual encoded TSC file, the 0x20 character in the middle gets replaced with 0x00. All the other characters, including the other space characters, get +0x20 added to their hex codes.
Now, it was a stroke of luck that cultr1 happened to pick ArmsItems.tsc. The method for converting an uppercase letter into a lowercase letter is to add 0x20 to the ascii code of that letter. That caused <FRE, <WAI to turn into fre, wai, so that you could see the TSC commands. For most of the other TSC files, all you would see is a jumble of total nonsense unicode.
So, now I need to get working on a deciphering routine. I believe it's still possible to finish the Mac TSC editor, though it might take a bit longer.
Ohhh I noticed something like this too, when I opened a TSC file on the PC with a hex editor. I noticed since there were a lot of repeated values (always a constant) that were repeated, and they seem to coincide with the decoded script where the "0's" were (since in TSC, you use a lot of 0's for various commands). I think I noticed it when I randomly opened the tetris script I made, since THAT has a lot of zeros in it. (It's really a cheap way to encode the file)
One other small thing: If the file size is that of a odd number of bits (like 6A9), then what you have to do to find the decoder bit is divide it by 2 and then round up (or add one) (ex. for 6A9, it would be 355).