mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-02-23 22:52:34 +01:00
byuu says: Changelog: - return open bus instead of mirroring addresses on the bus (fixes Mario&Luigi, Minish Cap, etc) [Jonas Quinn] - add boolean flag to load requests for slotted game carts (fixes slot load prompts) - rename BS-X Town cart from psram to ram - icarus: add support for game database Note: I didn't rename "bsx" to "mcc" in the database for icarus before uploading that. But I just fixed it locally, so it'll be in the next WIP. For now, make it create the manifest for you and then rename it yourself. I did fix the PSRAM size to 256kbit.
75 lines
2.2 KiB
C++
75 lines
2.2 KiB
C++
#ifdef NALL_STRING_INTERNAL_HPP
|
|
|
|
namespace nall {
|
|
|
|
// (/parent/child.type/)
|
|
// (/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--) {
|
|
if(*p == '/') return slice(self, 0, offset + 1);
|
|
}
|
|
return "";
|
|
}
|
|
|
|
// /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--) {
|
|
if(*p == '/') return slice(self, offset + 1);
|
|
}
|
|
return "";
|
|
}
|
|
|
|
// (/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--) {
|
|
if(*p == '/' && p == last) continue;
|
|
if(*p == '/') return slice(self, 0, offset + 1);
|
|
}
|
|
return self.data(); //this is the root directory
|
|
}
|
|
|
|
// /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--) {
|
|
if(*p == '/' && p == last) continue;
|
|
if(*p == '/') return slice(self, offset + 1);
|
|
}
|
|
return "";
|
|
}
|
|
|
|
// /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--) {
|
|
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 "";
|
|
}
|
|
|
|
// /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--) {
|
|
if(*p == '/' && p == last) continue;
|
|
if(*p == '/') break;
|
|
if(*p == '.') return slice(self, offset).rtrim("/");
|
|
}
|
|
return "";
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|