Update to v093r09 release.

byuu says:

Changelog:
- GB/C OAM DMA now runs in parallel with the CPU
- CPU can only access HRAM during OAM DMA
- fixed SGB mode again
- brand new config files will default to the optimal drivers now
  (OpenGL, etc) instead of the safest
- hopefully fixed remaining Windows UI issues
This commit is contained in:
Tim Allen 2013-12-14 17:25:12 +11:00
parent 1361820dd8
commit 926a39d701
11 changed files with 43 additions and 15 deletions

View File

@ -3,7 +3,7 @@
namespace Emulator {
static const char Name[] = "higan";
static const char Version[] = "093.08";
static const char Version[] = "093.09";
static const char Author[] = "byuu";
static const char License[] = "GPLv3";
static const char Website[] = "http://byuu.org/";

View File

@ -200,6 +200,10 @@ void CPU::power() {
status.interrupt_enable_timer = 0;
status.interrupt_enable_stat = 0;
status.interrupt_enable_vblank = 0;
oamdma.active = false;
oamdma.bank = 0;
oamdma.offset = 0;
}
}

View File

@ -79,6 +79,12 @@ struct CPU : Processor::LR35902, Thread, MMIO {
bool interrupt_enable_vblank;
} status;
struct OAMDMA {
bool active;
uint8 bank;
uint8 offset;
} oamdma;
uint8 wram[32768]; //GB=8192, GBC=32768
uint8 hram[128];

View File

@ -7,15 +7,16 @@ void CPU::op_io() {
uint8 CPU::op_read(uint16 addr) {
cycle_edge();
uint8 r = bus.read(addr);
add_clocks(4);
return r;
if(oamdma.active) return hram[addr & 0x7f];
return bus.read(addr);
}
void CPU::op_write(uint16 addr, uint8 data) {
cycle_edge();
bus.write(addr, data);
add_clocks(4);
if(oamdma.active) hram[addr & 0x7f] = data;
else bus.write(addr, data);
}
void CPU::cycle_edge() {

View File

@ -186,10 +186,9 @@ void CPU::mmio_write(uint16 addr, uint8 data) {
}
if(addr == 0xff46) { //DMA
for(unsigned n = 0x00; n <= 0x9f; n++) {
bus.write(0xfe00 + n, bus.read((data << 8) + n));
add_clocks(4);
}
oamdma.active = true;
oamdma.bank = data;
oamdma.offset = 0;
return;
}

View File

@ -55,6 +55,10 @@ void CPU::serialize(serializer& s) {
s.integer(status.interrupt_enable_timer);
s.integer(status.interrupt_enable_stat);
s.integer(status.interrupt_enable_vblank);
s.integer(oamdma.active);
s.integer(oamdma.bank);
s.integer(oamdma.offset);
}
#endif

View File

@ -5,6 +5,16 @@
#ifdef CPU_CPP
void CPU::add_clocks(unsigned clocks) {
if(oamdma.active) {
for(unsigned n = 0; n < clocks; n++) {
bus.write(0xfe00 + oamdma.offset, bus.read((oamdma.bank << 8) + oamdma.offset));
if(++oamdma.offset == 160) {
oamdma.active = false;
break;
}
}
}
system.clocks_executed += clocks;
if(system.sgb()) scheduler.exit(Scheduler::ExitReason::StepEvent);

View File

@ -66,6 +66,7 @@ void PPU::scanline() {
if(++status.ly == 154) frame();
if(status.ly < 144) {
interface->lcdScanline(); //Super Game Boy rendering notification
system.cgb() ? cgb_scanline() : dmg_scanline();
}
@ -80,8 +81,6 @@ void PPU::scanline() {
}
void PPU::frame() {
cpu.mmio_joyp_poll();
status.ly = 0;
scheduler.exit(Scheduler::ExitReason::FrameEvent);
}

View File

@ -1491,6 +1491,8 @@ void ListView::remove(unsigned selection) {
void ListView::reset() {
state.checked.reset();
state.image.reset();
state.selected = false;
state.selection = 0;
state.text.reset();
return p.reset();
}

View File

@ -2,7 +2,7 @@
ConfigurationSettings* config = nullptr;
ConfigurationSettings::ConfigurationSettings() {
video.append(video.driver = ruby::video.safestDriver(), "Driver");
video.append(video.driver = ruby::video.optimalDriver(), "Driver");
video.append(video.synchronize = false, "Synchronize");
video.append(video.shader = "Blur", "Shader");
video.append(video.scaleMode = 0, "ScaleMode");
@ -18,7 +18,7 @@ ConfigurationSettings::ConfigurationSettings() {
video.append(video.startFullScreen = false, "StartFullScreen");
append(video, "Video");
audio.append(audio.driver = ruby::audio.safestDriver(), "Driver");
audio.append(audio.driver = ruby::audio.optimalDriver(), "Driver");
audio.append(audio.synchronize = true, "Synchronize");
audio.append(audio.frequency = 48000, "Frequency");
audio.append(audio.latency = 60, "Latency");
@ -27,7 +27,7 @@ ConfigurationSettings::ConfigurationSettings() {
audio.append(audio.mute = false, "Mute");
append(audio, "Audio");
input.append(input.driver = ruby::input.safestDriver(), "Driver");
input.append(input.driver = ruby::input.optimalDriver(), "Driver");
input.focus.append(input.focus.pause = false, "Pause");
input.focus.append(input.focus.allow = false, "AllowInput");
input.append(input.focus, "Focus");

View File

@ -203,7 +203,7 @@ string LibraryManager::load(const string& type) {
show();
setModal();
slotLoad = false;
browser->mediaMode.setSelection(0);
browser->mediaMode.setSelection(config->library.mediaMode = 0);
return loadPathname;
}
mode++;
@ -287,7 +287,10 @@ void LibraryManager::synchronize() {
if(requestedLoadType.empty()) {
loadButton.setEnabled(media.bootable);
} else {
loadButton.setEnabled(requestedLoadType == media.type);
bool enabled = (requestedLoadType == media.type);
//allow Super Game Boy to load Game Boy Color games
if(requestedLoadType == "gb" && loaded.size() == 1 && media.type == "gbc") enabled = true;
loadButton.setEnabled(enabled);
}
} else {
loadButton.setEnabled(false);