/*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);
            }
        }
示例#2
0
        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();
            }
        }
 //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);
        }