MAME.Core/MAME.Core/mame/taitob/Input.cs
2024-07-29 15:53:22 +08:00

453 lines
14 KiB
C#

using MAME.Core.run_interface;
namespace mame
{
public partial class Taitob
{
public static void loop_inputports_taitob_common()
{
}
public static void loop_inputports_taitob_pbobble()
{
if (Keyboard.IsPressed(MotionKey.P1_INSERT_COIN))//if (Keyboard.IsPressed(Corekey.D5))
{
dswb &= unchecked((byte)~0x10);
}
else
{
dswb |= 0x10;
}
if (Keyboard.IsPressed(MotionKey.P2_INSERT_COIN))//if (Keyboard.IsPressed(Corekey.D6))
{
dswb &= unchecked((byte)~0x20);
}
else
{
dswb |= 0x20;
}
if (Keyboard.IsPressed(MotionKey.P1_GAMESTART))//if (Keyboard.IsPressed(Corekey.D1))
{
sbyte0 &= ~0x10;
}
else
{
sbyte0 |= 0x10;
}
if (Keyboard.IsPressed(MotionKey.P2_GAMESTART))//if (Keyboard.IsPressed(Corekey.D2))
{
sbyte0 &= ~0x20;
}
else
{
sbyte0 |= 0x20;
}
if (Keyboard.IsPressed(MotionKey.P1_RIGHT))//if (Keyboard.IsPressed(Corekey.D))
{
sbyte2 &= ~0x08;
}
else
{
sbyte2 |= 0x08;
}
if (Keyboard.IsPressed(MotionKey.P1_LEFT))//if (Keyboard.IsPressed(Corekey.A))
{
sbyte2 &= ~0x04;
}
else
{
sbyte2 |= 0x04;
}
if (Keyboard.IsPressed(MotionKey.P1_DOWN))//if (Keyboard.IsPressed(Corekey.S))
{
sbyte2 &= ~0x02;
}
else
{
sbyte2 |= 0x02;
}
if (Keyboard.IsPressed(MotionKey.P1_UP))//if (Keyboard.IsPressed(Corekey.W))
{
sbyte2 &= ~0x01;
}
else
{
sbyte2 |= 0x01;
}
if (Keyboard.IsPressed(MotionKey.P1_BTN_1))//if (Keyboard.IsPressed(Corekey.J))
{
sbyte1 &= ~0x01;
}
else
{
sbyte1 |= 0x01;
}
if (Keyboard.IsPressed(MotionKey.P1_BTN_2))//if (Keyboard.IsPressed(Corekey.K))
{
sbyte1 &= ~0x02;
}
else
{
sbyte1 |= 0x02;
}
if (Keyboard.IsPressed(MotionKey.P1_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.L))
{
sbyte1 &= ~0x04;
}
else
{
sbyte1 |= 0x04;
}
if (Keyboard.IsPressed(MotionKey.P2_RIGHT))//if (Keyboard.IsPressed(Corekey.Right))
{
sbyte2 &= unchecked((sbyte)~0x80);
}
else
{
sbyte2 |= unchecked((sbyte)0x80);
}
if (Keyboard.IsPressed(MotionKey.P2_LEFT))//if (Keyboard.IsPressed(Corekey.Left))
{
sbyte2 &= ~0x40;
}
else
{
sbyte2 |= 0x40;
}
if (Keyboard.IsPressed(MotionKey.P2_DOWN)) //if (Keyboard.IsPressed(Corekey.Down))
{
sbyte2 &= ~0x20;
}
else
{
sbyte2 |= 0x20;
}
if (Keyboard.IsPressed(MotionKey.P2_UP))//if (Keyboard.IsPressed(Corekey.Up))
{
sbyte2 &= ~0x10;
}
else
{
sbyte2 |= 0x10;
}
if (Keyboard.IsPressed(MotionKey.P2_BTN_1))//if (Keyboard.IsPressed(Corekey.NumPad1))
{
sbyte1 &= ~0x10;
}
else
{
sbyte1 |= 0x10;
}
if (Keyboard.IsPressed(MotionKey.P2_BTN_2))//if (Keyboard.IsPressed(Corekey.NumPad2))
{
sbyte1 &= ~0x20;
}
else
{
sbyte1 |= 0x20;
}
if (Keyboard.IsPressed(MotionKey.P2_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.NumPad3))
{
sbyte1 &= ~0x40;
}
else
{
sbyte1 |= 0x40;
}
if (Keyboard.IsPressed(MotionKey.UNKNOW_R)) //if (Keyboard.IsPressed(Corekey.R))
{
sbyte0 &= ~0x01;
}
else
{
sbyte0 |= 0x01;
}
if (Keyboard.IsPressed(MotionKey.UNKNOW_T)) //if (Keyboard.IsPressed(Corekey.T))
{
sbyte0 &= ~0x02;
}
else
{
sbyte0 |= 0x02;
}
}
public static void loop_inputports_taitob_silentd()
{
if (Keyboard.IsPressed(MotionKey.P1_INSERT_COIN))//if (Keyboard.IsPressed(Corekey.D5))
{
sbyte1 &= ~0x10;
}
else
{
sbyte1 |= 0x10;
}
if (Keyboard.IsPressed(MotionKey.P2_INSERT_COIN))//if (Keyboard.IsPressed(Corekey.D6))
{
sbyte1 &= ~0x20;
}
else
{
sbyte1 |= 0x20;
}
if (Keyboard.IsPressed(MotionKey.P1_GAMESTART))//if (Keyboard.IsPressed(Corekey.D1))
{
sbyte1 &= ~0x04;
}
else
{
sbyte1 |= 0x04;
}
if (Keyboard.IsPressed(MotionKey.P2_GAMESTART))//if (Keyboard.IsPressed(Corekey.D2))
{
sbyte1 &= ~0x08;
}
else
{
sbyte1 |= 0x08;
}
if (Keyboard.IsPressed(MotionKey.P1_RIGHT))//if (Keyboard.IsPressed(Corekey.D))
{
sbyte2 &= ~0x08;
}
else
{
sbyte2 |= 0x08;
}
if (Keyboard.IsPressed(MotionKey.P1_LEFT))//if (Keyboard.IsPressed(Corekey.A))
{
sbyte2 &= ~0x04;
}
else
{
sbyte2 |= 0x04;
}
if (Keyboard.IsPressed(MotionKey.P1_DOWN))//if (Keyboard.IsPressed(Corekey.S))
{
sbyte2 &= ~0x02;
}
else
{
sbyte2 |= 0x02;
}
if (Keyboard.IsPressed(MotionKey.P1_UP))//if (Keyboard.IsPressed(Corekey.W))
{
sbyte2 &= ~0x01;
}
else
{
sbyte2 |= 0x01;
}
if (Keyboard.IsPressed(MotionKey.P1_BTN_1))//if (Keyboard.IsPressed(Corekey.J))
{
sbyte0 &= ~0x01;
}
else
{
sbyte0 |= 0x01;
}
if (Keyboard.IsPressed(MotionKey.P1_BTN_2))//if (Keyboard.IsPressed(Corekey.K))
{
sbyte0 &= ~0x02;
}
else
{
sbyte0 |= 0x02;
}
if (Keyboard.IsPressed(MotionKey.P1_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.L))
{
sbyte0 &= ~0x04;
}
else
{
sbyte0 |= 0x04;
}
if (Keyboard.IsPressed(MotionKey.P2_RIGHT))//if (Keyboard.IsPressed(Corekey.Right))
{
sbyte2 &= unchecked((sbyte)~0x80);
}
else
{
sbyte2 |= unchecked((sbyte)0x80);
}
if (Keyboard.IsPressed(MotionKey.P2_LEFT))//if (Keyboard.IsPressed(Corekey.Left))
{
sbyte2 &= ~0x40;
}
else
{
sbyte2 |= 0x40;
}
if (Keyboard.IsPressed(MotionKey.P2_DOWN)) //if (Keyboard.IsPressed(Corekey.Down))
{
sbyte2 &= ~0x20;
}
else
{
sbyte2 |= 0x20;
}
if (Keyboard.IsPressed(MotionKey.P2_UP))//if (Keyboard.IsPressed(Corekey.Up))
{
sbyte2 &= ~0x10;
}
else
{
sbyte2 |= 0x10;
}
if (Keyboard.IsPressed(MotionKey.P2_BTN_1))//if (Keyboard.IsPressed(Corekey.NumPad1))
{
sbyte0 &= ~0x08;
}
else
{
sbyte0 |= 0x08;
}
if (Keyboard.IsPressed(MotionKey.P2_BTN_2))//if (Keyboard.IsPressed(Corekey.NumPad2))
{
sbyte0 &= ~0x10;
}
else
{
sbyte0 |= 0x10;
}
if (Keyboard.IsPressed(MotionKey.P2_UNKNOW_E))//if (Keyboard.IsPressed(Corekey.NumPad3))
{
sbyte0 &= ~0x20;
}
else
{
sbyte0 |= 0x20;
}
if (Keyboard.IsPressed(MotionKey.UNKNOW_R)) //if (Keyboard.IsPressed(Corekey.R))
{
sbyte1 &= ~0x01;
}
else
{
sbyte1 |= 0x01;
}
if (Keyboard.IsPressed(MotionKey.UNKNOW_T)) //if (Keyboard.IsPressed(Corekey.T))
{
sbyte1 &= ~0x02;
}
else
{
sbyte1 |= 0x02;
}
}
public static void record_port()
{
if (sbyte0 != sbyte0_old || sbyte1 != sbyte1_old || sbyte2 != sbyte2_old || sbyte3 != sbyte3_old || sbyte4 != sbyte4_old || sbyte5 != sbyte5_old)
{
sbyte0_old = sbyte0;
sbyte1_old = sbyte1;
sbyte2_old = sbyte2;
sbyte3_old = sbyte3;
sbyte4_old = sbyte4;
sbyte5_old = sbyte5;
Mame.bwRecord.Write(Video.screenstate.frame_number);
Mame.bwRecord.Write(sbyte0);
Mame.bwRecord.Write(sbyte1);
Mame.bwRecord.Write(sbyte2);
Mame.bwRecord.Write(sbyte3);
Mame.bwRecord.Write(sbyte4);
Mame.bwRecord.Write(sbyte5);
}
}
public static void replay_port()
{
if (Inptport.bReplayRead)
{
try
{
Video.frame_number_obj = Mame.brRecord.ReadInt64();
sbyte0_old = Mame.brRecord.ReadSByte();
sbyte1_old = Mame.brRecord.ReadSByte();
sbyte2_old = Mame.brRecord.ReadSByte();
sbyte3_old = Mame.brRecord.ReadSByte();
sbyte4_old = Mame.brRecord.ReadSByte();
sbyte5_old = Mame.brRecord.ReadSByte();
}
catch
{
Mame.playState = Mame.PlayState.PLAY_REPLAYEND;
//Mame.mame_pause(true);
}
Inptport.bReplayRead = false;
}
if (Video.screenstate.frame_number == Video.frame_number_obj)
{
sbyte0 = sbyte0_old;
sbyte1 = sbyte1_old;
sbyte2 = sbyte2_old;
sbyte3 = sbyte3_old;
sbyte4 = sbyte4_old;
sbyte5 = sbyte5_old;
Inptport.bReplayRead = true;
}
else
{
Inptport.bReplayRead = false;
}
}
public static void record_port_pbobble()
{
if (dswb != dswb_old || sbyte0 != sbyte0_old || sbyte1 != sbyte1_old || sbyte2 != sbyte2_old || sbyte3 != sbyte3_old || sbyte4 != sbyte4_old || sbyte5 != sbyte5_old)
{
dswb_old = dswb;
sbyte0_old = sbyte0;
sbyte1_old = sbyte1;
sbyte2_old = sbyte2;
sbyte3_old = sbyte3;
sbyte4_old = sbyte4;
sbyte5_old = sbyte5;
Mame.bwRecord.Write(Video.screenstate.frame_number);
Mame.bwRecord.Write(dswb);
Mame.bwRecord.Write(sbyte0);
Mame.bwRecord.Write(sbyte1);
Mame.bwRecord.Write(sbyte2);
Mame.bwRecord.Write(sbyte3);
Mame.bwRecord.Write(sbyte4);
Mame.bwRecord.Write(sbyte5);
}
}
public static void replay_port_pbobble()
{
if (Inptport.bReplayRead)
{
try
{
Video.frame_number_obj = Mame.brRecord.ReadInt64();
dswb_old = Mame.brRecord.ReadByte();
sbyte0_old = Mame.brRecord.ReadSByte();
sbyte1_old = Mame.brRecord.ReadSByte();
sbyte2_old = Mame.brRecord.ReadSByte();
sbyte3_old = Mame.brRecord.ReadSByte();
sbyte4_old = Mame.brRecord.ReadSByte();
sbyte5_old = Mame.brRecord.ReadSByte();
}
catch
{
Mame.playState = Mame.PlayState.PLAY_REPLAYEND;
//Mame.mame_pause(true);
}
Inptport.bReplayRead = false;
}
if (Video.screenstate.frame_number == Video.frame_number_obj)
{
dswb = dswb_old;
sbyte0 = sbyte0_old;
sbyte1 = sbyte1_old;
sbyte2 = sbyte2_old;
sbyte3 = sbyte3_old;
sbyte4 = sbyte4_old;
sbyte5 = sbyte5_old;
Inptport.bReplayRead = true;
}
else
{
Inptport.bReplayRead = false;
}
}
}
}