Compare commits

..

3 commits

Author SHA1 Message Date
3c58e9134a scrollbar improvement
All checks were successful
/ mirror_to_github (push) Successful in 19s
/ test (push) Successful in 4s
2024-11-29 21:02:51 +00:00
cfef6cabdf upgrade libv86 to support network better 2024-11-28 06:25:05 +00:00
a9d0aa1037 support pagedown/up 2024-11-28 06:24:49 +00:00
5 changed files with 555 additions and 545 deletions

View file

@ -44,7 +44,7 @@ if( typeof AFRAME != 'undefined '){
muteUntilPrompt:{ type: 'boolean',"default":true}, // mute stdout until a prompt is detected in ISO
HUD: { type: 'boolean',"default":false}, // link to camera movement
transparent: { type:'boolean', "default":false }, // need good gpu
memory: { type: 'number', "default":40 }, // VM memory (in MB) [NOTE: quest or smartphone might crash > 40mb ]
memory: { type: 'number', "default":64 }, // VM memory (in MB) [NOTE: quest or smartphone might crash > 40mb ]
bufferLatency: { type: 'number', "default":1 }, // in ms: bufferlatency from webworker to xterm (batch-update every char to texture)
debug: { type: 'boolean', "default":false }
},
@ -311,7 +311,7 @@ if( typeof AFRAME != 'undefined '){
cols: this.cols,
rows: this.rows,
el_or_id: el,
max_scroll_lines: this.rows,
max_scroll_lines: this.rows*2,
nodim: true,
rainbow: [VT100.COLOR_MAGENTA, VT100.COLOR_CYAN ],
xr: AFRAME.scenes[0].renderer.xr,
@ -376,7 +376,7 @@ if( typeof AFRAME != 'undefined '){
this.data.width -= this.data.padding*2
this.data.height -= this.data.padding*2
this.cols = Math.floor(this.data.width/this.data.lineHeight*2)
this.rows = Math.floor(this.data.height*0.53/this.data.lineHeight*1.7)
this.rows = Math.floor( (this.data.height*0.93)/this.data.lineHeight)
},
events:{

View file

@ -123,8 +123,11 @@ ISOTerminal.prototype.start = function(opts){
url: "bios/vgabios.bin",
//urg|: "com/isoterminal/bios/VGABIOS-lgpl-latest.bin",
},
network_relay_url: "wss://relay.widgetry.org/",
cmdline: "rw root=host9p rootfstype=9p rootflags=trans=virtio,cache=loose modules=virtio_pci tsc=reliable init_on_freg|=on vga=ask", //vga=0x122",
net_device:{
relay_url:"fetch", // or websocket proxy "wss://relay.widgetry.org/",
type:"virtio"
},
//bzimage_initrd_from_filesystem: true,
//filesystem: {
// baseurl: "com/isoterminal/v86/images/alpine-rootfs-flat",
@ -224,6 +227,8 @@ ISOTerminal.prototype.startVM = function(opts){
\r https://www.w3.org/TR/webxr
\r https://three.org
\r https://aframe.org
\r https://busybox.net
\r https://buildroot.org
`
const text_color = "\r"
@ -252,7 +257,7 @@ ISOTerminal.prototype.startVM = function(opts){
const str = e.detail
// lets scan for a prompt so we can send a 'ready' event to the world
if( !this.ready && str.match(/\n(\/ #|~%|\[.*\]>)/) ) this.postBoot()
if( !this.ready && str.match(/\n(\/ #|~ #|~%|\[.*\]>)/) ) this.postBoot()
if( this.ready || !this.opts.muteUntilPrompt ) this.emit('serial-output-string', e.detail )
})

View file

@ -100,6 +100,8 @@ function VT100(opts)
bg = VT100.COLOR_TRANSPARENT //COLOR_BLACK;
}
console.dir(opts)
var r;
var c;
var scr = typeof el_or_id == 'string' ? document.getElementById(el_or_id) : el_or_id
@ -120,7 +122,9 @@ function VT100(opts)
this.redraw_[r] = 1;
}
this.scr_ = scr;
this.scr_.style.display = 'inline'
this.scr_.style.display = 'block'
this.scr_.style.overflowY = 'scroll'
this.scr_.style.height = '100%'
this.setupTouchInputFallback() // smartphone/android
this.cursor_vis_ = true;
this.cursor_key_mode_ = VT100.CK_CURSOR;
@ -129,7 +133,7 @@ function VT100(opts)
this.key_buf_ = [];
this.echo_ = false;
this.esc_state_ = 0;
this.log_level_ = VT100.WARN
this.log_level_ = VT100.WARN //VT100.DEBUG
this.clear_all();
@ -262,14 +266,20 @@ VT100.handle_onkeypress_ = function VT100_handle_onkeypress(event,cb)
ch = '\x1b';
case "Control":
break;
case "PageDown":
ch = '\x1b[6~';
break;
case "PageUp":
ch = '\x1b[5~';
break;
default:
return true
break;
}
// custom map override
if( vt.opts.map[ event.code ].ch ) ch = vt.opts.map[ event.code ].ch
if( vt.opts.map[ event.code ].ctrl && event.ctrlKey ) ch = vt.opts.map[ event.code ].ctrl
}
// custom map override
if( vt.opts.map[ event.code ]?.ch ) ch = vt.opts.map[ event.code ].ch
if( vt.opts.map[ event.code ]?.ctrl && event.ctrlKey ) ch = vt.opts.map[ event.code ].ctrl
// Workaround: top the event from doing anything else.
// (prevent input from adding characters instead of via VM)
@ -653,10 +663,10 @@ VT100.prototype.refresh = function VT100_refresh()
// XXX: Remove older rows if past max_ht_ rows.
var num_rows = this.num_rows_ - this.start_row_id;
if (num_rows >= (this.max_ht_ + 100)) {
// Remove one group of rows (i.e. a 100 rows).
this.scr_.removeChild(this.scr_.firstChild);
this.start_row_id += 100;
if ( this.scr_.firstChild && num_rows >= (this.max_ht_ + 100)) {
// Remove one group of rows (i.e. a 100 rows).
this.scr_.removeChild(this.scr_.firstChild);
this.start_row_id += 100;
}
for (r = 0; r < ht; ++r) {
@ -738,6 +748,7 @@ VT100.prototype.refresh = function VT100_refresh()
div_element.innerHTML = row_html;
//dump("adding row html: " + row_html + "\n");
}
this.scr_.scrollTop = this.scr_.scrollHeight
this.curs_set(1)
}

File diff suppressed because it is too large Load diff

Binary file not shown.