You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is definitely necessary to be able to export files out from this emulator.
Currently windows95.img works one way only and state-v3.bin is not readable to extract files.
We need a function that will update the img file or understand why this is problematic.
My current attempts:
/**
* Save the emulator's modified disk image to disk.
*/
private async saveDiskImage(): Promise<void> {
const { emulator } = this.state;
const imgPath = (await getStatePath()).replace('.bin', '.img');
console.log(`saveDiskImage into:` + imgPath);
if (!emulator || !emulator.disk_images || !emulator.disk_images.hda) {
console.log(`saveDiskImage: No disk image present`);
return;
}
try {
// Convert SyncBuffer to a Uint8Array
const diskBuffer = new Uint8Array(emulator.disk_images.hda);
// Save the raw buffer as an .img file
await fs.outputFile(imgPath, Buffer.from(diskBuffer));
console.log(`Disk image saved to ${imgPath}`);
} catch (error) {
console.warn(`saveDiskImage: Could not save disk image`, error);
fs.appendFileSync('log.txt', `saveDiskImage: Could not save disk image: ${error.message}\n${error.stack}\n`);
}
}
As I understand this won't work, having blocks, we could:
// Apply modified blocks
const blockSize = 0x200;
for (const { sector, data } of writtenBlocks) {
const offset = sector * blockSize;
if (offset + data.length <= diskBuffer.length) {
data.copy(diskBuffer, offset);
} else {
console.warn(`saveDiskImage: Block at sector ${sector} exceeds disk size`);
}
}
The text was updated successfully, but these errors were encountered:
mmaciola
changed the title
Hda export into img file
Export HDA into img file
Feb 15, 2025
It is definitely necessary to be able to export files out from this emulator.
Currently windows95.img works one way only and state-v3.bin is not readable to extract files.
We need a function that will update the img file or understand why this is problematic.
My current attempts:
As I understand this won't work, having blocks, we could:
The text was updated successfully, but these errors were encountered: