Update to v090 release.
byuu says:
Most notably, this release adds Nintendo DS emulation. The Nintendo DS
module was written entirely by Cydrak, so please give him all of the
credit for it. I for one am extremely grateful to be allowed to use his
module in bsnes.
The Nintendo DS emulator's standalone name is dasShiny. You will need
the Nintendo DS firmware, which I cannot provide, in order to use it. It
also cannot (currently?) detect the save type used by NDS games. As
such, manifest.xml files must be created manually for this purpose. The
long-term plan is to create a database of save types for each game.
Also, you will need an analog input device for the touch screen for now
(joypad axes work well.)
There have also been a lot of changes from my end: a unified
manifest.xml format across all systems, major improvements to SPC7110
emulation, enhancements to RTC emulation, MSU1 enhancements, icons in
the file browser list, improvements to SNES coprocessor memory mapping,
cleanups and improvements in the libraries used to build bsnes, etc.
I've also included kaijuu (which allows launching game folders directly
with bsnes) and purify (which allows opening images that are compressed,
have copier headers, and have wrong extensions); both of which are fully
GUI-based.
This release only loads game folders, not files. Use purify to load ROM
files in bsnes.
Note that this will likely be the last release for a long time, and that
I will probably rename the emulator for the next release, due to how
many additional systems it now supports.
2012-08-07 14:08:37 +00:00
|
|
|
#ifndef NALL_PRIORITY_QUEUE_HPP
|
|
|
|
#define NALL_PRIORITY_QUEUE_HPP
|
2010-08-09 13:28:56 +00:00
|
|
|
|
|
|
|
#include <limits>
|
|
|
|
#include <nall/function.hpp>
|
|
|
|
#include <nall/serializer.hpp>
|
|
|
|
#include <nall/utility.hpp>
|
|
|
|
|
|
|
|
namespace nall {
|
|
|
|
template<typename type_t> void priority_queue_nocallback(type_t) {}
|
|
|
|
|
|
|
|
//priority queue implementation using binary min-heap array;
|
|
|
|
//does not require normalize() function.
|
|
|
|
//O(1) find (tick)
|
Update to v084r03 release.
(r02 was not posted to the WIP thread)
byuu says:
Internally, all color is processed with 30-bit precision. The filters
also operate at 30-bit depth.
There's a new config file setting, video.depth, which defaults to 24.
This causes the final output to downsample to 24-bit, as most will
require.
If you set it to 30-bit, the downsampling will not occur, and bsnes will
ask ruby for a 30-bit surface. If you don't have one available, you're
going to get bad colors. Or maybe even a crash with OpenGL.
I don't yet have detection code to make sure you have an appropriate
visual in place.
30-bit mode will really only work if you are running Linux, running Xorg
at Depth 30, use the OpenGL or XShm driver, have an nVidia Quadro or AMD
FireGL card with the official drivers, and have a 30-bit capable
monitor.
Lots of planning and work for very little gain here, but it's nice that
it's finally finished.
Oh, I had to change the contrast/brightness formulas a tiny bit, but
they still work and look nice.
2011-12-03 03:22:54 +00:00
|
|
|
//O(log n) append (enqueue)
|
2010-08-09 13:28:56 +00:00
|
|
|
//O(log n) remove (dequeue)
|
|
|
|
template<typename type_t> class priority_queue {
|
|
|
|
public:
|
|
|
|
inline void tick(unsigned ticks) {
|
|
|
|
basecounter += ticks;
|
|
|
|
while(heapsize && gte(basecounter, heap[0].counter)) callback(dequeue());
|
|
|
|
}
|
|
|
|
|
|
|
|
//counter is relative to current time (eg enqueue(64, ...) fires in 64 ticks);
|
|
|
|
//counter cannot exceed std::numeric_limits<unsigned>::max() >> 1.
|
|
|
|
void enqueue(unsigned counter, type_t event) {
|
|
|
|
unsigned child = heapsize++;
|
|
|
|
counter += basecounter;
|
|
|
|
|
|
|
|
while(child) {
|
|
|
|
unsigned parent = (child - 1) >> 1;
|
|
|
|
if(gte(counter, heap[parent].counter)) break;
|
|
|
|
|
|
|
|
heap[child].counter = heap[parent].counter;
|
|
|
|
heap[child].event = heap[parent].event;
|
|
|
|
child = parent;
|
|
|
|
}
|
|
|
|
|
|
|
|
heap[child].counter = counter;
|
|
|
|
heap[child].event = event;
|
|
|
|
}
|
|
|
|
|
|
|
|
type_t dequeue() {
|
|
|
|
type_t event(heap[0].event);
|
|
|
|
unsigned parent = 0;
|
|
|
|
unsigned counter = heap[--heapsize].counter;
|
|
|
|
|
|
|
|
while(true) {
|
|
|
|
unsigned child = (parent << 1) + 1;
|
|
|
|
if(child >= heapsize) break;
|
|
|
|
if(child + 1 < heapsize && gte(heap[child].counter, heap[child + 1].counter)) child++;
|
|
|
|
if(gte(heap[child].counter, counter)) break;
|
|
|
|
|
|
|
|
heap[parent].counter = heap[child].counter;
|
|
|
|
heap[parent].event = heap[child].event;
|
|
|
|
parent = child;
|
|
|
|
}
|
|
|
|
|
|
|
|
heap[parent].counter = counter;
|
|
|
|
heap[parent].event = heap[heapsize].event;
|
|
|
|
return event;
|
|
|
|
}
|
|
|
|
|
|
|
|
void reset() {
|
|
|
|
basecounter = 0;
|
|
|
|
heapsize = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void serialize(serializer &s) {
|
|
|
|
s.integer(basecounter);
|
|
|
|
s.integer(heapsize);
|
|
|
|
for(unsigned n = 0; n < heapcapacity; n++) {
|
|
|
|
s.integer(heap[n].counter);
|
|
|
|
s.integer(heap[n].event);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
priority_queue(unsigned size, function<void (type_t)> callback_ = &priority_queue_nocallback<type_t>)
|
|
|
|
: callback(callback_) {
|
|
|
|
heap = new heap_t[size];
|
|
|
|
heapcapacity = size;
|
|
|
|
reset();
|
|
|
|
}
|
|
|
|
|
|
|
|
~priority_queue() {
|
|
|
|
delete[] heap;
|
|
|
|
}
|
|
|
|
|
|
|
|
priority_queue& operator=(const priority_queue&) = delete;
|
|
|
|
priority_queue(const priority_queue&) = delete;
|
|
|
|
|
|
|
|
private:
|
|
|
|
function<void (type_t)> callback;
|
|
|
|
unsigned basecounter;
|
|
|
|
unsigned heapsize;
|
|
|
|
unsigned heapcapacity;
|
|
|
|
struct heap_t {
|
|
|
|
unsigned counter;
|
|
|
|
type_t event;
|
|
|
|
} *heap;
|
|
|
|
|
|
|
|
//return true if x is greater than or equal to y
|
|
|
|
inline bool gte(unsigned x, unsigned y) {
|
|
|
|
return x - y < (std::numeric_limits<unsigned>::max() >> 1);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|