diff --git a/higan/GNUmakefile b/higan/GNUmakefile index f195426e..ab9565dc 100644 --- a/higan/GNUmakefile +++ b/higan/GNUmakefile @@ -1,14 +1,8 @@ include ../nall/GNUmakefile -fc := fc -sfc := sfc -gb := gb -gba := gba -ws := ws - -profile := accuracy target := tomoko # target := loki +profile := accuracy # console := true flags += -I. -I.. -O3 diff --git a/higan/emulator/emulator.hpp b/higan/emulator/emulator.hpp index 56f07a27..22629d61 100644 --- a/higan/emulator/emulator.hpp +++ b/higan/emulator/emulator.hpp @@ -6,7 +6,7 @@ using namespace nall; namespace Emulator { static const string Name = "higan"; - static const string Version = "097.18"; + static const string Version = "097.19"; static const string Author = "byuu"; static const string License = "GPLv3"; static const string Website = "http://byuu.org/"; diff --git a/higan/fc/GNUmakefile b/higan/fc/GNUmakefile index d9ad3864..1034c3cb 100644 --- a/higan/fc/GNUmakefile +++ b/higan/fc/GNUmakefile @@ -1,17 +1,16 @@ processors += r6502 -fc_objects := fc-interface fc-system fc-scheduler fc-input -fc_objects += fc-memory fc-cartridge fc-cpu fc-apu fc-ppu -fc_objects += fc-cheat -objects += $(fc_objects) +objects += fc-interface fc-system fc-scheduler fc-input +objects += fc-memory fc-cartridge fc-cpu fc-apu fc-ppu +objects += fc-cheat -obj/fc-interface.o: $(fc)/interface/interface.cpp $(call rwildcard,$(fc)/interface/) -obj/fc-system.o: $(fc)/system/system.cpp $(call rwildcard,$(fc)/system/) -obj/fc-scheduler.o: $(fc)/scheduler/scheduler.cpp $(call rwildcard,$(fc)/scheduler/) -obj/fc-input.o: $(fc)/input/input.cpp $(call rwildcard,$(fc)/input/) -obj/fc-memory.o: $(fc)/memory/memory.cpp $(call rwildcard,$(fc)/memory/) -obj/fc-cartridge.o: $(fc)/cartridge/cartridge.cpp $(call rwildcard,$(fc)/cartridge/) -obj/fc-cpu.o: $(fc)/cpu/cpu.cpp $(call rwildcard,$(fc)/cpu/) -obj/fc-apu.o: $(fc)/apu/apu.cpp $(call rwildcard,$(fc)/apu/) -obj/fc-ppu.o: $(fc)/ppu/ppu.cpp $(call rwildcard,$(fc)/ppu/) -obj/fc-cheat.o: $(fc)/cheat/cheat.cpp $(call rwildcard,$(fc)/cheat/) +obj/fc-interface.o: fc/interface/interface.cpp $(call rwildcard,fc/interface/) +obj/fc-system.o: fc/system/system.cpp $(call rwildcard,fc/system/) +obj/fc-scheduler.o: fc/scheduler/scheduler.cpp $(call rwildcard,fc/scheduler/) +obj/fc-input.o: fc/input/input.cpp $(call rwildcard,fc/input/) +obj/fc-memory.o: fc/memory/memory.cpp $(call rwildcard,fc/memory/) +obj/fc-cartridge.o: fc/cartridge/cartridge.cpp $(call rwildcard,fc/cartridge/) +obj/fc-cpu.o: fc/cpu/cpu.cpp $(call rwildcard,fc/cpu/) +obj/fc-apu.o: fc/apu/apu.cpp $(call rwildcard,fc/apu/) +obj/fc-ppu.o: fc/ppu/ppu.cpp $(call rwildcard,fc/ppu/) +obj/fc-cheat.o: fc/cheat/cheat.cpp $(call rwildcard,fc/cheat/) diff --git a/higan/fc/ppu/ppu.cpp b/higan/fc/ppu/ppu.cpp index 6bcb4915..403ecb2a 100644 --- a/higan/fc/ppu/ppu.cpp +++ b/higan/fc/ppu/ppu.cpp @@ -110,7 +110,6 @@ auto PPU::read(uint16 addr) -> uint8 { break; case 4: //OAMDATA result = oam[status.oam_addr]; - if((status.oam_addr & 3) == 3) result &= 0xe3; break; case 7: //PPUDATA if(raster_enable() && (status.ly <= 240 || status.ly == 261)) return 0x00; @@ -161,6 +160,7 @@ auto PPU::write(uint16 addr, uint8 data) -> void { status.oam_addr = data; return; case 4: //OAMDATA + if(status.oam_addr.bits(0,1) == 2) data.bits(2,4) = 0; //clear non-existent bits (always read back as 0) oam[status.oam_addr++] = data; return; case 5: //PPUSCROLL diff --git a/higan/gb/GNUmakefile b/higan/gb/GNUmakefile index 34110715..7b3ded9a 100644 --- a/higan/gb/GNUmakefile +++ b/higan/gb/GNUmakefile @@ -1,17 +1,16 @@ processors += lr35902 -gb_objects := gb-interface gb-system gb-scheduler -gb_objects += gb-memory gb-cartridge -gb_objects += gb-cpu gb-ppu gb-apu -gb_objects += gb-cheat -objects += $(gb_objects) +objects += gb-interface gb-system gb-scheduler +objects += gb-memory gb-cartridge +objects += gb-cpu gb-ppu gb-apu +objects += gb-cheat -obj/gb-interface.o: $(gb)/interface/interface.cpp $(call rwildcard,$(gb)/interface/) -obj/gb-system.o: $(gb)/system/system.cpp $(call rwildcard,$(gb)/system/) -obj/gb-scheduler.o: $(gb)/scheduler/scheduler.cpp $(call rwildcard,$(gb)/scheduler/) -obj/gb-cartridge.o: $(gb)/cartridge/cartridge.cpp $(call rwildcard,$(gb)/cartridge/) -obj/gb-memory.o: $(gb)/memory/memory.cpp $(call rwildcard,$(gb)/memory/) -obj/gb-cpu.o: $(gb)/cpu/cpu.cpp $(call rwildcard,$(gb)/cpu/) -obj/gb-ppu.o: $(gb)/ppu/ppu.cpp $(call rwildcard,$(gb)/ppu/) -obj/gb-apu.o: $(gb)/apu/apu.cpp $(call rwildcard,$(gb)/apu/) -obj/gb-cheat.o: $(gb)/cheat/cheat.cpp $(call rwildcard,$(gb)/cheat/) +obj/gb-interface.o: gb/interface/interface.cpp $(call rwildcard,gb/interface/) +obj/gb-system.o: gb/system/system.cpp $(call rwildcard,gb/system/) +obj/gb-scheduler.o: gb/scheduler/scheduler.cpp $(call rwildcard,gb/scheduler/) +obj/gb-cartridge.o: gb/cartridge/cartridge.cpp $(call rwildcard,gb/cartridge/) +obj/gb-memory.o: gb/memory/memory.cpp $(call rwildcard,gb/memory/) +obj/gb-cpu.o: gb/cpu/cpu.cpp $(call rwildcard,gb/cpu/) +obj/gb-ppu.o: gb/ppu/ppu.cpp $(call rwildcard,gb/ppu/) +obj/gb-apu.o: gb/apu/apu.cpp $(call rwildcard,gb/apu/) +obj/gb-cheat.o: gb/cheat/cheat.cpp $(call rwildcard,gb/cheat/) diff --git a/higan/gba/GNUmakefile b/higan/gba/GNUmakefile index 16b0e0e7..a47fbcd9 100644 --- a/higan/gba/GNUmakefile +++ b/higan/gba/GNUmakefile @@ -1,16 +1,15 @@ processors += arm -gba_objects := gba-memory gba-interface gba-scheduler gba-system -gba_objects += gba-cartridge gba-player -gba_objects += gba-cpu gba-ppu gba-apu -objects += $(gba_objects) +objects += gba-memory gba-interface gba-scheduler gba-system +objects += gba-cartridge gba-player +objects += gba-cpu gba-ppu gba-apu -obj/gba-memory.o: $(gba)/memory/memory.cpp $(call rwildcard,$(gba)/memory) -obj/gba-interface.o: $(gba)/interface/interface.cpp $(call rwildcard,$(gba)/interface) -obj/gba-scheduler.o: $(gba)/scheduler/scheduler.cpp $(call rwildcard,$(gba)/scheduler) -obj/gba-system.o: $(gba)/system/system.cpp $(call rwildcard,$(gba)/system) -obj/gba-cartridge.o: $(gba)/cartridge/cartridge.cpp $(call rwildcard,$(gba)/cartridge) -obj/gba-player.o: $(gba)/player/player.cpp $(call rwildcard,$(gba)/player) -obj/gba-cpu.o: $(gba)/cpu/cpu.cpp $(call rwildcard,$(gba)/cpu) -obj/gba-ppu.o: $(gba)/ppu/ppu.cpp $(call rwildcard,$(gba)/ppu) -obj/gba-apu.o: $(gba)/apu/apu.cpp $(call rwildcard,$(gba)/apu) +obj/gba-memory.o: gba/memory/memory.cpp $(call rwildcard,gba/memory) +obj/gba-interface.o: gba/interface/interface.cpp $(call rwildcard,gba/interface) +obj/gba-scheduler.o: gba/scheduler/scheduler.cpp $(call rwildcard,gba/scheduler) +obj/gba-system.o: gba/system/system.cpp $(call rwildcard,gba/system) +obj/gba-cartridge.o: gba/cartridge/cartridge.cpp $(call rwildcard,gba/cartridge) +obj/gba-player.o: gba/player/player.cpp $(call rwildcard,gba/player) +obj/gba-cpu.o: gba/cpu/cpu.cpp $(call rwildcard,gba/cpu) +obj/gba-ppu.o: gba/ppu/ppu.cpp $(call rwildcard,gba/ppu) +obj/gba-apu.o: gba/apu/apu.cpp $(call rwildcard,gba/apu) diff --git a/higan/processor/GNUmakefile b/higan/processor/GNUmakefile index 9d9a9ab7..a8cb67dd 100644 --- a/higan/processor/GNUmakefile +++ b/higan/processor/GNUmakefile @@ -1,22 +1,21 @@ -processor_objects := -processor_objects += $(if $(findstring arm,$(processors)),processor-arm) -processor_objects += $(if $(findstring gsu,$(processors)),processor-gsu) -processor_objects += $(if $(findstring hg51b,$(processors)),processor-hg51b) -processor_objects += $(if $(findstring lr35902,$(processors)),processor-lr35902) -processor_objects += $(if $(findstring r6502,$(processors)),processor-r6502) -processor_objects += $(if $(findstring r65816,$(processors)),processor-r65816) -processor_objects += $(if $(findstring spc700,$(processors)),processor-spc700) -processor_objects += $(if $(findstring upd96050,$(processors)),processor-upd96050) -processor_objects += $(if $(findstring v30mz,$(processors)),processor-v30mz) -objects += $(processor_objects) +processors := $(call unique,$(processors)) -processor := processor -obj/processor-arm.o: $(processor)/arm/arm.cpp $(call rwildcard,$(processor)/arm) -obj/processor-gsu.o: $(processor)/gsu/gsu.cpp $(call rwildcard,$(processor)/gsu) -obj/processor-hg51b.o: $(processor)/hg51b/hg51b.cpp $(call rwildcard,$(processor)/hg51b) -obj/processor-lr35902.o: $(processor)/lr35902/lr35902.cpp $(call rwildcard,$(processor)/lr35902) -obj/processor-r6502.o: $(processor)/r6502/r6502.cpp $(call rwildcard,$(processor)/r6502) -obj/processor-r65816.o: $(processor)/r65816/r65816.cpp $(call rwildcard,$(processor)/r65816) -obj/processor-spc700.o: $(processor)/spc700/spc700.cpp $(call rwildcard,$(processor)/spc700) -obj/processor-upd96050.o: $(processor)/upd96050/upd96050.cpp $(call rwildcard,$(processor)/upd96050) -obj/processor-v30mz.o: $(processor)/v30mz/v30mz.cpp $(call rwildcard,$(processor)/v30mz) +objects += $(if $(findstring arm,$(processors)),processor-arm) +objects += $(if $(findstring gsu,$(processors)),processor-gsu) +objects += $(if $(findstring hg51b,$(processors)),processor-hg51b) +objects += $(if $(findstring lr35902,$(processors)),processor-lr35902) +objects += $(if $(findstring r6502,$(processors)),processor-r6502) +objects += $(if $(findstring r65816,$(processors)),processor-r65816) +objects += $(if $(findstring spc700,$(processors)),processor-spc700) +objects += $(if $(findstring upd96050,$(processors)),processor-upd96050) +objects += $(if $(findstring v30mz,$(processors)),processor-v30mz) + +obj/processor-arm.o: processor/arm/arm.cpp $(call rwildcard,processor/arm) +obj/processor-gsu.o: processor/gsu/gsu.cpp $(call rwildcard,processor/gsu) +obj/processor-hg51b.o: processor/hg51b/hg51b.cpp $(call rwildcard,processor/hg51b) +obj/processor-lr35902.o: processor/lr35902/lr35902.cpp $(call rwildcard,processor/lr35902) +obj/processor-r6502.o: processor/r6502/r6502.cpp $(call rwildcard,processor/r6502) +obj/processor-r65816.o: processor/r65816/r65816.cpp $(call rwildcard,processor/r65816) +obj/processor-spc700.o: processor/spc700/spc700.cpp $(call rwildcard,processor/spc700) +obj/processor-upd96050.o: processor/upd96050/upd96050.cpp $(call rwildcard,processor/upd96050) +obj/processor-v30mz.o: processor/v30mz/v30mz.cpp $(call rwildcard,processor/v30mz) diff --git a/higan/sfc/GNUmakefile b/higan/sfc/GNUmakefile index b5c4488d..8adba23d 100644 --- a/higan/sfc/GNUmakefile +++ b/higan/sfc/GNUmakefile @@ -1,75 +1,74 @@ processors += r65816 spc700 arm gsu hg51b upd96050 -sfc_objects := sfc-interface sfc-system sfc-scheduler sfc-controller -sfc_objects += sfc-cartridge sfc-cheat -sfc_objects += sfc-memory sfc-cpu sfc-smp sfc-dsp sfc-ppu -sfc_objects += sfc-satellaview sfc-eboot -sfc_objects += sfc-icd2 sfc-mcc sfc-nss sfc-event -sfc_objects += sfc-sa1 sfc-superfx -sfc_objects += sfc-armdsp sfc-hitachidsp sfc-necdsp -sfc_objects += sfc-epsonrtc sfc-sharprtc -sfc_objects += sfc-spc7110 sfc-sdd1 sfc-obc1 -sfc_objects += sfc-msu1 -sfc_objects += sfc-bsmemory sfc-sufamiturbo -objects += $(sfc_objects) +objects += sfc-interface sfc-system sfc-scheduler sfc-controller +objects += sfc-cartridge sfc-cheat +objects += sfc-memory sfc-cpu sfc-smp sfc-dsp sfc-ppu +objects += sfc-satellaview sfc-eboot +objects += sfc-icd2 sfc-mcc sfc-nss sfc-event +objects += sfc-sa1 sfc-superfx +objects += sfc-armdsp sfc-hitachidsp sfc-necdsp +objects += sfc-epsonrtc sfc-sharprtc +objects += sfc-spc7110 sfc-sdd1 sfc-obc1 +objects += sfc-msu1 +objects += sfc-bsmemory sfc-sufamiturbo ifeq ($(profile),accuracy) flags += -DPROFILE_ACCURACY - sfccpu := $(sfc)/cpu - sfcsmp := $(sfc)/smp - sfcdsp := $(sfc)/dsp - sfcppu := $(sfc)/ppu + sfccpu := cpu + sfcsmp := smp + sfcdsp := dsp + sfcppu := ppu else ifeq ($(profile),balanced) flags += -DPROFILE_BALANCED - sfccpu := $(sfc)/cpu - sfcsmp := $(sfc)/smp - sfcdsp := $(sfc)/alt/dsp - sfcppu := $(sfc)/alt/ppu-balanced + sfccpu := cpu + sfcsmp := smp + sfcdsp := alt/dsp + sfcppu := alt/ppu-balanced else ifeq ($(profile),performance) flags += -DPROFILE_PERFORMANCE - sfccpu := $(sfc)/alt/cpu - sfcsmp := $(sfc)/alt/smp - sfcdsp := $(sfc)/alt/dsp - sfcppu := $(sfc)/alt/ppu-performance + sfccpu := alt/cpu + sfcsmp := alt/smp + sfcdsp := alt/dsp + sfcppu := alt/ppu-performance else - $(error unknown Super Famicom profile) + $(error "unknown Super Famicom profile") endif -obj/sfc-interface.o: $(sfc)/interface/interface.cpp $(call rwildcard,$(sfc)/interface) -obj/sfc-system.o: $(sfc)/system/system.cpp $(call rwildcard,$(sfc)/system/) -obj/sfc-scheduler.o: $(sfc)/scheduler/scheduler.cpp $(call rwildcard,$(sfc)/scheduler/) -obj/sfc-controller.o: $(sfc)/controller/controller.cpp $(call rwildcard,$(sfc)/controller/) -obj/sfc-cartridge.o: $(sfc)/cartridge/cartridge.cpp $(call rwildcard,$(sfc)/cartridge/) -obj/sfc-cheat.o: $(sfc)/cheat/cheat.cpp $(call rwildcard,$(sfc)/cheat/) -obj/sfc-memory.o: $(sfc)/memory/memory.cpp $(call rwildcard,$(sfc)/memory/) -obj/sfc-cpu.o: $(sfccpu)/cpu.cpp $(call rwildcard,$(sfccpu)/) -obj/sfc-smp.o: $(sfcsmp)/smp.cpp $(call rwildcard,$(sfcsmp)/) -obj/sfc-dsp.o: $(sfcdsp)/dsp.cpp $(call rwildcard,$(sfcdsp)/) -obj/sfc-ppu.o: $(sfcppu)/ppu.cpp $(call rwildcard,$(sfcppu)/) +obj/sfc-interface.o: sfc/interface/interface.cpp $(call rwildcard,sfc/interface) +obj/sfc-system.o: sfc/system/system.cpp $(call rwildcard,sfc/system/) +obj/sfc-scheduler.o: sfc/scheduler/scheduler.cpp $(call rwildcard,sfc/scheduler/) +obj/sfc-controller.o: sfc/controller/controller.cpp $(call rwildcard,sfc/controller/) +obj/sfc-cartridge.o: sfc/cartridge/cartridge.cpp $(call rwildcard,sfc/cartridge/) +obj/sfc-cheat.o: sfc/cheat/cheat.cpp $(call rwildcard,sfc/cheat/) +obj/sfc-memory.o: sfc/memory/memory.cpp $(call rwildcard,sfc/memory/) +obj/sfc-cpu.o: sfc/$(sfccpu)/cpu.cpp $(call rwildcard,sfc/$(sfccpu)/) +obj/sfc-smp.o: sfc/$(sfcsmp)/smp.cpp $(call rwildcard,sfc/$(sfcsmp)/) +obj/sfc-dsp.o: sfc/$(sfcdsp)/dsp.cpp $(call rwildcard,sfc/$(sfcdsp)/) +obj/sfc-ppu.o: sfc/$(sfcppu)/ppu.cpp $(call rwildcard,sfc/$(sfcppu)/) -obj/sfc-satellaview.o: $(sfc)/expansion/satellaview/satellaview.cpp $(call rwildcard,$(sfc)/expansion/satellaview/) -obj/sfc-eboot.o: $(sfc)/expansion/eboot/eboot.cpp $(call rwildcard,$(sfc)/expansion/eboot/) +obj/sfc-satellaview.o: sfc/expansion/satellaview/satellaview.cpp $(call rwildcard,sfc/expansion/satellaview/) +obj/sfc-eboot.o: sfc/expansion/eboot/eboot.cpp $(call rwildcard,sfc/expansion/eboot/) -obj/sfc-icd2.o: $(sfc)/coprocessor/icd2/icd2.cpp $(call rwildcard,$(sfc)/coprocessor/icd2/) -obj/sfc-mcc.o: $(sfc)/coprocessor/mcc/mcc.cpp $(call rwildcard,$(sfc)/coprocessor/mcc/) -obj/sfc-nss.o: $(sfc)/coprocessor/nss/nss.cpp $(call rwildcard,$(sfc)/coprocessor/nss/) -obj/sfc-event.o: $(sfc)/coprocessor/event/event.cpp $(call rwildcard,$(sfc)/coprocessor/event/) +obj/sfc-icd2.o: sfc/coprocessor/icd2/icd2.cpp $(call rwildcard,sfc/coprocessor/icd2/) +obj/sfc-mcc.o: sfc/coprocessor/mcc/mcc.cpp $(call rwildcard,sfc/coprocessor/mcc/) +obj/sfc-nss.o: sfc/coprocessor/nss/nss.cpp $(call rwildcard,sfc/coprocessor/nss/) +obj/sfc-event.o: sfc/coprocessor/event/event.cpp $(call rwildcard,sfc/coprocessor/event/) -obj/sfc-sa1.o: $(sfc)/coprocessor/sa1/sa1.cpp $(call rwildcard,$(sfc)/coprocessor/sa1/) -obj/sfc-superfx.o: $(sfc)/coprocessor/superfx/superfx.cpp $(call rwildcard,$(sfc)/coprocessor/superfx/) +obj/sfc-sa1.o: sfc/coprocessor/sa1/sa1.cpp $(call rwildcard,sfc/coprocessor/sa1/) +obj/sfc-superfx.o: sfc/coprocessor/superfx/superfx.cpp $(call rwildcard,sfc/coprocessor/superfx/) -obj/sfc-armdsp.o: $(sfc)/coprocessor/armdsp/armdsp.cpp $(call rwildcard,$(sfc)/coprocessor/armdsp/) -obj/sfc-hitachidsp.o: $(sfc)/coprocessor/hitachidsp/hitachidsp.cpp $(call rwildcard,$(sfc)/coprocessor/hitachidsp/) -obj/sfc-necdsp.o: $(sfc)/coprocessor/necdsp/necdsp.cpp $(call rwildcard,$(sfc)/coprocessor/necdsp/) +obj/sfc-armdsp.o: sfc/coprocessor/armdsp/armdsp.cpp $(call rwildcard,sfc/coprocessor/armdsp/) +obj/sfc-hitachidsp.o: sfc/coprocessor/hitachidsp/hitachidsp.cpp $(call rwildcard,sfc/coprocessor/hitachidsp/) +obj/sfc-necdsp.o: sfc/coprocessor/necdsp/necdsp.cpp $(call rwildcard,sfc/coprocessor/necdsp/) -obj/sfc-epsonrtc.o: $(sfc)/coprocessor/epsonrtc/epsonrtc.cpp $(call rwildcard,$(sfc)/coprocessor/epsonrtc/) -obj/sfc-sharprtc.o: $(sfc)/coprocessor/sharprtc/sharprtc.cpp $(call rwildcard,$(sfc)/coprocessor/sharprtc/) +obj/sfc-epsonrtc.o: sfc/coprocessor/epsonrtc/epsonrtc.cpp $(call rwildcard,sfc/coprocessor/epsonrtc/) +obj/sfc-sharprtc.o: sfc/coprocessor/sharprtc/sharprtc.cpp $(call rwildcard,sfc/coprocessor/sharprtc/) -obj/sfc-spc7110.o: $(sfc)/coprocessor/spc7110/spc7110.cpp $(call rwildcard,$(sfc)/coprocessor/spc7110/) -obj/sfc-sdd1.o: $(sfc)/coprocessor/sdd1/sdd1.cpp $(call rwildcard,$(sfc)/coprocessor/sdd1/) -obj/sfc-obc1.o: $(sfc)/coprocessor/obc1/obc1.cpp $(call rwildcard,$(sfc)/coprocessor/obc1/) +obj/sfc-spc7110.o: sfc/coprocessor/spc7110/spc7110.cpp $(call rwildcard,sfc/coprocessor/spc7110/) +obj/sfc-sdd1.o: sfc/coprocessor/sdd1/sdd1.cpp $(call rwildcard,sfc/coprocessor/sdd1/) +obj/sfc-obc1.o: sfc/coprocessor/obc1/obc1.cpp $(call rwildcard,sfc/coprocessor/obc1/) -obj/sfc-msu1.o: $(sfc)/coprocessor/msu1/msu1.cpp $(call rwildcard,$(sfc)/coprocessor/msu1/) +obj/sfc-msu1.o: sfc/coprocessor/msu1/msu1.cpp $(call rwildcard,sfc/coprocessor/msu1/) -obj/sfc-bsmemory.o: $(sfc)/slot/bsmemory/bsmemory.cpp $(call rwildcard,$(sfc)/slot/bsmemory/) -obj/sfc-sufamiturbo.o: $(sfc)/slot/sufamiturbo/sufamiturbo.cpp $(call rwildcard,$(sfc)/slot/sufamiturbo/) +obj/sfc-bsmemory.o: sfc/slot/bsmemory/bsmemory.cpp $(call rwildcard,sfc/slot/bsmemory/) +obj/sfc-sufamiturbo.o: sfc/slot/sufamiturbo/sufamiturbo.cpp $(call rwildcard,sfc/slot/sufamiturbo/) diff --git a/higan/sfc/system/device.hpp b/higan/sfc/system/device.hpp index c5a51280..965353e2 100644 --- a/higan/sfc/system/device.hpp +++ b/higan/sfc/system/device.hpp @@ -1,4 +1,10 @@ struct Device { + enum class Port : uint { + Controller1, + Controller2, + Expansion, + }; + enum class ID : uint { None, diff --git a/higan/target-loki/GNUmakefile b/higan/target-loki/GNUmakefile index 72c94d56..9325234b 100644 --- a/higan/target-loki/GNUmakefile +++ b/higan/target-loki/GNUmakefile @@ -1,4 +1,5 @@ name := loki +flags += -DDEBUGGER include sfc/GNUmakefile include processor/GNUmakefile diff --git a/higan/target-loki/program/interface.cpp b/higan/target-loki/program/interface.cpp new file mode 100644 index 00000000..9e4e9820 --- /dev/null +++ b/higan/target-loki/program/interface.cpp @@ -0,0 +1,125 @@ +auto Program::loadRequest(uint id, string name, string type, bool required) -> void { + string location = BrowserDialog() + .setTitle({"Load ", name}) + .setPath({userpath(), "Emulation/", name}) + .setFilters({string{name, "|*.", type}}) + .openFolder(); + if(!directory::exists(location)) return; + + mediaPaths(id) = location; + folderPaths.append(location); + emulator->load(id); +} + +auto Program::loadRequest(uint id, string filename, bool required) -> void { + string pathname = mediaPaths(emulator->group(id)); + string location = {pathname, filename}; + + if(filename == "manifest.bml" && pathname && !pathname.endsWith("sys/")) { + if(!file::exists(location)) { + if(auto manifest = execute("icarus", "--manifest", pathname)) { + memorystream stream{(const uint8_t*)manifest.data(), manifest.size()}; + return emulator->load(id, stream); + } + } + } + + if(file::exists(location)) { + mmapstream stream{location}; + return emulator->load(id, stream); + } + + if(required) MessageDialog().setTitle("loki").setText({ + "Missing required file: ", nall::filename(location), "\n\n", + "From location:\n", nall::pathname(location) + }).error(); +} + +auto Program::saveRequest(uint id, string filename) -> void { + string pathname = mediaPaths(emulator->group(id)); + string location = {pathname, filename}; + +//filestream stream{location, file::mode::write}; +//return emulator->save(id, stream); +} + +auto Program::videoRefresh(const uint32* data, uint pitch, uint width, uint height) -> void { + uint32_t* output; + uint length; + + if(video->lock(output, length, width, height)) { + pitch >>= 2, length >>= 2; + + for(auto y : range(height)) { + memory::copy(output + y * length, data + y * pitch, width * sizeof(uint32)); + } + + video->unlock(); + video->refresh(); + } +} + +auto Program::audioSample(int16 left, int16 right) -> void { + int samples[] = {left, right}; + dsp.sample(samples); + while(dsp.pending()) { + dsp.read(samples); + audio->sample(samples[0], samples[1]); + } +} + +auto Program::inputPoll(uint port, uint device, uint input) -> int16 { + if(!presentation->focused()) return 0; + + shared_pointer keyboard; + for(auto& device : devices) { + if(device->isKeyboard()) { + keyboard = device; + break; + } + } + + if(port == (uint)SFC::Device::Port::Controller1) { + if(device == (uint)SFC::Device::ID::Gamepad) { + #define map(id, name) \ + case id: \ + if(auto code = keyboard->buttons().find(name)) { \ + return keyboard->buttons().input(*code).value(); \ + } \ + break; \ + + switch(input) { + map(SFC::Gamepad::Up, "Up"); + map(SFC::Gamepad::Down, "Down"); + map(SFC::Gamepad::Left, "Left"); + map(SFC::Gamepad::Right, "Right"); + map(SFC::Gamepad::B, "Z"); + map(SFC::Gamepad::A, "X"); + map(SFC::Gamepad::Y, "A"); + map(SFC::Gamepad::X, "S"); + map(SFC::Gamepad::L, "D"); + map(SFC::Gamepad::R, "C"); + map(SFC::Gamepad::Select, "Apostrophe"); + map(SFC::Gamepad::Start, "Return"); + } + + #undef map + } + } + + return 0; +} + +auto Program::inputRumble(uint port, uint device, uint input, bool enable) -> void { +} + +auto Program::dipSettings(const Markup::Node& node) -> uint { + return 0; +} + +auto Program::path(uint group) -> string { + return mediaPaths(group); +} + +auto Program::notify(string text) -> void { +} diff --git a/higan/target-loki/program/media.cpp b/higan/target-loki/program/media.cpp new file mode 100644 index 00000000..a9f0ef59 --- /dev/null +++ b/higan/target-loki/program/media.cpp @@ -0,0 +1,49 @@ +auto Program::loadMedia(string location) -> void { + location.transform("\\", "/"); + if(!location.endsWith("/")) location.append("/"); + if(!directory::exists(location)) return; + + string type = suffixname(location).ltrim(".", 1L); + for(auto& media : emulator->media) { + if(!media.bootable) continue; + if(media.type != type) continue; + return loadMedia(media, location); + } +} + +auto Program::loadMedia(Emulator::Interface::Media& media, string location) -> void { + unloadMedia(); + + mediaPaths(0) = locate({media.name, ".sys/"}); + mediaPaths(media.id) = location; + folderPaths.append(location); + + emulator->set("Blur Emulation", false); + emulator->set("Color Emulation", false); + emulator->set("Scanline Emulation", false); + + emulator->connect((uint)SFC::Device::Port::Controller1, (uint)SFC::Device::ID::Gamepad); + emulator->connect((uint)SFC::Device::Port::Controller2, (uint)SFC::Device::ID::None); + emulator->connect((uint)SFC::Device::Port::Expansion, (uint)SFC::Device::ID::None); + + emulator->load(media.id); + emulator->power(); + + dsp.setResampler(DSP::ResampleEngine::Sinc); + dsp.setResamplerFrequency(96000.0); + double inputRatio = emulator->audioFrequency() / emulator->videoFrequency(); + double outputRatio = 96000.0 / 60.0; + dsp.setFrequency(inputRatio / outputRatio * 96000.0); + + presentation->setTitle(emulator->title()); +} + +auto Program::unloadMedia() -> void { + if(!emulator->loaded()) return; + + emulator->unload(); + mediaPaths.reset(); + folderPaths.reset(); + + presentation->setTitle(""); +} diff --git a/higan/target-loki/program/program.cpp b/higan/target-loki/program/program.cpp index 7b828b6e..919c8168 100644 --- a/higan/target-loki/program/program.cpp +++ b/higan/target-loki/program/program.cpp @@ -1,4 +1,6 @@ #include "../loki.hpp" +#include "interface.cpp" +#include "media.cpp" unique_pointer program; Program::Program(lstring args) { @@ -29,15 +31,28 @@ Program::Program(lstring args) { if(!input->init()) input = Input::create("None"); presentation->drawSplashScreen(); -} -auto Program::load(string location) -> void { + string location = args(1, ""); + if(!directory::exists(location)) location = { //quick testing hack + userpath(), "Emulation/Super Famicom/", + "Legend of Zelda - A Link to the Past, The (USA) (1.0).sfc/" + }; + + if(directory::exists(location)) loadMedia(location); } auto Program::main() -> void { + if(!emulator->loaded()) { + usleep(20 * 1000); + return; + } + + devices = input->poll(); + emulator->run(); } auto Program::quit() -> void { + unloadMedia(); video.reset(); audio.reset(); input.reset(); diff --git a/higan/target-loki/program/program.hpp b/higan/target-loki/program/program.hpp index df79039e..9f175160 100644 --- a/higan/target-loki/program/program.hpp +++ b/higan/target-loki/program/program.hpp @@ -1,21 +1,30 @@ struct Program : Emulator::Interface::Bind { //program.cpp Program(lstring args); - auto load(string) -> void; auto main() -> void; auto quit() -> void; + //media.cpp + auto loadMedia(string location) -> void; + auto loadMedia(Emulator::Interface::Media& media, string location) -> void; + auto unloadMedia() -> void; + //interface.cpp - auto loadRequest(uint id, string name, string type, bool required) -> void override {} - auto loadRequest(uint id, string path, bool required) -> void override {} - auto saveRequest(uint id, string path) -> void override {} - auto videoRefresh(const uint32* data, uint pitch, uint width, uint height) -> void override {} - auto audioSample(int16 lsample, int16 rsample) -> void override {} - auto inputPoll(uint port, uint device, uint input) -> int16 override { return 0; } - auto inputRumble(uint port, uint device, uint input, bool enable) -> void override {} - auto dipSettings(const Markup::Node& node) -> uint override { return 0; } - auto path(uint group) -> string override { return ""; } - auto notify(string text) -> void override {} + auto loadRequest(uint id, string name, string type, bool required) -> void override; + auto loadRequest(uint id, string path, bool required) -> void override; + auto saveRequest(uint id, string path) -> void override; + auto videoRefresh(const uint32* data, uint pitch, uint width, uint height) -> void override; + auto audioSample(int16 left, int16 right) -> void override; + auto inputPoll(uint port, uint device, uint input) -> int16 override; + auto inputRumble(uint port, uint device, uint input, bool enable) -> void override; + auto dipSettings(const Markup::Node& node) -> uint override; + auto path(uint group) -> string override; + auto notify(string text) -> void override; + + DSP dsp; + vector> devices; + vector mediaPaths; + vector folderPaths; }; extern unique_pointer program; diff --git a/higan/target-loki/terminal/about-window.cpp b/higan/target-loki/terminal/about-window.cpp index 21d87078..d1c9430f 100644 --- a/higan/target-loki/terminal/about-window.cpp +++ b/higan/target-loki/terminal/about-window.cpp @@ -6,7 +6,7 @@ AboutWindow::AboutWindow() { layout.setMargin(5); canvas.setIcon({locate("loki.png")}); information.setFont(Font().setFamily(Font::Sans).setBold()).setAlignment(0.5).setText({ - "loki v", Emulator::Version, "\n\n" + Emulator::Name, "/loki v", Emulator::Version, "\n\n" "Author: ", Emulator::Author, "\n", "License: ", Emulator::License, "\n", "Website: ", Emulator::Website diff --git a/higan/target-tomoko/GNUmakefile b/higan/target-tomoko/GNUmakefile index 1a000fbe..1f75697c 100644 --- a/higan/target-tomoko/GNUmakefile +++ b/higan/target-tomoko/GNUmakefile @@ -6,8 +6,6 @@ include sfc/GNUmakefile include gb/GNUmakefile include gba/GNUmakefile include ws/GNUmakefile - -processors := $(call unique,$(processors)) include processor/GNUmakefile include emulator/GNUmakefile diff --git a/higan/target-tomoko/presentation/presentation.cpp b/higan/target-tomoko/presentation/presentation.cpp index d0831673..c549218c 100644 --- a/higan/target-tomoko/presentation/presentation.cpp +++ b/higan/target-tomoko/presentation/presentation.cpp @@ -131,7 +131,7 @@ Presentation::Presentation() { }); about.setText("About ...").onActivate([&] { MessageDialog().setParent(*this).setTitle("About higan ...").setText({ - Emulator::Name, " v", Emulator::Version, " (", Emulator::Profile, ")\n\n", + Emulator::Name, "/tomoko v", Emulator::Version, " (", Emulator::Profile, ")\n\n", "Author: ", Emulator::Author, "\n", "License: ", Emulator::License, "\n", "Website: ", Emulator::Website diff --git a/higan/target-tomoko/program/interface.cpp b/higan/target-tomoko/program/interface.cpp index 488e1e26..248d9c6b 100644 --- a/higan/target-tomoko/program/interface.cpp +++ b/higan/target-tomoko/program/interface.cpp @@ -3,7 +3,7 @@ auto Program::loadRequest(uint id, string name, string type, bool required) -> v string location = BrowserDialog() .setTitle({"Load ", name}) .setPath({settings["Library/Location"].text(), name}) - .setFilters({string{name, "|*.", type}}) + .setFilters({string{name, "|*.", type}, "All|*.*"}) .openFolder(); if(!directory::exists(location)) return; @@ -17,7 +17,7 @@ auto Program::loadRequest(uint id, string filename, bool required) -> void { string pathname = mediaPaths(emulator->group(id)); string location = {pathname, filename}; - if(filename == "manifest.bml" && pathname && !pathname.find(".sys/")) { + if(filename == "manifest.bml" && pathname && !pathname.endsWith(".sys/")) { if(!file::exists(location) || settings["Library/IgnoreManifests"].boolean()) { if(auto manifest = execute("icarus", "--manifest", pathname)) { memorystream stream{(const uint8_t*)manifest.data(), manifest.size()}; @@ -41,6 +41,7 @@ auto Program::loadRequest(uint id, string filename, bool required) -> void { auto Program::saveRequest(uint id, string filename) -> void { string pathname = mediaPaths(emulator->group(id)); string location = {pathname, filename}; + filestream stream{location, file::mode::write}; return emulator->save(id, stream); } @@ -114,6 +115,7 @@ auto Program::inputRumble(uint port, uint device, uint input, bool enable) -> vo } auto Program::dipSettings(const Markup::Node& node) -> uint { + return 0; } auto Program::path(uint group) -> string { diff --git a/higan/target-tomoko/program/media.cpp b/higan/target-tomoko/program/media.cpp index 7db8af2c..578070e3 100644 --- a/higan/target-tomoko/program/media.cpp +++ b/higan/target-tomoko/program/media.cpp @@ -13,7 +13,7 @@ auto Program::loadMedia(string location) -> void { } } -auto Program::loadMedia(Emulator::Interface& interface, Emulator::Interface::Media& media, const string& location) -> void { +auto Program::loadMedia(Emulator::Interface& interface, Emulator::Interface::Media& media, string location) -> void { unloadMedia(); mediaPaths(0) = locate({media.name, ".sys/"}); diff --git a/higan/target-tomoko/program/program.hpp b/higan/target-tomoko/program/program.hpp index 4248286c..6dc3e04e 100644 --- a/higan/target-tomoko/program/program.hpp +++ b/higan/target-tomoko/program/program.hpp @@ -19,7 +19,7 @@ struct Program : Emulator::Interface::Bind { //media.cpp auto loadMedia(string location) -> void; - auto loadMedia(Emulator::Interface& interface, Emulator::Interface::Media& media, const string& location) -> void; + auto loadMedia(Emulator::Interface& interface, Emulator::Interface::Media& media, string location) -> void; auto unloadMedia() -> void; //state.cpp diff --git a/higan/ws/GNUmakefile b/higan/ws/GNUmakefile index 83bc970f..cd3e50d4 100644 --- a/higan/ws/GNUmakefile +++ b/higan/ws/GNUmakefile @@ -1,16 +1,15 @@ processors += v30mz -ws_objects := ws-interface ws-system ws-scheduler -ws_objects += ws-memory ws-eeprom ws-cartridge -ws_objects += ws-cpu ws-ppu ws-apu -objects += $(ws_objects) +objects += ws-interface ws-system ws-scheduler +objects += ws-memory ws-eeprom ws-cartridge +objects += ws-cpu ws-ppu ws-apu -obj/ws-interface.o: $(ws)/interface/interface.cpp $(call rwildcard,$(ws)/interface/) -obj/ws-system.o: $(ws)/system/system.cpp $(call rwildcard,$(ws)/system/) -obj/ws-scheduler.o: $(ws)/scheduler/scheduler.cpp $(call rwildcard,$(ws)/scheduler/) -obj/ws-memory.o: $(ws)/memory/memory.cpp $(call rwildcard,$(ws)/memory/) -obj/ws-eeprom.o: $(ws)/eeprom/eeprom.cpp $(call rwildcard,$(ws)/eeprom/) -obj/ws-cartridge.o: $(ws)/cartridge/cartridge.cpp $(call rwildcard,$(ws)/cartridge/) -obj/ws-cpu.o: $(ws)/cpu/cpu.cpp $(call rwildcard,$(ws)/cpu/) -obj/ws-ppu.o: $(ws)/ppu/ppu.cpp $(call rwildcard,$(ws)/ppu/) -obj/ws-apu.o: $(ws)/apu/apu.cpp $(call rwildcard,$(ws)/apu/) +obj/ws-interface.o: ws/interface/interface.cpp $(call rwildcard,ws/interface/) +obj/ws-system.o: ws/system/system.cpp $(call rwildcard,ws/system/) +obj/ws-scheduler.o: ws/scheduler/scheduler.cpp $(call rwildcard,ws/scheduler/) +obj/ws-memory.o: ws/memory/memory.cpp $(call rwildcard,ws/memory/) +obj/ws-eeprom.o: ws/eeprom/eeprom.cpp $(call rwildcard,ws/eeprom/) +obj/ws-cartridge.o: ws/cartridge/cartridge.cpp $(call rwildcard,ws/cartridge/) +obj/ws-cpu.o: ws/cpu/cpu.cpp $(call rwildcard,ws/cpu/) +obj/ws-ppu.o: ws/ppu/ppu.cpp $(call rwildcard,ws/ppu/) +obj/ws-apu.o: ws/apu/apu.cpp $(call rwildcard,ws/apu/) diff --git a/hiro/gtk/header.hpp b/hiro/gtk/header.hpp index 30ec860b..7b1002b5 100644 --- a/hiro/gtk/header.hpp +++ b/hiro/gtk/header.hpp @@ -7,6 +7,7 @@ #define NOMINMAX #define TBS_TRANSPARENTBKGND 0x1000 + #include #include #include #include @@ -24,6 +25,7 @@ #include #include #endif + #include #include #include #endif diff --git a/hiro/windows/header.hpp b/hiro/windows/header.hpp index 239ff14f..a555e271 100644 --- a/hiro/windows/header.hpp +++ b/hiro/windows/header.hpp @@ -13,9 +13,9 @@ #include #include #include +#include #include #include -#include //MinGW/32-bit has painfully outdated platform headers ... diff --git a/nall/windows/guard.hpp b/nall/windows/guard.hpp index 4f88a74f..60c9269f 100644 --- a/nall/windows/guard.hpp +++ b/nall/windows/guard.hpp @@ -2,7 +2,7 @@ #define NALL_WINDOWS_GUARD_HPP #define boolean WindowsBoolean -#define interface WindowsBoolean +#define interface WindowsInterface #else #undef NALL_WINDOWS_GUARD_HPP