OSDN Git Service

[WIN32][COMMON][CONFIG] Stop to use Junk GetPrivateProfileInt() and Get/WritePrivateP...
authorK.Ohta <whatisthis.sowhat@gmail.com>
Tue, 24 Sep 2019 21:57:26 +0000 (06:57 +0900)
committerK.Ohta <whatisthis.sowhat@gmail.com>
Tue, 24 Sep 2019 21:57:26 +0000 (06:57 +0900)
source/src/common.cpp
source/src/common.h
source/src/config.cpp

index 0683eab..7e65747 100644 (file)
@@ -346,7 +346,7 @@ void DLL_PREFIX *my_memcpy(void *dst, void *src, size_t len)
 //#endif
 
 
-#ifndef _WIN32
+//#ifndef _WIN32
 BOOL DLL_PREFIX MyWritePrivateProfileString(LPCTSTR lpAppName, LPCTSTR lpKeyName, LPCTSTR lpString, LPCTSTR lpFileName)
 {
        BOOL result = FALSE;
@@ -472,7 +472,7 @@ UINT DLL_PREFIX MyGetPrivateProfileInt(LPCTSTR lpAppName, LPCTSTR lpKeyName, INT
        //csp_logger->debug_log(CSP_LOG_DEBUG, CSP_LOG_TYPE_GENERAL, "Got Int: %d\n", i);
        return i;
 }
-#endif
+//#endif
 
 #if defined(_RGB555)
 scrntype_t DLL_PREFIX RGB_COLOR(uint32_t r, uint32_t g, uint32_t b)
index f3a7d95..94167be 100644 (file)
@@ -966,18 +966,18 @@ uint16_t DLL_PREFIX EndianFromBig_WORD(uint16_t x);
 #endif
 
 // win32 api
-#ifndef _WIN32
+//#ifndef _WIN32
        BOOL MyWritePrivateProfileString(LPCTSTR lpAppName, LPCTSTR lpKeyName, LPCTSTR lpString, LPCTSTR lpFileName);
        DWORD MyGetPrivateProfileString(LPCTSTR lpAppName, LPCTSTR lpKeyName, LPCTSTR lpDefault, LPTSTR lpReturnedString, DWORD nSize, LPCTSTR lpFileName);
        UINT MyGetPrivateProfileInt(LPCTSTR lpAppName, LPCTSTR lpKeyName, INT nDefault, LPCTSTR lpFileName);
        // used only in winmain and win32 osd class
 //     #define ZeroMemory(p,s) memset(p,0x00,s)
 //     #define CopyMemory(t,f,s) memcpy(t,f,s)
-#else
-       #define MyWritePrivateProfileString WritePrivateProfileString
-       #define MyGetPrivateProfileString GetPrivateProfileString
-       #define MyGetPrivateProfileInt GetPrivateProfileInt
-#endif
+//#else
+//     #define MyWritePrivateProfileString WritePrivateProfileString
+//     #define MyGetPrivateProfileString GetPrivateProfileString
+//     #define MyGetPrivateProfileInt GetPrivateProfileInt
+//#endif
 
 // rgb color
 #if !defined(_RGB555) && !defined(_RGB565) && !defined(_RGB888)
index 18b506b..64f9a91 100644 (file)
@@ -481,9 +481,10 @@ void DLL_PREFIX load_config(const _TCHAR *config_path)
                // Assigning joysticks.
                for(i = 0; i < 16; i++) {
                        _TCHAR name[256];
-                       my_stprintf_s(name, 256, _T("AssignedJoystick"), i + 1);
+                       memset(config.assigned_joystick_name[i], 0x00, sizeof(_TCHAR) * 256);
+                       my_stprintf_s(name, 255, _T("AssignedJoystick%d"), i + 1);
                        MyGetPrivateProfileString(_T("Qt"), (const _TCHAR *)name, _T(""),
-                                                                         config.assigned_joystick_name[i], 256, config_path);
+                                                                         _T(""), 255, config_path);
                }
 
                // Extra UI
@@ -851,7 +852,7 @@ void DLL_PREFIX save_config(const _TCHAR *config_path)
 
                for(i = 0; i < 16; i++) {
                        _TCHAR name[256];
-                       my_stprintf_s(name, 256, _T("AssignedJoystick%d"), i + 1);
+                       my_stprintf_s(name, 255, _T("AssignedJoystick%d"), i + 1);
                        MyWritePrivateProfileString(_T("Qt"), (const _TCHAR *)name, 
                                                                                config.assigned_joystick_name[i], config_path);
                }