/[pcsx2_0.9.7]/branch/debug/0.X/0.9.X/0.9.7/r3113/plugins/zerogs/dx/Windows/Conf.cpp
ViewVC logotype

Contents of /branch/debug/0.X/0.9.X/0.9.7/r3113/plugins/zerogs/dx/Windows/Conf.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 171 - (show annotations) (download)
Mon Sep 13 16:38:21 2010 UTC (10 years, 2 months ago) by william
File size: 2860 byte(s)
fix warnings

1 #if defined(_WIN32) || defined(__WIN32__)
2 #include <d3dx9.h>
3 #include <dxerr.h>
4 #endif
5
6 #include <stdlib.h>
7
8 #include "Win32.h"
9
10 extern HINSTANCE hInst;
11
12 void SaveConfig() {
13
14 char szValue[256];
15 const std::string iniFile( s_strIniPath + "zerogs.ini" );
16
17 sprintf(szValue,"%u",conf.interlace);
18 WritePrivateProfileString("Settings", "Interlace",szValue,iniFile.c_str());
19 sprintf(szValue,"%u",conf.aa);
20 WritePrivateProfileString("Settings", "Antialiasing",szValue,iniFile.c_str());
21 sprintf(szValue,"%u",conf.bilinear);
22 WritePrivateProfileString("Settings", "Bilinear",szValue,iniFile.c_str());
23 sprintf(szValue,"%u",conf.options);
24 WritePrivateProfileString("Settings", "Options",szValue,iniFile.c_str());
25 sprintf(szValue,"%u",conf.gamesettings);
26 WritePrivateProfileString("Settings", "AdvancedOptions",szValue,iniFile.c_str());
27 }
28
29 void LoadConfig() {
30
31 char szValue[256];
32 const std::string iniFile( s_strIniPath + "zerogs.ini" );
33
34 memset(&conf, 0, sizeof(conf));
35 conf.interlace = 0; // on, mode 1
36 conf.mrtdepth = 1;
37 conf.options = 0;
38 conf.bilinear = 1;
39 conf.width = 640;
40 conf.height = 480;
41
42 FILE *fp=fopen(iniFile.c_str(),"rt");
43 if (!fp)
44 {
45 CreateDirectory(s_strIniPath.c_str(),NULL);
46 SaveConfig();//save and return
47 return ;
48 }
49 fclose(fp);
50
51 GetPrivateProfileString("Settings", "Interlace", NULL, szValue, 20, iniFile.c_str());
52 conf.interlace = (u8)strtoul(szValue, NULL, 10);
53 GetPrivateProfileString("Settings", "Antialiasing", NULL, szValue, 20, iniFile.c_str());
54 conf.aa = (u8)strtoul(szValue, NULL, 10);
55 GetPrivateProfileString("Settings", "Options", NULL, szValue, 20, iniFile.c_str());
56 conf.options = strtoul(szValue, NULL, 10);
57 GetPrivateProfileString("Settings", "AdvancedOptions", NULL, szValue, 20, iniFile.c_str());
58 conf.gamesettings = strtoul(szValue, NULL, 10);
59 GetPrivateProfileString("Settings", "Bilinear", NULL, szValue, 20, iniFile.c_str());
60 conf.bilinear = (u8)strtoul(szValue, NULL, 10);
61
62 if( conf.aa < 0 || conf.aa > 4 ) conf.aa = 0;
63
64 switch(conf.options&GSOPTION_WINDIMS) {
65 case GSOPTION_WIN640:
66 conf.width = 640;
67 conf.height = 480;
68 break;
69 case GSOPTION_WIN800:
70 conf.width = 800;
71 conf.height = 600;
72 break;
73 case GSOPTION_WIN1024:
74 conf.width = 1024;
75 conf.height = 768;
76 break;
77 case GSOPTION_WIN1280:
78 conf.width = 1280;
79 conf.height = 960;
80 break;
81 case GSOPTION_WIN960W:
82 conf.width = 960;
83 conf.height = 540;
84 break;
85 case GSOPTION_WIN1280W:
86 conf.width = 1280;
87 conf.height = 720;
88 break;
89 case GSOPTION_WIN1920W:
90 conf.width = 1920;
91 conf.height = 1080;
92 break;
93 }
94
95 // turn off all hacks by defaultof
96 conf.options &= ~(GSOPTION_FULLSCREEN|GSOPTION_WIREFRAME|GSOPTION_CAPTUREAVI);
97 conf.options |= GSOPTION_LOADED;
98
99 if( conf.width <= 0 || conf.height <= 0 ) {
100 conf.width = 640;
101 conf.height = 480;
102 }
103 }

  ViewVC Help
Powered by ViewVC 1.1.22