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 }
private void InitController(string 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[key]); } } _controller = _movieSession.GenerateMovieController(d); }
public void SetFromMnemonicStr(string inputLogEntry) { var controller = _movieSession.GenerateMovieController(_inputManager.ActiveController.Definition); try { controller.SetFromMnemonic(inputLogEntry); } catch (Exception) { LogCallback($"invalid mnemonic string: {inputLogEntry}"); return; } foreach (var button in controller.Definition.BoolButtons) { _inputManager.ButtonOverrideAdapter.SetButton(button, controller.IsPressed(button)); } foreach (var axis in controller.Definition.Axes.Keys) { _inputManager.ButtonOverrideAdapter.SetAxis(axis, controller.AxisValue(axis)); } }
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(); } } }