fix some input things
This commit is contained in:
parent
c8727ae01f
commit
2425b3c87a
|
@ -39,6 +39,7 @@ namespace BizHawk.MultiClient
|
|||
public static IController ControllerOutput;
|
||||
|
||||
public static Input.InputCoalescer InputCoalescer;
|
||||
public static UD_LR_ControllerAdapter UD_LR_ControllerAdapter = new UD_LR_ControllerAdapter();
|
||||
|
||||
public static string GetOutputControllersAsMnemonic()
|
||||
{
|
||||
|
|
|
@ -81,53 +81,9 @@ namespace BizHawk.MultiClient
|
|||
|
||||
public bool IsPressed(string button)
|
||||
{
|
||||
//if (forcePressedButtons.Contains(button))
|
||||
//{
|
||||
// removeFromForcePressedButtons.Add(button);
|
||||
// return true;
|
||||
//}
|
||||
//if (unpressedButtons.Contains(button))
|
||||
//{
|
||||
// if (IsPressedActually(button) == false)
|
||||
// unpressedButtons.Remove(button);
|
||||
|
||||
// return false;
|
||||
//}
|
||||
|
||||
////zeromus - TODO - this is gross!!!
|
||||
//if (Global.Config.AllowUD_LR == false)
|
||||
//{
|
||||
// string prefix;
|
||||
|
||||
// if (button.Contains("Down"))
|
||||
// {
|
||||
// prefix = button.GetPrecedingString("Down");
|
||||
// if (IsPressed(prefix + "Up"))
|
||||
// return false;
|
||||
// }
|
||||
// if (button.Contains("Right"))
|
||||
// {
|
||||
// prefix = button.GetPrecedingString("Right");
|
||||
// if (IsPressed(prefix + "Left"))
|
||||
// return false;
|
||||
// }
|
||||
//}
|
||||
|
||||
//return IsPressedActually(button);
|
||||
return stickyButtons[button];
|
||||
}
|
||||
|
||||
//public bool IsPressedActually(string button)
|
||||
//{
|
||||
// bool sticky = stickyButtons[button];
|
||||
|
||||
// foreach (var control in bindings[button])
|
||||
// if (Input.Instance.IsPressed(control))
|
||||
// return sticky ? false : true;
|
||||
|
||||
// return sticky ? true : false;
|
||||
//}
|
||||
|
||||
public float GetFloat(string name)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
@ -138,18 +94,8 @@ namespace BizHawk.MultiClient
|
|||
unpressedButtons.Add(name);
|
||||
}
|
||||
|
||||
private int frameNumber;
|
||||
|
||||
public void UpdateControls(int frame)
|
||||
{
|
||||
//if (frame != frameNumber)
|
||||
//{
|
||||
// // update
|
||||
// unpressedButtons.RemoveAll(button => IsPressedActually(button) == false);
|
||||
// forcePressedButtons.RemoveAll(button => removeFromForcePressedButtons.Contains(button));
|
||||
// removeFromForcePressedButtons.Clear();
|
||||
//}
|
||||
//frameNumber = frame;
|
||||
}
|
||||
|
||||
public void SetSticky(string button, bool sticky)
|
||||
|
|
|
@ -10,7 +10,6 @@ namespace BizHawk.MultiClient
|
|||
private static DirectInput dinput;
|
||||
private static Keyboard keyboard;
|
||||
private static KeyboardState state = new KeyboardState();
|
||||
private static List<Key> unpressedKeys = new List<Key>();
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
|
@ -32,23 +31,13 @@ namespace BizHawk.MultiClient
|
|||
state = keyboard.GetCurrentState();
|
||||
if (Result.Last.IsFailure)
|
||||
return;
|
||||
|
||||
unpressedKeys.RemoveAll(key => state.IsReleased(key));
|
||||
}
|
||||
|
||||
public static KeyboardState State { get { return state; } }
|
||||
|
||||
public static void Unpress(Key key)
|
||||
{
|
||||
if (unpressedKeys.Contains(key))
|
||||
return;
|
||||
unpressedKeys.Add(key);
|
||||
}
|
||||
|
||||
|
||||
public static bool IsPressed(Key key)
|
||||
{
|
||||
if (unpressedKeys.Contains(key))
|
||||
return false;
|
||||
if (state.IsPressed(key))
|
||||
return true;
|
||||
|
||||
|
|
|
@ -281,6 +281,7 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
|
||||
bool _HACK_KEY_FF;
|
||||
bool _HACK_KEY_REWIND;
|
||||
|
||||
void SyncThrottle()
|
||||
{
|
||||
|
@ -779,7 +780,8 @@ namespace BizHawk.MultiClient
|
|||
//insert turbo and lua here?
|
||||
Global.InputCoalescer = new Input.InputCoalescer();
|
||||
Global.InputCoalescer.Type = Global.ActiveController.Type;
|
||||
Global.MultitrackRewiringControllerAdapter.Source = Global.ActiveController;
|
||||
Global.UD_LR_ControllerAdapter.Source = Global.ActiveController;
|
||||
Global.MultitrackRewiringControllerAdapter.Source = Global.UD_LR_ControllerAdapter;
|
||||
Global.MovieInputSourceAdapter.Source = Global.MultitrackRewiringControllerAdapter;
|
||||
Global.MovieControllerAdapter.SetSource(Global.MovieInputSourceAdapter);
|
||||
Global.ControllerOutput = Global.MovieControllerAdapter;
|
||||
|
@ -993,6 +995,11 @@ namespace BizHawk.MultiClient
|
|||
_HACK_KEY_FF = ie.EventType == Input.InputEventType.Press;
|
||||
continue;
|
||||
}
|
||||
if (trigger == "Rewind")
|
||||
{
|
||||
_HACK_KEY_REWIND = ie.EventType == Input.InputEventType.Press;
|
||||
continue;
|
||||
}
|
||||
|
||||
if(ie.EventType == Input.InputEventType.Release) continue;
|
||||
|
||||
|
@ -1160,6 +1167,10 @@ namespace BizHawk.MultiClient
|
|||
Global.RenderPanel.MT = "Recording None";
|
||||
break;
|
||||
}
|
||||
case "Emulator Pause":
|
||||
//used to be here: (the pause hotkey is ignored when we are frame advancing)
|
||||
TogglePause();
|
||||
break;
|
||||
|
||||
} //switch(trigger)
|
||||
|
||||
|
@ -1167,20 +1178,6 @@ namespace BizHawk.MultiClient
|
|||
|
||||
} //foreach event
|
||||
|
||||
//TODO -
|
||||
//the pause hotkey is ignored when we are frame advancing
|
||||
//if (!Input.Instance.IsPressed("Frame Advance"))
|
||||
//{
|
||||
// if (Global.ClientControls["Emulator Pause"])
|
||||
// {
|
||||
// Global.ClientControls.UnpressButton("Emulator Pause");
|
||||
// if (EmulatorPaused)
|
||||
// UnpauseEmulator();
|
||||
// else
|
||||
// PauseEmulator();
|
||||
// }
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
void StepRunLoop_Throttle()
|
||||
|
@ -1241,7 +1238,7 @@ namespace BizHawk.MultiClient
|
|||
runFrame = true;
|
||||
}
|
||||
|
||||
if (Global.Config.RewindEnabled && Global.ClientControls["Rewind"] || PressRewind)
|
||||
if (Global.Config.RewindEnabled && _HACK_KEY_REWIND || PressRewind)
|
||||
{
|
||||
rewindCredits += Global.Config.SpeedPercent;
|
||||
int rewindTodo = rewindCredits / 100;
|
||||
|
|
|
@ -4,6 +4,39 @@ using System.Collections.Generic;
|
|||
|
||||
namespace BizHawk.MultiClient
|
||||
{
|
||||
//filters input for things called Up and Down while considering the client's AllowUD_LR option.
|
||||
//this is a bit gross but it is unclear how to do it more nicely
|
||||
public class UD_LR_ControllerAdapter : IController
|
||||
{
|
||||
public ControllerDefinition Type { get { return Source.Type; } }
|
||||
public IController Source;
|
||||
|
||||
public bool this[string button] { get { return IsPressed(button); } }
|
||||
public float GetFloat(string name) { return 0.0f; } //TODO
|
||||
public void UpdateControls(int frame) { }
|
||||
public bool IsPressed(string button)
|
||||
{
|
||||
if (Global.Config.AllowUD_LR == true)
|
||||
return Source.IsPressed(button);
|
||||
|
||||
string prefix;
|
||||
|
||||
if (button.Contains("Down"))
|
||||
{
|
||||
prefix = button.GetPrecedingString("Down");
|
||||
if (Source.IsPressed(prefix + "Up"))
|
||||
return false;
|
||||
}
|
||||
if (button.Contains("Right"))
|
||||
{
|
||||
prefix = button.GetPrecedingString("Right");
|
||||
if (Source.IsPressed(prefix + "Left"))
|
||||
return false;
|
||||
}
|
||||
|
||||
return Source.IsPressed(button);
|
||||
}
|
||||
}
|
||||
|
||||
public class SimpleController : IController
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue