mirror of https://github.com/mgba-emu/mgba.git
Qt: Expand romFilters functionality
This commit is contained in:
parent
131b983894
commit
8610147ad7
|
@ -65,13 +65,19 @@ bool convertAddress(const QHostAddress* input, Address* output) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString romFilters(bool includeMvl) {
|
QString romFilters(bool includeMvl, mPlatform platform, bool rawOnly) {
|
||||||
QStringList filters;
|
QStringList filters;
|
||||||
QStringList formats;
|
QStringList formats;
|
||||||
|
|
||||||
#ifdef M_CORE_GBA
|
#ifdef M_CORE_GBA
|
||||||
QStringList gbaFormats{
|
QStringList gbaFormats{
|
||||||
"*.gba",
|
"*.gba",
|
||||||
|
"*.agb",
|
||||||
|
"*.mb",
|
||||||
|
"*.rom",
|
||||||
|
"*.bin"};
|
||||||
|
if (!rawOnly) {
|
||||||
|
gbaFormats += QStringList{
|
||||||
#if defined(USE_LIBZIP) || defined(USE_MINIZIP)
|
#if defined(USE_LIBZIP) || defined(USE_MINIZIP)
|
||||||
"*.zip",
|
"*.zip",
|
||||||
#endif
|
#endif
|
||||||
|
@ -81,12 +87,14 @@ QString romFilters(bool includeMvl) {
|
||||||
#ifdef USE_ELF
|
#ifdef USE_ELF
|
||||||
"*.elf",
|
"*.elf",
|
||||||
#endif
|
#endif
|
||||||
"*.agb",
|
};
|
||||||
"*.mb",
|
}
|
||||||
"*.rom",
|
if (platform == mPLATFORM_NONE || platform == mPLATFORM_GBA) {
|
||||||
"*.bin"};
|
|
||||||
formats.append(gbaFormats);
|
formats.append(gbaFormats);
|
||||||
|
}
|
||||||
|
if (platform == mPLATFORM_NONE) {
|
||||||
filters.append(QCoreApplication::translate("QGBA", "Game Boy Advance ROMs (%1)", nullptr).arg(gbaFormats.join(QChar(' '))));
|
filters.append(QCoreApplication::translate("QGBA", "Game Boy Advance ROMs (%1)", nullptr).arg(gbaFormats.join(QChar(' '))));
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef M_CORE_GB
|
#ifdef M_CORE_GB
|
||||||
|
@ -94,16 +102,25 @@ QString romFilters(bool includeMvl) {
|
||||||
"*.gb",
|
"*.gb",
|
||||||
"*.gbc",
|
"*.gbc",
|
||||||
"*.sgb",
|
"*.sgb",
|
||||||
|
"*.rom",
|
||||||
|
"*.bin"};
|
||||||
|
|
||||||
|
if (!rawOnly) {
|
||||||
|
gbFormats += QStringList{
|
||||||
#if defined(USE_LIBZIP) || defined(USE_MINIZIP)
|
#if defined(USE_LIBZIP) || defined(USE_MINIZIP)
|
||||||
"*.zip",
|
"*.zip",
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_LZMA
|
#ifdef USE_LZMA
|
||||||
"*.7z",
|
"*.7z",
|
||||||
#endif
|
#endif
|
||||||
"*.rom",
|
};
|
||||||
"*.bin"};
|
}
|
||||||
|
if (platform == mPLATFORM_NONE || platform == mPLATFORM_GBA) {
|
||||||
formats.append(gbFormats);
|
formats.append(gbFormats);
|
||||||
|
}
|
||||||
|
if (platform == mPLATFORM_NONE) {
|
||||||
filters.append(QCoreApplication::translate("QGBA", "Game Boy ROMs (%1)", nullptr).arg(gbFormats.join(QChar(' '))));
|
filters.append(QCoreApplication::translate("QGBA", "Game Boy ROMs (%1)", nullptr).arg(gbFormats.join(QChar(' '))));
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
formats.removeDuplicates();
|
formats.removeDuplicates();
|
||||||
|
|
|
@ -112,7 +112,7 @@ constexpr int saturateCast<int, unsigned>(unsigned value) {
|
||||||
return static_cast<int>(value);
|
return static_cast<int>(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString romFilters(bool includeMvl = false);
|
QString romFilters(bool includeMvl = false, mPlatform platform = mPLATFORM_NONE, bool rawOnly = false);
|
||||||
bool extractMatchingFile(VDir* dir, std::function<QString (VDirEntry*)> filter);
|
bool extractMatchingFile(VDir* dir, std::function<QString (VDirEntry*)> filter);
|
||||||
|
|
||||||
QString keyName(int key);
|
QString keyName(int key);
|
||||||
|
|
Loading…
Reference in New Issue