Update to v101r19 release.

byuu says:

Changelog:

-   added \~130 new PAL games to icarus (courtesy of Smarthuman
    and aquaman)
-   added all three Korean-localized games to icarus
-   sfc: removed SuperDisc emulation (it was going nowhere)
-   sfc: fixed MSU1 regression where the play/repeat flags were not
    being cleared on track select
-   nall: cryptography support added; will be used to sign future
    databases (validation will always be optional)
-   minor shims to fix compilation issues due to nall changes

The real magic is that we now have 25-30% of the PAL SNES library in
icarus!

Signing will be tricky. Obviously if I put the public key inside the
higan archive, then all anyone has to do is change that public key for
their own releases. And if you download from my site (which is now over
HTTPS), then you don't need the signing to verify integrity. I may just
put the public key on my site on my site and leave it at that, we'll
see.
This commit is contained in:
Tim Allen
2016-10-28 08:16:58 +11:00
parent c6fc15f8d2
commit f3e67da937
70 changed files with 4425 additions and 1667 deletions

View File

@@ -42,14 +42,14 @@ auto Archive::create(const string& beatname, const string& pathname, const strin
auto size = input.size();
beat.writevu(size);
while(size--) beat.write(input.read());
beat.writel(input.checksum.value(), 4);
beat.writel(input.checksum.digest().hex(), 4);
} else {
beat.writevu(0);
beat.writel(0x00000000, 4);
}
}
beat.writel(beat.checksum.value(), 4);
beat.writel(beat.checksum.digest().hex(), 4);
return true;
}
@@ -82,11 +82,11 @@ auto Archive::unpack(const string& beatname, const string& pathname) -> bool {
auto size = beat.readvu();
while(size--) output.write(beat.read());
if(beat.readl(4) != output.checksum.value()) return false;
if(beat.readl(4) != output.checksum.digest().hex()) return false;
}
}
uint32_t checksum = beat.checksum.value();
uint32_t checksum = beat.checksum.digest().hex();
return beat.readl(4) == checksum;
}
@@ -113,7 +113,7 @@ auto Archive::extract(const string& beatname, const string& filename) -> vector<
result.resize(size);
beat.checksum.reset();
for(auto n : range(size)) result[n] = beat.read();
uint32_t checksum = beat.checksum.value();
uint32_t checksum = beat.checksum.digest().hex();
if(beat.readl(4) != checksum) return {};
return result;
}

View File

@@ -67,7 +67,7 @@ auto bpsdelta::create(const string& filename, const string& metadata) -> bool {
auto write = [&](uint8_t data) {
modifyFile.write(data);
modifyChecksum.data(data);
modifyChecksum.input(data);
};
auto encode = [&](uint64_t data) {
@@ -102,7 +102,7 @@ auto bpsdelta::create(const string& filename, const string& metadata) -> bool {
//source tree creation
for(uint offset = 0; offset < sourceSize; offset++) {
uint16_t symbol = sourceData[offset + 0];
sourceChecksum.data(symbol);
sourceChecksum.input(symbol);
if(offset < sourceSize - 1) symbol |= sourceData[offset + 1] << 8;
Node *node = new Node;
node->offset = offset;
@@ -198,10 +198,10 @@ auto bpsdelta::create(const string& filename, const string& metadata) -> bool {
targetReadFlush();
for(uint n = 0; n < 32; n += 8) write(sourceChecksum.value() >> n);
uint32_t targetChecksum = Hash::CRC32(targetData, targetSize).value();
for(uint n = 0; n < 32; n += 8) write(sourceChecksum.digest().hex() >> n);
uint32_t targetChecksum = Hash::CRC32(targetData, targetSize).digest().hex();
for(uint n = 0; n < 32; n += 8) write(targetChecksum >> n);
uint32_t outputChecksum = modifyChecksum.value();
uint32_t outputChecksum = modifyChecksum.digest().hex();
for(uint n = 0; n < 32; n += 8) write(outputChecksum >> n);
modifyFile.close();

View File

@@ -11,12 +11,12 @@ struct File : file {
auto File::read() -> uint8_t {
uint8_t data = file::read();
checksum.data(data);
checksum.input(data);
return data;
}
auto File::write(uint8_t data) -> void {
checksum.data(data);
checksum.input(data);
return file::write(data);
}

View File

@@ -59,7 +59,7 @@ auto bpslinear::create(const string& filename, const string& metadata) -> bool {
auto write = [&](uint8_t data) {
modifyFile.write(data);
modifyChecksum.data(data);
modifyChecksum.input(data);
};
auto encode = [&](uint64_t data) {
@@ -134,11 +134,11 @@ auto bpslinear::create(const string& filename, const string& metadata) -> bool {
targetReadFlush();
uint32_t sourceChecksum = Hash::CRC32(sourceData, sourceSize).value();
uint32_t sourceChecksum = Hash::CRC32(sourceData, sourceSize).digest().hex();
for(uint n = 0; n < 32; n += 8) write(sourceChecksum >> n);
uint32_t targetChecksum = Hash::CRC32(targetData, targetSize).value();
uint32_t targetChecksum = Hash::CRC32(targetData, targetSize).digest().hex();
for(uint n = 0; n < 32; n += 8) write(targetChecksum >> n);
uint32_t outputChecksum = modifyChecksum.value();
uint32_t outputChecksum = modifyChecksum.digest().hex();
for(uint n = 0; n < 32; n += 8) write(outputChecksum >> n);
modifyFile.close();

View File

@@ -77,7 +77,7 @@ auto bpsmetadata::save(const string& filename, const string& metadata) -> bool {
auto write = [&](uint8_t data) {
targetFile.write(data);
checksum.data(data);
checksum.input(data);
};
auto encode = [&](uint64_t data) {
@@ -103,7 +103,7 @@ auto bpsmetadata::save(const string& filename, const string& metadata) -> bool {
for(uint n = 0; n < targetLength; n++) write(metadata[n]);
uint length = sourceFile.size() - sourceFile.offset() - 4;
for(uint n = 0; n < length; n++) write(read());
uint32_t outputChecksum = checksum.value();
uint32_t outputChecksum = checksum.digest().hex();
for(uint n = 0; n < 32; n += 8) write(outputChecksum >> n);
targetFile.close();

View File

@@ -48,14 +48,14 @@ struct bpsmulti {
for(uint n = 0; n < sp.size(); n++) {
uint8_t byte = sp.read();
if(identical && byte != dp.read()) identical = false;
cksum.data(byte);
cksum.input(byte);
}
if(identical) {
writeNumber(MirrorFile | ((targetName.length() - 1) << 2));
writeString(targetName);
writeNumber(OriginSource);
writeChecksum(cksum.value());
writeChecksum(cksum.digest().hex());
} else {
writeNumber(ModifyFile | ((targetName.length() - 1) << 2));
writeString(targetName);
@@ -83,12 +83,12 @@ struct bpsmulti {
auto buffer = file::read({targetPath, targetName});
writeNumber(buffer.size());
for(auto& byte : buffer) write(byte);
writeChecksum(Hash::CRC32(buffer.data(), buffer.size()).value());
writeChecksum(Hash::CRC32(buffer.data(), buffer.size()).digest().hex());
}
}
//checksum
writeChecksum(checksum.value());
writeChecksum(checksum.digest().hex());
fp.close();
return true;
}
@@ -141,7 +141,7 @@ struct bpsmulti {
}
}
uint32_t cksum = checksum.value();
uint32_t cksum = checksum.digest().hex();
if(read() != (uint8_t)(cksum >> 0)) return false;
if(read() != (uint8_t)(cksum >> 8)) return false;
if(read() != (uint8_t)(cksum >> 16)) return false;
@@ -171,7 +171,7 @@ protected:
auto write(uint8_t data) -> void {
fp.write(data);
checksum.data(data);
checksum.input(data);
}
auto writeNumber(uint64_t data) -> void {
@@ -202,7 +202,7 @@ protected:
//apply() functions
auto read() -> uint8_t {
uint8_t data = fp.read();
checksum.data(data);
checksum.input(data);
return data;
}

View File

@@ -132,7 +132,7 @@ auto bpspatch::apply() -> result {
auto read = [&]() -> uint8_t {
uint8_t data = modifyData[modifyOffset++];
modifyChecksum.data(data);
modifyChecksum.input(data);
return data;
};
@@ -150,7 +150,7 @@ auto bpspatch::apply() -> result {
auto write = [&](uint8_t data) {
targetData[outputOffset++] = data;
targetChecksum.data(data);
targetChecksum.input(data);
};
if(read() != 'B') return result::patch_invalid_header;
@@ -199,13 +199,13 @@ auto bpspatch::apply() -> result {
uint32_t modifySourceChecksum = 0, modifyTargetChecksum = 0, modifyModifyChecksum = 0;
for(uint n = 0; n < 32; n += 8) modifySourceChecksum |= read() << n;
for(uint n = 0; n < 32; n += 8) modifyTargetChecksum |= read() << n;
uint32_t checksum = modifyChecksum.value();
uint32_t checksum = modifyChecksum.digest().hex();
for(uint n = 0; n < 32; n += 8) modifyModifyChecksum |= read() << n;
uint32_t sourceChecksum = Hash::CRC32(sourceData, modifySourceSize).value();
uint32_t sourceChecksum = Hash::CRC32(sourceData, modifySourceSize).digest().hex();
if(sourceChecksum != modifySourceChecksum) return result::source_checksum_invalid;
if(targetChecksum.value() != modifyTargetChecksum) return result::target_checksum_invalid;
if(targetChecksum.digest().hex() != modifyTargetChecksum) return result::target_checksum_invalid;
if(checksum != modifyModifyChecksum) return result::patch_checksum_invalid;
return result::success;