/[pcsx2_0.9.7]/trunk/plugins/dev9null/Config.cpp
ViewVC logotype

Contents of /trunk/plugins/dev9null/Config.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 31 - (show annotations) (download)
Tue Sep 7 03:24:11 2010 UTC (10 years, 9 months ago) by william
File size: 1865 byte(s)
committing r3113 initial commit again...
1 /* DEV9null
2 * Copyright (C) 2002-2010 Pcsx2 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19 #include <string>
20 using namespace std;
21
22 #include "Config.h"
23 #include "DEV9.h"
24
25 extern string s_strIniPath;
26 extern PluginLog Dev9Log;
27 PluginConf Ini;
28
29 void setLoggingState()
30 {
31 if (conf.Log)
32 {
33 Dev9Log.WriteToConsole = true;
34 Dev9Log.WriteToFile = true;
35 }
36 else
37 {
38 Dev9Log.WriteToConsole = false;
39 Dev9Log.WriteToFile = false;
40 }
41 }
42
43 EXPORT_C_(void) DEV9about()
44 {
45 SysMessage("Dev9null: A simple null plugin.");
46 }
47
48 EXPORT_C_(void) DEV9configure()
49 {
50 LoadConfig();
51 PluginNullConfigure("Since this is a null plugin, all that is really configurable is logging.", conf.Log);
52 SaveConfig();
53 }
54
55 void LoadConfig()
56 {
57 string IniPath = s_strIniPath + "/Dev9null.ini";
58 if (!Ini.Open(IniPath, READ_FILE))
59 {
60 Dev9Log.WriteLn("Failed to open %s", IniPath.c_str());
61 SaveConfig();
62 return;
63 }
64
65 conf.Log = Ini.ReadInt("logging",0);
66 Ini.Close();
67 }
68
69 void SaveConfig()
70 {
71 string IniPath = s_strIniPath + "/Dev9null.ini";
72 if (!Ini.Open(IniPath, WRITE_FILE))
73 {
74 Dev9Log.WriteLn("Failed to open %s", IniPath.c_str());
75 return;
76 }
77
78 Ini.WriteInt("logging", conf.Log);
79 Ini.Close();
80 }
81

  ViewVC Help
Powered by ViewVC 1.1.22