mirror of
https://github.com/aimrebirth/tools.git
synced 2026-04-15 01:43:25 +00:00
[unpaker2] Some RLEW experiments.
This commit is contained in:
parent
e0343576b7
commit
6b1db00fe6
2 changed files with 15 additions and 25 deletions
|
|
@ -32,8 +32,6 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
//#include <archive.h>
|
|
||||||
#include <lzma.h>
|
|
||||||
#include <lzo/lzo1x.h>
|
#include <lzo/lzo1x.h>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
@ -108,7 +106,7 @@ void unpack_file(path fn) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case segment::decode_algorithm::lzo: {
|
case segment::decode_algorithm::lzo: {
|
||||||
size_t outsz = supported_block_size;
|
size_t outsz;
|
||||||
auto r2 = lzo1x_decompress(s.p, len, pp, &outsz, 0);
|
auto r2 = lzo1x_decompress(s.p, len, pp, &outsz, 0);
|
||||||
if (r2 != LZO_E_OK) {
|
if (r2 != LZO_E_OK) {
|
||||||
throw std::runtime_error{"lzo error"};
|
throw std::runtime_error{"lzo error"};
|
||||||
|
|
@ -117,31 +115,22 @@ void unpack_file(path fn) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case segment::decode_algorithm::rlew: {
|
case segment::decode_algorithm::rlew: {
|
||||||
auto finalLength = len;
|
auto base = s.p;
|
||||||
//uint16_t flag = 0xfefe;
|
|
||||||
//uint8_t flag = 0xfe;
|
|
||||||
uint16_t flag = s;
|
uint16_t flag = s;
|
||||||
flag <<= 8;
|
|
||||||
flag |= 0xfe;
|
|
||||||
uint32_t outlen = 0;
|
uint32_t outlen = 0;
|
||||||
while (outlen < finalLength) {
|
while (s.p < base + len) {
|
||||||
if (pp-bbb.data() == 0x1cc38) {
|
uint8_t w = s;
|
||||||
int a = 5;
|
if (w == 0xfe && (*(uint8_t*)s.p) == flag) {
|
||||||
a++;
|
uint8_t w1 = s;
|
||||||
}
|
auto cntr = 0x20e;
|
||||||
decltype(flag) w = s;
|
uint8_t w2 = s;
|
||||||
if (w == flag) {
|
while (cntr--) {
|
||||||
decltype(flag) w1 = s;
|
*(decltype(w2)*)pp = w2;
|
||||||
decltype(flag) w2 = s;
|
pp += sizeof(w2);
|
||||||
while (w1--) {
|
|
||||||
*(decltype(flag) *)pp = w2;
|
|
||||||
pp += sizeof(flag);
|
|
||||||
outlen += sizeof(flag);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
*(decltype(flag)*)pp = w;
|
*(decltype(w)*)pp = w;
|
||||||
pp += sizeof(flag);
|
pp += sizeof(w);
|
||||||
outlen += sizeof(flag);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -151,6 +140,7 @@ void unpack_file(path fn) {
|
||||||
throw std::runtime_error{"compression unsupported: "s + std::to_string(seg.algorithm)};
|
throw std::runtime_error{"compression unsupported: "s + std::to_string(seg.algorithm)};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
exi:
|
||||||
pp = bbb.data();
|
pp = bbb.data();
|
||||||
|
|
||||||
auto dir = fn += ".dir2";
|
auto dir = fn += ".dir2";
|
||||||
|
|
|
||||||
2
sw.cpp
2
sw.cpp
|
|
@ -54,7 +54,7 @@ void build(Solution &s)
|
||||||
auto &unpaker = add_exe_base("unpaker"); // 32-bit only
|
auto &unpaker = add_exe_base("unpaker"); // 32-bit only
|
||||||
if (unpaker.getBuildSettings().TargetOS.Arch != ArchType::x86)
|
if (unpaker.getBuildSettings().TargetOS.Arch != ArchType::x86)
|
||||||
unpaker.HeaderOnly = true;
|
unpaker.HeaderOnly = true;
|
||||||
add_exe_with_common("unpaker2") += "org.sw.demo.libarchive.libarchive"_dep;
|
add_exe_with_common("unpaker2") += "org.sw.demo.oberhumer.lzo.lzo"_dep;
|
||||||
|
|
||||||
// not so simple targets
|
// not so simple targets
|
||||||
auto &script2txt = add_exe_with_common("script2txt");
|
auto &script2txt = add_exe_with_common("script2txt");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue