├── .gitignore ├── CMakeLists.txt ├── HISTORY.txt ├── LICENSE.txt ├── README.md ├── core ├── cart_hw │ ├── areplay.c │ ├── areplay.h │ ├── eeprom_93c.c │ ├── eeprom_93c.h │ ├── eeprom_i2c.c │ ├── eeprom_i2c.h │ ├── eeprom_spi.c │ ├── eeprom_spi.h │ ├── ggenie.c │ ├── ggenie.h │ ├── md_cart.c │ ├── md_cart.h │ ├── sms_cart.c │ ├── sms_cart.h │ ├── sram.c │ ├── sram.h │ └── svp │ │ ├── imageformat.txt │ │ ├── ssp16.c │ │ ├── ssp16.h │ │ ├── svp.c │ │ ├── svp.h │ │ └── svpdoc.txt ├── cd_hw │ ├── cd_cart.c │ ├── cd_cart.h │ ├── cdc.c │ ├── cdc.h │ ├── cdd.c │ ├── cdd.h │ ├── gfx.c │ ├── gfx.h │ ├── libchdr │ │ ├── LICENSE.txt │ │ ├── README.md │ │ ├── deps │ │ │ ├── libFLAC │ │ │ │ ├── AUTHORS │ │ │ │ ├── COPYING.Xiph │ │ │ │ ├── README │ │ │ │ ├── bitmath.c │ │ │ │ ├── bitreader.c │ │ │ │ ├── cpu.c │ │ │ │ ├── crc.c │ │ │ │ ├── fixed.c │ │ │ │ ├── float.c │ │ │ │ ├── format.c │ │ │ │ ├── include │ │ │ │ │ ├── FLAC │ │ │ │ │ │ ├── assert.h │ │ │ │ │ │ ├── callback.h │ │ │ │ │ │ ├── export.h │ │ │ │ │ │ ├── format.h │ │ │ │ │ │ ├── metadata.h │ │ │ │ │ │ ├── ordinals.h │ │ │ │ │ │ └── stream_decoder.h │ │ │ │ │ ├── private │ │ │ │ │ │ ├── bitmath.h │ │ │ │ │ │ ├── bitreader.h │ │ │ │ │ │ ├── cpu.h │ │ │ │ │ │ ├── crc.h │ │ │ │ │ │ ├── fixed.h │ │ │ │ │ │ ├── float.h │ │ │ │ │ │ ├── format.h │ │ │ │ │ │ ├── lpc.h │ │ │ │ │ │ ├── macros.h │ │ │ │ │ │ ├── md5.h │ │ │ │ │ │ └── memory.h │ │ │ │ │ ├── protected │ │ │ │ │ │ └── stream_decoder.h │ │ │ │ │ └── share │ │ │ │ │ │ ├── alloc.h │ │ │ │ │ │ ├── compat.h │ │ │ │ │ │ └── endswap.h │ │ │ │ ├── lpc.c │ │ │ │ ├── lpc_intrin_avx2.c │ │ │ │ ├── lpc_intrin_sse.c │ │ │ │ ├── lpc_intrin_sse2.c │ │ │ │ ├── lpc_intrin_sse41.c │ │ │ │ ├── md5.c │ │ │ │ ├── memory.c │ │ │ │ └── stream_decoder.c │ │ │ ├── lzma │ │ │ │ ├── 7zTypes.h │ │ │ │ ├── Compiler.h │ │ │ │ ├── DOC │ │ │ │ │ ├── lzma-history.txt │ │ │ │ │ ├── lzma-sdk.txt │ │ │ │ │ ├── lzma-specification.txt │ │ │ │ │ └── lzma.txt │ │ │ │ ├── LzFind.c │ │ │ │ ├── LzFind.h │ │ │ │ ├── LzHash.h │ │ │ │ ├── LzmaDec.c │ │ │ │ ├── LzmaDec.h │ │ │ │ ├── LzmaEnc.c │ │ │ │ ├── LzmaEnc.h │ │ │ │ └── Precomp.h │ │ │ └── zlib │ │ │ │ ├── ChangeLog │ │ │ │ ├── README │ │ │ │ ├── adler32.c │ │ │ │ ├── gzguts.h │ │ │ │ ├── inffast.c │ │ │ │ ├── inffast.h │ │ │ │ ├── inffixed.h │ │ │ │ ├── inflate.c │ │ │ │ ├── inflate.h │ │ │ │ ├── inftrees.c │ │ │ │ ├── inftrees.h │ │ │ │ ├── zconf.h │ │ │ │ ├── zlib.h │ │ │ │ ├── zutil.c │ │ │ │ └── zutil.h │ │ └── src │ │ │ ├── bitstream.c │ │ │ ├── bitstream.h │ │ │ ├── cdrom.c │ │ │ ├── cdrom.h │ │ │ ├── chd.c │ │ │ ├── chd.h │ │ │ ├── coretypes.h │ │ │ ├── flac.c │ │ │ ├── flac.h │ │ │ ├── huffman.c │ │ │ └── huffman.h │ ├── pcm.c │ ├── pcm.h │ ├── scd.c │ └── scd.h ├── debug │ ├── cpuhook.c │ ├── cpuhook.h │ ├── debug.c │ ├── debug.h │ ├── debug_wrap.c │ └── debug_wrap.h ├── genesis.c ├── genesis.h ├── hvc.h ├── input_hw │ ├── activator.c │ ├── activator.h │ ├── gamepad.c │ ├── gamepad.h │ ├── graphic_board.c │ ├── graphic_board.h │ ├── input.c │ ├── input.h │ ├── lightgun.c │ ├── lightgun.h │ ├── mouse.c │ ├── mouse.h │ ├── paddle.c │ ├── paddle.h │ ├── sportspad.c │ ├── sportspad.h │ ├── teamplayer.c │ ├── teamplayer.h │ ├── terebi_oekaki.c │ ├── terebi_oekaki.h │ ├── xe_1ap.c │ └── xe_1ap.h ├── io_ctrl.c ├── io_ctrl.h ├── loadrom.c ├── loadrom.h ├── m68k │ ├── m68k.h │ ├── m68kconf.h │ ├── m68kcpu.c │ ├── m68kcpu.h │ ├── m68ki_cycles.h │ ├── m68ki_instruction_jump_table.h │ ├── m68kops.h │ ├── readme.txt │ ├── s68kconf.h │ ├── s68kcpu.c │ └── s68ki_cycles.h ├── macros.h ├── mem68k.c ├── mem68k.h ├── membnk.c ├── membnk.h ├── memz80.c ├── memz80.h ├── ntsc │ ├── changes.txt │ ├── license.txt │ ├── md_ntsc.c │ ├── md_ntsc.h │ ├── md_ntsc_config.h │ ├── md_ntsc_impl.h │ ├── readme.txt │ ├── sms_ntsc.c │ ├── sms_ntsc.h │ ├── sms_ntsc.txt │ ├── sms_ntsc_config.h │ └── sms_ntsc_impl.h ├── shared.h ├── sound │ ├── blip_buf.c │ ├── blip_buf.h │ ├── eq.c │ ├── eq.h │ ├── opll.c │ ├── opll.h │ ├── psg.c │ ├── psg.h │ ├── sound.c │ ├── sound.h │ ├── ym2413.c │ ├── ym2413.h │ ├── ym2612.c │ ├── ym2612.h │ ├── ym3438.c │ └── ym3438.h ├── state.c ├── state.h ├── system.c ├── system.h ├── tremor │ ├── CHANGELOG │ ├── COPYING │ ├── README │ ├── Version_script.in │ ├── asm_arm.h │ ├── backends.h │ ├── bitwise.c │ ├── block.c │ ├── block.h │ ├── codebook.c │ ├── codebook.h │ ├── codec_internal.h │ ├── config_types.h │ ├── configure.in │ ├── floor0.c │ ├── floor1.c │ ├── framing.c │ ├── info.c │ ├── ivorbiscodec.h │ ├── ivorbisfile.h │ ├── lsp_lookup.h │ ├── mapping0.c │ ├── mdct.c │ ├── mdct.h │ ├── mdct_lookup.h │ ├── misc.h │ ├── ogg.h │ ├── os.h │ ├── os_types.h │ ├── registry.c │ ├── registry.h │ ├── res012.c │ ├── sharedbook.c │ ├── synthesis.c │ ├── vorbisfile.c │ ├── window.c │ ├── window.h │ └── window_lookup.h ├── types.h ├── vdp_ctrl.c ├── vdp_ctrl.h ├── vdp_render.c ├── vdp_render.h └── z80 │ ├── osd_cpu.h │ ├── z80.c │ └── z80.h ├── gui ├── edit_fields.cpp ├── edit_fields.h ├── gens2.ico ├── gui.c ├── gui.h ├── gui.manifest ├── gui.rc ├── hex_editor.cpp ├── hex_editor.h ├── plane_explorer.c ├── plane_explorer.h ├── resource.h ├── vdp_ram_debug.cpp └── vdp_ram_debug.h ├── gx └── osd.h ├── ida ├── bpts_window.h ├── ida_debmod.h ├── ida_debug.cpp ├── ida_plugin.cpp ├── ida_plugin.h └── moc_bpts_window.cpp └── libretro ├── libretro-common ├── compat │ ├── compat_strl.c │ └── fopen_utf8.c ├── encodings │ └── encoding_utf.c ├── include │ ├── boolean.h │ ├── compat │ │ ├── apple_compat.h │ │ ├── fnmatch.h │ │ ├── fopen_utf8.h │ │ ├── getopt.h │ │ ├── ifaddrs.h │ │ ├── intrinsics.h │ │ ├── msvc.h │ │ ├── msvc │ │ │ └── stdint.h │ │ ├── posix_string.h │ │ ├── strcasestr.h │ │ ├── strl.h │ │ ├── zconf.h │ │ ├── zconf.h.in │ │ ├── zlib.h │ │ └── zutil.h │ ├── encodings │ │ └── utf.h │ ├── libretro.h │ ├── memmap.h │ ├── retro_common.h │ ├── retro_common_api.h │ ├── retro_inline.h │ ├── streams │ │ ├── file_stream.h │ │ └── file_stream_transforms.h │ └── vfs │ │ └── vfs_implementation.h ├── memmap │ └── memmap.c ├── streams │ ├── file_stream.c │ └── file_stream_transforms.c └── vfs │ └── vfs_implementation.c ├── libretro.c ├── libretro_msvc ├── gpgx_debugger.sln ├── gpgx_debugger.vcxproj ├── gpgx_debugger.vcxproj.filters ├── gpgx_debugger.vcxproj.user ├── gxida.vcxproj ├── gxida.vcxproj.filters ├── gxida.vcxproj.user ├── sega_roms_ldr.cpp ├── sega_roms_ldr.h ├── sega_roms_ldr.vcxproj ├── sega_roms_ldr.vcxproj.filters └── sega_roms_ldr.vcxproj.user ├── osd.h ├── scrc32.c └── scrc32.h /.gitignore: -------------------------------------------------------------------------------- 1 | .vs/ 2 | .idea/ 3 | /libretro/libretro_msvc/Debug_*/ 4 | /libretro/libretro_msvc/Release_*/ 5 | /libretro/libretro_msvc/x64/Debug_*/ 6 | /libretro/libretro_msvc/x64/Release_*/ 7 | /cmake-build-debug/ 8 | cmake-build-release/ 9 | psp2/*.o 10 | psp2/*.elf 11 | psp2/*.velf 12 | psp2/build_vita/* 13 | psp2/*.a 14 | sdl/gen_sdl 15 | sdl/gen_sdl2 16 | sdl/build_sdl 17 | sdl/build_sdl2 18 | 19 | *.o 20 | *.aps -------------------------------------------------------------------------------- /HISTORY.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/gpgx_debugger/cb3f64ad8da177821b5c090a31205f8ffc54424c/HISTORY.txt -------------------------------------------------------------------------------- /core/cart_hw/areplay.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Genesis Plus 3 | * DATEL Action Replay / Pro Action Replay emulation 4 | * 5 | * Copyright (C) 2009-2014 Eke-Eke (Genesis Plus GX) 6 | * 7 | * Redistribution and use of this code or any derivative works are permitted 8 | * provided that the following conditions are met: 9 | * 10 | * - Redistributions may not be sold, nor may they be used in a commercial 11 | * product or activity. 12 | * 13 | * - Redistributions that are modified from the original source must include the 14 | * complete source code, including the source code for all components used by a 15 | * binary built from the modified sources. However, as a special exception, the 16 | * source code distributed need not include anything that is normally distributed 17 | * (in either source or binary form) with the major components (compiler, kernel, 18 | * and so on) of the operating system on which the executable runs, unless that 19 | * component itself accompanies the executable. 20 | * 21 | * - Redistributions must reproduce the above copyright notice, this list of 22 | * conditions and the following disclaimer in the documentation and/or other 23 | * materials provided with the distribution. 24 | * 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 29 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 | * POSSIBILITY OF SUCH DAMAGE. 36 | * 37 | ****************************************************************************************/ 38 | 39 | #ifndef _AREPLAY_H_ 40 | #define _AREPLAY_H_ 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | #define AR_SWITCH_OFF (0) 47 | #define AR_SWITCH_ON (1) 48 | #define AR_SWITCH_TRAINER (2) 49 | 50 | extern void areplay_init(void); 51 | extern void areplay_shutdown(void); 52 | extern void areplay_reset(int hard); 53 | extern void areplay_set_status(int status); 54 | extern int areplay_get_status(void); 55 | 56 | #ifdef __cplusplus 57 | } 58 | #endif 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /core/cart_hw/eeprom_93c.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Genesis Plus 3 | * Microwire Serial EEPROM (93C46 only) support 4 | * 5 | * Copyright (C) 2011 Eke-Eke (Genesis Plus GX) 6 | * 7 | * Redistribution and use of this code or any derivative works are permitted 8 | * provided that the following conditions are met: 9 | * 10 | * - Redistributions may not be sold, nor may they be used in a commercial 11 | * product or activity. 12 | * 13 | * - Redistributions that are modified from the original source must include the 14 | * complete source code, including the source code for all components used by a 15 | * binary built from the modified sources. However, as a special exception, the 16 | * source code distributed need not include anything that is normally distributed 17 | * (in either source or binary form) with the major components (compiler, kernel, 18 | * and so on) of the operating system on which the executable runs, unless that 19 | * component itself accompanies the executable. 20 | * 21 | * - Redistributions must reproduce the above copyright notice, this list of 22 | * conditions and the following disclaimer in the documentation and/or other 23 | * materials provided with the distribution. 24 | * 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 29 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 | * POSSIBILITY OF SUCH DAMAGE. 36 | * 37 | ****************************************************************************************/ 38 | 39 | #ifndef _EEPROM_93C_H_ 40 | #define _EEPROM_93C_H_ 41 | 42 | typedef enum 43 | { 44 | WAIT_STANDBY, 45 | WAIT_START, 46 | GET_OPCODE, 47 | WRITE_WORD, 48 | READ_WORD 49 | } T_STATE_93C; 50 | 51 | typedef struct 52 | { 53 | uint8 enabled; /* 1: chip enabled */ 54 | uint8 cs; /* CHIP SELECT line state */ 55 | uint8 clk; /* CLK line state */ 56 | uint8 data; /* DATA OUT line state */ 57 | uint8 cycles; /* current operation cycle */ 58 | uint8 we; /* 1: write enabled */ 59 | uint8 opcode; /* 8-bit opcode + address */ 60 | uint16 buffer; /* 16-bit data buffer */ 61 | T_STATE_93C state; /* current operation state */ 62 | } T_EEPROM_93C; 63 | 64 | /* global variables */ 65 | extern T_EEPROM_93C eeprom_93c; 66 | 67 | /* Function prototypes */ 68 | extern void eeprom_93c_init(); 69 | extern void eeprom_93c_write(unsigned char data); 70 | extern unsigned char eeprom_93c_read(void); 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /core/cart_hw/eeprom_i2c.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Genesis Plus 3 | * I2C Serial EEPROM (24Cxx) boards 4 | * 5 | * Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX) 6 | * 7 | * Redistribution and use of this code or any derivative works are permitted 8 | * provided that the following conditions are met: 9 | * 10 | * - Redistributions may not be sold, nor may they be used in a commercial 11 | * product or activity. 12 | * 13 | * - Redistributions that are modified from the original source must include the 14 | * complete source code, including the source code for all components used by a 15 | * binary built from the modified sources. However, as a special exception, the 16 | * source code distributed need not include anything that is normally distributed 17 | * (in either source or binary form) with the major components (compiler, kernel, 18 | * and so on) of the operating system on which the executable runs, unless that 19 | * component itself accompanies the executable. 20 | * 21 | * - Redistributions must reproduce the above copyright notice, this list of 22 | * conditions and the following disclaimer in the documentation and/or other 23 | * materials provided with the distribution. 24 | * 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 29 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 | * POSSIBILITY OF SUCH DAMAGE. 36 | * 37 | ****************************************************************************************/ 38 | 39 | #ifndef _EEPROM_I2C_H_ 40 | #define _EEPROM_I2C_H_ 41 | 42 | /* Function prototypes */ 43 | extern void eeprom_i2c_init(); 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /core/cart_hw/eeprom_spi.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Genesis Plus 3 | * SPI Serial EEPROM (25XX512 only) support 4 | * 5 | * Copyright (C) 2012 Eke-Eke (Genesis Plus GX) 6 | * 7 | * Redistribution and use of this code or any derivative works are permitted 8 | * provided that the following conditions are met: 9 | * 10 | * - Redistributions may not be sold, nor may they be used in a commercial 11 | * product or activity. 12 | * 13 | * - Redistributions that are modified from the original source must include the 14 | * complete source code, including the source code for all components used by a 15 | * binary built from the modified sources. However, as a special exception, the 16 | * source code distributed need not include anything that is normally distributed 17 | * (in either source or binary form) with the major components (compiler, kernel, 18 | * and so on) of the operating system on which the executable runs, unless that 19 | * component itself accompanies the executable. 20 | * 21 | * - Redistributions must reproduce the above copyright notice, this list of 22 | * conditions and the following disclaimer in the documentation and/or other 23 | * materials provided with the distribution. 24 | * 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 29 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 | * POSSIBILITY OF SUCH DAMAGE. 36 | * 37 | ****************************************************************************************/ 38 | 39 | #ifndef _EEPROM_SPI_H_ 40 | #define _EEPROM_SPI_H_ 41 | 42 | /* Function prototypes */ 43 | extern void eeprom_spi_init(); 44 | extern void eeprom_spi_write(unsigned char data); 45 | extern unsigned int eeprom_spi_read(unsigned int address); 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /core/cart_hw/ggenie.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Genesis Plus 3 | * Game Genie Hardware emulation 4 | * 5 | * Copyright (C) 2009-2014 Eke-Eke (Genesis Plus GX) 6 | * 7 | * Based on documentation from Charles McDonald 8 | * (http://cgfm2.emuviews.com/txt/genie.txt) 9 | * 10 | * Redistribution and use of this code or any derivative works are permitted 11 | * provided that the following conditions are met: 12 | * 13 | * - Redistributions may not be sold, nor may they be used in a commercial 14 | * product or activity. 15 | * 16 | * - Redistributions that are modified from the original source must include the 17 | * complete source code, including the source code for all components used by a 18 | * binary built from the modified sources. However, as a special exception, the 19 | * source code distributed need not include anything that is normally distributed 20 | * (in either source or binary form) with the major components (compiler, kernel, 21 | * and so on) of the operating system on which the executable runs, unless that 22 | * component itself accompanies the executable. 23 | * 24 | * - Redistributions must reproduce the above copyright notice, this list of 25 | * conditions and the following disclaimer in the documentation and/or other 26 | * materials provided with the distribution. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 29 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 30 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 31 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 32 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 33 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 34 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 35 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 36 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 37 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 | * POSSIBILITY OF SUCH DAMAGE. 39 | * 40 | ****************************************************************************************/ 41 | 42 | #ifndef _GGENIE_H_ 43 | #define _GGENIE_H_ 44 | 45 | #ifdef __cplusplus 46 | extern "C" { 47 | #endif 48 | 49 | /* Function prototypes */ 50 | extern void ggenie_init(void); 51 | extern void ggenie_shutdown(void); 52 | extern void ggenie_reset(int hard); 53 | extern void ggenie_switch(int enable); 54 | 55 | #ifdef __cplusplus 56 | } 57 | #endif 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /core/cart_hw/sms_cart.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/gpgx_debugger/cb3f64ad8da177821b5c090a31205f8ffc54424c/core/cart_hw/sms_cart.c -------------------------------------------------------------------------------- /core/cart_hw/sms_cart.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Genesis Plus 3 | * SG-1000, Master System & Game Gear cartridge hardware support 4 | * 5 | * Copyright (C) 2007-2020 Eke-Eke (Genesis Plus GX) 6 | * 7 | * Redistribution and use of this code or any derivative works are permitted 8 | * provided that the following conditions are met: 9 | * 10 | * - Redistributions may not be sold, nor may they be used in a commercial 11 | * product or activity. 12 | * 13 | * - Redistributions that are modified from the original source must include the 14 | * complete source code, including the source code for all components used by a 15 | * binary built from the modified sources. However, as a special exception, the 16 | * source code distributed need not include anything that is normally distributed 17 | * (in either source or binary form) with the major components (compiler, kernel, 18 | * and so on) of the operating system on which the executable runs, unless that 19 | * component itself accompanies the executable. 20 | * 21 | * - Redistributions must reproduce the above copyright notice, this list of 22 | * conditions and the following disclaimer in the documentation and/or other 23 | * materials provided with the distribution. 24 | * 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 29 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 | * POSSIBILITY OF SUCH DAMAGE. 36 | * 37 | ****************************************************************************************/ 38 | 39 | #ifndef _SMS_CART_H_ 40 | #define _SMS_CART_H_ 41 | 42 | /* Special hardware */ 43 | #define HW_3D_GLASSES 0x01 44 | #define HW_TEREBI_OEKAKI 0x02 45 | 46 | /* Function prototypes */ 47 | extern void sms_cart_init(void); 48 | extern void sms_cart_reset(void); 49 | extern void sms_cart_switch(uint8 mode); 50 | extern int sms_cart_region_detect(void); 51 | extern int sms_cart_context_save(uint8 *state); 52 | extern int sms_cart_context_load(uint8 *state); 53 | 54 | #endif 55 | 56 | 57 | -------------------------------------------------------------------------------- /core/cart_hw/sram.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************************** 2 | * Genesis Plus 3 | * Backup RAM support 4 | * 5 | * Copyright (C) 2007-2020 Eke-Eke (Genesis Plus GX) 6 | * 7 | * Redistribution and use of this code or any derivative works are permitted 8 | * provided that the following conditions are met: 9 | * 10 | * - Redistributions may not be sold, nor may they be used in a commercial 11 | * product or activity. 12 | * 13 | * - Redistributions that are modified from the original source must include the 14 | * complete source code, including the source code for all components used by a 15 | * binary built from the modified sources. However, as a special exception, the 16 | * source code distributed need not include anything that is normally distributed 17 | * (in either source or binary form) with the major components (compiler, kernel, 18 | * and so on) of the operating system on which the executable runs, unless that 19 | * component itself accompanies the executable. 20 | * 21 | * - Redistributions must reproduce the above copyright notice, this list of 22 | * conditions and the following disclaimer in the documentation and/or other 23 | * materials provided with the distribution. 24 | * 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 29 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 | * POSSIBILITY OF SUCH DAMAGE. 36 | * 37 | ****************************************************************************************/ 38 | 39 | #ifndef _SRAM_H_ 40 | #define _SRAM_H_ 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | typedef struct 47 | { 48 | uint8 detected; 49 | uint8 on; 50 | uint8 custom; 51 | uint32 start; 52 | uint32 end; 53 | uint32 crc; 54 | uint8 *sram; 55 | } T_SRAM; 56 | 57 | /* Function prototypes */ 58 | extern void sram_init(); 59 | extern unsigned int sram_read_byte(unsigned int address); 60 | extern unsigned int sram_read_word(unsigned int address); 61 | extern void sram_write_byte(unsigned int address, unsigned int data); 62 | extern void sram_write_word(unsigned int address, unsigned int data); 63 | 64 | /* global variables */ 65 | extern T_SRAM sram; 66 | 67 | #ifdef __cplusplus 68 | } 69 | #endif 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /core/cart_hw/svp/ssp16.h: -------------------------------------------------------------------------------- 1 | /* 2 | basic, incomplete SSP160x (SSP1601?) interpreter 3 | with SVP memory controller emu 4 | 5 | (c) Copyright 2008, Grazvydas "notaz" Ignotas 6 | Free for non-commercial use. 7 | 8 | For commercial use, separate licencing terms must be obtained. 9 | 10 | Modified for Genesis Plus GX (Eke-Eke): added BIG ENDIAN support, fixed addr/code inversion 11 | */ 12 | 13 | #ifndef _SSP16_H_ 14 | #define _SSP16_H_ 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | /* emulation event logging (from Picodrive) */ 21 | #ifdef LOG_SVP 22 | #define EL_SVP 0x00004000 /* SVP stuff */ 23 | #define EL_ANOMALY 0x80000000 /* some unexpected conditions (during emulation) */ 24 | #define elprintf(w,f,...) error("%d(%d): " f "\n",frame_count,v_counter,##__VA_ARGS__); 25 | #endif 26 | 27 | /* register names */ 28 | enum { 29 | SSP_GR0, SSP_X, SSP_Y, SSP_A, 30 | SSP_ST, SSP_STACK, SSP_PC, SSP_P, 31 | SSP_PM0, SSP_PM1, SSP_PM2, SSP_XST, 32 | SSP_PM4, SSP_gr13, SSP_PMC, SSP_AL 33 | }; 34 | 35 | typedef union 36 | { 37 | unsigned int v; 38 | struct { 39 | #ifdef LSB_FIRST 40 | unsigned short l; 41 | unsigned short h; 42 | #else 43 | unsigned short h; 44 | unsigned short l; 45 | #endif 46 | } byte; 47 | } ssp_reg_t; 48 | 49 | typedef struct 50 | { 51 | union { 52 | unsigned short RAM[256*2]; /* 2 internal RAM banks */ 53 | struct { 54 | unsigned short RAM0[256]; 55 | unsigned short RAM1[256]; 56 | } bank; 57 | } mem; 58 | ssp_reg_t gr[16]; /* general registers */ 59 | union { 60 | unsigned char r[8]; /* BANK pointers */ 61 | struct { 62 | unsigned char r0[4]; 63 | unsigned char r1[4]; 64 | } bank; 65 | } ptr; 66 | unsigned short stack[6]; 67 | unsigned int pmac[2][6]; /* read/write modes/addrs for PM0-PM5 */ 68 | #define SSP_PMC_HAVE_ADDR 0x0001 /* address written to PMAC, waiting for mode */ 69 | #define SSP_PMC_SET 0x0002 /* PMAC is set */ 70 | #define SSP_HANG 0x1000 /* 68000 hangs SVP */ 71 | #define SSP_WAIT_PM0 0x2000 /* bit1 in PM0 */ 72 | #define SSP_WAIT_30FE06 0x4000 /* ssp tight loops on 30FE08 to become non-zero */ 73 | #define SSP_WAIT_30FE08 0x8000 /* same for 30FE06 */ 74 | #define SSP_WAIT_MASK 0xf000 75 | unsigned int emu_status; 76 | unsigned int pad[30]; 77 | } ssp1601_t; 78 | 79 | 80 | void ssp1601_reset(ssp1601_t *ssp); 81 | void ssp1601_run(int cycles); 82 | 83 | #ifdef __cplusplus 84 | } 85 | #endif 86 | 87 | #endif 88 | -------------------------------------------------------------------------------- /core/cart_hw/svp/svp.c: -------------------------------------------------------------------------------- 1 | /* 2 | basic, incomplete SSP160x (SSP1601?) interpreter 3 | with SVP memory controller emu 4 | 5 | (c) Copyright 2008, Grazvydas "notaz" Ignotas 6 | Free for non-commercial use. 7 | 8 | For commercial use, separate licencing terms must be obtained. 9 | 10 | Modified for Genesis Plus GX (Eke-Eke): added BIG ENDIAN support, fixed addr/code inversion 11 | */ 12 | 13 | #include "shared.h" 14 | 15 | svp_t *svp; 16 | 17 | static void svp_write_dram(uint32 address, uint32 data) 18 | { 19 | *(uint16 *)(svp->dram + (address & 0x1fffe)) = data; 20 | if (data) 21 | { 22 | if (address == 0x30fe06) svp->ssp1601.emu_status &= ~SSP_WAIT_30FE06; 23 | else if (address == 0x30fe08) svp->ssp1601.emu_status &= ~SSP_WAIT_30FE08; 24 | } 25 | } 26 | 27 | static uint32 svp_read_cell_1(uint32 address) 28 | { 29 | address = (address & 0xe002) | ((address & 0x7c) << 6) | ((address & 0x1f80) >> 5); 30 | return *(uint16 *)(svp->dram + address); 31 | } 32 | 33 | static uint32 svp_read_cell_2(uint32 address) 34 | { 35 | address = (address & 0xf002) | ((address & 0x3c) << 6) | ((address & 0xfc0) >> 4); 36 | return *(uint16 *)(svp->dram + address); 37 | } 38 | 39 | static uint32 svp_read_cell_byte(uint32 address) 40 | { 41 | uint16 data = m68k.memory_map[address >> 16].read16(address); 42 | 43 | if (address & 0x01) 44 | { 45 | return (data & 0xff); 46 | } 47 | 48 | return (data >> 8); 49 | } 50 | 51 | void svp_init(void) 52 | { 53 | svp = (void *) ((char *)cart.rom + 0x200000); 54 | memset(svp, 0, sizeof(*svp)); 55 | 56 | m68k.memory_map[0x30].base = svp->dram; 57 | m68k.memory_map[0x30].read8 = NULL; 58 | m68k.memory_map[0x30].read16 = NULL; 59 | m68k.memory_map[0x30].write8 = NULL; 60 | m68k.memory_map[0x30].write16 = svp_write_dram; 61 | zbank_memory_map[0x30].read = NULL; 62 | zbank_memory_map[0x30].write = NULL; 63 | 64 | m68k.memory_map[0x31].base = svp->dram + 0x10000; 65 | m68k.memory_map[0x31].read8 = NULL; 66 | m68k.memory_map[0x31].read16 = NULL; 67 | m68k.memory_map[0x31].write8 = NULL; 68 | m68k.memory_map[0x31].write16 = NULL; 69 | zbank_memory_map[0x31].read = NULL; 70 | zbank_memory_map[0x31].write = NULL; 71 | 72 | m68k.memory_map[0x39].read8 = svp_read_cell_byte; 73 | m68k.memory_map[0x39].read16 = svp_read_cell_1; 74 | zbank_memory_map[0x39].read = svp_read_cell_byte; 75 | m68k.memory_map[0x3a].read8 = svp_read_cell_byte; 76 | m68k.memory_map[0x3a].read16 = svp_read_cell_2; 77 | zbank_memory_map[0x3a].read = svp_read_cell_byte; 78 | } 79 | 80 | void svp_reset(void) 81 | { 82 | memcpy(svp->iram_rom + 0x800, cart.rom + 0x800, 0x20000 - 0x800); 83 | ssp1601_reset(&svp->ssp1601); 84 | } 85 | 86 | -------------------------------------------------------------------------------- /core/cart_hw/svp/svp.h: -------------------------------------------------------------------------------- 1 | /* 2 | basic, incomplete SSP160x (SSP1601?) interpreter 3 | with SVP memory controller emu 4 | 5 | (c) Copyright 2008, Grazvydas "notaz" Ignotas 6 | Free for non-commercial use. 7 | 8 | For commercial use, separate licencing terms must be obtained. 9 | 10 | Modified for Genesis Plus GX (Eke-Eke): added BIG ENDIAN support, fixed addr/code inversion 11 | */ 12 | 13 | #ifndef _SVP_H_ 14 | #define _SVP_H_ 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | #include "shared.h" 21 | #include "ssp16.h" 22 | 23 | typedef struct { 24 | unsigned char iram_rom[0x20000]; /* IRAM (0-0x7ff) and program ROM (0x800-0x1ffff) */ 25 | unsigned char dram[0x20000]; 26 | ssp1601_t ssp1601; 27 | } svp_t; 28 | 29 | extern svp_t *svp; 30 | 31 | extern void svp_init(void); 32 | extern void svp_reset(void); 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /core/cd_hw/cd_cart.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************************** 2 | * Genesis Plus 3 | * CD compatible ROM/RAM cartridge support 4 | * 5 | * Copyright (C) 2012-2016 Eke-Eke (Genesis Plus GX) 6 | * 7 | * Redistribution and use of this code or any derivative works are permitted 8 | * provided that the following conditions are met: 9 | * 10 | * - Redistributions may not be sold, nor may they be used in a commercial 11 | * product or activity. 12 | * 13 | * - Redistributions that are modified from the original source must include the 14 | * complete source code, including the source code for all components used by a 15 | * binary built from the modified sources. However, as a special exception, the 16 | * source code distributed need not include anything that is normally distributed 17 | * (in either source or binary form) with the major components (compiler, kernel, 18 | * and so on) of the operating system on which the executable runs, unless that 19 | * component itself accompanies the executable. 20 | * 21 | * - Redistributions must reproduce the above copyright notice, this list of 22 | * conditions and the following disclaimer in the documentation and/or other 23 | * materials provided with the distribution. 24 | * 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 29 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 | * POSSIBILITY OF SUCH DAMAGE. 36 | * 37 | ****************************************************************************************/ 38 | 39 | 40 | /* CD compatible ROM/RAM cartridge */ 41 | typedef struct 42 | { 43 | uint8 reserved[0x80]; /* reserved for ROM cartridge infos (see md_cart.h) */ 44 | uint8 area[0x840000]; /* cartridge ROM/RAM area (max. 8MB ROM + 64KB backup memory + Pro Action Replay 128KB ROM / 64KB RAM) */ 45 | uint8 boot; /* cartridge boot mode (0x00: boot from CD with ROM/RAM cartridge enabled, 0x40: boot from ROM cartridge with CD enabled) */ 46 | uint8 id; /* RAM cartridge ID (related to RAM size, 0 if disabled) */ 47 | uint8 prot; /* RAM cartridge write protection */ 48 | uint32 mask; /* RAM cartridge size mask */ 49 | } cd_cart_t; 50 | 51 | /* Function prototypes */ 52 | extern void cd_cart_init(void); 53 | -------------------------------------------------------------------------------- /core/cd_hw/cdc.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************************** 2 | * Genesis Plus 3 | * CD data controller (LC8951x compatible) 4 | * 5 | * Copyright (C) 2012-2019 Eke-Eke (Genesis Plus GX) 6 | * 7 | * Redistribution and use of this code or any derivative works are permitted 8 | * provided that the following conditions are met: 9 | * 10 | * - Redistributions may not be sold, nor may they be used in a commercial 11 | * product or activity. 12 | * 13 | * - Redistributions that are modified from the original source must include the 14 | * complete source code, including the source code for all components used by a 15 | * binary built from the modified sources. However, as a special exception, the 16 | * source code distributed need not include anything that is normally distributed 17 | * (in either source or binary form) with the major components (compiler, kernel, 18 | * and so on) of the operating system on which the executable runs, unless that 19 | * component itself accompanies the executable. 20 | * 21 | * - Redistributions must reproduce the above copyright notice, this list of 22 | * conditions and the following disclaimer in the documentation and/or other 23 | * materials provided with the distribution. 24 | * 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 29 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 | * POSSIBILITY OF SUCH DAMAGE. 36 | * 37 | ****************************************************************************************/ 38 | #ifndef _HW_CDC_ 39 | #define _HW_CDC_ 40 | 41 | #define cdc scd.cdc_hw 42 | 43 | /* CDC hardware */ 44 | typedef struct 45 | { 46 | uint8 ifstat; 47 | uint8 ifctrl; 48 | reg16_t dbc; 49 | reg16_t dac; 50 | reg16_t pt; 51 | reg16_t wa; 52 | uint8 ctrl[2]; 53 | uint8 head[2][4]; 54 | uint8 stat[4]; 55 | int cycles; 56 | void (*dma_w)(unsigned int words); /* DMA transfer callback */ 57 | uint8 ram[0x4000 + 2352]; /* 16K external RAM (with one block overhead to handle buffer overrun) */ 58 | } cdc_t; 59 | 60 | /* Function prototypes */ 61 | extern void cdc_init(void); 62 | extern void cdc_reset(void); 63 | extern int cdc_context_save(uint8 *state); 64 | extern int cdc_context_load(uint8 *state); 65 | extern void cdc_dma_update(void); 66 | extern void cdc_decoder_update(uint32 header); 67 | extern void cdc_reg_w(unsigned char data); 68 | extern unsigned char cdc_reg_r(void); 69 | extern unsigned short cdc_host_r(void); 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /core/cd_hw/libchdr/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright Romain Tisserand 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of the nor the 12 | names of its contributors may be used to endorse or promote products 13 | derived from this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY 19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /core/cd_hw/libchdr/README.md: -------------------------------------------------------------------------------- 1 | # libchdr 2 | 3 | libchdr is a standalone library for reading MAME's CHDv1-v5 formats. 4 | 5 | The code is based off of MAME's old C codebase which read up to CHDv4 with OS-dependent features removed, and CHDv5 support backported from MAME's current C++ codebase. 6 | 7 | libchdr is licensed under the BSD 3-Clause (see [LICENSE.txt](LICENSE.txt)) and uses third party libraries that are each distributed under their own terms (see each library's license in [deps/](deps/)). 8 | -------------------------------------------------------------------------------- /core/cd_hw/libchdr/deps/libFLAC/AUTHORS: -------------------------------------------------------------------------------- 1 | /* FLAC - Free Lossless Audio Codec 2 | * Copyright (C) 2001-2009 Josh Coalson 3 | * Copyright (C) 2011-2016 Xiph.Org Foundation 4 | * 5 | * This file is part the FLAC project. FLAC is comprised of several 6 | * components distributed under different licenses. The codec libraries 7 | * are distributed under Xiph.Org's BSD-like license (see the file 8 | * COPYING.Xiph in this distribution). All other programs, libraries, and 9 | * plugins are distributed under the GPL (see COPYING.GPL). The documentation 10 | * is distributed under the Gnu FDL (see COPYING.FDL). Each file in the 11 | * FLAC distribution contains at the top the terms under which it may be 12 | * distributed. 13 | * 14 | * Since this particular file is relevant to all components of FLAC, 15 | * it may be distributed under the Xiph.Org license, which is the least 16 | * restrictive of those mentioned above. See the file COPYING.Xiph in this 17 | * distribution. 18 | */ 19 | 20 | Current FLAC maintainer: Erik de Castro Lopo 21 | 22 | Original author: Josh Coalson 23 | 24 | Website : https://www.xiph.org/flac/ 25 | 26 | FLAC is an Open Source lossless audio codec originally developed by Josh Coalson 27 | between 2001 and 2009. From 2009 to 2012 FLAC was basically unmaintained. In 28 | 2012 the Erik de Castro Lopo became the chief maintainer as part of the 29 | Xiph.Org Foundation. 30 | 31 | Other major contributors and their contributions: 32 | 33 | "lvqcl" 34 | * Visual Studio build system. 35 | * Optimisations in the encoder and decoder. 36 | 37 | "Janne Hyvärinen" 38 | * Visual Studio build system. 39 | * Unicode handling on Windows. 40 | 41 | "Andrey Astafiev" 42 | * Russian translation of the HTML documentation 43 | 44 | "Miroslav Lichvar" 45 | * IA-32 assembly versions of several libFLAC routines 46 | 47 | "Brady Patterson" 48 | * AIFF file support, PPC assembly versions of libFLAC routines 49 | 50 | "Daisuke Shimamura" 51 | * i18n support in the XMMS plugin 52 | 53 | "X-Fixer" 54 | * Configuration system, tag editing, and file info in the Winamp2 plugin 55 | 56 | "Matt Zimmerman" 57 | * Libtool/autoconf/automake make system, flac man page 58 | 59 | -------------------------------------------------------------------------------- /core/cd_hw/libchdr/deps/libFLAC/COPYING.Xiph: -------------------------------------------------------------------------------- 1 | Copyright (C) 2000-2009 Josh Coalson 2 | Copyright (C) 2011-2016 Xiph.Org Foundation 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions 6 | are met: 7 | 8 | - Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 11 | - Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | 15 | - Neither the name of the Xiph.org Foundation nor the names of its 16 | contributors may be used to endorse or promote products derived from 17 | this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 23 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 24 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 25 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 26 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /core/cd_hw/libchdr/deps/libFLAC/bitmath.c: -------------------------------------------------------------------------------- 1 | /* libFLAC - Free Lossless Audio Codec library 2 | * Copyright (C) 2001-2009 Josh Coalson 3 | * Copyright (C) 2011-2016 Xiph.Org Foundation 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * - Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * - Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * - Neither the name of the Xiph.org Foundation nor the names of its 17 | * contributors may be used to endorse or promote products derived from 18 | * this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | #ifdef HAVE_CONFIG_H 34 | # include 35 | #endif 36 | 37 | #include "private/bitmath.h" 38 | 39 | /* An example of what FLAC__bitmath_silog2() computes: 40 | * 41 | * silog2(-10) = 5 42 | * silog2(- 9) = 5 43 | * silog2(- 8) = 4 44 | * silog2(- 7) = 4 45 | * silog2(- 6) = 4 46 | * silog2(- 5) = 4 47 | * silog2(- 4) = 3 48 | * silog2(- 3) = 3 49 | * silog2(- 2) = 2 50 | * silog2(- 1) = 2 51 | * silog2( 0) = 0 52 | * silog2( 1) = 2 53 | * silog2( 2) = 3 54 | * silog2( 3) = 3 55 | * silog2( 4) = 4 56 | * silog2( 5) = 4 57 | * silog2( 6) = 4 58 | * silog2( 7) = 4 59 | * silog2( 8) = 5 60 | * silog2( 9) = 5 61 | * silog2( 10) = 5 62 | */ 63 | unsigned FLAC__bitmath_silog2(FLAC__int64 v) 64 | { 65 | if(v == 0) 66 | return 0; 67 | 68 | if(v == -1) 69 | return 2; 70 | 71 | v = (v < 0) ? (-(v+1)) : v; 72 | return FLAC__bitmath_ilog2_wide(v)+2; 73 | } 74 | -------------------------------------------------------------------------------- /core/cd_hw/libchdr/deps/libFLAC/include/FLAC/assert.h: -------------------------------------------------------------------------------- 1 | /* libFLAC - Free Lossless Audio Codec library 2 | * Copyright (C) 2001-2009 Josh Coalson 3 | * Copyright (C) 2011-2016 Xiph.Org Foundation 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * - Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * - Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * - Neither the name of the Xiph.org Foundation nor the names of its 17 | * contributors may be used to endorse or promote products derived from 18 | * this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | #ifndef FLAC__ASSERT_H 34 | #define FLAC__ASSERT_H 35 | 36 | /* we need this since some compilers (like MSVC) leave assert()s on release code (and we don't want to use their ASSERT) */ 37 | #ifdef DEBUG 38 | #include 39 | #define FLAC__ASSERT(x) assert(x) 40 | #define FLAC__ASSERT_DECLARATION(x) x 41 | #else 42 | #define FLAC__ASSERT(x) 43 | #define FLAC__ASSERT_DECLARATION(x) 44 | #endif 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /core/cd_hw/libchdr/deps/libFLAC/include/FLAC/ordinals.h: -------------------------------------------------------------------------------- 1 | /* libFLAC - Free Lossless Audio Codec library 2 | * Copyright (C) 2000-2009 Josh Coalson 3 | * Copyright (C) 2011-2016 Xiph.Org Foundation 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * - Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * - Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * - Neither the name of the Xiph.org Foundation nor the names of its 17 | * contributors may be used to endorse or promote products derived from 18 | * this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | #ifndef FLAC__ORDINALS_H 34 | #define FLAC__ORDINALS_H 35 | 36 | #if defined(_MSC_VER) && _MSC_VER < 1600 37 | 38 | /* Microsoft Visual Studio earlier than the 2010 version did not provide 39 | * the 1999 ISO C Standard header file . 40 | */ 41 | 42 | typedef __int8 FLAC__int8; 43 | typedef unsigned __int8 FLAC__uint8; 44 | 45 | typedef __int16 FLAC__int16; 46 | typedef __int32 FLAC__int32; 47 | typedef __int64 FLAC__int64; 48 | typedef unsigned __int16 FLAC__uint16; 49 | typedef unsigned __int32 FLAC__uint32; 50 | typedef unsigned __int64 FLAC__uint64; 51 | 52 | #else 53 | 54 | /* For MSVC 2010 and everything else which provides . */ 55 | 56 | #include 57 | 58 | typedef int8_t FLAC__int8; 59 | typedef uint8_t FLAC__uint8; 60 | 61 | typedef int16_t FLAC__int16; 62 | typedef int32_t FLAC__int32; 63 | typedef int64_t FLAC__int64; 64 | typedef uint16_t FLAC__uint16; 65 | typedef uint32_t FLAC__uint32; 66 | typedef uint64_t FLAC__uint64; 67 | 68 | #endif 69 | 70 | typedef int FLAC__bool; 71 | 72 | typedef FLAC__uint8 FLAC__byte; 73 | 74 | 75 | #ifdef true 76 | #undef true 77 | #endif 78 | #ifdef false 79 | #undef false 80 | #endif 81 | #ifndef __cplusplus 82 | #define true 1 83 | #define false 0 84 | #endif 85 | 86 | #endif 87 | -------------------------------------------------------------------------------- /core/cd_hw/libchdr/deps/libFLAC/include/private/crc.h: -------------------------------------------------------------------------------- 1 | /* libFLAC - Free Lossless Audio Codec library 2 | * Copyright (C) 2000-2009 Josh Coalson 3 | * Copyright (C) 2011-2016 Xiph.Org Foundation 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * - Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * - Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * - Neither the name of the Xiph.org Foundation nor the names of its 17 | * contributors may be used to endorse or promote products derived from 18 | * this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | #ifndef FLAC__PRIVATE__CRC_H 34 | #define FLAC__PRIVATE__CRC_H 35 | 36 | #include "FLAC/ordinals.h" 37 | 38 | /* 8 bit CRC generator, MSB shifted first 39 | ** polynomial = x^8 + x^2 + x^1 + x^0 40 | ** init = 0 41 | */ 42 | extern FLAC__byte const FLAC__crc8_table[256]; 43 | #define FLAC__CRC8_UPDATE(data, crc) (crc) = FLAC__crc8_table[(crc) ^ (data)]; 44 | void FLAC__crc8_update(const FLAC__byte data, FLAC__uint8 *crc); 45 | void FLAC__crc8_update_block(const FLAC__byte *data, unsigned len, FLAC__uint8 *crc); 46 | FLAC__uint8 FLAC__crc8(const FLAC__byte *data, unsigned len); 47 | 48 | /* 16 bit CRC generator, MSB shifted first 49 | ** polynomial = x^16 + x^15 + x^2 + x^0 50 | ** init = 0 51 | */ 52 | extern unsigned const FLAC__crc16_table[256]; 53 | 54 | #define FLAC__CRC16_UPDATE(data, crc) ((((crc)<<8) & 0xffff) ^ FLAC__crc16_table[((crc)>>8) ^ (data)]) 55 | /* this alternate may be faster on some systems/compilers */ 56 | #if 0 57 | #define FLAC__CRC16_UPDATE(data, crc) ((((crc)<<8) ^ FLAC__crc16_table[((crc)>>8) ^ (data)]) & 0xffff) 58 | #endif 59 | 60 | unsigned FLAC__crc16(const FLAC__byte *data, unsigned len); 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /core/cd_hw/libchdr/deps/libFLAC/include/private/format.h: -------------------------------------------------------------------------------- 1 | /* libFLAC - Free Lossless Audio Codec library 2 | * Copyright (C) 2000-2009 Josh Coalson 3 | * Copyright (C) 2011-2016 Xiph.Org Foundation 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * - Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * - Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * - Neither the name of the Xiph.org Foundation nor the names of its 17 | * contributors may be used to endorse or promote products derived from 18 | * this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | #ifndef FLAC__PRIVATE__FORMAT_H 34 | #define FLAC__PRIVATE__FORMAT_H 35 | 36 | #include "FLAC/format.h" 37 | 38 | unsigned FLAC__format_get_max_rice_partition_order(unsigned blocksize, unsigned predictor_order); 39 | unsigned FLAC__format_get_max_rice_partition_order_from_blocksize(unsigned blocksize); 40 | unsigned FLAC__format_get_max_rice_partition_order_from_blocksize_limited_max_and_predictor_order(unsigned limit, unsigned blocksize, unsigned predictor_order); 41 | void FLAC__format_entropy_coding_method_partitioned_rice_contents_init(FLAC__EntropyCodingMethod_PartitionedRiceContents *object); 42 | void FLAC__format_entropy_coding_method_partitioned_rice_contents_clear(FLAC__EntropyCodingMethod_PartitionedRiceContents *object); 43 | FLAC__bool FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_size(FLAC__EntropyCodingMethod_PartitionedRiceContents *object, unsigned max_partition_order); 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /core/cd_hw/libchdr/deps/libFLAC/include/private/macros.h: -------------------------------------------------------------------------------- 1 | /* libFLAC - Free Lossless Audio Codec library 2 | * Copyright (C) 2012-2016 Xiph.org Foundation 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * - Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * - Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * - Neither the name of the Xiph.org Foundation nor the names of its 16 | * contributors may be used to endorse or promote products derived from 17 | * this software without specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 23 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 25 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | 32 | #ifndef FLAC__PRIVATE__MACROS_H 33 | #define FLAC__PRIVATE__MACROS_H 34 | 35 | #if defined(__GNUC__) && (__GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 3)) 36 | 37 | #define flac_max(a,b) \ 38 | ({ __typeof__ (a) _a = (a); \ 39 | __typeof__ (b) _b = (b); \ 40 | _a > _b ? _a : _b; }) 41 | 42 | #define MIN_PASTE(A,B) A##B 43 | #define MIN_IMPL(A,B,L) ({ \ 44 | __typeof__(A) MIN_PASTE(__a,L) = (A); \ 45 | __typeof__(B) MIN_PASTE(__b,L) = (B); \ 46 | MIN_PASTE(__a,L) < MIN_PASTE(__b,L) ? MIN_PASTE(__a,L) : MIN_PASTE(__b,L); \ 47 | }) 48 | 49 | #define flac_min(A,B) MIN_IMPL(A,B,__COUNTER__) 50 | 51 | /* Whatever other unix that has sys/param.h */ 52 | #elif defined(HAVE_SYS_PARAM_H) 53 | #include 54 | #define flac_max(a,b) MAX(a,b) 55 | #define flac_min(a,b) MIN(a,b) 56 | 57 | /* Windows VS has them in stdlib.h.. XXX:Untested */ 58 | #elif defined(_MSC_VER) 59 | #include 60 | #define flac_max(a,b) __max(a,b) 61 | #define flac_min(a,b) __min(a,b) 62 | #endif 63 | 64 | #ifndef MIN 65 | #define MIN(x,y) ((x) <= (y) ? (x) : (y)) 66 | #endif 67 | 68 | #ifndef MAX 69 | #define MAX(x,y) ((x) >= (y) ? (x) : (y)) 70 | #endif 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /core/cd_hw/libchdr/deps/libFLAC/include/private/md5.h: -------------------------------------------------------------------------------- 1 | #ifndef FLAC__PRIVATE__MD5_H 2 | #define FLAC__PRIVATE__MD5_H 3 | 4 | /* 5 | * This is the header file for the MD5 message-digest algorithm. 6 | * The algorithm is due to Ron Rivest. This code was 7 | * written by Colin Plumb in 1993, no copyright is claimed. 8 | * This code is in the public domain; do with it what you wish. 9 | * 10 | * Equivalent code is available from RSA Data Security, Inc. 11 | * This code has been tested against that, and is equivalent, 12 | * except that you don't need to include two pages of legalese 13 | * with every copy. 14 | * 15 | * To compute the message digest of a chunk of bytes, declare an 16 | * MD5Context structure, pass it to MD5Init, call MD5Update as 17 | * needed on buffers full of bytes, and then call MD5Final, which 18 | * will fill a supplied 16-byte array with the digest. 19 | * 20 | * Changed so as no longer to depend on Colin Plumb's `usual.h' 21 | * header definitions; now uses stuff from dpkg's config.h 22 | * - Ian Jackson . 23 | * Still in the public domain. 24 | * 25 | * Josh Coalson: made some changes to integrate with libFLAC. 26 | * Still in the public domain, with no warranty. 27 | */ 28 | 29 | #include "FLAC/ordinals.h" 30 | 31 | typedef union { 32 | FLAC__byte *p8; 33 | FLAC__int16 *p16; 34 | FLAC__int32 *p32; 35 | } FLAC__multibyte; 36 | 37 | typedef struct { 38 | FLAC__uint32 in[16]; 39 | FLAC__uint32 buf[4]; 40 | FLAC__uint32 bytes[2]; 41 | FLAC__multibyte internal_buf; 42 | size_t capacity; 43 | } FLAC__MD5Context; 44 | 45 | void FLAC__MD5Init(FLAC__MD5Context *context); 46 | void FLAC__MD5Final(FLAC__byte digest[16], FLAC__MD5Context *context); 47 | 48 | FLAC__bool FLAC__MD5Accumulate(FLAC__MD5Context *ctx, const FLAC__int32 * const signal[], unsigned channels, unsigned samples, unsigned bytes_per_sample); 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /core/cd_hw/libchdr/deps/libFLAC/include/private/memory.h: -------------------------------------------------------------------------------- 1 | /* libFLAC - Free Lossless Audio Codec library 2 | * Copyright (C) 2001-2009 Josh Coalson 3 | * Copyright (C) 2011-2016 Xiph.Org Foundation 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * - Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * - Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * - Neither the name of the Xiph.org Foundation nor the names of its 17 | * contributors may be used to endorse or promote products derived from 18 | * this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | #ifndef FLAC__PRIVATE__MEMORY_H 34 | #define FLAC__PRIVATE__MEMORY_H 35 | 36 | #ifdef HAVE_CONFIG_H 37 | #include 38 | #endif 39 | 40 | #include /* for size_t */ 41 | 42 | #include "private/float.h" 43 | #include "FLAC/ordinals.h" /* for FLAC__bool */ 44 | 45 | /* Returns the unaligned address returned by malloc. 46 | * Use free() on this address to deallocate. 47 | */ 48 | void *FLAC__memory_alloc_aligned(size_t bytes, void **aligned_address); 49 | FLAC__bool FLAC__memory_alloc_aligned_int32_array(size_t elements, FLAC__int32 **unaligned_pointer, FLAC__int32 **aligned_pointer); 50 | FLAC__bool FLAC__memory_alloc_aligned_uint32_array(size_t elements, FLAC__uint32 **unaligned_pointer, FLAC__uint32 **aligned_pointer); 51 | FLAC__bool FLAC__memory_alloc_aligned_uint64_array(size_t elements, FLAC__uint64 **unaligned_pointer, FLAC__uint64 **aligned_pointer); 52 | FLAC__bool FLAC__memory_alloc_aligned_unsigned_array(size_t elements, unsigned **unaligned_pointer, unsigned **aligned_pointer); 53 | #ifndef FLAC__INTEGER_ONLY_LIBRARY 54 | FLAC__bool FLAC__memory_alloc_aligned_real_array(size_t elements, FLAC__real **unaligned_pointer, FLAC__real **aligned_pointer); 55 | #endif 56 | void *safe_malloc_mul_2op_p(size_t size1, size_t size2); 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /core/cd_hw/libchdr/deps/libFLAC/include/protected/stream_decoder.h: -------------------------------------------------------------------------------- 1 | /* libFLAC - Free Lossless Audio Codec library 2 | * Copyright (C) 2000-2009 Josh Coalson 3 | * Copyright (C) 2011-2016 Xiph.Org Foundation 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * - Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * - Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * - Neither the name of the Xiph.org Foundation nor the names of its 17 | * contributors may be used to endorse or promote products derived from 18 | * this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 27 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | 33 | #ifndef FLAC__PROTECTED__STREAM_DECODER_H 34 | #define FLAC__PROTECTED__STREAM_DECODER_H 35 | 36 | #include "FLAC/stream_decoder.h" 37 | #if FLAC__HAS_OGG 38 | #include "private/ogg_decoder_aspect.h" 39 | #endif 40 | 41 | typedef struct FLAC__StreamDecoderProtected { 42 | FLAC__StreamDecoderState state; 43 | FLAC__StreamDecoderInitStatus initstate; 44 | unsigned channels; 45 | FLAC__ChannelAssignment channel_assignment; 46 | unsigned bits_per_sample; 47 | unsigned sample_rate; /* in Hz */ 48 | unsigned blocksize; /* in samples (per channel) */ 49 | FLAC__bool md5_checking; /* if true, generate MD5 signature of decoded data and compare against signature in the STREAMINFO metadata block */ 50 | #if FLAC__HAS_OGG 51 | FLAC__OggDecoderAspect ogg_decoder_aspect; 52 | #endif 53 | } FLAC__StreamDecoderProtected; 54 | 55 | /* 56 | * return the number of input bytes consumed 57 | */ 58 | unsigned FLAC__stream_decoder_get_input_bytes_unconsumed(const FLAC__StreamDecoder *decoder); 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /core/cd_hw/libchdr/deps/lzma/Compiler.h: -------------------------------------------------------------------------------- 1 | /* Compiler.h 2 | 2015-08-02 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __7Z_COMPILER_H 5 | #define __7Z_COMPILER_H 6 | 7 | #ifdef _MSC_VER 8 | 9 | #ifdef UNDER_CE 10 | #define RPC_NO_WINDOWS_H 11 | /* #pragma warning(disable : 4115) // '_RPC_ASYNC_STATE' : named type definition in parentheses */ 12 | #pragma warning(disable : 4201) // nonstandard extension used : nameless struct/union 13 | #pragma warning(disable : 4214) // nonstandard extension used : bit field types other than int 14 | #endif 15 | 16 | #if _MSC_VER >= 1300 17 | #pragma warning(disable : 4996) // This function or variable may be unsafe 18 | #else 19 | #pragma warning(disable : 4511) // copy constructor could not be generated 20 | #pragma warning(disable : 4512) // assignment operator could not be generated 21 | #pragma warning(disable : 4514) // unreferenced inline function has been removed 22 | #pragma warning(disable : 4702) // unreachable code 23 | #pragma warning(disable : 4710) // not inlined 24 | #pragma warning(disable : 4786) // identifier was truncated to '255' characters in the debug information 25 | #endif 26 | 27 | #endif 28 | 29 | #define UNUSED_VAR(x) (void)x; 30 | /* #define UNUSED_VAR(x) x=x; */ 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /core/cd_hw/libchdr/deps/lzma/DOC/lzma-history.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/gpgx_debugger/cb3f64ad8da177821b5c090a31205f8ffc54424c/core/cd_hw/libchdr/deps/lzma/DOC/lzma-history.txt -------------------------------------------------------------------------------- /core/cd_hw/libchdr/deps/lzma/LzHash.h: -------------------------------------------------------------------------------- 1 | /* LzHash.h -- HASH functions for LZ algorithms 2 | 2015-04-12 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __LZ_HASH_H 5 | #define __LZ_HASH_H 6 | 7 | #define kHash2Size (1 << 10) 8 | #define kHash3Size (1 << 16) 9 | #define kHash4Size (1 << 20) 10 | 11 | #define kFix3HashSize (kHash2Size) 12 | #define kFix4HashSize (kHash2Size + kHash3Size) 13 | #define kFix5HashSize (kHash2Size + kHash3Size + kHash4Size) 14 | 15 | #define HASH2_CALC hv = cur[0] | ((UInt32)cur[1] << 8); 16 | 17 | #define HASH3_CALC { \ 18 | UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ 19 | h2 = temp & (kHash2Size - 1); \ 20 | hv = (temp ^ ((UInt32)cur[2] << 8)) & p->hashMask; } 21 | 22 | #define HASH4_CALC { \ 23 | UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ 24 | h2 = temp & (kHash2Size - 1); \ 25 | temp ^= ((UInt32)cur[2] << 8); \ 26 | h3 = temp & (kHash3Size - 1); \ 27 | hv = (temp ^ (p->crc[cur[3]] << 5)) & p->hashMask; } 28 | 29 | #define HASH5_CALC { \ 30 | UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ 31 | h2 = temp & (kHash2Size - 1); \ 32 | temp ^= ((UInt32)cur[2] << 8); \ 33 | h3 = temp & (kHash3Size - 1); \ 34 | temp ^= (p->crc[cur[3]] << 5); \ 35 | h4 = temp & (kHash4Size - 1); \ 36 | hv = (temp ^ (p->crc[cur[4]] << 3)) & p->hashMask; } 37 | 38 | /* #define HASH_ZIP_CALC hv = ((cur[0] | ((UInt32)cur[1] << 8)) ^ p->crc[cur[2]]) & 0xFFFF; */ 39 | #define HASH_ZIP_CALC hv = ((cur[2] | ((UInt32)cur[0] << 8)) ^ p->crc[cur[1]]) & 0xFFFF; 40 | 41 | 42 | #define MT_HASH2_CALC \ 43 | h2 = (p->crc[cur[0]] ^ cur[1]) & (kHash2Size - 1); 44 | 45 | #define MT_HASH3_CALC { \ 46 | UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ 47 | h2 = temp & (kHash2Size - 1); \ 48 | h3 = (temp ^ ((UInt32)cur[2] << 8)) & (kHash3Size - 1); } 49 | 50 | #define MT_HASH4_CALC { \ 51 | UInt32 temp = p->crc[cur[0]] ^ cur[1]; \ 52 | h2 = temp & (kHash2Size - 1); \ 53 | temp ^= ((UInt32)cur[2] << 8); \ 54 | h3 = temp & (kHash3Size - 1); \ 55 | h4 = (temp ^ (p->crc[cur[3]] << 5)) & (kHash4Size - 1); } 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /core/cd_hw/libchdr/deps/lzma/Precomp.h: -------------------------------------------------------------------------------- 1 | /* Precomp.h -- StdAfx 2 | 2013-11-12 : Igor Pavlov : Public domain */ 3 | 4 | #ifndef __7Z_PRECOMP_H 5 | #define __7Z_PRECOMP_H 6 | 7 | #include "Compiler.h" 8 | /* #include "7zTypes.h" */ 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /core/cd_hw/libchdr/deps/zlib/inffast.h: -------------------------------------------------------------------------------- 1 | /* inffast.h -- header to use inffast.c 2 | * Copyright (C) 1995-2003, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* WARNING: this file should *not* be used by applications. It is 7 | part of the implementation of the compression library and is 8 | subject to change. Applications should only use zlib.h. 9 | */ 10 | 11 | void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start)); 12 | -------------------------------------------------------------------------------- /core/cd_hw/libchdr/deps/zlib/inftrees.h: -------------------------------------------------------------------------------- 1 | /* inftrees.h -- header to use inftrees.c 2 | * Copyright (C) 1995-2005, 2010 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* WARNING: this file should *not* be used by applications. It is 7 | part of the implementation of the compression library and is 8 | subject to change. Applications should only use zlib.h. 9 | */ 10 | 11 | /* Structure for decoding tables. Each entry provides either the 12 | information needed to do the operation requested by the code that 13 | indexed that table entry, or it provides a pointer to another 14 | table that indexes more bits of the code. op indicates whether 15 | the entry is a pointer to another table, a literal, a length or 16 | distance, an end-of-block, or an invalid code. For a table 17 | pointer, the low four bits of op is the number of index bits of 18 | that table. For a length or distance, the low four bits of op 19 | is the number of extra bits to get after the code. bits is 20 | the number of bits in this code or part of the code to drop off 21 | of the bit buffer. val is the actual byte to output in the case 22 | of a literal, the base length or distance, or the offset from 23 | the current table to the next table. Each entry is four bytes. */ 24 | typedef struct { 25 | unsigned char op; /* operation, extra bits, table bits */ 26 | unsigned char bits; /* bits in this part of the code */ 27 | unsigned short val; /* offset in table or code value */ 28 | } code; 29 | 30 | /* op values as set by inflate_table(): 31 | 00000000 - literal 32 | 0000tttt - table link, tttt != 0 is the number of table index bits 33 | 0001eeee - length or distance, eeee is the number of extra bits 34 | 01100000 - end of block 35 | 01000000 - invalid code 36 | */ 37 | 38 | /* Maximum size of the dynamic table. The maximum number of code structures is 39 | 1444, which is the sum of 852 for literal/length codes and 592 for distance 40 | codes. These values were found by exhaustive searches using the program 41 | examples/enough.c found in the zlib distribtution. The arguments to that 42 | program are the number of symbols, the initial root table size, and the 43 | maximum bit length of a code. "enough 286 9 15" for literal/length codes 44 | returns returns 852, and "enough 30 6 15" for distance codes returns 592. 45 | The initial root table size (9 or 6) is found in the fifth argument of the 46 | inflate_table() calls in inflate.c and infback.c. If the root table size is 47 | changed, then these maximum sizes would be need to be recalculated and 48 | updated. */ 49 | #define ENOUGH_LENS 852 50 | #define ENOUGH_DISTS 592 51 | #define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS) 52 | 53 | /* Type of code to build for inflate_table() */ 54 | typedef enum { 55 | CODES, 56 | LENS, 57 | DISTS 58 | } codetype; 59 | 60 | int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens, 61 | unsigned codes, code FAR * FAR *table, 62 | unsigned FAR *bits, unsigned short FAR *work)); 63 | -------------------------------------------------------------------------------- /core/cd_hw/libchdr/src/bitstream.h: -------------------------------------------------------------------------------- 1 | /* license:BSD-3-Clause 2 | * copyright-holders:Aaron Giles 3 | *************************************************************************** 4 | 5 | bitstream.h 6 | 7 | Helper classes for reading/writing at the bit level. 8 | 9 | ***************************************************************************/ 10 | 11 | #pragma once 12 | 13 | #ifndef __BITSTREAM_H__ 14 | #define __BITSTREAM_H__ 15 | 16 | #include 17 | 18 | /*************************************************************************** 19 | * TYPE DEFINITIONS 20 | *************************************************************************** 21 | */ 22 | 23 | /* helper class for reading from a bit buffer */ 24 | struct bitstream 25 | { 26 | uint32_t buffer; /* current bit accumulator */ 27 | int bits; /* number of bits in the accumulator */ 28 | const uint8_t * read; /* read pointer */ 29 | uint32_t doffset; /* byte offset within the data */ 30 | uint32_t dlength; /* length of the data */ 31 | }; 32 | 33 | struct bitstream* create_bitstream(const void *src, uint32_t srclength); 34 | int bitstream_overflow(struct bitstream* bitstream); 35 | uint32_t bitstream_read_offset(struct bitstream* bitstream); 36 | 37 | uint32_t bitstream_read(struct bitstream* bitstream, int numbits); 38 | uint32_t bitstream_peek(struct bitstream* bitstream, int numbits); 39 | void bitstream_remove(struct bitstream* bitstream, int numbits); 40 | uint32_t bitstream_flush(struct bitstream* bitstream); 41 | 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /core/cd_hw/libchdr/src/cdrom.h: -------------------------------------------------------------------------------- 1 | /* license:BSD-3-Clause */ 2 | /* copyright-holders:Aaron Giles */ 3 | /*************************************************************************** 4 | 5 | cdrom.h 6 | 7 | Generic MAME cd-rom implementation 8 | 9 | ***************************************************************************/ 10 | 11 | #pragma once 12 | 13 | #ifndef __CDROM_H__ 14 | #define __CDROM_H__ 15 | 16 | #include 17 | 18 | 19 | /*************************************************************************** 20 | CONSTANTS 21 | ***************************************************************************/ 22 | 23 | /* tracks are padded to a multiple of this many frames */ 24 | #define CD_TRACK_PADDING (4) 25 | 26 | #define CD_MAX_TRACKS (99) /* AFAIK the theoretical limit */ 27 | #define CD_MAX_SECTOR_DATA (2352) 28 | #define CD_MAX_SUBCODE_DATA (96) 29 | 30 | #define CD_FRAME_SIZE (CD_MAX_SECTOR_DATA + CD_MAX_SUBCODE_DATA) 31 | #define CD_FRAMES_PER_HUNK (8) 32 | 33 | #define CD_METADATA_WORDS (1+(CD_MAX_TRACKS * 6)) 34 | 35 | enum 36 | { 37 | CD_TRACK_MODE1 = 0, /* mode 1 2048 bytes/sector */ 38 | CD_TRACK_MODE1_RAW, /* mode 1 2352 bytes/sector */ 39 | CD_TRACK_MODE2, /* mode 2 2336 bytes/sector */ 40 | CD_TRACK_MODE2_FORM1, /* mode 2 2048 bytes/sector */ 41 | CD_TRACK_MODE2_FORM2, /* mode 2 2324 bytes/sector */ 42 | CD_TRACK_MODE2_FORM_MIX, /* mode 2 2336 bytes/sector */ 43 | CD_TRACK_MODE2_RAW, /* mode 2 2352 bytes / sector */ 44 | CD_TRACK_AUDIO, /* redbook audio track 2352 bytes/sector (588 samples) */ 45 | 46 | CD_TRACK_RAW_DONTCARE /* special flag for cdrom_read_data: just return me whatever is there */ 47 | }; 48 | 49 | enum 50 | { 51 | CD_SUB_NORMAL = 0, /* "cooked" 96 bytes per sector */ 52 | CD_SUB_RAW, /* raw uninterleaved 96 bytes per sector */ 53 | CD_SUB_NONE /* no subcode data stored */ 54 | }; 55 | 56 | #define CD_FLAG_GDROM 0x00000001 // disc is a GD-ROM, all tracks should be stored with GD-ROM metadata 57 | #define CD_FLAG_GDROMLE 0x00000002 // legacy GD-ROM, with little-endian CDDA data 58 | 59 | /*************************************************************************** 60 | FUNCTION PROTOTYPES 61 | ***************************************************************************/ 62 | 63 | #ifdef WANT_RAW_DATA_SECTOR 64 | /* ECC utilities */ 65 | int ecc_verify(const uint8_t *sector); 66 | void ecc_generate(uint8_t *sector); 67 | void ecc_clear(uint8_t *sector); 68 | #endif 69 | 70 | #endif /* __CDROM_H__ */ 71 | -------------------------------------------------------------------------------- /core/cd_hw/libchdr/src/coretypes.h: -------------------------------------------------------------------------------- 1 | #ifndef __CORETYPES_H__ 2 | #define __CORETYPES_H__ 3 | 4 | #include 5 | #include 6 | 7 | #define ARRAY_LENGTH(x) (sizeof(x)/sizeof(x[0])) 8 | 9 | typedef uint64_t UINT64; 10 | #ifndef OSD_CPU_H 11 | typedef uint32_t UINT32; 12 | typedef uint16_t UINT16; 13 | typedef uint8_t UINT8; 14 | #endif 15 | 16 | typedef int64_t INT64; 17 | #ifndef OSD_CPU_H 18 | typedef int32_t INT32; 19 | typedef int16_t INT16; 20 | typedef int8_t INT8; 21 | #endif 22 | 23 | #define core_file cdStream 24 | #define core_fopen cdStreamOpen 25 | #define core_fseek cdStreamSeek 26 | #define core_fread(fc, buff, len) cdStreamRead(buff, 1, len, fc) 27 | #define core_fclose cdStreamClose 28 | #define core_ftell cdStreamTell 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /core/cd_hw/libchdr/src/flac.h: -------------------------------------------------------------------------------- 1 | // license:BSD-3-Clause 2 | // copyright-holders:Aaron Giles 3 | /*************************************************************************** 4 | 5 | flac.h 6 | 7 | FLAC compression wrappers 8 | 9 | ***************************************************************************/ 10 | 11 | #pragma once 12 | 13 | #ifndef __FLAC_H__ 14 | #define __FLAC_H__ 15 | 16 | #include 17 | #include "FLAC/ordinals.h" 18 | #include "FLAC/stream_decoder.h" 19 | 20 | //************************************************************************** 21 | // TYPE DEFINITIONS 22 | //************************************************************************** 23 | 24 | typedef struct _flac_decoder flac_decoder; 25 | struct _flac_decoder { 26 | // output state 27 | FLAC__StreamDecoder* decoder; // actual encoder 28 | uint32_t sample_rate; // decoded sample rate 29 | uint8_t channels; // decoded number of channels 30 | uint8_t bits_per_sample; // decoded bits per sample 31 | uint32_t compressed_offset; // current offset in compressed data 32 | const FLAC__byte * compressed_start; // start of compressed data 33 | uint32_t compressed_length; // length of compressed data 34 | const FLAC__byte * compressed2_start; // start of compressed data 35 | uint32_t compressed2_length; // length of compressed data 36 | int16_t * uncompressed_start[8]; // pointer to start of uncompressed data (up to 8 streams) 37 | uint32_t uncompressed_offset; // current position in uncompressed data 38 | uint32_t uncompressed_length; // length of uncompressed data 39 | int uncompressed_swap; // swap uncompressed sample data 40 | uint8_t custom_header[0x2a]; // custom header 41 | }; 42 | 43 | // ======================> flac_decoder 44 | 45 | void flac_decoder_init(flac_decoder* decoder); 46 | void flac_decoder_free(flac_decoder* decoder); 47 | int flac_decoder_reset(flac_decoder* decoder, uint32_t sample_rate, uint8_t num_channels, uint32_t block_size, const void *buffer, uint32_t length); 48 | int flac_decoder_decode_interleaved(flac_decoder* decoder, int16_t *samples, uint32_t num_samples, int swap_endian); 49 | uint32_t flac_decoder_finish(flac_decoder* decoder); 50 | 51 | #endif // __FLAC_H__ 52 | -------------------------------------------------------------------------------- /core/debug/cpuhook.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************************** 2 | * Genesis Plus GX 3 | * CPU hooking support 4 | * 5 | * HOOK_CPU should be defined in a makefile or MSVC project to enable this functionality 6 | * 7 | * Copyright feos (2019) 8 | * 9 | * Redistribution and use of this code or any derivative works are permitted 10 | * provided that the following conditions are met: 11 | * 12 | * - Redistributions may not be sold, nor may they be used in a commercial 13 | * product or activity. 14 | * 15 | * - Redistributions that are modified from the original source must include the 16 | * complete source code, including the source code for all components used by a 17 | * binary built from the modified sources. However, as a special exception, the 18 | * source code distributed need not include anything that is normally distributed 19 | * (in either source or binary form) with the major components (compiler, kernel, 20 | * and so on) of the operating system on which the executable runs, unless that 21 | * component itself accompanies the executable. 22 | * 23 | * - Redistributions must reproduce the above copyright notice, this list of 24 | * conditions and the following disclaimer in the documentation and/or other 25 | * materials provided with the distribution. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 28 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 29 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 30 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 31 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 32 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 33 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 34 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 35 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 36 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 37 | * POSSIBILITY OF SUCH DAMAGE. 38 | * 39 | ****************************************************************************************/ 40 | 41 | #ifdef HOOK_CPU 42 | 43 | #include 44 | #include "cpuhook.h" 45 | 46 | cpu_hook_t cpu_hook = NULL; 47 | 48 | void set_cpu_hook(cpu_hook_t hook) 49 | { 50 | cpu_hook = hook; 51 | } 52 | 53 | #endif /* HOOK_CPU */ -------------------------------------------------------------------------------- /core/debug/debug.h: -------------------------------------------------------------------------------- 1 | #ifndef _DEBUG_H_ 2 | #define _DEBUG_H_ 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #include 9 | #include "debug_wrap.h" 10 | 11 | extern void start_debugging(); 12 | extern void stop_debugging(); 13 | extern int is_debugger_accessible(); 14 | extern void process_request(); 15 | extern int is_debugger_paused(); 16 | extern void resume_debugger(); 17 | extern void process_breakpoints(bpt_type_t type, int width, unsigned int address, unsigned int value); 18 | 19 | extern int dbg_trace; 20 | extern int dbg_step_over; 21 | extern int dbg_in_interrupt; 22 | extern unsigned int dbg_step_over_addr; 23 | extern jmp_buf jmp_env; 24 | 25 | extern dbg_request_t* dbg_req_core; 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | 31 | #endif -------------------------------------------------------------------------------- /core/input_hw/activator.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************************** 2 | * Genesis Plus 3 | * Sega Activator support 4 | * 5 | * Copyright (C) 2011-2013 Eke-Eke (Genesis Plus GX) 6 | * 7 | * Redistribution and use of this code or any derivative works are permitted 8 | * provided that the following conditions are met: 9 | * 10 | * - Redistributions may not be sold, nor may they be used in a commercial 11 | * product or activity. 12 | * 13 | * - Redistributions that are modified from the original source must include the 14 | * complete source code, including the source code for all components used by a 15 | * binary built from the modified sources. However, as a special exception, the 16 | * source code distributed need not include anything that is normally distributed 17 | * (in either source or binary form) with the major components (compiler, kernel, 18 | * and so on) of the operating system on which the executable runs, unless that 19 | * component itself accompanies the executable. 20 | * 21 | * - Redistributions must reproduce the above copyright notice, this list of 22 | * conditions and the following disclaimer in the documentation and/or other 23 | * materials provided with the distribution. 24 | * 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 29 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 | * POSSIBILITY OF SUCH DAMAGE. 36 | * 37 | ****************************************************************************************/ 38 | 39 | #ifndef _ACTIVATOR_H_ 40 | #define _ACTIVATOR_H_ 41 | 42 | /* Function prototypes */ 43 | extern void activator_reset(int index); 44 | extern unsigned char activator_1_read(void); 45 | extern unsigned char activator_2_read(void); 46 | extern void activator_1_write(unsigned char data, unsigned char mask); 47 | extern void activator_2_write(unsigned char data, unsigned char mask); 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /core/input_hw/graphic_board.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************************** 2 | * Genesis Plus 3 | * Sega Graphic board support 4 | * 5 | * Copyright (C) 2017 Eke-Eke (Genesis Plus GX) 6 | * 7 | * Redistribution and use of this code or any derivative works are permitted 8 | * provided that the following conditions are met: 9 | * 10 | * - Redistributions may not be sold, nor may they be used in a commercial 11 | * product or activity. 12 | * 13 | * - Redistributions that are modified from the original source must include the 14 | * complete source code, including the source code for all components used by a 15 | * binary built from the modified sources. However, as a special exception, the 16 | * source code distributed need not include anything that is normally distributed 17 | * (in either source or binary form) with the major components (compiler, kernel, 18 | * and so on) of the operating system on which the executable runs, unless that 19 | * component itself accompanies the executable. 20 | * 21 | * - Redistributions must reproduce the above copyright notice, this list of 22 | * conditions and the following disclaimer in the documentation and/or other 23 | * materials provided with the distribution. 24 | * 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 29 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 | * POSSIBILITY OF SUCH DAMAGE. 36 | * 37 | ****************************************************************************************/ 38 | 39 | #ifndef _GRAPHIC_H_ 40 | #define _GRAPHIC_H_ 41 | 42 | /* Function prototypes */ 43 | extern void graphic_board_reset(int port); 44 | extern unsigned char graphic_board_read(void); 45 | extern void graphic_board_write(unsigned char data, unsigned char mask); 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /core/input_hw/lightgun.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************************** 2 | * Genesis Plus 3 | * Sega Light Phaser, Menacer & Konami Justifiers support 4 | * 5 | * Copyright (C) 2007-2013 Eke-Eke (Genesis Plus GX) 6 | * 7 | * Redistribution and use of this code or any derivative works are permitted 8 | * provided that the following conditions are met: 9 | * 10 | * - Redistributions may not be sold, nor may they be used in a commercial 11 | * product or activity. 12 | * 13 | * - Redistributions that are modified from the original source must include the 14 | * complete source code, including the source code for all components used by a 15 | * binary built from the modified sources. However, as a special exception, the 16 | * source code distributed need not include anything that is normally distributed 17 | * (in either source or binary form) with the major components (compiler, kernel, 18 | * and so on) of the operating system on which the executable runs, unless that 19 | * component itself accompanies the executable. 20 | * 21 | * - Redistributions must reproduce the above copyright notice, this list of 22 | * conditions and the following disclaimer in the documentation and/or other 23 | * materials provided with the distribution. 24 | * 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 29 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 | * POSSIBILITY OF SUCH DAMAGE. 36 | * 37 | ****************************************************************************************/ 38 | 39 | #ifndef _LIGHTGUN_H_ 40 | #define _LIGHTGUN_H_ 41 | 42 | /* Input devices port handlers */ 43 | extern void lightgun_reset(int index); 44 | extern void lightgun_refresh(int port); 45 | extern unsigned char phaser_1_read(void); 46 | extern unsigned char phaser_2_read(void); 47 | extern unsigned char menacer_read(void); 48 | extern unsigned char justifier_read(void); 49 | extern void justifier_write(unsigned char data, unsigned char mask); 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /core/input_hw/mouse.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************************** 2 | * Genesis Plus 3 | * Sega/Mega Mouse support 4 | * 5 | * Copyright (C) 2007-2017 Eke-Eke (Genesis Plus GX) 6 | * 7 | * Redistribution and use of this code or any derivative works are permitted 8 | * provided that the following conditions are met: 9 | * 10 | * - Redistributions may not be sold, nor may they be used in a commercial 11 | * product or activity. 12 | * 13 | * - Redistributions that are modified from the original source must include the 14 | * complete source code, including the source code for all components used by a 15 | * binary built from the modified sources. However, as a special exception, the 16 | * source code distributed need not include anything that is normally distributed 17 | * (in either source or binary form) with the major components (compiler, kernel, 18 | * and so on) of the operating system on which the executable runs, unless that 19 | * component itself accompanies the executable. 20 | * 21 | * - Redistributions must reproduce the above copyright notice, this list of 22 | * conditions and the following disclaimer in the documentation and/or other 23 | * materials provided with the distribution. 24 | * 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 29 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 | * POSSIBILITY OF SUCH DAMAGE. 36 | * 37 | ****************************************************************************************/ 38 | 39 | #ifndef _MOUSE_H_ 40 | #define _MOUSE_H_ 41 | 42 | /* Function prototypes */ 43 | extern void mouse_reset(int port); 44 | extern unsigned char mouse_read(void); 45 | extern void mouse_write(unsigned char data, unsigned char mask); 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /core/input_hw/paddle.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************************** 2 | * Genesis Plus 3 | * Sega Paddle Control support 4 | * 5 | * Copyright (C) 2007-2013 Eke-Eke (Genesis Plus GX) 6 | * 7 | * Redistribution and use of this code or any derivative works are permitted 8 | * provided that the following conditions are met: 9 | * 10 | * - Redistributions may not be sold, nor may they be used in a commercial 11 | * product or activity. 12 | * 13 | * - Redistributions that are modified from the original source must include the 14 | * complete source code, including the source code for all components used by a 15 | * binary built from the modified sources. However, as a special exception, the 16 | * source code distributed need not include anything that is normally distributed 17 | * (in either source or binary form) with the major components (compiler, kernel, 18 | * and so on) of the operating system on which the executable runs, unless that 19 | * component itself accompanies the executable. 20 | * 21 | * - Redistributions must reproduce the above copyright notice, this list of 22 | * conditions and the following disclaimer in the documentation and/or other 23 | * materials provided with the distribution. 24 | * 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 29 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 | * POSSIBILITY OF SUCH DAMAGE. 36 | * 37 | ****************************************************************************************/ 38 | 39 | #ifndef _PADDLE_H_ 40 | #define _PADDLE_H_ 41 | 42 | /* Function prototypes */ 43 | extern void paddle_reset(int index); 44 | extern unsigned char paddle_1_read(void); 45 | extern unsigned char paddle_2_read(void); 46 | extern void paddle_1_write(unsigned char data, unsigned char mask); 47 | extern void paddle_2_write(unsigned char data, unsigned char mask); 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /core/input_hw/sportspad.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************************** 2 | * Genesis Plus 3 | * Sega Sports Pad support 4 | * 5 | * Copyright (C) 2007-2013 Eke-Eke (Genesis Plus GX) 6 | * 7 | * Redistribution and use of this code or any derivative works are permitted 8 | * provided that the following conditions are met: 9 | * 10 | * - Redistributions may not be sold, nor may they be used in a commercial 11 | * product or activity. 12 | * 13 | * - Redistributions that are modified from the original source must include the 14 | * complete source code, including the source code for all components used by a 15 | * binary built from the modified sources. However, as a special exception, the 16 | * source code distributed need not include anything that is normally distributed 17 | * (in either source or binary form) with the major components (compiler, kernel, 18 | * and so on) of the operating system on which the executable runs, unless that 19 | * component itself accompanies the executable. 20 | * 21 | * - Redistributions must reproduce the above copyright notice, this list of 22 | * conditions and the following disclaimer in the documentation and/or other 23 | * materials provided with the distribution. 24 | * 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 29 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 | * POSSIBILITY OF SUCH DAMAGE. 36 | * 37 | ****************************************************************************************/ 38 | 39 | #ifndef _SPORTSPAD_H_ 40 | #define _SPORTSPAD_H_ 41 | 42 | /* Function prototypes */ 43 | extern void sportspad_reset(int index); 44 | extern unsigned char sportspad_1_read(void); 45 | extern unsigned char sportspad_2_read(void); 46 | extern void sportspad_1_write(unsigned char data, unsigned char mask); 47 | extern void sportspad_2_write(unsigned char data, unsigned char mask); 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /core/input_hw/teamplayer.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************************** 2 | * Genesis Plus 3 | * Team Player support 4 | * 5 | * Copyright (C) 2007-2014 Eke-Eke (Genesis Plus GX) 6 | * 7 | * Redistribution and use of this code or any derivative works are permitted 8 | * provided that the following conditions are met: 9 | * 10 | * - Redistributions may not be sold, nor may they be used in a commercial 11 | * product or activity. 12 | * 13 | * - Redistributions that are modified from the original source must include the 14 | * complete source code, including the source code for all components used by a 15 | * binary built from the modified sources. However, as a special exception, the 16 | * source code distributed need not include anything that is normally distributed 17 | * (in either source or binary form) with the major components (compiler, kernel, 18 | * and so on) of the operating system on which the executable runs, unless that 19 | * component itself accompanies the executable. 20 | * 21 | * - Redistributions must reproduce the above copyright notice, this list of 22 | * conditions and the following disclaimer in the documentation and/or other 23 | * materials provided with the distribution. 24 | * 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 29 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 | * POSSIBILITY OF SUCH DAMAGE. 36 | * 37 | ****************************************************************************************/ 38 | 39 | #ifndef _TEAMPLAYER_H_ 40 | #define _TEAMPLAYER_H_ 41 | 42 | /* Function prototypes */ 43 | extern void teamplayer_init(int port); 44 | extern void teamplayer_reset(int port); 45 | extern unsigned char teamplayer_1_read(void); 46 | extern unsigned char teamplayer_2_read(void); 47 | extern void teamplayer_1_write(unsigned char data, unsigned char mask); 48 | extern void teamplayer_2_write(unsigned char data, unsigned char mask); 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /core/input_hw/terebi_oekaki.c: -------------------------------------------------------------------------------- 1 | /*************************************************************************************** 2 | * Genesis Plus 3 | * Terebi Oekaki graphic board support 4 | * 5 | * Copyright (C) 2011 Eke-Eke (Genesis Plus GX) 6 | * 7 | * Redistribution and use of this code or any derivative works are permitted 8 | * provided that the following conditions are met: 9 | * 10 | * - Redistributions may not be sold, nor may they be used in a commercial 11 | * product or activity. 12 | * 13 | * - Redistributions that are modified from the original source must include the 14 | * complete source code, including the source code for all components used by a 15 | * binary built from the modified sources. However, as a special exception, the 16 | * source code distributed need not include anything that is normally distributed 17 | * (in either source or binary form) with the major components (compiler, kernel, 18 | * and so on) of the operating system on which the executable runs, unless that 19 | * component itself accompanies the executable. 20 | * 21 | * - Redistributions must reproduce the above copyright notice, this list of 22 | * conditions and the following disclaimer in the documentation and/or other 23 | * materials provided with the distribution. 24 | * 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 29 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 | * POSSIBILITY OF SUCH DAMAGE. 36 | * 37 | ****************************************************************************************/ 38 | 39 | #include "shared.h" 40 | 41 | static struct 42 | { 43 | uint8 axis; 44 | uint8 busy; 45 | } tablet; 46 | 47 | void terebi_oekaki_reset(void) 48 | { 49 | input.analog[0][0] = 128; 50 | input.analog[0][1] = 128; 51 | tablet.axis = 1; 52 | tablet.busy = 1; 53 | } 54 | 55 | unsigned short terebi_oekaki_read(void) 56 | { 57 | uint16 data = (tablet.busy << 15) | input.analog[0][tablet.axis]; 58 | 59 | if (!(input.pad[0] & INPUT_B)) 60 | { 61 | data |= 0x100; 62 | } 63 | 64 | /* clear BUSY flag */ 65 | tablet.busy = 0; 66 | 67 | return data; 68 | } 69 | 70 | void terebi_oekaki_write(unsigned char data) 71 | { 72 | /* X (1) or Y (0) axis */ 73 | tablet.axis = (data & 1) ^ 1; 74 | 75 | /* set BUSY flag */ 76 | tablet.busy = 1; 77 | } 78 | -------------------------------------------------------------------------------- /core/input_hw/terebi_oekaki.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************************** 2 | * Genesis Plus 3 | * Terebi Oekaki graphic board support 4 | * 5 | * Copyright (C) 2011 Eke-Eke (Genesis Plus GX) 6 | * 7 | * Redistribution and use of this code or any derivative works are permitted 8 | * provided that the following conditions are met: 9 | * 10 | * - Redistributions may not be sold, nor may they be used in a commercial 11 | * product or activity. 12 | * 13 | * - Redistributions that are modified from the original source must include the 14 | * complete source code, including the source code for all components used by a 15 | * binary built from the modified sources. However, as a special exception, the 16 | * source code distributed need not include anything that is normally distributed 17 | * (in either source or binary form) with the major components (compiler, kernel, 18 | * and so on) of the operating system on which the executable runs, unless that 19 | * component itself accompanies the executable. 20 | * 21 | * - Redistributions must reproduce the above copyright notice, this list of 22 | * conditions and the following disclaimer in the documentation and/or other 23 | * materials provided with the distribution. 24 | * 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 29 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 | * POSSIBILITY OF SUCH DAMAGE. 36 | * 37 | ****************************************************************************************/ 38 | 39 | #ifndef _TEREBI_H_ 40 | #define _TEREBI_H_ 41 | 42 | /* Function prototypes */ 43 | extern void terebi_oekaki_reset(void); 44 | extern unsigned short terebi_oekaki_read(void); 45 | extern void terebi_oekaki_write(unsigned char data); 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /core/input_hw/xe_1ap.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************************** 2 | * Genesis Plus 3 | * XE-1AP analog controller support 4 | * 5 | * Copyright (C) 2011-2015 Eke-Eke (Genesis Plus GX) 6 | * 7 | * Redistribution and use of this code or any derivative works are permitted 8 | * provided that the following conditions are met: 9 | * 10 | * - Redistributions may not be sold, nor may they be used in a commercial 11 | * product or activity. 12 | * 13 | * - Redistributions that are modified from the original source must include the 14 | * complete source code, including the source code for all components used by a 15 | * binary built from the modified sources. However, as a special exception, the 16 | * source code distributed need not include anything that is normally distributed 17 | * (in either source or binary form) with the major components (compiler, kernel, 18 | * and so on) of the operating system on which the executable runs, unless that 19 | * component itself accompanies the executable. 20 | * 21 | * - Redistributions must reproduce the above copyright notice, this list of 22 | * conditions and the following disclaimer in the documentation and/or other 23 | * materials provided with the distribution. 24 | * 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 29 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 | * POSSIBILITY OF SUCH DAMAGE. 36 | * 37 | ****************************************************************************************/ 38 | 39 | #ifndef _XE_1APH_ 40 | #define _XE_1APH_ 41 | 42 | /* Function prototypes */ 43 | extern void xe_1ap_reset(int index); 44 | extern unsigned char xe_1ap_1_read(void); 45 | extern unsigned char xe_1ap_2_read(void); 46 | extern void xe_1ap_1_write(unsigned char data, unsigned char mask); 47 | extern void xe_1ap_2_write(unsigned char data, unsigned char mask); 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /core/macros.h: -------------------------------------------------------------------------------- 1 | #ifndef _MACROS_H_ 2 | #define _MACROS_H_ 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #ifdef LSB_FIRST 9 | 10 | #define READ_BYTE(BASE, ADDR) (BASE)[(ADDR)^1] 11 | 12 | #define READ_WORD(BASE, ADDR) (((BASE)[ADDR]<<8) | (BASE)[(ADDR)+1]) 13 | 14 | #define READ_WORD_LONG(BASE, ADDR) (((BASE)[(ADDR)+1]<<24) | \ 15 | ((BASE)[(ADDR)]<<16) | \ 16 | ((BASE)[(ADDR)+3]<<8) | \ 17 | (BASE)[(ADDR)+2]) 18 | 19 | #define WRITE_BYTE(BASE, ADDR, VAL) (BASE)[(ADDR)^1] = (VAL)&0xff 20 | 21 | #define WRITE_WORD(BASE, ADDR, VAL) (BASE)[ADDR] = ((VAL)>>8) & 0xff; \ 22 | (BASE)[(ADDR)+1] = (VAL)&0xff 23 | 24 | #define WRITE_WORD_LONG(BASE, ADDR, VAL) (BASE)[(ADDR+1)] = ((VAL)>>24) & 0xff; \ 25 | (BASE)[(ADDR)] = ((VAL)>>16)&0xff; \ 26 | (BASE)[(ADDR+3)] = ((VAL)>>8)&0xff; \ 27 | (BASE)[(ADDR+2)] = (VAL)&0xff 28 | 29 | #else 30 | 31 | #define READ_BYTE(BASE, ADDR) (BASE)[ADDR] 32 | #define READ_WORD(BASE, ADDR) *(uint16 *)((BASE) + (ADDR)) 33 | #define READ_WORD_LONG(BASE, ADDR) *(uint32 *)((BASE) + (ADDR)) 34 | #define WRITE_BYTE(BASE, ADDR, VAL) (BASE)[ADDR] = VAL & 0xff 35 | #define WRITE_WORD(BASE, ADDR, VAL) *(uint16 *)((BASE) + (ADDR)) = VAL & 0xffff 36 | #define WRITE_WORD_LONG(BASE, ADDR, VAL) *(uint32 *)((BASE) + (ADDR)) = VAL & 0xffffffff 37 | #endif 38 | 39 | /* C89 compatibility */ 40 | #ifndef M_PI 41 | #define M_PI 3.14159265358979323846264338327f 42 | #endif /* M_PI */ 43 | 44 | /* Set to your compiler's static inline keyword to enable it, or 45 | * set it to blank to disable it. 46 | * If you define INLINE in makefile or osd.h, it will override this value. 47 | * NOTE: not enabling inline functions will SEVERELY slow down emulation. 48 | */ 49 | #ifndef INLINE 50 | #define INLINE static __inline__ 51 | #endif /* INLINE */ 52 | 53 | /* Alignment macros for cross compiler compatibility */ 54 | #if defined(_MSC_VER) 55 | #define ALIGNED_(x) __declspec(align(x)) 56 | #elif defined(__GNUC__) 57 | #define ALIGNED_(x) __attribute__ ((aligned(x))) 58 | #endif 59 | 60 | /* Default CD image file access (read-only) functions */ 61 | /* If you need to override default stdio.h functions with custom filesystem API, 62 | redefine following macros in platform specific include file (osd.h) or Makefile 63 | */ 64 | #ifndef cdStream 65 | #define cdStream FILE 66 | #define cdStreamOpen(fname) fopen(fname, "rb") 67 | #define cdStreamClose fclose 68 | #define cdStreamRead fread 69 | #define cdStreamSeek fseek 70 | #define cdStreamTell ftell 71 | #define cdStreamGets fgets 72 | #endif 73 | 74 | #ifdef __cplusplus 75 | } 76 | #endif 77 | 78 | #endif /* _MACROS_H_ */ 79 | -------------------------------------------------------------------------------- /core/ntsc/md_ntsc_config.h: -------------------------------------------------------------------------------- 1 | /* Configure library by modifying this file */ 2 | 3 | #ifndef MD_NTSC_CONFIG_H 4 | #define MD_NTSC_CONFIG_H 5 | 6 | /* Format of source & output pixels (RGB555 or RGB565 only)*/ 7 | #ifdef USE_15BPP_RENDERING 8 | #define MD_NTSC_IN_FORMAT MD_NTSC_RGB15 9 | #define MD_NTSC_OUT_DEPTH 15 10 | #else 11 | #define MD_NTSC_IN_FORMAT MD_NTSC_RGB16 12 | #define MD_NTSC_OUT_DEPTH 16 13 | #endif 14 | 15 | /* Original CRAM format (not used) */ 16 | /* #define MD_NTSC_IN_FORMAT MD_NTSC_BGR9 */ 17 | 18 | /* The following affect the built-in blitter only; a custom blitter can 19 | handle things however it wants. */ 20 | 21 | /* Type of input pixel values (fixed to 16-bit) */ 22 | #define MD_NTSC_IN_T unsigned short 23 | 24 | /* Each raw pixel input value is passed through this. You might want to mask 25 | the pixel index if you use the high bits as flags, etc. */ 26 | #define MD_NTSC_ADJ_IN( in ) in 27 | 28 | /* For each pixel, this is the basic operation: 29 | output_color = MD_NTSC_ADJ_IN( MD_NTSC_IN_T ) */ 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /core/ntsc/readme.txt: -------------------------------------------------------------------------------- 1 | sms_ntsc 0.2.3: Sega Master System NTSC Video Filter 2 | ---------------------------------------------------- 3 | This library filters a Sega Master System image to match what a TV would 4 | show, allowing an authentic image in an emulator. It uses a highly 5 | optimized algorithm to perform the same signal processing as an NTSC 6 | decoder in a TV, giving very similar pixel artifacts and color bleeding. 7 | The usual picture controls can be adjusted: hue, saturation, contrast, 8 | brightness, and sharpness. Additionally, the amount of NTSC chroma and 9 | luma artifacts can be reduced, allowing an image that corresponds to 10 | composite video (artifacts), S-video (color bleeding only), RGB (clean 11 | pixels), or anywhere inbetween. 12 | 13 | The output is scaled to the proper horizontal width, leaving it up the 14 | emulator to simply double the height. Specialized blitters can be easily 15 | written using a special interface, allowing customization of input and 16 | output pixel formats, optimization for the host platform, and efficient 17 | scanline doubling. 18 | 19 | Blitting a 248x192 source image to a 581x384 pixel 16-bit RGB memory 20 | buffer at 60 frames per second uses 7% CPU on a 2.0 GHz Athlon 3500+ and 21 | 33% CPU on a 10-year-old 400 MHz G3 PowerMac. 22 | 23 | Author : Shay Green 24 | Website : http://www.slack.net/~ant/ 25 | Forum : http://groups.google.com/group/blargg-sound-libs 26 | License : GNU Lesser General Public License (LGPL) 27 | Language: C or C++ 28 | 29 | 30 | Getting Started 31 | --------------- 32 | Build a program from demo.c, sms_ntsc.c, and the SDL multimedia library 33 | (see http://libsdl.org/). Run it with "test.bmp" in the same directory 34 | and it should show the filtered image. See demo.c for more. 35 | 36 | See sms_ntsc.txt for documentation and sms_ntsc.h for reference. Post to 37 | the discussion forum for assistance. 38 | 39 | 40 | Files 41 | ----- 42 | readme.txt Essential information 43 | sms_ntsc.txt Library documentation 44 | changes.txt Changes made since previous releases 45 | license.txt GNU Lesser General Public License 46 | 47 | benchmark.c Measures frame rate and processor usage of library 48 | demo.c Displays and saves NTSC filtered image 49 | demo_impl.h Internal routines used by demo 50 | test.bmp Test image for demo 51 | 52 | sms_ntsc_config.h Library configuration (modify as needed) 53 | sms_ntsc.h Library header and source 54 | sms_ntsc.c 55 | sms_ntsc_impl.h 56 | 57 | -- 58 | Shay Green 59 | -------------------------------------------------------------------------------- /core/ntsc/sms_ntsc_config.h: -------------------------------------------------------------------------------- 1 | /* Configure library by modifying this file */ 2 | 3 | #ifndef SMS_NTSC_CONFIG_H 4 | #define SMS_NTSC_CONFIG_H 5 | 6 | /* Format of source & output pixels (RGB555 or RGB565 only) */ 7 | #ifdef USE_15BPP_RENDERING 8 | #define SMS_NTSC_IN_FORMAT SMS_NTSC_RGB15 9 | #define SMS_NTSC_OUT_DEPTH 15 10 | #else 11 | #define SMS_NTSC_IN_FORMAT SMS_NTSC_RGB16 12 | #define SMS_NTSC_OUT_DEPTH 16 13 | #endif 14 | 15 | /* Original CRAM format (not used) */ 16 | /* #define SMS_NTSC_IN_FORMAT SMS_NTSC_BGR12 */ 17 | 18 | /* The following affect the built-in blitter only; a custom blitter can 19 | handle things however it wants. */ 20 | 21 | /* Type of input pixel values (fixed to 16-bit)*/ 22 | #define SMS_NTSC_IN_T unsigned short 23 | 24 | /* Each raw pixel input value is passed through this. You might want to mask 25 | the pixel index if you use the high bits as flags, etc. */ 26 | #define SMS_NTSC_ADJ_IN( in ) in 27 | 28 | /* For each pixel, this is the basic operation: 29 | output_color = SMS_NTSC_ADJ_IN( SMS_NTSC_IN_T ) */ 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /core/shared.h: -------------------------------------------------------------------------------- 1 | #ifndef _SHARED_H_ 2 | #define _SHARED_H_ 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include "types.h" 14 | #include "osd.h" 15 | #include "macros.h" 16 | #include "loadrom.h" 17 | #include "m68k.h" 18 | #include "z80.h" 19 | #include "system.h" 20 | #include "genesis.h" 21 | #include "vdp_ctrl.h" 22 | #include "vdp_render.h" 23 | #include "mem68k.h" 24 | #include "memz80.h" 25 | #include "membnk.h" 26 | #include "io_ctrl.h" 27 | #include "input.h" 28 | #include "sound.h" 29 | #include "psg.h" 30 | #include "ym2413.h" 31 | #include "ym2612.h" 32 | #ifdef HAVE_YM3438_CORE 33 | #include "ym3438.h" 34 | #endif 35 | #ifdef HAVE_OPLL_CORE 36 | #include "opll.h" 37 | #endif 38 | #include "sram.h" 39 | #include "ggenie.h" 40 | #include "areplay.h" 41 | #include "svp.h" 42 | #include "state.h" 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | #endif /* _SHARED_H_ */ 49 | 50 | -------------------------------------------------------------------------------- /core/sound/eq.h: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------------------- 2 | // 3 | // 3 Band EQ :) 4 | // 5 | // EQ.H - Header file for 3 band EQ 6 | // 7 | // (c) Neil C / Etanza Systems / 2K6 8 | // 9 | // Shouts / Loves / Moans = etanza at lycos dot co dot uk 10 | // 11 | // This work is hereby placed in the public domain for all purposes, including 12 | // use in commercial applications. 13 | // 14 | // The author assumes NO RESPONSIBILITY for any problems caused by the use of 15 | // this software. 16 | // 17 | //----------------------------------------------------------------------------*/ 18 | 19 | #ifndef __EQ3BAND__ 20 | #define __EQ3BAND__ 21 | 22 | /* ------------ 23 | //| Structures | 24 | // ------------*/ 25 | 26 | typedef struct { 27 | /* Filter #1 (Low band) */ 28 | 29 | double lf; /* Frequency */ 30 | double f1p0; /* Poles ... */ 31 | double f1p1; 32 | double f1p2; 33 | double f1p3; 34 | 35 | /* Filter #2 (High band) */ 36 | 37 | double hf; /* Frequency */ 38 | double f2p0; /* Poles ... */ 39 | double f2p1; 40 | double f2p2; 41 | double f2p3; 42 | 43 | /* Sample history buffer */ 44 | 45 | double sdm1; /* Sample data minus 1 */ 46 | double sdm2; /* 2 */ 47 | double sdm3; /* 3 */ 48 | 49 | /* Gain Controls */ 50 | 51 | double lg; /* low gain */ 52 | double mg; /* mid gain */ 53 | double hg; /* high gain */ 54 | 55 | } EQSTATE; 56 | 57 | 58 | /* --------- 59 | //| Exports | 60 | // ---------*/ 61 | 62 | extern void init_3band_state(EQSTATE * es, int lowfreq, int highfreq, 63 | int mixfreq); 64 | extern double do_3band(EQSTATE * es, int sample); 65 | 66 | 67 | #endif /* #ifndef __EQ3BAND__ */ 68 | -------------------------------------------------------------------------------- /core/sound/psg.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************************** 2 | * Genesis Plus 3 | * PSG sound chip (SN76489A compatible) 4 | * 5 | * Support for discrete chip & integrated (ASIC) clones 6 | * 7 | * Noise implementation based on http://www.smspower.org/Development/SN76489#NoiseChannel 8 | * 9 | * Copyright (C) 2016-2017 Eke-Eke (Genesis Plus GX) 10 | * 11 | * Redistribution and use of this code or any derivative works are permitted 12 | * provided that the following conditions are met: 13 | * 14 | * - Redistributions may not be sold, nor may they be used in a commercial 15 | * product or activity. 16 | * 17 | * - Redistributions that are modified from the original source must include the 18 | * complete source code, including the source code for all components used by a 19 | * binary built from the modified sources. However, as a special exception, the 20 | * source code distributed need not include anything that is normally distributed 21 | * (in either source or binary form) with the major components (compiler, kernel, 22 | * and so on) of the operating system on which the executable runs, unless that 23 | * component itself accompanies the executable. 24 | * 25 | * - Redistributions must reproduce the above copyright notice, this list of 26 | * conditions and the following disclaimer in the documentation and/or other 27 | * materials provided with the distribution. 28 | * 29 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 30 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 31 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 32 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 33 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 34 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 35 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 36 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 37 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 38 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 39 | * POSSIBILITY OF SUCH DAMAGE. 40 | * 41 | ****************************************************************************************/ 42 | 43 | #ifndef _PSG_H_ 44 | #define _PSG_H_ 45 | 46 | #ifdef __cplusplus 47 | extern "C" { 48 | #endif 49 | 50 | typedef enum { 51 | PSG_DISCRETE, 52 | PSG_INTEGRATED 53 | } PSG_TYPE; 54 | 55 | /* Function prototypes */ 56 | extern void psg_init(PSG_TYPE type); 57 | extern void psg_reset(void); 58 | extern int psg_context_save(uint8 *state); 59 | extern int psg_context_load(uint8 *state); 60 | extern void psg_write(unsigned int clocks, unsigned int data); 61 | extern void psg_config(unsigned int clocks, unsigned int preamp, unsigned int panning); 62 | extern void psg_end_frame(unsigned int clocks); 63 | 64 | #ifdef __cplusplus 65 | } 66 | #endif 67 | 68 | #endif /* _PSG_H_ */ 69 | -------------------------------------------------------------------------------- /core/sound/sound.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************************** 2 | * Genesis Plus 3 | * Sound Hardware 4 | * 5 | * Copyright (C) 1998-2003 Charles Mac Donald (original code) 6 | * Copyright (C) 2007-2020 Eke-Eke (Genesis Plus GX) 7 | * 8 | * Redistribution and use of this code or any derivative works are permitted 9 | * provided that the following conditions are met: 10 | * 11 | * - Redistributions may not be sold, nor may they be used in a commercial 12 | * product or activity. 13 | * 14 | * - Redistributions that are modified from the original source must include the 15 | * complete source code, including the source code for all components used by a 16 | * binary built from the modified sources. However, as a special exception, the 17 | * source code distributed need not include anything that is normally distributed 18 | * (in either source or binary form) with the major components (compiler, kernel, 19 | * and so on) of the operating system on which the executable runs, unless that 20 | * component itself accompanies the executable. 21 | * 22 | * - Redistributions must reproduce the above copyright notice, this list of 23 | * conditions and the following disclaimer in the documentation and/or other 24 | * materials provided with the distribution. 25 | * 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 27 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 30 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 31 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 32 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 34 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 35 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 | * POSSIBILITY OF SUCH DAMAGE. 37 | * 38 | ****************************************************************************************/ 39 | 40 | #ifndef _SOUND_H_ 41 | #define _SOUND_H_ 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | /* Function prototypes */ 48 | extern void sound_init(void); 49 | extern void sound_reset(void); 50 | extern int sound_context_save(uint8 *state); 51 | extern int sound_context_load(uint8 *state); 52 | extern int sound_update(unsigned int cycles); 53 | extern void (*fm_reset)(unsigned int cycles); 54 | extern void (*fm_write)(unsigned int cycles, unsigned int address, unsigned int data); 55 | extern unsigned int (*fm_read)(unsigned int cycles, unsigned int address); 56 | 57 | #ifdef __cplusplus 58 | } 59 | #endif 60 | 61 | #endif /* _SOUND_H_ */ 62 | -------------------------------------------------------------------------------- /core/sound/ym2413.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** 3 | ** File: ym2413.c - software implementation of YM2413 4 | ** FM sound generator type OPLL 5 | ** 6 | ** Copyright (C) 2002 Jarek Burczynski 7 | ** 8 | ** Version 1.0 9 | ** 10 | */ 11 | 12 | #ifndef _H_YM2413_ 13 | #define _H_YM2413_ 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | extern void YM2413Init(void); 20 | extern void YM2413ResetChip(void); 21 | extern void YM2413Update(int *buffer, int length); 22 | extern void YM2413Write(unsigned int a, unsigned int v); 23 | extern unsigned int YM2413Read(void); 24 | extern unsigned char *YM2413GetContextPtr(void); 25 | extern unsigned int YM2413GetContextSize(void); 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | 31 | #endif /*_H_YM2413_*/ 32 | -------------------------------------------------------------------------------- /core/sound/ym2612.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** 3 | ** software implementation of Yamaha FM sound generator (YM2612/YM3438) 4 | ** 5 | ** Original code (MAME fm.c) 6 | ** 7 | ** Copyright (C) 2001, 2002, 2003 Jarek Burczynski (bujar at mame dot net) 8 | ** Copyright (C) 1998 Tatsuyuki Satoh , MultiArcadeMachineEmulator development 9 | ** 10 | ** Version 1.4 (final beta) 11 | ** 12 | ** Additional code & fixes by Eke-Eke for Genesis Plus GX 13 | ** 14 | */ 15 | 16 | #ifndef _H_YM2612_ 17 | #define _H_YM2612_ 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | enum { 24 | YM2612_DISCRETE = 0, 25 | YM2612_INTEGRATED, 26 | YM2612_ENHANCED 27 | }; 28 | 29 | extern void YM2612Init(void); 30 | extern void YM2612Config(int type); 31 | extern void YM2612ResetChip(void); 32 | extern void YM2612Update(int *buffer, int length); 33 | extern void YM2612Write(unsigned int a, unsigned int v); 34 | extern unsigned int YM2612Read(void); 35 | extern int YM2612LoadContext(unsigned char *state); 36 | extern int YM2612SaveContext(unsigned char *state); 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif /* _YM2612_ */ 43 | -------------------------------------------------------------------------------- /core/state.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************************** 2 | * Genesis Plus 3 | * Savestate support 4 | * 5 | * Copyright (C) 2007-2019 Eke-Eke (Genesis Plus GX) 6 | * 7 | * Redistribution and use of this code or any derivative works are permitted 8 | * provided that the following conditions are met: 9 | * 10 | * - Redistributions may not be sold, nor may they be used in a commercial 11 | * product or activity. 12 | * 13 | * - Redistributions that are modified from the original source must include the 14 | * complete source code, including the source code for all components used by a 15 | * binary built from the modified sources. However, as a special exception, the 16 | * source code distributed need not include anything that is normally distributed 17 | * (in either source or binary form) with the major components (compiler, kernel, 18 | * and so on) of the operating system on which the executable runs, unless that 19 | * component itself accompanies the executable. 20 | * 21 | * - Redistributions must reproduce the above copyright notice, this list of 22 | * conditions and the following disclaimer in the documentation and/or other 23 | * materials provided with the distribution. 24 | * 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 29 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 | * POSSIBILITY OF SUCH DAMAGE. 36 | * 37 | ****************************************************************************************/ 38 | 39 | #ifndef _STATE_H_ 40 | #define _STATE_H_ 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | #define STATE_SIZE 0xfd000 47 | #define STATE_VERSION "GENPLUS-GX 1.7.5" 48 | 49 | #define load_param(param, size) \ 50 | memcpy(param, &state[bufferptr], size); \ 51 | bufferptr+= size; 52 | 53 | #define save_param(param, size) \ 54 | memcpy(&state[bufferptr], param, size); \ 55 | bufferptr+= size; 56 | 57 | /* Function prototypes */ 58 | extern int state_load(unsigned char *state); 59 | extern int state_save(unsigned char *state); 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /core/tremor/CHANGELOG: -------------------------------------------------------------------------------- 1 | *** 20020517: 1.0.2 *** 2 | 3 | Playback bugfix to floor1; mode mistakenly used for sizing instead 4 | of blockflag 5 | 6 | *** 20020515: 1.0.1 *** 7 | 8 | Added complete API documentation to source tarball. No code 9 | changes. 10 | 11 | *** 20020412: 1.0.1 *** 12 | 13 | Fixed a clipping bug that affected ARM processors; negative 14 | overflows were being properly clipped, but then clobbered to 15 | positive by the positive overflow chec (asm_arm.h:CLIP_TO_15) 16 | 17 | *** 20020403: 1.0.0 *** 18 | 19 | Initial version -------------------------------------------------------------------------------- /core/tremor/COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2002, Xiph.org Foundation 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions 5 | are met: 6 | 7 | - Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | 10 | - Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 14 | - Neither the name of the Xiph.org Foundation nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION 22 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /core/tremor/README: -------------------------------------------------------------------------------- 1 | This README covers the Ogg Vorbis 'Tremor' integer playback codec 2 | source as of date 2002 09 02, version 1.0.0. 3 | 4 | ****** 5 | 6 | The C source in this package will build on any ANSI C compiler and 7 | function completely and properly on any platform. The included build 8 | system assumes GNU build system and make tools (m4, automake, 9 | autoconf, libtool and gmake). GCC is not required, although GCC is 10 | the most tested compiler. To build using GNU tools, type in the 11 | source directory: 12 | 13 | ./autogen.sh 14 | make 15 | 16 | Currently, the source implements playback in pure C on all platforms 17 | except ARM, where a [currently] small amount of assembly (see 18 | asm_arm.h) is used to implement 64 bit math operations and fast LSP 19 | computation. If building on ARM without the benefit of GNU build 20 | system tools, be sure that '_ARM_ASSEM_' is #defined by the build 21 | system if this assembly is desired, else the resulting library will 22 | use whatever 64 bit math builtins the compiler implements. 23 | 24 | No math library is required by this source. No floating point 25 | operations are used at any point in either setup or decode. This 26 | decoder library will properly decode any past, current or future 27 | Vorbis I file or stream. 28 | 29 | ******** 30 | 31 | The build system produces a static and [when supported by the OS] 32 | dynamic library named 'libvorbisidec'. This library exposes an API 33 | nearly identical to the BSD reference library's 'libvorbisfile', 34 | including all the features familiar to users of vorbisfile. This API 35 | is similar enough that the proper header file to include is named 36 | 'ivorbisfile.h' [included in the source build directory]. Lower level 37 | libvorbis-style headers and structures are in 'ivorbiscodec.h' 38 | [included in the source build directory]. A simple example program, 39 | ivorbisfile_example.c, can be built with 'make example'. 40 | 41 | ******** 42 | 43 | Detailed Tremor API Documentation begins at doc/index.html 44 | 45 | Monty 46 | xiph.org 47 | -------------------------------------------------------------------------------- /core/tremor/Version_script.in: -------------------------------------------------------------------------------- 1 | # 2 | # Export file for libvorbisidec 3 | # 4 | # Only the symbols listed in the global section will be callable from 5 | # applications linking to libvorbisidec. 6 | # 7 | 8 | @PACKAGE@.so.1 9 | { 10 | global: 11 | ov_clear; 12 | ov_open; 13 | ov_open_callbacks; 14 | ov_test; 15 | ov_test_callbacks; 16 | ov_test_open; 17 | ov_bitrate; 18 | ov_bitrate_instant; 19 | ov_streams; 20 | ov_seekable; 21 | ov_serialnumber; 22 | ov_raw_total; 23 | ov_pcm_total; 24 | ov_time_total; 25 | ov_raw_seek; 26 | ov_pcm_seek; 27 | ov_pcm_seek_page; 28 | ov_time_seek; 29 | ov_time_seek_page; 30 | ov_raw_tell; 31 | ov_pcm_tell; 32 | ov_time_tell; 33 | ov_info; 34 | ov_comment; 35 | ov_read; 36 | 37 | vorbis_info_init; 38 | vorbis_info_clear; 39 | vorbis_info_blocksize; 40 | vorbis_comment_init; 41 | vorbis_comment_add; 42 | vorbis_comment_add_tag; 43 | vorbis_comment_query; 44 | vorbis_comment_query_count; 45 | vorbis_comment_clear; 46 | 47 | local: 48 | *; 49 | }; 50 | -------------------------------------------------------------------------------- /core/tremor/block.h: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. * 4 | * * 5 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 6 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 7 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 8 | * * 9 | * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2008 * 10 | * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ * 11 | * * 12 | ******************************************************************** 13 | 14 | function: shared block functions 15 | 16 | ********************************************************************/ 17 | 18 | #ifndef _V_BLOCK_ 19 | #define _V_BLOCK_ 20 | 21 | extern void _vorbis_block_ripcord(vorbis_block *vb); 22 | extern void *_vorbis_block_alloc(vorbis_block *vb,long bytes); 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /core/tremor/config_types.h: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. * 4 | * * 5 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 6 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 7 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 8 | * * 9 | * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 * 10 | * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ * 11 | * * 12 | ******************************************************************** 13 | 14 | function: #ifdef jail to whip a few platforms into the UNIX ideal. 15 | 16 | ********************************************************************/ 17 | #ifndef _OS_CVTYPES_H 18 | #define _OS_CVTYPES_H 19 | 20 | typedef long long ogg_int64_t; 21 | typedef int ogg_int32_t; 22 | typedef unsigned int ogg_uint32_t; 23 | typedef short ogg_int16_t; 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /core/tremor/mdct.h: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. * 4 | * * 5 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 6 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 7 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 8 | * * 9 | * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 * 10 | * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ * 11 | * * 12 | ******************************************************************** 13 | 14 | function: modified discrete cosine transform prototypes 15 | 16 | ********************************************************************/ 17 | 18 | #ifndef _OGG_mdct_H_ 19 | #define _OGG_mdct_H_ 20 | 21 | #include "ivorbiscodec.h" 22 | #include "misc.h" 23 | 24 | #define DATA_TYPE ogg_int32_t 25 | #define REG_TYPE register ogg_int32_t 26 | 27 | #ifdef _LOW_ACCURACY_ 28 | #define cPI3_8 (0x0062) 29 | #define cPI2_8 (0x00b5) 30 | #define cPI1_8 (0x00ed) 31 | #else 32 | #define cPI3_8 (0x30fbc54d) 33 | #define cPI2_8 (0x5a82799a) 34 | #define cPI1_8 (0x7641af3d) 35 | #endif 36 | 37 | extern void mdct_forward(int n, DATA_TYPE *in, DATA_TYPE *out); 38 | extern void mdct_backward(int n, DATA_TYPE *in, DATA_TYPE *out); 39 | 40 | #endif 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /core/tremor/os.h: -------------------------------------------------------------------------------- 1 | #ifndef _OS_H 2 | #define _OS_H 3 | /******************************************************************** 4 | * * 5 | * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. * 6 | * * 7 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 8 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 9 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 10 | * * 11 | * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 * 12 | * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ * 13 | * * 14 | ******************************************************************** 15 | 16 | function: #ifdef jail to whip a few platforms into the UNIX ideal. 17 | 18 | ********************************************************************/ 19 | 20 | #include 21 | #include "os_types.h" 22 | 23 | #ifndef _V_IFDEFJAIL_H_ 24 | # define _V_IFDEFJAIL_H_ 25 | 26 | # ifdef __GNUC__ 27 | # define STIN static __inline__ 28 | # elif _WIN32 29 | # define STIN static __inline 30 | # endif 31 | #else 32 | # define STIN static 33 | #endif 34 | 35 | #ifndef M_PI 36 | # define M_PI (3.1415926536f) 37 | #endif 38 | 39 | #ifdef _WIN32 40 | # include 41 | # define rint(x) (floor((x)+0.5f)) 42 | # define NO_FLOAT_MATH_LIB 43 | # define FAST_HYPOT(a, b) sqrt((a)*(a) + (b)*(b)) 44 | #ifndef _XBOX360 45 | # define LITTLE_ENDIAN 1 46 | # define BYTE_ORDER LITTLE_ENDIAN 47 | #endif 48 | #endif 49 | 50 | #ifdef HAVE_ALLOCA_H 51 | # include 52 | #endif 53 | 54 | #ifdef USE_MEMORY_H 55 | # include 56 | #endif 57 | 58 | #ifndef min 59 | # define min(x,y) ((x)>(y)?(y):(x)) 60 | #endif 61 | 62 | #ifndef max 63 | # define max(x,y) ((x)<(y)?(y):(x)) 64 | #endif 65 | 66 | #endif /* _OS_H */ 67 | -------------------------------------------------------------------------------- /core/tremor/os_types.h: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. * 4 | * * 5 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 6 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 7 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 8 | * * 9 | * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 * 10 | * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ * 11 | * * 12 | ******************************************************************** 13 | 14 | function: #ifdef jail to whip a few platforms into the UNIX ideal. 15 | 16 | ********************************************************************/ 17 | #ifndef _OS_TYPES_H 18 | #define _OS_TYPES_H 19 | 20 | #ifdef _LOW_ACCURACY_ 21 | # define X(n) (((((n)>>22)+1)>>1) - ((((n)>>22)+1)>>9)) 22 | # define LOOKUP_T const unsigned char 23 | #else 24 | # define X(n) (n) 25 | # define LOOKUP_T const ogg_int32_t 26 | #endif 27 | 28 | /* make it easy on the folks that want to compile the libs with a 29 | different malloc than stdlib */ 30 | #define _ogg_malloc malloc 31 | #define _ogg_calloc calloc 32 | #define _ogg_realloc realloc 33 | #define _ogg_free free 34 | 35 | #if defined(_WIN32) && defined(__LIBRETRO__) 36 | #include 37 | #else 38 | #include 39 | #endif 40 | 41 | typedef int64_t ogg_int64_t; 42 | typedef int32_t ogg_int32_t; 43 | typedef uint32_t ogg_uint32_t; 44 | typedef int16_t ogg_int16_t; 45 | 46 | #endif /* _OS_TYPES_H */ 47 | -------------------------------------------------------------------------------- /core/tremor/registry.c: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. * 4 | * * 5 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 6 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 7 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 8 | * * 9 | * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 * 10 | * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ * 11 | * * 12 | ******************************************************************** 13 | 14 | function: registry for floor, res backends and channel mappings 15 | 16 | ********************************************************************/ 17 | 18 | #include "ivorbiscodec.h" 19 | #include "codec_internal.h" 20 | #include "registry.h" 21 | #include "misc.h" 22 | 23 | 24 | /* seems like major overkill now; the backend numbers will grow into 25 | the infrastructure soon enough */ 26 | 27 | extern vorbis_func_floor floor0_exportbundle; 28 | extern vorbis_func_floor floor1_exportbundle; 29 | extern vorbis_func_residue residue0_exportbundle; 30 | extern vorbis_func_residue residue1_exportbundle; 31 | extern vorbis_func_residue residue2_exportbundle; 32 | extern vorbis_func_mapping mapping0_exportbundle; 33 | 34 | vorbis_func_floor *_floor_P[]={ 35 | &floor0_exportbundle, 36 | &floor1_exportbundle, 37 | }; 38 | 39 | vorbis_func_residue *_residue_P[]={ 40 | &residue0_exportbundle, 41 | &residue1_exportbundle, 42 | &residue2_exportbundle, 43 | }; 44 | 45 | vorbis_func_mapping *_mapping_P[]={ 46 | &mapping0_exportbundle, 47 | }; 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /core/tremor/registry.h: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. * 4 | * * 5 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 6 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 7 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 8 | * * 9 | * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 * 10 | * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ * 11 | * * 12 | ******************************************************************** 13 | 14 | function: registry for time, floor, res backends and channel mappings 15 | 16 | ********************************************************************/ 17 | 18 | #ifndef _V_REG_H_ 19 | #define _V_REG_H_ 20 | 21 | #define VI_TRANSFORMB 1 22 | #define VI_WINDOWB 1 23 | #define VI_TIMEB 1 24 | #define VI_FLOORB 2 25 | #define VI_RESB 3 26 | #define VI_MAPB 1 27 | 28 | #include "backends.h" 29 | 30 | #if defined(_WIN32) && defined(VORBISDLL_IMPORT) 31 | # define EXTERN __declspec(dllimport) extern 32 | #else 33 | # define EXTERN extern 34 | #endif 35 | 36 | EXTERN vorbis_func_floor *_floor_P[]; 37 | EXTERN vorbis_func_residue *_residue_P[]; 38 | EXTERN vorbis_func_mapping *_mapping_P[]; 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /core/tremor/window.c: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | * * 3 | * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. * 4 | * * 5 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 6 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 7 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 8 | * * 9 | * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 * 10 | * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ * 11 | * * 12 | ******************************************************************** 13 | 14 | function: window functions 15 | 16 | ********************************************************************/ 17 | 18 | #include 19 | #include 20 | #include "misc.h" 21 | #include "window.h" 22 | #include "window_lookup.h" 23 | 24 | const void *_vorbis_window(int type, int left){ 25 | 26 | switch(type){ 27 | case 0: 28 | 29 | switch(left){ 30 | case 32: 31 | return vwin64; 32 | case 64: 33 | return vwin128; 34 | case 128: 35 | return vwin256; 36 | case 256: 37 | return vwin512; 38 | case 512: 39 | return vwin1024; 40 | case 1024: 41 | return vwin2048; 42 | case 2048: 43 | return vwin4096; 44 | case 4096: 45 | return vwin8192; 46 | default: 47 | return(0); 48 | } 49 | break; 50 | default: 51 | return(0); 52 | } 53 | } 54 | 55 | void _vorbis_apply_window(ogg_int32_t *d,const void *window_p[2], 56 | long *blocksizes, 57 | int lW,int W,int nW){ 58 | 59 | LOOKUP_T *window[2]; 60 | long n=blocksizes[W]; 61 | long ln=blocksizes[lW]; 62 | long rn=blocksizes[nW]; 63 | 64 | long leftbegin=n/4-ln/4; 65 | long leftend=leftbegin+ln/2; 66 | 67 | long rightbegin=n/2+n/4-rn/4; 68 | long rightend=rightbegin+rn/2; 69 | 70 | int i,p; 71 | 72 | window[0]=window_p[0]; 73 | window[1]=window_p[1]; 74 | 75 | for(i=0;i 2 | #include 3 | 4 | #include "edit_fields.h" 5 | 6 | std::string GetDlgItemString(HWND hwnd, int controlID) 7 | { 8 | std::string result; 9 | 10 | const unsigned int maxTextLength = 1024; 11 | char currentTextTemp[maxTextLength]; 12 | if (GetDlgItemText(hwnd, controlID, currentTextTemp, maxTextLength) == 0) 13 | { 14 | currentTextTemp[0] = '\0'; 15 | } 16 | result = currentTextTemp; 17 | 18 | return result; 19 | } 20 | 21 | unsigned int GetDlgItemHex(HWND hwnd, int controlID) 22 | { 23 | unsigned int value = 0; 24 | 25 | const unsigned int maxTextLength = 1024; 26 | char currentTextTemp[maxTextLength]; 27 | if (GetDlgItemText(hwnd, controlID, currentTextTemp, maxTextLength) == 0) 28 | { 29 | currentTextTemp[0] = '\0'; 30 | } 31 | std::stringstream buffer; 32 | buffer << std::hex << currentTextTemp; 33 | buffer >> value; 34 | 35 | return value; 36 | } 37 | 38 | std::string make_hex_string(unsigned int width, unsigned int data) 39 | { 40 | std::string result; 41 | std::stringstream text; 42 | text << std::setw(width) << std::setfill('0') << std::hex << std::uppercase; 43 | 44 | text << (unsigned int)((uint64_t)data & (uint64_t)((uint64_t)(1ULL << (uint64_t)((uint64_t)width * 4ULL)) - 1ULL)); 45 | return text.str(); 46 | } 47 | 48 | void UpdateDlgItemHex(HWND hwnd, int controlID, unsigned int width, unsigned int data) 49 | { 50 | const unsigned int maxTextLength = 1024; 51 | char currentTextTemp[maxTextLength]; 52 | if (GetDlgItemText(hwnd, controlID, currentTextTemp, maxTextLength) == 0) 53 | { 54 | currentTextTemp[0] = '\0'; 55 | } 56 | std::string currentText = currentTextTemp; 57 | std::string result = make_hex_string(width, data); 58 | 59 | if (result != currentText) 60 | { 61 | SetDlgItemText(hwnd, controlID, result.c_str()); 62 | } 63 | } 64 | 65 | void UpdateDlgItemBin(HWND hwnd, int controlID, unsigned int data) 66 | { 67 | const unsigned int maxTextLength = 1024; 68 | char currentTextTemp[maxTextLength]; 69 | if (GetDlgItemText(hwnd, controlID, currentTextTemp, maxTextLength) == 0) 70 | { 71 | currentTextTemp[0] = '\0'; 72 | } 73 | std::string currentText = currentTextTemp; 74 | std::stringstream text; 75 | text << data; 76 | if (text.str() != currentText) 77 | { 78 | SetDlgItemText(hwnd, controlID, text.str().c_str()); 79 | } 80 | } 81 | 82 | -------------------------------------------------------------------------------- /gui/edit_fields.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | std::string make_hex_string(unsigned int width, unsigned int data); 7 | std::string GetDlgItemString(HWND hwnd, int controlID); 8 | unsigned int GetDlgItemHex(HWND hwnd, int controlID); 9 | void UpdateDlgItemHex(HWND hwnd, int controlID, unsigned int width, unsigned int data); 10 | void UpdateDlgItemBin(HWND hwnd, int controlID, unsigned int data); 11 | -------------------------------------------------------------------------------- /gui/gens2.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/gpgx_debugger/cb3f64ad8da177821b5c090a31205f8ffc54424c/gui/gens2.ico -------------------------------------------------------------------------------- /gui/gui.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | #ifdef _WIN32 8 | #include 9 | 10 | #include "plane_explorer.h" 11 | #include "vdp_ram_debug.h" 12 | #include "hex_editor.h" 13 | 14 | #define UpdateMSG (WM_USER+0x0001) 15 | 16 | extern const COLORREF normal_pal[]; 17 | unsigned short cram_9b_to_16b(unsigned short data); 18 | unsigned short cram_16b_to_9b(unsigned short data); 19 | 20 | int select_file_save(char *Dest, const char *Dir, const char *Titre, const char *Filter, const char *Ext, HWND hwnd); 21 | int select_file_load(char *Dest, const char *Dir, const char *Titre, const char *Filter, const char *Ext, HWND hwnd); 22 | 23 | extern HINSTANCE pinst; 24 | extern HWND rarch; 25 | #endif 26 | 27 | void run_gui(); 28 | void stop_gui(); 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | -------------------------------------------------------------------------------- /gui/gui.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | Your application description here. 10 | 11 | 12 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /gui/gui.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lab313ru/gpgx_debugger/cb3f64ad8da177821b5c090a31205f8ffc54424c/gui/gui.rc -------------------------------------------------------------------------------- /gui/hex_editor.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | void create_hex_editor(); 8 | void destroy_hex_editor(); 9 | void update_hex_editor(); 10 | 11 | extern HWND HexEditorHwnd; 12 | 13 | #define HEX_EDITOR_MUTEX "DBG_HEX_EDITOR_MUTEX" 14 | 15 | #ifdef __cplusplus 16 | } 17 | #endif 18 | -------------------------------------------------------------------------------- /gui/plane_explorer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | #include 8 | 9 | void create_plane_explorer(); 10 | void destroy_plane_explorer(); 11 | void update_plane_explorer(); 12 | 13 | #define PLANE_EXPLORER_MUTEX "DBG_PLANE_EXPLORER_MUTEX" 14 | extern HWND PlaneExplorerHWnd; 15 | 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | -------------------------------------------------------------------------------- /gui/vdp_ram_debug.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | void create_vdp_ram_debug(); 8 | void destroy_vdp_ram_debug(); 9 | void update_vdp_ram_debug(); 10 | 11 | extern HWND VDPRamHWnd; 12 | 13 | #define VDP_RAM_MUTEX "DBG_VDP_RAM_MUTEX" 14 | 15 | #ifdef __cplusplus 16 | } 17 | #endif 18 | -------------------------------------------------------------------------------- /gx/osd.h: -------------------------------------------------------------------------------- 1 | /*************************************************/ 2 | /* port specific stuff should be put there */ 3 | /*************************************************/ 4 | 5 | #ifndef _OSD_H_ 6 | #define _OSD_H_ 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | #ifdef HW_RVL 23 | #include 24 | #include 25 | #include "vi_encoder.h" 26 | #endif 27 | 28 | #include "gx_input.h" 29 | #include "gx_audio.h" 30 | #include "gx_video.h" 31 | #include "file_load.h" 32 | #include "cheats.h" 33 | 34 | #include "config.h" 35 | #include "fileio.h" 36 | 37 | #define DEFAULT_PATH "/genplus" 38 | 39 | /*************************************************/ 40 | /* required by Genesis Plus GX core */ 41 | /*************************************************/ 42 | #define CD_BIOS_US config.sys_rom[0] 43 | #define CD_BIOS_EU config.sys_rom[1] 44 | #define CD_BIOS_JP config.sys_rom[2] 45 | #define MD_BIOS config.sys_rom[3] 46 | #define MS_BIOS_US config.sys_rom[4] 47 | #define MS_BIOS_EU config.sys_rom[5] 48 | #define MS_BIOS_JP config.sys_rom[6] 49 | #define GG_BIOS config.sys_rom[7] 50 | #define GG_ROM config.sys_rom[8] 51 | #define AR_ROM config.sys_rom[9] 52 | #define SK_ROM config.sys_rom[10] 53 | #define SK_UPMEM config.sys_rom[11] 54 | 55 | #define CD_BRAM_US "/genplus/saves/cd/scd_U.brm" 56 | #define CD_BRAM_EU "/genplus/saves/cd/scd_E.brm" 57 | #define CD_BRAM_JP "/genplus/saves/cd/scd_J.brm" 58 | #define CART_BRAM "/genplus/saves/cd/cart.brm" 59 | 60 | /*********************************************************/ 61 | /* implemented by Genesis Plus GX core (GC/Wii specific) */ 62 | /*********************************************************/ 63 | 64 | /* 32 bytes aligned sound buffers (8 samples alignment) */ 65 | #define ALIGN_SND 0xfffffff8 66 | 67 | /* use Wii DVD LED to indicate when virtual CD tray is open */ 68 | #ifdef HW_RVL 69 | #define CD_TRAY_CALLBACK *(u32*)0xcd0000c0 = (*(u32*)0xcd0000c0 & ~0x20) | ((cdd.status == CD_OPEN) << 5); 70 | #endif 71 | 72 | /*************************************************/ 73 | 74 | #define VERSION "Genesis Plus GX 1.7.5" 75 | 76 | #define VIDEO_WAIT 0x01 77 | #define AUDIO_WAIT 0x02 78 | #define VIDEO_UPDATE 0x04 79 | #define AUDIO_UPDATE 0x08 80 | 81 | /* globals */ 82 | extern void legal(void); 83 | extern double get_framerate(void); 84 | extern void reloadrom(void); 85 | extern void shutdown(void); 86 | extern u32 Shutdown; 87 | extern u32 ConfigRequested; 88 | 89 | #endif /* _OSD_H_ */ 90 | -------------------------------------------------------------------------------- /ida/bpts_window.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class BptsWindow : public QWidget 6 | { 7 | Q_OBJECT 8 | 9 | public: 10 | BptsWindow(QWidget* _parent) : QWidget(_parent) {} 11 | 12 | private slots: 13 | void addBreakpoint(); 14 | void delBreakpoint(); 15 | void clrBreakpoints(); 16 | void rowDoubleClick(int row, int col); 17 | }; -------------------------------------------------------------------------------- /ida/ida_debmod.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | //-------------------------------------------------------------------------- 8 | // Very simple class to store pending events 9 | enum queue_pos_t 10 | { 11 | IN_FRONT, 12 | IN_BACK 13 | }; 14 | 15 | struct eventlist_t : public std::deque 16 | { 17 | private: 18 | bool synced; 19 | public: 20 | // save a pending event 21 | void enqueue(const debug_event_t &ev, queue_pos_t pos) 22 | { 23 | if (pos != IN_BACK) 24 | push_front(ev); 25 | else 26 | push_back(ev); 27 | } 28 | 29 | // retrieve a pending event 30 | bool retrieve(debug_event_t *event) 31 | { 32 | if (empty()) 33 | return false; 34 | // get the first event and return it 35 | *event = front(); 36 | pop_front(); 37 | return true; 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /ida/ida_plugin.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define NAME "gxida" 4 | #define VERSION "1.3" 5 | 6 | #include 7 | #include "debug_wrap.h" 8 | 9 | bpt_type_t idaBptToGx(bpttype_t type); -------------------------------------------------------------------------------- /libretro/libretro-common/compat/compat_strl.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2018 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (compat_strl.c). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #include 24 | #include 25 | 26 | #include 27 | 28 | /* Implementation of strlcpy()/strlcat() based on OpenBSD. */ 29 | 30 | #ifndef __MACH__ 31 | 32 | size_t strlcpy(char *dest, const char *source, size_t size) 33 | { 34 | size_t src_size = 0; 35 | size_t n = size; 36 | 37 | if (n) 38 | while (--n && (*dest++ = *source++)) src_size++; 39 | 40 | if (!n) 41 | { 42 | if (size) *dest = '\0'; 43 | while (*source++) src_size++; 44 | } 45 | 46 | return src_size; 47 | } 48 | 49 | size_t strlcat(char *dest, const char *source, size_t size) 50 | { 51 | size_t len = strlen(dest); 52 | 53 | dest += len; 54 | 55 | if (len > size) 56 | size = 0; 57 | else 58 | size -= len; 59 | 60 | return len + strlcpy(dest, source, size); 61 | } 62 | #endif 63 | 64 | char *strldup(const char *s, size_t n) 65 | { 66 | char *dst = (char*)malloc(sizeof(char) * (n + 1)); 67 | strlcpy(dst, s, n); 68 | return dst; 69 | } 70 | -------------------------------------------------------------------------------- /libretro/libretro-common/compat/fopen_utf8.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2018 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (fopen_utf8.c). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0500 || defined(_XBOX) 29 | #ifndef LEGACY_WIN32 30 | #define LEGACY_WIN32 31 | #endif 32 | #endif 33 | 34 | #ifdef _WIN32 35 | #undef fopen 36 | 37 | void *fopen_utf8(const char * filename, const char * mode) 38 | { 39 | #if defined(_XBOX) 40 | return fopen(filename, mode); 41 | #elif defined(LEGACY_WIN32) 42 | FILE *ret = NULL; 43 | char * filename_local = utf8_to_local_string_alloc(filename); 44 | 45 | if (!filename_local) 46 | return NULL; 47 | ret = fopen(filename_local, mode); 48 | if (filename_local) 49 | free(filename_local); 50 | return ret; 51 | #else 52 | wchar_t * filename_w = utf8_to_utf16_string_alloc(filename); 53 | wchar_t * mode_w = utf8_to_utf16_string_alloc(mode); 54 | FILE* ret = _wfopen(filename_w, mode_w); 55 | free(filename_w); 56 | free(mode_w); 57 | return ret; 58 | #endif 59 | } 60 | #endif 61 | -------------------------------------------------------------------------------- /libretro/libretro-common/include/boolean.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2018 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (boolean.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __LIBRETRO_SDK_BOOLEAN_H 24 | #define __LIBRETRO_SDK_BOOLEAN_H 25 | 26 | #ifndef __cplusplus 27 | 28 | #if defined(_MSC_VER) && _MSC_VER < 1800 && !defined(SN_TARGET_PS3) 29 | /* Hack applied for MSVC when compiling in C89 mode as it isn't C99 compliant. */ 30 | #define bool unsigned char 31 | #define true 1 32 | #define false 0 33 | #else 34 | #include 35 | #endif 36 | 37 | #endif 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /libretro/libretro-common/include/compat/apple_compat.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2018 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (apple_compat.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __APPLE_COMPAT_H 24 | #define __APPLE_COMPAT_H 25 | 26 | #ifdef __APPLE__ 27 | #include 28 | #endif 29 | 30 | #ifdef __OBJC__ 31 | 32 | #if (MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4) 33 | typedef int NSInteger; 34 | typedef unsigned NSUInteger; 35 | typedef float CGFloat; 36 | #endif 37 | 38 | #ifndef __has_feature 39 | /* Compatibility with non-Clang compilers. */ 40 | #define __has_feature(x) 0 41 | #endif 42 | 43 | #ifndef CF_RETURNS_RETAINED 44 | #if __has_feature(attribute_cf_returns_retained) 45 | #define CF_RETURNS_RETAINED __attribute__((cf_returns_retained)) 46 | #else 47 | #define CF_RETURNS_RETAINED 48 | #endif 49 | #endif 50 | 51 | #ifndef NS_INLINE 52 | #define NS_INLINE inline 53 | #endif 54 | 55 | NS_INLINE CF_RETURNS_RETAINED CFTypeRef CFBridgingRetainCompat(id X) 56 | { 57 | #if __has_feature(objc_arc) 58 | return (__bridge_retained CFTypeRef)X; 59 | #else 60 | return X; 61 | #endif 62 | } 63 | 64 | #endif 65 | 66 | #ifdef IOS 67 | #ifndef __IPHONE_5_0 68 | #warning "This project uses features only available in iOS SDK 5.0 and later." 69 | #endif 70 | 71 | #ifdef __OBJC__ 72 | #import 73 | #import 74 | #import 75 | #endif 76 | 77 | #else 78 | 79 | #ifdef __OBJC__ 80 | #include 81 | #endif 82 | #endif 83 | 84 | #endif 85 | -------------------------------------------------------------------------------- /libretro/libretro-common/include/compat/fnmatch.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2018 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (fnmatch.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __LIBRETRO_SDK_COMPAT_FNMATCH_H__ 24 | #define __LIBRETRO_SDK_COMPAT_FNMATCH_H__ 25 | 26 | #define FNM_NOMATCH 1 27 | 28 | int rl_fnmatch(const char *pattern, const char *string, int flags); 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /libretro/libretro-common/include/compat/fopen_utf8.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2018 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (fopen_utf8.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __LIBRETRO_SDK_COMPAT_FOPEN_UTF8_H 24 | #define __LIBRETRO_SDK_COMPAT_FOPEN_UTF8_H 25 | 26 | #ifdef _WIN32 27 | /* Defined to error rather than fopen_utf8, to make it clear to everyone reading the code that not worrying about utf16 is fine */ 28 | /* TODO: enable */ 29 | /* #define fopen (use fopen_utf8 instead) */ 30 | void *fopen_utf8(const char * filename, const char * mode); 31 | #else 32 | #define fopen_utf8 fopen 33 | #endif 34 | #endif 35 | -------------------------------------------------------------------------------- /libretro/libretro-common/include/compat/getopt.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2018 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (getopt.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __LIBRETRO_SDK_COMPAT_GETOPT_H 24 | #define __LIBRETRO_SDK_COMPAT_GETOPT_H 25 | 26 | #if defined(RARCH_INTERNAL) && defined(HAVE_CONFIG_H) 27 | #include "../../../config.h" 28 | #endif 29 | 30 | /* Custom implementation of the GNU getopt_long for portability. 31 | * Not designed to be fully compatible, but compatible with 32 | * the features RetroArch uses. */ 33 | 34 | #ifdef HAVE_GETOPT_LONG 35 | #include 36 | #else 37 | /* Avoid possible naming collisions during link since we 38 | * prefer to use the actual name. */ 39 | #define getopt_long(argc, argv, optstring, longopts, longindex) __getopt_long_retro(argc, argv, optstring, longopts, longindex) 40 | 41 | #include 42 | 43 | RETRO_BEGIN_DECLS 44 | 45 | struct option 46 | { 47 | const char *name; 48 | int has_arg; 49 | int *flag; 50 | int val; 51 | }; 52 | 53 | /* argv[] is declared with char * const argv[] in GNU, 54 | * but this makes no sense, as non-POSIX getopt_long 55 | * mutates argv (non-opts are moved to the end). */ 56 | int getopt_long(int argc, char *argv[], 57 | const char *optstring, const struct option *longopts, int *longindex); 58 | extern char *optarg; 59 | extern int optind, opterr, optopt; 60 | 61 | RETRO_END_DECLS 62 | 63 | /* If these are variously #defined, then we have bigger problems */ 64 | #ifndef no_argument 65 | #define no_argument 0 66 | #define required_argument 1 67 | #define optional_argument 2 68 | #endif 69 | 70 | /* HAVE_GETOPT_LONG */ 71 | #endif 72 | 73 | /* pragma once */ 74 | #endif 75 | 76 | -------------------------------------------------------------------------------- /libretro/libretro-common/include/compat/ifaddrs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1995, 1999 3 | * Berkeley Software Design, Inc. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * THIS SOFTWARE IS PROVIDED BY Berkeley Software Design, Inc. ``AS IS'' AND 12 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 13 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 14 | * ARE DISCLAIMED. IN NO EVENT SHALL Berkeley Software Design, Inc. BE LIABLE 15 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 16 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 17 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 18 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 19 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 20 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 21 | * SUCH DAMAGE. 22 | * 23 | * BSDI ifaddrs.h,v 2.5 2000/02/23 14:51:59 dab Exp 24 | */ 25 | 26 | #ifndef _IFADDRS_H_ 27 | #define _IFADDRS_H_ 28 | 29 | struct ifaddrs 30 | { 31 | struct ifaddrs *ifa_next; 32 | char *ifa_name; 33 | unsigned int ifa_flags; 34 | struct sockaddr *ifa_addr; 35 | struct sockaddr *ifa_netmask; 36 | struct sockaddr *ifa_dstaddr; 37 | void *ifa_data; 38 | }; 39 | 40 | /* 41 | * This may have been defined in . Note that if is 42 | * to be included it must be included before this header file. 43 | */ 44 | #ifndef ifa_broadaddr 45 | #define ifa_broadaddr ifa_dstaddr /* broadcast address interface */ 46 | #endif 47 | 48 | #include 49 | 50 | extern int getifaddrs(struct ifaddrs **ifap); 51 | extern void freeifaddrs(struct ifaddrs *ifa); 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /libretro/libretro-common/include/compat/intrinsics.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2018 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (intrinsics.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __LIBRETRO_SDK_COMPAT_INTRINSICS_H 24 | #define __LIBRETRO_SDK_COMPAT_INTRINSICS_H 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | #include 31 | #include 32 | 33 | #if defined(_MSC_VER) && !defined(_XBOX) 34 | #if (_MSC_VER > 1310) 35 | #include 36 | #endif 37 | #endif 38 | 39 | RETRO_BEGIN_DECLS 40 | 41 | /* Count Leading Zero, unsigned 16bit input value */ 42 | static INLINE unsigned compat_clz_u16(uint16_t val) 43 | { 44 | #ifdef __GNUC__ 45 | return __builtin_clz(val << 16 | 0x8000); 46 | #else 47 | unsigned ret = 0; 48 | 49 | while(!(val & 0x8000) && ret < 16) 50 | { 51 | val <<= 1; 52 | ret++; 53 | } 54 | 55 | return ret; 56 | #endif 57 | } 58 | 59 | /* Count Trailing Zero */ 60 | static INLINE int compat_ctz(unsigned x) 61 | { 62 | #if defined(__GNUC__) && !defined(RARCH_CONSOLE) 63 | return __builtin_ctz(x); 64 | #elif _MSC_VER >= 1400 && !defined(_XBOX) 65 | unsigned long r = 0; 66 | _BitScanReverse((unsigned long*)&r, x); 67 | return (int)r; 68 | #else 69 | /* Only checks at nibble granularity, 70 | * because that's what we need. */ 71 | if (x & 0x000f) 72 | return 0; 73 | if (x & 0x00f0) 74 | return 4; 75 | if (x & 0x0f00) 76 | return 8; 77 | if (x & 0xf000) 78 | return 12; 79 | return 16; 80 | #endif 81 | } 82 | 83 | RETRO_END_DECLS 84 | 85 | #endif 86 | -------------------------------------------------------------------------------- /libretro/libretro-common/include/compat/posix_string.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2018 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (posix_string.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __LIBRETRO_SDK_COMPAT_POSIX_STRING_H 24 | #define __LIBRETRO_SDK_COMPAT_POSIX_STRING_H 25 | 26 | #include 27 | 28 | #ifdef _MSC_VER 29 | #include 30 | #endif 31 | 32 | RETRO_BEGIN_DECLS 33 | 34 | #ifdef _WIN32 35 | #undef strtok_r 36 | #define strtok_r(str, delim, saveptr) retro_strtok_r__(str, delim, saveptr) 37 | 38 | char *strtok_r(char *str, const char *delim, char **saveptr); 39 | #endif 40 | 41 | #ifdef _MSC_VER 42 | #undef strcasecmp 43 | #undef strdup 44 | #define strcasecmp(a, b) retro_strcasecmp__(a, b) 45 | #define strdup(orig) retro_strdup__(orig) 46 | int strcasecmp(const char *a, const char *b); 47 | char *strdup(const char *orig); 48 | 49 | /* isblank is available since MSVC 2013 */ 50 | #if _MSC_VER < 1800 51 | #undef isblank 52 | #define isblank(c) retro_isblank__(c) 53 | int isblank(int c); 54 | #endif 55 | 56 | #endif 57 | 58 | 59 | RETRO_END_DECLS 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /libretro/libretro-common/include/compat/strcasestr.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2018 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (strcasestr.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __LIBRETRO_SDK_COMPAT_STRCASESTR_H 24 | #define __LIBRETRO_SDK_COMPAT_STRCASESTR_H 25 | 26 | #include 27 | 28 | #if defined(RARCH_INTERNAL) && defined(HAVE_CONFIG_H) 29 | #include "../../../config.h" 30 | #endif 31 | 32 | #ifndef HAVE_STRCASESTR 33 | 34 | #include 35 | 36 | RETRO_BEGIN_DECLS 37 | 38 | /* Avoid possible naming collisions during link 39 | * since we prefer to use the actual name. */ 40 | #define strcasestr(haystack, needle) strcasestr_retro__(haystack, needle) 41 | 42 | char *strcasestr(const char *haystack, const char *needle); 43 | 44 | RETRO_END_DECLS 45 | 46 | #endif 47 | 48 | #endif 49 | 50 | -------------------------------------------------------------------------------- /libretro/libretro-common/include/compat/strl.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2018 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (strl.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __LIBRETRO_SDK_COMPAT_STRL_H 24 | #define __LIBRETRO_SDK_COMPAT_STRL_H 25 | 26 | #include 27 | #include 28 | 29 | #if defined(RARCH_INTERNAL) && defined(HAVE_CONFIG_H) 30 | #include "../../../config.h" 31 | #endif 32 | 33 | #include 34 | 35 | RETRO_BEGIN_DECLS 36 | 37 | #ifdef __MACH__ 38 | #ifndef HAVE_STRL 39 | #define HAVE_STRL 40 | #endif 41 | #endif 42 | 43 | #ifndef HAVE_STRL 44 | /* Avoid possible naming collisions during link since 45 | * we prefer to use the actual name. */ 46 | #define strlcpy(dst, src, size) strlcpy_retro__(dst, src, size) 47 | 48 | #define strlcat(dst, src, size) strlcat_retro__(dst, src, size) 49 | 50 | size_t strlcpy(char *dest, const char *source, size_t size); 51 | size_t strlcat(char *dest, const char *source, size_t size); 52 | 53 | #endif 54 | 55 | char *strldup(const char *s, size_t n); 56 | 57 | RETRO_END_DECLS 58 | 59 | #endif 60 | 61 | -------------------------------------------------------------------------------- /libretro/libretro-common/include/encodings/utf.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2018 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (utf.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef _LIBRETRO_ENCODINGS_UTF_H 24 | #define _LIBRETRO_ENCODINGS_UTF_H 25 | 26 | #include 27 | #include 28 | 29 | #include 30 | 31 | #include 32 | 33 | RETRO_BEGIN_DECLS 34 | 35 | enum CodePage 36 | { 37 | CODEPAGE_LOCAL = 0, /* CP_ACP */ 38 | CODEPAGE_UTF8 = 65001 /* CP_UTF8 */ 39 | }; 40 | 41 | size_t utf8_conv_utf32(uint32_t *out, size_t out_chars, 42 | const char *in, size_t in_size); 43 | 44 | bool utf16_conv_utf8(uint8_t *out, size_t *out_chars, 45 | const uint16_t *in, size_t in_size); 46 | 47 | size_t utf8len(const char *string); 48 | 49 | size_t utf8cpy(char *d, size_t d_len, const char *s, size_t chars); 50 | 51 | const char *utf8skip(const char *str, size_t chars); 52 | 53 | uint32_t utf8_walk(const char **string); 54 | 55 | bool utf16_to_char_string(const uint16_t *in, char *s, size_t len); 56 | 57 | char* utf8_to_local_string_alloc(const char *str); 58 | 59 | char* local_to_utf8_string_alloc(const char *str); 60 | 61 | wchar_t* utf8_to_utf16_string_alloc(const char *str); 62 | 63 | char* utf16_to_utf8_string_alloc(const wchar_t *str); 64 | 65 | RETRO_END_DECLS 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /libretro/libretro-common/include/memmap.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2018 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (memmap.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef _LIBRETRO_MEMMAP_H 24 | #define _LIBRETRO_MEMMAP_H 25 | 26 | #include 27 | #include 28 | 29 | #if defined(__CELLOS_LV2__) || defined(PSP) || defined(GEKKO) || defined(VITA) || defined(_XBOX) || defined(_3DS) || defined(WIIU) || defined(SWITCH) 30 | /* No mman available */ 31 | #elif defined(_WIN32) && !defined(_XBOX) 32 | #include 33 | #include 34 | #include 35 | #else 36 | #define HAVE_MMAN 37 | #include 38 | #endif 39 | 40 | #if !defined(HAVE_MMAN) || defined(_WIN32) 41 | void* mmap(void *addr, size_t len, int mmap_prot, int mmap_flags, int fildes, size_t off); 42 | 43 | int munmap(void *addr, size_t len); 44 | 45 | int mprotect(void *addr, size_t len, int prot); 46 | #endif 47 | 48 | int memsync(void *start, void *end); 49 | 50 | int memprotect(void *addr, size_t len); 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /libretro/libretro-common/include/retro_common.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2018 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (retro_common.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef _LIBRETRO_COMMON_RETRO_COMMON_H 24 | #define _LIBRETRO_COMMON_RETRO_COMMON_H 25 | 26 | /* 27 | This file is designed to normalize the libretro-common compiling environment. 28 | It is not to be used in public API headers, as they should be designed as leanly as possible. 29 | Nonetheless.. in the meantime, if you do something like use ssize_t, which is not fully portable, 30 | in a public API, you may need this. 31 | */ 32 | 33 | /* conditional compilation is handled inside here */ 34 | #include 35 | 36 | #endif 37 | 38 | -------------------------------------------------------------------------------- /libretro/libretro-common/include/retro_inline.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2018 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (retro_inline.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __LIBRETRO_SDK_INLINE_H 24 | #define __LIBRETRO_SDK_INLINE_H 25 | 26 | #ifndef INLINE 27 | 28 | #if defined(_WIN32) || defined(__INTEL_COMPILER) 29 | #define INLINE __inline 30 | #elif defined(__STDC_VERSION__) && __STDC_VERSION__>=199901L 31 | #define INLINE inline 32 | #elif defined(__GNUC__) 33 | #define INLINE __inline__ 34 | #else 35 | #define INLINE 36 | #endif 37 | 38 | #endif 39 | #endif 40 | -------------------------------------------------------------------------------- /libretro/libretro-common/include/streams/file_stream_transforms.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2018 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (file_stream_transforms.h). 5 | * --------------------------------------------------------------------------------------- 6 | * 7 | * Permission is hereby granted, free of charge, 8 | * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 | * to deal in the Software without restriction, including without limitation the rights to 10 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 | * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef __LIBRETRO_SDK_FILE_STREAM_TRANSFORMS_H 24 | #define __LIBRETRO_SDK_FILE_STREAM_TRANSFORMS_H 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | RETRO_BEGIN_DECLS 32 | 33 | #define FILE RFILE 34 | 35 | #undef fopen 36 | #undef fclose 37 | #undef ftell 38 | #undef fseek 39 | #undef fread 40 | #undef fgets 41 | #undef fgetc 42 | #undef fwrite 43 | #undef fputc 44 | #undef fprintf 45 | #undef ferror 46 | #undef feof 47 | 48 | #define fopen rfopen 49 | #define fclose rfclose 50 | #define ftell rftell 51 | #define fseek rfseek 52 | #define fread rfread 53 | #define fgets rfgets 54 | #define fgetc rfgetc 55 | #define fwrite rfwrite 56 | #define fputc rfputc 57 | #define fprintf rfprintf 58 | #define ferror rferror 59 | #define feof rfeof 60 | 61 | RFILE* rfopen(const char *path, const char *mode); 62 | 63 | int rfclose(RFILE* stream); 64 | 65 | int64_t rftell(RFILE* stream); 66 | 67 | int64_t rfseek(RFILE* stream, int64_t offset, int origin); 68 | 69 | int64_t rfread(void* buffer, 70 | size_t elem_size, size_t elem_count, RFILE* stream); 71 | 72 | char *rfgets(char *buffer, int maxCount, RFILE* stream); 73 | 74 | int rfgetc(RFILE* stream); 75 | 76 | int64_t rfwrite(void const* buffer, 77 | size_t elem_size, size_t elem_count, RFILE* stream); 78 | 79 | int rfputc(int character, RFILE * stream); 80 | 81 | int rfprintf(RFILE * stream, const char * format, ...); 82 | 83 | int rferror(RFILE* stream); 84 | 85 | int rfeof(RFILE* stream); 86 | 87 | RETRO_END_DECLS 88 | 89 | #endif 90 | -------------------------------------------------------------------------------- /libretro/libretro_msvc/gpgx_debugger.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30225.117 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gpgx_debugger", "gpgx_debugger.vcxproj", "{6E5A2D82-D5E3-4AE2-9253-733BAC8A924C}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gxida", "gxida.vcxproj", "{DC4CD76D-E7ED-4C1C-9DB1-C079907DE35F}" 9 | EndProject 10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sega_roms_ldr", "sega_roms_ldr.vcxproj", "{9E3FD2A3-3F03-42FB-B268-82505CCF0F6C}" 11 | EndProject 12 | Global 13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 14 | Debug|x64 = Debug|x64 15 | Release|x64 = Release|x64 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {6E5A2D82-D5E3-4AE2-9253-733BAC8A924C}.Debug|x64.ActiveCfg = Debug|x64 19 | {6E5A2D82-D5E3-4AE2-9253-733BAC8A924C}.Debug|x64.Build.0 = Debug|x64 20 | {6E5A2D82-D5E3-4AE2-9253-733BAC8A924C}.Release|x64.ActiveCfg = Release|x64 21 | {6E5A2D82-D5E3-4AE2-9253-733BAC8A924C}.Release|x64.Build.0 = Release|x64 22 | {DC4CD76D-E7ED-4C1C-9DB1-C079907DE35F}.Debug|x64.ActiveCfg = Debug|x64 23 | {DC4CD76D-E7ED-4C1C-9DB1-C079907DE35F}.Debug|x64.Build.0 = Debug|x64 24 | {DC4CD76D-E7ED-4C1C-9DB1-C079907DE35F}.Release|x64.ActiveCfg = Release|x64 25 | {DC4CD76D-E7ED-4C1C-9DB1-C079907DE35F}.Release|x64.Build.0 = Release|x64 26 | {9E3FD2A3-3F03-42FB-B268-82505CCF0F6C}.Debug|x64.ActiveCfg = Debug|x64 27 | {9E3FD2A3-3F03-42FB-B268-82505CCF0F6C}.Debug|x64.Build.0 = Debug|x64 28 | {9E3FD2A3-3F03-42FB-B268-82505CCF0F6C}.Release|x64.ActiveCfg = Release|x64 29 | {9E3FD2A3-3F03-42FB-B268-82505CCF0F6C}.Release|x64.Build.0 = Release|x64 30 | EndGlobalSection 31 | GlobalSection(SolutionProperties) = preSolution 32 | HideSolutionNode = FALSE 33 | EndGlobalSection 34 | GlobalSection(ExtensibilityGlobals) = postSolution 35 | SolutionGuid = {3D50B6EB-2DBD-4200-BDCA-478C602B6F32} 36 | EndGlobalSection 37 | EndGlobal 38 | -------------------------------------------------------------------------------- /libretro/libretro_msvc/gpgx_debugger.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | d:\RetroArch\ 5 | WindowsLocalDebugger 6 | d:\RetroArch\RetroArch.exe 7 | 8 | 9 | d:\RetroArch\RetroArch.exe 10 | d:\RetroArch\ 11 | WindowsLocalDebugger 12 | 13 | -------------------------------------------------------------------------------- /libretro/libretro_msvc/gxida.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;ipp;xsd 11 | 12 | 13 | 14 | 15 | Source Files 16 | 17 | 18 | Source Files 19 | 20 | 21 | Source Files 22 | 23 | 24 | Source Files 25 | 26 | 27 | 28 | 29 | Header Files 30 | 31 | 32 | Header Files 33 | 34 | 35 | Header Files 36 | 37 | 38 | 39 | 40 | Source Files 41 | 42 | 43 | -------------------------------------------------------------------------------- /libretro/libretro_msvc/gxida.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | c:\Program Files\IDA Pro 7.5\ida.exe 5 | $(OutDir) 6 | WindowsLocalDebugger 7 | 8 | 9 | c:\Program Files\IDA Pro 7.5\ida.exe 10 | $(OutDir) 11 | WindowsLocalDebugger 12 | 13 | -------------------------------------------------------------------------------- /libretro/libretro_msvc/sega_roms_ldr.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #define VERSION "2.0" 7 | 8 | struct gen_hdr { 9 | unsigned char CopyRights[32]; 10 | unsigned char DomesticName[48]; 11 | unsigned char OverseasName[48]; 12 | unsigned char ProductCode[14]; 13 | unsigned short CheckSum; 14 | unsigned char Peripherials[16]; 15 | unsigned int RomStart; 16 | unsigned int RomEnd; 17 | unsigned int RamStart; 18 | unsigned int RamEnd; 19 | unsigned char SramCode[12]; 20 | unsigned char ModemCode[12]; 21 | unsigned char Reserved[40]; 22 | unsigned char CountryCode[16]; 23 | }; 24 | 25 | struct gen_vect { 26 | union { 27 | struct { 28 | unsigned int SSP; 29 | unsigned int Reset; 30 | unsigned int BusErr; 31 | unsigned int AdrErr; 32 | unsigned int InvOpCode; 33 | unsigned int DivBy0; 34 | unsigned int Check; 35 | unsigned int TrapV; 36 | unsigned int GPF; 37 | unsigned int Trace; 38 | unsigned int Reserv0; 39 | unsigned int Reserv1; 40 | unsigned int Reserv2; 41 | unsigned int Reserv3; 42 | unsigned int Reserv4; 43 | unsigned int BadInt; 44 | unsigned int Reserv10; 45 | unsigned int Reserv11; 46 | unsigned int Reserv12; 47 | unsigned int Reserv13; 48 | unsigned int Reserv14; 49 | unsigned int Reserv15; 50 | unsigned int Reserv16; 51 | unsigned int Reserv17; 52 | unsigned int BadIRQ; 53 | unsigned int IRQ1; 54 | unsigned int EXT; 55 | unsigned int IRQ3; 56 | unsigned int HBLANK; 57 | unsigned int IRQ5; 58 | unsigned int VBLANK; 59 | unsigned int IRQ7; 60 | unsigned int Trap0; 61 | unsigned int Trap1; 62 | unsigned int Trap2; 63 | unsigned int Trap3; 64 | unsigned int Trap4; 65 | unsigned int Trap5; 66 | unsigned int Trap6; 67 | unsigned int Trap7; 68 | unsigned int Trap8; 69 | unsigned int Trap9; 70 | unsigned int Trap10; 71 | unsigned int Trap11; 72 | unsigned int Trap12; 73 | unsigned int Trap13; 74 | unsigned int Trap14; 75 | unsigned int Trap15; 76 | unsigned int Reserv30; 77 | unsigned int Reserv31; 78 | unsigned int Reserv32; 79 | unsigned int Reserv33; 80 | unsigned int Reserv34; 81 | unsigned int Reserv35; 82 | unsigned int Reserv36; 83 | unsigned int Reserv37; 84 | unsigned int Reserv38; 85 | unsigned int Reserv39; 86 | unsigned int Reserv3A; 87 | unsigned int Reserv3B; 88 | unsigned int Reserv3C; 89 | unsigned int Reserv3D; 90 | unsigned int Reserv3E; 91 | unsigned int Reserv3F; 92 | }; 93 | unsigned int vectors[64]; 94 | }; 95 | }; 96 | 97 | idaman loader_t ida_module_data LDSC; -------------------------------------------------------------------------------- /libretro/libretro_msvc/sega_roms_ldr.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;ipp;xsd 11 | 12 | 13 | 14 | 15 | Header Files 16 | 17 | 18 | 19 | 20 | Source Files 21 | 22 | 23 | -------------------------------------------------------------------------------- /libretro/libretro_msvc/sega_roms_ldr.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | $(OutDir) 5 | WindowsLocalDebugger 6 | c:\Program Files\IDA Pro 7.5\ida.exe 7 | 8 | 9 | $(OutDir) 10 | WindowsLocalDebugger 11 | c:\Program Files\IDA Pro 7.4\ida.exe 12 | 13 | -------------------------------------------------------------------------------- /libretro/scrc32.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * scrc32.h 3 | * 4 | * Genesis Plus GX libretro port 5 | * 6 | * Copyright Eke-Eke (2007-2015) 7 | * 8 | * Copyright Daniel De Matteis (2012-2016) 9 | * 10 | * Redistribution and use of this code or any derivative works are permitted 11 | * provided that the following conditions are met: 12 | * 13 | * - Redistributions may not be sold, nor may they be used in a commercial 14 | * product or activity. 15 | * 16 | * - Redistributions that are modified from the original source must include the 17 | * complete source code, including the source code for all components used by a 18 | * binary built from the modified sources. However, as a special exception, the 19 | * source code distributed need not include anything that is normally distributed 20 | * (in either source or binary form) with the major components (compiler, kernel, 21 | * and so on) of the operating system on which the executable runs, unless that 22 | * component itself accompanies the executable. 23 | * 24 | * - Redistributions must reproduce the above copyright notice, this list of 25 | * conditions and the following disclaimer in the documentation and/or other 26 | * materials provided with the distribution. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 29 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 30 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 31 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 32 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 33 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 34 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 35 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 36 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 37 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 | * POSSIBILITY OF SUCH DAMAGE. 39 | * 40 | ****************************************************************************************/ 41 | #ifndef _S_CRC32_H 42 | #define _S_CRC32_H 43 | 44 | unsigned long crc32(unsigned long crc, const unsigned char *buf, unsigned int len); 45 | 46 | #endif 47 | --------------------------------------------------------------------------------