From f85420b343e22beb6b14f2ca249264b9e77b9f9f Mon Sep 17 00:00:00 2001 From: Aishou Date: Mon, 24 Feb 2014 08:51:57 +0100 Subject: [PATCH 1/9] small compile fixes --- Utilities/BEType.h | 5 +++-- rpcs3/Emu/GS/GL/GLGSRender.h | 2 +- rpcs3/Emu/SysCalls/Modules/cellAdec.h | 14 +++++++------- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Utilities/BEType.h b/Utilities/BEType.h index 17e8e61beb..7711716114 100644 --- a/Utilities/BEType.h +++ b/Utilities/BEType.h @@ -51,9 +51,10 @@ class be_t public: typedef T type; #ifdef __GNUG__ - be_t() noexcept = default -#endif + be_t() noexcept = default; +#else be_t(){} +#endif be_t(const T& value) { diff --git a/rpcs3/Emu/GS/GL/GLGSRender.h b/rpcs3/Emu/GS/GL/GLGSRender.h index e3875f665d..8fc4c3ea97 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, wxS_DIR_DEFAULT ); 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; From fd564159b58cbd5d850ad55472eb3f3e9056f99d Mon Sep 17 00:00:00 2001 From: Aishou Date: Fri, 28 Feb 2014 20:21:52 +0100 Subject: [PATCH 2/9] gcc.. --- Utilities/BEType.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Utilities/BEType.h b/Utilities/BEType.h index 2f940c1e80..02c47ed76d 100644 --- a/Utilities/BEType.h +++ b/Utilities/BEType.h @@ -54,7 +54,7 @@ public: #ifdef _WIN32 be_t(){} #else - be_t() noexcept = default + be_t() noexcept = default; #endif be_t(const T& value) From d418cceae46ad97fe3bab604868ca339a802ea47 Mon Sep 17 00:00:00 2001 From: Aishou Date: Sat, 1 Mar 2014 15:32:15 +0100 Subject: [PATCH 3/9] fix the typo. --- rpcs3/Emu/GS/GL/GLGSRender.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpcs3/Emu/GS/GL/GLGSRender.h b/rpcs3/Emu/GS/GL/GLGSRender.h index 8fc4c3ea97..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, wxS_DIR_DEFAULT ); + if(!wxDirExists(dir_path)) wxMkdir(dir_path); u32 count = 0; while(wxFileExists(wxString::Format(file_fmt, count))) count++; From bea8be29d5fcf2fa55166a90ae2ad7b48914be6f Mon Sep 17 00:00:00 2001 From: Aishou Date: Sun, 2 Mar 2014 12:55:20 +0100 Subject: [PATCH 4/9] get ffmpeg working with cmake.. --- rpcs3/CMakeLists.txt | 3 + rpcs3/Emu/SysCalls/Modules/cellVdec.cpp | 6 +- rpcs3/cmake_modules/FindFFMPEG.cmake | 79 +++++++++++++++++++++++++ 3 files changed, 85 insertions(+), 3 deletions(-) create mode 100644 rpcs3/cmake_modules/FindFFMPEG.cmake diff --git a/rpcs3/CMakeLists.txt b/rpcs3/CMakeLists.txt index 3f041c074e..ded21a1ae2 100644 --- a/rpcs3/CMakeLists.txt +++ b/rpcs3/CMakeLists.txt @@ -10,6 +10,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,12 +18,14 @@ 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 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) + From 851acfdbf35604651dc1c6825d843f98ed59d3da Mon Sep 17 00:00:00 2001 From: Aishou Date: Sun, 2 Mar 2014 13:00:57 +0100 Subject: [PATCH 5/9] add ffmpeg to link.. --- rpcs3/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpcs3/CMakeLists.txt b/rpcs3/CMakeLists.txt index ded21a1ae2..bddfb32fd8 100644 --- a/rpcs3/CMakeLists.txt +++ b/rpcs3/CMakeLists.txt @@ -47,4 +47,4 @@ ${CMAKE_SOURCE_DIR}/../scetool/scetool.cpp ) add_executable(rpcs3 ${RPCS3_SRC}) -target_link_libraries(rpcs3 ${wxWidgets_LIBRARIES} ${OPENGL_LIBRARIES} ${ZLIB_LIBRARIES}) +target_link_libraries(rpcs3 ${wxWidgets_LIBRARIES} ${OPENGL_LIBRARIES} ${ZLIB_LIBRARIES} ${FFMPEG_LIBRARIES}) From 85626024a0e98469d458ab1c74e05abbb07aaf2d Mon Sep 17 00:00:00 2001 From: Aishou Date: Mon, 3 Mar 2014 11:44:00 +0100 Subject: [PATCH 6/9] fix gcc complain about non-const reference... --- Utilities/SQueue.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 +}; From caa797cee34d4c8c1b87e6b25cab4e0e7b9fc009 Mon Sep 17 00:00:00 2001 From: Aishou Date: Mon, 3 Mar 2014 12:05:15 +0100 Subject: [PATCH 7/9] not sure about it.. but compiles.. --- Utilities/SMutex.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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() From 354cf24302bd868835e3bc87ca55b20ef3346598 Mon Sep 17 00:00:00 2001 From: Aishou Date: Mon, 3 Mar 2014 14:51:54 +0100 Subject: [PATCH 8/9] fix gcc compile... --- rpcs3/Crypto/unself.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) 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); From d32025ae3cdb921ab359f7fc27bc28d03b165b1b Mon Sep 17 00:00:00 2001 From: Aishou Date: Tue, 4 Mar 2014 09:37:28 +0100 Subject: [PATCH 9/9] more fixes... --- rpcs3/Crypto/unpkg.cpp | 4 ++-- rpcs3/Crypto/unself.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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 +}