no message

This commit is contained in:
BADIM-PC\Vadim 2017-12-11 11:59:14 +03:00
parent 409564cdde
commit b13fc33aed
2 changed files with 27 additions and 26 deletions

View File

@ -357,16 +357,15 @@ static bool onConsoleLoadSectionCommand(Console* console, const char* param)
loadCart(console->tic, cart, data, size, true); loadCart(console->tic, cart, data, size, true);
tic_mem* tic = console->tic; tic_mem* tic = console->tic;
// TODO: should load to the currena bank
switch(i) switch(i)
{ {
case 0: memcpy(&tic->cart.bank.tiles, &cart->bank.tiles, sizeof(tic_tiles)*2); break; case 0: memcpy(&tic->cart.bank.tiles, &cart->bank.tiles, sizeof(tic_tiles)*2); break;
case 1: memcpy(&tic->cart.bank.map, &cart->bank.map, sizeof(tic_map)); break; case 1: memcpy(&tic->cart.bank.map, &cart->bank.map, sizeof(tic_map)); break;
case 2: memcpy(&tic->cart.cover, &cart->cover, sizeof cart->cover); break; case 2: memcpy(&tic->cart.cover, &cart->cover, sizeof cart->cover); break;
case 3: memcpy(&tic->cart.code, &cart->code, sizeof cart->code); break; case 3: memcpy(&tic->cart.code, &cart->code, sizeof cart->code); break;
case 4: memcpy(&tic->cart.bank.sfx, &cart->bank.sfx, sizeof(tic_sfx)); 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 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 6: memcpy(&tic->cart.palette, &cart->palette, sizeof(tic_palette)); break;
} }
studioRomLoaded(); studioRomLoaded();
@ -603,15 +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; typedef struct {char* tag; s32 count; s32 offset; s32 size; bool flip;} BinarySection;
static const BinarySection BinarySections[] = static const BinarySection BinarySections[] =
{ {
// TODO: fix banks loading here {"PALETTE", 1, offsetof(tic_cartridge, palette.data), sizeof(tic_palette), false},
{"PALETTE", 1, offsetof(tic_cartridge, palette.data), sizeof(tic_palette), false}, {"TILES", TIC_BANK_SPRITES, offsetof(tic_cartridge, bank.tiles), sizeof(tic_tile), true},
{"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},
{"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},
{"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},
{"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},
{"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},
{"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},
{"TRACKS", MUSIC_TRACKS, offsetof(tic_cartridge, bank.music.tracks), sizeof(tic_track), true},
}; };
static s32 saveProject(Console* console, void* buffer, const char* comment) static s32 saveProject(Console* console, void* buffer, const char* comment)
@ -1332,7 +1330,6 @@ static void onImportSprites(const char* name, const void* buffer, size_t size, v
tic_rgb rgb = {c->r, c->g, c->b}; tic_rgb rgb = {c->r, c->g, c->b};
u8 color = tic_tool_find_closest_color(console->tic->cart.palette.colors, &rgb); u8 color = tic_tool_find_closest_color(console->tic->cart.palette.colors, &rgb);
// TODO: should be current bank
setSpritePixel(console->tic->cart.bank.tiles.data, x, y, color); setSpritePixel(console->tic->cart.bank.tiles.data, x, y, color);
} }
@ -1355,7 +1352,6 @@ static void injectMap(Console* console, const void* buffer, s32 size)
{ {
enum {Size = sizeof(tic_map)}; enum {Size = sizeof(tic_map)};
// TODO: should be current bank
SDL_memset(&console->tic->cart.bank.map, 0, Size); SDL_memset(&console->tic->cart.bank.map, 0, Size);
SDL_memcpy(&console->tic->cart.bank.map, buffer, SDL_min(size, Size)); SDL_memcpy(&console->tic->cart.bank.map, buffer, SDL_min(size, Size));
} }

View File

@ -1539,17 +1539,22 @@ static double api_time(tic_mem* memory)
static void api_sync(tic_mem* tic, bool toCart) static void api_sync(tic_mem* tic, bool toCart)
{ {
// TODO: fix this if(toCart)
// if(toCart) {
// { memcpy(&tic->cart.bank.tiles, &tic->ram.tiles, sizeof(tic_tiles));
// memcpy(&tic->cart.gfx, &tic->ram.gfx, sizeof tic->cart.gfx); memcpy(&tic->cart.bank.sprites, &tic->ram.sprites, sizeof(tic_tiles));
// memcpy(&tic->cart.sound, &tic->ram.sound, sizeof tic->cart.sound); memcpy(&tic->cart.bank.map, &tic->ram.map, sizeof(tic_map));
// } memcpy(&tic->cart.bank.sfx, &tic->ram.sfx, sizeof(tic_sfx));
// else memcpy(&tic->cart.bank.music, &tic->ram.music, sizeof(tic_music));
// { }
// memcpy(&tic->ram.gfx, &tic->cart.gfx, sizeof tic->cart.gfx); else
// memcpy(&tic->ram.sound, &tic->cart.sound, sizeof tic->cart.sound); {
// } memcpy(&tic->ram.tiles, &tic->cart.bank.tiles, sizeof(tic_tiles));
memcpy(&tic->ram.sprites, &tic->cart.bank.sprites, sizeof(tic_tiles));
memcpy(&tic->ram.map, &tic->cart.bank.map, sizeof(tic_map));
memcpy(&tic->ram.sfx, &tic->cart.bank.sfx, sizeof(tic_sfx));
memcpy(&tic->ram.music, &tic->cart.bank.music, sizeof(tic_music));
}
} }
static u32 api_btnp(tic_mem* tic, s32 index, s32 hold, s32 period) static u32 api_btnp(tic_mem* tic, s32 index, s32 hold, s32 period)