/[pcsx2_0.9.7]/trunk/plugins/spu2-x/src/Linux/CfgHelpers.cpp
ViewVC logotype

Contents of /trunk/plugins/spu2-x/src/Linux/CfgHelpers.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 62 - (show annotations) (download)
Tue Sep 7 11:08:22 2010 UTC (9 years, 9 months ago) by william
File size: 2467 byte(s)
Auto Commited Import of: pcsx2-0.9.7-r3738-debug in ./trunk
1 /* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2
2 * Developed and maintained by the Pcsx2 Development Team.
3 *
4 * Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz]
5 *
6 * SPU2-X is free software: you can redistribute it and/or modify it under the terms
7 * of the GNU Lesser General Public License as published by the Free Software Found-
8 * ation, either version 3 of the License, or (at your option) any later version.
9 *
10 * SPU2-X is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
11 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 * PURPOSE. See the GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with SPU2-X. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #include "Dialogs.h"
19 #include <wx/fileconf.h>
20
21 wxFileConfig *spuConfig = NULL;
22 wxString path(L"~/.pcsx2/inis/spu2-x.ini");
23 bool pathSet = false;
24
25 void initIni()
26 {
27 if (spuConfig == NULL) spuConfig = new wxFileConfig(L"", L"", path, L"", wxCONFIG_USE_LOCAL_FILE);
28 }
29
30 void setIni(const wchar_t* Section)
31 {
32 initIni();
33 spuConfig->SetPath(wxsFormat(L"/%s", Section));
34 }
35
36 void CfgSetSettingsDir(const char* dir)
37 {
38 FileLog("CfgSetSettingsDir(%s)\n", dir);
39 path = wxString::FromAscii(dir) + L"/spu2-x.ini";
40 pathSet = true;
41 }
42
43 void CfgWriteBool(const wchar_t* Section, const wchar_t* Name, bool Value)
44 {
45 setIni(Section);
46 spuConfig->Write(Name, Value);
47 }
48
49 void CfgWriteInt(const wchar_t* Section, const wchar_t* Name, int Value)
50 {
51 setIni(Section);
52 spuConfig->Write(Name, Value);
53 }
54
55 void CfgWriteStr(const wchar_t* Section, const wchar_t* Name, const wxString& Data)
56 {
57 setIni(Section);
58 spuConfig->Write(Name, Data);
59 }
60
61 bool CfgReadBool(const wchar_t *Section,const wchar_t* Name, bool Default)
62 {
63 bool ret;
64
65 setIni(Section);
66 spuConfig->Read(Name, &ret, Default);
67
68 return ret;
69 }
70
71 int CfgReadInt(const wchar_t* Section, const wchar_t* Name,int Default)
72 {
73 int ret;
74
75 setIni(Section);
76 spuConfig->Read(Name, &ret, Default);
77
78 return ret;
79 }
80
81 void CfgReadStr(const wchar_t* Section, const wchar_t* Name, wchar_t* Data, int DataSize, const wchar_t* Default)
82 {
83 setIni(Section);
84 wcscpy(Data, spuConfig->Read(Name, Default));
85 }
86
87 void CfgReadStr(const wchar_t* Section, const wchar_t* Name, wxString& Data, const wchar_t* Default)
88 {
89 setIni(Section);
90 Data = spuConfig->Read(Name, Default);
91 }

  ViewVC Help
Powered by ViewVC 1.1.22