private MovieZone(IEmulator emulator, ToolManager tools, IMovieSession movieSession) { _emulator = emulator; _tools = tools; _movieSession = movieSession; _targetController = movieSession.GenerateMovieController(); _targetController.SetFrom(_targetController); // Reference and create all buttons }
public MovieZone(IEmulator emulator, ToolManager tools, IMovieSession movieSession, int start, int length, string key = "") : this(emulator, tools, movieSession) { var lg = movieSession.Movie.LogGeneratorInstance(movieSession.MovieController); if (key == "") { key = lg.GenerateLogKey(); } key = key.Replace("LogKey:", "").Replace("#", ""); key = key.Substring(0, key.Length - 1); _inputKey = key; Length = length; _log = new string[length]; // Get a IController that only contains buttons in key. InitController(_inputKey); var logGenerator = movieSession.Movie.LogGeneratorInstance(_controller); logGenerator.GenerateLogEntry(); // Reference and create all buttons. string movieKey = logGenerator.GenerateLogKey().Replace("LogKey:", "").Replace("#", ""); movieKey = movieKey.Substring(0, movieKey.Length - 1); if (key == movieKey) { for (int i = 0; i < length; i++) { _log[i] = movieSession.Movie.GetInputLogEntry(i + start); } } else { for (int i = 0; i < length; i++) { _controller.SetFrom(movieSession.Movie.GetInputState(i + start)); _log[i] = logGenerator.GenerateLogEntry(); } } }
public MovieZone(IMovie movie, IEmulator emulator, ToolManager tools, IMovieSession movieSession, int start, int length, string key = "") { _emulator = emulator; _tools = tools; _movieSession = movieSession; var lg = movie.LogGeneratorInstance(movieSession.MovieController); _targetController = movieSession.GenerateMovieController(); _targetController.SetFrom(_targetController); // Reference and create all buttons if (key == "") { key = lg.GenerateLogKey(); } key = key.Replace("LogKey:", "").Replace("#", ""); key = key.Substring(0, key.Length - 1); _inputKey = key; Length = length; _log = new string[length]; // Get a IController that only contains buttons in key. string[] keys = key.Split('|'); var d = new ControllerDefinition(); foreach (var k in keys) { if (_emulator.ControllerDefinition.BoolButtons.Contains(k)) { d.BoolButtons.Add(k); } else { d.Axes.Add(k, _emulator.ControllerDefinition.Axes[k]); } } _controller = movieSession.GenerateMovieController(d); var logGenerator = movieSession.Movie.LogGeneratorInstance(_controller); logGenerator.GenerateLogEntry(); // Reference and create all buttons. string movieKey = logGenerator.GenerateLogKey().Replace("LogKey:", "").Replace("#", ""); movieKey = movieKey.Substring(0, movieKey.Length - 1); if (key == movieKey) { for (int i = 0; i < length; i++) { _log[i] = movie.GetInputLogEntry(i + start); } } else { for (int i = 0; i < length; i++) { _controller.SetFrom(movie.GetInputState(i + start)); _log[i] = logGenerator.GenerateLogEntry(); } } }