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 { ...@@ -338,7 +338,6 @@ class GameboyEmulator extends EmulatorBase implements Emulator {
this.trigger("booted"); this.trigger("booted");
} }
// @todo remove this method, or at least most of it
async register() { async register() {
await Promise.all([this.registerKeys()]); await Promise.all([this.registerKeys()]);
} }
...@@ -410,6 +409,10 @@ class GameboyEmulator extends EmulatorBase implements Emulator { ...@@ -410,6 +409,10 @@ class GameboyEmulator extends EmulatorBase implements Emulator {
return "https://gitlab.stage.hive.pt/joamag/boytacean/-/blob/master/CHANGELOG.md"; return "https://gitlab.stage.hive.pt/joamag/boytacean/-/blob/master/CHANGELOG.md";
} }
get romExts(): string[] {
return ["gb"];
}
get pixelFormat(): PixelFormat { get pixelFormat(): PixelFormat {
return PixelFormat.RGB; return PixelFormat.RGB;
} }
......
...@@ -130,6 +130,12 @@ export interface Emulator extends ObservableI { ...@@ -130,6 +130,12 @@ export interface Emulator extends ObservableI {
*/ */
get engine(): string | null; 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 * The pixel format of the emulator's display
* image buffer (eg: RGB). * image buffer (eg: RGB).
...@@ -363,9 +369,8 @@ export const App: FC<AppProps> = ({ ...@@ -363,9 +369,8 @@ export const App: FC<AppProps> = ({
}; };
const onFile = async (file: File) => { const onFile = async (file: File) => {
// @todo must make this more flexible and not just const fileExtension = file.name.split(".").pop() ?? "";
// Game Boy only (using the emulator interface) if (!emulator.romExts.includes(fileExtension)) {
if (!file.name.endsWith(".gb")) {
showToast( showToast(
`This is probably not a ${emulator.device} ROM file!`, `This is probably not a ${emulator.device} ROM file!`,
true 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