pax_global_header00006660000000000000000000000064152215312310014505gustar00rootroot0000000000000052 comment=43af3ed5bf6e4c97da4f564f3ef0626796b352ef jg-2.0.0-43af3ed5bf6e4c97da4f564f3ef0626796b352ef/000077500000000000000000000000001522153123100177275ustar00rootroot00000000000000jg-2.0.0-43af3ed5bf6e4c97da4f564f3ef0626796b352ef/ChangeLog000066400000000000000000000015711522153123100215050ustar00rootroot00000000000000Version 2.0.0 ------------- - Add jg_api_version() so cores can report the API version they were built against - Add JG_VERSION_NUMBER and JG_VERSION_NAME macros - Add a userdata pointer argument to jg_cb_audio_t, jg_cb_frametime_t, and jg_cb_rumble_t callbacks - Add jg_systeminfo_t and jg_get_systemlist() for querying supported systems - Add jg_biosinfo_t and jg_get_bioslist() for BIOS/firmware requirements - Add jg_mediainfo_t and jg_get_mediainfo() for querying media state - Add jg_media_set() and jg_media_mount(); deprecate jg_media_select() and jg_media_insert(), to be removed in API version >= 2.1.0 - Add jg_get_inputlist() to return the full list of supported input devices - Add jg_get_dips() for per-game DIP switch settings - Add JG_HINT_CHEATS hint flag - Add firstboot reset mode to jg_reset() Version 1.0.0 ------------- - Initial tagged release jg-2.0.0-43af3ed5bf6e4c97da4f564f3ef0626796b352ef/LICENSE000066400000000000000000000015541522153123100207410ustar00rootroot00000000000000zlib License Copyright (c) 2020-2022 Rupert Carmichael This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. jg-2.0.0-43af3ed5bf6e4c97da4f564f3ef0626796b352ef/Makefile000066400000000000000000000046001522153123100213670ustar00rootroot00000000000000PREFIX ?= /usr/local DATAROOTDIR ?= $(PREFIX)/share DOCDIR ?= $(DATAROOTDIR)/doc/jg INCLUDEDIR ?= $(PREFIX)/include SOURCEDIR := $(abspath $(patsubst %/,%,$(dir $(abspath $(lastword \ $(MAKEFILE_LIST)))))) PKGCONFINCDIR := $(shell $(SOURCEDIR)/pkgconf.sh "$(PREFIX)" "$(INCLUDEDIR)") .PHONY: all install uninstall all: @echo "Please use the install or uninstall target" install: @mkdir -p $(DESTDIR)$(INCLUDEDIR)/jg @mkdir -p $(DESTDIR)$(DATAROOTDIR)/pkgconfig @mkdir -p $(DESTDIR)$(DOCDIR) cp $(SOURCEDIR)/jg.h $(DESTDIR)$(INCLUDEDIR)/jg/ cp $(SOURCEDIR)/jg_2600.h $(DESTDIR)$(INCLUDEDIR)/jg/ cp $(SOURCEDIR)/jg_5200.h $(DESTDIR)$(INCLUDEDIR)/jg/ cp $(SOURCEDIR)/jg_7800.h $(DESTDIR)$(INCLUDEDIR)/jg/ cp $(SOURCEDIR)/jg_coleco.h $(DESTDIR)$(INCLUDEDIR)/jg/ cp $(SOURCEDIR)/jg_crvision.h $(DESTDIR)$(INCLUDEDIR)/jg/ cp $(SOURCEDIR)/jg_gb.h $(DESTDIR)$(INCLUDEDIR)/jg/ cp $(SOURCEDIR)/jg_gba.h $(DESTDIR)$(INCLUDEDIR)/jg/ cp $(SOURCEDIR)/jg_gg.h $(DESTDIR)$(INCLUDEDIR)/jg/ cp $(SOURCEDIR)/jg_intv.h $(DESTDIR)$(INCLUDEDIR)/jg/ cp $(SOURCEDIR)/jg_jag.h $(DESTDIR)$(INCLUDEDIR)/jg/ cp $(SOURCEDIR)/jg_lynx.h $(DESTDIR)$(INCLUDEDIR)/jg/ cp $(SOURCEDIR)/jg_md.h $(DESTDIR)$(INCLUDEDIR)/jg/ cp $(SOURCEDIR)/jg_myvision.h $(DESTDIR)$(INCLUDEDIR)/jg/ cp $(SOURCEDIR)/jg_n64.h $(DESTDIR)$(INCLUDEDIR)/jg/ cp $(SOURCEDIR)/jg_neogeo.h $(DESTDIR)$(INCLUDEDIR)/jg/ cp $(SOURCEDIR)/jg_nds.h $(DESTDIR)$(INCLUDEDIR)/jg/ cp $(SOURCEDIR)/jg_nes.h $(DESTDIR)$(INCLUDEDIR)/jg/ cp $(SOURCEDIR)/jg_ngp.h $(DESTDIR)$(INCLUDEDIR)/jg/ cp $(SOURCEDIR)/jg_pce.h $(DESTDIR)$(INCLUDEDIR)/jg/ cp $(SOURCEDIR)/jg_pcfx.h $(DESTDIR)$(INCLUDEDIR)/jg/ cp $(SOURCEDIR)/jg_psx.h $(DESTDIR)$(INCLUDEDIR)/jg/ cp $(SOURCEDIR)/jg_sms.h $(DESTDIR)$(INCLUDEDIR)/jg/ cp $(SOURCEDIR)/jg_snes.h $(DESTDIR)$(INCLUDEDIR)/jg/ cp $(SOURCEDIR)/jg_ss.h $(DESTDIR)$(INCLUDEDIR)/jg/ cp $(SOURCEDIR)/jg_vb.h $(DESTDIR)$(INCLUDEDIR)/jg/ cp $(SOURCEDIR)/jg_vectrex.h $(DESTDIR)$(INCLUDEDIR)/jg/ cp $(SOURCEDIR)/jg_wswan.h $(DESTDIR)$(INCLUDEDIR)/jg/ cp $(SOURCEDIR)/ChangeLog $(DESTDIR)$(DOCDIR) cp $(SOURCEDIR)/LICENSE $(DESTDIR)$(DOCDIR) cp $(SOURCEDIR)/README $(DESTDIR)$(DOCDIR) sed -e 's|@PREFIX@|$(PREFIX)|' -e 's|@INCLUDEDIR@|$(PKGCONFINCDIR)|' \ $(SOURCEDIR)/jg.pc.in > $(DESTDIR)$(DATAROOTDIR)/pkgconfig/jg.pc uninstall: rm -rf $(DESTDIR)$(INCLUDEDIR)/jg/ rm -rf $(DESTDIR)$(DOCDIR) rm -f $(DESTDIR)$(DATAROOTDIR)/pkgconfig/jg.pc jg-2.0.0-43af3ed5bf6e4c97da4f564f3ef0626796b352ef/README000066400000000000000000000012111522153123100206020ustar00rootroot00000000000000The Jolly Good API ------------------ The Jolly Good API is a shared object or "plugin" API for emulators. Example code may be found in "example.c" This repository lives at https://gitlab.com/jgemu/jg Installation ------------ Options: PREFIX - Override default installation prefix DATAROOTDIR - Override default data root directory DOCDIR - Override default documentation directory INCLUDEDIR - Override default include directory Linux: make install macOS: make install BSD: gmake install Windows (MSYS2): make install Copyright --------- The Jolly Good API (Zlib) Copyright (c) 2020-2022, Rupert Carmichael See LICENSE jg-2.0.0-43af3ed5bf6e4c97da4f564f3ef0626796b352ef/example.c000066400000000000000000000100761522153123100215320ustar00rootroot00000000000000/* Copyright (c) 2020-2026 Rupert Carmichael Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include #include #include #include //#include #define SAMPLERATE 48000 #define FRAMERATE 60 #define CHANNELS 2 #define NUMINPUTS 2 static jg_cb_audio_t jg_cb_audio; static void *jg_cb_audio_udata; static jg_cb_frametime_t jg_cb_frametime; static void *jg_cb_frametime_udata; static jg_cb_log_t jg_cb_log; static jg_cb_rumble_t jg_cb_rumble; static void *jg_cb_rumble_udata; static jg_coreinfo_t coreinfo = { "name", "Full Name", "0.0", "system", NUMINPUTS, 0x00 }; static jg_videoinfo_t vidinfo = { JG_PIXFMT_XRGB8888, // pixfmt 256, // wmax 240, // hmax 256, // w 240, // h 0, // x 0, // y 256, // p 256.0/240.0, // aspect NULL // buf }; static jg_audioinfo_t audinfo = { JG_SAMPFMT_INT16, SAMPLERATE, CHANNELS, (SAMPLERATE / FRAMERATE) * CHANNELS, NULL }; static jg_pathinfo_t pathinfo; static jg_fileinfo_t gameinfo; static jg_inputinfo_t inputinfo[NUMINPUTS]; static jg_inputstate_t *input_device[NUMINPUTS]; void jg_set_cb_audio(jg_cb_audio_t func, void *udata) { jg_cb_audio = func; jg_cb_audio_udata = udata; } void jg_set_cb_frametime(jg_cb_frametime_t func, void *udata) { jg_cb_frametime = func; jg_cb_frametime_udata = udata; } void jg_set_cb_log(jg_cb_log_t func) { jg_cb_log = func; } void jg_set_cb_rumble(jg_cb_rumble_t func, void *udata) { jg_cb_rumble = func; jg_cb_rumble_udata = udata; } unsigned jg_api_version(void) { return JG_VERSION_NUMBER; } int jg_init(void) { return 1; } void jg_deinit(void) { } void jg_reset(int hard) { } void jg_exec_frame(void) { } int jg_game_load(void) { return 1; } int jg_game_unload(void) { return 1; } int jg_state_load(const char *filename) { return 0; } void jg_state_load_raw(const void *data) { } int jg_state_save(const char *filename) { return 0; } const void* jg_state_save_raw(void) { return NULL; } size_t jg_state_size(void) { return 0; } void jg_media_set(unsigned index) { } void jg_media_mount(unsigned state) { } void jg_cheat_clear(void) { } void jg_cheat_set(const char *code) { } void jg_rehash(void) { } void jg_data_push(uint32_t type, int port, const void *ptr, size_t size) { } jg_systeminfo_t* jg_get_systemlist(size_t *num) { *num = 0; return NULL; } jg_coreinfo_t* jg_get_coreinfo(const char *sys) { return &coreinfo; } jg_biosinfo_t* jg_get_bioslist(size_t *num) { *num = 0; return NULL; } jg_videoinfo_t* jg_get_videoinfo(void) { return &vidinfo; } jg_audioinfo_t* jg_get_audioinfo(void) { return &audinfo; } jg_inputinfo_t* jg_get_inputinfo(int port) { return &inputinfo[port]; } jg_inputinfo_t* jg_get_inputlist(size_t *num) { *num = 0; return NULL; } jg_setting_t* jg_get_settings(size_t *numsettings) { *numsettings = 0; return NULL; } jg_setting_t* jg_get_dips(size_t *num) { *num = 0; return NULL; } jg_mediainfo_t* jg_get_mediainfo(void) { return NULL; } void jg_setup_video(void) { } void jg_setup_audio(void) { } void jg_set_inputstate(jg_inputstate_t *ptr, int port) { input_device[port] = ptr; } void jg_set_gameinfo(jg_fileinfo_t info) { gameinfo = info; } void jg_set_auxinfo(jg_fileinfo_t info, int index) { } void jg_set_paths(jg_pathinfo_t paths) { pathinfo = paths; } jg-2.0.0-43af3ed5bf6e4c97da4f564f3ef0626796b352ef/jg.h000066400000000000000000000415251522153123100205070ustar00rootroot00000000000000/* zlib License Copyright (c) 2020-2026 Rupert Carmichael This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef JG_H #define JG_H #ifdef __cplusplus #include #if __cplusplus >= 201103L #include #else #include #endif extern "C" { #else #include #include #endif // Semantic Versioning #define JG_VERSION_MAJOR 2 #define JG_VERSION_MINOR 0 #define JG_VERSION_PATCH 0 /** * The Jolly Good API Version number is made up of the patch version, added to * 100 times the minor version, added to 10000 times the major version. For * example, the JG_VERSION_NUMBER for 2.6.3 would be 20603. */ #define JG_VERSION_NUMBER (JG_VERSION_PATCH + (JG_VERSION_MINOR * 100) + \ (JG_VERSION_MAJOR * 10000)) #define JG_VERSION_NAME "The Jolly Good API 2.0.0" // Enums enum jg_datatype { JG_DATA_RAW, /**< Raw data */ JG_DATA_AUDIO, /**< Audio samples */ JG_DATA_VIDEO /**< Static or streaming visual data */ }; enum jg_hints { JG_HINT_AUDIO_INTERNAL = 0x00000001, /**< Core internally allocates audio buffer */ JG_HINT_VIDEO_INTERNAL = 0x00000002, /**< Core internally allocates video buffer */ JG_HINT_VIDEO_FLIP_H = 0x00000004, /**< Screen flipped horizontally */ JG_HINT_VIDEO_FLIP_V = 0x00000008, /**< Screen flipped vertically */ JG_HINT_VIDEO_ROTATE_L = 0x00000010, /**< Screen rotated 90 degrees left */ JG_HINT_VIDEO_ROTATE_R = 0x00000020, /**< Screen rotated 90 degrees right */ JG_HINT_VIDEO_PRESCALED = 0x00000040, /**< Video internally scaled by core */ JG_HINT_MEDIA_ARCHIVED = 0x00000080, /**< Core uses archived/compressed content */ JG_HINT_INPUT_AUDIO = 0x00000100, /**< Core supports audio input (microphone) */ JG_HINT_INPUT_VIDEO = 0x00000200, /**< Core supports visual input (camera, scanner) */ JG_HINT_CHEATS = 0x00000400 /**< Core supports cheats */ }; enum jg_inputtype { JG_INPUT_CONTROLLER, /**< Emulated Controller or Gamepad input type */ JG_INPUT_GUN, /**< Emulated Light Gun input type */ JG_INPUT_KEYBOARD, /**< Emulated Keyboard input type */ JG_INPUT_POINTER, /**< Emulated Pointer input type: mice, trackballs, drawing tablets, light sensors */ JG_INPUT_SPINNER, /**< Emulated Spinner input type */ JG_INPUT_TOUCH, /**< Emulated Touchscreen or Touchpad input type */ JG_INPUT_EXTERNAL /**< Emulated External input type: Coin slots, system/hardware buttons */ }; enum jg_loglevel { JG_LOG_DBG, /**< Debug: verbose logging */ JG_LOG_INF, /**< Info: general purpose logging */ JG_LOG_WRN, /**< Warning: warnings about non-critical errors */ JG_LOG_ERR, /**< Error: critical errors requiring program exit */ JG_LOG_SCR /**< Screen: log to on-screen display */ }; enum jg_pixfmt { JG_PIXFMT_XRGB8888, /**< 32-bit pixels with bits 24-31 unused, bits 16-23 for Red, bits 8-15 for Green, and bits 0-7 for Blue */ JG_PIXFMT_XBGR8888, /**< 32-bit pixels with bits 24-31 unused, bits 16-23 for Blue, bits 8-15 for Green, and bits 0-7 for Red */ JG_PIXFMT_RGBX5551, /**< 16-bit pixels with bits 11-15 for Red, bits 6-10 for Green, bits 1-5 for Blue, and bit 0 unused */ JG_PIXFMT_RGB565 /**< 16-bit pixels with bits 11-15 for Red, bits 5-10 for Green, and bits 0-4 for Blue */ }; enum jg_sampfmt { JG_SAMPFMT_INT16, /**< 16-bit Signed Integer audio samples */ JG_SAMPFMT_FLT32 /**< 32-bit Floating Point audio samples */ }; enum jg_settingflag { JG_SETTING_RESTART = 0x01, /**< Restart Required */ JG_SETTING_INPUT = 0x02 /**< Setting changes an input device */ }; // Typedefs typedef struct _jg_systeminfo_t { const char *name; /**< System name e.g. "coleco" */ const char *fname; /**< Full name e.g. "ColecoVision" */ const char *ext; /**< Comma-separated extensions e.g. "col,rom" */ } jg_systeminfo_t; typedef struct _jg_coreinfo_t { const char *name; /**< Short Name of the core e.g. "corename" */ const char *fname; /**< Full Name of the core e.g. "Core Name" */ const char *version; /**< Version e.g. "1.0 WIP" */ const char *sys; /**< System being emulated e.g. "sms" */ uint8_t numinputs; /**< Number of Ports/Inputs */ uint32_t hints; /**< Hints set for this core */ } jg_coreinfo_t; typedef struct _jg_biosinfo_t { const char *fname; /**< Expected filename e.g. "neogeo.zip" */ const char *desc; /**< Description e.g. "Neo Geo MVS BIOS" */ const char *md5; /**< Expected MD5 checksum */ unsigned required; /**< 0 = Optional, 1 = Required: Required means required for basic functionality, while Optional enables specific games or features */ unsigned group; /**< Group ID for interchangeable alternatives, 0 = standalone (no alternatives) */ } jg_biosinfo_t; typedef struct _jg_mediainfo_t { const char *name; /**< Media type label e.g. "Disc", "Side" */ unsigned count; /**< Total number of selectable media */ unsigned index; /**< Currently selected media (0 to count - 1) */ unsigned inserted; /**< 0 = ejected/removed, 1 = inserted/loaded */ } jg_mediainfo_t; typedef struct _jg_pathinfo_t { const char *base; /**< Base user directory from which all other paths begin */ const char *core; /**< Core asset path: for external support files required for normal core operation, typically distributed with the core */ const char *user; /**< User asset path: for external support files not required for normal core operation, typically optional audio/graphics/etc */ const char *bios; /**< BIOS directory: where BIOS or firmware files are located */ const char *save; /**< Save directory: where SRAM, Memory Card, Real Time Clock, or other non-volatile data is saved */ } jg_pathinfo_t; typedef struct _jg_fileinfo_t { void *data; /**< Pointer to the file data */ size_t size; /**< Size of the file data in bytes */ uint32_t crc; /**< CRC32 Checksum */ const char *md5; /**< MD5 Checksum */ const char *path; /**< Filesystem full path */ const char *name; /**< Name of the file (without extension) */ const char *fname; /**< Full name of the file (with extension) */ } jg_fileinfo_t; typedef struct _jg_videoinfo_t { enum jg_pixfmt pixfmt; /**< Pixel Format */ unsigned wmax; /**< Maximum Width (X Resolution) */ unsigned hmax; /**< Maximum Height (Y Resolution) */ unsigned w; /**< Width: Current displayed video width */ unsigned h; /**< Height: Current displayed video height */ unsigned x; /**< X Offset: Start drawing x pixels into the canvas from the left */ unsigned y; /**< Y Offset: Start drawing y pixels into the canvas from the top */ unsigned p; /**< Pitch: Row Length, usually equal to Width */ double aspect; /**< Aspect Ratio e.g. 4.0/3.0 == 1.333333 */ void *buf; /**< Pointer to Video Buffer */ } jg_videoinfo_t; typedef struct _jg_audioinfo_t { enum jg_sampfmt sampfmt; /**< Sample Format */ unsigned rate; /**< Sample Rate in Hz e.g. 48000 */ unsigned channels; /**< Number of Channels */ unsigned spf; /**< Number of Audio Samples Per Frame */ void *buf; /**< Pointer to Audio Buffer */ } jg_audioinfo_t; typedef struct _jg_inputinfo_t { enum jg_inputtype type; /**< Type of emulated input device */ int index; /**< Index/port input device is plugged into */ const char *name; /**< Short name e.g. "gamepad" */ const char *fname; /**< Full name e.g. "Game Pad" */ const char **defs; /**< List of input definitions/button names */ int numaxes; /**< Number of axes on emulated device */ int numbuttons; /**< Number of buttons on emulated device */ } jg_inputinfo_t; typedef struct _jg_inputstate_t { int16_t *axis; /**< 16-bit signed axis values allocated by frontend */ uint8_t *button; /**< Digital button values allocated by frontend */ int32_t *coord; /**< 32-bit signed coordinate values allocated by frontend */ int32_t *rel; /**< 32-bit signed relative motion values allocated by frontend */ } jg_inputstate_t; typedef struct _jg_setting_t { const char *name; /**< Name of the setting */ const char *fname; /**< Full (Friendly) name of the setting */ const char *opts; /**< List of options: This string must be in one of two formats.\n\n For numeric ranges:\n N = Setting\n\n For a list of settings with distinct names:\n 0 = Option, 1 = Other Option, 2 = Another Option */ const char *desc; /**< Description of the setting (verbose) */ int val; /**< Value of the setting */ int min; /**< Range minimum */ int max; /**< Range maximum */ uint32_t flags; /**< Flags to handle special behaviour */ } jg_setting_t; // Jolly Good API Callbacks /** * Send log data to the frontend * @param log level * @param format string */ typedef void (*jg_cb_log_t)(int, const char *, ...); void jg_set_cb_log(jg_cb_log_t); /** * Tell the frontend how many samples to read from the audio buffer * @param userdata pointer * @param number of samples to read */ typedef void (*jg_cb_audio_t)(void*, size_t); void jg_set_cb_audio(jg_cb_audio_t, void*); /** * Send frame time interval to the frontend * @param userdata pointer * @param frame time interval */ typedef void (*jg_cb_frametime_t)(void*, double); void jg_set_cb_frametime(jg_cb_frametime_t, void*); /** * Send Force Feedback data to the frontend * @param userdata pointer * @param port * @param strength (0.0 to 1.0) * @param length of time in frames */ typedef void (*jg_cb_rumble_t)(void*, int, float, size_t); void jg_set_cb_rumble(jg_cb_rumble_t, void*); // Jolly Good API Calls /** * Return the Jolly Good API version the core was built against * @return JG_VERSION_NUMBER */ unsigned jg_api_version(void); /** * Initialize the core * @return success/fail */ int jg_init(void); /** * Deinitialize a core */ void jg_deinit(void); /** * Reset the system * @param soft (0), hard (1), or firstboot (2) reset */ void jg_reset(int); /** * Run a single frame of emulation */ void jg_exec_frame(void); /** * Load a game * @return success/fail */ int jg_game_load(void); /** * Unload a game * @return success/fail */ int jg_game_unload(void); /** * Load a state by path * @param filename of the state to load */ int jg_state_load(const char *); /** * Load raw state data * @param pointer to raw state data */ void jg_state_load_raw(const void*); /** * Save a state by path * @param filename of the state to save */ int jg_state_save(const char *); /** * Save raw state data * @return pointer to raw state data */ const void* jg_state_save_raw(void); /** * Retrieve the size of state data * @return size of state data in bytes */ size_t jg_state_size(void); /** * Select next disc, floppy, or other type of media * @deprecated Use jg_media_set. Will be removed in API version >= 2.1.0 */ void jg_media_select(void); /** * Select media by index * @param index of the media to select (0 to count - 1) */ void jg_media_set(unsigned); /** * Insert or remove media (disc, floppy, etc) * @deprecated Use jg_media_mount. Will be removed in API version >= 2.1.0 */ void jg_media_insert(void); /** * Mount or unmount media * @param state 0 = unmount, 1 = mount */ void jg_media_mount(unsigned); /** * Clear (disable) all cheat codes */ void jg_cheat_clear(void); /** * Set (enable) a cheat code * @param cheat code */ void jg_cheat_set(const char *); /** * Rehash settings or other properties which may be modified while running */ void jg_rehash(void); /** * Push data into the core * @param type of data being pushed * @param port number of device, if applicable (default 0) * @param pointer to a data buffer or struct containing a data buffer * @param size of data or number of samples */ void jg_data_push(uint32_t, int, const void*, size_t); /** * Return number of supported systems, get pointer to system info array. * @param pointer to frontend's variable used to hold the number of entries * @return pointer to core's system info array */ jg_systeminfo_t* jg_get_systemlist(size_t*); /** * Return core information * @param system being emulated * @return information about the core */ jg_coreinfo_t* jg_get_coreinfo(const char *); /** * Return number of BIOS/firmware files, get pointer to BIOS info array. * @param pointer to frontend's variable used to hold the number of BIOS entries * @return pointer to core's BIOS info array, or NULL for no BIOS files */ jg_biosinfo_t* jg_get_bioslist(size_t*); /** * Return video information * @return information about video rendering */ jg_videoinfo_t* jg_get_videoinfo(void); /** * Return audio information * @return information about audio */ jg_audioinfo_t* jg_get_audioinfo(void); /** * Return input information * @param port input device is plugged into * @return information about an input device */ jg_inputinfo_t* jg_get_inputinfo(int); /** * Return the full list of input devices supported by the core * @param pointer to frontend's variable used to hold the number of entries * @return pointer to core's input slot definitions array */ jg_inputinfo_t* jg_get_inputlist(size_t*); /** * Return number of emulator-specific settings, get pointer to settings array * @param pointer to frontend's variable used to hold the number of settings * @return pointer to core's settings array */ jg_setting_t* jg_get_settings(size_t*); /** * Return number of DIP switches for the loaded game, get pointer to DIP array. * @param pointer to frontend's variable used to hold the number of DIP switches * @return pointer to core's DIP switch array, or NULL for no DIP switches */ jg_setting_t* jg_get_dips(size_t*); /** * Return media information, or NULL if no selectable media * @return pointer to core's media info, or NULL */ jg_mediainfo_t* jg_get_mediainfo(void); /** * Set up video parameters after a game is loaded */ void jg_setup_video(void); /** * Set up audio parameters after a game is loaded */ void jg_setup_audio(void); /** * Pass a pointer to an input state into the emulator core * @param pointer to input state * @param index/port number */ void jg_set_inputstate(jg_inputstate_t*, int); /** * Tell the emulator information about the game * @param jg_fileinfo_t */ void jg_set_gameinfo(jg_fileinfo_t); /** * Tell the emulator information about an auxiliary file * @param jg_fileinfo_t * @param index number */ void jg_set_auxinfo(jg_fileinfo_t, int); /** * Tell the emulator the paths for file operations * @param jg_pathinfo_t */ void jg_set_paths(jg_pathinfo_t); #ifdef __cplusplus } #endif #endif jg-2.0.0-43af3ed5bf6e4c97da4f564f3ef0626796b352ef/jg.pc.in000066400000000000000000000002441522153123100212600ustar00rootroot00000000000000prefix=@PREFIX@ includedir=@INCLUDEDIR@ Name: Jolly Good API Description: An API for Emulators Version: 2.0.0 URL: https://jgemu.gitlab.io Cflags: -I${includedir} jg-2.0.0-43af3ed5bf6e4c97da4f564f3ef0626796b352ef/jg_2600.h000066400000000000000000000046511522153123100211550ustar00rootroot00000000000000/* zlib License Copyright (c) 2020-2022 Rupert Carmichael This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef JG_2600_H #define JG_2600_H enum jg_2600_input_type { JG_2600_UNCONNECTED, JG_2600_JS, JG_2600_SYS }; static const char *jg_2600_input_name[] = { "Unconnected", "2600 Joystick", "2600 System" }; #define NDEFS_2600JS 5 static const char *defs_2600js[NDEFS_2600JS] = { "Up", "Down", "Left", "Right", "Fire" }; #define NDEFS_2600SYS 5 static const char *defs_2600sys[NDEFS_2600SYS] = { "Reset", "Select", "LeftDifficulty", "RightDifficulty", "TVType" }; static jg_inputinfo_t jg_2600_inputinfo(int index, int type) { jg_inputinfo_t ret; switch (type) { case JG_2600_JS: { ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = index == 0 ? "2600js1" : "2600js2"; ret.fname = jg_2600_input_name[type]; ret.defs = defs_2600js; ret.numaxes = 0; ret.numbuttons = NDEFS_2600JS; return ret; } case JG_2600_SYS: { ret.type = JG_INPUT_EXTERNAL; ret.index = index; ret.name = "2600system"; ret.fname = jg_2600_input_name[type]; ret.defs = defs_2600sys; ret.numaxes = 0; ret.numbuttons = NDEFS_2600SYS; return ret; } default: { ret.type = JG_INPUT_EXTERNAL; ret.index = index; ret.name = "unconnected"; ret.fname = jg_2600_input_name[0]; ret.defs = NULL; ret.numaxes = ret.numbuttons = 0; return ret; } } } #endif jg-2.0.0-43af3ed5bf6e4c97da4f564f3ef0626796b352ef/jg_5200.h000066400000000000000000000042241522153123100211500ustar00rootroot00000000000000/* zlib License Copyright (c) 2020-2022 Rupert Carmichael This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef JG_5200_H #define JG_5200_H enum jg_5200_input_type { JG_5200_UNCONNECTED, JG_5200_JS }; static const char *jg_5200_input_name[] = { "Unconnected", "5200 Joystick" }; #define NDEFS_5200JS 21 static const char *defs_5200js[NDEFS_5200JS] = { "Up", "Down", "Left", "Right", "FireL", "FireR", "Start", "Pause", "Reset", "Button1", "Button2", "Button3", "Button4", "Button5", "Button6", "Button7", "Button8", "Button9", "Button0", "Star", "Pound" }; static jg_inputinfo_t jg_5200_inputinfo(int index, int type) { jg_inputinfo_t ret; switch (type) { case JG_5200_JS: { ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = index == 0 ? "5200js1" : index == 1 ? "5200js2" : index == 2 ? "5200js3" : "5200js4"; ret.fname = jg_5200_input_name[type]; ret.defs = defs_5200js; ret.numaxes = 0; ret.numbuttons = NDEFS_5200JS; return ret; } default: { ret.type = JG_INPUT_EXTERNAL; ret.index = index; ret.name = "unconnected"; ret.fname = jg_5200_input_name[0]; ret.defs = NULL; ret.numaxes = ret.numbuttons = 0; return ret; } } } #endif jg-2.0.0-43af3ed5bf6e4c97da4f564f3ef0626796b352ef/jg_7800.h000066400000000000000000000056021522153123100211610ustar00rootroot00000000000000/* zlib License Copyright (c) 2020-2022 Rupert Carmichael This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef JG_7800_H #define JG_7800_H enum jg_7800_input_type { JG_7800_UNCONNECTED, JG_7800_JS, JG_7800_GUN, JG_7800_SYS }; static const char *jg_7800_input_name[] = { "Unconnected", "7800 Joystick", "7800 XG-1 Lightgun", "7800 System" }; #define NDEFS_7800JS 6 static const char *defs_7800js[NDEFS_7800JS] = { "Up", "Down", "Left", "Right", "Button1", "Button2" }; #define NDEFS_7800GUN 1 static const char *defs_7800gun[NDEFS_7800GUN] = { "Trigger" }; #define NDEFS_7800SYS 5 static const char *defs_7800sys[NDEFS_7800SYS] = { "Reset", "Select", "Pause", "LeftDifficulty", "RightDifficulty" }; static jg_inputinfo_t jg_7800_inputinfo(int index, int type) { jg_inputinfo_t ret; switch (type) { case JG_7800_JS: { ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = index == 0 ? "7800js1" : "7800js2"; ret.fname = jg_7800_input_name[type]; ret.defs = defs_7800js; ret.numaxes = 0; ret.numbuttons = NDEFS_7800JS; return ret; } case JG_7800_GUN: { ret.type = JG_INPUT_GUN; ret.index = index; ret.name = "7800gun"; ret.fname = jg_7800_input_name[type]; ret.defs = defs_7800gun; ret.numaxes = 0; ret.numbuttons = NDEFS_7800GUN; return ret; } case JG_7800_SYS: { ret.type = JG_INPUT_EXTERNAL; ret.index = index; ret.name = "7800system"; ret.fname = jg_7800_input_name[type]; ret.defs = defs_7800sys; ret.numaxes = 0; ret.numbuttons = NDEFS_7800SYS; return ret; } default: { ret.type = JG_INPUT_EXTERNAL; ret.index = index; ret.name = "unconnected"; ret.fname = jg_7800_input_name[0]; ret.defs = NULL; ret.numaxes = ret.numbuttons = 0; return ret; } } } #endif jg-2.0.0-43af3ed5bf6e4c97da4f564f3ef0626796b352ef/jg_coleco.h000066400000000000000000000107241522153123100220300ustar00rootroot00000000000000/* zlib License Copyright (c) 2020-2022 Rupert Carmichael This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef JG_COLECO_H #define JG_COLECO_H enum jg_coleco_input_type { JG_COLECO_UNCONNECTED, JG_COLECO_PAD, JG_COLECO_ROLLER, JG_COLECO_SAC, JG_COLECO_SKETCH, JG_COLECO_WHEEL }; static const char *jg_coleco_input_name[] = { "Unconnected", "ColecoVision Paddle", "ColecoVision Roller Controller", "ColecoVision Super Action Controller", "Super Sketch", "ColecoVision Steering Wheel" }; #define NDEFS_COLECOPAD 18 static const char *defs_colecopad[NDEFS_COLECOPAD] = { "Up", "Down", "Left", "Right", "FireL", "FireR", "Button1", "Button2", "Button3", "Button4", "Button5", "Button6", "Button7", "Button8", "Button9", "Button0", "Star", "Pound" }; #define NDEFS_COLECOSAC 22 static const char *defs_colecosac[NDEFS_COLECOSAC] = { "Up", "Down", "Left", "Right", "Yellow", "Orange", "Purple", "Blue", "Button1", "Button2", "Button3", "Button4", "Button5", "Button6", "Button7", "Button8", "Button9", "Button0", "Star", "Pound", "RollerL", "RollerR" }; #define NDEFS_COLECOSKETCH 4 static const char *defs_colecosketch[NDEFS_COLECOSKETCH] = { "Lift", "Select", "Release", "Menu" }; #define NDEFS_COLECOWHEEL 17 static const char *defs_colecowheel[NDEFS_COLECOWHEEL] = { "Accelerator", "StickUp", "StickDown", "StickLeft", "StickRight", "Button1", "Button2", "Button3", "Button4", "Button5", "Button6", "Button7", "Button8", "Button9", "Button0", "Star", "Pound" }; static jg_inputinfo_t jg_coleco_inputinfo(int index, int type) { jg_inputinfo_t ret; switch (type) { case JG_COLECO_PAD: { ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = index == 0 ? "colecopad1" : "colecopad2"; ret.fname = jg_coleco_input_name[type]; ret.defs = defs_colecopad; ret.numaxes = 0; ret.numbuttons = NDEFS_COLECOPAD; return ret; } case JG_COLECO_ROLLER: { ret.type = JG_INPUT_POINTER; ret.index = index; ret.name = index == 0 ? "colecoroller1" : "colecoroller2"; ret.fname = jg_coleco_input_name[type]; ret.defs = defs_colecopad; ret.numaxes = 0; ret.numbuttons = NDEFS_COLECOPAD; return ret; } case JG_COLECO_SAC: { ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = index == 0 ? "colecosac1" : "colecosac2"; ret.fname = jg_coleco_input_name[type]; ret.defs = defs_colecosac; ret.numaxes = 0; ret.numbuttons = NDEFS_COLECOSAC; return ret; } case JG_COLECO_SKETCH: { ret.type = JG_INPUT_POINTER; ret.index = index; ret.name = "colecosketch"; ret.fname = jg_coleco_input_name[type]; ret.defs = defs_colecosketch; ret.numaxes = 0; ret.numbuttons = NDEFS_COLECOSKETCH; return ret; } case JG_COLECO_WHEEL: { ret.type = JG_INPUT_SPINNER; ret.index = index; ret.name = "colecowheel"; ret.fname = jg_coleco_input_name[type]; ret.defs = defs_colecowheel; ret.numaxes = 0; ret.numbuttons = NDEFS_COLECOWHEEL; return ret; } default: { ret.type = JG_INPUT_EXTERNAL; ret.index = index; ret.name = "unconnected"; ret.fname = jg_coleco_input_name[0]; ret.defs = NULL; ret.numaxes = ret.numbuttons = 0; return ret; } } } #endif jg-2.0.0-43af3ed5bf6e4c97da4f564f3ef0626796b352ef/jg_crvision.h000066400000000000000000000055041522153123100224200ustar00rootroot00000000000000/* zlib License Copyright (c) 2020-2025 Rupert Carmichael This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef JG_CRVISION_H #define JG_CRVISION_H enum jg_crvision_input_type { JG_CRVISION_UNCONNECTED, JG_CRVISION_LPAD, JG_CRVISION_RPAD }; static const char *jg_crvision_input_name[] = { "Unconnected", "CreatiVision Left Paddle", "CreatiVision Right Paddle" }; #define NDEFS_CRVISIONPAD 30 static const char *defs_crvision_lpad[NDEFS_CRVISIONPAD] = { "Up", "Down", "Left", "Right", "Fire1", "Fire2", "1", "2", "3", "4", "5", "6", "Cntl", "Q", "W", "E", "R", "T", "Backspace", "A", "S", "D", "F", "G", "Shift", "Z", "X", "C", "V", "B" }; static const char *defs_crvision_rpad[NDEFS_CRVISIONPAD] = { "Up", "Down", "Left", "Right", "Fire1", "Fire2", "7", "8", "9", "0", "Colon", "Minus", "Y", "U", "I", "O", "P", "Retn", "H", "J", "K", "L", "Semicolon", "Tab", "N", "M", "Comma", "Period", "Slash", "Space" }; static jg_inputinfo_t jg_crvision_inputinfo(int index, int type) { jg_inputinfo_t ret; switch (type) { case JG_CRVISION_LPAD: { ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = "crvisionlpad"; ret.fname = jg_crvision_input_name[type]; ret.defs = defs_crvision_lpad; ret.numaxes = 0; ret.numbuttons = NDEFS_CRVISIONPAD; return ret; } case JG_CRVISION_RPAD: { ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = "crvisionrpad"; ret.fname = jg_crvision_input_name[type]; ret.defs = defs_crvision_rpad; ret.numaxes = 0; ret.numbuttons = NDEFS_CRVISIONPAD; return ret; } default: { ret.type = JG_INPUT_EXTERNAL; ret.index = index; ret.name = "unconnected"; ret.fname = jg_crvision_input_name[0]; ret.defs = NULL; ret.numaxes = ret.numbuttons = 0; return ret; } } } #endif jg-2.0.0-43af3ed5bf6e4c97da4f564f3ef0626796b352ef/jg_gb.h000066400000000000000000000041721522153123100211540ustar00rootroot00000000000000/* zlib License Copyright (c) 2020-2022 Rupert Carmichael This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef JG_GB_H #define JG_GB_H enum jg_gb_input_type { JG_GB_SYSTEM, JG_GB_ACCELEROMETER }; static const char *jg_gb_input_name[] = { "Game Boy", "Accelerometer" }; #define NDEFS_GB 10 static const char *defs_gb[NDEFS_GB] = { "Up", "Down", "Left", "Right", "Select", "Start", "A", "B", "TurboA", "TurboB" }; #define NDEFS_GBACCELEROMETER 2 static const char *defs_gbacclerometer[NDEFS_GBACCELEROMETER] = { "X", "Y" }; static jg_inputinfo_t jg_gb_inputinfo(int index, int type) { jg_inputinfo_t ret; switch (type) { case JG_GB_SYSTEM: { ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = index == 0 ? "gameboy1" : "gameboy2"; ret.fname = jg_gb_input_name[type]; ret.defs = defs_gb; ret.numaxes = 0; ret.numbuttons = NDEFS_GB; break; } case JG_GB_ACCELEROMETER: { ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = "gbaccelerometer"; ret.fname = jg_gb_input_name[type]; ret.defs = defs_gbacclerometer; ret.numaxes = NDEFS_GBACCELEROMETER; ret.numbuttons = 0; break; } } return ret; } #endif jg-2.0.0-43af3ed5bf6e4c97da4f564f3ef0626796b352ef/jg_gba.h000066400000000000000000000025771522153123100213240ustar00rootroot00000000000000/* zlib License Copyright (c) 2020-2022 Rupert Carmichael This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef JG_GBA_H #define JG_GBA_H #define NDEFS_GBA 10 static const char *defs_gba[NDEFS_GBA] = { "Up", "Down", "Left", "Right", "Select", "Start", "A", "B", "L", "R" }; static jg_inputinfo_t jg_gba_inputinfo(int index, int type) { if (type) { } jg_inputinfo_t ret; ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = index == 0 ? "gba1" : "gba2"; ret.fname = "Game Boy Advance"; ret.defs = defs_gba; ret.numaxes = 0; ret.numbuttons = NDEFS_GBA; return ret; } #endif jg-2.0.0-43af3ed5bf6e4c97da4f564f3ef0626796b352ef/jg_gg.h000066400000000000000000000025471522153123100211650ustar00rootroot00000000000000/* zlib License Copyright (c) 2020-2022 Rupert Carmichael This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef JG_GG_H #define JG_GG_H #define NDEFS_GG 7 static const char *defs_gg[NDEFS_GG] = { "Up", "Down", "Left", "Right", "Start", "B1", "B2" }; static jg_inputinfo_t jg_gg_inputinfo(int index, int type) { if (type) { } jg_inputinfo_t ret; ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = index == 0 ? "gamegear1" : "gamegear2"; ret.fname = "Game Gear"; ret.defs = defs_gg; ret.numaxes = 0; ret.numbuttons = NDEFS_GG; return ret; } #endif jg-2.0.0-43af3ed5bf6e4c97da4f564f3ef0626796b352ef/jg_intv.h000066400000000000000000000041431522153123100215420ustar00rootroot00000000000000/* zlib License Copyright (c) 2020-2022 Rupert Carmichael This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef JG_INTV_H #define JG_INTV_H enum jg_intv_input_type { JG_INTV_UNCONNECTED, JG_INTV_CONTROLLER }; static const char *jg_intv_input_name[] = { "Unconnected", "Intellivision Controller" }; #define NDEFS_INTVCTRL 17 static const char *defs_intvctrl[NDEFS_INTVCTRL] = { "XAxis", "YAxis", "FireL", "FireR", "FireTop", "Button1", "Button2", "Button3", "Button4", "Button5", "Button6", "Button7", "Button8", "Button9", "Button0", "Clear", "Enter" }; static jg_inputinfo_t jg_intv_inputinfo(int index, int type) { jg_inputinfo_t ret; switch (type) { case JG_INTV_CONTROLLER: { ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = index == 0 ? "intvctrl1" : "intvctrl2"; ret.fname = jg_intv_input_name[type]; ret.defs = defs_intvctrl; ret.numaxes = 2; ret.numbuttons = NDEFS_INTVCTRL - 2; return ret; } default: { ret.type = JG_INPUT_EXTERNAL; ret.index = index; ret.name = "unconnected"; ret.fname = jg_intv_input_name[0]; ret.defs = NULL; ret.numaxes = ret.numbuttons = 0; return ret; } } } #endif jg-2.0.0-43af3ed5bf6e4c97da4f564f3ef0626796b352ef/jg_jag.h000066400000000000000000000041001522153123100213140ustar00rootroot00000000000000/* zlib License Copyright (c) 2020-2022 Rupert Carmichael This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef JG_JAG_H #define JG_JAG_H enum jg_jag_input_type { JG_JAG_UNCONNECTED, JG_JAG_PAD }; static const char *jg_jag_input_name[] = { "Unconnected", "Jaguar Gamepad" }; #define NDEFS_JAGPAD 21 static const char *defs_jagpad[NDEFS_JAGPAD] = { "Up", "Down", "Left", "Right", "C", "B", "A", "Pause", "Option", "Button1", "Button2", "Button3", "Button4", "Button5", "Button6", "Button7", "Button8", "Button9", "Button0", "Star", "Pound" }; static jg_inputinfo_t jg_jag_inputinfo(int index, int type) { jg_inputinfo_t ret; switch (type) { case JG_JAG_PAD: { ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = index == 0 ? "jagpad1" : "jagpad2"; ret.fname = jg_jag_input_name[type]; ret.defs = defs_jagpad; ret.numaxes = 0; ret.numbuttons = NDEFS_JAGPAD; return ret; } default: { ret.type = JG_INPUT_EXTERNAL; ret.index = index; ret.name = "unconnected"; ret.fname = jg_jag_input_name[0]; ret.defs = NULL; ret.numaxes = ret.numbuttons = 0; return ret; } } } #endif jg-2.0.0-43af3ed5bf6e4c97da4f564f3ef0626796b352ef/jg_lynx.h000066400000000000000000000025461522153123100215610ustar00rootroot00000000000000/* zlib License Copyright (c) 2020-2022 Rupert Carmichael This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef JG_LYNX_H #define JG_LYNX_H #define NDEFS_LYNX 9 static const char *defs_lynx[NDEFS_LYNX] = { "Up", "Down", "Left", "Right", "Pause", "A", "B", "Option1", "Option2" }; static jg_inputinfo_t jg_lynx_inputinfo(int index, int type) { if (type) { } jg_inputinfo_t ret; ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = "lynx"; ret.fname = "Lynx"; ret.defs = defs_lynx; ret.numaxes = 0; ret.numbuttons = NDEFS_LYNX; return ret; } #endif jg-2.0.0-43af3ed5bf6e4c97da4f564f3ef0626796b352ef/jg_md.h000066400000000000000000000104311522153123100211570ustar00rootroot00000000000000/* Copyright (c) 2020-2025 Rupert Carmichael This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef JG_MD_H #define JG_MD_H enum jg_md_input_type { JG_MD_UNCONNECTED, JG_MD_PAD3B, JG_MD_PAD6B, JG_MD_JUSTIFIER, JG_MD_MENACER }; static const char *jg_md_input_name[] = { "Unconnected", "MD 3 Button Control Pad", "MD 6 Button Control Pad", "MD Justifier", "MD Menacer" }; // 3 Button Control Pad #define NDEFS_MDPAD3B 8 static const char *defs_mdpad3b[NDEFS_MDPAD3B] = { "Up", "Down", "Left", "Right", "Start", "A", "B", "C" }; // 6 Button Control Pad #define NDEFS_MDPAD6B 12 static const char *defs_mdpad6b[NDEFS_MDPAD6B] = { "Up", "Down", "Left", "Right", "Mode", "Start", "A", "B", "C", "X", "Y", "Z" }; // Justifier #define NDEFS_MDJUSTIFIER 3 static const char *defs_mdjustifier[NDEFS_MDJUSTIFIER] = { "Trigger", "Offscreen", "Pause" }; // Menacer #define NDEFS_MENACER 5 static const char *defs_menacer[NDEFS_MENACER] = { "Trigger", "Offscreen", "Button1", "Button2", "Pause" }; static jg_inputinfo_t jg_md_inputinfo(int index, int type) { jg_inputinfo_t ret; switch (type) { case JG_MD_PAD3B: { ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = index == 0 ? "mdpad3b1" : index == 1 ? "mdpad3b2" : index == 2 ? "mdpad3b3" : index == 3 ? "mdpad3b4" : index == 4 ? "mdpad3b5" : index == 5 ? "mdpad3b6" : index == 6 ? "mdpad3b7" : "mdpad3b8"; ret.fname = jg_md_input_name[type]; ret.defs = defs_mdpad3b; ret.numaxes = 0; ret.numbuttons = NDEFS_MDPAD3B; return ret; } case JG_MD_PAD6B: { ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = index == 0 ? "mdpad6b1" : index == 1 ? "mdpad6b2" : index == 2 ? "mdpad6b3" : index == 3 ? "mdpad6b4" : index == 4 ? "mdpad6b5" : index == 5 ? "mdpad6b6" : index == 6 ? "mdpad6b7" : "mdpad6b8"; ret.fname = jg_md_input_name[type]; ret.defs = defs_mdpad6b; ret.numaxes = 0; ret.numbuttons = NDEFS_MDPAD6B; return ret; } case JG_MD_JUSTIFIER: { ret.type = JG_INPUT_GUN; ret.index = index; ret.name = "mdjustifier"; ret.fname = jg_md_input_name[type]; ret.defs = defs_mdjustifier; ret.numaxes = 0; ret.numbuttons = NDEFS_MDJUSTIFIER; return ret; } case JG_MD_MENACER: { ret.type = JG_INPUT_POINTER; ret.index = index; ret.name = "mdmenacer"; ret.fname = jg_md_input_name[type]; ret.defs = defs_menacer; ret.numaxes = 0; ret.numbuttons = NDEFS_MENACER; return ret; } case JG_MD_MENACER | 0x80: { // Menacer with Crosshair ret.type = JG_INPUT_GUN; ret.index = index; ret.name = "mdmenacer"; ret.fname = jg_md_input_name[4]; ret.defs = defs_menacer; ret.numaxes = 0; ret.numbuttons = NDEFS_MENACER; return ret; } default: { ret.type = JG_INPUT_EXTERNAL; ret.index = index; ret.name = "unconnected"; ret.fname = jg_md_input_name[0]; ret.defs = NULL; ret.numaxes = ret.numbuttons = 0; return ret; } } } #endif jg-2.0.0-43af3ed5bf6e4c97da4f564f3ef0626796b352ef/jg_myvision.h000066400000000000000000000030621522153123100224360ustar00rootroot00000000000000/* zlib License Copyright (c) 2020-2025 Rupert Carmichael This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef JG_MYVISION_H #define JG_MYVISION_H enum jg_myvision_input_type { JG_MYVISION_SYSTEM }; static const char *jg_myvision_input_name[] = { "My Vision System" }; #define NDEFS_MYVISION 19 static const char *defs_myvision[NDEFS_MYVISION] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "A", "B", "C", "D", "E" }; static jg_inputinfo_t jg_myvision_inputinfo(int index, int type) { jg_inputinfo_t ret; ret.type = JG_INPUT_EXTERNAL; ret.index = index; ret.name = "myvision"; ret.fname = jg_myvision_input_name[type]; ret.defs = defs_myvision; ret.numaxes = 0; ret.numbuttons = NDEFS_MYVISION; return ret; } #endif jg-2.0.0-43af3ed5bf6e4c97da4f564f3ef0626796b352ef/jg_n64.h000066400000000000000000000041171522153123100211720ustar00rootroot00000000000000/* zlib License Copyright (c) 2020-2022 Rupert Carmichael This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef JG_N64_H #define JG_N64_H enum jg_n64_input_type { JG_N64_UNCONNECTED, JG_N64_CONTROLLER }; static const char *jg_n64_input_name[] = { "Unconnected", "N64 Controller" }; #define NDEFS_N64CTRL 16 static const char *defs_n64ctrl[NDEFS_N64CTRL] = { "XAxis", "YAxis", "Up", "Down", "Left", "Right", "Start", "Z", "L", "R", "A", "B", "CUp", "CDown", "CLeft", "CRight" }; static jg_inputinfo_t jg_n64_inputinfo(int index, int type) { jg_inputinfo_t ret; switch (type) { case JG_N64_CONTROLLER: { ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = index == 0 ? "n64ctrl1" : index == 1 ? "n64ctrl2" : index == 2 ? "n64ctrl3" : "n64ctrl4"; ret.fname = jg_n64_input_name[type]; ret.defs = defs_n64ctrl; ret.numaxes = 2; ret.numbuttons = NDEFS_N64CTRL - 2; return ret; } default: { ret.type = JG_INPUT_EXTERNAL; ret.index = index; ret.name = "unconnected"; ret.fname = jg_n64_input_name[0]; ret.defs = NULL; ret.numaxes = ret.numbuttons = 0; return ret; } } } #endif jg-2.0.0-43af3ed5bf6e4c97da4f564f3ef0626796b352ef/jg_nds.h000066400000000000000000000053061522153123100213500ustar00rootroot00000000000000/* zlib License Copyright (c) 2020-2025 Rupert Carmichael This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef JG_NDS_H #define JG_NDS_H enum jg_nds_input_type { JG_NDS_CONTROLS, JG_NDS_TOUCH, JG_NDS_SHELL }; static const char *jg_nds_input_name[] = { "NDS Controls", "NDS Touchscreen", "NDS Shell" }; // NDS System #define NDEFS_NDSCONTROLS 12 static const char *defs_ndspad[NDEFS_NDSCONTROLS] = { "Up", "Down", "Left", "Right", "Select", "Start", "A", "B", "X", "Y", "L", "R" }; // NDS Stylus #define NDEFS_NDSTOUCH 1 static const char *defs_ndstouch[NDEFS_NDSTOUCH] = { "Press" }; // NDS Physical Shell #define NDEFS_NDSSHELL 2 static const char *defs_ndsshell[NDEFS_NDSSHELL] = { "SwapScreens", "OpenCloseLid" }; static jg_inputinfo_t jg_nds_inputinfo(int index, int type) { jg_inputinfo_t ret; switch (type) { case JG_NDS_CONTROLS: { ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = index == 0 ? "nds1" : "nds2"; ret.fname = jg_nds_input_name[type]; ret.defs = defs_ndspad; ret.numaxes = 0; ret.numbuttons = NDEFS_NDSCONTROLS; return ret; } case JG_NDS_TOUCH: { ret.type = JG_INPUT_TOUCH; ret.index = index; ret.name = index == 1 ? "ndstouch1" : "ndstouch2"; ret.fname = jg_nds_input_name[type]; ret.defs = defs_ndstouch; ret.numaxes = 0; ret.numbuttons = NDEFS_NDSTOUCH; return ret; } case JG_NDS_SHELL: { ret.type = JG_INPUT_EXTERNAL; ret.index = index; ret.name = index == 2 ? "ndsshell1" : "ndsshell2"; ret.fname = jg_nds_input_name[type]; ret.defs = defs_ndsshell; ret.numaxes = 0; ret.numbuttons = NDEFS_NDSSHELL; return ret; } } return ret; } #endif jg-2.0.0-43af3ed5bf6e4c97da4f564f3ef0626796b352ef/jg_neogeo.h000066400000000000000000000104451522153123100220400ustar00rootroot00000000000000/* zlib License Copyright (c) 2020-2026 Rupert Carmichael This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef JG_NEOGEO_H #define JG_NEOGEO_H enum jg_neogeo_input_type { JG_NEOGEO_UNCONNECTED, JG_NEOGEO_JS, JG_NEOGEO_SYS, JG_NEOGEO_MAHJONG, JG_NEOGEO_VLINER, JG_NEOGEO_IRRMAZE }; static const char *jg_neogeo_input_name[] = { "Unconnected", "Neo Geo Joystick", "Neo Geo System", "Neo Geo Mahjong Controller", "V-Liner", "Irritating Maze" }; #define NDEFS_NEOGEOJS 10 static const char *defs_neogeojs[NDEFS_NEOGEOJS] = { "Up", "Down", "Left", "Right", "Select", "Start", "A", "B", "C", "D" }; #define NDEFS_NEOGEOSYS 4 static const char *defs_neogeosys[NDEFS_NEOGEOSYS] = { "Coin1", "Coin2", "Service", "Test" }; #define NDEFS_NEOGEOMJ 21 static const char *defs_neogeomj[NDEFS_NEOGEOMJ] = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "Pon", "Chi", "Kan", "Reach", "Ron", "Select", "Start" }; #define NDEFS_NEOGEOVLINER 11 static const char *defs_neogeovliner[NDEFS_NEOGEOVLINER] = { "Up", "Down", "Left", "Right", "Big", "Small", "D-Up", "Start", "Operator", "ClearCredit", "HopperOut" }; #define NDEFS_NEOGEOIRRMAZE 7 static const char *defs_neogeoirrmaze[NDEFS_NEOGEOIRRMAZE] = { "XAxis", "YAxis", "LeftA", "LeftB", "RightA", "RightB", "Start" }; static jg_inputinfo_t jg_neogeo_inputinfo(int index, int type) { jg_inputinfo_t ret; switch (type) { case JG_NEOGEO_JS: { ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = index == 0 ? "neogeojs1" : index == 1 ? "neogeojs2" : index == 2 ? "neogeojs3" : "neogeojs4"; ret.fname = jg_neogeo_input_name[type]; ret.defs = defs_neogeojs; ret.numaxes = 0; ret.numbuttons = NDEFS_NEOGEOJS; return ret; } case JG_NEOGEO_SYS: { ret.type = JG_INPUT_EXTERNAL; ret.index = index; ret.name = "neogeosystem"; ret.fname = jg_neogeo_input_name[type]; ret.defs = defs_neogeosys; ret.numaxes = 0; ret.numbuttons = NDEFS_NEOGEOSYS; return ret; } case JG_NEOGEO_MAHJONG: { ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = "neogeomahjong"; ret.fname = jg_neogeo_input_name[type]; ret.defs = defs_neogeomj; ret.numaxes = 0; ret.numbuttons = NDEFS_NEOGEOMJ; return ret; } case JG_NEOGEO_VLINER: { ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = "neogeovliner"; ret.fname = jg_neogeo_input_name[type]; ret.defs = defs_neogeovliner; ret.numaxes = 0; ret.numbuttons = NDEFS_NEOGEOVLINER; return ret; } case JG_NEOGEO_IRRMAZE: { ret.type = JG_INPUT_POINTER; ret.index = index; ret.name = "neogeoirrmaze"; ret.fname = jg_neogeo_input_name[type]; ret.defs = defs_neogeoirrmaze; ret.numaxes = 2; ret.numbuttons = NDEFS_NEOGEOIRRMAZE - 2; return ret; } default: { ret.type = JG_INPUT_EXTERNAL; ret.index = index; ret.name = "unconnected"; ret.fname = jg_neogeo_input_name[0]; ret.defs = NULL; ret.numaxes = ret.numbuttons = 0; return ret; } } } #endif jg-2.0.0-43af3ed5bf6e4c97da4f564f3ef0626796b352ef/jg_nes.h000066400000000000000000000312411522153123100213460ustar00rootroot00000000000000/* zlib License Copyright (c) 2020-2022 Rupert Carmichael This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef JG_NES_H #define JG_NES_H enum jg_nes_input_type { JG_NES_UNCONNECTED, JG_NES_PAD1, JG_NES_PAD2, JG_NES_PAD3, JG_NES_PAD4, JG_NES_ZAPPER, JG_NES_ARKANOID, JG_NES_POWERPAD, JG_NES_POWERGLOVE, JG_NES_MOUSE, JG_NES_ROB, JG_NES_FAMILYTRAINER, JG_NES_FAMILYKEYBOARD, JG_NES_SUBORKEYBOARD, JG_NES_DOREMIKKOKEYBOARD, JG_NES_HORITRACK, JG_NES_PACHINKO, JG_NES_OEKAKIDSTABLET, JG_NES_KONAMIHYPERSHOT, JG_NES_BANDAIHYPERSHOT, JG_NES_CRAZYCLIMBER, JG_NES_MAHJONG, JG_NES_EXCITINGBOXING, JG_NES_TOPRIDER, JG_NES_POKKUNMOGURAA, JG_NES_PARTYTAP, JG_NES_TURBOFILE, JG_NES_BARCODEWORLD, JG_NES_VSSYS, JG_NES_KARAOKESTUDIO }; static const char *jg_nes_input_name[] = { "Unconnected", "NES Controller", "NES Controller", "NES Controller", "NES Controller", "Zapper", "Arkanoid Paddle", "Power Pad", "Power Glove", "NES Mouse", // todo "R.O.B.", "Family Trainer", "Family Keyboard", // todo "Subor Keyboard", // todo "Doremikko Keyboard", // todo "Hori Track", // todo "Pachinko", "Oeka Kids Tablet", "Konami Hypershot", "Bandai Hypershot", "Crazy Climber", "Mahjong", "Exciting Boxing", "Top Rider", "Pokkun Moguraa", "PartyTap", "Turbo File", // edge case, not really an input device "Barcode World", // todo "Vs. System", "Karaoke Studio" }; // NES Controller (Pad) #define NDEFS_NESPAD 10 static const char *defs_nespad[NDEFS_NESPAD] = { "Up", "Down", "Left", "Right", "Select", "Start", "A", "B", "TurboA", "TurboB" }; // NES Zapper #define NDEFS_ZAPPER 2 static const char *defs_zapper[NDEFS_ZAPPER] = { "Fire", "Offscreen" }; // Arkanoid Paddle #define NDEFS_ARKANOID 2 static const char *defs_arkanoid[NDEFS_ARKANOID] = { "XAxis", "Button" }; // Power Pad #define NDEFS_POWERPAD 20 static const char *defs_powerpad[NDEFS_POWERPAD] = { "SideA1", "SideA2", "SideA3", "SideA4", "SideA5", "SideA6", "SideA7", "SideA8", "SideA9", "SideA10", "SideA11", "SideA12", "SideB3", "SideB2", "SideB8", "SideB7", "SideB6", "SideB5", "SideB11", "SideB10" }; // Power Glove #define NDEFS_POWERGLOVE 8 static const char *defs_powerglove[NDEFS_POWERGLOVE] = { "Select", "Start", "MoveIn", "MoveOut", "RollLeft", "RollRight", "Fist", "Finger" }; // Pachinko #define NDEFS_PACHINKO 9 static const char *defs_pachinko[NDEFS_PACHINKO] = { "Throttle", "Up", "Down", "Left", "Right", "Select", "Start", "A", "B" }; // Oeka Kids Tablet #define NDEFS_OEKAKIDS 1 static const char *defs_oekakids[NDEFS_OEKAKIDS] = { "Button" }; // Konami Hypershot #define NDEFS_KONAMIHYPERSHOT 4 static const char *defs_konamihypershot[NDEFS_KONAMIHYPERSHOT] = { "Player1B1", "Player1B2", "Player2B1", "Player2B2" }; // Bandai Hypershot #define NDEFS_BANDAIHYPERSHOT 3 static const char *defs_bandaihypershot[NDEFS_BANDAIHYPERSHOT] = { "Fire", "Offscreen", "Move" }; #define NDEFS_CRAZYCLIMBER 8 static const char *defs_crazyclimber[NDEFS_CRAZYCLIMBER] = { "LeftUp", "LeftDown", "LeftLeft", "LeftRight", "RightUp", "RightDown", "RightLeft", "RightRight", }; // Mahjong #define NDEFS_MAHJONG 21 static const char *defs_mahjong[NDEFS_MAHJONG] = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "Start", "Select", "Kan", "Pon", "Chi", "Reach", "Ron" }; // Exciting Boxing #define NDEFS_EXCITINGBOXING 8 static const char *defs_excitingboxing[NDEFS_EXCITINGBOXING] = { "Straight", "Body", "Left", "Right", "LeftHook", "RightHook", "LeftJab", "RightJab" }; // Top Rider #define NDEFS_TOPRIDER 8 static const char *defs_toprider[NDEFS_TOPRIDER] = { "ShiftGear", "Rear", "Left", "Right", "Select", "Start", "Accelerate", "Brake" }; // Pokkun Moguraa #define NDEFS_POKKUNMOGURAA 12 static const char *defs_pokkunmoguraa[NDEFS_POKKUNMOGURAA] = { "Row1B1", "Row1B2", "Row1B3", "Row1B4", "Row2B1", "Row2B2", "Row2B3", "Row2B4", "Row3B1", "Row3B2", "Row3B3", "Row3B4" }; // PartyTap #define NDEFS_PARTYTAP 6 static const char *defs_partytap[NDEFS_PARTYTAP] = { "Unit1", "Unit2", "Unit3", "Unit4", "Unit5", "Unit6" }; // Vs. System #define NDEFS_VSSYS 2 static const char *defs_vssys[NDEFS_VSSYS] = { "Coin1", "Coin2" }; // Vs. System #define NDEFS_KARAOKESTUDIO 2 static const char *defs_karaokestudio[NDEFS_VSSYS] = { "A", "B" }; static jg_inputinfo_t jg_nes_inputinfo(int index, int type) { jg_inputinfo_t ret; switch (type) { case JG_NES_PAD1: { ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = "nespad1"; ret.fname = jg_nes_input_name[type]; ret.defs = defs_nespad; ret.numaxes = 0; ret.numbuttons = NDEFS_NESPAD; return ret; } case JG_NES_PAD2: { ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = "nespad2"; ret.fname = jg_nes_input_name[type]; ret.defs = defs_nespad; ret.numaxes = 0; ret.numbuttons = NDEFS_NESPAD; return ret; } case JG_NES_PAD3: { ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = "nespad3"; ret.fname = jg_nes_input_name[type]; ret.defs = defs_nespad; ret.numaxes = 0; ret.numbuttons = NDEFS_NESPAD; return ret; } case JG_NES_PAD4: { ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = "nespad4"; ret.fname = jg_nes_input_name[type]; ret.defs = defs_nespad; ret.numaxes = 0; ret.numbuttons = NDEFS_NESPAD; return ret; } case JG_NES_ZAPPER: { ret.type = JG_INPUT_GUN; ret.index = index; ret.name = "neszapper"; ret.fname = jg_nes_input_name[type]; ret.defs = defs_zapper; ret.numaxes = 0; ret.numbuttons = NDEFS_ZAPPER; return ret; } case JG_NES_ARKANOID: { ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = "nesarkanoid"; ret.fname = jg_nes_input_name[type]; ret.defs = defs_arkanoid; ret.numaxes = 1; ret.numbuttons = NDEFS_ARKANOID - 1; return ret; } case JG_NES_POWERPAD: { ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = "nespowerpad"; ret.fname = jg_nes_input_name[type]; ret.defs = defs_powerpad; ret.numaxes = 0; ret.numbuttons = NDEFS_POWERPAD; return ret; } case JG_NES_FAMILYTRAINER: { // Family Trainer == Power Pad ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = "nespowerpad"; ret.fname = jg_nes_input_name[type]; ret.defs = defs_powerpad; ret.numaxes = 0; ret.numbuttons = NDEFS_POWERPAD; return ret; } case JG_NES_POWERGLOVE: { ret.type = JG_INPUT_POINTER; ret.index = index; ret.name = "nespowerglove"; ret.fname = jg_nes_input_name[type]; ret.defs = defs_powerglove; ret.numaxes = 0; ret.numbuttons = NDEFS_POWERGLOVE; return ret; } case JG_NES_PACHINKO: { ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = "nespachinko"; ret.fname = jg_nes_input_name[type]; ret.defs = defs_pachinko; ret.numaxes = 1; ret.numbuttons = NDEFS_PACHINKO - 1; return ret; } case JG_NES_OEKAKIDSTABLET: { ret.type = JG_INPUT_POINTER; ret.index = index; ret.name = "nesoekakids"; ret.fname = jg_nes_input_name[type]; ret.defs = defs_oekakids; ret.numaxes = 0; ret.numbuttons = NDEFS_OEKAKIDS; return ret; } case JG_NES_KONAMIHYPERSHOT: { ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = "neskonamihypershot"; ret.fname = jg_nes_input_name[type]; ret.defs = defs_konamihypershot; ret.numaxes = 0; ret.numbuttons = NDEFS_KONAMIHYPERSHOT; return ret; } case JG_NES_BANDAIHYPERSHOT: { ret.type = JG_INPUT_GUN; ret.index = index; ret.name = "nesbandaihypershot"; ret.fname = jg_nes_input_name[type]; ret.defs = defs_bandaihypershot; ret.numaxes = 0; ret.numbuttons = NDEFS_BANDAIHYPERSHOT; return ret; } case JG_NES_CRAZYCLIMBER: { ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = "nescrazyclimber"; ret.fname = jg_nes_input_name[type]; ret.defs = defs_crazyclimber; ret.numaxes = 0; ret.numbuttons = NDEFS_CRAZYCLIMBER; return ret; } case JG_NES_MAHJONG: { ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = "nesmahjong"; ret.fname = jg_nes_input_name[type]; ret.defs = defs_mahjong; ret.numaxes = 0; ret.numbuttons = NDEFS_MAHJONG; return ret; } case JG_NES_EXCITINGBOXING: { ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = "nesexcitingboxing"; ret.fname = jg_nes_input_name[type]; ret.defs = defs_excitingboxing; ret.numaxes = 0; ret.numbuttons = NDEFS_EXCITINGBOXING; return ret; } case JG_NES_TOPRIDER: { ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = "nestoprider"; ret.fname = jg_nes_input_name[type]; ret.defs = defs_toprider; ret.numaxes = 0; ret.numbuttons = NDEFS_TOPRIDER; return ret; } case JG_NES_POKKUNMOGURAA: { ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = "nespokkunmoguraa"; ret.fname = jg_nes_input_name[type]; ret.defs = defs_pokkunmoguraa; ret.numaxes = 0; ret.numbuttons = NDEFS_POKKUNMOGURAA; return ret; } case JG_NES_PARTYTAP: { ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = "nespartytap"; ret.fname = jg_nes_input_name[type]; ret.defs = defs_partytap; ret.numaxes = 0; ret.numbuttons = NDEFS_PARTYTAP; return ret; } case JG_NES_VSSYS: { ret.type = JG_INPUT_EXTERNAL; ret.index = index; ret.name = "vssys"; ret.fname = jg_nes_input_name[type]; ret.defs = defs_vssys; ret.numaxes = 0; ret.numbuttons = NDEFS_VSSYS; return ret; } case JG_NES_KARAOKESTUDIO: { ret.type = JG_INPUT_EXTERNAL; ret.index = index; ret.name = "neskaraokestudio"; ret.fname = jg_nes_input_name[type]; ret.defs = defs_karaokestudio; ret.numaxes = 0; ret.numbuttons = NDEFS_KARAOKESTUDIO; return ret; } default: { ret.type = JG_INPUT_EXTERNAL; ret.index = index; ret.name = "unconnected"; ret.fname = jg_nes_input_name[0]; ret.defs = NULL; ret.numaxes = ret.numbuttons = 0; return ret; } } } #endif jg-2.0.0-43af3ed5bf6e4c97da4f564f3ef0626796b352ef/jg_ngp.h000066400000000000000000000025221522153123100213450ustar00rootroot00000000000000/* zlib License Copyright (c) 2020-2022 Rupert Carmichael This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef JG_NGP_H #define JG_NGP_H #define NDEFS_NGP 7 static const char *defs_ngp[NDEFS_NGP] = { "Up", "Down", "Left", "Right", "A", "B", "Option" }; static jg_inputinfo_t jg_ngp_inputinfo(int index, int type) { jg_inputinfo_t ret; if (type) { } ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = "ngp"; ret.fname = "Neo Geo Pocket"; ret.defs = defs_ngp; ret.numaxes = 0; ret.numbuttons = NDEFS_NGP; return ret; } #endif jg-2.0.0-43af3ed5bf6e4c97da4f564f3ef0626796b352ef/jg_pce.h000066400000000000000000000053351522153123100213350ustar00rootroot00000000000000/* zlib License Copyright (c) 2020-2022 Rupert Carmichael This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef JG_PCE_H #define JG_PCE_H enum jg_pce_input_type { JG_PCE_UNCONNECTED, JG_PCE_PAD, JG_PCE_AP6 }; static const char *jg_pce_input_name[] = { "Unconnected", "PCE TurboPad", "PCE Avenue Pad 6" }; // PC Engine Controller (Pad) #define NDEFS_PCEPAD 10 static const char *defs_pcepad[NDEFS_PCEPAD] = { "Up", "Down", "Left", "Right", "Select", "Run", "I", "II", "TurboI", "TurboII" }; // Avenue/Arcade Pad 6 #define NDEFS_PCEAP6 12 static const char *defs_pceap6[NDEFS_PCEAP6] = { "Up", "Down", "Left", "Right", "Select", "Run", "I", "II", "III", "IV", "V", "VI" //"ModeSelect" forced on }; static jg_inputinfo_t jg_pce_inputinfo(int index, int type) { jg_inputinfo_t ret; switch (type) { case JG_PCE_PAD: { ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = index == 0 ? "pceturbopad1" : index == 1 ? "pceturbopad2" : index == 2 ? "pceturbopad3" : index == 3 ? "pceturbopad4" : "pceturbopad5"; ret.fname = jg_pce_input_name[type]; ret.defs = defs_pcepad; ret.numaxes = 0; ret.numbuttons = NDEFS_PCEPAD; return ret; } case JG_PCE_AP6: { ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = index == 0 ? "pceap6p1" : "pceap6p2"; ret.fname = jg_pce_input_name[type]; ret.defs = defs_pceap6; ret.numaxes = 0; ret.numbuttons = NDEFS_PCEAP6; return ret; } default: { ret.type = JG_INPUT_EXTERNAL; ret.index = index; ret.name = "unconnected"; ret.fname = jg_pce_input_name[0]; ret.defs = NULL; ret.numaxes = ret.numbuttons = 0; return ret; } } } #endif jg-2.0.0-43af3ed5bf6e4c97da4f564f3ef0626796b352ef/jg_pcfx.h000066400000000000000000000047701522153123100215300ustar00rootroot00000000000000/* zlib License Copyright (c) 2020-2025 Rupert Carmichael This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef JG_PCFX_H #define JG_PCFX_H enum jg_pcfx_input_type { JG_PCFX_UNCONNECTED, JG_PCFX_PAD, JG_PCFX_MOUSE }; static const char *jg_pcfx_input_name[] = { "Unconnected", "PC-FX Control Pad", "PC-FX Mouse" }; // PC-FX Control Pad #define NDEFS_PCFXPAD 14 static const char *defs_pcfxpad[NDEFS_PCFXPAD] = { "Up", "Down", "Left", "Right", "Select", "Run", "I", "II", "III", "IV", "V", "VI", "Mode1", "Mode2" }; // PC-FX Mouse #define NDEFS_PCFXMOUSE 2 static const char *defs_pcfxmouse[NDEFS_PCFXMOUSE] = { "Left", "Right" }; static jg_inputinfo_t jg_pcfx_inputinfo(int index, int type) { jg_inputinfo_t ret; switch (type) { case JG_PCFX_PAD: { ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = index == 0 ? "pcfxpad1" : "pcfxpad2"; ret.fname = jg_pcfx_input_name[type]; ret.defs = defs_pcfxpad; ret.numaxes = 0; ret.numbuttons = NDEFS_PCFXPAD; return ret; } case JG_PCFX_MOUSE: { ret.type = JG_INPUT_POINTER; ret.index = index; ret.name = "pcfxmouse"; ret.fname = jg_pcfx_input_name[type]; ret.defs = defs_pcfxmouse; ret.numaxes = 0; ret.numbuttons = NDEFS_PCFXMOUSE; return ret; } default: { ret.type = JG_INPUT_EXTERNAL; ret.index = index; ret.name = "unconnected"; ret.fname = jg_pcfx_input_name[0]; ret.defs = NULL; ret.numaxes = ret.numbuttons = 0; return ret; } } } #endif jg-2.0.0-43af3ed5bf6e4c97da4f564f3ef0626796b352ef/jg_psx.h000066400000000000000000000065661522153123100214070ustar00rootroot00000000000000/* zlib License Copyright (c) 2020-2022 Rupert Carmichael This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef JG_PSX_H #define JG_PSX_H enum jg_psx_input_type { JG_PSX_UNCONNECTED, JG_PSX_DUALSHOCK, JG_PSX_GUNCON, JG_PSX_JUSTIFIER }; static const char *jg_psx_input_name[] = { "Unconnected", "PSX DualShock", "PSX GunCon", "PSX Konami Justifier" }; // PSX DualShock #define NDEFS_DUALSHOCK 21 static const char *defs_dualshock[NDEFS_DUALSHOCK] = { "LeftStickX", "LeftStickY", "RightStickX", "RightStickY", "Up", "Down", "Left", "Right", "Select", "Start", "Triangle", "Cross", "Square", "Circle", "Analog", "L1", "L2", "L3", "R1", "R2", "R3" }; #define NDEFS_PSXGUNCON 4 static const char *defs_psxguncon[NDEFS_PSXGUNCON] = { "Trigger", "Offscreen", "A", "B" }; #define NDEFS_PSXJUSTIFIER 4 static const char *defs_psxjustifier[NDEFS_PSXJUSTIFIER] = { "Trigger", "Offscreen", "O", "Start" }; static jg_inputinfo_t jg_psx_inputinfo(int index, int type) { jg_inputinfo_t ret; switch (type) { case JG_PSX_DUALSHOCK: { ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = index == 0 ? "psxdualshock1" : index == 1 ? "psxdualshock2" : index == 2 ? "psxdualshock3" : index == 3 ? "psxdualshock4" : index == 4 ? "psxdualshock5" : index == 5 ? "psxdualshock6" : index == 6 ? "psxdualshock7" : "psxdualshock8"; ret.fname = jg_psx_input_name[type]; ret.defs = defs_dualshock; ret.numaxes = 4; ret.numbuttons = NDEFS_DUALSHOCK - 4; return ret; } case JG_PSX_GUNCON: { ret.type = JG_INPUT_GUN; ret.index = index; ret.name = "psxguncon"; ret.fname = jg_psx_input_name[type]; ret.defs = defs_psxguncon; ret.numaxes = 0; ret.numbuttons = NDEFS_PSXGUNCON; return ret; } case JG_PSX_JUSTIFIER: { ret.type = JG_INPUT_GUN; ret.index = index; ret.name = "psxjustifier"; ret.fname = jg_psx_input_name[type]; ret.defs = defs_psxjustifier; ret.numaxes = 0; ret.numbuttons = NDEFS_PSXJUSTIFIER; return ret; } default: { ret.type = JG_INPUT_EXTERNAL; ret.index = index; ret.name = "unconnected"; ret.fname = jg_psx_input_name[0]; ret.defs = NULL; ret.numaxes = ret.numbuttons = 0; return ret; } } } #endif jg-2.0.0-43af3ed5bf6e4c97da4f564f3ef0626796b352ef/jg_sms.h000066400000000000000000000076031522153123100213700ustar00rootroot00000000000000/* zlib License Copyright (c) 2020-2022 Rupert Carmichael This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef JG_SMS_H #define JG_SMS_H enum jg_sms_input_type { JG_SMS_UNCONNECTED, JG_SMS_PAD, JG_SMS_LIGHTPHASER, JG_SMS_PADDLE, JG_SMS_TEREBIOEKAKI, JG_SMS_SYS }; static const char *jg_sms_input_name[] = { "Unconnected", "SMS Control Pad", "SMS Light Phaser", "SMS Paddle", "Terebi Oekaki", "SMS System" }; // SMS Control Pad #define NDEFS_SMSPAD 6 static const char *defs_smspad[NDEFS_SMSPAD] = { "Up", "Down", "Left", "Right", "B1", "B2" }; // Light Phaser #define NDEFS_LIGHTPHASER 2 static const char *defs_lightphaser[NDEFS_LIGHTPHASER] = { "Trigger", "Offscreen" }; // Paddle #define NDEFS_SMSPADDLE 2 static const char *defs_smspaddle[NDEFS_SMSPADDLE] = { "Dial", "Button" }; // SMS System Buttons #define NDEFS_SMSSYS 2 static const char *defs_smssys[NDEFS_SMSSYS] = { "Reset", "Pause" }; // Terebi Oekaki #define NDEFS_TEREBIOEKAKI 1 static const char *defs_terebi[NDEFS_TEREBIOEKAKI] = { "Press" }; static jg_inputinfo_t jg_sms_inputinfo(int index, int type) { jg_inputinfo_t ret; switch (type) { case JG_SMS_PAD: { ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = index == 0 ? "smspad1" : "smspad2"; ret.fname = jg_sms_input_name[type]; ret.defs = defs_smspad; ret.numaxes = 0; ret.numbuttons = NDEFS_SMSPAD; return ret; } case JG_SMS_LIGHTPHASER: { ret.type = JG_INPUT_GUN; ret.index = index; ret.name = "lightphaser"; ret.fname = jg_sms_input_name[type]; ret.defs = defs_lightphaser; ret.numaxes = 0; ret.numbuttons = NDEFS_LIGHTPHASER; return ret; } case JG_SMS_PADDLE: { ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = index == 0 ? "smspaddle1" : "smspaddle2"; ret.fname = jg_sms_input_name[type]; ret.defs = defs_smspaddle; ret.numaxes = ret.numbuttons = 1; return ret; } case JG_SMS_TEREBIOEKAKI: { ret.type = JG_INPUT_POINTER; ret.index = index; ret.name = "terebi"; ret.fname = jg_sms_input_name[type]; ret.defs = defs_terebi; ret.numaxes = 0; ret.numbuttons = NDEFS_TEREBIOEKAKI; return ret; } case JG_SMS_SYS: { ret.type = JG_INPUT_EXTERNAL; ret.index = index; ret.name = "smssystem"; ret.fname = jg_sms_input_name[type]; ret.defs = defs_smssys; ret.numaxes = 0; ret.numbuttons = NDEFS_SMSSYS; return ret; } default: { ret.type = JG_INPUT_EXTERNAL; ret.index = index; ret.name = "unconnected"; ret.fname = jg_sms_input_name[0]; ret.defs = NULL; ret.numaxes = ret.numbuttons = 0; return ret; } } } #endif jg-2.0.0-43af3ed5bf6e4c97da4f564f3ef0626796b352ef/jg_snes.h000066400000000000000000000073071522153123100215370ustar00rootroot00000000000000/* zlib License Copyright (c) 2020-2022 Rupert Carmichael This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef JG_SNES_H #define JG_SNES_H enum jg_snes_input_type { JG_SNES_UNCONNECTED, JG_SNES_PAD, JG_SNES_MOUSE, JG_SNES_SUPERSCOPE, JG_SNES_JUSTIFIER }; static const char *jg_snes_input_name[] = { "Unconnected", "SNES Controller", "SNES Mouse", "SNES Super Scope", "SNES Justifier" }; // SNES Controller (Pad) #define NDEFS_SNESPAD 12 static const char *defs_snespad[NDEFS_SNESPAD] = { "Up", "Down", "Left", "Right", "Select", "Start", "A", "B", "X", "Y", "L", "R" }; #define NDEFS_SNESMOUSE 2 static const char *defs_snesmouse[NDEFS_SNESMOUSE] = { "Left", "Right" }; #define NDEFS_SUPERSCOPE 5 static const char *defs_superscope[NDEFS_SUPERSCOPE] = { "Trigger", "Offscreen", "Cursor", "Turbo", "Pause" }; #define NDEFS_SNESJUSTIFIER 3 static const char *defs_snesjustifier[NDEFS_SNESJUSTIFIER] = { "Trigger", "Offscreen", "Start" }; static jg_inputinfo_t jg_snes_inputinfo(int index, int type) { jg_inputinfo_t ret; switch (type) { case JG_SNES_PAD: { ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = index == 0 ? "snespad1" : index == 1 ? "snespad2" : index == 2 ? "snespad3" : index == 3 ? "snespad4" : index == 4 ? "snespad5" : index == 5 ? "snespad6" : index == 6 ? "snespad7" : "snespad8"; ret.fname = jg_snes_input_name[type]; ret.defs = defs_snespad; ret.numaxes = 0; ret.numbuttons = NDEFS_SNESPAD; return ret; } case JG_SNES_MOUSE: { ret.type = JG_INPUT_POINTER; ret.index = index; ret.name = "snesmouse"; ret.fname = jg_snes_input_name[type]; ret.defs = defs_snesmouse; ret.numaxes = 0; ret.numbuttons = NDEFS_SNESMOUSE; return ret; } case JG_SNES_SUPERSCOPE: { ret.type = JG_INPUT_GUN; ret.index = index; ret.name = "snessuperscope"; ret.fname = jg_snes_input_name[type]; ret.defs = defs_superscope; ret.numaxes = 0; ret.numbuttons = NDEFS_SUPERSCOPE; return ret; } case JG_SNES_JUSTIFIER: { ret.type = JG_INPUT_GUN; ret.index = index; ret.name = "snesjustifier"; ret.fname = jg_snes_input_name[type]; ret.defs = defs_snesjustifier; ret.numaxes = 0; ret.numbuttons = NDEFS_SNESJUSTIFIER; return ret; } default: { ret.type = JG_INPUT_EXTERNAL; ret.index = index; ret.name = "unconnected"; ret.fname = jg_snes_input_name[0]; ret.defs = NULL; ret.numaxes = ret.numbuttons = 0; return ret; } } } #endif jg-2.0.0-43af3ed5bf6e4c97da4f564f3ef0626796b352ef/jg_ss.h000066400000000000000000000072671522153123100212210ustar00rootroot00000000000000/* zlib License Copyright (c) 2020-2022 Rupert Carmichael This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef JG_SS_H #define JG_SS_H enum jg_ss_input_type { JG_SS_UNCONNECTED, JG_SS_PAD, JG_SS_3DPAD, JG_SS_VIRTUAGUN }; static const char *jg_ss_input_name[] = { "Unconnected", "Saturn Control Pad", "Saturn 3D Control Pad", "Saturn Virtua Gun" }; #define NDEFS_SSPAD 13 static const char *defs_sspad[NDEFS_SSPAD] = { "Up", "Down", "Left", "Right", "Start", "A", "B", "C", "X", "Y", "Z", "L", "R" }; #define NDEFS_SS3DPAD 16 static const char *defs_ss3dpad[NDEFS_SS3DPAD] = { "StickX", "StickY", "L", "R", "Up", "Down", "Left", "Right", "Start", "A", "B", "C", "X", "Y", "Z", "Analog" }; #define NDEFS_SSVIRTUAGUN 3 static const char *defs_ssvirtuagun[NDEFS_SSVIRTUAGUN] = { "Trigger", "Offscreen", "Start" }; static jg_inputinfo_t jg_ss_inputinfo(int index, int type) { jg_inputinfo_t ret; switch (type) { case JG_SS_PAD: { ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = index == 0 ? "sspad1" : index == 1 ? "sspad2" : index == 2 ? "sspad3" : index == 3 ? "sspad4" : index == 4 ? "sspad5" : index == 5 ? "sspad6" : index == 6 ? "sspad7" : index == 7 ? "sspad8" : index == 8 ? "sspad9" : index == 9 ? "sspad10" : index == 10 ? "sspad11" : "sspad12"; ret.fname = jg_ss_input_name[type]; ret.defs = defs_sspad; ret.numaxes = 0; ret.numbuttons = NDEFS_SSPAD; return ret; } case JG_SS_3DPAD: { ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = index == 0 ? "ss3dpad1" : index == 1 ? "ss3dpad2" : index == 2 ? "ss3dpad3" : index == 3 ? "ss3dpad4" : index == 4 ? "ss3dpad5" : index == 5 ? "ss3dpad6" : index == 6 ? "ss3dpad7" : index == 7 ? "ss3dpad8" : index == 8 ? "ss3dpad9" : index == 9 ? "ss3dpad10" : index == 10 ? "ss3dpad11" : "ss3dpad12"; ret.fname = jg_ss_input_name[type]; ret.defs = defs_ss3dpad; ret.numaxes = 4; ret.numbuttons = NDEFS_SS3DPAD - 4; return ret; } case JG_SS_VIRTUAGUN: { ret.type = JG_INPUT_GUN; ret.index = index; ret.name = "ssvirtuagun"; ret.fname = jg_ss_input_name[type]; ret.defs = defs_ssvirtuagun; ret.numaxes = 0; ret.numbuttons = NDEFS_SSVIRTUAGUN; return ret; } default: { ret.type = JG_INPUT_EXTERNAL; ret.index = index; ret.name = "unconnected"; ret.fname = jg_ss_input_name[0]; ret.defs = NULL; ret.numaxes = ret.numbuttons = 0; return ret; } } } #endif jg-2.0.0-43af3ed5bf6e4c97da4f564f3ef0626796b352ef/jg_vb.h000066400000000000000000000026641522153123100211770ustar00rootroot00000000000000/* zlib License Copyright (c) 2020-2022 Rupert Carmichael This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef JG_VB_H #define JG_VB_H #define NDEFS_VB 14 static const char *defs_vb[NDEFS_VB] = { "LeftUp", "LeftDown", "LeftLeft", "LeftRight", "RightUp", "RightDown", "RightLeft", "RightRight", "Select", "Start", "A", "B", "LeftBack", "RightBack" }; static jg_inputinfo_t jg_vb_inputinfo(int index, int type) { if (type) { } jg_inputinfo_t ret; ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = "vb"; ret.fname = "Virtual Boy"; ret.defs = defs_vb; ret.numaxes = 0; ret.numbuttons = NDEFS_VB; return ret; } #endif jg-2.0.0-43af3ed5bf6e4c97da4f564f3ef0626796b352ef/jg_vectrex.h000066400000000000000000000040341522153123100222410ustar00rootroot00000000000000/* zlib License Copyright (c) 2020-2022 Rupert Carmichael This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef JG_VECTREX_H #define JG_VECTREX_H enum jg_vectrex_input_type { JG_VECTREX_UNCONNECTED, JG_VECTREX_PAD }; static const char *jg_vectrex_input_name[] = { "Unconnected", "Vectrex Control Pad" }; #define NDEFS_VECTREXPAD 8 static const char *defs_vectrexpad[NDEFS_VECTREXPAD] = { "Up", "Down", "Left", "Right", "Button1", "Button2", "Button3", "Button4" }; static jg_inputinfo_t jg_vectrex_inputinfo(int index, int type) { jg_inputinfo_t ret; switch (type) { case JG_VECTREX_PAD: { ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = index == 0 ? "vectrexpad1" : "vectrexpad2"; ret.fname = jg_vectrex_input_name[type]; ret.defs = defs_vectrexpad; ret.numaxes = 0; ret.numbuttons = NDEFS_VECTREXPAD; return ret; } default: { ret.type = JG_INPUT_EXTERNAL; ret.index = index; ret.name = "unconnected"; ret.fname = jg_vectrex_input_name[0]; ret.defs = NULL; ret.numaxes = ret.numbuttons = 0; return ret; } } } #endif jg-2.0.0-43af3ed5bf6e4c97da4f564f3ef0626796b352ef/jg_wswan.h000066400000000000000000000025611522153123100217230ustar00rootroot00000000000000/* zlib License Copyright (c) 2020-2022 Rupert Carmichael This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef JG_WSWAN_H #define JG_WSWAN_H #define NDEFS_WSWAN 11 static const char *defs_wswan[NDEFS_WSWAN] = { "X1", "X2", "X3", "X4", "Y1", "Y2", "Y3", "Y4", "Start", "A", "B" }; static jg_inputinfo_t jg_wswan_inputinfo(int index, int type) { if (type) { } jg_inputinfo_t ret; ret.type = JG_INPUT_CONTROLLER; ret.index = index; ret.name = "wswan"; ret.fname = "WonderSwan"; ret.defs = defs_wswan; ret.numaxes = 0; ret.numbuttons = NDEFS_WSWAN; return ret; } #endif jg-2.0.0-43af3ed5bf6e4c97da4f564f3ef0626796b352ef/pkgconf.sh000077500000000000000000000003331522153123100217140ustar00rootroot00000000000000#!/bin/sh set -eu prefix="$1" includedir="$2" case "$includedir" in "$prefix"* ) include_path="\${prefix}${includedir#$prefix}" ;; * ) include_path="$includedir" ;; esac printf %s\\n "$include_path"