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

Palette loading bug #902

Closed
StinkerB06 opened this issue Aug 8, 2019 · 9 comments
Closed

Palette loading bug #902

StinkerB06 opened this issue Aug 8, 2019 · 9 comments
Assignees
Labels

Comments

@StinkerB06
Copy link

First of all, the *.tic file format allows for chunk sizes smaller than the memory associated with them. This is a very simple compression method for carts, in case you have zero-filled bytes left at the end of the memory region. The remaining bytes that are not stored in the file are therefore zero when the chunk is loaded.

But this isn't fully true for the 48-byte palette memory though. When TIC-80 saves a cart, it applies this compression method to the palette chunk in the file (along with the sprites, map, sound, etc. chunks). The loading process is the slightly different part for palettes.

Instead of filling the remaining palette memory with zeroes (or black colors/intensities in this case), it instead uses the DB16 palette's byte values at offsets n...47 (where n is both the size of the palette chunk in the cartridge file, and the offset of the first palette memory byte to not be present in the chunk). This may ruin a game's palette.

Repro Steps:

  1. Create a new cart with new command.
  2. Paste this palette string into the palette editor (saved chunk is 8 bytes, 40 bytes are filled):
00000000000000ff00000000000000000000000000000000000000000000000000000000000000000000000000000000
  1. Save the cart with whatever filename.
  2. Re-load the cart you just saved.

Expected Result: The palette should be two blacks, followed by a green and thirteen more blacks.
Preserved Result: The palette instead becomes two blacks, followed by a mint green, and then DB16 colors 3...15.

A workaround is to make color 15 have the darkest level of blue, i.e. RGB #xxxx01.

@RobLoach
Copy link
Contributor

RobLoach commented Aug 8, 2019

Worked for me... After I saved and quit, and re-ran, the palette data was saved.

Screenshot at 2019-08-08 03-34-53

@StinkerB06
Copy link
Author

I get something like this instead:
TIC-80 Palette Bug

@RobLoach
Copy link
Contributor

What version are you running?

@StinkerB06
Copy link
Author

StinkerB06 commented Aug 16, 2019 via email

ayuusweetfish added a commit to ayuusweetfish/TIC-80 that referenced this issue Aug 29, 2019
ayuusweetfish added a commit to ayuusweetfish/TIC-80 that referenced this issue Aug 29, 2019
@ayuusweetfish
Copy link
Contributor

I have a fix in #915. The problem does not occur with carts saved in plain text format, which I guess is the reason @RobLoach did not reproduce it ^ ^

@StinkerB06
Copy link
Author

Yes, I saved it in the default *.tic format that you can otherwise load in the free version.

Also @kawa-yoiko, I don't think plain-text was the format he used to reproduce it with. Plain-text is only available in the PRO version. You can see that his screenshot doesn't have that bank-switching button, so it's definitely the free version, as you can't save (or even load) plain-text carts.

@ayuusweetfish
Copy link
Contributor

You can see that his screenshot doesn't have that bank-switching button

Ah indeed, I missed that > <

nesbox added a commit that referenced this issue Sep 27, 2019
@nesbox nesbox self-assigned this Sep 27, 2019
@nesbox nesbox added the bug label Sep 27, 2019
@nesbox nesbox added this to the 0.80.0 milestone Sep 27, 2019
@nesbox
Copy link
Owner

nesbox commented Sep 27, 2019

fixed
@StinkerB06 please check

@nesbox nesbox closed this as completed Sep 27, 2019
@StinkerB06
Copy link
Author

@nesbox Worked so far, awesome! But there's another problem, mentioned in the issue @Masternama-8000 referenced.

@nesbox nesbox removed this from the 0.80.0 milestone Jul 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants