Skip to content

Commit

Permalink
Split linked game and hero's quest into two fields. Version bump.
Browse files Browse the repository at this point in the history
  • Loading branch information
kabili207 committed Feb 28, 2015
1 parent 5df74d2 commit b77891d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 14 deletions.
36 changes: 25 additions & 11 deletions GameInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ public class GameInfo : INotifyPropertyChanged
short _gameId = 0;
byte _behavior = 0;
byte _animal = 0;
byte _linkedHeros = 0;
byte _agesSeasons = 0;
bool _isHeroQuest = false;
bool _isLinkedGame = false;

// JSON.Net has problems serializing the rings if it's an enum,
// so we have to put the attribute here instead
Expand Down Expand Up @@ -74,15 +75,26 @@ public Game Game
/// <summary>
/// Gets or sets the Quest type used for this user data
/// </summary>
[JsonProperty("QuestType")]
[JsonConverter(typeof(StringEnumConverter))]
public Quest Quest
public bool IsHeroQuest
{
get { return _isHeroQuest; }
set
{
_isHeroQuest = value;
OnPropertyChanged("IsHeroQuest");
}
}

/// <summary>
/// Gets or sets the Quest type used for this user data
/// </summary>
public bool IsLinkedGame
{
get { return (Quest)_linkedHeros; }
get { return _isLinkedGame; }
set
{
_linkedHeros = (byte)value;
OnPropertyChanged("Quest");
_isLinkedGame = value;
OnPropertyChanged("IsLinkedGame");
}
}

Expand Down Expand Up @@ -274,8 +286,9 @@ public void LoadGameData(byte[] secret)
//if(!isGameCode)
// throw new ArgumentException("The specified data is not a game code", "secret");

_linkedHeros = (byte)(decodedSecret[20] == '1' ? 1 : 0);
_isHeroQuest = decodedSecret[20] == '1';
_agesSeasons = (byte)(decodedSecret[21] == '1' ? 1 : 0);
_isLinkedGame = decodedSecret[106] == '1';


_hero = System.Text.Encoding.ASCII.GetString(new byte[] {
Expand Down Expand Up @@ -313,7 +326,8 @@ public void LoadGameData(byte[] secret)
OnPropertyChanged("Animal");
OnPropertyChanged("Behavior");
OnPropertyChanged("Game");
OnPropertyChanged("Quest");
OnPropertyChanged("IsLinkedGame");
OnPropertyChanged("IsHeroQuest");
}

/// <summary>
Expand Down Expand Up @@ -426,7 +440,7 @@ public byte[] CreateGameSecret()
unencodedSecret += "00"; // game = 0

unencodedSecret += Convert.ToString(_gameId, 2).PadLeft(15, '0').Reverse();
unencodedSecret += Quest == OracleHack.Quest.LinkedGame ? "0" : "1";
unencodedSecret += _isHeroQuest ? "1" : "0";
unencodedSecret += Game == OracleHack.Game.Ages ? "0" : "1";
unencodedSecret += Convert.ToString((byte)_hero[0], 2).PadLeft(8, '0').Reverse();
unencodedSecret += Convert.ToString((byte)_child[0], 2).PadLeft(8, '0').Reverse();
Expand All @@ -443,7 +457,7 @@ public byte[] CreateGameSecret()
unencodedSecret += "1"; // unknown 5
unencodedSecret += Convert.ToString((byte)_hero[4], 2).PadLeft(8, '0').Reverse();
unencodedSecret += Convert.ToString((byte)_child[3], 2).PadLeft(8, '0').Reverse();
unencodedSecret += Quest == OracleHack.Quest.LinkedGame ? "1" : "0";
unencodedSecret += _isLinkedGame ? "1" : "0";
unencodedSecret += Convert.ToString((byte)_child[4], 2).PadLeft(8, '0').Reverse();

byte[] unencodedBytes = StringToBytes(unencodedSecret);
Expand Down
6 changes: 3 additions & 3 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OracleHack")]
[assembly: AssemblyCopyright("Copyright © Andrew \"Kabili\" Nagle 2013 - 2014")]
[assembly: AssemblyCopyright("Copyright © Andrew \"Kabili\" Nagle 2013 - 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -20,13 +20,13 @@
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.

[assembly: AssemblyVersion("2.0.0.*")]
[assembly: AssemblyVersion("2.1.0.*")]

// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.

//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]

[assembly: AssemblyInformationalVersion("2.0")]
[assembly: AssemblyInformationalVersion("2.1")]

0 comments on commit b77891d

Please sign in to comment.