Magicka 2

Magicka 2

31 ratings
Removing Cooldown Between Casting Magicks
By Alex
When you cast a magick with a combination of elements you have to wait for 3 seconds before casting another one. A great disappointment for those who appreciated how fun it was to throw the world into an utter chaos with infinite thunder bolts, dragon strikes and tornados in Magicka 1. And feeling limited to use teleport and revive your friends is just awful!

Good news: It's possible to remove the cooldown between casting magicks!
   
Award
Favorite
Favorited
Unfavorite
Download and Install
  • Download the patched file 171e8b0d2241eb79[drive.google.com]
  • Put it into this directory and cofirm file replace:
    <Steam installation directory>\steamapps\common\Magicka 2\data
    most likely on your PC it is:
    C:\Program Files (x86)\Steam\steamapps\common\Magicka 2\data
  • Enjoy!
Demo
How It's Done
Disclaimer:
This part might be interesting to developers. It is a little story how I managed to remove the cooldown. You absolutely do not have to read this.


First of all, let's take a look at the game data files.

File names look not that friendly :/
Magicka 2 is based on the Bitsquid game engine (same engine of Magicka Wizard Wars) which uses such unfriendly namings.

Fortunately, I have found a toolkit[github.com] that allows to unpack Bitsquid data files. Then, somewhere on the internet I found that the file named 171e8b0d2241eb79 contains the scripting files (Bitsquid uses Lua for scripting). So I tried to unpack that file first, and after some unlucky attempts the tool suddenly bloated with promisingly looking lines.

Hurray!
The resulting directory contained a lot of .lua files.

Unfortunately, these were not the original lua textual source files

After spending plenty of time in Google and hex editor, I found out that this are LuaJIT compiled lua files prefixed by some bytes containing the size of the file.
Also it looks like each file contained its own path (virtual path?) in the file system of the game. Very handy to have some hints about what the file is about. Since I wanted to remove the cooldown between casting magicks, I picked some files related to magicks, deleted first 8 bytes (that prefix with the file length) of their content and then started trying to decompile them. I tried one decompiler after another until one of them[gitlab.com] processed the input file without any errors... And even produced some output file...
Holding breath in anticipation, I opened that file and...
Gotcha! Now it becomes really interesting!
After decompiling some more files and doing some research, I found this:
This little fun-breaking digit. This is the value of the cooldown. It absolutely must have been set to zero!
So, the target was found. Almost there.
I could have tried to change that number here in the decompiled file, recompile it and then repack all the files back but I was afraid that that might not work because of the file size change and possible byte-code incompatibilities. So instead I wanted to somehow edit the original byte-code directly and surgically: this number 3 should be somewhere there and I only needed to change it to 0. Adjust just one single byte. The only tiny diifficulty to solve was to find that same 3 among thousands of other 3s all over the binary file...
In order to do some more research, I downloaded the LuaJIT compiler and compiled two version of this file: the original one (with the cooldown equals to 3) and one with 3 replaced with another number (I used 80). Then I compared them in a hex editor. As expected, the files differed by only one byte.
And here I noticed some pattern in the data
These hex numbers correspond to the values assigned to the SpellSettings properties!
I sketched a C# program to check the original byte-code for presence of this pattern. And it found it - and, furthermore, exatly once. So I modified the unpacker taken from the toolkit (I mentioned it in the beginning) to find this pattern, replace this single 3 with 0 and then pack the data back into a package using zlib.ZOutputStream.
I copied the result file into the "Magicka 2/data" folder, started the game (which happened luckily without any errors) and tried to cast some magick. The cooldown was gone. I was just utterly happy that it worked and now I am happy to share my results with you :)
Thank you very much for your attention if you read this article all the way down here and have not fallen asleep :)
6 Comments
unindustriousness Dec 1, 2024 @ 10:12am 
king shit.
Alex  [author] Oct 7, 2023 @ 2:58am 
SavinovArsen, привет! К сожалению, уже ничего толком не помню. Скажу только, что toolchain нужно сначала скомпилировать в исполняемые файлы через Visual Studio. Только потом его можно будет запускать. И могу предложить почитать эту ветку: https://forum.xentax.com/viewtopic.php?t=12002 . Кажется, упомянутая там утилита bitsquid_unp - это и есть основа для bsunp из проекта с github
SavinovArsen Sep 20, 2023 @ 7:23am 
А как пользоваться самим Bitsquid-Toolchain-master ? Нигде инструкции не нашёл, оригинальный сайт на который вела ссылка в гитхабе не работает, пробовал и так и сяк, разные файлы запускал, файлы туда-сюда переносил, и после этого запускал
Это моя единственная надежда вообще понять что делать, пожалуйста если ты все еще помнишь про свой стим аккаунт и тебе не сложно помоги
JudgeGregg Jul 25, 2021 @ 1:38pm 
Thanks for the lesson in reverse engineering :)
Blur Comet Jul 11, 2021 @ 4:12pm 
Super awesome; thanks so much for saving me 4 hours figuring this out!
WENDYN Jul 3, 2021 @ 8:39am 
OMG, this is a golden mine,
I must try it later...