From 64861035179b6f3cebb75e45633de0eb498a4b96 Mon Sep 17 00:00:00 2001 From: Sebastian Krzyszkowiak Date: Sat, 24 Jul 2021 04:08:40 +0200 Subject: [PATCH] mainloop: Switch Vita's CPU and bus to max frequency during loading --- src/mainloop.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/mainloop.c b/src/mainloop.c index f359811..34b9979 100644 --- a/src/mainloop.c +++ b/src/mainloop.c @@ -19,6 +19,10 @@ #include "internal.h" +#ifdef __vita__ +#include +#endif + static inline bool HandleEvent(struct Game* game, ALLEGRO_EVENT* ev) { switch (ev->type) { case ALLEGRO_EVENT_DISPLAY_HALT_DRAWING: @@ -332,6 +336,12 @@ static inline bool MainloopTick(struct Game* game) { if (tmp->pending_load) { #ifdef __EMSCRIPTEN__ StopAudio(game); +#endif +#ifdef __vita__ + int vita_arm_freq = scePowerGetArmClockFrequency(); + int vita_bus_freq = scePowerGetBusClockFrequency(); + scePowerSetArmClockFrequency(444); + scePowerSetBusClockFrequency(222); #endif if (tmp->show_loading && game->_priv.loading.gamestate->open) { (*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(); #ifdef __EMSCRIPTEN__ SetupAudio(game); +#endif +#ifdef __vita__ + scePowerSetArmClockFrequency(vita_arm_freq); + scePowerSetBusClockFrequency(vita_bus_freq); #endif }