IOS LLE: optional emulated Wii Remotes in bootstrap mode (StarletOS phase 11 M1)

With REV_BOOTSTRAP_WIIMOTE=1 a bootstrap-ELF session gets the emulated Wii
Remotes of the original-IOS mode, using the identities paired in the
attached NAND's SYSCONF. The NAND is never rewritten for it; without the
variable nothing changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Yaya48andClaude Opus 5.5 committed 2026-10-06 19:25:04 +02:00
1 parent 09fba9bbb5
commit 3ce435786c
5 files changed
+83 -8

No files matched your search

+11
View File
@@ -128,6 +128,17 @@ bool Starlet::Init(const std::string& dump_directory, std::string* error)
}
INFO_LOG_FMT(IOS, "Starlet bootstrap keys attached");
}
// StarletOS phase 11 (M1), emulator only: the emulated Wii Remotes for a Revolution session,
// with the identity paired in the attached NAND. Off unless asked for.
if (const char* wiimotes = std::getenv("REV_BOOTSTRAP_WIIMOTE"); wiimotes && *wiimotes == '1')
{
if (!m_memory->EnableBootstrapWiimotes(error))
{
m_memory.reset();
return false;
}
INFO_LOG_FMT(IOS, "Starlet bootstrap emulated Wii Remotes enabled");
}
}
// ARMCore owns generation-tagged software TLB and instruction caches, so
// construct it only after the complete physical bus exists.
+27 -1
View File
@@ -792,6 +792,26 @@ bool StarletMemory::AttachDisposableNAND(const std::string& source, const std::s
return true;
}
bool StarletMemory::EnableBootstrapWiimotes(std::string* error)
{
if (!m_nand)
{
if (error)
*error = "REV_BOOTSTRAP_WIIMOTE needs a bootstrap NAND";
return false;
}
// The identities are chosen before the devices exist (see Init).
if (!InstallEmulatedWiimotePairings(false))
{
if (error)
*error = "could not read the Wii Remote pairings of the bootstrap NAND";
return false;
}
m_initialized = true;
InitializeWiimotes();
return true;
}
bool StarletMemory::AttachKeys(const std::string& path, std::string* error)
{
File::IOFile keys_file(path, "rb");
@@ -4259,7 +4279,7 @@ bool StarletMemory::CommitNANDPages(const NANDJournal::Pages& pages)
return true;
}
bool StarletMemory::InstallEmulatedWiimotePairings()
bool StarletMemory::InstallEmulatedWiimotePairings(bool allow_nand_rewrite)
{
using NANDSuperblock = DiscIO::NANDImporter::NANDSuperblock;
using NANDFSTEntry = DiscIO::NANDImporter::NANDFSTEntry;
@@ -4499,6 +4519,12 @@ bool StarletMemory::InstallEmulatedWiimotePairings()
trusted_count);
return true;
}
if (!allow_nand_rewrite)
{
INFO_LOG_FMT(IOS_WIIMOTE, "No paired Wii Remote identity in the raw NAND; keeping the "
"default identities without modifying NAND");
return true;
}
std::ranges::copy(pairing, sysconf.begin() + static_cast<ptrdiff_t>(*pairing_offset));
+6 -1
View File
@@ -72,6 +72,11 @@ public:
// Revolution IOS Phase 04C: bootstrap mode loads no keys, so the OTP reads zero. This
// loads a 1024-byte BootMii keys.bin so OTP reads return the console's own words.
bool AttachKeys(const std::string& path, std::string* error);
// StarletOS phase 11 (M1), emulator only: give a bootstrap-ELF session the emulated Wii
// Remotes of the original-IOS mode, with the identities already paired in the attached NAND's
// SYSCONF (keys needed to decrypt it). Never writes the NAND: without a paired identity the
// remotes keep their default addresses. Call after AttachKeys and a NAND attach.
bool EnableBootstrapWiimotes(std::string* error);
void Reset();
void DoState(PointerWrap& p);
@@ -202,7 +207,7 @@ private:
void CompleteNANDCommand(u32 command);
bool ReadRawNANDPage(u32 page, NANDPage* raw);
bool CommitNANDPages(const NANDJournal::Pages& pages);
bool InstallEmulatedWiimotePairings();
bool InstallEmulatedWiimotePairings(bool allow_nand_rewrite = true);
bool ReadNANDPage(u32 command);
bool ReadNANDID(u32 command);
bool ReadNANDStatus(u32 command);