From 7c8298c1b202fa8df466b2710c4e8dfd28b23630 Mon Sep 17 00:00:00 2001 From: "Admiral H. Curtiss" Date: Fri, 16 May 2014 17:34:50 +0200 Subject: [PATCH] Put valid games into the autogenerated filename. --- Program.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Program.cs b/Program.cs index a3e1563..5c543c4 100644 --- a/Program.cs +++ b/Program.cs @@ -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 );