Jump to content

How can I compile tjs2?


Kein

Recommended Posts

I know krkrz scene editor can be used to edit tjs2 but I'm trying to remove a line altogether and can't do it with krkrz scene editor. I've managed to decompile with tjs2Disassembler by xmoe but using his tjs2Compiler causes a crash without an error report.

Link to comment
Share on other sites

On 6/19/2019 at 9:22 PM, uyjulian said:

You don't need to compile after editing TJS scripts. Just replace the file on the filesystem or the archive.

Sorry, I mean for krkrz. If it's not compiled it will give a syntax error.

Link to comment
Share on other sites

1 hour ago, uyjulian said:

Is it a half width to full width conversion error? If so, save the script in UTF-16 with BOM.

All the error says is "error at initialize line 1 Sytnax Error".

This is what the compiled and uncompiled versions look like, the second works without any problems:

https://i.imgur.com/7EHjmEn.png7EHjmEn.png

tW4Ughm.png

I've tried ctjs2 from here too: http://www.kaede-software.com/2013/02/tjs2_3.html

But I get this error with Japanese locale: 1NqiePm.png

Edited by Kein
Link to comment
Share on other sites

12 minutes ago, uyjulian said:

Did you try to use KrkrExtract to decompile the script?

Yeah, it seems that is the problem. I've tried using both tjs compliers now on a decomplied startup.tjs that was included with krkr2bytecode and they compile without a problem. So I'm right now looking for a different method to decompile.

Link to comment
Share on other sites

I've found out how to decompile and compile.

First, Furikiri seems to be the only decompiler that exists for tjs, everything else is a dissembler. You can learn the difference here: https://ulysseswu.azurewebsites.net/post/Furikiri

The main thing to know is that you can't use a compiler successfully on a dissembled tjs, only a decompiled one.

I have uploaded the exes here, for people who don't know how to build it: https://mega.nz/#!3HZWTS4L!CFJ2xBI8hhHCPlcLfUz2ySvD725W6MFlg4_4WpSht1o

To use girigiri.exe open the command line with shift + right click, then type "girigiri (tjs name + extension) --dec", or use --help to see all the commands.

For compiling, I recommend xmoe's compiler over the official ctjs2: https://github.com/xmoeproject/KrkrExtract/releases (download from releases and the exe will be under Tool Sources)

After you decompile you also have to change the encoding to UTF 16 (/ UCS 2) LE BOM.

Like it says on the blog post, the decompiler will not usually work if the tjs is complex but this is the only option, overall I wouldn't recommend doing this if you can use use this instead: https://github.com/marcussacana/KrKrZSceneManager

Edited by Kein
Link to comment
Share on other sites

On 2019/6/23 at 4:45 AM, Kein said:

I've found out how to decompile and compile.

First, Furikiri seems to be the only decompiler that exists for tjs, everything else is a dissembler. You can learn the difference here: https://ulysseswu.azurewebsites.net/post/Furikiri

The main thing to know is that you can't use a compiler successfully on a dissembled tjs, only a decompiled one.

Basically you're correct, there is no "TJS2 decompiler"(*) other than my Furikiri. But Furikiri is not finished (the TJS2 language is a bloated, badly-implemented language after all), and currently the decompilation result can only be used as a reference of TJS2 bytecode's behaviour - that's already useful in my cases. You cannot expect the decompilation result can be directly compiled again, it's impossible for now.

However, it might be more practical to implement a tool to compile the disassmbled assembly. Furikiri has a plan (issue) to do that, but I currently just focused on decompilation.

Furikiri also provides the fastest TJS2 disassemble feature - definitely faster and more complete than the official one. That's the main feature of girigiri for now.

(*): Xmoe said on weibo (at 2019-5-25) that he will release a tjs decompiler after a while. Maybe he can make a better tool than my shit :nico:

 

Edited by Ulysses
about other tools
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...