fix some dir issue on osx, if there is a problem on windows or linux, see this : GetSysDirectory in FileUtil.cpp

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3173 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
tmator 2009-05-07 21:19:55 +00:00
parent b0ea0f349b
commit 439523163e
9 changed files with 41 additions and 20 deletions

View File

@ -368,7 +368,10 @@ env['binary_dir'] = env['prefix']
#TODO add bin
env['libs_dir'] = env['prefix'] + 'Libs/'
#TODO where should this go?
env['data_dir'] = env['prefix']
if sys.platform == 'darwin':
env['data_dir'] = env['prefix'] + 'Dolphin.app/Contents/'
else:
env['data_dir'] = env['prefix']
env['RPATH'].append(env['libs_dir'])

View File

@ -36,12 +36,13 @@
#if defined __APPLE__
#define PLUGINS_DIR "Contents/PlugIns"
#define SYSDATA_DIR "Contents/Sys"
#else
#define PLUGINS_DIR "Plugins"
#define SYSDATA_DIR "Sys"
#endif
#define ROOT_DIR "."
#define USERDATA_DIR "User"
#define SYSDATA_DIR "Sys"
// Where data directory is
#ifdef _WIN32
@ -129,12 +130,13 @@
#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
#define FULL_HIRES_TEXTURES_DIR FULL_USERDATA_DIR LOAD_DIR DIR_SEP HIRES_TEXTURES_DIR
#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
@ -168,7 +170,7 @@
#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_JAP_SETTING_FILE FULL_WII_SYS_DIR WII_JAP_SETTING
#define WII_SYSCONF_FILE FULL_WII_USER_DIR WII_SYSCONF_DIR DIR_SEP WII_SYSCONF
#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"

View File

@ -16,6 +16,7 @@
// http://code.google.com/p/dolphin-emu/
#include "Common.h"
#include "FileUtil.h"
#include "../PowerPC/PowerPC.h"
#include "../Core.h"
@ -163,19 +164,19 @@ bool CBoot::SetupWiiMemory(unsigned int _CountryCode)
// data\setting.txt directly after the read the SYSCONF file. The games also
// read it to 0x3800, what is a little strange however is that it only reads
// the first 100 bytes of it.
std::string filename(WII_EUR_SETTING_FILE);
std::string filename(File::GetSysDirectory() + WII_SYS_DIR + DIR_SEP + WII_EUR_SETTING);
switch((DiscIO::IVolume::ECountry)_CountryCode)
{
case DiscIO::IVolume::COUNTRY_JAP:
filename = WII_JAP_SETTING_FILE;
filename = File::GetSysDirectory() + WII_SYS_DIR + DIR_SEP + WII_JAP_SETTING;
break;
case DiscIO::IVolume::COUNTRY_USA:
filename = WII_USA_SETTING_FILE;
filename = File::GetSysDirectory() + WII_SYS_DIR + DIR_SEP + WII_USA_SETTING;
break;
case DiscIO::IVolume::COUNTRY_EUROPE:
filename = WII_EUR_SETTING_FILE;
filename = File::GetSysDirectory() + WII_SYS_DIR + DIR_SEP + WII_EUR_SETTING;
break;
default:

View File

@ -197,7 +197,7 @@ bool SCoreStartupParameter::AutoSetup(EBootBios _BootBios)
bHLEBios = true;
if (!bWii)
{
m_strBios = FULL_GC_SYS_DIR + Region + DIR_SEP GC_IPL;
m_strBios = File::GetSysDirectory() + GC_SYS_DIR + DIR_SEP + Region + DIR_SEP GC_IPL;
if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bHLEBios)
{
if (File::Exists(m_strBios.c_str()))

View File

@ -21,6 +21,7 @@
#include "../Core.h"
#include "../ConfigManager.h"
#include "MemoryUtil.h"
#include "FileUtil.h"
// english
SRAM sram_dump = {{
@ -74,8 +75,8 @@ CEXIIPL::CEXIIPL() :
memcpy(m_pIPL, m_bNTSC ? iplverNTSC : iplverPAL, sizeof(m_bNTSC ? iplverNTSC : iplverPAL));
// Load fonts
LoadFileToIPL(FONT_SJIS_FILE, 0x001aff00);
LoadFileToIPL(FONT_ANSI_FILE, 0x001fcf00);
LoadFileToIPL((File::GetSysDirectory() + GC_SYS_DIR + DIR_SEP + FONT_SJIS).c_str(), 0x001aff00);
LoadFileToIPL((File::GetSysDirectory() + GC_SYS_DIR + DIR_SEP + FONT_ANSI).c_str(), 0x001fcf00);
// Clear RTC
memset(m_RTC, 0, sizeof(m_RTC));

View File

@ -264,7 +264,7 @@ bool AckCommand(u32 _Address)
// Let the game read the setting.txt file
void CopySettingsFile(std::string DeviceName)
{
std::string Source = FULL_WII_SYS_DIR;
std::string Source = File::GetSysDirectory() + WII_SYS_DIR + DIR_SEP;
if(Core::GetStartupParameter().bNTSC)
Source += "setting-usa.txt";
else

View File

@ -162,7 +162,7 @@ void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event)
{
PPCAnalyst::FindFunctions(0x81300000, 0x81800000, &g_symbolDB);
SignatureDB db;
if (db.Load(TOTALDB_FILE))
if (db.Load((File::GetSysDirectory() + TOTALDB).c_str()))
db.Apply(&g_symbolDB);
// HLE::PatchFunctions();
@ -175,7 +175,7 @@ void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event)
g_symbolDB.Clear();
PPCAnalyst::FindFunctions(0x81300000, 0x81800000, &g_symbolDB);
SignatureDB db;
if (db.Load(TOTALDB_FILE))
if (db.Load((File::GetSysDirectory() + TOTALDB).c_str()))
db.Apply(&g_symbolDB);
} else {
g_symbolDB.LoadMap(mapfile.c_str());

View File

@ -178,9 +178,23 @@ bool DolphinApp::OnInit()
chdir(AppSupportDir);
if (!File::Exists("User")) File::CreateDir("User");
if (!File::Exists("User/GC")) File::CreateDir("User/GC");
if (!File::Exists("User/Config")) File::CreateDir("User/Config");
//create all necessary dir in user directory
if (!File::Exists(FULL_GC_USER_DIR)) File::CreateFullPath(FULL_GC_USER_DIR);
if (!File::Exists(FULL_WII_SYSCONF_DIR)) File::CreateFullPath(FULL_WII_SYSCONF_DIR);
if (!File::Exists(FULL_CONFIG_DIR)) File::CreateDir(FULL_CONFIG_DIR);
if (!File::Exists(FULL_CACHE_DIR)) File::CreateDir(FULL_CACHE_DIR);
if (!File::Exists(FULL_DSP_DUMP_DIR)) File::CreateFullPath(FULL_DSP_DUMP_DIR);
if (!File::Exists(FULL_DUMP_TEXTURES_DIR)) File::CreateFullPath(FULL_DUMP_TEXTURES_DIR);
if (!File::Exists(FULL_HIRES_TEXTURES_DIR)) File::CreateFullPath(FULL_HIRES_TEXTURES_DIR);
if (!File::Exists(FULL_MAIL_LOGS_DIR)) File::CreateFullPath(FULL_MAIL_LOGS_DIR);
if (!File::Exists(FULL_SCREENSHOTS_DIR)) File::CreateFullPath(FULL_SCREENSHOTS_DIR);
if (!File::Exists(FULL_STATESAVES_DIR)) File::CreateFullPath(FULL_STATESAVES_DIR);
//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);
//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
// HACK: Get rid of bogus osx param
if (argc > 1 && wxString(argv[argc - 1]).StartsWith(_("-psn_"))) {
delete argv[argc-1];

View File

@ -213,13 +213,13 @@ void Initialize(void *init)
// g_dsp.exception_in_progress_hack = false;
gdsp_reset();
if (!gdsp_load_irom(DSP_IROM_FILE))
if (!gdsp_load_irom((File::GetSysDirectory() + GC_SYS_DIR + DIR_SEP + DSP_IROM).c_str()))
{
bCanWork = false;
PanicAlert("Failed loading DSP ROM from " DSP_IROM_FILE);
}
if (!gdsp_load_coef(DSP_COEF_FILE))
if (!gdsp_load_coef((File::GetSysDirectory() + GC_SYS_DIR + DIR_SEP + DSP_COEF).c_str()))
{
bCanWork = false;
PanicAlert("Failed loading DSP COEF from " DSP_COEF_FILE);