Linux global build. At least the basic footwork is done here.

Basic usage:  "sudo scons install=global install"
Hopefully this doesn't break builds on Macs.  I have tested this on linux and windows.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4994 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Glenn Rice 2010-02-02 21:56:29 +00:00
parent a090876bbd
commit feba09f7a3
79 changed files with 652 additions and 403 deletions

View File

@ -110,6 +110,13 @@ vars.AddVariables(
BoolVariable('wxgl', 'Set For Building with WX GL libs (WIP)', False), BoolVariable('wxgl', 'Set For Building with WX GL libs (WIP)', False),
BoolVariable('opencl', 'Build with OpenCL', False), BoolVariable('opencl', 'Build with OpenCL', False),
BoolVariable('nojit', 'Remove entire jit cores', False), BoolVariable('nojit', 'Remove entire jit cores', False),
PathVariable('userdir', 'Set the name of the user data directory in home', '.dolphin-emu', PathVariable.PathAccept),
EnumVariable('install', 'Choose a local or global installation', 'local',
allowed_values = ('local', 'global'),
ignorecase = 2
),
PathVariable('prefix', 'Installation prefix (only used for a global build)', '/usr', PathVariable.PathAccept),
PathVariable('destdir', 'Temporary install location (for package building)', None, PathVariable.PathAccept),
EnumVariable('flavor', 'Choose a build flavor', 'release', EnumVariable('flavor', 'Choose a build flavor', 'release',
allowed_values = ('release', 'devel', 'debug', 'fastlog', 'prof'), allowed_values = ('release', 'devel', 'debug', 'fastlog', 'prof'),
ignorecase = 2 ignorecase = 2
@ -225,6 +232,56 @@ env['build_dir'] = os.path.join(basedir, 'Build', platform.system() + '-' + plat
VariantDir(env['build_dir'], '.', duplicate=0) VariantDir(env['build_dir'], '.', duplicate=0)
# Where do we run from
env['base_dir'] = os.getcwd()+ '/'
# install paths
extra=''
if flavour == 'debug':
extra = '-debug'
elif flavour == 'prof':
extra = '-prof'
# TODO: support global install
if (ARGUMENTS.get('install') == 'global'):
env['prefix'] = os.path.join(env['prefix'] + os.sep)
else:
env['prefix'] = os.path.join(env['base_dir'] + 'Binary', platform.system() + '-' + platform.machine() + extra +os.sep)
#TODO add lib
if (ARGUMENTS.get('install') == 'global'):
env['plugin_dir'] = env['prefix'] + 'lib/dolphin-emu/'
else:
if sys.platform == 'darwin':
env['plugin_dir'] = env['prefix'] + 'Dolphin.app/Contents/PlugIns/'
else:
env['plugin_dir'] = env['prefix'] + 'Plugins/'
#TODO add bin
if (ARGUMENTS.get('install') == 'global'):
env['binary_dir'] = env['prefix'] + 'bin/'
else:
env['binary_dir'] = env['prefix']
#TODO add bin
if (ARGUMENTS.get('install') == 'global'):
env['libs_dir'] = env['prefix'] + 'lib/'
else:
env['libs_dir'] = env['prefix'] + 'Libs/'
#TODO where should this go?
if (ARGUMENTS.get('install') == 'global'):
env['data_dir'] = env['prefix'] + "share/dolphin-emu/"
else:
if sys.platform == 'darwin':
env['data_dir'] = env['prefix'] + 'Dolphin.app/Contents/'
else:
env['data_dir'] = env['prefix']
env['RPATH'].append(env['libs_dir'])
# static libs goes here
env['local_libs'] = env['build_dir'] + os.sep + 'libs' + os.sep
env['LIBPATH'].append(env['local_libs'])
env['LIBPATH'].append(env['libs_dir'])
conf = env.Configure(custom_tests = tests, conf = env.Configure(custom_tests = tests,
config_h="Source/Core/Common/Src/Config.h") config_h="Source/Core/Common/Src/Config.h")
@ -326,6 +383,10 @@ conf.Define('HAVE_X11', env['HAVE_X11'])
conf.Define('HAVE_COCOA', env['HAVE_COCOA']) conf.Define('HAVE_COCOA', env['HAVE_COCOA'])
conf.Define('HAVE_PORTAUDIO', env['HAVE_PORTAUDIO']) conf.Define('HAVE_PORTAUDIO', env['HAVE_PORTAUDIO'])
conf.Define('HAVE_SFML', env['HAVE_SFML']) conf.Define('HAVE_SFML', env['HAVE_SFML'])
conf.Define('USER_DIR', "\"" + env['userdir'] + "\"")
if (ARGUMENTS.get('install') == 'global'):
conf.Define('DATA_DIR', "\"" + env['data_dir'] + "\"")
conf.Define('LIBS_DIR', "\"" + env['libs_dir'] + "\"")
# lua # lua
env['LUA_USE_MACOSX'] = 0 env['LUA_USE_MACOSX'] = 0
@ -376,48 +437,22 @@ else:
# add methods from utils to env # add methods from utils to env
env.AddMethod(utils.filterWarnings) env.AddMethod(utils.filterWarnings)
# Where do we run from
env['base_dir'] = os.getcwd()+ '/'
# install paths
extra=''
if flavour == 'debug':
extra = '-debug'
elif flavour == 'prof':
extra = '-prof'
# TODO: support global install
env['prefix'] = os.path.join(env['base_dir'] + 'Binary', platform.system() + '-' + platform.machine() + extra +os.sep)
#TODO add lib
if sys.platform == 'darwin':
env['plugin_dir'] = env['prefix'] + 'Dolphin.app/Contents/PlugIns/'
else:
env['plugin_dir'] = env['prefix'] + 'Plugins/'
#TODO add bin
env['binary_dir'] = env['prefix']
#TODO add bin
env['libs_dir'] = env['prefix'] + 'Libs/'
#TODO where should this go?
if sys.platform == 'darwin':
env['data_dir'] = env['prefix'] + 'Dolphin.app/Contents/'
else:
env['data_dir'] = env['prefix']
env['RPATH'].append(env['libs_dir'])
# static libs goes here
env['local_libs'] = env['build_dir'] + os.sep + 'libs' + os.sep
env['LIBPATH'].append(env['local_libs'])
env['LIBPATH'].append(env['libs_dir'])
rev = utils.GenerateRevFile(env['flavor'], rev = utils.GenerateRevFile(env['flavor'],
"Source/Core/Common/Src/svnrev_template.h", "Source/Core/Common/Src/svnrev_template.h",
"Source/Core/Common/Src/svnrev.h") "Source/Core/Common/Src/svnrev.h")
# print a nice progress indication when not compiling # print a nice progress indication when not compiling
Progress(['-\r', '\\\r', '|\r', '/\r'], interval = 5) Progress(['-\r', '\\\r', '|\r', '/\r'], interval = 5)
# Setup destdir for package building
# Warning: The program will not run from this location. It is assumed the
# package will later install it to the prefix as it was defined before this.
if env.has_key('destdir'):
env['prefix'] = env['destdir'] + env['prefix']
env['plugin_dir'] = env['destdir'] + env['plugin_dir']
env['binary_dir'] = env['destdir'] + env['binary_dir']
env['libs_dir'] = env['destdir'] + env['libs_dir']
env['data_dir'] = env['destdir'] + env['data_dir']
# die on unknown variables # die on unknown variables
unknown = vars.UnknownVariables() unknown = vars.UnknownVariables()
if unknown: if unknown:
@ -437,12 +472,16 @@ for subdir in dirs:
) )
# Data install # Data install
env.Install(env['data_dir'], 'Data/Sys')
env.Install(env['data_dir'], 'Data/User')
if sys.platform == 'darwin': if sys.platform == 'darwin':
env.Install(env['data_dir'], 'Data/Sys')
env.Install(env['data_dir'], 'Data/User')
env.Install(env['binary_dir'] + 'Dolphin.app/Contents/Resources/', env.Install(env['binary_dir'] + 'Dolphin.app/Contents/Resources/',
'Source/Core/DolphinWX/resources/Dolphin.icns') 'Source/Core/DolphinWX/resources/Dolphin.icns')
else:
env.InstallAs(env['data_dir'] + 'sys', 'Data/Sys')
env.InstallAs(env['data_dir'] + 'user', 'Data/User')
env.Alias('install', env['prefix'])
if env['bundle']: if env['bundle']:
# Make tar ball (TODO put inside normal dir) # Make tar ball (TODO put inside normal dir)

View File

@ -18,6 +18,10 @@
#ifndef _COMMON_PATHS_H_ #ifndef _COMMON_PATHS_H_
#define _COMMON_PATHS_H_ #define _COMMON_PATHS_H_
#ifdef __linux__
#include "Config.h"
#endif
// Library suffix/prefix // Library suffix/prefix
#ifdef _WIN32 #ifdef _WIN32
#define PLUGIN_PREFIX "" #define PLUGIN_PREFIX ""
@ -34,18 +38,25 @@
#define DIR_SEP "/" #define DIR_SEP "/"
#define DIR_SEP_CHR '/' #define DIR_SEP_CHR '/'
#if defined __APPLE__ // Location of the plugins
#ifdef LIBS_DIR
#define PLUGINS_DIR LIBS_DIR "dolphin-emu"
#elif defined __APPLE__
#define PLUGINS_DIR "Contents/PlugIns" #define PLUGINS_DIR "Contents/PlugIns"
#define SYSDATA_DIR "Contents/Sys"
#else #else
#define PLUGINS_DIR "Plugins" #define PLUGINS_DIR "Plugins"
#define SYSDATA_DIR "Sys"
#endif #endif
#define ROOT_DIR "."
#define USERDATA_DIR "User"
// Where data directory is // The user data dir
#ifdef _WIN32 #define ROOT_DIR "."
#ifdef __linux__
#define USERDATA_DIR "user"
#else
#define USERDATA_DIR "User"
#endif
#ifdef USER_DIR
#define DOLPHIN_DATA_DIR USER_DIR
#elif defined _WIN32
#define DOLPHIN_DATA_DIR "Dolphin" #define DOLPHIN_DATA_DIR "Dolphin"
#elif defined __APPLE__ #elif defined __APPLE__
#define DOLPHIN_DATA_DIR "Library/Application Support/Dolphin" #define DOLPHIN_DATA_DIR "Library/Application Support/Dolphin"
@ -53,119 +64,101 @@
#define DOLPHIN_DATA_DIR ".dolphin" #define DOLPHIN_DATA_DIR ".dolphin"
#endif #endif
// Shared data dirs (Sys and shared User for linux)
#ifdef DATA_DIR
#define SYSDATA_DIR DATA_DIR "Sys"
#define SHARED_USER_DIR DATA_DIR USERDATA_DIR DIR_SEP
#elif defined __APPLE__
#define SYSDATA_DIR "Contents/Sys"
#elif defined __linux__
#define SYSDATA_DIR "sys"
#define SHARED_USER_DIR ROOT_DIR DIR_SEP USERDATA_DIR DIR_SEP
#else
#define SYSDATA_DIR "Sys"
#endif
// Dirs in both User and Sys // Dirs in both User and Sys
#define EUR_DIR "EUR" #define EUR_DIR "EUR"
#define USA_DIR "USA" #define USA_DIR "USA"
#define JAP_DIR "JAP" #define JAP_DIR "JAP"
// Dirs in User // Subdirs in the User dir returned by GetUserPath(D_USER_IDX)
#define GC_USER_DIR "GC" #define GC_USER_DIR "GC"
#define WII_USER_DIR "Wii" #define WII_USER_DIR "Wii"
#define WII_SYSCONF_DIR "shared2/sys" #define CONFIG_DIR "Config"
#define CONFIG_DIR "Config" #define GAMECONFIG_DIR "GameConfig"
#define GAMECONFIG_DIR "GameConfig" #define MAPS_DIR "Maps"
#define MAPS_DIR "Maps" #define CACHE_DIR "Cache"
#define CACHE_DIR "Cache" #define SHADERCACHE_DIR "ShaderCache"
#define SHADERCACHE_DIR "ShaderCache" #define STATESAVES_DIR "StateSaves"
#define STATESAVES_DIR "StateSaves" #define SCREENSHOTS_DIR "ScreenShots"
#define SCREENSHOTS_DIR "ScreenShots" #define LOAD_DIR "Load"
#define DUMP_DIR "Dump" #define HIRES_TEXTURES_DIR LOAD_DIR DIR_SEP "Textures"
#define DUMP_TEXTURES_DIR "Textures" #define DUMP_DIR "Dump"
#define LOAD_DIR "Load" #define DUMP_TEXTURES_DIR DUMP_DIR DIR_SEP "Textures"
#define HIRES_TEXTURES_DIR "Textures" #define DUMP_FRAMES_DIR DUMP_DIR DIR_SEP "Frames"
#define DUMP_FRAMES_DIR "Frames" #define DUMP_DSP_DIR DUMP_DIR DIR_SEP "DSP"
#define DUMP_DSP_DIR "DSP" #define LOGS_DIR "Logs"
#define LOGS_DIR "Logs" #define MAIL_LOGS_DIR LOGS_DIR DIR_SEP "Mail"
#define MAIL_LOGS_DIR "Mail" #define SHADERS_DIR "Shaders"
#define WII_SYSCONF_DIR WII_USER_DIR DIR_SEP "shared2" DIR_SEP "sys"
// Dirs in Sys #define WII_MENU_DIR WII_USER_DIR DIR_SEP "title" DIR_SEP "00000001" DIR_SEP "00000002" DIR_SEP "content"
#define GC_SYS_DIR "GC"
#define WII_SYS_DIR "Wii"
// Filenames // Filenames
#define DOLPHIN_CONFIG "Dolphin.ini" // Files in the directory returned by GetUserPath(D_CONFIG_IDX)
#define DEBUGGER_CONFIG "Debugger.ini" #define DOLPHIN_CONFIG "Dolphin.ini"
#define LOGGER_CONFIG "Logger.ini" #define DEBUGGER_CONFIG "Debugger.ini"
#define TOTALDB "totaldb.dsy" #define LOGGER_CONFIG "Logger.ini"
#define MAIN_LOG "dolphin.log"
// Files in the directory returned by GetUserPath(D_LOGS_IDX)
#define MAIN_LOG "dolphin.log"
// Files in the directory returned by GetUserPath(D_WIISYSCONF_IDX)
#define WII_SYSCONF "SYSCONF"
// Files in the directory returned by GetUserPath(D_DUMP_IDX)
#define RAM_DUMP "ram.raw"
#define ARAM_DUMP "aram.raw"
// Plugin files
#define DEFAULT_GFX_PLUGIN PLUGIN_PREFIX "Plugin_VideoOGL" PLUGIN_SUFFIX #define DEFAULT_GFX_PLUGIN PLUGIN_PREFIX "Plugin_VideoOGL" PLUGIN_SUFFIX
#define DEFAULT_DSP_PLUGIN PLUGIN_PREFIX "Plugin_DSP_HLE" PLUGIN_SUFFIX #define DEFAULT_DSP_PLUGIN PLUGIN_PREFIX "Plugin_DSP_HLE" PLUGIN_SUFFIX
#define DEFAULT_PAD_PLUGIN PLUGIN_PREFIX "Plugin_GCPad" PLUGIN_SUFFIX #define DEFAULT_PAD_PLUGIN PLUGIN_PREFIX "Plugin_GCPad" PLUGIN_SUFFIX
#define DEFAULT_WIIMOTE_PLUGIN PLUGIN_PREFIX "Plugin_Wiimote" PLUGIN_SUFFIX #define DEFAULT_WIIMOTE_PLUGIN PLUGIN_PREFIX "Plugin_Wiimote" PLUGIN_SUFFIX
#define FONT_ANSI "font_ansi.bin" // Sys files
#define FONT_SJIS "font_sjis.bin" #define TOTALDB "totaldb.dsy"
#define DSP_IROM "dsp_rom.bin" #define FONT_ANSI "font_ansi.bin"
#define DSP_COEF "dsp_coef.bin" #define FONT_SJIS "font_sjis.bin"
#define GC_IPL "IPL.bin" #define DSP_IROM "dsp_rom.bin"
#define GC_SRAM "SRAM.raw" #define DSP_COEF "dsp_coef.bin"
#define GC_MEMCARDA "MemoryCardA"
#define GC_MEMCARDB "MemoryCardB" #define GC_IPL "IPL.bin"
#define GC_SRAM "SRAM.raw"
#define GC_MEMCARDA "MemoryCardA"
#define GC_MEMCARDB "MemoryCardB"
#define WII_EUR_SETTING "setting-eur.txt" #define WII_EUR_SETTING "setting-eur.txt"
#define WII_USA_SETTING "setting-usa.txt" #define WII_USA_SETTING "setting-usa.txt"
#define WII_JAP_SETTING "setting-jpn.txt" #define WII_JAP_SETTING "setting-jpn.txt"
#define WII_SYSCONF "SYSCONF"
#define RAM_DUMP "ram.raw" // Subdirs in Sys
#define ARAM_DUMP "aram.raw" #define GC_SYS_DIR "GC"
#define WII_SYS_DIR "Wii"
// Shorts - dirs // Full Sys dirs
// User dirs
#define FULL_USERDATA_DIR ROOT_DIR DIR_SEP USERDATA_DIR DIR_SEP
#define T_FULLUSERDATA_DIR _T(ROOT_DIR) _T(DIR_SEP) _T(USERDATA_DIR) _T(DIR_SEP)
#define FULL_GC_USER_DIR FULL_USERDATA_DIR GC_USER_DIR DIR_SEP
#define T_FULL_GC_USER_DIR T_FULLUSERDATA_DIR _T(GC_USER_DIR) _T(DIR_SEP)
#define FULL_WII_USER_DIR FULL_USERDATA_DIR WII_USER_DIR DIR_SEP
#define FULL_WII_ROOT_DIR FULL_USERDATA_DIR WII_USER_DIR // This is the "root" for Wii fs, so that it may be used with created devices
#define FULL_GAMECONFIG_DIR FULL_USERDATA_DIR GAMECONFIG_DIR DIR_SEP
#define T_FULL_GAMECONFIG_DIR T_FULLUSERDATA_DIR _T(GAMECONFIG_DIR) _T(DIR_SEP)
#define FULL_CONFIG_DIR FULL_USERDATA_DIR CONFIG_DIR DIR_SEP
#define FULL_CACHE_DIR FULL_USERDATA_DIR CACHE_DIR DIR_SEP
#define FULL_SHADERCACHE_DIR FULL_USERDATA_DIR SHADERCACHE_DIR DIR_SEP
#define FULL_STATESAVES_DIR FULL_USERDATA_DIR STATESAVES_DIR DIR_SEP
#define FULL_SCREENSHOTS_DIR FULL_USERDATA_DIR SCREENSHOTS_DIR DIR_SEP
#define FULL_FRAMES_DIR FULL_USERDATA_DIR DUMP_DIR DIR_SEP DUMP_FRAMES_DIR
#define FULL_DUMP_DIR FULL_USERDATA_DIR DUMP_DIR DIR_SEP
#define FULL_DUMP_TEXTURES_DIR FULL_USERDATA_DIR DUMP_DIR DIR_SEP DUMP_TEXTURES_DIR DIR_SEP
#define FULL_HIRES_TEXTURES_DIR FULL_USERDATA_DIR LOAD_DIR DIR_SEP HIRES_TEXTURES_DIR DIR_SEP
#define FULL_DSP_DUMP_DIR FULL_USERDATA_DIR DUMP_DIR DIR_SEP DUMP_DSP_DIR DIR_SEP
#define FULL_LOGS_DIR FULL_USERDATA_DIR LOGS_DIR DIR_SEP
#define FULL_MAIL_LOGS_DIR FULL_LOGS_DIR MAIL_LOGS_DIR DIR_SEP
#define FULL_MAPS_DIR FULL_USERDATA_DIR MAPS_DIR DIR_SEP
#define FULL_WII_SYSCONF_DIR FULL_WII_USER_DIR WII_SYSCONF_DIR DIR_SEP
// Sys dirs
#define FULL_SYSDATA_DIR ROOT_DIR DIR_SEP SYSDATA_DIR DIR_SEP #define FULL_SYSDATA_DIR ROOT_DIR DIR_SEP SYSDATA_DIR DIR_SEP
#define FULL_GC_SYS_DIR FULL_SYSDATA_DIR GC_SYS_DIR DIR_SEP
#define FULL_GC_SYS_DIR FULL_SYSDATA_DIR GC_SYS_DIR DIR_SEP //#define GC_SYS_EUR_DIR FULL_GC_SYS_DIR EUR_DIR
//#define GC_SYS_EUR_DIR FULL_GC_SYS_DIR EUR_DIR //#define GC_SYS_USA_DIR FULL_GC_SYS_DIR USA_DIR
//#define GC_SYS_USA_DIR FULL_GC_SYS_DIR USA_DIR //#define GC_SYS_JAP_DIR FULL_GC_SYS_DIR JAP_DIR
//#define GC_SYS_JAP_DIR FULL_GC_SYS_DIR JAP_DIR
#define FULL_WII_SYS_DIR FULL_SYSDATA_DIR WII_SYS_DIR DIR_SEP #define FULL_WII_SYS_DIR FULL_SYSDATA_DIR WII_SYS_DIR DIR_SEP
// Shorts - files // Sys files with full path
// User files #define TOTALDB_FILE FULL_SYSDATA_DIR TOTALDB
#define CONFIG_FILE FULL_CONFIG_DIR DOLPHIN_CONFIG
#define DEBUGGER_CONFIG_FILE FULL_CONFIG_DIR DEBUGGER_CONFIG
#define LOGGER_CONFIG_FILE FULL_CONFIG_DIR LOGGER_CONFIG
#define TOTALDB_FILE FULL_SYSDATA_DIR TOTALDB
#define MAINRAM_DUMP_FILE FULL_DUMP_DIR RAM_DUMP
#define ARAM_DUMP_FILE FULL_DUMP_DIR ARAM_DUMP
#define GC_SRAM_FILE FULL_USERDATA_DIR GC_USER_DIR DIR_SEP GC_SRAM
#define MAIN_LOG_FILE FULL_LOGS_DIR MAIN_LOG
// Sys files
#define FONT_ANSI_FILE FULL_GC_SYS_DIR FONT_ANSI #define FONT_ANSI_FILE FULL_GC_SYS_DIR FONT_ANSI
#define FONT_SJIS_FILE FULL_GC_SYS_DIR FONT_SJIS #define FONT_SJIS_FILE FULL_GC_SYS_DIR FONT_SJIS
@ -175,8 +168,5 @@
#define WII_EUR_SETTING_FILE FULL_WII_SYS_DIR WII_EUR_SETTING #define WII_EUR_SETTING_FILE FULL_WII_SYS_DIR WII_EUR_SETTING
#define WII_USA_SETTING_FILE FULL_WII_SYS_DIR WII_USA_SETTING #define WII_USA_SETTING_FILE FULL_WII_SYS_DIR WII_USA_SETTING
#define WII_JAP_SETTING_FILE FULL_WII_SYS_DIR WII_JAP_SETTING #define WII_JAP_SETTING_FILE FULL_WII_SYS_DIR WII_JAP_SETTING
#define WII_SYSCONF_FILE FULL_WII_SYSCONF_DIR WII_SYSCONF
#define FULL_WII_MENU_DIR FULL_WII_USER_DIR "title" DIR_SEP "00000001" DIR_SEP "00000002" DIR_SEP "content"
#endif // _COMMON_PATHS_H_ #endif // _COMMON_PATHS_H_

View File

@ -487,6 +487,41 @@ bool DeleteDirRecursively(const char *directory)
return true; return true;
} }
#ifdef __linux__
//Create directory and copy contents (does not overwrite existing files)
void CopyDir(const char *source_path, const char *dest_path)
{
if (!File::Exists(source_path))
return;
if (!File::Exists(dest_path)) File::CreateFullPath(dest_path);
char *virtualName;
struct dirent dirent, *result = NULL;
DIR *dirp = opendir(source_path);
if (!dirp)
return;
while (!readdir_r(dirp, &dirent, &result) && result) {
virtualName = result->d_name;
// check for "." and ".."
if (((virtualName[0] == '.') && (virtualName[1] == '\0')) ||
((virtualName[0] == '.') && (virtualName[1] == '.') &&
(virtualName[2] == '\0')))
continue;
char source[300], dest[300];
sprintf(source, "%s%s", source_path, virtualName);
sprintf(dest, "%s%s", dest_path, virtualName);
if (IsDirectory(source)) {
sprintf(source, "%s/", source);
sprintf(dest, "%s/", dest);
if (!File::Exists(dest)) File::CreateFullPath(dest);
CopyDir(source, dest);
} else
if (!File::Exists(dest)) File::Copy(source, dest);
}
closedir(dirp);
}
#endif
// Returns the current directory // Returns the current directory
std::string GetCurrentDir() std::string GetCurrentDir()
{ {
@ -510,28 +545,6 @@ bool SetCurrentDir(const char *_rDirectory)
} }
#if defined(__APPLE__) #if defined(__APPLE__)
//get the full config dir
const char *GetConfigDirectory()
{
static char path[MAX_PATH] = {0};
if (strlen(path) > 0)
return path;
snprintf(path, sizeof(path), "%s" DIR_SEP CONFIG_FILE, GetUserDirectory());
return path;
}
//get the full SYSCONF dir
const char *GetSysConfDirectory()
{
static char path[MAX_PATH] = {0};
if (strlen(path) > 0)
return path;
snprintf(path, sizeof(path), "%s" DIR_SEP WII_SYSCONF_FILE, GetUserDirectory());
return path;
}
std::string GetBundleDirectory() std::string GetBundleDirectory()
{ {
// Plugin path will be Dolphin.app/Contents/PlugIns // Plugin path will be Dolphin.app/Contents/PlugIns
@ -599,28 +612,149 @@ std::string GetSysDirectory()
return sysDir; return sysDir;
} }
// Returns a pointer to a string with a Dolphin data dir in the user's home // Returns a pointer to a string with a Dolphin data dir or file in the user's home
// directory. To be used in "multi-user" mode (that is, installed). // directory. To be used in "multi-user" mode (that is, installed).
const char *GetUserDirectory() const char *GetUserPath(int DirIDX)
{ {
// Make sure we only need to do it once static char UserDir[MAX_PATH] = {0};
static char path[MAX_PATH] = {0}; static char GCUserDir[MAX_PATH] = {0};
if (strlen(path) > 0) static char WiiUserDir[MAX_PATH] = {0};
return path; static char ConfigDir[MAX_PATH] = {0};
static char GameConfigDir[MAX_PATH] = {0};
static char MapsDir[MAX_PATH] = {0};
static char CacheDir[MAX_PATH] = {0};
static char ShaderCacheDir[MAX_PATH] = {0};
static char ShadersDir[MAX_PATH] = {0};
static char StateSavesDir[MAX_PATH] = {0};
static char ScreenShotsDir[MAX_PATH] = {0};
static char HiresTexturesDir[MAX_PATH] = {0};
static char DumpDir[MAX_PATH] = {0};
static char DumpFramesDir[MAX_PATH] = {0};
static char DumpTexturesDir[MAX_PATH] = {0};
static char DumpDSPDir[MAX_PATH] = {0};
static char LogsDir[MAX_PATH] = {0};
static char MailLogsDir[MAX_PATH] = {0};
static char WiiSYSCONFDir[MAX_PATH] = {0};
static char WiiMenuDir[MAX_PATH] = {0};
static char DolphinConfig[MAX_PATH] = {0};
static char DebuggerConfig[MAX_PATH] = {0};
static char LoggerConfig[MAX_PATH] = {0};
static char MainLog[MAX_PATH] = {0};
static char WiiSYSCONF[MAX_PATH] = {0};
static char RamDump[MAX_PATH] = {0};
static char ARamDump[MAX_PATH] = {0};
static char GCSRam[MAX_PATH] = {0};
#ifdef WIN32 // Set up all paths and files on the first run
char homedir[MAX_PATH]; if (strlen(UserDir) == 0)
if (!SUCCEEDED(SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, path))) {
return NULL; #ifdef _WIN32
// Keep the directory setup the way it was on windows
snprintf(UserDir, sizeof(UserDir), ROOT_DIR DIR_SEP USERDATA_DIR DIR_SEP);
//char homedir[MAX_PATH];
//if (!SUCCEEDED(SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, path)))
// return NULL;
#else #else
char *homedir = getenv("HOME"); if (File::Exists(ROOT_DIR DIR_SEP USERDATA_DIR))
if (!homedir) snprintf(UserDir, sizeof(UserDir), ROOT_DIR DIR_SEP USERDATA_DIR DIR_SEP);
return NULL; else
{
char *homedir = getenv("HOME");
if (homedir)
snprintf(UserDir, sizeof(UserDir), "%s" DIR_SEP DOLPHIN_DATA_DIR DIR_SEP, homedir);
}
#endif #endif
INFO_LOG(COMMON, "GetUserPath: Setting user directory to %s:", UserDir);
snprintf(path, sizeof(path), "%s" DIR_SEP DOLPHIN_DATA_DIR, homedir); snprintf(GCUserDir, sizeof(GCUserDir), "%s" GC_USER_DIR DIR_SEP, UserDir);
INFO_LOG(COMMON, "GetUserDirectory: Setting to %s:", path); snprintf(WiiUserDir, sizeof(WiiUserDir), "%s" WII_USER_DIR DIR_SEP, UserDir);
return path; snprintf(ConfigDir, sizeof(ConfigDir), "%s" CONFIG_DIR DIR_SEP, UserDir);
snprintf(GameConfigDir, sizeof(GameConfigDir), "%s" GAMECONFIG_DIR DIR_SEP, UserDir);
snprintf(MapsDir, sizeof(MapsDir), "%s" MAPS_DIR DIR_SEP, UserDir);
snprintf(CacheDir, sizeof(CacheDir), "%s" CACHE_DIR DIR_SEP, UserDir);
snprintf(ShaderCacheDir, sizeof(ShaderCacheDir), "%s" SHADERCACHE_DIR DIR_SEP, UserDir);
snprintf(ShadersDir, sizeof(ShadersDir), "%s" SHADERS_DIR DIR_SEP, UserDir);
snprintf(StateSavesDir, sizeof(StateSavesDir), "%s" STATESAVES_DIR DIR_SEP, UserDir);
snprintf(ScreenShotsDir, sizeof(ScreenShotsDir), "%s" SCREENSHOTS_DIR DIR_SEP, UserDir);
snprintf(HiresTexturesDir, sizeof(HiresTexturesDir), "%s" HIRES_TEXTURES_DIR DIR_SEP, UserDir);
snprintf(DumpDir, sizeof(DumpDir), "%s" DUMP_DIR DIR_SEP, UserDir);
snprintf(DumpFramesDir, sizeof(DumpFramesDir), "%s" DUMP_FRAMES_DIR DIR_SEP, UserDir);
snprintf(DumpTexturesDir, sizeof(DumpTexturesDir), "%s" DUMP_TEXTURES_DIR DIR_SEP, UserDir);
snprintf(DumpDSPDir, sizeof(DumpDSPDir), "%s" DUMP_DSP_DIR DIR_SEP, UserDir);
snprintf(LogsDir, sizeof(LogsDir), "%s" LOGS_DIR DIR_SEP, UserDir);
snprintf(MailLogsDir, sizeof(MailLogsDir), "%s" MAIL_LOGS_DIR DIR_SEP, UserDir);
snprintf(WiiSYSCONFDir, sizeof(WiiSYSCONFDir), "%s" WII_SYSCONF_DIR DIR_SEP, UserDir);
snprintf(WiiMenuDir, sizeof(WiiMenuDir), "%s" WII_MENU_DIR DIR_SEP, UserDir);
snprintf(DolphinConfig, sizeof(DolphinConfig), "%s" DOLPHIN_CONFIG, ConfigDir);
snprintf(DebuggerConfig, sizeof(DebuggerConfig), "%s" DEBUGGER_CONFIG, ConfigDir);
snprintf(LoggerConfig, sizeof(LoggerConfig), "%s" LOGGER_CONFIG, ConfigDir);
snprintf(MainLog, sizeof(MainLog), "%s" MAIN_LOG, LogsDir);
snprintf(WiiSYSCONF, sizeof(WiiSYSCONF), "%s" WII_SYSCONF, WiiSYSCONFDir);
snprintf(RamDump, sizeof(RamDump), "%s" RAM_DUMP, DumpDir);
snprintf(ARamDump, sizeof(ARamDump), "%s" ARAM_DUMP, DumpDir);
snprintf(GCSRam, sizeof(GCSRam), "%s" GC_SRAM, GCUserDir);
}
switch (DirIDX)
{
case D_USER_IDX:
return UserDir;
case D_GCUSER_IDX:
return GCUserDir;
case D_WIIUSER_IDX:
return WiiUserDir;
case D_CONFIG_IDX:
return ConfigDir;
case D_GAMECONFIG_IDX:
return GameConfigDir;
case D_MAPS_IDX:
return MapsDir;
case D_CACHE_IDX:
return CacheDir;
case D_SHADERCACHE_IDX:
return ShaderCacheDir;
case D_SHADERS_IDX:
return ShadersDir;
case D_STATESAVES_IDX:
return StateSavesDir;
case D_SCREENSHOTS_IDX:
return ScreenShotsDir;
case D_HIRESTEXTURES_IDX:
return HiresTexturesDir;
case D_DUMP_IDX:
return DumpDir;
case D_DUMPFRAMES_IDX:
return DumpFramesDir;
case D_DUMPTEXTURES_IDX:
return DumpTexturesDir;
case D_DUMPDSP_IDX:
return DumpDSPDir;
case D_LOGS_IDX:
return LogsDir;
case D_MAILLOGS_IDX:
return MailLogsDir;
case D_WIISYSCONF_IDX:
return WiiSYSCONFDir;
case D_WIIMENU_IDX:
return WiiMenuDir;
case F_DOLPHINCONFIG_IDX:
return DolphinConfig;
case F_DEBUGGERCONFIG_IDX:
return DebuggerConfig;
case F_LOGGERCONFIG_IDX:
return LoggerConfig;
case F_MAINLOG_IDX:
return MainLog;
case F_WIISYSCONF_IDX:
return WiiSYSCONF;
case F_RAMDUMP_IDX:
return RamDump;
case F_ARAMDUMP_IDX:
return ARamDump;
case F_GCSRAM_IDX:
return GCSRam;
default:
return NULL;
}
} }
bool WriteStringToFile(bool text_file, const std::string &str, const char *filename) bool WriteStringToFile(bool text_file, const std::string &str, const char *filename)

View File

@ -24,6 +24,38 @@
#include "Common.h" #include "Common.h"
// User directory indices for GetUserPath
enum {
D_USER_IDX,
D_GCUSER_IDX,
D_WIIUSER_IDX,
D_CONFIG_IDX,
D_GAMECONFIG_IDX,
D_MAPS_IDX,
D_CACHE_IDX,
D_SHADERCACHE_IDX,
D_SHADERS_IDX,
D_STATESAVES_IDX,
D_SCREENSHOTS_IDX,
D_HIRESTEXTURES_IDX,
D_DUMP_IDX,
D_DUMPFRAMES_IDX,
D_DUMPTEXTURES_IDX,
D_DUMPDSP_IDX,
D_LOGS_IDX,
D_MAILLOGS_IDX,
D_WIISYSCONF_IDX,
D_WIIMENU_IDX,
F_DOLPHINCONFIG_IDX,
F_DEBUGGERCONFIG_IDX,
F_LOGGERCONFIG_IDX,
F_MAINLOG_IDX,
F_WIISYSCONF_IDX,
F_RAMDUMP_IDX,
F_ARAMDUMP_IDX,
F_GCSRAM_IDX,
};
namespace File namespace File
{ {
@ -78,13 +110,15 @@ bool DeleteDirRecursively(const char *directory);
// Returns the current directory // Returns the current directory
std::string GetCurrentDir(); std::string GetCurrentDir();
//Create directory and copy contents (does not overwrite existing files)
void CopyDir(const char *source_path, const char *dest_path);
// Set the current directory to given directory // Set the current directory to given directory
bool SetCurrentDir(const char *directory); bool SetCurrentDir(const char *directory);
// Returns a pointer to a string with a Dolphin data dir in the user's home // Returns a pointer to a string with a Dolphin data dir in the user's home
// directory. To be used in "multi-user" mode (that is, installed). // directory. To be used in "multi-user" mode (that is, installed).
const char *GetUserDirectory(); const char *GetUserPath(int DirIDX);
// Returns the path to where the plugins are // Returns the path to where the plugins are
std::string GetPluginsDirectory(); std::string GetPluginsDirectory();
@ -93,10 +127,6 @@ std::string GetPluginsDirectory();
std::string GetSysDirectory(); std::string GetSysDirectory();
#ifdef __APPLE__ #ifdef __APPLE__
const char *GetConfigDirectory();
const char *GetSysConfDirectory();
std::string GetBundleDirectory(); std::string GetBundleDirectory();
#endif #endif

View File

@ -19,6 +19,7 @@
#include "ConsoleListener.h" #include "ConsoleListener.h"
#include "Timer.h" #include "Timer.h"
#include "Thread.h" #include "Thread.h"
#include "FileUtil.h"
void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
const char *file, int line, const char* fmt, ...) const char *file, int line, const char* fmt, ...)
@ -79,7 +80,7 @@ LogManager::LogManager() {
m_Log[LogTypes::MEMCARD_MANAGER] = new LogContainer("MemCard Manger", "MemCard Manger"); m_Log[LogTypes::MEMCARD_MANAGER] = new LogContainer("MemCard Manger", "MemCard Manger");
m_Log[LogTypes::NETPLAY] = new LogContainer("NETPLAY", "Netplay"); m_Log[LogTypes::NETPLAY] = new LogContainer("NETPLAY", "Netplay");
m_fileLog = new FileLogListener(MAIN_LOG_FILE); m_fileLog = new FileLogListener(File::GetUserPath(F_MAINLOG_IDX));
m_consoleLog = new ConsoleListener(); m_consoleLog = new ConsoleListener();
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i) { for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i) {
@ -176,6 +177,10 @@ FileLogListener::FileLogListener(const char *filename) {
setEnable(true); setEnable(true);
} }
void FileLogListener::Reload() {
m_logfile = fopen(m_filename, "a+");
}
FileLogListener::~FileLogListener() { FileLogListener::~FileLogListener() {
free(m_filename); free(m_filename);
fclose(m_logfile); fclose(m_logfile);

View File

@ -42,6 +42,8 @@ public:
FileLogListener(const char *filename); FileLogListener(const char *filename);
~FileLogListener(); ~FileLogListener();
void Reload();
void Log(LogTypes::LOG_LEVELS, const char *msg); void Log(LogTypes::LOG_LEVELS, const char *msg);
bool isValid() { bool isValid() {

View File

@ -21,13 +21,17 @@
SysConf::SysConf() SysConf::SysConf()
: m_IsValid(false) : m_IsValid(false)
{ {
#if defined(__APPLE__) if (LoadFromFile(File::GetUserPath(F_WIISYSCONF_IDX)))
if (LoadFromFile(File::GetSysConfDirectory()))
#else
if (LoadFromFile(WII_SYSCONF_FILE))
#endif
m_IsValid = true; m_IsValid = true;
} }
void SysConf::Reload()
{
if (m_IsValid)
return;
if (LoadFromFile(File::GetUserPath(F_WIISYSCONF_IDX)))
m_IsValid = true;
}
SysConf::~SysConf() SysConf::~SysConf()
{ {

View File

@ -71,6 +71,8 @@ public:
bool IsValid() { return m_IsValid; } bool IsValid() { return m_IsValid; }
void Reload();
template<class T> template<class T>
T GetData(const char* sectionName) T GetData(const char* sectionName)
{ {

View File

@ -94,7 +94,7 @@ std::string CBoot::GenerateMapFilename()
u64 TitleID = Loader.GetTitleID(); u64 TitleID = Loader.GetTitleID();
char tmpBuffer[32]; char tmpBuffer[32];
sprintf(tmpBuffer, "%08x_%08x", (u32)(TitleID >> 32) & 0xFFFFFFFF , (u32)TitleID & 0xFFFFFFFF ); sprintf(tmpBuffer, "%08x_%08x", (u32)(TitleID >> 32) & 0xFFFFFFFF , (u32)TitleID & 0xFFFFFFFF );
return FULL_MAPS_DIR + std::string(tmpBuffer) + ".map"; return std::string(File::GetUserPath(D_MAPS_IDX)) + std::string(tmpBuffer) + ".map";
} }
} }
break; break;
@ -103,7 +103,7 @@ std::string CBoot::GenerateMapFilename()
case SCoreStartupParameter::BOOT_DOL: case SCoreStartupParameter::BOOT_DOL:
return _StartupPara.m_strFilename.substr(0, _StartupPara.m_strFilename.size()-4) + ".map"; return _StartupPara.m_strFilename.substr(0, _StartupPara.m_strFilename.size()-4) + ".map";
default: default:
return FULL_MAPS_DIR + _StartupPara.GetUniqueID() + ".map"; return std::string(File::GetUserPath(D_MAPS_IDX)) + _StartupPara.GetUniqueID() + ".map";
} }
return std::string("unknown map"); return std::string("unknown map");

View File

@ -46,7 +46,7 @@ bool CBoot::Boot_WiiWAD(const char* _pFilename)
char Path[260+1]; char Path[260+1];
u64 TitleID = ContentLoader.GetTitleID(); u64 TitleID = ContentLoader.GetTitleID();
char* pTitleID = (char*)&TitleID; char* pTitleID = (char*)&TitleID;
sprintf(Path, FULL_WII_USER_DIR "title//%02x%02x%02x%02x/%02x%02x%02x%02x/data/nocopy/", sprintf(Path, "%stitle/%02x%02x%02x%02x/%02x%02x%02x%02x/data/nocopy/", File::GetUserPath(D_WIIUSER_IDX),
(u8)pTitleID[7], (u8)pTitleID[6], (u8)pTitleID[5], (u8)pTitleID[4], (u8)pTitleID[7], (u8)pTitleID[6], (u8)pTitleID[5], (u8)pTitleID[4],
(u8)pTitleID[3], (u8)pTitleID[2], (u8)pTitleID[1], (u8)pTitleID[0]); (u8)pTitleID[3], (u8)pTitleID[2], (u8)pTitleID[1], (u8)pTitleID[0]);
File::CreateFullPath(Path); File::CreateFullPath(Path);
@ -99,7 +99,7 @@ bool CBoot::Install_WiiWAD(const char* _pFilename)
//copy WAD's tmd header and contents to content directory //copy WAD's tmd header and contents to content directory
char ContentPath[260+1]; char ContentPath[260+1];
sprintf(ContentPath, FULL_WII_USER_DIR "title/%08x/%08x/content/", TitleID_HI, TitleID_LO); sprintf(ContentPath, "%stitle/%08x/%08x/content/", File::GetUserPath(D_WIIUSER_IDX), TitleID_HI, TitleID_LO);
File::CreateFullPath(ContentPath); File::CreateFullPath(ContentPath);
std::string TMDFileName(ContentPath); std::string TMDFileName(ContentPath);
@ -137,11 +137,11 @@ bool CBoot::Install_WiiWAD(const char* _pFilename)
//Extract and copy WAD's ticket to ticket directory //Extract and copy WAD's ticket to ticket directory
char TicketPath[260+1]; char TicketPath[260+1];
sprintf(TicketPath, FULL_WII_USER_DIR "ticket/%08x/", TitleID_HI); sprintf(TicketPath, "%sticket/%08x/", File::GetUserPath(D_WIIUSER_IDX), TitleID_HI);
File::CreateFullPath(TicketPath); File::CreateFullPath(TicketPath);
char TicketFileName[260+1]; char TicketFileName[260+1];
sprintf(TicketFileName, FULL_WII_USER_DIR "ticket/%08x/%08x.tik", TitleID_HI, TitleID_LO); sprintf(TicketFileName, "%sticket/%08x/%08x.tik", File::GetUserPath(D_WIIUSER_IDX), TitleID_HI, TitleID_LO);
FILE* pTicketFile = fopen(TicketFileName, "wb"); FILE* pTicketFile = fopen(TicketFileName, "wb");
if (pTicketFile == NULL) { if (pTicketFile == NULL) {

View File

@ -44,13 +44,9 @@ SConfig::~SConfig()
void SConfig::SaveSettings() void SConfig::SaveSettings()
{ {
NOTICE_LOG(BOOT, "Saving Settings to %s", CONFIG_FILE); NOTICE_LOG(BOOT, "Saving Settings to %s", File::GetUserPath(F_DOLPHINCONFIG_IDX));
IniFile ini; IniFile ini;
#if defined(__APPLE__) ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX)); // yes we must load first to not kill unknown stuff
ini.Load(File::GetConfigDirectory()); // yes we must load first to not kill unknown stuff
#else
ini.Load(CONFIG_FILE); // yes we must load first to not kill unknown stuff
#endif
// General // General
{ {
@ -139,11 +135,7 @@ void SConfig::SaveSettings()
ini.Set("Core", "WiiMotePlugin",m_LocalCoreStartupParameter.m_strWiimotePlugin[0]); ini.Set("Core", "WiiMotePlugin",m_LocalCoreStartupParameter.m_strWiimotePlugin[0]);
} }
#if defined(__APPLE__) ini.Save(File::GetUserPath(F_DOLPHINCONFIG_IDX));
ini.Save(File::GetConfigDirectory());
#else
ini.Save(CONFIG_FILE);
#endif
m_SYSCONF->Save(); m_SYSCONF->Save();
} }
@ -151,13 +143,10 @@ void SConfig::SaveSettings()
void SConfig::LoadSettings() void SConfig::LoadSettings()
{ {
INFO_LOG(BOOT, "Loading Settings from %s", CONFIG_FILE); INFO_LOG(BOOT, "Loading Settings from %s", File::GetUserPath(F_DOLPHINCONFIG_IDX));
IniFile ini; IniFile ini;
#if defined(__APPLE__) ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX));
ini.Load(File::GetConfigDirectory());
#else
ini.Load(CONFIG_FILE);
#endif
std::string PluginsDir = File::GetPluginsDirectory(); std::string PluginsDir = File::GetPluginsDirectory();
// Hard coded default // Hard coded default
@ -267,6 +256,6 @@ void SConfig::LoadSettings()
void SConfig::LoadSettingsHLE() void SConfig::LoadSettingsHLE()
{ {
IniFile ini; IniFile ini;
ini.Load(FULL_CONFIG_DIR "DSP.ini"); ini.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "DSP.ini").c_str());
ini.Get("Config", "EnableRE0AudioFix", &m_EnableRE0Fix, false); // RE0 Hack ini.Get("Config", "EnableRE0AudioFix", &m_EnableRE0Fix, false); // RE0 Hack
} }

View File

@ -530,11 +530,11 @@ static inline std::string GenerateScreenshotName()
int index = 1; int index = 1;
std::string tempname, name; std::string tempname, name;
std::string gameId = GetStartupParameter().GetUniqueID(); std::string gameId = GetStartupParameter().GetUniqueID();
tempname = FULL_SCREENSHOTS_DIR + gameId + DIR_SEP_CHR; tempname = std::string(File::GetUserPath(D_SCREENSHOTS_IDX)) + gameId + DIR_SEP_CHR;
if (!File::CreateFullPath(tempname.c_str())) { if (!File::CreateFullPath(tempname.c_str())) {
//fallback to old-style screenshots, without folder. //fallback to old-style screenshots, without folder.
tempname = FULL_SCREENSHOTS_DIR; tempname = std::string(File::GetUserPath(D_SCREENSHOTS_IDX));
} }
//append gameId, tempname only contains the folder here. //append gameId, tempname only contains the folder here.
tempname += gameId; tempname += gameId;

View File

@ -230,7 +230,7 @@ bool SCoreStartupParameter::AutoSetup(EBootBS2 _BootBS2)
// Setup paths // Setup paths
CheckMemcardPath(SConfig::GetInstance().m_strMemoryCardA, Region, true); CheckMemcardPath(SConfig::GetInstance().m_strMemoryCardA, Region, true);
CheckMemcardPath(SConfig::GetInstance().m_strMemoryCardB, Region, false); CheckMemcardPath(SConfig::GetInstance().m_strMemoryCardB, Region, false);
m_strSRAM = GC_SRAM_FILE; m_strSRAM = File::GetUserPath(F_GCSRAM_IDX);
if (!bWii) if (!bWii)
{ {
m_strBootROM = File::GetSysDirectory() + GC_SYS_DIR + DIR_SEP + Region + DIR_SEP GC_IPL; m_strBootROM = File::GetSysDirectory() + GC_SYS_DIR + DIR_SEP + Region + DIR_SEP GC_IPL;
@ -259,7 +259,7 @@ void SCoreStartupParameter::CheckMemcardPath(std::string& memcardPath, std::stri
{ {
// Use default memcard path if there is no user defined name // Use default memcard path if there is no user defined name
std::string defaultFilename = isSlotA ? GC_MEMCARDA : GC_MEMCARDB; std::string defaultFilename = isSlotA ? GC_MEMCARDA : GC_MEMCARDB;
memcardPath = FULL_GC_USER_DIR + defaultFilename + ext; memcardPath = std::string(File::GetUserPath(D_GCUSER_IDX)) + defaultFilename + ext;
} }
else else
{ {

View File

@ -193,7 +193,7 @@ void CopySettingsFile(std::string& DeviceName)
else else
Source += "setting-eur.txt"; Source += "setting-eur.txt";
std::string Target = FULL_WII_ROOT_DIR + DeviceName; std::string Target = std::string(File::GetUserPath(D_WIIUSER_IDX)) + DeviceName;
// Check if the target dir exists, otherwise create it // Check if the target dir exists, otherwise create it
std::string TargetDir = Target.substr(0, Target.find_last_of(DIR_SEP)); std::string TargetDir = Target.substr(0, Target.find_last_of(DIR_SEP));

View File

@ -30,7 +30,7 @@ std::string HLE_IPC_BuildFilename(const char* _pFilename, int _size)
char Buffer[128]; char Buffer[128];
memcpy(Buffer, _pFilename, _size); memcpy(Buffer, _pFilename, _size);
std::string Filename(FULL_WII_ROOT_DIR); std::string Filename = std::string(File::GetUserPath(D_WIIUSER_IDX));
if (Buffer[1] == '0') if (Buffer[1] == '0')
Filename += std::string("/title"); // this looks and feel like a hack... Filename += std::string("/title"); // this looks and feel like a hack...
@ -289,4 +289,4 @@ void CWII_IPC_HLE_Device_FileIO::DoState(PointerWrap &p)
fseek(m_pFileHandle, m_Seek, SEEK_SET); fseek(m_pFileHandle, m_Seek, SEEK_SET);
} }
} }
} }

View File

@ -764,7 +764,7 @@ bool CWII_IPC_HLE_Device_es::IsValid(u64 _TitleID) const
std::string CWII_IPC_HLE_Device_es::CreateTicketFileName(u64 _TitleID) const std::string CWII_IPC_HLE_Device_es::CreateTicketFileName(u64 _TitleID) const
{ {
char TicketFilename[1024]; char TicketFilename[1024];
sprintf(TicketFilename, "%sticket/%08x/%08x.tik", FULL_WII_USER_DIR, (u32)(_TitleID >> 32), (u32)_TitleID); sprintf(TicketFilename, "%sticket/%08x/%08x.tik", File::GetUserPath(D_WIIUSER_IDX), (u32)(_TitleID >> 32), (u32)_TitleID);
return TicketFilename; return TicketFilename;
} }
@ -772,7 +772,7 @@ std::string CWII_IPC_HLE_Device_es::CreateTicketFileName(u64 _TitleID) const
std::string CWII_IPC_HLE_Device_es::CreateTitleContentPath(u64 _TitleID) const std::string CWII_IPC_HLE_Device_es::CreateTitleContentPath(u64 _TitleID) const
{ {
char TicketFilename[1024]; char TicketFilename[1024];
sprintf(TicketFilename, "%stitle/%08x/%08x/content", FULL_WII_USER_DIR, (u32)(_TitleID >> 32), (u32)_TitleID); sprintf(TicketFilename, "%stitle/%08x/%08x/content", File::GetUserPath(D_WIIUSER_IDX), (u32)(_TitleID >> 32), (u32)_TitleID);
return TicketFilename; return TicketFilename;
} }
@ -780,10 +780,11 @@ std::string CWII_IPC_HLE_Device_es::CreateTitleContentPath(u64 _TitleID) const
void CWII_IPC_HLE_Device_es::FindValidTitleIDs() void CWII_IPC_HLE_Device_es::FindValidTitleIDs()
{ {
m_TitleIDs.clear(); m_TitleIDs.clear();
char TitlePath[1024];
std::string TitlePath(FULL_WII_USER_DIR + std::string("title")); sprintf(TitlePath, "%stitle", File::GetUserPath(D_WIIUSER_IDX));
File::FSTEntry ParentEntry; File::FSTEntry ParentEntry;
u32 NumEntries = ScanDirectoryTree(TitlePath.c_str(), ParentEntry); u32 NumEntries = ScanDirectoryTree(TitlePath, ParentEntry);
for(std::vector<File::FSTEntry>::iterator Level1 = ParentEntry.children.begin(); Level1 != ParentEntry.children.end(); ++Level1) for(std::vector<File::FSTEntry>::iterator Level1 = ParentEntry.children.begin(); Level1 != ParentEntry.children.end(); ++Level1)
{ {
if (Level1->isDirectory) if (Level1->isDirectory)

View File

@ -41,10 +41,10 @@ bool CWII_IPC_HLE_Device_fs::Open(u32 _CommandAddress, u32 _Mode)
{ {
// clear tmp folder // clear tmp folder
{ {
//std::string WiiTempFolder = File::GetUserDirectory() + FULL_WII_USER_DIR + std::string("tmp"); char Path[260];
std::string WiiTempFolder = FULL_WII_USER_DIR + std::string("tmp"); snprintf(Path, sizeof(Path), "%stmp", File::GetUserPath(D_WIIUSER_IDX));
File::DeleteDirRecursively(WiiTempFolder.c_str()); File::DeleteDirRecursively(Path);
File::CreateDir(WiiTempFolder.c_str()); File::CreateDir(Path);
} }
// create home directory // create home directory
@ -61,7 +61,7 @@ bool CWII_IPC_HLE_Device_fs::Open(u32 _CommandAddress, u32 _Mode)
if (GameID == 0) GameID = 0xF00DBEEF; if (GameID == 0) GameID = 0xF00DBEEF;
if (TitleID == 0) TitleID = 0x00010000; if (TitleID == 0) TitleID = 0x00010000;
sprintf(Path, FULL_WII_USER_DIR "title/%08x/%08x/data/nocopy/", TitleID, GameID); snprintf(Path, sizeof(Path), "%stitle/%08x/%08x/data/nocopy/", File::GetUserPath(D_WIIUSER_IDX), TitleID, GameID);
File::CreateFullPath(Path); File::CreateFullPath(Path);
} }

View File

@ -47,7 +47,8 @@ bool CWII_IPC_HLE_Device_sdio_slot0::Open(u32 _CommandAddress, u32 _Mode)
{ {
INFO_LOG(WII_IPC_SD, "Open"); INFO_LOG(WII_IPC_SD, "Open");
char filename[16] = "sd.raw"; char filename[300];
sprintf(filename, "%ssd.raw", File::GetUserPath(D_WIIUSER_IDX));
m_Card = fopen(filename, "r+b"); m_Card = fopen(filename, "r+b");
if(!m_Card) if(!m_Card)
{ {

View File

@ -19,6 +19,7 @@
#include "../Core.h" // Local core functions #include "../Core.h" // Local core functions
#include "WII_IPC_HLE_Device_usb.h" #include "WII_IPC_HLE_Device_usb.h"
#include "WII_IPC_HLE_Device_usb_kbd.h" #include "WII_IPC_HLE_Device_usb_kbd.h"
#include "FileUtil.h"
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
@ -35,7 +36,7 @@ bool CWII_IPC_HLE_Device_usb_kbd::Open(u32 _CommandAddress, u32 _Mode)
{ {
INFO_LOG(WII_IPC_STM, "CWII_IPC_HLE_Device_usb_kbd: Open"); INFO_LOG(WII_IPC_STM, "CWII_IPC_HLE_Device_usb_kbd: Open");
IniFile ini; IniFile ini;
ini.Load(CONFIG_FILE); ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX));
ini.Get("USB Keyboard", "Layout", &m_KeyboardLayout, KBD_LAYOUT_QWERTY); ini.Get("USB Keyboard", "Layout", &m_KeyboardLayout, KBD_LAYOUT_QWERTY);
for(int i = 0; i < 256; i++) for(int i = 0; i < 256; i++)

View File

@ -2745,7 +2745,7 @@ DEFINE_LUA_FUNCTION(emulua_loadrom, "filename")
// Load game specific settings // Load game specific settings
IniFile game_ini; IniFile game_ini;
std::string unique_id = StartUp.GetUniqueID(); std::string unique_id = StartUp.GetUniqueID();
StartUp.m_strGameIni = FULL_GAMECONFIG_DIR + unique_id + ".ini"; StartUp.m_strGameIni = std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + unique_id + ".ini";
if (unique_id.size() == 6 && game_ini.Load(StartUp.m_strGameIni.c_str())) if (unique_id.size() == 6 && game_ini.Load(StartUp.m_strGameIni.c_str()))
{ {
// General settings // General settings

View File

@ -34,6 +34,7 @@
#include "PatchEngine.h" #include "PatchEngine.h"
#include "HW/Memmap.h" #include "HW/Memmap.h"
#include "ActionReplay.h" #include "ActionReplay.h"
#include "FileUtil.h"
using namespace Common; using namespace Common;
@ -149,7 +150,7 @@ int GetSpeedhackCycles(u32 addr)
void LoadPatches(const char *gameID) void LoadPatches(const char *gameID)
{ {
IniFile ini; IniFile ini;
std::string filename = std::string(FULL_GAMECONFIG_DIR) + gameID + ".ini"; std::string filename = std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + gameID + ".ini";
if (ini.Load(filename.c_str())) { if (ini.Load(filename.c_str())) {
LoadPatchSection("OnFrame", onFrame, ini); LoadPatchSection("OnFrame", onFrame, ini);
ActionReplay::LoadCodes(ini, false); ActionReplay::LoadCodes(ini, false);

View File

@ -21,6 +21,7 @@
#include "Common.h" #include "Common.h"
#include "PPCTables.h" #include "PPCTables.h"
#include "StringUtil.h" #include "StringUtil.h"
#include "FileUtil.h"
#include "Interpreter/Interpreter.h" #include "Interpreter/Interpreter.h"
#include "Interpreter/Interpreter_Tables.h" #include "Interpreter/Interpreter_Tables.h"
#if !(defined(NOJIT) && NOJIT) #if !(defined(NOJIT) && NOJIT)
@ -217,7 +218,7 @@ void PrintInstructionRunCounts()
void LogCompiledInstructions() void LogCompiledInstructions()
{ {
static int time = 0; static int time = 0;
FILE *f = fopen(StringFromFormat(FULL_LOGS_DIR "inst_log%i.txt", time).c_str(), "w"); FILE *f = fopen(StringFromFormat("%sinst_log%i.txt", File::GetUserPath(D_LOGS_IDX), time).c_str(), "w");
for (int i = 0; i < m_numInstructions; i++) for (int i = 0; i < m_numInstructions; i++)
{ {
if (m_allInstructions[i]->compileCount > 0) { if (m_allInstructions[i]->compileCount > 0) {
@ -225,7 +226,7 @@ void LogCompiledInstructions()
} }
} }
fclose(f); fclose(f);
f = fopen(StringFromFormat(FULL_LOGS_DIR "inst_not%i.txt", time).c_str(), "w"); f = fopen(StringFromFormat("%sinst_not%i.txt", File::GetUserPath(D_LOGS_IDX), time).c_str(), "w");
for (int i = 0; i < m_numInstructions; i++) for (int i = 0; i < m_numInstructions; i++)
{ {
if (m_allInstructions[i]->compileCount == 0) { if (m_allInstructions[i]->compileCount == 0) {
@ -234,7 +235,7 @@ void LogCompiledInstructions()
} }
fclose(f); fclose(f);
#ifdef OPLOG #ifdef OPLOG
f = fopen(StringFromFormat(FULL_LOGS_DIR OP_TO_LOG "_at.txt", time).c_str(), "w"); f = fopen(StringFromFormat("%s" OP_TO_LOG "_at.txt", File::GetUserPath(D_LOGS_IDX), time).c_str(), "w");
for (size_t i = 0; i < rsplocations.size(); i++) { for (size_t i = 0; i < rsplocations.size(); i++) {
fprintf(f, OP_TO_LOG ": %08x\n", rsplocations[i]); fprintf(f, OP_TO_LOG ": %08x\n", rsplocations[i]);
} }

View File

@ -157,10 +157,10 @@ THREAD_RETURN CompressAndDumpState(void *pArgs)
// Moving to last overwritten save-state // Moving to last overwritten save-state
if (File::Exists(cur_filename.c_str())) { if (File::Exists(cur_filename.c_str())) {
if (File::Exists(FULL_STATESAVES_DIR "lastState.sav")) if (File::Exists((std::string(File::GetUserPath(D_STATESAVES_IDX)) + "lastState.sav").c_str()))
File::Delete(FULL_STATESAVES_DIR "lastState.sav"); File::Delete((std::string(File::GetUserPath(D_STATESAVES_IDX)) + "lastState.sav").c_str());
if (!File::Rename(cur_filename.c_str(), FULL_STATESAVES_DIR "lastState.sav")) if (!File::Rename(cur_filename.c_str(), (std::string(File::GetUserPath(D_STATESAVES_IDX)) + "lastState.sav").c_str()))
Core::DisplayMessage("Failed to move previous state to state undo backup", 1000); Core::DisplayMessage("Failed to move previous state to state undo backup", 1000);
} }
@ -378,7 +378,7 @@ void State_Shutdown()
std::string MakeStateFilename(int state_number) std::string MakeStateFilename(int state_number)
{ {
return StringFromFormat(FULL_STATESAVES_DIR "%s.s%02i", Core::GetStartupParameter().GetUniqueID().c_str(), state_number); return StringFromFormat("%s%s.s%02i", File::GetUserPath(D_STATESAVES_IDX), Core::GetStartupParameter().GetUniqueID().c_str(), state_number);
} }
void State_SaveAs(const std::string &filename) void State_SaveAs(const std::string &filename)
@ -445,7 +445,7 @@ void State_UndoLoadState()
// Load the state that the last save state overwritten on // Load the state that the last save state overwritten on
void State_UndoSaveState() void State_UndoSaveState()
{ {
State_LoadAs(FULL_STATESAVES_DIR "lastState.sav"); State_LoadAs((std::string(File::GetUserPath(D_STATESAVES_IDX)) + "lastState.sav").c_str());
} }
size_t State_GetSize() size_t State_GetSize()

View File

@ -50,7 +50,7 @@ DSPDisassembler::~DSPDisassembler()
{ {
// Some old code for logging unknown ops. // Some old code for logging unknown ops.
char filename[MAX_PATH]; char filename[MAX_PATH];
sprintf(filename, "%sUnkOps.txt", FULL_DSP_DUMP_DIR); sprintf(filename, "%sUnkOps.txt", File::GetUserPath(D_DUMPDSP_IDX));
FILE *uo = fopen(filename, "w"); FILE *uo = fopen(filename, "w");
if (!uo) if (!uo)
return; return;

View File

@ -23,7 +23,7 @@
#include "MemoryCheckDlg.h" #include "MemoryCheckDlg.h"
#include "Host.h" #include "Host.h"
#include "PowerPC/PowerPC.h" #include "PowerPC/PowerPC.h"
#include "FileUtil.h"
BEGIN_EVENT_TABLE(CBreakPointWindow, wxPanel) BEGIN_EVENT_TABLE(CBreakPointWindow, wxPanel)
EVT_CLOSE(CBreakPointWindow::OnClose) EVT_CLOSE(CBreakPointWindow::OnClose)
@ -137,7 +137,7 @@ void CBreakPointWindow::OnAddBreakPointMany()
{ {
// load ini // load ini
IniFile ini; IniFile ini;
std::string filename = std::string(FULL_GAMECONFIG_DIR "BreakPoints.ini"); std::string filename = std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + "BreakPoints.ini";
if (ini.Load(filename.c_str())) // check if there is any file there if (ini.Load(filename.c_str())) // check if there is any file there
{ {
@ -163,7 +163,7 @@ void CBreakPointWindow::OnAddBreakPointMany()
} }
else else
{ {
wxMessageBox(_T("Couldn't find User/GameConfig/BreakPoints.ini file")); wxMessageBox(_T("Couldn't find GameConfig/BreakPoints.ini file"));
} }
} }
@ -183,7 +183,7 @@ void CBreakPointWindow::OnAddMemoryCheckMany()
{ {
// load ini // load ini
IniFile ini; IniFile ini;
std::string filename = std::string(FULL_GAMECONFIG_DIR "MemoryChecks.ini"); std::string filename = std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + "MemoryChecks.ini";
if (ini.Load(filename.c_str())) if (ini.Load(filename.c_str()))
{ {
@ -262,7 +262,7 @@ void CBreakPointWindow::OnAddMemoryCheckMany()
} }
else else
{ {
wxMessageBox(_T("You have no ") T_FULL_GAMECONFIG_DIR _T("MemoryChecks.ini file")); wxMessageBox(_T("You have no ") + wxString::FromAscii(File::GetUserPath(D_GAMECONFIG_IDX)) + _T("MemoryChecks.ini file"));
} }
} }

View File

@ -84,7 +84,7 @@ extern "C" // Bitmaps
void CCodeWindow::Load() void CCodeWindow::Load()
{ {
IniFile ini; IniFile ini;
ini.Load(DEBUGGER_CONFIG_FILE); ini.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
// The font to override DebuggerFont with // The font to override DebuggerFont with
std::string fontDesc; std::string fontDesc;
@ -133,7 +133,7 @@ void CCodeWindow::Load()
void CCodeWindow::Save() void CCodeWindow::Save()
{ {
IniFile ini; IniFile ini;
ini.Load(DEBUGGER_CONFIG_FILE); ini.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
ini.Set("ShowOnStart", "DebuggerFont", std::string(DebuggerFont.GetNativeFontInfoUserDesc().mb_str())); ini.Set("ShowOnStart", "DebuggerFont", std::string(DebuggerFont.GetNativeFontInfoUserDesc().mb_str()));
@ -172,7 +172,7 @@ void CCodeWindow::Save()
ini.Set("Float", "Sound", !!FindWindowById(IDM_SOUNDWINDOW_PARENT)); ini.Set("Float", "Sound", !!FindWindowById(IDM_SOUNDWINDOW_PARENT));
ini.Set("Float", "Video", !!FindWindowById(IDM_VIDEOWINDOW_PARENT)); ini.Set("Float", "Video", !!FindWindowById(IDM_VIDEOWINDOW_PARENT));
ini.Save(DEBUGGER_CONFIG_FILE); ini.Save(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
} }

View File

@ -27,6 +27,7 @@
#include "HW/CPU.h" #include "HW/CPU.h"
#include "PowerPC/PowerPC.h" #include "PowerPC/PowerPC.h"
#include "Host.h" #include "Host.h"
#include "FileUtil.h"
#include "Debugger/PPCDebugInterface.h" #include "Debugger/PPCDebugInterface.h"
#include "PowerPC/PPCSymbolDB.h" #include "PowerPC/PPCSymbolDB.h"
@ -243,7 +244,7 @@ void CMemoryWindow::OnDumpMemory( wxCommandEvent& event )
case 0: case 0:
default: default:
{ {
FILE* pDumpFile = fopen(MAINRAM_DUMP_FILE, "wb"); FILE* pDumpFile = fopen(File::GetUserPath(F_RAMDUMP_IDX), "wb");
if (pDumpFile) if (pDumpFile)
{ {
if (Memory::m_pRAM) if (Memory::m_pRAM)
@ -257,7 +258,7 @@ void CMemoryWindow::OnDumpMemory( wxCommandEvent& event )
case 1: case 1:
{ {
FILE* pDumpFile = fopen(ARAM_DUMP_FILE, "wb"); FILE* pDumpFile = fopen(File::GetUserPath(F_ARAMDUMP_IDX), "wb");
if (pDumpFile) if (pDumpFile)
{ {
u8* aram = DSP::GetARAMPtr(); u8* aram = DSP::GetARAMPtr();

View File

@ -40,8 +40,8 @@ CBannerLoaderWii::CBannerLoaderWii(DiscIO::IVolume *pVolume)
TitleID = Common::swap64(TitleID); TitleID = Common::swap64(TitleID);
sprintf(Filename, FULL_WII_USER_DIR "title/%08x/%08x/data/banner.bin", sprintf(Filename, "%stitle/%08x/%08x/data/banner.bin",
(u32)(TitleID>>32), (u32)TitleID); File::GetUserPath(D_WIIUSER_IDX), (u32)(TitleID>>32), (u32)TitleID);
if (!File::Exists(Filename)) if (!File::Exists(Filename))
{ {
@ -52,14 +52,14 @@ CBannerLoaderWii::CBannerLoaderWii(DiscIO::IVolume *pVolume)
char bnrFilename[260], titleFolder[260]; char bnrFilename[260], titleFolder[260];
// Creating title folder // Creating title folder
sprintf(titleFolder, FULL_WII_USER_DIR "title/%08x/%08x/data/", sprintf(titleFolder, "%stitle/%08x/%08x/data/",
(u32)(TitleID>>32), (u32)TitleID); File::GetUserPath(D_WIIUSER_IDX), (u32)(TitleID>>32), (u32)TitleID);
if(!File::Exists(titleFolder)) if(!File::Exists(titleFolder))
File::CreateFullPath(titleFolder); File::CreateFullPath(titleFolder);
// Extracting banner.bin from opening.bnr // Extracting banner.bin from opening.bnr
sprintf(bnrFilename, FULL_WII_USER_DIR "title/%08x/%08x/data/opening.bnr", sprintf(bnrFilename, "%stitle/%08x/%08x/data/opening.bnr",
(u32)(TitleID>>32), (u32)TitleID); File::GetUserPath(D_WIIUSER_IDX), (u32)(TitleID>>32), (u32)TitleID);
if(!_rFileSystem.ExportFile("opening.bnr", bnrFilename)) { if(!_rFileSystem.ExportFile("opening.bnr", bnrFilename)) {
m_IsValid = false; m_IsValid = false;

View File

@ -60,7 +60,7 @@ CSharedContent CSharedContent::m_Instance;
CSharedContent::CSharedContent() CSharedContent::CSharedContent()
{ {
char szFilename[1024]; char szFilename[1024];
sprintf(szFilename, "%sshared1/content.map", FULL_WII_USER_DIR); sprintf(szFilename, "%sshared1/content.map", File::GetUserPath(D_WIIUSER_IDX));
if (File::Exists(szFilename)) if (File::Exists(szFilename))
{ {
FILE* pFile = fopen(szFilename, "rb"); FILE* pFile = fopen(szFilename, "rb");
@ -86,7 +86,7 @@ std::string CSharedContent::GetFilenameFromSHA1(u8* _pHash)
if (memcmp(_pHash, m_Elements[i].SHA1Hash, 20) == 0) if (memcmp(_pHash, m_Elements[i].SHA1Hash, 20) == 0)
{ {
char szFilename[1024]; char szFilename[1024];
sprintf(szFilename, "%sshared1/%c%c%c%c%c%c%c%c.app", FULL_WII_USER_DIR, sprintf(szFilename, "%sshared1/%c%c%c%c%c%c%c%c.app", File::GetUserPath(D_WIIUSER_IDX),
m_Elements[i].FileName[0], m_Elements[i].FileName[1], m_Elements[i].FileName[2], m_Elements[i].FileName[3], m_Elements[i].FileName[0], m_Elements[i].FileName[1], m_Elements[i].FileName[2], m_Elements[i].FileName[3],
m_Elements[i].FileName[4], m_Elements[i].FileName[5], m_Elements[i].FileName[6], m_Elements[i].FileName[7]); m_Elements[i].FileName[4], m_Elements[i].FileName[5], m_Elements[i].FileName[6], m_Elements[i].FileName[7]);
return szFilename; return szFilename;

View File

@ -116,7 +116,7 @@ bool BootCore(const std::string& _rFilename)
// Load game specific settings // Load game specific settings
IniFile game_ini; IniFile game_ini;
std::string unique_id = StartUp.GetUniqueID(); std::string unique_id = StartUp.GetUniqueID();
StartUp.m_strGameIni = FULL_GAMECONFIG_DIR + unique_id + ".ini"; StartUp.m_strGameIni = std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + unique_id + ".ini";
if (unique_id.size() == 6 && game_ini.Load(StartUp.m_strGameIni.c_str())) if (unique_id.size() == 6 && game_ini.Load(StartUp.m_strGameIni.c_str()))
{ {
// General settings // General settings

View File

@ -764,7 +764,7 @@ void CConfigMain::ChooseMemcardPath(std::string& strMemcard, bool isSlotA)
{ {
std::string filename = std::string(wxFileSelector( std::string filename = std::string(wxFileSelector(
wxT("Choose a file to open"), wxT("Choose a file to open"),
T_FULL_GC_USER_DIR, wxString::FromAscii(File::GetUserPath(D_GCUSER_IDX)),
isSlotA ? wxT(GC_MEMCARDA) : wxT(GC_MEMCARDB), isSlotA ? wxT(GC_MEMCARDA) : wxT(GC_MEMCARDB),
wxEmptyString, wxEmptyString,
wxT("Gamecube Memory Cards (*.raw,*.gcp)|*.raw;*.gcp")).mb_str()); wxT("Gamecube Memory Cards (*.raw,*.gcp)|*.raw;*.gcp")).mb_str());

View File

@ -414,7 +414,7 @@ CFrame::CFrame(wxFrame* parent,
else else
{ {
IniFile ini; int pos; IniFile ini; int pos;
ini.Load(LOGGER_CONFIG_FILE); ini.Load(File::GetUserPath(F_LOGGERCONFIG_IDX));
ini.Get("LogWindow", "pos", &pos, 2); ini.Get("LogWindow", "pos", &pos, 2);
m_Mgr->GetPane(wxT("Pane 0")).Show().PaneBorder(false).CaptionVisible(false).Layer(0).Center(); m_Mgr->GetPane(wxT("Pane 0")).Show().PaneBorder(false).CaptionVisible(false).Layer(0).Center();

View File

@ -772,7 +772,7 @@ void CFrame::SetSimplePaneSize()
int Size = PercentageToPixels(50, this->GetSize().GetX()); int Size = PercentageToPixels(50, this->GetSize().GetX());
IniFile ini; IniFile ini;
ini.Load(LOGGER_CONFIG_FILE); ini.Load(File::GetUserPath(F_LOGGERCONFIG_IDX));
ini.Get("LogWindow", "x", &x, Size); ini.Get("LogWindow", "x", &x, Size);
ini.Get("LogWindow", "y", &y, Size); ini.Get("LogWindow", "y", &y, Size);
@ -894,7 +894,7 @@ void CFrame::SaveLocal()
std::string _Perspectives; std::string _Perspectives;
IniFile ini; IniFile ini;
ini.Load(DEBUGGER_CONFIG_FILE); ini.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
ini.Get("Perspectives", "Perspectives", &_Perspectives, ""); ini.Get("Perspectives", "Perspectives", &_Perspectives, "");
ini.Get("Perspectives", "Active", &ActivePerspective, 5); ini.Get("Perspectives", "Active", &ActivePerspective, 5);
SplitString(_Perspectives, ",", VPerspectives); SplitString(_Perspectives, ",", VPerspectives);
@ -945,7 +945,7 @@ void CFrame::Save()
int iClientX = this->GetSize().GetX(), iClientY = this->GetSize().GetY(); int iClientX = this->GetSize().GetX(), iClientY = this->GetSize().GetY();
IniFile ini; IniFile ini;
ini.Load(DEBUGGER_CONFIG_FILE); ini.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
std::string _Section = StringFromFormat("P - %s", Perspectives.at(ActivePerspective).Name.c_str()); std::string _Section = StringFromFormat("P - %s", Perspectives.at(ActivePerspective).Name.c_str());
ini.Set(_Section.c_str(), "Perspective", m_Mgr->SavePerspective().mb_str()); ini.Set(_Section.c_str(), "Perspective", m_Mgr->SavePerspective().mb_str());
@ -975,7 +975,7 @@ void CFrame::Save()
STmp = STmp.substr(0, STmp.length()-1); STmp = STmp.substr(0, STmp.length()-1);
ini.Set("Perspectives", "Perspectives", STmp.c_str()); ini.Set("Perspectives", "Perspectives", STmp.c_str());
ini.Set("Perspectives", "Active", ActivePerspective); ini.Set("Perspectives", "Active", ActivePerspective);
ini.Save(DEBUGGER_CONFIG_FILE); ini.Save(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
// Save notebook affiliations // Save notebook affiliations
g_pCodeWindow->Save(); g_pCodeWindow->Save();

View File

@ -196,7 +196,7 @@ void CFrame::CreateMenu()
toolsMenu->Append(IDM_NETPLAY, _T("Start &NetPlay")); toolsMenu->Append(IDM_NETPLAY, _T("Start &NetPlay"));
#endif #endif
if (DiscIO::CNANDContentManager::Access().GetNANDLoader(FULL_WII_MENU_DIR).IsValid()) if (DiscIO::CNANDContentManager::Access().GetNANDLoader(std::string (File::GetUserPath(D_WIIMENU_IDX))).IsValid())
{ {
toolsMenu->Append(IDM_LOAD_WII_MENU, _T("Load Wii Menu")); toolsMenu->Append(IDM_LOAD_WII_MENU, _T("Load Wii Menu"));
} }
@ -874,7 +874,7 @@ void CFrame::OnShow_CheatsWindow(wxCommandEvent& WXUNUSED (event))
void CFrame::OnLoadWiiMenu(wxCommandEvent& WXUNUSED (event)) void CFrame::OnLoadWiiMenu(wxCommandEvent& WXUNUSED (event))
{ {
StartGame(FULL_WII_MENU_DIR); StartGame(std::string (File::GetUserPath(D_WIIMENU_IDX)));
} }
void CFrame::OnConnectWiimote(wxCommandEvent& event) void CFrame::OnConnectWiimote(wxCommandEvent& event)
@ -1027,7 +1027,7 @@ void CFrame::UpdateGUI()
// Misc // Misc
GetMenuBar()->FindItem(IDM_CHANGEDISC)->Enable(Initialized); GetMenuBar()->FindItem(IDM_CHANGEDISC)->Enable(Initialized);
if (DiscIO::CNANDContentManager::Access().GetNANDLoader(FULL_WII_MENU_DIR).IsValid()) if (DiscIO::CNANDContentManager::Access().GetNANDLoader(std::string(File::GetUserPath(D_WIIMENU_IDX))).IsValid())
GetMenuBar()->FindItem(IDM_LOAD_WII_MENU)->Enable(!Initialized); GetMenuBar()->FindItem(IDM_LOAD_WII_MENU)->Enable(!Initialized);
GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE1)->Enable(Initialized && Core::GetStartupParameter().bWii); GetMenuBar()->FindItem(IDM_CONNECT_WIIMOTE1)->Enable(Initialized && Core::GetStartupParameter().bWii);
@ -1170,7 +1170,7 @@ void CFrame::GameListChanged(wxCommandEvent& event)
break; break;
case IDM_PURGECACHE: case IDM_PURGECACHE:
CFileSearch::XStringVector Directories; CFileSearch::XStringVector Directories;
Directories.push_back(FULL_CACHE_DIR); Directories.push_back(File::GetUserPath(D_CACHE_IDX));
CFileSearch::XStringVector Extensions; CFileSearch::XStringVector Extensions;
Extensions.push_back("*.cache"); Extensions.push_back("*.cache");

View File

@ -393,7 +393,7 @@ void CGameListCtrl::InsertItemInReportView(long _Index)
// Load the INI file for columns that read from it // Load the INI file for columns that read from it
IniFile ini; IniFile ini;
ini.Load(std::string(FULL_GAMECONFIG_DIR + (rISOFile.GetUniqueID()) + ".ini").c_str()); ini.Load((std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + (rISOFile.GetUniqueID()) + ".ini").c_str());
// Emulation status // Emulation status
int nState; int nState;
@ -640,8 +640,8 @@ int wxCALLBACK wxListCompare(long item1, long item2, long sortData)
return 0; return 0;
case CGameListCtrl::COLUMN_EMULATION_STATE: case CGameListCtrl::COLUMN_EMULATION_STATE:
IniFile ini; int nState1 = 0, nState2 = 0; IniFile ini; int nState1 = 0, nState2 = 0;
std::string GameIni1 = FULL_GAMECONFIG_DIR + iso1->GetUniqueID() + ".ini"; std::string GameIni1 = std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + iso1->GetUniqueID() + ".ini";
std::string GameIni2 = FULL_GAMECONFIG_DIR + iso2->GetUniqueID() + ".ini"; std::string GameIni2 = std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + iso2->GetUniqueID() + ".ini";
ini.Load(GameIni1.c_str()); ini.Load(GameIni1.c_str());
ini.Get("EmuState", "EmulationStateId", &nState1); ini.Get("EmuState", "EmulationStateId", &nState1);
@ -746,7 +746,7 @@ void CGameListCtrl::OnMouseMotion(wxMouseEvent& event)
const GameListItem& rISO = m_ISOFiles[GetItemData(item)]; const GameListItem& rISO = m_ISOFiles[GetItemData(item)];
IniFile ini; IniFile ini;
ini.Load(std::string(FULL_GAMECONFIG_DIR + (rISO.GetUniqueID()) + ".ini").c_str()); ini.Load((std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + (rISO.GetUniqueID()) + ".ini").c_str());
// Emulation status // Emulation status
std::string emuState[5] = {"Broken", "Intro", "In-Game", "Playable", "Perfect"}, issues; std::string emuState[5] = {"Broken", "Intro", "In-Game", "Playable", "Perfect"}, issues;

View File

@ -152,9 +152,9 @@ bool GameListItem::LoadFromCache()
void GameListItem::SaveToCache() void GameListItem::SaveToCache()
{ {
if (!File::IsDirectory(FULL_CACHE_DIR)) if (!File::IsDirectory(File::GetUserPath(D_CACHE_IDX)))
{ {
File::CreateDir(FULL_CACHE_DIR); File::CreateDir(File::GetUserPath(D_CACHE_IDX));
} }
CChunkFileReader::Save<GameListItem>(CreateCacheFilename(), CACHE_REVISION, *this); CChunkFileReader::Save<GameListItem>(CreateCacheFilename(), CACHE_REVISION, *this);
@ -188,7 +188,7 @@ std::string GameListItem::CreateCacheFilename()
Filename.append(".gcz"); Filename.append(".gcz");
Filename.append(".cache"); Filename.append(".cache");
std::string fullname(FULL_CACHE_DIR); std::string fullname(std::string(File::GetUserPath(D_CACHE_IDX)));
fullname += Filename; fullname += Filename;
return fullname; return fullname;
} }
@ -226,12 +226,12 @@ const std::string GameListItem::GetWiiFSPath() const
Iso->GetTitleID((u8*)&Title); Iso->GetTitleID((u8*)&Title);
Title = Common::swap64(Title); Title = Common::swap64(Title);
sprintf(Path, FULL_WII_USER_DIR "title/%08x/%08x/data/", (u32)(Title>>32), (u32)Title); sprintf(Path, "%stitle/%08x/%08x/data/", File::GetUserPath(D_WIIUSER_IDX), (u32)(Title>>32), (u32)Title);
if (!File::Exists(Path)) if (!File::Exists(Path))
File::CreateFullPath(Path); File::CreateFullPath(Path);
ret = std::string(wxGetCwd().mb_str()) + std::string(Path).substr(strlen(ROOT_DIR)); ret = std::string(Path);
} }
delete Iso; delete Iso;
} }

View File

@ -109,7 +109,7 @@ CISOProperties::CISOProperties(const std::string fileName, wxWindow* parent, wxW
CreateGUIControls(DiscIO::IsVolumeWadFile(OpenISO)); CreateGUIControls(DiscIO::IsVolumeWadFile(OpenISO));
GameIniFile = FULL_GAMECONFIG_DIR + (OpenISO->GetUniqueID()) + ".ini"; GameIniFile = std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + (OpenISO->GetUniqueID()) + ".ini";
if (GameIni.Load(GameIniFile.c_str())) if (GameIni.Load(GameIniFile.c_str()))
LoadGameConfig(); LoadGameConfig();
else else

View File

@ -27,6 +27,7 @@
#include "LogWindow.h" #include "LogWindow.h"
#include "ConsoleListener.h" #include "ConsoleListener.h"
#include "Console.h" #include "Console.h"
#include "FileUtil.h"
// Milliseconds between msgQueue flushes to wxTextCtrl // Milliseconds between msgQueue flushes to wxTextCtrl
@ -175,13 +176,13 @@ void CLogWindow::SaveSettings()
ini.Set("Options", "WriteToWindow", m_writeWindow); ini.Set("Options", "WriteToWindow", m_writeWindow);
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i) for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
ini.Set("Logs", m_LogManager->getShortName((LogTypes::LOG_TYPE)i), m_checks->IsChecked(i)); ini.Set("Logs", m_LogManager->getShortName((LogTypes::LOG_TYPE)i), m_checks->IsChecked(i));
ini.Save(LOGGER_CONFIG_FILE); ini.Save(File::GetUserPath(F_LOGGERCONFIG_IDX));
} }
void CLogWindow::LoadSettings() void CLogWindow::LoadSettings()
{ {
IniFile ini; IniFile ini;
ini.Load(LOGGER_CONFIG_FILE); ini.Load(File::GetUserPath(F_LOGGERCONFIG_IDX));
int verbosity,font; int verbosity,font;
ini.Get("Options", "Verbosity", &verbosity, 0); ini.Get("Options", "Verbosity", &verbosity, 0);
if (verbosity < 1) verbosity = 1; if (verbosity < 1) verbosity = 1;

View File

@ -135,9 +135,9 @@ bool DolphinApp::OnInit()
"Sayonara!\n"); "Sayonara!\n");
return false; return false;
} }
#ifndef __APPLE__ #if ! defined(__APPLE__) && ! defined(__linux__)
// Keep the user config dir free unless user wants to save the working dir // Keep the user config dir free unless user wants to save the working dir
if (!File::Exists(FULL_CONFIG_DIR "portable")) if (!File::Exists((std::string(File::GetUserPath(D_CONFIG_IDX)) + "portable").c_str()))
{ {
char tmp[1024]; char tmp[1024];
sprintf(tmp, "%s/.dolphin%swd", (const char*)wxStandardPaths::Get().GetUserConfigDir().mb_str(), sprintf(tmp, "%s/.dolphin%swd", (const char*)wxStandardPaths::Get().GetUserConfigDir().mb_str(),
@ -151,7 +151,7 @@ bool DolphinApp::OnInit()
{ {
if (PanicYesNo("Dolphin has not been configured with an install location,\nKeep Dolphin portable?")) if (PanicYesNo("Dolphin has not been configured with an install location,\nKeep Dolphin portable?"))
{ {
FILE* portable = fopen(FULL_CONFIG_DIR "portable", "w"); FILE* portable = fopen((std::string(File::GetUserPath(D_CONFIG_IDX)) + "portable").c_str(), "w");
if (!portable) if (!portable)
{ {
PanicAlert("Portable Setting could not be saved\n Are you running Dolphin from read only media or from a directory that dolphin is not located in?"); PanicAlert("Portable Setting could not be saved\n Are you running Dolphin from read only media or from a directory that dolphin is not located in?");
@ -296,19 +296,23 @@ bool DolphinApp::OnInit()
chdir(AppSupportDir); chdir(AppSupportDir);
//create all necessary dir in user directory //create all necessary dir in user directory
if (!File::Exists(FULL_GC_USER_DIR)) File::CreateFullPath(FULL_GC_USER_DIR); char user_path[500];
if (!File::Exists(FULL_WII_SYSCONF_DIR)) File::CreateFullPath(FULL_WII_SYSCONF_DIR); if (!File::Exists(File::GetUserPath(D_CONFIG_IDX))) File::CreateDir(File::GetUserPath(D_CONFIG_IDX));
if (!File::Exists(FULL_CONFIG_DIR)) File::CreateDir(FULL_CONFIG_DIR); if (!File::Exists(File::GetUserPath(D_GCUSER_IDX))) File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX));
if (!File::Exists(FULL_CACHE_DIR)) File::CreateDir(FULL_CACHE_DIR); if (!File::Exists(File::GetUserPath(D_WIISYSCONF_IDX))) File::CreateFullPath(File::GetUserPath(D_WIISYSCONF_IDX));
if (!File::Exists(FULL_DSP_DUMP_DIR)) File::CreateFullPath(FULL_DSP_DUMP_DIR); if (!File::Exists(File::GetUserPath(D_CACHE_IDX))) File::CreateFullPath(File::GetUserPath(D_CACHE_IDX));
if (!File::Exists(FULL_DUMP_TEXTURES_DIR)) File::CreateFullPath(FULL_DUMP_TEXTURES_DIR); if (!File::Exists(File::GetUserPath(D_DUMPDSP_IDX))) File::CreateFullPath(File::GetUserPath(D_DUMPDSP_IDX));
if (!File::Exists(FULL_HIRES_TEXTURES_DIR)) File::CreateFullPath(FULL_HIRES_TEXTURES_DIR); if (!File::Exists(File::GetUserPath(D_DUMPTEXTURES_IDX))) File::CreateFullPath(File::GetUserPath(D_DUMPTEXTURES_IDX));
if (!File::Exists(FULL_MAIL_LOGS_DIR)) File::CreateFullPath(FULL_MAIL_LOGS_DIR); if (!File::Exists(File::GetUserPath(D_HIRESTEXTURES_IDX))) File::CreateFullPath(File::GetUserPath(D_HIRESTEXTURES_IDX));
if (!File::Exists(FULL_SCREENSHOTS_DIR)) File::CreateFullPath(FULL_SCREENSHOTS_DIR); if (!File::Exists(File::GetUserPath(D_MAILLOGS_IDX))) File::CreateFullPath(File::GetUserPath(D_MAILLOGS_IDX));
if (!File::Exists(FULL_STATESAVES_DIR)) File::CreateFullPath(FULL_STATESAVES_DIR); if (!File::Exists(File::GetUserPath(D_SCREENSHOTS_IDX))) File::CreateFullPath(File::GetUserPath(D_SCREENSHOTS_IDX));
if (!File::Exists(File::GetUserPath(D_STATESAVES_IDX))) File::CreateFullPath(File::GetUserPath(D_STATESAVES_IDX));
//copy user wii shared2 SYSCONF if not exist //copy user wii shared2 SYSCONF if not exist
if (!File::Exists(WII_SYSCONF_FILE)) File::Copy((File::GetBundleDirectory() + DIR_SEP + "Contents" + DIR_SEP + WII_SYSCONF_FILE).c_str(),WII_SYSCONF_FILE); if (!File::Exists(File::GetUserPath(F_WIISYSCONF_IDX)))
File::Copy((File::GetBundleDirectory() + DIR_SEP + "Contents" + DIR_SEP + USERDATA_DIR + DIR_SEP + WII_SYSCONF_DIR).c_str(),
File::GetUserPath(F_WIISYSCONF_IDX));
SConfig::GetInstance().m_SYSCONF->Reload();
//TODO : if not exist copy game config dir in user dir and detect the revision to upgrade if necessary //TODO : if not exist copy game config dir in user dir and detect the revision to upgrade if necessary
//TODO : if not exist copy maps dir in user dir and detect revision to upgrade if necessary //TODO : if not exist copy maps dir in user dir and detect revision to upgrade if necessary
@ -322,6 +326,30 @@ bool DolphinApp::OnInit()
#endif #endif
#endif #endif
#ifdef __linux__
//create all necessary directories in user directory
//TODO : detect the revision and upgrade where necessary
File::CopyDir(SHARED_USER_DIR CONFIG_DIR DIR_SEP, File::GetUserPath(D_CONFIG_IDX));
File::CopyDir(SHARED_USER_DIR GAMECONFIG_DIR DIR_SEP, File::GetUserPath(D_GAMECONFIG_IDX));
File::CopyDir(SHARED_USER_DIR MAPS_DIR DIR_SEP, File::GetUserPath(D_MAPS_IDX));
File::CopyDir(SHARED_USER_DIR SHADERS_DIR DIR_SEP, File::GetUserPath(D_SHADERS_IDX));
File::CopyDir(SHARED_USER_DIR WII_USER_DIR DIR_SEP, File::GetUserPath(D_WIIUSER_IDX));
SConfig::GetInstance().m_SYSCONF->Reload();
if (!File::Exists(File::GetUserPath(D_GCUSER_IDX))) File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX));
if (!File::Exists(File::GetUserPath(D_CACHE_IDX))) File::CreateFullPath(File::GetUserPath(D_CACHE_IDX));
if (!File::Exists(File::GetUserPath(D_DUMPDSP_IDX))) File::CreateFullPath(File::GetUserPath(D_DUMPDSP_IDX));
if (!File::Exists(File::GetUserPath(D_DUMPTEXTURES_IDX))) File::CreateFullPath(File::GetUserPath(D_DUMPTEXTURES_IDX));
if (!File::Exists(File::GetUserPath(D_HIRESTEXTURES_IDX))) File::CreateFullPath(File::GetUserPath(D_HIRESTEXTURES_IDX));
if (!File::Exists(File::GetUserPath(D_SCREENSHOTS_IDX))) File::CreateFullPath(File::GetUserPath(D_SCREENSHOTS_IDX));
if (!File::Exists(File::GetUserPath(D_STATESAVES_IDX))) File::CreateFullPath(File::GetUserPath(D_STATESAVES_IDX));
if (!File::Exists(File::GetUserPath(D_LOGS_IDX))) {
File::CreateFullPath(File::GetUserPath(D_LOGS_IDX));
LogManager::GetInstance()->getFileListener()->Reload();
}
if (!File::Exists(File::GetUserPath(D_MAILLOGS_IDX))) File::CreateFullPath(File::GetUserPath(D_MAILLOGS_IDX));
#endif
// Gets the passed media files from command line // Gets the passed media files from command line
wxCmdLineParser parser(cmdLineDesc, argc, argv); wxCmdLineParser parser(cmdLineDesc, argc, argv);

View File

@ -108,7 +108,7 @@ CMemcardManager::CMemcardManager(wxWindow* parent, wxWindowID id, const wxString
{ {
memoryCard[SLOT_A]=NULL; memoryCard[SLOT_A]=NULL;
memoryCard[SLOT_B]=NULL; memoryCard[SLOT_B]=NULL;
if (MemcardManagerIni.Load(CONFIG_FILE)) if (MemcardManagerIni.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX)))
{ {
MemcardManagerIni.Get("MemcardManager", "Items per page", &itemsPerPage, 16); MemcardManagerIni.Get("MemcardManager", "Items per page", &itemsPerPage, 16);
MemcardManagerIni.Get("MemcardManager", "DefaultMemcardA", &(DefaultMemcard[SLOT_A]), "."); MemcardManagerIni.Get("MemcardManager", "DefaultMemcardA", &(DefaultMemcard[SLOT_A]), ".");
@ -143,7 +143,7 @@ CMemcardManager::~CMemcardManager()
MemcardManagerDebug = NULL; MemcardManagerDebug = NULL;
} }
#endif #endif
MemcardManagerIni.Load(CONFIG_FILE); MemcardManagerIni.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX));
MemcardManagerIni.Set("MemcardManager", "Items per page", itemsPerPage); MemcardManagerIni.Set("MemcardManager", "Items per page", itemsPerPage);
if (!DefaultMemcard[SLOT_A].empty() && (strcmp(DefaultMemcard[SLOT_A].c_str(), "."))) if (!DefaultMemcard[SLOT_A].empty() && (strcmp(DefaultMemcard[SLOT_A].c_str(), ".")))
@ -154,13 +154,13 @@ CMemcardManager::~CMemcardManager()
MemcardManagerIni.Set("MemcardManager", "DefaultMemcardB", DefaultMemcard[SLOT_B]); MemcardManagerIni.Set("MemcardManager", "DefaultMemcardB", DefaultMemcard[SLOT_B]);
else else
MemcardManagerIni.DeleteKey("MemcardManager", "DefaultMemcardB"); MemcardManagerIni.DeleteKey("MemcardManager", "DefaultMemcardB");
MemcardManagerIni.Save(CONFIG_FILE); MemcardManagerIni.Save(File::GetUserPath(F_DOLPHINCONFIG_IDX));
} }
CMemcardManager::CMemcardListCtrl::CMemcardListCtrl(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style) CMemcardManager::CMemcardListCtrl::CMemcardListCtrl(wxWindow* parent, const wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
: wxListCtrl(parent, id, pos, size, style) : wxListCtrl(parent, id, pos, size, style)
{ {
if (MemcardManagerIni.Load(CONFIG_FILE)) if (MemcardManagerIni.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX)))
{ {
MemcardManagerIni.Get("MemcardManager", "Use Pages", &usePages, true); MemcardManagerIni.Get("MemcardManager", "Use Pages", &usePages, true);
MemcardManagerIni.Get("MemcardManager", "cBanner", &column[COLUMN_BANNER], true); MemcardManagerIni.Get("MemcardManager", "cBanner", &column[COLUMN_BANNER], true);
@ -196,7 +196,7 @@ CMemcardManager::CMemcardListCtrl::CMemcardListCtrl(wxWindow* parent, const wxWi
CMemcardManager::CMemcardListCtrl::~CMemcardListCtrl() CMemcardManager::CMemcardListCtrl::~CMemcardListCtrl()
{ {
MemcardManagerIni.Load(CONFIG_FILE); MemcardManagerIni.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX));
MemcardManagerIni.Set("MemcardManager", "Use Pages", usePages); MemcardManagerIni.Set("MemcardManager", "Use Pages", usePages);
MemcardManagerIni.Set("MemcardManager", "cBanner", column[COLUMN_BANNER]); MemcardManagerIni.Set("MemcardManager", "cBanner", column[COLUMN_BANNER]);
@ -208,7 +208,7 @@ CMemcardManager::CMemcardListCtrl::~CMemcardListCtrl()
#ifdef DEBUG_MCM #ifdef DEBUG_MCM
MemcardManagerIni.Set("MemcardManager", "cDebug", column[NUMBER_OF_COLUMN]); MemcardManagerIni.Set("MemcardManager", "cDebug", column[NUMBER_OF_COLUMN]);
#endif #endif
MemcardManagerIni.Save(CONFIG_FILE); MemcardManagerIni.Save(File::GetUserPath(F_DOLPHINCONFIG_IDX));
} }
void CMemcardManager::CreateGUIControls() void CMemcardManager::CreateGUIControls()
@ -242,7 +242,8 @@ void CMemcardManager::CreateGUIControls()
sPages[slot]->Add(0, 0, 1, wxEXPAND|wxALL, 0); sPages[slot]->Add(0, 0, 1, wxEXPAND|wxALL, 0);
sPages[slot]->Add(m_NextPage[slot], 0, wxEXPAND|wxALL, 1); sPages[slot]->Add(m_NextPage[slot], 0, wxEXPAND|wxALL, 1);
m_MemcardPath[slot] = new wxFilePickerCtrl(this, ID_MEMCARDPATH_A + slot, T_FULL_GC_USER_DIR, wxT("Choose a memory card:"), m_MemcardPath[slot] = new wxFilePickerCtrl(this, ID_MEMCARDPATH_A + slot,
wxString::FromAscii(File::GetUserPath(D_GCUSER_IDX)), wxT("Choose a memory card:"),
wxT("Gamecube Memory Cards (*.raw,*.gcp)|*.raw;*.gcp"), wxDefaultPosition, wxDefaultSize, wxFLP_USE_TEXTCTRL|wxFLP_OPEN); wxT("Gamecube Memory Cards (*.raw,*.gcp)|*.raw;*.gcp"), wxDefaultPosition, wxDefaultSize, wxFLP_USE_TEXTCTRL|wxFLP_OPEN);
m_MemcardList[slot] = new CMemcardListCtrl(this, ID_MEMCARDLIST_A + slot, wxDefaultPosition, wxSize(350,400), m_MemcardList[slot] = new CMemcardListCtrl(this, ID_MEMCARDLIST_A + slot, wxDefaultPosition, wxSize(350,400),

View File

@ -1154,7 +1154,7 @@ bool GCMemcard::Format(bool sjis, bool New, int slot, u16 SizeMb, bool hdrOnly)
// Only Format 16MB memcards for now // Only Format 16MB memcards for now
if ((SizeMb != MemCard2043Mb) || (data_size != mc_data_size)) return false; if ((SizeMb != MemCard2043Mb) || (data_size != mc_data_size)) return false;
pStream = fopen(GC_SRAM_FILE, "rb"); pStream = fopen(File::GetUserPath(F_GCSRAM_IDX), "rb");
if (pStream == NULL) if (pStream == NULL)
{ {
PanicAlert("Could not open SRAM file"); PanicAlert("Could not open SRAM file");

View File

@ -503,7 +503,7 @@ bool CWiiSaveCrypted::getPaths(bool _export)
{ {
if (_saveGameTitle) if (_saveGameTitle)
{ {
sprintf(pathSavedir, FULL_WII_USER_DIR "title/%08x/%08x/data/", (u32)(_saveGameTitle>>32), (u32)_saveGameTitle); sprintf(pathSavedir, "%stitle/%08x/%08x/data/", File::GetUserPath(D_WIIUSER_IDX), (u32)(_saveGameTitle>>32), (u32)_saveGameTitle);
sprintf(pathBanner_bin, "%sbanner.bin", pathSavedir); sprintf(pathBanner_bin, "%sbanner.bin", pathSavedir);
sprintf(_saveGameString, "%c%c%c%c", sprintf(_saveGameString, "%c%c%c%c",
(u8)(_saveGameTitle >> 24) & 0xFF, (u8)(_saveGameTitle >> 16) & 0xFF, (u8)(_saveGameTitle >> 24) & 0xFF, (u8)(_saveGameTitle >> 16) & 0xFF,

View File

@ -17,7 +17,7 @@
#include "NetSockets.h" #include "NetSockets.h"
#include "NetWindow.h" #include "NetWindow.h"
#include "FileUtil.h"
// Main Frame window // Main Frame window
@ -52,13 +52,13 @@ NetPlay::NetPlay(wxWindow* parent, std::string GamePaths, std::string GameNames)
NetPlay::~NetPlay() NetPlay::~NetPlay()
{ {
ConfigIni.Load(CONFIG_FILE); ConfigIni.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX));
ConfigIni.Set("Netplay", "Nickname", m_nick); ConfigIni.Set("Netplay", "Nickname", m_nick);
ConfigIni.Set("Netplay", "UsedPort", (int)m_port); ConfigIni.Set("Netplay", "UsedPort", (int)m_port);
ConfigIni.Set("Netplay", "LastIP", m_address); ConfigIni.Set("Netplay", "LastIP", m_address);
ConfigIni.Save(CONFIG_FILE); ConfigIni.Save(File::GetUserPath(F_DOLPHINCONFIG_IDX));
} }
void NetPlay::OnJoin(wxCommandEvent& WXUNUSED(event)) void NetPlay::OnJoin(wxCommandEvent& WXUNUSED(event))
@ -255,7 +255,7 @@ void NetPlay::DrawGUI()
panel->SetSizerAndFit(sMain); panel->SetSizerAndFit(sMain);
sMain->SetSizeHints((wxWindow*)this); sMain->SetSizeHints((wxWindow*)this);
if (ConfigIni.Load(CONFIG_FILE)) if (ConfigIni.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX)))
{ {
ConfigIni.Get("Netplay", "Nickname", &m_nick, "Unnamed"); ConfigIni.Get("Netplay", "Nickname", &m_nick, "Unnamed");
ConfigIni.Get("Netplay", "UsedPort", (int*)&m_port, 12345); ConfigIni.Get("Netplay", "UsedPort", (int*)&m_port, 12345);

View File

@ -104,8 +104,8 @@ if sys.platform == 'darwin':
)) ))
) )
else: else:
exeGUI = env['binary_dir'] + 'Dolphin' exeGUI = env['binary_dir'] + 'dolphin-emu'
exeNoGUI = env['binary_dir'] + 'DolphinNoGUI' exeNoGUI = env['binary_dir'] + 'dolphin-emu-nogui'
#objects = [ wxenv.Object(srcFile) for srcFile in files ] #objects = [ wxenv.Object(srcFile) for srcFile in files ]

View File

@ -58,7 +58,7 @@ bool AVIDump::CreateFile()
m_totalBytes = 0; m_totalBytes = 0;
m_frameCount = 0; m_frameCount = 0;
char movie_file_name[255]; char movie_file_name[255];
sprintf(movie_file_name, "%s/framedump%d.avi", FULL_FRAMES_DIR, m_fileCount); sprintf(movie_file_name, "%sframedump%d.avi", File::GetUserPath(D_DUMPFRAMES_IDX), m_fileCount);
// Create path // Create path
File::CreateFullPath(movie_file_name); File::CreateFullPath(movie_file_name);

View File

@ -36,9 +36,9 @@ void Init(const char *gameCode)
static bool bCheckedDir; static bool bCheckedDir;
CFileSearch::XStringVector Directories; CFileSearch::XStringVector Directories;
//Directories.push_back(std::string(FULL_HIRES_TEXTURES_DIR)); //Directories.push_back(std::string(File::GetUserPath(D_HIRESTEXTURES_IDX)));
char szDir[MAX_PATH]; char szDir[MAX_PATH];
sprintf(szDir,"%s/%s",FULL_HIRES_TEXTURES_DIR,gameCode); sprintf(szDir,"%s%s",File::GetUserPath(D_HIRESTEXTURES_IDX),gameCode);
Directories.push_back(std::string(szDir)); Directories.push_back(std::string(szDir));

View File

@ -62,7 +62,8 @@ void TexDecoder_OpenCL_Initialize() {
return; return;
std::string code; std::string code;
char* filename = "User/OpenCL/TextureDecoder.cl"; char filename[1024];
sprintf(filename, "%sOpenCL/TextureDecoder.cl", File::GetUserPath(D_USER_IDX));
if (!File::ReadFileToString(true, filename, code)) if (!File::ReadFileToString(true, filename, code))
{ {
ERROR_LOG(VIDEO, "Failed to load OpenCL code %s - file is missing?", filename); ERROR_LOG(VIDEO, "Failed to load OpenCL code %s - file is missing?", filename);

View File

@ -21,6 +21,7 @@
#include "IniFile.h" #include "IniFile.h"
#include "VideoConfig.h" #include "VideoConfig.h"
#include "VideoCommon.h" #include "VideoCommon.h"
#include "FileUtil.h"
VideoConfig g_Config; VideoConfig g_Config;
VideoConfig g_ActiveConfig; VideoConfig g_ActiveConfig;
@ -100,7 +101,7 @@ void VideoConfig::Load(const char *ini_file)
iniFile.Get("Hardware", "SimpleFB", &bSimpleFB, false); iniFile.Get("Hardware", "SimpleFB", &bSimpleFB, false);
// Load common settings // Load common settings
iniFile.Load(CONFIG_FILE); iniFile.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX));
bool bTmp; bool bTmp;
iniFile.Get("Interface", "UsePanicHandlers", &bTmp, true); iniFile.Get("Interface", "UsePanicHandlers", &bTmp, true);
SetEnableAlert(bTmp); SetEnableAlert(bTmp);

View File

@ -20,6 +20,7 @@
#include "IniFile.h" #include "IniFile.h"
#include "Config.h" #include "Config.h"
#include "AudioCommon.h" #include "AudioCommon.h"
#include "FileUtil.h"
CConfig g_Config; CConfig g_Config;
@ -32,7 +33,7 @@ void CConfig::Load()
{ {
// first load defaults // first load defaults
IniFile file; IniFile file;
file.Load(FULL_CONFIG_DIR "DSP.ini"); file.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "DSP.ini").c_str());
file.Get("Config", "EnableHLEAudio", &m_EnableHLEAudio, true); // Sound Settings file.Get("Config", "EnableHLEAudio", &m_EnableHLEAudio, true); // Sound Settings
file.Get("Config", "EnableRE0AudioFix", &m_EnableRE0Fix, false); // RE0 Hack file.Get("Config", "EnableRE0AudioFix", &m_EnableRE0Fix, false); // RE0 Hack
ac_Config.Load(file); ac_Config.Load(file);
@ -41,12 +42,12 @@ void CConfig::Load()
void CConfig::Save() void CConfig::Save()
{ {
IniFile file; IniFile file;
file.Load(FULL_CONFIG_DIR "DSP.ini"); file.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "DSP.ini").c_str());
file.Set("Config", "EnableHLEAudio", m_EnableHLEAudio); // Sound Settings file.Set("Config", "EnableHLEAudio", m_EnableHLEAudio); // Sound Settings
file.Set("Config", "EnableRE0AudioFix", m_EnableRE0Fix); // RE0 Hack file.Set("Config", "EnableRE0AudioFix", m_EnableRE0Fix); // RE0 Hack
ac_Config.Set(file); ac_Config.Set(file);
file.Save(FULL_CONFIG_DIR "DSP.ini"); file.Save((std::string(File::GetUserPath(D_CONFIG_IDX)) + "DSP.ini").c_str());
} }
void CConfig::GameIniLoad(const char *game_ini) void CConfig::GameIniLoad(const char *game_ini)

View File

@ -96,7 +96,7 @@ DSPDebuggerHLE::DSPDebuggerHLE(wxWindow *parent, wxWindowID id, const wxString &
// load ini... // load ini...
IniFile file; IniFile file;
file.Load(DEBUGGER_CONFIG_FILE); file.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
this->Load(file); this->Load(file);
// append block names // append block names
@ -150,9 +150,9 @@ DSPDebuggerHLE::~DSPDebuggerHLE()
/* /*
// empty // empty
IniFile file; IniFile file;
file.Load(DEBUGGER_CONFIG_FILE); file.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
this->Save(file); this->Save(file);
file.Save(DEBUGGER_CONFIG_FILE); file.Save(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
*/ */
// Reset // Reset
@ -173,9 +173,9 @@ void DSPDebuggerHLE::OnClose(wxCloseEvent& event)
// Save the window position // Save the window position
IniFile file; IniFile file;
file.Load(DEBUGGER_CONFIG_FILE); file.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
this->Save(file); this->Save(file);
file.Save(DEBUGGER_CONFIG_FILE); file.Save(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
//EndModal(0); //EndModal(0);
//Close(true); //Close(true);

View File

@ -95,7 +95,7 @@ void DSPDebuggerHLE::ReadDir()
{ {
CFileSearch::XStringVector Directories; CFileSearch::XStringVector Directories;
//Directories.push_back("Logs/Mail"); //Directories.push_back("Logs/Mail");
Directories.push_back(FULL_MAIL_LOGS_DIR); Directories.push_back(File::GetUserPath(D_MAILLOGS_IDX));
CFileSearch::XStringVector Extensions; CFileSearch::XStringVector Extensions;
Extensions.push_back("*.log"); Extensions.push_back("*.log");
@ -241,8 +241,8 @@ void DSPDebuggerHLE::Readfile(std::string FileName, bool GC)
std::string sz = ""; std::string sz = "";
std::ostringstream ci; std::ostringstream ci;
ci << i; ci << i;
std::string f0 = FULL_MAIL_LOGS_DIR + FileName + "_sep" + ci.str() + "_sep" + "0_sep" + (GC ? "GC" : "Wii") + "_sep.log"; std::string f0 = std::string(File::GetUserPath(D_MAILLOGS_IDX)) + FileName + "_sep" + ci.str() + "_sep" + "0_sep" + (GC ? "GC" : "Wii") + "_sep.log";
std::string f1 = FULL_MAIL_LOGS_DIR + FileName + "_sep" + ci.str() + "_sep" + "1_sep" + (GC ? "GC" : "Wii") + "_sep.log"; std::string f1 = std::string(File::GetUserPath(D_MAILLOGS_IDX)) + FileName + "_sep" + ci.str() + "_sep" + "1_sep" + (GC ? "GC" : "Wii") + "_sep.log";
//Console::Print("ifstream %s %s\n", f0.c_str(), f1.c_str()); //Console::Print("ifstream %s %s\n", f0.c_str(), f1.c_str());

View File

@ -77,7 +77,7 @@ void CUCode_AX::SaveLogFile(std::string f, int resizeTo, bool type, bool Wii)
ci << (resizeTo - 1); // write ci ci << (resizeTo - 1); // write ci
cType << type; // write cType cType << type; // write cType
std::string FileName = FULL_MAIL_LOGS_DIR + std::string(globals->unique_id); std::string FileName = std::string(File::GetUserPath(D_MAILLOGS_IDX)) + std::string(globals->unique_id);
FileName += "_sep"; FileName += ci.str(); FileName += "_sep"; FileName += cType.str(); FileName += "_sep"; FileName += ci.str(); FileName += "_sep"; FileName += cType.str();
FileName += Wii ? "_sepWii_sep" : "_sepGC_sep"; FileName += ".log"; FileName += Wii ? "_sepWii_sep" : "_sepGC_sep"; FileName += ".log";

View File

@ -19,6 +19,7 @@
#include "IniFile.h" #include "IniFile.h"
#include "Config.h" #include "Config.h"
#include "AudioCommon.h" #include "AudioCommon.h"
#include "FileUtil.h"
#define LLE_CONFIG_FILE "DSPLLE.ini" #define LLE_CONFIG_FILE "DSPLLE.ini"
@ -33,15 +34,15 @@ void CConfig::Load()
{ {
// first load defaults // first load defaults
IniFile file; IniFile file;
file.Load(FULL_CONFIG_DIR LLE_CONFIG_FILE); file.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + LLE_CONFIG_FILE).c_str());
ac_Config.Load(file); ac_Config.Load(file);
} }
void CConfig::Save() void CConfig::Save()
{ {
IniFile file; IniFile file;
file.Load(FULL_CONFIG_DIR LLE_CONFIG_FILE); file.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + LLE_CONFIG_FILE).c_str());
ac_Config.Set(file); ac_Config.Set(file);
file.Save(FULL_CONFIG_DIR LLE_CONFIG_FILE); file.Save((std::string(File::GetUserPath(D_CONFIG_IDX)) + LLE_CONFIG_FILE).c_str());
} }

View File

@ -32,8 +32,8 @@ bool DumpDSPCode(const u8 *code_be, int size_in_bytes, u32 crc)
{ {
char binFile[MAX_PATH]; char binFile[MAX_PATH];
char txtFile[MAX_PATH]; char txtFile[MAX_PATH];
sprintf(binFile, "%sDSP_UC_%08X.bin", FULL_DSP_DUMP_DIR, crc); sprintf(binFile, "%sDSP_UC_%08X.bin", File::GetUserPath(D_DUMPDSP_IDX), crc);
sprintf(txtFile, "%sDSP_UC_%08X.txt", FULL_DSP_DUMP_DIR, crc); sprintf(txtFile, "%sDSP_UC_%08X.txt", File::GetUserPath(D_DUMPDSP_IDX), crc);
FILE* pFile = fopen(binFile, "wb"); FILE* pFile = fopen(binFile, "wb");
if (pFile) if (pFile)
@ -93,7 +93,7 @@ u32 GenerateCRC(const unsigned char* _pBuffer, int _pLength)
bool DumpCWCode(u32 _Address, u32 _Length) bool DumpCWCode(u32 _Address, u32 _Length)
{ {
char filename[256]; char filename[256];
sprintf(filename, "%sDSP_UCode.bin", FULL_DSP_DUMP_DIR); sprintf(filename, "%sDSP_UCode.bin", File::GetUserPath(D_DUMPDSP_IDX));
FILE* pFile = fopen(filename, "wb"); FILE* pFile = fopen(filename, "wb");
if (pFile != NULL) if (pFile != NULL)

View File

@ -22,6 +22,7 @@
#include "IniFile.h" #include "IniFile.h"
#include "Config.h" #include "Config.h"
#include "GCPad.h" #include "GCPad.h"
#include "FileUtil.h"
static const char* gcControlNames[] = static const char* gcControlNames[] =
{ {
@ -156,7 +157,7 @@ void Config::Save()
{ {
// Load ini file // Load ini file
IniFile file; IniFile file;
file.Load(FULL_CONFIG_DIR "GCPad.ini"); file.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "GCPad.ini").c_str());
// ================================================================== // ==================================================================
// Global settings // Global settings
@ -199,7 +200,7 @@ void Config::Save()
file.Set(SectionName.c_str(), gcControlNames[x], GCMapping[i].Button[x]); file.Set(SectionName.c_str(), gcControlNames[x], GCMapping[i].Button[x]);
} }
file.Save(FULL_CONFIG_DIR "GCPad.ini"); file.Save((std::string(File::GetUserPath(D_CONFIG_IDX)) + "GCPad.ini").c_str());
} }
// Load settings from file // Load settings from file
@ -208,7 +209,7 @@ void Config::Load()
{ {
// Load file // Load file
IniFile file; IniFile file;
file.Load(FULL_CONFIG_DIR "GCPad.ini"); file.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "GCPad.ini").c_str());
// ================================================================== // ==================================================================
// Global settings // Global settings

View File

@ -18,6 +18,7 @@
#include "IniFile.h" #include "IniFile.h"
#include "Debugger.h" #include "Debugger.h"
#include "FileUtil.h"
#include "VideoConfig.h" #include "VideoConfig.h"
#include "../Globals.h" #include "../Globals.h"
@ -75,7 +76,7 @@ void GFXDebuggerDX9::OnClose(wxCloseEvent& event)
void GFXDebuggerDX9::SaveSettings() const void GFXDebuggerDX9::SaveSettings() const
{ {
IniFile file; IniFile file;
file.Load(DEBUGGER_CONFIG_FILE); file.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
// TODO: make this work when we close the entire program too, currently on total close we get // TODO: make this work when we close the entire program too, currently on total close we get
// weird values, perhaps because of some conflict with the rendering window // weird values, perhaps because of some conflict with the rendering window
@ -100,13 +101,13 @@ void GFXDebuggerDX9::SaveSettings() const
//file.Set("VideoWindow", "ConfBits", g_Config.iLog); //file.Set("VideoWindow", "ConfBits", g_Config.iLog);
file.Save(DEBUGGER_CONFIG_FILE); file.Save(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
} }
void GFXDebuggerDX9::LoadSettings() void GFXDebuggerDX9::LoadSettings()
{ {
IniFile file; IniFile file;
file.Load(DEBUGGER_CONFIG_FILE); file.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
int x = 100, y = 100, w = 100, h = 100; int x = 100, y = 100, w = 100, h = 100;
file.Get("VideoWindow", "x", &x, GetPosition().x); file.Get("VideoWindow", "x", &x, GetPosition().x);

View File

@ -20,6 +20,7 @@
#include "resource.h" #include "resource.h"
#include "W32Util/PropertySheet.h" #include "W32Util/PropertySheet.h"
#include "W32Util/ShellUtil.h" #include "W32Util/ShellUtil.h"
#include "FileUtil.h"
#include "D3DBase.h" #include "D3DBase.h"
@ -137,7 +138,7 @@ struct TabDirect3D : public W32Util::Tab
g_Config.bFullscreen = Button_GetCheck(GetDlgItem(hDlg, IDC_FULLSCREENENABLE)) ? true : false; g_Config.bFullscreen = Button_GetCheck(GetDlgItem(hDlg, IDC_FULLSCREENENABLE)) ? true : false;
g_Config.bVSync = Button_GetCheck(GetDlgItem(hDlg, IDC_VSYNC)) ? true : false; g_Config.bVSync = Button_GetCheck(GetDlgItem(hDlg, IDC_VSYNC)) ? true : false;
g_Config.RenderToMainframe = Button_GetCheck(GetDlgItem(hDlg, IDC_RENDER_TO_MAINWINDOW)) ? true : false; g_Config.RenderToMainframe = Button_GetCheck(GetDlgItem(hDlg, IDC_RENDER_TO_MAINWINDOW)) ? true : false;
g_Config.Save(FULL_CONFIG_DIR "gfx_dx9.ini"); g_Config.Save((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_dx9.ini").c_str());
} }
}; };
@ -211,7 +212,7 @@ struct TabAdvanced : public W32Util::Tab
g_Config.bEFBCopyDisable = Button_GetCheck(GetDlgItem(hDlg,IDC_ENABLEEFBCOPY)) ? false : true; g_Config.bEFBCopyDisable = Button_GetCheck(GetDlgItem(hDlg,IDC_ENABLEEFBCOPY)) ? false : true;
g_Config.bCopyEFBToTexture = Button_GetCheck(GetDlgItem(hDlg,IDC_EFBTORAM)) ? false : true; g_Config.bCopyEFBToTexture = Button_GetCheck(GetDlgItem(hDlg,IDC_EFBTORAM)) ? false : true;
g_Config.Save(FULL_CONFIG_DIR "gfx_dx9.ini"); g_Config.Save((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_dx9.ini").c_str());
if( D3D::dev != NULL ) { if( D3D::dev != NULL ) {
D3D::SetRenderState( D3DRS_FILLMODE, g_Config.bWireFrame ? D3DFILL_WIREFRAME : D3DFILL_SOLID ); D3D::SetRenderState( D3DRS_FILLMODE, g_Config.bWireFrame ? D3DFILL_WIREFRAME : D3DFILL_SOLID );
@ -264,7 +265,7 @@ struct TabEnhancements : public W32Util::Tab
g_Config.bForceFiltering = Button_GetCheck(GetDlgItem(hDlg, IDC_FORCEFILTERING)) ? true : false; g_Config.bForceFiltering = Button_GetCheck(GetDlgItem(hDlg, IDC_FORCEFILTERING)) ? true : false;
g_Config.bHiresTextures = Button_GetCheck(GetDlgItem(hDlg, IDC_LOADHIRESTEXTURE)) ? true : false; g_Config.bHiresTextures = Button_GetCheck(GetDlgItem(hDlg, IDC_LOADHIRESTEXTURE)) ? true : false;
g_Config.bCopyEFBScaled = Button_GetCheck(GetDlgItem(hDlg,IDC_EFBSCALEDCOPY)) ? true : false; g_Config.bCopyEFBScaled = Button_GetCheck(GetDlgItem(hDlg,IDC_EFBSCALEDCOPY)) ? true : false;
g_Config.Save(FULL_CONFIG_DIR "gfx_dx9.ini"); g_Config.Save((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_dx9.ini").c_str());
} }
}; };
@ -274,7 +275,7 @@ void DlgSettings_Show(HINSTANCE hInstance, HWND _hParent)
bool tfoe = g_Config.bTexFmtOverlayEnable; bool tfoe = g_Config.bTexFmtOverlayEnable;
bool tfoc = g_Config.bTexFmtOverlayCenter; bool tfoc = g_Config.bTexFmtOverlayCenter;
g_Config.Load(FULL_CONFIG_DIR "gfx_dx9.ini"); g_Config.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_dx9.ini").c_str());
W32Util::PropSheet sheet; W32Util::PropSheet sheet;
sheet.Add(new TabDirect3D, (LPCTSTR)IDD_SETTINGS,_T("Direct3D")); sheet.Add(new TabDirect3D, (LPCTSTR)IDD_SETTINGS,_T("Direct3D"));
sheet.Add(new TabEnhancements, (LPCTSTR)IDD_ENHANCEMENTS,_T("Enhancements")); sheet.Add(new TabEnhancements, (LPCTSTR)IDD_ENHANCEMENTS,_T("Enhancements"));
@ -295,4 +296,4 @@ void DlgSettings_Show(HINSTANCE hInstance, HWND _hParent)
{ {
TextureCache::Invalidate(false); TextureCache::Invalidate(false);
} }
} }

View File

@ -150,11 +150,11 @@ void PixelShaderCache::Init()
s_DepthMatrixProgram = D3D::CompileAndCreatePixelShader(pprog, (int)strlen(pprog)); s_DepthMatrixProgram = D3D::CompileAndCreatePixelShader(pprog, (int)strlen(pprog));
Clear(); Clear();
if (!File::Exists(FULL_SHADERCACHE_DIR)) if (!File::Exists(File::GetUserPath(D_SHADERCACHE_IDX)))
File::CreateDir(FULL_SHADERCACHE_DIR); File::CreateDir(File::GetUserPath(D_SHADERCACHE_IDX));
char cache_filename[MAX_PATH]; char cache_filename[MAX_PATH];
sprintf(cache_filename, "%s%s-ps.cache", FULL_SHADERCACHE_DIR, globals->unique_id); sprintf(cache_filename, "%s%s-ps.cache", File::GetUserPath(D_SHADERCACHE_IDX), globals->unique_id);
PixelShaderCacheInserter inserter; PixelShaderCacheInserter inserter;
int read_items = g_ps_disk_cache.OpenAndRead(cache_filename, &inserter); int read_items = g_ps_disk_cache.OpenAndRead(cache_filename, &inserter);
} }
@ -231,7 +231,7 @@ bool PixelShaderCache::SetShader(bool dstAlpha)
if (g_ActiveConfig.iLog & CONF_SAVESHADERS && code) { if (g_ActiveConfig.iLog & CONF_SAVESHADERS && code) {
static int counter = 0; static int counter = 0;
char szTemp[MAX_PATH]; char szTemp[MAX_PATH];
sprintf(szTemp, "%s/ps_%04i.txt", FULL_DUMP_DIR, counter++); sprintf(szTemp, "%sps_%04i.txt", File::GetUserPath(D_DUMP_IDX), counter++);
SaveData(szTemp, code); SaveData(szTemp, code);
} }
@ -290,4 +290,4 @@ std::string PixelShaderCache::GetCurrentShaderCode()
else else
return "(no shader)\n"; return "(no shader)\n";
} }
#endif #endif

View File

@ -21,6 +21,7 @@
#include "StringUtil.h" #include "StringUtil.h"
#include "Common.h" #include "Common.h"
#include "FileUtil.h"
#include "Thread.h" #include "Thread.h"
#include "Timer.h" #include "Timer.h"
#include "Statistics.h" #include "Statistics.h"
@ -616,7 +617,7 @@ static void EFBTextureToD3DBackBuffer(const EFBRectangle& sourceRc)
else else
{ {
char msg [255]; char msg [255];
sprintf(msg, "Dumping Frames to \"%s/framedump0.avi\" (%dx%d RGB24)", FULL_FRAMES_DIR, s_recordWidth, s_recordHeight); sprintf(msg, "Dumping Frames to \"%sframedump0.avi\" (%dx%d RGB24)", File::GetUserPath(D_DUMPFRAMES_IDX), s_recordWidth, s_recordHeight);
OSD::AddMessage(msg, 2000); OSD::AddMessage(msg, 2000);
} }
} }

View File

@ -293,7 +293,7 @@ TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width,
const char* uniqueId = globals->unique_id; const char* uniqueId = globals->unique_id;
bool bCheckedDumpDir = false; bool bCheckedDumpDir = false;
sprintf(szDir, "%s/%s", FULL_DUMP_TEXTURES_DIR, uniqueId); sprintf(szDir, "%s%s", File::GetUserPath(D_DUMPTEXTURES_IDX), uniqueId);
if (!bCheckedDumpDir) if (!bCheckedDumpDir)
{ {

View File

@ -34,6 +34,7 @@
#include "D3DShader.h" #include "D3DShader.h"
#include "TextureCache.h" #include "TextureCache.h"
#include "Math.h" #include "Math.h"
#include "FileUtil.h"
namespace TextureConverter namespace TextureConverter
{ {
@ -124,7 +125,7 @@ LPDIRECT3DPIXELSHADER9 GetOrCreateEncodingShader(u32 format)
if (g_ActiveConfig.iLog & CONF_SAVESHADERS && shader) { if (g_ActiveConfig.iLog & CONF_SAVESHADERS && shader) {
static int counter = 0; static int counter = 0;
char szTemp[MAX_PATH]; char szTemp[MAX_PATH];
sprintf(szTemp, "%s/enc_%04i.txt", FULL_DUMP_DIR, counter++); sprintf(szTemp, "%senc_%04i.txt", File::GetUserPath(D_DUMP_IDX), counter++);
SaveData(szTemp, shader); SaveData(szTemp, shader);
} }

View File

@ -170,11 +170,11 @@ void VertexShaderCache::Init()
Clear(); Clear();
delete [] vSimpleProg; delete [] vSimpleProg;
if (!File::Exists(FULL_SHADERCACHE_DIR)) if (!File::Exists(File::GetUserPath(D_SHADERCACHE_IDX)))
File::CreateDir(FULL_SHADERCACHE_DIR); File::CreateDir(File::GetUserPath(D_SHADERCACHE_IDX));
char cache_filename[MAX_PATH]; char cache_filename[MAX_PATH];
sprintf(cache_filename, "%s%s-vs.cache", FULL_SHADERCACHE_DIR, globals->unique_id); sprintf(cache_filename, "%s%s-vs.cache", File::GetUserPath(D_SHADERCACHE_IDX), globals->unique_id);
VertexShaderCacheInserter inserter; VertexShaderCacheInserter inserter;
int read_items = g_vs_disk_cache.OpenAndRead(cache_filename, &inserter); int read_items = g_vs_disk_cache.OpenAndRead(cache_filename, &inserter);
} }
@ -280,4 +280,4 @@ std::string VertexShaderCache::GetCurrentShaderCode()
{ {
return "(N/A)\n"; return "(N/A)\n";
} }
#endif #endif

View File

@ -232,7 +232,7 @@ void Initialize(void *init)
g_VideoInitialize = *_pVideoInitialize; g_VideoInitialize = *_pVideoInitialize;
InitXFBConvTables(); InitXFBConvTables();
g_Config.Load(FULL_CONFIG_DIR "gfx_dx9.ini"); g_Config.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_dx9.ini").c_str());
g_Config.GameIniLoad(globals->game_ini); g_Config.GameIniLoad(globals->game_ini);
UpdateProjectionHack(g_Config.iPhackvalue); // DX9 projection hack could be disabled by commenting out this line UpdateProjectionHack(g_Config.iPhackvalue); // DX9 projection hack could be disabled by commenting out this line
UpdateActiveConfig(); UpdateActiveConfig();

View File

@ -21,6 +21,7 @@
#include "VideoConfig.h" #include "VideoConfig.h"
#include "../Globals.h" #include "../Globals.h"
#include "FileUtil.h"
extern int g_Preset; extern int g_Preset;
@ -65,7 +66,7 @@ void GFXDebuggerOGL::OnClose(wxCloseEvent& event)
void GFXDebuggerOGL::SaveSettings() const void GFXDebuggerOGL::SaveSettings() const
{ {
IniFile file; IniFile file;
file.Load(DEBUGGER_CONFIG_FILE); file.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
// TODO: make this work when we close the entire program too, currently on total close we get // TODO: make this work when we close the entire program too, currently on total close we get
// weird values, perhaps because of some conflict with the rendering window // weird values, perhaps because of some conflict with the rendering window
@ -90,13 +91,13 @@ void GFXDebuggerOGL::SaveSettings() const
file.Set("VideoWindow", "ConfBits", g_Config.iLog); file.Set("VideoWindow", "ConfBits", g_Config.iLog);
file.Save(DEBUGGER_CONFIG_FILE); file.Save(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
} }
void GFXDebuggerOGL::LoadSettings() void GFXDebuggerOGL::LoadSettings()
{ {
IniFile file; IniFile file;
file.Load(DEBUGGER_CONFIG_FILE); file.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
int x = 100, y = 100, w = 100, h = 100; int x = 100, y = 100, w = 100, h = 100;
file.Get("VideoWindow", "x", &x, GetPosition().x); file.Get("VideoWindow", "x", &x, GetPosition().x);

View File

@ -292,10 +292,10 @@ void GFXConfigDialogOGL::CreateGUIControls()
m_ReloadShader = new wxButton(m_PageGeneral, ID_RELOADSHADER, wxT("&Reload"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); m_ReloadShader = new wxButton(m_PageGeneral, ID_RELOADSHADER, wxT("&Reload"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_EditShader = new wxButton(m_PageGeneral, ID_EDITSHADER, wxT("&Edit"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); m_EditShader = new wxButton(m_PageGeneral, ID_EDITSHADER, wxT("&Edit"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
if (File::IsDirectory("User/Shaders")) if (File::IsDirectory(File::GetUserPath(D_SHADERS_IDX)))
{ {
File::FSTEntry entry; File::FSTEntry entry;
File::ScanDirectoryTree("User/Shaders", entry); File::ScanDirectoryTree(File::GetUserPath(D_SHADERS_IDX), entry);
for (u32 i = 0; i < entry.children.size(); i++) for (u32 i = 0; i < entry.children.size(); i++)
{ {
std::string name = entry.children[i].virtualName.c_str(); std::string name = entry.children[i].virtualName.c_str();
@ -306,7 +306,7 @@ void GFXConfigDialogOGL::CreateGUIControls()
} }
else else
{ {
File::CreateDir("User/Shaders"); File::CreateDir(File::GetUserPath(D_SHADERS_IDX));
} }
wxString shader= wxString::FromAscii(g_Config.sPostProcessingShader.c_str()); wxString shader= wxString::FromAscii(g_Config.sPostProcessingShader.c_str());
@ -547,7 +547,7 @@ void GFXConfigDialogOGL::EditShaderClick(wxCommandEvent& WXUNUSED (event))
{ {
if (m_PostShaderCB->GetStringSelection() == wxT("(off)")) if (m_PostShaderCB->GetStringSelection() == wxT("(off)"))
return; return;
wxString shader = wxT("User/Shaders/") + m_PostShaderCB->GetStringSelection() + _(".txt"); wxString shader = wxString::FromAscii(File::GetUserPath(D_SHADERS_IDX)) + m_PostShaderCB->GetStringSelection() + _(".txt");
if (wxFileExists(shader)) if (wxFileExists(shader))
{ {
wxFileType* filetype = wxTheMimeTypesManager->GetFileTypeFromExtension(_("txt")); wxFileType* filetype = wxTheMimeTypesManager->GetFileTypeFromExtension(_("txt"));
@ -737,7 +737,7 @@ void GFXConfigDialogOGL::AdvancedSettingsChanged(wxCommandEvent& event)
void GFXConfigDialogOGL::CloseWindow() void GFXConfigDialogOGL::CloseWindow()
{ {
// Save the config to INI // Save the config to INI
g_Config.Save(FULL_CONFIG_DIR "gfx_opengl.ini"); g_Config.Save((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_opengl.ini").c_str());
EndModal(1); EndModal(1);
} }

View File

@ -528,7 +528,7 @@ void Show()
/* /*
bool bVideoWindow = false; bool bVideoWindow = false;
IniFile ini; IniFile ini;
ini.Load(DEBUGGER_CONFIG_FILE); ini.Load(File::GetUserPath(F_DEBUGGERCONFIG_IDX));
ini.Get("ShowOnStart", "VideoWindow", &bVideoWindow, false); ini.Get("ShowOnStart", "VideoWindow", &bVideoWindow, false);
if(bVideoWindow) DoDllDebugger(); if(bVideoWindow) DoDllDebugger();
*/ */

View File

@ -33,6 +33,7 @@
#include "VertexShaderGen.h" #include "VertexShaderGen.h"
#include "PixelShaderCache.h" #include "PixelShaderCache.h"
#include "PixelShaderManager.h" #include "PixelShaderManager.h"
#include "FileUtil.h"
static int s_nMaxPixelInstructions; static int s_nMaxPixelInstructions;
static GLuint s_ColorMatrixProgram = 0; static GLuint s_ColorMatrixProgram = 0;
@ -204,7 +205,7 @@ FRAGMENTSHADER* PixelShaderCache::GetShader(bool dstAlphaEnable)
if (g_ActiveConfig.iLog & CONF_SAVESHADERS && code) { if (g_ActiveConfig.iLog & CONF_SAVESHADERS && code) {
static int counter = 0; static int counter = 0;
char szTemp[MAX_PATH]; char szTemp[MAX_PATH];
sprintf(szTemp, "%s/ps_%04i.txt", FULL_DUMP_DIR, counter++); sprintf(szTemp, "%sps_%04i.txt", File::GetUserPath(D_DUMP_IDX), counter++);
SaveData(szTemp, code); SaveData(szTemp, code);
} }

View File

@ -45,11 +45,11 @@ void ReloadShader()
bool ApplyShader() bool ApplyShader()
{ {
if (s_currentShader != "User/Shaders/" + g_ActiveConfig.sPostProcessingShader + ".txt") if (s_currentShader != std::string(File::GetUserPath(D_SHADERS_IDX)) + g_ActiveConfig.sPostProcessingShader + ".txt")
{ {
// Set immediately to prevent endless recompiles on failure. // Set immediately to prevent endless recompiles on failure.
if (!g_ActiveConfig.sPostProcessingShader.empty()) if (!g_ActiveConfig.sPostProcessingShader.empty())
s_currentShader = "User/Shaders/" + g_ActiveConfig.sPostProcessingShader + ".txt"; s_currentShader = std::string(File::GetUserPath(D_SHADERS_IDX)) + g_ActiveConfig.sPostProcessingShader + ".txt";
else else
s_currentShader.clear(); s_currentShader.clear();

View File

@ -29,6 +29,8 @@
#include <Cg/cg.h> #include <Cg/cg.h>
#include <Cg/cgGL.h> #include <Cg/cgGL.h>
#include "FileUtil.h"
#ifdef _WIN32 #ifdef _WIN32
#include <mmsystem.h> #include <mmsystem.h>
#endif #endif
@ -942,7 +944,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight)
else else
{ {
OSD::AddMessage(StringFromFormat( OSD::AddMessage(StringFromFormat(
"Dumping Frames to \"%s/framedump0.avi\" (%dx%d RGB24)", FULL_FRAMES_DIR, w, h).c_str(), 2000); "Dumping Frames to \"%sframedump0.avi\" (%dx%d RGB24)", File::GetUserPath(D_DUMPFRAMES_IDX), w, h).c_str(), 2000);
} }
} }
if (s_bAVIDumping) if (s_bAVIDumping)
@ -981,7 +983,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight)
glReadPixels(0, Renderer::GetTargetHeight() - h, w, h, GL_RGB, GL_UNSIGNED_BYTE, data); glReadPixels(0, Renderer::GetTargetHeight() - h, w, h, GL_RGB, GL_UNSIGNED_BYTE, data);
if (glGetError() == GL_NO_ERROR) { if (glGetError() == GL_NO_ERROR) {
if (!s_bLastFrameDumped) { if (!s_bLastFrameDumped) {
sprintf(movie_file_name, "%s/framedump.raw", FULL_FRAMES_DIR); sprintf(movie_file_name, "%sframedump.raw", File::GetUserPath(D_DUMPFRAMES_IDX));
f_pFrameDump = fopen(movie_file_name, "wb"); f_pFrameDump = fopen(movie_file_name, "wb");
if (f_pFrameDump == NULL) { if (f_pFrameDump == NULL) {
PanicAlert("Error opening framedump.raw for writing."); PanicAlert("Error opening framedump.raw for writing.");

View File

@ -29,6 +29,7 @@
#include "ImageWrite.h" #include "ImageWrite.h"
#include "Render.h" #include "Render.h"
#include <math.h> #include <math.h>
#include "FileUtil.h"
namespace TextureConverter namespace TextureConverter
{ {
@ -117,7 +118,7 @@ FRAGMENTSHADER &GetOrCreateEncodingShader(u32 format)
if (g_ActiveConfig.iLog & CONF_SAVESHADERS && shader) { if (g_ActiveConfig.iLog & CONF_SAVESHADERS && shader) {
static int counter = 0; static int counter = 0;
char szTemp[MAX_PATH]; char szTemp[MAX_PATH];
sprintf(szTemp, "%s/enc_%04i.txt", FULL_DUMP_DIR, counter++); sprintf(szTemp, "%senc_%04i.txt", File::GetUserPath(D_DUMP_IDX), counter++);
SaveData(szTemp, shader); SaveData(szTemp, shader);
} }

View File

@ -474,7 +474,7 @@ TextureMngr::TCacheEntry* TextureMngr::Load(int texstage, u32 address, int width
const char* uniqueId = globals->unique_id; const char* uniqueId = globals->unique_id;
bool bCheckedDumpDir = false; bool bCheckedDumpDir = false;
sprintf(szDir,"%s/%s",FULL_DUMP_TEXTURES_DIR,uniqueId); sprintf(szDir,"%s%s",File::GetUserPath(D_DUMPTEXTURES_IDX), uniqueId);
if(!bCheckedDumpDir) if(!bCheckedDumpDir)
{ {
@ -728,7 +728,7 @@ void TextureMngr::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, bool
if (g_ActiveConfig.bDumpEFBTarget) if (g_ActiveConfig.bDumpEFBTarget)
{ {
static int count = 0; static int count = 0;
SaveTexture(StringFromFormat("%s/efb_frame_%i.tga", FULL_DUMP_TEXTURES_DIR, count++).c_str(), GL_TEXTURE_RECTANGLE_ARB, entry.texture, entry.w, entry.h); SaveTexture(StringFromFormat("%sefb_frame_%i.tga", File::GetUserPath(D_DUMPTEXTURES_IDX), count++).c_str(), GL_TEXTURE_RECTANGLE_ARB, entry.texture, entry.w, entry.h);
} }
} }

View File

@ -39,6 +39,7 @@
#include "VertexManager.h" #include "VertexManager.h"
#include "IndexGenerator.h" #include "IndexGenerator.h"
#include "OpcodeDecoding.h" #include "OpcodeDecoding.h"
#include "FileUtil.h"
// internal state for loading vertices // internal state for loading vertices
extern NativeVertexFormat *g_nativeVertexFmt; extern NativeVertexFormat *g_nativeVertexFmt;
@ -278,7 +279,7 @@ void Flush()
{ {
// save the textures // save the textures
char strfile[255]; char strfile[255];
sprintf(strfile, "%sframes/tex%.3d_%d.tga", FULL_DUMP_DIR, g_Config.iSaveTargetId, i); sprintf(strfile, "%stex%.3d_%d.tga", File::GetUserPath(D_DUMPFRAMES_IDX), g_Config.iSaveTargetId, i);
SaveTexture(strfile, tentry->isRectangle?GL_TEXTURE_RECTANGLE_ARB:GL_TEXTURE_2D, tentry->texture, tentry->w, tentry->h); SaveTexture(strfile, tentry->isRectangle?GL_TEXTURE_RECTANGLE_ARB:GL_TEXTURE_2D, tentry->texture, tentry->w, tentry->h);
} }
} }
@ -332,10 +333,10 @@ void Flush()
{ {
// save the shaders // save the shaders
char strfile[255]; char strfile[255];
sprintf(strfile, "%sframes/ps%.3d.txt", FULL_DUMP_DIR, g_ActiveConfig.iSaveTargetId); sprintf(strfile, "%sps%.3d.txt", File::GetUserPath(D_DUMPFRAMES_IDX), g_ActiveConfig.iSaveTargetId);
std::ofstream fps(strfile); std::ofstream fps(strfile);
fps << ps->strprog.c_str(); fps << ps->strprog.c_str();
sprintf(strfile, "%sframes/vs%.3d.txt", FULL_DUMP_DIR, g_ActiveConfig.iSaveTargetId); sprintf(strfile, "%svs%.3d.txt", File::GetUserPath(D_DUMPFRAMES_IDX), g_ActiveConfig.iSaveTargetId);
std::ofstream fvs(strfile); std::ofstream fvs(strfile);
fvs << vs->strprog.c_str(); fvs << vs->strprog.c_str();
} }
@ -343,7 +344,7 @@ void Flush()
if (g_ActiveConfig.iLog & CONF_SAVETARGETS) if (g_ActiveConfig.iLog & CONF_SAVETARGETS)
{ {
char str[128]; char str[128];
sprintf(str, "%sframes/targ%.3d.tga", FULL_DUMP_DIR, g_ActiveConfig.iSaveTargetId); sprintf(str, "%starg%.3d.tga", File::GetUserPath(D_DUMPFRAMES_IDX), g_ActiveConfig.iSaveTargetId);
Renderer::SaveRenderTarget(str, Renderer::GetTargetWidth(), Renderer::GetTargetHeight()); Renderer::SaveRenderTarget(str, Renderer::GetTargetWidth(), Renderer::GetTargetHeight());
} }
#endif #endif

View File

@ -35,6 +35,7 @@
#include "VertexLoader.h" #include "VertexLoader.h"
#include "XFMemory.h" #include "XFMemory.h"
#include "ImageWrite.h" #include "ImageWrite.h"
#include "FileUtil.h"
VertexShaderCache::VSCache VertexShaderCache::vshaders; VertexShaderCache::VSCache VertexShaderCache::vshaders;
bool VertexShaderCache::s_displayCompileAlert; bool VertexShaderCache::s_displayCompileAlert;
@ -169,7 +170,7 @@ VERTEXSHADER* VertexShaderCache::GetShader(u32 components)
if (g_ActiveConfig.iLog & CONF_SAVESHADERS && code) { if (g_ActiveConfig.iLog & CONF_SAVESHADERS && code) {
static int counter = 0; static int counter = 0;
char szTemp[MAX_PATH]; char szTemp[MAX_PATH];
sprintf(szTemp, "%s/vs_%04i.txt", FULL_DUMP_DIR, counter++); sprintf(szTemp, "%svs_%04i.txt", File::GetUserPath(D_DUMP_IDX), counter++);
SaveData(szTemp, code); SaveData(szTemp, code);
} }

View File

@ -291,7 +291,7 @@ void CocaAddResolutions() {
void DllConfig(HWND _hParent) void DllConfig(HWND _hParent)
{ {
g_Config.Load(FULL_CONFIG_DIR "gfx_opengl.ini"); g_Config.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_opengl.ini").c_str());
g_Config.GameIniLoad(globals->game_ini); g_Config.GameIniLoad(globals->game_ini);
g_Config.UpdateProjectionHack(); g_Config.UpdateProjectionHack();
UpdateActiveConfig(); UpdateActiveConfig();
@ -333,7 +333,7 @@ void Initialize(void *init)
g_VideoInitialize = *(_pVideoInitialize); g_VideoInitialize = *(_pVideoInitialize);
InitXFBConvTables(); InitXFBConvTables();
g_Config.Load(FULL_CONFIG_DIR "gfx_opengl.ini"); g_Config.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_opengl.ini").c_str());
g_Config.GameIniLoad(globals->game_ini); g_Config.GameIniLoad(globals->game_ini);
g_Config.UpdateProjectionHack(); g_Config.UpdateProjectionHack();

View File

@ -28,6 +28,7 @@
#include "StringUtil.h" #include "StringUtil.h"
#include "CommandProcessor.h" #include "CommandProcessor.h"
#include "../../../Core/VideoCommon/Src/ImageWrite.h" #include "../../../Core/VideoCommon/Src/ImageWrite.h"
#include "FileUtil.h"
namespace DebugUtil namespace DebugUtil
{ {
@ -92,7 +93,7 @@ void DumpActiveTextures()
{ {
u32 texmap = bpmem.tevindref.getTexMap(stageNum); u32 texmap = bpmem.tevindref.getTexMap(stageNum);
SaveTexture(StringFromFormat("%s/tar%i_ind%i_map%i.tga", FULL_DUMP_TEXTURES_DIR, stats.thisFrame.numDrawnObjects, stageNum, texmap).c_str(), texmap); SaveTexture(StringFromFormat("%star%i_ind%i_map%i.tga", File::GetUserPath(D_DUMPTEXTURES_IDX), stats.thisFrame.numDrawnObjects, stageNum, texmap).c_str(), texmap);
} }
for (unsigned int stageNum = 0; stageNum <= bpmem.genMode.numtevstages; stageNum++) for (unsigned int stageNum = 0; stageNum <= bpmem.genMode.numtevstages; stageNum++)
@ -103,7 +104,7 @@ void DumpActiveTextures()
int texmap = order.getTexMap(stageOdd); int texmap = order.getTexMap(stageOdd);
SaveTexture(StringFromFormat("%s/tar%i_stage%i_map%i.tga", FULL_DUMP_TEXTURES_DIR, stats.thisFrame.numDrawnObjects, stageNum, texmap).c_str(), texmap); SaveTexture(StringFromFormat("%star%i_stage%i_map%i.tga", File::GetUserPath(D_DUMPTEXTURES_IDX), stats.thisFrame.numDrawnObjects, stageNum, texmap).c_str(), texmap);
} }
} }
@ -178,7 +179,7 @@ void OnObjectEnd()
if (!g_bSkipCurrentFrame) if (!g_bSkipCurrentFrame)
{ {
if (g_Config.bDumpObjects && stats.thisFrame.numDrawnObjects >= g_Config.drawStart && stats.thisFrame.numDrawnObjects < g_Config.drawEnd) if (g_Config.bDumpObjects && stats.thisFrame.numDrawnObjects >= g_Config.drawStart && stats.thisFrame.numDrawnObjects < g_Config.drawEnd)
DumpEfb(StringFromFormat("%s/object%i.tga", FULL_FRAMES_DIR, stats.thisFrame.numDrawnObjects).c_str()); DumpEfb(StringFromFormat("%sobject%i.tga", File::GetUserPath(D_DUMPFRAMES_IDX), stats.thisFrame.numDrawnObjects).c_str());
if (g_Config.bHwRasterizer) if (g_Config.bHwRasterizer)
HwRasterizer::EndTriangles(); HwRasterizer::EndTriangles();
@ -188,7 +189,7 @@ void OnObjectEnd()
if (DrawnToBuffer[i]) if (DrawnToBuffer[i])
{ {
DrawnToBuffer[i] = false; DrawnToBuffer[i] = false;
SaveTGA(StringFromFormat("%s/object%i_%s(%i).tga", FULL_FRAMES_DIR, SaveTGA(StringFromFormat("%sobject%i_%s(%i).tga", File::GetUserPath(D_DUMPFRAMES_IDX),
stats.thisFrame.numDrawnObjects, ObjectBufferName[i], i).c_str(), EFB_WIDTH, EFB_HEIGHT, ObjectBuffer[i]); stats.thisFrame.numDrawnObjects, ObjectBufferName[i], i).c_str(), EFB_WIDTH, EFB_HEIGHT, ObjectBuffer[i]);
memset(ObjectBuffer[i], 0, sizeof(ObjectBuffer[i])); memset(ObjectBuffer[i], 0, sizeof(ObjectBuffer[i]));
} }
@ -204,8 +205,8 @@ void OnFrameEnd()
{ {
if (g_Config.bDumpFrames) if (g_Config.bDumpFrames)
{ {
DumpEfb(StringFromFormat("%s/frame%i_color.tga", FULL_FRAMES_DIR, stats.frameCount).c_str()); DumpEfb(StringFromFormat("%sframe%i_color.tga", File::GetUserPath(D_DUMPFRAMES_IDX), stats.frameCount).c_str());
DumpDepth(StringFromFormat("%s/frame%i_depth.tga", FULL_FRAMES_DIR, stats.frameCount).c_str()); DumpDepth(StringFromFormat("%sframe%i_depth.tga", File::GetUserPath(D_DUMPFRAMES_IDX), stats.frameCount).c_str());
} }
} }
} }

View File

@ -44,7 +44,7 @@ void Config::Load()
{ {
std::string temp; std::string temp;
IniFile iniFile; IniFile iniFile;
iniFile.Load(FULL_CONFIG_DIR "gfx_software.ini"); iniFile.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_software.ini").c_str());
iniFile.Get("Hardware", "Fullscreen", &bFullscreen, 0); // Hardware iniFile.Get("Hardware", "Fullscreen", &bFullscreen, 0); // Hardware
iniFile.Get("Hardware", "RenderToMainframe", &renderToMainframe, false); iniFile.Get("Hardware", "RenderToMainframe", &renderToMainframe, false);
@ -55,11 +55,11 @@ void Config::Load()
void Config::Save() void Config::Save()
{ {
IniFile iniFile; IniFile iniFile;
iniFile.Load(FULL_CONFIG_DIR "gfx_software.ini"); iniFile.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_software.ini").c_str());
iniFile.Set("Hardware", "Fullscreen", bFullscreen); iniFile.Set("Hardware", "Fullscreen", bFullscreen);
iniFile.Set("Hardware", "RenderToMainframe", renderToMainframe); iniFile.Set("Hardware", "RenderToMainframe", renderToMainframe);
iniFile.Save(FULL_CONFIG_DIR "gfx_opengl.ini"); iniFile.Save((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_opengl.ini").c_str());
} }

View File

@ -25,6 +25,7 @@
#include "Config.h" #include "Config.h"
#include "EmuDefinitions.h" // for PadMapping #include "EmuDefinitions.h" // for PadMapping
#include "main.h" #include "main.h"
#include "FileUtil.h"
// Configuration file control names // Configuration file control names
// Do not change the order unless you change the related arrays // Do not change the order unless you change the related arrays
@ -259,7 +260,7 @@ void Config::Load()
{ {
std::string temp; std::string temp;
IniFile iniFile; IniFile iniFile;
iniFile.Load(FULL_CONFIG_DIR "Wiimote.ini"); iniFile.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "Wiimote.ini").c_str());
// Real Wiimote // Real Wiimote
iniFile.Get("Real", "UpdateStatus", &bUpdateRealWiimote, true); iniFile.Get("Real", "UpdateStatus", &bUpdateRealWiimote, true);
@ -329,7 +330,7 @@ void Config::Load()
// Load a few screen settings to. If these are added to the DirectX plugin it's probably // Load a few screen settings to. If these are added to the DirectX plugin it's probably
// better to place them in the main Dolphin.ini file // better to place them in the main Dolphin.ini file
iniFile.Load(FULL_CONFIG_DIR "gfx_opengl.ini"); iniFile.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_opengl.ini").c_str());
iniFile.Get("Settings", "KeepAR_4_3", &bKeepAR43, false); iniFile.Get("Settings", "KeepAR_4_3", &bKeepAR43, false);
iniFile.Get("Settings", "KeepAR_16_9", &bKeepAR169, false); iniFile.Get("Settings", "KeepAR_16_9", &bKeepAR169, false);
iniFile.Get("Settings", "Crop", &bCrop, false); iniFile.Get("Settings", "Crop", &bCrop, false);
@ -345,7 +346,7 @@ void Config::LoadIR()
int defaultLeft, defaultTop, defaultWidth, defaultHeight; int defaultLeft, defaultTop, defaultWidth, defaultHeight;
sprintf(TmpSection, "%s", g_ISOId ? Hex2Ascii(g_ISOId).c_str() : "Default"); sprintf(TmpSection, "%s", g_ISOId ? Hex2Ascii(g_ISOId).c_str() : "Default");
iniFile.Load(FULL_CONFIG_DIR "IR Pointer.ini"); iniFile.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "IR Pointer.ini").c_str());
//Load defaults first... //Load defaults first...
iniFile.Get("Default", "IRLeft", &defaultLeft, LEFT); iniFile.Get("Default", "IRLeft", &defaultLeft, LEFT);
iniFile.Get("Default", "IRTop", &defaultTop, TOP); iniFile.Get("Default", "IRTop", &defaultTop, TOP);
@ -362,7 +363,7 @@ void Config::LoadIR()
void Config::Save() void Config::Save()
{ {
IniFile iniFile; IniFile iniFile;
iniFile.Load(FULL_CONFIG_DIR "Wiimote.ini"); iniFile.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "Wiimote.ini").c_str());
iniFile.Set("Real", "UpdateStatus", bUpdateRealWiimote); iniFile.Set("Real", "UpdateStatus", bUpdateRealWiimote);
iniFile.Set("Real", "AccNeutralX", iAccNeutralX); iniFile.Set("Real", "AccNeutralX", iAccNeutralX);
@ -422,17 +423,17 @@ void Config::Save()
iniFile.Set(SectionName, "TriggerType", WiiMoteEmu::WiiMapping[i].TriggerType); iniFile.Set(SectionName, "TriggerType", WiiMoteEmu::WiiMapping[i].TriggerType);
} }
iniFile.Save(FULL_CONFIG_DIR "Wiimote.ini"); iniFile.Save((std::string(File::GetUserPath(D_CONFIG_IDX)) + "Wiimote.ini").c_str());
// Save the IR cursor settings if it's avaliable for the GameId, if not save the default settings // Save the IR cursor settings if it's avaliable for the GameId, if not save the default settings
iniFile.Load(FULL_CONFIG_DIR "IR Pointer.ini"); iniFile.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "IR Pointer.ini").c_str());
char TmpSection[32]; char TmpSection[32];
sprintf(TmpSection, "%s", g_ISOId ? Hex2Ascii(g_ISOId).c_str() : "Default"); sprintf(TmpSection, "%s", g_ISOId ? Hex2Ascii(g_ISOId).c_str() : "Default");
iniFile.Set(TmpSection, "IRLeft", iIRLeft); iniFile.Set(TmpSection, "IRLeft", iIRLeft);
iniFile.Set(TmpSection, "IRTop", iIRTop); iniFile.Set(TmpSection, "IRTop", iIRTop);
iniFile.Set(TmpSection, "IRWidth", iIRWidth); iniFile.Set(TmpSection, "IRWidth", iIRWidth);
iniFile.Set(TmpSection, "IRHeight", iIRHeight); iniFile.Set(TmpSection, "IRHeight", iIRHeight);
iniFile.Save(FULL_CONFIG_DIR "IR Pointer.ini"); iniFile.Save((std::string(File::GetUserPath(D_CONFIG_IDX)) + "IR Pointer.ini").c_str());
//DEBUG_LOG(WIIMOTE, "Save()"); //DEBUG_LOG(WIIMOTE, "Save()");
} }

View File

@ -32,7 +32,7 @@ void WiimoteRecordingConfigDialog::LoadFile()
DEBUG_LOG(WIIMOTE, "LoadFile()"); DEBUG_LOG(WIIMOTE, "LoadFile()");
IniFile file; IniFile file;
file.Load(FULL_CONFIG_DIR "WiimoteMovement.ini"); file.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "WiimoteMovement.ini").c_str());
for (int i = 1; i < (RECORDING_ROWS + 1); i++) for (int i = 1; i < (RECORDING_ROWS + 1); i++)
{ {
@ -75,7 +75,7 @@ void WiimoteRecordingConfigDialog::SaveFile()
DEBUG_LOG(WIIMOTE, "SaveFile"); DEBUG_LOG(WIIMOTE, "SaveFile");
IniFile file; IniFile file;
file.Load(FULL_CONFIG_DIR "WiimoteMovement.ini"); file.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "WiimoteMovement.ini").c_str());
for(int i = 1; i < (RECORDING_ROWS + 1); i++) for(int i = 1; i < (RECORDING_ROWS + 1); i++)
{ {
@ -107,7 +107,7 @@ void WiimoteRecordingConfigDialog::SaveFile()
file.Set(SaveName.c_str(), "PlaybackSpeed", m_RecordPlayBackSpeed[i]->GetSelection()); file.Set(SaveName.c_str(), "PlaybackSpeed", m_RecordPlayBackSpeed[i]->GetSelection());
} }
file.Save(FULL_CONFIG_DIR "WiimoteMovement.ini"); file.Save((std::string(File::GetUserPath(D_CONFIG_IDX)) + "WiimoteMovement.ini").c_str());
DEBUG_LOG(WIIMOTE, "SaveFile()"); DEBUG_LOG(WIIMOTE, "SaveFile()");
} }
@ -369,7 +369,7 @@ void WiimoteRecordingConfigDialog::CreateGUIControlsRecording()
void WiimoteRecordingConfigDialog::ConvertToString() void WiimoteRecordingConfigDialog::ConvertToString()
{ {
IniFile file; IniFile file;
file.Load(FULL_CONFIG_DIR "WiimoteMovement.ini"); file.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "WiimoteMovement.ini").c_str());
std::string TmpStr = "", TmpIR = "", TmpTime = ""; std::string TmpStr = "", TmpIR = "", TmpTime = "";
for (int i = 0; i < (int)m_vRecording.size(); i++) for (int i = 0; i < (int)m_vRecording.size(); i++)
@ -433,7 +433,7 @@ void WiimoteRecordingConfigDialog::ConvertToString()
m_RecordPlayBackSpeed[m_iRecordTo]->SetSelection(3); m_RecordPlayBackSpeed[m_iRecordTo]->SetSelection(3);
} }
file.Save(FULL_CONFIG_DIR "WiimoteMovement.ini"); file.Save((std::string(File::GetUserPath(D_CONFIG_IDX)) + "WiimoteMovement.ini").c_str());
DEBUG_LOG(WIIMOTE, "Save recording to WiimoteMovement.ini"); DEBUG_LOG(WIIMOTE, "Save recording to WiimoteMovement.ini");
} }

View File

@ -93,7 +93,7 @@ void LoadRecordedMovements()
INFO_LOG(WIIMOTE, "LoadRecordedMovements()"); INFO_LOG(WIIMOTE, "LoadRecordedMovements()");
IniFile file; IniFile file;
file.Load(FULL_CONFIG_DIR "WiimoteMovement.ini"); file.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "WiimoteMovement.ini").c_str());
for(int i = 0; i < RECORDING_ROWS; i++) for(int i = 0; i < RECORDING_ROWS; i++)
{ {