- --
Viewing Issue Advanced Details
ID | Category [?] | Severity [?] | Reproducibility | Date Submitted | Last Update |
---|---|---|---|---|---|
05872 | DIP/Input | Minor | Always | Mar 9, 2015, 00:35 | Sep 14, 2015, 22:12 |
Tester | enik | View Status | Public | Platform | MESS (Official Binary) |
Assigned To | Resolution | Fixed | OS | Windows XP | |
Status [?] | Resolved | Driver | |||
Version | 0.159 | Fixed in Version | 0.166 | Build | I686 |
Fixed in Git Commit | Github Pull Request # | ||||
Summary | 05872: sms, sms1 [alexbmx][megumi]: Incorrect behavior of the Sports Pad (US model) emulation | ||||
Description | Although the current emulation of the Sega Sports Pad (US model) works with the three games designed for the device, it shows incorrect behavior with at least two paddle games that are somewhat playable with that Sport Pad model (though used inverted, as left is right and right is left) on export (non-Japanese) SMS console versions. | ||||
Steps To Reproduce |
Try to play "Alex Kidd BMX Trial" on a non-Japanese SMS driver with the US Sports Pad: mess sms -ctrl1 sportspad alexbmx Compare with the behavior of a real Sports Pad in this YouTube video: "The Sega Sports Pad" (skip to 03:10) Try to play "Megumi Rescue" on a non-Japanese SMS driver with the US Sports Pad: mess sms -ctrl1 sportspad megumi Compare with the behavior of a real Sports Pad in this YouTube video: "Game Sack - Left in Japan 2" (skip to 07:29) |
||||
Additional Information |
This post on SMSPower states the trackball needs to be moved "slowly as any jerk would make the software for the paddle think it's moving backward": http://www.smspower.org/forums/14529-SportsPadControllerSomewhatUsableWithPaddleGames The post also states the US Sports Pad doesn't work on the Japanese SMS, what may be the case with the cartridges Sports Pad Football and World Soccer, but isn't the case with the cartridge Great Ice Hockey, that even had a Japanese format that was raffled by a magazine, along with a US Sports Pad, to owners of Japanese SMS. If my memory serves me well, Great Ice Hockey just use TH pin as output, that's why it has compatibility with the Jap SMS, that doesn't report TH input on port 0xDD. |
||||
Github Commit | |||||
Flags | |||||
Regression Version | |||||
Affected Sets / Systems | sms, sms1 [alexbmx][megumi] | ||||
Attached Files
|
sports.diff (5,819 bytes) Sep 13, 2015, 04:57 Uploaded by enik Patch that solves the issue. [Show Content] [Hide Content]diff -upr mess-git/src/emu/bus/sms_ctrl/sports.c mess-new/src/emu/bus/sms_ctrl/sports.c --- mess-git/src/emu/bus/sms_ctrl/sports.c 2015-09-12 22:45:26.000000000 -0300 +++ mess-new/src/emu/bus/sms_ctrl/sports.c 2015-09-13 01:33:14.000000000 -0300 @@ -6,6 +6,22 @@ **********************************************************************/ +// The games designed for the US model of the Sports Pad controller use the +// TH line of the controller port as output, to select which nibble, of the +// two axis bytes, will be read at a time. The Japanese cartridge Sports Pad +// Soccer uses a different mode, because the Sega Mark III lacks TH output, so +// there is a different Sports Pad model released in Japan (see sportsjp.c). + +// It was discovered that games designed for the Paddle Controller, released +// in Japan, switch to a mode incompatible with the original Paddle when +// detect the system region as Export. Similar to how the US model of the +// Sports Pad works, that mode uses the TH line as output to select which +// nibble of the X axis will be read. So, on an Export console version, paddle +// games are somewhat playable with the US Sport Pad model, though it needs to +// be used inverted and the trackball needs to be moved slowly, else the +// software for the paddle think it's moving backward. +// See http://mametesters.org/view.php?id=5872 for discussion. + #include "sports.h" @@ -16,32 +32,33 @@ const device_type SMS_SPORTS_PAD = &device_creator<sms_sports_pad_device>; - +// time interval not verified #define SPORTS_PAD_INTERVAL attotime::from_hz(XTAL_53_693175MHz/15/512) -CUSTOM_INPUT_MEMBER( sms_sports_pad_device::dir_pins_r ) +void sms_sports_pad_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - UINT8 data = 0; - - switch (m_read_state) + switch (id) { - case 0: - data = m_sports_x->read() >> 4; - break; - case 1: - data = m_sports_x->read(); - break; - case 2: - data = m_sports_y->read() >> 4; - break; - case 3: - data = m_sports_y->read(); + case TIMER_SPORTSPAD: + // values for x and y axis need to be resetted for Sports Pad games, but + // are not resetted for paddle games, so it was assumed the reset occurs + // only when this timer fires after the read state reached maximum value. + if (m_read_state == 3) + { + m_x_axis_reset_value = m_sports_x->read(); + m_y_axis_reset_value = m_sports_y->read(); + } + else + { + // set to maximum value, so it wraps to 0 at next increment + m_read_state = 3; + } + break; + default: + assert_always(FALSE, "Unknown id in sms_sports_pad_device::device_timer"); } - - // The returned value is inverted due to IP_ACTIVE_LOW mapping. - return ~(data & 0x0f); } @@ -53,18 +70,34 @@ CUSTOM_INPUT_MEMBER( sms_sports_pad_devi INPUT_CHANGED_MEMBER( sms_sports_pad_device::th_pin_w ) { - attotime cur_time = machine().time(); + m_read_state = (m_read_state + 1) & 3; + m_sportspad_timer->adjust(m_interval); + m_last_data = newval; +} - if (cur_time - m_last_time > m_interval) - { - m_read_state = 0; - } - else + +CUSTOM_INPUT_MEMBER( sms_sports_pad_device::dir_pins_r ) +{ + UINT8 data = 0; + + switch (m_read_state) { - m_read_state = (m_read_state + 1) & 3; + case 0: + data = (m_sports_x->read() - m_x_axis_reset_value) >> 4; + break; + case 1: + data = (m_sports_x->read() - m_x_axis_reset_value); + break; + case 2: + data = (m_sports_y->read() - m_y_axis_reset_value) >> 4; + break; + case 3: + data = (m_sports_y->read() - m_y_axis_reset_value); + break; } - m_last_time = cur_time; - m_last_data = newval; + + // The returned value is inverted due to IP_ACTIVE_LOW mapping. + return ~(data & 0x0f); } @@ -84,10 +117,10 @@ static INPUT_PORTS_START( sms_sports_pad PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) // TR (Button 2) PORT_START("SPORTS_X") /* Sports Pad X axis */ - PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(40) PORT_RESET PORT_REVERSE + PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(40) PORT_REVERSE PORT_START("SPORTS_Y") /* Sports Pad Y axis */ - PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(50) PORT_KEYDELTA(40) PORT_RESET PORT_REVERSE + PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(50) PORT_KEYDELTA(40) PORT_REVERSE INPUT_PORTS_END @@ -119,6 +152,8 @@ sms_sports_pad_device::sms_sports_pad_de m_sports_y(*this, "SPORTS_Y"), m_read_state(0), m_last_data(0), + m_x_axis_reset_value(0x80), // value 0x80 helps when start playing paddle games. + m_y_axis_reset_value(0x80), m_interval(SPORTS_PAD_INTERVAL) { } @@ -130,11 +165,12 @@ sms_sports_pad_device::sms_sports_pad_de void sms_sports_pad_device::device_start() { - m_last_time = machine().time(); + m_sportspad_timer = timer_alloc(TIMER_SPORTSPAD); save_item(NAME(m_read_state)); save_item(NAME(m_last_data)); - save_item(NAME(m_last_time)); + save_item(NAME(m_x_axis_reset_value)); + save_item(NAME(m_y_axis_reset_value)); } diff -upr mess-git/src/emu/bus/sms_ctrl/sports.h mess-new/src/emu/bus/sms_ctrl/sports.h --- mess-git/src/emu/bus/sms_ctrl/sports.h 2015-09-12 22:45:40.000000000 -0300 +++ mess-new/src/emu/bus/sms_ctrl/sports.h 2015-09-12 23:15:54.000000000 -0300 @@ -53,8 +53,13 @@ private: UINT8 m_read_state; UINT8 m_last_data; + UINT8 m_x_axis_reset_value; + UINT8 m_y_axis_reset_value; const attotime m_interval; - attotime m_last_time; + emu_timer *m_sportspad_timer; + static const device_timer_id TIMER_SPORTSPAD = 0; + + void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); }; | ||||
Relationships
There are no relationship linked to this issue. |
Notes
2
No.12021
enik Tester
Sep 13, 2015, 05:02
edited on: Jun 1, 2016, 03:11 |
I attached a patch that solves the issue. Please, commit it to the git tree. Also, please commit the two other patches I sent two weeks ago to mamedev.org. -- Enik |
---|---|
No.12025
Tafoid Administrator
Sep 14, 2015, 22:12
|
Fixed by Enik Land. Diff applied to source September 14, 2015, combined with other pending patches: https://github.com/mamedev/mame/commit/249d8f752cd1e4fe12e7212d29138c6058f5c3ba |