2011-10-02 10:05:45 +00:00
|
|
|
#ifdef NALL_STRING_INTERNAL_HPP
|
2010-10-14 10:07:38 +00:00
|
|
|
|
|
|
|
namespace nall {
|
|
|
|
|
Update to v094r09 release.
byuu says:
This will easily be the biggest diff in the history of higan. And not in
a good way.
* target-higan and target-loki have been blown away completely
* nall and ruby massively updated
* phoenix replaced with hiro (pretty near a total rewrite)
* target-higan restarted using hiro (just a window for now)
* all emulation cores updated to compile again
* installation changed to not require root privileges (installs locally)
For the foreseeable future (maybe even permanently?), the new higan UI
will only build under Linux/BSD with GTK+ 2.20+. Probably the most
likely route for Windows/OS X will be to try and figure out how to build
hiro/GTK on those platforms, as awful as that would be. The other
alternative would be to produce new UIs for those platforms ... which
would actually be a good opportunity to make something much more user
friendly.
Being that I just started on this a few hours ago, that means that for
at least a few weeks, don't expect to be able to actually play any
games. Right now, you can pretty much just compile the binary and that's
it. It's quite possible that some nall changes didn't produce
compilation errors, but will produce runtime errors. So until the UI can
actually load games, we won't know if anything is broken. But we should
mostly be okay. It was mostly just trim<1> -> trim changes, moving to
Hash::SHA256 (much cleaner), and patching some reckless memory copy
functions enough to compile.
Progress isn't going to be like it was before: I'm now dividing my time
much thinner between studying and other hobbies.
My aim this time is not to produce a binary for everyone to play games
on. Rather, it's to keep the emulator alive. I want to be able to apply
critical patches again. And I would also like the base of the emulator
to live on, for use in other emulator frontends that utilize higan.
2015-02-26 10:10:46 +00:00
|
|
|
auto activepath() -> string {
|
2012-06-18 10:13:51 +00:00
|
|
|
char path[PATH_MAX] = "";
|
2012-11-02 10:37:38 +00:00
|
|
|
auto unused = getcwd(path, PATH_MAX);
|
Update to v093r02 release.
byuu says:
Changelog:
- nall: fixed major memory leak in string class
- ruby: video shaders support #define-based settings now
- phoenix/GTK+: support > 256x256 icons for window / task bar / alt-tab
- sfc: remove random/ and config/, merge into system/
- ethos: delete higan.png (48x48), replace with higan512.png (512x512)
as new higan.png
- ethos: default gamma to 100% (no color adjustment)
- ethos: use "Video Shaders/Display Emulation/" instead of "Video
Shaders/Emulation/"
- use g++ instead of g++-4.7 (g++ -v must be >= 4.7)
- use -std=c++11 instead of -std=gnu++11
- applied a few patches from Debian upstream to make their packaging job
easier
So because colors are normalized in GLSL, I won't be able to offer video
shaders absolute color literals. We will have to perform basic color
conversion inside the core.
As such, the current plan is to create some sort of Emulator::Settings
interface. With that, I'll connect an option for color correction, which
will be on by default. For FC/SFC, that will mean gamma correction
(darker / stronger colors), and for GB/GBC/GBA, it will mean simulating
the weird brightness levels of the displays. I am undecided on whether
to use pea soup green for the GB or not. By not doing so, it'll be
easier for the display emulation shader to do it.
2013-11-09 11:45:54 +00:00
|
|
|
string result = path;
|
2012-06-18 10:13:51 +00:00
|
|
|
if(result.empty()) result = ".";
|
Update to v093r02 release.
byuu says:
Changelog:
- nall: fixed major memory leak in string class
- ruby: video shaders support #define-based settings now
- phoenix/GTK+: support > 256x256 icons for window / task bar / alt-tab
- sfc: remove random/ and config/, merge into system/
- ethos: delete higan.png (48x48), replace with higan512.png (512x512)
as new higan.png
- ethos: default gamma to 100% (no color adjustment)
- ethos: use "Video Shaders/Display Emulation/" instead of "Video
Shaders/Emulation/"
- use g++ instead of g++-4.7 (g++ -v must be >= 4.7)
- use -std=c++11 instead of -std=gnu++11
- applied a few patches from Debian upstream to make their packaging job
easier
So because colors are normalized in GLSL, I won't be able to offer video
shaders absolute color literals. We will have to perform basic color
conversion inside the core.
As such, the current plan is to create some sort of Emulator::Settings
interface. With that, I'll connect an option for color correction, which
will be on by default. For FC/SFC, that will mean gamma correction
(darker / stronger colors), and for GB/GBC/GBA, it will mean simulating
the weird brightness levels of the displays. I am undecided on whether
to use pea soup green for the GB or not. By not doing so, it'll be
easier for the display emulation shader to do it.
2013-11-09 11:45:54 +00:00
|
|
|
result.transform("\\", "/");
|
2013-12-03 10:01:59 +00:00
|
|
|
if(result.endsWith("/") == false) result.append("/");
|
2012-06-18 10:13:51 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
Update to v094r09 release.
byuu says:
This will easily be the biggest diff in the history of higan. And not in
a good way.
* target-higan and target-loki have been blown away completely
* nall and ruby massively updated
* phoenix replaced with hiro (pretty near a total rewrite)
* target-higan restarted using hiro (just a window for now)
* all emulation cores updated to compile again
* installation changed to not require root privileges (installs locally)
For the foreseeable future (maybe even permanently?), the new higan UI
will only build under Linux/BSD with GTK+ 2.20+. Probably the most
likely route for Windows/OS X will be to try and figure out how to build
hiro/GTK on those platforms, as awful as that would be. The other
alternative would be to produce new UIs for those platforms ... which
would actually be a good opportunity to make something much more user
friendly.
Being that I just started on this a few hours ago, that means that for
at least a few weeks, don't expect to be able to actually play any
games. Right now, you can pretty much just compile the binary and that's
it. It's quite possible that some nall changes didn't produce
compilation errors, but will produce runtime errors. So until the UI can
actually load games, we won't know if anything is broken. But we should
mostly be okay. It was mostly just trim<1> -> trim changes, moving to
Hash::SHA256 (much cleaner), and patching some reckless memory copy
functions enough to compile.
Progress isn't going to be like it was before: I'm now dividing my time
much thinner between studying and other hobbies.
My aim this time is not to produce a binary for everyone to play games
on. Rather, it's to keep the emulator alive. I want to be able to apply
critical patches again. And I would also like the base of the emulator
to live on, for use in other emulator frontends that utilize higan.
2015-02-26 10:10:46 +00:00
|
|
|
auto realpath(rstring name) -> string {
|
2012-06-18 10:13:51 +00:00
|
|
|
string result;
|
|
|
|
char path[PATH_MAX] = "";
|
2015-04-13 11:16:33 +00:00
|
|
|
if(::realpath(name, path)) result = string{path}.transform("\\", "/").pathname();
|
|
|
|
if(result.empty()) return activepath();
|
Update to v093r02 release.
byuu says:
Changelog:
- nall: fixed major memory leak in string class
- ruby: video shaders support #define-based settings now
- phoenix/GTK+: support > 256x256 icons for window / task bar / alt-tab
- sfc: remove random/ and config/, merge into system/
- ethos: delete higan.png (48x48), replace with higan512.png (512x512)
as new higan.png
- ethos: default gamma to 100% (no color adjustment)
- ethos: use "Video Shaders/Display Emulation/" instead of "Video
Shaders/Emulation/"
- use g++ instead of g++-4.7 (g++ -v must be >= 4.7)
- use -std=c++11 instead of -std=gnu++11
- applied a few patches from Debian upstream to make their packaging job
easier
So because colors are normalized in GLSL, I won't be able to offer video
shaders absolute color literals. We will have to perform basic color
conversion inside the core.
As such, the current plan is to create some sort of Emulator::Settings
interface. With that, I'll connect an option for color correction, which
will be on by default. For FC/SFC, that will mean gamma correction
(darker / stronger colors), and for GB/GBC/GBA, it will mean simulating
the weird brightness levels of the displays. I am undecided on whether
to use pea soup green for the GB or not. By not doing so, it'll be
easier for the display emulation shader to do it.
2013-11-09 11:45:54 +00:00
|
|
|
result.transform("\\", "/");
|
2013-12-03 10:01:59 +00:00
|
|
|
if(result.endsWith("/") == false) result.append("/");
|
2012-06-18 10:13:51 +00:00
|
|
|
return result;
|
2010-10-14 10:07:38 +00:00
|
|
|
}
|
|
|
|
|
Update to v094r09 release.
byuu says:
This will easily be the biggest diff in the history of higan. And not in
a good way.
* target-higan and target-loki have been blown away completely
* nall and ruby massively updated
* phoenix replaced with hiro (pretty near a total rewrite)
* target-higan restarted using hiro (just a window for now)
* all emulation cores updated to compile again
* installation changed to not require root privileges (installs locally)
For the foreseeable future (maybe even permanently?), the new higan UI
will only build under Linux/BSD with GTK+ 2.20+. Probably the most
likely route for Windows/OS X will be to try and figure out how to build
hiro/GTK on those platforms, as awful as that would be. The other
alternative would be to produce new UIs for those platforms ... which
would actually be a good opportunity to make something much more user
friendly.
Being that I just started on this a few hours ago, that means that for
at least a few weeks, don't expect to be able to actually play any
games. Right now, you can pretty much just compile the binary and that's
it. It's quite possible that some nall changes didn't produce
compilation errors, but will produce runtime errors. So until the UI can
actually load games, we won't know if anything is broken. But we should
mostly be okay. It was mostly just trim<1> -> trim changes, moving to
Hash::SHA256 (much cleaner), and patching some reckless memory copy
functions enough to compile.
Progress isn't going to be like it was before: I'm now dividing my time
much thinner between studying and other hobbies.
My aim this time is not to produce a binary for everyone to play games
on. Rather, it's to keep the emulator alive. I want to be able to apply
critical patches again. And I would also like the base of the emulator
to live on, for use in other emulator frontends that utilize higan.
2015-02-26 10:10:46 +00:00
|
|
|
auto programpath() -> string {
|
2014-01-28 10:04:58 +00:00
|
|
|
#if defined(PLATFORM_WINDOWS)
|
|
|
|
int argc = 0;
|
|
|
|
wchar_t** argv = CommandLineToArgvW(GetCommandLine(), &argc);
|
|
|
|
string argv0 = (const char*)utf8_t(argv[0]);
|
|
|
|
LocalFree(argv);
|
|
|
|
return realpath(argv0);
|
|
|
|
#else
|
|
|
|
Dl_info info;
|
|
|
|
dladdr((void*)&programpath, &info);
|
|
|
|
return realpath(info.dli_fname);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2013-01-21 12:27:15 +00:00
|
|
|
// /home/username/
|
|
|
|
// c:/users/username/
|
Update to v094r09 release.
byuu says:
This will easily be the biggest diff in the history of higan. And not in
a good way.
* target-higan and target-loki have been blown away completely
* nall and ruby massively updated
* phoenix replaced with hiro (pretty near a total rewrite)
* target-higan restarted using hiro (just a window for now)
* all emulation cores updated to compile again
* installation changed to not require root privileges (installs locally)
For the foreseeable future (maybe even permanently?), the new higan UI
will only build under Linux/BSD with GTK+ 2.20+. Probably the most
likely route for Windows/OS X will be to try and figure out how to build
hiro/GTK on those platforms, as awful as that would be. The other
alternative would be to produce new UIs for those platforms ... which
would actually be a good opportunity to make something much more user
friendly.
Being that I just started on this a few hours ago, that means that for
at least a few weeks, don't expect to be able to actually play any
games. Right now, you can pretty much just compile the binary and that's
it. It's quite possible that some nall changes didn't produce
compilation errors, but will produce runtime errors. So until the UI can
actually load games, we won't know if anything is broken. But we should
mostly be okay. It was mostly just trim<1> -> trim changes, moving to
Hash::SHA256 (much cleaner), and patching some reckless memory copy
functions enough to compile.
Progress isn't going to be like it was before: I'm now dividing my time
much thinner between studying and other hobbies.
My aim this time is not to produce a binary for everyone to play games
on. Rather, it's to keep the emulator alive. I want to be able to apply
critical patches again. And I would also like the base of the emulator
to live on, for use in other emulator frontends that utilize higan.
2015-02-26 10:10:46 +00:00
|
|
|
auto userpath() -> string {
|
2013-04-09 13:31:46 +00:00
|
|
|
#if defined(PLATFORM_WINDOWS)
|
2012-06-18 10:13:51 +00:00
|
|
|
wchar_t path[PATH_MAX] = L"";
|
2013-03-15 13:11:33 +00:00
|
|
|
SHGetFolderPathW(nullptr, CSIDL_PROFILE | CSIDL_FLAG_CREATE, nullptr, 0, path);
|
2013-12-10 12:12:54 +00:00
|
|
|
string result = (const char*)utf8_t(path);
|
2012-06-18 10:13:51 +00:00
|
|
|
result.transform("\\", "/");
|
|
|
|
#else
|
2013-12-10 12:12:54 +00:00
|
|
|
struct passwd* userinfo = getpwuid(getuid());
|
|
|
|
string result = userinfo->pw_dir;
|
2012-06-18 10:13:51 +00:00
|
|
|
#endif
|
|
|
|
if(result.empty()) result = ".";
|
2013-12-03 10:01:59 +00:00
|
|
|
if(result.endsWith("/") == false) result.append("/");
|
2012-06-18 10:13:51 +00:00
|
|
|
return result;
|
2010-10-14 10:07:38 +00:00
|
|
|
}
|
|
|
|
|
2013-01-21 12:27:15 +00:00
|
|
|
// /home/username/.config/
|
|
|
|
// c:/users/username/appdata/roaming/
|
Update to v094r09 release.
byuu says:
This will easily be the biggest diff in the history of higan. And not in
a good way.
* target-higan and target-loki have been blown away completely
* nall and ruby massively updated
* phoenix replaced with hiro (pretty near a total rewrite)
* target-higan restarted using hiro (just a window for now)
* all emulation cores updated to compile again
* installation changed to not require root privileges (installs locally)
For the foreseeable future (maybe even permanently?), the new higan UI
will only build under Linux/BSD with GTK+ 2.20+. Probably the most
likely route for Windows/OS X will be to try and figure out how to build
hiro/GTK on those platforms, as awful as that would be. The other
alternative would be to produce new UIs for those platforms ... which
would actually be a good opportunity to make something much more user
friendly.
Being that I just started on this a few hours ago, that means that for
at least a few weeks, don't expect to be able to actually play any
games. Right now, you can pretty much just compile the binary and that's
it. It's quite possible that some nall changes didn't produce
compilation errors, but will produce runtime errors. So until the UI can
actually load games, we won't know if anything is broken. But we should
mostly be okay. It was mostly just trim<1> -> trim changes, moving to
Hash::SHA256 (much cleaner), and patching some reckless memory copy
functions enough to compile.
Progress isn't going to be like it was before: I'm now dividing my time
much thinner between studying and other hobbies.
My aim this time is not to produce a binary for everyone to play games
on. Rather, it's to keep the emulator alive. I want to be able to apply
critical patches again. And I would also like the base of the emulator
to live on, for use in other emulator frontends that utilize higan.
2015-02-26 10:10:46 +00:00
|
|
|
auto configpath() -> string {
|
2013-04-09 13:31:46 +00:00
|
|
|
#if defined(PLATFORM_WINDOWS)
|
2013-01-21 12:27:15 +00:00
|
|
|
wchar_t path[PATH_MAX] = L"";
|
2013-03-15 13:11:33 +00:00
|
|
|
SHGetFolderPathW(nullptr, CSIDL_APPDATA | CSIDL_FLAG_CREATE, nullptr, 0, path);
|
2013-12-10 12:12:54 +00:00
|
|
|
string result = (const char*)utf8_t(path);
|
2013-01-21 12:27:15 +00:00
|
|
|
result.transform("\\", "/");
|
2013-11-28 10:29:01 +00:00
|
|
|
#elif defined(PLATFORM_MACOSX)
|
2013-12-10 12:12:54 +00:00
|
|
|
string result = {userpath(), "Library/Application Support/"};
|
2012-06-18 10:13:51 +00:00
|
|
|
#else
|
2013-12-10 12:12:54 +00:00
|
|
|
string result = {userpath(), ".config/"};
|
2012-06-18 10:13:51 +00:00
|
|
|
#endif
|
2013-01-21 12:27:15 +00:00
|
|
|
if(result.empty()) result = ".";
|
2013-12-03 10:01:59 +00:00
|
|
|
if(result.endsWith("/") == false) result.append("/");
|
2015-04-21 11:51:57 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
// /home/username/.local/
|
|
|
|
// c:/users/username/appdata/local/
|
|
|
|
auto localpath() -> string {
|
|
|
|
#if defined(PLATFORM_WINDOWS)
|
2015-05-16 07:37:13 +00:00
|
|
|
wchar_t path[PATH_MAX] = L"";
|
2015-04-21 11:51:57 +00:00
|
|
|
SHGetFolderPathW(nullptr, CSIDL_LOCAL_APPDATA | CSIDL_FLAG_CREATE, nullptr, 0, path);
|
|
|
|
string result = (const char*)utf8_t(path);
|
|
|
|
result.transform("\\", "/");
|
|
|
|
#elif defined(PLATFORM_MACOSX)
|
|
|
|
string result = {userpath(), "Library/Application Support/"};
|
|
|
|
#else
|
|
|
|
string result = {userpath(), ".local/"};
|
|
|
|
#endif
|
|
|
|
if(result.empty()) result = ".";
|
|
|
|
if(result.endsWith("/") == false) result.append("/");
|
2013-01-21 12:27:15 +00:00
|
|
|
return result;
|
2010-10-14 10:07:38 +00:00
|
|
|
}
|
|
|
|
|
2013-12-10 12:12:54 +00:00
|
|
|
// /usr/share
|
|
|
|
// /Library/Application Support/
|
|
|
|
// c:/ProgramData/
|
Update to v094r09 release.
byuu says:
This will easily be the biggest diff in the history of higan. And not in
a good way.
* target-higan and target-loki have been blown away completely
* nall and ruby massively updated
* phoenix replaced with hiro (pretty near a total rewrite)
* target-higan restarted using hiro (just a window for now)
* all emulation cores updated to compile again
* installation changed to not require root privileges (installs locally)
For the foreseeable future (maybe even permanently?), the new higan UI
will only build under Linux/BSD with GTK+ 2.20+. Probably the most
likely route for Windows/OS X will be to try and figure out how to build
hiro/GTK on those platforms, as awful as that would be. The other
alternative would be to produce new UIs for those platforms ... which
would actually be a good opportunity to make something much more user
friendly.
Being that I just started on this a few hours ago, that means that for
at least a few weeks, don't expect to be able to actually play any
games. Right now, you can pretty much just compile the binary and that's
it. It's quite possible that some nall changes didn't produce
compilation errors, but will produce runtime errors. So until the UI can
actually load games, we won't know if anything is broken. But we should
mostly be okay. It was mostly just trim<1> -> trim changes, moving to
Hash::SHA256 (much cleaner), and patching some reckless memory copy
functions enough to compile.
Progress isn't going to be like it was before: I'm now dividing my time
much thinner between studying and other hobbies.
My aim this time is not to produce a binary for everyone to play games
on. Rather, it's to keep the emulator alive. I want to be able to apply
critical patches again. And I would also like the base of the emulator
to live on, for use in other emulator frontends that utilize higan.
2015-02-26 10:10:46 +00:00
|
|
|
auto sharedpath() -> string {
|
2013-04-09 13:31:46 +00:00
|
|
|
#if defined(PLATFORM_WINDOWS)
|
|
|
|
wchar_t path[PATH_MAX] = L"";
|
|
|
|
SHGetFolderPathW(nullptr, CSIDL_COMMON_APPDATA | CSIDL_FLAG_CREATE, nullptr, 0, path);
|
2013-12-10 12:12:54 +00:00
|
|
|
string result = (const char*)utf8_t(path);
|
2013-04-09 13:31:46 +00:00
|
|
|
result.transform("\\", "/");
|
2013-11-28 10:29:01 +00:00
|
|
|
#elif defined(PLATFORM_MACOSX)
|
2013-12-10 12:12:54 +00:00
|
|
|
string result = "/Library/Application Support/";
|
2013-04-09 13:31:46 +00:00
|
|
|
#else
|
2013-12-10 12:12:54 +00:00
|
|
|
string result = "/usr/share/";
|
2013-04-09 13:31:46 +00:00
|
|
|
#endif
|
|
|
|
if(result.empty()) result = ".";
|
2013-12-03 10:01:59 +00:00
|
|
|
if(result.endsWith("/") == false) result.append("/");
|
2013-04-09 13:31:46 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2013-12-10 12:12:54 +00:00
|
|
|
// /tmp
|
|
|
|
// c:/users/username/AppData/Local/Temp/
|
Update to v094r09 release.
byuu says:
This will easily be the biggest diff in the history of higan. And not in
a good way.
* target-higan and target-loki have been blown away completely
* nall and ruby massively updated
* phoenix replaced with hiro (pretty near a total rewrite)
* target-higan restarted using hiro (just a window for now)
* all emulation cores updated to compile again
* installation changed to not require root privileges (installs locally)
For the foreseeable future (maybe even permanently?), the new higan UI
will only build under Linux/BSD with GTK+ 2.20+. Probably the most
likely route for Windows/OS X will be to try and figure out how to build
hiro/GTK on those platforms, as awful as that would be. The other
alternative would be to produce new UIs for those platforms ... which
would actually be a good opportunity to make something much more user
friendly.
Being that I just started on this a few hours ago, that means that for
at least a few weeks, don't expect to be able to actually play any
games. Right now, you can pretty much just compile the binary and that's
it. It's quite possible that some nall changes didn't produce
compilation errors, but will produce runtime errors. So until the UI can
actually load games, we won't know if anything is broken. But we should
mostly be okay. It was mostly just trim<1> -> trim changes, moving to
Hash::SHA256 (much cleaner), and patching some reckless memory copy
functions enough to compile.
Progress isn't going to be like it was before: I'm now dividing my time
much thinner between studying and other hobbies.
My aim this time is not to produce a binary for everyone to play games
on. Rather, it's to keep the emulator alive. I want to be able to apply
critical patches again. And I would also like the base of the emulator
to live on, for use in other emulator frontends that utilize higan.
2015-02-26 10:10:46 +00:00
|
|
|
auto temppath() -> string {
|
2013-04-09 13:31:46 +00:00
|
|
|
#if defined(PLATFORM_WINDOWS)
|
2012-08-16 10:30:47 +00:00
|
|
|
wchar_t path[PATH_MAX] = L"";
|
|
|
|
GetTempPathW(PATH_MAX, path);
|
2013-01-21 12:27:15 +00:00
|
|
|
string result = (const char*)utf8_t(path);
|
|
|
|
result.transform("\\", "/");
|
2013-12-10 12:12:54 +00:00
|
|
|
#elif defined(P_tmpdir)
|
|
|
|
string result = P_tmpdir;
|
2012-08-16 10:30:47 +00:00
|
|
|
#else
|
2013-12-10 12:12:54 +00:00
|
|
|
string result = "/tmp/";
|
2012-08-16 10:30:47 +00:00
|
|
|
#endif
|
2013-12-10 12:12:54 +00:00
|
|
|
if(result.endsWith("/") == false) result.append("/");
|
|
|
|
return result;
|
2012-08-16 10:30:47 +00:00
|
|
|
}
|
|
|
|
|
2010-10-14 10:07:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|