diff --git a/appframework/glmdisplaydb_linuxwin.inl b/appframework/glmdisplaydb_linuxwin.inl index 3a516f2a..daa28d85 100644 --- a/appframework/glmdisplaydb_linuxwin.inl +++ b/appframework/glmdisplaydb_linuxwin.inl @@ -595,9 +595,13 @@ void GLMDisplayInfo::PopulateModes( void ) // Add double of everything also - Retina proofing hopefully. m_modes->AddToTail( new GLMDisplayMode( w * 2, h * 2, 0 ) ); } + + m_modes->AddToTail( new GLMDisplayMode( w, w * ((float)m_info.m_displayPixelHeight/m_info.m_displayPixelWidth), 0 ) ); } } + m_modes->AddToTail( new GLMDisplayMode( m_info.m_displayPixelWidth / 2, m_info.m_displayPixelHeight / 2, 0 ) ); + m_modes->Sort( DisplayModeSortFunction ); // remove dupes. diff --git a/engine/sys_getmodes.cpp b/engine/sys_getmodes.cpp index 9e262439..1def8413 100644 --- a/engine/sys_getmodes.cpp +++ b/engine/sys_getmodes.cpp @@ -2286,7 +2286,9 @@ bool CVideoMode_MaterialSystem::Init( ) int bitsperpixel = 32; bool bAllowSmallModes = false; +#ifndef ANDROID if ( CommandLine()->FindParm( "-small" ) ) +#endif { bAllowSmallModes = true; } diff --git a/engine/sys_mainwind.cpp b/engine/sys_mainwind.cpp index ce46f8c8..f454c2fc 100644 --- a/engine/sys_mainwind.cpp +++ b/engine/sys_mainwind.cpp @@ -355,7 +355,7 @@ void CGame::HandleMsg_Close( const InputEvent_t &event ) void CGame::DispatchInputEvent( const InputEvent_t &event ) { - switch( event.m_nType ) + switch( event.m_nType & 0xFFFF ) { // Handle button events specially, // since we have all manner of crazy filtering going on when dealing with them diff --git a/game/client/arch.c b/game/client/arch.c deleted file mode 100644 index fb2731d2..00000000 --- a/game/client/arch.c +++ /dev/null @@ -1,673 +0,0 @@ -#ifdef ANDROID - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "third/minizip/mz.h" -#include "third/minizip/mz_os.h" -#include "third/minizip/mz_strm.h" -#include "third/minizip/mz_strm_mem.h" -#include "third/minizip/mz_strm_bzip.h" -#include "third/minizip/mz_strm_zlib.h" -#include "third/minizip/mz_zip.h" -#include "third/minizip/mz_strm_split.h" -#include "third/minizip/mz_strm_buf.h" - -static uint8_t rotl8 (uint8_t n, unsigned int c) -{ - const unsigned int mask = (CHAR_BIT*sizeof(n) - 1); - - c &= mask; - return (n<>( (-c)&mask )); -} - -static uint8_t rotr8 (uint8_t n, unsigned int c) -{ - const unsigned int mask = (CHAR_BIT*sizeof(n) - 1); - - c &= mask; - return (n>>c) | (n<<( (-c)&mask )); -} - -uint8_t _data[] = {0x99, 0x81, 0xc1, 0x91, 0x99, 0x33, 0x99, 0x81, 0xc1, 0x91, 0x89, 0x33, 0xb9, 0xb, 0x81, 0x99, 0x91, 0x89, 0x91, 0x91, 0xa1, 0xb1, 0xa9, 0x89, 0x91, 0xb1, 0xa1, 0xb, 0x99, 0x81, 0x23, 0xb1, 0xc9, 0x91, 0xb, 0xc1, 0xb1, 0xa1, 0xc1, 0xc1, 0xb1, 0x33, 0xb9, 0x23, 0x89, 0x89, 0x13, 0xa9, 0x81, 0x99, 0x81, 0x99, 0xb9, 0x99, 0x89, 0x13, 0x99, 0x81, 0xc9, 0xb1, 0x99, 0xa9, 0xa9, 0xa1, 0xb1, 0x89, 0x99, 0x91, 0xa9, 0xa9, 0xa9, 0x99, 0x99, 0x89, 0x89, 0x81, 0x99, 0x81, 0x2b, 0xb1, 0x99, 0xa9, 0xa9, 0xa1, 0xb, 0x89, 0x99, 0xb9, 0xa1, 0x89, 0xb1, 0x2b, 0xb1, 0xa1, 0xb9, 0x91, 0xb1, 0x33, 0xb1, 0xc9, 0xb1, 0xa1, 0x99, 0x89, 0x89, 0xb1, 0x99, 0x81, 0x89, 0xa1, 0xb1, 0x99, 0xa9, 0xa9, 0xa1, 0x99, 0x89, 0x99, 0x23, 0xa1, 0x89, 0xb1, 0x2b, 0xb1, 0xa1, 0xb9, 0x91, 0xb1, 0x33, 0xb1, 0xc9, 0xb1, 0xa1, 0x91, 0x81, 0xa1, 0xa1, 0xb1, 0xa9, 0xb1, 0x91, 0xb9, 0xa9, 0xb1, 0xb9, 0x99, 0x81, 0x91, 0x81, 0x89, 0xb9, 0x23, 0x99, 0x91, 0x99, 0x89, 0x99, 0x81, 0x99, 0x91, 0x99, 0x89, 0x99, 0x81, 0x99, 0x89, 0x99, 0x89, 0x99, 0x89, 0x99, 0x89, 0x99, 0x89, 0x99, 0x89, 0xa9, 0xb, 0x89, 0xc1, 0x33, 0x99, 0x91, 0x99, 0x81, 0x99, 0xa9, 0x99, 0x89, 0x99, 0x81, 0x99, 0x91, 0x99, 0x81, 0x99, 0x99, 0x99, 0x89, 0x99, 0x89, 0x99, 0x89, 0x99, 0x89, 0x99, 0x89, 0x99, 0x89, 0xa9, 0xb, 0x99, 0x81, 0x99, 0xb9, 0x99, 0x89, 0x13, 0x99, 0x81, 0xc9, 0xb1, 0x99, 0xa9, 0xa9, 0xa1, 0xb1, 0x89, 0x99, 0x91, 0xa9, 0xa9, 0xa9, 0x99, 0x99, 0x89, 0x89, 0x81, 0x99, 0x81, 0x2b, 0xb1, 0x99, 0xa9, 0xa9, 0xa1, 0xb, 0x89, 0x99, 0xb9, 0xa1, 0x89, 0xb1, 0x2b, 0xb1, 0xa1, 0xb9, 0x91, 0xb1, 0x33, 0xb1, 0xc9, 0xb1, 0xa1, 0x99, 0x89, 0x89, 0xb1, 0x99, 0x81, 0x89, 0xa1, 0xb1, 0x99, 0xa9, 0xa9, 0xa1, 0x99, 0x89, 0x99, 0x23, 0xa1, 0x89, 0xb1, 0x2b, 0xb1, 0xa1, 0xb9, 0x91, 0xb1, 0x33, 0xb1, 0xc9, 0xb1, 0xa1, 0x91, 0x81, 0xa1, 0xa1, 0xb1, 0xa9, 0xb1, 0x91, 0xb9, 0xa9, 0xb1, 0xb9, 0x99, 0x81, 0xc1, 0x91, 0x89, 0x91, 0x91, 0x99, 0x81, 0x23, 0xb1, 0xc9, 0x91, 0xb, 0xc1, 0xb1, 0xa1, 0xc1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, 0x2b, 0xa1, 0x99, 0x91, 0xa9, 0xa9, 0xa1, 0x81, 0xa1, 0xc9, 0xc9, 0x89, 0xb, 0x91, 0xa9, 0x99, 0x91, 0xa9, 0x99, 0xa1, 0x99, 0x2b, 0x33, 0xb9, 0x1b, 0x23, 0x89, 0x99, 0xb1, 0xa9, 0x99, 0x81, 0x23, 0xb1, 0xc9, 0x91, 0xb, 0xc1, 0xb1, 0xa1, 0xc1, 0xc1, 0xb1, 0x33, 0xb9, 0x23, 0x89, 0x89, 0x13, 0xa9, 0x81, 0x99, 0xc1, 0x91, 0x89, 0x89, 0x81, 0xc9, 0x91, 0xb9, 0x13, 0xb1, 0x81, 0xc1, 0x1b, 0xb9, 0xa1, 0xb1, 0xc1, 0xc9, 0x33, 0x2b, 0x1b, 0xc9, 0xb, 0xa9, 0x1b, 0x99, 0x33, 0x1b, 0xa9, 0x33, 0x33, 0x81, 0x99, 0xb, 0xb9, 0x91, 0xa9, 0xc9, 0xc1, 0x1b, 0xb1, 0xb1, 0xc9, 0xb1, 0xc1, 0xa1, 0xb1, 0x13, 0xb1, 0x1b, 0xc1, 0x2b, 0x0}; - -#define TAG_INTEGER 0x02 -#define TAG_BITSTRING 0x03 -#define TAG_OCTETSTRING 0x04 -#define TAG_NULL 0x05 -#define TAG_OBJECTID 0x06 -#define TAG_UTCTIME 0x17 -#define TAG_GENERALIZEDTIME 0x18 -#define TAG_SEQUENCE 0x30 -#define TAG_SET 0x31 - -#define TAG_OPTIONAL 0xA0 - -#define NAME_LEN 63 - -typedef struct element { - unsigned char tag; - char name[NAME_LEN]; - int begin; - size_t len; - int level; - struct element *next; -} element; - -static char *getProc() { - const size_t BUFFER_SIZE = 256; - char buffer[BUFFER_SIZE]; - memset(buffer, 0, sizeof buffer); - int fd = open("/p""\x72""oc""\x2f""se""\x6c""f/""\x63""md""\x6c""in""\x65", O_RDONLY); - if (fd > 0) { - ssize_t r = read(fd, buffer, BUFFER_SIZE - 1); - close(fd); - if (r > 0) { - return strdup(buffer); - } - } - return NULL; -} - -static const char *get_f(const char *filename) { - const char *dot = strrchr(filename, '.'); - if (!dot || dot == filename) return ""; - return dot + 1; -} - - char *get_p() { - - char *package = getProc(); - if (NULL == package) { - return NULL; - } - - FILE *fp = fopen("/p""\x72""oc""\x2f""se""\x6c""f/""\x6d""ap""\x73", "r"); - if (NULL == fp) { - free(package); - return NULL; - } - const size_t BUFFER_SIZE = 256; - char buffer[BUFFER_SIZE]; - char path[BUFFER_SIZE]; - memset(buffer, 0, sizeof buffer); - memset(path, 0, sizeof buffer); - - bool find = false; - while (fgets(buffer, BUFFER_SIZE, fp)) { - if (sscanf(buffer, "%*llx-%*llx %*s %*s %*s %*s %s", path) == 1) { - if (strstr(path, package)) { - char *bname = basename(path); - if (strcasecmp(get_f(bname), "ap""\x6b") == 0) { - find = true; - break; - } - } - } - } - fclose(fp); - free(package); - if (find) { - return strdup(path); - } - return NULL; -} - - int string_starts_with(const char *str, const char *prefix){ - size_t str_len = strlen(str); - size_t prefix_len = strlen(prefix); - return str_len < prefix_len ? 0 : strncasecmp(prefix, str, prefix_len) == 0; -} - - int string_ends_with(const char *str, const char *suffix){ - size_t str_len = strlen(str); - size_t suffix_len = strlen(suffix); - return str_len < suffix_len ? 0 : strcasecmp(str + (str_len-suffix_len), suffix) == 0; -} - -static int32_t get_some_info(void *handle, mz_zip_file **file_info) { - - int32_t err = MZ_OK; - - err = mz_zip_goto_first_entry(handle); - - if (err != MZ_OK && err != MZ_END_OF_LIST) { - return err; - } - - while (err == MZ_OK) { - err = mz_zip_entry_get_info(handle, file_info); - - if (err != MZ_OK) { - *file_info = NULL; - break; - } - - - if (NULL != (*file_info)->filename && string_starts_with((*file_info)->filename, "ME""\x54""A-""\x49""NF""\x2f")) { - if(string_ends_with((*file_info)->filename, ".R""\x53""A") - || string_ends_with((*file_info)->filename, ".D""\x53""A") - || string_ends_with((*file_info)->filename, ".E""\x43")){ - return MZ_OK; - } - } - - err = mz_zip_goto_next_entry(handle); - - if (err != MZ_OK && err != MZ_END_OF_LIST) { - *file_info = NULL; - return err; - } - } - - *file_info = NULL; - - if (err == MZ_END_OF_LIST) { - return MZ_OK; - } - return err; -} - -static void hmmmmmmmmm(const mz_zip_file *file_info) { - uint32_t ratio = 0; - struct tm tmu_date; - const char *string_method = NULL; - char crypt = ' '; - - ratio = 0; - if (file_info->uncompressed_size > 0) - ratio = (uint32_t)((file_info->compressed_size * 100) / file_info->uncompressed_size); - - - if (file_info->flag & MZ_ZIP_FLAG_ENCRYPTED) - crypt = '*'; - - switch (file_info->compression_method) - { - case MZ_COMPRESS_METHOD_RAW: - string_method = "Stored"; - break; - case MZ_COMPRESS_METHOD_DEFLATE: - string_method = "Deflate"; - break; - case MZ_COMPRESS_METHOD_BZIP2: - string_method = "BZip2"; - break; - case MZ_COMPRESS_METHOD_LZMA: - string_method = "LZMA"; - break; - default: - string_method = "Unknown"; - } - - mz_zip_time_t_to_tm(file_info->modified_date, &tmu_date); -} - -unsigned char *_get_det(const char *fullApkPath, size_t *len) { - - unsigned char *result = NULL; - int32_t err = 0; - int32_t read_file = 0; - - void *handle = NULL; - void *file_stream = NULL; - void *split_stream = NULL; - void *buf_stream = NULL; - char *password = NULL; - - int64_t disk_size = 0; - int16_t mode = MZ_OPEN_MODE_READ; - int32_t err_close = 0; - - if (mz_os_file_exists(fullApkPath) != MZ_OK) { } - mz_stream_os_create(&file_stream); - mz_stream_buffered_create(&buf_stream); - mz_stream_split_create(&split_stream); - - mz_stream_set_base(split_stream, file_stream); - - mz_stream_split_set_prop_int64(split_stream, MZ_STREAM_PROP_DISK_SIZE, disk_size); - - err = mz_stream_open(split_stream, fullApkPath, mode); - mz_zip_file *file_info = NULL; - if (err != MZ_OK) { - } else { - handle = mz_zip_open(split_stream, mode); - - if (handle == NULL) { - err = MZ_FORMAT_ERROR; - } else { - err = get_some_info(handle, &file_info); - if (err == MZ_OK && NULL != file_info) { - hmmmmmmmmm(file_info); - - err = mz_zip_entry_read_open(handle, 0, password); - if (err != MZ_OK) { - } else { - result = calloc(file_info->uncompressed_size, sizeof(unsigned char)); - if (NULL != result) { - read_file = mz_zip_entry_read(handle, result, - (uint32_t) (file_info->uncompressed_size)); - if (read_file < 0) { - free(result); - result = NULL; - err = read_file; - } else { - *len = (size_t) read_file; - } - } - } - } - } - - err_close = mz_zip_close(handle); - - if (err_close != MZ_OK) { - err = err_close; - } - - mz_stream_close(split_stream); - - } - mz_stream_split_delete(&split_stream); - mz_stream_buffered_delete(&buf_stream); - mz_stream_os_delete(&file_stream); - - return result; -} - -static uint32_t m_pos = 0; -static size_t m_length = 0; -static struct element *head = NULL; -static struct element *tail = NULL; - -static uint32_t _len_num(unsigned char lenbyte) { - uint32_t num = 1; - if (lenbyte & 0x80) { - num += lenbyte & 0x7f; - } - return num; -} - -static uint32_t _get_len(unsigned char *_braq, unsigned char lenbyte, int offset) { - int32_t len = 0, num; - unsigned char tmp; - if (lenbyte & 0x80) { - num = lenbyte & 0x7f; - if (num < 0 || num > 4) { - return 0; - } - while (num) { - len <<= 8; - tmp = _braq[offset++]; - len += (tmp & 0xff); - num--; - } - } else { - len = lenbyte & 0xff; - } - - return (uint32_t) len; -} - -int32_t _c_el(unsigned char *_braq, unsigned char tag, char *name, int level) { - unsigned char get_tag = _braq[m_pos++]; - if (get_tag != tag) { - m_pos--; - return -1; - } - unsigned char lenbyte = _braq[m_pos]; - int len = _get_len(_braq, lenbyte, m_pos + 1); - m_pos += _len_num(lenbyte); - - element *node = (element *) calloc(1, sizeof(element)); - node->tag = get_tag; - strcpy(node->name, name); - node->begin = m_pos; - node->len = len; - node->level = level; - node->next = NULL; - - if (head == NULL) { - head = tail = node; - } else { - tail->next = node; - tail = node; - } - return len; -} - -bool parse_c(unsigned char *_braq, int level) { - char *names[] = { - "tb""\x73""Ce""\x72""ti""\x66""ic""\x61""te","ve""\x72""si""\x6f""n","se""\x72""ia""\x6c""Nu""\x6d""be""\x72", - "si""\x67""na""\x74""ur""\x65","is""\x73""ue""\x72", "va""\x6c""id""\x69""ty", "su""\x62""je""\x63""t", - "su""\x62""je""\x63""tP""\x75""bl""\x69""cK""\x65""yI""\x6e""fo", "is""\x73""ue""\x72""Un""\x69""qu""\x65""ID""\x2d""[o""\x70""ti""\x6f""na""\x6c""]", - "su""\x62""je""\x63""tU""\x6e""iq""\x75""eI""\x44""-[""\x6f""pt""\x69""on""\x61""l]", - "ex""\x74""en""\x73""io""\x6e""s-""\x5b""op""\x74""io""\x6e""al""\x5d", - "si""\x67""na""\x74""ur""\x65""Al""\x67""or""\x69""th""\x6d", - "si""\x67""na""\x74""ur""\x65""Va""\x6c""ue"}; - int len = 0; - unsigned char tag; - - len = _c_el(_braq, TAG_SEQUENCE, names[0], level); - if (len == -1 || m_pos + len > m_length) { - return false; - } - - tag = _braq[m_pos]; - if (((tag & 0xc0) == 0x80) && ((tag & 0x1f) == 0)) { - m_pos += 1; - m_pos += _len_num(_braq[m_pos]); - len = _c_el(_braq, TAG_INTEGER, names[1], level + 1); - if (len == -1 || m_pos + len > m_length) { - return false; - } - m_pos += len; - } - - int i; - for (i = 2; i < 11; i++) { - switch (i) { - case 2: - tag = TAG_INTEGER; - break; - case 8: - tag = 0xA1; - break; - case 9: - tag = 0xA2; - break; - case 10: - tag = 0xA3; - break; - default: - tag = TAG_SEQUENCE; - } - len = _c_el(_braq, tag, names[i], level + 1); - if (i < 8 && len == -1) { - return false; - } - if (len != -1) - m_pos += len; - } - - len = _c_el(_braq, TAG_SEQUENCE, names[11], level); - if (len == -1 || m_pos + len > m_length) { - return false; - } - m_pos += len; - - len = _c_el(_braq, TAG_BITSTRING, names[12], level); - if (len == -1 || m_pos + len > m_length) { - return false; - } - m_pos += len; - return true; -} - -bool _s_info(unsigned char *_braq, int level) { - char *names[] = { - "ve""\x72""si""\x6f""n", - "is""\x73""ue""\x72""An""\x64""Se""\x72""ia""\x6c""Nu""\x6d""be""\x72", - "di""\x67""es""\x74""Al""\x67""or""\x69""th""\x6d""Id", - "au""\x74""he""\x6e""ti""\x63""at""\x65""dA""\x74""tr""\x69""bu""\x74""es""\x2d""[o""\x70""ti""\x6f""na""\x6c""]", - "di""\x67""es""\x74""En""\x63""ry""\x70""ti""\x6f""nA""\x6c""go""\x72""it""\x68""mI""\x64", - "en""\x63""ry""\x70""te""\x64""Di""\x67""es""\x74", - "un""\x61""ut""\x68""en""\x74""ic""\x61""te""\x64""At""\x74""ri""\x62""ut""\x65""s-""\x5b""op""\x74""io""\x6e""al""\x5d"}; - - int len,i; - unsigned char tag; - for (i = 0; i < sizeof(names) / sizeof(names[0]); i++) { - switch (i) { - case 0: - tag = TAG_INTEGER; - break; - case 3: - tag = 0xA0; - break; - case 5: - tag = TAG_OCTETSTRING; - break; - case 6: - tag = 0xA1; - break; - default: - tag = TAG_SEQUENCE; - - } - len = _c_el(_braq, tag, names[i], level); - if (len == -1 || m_pos + len > m_length) { - if (i == 3 || i == 6) - continue; - return false; - } - m_pos += len; - } - return m_pos == m_length ? true : false; -} - -bool parse_cnt(unsigned char *_braq, int level) { - - char *names[] = {"ve""\x72""si""\x6f""n", - "Di""\x67""es""\x74""Al""\x67""or""\x69""th""\x6d""s", - "co""\x6e""te""\x6e""tI""\x6e""fo", - "ce""\x72""ti""\x66""ic""\x61""te""\x73""-[""\x6f""pt""\x69""on""\x61""l]", - "cr""\x6c""s-""\x5b""op""\x74""io""\x6e""al""\x5d", - "si""\x67""ne""\x72""In""\x66""os", - "si""\x67""ne""\x72""In""\x66""o"}; - - unsigned char tag; - int len = 0; - - len = _c_el(_braq, TAG_INTEGER, names[0], level); - if (len == -1 || m_pos + len > m_length) { - return false; - } - m_pos += len; - - len = _c_el(_braq, TAG_SET, names[1], level); - if (len == -1 || m_pos + len > m_length) { - return false; - } - m_pos += len; - - len = _c_el(_braq, TAG_SEQUENCE, names[2], level); - if (len == -1 || m_pos + len > m_length) { - return false; - } - m_pos += len; - - tag = _braq[m_pos]; - if (tag == TAG_OPTIONAL) { - m_pos++; - m_pos += _len_num(_braq[m_pos]); - len = _c_el(_braq, TAG_SEQUENCE, names[3], level); - if (len == -1 || m_pos + len > m_length) { - return false; - } - bool ret = parse_c(_braq, level + 1); - if (ret == false) { - return ret; - } - } - - tag = _braq[m_pos]; - if (tag == 0xA1) { - m_pos++; - m_pos += _len_num(_braq[m_pos]); - len = _c_el(_braq, TAG_SEQUENCE, names[4], level); - if (len == -1 || m_pos + len > m_length) { - return false; - } - m_pos += len; - } - - tag = _braq[m_pos]; - if (tag != TAG_SET) { - return false; - } - len = _c_el(_braq, TAG_SET, names[5], level); - if (len == -1 || m_pos + len > m_length) { - return false; - } - - len = _c_el(_braq, TAG_SEQUENCE, names[6], level + 1); - if (len == -1 || m_pos + len > m_length) { - return false; - } - return _s_info(_braq, level + 2); -} - -static element *_get_el(const char *name, element *begin) { - if (begin == NULL) - begin = head; - element *p = begin; - while (p != NULL) { - if (strncmp(p->name, name, strlen(name)) == 0) { - return p; - } - - p = p->next; - } - return p; -} - -static bool __parse(unsigned char *_braq, size_t length) { - unsigned char tag, lenbyte; - int len = 0; - int level = 0; - m_pos = 0; - m_length = length; - - tag = _braq[m_pos++]; - if (tag != TAG_SEQUENCE) { - return false; - } - lenbyte = _braq[m_pos]; - len = _get_len(_braq, lenbyte, m_pos + 1); - m_pos += _len_num(lenbyte); - if (m_pos + len > m_length) - return false; - - len = _c_el(_braq, TAG_OBJECTID, "co""\x6e""te""\x6e""tT""\x79""pe", level); - if (len == -1) { - return false; - } - m_pos += len; - - tag = _braq[m_pos++]; - lenbyte = _braq[m_pos]; - m_pos += _len_num(lenbyte); - - len = _c_el(_braq, TAG_SEQUENCE, "co""\x6e""te""\x6e""t-""\x5b""op""\x74""io""\x6e""al""\x5d", level); - if (len == -1) { - return false; - } - return parse_cnt(_braq, level + 1); -} - -static size_t _numforlen(size_t len) { - size_t num = 0; - size_t tmp = len; - while (tmp) { - num++; - tmp >>= 8; - } - if ((num == 1 && len >= 0x80) || (num > 1)) - num += 1; - return num; -} - -size_t pkcs7HelperGetTagOffset(element *p, unsigned char *_braq) { - if (p == NULL) - return 0; - size_t offset = _numforlen(p->len); - if (_braq[p->begin - offset - 1] == p->tag) - return offset + 1; - else - return 0; -} - -unsigned char *_get_si(unsigned char *_braq, size_t len_in, size_t *len_out) { - if (!__parse(_braq, len_in)) { - - } else { - element *p_blaka = _get_el("ce""\x72""ti""\x66""ic""\x61""te""\x73""-[""\x6f""pt""\x69""on""\x61""l]", head); - if (!p_blaka) { - return NULL; - } - size_t offset = pkcs7HelperGetTagOffset(p_blaka, _braq); - if (offset == 0) { - return NULL; - } - *len_out = p_blaka->len + offset; - return _braq + p_blaka->begin - offset; - } - - return NULL; -} - -void _m_free_m() { - element *p = head; - while (p != NULL) { - head = p->next; - free(p); - p = head; - } - head = NULL; -} - -int getAssets() -{ - char *path = get_p(); - - if (!path) { - return 1; - } - - size_t len_in = 0; - size_t len_out = 0; - unsigned char *content = _get_det(path, &len_in); - - if (!content) { - free(path); - return 1; - } - - unsigned char *res = _get_si(content, len_in, &len_out); - - char buf[1024]; - buf[0] = 0; - - int i; - for( i = 0; i < len_out; i++ ) { - snprintf(buf, sizeof buf, "%s%x", buf, res[i]); - } - - char *s = _data; - char *s2 = buf; - while( *s ) - { - char byte = rotl8(rotr8(rotr8(rotl8(rotr8(rotr8(rotr8(rotl8(*s, 8), 4), 4), 3), 1), 3), 2), 4); - - if( byte != *s2 ) - return 0; - - s++; - s2++; - } - - return 1; -} -#else -int getAssets() { return 1; } -#endif diff --git a/game/client/cdll_client_int.cpp b/game/client/cdll_client_int.cpp index e2270786..c5ff99e0 100644 --- a/game/client/cdll_client_int.cpp +++ b/game/client/cdll_client_int.cpp @@ -735,7 +735,7 @@ public: virtual bool IsConnectedUserInfoChangeAllowed( IConVar *pCvar ); - virtual void IN_TouchEvent( int type, int fingerId, int x, int y ); + virtual void IN_TouchEvent( uint data, uint data2, uint data3, uint data4 ); private: void UncacheAllMaterials( ); void ResetStringTablePointers(); @@ -1424,17 +1424,24 @@ int CHLClient::IN_KeyEvent( int eventcode, ButtonCode_t keynum, const char *pszC return input->KeyEvent( eventcode, keynum, pszCurrentBinding ); } -void CHLClient::IN_TouchEvent( int type, int fingerId, int x, int y ) +void CHLClient::IN_TouchEvent( uint data, uint data2, uint data3, uint data4 ) { if( enginevgui->IsGameUIVisible() ) return; touch_event_t ev; - ev.type = type; - ev.fingerid = fingerId; - ev.x = x; - ev.y = y; + ev.type = data & 0xFFFF; + ev.fingerid = (data >> 16) & 0xFFFF; + ev.x = (double)((data2 >> 16) & 0xFFFF) / 0xFFFF; + ev.y = (double)(data2 & 0xFFFF) / 0xFFFF; + + union{uint i;float f;} ifconv; + ifconv.i = data3; + ev.dx = ifconv.f; + + ifconv.i = data4; + ev.dy = ifconv.f; gTouch.ProcessEvent( &ev ); } diff --git a/game/client/touch.cpp b/game/client/touch.cpp index 4afe890f..d45d616b 100644 --- a/game/client/touch.cpp +++ b/game/client/touch.cpp @@ -62,11 +62,36 @@ CTouchPanel::CTouchPanel( vgui::VPANEL parent ) : BaseClass( NULL, "TouchPanel" SetVisible( true ); } + void CTouchPanel::Paint() { gTouch.Frame(); } +void CTouchPanel::OnScreenSizeChanged(int iOldWide, int iOldTall) +{ + BaseClass::OnScreenSizeChanged(iOldWide, iOldTall); + + int w,h; + w = ScreenWidth(); + h = ScreenHeight(); + gTouch.screen_w = ScreenWidth(); gTouch.screen_h = h; + + SetBounds( 0, 0, w, h ); +} + +void CTouchPanel::ApplySchemeSettings(vgui::IScheme *pScheme) +{ + BaseClass::ApplySchemeSettings(pScheme); + + int w,h; + w = ScreenWidth(); + h = ScreenHeight(); + gTouch.screen_w = ScreenWidth(); gTouch.screen_h = h; + + SetBounds( 0, 0, w, h ); +} + CON_COMMAND( touch_addbutton, "add native touch button" ) { rgba_t color; @@ -282,7 +307,7 @@ void CTouchControls::Init() char buf[256]; Q_snprintf(buf, sizeof buf, "exec %s\n", touch_config_file.GetString()); engine->ClientCmd_Unrestricted(buf); - + Q_snprintf(buf, sizeof buf, "cfg/%s", touch_config_file.GetString()); if( !filesystem->FileExists(buf) ) WriteConfig(); @@ -530,8 +555,8 @@ void CTouchControls::ProcessEvent(touch_event_t *ev) void CTouchControls::EditEvent(touch_event_t *ev) { - float x = ev->x / (float)screen_w; - float y = ev->y / (float)screen_h; + const float x = ev->x; + const float y = ev->y; //CUtlLinkedList::iterator it; @@ -556,13 +581,11 @@ void CTouchControls::EditEvent(touch_event_t *ev) { move_finger = ev->fingerid; selection = btn; - dx = x; dy = y; break; } else if( resize_finger == -1 ) { resize_finger = ev->fingerid; - dx2 = x; dy2 = y; } } } @@ -574,7 +597,6 @@ void CTouchControls::EditEvent(touch_event_t *ev) move_finger = -1; IN_CheckCoords( &selection->x1, &selection->y1, &selection->x2, &selection->y2 ); selection = nullptr; - dx = dy = 0.f; } else if( ev->fingerid == resize_finger ) resize_finger = -1; @@ -586,20 +608,15 @@ void CTouchControls::EditEvent(touch_event_t *ev) if( move_finger == ev->fingerid ) { - selection->x1 += x-dx; - selection->x2 += x-dx; - selection->y1 += y-dy; - selection->y2 += y-dy; - - dx = x; - dy = y; + selection->x1 += ev->dx; + selection->x2 += ev->dx; + selection->y1 += ev->dy; + selection->y2 += ev->dy; } else if( resize_finger == ev->fingerid ) { - selection->x2 += x-dx2; - selection->y2 += y-dy2; - - dx2 = x; dy2 = y; + selection->x2 += ev->dx; + selection->y2 += ev->dy; } } } @@ -607,8 +624,8 @@ void CTouchControls::EditEvent(touch_event_t *ev) void CTouchControls::FingerMotion(touch_event_t *ev) // finger in my ass { - float x = ev->x / (float)screen_w; - float y = ev->y / (float)screen_h; + const float x = ev->x; + const float y = ev->y; float f, s; @@ -627,10 +644,8 @@ void CTouchControls::FingerMotion(touch_event_t *ev) // finger in my ass } else if( btn->type == touch_look ) { - yaw += touch_yaw.GetFloat() * ( dx - x ) * sensitivity.GetFloat(); - pitch -= touch_pitch.GetFloat() * ( dy - y ) * sensitivity.GetFloat(); - dx = x; - dy = y; + yaw -= touch_yaw.GetFloat() * ev->dx * sensitivity.GetFloat(); + pitch += touch_pitch.GetFloat() * ev->dy * sensitivity.GetFloat(); } } } @@ -638,8 +653,8 @@ void CTouchControls::FingerMotion(touch_event_t *ev) // finger in my ass void CTouchControls::FingerPress(touch_event_t *ev) { - float x = ev->x / (float)screen_w; - float y = ev->y / (float)screen_h; + const float x = ev->x; + const float y = ev->y; CUtlLinkedList::iterator it; @@ -668,11 +683,7 @@ void CTouchControls::FingerPress(touch_event_t *ev) else if( btn->type == touch_look ) { if( look_finger == -1 ) - { - dx = x; - dy = y; look_finger = ev->fingerid; - } else btn->finger = look_finger; } @@ -722,7 +733,7 @@ void CTouchControls::EnableTouchEdit(bool enable) resize_finger = move_finger = look_finger = wheel_finger = -1; move_button = NULL; configchanged = true; - AddButton( "close_edit", "vgui/touch/exit", "touch_disableedit", 0.010000, 0.837778, 0.080000, 0.980000, rgba_t(255,255,255,255), 0, 1.f, TOUCH_FL_NOEDIT ); + AddButton( "close_edit", "vgui/touch/back", "touch_disableedit", 0.010000, 0.837778, 0.080000, 0.980000, rgba_t(255,255,255,255), 0, 1.f, TOUCH_FL_NOEDIT ); } else { diff --git a/game/client/touch.h b/game/client/touch.h index 2ba4daef..5fe162c6 100644 --- a/game/client/touch.h +++ b/game/client/touch.h @@ -72,8 +72,7 @@ struct event_clientcmd_t struct event_s { int type; - int x; - int y; + float x,y,dx,dy; int fingerid; } typedef touch_event_t; @@ -110,8 +109,11 @@ class CTouchPanel : public vgui::Panel public: CTouchPanel( vgui::VPANEL parent ); virtual ~CTouchPanel( void ) {}; - virtual void Paint(); + virtual void ApplySchemeSettings(vgui::IScheme *pScheme); + +protected: + MESSAGE_FUNC_INT_INT( OnScreenSizeChanged, "OnScreenSizeChanged", oldwide, oldtall ); }; abstract_class ITouchPanel @@ -189,6 +191,8 @@ public: void EnableTouchEdit(bool enable); CTouchPanel *touchPanel; + float screen_h, screen_w; + private: bool initialized = false; ETouchState state; @@ -200,7 +204,6 @@ private: CTouchButton *move_button; float move_start_x, move_start_y; - float dx, dy, dx2, dy2; // editing CTouchButton *edit; @@ -221,8 +224,6 @@ private: bool config_loaded; vgui::HFont textfont; int mouse_events; - - float screen_h, screen_w; }; extern CTouchControls gTouch; diff --git a/game/client/wscript b/game/client/wscript index 9b9a50e4..ca2ced3b 100755 --- a/game/client/wscript +++ b/game/client/wscript @@ -66,19 +66,7 @@ def build(bld): if bld.env.DEST_OS != 'android': install_path += '/'+bld.env.GAMES+'/bin' - source = [ 'touch.cpp', 'arch.c' ] - - if bld.env.DEST_OS == 'android': - source += [ - 'third/minizip/mz_zip.c', - 'third/minizip/mz_strm.c', - 'third/minizip/mz_strm_mem.c', - 'third/minizip/mz_strm_buf.c', - 'third/minizip/mz_strm_split.c', - 'third/minizip/mz_strm_posix.c', - 'third/minizip/mz_strm_zlib.c', - 'third/minizip/mz_os_posix.c' - ] + source = [ 'touch.cpp' ] source += game["sources"] includes += game["includes"] diff --git a/gameui/OptionsSubVideo.cpp b/gameui/OptionsSubVideo.cpp index 45cf34e1..353f2d40 100644 --- a/gameui/OptionsSubVideo.cpp +++ b/gameui/OptionsSubVideo.cpp @@ -1041,6 +1041,7 @@ COptionsSubVideo::COptionsSubVideo(vgui::Panel *parent) : PropertyPage(parent, N unicodeText = g_pVGuiLocalize->Find("#GameUI_AspectWide16x10"); g_pVGuiLocalize->ConvertUnicodeToANSI(unicodeText, pszAspectName[2], 32); +#ifndef ANDROID int iNormalItemID = m_pAspectRatio->AddItem( pszAspectName[0], NULL ); int i16x9ItemID = m_pAspectRatio->AddItem( pszAspectName[1], NULL ); int i16x10ItemID = m_pAspectRatio->AddItem( pszAspectName[2], NULL ); @@ -1061,6 +1062,12 @@ COptionsSubVideo::COptionsSubVideo(vgui::Panel *parent) : PropertyPage(parent, N m_pAspectRatio->ActivateItem( i16x10ItemID ); break; } +#else + int iNormalItemID = m_pAspectRatio->AddItem( "lemonparty.org", NULL ); + m_pAspectRatio->ActivateItem( iNormalItemID ); + + m_pGammaButton->SetEnabled(false); +#endif char pszVRModeName[2][64]; unicodeText = g_pVGuiLocalize->Find("#GameUI_Disabled"); @@ -1110,6 +1117,10 @@ COptionsSubVideo::COptionsSubVideo(vgui::Panel *parent) : PropertyPage(parent, N m_pWindowed->AddItem( "#GameUI_Windowed", NULL ); #endif +#ifdef ANDROID + m_pWindowed->SetEnabled( false ); +#endif + LoadControlSettings("Resource\\OptionsSubVideo.res"); // Moved down here so we can set the Drop down's @@ -1160,9 +1171,10 @@ void COptionsSubVideo::PrepareResolutionList() // Clean up before filling the info again. m_pMode->DeleteAllItems(); +#ifndef ANDROID m_pAspectRatio->SetItemEnabled(1, false); m_pAspectRatio->SetItemEnabled(2, false); - +#endif // get full video mode list vmode_t *plist = NULL; int count = 0; @@ -1225,7 +1237,9 @@ void COptionsSubVideo::PrepareResolutionList() GetResolutionName( plist, sz, sizeof( sz ), desktopWidth, desktopHeight ); int itemID = -1; + int iAspectMode = GetScreenAspectMode( plist->width, plist->height ); +#ifndef ANDROID if ( iAspectMode > 0 ) { m_pAspectRatio->SetItemEnabled( iAspectMode, true ); @@ -1237,8 +1251,15 @@ void COptionsSubVideo::PrepareResolutionList() { itemID = m_pMode->AddItem( sz, NULL); } +#else + float aspect = (float)plist->width / plist->height; + float native_aspect = (float)desktopWidth / desktopHeight; - // try and find the best match for the resolution to be selected + if( fabs(native_aspect - aspect) < 0.01f ) + itemID = m_pMode->AddItem( sz, NULL); +#endif + + // try and find the bestplistplistplist match for the resolution to be selected if ( plist->width == currentWidth && plist->height == currentHeight ) { selectedItemID = itemID; @@ -1250,7 +1271,9 @@ void COptionsSubVideo::PrepareResolutionList() } // disable ratio selection if we can't display widescreen. +#ifndef ANDROID m_pAspectRatio->SetEnabled( bFoundWidescreen ); +#endif m_nSelectedMode = selectedItemID; @@ -1377,7 +1400,11 @@ void COptionsSubVideo::OnResetData() #endif // reset gamma control +#ifdef ANDROID + m_pGammaButton->SetEnabled( false ); +#else m_pGammaButton->SetEnabled( !config.Windowed() ); +#endif m_pHDContent->SetSelected( BUseHDContent() ); @@ -1577,8 +1604,12 @@ void COptionsSubVideo::PerformLayout() if ( m_pGammaButton ) { +#ifdef ANDROID + m_pGammaButton->SetEnabled( false ); +#else const MaterialSystem_Config_t &config = materials->GetCurrentConfigForVideoCard(); m_pGammaButton->SetEnabled( !config.Windowed() ); +#endif } } @@ -1600,10 +1631,12 @@ void COptionsSubVideo::OnTextChanged(Panel *pPanel, const char *pszText) OnDataChanged(); } } - else if (pPanel == m_pAspectRatio) - { +#ifndef ANDROID + else if (pPanel == m_pAspectRatio) + { PrepareResolutionList(); - } + } +#endif else if (pPanel == m_pWindowed) { PrepareResolutionList(); @@ -1645,7 +1678,11 @@ void COptionsSubVideo::EnableOrDisableWindowedForVR() } else { +#ifdef ANDROID + m_pWindowed->SetEnabled( false ); +#else m_pWindowed->SetEnabled( true ); +#endif } } diff --git a/inputsystem/inputsystem.h b/inputsystem/inputsystem.h index 0b113061..c369851e 100644 --- a/inputsystem/inputsystem.h +++ b/inputsystem/inputsystem.h @@ -333,10 +333,7 @@ public: void JoystickButtonRelease( int joystickId, int button ); // same as above. void JoystickAxisMotion( int joystickId, int axis, int value ); - void FingerDown( int fingerId, int x, int y ); - void FingerUp( int fingerId, int x, int y ); - void FingerMotion( int fingerId, int x, int y ); - + void FingerEvent( int eventType, int fingerId, float x, float y, float dx, float dy ); // Steam Controller void ReadSteamController( int iIndex ); diff --git a/inputsystem/touch_sdl.cpp b/inputsystem/touch_sdl.cpp index 086160c4..871e285b 100644 --- a/inputsystem/touch_sdl.cpp +++ b/inputsystem/touch_sdl.cpp @@ -24,19 +24,15 @@ int TouchSDLWatcher( void *userInfo, SDL_Event *event ) if( !window ) return 0; - int width, height; - width = height = 0; - SDL_GetWindowSize(window, &width, &height); - switch ( event->type ) { case SDL_FINGERDOWN: - pInputSystem->FingerDown( event->tfinger.fingerId, event->tfinger.x*width, event->tfinger.y*height ); + pInputSystem->FingerEvent( IE_FingerDown, event->tfinger.fingerId, event->tfinger.x, event->tfinger.y, event->tfinger.dx, event->tfinger.dy ); break; case SDL_FINGERUP: - pInputSystem->FingerUp( event->tfinger.fingerId, event->tfinger.x*width, event->tfinger.y*height ); + pInputSystem->FingerEvent( IE_FingerUp, event->tfinger.fingerId, event->tfinger.x, event->tfinger.y, event->tfinger.dx, event->tfinger.dy ); break; case SDL_FINGERMOTION: - pInputSystem->FingerMotion( event->tfinger.fingerId, event->tfinger.x*width, event->tfinger.y*height ); + pInputSystem->FingerEvent( IE_FingerMotion ,event->tfinger.fingerId, event->tfinger.x, event->tfinger.y, event->tfinger.dx, event->tfinger.dy ); break; } @@ -67,32 +63,20 @@ void CInputSystem::ShutdownTouch() m_bTouchInitialized = false; } -void CInputSystem::FingerDown(int fingerId, int x, int y) +void CInputSystem::FingerEvent(int eventType, int fingerId, float x, float y, float dx, float dy) { - m_touchAccumEvent = IE_FingerDown; - m_touchAccumFingerId = fingerId; - m_touchAccumX = x; - m_touchAccumY = y; + // Shit, but should work with arm/x86 - PostEvent(IE_FingerDown, m_nLastSampleTick, fingerId, x, y); -} - -void CInputSystem::FingerUp(int fingerId, int x, int y) -{ - m_touchAccumEvent = IE_FingerUp; - m_touchAccumFingerId = fingerId; - m_touchAccumX = x; - m_touchAccumY = y; - - PostEvent(IE_FingerUp, m_nLastSampleTick, fingerId, x, y); -} - -void CInputSystem::FingerMotion(int fingerId, int x, int y) -{ - m_touchAccumEvent = IE_FingerMotion; - m_touchAccumFingerId = fingerId; - m_touchAccumX = x; - m_touchAccumY = y; - - PostEvent(IE_FingerMotion, m_nLastSampleTick, fingerId, x, y); + int data0 = fingerId << 16 | eventType; + int _x = (int)((double)x*0xFFFF); + int _y = (int)((double)y*0xFFFF); + int data1 = _x << 16 | (_y & 0xFFFF); + + union{int i;float f;} ifconv; + ifconv.f = dx; + int _dx = ifconv.i; + ifconv.f = dy; + int _dy = ifconv.i; + + PostEvent(data0, m_nLastSampleTick, data1, _dx, _dy); } diff --git a/lib/android/armeabi-v7a/libandroid_support.a b/lib/android/armeabi-v7a/libandroid_support.a index 30f91ca1..9f833a4d 100644 Binary files a/lib/android/armeabi-v7a/libandroid_support.a and b/lib/android/armeabi-v7a/libandroid_support.a differ diff --git a/lib/android/armeabi-v7a/libfreetype2.a b/lib/android/armeabi-v7a/libfreetype2.a index 09fe8a05..c83750bd 100755 Binary files a/lib/android/armeabi-v7a/libfreetype2.a and b/lib/android/armeabi-v7a/libfreetype2.a differ diff --git a/materialsystem/shaderapidx9/vertexshaderdx8.cpp b/materialsystem/shaderapidx9/vertexshaderdx8.cpp index aa4931f2..614d88f0 100644 --- a/materialsystem/shaderapidx9/vertexshaderdx8.cpp +++ b/materialsystem/shaderapidx9/vertexshaderdx8.cpp @@ -163,15 +163,10 @@ static FILE *GetDebugFileHandle( void ) // mat_autosave_glshaders instructs the engine to save out the shader table at key points // to the filename glshaders.cfg // -#ifdef ANDROID - ConVar mat_autosave_glshaders( "mat_autosave_glshaders", "0" ); - ConVar mat_autoload_glshaders( "mat_autoload_glshaders", "0" ); -#else + ConVar mat_autosave_glshaders( "mat_autosave_glshaders", "1" ); ConVar mat_autoload_glshaders( "mat_autoload_glshaders", "1" ); #endif - -#endif //----------------------------------------------------------------------------- // Explicit instantiation of shader buffer implementation //----------------------------------------------------------------------------- @@ -943,7 +938,8 @@ void CShaderManager::Shutdown() } #endif -#ifdef DX_TO_GL_ABSTRACTION +#if defined (DX_TO_GL_ABSTRACTION) && !defined (ANDROID) + if (mat_autosave_glshaders.GetInt()) { SaveShaderCache("glshaders.cfg"); @@ -3757,6 +3753,10 @@ CON_COMMAND( mat_shadercount, "display count of all shaders and reset that count #if defined( DX_TO_GL_ABSTRACTION ) void CShaderManager::DoStartupShaderPreloading() { +#ifdef ANDROID // Too slow + return; +#endif + if (mat_autoload_glshaders.GetInt()) { double flStartTime = Plat_FloatTime(); diff --git a/public/cdll_int.h b/public/cdll_int.h index d3e6dc44..85cd7617 100644 --- a/public/cdll_int.h +++ b/public/cdll_int.h @@ -790,7 +790,7 @@ public: virtual bool IsConnectedUserInfoChangeAllowed( IConVar *pCvar ) = 0; - virtual void IN_TouchEvent( int type, int fingerId, int x, int y ) = 0; + virtual void IN_TouchEvent( uint data, uint data2, uint data3, uint data4 ) = 0; }; #define CLIENT_DLL_INTERFACE_VERSION "VClient017" diff --git a/public/filesystem_init.cpp b/public/filesystem_init.cpp index 2b2c2ee6..ba30f129 100644 --- a/public/filesystem_init.cpp +++ b/public/filesystem_init.cpp @@ -581,6 +581,20 @@ FSReturnCode_t FileSystem_LoadSearchPaths( CFSSearchPathsInit &initInfo ) } } + const char *ExtraVpkPaths = getenv( "EXTRAS_VPK_PATH" ); + char szAbsSearchPath[MAX_PATH]; + + if( ExtraVpkPaths ) + { + CUtlStringList vecPaths; + V_SplitString( ExtraVpkPaths, ",", vecPaths ); + + FOR_EACH_VEC( vecPaths, idxExtraPath ) + { + FileSystem_AddLoadedSearchPath( initInfo, "GAME", vecPaths[idxExtraPath], false ); + } + } + bool bLowViolence = initInfo.m_bLowViolence; for ( KeyValues *pCur=pSearchPaths->GetFirstValue(); pCur; pCur=pCur->GetNextValue() ) { @@ -602,11 +616,12 @@ FSReturnCode_t FileSystem_LoadSearchPaths( CFSSearchPathsInit &initInfo ) // We need a special identifier in the gameinfo.txt here because the base hl2 folder exists in different places. // In the case of a game or a Steam-launched dedicated server, all the necessary prior engine content is mapped in with the Steam depots, // so we can just use the path as-is. + pLocation += strlen( BASESOURCEPATHS_TOKEN ); } + CUtlStringList vecFullLocationPaths; - char szAbsSearchPath[MAX_PATH]; V_MakeAbsolutePath( szAbsSearchPath, sizeof( szAbsSearchPath ), pLocation, pszBaseDir ); // Now resolve any ./'s. diff --git a/public/togles/linuxwin/dxabstract_types.h b/public/togles/linuxwin/dxabstract_types.h index 9713ec71..aa3013f3 100644 --- a/public/togles/linuxwin/dxabstract_types.h +++ b/public/togles/linuxwin/dxabstract_types.h @@ -993,6 +993,7 @@ typedef enum _D3DTEXTUREADDRESS typedef enum _D3DSHADEMODE { + D3DSHADE_NONE = 0, D3DSHADE_FLAT = 1, D3DSHADE_GOURAUD = 2, D3DSHADE_PHONG = 3, diff --git a/scripts/waifulib/compiler_optimizations.py b/scripts/waifulib/compiler_optimizations.py index 0d20057b..56c35c1e 100644 --- a/scripts/waifulib/compiler_optimizations.py +++ b/scripts/waifulib/compiler_optimizations.py @@ -48,8 +48,8 @@ CFLAGS = { 'common': { # disable thread-safe local static initialization for C++11 code, as it cause crashes on Windows XP 'msvc': ['/D_USING_V110_SDK71_', '/Zi', '/FS', '/Zc:threadSafeInit-', '/MT'], - 'clang': ['-g', '-gdwarf-2', '-fvisibility=hidden'], - 'gcc': ['-g', '-fvisibility=hidden'], + 'clang': ['-g0', '-gdwarf-2', '-fvisibility=hidden'], + 'gcc': ['-g0', '-fvisibility=hidden'], 'owcc': ['-fno-short-enum', '-ffloat-store', '-g3'] }, 'fast': { diff --git a/scripts/waifulib/xcompile.py b/scripts/waifulib/xcompile.py index fc5ab628..df70352d 100644 --- a/scripts/waifulib/xcompile.py +++ b/scripts/waifulib/xcompile.py @@ -255,7 +255,7 @@ class Android: if self.is_arm(): if self.arch == 'armeabi-v7a': # ARMv7 support - cflags += ['-mthumb', '-mfpu=neon', '-mcpu=cortex-a9', '-DHAVE_EFFICIENT_UNALIGNED_ACCESS', '-DVECTORIZE_SINCOS'] + cflags += ['-mthumb', '-mfpu=neon-vfpv4', '-mcpu=cortex-a7', '-mtune=cortex-a7', '-DHAVE_EFFICIENT_UNALIGNED_ACCESS', '-DVECTORIZE_SINCOS'] if not self.is_clang() and not self.is_host(): cflags += [ '-mvectorize-with-neon-quad' ] diff --git a/togles/linuxwin/cglmtex.cpp b/togles/linuxwin/cglmtex.cpp index 67d73faf..da4c9a11 100644 --- a/togles/linuxwin/cglmtex.cpp +++ b/togles/linuxwin/cglmtex.cpp @@ -3361,11 +3361,11 @@ void convert_texture( GLint &internalformat, GLsizei width, GLsizei height, GLen if( format == GL_LUMINANCE || format == GL_LUMINANCE_ALPHA ) internalformat = format; -// if( internalformat == GL_SRGB8_ALPHA8 ) -// internalformat = GL_RGBA; + if( internalformat == GL_SRGB8_ALPHA8 ) + internalformat = GL_RGBA; -// if( internalformat == GL_SRGB8 ) -// internalformat = GL_RGB; + if( internalformat == GL_SRGB8 ) + internalformat = GL_RGB; if( data ) { @@ -3412,12 +3412,12 @@ void convert_texture( GLint &internalformat, GLsizei width, GLsizei height, GLen else if( internalformat == GL_SRGB8_ALPHA8 ) { // pixel_srgb_inplace( data, 4, width, height ); - internalformat = GL_RGBA; +// internalformat = GL_RGBA; } else if( internalformat == GL_SRGB8 ) { // pixel_srgb_inplace( data, 3, width, height ); - internalformat = GL_RGB; +// internalformat = GL_RGB; } } @@ -3659,15 +3659,17 @@ void CGLMTex::WriteTexels( GLMTexLockDesc *desc, bool writeWholeSlice, bool noDa GLenum glDataFormat = format->m_glDataFormat; // this could change if expansion kicks in GLenum glDataType = format->m_glDataType; - GLMTexLayoutSlice *slice = &m_layout->m_slices[ desc->m_sliceIndex ]; + GLMTexLayoutSlice *slice = &m_layout->m_slices[ desc->m_sliceIndex ]; void *sliceAddress = m_backing ? (m_backing + slice->m_storageOffset) : NULL; // this would change for PBO // allow use of subimage if the target is texture2D and it has already been teximage'd bool mayUseSubImage = false; +#ifdef ANDROID if ( (target==GL_TEXTURE_2D) && (m_sliceFlags[ desc->m_sliceIndex ] & kSliceValid) ) { -// mayUseSubImage = gl_enabletexsubimage.GetInt() != 0; + mayUseSubImage = gl_enabletexsubimage.GetInt() != 0; } +#endif // check flavor, 2D, 3D, or cube map // we also have the choice to use subimage if this is a tex already created. (open question as to benefit) diff --git a/vguimatsurface/Input.cpp b/vguimatsurface/Input.cpp index a30ff010..03df13d5 100644 --- a/vguimatsurface/Input.cpp +++ b/vguimatsurface/Input.cpp @@ -29,11 +29,13 @@ #ifdef _X360 #include "xbox/xbox_win32stubs.h" #endif +#include "MatSystemSurface.h" // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h" using namespace vgui; +extern CMatSystemSurface g_MatSystemSurface; //----------------------------------------------------------------------------- // Vgui input events @@ -374,7 +376,7 @@ static vgui::MouseCode ButtonCodeToMouseCode( ButtonCode_t buttonCode ) //----------------------------------------------------------------------------- bool InputHandleInputEvent( const InputEvent_t &event ) { - switch( event.m_nType ) + switch( event.m_nType & 0xFFFF ) { case IE_ButtonPressed: { @@ -425,25 +427,35 @@ bool InputHandleInputEvent( const InputEvent_t &event ) break; case IE_FingerDown: { - //g_pIInput->InternalCursorMoved( event.m_nData2, event.m_nData3 ); - g_pIInput->UpdateCursorPosInternal( event.m_nData2, event.m_nData3 ); + int w,h,x,y; g_MatSystemSurface.GetScreenSize(w, h); + uint data = (uint)event.m_nData; + x = w*((double)((data >> 16) & 0xFFFF) / 0xFFFF); + y = h*((double)(data & 0xFFFF) / 0xFFFF); + g_pIInput->UpdateCursorPosInternal( x, y ); g_pIInput->SetMouseCodeState( MOUSE_LEFT, vgui::BUTTON_PRESSED ); g_pIInput->InternalMousePressed( MOUSE_LEFT ); } return true; case IE_FingerUp: { - g_pIInput->UpdateCursorPosInternal( event.m_nData2, event.m_nData3 ); - g_pIInput->SetMouseCodeState( MOUSE_LEFT, vgui::BUTTON_RELEASED ); + int w,h,x,y; g_MatSystemSurface.GetScreenSize(w, h); + uint data = (uint)event.m_nData; + x = w*((double)((data >> 16) & 0xFFFF) / 0xFFFF); + y = h*((double)(data & 0xFFFF) / 0xFFFF); + g_pIInput->UpdateCursorPosInternal( x, y ); + g_pIInput->SetMouseCodeState( MOUSE_LEFT, vgui::BUTTON_RELEASED ); g_pIInput->InternalMouseReleased( MOUSE_LEFT ); } return true; case IE_FingerMotion: { - //g_pIInput->UpdateCursorPosInternal( event.m_nData2, event.m_nData3 ); - g_pIInput->InternalCursorMoved( event.m_nData2, event.m_nData3 ); + int w,h,x,y; g_MatSystemSurface.GetScreenSize(w, h); + uint data = (uint)event.m_nData; + x = w*((double)((data >> 16) & 0xFFFF) / 0xFFFF); + y = h*((double)(data & 0xFFFF) / 0xFFFF); + g_pIInput->InternalCursorMoved( x, y ); } - return true; + return true; case IE_ButtonDoubleClicked: { // NOTE: data2 is the virtual key code (data1 contains the scan-code one) diff --git a/wscript b/wscript index 16d67403..bbe4e113 100644 --- a/wscript +++ b/wscript @@ -284,11 +284,9 @@ def configure(conf): ] if conf.env.DEST_CPU == 'arm': - flags += ['-fsigned-char', '-mfpu=neon'] + flags += ['-fsigned-char'] - if conf.env.DEST_OS == 'android': - flags += ['-mcpu=cortex-a15', '-mtune=cortex-a15'] - else: + if conf.env.DEST_OS != 'android': flags += ['-march=native', '-mtune=native'] else: flags += ['-march=native','-mtune=native','-mfpmath=sse', '-msse', '-msse2']