Skip to content

Manic EMU is an all-in-one retro game emulator for iOS. It packs powerful features while keeping a clean, sleek UI and delivering buttery-smooth gameplay.

Swift

Adjust the sync details of romm

Daiuno673b992756c7
diff --git a/ManicEmu/ManicEmu/Resources/ar.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/ar.lproj/Localizable.strings
index c30e622d..526eb5ac 100644
--- a/ManicEmu/ManicEmu/Resources/ar.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/ar.lproj/Localizable.strings
@@ -22,7 +22,6 @@
"ImportDownloadError" = "خطأ في التحميل\n%@";
"ImportDownloadContinue" = "متابعة التحميل...\n%@";
"LandServiceEditServerName" = "اسم الخادم";
-"LandServiceEditServerNamePlaceholder" = "خادم SMB الخاص بي";
"LandServiceEditHost" = "عنوان الخادم";
"LandServiceEditUserName" = "اسم المستخدم";
"LandServiceEditPassword" = "كلمة المرور";
diff --git a/ManicEmu/ManicEmu/Resources/ca.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/ca.lproj/Localizable.strings
index bd96f82e..a5163a26 100644
--- a/ManicEmu/ManicEmu/Resources/ca.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/ca.lproj/Localizable.strings
@@ -21,7 +21,6 @@
"ImportDownloadError" = "Error en la baixada\n%@";
"ImportDownloadContinue" = "S'està reprenent la baixada...\n%@";
"LandServiceEditServerName" = "Nom del servidor";
-"LandServiceEditServerNamePlaceholder" = "El meu servidor SMB";
"LandServiceEditHost" = "Adreça del servidor";
"LandServiceEditUserName" = "Usuari";
"LandServiceEditPassword" = "Contrasenya";
diff --git a/ManicEmu/ManicEmu/Resources/cs.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/cs.lproj/Localizable.strings
index f9570994..f0b5b08d 100644
--- a/ManicEmu/ManicEmu/Resources/cs.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/cs.lproj/Localizable.strings
@@ -21,7 +21,6 @@
"ImportDownloadError" = "Chyba stahování\n%@";
"ImportDownloadContinue" = "Pokračovat ve stahování...\n%@";
"LandServiceEditServerName" = "Název serveru";
-"LandServiceEditServerNamePlaceholder" = "Můj SMB server";
"LandServiceEditHost" = "Adresa serveru";
"LandServiceEditUserName" = "Uživatelské jméno";
"LandServiceEditPassword" = "Heslo";
diff --git a/ManicEmu/ManicEmu/Resources/da.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/da.lproj/Localizable.strings
index 946b5a9d..cb93303e 100644
--- a/ManicEmu/ManicEmu/Resources/da.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/da.lproj/Localizable.strings
@@ -21,7 +21,6 @@
"ImportDownloadError" = "Downloadfejl\n%@";
"ImportDownloadContinue" = "Fortsæt download...\n%@";
"LandServiceEditServerName" = "Servernavn";
-"LandServiceEditServerNamePlaceholder" = "Min SMB-server";
"LandServiceEditHost" = "Serveradresse";
"LandServiceEditUserName" = "Brugernavn";
"LandServiceEditPassword" = "Adgangskode";
diff --git a/ManicEmu/ManicEmu/Resources/de.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/de.lproj/Localizable.strings
index aa95ccdc..6eb4637b 100644
--- a/ManicEmu/ManicEmu/Resources/de.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/de.lproj/Localizable.strings
@@ -22,7 +22,6 @@
"ImportDownloadError" = "Download-Fehler\n%@";
"ImportDownloadContinue" = "Download fortsetzen...\n%@";
"LandServiceEditServerName" = "Server-Name";
-"LandServiceEditServerNamePlaceholder" = "Mein SMB-Server";
"LandServiceEditHost" = "Server-Adresse";
"LandServiceEditUserName" = "Benutzername";
"LandServiceEditPassword" = "Passwort";
diff --git a/ManicEmu/ManicEmu/Resources/el.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/el.lproj/Localizable.strings
index e3fcb9bc..4c9179f1 100644
--- a/ManicEmu/ManicEmu/Resources/el.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/el.lproj/Localizable.strings
@@ -22,7 +22,6 @@
"ImportDownloadError" = "Σφάλμα λήψης\n%@";
"ImportDownloadContinue" = "Συνέχεια λήψης...\n%@";
"LandServiceEditServerName" = "Τίτλος Διακομιστή";
-"LandServiceEditServerNamePlaceholder" = "Ο SMB Διακομιστής μου";
"LandServiceEditHost" = "Διεύθυνση Διακομιστή";
"LandServiceEditUserName" = "Όνομα Χρήστη";
"LandServiceEditPassword" = "Κωδικός";
diff --git a/ManicEmu/ManicEmu/Resources/en.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/en.lproj/Localizable.strings
index 3c265e1f..4a5eec00 100644
--- a/ManicEmu/ManicEmu/Resources/en.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/en.lproj/Localizable.strings
@@ -20,7 +20,6 @@
"ImportDownloadError" = "Download Error\n%@";
"ImportDownloadContinue" = "Resuming Download...\n%@";
"LandServiceEditServerName" = "Server Title";
-"LandServiceEditServerNamePlaceholder" = "My SMB Server";
"LandServiceEditHost" = "Server Address";
"LandServiceEditUserName" = "Username";
"LandServiceEditPassword" = "Password";
@@ -1172,15 +1171,17 @@ Press the controller button to complete mapping...";
"MultiDiscImportErrorConflict" = "Error: Cannot mix different disc image formats.";
"MultiDiscImportErrorMissing" = "Error: No supported disc image found.";
-"SkinButtonBinding" = " Skin Button Binding";
-"SkinButtonBindingDesc" = "Bind skin buttons to keyboard keys";
+"SkinButtonBinding" = "Skin Button Binding";
+"SkinButtonBindingDesc" = "Bind skin buttons to keyboard keys.";
"RommPasswordOrApiKey" = "Password or API Key";
-"RommPullFromService" = "Pull data from RomM";
-"RommPushToService" = "Push changes to RomM";
-"RommPullConfirmDetail" = "This will overwrite local covers, metadata, play time, battery saves, and matching save states for %d linked game(s). Continue?";
-"RommPushConfirmDetail" = "This will overwrite RomM covers, summaries, saves, and save states for %d linked game(s), and append play time. Continue?";
+"RommPullFromService" = "Pull Data from RomM";
+"RommPushToService" = "Push Changes to RomM";
+"RommPullConfirmDetail" = "This will overwrite local covers, metadata, play time, game saves, and matching save states for %d linked games. Continue?";
+"RommPushConfirmDetail" = "This will overwrite RomM covers, summaries, game saves, and save states for %d linked games, and append play time. Continue?";
"RommNoLinkedGames" = "No games imported from this RomM service.";
-"RommTransferSuccess" = "Finished. %d game(s) updated.";
+"RommTransferSuccess" = "Finished. %d games updated.";
"RommTransferPartial" = "Finished. %d succeeded, %d failed.";
"RommTransferFailed" = "Transfer failed. Check the server connection.";
+"RommLanAddressOnly" = "RomM currently accepts LAN IP addresses only (such as 192.168.x.x, 10.x.x.x, or 169.254.x.x). Hostnames and public IPs are not supported yet.";
+"LandServiceEditServerNamePlaceholder" = "My Server";
diff --git a/ManicEmu/ManicEmu/Resources/es-419.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/es-419.lproj/Localizable.strings
index 7925f7ba..187b7118 100644
--- a/ManicEmu/ManicEmu/Resources/es-419.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/es-419.lproj/Localizable.strings
@@ -22,7 +22,6 @@
"ImportDownloadError" = "Error de descarga\n%@";
"ImportDownloadContinue" = "Continuar descarga...\n%@";
"LandServiceEditServerName" = "Nombre del servidor";
-"LandServiceEditServerNamePlaceholder" = "Mi servidor SMB";
"LandServiceEditHost" = "Dirección del servidor";
"LandServiceEditUserName" = "Usuario";
"LandServiceEditPassword" = "Contraseña";
diff --git a/ManicEmu/ManicEmu/Resources/es.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/es.lproj/Localizable.strings
index deebeda0..3af92e22 100644
--- a/ManicEmu/ManicEmu/Resources/es.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/es.lproj/Localizable.strings
@@ -22,7 +22,6 @@
"ImportDownloadError" = "Error de descarga\n%@";
"ImportDownloadContinue" = "Continuando descarga...\n%@";
"LandServiceEditServerName" = "Nombre del servidor";
-"LandServiceEditServerNamePlaceholder" = "Mi servidor SMB";
"LandServiceEditHost" = "Dirección del servidor";
"LandServiceEditUserName" = "Usuario";
"LandServiceEditPassword" = "Contraseña";
diff --git a/ManicEmu/ManicEmu/Resources/fi.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/fi.lproj/Localizable.strings
index 73340d4d..e0097adc 100644
--- a/ManicEmu/ManicEmu/Resources/fi.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/fi.lproj/Localizable.strings
@@ -21,7 +21,6 @@
"ImportDownloadError" = "Latausvirhe\n%@";
"ImportDownloadContinue" = "Jatketaan latausta...\n%@";
"LandServiceEditServerName" = "Palvelimen nimi";
-"LandServiceEditServerNamePlaceholder" = "Oma SMB-palvelin";
"LandServiceEditHost" = "Palvelimen osoite";
"LandServiceEditUserName" = "Käyttäjätunnus";
"LandServiceEditPassword" = "Salasana";
diff --git a/ManicEmu/ManicEmu/Resources/fr-CA.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/fr-CA.lproj/Localizable.strings
index 5d33bcde..7c350404 100644
--- a/ManicEmu/ManicEmu/Resources/fr-CA.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/fr-CA.lproj/Localizable.strings
@@ -21,7 +21,6 @@
"ImportDownloadError" = "Erreur de téléchargement\n%@";
"ImportDownloadContinue" = "Téléchargement en cours...\n%@";
"LandServiceEditServerName" = "Nom du serveur";
-"LandServiceEditServerNamePlaceholder" = "Mon serveur SMB";
"LandServiceEditHost" = "Adresse du serveur";
"LandServiceEditUserName" = "Nom d'utilisateur";
"LandServiceEditPassword" = "Mot de passe";
diff --git a/ManicEmu/ManicEmu/Resources/fr.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/fr.lproj/Localizable.strings
index 5a4f80de..cc970dc3 100644
--- a/ManicEmu/ManicEmu/Resources/fr.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/fr.lproj/Localizable.strings
@@ -21,7 +21,6 @@
"ImportDownloadError" = "Erreur de téléchargement\n%@";
"ImportDownloadContinue" = "Téléchargement en cours...\n%@";
"LandServiceEditServerName" = "Nom du serveur";
-"LandServiceEditServerNamePlaceholder" = "Mon serveur SMB";
"LandServiceEditHost" = "Adresse du serveur";
"LandServiceEditUserName" = "Nom d'utilisateur";
"LandServiceEditPassword" = "Mot de passe";
diff --git a/ManicEmu/ManicEmu/Resources/he.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/he.lproj/Localizable.strings
index 861cf8ea..c1acb0f3 100644
--- a/ManicEmu/ManicEmu/Resources/he.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/he.lproj/Localizable.strings
@@ -21,7 +21,6 @@
"ImportDownloadError" = "שגיאה בהורדה\n%@";
"ImportDownloadContinue" = "ממשיך בהורדה...\n%@";
"LandServiceEditServerName" = "שם השרת";
-"LandServiceEditServerNamePlaceholder" = "השרת שלי SMB";
"LandServiceEditHost" = "כתובת השרת";
"LandServiceEditUserName" = "שם משתמש";
"LandServiceEditPassword" = "סיסמה";
diff --git a/ManicEmu/ManicEmu/Resources/hi.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/hi.lproj/Localizable.strings
index c6e06119..cdc8f71d 100644
--- a/ManicEmu/ManicEmu/Resources/hi.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/hi.lproj/Localizable.strings
@@ -22,7 +22,6 @@
"ImportDownloadError" = "डाउनलोड त्रुटि\n%@";
"ImportDownloadContinue" = "डाउनलोड जारी...\n%@";
"LandServiceEditServerName" = "सर्वर शीर्षक";
-"LandServiceEditServerNamePlaceholder" = "मेरा SMB सर्वर";
"LandServiceEditHost" = "सर्वर पता";
"LandServiceEditUserName" = "लॉगिन यूजर";
"LandServiceEditPassword" = "पासवर्ड";
diff --git a/ManicEmu/ManicEmu/Resources/hr.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/hr.lproj/Localizable.strings
index 9a47d900..8a0b1cbf 100644
--- a/ManicEmu/ManicEmu/Resources/hr.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/hr.lproj/Localizable.strings
@@ -21,7 +21,6 @@
"ImportDownloadError" = "Greška pri preuzimanju\n%@";
"ImportDownloadContinue" = "Nastavljam preuzimanje...\n%@";
"LandServiceEditServerName" = "Naziv poslužitelja";
-"LandServiceEditServerNamePlaceholder" = "Moj SMB poslužitelj";
"LandServiceEditHost" = "Adresa poslužitelja";
"LandServiceEditUserName" = "Korisničko ime";
"LandServiceEditPassword" = "Lozinka";
diff --git a/ManicEmu/ManicEmu/Resources/hu.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/hu.lproj/Localizable.strings
index 9913bfb2..e84824fd 100644
--- a/ManicEmu/ManicEmu/Resources/hu.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/hu.lproj/Localizable.strings
@@ -21,7 +21,6 @@
"ImportDownloadError" = "Letöltési hiba\n%@";
"ImportDownloadContinue" = "Letöltés folytatása...\n%@";
"LandServiceEditServerName" = "Szerver neve";
-"LandServiceEditServerNamePlaceholder" = "Saját SMB szerverem";
"LandServiceEditHost" = "Szerver címe";
"LandServiceEditUserName" = "Felhasználónév";
"LandServiceEditPassword" = "Jelszó";
diff --git a/ManicEmu/ManicEmu/Resources/id.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/id.lproj/Localizable.strings
index 6c7089bd..1338731f 100644
--- a/ManicEmu/ManicEmu/Resources/id.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/id.lproj/Localizable.strings
@@ -21,7 +21,6 @@
"ImportDownloadError" = "Kesalahan unduh\n%@";
"ImportDownloadContinue" = "Lanjutkan unduhan...\n%@";
"LandServiceEditServerName" = "Judul Server";
-"LandServiceEditServerNamePlaceholder" = "Server SMB Saya";
"LandServiceEditHost" = "Alamat Server";
"LandServiceEditUserName" = "Nama Pengguna";
"LandServiceEditPassword" = "Kata Sandi";
diff --git a/ManicEmu/ManicEmu/Resources/it.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/it.lproj/Localizable.strings
index d8392a2e..14280868 100644
--- a/ManicEmu/ManicEmu/Resources/it.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/it.lproj/Localizable.strings
@@ -22,7 +22,6 @@
"ImportDownloadError" = "Errore download\n%@";
"ImportDownloadContinue" = "Download in corso...\n%@";
"LandServiceEditServerName" = "Nome server";
-"LandServiceEditServerNamePlaceholder" = "Il mio server SMB";
"LandServiceEditHost" = "Indirizzo server";
"LandServiceEditUserName" = "Utente";
"LandServiceEditPassword" = "Password";
diff --git a/ManicEmu/ManicEmu/Resources/ja.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/ja.lproj/Localizable.strings
index 5eceb628..542278ce 100644
--- a/ManicEmu/ManicEmu/Resources/ja.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/ja.lproj/Localizable.strings
@@ -20,7 +20,6 @@
"ImportDownloadError" = "ダウンロードエラー\n%@";
"ImportDownloadContinue" = "ダウンロードを続行...\n%@";
"LandServiceEditServerName" = "サーバー名";
-"LandServiceEditServerNamePlaceholder" = "マイSMBサーバー";
"LandServiceEditHost" = "サーバーアドレス";
"LandServiceEditUserName" = "ユーザー名";
"LandServiceEditPassword" = "パスワード";
diff --git a/ManicEmu/ManicEmu/Resources/ko.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/ko.lproj/Localizable.strings
index b347bc34..9a67594f 100644
--- a/ManicEmu/ManicEmu/Resources/ko.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/ko.lproj/Localizable.strings
@@ -22,7 +22,6 @@
"ImportDownloadError" = "다운로드 오류\n%@";
"ImportDownloadContinue" = "다운로드 계속...\n%@";
"LandServiceEditServerName" = "서버 제목";
-"LandServiceEditServerNamePlaceholder" = "나의 SMB 서버";
"LandServiceEditHost" = "서버 주소";
"LandServiceEditUserName" = "사용자 이름";
"LandServiceEditPassword" = "비밀번호";
diff --git a/ManicEmu/ManicEmu/Resources/ms.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/ms.lproj/Localizable.strings
index fb5a8ce3..d87f0990 100644
--- a/ManicEmu/ManicEmu/Resources/ms.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/ms.lproj/Localizable.strings
@@ -21,7 +21,6 @@
"ImportDownloadError" = "Ralat muat turun\n%@";
"ImportDownloadContinue" = "Meneruskan muat turun...\n%@";
"LandServiceEditServerName" = "Nama Pelayan";
-"LandServiceEditServerNamePlaceholder" = "Pelayan SMB Saya";
"LandServiceEditHost" = "Alamat Pelayan";
"LandServiceEditUserName" = "ID Pengguna";
"LandServiceEditPassword" = "Kata Laluan";
diff --git a/ManicEmu/ManicEmu/Resources/nb.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/nb.lproj/Localizable.strings
index 4c9bc2cf..4e7a4517 100644
--- a/ManicEmu/ManicEmu/Resources/nb.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/nb.lproj/Localizable.strings
@@ -21,7 +21,6 @@
"ImportDownloadError" = "Nedlastingsfeil\n%@";
"ImportDownloadContinue" = "Fortsett nedlasting...\n%@";
"LandServiceEditServerName" = "Servernavn";
-"LandServiceEditServerNamePlaceholder" = "Min SMB-server";
"LandServiceEditHost" = "Serveradresse";
"LandServiceEditUserName" = "Brukernavn";
"LandServiceEditPassword" = "Passord";
diff --git a/ManicEmu/ManicEmu/Resources/nl.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/nl.lproj/Localizable.strings
index 2c2f69d8..10da4c8e 100644
--- a/ManicEmu/ManicEmu/Resources/nl.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/nl.lproj/Localizable.strings
@@ -21,7 +21,6 @@
"ImportDownloadError" = "Downloadfout\n%@";
"ImportDownloadContinue" = "Download wordt voortgezet...\n%@";
"LandServiceEditServerName" = "Servernaam";
-"LandServiceEditServerNamePlaceholder" = "Mijn SMB-server";
"LandServiceEditHost" = "Serveradres";
"LandServiceEditUserName" = "Gebruikersnaam";
"LandServiceEditPassword" = "Wachtwoord";
diff --git a/ManicEmu/ManicEmu/Resources/pl.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/pl.lproj/Localizable.strings
index 1e7d974d..ed2b7ae3 100644
--- a/ManicEmu/ManicEmu/Resources/pl.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/pl.lproj/Localizable.strings
@@ -22,7 +22,6 @@
"ImportDownloadError" = "Błąd pobierania\n%@";
"ImportDownloadContinue" = "Kontynuuj pobieranie...\n%@";
"LandServiceEditServerName" = "Nazwa serwera";
-"LandServiceEditServerNamePlaceholder" = "Mój serwer SMB";
"LandServiceEditHost" = "Adres serwera";
"LandServiceEditUserName" = "Nazwa użytkownika";
"LandServiceEditPassword" = "Hasło";
diff --git a/ManicEmu/ManicEmu/Resources/pt-BR.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/pt-BR.lproj/Localizable.strings
index 3d12dd99..82b51f01 100644
--- a/ManicEmu/ManicEmu/Resources/pt-BR.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/pt-BR.lproj/Localizable.strings
@@ -21,7 +21,6 @@
"ImportDownloadError" = "Erro no download\n%@";
"ImportDownloadContinue" = "Continuar download...\n%@";
"LandServiceEditServerName" = "Nome do servidor";
-"LandServiceEditServerNamePlaceholder" = "Meu servidor SMB";
"LandServiceEditHost" = "Endereço do servidor";
"LandServiceEditUserName" = "Usuário";
"LandServiceEditPassword" = "Senha";
diff --git a/ManicEmu/ManicEmu/Resources/pt-PT.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/pt-PT.lproj/Localizable.strings
index 53502525..38f295c9 100644
--- a/ManicEmu/ManicEmu/Resources/pt-PT.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/pt-PT.lproj/Localizable.strings
@@ -21,7 +21,6 @@
"ImportDownloadError" = "Erro no download\n%@";
"ImportDownloadContinue" = "A continuar o download...\n%@";
"LandServiceEditServerName" = "Título do servidor";
-"LandServiceEditServerNamePlaceholder" = "Meu servidor SMB";
"LandServiceEditHost" = "Endereço do servidor";
"LandServiceEditUserName" = "Utilizador";
"LandServiceEditPassword" = "Palavra-passe";
diff --git a/ManicEmu/ManicEmu/Resources/ro.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/ro.lproj/Localizable.strings
index b48d6a6b..b4d34053 100644
--- a/ManicEmu/ManicEmu/Resources/ro.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/ro.lproj/Localizable.strings
@@ -21,7 +21,6 @@
"ImportDownloadError" = "Eroare la descărcare\n%@";
"ImportDownloadContinue" = "Continuă descărcarea...\n%@";
"LandServiceEditServerName" = "Nume server";
-"LandServiceEditServerNamePlaceholder" = "Serverul meu SMB";
"LandServiceEditHost" = "Adresă server";
"LandServiceEditUserName" = "Utilizator";
"LandServiceEditPassword" = "Parolă";
diff --git a/ManicEmu/ManicEmu/Resources/ru.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/ru.lproj/Localizable.strings
index cdabd4e3..124e9ea6 100644
--- a/ManicEmu/ManicEmu/Resources/ru.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/ru.lproj/Localizable.strings
@@ -22,7 +22,6 @@
"ImportDownloadError" = "Ошибка загрузки\n%@";
"ImportDownloadContinue" = "Продолжить загрузку...\n%@";
"LandServiceEditServerName" = "Название сервера";
-"LandServiceEditServerNamePlaceholder" = "Мой SMB-сервер";
"LandServiceEditHost" = "Адрес сервера";
"LandServiceEditUserName" = "Имя пользователя";
"LandServiceEditPassword" = "Пароль";
diff --git a/ManicEmu/ManicEmu/Resources/sk.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/sk.lproj/Localizable.strings
index 1e208b21..07af2c87 100644
--- a/ManicEmu/ManicEmu/Resources/sk.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/sk.lproj/Localizable.strings
@@ -20,7 +20,6 @@
"ImportDownloadError" = "Chyba sťahovania\n%@";
"ImportDownloadContinue" = "Pokračovať v sťahovaní...\n%@";
"LandServiceEditServerName" = "Názov servera";
-"LandServiceEditServerNamePlaceholder" = "Môj SMB server";
"LandServiceEditHost" = "Adresa servera";
"LandServiceEditUserName" = "Prihlasovacie meno";
"LandServiceEditPassword" = "Heslo";
diff --git a/ManicEmu/ManicEmu/Resources/sv.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/sv.lproj/Localizable.strings
index 08bb306f..76bddca9 100644
--- a/ManicEmu/ManicEmu/Resources/sv.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/sv.lproj/Localizable.strings
@@ -22,7 +22,6 @@
"ImportDownloadError" = "Nedladdningsfel\n%@";
"ImportDownloadContinue" = "Fortsätt ladda ner...\n%@";
"LandServiceEditServerName" = "Servernamn";
-"LandServiceEditServerNamePlaceholder" = "Min SMB-server";
"LandServiceEditHost" = "Serveradress";
"LandServiceEditUserName" = "Användarnamn";
"LandServiceEditPassword" = "Lösenord";
diff --git a/ManicEmu/ManicEmu/Resources/th.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/th.lproj/Localizable.strings
index 081b1340..d429c658 100644
--- a/ManicEmu/ManicEmu/Resources/th.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/th.lproj/Localizable.strings
@@ -22,7 +22,6 @@
"ImportDownloadError" = "เกิดข้อผิดพลาดในการดาวน์โหลด\n%@";
"ImportDownloadContinue" = "ดำเนินการดาวน์โหลดต่อ...\n%@";
"LandServiceEditServerName" = "ชื่อเซิร์ฟเวอร์";
-"LandServiceEditServerNamePlaceholder" = "เซิร์ฟเวอร์ SMB ของฉัน";
"LandServiceEditHost" = "ที่อยู่เซิร์ฟเวอร์";
"LandServiceEditUserName" = "ชื่อผู้ใช้";
"LandServiceEditPassword" = "รหัสผ่าน";
diff --git a/ManicEmu/ManicEmu/Resources/tr.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/tr.lproj/Localizable.strings
index d94f8fc1..17170e3f 100644
--- a/ManicEmu/ManicEmu/Resources/tr.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/tr.lproj/Localizable.strings
@@ -21,7 +21,6 @@
"ImportDownloadError" = "İndirme hatası\n%@";
"ImportDownloadContinue" = "İndirmeye devam ediliyor...\n%@";
"LandServiceEditServerName" = "Sunucu Başlığı";
-"LandServiceEditServerNamePlaceholder" = "Benim SMB Sunucum";
"LandServiceEditHost" = "Sunucu Adresi";
"LandServiceEditUserName" = "Kullanıcı Adı";
"LandServiceEditPassword" = "Şifre";
diff --git a/ManicEmu/ManicEmu/Resources/uk.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/uk.lproj/Localizable.strings
index c46e87c0..145b5d16 100644
--- a/ManicEmu/ManicEmu/Resources/uk.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/uk.lproj/Localizable.strings
@@ -21,7 +21,6 @@
"ImportDownloadError" = "Помилка завантаження\n%@";
"ImportDownloadContinue" = "Продовжити завантаження...\n%@";
"LandServiceEditServerName" = "Назва сервера";
-"LandServiceEditServerNamePlaceholder" = "Мій SMB-сервер";
"LandServiceEditHost" = "Адреса сервера";
"LandServiceEditUserName" = "Користувач";
"LandServiceEditPassword" = "Пароль";
diff --git a/ManicEmu/ManicEmu/Resources/vi.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/vi.lproj/Localizable.strings
index b8ac8dfe..dcd95847 100644
--- a/ManicEmu/ManicEmu/Resources/vi.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/vi.lproj/Localizable.strings
@@ -22,7 +22,6 @@
"ImportDownloadError" = "Lỗi tải xuống\n%@";
"ImportDownloadContinue" = "Tiếp tục tải...\n%@";
"LandServiceEditServerName" = "Tên máy chủ";
-"LandServiceEditServerNamePlaceholder" = "Máy chủ SMB của tôi";
"LandServiceEditHost" = "Địa chỉ máy chủ";
"LandServiceEditUserName" = "Tên đăng nhập";
"LandServiceEditPassword" = "Mật khẩu";
diff --git a/ManicEmu/ManicEmu/Resources/zh-HK.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/zh-HK.lproj/Localizable.strings
index c4f69871..c242ad19 100644
--- a/ManicEmu/ManicEmu/Resources/zh-HK.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/zh-HK.lproj/Localizable.strings
@@ -22,7 +22,6 @@
"ImportDownloadError" = "下載錯誤\n%@";
"ImportDownloadContinue" = "繼續下載...\n%@";
"LandServiceEditServerName" = "伺服器標題";
-"LandServiceEditServerNamePlaceholder" = "我的SMB伺服器";
"LandServiceEditHost" = "伺服器地址";
"LandServiceEditUserName" = "登入用戶";
"LandServiceEditPassword" = "密碼";
diff --git a/ManicEmu/ManicEmu/Resources/zh-Hans.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/zh-Hans.lproj/Localizable.strings
index fabc1b65..27282f19 100644
--- a/ManicEmu/ManicEmu/Resources/zh-Hans.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/zh-Hans.lproj/Localizable.strings
@@ -20,7 +20,6 @@
"ImportDownloadError" = "下载错误\n%@";
"ImportDownloadContinue" = "继续下载...\n%@";
"LandServiceEditServerName" = "服务器标题";
-"LandServiceEditServerNamePlaceholder" = "我的SMB服务器";
"LandServiceEditHost" = "服务器地址";
"LandServiceEditUserName" = "登录用户";
"LandServiceEditPassword" = "密码";
@@ -1166,3 +1165,17 @@
"MultiDiscSupportedFormats" = "支持的格式:%@";
"MultiDiscImportErrorConflict" = "错误:不能混用不同格式的光盘镜像";
"MultiDiscImportErrorMissing" = "错误:未找到支持的光盘镜像";
+
+"SkinButtonBinding" = "皮肤按键绑定";
+"SkinButtonBindingDesc" = "将皮肤按钮绑定到键盘按键。";
+"RommPasswordOrApiKey" = "密码或 API 密钥";
+"RommPullFromService" = "从 RomM 拉取数据";
+"RommPushToService" = "向 RomM 推送更改";
+"RommPullConfirmDetail" = "将覆盖 %d 个已关联游戏的本地封面、元数据、游戏时长、游戏存档,以及匹配的即时存档。是否继续?";
+"RommPushConfirmDetail" = "将覆盖 RomM 上 %d 个已关联游戏的封面、简介、游戏存档和即时存档,并累加游戏时长。是否继续?";
+"RommNoLinkedGames" = "没有从此 RomM 服务导入的游戏。";
+"RommTransferSuccess" = "完成,已更新 %d 个游戏。";
+"RommTransferPartial" = "完成,成功 %d 个,失败 %d 个。";
+"RommTransferFailed" = "同步失败,请检查服务器连接。";
+"RommLanAddressOnly" = "RomM 目前仅支持局域网 IP 地址(如 192.168.x.x、10.x.x.x 或 169.254.x.x),暂不支持主机名和公网 IP。";
+"LandServiceEditServerNamePlaceholder" = "我的服务器";
diff --git a/ManicEmu/ManicEmu/Resources/zh-Hant.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/zh-Hant.lproj/Localizable.strings
index 29fe8f65..4efa4a4d 100644
--- a/ManicEmu/ManicEmu/Resources/zh-Hant.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/zh-Hant.lproj/Localizable.strings
@@ -22,7 +22,6 @@
"ImportDownloadError" = "下載錯誤\n%@";
"ImportDownloadContinue" = "繼續下載...\n%@";
"LandServiceEditServerName" = "伺服器標題";
-"LandServiceEditServerNamePlaceholder" = "我的SMB伺服器";
"LandServiceEditHost" = "伺服器位址";
"LandServiceEditUserName" = "登入帳號";
"LandServiceEditPassword" = "密碼";
diff --git a/ManicEmu/ManicEmu/Sources/Business/Common/Views/FileBrowserView.swift b/ManicEmu/ManicEmu/Sources/Business/Common/Views/FileBrowserView.swift
index 764bc078..c5fbfd9e 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Common/Views/FileBrowserView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Common/Views/FileBrowserView.swift
@@ -454,9 +454,12 @@ class FileBrowserView: BaseView {
if let url = request?.url {
downloadItems[item.name] = url
if let romId = Int(item.id.split(separator: "/").first.map(String.init) ?? "") {
+ Log.debug("[RomM] download queue file=\(item.name) romId=\(romId) serviceId=\(provider.serviceId) url=\(url.absoluteString)")
RommLibrary.shared.registerDownloadedRom(fileName: item.name,
romId: romId,
serviceId: provider.serviceId)
+ } else {
+ Log.debug("[RomM] download queue skipped: cannot parse romId from item.id=\(item.id)")
}
}
headers = request?.allHTTPHeaderFields
diff --git a/ManicEmu/ManicEmu/Sources/Business/Import/Models/RommClient.swift b/ManicEmu/ManicEmu/Sources/Business/Import/Models/RommClient.swift
index ec9b764a..d90581be 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Import/Models/RommClient.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Import/Models/RommClient.swift
@@ -20,12 +20,80 @@ struct RommPlatform: Decodable {
let rom_count: Int?
}
+struct RommAgeRating: Decodable {
+ let rating: String?
+ let category: String?
+
+ init(rating: String?, category: String?) {
+ self.rating = rating
+ self.category = category
+ }
+
+ enum CodingKeys: String, CodingKey { case rating, category }
+
+ init(from decoder: Decoder) throws {
+ let container = try decoder.container(keyedBy: CodingKeys.self)
+ if let string = try? container.decode(String.self, forKey: .rating) {
+ rating = string
+ } else if let number = try? container.decode(Int.self, forKey: .rating) {
+ rating = String(number)
+ } else {
+ rating = nil
+ }
+ if let string = try? container.decode(String.self, forKey: .category) {
+ category = string
+ } else if let number = try? container.decode(Int.self, forKey: .category) {
+ category = String(number)
+ } else {
+ category = nil
+ }
+ }
+}
+
+struct RommIGDBMetadata: Decodable {
+ let age_ratings: [RommAgeRating]?
+
+ enum CodingKeys: String, CodingKey { case age_ratings }
+
+ init(from decoder: Decoder) throws {
+ let container = try decoder.container(keyedBy: CodingKeys.self)
+ if let objects = try? container.decode([RommAgeRating].self, forKey: .age_ratings) {
+ age_ratings = objects
+ } else if let strings = try? container.decode([String].self, forKey: .age_ratings) {
+ age_ratings = strings.map { RommAgeRating(rating: $0, category: nil) }
+ } else {
+ age_ratings = nil
+ }
+ }
+}
+
struct RommMetadatum: Decodable {
let genres: [String]?
let franchises: [String]?
let companies: [String]?
let age_ratings: [String]?
let first_release_date: Int64?
+
+ enum CodingKeys: String, CodingKey {
+ case genres, franchises, companies, age_ratings, first_release_date
+ }
+
+ init(from decoder: Decoder) throws {
+ let container = try decoder.container(keyedBy: CodingKeys.self)
+ genres = try? container.decode([String].self, forKey: .genres)
+ franchises = try? container.decode([String].self, forKey: .franchises)
+ companies = try? container.decode([String].self, forKey: .companies)
+ first_release_date = try? container.decode(Int64.self, forKey: .first_release_date)
+ if let list = try? container.decode([String].self, forKey: .age_ratings) {
+ age_ratings = list
+ } else if let one = try? container.decode(String.self, forKey: .age_ratings), !one.isEmpty {
+ age_ratings = [one]
+ } else if let objects = try? container.decode([RommAgeRating].self, forKey: .age_ratings) {
+ age_ratings = objects.compactMap(\.rating)
+ } else {
+ age_ratings = nil
+ }
+ }
}
struct RommUser: Decodable {
@@ -41,15 +109,52 @@ struct RommRom: Decodable {
let path_cover_small: String?
let path_cover_large: String?
let url_cover: String?
+ let has_manual: Bool?
+ let path_manual: String?
+ let url_manual: String?
let platform_display_name: String?
let metadatum: RommMetadatum?
+ let igdb_metadata: RommIGDBMetadata?
let rom_user: RommUser?
+ enum CodingKeys: String, CodingKey {
+ case id, name, fs_name, fs_size_bytes, summary
+ case path_cover_small, path_cover_large, url_cover
+ case has_manual, path_manual, url_manual
+ case platform_display_name, metadatum, igdb_metadata, rom_user
+ }
+
+ init(from decoder: Decoder) throws {
+ let container = try decoder.container(keyedBy: CodingKeys.self)
+ id = try container.decode(Int.self, forKey: .id)
+ name = try container.decodeIfPresent(String.self, forKey: .name)
+ fs_name = try container.decode(String.self, forKey: .fs_name)
+ fs_size_bytes = try container.decodeIfPresent(Int64.self, forKey: .fs_size_bytes)
+ summary = try container.decodeIfPresent(String.self, forKey: .summary)
+ path_cover_small = try container.decodeIfPresent(String.self, forKey: .path_cover_small)
+ path_cover_large = try container.decodeIfPresent(String.self, forKey: .path_cover_large)
+ url_cover = try container.decodeIfPresent(String.self, forKey: .url_cover)
+ has_manual = try? container.decode(Bool.self, forKey: .has_manual)
+ path_manual = try? container.decode(String.self, forKey: .path_manual)
+ url_manual = try? container.decode(String.self, forKey: .url_manual)
+ platform_display_name = try container.decodeIfPresent(String.self, forKey: .platform_display_name)
+ metadatum = try? container.decode(RommMetadatum.self, forKey: .metadatum)
+ igdb_metadata = try? container.decode(RommIGDBMetadata.self, forKey: .igdb_metadata)
+ rom_user = try? container.decode(RommUser.self, forKey: .rom_user)
+ }
+
var preferredCoverPath: String? {
if let path = path_cover_large, !path.isEmpty { return path }
if let path = path_cover_small, !path.isEmpty { return path }
return nil
}
+
+ /// Local resource path first. `url_manual` is the scraped source (ScreenScraper, etc.).
+ var preferredManualPath: String? {
+ if let path = path_manual, !path.isEmpty { return path }
+ if let path = url_manual, !path.isEmpty { return path }
+ return nil
+ }
}
struct RommScreenshot: Decodable {
@@ -189,10 +294,19 @@ final class RommClient {
}
func data(for request: URLRequest) async throws -> Data {
+ let url = request.url?.absoluteString ?? "?"
+ Log.debug("[RomM HTTP] \(request.httpMethod ?? "GET") \(url)")
let (data, response) = try await session.data(for: request)
- guard let http = response as? HTTPURLResponse, 200..<300 ~= http.statusCode else {
+ guard let http = response as? HTTPURLResponse else {
+ Log.debug("[RomM HTTP] ← non-HTTP response \(data.count) bytes \(url)")
+ throw URLError(.badServerResponse)
+ }
+ if !(200..<300 ~= http.statusCode) {
+ let body = String(data: data, encoding: .utf8).map { String($0.prefix(400)) } ?? "<\(data.count) bytes>"
+ Log.debug("[RomM HTTP] ← \(http.statusCode) \(data.count) bytes \(url) body=\(body)")
throw URLError(.userAuthenticationRequired)
}
+ Log.debug("[RomM HTTP] ← \(http.statusCode) \(data.count) bytes \(url)")
return data
}
@@ -207,7 +321,54 @@ final class RommClient {
}
func rom(id: Int) async throws -> RommRom {
- try await get("\(RomApiStub)/\(id)")
+ guard let req = request(path: "\(RomApiStub)/\(id)") else {
+ throw URLError(.badURL)
+ }
+ let payload = try await data(for: req)
+ Self.logRomPayload(id: id, payload: payload)
+ return try Self.jsonDecoder.decode(RommRom.self, from: payload)
+ }
+
+ private static func logRomPayload(id: Int, payload: Data) {
+ guard let json = try? JSONSerialization.jsonObject(with: payload) as? [String: Any] else {
+ Log.debug("[RomM] GET /api/roms/\(id) payload is not a JSON object (\(payload.count) bytes)")
+ return
+ }
+ let keys = json.keys.sorted()
+ Log.debug("[RomM] GET /api/roms/\(id) keys=\(keys)")
+ for key in ["id", "name", "fs_name", "summary", "path_cover_small", "path_cover_large", "url_cover", "has_cover", "has_manual", "path_manual", "url_manual", "platform_name", "platform_display_name"] {
+ if let value = json[key] {
+ Log.debug("[RomM] \(key)=\(Self.shortValue(value))")
+ }
+ }
+ if let metadatum = json["metadatum"] {
+ Log.debug("[RomM] metadatum=\(Self.shortValue(metadatum))")
+ }
+ if let igdb = json["igdb_metadata"] {
+ Log.debug("[RomM] igdb_metadata=\(Self.shortValue(igdb))")
+ }
+ if let romUser = json["rom_user"] {
+ Log.debug("[RomM] rom_user=\(Self.shortValue(romUser))")
+ }
+ let coverKeys = keys.filter { $0.lowercased().contains("cover") }
+ if !coverKeys.isEmpty {
+ Log.debug("[RomM] cover-related keys=\(coverKeys)")
+ }
+ }
+
+ private static func shortValue(_ value: Any, limit: Int = 240) -> String {
+ let raw: String
+ if let string = value as? String {
+ raw = string
+ } else if JSONSerialization.isValidJSONObject(value),
+ let data = try? JSONSerialization.data(withJSONObject: value, options: [.sortedKeys]),
+ let string = String(data: data, encoding: .utf8) {
+ raw = string
+ } else {
+ raw = String(describing: value)
+ }
+ if raw.count <= limit { return raw }
+ return String(raw.prefix(limit)) + "…"
}
func searchRoms(term: String) async throws -> [RommRom] {
@@ -254,7 +415,7 @@ final class RommClient {
request(path: "\(StateApiStub)/\(stateID)/content")
}
- func assetDownloadRequest(downloadPath: String) -> URLRequest? {
+ func assetDownloadRequest(downloadPath: String, ignoreCache: Bool = false) -> URLRequest? {
let rawPath = String(downloadPath.split(separator: "?", maxSplits: 1, omittingEmptySubsequences: false)[0])
var components = URLComponents()
components.scheme = baseURL.scheme
@@ -264,6 +425,9 @@ final class RommClient {
guard let url = components.url else { return nil }
var req = URLRequest(url: url)
req.setValue(authHeader, forHTTPHeaderField: "Authorization")
+ if ignoreCache {
+ req.cachePolicy = .reloadIgnoringLocalCacheData
+ }
return req
}
@@ -297,7 +461,48 @@ final class RommClient {
screenshot: screenshot)
}
- func updateLastPlayed(romID: Int) async throws {
+ func uploadManual(romID: Int, fileName: String, fileData: Data) async throws {
+ guard var req = request(path: "\(RomApiStub)/\(romID)/manuals") else { throw URLError(.badURL) }
+ let safeName = URL(fileURLWithPath: fileName).lastPathComponent
+ let boundary = "ManicEmuBoundary-manual-\(romID)"
+ req.httpMethod = "POST"
+ req.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type")
+ req.setValue(safeName, forHTTPHeaderField: "x-upload-filename")
+ var body = Data()
+ body.appendFormFile(boundary: boundary,
+ name: safeName,
+ fileName: safeName,
+ mime: "application/pdf",
+ data: fileData)
+ body.append("--\(boundary)--\r\n")
+ Log.debug("[RomM HTTP] POST \(req.url?.absoluteString ?? "?") manual=\(safeName) bytes=\(fileData.count)")
+ let (data, response) = try await session.upload(for: req, from: body)
+ guard let http = response as? HTTPURLResponse, 200..<300 ~= http.statusCode else {
+ let status = (response as? HTTPURLResponse)?.statusCode ?? -1
+ let bodyText = String(data: data, encoding: .utf8).map { String($0.prefix(400)) } ?? "<\(data.count) bytes>"
+ Log.debug("[RomM HTTP] ← \(status) POST /api/roms/\(romID)/manuals body=\(bodyText)")
+ throw URLError(.userAuthenticationRequired)
+ }
+ Log.debug("[RomM HTTP] ← \(http.statusCode) POST /api/roms/\(romID)/manuals \(data.count) bytes")
+ }
+
+ func deleteManual(romID: Int) async throws {
+ guard var req = request(path: "\(RomApiStub)/\(romID)/manuals") else { throw URLError(.badURL) }
+ req.httpMethod = "DELETE"
+ Log.debug("[RomM HTTP] DELETE \(req.url?.absoluteString ?? "?")")
+ let (data, response) = try await session.data(for: req)
+ guard let http = response as? HTTPURLResponse else { throw URLError(.badServerResponse) }
+ if http.statusCode == 404 {
+ Log.debug("[RomM HTTP] ← 404 DELETE /api/roms/\(romID)/manuals (already gone)")
+ return
+ }
+ if !(200..<300 ~= http.statusCode) {
+ let bodyText = String(data: data, encoding: .utf8).map { String($0.prefix(400)) } ?? "<\(data.count) bytes>"
+ Log.debug("[RomM HTTP] ← \(http.statusCode) DELETE /api/roms/\(romID)/manuals body=\(bodyText)")
+ throw URLError(.userAuthenticationRequired)
+ }
+ Log.debug("[RomM HTTP] ← \(http.statusCode) DELETE /api/roms/\(romID)/manuals")
+ }
guard var req = request(path: "\(RomApiStub)/\(romID)/props",
query: [.init(name: "update_last_played", value: "true")]) else {
throw URLError(.badURL)
@@ -349,10 +554,15 @@ final class RommClient {
data: artwork.data)
}
body.append("--\(boundary)--\r\n")
+ Log.debug("[RomM HTTP] PUT \(req.url?.absoluteString ?? "?") name=\(name ?? "nil") summaryChars=\(summary?.count ?? 0) artworkBytes=\(artwork?.data.count ?? 0)")
let (data, response) = try await session.upload(for: req, from: body)
guard let http = response as? HTTPURLResponse, 200..<300 ~= http.statusCode else {
+ let status = (response as? HTTPURLResponse)?.statusCode ?? -1
+ let bodyText = String(data: data, encoding: .utf8).map { String($0.prefix(400)) } ?? "<\(data.count) bytes>"
+ Log.debug("[RomM HTTP] ← \(status) PUT /api/roms/\(romID) body=\(bodyText)")
throw URLError(.userAuthenticationRequired)
}
+ Log.debug("[RomM HTTP] ← \(http.statusCode) PUT /api/roms/\(romID) \(data.count) bytes")
_ = data
}
@@ -391,10 +601,15 @@ final class RommClient {
}
body.append("--\(boundary)--\r\n")
+ Log.debug("[RomM HTTP] POST \(req.url?.absoluteString ?? "?") field=\(fileField) file=\(fileName) bytes=\(fileData.count) screenshot=\(screenshot?.fileName ?? "nil")")
let (data, response) = try await session.upload(for: req, from: body)
guard let http = response as? HTTPURLResponse, 200..<300 ~= http.statusCode else {
+ let status = (response as? HTTPURLResponse)?.statusCode ?? -1
+ let bodyText = String(data: data, encoding: .utf8).map { String($0.prefix(400)) } ?? "<\(data.count) bytes>"
+ Log.debug("[RomM HTTP] ← \(status) POST \(stub) \(fileName) body=\(bodyText)")
throw URLError(.userAuthenticationRequired)
}
+ Log.debug("[RomM HTTP] ← \(http.statusCode) POST \(stub) \(fileName) \(data.count) bytes")
return try Self.jsonDecoder.decode(T.self, from: data)
}
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Import/Views/ImportServiceListView.swift b/ManicEmu/ManicEmu/Sources/Business/Import/Views/ImportServiceListView.swift
index 50d012ac..75d04599 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Import/Views/ImportServiceListView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Import/Views/ImportServiceListView.swift
@@ -79,6 +79,9 @@ class ImportServiceListView: BaseView {
private let fileService = ImportService.genService(type: .files, detail: R.string.localizable.importServiceListFilesDetail())
private var serviceUpdateToken: NotificationToken? = nil
+ /// Context-menu API shows a custom sheet and returns nil, so UIKit would otherwise treat the long-press as a tap.
+ private var suppressSelectionFromLongPress = false
+ private var isPresentingServiceLongPressMenu = false
private var services: [ImportService] = {
var services: [ImportService] = []
//默认添加wifi、粘贴板、多碟助手、RomPatcher
@@ -291,7 +294,19 @@ extension ImportServiceListView: UICollectionViewDataSource {
}
extension ImportServiceListView: UICollectionViewDelegate {
+ func collectionView(_ collectionView: UICollectionView, shouldSelectItemAt indexPath: IndexPath) -> Bool {
+ if suppressSelectionFromLongPress {
+ suppressSelectionFromLongPress = false
+ return false
+ }
+ return true
+ }
+
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
+ if suppressSelectionFromLongPress {
+ suppressSelectionFromLongPress = false
+ return
+ }
if indexPath.section == 0, indexPath.row == 1 {
//files
FilesImporter.shared.presentImportController()
@@ -369,6 +384,21 @@ extension ImportServiceListView: UICollectionViewDelegate {
let service = services[indexPath.row]
guard service.type != .wifi && service.type != .paste && service.type != .multiDisc && service.type != .romPatcher else { return nil }
+ suppressSelectionFromLongPress = true
+ if !isPresentingServiceLongPressMenu {
+ isPresentingServiceLongPressMenu = true
+ presentServiceLongPressMenu(service)
+ DispatchQueue.main.async { [weak self] in
+ self?.isPresentingServiceLongPressMenu = false
+ }
+ }
+ DispatchQueue.main.asyncAfter(deadline: .now() + 1) { [weak self] in
+ self?.suppressSelectionFromLongPress = false
+ }
+ return nil
+ }
+
+ private func presentServiceLongPressMenu(_ service: ImportService) {
if service.type == .romm {
ChevronSheetView.show(cellOptions: [
.iconTitleChevronCell(icon: .symbol(.arrowDown),
@@ -401,7 +431,6 @@ extension ImportServiceListView: UICollectionViewDelegate {
}
})
}
- return nil
}
private func deleteImportService(_ service: ImportService) {
@@ -424,7 +453,8 @@ extension ImportServiceListView: UICollectionViewDelegate {
? R.string.localizable.rommPullConfirmDetail(count)
: R.string.localizable.rommPushConfirmDetail(count)
UIView.makeAlert(detail: detail,
- confirmTitle: R.string.localizable.confirmTitle()) {
+ confirmTitle: R.string.localizable.confirmTitle(),
+ confirmAction: {
Task {
await MainActor.run { UIView.makeLoading() }
let summary = pull
@@ -441,6 +471,6 @@ extension ImportServiceListView: UICollectionViewDelegate {
}
}
}
- }
+ })
}
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Import/Views/LanServiceEditView.swift b/ManicEmu/ManicEmu/Sources/Business/Import/Views/LanServiceEditView.swift
index e7ced865..65365a54 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Import/Views/LanServiceEditView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Import/Views/LanServiceEditView.swift
@@ -269,6 +269,10 @@ class LanServiceEditView: BaseView {
isValid = false
break
}
+ if service.type == .romm, !Self.isLanIPv4Host(components.host) {
+ isValid = false
+ break
+ }
}
service.scheme = components.scheme
service.host = components.host
@@ -306,6 +310,22 @@ class LanServiceEditView: BaseView {
button.state = isValid ? .normal : .disabled
return button
}
+
+ /// Temporary add-form gate: private IPv4 only. Hostnames and public IPs are rejected.
+ private static func isLanIPv4Host(_ host: String) -> Bool {
+ let folded = host.trimmingCharacters(in: .whitespacesAndNewlines).lowercased()
+ if folded == "localhost" { return true }
+ let parts = folded.split(separator: ".", omittingEmptySubsequences: false)
+ guard parts.count == 4,
+ let b1 = UInt8(parts[0]), let b2 = UInt8(parts[1]),
+ UInt8(parts[2]) != nil, UInt8(parts[3]) != nil else { return false }
+ if b1 == 10 { return true }
+ if b1 == 127 { return true }
+ if b1 == 169 && b2 == 254 { return true }
+ if b1 == 192 && b2 == 168 { return true }
+ if b1 == 172 && (16...31).contains(b2) { return true }
+ return false
+ }
}
extension LanServiceEditView: ShowableView {
diff --git a/ManicEmu/ManicEmu/Sources/Tools/Others/FilesImporter.swift b/ManicEmu/ManicEmu/Sources/Tools/Others/FilesImporter.swift
index ac0331f1..91d9e865 100644
--- a/ManicEmu/ManicEmu/Sources/Tools/Others/FilesImporter.swift
+++ b/ManicEmu/ManicEmu/Sources/Tools/Others/FilesImporter.swift
@@ -728,8 +728,10 @@ extension FilesImporter {
})
if RommLibrary.shared.hasPendingLink(fileName: originalUrl.lastPathComponent)
|| RommLibrary.shared.hasPendingLink(fileName: game.fileName) {
+ Log.debug("[RomM] import success, apply sidecar original=\(originalUrl.lastPathComponent) gameFile=\(game.fileName) gameId=\(game.id)")
RommLibrary.shared.applyAfterImport(gameId: game.id, fileName: originalUrl.lastPathComponent)
} else {
+ Log.debug("[RomM] import success, no pending link original=\(originalUrl.lastPathComponent) gameFile=\(game.fileName)")
OnlineCoverManager.shared.addCoverMatch(OnlineCoverManager.CoverMatch(game: game))
}
completion?(game.id, game.gameType == ._3ds ? (game.displayName) : game.name, nil)
diff --git a/ManicEmu/ManicEmu/Sources/Tools/Others/RommLibrary.swift b/ManicEmu/ManicEmu/Sources/Tools/Others/RommLibrary.swift
index 7faad8aa..515fc4ce 100644
--- a/ManicEmu/ManicEmu/Sources/Tools/Others/RommLibrary.swift
+++ b/ManicEmu/ManicEmu/Sources/Tools/Others/RommLibrary.swift
@@ -30,6 +30,7 @@ final class RommLibrary {
var map = pendingMap()
map[fileName] = ["romId": romId, "serviceId": serviceId]
UserDefaults.standard.set(map, forKey: Self.pendingLinksKey)
+ Log.debug("[RomM] pending register file=\(fileName) romId=\(romId) serviceId=\(serviceId)")
}
func hasPendingLink(fileName: String) -> Bool {
@@ -41,15 +42,87 @@ final class RommLibrary {
guard map[fileName] != nil else { return }
map[fileName] = nil
UserDefaults.standard.set(map, forKey: Self.pendingLinksKey)
+ Log.debug("[RomM] pending discarded file=\(fileName)")
}
/// Bind extras and pull sidecar data after a newly created game import.
func applyAfterImport(gameId: String, fileName: String? = nil) {
+ Log.debug("[RomM] applyAfterImport start gameId=\(gameId) file=\(fileName ?? "nil") main=\(Thread.isMainThread)")
+ let bound = bindPendingIfPossible(gameId: gameId, fileName: fileName)
Task { @MainActor in
- await self.applyAfterImportOnMain(gameId: gameId, fileName: fileName)
+ await self.continueAfterImport(gameId: gameId, fileName: fileName, bound: bound)
}
}
+ /// The importer writes the Game on a background Realm. Bind extras on that same thread
+ /// so the link is not lost when the main Realm has not refreshed yet.
+ private func bindPendingIfPossible(gameId: String, fileName: String?) -> (romId: Int, serviceId: String)? {
+ let realm = Database.realm
+ realm.refresh()
+ guard let game = realm.object(ofType: Game.self, forPrimaryKey: gameId), !game.isDeleted else {
+ Log.debug("[RomM] bind deferred; game not on caller Realm yet gameId=\(gameId)")
+ return nil
+ }
+ let pendingName = fileName ?? game.fileName
+ guard let pending = consumePendingLink(fileName: pendingName) ?? consumePendingLink(fileName: game.fileName) else {
+ Log.debug("[RomM] bind skipped; no pending file=\(pendingName) gameFile=\(game.fileName)")
+ return nil
+ }
+ persistLink(gameId: gameId, romId: pending.romId, serviceId: pending.serviceId)
+ Log.debug("[RomM] bind on caller thread game=\(game.fileName) romId=\(pending.romId) serviceId=\(pending.serviceId)")
+ return pending
+ }
+
+ @MainActor
+ private func continueAfterImport(gameId: String, fileName: String?, bound: (romId: Int, serviceId: String)?) async {
+ guard let game = await waitForGame(gameId: gameId) else {
+ Log.debug("[RomM] applyAfterImport aborted; game still missing after refresh gameId=\(gameId) file=\(fileName ?? "nil")")
+ return
+ }
+ let pending: (romId: Int, serviceId: String)
+ if let bound {
+ pending = bound
+ } else if let consumed = consumePendingLink(fileName: fileName ?? game.fileName) ?? consumePendingLink(fileName: game.fileName) {
+ persistLink(gameId: gameId, romId: consumed.romId, serviceId: consumed.serviceId)
+ Log.debug("[RomM] bind on main after refresh game=\(game.fileName) romId=\(consumed.romId) serviceId=\(consumed.serviceId)")
+ pending = consumed
+ } else if let romId = game.rommRomId, let serviceId = game.rommServiceId {
+ pending = (romId, serviceId)
+ Log.debug("[RomM] applyAfterImport using existing bind romId=\(romId) serviceId=\(serviceId)")
+ } else {
+ Log.debug("[RomM] applyAfterImport skipped: no pending link file=\(fileName ?? game.fileName) gameFile=\(game.fileName) gameId=\(gameId)")
+ return
+ }
+ guard let client = makeClient(serviceId: pending.serviceId) else {
+ Log.debug("[RomM] applyAfterImport: client unavailable for service \(pending.serviceId)")
+ return
+ }
+ do {
+ try await pullSidecar(gameId: gameId, client: client, romId: pending.romId)
+ } catch {
+ Log.debug("[RomM] applyAfterImport failed for \(game.fileName): \(error)")
+ }
+ }
+
+ @MainActor
+ private func waitForGame(gameId: String) async -> Game? {
+ let realm = Database.realm
+ realm.refresh()
+ if let game = realm.object(ofType: Game.self, forPrimaryKey: gameId), !game.isDeleted {
+ return game
+ }
+ for attempt in 1...8 {
+ try? await Task.sleep(nanoseconds: 50_000_000 * UInt64(attempt))
+ realm.refresh()
+ if let game = realm.object(ofType: Game.self, forPrimaryKey: gameId), !game.isDeleted {
+ Log.debug("[RomM] game appeared on main Realm after attempt \(attempt) gameId=\(gameId)")
+ return game
+ }
+ }
+ return nil
+ }
+
+ @MainActor
func linkedGameCount(service: ImportService) -> Int {
linkedGameIds(serviceId: "\(service.id)").count
}
@@ -70,11 +143,15 @@ final class RommLibrary {
private func consumePendingLink(fileName: String) -> (romId: Int, serviceId: String)? {
var map = pendingMap()
- guard let entry = map[fileName],
- let romId = Self.intValue(entry["romId"]),
- let serviceId = entry["serviceId"] as? String else { return nil }
+ guard let entry = map[fileName] else { return nil }
+ guard let romId = Self.intValue(entry["romId"]),
+ let serviceId = entry["serviceId"] as? String else {
+ Log.debug("[RomM] pending parse failed file=\(fileName) entry=\(entry)")
+ return nil
+ }
map[fileName] = nil
UserDefaults.standard.set(map, forKey: Self.pendingLinksKey)
+ Log.debug("[RomM] pending consumed file=\(fileName) romId=\(romId) serviceId=\(serviceId)")
return (romId, serviceId)
}
@@ -85,30 +162,6 @@ final class RommLibrary {
return nil
}
- // MARK: - Import sidecar
-
- @MainActor
- private func applyAfterImportOnMain(gameId: String, fileName: String?) async {
- guard let game = Database.realm.object(ofType: Game.self, forPrimaryKey: gameId), !game.isDeleted else {
- if let fileName { discardPendingLink(fileName: fileName) }
- return
- }
- let pendingName = fileName ?? game.fileName
- guard let pending = consumePendingLink(fileName: pendingName) ?? consumePendingLink(fileName: game.fileName) else {
- return
- }
- persistLink(gameId: gameId, romId: pending.romId, serviceId: pending.serviceId)
- guard let client = makeClient(serviceId: pending.serviceId) else {
- Log.debug("[RomM] applyAfterImport: client unavailable for service \(pending.serviceId)")
- return
- }
- do {
- try await pullSidecar(gameId: gameId, client: client, romId: pending.romId)
- } catch {
- Log.debug("[RomM] applyAfterImport failed for \(game.fileName): \(error)")
- }
- }
-
// MARK: - Service transfer
private enum Direction {
@@ -117,17 +170,21 @@ final class RommLibrary {
private func transfer(service: ImportService, direction: Direction) async -> TransferSummary {
let snapshot = await MainActor.run { ServiceSnapshot(service: service) }
+ Log.debug("[RomM] \(direction == .pull ? "PULL" : "PUSH") start service=\(snapshot.id) host=\(snapshot.host) port=\(snapshot.port ?? -1)")
guard let client = snapshot.makeClient() else {
+ Log.debug("[RomM] \(direction == .pull ? "PULL" : "PUSH") aborted: client init failed")
return TransferSummary(succeeded: 0, failed: 1)
}
do {
- _ = try await client.platforms()
+ let platforms = try await client.platforms()
+ Log.debug("[RomM] connected platforms=\(platforms.count)")
} catch {
Log.debug("[RomM] cannot reach service \(snapshot.id): \(error)")
return TransferSummary(succeeded: 0, failed: 1)
}
let gameIds = await MainActor.run { linkedGameIds(serviceId: snapshot.id) }
+ Log.debug("[RomM] \(direction == .pull ? "PULL" : "PUSH") linked games=\(gameIds.count) ids=\(gameIds)")
var summary = TransferSummary()
for gameId in gameIds {
do {
@@ -143,6 +200,7 @@ final class RommLibrary {
Log.debug("[RomM] \(direction == .pull ? "pull" : "push") failed for \(gameId): \(error)")
}
}
+ Log.debug("[RomM] \(direction == .pull ? "PULL" : "PUSH") done succeeded=\(summary.succeeded) failed=\(summary.failed)")
return summary
}
@@ -154,9 +212,13 @@ final class RommLibrary {
.map { $0.id }
}
- @MainActor
private func persistLink(gameId: String, romId: Int, serviceId: String) {
- guard let game = Database.realm.object(ofType: Game.self, forPrimaryKey: gameId) else { return }
+ let realm = Database.realm
+ realm.refresh()
+ guard let game = realm.object(ofType: Game.self, forPrimaryKey: gameId) else {
+ Log.debug("[RomM] persistLink miss gameId=\(gameId) main=\(Thread.isMainThread)")
+ return
+ }
game.rommRomId = romId
game.rommServiceId = serviceId
}
@@ -180,16 +242,23 @@ final class RommLibrary {
}
return linked
}
+ Log.debug("[RomM] PULL sidecar gameId=\(gameId) romId=\(resolvedRomId)")
let rom = try await client.rom(id: resolvedRomId)
+ Log.debug("[RomM] PULL decoded rom id=\(rom.id) name=\(rom.name ?? "nil") fs=\(rom.fs_name) coverLarge=\(rom.path_cover_large ?? "nil") coverSmall=\(rom.path_cover_small ?? "nil") urlCover=\(rom.url_cover ?? "nil") preferred=\(rom.preferredCoverPath ?? "nil") hasManual=\(rom.has_manual ?? false) pathManual=\(rom.path_manual ?? "nil") urlManual=\(rom.url_manual ?? "nil") preferredManual=\(rom.preferredManualPath ?? "nil") ageRatings=\(rom.metadatum?.age_ratings ?? []) igdbAgeRatings=\(rom.igdb_metadata?.age_ratings?.map { "\($0.category ?? "?"):\($0.rating ?? "?")" } ?? []) summaryChars=\(rom.summary?.count ?? 0) genres=\(rom.metadatum?.genres ?? []) companies=\(rom.metadatum?.companies ?? []) lastPlayed=\(String(describing: rom.rom_user?.last_played))")
await applyCover(gameId: gameId, client: client, rom: rom)
await applyMetadata(gameId: gameId, rom: rom)
+ await pullManual(gameId: gameId, client: client, rom: rom)
await applyPlayTime(gameId: gameId, client: client, rom: rom)
await pullSave(gameId: gameId, client: client, romId: resolvedRomId)
await pullStates(gameId: gameId, client: client, romId: resolvedRomId)
+ Log.debug("[RomM] PULL sidecar finished gameId=\(gameId) romId=\(resolvedRomId)")
}
private func applyCover(gameId: String, client: RommClient, rom: RommRom) async {
- guard let data = await downloadCover(client: client, rom: rom), !data.isEmpty else { return }
+ guard let data = await downloadCover(client: client, rom: rom), !data.isEmpty else {
+ Log.debug("[RomM] PULL cover skipped gameId=\(gameId) romId=\(rom.id) no image data")
+ return
+ }
await MainActor.run {
var didWrite = false
Game.change { realm in
@@ -200,6 +269,7 @@ final class RommLibrary {
game.onlineCoverUrl = nil
didWrite = true
}
+ Log.debug("[RomM] PULL cover wrote gameId=\(gameId) bytes=\(data.count) didWrite=\(didWrite)")
if didWrite {
NotificationCenter.default.post(name: R.NotificationName.GameCoverChange, object: nil)
}
@@ -207,29 +277,171 @@ final class RommLibrary {
}
private func downloadCover(client: RommClient, rom: RommRom) async -> Data? {
- if let path = rom.preferredCoverPath,
- let request = client.assetDownloadRequest(downloadPath: path),
- let data = try? await client.data(for: request),
- !data.isEmpty {
- return data
- }
- guard let urlCover = rom.url_cover, !urlCover.isEmpty else { return nil }
- if urlCover.hasPrefix("http"), let url = URL(string: urlCover) {
- return try? await client.data(for: URLRequest(url: url))
+ Log.debug("[RomM] PULL cover try romId=\(rom.id) large=\(rom.path_cover_large ?? "nil") small=\(rom.path_cover_small ?? "nil") url=\(rom.url_cover ?? "nil")")
+ if let path = rom.preferredCoverPath {
+ if let data = await downloadCoverResource(client: client, source: path, label: "preferred") {
+ return data
+ }
}
- if let request = client.assetDownloadRequest(downloadPath: urlCover) {
- return try? await client.data(for: request)
+ if let urlCover = rom.url_cover, !urlCover.isEmpty, urlCover != rom.preferredCoverPath {
+ if let data = await downloadCoverResource(client: client, source: urlCover, label: "url_cover") {
+ return data
+ }
}
+ Log.debug("[RomM] PULL cover all sources failed romId=\(rom.id)")
return nil
}
+ private func downloadCoverResource(client: RommClient, source: String, label: String, ignoreCache: Bool = false) async -> Data? {
+ if source.hasPrefix("http://") || source.hasPrefix("https://") {
+ guard let url = URL(string: source) else {
+ Log.debug("[RomM] PULL \(label): invalid URL \(source)")
+ return nil
+ }
+ var request = URLRequest(url: url)
+ if ignoreCache {
+ request.cachePolicy = .reloadIgnoringLocalCacheData
+ }
+ return await fetchBytes(label: label, client: client, request: request)
+ }
+ let path = Self.resolvedAssetPath(source)
+ guard let request = client.assetDownloadRequest(downloadPath: path, ignoreCache: ignoreCache) else {
+ Log.debug("[RomM] PULL \(label): could not build request path=\(path)")
+ return nil
+ }
+ Log.debug("[RomM] PULL \(label): path=\(path) url=\(request.url?.absoluteString ?? "nil")")
+ return await fetchBytes(label: label, client: client, request: request)
+ }
+
+ private static func resolvedAssetPath(_ path: String) -> String {
+ if path.hasPrefix("http://") || path.hasPrefix("https://") || path.hasPrefix("/assets/") {
+ return path
+ }
+ let relative = path.hasPrefix("/") ? String(path.dropFirst()) : path
+ return "/assets/romm/resources/" + relative
+ }
+
+ private func pullManual(gameId: String, client: RommClient, rom: RommRom) async {
+ let remoteHasManual = rom.has_manual == true || !(rom.path_manual ?? "").isEmpty
+ Log.debug("[RomM] PULL manual try romId=\(rom.id) remoteHasManual=\(remoteHasManual) hasManual=\(rom.has_manual ?? false) url=\(rom.url_manual ?? "nil") path=\(rom.path_manual ?? "nil")")
+ if !remoteHasManual {
+ await MainActor.run { Self.removeLocalManual(gameId: gameId, reason: "remote removed") }
+ return
+ }
+ var data: Data?
+ if let path = rom.path_manual, !path.isEmpty {
+ data = await downloadCoverResource(client: client, source: path, label: "manual path", ignoreCache: true)
+ }
+ if data == nil, let url = rom.url_manual, !url.isEmpty, url != rom.path_manual {
+ data = await downloadCoverResource(client: client, source: url, label: "manual url", ignoreCache: true)
+ }
+ guard let data, Self.isPDF(data) else {
+ if let data {
+ Log.debug("[RomM] PULL manual skipped romId=\(rom.id) not a PDF (\(data.count) bytes)")
+ } else {
+ Log.debug("[RomM] PULL manual skipped romId=\(rom.id) download failed; keep local")
+ }
+ return
+ }
+ await MainActor.run {
+ Self.writeLocalManual(gameId: gameId, data: data)
+ }
+ }
+
+ /// Clears extras and the PDF when RomM no longer has a manual.
+ @MainActor
+ private static func removeLocalManual(gameId: String, reason: String) {
+ guard let game = Database.realm.object(ofType: Game.self, forPrimaryKey: gameId), !game.isDeleted else {
+ Log.debug("[RomM] PULL manual \(reason) skipped: game missing \(gameId)")
+ return
+ }
+ let directory = URL(fileURLWithPath: R.Path.GameplayManuals, isDirectory: true)
+ var removed: [String] = []
+ if let fileName = game.getExtraString(key: ExtraKey.manualFileName.rawValue), !fileName.isEmpty {
+ let url = directory.appendingPathComponent(fileName)
+ if FileManager.default.fileExists(atPath: url.path) {
+ try? FileManager.safeRemoveItem(at: url)
+ SyncManager.delete(localFilePath: url.path)
+ removed.append(url.path)
+ }
+ }
+ let canonical = directory.appendingPathComponent("\(game.id).pdf")
+ if FileManager.default.fileExists(atPath: canonical.path), !removed.contains(canonical.path) {
+ try? FileManager.safeRemoveItem(at: canonical)
+ SyncManager.delete(localFilePath: canonical.path)
+ removed.append(canonical.path)
+ }
+ game.updateExtra(key: ExtraKey.manualFileName.rawValue, value: nil)
+ game.updateExtra(key: ExtraKey.manualPage.rawValue, value: nil)
+ game.updateExtra(key: ExtraKey.manualScaleFactor.rawValue, value: nil)
+ Log.debug("[RomM] PULL manual \(reason) gameId=\(gameId) removed=\(removed) manualsPath=\(game.manualsPath ?? "nil")")
+ }
+
+ @MainActor
+ private static func writeLocalManual(gameId: String, data: Data) {
+ guard let game = Database.realm.object(ofType: Game.self, forPrimaryKey: gameId), !game.isDeleted else {
+ Log.debug("[RomM] PULL manual skipped: game missing \(gameId)")
+ return
+ }
+ let pdfName = "\(game.id).pdf"
+ let directory = URL(fileURLWithPath: R.Path.GameplayManuals, isDirectory: true)
+ let destination = directory.appendingPathComponent(pdfName)
+ do {
+ try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true)
+ if let previous = game.getExtraString(key: ExtraKey.manualFileName.rawValue),
+ previous != pdfName {
+ let oldURL = directory.appendingPathComponent(previous)
+ try? FileManager.safeRemoveItem(at: oldURL)
+ SyncManager.delete(localFilePath: oldURL.path)
+ }
+ if FileManager.default.fileExists(atPath: destination.path),
+ let existing = try? Data(contentsOf: destination),
+ existing == data {
+ if game.getExtraString(key: ExtraKey.manualFileName.rawValue) != pdfName {
+ game.updateExtra(key: ExtraKey.manualFileName.rawValue, value: pdfName)
+ }
+ Log.debug("[RomM] PULL manual unchanged \(data.count) bytes \(destination.path)")
+ return
+ }
+ try data.write(to: destination, options: .atomic)
+ game.updateExtra(key: ExtraKey.manualFileName.rawValue, value: pdfName)
+ game.updateExtra(key: ExtraKey.manualPage.rawValue, value: nil)
+ game.updateExtra(key: ExtraKey.manualScaleFactor.rawValue, value: nil)
+ SyncManager.upload(localFilePath: destination.path)
+ Log.debug("[RomM] PULL manual wrote \(data.count) bytes to \(destination.path) manualsPath=\(game.manualsPath ?? "nil")")
+ } catch {
+ Log.debug("[RomM] PULL manual write failed: \(error)")
+ }
+ }
+
+ private func fetchBytes(label: String, client: RommClient, request: URLRequest) async -> Data? {
+ do {
+ let data = try await client.data(for: request)
+ if data.isEmpty {
+ Log.debug("[RomM] \(label): empty body \(request.url?.absoluteString ?? "?")")
+ return nil
+ }
+ Log.debug("[RomM] \(label): got \(data.count) bytes")
+ return data
+ } catch {
+ Log.debug("[RomM] \(label): failed \(request.url?.absoluteString ?? "?") error=\(error)")
+ return nil
+ }
+ }
+
private func applyMetadata(gameId: String, rom: RommRom) async {
await MainActor.run {
- guard let game = Database.realm.object(ofType: Game.self, forPrimaryKey: gameId), !game.isDeleted else { return }
+ guard let game = Database.realm.object(ofType: Game.self, forPrimaryKey: gameId), !game.isDeleted else {
+ Log.debug("[RomM] PULL metadata skipped: game missing \(gameId)")
+ return
+ }
var metadata = GameMetadata.getGameMetadata(game: game) ?? GameMetadata()
if let name = rom.name, !name.isEmpty {
metadata.displayName = name
metadata.fullName = name
+ Game.change { _ in
+ game.aliasName = name
+ }
}
if let summary = rom.summary {
metadata.overview = summary
@@ -251,11 +463,16 @@ final class RommLibrary {
metadata.releaseYear = calendar.component(.year, from: date)
metadata.releaseMonth = calendar.component(.month, from: date)
}
- if let ratings = rom.metadatum?.age_ratings, let esrp = Self.esrp(from: ratings) {
+ if let esrp = Self.esrp(metadatumRatings: rom.metadatum?.age_ratings,
+ igdbRatings: rom.igdb_metadata?.age_ratings) {
metadata.ratingId = esrp.ratingId
+ Log.debug("[RomM] PULL ESRB mapped \(esrp.abbr) ratingId=\(esrp.ratingId) from metadatum=\(rom.metadatum?.age_ratings ?? []) igdb=\(rom.igdb_metadata?.age_ratings?.map { "\($0.category ?? "?"):\($0.rating ?? "?")" } ?? [])")
+ } else {
+ Log.debug("[RomM] PULL ESRB skipped metadatum=\(rom.metadatum?.age_ratings ?? []) igdb=\(rom.igdb_metadata?.age_ratings?.map { "\($0.category ?? "?"):\($0.rating ?? "?")" } ?? [])")
}
metadata.persist(to: game)
game.updateExtra(key: ExtraKey.hasQueryMetadata.rawValue, value: true)
+ Log.debug("[RomM] PULL metadata wrote aliasName=\(game.aliasName ?? "nil") displayName=\(metadata.displayName) genre=\(metadata.genre) franchise=\(metadata.franchise) developer=\(metadata.developer) publisher=\(metadata.publisher) release=\(metadata.releaseYear)-\(metadata.releaseMonth) ratingId=\(metadata.ratingId) overviewChars=\(metadata.overview.count)")
}
}
@@ -263,6 +480,7 @@ final class RommLibrary {
let sessions = (try? await client.playSessions(romID: rom.id)) ?? []
let remoteTotal = Double(sessions.reduce(0) { $0 + $1.duration_ms })
let lastPlayed = rom.rom_user?.last_played ?? sessions.compactMap(\.end_time).max()
+ Log.debug("[RomM] PULL play-time romId=\(rom.id) sessions=\(sessions.count) durationMs=\(Int(remoteTotal)) lastPlayed=\(String(describing: lastPlayed))")
await MainActor.run {
Game.change { realm in
guard let game = realm.object(ofType: Game.self, forPrimaryKey: gameId), !game.isDeleted else { return }
@@ -285,13 +503,18 @@ final class RommLibrary {
guard let game = Database.realm.object(ofType: Game.self, forPrimaryKey: gameId), !game.isDeleted else { return nil }
return (game.gameSaveUrl, game.gameType == ._3ds || game.gameType == .psp)
}
- guard let context, !context.skip else { return }
- let remote = (try? await client.saves(romID: romId))?
+ guard let context, !context.skip else {
+ Log.debug("[RomM] PULL save skipped gameId=\(gameId) romId=\(romId) reason=\(context == nil ? "missing game" : "3DS/PSP")")
+ return
+ }
+ let remotes = (try? await client.saves(romID: romId)) ?? []
+ let remote = remotes
.sorted(by: { ($0.updated_at ?? .distantPast) > ($1.updated_at ?? .distantPast) })
.first
+ Log.debug("[RomM] PULL saves romId=\(romId) count=\(remotes.count) chosen=\(remote.map { "id=\($0.id) file=\($0.file_name) bytes=\($0.file_size_bytes ?? 0)" } ?? "none")")
guard let remote,
let request = client.saveContentRequest(saveID: remote.id),
- let data = try? await client.data(for: request) else { return }
+ let data = await fetchBytes(label: "save \(remote.file_name)", client: client, request: request) else { return }
let directory = context.url.deletingLastPathComponent()
try? FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true)
do {
@@ -300,16 +523,21 @@ final class RommLibrary {
try? FileManager.default.setAttributes([.modificationDate: date], ofItemAtPath: context.url.path)
}
SyncManager.upload(localFilePath: context.url.path)
+ Log.debug("[RomM] PULL save wrote \(data.count) bytes to \(context.url.lastPathComponent)")
} catch {
Log.debug("[RomM] write save failed: \(error)")
}
}
private func pullStates(gameId: String, client: RommClient, romId: Int) async {
- guard let remoteStates = try? await client.states(romID: romId) else { return }
+ guard let remoteStates = try? await client.states(romID: romId) else {
+ Log.debug("[RomM] PULL states failed to list romId=\(romId)")
+ return
+ }
+ Log.debug("[RomM] PULL states romId=\(romId) count=\(remoteStates.count) files=\(remoteStates.map(\.file_name))")
for remote in remoteStates {
guard let request = client.assetDownloadRequest(downloadPath: remote.download_path),
- let data = try? await client.data(for: request) else { continue }
+ let data = await fetchBytes(label: "state \(remote.file_name)", client: client, request: request) else { continue }
var coverData: Data?
if let screenshot = remote.screenshot,
let coverRequest = client.assetDownloadRequest(downloadPath: screenshot.download_path) {
@@ -320,6 +548,7 @@ final class RommLibrary {
date: remote.updated_at ?? Date(),
data: data,
cover: coverData)
+ Log.debug("[RomM] PULL state upsert file=\(remote.file_name) bytes=\(data.count) coverBytes=\(coverData?.count ?? 0)")
}
}
@@ -372,10 +601,13 @@ final class RommLibrary {
}
return PushSnapshot(game: game, romId: romId)
}
+ Log.debug("[RomM] PUSH sidecar gameId=\(snapshot.gameId) romId=\(snapshot.romId) displayName=\(snapshot.displayName) overviewChars=\(snapshot.overview?.count ?? 0) coverBytes=\(snapshot.coverData?.count ?? 0) manualBytes=\(snapshot.manualData?.count ?? 0) save=\(snapshot.saveURL.lastPathComponent) battery=\(snapshot.supportsBatterySave) playMs=\(Int(snapshot.totalPlayDuration)) pushedMs=\(Int(snapshot.playDurationPushed)) lastPlayed=\(String(describing: snapshot.latestPlayDate)) states=\(snapshot.states.map { "\($0.name):\($0.data?.count ?? 0)" })")
try await pushCoverAndMetadata(client: client, snapshot: snapshot)
+ await pushManual(client: client, snapshot: snapshot)
try await pushPlayTime(client: client, snapshot: snapshot)
await pushSave(client: client, snapshot: snapshot)
await pushStates(client: client, snapshot: snapshot)
+ Log.debug("[RomM] PUSH sidecar finished gameId=\(snapshot.gameId) romId=\(snapshot.romId)")
}
private func pushCoverAndMetadata(client: RommClient, snapshot: PushSnapshot) async throws {
@@ -383,14 +615,37 @@ final class RommLibrary {
if let cover = snapshot.coverData, !cover.isEmpty {
artwork = (fileName: "cover.jpg", data: cover)
}
+ Log.debug("[RomM] PUSH rom romId=\(snapshot.romId) name=\(snapshot.displayName) summaryChars=\(snapshot.overview?.count ?? 0) artwork=\(artwork.map { "\($0.fileName) \($0.data.count) bytes" } ?? "nil")")
try await client.updateRom(romID: snapshot.romId,
name: snapshot.displayName,
summary: snapshot.overview,
artwork: artwork)
}
+ private func pushManual(client: RommClient, snapshot: PushSnapshot) async {
+ if let data = snapshot.manualData, Self.isPDF(data) {
+ let fileName = snapshot.manualFileName ?? "manual.pdf"
+ Log.debug("[RomM] PUSH manual romId=\(snapshot.romId) file=\(fileName) bytes=\(data.count)")
+ do {
+ try await client.uploadManual(romID: snapshot.romId, fileName: fileName, fileData: data)
+ Log.debug("[RomM] PUSH manual ok romId=\(snapshot.romId)")
+ } catch {
+ Log.debug("[RomM] PUSH manual failed romId=\(snapshot.romId): \(error)")
+ }
+ return
+ }
+ Log.debug("[RomM] PUSH manual none locally romId=\(snapshot.romId); delete remote")
+ do {
+ try await client.deleteManual(romID: snapshot.romId)
+ Log.debug("[RomM] PUSH manual deleted remote romId=\(snapshot.romId)")
+ } catch {
+ Log.debug("[RomM] PUSH manual delete failed romId=\(snapshot.romId): \(error)")
+ }
+ }
+
private func pushPlayTime(client: RommClient, snapshot: PushSnapshot) async throws {
let delta = Int(snapshot.totalPlayDuration - snapshot.playDurationPushed)
+ Log.debug("[RomM] PUSH play-time romId=\(snapshot.romId) localMs=\(Int(snapshot.totalPlayDuration)) watermarkMs=\(Int(snapshot.playDurationPushed)) deltaMs=\(delta) lastPlayed=\(String(describing: snapshot.latestPlayDate))")
if delta > 0 {
try await client.ingestPlaySession(romID: snapshot.romId, durationMs: delta)
}
@@ -406,12 +661,17 @@ final class RommLibrary {
private func pushSave(client: RommClient, snapshot: PushSnapshot) async {
guard snapshot.supportsBatterySave,
FileManager.default.fileExists(atPath: snapshot.saveURL.path),
- let data = try? Data(contentsOf: snapshot.saveURL) else { return }
+ let data = try? Data(contentsOf: snapshot.saveURL) else {
+ Log.debug("[RomM] PUSH save skipped romId=\(snapshot.romId) battery=\(snapshot.supportsBatterySave) exists=\(FileManager.default.fileExists(atPath: snapshot.saveURL.path))")
+ return
+ }
+ Log.debug("[RomM] PUSH save romId=\(snapshot.romId) file=\(snapshot.saveURL.lastPathComponent) bytes=\(data.count)")
do {
try await client.uploadSave(romID: snapshot.romId,
emulator: nil,
fileName: snapshot.saveURL.lastPathComponent,
fileData: data)
+ Log.debug("[RomM] PUSH save ok romId=\(snapshot.romId)")
} catch {
Log.debug("[RomM] upload save failed: \(error)")
}
@@ -427,12 +687,14 @@ final class RommLibrary {
let remoteName = state.name.hasSuffix(Self.stateFileSuffix)
? state.name
: "\(state.name)\(Self.stateFileSuffix)"
+ Log.debug("[RomM] PUSH state romId=\(snapshot.romId) file=\(remoteName) bytes=\(data.count) screenshot=\(screenshot?.fileName ?? "nil")")
do {
_ = try await client.uploadState(romID: snapshot.romId,
emulator: nil,
fileName: remoteName,
fileData: data,
screenshot: screenshot)
+ Log.debug("[RomM] PUSH state ok \(remoteName)")
} catch {
Log.debug("[RomM] upload state failed (\(state.name)): \(error)")
}
@@ -441,17 +703,83 @@ final class RommLibrary {
// MARK: - Mapping
- private static func esrp(from ratings: [String]) -> ESRP? {
- let joined = ratings.joined(separator: " ").lowercased()
- if joined.contains("adults only") || joined.contains("esrb: ao") || joined.contains("esrb ao") { return .AO }
- if joined.contains("everyone 10") || joined.contains("e10") { return .E10 }
- if joined.contains("early childhood") || joined.contains("esrb: ec") { return .EC }
- if joined.contains("kids to adults") || joined.contains("k-a") || joined.contains("k–a") { return .K_A }
- if joined.contains("rating pending") && joined.contains("17") { return .RP17 }
- if joined.contains("rating pending") || joined.contains("esrb: rp") { return .RP }
- if joined.contains("mature") || joined.contains("esrb: m") { return .M }
- if joined.contains("teen") || joined.contains("esrb: t") { return .T }
- if joined.contains("everyone") || joined.contains("esrb: e") { return .E }
+ private static func isPDF(_ data: Data) -> Bool {
+ if let range = data.range(of: Data("%PDF".utf8)), range.lowerBound < 8 {
+ return true
+ }
+ return false
+ }
+
+ private static func esrp(metadatumRatings: [String]?, igdbRatings: [RommAgeRating]?) -> ESRP? {
+ if let igdbRatings {
+ let esrb = igdbRatings.filter { isESRBCategory($0.category) }
+ for item in esrb {
+ if let mapped = esrp(rating: item.rating, category: item.category) { return mapped }
+ }
+ for item in igdbRatings {
+ if let mapped = esrpFromToken(item.rating ?? "") { return mapped }
+ }
+ }
+ guard let metadatumRatings else { return nil }
+ for raw in metadatumRatings where raw.localizedCaseInsensitiveContains("esrb") {
+ if let mapped = esrpFromToken(raw) { return mapped }
+ }
+ for raw in metadatumRatings {
+ if let mapped = esrpFromToken(raw) { return mapped }
+ }
+ return nil
+ }
+
+ private static func isESRBCategory(_ raw: String?) -> Bool {
+ guard let raw, !raw.isEmpty else { return false }
+ let folded = raw.lowercased()
+ return folded.contains("esrb") || folded == "1"
+ }
+
+ private static func esrp(rating: String?, category: String?) -> ESRP? {
+ if let mapped = esrpFromToken(rating ?? "") { return mapped }
+ guard isESRBCategory(category), let id = Int(rating ?? "") else { return nil }
+ switch id {
+ case 1: return .RP
+ case 2: return .EC
+ case 3: return .E
+ case 4: return .E10
+ case 5: return .T
+ case 6: return .M
+ case 7: return .AO
+ default: return nil
+ }
+ }
+
+ /// RomM stores IGDB letters (`E`, `T`, `E10+`) in `metadatum.age_ratings`, not "Everyone".
+ private static func esrpFromToken(_ raw: String) -> ESRP? {
+ let folded = raw.lowercased()
+ .replacingOccurrences(of: "esrb", with: " ")
+ .replacingOccurrences(of: ":", with: " ")
+ .trimmingCharacters(in: .whitespacesAndNewlines)
+ let compact = folded
+ .replacingOccurrences(of: "+", with: "")
+ .replacingOccurrences(of: "-", with: "")
+ .replacingOccurrences(of: "–", with: "")
+ .replacingOccurrences(of: " ", with: "")
+ switch compact {
+ case "ao", "adultsonly": return .AO
+ case "e10", "everyone10": return .E10
+ case "ec", "earlychildhood": return .EC
+ case "ka", "kidstoadults": return .K_A
+ case "rp17", "ratingpending17": return .RP17
+ case "rp", "ratingpending": return .RP
+ case "m", "mature": return .M
+ case "t", "teen": return .T
+ case "e", "everyone": return .E
+ default: break
+ }
+ if folded.contains("adults only") { return .AO }
+ if folded.contains("everyone 10") { return .E10 }
+ if folded.contains("early childhood") { return .EC }
+ if folded.contains("kids to adults") { return .K_A }
+ if folded.contains("rating pending") && folded.contains("17") { return .RP17 }
+ if folded.contains("rating pending") { return .RP }
return nil
}
@@ -508,6 +836,8 @@ final class RommLibrary {
let displayName: String
let overview: String?
let coverData: Data?
+ let manualData: Data?
+ let manualFileName: String?
let saveURL: URL
let supportsBatterySave: Bool
let totalPlayDuration: Double
@@ -521,6 +851,16 @@ final class RommLibrary {
displayName = game.displayName
overview = GameMetadata.getGameMetadata(game: game)?.overview
coverData = game.gameCover?.storedData()
+ if let path = game.manualsPath,
+ FileManager.default.fileExists(atPath: path),
+ let data = try? Data(contentsOf: URL(fileURLWithPath: path)),
+ RommLibrary.isPDF(data) {
+ manualData = data
+ manualFileName = URL(fileURLWithPath: path).lastPathComponent
+ } else {
+ manualData = nil
+ manualFileName = nil
+ }
saveURL = game.gameSaveUrl
supportsBatterySave = game.gameType != ._3ds && game.gameType != .psp
totalPlayDuration = game.totalPlayDuration