Skip to content

Commit

Permalink
Merge pull request #57 from darkxex/master
Browse files Browse the repository at this point in the history
Definitive Crash Fix
  • Loading branch information
darkxex authored Feb 28, 2022
2 parents 02eff0b + 179d176 commit fcca9ee
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions include/gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions source/UI/mainMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ namespace Windows {
void MainMenuWindow(bool *focus, bool *first_item) {
Windows::SetupMainWindow();
std::vector<std::string> 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++){
Expand Down
14 changes: 12 additions & 2 deletions source/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

}
}

Expand Down

0 comments on commit fcca9ee

Please sign in to comment.