2626class Game (Flag ):
2727 """A flags enum of the supported games."""
2828
29+ BL1 = auto ()
2930 BL2 = auto ()
3031 TPS = auto ()
3132 AoDK = auto ()
3233 BL3 = auto ()
3334 WL = auto ()
3435
36+ Willow1 = BL1
3537 Willow2 = BL2 | TPS | AoDK
3638 Oak = BL3 | WL
3739
3840 @staticmethod
3941 @cache
40- def get_current () -> Literal [Game .BL2 , Game .TPS , Game .AoDK , Game .BL3 , Game .WL ]:
42+ def get_current () -> Literal [Game .BL1 , Game . BL2 , Game .TPS , Game .AoDK , Game .BL3 , Game .WL ]:
4143 """Gets the current game."""
4244
4345 # As a bit of safety, we can use the architecture to limit which games are allowed
4446 is_64bits = sys .maxsize > 2 ** 32
4547
46- lower_exe_names : dict [str , Literal [Game .BL2 , Game .TPS , Game .AoDK , Game .BL3 , Game .WL ]]
47- default_game : Literal [Game .BL2 , Game .TPS , Game .AoDK , Game .BL3 , Game .WL ]
48+ lower_exe_names : dict [
49+ str ,
50+ Literal [Game .BL1 , Game .BL2 , Game .TPS , Game .AoDK , Game .BL3 , Game .WL ],
51+ ]
52+ default_game : Literal [Game .BL1 , Game .BL2 , Game .TPS , Game .AoDK , Game .BL3 , Game .WL ]
4853 if is_64bits :
4954 lower_exe_names = {
5055 "borderlands3.exe" : Game .BL3 ,
@@ -53,6 +58,7 @@ def get_current() -> Literal[Game.BL2, Game.TPS, Game.AoDK, Game.BL3, Game.WL]:
5358 default_game = Game .BL3
5459 else :
5560 lower_exe_names = {
61+ "borderlands.exe" : Game .BL1 ,
5662 "borderlands2.exe" : Game .BL2 ,
5763 "borderlandspresequel.exe" : Game .TPS ,
5864 "tinytina.exe" : Game .AoDK ,
@@ -72,7 +78,7 @@ def get_current() -> Literal[Game.BL2, Game.TPS, Game.AoDK, Game.BL3, Game.WL]:
7278
7379 @staticmethod
7480 @cache
75- def get_tree () -> Literal [Game .Willow2 , Game .Oak ]:
81+ def get_tree () -> Literal [Game .Willow1 , Game . Willow2 , Game .Oak ]:
7682 """
7783 Gets the "tree" the game we're currently running belongs to.
7884
@@ -84,6 +90,8 @@ def get_tree() -> Literal[Game.Willow2, Game.Oak]:
8490 The current game's tree.
8591 """
8692 match Game .get_current ():
93+ case Game .BL1 :
94+ return Game .Willow1
8795 case Game .BL2 | Game .TPS | Game .AoDK :
8896 return Game .Willow2
8997 case Game .BL3 | Game .WL :
0 commit comments