OSDN Git Service

[CONFIG][OpenGL] Fix not effective config for renderer.
[csp-qt/common_source_project-fm7.git] / source / src / common.h
index 07abfb3..74f77f4 100644 (file)
                #endif
        #endif
 #endif
-#ifdef _USE_OT
-                       #define USE_ZLIB
-#endif
-
 // check environemnt/language
 #ifdef _WIN32
        #ifdef _MSC_VER
@@ -782,14 +778,24 @@ typedef union {
 
 uint32_t DLL_PREFIX EndianToLittle_DWORD(uint32_t x);
 uint16_t DLL_PREFIX EndianToLittle_WORD(uint16_t x);
+uint32_t DLL_PREFIX EndianFromLittle_DWORD(uint32_t x);
+uint16_t DLL_PREFIX EndianFromLittle_WORD(uint16_t x);
 
+uint32_t DLL_PREFIX EndianToBig_DWORD(uint32_t x);
+uint16_t DLL_PREFIX EndianToBig_WORD(uint16_t x);
+uint32_t DLL_PREFIX EndianFromBig_DWORD(uint32_t x);
+uint16_t DLL_PREFIX EndianFromBig_WORD(uint16_t x);
 // max/min
 #ifndef _MSC_VER
        #undef max
        #undef min
        int DLL_PREFIX max(int a, int b);
+       unsigned int DLL_PREFIX max(int a, unsigned int b);
+       unsigned int DLL_PREFIX max(unsigned int a, int b);
        unsigned int DLL_PREFIX max(unsigned int a, unsigned int b);
        int DLL_PREFIX min(int a, int b);
+       int DLL_PREFIX min(unsigned int a, int b);
+       int DLL_PREFIX min(int a, unsigned int b);
        unsigned int DLL_PREFIX min(unsigned int a, unsigned int b);
 #endif
 
@@ -966,13 +972,22 @@ uint16_t DLL_PREFIX EndianToLittle_WORD(uint16_t x);
        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))
+#if defined(__LITTLE_ENDIAN__)
+       #define RGB_COLOR(r, g, b)      (((uint32_t)(b) << 16) | ((uint32_t)(g) << 8) | ((uint32_t)(r) << 0) | (0xff << 24))
+       #define RGBA_COLOR(r, g, b, a)  (((uint32_t)(b) << 16) | ((uint32_t)(g) << 8) | ((uint32_t)(r) << 0) | ((uint32_t)(a) << 24))
+       #define R_OF_COLOR(c)           (((c)      ) & 0xff)
+       #define G_OF_COLOR(c)           (((c) >>  8) & 0xff)
+       #define B_OF_COLOR(c)           (((c) >> 16) & 0xff)
+       #define A_OF_COLOR(c)           (((c) >> 24) & 0xff)
+#else
+       #define RGB_COLOR(r, g, b)      (((uint32_t)(r) << 16) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 0) | (0xff << 24))
        #define RGBA_COLOR(r, g, b, a)  (((uint32_t)(r) << 16) | ((uint32_t)(g) << 8) | ((uint32_t)(b) << 0) | ((uint32_t)(a) << 24))
        #define R_OF_COLOR(c)           (((c) >> 16) & 0xff)
        #define G_OF_COLOR(c)           (((c) >>  8) & 0xff)
        #define B_OF_COLOR(c)           (((c)      ) & 0xff)
        #define A_OF_COLOR(c)           (((c) >> 24) & 0xff)
 #endif
+#endif
 
 inline uint64_t ExchangeEndianU64(uint64_t __in)
 {
@@ -1065,14 +1080,38 @@ typedef struct {
 } wav_header_t;
 #pragma pack()
 
+//  See http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/WAVE.html.
+#pragma pack(1)
+typedef struct {
+       wav_chunk_t riff_chunk;
+       char wave[4];
+       wav_chunk_t fmt_chunk;
+       uint16_t format_id;
+       uint16_t channels;
+       uint32_t sample_rate;
+       uint32_t data_speed;
+       uint16_t block_size;
+       uint16_t sample_bits;
+       uint16_t cbsize; // Extension size.Normaly set to 0.
+       wav_chunk_t fact_chunk; // "fact", 4.
+} wav_header_float_t;
+#pragma pack()
+
+// Use this before writing wav_data.
+bool DLL_PREFIX write_dummy_wav_header(void *__fio);
+// Use this after writng wav_data.
+bool DLL_PREFIX set_wav_header(wav_header_t *header, wav_chunk_t *first_chunk, uint16_t channels, uint32_t rate,
+                                                          uint16_t bits, size_t file_length);
+bool DLL_PREFIX load_wav_to_stereo(void *__fio, int16_t **left_buf, int16_t **right_buf, uint32_t *rate, int *got_samples);
+bool DLL_PREFIX load_wav_to_monoral(void *__fio, int16_t **buffer, uint32_t *rate, int *got_samples);
+
 // file path
 const _TCHAR *DLL_PREFIX get_application_path();
+const _TCHAR *DLL_PREFIX get_initial_current_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);
 bool DLL_PREFIX is_absolute_path(const _TCHAR *file_path);
-const _TCHAR *DLL_PREFIX create_absolute_path(const _TCHAR *file_name);
-void DLL_PREFIX create_absolute_path(_TCHAR *file_path, int length, const _TCHAR *file_name);
 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);
@@ -1090,6 +1129,8 @@ const wchar_t *DLL_PREFIX tchar_to_wchar(const _TCHAR *ts);
 
 
 // misc
+void DLL_PREFIX common_initialize();
+
 int32_t DLL_PREFIX muldiv_s32(int32_t nNumber, int32_t nNumerator, int32_t nDenominator);
 uint32_t DLL_PREFIX muldiv_u32(uint32_t nNumber, uint32_t nNumerator, uint32_t nDenominator);
 
@@ -1129,6 +1170,7 @@ typedef DLL_PREFIX struct cur_time_s {
 } cur_time_t;
 
 void DLL_PREFIX get_host_time(cur_time_t* cur_time);
+const _TCHAR DLL_PREFIX *get_lib_common_version();
 
 // symbol
 typedef struct symbol_s {