trying to add movie support
authornotaz <notasas@gmail.com>
Thu, 21 Dec 2006 22:55:45 +0000 (22:55 +0000)
committernotaz <notasas@gmail.com>
Thu, 21 Dec 2006 22:55:45 +0000 (22:55 +0000)
git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@3 be3aeb3a-fb24-0410-a615-afba39da0efa

gp2x/emu.c
linux/port_config.h

index 0e4fdd7..14eadeb 100644 (file)
@@ -55,7 +55,7 @@ static int combo_keys = 0, combo_acts = 0;    // keys and actions which need button
 static int gp2x_old_gamma = 100;\r
 static unsigned char *movie_data = NULL;\r
 static int movie_size = 0;\r
-static int frame_count = 0;\r
+int frame_count = 0;\r
 unsigned char *framebuff = 0;  // temporary buffer for alt renderer\r
 int state_slot = 0;\r
 \r
@@ -219,11 +219,18 @@ int emu_ReloadRom(void)
                if(movie_data[0x14] == '6')\r
                     PicoOpt |=  0x20; // 6 button pad\r
                else PicoOpt &= ~0x20;\r
+               PicoOpt |= 0x40; // accurate timing\r
                if(movie_data[0xF] >= 'A') {\r
-                       //Pico.m.pal = movie_data[0x16] >> 7;\r
+                       if(movie_data[0x16] & 0x80) {\r
+                               PicoRegionOverride = 8;\r
+                       } else {\r
+                               PicoRegionOverride = 4;\r
+                       }\r
+                       PicoReset(0);\r
                        // TODO: bits 6 & 5\r
                }\r
-               strcpy(noticeMsg, "MOVIE LOADED");\r
+               movie_data[0x18+30] = 0;\r
+               sprintf(noticeMsg, "MOVIE: %s", (char *) &movie_data[0x18]);\r
        }\r
        else\r
        {\r
@@ -988,6 +995,26 @@ void emu_Loop(void)
                updateKeys();\r
                PicoFrame();\r
 \r
+#if 0\r
+               // debug\r
+               {\r
+                       static unsigned char oldscr[320*240*2];\r
+                       FILE *f; char name[128]; int i;\r
+                       for (i = 0; i < 320*240*2; i++)\r
+                               if(oldscr[i] != ((unsigned char *)gp2x_screen)[i]) break;\r
+                       if (i < 320*240*2)\r
+                       {\r
+                               for (i = 0; i < 320*240*2; i++)\r
+                                       oldscr[i] = ((unsigned char *)gp2x_screen)[i];\r
+                               sprintf(name, "%05i.raw", frame_count);\r
+                               f = fopen(name, "wb");\r
+                               if (!f) { printf("!f\n"); exit(1); }\r
+                               fwrite(gp2x_screen, 1, 320*240*2, f);\r
+                               fclose(f);\r
+                       }\r
+               }\r
+#endif\r
+\r
                // check time\r
                gettimeofday(&tval, 0);\r
                if(thissec != tval.tv_sec) tval.tv_usec+=1000000;\r
index 4f183c7..b679bab 100644 (file)
@@ -12,7 +12,9 @@
 // pico.c
 #define CAN_HANDLE_240_LINES   1
 
-#define dprintf(f,...) printf(f"\n",##__VA_ARGS__)
+extern int frame_count;
+
+#define dprintf(f,...) printf("%05i: " f "\n",frame_count,##__VA_ARGS__)
 //#define dprintf(x...)
 
 #endif //PORT_CONFIG_H