• 🏆 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!

[Tool/Hack] Unreal Jass Spy v4.0

Status
Not open for further replies.
Level 19
Joined
Dec 12, 2010
Messages
2,069
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:

152385d1455887700-tool-hack-unreal-jass-spy-v4-0-screenshot_16-02-19_20-03-52.png


  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:

attachment.php


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

attachment.php


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:
JASS:
local string teststring="functionname"
with RegExp replacing:
JASS:
function (.*) takes (.*)$
into
JASS:
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.
 

Attachments

  • screenshot_16-02-19_20-03-52.png
    screenshot_16-02-19_20-03-52.png
    61.5 KB · Views: 1,014
  • screenshot_16-02-19_20-09-55.png
    screenshot_16-02-19_20-09-55.png
    5.4 KB · Views: 1,064
  • screenshot_16-02-19_20-11-50.png
    screenshot_16-02-19_20-11-50.png
    7.2 KB · Views: 1,034
  • UnrealJassSpy.rar
    350.9 KB · Views: 420

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,195
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.
 
Level 9
Joined
Jul 30, 2012
Messages
156
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.
 
Level 19
Joined
Dec 12, 2010
Messages
2,069
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.

as I said this way will log way too many unneeded stuff. Also long replays will generate gigabytes of logs, which is also bad.
 
Level 3
Joined
Apr 25, 2013
Messages
38
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?
 
Status
Not open for further replies.
Top