-
-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Starting the API? The read me says it packs the natives with the JAR, but Core.init requires the natives file. #36
Comments
There are two separate native libraries that need to be loaded:
Currently you would need to unpack the platform specific Core.init(getClass().getResource("./discord_game_sdk.dll")); That would automatically extract the library from the classpath, assuming that you packaged it into your JAR. I will be adding an example to further document that way of loading the library. |
Okay! Sorry for the slow reply, but I had gotten it to work shortly after making this post by downloading the libraries manually from the downloader class by using the link there. I;'ll try out the code you supplied. However I highly recommend making a cleaner/prettier way of doing it. You could turn
Into
or something. Personally when I write my own APIs, I try to make things as straightforward and clean as possible so people can guess what a function does simply by its name. Requiring getResource() and a path still requires you to read the tutorial and copy and paste that code. It's best if you can initialize the API in as few lines as possible. |
A There are many different way of loading the DLL, e.g. downloading it as in the example, shipping it with your application (not sure if that wouldn't violate the license), downloading it once and loading it from there then or even asking the user to download it manually. I do not think that the library should make any decisions regarding the loading of the DLL, especially because I cannot say for sure which of the ways is the best one. Because I cannot ship the |
Hello again, when you've completed your changes here and pushed it, can you please leave a comment on here about how the new setup works? This is so I can be notified in the future and check it out. Thank you! Good luck! |
Yes, I will make a comment and close this issue once I'm done. I don't think that I will change the setup code much (maybe I could add a |
Not fully fixed, examples are still missing, so I am reopening this, until I added examples. |
Are you planning on building another release with these code changes? |
Yes, I originally wanted to write an example first, but I guess I will just do a release now. I can always add examples later. |
We've been having issues getting the code to work on specific machines in general and have had to remove this API from our project, but I'll make a separate issue for that later. |
Hello,
I need this API to set up a discord rich presence with my game. However, I can't even get your Activity example working the way I'd like it to.
I managed to get it to download the natives with DownloadNativeLibrary, but it takes a few seconds and I don't want to make the player sit at a loading screen waiting for it to download. It's a single player game, so I don't want to work under the assumption their internet is fast or that the server DownloadNativeLibrary is connected to will be up/running quickly. So...
I tried using the natives included with your release, but get this error when I used the natives I thought was the closest approximation to my machine. This is likely a user error and just me not having the full natives that I need, but here is the error I get:
DRPC: Start true Using Discord Library: windows-amd64-discord_game_sdk_jni.dll Exception in thread "main" java.lang.UnsatisfiedLinkError: D:\Projects\Eclipse Workspace\RobotFarm\RobotFarm\discord_natives\windows-amd64-discord_game_sdk_jni.dll: Can't find dependent libraries at java.base/jdk.internal.loader.NativeLibraries.load(Native Method) at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:383) at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:227) at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:169) at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2383) at java.base/java.lang.Runtime.load0(Runtime.java:746) at java.base/java.lang.System.load(System.java:1857) at de.jcm.discordgamesdk.Core.init(Core.java:58) at com.nokoriware.robotfarm.util.DiscordRichPresence.start(DiscordRichPresence.java:51) at com.nokoriware.robotfarm.test.DiscordTest.main(DiscordTest.java:13)
So basically, I'm going to try and hook up the natives included in the file that DownloadNativeLibrary uses. But my issue comes down to these points:
I think you should maybe update your readme/release to explain a bit better how to hook up the natives locally. It seems that the natives included in the release aren't the ones you actually need. You should include a download link somewhere for the correctones.
Update the readme/examples to show how to load the natives automatically if they are included in the JAR and if this is an option.
I'm using the release version of the API and hooking the JAR up in my build path manually.
I appreciate the examples, but some more detailed documentation on using this for RPC would be helpful.
Thanks!
The text was updated successfully, but these errors were encountered: