From 179d176ce446c832235bb7b7a8a7a0abd4937a7b Mon Sep 17 00:00:00 2001 From: Angel Xex Date: Mon, 28 Feb 2022 02:39:45 -0300 Subject: [PATCH] Definitive Crash Fix --- include/gui.h | 1 + source/UI/mainMenu.cpp | 6 ++++++ source/gui.cpp | 14 ++++++++++++-- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/include/gui.h b/include/gui.h index 2531698..6b6d312 100644 --- a/include/gui.h +++ b/include/gui.h @@ -119,6 +119,7 @@ enum PLAYER_CONTROL_STATES { typedef struct { MENU_STATES state = MENU_STATE_HOME; MENU_STATES laststate = MENU_STATE_FILEBROWSER; + MENU_STATES savestate = MENU_STATE_FILEBROWSER; FILE_SELECTION_STATES selectionstate = FILE_SELECTION_NONE; PLAYER_RIGHT_MENU_STATES rightmenustate = PLAYER_RIGHT_MENU_PLAYER; PLAYER_STATES playerstate = PLAYER_STATE_VIDEO; diff --git a/source/UI/mainMenu.cpp b/source/UI/mainMenu.cpp index b93d400..cb92019 100644 --- a/source/UI/mainMenu.cpp +++ b/source/UI/mainMenu.cpp @@ -13,6 +13,12 @@ namespace Windows { void MainMenuWindow(bool *focus, bool *first_item) { Windows::SetupMainWindow(); std::vector topmenu = configini->topmenu; + + if(isHandheld == true) + batteryIcon(ImVec2(1230.0f,5.0f),true,batteryPorcent,40,20); + else + batteryIcon(ImVec2(1230.0f*multiplyRes + 20,5.0f),true,batteryPorcent,40,20); + if (ImGui::Begin(nxmpTitle.c_str(), nullptr, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse)) { static int selected = -1; for (unsigned int n = 0; n < topmenu.size(); n++){ diff --git a/source/gui.cpp b/source/gui.cpp index 031db6b..831a12c 100644 --- a/source/gui.cpp +++ b/source/gui.cpp @@ -381,10 +381,20 @@ namespace GUI { //exchanged the minus for the plus. //to avoid the crash of the integrated keyboard. if (button == SDL_KEY_PLUS){ - if(item.state == MENU_STATE_PLAYER && !item.masterlock){ - item.state = item.laststate; + if(item.state == MENU_STATE_PLAYER && !item.masterlock && item.rightmenustate == PLAYER_RIGHT_MENU_PLAYER){ + item.savestate = item.laststate; + item.state = item.laststate; }else if(item.state != MENU_STATE_PLAYER && !libmpv->Stopped()){ + std::cout << std::endl <<" State is?: " << item.state << std::endl; + //fix crash + if (item.state != item.savestate) + {item.state = MENU_STATE_FILEBROWSER; + localdir = new localFs(configini->getStartPath(),playlist); + localdir->DirList(configini->getStartPath(),true,Utility::getMediaExtensions()); + item.first_item = true;} + item.state = MENU_STATE_PLAYER; + } }