NickHugi / PyKotor

A Python library that can read and modify most file formats used by the game Knights of the Old Republic and its sequel.
GNU Lesser General Public License v3.0
11 stars 3 forks source link

Toolset - Add a setting to look for NSS files before decompiling NCS #69

Closed JoeNotCharles closed 5 months ago

JoeNotCharles commented 6 months ago

Adds a new "Search for NSS files before decompiling NCS resources" setting. If it's enabled, opening an NCS resource will first open a file dialog to let the user choose an NSS file to load, and fall back to decompiling the NCS if the user cancels or the load fails.

JoeNotCharles commented 6 months ago

It's any time an NCS is loaded into the NSS editor, to get a text file to populate the editor with. I don't think it would affect "extract selected" at all since IIUC that doesn't open the editor, but I didn't test it.

On Sun, Mar 10, 2024 at 4:00 PM Benjamin Auquite @.***> wrote:

Is this specifically for the 'extract selected' button or is this feature more generally used by various frontend code?

— Reply to this email directly, view it on GitHub https://github.com/NickHugi/PyKotor/pull/69#issuecomment-1987345935, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMDPPYVTJ64SVKBC273X7TYXTCWDAVCNFSM6AAAAABEORL2BSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBXGM2DKOJTGU . You are receiving this because you authored the thread.Message ID: @.***>

th3w1zard1 commented 6 months ago

OK I think I'm understanding. This just prompts the user to open a NSS anytime NCS is attempted to be loaded. Not as complex as I thought.

I feel we should do some validation to ensure it matches the NCS. Otherwise the user may pick something that doesn't match. The NCS class contains various methods/attributes for working with NCS files: we should first compile the user-chosen NSS and ensure it matches the NCS, similar to how DeNCS does it.

Additionally if the user is attempting to load a NCS from a bif, the NSS should always be right next to it. Perhaps the dialog you've created should load the NSS automatically in that instance?

Potentially could auto-download the source scripts from their repo, similar to the KitsDownloader and the Help booklet downloader.

JoeNotCharles commented 6 months ago

That's a good idea. How about defaulting the new pref to False and labeling it "EXPERIMENTAL" until we have time to make those improvements?

I was thinking of having a search path:

  1. an optional user-specified dir (in case I have some scripts I've edited and checked in to source control, and want to re-load one whenever I open the corresponding NCS - the decompiler would lose stuff like comments and variable names)
  2. the override dir (maybe?)
  3. any script with the same resname in the same place as the NSS
  4. the Vanilla_Kotor scripts (wrinkle: that archive contains two subdirs for TSL, one "Vanilla" and one for the Restored Content mod, we should figure out an interface for users to choose between them)

There's enough design questions about this that I just punted and opened a manual dialog every time for now.

On Sun, Mar 10, 2024, 19:20 Benjamin Auquite @.***> wrote:

OK I think I'm understanding. This just prompts the user to open a NSS anytime NCS is attempted to be loaded. Not as complex as I thought.

I feel we should do some validation to ensure it matches the NCS. Otherwise the user may pick something that doesn't match. The NCS class contains various methods/attributes for working with NCS files: we should first compile the user-chosen NSS and ensure it matches the NCS, similar to how DeNCS does it.

Additionally if the user is attempting to load a NCS from a bif, the NSS should always be right next to it. Perhaps the dialog you've created should load the NSS automatically in that instance?

Potentially could auto-download the source scripts from their repo, similar to the KitsDownloader and the Help booklet downloader.

— Reply to this email directly, view it on GitHub https://github.com/NickHugi/PyKotor/pull/69#issuecomment-1987405011, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMDPP4IADIMY3ZZF575ZYDYXT2FVAVCNFSM6AAAAABEORL2BSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBXGQYDKMBRGE . You are receiving this because you authored the thread.Message ID: @.***>