Update to v093 release.

byuu says:

Changelog:
- added Cocoa target: higan can now be compiled for OS X Lion
  [Cydrak, byuu]
- SNES/accuracy profile hires color blending improvements - fixes
  Marvelous text [AWJ]
- fixed a slight bug in SNES/SA-1 VBR support caused by a typo
- added support for multi-pass shaders that can load external textures
  (requires OpenGL 3.2+)
- added game library path (used by ananke->Import Game) to
  Settings->Advanced
- system profiles, shaders and cheats database can be stored in "all
  users" shared folders now (eg /usr/share on Linux)
- all configuration files are in BML format now, instead of XML (much
  easier to read and edit this way)
- main window supports drag-and-drop of game folders (but not game files
  / ZIP archives)
- audio buffer clears when entering a modal loop on Windows (prevents
  audio repetition with DirectSound driver)
- a substantial amount of code clean-up (probably the biggest
  refactoring to date)

One highly desired target for this release was to default to the optimal
drivers instead of the safest drivers, but because AMD drivers don't
seem to like my OpenGL 3.2 driver, I've decided to postpone that. AMD
has too big a market share. Hopefully with v093 officially released, we
can get some public input on what AMD doesn't like.
This commit is contained in:
Tim Allen
2013-08-18 13:21:14 +10:00
parent c74865e171
commit 4e2eb23835
1928 changed files with 4834 additions and 84223 deletions

View File

@@ -0,0 +1,98 @@
#ifdef NALL_STRING_INTERNAL_HPP
/*
copy on write (COW) allocator
sizeof(string) == 24 (amd64)
utilizes a shared_ptr to reference count strings
allows string copies to execute as fast as string moves
requires extra computations, which will be slower for all string sizes
pros:
* lower memory usage
* pass-by-value does not require heap allocation; obviates pass-by-const-reference
cons:
* added overhead to fetch data()
* added heap allocation for reference-count pool
* no potential for in-place resize (always copies)
* larger sizeof(string)
*/
namespace nall {
char* string::data() {
if(!_data.unique()) _copy();
return _data.get();
}
const char* string::data() const {
if(!_data) return "";
return _data.get();
}
//copy _data (to make unique or to grow in size)
void string::_copy() {
auto copy = new char[_capacity + 1];
if(_data.get()) memcpy(copy, _data.get(), min(_capacity, _size));
copy[_size] = 0;
copy[_capacity] = 0;
_data.reset(copy);
}
//amortize growth to O(log n)
//allocate one extra byte to always store null-terminator for libc usage
void string::reserve(unsigned capacity) {
if(capacity > _capacity) {
_capacity = bit::round(capacity + 1) - 1;
_copy();
}
}
void string::resize(unsigned size) {
reserve(size);
data()[_size = size] = 0;
}
void string::reset() {
_data.reset();
_capacity = 0;
_size = 0;
}
string& string::operator=(const string& source) {
if(&source == this) return *this;
_data = source._data;
_capacity = source._capacity;
_size = source._size;
return *this;
}
string& string::operator=(string&& source) {
if(&source == this) return *this;
_data = std::move(source._data);
_capacity = source._capacity;
_size = source._size;
source._capacity = 0;
source._size = 0;
return *this;
}
template<typename T, typename... Args> string::string(T&& source, Args&&... args) {
_capacity = 0;
_size = 0;
sprint(*this, std::forward<T>(source), std::forward<Args>(args)...);
}
string::string() {
_capacity = 0;
_size = 0;
}
string::~string() {
}
}
#endif

View File

@@ -0,0 +1,107 @@
#ifdef NALL_STRING_INTERNAL_HPP
/*
small string optimization (SSO) allocator
sizeof(string) == 16 (amd64)
utilizes a union to store small strings directly into text pointer
bypasses the need to allocate heap memory for small strings
requires extra computations, which can be slower for large strings
pros:
* potential for in-place resize
* no heap allocation when (capacity < 8)
cons:
* added overhead to fetch data()
* 32-bit platforms limited to (capacity < 4)
* pass-by-value requires heap allocation
*/
namespace nall {
char* string::data() {
if(_capacity < SSO) return _text;
return _data;
}
const char* string::data() const {
if(_capacity < SSO) return _text;
return _data;
}
void string::reserve(unsigned capacity) {
if(capacity > _capacity) {
if(capacity >= SSO) {
capacity = bit::round(capacity + 1) - 1;
if(_capacity < SSO) {
char temp[SSO];
memcpy(temp, _text, SSO);
_data = (char*)malloc(capacity + 1);
memcpy(_data, temp, SSO);
} else {
_data = (char*)realloc(_data, capacity + 1);
}
}
_capacity = capacity;
data()[_capacity] = 0;
}
}
void string::resize(unsigned size) {
reserve(size);
data()[_size = size] = 0;
}
void string::reset() {
if(_capacity >= SSO) free(_data);
_data = nullptr;
_capacity = SSO - 1;
_size = 0;
}
string& string::operator=(const string& source) {
if(&source == this) return *this;
if(source._capacity >= SSO) {
_data = (char*)malloc(source._capacity + 1);
_capacity = source._capacity;
_size = source._size;
memcpy(_data, source.data(), source.size() + 1);
} else {
memcpy(_text, source._text, SSO);
_capacity = SSO - 1;
_size = strlen(_text);
}
return *this;
}
string& string::operator=(string&& source) {
if(&source == this) return *this;
memcpy(this, &source, sizeof(string));
source._data = nullptr;
source._capacity = SSO - 1;
source._size = 0;
return *this;
}
template<typename T, typename... Args> string::string(T&& source, Args&&... args) {
_data = nullptr;
_capacity = SSO - 1;
_size = 0;
sprint(*this, std::forward<T>(source), std::forward<Args>(args)...);
}
string::string() {
_data = nullptr;
_capacity = SSO - 1;
_size = 0;
}
string::~string() {
if(_capacity >= SSO) free(_data);
}
}
#endif

View File

@@ -0,0 +1,90 @@
#ifdef NALL_STRING_INTERNAL_HPP
/*
vector allocator
sizeof(string) == 16 (amd64)
utilizes a raw string pointer
always allocates memory onto the heap when string is not empty
pros:
* potential for in-place resize
* simplicity
cons:
* always allocates heap memory on (capacity > 0)
* pass-by-value requires heap allocation
*/
namespace nall {
char* string::data() {
if(_capacity == 0) reserve(1);
return _data;
}
const char* string::data() const {
if(_capacity == 0) return "";
return _data;
}
void string::reserve(unsigned capacity) {
if(capacity > _capacity) {
_capacity = bit::round(capacity + 1) - 1;
_data = (char*)realloc(_data, _capacity + 1);
_data[_capacity] = 0;
}
}
void string::resize(unsigned size) {
reserve(size);
data()[_size = size] = 0;
}
void string::reset() {
if(_data) { free(_data); _data = nullptr; }
_capacity = 0;
_size = 0;
}
string& string::operator=(const string& source) {
if(&source == this) return *this;
_data = (char*)malloc(source._size + 1);
_capacity = source._size;
_size = source._size;
memcpy(_data, source.data(), source.size() + 1);
return *this;
}
string& string::operator=(string&& source) {
if(&source == this) return *this;
_data = source._data;
_capacity = source._capacity;
_size = source._size;
source._data = nullptr;
source._capacity = 0;
source._size = 0;
return *this;
}
template<typename T, typename... Args> string::string(T&& source, Args&&... args) {
_data = nullptr;
_capacity = 0;
_size = 0;
sprint(*this, std::forward<T>(source), std::forward<Args>(args)...);
}
string::string() {
_data = nullptr;
_capacity = 0;
_size = 0;
}
string::~string() {
if(_data) free(_data);
}
}
#endif