43
43
44
44
UNKNOWN_EMULATORS = [
45
45
# Emulatori non ancora supportati ma che vogliamo rilevare
46
- 'retroarch' , 'project64' , 'zsnes' , 'fceux' , 'nestopia' , 'demul' , 'mame' ,
47
- 'dosbox' , 'scummvm' , 'melonds' , 'xemu' , 'redream' , 'epsxe' , 'mesen' ,
48
- 'bsnes' , 'higan' , 'mednafen' , 'kega' , 'fusion' , 'vita3k' , 'play' ,
49
- 'supermodel' , 'nulldc' , 'mupen64plus' , 'bizhawk' , 'ares' , 'raine' ,
50
- 'pcsp' , 'cxbx' , 'cxbx-reloaded' , 'xqemu' , 'decaf' ,
46
+ # Yuzu/Ryujinx forks
47
+ 'suyu' , 'sudachi' , 'ryubing' , 'lime3ds' , 'folium' , 'strato' , 'ryujinx-ldn' , 'power-emu' ,
48
+ # Altri emulatori
49
+ 'aethersx2' , 'ares' , 'blastem' , 'bsnes' , 'beetle-psx' , 'bizhawk' , 'cxbx' ,
50
+ 'cxbx-reloaded' , 'decaf' , 'demul' , 'dosbox' , 'dosbox-staging' , 'dosbox-x' ,
51
+ 'epsxe' , 'fceux' , 'fusion' , 'genesisplusgx' , 'higan' , 'ideas' , 'kega' ,
52
+ 'kronos' , 'mame' , 'mednafen' , 'melonds' , 'mesen' , 'mikage' , 'mupen64plus' ,
53
+ 'nestopia' , 'nether_sx2' , 'no$gba' , 'nulldc' , 'panda3ds' , 'pcsp' ,
54
+ 'pcsx-rearmed' , 'pcsx-reloaded' , 'play' , 'project64' , 'puNES' , 'raine' ,
55
+ 'redream' , 'retroarch' , 'rmg' , 'scummvm' , 'simple64' , 'ssantanshiro' ,
56
+ 'supermodel' , 'swanstation' , 'vba-m' , 'vita3k' , 'xemu' , 'xqemu' ,
57
+ 'yabause' , 'zsnes' ,
51
58
]
52
59
# Dictionary mapping emulator keys (used internally) to their configuration
53
60
# 'name' is the display name, 'profile_finder' is the function to call
@@ -165,20 +172,20 @@ def find_profiles_for_emulator(emulator_key: str, custom_path: Optional[str] = N
165
172
log .exception (f"Error finding profiles for { emulator_config .get ('name' , emulator_key )} : { e } " )
166
173
return {}
167
174
168
- def is_known_emulator (file_path : str ) -> bool :
175
+ def is_known_emulator (file_path : str ) -> tuple [ str , str | None ] :
169
176
"""
170
- Verifica se il file è un emulatore conosciuto, senza cercare i profili di salvataggio.
171
- Usato principalmente per il filtraggio rapido durante la scansione delle cartelle.
172
-
177
+ Verifica se il file è un emulatore conosciuto e il suo stato di supporto.
178
+
173
179
Args:
174
- file_path: Il percorso del file da verificare
175
-
180
+ file_path: Il percorso del file da verificare.
181
+
176
182
Returns:
177
- bool: True se è un emulatore conosciuto, False altrimenti
183
+ tuple[str, str | None]: Una tupla contenente lo stato ('supported',
184
+ 'unsupported', 'not_found') e il nome dell'emulatore rilevato (o None).
178
185
"""
179
186
try :
180
187
if not file_path or not os .path .exists (file_path ):
181
- return False
188
+ return 'not_found' , None
182
189
183
190
# Risolvi il collegamento .lnk se necessario
184
191
target_path = file_path
@@ -192,26 +199,31 @@ def is_known_emulator(file_path: str) -> bool:
192
199
target_path = resolved_target
193
200
log .info (f"is_known_emulator: Resolved .lnk target to: { target_path } " )
194
201
else :
195
- return False
202
+ return 'not_found' , None
196
203
except Exception as e :
197
204
log .error (f"Error resolving shortcut in is_known_emulator: { e } " )
198
- return False
205
+ return 'not_found' , None
199
206
200
207
# Verifica se il percorso contiene uno degli emulatori conosciuti
201
208
target_path_lower = target_path .lower ()
202
209
file_name = os .path .basename (target_path_lower )
203
210
204
- # Combine known and unknown emulators for exclusion
205
- all_emulators = KNOWN_EMULATORS + UNKNOWN_EMULATORS
206
- for emulator in all_emulators :
211
+ # Controlla prima gli emulatori supportati
212
+ for emulator in KNOWN_EMULATORS :
207
213
if emulator in file_name or f"\\ { emulator } \\ " in target_path_lower or f"/{ emulator } /" in target_path_lower :
208
- log .info (f"Detected emulator '{ emulator } ' in path: { target_path } " )
209
- return True
210
-
211
- return False
214
+ log .info (f"Detected supported emulator '{ emulator } ' in path: { target_path } " )
215
+ return 'supported' , emulator
216
+
217
+ # Controlla gli emulatori non supportati
218
+ for emulator in UNKNOWN_EMULATORS :
219
+ if emulator in file_name or f"\\ { emulator } \\ " in target_path_lower or f"/{ emulator } /" in target_path_lower :
220
+ log .info (f"Detected unsupported emulator '{ emulator } ' in path: { target_path } " )
221
+ return 'unsupported' , emulator
222
+
223
+ return 'not_found' , None
212
224
except Exception as e :
213
225
log .error (f"Error in is_known_emulator: { e } " )
214
- return False
226
+ return 'not_found' , None
215
227
216
228
def detect_and_find_profiles (target_path : str | None ) -> tuple [str , list [dict ]] | None :
217
229
"""
0 commit comments