-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to compile .nss scripts, created using nsbparse/nsbparse2 to nsb+map? #15
Comments
nsbcompile is an obsolete tool which was dropped in 0.5.0. As for nsbparse2/nsbcompile2, they are very buggy and are currently useful only for development purposes. I currently do not have free time so I'm afraid it will not be fixed any time soon 😢 |
Hmm.. Is there any drafts / docs / specs on nsb+map format and nsbparse2's nss language? |
AFAIK there are no docs on those formats apart the ones in my head, so here it is: [command]
[parameter]
Example: Translates to (nsbparse): Looking at some context (note that nsbparse starts counting at zero):
Which translates to (nsbparse2): $SW_RNDMAIL_RUK = "NO_TARGET"; Note that integer literals are also written as strings, but have an "INT" parameter rather than "STRING". The syntax used by nsbparse2 mimics the language used by older Nitroplus games (before they switched to binary scripts) like Chaos;Head, so you can use that as sort of a reference. I have never bothered to document parameters used by each command, although I've figured out most of them and you can see them in libnpengine-new/src/NSBInterpreter.cpp. There is also no documentation of syntax (i.e. how do combinations like Literal+Assign work or how are combinations like Variable + Variable + CmpLogicalAnd + If evaluated, but you can see that either from NSBInterpreter or nsbparse2. But the general principle is that each operation has N arguments it affects, starting from the one with lowest ID (i.e. it's the opposite of what you would expect on an x86 cdecl stack). For example:
Means (126 - 12), and after that operation 126 and 12 are removed from "stack", and 114 is pushed. Number of arguments each command affects is in this table. There is also bunch of other quirks like position parameters. But I will not get into that now (unless you want me to explain). Also variable identifiers are overly complex to explain in this post (it's getting quite big), but you can try reading this code just to get the taste of it. It's basically spaghetti recursive hell. ANYWAY; map files are simpler. They basically tell where if/while/select/function/scene/chapter/jump/createprocess are supposed to jump. It also contains list of includes (although I suspect it's broken and unused). [map entry]
nsbparse2 is supposed to use .map to determine else if's and else's but it's currently broken. However, branching works in libnpengine-new. So yeah, it's a very simple format but it's very powerful and represents lots of complex stuff (like for example array-related magic, event loops, etc). If you have any additional questions feel free to ask, I'll be glad to help. |
When I trying decompile and compile script using
nsbparse2
andnsbcompile2
:When I trying to decompile and compile again using
nsbparse
andnsbcompile
I can't create .map file for sg09_01.new.nsb:When I trying to decompile sg09_01.new.nsb using sg09_01.map, strings apparently become broken (I haven;t tested neither FGRE nor SG with this files):
sg09_01.nss:
sg09_01.new.nss:
Is there right way to decompile nsb, edit it and compile to nss+map?
P.S. I used Fuwanovel version.
The text was updated successfully, but these errors were encountered: