aboutsummaryrefslogtreecommitdiff
path: root/src/lutris.h
blob: 0991e147ef5855d6407d4fd1694b9f68fe27292a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#ifndef LUTRIS_H
#define LUTRIS_H

#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 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",
};

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*, size_t);
struct script lutris_getInstaller(char*);
void lutris_freeInstaller(struct script*);

#endif