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