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

refactor: small set of fixes

parent 571f43d1
No related branches found
No related tags found
No related merge requests found
Pipeline #1733 passed
{
"ext": "js,ts,jsx,tsx,mjs,json",
"ext": "js,ts,jsx,tsx,mjs,css,json",
"ignore": ["dist", ".parcel-cache"],
"ignoreRoot": [".git"]
}
......@@ -4,7 +4,8 @@ import {
Entry,
Feature,
PixelFormat,
RomInfo
RomInfo,
Size
} from "emukit";
import { PALETTES, PALETTES_MAP } from "./palettes";
......@@ -25,6 +26,10 @@ const LOGIC_HZ = 4194304;
const VISUAL_HZ = 59.7275;
const IDLE_HZ = 10;
const DISPLAY_WIDTH = 160;
const DISPLAY_HEIGHT = 144;
const DISPLAY_SCALE = 2;
/**
* The rate at which the local storage RAM state flush
* operation is going to be performed, this value is the
......@@ -285,7 +290,9 @@ export class GameboyEmulator extends EmulatorBase implements Emulator {
// in case a remote ROM loading operation has been
// requested then loads it from the remote origin
if (loadRom) {
({ name: romName, data: romData } = await this.fetchRom(romPath));
({ name: romName, data: romData } = await GameboyEmulator.fetchRom(
romPath
));
} else if (romName === null || romData === null) {
[romName, romData] = [this.romName, this.romData];
}
......@@ -397,6 +404,14 @@ export class GameboyEmulator extends EmulatorBase implements Emulator {
return PixelFormat.RGB;
}
get dimensions(): Size {
return {
width: DISPLAY_WIDTH,
height: DISPLAY_HEIGHT,
scale: DISPLAY_SCALE
};
}
/**
* Returns the array buffer that contains the complete set of
* pixel data that is going to be drawn.
......@@ -559,7 +574,7 @@ export class GameboyEmulator extends EmulatorBase implements Emulator {
this.gameBoy?.set_palette_colors_ws(palette.colors);
}
private async fetchRom(
private static async fetchRom(
romPath: string
): Promise<{ name: string; data: Uint8Array }> {
// extracts the name of the ROM from the provided
......
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