|
1 | 1 | #include "ppsspp_config.h" |
| 2 | +#include <algorithm> |
2 | 3 | #include <cstring> |
3 | 4 | #include <cassert> |
4 | 5 | #include <thread> |
@@ -477,12 +478,39 @@ static std::string map_psp_language_to_i18n_locale(int val) |
477 | 478 | } |
478 | 479 |
|
479 | 480 | static void check_dynamic_variables(CoreParameter &coreParam) { |
| 481 | +#ifdef __EMSCRIPTEN__ |
| 482 | + struct retro_throttle_state throttle = { RETRO_THROTTLE_NONE, 0.0f }; |
| 483 | + if (environ_cb(RETRO_ENVIRONMENT_GET_THROTTLE_STATE, &throttle)) { |
| 484 | + switch (throttle.mode) { |
| 485 | + case RETRO_THROTTLE_FAST_FORWARD: |
| 486 | + if (throttle.rate > 0.0f) { |
| 487 | + coreParam.fpsLimit = FPSLimit::ANALOG; |
| 488 | + coreParam.analogFpsLimit = (int)(throttle.rate + 0.5f); |
| 489 | + coreParam.fastForward = false; |
| 490 | + } else { |
| 491 | + coreParam.fpsLimit = FPSLimit::NORMAL; |
| 492 | + coreParam.fastForward = true; |
| 493 | + } |
| 494 | + break; |
| 495 | + case RETRO_THROTTLE_SLOW_MOTION: |
| 496 | + coreParam.fpsLimit = FPSLimit::ANALOG; |
| 497 | + coreParam.analogFpsLimit = std::max(1, (int)(throttle.rate + 0.5f)); |
| 498 | + coreParam.fastForward = false; |
| 499 | + break; |
| 500 | + default: |
| 501 | + coreParam.fpsLimit = FPSLimit::NORMAL; |
| 502 | + coreParam.fastForward = false; |
| 503 | + break; |
| 504 | + } |
| 505 | + } |
| 506 | +#else |
480 | 507 | if (g_Config.bForceLagSync) |
481 | 508 | { |
482 | 509 | bool isFastForwarding; |
483 | 510 | if (environ_cb(RETRO_ENVIRONMENT_GET_FASTFORWARDING, &isFastForwarding)) |
484 | 511 | coreParam.fastForward = isFastForwarding; |
485 | 512 | } |
| 513 | +#endif |
486 | 514 | } |
487 | 515 |
|
488 | 516 | static void check_variables(CoreParameter &coreParam) |
|
0 commit comments