Skip to content

Commit 710b3cd

Browse files
committed
1.01
Fixed issue where gCustomExe was not being set on load, resulting in wrong exe being used. Fixed some interface issues.
1 parent b0fdaf5 commit 710b3cd

File tree

7 files changed

+86
-26
lines changed

7 files changed

+86
-26
lines changed

Definitive-SMR-Launcher/autopytoexe/autopytoexe_config.json

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,6 @@
173173
"optionDest": "datas",
174174
"value": "./Definitive-SMR-Launcher/exe;exe/"
175175
},
176-
{
177-
"optionDest": "datas",
178-
"value": "./Definitive-SMR-Launcher/icon;icon/"
179-
},
180176
{
181177
"optionDest": "datas",
182178
"value": "./Definitive-SMR-Launcher/interface;interface/"
@@ -188,6 +184,18 @@
188184
{
189185
"optionDest": "datas",
190186
"value": "./Definitive-SMR-Launcher/interface/background.jpg;."
187+
},
188+
{
189+
"optionDest": "datas",
190+
"value": "./Definitive-SMR-Launcher/tool_tip.pyw;."
191+
},
192+
{
193+
"optionDest": "copy_metadata",
194+
"value": "imageio"
195+
},
196+
{
197+
"optionDest": "datas",
198+
"value": "./Definitive-SMR-Launcher/icon/icon.ico;."
191199
}
192200
],
193201
"nonPyinstallerOptions": {

Definitive-SMR-Launcher/game_launcher.pyw

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ def game_launcher():
2424
runexe = "RailRoads.exe"
2525

2626
# Check if user wants to use custom OpenSpy exe
27-
if getattr(__main__, "gCustomExe", False):
28-
gametype = __main__.get_config_value("USERINFO", "gametype") or "Steam"
27+
if (__main__.gCustomExe == True):
28+
gametype = __main__.get_config_value("gametype")
2929
if gametype == "Steam":
3030
runexe = "RailRoads_Steam_LAA_OpenSpy.exe"
3131
else:
@@ -36,9 +36,22 @@ def game_launcher():
3636

3737
exe_path = __main__.os.path.join(__main__.gGamePath, runexe)
3838

39+
# Check if file exists
40+
if not __main__.os.path.isfile(exe_path):
41+
__main__.error_logs(f"[game_launcher] File not found: {exe_path}", "error")
42+
return
43+
44+
workdir = __main__.os.path.dirname(exe_path)
45+
3946
try:
40-
ret = windll.shell32.ShellExecuteW(None, "runas", exe_path, None, None, 1)
47+
ret = windll.shell32.ShellExecuteW(None, "runas", exe_path, None, workdir, 1)
48+
49+
# Log the return code
50+
__main__.error_logs(f"[game_launcher] ShellExecute return code: {ret}", "info")
51+
4152
if ret <= 32:
42-
__main__.error_logs("[game_launcher] Cannot start game", "error")
53+
__main__.error_logs(f"[game_launcher] Cannot start game, error code {ret}", "error")
54+
return
55+
4356
except Exception as e:
4457
__main__.error_logs(f"[game_launcher] Error starting game: {e}", "error")

Definitive-SMR-Launcher/gamepath_manager.pyw

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def gamepath_manager():
1919

2020
# Update label in UI
2121
__main__.gGameLocation_label.configure(
22-
text=str(__main__.string_utils(folder_path, max_length=180, placeholder="..."))
22+
text=str(__main__.string_utils(folder_path, max_length=30, placeholder="..."))
2323
)
2424

2525
# Update global variables

Definitive-SMR-Launcher/interface_manager.pyw

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def interface_manager(os,ctk):
3030
__main__.gCustom_difficulty = ctk.IntVar(value=int(__main__.get_config_value("customdifficulty", default="0")))
3131
__main__.gCustom_levels_button = ctk.CTkCheckBox(
3232
__main__.gApp,
33-
text="Custom Difficulty Levels",
33+
text="Custom Difficulty Levels ",
3434
variable=__main__.gCustom_difficulty,
3535
corner_radius=0,
3636
command=__main__.difficulty_manager
@@ -62,7 +62,7 @@ def interface_manager(os,ctk):
6262
__main__.gCustom_exe = ctk.IntVar(value=int(__main__.get_config_value("enableopenspy", default="0")))
6363
__main__.gCustom_exe_button = ctk.CTkCheckBox(
6464
__main__.gApp,
65-
text="Enable OpenSpy LAA exe",
65+
text="Enable OpenSpy LAA exe ",
6666
variable=__main__.gCustom_exe,
6767
corner_radius=0,
6868
command=__main__.custom_exe_manager
@@ -86,7 +86,8 @@ def interface_manager(os,ctk):
8686
__main__.gCustom_exe_button.configure(state="disabled")
8787
__main__.gGameTypeDrop.configure(state="disabled")
8888
else:
89-
__main__.gGameLocation_label.configure(text=str(__main__.string_utils(__main__.gGamePath, max_length=40, placeholder="...")))
89+
__main__.gGameLocation_label.configure(text=str(__main__.string_utils(__main__.gGamePath, max_length=30, placeholder="...")))
90+
__main__.ToolTip(__main__.gGameLocation_label, str(__main__.gGamePath))
9091
__main__.error_logs(f"[interface] Game Path " + str(__main__.gGamePath), "info")
9192
__main__.gCustom_levels_button.configure(state="normal")
9293
__main__.gStart_button.configure(state="normal")

Definitive-SMR-Launcher/main.pyw

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ from archive_maps import archive_maps
4848
from set_game_type_selection import set_game_type_selection
4949
from gamepath_manager import gamepath_manager
5050
from github_update import github_update
51+
from tool_tip import ToolTip
5152

5253
def stopThread():
53-
print("thread")
5454
gStopDownload.set()
5555
time.sleep(1.0)
5656
if __name__ == '__main__':
@@ -81,8 +81,8 @@ if __name__ == '__main__':
8181
# Internet Archive
8282
ginternetArchiveIdentifier = "sid-meiers-railroads-custom-maps-collection"
8383

84-
gVersion:str = "1.00" # App version
85-
gGitHubVersion:str = "version1.00"
84+
gVersion:str = "1.01" # App version
85+
gGitHubVersion:str = "version1.01"
8686
gBackGroundImageUrl:str = r"interface\background.jpg"
8787
gCustom_difficulty = None
8888
gCustom_exe = None
@@ -94,7 +94,7 @@ if __name__ == '__main__':
9494
gGameDocs = None
9595
gSelected_button = None
9696
gGameLocation_label = None
97-
gCustomExe = False
97+
9898
gAppWidth = 1280
9999
gAppHeight = 720
100100
gMain_font = ctk.CTkFont(family="arial", size=19,weight="bold")
@@ -124,6 +124,10 @@ if __name__ == '__main__':
124124
gApp.geometry(f"{gAppWidth}x{gAppHeight}+{mainWindowX}+{mainWindowY}") # Set the app geometry so that it is centered
125125
create_icon(sys) # Create an icon for the app
126126

127+
gCustomExe = False
128+
if get_config_value("enableopenspy") == "1":
129+
gCustomExe = True
130+
127131
if getattr(sys, 'frozen', False): # Running as a PyInstaller bundle
128132
bg_image_path = os.path.join(sys._MEIPASS, "background.jpg")
129133
error_logs("[Main] Background path " + str(bg_image_path),"info")
@@ -171,10 +175,5 @@ if __name__ == '__main__':
171175
download_dir_path.mkdir(parents=True, exist_ok=True)
172176

173177
interface_manager(os,ctk)
174-
175178
github_update()
176-
gApp.mainloop()
177-
178-
179-
180-
179+
gApp.mainloop()
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import tkinter as tk
2+
3+
class ToolTip:
4+
def __init__(self, widget, text):
5+
self.widget = widget
6+
self.text = text
7+
self.tip_window = None
8+
9+
widget.bind("<Enter>", self.show_tip)
10+
widget.bind("<Leave>", self.hide_tip)
11+
12+
def show_tip(self, event=None):
13+
if self.tip_window is not None:
14+
return
15+
16+
x = event.x_root + 10
17+
y = event.y_root + 10
18+
19+
self.tip_window = tw = tk.Toplevel(self.widget)
20+
tw.wm_overrideredirect(True)
21+
tw.wm_geometry(f"+{x}+{y}")
22+
23+
label = tk.Label(
24+
tw,
25+
text=self.text,
26+
background="#333333",
27+
foreground="white",
28+
borderwidth=1,
29+
relief="solid",
30+
padx=5,
31+
pady=3
32+
)
33+
label.pack()
34+
35+
def hide_tip(self, event=None):
36+
tw = self.tip_window
37+
self.tip_window = None
38+
if tw:
39+
tw.destroy()

Definitive-SMR-Launcher/version/version_info.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ VSVersionInfo(
66
ffi=FixedFileInfo(
77
# filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4)
88
# Set not needed items to zero 0.
9-
filevers=(1, 0, 0, 0),
10-
prodvers=(1, 0, 0, 0),
9+
filevers=(1, 0, 1, 0),
10+
prodvers=(1, 0, 1, 0),
1111
# Contains a bitmask that specifies the valid bits 'flags'r
1212
mask=0x3f,
1313
# Contains a bitmask that specifies the Boolean attributes of the file.
@@ -31,12 +31,12 @@ VSVersionInfo(
3131
u'040904B0',
3232
[StringStruct(u'CompanyName', u'ageekhere'),
3333
StringStruct(u'FileDescription', u'Definitive-SMR-Launcher'),
34-
StringStruct(u'FileVersion', u'1.000'),
34+
StringStruct(u'FileVersion', u'1.010'),
3535
StringStruct(u'InternalName', u'Definitive-SMR-Launcher'),
3636
StringStruct(u'LegalCopyright', u'ageekhere'),
3737
StringStruct(u'OriginalFilename', u'Definitive-SMR-Launcher'),
3838
StringStruct(u'ProductName', u'Definitive-SMR-Launcher'),
39-
StringStruct(u'ProductVersion', u'1.0.0.0')])
39+
StringStruct(u'ProductVersion', u'1.0.1.0')])
4040
]),
4141
VarFileInfo([VarStruct(u'Translation', [1033, 1200])])
4242
]

0 commit comments

Comments
 (0)