mainloop: Switch Vita's CPU and bus to max frequency during loading

This commit is contained in:
Sebastian Krzyszkowiak 2021-07-24 04:08:40 +02:00
parent b84e0af41f
commit 6486103517
No known key found for this signature in database
GPG key ID: E8F235CF3BDBC3FF

View file

@ -19,6 +19,10 @@
#include "internal.h" #include "internal.h"
#ifdef __vita__
#include <psp2/power.h>
#endif
static inline bool HandleEvent(struct Game* game, ALLEGRO_EVENT* ev) { static inline bool HandleEvent(struct Game* game, ALLEGRO_EVENT* ev) {
switch (ev->type) { switch (ev->type) {
case ALLEGRO_EVENT_DISPLAY_HALT_DRAWING: case ALLEGRO_EVENT_DISPLAY_HALT_DRAWING:
@ -332,6 +336,12 @@ static inline bool MainloopTick(struct Game* game) {
if (tmp->pending_load) { if (tmp->pending_load) {
#ifdef __EMSCRIPTEN__ #ifdef __EMSCRIPTEN__
StopAudio(game); StopAudio(game);
#endif
#ifdef __vita__
int vita_arm_freq = scePowerGetArmClockFrequency();
int vita_bus_freq = scePowerGetBusClockFrequency();
scePowerSetArmClockFrequency(444);
scePowerSetBusClockFrequency(222);
#endif #endif
if (tmp->show_loading && game->_priv.loading.gamestate->open) { if (tmp->show_loading && game->_priv.loading.gamestate->open) {
(*game->_priv.loading.gamestate->api->start)(game, game->_priv.loading.gamestate->data); (*game->_priv.loading.gamestate->api->start)(game, game->_priv.loading.gamestate->data);
@ -441,6 +451,10 @@ static inline bool MainloopTick(struct Game* game) {
game->_priv.timestamp = al_get_time(); game->_priv.timestamp = al_get_time();
#ifdef __EMSCRIPTEN__ #ifdef __EMSCRIPTEN__
SetupAudio(game); SetupAudio(game);
#endif
#ifdef __vita__
scePowerSetArmClockFrequency(vita_arm_freq);
scePowerSetBusClockFrequency(vita_bus_freq);
#endif #endif
} }