2018-08-21 03:17:12 +00:00
|
|
|
#pragma once
|
|
|
|
|
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]
2018-08-26 06:49:54 +00:00
|
|
|
#include <nall/array.hpp>
|
2018-08-21 03:17:12 +00:00
|
|
|
#include <nall/counting-sort.hpp>
|
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]
2018-08-26 06:49:54 +00:00
|
|
|
#include <nall/induced-sort.hpp>
|
2018-08-21 03:17:12 +00:00
|
|
|
#include <nall/range.hpp>
|
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]
2018-08-26 06:49:54 +00:00
|
|
|
#include <nall/view.hpp>
|
2018-08-21 03:17:12 +00:00
|
|
|
|
|
|
|
namespace nall {
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
input:
|
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]
2018-08-26 06:49:54 +00:00
|
|
|
data = "acaacatat"
|
|
|
|
0 "acaacatat"
|
|
|
|
1 "caacatat"
|
|
|
|
2 "aacatat"
|
|
|
|
3 "acatat"
|
|
|
|
4 "catat"
|
|
|
|
5 "atat"
|
|
|
|
6 "tat"
|
|
|
|
7 "at"
|
|
|
|
8 "t"
|
|
|
|
9 ""
|
2018-08-21 03:17:12 +00:00
|
|
|
|
|
|
|
suffix_array:
|
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]
2018-08-26 06:49:54 +00:00
|
|
|
suffixes = [9,2,0,3,7,5,1,4,8,6] => input + suffixes:
|
|
|
|
9 ""
|
|
|
|
2 "aacatat"
|
|
|
|
0 "acaacatat"
|
|
|
|
3 "acatat"
|
|
|
|
7 "at"
|
|
|
|
5 "atat"
|
|
|
|
1 "caacatat"
|
|
|
|
4 "catat"
|
|
|
|
8 "t"
|
|
|
|
6 "tat"
|
|
|
|
|
|
|
|
[auxiliary data structures to represent information lost from suffix trees]
|
|
|
|
|
|
|
|
suffix_array_invert:
|
|
|
|
inverted = [2,6,1,3,7,5,9,4,8,0] => input + suffixes[inverted]:
|
|
|
|
2 "acaacatat"
|
|
|
|
6 "caacatat"
|
|
|
|
1 "aacatat"
|
|
|
|
3 "acatat"
|
|
|
|
7 "catat"
|
|
|
|
5 "atat"
|
|
|
|
9 "tat"
|
|
|
|
4 "at"
|
|
|
|
8 "t"
|
|
|
|
0 ""
|
2018-08-21 03:17:12 +00:00
|
|
|
|
2018-09-02 14:06:41 +00:00
|
|
|
suffix_array_phi:
|
|
|
|
phi = [2,5,9,0,1,7,8,3,4,0]
|
|
|
|
|
2018-08-21 03:17:12 +00:00
|
|
|
suffix_array_lcp:
|
2018-09-02 14:06:41 +00:00
|
|
|
prefixes = [0,0,1,3,1,2,0,2,0,1] => lcp[n] == lcp(n, n-1)
|
|
|
|
"" 0
|
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]
2018-08-26 06:49:54 +00:00
|
|
|
"aacatat" 0
|
|
|
|
"acaacatat" 1 "a"
|
|
|
|
"acatat" 3 "aca"
|
|
|
|
"at" 1 "a"
|
|
|
|
"atat" 2 "at"
|
|
|
|
"caacatat" 0
|
|
|
|
"catat" 2 "ca"
|
|
|
|
"t" 0
|
|
|
|
"tat" 1 "t"
|
|
|
|
|
2018-09-02 14:06:41 +00:00
|
|
|
suffix_array_plcp:
|
|
|
|
plcp = [1,0,0,3,2,2,1,1,0,0]
|
|
|
|
|
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]
2018-08-26 06:49:54 +00:00
|
|
|
suffix_array_lrcp:
|
2019-09-13 13:15:11 +00:00
|
|
|
llcp = [0,0,0,3,0,2,0,2,0,0] => llcp[m] == lcp(l, m)
|
|
|
|
rlcp = [0,1,1,1,0,0,0,0,0,0] => rlcp[m] == lcp(m, r)
|
2018-08-21 03:17:12 +00: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]
2018-08-26 06:49:54 +00:00
|
|
|
suffix_array_lpf:
|
|
|
|
lengths = [0,0,1,3,2,1,0,2,1,0]
|
|
|
|
offsets = [0,0,0,0,1,3,4,5,6,2]
|
|
|
|
"acaacatat" (0,-)
|
|
|
|
"caacatat" (0,-)
|
|
|
|
"aacatat" (1,0) at 0, match "a"
|
|
|
|
"acatat" (3,0) at 0, match "aca"
|
|
|
|
"catat" (2,1) at 1, match "ca"
|
|
|
|
"atat" (1,3) at 3, match "a"
|
|
|
|
"tat" (0,-)
|
|
|
|
"at" (2,5) at 5, match "at"
|
|
|
|
"t" (1,6) at 6, match "t"
|
|
|
|
"" (0,-)
|
2018-08-21 03:17:12 +00:00
|
|
|
|
|
|
|
*/
|
|
|
|
|
2018-09-02 14:06:41 +00:00
|
|
|
// suffix array via induced sorting
|
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]
2018-08-26 06:49:54 +00:00
|
|
|
// O(n)
|
|
|
|
inline auto suffix_array(array_view<uint8_t> input) -> vector<int> {
|
2019-09-13 13:15:11 +00:00
|
|
|
return induced_sort(input);
|
2018-08-21 03:17:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// inverse
|
|
|
|
// O(n)
|
2018-09-02 14:06:41 +00:00
|
|
|
inline auto suffix_array_invert(array_view<int> sa) -> vector<int> {
|
|
|
|
vector<int> isa;
|
|
|
|
isa.reallocate(sa.size());
|
|
|
|
for(int i : range(sa.size())) isa[sa[i]] = i;
|
|
|
|
return isa;
|
2018-08-21 03:17:12 +00:00
|
|
|
}
|
|
|
|
|
2018-09-02 14:06:41 +00:00
|
|
|
// auxiliary data structure for plcp and lpf computation
|
|
|
|
// O(n)
|
|
|
|
inline auto suffix_array_phi(array_view<int> sa) -> vector<int> {
|
|
|
|
vector<int> phi;
|
|
|
|
phi.reallocate(sa.size());
|
|
|
|
phi[sa[0]] = 0;
|
|
|
|
for(int i : range(1, sa.size())) phi[sa[i]] = sa[i - 1];
|
|
|
|
return phi;
|
|
|
|
}
|
|
|
|
|
|
|
|
// longest common prefix: lcp(l, r)
|
|
|
|
// O(n)
|
|
|
|
inline auto suffix_array_lcp(int l, int r, array_view<int> sa, array_view<uint8_t> input) -> int {
|
|
|
|
int i = sa[l], j = sa[r], k = 0, size = input.size();
|
|
|
|
while(i + k < size && j + k < size && input[i + k] == input[j + k]) k++;
|
|
|
|
return k;
|
|
|
|
}
|
|
|
|
|
|
|
|
// longest common prefix: lcp(i, j, k)
|
2018-08-21 03:17:12 +00:00
|
|
|
// O(n)
|
2018-09-02 14:06:41 +00:00
|
|
|
inline auto suffix_array_lcp(int i, int j, int k, array_view<uint8_t> input) -> int {
|
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]
2018-08-26 06:49:54 +00:00
|
|
|
int size = input.size();
|
2018-09-02 14:06:41 +00:00
|
|
|
while(i + k < size && j + k < size && input[i + k] == input[j + k]) k++;
|
|
|
|
return k;
|
|
|
|
}
|
|
|
|
|
|
|
|
// longest common prefix: lcp[n] == lcp(n, n-1)
|
|
|
|
// O(n)
|
|
|
|
inline auto suffix_array_lcp(array_view<int> sa, array_view<int> isa, array_view<uint8_t> input) -> vector<int> {
|
|
|
|
int k = 0, size = input.size();
|
|
|
|
vector<int> lcp;
|
|
|
|
lcp.reallocate(size + 1);
|
|
|
|
for(int i : range(size)) {
|
|
|
|
if(isa[i] == size) { k = 0; continue; } //the next substring is empty; ignore it
|
|
|
|
int j = sa[isa[i] + 1];
|
|
|
|
while(i + k < size && j + k < size && input[i + k] == input[j + k]) k++;
|
|
|
|
lcp[1 + isa[i]] = k;
|
|
|
|
if(k) k--;
|
2018-08-21 03:17:12 +00:00
|
|
|
}
|
2018-09-02 14:06:41 +00:00
|
|
|
lcp[0] = 0;
|
|
|
|
return lcp;
|
|
|
|
}
|
|
|
|
|
|
|
|
// longest common prefix (from permuted longest common prefix)
|
|
|
|
// O(n)
|
|
|
|
inline auto suffix_array_lcp(array_view<int> plcp, array_view<int> sa) -> vector<int> {
|
|
|
|
vector<int> lcp;
|
|
|
|
lcp.reallocate(plcp.size());
|
|
|
|
for(int i : range(plcp.size())) lcp[i] = plcp[sa[i]];
|
|
|
|
return lcp;
|
|
|
|
}
|
|
|
|
|
|
|
|
// permuted longest common prefix
|
|
|
|
// O(n)
|
|
|
|
inline auto suffix_array_plcp(array_view<int> phi, array_view<uint8_t> input) -> vector<int> {
|
|
|
|
vector<int> plcp;
|
|
|
|
plcp.reallocate(phi.size());
|
|
|
|
int k = 0, size = input.size();
|
|
|
|
for(int i : range(size)) {
|
|
|
|
int j = phi[i];
|
|
|
|
while(i + k < size && j + k < size && input[i + k] == input[j + k]) k++;
|
|
|
|
plcp[i] = k;
|
|
|
|
if(k) k--;
|
|
|
|
}
|
|
|
|
return plcp;
|
|
|
|
}
|
|
|
|
|
|
|
|
// permuted longest common prefix (from longest common prefix)
|
|
|
|
// O(n)
|
|
|
|
inline auto suffix_array_plcp(array_view<int> lcp, array_view<int> sa) -> vector<int> {
|
|
|
|
vector<int> plcp;
|
|
|
|
plcp.reallocate(lcp.size());
|
|
|
|
for(int i : range(lcp.size())) plcp[sa[i]] = lcp[i];
|
|
|
|
return plcp;
|
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]
2018-08-26 06:49:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// longest common prefixes - left + right
|
|
|
|
// llcp[m] == lcp(l, m)
|
|
|
|
// rlcp[m] == lcp(m, r)
|
|
|
|
// O(n)
|
2018-09-02 14:06:41 +00:00
|
|
|
// requires: lcp -or- plcp+sa
|
|
|
|
inline auto suffix_array_lrcp(vector<int>& llcp, vector<int>& rlcp, array_view<int> lcp, array_view<int> plcp, array_view<int> sa, array_view<uint8_t> input) -> void {
|
|
|
|
int size = input.size();
|
|
|
|
llcp.reset(), llcp.reallocate(size + 1);
|
|
|
|
rlcp.reset(), rlcp.reallocate(size + 1);
|
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]
2018-08-26 06:49:54 +00:00
|
|
|
|
|
|
|
function<int (int, int)> recurse = [&](int l, int r) -> int {
|
2019-09-13 13:15:11 +00:00
|
|
|
if(l >= r - 1) {
|
|
|
|
if(l >= size) return 0;
|
|
|
|
if(lcp) return lcp[l];
|
|
|
|
return plcp[sa[l]];
|
2018-09-02 14:06:41 +00: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]
2018-08-26 06:49:54 +00:00
|
|
|
int m = l + r >> 1;
|
2019-09-13 13:15:11 +00:00
|
|
|
llcp[m - 1] = recurse(l, m);
|
|
|
|
rlcp[m - 1] = recurse(m, r);
|
|
|
|
return min(llcp[m - 1], rlcp[m - 1]);
|
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]
2018-08-26 06:49:54 +00:00
|
|
|
};
|
2019-09-13 13:15:11 +00:00
|
|
|
recurse(1, size + 1);
|
2018-09-02 14:06:41 +00: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]
2018-08-26 06:49:54 +00:00
|
|
|
llcp[0] = 0;
|
|
|
|
rlcp[0] = 0;
|
2018-08-21 03:17:12 +00: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]
2018-08-26 06:49:54 +00:00
|
|
|
// longest previous factor
|
2018-08-21 03:17:12 +00:00
|
|
|
// O(n)
|
2018-09-02 14:06:41 +00:00
|
|
|
// optional: plcp
|
|
|
|
inline auto suffix_array_lpf(vector<int>& lengths, vector<int>& offsets, array_view<int> phi, array_view<int> plcp, array_view<uint8_t> input) -> void {
|
|
|
|
int k = 0, size = input.size();
|
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]
2018-08-26 06:49:54 +00:00
|
|
|
lengths.reset(), lengths.resize(size + 1, -1);
|
|
|
|
offsets.reset(), offsets.resize(size + 1, -1);
|
|
|
|
|
2018-09-02 14:06:41 +00:00
|
|
|
function<void (int, int, int)> recurse = [&](int i, int j, int k) -> void {
|
2018-08-21 03:17:12 +00:00
|
|
|
if(lengths[i] < 0) {
|
2018-09-02 14:06:41 +00:00
|
|
|
lengths[i] = k;
|
|
|
|
offsets[i] = j;
|
|
|
|
} else if(lengths[i] < k) {
|
|
|
|
if(offsets[i] > j) {
|
|
|
|
recurse(offsets[i], j, lengths[i]);
|
|
|
|
} else {
|
|
|
|
recurse(j, offsets[i], lengths[i]);
|
|
|
|
}
|
|
|
|
lengths[i] = k;
|
2018-08-21 03:17:12 +00:00
|
|
|
offsets[i] = j;
|
|
|
|
} else {
|
2018-09-02 14:06:41 +00:00
|
|
|
if(offsets[i] > j) {
|
|
|
|
recurse(offsets[i], j, k);
|
2018-08-21 03:17:12 +00:00
|
|
|
} else {
|
2018-09-02 14:06:41 +00:00
|
|
|
recurse(j, offsets[i], k);
|
2018-08-21 03:17:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
for(int i : range(size)) {
|
|
|
|
int j = phi[i];
|
2018-09-02 14:06:41 +00:00
|
|
|
if(plcp) k = plcp[i];
|
|
|
|
else while(i + k < size && j + k < size && input[i + k] == input[j + k]) k++;
|
2018-08-21 03:17:12 +00:00
|
|
|
if(i > j) {
|
2018-09-02 14:06:41 +00:00
|
|
|
recurse(i, j, k);
|
2018-08-21 03:17:12 +00:00
|
|
|
} else {
|
2018-09-02 14:06:41 +00:00
|
|
|
recurse(j, i, k);
|
2018-08-21 03:17:12 +00:00
|
|
|
}
|
2018-09-02 14:06:41 +00:00
|
|
|
if(k) k--;
|
2018-08-21 03:17:12 +00: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]
2018-08-26 06:49:54 +00:00
|
|
|
|
|
|
|
lengths[0] = 0;
|
|
|
|
offsets[0] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// O(n log m)
|
2018-09-02 14:06:41 +00:00
|
|
|
inline auto suffix_array_find(int& length, int& offset, array_view<int> sa, array_view<uint8_t> input, array_view<uint8_t> match) -> bool {
|
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]
2018-08-26 06:49:54 +00:00
|
|
|
length = 0, offset = 0;
|
|
|
|
int l = 0, r = input.size();
|
|
|
|
|
|
|
|
while(l < r - 1) {
|
|
|
|
int m = l + r >> 1;
|
2018-09-02 14:06:41 +00:00
|
|
|
int s = sa[m];
|
2018-08-21 03:17:12 +00: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]
2018-08-26 06:49:54 +00:00
|
|
|
int k = 0;
|
|
|
|
while(k < match.size() && s + k < input.size()) {
|
|
|
|
if(match[k] != input[s + k]) break;
|
|
|
|
k++;
|
|
|
|
}
|
2018-08-21 03:17:12 +00: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]
2018-08-26 06:49:54 +00:00
|
|
|
if(k > length) {
|
|
|
|
length = k;
|
|
|
|
offset = s;
|
|
|
|
if(k == match.size()) return true;
|
|
|
|
}
|
2018-08-21 03:17:12 +00:00
|
|
|
|
2019-09-13 13:15:11 +00:00
|
|
|
if(k == match.size() || s + k == input.size()) k--;
|
|
|
|
|
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]
2018-08-26 06:49:54 +00:00
|
|
|
if(match[k] < input[s + k]) {
|
|
|
|
r = m;
|
|
|
|
} else {
|
|
|
|
l = m;
|
|
|
|
}
|
2018-08-21 03:17:12 +00: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]
2018-08-26 06:49:54 +00:00
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// O(n + log m)
|
2018-09-02 14:06:41 +00:00
|
|
|
inline auto suffix_array_find(int& length, int& offset, array_view<int> llcp, array_view<int> rlcp, array_view<int> sa, array_view<uint8_t> input, array_view<uint8_t> match) -> bool {
|
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]
2018-08-26 06:49:54 +00:00
|
|
|
length = 0, offset = 0;
|
|
|
|
int l = 0, r = input.size(), k = 0;
|
|
|
|
|
|
|
|
while(l < r - 1) {
|
|
|
|
int m = l + r >> 1;
|
2018-09-02 14:06:41 +00:00
|
|
|
int s = sa[m];
|
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]
2018-08-26 06:49:54 +00:00
|
|
|
|
|
|
|
while(k < match.size() && s + k < input.size()) {
|
|
|
|
if(match[k] != input[s + k]) break;
|
|
|
|
k++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(k > length) {
|
|
|
|
length = k;
|
|
|
|
offset = s;
|
|
|
|
if(k == match.size()) return true;
|
|
|
|
}
|
|
|
|
|
2019-09-13 13:15:11 +00:00
|
|
|
if(k == match.size() || s + k == input.size()) k--;
|
|
|
|
|
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]
2018-08-26 06:49:54 +00:00
|
|
|
if(match[k] < input[s + k]) {
|
|
|
|
r = m;
|
|
|
|
k = min(k, llcp[m]);
|
|
|
|
} else {
|
|
|
|
l = m;
|
|
|
|
k = min(k, rlcp[m]);
|
|
|
|
}
|
2018-08-21 03:17:12 +00: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]
2018-08-26 06:49:54 +00:00
|
|
|
return false;
|
2018-08-21 03:17:12 +00: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]
2018-08-26 06:49:54 +00:00
|
|
|
//
|
|
|
|
|
2018-09-02 14:06:41 +00:00
|
|
|
//there are multiple strategies for building the required auxiliary structures for suffix arrays
|
|
|
|
|
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]
2018-08-26 06:49:54 +00:00
|
|
|
struct SuffixArray {
|
|
|
|
using type = SuffixArray;
|
|
|
|
|
|
|
|
//O(n)
|
|
|
|
inline SuffixArray(array_view<uint8_t> input) : input(input) {
|
2018-09-02 14:06:41 +00:00
|
|
|
sa = suffix_array(input);
|
2018-08-21 03:17:12 +00: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]
2018-08-26 06:49:54 +00:00
|
|
|
|
|
|
|
//O(n)
|
|
|
|
inline auto lrcp() -> type& {
|
2018-09-02 14:06:41 +00:00
|
|
|
//if(!isa) isa = suffix_array_invert(sa);
|
|
|
|
//if(!lcp) lcp = suffix_array_lcp(sa, isa, input);
|
|
|
|
if(!phi) phi = suffix_array_phi(sa);
|
|
|
|
if(!plcp) plcp = suffix_array_plcp(phi, input);
|
|
|
|
//if(!lcp) lcp = suffix_array_lcp(plcp, sa);
|
|
|
|
if(!llcp || !rlcp) suffix_array_lrcp(llcp, rlcp, lcp, plcp, sa, input);
|
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]
2018-08-26 06:49:54 +00:00
|
|
|
return *this;
|
2018-08-21 03:17:12 +00: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]
2018-08-26 06:49:54 +00:00
|
|
|
//O(n)
|
|
|
|
inline auto lpf() -> type& {
|
2018-09-02 14:06:41 +00:00
|
|
|
if(!phi) phi = suffix_array_phi(sa);
|
|
|
|
//if(!plcp) plcp = suffix_array_plcp(phi, input);
|
|
|
|
if(!lengths || !offsets) suffix_array_lpf(lengths, offsets, phi, plcp, input);
|
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]
2018-08-26 06:49:54 +00:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline auto operator[](int offset) const -> int {
|
2018-09-02 14:06:41 +00:00
|
|
|
return sa[offset];
|
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]
2018-08-26 06:49:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//O(n log m)
|
2018-09-02 14:06:41 +00:00
|
|
|
//O(n + log m) with lrcp()
|
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]
2018-08-26 06:49:54 +00:00
|
|
|
inline auto find(int& length, int& offset, array_view<uint8_t> match) -> bool {
|
2018-09-02 14:06:41 +00:00
|
|
|
if(!llcp || !rlcp) return suffix_array_find(length, offset, sa, input, match); //O(n log m)
|
|
|
|
return suffix_array_find(length, offset, llcp, rlcp, sa, input, match); //O(n + log m)
|
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]
2018-08-26 06:49:54 +00:00
|
|
|
}
|
|
|
|
|
2018-09-02 14:06:41 +00:00
|
|
|
//O(n) with lpf()
|
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]
2018-08-26 06:49:54 +00:00
|
|
|
inline auto previous(int& length, int& offset, int address) -> void {
|
|
|
|
length = lengths[address];
|
|
|
|
offset = offsets[address];
|
|
|
|
}
|
|
|
|
|
|
|
|
//non-owning reference: SuffixArray is invalidated if memory is freed
|
|
|
|
array_view<uint8_t> input;
|
|
|
|
|
|
|
|
//suffix array and auxiliary data structures
|
2018-09-02 14:06:41 +00:00
|
|
|
vector<int> sa; //suffix array
|
|
|
|
vector<int> isa; //inverted suffix array
|
|
|
|
vector<int> phi; //phi
|
|
|
|
vector<int> plcp; //permuted longest common prefixes
|
|
|
|
vector<int> lcp; //longest common prefixes
|
|
|
|
vector<int> llcp; //longest common prefixes - left
|
|
|
|
vector<int> rlcp; //longest common prefixes - right
|
|
|
|
vector<int> lengths; //longest previous factors
|
|
|
|
vector<int> offsets; //longest previous factors
|
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]
2018-08-26 06:49:54 +00:00
|
|
|
};
|
2018-08-21 03:17:12 +00:00
|
|
|
|
|
|
|
}
|