additional movie tweaking

git-svn-id: file:///home/notaz/opt/svn/PicoDrive@7 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
notaz 2006-12-26 01:13:52 +00:00
parent 312e9ce192
commit 8c1952f0d7
5 changed files with 61 additions and 45 deletions

View file

@ -621,6 +621,8 @@ int PicoFrame(void)
{ {
int acc; int acc;
Pico.m.frame_count++;
if (PicoMCD & 1) { if (PicoMCD & 1) {
PicoFrameMCD(); PicoFrameMCD();
return 0; return 0;

View file

@ -189,6 +189,7 @@ static void DmaCopy(int len)
dprintf("DmaCopy len %i [%i|%i]", len, Pico.m.scanline, SekCyclesDone()); dprintf("DmaCopy len %i [%i|%i]", len, Pico.m.scanline, SekCyclesDone());
Pico.m.dma_bytes += len; Pico.m.dma_bytes += len;
if(Pico.m.scanline != -1)
Pico.video.status|=2; // dma busy Pico.video.status|=2; // dma busy
source =Pico.video.reg[0x15]; source =Pico.video.reg[0x15];
@ -222,7 +223,8 @@ static void DmaFill(int data)
dprintf("DmaFill len %i inc %i [%i|%i]", len, inc, Pico.m.scanline, SekCyclesDone()); dprintf("DmaFill len %i inc %i [%i|%i]", len, inc, Pico.m.scanline, SekCyclesDone());
Pico.m.dma_bytes += len; Pico.m.dma_bytes += len;
Pico.video.status|=2; // dma busy if(Pico.m.scanline != -1)
Pico.video.status|=2; // dma busy (in accurate mode)
// from Charles MacDonald's genvdp.txt: // from Charles MacDonald's genvdp.txt:
// Write lower byte to address specified // Write lower byte to address specified
@ -416,7 +418,7 @@ unsigned int PicoVideoRead(unsigned int a)
hc=hcounts_40[lineCycles]; hc=hcounts_40[lineCycles];
else hc=hcounts_32[lineCycles]; else hc=hcounts_32[lineCycles];
if(lineCycles > 488-12) d++; // Wheel of Fortune //if(lineCycles > 488-12) d++; // Wheel of Fortune
} else { } else {
// get approximate V-Counter // get approximate V-Counter
d=vcounts[SekCyclesDone()>>8]; d=vcounts[SekCyclesDone()>>8];

View file

@ -25,7 +25,7 @@ typedef unsigned int u32;
// ----------------------------------------------------------------- // -----------------------------------------------------------------
extern m68ki_cpu_core m68ki_cpu; // extern m68ki_cpu_core m68ki_cpu;
extern int counter75hz; extern int counter75hz;

View file

@ -40,6 +40,9 @@ OBJS += 940ctl_ym2612.o
# Pico # Pico
OBJS += ../../Pico/Area.o ../../Pico/Cart.o ../../Pico/Utils.o ../../Pico/Memory.o ../../Pico/Misc.o \ OBJS += ../../Pico/Area.o ../../Pico/Cart.o ../../Pico/Utils.o ../../Pico/Memory.o ../../Pico/Misc.o \
../../Pico/Pico.o ../../Pico/Sek.o ../../Pico/VideoPort.o ../../Pico/Draw2.o ../../Pico/Draw.o ../../Pico/Pico.o ../../Pico/Sek.o ../../Pico/VideoPort.o ../../Pico/Draw2.o ../../Pico/Draw.o
# Pico - CD
OBJS += ../../Pico/cd/Pico.o ../../Pico/cd/Memory.o ../../Pico/cd/Sek.o ../../Pico/cd/LC89510.o \
../../Pico/cd/cd_sys.o
# asm stuff # asm stuff
ifeq "$(asm_render)" "1" ifeq "$(asm_render)" "1"
DEFINC += -D_ASM_DRAW_C DEFINC += -D_ASM_DRAW_C

View file

@ -95,21 +95,28 @@ static int try_rfn_ext(char *ext)
return 0; return 0;
} }
int emu_ReloadRom(void) static void get_ext(char *ext)
{ {
unsigned int rom_size = 0; char *p;
char ext[5], *p;
FILE *rom;
int ret;
printf("emu_ReloadRom(%s)\n", romFileName);
// detect wrong extensions (.srm and .mds)
p = romFileName + strlen(romFileName) - 4; p = romFileName + strlen(romFileName) - 4;
if (p < romFileName) p = romFileName; if (p < romFileName) p = romFileName;
strncpy(ext, p, 4); strncpy(ext, p, 4);
ext[4] = 0; ext[4] = 0;
strlwr(ext); strlwr(ext);
}
int emu_ReloadRom(void)
{
unsigned int rom_size = 0;
char ext[5];
FILE *rom;
int ret;
printf("emu_ReloadRom(%s)\n", romFileName);
// detect wrong extensions
get_ext(ext);
if(!strcmp(ext, ".srm") || !strcmp(ext, "s.gz") || !strcmp(ext, ".mds")) { // s.gz ~ .mds.gz if(!strcmp(ext, ".srm") || !strcmp(ext, "s.gz") || !strcmp(ext, ".mds")) { // s.gz ~ .mds.gz
sprintf(menuErrorMsg, "Not a ROM selected."); sprintf(menuErrorMsg, "Not a ROM selected.");
@ -155,6 +162,7 @@ int emu_ReloadRom(void)
sprintf(menuErrorMsg, "Could't find a ROM for movie."); sprintf(menuErrorMsg, "Could't find a ROM for movie.");
return 0; return 0;
} }
get_ext(ext);
} }
rom = fopen(romFileName, "rb"); rom = fopen(romFileName, "rb");
@ -615,6 +623,8 @@ static void RunEvents(unsigned int which)
} }
if (do_it) { if (do_it) {
blit("", (which & 0x1000) ? "LOADING GAME" : "SAVING GAME"); blit("", (which & 0x1000) ? "LOADING GAME" : "SAVING GAME");
if(movie_data) {
}
emu_SaveLoadGame(which & 0x1000, 0); emu_SaveLoadGame(which & 0x1000, 0);
} }
@ -654,6 +664,35 @@ static void RunEvents(unsigned int which)
} }
static void updateMovie(void)
{
int offs = Pico.m.frame_count*3 + 0x40;
if (offs+3 > movie_size) {
free(movie_data);
movie_data = 0;
strcpy(noticeMsg, "END OF MOVIE.");
printf("END OF MOVIE.\n");
gettimeofday(&noticeMsgTime, 0);
} else {
// MXYZ SACB RLDU
PicoPad[0] = ~movie_data[offs] & 0x8f; // ! SCBA RLDU
if(!(movie_data[offs] & 0x10)) PicoPad[0] |= 0x40; // A
if(!(movie_data[offs] & 0x20)) PicoPad[0] |= 0x10; // B
if(!(movie_data[offs] & 0x40)) PicoPad[0] |= 0x20; // A
PicoPad[1] = ~movie_data[offs+1] & 0x8f; // ! SCBA RLDU
if(!(movie_data[offs+1] & 0x10)) PicoPad[1] |= 0x40; // A
if(!(movie_data[offs+1] & 0x20)) PicoPad[1] |= 0x10; // B
if(!(movie_data[offs+1] & 0x40)) PicoPad[1] |= 0x20; // A
PicoPad[0] |= (~movie_data[offs+2] & 0x0A) << 8; // ! MZYX
if(!(movie_data[offs+2] & 0x01)) PicoPad[0] |= 0x0400; // X
if(!(movie_data[offs+2] & 0x04)) PicoPad[0] |= 0x0100; // Z
PicoPad[1] |= (~movie_data[offs+2] & 0xA0) << 4; // ! MZYX
if(!(movie_data[offs+2] & 0x10)) PicoPad[1] |= 0x0400; // X
if(!(movie_data[offs+2] & 0x40)) PicoPad[1] |= 0x0100; // Z
}
}
static void updateKeys(void) static void updateKeys(void)
{ {
unsigned long keys, allActions[2] = { 0, 0 }, events; unsigned long keys, allActions[2] = { 0, 0 }, events;
@ -710,39 +749,8 @@ static void updateKeys(void)
} }
} }
if(movie_data)
{
int offs = Pico.m.frame_count*3 + 0x40;
if (offs+3 > movie_size) {
free(movie_data);
movie_data = 0;
strcpy(noticeMsg, "END OF MOVIE.");
printf("END OF MOVIE.\n");
gettimeofday(&noticeMsgTime, 0);
} else {
// MXYZ SACB RLDU
PicoPad[0] = ~movie_data[offs] & 0x8f; // ! SCBA RLDU
if(!(movie_data[offs] & 0x10)) PicoPad[0] |= 0x40; // A
if(!(movie_data[offs] & 0x20)) PicoPad[0] |= 0x10; // B
if(!(movie_data[offs] & 0x40)) PicoPad[0] |= 0x20; // A
PicoPad[1] = ~movie_data[offs+1] & 0x8f; // ! SCBA RLDU
if(!(movie_data[offs+1] & 0x10)) PicoPad[1] |= 0x40; // A
if(!(movie_data[offs+1] & 0x20)) PicoPad[1] |= 0x10; // B
if(!(movie_data[offs+1] & 0x40)) PicoPad[1] |= 0x20; // A
PicoPad[0] |= (~movie_data[offs+2] & 0x0A) << 8; // ! MZYX
if(!(movie_data[offs+2] & 0x01)) PicoPad[0] |= 0x0400; // X
if(!(movie_data[offs+2] & 0x04)) PicoPad[0] |= 0x0100; // Z
PicoPad[1] |= (~movie_data[offs+2] & 0xA0) << 4; // ! MZYX
if(!(movie_data[offs+2] & 0x10)) PicoPad[1] |= 0x0400; // X
if(!(movie_data[offs+2] & 0x40)) PicoPad[1] |= 0x0100; // Z
}
}
else
{
PicoPad[0] = (unsigned short) allActions[0]; PicoPad[0] = (unsigned short) allActions[0];
PicoPad[1] = (unsigned short) allActions[1]; PicoPad[1] = (unsigned short) allActions[1];
}
Pico.m.frame_count++;
events = (allActions[0] | allActions[1]) >> 16; events = (allActions[0] | allActions[1]) >> 16;
@ -762,6 +770,7 @@ static void updateKeys(void)
events &= ~prevEvents; events &= ~prevEvents;
if (events) RunEvents(events); if (events) RunEvents(events);
if (movie_data) updateMovie();
prevEvents = (allActions[0] | allActions[1]) >> 16; prevEvents = (allActions[0] | allActions[1]) >> 16;
} }