diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..bdf0fec902 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,35 @@ +language: cpp + +compiler: + - clang + - gcc + +branches: + only: + - master + +before_install: + - echo "yes" | sudo apt-key adv --fetch-keys http://repos.codelite.org/CodeLite.asc + - echo "yes" | sudo apt-add-repository 'deb http://repos.codelite.org/wx3.0/ubuntu/ precise universe' + - sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y + - sudo apt-get update + - sudo apt-get install libwxgtk3.0-dev libopenal-dev freeglut3-dev libglew-dev + - sudo apt-get install aria2 -qq + - download_extract() { aria2c -x 16 $1 -o $2 && tar -xf $2; } +# Travis uses CMake 2.8.7. We require 2.8.8. Grab latest + - sudo apt-get install -qq g++-4.8 + - if [ "$CXX" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi + - sudo apt-get install lib32stdc++6 -qq && + aria2c -x 16 http://www.cmake.org/files/v2.8/cmake-2.8.12.1-Linux-i386.sh && + chmod a+x cmake-2.8.12.1-Linux-i386.sh && + sudo ./cmake-2.8.12.1-Linux-i386.sh --skip-license --prefix=/usr; + +before_script: + - git submodule update --init --recursive + - mkdir build + - cd build + - cmake .. + +script: + - make + diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000000..bfb3c82402 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 2.8) + +set(ASMJIT_STATIC TRUE) + +add_subdirectory( asmjit ) +add_subdirectory( rpcs3 ) diff --git a/Utilities/IdManager.h b/Utilities/IdManager.h index 45d0d09970..c56fefd061 100644 --- a/Utilities/IdManager.h +++ b/Utilities/IdManager.h @@ -57,6 +57,13 @@ struct ID m_data = other.m_data; other.m_data = nullptr; } + ID& operator=(ID&& other) + { + std::swap(m_name,other.m_name); + std::swap(m_attr,other.m_attr); + std::swap(m_data,other.m_data); + return *this; + } void Kill() { @@ -113,7 +120,7 @@ public: { std::lock_guard lock(m_mtx_main); - m_id_map[m_cur_id] = std::move(ID(name, data, attr)); + m_id_map[m_cur_id] = ID(name, data, attr); return m_cur_id++; } diff --git a/rpcs3/CMakeLists.txt b/rpcs3/CMakeLists.txt index 843d9ce382..540b287c6e 100644 --- a/rpcs3/CMakeLists.txt +++ b/rpcs3/CMakeLists.txt @@ -2,17 +2,30 @@ cmake_minimum_required(VERSION 2.8) project(rpcs3) if (CMAKE_COMPILER_IS_GNUCXX) - add_definitions(-std=gnu++11) + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7.0) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") + else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + endif() #add_definitions(-D__WXGTK__) #add_definitions(-Wfatal-errors) add_definitions(-w) # TODO: remove me add_definitions(-fpermissive) # TODO: remove me add_definitions(-g) # Debugging!! add_definitions(-msse2) +elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") endif() -set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules") -set(EXECUTABLE_OUTPUT_PATH "${CMAKE_SOURCE_DIR}/../bin") +If( NOT RPCS3_SRC_DIR) + SET(RPCS3_SRC_DIR ${CMAKE_CURRENT_LIST_DIR}) + Message("-- Initializing RPCS3_SRC_DIR=${RPCS3_SRC_DIR}") +Else() + Message("-- Using Custom RPCS3_SRC_DIR=${RPCS3_SRC_DIR}") +EndIf() + +set(CMAKE_MODULE_PATH "${RPCS3_SRC_DIR}/cmake_modules") +set(EXECUTABLE_OUTPUT_PATH "${RPCS3_SRC_DIR}/../bin") # TODO: do real installation, including copying directory structure add_definitions(-DGL_GLEXT_PROTOTYPES) add_definitions(-DGLX_GLXEXT_PROTOTYPES) @@ -34,28 +47,34 @@ endif() include_directories( ${wxWidgets_INCLUDE_DIRS} ${OPENAL_INCLUDE_DIR} -"${CMAKE_SOURCE_DIR}/../ffmpeg/${PLATFORM_ARCH}/include" -"${CMAKE_SOURCE_DIR}" -"${CMAKE_SOURCE_DIR}/Emu" -"${CMAKE_SOURCE_DIR}/Gui" -"${CMAKE_SOURCE_DIR}/Loader" -"${CMAKE_SOURCE_DIR}/Crypto" -"${CMAKE_SOURCE_DIR}/.." +"${RPCS3_SRC_DIR}/../ffmpeg/${PLATFORM_ARCH}/include" +"${RPCS3_SRC_DIR}" +"${RPCS3_SRC_DIR}/Emu" +"${RPCS3_SRC_DIR}/Gui" +"${RPCS3_SRC_DIR}/Loader" +"${RPCS3_SRC_DIR}/Crypto" +"${RPCS3_SRC_DIR}/.." +"${RPCS3_SRC_DIR}/../asmjit/src/asmjit" ) -link_directories("${CMAKE_SOURCE_DIR}/../ffmpeg/${PLATFORM_ARCH}/lib") +link_directories("${RPCS3_SRC_DIR}/../ffmpeg/${PLATFORM_ARCH}/lib") + +get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES) +foreach(dir ${dirs}) + message(STATUS "dir='${dir}'") +endforeach() file( GLOB_RECURSE RPCS3_SRC -"${CMAKE_SOURCE_DIR}/rpcs3.cpp" -"${CMAKE_SOURCE_DIR}/AppConnector.cpp" -"${CMAKE_SOURCE_DIR}/Ini.cpp" -"${CMAKE_SOURCE_DIR}/Emu/*" -"${CMAKE_SOURCE_DIR}/Gui/*" -"${CMAKE_SOURCE_DIR}/Loader/*" -"${CMAKE_SOURCE_DIR}/Crypto/*" -"${CMAKE_SOURCE_DIR}/../Utilities/*" +"${RPCS3_SRC_DIR}/rpcs3.cpp" +"${RPCS3_SRC_DIR}/AppConnector.cpp" +"${RPCS3_SRC_DIR}/Ini.cpp" +"${RPCS3_SRC_DIR}/Emu/*" +"${RPCS3_SRC_DIR}/Gui/*" +"${RPCS3_SRC_DIR}/Loader/*" +"${RPCS3_SRC_DIR}/Crypto/*" +"${RPCS3_SRC_DIR}/../Utilities/*" ) add_executable(rpcs3 ${RPCS3_SRC}) diff --git a/rpcs3/Crypto/lz.cpp b/rpcs3/Crypto/lz.cpp new file mode 100644 index 0000000000..ec04981725 --- /dev/null +++ b/rpcs3/Crypto/lz.cpp @@ -0,0 +1,274 @@ +// Copyright (C) 2014 Hykem +// Licensed under the terms of the GNU GPL, version 3 +// http://www.gnu.org/licenses/gpl-3.0.txt + +#include "lz.h" + +int decode_range(unsigned int *range, unsigned int *code, unsigned char **src) +{ + if (!((*range) >> 24)) + { + (*range) <<= 8; + *code = ((*code) << 8) + (*src)++[5]; + return 1; + } + else + return 0; +} + +int decode_bit(unsigned int *range, unsigned int *code, int *index, unsigned char **src, unsigned char *c) +{ + unsigned int val = *range; + + if (decode_range(range, code, src)) + val *= (*c); + else + val = (val >> 8) * (*c); + + *c -= ((*c) >> 3); + if (index) (*index) <<= 1; + + if (*code < val) + { + *range = val; + *c += 31; + if (index) (*index)++; + return 1; + } + else + { + *code -= val; + *range -= val; + return 0; + } +} + +int decode_number(unsigned char *ptr, int index, int *bit_flag, unsigned int *range, unsigned int *code, unsigned char **src) +{ + int i = 1; + + if (index >= 3) + { + decode_bit(range, code, &i, src, ptr + 0x18); // Offset 0x978 + if (index >= 4) + { + decode_bit(range, code, &i, src, ptr + 0x18); // Offset 0x978 + if (index >= 5) + { + decode_range(range, code, src); + for (; index >= 5; index--) + { + i <<= 1; + (*range) >>= 1; + if (*code < *range) + i++; + else + (*code) -= *range; + } + } + } + } + + *bit_flag = decode_bit(range, code, &i, src, ptr); // Offset 0x960 + + if (index >= 1) + { + decode_bit(range, code, &i, src, ptr + 0x8); // Offset 0x968 + if (index >= 2) + { + decode_bit(range, code, &i, src, ptr + 0x10); // Offset 0x970 + } + } + + return i; +} + +int decode_word(unsigned char *ptr, int index, int *bit_flag, unsigned int *range, unsigned int *code, unsigned char **src) +{ + int i = 1; + index /= 8; + + if (index >= 3) + { + decode_bit(range, code, &i, src, ptr); // Offset 0x8A8 + if (index >= 4) + { + decode_bit(range, code, &i, src, ptr); // Offset 0x8A8 + if (index >= 5) + { + decode_range(range, code, src); + for (; index >= 5; index--) + { + i <<= 1; + (*range) >>= 1; + if (*code < *range) + i++; + else + (*code) -= *range; + } + } + } + } + + *bit_flag = decode_bit(range, code, &i, src, ptr + 3); // Offset 0x8A8 + 3 + + if (index >= 1) + { + decode_bit(range, code, &i, src, ptr + 2); // Offset 0x8A8 + 2 + if (index >= 2) + { + decode_bit(range, code, &i, src, ptr + 1); // Offset 0x8A8 + 1 + } + } + + return i; +} + +int decompress(unsigned char *out, unsigned char *in, unsigned int size) +{ + int result; + + unsigned char *tmp = new unsigned char[0xA70]; + + int offset = 0; + int bit_flag = 0; + int data_length = 0; + int data_offset = 0; + + unsigned char *tmp_sect1, *tmp_sect2, *tmp_sect3; + unsigned char *buf_start, *buf_end; + unsigned char prev = 0; + + unsigned char *start = out; + unsigned char *end = (out + size); + unsigned char head = in[0]; + + unsigned int range = 0xFFFFFFFF; + unsigned int code = (in[1] << 24) | (in[2] << 16) | (in[3] << 8) | in[4]; + + if (head < 0) // Check if we have a valid starting byte. + { + // The dictionary header is invalid, the data is not compressed. + result = -1; + if (code <= size) + { + memcpy(out, (const void *)(in + 5), code); + result = (start - out); + } + } + else + { + // Set up a temporary buffer (sliding window). + memset(tmp, 0x80, 0xA60); + while (1) + { + // Start reading at 0x920. + tmp_sect1 = tmp + offset + 0x920; + if (!decode_bit(&range, &code, 0, &in, tmp_sect1)) // Raw char. + { + // Adjust offset and check for stream end. + if (offset > 0) offset--; + if (start == end) return (start - out); + + // Locate first section. + int sect = (((((((int)(start - out)) & 7) << 8) + prev) >> head) & 7) * 0xFF - 1; + tmp_sect1 = tmp + sect; + int index = 1; + + // Read, decode and write back. + do + { + decode_bit(&range, &code, &index, &in, tmp_sect1 + index); + } while ((index >> 8) == 0); + + // Save index. + *start++ = index; + } + else // Compressed char stream. + { + int index = -1; + + // Identify the data length bit field. + do { + tmp_sect1 += 8; + bit_flag = decode_bit(&range, &code, 0, &in, tmp_sect1); + index += bit_flag; + } while ((bit_flag != 0) && (index < 6)); + + // Default block size is 0x40. + int b_size = 0x40; + tmp_sect2 = tmp + index + 0x7F1; + + // If the data length was found, parse it as a number. + if ((index >= 0) || (bit_flag != 0)) + { + // Locate next section. + int sect = (index << 5) | (((((start - out)) << index) & 3) << 3) | (offset & 7); + tmp_sect1 = tmp + 0x960 + sect; + + // Decode the data length (8 bit fields). + data_length = decode_number(tmp_sect1, index, &bit_flag, &range, &code, &in); + + // If we got valid parameters, seek to find data offset. + if ((data_length != 3) && ((index > 0) || (bit_flag != 0))) { + tmp_sect2 += 0x38; + b_size = 0x80; // Block size is now 0x80. + } + } else { + // Assume one byte of advance. + data_length = 1; + } + + int diff = 0; + int shift = 1; + + // Identify the data offset bit field. + do { + diff = (shift << 4) - b_size; + bit_flag = decode_bit(&range, &code, &shift, &in, tmp_sect2 + (shift << 3)); + } while (diff < 0); + + // If the data offset was found, parse it as a number. + if ((diff > 0) || (bit_flag != 0)) + { + // Adjust diff if needed. + if (bit_flag == 0) diff -= 8; + + // Locate section. + tmp_sect3 = tmp + 0x8A8 + diff; + + // Decode the data offset (1 bit fields). + data_offset = decode_word(tmp_sect3, diff, &bit_flag, &range, &code, &in); + } else { + // Assume one byte of advance. + data_offset = 1; + } + + // Set buffer start/end. + buf_start = start - data_offset; + buf_end = start + data_length + 1; + + // Underflow. + if (buf_start < out) + return -1; + + // Overflow. + if (buf_end > end) + return -1; + + // Update offset. + offset = ((((int)(buf_end - out)) + 1) & 1) + 6; + + // Copy data. + do { + *start++ = *buf_start++; + } while (start < buf_end); + + } + prev = *(start - 1); + } + result = (start - out); + } + delete[] tmp; + return result; +} diff --git a/rpcs3/Crypto/lz.h b/rpcs3/Crypto/lz.h new file mode 100644 index 0000000000..78cce623b6 --- /dev/null +++ b/rpcs3/Crypto/lz.h @@ -0,0 +1,7 @@ +#include + +int decode_range(unsigned int *range, unsigned int *code, unsigned char **src); +int decode_bit(unsigned int *range, unsigned int *code, int *index, unsigned char **src, unsigned char *c); +int decode_number(unsigned char *ptr, int index, int *bit_flag, unsigned int *range, unsigned int *code, unsigned char **src); +int decode_word(unsigned char *ptr, int index, int *bit_flag, unsigned int *range, unsigned int *code, unsigned char **src); +int decompress(unsigned char *out, unsigned char *in, unsigned int size); diff --git a/rpcs3/Crypto/unpkg.cpp b/rpcs3/Crypto/unpkg.cpp index 52cd20c772..db5eed77e5 100644 --- a/rpcs3/Crypto/unpkg.cpp +++ b/rpcs3/Crypto/unpkg.cpp @@ -10,7 +10,7 @@ bool CheckHeader(wxFile& pkg_f, PKGHeader* m_header) return false; } - switch (m_header->pkg_type) + switch ((u32)m_header->pkg_type) { case PKG_RELEASE_TYPE_DEBUG: break; case PKG_RELEASE_TYPE_RELEASE: break; @@ -19,7 +19,7 @@ bool CheckHeader(wxFile& pkg_f, PKGHeader* m_header) return false; } - switch (m_header->pkg_platform) + switch ((u32)m_header->pkg_platform) { case PKG_PLATFORM_TYPE_PS3: break; case PKG_PLATFORM_TYPE_PSP: break; diff --git a/rpcs3/Crypto/utils.cpp b/rpcs3/Crypto/utils.cpp index 1f682bfc35..a17013cda9 100644 --- a/rpcs3/Crypto/utils.cpp +++ b/rpcs3/Crypto/utils.cpp @@ -139,609 +139,9 @@ bool cmac_hash_compare(unsigned char *key, int key_len, unsigned char *in, int i return true; } +#include "lz.h" // Reverse-engineered custom Lempel–Ziv–Markov based compression (unknown variant of LZRC). int lz_decompress(unsigned char *out, unsigned char *in, unsigned int size) { - char *tmp = new char[3272]; - char *p; - char *p2; - char *sub; - char *sub2; - char *sub3; - int offset; - int index; - int index2; - int unk; - - int flag; - int flag2; - unsigned int c; - int cc; - int sp; - unsigned int sc; - int scc; - char st; - char t; - unsigned int n_size; - unsigned int r_size; - signed int f_size; - signed int b_size; - signed int diff; - signed int diff_pad; - - bool adjust; - int pos; - int end; - int n_end; - signed int end_size; - int chunk_size; - char pad; - unsigned int remainder; - int result; - - adjust = true; - offset = 0; - index = 0; - remainder = -1; - end = (int)((char *)out + size); - pos = (int)in; - pad = *in; - chunk_size = (*(in + 1) << 24) | (*(in + 2) << 16) | (*(in + 3) << 8) | *(in + 4); - - if (*in >= 0) // Check if we have a valid starting byte. - { - memset(tmp, 128, 0xCA8u); - end_size = 0; - while (1) - { - while (1) - { - p = &tmp[offset]; - c = (unsigned char)tmp[offset + 2920]; - - if (!(remainder >> 24)) - { - int add = *(unsigned char *)(pos + 5); - remainder <<= 8; - ++pos; - chunk_size = (chunk_size << 8) + add; - } - - cc = c - (c >> 3); - r_size = c * (remainder >> 8); - f_size = (unsigned int)chunk_size < r_size; - - if ((unsigned int)chunk_size < r_size) - break; - - remainder -= r_size; - chunk_size -= r_size; - p[2920] = cc; - offset = (offset - 1) & ((u64)~(offset - 1) >> 32); - - if (out == (void *)end) - return -1; - - sub = &tmp[255 * ((((((unsigned char)out & 7) << 8) | index & 0xFFFFF8FFu) >> pad) & 7)]; - index = 1; - - do - { - sp = (int)&sub[index]; - sc = (unsigned char)sub[index - 1]; - - if (!(remainder >> 24)) - { - int add = *(unsigned char *)(pos++ + 5); - remainder <<= 8; - chunk_size = (chunk_size << 8) + add; - } - - index *= 2; - n_size = sc * (remainder >> 8); - scc = sc - (sc >> 3); - st = scc; - - if ((unsigned int)chunk_size < n_size) - { - remainder = n_size; - ++index; - st = scc + 31; - } - else - { - remainder -= n_size; - chunk_size -= n_size; - } - *(unsigned char *)(sp - 1) = st; - } - while (index <= 255); - - out += 1; - ++end_size; - *(out - 1) = index; - } - - remainder = c * (remainder >> 8); - p[2920] = cc + 31; - index = -1; - - while (1) - { - c = (unsigned char)p[2928]; - - if (!(r_size >> 24)) - { - int add = *(unsigned char *)(pos++ + 5); - remainder = r_size << 8; - chunk_size = (chunk_size << 8) + add; - } - - p += 8; - r_size = c * (remainder >> 8); - cc = c - (c >> 3); - - if ((unsigned int)chunk_size >= r_size) - break; - - remainder = r_size; - p[2920] = cc + 31; - ++index; - - if (index == 6) - { - adjust = false; - break; - } - - } - - if (adjust) - { - remainder -= r_size; - chunk_size -= r_size; - p[2920] = cc; - } - adjust = true; - - p2 = &tmp[index]; - if (index >= 0) - { - sub3 = &tmp[offset & 7 | 8 * (((unsigned int)out << index) & 3) | 32 * index]; - flag = index - 3; - c = (unsigned char)sub3[2984]; - - if (!(remainder >> 24)) - { - int add = *(unsigned char *)(pos++ + 5); - remainder <<= 8; - chunk_size = (chunk_size << 8) + add; - } - - n_size = c * (remainder >> 8); - cc = c - (c >> 3); - t = cc; - index2 = 2; - - if ((unsigned int)chunk_size >= n_size) - { - remainder -= n_size; - chunk_size -= n_size; - } - else - { - remainder = n_size; - index2 = 3; - t = cc + 31; - } - - if (flag < 0) - { - sub3[2984] = t; - } - else - { - if (flag <= 0) - { - sub3[2984] = t; - } - else - { - c = (unsigned char)t; - - if (!(remainder >> 24)) - { - int add = *(unsigned char *)(pos++ + 5); - remainder <<= 8; - chunk_size = (chunk_size << 8) + add; - } - index2 *= 2; - n_size = c * (remainder >> 8); - cc = c - (c >> 3); - t = cc; - - if ((unsigned int)chunk_size >= n_size) - { - remainder -= n_size; - chunk_size -= n_size; - } - else - { - remainder = n_size; - ++index2; - t = cc + 31; - } - sub3[2984] = t; - - if (flag != 1) - { - if (!(remainder >> 24)) - { - int add = *(unsigned char *)(pos + 5); - remainder <<= 8; - ++pos; - chunk_size = (chunk_size << 8) + add; - } - do - { - remainder >>= 1; - index2 = ((unsigned int)chunk_size < remainder) + 2 * index2; - - if ((unsigned int)chunk_size >= remainder) - chunk_size -= remainder; - - --flag; - } - while (flag != 1); - } - } - c = (unsigned char)sub3[3008]; - - if (!(remainder >> 24)) - { - int add = *(unsigned char *)(pos + 5); - remainder <<= 8; - ++pos; - chunk_size = (chunk_size << 8) + add; - } - index2 *= 2; - n_size = c * (remainder >> 8); - cc = c - (c >> 3); - t = cc; - - if ((unsigned int)chunk_size >= n_size) - { - remainder -= n_size; - chunk_size -= n_size; - } - else - { - remainder = n_size; - ++index2; - t = cc + 31; - } - sub3[3008] = t; - } - if (index > 0) - { - c = (unsigned char)sub3[2992]; - - if (!(remainder >> 24)) - { - int add = *(unsigned char *)(pos++ + 5); - remainder <<= 8; - chunk_size = (chunk_size << 8) + add; - } - - index2 *= 2; - n_size = c * (remainder >> 8); - cc = c - (c >> 3); - t = cc; - - if ((unsigned int)chunk_size >= n_size) - { - remainder -= n_size; - chunk_size -= n_size; - } - else - { - remainder = n_size; - ++index2; - t = cc + 31; - } - sub3[2992] = t; - - if (index != 1) - { - c = (unsigned char)sub3[3000]; - - if (!(remainder >> 24)) - { - int add = *(unsigned char *)(pos + 5); - remainder <<= 8; - ++pos; - chunk_size = (chunk_size << 8) + add; - } - - index2 *= 2; - n_size = c * (remainder >> 8); - cc = c - (c >> 3); - t = cc; - - if ((unsigned int)chunk_size >= n_size) - { - remainder -= n_size; - chunk_size -= n_size; - } - else - { - remainder = n_size; - ++index2; - t = cc + 31; - } - sub3[3000] = t; - } - } - f_size = index2; - - if (index2 == 255) - break; - } - index = 8; - b_size = 352; - - if (f_size <= 2) - { - p2 += 248; - b_size = 64; - } - do - { - unk = (int)&p2[index]; - - if (!(remainder >> 24)) - { - int add = *(unsigned char *)(pos++ + 5); - remainder <<= 8; - chunk_size = (chunk_size << 8) + add; - } - - c = *(unsigned char *)(unk + 2033); - index *= 2; - n_size = c * (remainder >> 8); - cc = c - (c >> 3); - t = cc; - - if ((unsigned int)chunk_size < n_size) - { - remainder = n_size; - t = cc + 31; - index += 8; - } - else - { - remainder -= n_size; - chunk_size -= n_size; - } - *(unsigned char *)(unk + 2033) = t; - diff = index - b_size; - } - while ((index - b_size) < 0); - - if (index != b_size) - { - diff_pad = diff >> 3; - flag = diff_pad - 1; - flag2 = diff_pad - 4; - sub2 = &tmp[32 * (diff_pad - 1)]; - c = (unsigned char)sub2[2344]; - - if (!(remainder >> 24)) - { - int add = *(unsigned char *)(pos + 5); - remainder <<= 8; - ++pos; - chunk_size = (chunk_size << 8) + add; - } - - n_size = c * (remainder >> 8); - cc = c - (c >> 3); - t = cc; - index2 = 2; - - if ((unsigned int)chunk_size >= n_size) - { - remainder -= n_size; - chunk_size -= n_size; - } - else - { - remainder = n_size; - index2 = 3; - t = cc + 31; - } - - if (flag2 < 0) - { - sub2[2344] = t; - } - else - { - if (flag2 <= 0) - { - sub2[2344] = t; - } - else - { - c = (unsigned char)t; - - if (!(remainder >> 24)) - { - int add = *(unsigned char *)(pos++ + 5); - remainder <<= 8; - chunk_size = (chunk_size << 8) + add; - } - - index2 *= 2; - n_size = c * (remainder >> 8); - cc = c - (c >> 3); - t = cc; - - if ((unsigned int)chunk_size >= n_size) - { - remainder -= n_size; - chunk_size -= n_size; - } - else - { - remainder = n_size; - ++index2; - t = cc + 31; - } - sub2[2344] = t; - - if (flag2 != 1) - { - if (!(remainder >> 24)) - { - int add = *(unsigned char *)(pos + 5); - remainder <<= 8; - ++pos; - chunk_size = (chunk_size << 8) + add; - } - do - { - remainder >>= 1; - index2 = ((unsigned int)chunk_size < remainder) + 2 * index2; - - if ((unsigned int)chunk_size >= remainder) - chunk_size -= remainder; - - --flag2; - } - while (flag2 != 1); - } - } - c = (unsigned char)sub2[2368]; - - if (!(remainder >> 24)) - { - int add = *(unsigned char *)(pos + 5); - remainder <<= 8; - ++pos; - chunk_size = (chunk_size << 8) + add; - } - - index2 *= 2; - n_size = c * (remainder >> 8); - cc = c - (c >> 3); - t = cc; - - if ((unsigned int)chunk_size >= n_size) - { - remainder -= n_size; - chunk_size -= n_size; - } - else - { - remainder = n_size; - ++index2; - t = cc + 31; - } - sub2[2368] = t; - } - if (flag > 0) - { - c = (unsigned char)sub2[2352]; - if (!(remainder >> 24)) - { - int add = *(unsigned char *)(pos++ + 5); - remainder <<= 8; - chunk_size = (chunk_size << 8) + add; - } - index2 *= 2; - n_size = c * (remainder >> 8); - cc = c - (c >> 3); - t = cc; - if ((unsigned int)chunk_size >= n_size) - { - remainder -= n_size; - chunk_size -= n_size; - } - else - { - remainder = n_size; - ++index2; - t = cc + 31; - } - sub2[2352] = t; - if (flag != 1) - { - c = (unsigned char)sub2[2360]; - if (!(remainder >> 24)) - { - int add = *(unsigned char *)(pos + 5); - remainder <<= 8; - ++pos; - chunk_size = (chunk_size << 8) + add; - } - index2 *= 2; - n_size = c * (remainder >> 8); - cc = c - (c >> 3); - t = cc; - - if ((unsigned int)chunk_size >= n_size) - { - remainder -= n_size; - chunk_size -= n_size; - } - else - { - remainder = n_size; - ++index2; - t = cc + 31; - } - sub2[2360] = t; - } - } - diff = index2 - 1; - } - - if (end_size <= diff) - return -1; - - index = *(out - diff - 1); - n_end = (int)(out + f_size); - offset = (((unsigned char)f_size + (unsigned char)out) & 1) + 6; - - if ((unsigned int)(out + f_size) >= (unsigned int)end) - return -1; - - do - { - out += 1; - ++end_size; - *(out - 1) = index; - index = *(out - diff - 1); - } - while (out != (void *)n_end); - - out += 1; - ++end_size; - *((unsigned char *)out - 1) = index; - } - result = end_size; - } - else // Starting byte is invalid. - { - result = -1; - if (chunk_size <= (int)size) - { - memcpy(out, (const void *)(in + 5), chunk_size); - result = chunk_size; - } - } - delete[] tmp; - - return result; + return decompress(out,in,size); } diff --git a/rpcs3/Emu/Cell/SPURecompiler.h b/rpcs3/Emu/Cell/SPURecompiler.h index 4f57910603..5c11259b60 100644 --- a/rpcs3/Emu/Cell/SPURecompiler.h +++ b/rpcs3/Emu/Cell/SPURecompiler.h @@ -1,5 +1,5 @@ #pragma once - +#ifdef _WIN32 #include "Emu/Cell/SPUOpcodes.h" #include "Emu/Memory/Memory.h" #include "Emu/Cell/SPUThread.h" @@ -41,6 +41,7 @@ struct g_imm_table_struct }*/ for (u32 i = 0; i < sizeof(fsm_table) / sizeof(fsm_table[0]); i++) { + for (u32 j = 0; j < 4; j++) fsm_table[i].m128i_u32[j] = (i & (1 << j)) ? ~0 : 0; } for (u32 i = 0; i < sizeof(fsmh_table) / sizeof(fsmh_table[0]); i++) @@ -3796,5 +3797,6 @@ private: }; +#endif WIN32 -#undef c \ No newline at end of file +#undef c diff --git a/rpcs3/Emu/Cell/SPURecompilerCore.cpp b/rpcs3/Emu/Cell/SPURecompilerCore.cpp index 56d7e65d38..f80e1189af 100644 --- a/rpcs3/Emu/Cell/SPURecompilerCore.cpp +++ b/rpcs3/Emu/Cell/SPURecompilerCore.cpp @@ -4,6 +4,7 @@ #include "SPUInterpreter.h" #include "SPURecompiler.h" +#ifdef _WIN32 static const g_imm_table_struct g_imm_table; SPURecompilerCore::SPURecompilerCore(SPUThread& cpu) @@ -249,4 +250,5 @@ u8 SPURecompilerCore::DecodeMemory(const u64 address) CPU.SetBranch((u64)res << 2); return 0; } -} \ No newline at end of file +} +#endif diff --git a/rpcs3/Emu/Cell/SPUThread.cpp b/rpcs3/Emu/Cell/SPUThread.cpp index 395a203f45..fac52841dc 100644 --- a/rpcs3/Emu/Cell/SPUThread.cpp +++ b/rpcs3/Emu/Cell/SPUThread.cpp @@ -75,7 +75,11 @@ void SPUThread::DoRun() m_dec = new SPUDecoder(*new SPUInterpreter(*this)); break; case 2: + #ifdef _WIN32 m_dec = new SPURecompilerCore(*this); + #else + m_dec = new SPUDecoder(*new SPUInterpreter(*this)); + #endif break; default: @@ -115,4 +119,4 @@ void SPUThread::DoClose() port.eq = nullptr; } } -} \ No newline at end of file +} diff --git a/rpcs3/Emu/SysCalls/Modules/cellFont.cpp b/rpcs3/Emu/SysCalls/Modules/cellFont.cpp index 3933f2d789..036fc17005 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellFont.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellFont.cpp @@ -338,7 +338,7 @@ int cellFontOpenFontset(mem_ptr_t library, mem_ptr_ttype) + switch((u32)fontType->type) { case CELL_FONT_TYPE_RODIN_SANS_SERIF_LATIN: file = "/dev_flash/data/font/SCE-PS3-RD-R-LATIN.TTF"; break; case CELL_FONT_TYPE_RODIN_SANS_SERIF_LIGHT_LATIN: file = "/dev_flash/data/font/SCE-PS3-RD-L-LATIN.TTF"; break; @@ -910,4 +910,4 @@ void cellFont_unload() // s_fontInternalInstance->m_bInitialized = false; // s_fontInternalInstance->m_bFontGcmInitialized = false; delete s_fontInternalInstance; -} \ No newline at end of file +} diff --git a/rpcs3/Emu/SysCalls/Modules/cellGifDec.cpp b/rpcs3/Emu/SysCalls/Modules/cellGifDec.cpp index 41cde3ef46..439602605f 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGifDec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellGifDec.cpp @@ -130,7 +130,7 @@ int cellGifDecSetParameter(u32 mainHandle, u32 subHandle, const mem_ptr_tcolorSpace; - switch (current_outParam.outputColorSpace) + switch ((u32)current_outParam.outputColorSpace) { case CELL_GIFDEC_RGBA: case CELL_GIFDEC_ARGB: current_outParam.outputComponents = 4; break; @@ -172,7 +172,7 @@ int cellGifDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const m uint image_size = width * height * 4; - switch(current_outParam.outputColorSpace) + switch((u32)current_outParam.outputColorSpace) { case CELL_GIFDEC_RGBA: Memory.CopyFromReal(data.GetAddr(), image.get(), image_size); diff --git a/rpcs3/Emu/SysCalls/Modules/cellJpgDec.cpp b/rpcs3/Emu/SysCalls/Modules/cellJpgDec.cpp index f3f2b959ae..7049153dd6 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellJpgDec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellJpgDec.cpp @@ -153,7 +153,7 @@ int cellJpgDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const m if (!image) return CELL_JPGDEC_ERROR_STREAM_FORMAT; uint image_size = width * height; - switch(current_outParam.outputColorSpace) + switch((u32)current_outParam.outputColorSpace) { case CELL_JPG_RGBA: case CELL_JPG_RGB: @@ -210,7 +210,7 @@ int cellJpgDecSetParameter(u32 mainHandle, u32 subHandle, const mem_ptr_toutputColorSpace; - switch (current_outParam.outputColorSpace) + switch ((u32)current_outParam.outputColorSpace) { case CELL_JPG_GRAYSCALE: current_outParam.outputComponents = 1; break; diff --git a/rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp b/rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp index 6eb58a61bb..b0ace5ef72 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp @@ -172,7 +172,7 @@ int cellPngDecDecodeData(u32 mainHandle, u32 subHandle, mem8_ptr_t data, const m if (!image) return CELL_PNGDEC_ERROR_STREAM_FORMAT; uint image_size = width * height; - switch(current_outParam.outputColorSpace) + switch((u32)current_outParam.outputColorSpace) { case CELL_PNGDEC_RGB: case CELL_PNGDEC_RGBA: @@ -262,7 +262,7 @@ int cellPngDecSetParameter(u32 mainHandle, u32 subHandle, const mem_ptr_toutputColorSpace; - switch (current_outParam.outputColorSpace) + switch ((u32)current_outParam.outputColorSpace) { case CELL_PNGDEC_PALETTE: case CELL_PNGDEC_GRAYSCALE: current_outParam.outputComponents = 1; break; diff --git a/rpcs3/Emu/SysCalls/Modules/cellResc.cpp b/rpcs3/Emu/SysCalls/Modules/cellResc.cpp index 3b419e9799..95585c1d17 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellResc.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellResc.cpp @@ -117,7 +117,7 @@ void BuildupVertexBufferNR() mem_ptr_t vv(s_rescInternalInstance->m_vertexArrayEA_addr); if(s_rescInternalInstance->m_dstMode == CELL_RESC_720x480 || s_rescInternalInstance->m_dstMode == CELL_RESC_720x576){ - switch(s_rescInternalInstance->m_initConfig.ratioMode){ + switch((u32)s_rescInternalInstance->m_initConfig.ratioMode){ case CELL_RESC_LETTERBOX: goto NR_LETTERBOX; case CELL_RESC_PANSCAN: goto NR_PANSCAN; default: goto NR_FULLSCREEN; @@ -193,7 +193,7 @@ void BuildupVertexBufferUN(s32 srcIdx) mem_ptr_t vv(s_rescInternalInstance->m_vertexArrayEA_addr); if(s_rescInternalInstance->m_dstMode == CELL_RESC_720x480 || s_rescInternalInstance->m_dstMode == CELL_RESC_720x576){ - switch(s_rescInternalInstance->m_initConfig.ratioMode){ + switch((u32)s_rescInternalInstance->m_initConfig.ratioMode){ case CELL_RESC_LETTERBOX: goto UN_LETTERBOX; case CELL_RESC_PANSCAN: goto UN_PANSCAN; default: goto UN_FULLSCREEN; @@ -229,7 +229,7 @@ UN_PANSCAN: inline int InternalVersion(mem_ptr_t conf) { - switch (conf->size) + switch ((u32)conf->size) { case 20: return 1; case 24: return 2; @@ -239,7 +239,7 @@ inline int InternalVersion(mem_ptr_t conf) } inline int InternalVersion() { - switch (s_rescInternalInstance->m_initConfig.size) + switch ((u32)s_rescInternalInstance->m_initConfig.size) { case 20: return 1; case 24: return 2; diff --git a/rpcs3/Emu/SysCalls/Modules/cellRtc.cpp b/rpcs3/Emu/SysCalls/Modules/cellRtc.cpp index 1ee5602a78..a6c03744a6 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellRtc.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellRtc.cpp @@ -42,7 +42,7 @@ int cellRtcGetCurrentClock(mem_ptr_t pClock, s32 iTimeZone) wxDateTime unow = wxDateTime::UNow(); // Add time_zone as offset in minutes. - wxTimeSpan tz = wxTimeSpan::wxTimeSpan(0, (long) iTimeZone, 0, 0); + wxTimeSpan tz = wxTimeSpan(0, (long) iTimeZone, 0, 0); unow.Add(tz); pClock->year = unow.GetYear(wxDateTime::TZ::UTC); @@ -84,10 +84,10 @@ int cellRtcFormatRfc2822(u32 pszDateTime_addr, mem_ptr_t pUtc, s32 return CELL_RTC_ERROR_INVALID_POINTER; // Add time_zone as offset in minutes. - wxTimeSpan tz = wxTimeSpan::wxTimeSpan(0, (long) iTimeZone, 0, 0); + wxTimeSpan tz = wxTimeSpan(0, (long) iTimeZone, 0, 0); // Get date from ticks + tz. - wxDateTime date = wxDateTime::wxDateTime((time_t)pUtc->tick); + wxDateTime date = wxDateTime((time_t)pUtc->tick); date.Add(tz); // Format date string in RFC2822 format (e.g.: Mon, 01 Jan 1990 12:00:00 +0000). @@ -105,7 +105,7 @@ int cellRtcFormatRfc2822LocalTime(u32 pszDateTime_addr, mem_ptr_t p return CELL_RTC_ERROR_INVALID_POINTER; // Get date from ticks. - wxDateTime date = wxDateTime::wxDateTime((time_t)pUtc->tick); + wxDateTime date = wxDateTime((time_t)pUtc->tick); // Format date string in RFC2822 format (e.g.: Mon, 01 Jan 1990 12:00:00 +0000). const std::string& str = fmt::ToUTF8(date.Format("%a, %d %b %Y %T %z", wxDateTime::TZ::Local)); @@ -122,10 +122,10 @@ int cellRtcFormatRfc3339(u32 pszDateTime_addr, mem_ptr_t pUtc, s32 return CELL_RTC_ERROR_INVALID_POINTER; // Add time_zone as offset in minutes. - wxTimeSpan tz = wxTimeSpan::wxTimeSpan(0, (long) iTimeZone, 0, 0); + wxTimeSpan tz = wxTimeSpan(0, (long) iTimeZone, 0, 0); // Get date from ticks + tz. - wxDateTime date = wxDateTime::wxDateTime((time_t)pUtc->tick); + wxDateTime date = wxDateTime((time_t)pUtc->tick); date.Add(tz); // Format date string in RFC3339 format (e.g.: 1990-01-01T12:00:00.00Z). @@ -143,7 +143,7 @@ int cellRtcFormatRfc3339LocalTime(u32 pszDateTime_addr, mem_ptr_t p return CELL_RTC_ERROR_INVALID_POINTER; // Get date from ticks. - wxDateTime date = wxDateTime::wxDateTime((time_t) pUtc->tick); + wxDateTime date = wxDateTime((time_t) pUtc->tick); // Format date string in RFC3339 format (e.g.: 1990-01-01T12:00:00.00Z). const std::string& str = fmt::ToUTF8(date.Format("%FT%T.%zZ", wxDateTime::TZ::Local)); @@ -193,7 +193,7 @@ int cellRtcGetTick(mem_ptr_t pTime, mem_ptr_t pTic if (!pTime.IsGood() || !pTick.IsGood()) return CELL_RTC_ERROR_INVALID_POINTER; - wxDateTime datetime = wxDateTime::wxDateTime(pTime->day, (wxDateTime::Month)pTime->month.ToLE(), pTime->year, pTime->hour, pTime->minute, pTime->second, (pTime->microsecond / 1000)); + wxDateTime datetime = wxDateTime(pTime->day, (wxDateTime::Month)pTime->month.ToLE(), pTime->year, pTime->hour, pTime->minute, pTime->second, (pTime->microsecond / 1000)); pTick->tick = datetime.GetTicks(); return CELL_OK; @@ -206,7 +206,7 @@ int cellRtcSetTick(mem_ptr_t pTime, mem_ptr_t pTic if (!pTime.IsGood() || !pTick.IsGood()) return CELL_RTC_ERROR_INVALID_POINTER; - wxDateTime date = wxDateTime::wxDateTime((time_t)pTick->tick); + wxDateTime date = wxDateTime((time_t)pTick->tick); pTime->year = date.GetYear(wxDateTime::TZ::UTC); pTime->month = date.GetMonth(wxDateTime::TZ::UTC); @@ -237,8 +237,8 @@ int cellRtcTickAddMicroseconds(mem_ptr_t pTick0, mem_ptr_ttick); - wxTimeSpan microseconds = wxTimeSpan::wxTimeSpan(0, 0, 0, lAdd / 1000); + wxDateTime date = wxDateTime((time_t)pTick1->tick); + wxTimeSpan microseconds = wxTimeSpan(0, 0, 0, lAdd / 1000); date.Add(microseconds); pTick0->tick = date.GetTicks(); @@ -252,8 +252,8 @@ int cellRtcTickAddSeconds(mem_ptr_t pTick0, mem_ptr_t if (!pTick0.IsGood() || !pTick1.IsGood()) return CELL_RTC_ERROR_INVALID_POINTER; - wxDateTime date = wxDateTime::wxDateTime((time_t)pTick1->tick); - wxTimeSpan seconds = wxTimeSpan::wxTimeSpan(0, 0, lAdd, 0); + wxDateTime date = wxDateTime((time_t)pTick1->tick); + wxTimeSpan seconds = wxTimeSpan(0, 0, lAdd, 0); date.Add(seconds); pTick0->tick = date.GetTicks(); @@ -267,8 +267,8 @@ int cellRtcTickAddMinutes(mem_ptr_t pTick0, mem_ptr_t if (!pTick0.IsGood() || !pTick1.IsGood()) return CELL_RTC_ERROR_INVALID_POINTER; - wxDateTime date = wxDateTime::wxDateTime((time_t)pTick1->tick); - wxTimeSpan minutes = wxTimeSpan::wxTimeSpan(0, lAdd, 0, 0); + wxDateTime date = wxDateTime((time_t)pTick1->tick); + wxTimeSpan minutes = wxTimeSpan(0, lAdd, 0, 0); date.Add(minutes); pTick0->tick = date.GetTicks(); @@ -282,8 +282,8 @@ int cellRtcTickAddHours(mem_ptr_t pTick0, mem_ptr_t pT if (!pTick0.IsGood() || !pTick1.IsGood()) return CELL_RTC_ERROR_INVALID_POINTER; - wxDateTime date = wxDateTime::wxDateTime((time_t)pTick1->tick); - wxTimeSpan hours = wxTimeSpan::wxTimeSpan(iAdd, 0, 0, 0); + wxDateTime date = wxDateTime((time_t)pTick1->tick); + wxTimeSpan hours = wxTimeSpan(iAdd, 0, 0, 0); date.Add(hours); pTick0->tick = date.GetTicks(); @@ -297,8 +297,8 @@ int cellRtcTickAddDays(mem_ptr_t pTick0, mem_ptr_t pTi if (!pTick0.IsGood() || !pTick1.IsGood()) return CELL_RTC_ERROR_INVALID_POINTER; - wxDateTime date = wxDateTime::wxDateTime((time_t)pTick1->tick); - wxDateSpan days = wxDateSpan::wxDateSpan(0, 0, 0, iAdd); + wxDateTime date = wxDateTime((time_t)pTick1->tick); + wxDateSpan days = wxDateSpan(0, 0, 0, iAdd); date.Add(days); pTick0->tick = date.GetTicks(); @@ -312,8 +312,8 @@ int cellRtcTickAddWeeks(mem_ptr_t pTick0, mem_ptr_t pT if (!pTick0.IsGood() || !pTick1.IsGood()) return CELL_RTC_ERROR_INVALID_POINTER; - wxDateTime date = wxDateTime::wxDateTime((time_t)pTick1->tick); - wxDateSpan weeks = wxDateSpan::wxDateSpan(0, 0, iAdd, 0); + wxDateTime date = wxDateTime((time_t)pTick1->tick); + wxDateSpan weeks = wxDateSpan(0, 0, iAdd, 0); date.Add(weeks); pTick0->tick = date.GetTicks(); @@ -327,8 +327,8 @@ int cellRtcTickAddMonths(mem_ptr_t pTick0, mem_ptr_t p if (!pTick0.IsGood() || !pTick1.IsGood()) return CELL_RTC_ERROR_INVALID_POINTER; - wxDateTime date = wxDateTime::wxDateTime((time_t)pTick1->tick); - wxDateSpan months = wxDateSpan::wxDateSpan(0, iAdd, 0, 0); + wxDateTime date = wxDateTime((time_t)pTick1->tick); + wxDateSpan months = wxDateSpan(0, iAdd, 0, 0); date.Add(months); pTick0->tick = date.GetTicks(); @@ -342,8 +342,8 @@ int cellRtcTickAddYears(mem_ptr_t pTick0, mem_ptr_t pT if (!pTick0.IsGood() || !pTick1.IsGood()) return CELL_RTC_ERROR_INVALID_POINTER; - wxDateTime date = wxDateTime::wxDateTime((time_t)pTick1->tick); - wxDateSpan years = wxDateSpan::wxDateSpan(iAdd, 0, 0, 0); + wxDateTime date = wxDateTime((time_t)pTick1->tick); + wxDateSpan years = wxDateSpan(iAdd, 0, 0, 0); date.Add(years); pTick0->tick = date.GetTicks(); @@ -357,7 +357,7 @@ int cellRtcConvertUtcToLocalTime(mem_ptr_t pUtc, mem_ptr_ttick); + wxDateTime time = wxDateTime((time_t)pUtc->tick); wxDateTime local_time = time.FromUTC(false); pLocalTime->tick = local_time.GetTicks(); return CELL_OK; @@ -370,7 +370,7 @@ int cellRtcConvertLocalTimeToUtc(mem_ptr_t pLocalTime, mem_ptr_ttick); + wxDateTime time = wxDateTime((time_t)pLocalTime->tick); wxDateTime utc_time = time.ToUTC(false); pUtc->tick = utc_time.GetTicks(); return CELL_OK; @@ -384,7 +384,7 @@ int cellRtcGetDosTime(mem_ptr_t pDateTime, mem32_t puiDosTime) return CELL_RTC_ERROR_INVALID_POINTER; // Convert to DOS time. - wxDateTime date_time = wxDateTime::wxDateTime(pDateTime->day, (wxDateTime::Month)pDateTime->month.ToLE(), pDateTime->year, pDateTime->hour, pDateTime->minute, pDateTime->second, (pDateTime->microsecond / 1000)); + wxDateTime date_time = wxDateTime(pDateTime->day, (wxDateTime::Month)pDateTime->month.ToLE(), pDateTime->year, pDateTime->hour, pDateTime->minute, pDateTime->second, (pDateTime->microsecond / 1000)); puiDosTime = date_time.GetAsDOS(); return CELL_OK; @@ -398,7 +398,7 @@ int cellRtcGetTime_t(mem_ptr_t pDateTime, mem64_t piTime) return CELL_RTC_ERROR_INVALID_POINTER; // Convert to POSIX time_t. - wxDateTime date_time = wxDateTime::wxDateTime(pDateTime->day, (wxDateTime::Month)pDateTime->month.ToLE(), pDateTime->year, pDateTime->hour, pDateTime->minute, pDateTime->second, (pDateTime->microsecond / 1000)); + wxDateTime date_time = wxDateTime(pDateTime->day, (wxDateTime::Month)pDateTime->month.ToLE(), pDateTime->year, pDateTime->hour, pDateTime->minute, pDateTime->second, (pDateTime->microsecond / 1000)); piTime = convertToUNIXTime(date_time.GetSecond(wxDateTime::TZ::UTC), date_time.GetMinute(wxDateTime::TZ::UTC), date_time.GetHour(wxDateTime::TZ::UTC), date_time.GetDay(wxDateTime::TZ::UTC), date_time.GetYear(wxDateTime::TZ::UTC)); @@ -413,7 +413,7 @@ int cellRtcGetWin32FileTime(mem_ptr_t pDateTime, mem64_t pulWin return CELL_RTC_ERROR_INVALID_POINTER; // Convert to WIN32 FILETIME. - wxDateTime date_time = wxDateTime::wxDateTime(pDateTime->day, (wxDateTime::Month)pDateTime->month.ToLE(), pDateTime->year, pDateTime->hour, pDateTime->minute, pDateTime->second, (pDateTime->microsecond / 1000)); + wxDateTime date_time = wxDateTime(pDateTime->day, (wxDateTime::Month)pDateTime->month.ToLE(), pDateTime->year, pDateTime->hour, pDateTime->minute, pDateTime->second, (pDateTime->microsecond / 1000)); pulWin32FileTime = convertToWin32FILETIME(date_time.GetSecond(wxDateTime::TZ::UTC), date_time.GetMinute(wxDateTime::TZ::UTC), date_time.GetHour(wxDateTime::TZ::UTC), date_time.GetDay(wxDateTime::TZ::UTC), date_time.GetYear(wxDateTime::TZ::UTC)); @@ -448,7 +448,7 @@ int cellRtcSetTime_t(mem_ptr_t pDateTime, u64 iTime) if (!pDateTime.IsGood()) return CELL_RTC_ERROR_INVALID_POINTER; - wxDateTime date_time = wxDateTime::wxDateTime((time_t)iTime); + wxDateTime date_time = wxDateTime((time_t)iTime); pDateTime->year = date_time.GetYear(wxDateTime::TZ::UTC); pDateTime->month = date_time.GetMonth(wxDateTime::TZ::UTC); @@ -468,7 +468,7 @@ int cellRtcSetWin32FileTime(mem_ptr_t pDateTime, u64 ulWin32Fil if (!pDateTime.IsGood()) return CELL_RTC_ERROR_INVALID_POINTER; - wxDateTime date_time = wxDateTime::wxDateTime((time_t)ulWin32FileTime); + wxDateTime date_time = wxDateTime((time_t)ulWin32FileTime); pDateTime->year = date_time.GetYear(wxDateTime::TZ::UTC); pDateTime->month = date_time.GetMonth(wxDateTime::TZ::UTC); diff --git a/rpcs3/Emu/SysCalls/Modules/cellSpurs.h b/rpcs3/Emu/SysCalls/Modules/cellSpurs.h index 391a81f54d..3609e82b30 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSpurs.h +++ b/rpcs3/Emu/SysCalls/Modules/cellSpurs.h @@ -190,16 +190,19 @@ struct CellSpursTraceTaskData be_t task; }; +typedef be_t be_u32; +typedef be_t be_u64; + struct CellSpursTaskArgument { - be_t u32[4]; - be_t u64[2]; + be_u32 u32[4]; + be_u64 u64[2]; }; struct CellSpursTaskLsPattern { - be_t u32[4]; - be_t u64[2]; + be_u32 u32[4]; + be_u64 u64[2]; }; struct CellSpursTaskAttribute2 @@ -242,4 +245,4 @@ struct CellSpursTaskBinInfo // cellSpurs event flag. struct CellSpursEventFlag { u8 skip[128]; -}; \ No newline at end of file +}; diff --git a/rpcs3/Emu/SysCalls/Modules/cellSysutil_SaveData.cpp b/rpcs3/Emu/SysCalls/Modules/cellSysutil_SaveData.cpp index ce70b22ee4..695bf751dc 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSysutil_SaveData.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSysutil_SaveData.cpp @@ -235,7 +235,7 @@ s32 modifySaveDataFiles(mem_func_ptr_t& funcFile, mem_ vfsStream* file = NULL; void* buf = Memory.VirtualToRealAddr(fileSet->fileBuf_addr); - switch (fileSet->fileType) + switch ((u32)fileSet->fileType) { case CELL_SAVEDATA_FILETYPE_SECUREFILE: filepath += (char*)Memory.VirtualToRealAddr(fileSet->fileName_addr); break; case CELL_SAVEDATA_FILETYPE_NORMALFILE: filepath += (char*)Memory.VirtualToRealAddr(fileSet->fileName_addr); break; @@ -249,7 +249,7 @@ s32 modifySaveDataFiles(mem_func_ptr_t& funcFile, mem_ return CELL_SAVEDATA_ERROR_PARAM; } - switch (fileSet->fileOperation) + switch ((u32)fileSet->fileOperation) { case CELL_SAVEDATA_FILEOP_READ: file = Emu.GetVFS().OpenFile(filepath, vfsRead); diff --git a/rpcs3/Emu/SysCalls/Modules/sys_net.cpp b/rpcs3/Emu/SysCalls/Modules/sys_net.cpp index 61214fafeb..5ae038f0ae 100644 --- a/rpcs3/Emu/SysCalls/Modules/sys_net.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sys_net.cpp @@ -7,8 +7,13 @@ #ifdef _WIN32 #include #else +extern "C" +{ #include #include +#include +#include +} #endif void sys_net_init(); diff --git a/rpcs3/Loader/TRP.cpp b/rpcs3/Loader/TRP.cpp index de38f9cbca..c1596a916e 100644 --- a/rpcs3/Loader/TRP.cpp +++ b/rpcs3/Loader/TRP.cpp @@ -21,7 +21,7 @@ bool TRPLoader::Install(std::string dest, bool show) Emu.GetVFS().CreateDir(dest); for (const TRPEntry& entry : m_entries) { - char* buffer = new char [entry.size]; + char* buffer = new char [(u32)entry.size]; Emu.GetVFS().CreateFile(dest+entry.name); vfsFile file(dest+entry.name, vfsWrite); trp_f.Seek(entry.offset); diff --git a/rpcs3/rpcs3.vcxproj b/rpcs3/rpcs3.vcxproj index 6d4a66dbff..6a5a0f9b2e 100644 --- a/rpcs3/rpcs3.vcxproj +++ b/rpcs3/rpcs3.vcxproj @@ -295,6 +295,14 @@ + + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + NotUsing + @@ -457,6 +465,7 @@ + diff --git a/rpcs3/rpcs3.vcxproj.filters b/rpcs3/rpcs3.vcxproj.filters index e5adadf067..8546e9b72f 100644 --- a/rpcs3/rpcs3.vcxproj.filters +++ b/rpcs3/rpcs3.vcxproj.filters @@ -505,6 +505,9 @@ Emu\Memory + + Crypto + @@ -987,5 +990,8 @@ Emu\Cell + + Crypto + \ No newline at end of file