1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
/**
* Copyright (C) 2005-2012 Gekko Emulator
*
* @file config.cpp
* @author ShizZy <shizzy247@gmail.com>
* @date 2012-02-19
* @brief Emulator configuration class - all config settings stored here
*
* @section LICENSE
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details at
* http://www.gnu.org/copyleft/gpl.html
*
* Official project repository can be found at:
* http://code.google.com/p/gekko-gc-emu/
*/
#include "common.h"
#include "config.h"
#include "xml.h"
namespace common {
Config* g_config;
Config::Config() {
ResolutionType default_res;
RendererConfig default_renderer_config;
default_renderer_config.enable_wireframe = false;
default_renderer_config.enable_shaders = true;
default_renderer_config.enable_texture_dumping = false;
default_renderer_config.enable_textures = true;
default_renderer_config.anti_aliasing_mode = 0;
default_renderer_config.anistropic_filtering_mode = 0;
default_res.width = 640;
default_res.height = 480;
set_program_dir("", MAX_PATH);
set_enable_multicore(true);
set_enable_idle_skipping(false);
set_enable_hle(true);
set_enable_auto_boot(true);
set_enable_cheats(false);
set_default_boot_file("", MAX_PATH);
memset(dvd_image_paths_, 0, sizeof(dvd_image_paths_));
set_enable_show_fps(true);
set_enable_dump_opcode0(false);
set_enable_pause_on_unknown_opcode(true);
set_enable_dump_gcm_reads(false);
set_enable_ipl(false);
set_powerpc_core(CPU_INTERPRETER);
set_powerpc_frequency(486);
memset(renderer_config_, 0, sizeof(renderer_config_));
set_renderer_config(RENDERER_OPENGL_3, default_renderer_config);
set_current_renderer(RENDERER_OPENGL_3);
set_enable_fullscreen(false);
set_window_resolution(default_res);
set_fullscreen_resolution(default_res);
memset(controller_ports_, 0, sizeof(controller_ports_));
memset(mem_slots_, 0, sizeof(mem_slots_));
memset(patches_, 0, sizeof(patches_));
memset(cheats_, 0, sizeof(patches_));
}
Config::~Config() {
}
ConfigManager::ConfigManager() {
set_program_dir("", MAX_PATH);
}
ConfigManager::~ConfigManager() {
}
/**
* @brief Reload a game-specific configuration
* @param id Game id (to load game specific configuration)
*/
void ConfigManager::ReloadGameConfig(const char* id) {
char full_filename[MAX_PATH];
sprintf(full_filename, "user/games/%s.xml", id);
common::LoadXMLConfig(*g_config, full_filename);
}
/// Reload the userconfig file
void ConfigManager::ReloadUserConfig() {
common::LoadXMLConfig(*g_config, "userconf.xml");
}
/// Reload the sysconfig file
void ConfigManager::ReloadSysConfig() {
common::LoadXMLConfig(*g_config, "sysconf.xml");
}
/// Reload all configurations
void ConfigManager::ReloadConfig(const char* game_id) {
delete g_config;
g_config = new Config();
g_config->set_program_dir(program_dir_, MAX_PATH);
ReloadSysConfig();
ReloadUserConfig();
ReloadGameConfig(game_id);
}
} // namspace
|