Skip to content

Commit 6535a8d

Browse files
authored
Update save game functions for Mount & Blade II: Bannerlord (#194)
1 parent 0679b45 commit 6535a8d

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

games/game_mountandblade2.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
from PyQt6.QtCore import QFileInfo
1+
from pathlib import Path
2+
3+
from PyQt6.QtCore import QDir, QFileInfo
24

35
import mobase
46

5-
from ..basic_game import BasicGame
7+
from ..basic_features import BasicLocalSavegames
8+
from ..basic_game import BasicGame, BasicGameSaveGame
69

710

811
class MountAndBladeIIModDataChecker(mobase.ModDataChecker):
@@ -33,7 +36,7 @@ def dataLooksValid(
3336
class MountAndBladeIIGame(BasicGame):
3437
Name = "Mount & Blade II: Bannerlord"
3538
Author = "Holt59"
36-
Version = "0.1.0"
39+
Version = "0.1.1"
3740
Description = "Adds support for Mount & Blade II: Bannerlord"
3841

3942
GameName = "Mount & Blade II: Bannerlord"
@@ -47,17 +50,23 @@ class MountAndBladeIIGame(BasicGame):
4750
GameBinary = "bin/Win64_Shipping_Client/TaleWorlds.MountAndBlade.Launcher.exe"
4851

4952
GameDocumentsDirectory = "%DOCUMENTS%/Mount and Blade II Bannerlord/Configs"
50-
GameSaveExtension = "sav"
51-
GameSavesDirectory = "%DOCUMENTS%/Mount and Blade II Bannerlord/Game Saves/Native"
53+
GameSavesDirectory = "%DOCUMENTS%/Mount and Blade II Bannerlord/Game Saves"
5254

5355
GameNexusId = 3174
5456
GameSteamId = 261550
5557

5658
def init(self, organizer: mobase.IOrganizer):
5759
super().init(organizer)
5860
self._register_feature(MountAndBladeIIModDataChecker())
61+
self._register_feature(BasicLocalSavegames(self.savesDirectory()))
5962
return True
6063

64+
def listSaves(self, folder: QDir) -> list[mobase.ISaveGame]:
65+
save_paths = list(Path(folder.absolutePath()).glob("*.sav")) + list(
66+
Path(folder.absolutePath()).glob("*.sav.cleaner_backup_*")
67+
)
68+
return [BasicGameSaveGame(path) for path in save_paths]
69+
6170
def executables(self):
6271
return [
6372
mobase.ExecutableInfo(

0 commit comments

Comments
 (0)