mirror of https://github.com/stella-emu/stella.git
first attempt of implementing light gun support for Libretro
This commit is contained in:
parent
096f2434c0
commit
ce3fdec7c1
|
@ -55,7 +55,7 @@ Lightgun::Lightgun(Jack jack, const Event& event, const System& system,
|
|||
else if (romMd5 == "2559948f39b91682934ea99d90ede631" ||
|
||||
romMd5 == "e75ab446017448045b152eea78bf7910")
|
||||
{
|
||||
// Booby is Hungry
|
||||
// Bobby is Hungry
|
||||
myOfsX = -21;
|
||||
myOfsY = 5;
|
||||
}
|
||||
|
|
|
@ -126,6 +126,13 @@ int32_t input_bitmask[4];
|
|||
EVENT(Event::LeftJoystickFire9, pad, RETRO_DEVICE_ID_JOYPAD_Y);
|
||||
break;
|
||||
|
||||
case Controller::Type::Lightgun:
|
||||
EVENT(Event::MouseAxisXValue, input_state_cb(pad, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_SCREEN_X));
|
||||
EVENT(Event::MouseAxisYValue, input_state_cb(pad, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_SCREEN_Y));
|
||||
EVENT(Event::MouseButtonLeftValue, input_state_cb(pad, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_TRIGGER));
|
||||
EVENT(Event::MouseButtonRightValue, input_state_cb(pad, RETRO_DEVICE_LIGHTGUN, 0, RETRO_DEVICE_ID_LIGHTGUN_TRIGGER));
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -574,6 +581,10 @@ bool retro_load_game(const struct retro_game_info *info)
|
|||
{ 3, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT, "Right" },
|
||||
{ 3, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B, "Fire" },
|
||||
|
||||
{ 0, RETRO_DEVICE_POINTER, 0, RETRO_DEVICE_ID_POINTER_X, "Pointer X" },
|
||||
{ 0, RETRO_DEVICE_POINTER, 0, RETRO_DEVICE_ID_POINTER_Y, "Pointer Y" },
|
||||
{ 0, RETRO_DEVICE_POINTER, 0, RETRO_DEVICE_ID_POINTER_PRESSED, "Pointer Button" },
|
||||
|
||||
{ 0, 0, 0, 0, NULL },
|
||||
};
|
||||
|
||||
|
|
|
@ -199,7 +199,7 @@ extern "C" {
|
|||
#define RETRO_DEVICE_ID_JOYPAD_R2 13
|
||||
#define RETRO_DEVICE_ID_JOYPAD_L3 14
|
||||
#define RETRO_DEVICE_ID_JOYPAD_R3 15
|
||||
#define RETRO_DEVICE_ID_JOYPAD_MASK 256
|
||||
#define RETRO_DEVICE_ID_JOYPAD_MASK 256
|
||||
|
||||
/* Index / Id values for ANALOG device. */
|
||||
#define RETRO_DEVICE_INDEX_ANALOG_LEFT 0
|
||||
|
@ -969,46 +969,46 @@ enum retro_mod
|
|||
* It is recomended to do so in retro_set_environment */
|
||||
|
||||
#define RETRO_ENVIRONMENT_GET_AUDIO_VIDEO_ENABLE (47 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
||||
/* int * --
|
||||
* Tells the core if the frontend wants audio or video.
|
||||
* If disabled, the frontend will discard the audio or video,
|
||||
* so the core may decide to skip generating a frame or generating audio.
|
||||
* This is mainly used for increasing performance.
|
||||
* Bit 0 (value 1): Enable Video
|
||||
* Bit 1 (value 2): Enable Audio
|
||||
* Bit 2 (value 4): Use Fast Savestates.
|
||||
* Bit 3 (value 8): Hard Disable Audio
|
||||
* Other bits are reserved for future use and will default to zero.
|
||||
* If video is disabled:
|
||||
* * The frontend wants the core to not generate any video,
|
||||
* including presenting frames via hardware acceleration.
|
||||
* * The frontend's video frame callback will do nothing.
|
||||
* * After running the frame, the video output of the next frame should be
|
||||
* no different than if video was enabled, and saving and loading state
|
||||
* should have no issues.
|
||||
* If audio is disabled:
|
||||
* * The frontend wants the core to not generate any audio.
|
||||
* * The frontend's audio callbacks will do nothing.
|
||||
* * After running the frame, the audio output of the next frame should be
|
||||
* no different than if audio was enabled, and saving and loading state
|
||||
* should have no issues.
|
||||
* Fast Savestates:
|
||||
* * Guaranteed to be created by the same binary that will load them.
|
||||
* * Will not be written to or read from the disk.
|
||||
* * Suggest that the core assumes loading state will succeed.
|
||||
* * Suggest that the core updates its memory buffers in-place if possible.
|
||||
* * Suggest that the core skips clearing memory.
|
||||
* * Suggest that the core skips resetting the system.
|
||||
* * Suggest that the core may skip validation steps.
|
||||
* Hard Disable Audio:
|
||||
* * Used for a secondary core when running ahead.
|
||||
* * Indicates that the frontend will never need audio from the core.
|
||||
* * Suggests that the core may stop synthesizing audio, but this should not
|
||||
* compromise emulation accuracy.
|
||||
* * Audio output for the next frame does not matter, and the frontend will
|
||||
* never need an accurate audio state in the future.
|
||||
* * State will never be saved when using Hard Disable Audio.
|
||||
*/
|
||||
/* int * --
|
||||
* Tells the core if the frontend wants audio or video.
|
||||
* If disabled, the frontend will discard the audio or video,
|
||||
* so the core may decide to skip generating a frame or generating audio.
|
||||
* This is mainly used for increasing performance.
|
||||
* Bit 0 (value 1): Enable Video
|
||||
* Bit 1 (value 2): Enable Audio
|
||||
* Bit 2 (value 4): Use Fast Savestates.
|
||||
* Bit 3 (value 8): Hard Disable Audio
|
||||
* Other bits are reserved for future use and will default to zero.
|
||||
* If video is disabled:
|
||||
* * The frontend wants the core to not generate any video,
|
||||
* including presenting frames via hardware acceleration.
|
||||
* * The frontend's video frame callback will do nothing.
|
||||
* * After running the frame, the video output of the next frame should be
|
||||
* no different than if video was enabled, and saving and loading state
|
||||
* should have no issues.
|
||||
* If audio is disabled:
|
||||
* * The frontend wants the core to not generate any audio.
|
||||
* * The frontend's audio callbacks will do nothing.
|
||||
* * After running the frame, the audio output of the next frame should be
|
||||
* no different than if audio was enabled, and saving and loading state
|
||||
* should have no issues.
|
||||
* Fast Savestates:
|
||||
* * Guaranteed to be created by the same binary that will load them.
|
||||
* * Will not be written to or read from the disk.
|
||||
* * Suggest that the core assumes loading state will succeed.
|
||||
* * Suggest that the core updates its memory buffers in-place if possible.
|
||||
* * Suggest that the core skips clearing memory.
|
||||
* * Suggest that the core skips resetting the system.
|
||||
* * Suggest that the core may skip validation steps.
|
||||
* Hard Disable Audio:
|
||||
* * Used for a secondary core when running ahead.
|
||||
* * Indicates that the frontend will never need audio from the core.
|
||||
* * Suggests that the core may stop synthesizing audio, but this should not
|
||||
* compromise emulation accuracy.
|
||||
* * Audio output for the next frame does not matter, and the frontend will
|
||||
* never need an accurate audio state in the future.
|
||||
* * State will never be saved when using Hard Disable Audio.
|
||||
*/
|
||||
#define RETRO_ENVIRONMENT_GET_INPUT_BITMASKS 51
|
||||
|
||||
/* VFS functionality */
|
||||
|
@ -1099,17 +1099,17 @@ typedef int (RETRO_CALLCONV *retro_vfs_rename_t)(const char *old_path, const cha
|
|||
|
||||
struct retro_vfs_interface
|
||||
{
|
||||
retro_vfs_get_path_t get_path;
|
||||
retro_vfs_open_t open;
|
||||
retro_vfs_close_t close;
|
||||
retro_vfs_size_t size;
|
||||
retro_vfs_tell_t tell;
|
||||
retro_vfs_seek_t seek;
|
||||
retro_vfs_read_t read;
|
||||
retro_vfs_write_t write;
|
||||
retro_vfs_flush_t flush;
|
||||
retro_vfs_remove_t remove;
|
||||
retro_vfs_rename_t rename;
|
||||
retro_vfs_get_path_t get_path;
|
||||
retro_vfs_open_t open;
|
||||
retro_vfs_close_t close;
|
||||
retro_vfs_size_t size;
|
||||
retro_vfs_tell_t tell;
|
||||
retro_vfs_seek_t seek;
|
||||
retro_vfs_read_t read;
|
||||
retro_vfs_write_t write;
|
||||
retro_vfs_flush_t flush;
|
||||
retro_vfs_remove_t remove;
|
||||
retro_vfs_rename_t rename;
|
||||
};
|
||||
|
||||
struct retro_vfs_interface_info
|
||||
|
|
Loading…
Reference in New Issue