mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-08-30 08:30:56 +02:00
Update to v106r58 release.
byuu says: The main thing I worked on today was emulating the MBC7 EEPROM. And... I have many things to say about that, but not here, and not now... The missing EEPROM support is why the accelerometer was broken. Although it's not evidently clear that I'm emulating the actual values incorrectly. I'll think about it and get it fixed, though. bsnes went from ~308fps to ~328fps, and I don't even know why. Probably something somewhere in the 140KB of changes to other things made in this WIP.
This commit is contained in:
@@ -5,17 +5,19 @@ namespace nall {
|
||||
string::string() : _data(nullptr), _refs(nullptr), _capacity(0), _size(0) {
|
||||
}
|
||||
|
||||
auto string::get() -> char* {
|
||||
template<typename T>
|
||||
auto string::get() -> T* {
|
||||
static char _null[] = "";
|
||||
if(!_data) return _null;
|
||||
if(!_data) return (T*)_null;
|
||||
if(*_refs > 1) _data = _copy(); //make unique for write operations
|
||||
return _data;
|
||||
return (T*)_data;
|
||||
}
|
||||
|
||||
auto string::data() const -> const char* {
|
||||
template<typename T>
|
||||
auto string::data() const -> const T* {
|
||||
static const char _null[] = "";
|
||||
if(!_data) return _null;
|
||||
return _data;
|
||||
if(!_data) return (const T*)_null;
|
||||
return (const T*)_data;
|
||||
}
|
||||
|
||||
auto string::reset() -> type& {
|
||||
|
@@ -26,14 +26,16 @@ string::string() {
|
||||
_size = 0;
|
||||
}
|
||||
|
||||
auto string::get() -> char* {
|
||||
if(_capacity < SSO) return _text;
|
||||
return _data;
|
||||
template<typename T>
|
||||
auto string::get() -> T* {
|
||||
if(_capacity < SSO) return (T*)_text;
|
||||
return (T*)_data;
|
||||
}
|
||||
|
||||
auto string::data() const -> const char* {
|
||||
if(_capacity < SSO) return _text;
|
||||
return _data;
|
||||
template<typename T>
|
||||
auto string::data() const -> const T* {
|
||||
if(_capacity < SSO) return (const T*)_text;
|
||||
return (const T*)_data;
|
||||
}
|
||||
|
||||
auto string::reset() -> type& {
|
||||
|
@@ -19,14 +19,16 @@ cons:
|
||||
|
||||
namespace nall {
|
||||
|
||||
auto string::get() -> char* {
|
||||
template<typename T>
|
||||
auto string::get() -> T* {
|
||||
if(_capacity == 0) reserve(1);
|
||||
return _data;
|
||||
return (T*)_data;
|
||||
}
|
||||
|
||||
auto string::data() const -> const char* {
|
||||
if(_capacity == 0) return "";
|
||||
return _data;
|
||||
template<typename T>
|
||||
auto string::data() const -> const T* {
|
||||
if(_capacity == 0) return (const T*)"";
|
||||
return (const T*)_data;
|
||||
}
|
||||
|
||||
auto string::reset() -> type& {
|
||||
|
@@ -95,6 +95,10 @@ auto slice(view<string> self, int offset, int length) -> string {
|
||||
return result;
|
||||
}
|
||||
|
||||
auto string::slice(int offset, int length) -> string {
|
||||
return nall::slice(*this, offset, length);
|
||||
}
|
||||
|
||||
template<typename T> auto fromInteger(char* result, T value) -> char* {
|
||||
bool negative = value < 0;
|
||||
if(!negative) value = -value; //negate positive integers to support eg INT_MIN
|
||||
|
Reference in New Issue
Block a user