Fix saveSnapshot: add missing SR and SD body bytes for VICE Dump command

This commit is contained in:
Mattias Hansson 2026-07-19 23:10:59 +02:00
parent 1bea1deba9
commit c6abc564ff

View file

@ -693,9 +693,12 @@ export class ViceClient {
// Snapshot methods
async saveSnapshot(filename: string): Promise<void> {
const filenameBuffer = Buffer.from(filename, "utf8");
const body = Buffer.alloc(1 + filenameBuffer.length);
body[0] = filenameBuffer.length;
filenameBuffer.copy(body, 1);
// VICE Dump expects: saveROMs(1) + saveDisks(1) + filenameLen(1) + filename
const body = Buffer.alloc(3 + filenameBuffer.length);
body[0] = 1; // SR: save ROMs = true
body[1] = 0; // SD: save disks = false
body[2] = filenameBuffer.length;
filenameBuffer.copy(body, 3);
await this.sendCommand(Command.Dump, body);
}