-
Notifications
You must be signed in to change notification settings - Fork 1
/
doom.c
60 lines (52 loc) · 2.16 KB
/
doom.c
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
#include "doom.h"
void DoomApplySettings(TAction *Act)
{
ListNode *Curr;
char *EmulatorArgs=NULL;
const char *ptr;
EmulatorArgs=CopyStr(EmulatorArgs, GetVar(Act->Vars, "emulator-args"));
Curr=ListGetNext(Act->Vars);
while (Curr)
{
ptr=Curr->Item;
if (strcasecmp(Curr->Tag, "vdesk")==0)
{
if (strcasecmp(ptr, "y") == 0) EmulatorArgs=CatStr(EmulatorArgs, " -nofullscreen");
else if (strcasecmp(ptr, "n") == 0) EmulatorArgs=CatStr(EmulatorArgs, " -fullscreen");
else if (isdigit(*ptr)) EmulatorArgs=MCatStr(EmulatorArgs, " -geometry ", ptr, NULL);
}
else if (strcasecmp(Curr->Tag, "fullscreen")==0)
{
if (strcasecmp(ptr, "y") == 0) EmulatorArgs=CatStr(EmulatorArgs, " -fullscreen");
else if (strcasecmp(ptr, "n") == 0) EmulatorArgs=CatStr(EmulatorArgs, " -nofullscreen");
}
else if (strcasecmp(Curr->Tag, "sound")==0)
{
if (strcasecmp(ptr, "n") == 0) EmulatorArgs=CatStr(EmulatorArgs, " -nosound");
else if (strcasecmp(ptr, "sfx") == 0) EmulatorArgs=CatStr(EmulatorArgs, " -nomusic");
}
else if (strcasecmp(Curr->Tag, "grab")==0)
{
if (strcasecmp(ptr, "n") == 0) EmulatorArgs=CatStr(EmulatorArgs, " -nograbmouse");
}
else if (strcasecmp(Curr->Tag, "mouse")==0)
{
if (strcasecmp(ptr, "n") == 0) EmulatorArgs=CatStr(EmulatorArgs, " -nomouse");
}
Curr=ListGetNext(Curr);
}
//prboom-plus only supports dos/windows style '/' switches on the command line
//not unix style '-' switches
ptr=GetVar(Act->Vars, "emulator");
if (StrValid(ptr) && (strcmp(ptr, "prboom-plus")==0) )
{
strrep(EmulatorArgs, '-', '/');
}
SetVar(Act->Vars, "emulator-args", EmulatorArgs);
//as doom settings are stored in the emulator args in the emulator args
//within the .desktop file, so we will have to reconfigure to rewrite
//everything, unless we are doing an install (in which case all this
//gets done at the end of the install anyway)
//if (Act->Type != ACT_INSTALL) InstallReconfigure(Act);
Destroy(EmulatorArgs);
}