Skip to content
Snippets Groups Projects
Commit e0fd7dd1 authored by rswindell's avatar rswindell
Browse files

Confirm the *length* of imported .bin files (must be evenly divisble by

avatar size) before copying to text/avatars.
Use '-file=<filename>', rather than -f.
Export/share an avatar library like this:
  jsexec avatars export=syncdata -file=../text/avatars/custom.bin
Export user's avatars like this:
  jsexec avatars export=syncdata -users
Import avatars (users and shared libraries), like this:
  jsexec avatars import=syncdata
(replace syncdata with the correct code for the syncdata sub)
parent 62af52ba
Branches
Tags
No related merge requests found
......@@ -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) {
......
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment