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

Tweaking RetroAchievements' Challenges and Progress

Daiunoe59da11b8b87
diff --git a/Cores/Libretro/ui/drivers/CheevosBridge.m b/Cores/Libretro/ui/drivers/CheevosBridge.m
index 12f0a995..7da57b22 100644
--- a/Cores/Libretro/ui/drivers/CheevosBridge.m
+++ b/Cores/Libretro/ui/drivers/CheevosBridge.m
@@ -44,9 +44,6 @@
@implementation CheevosCompletion
@end
-@implementation CheevosChallenge
-@end
-
@implementation CheevosLeaderboardTracker
@end
diff --git a/Cores/Libretro/ui/drivers/LibretroCore.m b/Cores/Libretro/ui/drivers/LibretroCore.m
index 01cc832e..c64627fb 100644
--- a/Cores/Libretro/ui/drivers/LibretroCore.m
+++ b/Cores/Libretro/ui/drivers/LibretroCore.m
@@ -337,17 +337,28 @@ static void cheevosDidTrigger(uint32_t type, void* object1, void* object2) {
//挑战提示
if (object1) {
rc_client_achievement_t *a = (rc_client_achievement_t *)object1;
- if ([[NSString stringWithUTF8String:a->badge_name] isEqualToString:@"00000"]) {
+ CheevosAchievement *achievement = [LibretroCore convertAchievement:a];
+ if (!achievement) {
return;
}
- CheevosChallenge* obj = [CheevosChallenge new];
- obj._description = a->description ? [NSString stringWithUTF8String:a->description] : nil;
- char url1[256];
- if (rc_client_achievement_get_image_url(a, RC_CLIENT_ACHIEVEMENT_STATE_UNLOCKED, url1, sizeof(url1)) == RC_OK) {
- obj.unlockedBadgeUrl = [NSString stringWithCString:url1 encoding:NSUTF8StringEncoding];
+ achievement.isChallengeAchievement = YES;
+ achievement.show = YES;
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [[NSNotificationCenter defaultCenter] postNotificationName:RetroAchievementsNotification object:achievement];
+ });
+ }
+ } else if (type == RC_CLIENT_EVENT_ACHIEVEMENT_CHALLENGE_INDICATOR_HIDE) {
+ //挑战隐藏
+ if (object1) {
+ rc_client_achievement_t *a = (rc_client_achievement_t *)object1;
+ CheevosAchievement *achievement = [LibretroCore convertAchievement:a];
+ if (!achievement) {
+ return;
}
+ achievement.isChallengeAchievement = YES;
+ achievement.show = NO;
dispatch_async(dispatch_get_main_queue(), ^{
- [[NSNotificationCenter defaultCenter] postNotificationName:RetroAchievementsNotification object:obj];
+ [[NSNotificationCenter defaultCenter] postNotificationName:RetroAchievementsNotification object:achievement];
});
}
} else if (type == RC_CLIENT_EVENT_LEADERBOARD_TRACKER_SHOW) {
diff --git a/Cores/Libretro/ui/drivers/cocoa/CheevosBridge.h b/Cores/Libretro/ui/drivers/cocoa/CheevosBridge.h
index 8ff21576..bd39872c 100644
--- a/Cores/Libretro/ui/drivers/cocoa/CheevosBridge.h
+++ b/Cores/Libretro/ui/drivers/cocoa/CheevosBridge.h
@@ -45,6 +45,7 @@
@property (nonatomic, assign) BOOL isProgression;
@property (nonatomic, assign) BOOL isProgressAchievement;
+@property (nonatomic, assign) BOOL isChallengeAchievement;
@property (nonatomic, assign) BOOL show;
@end
@@ -76,12 +77,6 @@
@end
@interface CheevosCompletion : NSObject
-
-@end
-
-@interface CheevosChallenge : NSObject
-@property (nonatomic, copy) NSString *_Nullable _description;
-@property (nonatomic, copy) NSString *_Nullable unlockedBadgeUrl;
@end
@interface CheevosLeaderboardTracker : NSObject
diff --git a/ManicEmu/ManicEmu.xcodeproj/project.pbxproj b/ManicEmu/ManicEmu.xcodeproj/project.pbxproj
index d395aacb..959eed38 100644
--- a/ManicEmu/ManicEmu.xcodeproj/project.pbxproj
+++ b/ManicEmu/ManicEmu.xcodeproj/project.pbxproj
@@ -601,6 +601,7 @@
579C114D2D1D0E0A00CFD1F5 /* UIWindowExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 579C114C2D1D0E0A00CFD1F5 /* UIWindowExtensions.swift */; };
57A480CC2E733B83001D4598 /* flycast-jitless.libretro.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 57A480CB2E733B77001D4598 /* flycast-jitless.libretro.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
57A480CD2E733B83001D4598 /* flycast-jitless-wince.libretro.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 57A480C42E733236001D4598 /* flycast-jitless-wince.libretro.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
+ 57A480E72E74030E001D4598 /* CheevosChallengeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57A480E62E740301001D4598 /* CheevosChallengeView.swift */; };
57AD35EA2D7DEB9D0092FD03 /* WebViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57AD35E92D7DEB900092FD03 /* WebViewController.swift */; };
57AD35EC2D7DEF360092FD03 /* SheerExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57AD35EB2D7DEF2E0092FD03 /* SheerExtensions.swift */; };
57B6EBDB2D758819002E619C /* GameSaveMatchGameView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57B6EBDA2D7587FE002E619C /* GameSaveMatchGameView.swift */; };
@@ -1617,6 +1618,7 @@
579C114C2D1D0E0A00CFD1F5 /* UIWindowExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIWindowExtensions.swift; sourceTree = "<group>"; };
57A480C42E733236001D4598 /* flycast-jitless-wince.libretro.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "flycast-jitless-wince.libretro.framework"; path = "../Cores/flycast-jitless-wince.libretro.framework"; sourceTree = SOURCE_ROOT; };
57A480CB2E733B77001D4598 /* flycast-jitless.libretro.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "flycast-jitless.libretro.framework"; path = "../Cores/flycast-jitless.libretro.framework"; sourceTree = SOURCE_ROOT; };
+ 57A480E62E740301001D4598 /* CheevosChallengeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheevosChallengeView.swift; sourceTree = "<group>"; };
57AD35E92D7DEB900092FD03 /* WebViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebViewController.swift; sourceTree = "<group>"; };
57AD35EB2D7DEF2E0092FD03 /* SheerExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SheerExtensions.swift; sourceTree = "<group>"; };
57ADFED92D94F52500502E5C /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/InfoPlist.strings"; sourceTree = "<group>"; };
@@ -3700,6 +3702,7 @@
children = (
57DFBE8B2E71BC4C008C2161 /* CheevosPopupView.swift */,
57D029182E6C9C4000BF1F9D /* CheevosProgressView.swift */,
+ 57A480E62E740301001D4598 /* CheevosChallengeView.swift */,
5771C2092E6569B60062EDE0 /* LeaderboardView.swift */,
5720CACB2DB5558B0090C0F6 /* ThreeDSKeyboardView.swift */,
579076E22D8A98FC00ED90FB /* FunctionButtonContainerView.swift */,
@@ -5065,6 +5068,7 @@
57E962FA2D6AB4790022914C /* PlayHistoryFavouriteCollectionCell.swift in Sources */,
576F0E152D88209000D2A1BA /* SettingsMembershipGiftView.swift in Sources */,
5706B0492DFBF83C0066122E /* 32X.swift in Sources */,
+ 57A480E72E74030E001D4598 /* CheevosChallengeView.swift in Sources */,
5720E7AA2E541F2000EC0DA5 /* RadialGradientView.swift in Sources */,
57B6ECC22D796B97002E619C /* CheatCodeCollectionViewCell.swift in Sources */,
A52C1D89257F96C90029B15B /* UIViewControllerExtensions.swift in Sources */,
diff --git a/ManicEmu/ManicEmu/Resources/ar.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/ar.lproj/Localizable.strings
index 3206944e..7697ca09 100644
--- a/ManicEmu/ManicEmu/Resources/ar.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/ar.lproj/Localizable.strings
@@ -649,3 +649,5 @@
"Progress" = "التقدم";
"DCGameNoSupportGameSave" = "Dreamcast لا يدعم استيراد/تصدير الحفظ. استخدم VMU Explorer لتحرير ملفات الذاكرة الموجودة في مجلد Manic EMU-Flycast-dc.";
+
+"Challenge" = "التحدي";
\ No newline at end of file
diff --git a/ManicEmu/ManicEmu/Resources/ca.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/ca.lproj/Localizable.strings
index 508c2aa8..28f14bc9 100644
--- a/ManicEmu/ManicEmu/Resources/ca.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/ca.lproj/Localizable.strings
@@ -674,3 +674,5 @@ Prem el botó del control...";
"Progress" = "Progrés";
"DCGameNoSupportGameSave" = "Dreamcast no admet importar/exportar partides. Utilitza VMU Explorer per editar fitxers de memòria a la carpeta Manic EMU-Flycast-dc.";
+
+"Challenge" = "Repte";
\ No newline at end of file
diff --git a/ManicEmu/ManicEmu/Resources/cs.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/cs.lproj/Localizable.strings
index eca245cd..bd0f8460 100644
--- a/ManicEmu/ManicEmu/Resources/cs.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/cs.lproj/Localizable.strings
@@ -670,3 +670,5 @@ Stiskněte tlačítko ovladače...";
"Progress" = "Pokrok";
"DCGameNoSupportGameSave" = "Dreamcast nepodporuje import/export uložených her. K úpravě paměťových souborů ve složce Manic EMU-Flycast-dc použijte VMU Explorer.";
+
+"Challenge" = "Výzva";
\ No newline at end of file
diff --git a/ManicEmu/ManicEmu/Resources/da.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/da.lproj/Localizable.strings
index 195bd941..565bcf05 100644
--- a/ManicEmu/ManicEmu/Resources/da.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/da.lproj/Localizable.strings
@@ -672,3 +672,5 @@ Tryk på controller-knappen...";
"Progress" = "Fremskridt";
"DCGameNoSupportGameSave" = "Dreamcast understøtter ikke import/export af gemte spil. Brug VMU Explorer til at redigere hukommelsesfiler i mappen Manic EMU-Flycast-dc.";
+
+"Challenge" = "Udfordring";
\ No newline at end of file
diff --git a/ManicEmu/ManicEmu/Resources/de.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/de.lproj/Localizable.strings
index f05020bf..79c9dc92 100644
--- a/ManicEmu/ManicEmu/Resources/de.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/de.lproj/Localizable.strings
@@ -676,3 +676,5 @@ Drücke die Controller-Taste...";
"Progress" = "Fortschritt";
"DCGameNoSupportGameSave" = "Dreamcast unterstützt kein Importieren/Exportieren von Speicherständen. Verwenden Sie VMU Explorer, um Speicherdateien im Ordner Manic EMU-Flycast-dc zu bearbeiten.";
+
+"Challenge" = "Herausforderung";
\ No newline at end of file
diff --git a/ManicEmu/ManicEmu/Resources/el.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/el.lproj/Localizable.strings
index 99c749a8..d526bc87 100644
--- a/ManicEmu/ManicEmu/Resources/el.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/el.lproj/Localizable.strings
@@ -675,3 +675,5 @@
"Progress" = "Πρόοδος";
"DCGameNoSupportGameSave" = "Το Dreamcast δεν υποστηρίζει εισαγωγή/εξαγωγή αποθηκεύσεων. Χρησιμοποιήστε το VMU Explorer για επεξεργασία αρχείων μνήμης στον φάκελο Manic EMU-Flycast-dc.";
+
+"Challenge" = "Πρόκληση";
\ No newline at end of file
diff --git a/ManicEmu/ManicEmu/Resources/en.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/en.lproj/Localizable.strings
index 86899604..21bb813b 100644
--- a/ManicEmu/ManicEmu/Resources/en.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/en.lproj/Localizable.strings
@@ -685,3 +685,5 @@ Press the controller button to complete mapping...";
"Progress" = "Progress";
"DCGameNoSupportGameSave" = "Dreamcast doesn’t support save import/export. Use VMU Explorer to edit memory files located in the Manic EMU-Flycast-dc folder.";
+
+"Challenge" = "Challenge";
diff --git a/ManicEmu/ManicEmu/Resources/es-419.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/es-419.lproj/Localizable.strings
index ba51441b..5d9d987d 100644
--- a/ManicEmu/ManicEmu/Resources/es-419.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/es-419.lproj/Localizable.strings
@@ -674,3 +674,5 @@ Presiona el botón del control para continuar...";
"Progress" = "Progreso";
"DCGameNoSupportGameSave" = "Dreamcast no soporta importar/exportar partidas. Usa VMU Explorer para editar archivos de memoria en la carpeta Manic EMU-Flycast-dc.";
+
+"Challenge" = "Reto";
\ No newline at end of file
diff --git a/ManicEmu/ManicEmu/Resources/es.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/es.lproj/Localizable.strings
index 65040035..d7ca9a39 100644
--- a/ManicEmu/ManicEmu/Resources/es.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/es.lproj/Localizable.strings
@@ -649,3 +649,5 @@ Presiona el botón del control para completar...";
"Progress" = "Progreso";
"DCGameNoSupportGameSave" = "Dreamcast no admite importación/exportación de partidas. Use VMU Explorer para editar archivos de memoria en la carpeta Manic EMU-Flycast-dc.";
+
+"Challenge" = "Desafío";
\ No newline at end of file
diff --git a/ManicEmu/ManicEmu/Resources/fi.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/fi.lproj/Localizable.strings
index 1d09c406..26292fbd 100644
--- a/ManicEmu/ManicEmu/Resources/fi.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/fi.lproj/Localizable.strings
@@ -675,3 +675,5 @@ Paina ohjaimen nappia...";
"Progress" = "Edistyminen";
"DCGameNoSupportGameSave" = "Dreamcast ei tue tallennusten tuontia/vientiä. Muokkaa muistitiedostoja Manic EMU-Flycast-dc -kansiossa käyttämällä VMU Explorer -ohjelmaa.";
+
+"Challenge" = "Haaste";
\ No newline at end of file
diff --git a/ManicEmu/ManicEmu/Resources/fr-CA.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/fr-CA.lproj/Localizable.strings
index 3bb3a5e3..66b0fada 100644
--- a/ManicEmu/ManicEmu/Resources/fr-CA.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/fr-CA.lproj/Localizable.strings
@@ -676,3 +676,5 @@ Appuyez sur le bouton du contrôleur...";
"Progress" = "Progression";
"DCGameNoSupportGameSave" = "Dreamcast ne supporte pas l'importation/exportation de sauvegardes. Utilisez VMU Explorer pour modifier les fichiers mémoire dans le dossier Manic EMU-Flycast-dc.";
+
+"Challenge" = "Défi";
\ No newline at end of file
diff --git a/ManicEmu/ManicEmu/Resources/fr.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/fr.lproj/Localizable.strings
index 5718d118..ea26ec60 100644
--- a/ManicEmu/ManicEmu/Resources/fr.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/fr.lproj/Localizable.strings
@@ -676,3 +676,5 @@ Appuyez sur le bouton du contrôleur...";
"Progress" = "Progression";
"DCGameNoSupportGameSave" = "Dreamcast ne prend pas en charge l'import/export de sauvegardes. Utilisez VMU Explorer pour modifier les fichiers mémoire dans le dossier Manic EMU-Flycast-dc.";
+
+"Challenge" = "Défi";
\ No newline at end of file
diff --git a/ManicEmu/ManicEmu/Resources/he.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/he.lproj/Localizable.strings
index 87d96969..0030e09d 100644
--- a/ManicEmu/ManicEmu/Resources/he.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/he.lproj/Localizable.strings
@@ -675,3 +675,5 @@
"Progress" = "התקדמות";
"DCGameNoSupportGameSave" = "Dreamcast אינו תומך ביבוא/ייצוא שמירות. השתמש ב-VMU Explorer כדי לערוך קבצי זיכרון בתיקייה Manic EMU-Flycast-dc.";
+
+"Challenge" = "אתגר";
\ No newline at end of file
diff --git a/ManicEmu/ManicEmu/Resources/hi.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/hi.lproj/Localizable.strings
index 33cf0069..9bb25e51 100644
--- a/ManicEmu/ManicEmu/Resources/hi.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/hi.lproj/Localizable.strings
@@ -676,3 +676,5 @@
"Progress" = "प्रगति";
"DCGameNoSupportGameSave" = "Dreamcast सेव आयात/निर्यात का समर्थन नहीं करता है। Manic EMU-Flycast-dc फ़ोल्डर में स्थित मेमोरी फ़ाइलों को संपादित करने के लिए VMU Explorer का उपयोग करें।";
+
+"Challenge" = "चुनौती";
\ No newline at end of file
diff --git a/ManicEmu/ManicEmu/Resources/hr.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/hr.lproj/Localizable.strings
index 37d0e9f6..bc766624 100644
--- a/ManicEmu/ManicEmu/Resources/hr.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/hr.lproj/Localizable.strings
@@ -672,3 +672,5 @@ Ako naiđete na nestabilnost u 3DS-u, pogledajte «Često Postavljana Pitanja»
"Progress" = "Napredak";
"DCGameNoSupportGameSave" = "Dreamcast ne podržava uvoz/izvoz spremišta. Upotrijebite VMU Explorer za uređivanje memorijskih datoteka u mapi Manic EMU-Flycast-dc.";
+
+"Challenge" = "Izazov";
\ No newline at end of file
diff --git a/ManicEmu/ManicEmu/Resources/hu.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/hu.lproj/Localizable.strings
index 6f05665f..943fee69 100644
--- a/ManicEmu/ManicEmu/Resources/hu.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/hu.lproj/Localizable.strings
@@ -674,3 +674,5 @@ Nyomja meg a kontroller gombját...";
"Progress" = "Előrehaladás";
"DCGameNoSupportGameSave" = "A Dreamcast nem támogatja a mentések importálását/exportálását. Használd a VMU Explorer-t a Manic EMU-Flycast-dc mappában található memóriafájlok szerkesztéséhez.";
+
+"Challenge" = "Kihívás";
\ No newline at end of file
diff --git a/ManicEmu/ManicEmu/Resources/id.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/id.lproj/Localizable.strings
index e74e9672..dce92706 100644
--- a/ManicEmu/ManicEmu/Resources/id.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/id.lproj/Localizable.strings
@@ -667,3 +667,5 @@ Tekan tombol kontroler...";
"Progress" = "Progress";
"DCGameNoSupportGameSave" = "Dreamcast tidak mendukung impor/ekspor simpanan. Gunakan VMU Explorer untuk mengedit file memori di folder Manic EMU-Flycast-dc.";
+
+"Challenge" = "Tantangan";
\ No newline at end of file
diff --git a/ManicEmu/ManicEmu/Resources/it.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/it.lproj/Localizable.strings
index bda4d7ee..0a35229a 100644
--- a/ManicEmu/ManicEmu/Resources/it.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/it.lproj/Localizable.strings
@@ -678,3 +678,5 @@ Premi il pulsante del controller...";
"Progress" = "Progresso";
"DCGameNoSupportGameSave" = "Dreamcast non supporta l'importazione/esportazione dei salvataggi. Usa VMU Explorer per modificare i file di memoria nella cartella Manic EMU-Flycast-dc.";
+
+"Challenge" = "Sfida";
\ No newline at end of file
diff --git a/ManicEmu/ManicEmu/Resources/ja.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/ja.lproj/Localizable.strings
index 5063ee0b..e1a58e50 100644
--- a/ManicEmu/ManicEmu/Resources/ja.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/ja.lproj/Localizable.strings
@@ -671,3 +671,5 @@
"Progress" = "進捗";
"DCGameNoSupportGameSave" = "ドリームキャストはセーブデータのインポート/エクスポートに対応していません。VMU Explorer を使用して、Manic EMU-Flycast-dc フォルダ内のメモリファイルを編集してください。";
+
+"Challenge" = "チャレンジ";
\ No newline at end of file
diff --git a/ManicEmu/ManicEmu/Resources/ko.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/ko.lproj/Localizable.strings
index af0aa235..89d90d3f 100644
--- a/ManicEmu/ManicEmu/Resources/ko.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/ko.lproj/Localizable.strings
@@ -678,3 +678,5 @@
"Progress" = "진행률";
"DCGameNoSupportGameSave" = "드림캐스트는 저장파일 가져오기/내보내기를 지원하지 않습니다. VMU Explorer를 사용하여 Manic EMU-Flycast-dc 폴더에 있는 메모리 파일을 편집하세요.";
+
+"Challenge" = "도전";
\ No newline at end of file
diff --git a/ManicEmu/ManicEmu/Resources/ms.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/ms.lproj/Localizable.strings
index 5b3727da..526c5679 100644
--- a/ManicEmu/ManicEmu/Resources/ms.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/ms.lproj/Localizable.strings
@@ -648,3 +648,5 @@ Tekan butang pengawal...";
"Progress" = "Kemajuan";
"DCGameNoSupportGameSave" = "Dreamcast tidak menyokong import/eksport simpanan. Gunakan VMU Explorer untuk mengedit fail memori dalam folder Manic EMU-Flycast-dc.";
+
+"Challenge" = "Cabaran";
\ No newline at end of file
diff --git a/ManicEmu/ManicEmu/Resources/nb.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/nb.lproj/Localizable.strings
index 6cd9cfe3..3a88a4d2 100644
--- a/ManicEmu/ManicEmu/Resources/nb.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/nb.lproj/Localizable.strings
@@ -666,3 +666,5 @@ Trykk på kontrollerknappen...";
"Progress" = "Fremdrift";
"DCGameNoSupportGameSave" = "Dreamcast støtter ikke import/eksport av lagringer. Bruk VMU Explorer for å redigere minnefiler i mappen Manic EMU-Flycast-dc.";
+
+"Challenge" = "Utfordring";
\ No newline at end of file
diff --git a/ManicEmu/ManicEmu/Resources/nl.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/nl.lproj/Localizable.strings
index a066a987..905b5279 100644
--- a/ManicEmu/ManicEmu/Resources/nl.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/nl.lproj/Localizable.strings
@@ -675,3 +675,5 @@ Druk op de controllerknop...";
"Progress" = "Voortgang";
"DCGameNoSupportGameSave" = "Dreamcast ondersteunt geen importeren/exporteren van saves. Gebruik VMU Explorer om geheugenbestanden in de map Manic EMU-Flycast-dc te bewerken.";
+
+"Challenge" = "Uitdaging";
\ No newline at end of file
diff --git a/ManicEmu/ManicEmu/Resources/pl.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/pl.lproj/Localizable.strings
index d2b10c56..8ec3e5dc 100644
--- a/ManicEmu/ManicEmu/Resources/pl.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/pl.lproj/Localizable.strings
@@ -649,3 +649,5 @@ Naciśnij przycisk kontrolera...";
"Progress" = "Postęp";
"DCGameNoSupportGameSave" = "Dreamcast nie obsługuje importu/eksportu zapisów. Użyj VMU Explorer, aby edytować pliki pamięci w folderze Manic EMU-Flycast-dc.";
+
+"Challenge" = "Wyzwanie";
\ No newline at end of file
diff --git a/ManicEmu/ManicEmu/Resources/pt-BR.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/pt-BR.lproj/Localizable.strings
index 860adf69..e38d248e 100644
--- a/ManicEmu/ManicEmu/Resources/pt-BR.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/pt-BR.lproj/Localizable.strings
@@ -675,3 +675,5 @@ Pressione o botão do controle...";
"Progress" = "Progresso";
"DCGameNoSupportGameSave" = "O Dreamcast não suporta importação/exportação de saves. Use o VMU Explorer para editar arquivos de memória na pasta Manic EMU-Flycast-dc.";
+
+"Challenge" = "Desafio";
\ No newline at end of file
diff --git a/ManicEmu/ManicEmu/Resources/pt-PT.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/pt-PT.lproj/Localizable.strings
index b98a72fb..26c22c85 100644
--- a/ManicEmu/ManicEmu/Resources/pt-PT.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/pt-PT.lproj/Localizable.strings
@@ -676,3 +676,5 @@ Pressione o botão do comando...";
"Progress" = "Progresso";
"DCGameNoSupportGameSave" = "O Dreamcast não suporta importação/exportação de gravações. Utilize o VMU Explorer para editar ficheiros de memória na pasta Manic EMU-Flycast-dc.";
+
+"Challenge" = "Desafio";
\ No newline at end of file
diff --git a/ManicEmu/ManicEmu/Resources/ro.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/ro.lproj/Localizable.strings
index a0b0a162..159db9d4 100644
--- a/ManicEmu/ManicEmu/Resources/ro.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/ro.lproj/Localizable.strings
@@ -674,3 +674,5 @@ Apasă butonul controlerului...";
"Progress" = "Progres";
"DCGameNoSupportGameSave" = "Dreamcast nu suportă importul/exportul salvărilor. Utilizați VMU Explorer pentru a edita fișierele de memorie din folderul Manic EMU-Flycast-dc.";
+
+"Challenge" = "Provocare";
\ No newline at end of file
diff --git a/ManicEmu/ManicEmu/Resources/ru.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/ru.lproj/Localizable.strings
index 0977bbb4..d01ce511 100644
--- a/ManicEmu/ManicEmu/Resources/ru.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/ru.lproj/Localizable.strings
@@ -670,3 +670,5 @@
"Progress" = "Прогресс";
"DCGameNoSupportGameSave" = "Dreamcast не поддерживает импорт/экспорт сохранений. Используйте VMU Explorer для редактирования файлов памяти в папке Manic EMU-Flycast-dc.";
+
+"Challenge" = "Испытание";
\ No newline at end of file
diff --git a/ManicEmu/ManicEmu/Resources/sk.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/sk.lproj/Localizable.strings
index 7b922a0e..5d44e8be 100644
--- a/ManicEmu/ManicEmu/Resources/sk.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/sk.lproj/Localizable.strings
@@ -674,3 +674,5 @@ Ak sa vyskytne nestabilita v 3DS, pozrite si «Časté otázky» alebo sa pripoj
"Progress" = "Pokrok";
"DCGameNoSupportGameSave" = "Dreamcast nepodporuje import/export uložených hier. Na úpravu pamäťových súborov v priečinku Manic EMU-Flycast-dc použite VMU Explorer.";
+
+"Challenge" = "Výzva";
\ No newline at end of file
diff --git a/ManicEmu/ManicEmu/Resources/sv.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/sv.lproj/Localizable.strings
index 3ef6b57b..57384e83 100644
--- a/ManicEmu/ManicEmu/Resources/sv.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/sv.lproj/Localizable.strings
@@ -668,3 +668,5 @@ Tryck på kontrollknappen...";
"Progress" = "Framsteg";
"DCGameNoSupportGameSave" = "Dreamcast stöder inte import/export av sparfil. Använd VMU Explorer för att redigera minnesfiler i mappen Manic EMU-Flycast-dc.";
+
+"Challenge" = "Utmaning";
\ No newline at end of file
diff --git a/ManicEmu/ManicEmu/Resources/th.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/th.lproj/Localizable.strings
index f6f75dbc..102f4195 100644
--- a/ManicEmu/ManicEmu/Resources/th.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/th.lproj/Localizable.strings
@@ -664,3 +664,5 @@
"Progress" = "ความคืบหน้า";
"DCGameNoSupportGameSave" = "Dreamcast ไม่รองรับการนำเข้า/ส่งออกเซฟ ใช้ VMU Explorer เพื่อแก้ไขไฟล์หน่วยความจำในโฟลเดอร์ Manic EMU-Flycast-dc";
+
+"Challenge" = "ความท้าทาย";
\ No newline at end of file
diff --git a/ManicEmu/ManicEmu/Resources/tr.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/tr.lproj/Localizable.strings
index 4691c9af..006fc2e6 100644
--- a/ManicEmu/ManicEmu/Resources/tr.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/tr.lproj/Localizable.strings
@@ -674,3 +674,5 @@ Kontrolcü düğmesine basın...";
"Progress" = "İlerleme";
"DCGameNoSupportGameSave" = "Dreamcast kayıt içe/dışa aktarmayı desteklemez. Manic EMU-Flycast-dc klasöründeki bellek dosyalarını düzenlemek için VMU Explorer'ı kullanın.";
+
+"Challenge" = "Meydan Okuma";
\ No newline at end of file
diff --git a/ManicEmu/ManicEmu/Resources/uk.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/uk.lproj/Localizable.strings
index bf28db5d..ef4bf9b5 100644
--- a/ManicEmu/ManicEmu/Resources/uk.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/uk.lproj/Localizable.strings
@@ -674,3 +674,5 @@
"Progress" = "Прогрес";
"DCGameNoSupportGameSave" = "Dreamcast не підтримує імпорт/експорт збережень. Використовуйте VMU Explorer для редагування файлів пам'яті у папці Manic EMU-Flycast-dc.";
+
+"Challenge" = "Виклик";
\ No newline at end of file
diff --git a/ManicEmu/ManicEmu/Resources/vi.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/vi.lproj/Localizable.strings
index ed983b58..ead24b20 100644
--- a/ManicEmu/ManicEmu/Resources/vi.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/vi.lproj/Localizable.strings
@@ -668,3 +668,5 @@ Nhấn nút điều khiển...";
"Progress" = "Tiến Trình";
"DCGameNoSupportGameSave" = "Dreamcast không hỗ trợ nhập/xuất tập tin lưu. Sử dụng VMU Explorer để chỉnh sửa tập tin bộ nhớ trong thư mục Manic EMU-Flycast-dc.";
+
+"Challenge" = "Thử Thách";
\ No newline at end of file
diff --git a/ManicEmu/ManicEmu/Resources/zh-HK.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/zh-HK.lproj/Localizable.strings
index 1077dec5..0ca9693c 100644
--- a/ManicEmu/ManicEmu/Resources/zh-HK.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/zh-HK.lproj/Localizable.strings
@@ -680,3 +680,5 @@
"Progress" = "進度";
"DCGameNoSupportGameSave" = "Dreamcast 不支援存檔導入/導出。請使用 VMU Explorer 編輯 Manic EMU-Flycast-dc 文件夾中的記憶卡檔案。";
+
+"Challenge" = "挑戰";
\ No newline at end of file
diff --git a/ManicEmu/ManicEmu/Resources/zh-Hans.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/zh-Hans.lproj/Localizable.strings
index 747b2d4e..aae379ce 100644
--- a/ManicEmu/ManicEmu/Resources/zh-Hans.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/zh-Hans.lproj/Localizable.strings
@@ -681,3 +681,5 @@
"Progress" = "进度";
"DCGameNoSupportGameSave" = "Dreamcast不支持游戏存档的导入导出功能,需要你使用VMU Explorer工具自行编辑存档记忆体,这些记忆体文件存在于Manic EMU-Flycast-dc目录中";
+
+"Challenge" = "挑战";
\ No newline at end of file
diff --git a/ManicEmu/ManicEmu/Resources/zh-Hant.lproj/Localizable.strings b/ManicEmu/ManicEmu/Resources/zh-Hant.lproj/Localizable.strings
index c7d34eeb..429653d5 100644
--- a/ManicEmu/ManicEmu/Resources/zh-Hant.lproj/Localizable.strings
+++ b/ManicEmu/ManicEmu/Resources/zh-Hant.lproj/Localizable.strings
@@ -680,3 +680,5 @@
"Progress" = "進度";
"DCGameNoSupportGameSave" = "Dreamcast 不支援存檔匯入/匯出。請使用 VMU Explorer 編輯 Manic EMU-Flycast-dc 資料夾中的記憶卡檔案。";
+
+"Challenge" = "挑戰";
\ No newline at end of file
diff --git a/ManicEmu/ManicEmu/Sources/Business/Play/VIewControllers/PlayViewController.swift b/ManicEmu/ManicEmu/Sources/Business/Play/VIewControllers/PlayViewController.swift
index 136b2115..a44e9cf4 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Play/VIewControllers/PlayViewController.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Play/VIewControllers/PlayViewController.swift
@@ -96,10 +96,14 @@ class PlayViewController: GameViewController {
private var leaderboardView: LeaderboardView? = nil
//进度控件
private var cheevosProgressView: CheevosProgressView? = nil
+ //挑战控件
+ private var cheevosChallengeView: CheevosChallengeView? = nil
//游戏过程中接收到的leaderboard
private var leaderboards: [CheevosLeaderboard] = []
//解锁进展中的成就
private var progressAchievements: [CheevosAchievement] = []
+ //挑战中的成就
+ private var challengeAchievements: [CheevosAchievement] = []
deinit {
Log.debug("\(String(describing: Self.self)) deinit")
@@ -437,10 +441,35 @@ class PlayViewController: GameViewController {
} else {
self.progressAchievements.append(achievement)
}
+ if let challenge = self.challengeAchievements.first(where: { $0._id == achievement._id }) {
+ challenge.measuredProgress = achievement.measuredProgress
+ challenge.measuredPercent = achievement.measuredPercent
+ }
+
} else {
self.hideAchievementProgressIfNeed()
}
}
+ } else if achievement.isChallengeAchievement {
+ //挑战相关
+ if let challengeView = self.cheevosChallengeView {
+ if achievement.show {
+ challengeView.updateChallenge(achievement)
+ //临时存储进度 用于popup展示
+ if !self.challengeAchievements.contains(where: { $0._id == achievement._id }) {
+ self.challengeAchievements.append(achievement)
+ }
+
+ self.showRetroAchievements(badgeUrl: achievement.unlockedBadgeUrl,
+ title: R.string.localizable.achievementsChallenge(),
+ message: achievement._description,
+ hideIcon: true)
+
+ } else {
+ challengeView.removeChallenge(id: achievement._id)
+ self.challengeAchievements.removeAll(where: { $0._id == achievement._id } )
+ }
+ }
} else {
//获得成就
self.showRetroAchievements(badgeUrl: achievement.unlockedBadgeUrl,
@@ -503,13 +532,6 @@ class PlayViewController: GameViewController {
}
self.leaderboards.append(leaderboard)
- } else if let cheevosChallenge = notification.object as? CheevosChallenge {
- //挑战提示
- self.showRetroAchievements(badgeUrl: cheevosChallenge.unlockedBadgeUrl,
- title: R.string.localizable.achievementsChallenge(),
- message: cheevosChallenge._description,
- hideIcon: true)
-
} else if let message = notification.object as? String {
UIView.makeToast(message: message)
}
@@ -2084,6 +2106,7 @@ extension PlayViewController {
if enableAchievements {
setupLeaderboardView()
setupAchievementProgressView()
+ setupAchievementChallengeView()
}
} else {
LibretroCore.sharedInstance().updateLibretroConfig("cheevos_enable", value: "false")
@@ -2771,7 +2794,8 @@ extension PlayViewController {
leaderboardView.addTapGesture { [weak self] gesture in
guard let self else { return }
self.pauseEmulation()
- CheevosPopupView.show(leaderboards: leaderboards.reversed(),
+ CheevosPopupView.show(type: .leaderboard,
+ leaderboards: leaderboards.reversed(),
gameViewRect: self.gameView.frame,
menuInsets: getMenuInset()) { [weak self] in
self?.resumeEmulationAndHandleAudio()
@@ -2793,7 +2817,8 @@ extension PlayViewController {
progressView.addTapGesture { [weak self] gesture in
guard let self else { return }
self.pauseEmulation()
- CheevosPopupView.show(achievements: progressAchievements.reversed(),
+ CheevosPopupView.show(type: .progress,
+ achievements: progressAchievements.reversed(),
gameViewRect: self.gameView.frame,
menuInsets: getMenuInset()) { [weak self] in
self?.resumeEmulationAndHandleAudio()
@@ -2803,6 +2828,30 @@ extension PlayViewController {
}
}
+ private func setupAchievementChallengeView() {
+ if cheevosChallengeView == nil {
+ let challengeView = CheevosChallengeView()
+ view.addSubview(challengeView)
+ challengeView.snp.makeConstraints { make in
+ make.leading.bottom.equalTo(self.gameView).inset(5)
+ make.height.equalTo(32)
+ }
+ challengeView.isHidden = true
+ challengeView.addTapGesture { [weak self] gesture in
+ guard let self else { return }
+ self.pauseEmulation()
+
+ CheevosPopupView.show(type: .challenge,
+ achievements: self.challengeAchievements.reversed(),
+ gameViewRect: self.gameView.frame,
+ menuInsets: getMenuInset()) { [weak self] in
+ self?.resumeEmulationAndHandleAudio()
+ }
+ }
+ self.cheevosChallengeView = challengeView
+ }
+ }
+
private func getMenuInset() -> UIEdgeInsets? {
var menuInsets: UIEdgeInsets? = nil
if let traits = controllerView.controllerSkinTraits, let insets = controllerView.controllerSkin?.menuInsets(for: traits) {
diff --git a/ManicEmu/ManicEmu/Sources/Business/Play/Views/CheevosChallengeView.swift b/ManicEmu/ManicEmu/Sources/Business/Play/Views/CheevosChallengeView.swift
new file mode 100644
index 00000000..161dff71
--- /dev/null
+++ b/ManicEmu/ManicEmu/Sources/Business/Play/Views/CheevosChallengeView.swift
@@ -0,0 +1,89 @@
+//
+// CheevosChallengeView.swift
+// ManicEmu
+//
+// Created by Daiuno on 2025/9/12.
+// Copyright © 2025 Manic EMU. All rights reserved.
+//
+
+import UIKit
+
+class CheevosChallengeView: RoundAndBorderView {
+
+ private var challengeViewDict: [Int: UIImageView] = [:]
+ private let containerView = UIView()
+
+ init() {
+ super.init(roundCorner: .allCorners, radius: 16, borderColor: Constants.Color.Border, borderWidth: 1)
+ makeBlur(blurRadius: 2.5, blurColor: Constants.Color.BackgroundPrimary, blurAlpha: 0.4)
+
+ enableInteractive = true
+
+ addSubview(containerView)
+ containerView.snp.makeConstraints { make in
+ make.leading.equalToSuperview().offset(Constants.Size.ContentSpaceMin)
+ make.top.bottom.equalToSuperview()
+ }
+
+ let icon = UIImageView(image: .symbolImage(.playFill).applySymbolConfig(font: UIFont.systemFont(ofSize: 10, weight: .bold)))
+ icon.contentMode = .scaleAspectFit
+ addSubview(icon)
+ icon.snp.makeConstraints { make in
+ make.size.equalTo(12)
+ make.trailing.equalToSuperview().offset(-Constants.Size.ContentSpaceMin)
+ make.centerY.equalToSuperview()
+ make.leading.equalTo(containerView.snp.trailing).offset(5)
+ }
+ }
+
+ @MainActor required init?(coder: NSCoder) {
+ fatalError("init(coder:) has not been implemented")
+ }
+
+ func updateChallenge(_ challenge: CheevosAchievement) {
+ if isHidden { isHidden = false }
+
+ if let imageView = challengeViewDict[challenge._id] {
+ updateLayout(view: imageView, remakeConstraints: false)
+ } else {
+ let view = UIImageView()
+ view.layerCornerRadius = 4
+ view.contentMode = .scaleAspectFill
+ view.kf.setImage(with: URL(string: challenge.unlockedBadgeUrl), placeholder: UIImage.placeHolder(preferenceSize: .init(32)))
+ containerView.addSubview(view)
+ updateLayout(view: view)
+ challengeViewDict[challenge._id] = view
+ }
+ }
+
+ private func updateLayout(view: UIImageView?, remakeConstraints: Bool = true) {
+ for (index, subView) in containerView.subviews.enumerated() {
+ if remakeConstraints {
+ subView.snp.remakeConstraints { make in
+ make.top.bottom.equalToSuperview().inset(4)
+ make.size.equalTo(24)
+ if index == 0 {
+ make.leading.equalToSuperview()
+ } else {
+ make.leading.equalTo(containerView.subviews[index-1].snp.trailing).offset(4)
+ }
+ if index == containerView.subviews.count - 1 {
+ make.trailing.equalToSuperview()
+ }
+ }
+ }
+ }
+ }
+
+ func removeChallenge(id: Int) {
+ if let imageView = challengeViewDict[id] {
+ imageView.removeFromSuperview()
+ challengeViewDict.removeValue(forKey: id)
+ updateLayout(view: nil)
+ }
+ if challengeViewDict.isEmpty {
+ isHidden = true
+ }
+ }
+
+}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Play/Views/CheevosPopupView.swift b/ManicEmu/ManicEmu/Sources/Business/Play/Views/CheevosPopupView.swift
index 35ab1e09..67a4c6a1 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Play/Views/CheevosPopupView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Play/Views/CheevosPopupView.swift
@@ -16,6 +16,8 @@ class CheevosPopupAchievementCell: UICollectionViewCell {
return view
}()
+ private let infoContainerView = UIView()
+
private let imageView: UIImageView = {
let view = UIImageView()
view.contentMode = .scaleAspectFill
@@ -52,28 +54,32 @@ class CheevosPopupAchievementCell: UICollectionViewCell {
make.leading.equalToSuperview().offset(Constants.Size.ContentSpaceMid)
}
- containerView.addSubview(titleLabel)
- titleLabel.snp.makeConstraints { make in
- make.top.equalTo(imageView)
- make.leading.equalTo(imageView.snp.trailing).offset(Constants.Size.ContentSpaceTiny)
+ containerView.addSubview(infoContainerView)
+ infoContainerView.snp.makeConstraints { make in
+ make.centerY.equalTo(imageView)
+ make.leading.equalTo(imageView.snp.trailing).offset(Constants.Size.ContentSpaceMin)
make.trailing.equalToSuperview().offset(-Constants.Size.ContentSpaceMid)
}
- containerView.addSubview(progressView)
- progressView.snp.makeConstraints { make in
- make.leading.equalTo(titleLabel)
- make.height.equalTo(2)
- make.top.equalTo(titleLabel.snp.bottom).offset(Constants.Size.ContentSpaceTiny)
+ infoContainerView.addSubview(titleLabel)
+ titleLabel.snp.makeConstraints { make in
+ make.top.leading.trailing.equalToSuperview()
+ make.bottom.equalToSuperview().offset(-18)
}
-
- addSubview(progressLabel)
+ infoContainerView.addSubview(progressLabel)
progressLabel.snp.makeConstraints { make in
- make.leading.equalTo(progressView.snp.trailing).offset(Constants.Size.ContentSpaceMin)
- make.centerY.equalTo(progressView)
- make.trailing.equalTo(titleLabel)
+ make.trailing.equalToSuperview()
+ make.bottom.equalToSuperview()
}
+ infoContainerView.addSubview(progressView)
+ progressView.snp.makeConstraints { make in
+ make.leading.equalToSuperview()
+ make.centerY.equalTo(progressLabel)
+ make.trailing.equalTo(progressLabel.snp.leading).offset(-Constants.Size.ContentSpaceMin)
+ make.height.equalTo(2)
+ }
}
required init?(coder: NSCoder) {
@@ -90,9 +96,21 @@ class CheevosPopupAchievementCell: UICollectionViewCell {
style.alignment = .left
titleLabel.attributedText = matt.applying(attributes: [.paragraphStyle: style])
- progressView.progress = achievement.measuredPercent
-
- progressLabel.text = achievement.measuredProgress
+ if let measuredProgress = achievement.measuredProgress {
+ progressView.progress = achievement.measuredPercent
+ progressLabel.text = measuredProgress
+ progressView.isHidden = false
+ progressLabel.isHidden = false
+ titleLabel.snp.updateConstraints { make in
+ make.bottom.equalToSuperview().offset(-18)
+ }
+ } else {
+ progressView.isHidden = true
+ progressLabel.isHidden = true
+ titleLabel.snp.updateConstraints { make in
+ make.bottom.equalToSuperview().offset(0)
+ }
+ }
}
}
@@ -158,6 +176,10 @@ class CheevosPopupLeaderboardCell: UICollectionViewCell {
}
}
+enum CheevosPopupViewType {
+ case leaderboard, progress, challenge
+}
+
class CheevosPopupView: UIView {
/// 充当导航条
private var navigationBlurView: UIView = {
@@ -195,25 +217,29 @@ class CheevosPopupView: UIView {
private var achievements: [CheevosAchievement] = []
- private let isLeaderBoard: Bool
-
///点击关闭按钮回调
var didTapClose: (()->Void)? = nil
+ let type: CheevosPopupViewType
+
deinit {
Log.debug("\(String(describing: Self.self)) deinit")
}
- init(leaderBoards: [CheevosLeaderboard]? = nil, achievements: [CheevosAchievement]? = nil) {
- self.isLeaderBoard = leaderBoards != nil
+ init(type: CheevosPopupViewType, leaderBoards: [CheevosLeaderboard]? = nil, achievements: [CheevosAchievement]? = nil) {
+ self.type = type
+
super.init(frame: .zero)
Log.debug("\(String(describing: Self.self)) init")
- if let _ = leaderBoards, let _ = achievements {
- return
+ switch type {
+ case .leaderboard:
+ guard let leaderBoards, leaderBoards.count > 0 else { return }
+ case .progress, .challenge:
+ guard let achievements, achievements.count > 0 else { return }
}
- if isLeaderBoard {
+ if type == .leaderboard {
self.leaderBoards = leaderBoards ?? []
} else {
self.achievements = achievements ?? []
@@ -233,7 +259,15 @@ class CheevosPopupView: UIView {
let headerLabel = UILabel()
headerLabel.font = Constants.Font.title(size: .s, weight: .bold)
headerLabel.textColor = Constants.Color.LabelPrimary
- headerLabel.text = isLeaderBoard ? R.string.localizable.leaderboard() : R.string.localizable.progress()
+ switch type {
+ case .leaderboard:
+ headerLabel.text = R.string.localizable.leaderboard()
+ case .progress:
+ headerLabel.text = R.string.localizable.progress()
+ case .challenge:
+ headerLabel.text = R.string.localizable.challenge()
+ }
+
navigationBlurView.addSubview(headerLabel)
headerLabel.snp.makeConstraints { make in
make.centerY.equalToSuperview()
@@ -257,7 +291,7 @@ class CheevosPopupView: UIView {
guard let self else { return nil }
let item = NSCollectionLayoutItem(layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .fractionalHeight(1)))
- let group = NSCollectionLayoutGroup.horizontal(layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .absolute(self.isLeaderBoard ? 64 : Constants.Size.ItemHeightHuge)), subitem: item, count: Int(1))
+ let group = NSCollectionLayoutGroup.horizontal(layoutSize: NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .absolute(self.type == .leaderboard ? 64 : Constants.Size.ItemHeightHuge)), subitem: item, count: Int(1))
group.contentInsets = NSDirectionalEdgeInsets(top: 0, leading: Constants.Size.ContentSpaceMid, bottom: 0, trailing: Constants.Size.ContentSpaceMid)
@@ -276,11 +310,11 @@ class CheevosPopupView: UIView {
extension CheevosPopupView: UICollectionViewDataSource {
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
- isLeaderBoard ? leaderBoards.count : achievements.count
+ type == .leaderboard ? leaderBoards.count : achievements.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
- if isLeaderBoard {
+ if type == .leaderboard {
let cell = collectionView.dequeueReusableCell(withClass: CheevosPopupLeaderboardCell.self, for: indexPath)
cell.setData(leaderboard: leaderBoards[indexPath.row])
return cell
@@ -293,7 +327,10 @@ extension CheevosPopupView: UICollectionViewDataSource {
}
extension CheevosPopupView: UICollectionViewDelegate {
-
+ func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
+ guard type == .challenge || type == .progress else { return }
+ topViewController()?.present(RetroAchievementsDetailViewController(achievement: achievements[indexPath.row]), animated: true)
+ }
}
extension CheevosPopupView {
@@ -301,7 +338,8 @@ extension CheevosPopupView {
Sheet.find(identifier: String(describing: CheevosPopupView.self)).count > 0 ? true : false
}
- static func show(leaderboards: [CheevosLeaderboard]? = nil,
+ static func show(type: CheevosPopupViewType,
+ leaderboards: [CheevosLeaderboard]? = nil,
achievements: [CheevosAchievement]? = nil,
gameViewRect: CGRect,
menuInsets: UIEdgeInsets?,
@@ -347,7 +385,7 @@ extension CheevosPopupView {
}
}
- let listView = CheevosPopupView(leaderBoards: leaderboards, achievements: achievements)
+ let listView = CheevosPopupView(type: type, leaderBoards: leaderboards, achievements: achievements)
listView.didTapClose = { [weak sheet] in
sheet?.pop()
hideCompletion?()
diff --git a/ManicEmu/ManicEmu/Sources/Business/Play/Views/CheevosProgressView.swift b/ManicEmu/ManicEmu/Sources/Business/Play/Views/CheevosProgressView.swift
index a4490cd5..8641fee7 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Play/Views/CheevosProgressView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Play/Views/CheevosProgressView.swift
@@ -17,14 +17,14 @@ class CheevosProgressView: RoundAndBorderView {
private let titleLabel: UILabel = {
let view = UILabel()
view.font = UIFont.monospacedSystemFont(ofSize: 12, weight: .regular)
- view.textColor = .white
+ view.textColor = Constants.Color.LabelPrimary
view.minimumScaleFactor = 0.5
return view
}()
init() {
super.init(roundCorner: .allCorners, radius: 16, borderColor: Constants.Color.Border, borderWidth: 1)
- makeBlur(blurRadius: 2.5, blurColor: .white, blurAlpha: 0.4)
+ makeBlur(blurRadius: 2.5, blurColor: Constants.Color.BackgroundPrimary, blurAlpha: 0.4)
enableInteractive = true
@@ -88,16 +88,18 @@ class CheevosProgressView: RoundAndBorderView {
for (index, subView) in containerView.subviews.enumerated() {
subView.alpha = (subView == hightLightView ? 1 : 0.5)
- subView.snp.remakeConstraints { make in
- make.top.bottom.equalToSuperview().inset(4)
- make.size.equalTo(24)
- if index == 0 {
- make.leading.equalToSuperview()
- } else {
- make.leading.equalTo(containerView.subviews[index-1].snp.trailing).offset(4)
- }
- if index == containerView.subviews.count - 1 {
- make.trailing.equalToSuperview()
+ if remakeConstraints {
+ subView.snp.remakeConstraints { make in
+ make.top.bottom.equalToSuperview().inset(4)
+ make.size.equalTo(24)
+ if index == 0 {
+ make.leading.equalToSuperview()
+ } else {
+ make.leading.equalTo(containerView.subviews[index-1].snp.trailing).offset(4)
+ }
+ if index == containerView.subviews.count - 1 {
+ make.trailing.equalToSuperview()
+ }
}
}
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/Play/Views/LeaderboardView.swift b/ManicEmu/ManicEmu/Sources/Business/Play/Views/LeaderboardView.swift
index 1c0b070e..82bf71d0 100644
--- a/ManicEmu/ManicEmu/Sources/Business/Play/Views/LeaderboardView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/Play/Views/LeaderboardView.swift
@@ -13,7 +13,7 @@ class LeaderboardDetailView: UIView {
private let titleLabel: UILabel = {
let view = UILabel()
view.font = UIFont.monospacedSystemFont(ofSize: 12, weight: .regular)
- view.textColor = .white
+ view.textColor = Constants.Color.LabelPrimary
view.minimumScaleFactor = 0.5
return view
}()
@@ -66,7 +66,7 @@ class LeaderboardView: RoundAndBorderView {
init() {
super.init(roundCorner: .allCorners, radius: 12, borderColor: Constants.Color.Border, borderWidth: 1)
- makeBlur(blurRadius: 2.5, blurColor: .white, blurAlpha: 0.4)
+ makeBlur(blurRadius: 2.5, blurColor: Constants.Color.BackgroundPrimary, blurAlpha: 0.4)
enableInteractive = true
diff --git a/ManicEmu/ManicEmu/Sources/Business/RetroAchievements/ViewControllers/RetroAchievementsDetailViewController.swift b/ManicEmu/ManicEmu/Sources/Business/RetroAchievements/ViewControllers/RetroAchievementsDetailViewController.swift
index 0c467f92..7b00fe68 100644
--- a/ManicEmu/ManicEmu/Sources/Business/RetroAchievements/ViewControllers/RetroAchievementsDetailViewController.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/RetroAchievements/ViewControllers/RetroAchievementsDetailViewController.swift
@@ -11,6 +11,8 @@ class RetroAchievementsDetailViewController: BaseViewController {
private let containerView = UIView()
+ private var shareImageView: UIView? = nil
+
init(achievement: CheevosAchievement) {
super.init(fullScreen: true)
view.backgroundColor = .clear
@@ -34,7 +36,13 @@ class RetroAchievementsDetailViewController: BaseViewController {
shareButton.enableRoundCorner = true
shareButton.addTapGesture { [weak self] gesture in
guard let self else { return }
- ShareManager.shareImage(image: self.containerView.asImage())
+ UIView.makeLoading()
+ self.generateShareImage(achievement: achievement) { image in
+ ShareManager.shareImage(image: image)
+ UIView.hideLoading()
+ self.shareImageView?.removeFromSuperview()
+ self.shareImageView = nil
+ }
}
view.addSubview(shareButton)
shareButton.snp.makeConstraints { make in
@@ -44,6 +52,43 @@ class RetroAchievementsDetailViewController: BaseViewController {
}
}
+ func generateShareImage(achievement: CheevosAchievement, completion: ((UIImage)->Void)? = nil) {
+ let shareImageView = UIView()
+ view.insertSubview(shareImageView, belowSubview: containerView)
+ shareImageView.snp.makeConstraints { make in
+ make.top.bottom.equalToSuperview()
+ make.width.equalToSuperview()
+ make.leading.equalTo(view.snp.trailing)
+ }
+
+ let backgroundImageView = UIImageView(image: R.image.launch_bg())
+ backgroundImageView.contentMode = .scaleAspectFill
+ shareImageView.addSubview(backgroundImageView)
+ backgroundImageView.snp.makeConstraints { make in
+ make.center.equalToSuperview()
+ if UIDevice.isPhone, UIDevice.isLandscape {
+ make.leading.trailing.equalToSuperview()
+ } else {
+ make.top.bottom.equalToSuperview()
+ }
+ }
+
+ let detailView = RetroAchievementsDetailView(achievement: achievement, shaereMode: true) { }
+ shareImageView.addSubview(detailView)
+ detailView.snp.makeConstraints { make in
+ make.center.equalToSuperview()
+ make.leading.trailing.equalToSuperview().inset(40)
+ }
+
+ self.shareImageView = shareImageView
+
+ DispatchQueue.main.asyncAfter(delay: 0.5) {
+ completion?(shareImageView.asImage())
+ }
+
+ return
+ }
+
@MainActor required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
diff --git a/ManicEmu/ManicEmu/Sources/Business/RetroAchievements/Views/RetroAchievementsDetailView.swift b/ManicEmu/ManicEmu/Sources/Business/RetroAchievements/Views/RetroAchievementsDetailView.swift
index 3acaa355..9e23bc22 100644
--- a/ManicEmu/ManicEmu/Sources/Business/RetroAchievements/Views/RetroAchievementsDetailView.swift
+++ b/ManicEmu/ManicEmu/Sources/Business/RetroAchievements/Views/RetroAchievementsDetailView.swift
@@ -8,7 +8,7 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
class RetroAchievementsDetailView: BaseView {
- init(achievement: CheevosAchievement, didTapClose: @escaping (()->Void)) {
+ init(achievement: CheevosAchievement, shaereMode: Bool = false, didTapClose: @escaping (()->Void)) {
super.init(frame: .zero)
let coverImageView = UIImageView()
@@ -127,33 +127,50 @@ class RetroAchievementsDetailView: BaseView {
make.top.equalTo(seperator.snp.bottom).offset(Constants.Size.ContentSpaceMax)
}
- let roundContainer = RoundAndBorderView(roundCorner: .allCorners, borderColor: UIColor.white.withAlphaComponent(0.1), borderWidth: 2)
- roundContainer.addTapGesture { gesture in
- didTapClose()
- }
- roundContainer.enableInteractive = true
- roundContainer.delayInteractiveTouchEnd = true
- addSubview(roundContainer)
- roundContainer.snp.makeConstraints { make in
- make.height.equalTo(Constants.Size.ItemHeightMid)
- make.centerX.equalToSuperview()
- if let _ = enableProgressView {
- make.top.equalTo(infoLabel.snp.bottom).offset(Constants.Size.ItemHeightUltraTiny)
- } else {
- make.top.equalTo(infoLabel.snp.bottom).offset(Constants.Size.ItemHeightMin)
+ if shaereMode {
+ let brandImageView = UIImageView(image: R.image.app_title())
+ brandImageView.contentMode = .scaleAspectFit
+ addSubview(brandImageView)
+ brandImageView.snp.makeConstraints { make in
+ make.centerX.equalToSuperview()
+ if let _ = enableProgressView {
+ make.top.equalTo(infoLabel.snp.bottom).offset(Constants.Size.ItemHeightUltraTiny)
+ } else {
+ make.top.equalTo(infoLabel.snp.bottom).offset(Constants.Size.ItemHeightMin)
+ }
+
+ make.bottom.equalToSuperview()
+ }
+ } else {
+ let roundContainer = RoundAndBorderView(roundCorner: .allCorners, borderColor: UIColor.white.withAlphaComponent(0.1), borderWidth: 2)
+ roundContainer.addTapGesture { gesture in
+ didTapClose()
+ }
+ roundContainer.enableInteractive = true
+ roundContainer.delayInteractiveTouchEnd = true
+ addSubview(roundContainer)
+ roundContainer.snp.makeConstraints { make in
+ make.height.equalTo(Constants.Size.ItemHeightMid)
+ make.centerX.equalToSuperview()
+ if let _ = enableProgressView {
+ make.top.equalTo(infoLabel.snp.bottom).offset(Constants.Size.ItemHeightUltraTiny)
+ } else {
+ make.top.equalTo(infoLabel.snp.bottom).offset(Constants.Size.ItemHeightMin)
+ }
+
+ make.bottom.equalToSuperview()
+ }
+ let okLabel = UILabel()
+ okLabel.text = R.string.localizable.gotIt()
+ okLabel.font = Constants.Font.title(size: .s, weight: .semibold)
+ okLabel.textColor = .white
+ roundContainer.addSubview(okLabel)
+ okLabel.snp.makeConstraints { make in
+ make.center.equalToSuperview()
+ make.leading.trailing.equalToSuperview().inset(40)
}
-
- make.bottom.equalToSuperview()
- }
- let okLabel = UILabel()
- okLabel.text = R.string.localizable.gotIt()
- okLabel.font = Constants.Font.title(size: .s, weight: .semibold)
- okLabel.textColor = .white
- roundContainer.addSubview(okLabel)
- okLabel.snp.makeConstraints { make in
- make.center.equalToSuperview()
- make.leading.trailing.equalToSuperview().inset(40)
}
+
}
required init?(coder: NSCoder) {
diff --git a/ManicEmu/ManicEmu/Sources/Tools/Cores/DC.swift b/ManicEmu/ManicEmu/Sources/Tools/Cores/DC.swift
index 26ef75d8..3c4e833e 100644
--- a/ManicEmu/ManicEmu/Sources/Tools/Cores/DC.swift
+++ b/ManicEmu/ManicEmu/Sources/Tools/Cores/DC.swift
@@ -20,8 +20,8 @@ extension GameType
case b
case x
case y
- case l
- case r
+ case l1
+ case r1
case start
case up
case down
@@ -44,8 +44,8 @@ extension GameType
else if stringValue == "b" { self = .b }
else if stringValue == "x" { self = .x }
else if stringValue == "y" { self = .y }
- else if stringValue == "l" { self = .l }
- else if stringValue == "r" { self = .r }
+ else if stringValue == "l1" { self = .l1 }
+ else if stringValue == "r1" { self = .r1 }
else if stringValue == "start" { self = .start }
else if stringValue == "menu" { self = .menu }
else if stringValue == "up" { self = .up }
@@ -137,8 +137,8 @@ class DCEmulatorBridge : NSObject, EmulatorBase {
else if gameInput == .b { return .A }
else if gameInput == .x { return .Y }
else if gameInput == .y { return .X }
- else if gameInput == .l { return .L2 }
- else if gameInput == .r { return .R2 }
+ else if gameInput == .l1 { return .L2 }
+ else if gameInput == .r1 { return .R2 }
else if gameInput == .start { return .start }
else if gameInput == .up { return .up }
else if gameInput == .down { return .down }
diff --git a/ManicSupport/Resources/System.core b/ManicSupport/Resources/System.core
index 817570c1..d2ffe1c5 100644
--- a/ManicSupport/Resources/System.core
+++ b/ManicSupport/Resources/System.core
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:0bb4e2a34b826581e49c6b628c1c0fdb80c41968a97240aa36e2ef6ff0c5e32e
-size 63746443
+oid sha256:a857ddf4f85880a0b3407543c7a48a8cfc75d687b6b3b180408381bdb063870c
+size 63746445