Skip to content
Snippets Groups Projects
Commit a9189017 authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Ensure graphics are cached successfully.

It appears that cache operations in SyncTERM on Windows does not
currently work with subdirectories for some reason (likely
backslashes).  Ensure that after sending a file to be cached, it
correctly appears in the cache, and fall back to not using graphics.

This will fix the blank board issue in minesweeper with a Windows
SyncTERM and fallback to text mode.

Once SyncTERM is fixed, it should work in graphics mode too.
parent 64ff6820
No related branches found
No related tags found
No related merge requests found
......@@ -1166,6 +1166,7 @@ function detect_graphics()
var lst;
var m;
var b;
var sent;
// Detect PPM graphics and load the cache
graph = false;
......@@ -1180,6 +1181,7 @@ function detect_graphics()
// Load up cache...
f = new File(js.exec_dir+'/'+gfile);
if (f.open('rb')) {
sent = false;
md5 = f.md5_hex;
console.write('\x1b_SyncTERM:C;L;minesweeper/'+gfile+'\x1b\\');
lst = read_apc();
......@@ -1190,33 +1192,56 @@ function detect_graphics()
f.base64 = true;
console.write(f.read());
console.write('\x1b\\');
sent = true;
}
f.close();
console.write('\x1b_SyncTERM:C;LoadPPM;B=0;minesweeper/'+gfile+'\x1b\\');
f = new File(js.exec_dir+'/'+mfile);
if (f.open('rb')) {
md5 = f.md5_hex;
console.write('\x1b_SyncTERM:C;L;minesweeper/'+mfile+'\x1b\\');
if (sent) {
console.write('\x1b_SyncTERM:C;L;minesweeper/'+gfile+'\x1b\\');
lst = read_apc();
m = lst.match(/\nselmask.pbm\t([0-9a-f]+)\n/);
m = lst.match(/\ngraphics.ppm\t([0-9a-f]+)\n/);
if (m == null || m[1] !== md5) {
// Store in cache...
console.write('\x1b_SyncTERM:C;S;minesweeper/'+mfile+';');
f.base64 = true;
console.write(f.read());
console.write('\x1b\\');
graph = false;
}
f.close();
console.write('\x1b_SyncTERM:C;LoadPBM;minesweeper/'+mfile+'\x1b\\');
}
else {
graph = false;
f.close();
if (graph) {
sent = false;
f = new File(js.exec_dir+'/'+mfile);
if (f.open('rb')) {
md5 = f.md5_hex;
console.write('\x1b_SyncTERM:C;L;minesweeper/'+mfile+'\x1b\\');
lst = read_apc();
m = lst.match(/\nselmask.pbm\t([0-9a-f]+)\n/);
if (m == null || m[1] !== md5) {
// Store in cache...
console.write('\x1b_SyncTERM:C;S;minesweeper/'+mfile+';');
f.base64 = true;
console.write(f.read());
console.write('\x1b\\');
sent = true;
}
console.write('\x1b_SyncTERM:C;L;minesweeper/'+mfile+'\x1b\\');
lst = read_apc();
m = lst.match(/\nselmask.pbm\t([0-9a-f]+)\n/);
if (m == null || m[1] !== md5) {
graph = false;
}
f.close();
}
else {
graph = false;
}
}
}
else {
graph = false;
}
}
if (graph) {
console.write('\x1b_SyncTERM:C;LoadPPM;B=0;minesweeper/'+gfile+'\x1b\\');
console.write('\x1b_SyncTERM:C;LoadPBM;minesweeper/'+mfile+'\x1b\\');
}
console.ctrlkey_passthru = tmpckpt;
if (graph) {
console.mouse_mode = false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment