mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-04-21 03:01:56 +02:00
byuu says: This should be basically final now. Works with all media types (nes, sfc, gb, gbc, gba, bs, st), strips headers, can use internal or external firmware, imports saves on first run. Added a custom file dialog. It seems both GTK+ and Windows XP have (un)intelligent file sorting, which puts eg "ActRaiser 2 (NA)" before "ActRaiser (NA)". So, screw 'em.
30 lines
806 B
C++
30 lines
806 B
C++
vector<uint8_t> Ananke::extractROM() {
|
|
unzip archive;
|
|
if(archive.open(information.archive)) {
|
|
for(auto &file : archive.file) {
|
|
if(
|
|
file.name.endswith(".fc") || file.name.endswith(".nes")
|
|
|| file.name.endswith(".sfc") || file.name.endswith(".smc")
|
|
|| file.name.endswith(".gb") || file.name.endswith(".gbc")
|
|
|| file.name.endswith(".gba")
|
|
) {
|
|
information.name = notdir(file.name);
|
|
return archive.extract(file);
|
|
}
|
|
}
|
|
}
|
|
return vector<uint8_t>();
|
|
}
|
|
|
|
vector<uint8_t> Ananke::extractFile(const string &filename) {
|
|
unzip archive;
|
|
if(archive.open(information.archive)) {
|
|
for(auto &file : archive.file) {
|
|
if(notdir(file.name) == filename) {
|
|
return archive.extract(file);
|
|
}
|
|
}
|
|
}
|
|
return vector<uint8_t>();
|
|
}
|