marcussacana / MwareStuff

My tools to the Mware Engine
The Unlicense
60 stars 11 forks source link

Disadvantages of NUTEditor #7

Closed MishaIac closed 4 years ago

MishaIac commented 4 years ago

I have this problem: I want to change the distance between the letters in the game, but to do this, you have to change the values of the parameter, but you can't do this with the NUTEditor.

NUTEditor: image

The value I have to change: image

What can I do in that case?

Game - Tokyo Necro (The font is in .png format, and the necessary letters have spaces in it)

marcussacana commented 4 years ago

NUTEditor is a very basic tool and to do what you want you need of a Diassembler, the most near tool that is what you need is this one: https://github.com/darknesswind/NutCracker But not sure if still works with new games. Also, maybe you can open the script with a hex editor and manually edit the value that you found near the pitchSpaceFull

MishaIac commented 4 years ago

I tried it through the hex editor, but it breaks the script, and the game just doesn't work. NutCracker works with scripts from Tokyo Necro, but it doesn't support shift jis, and the output is this: image

Is there any way to make NutCracker work with shift jis encoding? I tried it through Japanese local, it didn't help anyway.

marcussacana commented 4 years ago

He display that, but he corrupt the text? if not then just ignore and edit anyway

MishaIac commented 4 years ago

Yeah, he corrupt the text. It's not supposed to be like that. But it's the Japanese symbols, the rest is fine.

marcussacana commented 4 years ago

Probabbly here is where he read the text: https://github.com/darknesswind/NutCracker/blob/ed98f1a9209014e3d80a4168e814c24b3ad4dbf9/nutcracker/SqObject.cpp#L42-L44 If not, maybe here: https://github.com/darknesswind/NutCracker/blob/ed98f1a9209014e3d80a4168e814c24b3ad4dbf9/nutcracker/LString.cpp#L66-L70

MishaIac commented 4 years ago

If I knew the C++ programming language...

MishaIac commented 4 years ago

Anyway, I tried this version (https://github.com/darknesswind/NutCracker), and it doesn't work at all, even if I don't make any changes.

This version (older) works, but I didn't find the file LString.cpp in it. NutCracker.zip

marcussacana commented 4 years ago

You said this old version works, but why you can't use that?

MishaIac commented 4 years ago

You said this old version works, but why you can't use that?

Because all Japanese text turns into \x0083 and so on. image NUTEditor: image As you can see, there's a difference.

Here's the archive with one nut from Tokyo Necro. Try to make it in txt and look at what's in it and where the Japanese text should be. Tokyo Necro nut.zip

marcussacana commented 4 years ago

Test this: 1 - Use the NutCracker to decompile 2 - Recompile the script without changes 3 - Decompile the recompiled script 4 - Edit the value that you need change 5 - Compile the script again in a new file 6 - With a hex editor (010 Editor for example have this feature), verify the diff bettwen the 2 recompiled scripts 7 - Probabbly now he will show only the changes that you need 8 - Find the same part of the script in the original one. 9 - Do the same changes. 10 - Enjoy.

MishaIac commented 4 years ago

Yeah, it helped. I was able to change the distance between the letters. image

But now there's another problem. You don't know how to fix the word wrap? I've seen SRL have this feature, and I know that SRL works with Totono. I tried it with Tokyo Necro too, but SRL doesn't work at all.

marcussacana commented 4 years ago

The SRL only works to change the font size in this engine. The wordwrap is better a tool to automatically rewrite the scripts with wordwrap. Anyway you managed to edit the font of this Engine? There are more guys trying to edit it, if it's public will help if you share to me document how.

MishaIac commented 4 years ago

The wordwrap is better a tool to automatically rewrite the scripts with wordwrap.

I don't quite get it. Can I get more details?

Anyway you managed to edit the font of this Engine? There are more guys trying to edit it, if it's public will help if you share to me document how.

Not really. I just took the font from Sonicomi as it was Cyrillic, and then I just reduced the distance between the letters.

marcussacana commented 4 years ago

Hmm, the NUTEditor as you can see is a 'library', all that we need is a tool to apply wordwrap in the modified lines. This will require a little of skill with coding, you need check what lines changed in the 2 scripts to ensure to don't modify command lines, after that just do a wordwrap in the lines manually then put a breakline in the best place.

marcussacana commented 4 years ago

By the way, the old SRL (you can look in the secondary branch) have a tool to rewrite the scripts using the SRL, while he can apply the wordwrap to you, the only problem is that you must translate using .lst files without the command lines to prevent he break the line of commands.

MishaIac commented 4 years ago

Looks like it would be easier to put \n manually...

MishaIac commented 4 years ago

By the way, the old SRL (you can look in the secondary branch) have a tool to rewrite the scripts using the SRL, while he can apply the wordwrap to you, the only problem is that you must translate using .lst files without the command lines to prevent he break the line of commands.

Can you tell me the specific version? Otherwise, while I'm looking...

marcussacana commented 4 years ago

you're looking in the master, switch to the DotNetFramework branch and you will found some tools.

MishaIac commented 4 years ago

Okay, well, I walked into that branch, but then what? I just don't know much about all this...

Or can you give me a direct link?

marcussacana commented 4 years ago

https://github.com/marcussacana/StringReloads/tree/DotNetFramework/Help the lstgenerator can be used to generate the .lst files the Debug Utility allow you use the SRL to process all lines of the game scripts (using the sacanawrapper) With that in mind you just need setup the SRL wordwrap, install the NUTEditor plugin and use the SRLTracer to rewrite the scripts using the genareted LST files

MishaIac commented 4 years ago

That's it. I was able to solve the problem with word wrap without SRL, through the game code. image image

As you can see, the text doesn't contain any \n: image

But still, thank you for trying to help me :D

MinscyBubu commented 2 years ago

@MishaIac could you explain how did you do that (the wordwrap)?

er-azh commented 5 months ago

I know it's very late to share anything here but just wanted to share this for anyone wondering here like me. For me the string format inside of the squirrel .nut files were plain old utf8. The issue with nutcracker was that windows forced utf16 encoding and everything was messed up.

for me the fix was: in main.cpp at the beginning of main()

SetConsoleOutputCP(CP_UTF8);
setvbuf(stdout, nullptr, _IOFBF, 1000);

and commenting the ascii check in Expressions.h:

//if (c < 0x20 || c > 0x7e)
//{
//              m_text += "\\x00";
//              m_text += ToHex((c >> 4) & 0x0f);
//              m_text += ToHex(c & 0x0f);
//}
//else
//{
                m_text += c;
//}

Tested with Saya no Uta, I still needed to skip the first 16 bytes (SCRP header) though.