File: archive.cpp

package info (click to toggle)
higan 094-5
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 9,780 kB
  • ctags: 15,643
  • sloc: cpp: 103,963; ansic: 659; makefile: 531; sh: 25
file content (29 lines) | stat: -rwxr-xr-x 863 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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(".st")  || file.name.endsWith(".bs")
      || 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>();
}