Skip to content

Commit ce1213a

Browse files
authored
Merge pull request #141 from Kapiainen/battlenet-launch-change
Updated support for Blizzard Battle.net
2 parents d9160e8 + 783d618 commit ce1213a

File tree

9 files changed

+108
-45
lines changed

9 files changed

+108
-45
lines changed

Changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
**Version 3.0.4 - 2018/06/26:**
2+
- Updated to support the new version of the Blizzard Battle.net launcher.
3+
- Fixed a bug in the context menu option for opening the shortcuts folder.
4+
15
**Version 3.0.3 - 2018/05/30:**
26
- Updated GOG Galaxy support to include arguments in the paths of games.
37

dist/@Resources/main/platforms/battlenet/init.lua

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ do
55
local _class_0
66
local _parent_0 = Platform
77
local _base_0 = {
8-
validate = function(self) end,
8+
validate = function(self)
9+
return assert(io.fileExists(self.clientPath, false), 'The path to the Blizzard Battle.net client is undefined or invalid.')
10+
end,
911
hasUnprocessedPaths = function(self)
1012
return #self.battlenetPaths > 0
1113
end,
@@ -40,13 +42,13 @@ do
4042
if 'destiny 2' == _exp_0 then
4143
args = {
4244
title = 'Destiny 2',
43-
path = 'battlenet://DST2',
45+
path = 'DST2',
4446
process = 'destiny2.exe'
4547
}
4648
elseif 'diablo iii' == _exp_0 then
4749
args = {
4850
title = 'Diablo III',
49-
path = 'battlenet://D3',
51+
path = 'D3',
5052
process = (function()
5153
if bits == 64 then
5254
return 'Diablo III64.exe'
@@ -58,13 +60,13 @@ do
5860
elseif 'hearthstone' == _exp_0 then
5961
args = {
6062
title = 'Hearthstone',
61-
path = 'battlenet://WTCG',
63+
path = 'WTCG',
6264
process = 'Hearthstone.exe'
6365
}
6466
elseif 'heroes of the storm' == _exp_0 then
6567
args = {
6668
title = 'Heroes of the Storm',
67-
path = 'battlenet://Hero',
69+
path = 'Hero',
6870
process = (function()
6971
if bits == 64 then
7072
return 'HeroesOfTheStorm_x64.exe'
@@ -76,19 +78,19 @@ do
7678
elseif 'overwatch' == _exp_0 then
7779
args = {
7880
title = 'Overwatch',
79-
path = 'battlenet://Pro',
81+
path = 'Pro',
8082
process = 'Overwatch.exe'
8183
}
8284
elseif 'starcraft' == _exp_0 then
8385
args = {
8486
title = 'StarCraft',
85-
path = 'battlenet://S1',
87+
path = 'S1',
8688
process = 'StarCraft.exe'
8789
}
8890
elseif 'starcraft ii' == _exp_0 then
8991
args = {
9092
title = 'StarCraft II',
91-
path = 'battlenet://S2',
93+
path = 'S2',
9294
process = (function()
9395
if bits == 64 then
9496
return 'SC2_x64.exe'
@@ -100,7 +102,7 @@ do
100102
elseif 'world of warcraft' == _exp_0 then
101103
args = {
102104
title = 'World of Warcraft',
103-
path = 'battlenet://WoW',
105+
path = 'WoW',
104106
process = (function()
105107
if bits == 64 then
106108
return 'Wow-64.exe'
@@ -122,6 +124,7 @@ do
122124
_continue_0 = true
123125
break
124126
end
127+
args.path = ('"%s" --exec="launch %s"'):format(self.clientPath, args.path)
125128
args.banner = self:getBannerPath(args.title)
126129
if not (args.banner) then
127130
args.expectedBanner = args.title
@@ -160,6 +163,7 @@ do
160163
end
161164
return _accum_0
162165
end)() or { }
166+
self.clientPath = io.joinPaths(settings:getBattlenetClientPath(), 'Battle.net.exe')
163167
self.enabled = settings:getBattlenetEnabled()
164168
self.games = { }
165169
end,
@@ -201,6 +205,9 @@ if RUN_TESTS then
201205
end,
202206
getBattlenetEnabled = function(self)
203207
return true
208+
end,
209+
getBattlenetClientPath = function(self)
210+
return 'C:\\Program Files\\Battle.net'
204211
end
205212
}
206213
local battlenet = Battlenet(settings)
@@ -215,47 +222,47 @@ if RUN_TESTS then
215222
local expectedGames = {
216223
{
217224
title = 'Diablo III',
218-
path = 'battlenet://D3',
225+
path = '"C:\\Program Files\\Battle.net\\Battle.net.exe" --exec="launch D3"',
219226
process = 'Diablo III64.exe'
220227
},
221228
{
222229
title = 'StarCraft',
223-
path = 'battlenet://S1',
230+
path = '"C:\\Program Files\\Battle.net\\Battle.net.exe" --exec="launch S1"',
224231
process = 'StarCraft.exe'
225232
},
226233
{
227234
title = 'Overwatch',
228-
path = 'battlenet://Pro',
235+
path = '"C:\\Program Files\\Battle.net\\Battle.net.exe" --exec="launch Pro"',
229236
process = 'Overwatch.exe'
230237
},
231238
{
232239
title = 'Hearthstone',
233-
path = 'battlenet://WTCG',
240+
path = '"C:\\Program Files\\Battle.net\\Battle.net.exe" --exec="launch WTCG"',
234241
process = 'Hearthstone.exe'
235242
},
236243
{
237244
title = 'Heroes of the Storm',
238-
path = 'battlenet://Hero',
245+
path = '"C:\\Program Files\\Battle.net\\Battle.net.exe" --exec="launch Hero"',
239246
process = 'HeroesOfTheStorm.exe'
240247
},
241248
{
242249
title = 'StarCraft II',
243-
path = 'battlenet://S2',
250+
path = '"C:\\Program Files\\Battle.net\\Battle.net.exe" --exec="launch S2"',
244251
process = 'SC2.exe'
245252
},
246253
{
247254
title = 'StarCraft',
248-
path = 'battlenet://S1',
255+
path = '"C:\\Program Files\\Battle.net\\Battle.net.exe" --exec="launch S1"',
249256
process = 'StarCraft.exe'
250257
},
251258
{
252259
title = 'World of Warcraft',
253-
path = 'battlenet://WoW',
260+
path = '"C:\\Program Files\\Battle.net\\Battle.net.exe" --exec="launch WoW"',
254261
process = 'Wow.exe'
255262
},
256263
{
257264
title = 'Destiny 2',
258-
path = 'battlenet://DST2',
265+
path = '"C:\\Program Files\\Battle.net\\Battle.net.exe" --exec="launch DST2"',
259266
process = 'destiny2.exe'
260267
}
261268
}

dist/@Resources/settings/pages/battlenet.lua

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,17 @@ do
2727
return COMPONENTS.SETTINGS:getBattlenetEnabled()
2828
end
2929
}),
30+
Settings.FolderPath({
31+
title = LOCALIZATION:get('button_label_client_path', 'Client path'),
32+
tooltip = LOCALIZATION:get('setting_battlenet_client_path_description', 'The folder that contains the Blizzard Battle.net client executable.'),
33+
getValue = function(self)
34+
return COMPONENTS.SETTINGS:getBattlenetClientPath()
35+
end,
36+
setValue = function(self, path)
37+
return COMPONENTS.SETTINGS:setBattlenetClientPath(path)
38+
end,
39+
dialogTitle = "Select the folder containing Battle.net.exe"
40+
}),
3041
Settings.FolderPathSpinner({
3142
title = LOCALIZATION:get('setting_battlenet_paths_title', 'Paths'),
3243
tooltip = LOCALIZATION:get('setting_battlenet_paths_description', '""Define the absolute paths to folders, which contain Blizzard Battle.net games in their own subfolders:\nIf e.g. Hearthstone is installed in "D:\\Blizzard games\\Hearthstone", then the path that you give should be "D:\\Blizzard games".\nEdit a path and input an empty string to remove that path.""'),

dist/@Resources/shared/settings.lua

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,16 @@ do
594594
end
595595
self.settings.platforms.battlenet.bangs.stopping = bangs
596596
end,
597+
getBattlenetClientPath = function(self)
598+
return self.settings.platforms.battlenet.clientPath or ''
599+
end,
600+
setBattlenetClientPath = function(self, path)
601+
if not (io.fileExists(io.joinPaths(path, 'Battle.net.exe'), false)) then
602+
return false
603+
end
604+
self.settings.platforms.battlenet.clientPath = path
605+
return true
606+
end,
597607
getGOGGalaxyEnabled = function(self)
598608
return self.settings.platforms.gogGalaxy.enabled or false
599609
end,
@@ -717,7 +727,8 @@ do
717727
starting = { },
718728
stopping = { }
719729
},
720-
paths = { }
730+
paths = { },
731+
clientPath = ''
721732
},
722733
gogGalaxy = {
723734
enabled = false,

dist/Main.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Name=Lauhdutin
33
Author=Kapiainen
44
Information=A game launcher with support for various digital distribution platforms.
5-
Version=3.0.2
5+
Version=3.0.4
66
License=MIT
77

88
[Rainmeter]
@@ -17,7 +17,7 @@ SkinHeight=#SkinHeight#
1717
ContextTitle="#ContextTitleSettings#"
1818
ContextAction=[!ActivateConfig "#ROOTCONFIG#\Settings"]
1919
ContextTitle2="#ContextTitleOpenShortcutsFolder#"
20-
ContextAction2=[#@#\Shortcuts]
20+
ContextAction2=["#@#\Shortcuts"]
2121
ContextTitle3="#ContextTitleExecuteStoppingBangs#"
2222
ContextAction3=[!CommandMeasure "Script" "ManuallyTerminateGameProcess()"]
2323
ContextTitle4="-"

src/main/platforms/battlenet/init.moon

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,13 @@ class Battlenet extends Platform
1212
@name = 'Blizzard Battle.net'
1313
@cachePath = 'cache\\battlenet\\'
1414
@battlenetPaths = [path for path in *settings\getBattlenetPaths()] or {}
15+
@clientPath = io.joinPaths(settings\getBattlenetClientPath(), 'Battle.net.exe')
1516
@enabled = settings\getBattlenetEnabled()
1617
@games = {}
1718

18-
validate: () => return
19+
validate: () =>
20+
assert(io.fileExists(@clientPath, false),
21+
'The path to the Blizzard Battle.net client is undefined or invalid.')
1922

2023
hasUnprocessedPaths: () => return #@battlenetPaths > 0
2124

@@ -41,49 +44,49 @@ class Battlenet extends Platform
4144
when 'destiny 2'
4245
args = {
4346
title: 'Destiny 2'
44-
path: 'battlenet://DST2'
47+
path: 'DST2'
4548
process: 'destiny2.exe' -- No 32-bit executable
4649
}
4750
when 'diablo iii'
4851
args = {
4952
title: 'Diablo III'
50-
path: 'battlenet://D3'
53+
path: 'D3'
5154
process: if bits == 64 then 'Diablo III64.exe' else 'Diablo III.exe'
5255
}
5356
when 'hearthstone'
5457
args = {
5558
title: 'Hearthstone'
56-
path: 'battlenet://WTCG'
59+
path: 'WTCG'
5760
process: 'Hearthstone.exe' -- No 64-bit executable
5861
}
5962
when 'heroes of the storm'
6063
args = {
6164
title: 'Heroes of the Storm'
62-
path: 'battlenet://Hero'
65+
path: 'Hero'
6366
process: if bits == 64 then 'HeroesOfTheStorm_x64.exe' else 'HeroesOfTheStorm.exe'
6467
}
6568
when 'overwatch'
6669
args = {
6770
title: 'Overwatch'
68-
path: 'battlenet://Pro'
71+
path: 'Pro'
6972
process: 'Overwatch.exe' -- No 32-bit executable
7073
}
7174
when 'starcraft'
7275
args = {
7376
title: 'StarCraft'
74-
path: 'battlenet://S1'
77+
path: 'S1'
7578
process: 'StarCraft.exe' -- No 64-bit executable
7679
}
7780
when 'starcraft ii'
7881
args = {
7982
title: 'StarCraft II'
80-
path: 'battlenet://S2'
83+
path: 'S2'
8184
process: if bits == 64 then 'SC2_x64.exe' else 'SC2.exe'
8285
}
8386
when 'world of warcraft'
8487
args = {
8588
title: 'World of Warcraft'
86-
path: 'battlenet://WoW'
89+
path: 'WoW'
8790
process: if bits == 64 then 'Wow-64.exe' else 'Wow.exe'
8891
}
8992
else
@@ -94,6 +97,7 @@ class Battlenet extends Platform
9497
elseif args.path == nil
9598
log('Skipping Blizzard Battle.net game because the path is missing')
9699
continue
100+
args.path = ('"%s" --exec="launch %s"')\format(@clientPath, args.path)
97101
args.banner = @getBannerPath(args.title)
98102
unless args.banner
99103
args.expectedBanner = args.title
@@ -110,6 +114,7 @@ if RUN_TESTS
110114
'Z:\\Games\\Battle.net'
111115
}
112116
getBattlenetEnabled: () => return true
117+
getBattlenetClientPath: () => return 'C:\\Program Files\\Battle.net'
113118
}
114119
battlenet = Battlenet(settings)
115120

@@ -139,48 +144,48 @@ Destiny 2
139144
-- First library (64-bits)
140145
{
141146
title: 'Diablo III'
142-
path: 'battlenet://D3'
147+
path: '"C:\\Program Files\\Battle.net\\Battle.net.exe" --exec="launch D3"'
143148
process: 'Diablo III64.exe'
144149
}
145150
{
146151
title: 'StarCraft'
147-
path: 'battlenet://S1'
152+
path: '"C:\\Program Files\\Battle.net\\Battle.net.exe" --exec="launch S1"'
148153
process: 'StarCraft.exe'
149154
}
150155
{
151156
title: 'Overwatch'
152-
path: 'battlenet://Pro'
157+
path: '"C:\\Program Files\\Battle.net\\Battle.net.exe" --exec="launch Pro"'
153158
process: 'Overwatch.exe'
154159
}
155160
{
156161
title: 'Hearthstone'
157-
path: 'battlenet://WTCG'
162+
path: '"C:\\Program Files\\Battle.net\\Battle.net.exe" --exec="launch WTCG"'
158163
process: 'Hearthstone.exe'
159164
}
160165
-- Second library (32-bits)
161166
{
162167
title: 'Heroes of the Storm'
163-
path: 'battlenet://Hero'
168+
path: '"C:\\Program Files\\Battle.net\\Battle.net.exe" --exec="launch Hero"'
164169
process: 'HeroesOfTheStorm.exe'
165170
}
166171
{
167172
title: 'StarCraft II'
168-
path: 'battlenet://S2'
173+
path: '"C:\\Program Files\\Battle.net\\Battle.net.exe" --exec="launch S2"'
169174
process: 'SC2.exe'
170175
}
171176
{
172177
title: 'StarCraft'
173-
path: 'battlenet://S1'
178+
path: '"C:\\Program Files\\Battle.net\\Battle.net.exe" --exec="launch S1"'
174179
process: 'StarCraft.exe'
175180
}
176181
{
177182
title: 'World of Warcraft'
178-
path: 'battlenet://WoW'
183+
path: '"C:\\Program Files\\Battle.net\\Battle.net.exe" --exec="launch WoW"'
179184
process: 'Wow.exe'
180185
}
181186
{
182187
title: 'Destiny 2'
183-
path: 'battlenet://DST2'
188+
path: '"C:\\Program Files\\Battle.net\\Battle.net.exe" --exec="launch DST2"'
184189
process: 'destiny2.exe'
185190
}
186191
}

0 commit comments

Comments
 (0)