Apply some quick hotfixes (#1931)
This commit is contained in:
parent
740489f7a4
commit
d55a384c88
|
@ -122,7 +122,8 @@ NANDImage::NANDImage(NANDImage&& other) noexcept :
|
||||||
ConsoleID(other.ConsoleID),
|
ConsoleID(other.ConsoleID),
|
||||||
FATIV(other.FATIV),
|
FATIV(other.FATIV),
|
||||||
FATKey(other.FATKey),
|
FATKey(other.FATKey),
|
||||||
ESKey(other.ESKey)
|
ESKey(other.ESKey),
|
||||||
|
Length(other.Length)
|
||||||
{
|
{
|
||||||
other.CurFile = nullptr;
|
other.CurFile = nullptr;
|
||||||
}
|
}
|
||||||
|
@ -140,6 +141,7 @@ NANDImage& NANDImage::operator=(NANDImage&& other) noexcept
|
||||||
FATIV = other.FATIV;
|
FATIV = other.FATIV;
|
||||||
FATKey = other.FATKey;
|
FATKey = other.FATKey;
|
||||||
ESKey = other.ESKey;
|
ESKey = other.ESKey;
|
||||||
|
Length = other.Length;
|
||||||
|
|
||||||
other.CurFile = nullptr;
|
other.CurFile = nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,14 +32,8 @@ using namespace Platform;
|
||||||
using std::string;
|
using std::string;
|
||||||
|
|
||||||
FATStorage::FATStorage(const std::string& filename, u64 size, bool readonly, const std::optional<string>& sourcedir) :
|
FATStorage::FATStorage(const std::string& filename, u64 size, bool readonly, const std::optional<string>& sourcedir) :
|
||||||
FilePath(filename),
|
FATStorage(FATStorageArgs { filename, size, readonly, sourcedir })
|
||||||
FileSize(size),
|
|
||||||
ReadOnly(readonly),
|
|
||||||
SourceDir(sourcedir)
|
|
||||||
{
|
{
|
||||||
Load(filename, size, sourcedir);
|
|
||||||
|
|
||||||
File = Platform::OpenLocalFile(FilePath, FileMode::ReadWriteExisting);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FATStorage::FATStorage(const FATStorageArgs& args) noexcept :
|
FATStorage::FATStorage(const FATStorageArgs& args) noexcept :
|
||||||
|
@ -55,7 +49,7 @@ FATStorage::FATStorage(FATStorageArgs&& args) noexcept :
|
||||||
{
|
{
|
||||||
Load(FilePath, FileSize, SourceDir);
|
Load(FilePath, FileSize, SourceDir);
|
||||||
|
|
||||||
File = nullptr;
|
File = Platform::OpenLocalFile(FilePath, FileMode::ReadWriteExisting);
|
||||||
}
|
}
|
||||||
|
|
||||||
FATStorage::FATStorage(FATStorage&& other) noexcept
|
FATStorage::FATStorage(FATStorage&& other) noexcept
|
||||||
|
|
|
@ -48,8 +48,8 @@ class FATStorage
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FATStorage(const std::string& filename, u64 size, bool readonly, const std::optional<std::string>& sourcedir = std::nullopt);
|
FATStorage(const std::string& filename, u64 size, bool readonly, const std::optional<std::string>& sourcedir = std::nullopt);
|
||||||
FATStorage(const FATStorageArgs& args) noexcept;
|
explicit FATStorage(const FATStorageArgs& args) noexcept;
|
||||||
FATStorage(FATStorageArgs&& args) noexcept;
|
explicit FATStorage(FATStorageArgs&& args) noexcept;
|
||||||
FATStorage(FATStorage&& other) noexcept;
|
FATStorage(FATStorage&& other) noexcept;
|
||||||
FATStorage(const FATStorage& other) = delete;
|
FATStorage(const FATStorage& other) = delete;
|
||||||
FATStorage& operator=(const FATStorage& other) = delete;
|
FATStorage& operator=(const FATStorage& other) = delete;
|
||||||
|
|
|
@ -1657,9 +1657,15 @@ std::unique_ptr<CartCommon> ParseROM(std::unique_ptr<u8[]>&& romdata, u32 romlen
|
||||||
std::unique_ptr<u8[]> sram = args ? std::move(args->SRAM) : nullptr;
|
std::unique_ptr<u8[]> sram = args ? std::move(args->SRAM) : nullptr;
|
||||||
u32 sramlen = args ? args->SRAMLength : 0;
|
u32 sramlen = args ? args->SRAMLength : 0;
|
||||||
if (homebrew)
|
if (homebrew)
|
||||||
cart = std::make_unique<CartHomebrew>(std::move(cartrom), cartromsize, cartid, romparams, args ? std::move(args->SDCard) : std::nullopt);
|
{
|
||||||
|
std::optional<FATStorage> sdcard = args && args->SDCard ? std::make_optional<FATStorage>(std::move(*args->SDCard)) : std::nullopt;
|
||||||
|
cart = std::make_unique<CartHomebrew>(std::move(cartrom), cartromsize, cartid, romparams, std::move(sdcard));
|
||||||
|
}
|
||||||
else if (gametitle[0] == 0 && !strncmp("SD/TF-NDS", gametitle + 1, 9) && gamecode == 0x414D5341)
|
else if (gametitle[0] == 0 && !strncmp("SD/TF-NDS", gametitle + 1, 9) && gamecode == 0x414D5341)
|
||||||
cart = std::make_unique<CartR4>(std::move(cartrom), cartromsize, cartid, romparams, CartR4TypeR4, CartR4LanguageEnglish, args ? std::move(args->SDCard) : std::nullopt);
|
{
|
||||||
|
std::optional<FATStorage> sdcard = args && args->SDCard ? std::make_optional<FATStorage>(std::move(*args->SDCard)) : std::nullopt;
|
||||||
|
cart = std::make_unique<CartR4>(std::move(cartrom), cartromsize, cartid, romparams, CartR4TypeR4, CartR4LanguageEnglish, std::move(sdcard));
|
||||||
|
}
|
||||||
else if (cartid & 0x08000000)
|
else if (cartid & 0x08000000)
|
||||||
cart = std::make_unique<CartRetailNAND>(std::move(cartrom), cartromsize, cartid, romparams, std::move(sram), sramlen);
|
cart = std::make_unique<CartRetailNAND>(std::move(cartrom), cartromsize, cartid, romparams, std::move(sram), sramlen);
|
||||||
else if (irversion != 0)
|
else if (irversion != 0)
|
||||||
|
|
Loading…
Reference in New Issue