diff --git a/Config/Supermodel.ini b/Config/Supermodel.ini index 245e03b..ee016dc 100644 --- a/Config/Supermodel.ini +++ b/Config/Supermodel.ini @@ -87,25 +87,32 @@ InputSteering = "JOY1_XAXIS" ; analog, full steering range InputAccelerator = "KEY_UP,JOY1_UP" InputBrake = "KEY_DOWN,JOY1_DOWN" -; Manual transmission +; Up/down shifter manual transmission (all racers) +InputGearShiftUp = "KEY_Y" ; sequential shift up +InputGearShiftDown = "KEY_H" ; sequential shift down + +; 4-Speed manual transmission (Daytona 2, Sega Rally 2, Scud Race) InputGearShift1 = "KEY_Q,JOY1_BUTTON5" InputGearShift2 = "KEY_W,JOY1_BUTTON6" InputGearShift3 = "KEY_E,JOY1_BUTTON7" InputGearShift4 = "KEY_R,JOY1_BUTTON8" InputGearShiftN = "KEY_T" -InputGearShiftUp = "NONE" ; sequential shift up -InputGearShiftDown = "NONE" ; sequential shift down -; View buttons +; VR4 view change buttons (Daytona 2, Le Mans 24, Scud Race) InputVR1 = "KEY_A,JOY1_BUTTON1" InputVR2 = "KEY_S,JOY1_BUTTON2" InputVR3 = "KEY_D,JOY1_BUTTON3" InputVR4 = "KEY_F,JOY1_BUTTON4" -; Miscellaneous driving game buttons: Sega Rally 2, Dirt Devils, Emergency Car -; Ambulance +; Single view change button (Dirt Devils, ECA, Harley-Davidson, Sega Rally 2) InputViewChange = "KEY_A,JOY1_BUTTON1" -InputHandBrake = "KEY_S,JOY1_BUTTON2" ; Sega Rally 2 only + +; Handbrake (Dirt Devils, Sega Rally 2) +InputHandBrake = "KEY_S,JOY1_BUTTON2" + +; Harley-Davidson controls +InputRearBrake = "KEY_S,JOY1_BUTTON2" +InputMusicSelect = "KEY_D,JOY1_BUTTON3" ; Virtual On macros InputTwinJoyTurnLeft = "KEY_Q,JOY1_RXAXIS_NEG" @@ -133,7 +140,7 @@ InputTwinJoyShot2 = "KEY_S,JOY1_BUTTON6" InputTwinJoyTurbo1 = "KEY_Z,JOY1_BUTTON7" InputTwinJoyTurbo2 = "KEY_X,JOY1_BUTTON8" -; Analog joystick (e.g. Star Wars Trilogy) +; Analog joystick (Star Wars Trilogy) InputAnalogJoyLeft = "KEY_LEFT" ; digital, move left InputAnalogJoyRight = "KEY_RIGHT" ; digital, move right InputAnalogJoyUp = "KEY_UP" ; digital, move up @@ -142,8 +149,10 @@ InputAnalogJoyX = "JOY_XAXIS,MOUSE_XAXIS" ; analog, full X axis InputAnalogJoyY = "JOY_YAXIS,MOUSE_YAXIS" ; analog, full Y axis InputAnalogJoyTrigger = "KEY_A,JOY_BUTTON1,MOUSE_LEFT_BUTTON" InputAnalogJoyEvent = "KEY_S,JOY_BUTTON2,MOUSE_RIGHT_BUTTON" +InputAnalogJoyTrigger2 = "KEY_D,JOY_BUTTON2" +InputAnalogJoyEvent2 = "NONE" -; Light guns +; Light guns (Lost World) InputGunLeft = "KEY_LEFT" ; digital, move gun left InputGunRight = "KEY_RIGHT" ; digital, move gun right InputGunUp = "KEY_UP" ; digital, move gun up @@ -163,3 +172,33 @@ InputTrigger2 = "JOY2_BUTTON1" InputOffscreen2 = "JOY2_BUTTON2" InputAutoTrigger2 = 0 +; Analog guns (Ocean Hunter, LA Machineguns) +InputAnalogGunLeft = "KEY_LEFT" ; digital, move gun left +InputAnalogGunRight = "KEY_RIGHT" ; digital, move gun right +InputAnalogGunUp = "KEY_UP" ; digital, move gun up +InputAnalogGunDown = "KEY_DOWN" ; digital, move gun down +InputAnalogGunX = "MOUSE_XAXIS,JOY1_XAXIS" ; analog, full X axis +InputAnalogGunY = "MOUSE_YAXIS,JOY1_YAXIS" ; analog, full Y axis +InputAnalogTriggerLeft = "KEY_A,JOY1_BUTTON1,MOUSE_LEFT_BUTTON" +InputAnalogTriggerRight = "KEY_S,JOY1_BUTTON2,MOUSE_RIGHT_BUTTON" +InputAnalogGunLeft2 = "NONE" +InputAnalogGunRight2 = "NONE" +InputAnalogGunUp2 = "NONE" +InputAnalogGunDown2 = "NONE" +InputAnalogGunX2 = "NONE" +InputAnalogGunY2 = "NONE" +InputAnalogTriggerLeft2 = "NONE" +InputAnalogTriggerRight2 = "NONE" + +; Ski Champ controls +InputSkiLeft = "KEY_LEFT" +InputSkiRight = "KEY_RIGHT" +InputSkiUp = "KEY_UP" +InputSkiDown = "KEY_DOWN" +InputSkiX = "JOY1_XAXIS" +InputSkiY = "JOY1_YAXIS" +InputSkiPollLeft = "KEY_A,JOY1_BUTTON1" +InputSkiPollRight = "KEY_S,JOY1_BUTTON2" +InputSkiSelect1 = "KEY_Q,JOY1_BUTTON3" +InputSkiSelect2 = "KEY_W,JOY1_BUTTON4" +InputSkiSelect3 = "KEY_E,JOY1_BUTTON5" \ No newline at end of file diff --git a/Src/Games.cpp b/Src/Games.cpp index 4187ed3..73df496 100644 --- a/Src/Games.cpp +++ b/Src/Games.cpp @@ -115,7 +115,7 @@ const struct GameInfo g_Model3GameList[] = false, // 96 MB of banked CROM (do not mirror) 0x4000000, // 64 MB of VROM 0x1000000, // 16 MB of sample ROMs - GAME_INPUT_COMMON|GAME_INPUT_VEHICLE|GAME_INPUT_VR|GAME_INPUT_SHIFT4, + GAME_INPUT_COMMON|GAME_INPUT_VEHICLE|GAME_INPUT_SHIFT4|GAME_INPUT_VR4, 2, // DSB2 MPEG board true, // drive board @@ -199,7 +199,7 @@ const struct GameInfo g_Model3GameList[] = false, // 64 MB of banked CROM (do not mirror) 0x4000000, // 64 MB of VROM 0x1000000, // 16 MB of sample ROMs - GAME_INPUT_COMMON|GAME_INPUT_VEHICLE|GAME_INPUT_VR|GAME_INPUT_SHIFT4, + GAME_INPUT_COMMON|GAME_INPUT_VEHICLE|GAME_INPUT_SHIFT4|GAME_INPUT_VR4, 2, // DSB2 MPEG board true, // drive board @@ -283,7 +283,7 @@ const struct GameInfo g_Model3GameList[] = true, // 32 MB of banked CROM (Mirror) 0x4000000, // 64 MB of VROM 0xC00000, // 12 MB of sample ROMs - GAME_INPUT_COMMON|GAME_INPUT_VEHICLE|GAME_INPUT_SHIFT4|GAME_INPUT_RALLY, + GAME_INPUT_COMMON|GAME_INPUT_VEHICLE|GAME_INPUT_SHIFTUPDOWN|GAME_INPUT_HANDBRAKE|GAME_INPUT_VIEWCHANGE, 0, // no MPEG board false, // no drive board @@ -346,7 +346,7 @@ const struct GameInfo g_Model3GameList[] = true, // 32 MB of banked CROM (Mirror) 0x4000000, // 64 MB of VROM 0xC00000, // 12 MB of sample ROMs - GAME_INPUT_COMMON|GAME_INPUT_VEHICLE|GAME_INPUT_SHIFT4|GAME_INPUT_RALLY, + GAME_INPUT_COMMON|GAME_INPUT_VEHICLE|GAME_INPUT_SHIFTUPDOWN|GAME_INPUT_HANDBRAKE|GAME_INPUT_VIEWCHANGE, 0, // no MPEG board false, // no drive board @@ -409,7 +409,7 @@ const struct GameInfo g_Model3GameList[] = true, // 48 MB of banked CROM (Mirror) 0x4000000, // 64 MB of VROM 0x1000000, // 16 MB of sample ROMs - GAME_INPUT_COMMON|GAME_INPUT_VEHICLE|GAME_INPUT_SHIFT4|GAME_INPUT_RALLY, + GAME_INPUT_COMMON|GAME_INPUT_VEHICLE|GAME_INPUT_SHIFTUPDOWN|GAME_INPUT_VIEWCHANGE, 0, // no MPEG board false, // no drive board @@ -479,7 +479,7 @@ const struct GameInfo g_Model3GameList[] = true, // 48 MB of banked CROM (Mirror) 0x4000000, // 64 MB of VROM 0x1000000, // 16 MB of sample ROMs - GAME_INPUT_COMMON|GAME_INPUT_VEHICLE|GAME_INPUT_SHIFT4|GAME_INPUT_RALLY, + GAME_INPUT_COMMON|GAME_INPUT_VEHICLE|GAME_INPUT_SHIFTUPDOWN|GAME_INPUT_VIEWCHANGE, 0, // no MPEG board false, // no drive board @@ -693,7 +693,7 @@ const struct GameInfo g_Model3GameList[] = true, // 40 MB of banked CROM (Mirror) 0x4000000, // 64 MB of VROM 0x1000000, // 16 MB of sample ROMs - GAME_INPUT_COMMON|GAME_INPUT_VEHICLE, + GAME_INPUT_COMMON|GAME_INPUT_VEHICLE|GAME_INPUT_SHIFTUPDOWN|GAME_INPUT_HARLEY|GAME_INPUT_VIEWCHANGE, 0, // no MPEG board false, // no drive board @@ -763,7 +763,7 @@ const struct GameInfo g_Model3GameList[] = true, // 40 MB of banked CROM (Mirror) 0x4000000, // 64 MB of VROM 0x1000000, // 16 MB of sample ROMs - GAME_INPUT_COMMON|GAME_INPUT_VEHICLE, + GAME_INPUT_COMMON|GAME_INPUT_VEHICLE|GAME_INPUT_SHIFTUPDOWN|GAME_INPUT_HARLEY|GAME_INPUT_VIEWCHANGE, 0, // no MPEG board false, // no drive board @@ -833,7 +833,7 @@ const struct GameInfo g_Model3GameList[] = true, // 48 MB of banked CROM (Mirror) 0x4000000, // 64 MB of VROM 0x1000000, // 16 MB of sample ROMs - GAME_INPUT_COMMON|GAME_INPUT_ANALOG_JOYSTICK, + GAME_INPUT_COMMON|GAME_INPUT_ANALOG_GUN1|GAME_INPUT_ANALOG_GUN2, 0, // no MPEG board false, // no drive board @@ -903,7 +903,7 @@ const struct GameInfo g_Model3GameList[] = true, // 48 MB of banked CROM (Mirror) 0x2000000, // 32 MB of VROM 0x800000, // 8 MB of sample ROMs - GAME_INPUT_COMMON|GAME_INPUT_VEHICLE|GAME_INPUT_VR|GAME_INPUT_SHIFT4, // for now, Shift Up/Down mapped to Shift 3/4 + GAME_INPUT_COMMON|GAME_INPUT_VEHICLE|GAME_INPUT_VR4|GAME_INPUT_SHIFTUPDOWN, 0, // no MPEG board false, // no drive board @@ -1103,7 +1103,7 @@ const struct GameInfo g_Model3GameList[] = false, // 96 MB of banked CROM (do not mirror) 0x4000000, // 64 MB of VROM 0x1000000, // 16 MB of sample ROMs - GAME_INPUT_COMMON|GAME_INPUT_ANALOG_JOYSTICK, + GAME_INPUT_COMMON|GAME_INPUT_ANALOG_GUN1|GAME_INPUT_ANALOG_GUN2, 0, // no MPEG board false, // no drive board @@ -1173,7 +1173,7 @@ const struct GameInfo g_Model3GameList[] = true, // 48 MB of banked CROM (Mirror) 0x2000000, // 32 MB of VROM 0x800000, // 8 MB of sample ROMs - GAME_INPUT_COMMON|GAME_INPUT_VEHICLE|GAME_INPUT_VR|GAME_INPUT_SHIFT4, + GAME_INPUT_COMMON|GAME_INPUT_VEHICLE|GAME_INPUT_SHIFT4|GAME_INPUT_VR4, 1, // DSB1 MPEG board true, // drive board @@ -1249,7 +1249,7 @@ const struct GameInfo g_Model3GameList[] = true, // 48 MB of banked CROM (Mirror) 0x2000000, // 32 MB of VROM 0x800000, // 8 MB of sample ROMs - GAME_INPUT_COMMON|GAME_INPUT_VEHICLE|GAME_INPUT_VR|GAME_INPUT_SHIFT4, + GAME_INPUT_COMMON|GAME_INPUT_VEHICLE|GAME_INPUT_SHIFT4|GAME_INPUT_VR4, 1, // DSB1 MPEG board true, // drive board @@ -1325,7 +1325,7 @@ const struct GameInfo g_Model3GameList[] = true, // 48 MB of banked CROM (Mirror) 0x2000000, // 32 MB of VROM 0x800000, // 8 MB of sample ROMs - GAME_INPUT_COMMON|GAME_INPUT_VEHICLE|GAME_INPUT_VR|GAME_INPUT_SHIFT4, + GAME_INPUT_COMMON|GAME_INPUT_VEHICLE|GAME_INPUT_SHIFT4|GAME_INPUT_VR4, 1, // DSB1 MPEG board true, // drive board @@ -1401,7 +1401,7 @@ const struct GameInfo g_Model3GameList[] = true, // 64 MB of banked CROM (Mirror) 0x2000000, // 32 MB of VROM 0x800000, // 8 MB of sample ROMs - GAME_INPUT_COMMON|GAME_INPUT_VEHICLE|GAME_INPUT_VR|GAME_INPUT_SHIFT4, + GAME_INPUT_COMMON|GAME_INPUT_VEHICLE|GAME_INPUT_SHIFT4|GAME_INPUT_VR4, 1, // DSB1 MPEG board true, // drive board @@ -1483,7 +1483,7 @@ const struct GameInfo g_Model3GameList[] = true, // 64 MB of banked CROM (Mirror) 0x2000000, // 32 MB of VROM 0x800000, // 8 MB of sample ROMs - GAME_INPUT_COMMON|GAME_INPUT_VEHICLE|GAME_INPUT_VR|GAME_INPUT_SHIFT4, + GAME_INPUT_COMMON|GAME_INPUT_VEHICLE|GAME_INPUT_SHIFT4|GAME_INPUT_VR4, 1, // DSB1 MPEG board true, // drive board @@ -1565,7 +1565,7 @@ const struct GameInfo g_Model3GameList[] = true, // 64 MB of banked CROM (Mirror) 0x4000000, // 64 MB of VROM 0x800000, // 8 MB of sample ROMs - GAME_INPUT_COMMON|GAME_INPUT_VEHICLE, + GAME_INPUT_COMMON|GAME_INPUT_SKI, 0, // no MPEG board false, // no drive board @@ -1801,7 +1801,7 @@ const struct GameInfo g_Model3GameList[] = true, // 48 MB of banked CROM (Mirror) 0x4000000, // 64 MB of VROM 0x800000, // 8 MB of sample ROMs - GAME_INPUT_COMMON|GAME_INPUT_VEHICLE|GAME_INPUT_RALLY|GAME_INPUT_SHIFT4, + GAME_INPUT_COMMON|GAME_INPUT_VEHICLE|GAME_INPUT_SHIFT4|GAME_INPUT_HANDBRAKE|GAME_INPUT_VIEWCHANGE, 2, // DSB2 MPEG board true, // drive board @@ -1877,7 +1877,7 @@ const struct GameInfo g_Model3GameList[] = true, // 48 MB of banked CROM (Mirror) 0x4000000, // 64 MB of VROM 0x800000, // 8 MB of sample ROMs - GAME_INPUT_COMMON|GAME_INPUT_VEHICLE|GAME_INPUT_RALLY|GAME_INPUT_SHIFT4, + GAME_INPUT_COMMON|GAME_INPUT_VEHICLE|GAME_INPUT_SHIFT4|GAME_INPUT_HANDBRAKE|GAME_INPUT_VIEWCHANGE, 0, // no MPEG board true, // drive board diff --git a/Src/Games.h b/Src/Games.h index db9469d..66a0c72 100644 --- a/Src/Games.h +++ b/Src/Games.h @@ -37,21 +37,27 @@ ******************************************************************************/ // Input flags -#define GAME_INPUT_COMMON 0x0001 // game has common controls -#define GAME_INPUT_VEHICLE 0x0002 // game has vehicle controls -#define GAME_INPUT_JOYSTICK1 0x0004 // game has joystick 1 -#define GAME_INPUT_JOYSTICK2 0x0008 // game has joystick 2 -#define GAME_INPUT_FIGHTING 0x0010 // game has fighting game controls -#define GAME_INPUT_VR 0x0020 // game has VR view buttons -#define GAME_INPUT_RALLY 0x0040 // game has rally car controls -#define GAME_INPUT_GUN1 0x0080 // game has gun 1 -#define GAME_INPUT_GUN2 0x0100 // game has gun 2 -#define GAME_INPUT_SHIFT4 0x0200 // game has 4-speed shifter -#define GAME_INPUT_ANALOG_JOYSTICK 0x0400 // game has analog joystick -#define GAME_INPUT_TWIN_JOYSTICKS 0x0800 // game has twin joysticks -#define GAME_INPUT_SOCCER 0x1000 // game has soccer controls -#define GAME_INPUT_SPIKEOUT 0x2000 // game has Spikeout buttons -#define GAME_INPUT_ALL 0x3FFF +#define GAME_INPUT_COMMON 0x00001 // game has common controls +#define GAME_INPUT_VEHICLE 0x00002 // game has vehicle controls +#define GAME_INPUT_JOYSTICK1 0x00004 // game has joystick 1 +#define GAME_INPUT_JOYSTICK2 0x00008 // game has joystick 2 +#define GAME_INPUT_FIGHTING 0x00010 // game has fighting game controls +#define GAME_INPUT_VR4 0x00020 // game has four VR view buttons +#define GAME_INPUT_VIEWCHANGE 0x00040 // game has single view change button +#define GAME_INPUT_SHIFT4 0x00080 // game has 4-speed shifter +#define GAME_INPUT_SHIFTUPDOWN 0x00100 // game has up/down shifter +#define GAME_INPUT_HANDBRAKE 0x00200 // game has handbrake +#define GAME_INPUT_HARLEY 0x00400 // game has Harley Davidson controls +#define GAME_INPUT_GUN1 0x00800 // game has light gun 1 +#define GAME_INPUT_GUN2 0x01000 // game has light gun 2 +#define GAME_INPUT_ANALOG_JOYSTICK 0x02000 // game has analog joystick +#define GAME_INPUT_TWIN_JOYSTICKS 0x04000 // game has twin joysticks +#define GAME_INPUT_SOCCER 0x08000 // game has soccer controls +#define GAME_INPUT_SPIKEOUT 0x10000 // game has Spikeout buttons +#define GAME_INPUT_ANALOG_GUN1 0x20000 // game has analog gun 1 +#define GAME_INPUT_ANALOG_GUN2 0x40000 // game has analog gun 2 +#define GAME_INPUT_SKI 0x80000 // game has ski controls +#define GAME_INPUT_ALL 0xFFFFF /****************************************************************************** diff --git a/Src/Inputs/Input.cpp b/Src/Inputs/Input.cpp index 644bf06..721fe3f 100644 --- a/Src/Inputs/Input.cpp +++ b/Src/Inputs/Input.cpp @@ -91,13 +91,19 @@ const char* CInput::GetInputGroup() case GAME_INPUT_SPIKEOUT: return "Spikeout Buttons"; case GAME_INPUT_SOCCER: return "Virtua Striker Buttons"; case GAME_INPUT_VEHICLE: return "Racing Game Steering Controls"; - case GAME_INPUT_SHIFT4: return "Racing Game Gear Shift"; - case GAME_INPUT_VR: return "Racing Game VR View Buttons"; - case GAME_INPUT_RALLY: return "Miscellaneous Driving Game Buttons"; + case GAME_INPUT_SHIFT4: return "Racing Game Gear 4-Way Shift"; + case GAME_INPUT_SHIFTUPDOWN: return "Racing Game Gear Up/Down Shift"; + case GAME_INPUT_VR4: return "Racing Game 4 VR View Buttons"; + case GAME_INPUT_VIEWCHANGE: return "Racing Game View Change"; + case GAME_INPUT_HANDBRAKE: return "Racing Game Handbrake"; + case GAME_INPUT_HARLEY: return "Harley Davidson Controls"; case GAME_INPUT_TWIN_JOYSTICKS: return "Virtual On Controls"; case GAME_INPUT_ANALOG_JOYSTICK: return "Analog Joystick"; case GAME_INPUT_GUN1: // Fall through to below - case GAME_INPUT_GUN2: return "Lightguns"; + case GAME_INPUT_GUN2: return "Light Guns"; + case GAME_INPUT_ANALOG_GUN1: // Fall through to below + case GAME_INPUT_ANALOG_GUN2: return "Analog Guns"; + case GAME_INPUT_SKI: return "Ski Controls"; default: return "Misc"; } } diff --git a/Src/Inputs/InputSystem.cpp b/Src/Inputs/InputSystem.cpp index 2eb1d2a..fa80a2d 100644 --- a/Src/Inputs/InputSystem.cpp +++ b/Src/Inputs/InputSystem.cpp @@ -1709,7 +1709,7 @@ bool CInputSystem::ReadMapping(char *buffer, unsigned bufSize, bool fullAxisOnly { if (!Poll()) goto Cancelled; - Wait(1000/60); + CThread::Sleep(1000/60); } goto Cancelled; } @@ -1744,7 +1744,7 @@ bool CInputSystem::ReadMapping(char *buffer, unsigned bufSize, bool fullAxisOnly } // Don't poll continuously - Wait(1000/60); + CThread::Sleep(1000/60); } // Copy mapping to buffer and return @@ -1833,7 +1833,7 @@ bool CInputSystem::DetectJoystickAxis(unsigned joyNum, unsigned &axisNum, const { if (!Poll()) goto Cancelled; - Wait(1000/60); + CThread::Sleep(1000/60); } goto Cancelled; } @@ -1846,7 +1846,7 @@ bool CInputSystem::DetectJoystickAxis(unsigned joyNum, unsigned &axisNum, const { if (!Poll()) goto Cancelled; - Wait(1000/60); + CThread::Sleep(1000/60); } break; } @@ -1878,7 +1878,7 @@ bool CInputSystem::DetectJoystickAxis(unsigned joyNum, unsigned &axisNum, const } // Don't poll continuously - Wait(1000/60); + CThread::Sleep(1000/60); } maxRange = 0; @@ -2026,7 +2026,7 @@ Repeat: { if (!Poll()) goto Cancelled; - Wait(1000/60); + CThread::Sleep(1000/60); } goto Cancelled; } @@ -2045,7 +2045,7 @@ Repeat: } // Don't poll continuously - Wait(1000/60); + CThread::Sleep(1000/60); } printf("Done\n\n"); diff --git a/Src/Inputs/InputSystem.h b/Src/Inputs/InputSystem.h index 5b23cdc..9cdb4e8 100644 --- a/Src/Inputs/InputSystem.h +++ b/Src/Inputs/InputSystem.h @@ -690,11 +690,6 @@ protected: */ virtual bool ProcessForceFeedbackCmd(int joyNum, int axisNum, ForceFeedbackCmd ffCmd) = 0; - /* - * Waits for the given time in milliseconds - */ - virtual void Wait(int ms) = 0; - // // Virtual methods subclass can override if required // diff --git a/Src/Inputs/InputTypes.cpp b/Src/Inputs/InputTypes.cpp index a75248e..9550f36 100644 --- a/Src/Inputs/InputTypes.cpp +++ b/Src/Inputs/InputTypes.cpp @@ -122,8 +122,8 @@ void CAxisInput::Poll() else { value = m_offVal; - if (m_posInput != NULL) value += (int)(m_posInput->ValueAsFraction() * (double)(m_offVal - m_maxVal)); - if (m_negInput != NULL) value -= (int)(m_negInput->ValueAsFraction() * (double)(m_minVal - m_offVal)); + if (m_posInput != NULL) value -= (int)(m_posInput->ValueAsFraction() * (double)(m_offVal - m_maxVal)); + if (m_negInput != NULL) value += (int)(m_negInput->ValueAsFraction() * (double)(m_minVal - m_offVal)); } } else if (m_source != NULL && m_source->GetValueAsAnalog(intValue, m_minVal, m_offVal, m_maxVal)) diff --git a/Src/Inputs/Inputs.cpp b/Src/Inputs/Inputs.cpp index 5c80760..0d34afe 100644 --- a/Src/Inputs/Inputs.cpp +++ b/Src/Inputs/Inputs.cpp @@ -108,30 +108,36 @@ CInputs::CInputs(CInputSystem *system) : m_system(system) CAnalogInput *steeringLeft = AddAnalogInput("SteeringLeft", "Steer Left", GAME_INPUT_VEHICLE, "NONE"); CAnalogInput *steeringRight = AddAnalogInput("SteeringRight", "Steer Right", GAME_INPUT_VEHICLE, "NONE"); - steering = AddAxisInput ("Steering", "Full Steering", GAME_INPUT_VEHICLE, "NONE", steeringLeft, steeringRight); - accelerator = AddAnalogInput("Accelerator", "Accelerator Pedal", GAME_INPUT_VEHICLE, "NONE"); - brake = AddAnalogInput("Brake", "Brake Pedal", GAME_INPUT_VEHICLE, "NONE"); + steering = AddAxisInput ("Steering", "Full Steering", GAME_INPUT_VEHICLE, "NONE", steeringLeft, steeringRight); + accelerator = AddAnalogInput("Accelerator", "Accelerator Pedal", GAME_INPUT_VEHICLE, "NONE"); + brake = AddAnalogInput("Brake", "Brake Pedal/Front Brake", GAME_INPUT_VEHICLE, "NONE"); + gearShiftUp = AddSwitchInput("GearShiftUp", "Shift Up", GAME_INPUT_VEHICLE, "NONE"); + gearShiftDown = AddSwitchInput("GearShiftDown", "Shift Down", GAME_INPUT_VEHICLE, "NONE"); // Racing Game Gear Shift - CSwitchInput *shift1 = AddSwitchInput("GearShift1", "Shift 1/Up", GAME_INPUT_SHIFT4, "NONE"); - CSwitchInput *shift2 = AddSwitchInput("GearShift2", "Shift 2/Down", GAME_INPUT_SHIFT4, "NONE"); - CSwitchInput *shift3 = AddSwitchInput("GearShift3", "Shift 3", GAME_INPUT_SHIFT4, "NONE"); - CSwitchInput *shift4 = AddSwitchInput("GearShift4", "Shift 4", GAME_INPUT_SHIFT4, "NONE"); - CSwitchInput *shiftN = AddSwitchInput("GearShiftN", "Shift Neutral",GAME_INPUT_SHIFT4, "NONE"); - CSwitchInput *shiftUp = AddSwitchInput("GearShiftUp", "Shift Up", GAME_INPUT_SHIFT4, "NONE"); - CSwitchInput *shiftDown = AddSwitchInput("GearShiftDown", "Shift Down", GAME_INPUT_SHIFT4, "NONE"); + CSwitchInput *shift1 = AddSwitchInput("GearShift1", "Shift 1", GAME_INPUT_SHIFT4, "NONE"); + CSwitchInput *shift2 = AddSwitchInput("GearShift2", "Shift 2", GAME_INPUT_SHIFT4, "NONE"); + CSwitchInput *shift3 = AddSwitchInput("GearShift3", "Shift 3", GAME_INPUT_SHIFT4, "NONE"); + CSwitchInput *shift4 = AddSwitchInput("GearShift4", "Shift 4", GAME_INPUT_SHIFT4, "NONE"); + CSwitchInput *shiftN = AddSwitchInput("GearShiftN", "Shift Neutral", GAME_INPUT_SHIFT4, "NONE"); + + gearShift4 = AddGearShift4Input("GearShift", "Gear Shift", GAME_INPUT_SHIFT4, shift1, shift2, shift3, shift4, shiftN, gearShiftUp, gearShiftDown); + + // Racing Game 4 VR View Buttons + vr[0] = AddSwitchInput("VR1", "VR1", GAME_INPUT_VR4, "NONE"); + vr[1] = AddSwitchInput("VR2", "VR2", GAME_INPUT_VR4, "NONE"); + vr[2] = AddSwitchInput("VR3", "VR3", GAME_INPUT_VR4, "NONE"); + vr[3] = AddSwitchInput("VR4", "VR4", GAME_INPUT_VR4, "NONE"); - gearShift4 = AddGearShift4Input("GearShift", "Gear Shift", GAME_INPUT_SHIFT4, shift1, shift2, shift3, shift4, shiftN, shiftUp, shiftDown); - - // Racing Game VR View Buttons - vr[0] = AddSwitchInput("VR1", "VR1", GAME_INPUT_VR, "NONE"); - vr[1] = AddSwitchInput("VR2", "VR2", GAME_INPUT_VR, "NONE"); - vr[2] = AddSwitchInput("VR3", "VR3", GAME_INPUT_VR, "NONE"); - vr[3] = AddSwitchInput("VR4", "VR4", GAME_INPUT_VR, "NONE"); - - // Sega Rally Buttons - viewChange = AddSwitchInput("ViewChange", "View Change", GAME_INPUT_RALLY, "NONE"); - handBrake = AddSwitchInput("HandBrake", "Hand Brake", GAME_INPUT_RALLY, "NONE"); + // Racing Game Single View Change Button + viewChange = AddSwitchInput("ViewChange", "View Change", GAME_INPUT_VIEWCHANGE, "NONE"); + + // Racing Game Handbrake + handBrake = AddSwitchInput("HandBrake", "Hand Brake", GAME_INPUT_HANDBRAKE, "NONE"); + + // Harley Davidson Controls + rearBrake = AddAnalogInput("RearBrake", "Rear Brake", GAME_INPUT_HARLEY, "NONE"); + musicSelect = AddSwitchInput("MusicSelect", "Music Selection", GAME_INPUT_HARLEY, "NONE"); // Virtual On Controls twinJoyTurnLeft = AddSwitchInput("TwinJoyTurnLeft", "Macro Turn Left", GAME_INPUT_TWIN_JOYSTICKS, "NONE"); @@ -161,12 +167,14 @@ CInputs::CInputs(CInputSystem *system) : m_system(system) CAnalogInput *analogJoyUp = AddAnalogInput("AnalogJoyUp", "Analog Up", GAME_INPUT_ANALOG_JOYSTICK, "NONE"); CAnalogInput *analogJoyDown = AddAnalogInput("AnalogJoyDown", "Analog Down", GAME_INPUT_ANALOG_JOYSTICK, "NONE"); - analogJoyX = AddAxisInput ("AnalogJoyX", "Analog X-Axis", GAME_INPUT_ANALOG_JOYSTICK, "NONE", analogJoyLeft, analogJoyRight); - analogJoyY = AddAxisInput ("AnalogJoyY", "Analog Y-Axis", GAME_INPUT_ANALOG_JOYSTICK, "NONE", analogJoyUp, analogJoyDown); - analogJoyTrigger = AddSwitchInput("AnalogJoyTrigger", "Trigger Button", GAME_INPUT_ANALOG_JOYSTICK, "NONE"); - analogJoyEvent = AddSwitchInput("AnalogJoyEvent", "Event Button", GAME_INPUT_ANALOG_JOYSTICK, "NONE"); + analogJoyX = AddAxisInput ("AnalogJoyX", "Analog X-Axis", GAME_INPUT_ANALOG_JOYSTICK, "NONE", analogJoyLeft, analogJoyRight); + analogJoyY = AddAxisInput ("AnalogJoyY", "Analog Y-Axis", GAME_INPUT_ANALOG_JOYSTICK, "NONE", analogJoyUp, analogJoyDown); + analogJoyTrigger1 = AddSwitchInput("AnalogJoyTrigger", "Trigger Button 1", GAME_INPUT_ANALOG_JOYSTICK, "NONE"); + analogJoyTrigger2 = AddSwitchInput("AnalogJoyTrigger2", "Trigger Button 2", GAME_INPUT_ANALOG_JOYSTICK, "NONE"); + analogJoyEvent1 = AddSwitchInput("AnalogJoyEvent", "Event Button 1", GAME_INPUT_ANALOG_JOYSTICK, "NONE"); + analogJoyEvent2 = AddSwitchInput("AnalogJoyEvent2", "Event Button 2", GAME_INPUT_ANALOG_JOYSTICK, "NONE"); - // Lightguns + // Light guns CAnalogInput *gun1Left = AddAnalogInput("GunLeft", "P1 Gun Left", GAME_INPUT_GUN1, "NONE"); CAnalogInput *gun1Right = AddAnalogInput("GunRight", "P1 Gun Right", GAME_INPUT_GUN1, "NONE"); CAnalogInput *gun1Up = AddAnalogInput("GunUp", "P1 Gun Up", GAME_INPUT_GUN1, "NONE"); @@ -192,6 +200,43 @@ CInputs::CInputs(CInputSystem *system) : m_system(system) CSwitchInput *gun2Offscreen = AddSwitchInput("Offscreen2", "P2 Point Off-screen", GAME_INPUT_GUN2, "NONE"); trigger[1] = AddTriggerInput("AutoTrigger2", "P2 Auto Trigger", GAME_INPUT_GUN2, gun2Trigger, gun2Offscreen); + + // Analog guns + CAnalogInput *analogGun1Left = AddAnalogInput("AnalogGunLeft", "P1 Analog Gun Left", GAME_INPUT_ANALOG_GUN1, "NONE"); + CAnalogInput *analogGun1Right = AddAnalogInput("AnalogGunRight", "P1 Analog Gun Right", GAME_INPUT_ANALOG_GUN1, "NONE"); + CAnalogInput *analogGun1Up = AddAnalogInput("AnalogGunUp", "P1 Analog Gun Up", GAME_INPUT_ANALOG_GUN1, "NONE"); + CAnalogInput *analogGun1Down = AddAnalogInput("AnalogGunDown", "P1 Analog Gun Down", GAME_INPUT_ANALOG_GUN1, "NONE"); + + analogGunX[0] = AddAxisInput("AnalogGunX", "P1 Analog Gun X-Axis", GAME_INPUT_ANALOG_GUN1, "NONE", analogGun1Left, analogGun1Right, 0, 0x80, 0xFF); + analogGunY[0] = AddAxisInput("AnalogGunY", "P1 Analog Gun Y-Axis", GAME_INPUT_ANALOG_GUN1, "NONE", analogGun1Up, analogGun1Down, 0xFF, 0x80, 0); + + analogTriggerLeft[0] = AddSwitchInput("AnalogTriggerLeft", "P1 Analog Gun Left Trigger", GAME_INPUT_ANALOG_GUN1, "NONE"); + analogTriggerRight[0] = AddSwitchInput("AnalogTriggerRight", "P1 Analog Gun Right Trigger", GAME_INPUT_ANALOG_GUN1, "NONE"); + + CAnalogInput *analogGun2Left = AddAnalogInput("AnalogGunLeft2", "P2 Analog Gun Left", GAME_INPUT_ANALOG_GUN2, "NONE"); + CAnalogInput *analogGun2Right = AddAnalogInput("AnalogGunRight2", "P2 Analog Gun Right", GAME_INPUT_ANALOG_GUN2, "NONE"); + CAnalogInput *analogGun2Up = AddAnalogInput("AnalogGunUp2", "P2 Analog Gun Up", GAME_INPUT_ANALOG_GUN2, "NONE"); + CAnalogInput *analogGun2Down = AddAnalogInput("AnalogGunDown2", "P2 Analog Gun Down", GAME_INPUT_ANALOG_GUN2, "NONE"); + + analogGunX[1] = AddAxisInput("AnalogGunX2", "P2 Analog Gun X-Axis", GAME_INPUT_ANALOG_GUN2, "NONE", analogGun2Left, analogGun2Right, 0, 0x80, 0xFF); + analogGunY[1] = AddAxisInput("AnalogGunY2", "P2 Analog Gun Y-Axis", GAME_INPUT_ANALOG_GUN2, "NONE", analogGun2Up, analogGun2Down, 0xFF, 0x80, 0); + + analogTriggerLeft[1] = AddSwitchInput("AnalogTriggerLeft2", "P2 Analog Gun Left Trigger", GAME_INPUT_ANALOG_GUN2, "NONE"); + analogTriggerRight[1] = AddSwitchInput("AnalogTriggerRight2", "P2 Analog Gun Right Trigger", GAME_INPUT_ANALOG_GUN2, "NONE"); + + // Ski controls + CAnalogInput *skiLeft = AddAnalogInput("SkiLeft", "Ski Champ Left", GAME_INPUT_SKI, "NONE"); + CAnalogInput *skiRight = AddAnalogInput("SkiRight", "Ski Champ Right", GAME_INPUT_SKI, "NONE"); + CAnalogInput *skiUp = AddAnalogInput("SkiUp", "Ski Champ Up", GAME_INPUT_SKI, "NONE"); + CAnalogInput *skiDown = AddAnalogInput("SkiDown", "Ski Champ Down", GAME_INPUT_SKI, "NONE"); + + skiX = AddAxisInput ("SkiX", "Ski Champ X-Axis", GAME_INPUT_SKI, "NONE", skiLeft, skiRight, 0xFF, 0x80, 0); + skiY = AddAxisInput ("SkiY", "Ski Champ Y-Axis", GAME_INPUT_SKI, "NONE", skiUp, skiDown); + skiPollLeft = AddSwitchInput("SkiPollLeft", "Ski Champ Poll Left", GAME_INPUT_SKI, "NONE"); + skiPollRight = AddSwitchInput("SkiPollRight", "Ski Champ Poll Right", GAME_INPUT_SKI, "NONE"); + skiSelect1 = AddSwitchInput("SkiSelect1", "Ski Champ Select 1", GAME_INPUT_SKI, "NONE"); + skiSelect2 = AddSwitchInput("SkiSelect2", "Ski Champ Select 2", GAME_INPUT_SKI, "NONE"); + skiSelect3 = AddSwitchInput("SkiSelect3", "Ski Champ Select 3", GAME_INPUT_SKI, "NONE"); } CInputs::~CInputs() diff --git a/Src/Inputs/Inputs.h b/Src/Inputs/Inputs.h index 56b1542..28bd884 100644 --- a/Src/Inputs/Inputs.h +++ b/Src/Inputs/Inputs.h @@ -148,6 +148,10 @@ public: // VR view buttons: VR1 Red, VR2 Blue, VR3 Yellow, VR4 Green CSwitchInput *vr[4]; + // Up/down gear shift + CSwitchInput *gearShiftUp; + CSwitchInput *gearShiftDown; + // 4-speed gear shift CGearShift4Input *gearShift4; @@ -155,6 +159,10 @@ public: CSwitchInput *viewChange; CSwitchInput *handBrake; + // Harley Davidson controls + CAnalogInput *rearBrake; + CSwitchInput *musicSelect; + // Twin joysticks (individually mapped version; 1 = left stick, 2 = right stick) CSwitchInput *twinJoyLeft1; CSwitchInput *twinJoyLeft2; @@ -182,14 +190,31 @@ public: // Analog joystick CAxisInput *analogJoyX; CAxisInput *analogJoyY; - CSwitchInput *analogJoyTrigger; - CSwitchInput *analogJoyEvent; + CSwitchInput *analogJoyTrigger1; + CSwitchInput *analogJoyTrigger2; + CSwitchInput *analogJoyEvent1; + CSwitchInput *analogJoyEvent2; - // Gun controls (players 1 and 2) + // Light gun controls (players 1 and 2) CAxisInput *gunX[2]; CAxisInput *gunY[2]; CTriggerInput *trigger[2]; + // Analog gun controls (players 1 and 2) + CAxisInput *analogGunX[2]; + CAxisInput *analogGunY[2]; + CSwitchInput *analogTriggerLeft[2]; + CSwitchInput *analogTriggerRight[2]; + + // Ski Champ controls + CAxisInput *skiX; + CAxisInput *skiY; + CSwitchInput *skiPollLeft; + CSwitchInput *skiPollRight; + CSwitchInput *skiSelect1; + CSwitchInput *skiSelect2; + CSwitchInput *skiSelect3; + /* * Creates a set of inputs with the given input system. */ diff --git a/Src/Model3/Model3.cpp b/Src/Model3/Model3.cpp index 60ac206..05fcaf7 100644 --- a/Src/Model3/Model3.cpp +++ b/Src/Model3/Model3.cpp @@ -228,12 +228,29 @@ UINT8 CModel3::ReadInputs(unsigned reg) data &= ~(Inputs->test[1]->value<<7); // Test B data = (data&0xDF)|(EEPROM.Read()<<5); // bank 1 contains EEPROM data bit } + + if ((Game->inputFlags&GAME_INPUT_SKI)) + { + if ((inputBank&1) == 0) + { + data &= ~(Inputs->skiPollLeft->value<<5); + data &= ~(Inputs->skiSelect1->value<<6); + data &= ~(Inputs->skiSelect2->value<<7); + data &= ~(Inputs->skiSelect3->value<<4); + } + } + return data; case 0x08: // game-specific inputs data = 0xFF; + if ((Game->inputFlags&GAME_INPUT_SKI)) + { + data &= ~(Inputs->skiPollRight->value<<0); + } + if ((Game->inputFlags&GAME_INPUT_JOYSTICK1)) { data &= ~(Inputs->up[0]->value<<5); // P1 Up @@ -265,13 +282,22 @@ UINT8 CModel3::ReadInputs(unsigned reg) data &= ~(Inputs->shoot[0]->value<<1); // P1 Shoot } - if ((Game->inputFlags&GAME_INPUT_VR)) + if ((Game->inputFlags&GAME_INPUT_VR4)) { data &= ~(Inputs->vr[0]->value<<0); // VR1 Red data &= ~(Inputs->vr[1]->value<<1); // VR2 Blue data &= ~(Inputs->vr[2]->value<<2); // VR3 Yellow data &= ~(Inputs->vr[3]->value<<3); // VR4 Green } + + if ((Game->inputFlags&GAME_INPUT_VIEWCHANGE)) + { + // Harley is wired slightly differently + if ((Game->inputFlags&GAME_INPUT_HARLEY)) + data &= ~(Inputs->viewChange->value<<1); // View change + else + data &= ~(Inputs->viewChange->value<<0); // View change + } if ((Game->inputFlags&GAME_INPUT_SHIFT4)) { @@ -284,20 +310,41 @@ UINT8 CModel3::ReadInputs(unsigned reg) else if (Inputs->gearShift4->value == 3) // Shift 3 data &= ~0x10; } - - if ((Game->inputFlags&GAME_INPUT_RALLY)) + + if ((Game->inputFlags&GAME_INPUT_SHIFTUPDOWN)) { - data &= ~(Inputs->viewChange->value<<0); // View change - data &= ~(Inputs->handBrake->value<<1); // Hand brake + // Harley is wired slightly differently + if ((Game->inputFlags&GAME_INPUT_HARLEY)) + { + if (Inputs->gearShiftUp->value) // Shift up + data &= ~0x60; + else if (Inputs->gearShiftDown->value) // Shift down + data &= ~0x50; + } + else + { + if (Inputs->gearShiftUp->value) // Shift up + data &= ~0x50; + else if (Inputs->gearShiftDown->value) // Shift down + data &= ~0x60; + } } + if ((Game->inputFlags&GAME_INPUT_HANDBRAKE)) + data &= ~(Inputs->handBrake->value<<1); // Hand brake + + if ((Game->inputFlags&GAME_INPUT_HARLEY)) + data &= ~(Inputs->musicSelect->value<<0); // Music select + if ((Game->inputFlags&GAME_INPUT_GUN1)) data &= ~(Inputs->trigger[0]->value<<0); // P1 Trigger if ((Game->inputFlags&GAME_INPUT_ANALOG_JOYSTICK)) { - data &= ~(Inputs->analogJoyTrigger->value<<5); // Trigger - data &= ~(Inputs->analogJoyEvent->value<<0); // Event Button + data &= ~(Inputs->analogJoyTrigger1->value<<5); // Trigger 1 + data &= ~(Inputs->analogJoyTrigger2->value<<4); // Trigger 2 + data &= ~(Inputs->analogJoyEvent1->value<<0); // Event Button 1 + data &= ~(Inputs->analogJoyEvent2->value<<1); // Event Button 2 } if ((Game->inputFlags&GAME_INPUT_TWIN_JOYSTICKS)) // First twin joystick @@ -356,6 +403,12 @@ UINT8 CModel3::ReadInputs(unsigned reg) data &= ~0x40; } + if ((Game->inputFlags&GAME_INPUT_ANALOG_GUN1)) + { + data &= ~(Inputs->analogTriggerLeft[0]->value<<0); + data &= ~(Inputs->analogTriggerRight[0]->value<<1); + } + return data; case 0x0C: // game-specific inputs @@ -421,6 +474,12 @@ UINT8 CModel3::ReadInputs(unsigned reg) if ((Game->inputFlags&GAME_INPUT_GUN2)) data &= ~(Inputs->trigger[1]->value<<0); // P2 Trigger + if ((Game->inputFlags&GAME_INPUT_ANALOG_GUN2)) + { + data &= ~(Inputs->analogTriggerLeft[1]->value<<0); + data &= ~(Inputs->analogTriggerRight[1]->value<<1); + } + return data; case 0x2C: // Serial FIFO 1 @@ -441,12 +500,29 @@ UINT8 CModel3::ReadInputs(unsigned reg) adc[0] = (UINT8)Inputs->steering->value; adc[1] = (UINT8)Inputs->accelerator->value; adc[2] = (UINT8)Inputs->brake->value; + if ((Game->inputFlags&GAME_INPUT_HARLEY)) + adc[3] = (UINT8)Inputs->rearBrake->value; } + if ((Game->inputFlags&GAME_INPUT_ANALOG_JOYSTICK)) { adc[0] = (UINT8)Inputs->analogJoyY->value; adc[1] = (UINT8)Inputs->analogJoyX->value; } + + if ((Game->inputFlags&GAME_INPUT_ANALOG_GUN1)||(Game->inputFlags&GAME_INPUT_ANALOG_GUN2)) + { + adc[0] = (UINT8)Inputs->analogGunX[0]->value; + adc[2] = (UINT8)Inputs->analogGunY[0]->value; + adc[1] = (UINT8)Inputs->analogGunX[1]->value; + adc[3] = (UINT8)Inputs->analogGunY[1]->value; + } + + if ((Game->inputFlags&GAME_INPUT_SKI)) + { + adc[0] = (UINT8)Inputs->skiY->value; + adc[1] = (UINT8)Inputs->skiX->value; + } // Read out appropriate channel data = adc[adcChannel&7]; @@ -1984,7 +2060,7 @@ void CModel3::RunFrame(void) RunDriveBoardFrame(); } - frameTicks = CThread::GetTicks() - start; + timings.frameTicks = CThread::GetTicks() - start; return; @@ -2023,7 +2099,7 @@ void CModel3::RunMainBoardFrame(void) statusCycles = (unsigned)((float)frameCycles * 9.12f/100.0f); } else if (Game->step == 0x15) - statusCycles = (unsigned)((float)frameCycles * 4.8f/100.0f); + statusCycles = (unsigned)((float)frameCycles * 5.5f/100.0f); else statusCycles = (unsigned)((float)frameCycles * 48.0f/100.0f); @@ -2082,17 +2158,17 @@ void CModel3::RunMainBoardFrame(void) ppc_execute(dispCycles); //printf("PC=%08X LR=%08X\n", ppc_get_pc(), ppc_get_lr()); - ppcTicks = CThread::GetTicks() - start; + timings.ppcTicks = CThread::GetTicks() - start; } void CModel3::SyncGPUs(void) { UINT32 start = CThread::GetTicks(); - syncSize = GPU.SyncSnapshots() + TileGen.SyncSnapshots(); + timings.syncSize = GPU.SyncSnapshots() + TileGen.SyncSnapshots(); gpusReady = true; - syncTicks = CThread::GetTicks() - start; + timings.syncTicks = CThread::GetTicks() - start; } void CModel3::RenderFrame(void) @@ -2112,7 +2188,7 @@ void CModel3::RenderFrame(void) EndFrameVideo(); - renderTicks = CThread::GetTicks() - start; + timings.renderTicks = CThread::GetTicks() - start; } bool CModel3::RunSoundBoardFrame(void) @@ -2121,7 +2197,7 @@ bool CModel3::RunSoundBoardFrame(void) bool bufferFull = SoundBoard.RunFrame(); - sndTicks = CThread::GetTicks() - start; + timings.sndTicks = CThread::GetTicks() - start; return bufferFull; } @@ -2132,7 +2208,7 @@ void CModel3::RunDriveBoardFrame(void) DriveBoard.RunFrame(); - drvTicks = CThread::GetTicks() - start; + timings.drvTicks = CThread::GetTicks() - start; } bool CModel3::StartThreads(void) @@ -2386,12 +2462,18 @@ void CModel3::DeleteThreadObjects(void) void CModel3::DumpTimings(void) { printf("PPC:%3ums%c render:%3ums%c sync:%4uK%c%3ums%c snd:%3ums%c drv:%3ums%c frame:%3ums%c\n", - ppcTicks, (ppcTicks > renderTicks ? '!' : ','), - renderTicks, (renderTicks > ppcTicks ? '!' : ','), - syncSize / 1024, (syncSize / 1024 > 128 ? '!' : ','), syncTicks, (syncTicks > 1 ? '!' : ','), - sndTicks, (sndTicks > 10 ? '!' : ','), - drvTicks, (drvTicks > 10 ? '!' : ','), - frameTicks, (frameTicks > 16 ? '!' : ' ')); + timings.ppcTicks, (timings.ppcTicks > timings.renderTicks ? '!' : ','), + timings.renderTicks, (timings.renderTicks > timings.ppcTicks ? '!' : ','), + timings.syncSize / 1024, (timings.syncSize / 1024 > 128 ? '!' : ','), + timings.syncTicks, (timings.syncTicks > 1 ? '!' : ','), + timings.sndTicks, (timings.sndTicks > 10 ? '!' : ','), + timings.drvTicks, (timings.drvTicks > 10 ? '!' : ','), + timings.frameTicks, (timings.frameTicks > 16 ? '!' : ' ')); +} + +FrameTimings CModel3::GetTimings(void) +{ + return timings; } int CModel3::StartMainBoardThread(void *data) @@ -2755,13 +2837,14 @@ void CModel3::Reset(void) DriveBoard.Reset(); gpusReady = false; - ppcTicks = 0; - syncSize = 0; - syncTicks = 0; - renderTicks = 0; - sndTicks = 0; - drvTicks = 0; - frameTicks = 0; + + timings.ppcTicks = 0; + timings.syncSize = 0; + timings.syncTicks = 0; + timings.renderTicks = 0; + timings.sndTicks = 0; + timings.drvTicks = 0; + timings.frameTicks = 0; DebugLog("Model 3 reset\n"); } @@ -2782,7 +2865,6 @@ void CModel3::Patch(void) *(UINT32 *) &crom[0x73EB5C] = 0x60000000; *(UINT32 *) &crom[0x73EDD0] = 0x60000000; *(UINT32 *) &crom[0x73EDC4] = 0x60000000; - } else if (!strcmp(Game->id, "lostwsga")) { @@ -2852,7 +2934,6 @@ void CModel3::Patch(void) } else if (!strcmp(Game->id, "eca") || !strcmp(Game->id, "ecax")) { - *(UINT32 *) &crom[0x535580] = 0x60000000; *(UINT32 *) &crom[0x5023B4] = 0x60000000; *(UINT32 *) &crom[0x5023D4] = 0x60000000; diff --git a/Src/Model3/Model3.h b/Src/Model3/Model3.h index d7f7352..ee121ff 100644 --- a/Src/Model3/Model3.h +++ b/Src/Model3/Model3.h @@ -22,13 +22,29 @@ /* * Model3.h * - * Header file defining the CModel3, CModel3Config, and CModel3Inputs classes. + * Header file defining the CModel3 and CModel3Config classes. */ #ifndef INCLUDED_MODEL3_H #define INCLUDED_MODEL3_H +/* + * FrameTimings + * + * Timings within a frame, for debugging purposes + */ +struct FrameTimings +{ + UINT32 ppcTicks; + UINT32 syncSize; + UINT32 syncTicks; + UINT32 renderTicks; + UINT32 sndTicks; + UINT32 drvTicks; + UINT32 frameTicks; +}; + /* * CModel3Config: * @@ -327,6 +343,13 @@ public: */ void DumpTimings(void); + /* + * GetTimings(void): + * + * Returns timings for the most recent frame, for debugging purposes. + */ + FrameTimings GetTimings(void); + /* * CModel3(void): * ~CModel3(void): @@ -444,6 +467,9 @@ private: CMutex *notifyLock; CCondVar *notifySync; + // Frame timings + FrameTimings timings; + // Other devices CIRQ IRQ; // Model 3 IRQ controller CMPC10x PCIBridge; // MPC10x PCI/bridge/memory controller @@ -456,15 +482,6 @@ private: CSoundBoard SoundBoard; // Sound board CDSB *DSB; // Digital Sound Board (type determined dynamically at load time) CDriveBoard DriveBoard; // Drive board - - // Frame timings - UINT32 ppcTicks; - UINT32 syncSize; - UINT32 syncTicks; - UINT32 renderTicks; - UINT32 sndTicks; - UINT32 drvTicks; - UINT32 frameTicks; }; diff --git a/Src/OSD/SDL/SDLInputSystem.cpp b/Src/OSD/SDL/SDLInputSystem.cpp index 0807a34..02325e1 100644 --- a/Src/OSD/SDL/SDLInputSystem.cpp +++ b/Src/OSD/SDL/SDLInputSystem.cpp @@ -348,11 +348,6 @@ bool CSDLInputSystem::ProcessForceFeedbackCmd(int joyNum, int axisNum, ForceFeed return false; } -void CSDLInputSystem::Wait(int ms) -{ - SDL_Delay(ms); -} - int CSDLInputSystem::GetNumKeyboards() { // Return ANY_KEYBOARD as SDL 1.2 cannot handle multiple keyboards diff --git a/Src/OSD/SDL/SDLInputSystem.h b/Src/OSD/SDL/SDLInputSystem.h index 07fb301..2e15030 100644 --- a/Src/OSD/SDL/SDLInputSystem.h +++ b/Src/OSD/SDL/SDLInputSystem.h @@ -110,8 +110,6 @@ protected: bool ProcessForceFeedbackCmd(int joyNum, int axisNum, ForceFeedbackCmd ffCmd); - void Wait(int ms); - public: /* * Constructs an SDL input system. diff --git a/Src/OSD/Windows/DirectInputSystem.cpp b/Src/OSD/Windows/DirectInputSystem.cpp index 51ce15d..222285d 100644 --- a/Src/OSD/Windows/DirectInputSystem.cpp +++ b/Src/OSD/Windows/DirectInputSystem.cpp @@ -1961,11 +1961,6 @@ bool CDirectInputSystem::ProcessForceFeedbackCmd(int joyNum, int axisNum, ForceF } } -void CDirectInputSystem::Wait(int ms) -{ - Sleep(ms); -} - bool CDirectInputSystem::ConfigMouseCentered() { // When checking if mouse centered, use system cursor rather than raw values (otherwise user's mouse movements won't match up diff --git a/Src/OSD/Windows/DirectInputSystem.h b/Src/OSD/Windows/DirectInputSystem.h index a17c0aa..cd7876d 100644 --- a/Src/OSD/Windows/DirectInputSystem.h +++ b/Src/OSD/Windows/DirectInputSystem.h @@ -213,8 +213,6 @@ protected: bool ProcessForceFeedbackCmd(int joyNum, int axisNum, ForceFeedbackCmd ffCmd); - void Wait(int ms); - bool ConfigMouseCentered(); CInputSource *CreateAnyMouseSource(EMousePart msePart);