diff --git a/exec/avatars.js b/exec/avatars.js index a09f591ca543f0927cdb024b30f6758c29bb8680..2b70f59fdf0fb3906b6cc0664094197e896c4bee 100644 --- a/exec/avatars.js +++ b/exec/avatars.js @@ -133,12 +133,13 @@ function import_shared_file(hdr, body) return false; } if(sauce.datatype != SAUCE.defs.datatype.bin - || sauce.cols != lib.defs.width) { - alert(format("%s has invalid SAUCE! (%u %u)" - ,file.name, sauce.datatype, sauce.cols)); + || sauce.cols != lib.defs.width + || (sauce.filesize%lib.size) != 0) { + alert(format("%s has invalid SAUCE! (datatype=%u cols=%u size=%u)" + ,file.name, sauce.datatype, sauce.cols, sauce.filesize)); return false; } - var new_path = format("%savatars/%s", system.text_dir, filename); + var new_path = format("%s%s", lib.local_library(), filename); var result = file_copy(file.name, new_path); if(!result) alert("ERROR copying " + file.name + " to " + new_path); @@ -294,7 +295,7 @@ function main() optval[arg] = val; switch(arg) { - case '-f': + case '-file': filename = val; break; case '-offset': @@ -320,7 +321,7 @@ function main() break; } } - + mkdir(lib.local_library()); for(var c in cmds) { var cmd = cmds[c].toLowerCase(); switch(cmd) { diff --git a/exec/load/avatar_lib.js b/exec/load/avatar_lib.js index 24f94448c8d17ea0d8682fae08aeb0ca25db4b2a..ee343eae978f784a8f8c9df054fa93acf2f2b329 100644 --- a/exec/load/avatar_lib.js +++ b/exec/load/avatar_lib.js @@ -7,6 +7,8 @@ const defs = { height: 6, }; +const size = defs.width * defs.height * 2; // 2 bytes per cell for char and attributes + function local_library() { return format("%savatars/", system.text_dir);