Lua - implement client.screenshot()
This commit is contained in:
parent
06d131b777
commit
4193ddfa5d
|
@ -511,6 +511,7 @@ namespace BizHawk.MultiClient
|
|||
"opencheats",
|
||||
"screenwidth",
|
||||
"screenheight",
|
||||
"screenshot",
|
||||
};
|
||||
|
||||
public static string[] FormsFunctions = new string[]
|
||||
|
@ -2041,6 +2042,18 @@ namespace BizHawk.MultiClient
|
|||
//----------------------------------------------------
|
||||
//Client library
|
||||
//----------------------------------------------------
|
||||
public void client_screenshot(object path = null)
|
||||
{
|
||||
if (path == null)
|
||||
{
|
||||
Global.MainForm.TakeScreenshot();
|
||||
}
|
||||
else
|
||||
{
|
||||
Global.MainForm.TakeScreenshot(path.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public int client_screenwidth()
|
||||
{
|
||||
return Global.RenderPanel.NativeSize.Width;
|
||||
|
|
|
@ -1174,7 +1174,6 @@ namespace BizHawk.MultiClient
|
|||
break;
|
||||
case "NES":
|
||||
NESToolStripMenuItem.Visible = true;
|
||||
NESFDSMenuControls();
|
||||
break;
|
||||
case "PCE":
|
||||
case "PCECD":
|
||||
|
@ -1213,44 +1212,6 @@ namespace BizHawk.MultiClient
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void NESFDSMenuAdd(string name, string button, string msg)
|
||||
{
|
||||
fDSToolStripMenuItem.Visible = true;
|
||||
fDSToolStripMenuItem.DropDownItems.Add(name, null, delegate(object sender, EventArgs e)
|
||||
{
|
||||
if (Global.Emulator.ControllerDefinition.BoolButtons.Contains(button))
|
||||
{
|
||||
if (!Global.MovieSession.Movie.IsPlaying || Global.MovieSession.Movie.IsFinished)
|
||||
{
|
||||
Global.ClickyVirtualPadController.Click(button);
|
||||
Global.OSD.AddMessage(msg);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void NESFDSMenuControls()
|
||||
{
|
||||
|
||||
// ugly and hacky
|
||||
fDSToolStripMenuItem.Visible = false;
|
||||
fDSToolStripMenuItem.DropDownItems.Clear();
|
||||
var ss = Global.Emulator.ControllerDefinition.BoolButtons;
|
||||
|
||||
if (ss.Contains("FDS Eject"))
|
||||
NESFDSMenuAdd("Eject Disk", "FDS Eject", "FDS Disk Ejected.");
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
string s = "FDS Insert " + i;
|
||||
if (ss.Contains(s))
|
||||
NESFDSMenuAdd("Insert Disk " + i, s, "FDS Disk " + i + " inserted.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SyncControls()
|
||||
{
|
||||
if (Global.Game == null) return;
|
||||
|
@ -1306,9 +1267,7 @@ namespace BizHawk.MultiClient
|
|||
Global.ActiveController = Global.NullControls;
|
||||
break;
|
||||
}
|
||||
// allow propogating controls that are in the current controller definition but not in the prebaked one
|
||||
Global.ActiveController.ForceType(new ControllerDefinition(Global.Emulator.ControllerDefinition));
|
||||
Global.ClickyVirtualPadController.Type = new ControllerDefinition(Global.Emulator.ControllerDefinition);
|
||||
|
||||
RewireInputChain();
|
||||
}
|
||||
|
||||
|
@ -1617,7 +1576,6 @@ namespace BizHawk.MultiClient
|
|||
string ntsc_biospath = PathManager.MakeAbsolutePath(Global.Config.PathAtari7800NTSCBIOS, "A78");
|
||||
string pal_biospath = PathManager.MakeAbsolutePath(Global.Config.PathAtari7800PALBIOS, "A78");
|
||||
string hsbiospath = PathManager.MakeAbsolutePath(Global.Config.PathAtari7800HighScoreBIOS, "A78");
|
||||
//7800TODO: pass in PAL BIOS path as well now and let the core decide which to use
|
||||
byte[] NTSC_BIOS7800 = File.ReadAllBytes(ntsc_biospath);
|
||||
byte[] PAL_BIOS7800 = File.ReadAllBytes(pal_biospath);
|
||||
byte[] HighScoreBIOS = File.ReadAllBytes(hsbiospath);
|
||||
|
@ -2520,7 +2478,7 @@ namespace BizHawk.MultiClient
|
|||
Global.OSD.AddMessage("Screenshot saved to clipboard.");
|
||||
}
|
||||
|
||||
private void TakeScreenshot()
|
||||
public void TakeScreenshot()
|
||||
{
|
||||
string path = String.Format(PathManager.ScreenshotPrefix(Global.Game) + ".{0:yyyy-MM-dd HH.mm.ss}.png", DateTime.Now);
|
||||
TakeScreenshot(path);
|
||||
|
@ -2533,7 +2491,7 @@ namespace BizHawk.MultiClient
|
|||
//Was using this code to test the animated gif functions
|
||||
}
|
||||
|
||||
private void TakeScreenshot(string path)
|
||||
public void TakeScreenshot(string path)
|
||||
{
|
||||
var fi = new FileInfo(path);
|
||||
if (fi.Directory.Exists == false)
|
||||
|
|
Loading…
Reference in New Issue