2010-08-09 13:28:56 +00:00
|
|
|
#ifndef NALL_CONFIG_HPP
|
|
|
|
#define NALL_CONFIG_HPP
|
|
|
|
|
|
|
|
#include <nall/file.hpp>
|
|
|
|
#include <nall/string.hpp>
|
|
|
|
#include <nall/vector.hpp>
|
|
|
|
|
|
|
|
namespace nall {
|
|
|
|
namespace configuration_traits {
|
|
|
|
template<typename T> struct is_boolean { enum { value = false }; };
|
|
|
|
template<> struct is_boolean<bool> { enum { value = true }; };
|
|
|
|
|
|
|
|
template<typename T> struct is_signed { enum { value = false }; };
|
|
|
|
template<> struct is_signed<signed> { enum { value = true }; };
|
|
|
|
|
|
|
|
template<typename T> struct is_unsigned { enum { value = false }; };
|
|
|
|
template<> struct is_unsigned<unsigned> { enum { value = true }; };
|
|
|
|
|
|
|
|
template<typename T> struct is_double { enum { value = false }; };
|
|
|
|
template<> struct is_double<double> { enum { value = true }; };
|
|
|
|
|
|
|
|
template<typename T> struct is_string { enum { value = false }; };
|
|
|
|
template<> struct is_string<string> { enum { value = true }; };
|
|
|
|
}
|
|
|
|
|
|
|
|
class configuration {
|
|
|
|
public:
|
|
|
|
enum type_t { boolean_t, signed_t, unsigned_t, double_t, string_t, unknown_t };
|
|
|
|
struct item_t {
|
|
|
|
uintptr_t data;
|
|
|
|
string name;
|
|
|
|
string desc;
|
|
|
|
type_t type;
|
|
|
|
|
|
|
|
string get() const {
|
|
|
|
switch(type) {
|
|
|
|
case boolean_t: return string() << *(bool*)data;
|
|
|
|
case signed_t: return string() << *(signed*)data;
|
|
|
|
case unsigned_t: return string() << *(unsigned*)data;
|
|
|
|
case double_t: return string() << *(double*)data;
|
|
|
|
case string_t: return string() << "\"" << *(string*)data << "\"";
|
|
|
|
}
|
|
|
|
return "???";
|
|
|
|
}
|
|
|
|
|
|
|
|
void set(string s) {
|
|
|
|
switch(type) {
|
|
|
|
case boolean_t: *(bool*)data = (s == "true"); break;
|
|
|
|
case signed_t: *(signed*)data = strsigned(s); break;
|
|
|
|
case unsigned_t: *(unsigned*)data = strunsigned(s); break;
|
|
|
|
case double_t: *(double*)data = strdouble(s); break;
|
Include all the code from the bsnes v068 tarball.
byuu describes the changes since v067:
This release officially introduces the accuracy and performance cores,
alongside the previously-existing compatibility core. The accuracy core
allows the most accurate SNES emulation ever seen, with every last
processor running at the lowest possible clock synchronization level.
The performance core allows slower computers the chance to finally use
bsnes. It is capable of attaining 60fps in standard games even on an
entry-level Intel Atom processor, commonly found in netbooks.
The accuracy core is absolutely not meant for casual gaming at all. It
is meant solely for getting as close to 100% perfection as possible, no
matter the cost to speed. It should only be used for testing,
development or debugging.
The compatibility core is identical to bsnes v067 and earlier, but is
now roughly 10% faster. This is the default and recommended core for
casual gaming.
The performance core contains an entirely new S-CPU core, with
range-tested IRQs; and uses blargg's heavily-optimized S-DSP core
directly. Although there are very minor accuracy tradeoffs to increase
speed, I am confident that the performance core is still more accurate
and compatible than any other SNES emulator. The S-CPU, S-SMP, S-DSP,
SuperFX and SA-1 processors are all clock-based, just as in the accuracy
and compatibility cores; and as always, there are zero game-specific
hacks. Its compatibility is still well above 99%, running even the most
challenging games flawlessly.
If you have held off from using bsnes in the past due to its system
requirements, please give the performance core a try. I think you will
be impressed. I'm also not finished: I believe performance can be
increased even further.
I would also strongly suggest Windows Vista and Windows 7 users to take
advantage of the new XAudio2 driver by OV2. Not only does it give you
a performance boost, it also lowers latency and provides better sound by
way of skipping an API emulation layer.
Changelog:
- Split core into three profiles: accuracy, compatibility and
performance
- Accuracy core now takes advantage of variable-bitlength integers (eg
uint24_t)
- Performance core uses a new S-CPU core, written from scratch for speed
- Performance core uses blargg's snes_dsp library for S-DSP emulation
- Binaries are now compiled using GCC 4.5
- Added a workaround in the SA-1 core for a bug in GCC 4.5+
- The clock-based S-PPU renderer has greatly improved OAM emulation;
fixing Winter Gold and Megalomania rendering issues
- Corrected pseudo-hires color math in the clock-based S-PPU renderer;
fixing Super Buster Bros backgrounds
- Fixed a clamping bug in the Cx4 16-bit triangle operation [Jonas
Quinn]; fixing Mega Man X2 "gained weapon" star background effect
- Updated video renderer to properly handle mixed-resolution screens
with interlace enabled; fixing Air Strike Patrol level briefing screen
- Added mightymo's 2010-08-19 cheat code pack
- Windows port: added XAudio2 output support [OV2]
- Source: major code restructuring; virtual base classes for processor
- cores removed, build system heavily modified, etc.
2010-08-22 01:02:42 +00:00
|
|
|
case string_t: trim(s, "\""); *(string*)data = s; break;
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
linear_vector<item_t> list;
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
void attach(T &data, const char *name, const char *desc = "") {
|
|
|
|
unsigned n = list.size();
|
|
|
|
list[n].data = (uintptr_t)&data;
|
|
|
|
list[n].name = name;
|
|
|
|
list[n].desc = desc;
|
|
|
|
|
|
|
|
if(configuration_traits::is_boolean<T>::value) list[n].type = boolean_t;
|
|
|
|
else if(configuration_traits::is_signed<T>::value) list[n].type = signed_t;
|
|
|
|
else if(configuration_traits::is_unsigned<T>::value) list[n].type = unsigned_t;
|
|
|
|
else if(configuration_traits::is_double<T>::value) list[n].type = double_t;
|
|
|
|
else if(configuration_traits::is_string<T>::value) list[n].type = string_t;
|
|
|
|
else list[n].type = unknown_t;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool load(const char *filename) {
|
|
|
|
string data;
|
|
|
|
if(data.readfile(filename) == true) {
|
|
|
|
data.replace("\r", "");
|
|
|
|
lstring line;
|
|
|
|
line.split("\n", data);
|
|
|
|
|
|
|
|
for(unsigned i = 0; i < line.size(); i++) {
|
|
|
|
if(auto position = qstrpos(line[i], "#")) line[i][position()] = 0;
|
|
|
|
if(!qstrpos(line[i], " = ")) continue;
|
|
|
|
|
|
|
|
lstring part;
|
|
|
|
part.qsplit(" = ", line[i]);
|
Include all the code from the bsnes v068 tarball.
byuu describes the changes since v067:
This release officially introduces the accuracy and performance cores,
alongside the previously-existing compatibility core. The accuracy core
allows the most accurate SNES emulation ever seen, with every last
processor running at the lowest possible clock synchronization level.
The performance core allows slower computers the chance to finally use
bsnes. It is capable of attaining 60fps in standard games even on an
entry-level Intel Atom processor, commonly found in netbooks.
The accuracy core is absolutely not meant for casual gaming at all. It
is meant solely for getting as close to 100% perfection as possible, no
matter the cost to speed. It should only be used for testing,
development or debugging.
The compatibility core is identical to bsnes v067 and earlier, but is
now roughly 10% faster. This is the default and recommended core for
casual gaming.
The performance core contains an entirely new S-CPU core, with
range-tested IRQs; and uses blargg's heavily-optimized S-DSP core
directly. Although there are very minor accuracy tradeoffs to increase
speed, I am confident that the performance core is still more accurate
and compatible than any other SNES emulator. The S-CPU, S-SMP, S-DSP,
SuperFX and SA-1 processors are all clock-based, just as in the accuracy
and compatibility cores; and as always, there are zero game-specific
hacks. Its compatibility is still well above 99%, running even the most
challenging games flawlessly.
If you have held off from using bsnes in the past due to its system
requirements, please give the performance core a try. I think you will
be impressed. I'm also not finished: I believe performance can be
increased even further.
I would also strongly suggest Windows Vista and Windows 7 users to take
advantage of the new XAudio2 driver by OV2. Not only does it give you
a performance boost, it also lowers latency and provides better sound by
way of skipping an API emulation layer.
Changelog:
- Split core into three profiles: accuracy, compatibility and
performance
- Accuracy core now takes advantage of variable-bitlength integers (eg
uint24_t)
- Performance core uses a new S-CPU core, written from scratch for speed
- Performance core uses blargg's snes_dsp library for S-DSP emulation
- Binaries are now compiled using GCC 4.5
- Added a workaround in the SA-1 core for a bug in GCC 4.5+
- The clock-based S-PPU renderer has greatly improved OAM emulation;
fixing Winter Gold and Megalomania rendering issues
- Corrected pseudo-hires color math in the clock-based S-PPU renderer;
fixing Super Buster Bros backgrounds
- Fixed a clamping bug in the Cx4 16-bit triangle operation [Jonas
Quinn]; fixing Mega Man X2 "gained weapon" star background effect
- Updated video renderer to properly handle mixed-resolution screens
with interlace enabled; fixing Air Strike Patrol level briefing screen
- Added mightymo's 2010-08-19 cheat code pack
- Windows port: added XAudio2 output support [OV2]
- Source: major code restructuring; virtual base classes for processor
- cores removed, build system heavily modified, etc.
2010-08-22 01:02:42 +00:00
|
|
|
trim(part[0]);
|
|
|
|
trim(part[1]);
|
2010-08-09 13:28:56 +00:00
|
|
|
|
|
|
|
for(unsigned n = 0; n < list.size(); n++) {
|
|
|
|
if(part[0] == list[n].name) {
|
|
|
|
list[n].set(part[1]);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool save(const char *filename) const {
|
|
|
|
file fp;
|
|
|
|
if(fp.open(filename, file::mode_write)) {
|
|
|
|
for(unsigned i = 0; i < list.size(); i++) {
|
|
|
|
string output;
|
|
|
|
output << list[i].name << " = " << list[i].get();
|
|
|
|
if(list[i].desc != "") output << " # " << list[i].desc;
|
|
|
|
output << "\r\n";
|
|
|
|
fp.print(output);
|
|
|
|
}
|
|
|
|
|
|
|
|
fp.close();
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|