From 32240d70628904cfc6450e6d6245f7f3fee398ef Mon Sep 17 00:00:00 2001 From: JoseAaronLopezGarcia Date: Thu, 20 Jul 2023 14:29:33 +0200 Subject: [PATCH] improve load times and add fade animations --- extras/menus/xMenu/include/menu.h | 3 +++ extras/menus/xMenu/main.cpp | 39 +++++++++++++++++-------------- extras/menus/xMenu/src/menu.cpp | 32 ++++++++++++++++++++++--- 3 files changed, 54 insertions(+), 20 deletions(-) diff --git a/extras/menus/xMenu/include/menu.h b/extras/menus/xMenu/include/menu.h index 165b1a342..0d2c7bbcd 100644 --- a/extras/menus/xMenu/include/menu.h +++ b/extras/menus/xMenu/include/menu.h @@ -65,6 +65,9 @@ class Menu{ void loadGame(); void rebootMenu(); + + void fadeIn(); + void fadeOut(); public: diff --git a/extras/menus/xMenu/main.cpp b/extras/menus/xMenu/main.cpp index 7c19162c2..fc16c12a8 100644 --- a/extras/menus/xMenu/main.cpp +++ b/extras/menus/xMenu/main.cpp @@ -9,30 +9,35 @@ PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER); using namespace std; -int main(int argc, char** argv){ - - common::setArgs(argc, argv); - - initGraphics(); - - common::loadData(); - +int startup_thread(int argc, void* argp){ + int i; std::string startup_txt = "starting menu"; std::string startup_txt_upper = "STARTING MENU"; - std::stringstream startup_holder; - - int i; for(i=0;irun(); diff --git a/extras/menus/xMenu/src/menu.cpp b/extras/menus/xMenu/src/menu.cpp index 6496b3987..6eea3e1d2 100644 --- a/extras/menus/xMenu/src/menu.cpp +++ b/extras/menus/xMenu/src/menu.cpp @@ -230,6 +230,8 @@ void Menu::moveUp(){ void Menu::control(){ + fadeIn(); + Controller control; bool working = true; while(working){ @@ -320,6 +322,7 @@ void Menu::control(){ } } + fadeOut(); } void Menu::loadGame(){ @@ -335,7 +338,7 @@ void Menu::loadGame(){ param.args = strlen(path) + 1; param.argp = path; param.key = "pops"; - debugScreen(path, NULL, NULL); + fadeOut(); sctrlKernelLoadExecVSHWithApitype(runlevel, path, ¶m); } @@ -346,7 +349,6 @@ void Menu::rebootMenu(){ char path[256]; strcpy(path, ark_config->arkpath); - //strcat(path, ark_config->launcher); strcat(path, ARK_XMENU); int runlevel = 0x141; @@ -354,7 +356,7 @@ void Menu::rebootMenu(){ param.args = strlen(path) + 1; param.argp = path; param.key = "game"; - debugScreen(path, NULL, NULL); + fadeOut(); sctrlKernelLoadExecVSHWithApitype(runlevel, path, ¶m); } @@ -389,6 +391,30 @@ void Menu::run(){ control(); } +void Menu::fadeOut(){ + int alpha = 255; + while (alpha>0){ + u32 color = alpha << 24; + clearScreen(CLEAR_COLOR); + blitAlphaImageToScreen(0, 0, 480, 272, common::getBG(), 0, 0); + fillScreenRect(color, 0, 0, 480, 272); + common::flip(); + alpha -= 15; + } +} + +void Menu::fadeIn(){ + int alpha = 0; + while (alpha<255){ + u32 color = alpha << 24; + clearScreen(CLEAR_COLOR); + blitAlphaImageToScreen(0, 0, 480, 272, common::getBG(), 0, 0); + fillScreenRect(color, 0, 0, 480, 272); + common::flip(); + alpha += 15; + } +} + Menu::~Menu(){ delete this->txt; this->eboots.clear();