Skip to content
Merged
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
6 changes: 4 additions & 2 deletions core/bin/openrom.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1289,7 +1289,8 @@ Future<int> _runCli(List<String> args) async {
if (isJson) {
_jsonPrint({
'type': 'log',
'message': '[DELETE] Removed source: ${p.basename(job.filepath)}',
'message':
'[DELETE] Removed source: ${p.basename(job.filepath)}',
});
}
}
Expand Down Expand Up @@ -1336,7 +1337,8 @@ Future<int> _runCli(List<String> args) async {
...stats.toJson(),
});
} else {
print('Batch complete: ${stats.jobsCompleted} converted, $failed failed.');
print(
'Batch complete: ${stats.jobsCompleted} converted, $failed failed.');
print(' Space saved: ${stats.bytesSavedReadable} '
'(${stats.savedPercentageReadable})');
}
Expand Down
34 changes: 17 additions & 17 deletions core/lib/src/watch_folder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,8 @@ class WatchFolderDaemon {
/// Returns the settled size, or null when the file vanished. A file that
/// never stops growing keeps the loop alive until it stabilises (or [stop]).
Future<int?> awaitStable(String path) async {
final intervalMs = pollInterval.inMilliseconds <= 0
? 1
: pollInterval.inMilliseconds;
final intervalMs =
pollInterval.inMilliseconds <= 0 ? 1 : pollInterval.inMilliseconds;
final requiredStableChecks =
(settleSeconds * 1000 / intervalMs).ceil().clamp(1, 1 << 30);

Expand Down Expand Up @@ -199,20 +198,21 @@ class WatchFolderDaemon {
if (_stopped) return;
final completer = Completer<void>();
_sub = dir.watch().listen(
(event) {
if (_stopped) return;
final path = event.path;
if (event is FileSystemCreateEvent || event is FileSystemModifyEvent) {
// Creation/modify events fire repeatedly while a file is written;
// handleFile's settle loop + _inFlight guard dedupe them.
unawaited(handleFile(path));
}
},
onError: (Object e) => _log('[WARN] Watch error: $e'),
onDone: () {
if (!completer.isCompleted) completer.complete();
},
);
(event) {
if (_stopped) return;
final path = event.path;
if (event is FileSystemCreateEvent ||
event is FileSystemModifyEvent) {
// Creation/modify events fire repeatedly while a file is written;
// handleFile's settle loop + _inFlight guard dedupe them.
unawaited(handleFile(path));
}
},
onError: (Object e) => _log('[WARN] Watch error: $e'),
onDone: () {
if (!completer.isCompleted) completer.complete();
},
);
await completer.future;
}

Expand Down
3 changes: 2 additions & 1 deletion core/test/cli_help_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ void main() {
expect(out, contains('--settle-seconds'));
});

test('--watch with a missing directory creates it and logs readiness', () async {
test('--watch with a missing directory creates it and logs readiness',
() async {
final tmpDir = Directory.systemTemp.createTempSync('cli_watch_');
final inDir = Directory('${tmpDir.path}/incoming');
final outDir = Directory('${tmpDir.path}/library');
Expand Down
3 changes: 2 additions & 1 deletion core/test/hasheous_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ void main() {
);
final client = HasheousClient(client: mock);

final result = await client.lookupByHash(sha1: sha1, md5: md5Hex, crc: crc);
final result =
await client.lookupByHash(sha1: sha1, md5: md5Hex, crc: crc);

expect(result.matched, isTrue);
expect(result.error, isNull);
Expand Down
66 changes: 35 additions & 31 deletions gui/lib/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -114,22 +114,25 @@ class _OpenROMAppState extends State<OpenROMApp> {
onPromptMedia: (job) async {
return await showDialog<String>(
context: context,
builder: (ctx) => AlertDialog(
title: const Text('Unrecognized Media Type'),
content: Text(
'Unrecognized Media Type: Is this game a CD or DVD?\n\nFile: ${job.romFile.filename}',
),
actions: [
TextButton(
onPressed: () => Navigator.of(ctx).pop('cd'),
child: const Text('CD'),
),
ElevatedButton(
onPressed: () => Navigator.of(ctx).pop('dvd'),
child: const Text('DVD'),
builder: (ctx) {
final l10n = AppLocalizations.of(ctx);
return AlertDialog(
title: Text(l10n.mediaTypeTitle),
content: Text(
l10n.mediaTypeBody(job.romFile.filename),
),
],
),
actions: [
TextButton(
onPressed: () => Navigator.of(ctx).pop('cd'),
child: Text(l10n.mediaCd),
),
ElevatedButton(
onPressed: () => Navigator.of(ctx).pop('dvd'),
child: Text(l10n.mediaDvd),
),
],
);
},
);
},
);
Expand Down Expand Up @@ -269,6 +272,7 @@ class _OpenROMAppState extends State<OpenROMApp> {
darkTheme: buildTheme(Brightness.dark, darkColorScheme),
home: LayoutBuilder(
builder: (context, constraints) {
final l10n = AppLocalizations.of(context);
final isNarrow = constraints.maxWidth < 650;
// Desktop-only build: a narrow window uses the compact layout.
final isMobile = isNarrow;
Expand Down Expand Up @@ -309,31 +313,31 @@ class _OpenROMAppState extends State<OpenROMApp> {
selectedItemColor: theme.accent,
unselectedItemColor: theme.textSecondary,
type: BottomNavigationBarType.fixed,
items: const [
items: [
BottomNavigationBarItem(
icon: Icon(Icons.sync_alt_outlined),
activeIcon: Icon(Icons.sync_alt),
label: 'Convert',
icon: const Icon(Icons.sync_alt_outlined),
activeIcon: const Icon(Icons.sync_alt),
label: l10n.convertButton,
),
BottomNavigationBarItem(
icon: Icon(Icons.healing_outlined),
activeIcon: Icon(Icons.healing),
label: 'Patch',
icon: const Icon(Icons.healing_outlined),
activeIcon: const Icon(Icons.healing),
label: l10n.navPatch,
),
BottomNavigationBarItem(
icon: Icon(Icons.construction_outlined),
activeIcon: Icon(Icons.construction),
label: 'Tools',
icon: const Icon(Icons.construction_outlined),
activeIcon: const Icon(Icons.construction),
label: l10n.navTools,
),
BottomNavigationBarItem(
icon: Icon(Icons.extension_outlined),
activeIcon: Icon(Icons.extension),
label: 'Plugins',
icon: const Icon(Icons.extension_outlined),
activeIcon: const Icon(Icons.extension),
label: l10n.navPlugins,
),
BottomNavigationBarItem(
icon: Icon(Icons.settings_outlined),
activeIcon: Icon(Icons.settings),
label: 'Settings',
icon: const Icon(Icons.settings_outlined),
activeIcon: const Icon(Icons.settings),
label: l10n.settingsScreen,
),
],
),
Expand Down
Loading
Loading