diff --git a/output64/dll/libsnes.wbx.gz b/output64/dll/libsnes.wbx.gz index 426e220108..c0df4febe1 100644 Binary files a/output64/dll/libsnes.wbx.gz and b/output64/dll/libsnes.wbx.gz differ diff --git a/waterbox/libsnes/bsnes/snes/alt/cpu/cpu.cpp b/waterbox/libsnes/bsnes/snes/alt/cpu/cpu.cpp index bd14d2b030..585de807ee 100644 --- a/waterbox/libsnes/bsnes/snes/alt/cpu/cpu.cpp +++ b/waterbox/libsnes/bsnes/snes/alt/cpu/cpu.cpp @@ -113,7 +113,7 @@ void CPU::power() { } void CPU::reset() { - create(Enter, system.cpu_frequency()); + create(Enter, system.cpu_frequency(), 16384); coprocessors.reset(); PPUcounter::reset(); diff --git a/waterbox/libsnes/bsnes/snes/alt/ppu-compatibility/ppu.cpp b/waterbox/libsnes/bsnes/snes/alt/ppu-compatibility/ppu.cpp index 3dae68bff2..46b21a9d54 100644 --- a/waterbox/libsnes/bsnes/snes/alt/ppu-compatibility/ppu.cpp +++ b/waterbox/libsnes/bsnes/snes/alt/ppu-compatibility/ppu.cpp @@ -345,7 +345,7 @@ void PPU::power() { } void PPU::reset() { - create(Enter, system.cpu_frequency()); + create(Enter, system.cpu_frequency(), 32768); PPUcounter::reset(); memset(surface, 0, 512 * 512 * sizeof(uint32)); diff --git a/waterbox/libsnes/bsnes/snes/chip/armdsp/armdsp.cpp b/waterbox/libsnes/bsnes/snes/chip/armdsp/armdsp.cpp index c9efd458de..344829ca2f 100644 --- a/waterbox/libsnes/bsnes/snes/chip/armdsp/armdsp.cpp +++ b/waterbox/libsnes/bsnes/snes/chip/armdsp/armdsp.cpp @@ -155,7 +155,7 @@ void ArmDSP::reset() { } void ArmDSP::arm_reset() { - create(ArmDSP::Enter, 21477272); + create(ArmDSP::Enter, 21477272, 8192); bridge.ready = false; bridge.timer = 0; diff --git a/waterbox/libsnes/bsnes/snes/chip/hitachidsp/hitachidsp.cpp b/waterbox/libsnes/bsnes/snes/chip/hitachidsp/hitachidsp.cpp index 109f82d6cc..235d08f1a6 100644 --- a/waterbox/libsnes/bsnes/snes/chip/hitachidsp/hitachidsp.cpp +++ b/waterbox/libsnes/bsnes/snes/chip/hitachidsp/hitachidsp.cpp @@ -58,7 +58,7 @@ void HitachiDSP::power() { } void HitachiDSP::reset() { - create(HitachiDSP::Enter, frequency); + create(HitachiDSP::Enter, frequency, 8192); state = State::Idle; regs.n = 0; diff --git a/waterbox/libsnes/bsnes/snes/chip/icd2/icd2.cpp b/waterbox/libsnes/bsnes/snes/chip/icd2/icd2.cpp index a740efeba9..bd2828e5dd 100644 --- a/waterbox/libsnes/bsnes/snes/chip/icd2/icd2.cpp +++ b/waterbox/libsnes/bsnes/snes/chip/icd2/icd2.cpp @@ -45,7 +45,7 @@ void ICD2::power() { } void ICD2::reset() { - create(ICD2::Enter, cpu.frequency / 5); + create(ICD2::Enter, cpu.frequency / 5, 16384); r6000_ly = 0x00; r6000_row = 0x00; diff --git a/waterbox/libsnes/bsnes/snes/chip/link/link.cpp b/waterbox/libsnes/bsnes/snes/chip/link/link.cpp index 0df610d995..da50e519c1 100644 --- a/waterbox/libsnes/bsnes/snes/chip/link/link.cpp +++ b/waterbox/libsnes/bsnes/snes/chip/link/link.cpp @@ -44,7 +44,7 @@ void Link::power() { void Link::reset() { if(link_reset) link_reset(); - create(Link::Enter, frequency); + create(Link::Enter, frequency, 8192); } uint8 Link::read(unsigned addr) { diff --git a/waterbox/libsnes/bsnes/snes/chip/msu1/msu1.cpp b/waterbox/libsnes/bsnes/snes/chip/msu1/msu1.cpp index 2bc1f0de58..bf44fddb12 100644 --- a/waterbox/libsnes/bsnes/snes/chip/msu1/msu1.cpp +++ b/waterbox/libsnes/bsnes/snes/chip/msu1/msu1.cpp @@ -63,7 +63,7 @@ void MSU1::power() { } void MSU1::reset() { - create(MSU1::Enter, 44100); + create(MSU1::Enter, 44100, 16384); mmio.data_offset = 0; mmio.audio_offset = 0; diff --git a/waterbox/libsnes/bsnes/snes/chip/necdsp/necdsp.cpp b/waterbox/libsnes/bsnes/snes/chip/necdsp/necdsp.cpp index 627d3c9d29..37b49e4106 100644 --- a/waterbox/libsnes/bsnes/snes/chip/necdsp/necdsp.cpp +++ b/waterbox/libsnes/bsnes/snes/chip/necdsp/necdsp.cpp @@ -275,7 +275,7 @@ void NECDSP::power() { } void NECDSP::reset() { - create(NECDSP::Enter, frequency); + create(NECDSP::Enter, frequency, 8192); for(unsigned n = 0; n < 16; n++) regs.stack[n] = 0x0000; regs.pc = 0x0000; diff --git a/waterbox/libsnes/bsnes/snes/chip/sa1/sa1.cpp b/waterbox/libsnes/bsnes/snes/chip/sa1/sa1.cpp index 08e586ee54..0f086e49f0 100644 --- a/waterbox/libsnes/bsnes/snes/chip/sa1/sa1.cpp +++ b/waterbox/libsnes/bsnes/snes/chip/sa1/sa1.cpp @@ -130,7 +130,7 @@ void SA1::power() { } void SA1::reset() { - create(SA1::Enter, system.cpu_frequency()); + create(SA1::Enter, system.cpu_frequency(), 8192); cpubwram.dma = false; for(unsigned addr = 0; addr < iram.size(); addr++) { diff --git a/waterbox/libsnes/bsnes/snes/chip/superfx/superfx.cpp b/waterbox/libsnes/bsnes/snes/chip/superfx/superfx.cpp index 31efcff036..d12736d693 100644 --- a/waterbox/libsnes/bsnes/snes/chip/superfx/superfx.cpp +++ b/waterbox/libsnes/bsnes/snes/chip/superfx/superfx.cpp @@ -53,7 +53,7 @@ void SuperFX::power() { } void SuperFX::reset() { - create(SuperFX::Enter, system.cpu_frequency()); + create(SuperFX::Enter, system.cpu_frequency(), 16384); instruction_counter = 0; for(unsigned n = 0; n < 16; n++) regs.r[n] = 0x0000; diff --git a/waterbox/libsnes/bsnes/snes/controller/controller.cpp b/waterbox/libsnes/bsnes/snes/controller/controller.cpp index c79baaff82..8e3791f79f 100644 --- a/waterbox/libsnes/bsnes/snes/controller/controller.cpp +++ b/waterbox/libsnes/bsnes/snes/controller/controller.cpp @@ -47,7 +47,7 @@ void Controller::iobit(bool data) { } Controller::Controller(bool port) : port(port) { - if(!thread) create(Controller::Enter, 1); + if(!thread) create(Controller::Enter, 1, 4096); } diff --git a/waterbox/libsnes/bsnes/snes/controller/justifier/justifier.cpp b/waterbox/libsnes/bsnes/snes/controller/justifier/justifier.cpp index cae1403603..af8ff3edfb 100644 --- a/waterbox/libsnes/bsnes/snes/controller/justifier/justifier.cpp +++ b/waterbox/libsnes/bsnes/snes/controller/justifier/justifier.cpp @@ -99,7 +99,7 @@ void Justifier::latch(bool data) { } Justifier::Justifier(bool port, bool chained) : Controller(port), chained(chained) { - create(Controller::Enter, 21477272); + create(Controller::Enter, 21477272, 8192); latched = 0; counter = 0; active = 0; diff --git a/waterbox/libsnes/bsnes/snes/controller/superscope/superscope.cpp b/waterbox/libsnes/bsnes/snes/controller/superscope/superscope.cpp index d5edd61a99..09967f2676 100644 --- a/waterbox/libsnes/bsnes/snes/controller/superscope/superscope.cpp +++ b/waterbox/libsnes/bsnes/snes/controller/superscope/superscope.cpp @@ -99,7 +99,7 @@ void SuperScope::latch(bool data) { } SuperScope::SuperScope(bool port) : Controller(port) { - create(Controller::Enter, 21477272); + create(Controller::Enter, 21477272, 8192); latched = 0; counter = 0; diff --git a/waterbox/libsnes/bsnes/snes/controller/usart/usart.cpp b/waterbox/libsnes/bsnes/snes/controller/usart/usart.cpp index f7013e02ef..2573d8794d 100644 --- a/waterbox/libsnes/bsnes/snes/controller/usart/usart.cpp +++ b/waterbox/libsnes/bsnes/snes/controller/usart/usart.cpp @@ -92,7 +92,7 @@ USART::USART(bool port) : Controller(port) { if(0 /*open_absolute(filename)*/) { init = sym("usart_init"); main = sym("usart_main"); - if(init && main) create(Controller::Enter, 1000000); + if(init && main) create(Controller::Enter, 1000000, 8192); } } diff --git a/waterbox/libsnes/bsnes/snes/cpu/cpu.cpp b/waterbox/libsnes/bsnes/snes/cpu/cpu.cpp index d0d974295f..0710232d34 100644 --- a/waterbox/libsnes/bsnes/snes/cpu/cpu.cpp +++ b/waterbox/libsnes/bsnes/snes/cpu/cpu.cpp @@ -138,7 +138,7 @@ void CPU::power() { } void CPU::reset() { - create(Enter, system.cpu_frequency()); + create(Enter, system.cpu_frequency(), 16384); coprocessors.reset(); PPUcounter::reset(); diff --git a/waterbox/libsnes/bsnes/snes/smp/smp.cpp b/waterbox/libsnes/bsnes/snes/smp/smp.cpp index 84dfd27edb..8d84b8f61c 100644 --- a/waterbox/libsnes/bsnes/snes/smp/smp.cpp +++ b/waterbox/libsnes/bsnes/snes/smp/smp.cpp @@ -60,7 +60,7 @@ void SMP::power() { } void SMP::reset() { - create(Enter, system.apu_frequency()); + create(Enter, system.apu_frequency(), 16384); regs.pc = 0xffc0; regs.a = 0x00; diff --git a/waterbox/libsnes/bsnes/snes/snes.hpp b/waterbox/libsnes/bsnes/snes/snes.hpp index cc2a688078..6ca7ae969b 100644 --- a/waterbox/libsnes/bsnes/snes/snes.hpp +++ b/waterbox/libsnes/bsnes/snes/snes.hpp @@ -23,9 +23,9 @@ namespace SNES { unsigned frequency; int64 clock; - inline void create(void (*entrypoint)(), unsigned frequency) { + inline void create(void (*entrypoint)(), unsigned frequency, int size) { if(thread) co_delete(thread); - thread = co_create(65536 * sizeof(void*), entrypoint); + thread = co_create(size * sizeof(void*), entrypoint); this->frequency = frequency; clock = 0; } diff --git a/waterbox/libsnes/bsnes/target-libsnes/libsnes_pwrap.cpp b/waterbox/libsnes/bsnes/target-libsnes/libsnes_pwrap.cpp index 23dcd80196..ed230e6cb8 100644 --- a/waterbox/libsnes/bsnes/target-libsnes/libsnes_pwrap.cpp +++ b/waterbox/libsnes/bsnes/target-libsnes/libsnes_pwrap.cpp @@ -604,7 +604,7 @@ EXPORT void* DllInit() co_delete(co_emu); co_emu = nullptr; } - co_emu = co_create(65536 * sizeof(void*), new_emuthread); + co_emu = co_create(32768 * sizeof(void*), new_emuthread); return &comm; }