diff --git a/Makefile.common b/Makefile.common index 5d92b93a52..705f049b68 100644 --- a/Makefile.common +++ b/Makefile.common @@ -222,7 +222,7 @@ endif ifeq ($(HAVE_QT), 1) OBJ += ui/drivers/ui_qt.o # TODO/FIXME - figure out which libraries we need to link against -LIBS += -lQt5Quick -lQt5Widgets -lQt5Gui -lQt5Qml -lQt5Network -lQt5Core -lglu32 -lopengl32 -L./ui/drivers/qt/release -lwrapper +LIBS += -lQt5Quick -lQt5Widgets -lQt5Gui -lQt5Qml -lQt5Network -lQt5Core -lglu32 -lopengl32 -L./ui/drivers/qt/wrapper/build/release -lwrapper endif # LibretroDB diff --git a/qb/config.libs.sh b/qb/config.libs.sh index 510c30276b..978f6373f8 100644 --- a/qb/config.libs.sh +++ b/qb/config.libs.sh @@ -404,6 +404,6 @@ add_define_make OS "$OS" # Creates config.mk and config.h. add_define_make GLOBAL_CONFIG_DIR "$GLOBAL_CONFIG_DIR" -VARS="RGUI LAKKA GLUI XMB ALSA OSS OSS_BSD OSS_LIB AL RSOUND ROAR JACK COREAUDIO CORETEXT PULSE SDL SDL2 D3D9 DINPUT LIBUSB XINPUT DSOUND XAUDIO OPENGL EXYNOS DISPMANX SUNXI OMAP GLES GLES3 VG EGL KMS GBM DRM DYLIB GETOPT_LONG THREADS CG LIBXML2 ZLIB DYNAMIC FFMPEG AVCODEC AVFORMAT AVUTIL SWSCALE FREETYPE STB_FONT XKBCOMMON XVIDEO X11 XEXT XF86VM XINERAMA WAYLAND MALI_FBDEV VIVANTE_FBDEV NETWORKING NETPLAY NETWORK_CMD STDIN_CMD COMMAND SOCKET_LEGACY FBO STRL STRCASESTR MMAP PYTHON FFMPEG_ALLOC_CONTEXT3 FFMPEG_AVCODEC_OPEN2 FFMPEG_AVIO_OPEN FFMPEG_AVFORMAT_WRITE_HEADER FFMPEG_AVFORMAT_NEW_STREAM FFMPEG_AVCODEC_ENCODE_AUDIO2 SWRESAMPLE FFMPEG_AVCODEC_ENCODE_VIDEO2 BSV_MOVIE VIDEOCORE NEON FLOATHARD FLOATSOFTFP UDEV V4L2 AV_CHANNEL_LAYOUT 7ZIP PARPORT IMAGEVIEWER COCOA AVFOUNDATION CORELOCATION IOHIDMANAGER LIBRETRODB" +VARS="RGUI LAKKA GLUI XMB ALSA OSS OSS_BSD OSS_LIB AL RSOUND ROAR JACK COREAUDIO CORETEXT PULSE SDL SDL2 D3D9 DINPUT LIBUSB XINPUT DSOUND XAUDIO OPENGL EXYNOS DISPMANX SUNXI OMAP GLES GLES3 VG EGL KMS GBM DRM DYLIB GETOPT_LONG THREADS CG LIBXML2 ZLIB DYNAMIC FFMPEG AVCODEC AVFORMAT AVUTIL SWSCALE FREETYPE STB_FONT XKBCOMMON XVIDEO X11 XEXT XF86VM XINERAMA WAYLAND MALI_FBDEV VIVANTE_FBDEV NETWORKING NETPLAY NETWORK_CMD STDIN_CMD COMMAND SOCKET_LEGACY FBO STRL STRCASESTR MMAP PYTHON FFMPEG_ALLOC_CONTEXT3 FFMPEG_AVCODEC_OPEN2 FFMPEG_AVIO_OPEN FFMPEG_AVFORMAT_WRITE_HEADER FFMPEG_AVFORMAT_NEW_STREAM FFMPEG_AVCODEC_ENCODE_AUDIO2 SWRESAMPLE FFMPEG_AVCODEC_ENCODE_VIDEO2 BSV_MOVIE VIDEOCORE NEON FLOATHARD FLOATSOFTFP UDEV V4L2 AV_CHANNEL_LAYOUT 7ZIP PARPORT IMAGEVIEWER COCOA AVFOUNDATION CORELOCATION IOHIDMANAGER LIBRETRODB QT" create_config_make config.mk $VARS create_config_header config.h $VARS diff --git a/qb/config.params.sh b/qb/config.params.sh index 67d1b96a09..6ab90745ed 100644 --- a/qb/config.params.sh +++ b/qb/config.params.sh @@ -57,3 +57,4 @@ HAVE_PRESERVE_DYLIB=no # Disable dlclose() for Valgrind support HAVE_PARPORT=auto # Parallel port joypad support HAVE_IMAGEVIEWER=yes # Built-in image viewer support. HAVE_MMAP=auto # MMAP support +HAVE_QT=no # QT companion support diff --git a/ui/drivers/qt/wimp-test/main.cpp b/ui/drivers/qt/wimp-test/main.cpp new file mode 100644 index 0000000000..868dab39bc --- /dev/null +++ b/ui/drivers/qt/wimp-test/main.cpp @@ -0,0 +1,47 @@ +#include +#include "../wrapper/wrapper.h" +#include "../wimp/wimp.h" + +#include +#include +#include + +struct Wimp* t; + + +int i=0; + +void *initGui(void *arg) +{ + char **arguments = (char**)arg; + t = ctrWimp(i,arguments); + CreateMainWindow(t); //-->uncomment this to open the QT gui + return 0; +} + +int main(int argc, char *argv[]) +{ + i = argc; + + pthread_t gui; + int rc; + rc=pthread_create(&gui, NULL, initGui, (void *)argv); + if(rc!=0) + { + printf("failed"); + exit(1); + } + + for(int j=0;j<100;j++) + { + Sleep(1000); + printf("test = %d\n",i); + i++; + if(j < 2) + t->SetTitle("test"); + } + + pthread_join(gui,NULL); + return 0; +} + diff --git a/ui/drivers/qt/wimp-test/wimp-test.pro b/ui/drivers/qt/wimp-test/wimp-test.pro new file mode 100644 index 0000000000..ee2e70b720 --- /dev/null +++ b/ui/drivers/qt/wimp-test/wimp-test.pro @@ -0,0 +1,20 @@ +TARGET = wimp-test +CONFIG += console + + +SOURCES += main.cpp + +win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../wimp/build/release/ -lwimp.dll +else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../wimp/build/debug/ -lwimp.dll +else:unix: LIBS += -L$$PWD/../wimp/build/ -lwimp.dll + +INCLUDEPATH += $$PWD/../wimp/build/release +DEPENDPATH += $$PWD/../wimp/build/release + + +win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../wrapper/build/release/ -lwrapper.dll +else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../wrapper/build/debug/ -lwrapper.dll +else:unix: LIBS += -L$$PWD/../wrapper/build/ -lwrapper.dll + +INCLUDEPATH += $$PWD/../wrapper/build/release +DEPENDPATH += $$PWD/../wrapper/build/release diff --git a/ui/drivers/qt/wimp/wimp.cpp b/ui/drivers/qt/wimp/wimp.cpp index 9e7f918fe7..cfab987dce 100644 --- a/ui/drivers/qt/wimp/wimp.cpp +++ b/ui/drivers/qt/wimp/wimp.cpp @@ -21,20 +21,30 @@ #include QObject *topLevel; -QQuickWindow *window; -int Wimp::CreateMainWindow() +static settings_t *settings; + +int Wimp::CreateMainWindow(char* windowTitle) { QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); topLevel = engine.rootObjects().value(0); window = qobject_cast(topLevel); + SetTitle(windowTitle); - SetTitle("Hello QT"); return this->exec(); } + void Wimp::SetTitle(char* title) { - window->setTitle(title); + window->setTitle(title); +} + +void Wimp::ConfigGetPtr(settings_t *g_config) +{ + settings = g_config; + /* test print the value of max users to compare with the value in RA */ + printf("Max Users: %d\n",g_config->input.max_users); + fflush(stdout); } diff --git a/ui/drivers/qt/wimp/wimp.h b/ui/drivers/qt/wimp/wimp.h index aa30b0b7f9..4de50e63de 100644 --- a/ui/drivers/qt/wimp/wimp.h +++ b/ui/drivers/qt/wimp/wimp.h @@ -20,15 +20,19 @@ #include #include #include - +#include +#include "configuration.h" class WIMPSHARED_EXPORT Wimp : public QGuiApplication { + QQuickWindow *window; + Q_OBJECT public: Wimp(int argc, char *argv[]): QGuiApplication(argc, argv) {} - int CreateMainWindow(); + int CreateMainWindow(char* windowTitle); void SetTitle(char* title); + void ConfigGetPtr(settings_t *g_config); }; diff --git a/ui/drivers/qt/wimp/wimp.pro b/ui/drivers/qt/wimp/wimp.pro index fa24d3e448..5dbf8f3b93 100644 --- a/ui/drivers/qt/wimp/wimp.pro +++ b/ui/drivers/qt/wimp/wimp.pro @@ -20,3 +20,7 @@ HEADERS +=\ RESOURCES += \ qml.qrc + + +INCLUDEPATH += $$PWD/../../../../ +INCLUDEPATH += $$PWD/../../../../libretro-common/include/ diff --git a/ui/drivers/qt/wrapper/wrapper.cpp b/ui/drivers/qt/wrapper/wrapper.cpp index 38fa6a17dc..3e1877a626 100644 --- a/ui/drivers/qt/wrapper/wrapper.cpp +++ b/ui/drivers/qt/wrapper/wrapper.cpp @@ -29,14 +29,14 @@ Wimp* ctrWimp(int argc, char *argv[]){ return new Wimp(argc,argv); } -int CreateMainWindow(Wimp* p) +int CreateMainWindow(Wimp* p, char* windowTitle) { - return p->CreateMainWindow(); + return p->CreateMainWindow(windowTitle); } -void SetTitle(Wimp*p, char* title) +void ConfigGetPtr(Wimp*p, settings_t *g_config) { - return p->SetTitle(title); + return p->ConfigGetPtr(g_config); } #ifdef __cplusplus diff --git a/ui/drivers/qt/wrapper/wrapper.h b/ui/drivers/qt/wrapper/wrapper.h index 603434790d..98b392063c 100644 --- a/ui/drivers/qt/wrapper/wrapper.h +++ b/ui/drivers/qt/wrapper/wrapper.h @@ -13,6 +13,7 @@ * If not, see . */ +#include "configuration.h" #ifndef WRAPPER_H #define WRAPPER_H @@ -25,8 +26,8 @@ typedef struct Wimp Wimp; Wimp* ctrWimp(int argc, char *argv[]); -int CreateMainWindow(Wimp* p); -void SetTitle(Wimp* p, char* title); +int CreateMainWindow(Wimp* p, char* windowTitle); +void ConfigGetPtr(Wimp*p, settings_t *g_config); #ifdef __cplusplus } diff --git a/ui/drivers/qt/wrapper/wrapper.pro b/ui/drivers/qt/wrapper/wrapper.pro index d8b8b8c210..f03fbb4dbd 100644 --- a/ui/drivers/qt/wrapper/wrapper.pro +++ b/ui/drivers/qt/wrapper/wrapper.pro @@ -14,7 +14,12 @@ HEADERS += \ wrapper.h -win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../release -lwimp +win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../wimp/build/release/ -lwimp.dll +else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../wimp/build/debug/ -lwimp.dll +else:unix: LIBS += -L$$PWD/../wimp/build/ -lwimp.dll -win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../release/libwimp.dll.a -else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../release/wimp.lib +INCLUDEPATH += $$PWD/../wimp/build/release +DEPENDPATH += $$PWD/../wimp/build/release + +INCLUDEPATH += $$PWD/../../../../ +INCLUDEPATH += $$PWD/../../../../libretro-common/include/ diff --git a/ui/drivers/ui_qt.c b/ui/drivers/ui_qt.c index 0191b747e6..f22606214e 100644 --- a/ui/drivers/ui_qt.c +++ b/ui/drivers/ui_qt.c @@ -18,6 +18,8 @@ #include #include #include +#include "general.h" +#include "system.h" #include #include @@ -38,11 +40,18 @@ typedef struct ui_companion_qt static void qt_thread(void *data) { - ui_companion_qt_t *handle = (ui_companion_qt_t*)data; + settings_t *settings = config_get_ptr(); + /* test print the value of max users to compare with the value in QT */ + RARCH_LOG("Max Users: %d\n", settings->input.max_users); + + ui_companion_qt_t *handle = (ui_companion_qt_t*)data; wimp = ctrWimp(0, NULL); if(wimp) - CreateMainWindow(wimp); + { + ConfigGetPtr(wimp, settings); + CreateMainWindow(wimp, "RetroArch QT"); + } return; } @@ -63,16 +72,11 @@ static void ui_companion_qt_deinit(void *data) static void *ui_companion_qt_init(void) { ui_companion_qt_t *handle = (ui_companion_qt_t*)calloc(1, sizeof(*handle)); - - fflush(stdout); - - if (!handle) return NULL; handle->lock = slock_new(); handle->thread = sthread_create(qt_thread, handle); - if (!handle->thread) { slock_free(handle->lock); @@ -87,8 +91,6 @@ static int ui_companion_qt_iterate(void *data, unsigned action) { (void)data; (void)action; - printf("Test"); - fflush(stdout); return 0; }