+
    Ki   c                   sz    ^ RI t ^ RIHt ^ RIHt ^ RIHt RtRtR t	R t
R	 tR
 tR tR tR tRR ltR tR tR# )    N)logger)"UBISOFT_REGISTRY_LAUNCHER_INSTALLS)WineRegistryNOT_INSTALLED	INSTALLEDc                 s8    \        4       pVP                  W4      # N)r   query)Zregistry_pathkeyregistry   && @/usr/lib/python3.14/site-packages/lutris/util/ubisoft/helpers.py_get_registry_value_from_pathr      s    ~H>>---    c                 sD    V '       g   \         # \        R V ,           R4      # )HKEY_LOCAL_MACHINEZInstallLocation)r   r   )special_registry_path   &r   -_return_local_game_path_from_special_registryr      s      ()=@U)UWhiir   c                 s    \         p\        4       pVP                  R V,           RV  2,           R4      p\        P                  P                  \        P                  P                  V4      4      # )r   \Z
InstallDir)r   r   r   ospathZnormcaseZnormpath)	launch_idZinstalls_pathr	   	game_paths   &   r   _return_local_game_pathr      sU    6M~H3mC9+FVVXdeI77BGG,,Y788r   c                 sR    \        V4      pV'       g   V '       d   \        V 4      pV# r   )r   r   )r   r   Zlocal_game_pathr
   r   get_local_game_pathr      s#    -i8O4GH]^r   c                 s<  "   ^ p\         P                  ! V 4       F{  w  r#pV Fo  p\         P                  P                  W%4      p\         P                  P	                  V4      '       d   KI  V\         P                  P                  V4      ,          pKq  	  K}  	  V# 5i)r    )r   Zwalkr   joinZislinkZgetsize)Z
start_pathZ
total_sizeZdirpathZ	_dirnamesZ	filenamesfZfps   &      r   get_size_at_pathr   $   sp     J)+)<%IAg)B77>>"%%bggoob11
  *=
 s   A%B,0Bc                 s    \         P                  P                  V 4      '       d=   \         P                  P                  \         P                  P	                  W4      4      # R # )F)r   r   ZisdirZisfiler   )r   Zfiles   &&r   _is_file_at_pathr   .   s8    	ww}}Tww~~bggll4677r   c                 s"    \         P                  P                  \         P                  P                  V R 4      4      '       dp   \	        \         P                  P                  V R 4      R4      ;_uu_ 4       pVP                  4       ^ ,          ^
8X  d   \        uuRRR4       # \        uuRRR4       # \        #   + '       g   i     \        # ; i  \         d2   p\        P                  ! RT \        T4      4       \        u Rp?# Rp?ii ; i)zuplay_install.stateZrbNz+Issue reading install state file for %s: %s)r   r   Zexistsr   ZopenZreadr   r   	Exceptionr   Zwarningrepr)r   r   es   &  r   _read_status_from_state_filer    4   s    	77>>"'',,y2GHIIbggll9.CDdKKq668A;$&$ LK % LK 	 LK  DiQUVWQXYsT   AC 2C 7"B:
C $B:)
C 4C :C		C C D&D	D	Dc                 sh   \         p V '       di   \        P                  ! V \        P                  4      '       d>   \	        V 4      pV\         8X  d(   V'       d    V'       d   \        W4      '       d   \        pV#   \         d-   p\        P                  ! R T \        T4      4        Rp?T# Rp?ii ; i)z-Error reading game installed status at %s, %sN)r   r   ZaccessZF_OKr    r   r   r   r   Zerrorr   )r   Zexer   Zstatusr   s   &&&  r   get_game_installed_statusr!   A   s    FUBIIdBGG,,1$7F&33H#D..&F M  UDdDQRGTTMUs-   A: *A: A: A: !A: :B1!B,,B1c                s    V'       g   R# VP                  R4      '       d2   VP                  R^R7      w  r#\        V4      pV P                  W#4      # V# )z9Get a value from the registry in a Ubisoft Connect prefixZ ZHKEYr   )Zmaxsplit)Z
startswithZrsplitconvert_ubisoft_keyZget_registry_key)ZprefixZfullpathr   r   s   &&  r   get_ubisoft_registryr#   O   sM    6""OOD1O5	"4(&&t11Or   c                s    RV 9   d   V P                  RR4      p V P                  RR4      p V P                  RR4      p V # )z4Convert Ubisoft registry keys for Wine compatibilityZLOCAL_MACHINEz	SOFTWARE\zSoftware\Wow6432Node\z\UBISOFTz\Ubisoftr   Z/)Zreplace)Zkey_pathr   r   r"   r"   Z   sF    ("##L2KL[9Hc*HOr   )NN)r   Zlutris.util.logr   Zlutris.util.ubisoft.constsr   Zlutris.util.wine.registryr   r   r   r   r   r   r   r   r   r    r!   r#   r"   ) r   r   <module>r$      sN    	 " I 2	.
j9
r   