Update to v073 release.
byuu says:
This release marks a major step forward, offering full low-level
emulation of all four DSP coprocessors based on the NEC uPD77C25
processor core. Many people were responsible for this milestone: Dr.
Decapitator for the actual decapping and extraction; Lord Nightmare for
the cartridges and some special analysis tools; myself, Jonas Quinn and
Cydrak for the uPD77C25 emulation; and all of the donors who raised the
necessary $1,000 for the necessary hardware and equipment needed to pull
this all off. To say thanks to the donors, I am releasing the uPD77C25
emulation core to the public domain, so that everyone can benefit from
it.
All four DSP emulations will be improved by this by way of having
realistic timing; the DSP-4 will benefit further as the high-level
emulation was incomplete and somewhat buggy; and the DSP-3 will benefit
the most as the high-levle emulation there was not complete enough to be
playable. As a result, most notably, this means bsnes v073 is the first
emulator to fully be able to play SD Gundam GX (J)!
As bsnes' primary goal is accuracy, the LLE DSP support renders the old
HLE DSP support obsolete. Ergo, I have removed the 166KB of HLE source
code, and replaced it with the uPD77C25 core, which comprises a mere
20KB of source code. As this LLE module supports save states, this also
means that for the first time, DSP-3 and DSP-4 games have save state
support.
On the other hand, this also means that to run any DSP game, you will
need the appropriate program ROM. As these are copyrighted, I cannot
distribute them nor tell you where to get them. All I can do is provide
you with the necessary filenames and hashes.
Changelog (since v072 release):
* added NEC uPD77C25 emulation core
* added low-level emulation of the DSP-1, DSP-1B, DSP-2, DSP-3, DSP-4
coprocessors
* removed high-level emulation of the DSP-n coprocessors
* added blargg's libco::ppc.c module, which is far more portable, even
running on the PS3
* added software filter support via binary plugins
* added debugger (currently Linux-only); but it is as yet unstable
* added pause shortcut
* updated mightymo's cheat code database
2010-12-26 12:24:34 +00:00
|
|
|
#ifndef NALL_VECTOR_HPP
|
|
|
|
#define NALL_VECTOR_HPP
|
|
|
|
|
|
|
|
#include <initializer_list>
|
|
|
|
#include <new>
|
|
|
|
#include <type_traits>
|
|
|
|
#include <utility>
|
|
|
|
#include <nall/algorithm.hpp>
|
|
|
|
#include <nall/bit.hpp>
|
|
|
|
#include <nall/concept.hpp>
|
|
|
|
#include <nall/foreach.hpp>
|
|
|
|
#include <nall/utility.hpp>
|
|
|
|
|
|
|
|
namespace nall {
|
|
|
|
//linear_vector
|
|
|
|
//memory: O(capacity * 2)
|
|
|
|
//
|
|
|
|
//linear_vector uses placement new + manual destructor calls to create a
|
|
|
|
//contiguous block of memory for all objects. accessing individual elements
|
|
|
|
//is fast, though resizing the array incurs significant overhead.
|
|
|
|
//reserve() overhead is reduced from quadratic time to amortized constant time
|
|
|
|
//by resizing twice as much as requested.
|
|
|
|
//
|
|
|
|
//if objects hold memory address references to themselves (introspection), a
|
|
|
|
//valid copy constructor will be needed to keep pointers valid.
|
|
|
|
|
|
|
|
template<typename T> class linear_vector {
|
|
|
|
protected:
|
|
|
|
T *pool;
|
|
|
|
unsigned poolsize, objectsize;
|
|
|
|
|
|
|
|
public:
|
|
|
|
unsigned size() const { return objectsize; }
|
|
|
|
unsigned capacity() const { return poolsize; }
|
|
|
|
|
|
|
|
void reset() {
|
|
|
|
if(pool) {
|
|
|
|
for(unsigned i = 0; i < objectsize; i++) pool[i].~T();
|
|
|
|
free(pool);
|
|
|
|
}
|
|
|
|
pool = 0;
|
|
|
|
poolsize = 0;
|
|
|
|
objectsize = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void reserve(unsigned newsize) {
|
|
|
|
newsize = bit::round(newsize); //round to nearest power of two (for amortized growth)
|
|
|
|
|
2011-02-27 09:11:01 +00:00
|
|
|
T *poolcopy = (T*)calloc(newsize, sizeof(T));
|
Update to v073 release.
byuu says:
This release marks a major step forward, offering full low-level
emulation of all four DSP coprocessors based on the NEC uPD77C25
processor core. Many people were responsible for this milestone: Dr.
Decapitator for the actual decapping and extraction; Lord Nightmare for
the cartridges and some special analysis tools; myself, Jonas Quinn and
Cydrak for the uPD77C25 emulation; and all of the donors who raised the
necessary $1,000 for the necessary hardware and equipment needed to pull
this all off. To say thanks to the donors, I am releasing the uPD77C25
emulation core to the public domain, so that everyone can benefit from
it.
All four DSP emulations will be improved by this by way of having
realistic timing; the DSP-4 will benefit further as the high-level
emulation was incomplete and somewhat buggy; and the DSP-3 will benefit
the most as the high-levle emulation there was not complete enough to be
playable. As a result, most notably, this means bsnes v073 is the first
emulator to fully be able to play SD Gundam GX (J)!
As bsnes' primary goal is accuracy, the LLE DSP support renders the old
HLE DSP support obsolete. Ergo, I have removed the 166KB of HLE source
code, and replaced it with the uPD77C25 core, which comprises a mere
20KB of source code. As this LLE module supports save states, this also
means that for the first time, DSP-3 and DSP-4 games have save state
support.
On the other hand, this also means that to run any DSP game, you will
need the appropriate program ROM. As these are copyrighted, I cannot
distribute them nor tell you where to get them. All I can do is provide
you with the necessary filenames and hashes.
Changelog (since v072 release):
* added NEC uPD77C25 emulation core
* added low-level emulation of the DSP-1, DSP-1B, DSP-2, DSP-3, DSP-4
coprocessors
* removed high-level emulation of the DSP-n coprocessors
* added blargg's libco::ppc.c module, which is far more portable, even
running on the PS3
* added software filter support via binary plugins
* added debugger (currently Linux-only); but it is as yet unstable
* added pause shortcut
* updated mightymo's cheat code database
2010-12-26 12:24:34 +00:00
|
|
|
for(unsigned i = 0; i < min(objectsize, newsize); i++) new(poolcopy + i) T(pool[i]);
|
|
|
|
for(unsigned i = 0; i < objectsize; i++) pool[i].~T();
|
|
|
|
free(pool);
|
|
|
|
pool = poolcopy;
|
|
|
|
poolsize = newsize;
|
|
|
|
objectsize = min(objectsize, newsize);
|
|
|
|
}
|
|
|
|
|
|
|
|
void resize(unsigned newsize) {
|
|
|
|
if(newsize > poolsize) reserve(newsize);
|
|
|
|
|
|
|
|
if(newsize < objectsize) {
|
|
|
|
//vector is shrinking; destroy excess objects
|
|
|
|
for(unsigned i = newsize; i < objectsize; i++) pool[i].~T();
|
|
|
|
} else if(newsize > objectsize) {
|
|
|
|
//vector is expanding; allocate new objects
|
|
|
|
for(unsigned i = objectsize; i < newsize; i++) new(pool + i) T;
|
|
|
|
}
|
|
|
|
|
|
|
|
objectsize = newsize;
|
|
|
|
}
|
|
|
|
|
|
|
|
void append(const T data) {
|
|
|
|
if(objectsize + 1 > poolsize) reserve(objectsize + 1);
|
|
|
|
new(pool + objectsize++) T(data);
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename U> void insert(unsigned index, const U list) {
|
|
|
|
linear_vector<T> merged;
|
|
|
|
for(unsigned i = 0; i < index; i++) merged.append(pool[i]);
|
|
|
|
foreach(item, list) merged.append(item);
|
|
|
|
for(unsigned i = index; i < objectsize; i++) merged.append(pool[i]);
|
|
|
|
operator=(merged);
|
|
|
|
}
|
|
|
|
|
|
|
|
void insert(unsigned index, const T item) {
|
|
|
|
insert(index, linear_vector<T>{ item });
|
|
|
|
}
|
|
|
|
|
|
|
|
void remove(unsigned index, unsigned count = 1) {
|
|
|
|
for(unsigned i = index; count + i < objectsize; i++) {
|
|
|
|
pool[i] = pool[count + i];
|
|
|
|
}
|
|
|
|
if(count + index >= objectsize) resize(index); //every element >= index was removed
|
|
|
|
else resize(objectsize - count);
|
|
|
|
}
|
|
|
|
|
2011-08-20 14:40:44 +00:00
|
|
|
linear_vector() : pool(0), poolsize(0), objectsize(0) {
|
Update to v073 release.
byuu says:
This release marks a major step forward, offering full low-level
emulation of all four DSP coprocessors based on the NEC uPD77C25
processor core. Many people were responsible for this milestone: Dr.
Decapitator for the actual decapping and extraction; Lord Nightmare for
the cartridges and some special analysis tools; myself, Jonas Quinn and
Cydrak for the uPD77C25 emulation; and all of the donors who raised the
necessary $1,000 for the necessary hardware and equipment needed to pull
this all off. To say thanks to the donors, I am releasing the uPD77C25
emulation core to the public domain, so that everyone can benefit from
it.
All four DSP emulations will be improved by this by way of having
realistic timing; the DSP-4 will benefit further as the high-level
emulation was incomplete and somewhat buggy; and the DSP-3 will benefit
the most as the high-levle emulation there was not complete enough to be
playable. As a result, most notably, this means bsnes v073 is the first
emulator to fully be able to play SD Gundam GX (J)!
As bsnes' primary goal is accuracy, the LLE DSP support renders the old
HLE DSP support obsolete. Ergo, I have removed the 166KB of HLE source
code, and replaced it with the uPD77C25 core, which comprises a mere
20KB of source code. As this LLE module supports save states, this also
means that for the first time, DSP-3 and DSP-4 games have save state
support.
On the other hand, this also means that to run any DSP game, you will
need the appropriate program ROM. As these are copyrighted, I cannot
distribute them nor tell you where to get them. All I can do is provide
you with the necessary filenames and hashes.
Changelog (since v072 release):
* added NEC uPD77C25 emulation core
* added low-level emulation of the DSP-1, DSP-1B, DSP-2, DSP-3, DSP-4
coprocessors
* removed high-level emulation of the DSP-n coprocessors
* added blargg's libco::ppc.c module, which is far more portable, even
running on the PS3
* added software filter support via binary plugins
* added debugger (currently Linux-only); but it is as yet unstable
* added pause shortcut
* updated mightymo's cheat code database
2010-12-26 12:24:34 +00:00
|
|
|
}
|
|
|
|
|
2011-08-20 14:40:44 +00:00
|
|
|
linear_vector(std::initializer_list<T> list) : pool(0), poolsize(0), objectsize(0) {
|
|
|
|
for(const T *p = list.begin(); p != list.end(); ++p) append(*p);
|
|
|
|
}
|
|
|
|
|
|
|
|
~linear_vector() {
|
|
|
|
reset();
|
Update to v073 release.
byuu says:
This release marks a major step forward, offering full low-level
emulation of all four DSP coprocessors based on the NEC uPD77C25
processor core. Many people were responsible for this milestone: Dr.
Decapitator for the actual decapping and extraction; Lord Nightmare for
the cartridges and some special analysis tools; myself, Jonas Quinn and
Cydrak for the uPD77C25 emulation; and all of the donors who raised the
necessary $1,000 for the necessary hardware and equipment needed to pull
this all off. To say thanks to the donors, I am releasing the uPD77C25
emulation core to the public domain, so that everyone can benefit from
it.
All four DSP emulations will be improved by this by way of having
realistic timing; the DSP-4 will benefit further as the high-level
emulation was incomplete and somewhat buggy; and the DSP-3 will benefit
the most as the high-levle emulation there was not complete enough to be
playable. As a result, most notably, this means bsnes v073 is the first
emulator to fully be able to play SD Gundam GX (J)!
As bsnes' primary goal is accuracy, the LLE DSP support renders the old
HLE DSP support obsolete. Ergo, I have removed the 166KB of HLE source
code, and replaced it with the uPD77C25 core, which comprises a mere
20KB of source code. As this LLE module supports save states, this also
means that for the first time, DSP-3 and DSP-4 games have save state
support.
On the other hand, this also means that to run any DSP game, you will
need the appropriate program ROM. As these are copyrighted, I cannot
distribute them nor tell you where to get them. All I can do is provide
you with the necessary filenames and hashes.
Changelog (since v072 release):
* added NEC uPD77C25 emulation core
* added low-level emulation of the DSP-1, DSP-1B, DSP-2, DSP-3, DSP-4
coprocessors
* removed high-level emulation of the DSP-n coprocessors
* added blargg's libco::ppc.c module, which is far more portable, even
running on the PS3
* added software filter support via binary plugins
* added debugger (currently Linux-only); but it is as yet unstable
* added pause shortcut
* updated mightymo's cheat code database
2010-12-26 12:24:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//copy
|
|
|
|
inline linear_vector<T>& operator=(const linear_vector<T> &source) {
|
|
|
|
reset();
|
|
|
|
reserve(source.capacity());
|
|
|
|
resize(source.size());
|
|
|
|
for(unsigned i = 0; i < source.size(); i++) operator[](i) = source.operator[](i);
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
linear_vector(const linear_vector<T> &source) : pool(0), poolsize(0), objectsize(0) {
|
|
|
|
operator=(source);
|
|
|
|
}
|
|
|
|
|
|
|
|
//move
|
|
|
|
inline linear_vector<T>& operator=(linear_vector<T> &&source) {
|
|
|
|
reset();
|
|
|
|
pool = source.pool;
|
|
|
|
poolsize = source.poolsize;
|
|
|
|
objectsize = source.objectsize;
|
|
|
|
source.pool = 0;
|
|
|
|
source.reset();
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
linear_vector(linear_vector<T> &&source) : pool(0), poolsize(0), objectsize(0) {
|
|
|
|
operator=(std::move(source));
|
|
|
|
}
|
|
|
|
|
2011-08-20 14:40:44 +00:00
|
|
|
//index
|
|
|
|
inline T& operator[](unsigned index) {
|
|
|
|
if(index >= objectsize) resize(index + 1);
|
|
|
|
return pool[index];
|
Update to v073 release.
byuu says:
This release marks a major step forward, offering full low-level
emulation of all four DSP coprocessors based on the NEC uPD77C25
processor core. Many people were responsible for this milestone: Dr.
Decapitator for the actual decapping and extraction; Lord Nightmare for
the cartridges and some special analysis tools; myself, Jonas Quinn and
Cydrak for the uPD77C25 emulation; and all of the donors who raised the
necessary $1,000 for the necessary hardware and equipment needed to pull
this all off. To say thanks to the donors, I am releasing the uPD77C25
emulation core to the public domain, so that everyone can benefit from
it.
All four DSP emulations will be improved by this by way of having
realistic timing; the DSP-4 will benefit further as the high-level
emulation was incomplete and somewhat buggy; and the DSP-3 will benefit
the most as the high-levle emulation there was not complete enough to be
playable. As a result, most notably, this means bsnes v073 is the first
emulator to fully be able to play SD Gundam GX (J)!
As bsnes' primary goal is accuracy, the LLE DSP support renders the old
HLE DSP support obsolete. Ergo, I have removed the 166KB of HLE source
code, and replaced it with the uPD77C25 core, which comprises a mere
20KB of source code. As this LLE module supports save states, this also
means that for the first time, DSP-3 and DSP-4 games have save state
support.
On the other hand, this also means that to run any DSP game, you will
need the appropriate program ROM. As these are copyrighted, I cannot
distribute them nor tell you where to get them. All I can do is provide
you with the necessary filenames and hashes.
Changelog (since v072 release):
* added NEC uPD77C25 emulation core
* added low-level emulation of the DSP-1, DSP-1B, DSP-2, DSP-3, DSP-4
coprocessors
* removed high-level emulation of the DSP-n coprocessors
* added blargg's libco::ppc.c module, which is far more portable, even
running on the PS3
* added software filter support via binary plugins
* added debugger (currently Linux-only); but it is as yet unstable
* added pause shortcut
* updated mightymo's cheat code database
2010-12-26 12:24:34 +00:00
|
|
|
}
|
|
|
|
|
2011-08-20 14:40:44 +00:00
|
|
|
inline const T& operator[](unsigned index) const {
|
|
|
|
if(index >= objectsize) throw "vector[] out of bounds";
|
|
|
|
return pool[index];
|
Update to v073 release.
byuu says:
This release marks a major step forward, offering full low-level
emulation of all four DSP coprocessors based on the NEC uPD77C25
processor core. Many people were responsible for this milestone: Dr.
Decapitator for the actual decapping and extraction; Lord Nightmare for
the cartridges and some special analysis tools; myself, Jonas Quinn and
Cydrak for the uPD77C25 emulation; and all of the donors who raised the
necessary $1,000 for the necessary hardware and equipment needed to pull
this all off. To say thanks to the donors, I am releasing the uPD77C25
emulation core to the public domain, so that everyone can benefit from
it.
All four DSP emulations will be improved by this by way of having
realistic timing; the DSP-4 will benefit further as the high-level
emulation was incomplete and somewhat buggy; and the DSP-3 will benefit
the most as the high-levle emulation there was not complete enough to be
playable. As a result, most notably, this means bsnes v073 is the first
emulator to fully be able to play SD Gundam GX (J)!
As bsnes' primary goal is accuracy, the LLE DSP support renders the old
HLE DSP support obsolete. Ergo, I have removed the 166KB of HLE source
code, and replaced it with the uPD77C25 core, which comprises a mere
20KB of source code. As this LLE module supports save states, this also
means that for the first time, DSP-3 and DSP-4 games have save state
support.
On the other hand, this also means that to run any DSP game, you will
need the appropriate program ROM. As these are copyrighted, I cannot
distribute them nor tell you where to get them. All I can do is provide
you with the necessary filenames and hashes.
Changelog (since v072 release):
* added NEC uPD77C25 emulation core
* added low-level emulation of the DSP-1, DSP-1B, DSP-2, DSP-3, DSP-4
coprocessors
* removed high-level emulation of the DSP-n coprocessors
* added blargg's libco::ppc.c module, which is far more portable, even
running on the PS3
* added software filter support via binary plugins
* added debugger (currently Linux-only); but it is as yet unstable
* added pause shortcut
* updated mightymo's cheat code database
2010-12-26 12:24:34 +00:00
|
|
|
}
|
|
|
|
|
2011-08-20 14:40:44 +00:00
|
|
|
//iteration
|
|
|
|
T* begin() { return &pool[0]; }
|
|
|
|
T* end() { return &pool[objectsize]; }
|
|
|
|
const T* begin() const { return &pool[0]; }
|
|
|
|
const T* end() const { return &pool[objectsize]; }
|
Update to v073 release.
byuu says:
This release marks a major step forward, offering full low-level
emulation of all four DSP coprocessors based on the NEC uPD77C25
processor core. Many people were responsible for this milestone: Dr.
Decapitator for the actual decapping and extraction; Lord Nightmare for
the cartridges and some special analysis tools; myself, Jonas Quinn and
Cydrak for the uPD77C25 emulation; and all of the donors who raised the
necessary $1,000 for the necessary hardware and equipment needed to pull
this all off. To say thanks to the donors, I am releasing the uPD77C25
emulation core to the public domain, so that everyone can benefit from
it.
All four DSP emulations will be improved by this by way of having
realistic timing; the DSP-4 will benefit further as the high-level
emulation was incomplete and somewhat buggy; and the DSP-3 will benefit
the most as the high-levle emulation there was not complete enough to be
playable. As a result, most notably, this means bsnes v073 is the first
emulator to fully be able to play SD Gundam GX (J)!
As bsnes' primary goal is accuracy, the LLE DSP support renders the old
HLE DSP support obsolete. Ergo, I have removed the 166KB of HLE source
code, and replaced it with the uPD77C25 core, which comprises a mere
20KB of source code. As this LLE module supports save states, this also
means that for the first time, DSP-3 and DSP-4 games have save state
support.
On the other hand, this also means that to run any DSP game, you will
need the appropriate program ROM. As these are copyrighted, I cannot
distribute them nor tell you where to get them. All I can do is provide
you with the necessary filenames and hashes.
Changelog (since v072 release):
* added NEC uPD77C25 emulation core
* added low-level emulation of the DSP-1, DSP-1B, DSP-2, DSP-3, DSP-4
coprocessors
* removed high-level emulation of the DSP-n coprocessors
* added blargg's libco::ppc.c module, which is far more portable, even
running on the PS3
* added software filter support via binary plugins
* added debugger (currently Linux-only); but it is as yet unstable
* added pause shortcut
* updated mightymo's cheat code database
2010-12-26 12:24:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//pointer_vector
|
|
|
|
//memory: O(1)
|
|
|
|
//
|
|
|
|
//pointer_vector keeps an array of pointers to each vector object. this adds
|
|
|
|
//significant overhead to individual accesses, but allows for optimal memory
|
|
|
|
//utilization.
|
|
|
|
//
|
|
|
|
//by guaranteeing that the base memory address of each objects never changes,
|
|
|
|
//this avoids the need for an object to have a valid copy constructor.
|
|
|
|
|
|
|
|
template<typename T> class pointer_vector {
|
|
|
|
protected:
|
|
|
|
T **pool;
|
|
|
|
unsigned poolsize, objectsize;
|
|
|
|
|
|
|
|
public:
|
|
|
|
unsigned size() const { return objectsize; }
|
|
|
|
unsigned capacity() const { return poolsize; }
|
|
|
|
|
|
|
|
void reset() {
|
|
|
|
if(pool) {
|
|
|
|
for(unsigned i = 0; i < objectsize; i++) { if(pool[i]) delete pool[i]; }
|
|
|
|
free(pool);
|
|
|
|
}
|
|
|
|
pool = 0;
|
|
|
|
poolsize = 0;
|
|
|
|
objectsize = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void reserve(unsigned newsize) {
|
|
|
|
newsize = bit::round(newsize); //round to nearest power of two (for amortized growth)
|
|
|
|
|
|
|
|
for(unsigned i = newsize; i < objectsize; i++) {
|
|
|
|
if(pool[i]) { delete pool[i]; pool[i] = 0; }
|
|
|
|
}
|
|
|
|
|
|
|
|
pool = (T**)realloc(pool, newsize * sizeof(T*));
|
|
|
|
for(unsigned i = poolsize; i < newsize; i++) pool[i] = 0;
|
|
|
|
poolsize = newsize;
|
|
|
|
objectsize = min(objectsize, newsize);
|
|
|
|
}
|
|
|
|
|
|
|
|
void resize(unsigned newsize) {
|
|
|
|
if(newsize > poolsize) reserve(newsize);
|
|
|
|
|
|
|
|
for(unsigned i = newsize; i < objectsize; i++) {
|
|
|
|
if(pool[i]) { delete pool[i]; pool[i] = 0; }
|
|
|
|
}
|
|
|
|
|
|
|
|
objectsize = newsize;
|
|
|
|
}
|
|
|
|
|
|
|
|
void append(const T data) {
|
|
|
|
if(objectsize + 1 > poolsize) reserve(objectsize + 1);
|
|
|
|
pool[objectsize++] = new T(data);
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename U> void insert(unsigned index, const U list) {
|
|
|
|
pointer_vector<T> merged;
|
|
|
|
for(unsigned i = 0; i < index; i++) merged.append(*pool[i]);
|
|
|
|
foreach(item, list) merged.append(item);
|
|
|
|
for(unsigned i = index; i < objectsize; i++) merged.append(*pool[i]);
|
|
|
|
operator=(merged);
|
|
|
|
}
|
|
|
|
|
|
|
|
void insert(unsigned index, const T item) {
|
|
|
|
insert(index, pointer_vector<T>{ item });
|
|
|
|
}
|
|
|
|
|
|
|
|
void remove(unsigned index, unsigned count = 1) {
|
|
|
|
for(unsigned i = index; count + i < objectsize; i++) {
|
|
|
|
*pool[i] = *pool[count + i];
|
|
|
|
}
|
|
|
|
if(count + index >= objectsize) resize(index); //every element >= index was removed
|
|
|
|
else resize(objectsize - count);
|
|
|
|
}
|
|
|
|
|
2011-08-20 14:40:44 +00:00
|
|
|
pointer_vector() : pool(0), poolsize(0), objectsize(0) {
|
Update to v073 release.
byuu says:
This release marks a major step forward, offering full low-level
emulation of all four DSP coprocessors based on the NEC uPD77C25
processor core. Many people were responsible for this milestone: Dr.
Decapitator for the actual decapping and extraction; Lord Nightmare for
the cartridges and some special analysis tools; myself, Jonas Quinn and
Cydrak for the uPD77C25 emulation; and all of the donors who raised the
necessary $1,000 for the necessary hardware and equipment needed to pull
this all off. To say thanks to the donors, I am releasing the uPD77C25
emulation core to the public domain, so that everyone can benefit from
it.
All four DSP emulations will be improved by this by way of having
realistic timing; the DSP-4 will benefit further as the high-level
emulation was incomplete and somewhat buggy; and the DSP-3 will benefit
the most as the high-levle emulation there was not complete enough to be
playable. As a result, most notably, this means bsnes v073 is the first
emulator to fully be able to play SD Gundam GX (J)!
As bsnes' primary goal is accuracy, the LLE DSP support renders the old
HLE DSP support obsolete. Ergo, I have removed the 166KB of HLE source
code, and replaced it with the uPD77C25 core, which comprises a mere
20KB of source code. As this LLE module supports save states, this also
means that for the first time, DSP-3 and DSP-4 games have save state
support.
On the other hand, this also means that to run any DSP game, you will
need the appropriate program ROM. As these are copyrighted, I cannot
distribute them nor tell you where to get them. All I can do is provide
you with the necessary filenames and hashes.
Changelog (since v072 release):
* added NEC uPD77C25 emulation core
* added low-level emulation of the DSP-1, DSP-1B, DSP-2, DSP-3, DSP-4
coprocessors
* removed high-level emulation of the DSP-n coprocessors
* added blargg's libco::ppc.c module, which is far more portable, even
running on the PS3
* added software filter support via binary plugins
* added debugger (currently Linux-only); but it is as yet unstable
* added pause shortcut
* updated mightymo's cheat code database
2010-12-26 12:24:34 +00:00
|
|
|
}
|
|
|
|
|
2011-08-20 14:40:44 +00:00
|
|
|
pointer_vector(std::initializer_list<T> list) : pool(0), poolsize(0), objectsize(0) {
|
|
|
|
for(const T *p = list.begin(); p != list.end(); ++p) append(*p);
|
|
|
|
}
|
|
|
|
|
|
|
|
~pointer_vector() {
|
|
|
|
reset();
|
Update to v073 release.
byuu says:
This release marks a major step forward, offering full low-level
emulation of all four DSP coprocessors based on the NEC uPD77C25
processor core. Many people were responsible for this milestone: Dr.
Decapitator for the actual decapping and extraction; Lord Nightmare for
the cartridges and some special analysis tools; myself, Jonas Quinn and
Cydrak for the uPD77C25 emulation; and all of the donors who raised the
necessary $1,000 for the necessary hardware and equipment needed to pull
this all off. To say thanks to the donors, I am releasing the uPD77C25
emulation core to the public domain, so that everyone can benefit from
it.
All four DSP emulations will be improved by this by way of having
realistic timing; the DSP-4 will benefit further as the high-level
emulation was incomplete and somewhat buggy; and the DSP-3 will benefit
the most as the high-levle emulation there was not complete enough to be
playable. As a result, most notably, this means bsnes v073 is the first
emulator to fully be able to play SD Gundam GX (J)!
As bsnes' primary goal is accuracy, the LLE DSP support renders the old
HLE DSP support obsolete. Ergo, I have removed the 166KB of HLE source
code, and replaced it with the uPD77C25 core, which comprises a mere
20KB of source code. As this LLE module supports save states, this also
means that for the first time, DSP-3 and DSP-4 games have save state
support.
On the other hand, this also means that to run any DSP game, you will
need the appropriate program ROM. As these are copyrighted, I cannot
distribute them nor tell you where to get them. All I can do is provide
you with the necessary filenames and hashes.
Changelog (since v072 release):
* added NEC uPD77C25 emulation core
* added low-level emulation of the DSP-1, DSP-1B, DSP-2, DSP-3, DSP-4
coprocessors
* removed high-level emulation of the DSP-n coprocessors
* added blargg's libco::ppc.c module, which is far more portable, even
running on the PS3
* added software filter support via binary plugins
* added debugger (currently Linux-only); but it is as yet unstable
* added pause shortcut
* updated mightymo's cheat code database
2010-12-26 12:24:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//copy
|
|
|
|
inline pointer_vector<T>& operator=(const pointer_vector<T> &source) {
|
|
|
|
reset();
|
|
|
|
reserve(source.capacity());
|
|
|
|
resize(source.size());
|
|
|
|
for(unsigned i = 0; i < source.size(); i++) operator[](i) = source.operator[](i);
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
pointer_vector(const pointer_vector<T> &source) : pool(0), poolsize(0), objectsize(0) {
|
|
|
|
operator=(source);
|
|
|
|
}
|
|
|
|
|
|
|
|
//move
|
|
|
|
inline pointer_vector<T>& operator=(pointer_vector<T> &&source) {
|
|
|
|
reset();
|
|
|
|
pool = source.pool;
|
|
|
|
poolsize = source.poolsize;
|
|
|
|
objectsize = source.objectsize;
|
|
|
|
source.pool = 0;
|
|
|
|
source.reset();
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
pointer_vector(pointer_vector<T> &&source) : pool(0), poolsize(0), objectsize(0) {
|
|
|
|
operator=(std::move(source));
|
|
|
|
}
|
|
|
|
|
2011-08-20 14:40:44 +00:00
|
|
|
//index
|
|
|
|
inline T& operator[](unsigned index) {
|
|
|
|
if(index >= objectsize) resize(index + 1);
|
|
|
|
if(!pool[index]) pool[index] = new T;
|
|
|
|
return *pool[index];
|
Update to v073 release.
byuu says:
This release marks a major step forward, offering full low-level
emulation of all four DSP coprocessors based on the NEC uPD77C25
processor core. Many people were responsible for this milestone: Dr.
Decapitator for the actual decapping and extraction; Lord Nightmare for
the cartridges and some special analysis tools; myself, Jonas Quinn and
Cydrak for the uPD77C25 emulation; and all of the donors who raised the
necessary $1,000 for the necessary hardware and equipment needed to pull
this all off. To say thanks to the donors, I am releasing the uPD77C25
emulation core to the public domain, so that everyone can benefit from
it.
All four DSP emulations will be improved by this by way of having
realistic timing; the DSP-4 will benefit further as the high-level
emulation was incomplete and somewhat buggy; and the DSP-3 will benefit
the most as the high-levle emulation there was not complete enough to be
playable. As a result, most notably, this means bsnes v073 is the first
emulator to fully be able to play SD Gundam GX (J)!
As bsnes' primary goal is accuracy, the LLE DSP support renders the old
HLE DSP support obsolete. Ergo, I have removed the 166KB of HLE source
code, and replaced it with the uPD77C25 core, which comprises a mere
20KB of source code. As this LLE module supports save states, this also
means that for the first time, DSP-3 and DSP-4 games have save state
support.
On the other hand, this also means that to run any DSP game, you will
need the appropriate program ROM. As these are copyrighted, I cannot
distribute them nor tell you where to get them. All I can do is provide
you with the necessary filenames and hashes.
Changelog (since v072 release):
* added NEC uPD77C25 emulation core
* added low-level emulation of the DSP-1, DSP-1B, DSP-2, DSP-3, DSP-4
coprocessors
* removed high-level emulation of the DSP-n coprocessors
* added blargg's libco::ppc.c module, which is far more portable, even
running on the PS3
* added software filter support via binary plugins
* added debugger (currently Linux-only); but it is as yet unstable
* added pause shortcut
* updated mightymo's cheat code database
2010-12-26 12:24:34 +00:00
|
|
|
}
|
|
|
|
|
2011-08-20 14:40:44 +00:00
|
|
|
inline const T& operator[](unsigned index) const {
|
|
|
|
if(index >= objectsize || !pool[index]) throw "vector[] out of bounds";
|
|
|
|
return *pool[index];
|
Update to v073 release.
byuu says:
This release marks a major step forward, offering full low-level
emulation of all four DSP coprocessors based on the NEC uPD77C25
processor core. Many people were responsible for this milestone: Dr.
Decapitator for the actual decapping and extraction; Lord Nightmare for
the cartridges and some special analysis tools; myself, Jonas Quinn and
Cydrak for the uPD77C25 emulation; and all of the donors who raised the
necessary $1,000 for the necessary hardware and equipment needed to pull
this all off. To say thanks to the donors, I am releasing the uPD77C25
emulation core to the public domain, so that everyone can benefit from
it.
All four DSP emulations will be improved by this by way of having
realistic timing; the DSP-4 will benefit further as the high-level
emulation was incomplete and somewhat buggy; and the DSP-3 will benefit
the most as the high-levle emulation there was not complete enough to be
playable. As a result, most notably, this means bsnes v073 is the first
emulator to fully be able to play SD Gundam GX (J)!
As bsnes' primary goal is accuracy, the LLE DSP support renders the old
HLE DSP support obsolete. Ergo, I have removed the 166KB of HLE source
code, and replaced it with the uPD77C25 core, which comprises a mere
20KB of source code. As this LLE module supports save states, this also
means that for the first time, DSP-3 and DSP-4 games have save state
support.
On the other hand, this also means that to run any DSP game, you will
need the appropriate program ROM. As these are copyrighted, I cannot
distribute them nor tell you where to get them. All I can do is provide
you with the necessary filenames and hashes.
Changelog (since v072 release):
* added NEC uPD77C25 emulation core
* added low-level emulation of the DSP-1, DSP-1B, DSP-2, DSP-3, DSP-4
coprocessors
* removed high-level emulation of the DSP-n coprocessors
* added blargg's libco::ppc.c module, which is far more portable, even
running on the PS3
* added software filter support via binary plugins
* added debugger (currently Linux-only); but it is as yet unstable
* added pause shortcut
* updated mightymo's cheat code database
2010-12-26 12:24:34 +00:00
|
|
|
}
|
|
|
|
|
2011-08-20 14:40:44 +00:00
|
|
|
//iteration
|
|
|
|
struct iterator {
|
|
|
|
bool operator!=(const iterator &source) const { return index != source.index; }
|
|
|
|
T& operator*() { return vector.operator[](index); }
|
|
|
|
iterator& operator++() { index++; return *this; }
|
|
|
|
iterator(pointer_vector &vector, unsigned index) : vector(vector), index(index) {}
|
|
|
|
private:
|
|
|
|
pointer_vector &vector;
|
|
|
|
unsigned index;
|
|
|
|
};
|
|
|
|
|
|
|
|
iterator begin() { return iterator(*this, 0); }
|
|
|
|
iterator end() { return iterator(*this, objectsize); }
|
Update to v073 release.
byuu says:
This release marks a major step forward, offering full low-level
emulation of all four DSP coprocessors based on the NEC uPD77C25
processor core. Many people were responsible for this milestone: Dr.
Decapitator for the actual decapping and extraction; Lord Nightmare for
the cartridges and some special analysis tools; myself, Jonas Quinn and
Cydrak for the uPD77C25 emulation; and all of the donors who raised the
necessary $1,000 for the necessary hardware and equipment needed to pull
this all off. To say thanks to the donors, I am releasing the uPD77C25
emulation core to the public domain, so that everyone can benefit from
it.
All four DSP emulations will be improved by this by way of having
realistic timing; the DSP-4 will benefit further as the high-level
emulation was incomplete and somewhat buggy; and the DSP-3 will benefit
the most as the high-levle emulation there was not complete enough to be
playable. As a result, most notably, this means bsnes v073 is the first
emulator to fully be able to play SD Gundam GX (J)!
As bsnes' primary goal is accuracy, the LLE DSP support renders the old
HLE DSP support obsolete. Ergo, I have removed the 166KB of HLE source
code, and replaced it with the uPD77C25 core, which comprises a mere
20KB of source code. As this LLE module supports save states, this also
means that for the first time, DSP-3 and DSP-4 games have save state
support.
On the other hand, this also means that to run any DSP game, you will
need the appropriate program ROM. As these are copyrighted, I cannot
distribute them nor tell you where to get them. All I can do is provide
you with the necessary filenames and hashes.
Changelog (since v072 release):
* added NEC uPD77C25 emulation core
* added low-level emulation of the DSP-1, DSP-1B, DSP-2, DSP-3, DSP-4
coprocessors
* removed high-level emulation of the DSP-n coprocessors
* added blargg's libco::ppc.c module, which is far more portable, even
running on the PS3
* added software filter support via binary plugins
* added debugger (currently Linux-only); but it is as yet unstable
* added pause shortcut
* updated mightymo's cheat code database
2010-12-26 12:24:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
template<typename T> struct has_size<linear_vector<T>> { enum { value = true }; };
|
|
|
|
template<typename T> struct has_size<pointer_vector<T>> { enum { value = true }; };
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|