import { useState } from 'react'; import { Cable, Code2, Cpu, FolderOpen, Link, List, Zap } from 'lucide-react'; import MediaBrowser from './MediaBrowser'; interface IECPageProps { config: any; setConfig: (config: any) => void; } export default function IECPage({ config, setConfig }: IECPageProps) { const [showMediaBrowser, setShowMediaBrowser] = useState(false); const [driveRomBrowsingKey, setDriveRomBrowsingKey] = useState(null); const updateSetting = (path: string[], value: any) => { const newConfig = JSON.parse(JSON.stringify(config)); let current = newConfig; for (let i = 0; i < path.length - 1; i++) { current = current[path[i]]; } current[path[path.length - 1]] = value; setConfig(newConfig); }; const settings = config.settings || {}; const boolDirEntries = Object.entries(settings.directory || {}).filter(([, v]) => v === 0 || v === 1); const isCompatMode = boolDirEntries.length > 0 && boolDirEntries.every(([, v]) => v === 0); const setAllDirBools = (val: 0 | 1) => { const newConfig = JSON.parse(JSON.stringify(config)); const dir = newConfig.settings?.directory ?? {}; for (const k of Object.keys(dir)) { if (dir[k] === 0 || dir[k] === 1) dir[k] = val; } setConfig(newConfig); }; return (

IEC Settings

updateSetting(['settings', 'autoboot'], e.target.value)} className="flex-1 px-3 py-2 border border-neutral-300 rounded-lg" />
{showMediaBrowser && ( { updateSetting(['settings', 'autoboot'], path); setShowMediaBrowser(false); }} onClose={() => setShowMediaBrowser(false)} /> )}

Drive ROMs

{(['default', 'd64', 'd71', 'd81'] as const).map((key) => (
updateSetting(['settings', 'drive_roms', key], e.target.value)} className="flex-1 px-3 py-2 border border-neutral-300 rounded-lg" />
))}
{driveRomBrowsingKey && ( { updateSetting(['settings', 'drive_roms', driveRomBrowsingKey], path); setDriveRomBrowsingKey(null); }} onClose={() => setDriveRomBrowsingKey(null)} /> )}

Directory Enhancements

{/* CBM Directory Compatibility Mode */}
CBM Directory Compatibility
Disables all directory enhancements
{Object.entries(settings.directory || {}).map(([key, value]) => (
{value === 0 || value === 1 ? ( ) : ( updateSetting(['settings', 'directory', key], parseInt(e.target.value))} className="w-24 px-3 py-1 border border-neutral-300 rounded-lg text-right disabled:cursor-not-allowed" /> )}
))}

Hardware Fastloaders

Serial

{Object.entries(settings.fastloaders?.hardware?.serial || {}).map(([key, value]) => (
))}

Parallel

{Object.entries(settings.fastloaders?.hardware?.parallel || {}).map(([key, value]) => (
))}

Software Fastloaders

{Object.entries(settings.fastloaders?.software || {}).map(([key, value]) => (
))}

Chainloaders

{Object.entries(settings.chainloaders || {}).map(([key, value]) => (
))}
); }