mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-02-24 15:12:23 +01:00
byuu says: Changelog: - added \~130 new PAL games to icarus (courtesy of Smarthuman and aquaman) - added all three Korean-localized games to icarus - sfc: removed SuperDisc emulation (it was going nowhere) - sfc: fixed MSU1 regression where the play/repeat flags were not being cleared on track select - nall: cryptography support added; will be used to sign future databases (validation will always be optional) - minor shims to fix compilation issues due to nall changes The real magic is that we now have 25-30% of the PAL SNES library in icarus! Signing will be tricky. Obviously if I put the public key inside the higan archive, then all anyone has to do is change that public key for their own releases. And if you download from my site (which is now over HTTPS), then you don't need the signing to verify integrity. I may just put the public key on my site on my site and leave it at that, we'll see.
78 lines
2.2 KiB
C++
78 lines
2.2 KiB
C++
#pragma once
|
|
|
|
//only allocators may access _data or modify _size and _capacity
|
|
//all other functions must use data(), size(), capacity()
|
|
|
|
#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>
|
|
#elif defined(NALL_STRING_ALLOCATOR_VECTOR)
|
|
#include <nall/string/allocator/vector.hpp>
|
|
#endif
|
|
|
|
namespace nall {
|
|
|
|
auto string::operator[](int position) const -> const char& {
|
|
//if(position > size() + 1) throw;
|
|
return data()[position];
|
|
}
|
|
|
|
auto string::operator()(int position, char fallback) const -> char {
|
|
if(position > size() + 1) return fallback;
|
|
return data()[position];
|
|
}
|
|
|
|
template<typename... P> auto string::assign(P&&... p) -> string& {
|
|
resize(0);
|
|
return append(forward<P>(p)...);
|
|
}
|
|
|
|
template<typename T, typename... P> auto string::prepend(const T& value, P&&... p) -> string& {
|
|
prepend(forward<P>(p)...);
|
|
return _prepend(make_string(value));
|
|
}
|
|
|
|
template<typename... P> auto string::prepend(const nall::string_format& value, P&&... p) -> string& {
|
|
prepend(forward<P>(p)...);
|
|
return format(value);
|
|
}
|
|
|
|
auto string::prepend() -> string& {
|
|
return *this;
|
|
}
|
|
|
|
template<typename T> auto string::_prepend(const stringify<T>& source) -> string& {
|
|
resize(source.size() + size());
|
|
memory::move(get() + source.size(), get(), size() - source.size());
|
|
memory::copy(get(), source.data(), source.size());
|
|
}
|
|
|
|
template<typename T, typename... P> auto string::append(const T& value, P&&... p) -> string& {
|
|
_append(make_string(value));
|
|
return append(forward<P>(p)...);
|
|
}
|
|
|
|
template<typename... P> auto string::append(const nall::string_format& value, P&&... p) -> string& {
|
|
format(value);
|
|
return append(forward<P>(p)...);
|
|
}
|
|
|
|
auto string::append() -> string& {
|
|
return *this;
|
|
}
|
|
|
|
template<typename T> auto string::_append(const stringify<T>& source) -> string& {
|
|
resize(size() + source.size());
|
|
memory::copy(get() + size() - source.size(), source.data(), source.size());
|
|
return *this;
|
|
}
|
|
|
|
auto string::length() const -> uint {
|
|
return strlen(data());
|
|
}
|
|
|
|
}
|