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

Mod support for multiple Bethesda games #138

Merged
merged 1 commit into from
Oct 15, 2024
Merged
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
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