Put valid games into the autogenerated filename.

This commit is contained in:
Admiral H. Curtiss 2014-05-16 17:34:50 +02:00
parent 27dc2ec953
commit 7c8298c1b2

View File

@ -24,18 +24,18 @@ namespace MysteryGiftConvert {
ushort cardId = BitConverter.ToUInt16( file, 0x150 );
Console.WriteLine( "Card ID: " + cardId );
string outFilename = args.Length >= 2 ? args[1] : cardId + ".myg";
string validGamesShortString = "";
ushort gameBitmask = BitConverter.ToUInt16( file, 0x14C );
Console.Write( "This Mystery Gift is valid for:" );
if ( ( gameBitmask & 0x0400 ) == 0x0400 ) { Console.Write( " Diamond" ); }
if ( ( gameBitmask & 0x0800 ) == 0x0800 ) { Console.Write( " Pearl" ); }
if ( ( gameBitmask & 0x1000 ) == 0x1000 ) { Console.Write( " Platinum" ); }
if ( ( gameBitmask & 0x0080 ) == 0x0080 ) { Console.Write( " HeartGold" ); }
if ( ( gameBitmask & 0x0100 ) == 0x0100 ) { Console.Write( " SoulSilver" ); }
if ( ( gameBitmask & 0x0400 ) == 0x0400 ) { Console.Write( " Diamond" ); validGamesShortString += 'd'; } else { validGamesShortString += '_'; }
if ( ( gameBitmask & 0x0800 ) == 0x0800 ) { Console.Write( " Pearl" ); validGamesShortString += 'p'; } else { validGamesShortString += '_'; }
if ( ( gameBitmask & 0x1000 ) == 0x1000 ) { Console.Write( " Platinum" ); validGamesShortString += 'p'; } else { validGamesShortString += '_'; }
if ( ( gameBitmask & 0x0080 ) == 0x0080 ) { Console.Write( " HeartGold" ); validGamesShortString += 'g'; } else { validGamesShortString += '_'; }
if ( ( gameBitmask & 0x0100 ) == 0x0100 ) { Console.Write( " SoulSilver" ); validGamesShortString += 's'; } else { validGamesShortString += '_'; }
Console.WriteLine();
// to convert a pcd into a wifi-distributable wonder card file, copy the short description and "header" data from 0x104 to 0x154 to the start of the file
string outFilename = args.Length >= 2 ? args[1] : cardId + validGamesShortString + ".myg";
var outStream = new FileStream( outFilename, FileMode.Create );
outStream.Write( file, 0x104, 0x50 );