disabled banks for the code section
This commit is contained in:
parent
2bfe213f61
commit
5156daa5ab
BIN
config.tic
BIN
config.tic
Binary file not shown.
|
@ -259,7 +259,7 @@ static void readConfig(Config* config)
|
|||
|
||||
if(lua)
|
||||
{
|
||||
if(luaL_loadstring(lua, config->cart.bank0.code.data) == LUA_OK && lua_pcall(lua, 0, LUA_MULTRET, 0) == LUA_OK)
|
||||
if(luaL_loadstring(lua, config->cart.code.data) == LUA_OK && lua_pcall(lua, 0, LUA_MULTRET, 0) == LUA_OK)
|
||||
{
|
||||
readConfigVideoLength(config, lua);
|
||||
readConfigVideoScale(config, lua);
|
||||
|
@ -269,10 +269,6 @@ static void readConfig(Config* config)
|
|||
readConfigCrtMonitor(config, lua);
|
||||
readConfigUiScale(config, lua);
|
||||
readTheme(config, lua);
|
||||
}
|
||||
|
||||
if(luaL_loadstring(lua, config->cart.bank1.code.data) == LUA_OK && lua_pcall(lua, 0, LUA_MULTRET, 0) == LUA_OK)
|
||||
{
|
||||
readConfigCrtShader(config, lua);
|
||||
}
|
||||
|
||||
|
|
|
@ -428,7 +428,7 @@ static bool onConsoleLoadSectionCommand(Console* console, const char* param)
|
|||
case 0: memcpy(&tic->cart.cover, &cart->cover, sizeof cart->cover); 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 3: memcpy(&tic->cart.code, &cart->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.bank0.palette, &cart->bank0.palette, sizeof(tic_palette)); break;
|
||||
|
@ -779,15 +779,9 @@ static s32 saveProject(Console* console, void* buffer, const char* comment)
|
|||
tic_mem* tic = console->tic;
|
||||
|
||||
char* stream = buffer;
|
||||
char* ptr = saveTextSection(stream, tic->cart.bank0.code.data);
|
||||
char* ptr = saveTextSection(stream, tic->cart.code.data);
|
||||
char tag[16];
|
||||
|
||||
for(s32 b = 1; b < TIC_BANKS; b++)
|
||||
{
|
||||
makeTag("CODE", tag, b);
|
||||
ptr = saveTextSectionBank(ptr, comment, tag, tic->cart.banks[b].code.data);
|
||||
}
|
||||
|
||||
for(s32 i = 0; i < COUNT_OF(BinarySections); i++)
|
||||
{
|
||||
const BinarySection* section = &BinarySections[i];
|
||||
|
@ -946,17 +940,9 @@ static bool loadProject(Console* console, const char* name, const char* data, s3
|
|||
const char* comment = projectComment(name);
|
||||
char tag[16];
|
||||
|
||||
if(loadTextSection(project, comment, cart->bank0.code.data, sizeof(tic_code)))
|
||||
if(loadTextSection(project, comment, cart->code.data, sizeof(tic_code)))
|
||||
done = true;
|
||||
|
||||
for(s32 b = 1; b < TIC_BANKS; b++)
|
||||
{
|
||||
makeTag("CODE", tag, b);
|
||||
|
||||
if(loadTextSectionBank(project, comment, tag, cart->banks[b].code.data, sizeof(tic_code)))
|
||||
done = true;
|
||||
}
|
||||
|
||||
for(s32 i = 0; i < COUNT_OF(BinarySections); i++)
|
||||
{
|
||||
const BinarySection* section = &BinarySections[i];
|
||||
|
@ -2894,7 +2880,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->bank0.code.data, name);
|
||||
bool loaded = loadFileIntoBuffer(console, console->embed.file->code.data, name);
|
||||
|
||||
if(loaded)
|
||||
{
|
||||
|
|
|
@ -79,7 +79,7 @@ static const char* data2md5(const void* data, s32 length)
|
|||
|
||||
static void initPMemName(Run* run)
|
||||
{
|
||||
const char* data = strlen(run->tic->saveid) ? run->tic->saveid : run->tic->cart.bank0.code.data;
|
||||
const char* data = strlen(run->tic->saveid) ? run->tic->saveid : run->tic->cart.code.data;
|
||||
const char* md5 = data2md5(data, strlen(data));
|
||||
strcpy(run->saveid, TIC_LOCAL);
|
||||
strcat(run->saveid, md5);
|
||||
|
@ -113,9 +113,9 @@ static void processDoFile(void* data, char* dst)
|
|||
static const char DoFileTag[] = "dofile(";
|
||||
enum {Size = sizeof DoFileTag - 1};
|
||||
|
||||
if (memcmp(tic->cart.bank0.code.data, DoFileTag, Size) == 0)
|
||||
if (memcmp(tic->cart.code.data, DoFileTag, Size) == 0)
|
||||
{
|
||||
const char* start = tic->cart.bank0.code.data + Size;
|
||||
const char* start = tic->cart.code.data + Size;
|
||||
const char* end = strchr(start, ')');
|
||||
|
||||
if(end && *start == *(end-1) && (*start == '"' || *start == '\''))
|
||||
|
|
|
@ -1099,7 +1099,7 @@ static void initModules()
|
|||
|
||||
for(s32 i = 0; i < TIC_EDITOR_BANKS; i++)
|
||||
{
|
||||
initCode(impl.editor[i].code, impl.studio.tic, &tic->cart.banks[i].code);
|
||||
initCode(impl.editor[i].code, impl.studio.tic, &tic->cart.code);
|
||||
initSprite(impl.editor[i].sprite, impl.studio.tic, &tic->cart.banks[i].tiles);
|
||||
initMap(impl.editor[i].map, impl.studio.tic, &tic->cart.banks[i].map);
|
||||
initSfx(impl.editor[i].sfx, impl.studio.tic, &tic->cart.banks[i].sfx);
|
||||
|
|
22
src/tic.c
22
src/tic.c
|
@ -1599,13 +1599,13 @@ static const tic_script_config* getScriptConfig(const char* code)
|
|||
|
||||
static const tic_script_config* api_get_script_config(tic_mem* memory)
|
||||
{
|
||||
return getScriptConfig(memory->cart.bank0.code.data);
|
||||
return getScriptConfig(memory->cart.code.data);
|
||||
}
|
||||
|
||||
static void updateSaveid(tic_mem* memory)
|
||||
{
|
||||
memset(memory->saveid, 0, sizeof memory->saveid);
|
||||
const char* saveid = readMetatag(memory->cart.bank0.code.data, "saveid", api_get_script_config(memory)->singleComment);
|
||||
const char* saveid = readMetatag(memory->cart.code.data, "saveid", api_get_script_config(memory)->singleComment);
|
||||
if(saveid)
|
||||
{
|
||||
strncpy(memory->saveid, saveid, TIC_SAVEID_SIZE-1);
|
||||
|
@ -1621,20 +1621,13 @@ static void api_tick(tic_mem* tic, tic_tick_data* data)
|
|||
|
||||
if(!machine->state.initialized)
|
||||
{
|
||||
enum{CodeSize = sizeof(tic_code) * TIC_BANKS};
|
||||
enum{CodeSize = sizeof(tic_code)};
|
||||
char* code = malloc(CodeSize);
|
||||
|
||||
if(code)
|
||||
{
|
||||
memset(code, 0, CodeSize);
|
||||
|
||||
for(s32 i = TIC_BANKS - 1; i >= 0; i--)
|
||||
{
|
||||
const char* bankCode = tic->cart.banks[i].code.data;
|
||||
|
||||
if(strlen(bankCode))
|
||||
strcat(code, bankCode);
|
||||
}
|
||||
strcpy(code, tic->cart.code.data);
|
||||
|
||||
if(data->preprocessor)
|
||||
data->preprocessor(data->data, code);
|
||||
|
@ -1802,12 +1795,15 @@ static void api_load(tic_cartridge* cart, const u8* buffer, s32 size, bool palet
|
|||
case CHUNK_TILES: LOAD_CHUNK(cart->banks[chunk.bank].tiles); break;
|
||||
case CHUNK_SPRITES: LOAD_CHUNK(cart->banks[chunk.bank].sprites); break;
|
||||
case CHUNK_MAP: LOAD_CHUNK(cart->banks[chunk.bank].map); break;
|
||||
case CHUNK_CODE: LOAD_CHUNK(cart->banks[chunk.bank].code); break;
|
||||
case CHUNK_SAMPLES: LOAD_CHUNK(cart->banks[chunk.bank].sfx.samples); break;
|
||||
case CHUNK_WAVEFORM: LOAD_CHUNK(cart->banks[chunk.bank].sfx.waveform); break;
|
||||
case CHUNK_MUSIC: LOAD_CHUNK(cart->banks[chunk.bank].music.tracks); break;
|
||||
case CHUNK_PATTERNS: LOAD_CHUNK(cart->banks[chunk.bank].music.patterns); break;
|
||||
case CHUNK_PALETTE: LOAD_CHUNK(cart->banks[chunk.bank].palette); break;
|
||||
case CHUNK_CODE:
|
||||
if(chunk.bank == 0)
|
||||
LOAD_CHUNK(cart->code);
|
||||
break;
|
||||
case CHUNK_COVER:
|
||||
LOAD_CHUNK(cart->cover.data);
|
||||
cart->cover.size = chunk.size;
|
||||
|
@ -1870,7 +1866,6 @@ static s32 api_save(const tic_cartridge* cart, u8* buffer)
|
|||
buffer = SAVE_CHUNK(CHUNK_TILES, cart->banks[i].tiles, i);
|
||||
buffer = SAVE_CHUNK(CHUNK_SPRITES, cart->banks[i].sprites, i);
|
||||
buffer = SAVE_CHUNK(CHUNK_MAP, cart->banks[i].map, i);
|
||||
buffer = SAVE_CHUNK(CHUNK_CODE, cart->banks[i].code, i);
|
||||
buffer = SAVE_CHUNK(CHUNK_SAMPLES, cart->banks[i].sfx.samples, i);
|
||||
buffer = SAVE_CHUNK(CHUNK_WAVEFORM, cart->banks[i].sfx.waveform, i);
|
||||
buffer = SAVE_CHUNK(CHUNK_PATTERNS, cart->banks[i].music.patterns, i);
|
||||
|
@ -1878,6 +1873,7 @@ static s32 api_save(const tic_cartridge* cart, u8* buffer)
|
|||
buffer = SAVE_CHUNK(CHUNK_PALETTE, cart->banks[i].palette, i);
|
||||
}
|
||||
|
||||
buffer = SAVE_CHUNK(CHUNK_CODE, cart->code, 0);
|
||||
buffer = saveFixedChunk(buffer, CHUNK_COVER, cart->cover.data, cart->cover.size, 0);
|
||||
|
||||
#undef SAVE_CHUNK
|
||||
|
|
11
src/tic.h
11
src/tic.h
|
@ -337,7 +337,6 @@ typedef struct
|
|||
tic_map map;
|
||||
tic_sfx sfx;
|
||||
tic_music music;
|
||||
tic_code code;
|
||||
tic_palette palette;
|
||||
} tic_bank;
|
||||
|
||||
|
@ -345,15 +344,11 @@ typedef struct
|
|||
{
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
tic_bank bank0;
|
||||
tic_bank bank1;
|
||||
};
|
||||
|
||||
tic_bank bank0;
|
||||
tic_bank banks[TIC_BANKS];
|
||||
};
|
||||
|
||||
|
||||
tic_code code;
|
||||
tic_cover_image cover;
|
||||
} tic_cartridge;
|
||||
|
||||
|
|
Loading…
Reference in New Issue