aboutsummaryrefslogtreecommitdiff
path: root/src/lutris.h
diff options
context:
space:
mode:
authorJan200101 <sentrycraft123@gmail.com>2020-08-18 23:58:16 +0200
committerJan200101 <sentrycraft123@gmail.com>2020-08-18 23:58:16 +0200
commitd53109eaa890ab807b66961a89291cea3cd3c003 (patch)
treea62382b32014266f5aecb6f639d0962bb1682bf0 /src/lutris.h
parent1753e2b151cbb4af75a4e9ea61720b3704b03805 (diff)
downloadpolecat-d53109eaa890ab807b66961a89291cea3cd3c003.tar.gz
polecat-d53109eaa890ab807b66961a89291cea3cd3c003.zip
first part of a proper lutris implementation and cleanup0.1.4
- remove all old build platform related variables - change behavior of clean - change tabs into spaces - make XDG fetching method static - replace strcpy and cat with strn alternative with proper bounds checking - add cache dir - reenable dxvk and download from ram - completely rework lutris fetching and convert it into an interal struct - only show http errors in debug - add sanity checks to methods with possible NULL return - change extracting methods to extract tar from ram
Diffstat (limited to 'src/lutris.h')
-rw-r--r--src/lutris.h143
1 files changed, 100 insertions, 43 deletions
diff --git a/src/lutris.h b/src/lutris.h
index 6f5fa40..0991e14 100644
--- a/src/lutris.h
+++ b/src/lutris.h
@@ -1,61 +1,118 @@
#ifndef LUTRIS_H
#define LUTRIS_H
-enum keywords {
- MOVE = 0,
- MERGE,
- EXTRACT,
- COPY,
- CHMODX,
- EXECUTE,
- WRITE_FILE,
- WRITE_CONFIG,
- WRITE_JSON,
- INPUT_MENU,
- INSERT_DISC,
- TASK,
-
- KEYWORDMAX
+#include <json.h>
+
+enum keyword {
+ MOVE = 0,
+ MERGE,
+ EXTRACT,
+ COPY,
+ CHMODX,
+ EXECUTE,
+ WRITE_FILE,
+ WRITE_CONFIG,
+ WRITE_JSON,
+ INPUT_MENU,
+ INSERT_DISC,
+ TASK,
+
+ KEYWORDMAX,
+ UNKNOWN_DIRECTIVE
};
static const char keywordstr[KEYWORDMAX][0xF] = {
- "move",
- "merge",
- "extract",
- "copy",
- "chmodx",
- "execute",
- "write_file",
- "write_config",
- "write_json",
- "input_menu",
- "insert-disc",
- "task",
-};
-
-enum taskKeywords {
- WINEEXEC = 0,
- WINETRICKS,
- CREATE_PREFIX,
- SET_REGEDIT,
- WINEKILL,
-
- TASKKEYWORDMAX
+ "move",
+ "merge",
+ "extract",
+ "copy",
+ "chmodx",
+ "execute",
+ "write_file",
+ "write_config",
+ "write_json",
+ "input_menu",
+ "insert-disc",
+ "task",
+};
+
+enum task {
+ WINEEXEC = 0,
+ WINETRICKS,
+ CREATE_PREFIX,
+ SET_REGEDIT,
+ WINEKILL,
+
+ TASKKEYWORDMAX,
+ NO_TASK,
+ UNKNOWN_TASK
};
static const char taskKeywordstr[TASKKEYWORDMAX][0xF] =
{
- "wineexec",
- "winetricks",
- "create_prefix",
- "set_regedit",
- "winekill"
+ "wineexec",
+ "winetricks",
+ "create_prefix",
+ "set_regedit",
+ "winekill",
+};
+
+enum runner_t {
+ WINE,
+ LINUX,
+
+ RUNNERMAX,
+ UNKNOWN_RUNNER
+};
+
+static const char runnerStr[RUNNERMAX][0xF] =
+{
+ "wine",
+ "linux",
+};
+
+
+enum errors {
+ NONE,
+ NO_JSON,
+ NO_SLUG,
+ NO_SCRIPT,
+ NO_INSTALLER,
+};
+
+struct directive_t {
+ enum keyword command;
+ enum task task;
+ char** arguments;
+ size_t size;
+};
+
+struct file_t {
+ char* filename;
+ char* url;
+};
+
+struct script {
+ char* name;
+ char* version;
+ enum runner_t runner;
+ char* description;
+ char* notes;
+ char* wine;
+ struct directive_t** directives;
+ size_t directivecount;
+ struct file_t** files;
+ size_t filecount;
+ enum errors error;
};
int lutris(int, char**);
int lutris_install(int, char**);
int lutris_info(int, char**);
int lutris_help(int, char**);
-void lutris_getInstallerURL(char*, char*);
+
+void lutris_getInstallerURL(char*, char*, size_t);
+struct script lutris_getInstaller(char*);
+void lutris_freeInstaller(struct script*);
#endif \ No newline at end of file