2012-04-29 06:16:44 +00:00
|
|
|
#include <sfc/sfc.hpp>
|
2011-01-08 09:58:41 +00:00
|
|
|
|
|
|
|
#define ICD2_CPP
|
2012-04-26 10:51:13 +00:00
|
|
|
namespace SuperFamicom {
|
2011-01-08 09:58:41 +00:00
|
|
|
|
|
|
|
#include "interface/interface.cpp"
|
|
|
|
#include "mmio/mmio.cpp"
|
Update to v073r03 release.
byuu says:
Changelog:
- much tighter SGB integration, but this is still a work-in-progress
- memory::gb(rom,ram,rtc) is gone, uses GameBoy:: memory structures
directly (a big gain, no need to copy memory to save and load)
- UI-based cartridge loading works with GameBoy:: directly as well
- libsnes will need to be updated internally to reflect this
- games can save and load (even before bgameboy can, hah)
- save states hooked up, but they crash the DMG. I don't know why, as
if it was hard enough saving states with libco, try doing it for an
emulator inside an emulator >_<
- last remnants of old SGB stuff removed, <sueprgameboy> XML converted
to <icd2>
- looks like the XML list idea is looking pretty useless for
SNES::Cartridge now that bgameboy handles its own XML mapping
2011-01-08 10:06:09 +00:00
|
|
|
#include "serialization.cpp"
|
2011-01-08 09:58:41 +00:00
|
|
|
ICD2 icd2;
|
|
|
|
|
|
|
|
void ICD2::Enter() { icd2.enter(); }
|
|
|
|
|
|
|
|
void ICD2::enter() {
|
|
|
|
while(true) {
|
Update to v073r03 release.
byuu says:
Changelog:
- much tighter SGB integration, but this is still a work-in-progress
- memory::gb(rom,ram,rtc) is gone, uses GameBoy:: memory structures
directly (a big gain, no need to copy memory to save and load)
- UI-based cartridge loading works with GameBoy:: directly as well
- libsnes will need to be updated internally to reflect this
- games can save and load (even before bgameboy can, hah)
- save states hooked up, but they crash the DMG. I don't know why, as
if it was hard enough saving states with libco, try doing it for an
emulator inside an emulator >_<
- last remnants of old SGB stuff removed, <sueprgameboy> XML converted
to <icd2>
- looks like the XML list idea is looking pretty useless for
SNES::Cartridge now that bgameboy handles its own XML mapping
2011-01-08 10:06:09 +00:00
|
|
|
if(scheduler.sync == Scheduler::SynchronizeMode::All) {
|
2012-04-26 10:51:13 +00:00
|
|
|
GameBoy::system.runtosave();
|
Update to v073r03 release.
byuu says:
Changelog:
- much tighter SGB integration, but this is still a work-in-progress
- memory::gb(rom,ram,rtc) is gone, uses GameBoy:: memory structures
directly (a big gain, no need to copy memory to save and load)
- UI-based cartridge loading works with GameBoy:: directly as well
- libsnes will need to be updated internally to reflect this
- games can save and load (even before bgameboy can, hah)
- save states hooked up, but they crash the DMG. I don't know why, as
if it was hard enough saving states with libco, try doing it for an
emulator inside an emulator >_<
- last remnants of old SGB stuff removed, <sueprgameboy> XML converted
to <icd2>
- looks like the XML list idea is looking pretty useless for
SNES::Cartridge now that bgameboy handles its own XML mapping
2011-01-08 10:06:09 +00:00
|
|
|
scheduler.exit(Scheduler::ExitReason::SynchronizeEvent);
|
|
|
|
}
|
|
|
|
|
2011-01-08 09:58:41 +00:00
|
|
|
if(r6003 & 0x80) {
|
2012-04-26 10:51:13 +00:00
|
|
|
GameBoy::system.run();
|
|
|
|
step(GameBoy::system.clocks_executed);
|
|
|
|
GameBoy::system.clocks_executed = 0;
|
2011-01-08 09:58:41 +00:00
|
|
|
} else { //DMG halted
|
2011-02-02 10:37:31 +00:00
|
|
|
audio.coprocessor_sample(0x0000, 0x0000);
|
|
|
|
step(1);
|
2011-01-08 09:58:41 +00:00
|
|
|
}
|
|
|
|
synchronize_cpu();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ICD2::init() {
|
|
|
|
}
|
|
|
|
|
Update to v075 release.
byuu says:
This release brings improved Super Game Boy emulation, the final SHA256
hashes for the DSP-(1,1B,2,3,4) and ST-(0010,0011) coprocessors, user
interface improvements, and major internal code restructuring.
Changelog (since v074):
- completely rewrote memory sub-system to support 1-byte granularity in
XML mapping
- removed Memory inheritance and MMIO class completely, any address can
be mapped to any function now
- SuperFX: removed SuperFXBus : Bus, now implemented manually
- SA-1: removed SA1Bus : Bus, now implemented manually
- entire bus mapping is now static, happens once on cartridge load
- as a result, read/write handlers now handle MMC mapping; slower
average case, far faster worst case
- namespace memory is no more, RAM arrays are stored inside the chips
they are owned by now
- GameBoy: improved CPU HALT emulation, fixes Zelda: Link's Awakening
scrolling
- GameBoy: added serial emulation (cannot connect to another GB yet),
fixes Shin Megami Tensei - Devichil
- GameBoy: improved LCD STAT emulation, fixes Sagaia
- ui: added fullscreen support (F11 key), video settings allows for
three scale settings
- ui: fixed brightness, contrast, gamma, audio volume, input frequency
values on program startup
- ui: since Qt is dead, config file becomes bsnes.cfg once again
- Super Game Boy: you can now load the BIOS without a game inserted to
see a pretty white box
- ui-gameboy: can be built without SNES components now
- libsnes: now a UI target, compile with 'make ui=ui-libsnes'
- libsnes: added WRAM, APURAM, VRAM, OAM, CGRAM access (cheat search,
etc)
- source: removed launcher/, as the Qt port is now gone
- source: Makefile restructuring to better support new ui targets
- source: lots of other internal code cleanup work
2011-01-27 08:52:34 +00:00
|
|
|
void ICD2::load() {
|
2012-05-09 23:35:29 +00:00
|
|
|
bind = GameBoy::interface->bind;
|
|
|
|
hook = GameBoy::interface->hook;
|
Update to v088r15 release.
byuu says:
Changelog:
- default placement of presentation window optimized for 1024x768
displays or larger (sorry if yours is smaller, move the window
yourself.)
- Direct3D waits until a previous Vblank ends before waiting for the
next Vblank to begin (fixes video timing analysis, and ---really---
fast computers.)
- Window::setVisible(false) clears modality, but also fixed in Browser
code as well (fixes loading images on Windows hanging)
- Browser won't consume full CPU resources (but timing analysis will,
I don't want stalls to affect the results.)
- closing settings window while analyzing stops analysis
- you can load the SGB BIOS without a game (why the hell you would want
to ...)
- escape closes the Browser window (it won't close other dialogs, it has
to be hooked up per-window)
- just for fun, joypad hat up/down moves in Browser file list, any
joypad button loads selected game [not very useful, lacks repeat, and
there aren't GUI load file open buttons]
- Super Scope and Justifier crosshairs render correctly (probably
doesn't belong in the core, but it's not something I suspect people
want to do themselves ...)
- you can load GB, SGB, GB, SGB ... without problems (not happy with how
I did this, but I don't want to add an Interface::setInterface()
function yet)
- PAL timing works as I want now (if you want 50fps on a 60hz monitor,
you must not use sync video) [needed to update the DSP frequency when
toggling video/audio sync]
- not going to save input port selection for now (lot of work), but it
will properly keep your port setting across cartridge loads at least
[just goes to controller on emulator restart]
- SFC overscan on and off both work as expected now (off centers image,
on shows entire image)
- laevateinn compiles properly now
- ethos goes to ~/.config/bsnes now that target-ui is dead [honestly,
I recommend deleting the old folder and starting over]
- Emulator::Interface callbacks converted to virtual binding structure
that GUI inherits from (simplifies binding callbacks)
- this breaks Super Game Boy for a bit, I need to rethink
system-specific bindings without direct inheritance
Timing analysis works spectacularly well on Windows, too. You won't get
your 100% perfect rate (unless maybe you leave the analysis running
overnight?), but it'll get really freaking close this way.
2012-05-07 23:29:03 +00:00
|
|
|
GameBoy::interface->bind = this;
|
2012-05-09 23:35:29 +00:00
|
|
|
GameBoy::interface->hook = this;
|
2011-01-08 09:58:41 +00:00
|
|
|
}
|
|
|
|
|
Update to v075 release.
byuu says:
This release brings improved Super Game Boy emulation, the final SHA256
hashes for the DSP-(1,1B,2,3,4) and ST-(0010,0011) coprocessors, user
interface improvements, and major internal code restructuring.
Changelog (since v074):
- completely rewrote memory sub-system to support 1-byte granularity in
XML mapping
- removed Memory inheritance and MMIO class completely, any address can
be mapped to any function now
- SuperFX: removed SuperFXBus : Bus, now implemented manually
- SA-1: removed SA1Bus : Bus, now implemented manually
- entire bus mapping is now static, happens once on cartridge load
- as a result, read/write handlers now handle MMC mapping; slower
average case, far faster worst case
- namespace memory is no more, RAM arrays are stored inside the chips
they are owned by now
- GameBoy: improved CPU HALT emulation, fixes Zelda: Link's Awakening
scrolling
- GameBoy: added serial emulation (cannot connect to another GB yet),
fixes Shin Megami Tensei - Devichil
- GameBoy: improved LCD STAT emulation, fixes Sagaia
- ui: added fullscreen support (F11 key), video settings allows for
three scale settings
- ui: fixed brightness, contrast, gamma, audio volume, input frequency
values on program startup
- ui: since Qt is dead, config file becomes bsnes.cfg once again
- Super Game Boy: you can now load the BIOS without a game inserted to
see a pretty white box
- ui-gameboy: can be built without SNES components now
- libsnes: now a UI target, compile with 'make ui=ui-libsnes'
- libsnes: added WRAM, APURAM, VRAM, OAM, CGRAM access (cheat search,
etc)
- source: removed launcher/, as the Qt port is now gone
- source: Makefile restructuring to better support new ui targets
- source: lots of other internal code cleanup work
2011-01-27 08:52:34 +00:00
|
|
|
void ICD2::unload() {
|
2012-05-09 23:35:29 +00:00
|
|
|
GameBoy::interface->bind = bind;
|
|
|
|
GameBoy::interface->hook = hook;
|
Update to v075 release.
byuu says:
This release brings improved Super Game Boy emulation, the final SHA256
hashes for the DSP-(1,1B,2,3,4) and ST-(0010,0011) coprocessors, user
interface improvements, and major internal code restructuring.
Changelog (since v074):
- completely rewrote memory sub-system to support 1-byte granularity in
XML mapping
- removed Memory inheritance and MMIO class completely, any address can
be mapped to any function now
- SuperFX: removed SuperFXBus : Bus, now implemented manually
- SA-1: removed SA1Bus : Bus, now implemented manually
- entire bus mapping is now static, happens once on cartridge load
- as a result, read/write handlers now handle MMC mapping; slower
average case, far faster worst case
- namespace memory is no more, RAM arrays are stored inside the chips
they are owned by now
- GameBoy: improved CPU HALT emulation, fixes Zelda: Link's Awakening
scrolling
- GameBoy: added serial emulation (cannot connect to another GB yet),
fixes Shin Megami Tensei - Devichil
- GameBoy: improved LCD STAT emulation, fixes Sagaia
- ui: added fullscreen support (F11 key), video settings allows for
three scale settings
- ui: fixed brightness, contrast, gamma, audio volume, input frequency
values on program startup
- ui: since Qt is dead, config file becomes bsnes.cfg once again
- Super Game Boy: you can now load the BIOS without a game inserted to
see a pretty white box
- ui-gameboy: can be built without SNES components now
- libsnes: now a UI target, compile with 'make ui=ui-libsnes'
- libsnes: added WRAM, APURAM, VRAM, OAM, CGRAM access (cheat search,
etc)
- source: removed launcher/, as the Qt port is now gone
- source: Makefile restructuring to better support new ui targets
- source: lots of other internal code cleanup work
2011-01-27 08:52:34 +00:00
|
|
|
}
|
|
|
|
|
2011-01-08 09:58:41 +00:00
|
|
|
void ICD2::power() {
|
2011-02-02 10:37:31 +00:00
|
|
|
audio.coprocessor_enable(true);
|
2013-12-11 11:19:17 +00:00
|
|
|
audio.coprocessor_frequency(2 * 1024 * 1024);
|
2011-01-08 09:58:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ICD2::reset() {
|
|
|
|
create(ICD2::Enter, cpu.frequency / 5);
|
|
|
|
|
2011-05-08 13:46:37 +00:00
|
|
|
r6000_ly = 0x00;
|
|
|
|
r6000_row = 0x00;
|
2011-01-08 09:58:41 +00:00
|
|
|
r6003 = 0x00;
|
|
|
|
r6004 = 0xff;
|
|
|
|
r6005 = 0xff;
|
|
|
|
r6006 = 0xff;
|
|
|
|
r6007 = 0xff;
|
2013-05-05 09:21:30 +00:00
|
|
|
for(auto& r : r7000) r = 0x00;
|
2011-01-08 09:58:41 +00:00
|
|
|
r7800 = 0x0000;
|
|
|
|
mlt_req = 0;
|
|
|
|
|
2013-05-05 09:21:30 +00:00
|
|
|
for(auto& n : lcd.buffer) n = 0;
|
|
|
|
for(auto& n : lcd.output) n = 0;
|
2011-05-08 13:46:37 +00:00
|
|
|
lcd.row = 0;
|
2011-01-08 09:58:41 +00:00
|
|
|
|
|
|
|
packetsize = 0;
|
|
|
|
joyp_id = 3;
|
|
|
|
joyp15lock = 0;
|
|
|
|
joyp14lock = 0;
|
|
|
|
pulselock = true;
|
|
|
|
|
2013-12-21 10:45:58 +00:00
|
|
|
GameBoy::video.generate_palette(Emulator::Interface::PaletteMode::Literal);
|
2012-04-26 10:51:13 +00:00
|
|
|
GameBoy::system.init();
|
|
|
|
GameBoy::system.power();
|
2011-01-08 09:58:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|