Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds support for Fallout 2 #101

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ You can rename `modorganizer-basic_games-xxx` to whatever you want (e.g., `basic
| Divinity: Original Sin (Enhanced Edition) — [STEAM](https://store.steampowered.com/app/373420/Divinity_Original_Sin__Enhanced_Edition/) | [LostDragonist](https://github.com/LostDragonist/) | [game_divinityoriginalsinee.py](games/game_divinityoriginalsinee.py) | <ul><li>save game preview</li><li>mod data checker</li></ul> |
| Dragon's Dogma: Dark Arisen — [GOG](https://www.gog.com/game/dragons_dogma_dark_arisen) / [STEAM](https://store.steampowered.com/app/367500/Dragons_Dogma_Dark_Arisen/) | [EzioTheDeadPoet](https://github.com/EzioTheDeadPoet) | [game_dragonsdogmadarkarisen.py](games/game_dragonsdogmadarkarisen.py) | |
| Dungeon Siege II — [GOG](https://www.gog.com/game/dungeon_siege_collection) / [STEAM](https://store.steampowered.com/app/39200/Dungeon_Siege_II/) | [Holt59](https://github.com/holt59/) | [game_dungeonsiege2.py](games/game_dungeonsiege2.py) | <ul><li>mod data checker</li></ul> |
| Fallout 2 — [GOG](https://www.gog.com/en/game/fallout_2) / [STEAM](https://store.steampowered.com/app/38410/Fallout_2_A_Post_Nuclear_Role_Playing_Game/) |[MrowrPurr](https://github.com/mrowrpurr)|[game_fallout2.py](games/game_fallout2.py)|<ul><li>profile specific ini file</li></ul>|
| Kingdom Come: Deliverance — [GOG](https://www.gog.com/game/kingdom_come_deliverance) / [STEAM](https://store.steampowered.com/app/379430/Kingdom_Come_Deliverance/)| [Silencer711](https://github.com/Silencer711) | [game_kingdomcomedeliverance.py](games/game_kingdomcomedeliverance.py) | <ul><li>profile specific cfg files</li></ul>|
| Mirror's Edge — [GOG](https://www.gog.com/game/mirrors_edge) / [STEAM](https://store.steampowered.com/app/17410/Mirrors_Edge)|[EzioTheDeadPoet](https://eziothedeadpoet.github.io/AboutMe/)|[game_mirrorsedge.py](games/game_mirrorsedge.py)| |
| Mount & Blade II: Bannerlord — [GOG](https://www.gog.com/game/mount_blade_ii_bannerlord) / [STEAM](https://store.steampowered.com/app/261550/Mount__Blade_II_Bannerlord/) | [Holt59](https://github.com/holt59/) | [game_mountandblade2.py](games/game_mountandblade2.py) | <ul><li>mod data checker</li></ul> |
Expand Down
53 changes: 53 additions & 0 deletions games/game_fallout2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# -*- encoding: utf-8 -*-

import os
import configparser
from PyQt5.QtCore import QDir

from ..basic_game import BasicGame


class Fallout2Game(BasicGame):
Name = "Fallout 2 - Support Plugin"
Author = "mrowrpurr"
Version = "0.1.0"

GameName = "Fallout 2"
GameShortName = "fallout2"
GameNexusName = "fallout2"
GameNexusId = 430
GameSteamId = 38410
GameGogId = 1440151285
GameBinary = "fallout2HR.exe"
GameDataPath = "%GAME_PATH%"
GameDocumentsDirectory = "%GAME_PATH%"

def iniFiles(self):
return ["ddraw.ini", "f2_res.ini"]

def updateFallout2cfg(self):
# Update fallout2.cfg (.ini format) for game to run via Mod Organizer 2
#
# [system]
# critter_dat=critter.dat <-- these paths must all be set to
# critter_patches=data <-- to absolute paths
# master_dat=master.dat <--
# master_patches=data <--
game_directory = self.gameDirectory().absolutePath()
fallout2_cfg_path = os.path.join(game_directory, "fallout2.cfg")
config = configparser.ConfigParser()
config.read(fallout2_cfg_path)
config["system"]["critter_dat"] = os.path.join(game_directory, "critter.dat")
config["system"]["critter_patches"] = os.path.join(game_directory, "data")
config["system"]["master_dat"] = os.path.join(game_directory, "master.dat")
config["system"]["master_patches"] = os.path.join(game_directory, "data")
with open(fallout2_cfg_path, "w") as configfile:
config.write(configfile, space_around_delimiters=False)

def initializeProfile(self, path: QDir, settings: int):
# Update fallout2.cfg, if present
game_directory = self.gameDirectory().absolutePath()
fallout2_cfg_path = os.path.join(game_directory, "fallout2.cfg")
if os.path.exists(fallout2_cfg_path):
self.updateFallout2cfg()
super().initializeProfile(path, settings)