Revert "Replace dynamic type w/ casts in CoreInventory/CLP"
This reverts commit 9ee4821148
.
# Conflicts:
# src/BizHawk.Emulation.Cores/CoreLoadParameters.cs
This didn't actually work, so revisit later
This commit is contained in:
parent
f41a70ef32
commit
81d0b4ec9e
|
@ -5,6 +5,7 @@
|
|||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
|
||||
<PackageReference Include="System.Memory" Version="4.5.4" />
|
||||
<Reference Include="FlatBuffers.Core" HintPath="$(ProjectDir)../../References/FlatBuffers.Core.dll" Private="true" />
|
||||
<Reference Include="Virtu" HintPath="$(ProjectDir)../../References/Virtu.dll" Private="true" />
|
||||
|
|
|
@ -114,11 +114,13 @@ namespace BizHawk.Emulation.Cores
|
|||
{
|
||||
if (_useCoreLoadParameters)
|
||||
{
|
||||
var paramType = typeof(CoreLoadParameters<,>).MakeGenericType(new[] { SettingsType, SyncSettingsType });
|
||||
// TODO: clean this up
|
||||
var param = (ICoreLoadParameters<object, object>) Activator.CreateInstance(typeof(CoreLoadParameters<,>).MakeGenericType(SettingsType, SyncSettingsType));
|
||||
dynamic param = Activator.CreateInstance(paramType);
|
||||
param.Comm = comm;
|
||||
param.Game = game;
|
||||
param.PutSettings(settings, syncSettings);
|
||||
param.Settings = (dynamic)settings;
|
||||
param.SyncSettings = (dynamic)syncSettings;
|
||||
param.Roms.Add(new RomGameFake
|
||||
{
|
||||
RomData = rom,
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
@ -24,15 +23,7 @@ namespace BizHawk.Emulation.Cores
|
|||
DiscType DiscType { get; }
|
||||
public string DiscName { get; set; }
|
||||
}
|
||||
internal interface ICoreLoadParameters<in TSettiing, in TSync>
|
||||
{
|
||||
CoreComm Comm { set; }
|
||||
GameInfo Game { set; }
|
||||
List<IRomAsset> Roms { get; }
|
||||
bool DeterministicEmulationRequested { set; }
|
||||
void PutSettings(object settings, object syncSettings);
|
||||
}
|
||||
public class CoreLoadParameters<TSettiing, TSync> : ICoreLoadParameters<TSettiing, TSync>
|
||||
public class CoreLoadParameters<TSettiing, TSync>
|
||||
{
|
||||
public CoreComm Comm { get; set; }
|
||||
public GameInfo Game { get; set; }
|
||||
|
@ -56,12 +47,5 @@ namespace BizHawk.Emulation.Cores
|
|||
/// <value></value>
|
||||
public List<IDiscAsset> Discs { get; set; } = new List<IDiscAsset>();
|
||||
public bool DeterministicEmulationRequested { get; set; }
|
||||
void ICoreLoadParameters<TSettiing, TSync>.PutSettings(object settings, object syncSettings)
|
||||
{
|
||||
if (!(settings is TSettiing typedSettings)) throw new ArgumentException("type does not match type param", nameof(settings));
|
||||
if (!(syncSettings is TSync typedSyncSettings)) throw new ArgumentException("type does not match type param", nameof(syncSettings));
|
||||
Settings = typedSettings;
|
||||
SyncSettings = typedSyncSettings;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue