SNES Super Scope support (port 2 only). More...
Macros | |
| #define | SSC_CURSOR 0x4000 |
| #define | SSC_FIRE 0x8000 |
| #define | SSC_NOISE 0x0100 |
| #define | SSC_OFFSCREEN 0x0200 |
| #define | SSC_PAUSE 0x1000 |
| #define | SSC_TURBO 0x2000 |
Functions | |
| u16 | scopeButtonsHeld (void) |
| Buttons currently down — the same meaning as padHeld() and mouseButtonsHeld(). | |
| u16 | scopeButtonsPressed (void) |
| Get newly pressed buttons this frame. | |
| u16 | scopeButtonsRepeat (void) |
| Buttons held past the hold delay, re-triggering every repeat delay (see scopeSetRepeatDelay()) — a keyboard-style auto-repeat. | |
| void | scopeCalibrate (void) |
| Calibrate aim from a center-screen shot. | |
| u16 | scopeGetRawX (void) |
| Get raw (uncalibrated) H position from PPU. | |
| u16 | scopeGetRawY (void) |
| Get raw (uncalibrated) V position from PPU. | |
| u16 | scopeGetX (void) |
| Get calibration-adjusted H position. | |
| u16 | scopeGetY (void) |
| Get calibration-adjusted V position. | |
| u8 | scopeInit (void) |
| Detect Super Scope on port 2. | |
| u8 | scopeIsConnected (void) |
| Check if Super Scope is connected. | |
| void | scopeSetHoldDelay (u16 frames) |
| Set hold delay (frames before hold triggers). | |
| void | scopeSetRepeatDelay (u16 frames) |
| Set repeat delay (frames between repeat fires after hold). | |
| u16 | scopeSinceShot (void) |
| Get frames since last detected shot. | |
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.
| #define SSC_CURSOR 0x4000 |
Cursor button
| #define SSC_FIRE 0x8000 |
Fire button (trigger)
| #define SSC_NOISE 0x0100 |
Noise flag (no signal)
| #define SSC_OFFSCREEN 0x0200 |
Off-screen flag
| #define SSC_PAUSE 0x1000 |
Pause button
| #define SSC_TURBO 0x2000 |
Turbo switch
| u16 scopeButtonsHeld | ( | void | ) |
Buttons currently down — the same meaning as padHeld() and mouseButtonsHeld().
Until 2026-09-22 this name returned the auto-repeat mask (now scopeButtonsRepeat()) and "currently down" had a name ending in Down (removed 2026-10-05): the one word had the opposite meaning on the third device. A caller that wanted the repeat behaviour from this name must move to scopeButtonsRepeat().
| u16 scopeButtonsPressed | ( | void | ) |
Get newly pressed buttons this frame.
| u16 scopeButtonsRepeat | ( | void | ) |
Buttons held past the hold delay, re-triggering every repeat delay (see scopeSetRepeatDelay()) — a keyboard-style auto-repeat.
| void scopeCalibrate | ( | void | ) |
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.
| u16 scopeGetRawX | ( | void | ) |
Get raw (uncalibrated) H position from PPU.
| u16 scopeGetRawY | ( | void | ) |
Get raw (uncalibrated) V position from PPU.
| u16 scopeGetX | ( | void | ) |
Get calibration-adjusted H position.
| u16 scopeGetY | ( | void | ) |
Get calibration-adjusted V position.
| u8 scopeInit | ( | void | ) |
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).
| u8 scopeIsConnected | ( | void | ) |
Check if Super Scope is connected.
1 from a scopeInit() that found the Super Scope on port 2, until the NMI handler sees its signature disappear (unplugged); then 0 until the next scopeInit(). Unlike the mouse, a scope plugged in later is not detected on its own: call scopeInit() again.
| void scopeSetHoldDelay | ( | u16 | frames | ) |
Set hold delay (frames before hold triggers).
| frames | Number of frames (default: 60 = 1 second at 60Hz) |
| void scopeSetRepeatDelay | ( | u16 | frames | ) |
Set repeat delay (frames between repeat fires after hold).
| frames | Number of frames (default: 20) |
| u16 scopeSinceShot | ( | void | ) |
Get frames since last detected shot.