Skip to content
Snippets Groups Projects
Verified Commit 19cd89f0 authored by João Magalhães's avatar João Magalhães :rocket:
Browse files

feat: rom extension format

parent a2d3171a
No related branches found
No related tags found
No related merge requests found
Pipeline #1498 passed
......@@ -338,7 +338,6 @@ class GameboyEmulator extends EmulatorBase implements Emulator {
this.trigger("booted");
}
// @todo remove this method, or at least most of it
async register() {
await Promise.all([this.registerKeys()]);
}
......@@ -410,6 +409,10 @@ class GameboyEmulator extends EmulatorBase implements Emulator {
return "https://gitlab.stage.hive.pt/joamag/boytacean/-/blob/master/CHANGELOG.md";
}
get romExts(): string[] {
return ["gb"];
}
get pixelFormat(): PixelFormat {
return PixelFormat.RGB;
}
......
......@@ -130,6 +130,12 @@ export interface Emulator extends ObservableI {
*/
get engine(): string | null;
/**
* The complete set of file extensions that this emulator
* supports.
*/
get romExts(): string[];
/**
* The pixel format of the emulator's display
* image buffer (eg: RGB).
......@@ -363,9 +369,8 @@ export const App: FC<AppProps> = ({
};
const onFile = async (file: File) => {
// @todo must make this more flexible and not just
// Game Boy only (using the emulator interface)
if (!file.name.endsWith(".gb")) {
const fileExtension = file.name.split(".").pop() ?? "";
if (!emulator.romExts.includes(fileExtension)) {
showToast(
`This is probably not a ${emulator.device} ROM file!`,
true
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment