MAMEWorld >> EmuChat
View all threads Index   Flat Mode Flat  

StormedBubbles
MAME Fan
Reged: 12/17/21
Posts: 1
Send PM
Musings on cursor offsets for invasnab, blueshrk, and maybe others
05/25/22 12:17 AM


Hello,

I have some thoughts about some games that use MAME's crosshair system. I figured I'd share in case anyone with a better working knowledge of the code wants to adapt to upstream MAME if there is any benefit to the user.

I noticed that invasnab (Invasion: The Abductors) has a constant cursor offset for both players and no way to calibrate in game. Based on some calculations from screen shots, the offset appears to be about 1.27% in the X direction and 3.54% in the Y direction. In a local build of MAME, editing midzeus.cpp's lightgun formula as follows gives great alignment:


Code:

gun_x[player] = ioport(names[player][0])->read() * visarea.width() / 255 + (0.0127 * visarea.width()) + visarea.min_x + BEAM_XOFFS;
gun_y[player] = ioport(names[player][1])->read() * visarea.height() / 255 + (0.0354 * visarea.height()) + visarea.min_y;



This is just empirical evidence, so I hope it points someone in the right direction if something is slightly off or if I edited the wrong part of the code. invasnab also currently only allows users to reload by firing at the right edge of the screen. I do not know how to fix that, but when using the RetroArch container, I am able to force the cursor to be on the right edge whenever it reaches a min/max value. This is a workaround until the actual issue is resolved.

I also took a look at blueshrk (Blue Shark). The current MAME min/max values for that game appear to reflect the calibration menu's bounds. I believe the calibration menu was just a guide on real hardware and required the operator to physically manipulate the gun mounted on the paddle accordingly. MAME has an optional cursor for convenience for this game so that users can actually see where they're shooting, but it moves at a different rate than the in-game aim. Better alignment can be attained by editing the crosshair behavior in mw8080bw.cpp:


Code:

PORT_CROSSHAIR(X, 0.94, 0.0285, 0.139)



However, I'm trying to play this game with a lightgun. I know that it isn't a lightgun game, but switching the paddle controls over to the GUNCODE axis works pretty well. The issue with the adjusted crosshair is that the gun maintains the old aim, i.e., the crosshair and harpoons line up, but the gun sight (i.e., the system mouse cursor) is misaligned. I can account for this by restoring the original crosshair behavior and instead making this change:


Code:

PORT_MINMAX(0x04,0x86)



With the above min/max values, a lightgun device works very well. Alignment is near-perfect, but this is definitely the incorrect range of values for this game. Shots too far to the left will behave strangely. Regardless, even better alignment could be attained by using decimal values for min/max instead of whole-number hex values. I believe the difference between the max and the min must be exactly 130 (in base 10) in order for the default cursor and the in-game aim to have the same rate of movement. Both the min and max would need to be bumped up by 0.545 in order for more exact alignment to be achieved.

Anywho, thanks for reading. I just wanted to put this info out there in case anyone thinks it could be beneficial to users. There's a few other games I'm interested in looking at. ppsatan is one that interests me, so I may have some comments about that one in the near future.







Entire thread
Subject Posted by Posted on
* Musings on cursor offsets for invasnab, blueshrk, and maybe others StormedBubbles 05/25/22 12:17 AM

Extra information Permissions
Moderator:  Robbbert, Tafoid 
0 registered and 167 anonymous users are browsing this forum.
You cannot start new topics
You cannot reply to topics
HTML is enabled
UBBCode is enabled
Thread views: 208