From b8bc5385c545c2d22fb1f8fd335cab7128676384 Mon Sep 17 00:00:00 2001 From: Evan Barger Date: Mon, 31 Aug 2020 21:50:10 -0400 Subject: [PATCH 1/3] Add support to MBC2 for iG Power Cart --- script/gbnp.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/script/gbnp.js b/script/gbnp.js index 34ac28f..eefea72 100644 --- a/script/gbnp.js +++ b/script/gbnp.js @@ -431,7 +431,7 @@ class Processor { // Set ram state romFile.seek(0x2101 + i); - if (rom.ramByte > 0) { + if (rom.ramByte > 0 || rom.typeByte == 0x06) { // has ram or MBC2 romFile.writeByte(1); // Ram enabled } else { @@ -442,7 +442,7 @@ class Processor { romFile.seek(0x2201 + i); // Ram offset and if we are 8KB or 32KB locked - if (rom.ramByte == 2) { // 8KB + if (rom.ramByte == 2 || rom.typeByte == 0x06) { // 8KB or MBC2+RAM romFile.writeByte(offsets.ram); // 8KB locked } else if (rom.ramByte == 3) { // 32KB @@ -453,7 +453,7 @@ class Processor { } // Increment ram offset after - if (rom.ramByte == 2) { // 8KB + if (rom.ramByte == 2 || rom.typeByte == 0x06) { // 8KB or MBC2+RAM offsets.ram += 2; } else if (rom.ramByte == 3) { // 32KB From 7b728b9cefba2d4d5036e7ef931f074a862afe1a Mon Sep 17 00:00:00 2001 From: Evan Barger Date: Mon, 31 Aug 2020 22:05:16 -0400 Subject: [PATCH 2/3] Force GAMER font to always be uppercase, use padded rom size in table --- index.html | 4 ++-- script/gbnp.js | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index ebfb50d..31d1613 100644 --- a/index.html +++ b/index.html @@ -57,7 +57,7 @@ {{ rom.title }} {{ rom.type }} {{ rom.romSizeKB() + 'k'}} - {{ rom.ramSizeKB() + 'k' }} + {{ rom.paddedRamSizeKB() + 'k' }} {{ rom.paddedRomSizeKB() / 128 + ' (' + rom.paddedRomSizeKB() + 'k)'}} @@ -137,7 +137,7 @@ - + diff --git a/script/gbnp.js b/script/gbnp.js index eefea72..7c18dcc 100644 --- a/script/gbnp.js +++ b/script/gbnp.js @@ -118,7 +118,7 @@ class ROM { paddedRamSizeKB() { if (this.typeByte === 0x06) { return 8; } - return Math.min(32, this.ramSizeKB()); + return this.ramSizeKB(); } isMenu() { @@ -143,7 +143,12 @@ class ROM { const font = FONTS[fontIndex || 0]; ctx.font = font.style; ctx.fillStyle = 'black'; - ctx.fillText(this.menuText,1,font.y); + + let text = this.menuText; + if (fontIndex == 3) { + text = text.toUpperCase(); + } + ctx.fillText(text,1,font.y); ctx.fillStyle = 'white'; ctx.fillRect(127, 0, 127, 8); @@ -226,7 +231,7 @@ class Processor { ramUsedKB() { return this.roms.reduce((total, rom) => { - return total += rom.ramSizeKB(); + return total += rom.paddedRamSizeKB(); }, 0); } @@ -513,7 +518,10 @@ class TickerText { generate() { let buffer = []; const canvas = this.canvas; - const text = this.text; + let text = this.text; + if (this.fontIndex == 3) { + text = text.toUpperCase(); + } const font = FONTS[this.fontIndex].style; const ctx = canvas.getContext('2d'); From 30008069986e9ebaee757a11606ad3afdcfe8719 Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 11 Oct 2020 01:22:49 +1000 Subject: [PATCH 3/3] Update gbnp.js Fix iG 32KB RAM incrementing from 8 to 4 --- script/gbnp.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/gbnp.js b/script/gbnp.js index 7c18dcc..e2f1153 100644 --- a/script/gbnp.js +++ b/script/gbnp.js @@ -462,7 +462,7 @@ class Processor { offsets.ram += 2; } else if (rom.ramByte == 3) { // 32KB - offsets.ram += 8; + offsets.ram += 4; } }