Added Frameadvance with threading. Can't test, because CueFromPath is broken.
This commit is contained in:
parent
abf0698e43
commit
16ec704e41
|
@ -6,6 +6,8 @@ using System.IO;
|
|||
using LuaInterface;
|
||||
using System.Windows.Forms;
|
||||
using BizHawk.MultiClient.tools;
|
||||
using System.Threading;
|
||||
|
||||
|
||||
namespace BizHawk.MultiClient
|
||||
{
|
||||
|
@ -14,10 +16,14 @@ namespace BizHawk.MultiClient
|
|||
Lua lua = new Lua();
|
||||
LuaConsole Caller;
|
||||
public String LuaLibraryList = "";
|
||||
public EventWaitHandle LuaWait;
|
||||
public bool isRunning;
|
||||
private Thread LuaThread;
|
||||
private int CurrentMemoryDomain = 0; //Main memory by default
|
||||
|
||||
public LuaImplementation(LuaConsole passed)
|
||||
{
|
||||
EventWaitHandle LuaWait = new AutoResetEvent(false);
|
||||
LuaLibraryList = "";
|
||||
Caller = passed.get();
|
||||
lua.RegisterFunction("print", this, this.GetType().GetMethod("print"));
|
||||
|
@ -72,12 +78,22 @@ namespace BizHawk.MultiClient
|
|||
LuaLibraryList += "client." + MultiClientFunctions[i] + "\n";
|
||||
}
|
||||
}
|
||||
private void LuaThreadFunction(object File)
|
||||
{
|
||||
string F = File.ToString();
|
||||
isRunning = true;
|
||||
lua.DoFile(F);
|
||||
isRunning = false;
|
||||
LuaWait.Set();
|
||||
}
|
||||
|
||||
public void DoLuaFile(string File)
|
||||
{
|
||||
lua.DoFile(File);
|
||||
LuaThread = new Thread(new ParameterizedThreadStart(LuaThreadFunction));
|
||||
LuaThread.Start(File);
|
||||
}
|
||||
|
||||
|
||||
public void print(string s)
|
||||
{
|
||||
Caller.AddText(string.Format(s));
|
||||
|
@ -180,8 +196,8 @@ namespace BizHawk.MultiClient
|
|||
//----------------------------------------------------
|
||||
public void emu_frameadvance()
|
||||
{
|
||||
//Global.MainForm.PressFrameAdvance = true;
|
||||
//Global.Emulator.FrameAdvance(true);
|
||||
LuaWait.Set();
|
||||
Global.MainForm.MainWait.WaitOne();
|
||||
}
|
||||
|
||||
public void emu_pause()
|
||||
|
|
|
@ -37,6 +37,7 @@ namespace BizHawk.MultiClient
|
|||
bool runloop_frameProgress;
|
||||
DateTime FrameAdvanceTimestamp = DateTime.MinValue;
|
||||
public bool EmulatorPaused;
|
||||
public EventWaitHandle MainWait;
|
||||
int runloop_fps;
|
||||
int runloop_last_fps;
|
||||
bool runloop_frameadvance;
|
||||
|
@ -67,6 +68,7 @@ namespace BizHawk.MultiClient
|
|||
{
|
||||
Global.MovieSession = new MovieSession();
|
||||
Global.MovieSession.Movie = new Movie();
|
||||
MainWait = new AutoResetEvent(false)
|
||||
Icon = BizHawk.MultiClient.Properties.Resources.logo;
|
||||
InitializeComponent();
|
||||
Global.Game = GameInfo.GetNullGame();
|
||||
|
@ -331,6 +333,8 @@ namespace BizHawk.MultiClient
|
|||
for (; ; )
|
||||
{
|
||||
//client input-related duties
|
||||
|
||||
|
||||
Input.Instance.Update();
|
||||
//handle events and dispatch as a hotkey action, or a hotkey button, or an input button
|
||||
ProcessInput();
|
||||
|
@ -339,14 +343,19 @@ namespace BizHawk.MultiClient
|
|||
Global.ActiveController.OR_FromLogical(Global.ClickyVirtualPadController);
|
||||
Global.AutoFireController.LatchFromPhysical(Global.ControllerInputCoalescer);
|
||||
Global.ClickyVirtualPadController.FrameTick();
|
||||
|
||||
|
||||
if (LuaConsole1.LuaImp.isRunning)
|
||||
{
|
||||
LuaConsole1.LuaImp.LuaWait.WaitOne();
|
||||
}
|
||||
StepRunLoop_Core();
|
||||
//if(!IsNullEmulator())
|
||||
StepRunLoop_Throttle();
|
||||
|
||||
Render();
|
||||
|
||||
if (LuaConsole1.LuaImp.isRunning)
|
||||
{
|
||||
MainForm.MainWait.Set();
|
||||
}
|
||||
CheckMessages();
|
||||
if (exit)
|
||||
break;
|
||||
|
|
|
@ -162,7 +162,7 @@ namespace BizHawk.MultiClient
|
|||
luaList.Add(l);
|
||||
LuaListView.ItemCount = luaList.Count;
|
||||
LuaListView.Refresh();
|
||||
Global.Config.RecentLua.Add(path);
|
||||
Global.Config.RecentLua.Add(path);
|
||||
LuaImp.DoLuaFile(path);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue