diff --git a/Utilities/BEType.h b/Utilities/BEType.h index 5f17abc11b..02c47ed76d 100644 --- a/Utilities/BEType.h +++ b/Utilities/BEType.h @@ -50,10 +50,11 @@ class be_t public: typedef T type; + #ifdef _WIN32 be_t(){} #else - be_t() noexcept = default + be_t() noexcept = default; #endif be_t(const T& value) diff --git a/Utilities/SMutex.cpp b/Utilities/SMutex.cpp index 1f48903f4e..1d9bcb03f2 100644 --- a/Utilities/SMutex.cpp +++ b/Utilities/SMutex.cpp @@ -1,6 +1,7 @@ #include #include + __forceinline void SM_Sleep() { Sleep(1); @@ -8,7 +9,7 @@ __forceinline void SM_Sleep() __forceinline size_t SM_GetCurrentThreadId() { - return std::this_thread::get_id().hash(); + return std::hash()(std::this_thread::get_id()); } __forceinline u32 SM_GetCurrentCPUThreadId() diff --git a/Utilities/SQueue.h b/Utilities/SQueue.h index 1fee6f6727..a7021365e1 100644 --- a/Utilities/SQueue.h +++ b/Utilities/SQueue.h @@ -15,7 +15,7 @@ public: { } - bool Push(T& data) + bool Push(const T& data) { while (true) { @@ -96,4 +96,4 @@ public: SMutexLocker lock(m_mutex); m_count = 0; } -}; \ No newline at end of file +}; diff --git a/rpcs3/CMakeLists.txt b/rpcs3/CMakeLists.txt index 345ab3c3bc..ba436d5957 100644 --- a/rpcs3/CMakeLists.txt +++ b/rpcs3/CMakeLists.txt @@ -1,5 +1,4 @@ cmake_minimum_required(VERSION 2.8) - project(rpcs3) if (CMAKE_COMPILER_IS_GNUCXX) @@ -10,6 +9,7 @@ if (CMAKE_COMPILER_IS_GNUCXX) add_definitions(-fpermissive) # TODO: remove me endif() +set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules) SET(EXECUTABLE_OUTPUT_PATH "${CMAKE_SOURCE_DIR}/../bin") add_definitions(-DGL_GLEXT_PROTOTYPES) @@ -17,16 +17,19 @@ add_definitions(-DGLX_GLXEXT_PROTOTYPES) find_package(wxWidgets COMPONENTS core base net aui gl REQUIRED) find_package(OpenGL REQUIRED) +find_package(FFMPEG REQUIRED) find_package(ZLIB REQUIRED) include("${wxWidgets_USE_FILE}") include_directories( ${wxWidgets_INCLUDE_DIRS} +${FFMPEG_INCLUDE_DIR} ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/Emu ${CMAKE_SOURCE_DIR}/Gui ${CMAKE_SOURCE_DIR}/Loader +${CMAKE_SOURCE_DIR}/Crypto ${CMAKE_SOURCE_DIR}/.. ) @@ -39,8 +42,11 @@ ${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/* ) add_executable(rpcs3 ${RPCS3_SRC}) -target_link_libraries(rpcs3 ${wxWidgets_LIBRARIES} ${OPENGL_LIBRARIES} ${ZLIB_LIBRARIES}) \ No newline at end of file + +target_link_libraries(rpcs3 ${wxWidgets_LIBRARIES} ${OPENGL_LIBRARIES} ${ZLIB_LIBRARIES} ${FFMPEG_LIBRARIES}) + diff --git a/rpcs3/Crypto/unpkg.cpp b/rpcs3/Crypto/unpkg.cpp index df59689dd4..52cd20c772 100644 --- a/rpcs3/Crypto/unpkg.cpp +++ b/rpcs3/Crypto/unpkg.cpp @@ -188,7 +188,7 @@ int Unpack(wxFile& pkg_f, std::string src, std::string dst) PKGHeader* m_header = (PKGHeader*) malloc (sizeof(PKGHeader)); wxFile dec_pkg_f; - std::string decryptedFile = wxGetCwd() + "/dev_hdd1/" + src + ".dec"; + std::string decryptedFile = wxGetCwd().ToStdString() + "/dev_hdd1/" + src + ".dec"; dec_pkg_f.Create(decryptedFile, true); @@ -219,4 +219,4 @@ int Unpack(wxFile& pkg_f, std::string src, std::string dst) wxRemoveFile(decryptedFile); return 0; -} \ No newline at end of file +} diff --git a/rpcs3/Crypto/unself.cpp b/rpcs3/Crypto/unself.cpp index 2923615a0b..8a98c4a87f 100644 --- a/rpcs3/Crypto/unself.cpp +++ b/rpcs3/Crypto/unself.cpp @@ -525,7 +525,7 @@ bool SELFDecrypter::GetKeyFromRap(u8 *content_id, u8 *npdrm_key) return false; } - ConLog.Write("Loading RAP file %s", ci_str + ".rap"); + ConLog.Write("Loading RAP file %s", ci_str.wc_str() + wchar_t(".rap")); rap_file.Read(rap_key, 0x10); rap_file.Close(); @@ -671,4 +671,4 @@ bool DecryptSelf(const std::string& elf, const std::string& self) } return true; -} \ No newline at end of file +} diff --git a/rpcs3/Crypto/unself.h b/rpcs3/Crypto/unself.h index a6f2a42c97..3c0dd395e3 100644 --- a/rpcs3/Crypto/unself.h +++ b/rpcs3/Crypto/unself.h @@ -205,7 +205,7 @@ struct ControlInfo for (int i = 0; i < 20; i++) digest_str += wxString::Format("%02x", file_digest_30.digest[i]); - ConLog.Write("Digest: %s", digest_str); + ConLog.Write("Digest: %s", digest_str.wc_str()); ConLog.Write("Unknown: 0x%llx", file_digest_30.unknown); } else if (size == 0x40) @@ -218,8 +218,8 @@ struct ControlInfo digest_str2 += wxString::Format("%02x", file_digest_40.digest2[i]); } - ConLog.Write("Digest1: %s", digest_str1); - ConLog.Write("Digest2: %s", digest_str2); + ConLog.Write("Digest1: %s", digest_str1.wc_str()); + ConLog.Write("Digest2: %s", digest_str2.wc_str()); ConLog.Write("Unknown: 0x%llx", file_digest_40.unknown); } } @@ -242,10 +242,10 @@ struct ControlInfo ConLog.Write("Unknown1: 0x%08x", npdrm.unknown1); ConLog.Write("License: 0x%08x", npdrm.license); ConLog.Write("Type: 0x%08x", npdrm.type); - ConLog.Write("ContentID: %s", contentid_str); - ConLog.Write("Digest: %s", digest_str); - ConLog.Write("Inverse digest: %s", invdigest_str); - ConLog.Write("XOR digest: %s", xordigest_str); + ConLog.Write("ContentID: %s", contentid_str.wc_str()); + ConLog.Write("Digest: %s", digest_str.wc_str()); + ConLog.Write("Inverse digest: %s", invdigest_str.wc_str()); + ConLog.Write("XOR digest: %s", xordigest_str.wc_str()); ConLog.Write("Unknown2: 0x%llx", npdrm.unknown2); ConLog.Write("Unknown3: 0x%llx", npdrm.unknown3); } @@ -282,10 +282,10 @@ struct MetadataInfo iv_pad_str += wxString::Format("%02x", iv_pad[i]); } - ConLog.Write("Key: %s", key_str); - ConLog.Write("Key pad: %s", key_pad_str); - ConLog.Write("IV: %s", iv_str); - ConLog.Write("IV pad: %s", iv_pad_str); + ConLog.Write("Key: %s", key_str.wc_str()); + ConLog.Write("Key pad: %s", key_pad_str.wc_str()); + ConLog.Write("IV: %s", iv_str.wc_str()); + ConLog.Write("IV pad: %s", iv_pad_str.wc_str()); } }; @@ -505,4 +505,4 @@ public: extern bool IsSelf(const std::string& path); extern bool IsSelfElf32(const std::string& path); extern bool CheckDebugSelf(const std::string& self, const std::string& elf); -extern bool DecryptSelf(const std::string& elf, const std::string& self); \ No newline at end of file +extern bool DecryptSelf(const std::string& elf, const std::string& self); diff --git a/rpcs3/Emu/GS/GL/GLGSRender.h b/rpcs3/Emu/GS/GL/GLGSRender.h index e3875f665d..5f503bde02 100644 --- a/rpcs3/Emu/GS/GL/GLGSRender.h +++ b/rpcs3/Emu/GS/GL/GLGSRender.h @@ -306,7 +306,7 @@ public: static const wxString& dir_path = "textures"; static const wxString& file_fmt = dir_path + "\\" + "tex[%d].png"; - if(!wxDirExists(dir_path)) wxMkDir(dir_path); + if(!wxDirExists(dir_path)) wxMkdir(dir_path); u32 count = 0; while(wxFileExists(wxString::Format(file_fmt, count))) count++; diff --git a/rpcs3/Emu/SysCalls/Modules/cellAdec.h b/rpcs3/Emu/SysCalls/Modules/cellAdec.h index 2aa17ead21..d2e034b9bb 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellAdec.h +++ b/rpcs3/Emu/SysCalls/Modules/cellAdec.h @@ -524,12 +524,12 @@ struct CellAdecParamM4Aac be_t configNumber; union { - struct { struct + struct mp { struct mp2 { be_t adifProgramNumber; // 0 } adifConfig; }; - struct { struct + struct mp3 { struct mp4 { be_t samplingFreqIndex; be_t profile; // LC profile (1) @@ -557,8 +557,8 @@ struct CellAdecM4AacInfo be_t pad1; // TODO: check alignment union { - struct { - struct + struct mp5 { + struct m6 { be_t copyrightIdPresent; char copyrightId[9]; @@ -571,8 +571,8 @@ struct CellAdecM4AacInfo } adif; }; - struct { - struct + struct mp7 { + struct mp8 { be_t id; be_t layer; @@ -595,7 +595,7 @@ struct CellAdecM4AacInfo be_t pad2; // TODO: check alignment - struct + struct mp9 { be_t matrixMixdownPresent; be_t mixdownIndex; diff --git a/rpcs3/Emu/SysCalls/Modules/cellVdec.cpp b/rpcs3/Emu/SysCalls/Modules/cellVdec.cpp index c0dd39dcfe..232e389f8e 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellVdec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellVdec.cpp @@ -5,9 +5,9 @@ extern "C" { -#include "libavcodec\avcodec.h" -#include "libavformat\avformat.h" -#include "libavutil\imgutils.h" +#include "libavcodec/avcodec.h" +#include "libavformat/avformat.h" +#include "libavutil/imgutils.h" } #include "cellVdec.h" diff --git a/rpcs3/cmake_modules/FindFFMPEG.cmake b/rpcs3/cmake_modules/FindFFMPEG.cmake new file mode 100644 index 0000000000..6be21cd8ab --- /dev/null +++ b/rpcs3/cmake_modules/FindFFMPEG.cmake @@ -0,0 +1,79 @@ +# - Try to find ffmpeg libraries (libavcodec, libavformat and libavutil) +# Once done this will define +# +# FFMPEG_FOUND - system has ffmpeg or libav +# FFMPEG_INCLUDE_DIR - the ffmpeg include directory +# FFMPEG_LIBRARIES - Link these to use ffmpeg +# FFMPEG_LIBAVCODEC +# FFMPEG_LIBAVFORMAT +# FFMPEG_LIBAVUTIL +# +# Copyright (c) 2008 Andreas Schneider +# Modified for other libraries by Lasse Kärkkäinen +# Modified for Hedgewars by Stepik777 +# +# Redistribution and use is allowed according to the terms of the New +# BSD license. +# + +if (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR) + # in cache already + set(FFMPEG_FOUND TRUE) +else (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR) + # use pkg-config to get the directories and then use these values + # in the FIND_PATH() and FIND_LIBRARY() calls + find_package(PkgConfig) + if (PKG_CONFIG_FOUND) + pkg_check_modules(_FFMPEG_AVCODEC libavcodec) + pkg_check_modules(_FFMPEG_AVFORMAT libavformat) + pkg_check_modules(_FFMPEG_AVUTIL libavutil) + endif (PKG_CONFIG_FOUND) + + find_path(FFMPEG_AVCODEC_INCLUDE_DIR + NAMES libavcodec/avcodec.h + PATHS ${_FFMPEG_AVCODEC_INCLUDE_DIRS} /usr/include /usr/local/include /opt/local/include /sw/include + PATH_SUFFIXES ffmpeg libav + ) + + find_library(FFMPEG_LIBAVCODEC + NAMES avcodec + PATHS ${_FFMPEG_AVCODEC_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib + ) + + find_library(FFMPEG_LIBAVFORMAT + NAMES avformat + PATHS ${_FFMPEG_AVFORMAT_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib + ) + + find_library(FFMPEG_LIBAVUTIL + NAMES avutil + PATHS ${_FFMPEG_AVUTIL_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib + ) + + if (FFMPEG_LIBAVCODEC AND FFMPEG_LIBAVFORMAT) + set(FFMPEG_FOUND TRUE) + endif() + + if (FFMPEG_FOUND) + set(FFMPEG_INCLUDE_DIR ${FFMPEG_AVCODEC_INCLUDE_DIR}) + + set(FFMPEG_LIBRARIES + ${FFMPEG_LIBAVCODEC} + ${FFMPEG_LIBAVFORMAT} + ${FFMPEG_LIBAVUTIL} + ) + + endif (FFMPEG_FOUND) + + if (FFMPEG_FOUND) + if (NOT FFMPEG_FIND_QUIETLY) + message(STATUS "Found FFMPEG or Libav: ${FFMPEG_LIBRARIES}, ${FFMPEG_INCLUDE_DIR}") + endif (NOT FFMPEG_FIND_QUIETLY) + else (FFMPEG_FOUND) + if (FFMPEG_FIND_REQUIRED) + message(FATAL_ERROR "Could not find libavcodec or libavformat or libavutil") + endif (FFMPEG_FIND_REQUIRED) + endif (FFMPEG_FOUND) + +endif (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR) +