From: notaz Date: Tue, 26 Dec 2006 01:13:52 +0000 (+0000) Subject: additional movie tweaking X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=25fced505d13a5eee16c191bb4d21b12e5d0f598;p=libpicofe.git additional movie tweaking git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@7 be3aeb3a-fb24-0410-a615-afba39da0efa --- diff --git a/gp2x/Makefile b/gp2x/Makefile index c634c3d..a524cc0 100644 --- a/gp2x/Makefile +++ b/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/gp2x/emu.c b/gp2x/emu.c index d84b053..6e0021b 100644 --- a/gp2x/emu.c +++ b/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; }