Fix screenshot return in EJS_onSaveState (#1092)

* Fixed bug where a screenshot wasn't returned using EJS_onSaveState

* Refactor takeScreenshot method to return a promise with screenshot data and format; update input element in HTML for better accessibility.
This commit is contained in:
Michael Green 2025-09-16 23:14:01 +10:00 committed by GitHub
parent ce7472d264
commit ad9586d266
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 4 deletions

View File

@ -7040,10 +7040,12 @@ class EmulatorJS {
}
}
async takeScreenshot(source, format, upscale) {
takeScreenshot(source, format, upscale) {
return new Promise((resolve) => {
this.screenshot((blob, format) => {
resolve({ blob, format });
this.screenshot(async (blob, returnFormat) => {
const arrayBuffer = await blob.arrayBuffer();
const uint8 = new Uint8Array(arrayBuffer);
resolve({ screenshot: uint8, format: returnFormat });
}, source, format, upscale);
});
}

View File

@ -104,7 +104,7 @@
<br>
</div>
<div id="box">
<input type = file id = input>
<input type="file" id ="input" title="Upload" />
Drag ROM file or click here
</div>