mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-08-26 14:54:48 +02:00
Update to v097r17 release.
byuu says: Changelog: - ruby: if DirectSoundCreate fails (no sound device present), return false from init instead of crashing - nall: improved edge case return values for (basename,pathname,dirname,...) - nall: renamed file_system_object class to inode - nall: varuint_t replaced with VariadicNatural; which contains .bit,.bits,.byte ala Natural/Integer - nall: fixed boolean compilation error on Windows - WS: popa should not restore SP - GBA: rewrote the CPU/APU cores to use the .bit,.bits functions; removed registers.cpp from each Note that the GBA changes are extremely major. This is about five hours worth of extremely delicate work. Any slight errors could break emulation in extremely bad ways. Let's hold off on extensive testing until the next WIP, after I do the same to the PPU. So far ... endrift's SOUNDCNT_X I/O test is failing, although that code didn't change, so clearly I messed up SOUNDCNT_H somehow ... To compile on Windows: 1. change nall/string/platform.hpp line 47 to return slice(result, 0, 3); 2. change ruby/video.wgl.cpp line 72 to auto lock(uint32_t*& data, uint& pitch, uint width, uint height) -> bool { 3. add this line to the very top of hiro/windows/header.cpp: #define boolean FuckYouMicrosoft
This commit is contained in:
@@ -51,6 +51,7 @@ inline auto suffixname(rstring self) -> string;
|
||||
inline auto activepath() -> string;
|
||||
inline auto realpath(rstring name) -> string;
|
||||
inline auto programpath() -> string;
|
||||
inline auto rootpath() -> string;
|
||||
inline auto userpath() -> string;
|
||||
inline auto configpath() -> string;
|
||||
inline auto localpath() -> string;
|
||||
|
@@ -6,67 +6,67 @@ namespace nall {
|
||||
// (/parent/child.type/)name.type
|
||||
auto pathname(rstring self) -> string {
|
||||
const char* p = self.data() + self.size() - 1;
|
||||
for(signed offset = self.size() - 1; offset >= 0; offset--, p--) {
|
||||
for(int offset = self.size() - 1; offset >= 0; offset--, p--) {
|
||||
if(*p == '/') return slice(self, 0, offset + 1);
|
||||
}
|
||||
return "";
|
||||
return ""; //no path found
|
||||
}
|
||||
|
||||
// /parent/child.type/()
|
||||
// /parent/child.type/(name.type)
|
||||
auto filename(rstring self) -> string {
|
||||
const char* p = self.data() + self.size() - 1;
|
||||
for(signed offset = self.size() - 1; offset >= 0; offset--, p--) {
|
||||
for(int offset = self.size() - 1; offset >= 0; offset--, p--) {
|
||||
if(*p == '/') return slice(self, offset + 1);
|
||||
}
|
||||
return "";
|
||||
return self; //no path found
|
||||
}
|
||||
|
||||
// (/parent/)child.type/
|
||||
// (/parent/child.type/)name.type
|
||||
auto dirname(rstring self) -> string {
|
||||
const char* p = self.data() + self.size() - 1, *last = p;
|
||||
for(signed offset = self.size() - 1; offset >= 0; offset--, p--) {
|
||||
for(int offset = self.size() - 1; offset >= 0; offset--, p--) {
|
||||
if(*p == '/' && p == last) continue;
|
||||
if(*p == '/') return slice(self, 0, offset + 1);
|
||||
}
|
||||
return self.data(); //this is the root directory
|
||||
return rootpath(); //technically, directory is unknown; must return something
|
||||
}
|
||||
|
||||
// /parent/(child.type/)
|
||||
// /parent/child.type/(name.type)
|
||||
auto basename(rstring self) -> string {
|
||||
const char* p = self.data() + self.size() - 1, *last = p;
|
||||
for(signed offset = self.size() - 1; offset >= 0; offset--, p--) {
|
||||
for(int offset = self.size() - 1; offset >= 0; offset--, p--) {
|
||||
if(*p == '/' && p == last) continue;
|
||||
if(*p == '/') return slice(self, offset + 1);
|
||||
}
|
||||
return "";
|
||||
return self; //no path found
|
||||
}
|
||||
|
||||
// /parent/(child).type/
|
||||
// /parent/child.type/(name).type
|
||||
auto prefixname(rstring self) -> string {
|
||||
const char* p = self.data() + self.size() - 1, *last = p;
|
||||
for(signed offset = self.size() - 1, suffix = -1; offset >= 0; offset--, p--) {
|
||||
for(int offset = self.size() - 1, suffix = -1; offset >= 0; offset--, p--) {
|
||||
if(*p == '/' && p == last) continue;
|
||||
if(*p == '/') return slice(self, offset + 1, suffix >= 0 ? suffix - offset - 1 : 0).rtrim("/");
|
||||
if(*p == '.' && suffix == -1) { suffix = offset; continue; }
|
||||
if(offset == 0) return slice(self, offset, suffix).rtrim("/");
|
||||
}
|
||||
return "";
|
||||
return ""; //no prefix found
|
||||
}
|
||||
|
||||
// /parent/child(.type)/
|
||||
// /parent/child.type/name(.type)
|
||||
auto suffixname(rstring self) -> string {
|
||||
const char* p = self.data() + self.size() - 1, *last = p;
|
||||
for(signed offset = self.size() - 1; offset >= 0; offset--, p--) {
|
||||
for(int offset = self.size() - 1; offset >= 0; offset--, p--) {
|
||||
if(*p == '/' && p == last) continue;
|
||||
if(*p == '/') break;
|
||||
if(*p == '.') return slice(self, offset).rtrim("/");
|
||||
}
|
||||
return "";
|
||||
return ""; //no suffix found
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -36,6 +36,20 @@ auto programpath() -> string {
|
||||
#endif
|
||||
}
|
||||
|
||||
// /
|
||||
// c:/
|
||||
auto rootpath() -> string {
|
||||
#if defined(PLATFORM_WINDOWS)
|
||||
wchar_t path[PATH_MAX] = L"";
|
||||
SHGetFolderPathW(nullptr, CSIDL_WINDOWS | CSIDL_FLAG_CREATE, nullptr, 0, path);
|
||||
string result = (const char*)utf8_t(path);
|
||||
result.transform("\\", "/");
|
||||
return result.slice(0, 3);
|
||||
#else
|
||||
return "/";
|
||||
#endif
|
||||
}
|
||||
|
||||
// /home/username/
|
||||
// c:/users/username/
|
||||
auto userpath() -> string {
|
||||
|
Reference in New Issue
Block a user