mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-28 16:50:15 -06:00
commit a bunch of random WIP crap
This commit is contained in:
@ -61,11 +61,12 @@ if (USE_QT6)
|
||||
set(Qt6Gui_DIR ${QT6_STATIC_BASE}Gui)
|
||||
set(Qt6Widgets_DIR ${QT6_STATIC_BASE}Widgets)
|
||||
set(Qt6Network_DIR ${QT6_STATIC_BASE}Network)
|
||||
set(Qt6Multimedia_DIR ${QT6_STATIC_BASE}Multimedia)
|
||||
set(Qt6OpenGL_DIR ${QT6_STATIC_BASE}OpenGL)
|
||||
set(Qt6OpenGLWidgets_DIR ${QT6_STATIC_BASE}OpenGLWidgets)
|
||||
endif()
|
||||
find_package(Qt6 COMPONENTS Core Gui Widgets Network OpenGL OpenGLWidgets REQUIRED)
|
||||
set(QT_LINK_LIBS Qt6::Core Qt6::Gui Qt6::Widgets Qt6::Network Qt6::OpenGL Qt6::OpenGLWidgets)
|
||||
find_package(Qt6 COMPONENTS Core Gui Widgets Network Multimedia OpenGL OpenGLWidgets REQUIRED)
|
||||
set(QT_LINK_LIBS Qt6::Core Qt6::Gui Qt6::Widgets Qt6::Network Qt6::Multimedia Qt6::OpenGL Qt6::OpenGLWidgets)
|
||||
else()
|
||||
if (BUILD_STATIC AND QT5_STATIC_DIR)
|
||||
set(QT5_STATIC_BASE ${QT5_STATIC_DIR}/lib/cmake/Qt5)
|
||||
@ -74,9 +75,10 @@ else()
|
||||
set(Qt5Gui_DIR ${QT5_STATIC_BASE}Gui)
|
||||
set(Qt5Widgets_DIR ${QT5_STATIC_BASE}Widgets)
|
||||
set(Qt5Network_DIR ${QT5_STATIC_BASE}Network)
|
||||
set(Qt5Multimedia_DIR ${QT5_STATIC_BASE}Multimedia)
|
||||
endif()
|
||||
find_package(Qt5 COMPONENTS Core Gui Widgets Network REQUIRED)
|
||||
set(QT_LINK_LIBS Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Network)
|
||||
find_package(Qt5 COMPONENTS Core Gui Widgets Network Multimedia REQUIRED)
|
||||
set(QT_LINK_LIBS Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Network Qt5::Multimedia)
|
||||
endif()
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
|
@ -114,6 +114,7 @@ s16* micWavBuffer;
|
||||
void micCallback(void* data, Uint8* stream, int len);
|
||||
|
||||
|
||||
|
||||
void audioCallback(void* data, Uint8* stream, int len)
|
||||
{
|
||||
len /= (sizeof(s16) * 2);
|
||||
@ -314,6 +315,57 @@ void micProcess()
|
||||
}
|
||||
|
||||
|
||||
void camOpen()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
void camClose()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
void camProcess()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
CameraFrameDumper::CameraFrameDumper(QObject* parent) : QAbstractVideoSurface(parent)
|
||||
{
|
||||
printf("BAKA!!\n");
|
||||
}
|
||||
|
||||
/*CameraFrameDumper::~CameraFrameDumper()
|
||||
{
|
||||
printf("SAYONARA\n");
|
||||
}*/
|
||||
|
||||
bool CameraFrameDumper::present(const QVideoFrame& _frame)
|
||||
{
|
||||
//printf("FRAMEZORZ!! %d %d %d\n", frame.pixelFormat(), frame.isMapped(), frame.isReadable());
|
||||
|
||||
QVideoFrame frame(_frame);
|
||||
if (!frame.map(QAbstractVideoBuffer::ReadOnly))
|
||||
return false;
|
||||
printf("FRAMEZORZ!! %d %d %d\n", frame.pixelFormat(), frame.isMapped(), frame.isReadable());
|
||||
NDS::CamInputFrame(0, (u32*)frame.bits(), frame.width(), frame.height(), false);
|
||||
|
||||
frame.unmap();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QList<QVideoFrame::PixelFormat> CameraFrameDumper::supportedPixelFormats(QAbstractVideoBuffer::HandleType type) const
|
||||
{
|
||||
QList<QVideoFrame::PixelFormat> ret;
|
||||
printf("PENIS. %d\n", type);
|
||||
ret.append(QVideoFrame::Format_RGB32);
|
||||
ret.append(QVideoFrame::Format_YUYV);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
EmuThread::EmuThread(QObject* parent) : QThread(parent)
|
||||
{
|
||||
EmuStatus = 0;
|
||||
@ -374,7 +426,7 @@ void EmuThread::deinitOpenGL()
|
||||
delete oglContext;
|
||||
delete oglSurface;
|
||||
}
|
||||
|
||||
#include <QVideoSurfaceFormat>
|
||||
void EmuThread::run()
|
||||
{
|
||||
bool hasOGL = mainWindow->hasOGL;
|
||||
@ -421,8 +473,46 @@ void EmuThread::run()
|
||||
|
||||
char melontitle[100];
|
||||
|
||||
QImage testimg("test.jpg");
|
||||
QImage testimg_conv = testimg.convertToFormat(QImage::Format_RGB32);
|
||||
//QImage testimg("test.jpg");
|
||||
//QImage testimg_conv = testimg.convertToFormat(QImage::Format_RGB32);
|
||||
|
||||
#if 0
|
||||
const QList<QCameraInfo> cameras = QCameraInfo::availableCameras();
|
||||
for (const QCameraInfo &cameraInfo : cameras)
|
||||
printf("CAMERAFAZIL: %s\n", cameraInfo.deviceName().toStdString().c_str());
|
||||
QCamera* camera = new QCamera(cameras[0]);
|
||||
CameraFrameDumper* dumper = new CameraFrameDumper();
|
||||
//QCameraViewfinder* derp = new QCameraViewfinder();
|
||||
printf("PROAON\n");
|
||||
//camera->setCaptureMode(QCamera::CaptureVideo);
|
||||
//camera->setCaptureMode(QCamera::CaptureViewfinder);
|
||||
printf("PROOT\n");
|
||||
//camera->unload();
|
||||
camera->setViewfinder(dumper);
|
||||
//camera->setViewfinder(derp);
|
||||
//camera->load();
|
||||
|
||||
// if (status != QCamera::LoadedStatus || m_camera->state() == QCamera::ActiveState) { return
|
||||
printf("STATUS %d STATE %d\n", camera->status(), camera->state());
|
||||
|
||||
printf("CHIASSE\n");
|
||||
/*QCameraViewfinderSettings settings;
|
||||
auto zorp = camera->supportedViewfinderResolutions(settings);
|
||||
for (auto& res : zorp) printf("RESOLUTION: %d x %d\n", res.width(), res.height());
|
||||
auto zarp = camera->supportedViewfinderPixelFormats(settings);
|
||||
for (auto& pf : zarp) printf("PIXEL FORMAT: %d\n", pf);
|
||||
|
||||
settings.setResolution(640, 480);
|
||||
//settings.setPixelFormat(QVideoFrame::Format_RGB32);
|
||||
settings.setPixelFormat(QVideoFrame::Format_YUYV);
|
||||
printf("PRALIPET\n");
|
||||
camera->setViewfinderSettings(settings);*/
|
||||
printf("PROULON\n");
|
||||
//dumper->start();
|
||||
//QVideoSurfaceFormat blarf(QSize(640,480), QVideoFrame::Format_RGB32);
|
||||
//dumper->start(blarf);
|
||||
camera->start();
|
||||
#endif
|
||||
|
||||
while (EmuRunning != 0)
|
||||
{
|
||||
@ -505,7 +595,7 @@ void EmuThread::run()
|
||||
}
|
||||
|
||||
// camera input test
|
||||
NDS::CamInputFrame(0, (u32*)testimg_conv.bits(), testimg_conv.width(), testimg_conv.height());
|
||||
//NDS::CamInputFrame(0, (u32*)testimg_conv.bits(), testimg_conv.width(), testimg_conv.height(), true);
|
||||
|
||||
// microphone input
|
||||
micProcess();
|
||||
@ -665,6 +755,9 @@ void EmuThread::run()
|
||||
}
|
||||
}
|
||||
|
||||
//camera->stop();
|
||||
//delete camera;
|
||||
|
||||
EmuStatus = 0;
|
||||
|
||||
GPU::DeInitRenderer();
|
||||
@ -1718,6 +1811,44 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent)
|
||||
|
||||
actLimitFramerate->setChecked(Config::LimitFPS);
|
||||
actAudioSync->setChecked(Config::AudioSync);
|
||||
|
||||
|
||||
|
||||
const QList<QCameraInfo> cameras = QCameraInfo::availableCameras();
|
||||
for (const QCameraInfo &cameraInfo : cameras)
|
||||
printf("CAMERAFAZIL: %s\n", cameraInfo.deviceName().toStdString().c_str());
|
||||
QCamera* camera = new QCamera(cameras[0]);
|
||||
CameraFrameDumper* dumper = new CameraFrameDumper();
|
||||
//QCameraViewfinder* derp = new QCameraViewfinder();
|
||||
printf("PROAON\n");
|
||||
//camera->setCaptureMode(QCamera::CaptureVideo);
|
||||
//camera->setCaptureMode(QCamera::CaptureViewfinder);
|
||||
printf("PROOT\n");
|
||||
//camera->unload();
|
||||
camera->setViewfinder(dumper);
|
||||
//camera->setViewfinder(derp);
|
||||
//camera->load();
|
||||
|
||||
// if (status != QCamera::LoadedStatus || m_camera->state() == QCamera::ActiveState) { return
|
||||
printf("STATUS %d STATE %d\n", camera->status(), camera->state());
|
||||
|
||||
printf("CHIASSE\n");
|
||||
/*QCameraViewfinderSettings settings;
|
||||
auto zorp = camera->supportedViewfinderResolutions(settings);
|
||||
for (auto& res : zorp) printf("RESOLUTION: %d x %d\n", res.width(), res.height());
|
||||
auto zarp = camera->supportedViewfinderPixelFormats(settings);
|
||||
for (auto& pf : zarp) printf("PIXEL FORMAT: %d\n", pf);
|
||||
|
||||
settings.setResolution(640, 480);
|
||||
//settings.setPixelFormat(QVideoFrame::Format_RGB32);
|
||||
settings.setPixelFormat(QVideoFrame::Format_YUYV);
|
||||
printf("PRALIPET\n");
|
||||
camera->setViewfinderSettings(settings);*/
|
||||
printf("PROULON\n");
|
||||
//dumper->start();
|
||||
//QVideoSurfaceFormat blarf(QSize(640,480), QVideoFrame::Format_RGB32);
|
||||
//dumper->start(blarf);
|
||||
camera->start();
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
@ -1813,7 +1944,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);
|
||||
}
|
||||
@ -2999,7 +3130,7 @@ bool MelonApplication::event(QEvent *event)
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
srand(time(NULL));
|
||||
srand(time(nullptr));
|
||||
|
||||
printf("melonDS " MELONDS_VERSION "\n");
|
||||
printf(MELONDS_URL "\n");
|
||||
|
@ -36,8 +36,24 @@
|
||||
#include <QOpenGLFunctions_3_2_Core>
|
||||
#include <QOpenGLShaderProgram>
|
||||
|
||||
#include <QCamera>
|
||||
#include <QCameraInfo>
|
||||
#include <QAbstractVideoSurface>
|
||||
|
||||
#include "FrontendUtil.h"
|
||||
|
||||
class CameraFrameDumper : public QAbstractVideoSurface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CameraFrameDumper(QObject* parent = nullptr);
|
||||
//~CameraFrameDumper();
|
||||
|
||||
bool present(const QVideoFrame& frame) override;
|
||||
QList<QVideoFrame::PixelFormat> supportedPixelFormats(QAbstractVideoBuffer::HandleType type = QAbstractVideoBuffer::NoHandle) const override;
|
||||
};
|
||||
|
||||
class EmuThread : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
|
Reference in New Issue
Block a user