Game Gear fixed

Proxy BIOS, enhance config, allow per-platform decompression
This commit is contained in:
2025-01-07 09:22:50 -03:00
parent b20d3954c6
commit 129ffcf1a9
3 changed files with 291 additions and 49 deletions

View File

@@ -1,65 +1,203 @@
// See https://emulatorjs.org/docs/systems for available cores
const coreMap = {
const systemConfigs = {
// Nintendo Systems
'Nintendo Entertainment System': 'fceumm',
'Super Nintendo Entertainment System': 'snes9x',
'Nintendo 64': 'mupen64plus_next',
'Nintendo DS': 'desmume2015',
'Nintendo Game Boy': 'gambatte',
'Nintendo Game Boy Color': 'gambatte',
'Nintendo Game Boy Advance': 'mgba',
'Nintendo Entertainment System': {
core: 'fceumm',
unpackRoms: true
},
'Super Nintendo Entertainment System': {
core: 'snes9x',
unpackRoms: true
},
'Nintendo 64': {
core: 'mupen64plus_next',
unpackRoms: true
},
'Nintendo DS': {
core: 'desmume2015',
unpackRoms: true
},
'Nintendo Game Boy': {
core: 'gambatte',
unpackRoms: true
},
'Nintendo Game Boy Color': {
core: 'gambatte',
unpackRoms: true
},
'Nintendo Game Boy Advance': {
core: 'mgba',
unpackRoms: true
},
// Sega Systems
'Sega Master System': 'smsplus',
'Sega Game Gear': 'genesis_plus_gx', // TODO: fix rom loading
'Sega Mega Drive': 'genesis_plus_gx',
'Sega CD': 'genesis_plus_gx', // TODO: add bios
'Sega 32X': 'picodrive', // Known issue: https://github.com/EmulatorJS/EmulatorJS/issues/579
'Sega Saturn': 'yabause',
'Sega Master System': {
core: 'smsplus',
unpackRoms: true
},
'Sega Game Gear': {
core: 'genesis_plus_gx',
unpackRoms: false
},
'Sega Mega Drive': {
core: 'genesis_plus_gx',
unpackRoms: true
},
'Sega CD': { // TODO: add bios
core: 'genesis_plus_gx',
unpackRoms: false,
bios: {
required: true,
files: {
'bios_CD_U.bin': {
url: 'https://github.com/Abdess/retroarch_system/raw/refs/heads/libretro/Sega%20-%20Mega%20CD%20-%20Sega%20CD/bios_CD_U.bin',
md5: '2efd74e3232ff260e371b99f84024f7f',
region: 'US'
},
'bios_CD_E.bin': {
url: 'https://github.com/Abdess/retroarch_system/raw/refs/heads/libretro/Sega%20-%20Mega%20CD%20-%20Sega%20CD/bios_CD_E.bin',
md5: 'e66fa1dc5820d254611fdcdba0662372',
region: 'EU'
},
'bios_CD_J.bin': {
url: 'https://github.com/Abdess/retroarch_system/raw/refs/heads/libretro/Sega%20-%20Mega%20CD%20-%20Sega%20CD/bios_CD_J.bin',
md5: 'bdeb4c47da613946d422d97d98b21cda',
region: 'JP'
}
}
}
},
'Sega 32X': { // Known issue: https://github.com/EmulatorJS/EmulatorJS/issues/579
core: 'picodrive',
unpackRoms: true
},
'Sega Saturn': {
core: 'yabause',
unpackRoms: true
},
// Atari Systems
'Atari 2600': 'stella2014',
'Atari 5200': 'a5200',
'Atari 7800': 'prosystem',
'Atari Jaguar': 'virtualjaguar',
'Atari Lynx': 'handy',
'Atari 2600': {
core: 'stella2014',
unpackRoms: true
},
'Atari 5200': {
core: 'a5200',
unpackRoms: true
},
'Atari 7800': {
core: 'prosystem',
unpackRoms: true
},
'Atari Jaguar': {
core: 'virtualjaguar',
unpackRoms: true
},
'Atari Lynx': {
core: 'handy',
unpackRoms: true
},
// Commodore Systems
'Commodore 64': 'vice_x64sc',
'Commodore 128': 'vice_x128', // Untested, Myrient has no ROMs for it
'Commodore Amiga': 'puae', // TODO: fix rom loading
'Commodore PET': 'vice_xpet', // Untested, Myrient has no ROMs for it
'Commodore Plus-4': 'vice_xplus4', // TODO: fix rom loading
'Commodore VIC-20': 'vice_xvic', // TODO: fix rom loading
'Commodore 64': {
core: 'vice_x64sc',
unpackRoms: true
},
'Commodore 128': { // Untested, Myrient has no ROMs for it
core: 'vice_x128',
unpackRoms: true
},
'Commodore Amiga': { // TODO: fix rom loading
core: 'puae',
unpackRoms: true
},
'Commodore PET': { // Untested, Myrient has no ROMs for it
core: 'vice_xpet',
unpackRoms: true
},
'Commodore Plus-4': { // TODO: fix rom loading
core: 'vice_xplus4',
unpackRoms: true
},
'Commodore VIC-20': { // TODO: fix rom loading
core: 'vice_xvic',
unpackRoms: true
},
// Sony Systems
'Sony PlayStation 1': 'pcsx_rearmed', // TODO: fix rom loading
'Sony PlayStation 1': { // TODO: fix rom loading (doesn't seem to affect all games)
core: 'pcsx_rearmed',
unpackRoms: true
},
// Other Systems
'Arcade': 'fbneo', // TODO: fix rom loading
'ColecoVision': 'gearcoleco', // TODO: add bios
'Panasonic 3DO': 'opera', // TODO: fix rom loading
'Arcade': { // TODO: fix rom loading
core: 'fbneo',
unpackRoms: true
},
'ColecoVision': { // TODO: add bios
core: 'gearcoleco',
unpackRoms: false,
bios: {
required: true,
files: {
'colecovision.rom': {
url: 'https://github.com/Abdess/retroarch_system/raw/refs/heads/libretro/Coleco%20-%20ColecoVision/colecovision.rom',
md5: '2c66f5911e5b42b8ebe113403548eee7',
region: 'Global'
}
}
}
},
'Panasonic 3DO': { // TODO: fix rom loading
core: 'opera',
unpackRoms: false
// bios: {
// required: true,
// files: {
// 'panafz1.bin': {
// url: 'https://files.catbox.moe/u5hy1c.bin',
// md5: 'f47264dd47fe30f73ab3c010015c155b',
// region: 'Global'
// }
// }
// }
}
};
const COMPATIBLE_SYSTEMS = Object.keys(coreMap);
const COMPATIBLE_SYSTEMS = Object.keys(systemConfigs);
export function isEmulatorCompatible(category) {
console.log(`[EmulatorConfig] Checking compatibility for: ${category}`);
if (process.env.EMULATOR_ENABLED !== 'true') {
console.log('[EmulatorConfig] Emulator is disabled via environment variable');
return false;
}
return COMPATIBLE_SYSTEMS.includes(category);
const isCompatible = COMPATIBLE_SYSTEMS.includes(category);
console.log(`[EmulatorConfig] System compatibility result: ${isCompatible}`);
return isCompatible;
}
export function getEmulatorConfig(category) {
const core = coreMap[category] || 'unknown';
console.log(`[EmulatorConfig] Configuring emulator for category: ${category}`);
const systemConfig = systemConfigs[category];
if (!systemConfig) {
console.warn(`[EmulatorConfig] No configuration found for category: ${category}`);
return null;
}
// Add system-specific settings
const config = {
core,
core: systemConfig.core,
system: category,
options: {}
unpackRoms: systemConfig.unpackRoms,
options: {},
bios: systemConfig.bios || null
};
console.log(`[EmulatorConfig] Final configuration:`, config);
return config;
}