OSDN Git Service

[General][Qt] Fix FTBFSs.
authorK.Ohta <whatisthis.sowhat@gmail.com>
Sun, 9 Apr 2017 12:44:35 +0000 (21:44 +0900)
committerK.Ohta <whatisthis.sowhat@gmail.com>
Sun, 9 Apr 2017 12:44:35 +0000 (21:44 +0900)
source/build-cmake/cmake/config_commonsource.cmake
source/build-cmake/cmake/config_sharedlibs.cmake
source/src/common.cpp
source/src/common.h
source/src/config.cpp
source/src/config.h
source/src/qt/osd_base.cpp
source/src/qt/osd_console.cpp
source/src/qt/osd_screen.cpp
source/src/qt/osd_sound.cpp

index cc6566e..320326a 100644 (file)
@@ -89,7 +89,6 @@ else()
 endif()
 
 add_definitions(-D_USE_QT5)
-add_definitions(-D_UNICODE)
 
 if(USE_QT5_4_APIS)
   add_definitions(-D_USE_QT_5_4)
@@ -260,6 +259,7 @@ endif()
 
 include(simd-x86)
 
+
 if(WIN32)
    set(BUNDLE_LIBS 
        ${OPENGL_LIBRARY}
@@ -277,6 +277,7 @@ if(WIN32)
        #SET(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> qcs <TARGET> <LINK_FLAGS> <OBJECTS>")
        #SET(CMAKE_CXX_ARCHIVE_FINISH   true)
 else()
+   add_definitions(-D_UNICODE)
    set(BUNDLE_LIBS 
 #       ${OPENGL_LIBRARY}
        ${OPENCL_LIBRARY}
index 439dd1b..5bd1a45 100644 (file)
@@ -50,7 +50,9 @@ else()
 endif()
 
 add_definitions(-D_USE_QT5)
-add_definitions(-D_UNICODE)
+if(NOT WIN32)
+  add_definitions(-D_UNICODE)
+endif()
 
 if(USE_QT5_4_APIS)
   add_definitions(-D_USE_QT_5_4)
index f561a09..680e79f 100644 (file)
@@ -861,7 +861,7 @@ bool DLL_PREFIX cur_time_t::load_state(void *f)
        return true;
 }
 
-const _TCHAR *get_symbol(symbol_t *first_symbol, uint32_t addr)
+const _TCHAR* DLL_PREFIX get_symbol(symbol_t *first_symbol, uint32_t addr)
 {
        static _TCHAR name[1024];
        
@@ -874,7 +874,7 @@ const _TCHAR *get_symbol(symbol_t *first_symbol, uint32_t addr)
        return NULL;
 }
 
-const _TCHAR *get_value_or_symbol(symbol_t *first_symbol, const _TCHAR *format, uint32_t addr)
+const _TCHAR* DLL_PREFIX get_value_or_symbol(symbol_t *first_symbol, const _TCHAR *format, uint32_t addr)
 {
        static _TCHAR name[1024];
        
@@ -888,7 +888,7 @@ const _TCHAR *get_value_or_symbol(symbol_t *first_symbol, const _TCHAR *format,
        return name;
 }
 
-const _TCHAR *get_value_and_symbol(symbol_t *first_symbol, const _TCHAR *format, uint32_t addr)
+const _TCHAR* DLL_PREFIX get_value_and_symbol(symbol_t *first_symbol, const _TCHAR *format, uint32_t addr)
 {
        static _TCHAR name[1024];
        
index a47aa7e..d98e1ee 100644 (file)
@@ -329,10 +329,10 @@ uint16_t DLL_PREFIX EndianToLittle_WORD(uint16_t x);
 #ifndef _MSC_VER
        #undef max
        #undef min
-       int max(int a, int b);
-       unsigned int max(unsigned int a, unsigned int b);
-       int min(int a, int b);
-       unsigned int min(unsigned int a, unsigned int b);
+       int DLL_PREFIX max(int a, int b);
+       unsigned int DLL_PREFIX max(unsigned int a, unsigned int b);
+       int DLL_PREFIX min(int a, int b);
+       unsigned int DLL_PREFIX min(unsigned int a, unsigned int b);
 #endif
 
 // string
@@ -474,12 +474,12 @@ uint16_t DLL_PREFIX EndianToLittle_WORD(uint16_t x);
 
 #if defined(_RGB555) || defined(_RGB565)
        typedef uint16_t scrntype_t;
-       scrntype_t RGB_COLOR(uint32_t r, uint32_t g, uint32_t b);
-       scrntype_t RGBA_COLOR(uint32_t r, uint32_t g, uint32_t b, uint32_t a);
-       uint8_t R_OF_COLOR(scrntype_t c);
-       uint8_t G_OF_COLOR(scrntype_t c);
-       uint8_t B_OF_COLOR(scrntype_t c);
-       uint8_t A_OF_COLOR(scrntype_t c);
+       scrntype_t DLL_PREFIX RGB_COLOR(uint32_t r, uint32_t g, uint32_t b);
+       scrntype_t DLL_PREFIX RGBA_COLOR(uint32_t r, uint32_t g, uint32_t b, uint32_t a);
+       uint8_t DLL_PREFIX R_OF_COLOR(scrntype_t c);
+       uint8_t DLL_PREFIX G_OF_COLOR(scrntype_t c);
+       uint8_t DLL_PREFIX B_OF_COLOR(scrntype_t c);
+       uint8_t DLL_PREFIX A_OF_COLOR(scrntype_t c);
 #elif defined(_RGB888)
        typedef uint32_t scrntype_t;
        #define RGB_COLOR(r, g, b)      (((uint32_t)(r) << 16) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 0))
@@ -513,15 +513,15 @@ typedef struct {
 #pragma pack()
 
 // file path
-const _TCHAR *get_application_path();
-const _TCHAR *create_local_path(const _TCHAR *format, ...);
-void create_local_path(_TCHAR *file_path, int length, const _TCHAR *format, ...);
-const _TCHAR *create_date_file_path(const _TCHAR *extension);
-void create_date_file_path(_TCHAR *file_path, int length, const _TCHAR *extension);
-bool check_file_extension(const _TCHAR *file_path, const _TCHAR *ext);
-const _TCHAR *get_file_path_without_extensiton(const _TCHAR *file_path);
-void get_long_full_path_name(const _TCHAR* src, _TCHAR* dst, size_t dst_len);
-const _TCHAR* get_parent_dir(const _TCHAR* file);
+const _TCHAR *DLL_PREFIX get_application_path();
+const _TCHAR *DLL_PREFIX create_local_path(const _TCHAR *format, ...);
+void DLL_PREFIX create_local_path(_TCHAR *file_path, int length, const _TCHAR *format, ...);
+const _TCHAR *DLL_PREFIX create_date_file_path(const _TCHAR *extension);
+void DLL_PREFIX create_date_file_path(_TCHAR *file_path, int length, const _TCHAR *extension);
+bool DLL_PREFIX check_file_extension(const _TCHAR *file_path, const _TCHAR *ext);
+const _TCHAR *DLL_PREFIX get_file_path_without_extensiton(const _TCHAR *file_path);
+void DLL_PREFIX get_long_full_path_name(const _TCHAR* src, _TCHAR* dst, size_t dst_len);
+const _TCHAR* DLL_PREFIX get_parent_dir(const _TCHAR* file);
 
 // string
 const _TCHAR *DLL_PREFIX create_string(const _TCHAR* format, ...);
@@ -574,8 +574,8 @@ typedef struct symbol_s {
        struct symbol_s *next_symbol;
 } symbol_t;
 
-const _TCHAR *get_symbol(symbol_t *first_symbol, uint32_t addr);
-const _TCHAR *get_value_or_symbol(symbol_t *first_symbol, const _TCHAR *format, uint32_t addr);
-const _TCHAR *get_value_and_symbol(symbol_t *first_symbol, const _TCHAR *format, uint32_t addr);
+const _TCHAR* DLL_PREFIX get_symbol(symbol_t *first_symbol, uint32_t addr);
+const _TCHAR* DLL_PREFIX get_value_or_symbol(symbol_t *first_symbol, const _TCHAR *format, uint32_t addr);
+const _TCHAR* DLL_PREFIX get_value_and_symbol(symbol_t *first_symbol, const _TCHAR *format, uint32_t addr);
 
 #endif
index d3b6a32..3f4374d 100644 (file)
@@ -141,7 +141,7 @@ void initialize_config()
        #endif
        
        // win32
-       #ifdef _WIN32
+       #if defined(_WIN32) && !defined(_USE_QT)
                #ifndef ONE_BOARD_MICRO_COMPUTER
                        config.use_d3d9 = true;
                #endif
@@ -335,10 +335,7 @@ void load_config(const _TCHAR *config_path)
                        #endif
                }
        #endif
-       #ifdef _WIN32
-               MyGetPrivateProfileString(_T("Sound"), _T("FMGenDll"), _T("mamefm.dll"), config.fmgen_dll_path, _MAX_PATH, config_path);
-       #endif
-       #ifdef _WIN32
+       #if defined(_WIN32) && !defined(_USE_QT)
                MyGetPrivateProfileString(_T("Sound"), _T("FMGenDll"), _T("mamefm.dll"), config.fmgen_dll_path, _MAX_PATH, config_path);
        #endif
        
@@ -357,7 +354,7 @@ void load_config(const _TCHAR *config_path)
        #endif
 
        // win32
-       #ifdef _WIN32
+       #if defined(_WIN32) && !defined(_USE_QT)
                #ifndef ONE_BOARD_MICRO_COMPUTER
                        config.use_d3d9 = MyGetPrivateProfileBool(_T("Win32"), _T("UseDirect3D9"), config.use_d3d9, config_path);
                        config.wait_vsync = MyGetPrivateProfileBool(_T("Win32"), _T("WaitVSync"), config.wait_vsync, config_path);
@@ -662,7 +659,7 @@ void save_config(const _TCHAR *config_path)
        #endif
        
        // win32
-       #ifdef _WIN32
+       #if defined(_WIN32) && !defined(_USE_QT)
                #ifndef ONE_BOARD_MICRO_COMPUTER
                        MyWritePrivateProfileBool(_T("Win32"), _T("UseDirect3D9"), config.use_d3d9, config_path);
                        MyWritePrivateProfileBool(_T("Win32"), _T("WaitVSync"), config.wait_vsync, config_path);
index 988514d..fe955cd 100644 (file)
@@ -206,10 +206,15 @@ typedef struct {
        int sound_volume_r[MAX_VOLUME_TMP];
 #endif
        // input
-#ifdef _WIN32
+#if defined(_WIN32) && !defined(_USE_QT)
        _TCHAR fmgen_dll_path[_MAX_PATH];
        bool use_direct_input;
        bool disable_dwm;
+
+       bool use_d3d9;
+       bool wait_vsync;
+       bool use_dinput;
+       bool show_status_bar;
 #endif
 #if defined(USE_SHARED_DLL) || defined(USE_JOYSTICK)
        int joy_buttons[4][16];
index 4b3a652..1bb32cd 100644 (file)
@@ -94,7 +94,7 @@ _TCHAR *OSD_BASE::get_app_path(void)
 _TCHAR* OSD_BASE::bios_path(const _TCHAR* file_name)
 {
        static _TCHAR file_path[_MAX_PATH];
-       snprintf(file_path, _MAX_PATH, _T("%s%s"), app_path, file_name);
+       snprintf((char *)file_path, _MAX_PATH, "%s%s", app_path, (const char *)file_name);
        csp_logger->debug_log(CSP_LOG_INFO, CSP_LOG_TYPE_OSD, "BIOS PATH:%s", file_path);
        return file_path;
 }
@@ -128,8 +128,8 @@ void OSD_BASE::create_date_file_name(_TCHAR *name, int length, const _TCHAR *ext
        tmps = tmps + get_vm_config_name();
        tmps = tmps + QString::fromUtf8("_");
        tmps = tmps + nowTime.toString(QString::fromUtf8("yyyy-MM-dd_hh-mm-ss.zzz."));
-       tmps = tmps + QString::fromUtf8(extension);
-       snprintf(name, length, _T("%s"), tmps.toLocal8Bit().constData());
+       tmps = tmps + QString::fromUtf8((const char *)extension);
+       snprintf((char *)name, length, "%s", tmps.toLocal8Bit().constData());
 }
 
 _TCHAR* OSD_BASE::application_path()
index fb91a94..1672ad8 100644 (file)
@@ -87,7 +87,7 @@ void OSD_BASE::set_console_text_attribute(unsigned short attr)
 
 void OSD_BASE::write_console(_TCHAR* buffer, unsigned int length)
 {
-       QString s = QString::fromLocal8Bit(buffer, length);
+       QString s = QString::fromLocal8Bit((const char *)buffer, length);
        emit sig_put_string_debugger(s);
 }
 
@@ -117,7 +117,7 @@ int OSD_BASE::read_console_input(_TCHAR* buffer)
        int l = console_cmd_str.length();
        
        console_cmd_str = console_cmd_str.right(l - count);     
-       strncpy(buffer, tmps.toLocal8Bit().constData(), count);
+       strncpy((char *)buffer, tmps.toLocal8Bit().constData(), count);
        //DebugSemaphore->release(1);
 
        return count;
index 5871d53..aa82b91 100644 (file)
@@ -203,7 +203,7 @@ bool OSD_BASE::start_record_video(int fps)
        QString tmps = nowTime.toString(QString::fromUtf8("yyyy-MM-dd_hh-mm-ss.zzz."));
        QString path = QString::fromUtf8("Saved_Movie_") + tmps + QString::fromUtf8("mp4");
        //QString path = QString::fromUtf8("Saved_Movie_") + tmps + QString::fromUtf8("mkv");
-       path = QString::fromLocal8Bit(this->get_app_path()) + path;
+       path = QString::fromLocal8Bit((const char *)this->get_app_path()) + path;
        int rate = this->get_sound_rate();
 
        emit sig_save_as_movie(path, fps, rate);
@@ -396,14 +396,14 @@ void OSD_BASE::release_bitmap(bitmap_t *bitmap)
 void OSD_BASE::create_font(font_t *font, const _TCHAR *family, int width, int height, int rotate, bool bold, bool italic)
 {
        QString fontName;
-       fontName = QString::fromUtf8(family);
+       fontName = QString::fromUtf8((const char *)family);
        if(fontName == QString::fromUtf8("Gothic")) {
                fontName = QString::fromUtf8("Sans Serif");
        } else if(fontName == QString::fromUtf8("Mincho")) {
                fontName = QString::fromUtf8("Serif");
        } else {
                //fontName = QString::fromUtf8("Sans Serif");
-               fontName = QString::fromUtf8(family);
+               fontName = QString::fromUtf8((const char *)family);
        }
        font->hFont = QFont(fontName);
        font->hFont.setPixelSize(height);
@@ -463,7 +463,7 @@ void OSD_BASE::draw_text_to_bitmap(bitmap_t *bitmap, font_t *font, int x, int y,
        QPoint loc = QPoint(x, y);
        
        QTextCodec *codec = QTextCodec::codecForName("Shift-JIS");
-       QString str = codec->toUnicode(text);
+       QString str = codec->toUnicode((char *)text);
        bitmap->hPainter.begin(&(bitmap->pImage));
        //bitmap->hPainter.setBackgroundMode(Qt::OpaqueMode);
        bitmap->hPainter.setPen(col);
@@ -527,7 +527,7 @@ void OSD_BASE::stretch_bitmap(bitmap_t *dest, int dest_x, int dest_y, int dest_w
 void OSD_BASE::write_bitmap_to_file(bitmap_t *bitmap, const _TCHAR *file_path)
 {
        int comp_quality = 0;
-       bitmap->pImage.save(QString::fromUtf8(file_path), "PNG", comp_quality);
+       bitmap->pImage.save(QString::fromUtf8((const char *)file_path), "PNG", comp_quality);
        csp_logger->debug_log(CSP_LOG_DEBUG, CSP_LOG_TYPE_PRINTER, "Save (print outed) bitmap %08x to %s", bitmap, file_path);
 }
 
index 6b83e1d..d317945 100644 (file)
@@ -337,7 +337,7 @@ void OSD_BASE::start_record_sound()
                tmps = tmps + QString::fromUtf8("_");
                tmps = tmps + nowTime.toString(QString::fromUtf8("yyyy-MM-dd_hh-mm-ss.zzz"));
                tmps = tmps + QString::fromUtf8(".wav");
-               strncpy(sound_file_name, tmps.toLocal8Bit().constData(), sizeof(sound_file_name));
+               strncpy((char *)sound_file_name, tmps.toLocal8Bit().constData(), sizeof(sound_file_name));
                // create wave file
                rec_sound_fio = new FILEIO();
                if(rec_sound_fio->Fopen(bios_path(sound_file_name), FILEIO_WRITE_BINARY)) {