22726e4d |
1 | /****************************************************************************** |
2 | * Arachnoid Graphics Plugin for Mupen64Plus |
3 | * http://bitbucket.org/wahrhaft/mupen64plus-video-arachnoid/ |
4 | * |
5 | * Copyright (C) 2009 Jon Ring |
6 | * Copyright (C) 2007 Kristofer Karlsson, Rickard Niklasson |
7 | * |
8 | * This program is free software; you can redistribute it and/or |
9 | * modify it under the terms of the GNU General Public License |
10 | * as published by the Free Software Foundation; either version 2 |
11 | * of the License, or (at your option) any later version. |
12 | * |
13 | * This program is distributed in the hope that it will be useful, |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | * GNU General Public License for more details. |
17 | * |
18 | * You should have received a copy of the GNU General Public License |
19 | * along with this program; if not, write to the Free Software |
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
21 | *****************************************************************************/ |
22 | |
23 | #include "Config.h" |
24 | #include <cstdio> |
25 | #include "GraphicsPlugin.h" |
26 | #include "Logger.h" |
27 | |
28 | //----------------------------------------------------------------------------- |
29 | //! Constructor |
30 | //----------------------------------------------------------------------------- |
31 | Config::Config(GraphicsPlugin* graphicsPlugin) |
32 | { |
33 | m_graphicsPlugin = graphicsPlugin; |
34 | } |
35 | |
36 | //----------------------------------------------------------------------------- |
37 | //! Destructor |
38 | //----------------------------------------------------------------------------- |
39 | Config::~Config() |
40 | { |
41 | } |
42 | |
43 | bool Config::initialize() |
44 | { |
45 | if (ConfigOpenSection("Video-General", &m_videoGeneralSection) != M64ERR_SUCCESS || |
46 | ConfigOpenSection("Video-Arachnoid", &m_videoArachnoidSection) != M64ERR_SUCCESS) |
47 | { |
48 | Logger::getSingleton().printMsg("Could not open configuration", M64MSG_ERROR); |
49 | return false; |
50 | } |
51 | |
52 | ConfigSetDefaultBool(m_videoGeneralSection, "Fullscreen", false, "Use fullscreen mode if True, or windowed mode if False"); |
53 | ConfigSetDefaultInt(m_videoGeneralSection, "ScreenWidth", 640, "Width of output window or fullscreen width"); |
54 | ConfigSetDefaultInt(m_videoGeneralSection, "ScreenHeight", 480, "Height of output window or fullscreen height"); |
55 | ConfigSetDefaultInt(m_videoArachnoidSection, "ColorDepth", 32, "Color bit-depth in fullscreen mode"); |
56 | ConfigSetDefaultInt(m_videoArachnoidSection, "RefreshRate", 60, "Screen refresh-rate in fullscreen mode"); |
57 | ConfigSetDefaultInt(m_videoArachnoidSection, "TextureCacheSize", 15 * (1024 * 1024), "Size of texture cache used to store textures"); |
58 | ConfigSetDefaultBool(m_videoArachnoidSection, "Wireframe", false, "Render in wireframe?"); |
59 | ConfigSetDefaultBool(m_videoArachnoidSection, "Fog", false, "Render fog?"); |
60 | ConfigSetDefaultInt(m_videoArachnoidSection, "MultiSampling", 0, "Use MultiSampling? 0=no 2,4,8,16=quality"); |
61 | ConfigSetDefaultInt(m_videoArachnoidSection, "Mipmapping", 0, "Use Mipmapping? 0=no, 1=nearest, 2=bilinear, 3=trilinear"); |
62 | #ifdef WIN32 |
63 | ConfigSetDefaultInt(m_videoArachnoidSection, "ScreenUpdateSetting", SCREEN_UPDATE_CI, "When to update the screen: 1 - on VI, 2 - on first CI"); |
64 | #else |
65 | ConfigSetDefaultInt(m_videoArachnoidSection, "ScreenUpdateSetting", SCREEN_UPDATE_VI, "When to update the screen: 1 - on VI, 2 - on first CI"); |
66 | #endif |
67 | ConfigSetDefaultBool(m_videoArachnoidSection, "FrameSkip", false, "Use FrameSkipping?"); |
68 | return true; |
69 | } |
70 | |
71 | void Config::load() |
72 | { |
73 | m_cfg.fullscreenWidth = ConfigGetParamInt(m_videoGeneralSection, "ScreenWidth"); |
74 | m_cfg.fullscreenHeight = ConfigGetParamInt(m_videoGeneralSection, "ScreenHeight"); |
75 | m_cfg.fullscreenBitDepth = ConfigGetParamInt(m_videoArachnoidSection, "ColorDepth"); |
76 | m_cfg.fullscreenRefreshRate = ConfigGetParamInt(m_videoArachnoidSection, "RefreshRate"); |
77 | m_cfg.windowWidth = ConfigGetParamInt(m_videoGeneralSection, "ScreenWidth"); |
78 | m_cfg.windowHeight = ConfigGetParamInt(m_videoGeneralSection, "ScreenHeight"); |
79 | m_cfg.startFullscreen = ConfigGetParamBool(m_videoGeneralSection, "Fullscreen"); |
80 | m_cfg.textureCacheSize = ConfigGetParamInt(m_videoArachnoidSection, "TextureCacheSize"); |
81 | m_cfg.wireframe = ConfigGetParamBool(m_videoArachnoidSection, "Wireframe"); |
82 | m_cfg.fog = ConfigGetParamBool(m_videoArachnoidSection, "Fog"); |
83 | m_cfg.multiSampling = ConfigGetParamBool(m_videoArachnoidSection, "MultiSampling"); |
84 | m_cfg.mipmapping = ConfigGetParamInt(m_videoArachnoidSection, "Mipmapping"); |
85 | m_cfg.screenUpdateSetting = ConfigGetParamInt(m_videoArachnoidSection, "ScreenUpdateSetting"); |
86 | m_cfg.frameSkip = ConfigGetParamBool(m_videoArachnoidSection, "FrameSkip"); |
87 | } |