Attempting to extract vanilla Minecraft sounds can cause NBS to crash
Describe the bug I didn't notice this until recently when I needed to re-extract my Minecraft sounds after a PC reset; however, when I tried to extract my MC sounds into Minecraft, it caused NBS to crash instantly. I'm still not 100% sure, but I really think this is most likely a permission issue; if its installation folder is protected (like if it was installed in Program Files), writing the sound files to its directory might cause a crash (since it wouldn't have permission to write there)
To Reproduce Steps to reproduce the behavior (though, unlike my usual issues I don't know if this will be easily reproducible): 0: (using a VM may help with this to not conflict with your main NBS installation)
- Install NBS to a folder with limited system permissions (such as
Program FilesorProgram Files (x86)) - Once it has been installed, make sure to unselect
Launch Note Block Studio(since the installer runs as admin, using the auto launch option might also make NBS run as admin) - Open NBS (:D) normally as a user application (aka not run as administrator) and create a new song
- Open the settings navigation bar drop-down and open the Minecraft sounds importer
- Set the version to the newest version (which right now is 1.21.4, which was auto-selected for me)
- Click the get sounds button and (hopefully) observe how NBS crashes Expected behavior well, I would hopefully expect NBS to copy all the sound files into the right folder without crashing :D
Screenshots
Additional context
One major thing that I find interesting is that NBS didn't crash like it usually does most of the time; usually, when NBS crashes, it shows a window referencing the line of GameMaker code that likely caused the problem (like this image from one of my previous GitHub issues)
instead, it seems like the bug was deep enough that Visual C++ threw an error; I'm not entirely sure though, so I will include the NBS log it generated on opening (though it doesn't indicate to me that there were any issues loading anything)
log.txt
Hi, thank you for reporting the bug! Can you run nbs from the Launch Debug. bat file from its installation folder and post the debug.txt in the same folder after the crash for more logs from the runner? thanks!
this is interesting..
firstly, the Launch Debug option causes this popup on startup, I wonder if NBS might be trying to internally read -debugoutput debug.log as a .nbs file path lol
I did manage to get the debug log and I will include it here:
debug.txt
however, this is the weird thing though.. after running it in debug, exporting works perfectly lol
after playing around with the files a bit (to make sure it wasn't a one-time bug) I think I might know why
I always install all of my programs (including NBS) in a protected folder (usually the Program Files's folder), as it makes it a lot easier to manage my apps compared to being in my user folder; since NBS's installer runs as an admin, it makes it possible to easily install there. However, NBS itself runs as a user application, and might not even have full access directly to its own folder; I bet that when it tries to copy the sounds into its own folder, it runs into permission issues and likely can't recover, and as such crashes.
what especially makes me think this is true as well is that if I run NBS as an administrator or manually give myself full permissions to the installation directory of its files, importing all Minecraft sounds also works fine.
tl;dr: I have NBS installed in the Program Files folder, and since NBS generally runs as a user application exporting likely causes it to crash (since it doesn't have permission to write to its directory) this also explains why the error is coming from Visual C++, as a no permission error would be a deeper-level problem and not something with the code directly
I'm not going to close this myself just yet (as ofc NBS still can crash), but definitely a very important detail to keep in mind :D
I've also run into this crash from trying to open the default songs stored in NBS's installation folder, but after realizing this is a permissions issue it makes perfect sense (read and open the NBS file in a protected directory, then save (and fail to write) when NBS tries to initially save it)