Skip to content

Commit 830e9c3

Browse files
committed
new unsupported emulator popup
1 parent 764d8f2 commit 830e9c3

File tree

3 files changed

+64
-44
lines changed

3 files changed

+64
-44
lines changed

emulator_utils/emulator_manager.py

Lines changed: 35 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,18 @@
4343

4444
UNKNOWN_EMULATORS = [
4545
# 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',
5158
]
5259
# Dictionary mapping emulator keys (used internally) to their configuration
5360
# '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
165172
log.exception(f"Error finding profiles for {emulator_config.get('name', emulator_key)}: {e}")
166173
return {}
167174

168-
def is_known_emulator(file_path: str) -> bool:
175+
def is_known_emulator(file_path: str) -> tuple[str, str | None]:
169176
"""
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+
173179
Args:
174-
file_path: Il percorso del file da verificare
175-
180+
file_path: Il percorso del file da verificare.
181+
176182
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).
178185
"""
179186
try:
180187
if not file_path or not os.path.exists(file_path):
181-
return False
188+
return 'not_found', None
182189

183190
# Risolvi il collegamento .lnk se necessario
184191
target_path = file_path
@@ -192,26 +199,31 @@ def is_known_emulator(file_path: str) -> bool:
192199
target_path = resolved_target
193200
log.info(f"is_known_emulator: Resolved .lnk target to: {target_path}")
194201
else:
195-
return False
202+
return 'not_found', None
196203
except Exception as e:
197204
log.error(f"Error resolving shortcut in is_known_emulator: {e}")
198-
return False
205+
return 'not_found', None
199206

200207
# Verifica se il percorso contiene uno degli emulatori conosciuti
201208
target_path_lower = target_path.lower()
202209
file_name = os.path.basename(target_path_lower)
203210

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:
207213
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
212224
except Exception as e:
213225
log.error(f"Error in is_known_emulator: {e}")
214-
return False
226+
return 'not_found', None
215227

216228
def detect_and_find_profiles(target_path: str | None) -> tuple[str, list[dict]] | None:
217229
"""

gui_components/drag_drop_handler.py

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,10 @@ def _scan_directory_for_executables(self, directory_path):
182182
continue
183183

184184
# Verifica se il file è un emulatore conosciuto (solo detection, senza scan dei profili)
185-
is_emulator = self._is_known_emulator(item_path)
186-
if is_emulator:
187-
# Se è un emulatore, lo saltiamo immediatamente senza cercare i profili
188-
logging.info(f"Skipping emulator in directory: {item_path}")
185+
# Verifica se il file è un emulatore conosciuto per escluderlo dalla scansione
186+
emulator_status, _ = self._is_known_emulator(item_path)
187+
if emulator_status in ['supported', 'unsupported']:
188+
logging.info(f"Skipping emulator file found during directory scan: {item_path}")
189189
continue
190190

191191
# Se arriviamo qui, il file non è un emulatore e può essere aggiunto
@@ -480,19 +480,15 @@ def _check_detection_threads_status(self):
480480

481481
logging.info("All detection threads completed.")
482482

483-
def _is_known_emulator(self, file_path):
484-
"""Verifica solo se il file è un emulatore conosciuto, senza cercare i profili di salvataggio.
485-
Usa la funzione centralizzata in emulator_manager.
486-
487-
Args:
488-
file_path: Il percorso del file da verificare
489-
490-
Returns:
491-
bool: True se è un emulatore conosciuto, False altrimenti
492-
"""
493-
from emulator_utils.emulator_manager import is_known_emulator
494-
return is_known_emulator(file_path)
495-
483+
def _is_known_emulator(self, file_path) -> tuple[str, str | None]:
484+
"""Controlla se il file è un emulatore conosciuto e restituisce il suo stato."""
485+
try:
486+
from emulator_utils.emulator_manager import is_known_emulator
487+
return is_known_emulator(file_path)
488+
except ImportError:
489+
log.error("Failed to import is_known_emulator. Check circular dependencies or project structure.")
490+
return 'not_found', None
491+
496492
def _check_if_emulator(self, file_path):
497493
"""Verifica se il file è un emulatore supportato e cerca i profili di salvataggio.
498494

gui_components/drop_event_logic.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,18 @@ def dropEvent(self, event: QDropEvent):
216216
# Verifica se è un emulatore
217217
if len(files_to_process) == 1:
218218
file_path = files_to_process[0]
219+
220+
# Controlla prima se è un emulatore conosciuto ma non supportato
221+
emulator_status, emulator_name = handler_instance._is_known_emulator(file_path)
222+
if emulator_status == 'unsupported':
223+
QMessageBox.information(handler_instance.main_window,
224+
"Emulatore Riconosciuto",
225+
f"L'emulatore '{emulator_name}' è stato riconosciuto ma non è ancora supportato da SaveState.\n\n"
226+
"Il supporto per nuovi emulatori viene aggiunto regolarmente.")
227+
event.acceptProposedAction()
228+
return
229+
230+
# Se non è 'unsupported', procedi con la normale verifica per emulatori supportati
219231
emulator_result = handler_instance._check_if_emulator(file_path)
220232

221233
if emulator_result:
@@ -333,10 +345,10 @@ def dropEvent(self, event: QDropEvent):
333345
# Filter out emulators and uninstalled Steam games from files_to_process
334346
filtered_files = []
335347
for file_path in files_to_process:
336-
# Check if it's an emulator
337-
emulator_result = handler_instance._check_if_emulator(file_path)
338-
if emulator_result:
339-
logging.info(f"DragDropHandler.dropEvent: Skipping emulator: {file_path}")
348+
# Controlla se è un emulatore (supportato o meno) per escluderlo
349+
emulator_status, emulator_name = handler_instance._is_known_emulator(file_path)
350+
if emulator_status in ['supported', 'unsupported']:
351+
logging.info(f"DragDropHandler.dropEvent: Skipping emulator '{emulator_name}' in multi-file drop: {file_path}")
340352
continue
341353

342354
# Check if it's a Steam link to an uninstalled game

0 commit comments

Comments
 (0)