-
Notifications
You must be signed in to change notification settings - Fork 394
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
from r7871
- Loading branch information
Showing
21 changed files
with
1,153 additions
and
843 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Tastudio.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
using System; | ||
using System.ComponentModel; | ||
|
||
using BizHawk.Client.Common; | ||
using LuaInterface; | ||
|
||
namespace BizHawk.Client.EmuHawk | ||
{ | ||
[Description("A library for manipulating the Tastudio dialog of the EmuHawk client")] | ||
[LuaLibraryAttributes(released: false)] | ||
public sealed class TastudioLuaLibrary : LuaLibraryBase | ||
{ | ||
public TastudioLuaLibrary(Lua lua) | ||
: base(lua) { } | ||
|
||
public TastudioLuaLibrary(Lua lua, Action<string> logOutputCallback) | ||
: base(lua, logOutputCallback) { } | ||
|
||
public override string Name { get { return "tastudio"; } } | ||
|
||
private TAStudio Tastudio | ||
{ | ||
get | ||
{ | ||
return GlobalWin.Tools.Get<TAStudio>() as TAStudio; | ||
} | ||
} | ||
|
||
|
||
[LuaMethodAttributes( | ||
"engaged", | ||
"returns whether or not tastudio is currently engaged (active)" | ||
)] | ||
public bool Engaged() | ||
{ | ||
return GlobalWin.Tools.Has<TAStudio>(); // TODO: eventually tastudio should have an engaged flag | ||
} | ||
|
||
[LuaMethodAttributes( | ||
"getmarker", | ||
"returns the marker text at the given frame, or an empty string if there is no marker for the given frame" | ||
)] | ||
public string GetMarker(int frame) | ||
{ | ||
if (Engaged()) | ||
{ | ||
var marker = Tastudio.CurrentMovie.Markers.Get(frame); | ||
if (marker != null) | ||
{ | ||
return marker.Message; | ||
} | ||
} | ||
|
||
return string.Empty; | ||
} | ||
|
||
[LuaMethodAttributes( | ||
"removemarker", | ||
"if there is a marker for the given frame, it will be removed" | ||
)] | ||
public void RemoveMarker(int frame) | ||
{ | ||
if (Engaged()) | ||
{ | ||
var marker = Tastudio.CurrentMovie.Markers.Get(frame); | ||
if (marker != null) | ||
{ | ||
Tastudio.CurrentMovie.Markers.Remove(marker); | ||
Tastudio.UpdateValues(); | ||
} | ||
} | ||
} | ||
|
||
[LuaMethodAttributes( | ||
"setmarker", | ||
"Adds or sets a marker at the given frame with the given message" | ||
)] | ||
public void SetMarker(int frame, string message) | ||
{ | ||
if (Engaged()) | ||
{ | ||
var marker = Tastudio.CurrentMovie.Markers.Get(frame); | ||
if (marker != null) | ||
{ | ||
marker.Message = message; | ||
} | ||
else | ||
{ | ||
Tastudio.CurrentMovie.Markers.Add(frame, message); | ||
Tastudio.UpdateValues(); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.