Skip to content

Commit 1524166

Browse files
committed
usb: Reset device state back to sdmc if usb is unmounted
1 parent 091328a commit 1524166

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

source/popups/usbprompt.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
#include "config.hpp"
2+
#include "fs.hpp"
23
#include "imgui.h"
34
#include "language.hpp"
45
#include "popups.hpp"
56
#include "usb.hpp"
7+
#include "windows.hpp"
68

79
namespace Popups {
810
static bool done = false;
@@ -21,6 +23,20 @@ namespace Popups {
2123
if (ImGui::Button(strings[cfg.lang][Lang::ButtonOK], ImVec2(120, 0))) {
2224
if (!done) {
2325
USB::Unmount();
26+
27+
// Reset device back to sdmc
28+
device = "sdmc:";
29+
fs = std::addressof(devices[FileSystemSDMC]);
30+
31+
cwd = "/";
32+
data.entries.clear();
33+
FS::GetDirList(device, cwd, data.entries);
34+
35+
data.checkbox_data.checked.resize(data.entries.size());
36+
FS::GetUsedStorageSpace(data.used_storage);
37+
FS::GetTotalStorageSpace(data.total_storage);
38+
sort = -1;
39+
2440
ImGui::CloseCurrentPopup();
2541
done = true;
2642
}

0 commit comments

Comments
 (0)