fix input.get
This commit is contained in:
parent
0bb9f65038
commit
e7eb6d8dcd
|
@ -1109,19 +1109,11 @@ namespace BizHawk.MultiClient
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
public LuaTable input_get()
|
public LuaTable input_get()
|
||||||
{
|
{
|
||||||
LuaTable keys = new LuaTable(1, lua);
|
LuaTable buttons = lua.NewTable();
|
||||||
string[] keystrings = Global.MainForm.lastKeyboard.Split(' ');
|
foreach (var kvp in Global.ControllerInputCoalescer.BoolButtons())
|
||||||
|
if (kvp.Value)
|
||||||
foreach (string keypress in keystrings)
|
buttons[kvp.Key] = true;
|
||||||
{
|
return buttons;
|
||||||
if (keypress.Contains("Press:"))
|
|
||||||
{
|
|
||||||
string key = keypress.Replace("Press:", "");
|
|
||||||
keys[key] = key;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return keys;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
|
@ -1131,7 +1123,7 @@ namespace BizHawk.MultiClient
|
||||||
//Currently sends all controllers, needs to control which ones it sends
|
//Currently sends all controllers, needs to control which ones it sends
|
||||||
public LuaTable joypad_get()
|
public LuaTable joypad_get()
|
||||||
{
|
{
|
||||||
LuaTable buttons = new LuaTable(1, lua);
|
LuaTable buttons = lua.NewTable();
|
||||||
foreach (string button in Global.ControllerOutput.Source.Type.BoolButtons)
|
foreach (string button in Global.ControllerOutput.Source.Type.BoolButtons)
|
||||||
buttons[button] = Global.ControllerOutput[button];
|
buttons[button] = Global.ControllerOutput[button];
|
||||||
|
|
||||||
|
@ -1145,7 +1137,7 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
public LuaTable joypad_getimmediate()
|
public LuaTable joypad_getimmediate()
|
||||||
{
|
{
|
||||||
LuaTable buttons = new LuaTable(1, lua);
|
LuaTable buttons = lua.NewTable();
|
||||||
foreach (string button in Global.ActiveController.Type.BoolButtons)
|
foreach (string button in Global.ActiveController.Type.BoolButtons)
|
||||||
buttons[button] = Global.ActiveController[button];
|
buttons[button] = Global.ActiveController[button];
|
||||||
return buttons;
|
return buttons;
|
||||||
|
|
Binary file not shown.
|
@ -376,6 +376,7 @@ namespace BizHawk.MultiClient
|
||||||
LuaConsole1.ResumeScripts(false);
|
LuaConsole1.ResumeScripts(false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Global.RenderPanel.ClearGUIText();
|
||||||
StepRunLoop_Core();
|
StepRunLoop_Core();
|
||||||
//if(!IsNullEmulator())
|
//if(!IsNullEmulator())
|
||||||
StepRunLoop_Throttle();
|
StepRunLoop_Throttle();
|
||||||
|
@ -1678,7 +1679,6 @@ namespace BizHawk.MultiClient
|
||||||
bool genSound = false;
|
bool genSound = false;
|
||||||
if (runFrame)
|
if (runFrame)
|
||||||
{
|
{
|
||||||
Global.RenderPanel.ClearGUIText();
|
|
||||||
//client input-related duties
|
//client input-related duties
|
||||||
|
|
||||||
#if WINDOWS
|
#if WINDOWS
|
||||||
|
|
Binary file not shown.
|
@ -82,6 +82,11 @@ namespace BizHawk.MultiClient
|
||||||
public float GetFloat(string name) { return 0.0f; } //TODO
|
public float GetFloat(string name) { return 0.0f; } //TODO
|
||||||
public void UpdateControls(int frame) { }
|
public void UpdateControls(int frame) { }
|
||||||
|
|
||||||
|
public IEnumerable<KeyValuePair<string, bool>> BoolButtons()
|
||||||
|
{
|
||||||
|
foreach (var kvp in Buttons) yield return kvp;
|
||||||
|
}
|
||||||
|
|
||||||
public virtual void LatchFrom(IController source)
|
public virtual void LatchFrom(IController source)
|
||||||
{
|
{
|
||||||
foreach (string button in source.Type.BoolButtons)
|
foreach (string button in source.Type.BoolButtons)
|
||||||
|
|
|
@ -647,6 +647,14 @@ namespace LuaInterface
|
||||||
translator.push(luaState,val);
|
translator.push(luaState,val);
|
||||||
LuaDLL.lua_settable(luaState,-3);
|
LuaDLL.lua_settable(luaState,-3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//zero 24-mar-2012 added
|
||||||
|
public LuaTable NewTable()
|
||||||
|
{
|
||||||
|
NewTable("_TEMP_BIZHAWK_RULES_");
|
||||||
|
return GetTable("_TEMP_BIZHAWK_RULES_");
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Creates a new table as a global variable or as a field
|
* Creates a new table as a global variable or as a field
|
||||||
* inside an existing table
|
* inside an existing table
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace LuaInterface
|
||||||
{
|
{
|
||||||
//internal int _Reference;
|
//internal int _Reference;
|
||||||
//private Lua _Interpreter;
|
//private Lua _Interpreter;
|
||||||
public LuaTable(int reference, Lua interpreter)
|
internal LuaTable(int reference, Lua interpreter)
|
||||||
{
|
{
|
||||||
_Reference = reference;
|
_Reference = reference;
|
||||||
_Interpreter = interpreter;
|
_Interpreter = interpreter;
|
||||||
|
|
Loading…
Reference in New Issue