+
    Ki  c                   s~   R t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHt	 ^ RI
HtHtHtHtHtHtHt ^ RIHtHtHt ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ R	IHt ^ R
I H!t! ^ RI"H#t#H$t$H%t% ^ RI&H't' ^ RI(H)t) ^ RI*H+t+ ^ RI,H-t-H.t. ^ RI/H0t0H1t1 ^ RI2H3t3H4t4 ^ RI5H6t6H7t7H8t8H9t9H:t:H;t;H<t<H=t= ^ RI>H?t?H@t@HAtAHBtBHCtC ^ RIDHEtE ^ RIFHGtG ^ RIHHItIHJtJ ^ RIKHLtM ^ RINHOtO ^ RIPHQtQ ^ RIRHStS ]'       d   ^ RITHUtU ^ RIVHWtW RtX]'! 4       tY]'! 4       tZ]'! 4       t[]'! 4       t\]'! 4       t]]'! 4       t^ ! R R4      t_R  R! lt`R" R# ltaR# )$z$Module that actually runs the games.N)gettext)TYPE_CHECKINGAnyDictListOptionalUnioncast)GioGLibGtk)settingsLutrisConfig)
categories)games)sql)watch_game_errors)GameConfigErrorInvalidGameMoveErrorMissingExecutableError)NotificationSource)InstallationKind)MonitoredCommand)export_bash_scriptget_launch_parameters)import_runneris_valid_runner_name)Runnerkill_processes)busydiscordextractjobslinuxstringssystemxdgshortcuts)DISPLAY_MANAGERSCREEN_SAVER_INHIBITORdisable_compositingenable_compositingis_display_x11)turn_off_except)LINUX_SYSTEM)LOG_BUFFERSlogger)remove_shortcut)fix_path_case)Timer)write_yaml_to_file)LutrisApplication)LaunchUIDelegatei  c                   sX  a a ] tR t^;t oRt]P                  P                  ]P                  R4      t
RtRtRtRtRV3R lV 3R lllt]V3R	 lR
 l4       tV3R lR ltV3R lR lt]V3R lR l4       t]V3R lR l4       t]V3R lR l4       tV3R lR ltV3R lR ltRV3R lR lltRV3R lR llt]V3R lR l4       tV3R  lR! lt]V3R" lR# l4       tV3R$ lR% lt]V3R& lR' l4       t ]V3R( lR) l4       t!V3R* lR+ lt"V3R, lR- lt#V3R. lR/ lt$V3R0 lR1 lt%]V3R2 lR3 l4       t&]&PN                  V3R4 lR5 l4       t&V3R6 lR7 lt(]V3R8 lR9 l4       t)])PN                  V3R: lR; l4       t)]V3R< lR= l4       t*]V3R> lR? l4       t+]+PN                  V3R@ lRA l4       t+V3RB lRC lt,V3RD lRE lt-V3RF lRG lt.V3RH lRI lt/RV3RJ lRK llt0V3RL lRM lt1V3RN lRO lt2RV3RP lRQ llt3V3RR lRS lt4V3RT lRU lt5V3RV lRW lt6V3RX lRY lt7V3RZ lR[ lt8RV3R\ lR] llt9V3R^ lR_ lt:V3R` lRa lt;V3Rb lRc lt<V3Rd lRe lt=V3Rf lRg lt>]?! RRh7      V3Ri lRj l4       t@]?! RRh7      V3Rk lRl l4       tAV3Rm lRn ltBV3Ro lRp ltCRV3Rq lRr lltDV3Rs lRt ltEV3Ru lRv ltFV3Rw lRx ltGV3Ry lRz ltH]?! RRh7      V3R{ lR| l4       tIV3R} lR~ ltJV3R lR ltKV3R lR ltLV3R lR ltMRV3R lR lltNV3R lR ltOV3R lR ltPRtQVtRV ;tS# )GamezOThis class takes cares of loading the configuration for a game
and running it.
znow-playing.txtZstoppedZ	launchingZrunningz	(primary)c                s0   < V ^8  d   QhRS[ S[,          /# )   game_id)r   strformat__classdict__   "0/usr/lib/python3.14/site-packages/lutris/game.py__annotate__Game.__annotate__H   s     62 62 62    c                s   < \         SV `  4        \        4       V n        V'       d   \	        V4      MR V n        \        P                  ! VR4      pVP                  R4      ;'       g    RV n	        VP                  R4      ;'       g    RV n
        VP                  R4      ;'       g    RV n        VP                  R4      ;'       g    RV n        VP                  R4      ;'       g    RV n        VP                  R4      ;'       g    RV n        \        VP                  R	4      ;'       d    V P                  4      V n        VP                  R
4      ;'       g    RV n        VP                  R4      ;'       g    RV n        VP                  R4      ;'       g    ^ V n        \)        4       V n        VP                  R4      '       d   V P*                  P-                  R4       VP                  R4      '       d   V P*                  P-                  R4       VP                  R4      '       d   V P*                  P-                  R4       VP                  R4      V n        VP                  R4      V n         \3        VP                  R4      ;'       g    R4      V n        VP                  R4      V n        R V n        R V n         R V n!        R V n"        R V n#        R V n$        R V n%        R V n&        R V n'        V PP                  V n)        / V n*        RV n+        RV n,        R V n-        R V n.        \_        4       V n0        R V n1        R #   \6         dD   p\8        P:                  ! RTP                  R4      T P                  T4       RT n         R p?LR p?ii ; i)Nidslug runner	directorynamesortname
configpath	installedplatformyear
lastplayedhas_custom_bannerbannerhas_custom_iconiconhas_custom_coverart_bigcoverart_bigservice
service_idplaytimeg        z-Unable to parse playtime '%s' for game %s: %s
discord_idF)2Zsuper__init__r   
game_errorr8   _idgames_dbget_game_by_fieldgetrB   _runner_namerE   rF   rG   game_config_idboolis_installedrJ   rK   rL   setcustom_imagesaddrS   appidfloatrU   
ValueErrorr.   	exceptionrV   _config_runner	game_uuidgame_threadantimicro_threadprelaunch_pidsprelaunch_executor	heartbeat
killswitchSTATE_STOPPEDstategame_runtime_configresolution_changedcompositor_disabledoriginal_outputs_log_bufferr1   timerscreen_saver_inhibitor_cookie)selfr7   	game_dataex	__class__s   &&  r=   rW   ZGame.__init__H   s   ,.#*3w< ..w=	MM&)//R	%MM(399r"{399rMM&)//R	!j177R'mmL9??R {!;!S!S@S@ST!j177RMM&)//R	#--5:: U==,--""8,==*++""6*==233"">2 }}Y/]]<0
	 !)--
";"B"BsCDM
 $--5 $""&''
#% "'#(  $W
-1*/  	 Limm\fNgimirirtvwDMM	 s   5L? L? ?N
9NNc                sX   < V ^8  d   QhRS[ S[S[S[S[3,          3,          RS[RS[/# )r6   db_gamerS   return)r   r8   r   intr   r9   r<   r=   r>   r?      s6      4U38_0D+E PS X[ r@   c                s*   \        4       pV R,          Vn        VP                  V 4      Vn        VP	                  V 4      Vn        RV 9   d   V R,          Vn        MV'       d   V R,          Vn        V'       d   VP                  Vn        V# RVn        V# )zCreates a Game from the database data from ServiceGameCollection, which is
not a real game, but which can be used to install. Such a game has no ID, but
has an 'appid' and slug.rF   rT   rd   N)	r5   rF   Zget_installed_slugrB   Zget_installed_runner_namerunner_namerd   rA   rS   )r~   rS   game   && r=   create_empty_service_gameZGame.create_empty_service_game   s~    
 vFO	..w7	"<<WE7" .DJ )DJ%,wzz 37r@   c                    < V ^8  d   QhRS[ /# r6   r   r8   r9   r<   r=   r>   r?      s      # r@   c                "    V P                  4       # N)__str__rz      &r=   __repr__ZGame.__repr__   s    ||~r@   c                r   r   r   r9   r<   r=   r>   r?      s       r@   c                s    V P                   ;'       g    R pV P                  '       d   VRV P                  ,          ,          pV# )zGame (no name)z (%s))rF   r   rz   value   & r=   r   ZGame.__str__   s:    		---Wt////Er@   c                r   r   r   r9   r<   r=   r>   r?      s     # #C #r@   c                s    V P                   '       g"   \        P                  ! R V P                  4       \	        \
        V P                   4      # )z:The game '%s' has no ID, it is not stored in the database.)rY   r.   errorrF   r   r8   r   r   r=   rA   ZGame.id   s2    xxxLLUW[W`W`aC""r@   c                r   r   r_   r9   r<   r=   r>   r?      s      d r@   c                s,    \        V P                  4      # )zETrue if this Game has an ID, which means it is saved in the database.)r_   rY   r   r   r=   is_db_storedZGame.is_db_stored   s     DHH~r@   c                r   r   r   r9   r<   r=   r>   r?      s     G Gd Gr@   c                sH    V P                   ;'       d    V P                  R9   # )z'Return whether the game can be upgraded)ZgogZitchio)r`   rS   r   r   r=   is_updatableZGame.is_updatable   s"       FFT\\5F%FFr@   c                s@   < V ^8  d   QhRS[ S[S[,          ,          /# r   )r   r   r8   r9   r<   r=   r>   r?      s      Z ZXc] 3 Zr@   c                sj    V P                   '       d!   \        P                  ! V P                  4      # . # )z%Return the categories the game is in.)r   categories_dbZget_categories_in_gamerA   r   r   r=   get_categoriesZGame.get_categories   s(    @D@Q@Q@Q}33DGG<YWYYr@   c                s*   < V ^8  d   QhRS[ RS[ RR/# )r6   added_category_namesremoved_category_namesr   N)listr9   r<   r=   r>   r?      s$        4  Y]  bf  r@   c                s    V F  pV P                  VRR7       K  	  V F  pV P                  VRR7       K  	  \        P                  V 4       R# )zadd to / remove from categoriesT	no_signalN)add_categoryremove_categoryGAME_UPDATEDfire)rz   r   r   Zadded_category_nameZremoved_category_name   &&&  r=   update_game_categoriesZGame.update_game_categories   sR    #71TB $8 &<!  !6$ G &< 	$r@   Fc                $   < V ^8  d   QhRS[ RR/# r6   category_namer   Nr   r9   r<   r=   r>   r?      s     $ $# $4 $r@   c                s4   V P                   '       g   \        R4      h\        P                  ! V4      pVf   \        P                  ! V4      pM	VR,          p\        P
                  ! V P                  V4       V'       g   \        P                  V 4       R# R# )zadd game to categoryz7Games that do not have IDs cannot belong to categories.NrA   )	r   RuntimeErrorr   get_category_by_namer   Zadd_game_to_categoryrA   r   r   rz   r   r   ZcategoryZcategory_idr   r=   r   ZGame.add_category   ss       XYY 55mD'44]CK"4.K**477K@d# r@   c                r   r   r   r9   r<   r=   r>   r?      s     $ $S $d $r@   c                s    V P                   '       g   R# \        P                  ! V4      pVf   R# VR,          p\        P                  ! V P                  V4       V'       g   \
        P                  V 4       R# R# )zremove game from categoryNrA   )r   r   r   Zremove_category_from_gamerA   r   r   r   r   r=   r   ZGame.remove_category   s]        55mDtn//Ed# r@   c                r   r   r   r9   r<   r=   r>   r?      s     3 3T 3r@   c                (    RV P                  4       9   # )2Return whether the game is in the user's favoritesfavoriter   r   r   r=   is_favoriteZGame.is_favorite   s     T00222r@   c                r   )r6   r   r   Nr   r9   r<   r=   r>   r?      s     1 1D 1T 1r@   c                    V P                   \        V4      8w  d/   V'       d   V P                  R4       R# V P                  R4       R# R# )zwPlace the game in the favorite's category, or remove it.
This change is applied at once, and does not need to be saved.r   N)r   r_   r   r   )rz   r      &&r=   mark_as_favoriteZGame.mark_as_favorite   s;     tK00!!*-$$Z0	 1r@   c                r   r   r   r9   r<   r=   r>   r?      s     2 24 2r@   c                r   )r   .hiddenr   r   r   r=   	is_hiddenZGame.is_hidden   s     D//111r@   c                r   )r6   r   r   Nr   r9   r<   r=   r>   r?      s     0 0 0 0r@   c                r   )zsPlace the game in the hidden category, or remove it.
This change is applied at once, and does not need to be saved.r   N)r   r_   r   r   )rz   r   r   r=   mark_as_hiddenZGame.mark_as_hidden   s8     >>T)_,!!),$$Y/	 -r@   c                s4   < V ^8  d   QhRS[ P                  /# r   )r
   
TextBufferr9   r<   r=   r>   r?      s      CNN r@   c                s   \         P                  ! V P                  4      pV'       d   V# \        P                  ! 4       pVP                  RRR7       V P                  '       dK   V P                  P                  V P                  4       VP                  V P                  P                  4       V\         V P                  &   V# )z6Access the log buffer object, creating it if necessarywarningZred)Z
foreground)r-   r\   rA   r
   r   Z
create_tagrk   Zset_log_bufferrw   Zset_textstdout)rz   rw   r   r=   
log_bufferZGame.log_buffer   s     "oodgg.nn&yU;++D,<,<=  !1!1!8!89*DGGr@   c                r   r   r   r9   r<   r=   r>   r?     s     = =C =r@   c                sB    \         P                  ! V P                  4      # )z+Return a human-readable formatted play time)r#   Zget_formatted_playtimerU   r   r   r=   formatted_playtimeZGame.formatted_playtime   s     --dmm<<r@   c                r   r6   r   r   N)r   r9   r<   r=   r>   r?     s     
3 
3# 
3$ 
3r@   c                s    V P                   P                  '       d   V P                   P                  V4       R# \        P                  W4       R# )zReports an error by firing game_error. If there is no handler for this,
we fall back to the global GAME_UNHANDLED_ERROR.

This allows special error handling to be set up for a particular Game, but
there's always some global handling.N)rX   Zhas_handlersr   GAME_UNHANDLED_ERROR)rz   r   r   r=   signal_errorZGame.signal_error  s4     ??'''OO  ' %%d2r@   c                r   r   r   r9   r<   r=   r>   r?     s     ( ( (r@   c                r   )z5Return the path to open with the Browse Files action.)resolve_game_pathr   r   r=   get_browse_dirZGame.get_browse_dir  s    %%''r@   c                r   r   r   r9   r<   r=   r>   r?     s      3 r@   c                s    V P                   '       d*   \        P                  P                  V P                   4      # V P                  '       d   V P
                  P                  4       # R# )zReturn the game's directory; if it is not known this will try to find
it. This can still return an empty string if it can't do that.rC   )rE   ospath
expanduser
has_runnerrD   r   r   r   r=   r   ZGame.resolve_game_path  sE     >>>77%%dnn55???;;0022r@   c                r   r   r   r9   r<   r=   r>   r?     s     , ,# ,r@   c                s    V P                   '       d/   V P                  P                  ;'       g    V P                  4       # V P                  4       # )zhReturns a working directory- if we can't get one from the runner,
we'll use the game path as a fallback.)r   rD   working_dirr   r   r   r=   find_working_dirZGame.find_working_dir  s=     ???;;**FFd.D.D.FF))++r@   c                s4   < V ^8  d   QhRS[ S[R3,          /# r6   r   N)r   r   r9   r<   r=   r>   r?   '  s      lD01 r@   c                s    V P                   '       d   V P                  '       g   R # V P                  '       g'   \        V P                  V P                  R7      V n        V P                  # )N)Zrunner_slugr^   )r`   r^   rh   r   r   r   r   r=   configGame.config&  sJ       (;(;(;|||'D4D4DUYUhUhiDL||r@   c                r   r6   r   r   Nr   r9   r<   r=   r>   r?   /  s     7 7L 7T 7r@   c                sV    Wn         R V n        V'       d   VP                  V n        R # R # r   )rh   ri   r^   r   r   r=   r   r   .  s$    "'"6"6D r@   c                   < V ^8  d   QhRR/# r    r9   r<   r=   r>   r?   5  s      t r@   c                s"    RV n         RV n        R# )zzTriggers the config to reload when next used; this also reloads the runner,
so that it will pick up the new configuration.N)rh   ri   r   r   r=   reload_configZGame.reload_config5  s     r@   c                r   r   r   r9   r<   r=   r>   r?   <  s     ! !S !r@   c                s    V P                   # r   )r]   r   r   r=   r   Game.runner_name;  s       r@   c                r   r   r   r9   r<   r=   r>   r?   @  s            r@   c                s    T;'       g    R V n         V P                  '       d'   V P                  P                  V8w  d
   RV n        R# R# R# )rC   N)r]   ri   rF   r   r   r=   r   r   ?  s8    !KKR<<<DLL--6DL 7<r@   c                r   r   r   r9   r<   r=   r>   r?   F  s     S SD Sr@   c                sf    \        V P                  ;'       d    \        V P                  4      4      # r   )r_   r]   r   r   r   r=   r   ZGame.has_runnerE  s'    D%%QQ*>t?P?P*QRRr@   c                r   r   r   r9   r<   r=   r>   r?   J  s     * * *r@   c                s    V P                   '       g   \        \        R 4      4      hV P                  '       g-   \	        V P
                  4      pV! V P                  4      V n        \        \        V P                  4      # )*Invalid game configuration: Missing runner)	r   r   _ri   r   r   r   r   r   )rz   Zrunner_classr   r=   rD   Game.runnerI  sV    !!$P"QRR|||()9)9:L'4DLFDLL))r@   c                r   r   r   r9   r<   r=   r>   r?   T  s     + +F +t +r@   c                sH    Wn         V'       d   VP                  V n        R # R # r   )ri   rF   r]   r   r   r=   rD   r   S  s     %

D r@   c                r   )r6   enabler   Nr   r9   r<   r=   r>   r?   Y  s     	0 	0d 	0t 	0r@   c                s    V'       d(   V P                   '       d   \        4        RV n         R# R# V P                   '       g   \        4        RV n         R# R# )zEnables or disables compositingFTN)ru   r)   r(   )rz   r   r   r=   set_desktop_compositingZGame.set_desktop_compositingY  sE    '''"$+0( ( +++#%+/( ,r@   c                s"   < V ^8  d   QhRRRR/# )r6   launch_ui_delegater4   r   Nr   r9   r<   r=   r>   r?   d  s     , ,*< , ,r@   c                sV   V P                   '       g   \        RV ,          4      hV P                  '       d   V P                  R8X  d=   \        P                  P                  4       pVP                  V P                   R7       R# VP                  V P                  4      pVP                  V 4      pV'       gi   \        P                  ! RV P                  VP                  4       \        P                  P                  4       pVP                  V P                   R7       R#  VP                  V4      pV'       d@   R R lp\        V4      pVP                  P!                  V4       VP#                  V4       R# R#   \         d#   p\        P                  ! T4       Rp Rp?LqRp?ii ; i)zRequest installation of a gamezInvalid game passed: %slutris)Z	game_slugNz>Can't find %s for %s, trying to fall back to Lutris installersc                s(    V ^8  d   QhR\         RR/# r   )ZBaseExceptionr:      "r=   r>   Z"Game.install.<locals>.__annotate__~  s     F F F$ Fr@   c                 s4    \         P                  ! R V 4       R# )zUnable to install game: %sN)r.   rg   )r   r   r=   on_errorZGame.install.<locals>.on_error~  s      !=uEr@   )rB   rf   rS   r   Applicationget_defaultZshow_lutris_installer_windowget_serviceZget_service_db_gamer.   r   rF   installdebugr5   rX   Zregisterlaunch)	rz   r   applicationrS   r~   r7   Zer   r   s	   &&       r=   r   ZGame.installd  s9   yyy6=>>|||t||x7/2/J/J/LK44tyy4I$00>--d3LLY[_[d[dfmfrfrs/2/J/J/LK44tyy4I	oog.G
 F =DOO$$X.KK*+ 	  	LLOG	s   !E; ;F(F##F(c                $   < V ^8  d   QhRRRS[ /# r6   install_ui_delegater4   r   r   r9   r<   r=   r>   r?     s      3E $ r@   c                s   a a VP                  S P                  4      o\        P                  ! S P                  R 4      pV V3R lp\
        P                  ! SP                  W24       R# )rA   c                    < V'       d   VhV '       g   \        \        R 4      4      h\        P                  P	                  4       pVP                  V SSP                  \        P                  R7       R# )zNo updates foundZinstallation_kindN)	r   r   r   r   r   show_installer_windowrd   r   ZUPDATEZ
installersr   r   rz   rS      && r=   on_installers_readyZ1Game.install_updates.<locals>.on_installers_ready  sX    "1%7#899//557K--GTZZCSCZCZ . r@   T)r   rS   rZ   r[   rA   r   BusyAsyncCallZget_update_installersrz   r   r~   r   rS      f&  @r=   install_updatesZGame.install_updates  sN    %11$,,?,,TWWd;
	 	788:MWr@   c                r   r   r   r9   r<   r=   r>   r?     s      /A d r@   c                s   a a VP                  S P                  4      o\        P                  ! S P                  R 4      pV V3R lp\
        P                  ! SP                  W2VR,          4       R# )rA   c                 r   )zNo DLC foundr   N)	r   r   r   r   r   r   rd   r   ZDLCr   r   r=   r   Z-Game.install_dlc.<locals>.on_installers_ready  sR    "1^#455//557K--j'4::aqauau-vr@   rD   T)r   rS   rZ   r[   rA   r   r   Zget_dlc_installers_runnerr   r   r=   install_dlcZGame.install_dlc  sX    %11$,,?,,TWWd;	w 	7<<>Q\cdl\mnr@   c                r   )r6   delete_filesr   Nr   r9   r<   r=   r>   r?     s     V Vd Vt Vr@   c                s   \         P                  ! \        P                  RR^ RR/RV P                  /4       V P
                  '       d   V P
                  P                  4        \        P                  ! V P                  V P                  RRR7       \        V 4       V'       dD   V P                  '       d2   V P                  P                  V P                  V P                  R7       R	V n        R
V n        R
V n        V P                  \&        9   dH   \&        V P                  ,          pVP)                  VP+                  4       VP-                  4       4       R
# R
# )zqUninstall a game, but do not remove it from the library.

Params:
    delete_files (bool): Delete the game files
r   rI   rD   rC   rA   T)ZdesktopZmenu)Zapp_id	game_pathFN)r   Z	db_updater   ZDB_PATHrA   r   Zremover%   Zremove_launcherrB   remove_steam_shortcutr   rD   Zremove_game_datard   rE   r`   rh   ri   r-   deleteget_start_iterget_end_iter)rz   r   r   r   r=   	uninstallZGame.uninstall  s     	h&&+q(B1ORVX\X_X_Q`a;;;KK $$TYYDQd#DOOO KK((

dnn(U!77k!$TWW-Jj779:;R;R;TU "r@   c                r   r   r   r9   r<   r=   r>   r?     s       r@   c                s    V P                   '       d   \        \        R4      4      h\        P                  ! V P
                  4       RV n        R# )z:Delete a game from the library; must be uninstalled first.z"Uninstall the game before deletingN)r`   r   r   rZ   Zdelete_gamerA   rY   r   r   r=   r   ZGame.delete  s8    q!EFGGTWW%r@   c                r   r   r   r9   r<   r=   r>   r?     s     ` `$ `r@   c                s(   \        V R4      '       d   V P                  '       g   \        P                  ! R4       R# V P                  P                  4       V n        V P                  '       g%   \        P                  ! RV P                  V 4       R# R# )z'Set the game's platform from the runnerr   z&Game has no runner, can't set platformNz.The %s runner didn't provide a platform for %s)hasattrr   r.   r   rD   Zget_platformrJ   r   r   r=   set_platform_from_runnerZGame.set_platform_from_runner  s_    t\**$///NNCD002}}}NNKT[[Z^_ r@   c                r   )r6   r   r   Nr   r9   r<   r=   r>   r?     s     #$ #$d #$t #$r@   c                s   V P                   '       d]   V P                   P                  p\        P                  ! RW P                   P                  4       V P                   P	                  4        M\        P
                  ! RV 4       RpV P                  4        / RV P                  bRV P                  bRV P                  bRV P                  bRV P                  bR	V P                  bR
V P                  bRV P                  bRV P                  bRVbRV P                   bRV P"                  bRV P$                  bRV P&                  bRV P(                  bRRV P*                  9   bRRV P*                  9   bRRV P*                  9   /Cp\-        \.        P0                  ! R/ VB 4      V n        V'       g   \4        P7                  V 4       R# R# )z&
Save the game's config and metadata.
zSaving %s with config ID %sz(Saving %s with the configuration missingrC   rF   rG   rD   rB   rJ   rE   rI   rK   rL   rH   rA   rU   rS   rT   rV   rM   rN   rO   rP   rQ   rR   Nr   )r   r^   r.   r   saver   r   rF   rG   r   rB   rJ   rE   r`   rK   rL   rA   rU   rS   rd   rV   rb   r8   rZ   Zadd_or_updaterY   r   r   )rz   r   rH   r{      &&  r=   r   Z	Game.save  s    ;;;33JLL6kk>X>XYKKNNEtLJ%%'
DII

 d&&
 DII	

 
 
 **
 DII
 $//
 *
 $''
 
 t||
 $**
 $//
   T-?-?!?!
" v););;#
$ &~9K9K'K%
	( x--:	:;d# r@   c                r   r   r   r9   r<   r=   r>   r?     s        t  r@   c                s    \         P                  ! V P                  V P                  V P                  R7       \
        P                  V 4       R# )zjSave only the platform field- do not restore any other values the user may have changed
in another window.)rA   rB   rJ   N)rZ   update_existingrA   rB   rJ   r   r   r   r   r=   save_platformZGame.save_platform  s0     	  DGG$))dmmT$r@   c                r   r   r   r9   r<   r=   r>   r?     s          r@   c                s    \         P                  ! V P                  V P                  V P                  V P
                  R7       \        P                  V 4       R# )zlSave only the lastplayed field- do not restore any other values the user may have changed
in another window.)rA   rB   rL   rU   N)rZ   r   rA   rB   rL   rU   r   r   r   r   r=   save_lastplayedZGame.save_lastplayed  s9     	  DGG$))bfbobop$r@   c                r   r   r   r9   r<   r=   r>   r?     s      $ r@   c                s   V P                   '       d   V P                  '       g6   \        P                  ! RW P                  4       \        \        R4      4      hV P                  '       g   \        \        R4      4      hR# )zKVerify that the current game can be launched, and raises exceptions if not.z%s (%s) not installedz,Tried to launch a game that isn't installed.r   T)r`   r   r.   r   rA   r   r   r   r   r   r=   check_launchableZGame.check_launchable  sZ       (9(9(9LL0$@!!$R"STT!!$P"QRRr@   c                s&   < V ^8  d   QhRS[ RS[/# )r6   displayr   )r8   r_   r9   r<   r=   r>   r?     s      3 4 r@   c                s   \         P                  ! 4       pVR 8X  dK   RpV F#  pVP                  '       g   K  VP                  p M	  V'       g   \        P
                  ! R4       MARpV F  pVP                  V8X  g   K  Rp M	  V'       g   \        P
                  ! RV4       RpV'       d$   \        V4       \        P                  ! ^4       R# R# )primaryrC   zNo primary display setFTzSelected display %s not found)	r&   
get_configr   rF   r.   r   r+   timesleep)rz   r   ZoutputsZoutputZfounds   &&   r=   restrict_to_displayZGame.restrict_to_display  s    !,,.iG!>>>$kkG " 78E!;;') E " >HG$JJqMr@   c                r   r   r   r9   r<   r=   r>   r?   $  s     * *D *r@   c                s   \         P                  ! 4       '       d   . R	OpM \        P                  ! R4      .p\        P                  ! R4       VRRRV.,          p\        V4      V n
        V P                  '       d;   \        V P                  R4      '       d   V P                  P                  4        R# R# R#   \         d   p\        \        R4      4      ThRp?ii ; i)
z)Start Antimicrox with a given config path
antimicroxzFUnable to find Antimicrox, install it or disable the Antimicrox optionNzStarting Antimicroz--hiddenz--trayz	--profilestart)zflatpak-spawnz--hostr   )r,   Z
is_flatpakr$   Zfind_required_executabler   r   r   r.   infor   rl   r   r  )rz   antimicro_configZantimicro_commandr|   r   r=   start_antimicroxZGame.start_antimicrox$  s    ""$$ I%+%D%D\%R$S! 	()j(KAQRR 01B C   WT-B-BG%L%L!!'') &M  * %^_s   B: :CCCc                r   r   r   r9   r<   r=   r>   r?   6  s     , ,D ,r@   c                s6   V P                   P                  P                  R4      pV'       g   R# \        P                  ! V4      p\
        P                  ! V^ ,          4      '       g!   \        P                  ! RV^ ,          4       R# V P                  R,          pV P                  4       pV'       d2   \        P                  ! RV4       \
        P                  ! W4VR7       R# \        P                  ! RV4       \        V\        P                  P!                  V^ ,          4      .VVR7      V n        \%        V P"                  R	4      '       d   V P"                  '       g   \'        R
V P"                  ,          4      hV P"                  P)                  4        R# )z;Start the prelaunch command specified in the system optionsprelaunch_commandNzCommand %s not foundenvz,Prelauch command: %s, waiting for completion)r  cwdz/Prelaunch command %s launched in the backgroundinclude_processesr  r  r  z5Prelaunch Executor: %s doesn't have a start attribute)rD   system_configr\   shlexsplitr$   path_existsr.   r   rs   r   r  executer   r   r   basenamern   r   r   r  )rz   Zwait_for_completionr  command_arrayr  r  s   &&    r=   start_prelaunch_commandZGame.start_prelaunch_command6  s)    KK5599:MN $56!!-"233NN1=3CD&&u-##%KKFHYZNN=s;KKIK\]&6#%77#3#3M!4D#E"F	'D# 422G<<DD[D[D["#Z]a]t]t#tuu##))+r@   c                r   r   r   r9   r<   r=   r>   r?   Q  s     	 	c 	r@   c                sd   V P                   P                  P                  R4      '       d   V P                   P                  P                  R\        P                  ! 4       4      pV'       d8   \
        P                  ! V4      '       g   \        \        R4      V,          4      hT;'       g    R# R# )zReturn the terminal used to run the game into or None if the game is not run from a terminal.
Remember that only games using text mode should use the terminal.
terminalZterminal_appz;The selected terminal application could not be launched:
%srC   )	rD   r
  r\   r"   Zget_default_terminalr$   Zcan_find_executabler   r   )rz   r  r   r=   get_terminalZGame.get_terminalQ  s}     ;;$$((44{{0044^UE_E_EabH : :8 D D%a(f&gjr&rss>>r!r@   c                r   r   r   r9   r<   r=   r>   r?   \  s       r@   c                s    V P                   P                  P                  R4      pV'       d   \        P                  ! V4      '       d   V# R# )ztReturn the path to a file that is monitored during game execution.
If the file stops existing, the game is stopped.
rp   rC   )rD   r
  r\   r$   r  )rz   rp   r   r=   get_killswitchZGame.get_killswitch\  s:     [[..22<@
&,,Z88r@   c                r   )r6   r   r4   r   r9   r<   r=   r>   r?   f  s      4F r@   c                s   \        V P                  R4      '       d'   \        \        V P                  RR4      4      '       g   \	        RV P                   R24      hV P                  P                  4       pRV9  d   V P                  P                  VR&   VP                  V 4      pVf   / # V'       d   V P                  P                  W#4       V# )a:  Return the information provided by a runner's play method.
It checks for possible errors and raises exceptions if they occur.

This may invoke methods on the delegates to make decisions,
and this may show UI.

This returns an empty dictionary if the user cancels this UI,
in which case the game should not be run.
playNzRunner: z doesn't have a play method.r   )	r   rD   Zcallablegetattrr   r  r   Zselect_game_launch_configZapply_launch_config)rz   r   gameplay_infor   r   r=   get_gameplay_infoZGame.get_gameplay_infof  s     t{{F++8GDKKQWY]<^3_3_$++6RSTT((*-+/;;+B+BM-(#==dC>IKK++MBr@   c                r   r   r   r9   r<   r=   r>   r?     s      c r@   c                s|   V P                   '       g   \        P                  ! RV 4       R# V P                   P                  pV P                  R8X  d   RV9   d   RVR,          9  d   R# R
 F  pW!9   g   K  W,          pVR8X  d
   V^ ,          pV'       g   K-  \
        P                  P                  V4      pVP                  R4      '       g+   \
        P                  P                  V P                  V4      pV P                  R8X  d   \        V4      pVu # 	  \        P                  ! R	V P                   4       R# )z2Return the path of the main entry point for a gamez%s has no configurationrC   Zmame	main_file.filesZ/winezNo path found in %s)Zexer  ZisoZromzdisk-ar   r  )r   r.   r   game_configr   r   r   r   Z
startswithjoinrE   r0   )rz   r  Zkeyr      &   r=   get_path_from_configZGame.get_path_from_config  s    {{{NN4d;kk-- v%k)c[9Q.QPC!"''>7D477--d3D??3//!ww||DNNDA ''61,T2K! Q$ 	,dkk:r@   c                r   r   r   r9   r<   r=   r>   r?     s       r@   c                sX    V P                   pV'       g   R # V P                   R8X  d   R# V# )rC   ZhumblebundleZhumble)rS   )rz   storer   r=   get_store_nameZGame.get_store_name  s%    <<>)r@   )game_stop_resultc                r   )r6   r   r4   r   r   r9   r<   r=   r>   r?     s      @ @1C @ @r@   c                s   V P                  V4      pV'       g   R# \        V P                  V4      w  r4VP                  R4      ;'       g    V P	                  4       pV'       d   WTR&   V P
                  VR&   V P                  '       d   V P                  VR&   RVRVRV P                  4       R\        P                  ! V P                  P                  P                  RR	4      4      R
\        P                  ! V P                  P                  P                  R
R	4      4      /V n        RV9   d   VR,          V P                  R&   V P                  P                  P                  R4      '       d'   \        4       '       d   \        P                  ! R4       \        P                   ! 4       V n        V P                  P                  P                  R4      '       d   V P%                  R4       V P                  P                  P                  R4      '       d&   \&        P(                  ! V P
                  4      V n        V P                  P                  P                  R4      R8w  dD   T P-                  V P                  P                  P                  R4      ;'       g    R	4      V n        V P                  P                  P                  R4      pVR8w  d4   \        P0                  ! V4       \2        P4                  ! ^4       RV n        V P                  P7                  W@4       V P                  P                  P                  RR	4      p\        P8                  ! V4      '       d   V P;                  V4       V P=                  4       V n        V P                  P                  P                  RR	4      '       d-   V PA                  V P                  P                  R,          4       V PC                  4        R# )zkGet the game ready to start, applying all the options.
This method sets the game_runtime_config attribute.
FZSTOREZ	GAME_NAMEZGAME_DIRECTORYargsr  r  r	  rC   exclude_processesr   use_us_layoutZusZdisable_compositorZdisable_screen_saverr   Zoff
resolutionTr  r  Zprelaunch_wait)"r  r   rD   r\   r"  rF   rE   r  r  r  r
  rs   r*   r$   Zset_keyboard_layoutr&   r   rv   r   r'   Zinhibitry   r   rt   set_resolutionr   r   Z
finish_envr  r  r  rp   r  
start_game)rz   r   r  commandr  r!  r'  r  s   &&      r=   configure_gameZGame.configure_game  s   
 ../AB,T[[-H 99D$7$7$9 L  99K>>>$(NNC ! G3))+T[[-F-F-J-JK^`b-c!dT[[-F-F-J-JK^`b-c!d$
  M)6CM6RD$$]3 ;;$$((99n>N>N&&t, !0 : : <;;$$(()=>>((/;;$$(()?@@1G1O1OPTPYPY1ZD.;;$$((3u<&*&>&>t{{?X?X?\?\]f?g?m?mkm&nD#[[..22<@
**:6JJqM&*D#s);;44889KRP.//!!"23 --/;;$$(()<bAA(()B)BCS)TUr@   c                r   r   r   r9   r<   r=   r>   r?     s      D r@   c                s  a a S P                  4       '       g   \        P                  ! R4       R# SP                  S 4      '       g   R# S P	                  4        S P
                  \        9   dF   \        S P
                  ,          pVP                  VP                  4       VP                  4       4       S P                  S n        \        P                  ! 4       S n        S P                  '       g   \        P                  ! R4       RS n        \        P!                  S 4       \#        RS R7      R VV 3R ll4       p\$        P&                  ! S P(                  P*                  V4       R# )	z<Request launching a game. The game may not be installed yet.zGame is not launchableFzBNo prelaunch PIDs could be obtained. Game stop may be ineffective.N)r#  r   c                    V ^8  d   QhRR/# r   r   r   r   r=   r>   Z!Game.launch.<locals>.__annotate__  s     	4 	4t 	4r@   c                 s>   < V'       d   VhSP                  S4       R # r   )r+  )Z_ignoredr   r   rz   s   &&r=   r+  Z#Game.launch.<locals>.configure_game  s     23r@   T)r   r.   r   Zcheck_game_launchabler   rA   r-   r   r   r   STATE_LAUNCHINGrr   r$   get_running_pid_listrm   
GAME_STARTr   r   r!   	AsyncCallrD   Z	prelaunch)rz   r   r   r+  s   ff  r=   r   ZGame.launch  s    $$&&LL12!77==77k!$TWW-Jj779:;R;R;TU))
$99;"""LL]^"&D	E	=	4 	4 
>	4
 	t{{,,n=r@   c                r   r   r   r9   r<   r=   r>   r?     s     "% "%D "%r@   c                s   \        V P                  R,          V P                  V P                  V P                  P	                  R4      V P                  R,          V P                  R,          V P
                  V P                  R,          V P                  R,          R7	      V n        \        V P                  RR	4      pV'       d#   V P                  '       d   WP                  n        V P                  '       d=   V P                  P                  R
,          V n
        V P                  P                  4        V P                  P                  4        V P                  V n        \        P!                  V 4       \"        P$                  ! R4      R8X  d=   V P&                  '       d+    \(        P*                  P-                  V P&                  4       \0        P2                  ! \4        V P6                  4      V n        \;        V P<                  RRR7      ;_uu_ 4       pVP?                  V P                  4       R	R	R	4       R	#   \.         d     L}i ; i  + '       g   i     R	# ; i)z+Run a background command to launch the gamer$  r   r  r  r	  r%  )ZtitlerD   r  r  Ztermr   r	  r%  stopNZLUTRIS_GAME_UUIDdiscord_rpcTruewutf-8Zencoding) r   rs   rF   rD   r\   r   rk   r  	stop_funcr  rj   r  rx   STATE_RUNNINGrr   GAME_STARTEDr   r   read_settingrV   r   clientZupdateZAssertionErrorr	   Ztimeout_addHEARTBEAT_DELAYbeatro   opennow_playing_pathwrite)rz   r7  Znp_file   &  r=   r)  ZGame.start_game  s   +$$V,));;((,,];((/))*5"667JK"667JK

 DKK6	))))2&!--112DEDN""$

''
$   /69dooo%%doo6 ))/499E$''w??7MM$))$ @?	 "  @??s   #)H< I<I
	I
I	c                r   r   r   r9   r<   r=   r>   r?   3  s     @ @D @r@   c                sX   a  R  V 3R llpR V 3R llp\         P                  ! W4       R# )c                s$    V ^8  d   QhR\         /# r   r   r   r   r=   r>   %Game.force_stop.<locals>.__annotate__6  s     	, 	, 	,r@   c                  s   < S P                   P                  S P                  4       4       S P                  4       '       * # r   )rD   force_stop_gameget_stop_pidsr   s   r=   rC  Z(Game.force_stop.<locals>.force_stop_game6  s0    KK''(:(:(<=))+++r@   c                r,  r   r   r   r   r=   r>   rB  :  s     	* 	*4 	*r@   c                 s   < V'       d   SP                  V4       R # V '       d   SP                  4        R # SP                  4        R # r   )r   	stop_gameforce_kill_delayed)Zall_deadr   rz      &&r=   force_stop_game_cbZ+Game.force_stop.<locals>.force_stop_game_cb:  s-    !!%( '')r@   Nr   r   )rz   rC  rH  s   f  r=   
force_stopZGame.force_stop3  s'    	, 	,	* 	* 	??r@   c                s*   < V ^8  d   QhRS[ RS[RR/# )r6   death_watch_secondsdeath_watch_interval_secondsr   N)r   re   r9   r<   r=   r>   r?   D  s$     8 8c 8]b 8mq 8r@   c                s`   a aa R VVV 3R llpR V 3R llp\         P                  ! W44       R# )zwForces termination of a running game, but only after a set time has elapsed;
Invokes stop_game() when the game is dead.c                r,  r   r   r   r   r=   r>   -Game.force_kill_delayed.<locals>.__annotate__H  s     	A 	AT 	Ar@   c                 s   < \        \        SS,          4      4       F2  p \        P                  ! S4       SP	                  4       '       d   K1   R# 	  \        \        P                  SP	                  4       4       R# )z8Wait for the processes to die; kill them if they do not.N)Zranger   r   r   rD  r   signalZSIGKILL)Z_nrL  rK  rz   s    r=   death_watchZ,Game.force_kill_delayed.<locals>.death_watchH  sW    C 36R RST

78))++ U 6>>4+=+=+?@r@   c                r,  r   r   r   r   r=   r>   rM  R  s     	 	d 	r@   c                sZ   < V'       d   SP                  V4       SP                  4        R# )z?Called after the death watch to more firmly kill any survivors.N)r   rE  Z_resultr   rz   rG  r=   death_watch_cbZ/Game.force_kill_delayed.<locals>.death_watch_cbR  s     !!%( NNr@   NrI  )rz   rK  rL  rO  rQ  s   fff  r=   rF  ZGame.force_kill_delayedD  s)    	A 	A	 	 	;7r@   c                r   r   ra   r9   r<   r=   r>   r?   \  s      s r@   c                s,   V P                  4       pV P                  '       dr   V P                  P                  '       dV   V P                  P                  P                  4       f0   VP	                  V P                  P                  P
                  4       V# )z.Finds the PIDs of processes that need killin'!)get_game_pidsrk   game_processZpollrc   pid)rz   Zpidsr   r=   rD  ZGame.get_stop_pids\  sk    !!# 0 0 = = =,,113;))66::;r@   c                r   r   rR  r9   r<   r=   r>   r?   d  s     S Ss Sr@   c                s    V P                   '       g!   \        P                  ! R4       \        4       # V P	                  4       pV P                  4       pV P                  P                  WP                   V4      # )z7Return a list of processes belonging to the Lutris gamezANo LUTRIS_GAME_UUID recorded. The game's PIDs cannot be computed.)rj   r.   r   ra   get_new_pidsr   rD   Zfilter_game_pids)rz   Znew_pidsZgame_folderrA  r=   rS  ZGame.get_game_pidsd  sV    ~~~LL\]5L$$&,,.{{++HnnkRRr@   c                r   r   rR  r9   r<   r=   r>   r?   n  s      c r@   c                s    V P                   '       d9   \        \        P                  ! 4       4      \        V P                   4      ,
          # \        P
                  ! R4       \        4       # )z7Return list of PIDs started since the game was launchedz?No prelaunch PIDs recorded. The game's PIDs cannot be computed.)rm   ra   r$   r.  r.   r   r   r   r=   rV  ZGame.get_new_pidsn  sF    v2245D<O<O8PPPVWur@   c                r   r   r   r9   r<   r=   r>   r?   v  s     # #4 #r@   c                s   V P                   P                  p\        P                  ! RW4       V^8  d   \        P                  ! R4       V P
                  V n        \        P                  V 4       \        P                  P                  V P                  4      '       d!   \        P                  ! V P                  4       V P                   P                  '       g   V P                   P                  4        V ;P                   V P                   P                  R,          ,          un        \        P                  ! RV P"                  4       V P%                  4        R# R# )zCleanup after a game as stoppedz%s has run for %d secondsz5The game has run for a very short time, did it crash?i  zPlaytime: %sN)rx   durationr.   r   r   rq   rr   GAME_STOPPEDr   r   r   existsr?  ZunlinkZfinishedZendrU   r   r   )rz   rW  r   r=   rE  ZGame.stop_gamev  s    ::&&0$Aa<NNRS ''
$77>>$//00IId++,zz"""JJNNMMTZZ00477MLL)@)@A  "	 #r@   c                r   r   r   r9   r<   r=   r>   r?     s      d r@   c                s>   V P                   '       g   R# V P                   P                  '       d@   V P                  4        \        \	        R4      V P                   P                  ,           4      hV P
                  ;'       d&    \        P                  ! V P
                  4      '       * pV'       d)   \        P                  ! R4       V P                  4        R# V P                  4       pRpV P                  '       d\   V P                  P                  '       d@   V P                  P                  '       d$   W P                  P                  P                  08H  pV'       g%   V P                   P                  '       g1   V'       g)   \        P                   ! R4       V P                  4        R# V P                   P                  '       gV   V'       dN   \        P                   ! R\#        V4      4       V P$                  P'                  V4       V P                  4        R# R# )zWatch the game's process(es).Tz <b>Error lauching the game:</b>
z6File descriptor no longer present, force quit the gameFzGame thread stoppedz?Game thread stopped but %d orphan processes remain, cleaning up)rk   r   on_game_quitr   r   rp   r$   r  r.   r   rJ  rS  rn   
is_runningrT  rU  r   ZlenrD   rC  )rz   Zkillswitch_engageZ	game_pidsZruns_only_prelaunchr  r=   r=  Z	Game.beat  sx    !!!q!DEHXHXH^H^^__ !OOWWF4F4Ft4W0WNNSTOO&&(	#"""t'>'>'I'I'IdNeNeNrNrNr"+0G0G0T0T0X0X/Y"Yt'7'7'B'B'B9LL./ ***yLLZ\_`i\jkKK''	2r@   c                r   r   r   r9   r<   r=   r>   r?     s      d r@   c                sB  a  S P                   S P                  8X  d   \        P                  ! R4       R# \        P                  ! RS 4       S P
                  '       d2   V 3R lp\        P                  ! S P
                  P                  V4       S P                  4        R# )zStops the gamezGame already stoppedNzStopping %sc                 s>   < V'       d   SP                  V4       R # R # r   )r   rP  rG  r=   stop_cbZGame.stop.<locals>.stop_cb  s    %%e, r@   )
rr   rq   r.   r   r  rk   r!   r0  r1  rE  )rz   r\  s   f r=   r1  Z	Game.stop  sj    ::+++LL/0M4(- NN4++00':r@   c                r   r   r   r9   r<   r=   r>   r?     s     =$ =$d =$r@   c                s   V P                   '       dM   V P                   P                  '       d1   \        P                  ! R4       V P                   P	                  4        V P
                  e(   \        P                  ! V P
                  4       RV n        RV n        V P                  V P                  8w  d2   \        P                  ! RV P                  4       V P	                  4        V P                  P                  P                  R4      pV'       d   \        P                   ! V4      p\"        P$                  ! V^ ,          4      '       dt   \        P                  ! RV4       \'        V\(        P*                  P-                  V4      .V P.                  R,          V P1                  4       R7      pVP3                  4        \4        P6                  ! R\4        P8                  ! 4       4      p\        P:                  ! R	V P<                  V4       \?        \4        P4                  ! 4       4      V n         V PC                  4        \(        PD                  ! \(        P*                  PG                  R
4      4       V PH                  '       d   V PH                  P	                  4        V PJ                  '       g,   V P                  P                  P                  R4      '       d!   \L        PN                  ! V PP                  4       V PR                  '       d   V PU                  R4       V P                  P                  P                  R4      '       dI   \V        PX                  ! R.\(        PZ                  R7      ;_uu_ 4       pVP]                  4        RRR4       \^        P`                  ! R4      R8X  d2   V Pb                  '       d     \d        Pf                  Pi                  4        V Pk                  4        R#   + '       g   i     Ln; i    L); i)z2Restore some settings and cleanup after game quit.zStopping prelaunch scriptNzGame still running (state: %s)postexit_commandzRunning post-exit command: %sr  r  z%a, %d %b %Y %H:%M:%Sz%s stopped at %sZ~Zreset_desktopTr&  	setxkbmap)r  r2  r3  )6rn   r[  r.   r  r1  ry   r'   Z	uninhibitro   rr   rq   r   rD   r
  r\   r  r  r$   r  r   r   r   r  rs   r   r  r   ZstrftimeZ	localtimer   rF   r   rL   r   Zchdirr   rl   rt   r&   r(  rv   ru   r   
subprocessZPopenZenvironZcommunicater   r:  rV   r   r;  Zclearprocess_return_codes)rz   r]  r  Zpostexit_threadZ	quit_timer^  s   &     r=   rZ  ZGame.on_game_quit  s    """t'>'>'I'I'IKK34##((*
 --9",,T-O-OP15D.::+++NN;TZZHIIK  ;;44889KL!KK(89M!!-"233;=MN"2!')ww'7'78H'I&J007--/	#  %%'MM"94>>;KL	'I>diik*
##C()   !!&&("""dkk&?&?&C&CO&T&T**4+@+@A###((.;;$$((99!!;-RZZ@@I%%' A   /69dooo$$&
 	!!# A@s   8O/?P /O?	Pc                r   r   r   r9   r<   r=   r>   r?     s     w wd wr@   c                s   V P                   '       g   R# V P                   P                  ^8X  dW   Rp\        P                  ! WP                   P                  4      pV'       d#   \        \        R4      V^ ,          ,          4      hV P                   P                  ^8X  dI   Rp\        P                  ! WP                   P                  4      '       d   \        \        R4      4      hR# R# )z,Do things depending on how the game quitted.Nzerror while loading shared libz)<b>Error: Missing shared library.</b>

%szmaybe the wrong wineserverzM<b>Error: A different Wine version is already using the same Wine prefix.</b>)rk   Zreturn_coder#   Zlookup_strings_in_textr   r   r   )rz   r   Zerror_linesrA  r=   r`  ZGame.process_return_codes  s    ''3.4E!88@P@P@W@WXK"1%R#SVabcVd#dee''1,0E--e5E5E5L5LMM"1%t#uvv N -r@   c                r   r   r   r9   r<   r=   r>   r?     s     D Dt Dr@   c                sh    V P                  V4      pV'       g   R# \        V P                  W14       R# )z+Output the launch argument in a bash scriptN)r  r   rD   )rz   Zscript_pathr   r  s   &&& r=   write_scriptZGame.write_script  s'    ../AB4;;Cr@   c                r   r   r   r9   r<   r=   r>   r?     s     1  1 S 1 r@   c                sX   \         P                  ! R W4       RpV P                  pV P                  V4      pV'       d9   \        P
                  ! WA4      '       d   \        \        R4      WA3,          4      hWPn        V P                  VR7       V'       g   V# V P                  '       g   \        RV P                   R24      hV P                  P                  pV'       g   \        RV P                   R24      h\        VRR7      ;_uu_ 4       pVP                  4        F*  pWX9   d   W8,          pK  W8P                  WE4      ,          pK,  	  R	R	R	4       \        VR
RR7      ;_uu_ 4       pVP!                  V4       R	R	R	4       \        P"                  ! V4      '       g   \         P$                  ! R4       V#  \&        P(                  ! WA4       V#   + '       g   i     L; i  + '       g   i     Lp; i  \*         d%   p	\         P,                  ! RTTT	4        R	p	?	T# R	p	?	ii ; i)zMoving %s to %srC   z<Lutris can't move '%s' to a location inside of itself, '%s'.r   z!Game configuration not found for r  z&Game configuration path not found for r5  r6  Nr4  zFInitial location %s does not exist, files may have already been moved.zLFailed to move %s to %s, you may have to move files manually (Exception: %s))r.   r  rE   _get_move_target_directoryr$   Zpath_containsr   r   r   r   r   rF   Zgame_config_pathr>  Z	readlinesreplacer@  r  r   shutilmoveZOSErrorr   )
rz   new_locationr   Z
new_configold_locationtarget_directoryconfig_pathconfig_fileZliner|   s
   &&&       r=   re  Z	Game.move  s   %t:
~~::<HF00LL&PQUaTpp  *		I	& $#{{{!B499+QOPPkk22!G		{RSTUU+00K#--/#+&J,,|"NNJ	 0 1 +sW55j) 6 !!,//NNcd##	KK3  - 10 65  	LL^	   	s0   ?G-G'<G: G$	'G7	:H)H$$H)c                r   r   r   r9   r<   r=   r>   r?   F  s        C  r@   c                sT    V P                  V4      pW n        V P                  4        V# r   )rb  rE   r   )rz   rf  rh  r   r=   set_locationZGame.set_locationF  s'    ::<H)		r@   c                s&   < V ^8  d   QhRS[ RS[ /# )r6   rf  r   r   r9   r<   r=   r>   r?   L  s      s s r@   c                s    V P                   pV'       dd   \        P                  P                  V4      '       d?   \        P                  P	                  V4      p\        P                  P                  W4      # V# r   )rE   r   r   rY  r  r  )rz   rf  rg  Zgame_directoryr   r=   rb  ZGame._get_move_target_directoryL  sM    ~~BGGNN<88WW--l;N77<<==r@   )"rh   rY   rw   ri   r]   rl   rd   ru   rb   rE   rV   r^   rX   rs   rk   rj   ro   r`   rp   rL   rF   rv   rJ   rU   rn   rm   rt   ry   rS   rB   rG   rr   rx   rK   r   )F)i   g      ?)TZ__name__Z
__module__Z__qualname__Z__firstlineno____doc__r   r   r  r   Z	CACHE_DIRr?  rq   r-  r8  ZPRIMARY_LAUNCH_CONFIG_NAMErW   Zstaticmethodr   r   r   ZpropertyrA   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   Zsetterr   r   r   rD   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r  r   r"  r   r+  r   r)  rJ  rF  rD  rS  rV  rE  r=  r1  rZ  r`  ra  re  rk  rb  Z__static_attributes__Z__classdictcell__Z__classcell__)r}   r;   s   @@r=   r5   r5   ;   s     ww||H$6$68IJM!OM!,62 62p  "   # #
   G GZ Z   $ $$ $ 3 31 1 2 20 0   = =
3 
3( ( , ,   ]]7 7  ! !    
 S S * * ]]+ +
	0 	0, ,B & "V V. ` `#$ #$J        2* *$, ,6	 	  6 B  .@ /@D . /B"% "%H@ @"8 80 S S # #$ . /B "=$ =$~w w"D D1  1 f     r@   r5   c                s4    V ^8  d   QhR\         R\         RR/# )r6   rB   dest_dirr   Nr   r   r   r=   r>   r>   U  s!     !9 !9c !9S !9T !9r@   c                s   . ROp\         P                  ! V R4      pV'       g   \        P                  ! RV 4       R# VR,          V9  d   \	        RVR,          ,          4      hVR,          '       g   \	        R4      h\        VR	,          4      pVP                  '       d   VP                  P                  VR
&   MRVR
&   VR,          p\        P                  P                  VR,          RV ,          4      p\        VRRR7      ;_uu_ 4       p\        P                  ! W7^R7       RRR4       \        P                  P                  VRV ,          4      pRRV\        P                  P                  V4      .p	\        P                   ! V	\        P                  P#                  V4      R7       \        P$                  ! RW4       R#   + '       g   i     L; i)z9Export a full game folder along with some lutris metadatarB   zGame %s not foundNrD   zGame %s can't be exported.rF   rE   z)No game directory set. Could we guess it?rA   r   z	%s.lutrisr4  r5  r6  )Zindentz	%s.tar.xzZtarZcJf)r  z%s exported to %s)r"   r  ZdosboxZscummvm)rZ   r[   r.   r   r   r5   r   Z
game_levelr   r   r  r>  jsonZdumpr  r$   r  Zdirnamer  )
rB   rm  Zexportable_runnersr~   r   r   ri  rj  Zarchive_pathr*  s
   &&        r=   export_gamero  U  sW    ((v6G($/x 227'&/IJJ;FGGD{{{ KK22 $I'',,w{3[45GHK	k3	1	1[		'q1 
277<<+*<=Le\277+;+;I+FGG
NN7	 :;
KK#T8 
2	1s   GG	c                r,  r   r   r   r   r=   r>   r>   y  s     ,- ,- ,-r@   c                s   \         P                  P                  V 4      '       g   \        RV ,          4      h\        P
                  ! RW4       \         P                  P                  V4      '       g   \         P                  ! V4       \        \         P                  ! V4      4      p\        P                  ! WRR7       \        \         P                  ! V4      4      p\        W2,
          4      ^ ,          p\         P                  P                  W4      p \         P                  ! V4       Uu. uF  qfP                  R4      '       g   K  VNK  	  up^ ,          p\#        \         P                  P                  YW4      RR	7      ;_uu_ 4       p\$        P&                  ! T4      p	RRR4       X	R
,          p
\#        \         P                  P                  YW4      RRR	7      ;_uu_ 4       pTP)                  4       pRRR4       XP+                  Y4      p\#        \         P                  P                  YW4      RRR	7      ;_uu_ 4       pTP-                  T4       RRR4       \#        \         P                  P                  YW4      RR	7      ;_uu_ 4       p\$        P&                  ! T4      p	RRR4       \         P                  P                  \.        P0                  RT	R,          ,          4      p\3        T	R,          T4       \4        P6                  ! T	R,          T	R,          T	R,          T	R,          TT	R,          T	R,          T	R,          T	R,          T	R,          T	R,          T	R,          R7      p\9        RT,          4       R# u upi   \         d    \        P                   ! R4        R# i ; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     ELL; i)zImport a game in Lutrisz
No file %szImporting %s to %sF)Zmerge_singlez.lutrisz-No Lutris configuration file found in archiveNr5  r6  rE   Zrr4  zgames/%s.ymlrH   r   rF   rD   rB   rJ   rI   rK   rL   rU   rS   rT   )rF   rD   rB   rJ   rE   rI   rK   rL   rH   rU   rS   rT   zAdded game with ID %s)r   r   rY  r   r.   r  ZisdirZmakedirsra   Zlistdirr    Zextract_archiver   r  ZendswithZ
IndexErrorr   r>  rn  ZloadZreadrc  r@  r   Z
CONFIG_DIRr2   rZ   Zadd_gameZprint)Z	file_pathrm  Zoriginal_file_listZnew_file_listZnew_dirZgame_dirZfr  rj  Zlutris_configZold_dirZconfig_dataZconfig_filenamer7   s   &&            r=   import_gamerp  y  s   77>>)$$<)344
KK$i:77==""
HRZZ12IeD

8,-M=56q9Gww||H.H"$**X"6P"6Q**Y:Oqq"6PQRS
 
bggll81G	D	D		+. 
EK(G	bggll813	I	I[!&&( 
J%%g8K	bggll813	I	I[+& 
J	bggll81G	D	D		+. 
Eggll8#6#6WcId8deO}X.@6"X&6"z*,6" . .z*i( .G 

!G
+,? Q DE 
E	D	D 
J	I	I 
J	I	I	D	D	DsZ   N	 0NN
N	 N1*OOO-N	 	!N.-N.1O	O	O*	-O>	)brl  rn  r   r  rd  rN  r_  r   r    r   Ztypingr   r   r   r   r   r   r   Zgi.repositoryr   r	   r
   r   r   Zlutris.configr   Zlutris.databaser   r   r   rZ   r   Zlutris.exception_backstopsr   Zlutris.exceptionsr   r   r   Zlutris.gui.widgetsr   Zlutris.installerr   Zlutris.monitored_commandr   Zlutris.runner_interpreterr   r   Zlutris.runnersr   r   Zlutris.runners.runnerr   r   Zlutris.utilr   r   r    r!   r"   r#   r$   r%   Zlutris.util.displayr&   r'   r(   r)   r*   Zlutris.util.graphics.xrandrr+   Zlutris.util.linuxr,   Zlutris.util.logr-   r.   Zlutris.util.steam.shortcutr/   r   Zlutris.util.systemr0   Zlutris.util.timerr1   Zlutris.util.yamlr2   Zlutris.gui.applicationr3   Zlutris.gui.dialogs.delegatesr4   r<  r/  r9  rX  r   ZGAME_INSTALLEDr   r5   ro  rp  r   r@   r=   <module>rq     s    *  	        H H H ( (  & 7 -  8 [ [ 1 - 5 O > 8 Z Z Z  8 * / O , # /8=!
!#!#!##%)+ W Wt !9H,-r@   