Unitsync to Java binding
Moderator: Moderators
Unitsync to Java binding
Has anyone got a working up to date implementation unitsync to Java binding?
Or is there any information about how to do such a thing.
I did it a while ago, but I forgot how I did, and it is old and broken now.
Or is there any information about how to do such a thing.
I did it a while ago, but I forgot how I did, and it is old and broken now.
Re: Unitsync to Java binding
Sweet that works nice.
For anyone else who stumbles accross this thread and wants to know what I did:
For anyone else who stumbles accross this thread and wants to know what I did:
- Download unitsync.jar from https://github.com/jahwag/cheeselobby/tree/master/lib
- Add it to your project
- Set the run time parameter for Java:
Code: Select all
-Djna.library.path="D:\\Program Files\\Spring"
Re: Unitsync to Java binding
Nice oneCheesecan wrote:https://github.com/jahwag/cheeselobby/tree/master/lib
Do you have any wrapper classes for Mods etc?
At the momemt I do:
Code: Select all
UnitsyncLibrary.GetPrimaryModName(i).getString(0)
Re: Unitsync to Java binding
https://github.com/jahwag/cheeselobby/t ... y/unitsync
There's a wrapper mostly written by hoijui, I added some things as well.
If you like you are welcome to create a github project for unitsync for java, and set up maven repo, that way we could develop a better wrapper in cooperation. Not many people use the java unitsync right now but maybe in the future who knows, could be useful to someone.
There's a wrapper mostly written by hoijui, I added some things as well.
If you like you are welcome to create a github project for unitsync for java, and set up maven repo, that way we could develop a better wrapper in cooperation. Not many people use the java unitsync right now but maybe in the future who knows, could be useful to someone.
Re: Unitsync to Java binding
Yea cool, I defintally post my results to Github if they are good enough.
Do you know how to read unit information from unitsync?
Do you know how to read unit information from unitsync?
Re: Unitsync to Java binding
I really cant figgure out how to get unit stats:
Ive tried a mixture of the following:
Ive tried a mixture of the following:
Code: Select all
public static void main(String[] args) {
UnitsyncLibrary.Init(false, 0);
int modCount = UnitsyncLibrary.GetPrimaryModCount();
System.err.println(UnitsyncLibrary.GetPrimaryModName(0).getString(0));
System.err.println(UnitsyncLibrary.GetPrimaryModArchiveCount(0));
System.err.println(UnitsyncLibrary.GetPrimaryModArchive(0).getString(0));
System.err.println(UnitsyncLibrary.GetArchivePath("BA712.sdd").getString(0));
int archiveID = UnitsyncLibrary.OpenArchive("D:\\Users\\David\\Documents\\My Games\\Spring\\mods\\BA712.sdd");
System.err.println(archiveID);
System.err.println(UnitsyncLibrary.GetUnitCount());
System.err.println(UnitsyncLibrary.ProcessUnitsNoChecksum());
UnitsyncLibrary.CloseArchive(archiveID);
int modCount = UnitsyncLibrary.GetPrimaryModCount();
for (int i = 0; i < modCount; i++) {
Mod mod = new Mod();
mod.setName(UnitsyncLibrary.GetPrimaryModName(i).getString(0));
mod.setShortName(UnitsyncLibrary.GetPrimaryModShortName(i).getString(0));
mod.setDescription(UnitsyncLibrary.GetPrimaryModDescription(i).getString(0));
mod.setVersion(UnitsyncLibrary.GetPrimaryModVersion(i).getString(0));
System.err.println(UnitsyncLibrary.GetUnitCount());
System.err.println(UnitsyncLibrary.ProcessUnits());
System.err.println(UnitsyncLibrary.GetFullUnitName(0));
int archiveCount = UnitsyncLibrary.GetPrimaryModArchiveCount(i);
for (int j = 0; j < archiveCount; j++) {
Pointer archive = UnitsyncLibrary.GetPrimaryModArchive(j);
System.out.println(archive.getString(0));
break;
}
mods.add(mod);
}
UnitsyncLibrary.UnInit();
// GUI.main(args);
}
Re: Unitsync to Java binding
i already have a much betteer wrapper locally. it has even OSGi support, which allows, next to other stuff, nice reloading of unityznc at runtime, which means you can load it from a different location. it also generates wrappers at comppiletime with maven plugins, and hides all JNA stuff from the interface.
it is quite as i wanted it, i just have to actualiye it for current master unitsznc.
i am not at home right now, will be soon though. just saying.. dont start somethign new
i will try to do that son, now that i know there is someone that could use it. will be online later.
it is quite as i wanted it, i just have to actualiye it for current master unitsznc.
i am not at home right now, will be soon though. just saying.. dont start somethign new

i will try to do that son, now that i know there is someone that could use it. will be online later.
Re: Unitsync to Java binding
yay, are you online yet?
Re: Unitsync to Java binding
woops! :D yes i am. get into #ai if you can, i am there if i am in the lobby.
Re: Unitsync to Java binding
made it up-to-date now. will just have lunch and then do minor cleanup upload it to github.
Re: Unitsync to Java binding
https://github.com/spring/JUnitSync
no real docu yet. i will upload a Pax-Exam test soon.
Most basic usage instructions:
You may specify the dir containing unitsync like this:
<code>System.setProperty("jna.library.path", unitsyncDir);</code>
or the path to unitsync like this:
<code>Preferences.userRoot().put("unitsync.path", unitsyncPath);</code>
Then start the bundle, and use either the "Unitsync" or "UnitsyncSimple" service (they only differ in one function, getInfoMapSize).
For further help, it may be best to meet me in the lobby.
no real docu yet. i will upload a Pax-Exam test soon.
Most basic usage instructions:
You may specify the dir containing unitsync like this:
<code>System.setProperty("jna.library.path", unitsyncDir);</code>
or the path to unitsync like this:
<code>Preferences.userRoot().put("unitsync.path", unitsyncPath);</code>
Then start the bundle, and use either the "Unitsync" or "UnitsyncSimple" service (they only differ in one function, getInfoMapSize).
For further help, it may be best to meet me in the lobby.
- CarRepairer
- Cursed Zero-K Developer
- Posts: 3359
- Joined: 07 Nov 2007, 21:48
Re: Unitsync to Java binding
We had success getting this to work in windows but now I need help getting it to work in linux and mac, both failed. Could you guys hang out in lobbydev more? It's not just for meetings anymore!
Re: Unitsync to Java binding
See the cheeselobby unitsync code, it should work under linux(unless it broke, I haven't tested it under linux for months).
- CarRepairer
- Cursed Zero-K Developer
- Posts: 3359
- Joined: 07 Nov 2007, 21:48
Re: Unitsync to Java binding
det has been helping me. Turns out I was pointing to unitsync.dll when that's windows only. I will need to detect OS and let user fix OS if necessary, and base the filename on that.
Ironically, we have not gotten it to work right for him on linux but i managed to get it to work on a macbook. So we're close.
Ironically, we have not gotten it to work right for him on linux but i managed to get it to work on a macbook. So we're close.