Skip to content

Commit f70d487

Browse files
RizlimRizlim
authored andcommitted
1.0.5
1 parent c4b4b5e commit f70d487

File tree

7 files changed

+84
-22
lines changed

7 files changed

+84
-22
lines changed

src/main/kotlin/PAL2/GUI/CoreController.kt

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import javafx.stage.DirectoryChooser
3030
import javafx.stage.FileChooser
3131
import javafx.stage.Stage
3232
import kotlinx.coroutines.*
33+
import org.apache.commons.io.FileUtils
3334
import java.awt.Desktop
3435
import java.io.File
3536
import java.net.URI
@@ -54,6 +55,10 @@ class CoreController : Initializable
5455
init()
5556
setSettings()
5657
showMOTD()
58+
if (GlobalData.launchPOEonLaunch)
59+
{
60+
PAL2.SystemHandling.launchPoE()
61+
}
5762
}
5863
core_tabpane.tabs.remove(addonDescTab)
5964
}
@@ -602,14 +607,11 @@ class CoreController : Initializable
602607
@FXML
603608
fun launchPoE(event: MouseEvent)
604609
{
605-
if (event.button == MouseButton.PRIMARY)
606-
{
607-
PAL2.SystemHandling.launchPoE()
608-
}
609-
else if (event.button == MouseButton.SECONDARY)
610+
if (event.button == MouseButton.SECONDARY)
610611
{
611-
launchAddons()
612+
GlobalData.launch_addons = true
612613
}
614+
PAL2.SystemHandling.launchPoE()
613615

614616
}
615617

@@ -1128,7 +1130,7 @@ class CoreController : Initializable
11281130
private lateinit var sGeneral: AnchorPane
11291131

11301132

1131-
val settingsArray = arrayOf("About", "AutoHotKey", "General Settings", "Folders")
1133+
val settingsArray = arrayOf("About", "AutoHotKey", "General Settings", "Folders", "Log")
11321134
fun populateSettingsList()
11331135
{
11341136
Platform.runLater { listViewSettings.items.addAll(settingsArray) }
@@ -1147,7 +1149,15 @@ class CoreController : Initializable
11471149
private fun SETAbout()
11481150
{
11491151
Platform.runLater {
1150-
hyperlinkVersion.text = GlobalData.version
1152+
if (GlobalData.debugging)
1153+
{
1154+
hyperlinkVersion.text = "DEBUGGING MODE ${GlobalData.version}"
1155+
}
1156+
else
1157+
{
1158+
hyperlinkVersion.text = GlobalData.version
1159+
}
1160+
11511161
}
11521162
}
11531163

@@ -1221,6 +1231,7 @@ class CoreController : Initializable
12211231
"AutoHotKey" -> showAHK()
12221232
"General Settings" -> showGeneralSettings()
12231233
"Folders" -> showFolders()
1234+
"Log" -> showLog()
12241235
}
12251236
}
12261237
}
@@ -1250,13 +1261,21 @@ class CoreController : Initializable
12501261
Platform.runLater { sAbout.isVisible = true }
12511262
}
12521263

1264+
private fun showLog()
1265+
{
1266+
hideAll()
1267+
Platform.runLater { debugLog.text = FileUtils.readFileToString(File("PAL_Logger.log")) }
1268+
Platform.runLater { anchorLog.isVisible = true }
1269+
}
1270+
12531271
private fun hideAll()
12541272
{
12551273
Platform.runLater {
12561274
sAutoHotKey.isVisible = false
12571275
sFolders.isVisible = false
12581276
sGeneral.isVisible = false
12591277
sAbout.isVisible = false
1278+
anchorLog.isVisible = false
12601279
}
12611280
}
12621281

@@ -1460,6 +1479,12 @@ class CoreController : Initializable
14601479
}
14611480
}
14621481

1482+
@FXML
1483+
private lateinit var anchorLog: AnchorPane
1484+
1485+
@FXML
1486+
private lateinit var debugLog: TextArea
1487+
14631488
@FXML
14641489
private lateinit var reddit: Hyperlink
14651490

src/main/kotlin/PAL2/GlobalData.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class GlobalData
88
{
99
companion object
1010
{
11-
var version = "1.0.4"
11+
var version = "1.0.5"
1212
var debugging = false
1313
var install_dir = ""
1414
var github_token = ""
@@ -23,6 +23,7 @@ class GlobalData
2323
var first_launch_after_update = true
2424
var primaryPoEFile: File? = null
2525
var poeLocations = ArrayList<String>()
26+
var logFile = ""
2627

2728
var loot_filter_path = ""
2829
var show_update_note = false

src/main/kotlin/PAL2/Launcher.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
import PAL2.GUI.CoreApplication
22
import SystemHandling.deleteFile
3+
import SystemHandling.verifyFolder
34
import javafx.application.Application
45
import mu.KotlinLogging
56
import org.apache.commons.io.FileUtils
67
import org.kohsuke.github.GitHubBuilder
8+
import java.io.BufferedOutputStream
79
import java.io.File
10+
import java.io.FileOutputStream
11+
import java.io.PrintStream
812
import java.util.Locale
913
import kotlin.Exception
1014

src/main/kotlin/PAL2/SystemHandling/LaunchHandling.kt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,11 @@ fun launchAddon(aid: Int)
4141

4242
private fun launch_poe(exe: String)
4343
{
44+
logger.debug { "CALLED: LAUNCH_POE(exe) | exe = \'$exe\'" }
45+
4446
if (exe.contains("PathOfExileSteam.exe") || exe.contains("PathOfExile_x64Steam.exe"))
4547
{
48+
logger.debug { "Attempting to run Steam PoE" }
4649
runSteamPoE()
4750
}
4851
else if (exe.contains("PathOfExile.exe") || exe.contains("PathOfExile_x64.exe"))
@@ -51,21 +54,27 @@ private fun launch_poe(exe: String)
5154
val executable: String
5255
if (exe.contains("PathOfExile_x64.exe"))
5356
{
57+
logger.debug { "Found PathOfExile_x64.exe" }
5458
executable = "PathOfExile_x64.exe"
5559
dir = exe.replace(executable, "")
60+
logger.debug { "dir = $dir" }
5661
}
5762
else
5863
{
64+
logger.debug { "ELSE case" }
5965
executable = "PathOfExile.exe"
6066
dir = exe.replace(executable, "")
67+
logger.debug { "dir = $dir" }
6168
}
6269
try
6370
{
64-
Runtime.getRuntime().exec(exe, null, File(dir))
71+
logger.debug { "Runtime command: \"$exe\", NULL, ${File(dir)}" }
72+
logger.debug { "dir = $dir" }
73+
Runtime.getRuntime().exec("\"$exe\"", null, File(dir))
6574
}
6675
catch (e: IOException)
6776
{
68-
e.printStackTrace()
77+
logger.error { e.printStackTrace() }
6978
}
7079

7180
}
@@ -162,6 +171,7 @@ fun launchPoE()
162171
{
163172
if (f.exists())
164173
{
174+
launchAddons()
165175
launch_poe(f.path)
166176
}
167177
}

src/main/resources/CoreUI.fxml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<?import javafx.scene.control.ScrollPane?>
1111
<?import javafx.scene.control.Tab?>
1212
<?import javafx.scene.control.TabPane?>
13+
<?import javafx.scene.control.TextArea?>
1314
<?import javafx.scene.control.TextField?>
1415
<?import javafx.scene.image.Image?>
1516
<?import javafx.scene.image.ImageView?>
@@ -394,7 +395,7 @@
394395
</image>
395396
</ImageView>
396397
<Hyperlink fx:id="patreon" layoutX="116.0" layoutY="307.0" onAction="#patreon" text="Support PAL on Patreon" textFill="#0066cc" />
397-
<Hyperlink fx:id="hyperlinkVersion" onAction="#showUpdates" alignment="CENTER_RIGHT" layoutX="324.0" prefHeight="23.0" prefWidth="126.0" text="1.0.0" textAlignment="RIGHT" textFill="#0066cc">
398+
<Hyperlink fx:id="hyperlinkVersion" alignment="CENTER_RIGHT" layoutX="324.0" onAction="#showUpdates" prefHeight="23.0" prefWidth="126.0" text="1.0.0" textAlignment="RIGHT" textFill="#0066cc">
398399
<font>
399400
<Font size="16.0" />
400401
</font></Hyperlink>
@@ -516,7 +517,15 @@
516517
</Text>
517518
</children>
518519
</AnchorPane>
519-
<AnchorPane layoutX="150.0" prefHeight="470.0" prefWidth="450.0" visible="false" />
520+
<AnchorPane fx:id="anchorLog" layoutX="150.0" prefHeight="470.0" prefWidth="450.0" visible="false">
521+
<children>
522+
<TextArea fx:id="debugLog" layoutX="10.0" layoutY="35.0" prefHeight="430.0" prefWidth="430.0" />
523+
<Text fill="WHITE" layoutX="14.0" layoutY="27.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Log">
524+
<font>
525+
<Font size="29.0" />
526+
</font>
527+
</Text>
528+
</children></AnchorPane>
520529
<AnchorPane layoutX="150.0" prefHeight="470.0" prefWidth="450.0" visible="false" />
521530
<AnchorPane layoutX="150.0" prefHeight="470.0" prefWidth="450.0" visible="false" />
522531
<AnchorPane layoutX="150.0" prefHeight="470.0" prefWidth="450.0" visible="false" />

src/main/resources/log4j2.xml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<Configuration status="WARN">
3-
<Appenders>
2+
<configuration status="WARN">
3+
<appenders>
44
<Console name="Console" target="SYSTEM_OUT">
55
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
66
</Console>
7-
</Appenders>
8-
<Loggers>
9-
<Root level="DEBUG">
10-
<AppenderRef ref="Console"/>
11-
</Root>
12-
</Loggers>
13-
</Configuration>
7+
8+
<File name="MyFile" fileName="PAL_Logger.log">
9+
<PatternLayout pattern="%d{yyyy-mm-dd HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
10+
</File>
11+
</appenders>
12+
13+
<loggers>
14+
<root level="debug">
15+
<appender-ref ref="Console"/>
16+
<appender-ref ref="MyFile"/>
17+
</root>
18+
</loggers>
19+
</configuration>

src/main/resources/update_notes.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@
6060

6161
</style>
6262
<body>
63+
<div class="block_1 hline-bottom"><h1>Version 1.0.5</h1></div>
64+
<ul>
65+
<li>Potential Fix for addons not launching.</li>
66+
<li>Added a log to the settings page.</li>
67+
<li>Still investigating PoE not launching upon click.</li>
68+
</ul>
69+
6370
<div class="block_1 hline-bottom"><h1>Version 1.0.4</h1></div>
6471
<ul>
6572
<li>You can now set the addons on launch by selecting them in the installed tab and clicking to enable.</li>

0 commit comments

Comments
 (0)