Skip to content

Commit

Permalink
Release for official version of BizHawk
Browse files Browse the repository at this point in the history
  • Loading branch information
Hathor86 committed Dec 21, 2015
1 parent 63dee2d commit 3d1596c
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 33 deletions.
8 changes: 4 additions & 4 deletions MMBizHawkTool/Controls/Panels/HiddenQuestStatusPanel.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public override void UpdateItems(IEnumerable<Watch> itemsAdresses)
string code = string.Empty;
for (int i = 0; i < 5; i++)
{
codeFetcher = Watch.GenerateWatch(z.Domain, (long)z.Address + i, z.Size, z.Type, string.Empty, true);
codeFetcher = Watch.GenerateWatch(z.Domain, (long)z.Address + i, z.Size, z.Type, true);
code = string.Format("{0}{1}", code, codeFetcher.ValueString);
}
((Label)handledItems[(long)z.Address]).Content = code;
Expand All @@ -118,7 +118,7 @@ public override void UpdateItems(IEnumerable<Watch> itemsAdresses)
byte[] code = new byte[6];
for (int i = 0; i < 6; i++)
{
codeFetcher = Watch.GenerateWatch(z.Domain, (long)z.Address + i, z.Size, z.Type, string.Empty, true);
codeFetcher = Watch.GenerateWatch(z.Domain, (long)z.Address + i, z.Size, z.Type, true);
code[i] = (byte)codeFetcher.Value;
}
((SkulltulaCodeViewer)handledItems[(long)z.Address]).SetColorCode(code);
Expand All @@ -129,14 +129,14 @@ public override void UpdateItems(IEnumerable<Watch> itemsAdresses)
string code = string.Empty;

//First we get the currentDay
Watch codeFetcher = Watch.GenerateWatch(z.Domain, CommonAdresses["currentDay"], Watch.WatchSize.Byte, Watch.DisplayType.Unsigned, string.Empty, true);
Watch codeFetcher = Watch.GenerateWatch(z.Domain, CommonAdresses["currentDay"], WatchSize.Byte, DisplayType.Unsigned, true);
int currentDay = (int)codeFetcher.Value;

if (currentDay == 1 || currentDay == 2 || currentDay == 3)
{
for (int i = 0; i < 3; i++)
{
codeFetcher = Watch.GenerateWatch(z.Domain, (long)z.Address + (currentDay - 1) * 3 + i, z.Size, z.Type, string.Empty, true);
codeFetcher = Watch.GenerateWatch(z.Domain, (long)z.Address + (currentDay - 1) * 3 + i, z.Size, z.Type, true);
code = string.Format("{0}{1}", code, codeFetcher.ValueString);
}
((Label)handledItems[(long)z.Address]).Content = code;
Expand Down
38 changes: 20 additions & 18 deletions MMBizHawkTool/CustomMainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ obtain one at

namespace BizHawk.Client.EmuHawk
{
public partial class CustomMainForm : Form, ICustomGameTool
public partial class CustomMainForm : Form, IExternalToolForm
{
#region Fields

Expand All @@ -36,7 +36,8 @@ public partial class CustomMainForm : Form, ICustomGameTool
[RequiredService]
private IEmulator _emu { get; set; }

internal HashSet<Watch> watchList = new HashSet<Watch>();
//internal HashSet<Watch> watchList = new HashSet<Watch>();
internal WatchList watchList;
//private HashSet<BasePanel> paneList = new HashSet<BasePanel>();
private bool isInitialized = false;

Expand All @@ -52,7 +53,7 @@ public CustomMainForm()
panelLoader_QuestStatus.PanelType = "Quest";
panelLoader_HiddenQuestStatus.PanelType = "HiddenQuest";
panelLoader_Map.PanelType = "Map";
panelLoader_Speed.PanelType = "Speed";
panelLoader_Speed.PanelType = "Speed";
}

#endregion
Expand All @@ -73,24 +74,25 @@ public void Restart()
{
if(!isInitialized)
{
InitializePanels();
watchList = new WatchList(_memoryDomains, "N64");
InitializePanels();
isInitialized = true;
}
else
{
Parallel.ForEach<Watch>(watchList, w => w.Domain = _memoryDomains.MainMemory);
watchList.RefreshDomains(_memoryDomains);
}

Parallel.ForEach<Watch>(watchList, w => w.Update());
watchList.UpdateValues();
foreach (BasePanel panel in PanelHolder.Panels)
{
panel.UpdateItems(watchList);
}
}

public void UpdateValues()
{
Parallel.ForEach<Watch>(watchList, w => w.Update());
{
watchList.UpdateValues();

IEnumerable<Watch> changes = from w in watchList
where w.Previous != w.Value
Expand All @@ -109,17 +111,17 @@ public void UpdateValues()
private void PopulatePanel<T>(XmlNodeList panelNode) where T : BasePanel
{
long address;
Watch.WatchSize wSize;
Watch.DisplayType dType;
WatchSize wSize;
Client.Common.DisplayType dType;
CultureInfo ci = new CultureInfo("en-US");

foreach (XmlElement watchNode in panelNode)
{
if (long.TryParse(watchNode.Attributes["Address"].Value, NumberStyles.HexNumber, ci, out address)
&& Enum.TryParse<Watch.WatchSize>(watchNode.Attributes["WatchSize"].Value, out wSize)
&& Enum.TryParse<Watch.DisplayType>(watchNode.Attributes["DisplayType"].Value, out dType))
&& Enum.TryParse<WatchSize>(watchNode.Attributes["WatchSize"].Value, out wSize)
&& Enum.TryParse<Client.Common.DisplayType>(watchNode.Attributes["DisplayType"].Value, out dType))
{
watchList.Add(Watch.GenerateWatch(_memoryDomains.MainMemory, address, wSize, dType, string.Empty, true));
watchList.Add(Watch.GenerateWatch(_memoryDomains.MainMemory, address, wSize, dType, true));
foreach (BasePanel panel in PanelHolder.Panels)
{
if (panel is T)
Expand Down Expand Up @@ -148,16 +150,16 @@ private void InitializePanels()
if (panelNode.Attributes["Type"].Value == "Common")
{
long address;
Watch.WatchSize wSize;
Watch.DisplayType dType;
WatchSize wSize;
Client.Common.DisplayType dType;
CultureInfo ci = new CultureInfo("en-US");
foreach (XmlElement watchNode in panelNode.ChildNodes)
{
if (long.TryParse(watchNode.Attributes["Address"].Value, NumberStyles.HexNumber, ci, out address)
&& Enum.TryParse<Watch.WatchSize>(watchNode.Attributes["WatchSize"].Value, out wSize)
&& Enum.TryParse<Watch.DisplayType>(watchNode.Attributes["DisplayType"].Value, out dType))
&& Enum.TryParse<WatchSize>(watchNode.Attributes["WatchSize"].Value, out wSize)
&& Enum.TryParse<Client.Common.DisplayType>(watchNode.Attributes["DisplayType"].Value, out dType))
{
watchList.Add(Watch.GenerateWatch(_memoryDomains.MainMemory, address, wSize, dType, string.Empty, true));
watchList.Add(Watch.GenerateWatch(_memoryDomains.MainMemory, address, wSize, dType, true));
BasePanel.CommonAdresses.Add(watchNode.Attributes["Item"].Value, address);

switch (watchNode.Attributes["Item"].Value)
Expand Down
10 changes: 5 additions & 5 deletions MMBizHawkTool/Forms/PanelHolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,17 @@ public PanelHolder(string panelType, CustomMainForm form)
if (panelNode.Attributes["Type"].Value == panelType)
{
long address;
Watch.WatchSize wSize;
Watch.DisplayType dType;
WatchSize wSize;
BizHawk.Client.Common.DisplayType dType;
CultureInfo ci = new CultureInfo("en-US");

foreach (XmlElement watchNode in panelNode.ChildNodes)
{
if (long.TryParse(watchNode.Attributes["Address"].Value, NumberStyles.HexNumber, ci, out address)
&& Enum.TryParse<Watch.WatchSize>(watchNode.Attributes["WatchSize"].Value, out wSize)
&& Enum.TryParse<Watch.DisplayType>(watchNode.Attributes["DisplayType"].Value, out dType))
&& Enum.TryParse<WatchSize>(watchNode.Attributes["WatchSize"].Value, out wSize)
&& Enum.TryParse<BizHawk.Client.Common.DisplayType>(watchNode.Attributes["DisplayType"].Value, out dType))
{
form.watchList.Add(Watch.GenerateWatch(form._memoryDomains.MainMemory, address, wSize, dType, string.Empty, true));
form.watchList.Add(Watch.GenerateWatch(form._memoryDomains.MainMemory, address, wSize, dType, true));
((BasePanel)panelHost.Child).AddToDictionnary(address, watchNode.Attributes["Item"].Value);
}
}
Expand Down
13 changes: 7 additions & 6 deletions MMBizHawkTool/MMBizHawkTool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,17 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="BizHawk.Client.Common, Version=1.11.2.0, Culture=neutral, processorArchitecture=x86">
<Reference Include="BizHawk.Client.ApiHawk, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\BizHawk\output\BizHawk.Client.Common.dll</HintPath>
<HintPath>..\..\..\..\..\Programs\Emulators\BizHawk\dll\BizHawk.Client.ApiHawk.dll</HintPath>
</Reference>
<Reference Include="BizHawk.Emulation.Common, Version=1.11.2.0, Culture=neutral, processorArchitecture=x86">
<Reference Include="BizHawk.Client.Common, Version=1.11.3.9903, Culture=neutral, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\BizHawk\output\BizHawk.Emulation.Common.dll</HintPath>
<HintPath>..\..\..\..\..\Programs\Emulators\BizHawk\dll\BizHawk.Client.Common.dll</HintPath>
</Reference>
<Reference Include="EmuHawk">
<HintPath>..\..\BizHawk\output\EmuHawk.exe</HintPath>
<Reference Include="BizHawk.Emulation.Common, Version=1.11.3.9903, Culture=neutral, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\Programs\Emulators\BizHawk\dll\BizHawk.Emulation.Common.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
Expand Down
2 changes: 2 additions & 0 deletions MMBizHawkTool/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using BizHawk.Client.ApiHawk;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
Expand All @@ -13,6 +14,7 @@
[assembly: AssemblyCopyright("Copyright © 2015 François Guiot")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: BizHawkExternalTool("Majora's Mask Tools", "Some advanced features specific to Majora's Mask")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
Expand Down

0 comments on commit 3d1596c

Please sign in to comment.