Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ lib/
Thumbs.db
/test/**/*.png
**/theme/override/
TODO
TODO
2 changes: 1 addition & 1 deletion src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export async function run(args: string[] = process.argv) {
.option('-w, --width <size>', 'Max width of the image', Number.parseFloat, 300)
.option('-h, --height <size>', 'Max height of the image', Number.parseFloat)
.option('-t, --type <type>', 'Art type (boxart, snap, title, box+snap, box+title)', 'boxart')
.option('-o, --output <format>', 'Artwork format (minui, nextui, muos, anbernic)', 'minui')
.option('-o, --output <format>', 'Artwork format (minui, nextui, muos, anbernic, funkey)', 'minui')
.option('-a, --ai', 'Use AI for advanced matching', false)
.option('-m, --ai-model <name>', 'Ollama model to use for AI matching', 'gemma2:2b')
.option('-r, --regions <regions>', 'Preferred regions to use for AI matching', 'World,Europe,USA,Japan')
Expand Down
8 changes: 7 additions & 1 deletion src/format/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ export enum Format {
MinUI = 'minui',
NextUI = 'nextui',
MuOS = 'muos',
Anbernic = 'anbernic'
Anbernic = 'anbernic',
Funkey = 'funkey'
}

export type SeparateArtworksFunction = (options: Options) => Promise<boolean>;
Expand Down Expand Up @@ -53,6 +54,11 @@ export async function getOutputFormat(options: Options): Promise<OutputFormat> {
return anbernic.default;
}

case Format.Funkey: {
const funkey = await import('./funkey.js');
return funkey.default;
}

// eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check
default: {
throw new Error(`Unknown format: ${options.output}`);
Expand Down
51 changes: 51 additions & 0 deletions src/format/funkey.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import path from 'node:path';
import createDebug from 'debug';
import { getArtTypes } from '../libretro.js';
import { type Options } from '../options.js';
import { composeImageTo, resizeImageTo } from '../image.js';
import { type ArtType } from '../art.js';

const debug = createDebug('funkey');

export async function useSeparateArtworks(_options: Options) {
return false;
}

export async function getArtPath(filePath: string, _machine: string, _type?: ArtType) {
const fileName = path.basename(filePath, path.extname(filePath));
return path.join(path.dirname(filePath), `${fileName}.png`);
}

export async function exportArtwork(
art1Url: string | undefined,
art2Url: string | undefined,
artPath: string,
options: Options
) {
const artTypes = getArtTypes(options);
if (artTypes.art2 && (art1Url ?? art2Url)) {
debug(`Found art URL(s): "${art1Url}" / "${art2Url}"`);
await composeImageTo(art1Url, art2Url, artPath, { width: options.width, height: options.height });
} else if art1Url) {

Copilot AI Mar 4, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a syntax error on this line: the opening parenthesis ( is missing before art1Url. The condition should be else if (art1Url) to match the syntax used in the equivalent code in anbernic.ts and minui.ts. As written, this file will fail to compile/parse entirely.

Suggested change
} else if art1Url) {
} else if (art1Url) {

Copilot uses AI. Check for mistakes.
debug(`Found art URL: "${art1Url}"`);
await resizeImageTo(art1Url, artPath, { width: options.width, height: options.height });
} else {
return false;
}

return true;
}

export async function cleanupArtwork(_targetPath: string, _romFolders: string[], _options: Options) {
// No cleanup needed since images are stored in the same folder as ROMs
console.info('No artwork folders to clean up for funkey format');
}

const funkey = {
useSeparateArtworks,
getArtPath,
exportArtwork,
cleanupArtwork
};

export default funkey;