basic virtualpad + default controls for TIC80, mark it as released
This commit is contained in:
parent
c49a8d338c
commit
c23b063733
|
@ -1052,6 +1052,19 @@
|
||||||
"P1 9": "Keypad9",
|
"P1 9": "Keypad9",
|
||||||
"P1 Asterisk": "KeypadMultiply",
|
"P1 Asterisk": "KeypadMultiply",
|
||||||
"P1 Pound": "KeypadDivide",
|
"P1 Pound": "KeypadDivide",
|
||||||
|
},
|
||||||
|
"TIC-80 Controller": {
|
||||||
|
"P1 Up": "Up",
|
||||||
|
"P1 Down": "Down",
|
||||||
|
"P1 Left": "Left",
|
||||||
|
"P1 Right": "Right",
|
||||||
|
"P1 A": "X",
|
||||||
|
"P1 B": "Z",
|
||||||
|
"P1 X": "S",
|
||||||
|
"P1 Y": "A",
|
||||||
|
"Mouse Left Click": "Z",
|
||||||
|
"Mouse Middle Click": "X",
|
||||||
|
"Mouse Right Click": "C",
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AllTrollersAutoFire": {
|
"AllTrollersAutoFire": {
|
||||||
|
@ -1415,6 +1428,18 @@
|
||||||
"Mult": -1.0,
|
"Mult": -1.0,
|
||||||
"Deadzone": 0.1
|
"Deadzone": 0.1
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"TIC-80 Controller": {
|
||||||
|
"Mouse X Position": {
|
||||||
|
"Value": "WMouse X",
|
||||||
|
"Mult": 1.0,
|
||||||
|
"Deadzone": 0.0
|
||||||
|
},
|
||||||
|
"Mouse Y Position": {
|
||||||
|
"Value": "WMouse Y",
|
||||||
|
"Mult": 1.0,
|
||||||
|
"Deadzone": 0.0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"AllTrollersFeedbacks": {
|
"AllTrollersFeedbacks": {
|
||||||
|
|
|
@ -139,7 +139,7 @@ namespace BizHawk.Emulation.Cores.Computers.TIC80
|
||||||
}
|
}
|
||||||
|
|
||||||
[BizImport(CC)]
|
[BizImport(CC)]
|
||||||
public abstract bool Init(byte[] rom, int sz, bool[] inputsEnabled);
|
public abstract bool Init(byte[] rom, int sz, bool[] inputsActive);
|
||||||
|
|
||||||
[BizImport(CC)]
|
[BizImport(CC)]
|
||||||
public abstract void SetInputs(ref TIC80Inputs inputs);
|
public abstract void SetInputs(ref TIC80Inputs inputs);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
|
||||||
using BizHawk.Common;
|
using BizHawk.Common;
|
||||||
using BizHawk.Emulation.Common;
|
using BizHawk.Emulation.Common;
|
||||||
|
@ -7,7 +8,7 @@ using BizHawk.Emulation.Cores.Waterbox;
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Cores.Computers.TIC80
|
namespace BizHawk.Emulation.Cores.Computers.TIC80
|
||||||
{
|
{
|
||||||
[PortedCore(CoreNames.TIC80, "nesbox", "v1.0.2164", "https://tic80.com/", isReleased: false)]
|
[PortedCore(CoreNames.TIC80, "nesbox", "v1.0.2164", "https://tic80.com/")]
|
||||||
[ServiceNotApplicable(new[] { typeof(IDriveLight), })]
|
[ServiceNotApplicable(new[] { typeof(IDriveLight), })]
|
||||||
public partial class TIC80 : WaterboxCore
|
public partial class TIC80 : WaterboxCore
|
||||||
{
|
{
|
||||||
|
@ -49,7 +50,7 @@ namespace BizHawk.Emulation.Cores.Computers.TIC80
|
||||||
});
|
});
|
||||||
|
|
||||||
var rom = lp.Roms[0].FileData;
|
var rom = lp.Roms[0].FileData;
|
||||||
var inputsEnabled = new bool[6]
|
var inputsActive = new bool[6]
|
||||||
{
|
{
|
||||||
_syncSettings.Gamepad1,
|
_syncSettings.Gamepad1,
|
||||||
_syncSettings.Gamepad2,
|
_syncSettings.Gamepad2,
|
||||||
|
@ -59,20 +60,23 @@ namespace BizHawk.Emulation.Cores.Computers.TIC80
|
||||||
_syncSettings.Keyboard,
|
_syncSettings.Keyboard,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!_core.Init(rom, rom.Length, inputsEnabled))
|
if (!_core.Init(rom, rom.Length, inputsActive))
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("Init returned false!");
|
throw new InvalidOperationException("Init returned false!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// inputsEnabled is mutated in Init call
|
// note: InputsActive is mutated in Init call
|
||||||
// as such any Autodetects in inputsEnabled will be set to True or False
|
// any items not available for the game will be set to false
|
||||||
ControllerDefinition = CreateControllerDefinition(inputsEnabled);
|
ControllerDefinition = CreateControllerDefinition(inputsActive);
|
||||||
|
InputsActive = Array.AsReadOnly(inputsActive);
|
||||||
PostInit();
|
PostInit();
|
||||||
|
|
||||||
DeterministicEmulation = lp.DeterministicEmulationRequested || (!_syncSettings.UseRealTime);
|
DeterministicEmulation = lp.DeterministicEmulationRequested || (!_syncSettings.UseRealTime);
|
||||||
InitializeRtc(_syncSettings.InitialTime);
|
InitializeRtc(_syncSettings.InitialTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public readonly ReadOnlyCollection<bool> InputsActive;
|
||||||
|
|
||||||
private static readonly IReadOnlyCollection<KeyValuePair<string, LibTIC80.TIC80Keys>> KeyMap = MakeKeyMap();
|
private static readonly IReadOnlyCollection<KeyValuePair<string, LibTIC80.TIC80Keys>> KeyMap = MakeKeyMap();
|
||||||
|
|
||||||
private static IReadOnlyCollection<KeyValuePair<string, LibTIC80.TIC80Keys>> MakeKeyMap()
|
private static IReadOnlyCollection<KeyValuePair<string, LibTIC80.TIC80Keys>> MakeKeyMap()
|
||||||
|
@ -89,13 +93,13 @@ namespace BizHawk.Emulation.Cores.Computers.TIC80
|
||||||
return Array.AsReadOnly(ret);
|
return Array.AsReadOnly(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ControllerDefinition CreateControllerDefinition(bool[] inputsEnabled)
|
private static ControllerDefinition CreateControllerDefinition(bool[] inputsActive)
|
||||||
{
|
{
|
||||||
var ret = new ControllerDefinition("TIC-80 Controller");
|
var ret = new ControllerDefinition("TIC-80 Controller");
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
if (inputsEnabled[i])
|
if (inputsActive[i])
|
||||||
{
|
{
|
||||||
foreach (var b in Enum.GetValues(typeof(LibTIC80.TIC80Gamepad)))
|
foreach (var b in Enum.GetValues(typeof(LibTIC80.TIC80Gamepad)))
|
||||||
{
|
{
|
||||||
|
@ -104,7 +108,7 @@ namespace BizHawk.Emulation.Cores.Computers.TIC80
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inputsEnabled[4])
|
if (inputsActive[4])
|
||||||
{
|
{
|
||||||
ret.AddXYPair("Mouse Position {0}", AxisPairOrientation.RightAndUp, (-128).RangeTo(127), 0);
|
ret.AddXYPair("Mouse Position {0}", AxisPairOrientation.RightAndUp, (-128).RangeTo(127), 0);
|
||||||
ret.BoolButtons.Add("Mouse Left Click");
|
ret.BoolButtons.Add("Mouse Left Click");
|
||||||
|
@ -130,7 +134,7 @@ namespace BizHawk.Emulation.Cores.Computers.TIC80
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inputsEnabled[5])
|
if (inputsActive[5])
|
||||||
{
|
{
|
||||||
foreach (var k in Enum.GetValues(typeof(LibTIC80.TIC80Keys)))
|
foreach (var k in Enum.GetValues(typeof(LibTIC80.TIC80Keys)))
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,96 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
|
|
||||||
|
using BizHawk.Common;
|
||||||
|
using BizHawk.Emulation.Common;
|
||||||
|
using BizHawk.Emulation.Cores.Computers.TIC80;
|
||||||
|
|
||||||
|
namespace BizHawk.Emulation.Cores
|
||||||
|
{
|
||||||
|
[Schema(VSystemID.Raw.TIC80)]
|
||||||
|
public class TIC80Schema : IVirtualPadSchema
|
||||||
|
{
|
||||||
|
public virtual IEnumerable<PadSchema> GetPadSchemas(IEmulator core, Action<string> showMessageBox)
|
||||||
|
{
|
||||||
|
var inputsActive = ((TIC80)core).InputsActive;
|
||||||
|
if (inputsActive[0]) yield return StandardController(1);
|
||||||
|
if (inputsActive[1]) yield return StandardController(2);
|
||||||
|
if (inputsActive[2]) yield return StandardController(3);
|
||||||
|
if (inputsActive[3]) yield return StandardController(4);
|
||||||
|
if (inputsActive[4]) yield return Mouse();
|
||||||
|
// todo: keyboard
|
||||||
|
yield return ConsoleButtons();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static PadSchema StandardController(int controller)
|
||||||
|
{
|
||||||
|
return new PadSchema
|
||||||
|
{
|
||||||
|
Size = new Size(174, 79),
|
||||||
|
Buttons = new[]
|
||||||
|
{
|
||||||
|
ButtonSchema.Up(14, 12, controller),
|
||||||
|
ButtonSchema.Down(14, 56, controller),
|
||||||
|
ButtonSchema.Left(2, 34, controller),
|
||||||
|
ButtonSchema.Right(24, 34, controller),
|
||||||
|
new ButtonSchema(100, 45, controller, "B"),
|
||||||
|
new ButtonSchema(124, 45, controller, "A"),
|
||||||
|
new ButtonSchema(100, 23, controller, "Y"),
|
||||||
|
new ButtonSchema(124, 23, controller, "X")
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private static PadSchema Mouse()
|
||||||
|
{
|
||||||
|
var posRange = new AxisSpec((-128).RangeTo(127), 0);
|
||||||
|
var scrollRange = new AxisSpec((-32).RangeTo(31), 0);
|
||||||
|
return new PadSchema
|
||||||
|
{
|
||||||
|
Size = new Size(375, 395),
|
||||||
|
Buttons = new PadSchemaControl[]
|
||||||
|
{
|
||||||
|
new AnalogSchema(6, 14, "Mouse Position X")
|
||||||
|
{
|
||||||
|
Spec = posRange,
|
||||||
|
SecondarySpec = posRange,
|
||||||
|
},
|
||||||
|
new AnalogSchema(6, 220, "Mouse Scroll X")
|
||||||
|
{
|
||||||
|
Spec = scrollRange,
|
||||||
|
SecondarySpec = scrollRange,
|
||||||
|
},
|
||||||
|
new ButtonSchema(275, 15, "Mouse Left Click")
|
||||||
|
{
|
||||||
|
DisplayName = "Left",
|
||||||
|
},
|
||||||
|
new ButtonSchema(275, 45, "Mouse Middle Click")
|
||||||
|
{
|
||||||
|
DisplayName = "Middle",
|
||||||
|
},
|
||||||
|
new ButtonSchema(275, 75, "Mouse Right Click")
|
||||||
|
{
|
||||||
|
DisplayName = "Right",
|
||||||
|
},
|
||||||
|
new ButtonSchema(275, 105, "Mouse Relative Toggle")
|
||||||
|
{
|
||||||
|
DisplayName = "Relative Toggle",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private static PadSchema ConsoleButtons()
|
||||||
|
{
|
||||||
|
return new ConsoleSchema
|
||||||
|
{
|
||||||
|
Size = new Size(75, 50),
|
||||||
|
Buttons = new[]
|
||||||
|
{
|
||||||
|
new ButtonSchema(10, 15, "Reset")
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue