├── jni └── Application.mk ├── platform ├── common │ ├── version.h │ ├── ogg.h │ ├── dismips.h │ ├── config_file.h │ ├── mp3_dummy.c │ ├── plat_sdl.h │ ├── arm_utils.h │ ├── mp3.h │ ├── tremor │ │ ├── CHANGELOG │ │ ├── ogg │ │ │ └── config_types.h │ │ ├── block.h │ │ ├── window.h │ │ ├── COPYING │ │ ├── registry.h │ │ ├── mdct.h │ │ ├── os_types.h │ │ ├── registry.c │ │ ├── os.h │ │ ├── README │ │ └── window.c │ ├── mp3_sync.c │ ├── keyboard.h │ ├── helix │ │ ├── lib.c │ │ └── Makefile │ ├── disarm.h │ ├── mp3_minimp3.c │ └── mp3_drmp3.c ├── libretro │ ├── link.T │ ├── ps2 │ │ └── asm.h │ ├── 3ds │ │ ├── 3ds_utils.h │ │ ├── utils.S │ │ └── 3ds_utils.c │ ├── msvc │ │ ├── msvc-2010 │ │ │ └── libretro.def │ │ ├── msvc-2010.sln │ │ └── msvc-2003-xbox1.bat │ └── libretro-common │ │ ├── include │ │ ├── retro_assert.h │ │ ├── compat │ │ │ ├── fnmatch.h │ │ │ ├── fopen_utf8.h │ │ │ ├── strcasestr.h │ │ │ └── ifaddrs.h │ │ ├── boolean.h │ │ ├── retro_common.h │ │ ├── retro_inline.h │ │ ├── memmap.h │ │ ├── formats │ │ │ └── rpng.h │ │ ├── libretro_gskit_ps2.h │ │ └── time │ │ │ └── rtime.h │ │ ├── formats │ │ └── png │ │ │ └── rpng_internal.h │ │ ├── compat │ │ ├── compat_strl.c │ │ ├── compat_strcasestr.c │ │ └── fopen_utf8.c │ │ └── time │ │ └── rtime.c ├── linux │ ├── log_io.h │ ├── skin │ │ ├── font.png │ │ ├── selector.png │ │ ├── background.png │ │ ├── skin.txt │ │ └── readme.txt │ ├── README │ ├── pprof.h │ └── menu.c ├── gp2x │ ├── PicoDrive.png │ ├── skin │ │ ├── font.png │ │ ├── selector.png │ │ ├── background.png │ │ ├── skin.txt │ │ └── readme.txt │ ├── warm_2.4.25.o │ ├── PicoDrive_s.png │ ├── PicoDrive_t.png │ ├── warm_2.6.24.ko │ ├── warm_2.4.26-open2x.o │ ├── code940 │ │ ├── pico940_v3.bin │ │ ├── uClibc │ │ │ ├── wrappers.c │ │ │ ├── math.h │ │ │ ├── README │ │ │ ├── s_fabs.c │ │ │ ├── s_copysign.c │ │ │ ├── memset.s │ │ │ ├── s_floor.c │ │ │ ├── s_scalbn.c │ │ │ └── s_sin.c │ │ └── 940shared.h │ ├── PicoDrive.ini │ ├── PicoDrive.gpe │ ├── 940ctl.h │ ├── test.c │ ├── plat.h │ ├── Makefile │ └── menu.c ├── psp │ ├── data │ │ ├── bg32.bin │ │ ├── bg40.bin │ │ └── icon.png │ ├── skin │ │ ├── font.png │ │ ├── background.png │ │ ├── selector.png │ │ ├── skin.txt │ │ └── readme.txt │ ├── in_psp.h │ ├── asm_utils.h │ ├── mp3.h │ ├── emu.h │ ├── menu.h │ ├── Makefile │ ├── menu.c │ └── psp.h ├── win32 │ ├── readme.txt │ ├── main.h │ ├── in_vk.h │ └── Makefile ├── gizmondo │ ├── asm_utils.h │ ├── emu.h │ ├── menu.h │ ├── main.c │ └── giz.h ├── pandora │ ├── PicoDrive.png │ ├── PicoDrive_p.png │ ├── skin │ │ ├── font.png │ │ ├── selector.png │ │ ├── background.png │ │ ├── skin.txt │ │ └── readme.txt │ ├── asm_utils.h │ ├── PicoDrive.sh │ ├── plat.h │ ├── make_pxml.sh │ ├── Makefile │ └── PicoDrive.pxml.template ├── opendingux │ └── data │ │ ├── PicoDrive.dge │ │ ├── megadrive.png │ │ ├── skin │ │ ├── font.png │ │ ├── selector.png │ │ ├── background.png │ │ ├── skin.txt │ │ └── readme.txt │ │ ├── default.gcw0.desktop │ │ ├── default.rg99.desktop │ │ ├── default.lepus.desktop │ │ └── default.retrofw.desktop ├── ps2 │ ├── in_ps2.h │ ├── menu.h │ ├── Makefile │ └── menu.c └── miyoo │ └── pkg.cfg ├── cpu ├── cyclone_config_armv4.h ├── cz80 │ ├── cz80.c │ ├── cz80.h │ ├── cz80_op.c │ ├── cz80jmp.c │ ├── readme.txt │ ├── cz80_opCB.c │ ├── cz80_opED.c │ ├── cz80_opXY.c │ ├── cz80_opXYCB.c │ └── cz80macro.h ├── fame │ └── famec.c ├── sh2 │ └── mame │ │ └── sh2dasm.h ├── debug_net.h ├── musashi │ └── Makefile ├── debug.h ├── cyclone_config.h └── drc │ ├── cmn.h │ └── cmn.c ├── pico ├── cd │ ├── cdd.c │ ├── cd_parse.h │ ├── genplus_macros.h │ ├── cell_map.c │ ├── megasd.h │ ├── gfx_dma.c │ ├── misc.c │ └── misc_arm.s ├── sound │ ├── vgm.h │ ├── sn76496.h │ ├── ym2413.h │ ├── mix.h │ └── resampler.h ├── carthw │ ├── svp │ │ └── compiler.h │ ├── carthw.h │ └── eeprom_spi.h ├── pico_types.h ├── patch.h ├── debug.h ├── misc.c ├── pico │ └── pico.c ├── arm_features.h ├── state.h ├── misc_amips.s └── misc_arm.s ├── zlib ├── ChangeLog ├── inffast.h ├── uncompr.c └── inftrees.h ├── tools ├── bin_to_cso_mp3 │ ├── bin_to_cso_mp3.exe │ └── readme.txt ├── Makefile ├── mkbgxx.c ├── make_carthw_c.c ├── compdecomp.c ├── offsets │ ├── generic-llp64-offsets.h │ ├── generic-ilp32-offsets.h │ └── generic-lp64-offsets.h ├── mkt1.c ├── mkoffsets.c ├── gcda.c └── bselect.c ├── .github └── workflows │ └── prepare.yml ├── .gitignore ├── .gitmodules ├── COPYING └── AUTHORS /jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_ABI := all 2 | -------------------------------------------------------------------------------- /platform/common/version.h: -------------------------------------------------------------------------------- 1 | #define VERSION "2.05" REVISION 2 | -------------------------------------------------------------------------------- /cpu/cyclone_config_armv4.h: -------------------------------------------------------------------------------- 1 | #define HAVE_ARMv6 0 2 | #include "cyclone_config.h" 3 | -------------------------------------------------------------------------------- /pico/cd/cdd.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/pico/cd/cdd.c -------------------------------------------------------------------------------- /platform/libretro/link.T: -------------------------------------------------------------------------------- 1 | { 2 | global: retro_*; 3 | local: *; 4 | }; 5 | 6 | -------------------------------------------------------------------------------- /zlib/ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/zlib/ChangeLog -------------------------------------------------------------------------------- /cpu/cz80/cz80.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/cpu/cz80/cz80.c -------------------------------------------------------------------------------- /cpu/cz80/cz80.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/cpu/cz80/cz80.h -------------------------------------------------------------------------------- /cpu/fame/famec.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/cpu/fame/famec.c -------------------------------------------------------------------------------- /platform/linux/log_io.h: -------------------------------------------------------------------------------- 1 | void log_io_clear(void); 2 | void log_io_dump(void); 3 | 4 | -------------------------------------------------------------------------------- /cpu/cz80/cz80_op.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/cpu/cz80/cz80_op.c -------------------------------------------------------------------------------- /cpu/cz80/cz80jmp.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/cpu/cz80/cz80jmp.c -------------------------------------------------------------------------------- /cpu/cz80/readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/cpu/cz80/readme.txt -------------------------------------------------------------------------------- /cpu/cz80/cz80_opCB.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/cpu/cz80/cz80_opCB.c -------------------------------------------------------------------------------- /cpu/cz80/cz80_opED.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/cpu/cz80/cz80_opED.c -------------------------------------------------------------------------------- /cpu/cz80/cz80_opXY.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/cpu/cz80/cz80_opXY.c -------------------------------------------------------------------------------- /cpu/cz80/cz80_opXYCB.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/cpu/cz80/cz80_opXYCB.c -------------------------------------------------------------------------------- /cpu/cz80/cz80macro.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/cpu/cz80/cz80macro.h -------------------------------------------------------------------------------- /cpu/sh2/mame/sh2dasm.h: -------------------------------------------------------------------------------- 1 | unsigned DasmSH2(char *buffer, unsigned pc, unsigned short opcode); 2 | -------------------------------------------------------------------------------- /platform/gp2x/PicoDrive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/platform/gp2x/PicoDrive.png -------------------------------------------------------------------------------- /platform/gp2x/skin/font.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/platform/gp2x/skin/font.png -------------------------------------------------------------------------------- /platform/gp2x/warm_2.4.25.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/platform/gp2x/warm_2.4.25.o -------------------------------------------------------------------------------- /platform/psp/data/bg32.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/platform/psp/data/bg32.bin -------------------------------------------------------------------------------- /platform/psp/data/bg40.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/platform/psp/data/bg40.bin -------------------------------------------------------------------------------- /platform/psp/data/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/platform/psp/data/icon.png -------------------------------------------------------------------------------- /platform/psp/skin/font.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/platform/psp/skin/font.png -------------------------------------------------------------------------------- /platform/win32/readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/platform/win32/readme.txt -------------------------------------------------------------------------------- /platform/gp2x/PicoDrive_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/platform/gp2x/PicoDrive_s.png -------------------------------------------------------------------------------- /platform/gp2x/PicoDrive_t.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/platform/gp2x/PicoDrive_t.png -------------------------------------------------------------------------------- /platform/gp2x/warm_2.6.24.ko: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/platform/gp2x/warm_2.6.24.ko -------------------------------------------------------------------------------- /platform/linux/skin/font.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/platform/linux/skin/font.png -------------------------------------------------------------------------------- /platform/gizmondo/asm_utils.h: -------------------------------------------------------------------------------- 1 | 2 | void vidCpy8to16(void *dest, void *src, short *pal, int lines_and_flags); 3 | 4 | -------------------------------------------------------------------------------- /platform/gp2x/skin/selector.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/platform/gp2x/skin/selector.png -------------------------------------------------------------------------------- /platform/linux/skin/selector.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/platform/linux/skin/selector.png -------------------------------------------------------------------------------- /platform/pandora/PicoDrive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/platform/pandora/PicoDrive.png -------------------------------------------------------------------------------- /platform/pandora/PicoDrive_p.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/platform/pandora/PicoDrive_p.png -------------------------------------------------------------------------------- /platform/pandora/skin/font.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/platform/pandora/skin/font.png -------------------------------------------------------------------------------- /platform/psp/in_psp.h: -------------------------------------------------------------------------------- 1 | 2 | struct in_default_bind; 3 | 4 | void in_psp_init(struct in_default_bind *defbinds); 5 | -------------------------------------------------------------------------------- /platform/psp/skin/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/platform/psp/skin/background.png -------------------------------------------------------------------------------- /platform/psp/skin/selector.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/platform/psp/skin/selector.png -------------------------------------------------------------------------------- /platform/gp2x/skin/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/platform/gp2x/skin/background.png -------------------------------------------------------------------------------- /platform/gp2x/warm_2.4.26-open2x.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/platform/gp2x/warm_2.4.26-open2x.o -------------------------------------------------------------------------------- /platform/linux/skin/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/platform/linux/skin/background.png -------------------------------------------------------------------------------- /platform/opendingux/data/PicoDrive.dge: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | echo 0 > /proc/sys/kernel/printk 3 | ./picodrive "$@" 4 | sync 5 | -------------------------------------------------------------------------------- /platform/pandora/skin/selector.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/platform/pandora/skin/selector.png -------------------------------------------------------------------------------- /platform/gizmondo/emu.h: -------------------------------------------------------------------------------- 1 | extern unsigned char gfx_buffer[321*240*2*2]; 2 | 3 | void emu_stateCb(const char *str); 4 | 5 | -------------------------------------------------------------------------------- /platform/gp2x/code940/pico940_v3.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/platform/gp2x/code940/pico940_v3.bin -------------------------------------------------------------------------------- /platform/pandora/skin/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/platform/pandora/skin/background.png -------------------------------------------------------------------------------- /platform/opendingux/data/megadrive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/platform/opendingux/data/megadrive.png -------------------------------------------------------------------------------- /platform/opendingux/data/skin/font.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/platform/opendingux/data/skin/font.png -------------------------------------------------------------------------------- /tools/bin_to_cso_mp3/bin_to_cso_mp3.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/tools/bin_to_cso_mp3/bin_to_cso_mp3.exe -------------------------------------------------------------------------------- /platform/opendingux/data/skin/selector.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/platform/opendingux/data/skin/selector.png -------------------------------------------------------------------------------- /pico/sound/vgm.h: -------------------------------------------------------------------------------- 1 | 2 | int vgm_load(const char *fname); 3 | void vgm_frame(void); 4 | void vgm_reset(void); 5 | void vgm_finish(void); 6 | 7 | -------------------------------------------------------------------------------- /platform/opendingux/data/skin/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libretro/picodrive/HEAD/platform/opendingux/data/skin/background.png -------------------------------------------------------------------------------- /platform/ps2/in_ps2.h: -------------------------------------------------------------------------------- 1 | 2 | struct in_default_bind; 3 | 4 | void in_ps2_init(struct in_default_bind *defbinds); 5 | 6 | void in_ps2_deinit(); 7 | -------------------------------------------------------------------------------- /platform/gp2x/skin/skin.txt: -------------------------------------------------------------------------------- 1 | // html-style hex color codes, ex. ff0000 is red, 0000ff is blue, etc. 2 | text_color=ffffff 3 | selection_color=c00000 4 | 5 | -------------------------------------------------------------------------------- /platform/linux/skin/skin.txt: -------------------------------------------------------------------------------- 1 | // html-style hex color codes, ex. ff0000 is red, 0000ff is blue, etc. 2 | text_color=ffffff 3 | selection_color=c00000 4 | 5 | -------------------------------------------------------------------------------- /platform/opendingux/data/skin/skin.txt: -------------------------------------------------------------------------------- 1 | // html-style hex color codes, ex. ff0000 is red, 0000ff is blue, etc. 2 | text_color=ffffff 3 | selection_color=0000c0 4 | -------------------------------------------------------------------------------- /platform/pandora/skin/skin.txt: -------------------------------------------------------------------------------- 1 | // html-style hex color codes, ex. ff0000 is red, 0000ff is blue, etc. 2 | text_color=ffffff 3 | selection_color=c00000 4 | 5 | -------------------------------------------------------------------------------- /platform/psp/skin/skin.txt: -------------------------------------------------------------------------------- 1 | // html-style hex color codes, ex. ff0000 is red, 0000ff is blue, etc. 2 | text_color=ffffff 3 | selection_color=c00000 4 | 5 | -------------------------------------------------------------------------------- /pico/cd/cd_parse.h: -------------------------------------------------------------------------------- 1 | 2 | cd_data_t *chd_parse(const char *fname); 3 | cd_data_t *cue_parse(const char *fname); 4 | void cdparse_destroy(cd_data_t *data); 5 | 6 | -------------------------------------------------------------------------------- /platform/common/ogg.h: -------------------------------------------------------------------------------- 1 | 2 | void ogg_start_play(void *f_, int sample_offset); 3 | void ogg_stop_play(void); 4 | void ogg_update(s32 *buffer, int length, int stereo); 5 | -------------------------------------------------------------------------------- /platform/gp2x/PicoDrive.ini: -------------------------------------------------------------------------------- 1 | [info] 2 | name="PicoDrive" 3 | path="/PicoDrive/PicoDrive.gpe" 4 | icon="/PicoDrive/PicoDrive_s.png" 5 | title="/PicoDrive/PicoDrive_t.png" 6 | group="GAMES" 7 | -------------------------------------------------------------------------------- /platform/common/dismips.h: -------------------------------------------------------------------------------- 1 | #ifndef DISMIPS_H 2 | #define DISMIPS_H 3 | 4 | int dismips(uintptr_t pc, uint32_t insn, char *buf, size_t buf_len, unsigned long *sym); 5 | 6 | #endif /* DISMIPS_H */ 7 | -------------------------------------------------------------------------------- /platform/psp/asm_utils.h: -------------------------------------------------------------------------------- 1 | // pointers must be word aligned, gammaa_val = -4..16, black_lvl = {0,1,2} 2 | void do_pal_convert(unsigned short *dest, unsigned short *src, int gammaa_val, int black_lvl); 3 | -------------------------------------------------------------------------------- /platform/psp/mp3.h: -------------------------------------------------------------------------------- 1 | 2 | // additional stuff for PSP mp3 decoder implementation 3 | extern int mp3_last_error; 4 | 5 | int mp3_init(void); 6 | void mp3_deinit(void); 7 | void mp3_reopen_file(void); 8 | 9 | -------------------------------------------------------------------------------- /cpu/debug_net.h: -------------------------------------------------------------------------------- 1 | typedef struct { 2 | struct { 3 | unsigned char type; 4 | unsigned char cpuid; 5 | unsigned short len; 6 | } header; 7 | unsigned int regs[32]; 8 | } packet_t; 9 | 10 | -------------------------------------------------------------------------------- /platform/linux/README: -------------------------------------------------------------------------------- 1 | This port tries to emulate gp2x environment on a standard linux box for testing 2 | (i.e. to be able to use things like valgrind and efence, gcc runtime 3 | optimizations, etc.). 4 | 5 | -------------------------------------------------------------------------------- /platform/win32/main.h: -------------------------------------------------------------------------------- 1 | #ifdef __cplusplus 2 | extern "C" { 3 | #endif 4 | 5 | extern HWND FrameWnd; 6 | extern RECT FrameRectMy; 7 | extern RECT EmuScreenRect; 8 | 9 | #ifdef __cplusplus 10 | } 11 | #endif 12 | -------------------------------------------------------------------------------- /cpu/musashi/Makefile: -------------------------------------------------------------------------------- 1 | all : m68kops.c 2 | 3 | m68kops.c : m68kmake 4 | ./$< 5 | 6 | m68kmake : m68kmake.c m68k_in.c 7 | $(CC) -o $@ $< 8 | 9 | 10 | clean: 11 | $(RM) m68kops.c m68kops.h m68kmake *.o 12 | 13 | -------------------------------------------------------------------------------- /platform/pandora/asm_utils.h: -------------------------------------------------------------------------------- 1 | 2 | void clut_line2x2(void *dest, const void *src, const unsigned short *pal, int pixels_mask); 3 | void clut_line3x2(void *dest, const void *src, const unsigned short *pal, int pixels_mask); 4 | -------------------------------------------------------------------------------- /platform/psp/emu.h: -------------------------------------------------------------------------------- 1 | 2 | extern int engineStateSuspend; 3 | 4 | void emu_handle_resume(void); 5 | 6 | void blitscreen_clut(void); 7 | 8 | // actually comes from Pico/Misc_amips.s 9 | void memset32_uncached(int *dest, int c, int count); 10 | 11 | -------------------------------------------------------------------------------- /platform/opendingux/data/default.gcw0.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Application 3 | Name=Picodrive 4 | Comment=A mega drive/genesis emulator 5 | Exec=picodrive %f 6 | Icon=megadrive 7 | Terminal=false 8 | Categories=emulators; 9 | MimeType=.md;.smd;.gen;.bin;.sms;.gg;.sg;.cue;.chd;.cso;.iso;.32x;.pco;.zip 10 | -------------------------------------------------------------------------------- /platform/opendingux/data/default.rg99.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Application 3 | Name=Picodrive 4 | Comment=A mega drive/genesis emulator 5 | Exec=picodrive %f 6 | Icon=megadrive 7 | Terminal=false 8 | Categories=emulators; 9 | MimeType=.md;.smd;.gen;.bin;.sms;.gg;.sg;.cue;.chd;.cso;.iso;.32x;.pco;.zip 10 | -------------------------------------------------------------------------------- /platform/opendingux/data/default.lepus.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Type=Application 3 | Name=Picodrive 4 | Comment=A mega drive/genesis emulator 5 | Exec=picodrive %f 6 | Icon=megadrive 7 | Terminal=false 8 | Categories=emulators; 9 | MimeType=.md;.smd;.gen;.bin;.sms;.gg;.sg;.cue;.chd;.cso;.iso;.32x;.pco;.zip 10 | -------------------------------------------------------------------------------- /platform/win32/in_vk.h: -------------------------------------------------------------------------------- 1 | #ifdef IN_VK 2 | 3 | void in_vk_init(void *vdrv); 4 | int in_vk_update(void *drv_data, const int *binds, int *result); 5 | 6 | void in_vk_keydown(int kc); 7 | void in_vk_keyup(int kc); 8 | 9 | extern int in_vk_add_pl12; 10 | 11 | #else 12 | 13 | #define in_vk_init(x) 14 | #define in_vk_update(a,b,c) 0 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /platform/gp2x/skin/readme.txt: -------------------------------------------------------------------------------- 1 | The skin images can be customized, but there are several limitations: 2 | 3 | background.png - must be 320x240 image with 24bit RGB colors. 4 | font.png - must be 128x160 8bit grayscale image. 5 | selector.png - must be 8x10 8bit grayscale image. 6 | 7 | Font and selector colors can be changed by editing skin.txt. 8 | 9 | -------------------------------------------------------------------------------- /platform/linux/skin/readme.txt: -------------------------------------------------------------------------------- 1 | The skin images can be customized, but there are several limitations: 2 | 3 | background.png - must be 640x480 image with 24bit RGB colors. 4 | font.png - must be 128x160 8bit grayscale image. 5 | selector.png - must be 8x10 8bit grayscale image. 6 | 7 | Font and selector colors can be changed by editing skin.txt. 8 | 9 | -------------------------------------------------------------------------------- /platform/opendingux/data/skin/readme.txt: -------------------------------------------------------------------------------- 1 | The skin images can be customized, but there are several limitations: 2 | 3 | background.png - must be 320x240 image with 24bit RGB colors. 4 | font.png - must be 128x160 8bit grayscale image. 5 | selector.png - must be 8x10 8bit grayscale image. 6 | 7 | Font and selector colors can be changed by editing skin.txt. 8 | -------------------------------------------------------------------------------- /platform/psp/skin/readme.txt: -------------------------------------------------------------------------------- 1 | The skin images can be customized, but there are several limitations: 2 | 3 | background.png - must be 320x240 image with 24bit RGB colors. 4 | font.png - must be 128x160 8bit grayscale image. 5 | selector.png - must be 8x10 8bit grayscale image. 6 | 7 | Font and selector colors can be changed by editing skin.txt. 8 | 9 | -------------------------------------------------------------------------------- /platform/pandora/skin/readme.txt: -------------------------------------------------------------------------------- 1 | The skin images can be customized, but there are several limitations: 2 | 3 | background.png - must be 320x240 image with 24bit RGB colors. 4 | font.png - must be 128x160 8bit grayscale image. 5 | selector.png - must be 8x10 8bit grayscale image. 6 | 7 | Font and selector colors can be changed by editing skin.txt. 8 | 9 | -------------------------------------------------------------------------------- /pico/sound/sn76496.h: -------------------------------------------------------------------------------- 1 | #ifndef SN76496_H 2 | #define SN76496_H 3 | 4 | extern int *sn76496_regs; 5 | 6 | void SN76496Write(int data); 7 | void SN76496Update(short *buffer,int length,int stereo); 8 | void SN76496Config(int panning); 9 | void SN76496_set_clockrate(int clock,int sample_rate); 10 | int SN76496_init(int clock,int sample_rate); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /platform/opendingux/data/default.retrofw.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=Picodrive 3 | Comment=A mega drive/genesis emulator 4 | Exec=picodrive %f 5 | Icon=megadrive 6 | Categories=emulators; 7 | X-OD-Manual= 8 | X-OD-Selector= 9 | X-OD-Filter=.md,.smd,.gen,.bin,.sms,.gg,.sg,.cue,.chd,.cso,.iso,.32x,.pco,.zip 10 | Terminal=true 11 | Type=Application 12 | StartupNotify=true 13 | -------------------------------------------------------------------------------- /platform/libretro/ps2/asm.h: -------------------------------------------------------------------------------- 1 | // By right, input and output pointers must be all quad-word aligned. Unfortunately, some stuff that Picodrive passes to these functions aren't aligned to that degree. And so, only double-word alignment is required. 2 | void do_pal_convert(unsigned short *dest, const unsigned short *src); 3 | void do_pal_convert_with_shadows(unsigned short *dest, const unsigned short *src); 4 | -------------------------------------------------------------------------------- /platform/ps2/menu.h: -------------------------------------------------------------------------------- 1 | 2 | void menu_loop(void); 3 | int menu_loop_tray(void); 4 | void menu_romload_prepare(const char *rom_name); 5 | void menu_romload_end(void); 6 | 7 | 8 | #define CONFIGURABLE_KEYS (PBTN_UP|PBTN_LEFT|PBTN_RIGHT|PBTN_DOWN|PBTN_L|PBTN_R|PBTN_TRIANGLE|PBTN_CIRCLE|PBTN_X|PBTN_SQUARE|PBTN_START| \ 9 | PBTN_NUB_UP|PBTN_NUB_RIGHT|PBTN_NUB_DOWN|PBTN_NUB_LEFT|PBTN_NOTE) 10 | 11 | -------------------------------------------------------------------------------- /platform/psp/menu.h: -------------------------------------------------------------------------------- 1 | 2 | void menu_loop(void); 3 | int menu_loop_tray(void); 4 | void menu_romload_prepare(const char *rom_name); 5 | void menu_romload_end(void); 6 | 7 | 8 | #define CONFIGURABLE_KEYS (PBTN_UP|PBTN_LEFT|PBTN_RIGHT|PBTN_DOWN|PBTN_L|PBTN_R|PBTN_TRIANGLE|PBTN_CIRCLE|PBTN_X|PBTN_SQUARE|PBTN_START| \ 9 | PBTN_NUB_UP|PBTN_NUB_RIGHT|PBTN_NUB_DOWN|PBTN_NUB_LEFT|PBTN_NOTE) 10 | 11 | -------------------------------------------------------------------------------- /pico/sound/ym2413.h: -------------------------------------------------------------------------------- 1 | /* PicoDrive's wrapper for emu2413 2 | */ 3 | 4 | #include 5 | #include "emu2413/emu2413.h" 6 | 7 | // the one instance that can be in a Mark III 8 | extern OPLL *opll; 9 | 10 | void YM2413_regWrite(unsigned data); 11 | void YM2413_dataWrite(unsigned data); 12 | 13 | size_t ym2413_pack_state(void *buf_, size_t size); 14 | void ym2413_unpack_state(const void *buf_, size_t size); 15 | -------------------------------------------------------------------------------- /platform/gp2x/code940/uClibc/wrappers.c: -------------------------------------------------------------------------------- 1 | #include "math.h" 2 | 3 | double pow(double x, double y) 4 | { 5 | return __ieee754_pow(x, y); 6 | } 7 | double __pow_finite(double x, double y) 8 | { 9 | return __ieee754_pow(x, y); 10 | } 11 | 12 | 13 | double log(double x) 14 | { 15 | return __ieee754_log(x); 16 | } 17 | double __log_finite(double x) 18 | { 19 | return __ieee754_log(x); 20 | } 21 | -------------------------------------------------------------------------------- /platform/libretro/3ds/3ds_utils.h: -------------------------------------------------------------------------------- 1 | #ifndef _3DS_UTILS_H 2 | #define _3DS_UTILS_H 3 | 4 | void ctr_flush_invalidate_cache(void); 5 | 6 | int ctr_svchack_init(void); 7 | void check_rosalina(void); 8 | 9 | #include 10 | #define DEBUG_HOLD() do{printf("%s@%s:%d.\n",__FUNCTION__, __FILE__, __LINE__);fflush(stdout);wait_for_input();}while(0) 11 | 12 | void wait_for_input(void); 13 | 14 | #endif // _3DS_UTILS_H 15 | -------------------------------------------------------------------------------- /platform/common/config_file.h: -------------------------------------------------------------------------------- 1 | 2 | #ifdef __cplusplus 3 | extern "C" { 4 | #endif 5 | 6 | int config_write(const char *fname); 7 | int config_writelrom(const char *fname); 8 | int config_readsect(const char *fname, const char *section); 9 | int config_readlrom(const char *fname); 10 | int config_get_var_val(void *file, char *line, int lsize, char **rvar, char **rval); 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | -------------------------------------------------------------------------------- /platform/common/mp3_dummy.c: -------------------------------------------------------------------------------- 1 | /* 2 | * dummy/none mp3 code 3 | * (C) notaz, 2013 4 | * 5 | * This work is licensed under the terms of MAME license. 6 | * See COPYING file in the top-level directory. 7 | */ 8 | 9 | #include 10 | #include "mp3.h" 11 | 12 | int mp3dec_start(FILE *f, int fpos_start) 13 | { 14 | return -1; 15 | } 16 | 17 | int mp3dec_decode(FILE *f, int *file_pos, int file_len) 18 | { 19 | return -1; 20 | } 21 | -------------------------------------------------------------------------------- /platform/common/plat_sdl.h: -------------------------------------------------------------------------------- 1 | 2 | extern const struct in_default_bind *in_sdl_defbinds; 3 | extern const struct menu_keymap *in_sdl_key_map; 4 | extern const int in_sdl_key_map_sz; 5 | extern const struct menu_keymap *in_sdl_joy_map; 6 | extern const int in_sdl_joy_map_sz; 7 | extern const char * const *in_sdl_key_names; 8 | extern const char *plat_device; 9 | extern const struct in_default_bind in_sdl_kbd_map[]; 10 | 11 | void linux_menu_init(void); 12 | -------------------------------------------------------------------------------- /platform/pandora/PicoDrive.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 3.2.30 on pandora has broken hugetlb 4 | if [ "`uname -r`" != "3.2.30" ]; then 5 | # 2x2M hugepages should be enough 6 | sudo -n /usr/pandora/scripts/op_hugetlb.sh 4 7 | fi 8 | 9 | ./picodrive "$@" 10 | 11 | # restore stuff if pico crashes 12 | ./picorestore 13 | sudo -n /usr/pandora/scripts/op_lcdrate.sh 60 14 | sudo -n /usr/pandora/scripts/op_gamma.sh 0 15 | sudo -n /usr/pandora/scripts/op_hugetlb.sh 0 16 | -------------------------------------------------------------------------------- /zlib/inffast.h: -------------------------------------------------------------------------------- 1 | /* inffast.h -- header to use inffast.c 2 | * Copyright (C) 1995-2003 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 inflate_fast OF((z_streamp strm, unsigned start)); 12 | -------------------------------------------------------------------------------- /tools/Makefile: -------------------------------------------------------------------------------- 1 | TARGETS = amalgamate textfilter make_carthw_c 2 | HOSTCC ?= cc 3 | 4 | all: 5 | if [ -f "offsets/$(XPLATFORM)-offsets.h" ]; then \ 6 | ln -sf "../tools/offsets/$(XPLATFORM)-offsets.h" ../pico/pico_int_offs.h; \ 7 | else \ 8 | CC="$(XCC)" CFLAGS="$(XCFLAGS)" sh ./mkoffsets.sh ../pico; \ 9 | fi 10 | 11 | $(TARGETS): $(addsuffix .c,$(TARGETS)) 12 | $(HOSTCC) -o $@ -O $@.c 13 | 14 | clean: 15 | $(RM) $(TARGETS) $(OBJS) 16 | 17 | .PHONY: clean all 18 | -------------------------------------------------------------------------------- /platform/pandora/plat.h: -------------------------------------------------------------------------------- 1 | 2 | extern int g_layer_cx, g_layer_cy; 3 | extern int g_layer_cw, g_layer_ch; 4 | extern int saved_start_line, saved_line_count; 5 | extern int saved_start_col, saved_col_count; 6 | 7 | void pnd_menu_init(void); 8 | int pnd_setup_layer(int enabled, int x, int y, int w, int h); 9 | void pnd_restore_layer_data(void); 10 | 11 | enum { 12 | SCALE_1x1, 13 | SCALE_2x2_3x2, 14 | SCALE_2x2_2x2, 15 | SCALE_FULLSCREEN, 16 | SCALE_CUSTOM, 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /platform/common/arm_utils.h: -------------------------------------------------------------------------------- 1 | 2 | void bgr444_to_rgb32(void *to, void *from, unsigned entries); 3 | void bgr444_to_rgb32_sh(void *to, void *from); 4 | 5 | void vidcpy_8bit(void *dest, void *src, int x_y, int w_h); 6 | void vidcpy_8bit_rot(void *dest, void *src, int x_y, int w_h); 7 | 8 | void spend_cycles(int c); // utility 9 | 10 | void rotated_blit8 (void *dst, void *linesx4, int y, int is_32col); 11 | void rotated_blit16(void *dst, void *linesx4, int y, int is_32col); 12 | -------------------------------------------------------------------------------- /platform/gp2x/PicoDrive.gpe: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export LD_PRELOAD= 4 | 5 | if ! [ -e /dev/accel ]; then 6 | # Wiz 7 | export POLLUX_RAM_TIMINGS='ram_timings=2,9,4,1,1,1,1' 8 | export POLLUX_LCD_TIMINGS_NTSC='lcd_timings=397,1,37,277,341,0,17,337;clkdiv0=9' 9 | export POLLUX_LCD_TIMINGS_PAL='lcd_timings=428,1,37,277,341,0,17,337;clkdiv0=10' 10 | else 11 | export POLLUX_RAM_TIMINGS='ram_timings=3,9,4,1,1,1,1' 12 | fi 13 | 14 | ./PicoDrive "$@" 15 | 16 | cd /usr/gp2x 17 | exec ./gp2xmenu 18 | -------------------------------------------------------------------------------- /platform/common/mp3.h: -------------------------------------------------------------------------------- 1 | #ifndef __COMMON_MP3_H__ 2 | #define __COMMON_MP3_H__ 3 | 4 | #include 5 | 6 | int mp3_find_sync_word(const unsigned char *buf, int size); 7 | 8 | /* decoder */ 9 | int mp3dec_start(FILE *f, int fpos_start); 10 | int mp3dec_decode(FILE *f, int *file_pos, int file_len); 11 | 12 | extern unsigned short mpeg1_l3_bitrates[16]; 13 | 14 | #ifdef __GP2X__ 15 | int _mp3dec_start(FILE *f, int fpos_start); 16 | int _mp3dec_decode(FILE *f, int *file_pos, int file_len); 17 | #endif 18 | 19 | #endif // __COMMON_MP3_H__ 20 | -------------------------------------------------------------------------------- /platform/gp2x/940ctl.h: -------------------------------------------------------------------------------- 1 | void sharedmem940_init(void); 2 | void sharedmem940_finish(void); 3 | 4 | void YM2612Init_940(int baseclock, int rate, int ssg); 5 | void YM2612ResetChip_940(void); 6 | int YM2612UpdateOne_940(int *buffer, int length, int stereo, int is_buf_empty); 7 | 8 | int YM2612Write_940(unsigned int a, unsigned int v, int scanline); 9 | 10 | int YM2612PicoTick_940(int n); 11 | void YM2612PicoStateLoad_940(void); 12 | void YM2612PicoStateSave2_940(int tat, int tbt); 13 | int YM2612PicoStateLoad2_940(int *tat, int *tbt); 14 | -------------------------------------------------------------------------------- /.github/workflows/prepare.yml: -------------------------------------------------------------------------------- 1 | name: prepare 2 | on: workflow_call 3 | 4 | jobs: 5 | prepare: 6 | runs-on: ubuntu-latest 7 | steps: 8 | - uses: actions/checkout@v3 9 | with: 10 | submodules: true 11 | - name: create release 12 | id: create_release 13 | if: ${{ github.ref_type == 'tag' }} 14 | env: 15 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} 16 | run: | 17 | tag=$(echo ${{ github.ref }} | sed 's:refs/tags/::') 18 | gh release create "$tag" --verify-tag -d -t "$tag" -n "$tag" 19 | 20 | -------------------------------------------------------------------------------- /platform/gizmondo/menu.h: -------------------------------------------------------------------------------- 1 | /* 2 | * PicoDrive 3 | * (C) notaz, 2006-2008 4 | * 5 | * This work is licensed under the terms of MAME license. 6 | * See COPYING file in the top-level directory. 7 | */ 8 | 9 | void menu_loop(void); 10 | int menu_loop_tray(void); 11 | void menu_romload_prepare(const char *rom_name); 12 | void menu_romload_end(void); 13 | 14 | 15 | #define CONFIGURABLE_KEYS \ 16 | (PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT|PBTN_STOP|PBTN_PLAY|PBTN_FWD|PBTN_REW| \ 17 | PBTN_L|PBTN_R|PBTN_VOLUME|PBTN_BRIGHTNESS|PBTN_ALARM) 18 | 19 | -------------------------------------------------------------------------------- /platform/common/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 -------------------------------------------------------------------------------- /pico/carthw/svp/compiler.h: -------------------------------------------------------------------------------- 1 | int ssp_drc_entry(ssp1601_t *ssp, int cycles); 2 | void ssp_drc_next(void); 3 | void ssp_drc_next_patch(void); 4 | void ssp_drc_end(void); 5 | 6 | void ssp_hle_800(void); 7 | void ssp_hle_902(void); 8 | void ssp_hle_07_6d6(void); 9 | void ssp_hle_07_030(void); 10 | void ssp_hle_07_036(void); 11 | void ssp_hle_11_12c(void); 12 | void ssp_hle_11_384(void); 13 | void ssp_hle_11_38a(void); 14 | 15 | int ssp1601_dyn_startup(void); 16 | void ssp1601_dyn_exit(void); 17 | void ssp1601_dyn_reset(ssp1601_t *ssp); 18 | void ssp1601_dyn_run(int cycles); 19 | 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.swp 3 | *.dll 4 | *.lib 5 | *.pdb 6 | *.manifest 7 | *.map 8 | *.exp 9 | *.dylib 10 | *.so 11 | *.a 12 | tags 13 | cscope.out 14 | compile_commands.json 15 | .gdb_history 16 | config.mak 17 | config.log 18 | cpu/musashi/m68kmake 19 | cpu/musashi/m68kops.c 20 | cpu/musashi/m68kops.h 21 | skin 22 | config.cfg 23 | srm/ 24 | brm/ 25 | mds/ 26 | cfg/ 27 | libs/ 28 | obj/ 29 | .opk_data 30 | .od_data 31 | PicoDrive 32 | picodrive 33 | picodrive_libretro* 34 | PicoDrive*.opk 35 | PicoDrive*.ipk 36 | PicoDrive*.zip 37 | pico_int_offs.h 38 | amalgamate 39 | textfilter 40 | -------------------------------------------------------------------------------- /platform/gp2x/code940/uClibc/math.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int __kernel_rem_pio2(double *x, double *y, int e0, int nx, int prec, const int32_t *ipio2); 4 | double __kernel_sin(double x, double y, int iy); 5 | double __kernel_cos(double x, double y); 6 | 7 | double __ieee754_pow(double x, double y); 8 | double __ieee754_sqrt(double x); 9 | double __ieee754_log(double x); 10 | int32_t __ieee754_rem_pio2(double x, double *y); 11 | 12 | double fabs(double x); 13 | double scalbn(double x, int n); 14 | double copysign(double x, double y); 15 | double floor(double x); 16 | -------------------------------------------------------------------------------- /pico/pico_types.h: -------------------------------------------------------------------------------- 1 | #ifndef PICO_TYPES 2 | #define PICO_TYPES 3 | 4 | #include 5 | 6 | #ifndef __TAMTYPES_H__ 7 | #ifndef UTYPES_DEFINED 8 | typedef uint8_t u8; 9 | typedef int8_t s8; 10 | typedef uint16_t u16; 11 | typedef int16_t s16; 12 | typedef uint32_t u32; 13 | typedef int32_t s32; 14 | typedef uint64_t u64; 15 | typedef int64_t s64; 16 | #endif 17 | #endif 18 | 19 | typedef uintptr_t uptr; /* unsigned pointer-sized int */ 20 | 21 | typedef unsigned int uint; /* printf casts */ 22 | typedef unsigned long ulong; 23 | #endif 24 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "platform/libpicofe"] 2 | path = platform/libpicofe 3 | url = https://github.com/irixxxx/libpicofe.git 4 | [submodule "cpu/cyclone"] 5 | path = cpu/cyclone 6 | url = https://github.com/irixxxx/cyclone68000.git 7 | [submodule "pico/sound/emu2413"] 8 | path = pico/sound/emu2413 9 | url = https://github.com/digital-sound-antiques/emu2413.git 10 | branch = main 11 | [submodule "pico/cd/libchdr"] 12 | path = pico/cd/libchdr 13 | url = https://github.com/irixxxx/libchdr.git 14 | [submodule "platform/common/dr_libs"] 15 | path = platform/common/dr_libs 16 | url = https://github.com/mackron/dr_libs.git 17 | -------------------------------------------------------------------------------- /platform/pandora/make_pxml.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | verfile=../common/version.h 5 | test -f $verfile 6 | 7 | major=`head -n 1 $verfile | sed 's/[^0-9]*\([0-9]*\)\.\([0-9]*\).*/\1/g'` 8 | minor=`head -n 1 $verfile | sed 's/[^0-9]*\([0-9]*\)\.\([0-9]*\).*/\2/g'` 9 | # lame, I know.. 10 | build=`git describe --tags HEAD | grep -- - | sed -e 's/.*\-\(.*\)\-.*/\1/'` 11 | test -n "$build" && build_post="-$build" 12 | test -n "$build" || build=0 13 | 14 | trap "rm -f $2" ERR 15 | 16 | sed -e 's/@major@/'$major'/' \ 17 | -e 's/@minor@/'$minor'/' \ 18 | -e 's/@build@/'$build'/' \ 19 | -e 's/@build_post@/'$build_post'/' \ 20 | "$1" > "$2" 21 | -------------------------------------------------------------------------------- /pico/cd/genplus_macros.h: -------------------------------------------------------------------------------- 1 | #undef uint8 2 | #undef uint16 3 | #undef uint32 4 | #undef int8 5 | #undef int16 6 | #undef int32 7 | 8 | #define uint8 u8 9 | #define uint16 u16 10 | #define uint32 u32 11 | #define int8 s8 12 | #define int16 s16 13 | #define int32 s32 14 | 15 | #define READ_BYTE(BASE, ADDR) (BASE)[MEM_BE2(ADDR)] 16 | #define WRITE_BYTE(BASE, ADDR, VAL) (BASE)[MEM_BE2(ADDR)] = (VAL) 17 | 18 | #define load_param(param, size) \ 19 | memcpy(param, &state[bufferptr], size); \ 20 | bufferptr += size; 21 | 22 | #define save_param(param, size) \ 23 | memcpy(&state[bufferptr], param, size); \ 24 | bufferptr += size; 25 | -------------------------------------------------------------------------------- /cpu/debug.h: -------------------------------------------------------------------------------- 1 | 2 | #ifdef PDB 3 | 4 | enum { 5 | PDBCT_SH2, 6 | }; 7 | 8 | void pdb_register_cpu(void *context, int type, const char *name); 9 | void pdb_cleanup(void); 10 | void pdb_step(void *context, unsigned int pc); 11 | void pdb_command(const char *cmd); 12 | 13 | #else 14 | 15 | #define pdb_register_cpu(a,b,c) 16 | #define pdb_cleanup() 17 | #define pdb_step(a,b) 18 | #define pdb_command(a) 19 | 20 | #endif 21 | 22 | 23 | #if defined(PDB) && defined(PDB_NET) 24 | 25 | int pdb_net_connect(const char *host, const char *port); 26 | 27 | #else 28 | 29 | static __inline int pdb_net_connect(const char *host, const char *port) {return 0;} 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /platform/gp2x/code940/uClibc/README: -------------------------------------------------------------------------------- 1 | The routines included in this math library are derived from the 2 | math library for Apple's MacOS X/Darwin math library, which was 3 | itself swiped from FreeBSD. The original copyright information 4 | is as follows: 5 | 6 | Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. 7 | 8 | Developed at SunPro, a Sun Microsystems, Inc. business. 9 | Permission to use, copy, modify, and distribute this 10 | software is freely granted, provided that this notice 11 | is preserved. 12 | 13 | It has been ported to work with uClibc and generally behave 14 | by Erik Andersen 15 | 22 May, 2001 16 | 17 | -------------------------------------------------------------------------------- /pico/patch.h: -------------------------------------------------------------------------------- 1 | #ifndef _GENIE_DECODE_H__ 2 | #define _GENIE_DECODE_H__ 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | struct patch_inst 9 | { 10 | char code[12]; 11 | char name[52]; 12 | unsigned int active; 13 | unsigned int addr; 14 | unsigned short data; 15 | unsigned short data_old; 16 | unsigned char comp; 17 | }; 18 | 19 | extern struct patch_inst *PicoPatches; 20 | extern int PicoPatchCount; 21 | 22 | int PicoPatchLoad(const char *fname); 23 | void PicoPatchUnload(void); 24 | void PicoPatchPrepare(void); 25 | void PicoPatchApply(void); 26 | 27 | 28 | #ifdef __cplusplus 29 | } // extern "C" 30 | #endif 31 | 32 | #endif // _GENIE_DECODE_H__ 33 | -------------------------------------------------------------------------------- /pico/sound/mix.h: -------------------------------------------------------------------------------- 1 | 2 | //void mix_32_to_32(int *dest, int *src, int count); 3 | void mix_16h_to_32(s32 *dest, s16 *src, int count); 4 | void mix_16h_to_32_s1(s32 *dest, s16 *src, int count); 5 | void mix_16h_to_32_s2(s32 *dest, s16 *src, int count); 6 | 7 | void mix_16h_to_32_resample_stereo(s32 *dest, s16 *src, int count, int fac16); 8 | void mix_16h_to_32_resample_mono(s32 *dest, s16 *src, int count, int fac16); 9 | void mix_32_to_16_stereo(s16 *dest, s32 *src, int count); 10 | void mix_32_to_16_mono(s16 *dest, s32 *src, int count); 11 | 12 | extern int mix_32_to_16_level; 13 | void mix_32_to_16_stereo_lvl(s16 *dest, s32 *src, int count); 14 | void mix_reset(int alpha_q16); 15 | -------------------------------------------------------------------------------- /platform/libretro/msvc/msvc-2010/libretro.def: -------------------------------------------------------------------------------- 1 | LIBRARY "msvc-2010" 2 | EXPORTS 3 | retro_set_environment 4 | retro_set_video_refresh 5 | retro_set_audio_sample 6 | retro_set_audio_sample_batch 7 | retro_set_input_poll 8 | retro_set_input_state 9 | retro_init 10 | retro_deinit 11 | retro_api_version 12 | retro_get_system_info 13 | retro_get_system_av_info 14 | retro_set_controller_port_device 15 | retro_reset 16 | retro_run 17 | retro_serialize_size 18 | retro_serialize 19 | retro_unserialize 20 | retro_cheat_reset 21 | retro_cheat_set 22 | retro_load_game 23 | retro_load_game_special 24 | retro_unload_game 25 | retro_get_region 26 | retro_get_memory_data 27 | retro_get_memory_size 28 | -------------------------------------------------------------------------------- /platform/common/tremor/ogg/config_types.h: -------------------------------------------------------------------------------- 1 | #ifndef __CONFIG_TYPES_H__ 2 | #define __CONFIG_TYPES_H__ 3 | 4 | /* these are filled in by configure or cmake*/ 5 | #define INCLUDE_INTTYPES_H 1 6 | #define INCLUDE_STDINT_H 1 7 | #define INCLUDE_SYS_TYPES_H 1 8 | 9 | #if INCLUDE_INTTYPES_H 10 | # include 11 | #endif 12 | #if INCLUDE_STDINT_H 13 | # include 14 | #endif 15 | #if INCLUDE_SYS_TYPES_H 16 | # include 17 | #endif 18 | 19 | typedef int16_t ogg_int16_t; 20 | typedef uint16_t ogg_uint16_t; 21 | typedef int32_t ogg_int32_t; 22 | typedef uint32_t ogg_uint32_t; 23 | typedef int64_t ogg_int64_t; 24 | typedef uint64_t ogg_uint64_t; 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /platform/common/mp3_sync.c: -------------------------------------------------------------------------------- 1 | 2 | int mp3_find_sync_word(const unsigned char *buf, int size) 3 | { 4 | const unsigned char *p, *pe; 5 | 6 | /* find byte-aligned syncword - need 12 (MPEG 1,2) or 11 (MPEG 2.5) matching bits */ 7 | for (p = buf, pe = buf + size - 3; p <= pe; p++) 8 | { 9 | int pn; 10 | if (p[0] != 0xff) 11 | continue; 12 | pn = p[1]; 13 | if ((pn & 0xf8) != 0xf8 || // currently must be MPEG1 14 | (pn & 6) == 0) { // invalid layer 15 | p++; continue; 16 | } 17 | pn = p[2]; 18 | if ((pn & 0xf0) < 0x20 || (pn & 0xf0) == 0xf0 || // bitrates 19 | (pn & 0x0c) != 0) { // not 44kHz 20 | continue; 21 | } 22 | 23 | return p - buf; 24 | } 25 | 26 | return -1; 27 | } 28 | -------------------------------------------------------------------------------- /platform/gp2x/test.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include "gp2x.h" 6 | 7 | void spend_cycles(int c); 8 | 9 | int main(void) 10 | { 11 | struct timeval tval; // timing 12 | int thissec = 0, frames_done = 0; 13 | 14 | gp2x_init(); 15 | 16 | for (;;) 17 | { 18 | gettimeofday(&tval, 0); 19 | 20 | if(thissec != tval.tv_sec) 21 | { 22 | thissec = tval.tv_sec; 23 | 24 | printf("frames_done: %i\n", frames_done); 25 | frames_done = 0; 26 | } 27 | 28 | 29 | //gp2x_video_wait_vsync(); 30 | //usleep(1); // sleeps a minimum of ~20ms 31 | //gp2x_video_flip(); // can be called ~430000 times/sec 32 | spend_cycles(1000); 33 | frames_done++; 34 | } 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /platform/common/keyboard.h: -------------------------------------------------------------------------------- 1 | // keyboard support for Pico/SC-3000 2 | 3 | // keyboard description 4 | struct key { 5 | int xpos; 6 | char *lower, *upper; 7 | int key; 8 | }; 9 | 10 | extern struct key *kbd_pico[]; 11 | extern struct key *kbd_sc3000[]; 12 | 13 | #define VKBD_METAS 4 14 | struct vkbd { 15 | struct key **kbd; 16 | int meta[VKBD_METAS][2]; // meta keys (shift, ctrl, etc) 17 | 18 | int top; // top or bottom? 19 | int shift; // shifted or normal view? 20 | 21 | int x,y; // current key 22 | int meta_state; 23 | int prev_input; 24 | }; 25 | 26 | extern struct vkbd vkbd_pico; 27 | extern struct vkbd vkbd_sc3000; 28 | 29 | int vkbd_find_xpos(struct key *keys, int xpos); 30 | void vkbd_draw(struct vkbd *vkbd); 31 | int vkbd_update(struct vkbd *vkbd, int input, int *actions); 32 | struct vkbd *vkbd_init(int is_pico); 33 | -------------------------------------------------------------------------------- /platform/libretro/3ds/utils.S: -------------------------------------------------------------------------------- 1 | .text 2 | .arm 3 | .balign 4 4 | 5 | .func ctr_clear_cache_kernel 6 | ctr_clear_cache_kernel: 7 | cpsid aif 8 | mov r0, #0 9 | mcr p15, 0, r0, c7, c10, 0 @ Clean entire data cache 10 | mcr p15, 0, r0, c7, c10, 5 @ Data Memory Barrier 11 | mcr p15, 0, r0, c7, c5, 0 @ Invalidate entire instruction cache / Flush BTB 12 | mcr p15, 0, r0, c7, c10, 4 @ Data Sync Barrier 13 | bx lr 14 | .endfunc 15 | 16 | @@ Clear the entire data cache / invalidate the instruction cache. Uses 17 | @@ Rosalina svcCustomBackdoor to avoid svcBackdoor stack corruption 18 | @@ during interrupts. 19 | .global ctr_clear_cache 20 | .func ctr_clear_cache 21 | ctr_clear_cache: 22 | ldr r0, =ctr_clear_cache_kernel 23 | svc 0x80 @ svcCustomBackdoor 24 | bx lr 25 | .endfunc 26 | -------------------------------------------------------------------------------- /platform/gp2x/plat.h: -------------------------------------------------------------------------------- 1 | extern void *gp2x_screens[4]; 2 | extern int gp2x_current_bpp; 3 | 4 | /* SoC specific functions */ 5 | extern void (*gp2x_video_flip)(void); 6 | extern void (*gp2x_video_flip2)(void); 7 | /* negative bpp means rotated mode (for Wiz) */ 8 | extern void (*gp2x_video_changemode_ll)(int bpp, int is_pal); 9 | extern void (*gp2x_video_setpalette)(int *pal, int len); 10 | extern void (*gp2x_video_RGB_setscaling)(int ln_offs, int W, int H); 11 | extern void (*gp2x_video_wait_vsync)(void); 12 | 13 | /* ??? */ 14 | void gp2x_video_changemode(int bpp, int is_pal); 15 | void gp2x_memcpy_all_buffers(void *data, int offset, int len); 16 | void gp2x_memset_all_buffers(int offset, int byte, int len); 17 | 18 | /* vid_*.c */ 19 | void vid_mmsp2_init(void); 20 | void vid_mmsp2_finish(void); 21 | 22 | void vid_pollux_init(void); 23 | void vid_pollux_finish(void); 24 | 25 | void gp2x_menu_init(void); 26 | -------------------------------------------------------------------------------- /platform/ps2/Makefile: -------------------------------------------------------------------------------- 1 | 2 | # ----------- release ----------- 3 | ifneq ($(findstring rel,$(MAKECMDGOALS)),) 4 | ifeq ($(VER),) 5 | $(error need VER) 6 | endif 7 | endif 8 | 9 | include ../../config.mak 10 | 11 | ../../tools/textfilter: ../../tools/textfilter.c 12 | make -C ../../tools/ textfilter 13 | 14 | readme.txt: ../../tools/textfilter ../base_readme.txt ../../ChangeLog 15 | ../../tools/textfilter ../base_readme.txt $@ PS2 16 | 17 | PicoDrive: ../../picodrive 18 | $(STRIP) $^ -o $@ 19 | 20 | PicoDrive.elf: PicoDrive 21 | ps2-packer $^ $@ 22 | 23 | rel: PicoDrive.elf readme.txt ../game_def.cfg 24 | mkdir -p out/PicoDrive/skin/ out/bin_to_cso_mp3 25 | cp $^ out/PicoDrive/ 26 | cp ../../skin/* out/PicoDrive/skin/ 27 | #mkdir -p out/bin_to_cso_mp3 28 | #cp ../../tools/bin_to_cso_mp3/* out/bin_to_cso_mp3/ 29 | cd out && zip -9 -r ../../../PicoDrive_ps2_$(VER).zip * 30 | rm -rf out 31 | 32 | -------------------------------------------------------------------------------- /platform/libretro/msvc/msvc-2010.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "msvc-2010", "msvc-2010\msvc-2010.vcxproj", "{D4156C25-0E30-4407-9198-1F51EF74AA84}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {D4156C25-0E30-4407-9198-1F51EF74AA84}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {D4156C25-0E30-4407-9198-1F51EF74AA84}.Debug|Win32.Build.0 = Debug|Win32 14 | {D4156C25-0E30-4407-9198-1F51EF74AA84}.Release|Win32.ActiveCfg = Release|Win32 15 | {D4156C25-0E30-4407-9198-1F51EF74AA84}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /platform/gp2x/code940/uClibc/s_fabs.c: -------------------------------------------------------------------------------- 1 | /* @(#)s_fabs.c 5.1 93/09/24 */ 2 | /* 3 | * ==================================================== 4 | * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. 5 | * 6 | * Developed at SunPro, a Sun Microsystems, Inc. business. 7 | * Permission to use, copy, modify, and distribute this 8 | * software is freely granted, provided that this notice 9 | * is preserved. 10 | * ==================================================== 11 | */ 12 | 13 | #if defined(LIBM_SCCS) && !defined(lint) 14 | static char rcsid[] = "$NetBSD: s_fabs.c,v 1.7 1995/05/10 20:47:13 jtc Exp $"; 15 | #endif 16 | 17 | /* 18 | * fabs(x) returns the absolute value of x. 19 | */ 20 | 21 | #include "math.h" 22 | #include "math_private.h" 23 | 24 | #ifdef __STDC__ 25 | double fabs(double x) 26 | #else 27 | double fabs(x) 28 | double x; 29 | #endif 30 | { 31 | u_int32_t high; 32 | GET_HIGH_WORD(high,x); 33 | SET_HIGH_WORD(x,high&0x7fffffff); 34 | return x; 35 | } 36 | -------------------------------------------------------------------------------- /platform/ps2/menu.c: -------------------------------------------------------------------------------- 1 | 2 | static const char *men_vscaling_opts[] = { "OFF", "fullscreen", "borderless", NULL }; 3 | static const char *men_hscaling_opts[] = { "1:1", "4:3", "extended", "fullwidth", NULL }; 4 | static const char *men_filter_opts[] = { "nearest", "bilinear", NULL }; 5 | 6 | #define MENU_OPTIONS_GFX \ 7 | mee_enum ("Vertical scaling", MA_OPT_VSCALING, currentConfig.vscaling, men_vscaling_opts), \ 8 | mee_enum ("Aspect ratio", MA_OPT_SCALING, currentConfig.scaling, men_hscaling_opts), \ 9 | mee_enum ("Scaler type", MA_OPT3_FILTERING, currentConfig.filter, men_filter_opts), \ 10 | mee_onoff ("Wait for vsync", MA_OPT3_VSYNC, currentConfig.EmuOpt, EOPT_VSYNC), \ 11 | 12 | #define MENU_OPTIONS_ADV 13 | 14 | static menu_entry e_menu_sms_options[]; 15 | static menu_entry e_menu_keyconfig[]; 16 | 17 | void psp_menu_init(void) 18 | { 19 | me_enable(e_menu_sms_options, MA_SMSOPT_GHOSTING, 0); 20 | me_enable(e_menu_keyconfig, MA_CTRL_DEADZONE, 0); 21 | } 22 | -------------------------------------------------------------------------------- /platform/psp/Makefile: -------------------------------------------------------------------------------- 1 | 2 | # ----------- release ----------- 3 | ifneq ($(findstring rel,$(MAKECMDGOALS)),) 4 | ifeq ($(VER),) 5 | $(error need VER) 6 | endif 7 | endif 8 | 9 | include ../../config.mak 10 | 11 | #PSPSDK ?= $(shell psp-config --pspsdk-path) 12 | #include $(PSPSDK)/lib/build.mak 13 | 14 | #PSP_EBOOT_TITLE = PicoDrive 15 | #PSP_EBOOT_ICON = data/icon.png 16 | 17 | #EBOOT.PBP: 18 | 19 | ../../tools/textfilter: ../../tools/textfilter.c 20 | make -C ../../tools/ textfilter 21 | 22 | readme.txt: ../../tools/textfilter ../base_readme.txt ../../ChangeLog 23 | ../../tools/textfilter ../base_readme.txt $@ PSP 24 | 25 | rel: ../../EBOOT.PBP readme.txt ../game_def.cfg 26 | mkdir -p out/PicoDrive/skin/ out/bin_to_cso_mp3 27 | cp $^ out/PicoDrive/ 28 | cp ../../skin/* out/PicoDrive/skin/ 29 | #mkdir -p out/bin_to_cso_mp3 30 | #cp ../../tools/bin_to_cso_mp3/* out/bin_to_cso_mp3/ 31 | cd out && zip -9 -r ../../../PicoDrive_psp_$(VER).zip * 32 | rm -rf out 33 | -------------------------------------------------------------------------------- /pico/debug.h: -------------------------------------------------------------------------------- 1 | 2 | char *PDebugMain(void); 3 | char *PDebug32x(void); 4 | char *PDebugSpriteList(void); 5 | void PDebugShowSpriteStats(unsigned short *screen, int stride); 6 | void PDebugShowPalette(unsigned short *screen, int stride); 7 | void PDebugShowSprite(unsigned short *screen, int stride, int which); 8 | void PDebugDumpMem(void); 9 | void PDebugZ80Frame(void); 10 | void PDebugCPUStep(void); 11 | 12 | #if defined(CPU_CMP_R) || defined(CPU_CMP_W) || defined(DRC_CMP) 13 | enum ctl_byte { 14 | CTL_68K_SLAVE = 0x02, 15 | CTL_68K_PC = 0x04, 16 | CTL_68K_SR = 0x05, 17 | CTL_68K_CYCLES = 0x06, 18 | CTL_68K_R = 0x10, // .. 0x20 19 | CTL_MASTERSLAVE = 0x80, 20 | CTL_EA = 0x82, 21 | CTL_EAVAL = 0x83, 22 | CTL_M68KPC = 0x84, 23 | CTL_CYCLES = 0x85, 24 | CTL_SH2_R = 0x90, // .. 0xa8 25 | }; 26 | 27 | void tl_write(const void *ptr, size_t size); 28 | void tl_write_uint(unsigned char ctl, unsigned int v); 29 | int tl_read(void *ptr, size_t size); 30 | int tl_read_uint(void *ptr); 31 | #endif 32 | -------------------------------------------------------------------------------- /tools/mkbgxx.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | static unsigned char buff[0x10140]; 5 | static unsigned char buff2[0x10140]; 6 | 7 | static void do_file(const char *ifn, const char *ofn) 8 | { 9 | FILE *fi, *fo; 10 | int ret; 11 | unsigned long dlen = sizeof(buff2); 12 | 13 | fi = fopen(ifn, "rb"); 14 | if (!fi) return; 15 | fseek(fi, 0x10020, SEEK_SET); 16 | fread(buff, 1, 0x10000, fi); 17 | fseek(fi, 0x2000, SEEK_CUR); 18 | fread(buff + 0x10000, 1, 0x80*2, fi); 19 | fseek(fi, 0x221a0, SEEK_SET); 20 | fread(buff + 0x10100, 1, 0x40, fi); 21 | fclose(fi); 22 | 23 | ret = compress2(buff2, &dlen, buff, sizeof(buff), Z_BEST_COMPRESSION); 24 | if (ret) { printf("compress2 failed with %i\n", ret); return; } 25 | 26 | fo = fopen(ofn, "wb"); 27 | if (!fo) return; 28 | fwrite(buff2, 1, dlen, fo); 29 | fclose(fo); 30 | 31 | printf("%s: %6i -> %6li\n", ofn, sizeof(buff), dlen); 32 | } 33 | 34 | int main(int argc, char *argv[]) 35 | { 36 | if (argc != 3) return 1; 37 | 38 | do_file(argv[1], "bg40.bin"); 39 | do_file(argv[2], "bg32.bin"); 40 | 41 | return 0; 42 | } 43 | 44 | -------------------------------------------------------------------------------- /platform/pandora/Makefile: -------------------------------------------------------------------------------- 1 | # release packaging makefile 2 | 3 | VER := $(shell head -n 1 ../common/version.h | \ 4 | sed 's/[^0-9]*\([0-9]*\)\.\([0-9]*\).*/\1\2/g') 5 | BUILD := $(shell git describe HEAD | grep -- - | \ 6 | sed -e 's/.*\-\(.*\)\-.*/\1/') 7 | ifneq "$(BUILD)" "" 8 | VER := $(VER)_$(BUILD) 9 | endif 10 | 11 | include ../../config.mak 12 | 13 | PND_MAKE ?= pnd_make 14 | 15 | all: rel 16 | 17 | ../../tools/textfilter: ../../tools/textfilter.c 18 | make -C ../../tools/ textfilter 19 | 20 | #readme.txt: ../../tools/textfilter ../base_readme.txt ../../ChangeLog 21 | # ../../tools/textfilter ../base_readme.txt $@ PANDORA 22 | 23 | /tmp/PicoDrive.pxml: PicoDrive.pxml.template FORCE 24 | ./make_pxml.sh $< $@ 25 | 26 | rel: ../../picodrive PicoDrive.sh picorestore \ 27 | PicoDrive.png PicoDrive_p.png \ 28 | ../../pico/carthw.cfg skin \ 29 | ../../README.md /tmp/PicoDrive.pxml 30 | rm -rf out 31 | mkdir out 32 | cp -r $^ out/ 33 | mv out/README.md out/README 34 | $(PND_MAKE) -p PicoDrive_$(VER).pnd -d out -x out/PicoDrive.pxml -i out/PicoDrive.png -c 35 | 36 | FORCE: 37 | .PHONY: all rel FORCE 38 | -------------------------------------------------------------------------------- /pico/cd/cell_map.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Convert "cell arrange" address to normal address. 3 | * (C) notaz, 2008 4 | * 5 | * This work is licensed under the terms of MAME license. 6 | * See COPYING file in the top-level directory. 7 | */ 8 | 9 | // 64 x32 x16 x8 x4 x4 10 | static unsigned int cell_map(int celln) 11 | { 12 | int col, row; 13 | 14 | switch ((celln >> 12) & 7) { // 0-0x8000 15 | case 0: // x32 cells 16 | case 1: 17 | case 2: 18 | case 3: 19 | col = celln >> 8; 20 | row = celln & 0xff; 21 | break; 22 | case 4: // x16 23 | case 5: 24 | col = celln >> 7; 25 | row = celln & 0x7f; 26 | row |= 0x10000 >> 8; 27 | break; 28 | case 6: // x8 29 | col = celln >> 6; 30 | row = celln & 0x3f; 31 | row |= 0x18000 >> 8; 32 | break; 33 | case 7: // x4 34 | col = celln >> 5; 35 | row = celln & 0x1f; 36 | row |= (celln & 0x7800) >> 6; 37 | break; 38 | default: // never happens, only here to make compiler happy 39 | col = row = 0; 40 | break; 41 | } 42 | 43 | return (col & 0x3f) + row*64; 44 | } 45 | 46 | -------------------------------------------------------------------------------- /pico/misc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * rarely used EEPROM code 3 | * (C) notaz, 2006-2008 4 | * 5 | * This work is licensed under the terms of MAME license. 6 | * See COPYING file in the top-level directory. 7 | */ 8 | 9 | #include "pico_int.h" 10 | 11 | 12 | #ifndef _ASM_MISC_C 13 | PICO_INTERNAL_ASM void memcpy16bswap(unsigned short *dest, void *src, int count) 14 | { 15 | unsigned char *src_ = src; 16 | 17 | for (; count; count--, src_ += 2) 18 | *dest++ = (src_[0] << 8) | src_[1]; 19 | } 20 | 21 | #ifndef _ASM_MISC_C_AMIPS 22 | PICO_INTERNAL_ASM void memset32(void *dest_in, int c, int count) 23 | { 24 | int *dest = dest_in; 25 | 26 | for (; count >= 8; count -= 8, dest += 8) 27 | dest[0] = dest[1] = dest[2] = dest[3] = 28 | dest[4] = dest[5] = dest[6] = dest[7] = c; 29 | 30 | switch (count) { 31 | case 7: *dest++ = c; 32 | case 6: *dest++ = c; 33 | case 5: *dest++ = c; 34 | case 4: *dest++ = c; 35 | case 3: *dest++ = c; 36 | case 2: *dest++ = c; 37 | case 1: *dest++ = c; 38 | } 39 | } 40 | void memset32_uncached(int *dest, int c, int count) { memset32(dest, c, count); } 41 | #endif 42 | #endif 43 | 44 | -------------------------------------------------------------------------------- /platform/gp2x/code940/uClibc/s_copysign.c: -------------------------------------------------------------------------------- 1 | /* @(#)s_copysign.c 5.1 93/09/24 */ 2 | /* 3 | * ==================================================== 4 | * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. 5 | * 6 | * Developed at SunPro, a Sun Microsystems, Inc. business. 7 | * Permission to use, copy, modify, and distribute this 8 | * software is freely granted, provided that this notice 9 | * is preserved. 10 | * ==================================================== 11 | */ 12 | 13 | #if defined(LIBM_SCCS) && !defined(lint) 14 | static char rcsid[] = "$NetBSD: s_copysign.c,v 1.8 1995/05/10 20:46:57 jtc Exp $"; 15 | #endif 16 | 17 | /* 18 | * copysign(double x, double y) 19 | * copysign(x,y) returns a value with the magnitude of x and 20 | * with the sign bit of y. 21 | */ 22 | 23 | #include "math.h" 24 | #include "math_private.h" 25 | 26 | #ifdef __STDC__ 27 | double copysign(double x, double y) 28 | #else 29 | double copysign(x,y) 30 | double x,y; 31 | #endif 32 | { 33 | u_int32_t hx,hy; 34 | GET_HIGH_WORD(hx,x); 35 | GET_HIGH_WORD(hy,y); 36 | SET_HIGH_WORD(x,(hx&0x7fffffff)|(hy&0x80000000)); 37 | return x; 38 | } 39 | 40 | -------------------------------------------------------------------------------- /pico/cd/megasd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * PicoDrive 3 | * (C) irixxxx, 2024 4 | * 5 | * MEGASD enhancement support as "documented" in "MegaSD DEV Manual Rev.2" 6 | */ 7 | 8 | struct megasd { 9 | // modifiable fields visible through the interface 10 | u16 data[0x800/2]; 11 | u16 command; 12 | u16 result; 13 | 14 | // internal state 15 | s8 state; // CD drive has been initialized 16 | 17 | s8 loop; // playback should loop? 18 | s16 index; // >= 0 if playing audio 19 | s32 startlba, endlba, looplba; // lba's for playback 20 | 21 | s32 readlba; // >= 0 if reading data 22 | 23 | s32 currentlba; // lba currently playing 24 | 25 | s32 pad[7]; 26 | }; 27 | 28 | #define MSD_ST_INIT 1 29 | #define MSD_ST_PLAY 2 30 | #define MSD_ST_PAUSE 4 31 | 32 | extern struct megasd Pico_msd; 33 | 34 | 35 | extern void msd_update(void); // 75Hz update, like CDD irq 36 | extern void msd_reset(void); // reset state 37 | extern void msd_load(void); // state loaded 38 | 39 | extern void msd_write8(u32 a, u32 d); // interface 40 | extern void msd_write16(u32 a, u32 d); 41 | -------------------------------------------------------------------------------- /platform/common/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 | -------------------------------------------------------------------------------- /pico/carthw/carthw.h: -------------------------------------------------------------------------------- 1 | 2 | /* svp */ 3 | #include "../pico_types.h" 4 | #include "svp/ssp16.h" 5 | 6 | typedef struct { 7 | unsigned char iram_rom[0x20000]; // IRAM (0-0x7ff) and program ROM (0x800-0x1ffff) 8 | unsigned char dram[0x20000]; 9 | ssp1601_t ssp1601; 10 | } svp_t; 11 | 12 | extern svp_t *svp; 13 | 14 | void PicoSVPInit(void); 15 | void PicoSVPStartup(void); 16 | void PicoSVPMemSetup(void); 17 | 18 | /* standard/ssf2 mapper */ 19 | extern int carthw_ssf2_active; 20 | extern unsigned char carthw_ssf2_banks[8]; 21 | void carthw_ssf2_startup(void); 22 | void carthw_ssf2_write8(u32 a, u32 d); 23 | void carthw_ssf2_write16(u32 a, u32 d); 24 | 25 | /* misc */ 26 | void carthw_Xin1_startup(void); 27 | void carthw_realtec_startup(void); 28 | void carthw_radica_startup(void); 29 | void carthw_pier_startup(void); 30 | void carthw_sf001_startup(void); 31 | void carthw_sf002_startup(void); 32 | void carthw_sf004_startup(void); 33 | 34 | void carthw_flash_startup(void); 35 | void carthw_sprot_startup(void); 36 | void carthw_sprot_new_location(unsigned int a, 37 | unsigned int mask, unsigned short val, int is_ro); 38 | 39 | void carthw_lk3_startup(void); 40 | void carthw_smw64_startup(void); 41 | 42 | void carthw_jcart_startup(void); 43 | -------------------------------------------------------------------------------- /platform/psp/menu.c: -------------------------------------------------------------------------------- 1 | 2 | static const char *men_vscaling_opts[] = { "OFF", "fullscreen", "borderless", NULL }; 3 | static const char *men_hscaling_opts[] = { "1:1", "4:3", "extended", "fullwidth", NULL }; 4 | static const char *men_filter_opts[] = { "nearest", "bilinear", NULL }; 5 | 6 | static const char h_8bit[] = "This option only works for 8bit renderers"; 7 | 8 | #define MENU_OPTIONS_GFX \ 9 | mee_enum ("Vertical scaling", MA_OPT_VSCALING, currentConfig.vscaling, men_vscaling_opts), \ 10 | mee_enum ("Aspect ratio", MA_OPT_SCALING, currentConfig.scaling, men_hscaling_opts), \ 11 | mee_enum ("Scaler type", MA_OPT3_FILTERING, currentConfig.filter, men_filter_opts), \ 12 | mee_range_h ("Gamma adjustment", MA_OPT3_GAMMAA, currentConfig.gamma, -4, 16, h_8bit), \ 13 | mee_range_h ("Black level", MA_OPT3_BLACKLVL, currentConfig.gamma2, 0, 2, h_8bit), \ 14 | mee_onoff ("Wait for vsync", MA_OPT3_VSYNC, currentConfig.EmuOpt, EOPT_VSYNC), \ 15 | 16 | #define MENU_OPTIONS_ADV 17 | 18 | static menu_entry e_menu_sms_options[]; 19 | static menu_entry e_menu_keyconfig[]; 20 | 21 | void psp_menu_init(void) 22 | { 23 | me_enable(e_menu_sms_options, MA_SMSOPT_GHOSTING, 0); 24 | me_enable(e_menu_keyconfig, MA_CTRL_DEADZONE, 0); 25 | } 26 | -------------------------------------------------------------------------------- /platform/common/tremor/window.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: window functions 15 | 16 | ********************************************************************/ 17 | 18 | #ifndef _V_WINDOW_ 19 | #define _V_WINDOW_ 20 | 21 | extern const void *_vorbis_window(int type,int left); 22 | extern void _vorbis_apply_window(ogg_int32_t *d,const void *window[2], 23 | long *blocksizes, 24 | int lW,int W,int nW); 25 | 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /platform/common/helix/lib.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | // libgcc has this with gcc 4.x 5 | void raise(int sig) 6 | { 7 | } 8 | 9 | // very limited heap functions for helix decoder 10 | 11 | static char heap[65000] __attribute__((aligned(16))); 12 | static long heap_offs; 13 | 14 | void __malloc_init(void) 15 | { 16 | heap_offs = 0; 17 | } 18 | 19 | void *malloc(size_t size) 20 | { 21 | void *chunk = heap + heap_offs; 22 | size = (size+15) & ~15; 23 | if (heap_offs + size > sizeof(heap)) 24 | return NULL; 25 | else { 26 | heap_offs += size; 27 | return chunk; 28 | } 29 | } 30 | 31 | void free(void *chunk) 32 | { 33 | if (chunk == heap) 34 | heap_offs = 0; 35 | } 36 | 37 | #if 0 38 | void *memcpy (void *dest, const void *src, size_t n) 39 | { 40 | char *_dest = dest; 41 | const char *_src = src; 42 | while (n--) *_dest++ = *_src++; 43 | return dest; 44 | } 45 | 46 | void *memmove (void *dest, const void *src, size_t n) 47 | { 48 | char *_dest = dest+n; 49 | const char *_src = src+n; 50 | if (dest <= src || dest >= _src) 51 | return memcpy(dest, src, n); 52 | while (n--) *--_dest = *--_src; 53 | return dest; 54 | } 55 | #else 56 | #include "../memcpy.c" 57 | #endif 58 | -------------------------------------------------------------------------------- /platform/gp2x/Makefile: -------------------------------------------------------------------------------- 1 | # release packaging makefile 2 | 3 | VER := $(shell head -n 1 ../common/version.h | \ 4 | sed 's/.*"\(.*\)\.\(.*\)".*/\1\2/g') 5 | BUILD := $(shell git describe HEAD | grep -- - | \ 6 | sed -e 's/.*\-\(.*\)\-.*/\1/') 7 | ifneq "$(BUILD)" "" 8 | VER := $(VER)_$(BUILD) 9 | endif 10 | 11 | include ../../config.mak 12 | 13 | all: rel 14 | 15 | ../../tools/textfilter: ../../tools/textfilter.c 16 | make -C ../../tools/ textfilter 17 | 18 | readme.txt: ../../tools/textfilter ../base_readme.txt ../../ChangeLog 19 | ../../tools/textfilter ../base_readme.txt $@ GP2X 20 | 21 | CODE940 = code940/pico940_v3.bin 22 | 23 | PicoDrive: ../../picodrive 24 | $(STRIP) $^ -o $@ 25 | 26 | rel: PicoDrive PicoDrive.gpe $(CODE940) readme.txt ../game_def.cfg \ 27 | PicoDrive.png PicoDrive_s.png PicoDrive_t.png \ 28 | warm_2.4.25.o warm_2.4.26-open2x.o warm_2.6.24.ko \ 29 | ../../pico/carthw.cfg 30 | mkdir -p out/PicoDrive/skin/ 31 | cp $^ out/PicoDrive/ 32 | cp PicoDrive.ini out/ 33 | cp skin/*.png out/PicoDrive/skin/ 34 | cp skin/*.txt out/PicoDrive/skin/ 35 | #mkdir out/bin_to_cso_mp3 36 | #cp ../../tools/bin_to_cso_mp3/* out/bin_to_cso_mp3/ 37 | cd out && zip -9 -r ../../../PicoDrive_$(VER).zip * 38 | rm -rf out 39 | 40 | $(CODE940): 41 | make -C code940/ 42 | -------------------------------------------------------------------------------- /tools/make_carthw_c.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | FILE *fi, *fo; 8 | char buf[256]; 9 | 10 | if (argc != 3) { 11 | printf("usage:\n%s \n", argv[0]); 12 | return 1; 13 | } 14 | 15 | fi = fopen(argv[1], "r"); 16 | fo = fopen(argv[2], "w"); 17 | if (fi == NULL || fo == NULL) { 18 | printf("fopen failed\n"); 19 | return 1; 20 | } 21 | 22 | fprintf(fo, "/* generated by %s, do not modify */\n", argv[0]); 23 | fprintf(fo, "static const char builtin_carthw_cfg[] =\n"); 24 | 25 | while ((fgets(buf, sizeof(buf), fi))) 26 | { 27 | char bufd[256]; 28 | char *d = bufd, *p = buf; 29 | int quote = 0; 30 | 31 | while (*p && isspace(*p)) 32 | p++; 33 | 34 | if (*p == 0 || *p == '#') 35 | continue; 36 | 37 | /* section names not needed */ 38 | if (*p == '[') 39 | strcpy(p, "[]"); 40 | 41 | for (; *p != 0; p++) { 42 | if (!quote && *p == '#') 43 | break; 44 | if (!quote && isspace(*p)) 45 | continue; 46 | if (*p == '"') { 47 | quote = !quote; 48 | *d++ = '\\'; 49 | } 50 | *d++ = *p; 51 | } 52 | *d = 0; 53 | 54 | 55 | fprintf(fo, " \"%s\\n\"\n", bufd); 56 | } 57 | 58 | fprintf(fo, ";\n"); 59 | 60 | fclose(fi); 61 | fclose(fo); 62 | 63 | return 0; 64 | } 65 | -------------------------------------------------------------------------------- /platform/common/disarm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 Wojtek Kaniewski 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to 6 | * deal in the Software without restriction, including without limitation the 7 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8 | * sell copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20 | * IN THE SOFTWARE. 21 | */ 22 | 23 | #ifndef DISARM_H 24 | #define DISARM_H 25 | 26 | int disarm(uintptr_t pc, uint32_t insn, char *buf, size_t buf_len, unsigned long *sym); 27 | 28 | #endif /* DISARM_H */ 29 | -------------------------------------------------------------------------------- /platform/common/helix/Makefile: -------------------------------------------------------------------------------- 1 | CROSS_COMPILE ?= arm-linux-gnueabi- 2 | 3 | CC = $(CROSS_COMPILE)gcc 4 | AS = $(CROSS_COMPILE)as 5 | AR = $(CROSS_COMPILE)ar 6 | TOOLCHAIN = $(notdir $(CROSS_COMPILE)) 7 | LIBGCC ?= ${HOME}/opt/open2x/gcc-4.1.1-glibc-2.3.6/lib/gcc/arm-open2x-linux/4.1.1/libgcc.a 8 | 9 | CFLAGS += -Ipub -O2 -Wall -fstrict-aliasing -ffast-math 10 | ifneq ($(findstring arm-,$(TOOLCHAIN)),) 11 | CFLAGS += -mcpu=arm940t -mtune=arm940t -mfloat-abi=soft -mfpu=fpa -mabi=apcs-gnu -mno-thumb-interwork 12 | ASFLAGS = -mcpu=arm940t -mfloat-abi=soft -mfpu=fpa -mabi=apcs-gnu 13 | OBJS += real/arm/asmpoly_gcc.o 14 | else 15 | CFLAGS += -m32 16 | ASFLAGS += -m32 17 | OBJS += real/polyphase.o 18 | endif 19 | 20 | LIB = $(TOOLCHAIN)helix_mp3.a 21 | SHLIB = $(TOOLCHAIN)helix_mp3.so 22 | 23 | all: $(LIB) $(SHLIB) 24 | 25 | 26 | OBJS += mp3dec.o mp3tabs.o 27 | #OBJS += ipp/bitstream.o ipp/buffers.o ipp/dequant.o ipp/huffman.o ipp/imdct.o ipp/subband.o 28 | OBJS += real/bitstream.o real/buffers.o real/dct32.o real/dequant.o real/dqchan.o real/huffman.o 29 | OBJS += real/hufftabs.o real/imdct.o real/scalfact.o real/stproc.o real/subband.o real/trigtabs.o 30 | 31 | OBJS += lib.o 32 | 33 | real/arm/asmpoly_gcc.o: real/arm/asmpoly_gcc.s 34 | $(CC) -o $@ $(ASFLAGS) -c $< 35 | 36 | $(LIB) : $(OBJS) 37 | $(AR) r $@ $^ 38 | $(SHLIB) : $(OBJS) $(LIBGCC) 39 | $(CC) -o $@ -nostdlib -shared $(CFLAGS) $^ 40 | 41 | clean: 42 | $(RM) -f $(OBJS) 43 | 44 | -------------------------------------------------------------------------------- /tools/compdecomp.c: -------------------------------------------------------------------------------- 1 | /* 2 | * :make compdecomp CFLAGS=-Wall LDFLAGS=-lz 3 | */ 4 | #include 5 | #include 6 | #include 7 | 8 | #define MEM_LIMIT (128*1024*1024) 9 | 10 | int main(int argc, char *argv[]) 11 | { 12 | void *pi, *po = NULL; 13 | FILE *fi, *fo; 14 | int ret, si, so; 15 | 16 | if (argc != 4) 17 | { 18 | printf("usage: %s <0|1> \n", argv[0]); 19 | return 1; 20 | } 21 | 22 | fi = fopen(argv[2], "rb"); 23 | if (fi == NULL) return 2; 24 | 25 | fseek(fi, 0, SEEK_END); 26 | si = ftell(fi); 27 | fseek(fi, 0, SEEK_SET); 28 | pi = malloc(si); 29 | if (pi == NULL) return 3; 30 | fread(pi, 1, si, fi); 31 | fclose(fi); 32 | 33 | if (atoi(argv[1])) 34 | { 35 | // decompress 36 | so = si; 37 | do 38 | { 39 | so *= 16; 40 | if (so > MEM_LIMIT) return 4; 41 | po = realloc(po, so); 42 | if (po == NULL) return 5; 43 | ret = uncompress(po, (uLongf *) &so, pi, si); 44 | } 45 | while (ret == Z_BUF_ERROR); 46 | } 47 | else 48 | { 49 | // compress 50 | so = si + 1024; 51 | po = malloc(so); 52 | if (po == NULL) return 5; 53 | ret = compress2(po, (uLongf *) &so, pi, si, Z_BEST_COMPRESSION); 54 | } 55 | 56 | if (ret == Z_OK) 57 | { 58 | fo = fopen(argv[3], "wb"); 59 | if (fo == NULL) return 6; 60 | fwrite(po, 1, so, fo); 61 | fclose(fo); 62 | } 63 | 64 | printf("result %i, size %i -> %i\n", ret, si, so); 65 | 66 | return ret; 67 | } 68 | 69 | -------------------------------------------------------------------------------- /cpu/cyclone_config.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | /** 4 | * Cyclone 68000 configuration file 5 | * 6 | * Used for PicoDrive Cyclone build. 7 | * See config.h in Cyclone directory for option descriptions. 8 | **/ 9 | 10 | 11 | #ifndef HAVE_ARMv6 12 | #define HAVE_ARMv6 1 13 | #endif 14 | #define USE_MS_SYNTAX 0 15 | #define CYCLONE_FOR_GENESIS 2 16 | #define COMPRESS_JUMPTABLE 0 17 | #define MEMHANDLERS_ADDR_MASK 0 18 | 19 | #define MEMHANDLERS_NEED_PC 0 20 | #define MEMHANDLERS_NEED_PREV_PC 0 21 | #define MEMHANDLERS_NEED_FLAGS 0 22 | #define MEMHANDLERS_NEED_CYCLES 1 23 | #define MEMHANDLERS_CHANGE_PC 0 24 | #define MEMHANDLERS_CHANGE_FLAGS 0 25 | #define MEMHANDLERS_CHANGE_CYCLES 1 26 | 27 | #define MEMHANDLERS_DIRECT_PREFIX "cyclone_" 28 | 29 | #define USE_INT_ACK_CALLBACK 1 30 | 31 | #define INT_ACK_NEEDS_STUFF 0 32 | #define INT_ACK_CHANGES_CYCLES 0 33 | 34 | #define USE_RESET_CALLBACK 1 35 | #define USE_UNRECOGNIZED_CALLBACK 1 36 | #define USE_AFLINE_CALLBACK 1 37 | 38 | #define USE_CHECKPC_CALLBACK 1 39 | #define USE_CHECKPC_OFFSETBITS_16 1 40 | #define USE_CHECKPC_OFFSETBITS_8 0 41 | #define USE_CHECKPC_DBRA 0 42 | 43 | #define SPLIT_MOVEL_PD 1 44 | 45 | #define EMULATE_TRACE 1 46 | #define EMULATE_ADDRESS_ERRORS_JUMP 1 47 | #define EMULATE_ADDRESS_ERRORS_IO 0 48 | #define EMULATE_HALT 0 49 | 50 | -------------------------------------------------------------------------------- /cpu/drc/cmn.h: -------------------------------------------------------------------------------- 1 | 2 | #define DRC_TCACHE_SIZE (4*1024*1024) 3 | 4 | extern u8 *tcache; 5 | 6 | void drc_cmn_init(void); 7 | void drc_cmn_cleanup(void); 8 | 9 | #define BITMASK1(v0) (1 << (v0)) 10 | #define BITMASK2(v0,v1) ((1 << (v0)) | (1 << (v1))) 11 | #define BITMASK3(v0,v1,v2) (BITMASK2(v0,v1) | (1 << (v2))) 12 | #define BITMASK4(v0,v1,v2,v3) (BITMASK3(v0,v1,v2) | (1 << (v3))) 13 | #define BITMASK5(v0,v1,v2,v3,v4) (BITMASK4(v0,v1,v2,v3) | (1 << (v4))) 14 | #define BITMASK6(v0,v1,v2,v3,v4,v5) (BITMASK5(v0,v1,v2,v3,v4) | (1 << (v5))) 15 | #define BITRANGE(v0,v1) (BITMASK1(v1+1)-BITMASK1(v0)) // set with v0..v1 16 | 17 | // binary search approach, since we don't have CLZ on ARM920T 18 | #define FOR_ALL_BITS_SET_DO(mask, bit, code) { \ 19 | u32 __mask = mask; \ 20 | for (bit = 0; bit < 32 && mask; bit++, __mask >>= 1) { \ 21 | if (!(__mask & 0xffff)) \ 22 | bit += 16,__mask >>= 16; \ 23 | if (!(__mask & 0xff)) \ 24 | bit += 8, __mask >>= 8; \ 25 | if (!(__mask & 0xf)) \ 26 | bit += 4, __mask >>= 4; \ 27 | if (!(__mask & 0x3)) \ 28 | bit += 2, __mask >>= 2; \ 29 | if (!(__mask & 0x1)) \ 30 | bit += 1, __mask >>= 1; \ 31 | if (__mask & 0x1) { \ 32 | code; \ 33 | } \ 34 | } \ 35 | } 36 | 37 | // inspired by https://graphics.stanford.edu/~seander/bithacks.html 38 | static inline int count_bits(unsigned val) 39 | { 40 | val = val - ((val >> 1) & 0x55555555); 41 | val = (val & 0x33333333) + ((val >> 2) & 0x33333333); 42 | return (((val + (val >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24; 43 | } 44 | 45 | -------------------------------------------------------------------------------- /platform/common/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 | -------------------------------------------------------------------------------- /platform/gizmondo/main.c: -------------------------------------------------------------------------------- 1 | /* 2 | * PicoDrive 3 | * (C) notaz, 2006-2008 4 | * 5 | * This work is licensed under the terms of MAME license. 6 | * See COPYING file in the top-level directory. 7 | */ 8 | 9 | #include 10 | 11 | #include "giz.h" 12 | #include "menu.h" 13 | #include "emu.h" 14 | #include "../common/menu.h" 15 | #include "../common/emu.h" 16 | #include "../common/config.h" 17 | #include "../common/version.h" 18 | 19 | 20 | int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow) 21 | { 22 | emu_prepareDefaultConfig(); 23 | emu_ReadConfig(0, 0); 24 | config_readlrom(PicoConfigFile); 25 | giz_init(hInstance, hPrevInstance); 26 | emu_Init(); 27 | menu_init(); 28 | 29 | engineState = PGS_Menu; 30 | 31 | for (;;) 32 | { 33 | switch (engineState) 34 | { 35 | case PGS_Menu: 36 | menu_loop(); 37 | break; 38 | 39 | case PGS_ReloadRom: 40 | if (emu_reload_rom(romFileName)) 41 | engineState = PGS_Running; 42 | else { 43 | lprintf("PGS_ReloadRom == 0\n"); 44 | engineState = PGS_Menu; 45 | } 46 | break; 47 | 48 | case PGS_RestartRun: 49 | engineState = PGS_Running; 50 | 51 | case PGS_Running: 52 | pemu_loop(); 53 | break; 54 | 55 | case PGS_Quit: 56 | goto endloop; 57 | 58 | default: 59 | lprintf("engine got into unknown state (%i), exitting\n", engineState); 60 | goto endloop; 61 | } 62 | } 63 | 64 | endloop: 65 | 66 | emu_Deinit(); 67 | giz_deinit(); 68 | 69 | return 0; 70 | } 71 | -------------------------------------------------------------------------------- /platform/common/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 | -------------------------------------------------------------------------------- /platform/pandora/PicoDrive.pxml.template: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PicoDrive 6 | 7 | 8 | 9 | 10 | 11 | 12 | PicoDrive @major@.@minor@@build_post@ 13 | 14 | PicoDrive @major@.@minor@@build_post@ 15 | 16 | 17 | Genesis/Mega Drive/Sega CD/32x Emulator. 18 | Ein Mega Drive/Sega CD/32x Emulator 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /tools/offsets/generic-llp64-offsets.h: -------------------------------------------------------------------------------- 1 | /* autogenerated by mkoffset.sh, do not edit */ 2 | /* target endianess: le, compiled with: x86_64-w64-mingw32-gcc */ 3 | #define OFS_Pico_video_reg 0x0000 4 | #define OFS_Pico_m_rotate 0x0040 5 | #define OFS_Pico_m_z80Run 0x0041 6 | #define OFS_Pico_m_dirtyPal 0x0046 7 | #define OFS_Pico_m_hardware 0x0047 8 | #define OFS_Pico_m_z80_reset 0x004f 9 | #define OFS_Pico_m_sram_reg 0x0049 10 | #define OFS_Pico_sv 0x0090 11 | #define OFS_Pico_sv_data 0x0090 12 | #define OFS_Pico_sv_start 0x0098 13 | #define OFS_Pico_sv_end 0x009c 14 | #define OFS_Pico_sv_flags 0x00a0 15 | #define OFS_Pico_rom 0x0588 16 | #define OFS_Pico_romsize 0x0590 17 | #define OFS_Pico_est 0x00d8 18 | #define OFS_EST_DrawScanline 0x0000 19 | #define OFS_EST_rendstatus 0x0004 20 | #define OFS_EST_DrawLineDest 0x0008 21 | #define OFS_EST_HighCol 0x0010 22 | #define OFS_EST_HighPreSpr 0x0018 23 | #define OFS_EST_Pico 0x0020 24 | #define OFS_EST_PicoMem_vram 0x0028 25 | #define OFS_EST_PicoMem_cram 0x0030 26 | #define OFS_EST_PicoOpt 0x0038 27 | #define OFS_EST_Draw2FB 0x0040 28 | #define OFS_EST_HighPal 0x0048 29 | #define OFS_PMEM_vram 0x10000 30 | #define OFS_PMEM_vsram 0x22100 31 | #define OFS_PMEM32x_pal_native 0x90e00 32 | #define OFS_SH2_is_slave 0x0a18 33 | #define OFS_SH2_p_bios 0x0098 34 | #define OFS_SH2_p_da 0x00a0 35 | #define OFS_SH2_p_sdram 0x00a8 36 | #define OFS_SH2_p_rom 0x00b0 37 | #define OFS_SH2_p_dram 0x00b8 38 | #define OFS_SH2_p_drcblk_da 0x00c0 39 | #define OFS_SH2_p_drcblk_ram 0x00c8 40 | -------------------------------------------------------------------------------- /tools/offsets/generic-ilp32-offsets.h: -------------------------------------------------------------------------------- 1 | /* autogenerated by mkoffset.sh, do not edit */ 2 | /* target endianess: le, compiled with: mipsel-linux-gnu-gcc -mabi=32 */ 3 | #define OFS_Pico_video_reg 0x0000 4 | #define OFS_Pico_m_rotate 0x0040 5 | #define OFS_Pico_m_z80Run 0x0041 6 | #define OFS_Pico_m_dirtyPal 0x0046 7 | #define OFS_Pico_m_hardware 0x0047 8 | #define OFS_Pico_m_z80_reset 0x004f 9 | #define OFS_Pico_m_sram_reg 0x0049 10 | #define OFS_Pico_sv 0x008c 11 | #define OFS_Pico_sv_data 0x008c 12 | #define OFS_Pico_sv_start 0x0090 13 | #define OFS_Pico_sv_end 0x0094 14 | #define OFS_Pico_sv_flags 0x0098 15 | #define OFS_Pico_rom 0x0554 16 | #define OFS_Pico_romsize 0x0558 17 | #define OFS_Pico_est 0x00c8 18 | #define OFS_EST_DrawScanline 0x0000 19 | #define OFS_EST_rendstatus 0x0004 20 | #define OFS_EST_DrawLineDest 0x0008 21 | #define OFS_EST_HighCol 0x000c 22 | #define OFS_EST_HighPreSpr 0x0010 23 | #define OFS_EST_Pico 0x0014 24 | #define OFS_EST_PicoMem_vram 0x0018 25 | #define OFS_EST_PicoMem_cram 0x001c 26 | #define OFS_EST_PicoOpt 0x0020 27 | #define OFS_EST_Draw2FB 0x0024 28 | #define OFS_EST_HighPal 0x0028 29 | #define OFS_PMEM_vram 0x10000 30 | #define OFS_PMEM_vsram 0x22100 31 | #define OFS_PMEM32x_pal_native 0x90e00 32 | #define OFS_SH2_is_slave 0x055c 33 | #define OFS_SH2_p_bios 0x0080 34 | #define OFS_SH2_p_da 0x0084 35 | #define OFS_SH2_p_sdram 0x0088 36 | #define OFS_SH2_p_rom 0x008c 37 | #define OFS_SH2_p_dram 0x0090 38 | #define OFS_SH2_p_drcblk_da 0x0094 39 | #define OFS_SH2_p_drcblk_ram 0x0098 40 | -------------------------------------------------------------------------------- /tools/offsets/generic-lp64-offsets.h: -------------------------------------------------------------------------------- 1 | /* autogenerated by mkoffset.sh, do not edit */ 2 | /* target endianess: le, compiled with: mipsel-linux-gnu-gcc -mabi=64 */ 3 | #define OFS_Pico_video_reg 0x0000 4 | #define OFS_Pico_m_rotate 0x0040 5 | #define OFS_Pico_m_z80Run 0x0041 6 | #define OFS_Pico_m_dirtyPal 0x0046 7 | #define OFS_Pico_m_hardware 0x0047 8 | #define OFS_Pico_m_z80_reset 0x004f 9 | #define OFS_Pico_m_sram_reg 0x0049 10 | #define OFS_Pico_sv 0x0090 11 | #define OFS_Pico_sv_data 0x0090 12 | #define OFS_Pico_sv_start 0x0098 13 | #define OFS_Pico_sv_end 0x009c 14 | #define OFS_Pico_sv_flags 0x00a0 15 | #define OFS_Pico_rom 0x0588 16 | #define OFS_Pico_romsize 0x0590 17 | #define OFS_Pico_est 0x00d8 18 | #define OFS_EST_DrawScanline 0x0000 19 | #define OFS_EST_rendstatus 0x0004 20 | #define OFS_EST_DrawLineDest 0x0008 21 | #define OFS_EST_HighCol 0x0010 22 | #define OFS_EST_HighPreSpr 0x0018 23 | #define OFS_EST_Pico 0x0020 24 | #define OFS_EST_PicoMem_vram 0x0028 25 | #define OFS_EST_PicoMem_cram 0x0030 26 | #define OFS_EST_PicoOpt 0x0038 27 | #define OFS_EST_Draw2FB 0x0040 28 | #define OFS_EST_HighPal 0x0048 29 | #define OFS_PMEM_vram 0x10000 30 | #define OFS_PMEM_vsram 0x22100 31 | #define OFS_PMEM32x_pal_native 0x90e00 32 | #define OFS_SH2_is_slave 0x0a18 33 | #define OFS_SH2_p_bios 0x0098 34 | #define OFS_SH2_p_da 0x00a0 35 | #define OFS_SH2_p_sdram 0x00a8 36 | #define OFS_SH2_p_rom 0x00b0 37 | #define OFS_SH2_p_dram 0x00b8 38 | #define OFS_SH2_p_drcblk_da 0x00c0 39 | #define OFS_SH2_p_drcblk_ram 0x00c8 40 | -------------------------------------------------------------------------------- /tools/mkt1.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | static FILE *fo = NULL; 5 | 6 | static void out(int r, int is_last) 7 | { 8 | if (!is_last) 9 | { 10 | fprintf(fo, " or $t%i, $t%i, $a2\n", r, r); 11 | fprintf(fo, " sb $t%i, %i($a0)\n", r, r); 12 | } 13 | else 14 | { 15 | fprintf(fo, " or $t%i, $t%i, $a2\n", r, r); 16 | fprintf(fo, " jr $ra\n"); 17 | fprintf(fo, " sb $t%i, %i($a0)\n", r, r); 18 | } 19 | } 20 | 21 | unsigned char pattern_db[0x100]; 22 | 23 | static int check_label(unsigned char i) 24 | { 25 | if (!pattern_db[i]) { 26 | fprintf(fo, "tile%i%i%i%i%i%i%i%i:\n", (i&0x80)?1:0, (i&0x40)?1:0, (i&0x20)?1:0, (i&0x10)?1:0, 27 | (i&0x08)?1:0, (i&0x04)?1:0, (i&0x02)?1:0, (i&0x01)?1:0); 28 | pattern_db[i] = 1; 29 | return 0; 30 | } 31 | 32 | return 1; 33 | } 34 | 35 | 36 | int main() 37 | { 38 | int i; 39 | 40 | fo = fopen("out.s", "w"); 41 | if (!fo) return 1; 42 | 43 | memset(pattern_db, 0, sizeof(pattern_db)); 44 | 45 | for (i = 0xff; i > 0; i--) 46 | { 47 | if (check_label(i)) continue; 48 | 49 | if (i & 0x01) out(0, !(i&0xfe)); 50 | check_label(i&0xfe); 51 | if (i & 0x02) out(1, !(i&0xfc)); 52 | check_label(i&0xfc); 53 | if (i & 0x04) out(2, !(i&0xf8)); 54 | check_label(i&0xf8); 55 | if (i & 0x08) out(3, !(i&0xf0)); 56 | check_label(i&0xf0); 57 | if (i & 0x10) out(4, !(i&0xe0)); 58 | check_label(i&0xe0); 59 | if (i & 0x20) out(5, !(i&0xc0)); 60 | check_label(i&0xc0); 61 | if (i & 0x40) out(6, !(i&0x80)); 62 | check_label(i&0x80); 63 | if (i & 0x80) out(7, 1); 64 | } 65 | 66 | fclose(fo); 67 | 68 | return 0; 69 | } 70 | 71 | -------------------------------------------------------------------------------- /platform/common/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 | -------------------------------------------------------------------------------- /cpu/drc/cmn.c: -------------------------------------------------------------------------------- 1 | /* 2 | * PicoDrive 3 | * Copyright (C) 2009,2010 notaz 4 | * 5 | * This work is licensed under the terms of MAME license. 6 | * See COPYING file in the top-level directory. 7 | */ 8 | #include 9 | 10 | #include 11 | #include "cmn.h" 12 | 13 | #if defined(__linux__) && (defined(__aarch64__) || defined(__VFP_FP__)) 14 | // might be running on a 64k-page kernel 15 | #define PICO_PAGE_ALIGN 65536 16 | #else 17 | #define PICO_PAGE_ALIGN 4096 18 | #endif 19 | u8 ALIGNED(PICO_PAGE_ALIGN) tcache_default[DRC_TCACHE_SIZE]; 20 | u8 *tcache; 21 | 22 | void drc_cmn_init(void) 23 | { 24 | int ret; 25 | 26 | tcache = plat_mem_get_for_drc(DRC_TCACHE_SIZE); 27 | if (tcache == NULL) 28 | tcache = tcache_default; 29 | 30 | ret = plat_mem_set_exec(tcache, DRC_TCACHE_SIZE); 31 | elprintf(EL_STATUS, "drc_cmn_init: %p, %zd bytes: %d", 32 | tcache, DRC_TCACHE_SIZE, ret); 33 | 34 | #ifdef __arm__ 35 | if (PicoIn.opt & POPT_EN_DRC) 36 | { 37 | static int test_done; 38 | if (!test_done) 39 | { 40 | int *test_out = (void *)tcache; 41 | int (*testfunc)(void) = (void *)tcache; 42 | 43 | elprintf(EL_STATUS, "testing if we can run recompiled code.."); 44 | *test_out++ = 0xe3a000dd; // mov r0, 0xdd 45 | *test_out++ = 0xe12fff1e; // bx lr 46 | cache_flush_d_inval_i(tcache, test_out); 47 | 48 | // we'll usually crash on broken platforms or bad ports, 49 | // but do a value check too just in case 50 | ret = testfunc(); 51 | elprintf(EL_STATUS, "test %s.", ret == 0xdd ? "passed" : "failed"); 52 | test_done = 1; 53 | } 54 | } 55 | #endif 56 | } 57 | 58 | void drc_cmn_cleanup(void) 59 | { 60 | } 61 | 62 | // vim:shiftwidth=2:expandtab 63 | -------------------------------------------------------------------------------- /platform/libretro/msvc/msvc-2003-xbox1.bat: -------------------------------------------------------------------------------- 1 | @SET VSINSTALLDIR=C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE 2 | @SET VCINSTALLDIR=C:\Program Files\Microsoft Visual Studio .NET 2003 3 | @SET FrameworkDir=C:\WINDOWS\Microsoft.NET\Framework 4 | @SET FrameworkVersion=v1.1.4322 5 | @SET FrameworkSDKDir=C:\Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1 6 | @rem Root of Visual Studio common files. 7 | 8 | @if "%VSINSTALLDIR%"=="" goto Usage 9 | @if "%VCINSTALLDIR%"=="" set VCINSTALLDIR=%VSINSTALLDIR% 10 | 11 | @rem 12 | @rem Root of Visual Studio ide installed files. 13 | @rem 14 | @set DevEnvDir=%VSINSTALLDIR% 15 | 16 | @rem 17 | @rem Root of Visual C++ installed files. 18 | @rem 19 | @set MSVCDir=%VCINSTALLDIR%\VC7 20 | 21 | @rem 22 | @echo Setting environment for using Microsoft Visual Studio .NET 2003 tools. 23 | @echo (If you have another version of Visual Studio or Visual C++ installed and wish 24 | @echo to use its tools from the command line, run vcvars32.bat for that version.) 25 | @rem 26 | 27 | @REM %VCINSTALLDIR%\Common7\Tools dir is added only for real setup. 28 | 29 | @set PATH=%DevEnvDir%;%MSVCDir%\BIN;%VCINSTALLDIR%\Common7\Tools;%VCINSTALLDIR%\Common7\Tools\bin\prerelease;%VCINSTALLDIR%\Common7\Tools\bin;%FrameworkSDKDir%\bin;%FrameworkDir%\%FrameworkVersion%;%PATH%; 30 | @set INCLUDE=%MSVCDir%\ATLMFC\INCLUDE;%MSVCDir%\INCLUDE;%FrameworkSDKDir%\include;%INCLUDE%;%XDK%\xbox\include 31 | @set LIB=%MSVCDir%\ATLMFC\LIB;%MSVCDir%\LIB;%MSVCDir%\PlatformSDK\lib;%XDK%\lib;%XDK%\xbox\lib;%LIB% 32 | 33 | @goto end 34 | 35 | :Usage 36 | 37 | @echo. VSINSTALLDIR variable is not set. 38 | @echo. 39 | @echo SYNTAX: %0 40 | 41 | @goto end 42 | 43 | :end 44 | 45 | devenv /clean Release_LTCG msvc-2003-xbox1.sln 46 | devenv /build Release_LTCG msvc-2003-xbox1.sln 47 | exit 48 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | 2 | Redistribution and use of this code or any derivative works are permitted 3 | provided that the following conditions are met: 4 | 5 | * Redistributions may not be sold, nor may they be used in a commercial 6 | product or activity. 7 | 8 | * Redistributions that are modified from the original source must include the 9 | complete source code, including the source code for all components used by a 10 | binary built from the modified sources. However, as a special exception, the 11 | source code distributed need not include anything that is normally distributed 12 | (in either source or binary form) with the major components (compiler, kernel, 13 | and so on) of the operating system on which the executable runs, unless that 14 | component itself accompanies the executable. 15 | 16 | * Redistributions must reproduce the above copyright notice, this list of 17 | conditions and the following disclaimer in the documentation and/or other 18 | materials provided with the distribution. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 24 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 | POSSIBILITY OF SUCH DAMAGE. 31 | -------------------------------------------------------------------------------- /pico/pico/pico.c: -------------------------------------------------------------------------------- 1 | /* 2 | * PicoDrive 3 | * (C) notaz, 2008 4 | * (C) irixxxx, 2024 5 | * 6 | * This work is licensed under the terms of MAME license. 7 | * See COPYING file in the top-level directory. 8 | */ 9 | #include "../pico_int.h" 10 | 11 | // x: 0x03c - 0x19d 12 | // y: 0x1fc - 0x2f7 13 | // 0x2f8 - 0x3f3 14 | picohw_state PicoPicohw; 15 | 16 | 17 | 18 | PICO_INTERNAL void PicoReratePico(void) 19 | { 20 | PicoPicoPCMRerate(); 21 | PicoPicohw.xpcm_ptr = PicoPicohw.xpcm_buffer + PicoPicohw.fifo_bytes; 22 | } 23 | 24 | static void PicoLinePico(void) 25 | { 26 | // update sound so that irq for FIFO refill is generated 27 | if ((PicoPicohw.fifo_bytes | !PicoPicoPCMBusyN()) && (Pico.m.scanline & 7) == 7) 28 | PsndDoPCM(cycles_68k_to_z80(SekCyclesDone() - Pico.t.m68c_frame_start)); 29 | } 30 | 31 | static void PicoResetPico(void) 32 | { 33 | PicoPicoPCMResetN(1); 34 | PicoPicoPCMStartN(1); 35 | PicoPicohw.xpcm_ptr = PicoPicohw.xpcm_buffer; 36 | PicoPicohw.fifo_bytes = 0; 37 | PicoPicohw.r12 = 0; 38 | 39 | PicoPicohw.pen_pos[0] = PicoPicohw.pen_pos[1] = 0x8000; 40 | 41 | PicoPicoPCMIrqEn(0); 42 | PicoPicoPCMFilter(0); 43 | PicoPicoPCMGain(8); 44 | 45 | // map version register 46 | PicoDetectRegion(); 47 | switch (Pico.m.hardware >> 6) { 48 | case 0: PicoPicohw.r1 = 0x40; break; // JP NTSC 49 | case 1: PicoPicohw.r1 = 0x00; break; // JP PAL 50 | case 2: PicoPicohw.r1 = 0x60; break; // US 51 | case 3: PicoPicohw.r1 = 0x20; break; // EU 52 | } 53 | } 54 | 55 | PICO_INTERNAL void PicoInitPico(void) 56 | { 57 | elprintf(EL_STATUS, "Pico startup"); 58 | PicoLineHook = PicoLinePico; 59 | PicoResetHook = PicoResetPico; 60 | 61 | PicoIn.AHW = PAHW_PICO; 62 | memset(&PicoPicohw, 0, sizeof(PicoPicohw)); 63 | PicoPicohw.pen_pos[0] = PicoPicohw.pen_pos[1] = 0x8000; 64 | } 65 | -------------------------------------------------------------------------------- /platform/libretro/libretro-common/include/retro_assert.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (retro_assert.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 __RETRO_ASSERT_H 24 | #define __RETRO_ASSERT_H 25 | 26 | #include 27 | 28 | #ifdef RARCH_INTERNAL 29 | #include 30 | #define retro_assert(cond) ((void)( (cond) || (printf("Assertion failed at %s:%d.\n", __FILE__, __LINE__), abort(), 0) )) 31 | #else 32 | #define retro_assert(cond) assert(cond) 33 | #endif 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /platform/common/mp3_minimp3.c: -------------------------------------------------------------------------------- 1 | /* 2 | * MP3 decoding using minimp3 3 | * (C) irixxxx, 2020 4 | * 5 | * This work is licensed under the terms of MAME license. 6 | * See COPYING file in the top-level directory. 7 | */ 8 | 9 | #include 10 | 11 | #include 12 | #define MINIMP3_IMPLEMENTATION 13 | #include "minimp3/minimp3.h" 14 | #include "mp3.h" 15 | 16 | static mp3dec_t mp3dec; 17 | static unsigned char mp3_input_buffer[2 * 1024]; 18 | 19 | int mp3dec_start(FILE *f, int fpos_start) 20 | { 21 | mp3dec_init(&mp3dec); 22 | return 0; 23 | } 24 | 25 | int mp3dec_decode(FILE *f, int *file_pos, int file_len) 26 | { 27 | mp3dec_frame_info_t info; 28 | unsigned char *readPtr; 29 | int bytesLeft; 30 | int offset; // mp3 frame offset from readPtr 31 | int len; 32 | int retry = 3; 33 | 34 | do 35 | { 36 | if (*file_pos >= file_len) 37 | return 1; /* EOF, nothing to do */ 38 | 39 | fseek(f, *file_pos, SEEK_SET); 40 | bytesLeft = fread(mp3_input_buffer, 1, sizeof(mp3_input_buffer), f); 41 | 42 | offset = mp3_find_sync_word(mp3_input_buffer, bytesLeft); 43 | if (offset < 0) { 44 | lprintf("find_sync_word (%i/%i) err %i\n", 45 | *file_pos, file_len, offset); 46 | *file_pos = file_len; 47 | return 1; // EOF 48 | } 49 | *file_pos += offset; 50 | readPtr = mp3_input_buffer + offset; 51 | bytesLeft -= offset; 52 | 53 | len = mp3dec_decode_frame(&mp3dec, readPtr, bytesLeft, cdda_out_buffer, &info); 54 | if (len > 0) // retrieved decoded data 55 | *file_pos += info.frame_bytes; 56 | else if (info.frame_bytes > 0) // no output but input consumed? 57 | *file_pos += 1; // try to skip frame 58 | else if (offset == 0) // bad frame? 59 | *file_pos += 1; // try resyncing 60 | // else // truncated frame, try more data 61 | } 62 | while (len <= 0 && --retry > 0); 63 | 64 | return len <= 0; 65 | } 66 | -------------------------------------------------------------------------------- /platform/common/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 | -------------------------------------------------------------------------------- /platform/libretro/libretro-common/include/compat/fnmatch.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 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 | /** 29 | * Portable implementation of \c fnmatch(3), 30 | * except \c flags is not implemented. 31 | * @see https://man7.org/linux/man-pages/man3/fnmatch.3.html 32 | */ 33 | int rl_fnmatch(const char *pattern, const char *string, int flags); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /platform/psp/psp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * PicoDrive 3 | * (C) notaz, 2007,2008 4 | * 5 | * This work is licensed under the terms of MAME license. 6 | * See COPYING file in the top-level directory. 7 | */ 8 | 9 | #include 10 | 11 | void psp_init(void); 12 | void psp_finish(void); 13 | 14 | void psp_msleep(int ms); 15 | 16 | // vram usage map: 17 | // 000000-044000 fb0: 512*272*2 18 | // 044000-088000 fb1 19 | // 088000-0cc000 depth (Z) 20 | // 0cc000-110000 emu/menu draw buffer 0: 512*272*2 21 | // 110000-154000 emu/menu draw buffer 1 22 | 23 | #define VRAMOFFS_FB0 0x00000000 24 | #define VRAMOFFS_FB1 0x00044000 25 | #define VRAMOFFS_DEPTH 0x00088000 26 | #define VRAMOFFS_STUFF 0x000cc000 27 | 28 | #define VRAM_ADDR 0x44000000 29 | #define VRAM_FB0 ((void *) (VRAM_ADDR+VRAMOFFS_FB0)) 30 | #define VRAM_FB1 ((void *) (VRAM_ADDR+VRAMOFFS_FB1)) 31 | #define VRAM_STUFF ((void *) (VRAM_ADDR+VRAMOFFS_STUFF)) 32 | 33 | #define VRAM_CACHEDADDR 0x04000000 34 | #define VRAM_CACHED_STUFF ((void *) (VRAM_CACHEDADDR+VRAMOFFS_STUFF)) 35 | 36 | #define GU_CMDLIST_SIZE (16*1024) 37 | 38 | extern unsigned int guCmdList[GU_CMDLIST_SIZE]; 39 | extern int psp_unhandled_suspend; 40 | 41 | void *psp_video_get_active_fb(void); 42 | void psp_video_switch_to_single(void); 43 | void psp_video_flip(int wait_vsync); 44 | extern void *psp_screen; 45 | 46 | unsigned int psp_pad_read(int blocking); 47 | 48 | int psp_get_cpu_clock(void); 49 | int psp_set_cpu_clock(int clock); 50 | 51 | char *psp_get_status_line(void); 52 | 53 | void psp_wait_suspend(void); 54 | void psp_resume_suspend(void); 55 | 56 | /* fake 'nub' btns, mapped to the 4 unused upper bits of ctrl buttons */ 57 | #define PSP_NUB_UP (1 << 26) 58 | #define PSP_NUB_RIGHT (1 << 27) 59 | #define PSP_NUB_DOWN (1 << 28) 60 | #define PSP_NUB_LEFT (1 << 29) 61 | 62 | /* from menu.c */ 63 | void psp_menu_init(void); 64 | -------------------------------------------------------------------------------- /platform/win32/Makefile: -------------------------------------------------------------------------------- 1 | # settings 2 | CROSS=i586-mingw32msvc- 3 | 4 | #use_musashi = 1 5 | use_fame = 1 6 | use_cz80 = 1 7 | use_sh2drc = 1 8 | #use_sh2mame = 1 9 | 10 | -include Makefile.local 11 | 12 | ARCH ?= x86 13 | CC = $(CROSS)gcc 14 | CXX = $(CROSS)g++ 15 | LD = $(CROSS)ld 16 | STRIP = $(CROSS)strip 17 | 18 | DEFINES = _UNZIP_SUPPORT IN_VK 19 | CFLAGS += -O2 -Wall -falign-functions=2 -ffast-math 20 | CFLAGS += -I../.. -I. -I../../zlib/ -Idirectx/include/ 21 | LDFLAGS += -mwindows -L. -Ldirectx/lib/ -lgdi32 -lcomdlg32 -lddraw -ldsound -ldxguid 22 | 23 | # frontend 24 | OBJS += main.o plat.o direct.o dsnd.o in_vk.o 25 | 26 | # common 27 | OBJS += platform/common/emu.o platform/common/menu.o \ 28 | platform/common/config.o platform/common/fonts.o platform/common/readpng.o \ 29 | platform/common/input.o 30 | 31 | OBJS += pico/carthw/svp/compiler.o 32 | OBJS += pico/sound/mix.o 33 | # zlib 34 | OBJS += zlib/gzio.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o zlib/trees.o \ 35 | zlib/deflate.o zlib/crc32.o zlib/adler32.o zlib/zutil.o zlib/compress.o zlib/uncompr.o 36 | # unzip 37 | OBJS += unzip/unzip.o unzip/unzip_stream.o 38 | 39 | CFLAGS += $(addprefix -D,$(DEFINES)) 40 | CXXFLAGS = $(CFLAGS) 41 | 42 | vpath %.c = ../.. 43 | 44 | DIRS += zlib unzip 45 | 46 | TARGET = PicoDrive.exe 47 | all: mkdirs $(TARGET) 48 | 49 | include ../common/common.mak 50 | include ../common/revision.mak 51 | 52 | clean: tidy 53 | @$(RM) $(TARGET) 54 | tidy: 55 | $(RM) $(OBJS) $(TARGET).map 56 | rm -rf $(DIRS) 57 | 58 | $(TARGET) : $(OBJS) 59 | @echo ">>>" $@ 60 | $(CC) $(CFLAGS) $^ $(LDFLAGS) -lm -lpng -Wl,-Map=$(TARGET).map -o $@ 61 | $(STRIP) $@ 62 | 63 | # ----------- release ----------- 64 | ifneq ($(findstring rel,$(MAKECMDGOALS)),) 65 | ifeq ($(VER),) 66 | $(error need VER) 67 | endif 68 | endif 69 | 70 | rel: $(TARGET) readme.txt carthw.cfg 71 | zip -9 -j ../../PicoDrive_win32_$(VER).zip $^ 72 | 73 | -------------------------------------------------------------------------------- /pico/cd/gfx_dma.c: -------------------------------------------------------------------------------- 1 | /* 2 | * PicoDrive 3 | * (C) notaz, 2007 4 | * 5 | * This work is licensed under the terms of MAME license. 6 | * See COPYING file in the top-level directory. 7 | */ 8 | 9 | #include "../pico_int.h" 10 | 11 | #include "cell_map.c" 12 | 13 | // check: Heart of the alien, jaguar xj 220 14 | PICO_INTERNAL void DmaSlowCell(u32 source, u32 a, int len, unsigned char inc) 15 | { 16 | unsigned char *base; 17 | u32 asrc, a2; 18 | u16 *r; 19 | 20 | base = Pico_mcd->word_ram1M[Pico_mcd->s68k_regs[3]&1]; 21 | 22 | switch (Pico.video.type) 23 | { 24 | case 1: // vram 25 | r = PicoMem.vram; 26 | for(; len; len--) 27 | { 28 | asrc = cell_map(source >> 2) << 2; 29 | asrc |= source & 2; 30 | // if(a&1) d=(d<<8)|(d>>8); // ?? 31 | VideoWriteVRAM(a, *(u16 *)(base + asrc)); 32 | source += 2; 33 | // AutoIncrement 34 | a=(u16)(a+inc); 35 | } 36 | break; 37 | 38 | case 3: // cram 39 | Pico.m.dirtyPal = 1; 40 | r = PicoMem.cram; 41 | for(a2=a&0x7f; len; len--) 42 | { 43 | asrc = cell_map(source >> 2) << 2; 44 | asrc |= source & 2; 45 | r[a2>>1] = *(u16 *)(base + asrc); 46 | source += 2; 47 | // AutoIncrement 48 | a2+=inc; 49 | // good dest? 50 | if(a2 >= 0x80) break; 51 | } 52 | a=(a&0xff00)|a2; 53 | break; 54 | 55 | case 5: // vsram[a&0x003f]=d; 56 | r = PicoMem.vsram; 57 | for(a2=a&0x7f; len; len--) 58 | { 59 | asrc = cell_map(source >> 2) << 2; 60 | asrc |= source & 2; 61 | r[a2>>1] = *(u16 *)(base + asrc); 62 | source += 2; 63 | // AutoIncrement 64 | a2+=inc; 65 | // good dest? 66 | if(a2 >= 0x80) break; 67 | } 68 | a=(a&0xff00)|a2; 69 | break; 70 | } 71 | // remember addr 72 | Pico.video.addr=(u16)a; 73 | } 74 | 75 | -------------------------------------------------------------------------------- /platform/libretro/libretro-common/include/boolean.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 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 | -------------------------------------------------------------------------------- /tools/mkoffsets.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | 6 | #define DUMP(f, prefix, type, field) \ 7 | fprintf(f, "#define %-20s 0x%02x\n", \ 8 | prefix #field, (int)offsetof(type, field)) 9 | 10 | #define DUMP_P(f, field) \ 11 | fprintf(f, "#define %-20s 0x%04x\n", \ 12 | "OFS_Pico_" #field, (char *)&p.field - (char *)&p) 13 | 14 | #define DUMP_PS(f, s1, field) \ 15 | fprintf(f, "#define %-20s 0x%04x\n", \ 16 | "OFS_Pico_" #s1 "_" #field, (char *)&p.s1.field - (char *)&p) 17 | 18 | #define DUMP_EST(f, field) \ 19 | DUMP(f, "OFS_EST_", struct PicoEState, field) 20 | 21 | #define DUMP_PMEM(f, field) \ 22 | DUMP(f, "OFS_PMEM_", struct PicoMem, field) 23 | 24 | extern struct Pico p; 25 | 26 | int main(int argc, char *argv[]) 27 | { 28 | char buf[128]; 29 | FILE *f; 30 | 31 | snprintf(buf, sizeof(buf), "pico/pico_int_o%d.h", sizeof(void *) * 8); 32 | f = fopen(buf, "w"); 33 | if (!f) { 34 | perror("fopen"); 35 | return 1; 36 | } 37 | 38 | fprintf(f, "/* autogenerated by %s, do not edit */\n", argv[0]); 39 | DUMP_PS(f, video, reg); 40 | DUMP_PS(f, m, rotate); 41 | DUMP_PS(f, m, z80Run); 42 | DUMP_PS(f, m, dirtyPal); 43 | DUMP_PS(f, m, hardware); 44 | DUMP_PS(f, m, z80_reset); 45 | DUMP_PS(f, m, sram_reg); 46 | DUMP_P (f, sv); 47 | DUMP_PS(f, sv, data); 48 | DUMP_PS(f, sv, start); 49 | DUMP_PS(f, sv, end); 50 | DUMP_PS(f, sv, flags); 51 | DUMP_P (f, rom); 52 | DUMP_P (f, romsize); 53 | DUMP_EST(f, DrawScanline); 54 | DUMP_EST(f, rendstatus); 55 | DUMP_EST(f, DrawLineDest); 56 | DUMP_EST(f, HighCol); 57 | DUMP_EST(f, HighPreSpr); 58 | DUMP_EST(f, Pico); 59 | DUMP_EST(f, PicoMem_vram); 60 | DUMP_EST(f, PicoMem_cram); 61 | DUMP_EST(f, PicoOpt); 62 | DUMP_EST(f, Draw2FB); 63 | DUMP_EST(f, HighPal); 64 | DUMP_PMEM(f, vram); 65 | DUMP_PMEM(f, vsram); 66 | fclose(f); 67 | 68 | return 0; 69 | } 70 | -------------------------------------------------------------------------------- /platform/libretro/libretro-common/include/compat/fopen_utf8.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 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 | -------------------------------------------------------------------------------- /platform/gp2x/code940/940shared.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // max 16 jobs, lower num means higher prio 4 | enum _940_job_t { 5 | JOB940_INITALL = 1, 6 | JOB940_INVALIDATE_DCACHE, 7 | JOB940_YM2612RESETCHIP, 8 | JOB940_YM2612UPDATEONE, 9 | JOB940_MP3DECODE, 10 | JOB940_PICOSTATELOAD, 11 | JOB940_PICOSTATESAVE2, 12 | JOB940_PICOSTATELOAD2_PREP, 13 | JOB940_PICOSTATELOAD2, 14 | JOB940_MP3RESET, 15 | }; 16 | 17 | //#define MAX_940JOBS 2 18 | 19 | typedef struct 20 | { 21 | YM2612 ym2612; /* current state of the emulated YM2612 */ 22 | void *mp3dec; /* mp3 decoder's handle */ 23 | int ym_buffer[44100/50*2]; /* this is where the YM2612 samples will be mixed to */ 24 | short mp3_buffer[2][1152*2]; /* buffers for mp3 decoder's output */ 25 | } _940_data_t; 26 | 27 | 28 | typedef struct 29 | { 30 | int vstarts[8]; /* debug: 00: number of starts from each of 8 vectors */ 31 | int last_lr; /* debug: 20: last exception's lr */ 32 | // int jobs[MAX_940JOBS]; /* jobs for second core */ 33 | // int busy_; /* unused */ 34 | int length; /* number of samples to mix (882 max) */ 35 | int stereo; /* mix samples as stereo, doubles sample count automatically */ 36 | int baseclock; /* ym2612 settings */ 37 | int rate; 38 | int writebuffsel; /* which write buffer to use (from 940 side) */ 39 | UINT16 writebuff0[2048]; /* list of writes to ym2612, 1024 for savestates, 1024 extra */ 40 | UINT16 writebuff1[2048]; 41 | int ym_active_chs; 42 | int mp3_len; /* data len of loaded mp3 */ 43 | int mp3_offs; /* current playback offset (just after last decoded frame) */ 44 | int mp3_buffsel; /* which output buffer to decode to */ 45 | int loopc; /* debug: main loop counter */ 46 | int mp3_errors; /* debug: mp3 decoder's error counter */ 47 | int mp3_lasterr; /* debug: mp3 decoder's last error */ 48 | int lastjob; /* debug: last job id */ 49 | } _940_ctl_t; 50 | -------------------------------------------------------------------------------- /platform/common/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 | -------------------------------------------------------------------------------- /tools/bin_to_cso_mp3/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | bin_to_cso_mp3 3 | Originally written by Exophase as "bin_to_iso_ogg" 4 | updated for cso/mp3 by notaz 5 | 6 | 7 | About 8 | ----- 9 | 10 | This is a tool to convert cue/bin CD image to cue/cso/mp3 form, useful to use 11 | with emulators. It can also create ISO instead of CSO and WAV instead of MP3. 12 | Note that input must be .cue file, along with single .bin file. 13 | 14 | 15 | Easy/Windows usage 16 | ------------------ 17 | 18 | 1. Download LAME from http://lame.sourceforge.net/links.php#Binaries 19 | You need an archive or "LAME Bundle" with lame.exe inside. Extract lame.exe 20 | to the same directory as bin_to_cso_mp3.exe 21 | 2. Find ciso.exe . It usually comes with ISO->CSO converters, for example yacc 22 | (http://yacc.pspgen.com/). Extract ciso.exe to the directory from previous 23 | step. 24 | 3. Drag the .cue file you want to convert onto bin_to_cso_mp3.exe . It should 25 | pop up console window with some scrolling text, which should close by itself 26 | when done. After that you should see new directory with converted files. 27 | 28 | In case it complains about missing lame.exe even after you copied it, try 29 | copying lame.exe and ciso.exe somewhere in your PATH, i.e. Windows directory. 30 | 31 | If it crashes ("this program needs to close blabla"), you probably have bad 32 | .cue or missing .bin file. 33 | 34 | 35 | Advanced usage 36 | -------------- 37 | 38 | Just run bin_to_cso_mp3.exe from console terminal (or "command prompt") without 39 | any parameters to see usage. 40 | 41 | 42 | Linux 43 | ----- 44 | 45 | You will need to compile bin_to_cso_mp3.c yourself using gcc: 46 | $ gcc bin_to_cso_mp3.c -o bin_to_cso_mp3 47 | 48 | You will also need to have lame and ciso binaries in PATH. Those can sometimes 49 | be installed using packet manager from the distribution, or you can compile 50 | them from sources: 51 | lame: http://lame.sourceforge.net/ 52 | ciso: http://ciso.tenshu.fr/ 53 | 54 | -------------------------------------------------------------------------------- /platform/gizmondo/giz.h: -------------------------------------------------------------------------------- 1 | extern void *giz_screen; 2 | 3 | void giz_init(); 4 | void giz_deinit(void); 5 | void lprintf(const char *fmt, ...); 6 | 7 | void *directfb_lock(int unused); 8 | void directfb_unlock(void); 9 | void directfb_flip(void); 10 | 11 | #if 1 12 | #define fb_lock Framework2D_LockBuffer 13 | #define fb_unlock Framework2D_UnlockBuffer 14 | #define fb_flip Framework2D_Flip 15 | #else 16 | #define fb_lock directfb_lock 17 | #define fb_unlock directfb_unlock 18 | #define fb_flip directfb_flip 19 | #endif 20 | 21 | #ifndef _FRAMEWORK_H 22 | // bah, some copy-pasta 23 | enum FRAMEWORK_BUTTONTYPES 24 | { 25 | FRAMEWORK_BUTTON_DPAD_LEFT = 0, 26 | FRAMEWORK_BUTTON_DPAD_RIGHT, 27 | FRAMEWORK_BUTTON_DPAD_UP, 28 | FRAMEWORK_BUTTON_DPAD_DOWN, 29 | FRAMEWORK_BUTTON_STOP, 30 | FRAMEWORK_BUTTON_PLAY, 31 | FRAMEWORK_BUTTON_FORWARD, 32 | FRAMEWORK_BUTTON_REWIND, 33 | FRAMEWORK_BUTTON_LEFT_SHOULDER, 34 | FRAMEWORK_BUTTON_RIGHT_SHOULDER, 35 | FRAMEWORK_BUTTON_HOME, 36 | FRAMEWORK_BUTTON_VOLUME, 37 | FRAMEWORK_BUTTON_BRIGHTNESS, 38 | FRAMEWORK_BUTTON_ALARM, 39 | FRAMEWORK_BUTTON_POWER, 40 | 41 | FRAMEWORK_BUTTON_COUNT 42 | 43 | }; 44 | #endif 45 | 46 | #define PBTN_LEFT (1 << FRAMEWORK_BUTTON_DPAD_LEFT) 47 | #define PBTN_RIGHT (1 << FRAMEWORK_BUTTON_DPAD_RIGHT) 48 | #define PBTN_UP (1 << FRAMEWORK_BUTTON_DPAD_UP) 49 | #define PBTN_DOWN (1 << FRAMEWORK_BUTTON_DPAD_DOWN) 50 | #define PBTN_STOP (1 << FRAMEWORK_BUTTON_STOP) 51 | #define PBTN_PLAY (1 << FRAMEWORK_BUTTON_PLAY) 52 | #define PBTN_FWD (1 << FRAMEWORK_BUTTON_FORWARD) 53 | #define PBTN_REW (1 << FRAMEWORK_BUTTON_REWIND) 54 | #define PBTN_L (1 << FRAMEWORK_BUTTON_LEFT_SHOULDER) 55 | #define PBTN_R (1 << FRAMEWORK_BUTTON_RIGHT_SHOULDER) 56 | 57 | #define PBTN_HOME (1 << FRAMEWORK_BUTTON_HOME) 58 | #define PBTN_VOLUME (1 << FRAMEWORK_BUTTON_VOLUME) 59 | #define PBTN_BRIGHTNESS (1 << FRAMEWORK_BUTTON_BRIGHTNESS) 60 | #define PBTN_ALARM (1 << FRAMEWORK_BUTTON_ALARM) 61 | #define PBTN_POWER (1 << FRAMEWORK_BUTTON_POWER) 62 | 63 | -------------------------------------------------------------------------------- /platform/common/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 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 | # define LITTLE_ENDIAN 1 45 | # define BYTE_ORDER LITTLE_ENDIAN 46 | #endif 47 | 48 | #ifdef HAVE_ALLOCA_H 49 | # include 50 | #endif 51 | 52 | #ifdef USE_MEMORY_H 53 | # include 54 | #endif 55 | 56 | #ifndef min 57 | # define min(x,y) ((x)>(y)?(y):(x)) 58 | #endif 59 | 60 | #ifndef max 61 | # define max(x,y) ((x)<(y)?(y):(x)) 62 | #endif 63 | 64 | #endif /* _OS_H */ 65 | -------------------------------------------------------------------------------- /platform/libretro/libretro-common/include/retro_common.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 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 | * @internal 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 | -------------------------------------------------------------------------------- /platform/libretro/libretro-common/include/retro_inline.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 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 | /** 29 | * Cross-platform inline specifier. 30 | * 31 | * Expands to something like \c __inline or \c inline, 32 | * depending on the compiler. 33 | */ 34 | #if defined(_WIN32) || defined(__INTEL_COMPILER) 35 | #define INLINE __inline 36 | #elif defined(__STDC_VERSION__) && __STDC_VERSION__>=199901L 37 | #define INLINE inline 38 | #elif defined(__GNUC__) 39 | #define INLINE __inline__ 40 | #else 41 | #define INLINE 42 | #endif 43 | 44 | #endif 45 | #endif 46 | -------------------------------------------------------------------------------- /platform/libretro/libretro-common/formats/png/rpng_internal.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (rpng_internal.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 _RPNG_COMMON_H 24 | #define _RPNG_COMMON_H 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | #ifndef ARRAY_SIZE 31 | #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) 32 | #endif 33 | 34 | static const uint8_t png_magic[8] = { 35 | 0x89, 'P', 'N', 'G', 0x0d, 0x0a, 0x1a, 0x0a, 36 | }; 37 | 38 | struct png_ihdr 39 | { 40 | uint32_t width; 41 | uint32_t height; 42 | uint8_t depth; 43 | uint8_t color_type; 44 | uint8_t compression; 45 | uint8_t filter; 46 | uint8_t interlace; 47 | }; 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /pico/cd/misc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * PicoDrive 3 | * (C) notaz, 2007 4 | * 5 | * This work is licensed under the terms of MAME license. 6 | * See COPYING file in the top-level directory. 7 | */ 8 | 9 | #include "../pico_int.h" 10 | 11 | unsigned char formatted_bram[4*0x10] = 12 | { 13 | #if 0 14 | 0x00, 0xd4, 0x63, 0x00, 0x00, 0x03, 0x03, 0x00, 0x03, 0x03, 0x03, 0x00, 0x03, 0x00, 0x00, 0x03, 15 | 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x53, 0xd2, 0xf5, 0x3a, 0x48, 0x50, 0x35, 0x0f, 16 | 0x47, 0x14, 0xf5, 0x7e, 0x5c, 0xd4, 0xf3, 0x03, 0x00, 0x03, 0x12, 0x00, 0x0a, 0xff, 0xca, 0xa6, 17 | 0xf5, 0x27, 0xed, 0x22, 0x47, 0xfa, 0x22, 0x96, 0x6c, 0xa5, 0x88, 0x14, 0x48, 0x48, 0x0a, 0xbb, 18 | #endif 19 | 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x40, 20 | 0x00, 0x7d, 0x00, 0x7d, 0x00, 0x7d, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 21 | 0x53, 0x45, 0x47, 0x41, 0x5f, 0x43, 0x44, 0x5f, 0x52, 0x4f, 0x4d, 0x00, 0x01, 0x00, 0x00, 0x00, 22 | 0x52, 0x41, 0x4d, 0x5f, 0x43, 0x41, 0x52, 0x54, 0x52, 0x49, 0x44, 0x47, 0x45, 0x5f, 0x5f, 0x5f, 23 | // SEGA_CD_ROM.....RAM_CARTRIDGE___ 24 | }; 25 | 26 | 27 | // offs | 2Mbit | 1Mbit | 28 | // 0 | [ 2M | unused | 29 | // 128K | bit ] | bank0 | 30 | // 256K | unused | bank1 | 31 | 32 | #ifndef _ASM_MISC_C 33 | PICO_INTERNAL_ASM void wram_2M_to_1M(unsigned char *m) 34 | { 35 | unsigned short *m1M_b0, *m1M_b1; 36 | unsigned int i, tmp, *m2M; 37 | 38 | m2M = (unsigned int *) (m + 0x40000); 39 | m1M_b0 = (unsigned short *) m2M; 40 | m1M_b1 = (unsigned short *) (m + 0x60000); 41 | 42 | for (i = 0x40000/4; i; i--) 43 | { 44 | tmp = *(--m2M); 45 | *(--m1M_b0) = tmp; 46 | *(--m1M_b1) = tmp >> 16; 47 | } 48 | } 49 | 50 | PICO_INTERNAL_ASM void wram_1M_to_2M(unsigned char *m) 51 | { 52 | unsigned short *m1M_b0, *m1M_b1; 53 | unsigned int i, tmp, *m2M; 54 | 55 | m2M = (unsigned int *) m; 56 | m1M_b0 = (unsigned short *) (m + 0x20000); 57 | m1M_b1 = (unsigned short *) (m + 0x40000); 58 | 59 | for (i = 0x40000/4; i; i--) 60 | { 61 | tmp = *m1M_b0++ | (*m1M_b1++ << 16); 62 | *m2M++ = tmp; 63 | } 64 | } 65 | #endif 66 | 67 | -------------------------------------------------------------------------------- /pico/cd/misc_arm.s: -------------------------------------------------------------------------------- 1 | @* 2 | @* Memory converters for different modes 3 | @* (C) notaz, 2007-2008 4 | @* 5 | @* This work is licensed under the terms of MAME license. 6 | @* See COPYING file in the top-level directory. 7 | @* 8 | 9 | 10 | @ r10 is tmp, io1 is lsb halfword, io2 is msb 11 | @ | 0 1 | 2 3 | -> | 0 2 | 1 3 | (little endian) 12 | .macro _conv_reg io1 io2 13 | mov r10, \io2, lsl #16 14 | and \io2, \io2, r11, lsl #16 15 | orr \io2, \io2, \io1, lsr #16 16 | and \io1, \io1, r11 17 | orr \io1, \io1, r10 18 | /* 19 | mov \io2, \io2, ror #16 20 | mov r10, \io1, lsl #16 21 | orr r10, r10, \io2, lsr #16 22 | mov \io1, \io1, lsr #16 23 | orr \io1, \io1, \io2, lsl #16 24 | mov \io2, r10, ror #16 25 | */ 26 | .endm 27 | 28 | 29 | .global wram_2M_to_1M 30 | wram_2M_to_1M: 31 | stmfd sp!,{r4-r11,lr} 32 | add r1, r0, #0x60000 @ m1M_b1 33 | add r0, r0, #0x40000 @ m1M_b0 34 | mov r2, r0 @ m2M 35 | 36 | mov r11, #0xff 37 | orr r11, r11, r11, lsl #8 38 | mov r12, #(0x40000/8/4) 39 | 40 | _2Mto1M_loop: 41 | ldmdb r2!,{r3-r9,lr} 42 | _conv_reg r3,r4 43 | _conv_reg r5,r6 44 | _conv_reg r7,r8 45 | _conv_reg r9,lr 46 | subs r12, r12, #1 47 | stmdb r0!,{r3,r5,r7,r9} 48 | stmdb r1!,{r4,r6,r8,lr} 49 | bne _2Mto1M_loop 50 | 51 | ldmfd sp!,{r4-r11,pc} 52 | 53 | 54 | 55 | .global wram_1M_to_2M 56 | wram_1M_to_2M: 57 | stmfd sp!,{r4-r11,lr} 58 | mov r2, r0 @ m2M 59 | add r1, r0, #0x40000 @ m1M_b1 60 | add r0, r0, #0x20000 @ m1M_b0 61 | 62 | mov r11, #0xff 63 | orr r11, r11, r11, lsl #8 64 | mov r12, #(0x40000/8/4) 65 | 66 | _1Mto2M_loop: 67 | ldmia r0!,{r3,r5,r7,r9} 68 | ldmia r1!,{r4,r6,r8,lr} 69 | _conv_reg r3,r4 70 | _conv_reg r5,r6 71 | _conv_reg r7,r8 72 | _conv_reg r9,lr 73 | subs r12, r12, #1 74 | stmia r2!,{r3-r9,lr} 75 | bne _1Mto2M_loop 76 | 77 | ldmfd sp!,{r4-r11,pc} 78 | 79 | @ vim:filetype=armasm 80 | -------------------------------------------------------------------------------- /platform/common/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 | -------------------------------------------------------------------------------- /platform/linux/pprof.h: -------------------------------------------------------------------------------- 1 | #ifndef __PPROF_H__ 2 | #define __PPROF_H__ 3 | 4 | enum pprof_points { 5 | pp_main, 6 | pp_frame, 7 | pp_draw, 8 | pp_sound, 9 | pp_m68k, 10 | pp_s68k, 11 | pp_mem68, 12 | pp_z80, 13 | pp_msh2, 14 | pp_ssh2, 15 | pp_memsh, 16 | pp_dummy, 17 | pp_total_points 18 | }; 19 | 20 | extern struct pp_counters *pp_counters; 21 | extern int *refcounts; 22 | 23 | #ifdef __i386__ 24 | typedef unsigned long long pp_type; 25 | 26 | static __attribute__((always_inline)) inline unsigned int pprof_get_one(void) 27 | { 28 | unsigned long long ret; 29 | __asm__ __volatile__ ("rdtsc" : "=A" (ret)); 30 | return (unsigned int)ret; 31 | } 32 | #define unglitch_timer(x) 33 | 34 | #elif defined(__GP2X__) 35 | typedef unsigned long pp_type; 36 | 37 | #if 0 38 | // XXX: MMSP2 only, timer sometimes seems to return lower vals? 39 | extern volatile unsigned long *gp2x_memregl; 40 | #define pprof_get_one() (unsigned int)gp2x_memregl[0x0a00 >> 2] 41 | #define unglitch_timer(di) \ 42 | if ((signed int)(di) < 0) di = 0 43 | #else 44 | extern unsigned int (*gp2x_get_ticks_us)(void); 45 | #define pprof_get_one() gp2x_get_ticks_us() 46 | #define unglitch_timer(di) \ 47 | if ((signed int)(di) < 0) di = 0 48 | #endif 49 | 50 | #else 51 | #error no timer 52 | #endif 53 | 54 | struct pp_counters 55 | { 56 | pp_type counter[pp_total_points]; 57 | }; 58 | 59 | #define pprof_start(point) { \ 60 | unsigned int pp_start_##point = pprof_get_one(); refcounts[pp_##point]++ 61 | 62 | #define pprof_end(point) \ 63 | { \ 64 | unsigned int di = pprof_get_one() - pp_start_##point; \ 65 | unglitch_timer(di); \ 66 | if (!--refcounts[pp_##point]) pp_counters->counter[pp_##point] += di; \ 67 | } \ 68 | } 69 | 70 | // subtract for recursive stuff 71 | #define pprof_end_sub(point) \ 72 | { \ 73 | unsigned int di = pprof_get_one() - pp_start_##point; \ 74 | unglitch_timer(di); \ 75 | if (--refcounts[pp_##point]) pp_counters->counter[pp_##point] -= di; \ 76 | } \ 77 | } 78 | 79 | extern void pprof_init(void); 80 | extern void pprof_finish(void); 81 | 82 | #endif // __PPROF_H__ 83 | -------------------------------------------------------------------------------- /platform/gp2x/menu.c: -------------------------------------------------------------------------------- 1 | #include "../libpicofe/gp2x/plat_gp2x.h" 2 | 3 | // ------------ gfx options menu ------------ 4 | 5 | 6 | const char *men_scaling_opts[] = { "OFF", "software", "hardware", NULL }; 7 | 8 | #define MENU_OPTIONS_GFX \ 9 | mee_enum ("Horizontal scaling", MA_OPT_SCALING, currentConfig.scaling, men_scaling_opts), \ 10 | mee_enum ("Vertical scaling", MA_OPT_VSCALING, currentConfig.vscaling, men_scaling_opts), \ 11 | mee_onoff ("Tearing Fix", MA_OPT_TEARING_FIX, currentConfig.EmuOpt, EOPT_WIZ_TEAR_FIX), \ 12 | /*mee_onoff ("A_SN's gamma curve", MA_OPT2_A_SN_GAMMA, currentConfig.EmuOpt, EOPT_A_SN_GAMMA),*/ \ 13 | mee_onoff ("Vsync", MA_OPT2_VSYNC, currentConfig.EmuOpt, EOPT_VSYNC), 14 | 15 | #define MENU_OPTIONS_ADV \ 16 | mee_onoff ("Use second CPU for sound", MA_OPT_ARM940_SOUND, PicoIn.opt, POPT_EXT_FM), \ 17 | 18 | 19 | static menu_entry e_menu_adv_options[]; 20 | static menu_entry e_menu_gfx_options[]; 21 | static menu_entry e_menu_sms_options[]; 22 | static menu_entry e_menu_options[]; 23 | static menu_entry e_menu_keyconfig[]; 24 | 25 | void gp2x_menu_init(void) 26 | { 27 | /* disable by default.. */ 28 | me_enable(e_menu_adv_options, MA_OPT_ARM940_SOUND, 0); 29 | me_enable(e_menu_gfx_options, MA_OPT_TEARING_FIX, 0); 30 | me_enable(e_menu_gfx_options, MA_OPT2_GAMMA, 0); 31 | me_enable(e_menu_gfx_options, MA_OPT2_A_SN_GAMMA, 0); 32 | me_enable(e_menu_sms_options, MA_SMSOPT_GHOSTING, 0); 33 | 34 | switch (gp2x_dev_id) { 35 | case GP2X_DEV_GP2X: 36 | me_enable(e_menu_adv_options, MA_OPT_ARM940_SOUND, 1); 37 | me_enable(e_menu_gfx_options, MA_OPT2_GAMMA, 1); 38 | me_enable(e_menu_gfx_options, MA_OPT2_A_SN_GAMMA, 1); 39 | break; 40 | case GP2X_DEV_WIZ: 41 | me_enable(e_menu_gfx_options, MA_OPT_TEARING_FIX, 1); 42 | break; 43 | case GP2X_DEV_CAANOO: 44 | break; 45 | default: 46 | break; 47 | } 48 | 49 | if (gp2x_dev_id != GP2X_DEV_GP2X) 50 | men_scaling_opts[2] = NULL; /* leave only off and sw */ 51 | 52 | if (gp2x_dev_id != GP2X_DEV_CAANOO) 53 | me_enable(e_menu_keyconfig, MA_CTRL_DEADZONE, 0); 54 | } 55 | 56 | -------------------------------------------------------------------------------- /pico/sound/resampler.h: -------------------------------------------------------------------------------- 1 | /* Configurable fixed point resampling SINC filter for mono and stereo audio. 2 | * 3 | * (C) 2022 irixxxx 4 | * 5 | * This work is licensed under the terms of any of these licenses 6 | * (at your option): 7 | * - GNU GPL, version 2 or later. 8 | * - MAME license. 9 | * See COPYING file in the top-level directory. 10 | */ 11 | 12 | struct resampler { 13 | int stereo; // mono or stereo? 14 | int taps; // taps to compute per output sample 15 | int interpolation; // upsampling factor (numerator) 16 | int decimation; // downsampling factor (denominator) 17 | int ratio_int; // floor(decimation/interpolation) 18 | u32 interp_inv; // Q16, 1.0/interpolation 19 | s16 *filter; // filter taps 20 | s32 *buffer; // filter history and input buffer (w/o zero stuffing) 21 | int buffer_sz; // buffer size in frames 22 | int buffer_idx; // buffer offset 23 | int phase; // filter phase for last output sample 24 | }; 25 | typedef struct resampler resampler_t; 26 | 27 | 28 | /* Release a resampler */ 29 | void resampler_free(resampler_t *r); 30 | /* Create a resampler with upsampling factor :interpolation and downsampling 31 | * factor :decimation, Kaiser windowed SINC polyphase FIR with bank size :taps. 32 | * The created filter has a size of :taps*:interpolation for upsampling and 33 | * :taps*:decimation for downsampling. :taps is limiting the cost per sample and 34 | * should be big enough to avoid inaccuracy (>= 8, higher is more accurate). 35 | * :cutoff is in [0..1] with 1 representing the Nyquist rate after decimation. 36 | * :beta is the Kaiser window beta. 37 | * :max_input is the maximum length in a resampler_update call */ 38 | resampler_t *resampler_new(unsigned taps, unsigned interpolation, unsigned decimation, 39 | double cutoff, double beta, unsigned max_input, int stereo); 40 | /* Obtain :length resampled audio frames in :buffer. Use :get_samples to obtain 41 | * the needed amount of input samples */ 42 | void resampler_update(resampler_t *r, s32 *buffer, int length, 43 | void (*generate_samples)(s32 *buffer, int length, int stereo)); 44 | 45 | -------------------------------------------------------------------------------- /platform/linux/menu.c: -------------------------------------------------------------------------------- 1 | // ------------ gfx options menu ------------ 2 | 3 | #include "../libpicofe/plat_sdl.h" 4 | 5 | static const char *men_scaling_opts[] = { "OFF", "software", "hardware", NULL }; 6 | static const char *men_filter_opts[] = { "nearest", "smoother", "bilinear 1", "bilinear 2", NULL }; 7 | 8 | static const char h_scale[] = "Hardware scaling might not work on some devices"; 9 | static const char h_stype[] = "Scaler algorithm for software scaling"; 10 | 11 | static const char *mgn_windowsize(int id, int *offs) 12 | { 13 | int scale = g_menuscreen_w / 320; 14 | 15 | if ((g_menuscreen_w == scale*320 && g_menuscreen_h == scale*240) || 16 | plat_sdl_is_fullscreen()) 17 | sprintf(static_buff, "%dx%d", g_menuscreen_w, g_menuscreen_h); 18 | else 19 | sprintf(static_buff, "custom"); 20 | return static_buff; 21 | } 22 | 23 | static int mh_windowsize(int id, int keys) 24 | { 25 | if (keys & (PBTN_LEFT|PBTN_RIGHT)) { 26 | if (!plat_target.vout_fullscreen) { 27 | int scale = g_menuscreen_w / 320; 28 | if (keys & PBTN_RIGHT) scale++; 29 | if (keys & PBTN_LEFT ) scale--; 30 | if (scale <= 0) scale = 1; 31 | if (scale > 20) scale = 20; 32 | plat_set_window(scale*320, scale*240); 33 | } 34 | return 0; 35 | } 36 | return 1; 37 | } 38 | 39 | #define MENU_OPTIONS_GFX \ 40 | mee_cust_s_h ("Window size", MA_OPT_VOUT_SIZE, 0,mh_windowsize, mgn_windowsize, NULL), \ 41 | mee_onoff ("Fullscreen mode", MA_OPT_VOUT_FULL, plat_target.vout_fullscreen, 1), \ 42 | mee_enum_h ("Horizontal scaling", MA_OPT_SCALING, currentConfig.scaling, men_scaling_opts, h_scale), \ 43 | mee_enum_h ("Vertical scaling", MA_OPT_VSCALING, currentConfig.vscaling, men_scaling_opts, h_scale), \ 44 | mee_enum_h ("Scaler type", MA_OPT3_FILTERING, currentConfig.filter, men_filter_opts, h_stype), \ 45 | 46 | #define MENU_OPTIONS_ADV 47 | 48 | static menu_entry e_menu_keyconfig[], e_menu_gfx_options[]; 49 | 50 | void linux_menu_init(void) 51 | { 52 | me_enable(e_menu_gfx_options, MA_OPT_VOUT_SIZE, plat_has_wm()); 53 | me_enable(e_menu_gfx_options, MA_OPT_VOUT_FULL, plat_has_wm()); 54 | me_enable(e_menu_keyconfig, MA_CTRL_DEADZONE, 0); 55 | } 56 | 57 | -------------------------------------------------------------------------------- /platform/common/mp3_drmp3.c: -------------------------------------------------------------------------------- 1 | /* 2 | * MP3 decoding using dr_mp3 3 | * (C) irixxxx, 2020 4 | * 5 | * This work is licensed under the terms of MAME license. 6 | * See COPYING file in the top-level directory. 7 | */ 8 | 9 | #include 10 | 11 | #include 12 | 13 | #ifdef USE_LIBRETRO_VFS 14 | // Ugh, drmp3 tries to use wfopen on windows, which breaks libretro VFS... 15 | #define __acrt_iob_func __acrt_iob_func2 16 | #define _wfopen_s(p,m) NULL 17 | #define _wfopen(p,m) NULL 18 | #endif 19 | #ifdef __GP2X__ 20 | #define mp3dec_decode _mp3dec_decode 21 | #define mp3dec_start _mp3dec_start 22 | #endif 23 | #define DR_MP3_IMPLEMENTATION 24 | #include "dr_libs/dr_mp3.h" 25 | #include "mp3.h" 26 | 27 | static drmp3dec mp3dec; 28 | static unsigned char mp3_input_buffer[2 * 1024]; 29 | 30 | int mp3dec_start(FILE *f, int fpos_start) 31 | { 32 | drmp3dec_init(&mp3dec); 33 | return 0; 34 | } 35 | 36 | int mp3dec_decode(FILE *f, int *file_pos, int file_len) 37 | { 38 | drmp3dec_frame_info info; 39 | unsigned char *readPtr; 40 | int bytesLeft; 41 | int offset; // mp3 frame offset from readPtr 42 | int len; 43 | int retry = 3; 44 | 45 | do 46 | { 47 | if (*file_pos >= file_len) 48 | return 1; /* EOF, nothing to do */ 49 | 50 | fseek(f, *file_pos, SEEK_SET); 51 | bytesLeft = fread(mp3_input_buffer, 1, sizeof(mp3_input_buffer), f); 52 | 53 | offset = mp3_find_sync_word(mp3_input_buffer, bytesLeft); 54 | if (offset < 0) { 55 | lprintf("find_sync_word (%i/%i) err %i\n", 56 | *file_pos, file_len, offset); 57 | *file_pos = file_len; 58 | return 1; // EOF 59 | } 60 | *file_pos += offset; 61 | readPtr = mp3_input_buffer + offset; 62 | bytesLeft -= offset; 63 | 64 | len = drmp3dec_decode_frame(&mp3dec, readPtr, bytesLeft, cdda_out_buffer, &info); 65 | if (len > 0) // retrieved decoded data 66 | *file_pos += info.frame_bytes; 67 | else if (info.frame_bytes > 0) // no output but input consumed? 68 | *file_pos += 1; // try to skip frame 69 | else if (offset == 0) // bad frame? 70 | *file_pos += 1; // try resyncing 71 | // else // truncated frame, try more data 72 | } 73 | while (len <= 0 && --retry > 0); 74 | 75 | return len <= 0; 76 | } 77 | -------------------------------------------------------------------------------- /platform/gp2x/code940/uClibc/memset.s: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 1998 Free Software Foundation, Inc. 2 | This file is part of the GNU C Library. 3 | Contributed by Philip Blundell 4 | 5 | The GNU C Library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | The GNU C Library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with the GNU C Library; if not, write to the Free 17 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 18 | 02111-1307 USA. */ 19 | 20 | @ #include 21 | 22 | .text 23 | .global memset 24 | .type memset,%function 25 | .align 2 26 | 27 | memset: 28 | mov a4, a1 29 | cmp a3, $8 @ at least 8 bytes to do? 30 | blt 2f 31 | orr a2, a2, a2, lsl $8 32 | orr a2, a2, a2, lsl $16 33 | 1: 34 | tst a4, $3 @ aligned yet? 35 | strneb a2, [a4], $1 36 | subne a3, a3, $1 37 | bne 1b 38 | mov ip, a2 39 | 1: 40 | cmp a3, $8 @ 8 bytes still to do? 41 | blt 2f 42 | stmia a4!, {a2, ip} 43 | sub a3, a3, $8 44 | cmp a3, $8 @ 8 bytes still to do? 45 | blt 2f 46 | stmia a4!, {a2, ip} 47 | sub a3, a3, $8 48 | cmp a3, $8 @ 8 bytes still to do? 49 | blt 2f 50 | stmia a4!, {a2, ip} 51 | sub a3, a3, $8 52 | cmp a3, $8 @ 8 bytes still to do? 53 | stmgeia a4!, {a2, ip} 54 | subge a3, a3, $8 55 | bge 1b 56 | 2: 57 | movs a3, a3 @ anything left? 58 | moveq pc, lr @ nope 59 | rsb a3, a3, $7 60 | add pc, pc, a3, lsl $2 61 | mov r0, r0 62 | strb a2, [a4], $1 63 | strb a2, [a4], $1 64 | strb a2, [a4], $1 65 | strb a2, [a4], $1 66 | strb a2, [a4], $1 67 | strb a2, [a4], $1 68 | strb a2, [a4], $1 69 | mov pc, lr 70 | 71 | .size memset,.-memset; 72 | 73 | -------------------------------------------------------------------------------- /pico/arm_features.h: -------------------------------------------------------------------------------- 1 | #ifndef __ARM_FEATURES_H__ 2 | #define __ARM_FEATURES_H__ 3 | 4 | #if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \ 5 | || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) \ 6 | || defined(__ARM_ARCH_7EM__) 7 | 8 | #define HAVE_ARMV7 9 | #define HAVE_ARMV6 10 | #define HAVE_ARMV5 11 | 12 | #elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \ 13 | || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) \ 14 | || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) 15 | 16 | #define HAVE_ARMV6 17 | #define HAVE_ARMV5 18 | 19 | #elif defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5E__) \ 20 | || defined(__ARM_ARCH_5T__) || defined(__ARM_ARCH_5TE__) || defined(__ARM_ARCH_5TEJ__) 21 | 22 | #define HAVE_ARMV5 23 | 24 | #endif 25 | 26 | /* no need for HAVE_NEON - GCC defines __ARM_NEON__ consistently */ 27 | 28 | /* global function/external symbol */ 29 | #ifndef __MACH__ 30 | #define ESYM(name) name 31 | 32 | #define FUNCTION(name) \ 33 | .globl name; \ 34 | .type name, %function; \ 35 | name 36 | 37 | #define EXTRA_UNSAVED_REGS 38 | 39 | #else 40 | #define ESYM(name) _##name 41 | 42 | #define FUNCTION(name) \ 43 | .globl ESYM(name); \ 44 | name: \ 45 | ESYM(name) 46 | 47 | // r7 is preserved, but add it for EABI alignment.. 48 | #define EXTRA_UNSAVED_REGS r7, r9, 49 | 50 | #endif 51 | 52 | // indexed branch (XB) via branch table (BT) 53 | #ifdef __PIC__ 54 | #define PIC_XB(c,r,s) add##c pc, r, s 55 | #define PIC_BT(a) b a 56 | #else 57 | #define PIC_XB(c,r,s) ldr##c pc, [pc, r, s] 58 | #define PIC_BT(a) .word a 59 | #endif 60 | 61 | // load data address (LDR) either via literal pool or via GOT 62 | #ifdef __PIC__ 63 | // can't use pool loads since ldr= only allows a symbol or a constant expr :-( 64 | #define PIC_LDR_INIT() \ 65 | .macro pic_ldr r t a; \ 66 | ldr \r, [pc, $.LD\@-.-8]; \ 67 | ldr \t, [pc, $.LD\@-.-4]; \ 68 | .LP\@:add \r, pc; \ 69 | ldr \r, [\r, \t]; \ 70 | add pc, $4; \ 71 | .LD\@:.word _GLOBAL_OFFSET_TABLE_-.LP\@-8; \ 72 | .word \a(GOT); \ 73 | .endm; 74 | #define PIC_LDR(r,t,a) pic_ldr r, t, a 75 | #else 76 | #define PIC_LDR_INIT() 77 | #define PIC_LDR(r,t,a) ldr r, =a 78 | #endif 79 | 80 | #endif /* __ARM_FEATURES_H__ */ 81 | -------------------------------------------------------------------------------- /platform/gp2x/code940/uClibc/s_floor.c: -------------------------------------------------------------------------------- 1 | /* @(#)s_floor.c 5.1 93/09/24 */ 2 | /* 3 | * ==================================================== 4 | * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. 5 | * 6 | * Developed at SunPro, a Sun Microsystems, Inc. business. 7 | * Permission to use, copy, modify, and distribute this 8 | * software is freely granted, provided that this notice 9 | * is preserved. 10 | * ==================================================== 11 | */ 12 | 13 | #if defined(LIBM_SCCS) && !defined(lint) 14 | static char rcsid[] = "$NetBSD: s_floor.c,v 1.8 1995/05/10 20:47:20 jtc Exp $"; 15 | #endif 16 | 17 | /* 18 | * floor(x) 19 | * Return x rounded toward -inf to integral value 20 | * Method: 21 | * Bit twiddling. 22 | * Exception: 23 | * Inexact flag raised if x not equal to floor(x). 24 | */ 25 | 26 | #include "math.h" 27 | #include "math_private.h" 28 | 29 | #ifdef __STDC__ 30 | static const double huge = 1.0e300; 31 | #else 32 | static double huge = 1.0e300; 33 | #endif 34 | 35 | #ifdef __STDC__ 36 | double floor(double x) 37 | #else 38 | double floor(x) 39 | double x; 40 | #endif 41 | { 42 | int32_t i0,i1,j0; 43 | u_int32_t i,j; 44 | EXTRACT_WORDS(i0,i1,x); 45 | j0 = ((i0>>20)&0x7ff)-0x3ff; 46 | if(j0<20) { 47 | if(j0<0) { /* raise inexact if x != 0 */ 48 | if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */ 49 | if(i0>=0) {i0=i1=0;} 50 | else if(((i0&0x7fffffff)|i1)!=0) 51 | { i0=0xbff00000;i1=0;} 52 | } 53 | } else { 54 | i = (0x000fffff)>>j0; 55 | if(((i0&i)|i1)==0) return x; /* x is integral */ 56 | if(huge+x>0.0) { /* raise inexact flag */ 57 | if(i0<0) i0 += (0x00100000)>>j0; 58 | i0 &= (~i); i1=0; 59 | } 60 | } 61 | } else if (j0>51) { 62 | if(j0==0x400) return x+x; /* inf or NaN */ 63 | else return x; /* x is integral */ 64 | } else { 65 | i = ((u_int32_t)(0xffffffff))>>(j0-20); 66 | if((i1&i)==0) return x; /* x is integral */ 67 | if(huge+x>0.0) { /* raise inexact flag */ 68 | if(i0<0) { 69 | if(j0==20) i0+=1; 70 | else { 71 | j = i1+(1<<(52-j0)); 72 | if(j>20; /* extract exponent */ 47 | if (k==0) { /* 0 or subnormal x */ 48 | if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */ 49 | x *= two54; 50 | GET_HIGH_WORD(hx,x); 51 | k = ((hx&0x7ff00000)>>20) - 54; 52 | if (n< -50000) return tiny*x; /*underflow*/ 53 | } 54 | if (k==0x7ff) return x+x; /* NaN or Inf */ 55 | k = k+n; 56 | if (k > 0x7fe) return huge*copysign(huge,x); /* overflow */ 57 | if (k > 0) /* normal result */ 58 | {SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20)); return x;} 59 | if (k <= -54) { 60 | if (n > 50000) /* in case integer overflow in n+k */ 61 | return huge*copysign(huge,x); /*overflow*/ 62 | else return tiny*copysign(tiny,x); /*underflow*/ 63 | } 64 | k += 54; /* subnormal result */ 65 | SET_HIGH_WORD(x,(hx&0x800fffff)|(k<<20)); 66 | return x*twom54; 67 | } 68 | -------------------------------------------------------------------------------- /platform/miyoo/pkg.cfg: -------------------------------------------------------------------------------- 1 | # NOTES: 2 | ## All variable values should enclosed within double quotes: "" 3 | ## CONFIGURATION FILE for `gm2xpkg` script version: 4 | PKGVER="0.9" 5 | 6 | # EXEC commands (set to "1" anyone for desired outcome), you can instead use [OPTIONS] of `gm2xpkg`: 7 | PACKAGE="" 8 | ZIP="" 9 | IPK="" 10 | CLEAN="" 11 | 12 | # ENV VAR. 13 | ## Specific (mandatory to provide!) 14 | TARGET="picodrive" # replace with binary name 15 | VERSION="$(cut -d'"' -f2 platform/common/version.h)" # replace with correct release version if exist 16 | test "$(git describe --tags --exact-match HEAD 2>/dev/null)" == "" && VERSION="${VERSION}-$(git rev-parse --short HEAD || echo unknown)" 17 | ## Generic - common to all apps (better to not modify) 18 | HOMEPATH="/mnt" 19 | RELEASEDIR="" 20 | ASSETSDIR=".od_data" 21 | OPKG_ASSETSDIR="" 22 | LINK="" # full name of gm2x link, modify if exec binary name may be different from target name - place in CWD (warning: it may be removed with CLEAN=1) 23 | ALIASES="" # full name (with ext) of *.txt file with new names for selector e.g. old_title=new_title - place in CWD 24 | MANUAL="" # full name (with ext) of *.man.txt file with usage description of target app - place in CWD 25 | 26 | ## Link entries (better modify if no .lnk file provided) 27 | TITLE="PicoDrive" 28 | DESCRI="MegaDrive/MegaCD/32X emulator" 29 | SELDIR="/mnt/roms/SMD" 30 | DESTDIR="emus" # default=apps 31 | SECTION="emulators" # default=applications 32 | 33 | ## Custom entries (if needed then modify) 34 | TARGET_DIR="" # the directory /$HOMEPATH/$DESTDIR/TARGET_DIR of executable binary if not provided the TARGET_DIR=$TARGET 35 | DOCS=("COPYING" "AUTHORS") # array of extra text files e.g. =("LICENSE" "CHANGELOG" "CONTRIBUTORS") which will be copied & converted to *.txt files for ease of use by frontend 36 | 37 | ## IPK control entries (if needed then modify) 38 | PRIORITY="" 39 | MAINTAINER="irixxxx" 40 | CONFFILES="" 41 | ARCH="" # default=arm - do not modify for ARM chips 42 | # CONTROL= # automated output of *.ipk control config file 43 | DEPENDS="" # list of dependency packages e.g. ="sdl, libpng" or ="sdl (>= 2.9.2), sdl_mixer (= ed76d39cda0735d26c14a3e4f4da996e420f6478)" provide only for shared libs build, otherwise ignored 44 | SOURCE="https://github.com/irixxxx/picodrive" 45 | LICENSE="Custom" 46 | -------------------------------------------------------------------------------- /zlib/uncompr.c: -------------------------------------------------------------------------------- 1 | /* uncompr.c -- decompress a memory buffer 2 | * Copyright (C) 1995-2003 Jean-loup Gailly. 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* @(#) $Id$ */ 7 | 8 | #define ZLIB_INTERNAL 9 | #include "zlib.h" 10 | 11 | /* =========================================================================== 12 | Decompresses the source buffer into the destination buffer. sourceLen is 13 | the byte length of the source buffer. Upon entry, destLen is the total 14 | size of the destination buffer, which must be large enough to hold the 15 | entire uncompressed data. (The size of the uncompressed data must have 16 | been saved previously by the compressor and transmitted to the decompressor 17 | by some mechanism outside the scope of this compression library.) 18 | Upon exit, destLen is the actual size of the compressed buffer. 19 | This function can be used to decompress a whole file at once if the 20 | input file is mmap'ed. 21 | 22 | uncompress returns Z_OK if success, Z_MEM_ERROR if there was not 23 | enough memory, Z_BUF_ERROR if there was not enough room in the output 24 | buffer, or Z_DATA_ERROR if the input data was corrupted. 25 | */ 26 | int ZEXPORT uncompress (dest, destLen, source, sourceLen) 27 | Bytef *dest; 28 | uLongf *destLen; 29 | const Bytef *source; 30 | uLong sourceLen; 31 | { 32 | z_stream stream; 33 | int err; 34 | 35 | stream.next_in = (Bytef*)source; 36 | stream.avail_in = (uInt)sourceLen; 37 | /* Check for source > 64K on 16-bit machine: */ 38 | if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; 39 | 40 | stream.next_out = dest; 41 | stream.avail_out = (uInt)*destLen; 42 | if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; 43 | 44 | stream.zalloc = (alloc_func)0; 45 | stream.zfree = (free_func)0; 46 | 47 | err = inflateInit(&stream); 48 | if (err != Z_OK) return err; 49 | 50 | err = inflate(&stream, Z_FINISH); 51 | if (err != Z_STREAM_END) { 52 | inflateEnd(&stream); 53 | if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0)) 54 | return Z_DATA_ERROR; 55 | return err; 56 | } 57 | *destLen = stream.total_out; 58 | 59 | err = inflateEnd(&stream); 60 | return err; 61 | } 62 | -------------------------------------------------------------------------------- /platform/libretro/libretro-common/compat/compat_strl.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 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 | -------------------------------------------------------------------------------- /pico/state.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "pico_types.h" 4 | 5 | typedef size_t (arearw)(void *p, size_t _size, size_t _n, void *file); 6 | typedef size_t (areaeof)(void *file); 7 | typedef int (areaseek)(void *file, long offset, int whence); 8 | typedef int (areaclose)(void *file); 9 | 10 | int PicoStateFP(void *afile, int is_save, 11 | arearw *read, arearw *write, areaeof *eof, areaseek *seek); 12 | 13 | static inline void save_u8_(u8 *buf, size_t *b, u32 u) 14 | { 15 | assert(!(u & ~0xff)); 16 | buf[(*b)++] = u; 17 | } 18 | 19 | static inline void save_s8_(u8 *buf, size_t *b, s32 s) 20 | { 21 | s32 s_sext = (s32)((u32)s << 24) >> 24; 22 | assert(s == s_sext); (void)s_sext; 23 | buf[(*b)++] = s; 24 | } 25 | 26 | static inline void save_u16(u8 *buf, size_t *b, u32 u) 27 | { 28 | assert(!(u & ~0xffff)); 29 | buf[(*b)++] = u; 30 | buf[(*b)++] = u >> 8; 31 | } 32 | 33 | static inline void save_s16(u8 *buf, size_t *b, s32 s) 34 | { 35 | s32 s_sext = (s32)((u32)s << 16) >> 16; 36 | assert(s == s_sext); (void)s_sext; 37 | buf[(*b)++] = s; 38 | buf[(*b)++] = s >> 8; 39 | } 40 | 41 | static inline void save_u32(u8 *buf, size_t *b, u32 u) 42 | { 43 | buf[(*b)++] = u; 44 | buf[(*b)++] = u >> 8; 45 | buf[(*b)++] = u >> 16; 46 | buf[(*b)++] = u >> 24; 47 | } 48 | 49 | static inline void save_s32(u8 *buf, size_t *b, s32 s) 50 | { 51 | buf[(*b)++] = s; 52 | buf[(*b)++] = s >> 8; 53 | buf[(*b)++] = s >> 16; 54 | buf[(*b)++] = s >> 24; 55 | } 56 | 57 | static inline u8 load_u8_(const u8 *buf, size_t *b) 58 | { 59 | return buf[(*b)++]; 60 | } 61 | 62 | static inline s8 load_s8_(const u8 *buf, size_t *b) 63 | { 64 | return buf[(*b)++]; 65 | } 66 | 67 | static inline u16 load_u16(const u8 *buf, size_t *b) 68 | { 69 | u16 r = (buf[*b + 1] << 8) | buf[*b]; 70 | (*b) += 2; 71 | return r; 72 | } 73 | 74 | static inline s16 load_s16(const u8 *buf, size_t *b) 75 | { 76 | s16 r = (buf[*b + 1] << 8) | buf[*b]; 77 | (*b) += 2; 78 | return r; 79 | } 80 | 81 | static inline u32 load_u32(const u8 *buf, size_t *b) 82 | { 83 | u32 r = (buf[*b + 3] << 24) | (buf[*b + 2] << 16) | (buf[*b + 1] << 8) | buf[*b]; 84 | (*b) += 4; 85 | return r; 86 | } 87 | 88 | static inline s32 load_s32(const u8 *buf, size_t *b) 89 | { 90 | s32 r = (buf[*b + 3] << 24) | (buf[*b + 2] << 16) | (buf[*b + 1] << 8) | buf[*b]; 91 | (*b) += 4; 92 | return r; 93 | } 94 | -------------------------------------------------------------------------------- /platform/libretro/3ds/3ds_utils.c: -------------------------------------------------------------------------------- 1 | 2 | #include "3ds_utils.h" 3 | 4 | #define GET_VERSION_MAJOR(version) ((version) >>24) 5 | 6 | typedef int (*ctr_callback_type)(void); 7 | 8 | int srvGetServiceHandle(unsigned int* out, const char* name); 9 | int svcCloseHandle(unsigned int handle); 10 | int svcBackdoor(ctr_callback_type); 11 | int32_t svcGetSystemInfo(int64_t* out, uint32_t type, int32_t param); 12 | void ctr_clear_cache(void); 13 | 14 | static int has_rosalina; 15 | 16 | void check_rosalina(void) { 17 | int64_t version; 18 | uint32_t major; 19 | 20 | has_rosalina = 0; 21 | 22 | if (!svcGetSystemInfo(&version, 0x10000, 0)) { 23 | major = GET_VERSION_MAJOR(version); 24 | 25 | if (major >= 8) 26 | has_rosalina = 1; 27 | } 28 | } 29 | 30 | static void ctr_enable_all_svc_kernel(void) 31 | { 32 | __asm__ volatile("cpsid aif"); 33 | 34 | unsigned int* svc_access_control = *(*(unsigned int***)0xFFFF9000 + 0x22) - 0x6; 35 | 36 | svc_access_control[0]=0xFFFFFFFE; 37 | svc_access_control[1]=0xFFFFFFFF; 38 | svc_access_control[2]=0xFFFFFFFF; 39 | svc_access_control[3]=0x3FFFFFFF; 40 | } 41 | 42 | static void ctr_enable_all_svc(void) 43 | { 44 | svcBackdoor((ctr_callback_type)ctr_enable_all_svc_kernel); 45 | } 46 | 47 | static void ctr_clean_invalidate_kernel(void) 48 | { 49 | __asm__ volatile( 50 | "mrs r1, cpsr\n" 51 | "cpsid aif\n" // disable interrupts 52 | "mov r0, #0\n" 53 | "mcr p15, 0, r0, c7, c10, 0\n" // clean dcache 54 | "mcr p15, 0, r0, c7, c10, 4\n" // DSB 55 | "mcr p15, 0, r0, c7, c5, 0\n" // invalidate icache+BTAC 56 | "msr cpsr_cx, r1\n" // restore interrupts 57 | ::: "r0", "r1"); 58 | } 59 | 60 | void ctr_flush_invalidate_cache(void) 61 | { 62 | if (has_rosalina) { 63 | ctr_clear_cache(); 64 | } else { 65 | // __asm__ volatile("svc 0x2E\n\t"); 66 | // __asm__ volatile("svc 0x4B\n\t"); 67 | svcBackdoor((ctr_callback_type)ctr_clean_invalidate_kernel); 68 | } 69 | } 70 | 71 | int ctr_svchack_init(void) 72 | { 73 | extern unsigned int __ctr_svchax; 74 | extern unsigned int __service_ptr; 75 | 76 | if(__ctr_svchax) 77 | return 1; /* All services have already been enabled */ 78 | 79 | if(__service_ptr) 80 | return 0; 81 | 82 | /* CFW */ 83 | ctr_enable_all_svc(); 84 | return 1; 85 | } 86 | 87 | -------------------------------------------------------------------------------- /platform/libretro/libretro-common/compat/compat_strcasestr.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (compat_strcasestr.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 | 25 | #include 26 | 27 | /* Pretty much strncasecmp. */ 28 | static int casencmp(const char *a, const char *b, size_t n) 29 | { 30 | size_t i; 31 | 32 | for (i = 0; i < n; i++) 33 | { 34 | int a_lower = tolower(a[i]); 35 | int b_lower = tolower(b[i]); 36 | if (a_lower != b_lower) 37 | return a_lower - b_lower; 38 | } 39 | 40 | return 0; 41 | } 42 | 43 | char *strcasestr_retro__(const char *haystack, const char *needle) 44 | { 45 | size_t i, search_off; 46 | size_t hay_len = strlen(haystack); 47 | size_t needle_len = strlen(needle); 48 | 49 | if (needle_len > hay_len) 50 | return NULL; 51 | 52 | search_off = hay_len - needle_len; 53 | for (i = 0; i <= search_off; i++) 54 | if (!casencmp(haystack + i, needle, needle_len)) 55 | return (char*)haystack + i; 56 | 57 | return NULL; 58 | } 59 | -------------------------------------------------------------------------------- /platform/libretro/libretro-common/include/compat/strcasestr.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 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 | /** 43 | * Portable reimplementation of \c strcasestr(3). 44 | * If the original function is available 45 | * (as determined by the presence of \c HAVE_STRCASESTR), 46 | * it will be used instead. 47 | * 48 | * @see https://man7.org/linux/man-pages/man3/strstr.3.html 49 | */ 50 | char *strcasestr(const char *haystack, const char *needle); 51 | 52 | RETRO_END_DECLS 53 | 54 | #endif 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /platform/libretro/libretro-common/include/memmap.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 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(PSP) || defined(PS2) || defined(GEKKO) || defined(VITA) || defined(_XBOX) || defined(_3DS) || defined(WIIU) || defined(SWITCH) || defined(HAVE_LIBNX) || defined(__PS3__) || defined(__PSL1GHT__) || defined(__EMSCRIPTEN__) 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 | -------------------------------------------------------------------------------- /tools/gcda.c: -------------------------------------------------------------------------------- 1 | #include 2 | //#include 3 | #include 4 | #include 5 | 6 | 7 | static int search_gcda(const char *str, int len) 8 | { 9 | int i; 10 | for (i = 0; i < len - 6; i++) 11 | if (str[i] == '.' && str[i+1] == 'g' && str[i+2] == 'c' && 12 | str[i+3] == 'd' && str[i+4] == 'a' && str[i+5] == 0) 13 | return i; 14 | return -1; 15 | } 16 | 17 | static int is_good_char(char c) 18 | { 19 | return c >= ' ' && c < 0x7f; 20 | } 21 | 22 | static int is_good_path(char *path) 23 | { 24 | int len = strlen(path); 25 | 26 | path[len-2] = 'n'; 27 | path[len-1] = 'o'; 28 | 29 | FILE *f = fopen(path, "rb"); 30 | 31 | path[len-2] = 'd'; 32 | path[len-1] = 'a'; 33 | 34 | if (f) { 35 | fclose(f); 36 | return 1; 37 | } 38 | printf("not good path: %s\n", path); 39 | return 0; 40 | } 41 | 42 | int main(int argc, char *argv[]) 43 | { 44 | char buff[1024], *p; 45 | char cwd[4096]; 46 | FILE *f; 47 | int l, pos, pos1, old_len, cwd_len; 48 | 49 | if (argc != 2) return 1; 50 | 51 | getcwd(cwd, sizeof(cwd)); 52 | cwd_len = strlen(cwd); 53 | if (cwd[cwd_len-1] != '/') { 54 | cwd[cwd_len++] = '/'; 55 | cwd[cwd_len] = 0; 56 | } 57 | 58 | f = fopen(argv[1], "rb+"); 59 | if (f == NULL) return 2; 60 | 61 | while (1) 62 | { 63 | readnext: 64 | l = fread(buff, 1, sizeof(buff), f); 65 | if (l <= 16) break; 66 | 67 | pos = 0; 68 | while (pos < l) 69 | { 70 | pos1 = search_gcda(buff + pos, l - pos); 71 | if (pos1 < 0) { 72 | fseek(f, -6, SEEK_CUR); 73 | goto readnext; 74 | } 75 | pos += pos1; 76 | 77 | while (pos > 0 && is_good_char(buff[pos-1])) pos--; 78 | 79 | if (pos == 0) { 80 | fseek(f, -(sizeof(buff) + 16), SEEK_CUR); 81 | goto readnext; 82 | } 83 | 84 | // paths must start with / 85 | while (pos < l && buff[pos] != '/') pos++; 86 | p = buff + pos; 87 | old_len = strlen(p); 88 | 89 | if (!is_good_path(p)) { 90 | pos += old_len; 91 | continue; 92 | } 93 | 94 | if (strncmp(p, cwd, cwd_len) != 0) { 95 | printf("can't handle: %s\n", p); 96 | pos += old_len; 97 | continue; 98 | } 99 | 100 | memmove(p, p + cwd_len, old_len - cwd_len + 1); 101 | fseek(f, -(sizeof(buff) - pos), SEEK_CUR); 102 | fwrite(p, 1, old_len, f); 103 | goto readnext; 104 | } 105 | } 106 | 107 | fclose(f); 108 | 109 | return 0; 110 | } 111 | 112 | -------------------------------------------------------------------------------- /platform/common/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]={window_p[0],window_p[1]}; 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 | for(i=0;i=0x7ff00000) return x-x; 70 | 71 | /* argument reduction needed */ 72 | else { 73 | n = __ieee754_rem_pio2(x,y); 74 | switch(n&3) { 75 | case 0: return __kernel_sin(y[0],y[1],1); 76 | case 1: return __kernel_cos(y[0],y[1]); 77 | case 2: return -__kernel_sin(y[0],y[1],1); 78 | default: 79 | return -__kernel_cos(y[0],y[1]); 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /pico/carthw/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(int *size); 44 | extern void eeprom_spi_write(unsigned char data); 45 | extern unsigned int eeprom_spi_read(unsigned int address); 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /platform/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 | /** 51 | * Portable reimplementation of \c getifaddrs(). 52 | * The original function will be used if it's available. 53 | * 54 | * @see https://man7.org/linux/man-pages/man3/getifaddrs.3.html 55 | */ 56 | extern int getifaddrs(struct ifaddrs **ifap); 57 | 58 | /** 59 | * Portable reimplementation of \c freeifaddrs(). 60 | * The original function will be used if it's available. 61 | * 62 | * @see https://man7.org/linux/man-pages/man3/getifaddrs.3.html 63 | */ 64 | extern void freeifaddrs(struct ifaddrs *ifa); 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | notaz 2 | core, 32X emulation, CD code, ARM asm renderers, dynamic recompilers, 3 | Pandora, GPH device, PSP, Gizmondo ports, CPU core hacks 4 | lots of additional coding (see changeLog). 5 | Homepage: http://notaz.gp2x.de/ 6 | 7 | irixxxx 8 | improvements to dynamic recompilers, 32X emulation, ARM asm, sound, VDP, 9 | platforms (GPH, PSP, generic linux), added SG-1000 and Game Gear support, 10 | fixed a lot of bugs (and probably added more new bugs), cleaned up stuff, 11 | probably more that I've already forgotten. 12 | 13 | fDave 14 | project starter 15 | Cyclone 68000 core and PicoDrive core itself 16 | 17 | Chui 18 | FAME/C 68k interpreter core 19 | (based on C68K by Stephane Dallongeville) 20 | 21 | Stephane Dallongeville (written), NJ (optimized) 22 | CZ80 Z80 interpreter core 23 | 24 | Reesy & FluBBa 25 | DrZ80, the Z80 interpreter written in ARM assembly. 26 | Homepage: http://reesy.gp32x.de/ (defunct) 27 | 28 | Tatsuyuki Satoh, Jarek Burczynski, MAME development 29 | software implementation of Yamaha FM sound generator 30 | 31 | MAME development 32 | Texas Instruments SN76489 / SN76496 programmable tone/noise generator 33 | Homepage: http://www.mame.net/ 34 | 35 | Eke-Eke 36 | CD graphics processor and CD controller implementation (from Genesis Plus GX) 37 | 38 | Additional thanks 39 | ----------------- 40 | 41 | * Charles MacDonald (http://cgfm2.emuviews.com/) for old but still very useful 42 | info about genesis hardware. 43 | * Steve Snake for all that he has done for Genesis emulation scene. 44 | * Stephane Dallongeville for writing Gens and making it open source. 45 | * Tasco Deluxe for his reverse engineering work on SVP and some mappers. 46 | * Bart Trzynadlowski for his SSFII and 68000 docs. 47 | * Haze for his research (http://mamedev.emulab.it/haze/). 48 | * Lordus, Exophase and Rokas for various ideas. 49 | * Nemesis for his YM2612, VDP research and docs. 50 | * Eke-Eke for sharing the knowledge and his work on Genesis Plus GX. 51 | * Many posters at spritesmind.net forums for valuable information. 52 | * Mark and Jean-loup for zlib library. 53 | * ketchupgun for the skin. 54 | * GP2X specific help: rlyeh, Squidge, Dzz, A_SN, Alex and GP32X posters. 55 | * Gizmondo code: Kingcdr, Reesy, jens.l (for the device itself) 56 | * Hardware: craigix (GP2X), EvilDragon (Wiz, Caanoo, Pandora, ...) 57 | and jens.l (Gizmondo) 58 | * Paul Cercueil for OpenDingux port. 59 | * Inder for some graphics. 60 | * squarepusher for some libretro fixes 61 | * Hiroshica for support of japanese Mark-III extended YM2413 sound 62 | * Anyone else I forgot. Let me know if it's you. 63 | -------------------------------------------------------------------------------- /zlib/inftrees.h: -------------------------------------------------------------------------------- 1 | /* inftrees.h -- header to use inftrees.c 2 | * Copyright (C) 1995-2005 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 dynamic tree. The maximum found in a long but non- 39 | exhaustive search was 1444 code structures (852 for length/literals 40 | and 592 for distances, the latter actually the result of an 41 | exhaustive search). The true maximum is not known, but the value 42 | below is more than safe. */ 43 | #define ENOUGH 2048 44 | #define MAXD 592 45 | 46 | /* Type of code to build for inftable() */ 47 | typedef enum { 48 | CODES, 49 | LENS, 50 | DISTS 51 | } codetype; 52 | 53 | extern int inflate_table OF((codetype type, unsigned short FAR *lens, 54 | unsigned codes, code FAR * FAR *table, 55 | unsigned FAR *bits, unsigned short FAR *work)); 56 | -------------------------------------------------------------------------------- /platform/libretro/libretro-common/compat/fopen_utf8.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 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(LEGACY_WIN32) 40 | char * filename_local = utf8_to_local_string_alloc(filename); 41 | if (filename_local) 42 | { 43 | FILE *ret = fopen(filename_local, mode); 44 | free(filename_local); 45 | return ret; 46 | } 47 | #else 48 | wchar_t * filename_w = utf8_to_utf16_string_alloc(filename); 49 | if (filename_w) 50 | { 51 | FILE *ret = NULL; 52 | wchar_t *mode_w = utf8_to_utf16_string_alloc(mode); 53 | if (mode_w) 54 | { 55 | ret = _wfopen(filename_w, mode_w); 56 | free(mode_w); 57 | } 58 | free(filename_w); 59 | return ret; 60 | } 61 | #endif 62 | return NULL; 63 | } 64 | #endif 65 | -------------------------------------------------------------------------------- /platform/libretro/libretro-common/include/formats/rpng.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (rpng.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_FORMAT_RPNG_H__ 24 | #define __LIBRETRO_SDK_FORMAT_RPNG_H__ 25 | 26 | #include 27 | #include 28 | 29 | #include 30 | 31 | #include 32 | 33 | RETRO_BEGIN_DECLS 34 | 35 | typedef struct rpng rpng_t; 36 | 37 | rpng_t *rpng_init(const char *path); 38 | 39 | bool rpng_is_valid(rpng_t *rpng); 40 | 41 | bool rpng_set_buf_ptr(rpng_t *rpng, void *data, size_t len); 42 | 43 | rpng_t *rpng_alloc(void); 44 | 45 | void rpng_free(rpng_t *rpng); 46 | 47 | bool rpng_iterate_image(rpng_t *rpng); 48 | 49 | int rpng_process_image(rpng_t *rpng, 50 | void **data, size_t size, unsigned *width, unsigned *height); 51 | 52 | bool rpng_start(rpng_t *rpng); 53 | 54 | bool rpng_save_image_argb(const char *path, const uint32_t *data, 55 | unsigned width, unsigned height, unsigned pitch); 56 | bool rpng_save_image_bgr24(const char *path, const uint8_t *data, 57 | unsigned width, unsigned height, unsigned pitch); 58 | 59 | uint8_t* rpng_save_image_bgr24_string(const uint8_t *data, 60 | unsigned width, unsigned height, signed pitch, uint64_t *bytes); 61 | 62 | RETRO_END_DECLS 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /pico/misc_amips.s: -------------------------------------------------------------------------------- 1 | #* 2 | #* Some misc routines for Allegrex MIPS 3 | #* (C) notaz, 2007-2008 4 | #* 5 | #* This work is licensed under the terms of MAME license. 6 | #* See COPYING file in the top-level directory. 7 | #* 8 | 9 | .set noreorder 10 | .set noat 11 | 12 | .text 13 | .align 4 14 | 15 | .globl memset32 # int *dest, int c, int count 16 | 17 | memset32: 18 | ms32_aloop: 19 | andi $t0, $a0, 0x3f 20 | beqz $t0, ms32_bloop_prep 21 | nop 22 | sw $a1, 0($a0) 23 | addiu $a2, -1 24 | beqz $a2, ms32_return 25 | addiu $a0, 4 26 | j ms32_aloop 27 | nop 28 | 29 | ms32_bloop_prep: 30 | srl $t0, $a2, 4 # we will do 64 bytes per iteration (cache line) 31 | beqz $t0, ms32_bloop_end 32 | 33 | ms32_bloop: 34 | addiu $t0, -1 35 | cache 0x18, ($a0) # create dirty exclusive 36 | sw $a1, 0x00($a0) 37 | sw $a1, 0x04($a0) 38 | sw $a1, 0x08($a0) 39 | sw $a1, 0x0c($a0) 40 | sw $a1, 0x10($a0) 41 | sw $a1, 0x14($a0) 42 | sw $a1, 0x18($a0) 43 | sw $a1, 0x1c($a0) 44 | sw $a1, 0x20($a0) 45 | sw $a1, 0x24($a0) 46 | sw $a1, 0x28($a0) 47 | sw $a1, 0x2c($a0) 48 | sw $a1, 0x30($a0) 49 | sw $a1, 0x34($a0) 50 | sw $a1, 0x38($a0) 51 | sw $a1, 0x3c($a0) 52 | bnez $t0, ms32_bloop 53 | addiu $a0, 0x40 54 | 55 | ms32_bloop_end: 56 | andi $a2, $a2, 0x0f 57 | beqz $a2, ms32_return 58 | 59 | ms32_cloop: 60 | addiu $a2, -1 61 | sw $a1, 0($a0) 62 | bnez $a2, ms32_cloop 63 | addiu $a0, 4 64 | 65 | ms32_return: 66 | jr $ra 67 | nop 68 | 69 | 70 | .globl memset32_uncached # int *dest, int c, int count 71 | 72 | memset32_uncached: 73 | srl $t0, $a2, 3 # we will do 32 bytes per iteration 74 | beqz $t0, ms32u_bloop_end 75 | 76 | ms32u_bloop: 77 | addiu $t0, -1 78 | sw $a1, 0x00($a0) 79 | sw $a1, 0x04($a0) 80 | sw $a1, 0x08($a0) 81 | sw $a1, 0x0c($a0) 82 | sw $a1, 0x10($a0) 83 | sw $a1, 0x14($a0) 84 | sw $a1, 0x18($a0) 85 | sw $a1, 0x1c($a0) 86 | bnez $t0, ms32u_bloop 87 | addiu $a0, 0x20 88 | 89 | ms32u_bloop_end: 90 | andi $a2, $a2, 0x0f 91 | beqz $a2, ms32u_return 92 | 93 | ms32u_cloop: 94 | addiu $a2, -1 95 | sw $a1, 0($a0) 96 | bnez $a2, ms32u_cloop 97 | addiu $a0, 4 98 | 99 | ms32u_return: 100 | jr $ra 101 | nop 102 | 103 | 104 | # vim:filetype=mips 105 | -------------------------------------------------------------------------------- /platform/libretro/libretro-common/include/libretro_gskit_ps2.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this libretro API header (libretro_d3d.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 9 | * "Software"), 10 | * to deal in the Software without restriction, including without limitation the rights to 11 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 12 | * and to permit persons to whom the Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in all copies or 16 | * substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 19 | * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 21 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | */ 26 | 27 | #ifndef LIBRETRO_GSKIT_PS2_H_ 28 | #define LIBRETRO_GSKIT_PS2_H_ 29 | 30 | #include "libretro.h" 31 | 32 | #if defined(PS2) 33 | 34 | #include 35 | 36 | #define RETRO_HW_RENDER_INTERFACE_GSKIT_PS2_VERSION 2 37 | 38 | struct retro_hw_ps2_insets 39 | { 40 | float top; 41 | float left; 42 | float bottom; 43 | float right; 44 | }; 45 | 46 | #define empty_ps2_insets (struct retro_hw_ps2_insets){0.f, 0.f, 0.f, 0.f} 47 | 48 | struct retro_hw_render_interface_gskit_ps2 49 | { 50 | /* Must be set to RETRO_HW_RENDER_INTERFACE_GSKIT_PS2. */ 51 | enum retro_hw_render_interface_type interface_type; 52 | /* Must be set to RETRO_HW_RENDER_INTERFACE_GSKIT_PS2_VERSION. */ 53 | unsigned interface_version; 54 | 55 | /* Opaque handle to the GSKit_PS2 backend in the frontend 56 | * which must be passed along to all function pointers 57 | * in this interface. 58 | */ 59 | GSTEXTURE *coreTexture; 60 | struct retro_hw_ps2_insets padding; 61 | }; 62 | typedef struct retro_hw_render_interface_gskit_ps2 RETRO_HW_RENDER_INTEFACE_GSKIT_PS2; 63 | 64 | #endif 65 | 66 | #endif /* LIBRETRO_GSKIT_PS2_H_ */ 67 | -------------------------------------------------------------------------------- /platform/libretro/libretro-common/include/time/rtime.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (rtime.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_RTIME_H__ 24 | #define __LIBRETRO_SDK_RTIME_H__ 25 | 26 | #include 27 | 28 | #include 29 | #include 30 | #include 31 | 32 | RETRO_BEGIN_DECLS 33 | 34 | /* TODO/FIXME: Move all generic time handling functions 35 | * to this file */ 36 | 37 | /** 38 | * Must be called before using \c rtime_localtime(). 39 | * May be called multiple times without ill effects, 40 | * but must only be called from the main thread. 41 | */ 42 | void rtime_init(void); 43 | 44 | /** 45 | * Must be called upon program or core termination. 46 | * May be called multiple times without ill effects, 47 | * but must only be called from the main thread. 48 | */ 49 | void rtime_deinit(void); 50 | 51 | /** 52 | * Thread-safe wrapper around standard \c localtime(), 53 | * which by itself is not guaranteed to be thread-safe. 54 | * @param timep Pointer to a time_t object to convert. 55 | * @param result Pointer to a tm object to store the result in. 56 | * @return \c result. 57 | * @see https://en.cppreference.com/w/c/chrono/localtime 58 | */ 59 | struct tm *rtime_localtime(const time_t *timep, struct tm *result); 60 | 61 | RETRO_END_DECLS 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /tools/bselect.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | static unsigned char *ptr[100]; 5 | static int ptrc; 6 | 7 | #define M 256 8 | 9 | static struct 10 | { 11 | int pos; 12 | int cnt; 13 | } max[M]; 14 | 15 | 16 | static int active[100]; 17 | static int activec; 18 | 19 | static int active_pos; 20 | 21 | static void 22 | fill_max(void) 23 | { 24 | int i, n, b, c, u; 25 | 26 | 27 | memset(max, 0, sizeof(max)); 28 | 29 | for (b = 0; b < 0x800; b++) 30 | { 31 | c = 0; 32 | for (i = 0; i < activec; i++) 33 | { 34 | for (u = i + 1; u < activec; u++) 35 | { 36 | if (ptr[active[i]][b] == ptr[active[u]][b]) 37 | { 38 | goto bad; 39 | } 40 | } 41 | c ++; 42 | bad:; 43 | } 44 | 45 | for (i = 0; i < M; i ++) 46 | { 47 | if (max[i].cnt < c) 48 | { 49 | max[i].pos = b; 50 | max[i].cnt = c; 51 | break; 52 | } 53 | } 54 | } 55 | } 56 | 57 | static void 58 | select_max(void) 59 | { 60 | int i, m, c; 61 | 62 | m = max[0].cnt; 63 | 64 | if (max[0].cnt == 1) 65 | { 66 | printf("no solution!\n"); 67 | exit(1); 68 | } 69 | c = 0; 70 | for (i = 0; i < M; i++) 71 | { 72 | if (m == max[i].cnt) 73 | { 74 | c++; 75 | } 76 | } 77 | 78 | i = random() % c; 79 | active_pos = max[i].pos; 80 | printf("0x%03X (%d) ", active_pos, max[i].cnt); 81 | } 82 | 83 | 84 | static void 85 | search_active(void) 86 | { 87 | int i, j, a; 88 | int tmpa[100]; 89 | 90 | 91 | a = 0; 92 | for (i = 0; i < activec; i++) 93 | { 94 | for (j = 0; j < activec; j++) 95 | { 96 | if (i == j) 97 | { 98 | continue; 99 | } 100 | if (ptr[active[i]][active_pos] == 101 | ptr[active[j]][active_pos]) 102 | { 103 | tmpa[a] = active[i]; 104 | a++; 105 | break; 106 | } 107 | } 108 | } 109 | 110 | printf("(%d) ", a); 111 | for (i = 0; i < activec; i++) 112 | { 113 | printf("%02X ", ptr[active[i]][active_pos]); 114 | } 115 | 116 | printf("\n"); 117 | 118 | memcpy(active, tmpa, sizeof(active)); 119 | activec = a; 120 | } 121 | 122 | int 123 | main(int argc, char *argv[]) 124 | { 125 | int i, u, b, c; 126 | FILE *f; 127 | 128 | 129 | srandom(time(NULL)); 130 | 131 | ptrc = argc - 1; 132 | 133 | /* 134 | * read data 135 | */ 136 | 137 | for (i = 0; i < ptrc; i++) 138 | { 139 | ptr[i] = malloc(0x800); 140 | f = fopen(argv[i + 1], "rb"); 141 | fread(ptr[i], 1, 0x800, f); 142 | fclose(f); 143 | active[i] = i; 144 | } 145 | activec = ptrc; 146 | 147 | while (activec > 0) 148 | { 149 | fill_max(); 150 | select_max(); 151 | search_active(); 152 | } 153 | 154 | return 0; 155 | } 156 | 157 | -------------------------------------------------------------------------------- /pico/misc_arm.s: -------------------------------------------------------------------------------- 1 | /* 2 | * Generic memory routines. 3 | * (C) notaz, 2007-2008 4 | * 5 | * This work is licensed under the terms of MAME license. 6 | * See COPYING file in the top-level directory. 7 | */ 8 | 9 | @ 0x12345678 -> 0x34127856 10 | @ r4=temp, lr=0x00ff00ff 11 | .macro bswap reg 12 | and r4, \reg, lr 13 | and \reg, lr, \reg, lsr #8 14 | orr \reg, \reg, r4, lsl #8 15 | .endm 16 | 17 | @ dest must be halfword aligned, src can be unaligned 18 | .global memcpy16bswap @ unsigned short *dest, void *src, int count 19 | 20 | memcpy16bswap: 21 | tst r1, #1 22 | bne mcp16bs_cant_align2 23 | 24 | eor r3, r0, r1 25 | tst r3, #2 26 | bne mcp16bs_cant_align 27 | 28 | tst r0, #2 29 | beq mcp16bs_aligned 30 | ldrh r3, [r1], #2 31 | sub r2, r2, #1 32 | orr r3, r3, r3, lsl #16 33 | mov r3, r3, lsr #8 34 | strh r3, [r0], #2 35 | 36 | mcp16bs_aligned: 37 | stmfd sp!, {r4,lr} 38 | mov lr, #0xff 39 | orr lr, lr, lr, lsl #16 40 | 41 | subs r2, r2, #4 42 | bmi mcp16bs_fin4 43 | 44 | mcp16bs_loop: 45 | ldmia r1!, {r3,r12} 46 | subs r2, r2, #4 47 | bswap r3 48 | bswap r12 49 | stmia r0!, {r3,r12} 50 | bpl mcp16bs_loop 51 | 52 | mcp16bs_fin4: 53 | tst r2, #2 54 | beq mcp16bs_fin2 55 | ldr r3, [r1], #4 56 | bswap r3 57 | str r3, [r0], #4 58 | 59 | mcp16bs_fin2: 60 | ldmfd sp!, {r4,lr} 61 | ands r2, r2, #1 62 | bxeq lr 63 | 64 | mcp16bs_cant_align: 65 | ldrh r3, [r1], #2 66 | subs r2, r2, #1 67 | orr r3, r3, r3, lsl #16 68 | mov r3, r3, lsr #8 69 | strh r3, [r0], #2 70 | bne mcp16bs_cant_align 71 | bx lr 72 | 73 | @ worst case 74 | mcp16bs_cant_align2: 75 | ldrb r3, [r1], #1 76 | ldrb r12,[r1], #1 77 | subs r2, r2, #1 78 | mov r3, r3, lsl #8 79 | orr r3, r3, r12 80 | strh r3, [r0], #2 81 | bne mcp16bs_cant_align2 82 | bx lr 83 | 84 | 85 | .global memset32 @ int *dest, int c, int count 86 | 87 | memset32: 88 | stmfd sp!, {lr} 89 | 90 | mov r3, r1 91 | subs r2, r2, #4 92 | bmi mst32_fin 93 | 94 | mov r12,r1 95 | mov lr, r1 96 | 97 | mst32_loop: 98 | subs r2, r2, #4 99 | stmia r0!, {r1,r3,r12,lr} 100 | bpl mst32_loop 101 | 102 | mst32_fin: 103 | tst r2, #1 104 | strne r1, [r0], #4 105 | 106 | tst r2, #2 107 | stmneia r0!, {r1,r3} 108 | 109 | ldmfd sp!, {lr} 110 | bx lr 111 | 112 | @ vim:filetype=armasm 113 | -------------------------------------------------------------------------------- /platform/libretro/libretro-common/time/rtime.c: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2020 The RetroArch team 2 | * 3 | * --------------------------------------------------------------------------------------- 4 | * The following license statement only applies to this file (rtime.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 | #ifdef HAVE_THREADS 24 | #include 25 | #include 26 | #endif 27 | 28 | #include 29 | #include