| 1 | \r |
| 2 | // -------------------- Pico Library --------------------\r |
| 3 | \r |
| 4 | // Pico Library - Header File\r |
| 5 | \r |
| 6 | // (c) Copyright 2004 Dave, All rights reserved.\r |
| 7 | // (c) Copyright 2006 notaz, All rights reserved.\r |
| 8 | // Free for non-commercial use.\r |
| 9 | \r |
| 10 | // For commercial use, separate licencing terms must be obtained.\r |
| 11 | \r |
| 12 | #ifndef PICO_H\r |
| 13 | #define PICO_H\r |
| 14 | \r |
| 15 | // port-specific compile-time settings\r |
| 16 | #include <port_config.h>\r |
| 17 | \r |
| 18 | #ifdef __cplusplus\r |
| 19 | extern "C" {\r |
| 20 | #endif\r |
| 21 | \r |
| 22 | // external funcs for Sega/Mega CD\r |
| 23 | int mp3_get_bitrate(FILE *f, int size);\r |
| 24 | void mp3_start_play(FILE *f, int pos);\r |
| 25 | int mp3_get_offset(void); // 0-1023\r |
| 26 | void mp3_update(int *buffer, int length, int stereo);\r |
| 27 | \r |
| 28 | \r |
| 29 | // Pico.c\r |
| 30 | // PicoOpt bits LSb->MSb:\r |
| 31 | // enable_ym2612&dac, enable_sn76496, enable_z80, stereo_sound,\r |
| 32 | // alt_renderer, 6button_gamepad, accurate_timing, accurate_sprites,\r |
| 33 | // draw_no_32col_border, external_ym2612, enable_pcm, enable cdda\r |
| 34 | // enable_cdgfx, cd_perfect_sync, soft_32col_scaling\r |
| 35 | extern int PicoOpt;\r |
| 36 | extern int PicoVer;\r |
| 37 | extern int PicoSkipFrame; // skip rendering frame, but still do sound (if enabled) and emulation stuff\r |
| 38 | extern int PicoRegionOverride; // override the region detection 0: auto, 1: Japan NTSC, 2: Japan PAL, 4: US, 8: Europe\r |
| 39 | extern int PicoAutoRgnOrder; // packed priority list of regions, for example 0x148 means this detection order: EUR, USA, JAP\r |
| 40 | int PicoInit(void);\r |
| 41 | void PicoExit(void);\r |
| 42 | int PicoReset(int hard);\r |
| 43 | int PicoFrame(void);\r |
| 44 | extern int PicoPad[2]; // Joypads, format is MXYZ SACB RLDU\r |
| 45 | extern void (*PicoWriteSound)(int len); // called once per frame at the best time to send sound buffer (PsndOut) to hardware\r |
| 46 | extern void (*PicoMessage)(const char *msg); // callback to output text message from emu\r |
| 47 | \r |
| 48 | // cd/Pico.c\r |
| 49 | int PicoFrameMCD(void);\r |
| 50 | extern void (*PicoMCDopenTray)(void);\r |
| 51 | extern int (*PicoMCDcloseTray)(void);\r |
| 52 | \r |
| 53 | extern int PicoCDBuffers;\r |
| 54 | \r |
| 55 | // Area.c\r |
| 56 | typedef size_t (arearw)(void *p, size_t _size, size_t _n, void *file);\r |
| 57 | typedef size_t (areaeof)(void *file);\r |
| 58 | typedef int (areaseek)(void *file, long offset, int whence);\r |
| 59 | typedef int (areaclose)(void *file);\r |
| 60 | // Save or load the state from PmovFile:\r |
| 61 | int PmovState(int PmovAction, void *PmovFile); // &1=for reading &2=for writing &4=volatile &8=non-volatile\r |
| 62 | extern arearw *areaRead; // external read and write function pointers for\r |
| 63 | extern arearw *areaWrite; // gzip save state ability\r |
| 64 | extern areaeof *areaEof;\r |
| 65 | extern areaseek *areaSeek;\r |
| 66 | extern areaclose *areaClose;\r |
| 67 | extern void (*PicoStateProgressCB)(const char *str);\r |
| 68 | \r |
| 69 | // cd/buffering.c\r |
| 70 | void PicoCDBufferInit(void);\r |
| 71 | void PicoCDBufferFree(void);\r |
| 72 | \r |
| 73 | // Cart.c\r |
| 74 | typedef enum\r |
| 75 | {\r |
| 76 | PMT_UNCOMPRESSED = 0,\r |
| 77 | PMT_ZIP\r |
| 78 | } pm_type;\r |
| 79 | typedef struct\r |
| 80 | {\r |
| 81 | void *file; /* file handle */\r |
| 82 | void *param; /* additional file related field */\r |
| 83 | unsigned int size; /* size */\r |
| 84 | pm_type type;\r |
| 85 | } pm_file;\r |
| 86 | pm_file *pm_open(const char *path);\r |
| 87 | size_t pm_read(void *ptr, size_t bytes, pm_file *stream);\r |
| 88 | int pm_seek(pm_file *stream, long offset, int whence);\r |
| 89 | int pm_close(pm_file *fp);\r |
| 90 | int PicoCartLoad(pm_file *f,unsigned char **prom,unsigned int *psize);\r |
| 91 | int PicoCartInsert(unsigned char *rom,unsigned int romsize);\r |
| 92 | void Byteswap(unsigned char *data,int len);\r |
| 93 | // anotherguest\r |
| 94 | int PicoUnloadCart(unsigned char* romdata);\r |
| 95 | \r |
| 96 | // Draw.c\r |
| 97 | void PicoDrawSetColorFormat(int which); // 0=BGR444, 1=RGB555, 2=8bit(HighPal pal)\r |
| 98 | extern void *DrawLineDest;\r |
| 99 | extern int (*PicoScan)(unsigned int num, void *data);\r |
| 100 | // internals\r |
| 101 | extern unsigned short HighPal[0x100];\r |
| 102 | extern int rendstatus;\r |
| 103 | // utility\r |
| 104 | #ifdef _ASM_DRAW_C\r |
| 105 | void *blockcpy(void *dst, const void *src, size_t n);\r |
| 106 | #else\r |
| 107 | #define blockcpy memcpy\r |
| 108 | #endif\r |
| 109 | \r |
| 110 | // Draw2.c\r |
| 111 | // stuff below is optional\r |
| 112 | extern unsigned short *PicoCramHigh; // pointer to CRAM buff (0x40 shorts), converted to native device color (works only with 16bit for now)\r |
| 113 | extern void (*PicoPrepareCram)(); // prepares PicoCramHigh for renderer to use\r |
| 114 | \r |
| 115 | // sound.c\r |
| 116 | extern int PsndRate,PsndLen;\r |
| 117 | extern short *PsndOut;\r |
| 118 | void sound_reset();\r |
| 119 | void sound_rerate(int preserve_state);\r |
| 120 | void z80_pack(unsigned char *data);\r |
| 121 | void z80_unpack(unsigned char *data);\r |
| 122 | void z80_reset();\r |
| 123 | \r |
| 124 | // Utils.c\r |
| 125 | extern int PicuAnd;\r |
| 126 | int PicuQuick(unsigned short *dest,unsigned short *src);\r |
| 127 | int PicuShrink(unsigned short *dest,int destLen,unsigned short *src,int srcLen);\r |
| 128 | int PicuShrinkReverse(unsigned short *dest,int destLen,unsigned short *src,int srcLen);\r |
| 129 | int PicuMerge(unsigned short *dest,int destLen,unsigned short *src,int srcLen);\r |
| 130 | \r |
| 131 | #ifdef __cplusplus\r |
| 132 | } // End of extern "C"\r |
| 133 | #endif\r |
| 134 | \r |
| 135 | #endif // PICO_H\r |