no message

This commit is contained in:
BADIM-PC\Vadim 2017-11-08 15:31:56 +03:00
parent a726b30d84
commit c18505b4d0
3 changed files with 44 additions and 33 deletions

View File

@ -1349,22 +1349,30 @@ static void onConsoleExportHtmlCommand(Console* console, const char* name)
static void* embedCart(Console* console, s32* size) static void* embedCart(Console* console, s32* size)
{ {
void* data = fsReadFile(console->appPath, size); tic_mem* tic = console->tic;
if(data) if(processDoFile())
{ {
void* start = memmem(data, *size, embed.prefix, sizeof(embed.prefix)); void* data = fsReadFile(console->appPath, size);
if(start) if(data)
{ {
embed.yes = true; void* start = memmem(data, *size, embed.prefix, sizeof(embed.prefix));
memcpy(&embed.file, &console->tic->cart, sizeof(tic_cartridge));
memcpy(start, &embed, sizeof(embed)); if(start)
embed.yes = false; {
embed.yes = true;
SDL_memcpy(&embed.file, &tic->cart, sizeof(tic_cartridge));
SDL_memcpy(embed.file.code.data, tic->code.data, sizeof(tic_code));
SDL_memcpy(start, &embed, sizeof(embed));
embed.yes = false;
}
} }
return data;
} }
return data; return NULL;
} }
#if defined(__WINDOWS__) #if defined(__WINDOWS__)

View File

@ -89,8 +89,6 @@ static const char* getPMemName(Run* run)
static void tick(Run* run) static void tick(Run* run)
{ {
// tic_mem* tic = run->tic;
while(pollEvent()); while(pollEvent());
if (getStudioMode() != TIC_RUN_MODE) if (getStudioMode() != TIC_RUN_MODE)
@ -98,7 +96,7 @@ static void tick(Run* run)
if(!run->init) if(!run->init)
{ {
if(processDoFile()) if(!processDoFile())
return; return;
run->tickData.start = run->tickData.counter(), run->tickData.start = run->tickData.counter(),

View File

@ -1411,6 +1411,11 @@ static void api_tick(tic_mem* memory, tic_tick_data* data)
else if(!initLua(machine, code)) else if(!initLua(machine, code))
return; return;
} }
else
{
machine->data->error(machine->data->data, "the code is empty");
return;
}
machine->state.scanline = memory->script == tic_script_js ? callJavascriptScanline : callLuaScanline; machine->state.scanline = memory->script == tic_script_js ? callJavascriptScanline : callLuaScanline;
machine->state.initialized = true; machine->state.initialized = true;
@ -1582,28 +1587,28 @@ static s32 api_save(const tic_cartridge* cart, u8* buffer)
inline void memset4(void *dst, u32 val, u32 dwords) inline void memset4(void *dst, u32 val, u32 dwords)
{ {
#if defined(__GNUC__) && defined(i386) #if defined(__GNUC__) && defined(i386)
s32 u0, u1, u2; s32 u0, u1, u2;
__asm__ __volatile__ ( __asm__ __volatile__ (
"cld \n\t" "cld \n\t"
"rep ; stosl \n\t" "rep ; stosl \n\t"
: "=&D" (u0), "=&a" (u1), "=&c" (u2) : "=&D" (u0), "=&a" (u1), "=&c" (u2)
: "0" (dst), "1" (val), "2" (dwords) : "0" (dst), "1" (val), "2" (dwords)
: "memory" : "memory"
); );
#else #else
u32 _n = (dwords + 3) / 4; u32 _n = (dwords + 3) / 4;
u32 *_p = (u32*)dst; u32 *_p = (u32*)dst;
u32 _val = (val); u32 _val = (val);
if (dwords == 0) if (dwords == 0)
return; return;
switch (dwords % 4) switch (dwords % 4)
{ {
case 0: do { *_p++ = _val; case 0: do { *_p++ = _val;
case 3: *_p++ = _val; case 3: *_p++ = _val;
case 2: *_p++ = _val; case 2: *_p++ = _val;
case 1: *_p++ = _val; case 1: *_p++ = _val;
} while ( --_n ); } while ( --_n );
} }
#endif #endif
} }