private void BeforeQuickSave(object sender, BeforeQuickSaveEventArgs e) { if (treeView.SelectedNode == null) { treeView.SelectedNode = treeView.Nodes[0]; } if (treeView.SelectedNode.Tag is FileInfo) { treeView.SelectedNode = treeView.SelectedNode.Parent; } string path = Path.Combine(PathManager.GetSaveStatePath(Global.Game), treeView.SelectedNode.FullPath); ClientApi.SaveState(Path.Combine(path, e.Name)); e.Handled = true; foreach (TreeNode node in treeView.SelectedNode.Nodes) { if (node.Text == e.Name) { return; } } TreeNode newNode = new TreeNode(e.Name); newNode.Tag = new FileInfo(Path.Combine(path, string.Format("{0}.State", e.Name))); treeView.SelectedNode.Nodes.Add(newNode); if (treeView.SelectedNode != null) { treeView.SelectedNode.ExpandAll(); } }
/*private void Test(BinaryReader r) * { * System.Drawing.Bitmap b = new System.Drawing.Bitmap(r.BaseStream); * }*/ private void saveState_Click(object sender, EventArgs e) { if (savestateName.Text.Trim() != string.Empty) { ClientApi.SaveState(savestateName.Text); } }
private void BeforeQuickLoad(object sender, BeforeQuickLoadEventArgs e) { if (treeView.SelectedNode.Tag is FileInfo) { treeView.SelectedNode = treeView.SelectedNode.Parent; } string path = Path.Combine(PathManager.GetSaveStatePath(Global.Game), string.Format(@"{0}\{1}", treeView.SelectedNode.FullPath, e.Name)); if (File.Exists(string.Format("{0}.State", path))) { try { ClientApi.LoadState(path); } #if DEBUG catch (TargetInvocationException ex) { MessageBox.Show(ex.Message); } #else catch (TargetInvocationException) {} #endif } e.Handled = true; }
private void loadstate_Click(object sender, EventArgs e) { if (savestateName.Text.Trim() != string.Empty) { ClientApi.LoadState(savestateName.Text); //BinaryStateLoader.LoadAndDetect(savestateName.Text + ".State").GetLump(BinaryStateLump.Framebuffer, false, Test); } }
public LuaTable TransformPoint(int x, int y) { var transformed = ClientApi.TransformPoint(new Point(x, y)); var table = Lua.NewTable(); table["x"] = transformed.X; table["y"] = transformed.Y; return(table); }
//We will override F10 quickload behavior private void ClientApi_BeforeQuickLoad(object sender, BeforeQuickLoadEventArgs e) { if (e.Slot == 0) { string basePath = Path.Combine(PathManager.GetSaveStatePath(Global.Game), "Test"); ClientApi.LoadState(Path.Combine(basePath, e.Name)); e.Handled = true; } }
//We will override F10 quicksave behavior private void ClientApi_BeforeQuickSave(object sender, BeforeQuickSaveEventArgs e) { if (e.Slot == 0) { string basePath = Path.Combine(PathManager.GetSaveStatePath(Global.Game), "Test"); if (!Directory.Exists(basePath)) { Directory.CreateDirectory(basePath); } ClientApi.SaveState(Path.Combine(basePath, e.Name)); e.Handled = true; } }
private void ExecCommand(Command cmd) { if (this.checkBoxSaveState.Checked) { ClientApi.SaveState(SaveStateName); } for (int i = 0; i < cmd.ButtonPresses.Length; i++) { for (int f = 0; f < cmd.ButtonPresses[i].Frames; f++) { this.AddButtons(cmd.ButtonPresses[i].Buttons); ClientApi.DoFrameAdvance(); } } Joypad controller = ClientApi.GetInput(1); controller.ClearInputs(); ClientApi.SetInput(1, controller); }
/// <summary> /// Restart is called the first time you call the form /// but also when you start playing a movie /// </summary> public void Restart() { //set a client padding ClientApi.SetExtraPadding(50, 50); if (Global.Game.Name != "Null") { //first initialization of WatchList if (_watches == null) { _watches = new WatchList(_memoryDomains, _emu.SystemId ?? string.Empty); //Create some watch Watch myFirstWatch = Watch.GenerateWatch(_memoryDomains.MainMemory, 0x40, WatchSize.Byte, BizHawk.Client.Common.DisplayType.Hex, true); Watch mySecondWatch = Watch.GenerateWatch(_memoryDomains.MainMemory, 0x50, WatchSize.Word, BizHawk.Client.Common.DisplayType.Unsigned, true); Watch myThirdWatch = Watch.GenerateWatch(_memoryDomains.MainMemory, 0x60, WatchSize.DWord, BizHawk.Client.Common.DisplayType.Hex, true); //add them into the list _watches.Add(myFirstWatch); _watches.Add(mySecondWatch); _watches.Add(myThirdWatch); label_Game.Text = string.Format("You're playing {0}", Global.Game.Name); label_GameHash.Text = string.Format("Hash: {0}", Global.Game.Hash); } //refresh it else { _watches.RefreshDomains(_memoryDomains); label_Game.Text = string.Format("You're playing {0}", Global.Game.Name); label_GameHash.Text = string.Format("Hash: {0}", Global.Game.Hash); } } else { label_Game.Text = string.Format("You aren't playing to anything"); label_GameHash.Text = string.Empty; } }
private void button3_Click(object sender, EventArgs e) { for (int i = 0; i < 600; i++) { if (i % 60 == 0) { Joypad j1 = ClientApi.GetInput(1); j1.AddInput(JoypadButton.A); ClientApi.SetInput(1, j1); ClientApi.DoFrameAdvance(); j1.RemoveInput(JoypadButton.A); ClientApi.SetInput(1, j1); ClientApi.DoFrameAdvance(); } ClientApi.DoFrameAdvance(); } Joypad j = ClientApi.GetInput(1); j.ClearInputs(); ClientApi.SetInput(1, j); }
private void TreeNode_Click(object sender, TreeNodeMouseClickEventArgs e) { if (e.Button == MouseButtons.Left) { treeView.SelectedNode = e.Node; if (treeView.SelectedNode.Tag is FileInfo) { try { ClientApi.LoadState(Path.Combine(PathManager.GetSaveStatePath(Global.Game), e.Node.FullPath)); treeView.SelectedNode = treeView.SelectedNode.Parent; } catch (TargetInvocationException) { } } nodeStatusLabel.Text = string.Format("Current folder: {0}", treeView.SelectedNode.Text); } else if (e.Button == MouseButtons.Right) { treeView.SelectedNode = e.Node; e.Node.ContextMenuStrip = menu; } }
void AddButtons(SnesButtons buttons) { Joypad controller = ClientApi.GetInput(1); controller.ClearInputs(); ClientApi.SetInput(1, controller); // D Pad if (buttons.HasFlag(SnesButtons.Left)) { controller.AddInput(JoypadButton.Left); } if (buttons.HasFlag(SnesButtons.Right)) { controller.AddInput(JoypadButton.Right); } if (buttons.HasFlag(SnesButtons.Down)) { controller.AddInput(JoypadButton.Down); } if (buttons.HasFlag(SnesButtons.Up)) { controller.AddInput(JoypadButton.Up); } // Toward/Away if (buttons.HasFlag(SnesButtons.Toward)) { controller.AddInput(this.radioButtonLeft.Checked ? JoypadButton.Left : JoypadButton.Right); } if (buttons.HasFlag(SnesButtons.Away)) { controller.AddInput(this.radioButtonLeft.Checked ? JoypadButton.Right : JoypadButton.Left); } // Face Buttons if (buttons.HasFlag(SnesButtons.A)) { controller.AddInput(JoypadButton.A); } if (buttons.HasFlag(SnesButtons.B)) { controller.AddInput(JoypadButton.B); } if (buttons.HasFlag(SnesButtons.X)) { controller.AddInput(JoypadButton.X); } if (buttons.HasFlag(SnesButtons.Y)) { controller.AddInput(JoypadButton.Y); } // S/s if (buttons.HasFlag(SnesButtons.Select)) { controller.AddInput(JoypadButton.Select); } if (buttons.HasFlag(SnesButtons.Start)) { controller.AddInput(JoypadButton.Start); } // Shoulder buttons if (buttons.HasFlag(SnesButtons.L)) { controller.AddInput(JoypadButton.L); } if (buttons.HasFlag(SnesButtons.R)) { controller.AddInput(JoypadButton.R); } if (this.checkBoxStrafe.Checked) { controller.AddInput(JoypadButton.R); } ClientApi.SetInput(1, controller); }
public static bool GetSoundOn() => ClientApi.GetSoundOn();
public static void SetSoundOn(bool enable) => ClientApi.SetSoundOn(enable);
private void button1_Click(object sender, EventArgs e) { ClientApi.DoFrameAdvance(); }
public void CustomMainForm_FormClosed(object sender, FormClosedEventArgs e) { Gui.DrawNew("emu"); Gui.DrawFinish(); ClientApi.SetGameExtraPadding(0); }
private void buttonLoadState_Click(object sender, EventArgs e) { ClientApi.LoadState(SaveStateName); }
private void button2_Click(object sender, EventArgs e) { ClientApi.GetInput(1); }