make Bk2LogEntryGenerator.GenerateLogKey static
there is no reason for it to be an instance method
This commit is contained in:
parent
f679d8622f
commit
2765da78ef
|
@ -51,11 +51,11 @@ namespace BizHawk.Client.Common
|
||||||
/// documentation of the meaning of the mnemonics and not to be used to
|
/// documentation of the meaning of the mnemonics and not to be used to
|
||||||
/// enforce the mnemonic values
|
/// enforce the mnemonic values
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string GenerateLogKey()
|
public static string GenerateLogKey(ControllerDefinition definition)
|
||||||
{
|
{
|
||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
|
|
||||||
foreach (var group in _source.Definition.ControlsOrdered.Where(static c => c.Count is not 0))
|
foreach (var group in definition.ControlsOrdered.Where(static c => c.Count is not 0))
|
||||||
{
|
{
|
||||||
sb.Append('#');
|
sb.Append('#');
|
||||||
foreach (var button in group)
|
foreach (var button in group)
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
writer.WriteLine("[Input]");
|
writer.WriteLine("[Input]");
|
||||||
writer.Write("LogKey:");
|
writer.Write("LogKey:");
|
||||||
writer.WriteLine(string.IsNullOrEmpty(LogKey) ? LogGeneratorInstance(Session.MovieController).GenerateLogKey() : LogKey);
|
writer.WriteLine(string.IsNullOrEmpty(LogKey) ? Bk2LogEntryGenerator.GenerateLogKey(Session.MovieController.Definition) : LogKey);
|
||||||
|
|
||||||
foreach (var record in Log)
|
foreach (var record in Log)
|
||||||
{
|
{
|
||||||
|
|
|
@ -90,7 +90,7 @@ namespace BizHawk.Client.Common.movie.import
|
||||||
_controller = new SimpleController(controllerDefinition);
|
_controller = new SimpleController(controllerDefinition);
|
||||||
_playerCount = controllerDefinition.PlayerCount;
|
_playerCount = controllerDefinition.PlayerCount;
|
||||||
|
|
||||||
Result.Movie.LogKey = new Bk2LogEntryGenerator(VSystemID.Raw.SNES, new Bk2Controller(controllerDefinition)).GenerateLogKey();
|
Result.Movie.LogKey = Bk2LogEntryGenerator.GenerateLogKey(controllerDefinition);
|
||||||
|
|
||||||
foreach (var item in zip.Entries)
|
foreach (var item in zip.Entries)
|
||||||
{
|
{
|
||||||
|
|
|
@ -193,7 +193,7 @@ namespace BizHawk.Client.Common.movie.import
|
||||||
ControllerDefinition definition = new Snes9xControllers(ss).ControllerDefinition;
|
ControllerDefinition definition = new Snes9xControllers(ss).ControllerDefinition;
|
||||||
SimpleController controllers = new(definition);
|
SimpleController controllers = new(definition);
|
||||||
|
|
||||||
Result.Movie.LogKey = new Bk2LogEntryGenerator(VSystemID.Raw.SNES, new Bk2Controller(definition)).GenerateLogKey();
|
Result.Movie.LogKey = Bk2LogEntryGenerator.GenerateLogKey(definition);
|
||||||
|
|
||||||
r.BaseStream.Position = firstFrameOffset;
|
r.BaseStream.Position = firstFrameOffset;
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
using BizHawk.Client.Common;
|
||||||
|
|
||||||
namespace BizHawk.Client.EmuHawk
|
namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
public partial class MacroInputTool
|
public partial class MacroInputTool
|
||||||
|
@ -47,8 +49,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
s.Refresh();
|
s.Refresh();
|
||||||
|
|
||||||
// Update the selected zone's key
|
// Update the selected zone's key
|
||||||
var lg = MovieSession.Movie.LogGeneratorInstance(MovieSession.MovieController);
|
string key = Bk2LogEntryGenerator.GenerateLogKey(MovieSession.MovieController.Definition);
|
||||||
string key = lg.GenerateLogKey();
|
|
||||||
key = key.Replace("#", "");
|
key = key.Replace("#", "");
|
||||||
|
|
||||||
foreach (var box in _buttonBoxes)
|
foreach (var box in _buttonBoxes)
|
||||||
|
|
|
@ -20,11 +20,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
public MovieZone(IEmulator emulator, ToolManager tools, IMovieSession movieSession, int start, int length, string key = "")
|
public MovieZone(IEmulator emulator, ToolManager tools, IMovieSession movieSession, int start, int length, string key = "")
|
||||||
: this(emulator, tools, movieSession)
|
: this(emulator, tools, movieSession)
|
||||||
{
|
{
|
||||||
var lg = movieSession.Movie.LogGeneratorInstance(movieSession.MovieController);
|
|
||||||
|
|
||||||
if (key == "")
|
if (key == "")
|
||||||
{
|
{
|
||||||
key = lg.GenerateLogKey();
|
key = Bk2LogEntryGenerator.GenerateLogKey(movieSession.MovieController.Definition);
|
||||||
}
|
}
|
||||||
|
|
||||||
key = key.Replace("#", "");
|
key = key.Replace("#", "");
|
||||||
|
@ -38,9 +36,8 @@ namespace BizHawk.Client.EmuHawk
|
||||||
InitController(_inputKey);
|
InitController(_inputKey);
|
||||||
|
|
||||||
var logGenerator = movieSession.Movie.LogGeneratorInstance(_controller);
|
var logGenerator = movieSession.Movie.LogGeneratorInstance(_controller);
|
||||||
logGenerator.GenerateLogEntry(); // Reference and create all buttons.
|
|
||||||
|
|
||||||
string movieKey = logGenerator.GenerateLogKey().Replace("#", "");
|
string movieKey = Bk2LogEntryGenerator.GenerateLogKey(_controller.Definition).Replace("#", "");
|
||||||
movieKey = movieKey.Substring(startIndex: 0, length: movieKey.Length - 1); // drop last char
|
movieKey = movieKey.Substring(startIndex: 0, length: movieKey.Length - 1); // drop last char
|
||||||
if (key == movieKey)
|
if (key == movieKey)
|
||||||
{
|
{
|
||||||
|
@ -236,8 +233,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
// If the LogKey contains buttons/controls not accepted by the emulator,
|
// If the LogKey contains buttons/controls not accepted by the emulator,
|
||||||
// tell the user and display the macro's controller name and player count
|
// tell the user and display the macro's controller name and player count
|
||||||
_inputKey = readText[0];
|
_inputKey = readText[0];
|
||||||
var lg = _movieSession.Movie.LogGeneratorInstance(_movieSession.MovieController);
|
string key = Bk2LogEntryGenerator.GenerateLogKey(_movieSession.MovieController.Definition);
|
||||||
string key = lg.GenerateLogKey();
|
|
||||||
key = key.Replace("#", "");
|
key = key.Replace("#", "");
|
||||||
key = key.Substring(startIndex: 0, length: key.Length - 1); // drop last char
|
key = key.Substring(startIndex: 0, length: key.Length - 1); // drop last char
|
||||||
string[] emuKeys = key.Split('|');
|
string[] emuKeys = key.Split('|');
|
||||||
|
|
Loading…
Reference in New Issue