Jump to content

Recommended Posts

Posted (edited)

Check this, might work. (probably the latest dll source code)

Honestly I did a lot of things wrong there (I'm not a c++ coder), so feel free to correct the stuff:

 

http://kenai.com/projects/leavu2/sources/subversion/content/LEAVU/Lua%20Export/src/luaKeys.cpp?rev=742

 



//Simple DLL for lockon to see if a key is pressed

#define LUA_BUILD_AS_DLL
#define LUA_LIB

#include "Windows.h"


extern "C"{
#pragma comment( lib, "lua.lib" ) // Compiled earlier
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
}

// Lua will see the returned variables as a value or nil
static int has_been_pressed(lua_State *L) {
if (GetAsyncKeyState((int)luaL_checknumber(L, 1))!=0)
	return 1;
return 0;
}


static const luaL_reg testlib[] =
{
{"has_been_pressed", has_been_pressed},
{NULL, NULL}
};

extern "C"{
LUALIB_API int init_libs(lua_State *L) {
 luaL_openlib(L, "kb_fcns", testlib, 0);
 return 1;
}
}

 

I also experimented back then with creating DIRECTX stuff this way through LUA, but it didn't go so well :P.

 

WARNING: GetAsyncKeyState is not thread safe or afaik even multi-app safe! Only 1 app can use it at the same time cause every time you ask the OS "has this button been pressed this the last time I asked", will cause it to *clear* the state. I used this function because lockon blocks all "normal" ways to access OS global keyboard input in the background. (DirectInput/DirectX with callbacks does work though, but I kept failing to create any DX devices :( in a dll accessible by lua )

 

Oh and as a sidenote, keep working on this stuff u think is fun. I actually got to show LEAVU at a job interview (lol) and it got me a job working on the real thing. Details err...classified ;)

Edited 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'

Posted

LEAVU2: Approved by RL fighter aircraft manufacturer. Coming soon to an F-XX near you ;)

[sIGPIC][/sIGPIC]

Reminder: SAM = Speed Bump :D

I used to play flight sims like you, but then I took a slammer to the knee - Yoda

Posted

Fantastic Yoda! I'm curious as to what technologies you are working with. C++ I guess since that's what the F-22 and F-35 software was written in. OpenGL, or you don't need to go to that level?

 

nb. I'll finally be at home tonight so will send the source I have through - including the mechanical aircraft status mods I made.

Posted

Ooh, you're working for the defense industry now are you Yoda? Anyway concerning this mod, I certainly am planning to continue work on it. Currently I'm planning to implement the other feature of the radar that GGTharos has mentioned as well as incorporating Moa's aircraft mechanical status mod. And as you mentioned this mod might just help me find a job as yours helped you get a job, I'll see :).

 

I'll look into the dll source code that you have posted Yoda as well as the one that Moa has when he gets around to sending it through. Thanks by the way Moa :).

  • 2 months later...
Posted

Hi guys, I noticed that there have been more people that have downloaded this mod since not too long ago, so I'm wondering if anyone has any feedback for it. And also, I have to find some time to add the other features that I am planning to do.

Posted

I tried the mod and i can say it's working you need to use lock and unlock key but it's working good for now. Also would be nice to put some exports on leavu like berioza and navigation mod (bering and distance from bullseye) and digital fuel left. Anyway very good work.

Rocket brigade who retired F-117

Posted

hi gents and thanks for hard work.

i got 2 questions

does it work with 64 bit win7 and is it allowed online on servers with file check?

Posted
hi gents and thanks for hard work.

i got 2 questions

does it work with 64 bit win7 and is it allowed online on servers with file check?

 

Yes and no or maybe No and yes. Who know's what is for what :-).

Joking, it's working windows-7 64 bit's and lot's of servers do not support export.lua. I hope you will be lucky finding servers who are supporting this mod.

Rocket brigade who retired F-117

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...