Refactor some firmware-related config

- Built-in firmware can no longer be used in DSi mode
- Change terminology of boot mode and BIOS/firmware mode
- Revise or remove tests to reflect these changes
This commit is contained in:
Jesse Talavera-Greenberg 2023-09-25 14:12:05 -04:00
parent 7dd1cce1e0
commit 35746cbe22
4 changed files with 139 additions and 268 deletions

View File

@ -291,11 +291,11 @@ namespace melonds::config {
static melonds::ConsoleType _consoleType;
melonds::ConsoleType ConsoleType() noexcept { return _consoleType; }
static bool _directBoot;
bool DirectBoot() noexcept { return _directBoot; }
static BootMode _bootMode;
bool DirectBoot() noexcept { return _bootMode == BootMode::Direct; }
static bool _externalBiosEnable;
bool ExternalBiosEnable() noexcept { return _externalBiosEnable; }
static SysfileMode _sysfileMode;
bool ExternalBiosEnable() noexcept { return _sysfileMode == SysfileMode::Native; }
static unsigned _dsPowerOkayThreshold = 20;
unsigned DsPowerOkayThreshold() noexcept { return _dsPowerOkayThreshold; }
@ -667,18 +667,18 @@ static void melonds::config::parse_system_options() noexcept {
_consoleType = ConsoleType::DS;
}
if (optional<bool> value = ParseBoolean(get_variable(BOOT_DIRECTLY))) {
_directBoot = *value;
if (optional<BootMode> value = ParseBootMode(get_variable(BOOT_MODE))) {
_bootMode = *value;
} else {
retro::warn("Failed to get value for %s; defaulting to %s", BOOT_DIRECTLY, values::ENABLED);
_directBoot = true;
retro::warn("Failed to get value for %s; defaulting to %s", BOOT_MODE, values::NATIVE);
_bootMode = BootMode::Direct;
}
if (optional<bool> value = ParseBoolean(get_variable(USE_EXTERNAL_BIOS))) {
_externalBiosEnable = *value;
if (optional<SysfileMode> value = ParseSysfileMode(get_variable(SYSFILE_MODE))) {
_sysfileMode = *value;
} else {
retro::warn("Failed to get value for %s; defaulting to %s", USE_EXTERNAL_BIOS, values::ENABLED);
_externalBiosEnable = true;
retro::warn("Failed to get value for %s; defaulting to %s", SYSFILE_MODE, values::BUILT_IN);
_sysfileMode = SysfileMode::BuiltIn;
}
if (optional<unsigned> value = ParseIntegerInList(get_variable(DS_POWER_OK), DS_POWER_OK_THRESHOLDS)) {
@ -1304,7 +1304,7 @@ static void CustomizeFirmware(SPI_Firmware::Firmware& firmware) {
// Then, fall back to other system files if needed and possible
// If fallback is needed and not possible, throw an exception
// Finally, install the system files
static void InitNdsSystemConfig(const NDSHeader* header, bool tryNativeBios) {
static void InitNdsSystemConfig(const NDSHeader* header, melonds::BootMode bootMode, melonds::SysfileMode sysfileMode) {
ZoneScopedN("melonds::config::InitNdsSystemConfig");
using namespace melonds::config::system;
using namespace melonds;
@ -1312,11 +1312,10 @@ static void InitNdsSystemConfig(const NDSHeader* header, bool tryNativeBios) {
// The rules are somewhat complicated.
// - Bootable firmware is required if booting without content.
// - Both BIOS files must be native or both must be built-in.
// - All system files must be native or all must be built-in. (No mixing.)
// - If BIOS files are built-in, then Direct Boot mode must be used
string_view firmwareName = FirmwarePath();
unique_ptr<SPI_Firmware::Firmware> firmware;
if (firmwareName != melonds::config::values::BUILT_IN) {
if (sysfileMode == SysfileMode::Native) {
optional<string> firmwarePath = retro::get_system_path(FirmwarePath());
if (!firmwarePath) {
retro::error("Failed to get system directory");
@ -1325,41 +1324,40 @@ static void InitNdsSystemConfig(const NDSHeader* header, bool tryNativeBios) {
firmware = firmwarePath ? LoadFirmware(*firmwarePath) : nullptr;
}
if (!header && !(firmware && firmware->IsBootable())) {
// If we're trying to boot into the NDS menu, but the firmware we loaded isn't bootable...
// If we're trying to boot into the NDS menu, but we didn't load bootable firmware...
throw bios_exception("Booting to the NDS menu requires a bootable firmware dump.");
}
if (!firmware) {
// If we haven't loaded any firmware...
if (firmwareName != melonds::config::values::BUILT_IN) {
if (sysfileMode == SysfileMode::Native) {
// ...but we were trying to...
retro::warn("Falling back to built-in firmware");
}
firmware = make_unique<SPI_Firmware::Firmware>(static_cast<int>(melonds::ConsoleType::DS));
}
if (!tryNativeBios) {
if (sysfileMode == SysfileMode::BuiltIn) {
retro::debug("Not loading native ARM BIOS files");
}
// Try to load the ARM7 and ARM9 BIOS files (but don't bother with the ARM9 BIOS if the ARM7 BIOS failed)
unique_ptr<u8[]> bios7 = tryNativeBios ? LoadBios(Bios7Path(), "ARM7", sizeof(NDS::ARM7BIOS)) : nullptr;
unique_ptr<u8[]> bios7 = (sysfileMode == SysfileMode::Native) ? LoadBios(Bios7Path(), "ARM7", sizeof(NDS::ARM7BIOS)) : nullptr;
unique_ptr<u8[]> bios9 = bios7 ? LoadBios(Bios9Path(), "ARM9", sizeof(NDS::ARM9BIOS)) : nullptr;
if (tryNativeBios && !(bios7 && bios9)) {
if (sysfileMode == SysfileMode::Native && !(bios7 && bios9)) {
// If we're trying to load native BIOS files, but at least one of them failed...
retro::warn("Falling back to FreeBIOS");
}
// Now that we've loaded the system files, let's see if we can use them
if (!_directBoot && (!bios7 || !bios9 || !firmware->IsBootable())) {
if (bootMode == melonds::BootMode::Native && (!bios7 || !bios9 || !firmware->IsBootable())) {
// If we want to try a native boot, but the BIOS files aren't all native or the firmware isn't bootable...
retro::warn("Native boot requires bootable firmware and native BIOS files; forcing Direct Boot mode");
_directBoot = true;
_bootMode = melonds::BootMode::Direct;
}
if (!header && (!firmware || !firmware->IsBootable() || !bios7 || !bios9)) {
@ -1399,17 +1397,15 @@ static void InitDsiSystemConfig() {
}
// TODO: Actually open the NAND file and keep it around
int statFlags = path_stat(nandPath->c_str());
if ((statFlags & RETRO_VFS_STAT_IS_VALID) == 0) {
int nandStatFlags = path_stat(nandPath->c_str());
if ((nandStatFlags & RETRO_VFS_STAT_IS_VALID) == 0) {
// If this isn't a valid file...
throw bios_exception("Failed to find a DSi NAND image at \"%s\"", nandPath->c_str());
}
#ifndef NDEBUG
// If it weren't a regular file, it would've never been added to the config options
retro_assert((statFlags & RETRO_VFS_STAT_IS_DIRECTORY) == 0);
retro_assert((statFlags & RETRO_VFS_STAT_IS_CHARACTER_SPECIAL) == 0);
#endif
retro_assert((nandStatFlags & RETRO_VFS_STAT_IS_DIRECTORY) == 0);
retro_assert((nandStatFlags & RETRO_VFS_STAT_IS_CHARACTER_SPECIAL) == 0);
// DSi mode requires all native BIOS files
unique_ptr<u8[]> bios7i = LoadBios(DsiBios7Path(), "DSi ARM7", sizeof(DSi::ARM7iBIOS));
@ -1433,27 +1429,19 @@ static void InitDsiSystemConfig() {
}
string_view firmwareName = DsiFirmwarePath();
unique_ptr<SPI_Firmware::Firmware> firmware;
if (firmwareName != melonds::config::values::BUILT_IN) {
optional<string> firmwarePath = retro::get_system_path(firmwareName);
retro_assert(firmwarePath.has_value());
// If we couldn't get the system directory, we wouldn't have gotten this far
optional<string> firmwarePath = retro::get_system_path(firmwareName);
retro_assert(firmwarePath.has_value());
// If we couldn't get the system directory, we wouldn't have gotten this far
firmware = LoadFirmware(*firmwarePath);
if (firmware && firmware->Header().ConsoleType != SPI_Firmware::FirmwareConsoleType::DSi) {
retro::warn("Expected firmware of type DSi, got %s", ConsoleTypeName(firmware->Header().ConsoleType).data());
firmware = nullptr;
}
// DSi firmware isn't bootable, so we don't need to check for that here.
if (!firmware) {
retro::warn("Falling back to built-in DSi firmware");
}
unique_ptr<SPI_Firmware::Firmware> firmware = LoadFirmware(*firmwarePath);
if (firmware && firmware->Header().ConsoleType != SPI_Firmware::FirmwareConsoleType::DSi) {
retro::warn("Expected firmware of type DSi, got %s", ConsoleTypeName(firmware->Header().ConsoleType).data());
firmware = nullptr;
}
// DSi firmware isn't bootable, so we don't need to check for that here.
if (!firmware) {
// If we haven't loaded any firmware...
firmware = make_unique<SPI_Firmware::Firmware>(static_cast<int>(melonds::ConsoleType::DSi));
throw bios_exception("Failed to load DSi BIOS file");
}
memcpy(DSi::ARM9iBIOS, bios9i.get(), sizeof(DSi::ARM9iBIOS));
@ -1483,7 +1471,7 @@ static void melonds::config::apply_system_options(const NDSHeader* header) {
InitDsiSystemConfig();
} else {
// If we're in DS mode...
InitNdsSystemConfig(header, _externalBiosEnable);
InitNdsSystemConfig(header, _bootMode, _sysfileMode);
}
}
@ -1666,18 +1654,16 @@ static void melonds::config::set_core_options() noexcept {
retro_assert(firmwarePathOption != definitions.end());
retro_assert(firmwarePathDsiOption != definitions.end());
// Keep the first element, it's for built-in firmware
// We subtract 2 because we need room for the terminating element and the built-in firmware
int length = std::min((int)firmwarePaths.size(), (int)RETRO_NUM_CORE_OPTION_VALUES_MAX - 2);
int length = std::min((int)firmwarePaths.size(), (int)RETRO_NUM_CORE_OPTION_VALUES_MAX - 1);
for (int i = 0; i < length; ++i) {
retro::debug("Found a firmware image at \"%s\"", firmwarePaths[i].c_str());
string_view path = firmwarePaths[i];
path.remove_prefix(sysdir->size() + 1);
firmwarePathOption->values[i + 1] = { path.data(), nullptr };
firmwarePathDsiOption->values[i + 1] = { path.data(), nullptr };
firmwarePathOption->values[i] = { path.data(), nullptr };
firmwarePathDsiOption->values[i] = { path.data(), nullptr };
}
firmwarePathOption->values[length + 2] = { nullptr, nullptr };
firmwarePathDsiOption->values[length + 2] = { nullptr, nullptr };
firmwarePathOption->values[length + 1] = { nullptr, nullptr };
firmwarePathDsiOption->values[length + 1] = { nullptr, nullptr };
firmwarePathOption->default_value = firmwarePathOption->values[0].value;
firmwarePathDsiOption->default_value = firmwarePathDsiOption->values[0].value;

View File

@ -116,13 +116,13 @@ namespace melonds::config {
namespace system {
static constexpr const char *const CATEGORY = "system";
static constexpr const char *const BATTERY_UPDATE_INTERVAL = "melonds_battery_update_interval";
static constexpr const char *const BOOT_DIRECTLY = "melonds_boot_directly";
static constexpr const char *const BOOT_MODE = "melonds_boot_mode";
static constexpr const char *const CONSOLE_MODE = "melonds_console_mode";
static constexpr const char *const DS_POWER_OK = "melonds_ds_battery_ok_threshold";
static constexpr const char *const FIRMWARE_PATH = "melonds_firmware_nds_path";
static constexpr const char *const FIRMWARE_DSI_PATH = "melonds_firmware_dsi_path";
static constexpr const char *const OVERRIDE_FIRMWARE_SETTINGS = "melonds_override_fw_settings";
static constexpr const char *const USE_EXTERNAL_BIOS = "melonds_use_external_bios";
static constexpr const char *const SYSFILE_MODE = "melonds_sysfile_mode";
}
namespace storage {
@ -166,7 +166,7 @@ namespace melonds::config {
static constexpr const char *const BOTTOM_TOP = "bottom-top";
static constexpr const char *const BOTH = "both";
static constexpr const char *const BOTTOM = "bottom";
static constexpr const char *const BUILT_IN = "/builtin"; // leading slash so it's not a valid filename
static constexpr const char *const BUILT_IN = "builtin";
static constexpr const char *const COSINE = "cosine";
static constexpr const char *const CUBIC = "cubic";
static constexpr const char *const DEDICATED = "dedicated";

View File

@ -30,17 +30,20 @@ namespace melonds::config::definitions {
"Console Type",
nullptr,
"Whether melonDS should emulate a Nintendo DS or a Nintendo DSi. "
"DSi mode requires a native DSi NAND image "
"DSi mode requires a native DSi NAND image, "
"a native DSi firmware image, "
"and native BIOS images for the DS and DSi. "
"Place them in the system directory or its \"melonDS DS\" subdirectory "
" and name them as follows:\n"
"\n"
"- DS BIOS: bios7.bin, bios9.bin\n"
"- DSi BIOS: dsi_bios7.bin, dsi_bios9.bin\n"
"- DSi firmware: Anything, set it with the \"DSi Firmware\" option.\n"
"- DSi NAND: Anything, set it with the \"DSi NAND Path\" option.\n"
"\n"
"Ignored if loading a DSiWare game (DSi mode will be forced). "
"Some features may not be available in DSi mode. "
"Some features are not available in DSi mode. "
"If unsure, set to DS mode unless playing a DSi game."
"Changes take effect at the next restart.",
nullptr,
config::system::CATEGORY,
@ -52,43 +55,54 @@ namespace melonds::config::definitions {
melonds::config::values::DS
},
retro_core_option_v2_definition {
config::system::BOOT_DIRECTLY,
"Boot Game Directly",
config::system::BOOT_MODE,
"Boot Mode",
nullptr,
"If enabled, melonDS will bypass the native DS menu and boot the loaded game directly. "
"If disabled, native BIOS and firmware files must be provided in the system directory. "
"Ignored if any of the following is true:\n"
"Determines how melonDS boots games.\n"
"\n"
"- The core is loaded without a game\n"
"- Native BIOS/firmware files weren't found\n"
"- The loaded game is a DSiWare game\n",
"Native: Load games through the system menu, "
"similar to the real DS/DSi boot process. "
"Requires native BIOS and firmware files in the system directory.\n"
"Direct: Skip the system menu and go straight to the game. "
"Required if native BIOS/firmware isn't available.\n"
"\n"
"Ignored if loaded without a game, "
"the loaded game is DSiWare, "
"or native BIOS/firmware files weren't found. "
"Changes take effect at next restart.",
nullptr,
config::system::CATEGORY,
{
{melonds::config::values::DISABLED, nullptr},
{melonds::config::values::ENABLED, nullptr},
{melonds::config::values::DIRECT, "Direct"},
{melonds::config::values::NATIVE, "Native"},
{nullptr, nullptr},
},
melonds::config::values::ENABLED
melonds::config::values::DIRECT
},
retro_core_option_v2_definition {
config::system::USE_EXTERNAL_BIOS,
"Use native BIOS if available",
config::system::SYSFILE_MODE,
"BIOS/Firmware Mode",
nullptr,
"Use native BIOS files from the \"melonDS DS\" folder in the system directory if enabled and available, "
"falling back to the built-in FreeBIOS if not. "
"DS mode only; DSi mode and GBA connectivity each require a native BIOS. "
"Does not affect firmware. "
"Changes take effect at the next restart. "
"If unsure, leave this enabled.",
"Determines whether melonDS uses native BIOS/firmware dumps "
"or its own built-in replacements.\n"
"\n"
"Native: Use the same BIOS and firmware files that would be used on a real DS. "
"Place these in the system directory or its \"melonDS DS\" subdirectory. "
"Falls back to Built-In if any BIOS/firmware file isn't found."
"Built-In: Use melonDS's built-in BIOS and firmware. "
"Suitable for most games, "
"but some features (notably GBA connectivity and the DS menu) are not available.\n"
"\n"
"Ignored in DSi mode, as that requires native BIOS and firmware files. "
"Changes take effect at next restart.",
nullptr,
melonds::config::system::CATEGORY,
{
{melonds::config::values::DISABLED, nullptr},
{melonds::config::values::ENABLED, nullptr},
{melonds::config::values::NATIVE, "Native (or Fallback)"},
{melonds::config::values::BUILT_IN, "Built-In"},
{nullptr, nullptr},
},
melonds::config::values::ENABLED
melonds::config::values::NATIVE
},
retro_core_option_v2_definition {
config::system::FIRMWARE_PATH,
@ -100,19 +114,17 @@ namespace melonds::config::definitions {
"- Placed inside the frontend's system directory, or a subdirectory named \"melonDS DS\".\n"
"- Exactly 131,072 bytes (128KB), 262,144 bytes (256KB), or 524,288 bytes (512KB).\n"
"\n"
"Defaults to Built-In if no firmware image is available. "
"Built-In firmware cannot be booted and lacks GBA connectivity support. "
"Nintendo WFC IDs are saved to firmware, "
"so switching firmware images may result in the loss of some WFC data. "
"Ignored in DSi mode. "
"Ignored in DSi mode or if BIOS/Firmware Mode is Built-In."
"Changes take effect at next restart.",
nullptr,
config::system::CATEGORY,
{
{melonds::config::values::BUILT_IN, "Built-In"},
{melonds::config::values::NOT_FOUND, "None found..."},
{nullptr, nullptr},
},
melonds::config::values::BUILT_IN
melonds::config::values::NOT_FOUND
},
retro_core_option_v2_definition {
config::system::FIRMWARE_DSI_PATH,
@ -124,25 +136,24 @@ namespace melonds::config::definitions {
"- Placed inside the frontend's system directory, or a subdirectory named \"melonDS DS\".\n"
"- Exactly 131,072 bytes (128KB), 262,144 bytes (256KB), or 524,288 bytes (512KB).\n"
"\n"
"Defaults to Built-In if no firmware image is available. "
"Built-In firmware cannot be booted. "
"Nintendo WFC IDs are saved to firmware, "
"so switching firmware images may result in the loss of some WFC data. "
"Ignored in DS mode. "
"DSi mode only. "
"Changes take effect at next restart.",
nullptr,
config::system::CATEGORY,
{
{melonds::config::values::BUILT_IN, "Built-In"},
{melonds::config::values::NOT_FOUND, "None found..."},
{nullptr, nullptr},
},
melonds::config::values::BUILT_IN
melonds::config::values::NOT_FOUND
},
retro_core_option_v2_definition {
config::system::BATTERY_UPDATE_INTERVAL,
"Battery Update Interval",
nullptr,
"How often the emulated console's battery should be updated.",
"How often the emulated console's battery should be updated. "
"Ignored if the frontend can't get the device's battery level.",
nullptr,
config::system::CATEGORY,
{

View File

@ -223,15 +223,14 @@ add_emutest_test(
)
# See https://github.com/JesseTG/melonds-ds/issues/70
add_emutest_test(
add_retroarch_test(
NAME "Core unloads with threaded software rendering"
CONTENT "${NDS_ROM}"
TEST_SCRIPT "loads-core.lua"
CORE_OPTION melonds_boot_directly="enabled"
CORE_OPTION melonds_use_external_bios="disabled"
CORE_OPTION melonds_firmware_nds_path="/builtin"
CORE_OPTION melonds_console_mode="ds"
CORE_OPTION melonds_threaded_renderer="enabled"
MAX_FRAMES 6
CORE_OPTION "melonds_boot_mode=direct"
CORE_OPTION "melonds_sysfile_mode=builtin"
CORE_OPTION "melonds_console_mode=ds"
CORE_OPTION "melonds_threaded_renderer=enabled"
)
# See https://github.com/JesseTG/melonds-ds/issues/62
@ -239,10 +238,9 @@ add_emutest_test(
NAME "Core resets when using built-in system files and direct boot (NDS)"
CONTENT "${NDS_ROM}"
TEST_SCRIPT "no-hang-on-reboot.lua"
CORE_OPTION melonds_boot_directly="enabled"
CORE_OPTION melonds_boot_mode="direct"
CORE_OPTION melonds_show_cursor="disabled"
CORE_OPTION melonds_use_external_bios="disabled"
CORE_OPTION melonds_firmware_nds_path="/builtin"
CORE_OPTION melonds_sysfile_mode="builtin"
CORE_OPTION melonds_console_mode="ds"
)
@ -254,8 +252,8 @@ add_emutest_test(
ARM9_BIOS
NDS_FIRMWARE
CORE_OPTION melonds_firmware_nds_path='melonDS DS/${NDS_FIRMWARE_NAME}'
CORE_OPTION melonds_boot_directly="enabled"
CORE_OPTION melonds_use_external_bios="enabled"
CORE_OPTION melonds_boot_mode="direct"
CORE_OPTION melonds_sysfile_mode="native"
CORE_OPTION melonds_show_cursor="disabled"
CORE_OPTION melonds_console_mode="ds"
)
@ -268,8 +266,8 @@ add_emutest_test(
ARM9_BIOS
NDS_FIRMWARE
CORE_OPTION melonds_firmware_nds_path="melonDS DS/${NDS_FIRMWARE_NAME}"
CORE_OPTION melonds_boot_directly="disabled"
CORE_OPTION melonds_use_external_bios="enabled"
CORE_OPTION melonds_boot_mode="native"
CORE_OPTION melonds_sysfile_mode="native"
CORE_OPTION melonds_show_cursor="disabled"
)
@ -286,8 +284,8 @@ add_emutest_test(
CORE_OPTION melonds_firmware_dsi_path="melonDS DS/${DSI_FIRMWARE_NAME}"
CORE_OPTION melonds_dsi_nand_path="melonDS DS/${DSI_NAND_NAME}"
CORE_OPTION melonds_console_mode="dsi"
CORE_OPTION melonds_boot_directly="enabled"
CORE_OPTION melonds_use_external_bios="enabled"
CORE_OPTION melonds_boot_mode="direct"
CORE_OPTION melonds_sysfile_mode="native"
CORE_OPTION melonds_show_cursor="disabled"
)
@ -304,42 +302,8 @@ add_emutest_test(
CORE_OPTION melonds_firmware_dsi_path="melonDS DS/${DSI_FIRMWARE_NAME}"
CORE_OPTION melonds_console_mode="dsi"
CORE_OPTION melonds_dsi_nand_path="melonDS DS/${DSI_NAND_NAME}"
CORE_OPTION melonds_boot_directly="disabled"
CORE_OPTION melonds_use_external_bios="enabled"
CORE_OPTION melonds_show_cursor="disabled"
)
add_emutest_test(
NAME "Core resets when using native BIOS files, generated firmware, and direct boot (DSi)"
CONTENT "${NDS_ROM}"
TEST_SCRIPT "no-hang-on-reboot.lua"
ARM7_BIOS
ARM9_BIOS
ARM7_DSI_BIOS
ARM9_DSI_BIOS
DSI_NAND
CORE_OPTION melonds_firmware_dsi_path="/builtin"
CORE_OPTION melonds_console_mode="dsi"
CORE_OPTION melonds_dsi_nand_path="melonDS DS/${DSI_NAND_NAME}"
CORE_OPTION melonds_boot_directly="enabled"
CORE_OPTION melonds_use_external_bios="enabled"
CORE_OPTION melonds_show_cursor="disabled"
)
add_emutest_test(
NAME "Core resets when using native BIOS files, generated firmware, and native boot (DSi)"
CONTENT "${NDS_ROM}"
TEST_SCRIPT "no-hang-on-reboot.lua"
ARM7_BIOS
ARM9_BIOS
ARM7_DSI_BIOS
ARM9_DSI_BIOS
DSI_NAND
CORE_OPTION melonds_firmware_dsi_path="/builtin"
CORE_OPTION melonds_console_mode="dsi"
CORE_OPTION melonds_dsi_nand_path="melonDS DS/${DSI_NAND_NAME}"
CORE_OPTION melonds_boot_directly="disabled"
CORE_OPTION melonds_use_external_bios="enabled"
CORE_OPTION melonds_boot_mode="native"
CORE_OPTION melonds_sysfile_mode="native"
CORE_OPTION melonds_show_cursor="disabled"
)
@ -352,42 +316,12 @@ add_retroarch_test(
### Preventing Unneeded Loads
add_retroarch_test(
NAME "Core doesn't try to load native firmware if using built-in firmware (NDS)"
CONTENT "${NDS_ROM}"
MAX_FRAMES 6
CORE_OPTION "melonds_console_mode=ds"
CORE_OPTION "melonds_use_external_bios=disabled"
CORE_OPTION "melonds_firmware_nds_path=/builtin"
FAIL_REGULAR_EXPRESSION "[\\/]/builtin"
# "/builtin" is the value used to indicate the built-in firmware
# chosen because it's unlikely to be a valid path
)
add_retroarch_test(
NAME "Core doesn't try to load native firmware if using built-in firmware (DSi)"
CONTENT "${NDS_ROM}"
MAX_FRAMES 6
CORE_OPTION "melonds_console_mode=dsi"
CORE_OPTION "melonds_firmware_dsi_path=/builtin"
CORE_OPTION "melonds_dsi_nand_path=melonDS DS/${DSI_NAND_NAME}"
ARM7_BIOS
ARM9_BIOS
ARM7_DSI_BIOS
ARM9_DSI_BIOS
DSI_NAND
FAIL_REGULAR_EXPRESSION "[\\/]/builtin"
# "/builtin" is the value used to indicate the built-in firmware
# chosen because it's unlikely to be a valid path
)
add_retroarch_test(
NAME "Core doesn't try to load native BIOS if using FreeBIOS (NDS)"
CONTENT "${NDS_ROM}"
MAX_FRAMES 6
CORE_OPTION "melonds_console_mode=ds"
CORE_OPTION "melonds_use_external_bios=disabled"
CORE_OPTION "melonds_firmware_nds_path=/builtin"
CORE_OPTION "melonds_sysfile_mode=builtin"
PASS_REGULAR_EXPRESSION "Not loading native ARM BIOS files"
)
@ -398,9 +332,8 @@ add_retroarch_test(
CONTENT "${NDS_ROM}"
MAX_FRAMES 6
CORE_OPTION "melonds_console_mode=ds"
CORE_OPTION "melonds_use_external_bios=enabled"
CORE_OPTION "melonds_boot_directly=enabled"
CORE_OPTION "melonds_firmware_nds_path=/builtin"
CORE_OPTION "melonds_sysfile_mode=native"
CORE_OPTION "melonds_boot_mode=direct"
ARM9_BIOS
PASS_REGULAR_EXPRESSION "Falling back to FreeBIOS"
)
@ -410,9 +343,8 @@ add_retroarch_test(
CONTENT "${NDS_ROM}"
MAX_FRAMES 6
CORE_OPTION "melonds_console_mode=ds"
CORE_OPTION "melonds_use_external_bios=enabled"
CORE_OPTION "melonds_boot_directly=enabled"
CORE_OPTION "melonds_firmware_nds_path=/builtin"
CORE_OPTION "melonds_sysfile_mode=native"
CORE_OPTION "melonds_boot_mode=direct"
ARM7_BIOS
PASS_REGULAR_EXPRESSION "Falling back to FreeBIOS"
)
@ -422,8 +354,8 @@ add_retroarch_test(
CONTENT "${NDS_ROM}"
MAX_FRAMES 6
CORE_OPTION "melonds_console_mode=ds"
CORE_OPTION "melonds_use_external_bios=enabled"
CORE_OPTION "melonds_boot_directly=enabled"
CORE_OPTION "melonds_sysfile_mode=native"
CORE_OPTION "melonds_boot_mode=direct"
CORE_OPTION "melonds_firmware_nds_path=melonDS DS/${NDS_FIRMWARE_NAME}"
ARM7_BIOS
ARM9_BIOS
@ -434,22 +366,21 @@ add_retroarch_test(
## Direct Boot of NDS game ####################################################
add_retroarch_test(
NAME "Direct NDS boot with FreeBIOS and built-in firmware succeeds"
NAME "Direct NDS boot with built-in system files succeeds"
CONTENT "${NDS_ROM}"
MAX_FRAMES 180
CORE_OPTION "melonds_boot_directly=enabled"
CORE_OPTION "melonds_boot_mode=direct"
CORE_OPTION "melonds_console_mode=ds"
CORE_OPTION "melonds_use_external_bios=disabled"
CORE_OPTION "melonds_firmware_nds_path=/builtin"
CORE_OPTION "melonds_sysfile_mode=builtin"
)
add_retroarch_test(
NAME "Direct NDS boot with native BIOS and native firmware succeeds"
NAME "Direct NDS boot with native system files succeeds"
CONTENT "${NDS_ROM}"
MAX_FRAMES 180
CORE_OPTION "melonds_boot_directly=enabled"
CORE_OPTION "melonds_boot_mode=direct"
CORE_OPTION "melonds_console_mode=ds"
CORE_OPTION "melonds_use_external_bios=enabled"
CORE_OPTION "melonds_sysfile_mode=native"
CORE_OPTION "melonds_firmware_nds_path=melonDS DS/${NDS_FIRMWARE_NAME}"
ARM7_BIOS
ARM9_BIOS
@ -462,9 +393,9 @@ add_retroarch_test(
NAME "Direct NDS boot with native BIOS and non-bootable firmware succeeds"
CONTENT "${NDS_ROM}"
MAX_FRAMES 180
CORE_OPTION "melonds_boot_directly=enabled"
CORE_OPTION "melonds_boot_mode=direct"
CORE_OPTION "melonds_console_mode=ds"
CORE_OPTION "melonds_use_external_bios=enabled"
CORE_OPTION "melonds_sysfile_mode=native"
CORE_OPTION "melonds_firmware_nds_path=melonDS DS/${DSI_FIRMWARE_NAME}"
ARM7_BIOS
ARM9_BIOS
@ -473,38 +404,14 @@ add_retroarch_test(
FAIL_REGULAR_EXPRESSION "Failed to load the required firmware"
)
add_retroarch_test(
NAME "Direct NDS boot with native BIOS and built-in firmware succeeds"
CONTENT "${NDS_ROM}"
MAX_FRAMES 180
CORE_OPTION "melonds_boot_directly=enabled"
CORE_OPTION "melonds_console_mode=ds"
CORE_OPTION "melonds_use_external_bios=enabled"
CORE_OPTION "melonds_firmware_nds_path=/builtin"
ARM7_BIOS
ARM9_BIOS
FAIL_REGULAR_EXPRESSION "Failed to load the required firmware"
)
add_retroarch_test(
NAME "Direct NDS boot with FreeBIOS and native firmware succeeds"
CONTENT "${NDS_ROM}"
MAX_FRAMES 180
CORE_OPTION "melonds_boot_directly=enabled"
CORE_OPTION "melonds_console_mode=ds"
CORE_OPTION "melonds_use_external_bios=disabled"
CORE_OPTION "melonds_firmware_nds_path=melonDS DS/${NDS_FIRMWARE_NAME}"
NDS_FIRMWARE
FAIL_REGULAR_EXPRESSION "Failed to load the required firmware"
)
## Boot to firmware ####################################################
add_retroarch_test(
NAME "NDS boot with no content, native BIOS, and bootable firmware succeeds"
MAX_FRAMES 180
CORE_OPTION "melonds_console_mode=ds"
CORE_OPTION "melonds_use_external_bios=enabled"
CORE_OPTION "melonds_sysfile_mode=native"
CORE_OPTION "melonds_boot_mode=native"
CORE_OPTION "melonds_firmware_nds_path=melonDS DS/${NDS_FIRMWARE_NAME}"
NDS_FIRMWARE
ARM7_BIOS
@ -512,31 +419,10 @@ add_retroarch_test(
)
add_retroarch_test(
NAME "NDS boot with no content, FreeBIOS, and built-in firmware fails"
NAME "NDS boot with no content and built-in system files fails"
MAX_FRAMES 180
CORE_OPTION "melonds_console_mode=ds"
CORE_OPTION "melonds_use_external_bios=disabled"
CORE_OPTION "melonds_firmware_nds_path=/builtin"
WILL_FAIL
)
add_retroarch_test(
NAME "NDS boot with no content, FreeBIOS, and native firmware fails"
MAX_FRAMES 180
CORE_OPTION "melonds_console_mode=ds"
CORE_OPTION "melonds_use_external_bios=disabled"
CORE_OPTION "melonds_firmware_nds_path=melonDS DS/${NDS_FIRMWARE_NAME}"
NDS_FIRMWARE
WILL_FAIL
)
add_retroarch_test(
NAME "NDS boot with no content, native BIOS, and built-in firmware fails"
MAX_FRAMES 180
CORE_OPTION "melonds_console_mode=ds"
CORE_OPTION "melonds_use_external_bios=enabled"
ARM7_BIOS
ARM9_BIOS
CORE_OPTION "melonds_sysfile_mode=builtin"
WILL_FAIL
)
@ -544,7 +430,7 @@ add_retroarch_test(
NAME "NDS boot with no content, native BIOS, and non-bootable firmware fails"
MAX_FRAMES 180
CORE_OPTION "melonds_console_mode=ds"
CORE_OPTION "melonds_use_external_bios=disabled"
CORE_OPTION "melonds_sysfile_mode=builtin"
CORE_OPTION "melonds_firmware_nds_path=melonDS DS/${DSI_FIRMWARE_NAME}"
ARM7_BIOS
ARM9_BIOS
@ -595,7 +481,7 @@ add_retroarch_test(
)
add_retroarch_test(
NAME "DSi boot to menu with NDS firmware falls back to built-in firmware"
NAME "DSi boot to menu with NDS firmware fails"
MAX_FRAMES 6
CORE_OPTION "melonds_console_mode=dsi"
CORE_OPTION "melonds_firmware_dsi_path=melonDS DS/${NDS_FIRMWARE_NAME}"
@ -606,34 +492,20 @@ add_retroarch_test(
ARM9_DSI_BIOS
NDS_FIRMWARE
DSI_NAND
PASS_REGULAR_EXPRESSION "Falling back to built-in DSi firmware"
WILL_FAIL
)
add_retroarch_test(
NAME "DSi boot to menu with no firmware falls back to built-in firmware"
NAME "DSi boot to menu with no firmware fails"
MAX_FRAMES 6
CORE_OPTION "melonds_console_mode=dsi"
CORE_OPTION "melonds_firmware_dsi_path=/builtin"
CORE_OPTION "melonds_dsi_nand_path=melonDS DS/${DSI_NAND_NAME}"
ARM7_BIOS
ARM9_BIOS
ARM7_DSI_BIOS
ARM9_DSI_BIOS
DSI_NAND
PASS_REGULAR_EXPRESSION "Installed firmware \\(Identifier: MELN\\)"
)
add_retroarch_test(
NAME "DSi boot to menu with built-in firmware succeeds"
MAX_FRAMES 6
CORE_OPTION "melonds_console_mode=dsi"
CORE_OPTION "melonds_firmware_dsi_path=/builtin"
CORE_OPTION "melonds_dsi_nand_path=melonDS DS/${DSI_NAND_NAME}"
ARM7_BIOS
ARM9_BIOS
ARM7_DSI_BIOS
ARM9_DSI_BIOS
DSI_NAND
WILL_FAIL
)
add_retroarch_test(
@ -655,7 +527,7 @@ add_retroarch_test(
CONTENT "${NDS_ROM}"
MAX_FRAMES 6
CORE_OPTION "melonds_console_mode=dsi"
CORE_OPTION "melonds_boot_directly=enabled"
CORE_OPTION "melonds_boot_mode=direct"
CORE_OPTION "melonds_firmware_dsi_path=melonDS DS/${DSI_FIRMWARE_NAME}"
CORE_OPTION "melonds_dsi_nand_path=/notfound"
ARM7_BIOS
@ -671,7 +543,7 @@ add_retroarch_test(
CONTENT "${NDS_ROM}"
MAX_FRAMES 6
CORE_OPTION "melonds_console_mode=dsi"
CORE_OPTION "melonds_boot_directly=enabled"
CORE_OPTION "melonds_boot_mode=direct"
CORE_OPTION "melonds_firmware_dsi_path=melonDS DS/${DSI_FIRMWARE_NAME}"
CORE_OPTION "melonds_dsi_nand_path=melonDS DS/${DSI_NAND_NAME}"
ARM7_DSI_BIOS
@ -686,7 +558,7 @@ add_retroarch_test(
CONTENT "${NDS_ROM}"
MAX_FRAMES 6
CORE_OPTION "melonds_console_mode=dsi"
CORE_OPTION "melonds_boot_directly=enabled"
CORE_OPTION "melonds_boot_mode=direct"
CORE_OPTION "melonds_firmware_dsi_path=melonDS DS/${DSI_FIRMWARE_NAME}"
CORE_OPTION "melonds_dsi_nand_path=melonDS DS/${DSI_NAND_NAME}"
ARM7_BIOS
@ -719,6 +591,8 @@ add_retroarch_test(
MAX_FRAMES 6
CORE_OPTION "melonds_console_mode=ds"
CORE_OPTION "melonds_firmware_nds_path=melonDS DS/${NDS_FIRMWARE_NAME}"
CORE_OPTION "melonds_sysfile_mode=native"
CORE_OPTION "melonds_boot_mode=native"
ARM7_BIOS
ARM9_BIOS
NDS_FIRMWARE
@ -754,7 +628,7 @@ add_emutest_test(
CORE_OPTION melonds_dsi_nand_path="melonDS DS/${DSI_NAND_NAME}"
CORE_OPTION melonds_console_mode="ds"
CORE_OPTION melonds_boot_directly="false"
CORE_OPTION melonds_use_external_bios="enabled"
CORE_OPTION melonds_sysfile_mode="native"
CORE_OPTION melonds_show_cursor="disabled"
)
@ -774,7 +648,7 @@ add_emutest_test(
CORE_OPTION melonds_dsi_nand_path="melonDS DS/${DSI_NAND_NAME}"
CORE_OPTION melonds_console_mode="dsi"
CORE_OPTION melonds_boot_directly="false"
CORE_OPTION melonds_use_external_bios="enabled"
CORE_OPTION melonds_sysfile_mode="native"
CORE_OPTION melonds_show_cursor="disabled"
)
@ -794,7 +668,7 @@ add_emutest_test(
CORE_OPTION melonds_dsi_nand_path="melonDS DS/${DSI_NAND_NAME}"
CORE_OPTION melonds_console_mode="dsi"
CORE_OPTION melonds_boot_directly="false"
CORE_OPTION melonds_use_external_bios="enabled"
CORE_OPTION melonds_sysfile_mode="native"
CORE_OPTION melonds_show_cursor="disabled"
)
@ -814,7 +688,7 @@ add_emutest_test(
CORE_OPTION melonds_dsi_nand_path="melonDS DS/${DSI_NAND_NAME}"
CORE_OPTION melonds_console_mode="dsi"
CORE_OPTION melonds_boot_directly="false"
CORE_OPTION melonds_use_external_bios="enabled"
CORE_OPTION melonds_sysfile_mode="native"
CORE_OPTION melonds_show_cursor="disabled"
)