Compare commits

..

1 Commits

Author SHA1 Message Date
skymike03
0c5e307112 v2.3.1.9 (2025.11.10)
- Add footer font scale settings and accessibility options
- Adjusted scraper error messages
2025-11-10 22:43:48 +01:00
14 changed files with 322 additions and 145 deletions

View File

@@ -127,6 +127,12 @@ for i, scale in enumerate(config.font_scale_options):
config.current_font_scale_index = i
break
# Charger le footer_font_scale
for i, scale in enumerate(config.footer_font_scale_options):
if scale == config.accessibility_settings.get("footer_font_scale", 1.0):
config.current_footer_font_scale_index = i
break
# Chargement et initialisation de la langue
from language import initialize_language
initialize_language()
@@ -160,6 +166,7 @@ pygame.display.set_caption("RGSX")
# Initialisation des polices via config
config.init_font()
config.init_footer_font()
# Mise à jour de la résolution dans config
config.screen_width, config.screen_height = pygame.display.get_surface().get_size()

View File

@@ -11,10 +11,10 @@ def load_accessibility_settings():
try:
settings = load_rgsx_settings()
return settings.get("accessibility", {"font_scale": 1.0})
return settings.get("accessibility", {"font_scale": 1.0, "footer_font_scale": 1.0})
except Exception as e:
logger.error(f"Erreur lors du chargement des paramètres d'accessibilité: {str(e)}")
return {"font_scale": 1.0}
return {"font_scale": 1.0, "footer_font_scale": 1.0}
def save_accessibility_settings(accessibility_settings):
"""Sauvegarde les paramètres d'accessibilité dans rgsx_settings.json."""
@@ -28,7 +28,7 @@ def save_accessibility_settings(accessibility_settings):
logger.error(f"Erreur lors de la sauvegarde des paramètres d'accessibilité: {str(e)}")
def draw_accessibility_menu(screen):
"""Affiche le menu d'accessibilité avec curseur pour la taille de police."""
"""Affiche le menu d'accessibilité avec curseurs pour la taille de police générale et du footer."""
from display import OVERLAY, THEME_COLORS, draw_stylized_button
screen.blit(OVERLAY, (0, 0))
@@ -44,47 +44,87 @@ def draw_accessibility_menu(screen):
pygame.draw.rect(screen, THEME_COLORS["border"], title_bg_rect, 2, border_radius=10)
screen.blit(title_surface, title_rect)
# Curseur de taille de police
# Déterminer quel curseur est sélectionné (0 = général, 1 = footer)
selected_cursor = getattr(config, 'accessibility_selected_cursor', 0)
# Curseur 1: Taille de police générale
current_scale = config.font_scale_options[config.current_font_scale_index]
font_text = _("accessibility_font_size").format(f"{current_scale:.1f}")
# Position du curseur
cursor_y = config.screen_height // 2
cursor_y1 = config.screen_height // 2 - 50
cursor_width = 400
cursor_height = 60
cursor_x = (config.screen_width - cursor_width) // 2
# Fond du curseur
pygame.draw.rect(screen, THEME_COLORS["button_idle"], (cursor_x, cursor_y, cursor_width, cursor_height), border_radius=10)
pygame.draw.rect(screen, THEME_COLORS["border"], (cursor_x, cursor_y, cursor_width, cursor_height), 2, border_radius=10)
# Fond du curseur 1
cursor1_color = THEME_COLORS["fond_lignes"] if selected_cursor == 0 else THEME_COLORS["button_idle"]
pygame.draw.rect(screen, cursor1_color, (cursor_x, cursor_y1, cursor_width, cursor_height), border_radius=10)
border_width = 3 if selected_cursor == 0 else 2
pygame.draw.rect(screen, THEME_COLORS["border"], (cursor_x, cursor_y1, cursor_width, cursor_height), border_width, border_radius=10)
# Flèches gauche/droite
# Flèches gauche/droite pour curseur 1
arrow_size = 30
left_arrow_x = cursor_x + 20
right_arrow_x = cursor_x + cursor_width - arrow_size - 20
arrow_y = cursor_y + (cursor_height - arrow_size) // 2
arrow_y1 = cursor_y1 + (cursor_height - arrow_size) // 2
# Flèche gauche
left_color = THEME_COLORS["fond_lignes"] if config.current_font_scale_index > 0 else THEME_COLORS["border"]
left_color = THEME_COLORS["text"] if config.current_font_scale_index > 0 else THEME_COLORS["border"]
pygame.draw.polygon(screen, left_color, [
(left_arrow_x + arrow_size, arrow_y),
(left_arrow_x, arrow_y + arrow_size // 2),
(left_arrow_x + arrow_size, arrow_y + arrow_size)
(left_arrow_x + arrow_size, arrow_y1),
(left_arrow_x, arrow_y1 + arrow_size // 2),
(left_arrow_x + arrow_size, arrow_y1 + arrow_size)
])
# Flèche droite
right_color = THEME_COLORS["fond_lignes"] if config.current_font_scale_index < len(config.font_scale_options) - 1 else THEME_COLORS["border"]
right_color = THEME_COLORS["text"] if config.current_font_scale_index < len(config.font_scale_options) - 1 else THEME_COLORS["border"]
pygame.draw.polygon(screen, right_color, [
(right_arrow_x, arrow_y),
(right_arrow_x + arrow_size, arrow_y + arrow_size // 2),
(right_arrow_x, arrow_y + arrow_size)
(right_arrow_x, arrow_y1),
(right_arrow_x + arrow_size, arrow_y1 + arrow_size // 2),
(right_arrow_x, arrow_y1 + arrow_size)
])
# Texte au centre
text_surface = config.font.render(font_text, True, THEME_COLORS["text"])
text_rect = text_surface.get_rect(center=(cursor_x + cursor_width // 2, cursor_y + cursor_height // 2))
text_rect = text_surface.get_rect(center=(cursor_x + cursor_width // 2, cursor_y1 + cursor_height // 2))
screen.blit(text_surface, text_rect)
# Curseur 2: Taille de police du footer
current_footer_scale = config.footer_font_scale_options[config.current_footer_font_scale_index]
footer_font_text = _("accessibility_footer_font_size").format(f"{current_footer_scale:.1f}")
cursor_y2 = cursor_y1 + cursor_height + 20
# Fond du curseur 2
cursor2_color = THEME_COLORS["fond_lignes"] if selected_cursor == 1 else THEME_COLORS["button_idle"]
pygame.draw.rect(screen, cursor2_color, (cursor_x, cursor_y2, cursor_width, cursor_height), border_radius=10)
border_width = 3 if selected_cursor == 1 else 2
pygame.draw.rect(screen, THEME_COLORS["border"], (cursor_x, cursor_y2, cursor_width, cursor_height), border_width, border_radius=10)
# Flèches gauche/droite pour curseur 2
arrow_y2 = cursor_y2 + (cursor_height - arrow_size) // 2
# Flèche gauche
left_color2 = THEME_COLORS["text"] if config.current_footer_font_scale_index > 0 else THEME_COLORS["border"]
pygame.draw.polygon(screen, left_color2, [
(left_arrow_x + arrow_size, arrow_y2),
(left_arrow_x, arrow_y2 + arrow_size // 2),
(left_arrow_x + arrow_size, arrow_y2 + arrow_size)
])
# Flèche droite
right_color2 = THEME_COLORS["text"] if config.current_footer_font_scale_index < len(config.footer_font_scale_options) - 1 else THEME_COLORS["border"]
pygame.draw.polygon(screen, right_color2, [
(right_arrow_x, arrow_y2),
(right_arrow_x + arrow_size, arrow_y2 + arrow_size // 2),
(right_arrow_x, arrow_y2 + arrow_size)
])
# Texte au centre
text_surface2 = config.font.render(footer_font_text, True, THEME_COLORS["text"])
text_rect2 = text_surface2.get_rect(center=(cursor_x + cursor_width // 2, cursor_y2 + cursor_height // 2))
screen.blit(text_surface2, text_rect2)
# Instructions
instruction_text = _("language_select_instruction")
instruction_surface = config.small_font.render(instruction_text, True, THEME_COLORS["text"])
@@ -93,16 +133,44 @@ def draw_accessibility_menu(screen):
def handle_accessibility_events(event):
"""Gère les événements du menu d'accessibilité avec support clavier et manette."""
# Initialiser le curseur sélectionné si non défini
if not hasattr(config, 'accessibility_selected_cursor'):
config.accessibility_selected_cursor = 0
# Gestion des touches du clavier
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_LEFT and config.current_font_scale_index > 0:
config.current_font_scale_index -= 1
update_font_scale()
# Navigation haut/bas entre les curseurs
if event.key == pygame.K_UP:
config.accessibility_selected_cursor = max(0, config.accessibility_selected_cursor - 1)
config.needs_redraw = True
return True
elif event.key == pygame.K_RIGHT and config.current_font_scale_index < len(config.font_scale_options) - 1:
config.current_font_scale_index += 1
update_font_scale()
elif event.key == pygame.K_DOWN:
config.accessibility_selected_cursor = min(1, config.accessibility_selected_cursor + 1)
config.needs_redraw = True
return True
# Navigation gauche/droite pour modifier les valeurs
elif event.key == pygame.K_LEFT:
if config.accessibility_selected_cursor == 0:
if config.current_font_scale_index > 0:
config.current_font_scale_index -= 1
update_font_scale()
return True
else:
if config.current_footer_font_scale_index > 0:
config.current_footer_font_scale_index -= 1
update_footer_font_scale()
return True
elif event.key == pygame.K_RIGHT:
if config.accessibility_selected_cursor == 0:
if config.current_font_scale_index < len(config.font_scale_options) - 1:
config.current_font_scale_index += 1
update_font_scale()
return True
else:
if config.current_footer_font_scale_index < len(config.footer_font_scale_options) - 1:
config.current_footer_font_scale_index += 1
update_footer_font_scale()
return True
elif event.key == pygame.K_RETURN or event.key == pygame.K_ESCAPE:
config.menu_state = "pause_menu"
return True
@@ -118,36 +186,89 @@ def handle_accessibility_events(event):
# Gestion du D-pad
elif event.type == pygame.JOYHATMOTION:
if event.value == (-1, 0): # Gauche
if config.current_font_scale_index > 0:
config.current_font_scale_index -= 1
update_font_scale()
return True
if event.value == (0, 1): # Haut
config.accessibility_selected_cursor = max(0, config.accessibility_selected_cursor - 1)
config.needs_redraw = True
return True
elif event.value == (0, -1): # Bas
config.accessibility_selected_cursor = min(1, config.accessibility_selected_cursor + 1)
config.needs_redraw = True
return True
elif event.value == (-1, 0): # Gauche
if config.accessibility_selected_cursor == 0:
if config.current_font_scale_index > 0:
config.current_font_scale_index -= 1
update_font_scale()
return True
else:
if config.current_footer_font_scale_index > 0:
config.current_footer_font_scale_index -= 1
update_footer_font_scale()
return True
elif event.value == (1, 0): # Droite
if config.current_font_scale_index < len(config.font_scale_options) - 1:
config.current_font_scale_index += 1
update_font_scale()
return True
if config.accessibility_selected_cursor == 0:
if config.current_font_scale_index < len(config.font_scale_options) - 1:
config.current_font_scale_index += 1
update_font_scale()
return True
else:
if config.current_footer_font_scale_index < len(config.footer_font_scale_options) - 1:
config.current_footer_font_scale_index += 1
update_footer_font_scale()
return True
# Gestion du joystick analogique (axe horizontal)
# Gestion du joystick analogique
elif event.type == pygame.JOYAXISMOTION:
if event.axis == 0 and abs(event.value) > 0.5: # Joystick gauche horizontal
if event.value < -0.5 and config.current_font_scale_index > 0: # Gauche
config.current_font_scale_index -= 1
update_font_scale()
if event.axis == 1 and abs(event.value) > 0.5: # Joystick vertical
if event.value < -0.5: # Haut
config.accessibility_selected_cursor = max(0, config.accessibility_selected_cursor - 1)
config.needs_redraw = True
return True
elif event.value > 0.5 and config.current_font_scale_index < len(config.font_scale_options) - 1: # Droite
config.current_font_scale_index += 1
update_font_scale()
elif event.value > 0.5: # Bas
config.accessibility_selected_cursor = min(1, config.accessibility_selected_cursor + 1)
config.needs_redraw = True
return True
elif event.axis == 0 and abs(event.value) > 0.5: # Joystick horizontal
if event.value < -0.5: # Gauche
if config.accessibility_selected_cursor == 0:
if config.current_font_scale_index > 0:
config.current_font_scale_index -= 1
update_font_scale()
return True
else:
if config.current_footer_font_scale_index > 0:
config.current_footer_font_scale_index -= 1
update_footer_font_scale()
return True
elif event.value > 0.5: # Droite
if config.accessibility_selected_cursor == 0:
if config.current_font_scale_index < len(config.font_scale_options) - 1:
config.current_font_scale_index += 1
update_font_scale()
return True
else:
if config.current_footer_font_scale_index < len(config.footer_font_scale_options) - 1:
config.current_footer_font_scale_index += 1
update_footer_font_scale()
return True
return False
def update_font_scale():
"""Met à jour l'échelle de police et sauvegarde."""
"""Met à jour l'échelle de police générale et sauvegarde."""
new_scale = config.font_scale_options[config.current_font_scale_index]
config.accessibility_settings["font_scale"] = new_scale
save_accessibility_settings(config.accessibility_settings)
# Réinitialiser les polices
config.init_font()
config.needs_redraw = True
def update_footer_font_scale():
"""Met à jour l'échelle de police du footer et sauvegarde."""
new_scale = config.footer_font_scale_options[config.current_footer_font_scale_index]
config.accessibility_settings["footer_font_scale"] = new_scale
save_accessibility_settings(config.accessibility_settings)
# Réinitialiser les polices du footer
config.init_footer_font()
config.needs_redraw = True

View File

@@ -13,7 +13,7 @@ except Exception:
pygame = None # type: ignore
# Version actuelle de l'application
app_version = "2.3.1.8"
app_version = "2.3.1.9"
def get_application_root():
@@ -30,53 +30,7 @@ def get_application_root():
### CONSTANTES DES CHEMINS DE BASE
#
# This application supports two deployment modes:
#
# ===== TRADITIONAL MODE (Batocera/Retrobat) =====
# No environment variables set. Everything is derived from the app code location.
#
# Structure:
# /userdata/
# ├── roms/
# │ ├── ports/RGSX/ ← APP_FOLDER (application code)
# │ ├── snes/ ← ROMs organized by platform
# │ └── ...
# └── saves/ports/rgsx/ ← SAVE_FOLDER (config & data)
# ├── rgsx_settings.json ← settings file
# ├── images/ ← scraped metadata/covers
# ├── games/ ← temporary download location
# ├── history.json ← download history
# └── ...
#
# ===== DOCKER MODE =====
# Enabled by setting RGSX_CONFIG_DIR and/or RGSX_DATA_DIR environment variables.
# This separates the app code, configuration, and data into different directories
# that can be mounted as Docker volumes.
#
# Environment Variables:
# RGSX_APP_DIR (optional): Where app code lives (defaults to /app in Docker)
# RGSX_CONFIG_DIR: Where config/settings/metadata live (mount to /config volume)
# RGSX_DATA_DIR: Where ROMs and data live (mount to /data volume)
#
# Structure:
# /app/RGSX/ ← APP_FOLDER (application code)
# /config/ ← CONFIG_FOLDER / SAVE_FOLDER
# ├── rgsx_settings.json ← settings file
# ├── games/ ← GAME_LISTS_FOLDER (platform game database JSONs)
# ├── images/ ← scraped metadata/covers
# ├── logs/ ← application logs
# ├── history.json ← download history
# └── ...
# /data/
# └── roms/ ← ROMS_FOLDER
# ├── snes/ ← ROMs download here, extract, delete zip
# ├── nes/
# └── ...
#
# Single Volume Mode:
# If only RGSX_CONFIG_DIR is set (no RGSX_DATA_DIR), both config and data
# will use the same directory.
# Check for Docker mode environment variables
_docker_app_dir = os.environ.get("RGSX_APP_DIR", "").strip()
@@ -134,24 +88,6 @@ else:
DATA_FOLDER = USERDATA_FOLDER
# ROMS_FOLDER - Can be customized via rgsx_settings.json
#
# The "roms_folder" setting in rgsx_settings.json supports three formats:
#
# 1. Empty string or not set:
# Uses default location:
# - Docker mode: /data/roms
# - Traditional mode: /userdata/roms
#
# 2. Absolute path (e.g., "/my/custom/roms"):
# Uses the path exactly as specified (must exist)
# Works in both Docker and Traditional modes
#
# 3. Relative path (e.g., "my_roms" or "../custom_roms"):
# Resolved relative to:
# - Docker mode: DATA_FOLDER (e.g., /data/my_roms)
# - Traditional mode: USERDATA_FOLDER (e.g., /userdata/my_roms)
#
# If the specified path doesn't exist, falls back to default.
# Default ROM location
_default_roms_folder = os.path.join(DATA_FOLDER if _is_docker_mode else USERDATA_FOLDER, "roms")
@@ -376,6 +312,7 @@ progress_font = None # Police pour l'affichage de la progression
title_font = None # Police pour les titres
search_font = None # Police pour la recherche
small_font = None # Police pour les petits textes
tiny_font = None # Police pour le footer (contrôles/version)
FONT_FAMILIES = [
"pixel", # police rétro Pixel-UniCode.ttf
"dejavu" # police plus standard lisible petites tailles
@@ -422,9 +359,11 @@ visible_games = 15 # Nombre de jeux visibles en même temps par défaut
# Options d'affichage
accessibility_mode = False # Mode accessibilité pour les polices agrandies
accessibility_settings = {"font_scale": 1.0} # Paramètres d'accessibilité (échelle de police)
accessibility_settings = {"font_scale": 1.0, "footer_font_scale": 1.0} # Paramètres d'accessibilité (échelle de police)
font_scale_options = [0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0] # Options disponibles pour l'échelle de police
current_font_scale_index = 3 # Index pour 1.0
footer_font_scale_options = [0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5] # Options pour l'échelle de police du footer
current_footer_font_scale_index = 3 # Index pour 1.0
popup_start_time = 0 # Timestamp de début d'affichage du popup
last_progress_update = 0 # Timestamp de la dernière mise à jour de progression
transition_state = "idle" # État de la transition d'écran
@@ -563,6 +502,31 @@ def init_font():
font = title_font = search_font = progress_font = small_font = None
def init_footer_font():
"""Initialise uniquement la police du footer (tiny_font) en fonction de l'échelle séparée."""
global tiny_font
footer_font_scale = accessibility_settings.get("footer_font_scale", 1.0)
# Déterminer la famille sélectionnée
family_id = FONT_FAMILIES[current_font_family_index] if 0 <= current_font_family_index < len(FONT_FAMILIES) else "pixel"
footer_base_size = 20 # Taille de base pour le footer
try:
if family_id == "pixel":
path = os.path.join(APP_FOLDER, "assets", "fonts", "Pixel-UniCode.ttf")
tiny_font = pygame.font.Font(path, int(footer_base_size * footer_font_scale))
elif family_id == "dejavu":
try:
tiny_font = pygame.font.SysFont("dejavusans", int(footer_base_size * footer_font_scale))
except Exception:
tiny_font = pygame.font.SysFont("dejavu sans", int(footer_base_size * footer_font_scale))
logger.debug(f"Police footer initialisée (famille={family_id}, scale={footer_font_scale})")
except Exception as e:
logger.error(f"Erreur chargement police footer: {e}")
tiny_font = None
def validate_resolution():
"""Valide la résolution de l'écran par rapport aux capacités de l'écran."""
if pygame is None:

View File

@@ -1415,7 +1415,7 @@ def handle_controls(event, sources, joystick, screen):
# Sous-menu Display
elif config.menu_state == "pause_display_menu":
sel = getattr(config, 'pause_display_selection', 0)
total = 8 # layout, font size, font family, unsupported, unknown, hide premium, filter, back
total = 9 # layout, font size, footer font size, font family, unsupported, unknown, hide premium, filter, back
if is_input_matched(event, "up"):
config.pause_display_selection = (sel - 1) % total
config.needs_redraw = True
@@ -1439,14 +1439,12 @@ def handle_controls(event, sources, joystick, screen):
logger.error(f"Erreur set_display_grid: {e}")
config.GRID_COLS = new_cols
config.GRID_ROWS = new_rows
# Redémarrage automatique
# Afficher popup au lieu de redémarrer
try:
config.menu_state = "restart_popup"
config.popup_message = _("popup_restarting") if _ else "Restarting..."
config.popup_timer = 2000
restart_application(2000)
restart_msg = _("popup_layout_changed_restart").format(new_cols, new_rows) if _ else f"Layout changed to {new_cols}x{new_rows}. Please restart the app to apply changes."
show_toast(restart_msg, duration=3000)
except Exception as e:
logger.error(f"Erreur restart après layout: {e}")
logger.error(f"Erreur toast après layout: {e}")
config.needs_redraw = True
# 1 font size
elif sel == 1 and (is_input_matched(event, "left") or is_input_matched(event, "right")):
@@ -1466,8 +1464,28 @@ def handle_controls(event, sources, joystick, screen):
except Exception as e:
logger.error(f"Erreur init polices: {e}")
config.needs_redraw = True
# 2 font family cycle
elif sel == 2 and (is_input_matched(event, "left") or is_input_matched(event, "right") or is_input_matched(event, "confirm")):
# 2 footer font size
elif sel == 2 and (is_input_matched(event, "left") or is_input_matched(event, "right")):
opts = getattr(config, 'footer_font_scale_options', [0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0])
idx = getattr(config, 'current_footer_font_scale_index', 3)
idx = max(0, idx-1) if is_input_matched(event, "left") else min(len(opts)-1, idx+1)
if idx != getattr(config, 'current_footer_font_scale_index', 3):
config.current_footer_font_scale_index = idx
scale = opts[idx]
config.accessibility_settings["footer_font_scale"] = scale
try:
save_accessibility_settings(config.accessibility_settings)
except Exception as e:
logger.error(f"Erreur sauvegarde footer font scale: {e}")
try:
init_footer_font_func = getattr(config, 'init_footer_font', None)
if callable(init_footer_font_func):
init_footer_font_func()
except Exception as e:
logger.error(f"Erreur init footer font: {e}")
config.needs_redraw = True
# 3 font family cycle
elif sel == 3 and (is_input_matched(event, "left") or is_input_matched(event, "right") or is_input_matched(event, "confirm")):
try:
families = getattr(config, 'FONT_FAMILIES', ["pixel"]) or ["pixel"]
current = get_font_family()
@@ -1500,8 +1518,8 @@ def handle_controls(event, sources, joystick, screen):
config.needs_redraw = True
except Exception as e:
logger.error(f"Erreur changement font family: {e}")
# 3 unsupported toggle
elif sel == 3 and (is_input_matched(event, "left") or is_input_matched(event, "right") or is_input_matched(event, "confirm")):
# 4 unsupported toggle
elif sel == 4 and (is_input_matched(event, "left") or is_input_matched(event, "right") or is_input_matched(event, "confirm")):
try:
current = get_show_unsupported_platforms()
new_val = set_show_unsupported_platforms(not current)
@@ -1511,8 +1529,8 @@ def handle_controls(event, sources, joystick, screen):
config.needs_redraw = True
except Exception as e:
logger.error(f"Erreur toggle unsupported: {e}")
# 4 allow unknown extensions
elif sel == 4 and (is_input_matched(event, "left") or is_input_matched(event, "right") or is_input_matched(event, "confirm")):
# 5 allow unknown extensions
elif sel == 5 and (is_input_matched(event, "left") or is_input_matched(event, "right") or is_input_matched(event, "confirm")):
try:
current = get_allow_unknown_extensions()
new_val = set_allow_unknown_extensions(not current)
@@ -1521,8 +1539,8 @@ def handle_controls(event, sources, joystick, screen):
config.needs_redraw = True
except Exception as e:
logger.error(f"Erreur toggle allow_unknown_extensions: {e}")
# 5 hide premium systems
elif sel == 5 and (is_input_matched(event, "confirm") or is_input_matched(event, "left") or is_input_matched(event, "right")):
# 6 hide premium systems
elif sel == 6 and (is_input_matched(event, "confirm") or is_input_matched(event, "left") or is_input_matched(event, "right")):
try:
cur = get_hide_premium_systems()
new_val = set_hide_premium_systems(not cur)
@@ -1531,15 +1549,15 @@ def handle_controls(event, sources, joystick, screen):
config.needs_redraw = True
except Exception as e:
logger.error(f"Erreur toggle hide_premium_systems: {e}")
# 6 filter platforms
elif sel == 6 and (is_input_matched(event, "confirm") or is_input_matched(event, "right")):
# 7 filter platforms
elif sel == 7 and (is_input_matched(event, "confirm") or is_input_matched(event, "right")):
config.filter_return_to = "pause_display_menu"
config.menu_state = "filter_platforms"
config.selected_filter_index = 0
config.filter_platforms_scroll_offset = 0
config.needs_redraw = True
# 7 back
elif sel == 7 and (is_input_matched(event, "confirm")):
# 8 back
elif sel == 8 and (is_input_matched(event, "confirm")):
config.menu_state = "pause_menu"
config.last_state_change_time = pygame.time.get_ticks()
config.needs_redraw = True

View File

@@ -90,7 +90,34 @@ def get_help_icon_surface(action_name: str, size: int):
def _render_icons_line(actions, text, target_col_width, font, text_color, icon_size=28, icon_gap=8, icon_text_gap=12):
"""Compose une ligne avec une rangée d'icônes (actions) et un texte à droite.
Renvoie un pygame.Surface prêt à être blité, limité à target_col_width.
Si aucun joystick n'est détecté, affiche les touches clavier entre [ ] au lieu des icônes.
"""
# Si aucun joystick détecté, afficher les touches clavier entre crochets au lieu des icônes
if not getattr(config, 'joystick', True):
# Mode clavier : afficher [Touche] : Description
action_labels = []
for a in actions:
label = get_control_display(a, a.upper())
action_labels.append(f"[{label}]")
# Combiner les labels avec le texte
full_text = " ".join(action_labels) + " : " + text
try:
lines = wrap_text(full_text, font, target_col_width)
except Exception:
lines = [full_text]
line_surfs = [font.render(l, True, text_color) for l in lines]
width = max((s.get_width() for s in line_surfs), default=1)
height = sum(s.get_height() for s in line_surfs) + max(0, (len(line_surfs) - 1)) * 4
surf = pygame.Surface((width, height), pygame.SRCALPHA)
y = 0
for s in line_surfs:
surf.blit(s, (0, y))
y += s.get_height() + 4
return surf
# Mode joystick : afficher les icônes normalement
# Charger icônes (ignorer celles manquantes)
icon_surfs = []
for a in actions:
@@ -643,7 +670,10 @@ def draw_platform_grid(screen):
if total_pages > 1:
page_indicator_text = _("platform_page").format(config.current_page + 1, total_pages)
page_indicator = config.small_font.render(page_indicator_text, True, THEME_COLORS["text"])
page_rect = page_indicator.get_rect(center=(config.screen_width // 2, config.screen_height - margin_bottom // 2))
# Positionner au-dessus du footer (réserver ~80px pour le footer)
footer_reserved_height = 80
page_y = config.screen_height - footer_reserved_height - page_indicator.get_height() - 10
page_rect = page_indicator.get_rect(center=(config.screen_width // 2, page_y))
screen.blit(page_indicator, page_rect)
# Calculer une seule fois la pulsation pour les éléments sélectionnés
@@ -1494,6 +1524,9 @@ def draw_controls(screen, menu_state, current_music_name=None, music_popup_start
control_parts = []
start_button = get_control_display('start', 'START')
# Si aucun joystick, afficher la touche entre crochets
if not getattr(config, 'joystick', True):
start_button = f"[{start_button}]"
start_text = i18n("controls_action_start")
control_parts.append(f"RGSX v{config.app_version} - {start_button} : {start_text}")
@@ -1540,6 +1573,15 @@ def draw_controls(screen, menu_state, current_music_name=None, music_popup_start
max_width = config.screen_width - 40
icon_surfs = []
# Calculer la taille des icônes en fonction du footer_font_scale
footer_scale = config.accessibility_settings.get("footer_font_scale", 1.0)
base_icon_size = 20
scaled_icon_size = int(base_icon_size * footer_scale)
base_icon_gap = 6
scaled_icon_gap = int(base_icon_gap * footer_scale)
base_icon_text_gap = 10
scaled_icon_text_gap = int(base_icon_text_gap * footer_scale)
for line_data in icon_lines:
if isinstance(line_data, tuple) and len(line_data) >= 2:
if line_data[0] == "icons_combined":
@@ -1550,7 +1592,7 @@ def draw_controls(screen, menu_state, current_music_name=None, music_popup_start
for action_tuple in all_controls:
_, actions, label = action_tuple
try:
surf = _render_icons_line(actions, label, max_width - x_pos - 10, config.font, THEME_COLORS["text"], icon_size=20, icon_gap=6, icon_text_gap=10)
surf = _render_icons_line(actions, label, max_width - x_pos - 10, config.tiny_font, THEME_COLORS["text"], icon_size=scaled_icon_size, icon_gap=scaled_icon_gap, icon_text_gap=scaled_icon_text_gap)
if x_pos + surf.get_width() > max_width - 10:
break # Pas assez de place
combined_surf.blit(surf, (x_pos, (50 - surf.get_height()) // 2))
@@ -1565,14 +1607,14 @@ def draw_controls(screen, menu_state, current_music_name=None, music_popup_start
elif line_data[0] == "icons" and len(line_data) == 3:
_, actions, label = line_data
try:
surf = _render_icons_line(actions, label, max_width, config.font, THEME_COLORS["text"], icon_size=20, icon_gap=6, icon_text_gap=10)
surf = _render_icons_line(actions, label, max_width, config.tiny_font, THEME_COLORS["text"], icon_size=scaled_icon_size, icon_gap=scaled_icon_gap, icon_text_gap=scaled_icon_text_gap)
icon_surfs.append(surf)
except Exception:
text_surface = config.font.render(f"{label}", True, THEME_COLORS["text"])
text_surface = config.tiny_font.render(f"{label}", True, THEME_COLORS["text"])
icon_surfs.append(text_surface)
else:
# Texte simple (pour la ligne platform)
text_surface = config.font.render(line_data, True, THEME_COLORS["text"])
text_surface = config.tiny_font.render(line_data, True, THEME_COLORS["text"])
icon_surfs.append(text_surface)
# Calculer hauteur totale
@@ -1954,6 +1996,11 @@ def draw_pause_display_menu(screen, selected_index):
cur_idx = getattr(config, 'current_font_scale_index', 1)
font_value = f"{opts[cur_idx]}x"
font_txt = f"{_('submenu_display_font_size') if _ else 'Font Size'}: < {font_value} >"
# Footer font size
footer_opts = getattr(config, 'footer_font_scale_options', [0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0])
footer_cur_idx = getattr(config, 'current_footer_font_scale_index', 3)
footer_font_value = f"{footer_opts[footer_cur_idx]}x"
footer_font_txt = f"{_('accessibility_footer_font_size').split(':')[0] if _ else 'Footer Font Size'}: < {footer_font_value} >"
# Font family
current_family = get_font_family()
# Nom user-friendly
@@ -1985,11 +2032,12 @@ def draw_pause_display_menu(screen, selected_index):
hide_premium_txt = f"{hide_premium_label}: < {status_hide_premium} >"
filter_txt = _("submenu_display_filter_platforms") if _ else "Filter Platforms"
back_txt = _("menu_back") if _ else "Back"
options = [layout_txt, font_txt, font_family_txt, unsupported_txt, unknown_txt, hide_premium_txt, filter_txt, back_txt]
options = [layout_txt, font_txt, footer_font_txt, font_family_txt, unsupported_txt, unknown_txt, hide_premium_txt, filter_txt, back_txt]
_draw_submenu_generic(screen, _("menu_display"), options, selected_index)
instruction_keys = [
"instruction_display_layout",
"instruction_display_font_size",
"instruction_display_footer_font_size",
"instruction_display_font_family",
"instruction_display_show_unsupported",
"instruction_display_unknown_ext",

View File

@@ -190,6 +190,7 @@
"instruction_generic_back": "Zum vorherigen Menü zurückkehren",
"instruction_display_layout": "Rasterabmessungen (Spalten × Zeilen) durchschalten",
"instruction_display_font_size": "Schriftgröße für bessere Lesbarkeit anpassen",
"instruction_display_footer_font_size": "Fußzeilen-Textgröße anpassen (Version & Steuerelemente)",
"instruction_display_font_family": "Zwischen verfügbaren Schriftarten wechseln",
"instruction_display_show_unsupported": "Nicht in es_systems.cfg definierte Systeme anzeigen/ausblenden",
"instruction_display_unknown_ext": "Warnung für in es_systems.cfg fehlende Dateiendungen an-/abschalten",
@@ -361,5 +362,7 @@
"filter_all": "Alles auswählen",
"filter_none": "Alles abwählen",
"filter_apply": "Filter anwenden",
"filter_back": "Zurück"
"filter_back": "Zurück",
"accessibility_footer_font_size": "Fußzeilen-Schriftgröße: {0}",
"popup_layout_changed_restart": "Layout geändert auf {0}x{1}. Bitte starten Sie die App neu."
}

View File

@@ -192,6 +192,7 @@
"instruction_generic_back": "Return to the previous menu",
"instruction_display_layout": "Cycle grid dimensions (columns × rows)",
"instruction_display_font_size": "Adjust text scale for readability",
"instruction_display_footer_font_size": "Adjust footer text scale (version & controls display)",
"instruction_display_font_family": "Switch between available font families",
"instruction_display_show_unsupported": "Show/hide systems not defined in es_systems.cfg",
"instruction_display_unknown_ext": "Enable/disable warning for file extensions absent from es_systems.cfg",
@@ -361,5 +362,7 @@
"filter_all": "Check All",
"filter_none": "Uncheck All",
"filter_apply": "Apply Filter",
"filter_back": "Back"
"filter_back": "Back",
"accessibility_footer_font_size": "Footer font size: {0}",
"popup_layout_changed_restart": "Layout changed to {0}x{1}. Please restart the app to apply."
}

View File

@@ -192,6 +192,7 @@
"instruction_generic_back": "Volver al menú anterior",
"instruction_display_layout": "Alternar dimensiones de la cuadrícula (columnas × filas)",
"instruction_display_font_size": "Ajustar tamaño del texto para mejor legibilidad",
"instruction_display_footer_font_size": "Ajustar el tamaño del texto del pie de página (versión y controles)",
"instruction_display_font_family": "Cambiar entre familias de fuentes disponibles",
"instruction_display_show_unsupported": "Mostrar/ocultar sistemas no definidos en es_systems.cfg",
"instruction_display_unknown_ext": "Activar/desactivar aviso para extensiones no presentes en es_systems.cfg",
@@ -361,5 +362,7 @@
"filter_all": "Marcar todo",
"filter_none": "Desmarcar todo",
"filter_apply": "Aplicar filtro",
"filter_back": "Volver"
"filter_back": "Volver",
"accessibility_footer_font_size": "Tamaño fuente pie de página: {0}",
"popup_layout_changed_restart": "Diseño cambiado a {0}x{1}. Reinicie la app para aplicar."
}

View File

@@ -192,6 +192,7 @@
"instruction_generic_back": "Revenir au menu précédent",
"instruction_display_layout": "Changer les dimensions de la grille",
"instruction_display_font_size": "Ajuster la taille du texte pour la lisibilité",
"instruction_display_footer_font_size": "Ajuster la taille du texte du pied de page (version et contrôles)",
"instruction_display_font_family": "Basculer entre les polices disponibles",
"instruction_display_show_unsupported": "Afficher/masquer systèmes absents de es_systems.cfg",
"instruction_display_unknown_ext": "Avertir ou non pour extensions absentes de es_systems.cfg",
@@ -361,5 +362,7 @@
"filter_all": "Tout cocher",
"filter_none": "Tout décocher",
"filter_apply": "Appliquer filtre",
"filter_back": "Retour"
"filter_back": "Retour",
"accessibility_footer_font_size": "Taille police pied de page : {0}",
"popup_layout_changed_restart": "Disposition changée en {0}x{1}. Veuillez redémarrer l'app pour appliquer."
}

View File

@@ -189,6 +189,7 @@
"instruction_generic_back": "Tornare al menu precedente",
"instruction_display_layout": "Scorrere dimensioni griglia (colonne × righe)",
"instruction_display_font_size": "Regolare dimensione testo per leggibilità",
"instruction_display_footer_font_size": "Regola dimensione testo piè di pagina (versione e controlli)",
"instruction_display_font_family": "Cambiare famiglia di font disponibile",
"instruction_display_show_unsupported": "Mostrare/nascondere sistemi non definiti in es_systems.cfg",
"instruction_display_unknown_ext": "Attivare/disattivare avviso per estensioni assenti in es_systems.cfg",
@@ -361,5 +362,7 @@
"filter_all": "Seleziona tutto",
"filter_none": "Deseleziona tutto",
"filter_apply": "Applica filtro",
"filter_back": "Indietro"
"filter_back": "Indietro",
"accessibility_footer_font_size": "Dimensione carattere piè di pagina: {0}",
"popup_layout_changed_restart": "Layout cambiato in {0}x{1}. Riavviare l'app per applicare."
}

View File

@@ -191,6 +191,7 @@
"instruction_generic_back": "Voltar ao menu anterior",
"instruction_display_layout": "Alternar dimensões da grade (colunas × linhas)",
"instruction_display_font_size": "Ajustar tamanho do texto para legibilidade",
"instruction_display_footer_font_size": "Ajustar tamanho do texto do rodapé (versão e controles)",
"instruction_display_font_family": "Alternar entre famílias de fontes disponíveis",
"instruction_display_show_unsupported": "Mostrar/ocultar sistemas não definidos em es_systems.cfg",
"instruction_display_unknown_ext": "Ativar/desativar aviso para extensões ausentes em es_systems.cfg",
@@ -361,5 +362,7 @@
"filter_all": "Marcar tudo",
"filter_none": "Desmarcar tudo",
"filter_apply": "Aplicar filtro",
"filter_back": "Voltar"
"filter_back": "Voltar",
"accessibility_footer_font_size": "Tamanho fonte rodapé: {0}",
"popup_layout_changed_restart": "Layout alterado para {0}x{1}. Reinicie o app para aplicar."
}

View File

@@ -53,7 +53,8 @@ def load_rgsx_settings():
"language": "en",
"music_enabled": True,
"accessibility": {
"font_scale": 1.0
"font_scale": 1.0,
"footer_font_scale": 1.5
},
"display": {
"grid": "3x4",

View File

@@ -212,7 +212,7 @@ def get_game_metadata(game_name, platform_name):
# Vérifier si des résultats ont été trouvés
if "data" not in data or "games" not in data["data"] or not data["data"]["games"]:
logger.warning(f"Aucun résultat trouvé pour '{clean_name}'")
return {"error": "Aucun résultat trouvé"}
return {"error": f"No result found for '{clean_name}'"}
# Prendre le premier résultat (meilleure correspondance)
games = data["data"]["games"]

View File

@@ -1,3 +1,3 @@
{
"version": "2.3.1.8"
"version": "2.3.1.9"
}