Fix up some junkus in appleii core init, and add stub for mGBA
This commit is contained in:
parent
7f275c5ab5
commit
66f0bf15c0
|
@ -349,8 +349,7 @@ namespace BizHawk.Client.Common
|
||||||
nextEmulator = new AppleII(
|
nextEmulator = new AppleII(
|
||||||
nextComm,
|
nextComm,
|
||||||
assets,
|
assets,
|
||||||
roms,
|
roms);
|
||||||
GetCoreSettings<AppleII>());
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
@ -505,13 +504,10 @@ namespace BizHawk.Client.Common
|
||||||
var c64 = new C64(nextComm, game, rom.RomData, rom.Extension);
|
var c64 = new C64(nextComm, game, rom.RomData, rom.Extension);
|
||||||
nextEmulator = c64;
|
nextEmulator = c64;
|
||||||
break;
|
break;
|
||||||
case "AppleII":
|
|
||||||
var appleII = new AppleII(nextComm, game, rom.RomData, rom.Extension);
|
|
||||||
nextEmulator = appleII;
|
|
||||||
break;
|
|
||||||
case "GBA":
|
case "GBA":
|
||||||
//core = CoreInventory.Instance["GBA", "Meteor"];
|
//core = CoreInventory.Instance["GBA", "Meteor"];
|
||||||
core = CoreInventory.Instance["GBA", "VBA-Next"];
|
core = CoreInventory.Instance["GBA", "VBA-Next"];
|
||||||
|
//core = CoreInventory.Instance["GBA", "mGBA"];
|
||||||
break;
|
break;
|
||||||
case "PSX":
|
case "PSX":
|
||||||
nextEmulator = new Octoshock(nextComm, null, null, rom.FileData, GetCoreSettings<Octoshock>(), GetCoreSyncSettings<Octoshock>());
|
nextEmulator = new Octoshock(nextComm, null, null, rom.FileData, GetCoreSettings<Octoshock>(), GetCoreSyncSettings<Octoshock>());
|
||||||
|
|
|
@ -120,7 +120,7 @@
|
||||||
<Compile Include="Calculator\TI83LinkPort.cs" />
|
<Compile Include="Calculator\TI83LinkPort.cs" />
|
||||||
<Compile Include="Computers\AppleII\AppleII.cs" />
|
<Compile Include="Computers\AppleII\AppleII.cs" />
|
||||||
<Compile Include="Computers\AppleII\AppleII.IAudioProvider.cs">
|
<Compile Include="Computers\AppleII\AppleII.IAudioProvider.cs">
|
||||||
<DependentUpon>AppleII.cs</DependentUpon>
|
<DependentUpon>AppleII.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Computers\AppleII\AppleII.IEmulator.cs">
|
<Compile Include="Computers\AppleII\AppleII.IEmulator.cs">
|
||||||
<DependentUpon>AppleII.cs</DependentUpon>
|
<DependentUpon>AppleII.cs</DependentUpon>
|
||||||
|
@ -378,6 +378,7 @@
|
||||||
<Compile Include="Consoles\Nintendo\GBA\ArmV4Disassembler.cs" />
|
<Compile Include="Consoles\Nintendo\GBA\ArmV4Disassembler.cs" />
|
||||||
<Compile Include="Consoles\Nintendo\GBA\IGBAGPUViewable.cs" />
|
<Compile Include="Consoles\Nintendo\GBA\IGBAGPUViewable.cs" />
|
||||||
<Compile Include="Consoles\Nintendo\GBA\LibMeteor.cs" />
|
<Compile Include="Consoles\Nintendo\GBA\LibMeteor.cs" />
|
||||||
|
<Compile Include="Consoles\Nintendo\GBA\LibmGBA.cs" />
|
||||||
<Compile Include="Consoles\Nintendo\GBA\LibVBANext.cs" />
|
<Compile Include="Consoles\Nintendo\GBA\LibVBANext.cs" />
|
||||||
<Compile Include="Consoles\Nintendo\GBA\Meteor.cs" />
|
<Compile Include="Consoles\Nintendo\GBA\Meteor.cs" />
|
||||||
<Compile Include="Consoles\Nintendo\GBA\Meteor.IGBAGPUViewable.cs">
|
<Compile Include="Consoles\Nintendo\GBA\Meteor.IGBAGPUViewable.cs">
|
||||||
|
@ -395,6 +396,7 @@
|
||||||
<Compile Include="Consoles\Nintendo\GBA\Meteor.IVideoProvider.cs">
|
<Compile Include="Consoles\Nintendo\GBA\Meteor.IVideoProvider.cs">
|
||||||
<DependentUpon>Meteor.cs</DependentUpon>
|
<DependentUpon>Meteor.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Consoles\Nintendo\GBA\MGBAHawk.cs" />
|
||||||
<Compile Include="Consoles\Nintendo\GBA\VBANext.cs" />
|
<Compile Include="Consoles\Nintendo\GBA\VBANext.cs" />
|
||||||
<Compile Include="Consoles\Nintendo\GBA\VBANext.IDebuggable.cs">
|
<Compile Include="Consoles\Nintendo\GBA\VBANext.IDebuggable.cs">
|
||||||
<DependentUpon>VBANext.cs</DependentUpon>
|
<DependentUpon>VBANext.cs</DependentUpon>
|
||||||
|
|
|
@ -16,15 +16,15 @@ namespace BizHawk.Emulation.Cores.Computers.AppleII
|
||||||
)]
|
)]
|
||||||
public partial class AppleII : IEmulator, IDriveLight
|
public partial class AppleII : IEmulator, IDriveLight
|
||||||
{
|
{
|
||||||
public AppleII(CoreComm comm, IEnumerable<GameInfo> gameInfoSet, IEnumerable<byte[]> romSet, object settings)
|
public AppleII(CoreComm comm, IEnumerable<GameInfo> gameInfoSet, IEnumerable<byte[]> romSet)
|
||||||
: this(comm, gameInfoSet.First(), romSet.First(), settings)
|
: this(comm, gameInfoSet.First(), romSet.First())
|
||||||
{
|
{
|
||||||
GameInfoSet = gameInfoSet.ToList();
|
GameInfoSet = gameInfoSet.ToList();
|
||||||
RomSet = romSet.ToList();
|
RomSet = romSet.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
[CoreConstructor("AppleII")]
|
[CoreConstructor("AppleII")]
|
||||||
public AppleII(CoreComm comm, GameInfo game, byte[] rom, object Settings)
|
public AppleII(CoreComm comm, GameInfo game, byte[] rom)
|
||||||
{
|
{
|
||||||
GameInfoSet = new List<GameInfo>();
|
GameInfoSet = new List<GameInfo>();
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using BizHawk.Emulation.Common;
|
||||||
|
|
||||||
|
namespace BizHawk.Emulation.Cores.Nintendo.GBA
|
||||||
|
{
|
||||||
|
public static class LibmGBA
|
||||||
|
{
|
||||||
|
const string dll = "mgba.dll";
|
||||||
|
const CallingConvention cc = CallingConvention.Cdecl;
|
||||||
|
|
||||||
|
[DllImport(dll, CallingConvention=cc)]
|
||||||
|
public static extern void BizDestroy(IntPtr ctx);
|
||||||
|
|
||||||
|
[DllImport(dll, CallingConvention = cc)]
|
||||||
|
public static extern IntPtr BizCreate();
|
||||||
|
|
||||||
|
[DllImport(dll, CallingConvention = cc)]
|
||||||
|
public static extern void BizReset(IntPtr ctx);
|
||||||
|
|
||||||
|
[DllImport(dll, CallingConvention = cc)]
|
||||||
|
public static extern bool BizLoad(IntPtr ctx, byte[] data, int length);
|
||||||
|
|
||||||
|
[DllImport(dll, CallingConvention = cc)]
|
||||||
|
public static extern void BizAdvance(IntPtr ctx, int keys, ref IntPtr vbuff);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,104 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using BizHawk.Common;
|
||||||
|
using BizHawk.Emulation.Common;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace BizHawk.Emulation.Cores.Nintendo.GBA
|
||||||
|
{
|
||||||
|
[CoreAttributes("mGBA", "endrift", true, false, "NOT DONE", "NOT DONE", false)]
|
||||||
|
public class MGBAHawk : IEmulator, IVideoProvider
|
||||||
|
{
|
||||||
|
IntPtr core;
|
||||||
|
|
||||||
|
[CoreConstructor("GBA")]
|
||||||
|
public MGBAHawk(byte[] file, CoreComm comm)
|
||||||
|
{
|
||||||
|
var ser = new BasicServiceProvider(this);
|
||||||
|
ser.Register<IDisassemblable>(new ArmV4Disassembler());
|
||||||
|
ServiceProvider = ser;
|
||||||
|
CoreComm = comm;
|
||||||
|
|
||||||
|
core = LibmGBA.BizCreate();
|
||||||
|
if (core == IntPtr.Zero)
|
||||||
|
throw new InvalidOperationException("BizCreate() returned NULL!");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!LibmGBA.BizLoad(core, file, file.Length))
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException("BizLoad() returned FALSE!");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
LibmGBA.BizDestroy(core);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEmulatorServiceProvider ServiceProvider { get; private set; }
|
||||||
|
|
||||||
|
public ISoundProvider SoundProvider { get { throw new InvalidOperationException(); } }
|
||||||
|
|
||||||
|
public ISyncSoundProvider SyncSoundProvider { get { return new FakeSyncSound(new NullSound(), 735); } }
|
||||||
|
|
||||||
|
public bool StartAsyncSound() { return false; }
|
||||||
|
|
||||||
|
public void EndAsyncSound() { }
|
||||||
|
|
||||||
|
public ControllerDefinition ControllerDefinition { get { return GBA.GBAController; } }
|
||||||
|
|
||||||
|
public IController Controller { get; set; }
|
||||||
|
|
||||||
|
public void FrameAdvance(bool render, bool rendersound = true)
|
||||||
|
{
|
||||||
|
IntPtr vp = IntPtr.Zero;
|
||||||
|
LibmGBA.BizAdvance(core, 0, ref vp);
|
||||||
|
Marshal.Copy(vp, videobuff, 0, 240 * 160);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Frame { get; private set; }
|
||||||
|
|
||||||
|
public string SystemId { get { return "GBA"; } }
|
||||||
|
|
||||||
|
public bool DeterministicEmulation { get { return true; } }
|
||||||
|
|
||||||
|
public string BoardName { get { return null; } }
|
||||||
|
|
||||||
|
public void ResetCounters()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public CoreComm CoreComm { get; private set; }
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
if (core != IntPtr.Zero)
|
||||||
|
{
|
||||||
|
LibmGBA.BizDestroy(core);
|
||||||
|
core = IntPtr.Zero;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int VirtualWidth { get { return 240; } }
|
||||||
|
public int VirtualHeight { get { return 160; } }
|
||||||
|
public int BufferWidth { get { return 240; } }
|
||||||
|
public int BufferHeight { get { return 160; } }
|
||||||
|
|
||||||
|
public int BackgroundColor
|
||||||
|
{
|
||||||
|
get { return unchecked((int)0xff000000); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[] GetVideoBuffer()
|
||||||
|
{
|
||||||
|
return videobuff;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int[] videobuff = new int[240 * 160];
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue