mirror of
https://github.com/xenia-project/xenia.git
synced 2025-12-06 07:12:03 +01:00
[App] Add "Show content directory..." menu item.
This commit is contained in:
parent
2c3207e5cc
commit
cfa0a40343
|
|
@ -181,6 +181,11 @@ bool EmulatorWindow::Initialize() {
|
||||||
file_menu->AddChild(
|
file_menu->AddChild(
|
||||||
MenuItem::Create(MenuItem::Type::kString, L"Close",
|
MenuItem::Create(MenuItem::Type::kString, L"Close",
|
||||||
std::bind(&EmulatorWindow::FileClose, this)));
|
std::bind(&EmulatorWindow::FileClose, this)));
|
||||||
|
file_menu->AddChild(MenuItem::Create(MenuItem::Type::kSeparator));
|
||||||
|
file_menu->AddChild(MenuItem::Create(
|
||||||
|
MenuItem::Type::kString, L"Show content directory...",
|
||||||
|
std::bind(&EmulatorWindow::ShowContentDirectory, this)));
|
||||||
|
file_menu->AddChild(MenuItem::Create(MenuItem::Type::kSeparator));
|
||||||
file_menu->AddChild(MenuItem::Create(MenuItem::Type::kString, L"E&xit",
|
file_menu->AddChild(MenuItem::Create(MenuItem::Type::kString, L"E&xit",
|
||||||
L"Alt+F4",
|
L"Alt+F4",
|
||||||
[this]() { window_->Close(); }));
|
[this]() { window_->Close(); }));
|
||||||
|
|
@ -251,16 +256,17 @@ bool EmulatorWindow::Initialize() {
|
||||||
{
|
{
|
||||||
help_menu->AddChild(MenuItem::Create(
|
help_menu->AddChild(MenuItem::Create(
|
||||||
MenuItem::Type::kString, L"Build commit on GitHub...", [this]() {
|
MenuItem::Type::kString, L"Build commit on GitHub...", [this]() {
|
||||||
std::string url =
|
std::wstring url =
|
||||||
std::string("https://github.com/benvanik/xenia/tree/") +
|
std::wstring(L"https://github.com/xenia-project/xenia/tree/") +
|
||||||
XE_BUILD_COMMIT + "/";
|
xe::to_wstring(XE_BUILD_COMMIT) + L"/";
|
||||||
LaunchBrowser(url.c_str());
|
LaunchBrowser(url.c_str());
|
||||||
}));
|
}));
|
||||||
help_menu->AddChild(MenuItem::Create(
|
help_menu->AddChild(MenuItem::Create(
|
||||||
MenuItem::Type::kString, L"Recent changes on GitHub...", [this]() {
|
MenuItem::Type::kString, L"Recent changes on GitHub...", [this]() {
|
||||||
std::string url =
|
std::wstring url =
|
||||||
std::string("https://github.com/benvanik/xenia/compare/") +
|
std::wstring(L"https://github.com/xenia-project/xenia/compare/") +
|
||||||
XE_BUILD_COMMIT + "..." + XE_BUILD_BRANCH;
|
xe::to_wstring(XE_BUILD_COMMIT) + L"..." +
|
||||||
|
xe::to_wstring(XE_BUILD_BRANCH);
|
||||||
LaunchBrowser(url.c_str());
|
LaunchBrowser(url.c_str());
|
||||||
}));
|
}));
|
||||||
help_menu->AddChild(MenuItem::Create(MenuItem::Type::kSeparator));
|
help_menu->AddChild(MenuItem::Create(MenuItem::Type::kSeparator));
|
||||||
|
|
@ -269,7 +275,7 @@ bool EmulatorWindow::Initialize() {
|
||||||
std::bind(&EmulatorWindow::ShowHelpWebsite, this)));
|
std::bind(&EmulatorWindow::ShowHelpWebsite, this)));
|
||||||
help_menu->AddChild(MenuItem::Create(
|
help_menu->AddChild(MenuItem::Create(
|
||||||
MenuItem::Type::kString, L"&About...",
|
MenuItem::Type::kString, L"&About...",
|
||||||
[this]() { LaunchBrowser("https://xenia.jp/about/"); }));
|
[this]() { LaunchBrowser(L"https://xenia.jp/about/"); }));
|
||||||
}
|
}
|
||||||
main_menu->AddChild(std::move(help_menu));
|
main_menu->AddChild(std::move(help_menu));
|
||||||
|
|
||||||
|
|
@ -331,6 +337,27 @@ void EmulatorWindow::FileClose() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EmulatorWindow::ShowContentDirectory() {
|
||||||
|
std::wstring target_path;
|
||||||
|
|
||||||
|
auto content_root = emulator_->content_root();
|
||||||
|
if (!emulator_->is_title_open() || !emulator_->kernel_state()) {
|
||||||
|
target_path = content_root;
|
||||||
|
} else {
|
||||||
|
// TODO(gibbed): expose this via ContentManager?
|
||||||
|
wchar_t title_id[9] = L"00000000";
|
||||||
|
std::swprintf(title_id, 9, L"%.8X", emulator_->kernel_state()->title_id());
|
||||||
|
auto package_root = xe::join_paths(content_root, title_id);
|
||||||
|
target_path = package_root;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!xe::filesystem::PathExists(target_path)) {
|
||||||
|
xe::filesystem::CreateFolder(target_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
LaunchBrowser(target_path.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
void EmulatorWindow::CheckHideCursor() {
|
void EmulatorWindow::CheckHideCursor() {
|
||||||
if (!window_->is_fullscreen()) {
|
if (!window_->is_fullscreen()) {
|
||||||
// Only hide when fullscreen.
|
// Only hide when fullscreen.
|
||||||
|
|
@ -395,7 +422,7 @@ void EmulatorWindow::ToggleFullscreen() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmulatorWindow::ShowHelpWebsite() { LaunchBrowser("https://xenia.jp"); }
|
void EmulatorWindow::ShowHelpWebsite() { LaunchBrowser(L"https://xenia.jp"); }
|
||||||
|
|
||||||
void EmulatorWindow::UpdateTitle() {
|
void EmulatorWindow::UpdateTitle() {
|
||||||
std::wstring title(base_title_);
|
std::wstring title(base_title_);
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ class EmulatorWindow {
|
||||||
void FileDrop(wchar_t* filename);
|
void FileDrop(wchar_t* filename);
|
||||||
void FileOpen();
|
void FileOpen();
|
||||||
void FileClose();
|
void FileClose();
|
||||||
|
void ShowContentDirectory();
|
||||||
void CheckHideCursor();
|
void CheckHideCursor();
|
||||||
void CpuTimeScalarReset();
|
void CpuTimeScalarReset();
|
||||||
void CpuTimeScalarSetHalf();
|
void CpuTimeScalarSetHalf();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue