HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

jAPI - Version 1.0

01-24-2006, 02:20 AM#1
xttocs
The Jass Tool is the prebuild tool using japi.dll. I'm pretty sure it should work now...

// Original Post
This is my first version of the Jass Hacking API that allows you to create new natives. Included is the source code only, so it is up to you to create a program to use it. I reccomend creating a dll using my code and then injecting it into the game or the editor. Here are some tutorials and resources for you coders interested in trying this:

http://www.thecodeproject.com/dll/DL...n_tutorial.asp
http://www.megasecurity.org/Programm...Injection.html
http://www.planet-source-code.com/vb...tp%2FC83204982

Just search google and you can find plenty more.

You will need to inject your code immediately after creating the process for this to work. I have included some sample code of adding natives in the .rar in addition to the two files that make up this library.

There is more to come (at least a bit), but I figured I'd release what I have so far.

Have fun, good luck, and enjoy.

Edit:

Hmm, actually, to make it easy... I'll release an entire project using this source code with the loader and all premade. It will have a plugin-like setup that will allow you to create new natives by simply building a dll that exports the native you want to add.

// End of Original post
Attached Files
File type: rarjAPI Tool - Working 1.0.rar (83.6 KB)
01-24-2006, 04:46 AM#2
Extrarius
I know it isn't exactly the same thing, but you might want to take some inspiration from MetaMod(a Half-Life 1 tool used to modify mods, thus the name) as far as the way the interface it exposes allow an arbitrary number of user dlls to be loaded =-)
If you design it right, others could make both new natives(the whole point of your work) and non-native additions (for example, an auto-downloader that could fetch missing dlls from a central 'WC3 MetaMod' website and register them with the program if the user approves)
01-24-2006, 03:09 PM#3
IPEONRUSH-SHIP
interesting. Tha'ts the extent of my knowledge on this, i just know there's more possibilites on this. IF this is what i think it is then it could really benefit a lot of us who don't play melee but who like the competition part of it.

Keep up the good work :)
01-24-2006, 03:41 PM#4
Zoxc
Maybe we might find a way to sync things throught this?
01-24-2006, 05:21 PM#5
Chuckle_Brother
Finally, someone put out the source code for something, and it's in a language I have had the chance to learn. Huzzah!. So anyway, now that we have these capabilities we really need to figure out HOW the game derives certain values, such as damage and such....otherwise this is just a load of code that won't be able to help anyone really.
01-24-2006, 05:37 PM#6
Zoxc
Quote:
Originally Posted by Chuckle_Brother
Finally, someone put out the source code for something, and it's in a language I have had the chance to learn. Huzzah!. So anyway, now that we have these capabilities we really need to figure out HOW the game derives certain values, such as damage and such....otherwise this is just a load of code that won't be able to help anyone really.

Except creating custom ladder systems and deliver messages from web into map. This will only work if one of the players has the mod.
01-24-2006, 06:46 PM#7
Extrarius
Quote:
Originally Posted by Zoxc
[...]This will only work if one of the players has the mod.
I'm fairly certain every player will need the mod, because without it the Jass will seem to contain invalid code (that calls undefined functions) and thus it should cause an error.
There might be ways around that problem, such as altering an almost-never-used native to make it do something special if a certain value is passed in, but that would be a fairly difficult addition to what xttocs has released.
01-24-2006, 08:58 PM#8
xttocs
Ext, that is not difficult to add at all. Also, there numerous natives that are part of the game that aren't listed in common.j but are still already part of the game.

Here are some of the natives that are already present but do nothing.
Code:
Prototype - Native Name
"(S)V" - "DebugS"
"(SI)V" - "DebugFI"
"(SI)V" - "DebugUnitID"
"(IS)V" - "DisplayText"
"(ISI)V" - "DisplayTextI"
"(ISII)V" - "DisplayTextII"
"(ISIII)V" - "DisplayTextIII"
"(I)V" - "DebugBreak"
01-24-2006, 09:27 PM#9
COOLer
i seem to get compile errors on
[Warning] `naked' attribute directive ignored
`push' undeclared (first use this function)
void __declspec(naked) jInitializing_hook()
{
__asm
{
push ecx
push edx
call jInitializing
pop edx
pop ecx
jmp jBindNative
}
}
01-24-2006, 09:59 PM#10
Zoxc
Me too, what do you use to build it? to both of ya ;)
01-24-2006, 10:05 PM#11
COOLer
I got it to work you needed complie it as a libray im using Dev C++ IDE

this is the native that i want to add.
bool IsKeyPressed(char a){
if(kbhit()&& a == getch())
return true;
return false;
}

basicly it checks if key has been pressed and then gets the key and see if it is equal to the value passed.

hmm it only works on concle apps...
01-24-2006, 10:55 PM#12
Extrarius
Quote:
Originally Posted by xttocs
Ext, that is not difficult to add at all. [...]
It depends on what you mean - finding a native isn't hard, but you can't just make it do ANYTHING special, it has to do a very certain thing - namely, execute jass script from somewhere that the other player's wc3's won't look, so theirs will run fine and won't have syntax errors but the hosts' file will do something different without desyncing. That seems to mean it could save everybody's info, but only the host could restore it (and even to do that much, you'd need some way to send info from the host to clients so they could decode the stored 'save code', maybe like tricking the host's wc3 into thinking he typed the text code to all players).

As far as how to compile it, you need MSVC because GCC uses a different format for inline assembly. Currently, though, the code isn't very useful to anybody that doesn't know how to inject a DLL into a process because xttocs hasn't added in that part yet.
You can freely (and legally) obtain VC 2005 Express Edition for several months (it's going to be downloadable for 1 year total, but once you download it you can freely use it forever), or if you can't stand the 2005 interface (like me), you can get VC Toolit 2003 for free (legally), but it only contains the command-line compilers and not the fancy interface (I use VS2002 w/ the 2003 compiler)

Note that if you get either one of the free versions listed above, you'll also need to download the Platform SDK and set up your compiler to work with it. The retail versions of visual studio come with the platform SDK, but it's a large download so the free versions don't include it.
01-24-2006, 11:02 PM#13
Zoxc
We can make ladder systems
01-24-2006, 11:08 PM#14
Extrarius
Quote:
Originally Posted by COOLer
I got it to work you needed complie it as a libray im using Dev C++ IDE

this is the native that i want to add.
bool IsKeyPressed(char a){
if(kbhit()&& a == getch())
return true;
return false;
}

basicly it checks if key has been pressed and then gets the key and see if it is equal to the value passed.

hmm it only works on concle apps...
You'll have to use Windows API calls to do that kind of thing. GetAsyncKeyState is probably the function you want, but you could also use GetKeyboardState to get the status of every key. Note that such a native could only be used to control local things, because the other players will get different results. You would need to make some kind of 'DoesPlayerHaveKeyPressed' function and make it somehow synchronize between all players (a LOT of work if we don't find a way to use what wc3 already does, and even then it will feel laggy just like the arrow keys do because the synchonization is why they feel laggy).
01-24-2006, 11:31 PM#15
Zoxc
I think he wanted it for single player... also its easy to sync a bool (0.5 sec thus...)