+
    Ki  c                   s    ^ RI t ^ RIt^ RIt^ RIHt ^ RIHt ^ RIHt ^ RI	H
t
 ]P                  P                  ]R4      tR R ltR	 R
 ltR# )i    N)	CACHE_DIR)system)get_folder_contents)loggerzbios-files.jsonc                s$    V ^8  d   QhR\         /# )   target_directoryZstrZformat   "C/usr/lib/python3.14/site-packages/lutris/util/retroarch/firmware.py__annotate__r
      s     d dc d    c           	     s    \        \        R4      ;_uu_ 4       p\        P                  ! \	        V RR7      V^R7       RRR4       R#   + '       g   i     R# ; i)zScans a target directory for firmwares and generates/updates the JSON 'firmware cache'
file with relevant details and hashes for each file within the directoryzw+T)Z	with_hash)ZindentN)openFIRMWARE_CACHE_PATHjsonZdumpr   )r   Zfirmwares_caches   & r	   scan_firmware_directoryr      s=     
!4	(	(O		%&6$Gabc 
)	(	(	(s   %AA	c                s<    V ^8  d   QhR\         R\         R\         /# )r   target_firmware_nametarget_firmware_checksumrunner_system_pathr   r   r   r	   r
   r
      s'     e es ec e_b er   c                s4   \         P                  ! \        4      '       g!   \        P                  ! R\         R24       R# \        \        4      ;_uu_ 4       p\        P                  ! V4      pRRR4       X F  pVP                  R4      V8X  g   K  \         P                  ! V4       \        P                  ! VR,          \        P                  P                  W 4      4       \        P                  ! RV  RV 24       K  	  R#   + '       g   i     L; i)zGiven a target firmware's name and checksum and the target runner's system directory, searches the
user's BIOS cache for a firmware matching the checksum and places it under the provided system directory
and namez	Firmware z not found.NZmd5_hashZnamez found and copied to )r   Zpath_existsr   r   Zerrorr   r   ZloadZgetZcreate_foldershutilZcopyfileospathjoinZinfo)r   r   r   Zbios_cache_dataZ
bios_cacheZcached_firmware_records   &&&   r	   get_firmwarer      s    
 122y!4 5[AB	!	"	"oYY/
 
# #-!%%j15MM  !34OO&v./F KK)$8#99NOaNbcd #- 
#	"s   DD	)r   r   r   Zlutris.settingsr    Zlutris.utilr   Zlutris.util.filesr   Zlutris.util.logr   r   r   r   r   r   ) r   r	   <module>r      s<     	  %  1 "ggll9.?@ der   