TIC as single exe without dlls

This commit is contained in:
BADIM-PC\Vadim
2017-12-22 18:26:03 +03:00
parent de7557e4f9
commit f78397ffea
5 changed files with 16 additions and 132 deletions

View File

@@ -1828,86 +1828,6 @@ static void* embedCart(Console* console, s32* size)
return data;
}
#if defined(__WINDOWS__)
static const char* getFileFolder(const char* path)
{
static char folder[FILENAME_MAX];
const char* pos = strrchr(path, '\\');
if(!pos)
pos = strrchr(path, '/');
if(pos)
{
s32 size = pos - path;
memcpy(folder, path, size);
folder[size] = 0;
return folder;
}
return NULL;
}
static bool exportToFolder(Console* console, const char* folder, const char* file)
{
const char* workFolder = getFileFolder(console->appPath);
if(workFolder)
{
char src[FILENAME_MAX];
strcpy(src, workFolder);
strcat(src, file);
char dst[FILENAME_MAX];
strcpy(dst, folder);
strcat(dst, file);
return fsCopyFile(src, dst);
}
return false;
}
static void onConsoleExportNativeCommand(Console* console, const char* cartName)
{
const char* folder = folder_dialog(console);
bool done = false;
if(folder)
{
s32 size = 0;
void* data = embedCart(console, &size);
if(data)
{
char path[FILENAME_MAX];
strcpy(path, folder);
strcat(path, "\\game.exe");
done = fsWriteFile(path, data, size);
SDL_free(data);
}
else
{
printBack(console, "\ngame exporting error :(");
}
}
if(done && exportToFolder(console, folder, "\\tic80.dll") &&
exportToFolder(console, folder, "\\SDL2.dll"))
printBack(console, "\ngame exported :)");
else printBack(console, "\ngame not exported :|");
commandDone(console);
}
#else
static void onConsoleExportNativeCommand(Console* console, const char* cartName)
{
s32 size = 0;
@@ -1923,9 +1843,6 @@ static void onConsoleExportNativeCommand(Console* console, const char* cartName)
}
}
#endif
#endif
static const char* getExportName(Console* console, bool html)