mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-08-31 11:41:59 +02:00
Update to v106r59 release.
byuu says: Changelog: - fixed bug in Emulator::Game::Memory::operator bool() - nall: renamed view<string> back to `string_view` - nall:: implemented `array_view` - Game Boy: split cartridge-specific input mappings (rumble, accelerometer) to their own separate ports - Game Boy: fixed MBC7 accelerometer x-axis - icarus: Game Boy, Super Famicom, Mega Drive cores output internal header game titles to heuristics manifests - higan, icarus, hiro/gtk: improve viewport geometry configuration; fixed higan crashing bug with XShm driver - higan: connect Video::poll(),update() functionality - hiro, ruby: several compilation / bugfixes, should get the macOS port compiling again, hopefully [Sintendo] - ruby/video/xshm: fix crashing bug on window resize - a bit hacky; it's throwing BadAccess Xlib warnings, but they're not fatal, so I am catching and ignoring them - bsnes: removed Application::Windows::onModalChange hook that's no longer needed [Screwtape]
This commit is contained in:
@@ -6,8 +6,7 @@
|
||||
|
||||
namespace nall { namespace Decode {
|
||||
|
||||
inline auto BWT(const void* data) -> vector<uint8_t> {
|
||||
auto input = (const uint8_t*)data;
|
||||
inline auto BWT(array_view<uint8_t> input) -> vector<uint8_t> {
|
||||
vector<uint8_t> output;
|
||||
|
||||
uint size = 0;
|
||||
@@ -17,14 +16,11 @@ inline auto BWT(const void* data) -> vector<uint8_t> {
|
||||
uint I = 0;
|
||||
for(uint byte : range(8)) I |= *input++ << byte * 8;
|
||||
|
||||
auto suffixes = new int[size];
|
||||
suffix_array(suffixes, input, size);
|
||||
auto suffixes = SuffixArray(input);
|
||||
|
||||
auto L = input;
|
||||
auto F = new uint8_t[size];
|
||||
for(uint byte : range(size)) F[byte] = L[suffixes[byte]];
|
||||
|
||||
delete[] suffixes;
|
||||
for(uint offset : range(size)) F[offset] = L[suffixes[offset + 1]];
|
||||
|
||||
uint64_t K[256] = {};
|
||||
auto C = new int[size];
|
||||
@@ -48,9 +44,4 @@ inline auto BWT(const void* data) -> vector<uint8_t> {
|
||||
return output;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline auto BWT(const vector<T>& buffer) -> vector<uint8_t> {
|
||||
return move(BWT(buffer.data()));
|
||||
}
|
||||
|
||||
}}
|
||||
|
@@ -2,8 +2,7 @@
|
||||
|
||||
namespace nall { namespace Decode {
|
||||
|
||||
inline auto Huffman(const void* data) -> vector<uint8_t> {
|
||||
auto input = (const uint8_t*)data;
|
||||
inline auto Huffman(array_view<uint8_t> input) -> vector<uint8_t> {
|
||||
vector<uint8_t> output;
|
||||
|
||||
uint size = 0;
|
||||
@@ -34,9 +33,4 @@ inline auto Huffman(const void* data) -> vector<uint8_t> {
|
||||
return output;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline auto Huffman(const vector<T>& buffer) -> vector<uint8_t> {
|
||||
return move(Huffman(buffer.data()));
|
||||
}
|
||||
|
||||
}}
|
||||
|
@@ -25,7 +25,6 @@ inline auto LZSA(const void* data) -> vector<uint8_t> {
|
||||
|
||||
auto flags = Decode::Huffman(load());
|
||||
auto literals = Decode::Huffman(load());
|
||||
//auto literals = Decode::BWT(Decode::Huffman(load()));
|
||||
auto lengths = Decode::Huffman(load());
|
||||
auto offsets = Decode::Huffman(load());
|
||||
|
||||
|
@@ -1,44 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
namespace nall { namespace Decode {
|
||||
|
||||
inline auto LZSS(const void* data) -> vector<uint8_t> {
|
||||
vector<uint8_t> output;
|
||||
|
||||
auto input = (const uint8_t*)data;
|
||||
uint64_t size = 0;
|
||||
for(uint byte : range(8)) size |= *input++ << byte * 8;
|
||||
output.resize(size);
|
||||
const uint windowBits = *input++;
|
||||
const uint lengthBits = *input++;
|
||||
|
||||
const uint lengthExtends = 4 + (1 << lengthBits) - 1;
|
||||
const uint windowMask = (1 << windowBits) - 1;
|
||||
|
||||
for(uint offset = 0, flags = 0, bit = 7; offset < size;) {
|
||||
if(++bit == 8) bit = 0, flags = *input++;
|
||||
|
||||
if(flags & 1 << bit) {
|
||||
uint encoding = 0;
|
||||
encoding |= *input++ << 0;
|
||||
encoding |= *input++ << 8;
|
||||
encoding |= *input++ << 16;
|
||||
|
||||
uint length = 4 + (encoding >> windowBits);
|
||||
uint window = 1 + (encoding & windowMask);
|
||||
if(length == lengthExtends) length += *input++;
|
||||
|
||||
for(uint index : range(length)) {
|
||||
if(offset + index >= size) break;
|
||||
output[offset + index] = output[offset + index - window];
|
||||
}
|
||||
offset += length;
|
||||
} else {
|
||||
output[offset++] = *input++;
|
||||
}
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
}}
|
@@ -4,25 +4,19 @@
|
||||
|
||||
namespace nall { namespace Decode {
|
||||
|
||||
inline auto MTF(const void* data, uint size) -> vector<uint8_t> {
|
||||
auto input = (const uint8_t*)data;
|
||||
inline auto MTF(array_view<uint8_t> input) -> vector<uint8_t> {
|
||||
vector<uint8_t> output;
|
||||
output.resize(size);
|
||||
output.resize(input.size());
|
||||
|
||||
uint8_t order[256];
|
||||
for(uint n : range(256)) order[n] = n;
|
||||
|
||||
for(uint offset = 0; offset < size; offset++) {
|
||||
auto data = input[offset];
|
||||
for(uint index = 0; index < 256; index++) {
|
||||
uint value = order[data];
|
||||
if(value == index) {
|
||||
output[offset] = value;
|
||||
memory::move(&order[1], &order[0], index);
|
||||
order[0] = index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for(uint offset : range(input.size())) {
|
||||
uint data = input[offset];
|
||||
uint value = order[data];
|
||||
output[offset] = value;
|
||||
memory::move(&order[1], &order[0], data);
|
||||
order[0] = value;
|
||||
}
|
||||
|
||||
return output;
|
||||
|
@@ -3,14 +3,11 @@
|
||||
namespace nall { namespace Decode {
|
||||
|
||||
template<uint S = 1, uint M = 4 / S> //S = word size; M = match length
|
||||
inline auto RLE(const void* data, uint remaining = ~0) -> vector<uint8_t> {
|
||||
inline auto RLE(array_view<uint8_t> input) -> vector<uint8_t> {
|
||||
vector<uint8_t> output;
|
||||
|
||||
auto input = (const uint8_t*)data;
|
||||
|
||||
auto load = [&]() -> uint8_t {
|
||||
if(!remaining) return 0x00;
|
||||
return --remaining, *input++;
|
||||
return input ? *input++ : 0;
|
||||
};
|
||||
|
||||
uint base = 0;
|
||||
|
@@ -3,7 +3,7 @@
|
||||
namespace nall { namespace Decode {
|
||||
|
||||
//returns empty string on malformed content
|
||||
inline auto URL(const string& input) -> string {
|
||||
inline auto URL(string_view input) -> string {
|
||||
string output;
|
||||
for(uint n = 0; n < input.size();) {
|
||||
char c = input[n];
|
||||
|
Reference in New Issue
Block a user