Rami-Sabbagh / TEC-Redshift-Disk-Specification

A specification of the TEC Redshift exported images format in the EXAPUNKS game by Zachtronics.
https://rami-sabbagh.github.io/TEC-Redshift-Disk-Specification/
GNU General Public License v3.0
5 stars 1 forks source link

Potential error in Integer type declaration #2

Closed Lilly7084 closed 4 years ago

Lilly7084 commented 4 years ago

There are 2 things stated by this document which are important for this issue:

  1. Integers are stored as 4 bytes, little endian
  2. The raw data begins with an integer, stating the size of the compressed game data in bytes

However, for the 2 example disks I have decoded (HEX files are both 16KB), there is an issue:

  1. Space-Type Fighter (by Zachtronics): Size is 0xEF401800 (4.0GB, impossible)
  2. TenTen EMBER-2 (Steam Workshop): Size is 0x06405000 (6.4MB, impossible)

It is possible that this format uses 16-bit integers, rather than 32-bit. 32 bits is unnecessary for the data size, since the entire HEX file, including garbage data, is 16KB. 32 bits is unnecessary for the checksum, since the Microdisk uses a Fletcher-16 checksum.

Rami-Sabbagh commented 4 years ago

Heyy, It's been about a year since I made this, and I no longer remember the technical details of the document. If there's anyone who can confirm the issue with you, and do a pull request to fix it, I would merge it.

Or you can just fork it that's fine.

Thanks for your time submitting the issue!

Lilly7084 commented 4 years ago

The plot thickens: A disk I exported myself from the game appears perfectly intact with 32-bit integers. (REDSHIFT OS)

Let's show the first 8 bytes of each extracted file, to make this a bit less confusing, since I'm really bad at explaining stuff: Space-Type Avoider (Zachtronics): ef be a6 04 00 00 ef be -> 32-bit integers would mean a size of 78,036,719 bytes. ROM size, including garbage data, is only 70,085 bytes. TenTen Image Example (Workshop): ef bf 8a 04 00 00 ef be -> 32-bit integers would mean a size of 76,201,967 bytes. ROM size, including garbage data, is only 70,853 bytes. Redshift OS (My own creation): 53 02 00 00 1c 2a 00 00 -> 32-bit integers would mean a size of 595 bytes. ROM size, including garbage data, is only 70,775 bytes.

I feel like I may have improperly extracted the data from the first 2 disks, gonna try running my extractor script (written in Processing 3, for easier image processing code) again.

Lilly7084 commented 4 years ago

UPDATE: The issue wasn't caused by an error in the documentation, I just had a few bugs in my extractor script. My first clue should have been the different sized dump files. I decided that rather than fixing them I would rebuild the entire script in Eclipse instead of Processing. I lost the image demo disk, but found 4 more (except one didn't download right):

HIGHER OR LOWER - ba 05 00 00 fc a2 00 00 - 1,466 bytes INTO THE DUNGEON - Error occurred while downloading disk image. RACECAR - b2 02 00 00 ea 5d 00 00 - 690 bytes SPACE TYPE DESTROYER - 41 0f 00 00 30 96 00 00 - 3,905 bytes SPACE INVADERS - 26 05 00 00 ad 79 00 00 - 1,318 bytes REDSHIFT OS - 53 02 00 00 1c 2a 00 00 - 595 bytes