actual DSi camera support (#1520)

basically feeding something that isn't a fixed stripe pattern, and emulating enough of the camera hardware to make this work
This commit is contained in:
Arisotura
2022-10-02 16:47:57 +02:00
committed by GitHub
parent c1c4cbc838
commit 3f4573574a
23 changed files with 2024 additions and 270 deletions

View File

@ -169,7 +169,6 @@ u32 Device;
bool Init()
{
if (!DSi_BPTWL::Init()) return false;
if (!DSi_Camera::Init()) return false;
return true;
}
@ -177,7 +176,6 @@ bool Init()
void DeInit()
{
DSi_BPTWL::DeInit();
DSi_Camera::DeInit();
}
void Reset()
@ -188,7 +186,6 @@ void Reset()
Device = -1;
DSi_BPTWL::Reset();
DSi_Camera::Reset();
}
void DoSavestate(Savestate* file)
@ -200,12 +197,11 @@ void DoSavestate(Savestate* file)
file->Var32(&Device);
DSi_BPTWL::DoSavestate(file);
// cameras are savestated from the DSi_Camera module
}
void WriteCnt(u8 val)
{
//printf("I2C: write CNT %02X, %08X\n", val, NDS::GetPC(1));
//printf("I2C: write CNT %02X, %02X, %08X\n", val, Data, NDS::GetPC(1));
// TODO: check ACK flag
// TODO: transfer delay
@ -224,8 +220,8 @@ void WriteCnt(u8 val)
switch (Device)
{
case 0x4A: Data = DSi_BPTWL::Read(islast); break;
case 0x78: Data = DSi_Camera0->I2C_Read(islast); break;
case 0x7A: Data = DSi_Camera1->I2C_Read(islast); break;
case 0x78: Data = DSi_CamModule::Camera0->I2C_Read(islast); break;
case 0x7A: Data = DSi_CamModule::Camera1->I2C_Read(islast); break;
case 0xA0:
case 0xE0: Data = 0xFF; break;
default:
@ -250,8 +246,8 @@ void WriteCnt(u8 val)
switch (Device)
{
case 0x4A: DSi_BPTWL::Start(); break;
case 0x78: DSi_Camera0->I2C_Start(); break;
case 0x7A: DSi_Camera1->I2C_Start(); break;
case 0x78: DSi_CamModule::Camera0->I2C_Start(); break;
case 0x7A: DSi_CamModule::Camera1->I2C_Start(); break;
case 0xA0:
case 0xE0: ack = false; break;
default:
@ -267,8 +263,8 @@ void WriteCnt(u8 val)
switch (Device)
{
case 0x4A: DSi_BPTWL::Write(Data, islast); break;
case 0x78: DSi_Camera0->I2C_Write(Data, islast); break;
case 0x7A: DSi_Camera1->I2C_Write(Data, islast); break;
case 0x78: DSi_CamModule::Camera0->I2C_Write(Data, islast); break;
case 0x7A: DSi_CamModule::Camera1->I2C_Write(Data, islast); break;
case 0xA0:
case 0xE0: ack = false; break;
default: