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

Problems with JassHelper in Reforged

Level 9
Joined
Jul 20, 2018
Messages
176
In this thread I would like to discuss some problems with JassHelper in Reforged. I posted them in far 2019 after 1.31 release on wc3maps.com/feedback, but that site was shut down, so I am making here a new post.



Settings inside World Editor

At first let's look at JassHelper settings in Reforged editor.
1656972429410.png


And now look at them in JNGP or WEX:
1656973119695.png


Let's refer to the JassHelper manual:
  • --debug : This flag will make jasshelper compile in debug mode (more information in the quite extense vJass section). It also turns --nooptimize on.
  • --nopreprocessor : If for some reason you just want to check normal Jass syntax, and call PJass using jasshelper as proxy, so you can use this option.
  • --nooptimize : Disables optimization, refer to the script optimization section for more information.

Basically, --nopreprocessor and --nooptimize are inverted in Reforged for some reason. And this change causes issues discussed below.

Let me introduce a notation [xxx], where x can be 1 or 0.
For example, [101] means that Enable vJass is marked, Enable debug mode is NOT marked and Enable optimizer is marked:
1656973401892.png


I used next code snippet to test settings :
JASS:
function foo takes integer i returns integer
    return i
endfunction

function main_foo takes nothing returns nothing
    local integer i = foo(10)
endfunction

function main_vjass_foo takes nothing returns nothing
    local integer i = foo(10)
    debug local integer a = foo(15)
endfunction
When Enable vJass is not marked, function main_vjass_foo is commented.


All tests below were performed on 1.32.10. Each spoiler box contains code after preprocessing and related comments.

JASS:
function foo takes integer i returns integer
    return i
endfunction

function main_foo takes nothing returns nothing
    local integer i= foo(10)
endfunction

//function main_vjass_foo takes nothing returns nothing
//    local integer i = foo(10)
//    debug local integer a = foo(15)
//endfunction

Everything is disabled, so nothing should change. So it does.
JASS:
function foo takes integer i returns integer
    return i
endfunction

function main_foo takes nothing returns nothing
    local integer i= ((10)) // INLINED!!
endfunction

//function main_vjass_foo takes nothing returns nothing
//    local integer i = foo(10)
//    debug local integer a = foo(15)
//endfunction

Optimization is enabled, and foo is inlined indeed.
JASS:
function foo takes integer i returns integer
    return i
endfunction

function main_foo takes nothing returns nothing
    local integer i = foo(10)
endfunction

//function main_vjass_foo takes nothing returns nothing
//    local integer i = foo(10)
//    debug local integer a = foo(15)
//endfunction

Optimization is disabled and not performed. Features of debug mode cannot be tested, because vJass is disabled.
JASS:
function foo takes integer i returns integer
    return i
endfunction

function main_foo takes nothing returns nothing
    local integer i= ((10)) // INLINED!!
endfunction

function main_vjass_foo takes nothing returns nothing
    local integer i= ((10)) // INLINED!!
endfunction

Optimization is NOT enabled, but it is still done!
JASS:
function foo takes integer i returns integer
    return i
endfunction

function main_foo takes nothing returns nothing
    local integer i = ((10)) // INLINED!!
endfunction

//function main_vjass_foo takes nothing returns nothing
//    local integer i = foo(10)
//    debug local integer a = foo(15)
//endfunction

Optimization is enabled, but debug mode is enabled too; therefore, optimization must not be done. But alas, it is performed.
Features of debug mode cannot be tested, because vJass is disabled.
JASS:
function foo takes integer i returns integer
    return i
endfunction

function main_foo takes nothing returns nothing
    local integer i = foo(10)
endfunction

function main_vjass_foo takes nothing returns nothing
    local integer i = foo(10)
    debug local integer a = foo(15)
endfunction

Code is left absolutely unchanged. Since pure JASS does not have debug keyword, a syntax error is emitted.
JASS:
function foo takes integer i returns integer
    return i
endfunction

function main_foo takes nothing returns nothing
    local integer i= foo(10)
endfunction

function main_vjass_foo takes nothing returns nothing
    local integer i= foo(10)
endfunction

Optimization is disabled and not performed.
Debug statement is removed, despite enabled debug mode.
JASS:
function foo takes integer i returns integer
    return i
endfunction

function main_foo takes nothing returns nothing
    local integer i= ((10)) // INLINED!!
endfunction

function main_vjass_foo takes nothing returns nothing
    local integer i= ((10)) // INLINED!!
endfunction

Optimization is enabled, but debug mode is enabled too; therefore, optimization must not be done. But it is performed anyways. Debug statement is also missing.



Configuration file

JassHelper requires jasshelper.conf file to specify paths to pjass.exe, blizzard.j and common.j and some other settings. Below you can see jasshelper.conf with all usable settings in Reforged:
Code:
[jasscompiler]
"pjass.exe"
"$COMMONJ $BLIZZARDJ $WAR3MAPJ"

[lookupfolders]
// Just type the folders where //! import would look for if relative paths where used, include the final \
// embed them in quotes
// example: "c:\"
// The order causes priority:

[noreturnfixer]
// Change [noreturnfixer] to [doreturnfixer] in order to enable the patch 1.24 return bug fixer
// (not necessary unless you are on patch 1.24, bug was fixed in patch 1.24b)

[doshadowfixer]
// Enable the local variable shadowing phase

// To disable automatic .evaluate of methods that are called from above their declaration,
// add a line containing [forcemethodevaluate]

// To disable implicit usage of members and methods (i.e., not requiring this. ),
// add a line containing [noimplicitthis]

If you install a fresh copy of Reforged, then jasshelper.conf will look next way:
Code:
[jasscompiler]
"pjass.exe"
"$COMMONJ $BLIZZARDJ $WAR3MAPJ"

If you edit it, after some time Blizzard Battle.net will ask you to update the game even though there none of them. When you do it, all changes made in jasshelper.conf will be erased. This issue makes Reforged button in the launcher to always be "Update". Thus, you never know for sure, whether there is a true update or launcher just want to "fix" the game.



Summary
  • JassHelper can perform optimization even if it is not enabled.
  • Debug mode is always disabled.
  • Some combinations of options lead to syntax errors.
  • Blizzard Launcher always tries to "fix" customized jasshelper.conf, replacing "Play" button with "Update".

How to overcome issues
  1. Save maps as a directory, disable JassHelper in the editor and use JassHelper via CLI (tutorial).
  2. Disable automatic updates for WarCraft III Reforged and always hold a copy of customized jasshelper.conf. I personally always open it in Notepad++ before updates to save changes.
 
Last edited:
Level 19
Joined
Jan 3, 2022
Messages
320
Great testing! This must be really annoying.
What happens when you set the .conf file to read-only or set it to "archived" mode? Bnet app shouldn't be able to overwrite it.

I imagine another working solution on Windows, interception via "debugger". Windows allows you to set a debugger program per .exe path in registry. This "debugger" can be anything, but it this case it should be a program that takes control and launches your copy of JassHelper & config.
 
Top