From 8c1952f0d742014666df8ec2191458d9117625b5 Mon Sep 17 00:00:00 2001 From: notaz Date: Tue, 26 Dec 2006 01:13:52 +0000 Subject: [PATCH] additional movie tweaking git-svn-id: file:///home/notaz/opt/svn/PicoDrive@7 be3aeb3a-fb24-0410-a615-afba39da0efa --- Pico/Pico.c | 2 + Pico/VideoPort.c | 8 ++-- Pico/cd/Memory.c | 2 +- platform/gp2x/Makefile | 3 ++ platform/gp2x/emu.c | 89 +++++++++++++++++++++++------------------- 5 files changed, 60 insertions(+), 44 deletions(-) diff --git a/Pico/Pico.c b/Pico/Pico.c index 5ab8483b..b430d661 100644 --- a/Pico/Pico.c +++ b/Pico/Pico.c @@ -621,6 +621,8 @@ int PicoFrame(void) { int acc; + Pico.m.frame_count++; + if (PicoMCD & 1) { PicoFrameMCD(); return 0; diff --git a/Pico/VideoPort.c b/Pico/VideoPort.c index 7f3d009c..75267c35 100644 --- a/Pico/VideoPort.c +++ b/Pico/VideoPort.c @@ -189,7 +189,8 @@ static void DmaCopy(int len) dprintf("DmaCopy len %i [%i|%i]", len, Pico.m.scanline, SekCyclesDone()); Pico.m.dma_bytes += len; - Pico.video.status|=2; // dma busy + if(Pico.m.scanline != -1) + Pico.video.status|=2; // dma busy source =Pico.video.reg[0x15]; source|=Pico.video.reg[0x16]<<8; @@ -222,7 +223,8 @@ static void DmaFill(int data) dprintf("DmaFill len %i inc %i [%i|%i]", len, inc, Pico.m.scanline, SekCyclesDone()); 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: // Write lower byte to address specified @@ -416,7 +418,7 @@ unsigned int PicoVideoRead(unsigned int a) hc=hcounts_40[lineCycles]; else hc=hcounts_32[lineCycles]; - if(lineCycles > 488-12) d++; // Wheel of Fortune + //if(lineCycles > 488-12) d++; // Wheel of Fortune } else { // get approximate V-Counter d=vcounts[SekCyclesDone()>>8]; diff --git a/Pico/cd/Memory.c b/Pico/cd/Memory.c index b8322d8a..a1cadb1f 100644 --- a/Pico/cd/Memory.c +++ b/Pico/cd/Memory.c @@ -25,7 +25,7 @@ typedef unsigned int u32; // ----------------------------------------------------------------- -extern m68ki_cpu_core m68ki_cpu; +// extern m68ki_cpu_core m68ki_cpu; extern int counter75hz; diff --git a/platform/gp2x/Makefile b/platform/gp2x/Makefile index c634c3dd..a524cc0d 100644 --- a/platform/gp2x/Makefile +++ b/platform/gp2x/Makefile @@ -40,6 +40,9 @@ OBJS += 940ctl_ym2612.o # Pico 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 - 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 ifeq "$(asm_render)" "1" DEFINC += -D_ASM_DRAW_C diff --git a/platform/gp2x/emu.c b/platform/gp2x/emu.c index d84b053f..6e0021b1 100644 --- a/platform/gp2x/emu.c +++ b/platform/gp2x/emu.c @@ -95,21 +95,28 @@ static int try_rfn_ext(char *ext) return 0; } +static void get_ext(char *ext) +{ + char *p; + + p = romFileName + strlen(romFileName) - 4; + if (p < romFileName) p = romFileName; + strncpy(ext, p, 4); + ext[4] = 0; + strlwr(ext); +} + int emu_ReloadRom(void) { unsigned int rom_size = 0; - char ext[5], *p; + char ext[5]; FILE *rom; int ret; printf("emu_ReloadRom(%s)\n", romFileName); - // detect wrong extensions (.srm and .mds) - p = romFileName + strlen(romFileName) - 4; - if (p < romFileName) p = romFileName; - strncpy(ext, p, 4); - ext[4] = 0; - strlwr(ext); + // detect wrong extensions + get_ext(ext); if(!strcmp(ext, ".srm") || !strcmp(ext, "s.gz") || !strcmp(ext, ".mds")) { // s.gz ~ .mds.gz sprintf(menuErrorMsg, "Not a ROM selected."); @@ -155,6 +162,7 @@ int emu_ReloadRom(void) sprintf(menuErrorMsg, "Could't find a ROM for movie."); return 0; } + get_ext(ext); } rom = fopen(romFileName, "rb"); @@ -615,6 +623,8 @@ static void RunEvents(unsigned int which) } if (do_it) { blit("", (which & 0x1000) ? "LOADING GAME" : "SAVING GAME"); + if(movie_data) { + } 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(¬iceMsgTime, 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) { 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(¬iceMsgTime, 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[1] = (unsigned short) allActions[1]; - } - Pico.m.frame_count++; + PicoPad[0] = (unsigned short) allActions[0]; + PicoPad[1] = (unsigned short) allActions[1]; events = (allActions[0] | allActions[1]) >> 16; @@ -762,6 +770,7 @@ static void updateKeys(void) events &= ~prevEvents; if (events) RunEvents(events); + if (movie_data) updateMovie(); prevEvents = (allActions[0] | allActions[1]) >> 16; } -- 2.39.5