private static void tmrHideMouse_Tick(object sender, EventArgs e) { if (InteropEmu.IsRunning() && !InteropEmu.IsPaused()) { HideMouse(); _tmrHideMouse.Stop(); } else { ShowMouse(); _tmrHideMouse.Stop(); } }
public static void OnMouseMove(Control ctrl) { if (_mouseCaptured && AllowMouseCapture) { HideMouse(); _tmrHideMouse.Stop(); Form frm = Application.OpenForms[0]; Point centerPos = frm.PointToScreen(new Point(frm.Width / 2, frm.Height / 2)); Point diff = new Point(Cursor.Position.X - centerPos.X, Cursor.Position.Y - centerPos.Y); if (diff.X != 0 || diff.Y != 0) { InteropEmu.SetMouseMovement((Int16)diff.X, (Int16)diff.Y); Cursor.Position = centerPos; } } else { _mouseCaptured = false; if (!InteropEmu.IsRunning() || InteropEmu.IsPaused()) { ShowMouse(); } else if (ConfigManager.Config.InputInfo.HideMousePointerForZapper && CursorManager.IsLightGun) { //Keep mouse hidden when using zapper if option to hide mouse is enabled HideMouse(); return; } _tmrHideMouse.Stop(); if (!CursorManager.NeedMouseIcon) { //Only hide mouse if no zapper (otherwise this could be pretty annoying) ctrl.Cursor = Cursors.Default; if (InteropEmu.IsRunning() && !InteropEmu.IsPaused()) { _tmrHideMouse.Start(); } } } }
private static void tmrCheckMouseMove_Tick(object sender, EventArgs e) { //Rarely the cursor becomes hidden despite leaving the window or moving //Have not been able to find a reliable way to reproduce it yet //This is a patch to prevent that bug from having any negative impact if (!_mouseCaptured && _lastPosition != Cursor.Position) { _lastPosition = Cursor.Position; bool running = InteropEmu.IsRunning() && !InteropEmu.IsPaused(); if (running && ConfigManager.Config.InputInfo.HideMousePointerForZapper && CursorManager.IsLightGun) { //Keep mouse hidden when using zapper if option to hide mouse is enabled return; } ShowMouse(); } }
public static void OnMouseMove(Control ctrl) { if (!InteropEmu.IsRunning() || InteropEmu.IsPaused() || !InteropEmu.HasArkanoidPaddle()) { ShowMouse(); } else if (InteropEmu.HasArkanoidPaddle() && !CursorManager.NeedMouseIcon) { HideMouse(); } _tmrHideMouse.Stop(); if (!CursorManager.NeedMouseIcon) { //Only hide mouse if no zapper (otherwise this could be pretty annoying) ctrl.Cursor = Cursors.Default; if (InteropEmu.IsRunning() && !InteropEmu.IsPaused()) { _tmrHideMouse.Start(); } } }
internal static int Run(string[] args) { ConfigManager.DoNotSaveSettings = true; string romPath; List <string> luaScriptsToLoad; CommandLineHelper.GetRomPathFromCommandLine(CommandLineHelper.PreprocessCommandLineArguments(args, false), out romPath, out luaScriptsToLoad); if (romPath == null) { //No rom specified return(-1); } List <string> lcArgs = CommandLineHelper.PreprocessCommandLineArguments(args, true); int timeout = 100; //100 seconds string timeoutArg = lcArgs.Find(arg => arg.StartsWith("/timeout=")); if (timeoutArg != null) { int timeoutValue; if (Int32.TryParse(timeoutArg.Substring(timeoutArg.IndexOf("=") + 1), out timeoutValue)) { timeout = timeoutValue; } } ConfigManager.ProcessSwitches(lcArgs); ConfigManager.Config.ApplyConfig(); InteropEmu.SetFlag(EmulationFlags.ConsoleMode, true); InteropEmu.InitializeEmu(ConfigManager.HomeFolder, IntPtr.Zero, IntPtr.Zero, true, true, true); InteropEmu.LoadROM(romPath, string.Empty); foreach (string luaScript in luaScriptsToLoad) { try { string script = File.ReadAllText(luaScript); InteropEmu.DebugLoadScript(luaScript, script); } catch { } } System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); Task.Run(() => { InteropEmu.Run(); }); InteropEmu.SetFlag(EmulationFlags.ForceMaxSpeed, true); sw.Start(); int result = -1; while (sw.ElapsedMilliseconds < timeout * 1000) { System.Threading.Thread.Sleep(100); if (!InteropEmu.IsRunning()) { result = InteropEmu.GetStopCode(); break; } } InteropEmu.Stop(); InteropEmu.Release(); return(result); }