2016-01-27 11:31:39 +00:00
|
|
|
#include <ws/ws.hpp>
|
|
|
|
|
|
|
|
namespace WonderSwan {
|
|
|
|
|
|
|
|
System system;
|
|
|
|
|
Update to v097r12 release.
byuu says:
Nothing WS-related this time.
First, I fixed expansion port device mapping. On first load, it was
mapping the expansion port device too late, so it ended up not taking
effect. I had to spin out the logic for that into
Program::connectDevices(). This was proving to be quite annoying while
testing eBoot (SNES-Hook simulation.)
Second, I fixed the audio->set(Frequency, Latency) functions to take
(uint) parameters from the configuration file, so the weird behavior
around changing settings in the audio panel should hopefully be gone
now.
Third, I rewrote the interface->load,unload functions to call into the
(Emulator)::System::load,unload functions. And I have those call out to
Cartridge::load,unload. Before, this was inverted, and Cartridge::load()
was invoking System::load(), which I felt was kind of backward.
The Super Game Boy really didn't like this change, however. And it took
me a few hours to power through it. Before, I had the Game Boy core
dummying out all the interface->(load,save)Request calls, and having the
SNES core make them for it. This is because the folder paths and IDs
will be different between the two cores.
I've redesigned things so that ICD2's Emulator::Interface overloads
loadRequest and saveRequest, and translates the requests into new
requests for the SuperFamicom core. This allows the Game Boy code to do
its own loading for everything without a bunch of Super Game Boy special
casing, and without any awkwardness around powering on with no cartridge
inserted.
This also lets the SNES side of things simply call into higher-level
GameBoy::interface->load,save(id, stream) functions instead of stabbing
at the raw underlying state inside of various Game Boy core emulation
classes. So things are a lot better abstracted now.
2016-02-08 03:17:59 +00:00
|
|
|
auto System::loaded() const -> bool { return _loaded; }
|
|
|
|
auto System::revision() const -> Revision { return _revision; }
|
2016-01-27 11:31:39 +00:00
|
|
|
|
|
|
|
auto System::init() -> void {
|
|
|
|
}
|
|
|
|
|
|
|
|
auto System::term() -> void {
|
|
|
|
}
|
|
|
|
|
|
|
|
auto System::load(Revision revision) -> void {
|
|
|
|
_revision = revision;
|
|
|
|
|
|
|
|
interface->loadRequest(ID::SystemManifest, "manifest.bml", true);
|
|
|
|
auto document = BML::unserialize(information.manifest);
|
|
|
|
|
2016-01-28 11:39:49 +00:00
|
|
|
//note: IPLROM is currently undumped; otherwise we'd load it here ...
|
|
|
|
|
2016-01-27 11:31:39 +00:00
|
|
|
cartridge.load();
|
Update to v097r12 release.
byuu says:
Nothing WS-related this time.
First, I fixed expansion port device mapping. On first load, it was
mapping the expansion port device too late, so it ended up not taking
effect. I had to spin out the logic for that into
Program::connectDevices(). This was proving to be quite annoying while
testing eBoot (SNES-Hook simulation.)
Second, I fixed the audio->set(Frequency, Latency) functions to take
(uint) parameters from the configuration file, so the weird behavior
around changing settings in the audio panel should hopefully be gone
now.
Third, I rewrote the interface->load,unload functions to call into the
(Emulator)::System::load,unload functions. And I have those call out to
Cartridge::load,unload. Before, this was inverted, and Cartridge::load()
was invoking System::load(), which I felt was kind of backward.
The Super Game Boy really didn't like this change, however. And it took
me a few hours to power through it. Before, I had the Game Boy core
dummying out all the interface->(load,save)Request calls, and having the
SNES core make them for it. This is because the folder paths and IDs
will be different between the two cores.
I've redesigned things so that ICD2's Emulator::Interface overloads
loadRequest and saveRequest, and translates the requests into new
requests for the SuperFamicom core. This allows the Game Boy code to do
its own loading for everything without a bunch of Super Game Boy special
casing, and without any awkwardness around powering on with no cartridge
inserted.
This also lets the SNES side of things simply call into higher-level
GameBoy::interface->load,save(id, stream) functions instead of stabbing
at the raw underlying state inside of various Game Boy core emulation
classes. So things are a lot better abstracted now.
2016-02-08 03:17:59 +00:00
|
|
|
_loaded = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto System::unload() -> void {
|
|
|
|
if(!loaded()) return;
|
|
|
|
cartridge.unload();
|
|
|
|
_loaded = false;
|
2016-01-27 11:31:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
auto System::power() -> void {
|
|
|
|
IO::power();
|
|
|
|
cpu.power();
|
|
|
|
ppu.power();
|
|
|
|
apu.power();
|
|
|
|
cartridge.power();
|
|
|
|
scheduler.power();
|
|
|
|
}
|
|
|
|
|
|
|
|
auto System::run() -> void {
|
2016-02-09 11:51:12 +00:00
|
|
|
while(scheduler.enter() != Scheduler::Event::Frame);
|
2016-01-27 11:31:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|