treballant en resources.pack
This commit is contained in:
51
tools/pack_resources.cpp
Normal file
51
tools/pack_resources.cpp
Normal file
@@ -0,0 +1,51 @@
|
||||
#include "../source/resource_pack.h"
|
||||
#include <iostream>
|
||||
#include <filesystem>
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
std::string dataDir = "data";
|
||||
std::string outputFile = "resources.pack";
|
||||
|
||||
if (argc > 1) {
|
||||
dataDir = argv[1];
|
||||
}
|
||||
if (argc > 2) {
|
||||
outputFile = argv[2];
|
||||
}
|
||||
|
||||
std::cout << "Coffee Crisis Arcade Edition - Resource Packer" << std::endl;
|
||||
std::cout << "===============================================" << std::endl;
|
||||
std::cout << "Input directory: " << dataDir << std::endl;
|
||||
std::cout << "Output file: " << outputFile << std::endl;
|
||||
std::cout << "Note: config/ directory is excluded from packing" << std::endl;
|
||||
std::cout << std::endl;
|
||||
|
||||
if (!std::filesystem::exists(dataDir)) {
|
||||
std::cerr << "Error: Input directory does not exist: " << dataDir << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
ResourcePack pack;
|
||||
|
||||
std::cout << "Scanning and packing resources..." << std::endl;
|
||||
if (!pack.addDirectory(dataDir)) {
|
||||
std::cerr << "Error: Failed to add directory to pack" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::cout << "Found " << pack.getResourceCount() << " resources" << std::endl;
|
||||
|
||||
std::cout << "Saving pack file..." << std::endl;
|
||||
if (!pack.savePack(outputFile)) {
|
||||
std::cerr << "Error: Failed to save pack file" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::filesystem::path packPath(outputFile);
|
||||
auto fileSize = std::filesystem::file_size(packPath);
|
||||
|
||||
std::cout << "Pack file created successfully!" << std::endl;
|
||||
std::cout << "File size: " << (fileSize / 1024.0 / 1024.0) << " MB" << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user