this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

#1308: added new chunk CHUNK_DEFAULT which loads default palette/waveforms

Nesbox 8ec5a271 7c517acd

+21 -5
+21 -5
src/cart.c
··· 44 44 CHUNK_MUSIC, // 14 45 45 CHUNK_PATTERNS, // 15 46 46 CHUNK_CODE_ZIP, // 16 47 + CHUNK_DEFAULT, // 17 47 48 } ChunkType; 48 49 49 50 typedef struct ··· 64 65 #define LOAD_CHUNK(to) memcpy(&to, buffer, MIN(sizeof(to), chunk.size)) 65 66 66 67 bool paletteExists = false; 68 + bool loadDefauts = false; 67 69 68 70 tic_code* code = calloc(TIC_BANKS, TIC_CODE_BANK_SIZE); 69 71 ··· 112 114 } 113 115 } 114 116 break; 117 + case CHUNK_DEFAULT: 118 + loadDefauts = true; 119 + break; 115 120 default: break; 116 121 } 117 122 ··· 140 145 141 146 free(code); 142 147 143 - // workaround to support ancient carts without palette 144 - // load DB16 palette if it not exists 145 - if(!paletteExists) 148 + if(loadDefauts) 146 149 { 147 - static const u8 DB16[] = {0x14, 0x0c, 0x1c, 0x44, 0x24, 0x34, 0x30, 0x34, 0x6d, 0x4e, 0x4a, 0x4e, 0x85, 0x4c, 0x30, 0x34, 0x65, 0x24, 0xd0, 0x46, 0x48, 0x75, 0x71, 0x61, 0x59, 0x7d, 0xce, 0xd2, 0x7d, 0x2c, 0x85, 0x95, 0xa1, 0x6d, 0xaa, 0x2c, 0xd2, 0xaa, 0x99, 0x6d, 0xc2, 0xca, 0xda, 0xd4, 0x5e, 0xde, 0xee, 0xd6}; 148 - memcpy(cart->bank0.palette.scn.data, DB16, sizeof(tic_palette)); 150 + static const u8 Sweetie16[] = {0x1a, 0x1c, 0x2c, 0x5d, 0x27, 0x5d, 0xb1, 0x3e, 0x53, 0xef, 0x7d, 0x57, 0xff, 0xcd, 0x75, 0xa7, 0xf0, 0x70, 0x38, 0xb7, 0x64, 0x25, 0x71, 0x79, 0x29, 0x36, 0x6f, 0x3b, 0x5d, 0xc9, 0x41, 0xa6, 0xf6, 0x73, 0xef, 0xf7, 0xf4, 0xf4, 0xf4, 0x94, 0xb0, 0xc2, 0x56, 0x6c, 0x86, 0x33, 0x3c, 0x57}; 151 + memcpy(cart->bank0.palette.scn.data, Sweetie16, sizeof(tic_palette)); 152 + 153 + static const u8 Waveforms[] = {0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x10, 0x32, 0x54, 0x76, 0x98, 0xba, 0xdc, 0xfe, 0xef, 0xcd, 0xab, 0x89, 0x67, 0x45, 0x23, 0x01, 0x10, 0x32, 0x54, 0x76, 0x98, 0xba, 0xdc, 0xfe, 0x10, 0x32, 0x54, 0x76, 0x98, 0xba, 0xdc, 0xfe}; 154 + memcpy(&cart->bank0.sfx.waveforms, Waveforms, sizeof Waveforms); 155 + } 156 + else 157 + { 158 + // workaround to support ancient carts without palette 159 + // load DB16 palette if it not exists 160 + if(!paletteExists) 161 + { 162 + static const u8 DB16[] = {0x14, 0x0c, 0x1c, 0x44, 0x24, 0x34, 0x30, 0x34, 0x6d, 0x4e, 0x4a, 0x4e, 0x85, 0x4c, 0x30, 0x34, 0x65, 0x24, 0xd0, 0x46, 0x48, 0x75, 0x71, 0x61, 0x59, 0x7d, 0xce, 0xd2, 0x7d, 0x2c, 0x85, 0x95, 0xa1, 0x6d, 0xaa, 0x2c, 0xd2, 0xaa, 0x99, 0x6d, 0xc2, 0xca, 0xda, 0xd4, 0x5e, 0xde, 0xee, 0xd6}; 163 + memcpy(cart->bank0.palette.scn.data, DB16, sizeof(tic_palette)); 164 + } 149 165 } 150 166 } 151 167