Skip to content

Commit ca9fcf4

Browse files
committed
Revert and improve some changes
1 parent 1294103 commit ca9fcf4

39 files changed

+378
-159
lines changed

Goldleaf/include/base.hpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,12 +213,19 @@ class ScopeGuard {
213213

214214
private:
215215
Fn exit_fn;
216+
bool call;
216217

217218
public:
218-
ScopeGuard(Fn fn) : exit_fn(fn) {}
219+
ScopeGuard(Fn fn) : exit_fn(fn), call(true) {}
219220

220221
~ScopeGuard() {
221-
this->exit_fn();
222+
if(this->call) {
223+
this->exit_fn();
224+
}
225+
}
226+
227+
inline void Cancel() {
228+
this->call = false;
222229
}
223230
};
224231

Goldleaf/include/ui/ui_BrowserLayout.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace ui {
4040
void ChangePartitionExplorer(fs::Explorer *exp, const bool update_contents = true);
4141
void ChangePartitionSdCard(const bool update_contents = true);
4242
void ChangePartitionNAND(const fs::Partition partition, const bool update_contents = true);
43-
void ChangePartitionPCDrive(const std::string &mount_name, const bool update_contents = true);
43+
void ChangePartitionRemotePcDrive(const std::string &mount_name, const bool update_contents = true);
4444
void ChangePartitionDrive(const UsbHsFsDevice &drv, const bool update_contents = true);
4545
void UpdateElements(const int idx = 0);
4646
void ResetMenuHead();

Goldleaf/include/ui/ui_ExploreMenuLayout.hpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ namespace ui {
3434
pu::ui::elm::Menu::Ref mounts_menu;
3535
pu::ui::elm::MenuItem::Ref sd_card_menu_item;
3636
std::vector<pu::ui::elm::MenuItem::Ref> usb_drive_menu_items;
37-
std::vector<PcSpecialPath> remote_pc_special_paths;
38-
std::vector<pu::ui::elm::MenuItem::Ref> remote_pc_special_menu_items;
39-
pu::ui::elm::MenuItem::Ref remote_pc_select_file_menu_item;
37+
pu::ui::elm::MenuItem::Ref remote_pc_explore_menu_item;
4038
std::unordered_map<fs::Explorer*, pu::ui::elm::MenuItem::Ref> mounted_explorer_items;
4139
pu::ui::elm::MenuItem::Ref nand_user_menu_item;
4240
pu::ui::elm::MenuItem::Ref nand_system_menu_item;
@@ -49,8 +47,7 @@ namespace ui {
4947
void OnSdCardSelected();
5048
void OnUsbDriveSelected(const UsbHsFsDevice drive);
5149
void OnUsbDriveSelectedX(const UsbHsFsDevice drive);
52-
void OnRemotePcSpecialPathSelected(const PcSpecialPath &path);
53-
void OnRemotePcSelectFileSelected();
50+
void OnRemotePcExploreSelected();
5451
void OnNandPartitionSelected(const fs::Partition partition);
5552
void OnMountedExplorerSelected(fs::Explorer *exp, const std::string &name, pu::sdl2::TextureHandle::Ref icon);
5653
void OnMountedExplorerSelectedX(fs::Explorer *exp);

Goldleaf/include/ui/ui_MainApplication.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include <ui/ui_MainMenuLayout.hpp>
3535
#include <ui/ui_MemoryLayout.hpp>
3636
#include <ui/ui_OwnSettingsLayout.hpp>
37+
#include <ui/ui_RemotePcExploreLayout.hpp>
3738
#include <ui/ui_BrowserLayout.hpp>
3839
#include <ui/ui_SettingsLayout.hpp>
3940
#include <ui/ui_TicketsLayout.hpp>
@@ -72,6 +73,7 @@ namespace ui {
7273
AmiiboDumpLayout::Ref amiibo_dump_lyt;
7374
SettingsLayout::Ref settings_lyt;
7475
OwnSettingsLayout::Ref own_settings_lyt;
76+
RemotePcExploreLayout::Ref remote_pc_explore_lyt;
7577
MemoryLayout::Ref memory_lyt;
7678
UpdateLayout::Ref update_lyt;
7779
UpdateInstallLayout::Ref update_install_lyt;
@@ -189,6 +191,10 @@ namespace ui {
189191
return this->own_settings_lyt;
190192
}
191193

194+
inline RemotePcExploreLayout::Ref &GetRemotePcExploreLayout() {
195+
return this->remote_pc_explore_lyt;
196+
}
197+
192198
inline MemoryLayout::Ref &GetMemoryLayout() {
193199
return this->memory_lyt;
194200
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
2+
/*
3+
4+
Goldleaf - Multipurpose homebrew tool for Nintendo Switch
5+
Copyright © 2018-2025 XorTroll
6+
7+
This program is free software: you can redistribute it and/or modify
8+
it under the terms of the GNU General Public License as published by
9+
the Free Software Foundation, either version 3 of the License, or
10+
(at your option) any later version.
11+
12+
This program is distributed in the hope that it will be useful,
13+
but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
GNU General Public License for more details.
16+
17+
You should have received a copy of the GNU General Public License
18+
along with this program. If not, see <https://www.gnu.org/licenses/>.
19+
20+
*/
21+
22+
#pragma once
23+
#include <ui/ui_Includes.hpp>
24+
25+
namespace ui {
26+
27+
class RemotePcExploreLayout : public pu::ui::Layout {
28+
private:
29+
std::vector<std::string> names;
30+
std::vector<std::string> paths;
31+
pu::ui::elm::Menu::Ref paths_menu;
32+
std::vector<pu::ui::elm::MenuItem::Ref> path_items;
33+
34+
void OnInput(const u64 keys_down, const u64 keys_up, const u64 keys_held, const pu::ui::TouchPoint touch_pos);
35+
36+
void OnPathSelected();
37+
void OnSelectFileSelected();
38+
39+
public:
40+
RemotePcExploreLayout();
41+
PU_SMART_CTOR(RemotePcExploreLayout)
42+
43+
Result Reload();
44+
};
45+
46+
}

Goldleaf/include/ui/ui_Utils.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ namespace ui {
6666
Update,
6767
USB,
6868
User,
69+
Pc,
6970

7071
Count
7172
};
@@ -80,4 +81,6 @@ namespace ui {
8081
void SetApplicationIcon(const u64 app_id, pu::sdl2::TextureHandle::Ref icon);
8182
pu::sdl2::TextureHandle::Ref GetApplicationIcon(const u64 app_id);
8283

84+
void SleepWhileRender(const u64 ns);
85+
8386
}

Goldleaf/romfs/Common/Pc.png

3.16 KB
Loading

Goldleaf/romfs/Strings/de.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,5 +514,10 @@
514514
"This version is more recent than the last release... this surely is a debug build, right?",
515515
"Delta fragment",
516516
"Clear logs",
517-
"Goldleaf logs were successfully cleared."
517+
"Goldleaf logs were successfully cleared.",
518+
"Browse PC drives and files via USB",
519+
"Filesystem type:",
520+
"Unmount drive",
521+
"The selected drive was successfully unmounted. You can now safely remove it.",
522+
"An error ocurred attempting to unmount the drive."
518523
]

Goldleaf/romfs/Strings/en-US.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,5 +514,10 @@
514514
"This version is more recent than the last release... this surely is a debug build, right?",
515515
"Delta fragment",
516516
"Clear logs",
517-
"Goldleaf logs were successfully cleared."
517+
"Goldleaf logs were successfully cleared.",
518+
"Browse PC drives and files via USB",
519+
"Filesystem type:",
520+
"Unmount drive",
521+
"The selected drive was successfully unmounted. You can now safely remove it.",
522+
"An error ocurred attempting to unmount the drive."
518523
]

Goldleaf/romfs/Strings/es.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,5 +514,10 @@
514514
"Esta versión es más reciente que el último lanzamiento... seguro que no es una versión de desarrollo, verdad?",
515515
"Fragmento delta",
516516
"Limpiar logs",
517-
"Los logs de Goldleaf fueron limpiados con éxito."
517+
"Los logs de Goldleaf fueron limpiados con éxito.",
518+
"Browse PC drives and files via USB",
519+
"Filesystem type:",
520+
"Unmount drive",
521+
"The selected drive was successfully unmounted. You can now safely remove it.",
522+
"An error ocurred attempting to unmount the drive."
518523
]

0 commit comments

Comments
 (0)