Skip to content

Commit 27dd63d

Browse files
committed
Manual Invictus Install Option
Adds an option to specify a manual installation for Invictus, while improving the Steam Default option by checking the D:, E:, and F: drives. Both options now will automatically log an error if the hybrid option is selected and Invictus cannot be found.
1 parent b5d1343 commit 27dd63d

File tree

4 files changed

+59
-12
lines changed

4 files changed

+59
-12
lines changed

BaToImperator/DataFiles/Fronter/fronter-options.txt

+10-4
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ option = {
1010
default = true
1111
}
1212
radioOption = {
13-
name = yes
14-
displayName = HYBRIDYES
15-
tooltip = HYBRIDYESTIP
13+
name = invictus
14+
displayName = HYBRIDINV
15+
tooltip = HYBRIDINVTIP
1616
default = false
1717
}
1818
}
1919
}
2020

2121
option = {
2222
name = invictusDir
23-
displayName = INVICTUSDIROPTION
23+
displayName = INVICTUSDIR
2424
tooltip = INVICTUSDIRTIP
2525
radioSelector = {
2626
radioOption = {
@@ -29,6 +29,12 @@ option = {
2929
tooltip = INVICTUSDIRDEFAULTTIP
3030
default = true
3131
}
32+
radioOption = {
33+
name = custom
34+
displayName = INVICTUSDIRCUSTOM
35+
tooltip = INVICTUSDIRCUSTOMTIP
36+
default = true
37+
}
3238
}
3339
}
3440

BaToImperator/DataFiles/Fronter/options_l_english.yml

+6-4
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ l_english:
77
HYBRIDOPTIONTIP: "Instead of creating a standalone mod based on vanilla, would you prefer to have the converter create a sub-mod for Imperator:Invictus"
88
HYBRIDNO: "No"
99
HYBRIDNOTIP: "The output will be a standalone mod based on vanilla."
10-
HYBRIDYES: "Yes (Requires Invictus)"
11-
HYBRIDYESTIP: "The output will be a sub-mod for Imperator:Invictus."
10+
HYBRIDINV: "Yes (Requires Invictus)"
11+
HYBRIDINVTIP: "The output will be a sub-mod for Imperator:Invictus."
1212

13-
INVICTUSDIROPTION: "Invictus Directory"
14-
INVICTUSDIROPTIONTIP: "If hybridizing with Invictus, what directory is that mod located in?"
13+
INVICTUSDIR: "Invictus Directory"
14+
INVICTUSDIRTIP: "If hybridizing with Invictus, what directory is that mod located in?"
1515
INVICTUSDIRDEFAULT: "Steam Default"
1616
INVICTUSDIRDEFAULTTIP: "The converter will look for Invictus in your Steam Workshop folder."
17+
INVICTUSDIRCUSTOM: "Custom Installation"
18+
INVICTUSDIRCUSTOMTIP: "The converter will use the directory specified in BaToImperator\configurables\modDirectories.txt. Useful for manual and non-Steam installations."
1719

1820
ANTAGONISTOPTION: "Convert Antagonists"
1921
ANTAGONISTOPTIONTIP: "Certain AI countries have a hidden modifier which makes them much stronger and highly aggressive. Should those countries which had it in BA also have it carried over to I:R?"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#Specify where your custom Imperator:Invictus installation is located to the right of "invictus,"
2+
#Otherwise, it will be impossible to hybridize with Invictus!
3+
#By default, mods are stored in C:\Users\<USER>\Documents\Paradox Interactive\Imperator\mod
4+
5+
invictus,C:\Users\<USER>\Documents\Paradox Interactive\Imperator\mod\Invictus\

BaToImperator/src/main/java/com/paradoxgameconverters/batoir/Main.java

+38-4
Original file line numberDiff line numberDiff line change
@@ -199,15 +199,49 @@ public static void main (String[] args) throws IOException
199199

200200
int splitSize = empireRank+800;
201201

202+
ArrayList<String> customModInstalls = Importer.importBasicFile("configurables/modDirectories.txt");
203+
202204
boolean invictus = false;
203-
if (configDirectories[7].equals("yes")) { //if Invictus hybridization is enabled
205+
if (configDirectories[7].equals("invictus")) { //if Invictus hybridization is enabled
204206
invictus = true;
205207
}
206208

207209
String invictusDir = "";
208-
if (configDirectories[8].equals("default")){ //default directory for Invictus
209-
invictusDir = "C:/Program Files (x86)/Steam/steamapps/workshop/content/859580/2532715348";
210-
}
210+
if (configDirectories[8].equals("default") && invictus){ //default directory for Invictus
211+
String steamInvDir = ":/Program Files (x86)/Steam/steamapps/workshop/content/859580/2532715348";
212+
int dirCount = 0;
213+
int dirCountMax = 4;
214+
while (dirCount < dirCountMax) {
215+
String invictusDirLetter = "C";
216+
if (dirCount == 1) {
217+
invictusDirLetter = "D";
218+
} else if (dirCount == 2) {
219+
invictusDirLetter = "E";
220+
} else if (dirCount == 3) {
221+
invictusDirLetter = "F";
222+
}
223+
invictusDir = invictusDirLetter+steamInvDir;
224+
LOGGER.info("Checking for Invictus on the "+invictusDirLetter+": drive...");
225+
File invictusTest = new File(invictusDir);
226+
if (invictusTest.isDirectory()) {
227+
LOGGER.info("Invictus found on the "+invictusDirLetter+": drive!");
228+
dirCount = dirCountMax + 1;
229+
}
230+
dirCount = dirCount + 1;
231+
if (dirCount == dirCountMax) {
232+
LOGGER.severe("Unable to detect Invictus! If you have a custom or non-Steam installation, select the 'Custom Installation' Invictus Directory option before converting.");
233+
}
234+
}
235+
236+
} else if (configDirectories[8].equals("custom")){ //default directory for Invictus
237+
invictusDir = Output.cultureOutput(customModInstalls,"invictus");
238+
File invictusTest = new File(invictusDir);
239+
if (invictusTest.isDirectory()) {
240+
LOGGER.info("Invictus found!");
241+
} else {
242+
LOGGER.severe("Unable to detect Invictus at "+invictusDir+"");
243+
}
244+
}
211245

212246
String mappingDir = "configurables/vanilla/";
213247
if (invictus) {

0 commit comments

Comments
 (0)