fix ButtonCount lua script to use console.log instead of the now deleted console.output, Lua - remove some todos that had been done and some rather useless cleanup
This commit is contained in:
parent
96da0880b4
commit
05823d3022
|
@ -40,6 +40,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
get { return _guiLibrary; }
|
||||
}
|
||||
|
||||
public LuaFunctionList RegisteredFunctions
|
||||
{
|
||||
get { return _eventLibrary.RegisteredFunctions; }
|
||||
}
|
||||
|
||||
public void WindowClosed(IntPtr handle)
|
||||
{
|
||||
_formsLibrary.WindowClosed(handle);
|
||||
|
@ -55,11 +60,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
_eventLibrary.CallLoadStateEvent(name);
|
||||
}
|
||||
|
||||
public LuaFunctionList RegisteredFunctions
|
||||
{
|
||||
get { return _eventLibrary.RegisteredFunctions; }
|
||||
}
|
||||
|
||||
public void CallFrameBeforeEvent()
|
||||
{
|
||||
_eventLibrary.CallFrameBeforeEvent();
|
||||
|
@ -87,8 +87,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
new EmulatorLuaLibrary(
|
||||
_lua,
|
||||
Frameadvance,
|
||||
EmuYield
|
||||
).LuaRegister(lua, Docs);
|
||||
EmuYield).LuaRegister(lua, Docs);
|
||||
|
||||
_eventLibrary.LuaRegister(lua, Docs);
|
||||
_formsLibrary.LuaRegister(lua, Docs);
|
||||
|
@ -114,12 +113,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
return lua;
|
||||
}
|
||||
|
||||
public class ResumeResult
|
||||
{
|
||||
public bool WaitForFrame { get; set; }
|
||||
public bool Terminated { get; set; }
|
||||
}
|
||||
|
||||
public ResumeResult ResumeScript(Lua script)
|
||||
{
|
||||
_eventLibrary.CurrentThread = script;
|
||||
|
@ -158,5 +151,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
GlobalWin.DisplayManager.NeedsToPaint = true;
|
||||
_currThread.Yield(0);
|
||||
}
|
||||
|
||||
public class ResumeResult
|
||||
{
|
||||
public bool WaitForFrame { get; set; }
|
||||
public bool Terminated { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,29 +14,12 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
public partial class LuaConsole : Form, IToolForm
|
||||
{
|
||||
// TODO:
|
||||
// remember column widths and restore column width on restore default settings
|
||||
// column reorder
|
||||
public EmuLuaLibrary LuaImp { get; set; }
|
||||
|
||||
private readonly LuaFileList _luaList;
|
||||
private int _defaultWidth;
|
||||
private int _defaultHeight;
|
||||
private bool _sortReverse;
|
||||
private string _lastColumnSorted;
|
||||
|
||||
public bool UpdateBefore { get { return true; } }
|
||||
public void UpdateValues() { }
|
||||
|
||||
public LuaConsole Get() { return this; }
|
||||
|
||||
public void ConsoleLog(string message)
|
||||
{
|
||||
OutputBox.Text += message + Environment.NewLine + Environment.NewLine;
|
||||
OutputBox.SelectionStart = OutputBox.Text.Length;
|
||||
OutputBox.ScrollToCaret();
|
||||
}
|
||||
|
||||
public LuaConsole()
|
||||
{
|
||||
_sortReverse = false;
|
||||
|
@ -68,6 +51,41 @@ namespace BizHawk.Client.EmuHawk
|
|||
TopMost = Global.Config.LuaSettings.TopMost;
|
||||
}
|
||||
|
||||
public EmuLuaLibrary LuaImp { get; set; }
|
||||
|
||||
public bool UpdateBefore { get { return true; } }
|
||||
|
||||
private IEnumerable<int> SelectedIndices
|
||||
{
|
||||
get { return LuaListView.SelectedIndices.Cast<int>(); }
|
||||
}
|
||||
|
||||
private IEnumerable<LuaFile> SelectedItems
|
||||
{
|
||||
get { return SelectedIndices.Select(index => _luaList[index]); }
|
||||
}
|
||||
|
||||
private IEnumerable<LuaFile> SelectedFiles
|
||||
{
|
||||
get { return SelectedItems.Where(x => !x.IsSeparator); }
|
||||
}
|
||||
|
||||
private void RefreshFloatingWindowControl()
|
||||
{
|
||||
Owner = Global.Config.LuaSettings.FloatingWindow ? null : GlobalWin.MainForm;
|
||||
}
|
||||
|
||||
public void UpdateValues() { }
|
||||
|
||||
public LuaConsole Get() { return this; }
|
||||
|
||||
public void ConsoleLog(string message)
|
||||
{
|
||||
OutputBox.Text += message + Environment.NewLine + Environment.NewLine;
|
||||
OutputBox.SelectionStart = OutputBox.Text.Length;
|
||||
OutputBox.ScrollToCaret();
|
||||
}
|
||||
|
||||
private void LuaConsole_Load(object sender, EventArgs e)
|
||||
{
|
||||
LoadConfigSettings();
|
||||
|
@ -501,12 +519,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
return true;
|
||||
}
|
||||
else if (result == DialogResult.No)
|
||||
|
||||
if (result == DialogResult.No)
|
||||
{
|
||||
_luaList.Changes = false;
|
||||
return true;
|
||||
}
|
||||
else if (result == DialogResult.Cancel)
|
||||
|
||||
if (result == DialogResult.Cancel)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -524,8 +544,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
private Point GetPromptPoint()
|
||||
{
|
||||
return PointToScreen(
|
||||
new Point(LuaListView.Location.X + 30, LuaListView.Location.Y + 30)
|
||||
);
|
||||
new Point(LuaListView.Location.X + 30, LuaListView.Location.Y + 30));
|
||||
}
|
||||
|
||||
private static void UpdateRegisteredFunctionsDialog()
|
||||
|
@ -536,26 +555,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
}
|
||||
|
||||
private IEnumerable<int> SelectedIndices
|
||||
{
|
||||
get { return LuaListView.SelectedIndices.Cast<int>(); }
|
||||
}
|
||||
|
||||
private IEnumerable<LuaFile> SelectedItems
|
||||
{
|
||||
get { return SelectedIndices.Select(index => _luaList[index]); }
|
||||
}
|
||||
|
||||
private IEnumerable<LuaFile> SelectedFiles
|
||||
{
|
||||
get { return SelectedItems.Where(x => !x.IsSeparator); }
|
||||
}
|
||||
|
||||
private void RefreshFloatingWindowControl()
|
||||
{
|
||||
Owner = Global.Config.LuaSettings.FloatingWindow ? null : GlobalWin.MainForm;
|
||||
}
|
||||
|
||||
#region Events
|
||||
|
||||
#region File Menu
|
||||
|
@ -569,16 +568,14 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
RecentSessionsSubMenu.DropDownItems.Clear();
|
||||
RecentSessionsSubMenu.DropDownItems.AddRange(
|
||||
ToolHelpers.GenerateRecentMenu(Global.Config.RecentLuaSession, LoadSessionFromRecent)
|
||||
);
|
||||
ToolHelpers.GenerateRecentMenu(Global.Config.RecentLuaSession, LoadSessionFromRecent));
|
||||
}
|
||||
|
||||
private void RecentScriptsSubMenu_DropDownOpened(object sender, EventArgs e)
|
||||
{
|
||||
RecentScriptsSubMenu.DropDownItems.Clear();
|
||||
RecentScriptsSubMenu.DropDownItems.AddRange(
|
||||
ToolHelpers.GenerateRecentMenu(Global.Config.RecentLua, LoadLuaFromRecent)
|
||||
);
|
||||
ToolHelpers.GenerateRecentMenu(Global.Config.RecentLua, LoadLuaFromRecent));
|
||||
}
|
||||
|
||||
private void NewSessionMenuItem_Click(object sender, EventArgs e)
|
||||
|
@ -1109,7 +1106,5 @@ namespace BizHawk.Client.EmuHawk
|
|||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ end
|
|||
|
||||
function frames()
|
||||
if not movie.isloaded() then
|
||||
console.output('No data loaded from frames')
|
||||
console.log('No data loaded from frames')
|
||||
return
|
||||
end
|
||||
reset()
|
||||
|
@ -46,7 +46,7 @@ function frames()
|
|||
for frame = 0, emu.framecount() - 1 do
|
||||
record(movie.getinput(frame))
|
||||
end
|
||||
console.output('Data loaded from frames')
|
||||
console.log('Data loaded from frames')
|
||||
counts(data)
|
||||
end
|
||||
|
||||
|
@ -59,7 +59,7 @@ function load(name)
|
|||
return
|
||||
end
|
||||
data = deepcopy(states[name])
|
||||
console.output('Data loaded from ' .. name)
|
||||
console.log('Data loaded from ' .. name)
|
||||
--Show the data from before the state's frame.
|
||||
local previous = states[name].previous
|
||||
counts(previous)
|
||||
|
@ -98,7 +98,7 @@ function save(name)
|
|||
state = deepcopy(data)
|
||||
end
|
||||
states[name] = deepcopy(state)
|
||||
console.output('Data saved to ' .. name)
|
||||
console.log('Data saved to ' .. name)
|
||||
end
|
||||
|
||||
reset()
|
||||
|
|
Loading…
Reference in New Issue