diff --git a/src/xenia/app/emulator_window.cc b/src/xenia/app/emulator_window.cc index 333d854f7..98bb3bf5d 100644 --- a/src/xenia/app/emulator_window.cc +++ b/src/xenia/app/emulator_window.cc @@ -181,6 +181,11 @@ bool EmulatorWindow::Initialize() { file_menu->AddChild( MenuItem::Create(MenuItem::Type::kString, L"Close", 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", L"Alt+F4", [this]() { window_->Close(); })); @@ -251,16 +256,17 @@ bool EmulatorWindow::Initialize() { { help_menu->AddChild(MenuItem::Create( MenuItem::Type::kString, L"Build commit on GitHub...", [this]() { - std::string url = - std::string("https://github.com/benvanik/xenia/tree/") + - XE_BUILD_COMMIT + "/"; + std::wstring url = + std::wstring(L"https://github.com/xenia-project/xenia/tree/") + + xe::to_wstring(XE_BUILD_COMMIT) + L"/"; LaunchBrowser(url.c_str()); })); help_menu->AddChild(MenuItem::Create( MenuItem::Type::kString, L"Recent changes on GitHub...", [this]() { - std::string url = - std::string("https://github.com/benvanik/xenia/compare/") + - XE_BUILD_COMMIT + "..." + XE_BUILD_BRANCH; + std::wstring url = + std::wstring(L"https://github.com/xenia-project/xenia/compare/") + + xe::to_wstring(XE_BUILD_COMMIT) + L"..." + + xe::to_wstring(XE_BUILD_BRANCH); LaunchBrowser(url.c_str()); })); help_menu->AddChild(MenuItem::Create(MenuItem::Type::kSeparator)); @@ -269,7 +275,7 @@ bool EmulatorWindow::Initialize() { std::bind(&EmulatorWindow::ShowHelpWebsite, this))); help_menu->AddChild(MenuItem::Create( 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)); @@ -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() { if (!window_->is_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() { std::wstring title(base_title_); diff --git a/src/xenia/app/emulator_window.h b/src/xenia/app/emulator_window.h index 758f079f1..897bc2293 100644 --- a/src/xenia/app/emulator_window.h +++ b/src/xenia/app/emulator_window.h @@ -46,6 +46,7 @@ class EmulatorWindow { void FileDrop(wchar_t* filename); void FileOpen(); void FileClose(); + void ShowContentDirectory(); void CheckHideCursor(); void CpuTimeScalarReset(); void CpuTimeScalarSetHalf();