fonts, buffer aligment, save progress

git-svn-id: file:///home/notaz/opt/svn/PicoDrive@51 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
notaz 2007-02-17 22:43:26 +00:00
parent cea6590346
commit 76276b0bc0
13 changed files with 371 additions and 126 deletions

View file

@ -56,6 +56,7 @@ extern arearw *areaRead; // external read and write function pointers for
extern arearw *areaWrite; // gzip save state ability
extern areaeof *areaEof;
extern areaseek *areaSeek;
extern void (*PicoStateProgressCB)(const char *str);
// Cart.c
int PicoCartLoad(FILE *f,unsigned char **prom,unsigned int *psize);

View file

@ -14,6 +14,8 @@
// sn76496
extern int *sn76496_regs;
void (*PicoStateProgressCB)(const char *str) = 0;
typedef enum {
CHUNK_M68K = 1,
@ -43,6 +45,34 @@ typedef enum {
} chunk_name_e;
static char *chunk_names[] = {
"Saving.. M68K state",
"Saving.. RAM",
"Saving.. VRAM",
"Saving.. ZRAM",
"Saving.. CRAM", // 5
"Saving.. VSRAM",
"Saving.. emu state",
"Saving.. VIDEO",
"Saving.. Z80 state",
"Saving.. PSG", // 10
"Saving.. FM",
// CD stuff
"Saving.. S68K state",
"Saving.. PRG_RAM",
"Saving.. WORD_RAM",
"Saving.. PCM_RAM", // 15
"Saving.. BRAM",
"Saving.. GATE ARRAY regs",
"Saving.. PCM state",
"Saving.. CDC",
"Saving.. CDD", // 20
"Saving.. SCD",
"Saving.. GFX chip",
"Saving.. MCD state",
};
static int write_chunk(chunk_name_e name, int len, void *data, void *file)
{
size_t bwritten = 0;
@ -55,9 +85,11 @@ static int write_chunk(chunk_name_e name, int len, void *data, void *file)
#define CHECKED_WRITE(name,len,data) \
if (PicoStateProgressCB) PicoStateProgressCB(chunk_names[name]); \
if (!write_chunk(name, len, data, file)) return 1;
#define CHECKED_WRITE_BUFF(name,buff) \
if (PicoStateProgressCB) PicoStateProgressCB(chunk_names[name]); \
if (!write_chunk(name, sizeof(buff), &buff, file)) return 1;
int PicoCdSaveState(void *file)
@ -88,7 +120,6 @@ int PicoCdSaveState(void *file)
if(PicoOpt&1)
CHECKED_WRITE(CHUNK_FM, 0x200+4, ym2612_regs);
// TODO: cd stuff
if (PicoMCD & 1)
{
Pico_mcd->m.audio_offset = mp3_get_offset();

View file

@ -1,16 +1,18 @@
unsigned char formatted_bram[8*0x10] =
unsigned char formatted_bram[4*0x10] =
{
#if 0
0x00, 0xd4, 0x63, 0x00, 0x00, 0x03, 0x03, 0x00, 0x03, 0x03, 0x03, 0x00, 0x03, 0x00, 0x00, 0x03,
0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x53, 0xd2, 0xf5, 0x3a, 0x48, 0x50, 0x35, 0x0f,
0x47, 0x14, 0xf5, 0x7e, 0x5c, 0xd4, 0xf3, 0x03, 0x00, 0x03, 0x12, 0x00, 0x0a, 0xff, 0xca, 0xa6,
0xf5, 0x27, 0xed, 0x22, 0x47, 0xfa, 0x22, 0x96, 0x6c, 0xa5, 0x88, 0x14, 0x48, 0x48, 0x0a, 0xbb,
#endif
0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x40,
0x00, 0x7d, 0x00, 0x7d, 0x00, 0x7d, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x53, 0x45, 0x47, 0x41, 0x5f, 0x43, 0x44, 0x5f, 0x52, 0x4f, 0x4d, 0x00, 0x01, 0x00, 0x00, 0x00,
0x52, 0x41, 0x4d, 0x5f, 0x43, 0x41, 0x52, 0x54, 0x52, 0x49, 0x44, 0x47, 0x45, 0x5f, 0x5f, 0x5f,
// SEGA_CD_ROM.....RAM_CART
// SEGA_CD_ROM.....RAM_CARTRIDGE___
};

View file

@ -11,7 +11,7 @@
#include "../sound/sound.h"
extern unsigned char formatted_bram[8*0x10];
extern unsigned char formatted_bram[4*0x10];
int PicoInitMCD(void)
@ -34,8 +34,9 @@ int PicoResetMCD(int hard)
memset(Pico_mcd->word_ram, 0, sizeof(Pico_mcd->word_ram));
memset(Pico_mcd->pcm_ram, 0, sizeof(Pico_mcd->pcm_ram));
if (hard) {
int fmt_size = sizeof(formatted_bram);
memset(Pico_mcd->bram, 0, sizeof(Pico_mcd->bram));
memcpy(Pico_mcd->bram + sizeof(Pico_mcd->bram) - 8*0x10, formatted_bram, 8*0x10);
memcpy(Pico_mcd->bram + sizeof(Pico_mcd->bram) - fmt_size, formatted_bram, fmt_size);
}
memset(Pico_mcd->s68k_regs, 0, sizeof(Pico_mcd->s68k_regs));
memset(&Pico_mcd->pcm, 0, sizeof(Pico_mcd->pcm));