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

Changes in file structure are needed #18

Closed
koca2000 opened this issue Apr 23, 2019 · 6 comments
Closed

Changes in file structure are needed #18

koca2000 opened this issue Apr 23, 2019 · 6 comments
Labels
C: Enhancement New feature or request S: Resolved in next release This bugfix or suggestion has been applied to the code

Comments

@koca2000
Copy link
Contributor

Hi!

There is big issue in current .nbs file format structure. As new instruments are comming to Minecraft the index of first custom instrument changes. There is the problem:

Minecraft version | Instrument count | Custom instrument index
     < 1.12       |      5 (0-4)     |            5
     < 1.14       |     10 (0-9)     |           10
    >= 1.14       |     16 (0-15)    |           16

When you open .nbs file with custom instruments from older version in new version. Custom instruments are changed to regular instruments in new version.

Suggested solution: Add structure version info to first bytes of header and first custom instrument index information near custom instruments count. This way it will be easy for parser to recognize old files and determine from which version the file comes.

@koca2000
Copy link
Contributor Author

This change will be also useful for #7

@HielkeMinecraft
Copy link
Collaborator

Good idea, but how would this work with the already existing .nbs files? Making big changes to the file format is risky :/

@HielkeMinecraft HielkeMinecraft added the C: Enhancement New feature or request label May 5, 2019
@koca2000
Copy link
Contributor Author

koca2000 commented May 5, 2019

You can set two first bytes (short with song length in actual structure) to 0 as a sign of new structure. Third byte would be structure version. This way you can decide how to read the file on load. If first two bytes would not be 0, you will know that third and fourth is song height and you should not read first byte after last layer as first custom instrument index but as custom instruments count.

@HielkeMinecraft
Copy link
Collaborator

Sure, but the older versions don't know that. This will make the new .nbs files incompatible with older versions of Note Block Studio. Is this something we really want?

@koca2000
Copy link
Contributor Author

koca2000 commented May 5, 2019

There are two options:

  1. Old versions are not supported. Update to new one.
  2. Change format from .nbs to .nbsx (or something like that)

The problem is that when you take .nbs file generated with Note Block Studio using version 1.12 with custom instruments and open it in actual version, custom instruments are changed to regular 1.14 note blocks. If you know about different way to solve this without changing file structure, it will be better. But I don't.

@HielkeMinecraft
Copy link
Collaborator

First one sounds preferable. I'll work on it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: Enhancement New feature or request S: Resolved in next release This bugfix or suggestion has been applied to the code
Projects
None yet
Development

No branches or pull requests

3 participants