Skip to content

Commit

Permalink
Merge pull request #138 from Root-Core/bethesda
Browse files Browse the repository at this point in the history
Mod support for multiple Bethesda games
  • Loading branch information
GloriousEggroll authored Oct 15, 2024
2 parents 3158cb6 + d9cf4ec commit 5936c55
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 45 deletions.
5 changes: 4 additions & 1 deletion fix.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,10 @@ def _run_fix(game_id: str, default: bool = False, local: bool = False) -> bool:
game_module = import_module(module_name)

log.info(f'Using {scope} {fix_type} for {get_game_name()} ({game_id})')
game_module.main()
if hasattr(game_module, 'main_with_id'):
game_module.main_with_id(game_id)
else:
game_module.main()
except ImportError:
log.info(f'No {scope} {fix_type} found for {get_game_name()} ({game_id})')
return False
Expand Down
1 change: 1 addition & 0 deletions gamefixes-steam/1716740.py
48 changes: 48 additions & 0 deletions gamefixes-steam/22330.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
"""Mod support for following Bethesda games:
- Fallout 3 - Game of the Year Edition
- Fallout 4
- Fallout: New Vegas
- The Elder Scrolls IV: Oblivion
- The Elder Scrolls V: Skyrim
- The Elder Scrolls V: Skyrim Special Edition
- Starfield
"""

import os

from dataclasses import dataclass
from protonfixes import util

def main_with_id(game_id: str) -> None:
"""Enable modding and fixes"""
# modorganizer2 features a redirector and breaks if we replace the command. (Issue #103)
if os.path.exists('modorganizer2'):
return

# Run script extender if it exists.
mapping = get_redirect_name(game_id)
if os.path.isfile(mapping.from_name):
util.replace_command(mapping.from_name, mapping.to_name)


@dataclass
class Redirect:
"""Used for replacements"""

from_name: str
to_name: str


def get_redirect_name(game_id: str) -> Redirect:
"""Mapping for SteamID -> script extender replacements"""
mapping = {
'22380': ('FalloutNV.exe', 'nvse_loader.exe'), # Fallout New Vegas
'22370': ('FalloutLauncher.exe', 'fose_loader.exe'), # Fallout 3
'377160': ('Fallout4Launcher.exe', 'f4se_loader.exe'), # Fallout 4
'22330': ('OblivionLauncher.exe', 'obse_loader.exe'), # Oblivion
'72850': ('SkyrimLauncher.exe', 'skse_loader.exe'), # Skyrim
'489830': ('SkyrimSELauncher.exe', 'skse64_loader.exe'), # Skyrim SE
'1716740': ('Starfield.exe', 'sfse_loader.exe') # Starfield
}.get(game_id, ('', ''))
return Redirect(*mapping)
10 changes: 0 additions & 10 deletions gamefixes-steam/22370.py

This file was deleted.

1 change: 1 addition & 0 deletions gamefixes-steam/22370.py
1 change: 1 addition & 0 deletions gamefixes-steam/22380.py
11 changes: 0 additions & 11 deletions gamefixes-steam/377160.py

This file was deleted.

1 change: 1 addition & 0 deletions gamefixes-steam/377160.py
11 changes: 0 additions & 11 deletions gamefixes-steam/489830.py

This file was deleted.

1 change: 1 addition & 0 deletions gamefixes-steam/489830.py
12 changes: 0 additions & 12 deletions gamefixes-steam/72850.py

This file was deleted.

1 change: 1 addition & 0 deletions gamefixes-steam/72850.py

0 comments on commit 5936c55

Please sign in to comment.