Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions Source/Core/DolphinLibretro/Boot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <fstream>

#include "Common/CommonPaths.h"
#include "Core/CommonTitles.h"
#include "Common/FileUtil.h"
#include "Common/Version.h"
#include "Core/Boot/Boot.h"
Expand Down Expand Up @@ -571,8 +572,34 @@ bool retro_load_game(const struct retro_game_info* game)
Libretro::GetOption<bool>(sysconf::WII_LOGI_MICROPHONE_ENABLE, /*def=*/false));
}

if (!BootManager::BootCore(Core::System::GetInstance(),
BootParameters::GenerateFromFile(normalized_game_paths), wsi))
const bool disc_based_games_boot_to_wii_menu = Libretro::GetOption<bool>(Libretro::Options::core::DISC_BASED_GAMES_BOOT_TO_WII_MENU, false);
std::unique_ptr<BootParameters> boot_params = BootParameters::GenerateFromFile(normalized_game_paths);

if (disc_based_games_boot_to_wii_menu)
{
bool is_disc_title = false;
if (!normalized_game_paths.empty())
{
auto volume = DiscIO::CreateDisc(normalized_game_paths.front());
if (volume && (volume->GetVolumeType() == DiscIO::Platform::WiiDisc || volume->GetVolumeType() == DiscIO::Platform::GameCubeDisc))
is_disc_title = true;
else
WARN_LOG_FMT(BOOT, "'Disc Based Games Boot to Wii System Menu' enabled but content is not a disc based game, ignoring Wii Menu");
}

const std::string wii_menu_tmd_file_name = Common::GetTMDFileName(Titles::SYSTEM_MENU, Common::FromWhichRoot::Configured);
const bool wii_menu_installed = File::Exists(wii_menu_tmd_file_name);
if (is_disc_title && !wii_menu_installed)
WARN_LOG_FMT(BOOT,"'Disc Based Games Boot to Wii System Menu' enabled but Wii Menu not found at save location: {}, booting directly instead", wii_menu_tmd_file_name);

if (is_disc_title && wii_menu_installed)
{
Config::SetBase(Config::MAIN_DEFAULT_ISO, normalized_game_paths.front());
boot_params = std::make_unique<BootParameters>(BootParameters::NANDTitle{Titles::SYSTEM_MENU});
}
}

if (!BootManager::BootCore(Core::System::GetInstance(), std::move(boot_params), wsi))
{
ERROR_LOG_FMT(BOOT, "Could not boot {}", game->path);
return false;
Expand Down
15 changes: 15 additions & 0 deletions Source/Core/DolphinLibretro/Common/Options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,21 @@ static struct retro_core_option_v2_definition option_defs[] = {
},
"enabled"
},
{
Libretro::Options::core::DISC_BASED_GAMES_BOOT_TO_WII_MENU,
"Core > Disc Based Games Boot to Wii Menu",
"Disc Based Games Boot to Wii System Menu",
"When a Wii System Menu is installed in the save location and the game is a disc based game, it will start the Wii Menu with the disc inserted in the drive instead of directly booting the game. "
"Beware: The game region must match the Wii Menu region otherwise the game will not be recognized.",
nullptr,
CATEGORY_CORE,
{
{"disabled", nullptr},
{"enabled", nullptr},
{nullptr, nullptr}
},
"disabled"
},
{
Libretro::Options::core::LANGUAGE,
"Core > System Language",
Expand Down
1 change: 1 addition & 0 deletions Source/Core/DolphinLibretro/Common/Options.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ namespace core {
constexpr const char CHEATS_ENABLED[] = "dolphin_cheats_enabled";
constexpr const char CHEATS_IMPORT[] = "dolphin_cheats_import";
constexpr const char SKIP_GC_BIOS[] = "dolphin_skip_gc_bios";
constexpr const char DISC_BASED_GAMES_BOOT_TO_WII_MENU[] = "dolphin_disc_based_games_boot_to_wii_menu";
constexpr const char LANGUAGE[] = "dolphin_language";
constexpr const char FAST_DISC_SPEED[] = "dolphin_fast_disc_speed";
constexpr const char MAIN_MMU[] = "dolphin_main_mmu";
Expand Down
Loading