SNES Super Scope support (port 2 only).
More...
SNES Super Scope support (port 2 only).
The Super Scope is a light gun that uses the PPU H/V counter latch to determine aim position. It provides 4 buttons and 2 status flags.
Usage
}
while (1) {
}
}
void WaitForVBlank(void)
Wait for next VBlank period.
unsigned short u16
16-bit unsigned integer (0 to 65535)
Definition types.h:53
◆ SSC_CURSOR
| #define SSC_CURSOR 0x4000 |
◆ SSC_FIRE
◆ SSC_NOISE
◆ SSC_OFFSCREEN
| #define SSC_OFFSCREEN 0x0200 |
◆ SSC_PAUSE
◆ SSC_TURBO
◆ scopeButtonsDown()
| u16 scopeButtonsDown |
( |
void | | ) |
|
Get currently held buttons.
- Returns
- Button mask (SSC_FIRE, SSC_CURSOR, SSC_TURBO, SSC_PAUSE, SSC_OFFSCREEN, SSC_NOISE)
◆ scopeButtonsHeld()
| u16 scopeButtonsHeld |
( |
void | | ) |
|
Get buttons held past the hold delay threshold.
After holding a button for holddelay frames, it triggers as "held". Then it re-triggers every repdelay frames.
- Returns
- Button mask of held buttons
◆ scopeButtonsPressed()
| u16 scopeButtonsPressed |
( |
void | | ) |
|
Get newly pressed buttons this frame.
- Returns
- Button mask of buttons pressed this frame (edge detection)
◆ scopeCalibrate()
| void scopeCalibrate |
( |
void | | ) |
|
|
inline |
◆ scopeGetRawX()
| u16 scopeGetRawX |
( |
void | | ) |
|
Get raw (uncalibrated) H position from PPU.
- Returns
- Raw X coordinate from PPU H counter
◆ scopeGetRawY()
| u16 scopeGetRawY |
( |
void | | ) |
|
Get raw (uncalibrated) V position from PPU.
- Returns
- Raw Y coordinate from PPU V counter
◆ scopeGetX()
Get calibration-adjusted H position.
- Returns
- Adjusted X coordinate (0-255 visible range)
◆ scopeGetY()
Get calibration-adjusted V position.
- Returns
- Adjusted Y coordinate (0-223 visible range)
◆ scopeInit()
Detect Super Scope on port 2.
Checks the auto-joypad device signature on port 2. If a Super Scope is found, enables reading in the NMI handler and sets default hold/repeat delays (60/20 frames).
- Returns
- 1 if Super Scope detected, 0 if not
◆ scopeIsConnected()
| u8 scopeIsConnected |
( |
void | | ) |
|
Check if Super Scope is connected.
- Returns
- 1 if connected, 0 if not
◆ scopeSetHoldDelay()
| void scopeSetHoldDelay |
( |
u16 | frames | ) |
|
|
inline |
◆ scopeSetRepeatDelay()
| void scopeSetRepeatDelay |
( |
u16 | frames | ) |
|
Set repeat delay (frames between repeat fires after hold).
- Parameters
-
| frames | Number of frames (default: 20) |
◆ scopeSinceShot()
| u16 scopeSinceShot |
( |
void | | ) |
|
Get frames since last detected shot.
- Returns
- Number of frames since last PPU latch (shot detection)
◆ scope_centerh
◆ scope_centerv
◆ scope_holddelay
Set hold delay (frames before hold triggers).
- Parameters
-
| frames | Number of frames (default: 60 = 1 second at 60Hz) Inlined for zero-call-overhead access. |
◆ scope_shothraw
Calibrate aim from a center-screen shot.
Call this after the user fires at the center of the screen (128, 112). Computes calibration offsets: centerh = 128 - rawX, centerv = 112 - rawY. The NMI handler applies these offsets to all subsequent readings.
Inlined for zero-call-overhead access.
◆ scope_shotvraw