no message

This commit is contained in:
BADIM-PC\Vadim 2018-02-14 16:22:33 +03:00
parent 670c650120
commit 631fd03dd8
7 changed files with 33 additions and 30 deletions

View File

@ -35,6 +35,10 @@
#include <lauxlib.h> #include <lauxlib.h>
#include <lualib.h> #include <lualib.h>
#if defined(__EMSCRIPTEN__)
#include <emscripten.h>
#endif
#define CONSOLE_CURSOR_COLOR ((tic_color_red)) #define CONSOLE_CURSOR_COLOR ((tic_color_red))
#define CONSOLE_BACK_TEXT_COLOR ((tic_color_dark_gray)) #define CONSOLE_BACK_TEXT_COLOR ((tic_color_dark_gray))
#define CONSOLE_FRONT_TEXT_COLOR ((tic_color_white)) #define CONSOLE_FRONT_TEXT_COLOR ((tic_color_white))
@ -54,7 +58,7 @@ typedef enum
WrenScript, WrenScript,
} ScriptLang; } ScriptLang;
#if defined(__TIC_WINDOWS__) || defined(__LINUX__) || defined(__MACOSX__) #if defined(__TIC_WINDOWS__) || defined(__TIC_LINUX__) || defined(__TIC_MACOSX__)
#define CAN_EXPORT 1 #define CAN_EXPORT 1
#endif #endif
@ -1644,9 +1648,7 @@ static void onConsoleExportCommand(Console* console, const char* param)
#else #else
#if !defined(__ANDROID__) && !defined(__MACOSX__) && !defined(__LINUX__) static void *ticMemmem(const void* haystack, size_t hlen, const void* needle, size_t nlen)
static void *memmem(const void* haystack, size_t hlen, const void* needle, size_t nlen)
{ {
const u8* p = haystack; const u8* p = haystack;
size_t plen = hlen; size_t plen = hlen;
@ -1667,8 +1669,6 @@ static void *memmem(const void* haystack, size_t hlen, const void* needle, size_
return NULL; return NULL;
} }
#endif
typedef struct typedef struct
{ {
Console* console; Console* console;
@ -1722,7 +1722,7 @@ static void onConsoleExportHtmlCommand(Console* console, const char* name)
u8* EmbedTicJs = NULL; u8* EmbedTicJs = NULL;
u32 EmbedTicJsSize = unzip(&EmbedTicJs, EmbedTicJsZip, EmbedTicJsZipSize); u32 EmbedTicJsSize = unzip(&EmbedTicJs, EmbedTicJsZip, EmbedTicJsZipSize);
u8* ptr = memmem(EmbedIndex, EmbedIndexSize, Placeholder, sizeof(Placeholder)-1); u8* ptr = ticMemmem(EmbedIndex, EmbedIndexSize, Placeholder, sizeof(Placeholder)-1);
if(ptr) if(ptr)
{ {
@ -2363,13 +2363,7 @@ static void onConsoleHelpCommand(Console* console, const char* param)
} }
printBack(console, "\npress "); printBack(console, "\npress ");
#if defined(__ANDROID__)
printFront(console, "BACK");
#else
printFront(console, "ESC"); printFront(console, "ESC");
#endif
printBack(console, " to enter UI mode\n"); printBack(console, " to enter UI mode\n");
commandDone(console); commandDone(console);
@ -3108,7 +3102,7 @@ void initConsole(Console* console, tic_mem* tic, FileSystem* fs, Config* config,
while(true) while(true)
{ {
const EmbedHeader* header = (const EmbedHeader*)memmem(ptr, size, TicCartSig, SIG_SIZE); const EmbedHeader* header = (const EmbedHeader*)ticMemmem(ptr, size, TicCartSig, SIG_SIZE);
if(header) if(header)
{ {

View File

@ -165,6 +165,8 @@ int _wremove(const wchar_t *);
#endif #endif
#if !defined(__EMSCRIPTEN__)
typedef struct typedef struct
{ {
ListCallback callback; ListCallback callback;
@ -286,6 +288,8 @@ static void netDirRequest(const char* path, ListCallback callback, void* data)
onDirResponse(buffer, size, &netDirData); onDirResponse(buffer, size, &netDirData);
} }
#endif
void fsEnumFiles(FileSystem* fs, ListCallback callback, void* data) void fsEnumFiles(FileSystem* fs, ListCallback callback, void* data)
{ {
#if !defined(__EMSCRIPTEN__) #if !defined(__EMSCRIPTEN__)

View File

@ -155,16 +155,6 @@ static void processDoFile(void* data, char* dst)
return; return;
} }
static void preseed()
{
#if defined(__MACOSX__)
srandom(time(NULL));
random();
#else
srand(time(NULL));
rand();
#endif
}
static bool forceExit(void* data) static bool forceExit(void* data)
{ {
@ -213,5 +203,5 @@ void initRun(Run* run, Console* console, tic_mem* tic)
if(data) free(data); if(data) free(data);
} }
preseed(); getSystem()->preseed();
} }

View File

@ -27,10 +27,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#if defined(__EMSCRIPTEN__)
#include <emscripten.h>
#endif
#include "tic.h" #include "tic.h"
#include "ticapi.h" #include "ticapi.h"
#include "defines.h" #include "defines.h"

View File

@ -37,7 +37,7 @@
#define COVER_Y 5 #define COVER_Y 5
#define COVER_X (TIC80_WIDTH - COVER_WIDTH - COVER_Y) #define COVER_X (TIC80_WIDTH - COVER_WIDTH - COVER_Y)
#if defined(__TIC_WINDOWS__) || defined(__LINUX__) || defined(__MACOSX__) #if defined(__TIC_WINDOWS__) || defined(__TIC_LINUX__) || defined(__TIC_MACOSX__)
#define CAN_OPEN_URL 1 #define CAN_OPEN_URL 1
#endif #endif

View File

@ -4,8 +4,13 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <time.h>
#include <SDL.h> #include <SDL.h>
#if defined(__EMSCRIPTEN__)
#include <emscripten.h>
#endif
#define STUDIO_UI_SCALE 3 #define STUDIO_UI_SCALE 3
#define STUDIO_PIXEL_FORMAT SDL_PIXELFORMAT_ARGB8888 #define STUDIO_PIXEL_FORMAT SDL_PIXELFORMAT_ARGB8888
#define TEXTURE_SIZE (TIC80_FULLWIDTH) #define TEXTURE_SIZE (TIC80_FULLWIDTH)
@ -967,6 +972,17 @@ static void* getUrlRequest(const char* url, s32* size)
return netGetRequest(platform.net, url, size); return netGetRequest(platform.net, url, size);
} }
static void preseed()
{
#if defined(__MACOSX__)
srandom(time(NULL));
random();
#else
srand(time(NULL));
rand();
#endif
}
static System systemInterface = static System systemInterface =
{ {
.setClipboardText = setClipboardText, .setClipboardText = setClipboardText,
@ -985,6 +1001,7 @@ static System systemInterface =
.setWindowTitle = setWindowTitle, .setWindowTitle = setWindowTitle,
.openSystemPath = openSystemPath, .openSystemPath = openSystemPath,
.preseed = preseed,
}; };
#if defined(__EMSCRIPTEN__) #if defined(__EMSCRIPTEN__)

View File

@ -21,6 +21,8 @@ typedef struct
void (*setWindowTitle)(const char* title); void (*setWindowTitle)(const char* title);
void (*openSystemPath)(const char* path); void (*openSystemPath)(const char* path);
void (*preseed)();
} System; } System;