From f7454baffa1a97ac6a2d4e792936c8e1bc391c04 Mon Sep 17 00:00:00 2001 From: Misa Date: Wed, 22 Dec 2021 00:58:27 -0800 Subject: [PATCH] Hide level path by default You will now need to go through another confirm menu in order to print your level path. The confirm menu warns you may leak sensitive information if you are streaming. Screenshots: https://i.imgur.com/0Dc9jsZ.png https://i.imgur.com/UhDgXqj.png https://i.imgur.com/Z0ftQnH.png Fixes #853. --- desktop_version/src/Game.cpp | 10 ++++++++++ desktop_version/src/Game.h | 2 ++ desktop_version/src/Input.cpp | 22 ++++++++++++++++++++++ desktop_version/src/Render.cpp | 27 ++++++++------------------- 4 files changed, 42 insertions(+), 19 deletions(-) diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index 8978f0b4..ecc9780b 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -5947,10 +5947,20 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ ) option("level editor"); #endif option("open level folder", FILESYSTEM_openDirectoryEnabled()); + option("show level folder path"); option("back to menu"); menuyoff = -40; maxspacing = 15; break; + case Menu::confirmshowlevelspath: + option("no, don't show me"); + option("yes, reveal the path"); + menuyoff = -10; + break; + case Menu::showlevelspath: + option("return to levels"); + menuyoff = 60; + break; case Menu::levellist: if(cl.ListOfMetaData.size()==0) { diff --git a/desktop_version/src/Game.h b/desktop_version/src/Game.h index 9832a52d..973766fe 100644 --- a/desktop_version/src/Game.h +++ b/desktop_version/src/Game.h @@ -37,6 +37,8 @@ namespace Menu { mainmenu, playerworlds, + confirmshowlevelspath, + showlevelspath, levellist, quickloadlevel, deletequicklevel, diff --git a/desktop_version/src/Input.cpp b/desktop_version/src/Input.cpp index 25538d53..cac975c9 100644 --- a/desktop_version/src/Input.cpp +++ b/desktop_version/src/Input.cpp @@ -567,6 +567,11 @@ static void menuactionpress(void) } break; case OFFSET+3: + music.playef(11); + game.createmenu(Menu::confirmshowlevelspath); + map.nexttowercolour(); + break; + case OFFSET+4: //back music.playef(11); game.returnmenu(); @@ -576,6 +581,23 @@ static void menuactionpress(void) #undef OFFSET break; #endif + case Menu::confirmshowlevelspath: + { + int prevmenuoption = game.currentmenuoption; /* returnmenu destroys this */ + music.playef(11); + game.returnmenu(); + map.nexttowercolour(); + if (prevmenuoption == 1) + { + game.createmenu(Menu::showlevelspath); + } + break; + } + case Menu::showlevelspath: + music.playef(11); + game.returntomenu(Menu::playerworlds); + map.nexttowercolour(); + break; case Menu::errornostart: music.playef(11); game.createmenu(Menu::mainmenu); diff --git a/desktop_version/src/Render.cpp b/desktop_version/src/Render.cpp index 3e558208..b378ddb6 100644 --- a/desktop_version/src/Render.cpp +++ b/desktop_version/src/Render.cpp @@ -1367,26 +1367,15 @@ static void menurender(void) graphics.Print( -1, 135, "the intermission levels.", tr, tg, tb, true); break; case Menu::playerworlds: - { - std::string tempstring = FILESYSTEM_getUserLevelDirectory(); - if(tempstring.length()>80){ - graphics.Print( -1, 160, "To install new player levels, copy", tr, tg, tb, true); - graphics.Print( -1, 170, "the .vvvvvv files to this folder:", tr, tg, tb, true); - graphics.Print( 320-((tempstring.length()-80)*8), 190, tempstring.substr(0,tempstring.length()-80), tr, tg, tb); - graphics.Print( 0, 200, tempstring.substr(tempstring.length()-80,40), tr, tg, tb); - graphics.Print( 0, 210, tempstring.substr(tempstring.length()-40,40), tr, tg, tb); - }else if(tempstring.length()>40){ - graphics.Print( -1, 170, "To install new player levels, copy", tr, tg, tb, true); - graphics.Print( -1, 180, "the .vvvvvv files to this folder:", tr, tg, tb, true); - graphics.Print( 320-((tempstring.length()-40)*8), 200, tempstring.substr(0,tempstring.length()-40), tr, tg, tb); - graphics.Print( 0, 210, tempstring.substr(tempstring.length()-40,40), tr, tg, tb); - }else{ - graphics.Print( -1, 180, "To install new player levels, copy", tr, tg, tb, true); - graphics.Print( -1, 190, "the .vvvvvv files to this folder:", tr, tg, tb, true); - graphics.Print( 320-(tempstring.length()*8), 210, tempstring, tr, tg, tb); - } + graphics.PrintWrap(-1, 180, "To install new player levels, copy the .vvvvvv files to the levels folder.", tr, tg, tb, true, 10, 304); + break; + case Menu::confirmshowlevelspath: + graphics.PrintWrap(-1, 80, "Are you sure you want to show the levels path? This may reveal sensitive information if you are streaming.", tr, tg, tb, true, 10, 304); + break; + case Menu::showlevelspath: + graphics.Print(-1, 40, "The levels path is:", tr, tg, tb, true); + graphics.PrintWrap(0, 60, FILESYSTEM_getUserLevelDirectory(), tr, tg, tb, false, 10, 320); break; - } case Menu::errorsavingsettings: graphics.Print( -1, 95, "ERROR: Could not save settings file!", tr, tg, tb, true); break;