summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/config.h2
-rw-r--r--src/raylib.h4
-rw-r--r--src/rcore.c113
3 files changed, 0 insertions, 119 deletions
diff --git a/src/config.h b/src/config.h
index 8a20f174..132b8cee 100644
--- a/src/config.h
+++ b/src/config.h
@@ -63,8 +63,6 @@
#define SUPPORT_GIF_RECORDING 1
// Support CompressData() and DecompressData() functions
#define SUPPORT_COMPRESSION_API 1
-// Support saving binary data automatically to a generated storage.data file. This file is managed internally.
-#define SUPPORT_DATA_STORAGE 1
// Support automatic generated events, loading and recording of those events when required
//#define SUPPORT_EVENTS_AUTOMATION 1
// Support custom frame control, only for advance users
diff --git a/src/raylib.h b/src/raylib.h
index f9db8a17..3bc08898 100644
--- a/src/raylib.h
+++ b/src/raylib.h
@@ -1081,10 +1081,6 @@ RLAPI unsigned char *DecompressData(const unsigned char *compData, int compDataS
RLAPI char *EncodeDataBase64(const unsigned char *data, int dataSize, int *outputSize); // Encode data to Base64 string, memory must be MemFree()
RLAPI unsigned char *DecodeDataBase64(const unsigned char *data, int *outputSize); // Decode Base64 string data, memory must be MemFree()
-// Persistent storage management
-RLAPI bool SaveStorageValue(unsigned int position, int value); // Save integer value to storage file (to defined position), returns true on success
-RLAPI int LoadStorageValue(unsigned int position); // Load integer value from storage file (from defined position)
-
RLAPI void OpenURL(const char *url); // Open URL with default system browser (if available)
//------------------------------------------------------------------------------------
diff --git a/src/rcore.c b/src/rcore.c
index 55e820b6..1313349b 100644
--- a/src/rcore.c
+++ b/src/rcore.c
@@ -80,9 +80,6 @@
* provided by stb_image and stb_image_write libraries, so, those libraries must be enabled on textures module
* for linkage
*
-* #define SUPPORT_DATA_STORAGE
-* Support saving binary data automatically to a generated storage.data file. This file is managed internally
-*
* #define SUPPORT_EVENTS_AUTOMATION
* Support automatic generated events, loading and recording of those events when required
*
@@ -332,12 +329,6 @@
#define MAX_CHAR_PRESSED_QUEUE 16 // Maximum number of characters in the char input queue
#endif
-#if defined(SUPPORT_DATA_STORAGE)
- #ifndef STORAGE_DATA_FILE
- #define STORAGE_DATA_FILE "storage.data" // Automatic storage filename
- #endif
-#endif
-
#ifndef MAX_DECOMPRESSION_SIZE
#define MAX_DECOMPRESSION_SIZE 64 // Maximum size allocated for decompression in MB
#endif
@@ -3398,110 +3389,6 @@ unsigned char *DecodeDataBase64(const unsigned char *data, int *outputSize)
return decodedData;
}
-// Save integer value to storage file (to defined position)
-// NOTE: Storage positions is directly related to file memory layout (4 bytes each integer)
-bool SaveStorageValue(unsigned int position, int value)
-{
- bool success = false;
-
-#if defined(SUPPORT_DATA_STORAGE)
- char path[512] = { 0 };
- strcpy(path, TextFormat("%s/%s", CORE.Storage.basePath, STORAGE_DATA_FILE));
-
- unsigned int dataSize = 0;
- unsigned int newDataSize = 0;
- unsigned char *fileData = LoadFileData(path, &dataSize);
- unsigned char *newFileData = NULL;
-
- if (fileData != NULL)
- {
- if (dataSize <= (position*sizeof(int)))
- {
- // Increase data size up to position and store value
- newDataSize = (position + 1)*sizeof(int);
- newFileData = (unsigned char *)RL_REALLOC(fileData, newDataSize);
-
- if (newFileData != NULL)
- {
- // RL_REALLOC succeded
- int *dataPtr = (int *)newFileData;
- dataPtr[position] = value;
- }
- else
- {
- // RL_REALLOC failed
- TRACELOG(LOG_WARNING, "FILEIO: [%s] Failed to realloc data (%u), position in bytes (%u) bigger than actual file size", path, dataSize, position*sizeof(int));
-
- // We store the old size of the file
- newFileData = fileData;
- newDataSize = dataSize;
- }
- }
- else
- {
- // Store the old size of the file
- newFileData = fileData;
- newDataSize = dataSize;
-
- // Replace value on selected position
- int *dataPtr = (int *)newFileData;
- dataPtr[position] = value;
- }
-
- success = SaveFileData(path, newFileData, newDataSize);
- RL_FREE(newFileData);
-
- TRACELOG(LOG_INFO, "FILEIO: [%s] Saved storage value: %i", path, value);
- }
- else
- {
- TRACELOG(LOG_INFO, "FILEIO: [%s] File created successfully", path);
-
- dataSize = (position + 1)*sizeof(int);
- fileData = (unsigned char *)RL_MALLOC(dataSize);
- int *dataPtr = (int *)fileData;
- dataPtr[position] = value;
-
- success = SaveFileData(path, fileData, dataSize);
- UnloadFileData(fileData);
-
- TRACELOG(LOG_INFO, "FILEIO: [%s] Saved storage value: %i", path, value);
- }
-#endif
-
- return success;
-}
-
-// Load integer value from storage file (from defined position)
-// NOTE: If requested position could not be found, value 0 is returned
-int LoadStorageValue(unsigned int position)
-{
- int value = 0;
-
-#if defined(SUPPORT_DATA_STORAGE)
- char path[512] = { 0 };
- strcpy(path, TextFormat("%s/%s", CORE.Storage.basePath, STORAGE_DATA_FILE));
-
- unsigned int dataSize = 0;
- unsigned char *fileData = LoadFileData(path, &dataSize);
-
- if (fileData != NULL)
- {
- if (dataSize < (position*4)) TRACELOG(LOG_WARNING, "FILEIO: [%s] Failed to find storage position: %i", path, position);
- else
- {
- int *dataPtr = (int *)fileData;
- value = dataPtr[position];
- }
-
- UnloadFileData(fileData);
-
- TRACELOG(LOG_INFO, "FILEIO: [%s] Loaded storage value: %i", path, value);
- }
-#endif
- return value;
-}
-
// Open URL with default system browser (if available)
// NOTE: This function is only safe to use if you control the URL given.
// A user could craft a malicious string performing another action.