3232#include " hw/modem/modem.h"
3333#include " hw/holly/holly_intc.h"
3434#include " hw/aica/aica_mmio.h"
35+ #include " hw/arm7/SoundCPU.h"
3536
3637#define fault_printf (...)
3738
4142
4243unique_ptr<VirtualDreamcast> virtualDreamcast;
4344unique_ptr<GDRomDisc> g_GDRDisc;
44- unique_ptr<SoundCPU> g_SoundCPU;
45+
4546MMIODevice* g_GDRomDrive;
4647
4748
@@ -125,21 +126,11 @@ s32 plugins_Init()
125126 return rv;
126127#endif
127128
128-
129- g_SoundCPU.reset (SoundCPU::Create ());
130-
131- if (s32 rv = g_SoundCPU->Init ())
132- return rv;
133-
134129 return rv_ok;
135130}
136131
137132void plugins_Term ()
138133{
139- // term all plugins
140- g_SoundCPU->Term ();
141- g_SoundCPU.reset (nullptr );
142-
143134 g_GDRDisc->Term ();
144135 g_GDRDisc.reset (nullptr );
145136}
@@ -148,7 +139,6 @@ void plugins_Reset(bool Manual)
148139{
149140 reios_reset ();
150141 g_GDRDisc->Reset (Manual);
151- g_SoundCPU->Reset (Manual);
152142 // libExtDevice_Reset(Manual);
153143}
154144
@@ -823,6 +813,8 @@ struct Dreamcast_impl : VirtualDreamcast {
823813 SPG* spg = SPG::Create (asic);
824814 MMIODevice* pvrDevice = Create_PVRDevice (systemBus, asic, spg);
825815 MMIODevice* aicaDevice = Create_AicaDevice (systemBus, asic);
816+ SoundCPU* soundCPU = SoundCPU::Create ();
817+
826818 MMIODevice* mapleDevice = Create_MapleDevice (systemBus, asic);
827819
828820 MMIODevice* extDevice = Create_ExtDevice (); // or Create_Modem();
@@ -848,7 +840,8 @@ struct Dreamcast_impl : VirtualDreamcast {
848840 sh4_cpu->SetA0Handler (A0H_MAPLE, mapleDevice);
849841 sh4_cpu->SetA0Handler (A0H_ASIC, asic);
850842 sh4_cpu->SetA0Handler (A0H_SPG, spg);
851-
843+ sh4_cpu->SetA0Handler (A0H_SCPU, soundCPU);
844+
852845 return sh4_cpu->Init ();
853846 }
854847
0 commit comments