1. Find your way through the deepest dungeon in the 18th Mini Mapping Contest Poll.
    Dismiss Notice
  2. A brave new world lies beyond the seven seas. Join the 34th Modeling Contest today!
    Dismiss Notice
  3. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
Hive 3 Remoosed BETA - NOW LIVE. Go check it out at BETA Hive Workshop! Post your feedback in this new forum BETA Feedback.
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[Tool/Hack] Unreal Jass Spy v4.0

Discussion in 'Warcraft Editing Tools' started by DracoL1ch, Feb 19, 2016.

  1. DracoL1ch

    DracoL1ch

    Joined:
    Dec 12, 2010
    Messages:
    2,040
    Resources:
    2
    Tutorials:
    2
    Resources:
    2
    A tool for advanced JASS decompiling at runtime.

    How it works
    Everytime a native from common.j called, it being hooked and written into the log. Then action starts, and, if it didn't crash, line being marked with [returned value] or [OK].

    It's useful when
    You've got unknown crash or undefined behaviour or strange bugs which cannot be found deductively.

    How to use
    You will need an Injector in order to use it properly. Why? Because it hooks EVERY single native, which are being executed. It happens everytime when you selects map - game parses initializing code and find info about players. When map loading it's tracking every native call made from Common.j, Blizzard.j and the script from map itself. Normally it's 10000+ native calls.

    Writting happens at the very moment the native is called. That causes hard drive "overheat" - literally it asks for file way too often. Because of that and exlusive "access lock" you won't be able to open and look at the data while WC3 is running.

    JassSpy.ini (in the archive) allows you to select which natives you'd like to track. By default - every. You can disable some of them, but normally I prefer to watch at the whole log. OK, let's get started.

    Drop JassSpy files into the WC3's folder, Injector's location doesn't matter.

    So, run the map (or replay), run D3SceneInjector (in the archive), get to the place you'd like to inspect (prepare the skill or situation or fast forward replay to desired position), switch over to injector and insert "war3" into "Processname". Then select UnrealJassSpy.dll as "File you want to inject". Note: you have to put replay on pause in order to not overload writting query.

    Injection starts when you make any action (left click) at War3 window and takes 10-20 seconds, based on your CPU speed, longer for old machines. As soon as WC3 become operable you can unpause replay or start reproducing.

    Result:
    Everything being stored at jassSpy.txt file:

    [​IMG]

    1. A line which marks module loading started;
    2. Exec: Native;
    3. Handle, related to any handle-based object in game;
    4. Returned handle object;
    5. Object's ID, used in editor;
    6. It parses every value big enough to be translated into hex;
    7. Function which returns nothing, as example.

    Be aware that included functions like filters fires right inbetween main function. For instance, filter starts right after GroupEnumUnitsInRange being called, causing following listing:

    [​IMG]

    Mark about "succesfully done" and given params will be found at the very end of filtering:

    [​IMG]

    And so what?
    You will only see raw natives. You won't have any idea what function are running right here. At best you could track it by raw data mentioned around and actions order. For my researches I used next line:
    Code (vJASS):
    local string teststring="functionname"

    with RegExp replacing:
    Code (vJASS):
    function (.*) takes (.*)$

    into
    Code (vJASS):
    function \1 takes \2
    local string teststring="\1"

    Surely you'll need some proper text tool in order to apply it to the whole script.

    Last words
    I didn't understand this tool until started developing myself. It saved me a lot of time debugging non-obvious things. It also shown me many bad perfomance-wise decisions, allowing me to fix it.

    Use it to fix unknown issues or speed up your map - whatever you need.

    Archive listing:
    Injector; config file; DLL.
     

    Attached Files:

  2. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    26,199
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    Looks like an improvement from nothing to something as far as JASS debugging goes. Still a long way off from StarCraft II with its script error logging and test with debugger mode.

    Would be useful if one could extract the JASS bytecode into some form of assembly listing and then add break points to that assembly to inspect values.
     
  3. leandrotp

    leandrotp

    Joined:
    Jul 30, 2012
    Messages:
    153
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    This is a very interesting tool. But it can be even easier to use: just drop the files in the WC3 folder, and rename UnrealJassSpy.dll to UnrealJassSpy.mix. WC3 automatically loads any DLLs with the .mix extension from the game folder. This way you don't require an injector, the DLL is loaded as soon as you launch the game. Obviously it will take a few more seconds to start than the usual.

    And also, you said it wasn't possible, but I was able to normally open the JassSpy.txt file, and see partial data while the game was running. Maybe it's because I'm running Windows 10, idk.
     
  4. Chaosy

    Chaosy

    Tutorial Reviewer

    Joined:
    Jun 9, 2011
    Messages:
    11,102
    Resources:
    18
    Icons:
    1
    Maps:
    1
    Spells:
    10
    Tutorials:
    6
    Resources:
    18
    Can be useful but I feel like very few will use it because very few will understand how to use it, and even worse understand the log.

    A suggestion for further development is to add a button in JNGP to open up the log, it would make it way easier to use and access that way.
     
  5. DracoL1ch

    DracoL1ch

    Joined:
    Dec 12, 2010
    Messages:
    2,040
    Resources:
    2
    Tutorials:
    2
    Resources:
    2
    as I said this way will log way too many unneeded stuff. Also long replays will generate gigabytes of logs, which is also bad.
     
  6. leandrotp

    leandrotp

    Joined:
    Jul 30, 2012
    Messages:
    153
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    But in the case someone has a crash in the map initialization function, they do need to inject the dll in the very beginning.
     
  7. DracoL1ch

    DracoL1ch

    Joined:
    Dec 12, 2010
    Messages:
    2,040
    Resources:
    2
    Tutorials:
    2
    Resources:
    2
    well I've never seen such case :D ok
     
  8. Ezekiel12

    Ezekiel12

    Joined:
    Mar 13, 2012
    Messages:
    1,061
    Resources:
    0
    Resources:
    0
    Can you provide the source?
     
  9. puffdragon

    puffdragon

    Joined:
    Jul 10, 2008
    Messages:
    352
    Resources:
    0
    Resources:
    0
    UnrealJassSpy.dll for 1.27 needed if anyone has a new version.
     
  10. So this doesn't work for 1.27?
     
  11. Hannibal

    Hannibal

    Joined:
    Apr 25, 2013
    Messages:
    37
    Resources:
    0
    Resources:
    0
    I would like to use this as I am dealing with a unknown crash that happens about 35 minutes in game with no trigger at that time to look at as the obvious suspect. I am completely lost having re-read the 'How to use' several times and am quite confused on what to do?

    First does with work with 1.27b?
    Next ideally when testing the game I should turn this on around the 30 minute mark to try and capture the error (which isn't always producing a crash report).
    Finally, I am a little confused on the use of injectors. When I attempt to use it warcraft 3 just encounters an error and needs to be closed. Is this due to the update?
     
  12. DracoL1ch

    DracoL1ch

    Joined:
    Dec 12, 2010
    Messages:
    2,040
    Resources:
    2
    Tutorials:
    2
    Resources:
    2
    this tool works only under 1.26a