Jump to content
Sign in to follow this  
jaynus

JayArma2Lib

Recommended Posts

VERSION: 1.4.35

CURRENT OA BETA SUPPORT: 1.60 RC2

Current ArmA2 VERSION SUPPORT: 1.09 FINAL

UPDATED: 12.10.2011

PLEASE NOTE:

this is initial release for preview and peer review. The first final release, later will include: SQLite support, C/C++ extension support, and a full Addon for API access to allow for ease of Yoma/whatever updates.

Besides the above mentioned, however, all features mentioned in the README work as documented. Initial install is also documented. It is the simple copying of 2 DLL's into your ArmA2 directory.

SECOND NOTE:

The final release version will consist of 1(ONE) DLL in the ArmA2 Root that will *not* change, and 1(ONE) DLL in an addon folder, @JayArma2Lib. So please do not rely on this release structure for anything critical/special/whatever.

Link: http://dev-heaven.net/projects/jayarma2lib/files

IF you run into a wierd error starting ArmA2 consisting of library errors, try:

http://www.microsoft.com/downloads/details.aspx?familyid=a5c84275-3b97-4ab7-a40d-3802b2af5fc2&displaylang=en

README:

JayArma2Lib

Jaynus' ArmA2 Extended Library

-------------------------------------------------------

INTRODUCTION

-------------------------------------------------------

JayArma2Lib is my creation to have access to either more efficient or extended functionality which the current ArmA2 engine lacks. This includes string functionality, data structure management, and named pipes access.

This can be considered the follow-up to the original 'armalib' by Kegetys. Sadly though, I was never able to get in touch with Kegetys, and therefore none of this work is based off of his except for the identification of the ArmA2 scripting function to replace.

In a nutshell, this library works by proxying the DirectSound library on any Windows system; DirectSound is dsound.dll. I then replace the KbAddTopic function. This function is the access point for all functionality within this library.

There are no requirements, except for using the latest version of ArmA2. Additionally, this library works BOTH server and client side.

-------------------------------------------------------

FEATURES

-------------------------------------------------------

- Named pipes access

- String manipulation functionality

- Hashtable (sorted list) functionality

- Logging to an external file

- Get local system time

- DLL Extension Support

- (Coming Soon!) SQL Support

-------------------------------------------------------

INSTALLATION

-------------------------------------------------------

You can follow an easy 1 step process for installation.

1. Extract all files to your ArmA2 Directory

2. Add @JayArma2Lib to your mod's path on your shortcut.

- Example Shortcut Path: "C:\Steam\steamapps\common\arma 2\arma2.exe" -mod=@JayArma2Lib

An addon for the functionality has also been provided. @JayArmA2Lib. Please add this folder to your mod's path.

This is to allow for easier updating of the core functionality via Yoma. You are *NOT* required to run this addon for JayArma2Lib to work; only if an Addon requires the use of it.

You can also add a line to your actual ArmA2 shortcut to disable this library.

Add -nojayarma2lib to your shorcut, and it will not load.

This library is also 100% BattlEye Compatible!

-------------------------------------------------------

UNINSTALL

-------------------------------------------------------

Delete dsound.dll and all associated JayArma2Lib Files.

-------------------------------------------------------

FUNCTION INDEX

-------------------------------------------------------

STRING FUNCTIONS

jayarma2lib_fnc_stringContains

Function:

BOOL ret = [string, StringToFind] call jayarma2lib_fnc_stringContains;

Description:

Checks to see if the first supplied string contains the second supplied string.

Example:

_ret = ["foobar", "foo"] call jayarma2lib_fnc_stringContains;

if(_ret == true) then {

...

};

jayarma2lib_fnc_stringIContains

Function:

BOOL ret = [string, StringToFind] call jayarma2lib_fnc_stringIContains;

Description:

Same as jay_string_contains, except case insensitive.

Example:

_ret = ["foobar", "foo"] call jayarma2lib_fnc_stringIContains;

if(_ret == true) then {

...

};

jayarma2lib_fnc_stringIndexOf

Function:

INT position = [string, StringToFind] call jayarma2lib_fnc_stringIndexOf;

Description:

Returns the 0-based index of the requested string to search for.

Example:

_pos = ["foobar", "bar"] call jayarma2lib_fnc_stringIndexOf;

// _pos will be 3

jayarma2lib_fnc_stringSubstr

Function:

STRING ret = [string, INT StartPosition, INT Length] call jayarma2lib_fnc_stringSubstr;

Description:

Returns the sub string from 0-based StartPosition, and length characters.

Example:

_sub = ["foobar", 3,3] call jayarma2lib_fnc_stringSubstr;

// _sub will be "bar"

jayarma2lib_fnc_stringTrim

Function:

STRING ret = [string] call jayarma2lib_fnc_stringTrim;

Description:

Removes all leading and trailing whitespaces from the provided string.

Example:

_clean = [" asdf "] call jayarma2lib_fnc_stringTrim;

// _clean will be "asdf"

NAMED PIPE FUNCTIONS

jayarma2lib_fnc_openPipe

Function:

HANDLE pipeHandle = [PipePath] call jayarma2lib_fnc_openPipe;

Description:

Attempts to open the specific pipe name. If fail, returns nil. Otherwise, it returns a handle to the pipe.

Example:

_pipeHandle = ["\\.\pipe\jay] call jayarma2lib_fnc_openPipe;

if(!isNil("_pipeHandle")) then {

....

};

jayarma2lib_fnc_closepipe

Function:

[HANDLE] call jayarma2lib_fnc_closepipe;

Description:

Attempts to close the provided pipe handle. fails silently; no return.

Example:

[_pipeHandle] call jayarma2lib_fnc_closepipe;

jayarma2lib_fnc_readopipe

Function:

STRING ret = [HANDLE] call jayarma2lib_fnc_readopipe;

Description:

Reads any data which may be waiting on the pipe. If no data, returns nil

Example:

_data = [_pipeHandle] call jayarma2lib_fnc_readopipe;

if(!isNil("_data")) then {

....

};

jayarma2lib_fnc_writepipe

Function:

[HANDLE, StringToSend] call jayarma2lib_fnc_writepipe;

Description:

Attempts to write the provided data to the specified pipe handle. returns false

on failure, true on success.

Example:

_ret = [_pipeHandle, "Hello World!"] call jayarma2lib_fnc_writepipe;

if(_ret == false) then {

player sidechat "Write Failed!";

};

HASHMAP FUNCTIONS

jayarma2lib_fnc_hashmapCreate

Function:

BOOL ret = [stringHashmapName] call jayarma2lib_fnc_hashmapCreate;

Description:

Creates a new internally stored, thread safe hash map with the specified name. returns FALSE on failure, true on success.

Example:

["MyHashTable"] call jayarma2lib_fnc_hashmapCreate;

jayarma2lib_fnc_hashmapDelete

Function:

BOOL ret = [stringHashmapName] call jayarma2lib_fnc_hashmapDelete;

Description:

Deletes and unallocates the specified hash map. returns FALSE on failure, TRUE on success.

Example:

["MyHashTable"] call jayarma2lib_fnc_hashmapDelete;

jayarma2lib_fnc_hashmapDeleteValue

Function:

BOOL ret = [stringHashmapName, StringKey] call jayarma2lib_fnc_hashmapDeleteValue;

Description:

Attempts to delete the specified key from the specified hash table. returns FALSE on failure, TRUE on success.

Example:

_ret = ["MyHashTable", "MyKey"] call jayarma2lib_fnc_hashmapDeleteValue;

if(_ret == false) then {

// that key didnt exist...

};

jayarma2lib_fnc_hashmapAddValue

Function:

BOOL ret = [stringHashmapName, StringKey, StringValue] call jayarma2lib_fnc_hashmapAddValue;

Description:

Attempts to add the provided key/value pair to the specified hash map. returns FALSE on failure, TRUE on success.

Example:

_ret = ["MyHashTable", "MyKey", "MyValue"] call jayarma2lib_fnc_hashmapAddValue;

if(_ret == false) then {

// that hash table didnt exist...

};

jayarma2lib_fnc_hashmapGetValue

Function:

STRING ret = [stringHashmapName, StringKey] call jayarma2lib_fnc_hashmapGetValue;

Description:

Attempts to get the value corrosponding to the provided key within the specified map. Returns the value on success, returns nil on failure.

Example:

_value = ["MyHashTable", "MyKey"] call jayarma2lib_fnc_hashmapGetValue;

if(!isNil("_value")) then {

....

};

MISC FUNCTIONS

jayarma2lib_fnc_writeLog

Function:

[stringToLog] call jayarma2lib_fnc_writeLog;

Description:

Writes to the local JayArma2Lib.log located in the ArmA2 Root.

Example:

["Hello log world!"] call jayarma2lib_fnc_writeLog;

jayarma2lib_fnc_getLocalTime

Function:

INT ret = [] call jayarma2lib_fnc_getLocalTime;

Description:

Gets the local time of the system in which the command is ran. The time is provided in 24-Hour Metric Time (12.5 = 12:30).

Example:

_time = [] call jayarma2lib_fnc_getLocalTime;

if(_time == 1.0) then {

// its 1AM...

};

-------------------------------------------------------

LINKS

-------------------------------------------------------

Dev-Heaven: http://dev-heaven.net/projects/jayarma2lib

BIS Forums: http://forums.bistudio.com/showthread.php?t=98647

-------------------------------------------------------

CREDITS

-------------------------------------------------------

- A2TS3 Team for helping with functionality requests

- Nou for addon help and getting me in touch with A2TS3

- Task Force Proteus @ TacticalGamer.com for being my

guinea pigs.

- TacticalGamer.Com Admin team for supporting me and

helping me with so much server side testing.

-------------------------------------------------------

CONTACT

-------------------------------------------------------

E-Mail: jaynus@gmail.com

BIS Forums: jaynus

TacticalGamer.Com Forums: jaynus

Dev-Heaven Jabber: jaynus@gmail.com

-------------------------------------------------------

KNOWN BUGS

-------------------------------------------------------

Edited by jaynus

Share this post


Link to post
Share on other sites

Any chance your could add mysql support.

Also is there any chance of the source code for this as i would love to learn how to do dll injections

Share this post


Link to post
Share on other sites

MySQL? Why? There is going to be a planned extensions support so adding your own wrapper DLL to MySQL wouldn't be hard, but that seems over kill. SQLite support is coming though.

Also I can almost 100% guarantee you will never, ever, see the source code to this.

Share this post


Link to post
Share on other sites

One of the best release ever made for arma 2 ! :yay:

And it works with BattleEye ! :clap:

Thanks !

Share this post


Link to post
Share on other sites
Any chance your could add mysql support.

Also is there any chance of the source code for this as i would love to learn how to do dll injections

Hi, here's something to get you started, links to lots of code as well: http://en.wikipedia.org/wiki/DLL_injection

-OP

Share this post


Link to post
Share on other sites

Thx for the release! :thumbsup:

ArmedAssault.info Mirror and News:

98925.gif

We have also added this release to your personal author profile

If a release or contact information is missing, feel free to drop a PM, it will then be added.

And here is the BBCode if you want to add our Mirror to your release post :

[url=http://www.armedassault.info/index.php?cat=utilities&game=1&id=93][img=http://www.armedassault.info/mirrorgen2/98925.gif][/url]

If you prefer a text only BBCode please copy and paste the code below :

[b]ArmedAssault.info Mirror :[/b]
[url=http://www.armedassault.info/index.php?cat=addons&game=1&id=93]DOWNLOAD - JayArma2Lib (v.0.9.5 - BETA 1) - [95.5 KB] from ArmedAssault.info[/url][/spoiler]

Share this post


Link to post
Share on other sites
Any chance your could add mysql support.

Also is there any chance of the source code for this as i would love to learn how to do dll injections

#1. Nou hit the nail on the head for these. I can see the desire for mysql server side; but performance wise, unless your topping 20,000 records, sqlite in-memory will be faster, hence I'll be sticking with that (same syntax anyways).

#2. no, source code for the actual DLL's wont be released. I am making an "extension" API for 3rd parties can load up as well and "register" commands with my library.

Share this post


Link to post
Share on other sites

Beta 2 complete.

- Made named pipe reading non-blocking, readpipe will always return immidiately; and null if no data was avialable

- fixed clock syncing

- fixed a few crashes where values wern't being checked correctly

- implemented Addon structure

- Changed kbAddTopic name back to original; now passthru to function if the call isnt for us. Fix for ALICE/FUNCTIONS/whatever foo

- initial SQL functions are in but function calls not implemented

- DLL Extensions integrated and avialable

- Functions renamed for CBA function declarations

- Now requires CBA

Share this post


Link to post
Share on other sites

Cool release.

Not long ago, you were going to implement DirectInput mouse coords/buttons... that still going to make it in? :)

Share this post


Link to post
Share on other sites

Yup, it will be making it in; I just haven't completed DirectX hooking completely yet.

This is last beta until I push a V1 final.

Share this post


Link to post
Share on other sites

Nice work indeed...

I guess that's no way to get it working with linux?

Share this post


Link to post
Share on other sites
Nice work indeed...

I guess that's no way to get it working with linux?

For dedicated server?

There is, it will just take some porting on my part. I'll make a ticket of it and see :)

Share this post


Link to post
Share on other sites

missing the getURL function to request a file as string from URL (maybe with cUrl)

nice work!

Share this post


Link to post
Share on other sites
Any chance for a fast 1.07 support?

Hehe, its there, but its only in the ACRE alpha right now... :p

Ummm those can be found pretttty easily if you go check the acre thread and look at some of the images posted recently... ;)

Share this post


Link to post
Share on other sites

Unfortunately it crashes the dedicated server of 1.07 (arma2server.exe) when using pipes.

The non-dedicated arma2.exe runs fine with the -server option.

Share this post


Link to post
Share on other sites
Unfortunately it crashes the dedicated server of 1.07 (arma2server.exe) when using pipes.

The non-dedicated arma2.exe runs fine with the -server option.

Nevermind. a German ACRE tester was kind enough to test for me.

http://dev-heaven.net/projects/jayarma2lib/files

Updated to V1.0. Supports 1.07 and OA.

Edited by jaynus

Share this post


Link to post
Share on other sites

It looks to be the same what I extracted from ACRE RC4, so the bug above remains: it does not work with the 1.07 dedicated server .exe, at least in my case it crashes arma2server.exe with pipes.

"arma2.exe -server" is fine.

You probably have a bad patch address somewhere with the dedi exe.

Thank you for the lib anyway, it is extremely useful! :bounce3:

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×