X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=pico%2Fpico.h;h=4a99ef57ef205d5a6446edf5ae66d5fb5fe16944;hb=5609d343e3b34d9fed210a1c26c2441d3f797036;hp=e0acda108d61ec82b2e4aac8a5a8dc8adaf993f7;hpb=f4750ee051b509a17bb940d6372a0c12faae18cd;p=picodrive.git diff --git a/pico/pico.h b/pico/pico.h index e0acda1..4a99ef5 100644 --- a/pico/pico.h +++ b/pico/pico.h @@ -1,18 +1,16 @@ - -// -------------------- Pico Library -------------------- - -// Pico Library - Header File - -// (c) Copyright 2004 Dave, All rights reserved. -// (c) Copyright 2006-2009 notaz, All rights reserved. -// Free for non-commercial use. - -// For commercial use, separate licencing terms must be obtained. +/* + * PicoDrive + * (c) Copyright Dave, 2004 + * (C) notaz, 2006-2010 + * + * This work is licensed under the terms of MAME license. + * See COPYING file in the top-level directory. + */ #ifndef PICO_H #define PICO_H -//#include +#include // size_t // port-specific compile-time settings #include @@ -21,6 +19,9 @@ extern "C" { #endif +// message log +extern void lprintf(const char *fmt, ...); + // external funcs for Sega/Mega CD extern int mp3_get_bitrate(void *f, int size); extern void mp3_start_play(void *f, int pos); @@ -29,13 +30,14 @@ extern void mp3_update(int *buffer, int length, int stereo); // this function should write-back d-cache and invalidate i-cache // on a mem region [start_addr, end_addr) // used by dynarecs -extern void cache_flush_d_inval_i(const void *start_addr, const void *end_addr); +extern void cache_flush_d_inval_i(void *start_addr, void *end_addr); // attempt to alloc mem at specified address. // alloc anywhere else if that fails (callers should handle that) -extern void *plat_mmap(unsigned long addr, size_t size); +extern void *plat_mmap(unsigned long addr, size_t size, int need_exec, int is_fixed); extern void *plat_mremap(void *ptr, size_t oldsize, size_t newsize); extern void plat_munmap(void *ptr, size_t size); +extern int plat_mem_set_exec(void *ptr, size_t size); // this one should handle display mode changes extern void emu_video_mode_change(int start_line, int line_count, int is_32cols); @@ -90,7 +92,7 @@ void PicoLoopPrepare(void); void PicoFrame(void); void PicoFrameDrawOnly(void); extern int PicoPad[2]; // Joypads, format is MXYZ SACB RLDU -extern void (*PicoWriteSound)(int len); // called once per frame at the best time to send sound buffer (PsndOut) to hardware +extern void (*PicoWriteSound)(int bytes); // called once per frame at the best time to send sound buffer (PsndOut) to hardware extern void (*PicoMessage)(const char *msg); // callback to output text message from emu typedef enum { PI_ROM, PI_ISPAL, PI_IS40_CELL, PI_IS240_LINES } pint_t; typedef union { int vint; void *vptr; } pint_ret_t; @@ -158,6 +160,7 @@ int PicoCartInsert(unsigned char *rom, unsigned int romsize, const char *carthw_ void PicoCartUnload(void); extern void (*PicoCartLoadProgressCB)(int percent); extern void (*PicoCDLoadProgressCB)(const char *fname, int percent); +extern int PicoGameLoaded; // Draw.c // for line-based renderer, set conversion @@ -168,7 +171,7 @@ typedef enum PDF_RGB555, // RGB/BGR output, depends on compile options PDF_8BIT, // 8-bit out (handles shadow/hilight mode, sonic water) } pdso_t; -void PicoDrawSetOutFormat(pdso_t which, int allow_32x); +void PicoDrawSetOutFormat(pdso_t which, int use_32x_line_mode); void PicoDrawSetOutBuf(void *dest, int increment); void PicoDrawSetCallbacks(int (*begin)(unsigned int num), int (*end)(unsigned int num)); extern void *DrawLineDest; @@ -209,15 +212,20 @@ extern unsigned short *PicoCramHigh; // pointer to CRAM buff (0x40 shorts), conv extern void (*PicoPrepareCram)(); // prepares PicoCramHigh for renderer to use // pico.c (32x) -// multipliers against 68k clock -extern int p32x_msh2_multiplier; -extern int p32x_ssh2_multiplier; -#define SH2_MULTI_SHIFT 10 -#define MSH2_MULTI_DEFAULT ((1 << SH2_MULTI_SHIFT) * 3 / 2) -#define SSH2_MULTI_DEFAULT ((1 << SH2_MULTI_SHIFT) * 3 / 2) +#ifndef NO_32X + +void Pico32xSetClocks(int msh2_hz, int ssh2_hz); -// 32x/draw.c -void PicoDraw32xSetFrameMode(int is_on, int only_32x); +#else + +#define Pico32xSetClocks(msh2_khz, ssh2_khz) + +#endif + +// normally 68k clock (7670442) * 3, in reality but much lower +// because of high memory latencies +#define PICO_MSH2_HZ ((int)(7670442.0 * 2.4)) +#define PICO_SSH2_HZ ((int)(7670442.0 * 2.4)) // sound.c extern int PsndRate,PsndLen; @@ -225,12 +233,23 @@ extern short *PsndOut; extern void (*PsndMix_32_to_16l)(short *dest, int *src, int count); void PsndRerate(int preserve_state); -// Utils.c -extern int PicuAnd; -int PicuQuick(unsigned short *dest,unsigned short *src); -int PicuShrink(unsigned short *dest,int destLen,unsigned short *src,int srcLen); -int PicuShrinkReverse(unsigned short *dest,int destLen,unsigned short *src,int srcLen); -int PicuMerge(unsigned short *dest,int destLen,unsigned short *src,int srcLen); +// media.c +enum media_type_e { + PM_BAD_DETECT = -1, + PM_ERROR = -2, + PM_BAD_CD = -3, + PM_BAD_CD_NO_BIOS = -4, + PM_MD_CART = 1, /* also 32x */ + PM_MARK3, + PM_CD, +}; +enum media_type_e PicoLoadMedia(const char *filename, + const char *carthw_cfg_fname, + const char *(*get_bios_filename)(int *region, const char *cd_fname), + void (*do_region_override)(const char *media_filename)); +int PicoCdCheck(const char *fname_in, int *pregion); + +extern unsigned char media_id_header[0x100]; #ifdef __cplusplus } // End of extern "C"