2016-01-07 08:14:33 +00:00
|
|
|
#pragma once
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2013-04-14 08:52:47 +00:00
|
|
|
#include <nall/platform.hpp>
|
2010-08-09 13:28:56 +00:00
|
|
|
#include <nall/file.hpp>
|
|
|
|
#include <nall/string.hpp>
|
|
|
|
|
|
|
|
namespace nall {
|
2013-04-14 08:52:47 +00:00
|
|
|
namespace Configuration {
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2013-04-14 08:52:47 +00:00
|
|
|
struct Node {
|
|
|
|
string name;
|
|
|
|
string desc;
|
Update to v098r11 release.
byuu says:
Changelog:
- fixed nall/path.hpp compilation issue
- fixed ruby/audio/xaudio header declaration compilation issue (again)
- cleaned up xaudio2.hpp file to match my coding syntax (12.5% of the
file was whitespace overkill)
- added null terminator entry to nall/windows/utf8.hpp argc[] array
- nall/windows/guid.hpp uses the Windows API for generating the GUID
- this should stop all the bug reports where two nall users were
generating GUIDs at the exact same second
- fixed hiro/cocoa compilation issue with uint# types
- fixed major higan/sfc Super Game Boy audio latency issue
- fixed higan/sfc CPU core bug with pei, [dp], [dp]+y instructions
- major cleanups to higan/processor/r65816 core
- merged emulation/native-mode opcodes
- use camel-case naming on memory.hpp functions
- simplify address masking code for memory.hpp functions
- simplify a few opcodes themselves (avoid redundant copies, etc)
- rename regs.* to r.* to match modern convention of other CPU cores
- removed device.order<> concept from Emulator::Interface
- cores will now do the translation to make the job of the UI easier
- fixed plurality naming of arrays in Emulator::Interface
- example: emulator.ports[p].devices[d].inputs[i]
- example: vector<Medium> media
- probably more surprises
Major show-stoppers to the next official release:
- we need to work on GB core improvements: LY=153/0 case, multiple STAT
IRQs case, GBC audio output regs, etc.
- we need to re-add software cursors for light guns (Super Scope,
Justifier)
- after the above, we need to fix the turbo button for the Super Scope
I really have no idea how I want to implement the light guns. Ideally,
we'd want it in higan/video, so we can support the NES Zapper with the
same code. But this isn't going to be easy, because only the SNES knows
when its output is interlaced, and its resolutions can vary as
{256,512}x{224,240,448,480} which requires pixel doubling that was
hard-coded to the SNES-specific behavior, but isn't appropriate to be
exposed in higan/video.
2016-05-25 11:13:02 +00:00
|
|
|
enum class Type : uint { Null, Boolean, Integer, Natural, Double, String } type = Type::Null;
|
2013-04-14 08:52:47 +00:00
|
|
|
void* data = nullptr;
|
|
|
|
vector<Node> children;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2016-05-16 09:51:12 +00:00
|
|
|
explicit operator bool() const { return data; }
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2015-07-14 09:32:43 +00:00
|
|
|
auto get() const -> string {
|
2013-04-14 08:52:47 +00:00
|
|
|
switch(type) {
|
2015-11-14 00:52:51 +00:00
|
|
|
case Type::Boolean: return {*(bool*)data};
|
|
|
|
case Type::Integer: return {*(int*)data};
|
|
|
|
case Type::Natural: return {*(uint*)data};
|
2013-04-14 08:52:47 +00:00
|
|
|
case Type::Double: return {*(double*)data};
|
|
|
|
case Type::String: return {*(string*)data};
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
2013-04-14 08:52:47 +00:00
|
|
|
return "";
|
|
|
|
}
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2015-07-14 09:32:43 +00:00
|
|
|
auto set(const string& value) -> void {
|
2013-04-14 08:52:47 +00:00
|
|
|
switch(type) {
|
2015-11-14 00:52:51 +00:00
|
|
|
case Type::Boolean: *(bool*)data = (value != "false"); break;
|
Update to v099r14 release.
byuu says:
Changelog:
- (u)int(max,ptr) abbreviations removed; use _t suffix now [didn't feel
like they were contributing enough to be worth it]
- cleaned up nall::integer,natural,real functionality
- toInteger, toNatural, toReal for parsing strings to numbers
- fromInteger, fromNatural, fromReal for creating strings from numbers
- (string,Markup::Node,SQL-based-classes)::(integer,natural,real)
left unchanged
- template<typename T> numeral(T value, long padding, char padchar)
-> string for print() formatting
- deduces integer,natural,real based on T ... cast the value if you
want to override
- there still exists binary,octal,hex,pointer for explicit print()
formatting
- lstring -> string_vector [but using lstring = string_vector; is
declared]
- would be nice to remove the using lstring eventually ... but that'd
probably require 10,000 lines of changes >_>
- format -> string_format [no using here; format was too ambiguous]
- using integer = Integer<sizeof(int)*8>; and using natural =
Natural<sizeof(uint)*8>; declared
- for consistency with boolean. These three are meant for creating
zero-initialized values implicitly (various uses)
- R65816::io() -> idle() and SPC700::io() -> idle() [more clear; frees
up struct IO {} io; naming]
- SFC CPU, PPU, SMP use struct IO {} io; over struct (Status,Registers) {}
(status,registers); now
- still some CPU::Status status values ... they didn't really fit into
IO functionality ... will have to think about this more
- SFC CPU, PPU, SMP now use step() exclusively instead of addClocks()
calling into step()
- SFC CPU joypad1_bits, joypad2_bits were unused; killed them
- SFC PPU CGRAM moved into PPU::Screen; since nothing else uses it
- SFC PPU OAM moved into PPU::Object; since nothing else uses it
- the raw uint8[544] array is gone. OAM::read() constructs values from
the OAM::Object[512] table now
- this avoids having to determine how we want to sub-divide the two
OAM memory sections
- this also eliminates the OAM::synchronize() functionality
- probably more I'm forgetting
The FPS fluctuations are driving me insane. This WIP went from 128fps to
137fps. Settled on 133.5fps for the final build. But nothing I changed
should have affected performance at all. This level of fluctuation makes
it damn near impossible to know whether I'm speeding things up or slowing
things down with changes.
2016-07-01 11:50:32 +00:00
|
|
|
case Type::Integer: *(int*)data = toInteger(value); break;
|
|
|
|
case Type::Natural: *(uint*)data = toNatural(value); break;
|
|
|
|
case Type::Double: *(double*)data = toReal(value); break;
|
2013-04-14 08:52:47 +00:00
|
|
|
case Type::String: *(string*)data = value; break;
|
2012-01-15 08:29:57 +00:00
|
|
|
}
|
2013-04-14 08:52:47 +00:00
|
|
|
}
|
2012-01-15 08:29:57 +00:00
|
|
|
|
2015-07-14 09:32:43 +00:00
|
|
|
auto assign() { type = Type::Null; data = nullptr; }
|
2015-11-14 00:52:51 +00:00
|
|
|
auto assign(bool& bind) { type = Type::Boolean; data = (void*)&bind; }
|
|
|
|
auto assign(int& bind) { type = Type::Integer; data = (void*)&bind; }
|
|
|
|
auto assign(uint& bind) { type = Type::Natural; data = (void*)&bind; }
|
2015-07-14 09:32:43 +00:00
|
|
|
auto assign(double& bind) { type = Type::Double; data = (void*)&bind; }
|
|
|
|
auto assign(string& bind) { type = Type::String; data = (void*)&bind; }
|
|
|
|
auto assign(const Node& node) { operator=(node); }
|
2013-04-14 08:52:47 +00:00
|
|
|
|
2015-07-14 09:32:43 +00:00
|
|
|
template<typename T> auto append(T& data, const string& name, const string& desc = "") -> void {
|
2013-04-14 08:52:47 +00:00
|
|
|
Node node;
|
|
|
|
node.assign(data);
|
|
|
|
node.name = name;
|
|
|
|
node.desc = desc;
|
|
|
|
children.append(node);
|
|
|
|
}
|
2010-08-09 13:28:56 +00:00
|
|
|
|
Update to v095r05 release.
byuu says:
Changelog:
- GBA: lots of emulation improvements
- PPU PRAM is 16-bits wide
- DMA masks &~1/Half, &~3/Word
- VRAM OBJ 8-bit writes are ignored
- OAM 8-bit writes are ignored
- BGnCNT unused bits are writable*
- BG(0,1)CNT can't set the d13
- BLDALPHA is readable (fixes Donkey Kong Country, etc)
- SNES: lots of code cleanups
- sfc/chip => sfc/coprocessor
- UI: save most recent controller selection
GBA test scores: 1552/1552, 37/38, 1020/1260
(* forgot to add the value to the read function, so endrift's I/O tests
for them will fail. Fixed locally.)
Note: SNES is the only system with multiple controller/expansion port
options, and as such is the only one with a "None" option. Because it's
shared by the controller and expansion port, it ends up sorted first in
the list. This means that on your first run, you'll need to go to Super
Famicom->Controller Port 1 and select "Gamepad", otherwise input won't
work.
Also note that changing the expansion port device requires loading a new
cart. Unlike controllers, you aren't meant to hotplug expansion port
devices.
2015-11-12 10:15:03 +00:00
|
|
|
auto find(const string& path) -> maybe<Node&> {
|
|
|
|
auto p = path.split("/");
|
2016-05-02 09:57:04 +00:00
|
|
|
auto name = p.takeLeft();
|
Update to v095r05 release.
byuu says:
Changelog:
- GBA: lots of emulation improvements
- PPU PRAM is 16-bits wide
- DMA masks &~1/Half, &~3/Word
- VRAM OBJ 8-bit writes are ignored
- OAM 8-bit writes are ignored
- BGnCNT unused bits are writable*
- BG(0,1)CNT can't set the d13
- BLDALPHA is readable (fixes Donkey Kong Country, etc)
- SNES: lots of code cleanups
- sfc/chip => sfc/coprocessor
- UI: save most recent controller selection
GBA test scores: 1552/1552, 37/38, 1020/1260
(* forgot to add the value to the read function, so endrift's I/O tests
for them will fail. Fixed locally.)
Note: SNES is the only system with multiple controller/expansion port
options, and as such is the only one with a "None" option. Because it's
shared by the controller and expansion port, it ends up sorted first in
the list. This means that on your first run, you'll need to go to Super
Famicom->Controller Port 1 and select "Gamepad", otherwise input won't
work.
Also note that changing the expansion port device requires loading a new
cart. Unlike controllers, you aren't meant to hotplug expansion port
devices.
2015-11-12 10:15:03 +00:00
|
|
|
for(auto& child : children) {
|
|
|
|
if(child.name == name) {
|
|
|
|
if(p.size() == 0) return child;
|
|
|
|
return child.find(p.merge("/"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nothing;
|
|
|
|
}
|
|
|
|
|
2015-07-14 09:32:43 +00:00
|
|
|
auto load(Markup::Node path) -> void {
|
2013-04-14 08:52:47 +00:00
|
|
|
for(auto& child : children) {
|
Update to v094r17 release.
byuu says:
This updates higan to use the new Markup::Node changes. This is a really
big change, and one slight typo anywhere could break certain classes of
games from playing.
I don't have ananke hooked up again yet, so I don't have the ability to
test this much. If anyone with some v094 game folders wouldn't mind
testing, I'd help out a great deal.
I'm most concerned about testing one of each SNES special chip game.
Most notably, systems like the SA-1, HitachiDSP and NEC-DSP were using
the fancier lookups, eg node["rom[0]/name"], which I had to convert to
a rather ugly node["rom"].at(0)["name"], which I'm fairly confident
won't work. I'm going to blame that on the fumes from the shelves I just
stained >.> Might work with node.find("rom[0]/name")(0) though ...? But
so ugly ... ugh.
That aside, this WIP adds the accuracy-PPU inlining, so the accuracy
profile should run around 7.5% faster than before.
2015-05-02 13:05:46 +00:00
|
|
|
if(auto leaf = path[child.name]) {
|
2016-05-16 09:51:12 +00:00
|
|
|
if(child) child.set(leaf.text());
|
Update to v094r17 release.
byuu says:
This updates higan to use the new Markup::Node changes. This is a really
big change, and one slight typo anywhere could break certain classes of
games from playing.
I don't have ananke hooked up again yet, so I don't have the ability to
test this much. If anyone with some v094 game folders wouldn't mind
testing, I'd help out a great deal.
I'm most concerned about testing one of each SNES special chip game.
Most notably, systems like the SA-1, HitachiDSP and NEC-DSP were using
the fancier lookups, eg node["rom[0]/name"], which I had to convert to
a rather ugly node["rom"].at(0)["name"], which I'm fairly confident
won't work. I'm going to blame that on the fumes from the shelves I just
stained >.> Might work with node.find("rom[0]/name")(0) though ...? But
so ugly ... ugh.
That aside, this WIP adds the accuracy-PPU inlining, so the accuracy
profile should run around 7.5% faster than before.
2015-05-02 13:05:46 +00:00
|
|
|
child.load(leaf);
|
|
|
|
}
|
2013-04-14 08:52:47 +00:00
|
|
|
}
|
|
|
|
}
|
2010-08-09 13:28:56 +00:00
|
|
|
|
Update to v098r11 release.
byuu says:
Changelog:
- fixed nall/path.hpp compilation issue
- fixed ruby/audio/xaudio header declaration compilation issue (again)
- cleaned up xaudio2.hpp file to match my coding syntax (12.5% of the
file was whitespace overkill)
- added null terminator entry to nall/windows/utf8.hpp argc[] array
- nall/windows/guid.hpp uses the Windows API for generating the GUID
- this should stop all the bug reports where two nall users were
generating GUIDs at the exact same second
- fixed hiro/cocoa compilation issue with uint# types
- fixed major higan/sfc Super Game Boy audio latency issue
- fixed higan/sfc CPU core bug with pei, [dp], [dp]+y instructions
- major cleanups to higan/processor/r65816 core
- merged emulation/native-mode opcodes
- use camel-case naming on memory.hpp functions
- simplify address masking code for memory.hpp functions
- simplify a few opcodes themselves (avoid redundant copies, etc)
- rename regs.* to r.* to match modern convention of other CPU cores
- removed device.order<> concept from Emulator::Interface
- cores will now do the translation to make the job of the UI easier
- fixed plurality naming of arrays in Emulator::Interface
- example: emulator.ports[p].devices[d].inputs[i]
- example: vector<Medium> media
- probably more surprises
Major show-stoppers to the next official release:
- we need to work on GB core improvements: LY=153/0 case, multiple STAT
IRQs case, GBC audio output regs, etc.
- we need to re-add software cursors for light guns (Super Scope,
Justifier)
- after the above, we need to fix the turbo button for the Super Scope
I really have no idea how I want to implement the light guns. Ideally,
we'd want it in higan/video, so we can support the NES Zapper with the
same code. But this isn't going to be easy, because only the SNES knows
when its output is interlaced, and its resolutions can vary as
{256,512}x{224,240,448,480} which requires pixel doubling that was
hard-coded to the SNES-specific behavior, but isn't appropriate to be
exposed in higan/video.
2016-05-25 11:13:02 +00:00
|
|
|
auto save(file& fp, uint depth = 0) -> void {
|
2013-04-14 08:52:47 +00:00
|
|
|
for(auto& child : children) {
|
|
|
|
if(child.desc) {
|
2015-11-14 00:52:51 +00:00
|
|
|
for(auto n : range(depth)) fp.print(" ");
|
2013-04-14 08:52:47 +00:00
|
|
|
fp.print("//", child.desc, "\n");
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
2015-11-14 00:52:51 +00:00
|
|
|
for(auto n : range(depth)) fp.print(" ");
|
2013-04-14 08:52:47 +00:00
|
|
|
fp.print(child.name);
|
2016-05-16 09:51:12 +00:00
|
|
|
if(child) fp.print(": ", child.get());
|
2013-04-14 08:52:47 +00:00
|
|
|
fp.print("\n");
|
|
|
|
child.save(fp, depth + 1);
|
|
|
|
if(depth == 0) fp.print("\n");
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
2013-04-14 08:52:47 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Document : Node {
|
2015-07-14 09:32:43 +00:00
|
|
|
auto load(const string& filename) -> bool {
|
2013-04-14 08:52:47 +00:00
|
|
|
if(!file::exists(filename)) return false;
|
Update to v094r17 release.
byuu says:
This updates higan to use the new Markup::Node changes. This is a really
big change, and one slight typo anywhere could break certain classes of
games from playing.
I don't have ananke hooked up again yet, so I don't have the ability to
test this much. If anyone with some v094 game folders wouldn't mind
testing, I'd help out a great deal.
I'm most concerned about testing one of each SNES special chip game.
Most notably, systems like the SA-1, HitachiDSP and NEC-DSP were using
the fancier lookups, eg node["rom[0]/name"], which I had to convert to
a rather ugly node["rom"].at(0)["name"], which I'm fairly confident
won't work. I'm going to blame that on the fumes from the shelves I just
stained >.> Might work with node.find("rom[0]/name")(0) though ...? But
so ugly ... ugh.
That aside, this WIP adds the accuracy-PPU inlining, so the accuracy
profile should run around 7.5% faster than before.
2015-05-02 13:05:46 +00:00
|
|
|
auto document = BML::unserialize(string::read(filename));
|
2013-04-14 08:52:47 +00:00
|
|
|
Node::load(document);
|
|
|
|
return true;
|
|
|
|
}
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2015-07-14 09:32:43 +00:00
|
|
|
auto save(const string& filename) -> bool {
|
2013-04-14 08:52:47 +00:00
|
|
|
file fp(filename, file::mode::write);
|
|
|
|
if(!fp.open()) return false;
|
|
|
|
Node::save(fp);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2013-04-14 08:52:47 +00:00
|
|
|
}
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|