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
5 changes: 4 additions & 1 deletion .github/workflows/auto_fix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,20 @@ jobs:
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: '3.47.6'
cache: true

- name: Auto-Format Dart
run: |
if [ -d "gui" ]; then
cd gui
flutter pub get
dart format .
cd ..
fi
if [ -d "core" ]; then
cd core
dart pub get
dart format .
cd ..
fi
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: '3.47.6'
cache: true

- name: Install GUI dependencies
Expand Down
8 changes: 3 additions & 5 deletions core/bin/openrom.dart
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,7 @@ int main(List<String> args) {

if ((results['m3u'] as List<String>).isNotEmpty) {
final discFiles = results['m3u'] as List<String>;
final out =
results['output'] as String? ??
final out = results['output'] as String? ??
p.dirname(p.canonicalize(discFiles.first));
final rel = results['absolute'] != true;
try {
Expand Down Expand Up @@ -714,9 +713,8 @@ int main(List<String> args) {
var fields = readIpbin(file);
if (results['set-title'] != null) {
final title = results['set-title'] as String;
fields['product_name'] = title.length > 16
? title.substring(0, 16)
: title;
fields['product_name'] =
title.length > 16 ? title.substring(0, 16) : title;
fields['product_name_2'] = title.length > 16
? title.substring(16, title.length > 32 ? 32 : title.length)
: '';
Expand Down
10 changes: 4 additions & 6 deletions core/lib/src/bin_merger.dart
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,8 @@ BinMergeResult mergeBins(
}

final cueDir = p.dirname(p.canonicalize(cuePath));
final targetDir = (outputDir != null && outputDir.isNotEmpty)
? outputDir
: cueDir;
final targetDir =
(outputDir != null && outputDir.isNotEmpty) ? outputDir : cueDir;
Directory(targetDir).createSync(recursive: true);

final tracks = parseCue(cuePath);
Expand Down Expand Up @@ -182,9 +181,8 @@ BinMergeResult mergeBins(
break;
}
}
final idx01Offset = idx01Entry != null
? _msfToSectors(idx01Entry.msf)
: 0;
final idx01Offset =
idx01Entry != null ? _msfToSectors(idx01Entry.msf) : 0;

computedIndexes = [];
for (final idxItem in parsedIndexes) {
Expand Down
4 changes: 2 additions & 2 deletions core/lib/src/compressor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ class CompressionJob {
this.status = 'Queued',
this.progress = 0.0,
this.error,
}) : format = format.toLowerCase(),
level = level.toLowerCase();
}) : format = format.toLowerCase(),
level = level.toLowerCase();
}

class Compressor {
Expand Down
12 changes: 5 additions & 7 deletions core/lib/src/config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ const String appName = 'OpenROM';
String getDirectoryConfig() {
String path;
if (Platform.isWindows) {
final base =
Platform.environment['APPDATA'] ??
final base = Platform.environment['APPDATA'] ??
Platform.environment['USERPROFILE'] ??
'';
path = p.join(base, appName);
Expand Down Expand Up @@ -64,8 +63,8 @@ String getDefaultBundledPath(String tool) {
}

final String archFolder;
final archStr = '${Platform.version} ${Platform.operatingSystem}'
.toLowerCase();
final archStr =
'${Platform.version} ${Platform.operatingSystem}'.toLowerCase();
if (archStr.contains('aarch64') || archStr.contains('arm64')) {
archFolder = 'arm64';
} else {
Expand Down Expand Up @@ -136,9 +135,8 @@ String getDefaultBundledPath(String tool) {
return bundled;
}

final fallback = Platform.isWindows
? (winNames[tool] ?? tool)
: (unixNames[tool] ?? tool);
final fallback =
Platform.isWindows ? (winNames[tool] ?? tool) : (unixNames[tool] ?? tool);
ensureExecutable(fallback);
return fallback;
}
Expand Down
15 changes: 6 additions & 9 deletions core/lib/src/converter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ class ConversionJob {
List<String>? logLines,
this.error,
List<String>? tempFiles,
}) : logLines = logLines ?? [],
tempFiles = tempFiles ?? [];
}) : logLines = logLines ?? [],
tempFiles = tempFiles ?? [];

Map<String, dynamic> getFileInfo() {
if (_fileInfo == null) {
Expand Down Expand Up @@ -135,8 +135,7 @@ class Converter {

final valid = detector.getValidTargets(fmt);
if (!valid.contains(tgt) && tgt != 'BIN/CUE' && tgt != 'FILES') {
final err =
'Cannot convert $fmt → $tgt. '
final err = 'Cannot convert $fmt → $tgt. '
'Supported targets for $fmt: ${valid.isNotEmpty ? valid.join(', ') : 'none'}';
_log('[ERROR] $err');
job.error = err;
Expand Down Expand Up @@ -215,9 +214,8 @@ class Converter {
subCmd = 'createcd';
}

final compressionMap = subCmd == 'createcd'
? chdCdCompression
: chdDvdCompression;
final compressionMap =
subCmd == 'createcd' ? chdCdCompression : chdDvdCompression;
final defaultCodec = subCmd == 'createcd' ? 'cdlz' : 'zlib';
final cmd = [
chdman,
Expand Down Expand Up @@ -396,8 +394,7 @@ class Converter {

bool _xboxConvert(ConversionJob job, String src, String fmt) {
if (Platform.isMacOS) {
job.error =
'Xbox format conversion is not supported on macOS. '
job.error = 'Xbox format conversion is not supported on macOS. '
'XGDTool does not currently provide a macOS build.';
_log(' ❌ ${job.error}');
return false;
Expand Down
5 changes: 2 additions & 3 deletions core/lib/src/dcp_patcher.dart
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,8 @@ class DcpPatcher {
final basePath = p.normalize(p.canonicalize(outputDir));

for (final entry in xdeltaEntries) {
final archivePrefix = entry.name.startsWith('xdelta\\')
? 'xdelta\\'
: 'xdelta/';
final archivePrefix =
entry.name.startsWith('xdelta\\') ? 'xdelta\\' : 'xdelta/';
final relativePatchName = entry.name.substring(archivePrefix.length);
String targetName = relativePatchName.replaceAll('\\', '/');

Expand Down
11 changes: 4 additions & 7 deletions core/lib/src/gdi_reader.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,8 @@ List<GdiTrack> parseGdi(String gdiPath) {
final gdiDir = p.dirname(p.canonicalize(gdiPath));
final tracks = <GdiTrack>[];

final lines = file
.readAsLinesSync()
.where((l) => l.trim().isNotEmpty)
.toList();
final lines =
file.readAsLinesSync().where((l) => l.trim().isNotEmpty).toList();
if (lines.isEmpty) return tracks;

for (final line in lines.skip(1)) {
Expand All @@ -64,9 +62,8 @@ List<GdiTrack> parseGdi(String gdiPath) {
filename = filename.substring(1, filename.length - 1);
}
final filepath = p.join(gdiDir, filename);
final filesize = File(filepath).existsSync()
? File(filepath).lengthSync()
: 0;
final filesize =
File(filepath).existsSync() ? File(filepath).lengthSync() : 0;

tracks.add(
GdiTrack(
Expand Down
5 changes: 2 additions & 3 deletions core/lib/src/header_remover.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,8 @@ Map<String, dynamic>? detectHeader(String filepath) {

final hasCopierHeaderInternal =
_verifySnesInternalHeader(headerData, 0x81C0) ||
_verifySnesInternalHeader(headerData, 0x101C0);
final hasCleanInternal =
_verifySnesInternalHeader(headerData, 0x7FC0) ||
_verifySnesInternalHeader(headerData, 0x101C0);
final hasCleanInternal = _verifySnesInternalHeader(headerData, 0x7FC0) ||
_verifySnesInternalHeader(headerData, 0xFFC0);

if (hasCopierHeaderInternal) {
Expand Down
3 changes: 1 addition & 2 deletions core/lib/src/m3u_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ String generateM3u({
}
}

final targetDir =
Directory(outputPath).existsSync() ||
final targetDir = Directory(outputPath).existsSync() ||
!outputPath.toLowerCase().endsWith('.m3u')
? outputPath
: p.dirname(outputPath);
Expand Down
11 changes: 4 additions & 7 deletions core/lib/src/rom_renamer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,8 @@ String calcCrc32(String filepath, {void Function(double pct)? onProgress}) {
raf.closeSync();
}

final hex = (crc & 0xFFFFFFFF)
.toRadixString(16)
.toLowerCase()
.padLeft(8, '0');
final hex =
(crc & 0xFFFFFFFF).toRadixString(16).toLowerCase().padLeft(8, '0');
return hex;
}

Expand Down Expand Up @@ -216,9 +214,8 @@ Map<String, Map<String, dynamic>> loadDatIndex(String datPath) {
if (crc.isNotEmpty) {
index[crc] = {
'name': currentGameName,
'description': currentDesc.isNotEmpty
? currentDesc
: currentGameName,
'description':
currentDesc.isNotEmpty ? currentDesc : currentGameName,
'rom_name': romName,
'size': size,
'md5': md5,
Expand Down
16 changes: 8 additions & 8 deletions core/test/dcp_builder_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ void main() {

expect(result['success'], isTrue);

final patchedIpBin = File(p.join(outputDir.path, 'IP.BIN'))
.readAsStringSync();
final patched1stRead = File(p.join(outputDir.path, '1ST_READ.BIN'))
.readAsStringSync();
final patchedConfig = File(p.join(outputDir.path, 'DATA', 'CONFIG.TXT'))
.readAsStringSync();
final patchedNewFile = File(p.join(outputDir.path, 'DATA', 'NEWFILE.BIN'))
.readAsStringSync();
final patchedIpBin =
File(p.join(outputDir.path, 'IP.BIN')).readAsStringSync();
final patched1stRead =
File(p.join(outputDir.path, '1ST_READ.BIN')).readAsStringSync();
final patchedConfig =
File(p.join(outputDir.path, 'DATA', 'CONFIG.TXT')).readAsStringSync();
final patchedNewFile =
File(p.join(outputDir.path, 'DATA', 'NEWFILE.BIN')).readAsStringSync();

expect(patchedIpBin, equals('MODIFIED_BOOTSECTOR_IPBIN_HEADER_67890'));
expect(patched1stRead, equals('MODIFIED_GAME_CODE_XYZ123'));
Expand Down
13 changes: 6 additions & 7 deletions core/test/ssp_builder_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ void main() {
ecc.recalculateSector(sector);

// Verify EDC non-zero
final edcVal =
sector[0x810] |
final edcVal = sector[0x810] |
(sector[0x811] << 8) |
(sector[0x812] << 16) |
(sector[0x813] << 24);
Expand Down Expand Up @@ -113,10 +112,8 @@ void main() {
final changesTxt = utf8.decode(changesFile.content as List<int>);

final origIsoContent = Iso9660Reader.readIsoFile(origBin, 18, 39);
final expectedMd5 = md5
.convert(origIsoContent)
.toString()
.toUpperCase();
final expectedMd5 =
md5.convert(origIsoContent).toString().toUpperCase();

expect(changesTxt, contains('TEST.BIN: $expectedMd5'));

Expand All @@ -126,7 +123,9 @@ void main() {
},
);

test('SspBuilder generated SSP can be applied with saturn-patcher CLI binary if available', () async {
test(
'SspBuilder generated SSP can be applied with saturn-patcher CLI binary if available',
() async {
final builder = SspBuilder(
originalBin: origBin,
modifiedBin: modBin,
Expand Down
6 changes: 6 additions & 0 deletions gui/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
analyzer:
exclude:
- build/**
- windows/**
- macos/**
- linux/**
include: package:flutter_lints/flutter.yaml

linter:
Expand Down
47 changes: 23 additions & 24 deletions gui/lib/l10n/app_localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ import 'app_localizations_zh.dart';
/// property.
abstract class AppLocalizations {
AppLocalizations(String locale)
: localeName = intl.Intl.canonicalizedLocale(locale.toString());
: localeName = intl.Intl.canonicalizedLocale(locale.toString());

final String localeName;

Expand All @@ -95,11 +95,11 @@ abstract class AppLocalizations {
/// of delegates is preferred or required.
static const List<LocalizationsDelegate<dynamic>> localizationsDelegates =
<LocalizationsDelegate<dynamic>>[
delegate,
GlobalMaterialLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
];
delegate,
GlobalMaterialLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
];

/// A list of this localizations delegate's supported locales.
static const List<Locale> supportedLocales = <Locale>[
Expand All @@ -113,7 +113,7 @@ abstract class AppLocalizations {
Locale('pt'),
Locale('ru'),
Locale('tr'),
Locale('zh'),
Locale('zh')
];

/// No description provided for @appTitle.
Expand Down Expand Up @@ -878,18 +878,18 @@ class _AppLocalizationsDelegate

@override
bool isSupported(Locale locale) => <String>[
'ar',
'de',
'en',
'es',
'fr',
'it',
'ja',
'pt',
'ru',
'tr',
'zh',
].contains(locale.languageCode);
'ar',
'de',
'en',
'es',
'fr',
'it',
'ja',
'pt',
'ru',
'tr',
'zh'
].contains(locale.languageCode);

@override
bool shouldReload(_AppLocalizationsDelegate old) => false;
Expand Down Expand Up @@ -923,9 +923,8 @@ AppLocalizations lookupAppLocalizations(Locale locale) {
}

throw FlutterError(
'AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely '
'an issue with the localizations generation tool. Please file an issue '
'on GitHub with a reproducible sample app and the gen-l10n configuration '
'that was used.',
);
'AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely '
'an issue with the localizations generation tool. Please file an issue '
'on GitHub with a reproducible sample app and the gen-l10n configuration '
'that was used.');
}
Loading
Loading