Fix building of ext. tools

this HelloWorld is now a far cry from intended use...
This commit is contained in:
YoshiRulz 2020-08-01 17:59:56 +10:00
parent f6edd02195
commit d32c19ee5d
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
5 changed files with 13 additions and 87 deletions

View File

@ -14,6 +14,9 @@ namespace BizHawk.Experiment.AutoGenConfig
[ExternalTool("AutoGenConfig")]
public class AutoGenConfigForm : Form, IExternalToolForm
{
[RequiredApi]
private IEmulationApi? _emuAPI { get; set; }
private static readonly WeakReference<ConfigEditorCache> _cache = new WeakReference<ConfigEditorCache>(new ConfigEditorCache(typeof(Config)));
private static ConfigEditorCache Cache => _cache.TryGetTarget(out var c) ? c : new ConfigEditorCache(typeof(Config)).Also(_cache.SetTarget);
@ -22,9 +25,6 @@ namespace BizHawk.Experiment.AutoGenConfig
private readonly ConfigEditorMetadata Metadata = new ConfigEditorMetadata(Cache);
[RequiredApi]
private IEmu? EmuHawkAPI { get; set; }
public override string Text => "AutoGenConfig";
public AutoGenConfigForm()
@ -128,7 +128,7 @@ namespace BizHawk.Experiment.AutoGenConfig
Text = fi.Name
});
}
var config = (EmuHawkAPI as EmuApi ?? throw new Exception("required API wasn't fulfilled")).ForbiddenConfigReference;
var config = (_emuAPI as EmulationApi ?? throw new Exception("required API wasn't fulfilled")).ForbiddenConfigReference;
var groupings = new Dictionary<string, object> { [string.Empty] = config };
void TraverseGroupings(object groupingObj, string parentNesting)
{

View File

@ -1,35 +0,0 @@
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("DBMan")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DBMan")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 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
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("58cef5c3-fb2d-4d02-8f02-46a53c1c49cf")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -52,7 +52,7 @@ namespace HelloWorld
ClientApi.BeforeQuickSave += (sender, e) =>
{
if (e.Slot != 0) return; // only take effect on slot 0
var basePath = Path.Combine(Global.Config.PathEntries.SaveStateAbsolutePath(Global.Game.System), "Test");
var basePath = Path.Combine(GlobalWin.Config.PathEntries.SaveStateAbsolutePath(GlobalWin.Game.System), "Test");
if (!Directory.Exists(basePath)) Directory.CreateDirectory(basePath);
ClientApi.SaveState(Path.Combine(basePath, e.Name));
e.Handled = true;
@ -60,7 +60,7 @@ namespace HelloWorld
ClientApi.BeforeQuickLoad += (sender, e) =>
{
if (e.Slot != 0) return; // only take effect on slot 0
var basePath = Path.Combine(Global.Config.PathEntries.SaveStateAbsolutePath(Global.Game.System), "Test");
var basePath = Path.Combine(GlobalWin.Config.PathEntries.SaveStateAbsolutePath(GlobalWin.Game.System), "Test");
ClientApi.LoadState(Path.Combine(basePath, e.Name));
e.Handled = true;
};
@ -75,11 +75,11 @@ namespace HelloWorld
ClientApi.SetExtraPadding(50, 50);
#endif
if (Global.Game.Name != "Null")
if (GlobalWin.Game.Name != "Null")
{
Watches.RefreshDomains(_memoryDomains, Global.Config.RamWatchDefinePrevious);
label_Game.Text = $"You're playing {Global.Game.Name}";
label_GameHash.Text = $"Hash: {Global.Game.Hash}";
Watches.RefreshDomains(_memoryDomains, GlobalWin.Config.RamWatchDefinePrevious);
label_Game.Text = $"You're playing {GlobalWin.Game.Name}";
label_GameHash.Text = $"Hash: {GlobalWin.Game.Hash}";
}
else
{
@ -91,12 +91,12 @@ namespace HelloWorld
public void UpdateValues(ToolFormUpdateType type)
{
if (!(type == ToolFormUpdateType.PreFrame || type == ToolFormUpdateType.FastPreFrame)
|| Global.Game.Name == "Null"
|| GlobalWin.Game.Name == "Null"
|| Watches.Count < 3)
{
return;
}
Watches.UpdateValues(Global.Config.RamWatchDefinePrevious);
Watches.UpdateValues(GlobalWin.Config.RamWatchDefinePrevious);
label_Watch1.Text = $"First watch ({Watches[0].AddressString}) current value: {Watches[0].ValueString}";
label_Watch2.Text = $"Second watch ({Watches[1].AddressString}) current value: {Watches[1].ValueString}";
label_Watch3.Text = $"Third watch ({Watches[2].AddressString}) current value: {Watches[2].ValueString}";
@ -129,7 +129,7 @@ namespace HelloWorld
ClientApi.SetInput(1, j);
}
private void label_GameHash_Click(object sender, EventArgs e) => Clipboard.SetText(Global.Game.Hash);
private void label_GameHash_Click(object sender, EventArgs e) => Clipboard.SetText(GlobalWin.Game.Hash);
private void loadstate_Click(object sender, EventArgs e)
{

View File

@ -4,8 +4,4 @@
<ItemGroup>
<EmbeddedResource Include="icon_Hello.ico" />
</ItemGroup>
<ItemGroup>
<Compile Update="CustomMainForm.cs" SubType="Form" />
<Compile Update="CustomMainForm.Designer.cs" DependentUpon="CustomMainForm.cs" />
</ItemGroup>
</Project>

View File

@ -1,35 +0,0 @@
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("HelloWorld")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HelloWorld")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 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
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("288d598f-1019-4ea2-802d-14d3cc73ee90")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]