Hiding any button!!! New method, please help me test it!!!

Level 8
Joined
Jul 30, 2012
Messages
154

This method crashes on Macs. Until I solve it, you should use [thread=261633]this[/thread] instead





Hello Guys!

Please forgive me for the title in caps, but I REALLY think this deserves some attention.

I JUST FOUND A NEW METHOD TO HIDE ANY BUTTON FROM THE COMMAND CARD!!!

That means ANY button, even the ones that we know to be "impossible" to remove.

MOVE, PATROL, STOP, ATTACK, HERO ABILITIES, BUILD, RALLY, EVEN THE CANCEL BUTTON CAN BE HIDDEN!

Any other ability can be hidden as well. No more need for disabled spellbooks!

The Concept

I got the original idea from this thread: http://www.hiveworkshop.com/forums/lab-715/removing-standart-command-buttons-commandfunc-txt-261559/
Credits go to ALEXz407 for his initial discovery. In his experiments he has found a way to hide anything from command card, by setting the Buttonpos to a big integer.

However, he reported that he was getting crashes randomly, and that this method was unsafe. Also, because it needed big integers, you couldn't use it inside World Editor because it does not allow you to input such integers.

So, I decided to track down the cause of the crashes in a debugger, and see if I could make that method more stable.

The crashes are caused because the values you put in Buttonpos are used directly in pointer arithmetic, with no safety checks. If you set it to a big integer, it will point to a random location in memory, which sometimes gives the desired effect, but may cause crashes as well.

Then I started to mess with the values to see if I could make it point to a stable location, and it seems that I got it!

How to hide ANY button from Command Card

You just need to set its position to 0,-11
(Only this specific value will work, that's what makes it point to a safe location in memory, anything else may cause crashes.)

Code:
[CmdMove]
Art=CommandMove
Buttonpos=0,-11
That will hide the Move button. You can also do it with any other ability in the World Editor, just set the X position to 0 and Y to -11. (You need to use Shift+Enter to input these values)

I have tested it many times and it never caused problems. The value -11 causes the game to reference a location in the begginning of a memory region, which seems to be safe.

I have attached a small test map. It's just the Bandit Ridge map with a modified CommandFunc.txt. All standard buttons of the UI (Move, Stop, Patrol, Hold Position and Attack) will be hidden. Cancel button is hidden as well, just for demonstration purposes,

Please help me test it, just to make sure it's safe.
 

Attachments

  • (2)BanditRidge.w3x
    164.7 KB · Views: 388
Last edited:
Level 12
Joined
Feb 22, 2010
Messages
1,115
I just tested it and tried to add a hidden endurance aura to a unit without spellbook and it seems to be working, maybe rip disabled spellbooks, nice find.
 
Level 8
Joined
Jul 30, 2012
Messages
154
You mean i can have 12. building in the build card inplace of goddamn cancel ?

Hmm, I didn't test this possibility, but probably it will work. I will experiment with this when I get home.

EDIT: Confirmed that it works
attachment.php
 

Attachments

  • WC3ScrnShot06101521595101.png
    WC3ScrnShot06101521595101.png
    1.8 MB · Views: 1,070
Last edited:
Level 8
Joined
Jul 30, 2012
Messages
154
Cool stuff indeed. Now the only thing even better would be to be able to dynamically show/hide buttons.

Nice find, though the number of practical applications outside of the "big five" (move, attack, patrol, stop, hold) is limited since you can not show/hide them dynamically.

Well, it can actually be achieved, depending on what you want to do. Abilities can be hidden in a per-unit basis by using this: http://www.hiveworkshop.com/forums/...78/disable-ability-specific-hero-unit-225879/

And if you want to hide/unhide the "big five" dynamically, there's also a way to do it: just hide them in CommandFunc.txt, and make 5 dummy abilities based on channel to replace them. Change the order ids of those abilities to move, stop, holdposition, patrol and attack, and change icons accordingly. Then if you want to hide any of them, just remove the dummy ability.
 
And if you want to hide/unhide the "big five" dynamically, there's also a way to do it: just hide them in CommandFunc.txt, and make 5 dummy abilities based on channel to replace them. Change the order ids of those abilities to move, stop, holdposition, patrol and attack, and change icons accordingly. Then if you want to hide any of them, just remove the dummy ability.
The problem with that is that this will never correctly mimic the visual behaviour of said buttons.
For example, when a unit is standing still, the "stop" button has a green frame. Hold position will be framed when this action is used aswell. And patrol will get a frame while the unit is patrolling.

However, I do see a cool use for this: as you can hide the cancel button aswell, you can use this to unlock a 12th spell slot in spellbooks.
 
Level 7
Joined
Aug 23, 2014
Messages
208
Congratulations

You just need to set its position to 0,-11
You made a brilliant from the raw idea, nice research!

Well, button stacking tutorial can be reduced to a single row now :)

However, I do see a cool use for this: as you can hide the cancel button aswell, you can use this to unlock a 12th spell slot in spellbooks.
Don't forget about usability. With hidden cancel you can not cancel things with ESC button aswell.
However, looks like Blizzard made different ways for cancelling things, so it will not ruin gameplay things like cancelling training/building/upgrading/casting/etc.
 
Level 8
Joined
Jul 30, 2012
Messages
154
I just tried twice on my mac, crashes when I try to select builder units.

Hmm... That was exactly what I was afraid of. Thanks for reporting, I really wanted someone to test it in a mac, as the memory layout is different there. Does it happen only when you select a peasant, or with any unit? Try to select your town hall as soon as the game starts and tell me what happens.

Also, could you please send me a copy of the game.bin and storm.bin libraries from the War3 folder? I'd like to analyze them and fix this problem.
 

TKF

TKF

Level 19
Joined
Nov 29, 2006
Messages
1,267
This is interesting, but if it makes mac players unable to play with lacking compatibility with setting the icons in a "unused" slot which apparently doesn't work for mac version I feel less tempted to use this. Perhaps there is a solution for that.
 
I will test it later, but uh.. I just realized that the buttons aren't functional if you hide them via this method - that's really limiting.. lol
Yeah it was the same thing with the old method.

Hotkeys don't work anymore. So hiding the attack button basicly removes the possibility to A-move.

Hiding 'move' or 'patrol' probably won't hurt anyone, though.

Btw, does the old method (setting icon position to insanely high numbers) also crash for macs or is that limited to the negative number approach?
 
Level 8
Joined
Jul 30, 2012
Messages
154
Btw, does the old method (setting icon position to insanely high numbers) also crash for macs or is that limited to the negative number approach?
No, the old method is 100% safe. I have examined the code and there is no possible way to crash with a big negative (NOT positive) number. Unless the code from mac version is somehow different from the windows version.

Anyway, I'm downloading the mac version of warcraft right now. I'll try to debug it in a VM and find a way to make it work there.
 
Level 8
Joined
Jul 30, 2012
Messages
154
Mac may be big endian.

What happens when you stack a lot of abilities on that invalid slot? Maybe if you have enough they get pushed back into the actual command card or in dangerous areas.

PowerPC Mac is big endian. Intel Mac is not.

But this doesn't make a difference. And the buttons don't really get "pushed" at all. See here for a detailed description of how the game UI works.

My method works by making the game read from some strange memory location. If the offset 0x94 at this memory location is set to 0, then the game will try to create the button in an invalid location and crash. If the value is different from 0 the button will not be created at all.

Unfornately I still didn't find a value that works both for windows and mac. Endianess does not matter, but the memory allocation schemes are different. Maybe it's not possible at all, I can't be for sure for now.
 
Top