zmilla93 / SlimTrade

A trade UI overlay for Path of Exile
MIT License
135 stars 15 forks source link

Full support for Mac and Linux #74

Open zmilla93 opened 3 months ago

zmilla93 commented 3 months ago

SlimTrade needs to be able to do two things that are currently not cross platform:

This is currently only supported on windows. It is done using the Java Native Access (JNA) library, full API here. For Windows, it uses the win32/user32 API, which has the functions for getting the foreground window, enumerating all windows, and focusing windows. Using this library isn't required, but it does have additional APIs for other platforms.

The actual code that needs updating is getFocusedWindowTitle() and focusPathOfExileWindow in PoeInterface.java marked with TODOs and FIXMEs. This code runs fairly frequently, so it cannot be noticeably slow.

There doesn't seem to be a pure Java solution to this issue, and I don't currently have other operating systems to test solutions myself. Any feedback is appreciated.

xbc1 commented 3 months ago

System Information: USER@PC:~/.slimtrade$ uname -a Linux PC 6.5.0-45-generic #45~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon Jul 15 16:40:02 UTC 2 x86_64 x86_64 x86_64 GNU/Linux USER@PC:~/.slimtrade$ java -version openjdk version "21.0.4" 2024-07-16 OpenJDK Runtime Environment (build 21.0.4+7-Ubuntu-1ubuntu222.04) OpenJDK 64-Bit Server VM (build 21.0.4+7-Ubuntu-1ubuntu222.04, mixed mode, sharing)

USER@PC:~/Downloads$ java -jar SlimTrade.jar
SlimTrade launching... []
Save file '/home/PC/.slimtrade/settings.json' doesn't exist, creating new file.
Save file '/home/PC/.slimtrade/app_state.json' doesn't exist, creating new file.
Save file '/home/PC/.slimtrade/overlay.json' doesn't exist, creating new file.
Save file '/home/PC/.slimtrade/stash.json' doesn't exist, creating new file.
Save file '/home/PC/.slimtrade/ignore.json' doesn't exist, creating new file.
Save file '/home/PC/.slimtrade/pins.json' doesn't exist, creating new file.
Save file '/home/PC/.slimtrade/scanner.json' doesn't exist, creating new file.
Save file '/home/PC/.slimtrade/patch_notes.json' doesn't exist, creating new file.
Checking for update...
Current version: v0.4.8
Latest version: v0.4.8
Program is up to date.
[FontManager] Loaded font does not exist!
java.lang.reflect.InvocationTargetException
    at java.desktop/java.awt.EventQueue.invokeAndWait(EventQueue.java:1371)
    at java.desktop/java.awt.EventQueue.invokeAndWait(EventQueue.java:1346)
    at java.desktop/javax.swing.SwingUtilities.invokeAndWait(SwingUtilities.java:1480)
    at com.slimtrade.App.main(App.java:148)
Caused by: java.lang.UnsupportedOperationException: The system tray is not supported on the current platform.
    at java.desktop/java.awt.SystemTray.getSystemTray(SystemTray.java:180)
    at com.slimtrade.gui.managers.SystemTrayManager.init(SystemTrayManager.java:24)
    at com.slimtrade.App.lambda$main$1(App.java:150)
    at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:308)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Slimtrade Launched
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: Cannot invoke "com.slimtrade.gui.setup.SetupWindow.setup()" because "com.slimtrade.gui.managers.FrameManager.setupWindow" is null
    at com.slimtrade.App.lambda$runSetupWizard$3(App.java:188)
    at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
^CSlimTrade Terminated

It doesn't create the files it should, "ls -a" in application folder: USER@PC:~/.slimtrade$ pwd /home/USER/.slimtrade USER@PC:~/.slimtrade$ ls -a . .. audio images logs

Downloaded the fonts, copied them, updated font cache, available system wide, still says the same.