mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-30 01:29:52 -06:00
Miscellaneous DSi NAND fixes (#1852)
* Replace some standard I/O calls with Platform equivalents - I missed a spot when I submitted that PR a few months ago * Include <memory> in DSi_NAND.h - Because it uses unique_ptr * Split DSi_NAND::ReadHardwareInfo into ReadSerialData and ReadHardwareInfoN * Add a RegionMask enum * Move DSi NAND patching to the frontend * Add DSiSupportedLanguageMask - Not currently used by the frontend, but I use it in melonDS DS * Remove some Platform::ConfigEntry values - The core no longer needs to know about them - The corresponding Config values are unchanged * Mark NANDMount's destructor as noexcept
This commit is contained in:

committed by
GitHub

parent
8c4e5af737
commit
21590b0709
@ -25,6 +25,7 @@
|
||||
#include "DSi_TMD.h"
|
||||
#include "SPI_Firmware.h"
|
||||
#include <array>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
@ -84,7 +85,7 @@ class NANDMount
|
||||
{
|
||||
public:
|
||||
explicit NANDMount(NANDImage& nand) noexcept;
|
||||
~NANDMount();
|
||||
~NANDMount() noexcept;
|
||||
NANDMount(const NANDMount&) = delete;
|
||||
NANDMount& operator=(const NANDMount&) = delete;
|
||||
|
||||
@ -92,10 +93,15 @@ public:
|
||||
NANDMount(NANDMount&&) = delete;
|
||||
NANDMount& operator=(NANDMount&&) = delete;
|
||||
|
||||
bool ReadSerialData(DSiSerialData& dataS);
|
||||
bool ReadHardwareInfoN(DSiHardwareInfoN& dataN);
|
||||
void ReadHardwareInfo(DSiSerialData& dataS, DSiHardwareInfoN& dataN);
|
||||
|
||||
void ReadUserData(DSiFirmwareSystemSettings& data);
|
||||
void PatchUserData();
|
||||
bool ReadUserData(DSiFirmwareSystemSettings& data);
|
||||
|
||||
/// Saves the given system settings to the DSi NAND,
|
||||
/// to both TWLCFG0.dat and TWLCFG1.dat.
|
||||
bool ApplyUserData(const DSiFirmwareSystemSettings& data);
|
||||
|
||||
void ListTitles(u32 category, std::vector<u32>& titlelist);
|
||||
bool TitleExists(u32 category, u32 titleid);
|
||||
@ -211,6 +217,29 @@ enum class ConsoleRegion : u8
|
||||
Korea,
|
||||
};
|
||||
|
||||
/// Languages that the given NAND image supports.
|
||||
/// @see https://problemkaputt.de/gbatek.htm#dsiregions
|
||||
enum DSiSupportedLanguageMask : u32 {
|
||||
NoLanguagesSet = 0,
|
||||
JapaneseSupported = 1 << 0,
|
||||
EnglishSupported = 1 << 1,
|
||||
FrenchSupported = 1 << 2,
|
||||
GermanSupported = 1 << 3,
|
||||
ItalianSupported = 1 << 4,
|
||||
SpanishSupported = 1 << 5,
|
||||
ChineseSupported = 1 << 6,
|
||||
KoreanSupported = 1 << 7,
|
||||
|
||||
JapanLanguages = JapaneseSupported,
|
||||
AmericaLanguages = EnglishSupported | FrenchSupported | SpanishSupported,
|
||||
EuropeLanguages = EnglishSupported | FrenchSupported | GermanSupported | ItalianSupported | SpanishSupported,
|
||||
AustraliaLanguages = EnglishSupported,
|
||||
|
||||
// "Unknown (supposedly Chinese/Mandarin?, and maybe English or so)"
|
||||
ChinaLanguages = ChineseSupported | EnglishSupported,
|
||||
KoreaLanguages = KoreanSupported,
|
||||
};
|
||||
|
||||
/// Data file saved to 0:/sys/HWINFO_S.dat.
|
||||
/// @note The file is normally 16KiB, but only the first 164 bytes are used;
|
||||
/// the rest is FF-padded.
|
||||
@ -223,7 +252,7 @@ union DSiSerialData
|
||||
u8 RsaSha1HMAC[0x80];
|
||||
u32 Version;
|
||||
u32 EntrySize;
|
||||
u32 SupportedLanguages;
|
||||
DSiSupportedLanguageMask SupportedLanguages;
|
||||
u8 Unknown0[4];
|
||||
ConsoleRegion Region;
|
||||
char Serial[12];
|
||||
|
Reference in New Issue
Block a user