public override void Attach(IEmulator emulator) { if (!emulator.HasSavestates()) { throw new InvalidOperationException($"A core must be able to provide an {nameof(IStatable)} service"); } if (!emulator.CanPollInput()) { throw new InvalidOperationException($"A core must be able to provide an {nameof(IInputPollable)} service"); } _inputPollable = emulator.AsInputPollable(); if (StartsFromSavestate) { TasStateManager.Engage(BinarySavestate); } else { var ms = new MemoryStream(); emulator.AsStatable().SaveStateBinary(new BinaryWriter(ms)); TasStateManager.Engage(ms.ToArray()); } base.Attach(emulator); foreach (var button in emulator.ControllerDefinition.BoolButtons) { _mnemonicCache[button] = Bk2MnemonicLookup.Lookup(button, emulator.SystemId); } }
internal N64Input(IInputPollable emuCore, mupen64plusApi core, N64SyncSettings.N64ControllerSettings[] controllerSettings) { _emuCore = emuCore; _api = new mupen64plusInputApi(core); _api.SetM64PInputCallback(GetControllerInput); core.VInterrupt += ShiftInputPolledBools; for (int i = 0; i < controllerSettings.Length; ++i) { SetControllerConnected(i, controllerSettings[i].IsConnected); SetControllerPakType(i, controllerSettings[i].PakType); } }
public N64Input(IInputPollable emuCore, mupen64plusApi core, CoreComm comm, N64SyncSettings.N64ControllerSettings[] controllerSettings) { _emuCore = emuCore; api = new mupen64plusInputApi(core); CoreComm = comm; api.SetM64PInputCallback(new mupen64plusInputApi.InputCallback(GetControllerInput)); core.VInterrupt += ShiftInputPolledBools; for (int i = 0; i < controllerSettings.Length; ++i) { SetControllerConnected(i, controllerSettings[i].IsConnected); SetControllerPakType(i, controllerSettings[i].PakType); } }
public override void Attach(IEmulator emulator) { if (!emulator.HasSavestates()) { throw new InvalidOperationException($"A core must be able to provide an {nameof(IStatable)} service"); } if (!emulator.CanPollInput()) { throw new InvalidOperationException($"A core must be able to provide an {nameof(IInputPollable)} service"); } _inputPollable = emulator.AsInputPollable(); TasStateManager.Attach(emulator); base.Attach(emulator); }
public override void Attach(IEmulator emulator) { if (!emulator.HasSavestates()) { throw new InvalidOperationException($"A core must be able to provide an {nameof(IStatable)} service"); } if (!emulator.CanPollInput()) { throw new InvalidOperationException($"A core must be able to provide an {nameof(IInputPollable)} service"); } _inputPollable = emulator.AsInputPollable(); TasStateManager.Attach(emulator); base.Attach(emulator); foreach (var button in emulator.ControllerDefinition.BoolButtons) { _mnemonicCache[button] = Bk2MnemonicLookup.Lookup(button, emulator.SystemId); } }