Nut Scripts

Programming related discussions related to game research
Ekey
Posts: 1383
Joined: Sat Aug 09, 2014 2:34 pm

Nut Scripts

Post by Ekey »

May be someone knows what the Script Engine is used to work with *.nut / *.nutx files (Magic Header ID is RIQS and in the end magic id is LIAT)?

Edited: Seems it's Squirrel programming language but not sure.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Nut Scripts

Post by aluigi »

Yes, they are compiled Squirrel scripts.
Ekey
Posts: 1383
Joined: Sat Aug 09, 2014 2:34 pm

Re: Nut Scripts

Post by Ekey »

Ok. Then there is another question: Is there a for compiled scripts Disassembler / Decompiler? :)
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Nut Scripts

Post by aluigi »

Honestly I didn't even know Squirrel but it looks like it's known in the gaming community and there are some decompilers available.
Just a quick google search reveals something interesting, like this project:
https://github.com/rockfireredmoon/icee ... /UTILITIES
I didn't test it.
Ekey
Posts: 1383
Joined: Sat Aug 09, 2014 2:34 pm

Re: Nut Scripts

Post by Ekey »

NutCrack don't works. I guess because not supports Unicode strings. Thanks anyway.
einstein95
Posts: 64
Joined: Tue Sep 08, 2015 11:27 am

Re: Nut Scripts

Post by einstein95 »

I've used NutCracker in the past and it's worked well.
Ekey
Posts: 1383
Joined: Sat Aug 09, 2014 2:34 pm

Re: Nut Scripts

Post by Ekey »

Thanks for source's. I've tried decompile provided by me scripts but got:

Code: Select all

Error: NUT file compiled for different size of char that expected.


Problem here:

Code: Select all

   if (reader.ReadInt32() != sizeof(char))
      throw Error("NUT file compiled for different size of char that expected.");


In script i changed DWORD value 2 at offset 0x6 > to 1 =

Code: Select all

Error: Expected string object not found in source binary file.


That error because strings length written with ANSI size but the string itself is written in UNICODE. I changed part code in BinaryReader.h - void ReadSQString( std::string& str ) for read UNICODE strings but while decompile i got some parts disassembled code like this:

Code: Select all

  // [003]  bad allocation    3      0    0    0
::require($[stack offset 3]);
  // [007]  bad allocation    3      0    0    0
  // [011]  bad allocation    4      0    0    0
this.GMI_SETUP_DEPEND($[stack offset 3], $[stack offset 4]);
  // [015]  bad allocation    3      0    0    0
  // [017]  bad allocation    4      0    0    0
this.glog($[stack offset 3], $[stack offset 4]);
  // [022]  bad allocation    3      0    0    0
::require($[stack offset 3]);
  // [027]  bad allocation    3      0    0    0
::requiredir($[stack offset 3]);


I guess scripts from game compiled with newest or / older 2.2.4 version of Squirrel compiler, also seems developers have made some changes :(
Last edited by Ekey on Sun Oct 25, 2015 1:22 pm, edited 1 time in total.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Nut Scripts

Post by aluigi »

@einstein95
Any homepage/github/author? Just curious because I see no references on google except in some talks
Ekey
Posts: 1383
Joined: Sat Aug 09, 2014 2:34 pm

Re: Nut Scripts

Post by Ekey »

aluigi wrote:@einstein95
Any homepage/github/author? Just curious because I see no references on google except in some talks

I see some talks only on Steam forums.