Fixed the author / game name handling. Now all that should be left is the actual input for SMV143.

This commit is contained in:
brandman211 2012-09-14 17:36:49 +00:00
parent 1697e77042
commit 17567b4952
1 changed files with 13 additions and 7 deletions

View File

@ -1636,13 +1636,19 @@ namespace BizHawk.MultiClient
After the header comes "metadata", which is UTF16-coded movie title string (author info). The metadata begins
from position 32 (0x20) and ends at <savestate_offset - length_of_extra_rom_info_in_bytes>.
*/
string metadata = Encoding.Unicode.GetString(r.ReadBytes((int)(savestateOffset - extraRomInfo - 0x20))); // TODO: Handle.
// 000 3 bytes of zero padding: 00 00 00 003 4-byte integer: CRC32 of the ROM 007 23-byte ascii string
r.ReadBytes(3);
int crc32 = r.ReadInt32(); // TODO: Validate.
// the game name copied from the ROM, truncated to 23 bytes (the game name in the ROM is 21 bytes)
string gameName = RemoveNull(Encoding.UTF8.GetString(r.ReadBytes(23)));
m.Header.SetHeaderLine(MovieHeader.GAMENAME, gameName);
byte[] metadata = r.ReadBytes((int)(savestateOffset - extraRomInfo - 0x20));
string author = Encoding.Unicode.GetString(metadata).Trim();
if (author != "")
m.Header.SetHeaderLine(MovieHeader.AUTHOR, author);
if (extraRomInfo == 30)
{
// 000 3 bytes of zero padding: 00 00 00 003 4-byte integer: CRC32 of the ROM 007 23-byte ascii string
r.ReadBytes(3);
int crc32 = r.ReadInt32(); // TODO: Validate.
// the game name copied from the ROM, truncated to 23 bytes (the game name in the ROM is 21 bytes)
string gameName = RemoveNull(Encoding.UTF8.GetString(r.ReadBytes(23)));
m.Header.SetHeaderLine(MovieHeader.GAMENAME, gameName);
}
r.BaseStream.Position = firstFrameOffset;
for (int frame = 1; frame <= frameCount; frame++)
{