camera: fix bugs that Epicpkmn11's camera demo revealed

This commit is contained in:
Arisotura 2022-04-19 12:54:37 +02:00 committed by Nadia Holmquist Pedersen
parent a6e88bf6c0
commit ac9a4cfd6d
2 changed files with 8 additions and 15 deletions

View File

@ -217,7 +217,7 @@ void TransferScanline(u32 line)
{
// return raw data
memcpy(dstbuf, &tmpbuf[copystart], copylen);
memcpy(dstbuf, &tmpbuf[copystart], copylen*sizeof(u32));
}
u32 numscan = Cnt & 0x000F;
@ -577,19 +577,13 @@ int Camera::TransferScanline(u32* buffer, int maxlen)
void Camera::I2C_Start()
{
DataPos = 0;
}
u8 Camera::I2C_Read(bool last)
{
u8 ret;
if (DataPos < 2)
{
printf("DSi_Camera: WHAT??\n");
ret = 0;
}
else
{
if (DataPos & 0x1)
{
ret = RegData & 0xFF;
@ -600,7 +594,6 @@ u8 Camera::I2C_Read(bool last)
RegData = I2C_ReadReg(RegAddr);
ret = RegData >> 8;
}
}
if (last) DataPos = 0;
else DataPos++;

View File

@ -201,7 +201,7 @@ void DoSavestate(Savestate* file)
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