SekRunPS Cyclone integration
[picodrive.git] / Pico / Pico.h
... / ...
CommitLineData
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
19extern "C" {\r
20#endif\r
21\r
22// external funcs for Sega/Mega CD\r
23int mp3_get_bitrate(FILE *f, int size);\r
24void mp3_start_play(FILE *f, int pos);\r
25int mp3_get_offset(void); // 0-1023\r
26void 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
35extern int PicoOpt;\r
36extern int PicoVer;\r
37extern int PicoSkipFrame; // skip rendering frame, but still do sound (if enabled) and emulation stuff\r
38extern int PicoRegionOverride; // override the region detection 0: auto, 1: Japan NTSC, 2: Japan PAL, 4: US, 8: Europe\r
39extern int PicoAutoRgnOrder; // packed priority list of regions, for example 0x148 means this detection order: EUR, USA, JAP\r
40int PicoInit(void);\r
41void PicoExit(void);\r
42int PicoReset(int hard);\r
43int PicoFrame(void);\r
44extern int PicoPad[2]; // Joypads, format is MXYZ SACB RLDU\r
45extern int (*PicoCram)(int cram); // Callback to convert colour ram 0000bbb0 ggg0rrr0\r
46extern void (*PicoWriteSound)(int len); // called once per frame at the best time to send sound buffer (PsndOut) to hardware\r
47\r
48int PicoFrameMCD(void);\r
49\r
50extern int PicoCDBuffers;\r
51\r
52// Area.c\r
53typedef size_t (arearw)(void *p, size_t _size, size_t _n, void *file);\r
54typedef size_t (areaeof)(void *file);\r
55typedef int (areaseek)(void *file, long offset, int whence);\r
56typedef int (areaclose)(void *file);\r
57// Save or load the state from PmovFile:\r
58int PmovState(int PmovAction, void *PmovFile); // &1=for reading &2=for writing &4=volatile &8=non-volatile\r
59extern arearw *areaRead; // external read and write function pointers for\r
60extern arearw *areaWrite; // gzip save state ability\r
61extern areaeof *areaEof;\r
62extern areaseek *areaSeek;\r
63extern areaclose *areaClose;\r
64extern void (*PicoStateProgressCB)(const char *str);\r
65\r
66// cd/buffering.c\r
67void PicoCDBufferInit(void);\r
68void PicoCDBufferFree(void);\r
69\r
70// Cart.c\r
71typedef enum\r
72{\r
73 PMT_UNCOMPRESSED = 0,\r
74 PMT_ZIP\r
75} pm_type;\r
76typedef 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
83pm_file *pm_open(const char *path);\r
84size_t pm_read(void *ptr, size_t bytes, pm_file *stream);\r
85int pm_seek(pm_file *stream, long offset, int whence);\r
86int pm_close(pm_file *fp);\r
87int PicoCartLoad(pm_file *f,unsigned char **prom,unsigned int *psize);\r
88int PicoCartInsert(unsigned char *rom,unsigned int romsize);\r
89void Byteswap(unsigned char *data,int len);\r
90// anotherguest\r
91int PicoUnloadCart(unsigned char* romdata);\r
92\r
93// Draw.c\r
94void PicoDrawSetColorFormat(int which); // 0=BGR444, 1=RGB555, 2=8bit(HighPal pal)\r
95extern void *DrawLineDest;\r
96extern int (*PicoScan)(unsigned int num, void *data);\r
97// internals\r
98extern unsigned short HighPal[0x100];\r
99extern int rendstatus;\r
100// utility\r
101#ifdef _ASM_DRAW_C\r
102void *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
109extern unsigned short *PicoCramHigh; // pointer to CRAM buff (0x40 shorts), converted to native device color (works only with 16bit for now)\r
110extern void (*PicoPrepareCram)(); // prepares PicoCramHigh for renderer to use\r
111\r
112// sound.c\r
113extern int PsndRate,PsndLen;\r
114extern short *PsndOut;\r
115void sound_reset();\r
116void sound_rerate(int preserve_state);\r
117void z80_pack(unsigned char *data);\r
118void z80_unpack(unsigned char *data);\r
119void z80_reset();\r
120\r
121// Utils.c\r
122extern int PicuAnd;\r
123int PicuQuick(unsigned short *dest,unsigned short *src);\r
124int PicuShrink(unsigned short *dest,int destLen,unsigned short *src,int srcLen);\r
125int PicuShrinkReverse(unsigned short *dest,int destLen,unsigned short *src,int srcLen);\r
126int 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