# HG changeset patch # User Wuzzy # Date 1519412772 0 # Node ID 11ecdec25bf3a59639f2e901e773d6ab908d81ba # Parent c4a843642c21f8c4dc747c2571231460eec1d34f RandomNotes: How to converts a `.hwmap` file to Lua diff -r c4a843642c21 -r 11ecdec25bf3 RandomNotes.wiki --- a/RandomNotes.wiki Fri Feb 23 19:03:39 2018 +0000 +++ b/RandomNotes.wiki Fri Feb 23 19:06:12 2018 +0000 @@ -10,6 +10,14 @@ * `void GameUIConfig::SaveOptions()` in `gameuiconfig.cpp` loads (or initializes) values and set the widgets to those values * `PageOptions::PageOptions(QWidget* parent) : AbstractPage(parent)` is where you would add your widget += How to converts a `.hwmap` file to a Lua string = + +Run this in a shell: + +IN="map.hwmap";OUT="temp.lua";base64 -d $IN | tail -c +7 | head -c -4 > foo;echo -ne "\x1f\x8b\x08\0\0\0\0\0\x02\xff" > bar;cat bar foo | gunzip > baz;C=0;echo -n "local map = { " >> $OUT;od -w240 -t u1 baz | grep -Ev "^[0-9]*[[:space:]]*$" | while read f;do C=$((C+1));if ((C!=1));then echo "," >> $OUT;fi;echo -n $f | sed "s/^......./'/;s/ */\\\\/g;s/$/'/" >> $OUT;done;echo "}" >> $OUT + +Input file: `map.hwmap` +Output file: `temp.lua` = Syntax test =