/[pcsx2_0.9.7]/trunk/plugins/zzogl-pg/opengl/Linux/Conf.cpp
ViewVC logotype

Contents of /trunk/plugins/zzogl-pg/opengl/Linux/Conf.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 280 - (show annotations) (download)
Thu Dec 23 12:02:12 2010 UTC (9 years, 2 months ago) by william
File size: 3300 byte(s)
re-commit (had local access denied errors when committing)
1 /* GSsoft
2 * Copyright (C) 2002-2004 GSsoft Team
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18
19 #include <stdlib.h>
20 #include <sys/stat.h>
21 #include <sys/types.h>
22 #include <fcntl.h>
23 #include <unistd.h>
24 #include <string.h>
25 #include "GS.h"
26
27 void SaveConfig()
28 {
29 const std::string iniFile(s_strIniPath + "zzogl-pg.ini");
30
31 FILE* f = fopen(iniFile.c_str(), "w");
32
33 if (f == NULL)
34 {
35 ZZLog::Error_Log("Failed to open '%s'", iniFile.c_str());
36 return;
37 }
38
39 fprintf(f, "interlace = %hhx\n", conf.interlace);
40
41 fprintf(f, "mrtdepth = %hhx\n", conf.mrtdepth);
42 fprintf(f, "zzoptions = %x\n", conf.zz_options._u32);
43 fprintf(f, "options = %x\n", conf.hacks._u32);
44 fprintf(f, "bilinear = %hhx\n", conf.bilinear);
45 fprintf(f, "aliasing = %hhx\n", conf.aa);
46 fprintf(f, "width = %x\n", conf.width);
47 fprintf(f, "height = %x\n", conf.height);
48 fprintf(f, "x = %x\n", conf.x);
49 fprintf(f, "y = %x\n", conf.y);
50 fprintf(f, "log = %x\n", conf.log);
51 fprintf(f, "skipdraw = %x\n", conf.SkipDraw);
52 fprintf(f, "disablehacks = %x\n", conf.disableHacks);
53 fclose(f);
54 }
55
56 void LoadConfig()
57 {
58 int err = 0;
59 memset(&conf, 0, sizeof(conf));
60 conf.interlace = 0; // on, mode 1
61 conf.mrtdepth = 1;
62 conf.bilinear = 1;
63 conf.log = 1;
64 conf.SkipDraw = 0;
65 conf.width = 800;
66 conf.height = 600;
67 conf.disableHacks = 0;
68
69 const std::string iniFile(s_strIniPath + "zzogl-pg.ini");
70 FILE* f = fopen(iniFile.c_str(), "r");
71
72 if (f == NULL)
73 {
74 ZZLog::Error_Log("Failed to open '%s'", iniFile.c_str());
75 SaveConfig();//save and return
76 return;
77 }
78
79 err = fscanf(f, "interlace = %hhx\n", &conf.interlace);
80
81 err = fscanf(f, "mrtdepth = %hhx\n", &conf.mrtdepth);
82 err = fscanf(f, "zzoptions = %x\n", &conf.zz_options._u32);
83 err = fscanf(f, "options = %x\n", &conf.hacks._u32);
84 err = fscanf(f, "bilinear = %hhx\n", &conf.bilinear);
85 err = fscanf(f, "aliasing = %hhx\n", &conf.aa);
86 err = fscanf(f, "width = %x\n", &conf.width);
87 err = fscanf(f, "height = %x\n", &conf.height);
88 err = fscanf(f, "x = %x\n", &conf.x);
89 err = fscanf(f, "y = %x\n", &conf.y);
90 err = fscanf(f, "log = %x\n", &conf.log);
91 err = fscanf(f, "skipdraw = %x\n", &conf.SkipDraw);
92 err = fscanf(f, "disablehacks = %x\n", &conf.disableHacks);
93 fclose(f);
94
95 // turn off all hacks by default
96 conf.setWireframe(false);
97 conf.setCaptureAvi(false);
98 conf.setLoaded(true);
99
100 conf.isWideScreen = conf.widescreen();
101
102 // filter bad files
103 if (conf.interlace > 2) conf.interlace = 0;
104 if (conf.aa > 4) conf.aa = 0;
105 if (conf.width <= 0 || conf.height <= 0)
106 {
107 conf.width = 800;
108 conf.height = 600;
109 }
110
111 if (conf.x < 0 || conf.y < 0)
112 {
113 conf.x = 0;
114 conf.y = 0;
115 }
116 }
117

  ViewVC Help
Powered by ViewVC 1.1.22