mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-08-14 04:44:16 +02: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.
This commit is contained in:
@@ -3,7 +3,9 @@
|
||||
//only allocators may access _data or modify _size and _capacity
|
||||
//all other functions must use data(), size(), capacity()
|
||||
|
||||
#if defined(NALL_STRING_ALLOCATOR_COPY_ON_WRITE)
|
||||
#if defined(NALL_STRING_ALLOCATOR_ADAPTIVE)
|
||||
#include <nall/string/allocator/adaptive.hpp>
|
||||
#elif defined(NALL_STRING_ALLOCATOR_COPY_ON_WRITE)
|
||||
#include <nall/string/allocator/copy-on-write.hpp>
|
||||
#elif defined(NALL_STRING_ALLOCATOR_SMALL_STRING_OPTIMIZATION)
|
||||
#include <nall/string/allocator/small-string-optimization.hpp>
|
||||
@@ -13,75 +15,44 @@
|
||||
|
||||
namespace nall {
|
||||
|
||||
unsigned string::length() const { return strlen(data()); }
|
||||
unsigned string::size() const { return _size; }
|
||||
unsigned string::capacity() const { return _capacity; }
|
||||
bool string::empty() const { return _size == 0; }
|
||||
|
||||
void string::clear(char c) {
|
||||
for(unsigned n = 0; n < size(); n++) data()[n] = c;
|
||||
}
|
||||
|
||||
unsigned string::hash() const {
|
||||
const char* p = data();
|
||||
unsigned result = 5381;
|
||||
while(*p) result = (result << 5) + result + *p++;
|
||||
return result;
|
||||
}
|
||||
|
||||
template<typename... Args> string& string::assign(Args&&... args) {
|
||||
resize(0);
|
||||
sprint(*this, std::forward<Args>(args)...);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename... Args> string& string::append(Args&&... args) {
|
||||
sprint(*this, std::forward<Args>(args)...);
|
||||
return *this;
|
||||
}
|
||||
|
||||
string& string::_append(const char* s) {
|
||||
if(s == nullptr) return *this;
|
||||
unsigned basesize = size(), length = strlen(s);
|
||||
reserve(basesize + length);
|
||||
memcpy(data() + basesize, s, length);
|
||||
resize(basesize + length);
|
||||
return *this;
|
||||
}
|
||||
|
||||
string::operator bool() const {
|
||||
return !empty();
|
||||
}
|
||||
|
||||
string::operator const char*() const {
|
||||
return data();
|
||||
}
|
||||
|
||||
char& string::operator[](signed position) {
|
||||
auto string::operator[](signed position) const -> const char& {
|
||||
if(position > size() + 1) throw exception_out_of_bounds{};
|
||||
return data()[position];
|
||||
}
|
||||
|
||||
const char& string::operator[](signed position) const {
|
||||
if(position > size() + 1) throw exception_out_of_bounds{};
|
||||
return data()[position];
|
||||
template<typename... P> auto assign(string& self, P&&... p) -> string& {
|
||||
self.resize(0);
|
||||
return self.append(std::forward<P>(p)...);
|
||||
}
|
||||
|
||||
bool string::operator==(const char* str) const { return strcmp(data(), str) == 0; }
|
||||
bool string::operator!=(const char* str) const { return strcmp(data(), str) != 0; }
|
||||
bool string::operator< (const char* str) const { return strcmp(data(), str) < 0; }
|
||||
bool string::operator<=(const char* str) const { return strcmp(data(), str) <= 0; }
|
||||
bool string::operator> (const char* str) const { return strcmp(data(), str) > 0; }
|
||||
bool string::operator>=(const char* str) const { return strcmp(data(), str) >= 0; }
|
||||
|
||||
string::string(const string& source) {
|
||||
construct();
|
||||
operator=(source);
|
||||
template<typename T, typename... P> auto append(string& self, const T& value, P&&... p) -> string& {
|
||||
_append(self, make_string(value));
|
||||
return self.append(std::forward<P>(p)...);
|
||||
}
|
||||
|
||||
string::string(string&& source) {
|
||||
construct();
|
||||
operator=(std::move(source));
|
||||
template<typename... P> auto append(string& self, const format& value, P&&... p) -> string& {
|
||||
self.format(value);
|
||||
return self.append(std::forward<P>(p)...);
|
||||
}
|
||||
|
||||
auto append(string& self) -> string& {
|
||||
return self;
|
||||
}
|
||||
|
||||
template<typename T> auto _append(string& self, const stringify<T>& source) -> string& {
|
||||
unsigned size = self.size();
|
||||
unsigned length = source.size();
|
||||
self.resize(size + length);
|
||||
memory::copy(self.pointer() + size, source.data(), length);
|
||||
return self;
|
||||
}
|
||||
|
||||
auto empty(const string& self) -> bool {
|
||||
return self.size() == 0;
|
||||
}
|
||||
|
||||
auto length(const string& self) -> unsigned {
|
||||
return strlen(self.data());
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user