emu.speedmode(string mode) Takes control of the emulation speed of the system. Normal is normal speed (60fps, 50 for PAL), nothrottle disables speed control but renders every frame, turbo renders only a few frames in order to speed up emulation, maximum renders no frames TODO: better enforcement, done in the same way as basicbot...
| 428 | // maximum renders no frames |
| 429 | // TODO: better enforcement, done in the same way as basicbot... |
| 430 | static int emu_speedmode(lua_State *L) { |
| 431 | const char *mode = luaL_checkstring(L,1); |
| 432 | |
| 433 | if (strcasecmp(mode, "normal")==0) { |
| 434 | speedmode = SPEED_NORMAL; |
| 435 | } else if (strcasecmp(mode, "nothrottle")==0) { |
| 436 | speedmode = SPEED_NOTHROTTLE; |
| 437 | } else if (strcasecmp(mode, "turbo")==0) { |
| 438 | speedmode = SPEED_TURBO; |
| 439 | } else if (strcasecmp(mode, "maximum")==0) { |
| 440 | speedmode = SPEED_MAXIMUM; |
| 441 | } else |
| 442 | luaL_error(L, "Invalid mode %s to emu.speedmode",mode); |
| 443 | |
| 444 | //printf("new speed mode: %d\n", speedmode); |
| 445 | if (speedmode == SPEED_NORMAL) |
| 446 | { |
| 447 | FCEUD_SetEmulationSpeed(EMUSPEED_NORMAL); |
| 448 | FCEUD_TurboOff(); |
| 449 | } |
| 450 | else if (speedmode == SPEED_TURBO) //adelikat: Making turbo actually use turbo. |
| 451 | FCEUD_TurboOn(); //Turbo and max speed are two different results. Turbo employs frame skipping and sound bypassing if mute turbo option is enabled. |
| 452 | //This makes it faster but with frame skipping. Therefore, maximum is still a useful feature, in case the user is recording an avi or making screenshots (or something else that needs all frames) |
| 453 | else |
| 454 | FCEUD_SetEmulationSpeed(EMUSPEED_FASTEST); //TODO: Make nothrottle turn off throttle, or remove the option |
| 455 | return 0; |
| 456 | } |
| 457 | |
| 458 | // emu.poweron() |
| 459 | // |
nothing calls this directly
no test coverage detected