REVIEWED: CORE.Storage.basePath
Simplified some code
This commit is contained in:
parent
46ad7b87e8
commit
953882e86f
1 changed files with 50 additions and 80 deletions
130
src/core.c
130
src/core.c
|
@ -356,7 +356,7 @@ typedef struct { unsigned int width; unsigned int height; } Size;
|
||||||
typedef struct CoreData {
|
typedef struct CoreData {
|
||||||
struct {
|
struct {
|
||||||
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB)
|
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB)
|
||||||
GLFWwindow *handle; // Native window handle (graphic device)
|
GLFWwindow *handle; // GLFW window handle (graphic device)
|
||||||
#endif
|
#endif
|
||||||
#if defined(PLATFORM_RPI)
|
#if defined(PLATFORM_RPI)
|
||||||
EGL_DISPMANX_WINDOW_T handle; // Native window handle (graphic device)
|
EGL_DISPMANX_WINDOW_T handle; // Native window handle (graphic device)
|
||||||
|
@ -401,15 +401,12 @@ typedef struct CoreData {
|
||||||
bool appEnabled; // Flag to detect if app is active ** = true
|
bool appEnabled; // Flag to detect if app is active ** = true
|
||||||
struct android_app *app; // Android activity
|
struct android_app *app; // Android activity
|
||||||
struct android_poll_source *source; // Android events polling source
|
struct android_poll_source *source; // Android events polling source
|
||||||
const char *internalDataPath; // Android internal data path to write data (/data/data/<package>/files)
|
|
||||||
bool contextRebindRequired; // Used to know context rebind required
|
bool contextRebindRequired; // Used to know context rebind required
|
||||||
} Android;
|
} Android;
|
||||||
#endif
|
#endif
|
||||||
#if defined(PLATFORM_UWP)
|
|
||||||
struct {
|
struct {
|
||||||
const char *internalDataPath; // UWP App data path
|
const char *basePath; // Base path for data storage
|
||||||
} UWP;
|
} Storage;
|
||||||
#endif
|
|
||||||
struct {
|
struct {
|
||||||
#if defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
|
#if defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
|
||||||
InputEventWorker eventWorker[10]; // List of worker threads for every monitored "/dev/input/event<N>"
|
InputEventWorker eventWorker[10]; // List of worker threads for every monitored "/dev/input/event<N>"
|
||||||
|
@ -475,7 +472,7 @@ typedef struct CoreData {
|
||||||
double draw; // Time measure for frame draw
|
double draw; // Time measure for frame draw
|
||||||
double frame; // Time measure for one frame
|
double frame; // Time measure for one frame
|
||||||
double target; // Desired time for one frame, if 0 not applied
|
double target; // Desired time for one frame, if 0 not applied
|
||||||
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI) || defined(PLATFORM_DRM) || defined(PLATFORM_UWP)
|
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
|
||||||
unsigned long long base; // Base time measure for hi-res timer
|
unsigned long long base; // Base time measure for hi-res timer
|
||||||
#endif
|
#endif
|
||||||
unsigned int frameCounter; // Frame counter
|
unsigned int frameCounter; // Frame counter
|
||||||
|
@ -637,20 +634,20 @@ static EM_BOOL EmscriptenResizeCallback(int eventType, const EmscriptenUiEvent *
|
||||||
|
|
||||||
#if defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
|
#if defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
|
||||||
#if defined(SUPPORT_SSH_KEYBOARD_RPI)
|
#if defined(SUPPORT_SSH_KEYBOARD_RPI)
|
||||||
static void InitKeyboard(void); // Init raw keyboard system (standard input reading)
|
static void InitKeyboard(void); // Initialize raw keyboard system (standard input reading)
|
||||||
static void ProcessKeyboard(void); // Process keyboard events
|
static void ProcessKeyboard(void); // Process keyboard events
|
||||||
static void RestoreKeyboard(void); // Restore keyboard system
|
static void RestoreKeyboard(void); // Restore keyboard system
|
||||||
#else
|
#else
|
||||||
static void InitTerminal(void); // Init terminal (block echo and signal short cuts)
|
static void InitTerminal(void); // Initialize terminal (block echo and signal short cuts)
|
||||||
static void RestoreTerminal(void); // Restore terminal
|
static void RestoreTerminal(void); // Restore terminal
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void InitEvdevInput(void); // Evdev inputs initialization
|
static void InitEvdevInput(void); // Initialize evdev inputs
|
||||||
static void ConfigureEvdevDevice(char *device); // Identifies a input device and configures it for use if appropriate
|
static void ConfigureEvdevDevice(char *device); // Identifies a input device and configures it for use if appropriate
|
||||||
static void PollKeyboardEvents(void); // Process evdev keyboard events.
|
static void PollKeyboardEvents(void); // Process evdev keyboard events.
|
||||||
static void *EventThread(void *arg); // Input device events reading thread
|
static void *EventThread(void *arg); // Input device events reading thread
|
||||||
|
|
||||||
static void InitGamepad(void); // Init raw gamepad input
|
static void InitGamepad(void); // Initialize raw gamepad input
|
||||||
static void *GamepadThread(void *arg); // Mouse reading thread
|
static void *GamepadThread(void *arg); // Mouse reading thread
|
||||||
|
|
||||||
#if defined(PLATFORM_DRM)
|
#if defined(PLATFORM_DRM)
|
||||||
|
@ -662,15 +659,15 @@ static int FindNearestConnectorMode(const drmModeConnector *connector, uint widt
|
||||||
#endif // PLATFORM_RPI || PLATFORM_DRM
|
#endif // PLATFORM_RPI || PLATFORM_DRM
|
||||||
|
|
||||||
#if defined(SUPPORT_EVENTS_AUTOMATION)
|
#if defined(SUPPORT_EVENTS_AUTOMATION)
|
||||||
static void LoadAutomationEvents(const char *fileName);
|
static void LoadAutomationEvents(const char *fileName); // Load automation events from file
|
||||||
static void ExportAutomationEvents(const char *fileName);
|
static void ExportAutomationEvents(const char *fileName); // Export recorded automation events into a file
|
||||||
static void RecordAutomationEvent(unsigned int frame);
|
static void RecordAutomationEvent(unsigned int frame); // Record frame events (to internal events array)
|
||||||
static void PlayAutomationEvent(unsigned int frame);
|
static void PlayAutomationEvent(unsigned int frame); // Play frame events (from internal events array)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
// NOTE: We include Sleep() function signature here to avoid windows.h inclusion (kernel32 lib)
|
// NOTE: We declare Sleep() function symbol to avoid including windows.h (kernel32.lib linkage required)
|
||||||
void __stdcall Sleep(unsigned long msTimeout); // Required for WaitTime()
|
void __stdcall Sleep(unsigned long msTimeout); // Required for WaitTime()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
@ -698,7 +695,7 @@ struct android_app *GetAndroidApp(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if (defined(PLATFORM_RPI) || defined(PLATFORM_DRM)) && !defined(SUPPORT_SSH_KEYBOARD_RPI)
|
#if (defined(PLATFORM_RPI) || defined(PLATFORM_DRM)) && !defined(SUPPORT_SSH_KEYBOARD_RPI)
|
||||||
// Init terminal (block echo and signal short cuts)
|
// Initialize terminal (block echo and signal short cuts)
|
||||||
static void InitTerminal(void)
|
static void InitTerminal(void)
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_INFO, "RPI: Reconfiguring terminal...");
|
TRACELOG(LOG_INFO, "RPI: Reconfiguring terminal...");
|
||||||
|
@ -773,9 +770,6 @@ void InitWindow(int width, int height, const char *title)
|
||||||
CORE.Window.currentFbo.width = width;
|
CORE.Window.currentFbo.width = width;
|
||||||
CORE.Window.currentFbo.height = height;
|
CORE.Window.currentFbo.height = height;
|
||||||
|
|
||||||
// Input data is android app pointer
|
|
||||||
CORE.Android.internalDataPath = CORE.Android.app->activity->internalDataPath;
|
|
||||||
|
|
||||||
// Set desired windows flags before initializing anything
|
// Set desired windows flags before initializing anything
|
||||||
ANativeActivity_setWindowFlags(CORE.Android.app->activity, AWINDOW_FLAG_FULLSCREEN, 0); //AWINDOW_FLAG_SCALED, AWINDOW_FLAG_DITHER
|
ANativeActivity_setWindowFlags(CORE.Android.app->activity, AWINDOW_FLAG_FULLSCREEN, 0); //AWINDOW_FLAG_SCALED, AWINDOW_FLAG_DITHER
|
||||||
|
|
||||||
|
@ -804,7 +798,11 @@ void InitWindow(int width, int height, const char *title)
|
||||||
CORE.Android.app->onAppCmd = AndroidCommandCallback;
|
CORE.Android.app->onAppCmd = AndroidCommandCallback;
|
||||||
CORE.Android.app->onInputEvent = AndroidInputCallback;
|
CORE.Android.app->onInputEvent = AndroidInputCallback;
|
||||||
|
|
||||||
|
// Initialize assets manager
|
||||||
InitAssetManager(CORE.Android.app->activity->assetManager, CORE.Android.app->activity->internalDataPath);
|
InitAssetManager(CORE.Android.app->activity->assetManager, CORE.Android.app->activity->internalDataPath);
|
||||||
|
|
||||||
|
// Initialize base path for storage
|
||||||
|
CORE.Storage.basePath = CORE.Android.app->activity->internalDataPath;
|
||||||
|
|
||||||
TRACELOG(LOG_INFO, "ANDROID: App initialized successfully");
|
TRACELOG(LOG_INFO, "ANDROID: App initialized successfully");
|
||||||
|
|
||||||
|
@ -827,7 +825,7 @@ void InitWindow(int width, int height, const char *title)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB) || defined(PLATFORM_RPI) || defined(PLATFORM_UWP) || defined(PLATFORM_DRM)
|
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB) || defined(PLATFORM_RPI) || defined(PLATFORM_UWP) || defined(PLATFORM_DRM)
|
||||||
// Init graphics device (display device and OpenGL context)
|
// Initialize graphics device (display device and OpenGL context)
|
||||||
// NOTE: returns true if window and graphic device has been initialized successfully
|
// NOTE: returns true if window and graphic device has been initialized successfully
|
||||||
CORE.Window.ready = InitGraphicsDevice(width, height);
|
CORE.Window.ready = InitGraphicsDevice(width, height);
|
||||||
|
|
||||||
|
@ -838,11 +836,14 @@ void InitWindow(int width, int height, const char *title)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init hi-res timer
|
// Initialize hi-res timer
|
||||||
InitTimer();
|
InitTimer();
|
||||||
|
|
||||||
// Initialize random seed
|
// Initialize random seed
|
||||||
srand((unsigned int)time(NULL));
|
srand((unsigned int)time(NULL));
|
||||||
|
|
||||||
|
// Initialize base path for storage
|
||||||
|
CORE.Storage.basePath = GetWorkingDirectory();
|
||||||
|
|
||||||
#if defined(SUPPORT_DEFAULT_FONT)
|
#if defined(SUPPORT_DEFAULT_FONT)
|
||||||
// Load default font
|
// Load default font
|
||||||
|
@ -864,7 +865,7 @@ void InitWindow(int width, int height, const char *title)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
|
#if defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
|
||||||
// Init raw input system
|
// Initialize raw input system
|
||||||
InitEvdevInput(); // Evdev inputs initialization
|
InitEvdevInput(); // Evdev inputs initialization
|
||||||
InitGamepad(); // Gamepad init
|
InitGamepad(); // Gamepad init
|
||||||
#if defined(SUPPORT_SSH_KEYBOARD_RPI)
|
#if defined(SUPPORT_SSH_KEYBOARD_RPI)
|
||||||
|
@ -2689,7 +2690,7 @@ float GetFrameTime(void)
|
||||||
double GetTime(void)
|
double GetTime(void)
|
||||||
{
|
{
|
||||||
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB)
|
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB)
|
||||||
return glfwGetTime(); // Elapsed time since glfwInit()
|
return glfwGetTime(); // Elapsed time since glfwInit()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
|
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI) || defined(PLATFORM_DRM)
|
||||||
|
@ -2727,17 +2728,7 @@ void TakeScreenshot(const char *fileName)
|
||||||
Image image = { imgData, CORE.Window.render.width, CORE.Window.render.height, 1, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 };
|
Image image = { imgData, CORE.Window.render.width, CORE.Window.render.height, 1, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 };
|
||||||
|
|
||||||
char path[512] = { 0 };
|
char path[512] = { 0 };
|
||||||
#if defined(PLATFORM_ANDROID)
|
strcpy(path, TextFormat("%s/%s", CORE.Storage.basePath, fileName));
|
||||||
strcpy(path, CORE.Android.internalDataPath);
|
|
||||||
strcat(path, "/");
|
|
||||||
strcat(path, fileName);
|
|
||||||
#elif defined(PLATFORM_UWP)
|
|
||||||
strcpy(path, CORE.UWP.internalDataPath);
|
|
||||||
strcat(path, "/");
|
|
||||||
strcat(path, fileName);
|
|
||||||
#else
|
|
||||||
strcpy(path, fileName);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ExportImage(image, path);
|
ExportImage(image, path);
|
||||||
RL_FREE(imgData);
|
RL_FREE(imgData);
|
||||||
|
@ -2956,9 +2947,9 @@ const char *GetWorkingDirectory(void)
|
||||||
static char currentDir[MAX_FILEPATH_LENGTH];
|
static char currentDir[MAX_FILEPATH_LENGTH];
|
||||||
memset(currentDir, 0, MAX_FILEPATH_LENGTH);
|
memset(currentDir, 0, MAX_FILEPATH_LENGTH);
|
||||||
|
|
||||||
char *ptr = GETCWD(currentDir, MAX_FILEPATH_LENGTH - 1);
|
char *path = GETCWD(currentDir, MAX_FILEPATH_LENGTH - 1);
|
||||||
|
|
||||||
return ptr;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get filenames in a directory path (max 512 files)
|
// Get filenames in a directory path (max 512 files)
|
||||||
|
@ -3114,17 +3105,7 @@ bool SaveStorageValue(unsigned int position, int value)
|
||||||
|
|
||||||
#if defined(SUPPORT_DATA_STORAGE)
|
#if defined(SUPPORT_DATA_STORAGE)
|
||||||
char path[512] = { 0 };
|
char path[512] = { 0 };
|
||||||
#if defined(PLATFORM_ANDROID)
|
strcpy(path, TextFormat("%s/%s", CORE.Storage.basePath, STORAGE_DATA_FILE));
|
||||||
strcpy(path, CORE.Android.internalDataPath);
|
|
||||||
strcat(path, "/");
|
|
||||||
strcat(path, STORAGE_DATA_FILE);
|
|
||||||
#elif defined(PLATFORM_UWP)
|
|
||||||
strcpy(path, CORE.UWP.internalDataPath);
|
|
||||||
strcat(path, "/");
|
|
||||||
strcat(path, STORAGE_DATA_FILE);
|
|
||||||
#else
|
|
||||||
strcpy(path, STORAGE_DATA_FILE);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
unsigned int dataSize = 0;
|
unsigned int dataSize = 0;
|
||||||
unsigned int newDataSize = 0;
|
unsigned int newDataSize = 0;
|
||||||
|
@ -3168,10 +3149,12 @@ bool SaveStorageValue(unsigned int position, int value)
|
||||||
|
|
||||||
success = SaveFileData(path, newFileData, newDataSize);
|
success = SaveFileData(path, newFileData, newDataSize);
|
||||||
RL_FREE(newFileData);
|
RL_FREE(newFileData);
|
||||||
|
|
||||||
|
TRACELOG(LOG_INFO, "FILEIO: [%s] Saved storage value: %i", path, value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_INFO, "FILEIO: [%s] File not found, creating it", path);
|
TRACELOG(LOG_INFO, "FILEIO: [%s] File created successfully", path);
|
||||||
|
|
||||||
dataSize = (position + 1)*sizeof(int);
|
dataSize = (position + 1)*sizeof(int);
|
||||||
fileData = (unsigned char *)RL_MALLOC(dataSize);
|
fileData = (unsigned char *)RL_MALLOC(dataSize);
|
||||||
|
@ -3180,6 +3163,8 @@ bool SaveStorageValue(unsigned int position, int value)
|
||||||
|
|
||||||
success = SaveFileData(path, fileData, dataSize);
|
success = SaveFileData(path, fileData, dataSize);
|
||||||
UnloadFileData(fileData);
|
UnloadFileData(fileData);
|
||||||
|
|
||||||
|
TRACELOG(LOG_INFO, "FILEIO: [%s] Saved storage value: %i", path, value);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -3194,24 +3179,14 @@ int LoadStorageValue(unsigned int position)
|
||||||
|
|
||||||
#if defined(SUPPORT_DATA_STORAGE)
|
#if defined(SUPPORT_DATA_STORAGE)
|
||||||
char path[512] = { 0 };
|
char path[512] = { 0 };
|
||||||
#if defined(PLATFORM_ANDROID)
|
strcpy(path, TextFormat("%s/%s", CORE.Storage.basePath, STORAGE_DATA_FILE));
|
||||||
strcpy(path, CORE.Android.internalDataPath);
|
|
||||||
strcat(path, "/");
|
|
||||||
strcat(path, STORAGE_DATA_FILE);
|
|
||||||
#elif defined(PLATFORM_UWP)
|
|
||||||
strcpy(path, CORE.UWP.internalDataPath);
|
|
||||||
strcat(path, "/");
|
|
||||||
strcat(path, STORAGE_DATA_FILE);
|
|
||||||
#else
|
|
||||||
strcpy(path, STORAGE_DATA_FILE);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
unsigned int dataSize = 0;
|
unsigned int dataSize = 0;
|
||||||
unsigned char *fileData = LoadFileData(path, &dataSize);
|
unsigned char *fileData = LoadFileData(path, &dataSize);
|
||||||
|
|
||||||
if (fileData != NULL)
|
if (fileData != NULL)
|
||||||
{
|
{
|
||||||
if (dataSize < (position*4)) TRACELOG(LOG_WARNING, "SYSTEM: Failed to find storage position");
|
if (dataSize < (position*4)) TRACELOG(LOG_WARNING, "FILEIO: [%s] Failed to find storage position: %i", path, position);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int *dataPtr = (int *)fileData;
|
int *dataPtr = (int *)fileData;
|
||||||
|
@ -3219,6 +3194,8 @@ int LoadStorageValue(unsigned int position)
|
||||||
}
|
}
|
||||||
|
|
||||||
UnloadFileData(fileData);
|
UnloadFileData(fileData);
|
||||||
|
|
||||||
|
TRACELOG(LOG_INFO, "FILEIO: [%s] Loaded storage value: %i", path, value);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return value;
|
return value;
|
||||||
|
@ -5201,15 +5178,7 @@ static void KeyCallback(GLFWwindow *window, int key, int scancode, int action, i
|
||||||
|
|
||||||
MsfGifResult result = msf_gif_end(&gifState);
|
MsfGifResult result = msf_gif_end(&gifState);
|
||||||
|
|
||||||
char path[512] = { 0 };
|
SaveFileData(TextFormat("%s/screenrec%03i.gif", CORE.Storage.basePath, screenshotCounter), result.data, (unsigned int)result.dataSize);
|
||||||
#if defined(PLATFORM_ANDROID)
|
|
||||||
strcpy(path, CORE.Android.internalDataPath);
|
|
||||||
strcat(path, TextFormat("./screenrec%03i.gif", screenshotCounter));
|
|
||||||
#else
|
|
||||||
strcpy(path, TextFormat("./screenrec%03i.gif", screenshotCounter));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
SaveFileData(path, result.data, (unsigned int)result.dataSize);
|
|
||||||
msf_gif_free(result);
|
msf_gif_free(result);
|
||||||
|
|
||||||
#if defined(PLATFORM_WEB)
|
#if defined(PLATFORM_WEB)
|
||||||
|
@ -5407,7 +5376,7 @@ static void AndroidCommandCallback(struct android_app *app, int32_t cmd)
|
||||||
if (CORE.Android.contextRebindRequired)
|
if (CORE.Android.contextRebindRequired)
|
||||||
{
|
{
|
||||||
// Reset screen scaling to full display size
|
// Reset screen scaling to full display size
|
||||||
EGLint displayFormat;
|
EGLint displayFormat = 0;
|
||||||
eglGetConfigAttrib(CORE.Window.device, CORE.Window.config, EGL_NATIVE_VISUAL_ID, &displayFormat);
|
eglGetConfigAttrib(CORE.Window.device, CORE.Window.config, EGL_NATIVE_VISUAL_ID, &displayFormat);
|
||||||
ANativeWindow_setBuffersGeometry(app->window, CORE.Window.render.width, CORE.Window.render.height, displayFormat);
|
ANativeWindow_setBuffersGeometry(app->window, CORE.Window.render.width, CORE.Window.render.height, displayFormat);
|
||||||
|
|
||||||
|
@ -5422,10 +5391,10 @@ static void AndroidCommandCallback(struct android_app *app, int32_t cmd)
|
||||||
CORE.Window.display.width = ANativeWindow_getWidth(CORE.Android.app->window);
|
CORE.Window.display.width = ANativeWindow_getWidth(CORE.Android.app->window);
|
||||||
CORE.Window.display.height = ANativeWindow_getHeight(CORE.Android.app->window);
|
CORE.Window.display.height = ANativeWindow_getHeight(CORE.Android.app->window);
|
||||||
|
|
||||||
// Init graphics device (display device and OpenGL context)
|
// Initialize graphics device (display device and OpenGL context)
|
||||||
InitGraphicsDevice(CORE.Window.screen.width, CORE.Window.screen.height);
|
InitGraphicsDevice(CORE.Window.screen.width, CORE.Window.screen.height);
|
||||||
|
|
||||||
// Init hi-res timer
|
// Initialize hi-res timer
|
||||||
InitTimer();
|
InitTimer();
|
||||||
|
|
||||||
// Initialize random seed
|
// Initialize random seed
|
||||||
|
@ -6392,7 +6361,7 @@ static void *EventThread(void *arg)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init gamepad system
|
// Initialize gamepad system
|
||||||
static void InitGamepad(void)
|
static void InitGamepad(void)
|
||||||
{
|
{
|
||||||
char gamepadDev[128] = "";
|
char gamepadDev[128] = "";
|
||||||
|
@ -6512,7 +6481,7 @@ bool UWPIsConfigured()
|
||||||
}
|
}
|
||||||
|
|
||||||
// UWP function handlers get/set
|
// UWP function handlers get/set
|
||||||
void UWPSetDataPath(const char *path) { CORE.UWP.internalDataPath = path; }
|
void UWPSetDataPath(const char *path) { CORE.Storage.basePath = path; }
|
||||||
UWPQueryTimeFunc UWPGetQueryTimeFunc(void) { return uwpQueryTimeFunc; }
|
UWPQueryTimeFunc UWPGetQueryTimeFunc(void) { return uwpQueryTimeFunc; }
|
||||||
void UWPSetQueryTimeFunc(UWPQueryTimeFunc func) { uwpQueryTimeFunc = func; }
|
void UWPSetQueryTimeFunc(UWPQueryTimeFunc func) { uwpQueryTimeFunc = func; }
|
||||||
UWPSleepFunc UWPGetSleepFunc(void) { return uwpSleepFunc; }
|
UWPSleepFunc UWPGetSleepFunc(void) { return uwpSleepFunc; }
|
||||||
|
@ -6553,14 +6522,15 @@ void UWPKeyDownEvent(int key, bool down, bool controlKey)
|
||||||
|
|
||||||
MsfGifResult result = msf_gif_end(&gifState);
|
MsfGifResult result = msf_gif_end(&gifState);
|
||||||
|
|
||||||
SaveFileData(TextFormat("%s/screenrec%03i.gif", CORE.UWP.internalDataPath, screenshotCounter), result.data, result.dataSize);
|
SaveFileData(TextFormat("%s/screenrec%03i.gif", CORE.Storage.basePath, screenshotCounter), result.data, result.dataSize);
|
||||||
msf_gif_free(result);
|
msf_gif_free(result);
|
||||||
|
|
||||||
#if defined(PLATFORM_WEB)
|
#if defined(PLATFORM_WEB)
|
||||||
// Download file from MEMFS (emscripten memory filesystem)
|
// Download file from MEMFS (emscripten memory filesystem)
|
||||||
// saveFileFromMEMFSToDisk() function is defined in raylib/templates/web_shel/shell.html
|
// saveFileFromMEMFSToDisk() function is defined in raylib/templates/web_shel/shell.html
|
||||||
emscripten_run_script(TextFormat("saveFileFromMEMFSToDisk('%s','%s')", TextFormat("screenrec%03i.gif", screenshotCounter - 1), TextFormat("screenrec%03i.gif", screenshotCounter - 1)));
|
emscripten_run_script(TextFormat("saveFileFromMEMFSToDisk('%s','%s')", TextFormat("screenrec%03i.gif", screenshotCounter - 1), TextFormat("screenrec%03i.gif", screenshotCounter - 1)));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TRACELOG(LOG_INFO, "SYSTEM: Finish animated GIF recording");
|
TRACELOG(LOG_INFO, "SYSTEM: Finish animated GIF recording");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue