2019-03-10 11:12:50 -04:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.IO.Compression;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using Mesen.GUI.Config;
|
2019-03-11 17:56:54 -04:00
|
|
|
|
using Mesen.GUI.Config.Shortcuts;
|
2019-03-10 11:12:50 -04:00
|
|
|
|
using Mesen.GUI.Forms;
|
|
|
|
|
|
|
|
|
|
namespace Mesen.GUI
|
|
|
|
|
{
|
|
|
|
|
public class ConfigApi
|
|
|
|
|
{
|
|
|
|
|
private const string DllPath = "MesenSCore.dll";
|
|
|
|
|
|
|
|
|
|
[DllImport(DllPath)] public static extern void SetVideoConfig(VideoConfig config);
|
2019-03-10 17:39:14 -04:00
|
|
|
|
[DllImport(DllPath)] public static extern void SetAudioConfig(AudioConfig config);
|
2019-03-13 22:56:33 -04:00
|
|
|
|
[DllImport(DllPath)] public static extern void SetInputConfig(InputConfig config);
|
2019-03-11 17:56:54 -04:00
|
|
|
|
[DllImport(DllPath)] public static extern void SetEmulationConfig(EmulationConfig config);
|
|
|
|
|
|
|
|
|
|
[DllImport(DllPath)] public static extern void SetPreferences(InteropPreferencesConfig config);
|
|
|
|
|
[DllImport(DllPath)] public static extern void SetShortcutKeys([MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)]ShortcutKeyInfo[] shortcuts, UInt32 count);
|
2019-03-10 17:39:14 -04:00
|
|
|
|
|
2019-07-17 20:31:29 -04:00
|
|
|
|
[DllImport(DllPath)] public static extern void SetEmulationFlag(EmulationFlags flag, bool enabled);
|
2019-04-30 21:05:53 -04:00
|
|
|
|
[DllImport(DllPath)] public static extern void SetDebuggerFlag(DebuggerFlags flag, bool enabled);
|
|
|
|
|
|
2019-10-20 20:05:39 -04:00
|
|
|
|
[DllImport(DllPath)] public static extern ControllerType GetControllerType(int player);
|
|
|
|
|
|
2019-03-10 17:39:14 -04:00
|
|
|
|
[DllImport(DllPath, EntryPoint = "GetAudioDevices")] private static extern IntPtr GetAudioDevicesWrapper();
|
|
|
|
|
public static List<string> GetAudioDevices()
|
|
|
|
|
{
|
|
|
|
|
return new List<string>(Utf8Marshaler.PtrToStringUtf8(ConfigApi.GetAudioDevicesWrapper()).Split(new string[1] { "||" }, StringSplitOptions.RemoveEmptyEntries));
|
|
|
|
|
}
|
2019-03-10 11:12:50 -04:00
|
|
|
|
}
|
2019-07-17 20:31:29 -04:00
|
|
|
|
|
|
|
|
|
public enum EmulationFlags : UInt32
|
|
|
|
|
{
|
|
|
|
|
Turbo = 1,
|
|
|
|
|
Rewind = 2,
|
|
|
|
|
MaximumSpeed = 4,
|
|
|
|
|
InBackground = 8,
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-30 21:05:53 -04:00
|
|
|
|
public enum DebuggerFlags : UInt32
|
|
|
|
|
{
|
|
|
|
|
BreakOnBrk = 0x01,
|
|
|
|
|
BreakOnCop = 0x02,
|
|
|
|
|
BreakOnWdm = 0x04,
|
|
|
|
|
BreakOnStp = 0x08,
|
|
|
|
|
BreakOnUninitRead = 0x10,
|
|
|
|
|
|
|
|
|
|
ShowVerifiedData = 0x100,
|
|
|
|
|
DisassembleVerifiedData = 0x200,
|
|
|
|
|
|
|
|
|
|
ShowUnidentifiedData = 0x400,
|
|
|
|
|
DisassembleUnidentifiedData = 0x800,
|
|
|
|
|
|
2020-01-20 23:24:59 -05:00
|
|
|
|
UseAltSpcOpNames = 0x1000,
|
2020-02-07 22:55:27 -05:00
|
|
|
|
UseLowerCaseDisassembly = 0x2000,
|
2020-01-20 23:24:59 -05:00
|
|
|
|
|
2019-07-30 22:34:52 -04:00
|
|
|
|
GsuDebuggerEnabled = 0x10000000,
|
2019-07-25 22:22:09 -04:00
|
|
|
|
Sa1DebuggerEnabled = 0x20000000,
|
2019-04-30 21:05:53 -04:00
|
|
|
|
SpcDebuggerEnabled = 0x40000000,
|
|
|
|
|
CpuDebuggerEnabled = 0x80000000
|
|
|
|
|
}
|
2019-03-10 11:12:50 -04:00
|
|
|
|
}
|