mirror of
https://github.com/izzy2lost/Diddy-Kong-Racing.git
synced 2026-06-19 01:16:26 -07:00
30 lines
816 B
C++
30 lines
816 B
C++
#include "extract_compressed.h"
|
|
|
|
ExtractCompressed::ExtractCompressed(std::vector<uint8_t> data, ROM& rom, std::string outFilepath)
|
|
: Extract(data, rom, outFilepath) {
|
|
|
|
if(data.size() == 0) {
|
|
std::cout << "Warning: \"" << outFilepath << "\" is empty." << std::endl;
|
|
write_binary_file(data, outFilepath);
|
|
print_extracted(outFilepath);
|
|
return;
|
|
}
|
|
|
|
// Needed padding to prevent errors with decompressing.
|
|
if(data[data.size() - 1] != 0) {
|
|
data.push_back(0);
|
|
data.push_back(0);
|
|
data.push_back(0);
|
|
data.push_back(0);
|
|
}
|
|
|
|
DKRCompression compression;
|
|
data = compression.decompressBuffer(data);
|
|
|
|
write_binary_file(data, outFilepath);
|
|
print_extracted(outFilepath);
|
|
}
|
|
|
|
ExtractCompressed::~ExtractCompressed(){
|
|
}
|