/[pcsx2_0.9.7]/branch/r3113_0.9.7_beta_reference/plugins/zzogl-pg/opengl/Win32/Conf.cpp
ViewVC logotype

Annotation of /branch/r3113_0.9.7_beta_reference/plugins/zzogl-pg/opengl/Win32/Conf.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 174 - (hide annotations) (download)
Mon Sep 13 17:24:24 2010 UTC (10 years ago) by william
File size: 3179 byte(s)
merge r171-173 from https://svn.netsolutions.dnsalias.com/websvn/ps2/pcsx2/pcsx2_0.9.7/branch/debug/0.X/0.9.X/0.9.7/r3113
-- pick up:
* local versioning support from trunk
* get rig of annoying warnings
1 william 31 #include <stdlib.h>
2    
3     #include "GS.h"
4     #include "Win32.h"
5    
6     extern HINSTANCE hInst;
7    
8    
9     void SaveConfig()
10     {
11     char szValue[256];
12     const std::string iniFile(s_strIniPath + "zzogl-pg.ini");
13    
14     sprintf(szValue, "%u", conf.interlace);
15     WritePrivateProfileString("Settings", "Interlace", szValue, iniFile.c_str());
16     sprintf(szValue, "%u", conf.aa);
17     WritePrivateProfileString("Settings", "Antialiasing", szValue, iniFile.c_str());
18     sprintf(szValue, "%u", conf.bilinear);
19     WritePrivateProfileString("Settings", "Bilinear", szValue, iniFile.c_str());
20     sprintf(szValue, "%u", conf.options);
21     WritePrivateProfileString("Settings", "Options", szValue, iniFile.c_str());
22     sprintf(szValue, "%u", conf.gamesettings);
23     WritePrivateProfileString("Settings", "AdvancedOptions", szValue, iniFile.c_str());
24     sprintf(szValue, "%u", conf.width);
25     WritePrivateProfileString("Settings", "Width", szValue, iniFile.c_str());
26     sprintf(szValue, "%u", conf.height);
27     WritePrivateProfileString("Settings", "Height", szValue, iniFile.c_str());
28     }
29    
30     void LoadConfig()
31     {
32     char szValue[256];
33     const std::string iniFile(s_strIniPath + "zzogl-pg.ini");
34    
35     memset(&conf, 0, sizeof(conf));
36     conf.interlace = 0; // on, mode 1
37     conf.mrtdepth = 1;
38     conf.options = 0;
39     conf.bilinear = 1;
40     conf.width = 640;
41     conf.height = 480;
42    
43     FILE *fp = fopen(iniFile.c_str(), "rt");
44    
45     if (!fp)
46     {
47     CreateDirectory(s_strIniPath.c_str(), NULL);
48     SaveConfig();//save and return
49     return ;
50     }
51    
52     fclose(fp);
53    
54     GetPrivateProfileString("Settings", "Interlace", NULL, szValue, 20, iniFile.c_str());
55     conf.interlace = (u8)strtoul(szValue, NULL, 10);
56     GetPrivateProfileString("Settings", "Antialiasing", NULL, szValue, 20, iniFile.c_str());
57     conf.aa = (u8)strtoul(szValue, NULL, 10);
58     GetPrivateProfileString("Settings", "Options", NULL, szValue, 20, iniFile.c_str());
59     conf.options = strtoul(szValue, NULL, 10);
60     GetPrivateProfileString("Settings", "AdvancedOptions", NULL, szValue, 20, iniFile.c_str());
61     conf.gamesettings = strtoul(szValue, NULL, 10);
62     GetPrivateProfileString("Settings", "Bilinear", NULL, szValue, 20, iniFile.c_str());
63 william 174 conf.bilinear = (u8)strtoul(szValue, NULL, 10);
64 william 31 GetPrivateProfileString("Settings", "Width", NULL, szValue, 20, iniFile.c_str());
65     conf.width = strtoul(szValue, NULL, 10);
66     GetPrivateProfileString("Settings", "Height", NULL, szValue, 20, iniFile.c_str());
67     conf.height = strtoul(szValue, NULL, 10);
68    
69     if (conf.aa < 0 || conf.aa > 4) conf.aa = 0;
70    
71     conf.isWideScreen = ((conf.options & GSOPTION_WIDESCREEN) != 0);
72    
73     switch (conf.options & GSOPTION_WINDIMS)
74     {
75     case GSOPTION_WIN640:
76     conf.width = 640;
77     conf.height = conf.isWideScreen ? 360 : 480;
78     break;
79    
80     case GSOPTION_WIN800:
81     conf.width = 800;
82     conf.height = conf.isWideScreen ? 450 : 600;
83     break;
84    
85     case GSOPTION_WIN1024:
86     conf.width = 1024;
87     conf.height = conf.isWideScreen ? 576 : 768;
88     break;
89    
90     case GSOPTION_WIN1280:
91     conf.width = 1280;
92     conf.height = conf.isWideScreen ? 720 : 960;
93     break;
94     }
95    
96     // turn off all hacks by defaultof
97     conf.options &= ~(GSOPTION_WIREFRAME | GSOPTION_CAPTUREAVI);
98    
99     conf.options |= GSOPTION_LOADED;
100    
101     if (conf.width <= 0 || conf.height <= 0)
102     {
103     conf.width = 640;
104     conf.height = 480;
105     }
106     }

  ViewVC Help
Powered by ViewVC 1.1.22