Mercurial > hg > forks > multipaint-js
diff exporters.pde @ 29:249c4f5742f3
Refactor the import/export stuff a bit and the GUI bits for JS.
Still a work in progress, only "format" export/import works now.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 04 Jul 2018 10:36:43 +0300 |
parents | cecc594d1559 |
children | 2d9a674bdeb2 |
line wrap: on
line diff
--- a/exporters.pde Wed Jul 04 10:34:12 2018 +0300 +++ b/exporters.pde Wed Jul 04 10:36:43 2018 +0300 @@ -391,16 +391,18 @@ g_map[ad + 7] = byte( g_template[head] & 1); } -void format_import(String fname) { + +void format_import(byte[] fhd) { int x, y, x2, y2, y3, head, xx, yy, yp, ad, valu; int p1, p2, p3; head = 0; + g_template = fhd; + if (machine == SPECTRUM) //SCR=SCREEN$ { // 32*24*8 bytes of bitmap // 32*24 bytes of attributes - import_program(fname); if (g_template.length < 6912) { message("FALSE"); return; @@ -444,9 +446,8 @@ //0x0002->bitmap //0x1f42->colormap //0x232a=border (take the lower nybble) - import_program(fname); //art studio if (g_template.length < 9006) { - message("FALSE"); + message("FALSE "+ str(g_template.length)); return; } if (g_template.length >= 0x232a) { @@ -473,8 +474,6 @@ //2 - luminance 40*25 //1026 - colors 40*25 //2050 - bitmappi 40*25*8 - import_program(fname); - if (g_template.length < 10050) { message("FALSE"); return; @@ -508,8 +507,6 @@ //1025 - bäkki2 //1026 - colors 40*25 //2050 - bitmap 40*25*8 - import_program(fname); - if (g_template.length < 10050) { message("FALSE"); return; @@ -550,9 +547,8 @@ //0x232a border //0x232b background //0x233a colors2 (40*25) - import_program(fname); if (g_template.length < 10018) { - message("FALSE"); + message("FALSE "+ str(g_template.length)); return; } for (y = 0; y < 25; y++) { @@ -580,7 +576,6 @@ if (machine == MSX) { // sc2 // 7=bitmap 32*24*8 // 7+(32*24*8)=colormap 32*24 - import_program(fname); if (g_template.length < 14343) { message("FALSE"); return; @@ -608,7 +603,6 @@ } if (machine == CPC) { // a studio? - import_program(fname); message("Not|Working"); } @@ -1262,11 +1256,11 @@ } void load_template(String fname) { - g_template = loadBytes("templates/" + fname); + g_template = mpLoadBinaryFile("templates/" + fname); } void import_program(String fname) { - g_template = loadBytes(fname); + g_template = mpLoadBinaryFile(fname); } void set_head(int pos) { @@ -1279,10 +1273,8 @@ } void export_program(String fname) { - if (g_sorsaa == 1) { - return; - } - saveBytes(fname, g_template); + if (g_sorsaa != 1) + mpSaveBinaryFile(fname, g_template); } void outputter(String oput, boolean eol) {