mirror of https://github.com/mgba-emu/mgba.git
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)
|
- GB Serialize: Add missing savestate support for MBC6 and NT (newer)
|
||||||
- GBA: Improve detection of valid ELF ROMs
|
- GBA: Improve detection of valid ELF ROMs
|
||||||
- mGUI: Enable auto-softpatching (closes mgba.io/i/2899)
|
- 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
|
- Scripting: Add `callbacks:oneshot` for single-call callbacks
|
||||||
|
|
||||||
0.10.2: (2023-04-23)
|
0.10.2: (2023-04-23)
|
||||||
|
|
|
@ -198,19 +198,24 @@ void SaveConverter::detectFromSize(std::shared_ptr<VFileDevice> vf) {
|
||||||
#ifdef M_CORE_GBA
|
#ifdef M_CORE_GBA
|
||||||
switch (vf->size()) {
|
switch (vf->size()) {
|
||||||
case GBA_SIZE_SRAM:
|
case GBA_SIZE_SRAM:
|
||||||
|
case GBA_SIZE_SRAM + 16:
|
||||||
m_validSaves.append(AnnotatedSave{SAVEDATA_SRAM, vf});
|
m_validSaves.append(AnnotatedSave{SAVEDATA_SRAM, vf});
|
||||||
break;
|
break;
|
||||||
case GBA_SIZE_FLASH512:
|
case GBA_SIZE_FLASH512:
|
||||||
|
case GBA_SIZE_FLASH512 + 16:
|
||||||
m_validSaves.append(AnnotatedSave{SAVEDATA_FLASH512, vf});
|
m_validSaves.append(AnnotatedSave{SAVEDATA_FLASH512, vf});
|
||||||
break;
|
break;
|
||||||
case GBA_SIZE_FLASH1M:
|
case GBA_SIZE_FLASH1M:
|
||||||
|
case GBA_SIZE_FLASH1M + 16:
|
||||||
m_validSaves.append(AnnotatedSave{SAVEDATA_FLASH1M, vf});
|
m_validSaves.append(AnnotatedSave{SAVEDATA_FLASH1M, vf});
|
||||||
break;
|
break;
|
||||||
case GBA_SIZE_EEPROM:
|
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::LITTLE});
|
||||||
m_validSaves.append(AnnotatedSave{SAVEDATA_EEPROM, vf, Endian::BIG});
|
m_validSaves.append(AnnotatedSave{SAVEDATA_EEPROM, vf, Endian::BIG});
|
||||||
break;
|
break;
|
||||||
case GBA_SIZE_EEPROM512:
|
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::LITTLE});
|
||||||
m_validSaves.append(AnnotatedSave{SAVEDATA_EEPROM512, vf, Endian::BIG});
|
m_validSaves.append(AnnotatedSave{SAVEDATA_EEPROM512, vf, Endian::BIG});
|
||||||
break;
|
break;
|
||||||
|
@ -478,6 +483,9 @@ SaveConverter::AnnotatedSave::operator QString() const {
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if ((size & 0xFF) == 0x10) {
|
||||||
|
typeFormat += QCoreApplication::translate("QGBA::SaveConverter", " + RTC");
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef M_CORE_GB
|
#ifdef M_CORE_GB
|
||||||
|
@ -618,6 +626,15 @@ QList<SaveConverter::AnnotatedSave> SaveConverter::AnnotatedSave::possibleConver
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
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
|
#endif
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -650,7 +667,7 @@ QByteArray SaveConverter::AnnotatedSave::convertTo(const SaveConverter::Annotate
|
||||||
}
|
}
|
||||||
converted.resize(target.size);
|
converted.resize(target.size);
|
||||||
buffer = backing->readAll();
|
buffer = backing->readAll();
|
||||||
for (int i = 0; i < size; i += 8) {
|
for (int i = 0; i < (size & ~0xFF); i += 8) {
|
||||||
uint64_t word;
|
uint64_t word;
|
||||||
const uint64_t* in = reinterpret_cast<const uint64_t*>(buffer.constData());
|
const uint64_t* in = reinterpret_cast<const uint64_t*>(buffer.constData());
|
||||||
uint64_t* out = reinterpret_cast<uint64_t*>(converted.data());
|
uint64_t* out = reinterpret_cast<uint64_t*>(converted.data());
|
||||||
|
@ -661,6 +678,9 @@ QByteArray SaveConverter::AnnotatedSave::convertTo(const SaveConverter::Annotate
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (endianness == target.endianness && size > target.size) {
|
||||||
|
converted = backing->read(target.size);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef M_CORE_GB
|
#ifdef M_CORE_GB
|
||||||
|
|
Loading…
Reference in New Issue