Moa Posted August 21, 2009 Share Posted August 21, 2009 Thanks for the pointers. Will take a look. There used to be a project that gave DirectInput access, called "jinput" although it seems abandoned at the moment. Even when I looked at it a few years ago it had some issues (throwing NullPointerExceptions which should not happen in any decent code). I'm also interested in having some Java code working alongside LockOn/DCS (besides LEAVU) so am keen to find a way to make it work - even if it takes a while. Link to comment Share on other sites More sharing options...
RvEYoda Posted August 21, 2009 Author Share Posted August 21, 2009 cool, yeah if you can get those basic things working it java it sure is faster to develop a java app ;) S = SPARSE(m,n) abbreviates SPARSE([],[],[],m,n,0). This generates the ultimate sparse matrix, an m-by-n all zero matrix. - Matlab help on 'sparse' Link to comment Share on other sites More sharing options...
RvEYoda Posted November 16, 2009 Author Share Posted November 16, 2009 (edited) Just to let you know I am currently moving the project to Java and OpenGL through JOGL. it is so far in very early development and cannot do much more than switch between and configure different blank mfd pages, but I got the graphics running, clicks detected and I was able to wrap my C functions in JNI so that the window does not steal focus from lockon when clicked... Prototype looks something like this : For JNI I used this as a source : http://stackoverflow.com/questions/386792/in-java-swing-how-do-you-get-a-win32-window-handle-hwnd-reference-to-a-window but that is for old java and I needed to update it like this : #define _AFXDLL #include "afxwin.h" #include "windows.h" #include "Java2Win32.h" #include "jawt.h" #include "jawt_md.h" JNIEXPORT jlong JNICALL Java_leavu_Win32_setNoActivate (JNIEnv *env, jclass cls, jobject comp) { HMODULE _hAWT = 0; HWND hWnd = 0; typedef jboolean (JNICALL *PJAWT_GETAWT)(JNIEnv*, JAWT*); JAWT awt; JAWT_DrawingSurface* ds; JAWT_DrawingSurfaceInfo* dsi; JAWT_Win32DrawingSurfaceInfo* dsi_win; jboolean result; jint lock; //Load AWT Library _hAWT = LoadLibrary(L"jawt.dll"); if(_hAWT) { PJAWT_GETAWT JAWT_GetAWT = (PJAWT_GETAWT)GetProcAddress(_hAWT, "JAWT_GetAWT"); if(JAWT_GetAWT) { awt.version = JAWT_VERSION_1_4; // Init here with JAWT_VERSION_1_3 or JAWT_VERSION_1_4 //Get AWT API Interface result = JAWT_GetAWT(env, &awt); if(result != JNI_FALSE) { ds = awt.GetDrawingSurface(env, comp); if(ds != NULL) { lock = ds->Lock(ds); if((lock & JAWT_LOCK_ERROR) == 0) { dsi = ds->GetDrawingSurfaceInfo(ds); if(dsi) { dsi_win = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo; if(dsi_win) { hWnd = dsi_win->hwnd; CWnd::FromHandle(hWnd)->ModifyStyleEx(0,WS_EX_NOACTIVATE,1); } else { hWnd = (HWND) -1; } ds->FreeDrawingSurfaceInfo(dsi); } else { hWnd = (HWND) -2; } ds->Unlock(ds); } else { hWnd = (HWND) -3; } awt.FreeDrawingSurface(ds); } else { hWnd = (HWND) -4; } } else { hWnd = (HWND) -5; } } else { hWnd = (HWND) -6; } } else { hWnd = (HWND) -7; } return (jlong)hWnd; } Argument is any AWT component. ( I use AWT only, no swing ) Got it running on 64bit jre currently Edited February 17, 2010 by =RvE=Yoda S = SPARSE(m,n) abbreviates SPARSE([],[],[],m,n,0). This generates the ultimate sparse matrix, an m-by-n all zero matrix. - Matlab help on 'sparse' Link to comment Share on other sites More sharing options...
topol-m Posted November 16, 2009 Share Posted November 16, 2009 Nice to see you are still working on this project. :thumbup: [sIGPIC][/sIGPIC] Link to comment Share on other sites More sharing options...
RvEYoda Posted November 16, 2009 Author Share Posted November 16, 2009 yeah, but it will be a while before we can use the new version, for many reasons. Primarily cause im doing it all again from scratch...:P 1 S = SPARSE(m,n) abbreviates SPARSE([],[],[],m,n,0). This generates the ultimate sparse matrix, an m-by-n all zero matrix. - Matlab help on 'sparse' Link to comment Share on other sites More sharing options...
104th_Crunch Posted November 17, 2009 Share Posted November 17, 2009 Nice to see you active Yoda. Good luck with the project. If you need any testing help, please just ask. Link to comment Share on other sites More sharing options...
RvEYoda Posted November 17, 2009 Author Share Posted November 17, 2009 (edited) Yes, I could definitely use a hand. Either from anyone that knows JAVA ( I have an svn rep at kenai called leavu2 ), or if you can provide pictures of MFDs, MFD pages etc. Or if anyone wants to contribute with artwork that would be cool. Naturally anyone making a contribution would also get the author/dev/contributor stamp :) Edited November 17, 2009 by =RvE=Yoda S = SPARSE(m,n) abbreviates SPARSE([],[],[],m,n,0). This generates the ultimate sparse matrix, an m-by-n all zero matrix. - Matlab help on 'sparse' Link to comment Share on other sites More sharing options...
RvEYoda Posted November 17, 2009 Author Share Posted November 17, 2009 Implemented some hsd details, GLCanvas instead of Gljpanel (canvas is faster), AA and some other stuff.. S = SPARSE(m,n) abbreviates SPARSE([],[],[],m,n,0). This generates the ultimate sparse matrix, an m-by-n all zero matrix. - Matlab help on 'sparse' Link to comment Share on other sites More sharing options...
Moa Posted November 17, 2009 Share Posted November 17, 2009 (edited) Glad to see you r using Java. What would you specifically like a hand with Yoda? I could try converting the JNI to JNA so you don't have to copy the DLL around and set the javca.library.path Edited November 17, 2009 by Moa Link to comment Share on other sites More sharing options...
RvEYoda Posted November 17, 2009 Author Share Posted November 17, 2009 (edited) I tested using JNA to get the HWND, but it succeeded only some times, some times it gave random integers and sometimes just zero :). You make some JNA call to get a pointer to the hwnd value, and then you call ptr.getLong() or ptr.getInt(), however since the pointer is ( my thought of the JNA problem ) returned as a 32bit value and my OS and JRE is 64bit the pointer value only works in some cases. (where the 32bits are lucky enough to fit the pointer value) If you can make JNA retrieve the HWND and or add WS_NO_ACTIVATE extended style to a java awt component however, that would be excellent. But make absolute sure it works 100% of the time in 64bit OS and 32bit OS, and works with both 64bit jre and 32bit jre. I have use JNA to enable OpenCL ( Open Compute language ) in java at work, and I believe JNA may have some issues with 64bit pointer values, at least as it is right now. JNI enables me to link statically and make sure all variables sent and returned are correct. ( for work I also switched to JNI for using OpenCL in Java. ) Also I think we can include both a 64bit and 32bit dll for the final release of LEAVU and have the library path be configured in some shortcut that is automatically set up. what is needed is the LEAVU.jar, the Java2Win32.dll (32 or 64 bit) that I wrote and jawt.dll (32 or 64 bit..i think) from the JDK lib directory. Like : LEAVU/LEAVU.jar LEAVU/LEAVU.bat (or similar) LEAVU/lib/win/X86/Java2Win32.dll LEAVU/lib/win/X86/jawt.dll LEAVU/lib/win/X86/jogl.dll LEAVU/lib/win/X86/gluegen-rt.dll LEAVU/lib/win/X64/Java2Win32.dll LEAVU/lib/win/X64/jawt.dll LEAVU/lib/win/X64/jogl.dll LEAVU/lib/win/X64/gluegen-rt.dll then either run the bat file to launch it or copy the dlls to windows PATH ( ie windows/system32/ ) IF you want to run on linux I will have some files under LEAVU/NATIVE where you must code your Java2Win32.cpp to make the Java2Win32.dll (yes maybe I should change the name of that file :)) You'll get my windows variant as a reference, but it will of course not compile under linux, so you must replace the hwnd and extended styles with whatever is necessary (or you can just have it do nothing if you dont care about WS_NO_ACTIVATE ) Little status update : Edited November 18, 2009 by =RvE=Yoda S = SPARSE(m,n) abbreviates SPARSE([],[],[],m,n,0). This generates the ultimate sparse matrix, an m-by-n all zero matrix. - Matlab help on 'sparse' Link to comment Share on other sites More sharing options...
71st_Mastiff Posted November 18, 2009 Share Posted November 18, 2009 what about being Multi monitor capable on MP? " any failure you meet, is never a defeat; merely a set up for a greater come back, " W Forbes "Success is not final, failure is not fatal, it is the courage to continue that counts," Winston Churchill " He who never changes his mind, never changes anything," MSI z690MPG DDR4 || i914900k|| ddr4-64gb PC3200 || MSI RTX 4070Ti|Game1300w|Win10x64| |turtle beach elite pro 5.1|| ViRpiL,T50cm2|| MFG Crosswinds|| VT50CM-plus rotor Throttle || G10 RGB EVGA Keyboard/MouseLogitech || PiMax Crystal VR || 32 Samsung|| Link to comment Share on other sites More sharing options...
hannibal Posted November 18, 2009 Share Posted November 18, 2009 yes, i would also like to know the LEAVU 2.0 functionality if a multiplayer server has .LUA export turned off... find me on steam! username: Hannibal_A101A http://steamcommunity.com/profiles/76561197969447179 Link to comment Share on other sites More sharing options...
RvEYoda Posted November 18, 2009 Author Share Posted November 18, 2009 (edited) Leavu 2 has a button saying "Add MFD" which allows any number of MFDs to share the same data, so that the CPU work load is the same regardless of number of MFDs. The CPU load will increase with number of MFDs only because OpenGL requires one graphics engine and drawing thread per MFD. ( But they all share the same precached shapes, so load is quite ok. i get about 1-2% load per MFD on my 2.66 GHz machine at home when locking at 30 fps ) Just put it on a different cpu core than lockon and will have zero effect on game performance. This means to run multiple MFDs of different size works just fine. You just press "new mfd" here : , and you can resize each MFD independently of the others ( just drag like a normal window ) . Just add MFD and drag to the monitor you want it on. It should run on any operating system with a Java VM, and supports any screen aspect ratio without changes to settings or misshaped objects. No Global exports are needed, so even if lua export turned off it works 100% fine, since Leavu only uses information from your instruments. So it asks "what is on my radar", "what is my speed", "what is my position", "what is my colition". It does never ask "What is player GG's position" Edited November 18, 2009 by =RvE=Yoda S = SPARSE(m,n) abbreviates SPARSE([],[],[],m,n,0). This generates the ultimate sparse matrix, an m-by-n all zero matrix. - Matlab help on 'sparse' Link to comment Share on other sites More sharing options...
hannibal Posted November 18, 2009 Share Posted November 18, 2009 (edited) No Global Exports needed??? IT SOUNDS AWESOME... but im not sure.. all i know is that i was disappointed to have setup the LOVP for lockon in order to view gauge information to work locally, and not work on multiplayer because i was informed that most servers turn OFF lua export in order to prevent cheating.... but if your application is not feed data from the server, THIS IS INDEED FRIGGIN AWESOME currently i am trying to setup multi monitors.. i just purchased a new card from ATi, because i want to run multi monitor in black shark on Windows 7 with out having to be in Windowed mode.. but im having a difficult time with this radeon HD5770 ( I am NOT liking Eye finity at the moment) you seem to know about .lua stuff... do you know that guy that made a actually physical Balck Shark DATA Link panel? he has a functional panel that interacts with the virtual cockpit.. im just wondering if the server he joins had .lua export turned off, would his physical data link panel still work? IM HAPPY ABOUT YOUR WORK!! Edited November 18, 2009 by hannibal find me on steam! username: Hannibal_A101A http://steamcommunity.com/profiles/76561197969447179 Link to comment Share on other sites More sharing options...
RvEYoda Posted November 18, 2009 Author Share Posted November 18, 2009 My data link works with global exports turned off. This is because I write my own datalink server. Each player gets only local lua data like "What is my position". Then each player logs into LEAVU data link server (separate software) and says "Hi, my name is Yoda, this is my position..." S = SPARSE(m,n) abbreviates SPARSE([],[],[],m,n,0). This generates the ultimate sparse matrix, an m-by-n all zero matrix. - Matlab help on 'sparse' Link to comment Share on other sites More sharing options...
jason_peters Posted November 18, 2009 Share Posted November 18, 2009 looks cool - so is it available for d/l or still WIP ? --------- System: i7-8700k @ 4.9GHz; Nvidia RTX 2080ti; 32GB (2 x 16) DDR4 @ 3333Mz Ram; ASUS ROG Strix z370-E; SSD Drive; Oculus Rift-S; Thrustmaster HOTAS Warthog Link to comment Share on other sites More sharing options...
104th_Crunch Posted November 18, 2009 Share Posted November 18, 2009 There is an older version of LEAVU here in this thread, but the new LEAVU using Java is a WIP. Link to comment Share on other sites More sharing options...
hannibal Posted November 18, 2009 Share Posted November 18, 2009 are you running this with lockon or black shark in windowed mode or full screen? find me on steam! username: Hannibal_A101A http://steamcommunity.com/profiles/76561197969447179 Link to comment Share on other sites More sharing options...
104th_Crunch Posted November 18, 2009 Share Posted November 18, 2009 It is currently for the Lock On F-15, but who knows, maybe Yoda with some help will expand to other aircraft. You can run it either full or window in a second monitor Hannibal. If you would like to get some help with the current release of LEAVU, ask me the next time you're in Teamspeak. Link to comment Share on other sites More sharing options...
hannibal Posted November 19, 2009 Share Posted November 19, 2009 (edited) alright.. let me know what u need help with.. i can run setups or something.. i have elementary programming skills, and i can be good in graphics (albiet slow).. we'll talk... Edited November 19, 2009 by hannibal find me on steam! username: Hannibal_A101A http://steamcommunity.com/profiles/76561197969447179 Link to comment Share on other sites More sharing options...
RvEYoda Posted November 19, 2009 Author Share Posted November 19, 2009 Little new update to design changes. Also implemented network connection with lockon, so I can get the data I need ( but I just draw test shapes so far ) 1 S = SPARSE(m,n) abbreviates SPARSE([],[],[],m,n,0). This generates the ultimate sparse matrix, an m-by-n all zero matrix. - Matlab help on 'sparse' Link to comment Share on other sites More sharing options...
hannibal Posted November 20, 2009 Share Posted November 20, 2009 (edited) im good at photo shop... tell me what you need.. name an MFD / aircraft you want me to research/photoshop.. and give me the dimensions in pixels that you want the image to ultimately be.. Edited November 20, 2009 by hannibal find me on steam! username: Hannibal_A101A http://steamcommunity.com/profiles/76561197969447179 Link to comment Share on other sites More sharing options...
RvEYoda Posted November 20, 2009 Author Share Posted November 20, 2009 Basically it would be good to have the buttons look a bit nicer. So buttons and the panels around the display would need some nice shapes/picture. The dimension of the screen must be customizable. You can resize it to anything you want with any aspect without it becoming strange, but the button size themselves are fixed. (They only move with changing size of window) S = SPARSE(m,n) abbreviates SPARSE([],[],[],m,n,0). This generates the ultimate sparse matrix, an m-by-n all zero matrix. - Matlab help on 'sparse' Link to comment Share on other sites More sharing options...
hannibal Posted November 20, 2009 Share Posted November 20, 2009 hello. your project sounds interesting.. can you send me a bitmap/jpeg image of your original photo of your MFD F15 screen? i have sent you a PM, unless your fine with the one on the post. im going to do this in photo shop, so everything can be re-sized, but at the same time, i like to work of your original dimensions... find me on steam! username: Hannibal_A101A http://steamcommunity.com/profiles/76561197969447179 Link to comment Share on other sites More sharing options...
hannibal Posted November 20, 2009 Share Posted November 20, 2009 (edited) BY the way, is there any option are you able to make the option, to turn on/off the virtual frame with the buttons? your outer frame might be redundant for those who actually have a physically frame with buttons... i hope your application will all not only turn off the frame, but allow a controller/joystick functions work in conjunction with your buttons (that would have been in your virtual MFD frame)... Edited November 20, 2009 by hannibal find me on steam! username: Hannibal_A101A http://steamcommunity.com/profiles/76561197969447179 Link to comment Share on other sites More sharing options...
Recommended Posts