Fixed segfault issue with dkr_extractor

This commit is contained in:
David Benepe
2021-06-28 17:57:58 -05:00
parent cea4c2c30c
commit f70b44e2b6
3 changed files with 7 additions and 7 deletions
+3 -3
View File
@@ -17,7 +17,7 @@ namespace fs = std::experimental::filesystem;
const std::string CONFIG_EXTENSION = ".config.json";
const std::string ROM_EXTENSIONS[3] = { ".z64", ".v64", ".n64" };
const std::string ROM_EXTENSIONS[] = { ".z64", ".v64", ".n64", ".rom" };
std::string outDirectory;
std::string currentCategory;
@@ -101,9 +101,9 @@ int main(int argc, char* argv[]) {
for (const auto & entry : fs::directory_iterator(baseromsDirectory)){
std::string filename = entry.path().string();
//if(ends_with_rom_extension(filename)) {
if(ends_with_rom_extension(filename)) {
roms.push_back(ROM(filename));
//}
}
}
bool completedAnExtraction = false;
@@ -35,10 +35,10 @@ ExtractTextures::ExtractTextures(std::vector<uint8_t> data, ROM& rom, std::strin
int textureSize = get_texture_size(width, height, textureFormat);
std::vector<uint8_t> texHeader(texData.begin() + dataOffset, texData.begin() + dataOffset + TEX_HEADER_SIZE);
std::vector<uint8_t> texData(texData.begin() + dataOffset + TEX_HEADER_SIZE, texData.begin() + dataOffset + textureSize);
std::vector<uint8_t> texData2(texData.begin() + dataOffset + TEX_HEADER_SIZE, texData.begin() + dataOffset + textureSize);
process_texture(texHeader, texData);
combinedTexturesData.insert(combinedTexturesData.end(), texData.begin(), texData.end());
process_texture(texHeader, texData2);
combinedTexturesData.insert(combinedTexturesData.end(), texData2.begin(), texData2.end());
dataOffset += textureSize;
totalHeight += texHeader[1];