+
    Ki  c                   s~    R t ^ RIt^ RIt^ RIt^ RIHtHt ^ RIHt ^ RI	H
t
 ^ RIHt R tR tR t]R	 4       tR
 tR# )z@Transform runner parameters to data usable for runtime executionN)cache_singlesystem)GPUS)LINUX_SYSTEM)loggerc                s    V P                  R4      '       d   R# V P                  R4      '       d&   \        P                  ! R4      '       d
   R.RRRR/3# R# )zGReturn correct launch arguments and environment variables for Mangohud.	gamescopemangohudZMANGOHUD1ZMANGOHUD_DLSYM)NN)getr   can_find_executable)system_configs   &>/usr/lib/python3.14/site-packages/lutris/runner_interpreter.pyget_mangohud_confr      sY     %%$$)C)CJ)O)O|j#/?EEE    c                 s   V P                   pVR ,          p/ pV P                  R8X  d   \        P                  ! R4       M.\	        V4      w  rVV'       d   WS,           pVP                  V4       VP                  R4      ;'       g    RpV'       d;   \        P                  ! \        P                  P                  V4      4      V,           pVP                  R4      ;'       g    RpV'       d   VP                  R4      p	V	'       d#   V	P                  4       '       d   \        V	4      p	M^p	\        ^V	4      p	\        P                  ! RV	4       VP                  ^ R	V	^,
          ,          4       VP                  ^ R
4       VP                  ^ R4       VP                  V P!                  4       4       TP                  VP                  R4      ;'       g    / 4       VP                  R4      p
V
'       d   WR&   VP                  R4      pV'       d?   VP                  R4      p\        P"                  P%                  \'        RW.4      4      VR&   VP                  R4      ;'       d    \(        P*                  ! 4       pV'       d   VP                  ^ R4       VP                  R4      ;'       d    \,        P.                  ! R4      pV'       d(   \1        W24      pVP                  R4      '       d   RVR&   W43# )commandZsteamzwDo not enable Mangodhud for Steam games in Lutris.Edit the launch options in Steam and set them to mangohud %%command%%prefix_commandZ 
single_cpuFlimit_cpu_countz#The game will run on %d CPU core(s)z0-%dz-cZtasksetenv
ld_preloadZ
LD_PRELOADld_library_pathZLD_LIBRARY_PATHNgamemodeZgamemoderunr   gamescope_hdrr   ZDXVK_HDR)r
   namer   Zinfor   Zupdater   shlexsplitosZpathZ
expandvarsZ	isnumericZintZmaxinsertZget_envZpathsepjoinZfilterr   Zgamemode_availabler   r	   get_gamescope_args)runnergameplay_infor
   launch_argumentsr   Z
mango_argsZ	mango_envr   r   r   r   Zgame_ld_library_pathr   r   Zhas_gamescopes   &&             r   get_launch_parametersr!      sk   ((M$Y/
C {{gT	

 !2- @
)<JJy!"&&'78>>BN ;;rww'9'9.'IJM]]""<099EJ'++,=>88::!/2OOa19?K6_q-@#AB4(9-JJv~~ JJ}  '--2.
 ""<0J&L ),,->?''"34!#?S>e1f!g   ,RR1P1P1RH=1 "%%k2^^v7Q7QR]7^M-.>N_--!C
O  r   c                sB   V P                  ^ R4       VP                  R4      '       d   V P                  ^ R4       VP                  R4      '       d9   V P                  ^ VR,          4       V P                  ^ R4       \        4       V R&   VP                  R4      '       d&   \        P                  ! VR,          4      pW ,           p VP                  R4      '       d   VR,          pV P                  ^ V4       VP                  R	4      '       d.   VR	,          pV P                  ^ V4       V P                  ^ R
4       VP                  R4      '       dq   VR,          P                  4       P	                  R4      w  rVV P                  ^ V4       V P                  ^ R4       V P                  ^ V4       V P                  ^ R4       VP                  R4      '       dq   VR,          P                  4       P	                  R4      w  rxV P                  ^ V4       V P                  ^ R4       V P                  ^ V4       V P                  ^ R4       \        \        4      ^8  d]   VP                  R4      \        9   dC   \        VR,          ,          p	V P                  ^ V	P                  4       V P                  ^ R4       VP                  R4      '       d   V P                  ^ R4       VP                  R4      '       d   V P                  ^ R4       V P                  ^ R4       V # )z5Insert gamescope at the start of the launch argumentsz--Zgamescope_force_grab_cursorz--force-grab-cursorZgamescope_fsr_sharpnessz--fsr-sharpness:    r"   Ngamescope_flagsgamescope_window_modegamescope_fps_limiterz-rZgamescope_output_resZxz-Hz-WZgamescope_game_resz-hz-wgpuz--prefer-vk-devicer   z--hdr-enabledr   z
--mangoappr   )	r   r   _get_gamescope_fsr_optionr   r   ZlowerZlenr   Zpci_id)
r    r
   r#   r$   r%   Zoutput_widthZoutput_heightZ
game_widthZgame_heightr&   s
   &&        r   r   r   Z   s   At$677#89233=1J#KL#45 9 ;*++++m4E&FG*=011 -.E F#89011 -.E F#894(/00&34J&K&Q&Q&S&Y&YZ]&^#=14(<04(-.."/0D"E"K"K"M"S"STW"X
;/4(:.4(
4y1}**51T9='(3::.#78))?3$$<0A{+r   c                 s    \         P                  ! R4      '       d.   \         P                  ! RR.4      w  rW,           pRV9   d   RR.# R.# )zReturns a list containing the arguments to insert to trigger FSR in gamescope;
this changes in later versions, so we have to check the help output. There seems to be
no way to query the version number more directly.r   z--helpz-F, --filterz-FZfsrz-U)r   r	   Zexecute_with_error)ZstdoutZstderrZ	help_texts      r   r'   r'      sN    
 !!+..22K3JKO	Y&%=  6Mr   c           	     s   V P                  4        \        W4      w  r4RVR&   RpVR,          pVP                  4        F  w  rgVRV: RV: R2,          pK  	  RV9   d5   VR	,          pVR
\        P                  ! VR,          4      ,          ,          pVR,          pTRP                  V Uu. uF  p\        P                  ! V4      NK  	  up4      ,          p\        VRRR7      ;_uu_ 4       p	V	P                  V4       RRR4       \        P                  ! V\        P                  ! V4      P                  \        P                  ,          4       R# u upi   + '       g   i     La; i)z/Convert runner configuration into a bash scriptZxtermZTERMz#!/bin/bash


z# Environment variables
zexport z="z"
Zworking_dirz
# Working Directory
zcd %s
z
# Command
Z Zwzutf-8)ZencodingN)Z	prelaunchr!   Zitemsr   Zquoter   ZopenZwriter   ZchmodstatZst_modeZS_IEXEC)
r   r   Zscript_pathr   r   Zscript_contentr   ZvalueZcZscript_files
   &&&       r   export_bash_scriptr)      s   
(?LGCK(N11Nyy{e<< # %33)ekk-2N&OOOo%Nchh@1A@AAN	k3	1	1[.) 
2 HH["''+.66EF  A	1	1s   -E
/EE*	)Z__doc__r   r   r(   Zlutris.utilr    r   Zlutris.util.graphics.gpur   Zlutris.util.linuxr   Zlutris.util.logr   r   r!   r   r'   r)   ) r   r   <module>r*      sI    F 	   , ) * "@!F(V  Gr   