Skip to content

Commit f41cb69

Browse files
committed
Bug fixes/variable refactors.
--- - Fixed bug causing program to not exit when starting Valheim. - Refactored `__version__` variable to "./appglobals/appglobals.py". Signed-off-by: schlopp96 <[email protected]>
1 parent 9e05c32 commit f41cb69

File tree

4 files changed

+16
-15
lines changed

4 files changed

+16
-15
lines changed

VBPatcher/appglobals/appglobals.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ def get_dev_assets(url: str, mode: int):
7272
return dl_link[73:80] # Return patch version.
7373

7474

75+
__version__: str = '0.8.0'
76+
7577
p_stable: str = r'.\patch-files\stable' # Stable patch file location
7678

7779
url_stable = get_stable_assets(

VBPatcher/applogger/applogger.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def __init__(
8989
self.logger.setLevel(level)
9090
self.stream = stream
9191

92-
if stream: # if stream is True, then toggle logging to stdout
92+
if stream: # if stream is True, then toggle logging stream to stdout
9393
self.logger.addHandler(logging.StreamHandler())
9494

9595
def debug(self, msg) -> None:

VBPatcher/main.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/usr/bin/env python3
22

3-
__version__: str = '0.8.0'
4-
53
import sys
64
from os import chdir
75
from os.path import dirname
@@ -39,15 +37,15 @@ def main() -> None | NoReturn:
3937
"""
4038

4139
logger.info(
42-
f'Welcome to the Valheim Bepinex Patcher v{__version__}!\n>> Session Start: {VBPatcher.appglobals.appglobals._datefmt}\n\n'
40+
f'Welcome to the Valheim Bepinex Patcher v{VBPatcher.appglobals.appglobals.__version__}!\n>> Session Start: {VBPatcher.appglobals.appglobals._datefmt}\n\n'
4341
)
4442

4543
Validations._start_checks() # Ensure presence of patch files.
4644

4745
while True:
4846
logger.info('Display user menu...\n')
4947
choosePatch: str = input(
50-
f"Welcome to the Valheim Bepinex Patcher!\n\nPlease Choose an Option by Entering its Corresponding Number:\n\n{VBPatcher.appglobals.appglobals._textborder}\n>> [1] Patch BepInEx to latest stable release: {VBPatcher.appglobals.appglobals.b_stable}\n>> [2] Patch BepInEx to latest development/bleeding-edge build: {VBPatcher.appglobals.appglobals.b_dev}\n>> [3] Apply both patches to BepInEx in chronological order of release ({VBPatcher.appglobals.appglobals.b_stable} then {VBPatcher.appglobals.appglobals.b_dev})\n>> [4] Check for/update to newest patch versions\n>> [5] Open Valheim\n>> [6] Exit Program\n\n> "
48+
f"Welcome to the Valheim Bepinex Patcher v{VBPatcher.appglobals.appglobals.__version__}!\n\nPlease Choose an Option by Entering its Corresponding Number:\n\n{VBPatcher.appglobals.appglobals._textborder}\n>> [1] Patch BepInEx to latest stable release: {VBPatcher.appglobals.appglobals.b_stable}\n>> [2] Patch BepInEx to latest development/bleeding-edge build: {VBPatcher.appglobals.appglobals.b_dev}\n>> [3] Apply both patches to BepInEx in chronological order of release ({VBPatcher.appglobals.appglobals.b_stable} then {VBPatcher.appglobals.appglobals.b_dev})\n>> [4] Check for/update to newest patch versions\n>> [5] Open Valheim\n>> [6] Exit Program\n\n> "
5149
)
5250

5351
if choosePatch == '1': # Patch BepInEx to latest stable release.
@@ -74,7 +72,6 @@ def main() -> None | NoReturn:
7472
elif choosePatch == '5': # Open Valheim.
7573
logger.info('Chose option [5] to start Valheim...')
7674
_openValheim()
77-
break
7875

7976
elif choosePatch == '6': # Exit Program.
8077
logger.info('Chose option [6] to close patcher...')

VBPatcher/subprocessing/subprocessing.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,18 @@ def _exitPatcher() -> None | NoReturn:
2626
return ex()
2727

2828

29-
def _openValheim() -> int | None:
29+
def _openValheim() -> None:
3030
"""Calls command to open "Valheim" within Steam client.
31+
3132
- Will raise exception :class:`TimeoutExpired` if executable doesn't start within 10 seconds.
3233
- Prevents program from freezing due to any errors encountered during launch process.
3334
3435
- Steam must be running to properly initialize launch process.
3536
3637
---
3738
38-
:return: Start game client.
39-
:rtype: :class:`int` | None
39+
:return: Start Valheim game client.
40+
:rtype: `None`
4041
"""
4142

4243
try:
@@ -45,16 +46,17 @@ def _openValheim() -> int | None:
4546
">> Opening Valheim...\n",
4647
iter_total=3,
4748
txt_seq_speed=0.25)
48-
return call(
49-
r"C:\Program Files (x86)\Steam\Steam.exe -applaunch 892970",
50-
timeout=15,
51-
stdout=sys.stdout,
52-
stderr=sys.stderr) # Start Valheim
49+
call(r"C:\Program Files (x86)\Steam\Steam.exe -applaunch 892970",
50+
timeout=15,
51+
stdout=sys.stdout,
52+
stderr=sys.stderr) # Start Valheim
5353

5454
except TimeoutExpired as exp:
5555
logger_stream.error(
5656
f'Something went wrong while starting Valheim...\n\n>> Exception:\n{exp}\n>> Make sure Steam is running!\n'
5757
)
58+
59+
finally:
5860
return _exitPatcher()
5961

6062

@@ -77,7 +79,7 @@ def _startPrompt() -> NoReturn | None:
7779

7880
elif startPrompt.lower() in {'n', 'no'}:
7981
logger.info(
80-
'Patching process successfully completed!\n>> Preparing to exit...\n'
82+
'Patching process successfully completed!\n>> Returning to menu...\n'
8183
)
8284
return start_seq.start(
8385
'>> Patching process successfully completed',

0 commit comments

Comments
 (0)