1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-25 04:02:42 +01:00

Merge pull request #90 from Aishou/master

Linux compilation fixes
This commit is contained in:
Alexandro Sánchez Bach 2014-03-04 15:18:12 +01:00
commit bc77f27bb2
11 changed files with 120 additions and 33 deletions

View File

@ -50,10 +50,11 @@ class be_t
public: public:
typedef T type; typedef T type;
#ifdef _WIN32 #ifdef _WIN32
be_t(){} be_t(){}
#else #else
be_t() noexcept = default be_t() noexcept = default;
#endif #endif
be_t(const T& value) be_t(const T& value)

View File

@ -1,6 +1,7 @@
#include <stdafx.h> #include <stdafx.h>
#include <Utilities/SMutex.h> #include <Utilities/SMutex.h>
__forceinline void SM_Sleep() __forceinline void SM_Sleep()
{ {
Sleep(1); Sleep(1);
@ -8,7 +9,7 @@ __forceinline void SM_Sleep()
__forceinline size_t SM_GetCurrentThreadId() __forceinline size_t SM_GetCurrentThreadId()
{ {
return std::this_thread::get_id().hash(); return std::hash<std::thread::id>()(std::this_thread::get_id());
} }
__forceinline u32 SM_GetCurrentCPUThreadId() __forceinline u32 SM_GetCurrentCPUThreadId()

View File

@ -15,7 +15,7 @@ public:
{ {
} }
bool Push(T& data) bool Push(const T& data)
{ {
while (true) while (true)
{ {
@ -96,4 +96,4 @@ public:
SMutexLocker lock(m_mutex); SMutexLocker lock(m_mutex);
m_count = 0; m_count = 0;
} }
}; };

View File

@ -1,5 +1,4 @@
cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 2.8)
project(rpcs3) project(rpcs3)
if (CMAKE_COMPILER_IS_GNUCXX) if (CMAKE_COMPILER_IS_GNUCXX)
@ -10,6 +9,7 @@ if (CMAKE_COMPILER_IS_GNUCXX)
add_definitions(-fpermissive) # TODO: remove me add_definitions(-fpermissive) # TODO: remove me
endif() endif()
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules)
SET(EXECUTABLE_OUTPUT_PATH "${CMAKE_SOURCE_DIR}/../bin") SET(EXECUTABLE_OUTPUT_PATH "${CMAKE_SOURCE_DIR}/../bin")
add_definitions(-DGL_GLEXT_PROTOTYPES) 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(wxWidgets COMPONENTS core base net aui gl REQUIRED)
find_package(OpenGL REQUIRED) find_package(OpenGL REQUIRED)
find_package(FFMPEG REQUIRED)
find_package(ZLIB REQUIRED) find_package(ZLIB REQUIRED)
include("${wxWidgets_USE_FILE}") include("${wxWidgets_USE_FILE}")
include_directories( include_directories(
${wxWidgets_INCLUDE_DIRS} ${wxWidgets_INCLUDE_DIRS}
${FFMPEG_INCLUDE_DIR}
${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/Emu ${CMAKE_SOURCE_DIR}/Emu
${CMAKE_SOURCE_DIR}/Gui ${CMAKE_SOURCE_DIR}/Gui
${CMAKE_SOURCE_DIR}/Loader ${CMAKE_SOURCE_DIR}/Loader
${CMAKE_SOURCE_DIR}/Crypto
${CMAKE_SOURCE_DIR}/.. ${CMAKE_SOURCE_DIR}/..
) )
@ -39,8 +42,11 @@ ${CMAKE_SOURCE_DIR}/Ini.cpp
${CMAKE_SOURCE_DIR}/Emu/* ${CMAKE_SOURCE_DIR}/Emu/*
${CMAKE_SOURCE_DIR}/Gui/* ${CMAKE_SOURCE_DIR}/Gui/*
${CMAKE_SOURCE_DIR}/Loader/* ${CMAKE_SOURCE_DIR}/Loader/*
${CMAKE_SOURCE_DIR}/Crypto/*
${CMAKE_SOURCE_DIR}/../Utilities/* ${CMAKE_SOURCE_DIR}/../Utilities/*
) )
add_executable(rpcs3 ${RPCS3_SRC}) 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})

View File

@ -188,7 +188,7 @@ int Unpack(wxFile& pkg_f, std::string src, std::string dst)
PKGHeader* m_header = (PKGHeader*) malloc (sizeof(PKGHeader)); PKGHeader* m_header = (PKGHeader*) malloc (sizeof(PKGHeader));
wxFile dec_pkg_f; 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); dec_pkg_f.Create(decryptedFile, true);
@ -219,4 +219,4 @@ int Unpack(wxFile& pkg_f, std::string src, std::string dst)
wxRemoveFile(decryptedFile); wxRemoveFile(decryptedFile);
return 0; return 0;
} }

View File

@ -525,7 +525,7 @@ bool SELFDecrypter::GetKeyFromRap(u8 *content_id, u8 *npdrm_key)
return false; 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.Read(rap_key, 0x10);
rap_file.Close(); rap_file.Close();
@ -671,4 +671,4 @@ bool DecryptSelf(const std::string& elf, const std::string& self)
} }
return true; return true;
} }

View File

@ -205,7 +205,7 @@ struct ControlInfo
for (int i = 0; i < 20; i++) for (int i = 0; i < 20; i++)
digest_str += wxString::Format("%02x", file_digest_30.digest[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); ConLog.Write("Unknown: 0x%llx", file_digest_30.unknown);
} }
else if (size == 0x40) else if (size == 0x40)
@ -218,8 +218,8 @@ struct ControlInfo
digest_str2 += wxString::Format("%02x", file_digest_40.digest2[i]); digest_str2 += wxString::Format("%02x", file_digest_40.digest2[i]);
} }
ConLog.Write("Digest1: %s", digest_str1); ConLog.Write("Digest1: %s", digest_str1.wc_str());
ConLog.Write("Digest2: %s", digest_str2); ConLog.Write("Digest2: %s", digest_str2.wc_str());
ConLog.Write("Unknown: 0x%llx", file_digest_40.unknown); ConLog.Write("Unknown: 0x%llx", file_digest_40.unknown);
} }
} }
@ -242,10 +242,10 @@ struct ControlInfo
ConLog.Write("Unknown1: 0x%08x", npdrm.unknown1); ConLog.Write("Unknown1: 0x%08x", npdrm.unknown1);
ConLog.Write("License: 0x%08x", npdrm.license); ConLog.Write("License: 0x%08x", npdrm.license);
ConLog.Write("Type: 0x%08x", npdrm.type); ConLog.Write("Type: 0x%08x", npdrm.type);
ConLog.Write("ContentID: %s", contentid_str); ConLog.Write("ContentID: %s", contentid_str.wc_str());
ConLog.Write("Digest: %s", digest_str); ConLog.Write("Digest: %s", digest_str.wc_str());
ConLog.Write("Inverse digest: %s", invdigest_str); ConLog.Write("Inverse digest: %s", invdigest_str.wc_str());
ConLog.Write("XOR digest: %s", xordigest_str); ConLog.Write("XOR digest: %s", xordigest_str.wc_str());
ConLog.Write("Unknown2: 0x%llx", npdrm.unknown2); ConLog.Write("Unknown2: 0x%llx", npdrm.unknown2);
ConLog.Write("Unknown3: 0x%llx", npdrm.unknown3); ConLog.Write("Unknown3: 0x%llx", npdrm.unknown3);
} }
@ -282,10 +282,10 @@ struct MetadataInfo
iv_pad_str += wxString::Format("%02x", iv_pad[i]); iv_pad_str += wxString::Format("%02x", iv_pad[i]);
} }
ConLog.Write("Key: %s", key_str); ConLog.Write("Key: %s", key_str.wc_str());
ConLog.Write("Key pad: %s", key_pad_str); ConLog.Write("Key pad: %s", key_pad_str.wc_str());
ConLog.Write("IV: %s", iv_str); ConLog.Write("IV: %s", iv_str.wc_str());
ConLog.Write("IV pad: %s", iv_pad_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 IsSelf(const std::string& path);
extern bool IsSelfElf32(const std::string& path); extern bool IsSelfElf32(const std::string& path);
extern bool CheckDebugSelf(const std::string& self, const std::string& elf); extern bool CheckDebugSelf(const std::string& self, const std::string& elf);
extern bool DecryptSelf(const std::string& elf, const std::string& self); extern bool DecryptSelf(const std::string& elf, const std::string& self);

View File

@ -306,7 +306,7 @@ public:
static const wxString& dir_path = "textures"; static const wxString& dir_path = "textures";
static const wxString& file_fmt = dir_path + "\\" + "tex[%d].png"; 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; u32 count = 0;
while(wxFileExists(wxString::Format(file_fmt, count))) count++; while(wxFileExists(wxString::Format(file_fmt, count))) count++;

View File

@ -524,12 +524,12 @@ struct CellAdecParamM4Aac
be_t<MPEG4AAC_ConfigType> configNumber; be_t<MPEG4AAC_ConfigType> configNumber;
union { union {
struct { struct struct mp { struct mp2
{ {
be_t<u32> adifProgramNumber; // 0 be_t<u32> adifProgramNumber; // 0
} adifConfig; }; } adifConfig; };
struct { struct struct mp3 { struct mp4
{ {
be_t<MPEG4AAC_SamplingFreq> samplingFreqIndex; be_t<MPEG4AAC_SamplingFreq> samplingFreqIndex;
be_t<u32> profile; // LC profile (1) be_t<u32> profile; // LC profile (1)
@ -557,8 +557,8 @@ struct CellAdecM4AacInfo
be_t<u32> pad1; // TODO: check alignment be_t<u32> pad1; // TODO: check alignment
union { union {
struct { struct mp5 {
struct struct m6
{ {
be_t<u32> copyrightIdPresent; be_t<u32> copyrightIdPresent;
char copyrightId[9]; char copyrightId[9];
@ -571,8 +571,8 @@ struct CellAdecM4AacInfo
} adif; } adif;
}; };
struct { struct mp7 {
struct struct mp8
{ {
be_t<u32> id; be_t<u32> id;
be_t<u32> layer; be_t<u32> layer;
@ -595,7 +595,7 @@ struct CellAdecM4AacInfo
be_t<u32> pad2; // TODO: check alignment be_t<u32> pad2; // TODO: check alignment
struct struct mp9
{ {
be_t<u32> matrixMixdownPresent; be_t<u32> matrixMixdownPresent;
be_t<u32> mixdownIndex; be_t<u32> mixdownIndex;

View File

@ -5,9 +5,9 @@
extern "C" extern "C"
{ {
#include "libavcodec\avcodec.h" #include "libavcodec/avcodec.h"
#include "libavformat\avformat.h" #include "libavformat/avformat.h"
#include "libavutil\imgutils.h" #include "libavutil/imgutils.h"
} }
#include "cellVdec.h" #include "cellVdec.h"

View File

@ -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 <mail@cynapses.org>
# Modified for other libraries by Lasse Kärkkäinen <tronic>
# 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)