summaryrefslogtreecommitdiff
path: root/tools/asset_packer.cc
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-01 00:58:20 +0100
committerskal <pascal.massimino@gmail.com>2026-02-01 01:13:53 +0100
commit18eb8a07ba39a8aad1c75521cee027b9c9c72e40 (patch)
tree87e498dbaffdd591eb94fddca315f6ba28756a32 /tools/asset_packer.cc
parent03cd94817097e59a0809b222e0e1e74dd9a8ede7 (diff)
clang-format
Diffstat (limited to 'tools/asset_packer.cc')
-rw-r--r--tools/asset_packer.cc18
1 files changed, 11 insertions, 7 deletions
diff --git a/tools/asset_packer.cc b/tools/asset_packer.cc
index 4a2e631..c803c02 100644
--- a/tools/asset_packer.cc
+++ b/tools/asset_packer.cc
@@ -8,7 +8,7 @@
#include <string>
#include <vector>
-int main(int argc, char *argv[]) {
+int main(int argc, char* argv[]) {
if (argc != 4) {
std::cerr << "Usage: " << argv[0]
<< " <assets.txt_path> <output_assets_h_path> "
@@ -59,17 +59,20 @@ int main(int argc, char *argv[]) {
std::vector<std::string> asset_names;
while (std::getline(assets_txt_file, line)) {
- if (line.empty() || line[0] == '#') continue;
+ if (line.empty() || line[0] == '#')
+ continue;
size_t first_comma = line.find(',');
- if (first_comma == std::string::npos) continue;
+ if (first_comma == std::string::npos)
+ continue;
std::string asset_name = line.substr(0, first_comma);
asset_name.erase(0, asset_name.find_first_not_of(" \t\r\n"));
asset_name.erase(asset_name.find_last_not_of(" \t\r\n") + 1);
size_t second_comma = line.find(',', first_comma + 1);
- if (second_comma == std::string::npos) continue;
+ if (second_comma == std::string::npos)
+ continue;
std::string filename =
line.substr(first_comma + 1, second_comma - first_comma - 1);
@@ -99,13 +102,14 @@ int main(int argc, char *argv[]) {
assets_data_cc_file << "static const uint8_t ASSET_DATA_" << asset_name
<< "[] = {";
for (size_t i = 0; i < buffer.size(); ++i) {
- if (i % 12 == 0) assets_data_cc_file << "\n ";
+ if (i % 12 == 0)
+ assets_data_cc_file << "\n ";
assets_data_cc_file << "0x" << std::hex << (int)buffer[i] << std::dec
<< (i == buffer.size() - 1 ? "" : ", ");
}
assets_data_cc_file << "\n};\n\n";
- asset_id_counter++;
+ ++asset_id_counter;
}
assets_h_file << "};\n\n";
@@ -114,7 +118,7 @@ int main(int argc, char *argv[]) {
// Generate the lookup array in assets_data.cc
assets_data_cc_file << "extern const AssetRecord g_assets[] = {\n";
- for (const std::string &name : asset_names) {
+ for (const std::string& name : asset_names) {
assets_data_cc_file << " { ASSET_DATA_" << name << ", sizeof(ASSET_DATA_"
<< name << ") },\n";
}