basic provision for feeding external pictures to the cameras
This commit is contained in:
parent
59a5923463
commit
ee61062aa1
|
@ -758,6 +758,30 @@ void Camera::MCU_Write(u16 addr, u8 val)
|
|||
MCURegs[addr] = val;
|
||||
}
|
||||
|
||||
|
||||
void Camera::InputFrame(u32* data, int width, int height)
|
||||
{
|
||||
// TODO: double-buffering?
|
||||
|
||||
if (width == 640 && height == 480)
|
||||
{
|
||||
memcpy(FrameBuffer, data, 640*480*sizeof(u32));
|
||||
return;
|
||||
}
|
||||
|
||||
for (int dy = 0; dy < 480; dy++)
|
||||
{
|
||||
int sy = (dy * height) / 480;
|
||||
|
||||
for (int dx = 0; dx < 640; dx++)
|
||||
{
|
||||
int sx = (dx * width) / 640;
|
||||
|
||||
FrameBuffer[dy*640 + dx] = data[sy*width + sx];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -68,6 +68,8 @@ public:
|
|||
u8 I2C_Read(bool last);
|
||||
void I2C_Write(u8 val, bool last);
|
||||
|
||||
void InputFrame(u32* data, int width, int height);
|
||||
|
||||
u32 Num;
|
||||
|
||||
private:
|
||||
|
|
15
src/NDS.cpp
15
src/NDS.cpp
|
@ -1261,6 +1261,21 @@ void SetLidClosed(bool closed)
|
|||
}
|
||||
}
|
||||
|
||||
void CamInputFrame(int cam, u32* data, int width, int height)
|
||||
{
|
||||
// TODO: support things like the GBA-slot camera addon
|
||||
// whenever these are emulated
|
||||
|
||||
if (ConsoleType == 1)
|
||||
{
|
||||
switch (cam)
|
||||
{
|
||||
case 0: return DSi_CamModule::Camera0->InputFrame(data, width, height);
|
||||
case 1: return DSi_CamModule::Camera1->InputFrame(data, width, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MicInputFrame(s16* data, int samples)
|
||||
{
|
||||
return SPI_TSC::MicInputFrame(data, samples);
|
||||
|
|
|
@ -260,6 +260,7 @@ void SetKeyMask(u32 mask);
|
|||
bool IsLidClosed();
|
||||
void SetLidClosed(bool closed);
|
||||
|
||||
void CamInputFrame(int cam, u32* data, int width, int height);
|
||||
void MicInputFrame(s16* data, int samples);
|
||||
|
||||
void ScheduleEvent(u32 id, bool periodic, s32 delay, void (*func)(u32), u32 param);
|
||||
|
|
|
@ -430,6 +430,9 @@ void EmuThread::run()
|
|||
|
||||
char melontitle[100];
|
||||
|
||||
QImage testimg("test.jpg");
|
||||
QImage testimg_conv = testimg.convertToFormat(QImage::Format_RGB32);
|
||||
|
||||
while (EmuRunning != 0)
|
||||
{
|
||||
Input::Process();
|
||||
|
@ -510,6 +513,9 @@ void EmuThread::run()
|
|||
OSD::AddMessage(0, lid ? "Lid closed" : "Lid opened");
|
||||
}
|
||||
|
||||
// camera input test
|
||||
NDS::CamInputFrame(0, (u32*)testimg_conv.bits(), testimg_conv.width(), testimg_conv.height());
|
||||
|
||||
// microphone input
|
||||
micProcess();
|
||||
|
||||
|
@ -1834,7 +1840,7 @@ void MainWindow::keyPressEvent(QKeyEvent* event)
|
|||
if (event->isAutoRepeat()) return;
|
||||
|
||||
// TODO!! REMOVE ME IN RELEASE BUILDS!!
|
||||
//if (event->key() == Qt::Key_F11) NDS::debug(0);
|
||||
if (event->key() == Qt::Key_F11) NDS::debug(0);
|
||||
|
||||
Input::KeyPress(event);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue