Move preprocessor directives at column 0, cleanup some risky ifdef usage.
This commit is contained in:
parent
1d9c7c6bc4
commit
8b7a7f9b50
|
@ -68,27 +68,26 @@ public:
|
||||||
std::vector<std::string> parts = tokenize_str(filename,"|");
|
std::vector<std::string> parts = tokenize_str(filename,"|");
|
||||||
SetRomName(parts[parts.size()-1].c_str());
|
SetRomName(parts[parts.size()-1].c_str());
|
||||||
LoadModulePath();
|
LoadModulePath();
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
|
|
||||||
ReadPathSettings();
|
ReadPathSettings();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadModulePath()
|
void LoadModulePath()
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
char *p;
|
char *p;
|
||||||
ZeroMemory(pathToModule, sizeof(pathToModule));
|
ZeroMemory(pathToModule, sizeof(pathToModule));
|
||||||
GetModuleFileName(NULL, pathToModule, sizeof(pathToModule));
|
GetModuleFileName(NULL, pathToModule, sizeof(pathToModule));
|
||||||
p = pathToModule + lstrlen(pathToModule);
|
p = pathToModule + lstrlen(pathToModule);
|
||||||
while (p >= pathToModule && *p != '\\') p--;
|
while (p >= pathToModule && *p != '\\') p--;
|
||||||
if (++p >= pathToModule) *p = 0;
|
if (++p >= pathToModule) *p = 0;
|
||||||
#else
|
#else
|
||||||
// strcpy(pathToModule, g_get_home_dir());
|
// strcpy(pathToModule, g_get_home_dir());
|
||||||
const char *homedir = getenv ("HOME");
|
const char *homedir = getenv ("HOME");
|
||||||
strcpy(pathToModule, homedir);
|
strcpy(pathToModule, homedir);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Action
|
enum Action
|
||||||
|
@ -104,12 +103,16 @@ public:
|
||||||
|
|
||||||
void ReadKey(char *pathToRead, const char *key)
|
void ReadKey(char *pathToRead, const char *key)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
GetPrivateProfileString(SECTION, key, key, pathToRead, MAX_PATH, IniName);
|
GetPrivateProfileString(SECTION, key, key, pathToRead, MAX_PATH, IniName);
|
||||||
if(strcmp(pathToRead, key) == 0)
|
if(strcmp(pathToRead, key) == 0) {
|
||||||
#endif
|
|
||||||
//since the variables are all intialized in this file they all use MAX_PATH
|
//since the variables are all intialized in this file they all use MAX_PATH
|
||||||
GetDefaultPath(pathToRead, key, MAX_PATH);
|
GetDefaultPath(pathToRead, key, MAX_PATH);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
//since the variables are all intialized in this file they all use MAX_PATH
|
||||||
|
GetDefaultPath(pathToRead, key, MAX_PATH);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReadPathSettings()
|
void ReadPathSettings()
|
||||||
|
@ -126,11 +129,11 @@ public:
|
||||||
ReadKey(pathToSounds, SOUNDKEY);
|
ReadKey(pathToSounds, SOUNDKEY);
|
||||||
ReadKey(pathToFirmware, FIRMWAREKEY);
|
ReadKey(pathToFirmware, FIRMWAREKEY);
|
||||||
ReadKey(pathToLua, LUAKEY);
|
ReadKey(pathToLua, LUAKEY);
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
GetPrivateProfileString(SECTION, FORMATKEY, "%f_%s_%r", screenshotFormat, MAX_FORMAT, IniName);
|
GetPrivateProfileString(SECTION, FORMATKEY, "%f_%s_%r", screenshotFormat, MAX_FORMAT, IniName);
|
||||||
savelastromvisit = GetPrivateProfileBool(SECTION, LASTVISITKEY, true, IniName);
|
savelastromvisit = GetPrivateProfileBool(SECTION, LASTVISITKEY, true, IniName);
|
||||||
currentimageformat = (ImageFormat)GetPrivateProfileInt(SECTION, DEFAULTFORMATKEY, PNG, IniName);
|
currentimageformat = (ImageFormat)GetPrivateProfileInt(SECTION, DEFAULTFORMATKEY, PNG, IniName);
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
needsSaving = GetPrivateProfileInt(SECTION, NEEDSSAVINGKEY, TRUE, IniName);
|
needsSaving = GetPrivateProfileInt(SECTION, NEEDSSAVINGKEY, TRUE, IniName);
|
||||||
if(needsSaving)
|
if(needsSaving)
|
||||||
|
@ -178,13 +181,13 @@ public:
|
||||||
{
|
{
|
||||||
strncpy(buffer, pathToCopy, MAX_PATH);
|
strncpy(buffer, pathToCopy, MAX_PATH);
|
||||||
int len = strlen(buffer)-1;
|
int len = strlen(buffer)-1;
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
if(buffer[len] != '\\')
|
if(buffer[len] != '\\')
|
||||||
strcat(buffer, "\\");
|
strcat(buffer, "\\");
|
||||||
#else
|
#else
|
||||||
if(buffer[len] != '/')
|
if(buffer[len] != '/')
|
||||||
strcat(buffer, "/");
|
strcat(buffer, "/");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(action == SET)
|
else if(action == SET)
|
||||||
|
@ -308,13 +311,13 @@ public:
|
||||||
|
|
||||||
enum ImageFormat
|
enum ImageFormat
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
PNG = IDC_PNG,
|
PNG = IDC_PNG,
|
||||||
BMP = IDC_BMP
|
BMP = IDC_BMP
|
||||||
#else
|
#else
|
||||||
PNG,
|
PNG,
|
||||||
BMP
|
BMP
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
ImageFormat currentimageformat;
|
ImageFormat currentimageformat;
|
||||||
|
|
Loading…
Reference in New Issue