Skip to content
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

HoloPatcher 1.5.2: Issues/differences from TSLPatcher when compiling scripts and using namespaces #105

Open
Nereithr opened this issue May 17, 2024 · 1 comment

Comments

@Nereithr
Copy link

Nereithr commented May 17, 2024

First of all, I'm not sure if this is a HoloPatcher issue, user issue or simply a difference in implementation that probably needs to be documented.

I'm testing this with a mod edits k_ai_master.nss and adds 2 new includes. The mod works when compiled manually as well as when compiled using TSLPatcher. TSLPatcher recommends putting nwnnsscomp.exe and nwscript.nss in tslpatchdata (using nwnsscomp included with TSLPatcher and a KOTOR 1 nwscript from the Steam version). For setups without namespaces, all other files go here as well. For setups with namespaces, all source files (except nwscript.nss) go into the namespace folder (if a separate namespace folder is chosen). This is slightly rambly and step-by-step, so a more concise TLDR is at the end.

The relevant section of changes.ini in all cases is:

[CompileList]
Replace0=k_ai_master.nss

The first difference/issue I ran into is when I'm NOT using namespaces

This is how tslpatchdata looks

image

When running the install, everything compiles and works properly, but nwscript.nss is additionally moved into Override.

nwsscript.nss snippet from installer

image

Now, with namespaces (all of the relevant files are now in the "base" folder).

tslpatchdata setup that works for TSLPatcher

image

Attempting to install with holopatcher will now use built-in compilers and return a compilation error:

[Error] [17:15:59] Function 'CheckAppliedEffect' already has a prototype or been defined.

Attempting to remove the unnecessary define returns a different compilation error.

Moving both nwnnsscomp.exe and nwscript.nss into the folder with changes.ini resolves the issue, but nwscript.nss is now moved to Override yet again.


TLDR:

  1. The installer copies nwscript.nss into Override. This is probably undesirable behaviour;
  2. HoloPatcher looks for nwnsscomp.exe and nwscript.nss within the same directory as the changes.ini for a given namespace. This could either be fixed to work like TSLPatcher or (even better) just documented on the wiki in the HoloPatcher changes section.
  3. Builtin compiler works differently from nwnsscomp.exe, at least with KOTOR 1 scripts. The fact that it even exists should probably be mentioned on the wiki.

Additionally, would you even recommend distributing mods as source nss files to begin with or is it better to just precompile them and include the source separately?

@th3w1zard1
Copy link
Collaborator

th3w1zard1 commented May 18, 2024

We ran into each other in one of the kotor discords, since this was discussed I'll publicly post the information here as well.

The installer copies nwscript.nss into Override. This is probably undesirable behaviour;

At the time of introducing nwscript.nss being moved into Override, I was using the KTool version which requires it. It turns out there are actually 4 known versions of nwnnsscomp.exe, which have since been documented here
nwscript.nss is required for KScript, V1, and KTool's versions.

The installer moving nwscript.nss is left in as an attempt to unify all 4 versions and abstract away the burden of determining if they are using the correct version.
You can prevent nwscript.nss from being moved by simply taking the file out of your tslpatchdata namespace. Eventually we will implement a check for which nwnnsscomp.exe version the user is using and only move that script if they are using the non-tslpatcher version.

TSLPatcher recommends putting nwnnsscomp.exe and nwscript.nss in tslpatchdata (using nwnsscomp included with TSLPatcher and a KOTOR 1 nwscript from the Steam version). For setups without namespaces, all other files go here as well. For setups with namespaces, all source files (except nwscript.nss) go into the namespace folder (if a separate namespace folder is chosen). This is slightly rambly and step-by-step, so a more concise TLDR is at the end.

HoloPatcher looks for nwnsscomp.exe and nwscript.nss within the same directory as the changes.ini for a given namespace. This could either be fixed to work like TSLPatcher or (even better) just documented on the wiki in the HoloPatcher changes section.

This was recently discovered behavior and is currently fixed on master and will be in the next beta5 version of v1.6. Seems we forgot consider namespaces when looking up nwnnsscomp.exe

Builtin compiler works differently from nwnsscomp.exe, at least with KOTOR 1 scripts. The fact that it even exists should probably be mentioned on the wiki.

Absolutely agree, will update some point soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants