public Yabause(CoreComm CoreComm, DiscSystem.Disc CD, object syncSettings) { ServiceProvider = new BasicServiceProvider(this); byte[] bios = CoreComm.CoreFileProvider.GetFirmware("SAT", "J", true, "Saturn BIOS is required."); CoreComm.RomStatusDetails = string.Format("Disk partial hash:{0}", new DiscSystem.DiscHasher(CD).OldHash()); this.CoreComm = CoreComm; this.CD = CD; DiscSectorReader = new DiscSystem.DiscSectorReader(CD); SyncSettings = (SaturnSyncSettings)syncSettings ?? new SaturnSyncSettings(); if (this.SyncSettings.UseGL && glContext == null) { glContext = CoreComm.RequestGLContext(2, 0, false); } ResetCounters(); ActivateGL(); Init(bios); InputCallbackH = new LibYabause.InputCallback(() => InputCallbacks.Call()); LibYabause.libyabause_setinputcallback(InputCallbackH); ConnectTracer(); DriveLightEnabled = true; DeactivateGL(); }
internal byte ReadControls2(bool peek) { InputCallbacks.Call(); byte value = 0xFF; if (Controller.IsPressed("P2 Up")) { value &= 0xEF; } if (Controller.IsPressed("P2 Down")) { value &= 0xDF; } if (Controller.IsPressed("P2 Left")) { value &= 0xBF; } if (Controller.IsPressed("P2 Right")) { value &= 0x7F; } if (Controller.IsPressed("P2 Button")) { value &= 0xF7; } if (!peek) { _islag = false; } return(value); }
public void GetControllerState(IController controller) { InputCallbacks.Call(); L_controller = _controllerDeck.ReadPort1(controller); C_controller = _controllerDeck.ReadPort2(controller); R_controller = _controllerDeck.ReadPort3(controller); }
private byte ReadInput() { InputCallbacks.Call(); byte value = 0x3F; int player = _selectedController + 1; if (player < 6) { _lagged = false; value &= _controllerDeck.Read(player, _controller, Sel); } if (Region == "Japan") { value |= 0x40; } if (Type != NecSystemType.TurboCD && BramEnabled == false) { value |= 0x80; } return(value); }
internal byte ReadControls1(bool peek) { InputCallbacks.Call(); byte value = 0xFF; if (Controller["P1 Up"]) { value &= 0xEF; } if (Controller["P1 Down"]) { value &= 0xDF; } if (Controller["P1 Left"]) { value &= 0xBF; } if (Controller["P1 Right"]) { value &= 0x7F; } if (Controller["P1 Button"]) { value &= 0xF7; } if (!peek) { _islag = false; } return(value); }
private void GetControllerState(IController controller) { InputCallbacks.Call(); ushort port1 = _controllerDeck.ReadPort1(controller); ushort port2 = _controllerDeck.ReadPort2(controller); }
public void GetControllerState(IController controller) { InputCallbacks.Call(); controller_state = _controllerDeck.ReadPort1(controller); Acc_X_state = _controllerDeck.ReadAccX1(controller); Acc_Y_state = _controllerDeck.ReadAccY1(controller); }
public void GetControllerState(IController controller) { InputCallbacks.Call(); p1_state = _controllerDeck.ReadPort1(controller); p2_state = _controllerDeck.ReadPort2(controller); p1_fire = _controllerDeck.ReadFire1(controller); p2_fire = _controllerDeck.ReadFire2(controller); }
public bool FrameAdvance(IController controller, bool render, bool renderSound) { //Console.WriteLine("-----------------------FRAME-----------------------"); if (_tracer.Enabled) { _nesCore.cpu.TraceCallback = s => _tracer.Put(s); } else { _nesCore.cpu.TraceCallback = null; } if (controller.IsPressed("Power")) { HardReset(); } reset_frame = false; if (controller.IsPressed("Reset")) { reset_frame = true; } reset_cycle = controller.AxisValue("Reset Cycle"); reset_cycle_int = (int)Math.Floor(reset_cycle); _isLag = true; _nesCore.alt_lag = true; InputCallbacks.Call(); DoFrame(controller); bool ret = pass_a_frame; if (pass_a_frame) { _nesCore.videoProvider.FillFrameBuffer(); current_cycle = 0; _nesCore.cpu.ext_ppu_cycle = current_cycle; } _isLag = _nesCore.alt_lag; if (_isLag) { _lagCount++; VblankCount++; } reset_frame = false; _frame++; return(ret); }
byte read_joyport(int addr) { InputCallbacks.Call(); lagged = false; byte ret = addr == 0x4016 ? ControllerDeck.ReadA(Controller) : ControllerDeck.ReadB(Controller); ret &= 0x1f; ret |= (byte)(0xe0 & DB); return(ret); }
public void GetControllerState(IController controller) { InputCallbacks.Call(); L.cntr_rd_0 = (byte)(controller.IsPressed("P1 Start") ? 0x7F : 0xFF); L.cntr_rd_1 = _controllerDeck.ReadPort1(controller); L.cntr_rd_2 = 0xFF; R.cntr_rd_0 = (byte)(controller.IsPressed("P2 Start") ? 0x7F : 0xFF); R.cntr_rd_1 = _controllerDeck.ReadPort2(controller); R.cntr_rd_2 = 0xFF; }
public bool FrameAdvance(IController controller, bool render, bool rendersound) { //Console.WriteLine("-----------------------FRAME-----------------------"); if (_tracer.Enabled) { subnes.cpu.TraceCallback = s => _tracer.Put(s); } else { subnes.cpu.TraceCallback = null; } _frame++; if (controller.IsPressed("Power")) { HardReset(); } reset_frame = false; if (controller.IsPressed("Reset")) { reset_frame = true; } reset_cycle = controller.GetFloat("Reset Cycle"); reset_cycle_int = (int)Math.Floor(reset_cycle); _islag = true; subnes.alt_lag = true; InputCallbacks.Call(); do_frame(controller); bool ret = pass_a_frame; if (pass_a_frame) { subnes.videoProvider.FillFrameBuffer(); current_cycle = 0; subnes.cpu.ext_ppu_cycle = current_cycle; } _islag = subnes.alt_lag; if (_islag) { _lagcount++; VBL_CNT++; } reset_frame = false; return(ret); }
internal byte ReadControls2(bool peek) { InputCallbacks.Call(); byte value = _controllerDeck.ReadPort2(_controller); if (!peek) { _islag = false; } return(value); }
private void GetControllerState(IController controller) { InputCallbacks.Call(); ushort port1 = _controllerDeck.ReadPort1(controller); _psg.Register[15] = (ushort)(0xFF - port1); ushort port2 = _controllerDeck.ReadPort2(controller); _psg.Register[14] = (ushort)(0xFF - port2); }
void ReadController(ref byte data) { InputCallbacks.Call(); data &= 0xC0; if ((data & 0x40) != 0) // TH high { if (Controller.IsPressed("P1 Up") == false) { data |= 0x01; } if (Controller.IsPressed("P1 Down") == false) { data |= 0x02; } if (Controller.IsPressed("P1 Left") == false) { data |= 0x04; } if (Controller.IsPressed("P1 Right") == false) { data |= 0x08; } if (Controller.IsPressed("P1 B") == false) { data |= 0x10; } if (Controller.IsPressed("P1 C") == false) { data |= 0x20; } } else { // TH low if (Controller.IsPressed("P1 Up") == false) { data |= 0x01; } if (Controller.IsPressed("P1 Down") == false) { data |= 0x02; } if (Controller.IsPressed("P1 A") == false) { data |= 0x10; } if (Controller.IsPressed("P1 Start") == false) { data |= 0x20; } } }
byte ReadControls2() { InputCallbacks.Call(); lagged = false; byte value = 0xFF; if (Controller["P2 Left"]) { value &= 0xFE; } if (Controller["P2 Right"]) { value &= 0xFD; } if (Controller["P2 B1"]) { value &= 0xFB; } if (Controller["P2 B2"]) { value &= 0xF7; } if (Controller["Reset"]) { value &= 0xEF; } if ((Port3F & 0x0F) == 5) { if (region == "Japan") { value &= 0x3F; } else // US / Europe { if (Port3F >> 4 == 0x0F) { value |= 0xC0; } else { value &= 0x3F; } } } return(value); }
private byte ReadControls2() { InputCallbacks.Call(); _lagged = false; byte value = 0xFF; if (_controller.IsPressed("P2 Left")) { value &= 0xFE; } if (_controller.IsPressed("P2 Right")) { value &= 0xFD; } if (_controller.IsPressed("P2 B1")) { value &= 0xFB; } if (_controller.IsPressed("P2 B2")) { value &= 0xF7; } if (_controller.IsPressed("Reset")) { value &= 0xEF; } if ((Port3F & 0x0F) == 5) { if (_region == "Japan") { value &= 0x3F; } else // US / Europe { if (Port3F >> 4 == 0x0F) { value |= 0xC0; } else { value &= 0x3F; } } } return(value); }
public void GetControllerState(IController controller) { InputCallbacks.Call(); p1_state = _controllerDeck.ReadPort1(controller); p2_state = _controllerDeck.ReadPort2(controller); p1_fire = _controllerDeck.ReadFire1(controller); p2_fire = _controllerDeck.ReadFire2(controller); p1_fire_2x = _controllerDeck.ReadFire1_2x(controller); p2_fire_2x = _controllerDeck.ReadFire2_2x(controller); p1_is_2button = _controllerDeck.Is_2_button1(controller); p2_is_2button = _controllerDeck.Is_2_button2(controller); p1_is_lightgun = _controllerDeck.Is_LightGun1(controller, out p1_lightgun_x, out p1_lightgun_y); p2_is_lightgun = _controllerDeck.Is_LightGun2(controller, out p2_lightgun_x, out p2_lightgun_y); }
LibMeteor.Buttons GetInput() { InputCallbacks.Call(); // libmeteor bitflips everything itself, so 0 == off, 1 == on IsLagFrame = false; LibMeteor.Buttons ret = 0; if (Controller.IsPressed("Up")) { ret |= LibMeteor.Buttons.BTN_UP; } if (Controller.IsPressed("Down")) { ret |= LibMeteor.Buttons.BTN_DOWN; } if (Controller.IsPressed("Left")) { ret |= LibMeteor.Buttons.BTN_LEFT; } if (Controller.IsPressed("Right")) { ret |= LibMeteor.Buttons.BTN_RIGHT; } if (Controller.IsPressed("Select")) { ret |= LibMeteor.Buttons.BTN_SELECT; } if (Controller.IsPressed("Start")) { ret |= LibMeteor.Buttons.BTN_START; } if (Controller.IsPressed("B")) { ret |= LibMeteor.Buttons.BTN_B; } if (Controller.IsPressed("A")) { ret |= LibMeteor.Buttons.BTN_A; } if (Controller.IsPressed("L")) { ret |= LibMeteor.Buttons.BTN_L; } if (Controller.IsPressed("R")) { ret |= LibMeteor.Buttons.BTN_R; } return(ret); }
/// <summary> /// Cycles through all the input callbacks /// This should be done once per frame /// </summary> public bool PollInput() { bool noInput = true; InputCallbacks.Call(); lock (this) { for (int i = 0; i < ButtonsConsole.Length; i++) { var key = ButtonsConsole[i]; bool prevState = StateConsole[i]; // CTRLConsole.Bit(i); bool currState = _controller.IsPressed(key); if (currState != prevState) { StateConsole[i] = currState; noInput = false; } } for (int i = 0; i < ButtonsRight.Length; i++) { var key = "P1 " + ButtonsRight[i]; bool prevState = StateRight[i]; bool currState = _controller.IsPressed(key); if (currState != prevState) { StateRight[i] = currState; noInput = false; } } for (int i = 0; i < ButtonsLeft.Length; i++) { var key = "P2 " + ButtonsLeft[i]; bool prevState = StateLeft[i]; bool currState = _controller.IsPressed(key); if (currState != prevState) { StateLeft[i] = currState; noInput = false; } } } return(noInput); }
private void write_joyport(byte value) { //Console.WriteLine("cont " + value + " frame " + Frame); var si = new StrobeInfo(latched4016, value); ControllerDeck.Strobe(si, _controller); latched4016 = value; new_strobe = (value & 1) > 0; if (current_strobe && !new_strobe) { controller_was_latched = true; alt_lag = false; lagged = false; InputCallbacks.Call(); } current_strobe = new_strobe; }
byte ReadControls1() { InputCallbacks.Call(); lagged = false; byte value = 0xFF; if (Controller["P1 Up"]) { value &= 0xFE; } if (Controller["P1 Down"]) { value &= 0xFD; } if (Controller["P1 Left"]) { value &= 0xFB; } if (Controller["P1 Right"]) { value &= 0xF7; } if (Controller["P1 B1"]) { value &= 0xEF; } if (Controller["P1 B2"]) { value &= 0xDF; } if (Controller["P2 Up"]) { value &= 0xBF; } if (Controller["P2 Down"]) { value &= 0x7F; } return(value); }
private byte ReadControls1() { InputCallbacks.Call(); _lagged = false; byte value = 0xFF; if (_controller.IsPressed("P1 Up")) { value &= 0xFE; } if (_controller.IsPressed("P1 Down")) { value &= 0xFD; } if (_controller.IsPressed("P1 Left")) { value &= 0xFB; } if (_controller.IsPressed("P1 Right")) { value &= 0xF7; } if (_controller.IsPressed("P1 B1")) { value &= 0xEF; } if (_controller.IsPressed("P1 B2")) { value &= 0xDF; } if (_controller.IsPressed("P2 Up")) { value &= 0xBF; } if (_controller.IsPressed("P2 Down")) { value &= 0x7F; } return(value); }
byte read_joyport(int addr) { InputCallbacks.Call(); lagged = false; byte ret = 0; if (_isVS) { // for whatever reason, in VS left and right controller have swapped regs ret = addr == 0x4017 ? ControllerDeck.ReadA(Controller) : ControllerDeck.ReadB(Controller); } else { ret = addr == 0x4016 ? ControllerDeck.ReadA(Controller) : ControllerDeck.ReadB(Controller); } ret &= 0x1f; ret |= (byte)(0xe0 & DB); return(ret); }
private int ControllerTick = 0; // for timing in japan private byte ReadControls1() { InputCallbacks.Call(); _lagged = false; byte value = 0xFF; PresetControllerState(1); // Hard-wired together for paddles? _controllerDeck.SetPin_c2(_controller, _controllerDeck.GetPin_c1(_controller)); value &= _controllerDeck.ReadPort1_c1(_controller); value &= _controllerDeck.ReadPort1_c2(_controller); PostsetControllerState(1); if (!IsGameGear_C && SyncSettings.UseKeyboard) { // 7 represents ordinary controller reads if ((PortDE & 7) != 7) { value = 0xFF; for (int bit = 0; bit < 8; ++bit) { string key = KeyboardMap[(PortDE & 0x07) * 12 + bit]; if (key != null && _controller.IsPressed(key)) { value &= (byte)~(1 << bit); } } } } return(value); }
void SetInputCallback() { BizSwan.bizswan_setbuttoncallback(Core, InputCallbacks.Any() ? ButtonCallbackD : null); }
void ButtonCallback() { InputCallbacks.Call(); }
public void AddCallback(InputCallbacks callback) { Callbacks.Add(callback); }
public void RemoveCallback(InputCallbacks callback) { Callbacks.Add(callback); }
private LibGambatte.Buttons ControllerCallback() { InputCallbacks.Call(); IsLagFrame = false; return(CurrentButtons); }
public bool FrameAdvance(IController controller, bool render, bool renderSound) { //Console.WriteLine("-----------------------FRAME-----------------------"); //Update the color palette if a setting changed if (GetSettings().Palette == GBHawk.GBHawk.GBSettings.PaletteType.BW) { _GBCore.color_palette[0] = GBHawk.GBHawk.color_palette_BW[0]; _GBCore.color_palette[1] = GBHawk.GBHawk.color_palette_BW[1]; _GBCore.color_palette[2] = GBHawk.GBHawk.color_palette_BW[2]; _GBCore.color_palette[3] = GBHawk.GBHawk.color_palette_BW[3]; } else { _GBCore.color_palette[0] = GBHawk.GBHawk.color_palette_Gr[0]; _GBCore.color_palette[1] = GBHawk.GBHawk.color_palette_Gr[1]; _GBCore.color_palette[2] = GBHawk.GBHawk.color_palette_Gr[2]; _GBCore.color_palette[3] = GBHawk.GBHawk.color_palette_Gr[3]; } if (_tracer.Enabled) { _GBCore.cpu.TraceCallback = s => _tracer.Put(s); } else { _GBCore.cpu.TraceCallback = null; } _frame++; reset_frame = false; if (controller.IsPressed("P1 Power")) { reset_frame = true; } input_frame_length = controller.GetFloat("Input Cycle"); input_frame_length_int = (int)Math.Floor(input_frame_length); if (input_frame_length_int == 0) { input_frame_length_int = 70224; } pass_a_frame = false; InputCallbacks.Call(); DoFrame(controller); bool ret = pass_a_frame; if (pass_a_frame) { frame_cycle = 0; } current_cycle = 0; _isLag = pass_a_frame; if (_isLag) { _lagCount++; VBL_CNT++; } reset_frame = false; return(ret); }
public void GetControllerState(IController controller) { InputCallbacks.Call(); controller_state_1 = _controllerDeck.ReadPort1(controller); controller_state_2 = _controllerDeck.ReadPort2(controller); kb_state_row = 8; // nothing pressed if (controller.IsPressed("0")) { kb_state_row = 0; kb_state_col = 7; } if (controller.IsPressed("1")) { kb_state_row = 0; kb_state_col = 6; } if (controller.IsPressed("2")) { kb_state_row = 0; kb_state_col = 5; } if (controller.IsPressed("3")) { kb_state_row = 0; kb_state_col = 4; } if (controller.IsPressed("4")) { kb_state_row = 0; kb_state_col = 3; } if (controller.IsPressed("5")) { kb_state_row = 0; kb_state_col = 2; } if (controller.IsPressed("6")) { kb_state_row = 0; kb_state_col = 1; } if (controller.IsPressed("7")) { kb_state_row = 0; kb_state_col = 0; } if (controller.IsPressed("8")) { kb_state_row = 1; kb_state_col = 7; } if (controller.IsPressed("9")) { kb_state_row = 1; kb_state_col = 6; } if (controller.IsPressed("SPC")) { kb_state_row = 1; kb_state_col = 3; } if (controller.IsPressed("?")) { kb_state_row = 1; kb_state_col = 2; } if (controller.IsPressed("L")) { kb_state_row = 1; kb_state_col = 1; } if (controller.IsPressed("P")) { kb_state_row = 1; kb_state_col = 0; } if (controller.IsPressed("+")) { kb_state_row = 2; kb_state_col = 7; } if (controller.IsPressed("W")) { kb_state_row = 2; kb_state_col = 6; } if (controller.IsPressed("E")) { kb_state_row = 2; kb_state_col = 5; } if (controller.IsPressed("R")) { kb_state_row = 2; kb_state_col = 4; } if (controller.IsPressed("T")) { kb_state_row = 2; kb_state_col = 3; } if (controller.IsPressed("U")) { kb_state_row = 2; kb_state_col = 2; } if (controller.IsPressed("I")) { kb_state_row = 2; kb_state_col = 1; } if (controller.IsPressed("O")) { kb_state_row = 2; kb_state_col = 0; } if (controller.IsPressed("Q")) { kb_state_row = 3; kb_state_col = 7; } if (controller.IsPressed("S")) { kb_state_row = 3; kb_state_col = 6; } if (controller.IsPressed("D")) { kb_state_row = 3; kb_state_col = 5; } if (controller.IsPressed("F")) { kb_state_row = 3; kb_state_col = 4; } if (controller.IsPressed("G")) { kb_state_row = 3; kb_state_col = 3; } if (controller.IsPressed("H")) { kb_state_row = 3; kb_state_col = 2; } if (controller.IsPressed("J")) { kb_state_row = 3; kb_state_col = 1; } if (controller.IsPressed("K")) { kb_state_row = 3; kb_state_col = 0; } if (controller.IsPressed("A")) { kb_state_row = 4; kb_state_col = 7; } if (controller.IsPressed("Z")) { kb_state_row = 4; kb_state_col = 6; } if (controller.IsPressed("X")) { kb_state_row = 4; kb_state_col = 5; } if (controller.IsPressed("C")) { kb_state_row = 4; kb_state_col = 4; } if (controller.IsPressed("V")) { kb_state_row = 4; kb_state_col = 3; } if (controller.IsPressed("B")) { kb_state_row = 4; kb_state_col = 2; } if (controller.IsPressed("M")) { kb_state_row = 4; kb_state_col = 1; } if (controller.IsPressed(".")) { kb_state_row = 4; kb_state_col = 0; } if (controller.IsPressed("-")) { kb_state_row = 5; kb_state_col = 7; } if (controller.IsPressed("*")) { kb_state_row = 5; kb_state_col = 6; } if (controller.IsPressed("/")) { kb_state_row = 5; kb_state_col = 5; } if (controller.IsPressed("=")) { kb_state_row = 5; kb_state_col = 4; } if (controller.IsPressed("YES")) { kb_state_row = 5; kb_state_col = 3; } if (controller.IsPressed("NO")) { kb_state_row = 5; kb_state_col = 2; } if (controller.IsPressed("CLR")) { kb_state_row = 5; kb_state_col = 1; } if (controller.IsPressed("ENT")) { kb_state_row = 5; kb_state_col = 0; } }