diff --git a/src/config.c b/src/config.c index 0294598..1abf7a3 100644 --- a/src/config.c +++ b/src/config.c @@ -170,7 +170,7 @@ static void readConfig(Config* config) if(lua) { - if(luaL_loadstring(lua, config->tic->config.bank.code.data) == LUA_OK && lua_pcall(lua, 0, LUA_MULTRET, 0) == LUA_OK) + if(luaL_loadstring(lua, config->tic->config.bank0.code.data) == LUA_OK && lua_pcall(lua, 0, LUA_MULTRET, 0) == LUA_OK) { readConfigVideoLength(config, lua); readConfigVideoScale(config, lua); diff --git a/src/console.c b/src/console.c index 48fa4c9..cbd9732 100644 --- a/src/console.c +++ b/src/console.c @@ -360,12 +360,12 @@ static bool onConsoleLoadSectionCommand(Console* console, const char* param) switch(i) { case 0: memcpy(&tic->cart.cover, &cart->cover, sizeof cart->cover); break; - case 1: memcpy(&tic->cart.bank.tiles, &cart->bank.tiles, sizeof(tic_tiles)*2); break; - case 2: memcpy(&tic->cart.bank.map, &cart->bank.map, sizeof(tic_map)); break; - case 3: memcpy(&tic->cart.bank.code, &cart->bank.code, sizeof(tic_code)); break; - case 4: memcpy(&tic->cart.bank.sfx, &cart->bank.sfx, sizeof(tic_sfx)); break; - case 5: memcpy(&tic->cart.bank.music, &cart->bank.music, sizeof(tic_music)); break; - case 6: memcpy(&tic->cart.palette, &cart->palette, sizeof(tic_palette)); break; + case 1: memcpy(&tic->cart.bank0.tiles, &cart->bank0.tiles, sizeof(tic_tiles)*2); break; + case 2: memcpy(&tic->cart.bank0.map, &cart->bank0.map, sizeof(tic_map)); break; + case 3: memcpy(&tic->cart.bank0.code, &cart->bank0.code, sizeof(tic_code)); break; + case 4: memcpy(&tic->cart.bank0.sfx, &cart->bank0.sfx, sizeof(tic_sfx)); break; + case 5: memcpy(&tic->cart.bank0.music, &cart->bank0.music, sizeof(tic_music)); break; + case 6: memcpy(&tic->cart.palette, &cart->palette, sizeof(tic_palette)); break; } studioRomLoaded(); @@ -602,14 +602,14 @@ static char* saveBinarySection(char* ptr, const char* comment, const char* tag, typedef struct {char* tag; s32 count; s32 offset; s32 size; bool flip;} BinarySection; static const BinarySection BinarySections[] = { - {"PALETTE", 1, offsetof(tic_cartridge, palette.data), sizeof(tic_palette), false}, - {"TILES", TIC_BANK_SPRITES, offsetof(tic_cartridge, bank.tiles), sizeof(tic_tile), true}, - {"SPRITES", TIC_BANK_SPRITES, offsetof(tic_cartridge, bank.sprites), sizeof(tic_tile), true}, - {"MAP", TIC_MAP_HEIGHT, offsetof(tic_cartridge, bank.map), TIC_MAP_WIDTH, true}, - {"WAVES", ENVELOPES_COUNT, offsetof(tic_cartridge, bank.sfx.waveform.envelopes), sizeof(tic_waveform), true}, - {"SFX", SFX_COUNT, offsetof(tic_cartridge, bank.sfx.data), sizeof(tic_sound_effect), true}, - {"PATTERNS", MUSIC_PATTERNS, offsetof(tic_cartridge, bank.music.patterns), sizeof(tic_track_pattern), true}, - {"TRACKS", MUSIC_TRACKS, offsetof(tic_cartridge, bank.music.tracks), sizeof(tic_track), true}, + {"PALETTE", 1, offsetof(tic_cartridge, palette.data), sizeof(tic_palette), false}, + {"TILES", TIC_BANK_SPRITES, offsetof(tic_cartridge, bank0.tiles), sizeof(tic_tile), true}, + {"SPRITES", TIC_BANK_SPRITES, offsetof(tic_cartridge, bank0.sprites), sizeof(tic_tile), true}, + {"MAP", TIC_MAP_HEIGHT, offsetof(tic_cartridge, bank0.map), TIC_MAP_WIDTH, true}, + {"WAVES", ENVELOPES_COUNT, offsetof(tic_cartridge, bank0.sfx.waveform.envelopes), sizeof(tic_waveform), true}, + {"SFX", SFX_COUNT, offsetof(tic_cartridge, bank0.sfx.data), sizeof(tic_sound_effect), true}, + {"PATTERNS", MUSIC_PATTERNS, offsetof(tic_cartridge, bank0.music.patterns), sizeof(tic_track_pattern), true}, + {"TRACKS", MUSIC_TRACKS, offsetof(tic_cartridge, bank0.music.tracks), sizeof(tic_track), true}, }; static s32 saveProject(Console* console, void* buffer, const char* comment) @@ -617,7 +617,7 @@ static s32 saveProject(Console* console, void* buffer, const char* comment) tic_mem* tic = console->tic; char* stream = buffer; - char* ptr = saveTextSection(stream, tic->cart.bank.code.data); + char* ptr = saveTextSection(stream, tic->cart.bank0.code.data); for(s32 i = 0; i < COUNT_OF(BinarySections); i++) { @@ -738,7 +738,7 @@ static bool loadProject(Console* console, const char* name, const char* data, s3 const char* comment = projectComment(name); - if(loadTextSection(project, comment, cart->bank.code.data, sizeof(tic_code))) + if(loadTextSection(project, comment, cart->bank0.code.data, sizeof(tic_code))) done = true; for(s32 i = 0; i < COUNT_OF(BinarySections); i++) @@ -1330,7 +1330,7 @@ static void onImportSprites(const char* name, const void* buffer, size_t size, v tic_rgb rgb = {c->r, c->g, c->b}; u8 color = tic_tool_find_closest_color(console->tic->cart.palette.colors, &rgb); - setSpritePixel(console->tic->cart.bank.tiles.data, x, y, color); + setSpritePixel(getBankTiles()->data, x, y, color); } gif_close(image); @@ -1352,8 +1352,8 @@ static void injectMap(Console* console, const void* buffer, s32 size) { enum {Size = sizeof(tic_map)}; - SDL_memset(&console->tic->cart.bank.map, 0, Size); - SDL_memcpy(&console->tic->cart.bank.map, buffer, SDL_min(size, Size)); + SDL_memset(getBankMap(), 0, Size); + SDL_memcpy(getBankMap(), buffer, SDL_min(size, Size)); } static void onImportMap(const char* name, const void* buffer, size_t size, void* data) @@ -1453,7 +1453,7 @@ static void exportSprites(Console* console) { for (s32 y = 0; y < Height; y++) for (s32 x = 0; x < Width; x++) - data[x + y * Width] = getSpritePixel(console->tic->cart.bank.tiles.data, x, y); + data[x + y * Width] = getSpritePixel(getBankTiles()->data, x, y); s32 size = 0; if((size = writeGifData(console->tic, buffer, data, Width, Height))) @@ -1493,7 +1493,7 @@ static void exportMap(Console* console) if(buffer) { - SDL_memcpy(buffer, console->tic->cart.bank.map.data, Size); + SDL_memcpy(buffer, getBankMap()->data, Size); fsGetFileData(onMapExported, "world.map", buffer, Size, DEFAULT_CHMOD, console); } } @@ -2714,7 +2714,7 @@ static bool cmdInjectCode(Console* console, const char* param, const char* name) bool watch = strcmp(param, "-code-watch") == 0; if(watch || strcmp(param, "-code") == 0) { - bool loaded = loadFileIntoBuffer(console, console->embed.file->bank.code.data, name); + bool loaded = loadFileIntoBuffer(console, console->embed.file->bank0.code.data, name); if(loaded) { @@ -2765,7 +2765,7 @@ static bool cmdInjectSprites(Console* console, const char* param, const char* na tic_rgb rgb = {c->r, c->g, c->b}; u8 color = tic_tool_find_closest_color(console->embed.file->palette.colors, &rgb); - setSpritePixel(console->embed.file->bank.tiles.data, x, y, color); + setSpritePixel(console->embed.file->bank0.tiles.data, x, y, color); } gif_close(image); diff --git a/src/dialog.c b/src/dialog.c index a61c16b..2f5be5f 100644 --- a/src/dialog.c +++ b/src/dialog.c @@ -170,7 +170,7 @@ static void drawDialog(Dialog* dlg) { u8 chromakey = 14; - tic->api.sprite_ex(tic, &tic->config.bank.tiles, 2, rect.x+6, rect.y-4, 2, 2, &chromakey, 1, 1, tic_no_flip, tic_no_rotate); + tic->api.sprite_ex(tic, &tic->config.bank0.tiles, 2, rect.x+6, rect.y-4, 2, 2, &chromakey, 1, 1, tic_no_flip, tic_no_rotate); } { diff --git a/src/map.c b/src/map.c index 28c939e..64a6d0a 100644 --- a/src/map.c +++ b/src/map.c @@ -1185,7 +1185,7 @@ void initMap(Map* map, tic_mem* tic) .gesture = false, .start = {0, 0}, }, - .history = history_create(&tic->cart.bank.map, sizeof(tic_map)), + .history = history_create(&tic->cart.bank0.map, sizeof(tic_map)), .event = onStudioEvent, .overlap = overlap, }; diff --git a/src/menu.c b/src/menu.c index 935ce3a..746ecf8 100644 --- a/src/menu.c +++ b/src/menu.c @@ -124,7 +124,7 @@ static void drawDialog(Menu* menu) { u8 chromakey = 14; - tic->api.sprite_ex(tic, &tic->config.bank.tiles, 0, rect.x+6, rect.y-4, 2, 2, &chromakey, 1, 1, tic_no_flip, tic_no_rotate); + tic->api.sprite_ex(tic, &tic->config.bank0.tiles, 0, rect.x+6, rect.y-4, 2, 2, &chromakey, 1, 1, tic_no_flip, tic_no_rotate); } } @@ -209,7 +209,7 @@ static void drawPlayerButtons(Menu* menu, s32 x, s32 y) if(menu->gamepad.selected == index && menu->ticks % TIC_FRAMERATE < TIC_FRAMERATE / 2) continue; - tic->api.sprite_ex(tic, &tic->config.bank.tiles, 8+i, rect.x, rect.y, 1, 1, &chromakey, 1, 1, tic_no_flip, tic_no_rotate); + tic->api.sprite_ex(tic, &tic->config.bank0.tiles, 8+i, rect.x, rect.y, 1, 1, &chromakey, 1, 1, tic_no_flip, tic_no_rotate); s32 code = codes[index]; char label[32]; diff --git a/src/music.c b/src/music.c index 7672eb4..9156718 100644 --- a/src/music.c +++ b/src/music.c @@ -1327,7 +1327,7 @@ static void drawTumbler(Music* music, s32 x, s32 y, s32 index) } u8 color = Chroma; - tic->api.sprite(tic, &tic->config.bank.tiles, music->tracker.patterns[index] ? On : Off, x, y, &color, 1); + tic->api.sprite(tic, &tic->config.bank0.tiles, music->tracker.patterns[index] ? On : Off, x, y, &color, 1); } static void drawTracker(Music* music, s32 x, s32 y) @@ -1643,7 +1643,7 @@ void initMusic(Music* music, tic_mem* tic) }, .tab = MUSIC_TRACKER_TAB, - .history = history_create(&tic->cart.bank.music, sizeof(tic_music)), + .history = history_create(&tic->cart.bank0.music, sizeof(tic_music)), .event = onStudioEvent, }; diff --git a/src/run.c b/src/run.c index 93c1897..e54c21d 100644 --- a/src/run.c +++ b/src/run.c @@ -80,7 +80,7 @@ static const char* getPMemName(Run* run) { static char buffer[FILENAME_MAX]; - const char* data = strlen(run->tic->saveid) ? run->tic->saveid : run->tic->cart.bank.code.data; + const char* data = strlen(run->tic->saveid) ? run->tic->saveid : run->tic->cart.bank0.code.data; char* md5 = data2md5(data, (s32)strlen(data)); strcpy(buffer, TIC_LOCAL); strcat(buffer, md5); @@ -124,9 +124,9 @@ static void processDoFile(void* data, char* dst) static const char DoFileTag[] = "dofile("; enum {Size = sizeof DoFileTag - 1}; - if (memcmp(tic->cart.bank.code.data, DoFileTag, Size) == 0) + if (memcmp(tic->cart.bank0.code.data, DoFileTag, Size) == 0) { - const char* start = tic->cart.bank.code.data + Size; + const char* start = tic->cart.bank0.code.data + Size; const char* end = strchr(start, ')'); if(end && *start == *(end-1) && (*start == '"' || *start == '\'')) diff --git a/src/sfx.c b/src/sfx.c index 1de5c4c..48957c8 100644 --- a/src/sfx.c +++ b/src/sfx.c @@ -1058,8 +1058,8 @@ void initSfx(Sfx* sfx, tic_mem* tic) .tab = SFX_ENVELOPES_TAB, .history = { - .envelope = history_create(&tic->cart.bank.sfx.data, sizeof tic->cart.bank.sfx.data), - .waveform = history_create(&tic->cart.bank.sfx.waveform, sizeof tic->cart.bank.sfx.waveform), + .envelope = history_create(&tic->cart.bank0.sfx.data, sizeof tic->cart.bank0.sfx.data), + .waveform = history_create(&tic->cart.bank0.sfx.waveform, sizeof tic->cart.bank0.sfx.waveform), }, .event = onStudioEvent, }; diff --git a/src/sprite.c b/src/sprite.c index 97fce55..0bb39c9 100644 --- a/src/sprite.c +++ b/src/sprite.c @@ -1570,7 +1570,7 @@ void initSprite(Sprite* sprite, tic_mem* tic) .front = sprite->select.front, }, .mode = SPRITE_DRAW_MODE, - .history = history_create(&tic->cart.bank.tiles, TIC_SPRITES * sizeof(tic_tile)), + .history = history_create(&tic->cart.bank0.tiles, TIC_SPRITES * sizeof(tic_tile)), .event = onStudioEvent, .overlap = overlap, }; diff --git a/src/studio.c b/src/studio.c index 5acb661..3ad34b3 100644 --- a/src/studio.c +++ b/src/studio.c @@ -337,7 +337,7 @@ tic_music* getBankMusic() void playSystemSfx(s32 id) { - const tic_sound_effect* effect = &studio.tic->config.bank.sfx.data[id]; + const tic_sound_effect* effect = &studio.tic->config.bank0.sfx.data[id]; studio.tic->api.sfx_ex(studio.tic, id, effect->note, effect->octave, -1, 0, MAX_VOLUME, 0); } @@ -2209,7 +2209,7 @@ static void renderCursor() SDL_ShowCursor(getConfig()->theme.cursor.sprite >= 0 ? SDL_DISABLE : SDL_ENABLE); if(getConfig()->theme.cursor.sprite >= 0) - blitCursor(studio.tic->config.bank.tiles.data[getConfig()->theme.cursor.sprite].data); + blitCursor(studio.tic->config.bank0.tiles.data[getConfig()->theme.cursor.sprite].data); } static void useSystemPalette() @@ -2264,8 +2264,8 @@ static void renderStudio() case TIC_DIALOG_MODE: case TIC_MENU_MODE: case TIC_SURF_MODE: - sfx = &studio.tic->config.bank.sfx; - music = &studio.tic->config.bank.music; + sfx = &studio.tic->config.bank0.sfx; + music = &studio.tic->config.bank0.music; break; default: sfx = getBankSfx(); @@ -2448,7 +2448,7 @@ static void initTouchGamepad() if (!studio.renderer) return; - studio.tic->api.map(studio.tic, &studio.tic->config.bank.map, &studio.tic->config.bank.tiles, 0, 0, TIC_MAP_SCREEN_WIDTH, TIC_MAP_SCREEN_HEIGHT, 0, 0, -1, 1); + studio.tic->api.map(studio.tic, &studio.tic->config.bank0.map, &studio.tic->config.bank0.tiles, 0, 0, TIC_MAP_SCREEN_WIDTH, TIC_MAP_SCREEN_HEIGHT, 0, 0, -1, 1); if(!studio.gamepad.texture) { @@ -2475,7 +2475,7 @@ static void updateSystemFont() for(s32 i = 0; i < TIC_FONT_CHARS; i++) for(s32 y = 0; y < TIC_SPRITESIZE; y++) for(s32 x = 0; x < TIC_SPRITESIZE; x++) - if(tic_tool_peek4(&studio.tic->config.bank.sprites.data[i], TIC_SPRITESIZE*(y+1) - x-1)) + if(tic_tool_peek4(&studio.tic->config.bank0.sprites.data[i], TIC_SPRITESIZE*(y+1) - x-1)) studio.tic->font.data[i*BITS_IN_BYTE+y] |= 1 << x; } @@ -2501,7 +2501,7 @@ static void setWindowIcon() for(s32 j = 0, index = 0; j < Size; j++) for(s32 i = 0; i < Size; i++, index++) { - u8 color = getSpritePixel(studio.tic->config.bank.tiles.data, i/Scale, j/Scale); + u8 color = getSpritePixel(studio.tic->config.bank0.tiles.data, i/Scale, j/Scale); pixels[index] = color == ColorKey ? 0 : pal[color]; } diff --git a/src/surf.c b/src/surf.c index 83083fd..07d714e 100644 --- a/src/surf.c +++ b/src/surf.c @@ -202,14 +202,14 @@ static void drawTopToolbar(Surf* surf, s32 x, s32 y) enum{Gap = 10, TipX = 150, SelectWidth = 54}; u8 colorkey = 0; - tic->api.sprite_ex(tic, &tic->config.bank.tiles, 12, TipX, y+1, 1, 1, &colorkey, 1, 1, tic_no_flip, tic_no_rotate); + tic->api.sprite_ex(tic, &tic->config.bank0.tiles, 12, TipX, y+1, 1, 1, &colorkey, 1, 1, tic_no_flip, tic_no_rotate); { static const char Label[] = "SELECT"; tic->api.text(tic, Label, TipX + Gap, y+3, tic_color_black); tic->api.text(tic, Label, TipX + Gap, y+2, tic_color_white); } - tic->api.sprite_ex(tic, &tic->config.bank.tiles, 13, TipX + SelectWidth, y + 1, 1, 1, &colorkey, 1, 1, tic_no_flip, tic_no_rotate); + tic->api.sprite_ex(tic, &tic->config.bank0.tiles, 13, TipX + SelectWidth, y + 1, 1, 1, &colorkey, 1, 1, tic_no_flip, tic_no_rotate); { static const char Label[] = "BACK"; tic->api.text(tic, Label, TipX + Gap + SelectWidth, y +3, tic_color_black); @@ -244,7 +244,7 @@ static void drawBottomToolbar(Surf* surf, s32 x, s32 y) u8 colorkey = 0; - tic->api.sprite_ex(tic, &tic->config.bank.tiles, 15, TipX + SelectWidth, y + 1, 1, 1, &colorkey, 1, 1, tic_no_flip, tic_no_rotate); + tic->api.sprite_ex(tic, &tic->config.bank0.tiles, 15, TipX + SelectWidth, y + 1, 1, 1, &colorkey, 1, 1, tic_no_flip, tic_no_rotate); { static const char Label[] = "WEBSITE"; tic->api.text(tic, Label, TipX + Gap + SelectWidth, y +3, tic_color_black); @@ -355,7 +355,7 @@ static void drawBG(Surf* surf) for(s32 j = 0; j < Height + 1; j++) for(s32 i = 0; i < Width + 1; i++) if(counter++ % 2) - tic->api.sprite_ex(tic, &tic->config.bank.tiles, 34, i*Size - offset, j*Size - offset, 2, 2, 0, 0, 1, tic_no_flip, tic_no_rotate); + tic->api.sprite_ex(tic, &tic->config.bank0.tiles, 34, i*Size - offset, j*Size - offset, 2, 2, 0, 0, 1, tic_no_flip, tic_no_rotate); } static void replace(char* src, const char* what, const char* with) diff --git a/src/tic.c b/src/tic.c index 2a20b70..73f0d53 100644 --- a/src/tic.c +++ b/src/tic.c @@ -1327,11 +1327,11 @@ static void api_sync(tic_mem* tic, const char* section, s32 bank, bool toCart) { static const struct {const char* name; s32 cart; s32 ram; s32 size;} Sections[] = { - {"tiles", offsetof(tic_cartridge, bank.tiles), offsetof(tic_ram, tiles), sizeof(tic_tiles)}, - {"sprites", offsetof(tic_cartridge, bank.sprites), offsetof(tic_ram, sprites), sizeof(tic_tiles)}, - {"map", offsetof(tic_cartridge, bank.map), offsetof(tic_ram, map), sizeof(tic_map)}, - {"sfx", offsetof(tic_cartridge, bank.sfx), offsetof(tic_ram, sfx), sizeof(tic_sfx)}, - {"music", offsetof(tic_cartridge, bank.music), offsetof(tic_ram, music), sizeof(tic_music)}, + {"tiles", offsetof(tic_cartridge, bank0.tiles), offsetof(tic_ram, tiles), sizeof(tic_tiles)}, + {"sprites", offsetof(tic_cartridge, bank0.sprites), offsetof(tic_ram, sprites), sizeof(tic_tiles)}, + {"map", offsetof(tic_cartridge, bank0.map), offsetof(tic_ram, map), sizeof(tic_map)}, + {"sfx", offsetof(tic_cartridge, bank0.sfx), offsetof(tic_ram, sfx), sizeof(tic_sfx)}, + {"music", offsetof(tic_cartridge, bank0.music), offsetof(tic_ram, music), sizeof(tic_music)}, }; assert(bank >= 0 && bank < TIC_BANKS); @@ -1438,15 +1438,15 @@ static bool isJavascript(const char* code) static tic_script_lang api_get_script(tic_mem* memory) { - if(isMoonscript(memory->cart.bank.code.data)) return tic_script_moon; - if(isJavascript(memory->cart.bank.code.data)) return tic_script_js; + if(isMoonscript(memory->cart.bank0.code.data)) return tic_script_moon; + if(isJavascript(memory->cart.bank0.code.data)) return tic_script_js; return tic_script_lua; } static void updateSaveid(tic_mem* memory) { memset(memory->saveid, 0, sizeof memory->saveid); - const char* saveid = readMetatag(memory->cart.bank.code.data, "saveid", TagFormatLua); + const char* saveid = readMetatag(memory->cart.bank0.code.data, "saveid", TagFormatLua); if(saveid) { strcpy(memory->saveid, saveid); @@ -1454,7 +1454,7 @@ static void updateSaveid(tic_mem* memory) } else { - const char* saveid = readMetatag(memory->cart.bank.code.data, "saveid", TagFormatJS); + const char* saveid = readMetatag(memory->cart.bank0.code.data, "saveid", TagFormatJS); if(saveid) { strcpy(memory->saveid, saveid); @@ -1607,14 +1607,14 @@ static void api_load(tic_cartridge* cart, const u8* buffer, s32 size, bool palet switch(chunk.type) { - case CHUNK_TILES: LOAD_CHUNK(cart->bank.tiles); break; - case CHUNK_SPRITES: LOAD_CHUNK(cart->bank.sprites); break; - case CHUNK_MAP: LOAD_CHUNK(cart->bank.map); break; - case CHUNK_CODE: LOAD_CHUNK(cart->bank.code); break; - case CHUNK_SOUND: LOAD_CHUNK(cart->bank.sfx.data); break; - case CHUNK_WAVEFORM: LOAD_CHUNK(cart->bank.sfx.waveform); break; - case CHUNK_MUSIC: LOAD_CHUNK(cart->bank.music.tracks.data); break; - case CHUNK_PATTERNS: LOAD_CHUNK(cart->bank.music.patterns.data); break; + case CHUNK_TILES: LOAD_CHUNK(cart->bank0.tiles); break; + case CHUNK_SPRITES: LOAD_CHUNK(cart->bank0.sprites); break; + case CHUNK_MAP: LOAD_CHUNK(cart->bank0.map); break; + case CHUNK_CODE: LOAD_CHUNK(cart->bank0.code); break; + case CHUNK_SOUND: LOAD_CHUNK(cart->bank0.sfx.data); break; + case CHUNK_WAVEFORM: LOAD_CHUNK(cart->bank0.sfx.waveform); break; + case CHUNK_MUSIC: LOAD_CHUNK(cart->bank0.music.tracks.data); break; + case CHUNK_PATTERNS: LOAD_CHUNK(cart->bank0.music.patterns.data); break; case CHUNK_PALETTE: if(palette) LOAD_CHUNK(cart->palette); @@ -1676,14 +1676,14 @@ static s32 api_save(const tic_cartridge* cart, u8* buffer) #define SAVE_CHUNK(id, from) saveChunk(buffer, id, &from, sizeof(from)) - buffer = SAVE_CHUNK(CHUNK_TILES, cart->bank.tiles); - buffer = SAVE_CHUNK(CHUNK_SPRITES, cart->bank.sprites); - buffer = SAVE_CHUNK(CHUNK_MAP, cart->bank.map); - buffer = SAVE_CHUNK(CHUNK_CODE, cart->bank.code); - buffer = SAVE_CHUNK(CHUNK_SOUND, cart->bank.sfx.data); - buffer = SAVE_CHUNK(CHUNK_WAVEFORM, cart->bank.sfx.waveform); - buffer = SAVE_CHUNK(CHUNK_PATTERNS, cart->bank.music.patterns.data); - buffer = SAVE_CHUNK(CHUNK_MUSIC, cart->bank.music.tracks.data); + buffer = SAVE_CHUNK(CHUNK_TILES, cart->bank0.tiles); + buffer = SAVE_CHUNK(CHUNK_SPRITES, cart->bank0.sprites); + buffer = SAVE_CHUNK(CHUNK_MAP, cart->bank0.map); + buffer = SAVE_CHUNK(CHUNK_CODE, cart->bank0.code); + buffer = SAVE_CHUNK(CHUNK_SOUND, cart->bank0.sfx.data); + buffer = SAVE_CHUNK(CHUNK_WAVEFORM, cart->bank0.sfx.waveform); + buffer = SAVE_CHUNK(CHUNK_PATTERNS, cart->bank0.music.patterns.data); + buffer = SAVE_CHUNK(CHUNK_MUSIC, cart->bank0.music.tracks.data); buffer = SAVE_CHUNK(CHUNK_PALETTE, cart->palette); buffer = saveFixedChunk(buffer, CHUNK_COVER, cart->cover.data, cart->cover.size); diff --git a/src/tic.h b/src/tic.h index e595374..4a76585 100644 --- a/src/tic.h +++ b/src/tic.h @@ -340,7 +340,7 @@ typedef struct { union { - tic_bank bank; + tic_bank bank0; tic_bank banks[TIC_BANKS]; };