• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[MemoryHacks] NewGen Integration

Status
Not open for further replies.
This thread contains a download of Jass NewGen Pack with support for the API @DracoL1ch recently posted. The API allows for basically unlimited possibilities in modding, without the need for 3rd party tools, and should work on Battle.net.

Memory Hack API (description)
Memory hack

Previously you had to manually edit your maps script, but now with this package you can make use of the API from within the editor, and while using vJass. For now, I attached a basic demo map. Later I'll improve on it. You can run the demo straight from your normal Warcraft III installation, or you can open it in the JNGP I provided below.

Download Jass NewGen Pack

The core of this package is a preprocessor which modifies your maps script and add the required code to use the API.

Source Code: GitHub - triggerhappy187/MemoryAPI-Installer
 

Attachments

  • MemHaxAPI Demo.w3m
    83.3 KB · Views: 492
Last edited:

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,183
Yup they work now.
When I try to save your demo map I get the following error though:
af0c43dcf7da841cbb335c5a7d67d0c4.png


Yes, I am running the JNGP you provided.
 
When I try to save your demo map I get the following error though:

Did you "Enable JASS Memory Hacks" from the Extensions tab? I will make it the default option next time.

great job
whole library barely useful normally, since it contains way too much weight from unused (by rest) APIs like http or blp-basis.
@karaulov still up to provide restore-only sublib :D

I was going to clean up the API, since like ytou said it's very bloated. Unless you're planning on doing that yourself.

BTW many things don't work for me (like you mentioned http), but mainly GetCurrentMapDir is what I need for File IO without admin rights (local folder).
 
You could upload the tool files, for manually installation?

The source code is linked in the first post and the executable is located at "JNGP/MemoryHack/installhack.exe".

installhack.exe map.w3x

I'll have more detailed instructions later. You can look at how I do it in wehack.lua.

this is really great, bu just to clarify, these are the kind of hacks that we are not sure, if they will survive the next patch, right?

Correct.
 
Level 9
Joined
Jun 21, 2012
Messages
432
Hey Trigger.

Does not seem to work at 100%.

The code that goes in the header is integrated correctly, but the rest as main.j does not work for me:

2-png.253204


And also the script file is very large, has many spaces between lines:

1-png.253203


I was thinking that the source code of JassHelper its free, it would be better if it were adapted to work with MemoryHack?, in my opinion...
 

Attachments

  • 1.png
    1.png
    44 KB · Views: 1,235
  • 2.png
    2.png
    70.1 KB · Views: 1,111
Level 9
Joined
Jun 21, 2012
Messages
432
Okay I will test it.

The many spaces are also caused by JassHelper, not my program.
But if I disable "Enable Jass MH" the compiled script does not have so many spaces between lines!

EDIT:

The new package gives me an error:

test-png.253208


If I disable the library, later a similar error appears again, something like: set u=GetTriggerUnit() call SomeFunction() in same line.
 

Attachments

  • test.png
    test.png
    34.9 KB · Views: 1,100
Last edited:
Update
  • Fixed a bug where multiple redundant newlines could be added to the map script.
  • Removed many of the useless or unused functions and globals from the API.
  • Renamed global variables that could easily conflict with others.

But if I disable "Enable Jass MH" the compiled script does not have so many spaces between lines!

Yeah sorry my program added some newlines that can't be seen in some editors, but it fixed an issue I had.

It's fixed now, though JassHelper does the same thing so it will still happen somewhat.

The new package gives me an error: If I disable the library, later a similar error appears again, something like: set u=GetTriggerUnit() call SomeFunction() in same line.

Can I see your map or your war3map.j?

Also try the newest update.
 
Update
  • Bundled the files in the MemoryHack folder into a single executable.
  • Fixed a bug that wouldn't allow insertjass.exe to run on some computers.
  • Renamed function Init -> MemoryHackInit
on my Win7 computer, JASSHelper popups from Compile Errors freeze WorldEdit

Try the new update.
 
Level 13
Joined
Oct 18, 2013
Messages
691
Try this. Find the file jasshelper.exe and run it, then uncheck "Always ask before opening this type of file" and see if it solves the problem.

Very nice! worked like a charm
 

LeP

LeP

Level 13
Joined
Feb 13, 2008
Messages
539
Why write a tool when we simply could refactor the memory-hack script to be clean vjass? splitting it up into libraries etc.
 
Level 13
Joined
Nov 7, 2014
Messages
571
Natives have to be above globals block

It seems in common.j some of the natives come before the globals block and some after?:
JASS:
...

// Not currently working correctly...
constant native AbilityId                   takes string  abilityIdString   returns integer
constant native AbilityId2String            takes integer abilityId         returns string

// Looks up the "name" field for any object (unit, item, ability)
constant native GetObjectName               takes integer objectId          returns string

globals

//===================================================
// Game Constants
//===================================================

    constant boolean            FALSE                           = false
    constant boolean            TRUE                            = true
    constant integer            JASS_MAX_ARRAY_SIZE             = 8192
...
endglobals

//============================================================================
// MathAPI
native Deg2Rad  takes real degrees returns real
native Rad2Deg  takes real radians returns real

...
 
Update
  • A black window will no longer popup if you don't have python installed.
  • "Disable vJass script optimizations" added back to the menu, but will not be used if memory API is enabled.
  • Renamed many things to hopefully prevent the false flag by google.
but jasshelper already allows to define custom natives, no?

Has to be above the globals block. Not to mention certain code has to be run first, which requires modifying the main function. That's possible to do manually but much better to have automated.
 
Level 2
Joined
Oct 20, 2011
Messages
7
Dear, Could you please tell me how to run the map?
I have used your WE and tested this w3x, but it still didn't work.
No error occured, but nothing happen in the game...
like image
 

Attachments

  • 20161126232326.jpg
    20161126232326.jpg
    79.4 KB · Views: 125
Level 2
Joined
Oct 20, 2011
Messages
7
Do you have the second option enabled?

we-png.253532



I am sure that the "Enable Jass Memory Hack" is Enabled, because it's enabled default.
I run the w3x from this WE that noting happen .Also the same run the w3x by war3 directly.
But when i change a little the code (just like space...) and save it(no jass error tips), this demo map will be broken, can't work in war3.
 
Level 7
Joined
Jan 23, 2011
Messages
350
I found a bug in the program, using this code, gives me an error of the memory hack's functions being undeclared, but if i put a "requires AnyLibrary" then it compiles perfectly

JASS:
library MSmod
 
    struct MSBonus extends array
     
        private real MSmod
     
        private method AIDS_onCreate takes nothing returns nothing
            set this.MSmod=0
        endmethod
        //! runtextmacro AIDS()
     
        method getMSBonus takes nothing returns real
            return this.MSmod
        endmethod
     
        method addMSBonus takes real amount returns nothing
            set this.MSmod =this.MSmod+amount
            call SetUnitMSBonus(this.unit,GetUnitMSBonus(this.unit)+amount)
        endmethod
     
    endstruct
 
endlibrary

Edit: I also get a critical error when using the variable of an already placed unit on the map
 
Last edited:
Level 2
Joined
Oct 23, 2016
Messages
8
Dear, Could you please tell me how to run the map?
I have used your WE and tested this w3x, but it still didn't work.
No error occured, but nothing happen in the game...
like image
I'm having the same problem like this guy too, please help. It possible, can you show me how to manually insert codes to maps. Btw, i'm using 1.24e patch.
P/S: I'm have bad english btw...
 
Status
Not open for further replies.
Top