移除不再需要要的代码

This commit is contained in:
sin365 2025-02-05 13:13:19 +08:00
parent cc39c555f7
commit b280f78d04
50 changed files with 260 additions and 2247 deletions

View File

@ -1,20 +1,13 @@
using System; using Essgee.Emulation.Configuration;
using System.Collections.Generic; using Essgee.Utilities;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Reflection;
using System.Drawing;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Converters; using Newtonsoft.Json.Converters;
using System.Collections.Generic;
using Essgee.Emulation.Configuration; using System.Drawing;
using Essgee.Utilities;
namespace Essgee namespace Essgee
{ {
public class Configuration public class Configuration
{ {
public const int RecentFilesCapacity = 15; public const int RecentFilesCapacity = 15;
public const string DefaultShaderName = "Basic"; public const string DefaultShaderName = "Basic";

View File

@ -1,7 +1,6 @@
using Essgee; using Essgee;
using System; using System;
using System.IO;
public static class EmuStandInfo public static class EmuStandInfo
{ {

View File

@ -13,83 +13,83 @@ namespace Essgee.Emulation.Configuration
//todo Unity [DropDownControl("Controls", "Up", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controls", "Up", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey ControlsUp { get; set; } public EssgeeMotionKey ControlsUp { get; set; }
//todo Unity [DropDownControl("Controls", "Down", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controls", "Down", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey ControlsDown { get; set; } public EssgeeMotionKey ControlsDown { get; set; }
//todo Unity [DropDownControl("Controls", "Left", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controls", "Left", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey ControlsLeft { get; set; } public EssgeeMotionKey ControlsLeft { get; set; }
//todo Unity [DropDownControl("Controls", "Right", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controls", "Right", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey ControlsRight { get; set; } public EssgeeMotionKey ControlsRight { get; set; }
//todo Unity [DropDownControl("Controls", "Left Button", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controls", "Left Button", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey ControlsButtonLeft { get; set; } public EssgeeMotionKey ControlsButtonLeft { get; set; }
//todo Unity [DropDownControl("Controls", "Right Button", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controls", "Right Button", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey ControlsButtonRight { get; set; } public EssgeeMotionKey ControlsButtonRight { get; set; }
//todo Unity [DropDownControl("Controls", "Keypad 1", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controls", "Keypad 1", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey ControlsKeypad1 { get; set; } public EssgeeMotionKey ControlsKeypad1 { get; set; }
//todo Unity [DropDownControl("Controls", "Keypad 2", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controls", "Keypad 2", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey ControlsKeypad2 { get; set; } public EssgeeMotionKey ControlsKeypad2 { get; set; }
//todo Unity [DropDownControl("Controls", "Keypad 3", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controls", "Keypad 3", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey ControlsKeypad3 { get; set; } public EssgeeMotionKey ControlsKeypad3 { get; set; }
//todo Unity [DropDownControl("Controls", "Keypad 4", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controls", "Keypad 4", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey ControlsKeypad4 { get; set; } public EssgeeMotionKey ControlsKeypad4 { get; set; }
//todo Unity [DropDownControl("Controls", "Keypad 5", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controls", "Keypad 5", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey ControlsKeypad5 { get; set; } public EssgeeMotionKey ControlsKeypad5 { get; set; }
//todo Unity [DropDownControl("Controls", "Keypad 6", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controls", "Keypad 6", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey ControlsKeypad6 { get; set; } public EssgeeMotionKey ControlsKeypad6 { get; set; }
//todo Unity [DropDownControl("Controls", "Keypad 7", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controls", "Keypad 7", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey ControlsKeypad7 { get; set; } public EssgeeMotionKey ControlsKeypad7 { get; set; }
//todo Unity [DropDownControl("Controls", "Keypad 8", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controls", "Keypad 8", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey ControlsKeypad8 { get; set; } public EssgeeMotionKey ControlsKeypad8 { get; set; }
//todo Unity [DropDownControl("Controls", "Keypad 9", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controls", "Keypad 9", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey ControlsKeypad9 { get; set; } public EssgeeMotionKey ControlsKeypad9 { get; set; }
//todo Unity [DropDownControl("Controls", "Keypad 0", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controls", "Keypad 0", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey ControlsKeypad0 { get; set; } public EssgeeMotionKey ControlsKeypad0 { get; set; }
//todo Unity [DropDownControl("Controls", "Keypad *", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controls", "Keypad *", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey ControlsKeypadStar { get; set; } public EssgeeMotionKey ControlsKeypadStar { get; set; }
//todo Unity [DropDownControl("Controls", "Keypad #", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controls", "Keypad #", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey ControlsKeypadNumberSign { get; set; } public EssgeeMotionKey ControlsKeypadNumberSign { get; set; }
public ColecoVision() public ColecoVision()
{ {
BiosRom = string.Empty; BiosRom = string.Empty;
ControlsUp = MotionKey.Up; ControlsUp = EssgeeMotionKey.Up;
ControlsDown = MotionKey.Down; ControlsDown = EssgeeMotionKey.Down;
ControlsLeft = MotionKey.Left; ControlsLeft = EssgeeMotionKey.Left;
ControlsRight = MotionKey.Right; ControlsRight = EssgeeMotionKey.Right;
ControlsButtonLeft = MotionKey.A; ControlsButtonLeft = EssgeeMotionKey.A;
ControlsButtonRight = MotionKey.S; ControlsButtonRight = EssgeeMotionKey.S;
ControlsKeypad1 = MotionKey.NumPad1; ControlsKeypad1 = EssgeeMotionKey.NumPad1;
ControlsKeypad2 = MotionKey.NumPad2; ControlsKeypad2 = EssgeeMotionKey.NumPad2;
ControlsKeypad3 = MotionKey.NumPad3; ControlsKeypad3 = EssgeeMotionKey.NumPad3;
ControlsKeypad4 = MotionKey.NumPad4; ControlsKeypad4 = EssgeeMotionKey.NumPad4;
ControlsKeypad5 = MotionKey.NumPad5; ControlsKeypad5 = EssgeeMotionKey.NumPad5;
ControlsKeypad6 = MotionKey.NumPad6; ControlsKeypad6 = EssgeeMotionKey.NumPad6;
ControlsKeypad7 = MotionKey.NumPad7; ControlsKeypad7 = EssgeeMotionKey.NumPad7;
ControlsKeypad8 = MotionKey.NumPad8; ControlsKeypad8 = EssgeeMotionKey.NumPad8;
ControlsKeypad9 = MotionKey.NumPad9; ControlsKeypad9 = EssgeeMotionKey.NumPad9;
ControlsKeypad0 = MotionKey.NumPad0; ControlsKeypad0 = EssgeeMotionKey.NumPad0;
ControlsKeypadStar = MotionKey.Multiply; ControlsKeypadStar = EssgeeMotionKey.Multiply;
ControlsKeypadNumberSign = MotionKey.Divide; ControlsKeypadNumberSign = EssgeeMotionKey.Divide;
} }
} }
} }

View File

@ -38,28 +38,28 @@ namespace Essgee.Emulation.Configuration
//todo Unity [DropDownControl("Controls", "Up", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controls", "Up", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey ControlsUp { get; set; } public EssgeeMotionKey ControlsUp { get; set; }
//todo Unity [DropDownControl("Controls", "Down", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controls", "Down", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey ControlsDown { get; set; } public EssgeeMotionKey ControlsDown { get; set; }
//todo Unity [DropDownControl("Controls", "Left", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controls", "Left", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey ControlsLeft { get; set; } public EssgeeMotionKey ControlsLeft { get; set; }
//todo Unity [DropDownControl("Controls", "Right", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controls", "Right", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey ControlsRight { get; set; } public EssgeeMotionKey ControlsRight { get; set; }
//todo Unity [DropDownControl("Controls", "A", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controls", "A", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey ControlsA { get; set; } public EssgeeMotionKey ControlsA { get; set; }
//todo Unity [DropDownControl("Controls", "B", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controls", "B", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey ControlsB { get; set; } public EssgeeMotionKey ControlsB { get; set; }
//todo Unity [DropDownControl("Controls", "Select", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controls", "Select", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey ControlsSelect { get; set; } public EssgeeMotionKey ControlsSelect { get; set; }
//todo Unity [DropDownControl("Controls", "Start", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controls", "Start", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey ControlsStart { get; set; } public EssgeeMotionKey ControlsStart { get; set; }
public GameBoy() public GameBoy()
{ {
@ -70,14 +70,14 @@ namespace Essgee.Emulation.Configuration
CameraSource = GBCameraCartridge.ImageSources.Noise; CameraSource = GBCameraCartridge.ImageSources.Noise;
CameraImageFile = string.Empty; CameraImageFile = string.Empty;
ControlsUp = MotionKey.Up; ControlsUp = EssgeeMotionKey.Up;
ControlsDown = MotionKey.Down; ControlsDown = EssgeeMotionKey.Down;
ControlsLeft = MotionKey.Left; ControlsLeft = EssgeeMotionKey.Left;
ControlsRight = MotionKey.Right; ControlsRight = EssgeeMotionKey.Right;
ControlsA = MotionKey.S; ControlsA = EssgeeMotionKey.S;
ControlsB = MotionKey.A; ControlsB = EssgeeMotionKey.A;
ControlsSelect = MotionKey.Space; ControlsSelect = EssgeeMotionKey.Space;
ControlsStart = MotionKey.Enter; ControlsStart = EssgeeMotionKey.Enter;
} }
} }
} }

View File

@ -33,31 +33,31 @@ namespace Essgee.Emulation.Configuration
//todo Unity [DropDownControl("Controls", "Up", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controls", "Up", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey ControlsUp { get; set; } public EssgeeMotionKey ControlsUp { get; set; }
//todo Unity [DropDownControl("Controls", "Down", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controls", "Down", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey ControlsDown { get; set; } public EssgeeMotionKey ControlsDown { get; set; }
//todo Unity [DropDownControl("Controls", "Left", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controls", "Left", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey ControlsLeft { get; set; } public EssgeeMotionKey ControlsLeft { get; set; }
//todo Unity [DropDownControl("Controls", "Right", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controls", "Right", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey ControlsRight { get; set; } public EssgeeMotionKey ControlsRight { get; set; }
//todo Unity [DropDownControl("Controls", "A", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controls", "A", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey ControlsA { get; set; } public EssgeeMotionKey ControlsA { get; set; }
//todo Unity [DropDownControl("Controls", "B", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controls", "B", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey ControlsB { get; set; } public EssgeeMotionKey ControlsB { get; set; }
//todo Unity [DropDownControl("Controls", "Select", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controls", "Select", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey ControlsSelect { get; set; } public EssgeeMotionKey ControlsSelect { get; set; }
//todo Unity [DropDownControl("Controls", "Start", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controls", "Start", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey ControlsStart { get; set; } public EssgeeMotionKey ControlsStart { get; set; }
//todo Unity [DropDownControl("Controls", "Send IR Signal", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controls", "Send IR Signal", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey ControlsSendIR { get; set; } public EssgeeMotionKey ControlsSendIR { get; set; }
public GameBoyColor() public GameBoyColor()
{ {
@ -71,15 +71,15 @@ namespace Essgee.Emulation.Configuration
InfraredSource = Machines.GameBoyColor.InfraredSources.None; InfraredSource = Machines.GameBoyColor.InfraredSources.None;
InfraredDatabasePikachu = string.Empty; InfraredDatabasePikachu = string.Empty;
ControlsUp = MotionKey.Up; ControlsUp = EssgeeMotionKey.Up;
ControlsDown = MotionKey.Down; ControlsDown = EssgeeMotionKey.Down;
ControlsLeft = MotionKey.Left; ControlsLeft = EssgeeMotionKey.Left;
ControlsRight = MotionKey.Right; ControlsRight = EssgeeMotionKey.Right;
ControlsA = MotionKey.S; ControlsA = EssgeeMotionKey.S;
ControlsB = MotionKey.A; ControlsB = EssgeeMotionKey.A;
ControlsSelect = MotionKey.Space; ControlsSelect = EssgeeMotionKey.Space;
ControlsStart = MotionKey.Enter; ControlsStart = EssgeeMotionKey.Enter;
ControlsSendIR = MotionKey.Back; ControlsSendIR = EssgeeMotionKey.Back;
} }
} }
} }

View File

@ -19,25 +19,25 @@ namespace Essgee.Emulation.Configuration
//todo Unity [DropDownControl("Controls", "D-Pad Up", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controls", "D-Pad Up", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey ControlsUp { get; set; } public EssgeeMotionKey ControlsUp { get; set; }
//todo Unity [DropDownControl("Controls", "D-Pad Down", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controls", "D-Pad Down", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey ControlsDown { get; set; } public EssgeeMotionKey ControlsDown { get; set; }
//todo Unity [DropDownControl("Controls", "D-Pad Left", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controls", "D-Pad Left", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey ControlsLeft { get; set; } public EssgeeMotionKey ControlsLeft { get; set; }
//todo Unity [DropDownControl("Controls", "D-Pad Right", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controls", "D-Pad Right", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey ControlsRight { get; set; } public EssgeeMotionKey ControlsRight { get; set; }
//todo Unity [DropDownControl("Controls", "Button 1", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controls", "Button 1", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey ControlsButton1 { get; set; } public EssgeeMotionKey ControlsButton1 { get; set; }
//todo Unity [DropDownControl("Controls", "Button 2", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controls", "Button 2", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey ControlsButton2 { get; set; } public EssgeeMotionKey ControlsButton2 { get; set; }
//todo Unity [DropDownControl("Controls", "Start", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controls", "Start", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey ControlsStart { get; set; } public EssgeeMotionKey ControlsStart { get; set; }
public bool AllowMemoryControl { get; set; } public bool AllowMemoryControl { get; set; }
@ -47,13 +47,13 @@ namespace Essgee.Emulation.Configuration
Region = Region.Export; Region = Region.Export;
ControlsUp = MotionKey.Up; ControlsUp = EssgeeMotionKey.Up;
ControlsDown = MotionKey.Down; ControlsDown = EssgeeMotionKey.Down;
ControlsLeft = MotionKey.Left; ControlsLeft = EssgeeMotionKey.Left;
ControlsRight = MotionKey.Right; ControlsRight = EssgeeMotionKey.Right;
ControlsButton1 = MotionKey.A; ControlsButton1 = EssgeeMotionKey.A;
ControlsButton2 = MotionKey.S; ControlsButton2 = EssgeeMotionKey.S;
ControlsStart = MotionKey.Return; ControlsStart = EssgeeMotionKey.Return;
AllowMemoryControl = true; AllowMemoryControl = true;
} }

View File

@ -25,56 +25,56 @@ namespace Essgee.Emulation.Configuration
//todo Unity [DropDownControl("General", "Pause Button", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("General", "Pause Button", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey InputPause { get; set; } public EssgeeMotionKey InputPause { get; set; }
//todo Unity [DropDownControl("General", "Reset Button", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("General", "Reset Button", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey InputReset { get; set; } public EssgeeMotionKey InputReset { get; set; }
//todo Unity [DropDownControl("Controller Port 1", "Device Type", typeof(InputDevice))] //todo Unity [DropDownControl("Controller Port 1", "Device Type", typeof(InputDevice))]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public InputDevice Joypad1DeviceType { get; set; } public InputDevice Joypad1DeviceType { get; set; }
//todo Unity [DropDownControl("Controller Port 1", "D-Pad Up", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controller Port 1", "D-Pad Up", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey Joypad1Up { get; set; } public EssgeeMotionKey Joypad1Up { get; set; }
//todo Unity [DropDownControl("Controller Port 1", "D-Pad Down", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controller Port 1", "D-Pad Down", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey Joypad1Down { get; set; } public EssgeeMotionKey Joypad1Down { get; set; }
//todo Unity [DropDownControl("Controller Port 1", "D-Pad Left", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controller Port 1", "D-Pad Left", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey Joypad1Left { get; set; } public EssgeeMotionKey Joypad1Left { get; set; }
//todo Unity [DropDownControl("Controller Port 1", "D-Pad Right", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controller Port 1", "D-Pad Right", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey Joypad1Right { get; public EssgeeMotionKey Joypad1Right { get;
set; set;
} }
//todo Unity [DropDownControl("Controller Port 1", "Button 1", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controller Port 1", "Button 1", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey Joypad1Button1 { get; set; } public EssgeeMotionKey Joypad1Button1 { get; set; }
//todo Unity [DropDownControl("Controller Port 1", "Button 2", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controller Port 1", "Button 2", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey Joypad1Button2 { get; set; } public EssgeeMotionKey Joypad1Button2 { get; set; }
//todo Unity [DropDownControl("Controller Port 2", "Device Type", typeof(InputDevice))] //todo Unity [DropDownControl("Controller Port 2", "Device Type", typeof(InputDevice))]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public InputDevice Joypad2DeviceType { get; set; } public InputDevice Joypad2DeviceType { get; set; }
//todo Unity [DropDownControl("Controller Port 2", "D-Pad Up", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controller Port 2", "D-Pad Up", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey Joypad2Up { get; set; } public EssgeeMotionKey Joypad2Up { get; set; }
//todo Unity [DropDownControl("Controller Port 2", "D-Pad Down", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controller Port 2", "D-Pad Down", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey Joypad2Down { get; set; } public EssgeeMotionKey Joypad2Down { get; set; }
//todo Unity [DropDownControl("Controller Port 2", "D-Pad Left", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controller Port 2", "D-Pad Left", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey Joypad2Left { get; set; } public EssgeeMotionKey Joypad2Left { get; set; }
//todo Unity [DropDownControl("Controller Port 2", "D-Pad Right", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controller Port 2", "D-Pad Right", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey Joypad2Right { get; set; } public EssgeeMotionKey Joypad2Right { get; set; }
//todo Unity [DropDownControl("Controller Port 2", "Button 1", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controller Port 2", "Button 1", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey Joypad2Button1 { get; set; } public EssgeeMotionKey Joypad2Button1 { get; set; }
//todo Unity [DropDownControl("Controller Port 2", "Button 2", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controller Port 2", "Button 2", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey Joypad2Button2 { get; set; } public EssgeeMotionKey Joypad2Button2 { get; set; }
public bool AllowMemoryControl { get; set; } public bool AllowMemoryControl { get; set; }
@ -86,24 +86,24 @@ namespace Essgee.Emulation.Configuration
Region = Region.Export; Region = Region.Export;
VDPType = VDPTypes.SMS2GG; VDPType = VDPTypes.SMS2GG;
InputPause = MotionKey.Space; InputPause = EssgeeMotionKey.Space;
InputReset = MotionKey.Back; InputReset = EssgeeMotionKey.Back;
Joypad1DeviceType = InputDevice.Controller; Joypad1DeviceType = InputDevice.Controller;
Joypad1Up = MotionKey.Up; Joypad1Up = EssgeeMotionKey.Up;
Joypad1Down = MotionKey.Down; Joypad1Down = EssgeeMotionKey.Down;
Joypad1Left = MotionKey.Left; Joypad1Left = EssgeeMotionKey.Left;
Joypad1Right = MotionKey.Right; Joypad1Right = EssgeeMotionKey.Right;
Joypad1Button1 = MotionKey.A; Joypad1Button1 = EssgeeMotionKey.A;
Joypad1Button2 = MotionKey.S; Joypad1Button2 = EssgeeMotionKey.S;
Joypad2DeviceType = InputDevice.Controller; Joypad2DeviceType = InputDevice.Controller;
Joypad2Up = MotionKey.NumPad8; Joypad2Up = EssgeeMotionKey.NumPad8;
Joypad2Down = MotionKey.NumPad2; Joypad2Down = EssgeeMotionKey.NumPad2;
Joypad2Left = MotionKey.NumPad4; Joypad2Left = EssgeeMotionKey.NumPad4;
Joypad2Right = MotionKey.NumPad6; Joypad2Right = EssgeeMotionKey.NumPad6;
Joypad2Button1 = MotionKey.NumPad1; Joypad2Button1 = EssgeeMotionKey.NumPad1;
Joypad2Button2 = MotionKey.NumPad3; Joypad2Button2 = EssgeeMotionKey.NumPad3;
AllowMemoryControl = true; AllowMemoryControl = true;
} }

View File

@ -12,75 +12,75 @@ namespace Essgee.Emulation.Configuration
//todo Unity [DropDownControl("General", "Reset Button", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("General", "Reset Button", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey InputReset { get; set; } public EssgeeMotionKey InputReset { get; set; }
//todo Unity [DropDownControl("General", "Change Input Mode", typeof(Keys), Keys.F11, Tooltip = "Selects which PC keyboard key is used to switch between SC-3000 keyboard and controller input.")] //todo Unity [DropDownControl("General", "Change Input Mode", typeof(Keys), Keys.F11, Tooltip = "Selects which PC keyboard key is used to switch between SC-3000 keyboard and controller input.")]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey InputChangeMode { get; set; } public EssgeeMotionKey InputChangeMode { get; set; }
//todo Unity [DropDownControl("General", "Play Tape", typeof(Keys), Keys.F11, Tooltip = "Note that tape emulation is currently non-functional.")] //todo Unity [DropDownControl("General", "Play Tape", typeof(Keys), Keys.F11, Tooltip = "Note that tape emulation is currently non-functional.")]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey InputPlayTape { get; set; } public EssgeeMotionKey InputPlayTape { get; set; }
//todo Unity [DropDownControl("Controller Port 1", "D-Pad Up", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controller Port 1", "D-Pad Up", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey Joypad1Up { get; set; } public EssgeeMotionKey Joypad1Up { get; set; }
//todo Unity [DropDownControl("Controller Port 1", "D-Pad Down", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controller Port 1", "D-Pad Down", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey Joypad1Down { get; set; } public EssgeeMotionKey Joypad1Down { get; set; }
//todo Unity [DropDownControl("Controller Port 1", "D-Pad Left", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controller Port 1", "D-Pad Left", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey Joypad1Left { get; set; } public EssgeeMotionKey Joypad1Left { get; set; }
//todo Unity [DropDownControl("Controller Port 1", "D-Pad Right", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controller Port 1", "D-Pad Right", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey Joypad1Right { get; set; } public EssgeeMotionKey Joypad1Right { get; set; }
//todo Unity [DropDownControl("Controller Port 1", "Button 1", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controller Port 1", "Button 1", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey Joypad1Button1 { get; set; } public EssgeeMotionKey Joypad1Button1 { get; set; }
//todo Unity [DropDownControl("Controller Port 1", "Button 2", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controller Port 1", "Button 2", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey Joypad1Button2 { get; set; } public EssgeeMotionKey Joypad1Button2 { get; set; }
//todo Unity [DropDownControl("Controller Port 2", "D-Pad Up", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controller Port 2", "D-Pad Up", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey Joypad2Up { get; set; } public EssgeeMotionKey Joypad2Up { get; set; }
//todo Unity [DropDownControl("Controller Port 2", "D-Pad Down", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controller Port 2", "D-Pad Down", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey Joypad2Down { get; set; } public EssgeeMotionKey Joypad2Down { get; set; }
//todo Unity [DropDownControl("Controller Port 2", "D-Pad Left", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controller Port 2", "D-Pad Left", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey Joypad2Left { get; set; } public EssgeeMotionKey Joypad2Left { get; set; }
//todo Unity [DropDownControl("Controller Port 2", "D-Pad Right", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controller Port 2", "D-Pad Right", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey Joypad2Right { get; set; } public EssgeeMotionKey Joypad2Right { get; set; }
//todo Unity [DropDownControl("Controller Port 2", "Button 1", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controller Port 2", "Button 1", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey Joypad2Button1 { get; set; } public EssgeeMotionKey Joypad2Button1 { get; set; }
//todo Unity [DropDownControl("Controller Port 2", "Button 2", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controller Port 2", "Button 2", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey Joypad2Button2 { get; set; } public EssgeeMotionKey Joypad2Button2 { get; set; }
public SC3000() public SC3000()
{ {
TVStandard = TVStandard.NTSC; TVStandard = TVStandard.NTSC;
InputReset = MotionKey.F12; InputReset = EssgeeMotionKey.F12;
InputChangeMode = MotionKey.F1; InputChangeMode = EssgeeMotionKey.F1;
InputPlayTape = MotionKey.F2; InputPlayTape = EssgeeMotionKey.F2;
Joypad1Up = MotionKey.Up; Joypad1Up = EssgeeMotionKey.Up;
Joypad1Down = MotionKey.Down; Joypad1Down = EssgeeMotionKey.Down;
Joypad1Left = MotionKey.Left; Joypad1Left = EssgeeMotionKey.Left;
Joypad1Right = MotionKey.Right; Joypad1Right = EssgeeMotionKey.Right;
Joypad1Button1 = MotionKey.A; Joypad1Button1 = EssgeeMotionKey.A;
Joypad1Button2 = MotionKey.S; Joypad1Button2 = EssgeeMotionKey.S;
Joypad2Up = MotionKey.NumPad8; Joypad2Up = EssgeeMotionKey.NumPad8;
Joypad2Down = MotionKey.NumPad2; Joypad2Down = EssgeeMotionKey.NumPad2;
Joypad2Left = MotionKey.NumPad4; Joypad2Left = EssgeeMotionKey.NumPad4;
Joypad2Right = MotionKey.NumPad6; Joypad2Right = EssgeeMotionKey.NumPad6;
Joypad2Button1 = MotionKey.NumPad1; Joypad2Button1 = EssgeeMotionKey.NumPad1;
Joypad2Button2 = MotionKey.NumPad3; Joypad2Button2 = EssgeeMotionKey.NumPad3;
} }
} }
} }

View File

@ -12,65 +12,65 @@ namespace Essgee.Emulation.Configuration
//todo Unity [DropDownControl("General", "Pause Button", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("General", "Pause Button", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey InputPause { get; set; } public EssgeeMotionKey InputPause { get; set; }
//todo Unity [DropDownControl("Controller Port 1", "D-Pad Up", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controller Port 1", "D-Pad Up", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey Joypad1Up { get; set; } public EssgeeMotionKey Joypad1Up { get; set; }
//todo Unity [DropDownControl("Controller Port 1", "D-Pad Down", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controller Port 1", "D-Pad Down", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey Joypad1Down { get; set; } public EssgeeMotionKey Joypad1Down { get; set; }
//todo Unity [DropDownControl("Controller Port 1", "D-Pad Left", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controller Port 1", "D-Pad Left", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey Joypad1Left { get; set; } public EssgeeMotionKey Joypad1Left { get; set; }
//todo Unity [DropDownControl("Controller Port 1", "D-Pad Right", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controller Port 1", "D-Pad Right", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey Joypad1Right { get; set; } public EssgeeMotionKey Joypad1Right { get; set; }
//todo Unity [DropDownControl("Controller Port 1", "Button 1", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controller Port 1", "Button 1", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey Joypad1Button1 { get; set; } public EssgeeMotionKey Joypad1Button1 { get; set; }
//todo Unity [DropDownControl("Controller Port 1", "Button 2", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controller Port 1", "Button 2", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey Joypad1Button2 { get; set; } public EssgeeMotionKey Joypad1Button2 { get; set; }
//todo Unity [DropDownControl("Controller Port 2", "D-Pad Up", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controller Port 2", "D-Pad Up", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey Joypad2Up { get; set; } public EssgeeMotionKey Joypad2Up { get; set; }
//todo Unity [DropDownControl("Controller Port 2", "D-Pad Down", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controller Port 2", "D-Pad Down", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey Joypad2Down { get; set; } public EssgeeMotionKey Joypad2Down { get; set; }
//todo Unity [DropDownControl("Controller Port 2", "D-Pad Left", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controller Port 2", "D-Pad Left", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey Joypad2Left { get; set; } public EssgeeMotionKey Joypad2Left { get; set; }
//todo Unity [DropDownControl("Controller Port 2", "D-Pad Right", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controller Port 2", "D-Pad Right", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey Joypad2Right { get; set; } public EssgeeMotionKey Joypad2Right { get; set; }
//todo Unity [DropDownControl("Controller Port 2", "Button 1", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controller Port 2", "Button 1", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey Joypad2Button1 { get; set; } public EssgeeMotionKey Joypad2Button1 { get; set; }
//todo Unity [DropDownControl("Controller Port 2", "Button 2", typeof(Keys), Keys.F11)] //todo Unity [DropDownControl("Controller Port 2", "Button 2", typeof(Keys), Keys.F11)]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public MotionKey Joypad2Button2 { get; set; } public EssgeeMotionKey Joypad2Button2 { get; set; }
public SG1000() public SG1000()
{ {
TVStandard = TVStandard.NTSC; TVStandard = TVStandard.NTSC;
InputPause = MotionKey.Space; InputPause = EssgeeMotionKey.Space;
Joypad1Up = MotionKey.Up; Joypad1Up = EssgeeMotionKey.Up;
Joypad1Down = MotionKey.Down; Joypad1Down = EssgeeMotionKey.Down;
Joypad1Left = MotionKey.Left; Joypad1Left = EssgeeMotionKey.Left;
Joypad1Right = MotionKey.Right; Joypad1Right = EssgeeMotionKey.Right;
Joypad1Button1 = MotionKey.A; Joypad1Button1 = EssgeeMotionKey.A;
Joypad1Button2 = MotionKey.S; Joypad1Button2 = EssgeeMotionKey.S;
Joypad2Up = MotionKey.NumPad8; Joypad2Up = EssgeeMotionKey.NumPad8;
Joypad2Down = MotionKey.NumPad2; Joypad2Down = EssgeeMotionKey.NumPad2;
Joypad2Left = MotionKey.NumPad4; Joypad2Left = EssgeeMotionKey.NumPad4;
Joypad2Right = MotionKey.NumPad6; Joypad2Right = EssgeeMotionKey.NumPad6;
Joypad2Button1 = MotionKey.NumPad1; Joypad2Button1 = EssgeeMotionKey.NumPad1;
Joypad2Button2 = MotionKey.NumPad3; Joypad2Button2 = EssgeeMotionKey.NumPad3;
} }
} }
} }

View File

@ -124,7 +124,7 @@ namespace Essgee.Emulation.Machines
public Configuration.MasterSystem configuration { get; private set; } public Configuration.MasterSystem configuration { get; private set; }
List<MotionKey> lastKeysDown; List<EssgeeMotionKey> lastKeysDown;
//ControllerState lastControllerState; //ControllerState lastControllerState;
MouseButtons lastMouseButtons; MouseButtons lastMouseButtons;
(int x, int y) lastMousePosition; (int x, int y) lastMousePosition;
@ -145,7 +145,7 @@ namespace Essgee.Emulation.Machines
inputDevices[0] = InputDevice.None; inputDevices[0] = InputDevice.None;
inputDevices[1] = InputDevice.None; inputDevices[1] = InputDevice.None;
lastKeysDown = new List<MotionKey>(); lastKeysDown = new List<EssgeeMotionKey>();
//lastControllerState = new ControllerState(); //lastControllerState = new ControllerState();
vdp.EndOfScanline += (s, e) => vdp.EndOfScanline += (s, e) =>

View File

@ -386,84 +386,84 @@ namespace Essgee.Emulation.Machines
/* Handle keyboard */ /* Handle keyboard */
// TODO: Replace hardcoded English layout w/ user-configurable settings // TODO: Replace hardcoded English layout w/ user-configurable settings
keyboard[0, 0] = keysDown.Contains(MotionKey.D1); keyboard[0, 0] = keysDown.Contains(EssgeeMotionKey.D1);
keyboard[0, 1] = keysDown.Contains(MotionKey.D2); keyboard[0, 1] = keysDown.Contains(EssgeeMotionKey.D2);
keyboard[0, 2] = keysDown.Contains(MotionKey.D3); keyboard[0, 2] = keysDown.Contains(EssgeeMotionKey.D3);
keyboard[0, 3] = keysDown.Contains(MotionKey.D4); keyboard[0, 3] = keysDown.Contains(EssgeeMotionKey.D4);
keyboard[0, 4] = keysDown.Contains(MotionKey.D5); keyboard[0, 4] = keysDown.Contains(EssgeeMotionKey.D5);
keyboard[0, 5] = keysDown.Contains(MotionKey.D6); keyboard[0, 5] = keysDown.Contains(EssgeeMotionKey.D6);
keyboard[0, 6] = keysDown.Contains(MotionKey.D7); keyboard[0, 6] = keysDown.Contains(EssgeeMotionKey.D7);
keyboard[1, 0] = keysDown.Contains(MotionKey.Q); keyboard[1, 0] = keysDown.Contains(EssgeeMotionKey.Q);
keyboard[1, 1] = keysDown.Contains(MotionKey.W); keyboard[1, 1] = keysDown.Contains(EssgeeMotionKey.W);
keyboard[1, 2] = keysDown.Contains(MotionKey.E); keyboard[1, 2] = keysDown.Contains(EssgeeMotionKey.E);
keyboard[1, 3] = keysDown.Contains(MotionKey.R); keyboard[1, 3] = keysDown.Contains(EssgeeMotionKey.R);
keyboard[1, 4] = keysDown.Contains(MotionKey.T); keyboard[1, 4] = keysDown.Contains(EssgeeMotionKey.T);
keyboard[1, 5] = keysDown.Contains(MotionKey.Y); keyboard[1, 5] = keysDown.Contains(EssgeeMotionKey.Y);
keyboard[1, 6] = keysDown.Contains(MotionKey.U); keyboard[1, 6] = keysDown.Contains(EssgeeMotionKey.U);
keyboard[2, 0] = keysDown.Contains(MotionKey.A); keyboard[2, 0] = keysDown.Contains(EssgeeMotionKey.A);
keyboard[2, 1] = keysDown.Contains(MotionKey.S); keyboard[2, 1] = keysDown.Contains(EssgeeMotionKey.S);
keyboard[2, 2] = keysDown.Contains(MotionKey.D); keyboard[2, 2] = keysDown.Contains(EssgeeMotionKey.D);
keyboard[2, 3] = keysDown.Contains(MotionKey.F); keyboard[2, 3] = keysDown.Contains(EssgeeMotionKey.F);
keyboard[2, 4] = keysDown.Contains(MotionKey.G); keyboard[2, 4] = keysDown.Contains(EssgeeMotionKey.G);
keyboard[2, 5] = keysDown.Contains(MotionKey.H); keyboard[2, 5] = keysDown.Contains(EssgeeMotionKey.H);
keyboard[2, 6] = keysDown.Contains(MotionKey.J); keyboard[2, 6] = keysDown.Contains(EssgeeMotionKey.J);
keyboard[3, 0] = keysDown.Contains(MotionKey.Z); keyboard[3, 0] = keysDown.Contains(EssgeeMotionKey.Z);
keyboard[3, 1] = keysDown.Contains(MotionKey.X); keyboard[3, 1] = keysDown.Contains(EssgeeMotionKey.X);
keyboard[3, 2] = keysDown.Contains(MotionKey.C); keyboard[3, 2] = keysDown.Contains(EssgeeMotionKey.C);
keyboard[3, 3] = keysDown.Contains(MotionKey.V); keyboard[3, 3] = keysDown.Contains(EssgeeMotionKey.V);
keyboard[3, 4] = keysDown.Contains(MotionKey.B); keyboard[3, 4] = keysDown.Contains(EssgeeMotionKey.B);
keyboard[3, 5] = keysDown.Contains(MotionKey.N); keyboard[3, 5] = keysDown.Contains(EssgeeMotionKey.N);
keyboard[3, 6] = keysDown.Contains(MotionKey.M); keyboard[3, 6] = keysDown.Contains(EssgeeMotionKey.M);
keyboard[4, 0] = keysDown.Contains(MotionKey.None); // Alphanumerics, Eng Dier's keyboard[4, 0] = keysDown.Contains(EssgeeMotionKey.None); // Alphanumerics, Eng Dier's
keyboard[4, 1] = keysDown.Contains(MotionKey.Space); keyboard[4, 1] = keysDown.Contains(EssgeeMotionKey.Space);
keyboard[4, 2] = keysDown.Contains(MotionKey.Home); // Clr, Home keyboard[4, 2] = keysDown.Contains(EssgeeMotionKey.Home); // Clr, Home
keyboard[4, 3] = keysDown.Contains(MotionKey.Back); // Del, Ins keyboard[4, 3] = keysDown.Contains(EssgeeMotionKey.Back); // Del, Ins
keyboard[4, 4] = keysDown.Contains(MotionKey.None); // Not on English keyboard? keyboard[4, 4] = keysDown.Contains(EssgeeMotionKey.None); // Not on English keyboard?
keyboard[4, 5] = keysDown.Contains(MotionKey.None); // "" keyboard[4, 5] = keysDown.Contains(EssgeeMotionKey.None); // ""
keyboard[4, 6] = keysDown.Contains(MotionKey.None); // "" keyboard[4, 6] = keysDown.Contains(EssgeeMotionKey.None); // ""
keyboard[5, 0] = keysDown.Contains(MotionKey.Oemcomma); keyboard[5, 0] = keysDown.Contains(EssgeeMotionKey.Oemcomma);
keyboard[5, 1] = keysDown.Contains(MotionKey.OemPeriod); keyboard[5, 1] = keysDown.Contains(EssgeeMotionKey.OemPeriod);
keyboard[5, 2] = keysDown.Contains(MotionKey.OemQuestion); // Forward slash keyboard[5, 2] = keysDown.Contains(EssgeeMotionKey.OemQuestion); // Forward slash
keyboard[5, 3] = keysDown.Contains(MotionKey.None); // Pi keyboard[5, 3] = keysDown.Contains(EssgeeMotionKey.None); // Pi
keyboard[5, 4] = keysDown.Contains(MotionKey.Down); keyboard[5, 4] = keysDown.Contains(EssgeeMotionKey.Down);
keyboard[5, 5] = keysDown.Contains(MotionKey.Left); keyboard[5, 5] = keysDown.Contains(EssgeeMotionKey.Left);
keyboard[5, 6] = keysDown.Contains(MotionKey.Right); keyboard[5, 6] = keysDown.Contains(EssgeeMotionKey.Right);
keyboard[6, 0] = keysDown.Contains(MotionKey.K); keyboard[6, 0] = keysDown.Contains(EssgeeMotionKey.K);
keyboard[6, 1] = keysDown.Contains(MotionKey.L); keyboard[6, 1] = keysDown.Contains(EssgeeMotionKey.L);
keyboard[6, 2] = keysDown.Contains(MotionKey.Oemplus); // Semicolon keyboard[6, 2] = keysDown.Contains(EssgeeMotionKey.Oemplus); // Semicolon
keyboard[6, 3] = keysDown.Contains(MotionKey.OemSemicolon); // Colon keyboard[6, 3] = keysDown.Contains(EssgeeMotionKey.OemSemicolon); // Colon
keyboard[6, 4] = keysDown.Contains(MotionKey.OemCloseBrackets); keyboard[6, 4] = keysDown.Contains(EssgeeMotionKey.OemCloseBrackets);
keyboard[6, 5] = keysDown.Contains(MotionKey.Enter); keyboard[6, 5] = keysDown.Contains(EssgeeMotionKey.Enter);
keyboard[6, 6] = keysDown.Contains(MotionKey.Up); keyboard[6, 6] = keysDown.Contains(EssgeeMotionKey.Up);
keyboard[7, 0] = keysDown.Contains(MotionKey.I); keyboard[7, 0] = keysDown.Contains(EssgeeMotionKey.I);
keyboard[7, 1] = keysDown.Contains(MotionKey.O); keyboard[7, 1] = keysDown.Contains(EssgeeMotionKey.O);
keyboard[7, 2] = keysDown.Contains(MotionKey.P); keyboard[7, 2] = keysDown.Contains(EssgeeMotionKey.P);
keyboard[7, 3] = keysDown.Contains(MotionKey.PageUp); // @ keyboard[7, 3] = keysDown.Contains(EssgeeMotionKey.PageUp); // @
keyboard[7, 4] = keysDown.Contains(MotionKey.OemOpenBrackets); keyboard[7, 4] = keysDown.Contains(EssgeeMotionKey.OemOpenBrackets);
keyboard[7, 5] = keysDown.Contains(MotionKey.None); // Not on English keyboard? keyboard[7, 5] = keysDown.Contains(EssgeeMotionKey.None); // Not on English keyboard?
keyboard[7, 6] = keysDown.Contains(MotionKey.None); // "" keyboard[7, 6] = keysDown.Contains(EssgeeMotionKey.None); // ""
keyboard[8, 0] = keysDown.Contains(MotionKey.D8); keyboard[8, 0] = keysDown.Contains(EssgeeMotionKey.D8);
keyboard[8, 1] = keysDown.Contains(MotionKey.D9); keyboard[8, 1] = keysDown.Contains(EssgeeMotionKey.D9);
keyboard[8, 2] = keysDown.Contains(MotionKey.D0); keyboard[8, 2] = keysDown.Contains(EssgeeMotionKey.D0);
keyboard[8, 3] = keysDown.Contains(MotionKey.OemMinus); keyboard[8, 3] = keysDown.Contains(EssgeeMotionKey.OemMinus);
keyboard[8, 4] = keysDown.Contains(MotionKey.Oemtilde); // ^, ~ keyboard[8, 4] = keysDown.Contains(EssgeeMotionKey.Oemtilde); // ^, ~
keyboard[8, 5] = keysDown.Contains(MotionKey.OemPipe); // Yen, Pipe, Pound? keyboard[8, 5] = keysDown.Contains(EssgeeMotionKey.OemPipe); // Yen, Pipe, Pound?
keyboard[8, 6] = keysDown.Contains(MotionKey.PageDown); // Break keyboard[8, 6] = keysDown.Contains(EssgeeMotionKey.PageDown); // Break
keyboard[9, 6] = keysDown.Contains(MotionKey.RControlKey); // Graph keyboard[9, 6] = keysDown.Contains(EssgeeMotionKey.RControlKey); // Graph
keyboard[10, 6] = keysDown.Contains(MotionKey.LControlKey); // Ctrl keyboard[10, 6] = keysDown.Contains(EssgeeMotionKey.LControlKey); // Ctrl
keyboard[11, 5] = keysDown.Contains(MotionKey.Tab); // Func keyboard[11, 5] = keysDown.Contains(EssgeeMotionKey.Tab); // Func
keyboard[11, 6] = keysDown.Contains(MotionKey.ShiftKey); // Shift keyboard[11, 6] = keysDown.Contains(EssgeeMotionKey.ShiftKey); // Shift
} }
else else
{ {

View File

@ -1,12 +1,8 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Essgee namespace Essgee
{ {
public enum ScreenSizeMode { Stretch, Scale, Integer } public enum ScreenSizeMode { Stretch, Scale, Integer }
public enum ExceptionResult { Continue, StopEmulation, ExitApplication } public enum ExceptionResult { Continue, StopEmulation, ExitApplication }

View File

@ -1,6 +1,3 @@
using System;
using UnityEngine;
public interface IEssgeeLogger public interface IEssgeeLogger
{ {
void Debug(string message); void Debug(string message);

View File

@ -1,11 +1,9 @@
using System.Runtime.InteropServices;
using System; using System;
using UnityEngine; using System.Runtime.InteropServices;
using System.ComponentModel;
[Flags] [Flags]
[ComVisible(true)] [ComVisible(true)]
public enum MotionKey public enum EssgeeMotionKey
{ {
KeyCode = 0xFFFF, KeyCode = 0xFFFF,
Modifiers = -65536, Modifiers = -65536,

View File

@ -6,7 +6,7 @@ namespace Essgee.EventArguments
{ {
public class PollInputEventArgs : EventArgs public class PollInputEventArgs : EventArgs
{ {
public List<MotionKey> Keyboard { get; set; } public List<EssgeeMotionKey> Keyboard { get; set; }
public MouseButtons MouseButtons { get; set; } public MouseButtons MouseButtons { get; set; }
public (int X, int Y) MousePosition { get; set; } public (int X, int Y) MousePosition { get; set; }
@ -27,7 +27,7 @@ namespace Essgee.EventArguments
{ {
var eventArgs = ObjectPoolAuto.Acquire<PollInputEventArgs>(); var eventArgs = ObjectPoolAuto.Acquire<PollInputEventArgs>();
//eventArgs.Keyboard = new List<MotionKey>(); //eventArgs.Keyboard = new List<MotionKey>();
eventArgs.Keyboard = ObjectPoolAuto.AcquireList<MotionKey>(); eventArgs.Keyboard = ObjectPoolAuto.AcquireList<EssgeeMotionKey>();
eventArgs.MouseButtons = MouseButtons.None; eventArgs.MouseButtons = MouseButtons.None;
eventArgs.MousePosition = (0, 0); eventArgs.MousePosition = (0, 0);

View File

@ -1,11 +0,0 @@
//namespace Essgee.Extensions
//{
// public static class FormExtensionMethods
// {
// public static void CheckInvokeMethod(this Form form, MethodInvoker methodInvoker)
// {
// if (form.InvokeRequired) form.BeginInvoke(methodInvoker);
// else methodInvoker();
// }
// }
//}

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 6f4a1f0be012aa141a62c9f7259b614c

View File

@ -1,15 +1,9 @@
using System; using Newtonsoft.Json;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO; using System.IO;
using Newtonsoft.Json;
namespace Essgee.Extensions namespace Essgee.Extensions
{ {
public static class SerializationExtensionMethods public static class SerializationExtensionMethods
{ {
public static void SerializeToFile(this object obj, string jsonFileName) public static void SerializeToFile(this object obj, string jsonFileName)
{ {

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 414f2e9f45929a04a9c56ae02bd0ff9e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,28 +0,0 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using System.Threading.Tasks;
//namespace Essgee.Graphics
//{
// public enum FilterMode
// {
// Linear,
// Nearest
// }
// public enum WrapMode
// {
// Repeat,
// Edge,
// Border,
// Mirror
// }
// public enum PixelFormat
// {
// Rgba8888,
// Rgb888
// }
//}

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: eedf5bf3a0ae6eb41acf730b466dabc9

View File

@ -1,140 +0,0 @@
//using System;
//using System.Reflection;
//using System.Reflection.Emit;
//namespace Essgee.Graphics
//{
// /* http://www.codeproject.com/Articles/14593/A-General-Fast-Method-Invoker */
// internal delegate object FastInvokeHandler(object target, object[] paramters);
// internal class FastMethodInvoker
// {
// public static FastInvokeHandler GetMethodInvoker(MethodInfo methodInfo)
// {
// DynamicMethod dynamicMethod = new DynamicMethod(string.Empty, typeof(object), new Type[] { typeof(object), typeof(object[]) }, methodInfo.DeclaringType.Module);
// ILGenerator il = dynamicMethod.GetILGenerator();
// ParameterInfo[] ps = methodInfo.GetParameters();
// Type[] paramTypes = new Type[ps.Length];
// for (int i = 0; i < paramTypes.Length; i++)
// {
// if (ps[i].ParameterType.IsByRef)
// paramTypes[i] = ps[i].ParameterType.GetElementType();
// else
// paramTypes[i] = ps[i].ParameterType;
// }
// LocalBuilder[] locals = new LocalBuilder[paramTypes.Length];
// for (int i = 0; i < paramTypes.Length; i++)
// locals[i] = il.DeclareLocal(paramTypes[i], true);
// for (int i = 0; i < paramTypes.Length; i++)
// {
// il.Emit(OpCodes.Ldarg_1);
// EmitFastInt(il, i);
// il.Emit(OpCodes.Ldelem_Ref);
// EmitCastToReference(il, paramTypes[i]);
// il.Emit(OpCodes.Stloc, locals[i]);
// }
// if (!methodInfo.IsStatic)
// il.Emit(OpCodes.Ldarg_0);
// for (int i = 0; i < paramTypes.Length; i++)
// {
// if (ps[i].ParameterType.IsByRef)
// il.Emit(OpCodes.Ldloca_S, locals[i]);
// else
// il.Emit(OpCodes.Ldloc, locals[i]);
// }
// if (methodInfo.IsStatic)
// il.EmitCall(OpCodes.Call, methodInfo, null);
// else
// il.EmitCall(OpCodes.Callvirt, methodInfo, null);
// if (methodInfo.ReturnType == typeof(void))
// il.Emit(OpCodes.Ldnull);
// else
// EmitBoxIfNeeded(il, methodInfo.ReturnType);
// for (int i = 0; i < paramTypes.Length; i++)
// {
// if (ps[i].ParameterType.IsByRef)
// {
// il.Emit(OpCodes.Ldarg_1);
// EmitFastInt(il, i);
// il.Emit(OpCodes.Ldloc, locals[i]);
// if (locals[i].LocalType.IsValueType)
// il.Emit(OpCodes.Box, locals[i].LocalType);
// il.Emit(OpCodes.Stelem_Ref);
// }
// }
// il.Emit(OpCodes.Ret);
// FastInvokeHandler invoder = (FastInvokeHandler)dynamicMethod.CreateDelegate(typeof(FastInvokeHandler));
// return invoder;
// }
// private static void EmitCastToReference(ILGenerator il, Type type)
// {
// if (type.IsValueType)
// il.Emit(OpCodes.Unbox_Any, type);
// else
// il.Emit(OpCodes.Castclass, type);
// }
// private static void EmitBoxIfNeeded(ILGenerator il, Type type)
// {
// if (type.IsValueType)
// il.Emit(OpCodes.Box, type);
// }
// private static void EmitFastInt(ILGenerator il, int value)
// {
// switch (value)
// {
// case -1:
// il.Emit(OpCodes.Ldc_I4_M1);
// return;
// case 0:
// il.Emit(OpCodes.Ldc_I4_0);
// return;
// case 1:
// il.Emit(OpCodes.Ldc_I4_1);
// return;
// case 2:
// il.Emit(OpCodes.Ldc_I4_2);
// return;
// case 3:
// il.Emit(OpCodes.Ldc_I4_3);
// return;
// case 4:
// il.Emit(OpCodes.Ldc_I4_4);
// return;
// case 5:
// il.Emit(OpCodes.Ldc_I4_5);
// return;
// case 6:
// il.Emit(OpCodes.Ldc_I4_6);
// return;
// case 7:
// il.Emit(OpCodes.Ldc_I4_7);
// return;
// case 8:
// il.Emit(OpCodes.Ldc_I4_8);
// return;
// }
// if (value > -129 && value < 128)
// il.Emit(OpCodes.Ldc_I4_S, (sbyte)value);
// else
// il.Emit(OpCodes.Ldc_I4, value);
// }
// }
//}

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: d46aa7b243f39584b93c79dc84079999

View File

@ -1,247 +0,0 @@
//using Essgee.Graphics.Shaders;
//using System;
//using System.ComponentModel;
//using System.Diagnostics;
//using System.Drawing;
//namespace Essgee.Graphics
//{
// public class GraphicsHandler : IDisposable
// {
// static readonly CommonVertex[] vertices = new CommonVertex[]
// {
// new CommonVertex() { Position = new Vector3(0.0f, 1.0f, 0.0f), TexCoord = new Vector2(0.0f, 1.0f), Color = Color4.White },
// new CommonVertex() { Position = new Vector3(0.0f, 0.0f, 0.0f), TexCoord = new Vector2(0.0f, 0.0f), Color = Color4.White },
// new CommonVertex() { Position = new Vector3(1.0f, 0.0f, 0.0f), TexCoord = new Vector2(1.0f, 0.0f), Color = Color4.White },
// new CommonVertex() { Position = new Vector3(1.0f, 1.0f, 0.0f), TexCoord = new Vector2(1.0f, 1.0f), Color = Color4.White }
// };
// static readonly byte[] indices = new byte[] { 0, 1, 2, 2, 3, 0 };
// public string GLRenderer { get; private set; }
// public string GLVersion { get; private set; }
// VertexBuffer vertexBuffer;
// ShaderBundle shaderBundle;
// Texture[] textures;
// int lastTextureUpdate;
// OnScreenDisplayHandler onScreenDisplayHandler;
// (int Width, int Height) textureSize;
// (int X, int Y, int Width, int Height) inputViewport, outputViewport;
// Matrix4 projectionMatrix, modelviewMatrix;
// bool refreshRendererAndShader;
// Stopwatch stopwatch;
// float deltaTime;
// bool disposed = false;
// public GraphicsHandler(OnScreenDisplayHandler osdHandler)
// {
// onScreenDisplayHandler = osdHandler;
// if (AppEnvironment.EnableOpenGLDebug)
// GL.Enable(EnableCap.DebugOutput);
// GLRenderer = GL.GetString(StringName.Renderer);
// GLVersion = GL.GetString(StringName.Version);
// GL.Enable(EnableCap.Blend);
// GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha);
// vertexBuffer = new VertexBuffer();
// vertexBuffer.SetVertexData(vertices);
// vertexBuffer.SetIndices(indices);
// textures = new Texture[ShaderBundle.MaxNumSourceSamplers];
// lastTextureUpdate = 0;
// projectionMatrix = Matrix4.Identity;
// modelviewMatrix = Matrix4.Identity;
// stopwatch = Stopwatch.StartNew();
// Application.Idle += (s, e) =>
// {
// if (LicenseManager.UsageMode == LicenseUsageMode.Designtime || GraphicsContext.CurrentContext == null) return;
// stopwatch.Stop();
// deltaTime = (float)stopwatch.Elapsed.TotalMilliseconds / 10.0f;
// stopwatch.Reset();
// stopwatch.Start();
// };
// onScreenDisplayHandler.EnqueueMessageSuccess($"Graphics initialized; {GLRenderer}, {GLVersion}.");
// }
// ~GraphicsHandler()
// {
// Dispose(false);
// }
// public void Dispose()
// {
// Dispose(true);
// GC.SuppressFinalize(this);
// }
// protected virtual void Dispose(bool disposing)
// {
// if (disposed) return;
// if (disposing)
// {
// if (vertexBuffer != null) vertexBuffer.Dispose();
// if (shaderBundle != null) shaderBundle.Dispose();
// }
// disposed = true;
// }
// public void LoadShaderBundle(string shaderName)
// {
// var lastShaderFilter = shaderBundle?.Manifest.Filter;
// var lastShaderWrap = shaderBundle?.Manifest.Wrap;
// shaderBundle = new ShaderBundle(shaderName, typeof(CommonVertex));
// if ((lastShaderFilter != null && lastShaderFilter != shaderBundle.Manifest.Filter) || (lastShaderWrap != null && lastShaderWrap != shaderBundle.Manifest.Wrap))
// CreateTextures();
// FlushTextures();
// refreshRendererAndShader = true;
// onScreenDisplayHandler.EnqueueMessage($"Loaded shader '{shaderName}'.");
// }
// public void SetTextureSize(int width, int height)
// {
// textureSize = (width, height);
// CreateTextures();
// refreshRendererAndShader = true;
// }
// private void CreateTextures()
// {
// if (textureSize.Width == 0 || textureSize.Height == 0)
// return;
// for (int i = 0; i < textures.Length; i++)
// textures[i] = new Texture(textureSize.Width, textureSize.Height, PixelFormat.Rgba8888, shaderBundle.Manifest.Filter, shaderBundle.Manifest.Wrap);
// lastTextureUpdate = 0;
// }
// public void SetTextureData(byte[] data)
// {
// textures[lastTextureUpdate].SetData(data);
// lastTextureUpdate++;
// if (lastTextureUpdate >= shaderBundle.Manifest.Samplers) lastTextureUpdate = 0;
// }
// public void SetScreenViewport((int, int, int, int) viewport)
// {
// inputViewport = viewport;
// lastTextureUpdate = 0;
// refreshRendererAndShader = true;
// }
// public void FlushTextures()
// {
// for (int i = 0; i < shaderBundle.Manifest.Samplers; i++)
// textures[i]?.ClearData();
// lastTextureUpdate = 0;
// refreshRendererAndShader = true;
// }
// public void Resize(Rectangle clientRectangle, Size screenSize)
// {
// GL.Viewport(0, 0, clientRectangle.Width, clientRectangle.Height);
// projectionMatrix = Matrix4.CreateOrthographicOffCenter(0.0f, clientRectangle.Width, clientRectangle.Height, 0.0f, -10.0f, 10.0f);
// switch (Program.Configuration.ScreenSizeMode)
// {
// case ScreenSizeMode.Stretch:
// {
// modelviewMatrix = Matrix4.CreateScale(clientRectangle.Width, clientRectangle.Height, 1.0f);
// outputViewport = (clientRectangle.X, clientRectangle.Y, clientRectangle.Width, clientRectangle.Height);
// }
// break;
// case ScreenSizeMode.Scale:
// {
// var multiplier = (float)Math.Min(clientRectangle.Width / (double)screenSize.Width, clientRectangle.Height / (double)screenSize.Height);
// var adjustedWidth = screenSize.Width * multiplier;
// var adjustedHeight = screenSize.Height * multiplier;
// var adjustedX = (float)Math.Floor((clientRectangle.Width - adjustedWidth) / 2.0f);
// var adjustedY = (float)Math.Floor((clientRectangle.Height - adjustedHeight) / 2.0f);
// modelviewMatrix = Matrix4.CreateScale(adjustedWidth, adjustedHeight, 1.0f) * Matrix4.CreateTranslation(adjustedX, adjustedY, 1.0f);
// outputViewport = (clientRectangle.X, clientRectangle.Y, clientRectangle.Width, clientRectangle.Height);
// }
// break;
// case ScreenSizeMode.Integer:
// {
// var multiplier = (float)Math.Min(Math.Floor(clientRectangle.Width / (double)inputViewport.Width), Math.Floor(clientRectangle.Height / (double)inputViewport.Height));
// var adjustedWidth = inputViewport.Width * multiplier;
// var adjustedHeight = inputViewport.Height * multiplier;
// var adjustedX = (float)Math.Floor((clientRectangle.Width - adjustedWidth) / 2.0f);
// var adjustedY = (float)Math.Floor((clientRectangle.Height - adjustedHeight) / 2.0f);
// modelviewMatrix = Matrix4.CreateScale(adjustedWidth, adjustedHeight, 1.0f) * Matrix4.CreateTranslation(adjustedX, adjustedY, 1.0f);
// outputViewport = ((int)adjustedX, (int)adjustedY, (int)adjustedWidth, (int)adjustedHeight);
// }
// break;
// }
// onScreenDisplayHandler.SetViewport((clientRectangle.X, clientRectangle.Y, clientRectangle.Width, clientRectangle.Height));
// onScreenDisplayHandler.SetProjectionMatrix(projectionMatrix);
// onScreenDisplayHandler.SetModelviewMatrix(modelviewMatrix);
// refreshRendererAndShader = true;
// }
// public void Render()
// {
// if (refreshRendererAndShader)
// {
// shaderBundle.SetTextureSize(new Vector2(textureSize.Width, textureSize.Height));
// shaderBundle.SetInputViewport(new Vector4(inputViewport.X, inputViewport.Y, inputViewport.Width, inputViewport.Height));
// shaderBundle.SetOutputViewport(new Vector4(outputViewport.X, outputViewport.Y, outputViewport.Width, outputViewport.Height));
// shaderBundle.SetProjectionMatrix(projectionMatrix);
// shaderBundle.SetModelviewMatrix(modelviewMatrix);
// GC.Collect();
// refreshRendererAndShader = false;
// }
// for (int i = 0; i < shaderBundle.Manifest.Samplers; i++)
// textures[i]?.Activate(TextureUnit.Texture0 + ((lastTextureUpdate + i) % shaderBundle.Manifest.Samplers));
// shaderBundle.Activate();
// vertexBuffer.Render();
// onScreenDisplayHandler.Render(deltaTime);
// }
// }
//}

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 20fd3917138ed8943be76a9d49cd4327

View File

@ -1,374 +0,0 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using System.Threading.Tasks;
//using System.Drawing;
//using System.Runtime.InteropServices;
//using System.Reflection;
//using OpenTK;
//using OpenTK.Graphics;
//using Essgee.Graphics.Shaders;
//namespace Essgee.Graphics
//{
// public class OnScreenDisplayHandler : IDisposable
// {
// readonly static int messageDefaultSeconds = 5;
// readonly static int maxStringListLength = 128;
// readonly static int stringListPurgeSize = 16;
// readonly static string glslUniformProjection = "projection";
// readonly static string glslUniformModelview = "modelview";
// readonly static string glslUniformSourceSampler = "source";
// readonly static string glslUniformTextColor = "textColor";
// readonly static string glslUniformFontSize = "fontSize";
// readonly static string glslUniformCharacterOffset = "characterOffset";
// readonly static string glslVersion = "#version 300 es\n";
// readonly static string glslESPrecision = "precision mediump float; precision mediump int;\n";
// readonly static string glslMainStart = "void main(void){";
// readonly static string glslMainEnd = "}\n";
// readonly static string vertexUniforms = $"uniform mat4 {glslUniformProjection}; uniform mat4 {glslUniformModelview};\n";
// readonly static string vertexOuts = "out vec2 vertTexCoord;\n";
// readonly static string vertexMain = $"vertTexCoord = inTextureCoords; gl_Position = {glslUniformProjection} * {glslUniformModelview} * vec4(inPosition.x, inPosition.y, 0.0, 1.0);\n";
// readonly static string fragmentUniforms = $"uniform sampler2D {glslUniformSourceSampler}; uniform vec4 {glslUniformTextColor}; uniform vec2 {glslUniformFontSize}; uniform vec2 {glslUniformCharacterOffset};\n";
// readonly static string fragmentIns = "in vec2 vertTexCoord;\n";
// readonly static string fragmentOuts = "out vec4 fragColor;\n";
// readonly static string fragmentMain =
// $"vec2 localTexCoord = vec2(({glslUniformCharacterOffset}.x + vertTexCoord.x) / {glslUniformFontSize}.x, ({glslUniformCharacterOffset}.y + vertTexCoord.y) / {glslUniformFontSize}.y);\n" +
// $"vec4 outColor = textColor * texture(source, localTexCoord);\n" +
// "if(outColor.a == 0.0) discard;\n" +
// "fragColor = outColor;\n";
// readonly static ushort[] characterIndices = new ushort[] { 0, 1, 2, 2, 3, 0 };
// readonly static Color4 colorSuccess = new Color4(192, 255, 192, 255);
// readonly static Color4 colorWarning = new Color4(255, 192, 160, 255);
// readonly static Color4 colorError = new Color4(255, 128, 128, 255);
// readonly static Color4 colorCore = new Color4(192, 192, 255, 255);
// readonly static Color4 colorDebug = new Color4(192, 128, 255, 255);
// readonly OnScreenDisplayVertex[] characterVertices;
// readonly List<VertexElement> vertexElements;
// readonly int vertexStructSize;
// readonly VertexBuffer characterVertexBuffer;
// readonly Texture fontTexture;
// readonly float characterSourceSize;
// readonly float characterDefaultWidth;
// readonly GLSLShader shader;
// readonly Dictionary<char, Vector2> characterOffsetDict;
// readonly Dictionary<char, (float start, float width)> characterWidthDict;
// readonly List<OnScreenDisplayMessage> stringList;
// (int X, int Y, int Width, int Height) viewport;
// bool disposed = false;
// public OnScreenDisplayHandler(Bitmap osdFontBitmap)
// {
// characterSourceSize = (osdFontBitmap.Width / 16.0f);
// characterDefaultWidth = characterSourceSize - (2.0f * (characterSourceSize / 8));
// characterOffsetDict = new Dictionary<char, Vector2>();
// characterWidthDict = new Dictionary<char, (float, float)>();
// for (var ch = '\0'; ch < (char)((osdFontBitmap.Width / characterSourceSize) * (osdFontBitmap.Height / characterSourceSize)); ch++)
// {
// float x = (ch % (osdFontBitmap.Width / (int)characterSourceSize)) * characterSourceSize;
// float y = (ch / (osdFontBitmap.Width / (int)characterSourceSize)) * characterSourceSize;
// float width = characterSourceSize;
// float start = 0.0f;
// for (float xc = x + (characterSourceSize - 1); xc >= x; xc--)
// {
// var pixel = osdFontBitmap.GetPixel((int)xc, (int)y);
// if (pixel.R == 0xFF && pixel.G == 0x00 && pixel.B == 0x00 && pixel.A == 0xFF)
// {
// width = (xc - x);
// osdFontBitmap.SetPixel((int)xc, (int)y, Color.Transparent);
// }
// if (pixel.R == 0xFF && pixel.G == 0xFF && pixel.B == 0x00 && pixel.A == 0xFF)
// {
// start = (xc - x);
// osdFontBitmap.SetPixel((int)xc, (int)y, Color.Transparent);
// }
// }
// characterOffsetDict.Add(ch, new Vector2(x, y));
// characterWidthDict.Add(ch, (start, width));
// }
// fontTexture = new Texture(osdFontBitmap, filter: FilterMode.Nearest);
// (vertexElements, vertexStructSize) = VertexBuffer.DeconstructVertexLayout<OnScreenDisplayVertex>();
// characterVertices = new OnScreenDisplayVertex[]
// {
// new OnScreenDisplayVertex() { Position = new Vector2(0.0f, characterSourceSize), TextureCoords = new Vector2(0.0f, characterSourceSize) },
// new OnScreenDisplayVertex() { Position = new Vector2(0.0f, 0.0f), TextureCoords = new Vector2(0.0f, 0.0f) },
// new OnScreenDisplayVertex() { Position = new Vector2(characterSourceSize, 0.0f), TextureCoords = new Vector2(characterSourceSize, 0.0f) },
// new OnScreenDisplayVertex() { Position = new Vector2(characterSourceSize, characterSourceSize), TextureCoords = new Vector2(characterSourceSize, characterSourceSize) },
// };
// characterVertexBuffer = new VertexBuffer();
// characterVertexBuffer.SetVertexData(characterVertices);
// characterVertexBuffer.SetIndices(characterIndices);
// shader = new GLSLShader();
// shader.SetVertexShaderCode(glslVersion, glslESPrecision, vertexUniforms, VertexBuffer.GetShaderPreamble(vertexElements), vertexOuts, glslMainStart, vertexMain, glslMainEnd);
// shader.SetFragmentShaderCode(glslVersion, glslESPrecision, fragmentUniforms, fragmentIns, fragmentOuts, glslMainStart, fragmentMain, glslMainEnd);
// shader.LinkProgram();
// shader.SetUniformMatrix(glslUniformProjection, false, Matrix4.Identity);
// shader.SetUniformMatrix(glslUniformModelview, false, Matrix4.Identity);
// shader.SetUniform(glslUniformSourceSampler, 0);
// shader.SetUniform(glslUniformTextColor, Color4.White);
// shader.SetUniform(glslUniformFontSize, new Vector2(fontTexture.Width, fontTexture.Height));
// shader.SetUniform(glslUniformCharacterOffset, Vector2.Zero);
// stringList = new List<OnScreenDisplayMessage>();
// }
// ~OnScreenDisplayHandler()
// {
// Dispose(false);
// }
// public void Dispose()
// {
// Dispose(true);
// GC.SuppressFinalize(this);
// }
// protected virtual void Dispose(bool disposing)
// {
// if (disposed) return;
// if (disposing)
// {
// if (fontTexture != null) fontTexture.Dispose();
// if (characterVertexBuffer != null) characterVertexBuffer.Dispose();
// if (shader != null) shader.Dispose();
// }
// disposed = true;
// }
// public void SetViewport(ValueTuple<int, int, int, int> view)
// {
// viewport = view;
// }
// public void SetProjectionMatrix(Matrix4 mat4)
// {
// shader.SetUniformMatrix(glslUniformProjection, false, mat4);
// }
// public void SetModelviewMatrix(Matrix4 mat4)
// {
// shader.SetUniformMatrix(glslUniformModelview, false, mat4);
// }
// public void SendString(string str, int x, int y)
// {
// SendString(str, x, y, Color4.White);
// }
// public void SendString(string str, int x, int y, Color4 color)
// {
// stringList.Add(new OnScreenDisplayMessage()
// {
// X = x,
// Y = y,
// Color = color,
// Text = str,
// ShowUntil = DateTime.Now,
// IsLogEntry = false
// });
// }
// public void EnqueueMessage(string str)
// {
// EnqueueMessage(str, Color4.White);
// }
// public void EnqueueMessage(string str, Color4 color)
// {
// var split = str.Split(new string[] { Environment.NewLine, "\n" }, StringSplitOptions.RemoveEmptyEntries);
// for (var i = 0; i < split.Length; i++)
// {
// stringList.Add(new OnScreenDisplayMessage()
// {
// X = 0,
// Y = 0,
// Color = color,
// Text = split[i],
// ShowUntil = DateTime.Now + TimeSpan.FromTicks(i) + TimeSpan.FromSeconds(messageDefaultSeconds),
// IsLogEntry = true
// });
// }
// }
// public void EnqueueMessageSuccess(string str)
// {
// EnqueueMessage(str, colorSuccess);
// }
// public void EnqueueMessageWarning(string str)
// {
// EnqueueMessage(str, colorWarning);
// }
// public void EnqueueMessageError(string str)
// {
// EnqueueMessage(str, colorError);
// }
// public void EnqueueMessageCore(string str)
// {
// EnqueueMessage(str, colorCore);
// }
// public void EnqueueMessageDebug(string str)
// {
// if (Program.AppEnvironment.DebugMode)
// EnqueueMessage(str, colorDebug);
// }
// public void Render(float deltaTime)
// {
// shader.Activate();
// fontTexture.Activate();
// RenderStrings(deltaTime);
// RenderLogMessages(deltaTime);
// stringList.RemoveAll(x => !x.IsLogEntry && x.ShowUntil < DateTime.Now);
// stringList.RemoveAll(x => x.IsLogEntry && x.Color.A <= 0.0f);
// if (stringList.Count > maxStringListLength)
// stringList.RemoveRange(0, stringListPurgeSize);
// fontTexture.Deactivate();
// }
// private int MeasureString(string @string)
// {
// float width = 0.0f;
// foreach (var ch in @string)
// {
// if (characterWidthDict.ContainsKey(ch))
// {
// width -= characterWidthDict[ch].start;
// width += characterWidthDict[ch].width;
// }
// else
// width += characterDefaultWidth;
// }
// return (int)width;
// }
// private void RenderStrings(float deltaTime)
// {
// foreach (var @string in stringList.ToList().Where(x => !x.IsLogEntry))
// {
// float x = @string.X, y = @string.Y;
// if (x < 0.0f) x = (viewport.Width + x) - MeasureString(@string.Text);
// if (y < 0.0f) y = (viewport.Height + y) - characterSourceSize;
// shader.SetUniform(glslUniformTextColor, @string.Color);
// ParseAndRenderString(@string, ref x, ref y);
// }
// }
// private void RenderLogMessages(float deltaTime)
// {
// var logY = (viewport.Height - (characterSourceSize + (characterSourceSize / 2)));
// foreach (var @string in stringList.ToList().Where(x => x.IsLogEntry).OrderByDescending(x => x.ShowUntil))
// {
// float x = characterSourceSize / 2.0f, y = logY;
// logY -= characterSourceSize;
// shader.SetUniform(glslUniformTextColor, @string.Color);
// ParseAndRenderString(@string, ref x, ref y);
// if ((logY + characterSourceSize) < 0) break;
// }
// var timeNow = DateTime.Now;
// foreach (var @string in stringList.ToList().Where(x => x.IsLogEntry))
// {
// if ((@string.ShowUntil.Ticks - timeNow.Ticks) < TimeSpan.TicksPerSecond)
// @string.Color = new Color4(@string.Color.R, @string.Color.G, @string.Color.B, Math.Max(0.0f, @string.Color.A - (deltaTime / 25.0f)));
// }
// }
// private void ParseAndRenderString(OnScreenDisplayMessage @string, ref float x, ref float y)
// {
// foreach (var c in @string.Text)
// {
// var ch = c;
// if (!characterWidthDict.ContainsKey(ch))
// ch = '\0';
// x -= characterWidthDict[ch].start;
// if (ch == '\n' || ch == '\r')
// {
// x = @string.X;
// y += characterSourceSize;
// continue;
// }
// else if (ch != ' ')
// {
// var osdModelview = Matrix4.Identity;
// osdModelview *= Matrix4.CreateTranslation(x, y, 0.0f);
// shader.SetUniformMatrix(glslUniformModelview, false, osdModelview);
// shader.SetUniform(glslUniformCharacterOffset, characterOffsetDict[ch]);
// characterVertexBuffer.Render();
// }
// x += characterWidthDict[ch].width;
// }
// }
// [StructLayout(LayoutKind.Sequential, Pack = 1)]
// public struct OnScreenDisplayVertex : IVertexStruct
// {
// [VertexElement(AttributeIndex = 0)]
// public Vector2 Position;
// [VertexElement(AttributeIndex = 1)]
// public Vector2 TextureCoords;
// }
// public class OnScreenDisplayMessage
// {
// public int X { get; set; }
// public int Y { get; set; }
// public Color4 Color { get; set; }
// public string Text { get; set; }
// public DateTime ShowUntil { get; set; }
// public bool IsLogEntry { get; set; }
// public OnScreenDisplayMessage()
// {
// X = Y = 0;
// Color = Color4.White;
// Text = string.Empty;
// ShowUntil = DateTime.Now;
// IsLogEntry = false;
// }
// }
// }
//}

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: d339431b097f84640a5625605af96f59

View File

@ -1,108 +0,0 @@
//using System;
//using System.ComponentModel;
//using System.Diagnostics;
//using System.Diagnostics.CodeAnalysis;
//using System.Drawing;
//using System.Runtime.InteropServices;
//namespace Essgee.Graphics
//{
// [DesignTimeVisible(true), ToolboxItem(true)]
// [SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly",
// Justification = "False positive. IDisposable is inherited via IFunctionality. See http://stackoverflow.com/questions/8925925/code-analysis-ca1063-fires-when-deriving-from-idisposable-and-providing-implemen for details.")]
// public class RenderControl : GLControl, IComponent
// {
// public event EventHandler<EventArgs> Render;
// bool isRuntime => (LicenseManager.UsageMode != LicenseUsageMode.Designtime);
// bool isReady => (isRuntime && GraphicsContext.CurrentContext != null);
// DebugProc debugCallback;
// bool wasShown = false;
// public RenderControl() : base(GraphicsMode.Default, 3, 0, GraphicsContextFlags.Default)
// {
// if (!isRuntime) return;
// Application.Idle += ((s, e) => { if (isReady) Invalidate(); });
// }
// protected override bool IsInputKey(Keys keyData)
// {
// switch (keyData)
// {
// case Keys.Right:
// case Keys.Left:
// case Keys.Up:
// case Keys.Down:
// case (Keys.Shift | Keys.Right):
// case (Keys.Shift | Keys.Left):
// case (Keys.Shift | Keys.Up):
// case (Keys.Shift | Keys.Down):
// return true;
// default:
// return base.IsInputKey(keyData);
// }
// }
// protected override void OnPaint(PaintEventArgs e)
// {
// if (!isReady)
// {
// e.Graphics.Clear(BackColor);
// using (Pen pen = new Pen(Color.Red, 3.0f))
// {
// e.Graphics.InterpolationMode = InterpolationMode.HighQualityBilinear;
// e.Graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
// e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
// e.Graphics.DrawLine(pen, Point.Empty, new Point(ClientRectangle.Right, ClientRectangle.Bottom));
// e.Graphics.DrawLine(pen, new Point(0, ClientRectangle.Bottom), new Point(ClientRectangle.Right, 0));
// }
// return;
// }
// if (!wasShown)
// {
// OnResize(EventArgs.Empty);
// wasShown = true;
// }
// OnRender(EventArgs.Empty);
// SwapBuffers();
// }
// protected virtual void OnRender(EventArgs e)
// {
// if (!isReady) return;
// Render?.Invoke(this, e);
// }
// protected override void OnLoad(EventArgs e)
// {
// if (!isReady) return;
// if (Program.AppEnvironment.EnableOpenGLDebug)
// {
// debugCallback = new DebugProc(GLDebugCallback);
// GL.DebugMessageCallback(debugCallback, IntPtr.Zero);
// }
// GL.ClearColor(BackColor);
// base.OnLoad(e);
// }
// protected override void OnResize(EventArgs e)
// {
// if (!isReady) return;
// base.OnResize(e);
// }
// private void GLDebugCallback(DebugSource source, DebugType type, int id, DebugSeverity severity, int length, IntPtr message, IntPtr userParam)
// {
// Debug.Print($"{(type == DebugType.DebugTypeError ? "GL ERROR!" : "GL callback")} - source={source}, type={type}, severity={severity}, message={Marshal.PtrToStringAnsi(message)}");
// }
// }
//}

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: bd60d4cba4b596b4caca2011e09f52f2

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 9883a8b3cddfccc44b67d176b7f1ac47
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,27 +0,0 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using System.Threading.Tasks;
//using Newtonsoft.Json;
//using Newtonsoft.Json.Converters;
//namespace Essgee.Graphics.Shaders
//{
// public class BundleManifest
// {
// [JsonConverter(typeof(StringEnumConverter))]
// public FilterMode Filter { get; set; }
// [JsonConverter(typeof(StringEnumConverter))]
// public WrapMode Wrap { get; set; }
// public int Samplers { get; set; }
// public BundleManifest()
// {
// Filter = FilterMode.Linear;
// Wrap = WrapMode.Repeat;
// Samplers = 3;
// }
// }
//}

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: eb0a360511a90b64291ef7d4b8bf80c0

View File

@ -1,214 +0,0 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using System.Threading.Tasks;
//using System.Reflection;
//using OpenTK.Graphics.OpenGL;
//using Essgee.Exceptions;
//namespace Essgee.Graphics.Shaders
//{
// public class GLSLShader : IDisposable
// {
// int vertexShaderObject, fragmentShaderObject, geometryShaderObject;
// List<string> vertexShaderCode, fragmentShaderCode, geometryShaderCode;
// readonly int programObject;
// static readonly string[] uniformSetMethods =
// {
// "Uniform1", "Uniform2", "Uniform3", "Uniform4"
// };
// static readonly string[] uniformSetMethodsMatrix =
// {
// "UniformMatrix2", "UniformMatrix2x3", "UniformMatrix2x4",
// "UniformMatrix3", "UniformMatrix3x2", "UniformMatrix3x4",
// "UniformMatrix4", "UniformMatrix4x2", "UniformMatrix4x3"
// };
// Dictionary<string, int> uniformLocations;
// Dictionary<string, dynamic> uniformData;
// Dictionary<Type, FastInvokeHandler> uniformMethods;
// bool disposed = false;
// public GLSLShader()
// {
// vertexShaderObject = fragmentShaderObject = geometryShaderObject = -1;
// programObject = GL.CreateProgram();
// uniformLocations = new Dictionary<string, int>();
// uniformData = new Dictionary<string, dynamic>();
// uniformMethods = new Dictionary<Type, FastInvokeHandler>();
// }
// ~GLSLShader()
// {
// Dispose(false);
// }
// public void Dispose()
// {
// Dispose(true);
// GC.SuppressFinalize(this);
// }
// protected virtual void Dispose(bool disposing)
// {
// if (disposed)
// return;
// if (disposing)
// {
// DetachDeleteShader(programObject, vertexShaderObject);
// DetachDeleteShader(programObject, fragmentShaderObject);
// DetachDeleteShader(programObject, geometryShaderObject);
// GL.DeleteProgram(programObject);
// }
// disposed = true;
// }
// public void SetVertexShaderCode(params string[] shaderCode)
// {
// DetachDeleteShader(programObject, vertexShaderObject);
// vertexShaderObject = GenerateShader(ShaderType.VertexShader, vertexShaderCode = shaderCode.ToList());
// }
// public void SetFragmentShaderCode(params string[] shaderCode)
// {
// DetachDeleteShader(programObject, fragmentShaderObject);
// fragmentShaderObject = GenerateShader(ShaderType.FragmentShader, fragmentShaderCode = shaderCode.ToList());
// }
// public void SetGeometryShaderCode(params string[] shaderCode)
// {
// DetachDeleteShader(programObject, geometryShaderObject);
// geometryShaderObject = GenerateShader(ShaderType.GeometryShader, geometryShaderCode = shaderCode.ToList());
// }
// private int GenerateShader(ShaderType shaderType, List<string> shaderCode)
// {
// var handle = GL.CreateShader(shaderType);
// GL.ShaderSource(handle, shaderCode.Count, shaderCode.ToArray(), shaderCode.Select(x => x.Length).ToArray());
// GL.CompileShader(handle);
// GL.GetShaderInfoLog(handle, out string infoLog);
// GL.GetShader(handle, ShaderParameter.CompileStatus, out int statusCode);
// if (statusCode != 1)
// throw new GraphicsException($"Shader compile for {shaderType} failed: {infoLog}");
// return handle;
// }
// private void DetachDeleteShader(int programObject, int shaderObject)
// {
// if (shaderObject != -1 && GL.IsShader(shaderObject))
// {
// GL.DetachShader(programObject, shaderObject);
// GL.DeleteShader(shaderObject);
// }
// }
// public void LinkProgram()
// {
// LinkProgram(programObject, new int[] { vertexShaderObject, fragmentShaderObject, geometryShaderObject });
// }
// private void LinkProgram(int programObject, int[] shaderObjects)
// {
// foreach (var shaderObject in shaderObjects.Where(x => x != -1))
// GL.AttachShader(programObject, shaderObject);
// GL.LinkProgram(programObject);
// GL.GetProgramInfoLog(programObject, out string infoLog);
// GL.GetProgram(programObject, GetProgramParameterName.LinkStatus, out int statusCode);
// if (statusCode != 1)
// throw new GraphicsException($"Shader program link failed: {infoLog}");
// }
// public void Activate()
// {
// if (programObject == -1) throw new GraphicsException("Invalid shader program handle");
// GL.UseProgram(programObject);
// }
// public void SetUniform(string name, dynamic data)
// {
// Activate();
// Type type = data.GetType();
// if (!uniformLocations.ContainsKey(name))
// uniformLocations.Add(name, GL.GetUniformLocation(programObject, name));
// uniformData[name] = data;
// if (uniformMethods.ContainsKey(type))
// {
// uniformMethods[type](null, new object[] { uniformLocations[name], data });
// }
// else
// {
// foreach (string methodName in uniformSetMethods)
// {
// Type[] argTypes = new Type[] { typeof(int), type };
// MethodInfo methodInfo = typeof(GL).GetMethod(methodName, argTypes);
// if (methodInfo != null)
// {
// uniformMethods[type] = FastMethodInvoker.GetMethodInvoker(methodInfo);
// uniformMethods[type](null, new object[] { uniformLocations[name], data });
// return;
// }
// }
// throw new GraphicsException("No Uniform method found");
// }
// }
// public void SetUniformMatrix(string name, bool transpose, dynamic data)
// {
// Activate();
// Type type = data.GetType();
// if (!uniformLocations.ContainsKey(name))
// uniformLocations.Add(name, GL.GetUniformLocation(programObject, name));
// uniformData[name] = data;
// if (uniformMethods.ContainsKey(type))
// {
// uniformMethods[type](null, new object[] { uniformLocations[name], transpose, data });
// }
// else
// {
// foreach (string methodName in uniformSetMethodsMatrix)
// {
// Type[] argTypes = new Type[] { typeof(int), typeof(bool), data.GetType().MakeByRefType() };
// MethodInfo methodInfo = typeof(GL).GetMethod(methodName, argTypes);
// if (methodInfo != null)
// {
// uniformMethods[type] = FastMethodInvoker.GetMethodInvoker(methodInfo);
// uniformMethods[type](null, new object[] { uniformLocations[name], transpose, data });
// return;
// }
// }
// throw new GraphicsException("No UniformMatrix method found");
// }
// }
// public dynamic GetUniform(string name)
// {
// if (!uniformData.ContainsKey(name)) throw new ArgumentException();
// return uniformData[name];
// }
// }
//}

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: a68ffee335bae1a4a916390d6cf1c0aa

View File

@ -1,201 +0,0 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using System.Threading.Tasks;
//using System.IO;
//using System.Reflection;
//using System.Windows.Forms;
//using OpenTK;
//using Essgee.Extensions;
//namespace Essgee.Graphics.Shaders
//{
// public class ShaderBundle : IDisposable
// {
// public const int MaxNumSourceSamplers = 8;
// readonly static string manifestFilename = "Manifest.json";
// readonly static string fragmentFilename = "Fragment.glsl";
// readonly static string glslUniformSourceSamplers = "source";
// readonly static string glslUniformProjection = "projection";
// readonly static string glslUniformModelview = "modelview";
// readonly static string glslUniformTextureSize = "textureSize";
// readonly static string glslUniformInputViewport = "inputViewport";
// readonly static string glslUniformOutputViewport = "outputViewport";
// readonly static string glslVersion = "#version 300 es\n";
// readonly static string glslESPrecision = "precision mediump float; precision mediump int;\n";
// readonly static string glslMainStart = "void main(void){";
// readonly static string glslMainEnd = "}\n";
// readonly static string defaultVertexUniforms = $"uniform mat4 {glslUniformProjection}; uniform mat4 {glslUniformModelview}; uniform vec2 {glslUniformTextureSize}; uniform vec4 {glslUniformInputViewport};\n";
// readonly static string defaultVertexOuts = "out vec4 vertColor; out vec2 vertTexCoord;\n";
// readonly static string defaultVertexMain = $"vertColor = inColor; gl_Position = {glslUniformProjection} * {glslUniformModelview} * vec4(inPosition.x, inPosition.y, inPosition.z, 1.0);\n";
// readonly static string defaultVertexTexCoord = "vertTexCoord = inTexCoord;";
// readonly static string defaultFragmentUniforms = $"uniform sampler2D {glslUniformSourceSamplers}[{MaxNumSourceSamplers}]; uniform vec2 {glslUniformTextureSize}; uniform vec4 {glslUniformInputViewport}; uniform vec4 {glslUniformOutputViewport};";
// readonly static string defaultFragmentIns = "in vec4 vertColor; in vec2 vertTexCoord; layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;\n";
// readonly static string defaultFragmentOuts = "out vec4 fragColor;\n";
// readonly List<VertexElement> vertexElements;
// readonly int vertexStructSize;
// readonly string vertexPreamble, vertexMain, fragmentPreamble;
// string manifestJson, fragmentMain;
// public BundleManifest Manifest { get; private set; }
// GLSLShader internalShader;
// bool disposed = false;
// public ShaderBundle(Type vertexType)
// {
// (vertexElements, vertexStructSize) = VertexBuffer.DeconstructVertexLayout(vertexType);
// var vertexPreambleBuilder = new StringBuilder();
// vertexPreambleBuilder.Append(glslVersion);
// vertexPreambleBuilder.Append(glslESPrecision);
// vertexPreambleBuilder.Append(defaultVertexUniforms);
// vertexPreambleBuilder.Append(VertexBuffer.GetShaderPreamble(vertexElements));
// vertexPreambleBuilder.Append(defaultVertexOuts);
// vertexPreamble = vertexPreambleBuilder.ToString();
// var vertexMainBuilder = new StringBuilder();
// vertexMainBuilder.Append(glslMainStart);
// vertexMainBuilder.Append(defaultVertexMain);
// vertexMainBuilder.Append(defaultVertexTexCoord);
// vertexMainBuilder.Append(glslMainEnd);
// vertexMain = vertexMainBuilder.ToString();
// var fragmentPreambleBuilder = new StringBuilder();
// fragmentPreambleBuilder.Append(glslVersion);
// fragmentPreambleBuilder.Append(glslESPrecision);
// fragmentPreambleBuilder.Append(defaultFragmentUniforms);
// fragmentPreambleBuilder.Append(defaultFragmentIns);
// fragmentPreambleBuilder.Append(defaultFragmentOuts);
// fragmentPreamble = fragmentPreambleBuilder.ToString();
// }
// public ShaderBundle(string shaderName, Type vertexType) : this(vertexType)
// {
// LoadBundle(shaderName);
// }
// ~ShaderBundle()
// {
// Dispose(false);
// }
// public void Dispose()
// {
// Dispose(true);
// GC.SuppressFinalize(this);
// }
// protected virtual void Dispose(bool disposing)
// {
// if (disposed)
// return;
// if (disposing)
// internalShader.Dispose();
// disposed = true;
// }
// public void LoadBundle(string shaderName)
// {
// /* Try loading embedded shader first... */
// var shaderEmbeddedPath = $"{Application.ProductName}.Assets.Shaders.{shaderName}";
// var shaderEmbeddedManifestFile = $"{shaderEmbeddedPath}.{manifestFilename}";
// if (Assembly.GetExecutingAssembly().IsEmbeddedResourceAvailable(shaderEmbeddedManifestFile))
// {
// manifestJson = Assembly.GetExecutingAssembly().ReadEmbeddedTextFile(shaderEmbeddedManifestFile);
// fragmentMain = Assembly.GetExecutingAssembly().ReadEmbeddedTextFile($"{shaderEmbeddedPath}.{fragmentFilename}");
// }
// /* If embedded shader wasn't found, try loading from assets directory... */
// else
// {
// var bundlePath = Path.Combine(Program.ShaderPath, shaderName);
// if (!Directory.Exists(bundlePath)) throw new DirectoryNotFoundException($"Shader {shaderName} not found");
// var manifestPath = Path.Combine(bundlePath, manifestFilename);
// if (!File.Exists(manifestPath)) throw new FileNotFoundException($"Manifest {manifestFilename} not found in {bundlePath}");
// manifestJson = File.ReadAllText(manifestPath);
// var fragmentPath = Path.Combine(bundlePath, fragmentFilename);
// if (!File.Exists(fragmentPath)) throw new FileNotFoundException($"Fragment shader {fragmentFilename} not found in {bundlePath}");
// using (var reader = new StreamReader(new FileStream(fragmentPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)))
// {
// fragmentMain = reader.ReadToEnd();
// }
// }
// /* Now initialize GLSL shader using manifest and fragment code */
// InitializeBundle(manifestJson, fragmentMain);
// }
// private void InitializeBundle(string manifestJson, string fragmentMain)
// {
// Manifest = manifestJson.DeserializeObject<BundleManifest>();
// if (Manifest.Samplers > MaxNumSourceSamplers)
// {
// // TODO: give user a warning or something?
// Manifest.Samplers = MaxNumSourceSamplers;
// }
// internalShader = new GLSLShader();
// internalShader.SetVertexShaderCode(vertexPreamble, vertexMain);
// internalShader.SetFragmentShaderCode(fragmentPreamble, fragmentMain);
// internalShader.LinkProgram();
// internalShader.SetUniformMatrix(glslUniformModelview, false, Matrix4.Identity);
// internalShader.SetUniform(glslUniformTextureSize, Vector2.One);
// internalShader.SetUniform(glslUniformInputViewport, Vector4.One);
// internalShader.SetUniform(glslUniformOutputViewport, Vector4.One);
// for (int i = 0; i < MaxNumSourceSamplers; i++)
// internalShader.SetUniform($"{glslUniformSourceSamplers}[{i}]", i);
// }
// public void SetProjectionMatrix(Matrix4 mat4)
// {
// internalShader.SetUniformMatrix(glslUniformProjection, false, mat4);
// }
// public void SetModelviewMatrix(Matrix4 mat4)
// {
// internalShader.SetUniformMatrix(glslUniformModelview, false, mat4);
// }
// public void SetTextureSize(Vector2 vec2)
// {
// internalShader.SetUniform(glslUniformTextureSize, vec2);
// }
// public void SetInputViewport(Vector4 vec4)
// {
// internalShader.SetUniform(glslUniformInputViewport, vec4);
// }
// public void SetOutputViewport(Vector4 vec4)
// {
// internalShader.SetUniform(glslUniformOutputViewport, vec4);
// }
// public void Activate()
// {
// internalShader.Activate();
// }
// }
//}

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 9505180589ab61c4488cd36d3aed6245

View File

@ -1,200 +0,0 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using System.Threading.Tasks;
//using System.Drawing;
//using System.Drawing.Imaging;
//using System.Runtime.InteropServices;
//using OpenTK.Graphics.OpenGL;
//using GlPixelFormat = OpenTK.Graphics.OpenGL.PixelFormat;
//using GdiPixelFormat = System.Drawing.Imaging.PixelFormat;
//namespace Essgee.Graphics
//{
// public class Texture : IDisposable
// {
// static readonly Dictionary<GdiPixelFormat, PixelFormat> gdiPixelFormatMap = new Dictionary<GdiPixelFormat, PixelFormat>()
// {
// { GdiPixelFormat.Format32bppArgb, PixelFormat.Rgba8888 },
// { GdiPixelFormat.Format24bppRgb, PixelFormat.Rgb888 }
// };
// static readonly Dictionary<PixelFormat, (PixelInternalFormat, GlPixelFormat, int)> glPixelFormatMap = new Dictionary<PixelFormat, (PixelInternalFormat, GlPixelFormat, int)>()
// {
// { PixelFormat.Rgba8888, (PixelInternalFormat.Rgba8, GlPixelFormat.Bgra, 4) },
// { PixelFormat.Rgb888, (PixelInternalFormat.Rgb8, GlPixelFormat.Bgr, 3) }
// };
// readonly static int maxTextureSize;
// int textureHandle;
// public int Width { get; private set; }
// public int Height { get; private set; }
// PixelInternalFormat pixelInternalFormat;
// GlPixelFormat glPixelFormat;
// int bytesPerPixel, dataSize;
// byte[] currentData;
// TextureMinFilter minFilter;
// TextureMagFilter magFilter;
// TextureWrapMode wrapMode;
// bool disposed = false;
// static Texture()
// {
// maxTextureSize = GL.GetInteger(GetPName.MaxTextureSize);
// }
// public Texture(int width, int height, PixelFormat pixelFormat, FilterMode filter = FilterMode.Linear, WrapMode wrap = WrapMode.Repeat)
// {
// InitializeRaw(width, height, pixelFormat, filter, wrap);
// }
// public Texture(Bitmap image, FilterMode filter = FilterMode.Linear, WrapMode wrap = WrapMode.Repeat)
// {
// if (!gdiPixelFormatMap.ContainsKey(image.PixelFormat))
// throw new ArgumentException($"Unsupported pixel format {image.PixelFormat}", nameof(image));
// InitializeRaw(image.Width, image.Height, gdiPixelFormatMap[image.PixelFormat], filter, wrap);
// var bitmapData = image.LockBits(new Rectangle(0, 0, image.Width, image.Height), ImageLockMode.ReadOnly, image.PixelFormat);
// var imageData = new byte[bitmapData.Height * bitmapData.Stride];
// Marshal.Copy(bitmapData.Scan0, imageData, 0, imageData.Length);
// SetData(imageData);
// image.UnlockBits(bitmapData);
// }
// ~Texture()
// {
// Dispose(false);
// }
// public void Dispose()
// {
// Dispose(true);
// GC.SuppressFinalize(this);
// }
// protected virtual void Dispose(bool disposing)
// {
// if (disposed)
// return;
// if (disposing)
// {
// if (GL.IsTexture(textureHandle))
// GL.DeleteTexture(textureHandle);
// }
// disposed = true;
// }
// private void InitializeRaw(int width, int height, PixelFormat pixelFormat, FilterMode filter, WrapMode wrap)
// {
// if (width <= 0 || width > maxTextureSize) throw new ArgumentOutOfRangeException(nameof(width), $"Invalid width {width}");
// Width = width;
// if (height <= 0 || height > maxTextureSize) throw new ArgumentOutOfRangeException(nameof(height), $"Invalid height {height}");
// Height = height;
// if (!glPixelFormatMap.ContainsKey(pixelFormat)) throw new ArgumentException($"Unsupported pixel format {pixelFormat}", nameof(pixelFormat));
// (pixelInternalFormat, glPixelFormat, bytesPerPixel) = glPixelFormatMap[pixelFormat];
// dataSize = (width * height * bytesPerPixel);
// switch (filter)
// {
// case FilterMode.Linear:
// minFilter = TextureMinFilter.Linear;
// magFilter = TextureMagFilter.Linear;
// break;
// case FilterMode.Nearest:
// minFilter = TextureMinFilter.Nearest;
// magFilter = TextureMagFilter.Nearest;
// break;
// default:
// throw new ArgumentException("Invalid filter mode", nameof(filter));
// }
// switch (wrap)
// {
// case WrapMode.Repeat: wrapMode = TextureWrapMode.Repeat; break;
// case WrapMode.Border: wrapMode = TextureWrapMode.ClampToBorder; break;
// case WrapMode.Edge: wrapMode = TextureWrapMode.ClampToEdge; break;
// case WrapMode.Mirror: wrapMode = TextureWrapMode.MirroredRepeat; break;
// default: throw new ArgumentException("Invalid wrap mode", nameof(wrap));
// }
// GenerateHandles();
// InitializeTexture();
// }
// private void GenerateHandles()
// {
// textureHandle = GL.GenTexture();
// }
// private void InitializeTexture()
// {
// GL.BindTexture(TextureTarget.Texture2D, textureHandle);
// GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)minFilter);
// GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)magFilter);
// GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)wrapMode);
// GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)wrapMode);
// if (bytesPerPixel != 4) GL.PixelStore(PixelStoreParameter.UnpackAlignment, 1);
// GL.TexImage2D(TextureTarget.Texture2D, 0, pixelInternalFormat, Width, Height, 0, glPixelFormat, PixelType.UnsignedByte, IntPtr.Zero);
// GL.BindTexture(TextureTarget.Texture2D, 0);
// }
// public void SetData(byte[] data)
// {
// if (data == null) throw new ArgumentNullException(nameof(data), "Image data is null");
// if (data.Length != dataSize) throw new ArgumentException($"Image data size mismatch; excepted {dataSize} bytes, got {data.Length} bytes", nameof(data));
// GL.BindTexture(TextureTarget.Texture2D, textureHandle);
// GL.TexSubImage2D(TextureTarget.Texture2D, 0, 0, 0, Width, Height, glPixelFormat, PixelType.UnsignedByte, (currentData = data));
// }
// public byte[] GetData()
// {
// return currentData;
// }
// public void ClearData()
// {
// var emptyData = new byte[dataSize];
// SetData(emptyData);
// }
// public void Activate()
// {
// Activate(TextureUnit.Texture0);
// }
// public void Activate(TextureUnit textureUnit)
// {
// if (textureHandle == -1) throw new InvalidOperationException("Invalid texture handle");
// GL.ActiveTexture(textureUnit);
// GL.BindTexture(TextureTarget.Texture2D, textureHandle);
// }
// public void Deactivate()
// {
// Deactivate(TextureUnit.Texture0);
// }
// public void Deactivate(TextureUnit textureUnit)
// {
// GL.ActiveTexture(textureUnit);
// GL.BindTexture(TextureTarget.Texture2D, 0);
// }
// }
//}

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 27df8906b58443d4ab2ca4181c41616e

View File

@ -1,276 +0,0 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using System.Threading.Tasks;
//using System.Runtime.InteropServices;
//using System.Reflection;
//using OpenTK;
//using OpenTK.Graphics;
//using OpenTK.Graphics.OpenGL;
//using Essgee.Exceptions;
//namespace Essgee.Graphics
//{
// public class VertexBuffer : IDisposable
// {
// static readonly Dictionary<Type, VertexAttribPointerType> pointerTypeTranslator = new Dictionary<Type, VertexAttribPointerType>()
// {
// { typeof(byte), VertexAttribPointerType.UnsignedByte },
// { typeof(sbyte), VertexAttribPointerType.Byte },
// { typeof(ushort), VertexAttribPointerType.UnsignedShort },
// { typeof(short), VertexAttribPointerType.Short },
// { typeof(uint), VertexAttribPointerType.UnsignedInt },
// { typeof(int), VertexAttribPointerType.Int },
// { typeof(float), VertexAttribPointerType.Float },
// { typeof(double), VertexAttribPointerType.Double },
// { typeof(Vector2), VertexAttribPointerType.Float },
// { typeof(Vector3), VertexAttribPointerType.Float },
// { typeof(Vector4), VertexAttribPointerType.Float },
// { typeof(Color4), VertexAttribPointerType.Float }
// };
// static readonly Dictionary<Type, string> glslTypeTranslator = new Dictionary<Type, string>()
// {
// { typeof(uint), "uint" },
// { typeof(int), "int" },
// { typeof(float), "float" },
// { typeof(double), "double" },
// { typeof(Vector2), "vec2" },
// { typeof(Vector3), "vec3" },
// { typeof(Vector4), "vec4" },
// { typeof(Color4), "vec4" }
// };
// static readonly Dictionary<Type, DrawElementsType> drawElementsTypeTranslator = new Dictionary<Type, DrawElementsType>()
// {
// { typeof(byte), DrawElementsType.UnsignedByte },
// { typeof(ushort), DrawElementsType.UnsignedShort },
// { typeof(uint), DrawElementsType.UnsignedInt }
// };
// readonly int vaoHandle, vboHandle;
// int numElementsToDraw;
// PrimitiveType primitiveType;
// int elementBufferHandle;
// DrawElementsType drawElementsType;
// List<VertexElement> vertexElements;
// int vertexStructSize;
// bool disposed = false;
// public VertexBuffer()
// {
// vaoHandle = GL.GenVertexArray();
// vboHandle = GL.GenBuffer();
// numElementsToDraw = -1;
// primitiveType = PrimitiveType.Triangles;
// elementBufferHandle = -1;
// drawElementsType = DrawElementsType.UnsignedByte;
// vertexElements = null;
// vertexStructSize = -1;
// }
// ~VertexBuffer()
// {
// Dispose(false);
// }
// public void Dispose()
// {
// Dispose(true);
// GC.SuppressFinalize(this);
// }
// protected virtual void Dispose(bool disposing)
// {
// if (disposed)
// return;
// if (disposing)
// {
// if (GL.IsVertexArray(vaoHandle))
// GL.DeleteVertexArray(vaoHandle);
// if (GL.IsBuffer(vboHandle))
// GL.DeleteBuffer(vboHandle);
// if (GL.IsBuffer(elementBufferHandle))
// GL.DeleteBuffer(elementBufferHandle);
// }
// disposed = true;
// }
// public static (List<VertexElement>, int) DeconstructVertexLayout<T>() where T : struct, IVertexStruct
// {
// return DeconstructVertexLayout(typeof(T));
// }
// public static (List<VertexElement>, int) DeconstructVertexLayout(Type vertexType)
// {
// if (!typeof(IVertexStruct).IsAssignableFrom(vertexType)) throw new Exceptions.GraphicsException("Cannot deconstruct layout of non-vertex type");
// var elements = new List<VertexElement>();
// var structSize = Marshal.SizeOf(vertexType);
// foreach (var field in vertexType.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic))
// {
// var attribs = field.GetCustomAttributes(typeof(VertexElementAttribute), false);
// if (attribs == null || attribs.Length != 1) continue;
// var elementAttribute = (attribs[0] as VertexElementAttribute);
// var numComponents = Marshal.SizeOf(field.FieldType);
// if (field.FieldType.IsValueType && !field.FieldType.IsEnum)
// {
// var structFields = field.FieldType.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
// if (structFields == null || structFields.Length < 1 || structFields.Length > 4) throw new Exceptions.GraphicsException("Invalid number of fields in struct");
// numComponents = structFields.Length;
// }
// elements.Add(new VertexElement()
// {
// AttributeIndex = elementAttribute.AttributeIndex,
// DataType = field.FieldType,
// NumComponents = numComponents,
// OffsetInVertex = Marshal.OffsetOf(vertexType, field.Name).ToInt32(),
// Name = field.Name
// });
// }
// return (elements, structSize);
// }
// public void SetPrimitiveType(PrimitiveType primType)
// {
// primitiveType = primType;
// }
// public PrimitiveType GetPrimitiveType()
// {
// return primitiveType;
// }
// public void SetVertexData<TVertex>(TVertex[] vertices) where TVertex : struct, IVertexStruct
// {
// (vertexElements, vertexStructSize) = DeconstructVertexLayout<TVertex>();
// GL.BindVertexArray(vaoHandle);
// GL.BindBuffer(BufferTarget.ArrayBuffer, vboHandle);
// GL.BufferData(BufferTarget.ArrayBuffer, new IntPtr(vertexStructSize * vertices.Length), vertices, BufferUsageHint.StaticDraw);
// foreach (var element in vertexElements)
// {
// GL.EnableVertexAttribArray(element.AttributeIndex);
// GL.VertexAttribPointer(element.AttributeIndex, element.NumComponents, GetVertexAttribPointerType(element.DataType), false, vertexStructSize, element.OffsetInVertex);
// }
// numElementsToDraw = vertices.Length;
// GL.BindVertexArray(0);
// }
// public void SetIndices<TIndex>(TIndex[] indices) where TIndex : struct, IConvertible
// {
// drawElementsType = GetDrawElementsType(typeof(TIndex));
// if (elementBufferHandle == -1)
// elementBufferHandle = GL.GenBuffer();
// GL.BindBuffer(BufferTarget.ElementArrayBuffer, elementBufferHandle);
// GL.BufferData(BufferTarget.ElementArrayBuffer, new IntPtr(Marshal.SizeOf(typeof(TIndex)) * indices.Length), indices, BufferUsageHint.StaticDraw);
// numElementsToDraw = indices.Length;
// }
// private VertexAttribPointerType GetVertexAttribPointerType(Type type)
// {
// if (pointerTypeTranslator.ContainsKey(type))
// return pointerTypeTranslator[type];
// else
// throw new ArgumentException("Unimplemented or unsupported vertex attribute pointer type");
// }
// private DrawElementsType GetDrawElementsType(Type type)
// {
// if (drawElementsTypeTranslator.ContainsKey(type))
// return drawElementsTypeTranslator[type];
// else
// throw new ArgumentException("Unsupported draw elements type");
// }
// private static string GetGlslDataType(Type type)
// {
// if (glslTypeTranslator.ContainsKey(type))
// return glslTypeTranslator[type];
// else
// throw new ArgumentException("Unimplemented or unsupported GLSL data type");
// }
// public string GetShaderPreamble(string prefix = "in")
// {
// return GetShaderPreamble(vertexElements, prefix);
// }
// public static string GetShaderPreamble(List<VertexElement> vertexElements, string prefix = "in")
// {
// var stringBuilder = new StringBuilder();
// for (int i = 0; i < vertexElements.Count; i++)
// {
// var element = vertexElements[i];
// stringBuilder.AppendLine($"layout(location = {element.AttributeIndex}) in {GetGlslDataType(element.DataType)} {prefix}{element.Name};");
// }
// return stringBuilder.ToString();
// }
// public void Render()
// {
// GL.BindVertexArray(vaoHandle);
// if (elementBufferHandle != -1)
// {
// GL.BindBuffer(BufferTarget.ElementArrayBuffer, elementBufferHandle);
// GL.DrawElements(primitiveType, numElementsToDraw, drawElementsType, 0);
// }
// else
// GL.DrawArrays(primitiveType, 0, numElementsToDraw);
// }
// }
// public interface IVertexStruct { }
// [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
// public class VertexElementAttribute : Attribute
// {
// public int AttributeIndex { get; set; }
// public VertexElementAttribute()
// {
// AttributeIndex = -1;
// }
// }
// [StructLayout(LayoutKind.Sequential, Pack = 1)]
// public struct CommonVertex : IVertexStruct
// {
// [VertexElement(AttributeIndex = 0)]
// public Vector3 Position;
// [VertexElement(AttributeIndex = 1)]
// public Vector3 Normal;
// [VertexElement(AttributeIndex = 2)]
// public Color4 Color;
// [VertexElement(AttributeIndex = 3)]
// public Vector2 TexCoord;
// }
//}

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: f6abd7f4ed8a2dc4a8950cb920e39bda

View File

@ -1,26 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Essgee.Graphics
{
public sealed class VertexElement
{
public int AttributeIndex { get; internal set; }
public Type DataType { get; internal set; }
public int NumComponents { get; internal set; }
public int OffsetInVertex { get; internal set; }
public string Name { get; internal set; }
public VertexElement()
{
AttributeIndex = -1;
DataType = null;
NumComponents = -1;
OffsetInVertex = -1;
Name = string.Empty;
}
}
}

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 2e3f41f8d2cd2534a8906786dbe34d25

View File

@ -1,10 +0,0 @@
//namespace Essgee.Utilities
//{
// class AltKeyFilter : IMessageFilter
// {
// public bool PreFilterMessage(ref Message m)
// {
// return (m.Msg == 0x0104 && ((int)m.LParam & 0x20000000) != 0);
// }
// }
//}

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 0857ccfa13cf054469f9f76a26a93de9

View File

@ -1,48 +0,0 @@
//using System;
//using System.Windows.Forms;
//using System.Drawing;
//using System.Diagnostics.CodeAnalysis;
//namespace Essgee.Utilities
//{
// [SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly",
// Justification = "False positive. IDisposable is inherited via IFunctionality. See http://stackoverflow.com/questions/8925925/code-analysis-ca1063-fires-when-deriving-from-idisposable-and-providing-implemen for details.")]
// public class BindableToolStripMenuItem : ToolStripMenuItem, IBindableComponent
// {
// public BindableToolStripMenuItem() : base() { }
// public BindableToolStripMenuItem(string text) : base(text) { }
// public BindableToolStripMenuItem(Image image) : base(image) { }
// public BindableToolStripMenuItem(string text, Image image) : base(text, image) { }
// public BindableToolStripMenuItem(string text, Image image, EventHandler onClick) : base(text, image, onClick) { }
// public BindableToolStripMenuItem(string text, Image image, params ToolStripMenuItem[] dropDownItems) : base(text, image, dropDownItems) { }
// public BindableToolStripMenuItem(string text, Image image, EventHandler onClick, Keys shortcutKeys) : base(text, image, onClick, shortcutKeys) { }
// public BindableToolStripMenuItem(string text, Image image, EventHandler onClick, string name) : base(text, image, onClick, name) { }
// BindingContext bindingContext;
// ControlBindingsCollection dataBindings;
// public BindingContext BindingContext
// {
// get
// {
// if (bindingContext == null)
// bindingContext = new BindingContext();
// return bindingContext;
// }
// set
// {
// bindingContext = value;
// }
// }
// public ControlBindingsCollection DataBindings
// {
// get
// {
// if (dataBindings == null)
// dataBindings = new ControlBindingsCollection(this);
// return dataBindings;
// }
// }
// }
//}

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: bd5e5aa99d4a1b642b4f6c18a4a29988

View File

@ -1,14 +1,9 @@
using System; using Newtonsoft.Json;
using System.Collections.Generic; using System;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace Essgee.Utilities namespace Essgee.Utilities
{ {
public class HexadecimalJsonConverter : JsonConverter public class HexadecimalJsonConverter : JsonConverter
{ {
public override bool CanConvert(Type objectType) public override bool CanConvert(Type objectType)
{ {

View File

@ -1,14 +1,9 @@
using System; using Newtonsoft.Json;
using System.Collections.Generic; using System;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace Essgee.Utilities namespace Essgee.Utilities
{ {
public class TypeNameJsonConverter : JsonConverter public class TypeNameJsonConverter : JsonConverter
{ {
readonly string searchNamespace; readonly string searchNamespace;

View File

@ -4,11 +4,11 @@ using UnityEngine;
public class KeyCodeCore public class KeyCodeCore
{ {
public Dictionary<KeyCode, MotionKey> dictKeyCfgs = new Dictionary<KeyCode, MotionKey>(); public Dictionary<KeyCode, EssgeeMotionKey> dictKeyCfgs = new Dictionary<KeyCode, EssgeeMotionKey>();
public KeyCode[] CheckList; public KeyCode[] CheckList;
public MotionKey[] mCurrKey = new MotionKey[0]; public EssgeeMotionKey[] mCurrKey = new EssgeeMotionKey[0];
//public ulong CurryInpuAllData = 0; //public ulong CurryInpuAllData = 0;
List<MotionKey> temp = new List<MotionKey>(); List<EssgeeMotionKey> temp = new List<EssgeeMotionKey>();
ulong tempInputAllData = 0; ulong tempInputAllData = 0;
UniKeyboard mUniKeyboard; UniKeyboard mUniKeyboard;
//bool bReplayMode; //bool bReplayMode;
@ -16,7 +16,7 @@ public class KeyCodeCore
ulong last_CurryInpuAllData_test = 0; ulong last_CurryInpuAllData_test = 0;
public MotionKey[] GetPressedKeys() public EssgeeMotionKey[] GetPressedKeys()
{ {
return mCurrKey; return mCurrKey;
@ -252,7 +252,7 @@ public class KeyCodeCore
{ {
if (Input.GetKey(CheckList[i])) if (Input.GetKey(CheckList[i]))
{ {
MotionKey mk = dictKeyCfgs[CheckList[i]]; EssgeeMotionKey mk = dictKeyCfgs[CheckList[i]];
temp.Add(mk); temp.Add(mk);
tempInputAllData |= (ulong)mk; tempInputAllData |= (ulong)mk;
} }