bugfix, fd leak
[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, soft_32col_scaling\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 void (*PicoWriteSound)(int len); // called once per frame at the best time to send sound buffer (PsndOut) to hardware\r
46extern void (*PicoMessage)(const char *msg); // callback to output text message from emu\r
47\r
48// cd/Pico.c\r
49int PicoFrameMCD(void);\r
50extern void (*PicoMCDopenTray)(void);\r
51extern int (*PicoMCDcloseTray)(void);\r
52\r
53extern int PicoCDBuffers;\r
54\r
55// Area.c\r
56typedef size_t (arearw)(void *p, size_t _size, size_t _n, void *file);\r
57typedef size_t (areaeof)(void *file);\r
58typedef int (areaseek)(void *file, long offset, int whence);\r
59typedef int (areaclose)(void *file);\r
60// Save or load the state from PmovFile:\r
61int PmovState(int PmovAction, void *PmovFile); // &1=for reading &2=for writing &4=volatile &8=non-volatile\r
62extern arearw *areaRead; // external read and write function pointers for\r
63extern arearw *areaWrite; // gzip save state ability\r
64extern areaeof *areaEof;\r
65extern areaseek *areaSeek;\r
66extern areaclose *areaClose;\r
67extern void (*PicoStateProgressCB)(const char *str);\r
68\r
69// cd/buffering.c\r
70void PicoCDBufferInit(void);\r
71void PicoCDBufferFree(void);\r
72\r
73// Cart.c\r
74typedef enum\r
75{\r
76 PMT_UNCOMPRESSED = 0,\r
77 PMT_ZIP\r
78} pm_type;\r
79typedef 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
86pm_file *pm_open(const char *path);\r
87size_t pm_read(void *ptr, size_t bytes, pm_file *stream);\r
88int pm_seek(pm_file *stream, long offset, int whence);\r
89int pm_close(pm_file *fp);\r
90int PicoCartLoad(pm_file *f,unsigned char **prom,unsigned int *psize);\r
91int PicoCartInsert(unsigned char *rom,unsigned int romsize);\r
92void Byteswap(unsigned char *data,int len);\r
93// anotherguest\r
94int PicoUnloadCart(unsigned char* romdata);\r
95\r
96// Draw.c\r
97void PicoDrawSetColorFormat(int which); // 0=BGR444, 1=RGB555, 2=8bit(HighPal pal)\r
98extern void *DrawLineDest;\r
99extern int (*PicoScan)(unsigned int num, void *data);\r
100// internals\r
101extern unsigned short HighPal[0x100];\r
102extern int rendstatus;\r
103// utility\r
104#ifdef _ASM_DRAW_C\r
105void *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
112extern unsigned short *PicoCramHigh; // pointer to CRAM buff (0x40 shorts), converted to native device color (works only with 16bit for now)\r
113extern void (*PicoPrepareCram)(); // prepares PicoCramHigh for renderer to use\r
114\r
115// sound.c\r
116extern int PsndRate,PsndLen;\r
117extern short *PsndOut;\r
118void sound_reset();\r
119void sound_rerate(int preserve_state);\r
120void z80_pack(unsigned char *data);\r
121void z80_unpack(unsigned char *data);\r
122void z80_reset();\r
123\r
124// Utils.c\r
125extern int PicuAnd;\r
126int PicuQuick(unsigned short *dest,unsigned short *src);\r
127int PicuShrink(unsigned short *dest,int destLen,unsigned short *src,int srcLen);\r
128int PicuShrinkReverse(unsigned short *dest,int destLen,unsigned short *src,int srcLen);\r
129int 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