mirror of
https://github.com/libretro/mgba.git
synced 2024-11-23 16:10:01 +00:00
Qt: Add exporting of SAV + RTC GBA saves from Save Converter to strip RTC data
This commit is contained in:
parent
58da738647
commit
82f7e52fc6
1
CHANGES
1
CHANGES
@ -22,6 +22,7 @@ Misc:
|
||||
- GB Serialize: Add missing savestate support for MBC6 and NT (newer)
|
||||
- GBA: Improve detection of valid ELF ROMs
|
||||
- mGUI: Enable auto-softpatching (closes mgba.io/i/2899)
|
||||
- Qt: Add exporting of SAV + RTC GBA saves from Save Converter to strip RTC data
|
||||
- Scripting: Add `callbacks:oneshot` for single-call callbacks
|
||||
|
||||
0.10.2: (2023-04-23)
|
||||
|
@ -198,19 +198,24 @@ void SaveConverter::detectFromSize(std::shared_ptr<VFileDevice> vf) {
|
||||
#ifdef M_CORE_GBA
|
||||
switch (vf->size()) {
|
||||
case GBA_SIZE_SRAM:
|
||||
case GBA_SIZE_SRAM + 16:
|
||||
m_validSaves.append(AnnotatedSave{SAVEDATA_SRAM, vf});
|
||||
break;
|
||||
case GBA_SIZE_FLASH512:
|
||||
case GBA_SIZE_FLASH512 + 16:
|
||||
m_validSaves.append(AnnotatedSave{SAVEDATA_FLASH512, vf});
|
||||
break;
|
||||
case GBA_SIZE_FLASH1M:
|
||||
case GBA_SIZE_FLASH1M + 16:
|
||||
m_validSaves.append(AnnotatedSave{SAVEDATA_FLASH1M, vf});
|
||||
break;
|
||||
case GBA_SIZE_EEPROM:
|
||||
case GBA_SIZE_EEPROM + 16:
|
||||
m_validSaves.append(AnnotatedSave{SAVEDATA_EEPROM, vf, Endian::LITTLE});
|
||||
m_validSaves.append(AnnotatedSave{SAVEDATA_EEPROM, vf, Endian::BIG});
|
||||
break;
|
||||
case GBA_SIZE_EEPROM512:
|
||||
case GBA_SIZE_EEPROM512 + 16:
|
||||
m_validSaves.append(AnnotatedSave{SAVEDATA_EEPROM512, vf, Endian::LITTLE});
|
||||
m_validSaves.append(AnnotatedSave{SAVEDATA_EEPROM512, vf, Endian::BIG});
|
||||
break;
|
||||
@ -478,6 +483,9 @@ SaveConverter::AnnotatedSave::operator QString() const {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if ((size & 0xFF) == 0x10) {
|
||||
typeFormat += QCoreApplication::translate("QGBA::SaveConverter", " + RTC");
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#ifdef M_CORE_GB
|
||||
@ -618,6 +626,15 @@ QList<SaveConverter::AnnotatedSave> SaveConverter::AnnotatedSave::possibleConver
|
||||
break;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#ifdef M_CORE_GBA
|
||||
case mPLATFORM_GBA:
|
||||
if ((size & 0xFF) == 0x10) {
|
||||
AnnotatedSave noRtc = same;
|
||||
noRtc.size &= ~0xFF;
|
||||
possible.append(noRtc);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
@ -650,7 +667,7 @@ QByteArray SaveConverter::AnnotatedSave::convertTo(const SaveConverter::Annotate
|
||||
}
|
||||
converted.resize(target.size);
|
||||
buffer = backing->readAll();
|
||||
for (int i = 0; i < size; i += 8) {
|
||||
for (int i = 0; i < (size & ~0xFF); i += 8) {
|
||||
uint64_t word;
|
||||
const uint64_t* in = reinterpret_cast<const uint64_t*>(buffer.constData());
|
||||
uint64_t* out = reinterpret_cast<uint64_t*>(converted.data());
|
||||
@ -661,6 +678,9 @@ QByteArray SaveConverter::AnnotatedSave::convertTo(const SaveConverter::Annotate
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (endianness == target.endianness && size > target.size) {
|
||||
converted = backing->read(target.size);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#ifdef M_CORE_GB
|
||||
|
Loading…
Reference in New Issue
Block a user