clean up some stuff and upgrade to the latest superqemu release

This commit is contained in:
modeco80
2024-08-23 10:01:41 -04:00
parent b66810a227
commit 338cc6e824
4 changed files with 23 additions and 18 deletions

View File

@@ -13,7 +13,7 @@
"license": "GPL-3.0",
"dependencies": {
"@computernewb/nodejs-rfb": "^0.3.0",
"@computernewb/superqemu": "0.2.4-alpha0",
"@computernewb/superqemu": "0.2.4",
"@cvmts/cvm-rs": "*",
"@maxmind/geoip2-node": "^5.0.0",
"execa": "^8.0.1",

View File

@@ -1,6 +1,14 @@
import EventEmitter from 'node:events';
import { Size, Rect } from '../Utilities';
// events:
//
// 'connected' -> () -> on successful connection
// 'resize' -> (w, h) -> done when resize occurs
// 'rect' -> (x, y, Buffer) -> framebuffer rect (RGBA)
// 'frame' -> () -> done at end of frame
export interface VMDisplay extends EventEmitter {
Connect(): void;
Disconnect(): void;

View File

@@ -6,7 +6,11 @@ import { VMDisplay } from './interface.js';
import { Size, Rect } from '../Utilities.js';
const kQemuFps = 60;
// the FPS to run the VNC client at
// This only affects internal polling,
// if the VNC itself is sending updates at a slower rate
// the display will be at that slower rate
const kVncBaseFramerate = 60;
export type VncRect = {
x: number;
@@ -15,17 +19,13 @@ export type VncRect = {
height: number;
};
// events:
//
// 'resize' -> (w, h) -> done when resize occurs
// 'rect' -> (x, y, ImageData) -> framebuffer
// 'frame' -> () -> done at end of frame
// TODO: replace with a non-asshole VNC client
// TODO: replace with a non-asshole VNC client (prefably one implemented
// as a part of cvm-rs)
export class VncDisplay extends EventEmitter implements VMDisplay {
private displayVnc = new VncClient({
debug: false,
fps: kQemuFps,
fps: kVncBaseFramerate,
encodings: [
VncClient.consts.encodings.raw,
@@ -64,12 +64,9 @@ export class VncDisplay extends EventEmitter implements VMDisplay {
this.displayVnc.on('firstFrameUpdate', () => {
// apparently this library is this good.
// at least it's better than the two others which exist.
this.displayVnc.changeFps(kQemuFps);
this.displayVnc.changeFps(kVncBaseFramerate);
this.emit('connected');
this.emit('resize', { width: this.displayVnc.clientWidth, height: this.displayVnc.clientHeight });
//this.emit('rect', { x: 0, y: 0, width: this.displayVnc.clientWidth, height: this.displayVnc.clientHeight });
this.emit('frame');
});
this.displayVnc.on('desktopSizeChanged', (size: Size) => {

View File

@@ -41,13 +41,13 @@ __metadata:
languageName: node
linkType: hard
"@computernewb/superqemu@npm:0.2.4-alpha0":
version: 0.2.4-alpha0
resolution: "@computernewb/superqemu@npm:0.2.4-alpha0"
"@computernewb/superqemu@npm:0.2.4":
version: 0.2.4
resolution: "@computernewb/superqemu@npm:0.2.4"
dependencies:
execa: "npm:^8.0.1"
pino: "npm:^9.3.1"
checksum: 10c0/ac002c2da734db0fc8823a4ae6c7361ef9cf2aa15fd0345376163ddd1f124654fd8d7576c3e9831ec57f6c41263683c3684e31db8066c31cff9abfc7a55a7346
checksum: 10c0/9ed3190bd95c60a6f74fbb6d29cbd9909ff18b04d64b5a09c02dec91169304f439d7b0ac91848b69621066810cdfef4a0dbf97075938ee40b3aebd74376b4440
languageName: node
linkType: hard
@@ -75,7 +75,7 @@ __metadata:
resolution: "@cvmts/cvmts@workspace:cvmts"
dependencies:
"@computernewb/nodejs-rfb": "npm:^0.3.0"
"@computernewb/superqemu": "npm:0.2.4-alpha0"
"@computernewb/superqemu": "npm:0.2.4"
"@cvmts/cvm-rs": "npm:*"
"@maxmind/geoip2-node": "npm:^5.0.0"
"@types/node": "npm:^20.12.5"