Skip to content

Commit

Permalink
Add support for many more platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
john-tornblom committed Jun 21, 2024
1 parent 7e5614a commit e888545
Show file tree
Hide file tree
Showing 35 changed files with 66 additions and 7 deletions.
73 changes: 66 additions & 7 deletions homebrew/Mednafen/homebrew.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,62 @@ along with this program; see the file COPYING. If not, see
async function main() {
const PAYLOAD = window.workingDir + '/mednafen.elf';
const ROMDIR = window.workingDir + '/roms/';
const ROMTYPES = ['nes', 'smc', 'sfc', 'gba', 'psx', 'cue', 'zip']

const ROMTYPES = ['cue', 'dsk', 'gb', 'gba', 'gbc', 'gen', 'gg', 'lnx',
'nes', 'ngp', 'pce', 'psx', 'sfc', 'smc', 'sms', 'vb',
'ws', 'wsc', 'zip'];

function getRomType(filename) {
const dotIndex = filename.lastIndexOf('.');
if (dotIndex === -1) {
return '';
}
return filename.slice(dotIndex + 1);
}

function getRomName(filename) {
const dotIndex = filename.lastIndexOf('.');
if (dotIndex === -1) {
return filename;
}

return filename.slice(0, dotIndex);
}

function getPlatformName(romType) {
switch(romType) {
case 'dsk': return 'Apple ][';
case 'lnx': return 'Atari Lynx';
case 'gb': return 'Game Boy';
case 'gba': return 'Game Boy Advance';
case 'gbc': return 'Game Boy Color';
case 'gen': return 'Sega MegaDrive';
case 'gg': return 'Sega Game Gear';
case 'nes': return 'Nintendo Entertainment System';
case 'ngp': return 'Neo Geo Pocket';
case 'pce': return 'PC Engine';
case 'psx': return 'Sony Playstation';
case 'sfc':
case 'smc': return 'Super Nintendo';
case 'sms': return 'Sega Master System';
case 'vb': return 'Virtual Boy';
case 'ws': return 'WonderSwan';
case 'wsc': return 'WonderSwan Color';
default: return '';
}
}

async function getRomList() {
let listing = await ApiClient.fsListDir(ROMDIR);
return listing.filter(entry =>
ROMTYPES.includes(entry.name.slice(-3))).map(entry => {
const name = entry.name.slice(0, -4);
ROMTYPES.includes(getRomType(entry.name))).map(entry => {
const romType = getRomType(entry.name);
const romName = getRomName(entry.name);
const platformName = getPlatformName(romType);

return {
mainText: name,
imgPath: '/fs/' + ROMDIR + name + '.jpg',
mainText: romName,
secondaryText: platformName,
imgPath: '/fs/' + ROMDIR + romName + '.jpg',
onclick: async() => {
return {
path: PAYLOAD,
Expand All @@ -37,12 +83,25 @@ async function main() {
};
});
}

return {
mainText: "Mednafen",
secondaryText: 'Multi-system Emulator',
onclick: async () => {
let items = await getRomList();
showCarousel(items);
}
},
options: [
{
text: "Browse ROM...",
onclick: async () => {
return {
path: PAYLOAD,
args: await pickFile(window.workingDir)
};
}
}
]
};
}

Binary file added homebrew/Mednafen/roms/Bar Frog Tux.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added homebrew/Mednafen/roms/Bar Frog Tux.pce
Binary file not shown.
Binary file added homebrew/Mednafen/roms/Fast And Fourier.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added homebrew/Mednafen/roms/Fast And Fourier.ngp
Binary file not shown.
Binary file added homebrew/Mednafen/roms/Finally.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added homebrew/Mednafen/roms/Finally.wsc
Binary file not shown.
File renamed without changes
File renamed without changes.
Binary file added homebrew/Mednafen/roms/Hover.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added homebrew/Mednafen/roms/Hover.vb
Binary file not shown.
Binary file added homebrew/Mednafen/roms/Ihmesorsa.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added homebrew/Mednafen/roms/Ihmesorsa.ws
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added homebrew/Mednafen/roms/Lynx Reloaded.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added homebrew/Mednafen/roms/Lynx Reloaded.lnx
Binary file not shown.
Binary file added homebrew/Mednafen/roms/Nine Pixels.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added homebrew/Mednafen/roms/Nine Pixels.sms
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added homebrew/Mednafen/roms/Sega Tween.gg
Binary file not shown.
Binary file added homebrew/Mednafen/roms/Sega Tween.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes.
Binary file added homebrew/Mednafen/roms/Spiraling Shape.dsk
Binary file not shown.
Binary file added homebrew/Mednafen/roms/Spiraling Shape.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
Binary file not shown.
Binary file added homebrew/Mednafen/roms/The Kessler Incident.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
File renamed without changes

0 comments on commit e888545

Please sign in to comment.