properly stop any started cameras upon reset/shutdown

This commit is contained in:
Arisotura 2022-10-02 23:29:24 +02:00
parent 62879c4484
commit 571d1c403f
5 changed files with 24 additions and 0 deletions

View File

@ -172,6 +172,11 @@ void Reset()
GPU::DispStat[1] |= (1<<6);
}
void Stop()
{
DSi_CamModule::Stop();
}
void DoSavestate(Savestate* file)
{
file->Section("DSIG");

View File

@ -56,6 +56,7 @@ extern u32 NWRAMMask[2][3];
bool Init();
void DeInit();
void Reset();
void Stop();
void DoSavestate(Savestate* file);

View File

@ -83,6 +83,12 @@ void Reset()
NDS::ScheduleEvent(NDS::Event_DSi_CamIRQ, true, kIRQInterval, IRQ, 0);
}
void Stop()
{
Camera0->Stop();
Camera1->Stop();
}
void DoSavestate(Savestate* file)
{
file->Section("CAMi");
@ -418,6 +424,8 @@ void Camera::DoSavestate(Savestate* file)
void Camera::Reset()
{
Platform::Camera_Stop(Num);
DataPos = 0;
RegAddr = 0;
RegData = 0;
@ -439,6 +447,11 @@ void Camera::Reset()
memset(FrameBuffer, 0, (640*480/2)*sizeof(u32));
}
void Camera::Stop()
{
Platform::Camera_Stop(Num);
}
bool Camera::IsActivated()
{
if (StandbyCnt & (1<<14)) return false; // standby

View File

@ -33,6 +33,7 @@ extern Camera* Camera1;
bool Init();
void DeInit();
void Reset();
void Stop();
void DoSavestate(Savestate* file);
@ -56,6 +57,7 @@ public:
void DoSavestate(Savestate* file);
void Reset();
void Stop();
bool IsActivated();
void StartTransfer();

View File

@ -693,6 +693,9 @@ void Stop()
Platform::StopEmu();
GPU::Stop();
SPU::Stop();
if (ConsoleType == 1)
DSi::Stop();
}
bool DoSavestate_Scheduler(Savestate* file)