Browse Source

Parse GOG Galaxy architecture constraints

Previously we would warn on any values other than "32#64#".
pull/108/head
Daniel Scharrer 7 years ago
parent
commit
a6b88dbc16
  1. 1
      CHANGELOG
  2. 32
      src/cli/goggalaxy.cpp

1
CHANGELOG

@ -9,6 +9,7 @@ innoextract 1.8 (WIP)
- Added support for installers using an alternative setup loader magic
- Added support for using boost_{zlib,bzip2} when statically linking Boost
- Added support for automatically reading external setup.0 files
- Implemented parsing of GOG Galaxy architecture constraints
- Fixed extracting files from slices larger than 2 GiB with 32-bit builds
- Fixed output path for files with absolute paths (canonicalization now strips all unsafe characters)
- Fixed output directory being created even when not extracting files

32
src/cli/goggalaxy.cpp

@ -448,9 +448,35 @@ void parse_galaxy_files(setup::info & info, bool force) {
}
if(check.size() >= 2 && !check[1].empty() && check[1] != "32#64#") {
log_warning << "Ignoring architecture constraint for GOG Galaxy file " << file.destination
<< ": " << check[1];
if(check.size() >= 2 && !check[1].empty()) {
const setup::file_entry::flags all_arch = setup::file_entry::Bits32 | setup::file_entry::Bits64;
setup::file_entry::flags arch = 0;
if(check[1] != "32#64#") {
std::vector<constraint> architectures = parse_constraints(check[1]);
BOOST_FOREACH(const constraint & architecture, architectures) {
if(architecture.negated && architectures.size() > 1) {
log_warning << "Ignoring architecture for GOG Galaxy file " << file.destination
<< ": !" << architecture.name;
} else if(architecture.name == "32") {
arch |= setup::file_entry::Bits32;
} else if(architecture.name == "64") {
arch |= setup::file_entry::Bits64;
} else {
log_warning << "Unknown architecture for GOG Galaxy file " << file.destination
<< ": " << architecture.name;
}
if(architecture.negated && architectures.size() <= 1) {
arch = all_arch & ~arch;
}
}
if(arch == all_arch) {
arch = 0;
}
}
if((file.options & all_arch) && (file.options & all_arch) != arch) {
log_warning << "Overwriting architecture constraints for GOG Galaxy file " << file.destination;
}
file.options = (file.options & ~all_arch) | arch;
}
if(check.size() >= 3 && !check[2].empty()) {

Loading…
Cancel
Save