| 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\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 int (*PicoCram)(int cram); // Callback to convert colour ram 0000bbb0 ggg0rrr0\r |
| 46 | extern void (*PicoWriteSound)(int len); // called once per frame at the best time to send sound buffer (PsndOut) to hardware\r |
| 47 | \r |
| 48 | int PicoFrameMCD(void);\r |
| 49 | \r |
| 50 | extern int PicoCDBuffers;\r |
| 51 | \r |
| 52 | // Area.c\r |
| 53 | typedef size_t (arearw)(void *p, size_t _size, size_t _n, void *file);\r |
| 54 | typedef size_t (areaeof)(void *file);\r |
| 55 | typedef int (areaseek)(void *file, long offset, int whence);\r |
| 56 | typedef int (areaclose)(void *file);\r |
| 57 | // Save or load the state from PmovFile:\r |
| 58 | int PmovState(int PmovAction, void *PmovFile); // &1=for reading &2=for writing &4=volatile &8=non-volatile\r |
| 59 | extern arearw *areaRead; // external read and write function pointers for\r |
| 60 | extern arearw *areaWrite; // gzip save state ability\r |
| 61 | extern areaeof *areaEof;\r |
| 62 | extern areaseek *areaSeek;\r |
| 63 | extern areaclose *areaClose;\r |
| 64 | extern void (*PicoStateProgressCB)(const char *str);\r |
| 65 | \r |
| 66 | // cd/buffering.c\r |
| 67 | void PicoCDBufferInit(void);\r |
| 68 | void PicoCDBufferFree(void);\r |
| 69 | \r |
| 70 | // Cart.c\r |
| 71 | typedef enum\r |
| 72 | {\r |
| 73 | PMT_UNCOMPRESSED = 0,\r |
| 74 | PMT_ZIP\r |
| 75 | } pm_type;\r |
| 76 | typedef struct\r |
| 77 | {\r |
| 78 | void *file; /* file handle */\r |
| 79 | void *param; /* additional file related field */\r |
| 80 | unsigned int size; /* size */\r |
| 81 | pm_type type;\r |
| 82 | } pm_file;\r |
| 83 | pm_file *pm_open(const char *path);\r |
| 84 | size_t pm_read(void *ptr, size_t bytes, pm_file *stream);\r |
| 85 | int pm_seek(pm_file *stream, long offset, int whence);\r |
| 86 | int pm_close(pm_file *fp);\r |
| 87 | int PicoCartLoad(pm_file *f,unsigned char **prom,unsigned int *psize);\r |
| 88 | int PicoCartInsert(unsigned char *rom,unsigned int romsize);\r |
| 89 | void Byteswap(unsigned char *data,int len);\r |
| 90 | // anotherguest\r |
| 91 | int PicoUnloadCart(unsigned char* romdata);\r |
| 92 | \r |
| 93 | // Draw.c\r |
| 94 | void PicoDrawSetColorFormat(int which); // 0=BGR444, 1=RGB555, 2=8bit(HighPal pal)\r |
| 95 | extern void *DrawLineDest;\r |
| 96 | extern int (*PicoScan)(unsigned int num, void *data);\r |
| 97 | // internals\r |
| 98 | extern unsigned short HighPal[0x100];\r |
| 99 | extern int rendstatus;\r |
| 100 | // utility\r |
| 101 | #ifdef _ASM_DRAW_C\r |
| 102 | void *blockcpy(void *dst, const void *src, size_t n);\r |
| 103 | #else\r |
| 104 | #define blockcpy memcpy\r |
| 105 | #endif\r |
| 106 | \r |
| 107 | // Draw2.c\r |
| 108 | // stuff below is optional\r |
| 109 | extern unsigned short *PicoCramHigh; // pointer to CRAM buff (0x40 shorts), converted to native device color (works only with 16bit for now)\r |
| 110 | extern void (*PicoPrepareCram)(); // prepares PicoCramHigh for renderer to use\r |
| 111 | \r |
| 112 | // sound.c\r |
| 113 | extern int PsndRate,PsndLen;\r |
| 114 | extern short *PsndOut;\r |
| 115 | void sound_reset();\r |
| 116 | void sound_rerate(int preserve_state);\r |
| 117 | void z80_pack(unsigned char *data);\r |
| 118 | void z80_unpack(unsigned char *data);\r |
| 119 | void z80_reset();\r |
| 120 | \r |
| 121 | // Utils.c\r |
| 122 | extern int PicuAnd;\r |
| 123 | int PicuQuick(unsigned short *dest,unsigned short *src);\r |
| 124 | int PicuShrink(unsigned short *dest,int destLen,unsigned short *src,int srcLen);\r |
| 125 | int PicuShrinkReverse(unsigned short *dest,int destLen,unsigned short *src,int srcLen);\r |
| 126 | int PicuMerge(unsigned short *dest,int destLen,unsigned short *src,int srcLen);\r |
| 127 | \r |
| 128 | #ifdef __cplusplus\r |
| 129 | } // End of extern "C"\r |
| 130 | #endif\r |
| 131 | \r |
| 132 | #endif // PICO_H\r |