Merge pull request #340 from matheuslessarodrigues/tic_0.47.0
Tic 0.47.0
This commit is contained in:
commit
335d8cb65e
198
src/console.c
198
src/console.c
|
@ -122,7 +122,7 @@ static void consolePrint(Console* console, const char* text, u8 color)
|
||||||
console->cursor.x = 0;
|
console->cursor.x = 0;
|
||||||
console->cursor.y++;
|
console->cursor.y++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
s32 offset = console->cursor.x + console->cursor.y * CONSOLE_BUFFER_WIDTH;
|
s32 offset = console->cursor.x + console->cursor.y * CONSOLE_BUFFER_WIDTH;
|
||||||
*(console->buffer + offset) = symbol;
|
*(console->buffer + offset) = symbol;
|
||||||
|
@ -182,7 +182,7 @@ static void drawCursor(Console* console, s32 x, s32 y, u8 symbol)
|
||||||
|
|
||||||
if(inverse)
|
if(inverse)
|
||||||
console->tic->api.rect(console->tic, x-1, y-1, TIC_FONT_WIDTH+1, TIC_FONT_HEIGHT+1, CONSOLE_CURSOR_COLOR);
|
console->tic->api.rect(console->tic, x-1, y-1, TIC_FONT_WIDTH+1, TIC_FONT_HEIGHT+1, CONSOLE_CURSOR_COLOR);
|
||||||
|
|
||||||
console->tic->api.draw_char(console->tic, symbol, x, y, inverse ? TIC_COLOR_BG : CONSOLE_FRONT_TEXT_COLOR);
|
console->tic->api.draw_char(console->tic, symbol, x, y, inverse ? TIC_COLOR_BG : CONSOLE_FRONT_TEXT_COLOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ static void processConsoleDel(Console* console)
|
||||||
{
|
{
|
||||||
char* pos = console->inputBuffer + console->inputPosition;
|
char* pos = console->inputBuffer + console->inputPosition;
|
||||||
size_t size = strlen(pos);
|
size_t size = strlen(pos);
|
||||||
memmove(pos, pos + 1, size);
|
memmove(pos, pos + 1, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void processConsoleBackspace(Console* console)
|
static void processConsoleBackspace(Console* console)
|
||||||
|
@ -269,7 +269,7 @@ static void processConsoleBackspace(Console* console)
|
||||||
{
|
{
|
||||||
console->inputPosition--;
|
console->inputPosition--;
|
||||||
|
|
||||||
processConsoleDel(console);
|
processConsoleDel(console);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -322,7 +322,7 @@ static bool onConsoleLoadSectionCommand(Console* console, const char* param)
|
||||||
|
|
||||||
if(param)
|
if(param)
|
||||||
{
|
{
|
||||||
static const char* Sections[] =
|
static const char* Sections[] =
|
||||||
{
|
{
|
||||||
"sprites",
|
"sprites",
|
||||||
"map",
|
"map",
|
||||||
|
@ -416,21 +416,21 @@ static void* getDemoCart(Console* console, tic_script_lang script, s32* size)
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const u8 LuaDemoRom[] =
|
static const u8 LuaDemoRom[] =
|
||||||
{
|
{
|
||||||
#include "../bin/assets/luademo.tic.dat"
|
#include "../bin/assets/luademo.tic.dat"
|
||||||
};
|
};
|
||||||
|
|
||||||
static const u8 JsDemoRom[] =
|
static const u8 JsDemoRom[] =
|
||||||
{
|
{
|
||||||
#include "../bin/assets/jsdemo.tic.dat"
|
#include "../bin/assets/jsdemo.tic.dat"
|
||||||
};
|
};
|
||||||
|
|
||||||
static const u8 MoonDemoRom[] =
|
static const u8 MoonDemoRom[] =
|
||||||
{
|
{
|
||||||
#include "../bin/assets/moondemo.tic.dat"
|
#include "../bin/assets/moondemo.tic.dat"
|
||||||
};
|
};
|
||||||
|
|
||||||
const u8* demo = NULL;
|
const u8* demo = NULL;
|
||||||
s32 romSize = 0;
|
s32 romSize = 0;
|
||||||
|
|
||||||
|
@ -467,7 +467,7 @@ static void onConsoleLoadDemoCommandConfirmed(Console* console, const char* para
|
||||||
s32 size = 0;
|
s32 size = 0;
|
||||||
|
|
||||||
console->showGameMenu = false;
|
console->showGameMenu = false;
|
||||||
|
|
||||||
if(strcmp(param, DefaultLuaTicPath) == 0)
|
if(strcmp(param, DefaultLuaTicPath) == 0)
|
||||||
data = getDemoCart(console, tic_script_lua, &size);
|
data = getDemoCart(console, tic_script_lua, &size);
|
||||||
else if(strcmp(param, DefaultMoonTicPath) == 0)
|
else if(strcmp(param, DefaultMoonTicPath) == 0)
|
||||||
|
@ -499,7 +499,7 @@ static void onConsoleLoadCommandConfirmed(Console* console, const char* param)
|
||||||
s32 size = 0;
|
s32 size = 0;
|
||||||
const char* name = getRomName(param);
|
const char* name = getRomName(param);
|
||||||
|
|
||||||
void* data = strcmp(name, CONFIG_TIC_PATH) == 0
|
void* data = strcmp(name, CONFIG_TIC_PATH) == 0
|
||||||
? fsLoadRootFile(console->fs, name, &size)
|
? fsLoadRootFile(console->fs, name, &size)
|
||||||
: fsLoadFile(console->fs, name, &size);
|
: fsLoadFile(console->fs, name, &size);
|
||||||
|
|
||||||
|
@ -568,7 +568,7 @@ static void onConsoleLoadDemoCommand(Console* console, const char* param)
|
||||||
{
|
{
|
||||||
if(studioCartChanged())
|
if(studioCartChanged())
|
||||||
{
|
{
|
||||||
static const char* Rows[] =
|
static const char* Rows[] =
|
||||||
{
|
{
|
||||||
"YOU HAVE",
|
"YOU HAVE",
|
||||||
"UNSAVED CHANGES",
|
"UNSAVED CHANGES",
|
||||||
|
@ -589,7 +589,7 @@ static void onConsoleLoadCommand(Console* console, const char* param)
|
||||||
{
|
{
|
||||||
if(studioCartChanged())
|
if(studioCartChanged())
|
||||||
{
|
{
|
||||||
static const char* Rows[] =
|
static const char* Rows[] =
|
||||||
{
|
{
|
||||||
"YOU HAVE",
|
"YOU HAVE",
|
||||||
"UNSAVED CHANGES",
|
"UNSAVED CHANGES",
|
||||||
|
@ -615,7 +615,7 @@ static void loadDemo(Console* console, tic_script_lang script)
|
||||||
{
|
{
|
||||||
loadRom(console->tic, data, size, false);
|
loadRom(console->tic, data, size, false);
|
||||||
|
|
||||||
SDL_free(data);
|
SDL_free(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_memset(console->romName, 0, sizeof console->romName);
|
SDL_memset(console->romName, 0, sizeof console->romName);
|
||||||
|
@ -651,7 +651,7 @@ static void onConsoleNewCommand(Console* console, const char* param)
|
||||||
{
|
{
|
||||||
if(studioCartChanged())
|
if(studioCartChanged())
|
||||||
{
|
{
|
||||||
static const char* Rows[] =
|
static const char* Rows[] =
|
||||||
{
|
{
|
||||||
"YOU HAVE",
|
"YOU HAVE",
|
||||||
"UNSAVED CHANGES",
|
"UNSAVED CHANGES",
|
||||||
|
@ -779,42 +779,42 @@ static void installDemoCart(FileSystem* fs, const char* name, const void* cart,
|
||||||
|
|
||||||
static void onConsoleInstallDemosCommand(Console* console, const char* param)
|
static void onConsoleInstallDemosCommand(Console* console, const char* param)
|
||||||
{
|
{
|
||||||
static const u8 DemoFire[] =
|
static const u8 DemoFire[] =
|
||||||
{
|
{
|
||||||
#include "../bin/assets/fire.tic.dat"
|
#include "../bin/assets/fire.tic.dat"
|
||||||
};
|
};
|
||||||
|
|
||||||
static const u8 DemoP3D[] =
|
static const u8 DemoP3D[] =
|
||||||
{
|
{
|
||||||
#include "../bin/assets/p3d.tic.dat"
|
#include "../bin/assets/p3d.tic.dat"
|
||||||
};
|
};
|
||||||
|
|
||||||
static const u8 DemoSFX[] =
|
static const u8 DemoSFX[] =
|
||||||
{
|
{
|
||||||
#include "../bin/assets/sfx.tic.dat"
|
#include "../bin/assets/sfx.tic.dat"
|
||||||
};
|
};
|
||||||
|
|
||||||
static const u8 DemoPalette[] =
|
static const u8 DemoPalette[] =
|
||||||
{
|
{
|
||||||
#include "../bin/assets/palette.tic.dat"
|
#include "../bin/assets/palette.tic.dat"
|
||||||
};
|
};
|
||||||
|
|
||||||
static const u8 DemoFont[] =
|
static const u8 DemoFont[] =
|
||||||
{
|
{
|
||||||
#include "../bin/assets/font.tic.dat"
|
#include "../bin/assets/font.tic.dat"
|
||||||
};
|
};
|
||||||
|
|
||||||
static const u8 DemoMusic[] =
|
static const u8 DemoMusic[] =
|
||||||
{
|
{
|
||||||
#include "../bin/assets/music.tic.dat"
|
#include "../bin/assets/music.tic.dat"
|
||||||
};
|
};
|
||||||
|
|
||||||
static const u8 GameQuest[] =
|
static const u8 GameQuest[] =
|
||||||
{
|
{
|
||||||
#include "../bin/assets/quest.tic.dat"
|
#include "../bin/assets/quest.tic.dat"
|
||||||
};
|
};
|
||||||
|
|
||||||
static const u8 GameTetris[] =
|
static const u8 GameTetris[] =
|
||||||
{
|
{
|
||||||
#include "../bin/assets/tetris.tic.dat"
|
#include "../bin/assets/tetris.tic.dat"
|
||||||
};
|
};
|
||||||
|
@ -942,7 +942,7 @@ static void onImportCover(const char* name, const void* buffer, size_t size, voi
|
||||||
|
|
||||||
printLine(console);
|
printLine(console);
|
||||||
printBack(console, name);
|
printBack(console, name);
|
||||||
printBack(console, " successfully imported");
|
printBack(console, " successfully imported");
|
||||||
}
|
}
|
||||||
else printError(console, "\ncover image too big :(");
|
else printError(console, "\ncover image too big :(");
|
||||||
}
|
}
|
||||||
|
@ -950,9 +950,9 @@ static void onImportCover(const char* name, const void* buffer, size_t size, voi
|
||||||
|
|
||||||
gif_close(image);
|
gif_close(image);
|
||||||
}
|
}
|
||||||
else printError(console, "\nfile importing error :(");
|
else printError(console, "\nfile importing error :(");
|
||||||
}
|
}
|
||||||
else printBack(console, "\nonly .gif files can be imported :|");
|
else printBack(console, "\nonly .gif files can be imported :|");
|
||||||
}
|
}
|
||||||
else printBack(console, "\nfile not imported :|");
|
else printBack(console, "\nfile not imported :|");
|
||||||
|
|
||||||
|
@ -1006,7 +1006,7 @@ static void onImportSprites(const char* name, const void* buffer, size_t size, v
|
||||||
}
|
}
|
||||||
else printError(console, "\nfile importing error :(");
|
else printError(console, "\nfile importing error :(");
|
||||||
}
|
}
|
||||||
else printBack(console, "\nonly .gif files can be imported :|");
|
else printBack(console, "\nonly .gif files can be imported :|");
|
||||||
}
|
}
|
||||||
else printBack(console, "\nfile not imported :|");
|
else printBack(console, "\nfile not imported :|");
|
||||||
|
|
||||||
|
@ -1091,7 +1091,7 @@ static void exportCover(Console* console)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printBack(console, "\ncover image is empty, run game and\npress [F7] to assign cover image");
|
printBack(console, "\ncover image is empty, run game and\npress [F7] to assign cover image");
|
||||||
commandDone(console);
|
commandDone(console);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1215,7 +1215,7 @@ typedef struct
|
||||||
const char* cartName;
|
const char* cartName;
|
||||||
} AppFileReadParam;
|
} AppFileReadParam;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
u8* data;
|
u8* data;
|
||||||
size_t size;
|
size_t size;
|
||||||
|
@ -1272,7 +1272,7 @@ static void onConsoleExportHtmlCommand(Console* console, const char* name)
|
||||||
writeMemoryString(&output, "<script type='text/javascript'>\n");
|
writeMemoryString(&output, "<script type='text/javascript'>\n");
|
||||||
|
|
||||||
u8* buffer = (u8*)SDL_malloc(sizeof(tic_cartridge));
|
u8* buffer = (u8*)SDL_malloc(sizeof(tic_cartridge));
|
||||||
|
|
||||||
if(buffer)
|
if(buffer)
|
||||||
{
|
{
|
||||||
writeMemoryString(&output, "var cartridge = [");
|
writeMemoryString(&output, "var cartridge = [");
|
||||||
|
@ -1315,7 +1315,7 @@ static void onConsoleExportHtmlCommand(Console* console, const char* name)
|
||||||
|
|
||||||
fsGetFileData(onFileDownloaded, cartName, output.data, output.size, DEFAULT_CHMOD, console);
|
fsGetFileData(onFileDownloaded, cartName, output.data, output.size, DEFAULT_CHMOD, console);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_free(EmbedIndex);
|
SDL_free(EmbedIndex);
|
||||||
|
@ -1381,7 +1381,7 @@ static bool exportToFolder(Console* console, const char* folder, const char* fil
|
||||||
strcpy(dst, folder);
|
strcpy(dst, folder);
|
||||||
strcat(dst, file);
|
strcat(dst, file);
|
||||||
|
|
||||||
return fsCopyFile(src, dst);
|
return fsCopyFile(src, dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1390,7 +1390,7 @@ static bool exportToFolder(Console* console, const char* folder, const char* fil
|
||||||
static void onConsoleExportNativeCommand(Console* console, const char* cartName)
|
static void onConsoleExportNativeCommand(Console* console, const char* cartName)
|
||||||
{
|
{
|
||||||
const char* folder = folder_dialog(console);
|
const char* folder = folder_dialog(console);
|
||||||
bool done = false;
|
bool done = false;
|
||||||
|
|
||||||
if(folder)
|
if(folder)
|
||||||
{
|
{
|
||||||
|
@ -1414,7 +1414,7 @@ static void onConsoleExportNativeCommand(Console* console, const char* cartName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(done && exportToFolder(console, folder, "\\tic80.dll") &&
|
if(done && exportToFolder(console, folder, "\\tic80.dll") &&
|
||||||
exportToFolder(console, folder, "\\SDL2.dll"))
|
exportToFolder(console, folder, "\\SDL2.dll"))
|
||||||
printBack(console, "\ngame exported :)");
|
printBack(console, "\ngame exported :)");
|
||||||
else printBack(console, "\ngame not exported :|");
|
else printBack(console, "\ngame not exported :|");
|
||||||
|
@ -1478,7 +1478,7 @@ static void onConsoleExportCommand(Console* console, const char* param)
|
||||||
if(strcmp(param, "html") == 0) onConsoleExportHtmlCommand(console, getExportName(console, true));
|
if(strcmp(param, "html") == 0) onConsoleExportHtmlCommand(console, getExportName(console, true));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(strcmp(param, "native") == 0)
|
if(strcmp(param, "native") == 0)
|
||||||
{
|
{
|
||||||
#ifdef CAN_EXPORT
|
#ifdef CAN_EXPORT
|
||||||
onConsoleExportNativeCommand(console, getExportName(console, false));
|
onConsoleExportNativeCommand(console, getExportName(console, false));
|
||||||
|
@ -1529,7 +1529,7 @@ static CartSaveResult saveCartName(Console* console, const char* name)
|
||||||
{
|
{
|
||||||
console->config->save(console->config);
|
console->config->save(console->config);
|
||||||
studioRomSaved();
|
studioRomSaved();
|
||||||
|
|
||||||
return CART_SAVE_OK;
|
return CART_SAVE_OK;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1544,10 +1544,10 @@ static CartSaveResult saveCartName(Console* console, const char* name)
|
||||||
success = true;
|
success = true;
|
||||||
studioRomSaved();
|
studioRomSaved();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_free(buffer);
|
SDL_free(buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strlen(console->romName))
|
else if (strlen(console->romName))
|
||||||
|
@ -1555,7 +1555,7 @@ static CartSaveResult saveCartName(Console* console, const char* name)
|
||||||
return saveCartName(console, console->romName);
|
return saveCartName(console, console->romName);
|
||||||
}
|
}
|
||||||
else return CART_SAVE_MISSING_NAME;
|
else return CART_SAVE_MISSING_NAME;
|
||||||
|
|
||||||
return success ? CART_SAVE_OK : CART_SAVE_ERROR;
|
return success ? CART_SAVE_OK : CART_SAVE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1574,9 +1574,9 @@ static void onConsoleSaveCommandConfirmed(Console* console, const char* param)
|
||||||
printFront(console, console->romName);
|
printFront(console, console->romName);
|
||||||
printBack(console, " saved!\n");
|
printBack(console, " saved!\n");
|
||||||
}
|
}
|
||||||
else if(rom == CART_SAVE_MISSING_NAME)
|
else if(rom == CART_SAVE_MISSING_NAME)
|
||||||
printBack(console, "\ncart name is missing\n");
|
printBack(console, "\ncart name is missing\n");
|
||||||
else
|
else
|
||||||
printBack(console, "\ncart saving error");
|
printBack(console, "\ncart saving error");
|
||||||
|
|
||||||
commandDone(console);
|
commandDone(console);
|
||||||
|
@ -1586,7 +1586,7 @@ static void onConsoleSaveCommand(Console* console, const char* param)
|
||||||
{
|
{
|
||||||
if(param && strlen(param) && fsExistsFile(console->fs, getRomName(param)))
|
if(param && strlen(param) && fsExistsFile(console->fs, getRomName(param)))
|
||||||
{
|
{
|
||||||
static const char* Rows[] =
|
static const char* Rows[] =
|
||||||
{
|
{
|
||||||
"THE CART",
|
"THE CART",
|
||||||
"ALREADY EXISTS",
|
"ALREADY EXISTS",
|
||||||
|
@ -1672,24 +1672,24 @@ static void onConsoleDelCommandConfirmed(Console* console, const char* param)
|
||||||
if(fsIsDir(console->fs, param))
|
if(fsIsDir(console->fs, param))
|
||||||
{
|
{
|
||||||
printBack(console, fsDeleteDir(console->fs, param)
|
printBack(console, fsDeleteDir(console->fs, param)
|
||||||
? "\ndir not deleted"
|
? "\ndir not deleted"
|
||||||
: "\ndir successfully deleted");
|
: "\ndir successfully deleted");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printBack(console, fsDeleteFile(console->fs, param)
|
printBack(console, fsDeleteFile(console->fs, param)
|
||||||
? "\nfile not deleted"
|
? "\nfile not deleted"
|
||||||
: "\nfile successfully deleted");
|
: "\nfile successfully deleted");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else printBack(console, "\nname is missing");
|
else printBack(console, "\nname is missing");
|
||||||
|
|
||||||
commandDone(console);
|
commandDone(console);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void onConsoleDelCommand(Console* console, const char* param)
|
static void onConsoleDelCommand(Console* console, const char* param)
|
||||||
{
|
{
|
||||||
static const char* Rows[] =
|
static const char* Rows[] =
|
||||||
{
|
{
|
||||||
"", "",
|
"", "",
|
||||||
"DO YOU REALLY WANT",
|
"DO YOU REALLY WANT",
|
||||||
|
@ -1717,7 +1717,7 @@ static void printTable(Console* console, const char* text)
|
||||||
console->cursor.x = 0;
|
console->cursor.x = 0;
|
||||||
console->cursor.y++;
|
console->cursor.y++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
s32 offset = console->cursor.x + console->cursor.y * CONSOLE_BUFFER_WIDTH;
|
s32 offset = console->cursor.x + console->cursor.y * CONSOLE_BUFFER_WIDTH;
|
||||||
*(console->buffer + offset) = symbol;
|
*(console->buffer + offset) = symbol;
|
||||||
|
@ -1805,7 +1805,7 @@ static void onConsoleRamCommand(Console* console, const char* param)
|
||||||
commandDone(console);
|
commandDone(console);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct
|
static const struct
|
||||||
{
|
{
|
||||||
const char* command;
|
const char* command;
|
||||||
const char* alt;
|
const char* alt;
|
||||||
|
@ -1860,7 +1860,7 @@ static void processConsoleTab(Console* console)
|
||||||
if(strlen(input))
|
if(strlen(input))
|
||||||
{
|
{
|
||||||
char* param = SDL_strchr(input, ' ');
|
char* param = SDL_strchr(input, ' ');
|
||||||
|
|
||||||
if(param && strlen(++param))
|
if(param && strlen(++param))
|
||||||
{
|
{
|
||||||
fsEnumFiles(console->fs, predictFilename, param);
|
fsEnumFiles(console->fs, predictFilename, param);
|
||||||
|
@ -1878,8 +1878,8 @@ static void processConsoleTab(Console* console)
|
||||||
console->inputPosition = strlen(input);
|
console->inputPosition = strlen(input);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1980,7 +1980,7 @@ static void processCommand(Console* console, const char* command)
|
||||||
if(param && !strlen(param)) param = NULL;
|
if(param && !strlen(param)) param = NULL;
|
||||||
|
|
||||||
for(s32 i = 0; i < COUNT_OF(AvailableConsoleCommands); i++)
|
for(s32 i = 0; i < COUNT_OF(AvailableConsoleCommands); i++)
|
||||||
if(tic_strcasecmp(command, AvailableConsoleCommands[i].command) == 0 ||
|
if(tic_strcasecmp(command, AvailableConsoleCommands[i].command) == 0 ||
|
||||||
(AvailableConsoleCommands[i].alt && tic_strcasecmp(command, AvailableConsoleCommands[i].alt) == 0))
|
(AvailableConsoleCommands[i].alt && tic_strcasecmp(command, AvailableConsoleCommands[i].alt) == 0))
|
||||||
{
|
{
|
||||||
if(AvailableConsoleCommands[i].handler)
|
if(AvailableConsoleCommands[i].handler)
|
||||||
|
@ -2087,7 +2087,7 @@ static void setScroll(Console* console, s32 val)
|
||||||
console->scroll.pos = val;
|
console->scroll.pos = val;
|
||||||
|
|
||||||
if(console->scroll.pos < 0) console->scroll.pos = 0;
|
if(console->scroll.pos < 0) console->scroll.pos = 0;
|
||||||
if(console->scroll.pos > console->cursor.y) console->scroll.pos = console->cursor.y;
|
if(console->scroll.pos > console->cursor.y) console->scroll.pos = console->cursor.y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2117,7 +2117,7 @@ static void checkNewVersion(Console* console)
|
||||||
NetVersion version = netVersionRequest(net);
|
NetVersion version = netVersionRequest(net);
|
||||||
SDL_free(net);
|
SDL_free(net);
|
||||||
|
|
||||||
if((version.major > TIC_VERSION_MAJOR) ||
|
if((version.major > TIC_VERSION_MAJOR) ||
|
||||||
(version.major == TIC_VERSION_MAJOR && version.minor > TIC_VERSION_MINOR) ||
|
(version.major == TIC_VERSION_MAJOR && version.minor > TIC_VERSION_MINOR) ||
|
||||||
(version.major == TIC_VERSION_MAJOR && version.minor == TIC_VERSION_MINOR && version.patch > TIC_VERSION_PATCH))
|
(version.major == TIC_VERSION_MAJOR && version.minor == TIC_VERSION_MINOR && version.patch > TIC_VERSION_PATCH))
|
||||||
{
|
{
|
||||||
|
@ -2177,7 +2177,7 @@ static void tick(Console* console)
|
||||||
}
|
}
|
||||||
|
|
||||||
scrollConsole(console);
|
scrollConsole(console);
|
||||||
console->cursor.delay = CONSOLE_CURSOR_DELAY;
|
console->cursor.delay = CONSOLE_CURSOR_DELAY;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_TEXTINPUT:
|
case SDL_TEXTINPUT:
|
||||||
|
@ -2260,7 +2260,7 @@ static void tick(Console* console)
|
||||||
drawConsoleInputText(console);
|
drawConsoleInputText(console);
|
||||||
}
|
}
|
||||||
|
|
||||||
console->tickCounter++;
|
console->tickCounter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cmdLoadCart(Console* console, const char* name)
|
static void cmdLoadCart(Console* console, const char* name)
|
||||||
|
@ -2269,7 +2269,7 @@ static void cmdLoadCart(Console* console, const char* name)
|
||||||
void* data = fsReadFile(name, &size);
|
void* data = fsReadFile(name, &size);
|
||||||
|
|
||||||
if(data)
|
if(data)
|
||||||
{
|
{
|
||||||
loadCart(console->tic, &embed.file, data, size, true);
|
loadCart(console->tic, &embed.file, data, size, true);
|
||||||
embed.yes = true;
|
embed.yes = true;
|
||||||
|
|
||||||
|
@ -2277,31 +2277,62 @@ static void cmdLoadCart(Console* console, const char* name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool loadFileIntoBuffer(Console* console, char* buffer, const char* fileName)
|
||||||
|
{
|
||||||
|
s32 size = 0;
|
||||||
|
void* contents = fsReadFile(fileName, &size);
|
||||||
|
|
||||||
|
if(contents)
|
||||||
|
{
|
||||||
|
memset(buffer, 0, TIC_CODE_SIZE);
|
||||||
|
|
||||||
|
if(size > TIC_CODE_SIZE)
|
||||||
|
{
|
||||||
|
char messageBuffer[256];
|
||||||
|
sprintf(messageBuffer, "\n code is larger than %i symbols\n", TIC_CODE_SIZE);
|
||||||
|
|
||||||
|
printError(console, messageBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy(buffer, contents, SDL_min(size, TIC_CODE_SIZE-1));
|
||||||
|
SDL_free(contents);
|
||||||
|
|
||||||
|
embed.yes = true;
|
||||||
|
embed.fast = true;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void tryReloadCode(Console* console, char* codeBuffer)
|
||||||
|
{
|
||||||
|
if(console->codeLiveReload.active)
|
||||||
|
{
|
||||||
|
const char* fileName = console->codeLiveReload.fileName;
|
||||||
|
loadFileIntoBuffer(console, codeBuffer, fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void cmdInjectCode(Console* console, const char* param, const char* name)
|
static void cmdInjectCode(Console* console, const char* param, const char* name)
|
||||||
{
|
{
|
||||||
if(strcmp(param, "-code") == 0)
|
bool watch = strcmp(param, "-code-watch") == 0;
|
||||||
|
if(strcmp(param, "-code") == 0 || watch)
|
||||||
{
|
{
|
||||||
s32 size = 0;
|
bool loaded = loadFileIntoBuffer(console, &embed.file.code.data, name);
|
||||||
void* code = fsReadFile(name, &size);
|
|
||||||
|
|
||||||
memset(embed.file.code.data, 0, sizeof(tic_code));
|
if(loaded)
|
||||||
|
|
||||||
if(code)
|
|
||||||
{
|
{
|
||||||
if(size > TIC_CODE_SIZE)
|
|
||||||
{
|
|
||||||
char buffer[256];
|
|
||||||
sprintf(buffer, "\n code is larger than %i symbols\n", TIC_CODE_SIZE);
|
|
||||||
|
|
||||||
printError(console, buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(embed.file.code.data, code, SDL_min(size, TIC_CODE_SIZE-1));
|
|
||||||
SDL_free(code);
|
|
||||||
|
|
||||||
embed.yes = true;
|
embed.yes = true;
|
||||||
embed.fast = true;
|
embed.fast = true;
|
||||||
}
|
|
||||||
|
if(watch)
|
||||||
|
{
|
||||||
|
console->codeLiveReload.active = true;
|
||||||
|
strcpy(console->codeLiveReload.fileName, name);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2313,7 +2344,7 @@ static void cmdInjectSprites(Console* console, const char* param, const char* na
|
||||||
void* sprites = fsReadFile(name, &size);
|
void* sprites = fsReadFile(name, &size);
|
||||||
|
|
||||||
if(sprites)
|
if(sprites)
|
||||||
{
|
{
|
||||||
gif_image* image = gif_read_data(sprites, size);
|
gif_image* image = gif_read_data(sprites, size);
|
||||||
|
|
||||||
if (image)
|
if (image)
|
||||||
|
@ -2387,12 +2418,17 @@ void initConsole(Console* console, tic_mem* tic, FileSystem* fs, Config* config,
|
||||||
.tick = tick,
|
.tick = tick,
|
||||||
.save = saveCart,
|
.save = saveCart,
|
||||||
.cursor = {.x = 0, .y = 0, .delay = 0},
|
.cursor = {.x = 0, .y = 0, .delay = 0},
|
||||||
.scroll =
|
.scroll =
|
||||||
{
|
{
|
||||||
.pos = 0,
|
.pos = 0,
|
||||||
.start = 0,
|
.start = 0,
|
||||||
.active = false,
|
.active = false,
|
||||||
},
|
},
|
||||||
|
.codeLiveReload =
|
||||||
|
{
|
||||||
|
.active = false,
|
||||||
|
.reload = tryReloadCode,
|
||||||
|
},
|
||||||
.inputPosition = 0,
|
.inputPosition = 0,
|
||||||
.history = NULL,
|
.history = NULL,
|
||||||
.historyHead = NULL,
|
.historyHead = NULL,
|
||||||
|
@ -2407,6 +2443,8 @@ void initConsole(Console* console, tic_mem* tic, FileSystem* fs, Config* config,
|
||||||
memset(console->buffer, 0, CONSOLE_BUFFER_SIZE);
|
memset(console->buffer, 0, CONSOLE_BUFFER_SIZE);
|
||||||
memset(console->colorBuffer, TIC_COLOR_BG, CONSOLE_BUFFER_SIZE);
|
memset(console->colorBuffer, TIC_COLOR_BG, CONSOLE_BUFFER_SIZE);
|
||||||
|
|
||||||
|
memset(console->codeLiveReload.fileName, 0, FILENAME_MAX);
|
||||||
|
|
||||||
if(argc)
|
if(argc)
|
||||||
{
|
{
|
||||||
strcpy(console->appPath, argv[0]);
|
strcpy(console->appPath, argv[0]);
|
||||||
|
@ -2424,7 +2462,7 @@ void initConsole(Console* console, tic_mem* tic, FileSystem* fs, Config* config,
|
||||||
if(argc > 1)
|
if(argc > 1)
|
||||||
{
|
{
|
||||||
memcpy(embed.file.palette.data, tic->config.palette.data, sizeof(tic_palette));
|
memcpy(embed.file.palette.data, tic->config.palette.data, sizeof(tic_palette));
|
||||||
|
|
||||||
if (argc == 2) cmdLoadCart(console, argv[1]);
|
if (argc == 2) cmdLoadCart(console, argv[1]);
|
||||||
else if (argc == 3)
|
else if (argc == 3)
|
||||||
{
|
{
|
||||||
|
@ -2475,9 +2513,9 @@ void initConsole(Console* console, tic_mem* tic, FileSystem* fs, Config* config,
|
||||||
SDL_free(data);
|
SDL_free(data);
|
||||||
|
|
||||||
EM_ASM_({Module._free($0);}, cartPtr);
|
EM_ASM_({Module._free($0);}, cartPtr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
console->active = !embed.yes;
|
console->active = !embed.yes;
|
||||||
|
|
|
@ -57,10 +57,18 @@ struct Console
|
||||||
{
|
{
|
||||||
s32 pos;
|
s32 pos;
|
||||||
s32 start;
|
s32 start;
|
||||||
|
|
||||||
bool active;
|
bool active;
|
||||||
} scroll;
|
} scroll;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
char fileName[FILENAME_MAX];
|
||||||
|
bool active;
|
||||||
|
|
||||||
|
void(*reload)(Console*, char*);
|
||||||
|
} codeLiveReload;
|
||||||
|
|
||||||
char* buffer;
|
char* buffer;
|
||||||
u8* colorBuffer;
|
u8* colorBuffer;
|
||||||
|
|
||||||
|
|
161
src/studio.c
161
src/studio.c
|
@ -141,7 +141,7 @@ static struct
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
s32 counter;
|
s32 counter;
|
||||||
char message[STUDIO_TEXT_BUFFER_WIDTH];
|
char message[STUDIO_TEXT_BUFFER_WIDTH];
|
||||||
} popup;
|
} popup;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
|
@ -188,11 +188,11 @@ static struct
|
||||||
|
|
||||||
float* floatSamples;
|
float* floatSamples;
|
||||||
|
|
||||||
} studio =
|
} studio =
|
||||||
{
|
{
|
||||||
.tic80local = NULL,
|
.tic80local = NULL,
|
||||||
.tic = NULL,
|
.tic = NULL,
|
||||||
|
|
||||||
.window = NULL,
|
.window = NULL,
|
||||||
.renderer = NULL,
|
.renderer = NULL,
|
||||||
.texture = NULL,
|
.texture = NULL,
|
||||||
|
@ -205,7 +205,7 @@ static struct
|
||||||
.prevMode = TIC_CODE_MODE,
|
.prevMode = TIC_CODE_MODE,
|
||||||
.dialogMode = TIC_CONSOLE_MODE,
|
.dialogMode = TIC_CONSOLE_MODE,
|
||||||
|
|
||||||
.mouse =
|
.mouse =
|
||||||
{
|
{
|
||||||
.cursor = {-1, -1},
|
.cursor = {-1, -1},
|
||||||
.button = 0,
|
.button = 0,
|
||||||
|
@ -221,11 +221,11 @@ static struct
|
||||||
},
|
},
|
||||||
|
|
||||||
.keyboard = NULL,
|
.keyboard = NULL,
|
||||||
.keycodes =
|
.keycodes =
|
||||||
{
|
{
|
||||||
SDL_SCANCODE_UP,
|
SDL_SCANCODE_UP,
|
||||||
SDL_SCANCODE_DOWN,
|
SDL_SCANCODE_DOWN,
|
||||||
SDL_SCANCODE_LEFT,
|
SDL_SCANCODE_LEFT,
|
||||||
SDL_SCANCODE_RIGHT,
|
SDL_SCANCODE_RIGHT,
|
||||||
|
|
||||||
SDL_SCANCODE_Z, // a
|
SDL_SCANCODE_Z, // a
|
||||||
|
@ -233,26 +233,26 @@ static struct
|
||||||
SDL_SCANCODE_A, // x
|
SDL_SCANCODE_A, // x
|
||||||
SDL_SCANCODE_S, // y
|
SDL_SCANCODE_S, // y
|
||||||
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
},
|
},
|
||||||
|
|
||||||
.gamepad =
|
.gamepad =
|
||||||
{
|
{
|
||||||
.show = false,
|
.show = false,
|
||||||
},
|
},
|
||||||
|
|
||||||
.popup =
|
.popup =
|
||||||
{
|
{
|
||||||
.counter = 0,
|
.counter = 0,
|
||||||
.message = "\0",
|
.message = "\0",
|
||||||
},
|
},
|
||||||
|
|
||||||
.tooltip =
|
.tooltip =
|
||||||
{
|
{
|
||||||
.text = "\0",
|
.text = "\0",
|
||||||
},
|
},
|
||||||
|
|
||||||
.video =
|
.video =
|
||||||
{
|
{
|
||||||
.record = false,
|
.record = false,
|
||||||
.buffer = NULL,
|
.buffer = NULL,
|
||||||
|
@ -278,10 +278,10 @@ static void md5(const void* voidData, s32 length, u8* digest)
|
||||||
|
|
||||||
const u8* data = voidData;
|
const u8* data = voidData;
|
||||||
|
|
||||||
MD5_CTX c;
|
MD5_CTX c;
|
||||||
MD5_Init(&c);
|
MD5_Init(&c);
|
||||||
|
|
||||||
while (length > 0)
|
while (length > 0)
|
||||||
{
|
{
|
||||||
MD5_Update(&c, data, length > Size ? Size: length);
|
MD5_Update(&c, data, length > Size ? Size: length);
|
||||||
|
|
||||||
|
@ -331,13 +331,13 @@ void toClipboard(const void* data, s32 size, bool flip)
|
||||||
{
|
{
|
||||||
char tmp = ptr[0];
|
char tmp = ptr[0];
|
||||||
ptr[0] = ptr[1];
|
ptr[0] = ptr[1];
|
||||||
ptr[1] = tmp;
|
ptr[1] = tmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_SetClipboardText(clipboard);
|
SDL_SetClipboardText(clipboard);
|
||||||
SDL_free(clipboard);
|
SDL_free(clipboard);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,7 +357,7 @@ void str2buf(const char* str, void* buf, bool flip)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
val[2] = *ptr++;
|
val[2] = *ptr++;
|
||||||
val[3] = *ptr++;
|
val[3] = *ptr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -383,7 +383,7 @@ bool fromClipboard(void* data, s32 size, bool flip)
|
||||||
|
|
||||||
return valid;
|
return valid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -394,7 +394,7 @@ void showTooltip(const char* text)
|
||||||
strcpy(studio.tooltip.text, text);
|
strcpy(studio.tooltip.text, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const EditorMode Modes[] =
|
static const EditorMode Modes[] =
|
||||||
{
|
{
|
||||||
TIC_CODE_MODE,
|
TIC_CODE_MODE,
|
||||||
TIC_SPRITE_MODE,
|
TIC_SPRITE_MODE,
|
||||||
|
@ -610,7 +610,7 @@ void drawToolbar(tic_mem* tic, u8 color, bool bg)
|
||||||
"MUSIC EDITOR",
|
"MUSIC EDITOR",
|
||||||
};
|
};
|
||||||
|
|
||||||
if(mode >= 0)
|
if(mode >= 0)
|
||||||
{
|
{
|
||||||
if(strlen(studio.tooltip.text))
|
if(strlen(studio.tooltip.text))
|
||||||
{
|
{
|
||||||
|
@ -682,7 +682,7 @@ void exitStudio()
|
||||||
{
|
{
|
||||||
if(studio.mode != TIC_START_MODE && studioCartChanged())
|
if(studio.mode != TIC_START_MODE && studioCartChanged())
|
||||||
{
|
{
|
||||||
static const char* Rows[] =
|
static const char* Rows[] =
|
||||||
{
|
{
|
||||||
"YOU HAVE",
|
"YOU HAVE",
|
||||||
"UNSAVED CHANGES",
|
"UNSAVED CHANGES",
|
||||||
|
@ -783,7 +783,7 @@ void setStudioMode(EditorMode mode)
|
||||||
case TIC_START_MODE:
|
case TIC_START_MODE:
|
||||||
SDL_StartTextInput();
|
SDL_StartTextInput();
|
||||||
case TIC_CONSOLE_MODE:
|
case TIC_CONSOLE_MODE:
|
||||||
case TIC_RUN_MODE:
|
case TIC_RUN_MODE:
|
||||||
case TIC_KEYMAP_MODE:
|
case TIC_KEYMAP_MODE:
|
||||||
case TIC_DIALOG_MODE:
|
case TIC_DIALOG_MODE:
|
||||||
case TIC_MENU_MODE:
|
case TIC_MENU_MODE:
|
||||||
|
@ -800,8 +800,8 @@ void setStudioMode(EditorMode mode)
|
||||||
case TIC_RUN_MODE: initRunMode(); break;
|
case TIC_RUN_MODE: initRunMode(); break;
|
||||||
case TIC_SURF_MODE: studio.surf.resume(&studio.surf); break;
|
case TIC_SURF_MODE: studio.surf.resume(&studio.surf); break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
studio.mode = mode;
|
studio.mode = mode;
|
||||||
|
|
||||||
if(prev == TIC_RUN_MODE)
|
if(prev == TIC_RUN_MODE)
|
||||||
|
@ -809,7 +809,7 @@ void setStudioMode(EditorMode mode)
|
||||||
else if ((prev == TIC_MENU_MODE || prev == TIC_SURF_MODE) && studio.mode != TIC_RUN_MODE)
|
else if ((prev == TIC_MENU_MODE || prev == TIC_SURF_MODE) && studio.mode != TIC_RUN_MODE)
|
||||||
enableScreenTextInput();
|
enableScreenTextInput();
|
||||||
|
|
||||||
if(SDL_HasScreenKeyboardSupport() &&
|
if(SDL_HasScreenKeyboardSupport() &&
|
||||||
(studio.mode == TIC_RUN_MODE || studio.mode == TIC_SURF_MODE || studio.mode == TIC_MENU_MODE))
|
(studio.mode == TIC_RUN_MODE || studio.mode == TIC_SURF_MODE || studio.mode == TIC_MENU_MODE))
|
||||||
SDL_StopTextInput();
|
SDL_StopTextInput();
|
||||||
}
|
}
|
||||||
|
@ -852,8 +852,8 @@ bool checkMouseClick(const SDL_Rect* rect, s32 button)
|
||||||
{
|
{
|
||||||
MouseState* state = &studio.mouse.state[button - 1];
|
MouseState* state = &studio.mouse.state[button - 1];
|
||||||
|
|
||||||
bool value = state->click
|
bool value = state->click
|
||||||
&& SDL_PointInRect(&state->start, rect)
|
&& SDL_PointInRect(&state->start, rect)
|
||||||
&& SDL_PointInRect(&state->end, rect);
|
&& SDL_PointInRect(&state->end, rect);
|
||||||
|
|
||||||
if(value) state->click = false;
|
if(value) state->click = false;
|
||||||
|
@ -924,7 +924,7 @@ static void updateTitle()
|
||||||
if(strlen(studio.console.romName))
|
if(strlen(studio.console.romName))
|
||||||
sprintf(name, "%s [%s]", TIC_TITLE, studio.console.romName);
|
sprintf(name, "%s [%s]", TIC_TITLE, studio.console.romName);
|
||||||
|
|
||||||
SDL_SetWindowTitle(studio.window, name);
|
SDL_SetWindowTitle(studio.window, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void studioRomSaved()
|
void studioRomSaved()
|
||||||
|
@ -1088,7 +1088,7 @@ static void processTouchGamepad()
|
||||||
|
|
||||||
{
|
{
|
||||||
SDL_Rect a = {studio.gamepad.part.a.x, studio.gamepad.part.a.y, size, size};
|
SDL_Rect a = {studio.gamepad.part.a.x, studio.gamepad.part.a.y, size, size};
|
||||||
if(checkTouch(&a, &x, &y)) studio.gamepad.touch.first.a = true;
|
if(checkTouch(&a, &x, &y)) studio.gamepad.touch.first.a = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -1098,7 +1098,7 @@ static void processTouchGamepad()
|
||||||
|
|
||||||
{
|
{
|
||||||
SDL_Rect xb = {studio.gamepad.part.x.x, studio.gamepad.part.x.y, size, size};
|
SDL_Rect xb = {studio.gamepad.part.x.x, studio.gamepad.part.x.y, size, size};
|
||||||
if(checkTouch(&xb, &x, &y)) studio.gamepad.touch.first.x = true;
|
if(checkTouch(&xb, &x, &y)) studio.gamepad.touch.first.x = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -1227,7 +1227,7 @@ static void processJoysticks()
|
||||||
gamepad->data |= getJoystickHatMask(getAxisMask(joystick));
|
gamepad->data |= getJoystickHatMask(getAxisMask(joystick));
|
||||||
|
|
||||||
for (s32 h = 0; h < SDL_JoystickNumHats(joystick); h++)
|
for (s32 h = 0; h < SDL_JoystickNumHats(joystick); h++)
|
||||||
gamepad->data |= getJoystickHatMask(SDL_JoystickGetHat(joystick, h));
|
gamepad->data |= getJoystickHatMask(SDL_JoystickGetHat(joystick, h));
|
||||||
|
|
||||||
s32 numButtons = SDL_JoystickNumButtons(joystick);
|
s32 numButtons = SDL_JoystickNumButtons(joystick);
|
||||||
if(numButtons >= 2)
|
if(numButtons >= 2)
|
||||||
|
@ -1278,11 +1278,11 @@ static void processJoysticks()
|
||||||
static void processGamepad()
|
static void processGamepad()
|
||||||
{
|
{
|
||||||
studio.tic->ram.vram.input.gamepad.data = 0;
|
studio.tic->ram.vram.input.gamepad.data = 0;
|
||||||
|
|
||||||
studio.tic->ram.vram.input.gamepad.data |= studio.gamepad.keyboard.data;
|
studio.tic->ram.vram.input.gamepad.data |= studio.gamepad.keyboard.data;
|
||||||
studio.tic->ram.vram.input.gamepad.data |= studio.gamepad.touch.data;
|
studio.tic->ram.vram.input.gamepad.data |= studio.gamepad.touch.data;
|
||||||
studio.tic->ram.vram.input.gamepad.data |= studio.gamepad.joystick.data;
|
studio.tic->ram.vram.input.gamepad.data |= studio.gamepad.joystick.data;
|
||||||
studio.tic->ram.vram.input.gamepad.data &= studio.tic->ram.vram.vars.mask.data |
|
studio.tic->ram.vram.input.gamepad.data &= studio.tic->ram.vram.vars.mask.data |
|
||||||
(studio.tic->ram.vram.vars.mask.data << (sizeof(tic80_gamepad)*BITS_IN_BYTE));
|
(studio.tic->ram.vram.vars.mask.data << (sizeof(tic80_gamepad)*BITS_IN_BYTE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1351,7 +1351,7 @@ static void processMouse()
|
||||||
static void onFullscreen()
|
static void onFullscreen()
|
||||||
{
|
{
|
||||||
studio.fullscreen = !studio.fullscreen;
|
studio.fullscreen = !studio.fullscreen;
|
||||||
SDL_SetWindowFullscreen(studio.window, studio.fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0);
|
SDL_SetWindowFullscreen(studio.window, studio.fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void runProject()
|
void runProject()
|
||||||
|
@ -1373,7 +1373,7 @@ static void saveProject()
|
||||||
{
|
{
|
||||||
char buffer[FILENAME_MAX];
|
char buffer[FILENAME_MAX];
|
||||||
sprintf(buffer, "%s SAVED :)", studio.console.romName);
|
sprintf(buffer, "%s SAVED :)", studio.console.romName);
|
||||||
|
|
||||||
for(s32 i = 0; i < (s32)strlen(buffer); i++)
|
for(s32 i = 0; i < (s32)strlen(buffer); i++)
|
||||||
buffer[i] = SDL_toupper(buffer[i]);
|
buffer[i] = SDL_toupper(buffer[i]);
|
||||||
|
|
||||||
|
@ -1443,7 +1443,7 @@ static void screen2buffer(u32* buffer, const u8* pixels, s32 pitch)
|
||||||
SDL_memcpy(buffer, pixels+MAX_OFFSET * sizeof(u32), TIC80_WIDTH * sizeof(u32));
|
SDL_memcpy(buffer, pixels+MAX_OFFSET * sizeof(u32), TIC80_WIDTH * sizeof(u32));
|
||||||
pixels += pitch;
|
pixels += pitch;
|
||||||
buffer += TIC80_WIDTH;
|
buffer += TIC80_WIDTH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setCoverImage()
|
static void setCoverImage()
|
||||||
|
@ -1462,8 +1462,8 @@ static void setCoverImage()
|
||||||
if(buffer)
|
if(buffer)
|
||||||
{
|
{
|
||||||
screen2buffer(buffer, (const u8*)pixels, Pitch);
|
screen2buffer(buffer, (const u8*)pixels, Pitch);
|
||||||
|
|
||||||
gif_write_animation(studio.tic->cart.cover.data, &studio.tic->cart.cover.size,
|
gif_write_animation(studio.tic->cart.cover.data, &studio.tic->cart.cover.size,
|
||||||
TIC80_WIDTH, TIC80_HEIGHT, (const u8*)buffer, 1, TIC_FRAMERATE, 1);
|
TIC80_WIDTH, TIC80_HEIGHT, (const u8*)buffer, 1, TIC_FRAMERATE, 1);
|
||||||
|
|
||||||
SDL_free(buffer);
|
SDL_free(buffer);
|
||||||
|
@ -1545,7 +1545,7 @@ static bool processShortcuts(SDL_KeyboardEvent* event)
|
||||||
|
|
||||||
if(studio.mode == TIC_START_MODE) return true;
|
if(studio.mode == TIC_START_MODE) return true;
|
||||||
if(studio.mode == TIC_CONSOLE_MODE && !studio.console.active) return true;
|
if(studio.mode == TIC_CONSOLE_MODE && !studio.console.active) return true;
|
||||||
|
|
||||||
if(isGameMenu())
|
if(isGameMenu())
|
||||||
{
|
{
|
||||||
switch(event->keysym.sym)
|
switch(event->keysym.sym)
|
||||||
|
@ -1555,7 +1555,7 @@ static bool processShortcuts(SDL_KeyboardEvent* event)
|
||||||
studio.mode == TIC_MENU_MODE ? hideGameMenu() : showGameMenu();
|
studio.mode == TIC_MENU_MODE ? hideGameMenu() : showGameMenu();
|
||||||
studio.gamepad.backProcessed = true;
|
studio.gamepad.backProcessed = true;
|
||||||
return true;
|
return true;
|
||||||
case SDLK_F11:
|
case SDLK_F11:
|
||||||
onFullscreen();
|
onFullscreen();
|
||||||
return true;
|
return true;
|
||||||
case SDLK_RETURN:
|
case SDLK_RETURN:
|
||||||
|
@ -1565,14 +1565,14 @@ static bool processShortcuts(SDL_KeyboardEvent* event)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDLK_F7:
|
case SDLK_F7:
|
||||||
setCoverImage();
|
setCoverImage();
|
||||||
return true;
|
return true;
|
||||||
case SDLK_F8:
|
case SDLK_F8:
|
||||||
takeScreenshot();
|
takeScreenshot();
|
||||||
return true;
|
return true;
|
||||||
#if !defined(__EMSCRIPTEN__)
|
#if !defined(__EMSCRIPTEN__)
|
||||||
case SDLK_F9:
|
case SDLK_F9:
|
||||||
startVideoRecord();
|
startVideoRecord();
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1591,7 +1591,7 @@ static bool processShortcuts(SDL_KeyboardEvent* event)
|
||||||
case SDLK_3: setStudioMode(TIC_MAP_MODE); return true;
|
case SDLK_3: setStudioMode(TIC_MAP_MODE); return true;
|
||||||
case SDLK_4: setStudioMode(TIC_SFX_MODE); return true;
|
case SDLK_4: setStudioMode(TIC_SFX_MODE); return true;
|
||||||
case SDLK_5: setStudioMode(TIC_MUSIC_MODE); return true;
|
case SDLK_5: setStudioMode(TIC_MUSIC_MODE); return true;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1608,8 +1608,8 @@ static bool processShortcuts(SDL_KeyboardEvent* event)
|
||||||
#if !defined(__EMSCRIPTEN__)
|
#if !defined(__EMSCRIPTEN__)
|
||||||
case SDLK_F9: startVideoRecord(); return true;
|
case SDLK_F9: startVideoRecord(); return true;
|
||||||
#endif
|
#endif
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(event->keysym.sym)
|
switch(event->keysym.sym)
|
||||||
|
@ -1686,7 +1686,7 @@ static void processGamepadInput()
|
||||||
static void processMouseInput()
|
static void processMouseInput()
|
||||||
{
|
{
|
||||||
processJoysticksWithMouseInput();
|
processJoysticksWithMouseInput();
|
||||||
|
|
||||||
s32 x = studio.mouse.cursor.x;
|
s32 x = studio.mouse.cursor.x;
|
||||||
s32 y = studio.mouse.cursor.y;
|
s32 y = studio.mouse.cursor.y;
|
||||||
|
|
||||||
|
@ -1698,7 +1698,7 @@ static void processMouseInput()
|
||||||
studio.tic->ram.vram.input.gamepad.mouse = x + y * TIC80_WIDTH;
|
studio.tic->ram.vram.input.gamepad.mouse = x + y * TIC80_WIDTH;
|
||||||
studio.tic->ram.vram.input.gamepad.pressed = studio.mouse.state->down ? 1 : 0;
|
studio.tic->ram.vram.input.gamepad.pressed = studio.mouse.state->down ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_Event* pollEvent()
|
SDL_Event* pollEvent()
|
||||||
{
|
{
|
||||||
static SDL_Event event;
|
static SDL_Event event;
|
||||||
|
@ -1739,6 +1739,13 @@ SDL_Event* pollEvent()
|
||||||
switch(event.window.event)
|
switch(event.window.event)
|
||||||
{
|
{
|
||||||
case SDL_WINDOWEVENT_RESIZED: updateGamepadParts(); break;
|
case SDL_WINDOWEVENT_RESIZED: updateGamepadParts(); break;
|
||||||
|
case SDL_WINDOWEVENT_FOCUS_GAINED:
|
||||||
|
{
|
||||||
|
studio.console.codeLiveReload.reload(&studio.console,studio.code.data);
|
||||||
|
if(studio.code.update)
|
||||||
|
studio.code.update(&studio.code);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SDL_FINGERUP:
|
case SDL_FINGERUP:
|
||||||
|
@ -1767,7 +1774,7 @@ SDL_Event* pollEvent()
|
||||||
case tic_gamepad_input:
|
case tic_gamepad_input:
|
||||||
processGamepadInput();
|
processGamepadInput();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case tic_mouse_input:
|
case tic_mouse_input:
|
||||||
processMouseInput();
|
processMouseInput();
|
||||||
break;
|
break;
|
||||||
|
@ -1804,7 +1811,7 @@ static void transparentBlit(u32* out, s32 pitch)
|
||||||
{
|
{
|
||||||
col = 0;
|
col = 0;
|
||||||
out += Delta;
|
out += Delta;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1831,7 +1838,7 @@ static void blitSound()
|
||||||
|
|
||||||
static void drawRecordLabel(u8* frame, s32 pitch, s32 sx, s32 sy, const u32* color)
|
static void drawRecordLabel(u8* frame, s32 pitch, s32 sx, s32 sy, const u32* color)
|
||||||
{
|
{
|
||||||
static const u16 RecLabel[] =
|
static const u16 RecLabel[] =
|
||||||
{
|
{
|
||||||
0b0111001100110011,
|
0b0111001100110011,
|
||||||
0b1111101010100100,
|
0b1111101010100100,
|
||||||
|
@ -1839,14 +1846,14 @@ static void drawRecordLabel(u8* frame, s32 pitch, s32 sx, s32 sy, const u32* col
|
||||||
0b1111101010100100,
|
0b1111101010100100,
|
||||||
0b0111001010110011,
|
0b0111001010110011,
|
||||||
};
|
};
|
||||||
|
|
||||||
for(s32 y = 0; y < 5; y++)
|
for(s32 y = 0; y < 5; y++)
|
||||||
{
|
{
|
||||||
for(s32 x = 0; x < sizeof RecLabel[0]*BITS_IN_BYTE; x++)
|
for(s32 x = 0; x < sizeof RecLabel[0]*BITS_IN_BYTE; x++)
|
||||||
{
|
{
|
||||||
if(RecLabel[y] & (1 << x))
|
if(RecLabel[y] & (1 << x))
|
||||||
memcpy(&frame[((MAX_OFFSET + sx) + 15 - x + (y+sy)*(pitch/4))*4], color, sizeof *color);
|
memcpy(&frame[((MAX_OFFSET + sx) + 15 - x + (y+sy)*(pitch/4))*4], color, sizeof *color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1861,11 +1868,11 @@ static void recordFrame(u8* pixels, s32 pitch)
|
||||||
if(studio.video.frame % TIC_FRAMERATE < TIC_FRAMERATE / 2)
|
if(studio.video.frame % TIC_FRAMERATE < TIC_FRAMERATE / 2)
|
||||||
{
|
{
|
||||||
const u32* pal = srcPaletteBlit(studio.tic->config.palette.data);
|
const u32* pal = srcPaletteBlit(studio.tic->config.palette.data);
|
||||||
drawRecordLabel(pixels, pitch, TIC80_WIDTH-24, 8, &pal[tic_color_red]);
|
drawRecordLabel(pixels, pitch, TIC80_WIDTH-24, 8, &pal[tic_color_red]);
|
||||||
}
|
}
|
||||||
|
|
||||||
studio.video.frame++;
|
studio.video.frame++;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1912,7 +1919,7 @@ static void blitTexture()
|
||||||
|
|
||||||
{
|
{
|
||||||
SDL_Rect srcRect = {0, 0, FULL_WIDTH, TIC80_HEIGHT};
|
SDL_Rect srcRect = {0, 0, FULL_WIDTH, TIC80_HEIGHT};
|
||||||
SDL_RenderCopy(studio.renderer, studio.texture, &srcRect, &rect);
|
SDL_RenderCopy(studio.renderer, studio.texture, &srcRect, &rect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1972,7 +1979,7 @@ static void blitCursor(const u8* in)
|
||||||
|
|
||||||
static void renderCursor()
|
static void renderCursor()
|
||||||
{
|
{
|
||||||
if(studio.mode == TIC_RUN_MODE &&
|
if(studio.mode == TIC_RUN_MODE &&
|
||||||
studio.tic->input == tic_mouse_input &&
|
studio.tic->input == tic_mouse_input &&
|
||||||
studio.tic->ram.vram.vars.cursor)
|
studio.tic->ram.vram.vars.cursor)
|
||||||
{
|
{
|
||||||
|
@ -2014,7 +2021,7 @@ static void renderStudio()
|
||||||
src = &studio.tic->cart.sound;
|
src = &studio.tic->cart.sound;
|
||||||
}
|
}
|
||||||
|
|
||||||
studio.tic->api.tick_start(studio.tic, src);
|
studio.tic->api.tick_start(studio.tic, src);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(studio.mode)
|
switch(studio.mode)
|
||||||
|
@ -2040,7 +2047,7 @@ static void renderStudio()
|
||||||
studio.popup.counter--;
|
studio.popup.counter--;
|
||||||
|
|
||||||
studio.tic->api.rect(studio.tic, 0, TIC80_HEIGHT - TIC_FONT_HEIGHT - 1, TIC80_WIDTH, TIC80_HEIGHT, systemColor(tic_color_red));
|
studio.tic->api.rect(studio.tic, 0, TIC80_HEIGHT - TIC_FONT_HEIGHT - 1, TIC80_WIDTH, TIC80_HEIGHT, systemColor(tic_color_red));
|
||||||
studio.tic->api.text(studio.tic, studio.popup.message, (s32)(TIC80_WIDTH - strlen(studio.popup.message)*TIC_FONT_WIDTH)/2,
|
studio.tic->api.text(studio.tic, studio.popup.message, (s32)(TIC80_WIDTH - strlen(studio.popup.message)*TIC_FONT_WIDTH)/2,
|
||||||
TIC80_HEIGHT - TIC_FONT_HEIGHT, systemColor(tic_color_white));
|
TIC80_HEIGHT - TIC_FONT_HEIGHT, systemColor(tic_color_white));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2087,7 +2094,7 @@ static void renderGamepad()
|
||||||
const s32 tileSize = studio.gamepad.part.size;
|
const s32 tileSize = studio.gamepad.part.size;
|
||||||
const SDL_Point axis = studio.gamepad.part.axis;
|
const SDL_Point axis = studio.gamepad.part.axis;
|
||||||
typedef struct { bool press; s32 x; s32 y;} Tile;
|
typedef struct { bool press; s32 x; s32 y;} Tile;
|
||||||
const Tile Tiles[] =
|
const Tile Tiles[] =
|
||||||
{
|
{
|
||||||
{studio.tic->ram.vram.input.gamepad.first.up, axis.x + 1*tileSize, axis.y + 0*tileSize},
|
{studio.tic->ram.vram.input.gamepad.first.up, axis.x + 1*tileSize, axis.y + 0*tileSize},
|
||||||
{studio.tic->ram.vram.input.gamepad.first.down, axis.x + 1*tileSize, axis.y + 2*tileSize},
|
{studio.tic->ram.vram.input.gamepad.first.down, axis.x + 1*tileSize, axis.y + 2*tileSize},
|
||||||
|
@ -2171,7 +2178,7 @@ static void tick()
|
||||||
|
|
||||||
static void initSound()
|
static void initSound()
|
||||||
{
|
{
|
||||||
SDL_AudioSpec want =
|
SDL_AudioSpec want =
|
||||||
{
|
{
|
||||||
.freq = 44100,
|
.freq = 44100,
|
||||||
.format = AUDIO_S16,
|
.format = AUDIO_S16,
|
||||||
|
@ -2202,7 +2209,7 @@ static void initTouchGamepad()
|
||||||
|
|
||||||
if(!studio.gamepad.texture)
|
if(!studio.gamepad.texture)
|
||||||
{
|
{
|
||||||
studio.gamepad.texture = SDL_CreateTexture(studio.renderer, STUDIO_PIXEL_FORMAT, SDL_TEXTUREACCESS_STREAMING,
|
studio.gamepad.texture = SDL_CreateTexture(studio.renderer, STUDIO_PIXEL_FORMAT, SDL_TEXTUREACCESS_STREAMING,
|
||||||
textureLog2(TIC80_WIDTH), textureLog2(TIC80_HEIGHT));
|
textureLog2(TIC80_WIDTH), textureLog2(TIC80_HEIGHT));
|
||||||
SDL_SetTextureBlendMode(studio.gamepad.texture, SDL_BLENDMODE_BLEND);
|
SDL_SetTextureBlendMode(studio.gamepad.texture, SDL_BLENDMODE_BLEND);
|
||||||
}
|
}
|
||||||
|
@ -2255,8 +2262,8 @@ static void setWindowIcon()
|
||||||
pixels[index] = color == ColorKey ? 0 : pal[color];
|
pixels[index] = color == ColorKey ? 0 : pal[color];
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_Surface* surface = SDL_CreateRGBSurfaceFrom(pixels, Size, Size,
|
SDL_Surface* surface = SDL_CreateRGBSurfaceFrom(pixels, Size, Size,
|
||||||
sizeof(s32) * BITS_IN_BYTE, Size * sizeof(s32),
|
sizeof(s32) * BITS_IN_BYTE, Size * sizeof(s32),
|
||||||
0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000);
|
0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000);
|
||||||
|
|
||||||
SDL_SetWindowIcon(studio.window, surface);
|
SDL_SetWindowIcon(studio.window, surface);
|
||||||
|
@ -2301,13 +2308,13 @@ static void onFSInitialized(FileSystem* fs)
|
||||||
|
|
||||||
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK);
|
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK);
|
||||||
|
|
||||||
studio.window = SDL_CreateWindow( TIC_TITLE, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
|
studio.window = SDL_CreateWindow( TIC_TITLE, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
|
||||||
(TIC80_WIDTH+STUDIO_UI_BORDER) * STUDIO_UI_SCALE,
|
(TIC80_WIDTH+STUDIO_UI_BORDER) * STUDIO_UI_SCALE,
|
||||||
(TIC80_HEIGHT+STUDIO_UI_BORDER) * STUDIO_UI_SCALE,
|
(TIC80_HEIGHT+STUDIO_UI_BORDER) * STUDIO_UI_SCALE,
|
||||||
SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE
|
SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE
|
||||||
#if defined(__ARM_LINUX__)
|
#if defined(__ARM_LINUX__)
|
||||||
| SDL_WINDOW_FULLSCREEN_DESKTOP
|
| SDL_WINDOW_FULLSCREEN_DESKTOP
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
initSound();
|
initSound();
|
||||||
|
@ -2343,14 +2350,14 @@ static void onFSInitialized(FileSystem* fs)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
studio.renderer = SDL_CreateRenderer(studio.window, -1, renderFlags);
|
studio.renderer = SDL_CreateRenderer(studio.window, -1, renderFlags);
|
||||||
studio.texture = SDL_CreateTexture(studio.renderer, STUDIO_PIXEL_FORMAT, SDL_TEXTUREACCESS_STREAMING,
|
studio.texture = SDL_CreateTexture(studio.renderer, STUDIO_PIXEL_FORMAT, SDL_TEXTUREACCESS_STREAMING,
|
||||||
textureLog2(FULL_WIDTH), textureLog2(TIC80_HEIGHT));
|
textureLog2(FULL_WIDTH), textureLog2(TIC80_HEIGHT));
|
||||||
|
|
||||||
#if !defined(__ARM_LINUX__)
|
#if !defined(__ARM_LINUX__)
|
||||||
SDL_SetTextureBlendMode(studio.texture, SDL_BLENDMODE_BLEND);
|
SDL_SetTextureBlendMode(studio.texture, SDL_BLENDMODE_BLEND);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
studio.borderTexture = SDL_CreateTexture(studio.renderer, STUDIO_PIXEL_FORMAT, SDL_TEXTUREACCESS_STREAMING,
|
studio.borderTexture = SDL_CreateTexture(studio.renderer, STUDIO_PIXEL_FORMAT, SDL_TEXTUREACCESS_STREAMING,
|
||||||
textureLog2(TIC80_WIDTH), textureLog2(TIC80_HEIGHT));
|
textureLog2(TIC80_WIDTH), textureLog2(TIC80_HEIGHT));
|
||||||
|
|
||||||
initTouchGamepad();
|
initTouchGamepad();
|
||||||
|
@ -2400,19 +2407,19 @@ s32 main(s32 argc, char **argv)
|
||||||
u64 nextTick = SDL_GetPerformanceCounter();
|
u64 nextTick = SDL_GetPerformanceCounter();
|
||||||
const u64 Delta = SDL_GetPerformanceFrequency() / TIC_FRAMERATE;
|
const u64 Delta = SDL_GetPerformanceFrequency() / TIC_FRAMERATE;
|
||||||
|
|
||||||
while (!studio.quitFlag)
|
while (!studio.quitFlag)
|
||||||
{
|
{
|
||||||
nextTick += Delta;
|
nextTick += Delta;
|
||||||
tick();
|
tick();
|
||||||
|
|
||||||
s64 delay = nextTick - SDL_GetPerformanceCounter();
|
s64 delay = nextTick - SDL_GetPerformanceCounter();
|
||||||
|
|
||||||
if(delay > 0)
|
if(delay > 0)
|
||||||
SDL_Delay((u32)(delay * 1000 / SDL_GetPerformanceFrequency()));
|
SDL_Delay((u32)(delay * 1000 / SDL_GetPerformanceFrequency()));
|
||||||
else nextTick -= delay;
|
else nextTick -= delay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(studio.tic80local)
|
if(studio.tic80local)
|
||||||
|
@ -2420,7 +2427,7 @@ s32 main(s32 argc, char **argv)
|
||||||
|
|
||||||
if(studio.floatSamples)
|
if(studio.floatSamples)
|
||||||
SDL_free(studio.floatSamples);
|
SDL_free(studio.floatSamples);
|
||||||
|
|
||||||
SDL_DestroyTexture(studio.gamepad.texture);
|
SDL_DestroyTexture(studio.gamepad.texture);
|
||||||
SDL_DestroyTexture(studio.texture);
|
SDL_DestroyTexture(studio.texture);
|
||||||
SDL_DestroyTexture(studio.borderTexture);
|
SDL_DestroyTexture(studio.borderTexture);
|
||||||
|
@ -2436,7 +2443,7 @@ s32 main(s32 argc, char **argv)
|
||||||
SDL_CloseAudioDevice(studio.audioDevice);
|
SDL_CloseAudioDevice(studio.audioDevice);
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SDLNet_Quit();
|
SDLNet_Quit();
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue