comparison src/sdl/SDL.cpp @ 39:3e36553d0cbf

got some speedruns to work!
author Robert McIntyre <rlm@mit.edu>
date Mon, 05 Mar 2012 16:37:38 -0600
parents 44974c3e093b
children 139178c4d843
comparison
equal deleted inserted replaced
38:b374503a5b31 39:3e36553d0cbf
1964 1964
1965 static char *szFile; 1965 static char *szFile;
1966 1966
1967 void file_run() 1967 void file_run()
1968 { 1968 {
1969 printf("RLM: file_run\n"); 1969 //printf("RLM: file_run\n");
1970 utilGetBaseName(szFile, filename); 1970 utilGetBaseName(szFile, filename);
1971 char *p = strrchr(filename, '.'); 1971 char *p = strrchr(filename, '.');
1972 1972
1973 if(p) 1973 if(p)
1974 *p = 0; 1974 *p = 0;
1975 1975
1988 1988
1989 if(type == IMAGE_GB) { 1989 if(type == IMAGE_GB) {
1990 failed = !gbLoadRom(szFile); 1990 failed = !gbLoadRom(szFile);
1991 if(!failed) { 1991 if(!failed) {
1992 systemCartridgeType = 1; 1992 systemCartridgeType = 1;
1993 printf("RLM: choosing GBSystem\n"); 1993 //printf("RLM: choosing GBSystem\n");
1994 theEmulator = GBSystem; 1994 theEmulator = GBSystem;
1995 if(sdlAutoIPS) { 1995 if(sdlAutoIPS) {
1996 int size = gbRomSize; 1996 int size = gbRomSize;
1997 utilApplyIPS(ipsname, &gbRom, &size); 1997 utilApplyIPS(ipsname, &gbRom, &size);
1998 if(size != gbRomSize) { 1998 if(size != gbRomSize) {
2271 sdlPrintUsage = 1; 2271 sdlPrintUsage = 1;
2272 break; 2272 break;
2273 } 2273 }
2274 } 2274 }
2275 2275
2276 printf("RLM: derpy loves you!\n"); 2276 //printf("RLM: derpy loves you!\n");
2277 printf("RLM: useMovie: %d (1 is record)\n", useMovie); 2277 //printf("RLM: useMovie: %d (1 is record)\n", useMovie);
2278 if(sdlPrintUsage) { 2278 if(sdlPrintUsage) {
2279 usage(argv[0]); 2279 usage(argv[0]);
2280 exit(-1); 2280 exit(-1);
2281 } 2281 }
2282 2282
2319 2319
2320 if(optind < argc) 2320 if(optind < argc)
2321 { 2321 {
2322 szFile = argv[optind]; 2322 szFile = argv[optind];
2323 file_run(); 2323 file_run();
2324 printf("RLM: file_run() done\n"); 2324 //printf("RLM: file_run() done\n");
2325 } 2325 }
2326 else 2326 else
2327 { 2327 {
2328 systemCartridgeType = 0; 2328 systemCartridgeType = 0;
2329 strcpy(filename, "gnu_stub"); 2329 strcpy(filename, "gnu_stub");
2618 2618
2619 if(!soundOffFlag) 2619 if(!soundOffFlag)
2620 soundInit(); 2620 soundInit();
2621 2621
2622 autoFrameSkipLastTime = throttleLastTime = systemGetClock(); 2622 autoFrameSkipLastTime = throttleLastTime = systemGetClock();
2623 printf("RLM: and now for the movie part!\n"); 2623 //printf("RLM: and now for the movie part!\n");
2624 2624
2625 switch(useMovie) 2625 switch(useMovie)
2626 { 2626 {
2627 case 1: // --recordMovie 2627 case 1: // --recordMovie
2628 VBAMovieCreate(movieFileName, 2628 VBAMovieCreate(movieFileName,
2639 break; 2639 break;
2640 default: 2640 default:
2641 sdlReadBattery(); 2641 sdlReadBattery();
2642 break; 2642 break;
2643 } 2643 }
2644 printf("RLM: still alive after movie switch\n"); 2644 //printf("RLM: still alive after movie switch\n");
2645 SDL_WM_SetCaption("VisualBoyAdvance", NULL); 2645 SDL_WM_SetCaption("VisualBoyAdvance", NULL);
2646 2646
2647 char *moviefile = getenv("AUTODEMO"); 2647 char *moviefile = getenv("AUTODEMO");
2648 fprintf (stderr, "Checking for AUTODEMO...\n"); 2648 fprintf (stderr, "Checking for AUTODEMO...\n");
2649 if (moviefile) 2649 if (moviefile)
2655 while(emulating) { 2655 while(emulating) {
2656 if(!paused && active) { 2656 if(!paused && active) {
2657 if(debugger && theEmulator.emuHasDebugger) 2657 if(debugger && theEmulator.emuHasDebugger)
2658 dbgMain(); 2658 dbgMain();
2659 else { 2659 else {
2660 printf("RLM: emulator main\n"); 2660 //printf("RLM: emulator main\n");
2661 theEmulator.emuMain(theEmulator.emuCount); 2661 theEmulator.emuMain(theEmulator.emuCount);
2662 printf("RLM: emulator main called\n"); 2662 //printf("RLM: emulator main called\n");
2663 if(rewindSaveNeeded && rewindMemory && theEmulator.emuWriteMemState) { 2663 if(rewindSaveNeeded && rewindMemory && theEmulator.emuWriteMemState) {
2664 rewindCount++; 2664 rewindCount++;
2665 if(rewindCount > 8) 2665 if(rewindCount > 8)
2666 rewindCount = 8; 2666 rewindCount = 8;
2667 if(theEmulator.emuWriteMemState && 2667 if(theEmulator.emuWriteMemState &&
3612 true //laggedLast 3612 true //laggedLast
3613 }; 3613 };
3614 3614
3615 void VBAOnEnteringFrameBoundary() 3615 void VBAOnEnteringFrameBoundary()
3616 { 3616 {
3617 printf("RLM: Entering Frame Boundary\n"); 3617 //printf("RLM: Entering Frame Boundary\n");
3618 CallRegisteredLuaFunctions(LUACALL_AFTEREMULATION); 3618 CallRegisteredLuaFunctions(LUACALL_AFTEREMULATION);
3619 3619
3620 if (VBALuaRunning()) 3620 if (VBALuaRunning())
3621 { 3621 {
3622 VBALuaFrameBoundary(); 3622 VBALuaFrameBoundary();
3623 } 3623 }
3624 3624
3625 printf("RLM: Movie state update pending\n"); 3625 //printf("RLM: Movie state update pending\n");
3626 VBAMovieUpdateState(); 3626 VBAMovieUpdateState();
3627 printf("RLM: Movie state updated\n"); 3627 //printf("RLM: Movie state updated\n");
3628 } 3628 }
3629 3629
3630 void VBAOnExitingFrameBoundary() 3630 void VBAOnExitingFrameBoundary()
3631 { 3631 {
3632 ; 3632 ;