mirror of
https://github.com/aclist/dztui.git
synced 2026-08-26 09:47:36 +02:00
fix: zero-pad revision number
This commit is contained in:
parent
08b62e1cfd
commit
c4160bbbd8
@ -239,7 +239,7 @@ class FileVersion:
|
||||
major: int
|
||||
minor: int
|
||||
build: int
|
||||
revision: int
|
||||
revision: str
|
||||
|
||||
|
||||
@dataclass(slots=True, frozen=True)
|
||||
@ -281,8 +281,11 @@ def parse_version_number(data: BinaryIO) -> FileVersion:
|
||||
minor = struct.unpack("<L", data.read(4))[0] >> 16 & 0xFFFF
|
||||
major = struct.unpack("<L", data.read(4))[0] >> 0 & 0xFFFF
|
||||
build = struct.unpack("<L", data.read(4))[0] >> 0 & 0xFFFF
|
||||
revision = struct.unpack("<L", data.read(4))[0] >> 16 & 0xFFFF
|
||||
return FileVersion(major, minor, build, revision)
|
||||
# NOTE: 0-pad revision number
|
||||
revision = str(struct.unpack("<L", data.read(4))[0] >> 16 & 0xFFFF)
|
||||
offset = 3 - len(revision)
|
||||
padded = "0" * offset + revision
|
||||
return FileVersion(major, minor, build, padded)
|
||||
|
||||
|
||||
def seek_to_hex(address: str, data: BinaryIO) -> None:
|
||||
@ -311,7 +314,8 @@ def get_dayz_version(file: Path) -> DayZVersion:
|
||||
|
||||
|
||||
def dayz_version_to_str(v: DayZVersion) -> str:
|
||||
return ".".join(str(el) for el in [v.major, v.minor, v.patch])
|
||||
return ".".join(el for el in list(map(str, [v.major, v.minor, v.patch])))
|
||||
# return ".".join(str(el) for el in [v.major, v.minor, v.patch])
|
||||
|
||||
|
||||
def dayz_version_from_str(v: str) -> DayZVersion:
|
||||
@ -452,5 +456,6 @@ def get_pretty_version(steam_path: Path, appid: int) -> str | None:
|
||||
vers = get_dayz_version(pe_file_path)
|
||||
dayz_version = dayz_version_to_str(vers)
|
||||
return dayz_version
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
print(e)
|
||||
return None
|
||||
|
||||
@ -7,7 +7,8 @@ MIN_COUNT = 1048576
|
||||
REQUEST_TIMEOUT = 10
|
||||
|
||||
APPNAME_DAYZ = "DayZ"
|
||||
APPNAME_DAYZ_EXP = "DayZ Experimental"
|
||||
APPNAME_DAYZ_EXP = "DayZ Exp"
|
||||
APPNAME_DAYZ_EXP_HUMAN = "DayZ Experimental"
|
||||
DAYZ_BINARY = "DayZ_x64.exe"
|
||||
|
||||
LIBRARYFOLDERS_PATH = "steamapps/libraryfolders.vdf"
|
||||
|
||||
@ -28,7 +28,7 @@ from dzgui.const.constants import (
|
||||
APPID_DAYZ,
|
||||
APPID_DAYZ_EXP,
|
||||
APPNAME_DAYZ,
|
||||
APPNAME_DAYZ_EXP,
|
||||
APPNAME_DAYZ_EXP_HUMAN,
|
||||
)
|
||||
from dzgui.const.enum import NotebookPage, Preferences
|
||||
from dzgui.init.proc import is_dayz_running, is_steam_running
|
||||
@ -123,7 +123,7 @@ class ConnectionManager:
|
||||
self.appid = info.game_id
|
||||
self.record = record
|
||||
|
||||
builds = {APPID_DAYZ: APPNAME_DAYZ, APPID_DAYZ_EXP: APPNAME_DAYZ_EXP}
|
||||
builds = {APPID_DAYZ: APPNAME_DAYZ, APPID_DAYZ_EXP: APPNAME_DAYZ_EXP_HUMAN}
|
||||
build = builds[self.appid]
|
||||
binary_missing = False
|
||||
required_mib = 0.0
|
||||
|
||||
@ -8,7 +8,7 @@ from dzgui.const.constants import (
|
||||
APPID_DAYZ,
|
||||
APPID_DAYZ_EXP,
|
||||
APPNAME_DAYZ,
|
||||
APPNAME_DAYZ_EXP,
|
||||
APPNAME_DAYZ_EXP_HUMAN,
|
||||
FLATPAK_RUN_CMD,
|
||||
FLATPAK_SANDBOX,
|
||||
NO_EXPAND,
|
||||
@ -173,7 +173,7 @@ class Options(Gtk.Box):
|
||||
|
||||
version_rows = [
|
||||
[LeftLabel(APPNAME_DAYZ), self.dayz_version_label],
|
||||
[LeftLabel(APPNAME_DAYZ_EXP), self.dayz_exp_version_label],
|
||||
[LeftLabel(APPNAME_DAYZ_EXP_HUMAN), self.dayz_exp_version_label],
|
||||
]
|
||||
|
||||
api_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
||||
|
||||
@ -200,8 +200,8 @@ class PreConnectionAssistant(Gtk.ScrolledWindow):
|
||||
)
|
||||
for child in widgets:
|
||||
child.set_visible(True)
|
||||
self.raise_window.set_visible(False)
|
||||
|
||||
self.raise_window.set_visible(False)
|
||||
self.raise_window.set_sensitive(False)
|
||||
self.ok.set_sensitive(True)
|
||||
self.ok.set_label(preconnect.update_mods)
|
||||
@ -214,8 +214,6 @@ class PreConnectionAssistant(Gtk.ScrolledWindow):
|
||||
self.ok.emit("clicked")
|
||||
|
||||
def _on_ok_clicked(self, button: Gtk.Button) -> None:
|
||||
# TODO: cancel mod downloads
|
||||
# sets some kind of global event listener
|
||||
self.controller.update_and_connect(self.raise_window.get_active())
|
||||
|
||||
def _on_back_clicked(self, button: Gtk.Button) -> None:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user