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
|
#include "cfg.h"
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/stat.h>
extern GpuConfS gpuConfig;
char * pConfigFile=NULL;
#define GetValue(name, var) \
p = strstr(pB, name); \
if (p != NULL) { \
p+=strlen(name); \
while ((*p == ' ') || (*p == '=')) p++; \
if (*p != '\n') var = atoi(p); \
}
void readconfig()
{
struct stat buf;
FILE *in;char t[256];int len, size;
char * pB, * p;
if(pConfigFile)
strcpy(t,pConfigFile);
else
{
strcpy(t,"dfopengl.cfg");
in = fopen(t,"rb");
if (!in)
{
strcpy(t,"cfg/dfopengl.cfg");
in = fopen(t,"rb");
if(!in) sprintf(t,"%s/.pcsx/plugins/dfopengl.cfg",getenv("HOME"));
else fclose(in);
}
else fclose(in);
}
if (stat(t, &buf) == -1) return;
size = buf.st_size;
in = fopen(t,"rb");
if (!in) return;
pB=(char *)malloc(size);
memset(pB,0,size);
len = fread(pB, 1, size, in);
fclose(in);
gpuConfig.bFullscreen=FALSE;
gpuConfig.bBilinear=FALSE;
gpuConfig.nMaxTextures=64;
gpuConfig.bWireFrame=FALSE;
gpuConfig.bAntialias=FALSE;
gpuConfig.bClearScreen=FALSE;
gpuConfig.FrameLimit=TRUE;
gpuConfig.windowX=1024;
gpuConfig.windowY=768;
GetValue("Fullscreen", gpuConfig.bFullscreen);
GetValue("Bilinear", gpuConfig.bBilinear);
GetValue("MaxTextures", gpuConfig.nMaxTextures);
GetValue("Wireframe", gpuConfig.bWireFrame);
GetValue("Antialias", gpuConfig.bAntialias);
GetValue("Clearscreen", gpuConfig.bClearScreen);
GetValue("FrameLimit", gpuConfig.FrameLimit);
GetValue("windowX", gpuConfig.windowX);
GetValue("windowY", gpuConfig.windowY);
free(pB);
}
void writeconfig()
{
}
void ExecCfg(char *arg) {
char cfg[256];
struct stat buf;
strcpy(cfg, "./cfgDFOpenGL");
if (stat(cfg, &buf) != -1) {
strcat(cfg, " ");
strcat(cfg, arg);
system(cfg);
return;
}
strcpy(cfg, "./cfg/cfgDFOpenGL");
if (stat(cfg, &buf) != -1) {
strcat(cfg, " ");
strcat(cfg, arg);
system(cfg);
return;
}
sprintf(cfg, "%s/.pcsx/plugins/cfg/cfgDFOpenGL", getenv("HOME"));
if (stat(cfg, &buf) != -1) {
strcat(cfg, " ");
strcat(cfg, arg);
system(cfg);
return;
}
printf("ERROR: cfgDFOpenGL file not found!\n");
}
|