From f85420b343e22beb6b14f2ca249264b9e77b9f9f Mon Sep 17 00:00:00 2001 From: Aishou Date: Mon, 24 Feb 2014 08:51:57 +0100 Subject: [PATCH 01/13] 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 02/13] 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 03/13] 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 04/13] 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 05/13] 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 06/13] 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 07/13] 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 08/13] 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 09/13] 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 +} From 8204deaae6fad61c01714b6d558addb2bf60ca87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandro=20S=C3=A1nchez=20Bach?= Date: Tue, 4 Mar 2014 15:40:15 +0100 Subject: [PATCH 10/13] Minor changes * Fixed some forgotten `!` in cellFsGetFreeSize. * Fixed VSUM2SWS opcode. * Added cellNetCtl to the project. * Implemented cellNetCtlGetState. --- rpcs3/Crypto/unself.cpp | 2 +- rpcs3/Emu/Cell/PPUInterpreter.h | 4 ++-- rpcs3/Emu/SysCalls/Modules/cellNetCtl.cpp | 18 ++++++++++++++++-- rpcs3/Emu/SysCalls/lv2/SC_FileSystem.cpp | 2 +- rpcs3/rpcs3.vcxproj | 1 + rpcs3/rpcs3.vcxproj.filters | 3 +++ 6 files changed, 24 insertions(+), 6 deletions(-) diff --git a/rpcs3/Crypto/unself.cpp b/rpcs3/Crypto/unself.cpp index 8a98c4a87f..df298b434c 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.wc_str() + wchar_t(".rap")); + ConLog.Write("Loading RAP file %s", ci_str.wc_str() + wchar_t(".rap")); rap_file.Read(rap_key, 0x10); rap_file.Close(); diff --git a/rpcs3/Emu/Cell/PPUInterpreter.h b/rpcs3/Emu/Cell/PPUInterpreter.h index 8f2e11ba1d..3413e2f3f0 100644 --- a/rpcs3/Emu/Cell/PPUInterpreter.h +++ b/rpcs3/Emu/Cell/PPUInterpreter.h @@ -1889,8 +1889,6 @@ private: } void VSUM2SWS(u32 vd, u32 va, u32 vb) { - CPU.VPR[vd].Clear(); - for (uint n = 0; n < 2; n++) { s64 sum = (s64)CPU.VPR[va]._s32[n*2] + CPU.VPR[va]._s32[n*2 + 1] + CPU.VPR[vb]._s32[n*2]; @@ -1908,6 +1906,8 @@ private: else CPU.VPR[vd]._s32[n*2] = (s32)sum; } + CPU.VPR[vd]._s32[1] = 0; + CPU.VPR[vd]._s32[3] = 0; } void VSUM4SBS(u32 vd, u32 va, u32 vb) { diff --git a/rpcs3/Emu/SysCalls/Modules/cellNetCtl.cpp b/rpcs3/Emu/SysCalls/Modules/cellNetCtl.cpp index 9dc8a2364b..6c4dfa6e4c 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellNetCtl.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellNetCtl.cpp @@ -45,6 +45,15 @@ enum CELL_NET_CTL_ERROR_DHCP_LEASE_TIME = 0x80130504, }; +// Network connection states +enum +{ + CELL_NET_CTL_STATE_Disconnected = 0, + CELL_NET_CTL_STATE_Connecting = 1, + CELL_NET_CTL_STATE_IPObtaining = 2, + CELL_NET_CTL_STATE_IPObtained = 3, +}; + int cellNetCtlInit() { UNIMPLEMENTED_FUNC(cellNetCtl); @@ -57,9 +66,14 @@ int cellNetCtlTerm() return CELL_OK; } -int cellNetCtlGetState() +int cellNetCtlGetState(mem32_t state) { - UNIMPLEMENTED_FUNC(cellNetCtl); + cellNetCtl.Log("cellNetCtlGetState(state_addr=0x%x)", state.GetAddr()); + + if (!state.IsGood()) + return CELL_NET_CTL_ERROR_INVALID_ADDR; + + state = CELL_NET_CTL_STATE_Disconnected; // TODO: Allow other states return CELL_OK; } diff --git a/rpcs3/Emu/SysCalls/lv2/SC_FileSystem.cpp b/rpcs3/Emu/SysCalls/lv2/SC_FileSystem.cpp index 0c51ef825d..80b425bf02 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_FileSystem.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_FileSystem.cpp @@ -472,7 +472,7 @@ int cellFsGetFreeSize(u32 path_addr, mem32_t block_size, mem64_t block_count) sys_fs.Warning("cellFsGetFreeSize(path=\"%s\", block_size_addr=0x%x, block_count_addr=0x%x)", ps3_path.wx_str(), block_size.GetAddr(), block_count.GetAddr()); - if (Memory.IsGoodAddr(path_addr) || !block_size.IsGood() || !block_count.IsGood()) + if (!Memory.IsGoodAddr(path_addr) || !block_size.IsGood() || !block_count.IsGood()) return CELL_EFAULT; if (ps3_path.empty()) diff --git a/rpcs3/rpcs3.vcxproj b/rpcs3/rpcs3.vcxproj index 9e53606cac..4c7a3726a3 100644 --- a/rpcs3/rpcs3.vcxproj +++ b/rpcs3/rpcs3.vcxproj @@ -291,6 +291,7 @@ + diff --git a/rpcs3/rpcs3.vcxproj.filters b/rpcs3/rpcs3.vcxproj.filters index 28561ebfcf..b5f5f44515 100644 --- a/rpcs3/rpcs3.vcxproj.filters +++ b/rpcs3/rpcs3.vcxproj.filters @@ -436,6 +436,9 @@ Crypto + + Emu\SysCalls\Modules + From 39d3814be73d06d55f3207f73fedabe04f7e9f0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandro=20S=C3=A1nchez=20Bach?= Date: Thu, 6 Mar 2014 01:52:23 +0100 Subject: [PATCH 11/13] Changes in cellRtc & sceNpTrophy * Two header files added: cellRtc.h and sceNpTrophy.h * Changes in sceNpTrophyCreateContext. * Implemented sceNpTrophyGetTrophyInfo. --- rpcs3/Emu/SysCalls/Modules/cellRtc.cpp | 37 +--------- rpcs3/Emu/SysCalls/Modules/cellRtc.h | 36 ++++++++++ rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp | 77 ++++++-------------- rpcs3/Emu/SysCalls/Modules/sceNpTrophy.h | 84 ++++++++++++++++++++++ 4 files changed, 144 insertions(+), 90 deletions(-) create mode 100644 rpcs3/Emu/SysCalls/Modules/cellRtc.h create mode 100644 rpcs3/Emu/SysCalls/Modules/sceNpTrophy.h diff --git a/rpcs3/Emu/SysCalls/Modules/cellRtc.cpp b/rpcs3/Emu/SysCalls/Modules/cellRtc.cpp index eb03cc225f..9162c06cb7 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellRtc.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellRtc.cpp @@ -2,44 +2,11 @@ #include "Emu/SysCalls/SysCalls.h" #include "Emu/SysCalls/SC_FUNC.h" +#include "cellRtc.h" + void cellRtc_init(); Module cellRtc(0x0009, cellRtc_init); -// Return Codes -enum -{ - CELL_RTC_ERROR_NOT_INITIALIZED = 0x80010601, - CELL_RTC_ERROR_INVALID_POINTER = 0x80010602, - CELL_RTC_ERROR_INVALID_VALUE = 0x80010603, - CELL_RTC_ERROR_INVALID_ARG = 0x80010604, - CELL_RTC_ERROR_NOT_SUPPORTED = 0x80010605, - CELL_RTC_ERROR_NO_CLOCK = 0x80010606, - CELL_RTC_ERROR_BAD_PARSE = 0x80010607, - CELL_RTC_ERROR_INVALID_YEAR = 0x80010621, - CELL_RTC_ERROR_INVALID_MONTH = 0x80010622, - CELL_RTC_ERROR_INVALID_DAY = 0x80010623, - CELL_RTC_ERROR_INVALID_HOUR = 0x80010624, - CELL_RTC_ERROR_INVALID_MINUTE = 0x80010625, - CELL_RTC_ERROR_INVALID_SECOND = 0x80010626, - CELL_RTC_ERROR_INVALID_MICROSECOND = 0x80010627, -}; - -struct CellRtcTick -{ - u64 tick; -}; - -struct CellRtcDateTime -{ - u16 year; - u16 month; - u16 day; - u16 hour; - u16 minute; - u16 second; - u32 microsecond; -}; - long convertToUNIXTime(u16 seconds, u16 minutes, u16 hours, u16 days, int years) { return (seconds + minutes*60 + hours*3600 + days*86400 + (years-70)*31536000 + ((years-69)/4)*86400 - ((years-1)/100)*86400 + ((years+299)/400)*86400); diff --git a/rpcs3/Emu/SysCalls/Modules/cellRtc.h b/rpcs3/Emu/SysCalls/Modules/cellRtc.h new file mode 100644 index 0000000000..5e9483c917 --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/cellRtc.h @@ -0,0 +1,36 @@ +#pragma once + +// Return Codes +enum +{ + CELL_RTC_ERROR_NOT_INITIALIZED = 0x80010601, + CELL_RTC_ERROR_INVALID_POINTER = 0x80010602, + CELL_RTC_ERROR_INVALID_VALUE = 0x80010603, + CELL_RTC_ERROR_INVALID_ARG = 0x80010604, + CELL_RTC_ERROR_NOT_SUPPORTED = 0x80010605, + CELL_RTC_ERROR_NO_CLOCK = 0x80010606, + CELL_RTC_ERROR_BAD_PARSE = 0x80010607, + CELL_RTC_ERROR_INVALID_YEAR = 0x80010621, + CELL_RTC_ERROR_INVALID_MONTH = 0x80010622, + CELL_RTC_ERROR_INVALID_DAY = 0x80010623, + CELL_RTC_ERROR_INVALID_HOUR = 0x80010624, + CELL_RTC_ERROR_INVALID_MINUTE = 0x80010625, + CELL_RTC_ERROR_INVALID_SECOND = 0x80010626, + CELL_RTC_ERROR_INVALID_MICROSECOND = 0x80010627, +}; + +struct CellRtcTick +{ + u64 tick; +}; + +struct CellRtcDateTime +{ + u16 year; + u16 month; + u16 day; + u16 hour; + u16 minute; + u16 second; + u32 microsecond; +}; diff --git a/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp b/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp index d889553017..bae2bf372b 100644 --- a/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp @@ -3,61 +3,14 @@ #include "Emu/SysCalls/SC_FUNC.h" #include "sceNp.h" +#include "sceNpTrophy.h" #include "Loader/TRP.h" void sceNpTrophy_unload(); void sceNpTrophy_init(); Module sceNpTrophy(0xf035, sceNpTrophy_init, nullptr, sceNpTrophy_unload); -enum -{ - SCE_NP_TROPHY_ERROR_ALREADY_INITIALIZED = 0x80022901, - SCE_NP_TROPHY_ERROR_NOT_INITIALIZED = 0x80022902, - SCE_NP_TROPHY_ERROR_NOT_SUPPORTED = 0x80022903, - SCE_NP_TROPHY_ERROR_CONTEXT_NOT_REGISTERED = 0x80022904, - SCE_NP_TROPHY_ERROR_OUT_OF_MEMORY = 0x80022905, - SCE_NP_TROPHY_ERROR_INVALID_ARGUMENT = 0x80022906, - SCE_NP_TROPHY_ERROR_EXCEEDS_MAX = 0x80022907, - SCE_NP_TROPHY_ERROR_INSUFFICIENT = 0x80022909, - SCE_NP_TROPHY_ERROR_UNKNOWN_CONTEXT = 0x8002290a, - SCE_NP_TROPHY_ERROR_INVALID_FORMAT = 0x8002290b, - SCE_NP_TROPHY_ERROR_BAD_RESPONSE = 0x8002290c, - SCE_NP_TROPHY_ERROR_INVALID_GRADE = 0x8002290d, - SCE_NP_TROPHY_ERROR_INVALID_CONTEXT = 0x8002290e, - SCE_NP_TROPHY_ERROR_PROCESSING_ABORTED = 0x8002290f, - SCE_NP_TROPHY_ERROR_ABORT = 0x80022910, - SCE_NP_TROPHY_ERROR_UNKNOWN_HANDLE = 0x80022911, - SCE_NP_TROPHY_ERROR_LOCKED = 0x80022912, - SCE_NP_TROPHY_ERROR_HIDDEN = 0x80022913, - SCE_NP_TROPHY_ERROR_CANNOT_UNLOCK_PLATINUM = 0x80022914, - SCE_NP_TROPHY_ERROR_ALREADY_UNLOCKED = 0x80022915, - SCE_NP_TROPHY_ERROR_INVALID_TYPE = 0x80022916, - SCE_NP_TROPHY_ERROR_INVALID_HANDLE = 0x80022917, - SCE_NP_TROPHY_ERROR_INVALID_NP_COMM_ID = 0x80022918, - SCE_NP_TROPHY_ERROR_UNKNOWN_NP_COMM_ID = 0x80022919, - SCE_NP_TROPHY_ERROR_DISC_IO = 0x8002291a, - SCE_NP_TROPHY_ERROR_CONF_DOES_NOT_EXIST = 0x8002291b, - SCE_NP_TROPHY_ERROR_UNSUPPORTED_FORMAT = 0x8002291c, - SCE_NP_TROPHY_ERROR_ALREADY_INSTALLED = 0x8002291d, - SCE_NP_TROPHY_ERROR_BROKEN_DATA = 0x8002291e, - SCE_NP_TROPHY_ERROR_VERIFICATION_FAILURE = 0x8002291f, - SCE_NP_TROPHY_ERROR_INVALID_TROPHY_ID = 0x80022920, - SCE_NP_TROPHY_ERROR_UNKNOWN_TROPHY_ID = 0x80022921, - SCE_NP_TROPHY_ERROR_UNKNOWN_TITLE = 0x80022922, - SCE_NP_TROPHY_ERROR_UNKNOWN_FILE = 0x80022923, - SCE_NP_TROPHY_ERROR_DISC_NOT_MOUNTED = 0x80022924, - SCE_NP_TROPHY_ERROR_SHUTDOWN = 0x80022925, - SCE_NP_TROPHY_ERROR_TITLE_ICON_NOT_FOUND = 0x80022926, - SCE_NP_TROPHY_ERROR_TROPHY_ICON_NOT_FOUND = 0x80022927, - SCE_NP_TROPHY_ERROR_INSUFFICIENT_DISK_SPACE = 0x80022928, - SCE_NP_TROPHY_ERROR_ILLEGAL_UPDATE = 0x8002292a, - SCE_NP_TROPHY_ERROR_SAVEDATA_USER_DOES_NOT_MATCH = 0x8002292b, - SCE_NP_TROPHY_ERROR_TROPHY_ID_DOES_NOT_EXIST = 0x8002292c, - SCE_NP_TROPHY_ERROR_SERVICE_UNAVAILABLE = 0x8002292d, - SCE_NP_TROPHY_ERROR_UNKNOWN = 0x800229ff, -}; - - +// Internal Structs struct sceNpTrophyInternalContext { // TODO @@ -115,15 +68,15 @@ int sceNpTrophyCreateContext(mem32_t context, mem_ptr_t co { if (entry->flags & DirEntry_TypeDir) { - std::shared_ptr f(Emu.GetVFS().OpenFile("/app_home/TROPDIR/" + entry->name + "/TROPHY.TRP", vfsRead)); + vfsStream* stream = Emu.GetVFS().OpenFile("/app_home/TROPDIR/" + entry->name + "/TROPHY.TRP", vfsRead); - if (f && f->IsOpened()) + if (stream && stream->IsOpened()) { sceNpTrophyInternalContext ctxt; - ctxt.trp_stream = f.get(); + ctxt.trp_stream = stream; ctxt.trp_name = entry->name; s_npTrophyInstance.contexts.push_back(ctxt); - f = nullptr; + stream = nullptr; return CELL_OK; } } @@ -253,9 +206,23 @@ int sceNpTrophyGetTrophyIcon() return CELL_OK; } -int sceNpTrophyGetTrophyInfo() +int sceNpTrophyGetTrophyInfo(u32 context, u32 handle, s32 trophyId, mem_ptr_t details, mem_ptr_t data) { - UNIMPLEMENTED_FUNC(sceNpTrophy); + sceNpTrophy.Warning("sceNpTrophyGetTrophyInfo(context=%u, handle=%u, trophyId=%d, details_addr=0x%x, data_addr=0x%x)", + context, handle, trophyId, details.GetAddr(), data.GetAddr()); + + if (!s_npTrophyInstance.m_bInitialized) + return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; + if (!details.IsGood() || !data.IsGood()) + return SCE_NP_TROPHY_ERROR_INVALID_ARGUMENT; + // TODO: There are other possible errors + + // sceNpTrophyInternalContext& ctxt = s_npTrophyInstance.contexts[context]; + memcpy(details->name, "Some Trophy", SCE_NP_TROPHY_NAME_MAX_SIZE); + memcpy(details->description, "Hey! Implement a XML reader, and load the description from TROP.SFM", SCE_NP_TROPHY_DESCR_MAX_SIZE); + details->hidden = false; + details->trophyId = trophyId; + details->trophyGrade = SCE_NP_TROPHY_GRADE_GOLD; return CELL_OK; } diff --git a/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.h b/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.h new file mode 100644 index 0000000000..2bcf4b15c8 --- /dev/null +++ b/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.h @@ -0,0 +1,84 @@ +#pragma once +#include "cellRtc.h" + +enum +{ + SCE_NP_TROPHY_ERROR_ALREADY_INITIALIZED = 0x80022901, + SCE_NP_TROPHY_ERROR_NOT_INITIALIZED = 0x80022902, + SCE_NP_TROPHY_ERROR_NOT_SUPPORTED = 0x80022903, + SCE_NP_TROPHY_ERROR_CONTEXT_NOT_REGISTERED = 0x80022904, + SCE_NP_TROPHY_ERROR_OUT_OF_MEMORY = 0x80022905, + SCE_NP_TROPHY_ERROR_INVALID_ARGUMENT = 0x80022906, + SCE_NP_TROPHY_ERROR_EXCEEDS_MAX = 0x80022907, + SCE_NP_TROPHY_ERROR_INSUFFICIENT = 0x80022909, + SCE_NP_TROPHY_ERROR_UNKNOWN_CONTEXT = 0x8002290a, + SCE_NP_TROPHY_ERROR_INVALID_FORMAT = 0x8002290b, + SCE_NP_TROPHY_ERROR_BAD_RESPONSE = 0x8002290c, + SCE_NP_TROPHY_ERROR_INVALID_GRADE = 0x8002290d, + SCE_NP_TROPHY_ERROR_INVALID_CONTEXT = 0x8002290e, + SCE_NP_TROPHY_ERROR_PROCESSING_ABORTED = 0x8002290f, + SCE_NP_TROPHY_ERROR_ABORT = 0x80022910, + SCE_NP_TROPHY_ERROR_UNKNOWN_HANDLE = 0x80022911, + SCE_NP_TROPHY_ERROR_LOCKED = 0x80022912, + SCE_NP_TROPHY_ERROR_HIDDEN = 0x80022913, + SCE_NP_TROPHY_ERROR_CANNOT_UNLOCK_PLATINUM = 0x80022914, + SCE_NP_TROPHY_ERROR_ALREADY_UNLOCKED = 0x80022915, + SCE_NP_TROPHY_ERROR_INVALID_TYPE = 0x80022916, + SCE_NP_TROPHY_ERROR_INVALID_HANDLE = 0x80022917, + SCE_NP_TROPHY_ERROR_INVALID_NP_COMM_ID = 0x80022918, + SCE_NP_TROPHY_ERROR_UNKNOWN_NP_COMM_ID = 0x80022919, + SCE_NP_TROPHY_ERROR_DISC_IO = 0x8002291a, + SCE_NP_TROPHY_ERROR_CONF_DOES_NOT_EXIST = 0x8002291b, + SCE_NP_TROPHY_ERROR_UNSUPPORTED_FORMAT = 0x8002291c, + SCE_NP_TROPHY_ERROR_ALREADY_INSTALLED = 0x8002291d, + SCE_NP_TROPHY_ERROR_BROKEN_DATA = 0x8002291e, + SCE_NP_TROPHY_ERROR_VERIFICATION_FAILURE = 0x8002291f, + SCE_NP_TROPHY_ERROR_INVALID_TROPHY_ID = 0x80022920, + SCE_NP_TROPHY_ERROR_UNKNOWN_TROPHY_ID = 0x80022921, + SCE_NP_TROPHY_ERROR_UNKNOWN_TITLE = 0x80022922, + SCE_NP_TROPHY_ERROR_UNKNOWN_FILE = 0x80022923, + SCE_NP_TROPHY_ERROR_DISC_NOT_MOUNTED = 0x80022924, + SCE_NP_TROPHY_ERROR_SHUTDOWN = 0x80022925, + SCE_NP_TROPHY_ERROR_TITLE_ICON_NOT_FOUND = 0x80022926, + SCE_NP_TROPHY_ERROR_TROPHY_ICON_NOT_FOUND = 0x80022927, + SCE_NP_TROPHY_ERROR_INSUFFICIENT_DISK_SPACE = 0x80022928, + SCE_NP_TROPHY_ERROR_ILLEGAL_UPDATE = 0x8002292a, + SCE_NP_TROPHY_ERROR_SAVEDATA_USER_DOES_NOT_MATCH = 0x8002292b, + SCE_NP_TROPHY_ERROR_TROPHY_ID_DOES_NOT_EXIST = 0x8002292c, + SCE_NP_TROPHY_ERROR_SERVICE_UNAVAILABLE = 0x8002292d, + SCE_NP_TROPHY_ERROR_UNKNOWN = 0x800229ff, +}; + +enum +{ + SCE_NP_TROPHY_TITLE_MAX_SIZE = 128, + SCE_NP_TROPHY_GAME_DESCR_MAX_SIZE = 1024, + SCE_NP_TROPHY_NAME_MAX_SIZE = 128, + SCE_NP_TROPHY_DESCR_MAX_SIZE = 1024, +}; + +enum +{ + SCE_NP_TROPHY_GRADE_UNKNOWN = 0, + SCE_NP_TROPHY_GRADE_PLATINUM = 1, + SCE_NP_TROPHY_GRADE_GOLD = 2, + SCE_NP_TROPHY_GRADE_SILVER = 3, + SCE_NP_TROPHY_GRADE_BRONZE = 4, +}; + +struct SceNpTrophyDetails +{ + s32 trophyId; // SceNpTrophyId + u32 trophyGrade; // SceNpTrophyGrade + u8 name[SCE_NP_TROPHY_NAME_MAX_SIZE]; + u8 description[SCE_NP_TROPHY_DESCR_MAX_SIZE]; + bool hidden; + u8 reserved[3]; +}; + +struct SceNpTrophyData { + CellRtcTick timestamp; + s32 trophyId; // SceNpTrophyId + bool unlocked; + u8 reserved[3]; +}; From d6596ca45321a74568342b9567e4b32d1b098d55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandro=20S=C3=A1nchez=20Bach?= Date: Thu, 6 Mar 2014 09:48:35 +0100 Subject: [PATCH 12/13] Progress in cellL10n * cellL10n added to the project. * Function addresses added to cellL10n_init. * UTF16stoUTF8s implemented (WARNING: I haven't tested it). --- rpcs3/Emu/SysCalls/Modules/cellL10n.cpp | 206 +++++++++++++++++++++++- rpcs3/rpcs3.vcxproj | 1 + rpcs3/rpcs3.vcxproj.filters | 3 + 3 files changed, 209 insertions(+), 1 deletion(-) diff --git a/rpcs3/Emu/SysCalls/Modules/cellL10n.cpp b/rpcs3/Emu/SysCalls/Modules/cellL10n.cpp index 6989f8b8b5..f78f667030 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellL10n.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellL10n.cpp @@ -5,7 +5,211 @@ void cellL10n_init(); Module cellL10n(0x001e, cellL10n_init); +// L10nResult +enum +{ + ConversionOK, + SRCIllegal, + DSTExhausted, + ConverterUnknown, +}; + +int UTF16stoUTF8s(mem16_ptr_t utf16, mem64_t utf16_len, mem8_ptr_t utf8, mem64_t utf8_len) +{ + cellL10n.Warning("UTF16stoUTF8s(utf16_addr=0x%x, utf16_len_addr=0x%x, utf8_addr=0x%x, utf8_len_addr=0x%x)", + utf16.GetAddr(), utf16_len.GetAddr(), utf8.GetAddr(), utf8_len.GetAddr()); + + if (!utf16.IsGood() || !utf16_len.IsGood() || !utf8_len.IsGood()) + return SRCIllegal; + + std::wstring wstr = (wchar_t*)Memory.VirtualToRealAddr(utf16); + std::string str; + + int len = min((int)utf16_len.GetValue(), (int)wstr.size()); + int size = (int)WideCharToMultiByte(CP_UTF8, 0, wstr.c_str(), len, 0, 0, NULL, NULL); + + if (!utf8.IsGood()) + utf8_len = size; + if (utf8_len.GetValue() < size) + return DSTExhausted; + +#ifdef WIN32 + WideCharToMultiByte(CP_UTF8, 0, wstr.c_str(), len, &str[0], size, NULL, NULL); +#else + // TODO +#endif + + Memory.WriteString(utf8, str); + return ConversionOK; +} + void cellL10n_init() { - // (TODO: Get addresses of cellL10n functions) + // NOTE: I think this module should be LLE'd instead of implementing all its functions + + // cellL10n.AddFunc(0x005200e6, UCS2toEUCJP); + // cellL10n.AddFunc(0x01b0cbf4, l10n_convert); + // cellL10n.AddFunc(0x0356038c, UCS2toUTF32); + // cellL10n.AddFunc(0x05028763, jis2kuten); + // cellL10n.AddFunc(0x058addc8, UTF8toGB18030); + // cellL10n.AddFunc(0x060ee3b2, JISstoUTF8s); + // cellL10n.AddFunc(0x07168a83, SjisZen2Han); + // cellL10n.AddFunc(0x0bc386c8, ToSjisLower); + // cellL10n.AddFunc(0x0bedf77d, UCS2toGB18030); + // cellL10n.AddFunc(0x0bf867e2, HZstoUCS2s); + // cellL10n.AddFunc(0x0ce278fd, UCS2stoHZs); + // cellL10n.AddFunc(0x0d90a48d, UCS2stoSJISs); + // cellL10n.AddFunc(0x0f624540, kuten2eucjp); + // cellL10n.AddFunc(0x14ee3649, sjis2jis); + // cellL10n.AddFunc(0x14f504b8, EUCKRstoUCS2s); + // cellL10n.AddFunc(0x16eaf5f1, UHCstoEUCKRs); + // cellL10n.AddFunc(0x1758053c, jis2sjis); + // cellL10n.AddFunc(0x1906ce6b, jstrnchk); + // cellL10n.AddFunc(0x1ac0d23d, L10nConvert); + // cellL10n.AddFunc(0x1ae2acee, EUCCNstoUTF8s); + // cellL10n.AddFunc(0x1cb1138f, GBKstoUCS2s); + // cellL10n.AddFunc(0x1da42d70, eucjphan2zen); + // cellL10n.AddFunc(0x1ec712e0, ToSjisHira); + // cellL10n.AddFunc(0x1fb50183, GBKtoUCS2); + // cellL10n.AddFunc(0x21948c03, eucjp2jis); + // cellL10n.AddFunc(0x21aa3045, UTF32stoUTF8s); + // cellL10n.AddFunc(0x24fd32a9, sjishan2zen); + // cellL10n.AddFunc(0x256b6861, UCS2toSBCS); + // cellL10n.AddFunc(0x262a5ae2, UTF8stoGBKs); + // cellL10n.AddFunc(0x28724522, UTF8toUCS2); + // cellL10n.AddFunc(0x2ad091c6, UCS2stoUTF8s); + // cellL10n.AddFunc(0x2b84030c, EUCKRstoUTF8s); + // cellL10n.AddFunc(0x2efa7294, UTF16stoUTF32s); + // cellL10n.AddFunc(0x2f9eb543, UTF8toEUCKR); + // cellL10n.AddFunc(0x317ab7c2, UTF16toUTF8); + // cellL10n.AddFunc(0x32689828, ARIBstoUTF8s); + // cellL10n.AddFunc(0x33435818, SJISstoUTF8s); + // cellL10n.AddFunc(0x33f8b35c, sjiszen2han); + // cellL10n.AddFunc(0x3968f176, ToEucJpLower); + // cellL10n.AddFunc(0x398a3dee, MSJIStoUTF8); + // cellL10n.AddFunc(0x3a20bc34, UCS2stoMSJISs); + // cellL10n.AddFunc(0x3dabd5a7, EUCJPtoUTF8); + // cellL10n.AddFunc(0x3df65b64, eucjp2sjis); + // cellL10n.AddFunc(0x408a622b, ToEucJpHira); + // cellL10n.AddFunc(0x41b4a5ae, UHCstoUCS2s); + // cellL10n.AddFunc(0x41ccf033, ToEucJpKata); + // cellL10n.AddFunc(0x42838145, HZstoUTF8s); + // cellL10n.AddFunc(0x4931b44e, UTF8toMSJIS); + // cellL10n.AddFunc(0x4b3bbacb, BIG5toUTF8); + // cellL10n.AddFunc(0x511d386b, EUCJPstoSJISs); + // cellL10n.AddFunc(0x52b7883f, UTF8stoBIG5s); + // cellL10n.AddFunc(0x53558b6b, UTF16stoUCS2s); + // cellL10n.AddFunc(0x53764725, UCS2stoGB18030s); + // cellL10n.AddFunc(0x53c71ac2, EUCJPtoSJIS); + // cellL10n.AddFunc(0x54f59807, EUCJPtoUCS2); + // cellL10n.AddFunc(0x55f6921c, UCS2stoGBKs); + // cellL10n.AddFunc(0x58246762, EUCKRtoUHC); + // cellL10n.AddFunc(0x596df41c, UCS2toSJIS); + // cellL10n.AddFunc(0x5a4ab223, MSJISstoUTF8s); + // cellL10n.AddFunc(0x5ac783dc, EUCJPstoUTF8s); + // cellL10n.AddFunc(0x5b684dfb, UCS2toBIG5); + // cellL10n.AddFunc(0x5cd29270, UTF8stoEUCKRs); + // cellL10n.AddFunc(0x5e1d9330, UHCstoUTF8s); + // cellL10n.AddFunc(0x60ffa0ec, GB18030stoUCS2s); + // cellL10n.AddFunc(0x6122e000, SJIStoUTF8); + // cellL10n.AddFunc(0x6169f205, JISstoSJISs); + // cellL10n.AddFunc(0x61fb9442, UTF8toUTF16); + // cellL10n.AddFunc(0x62b36bcf, UTF8stoMSJISs); + // cellL10n.AddFunc(0x63219199, EUCKRtoUTF8); + // cellL10n.AddFunc(0x638c2fc1, SjisHan2Zen); + // cellL10n.AddFunc(0x64a10ec8, UCS2toUTF16); + // cellL10n.AddFunc(0x65444204, UCS2toMSJIS); + // cellL10n.AddFunc(0x6621a82c, sjis2kuten); + // cellL10n.AddFunc(0x6a6f25d1, UCS2toUHC); + // cellL10n.AddFunc(0x6c62d879, UTF32toUCS2); + // cellL10n.AddFunc(0x6de4b508, ToSjisUpper); + // cellL10n.AddFunc(0x6e0705c4, UTF8toEUCJP); + // cellL10n.AddFunc(0x6e5906fd, UCS2stoEUCJPs); + // cellL10n.AddFunc(0x6fc530b3, UTF16toUCS2); + // cellL10n.AddFunc(0x714a9b4a, UCS2stoUTF16s); + // cellL10n.AddFunc(0x71804d64, UCS2stoEUCCNs); + // cellL10n.AddFunc(0x72632e53, SBCSstoUTF8s); + // cellL10n.AddFunc(0x73f2cd21, SJISstoJISs); + // cellL10n.AddFunc(0x74496718, SBCStoUTF8); + // cellL10n.AddFunc(0x74871fe0, UTF8toUTF32); + // cellL10n.AddFunc(0x750c363d, jstrchk); + // cellL10n.AddFunc(0x7c5bde1c, UHCtoEUCKR); + // cellL10n.AddFunc(0x7c912bda, kuten2jis); + // cellL10n.AddFunc(0x7d07a1c2, UTF8toEUCCN); + // cellL10n.AddFunc(0x8171c1cc, EUCCNtoUTF8); + // cellL10n.AddFunc(0x82d5ecdf, EucJpZen2Han); + // cellL10n.AddFunc(0x8555fe15, UTF32stoUTF16s); + // cellL10n.AddFunc(0x860fc741, GBKtoUTF8); + // cellL10n.AddFunc(0x867f7b8b, ToEucJpUpper); + // cellL10n.AddFunc(0x88f8340b, UCS2stoJISs); + // cellL10n.AddFunc(0x89236c86, UTF8stoGB18030s); + // cellL10n.AddFunc(0x8a56f148, EUCKRstoUHCs); + // cellL10n.AddFunc(0x8ccdba38, UTF8stoUTF32s); + // cellL10n.AddFunc(0x8f472054, UTF8stoEUCCNs); + // cellL10n.AddFunc(0x90e9b5d2, EUCJPstoUCS2s); + // cellL10n.AddFunc(0x91a99765, UHCtoUCS2); + // cellL10n.AddFunc(0x931ff25a, L10nConvertStr); + // cellL10n.AddFunc(0x949bb14c, GBKstoUTF8s); + // cellL10n.AddFunc(0x9557ac9b, UTF8toUHC); + // cellL10n.AddFunc(0x9768b6d3, UTF32toUTF8); + // cellL10n.AddFunc(0x9874020d, sjis2eucjp); + // cellL10n.AddFunc(0x9a0e7d23, UCS2toEUCCN); + // cellL10n.AddFunc(0x9a13d6b8, UTF8stoUHCs); + // cellL10n.AddFunc(0x9a72059d, EUCKRtoUCS2); + // cellL10n.AddFunc(0x9b1210c6, UTF32toUTF16); + // cellL10n.AddFunc(0x9cd8135b, EUCCNstoUCS2s); + // cellL10n.AddFunc(0x9ce52809, SBCSstoUCS2s); + // cellL10n.AddFunc(0x9cf1ab77, UTF8stoJISs); + // cellL10n.AddFunc(0x9d14dc46, ToSjisKata); + // cellL10n.AddFunc(0x9dcde367, jis2eucjp); + // cellL10n.AddFunc(0x9ec52258, BIG5toUCS2); + // cellL10n.AddFunc(0xa0d463c0, UCS2toGBK); + // cellL10n.AddFunc(0xa19fb9de, UTF16toUTF32); + // cellL10n.AddFunc(0xa298cad2, l10n_convert_str); + // cellL10n.AddFunc(0xa34fa0eb, EUCJPstoJISs); + // cellL10n.AddFunc(0xa5146299, UTF8stoARIBs); + // cellL10n.AddFunc(0xa609f3e9, JISstoEUCJPs); + // cellL10n.AddFunc(0xa60ff5c9, EucJpHan2Zen); + // cellL10n.AddFunc(0xa963619c, isEucJpKigou); + // cellL10n.AddFunc(0xa9a76fb8, UCS2toUTF8); + // cellL10n.AddFunc(0xaf18d499, GB18030toUCS2); + // cellL10n.AddFunc(0xb3361be6, UHCtoUTF8); + // cellL10n.AddFunc(0xb6e45343, MSJIStoUCS2); + // cellL10n.AddFunc(0xb7cef4a6, UTF8toGBK); + // cellL10n.AddFunc(0xb7e08f7a, kuten2sjis); + // cellL10n.AddFunc(0xb9cf473d, UTF8toSBCS); + // cellL10n.AddFunc(0xbdd44ee3, SJIStoUCS2); + // cellL10n.AddFunc(0xbe42e661, eucjpzen2han); + // cellL10n.AddFunc(0xbe8d5485, UCS2stoARIBs); + // cellL10n.AddFunc(0xbefe3869, isSjisKigou); + // cellL10n.AddFunc(0xc62b758d, UTF8stoEUCJPs); + // cellL10n.AddFunc(0xc7bdcb4c, UCS2toEUCKR); + // cellL10n.AddFunc(0xc944fa56, SBCStoUCS2); + // cellL10n.AddFunc(0xc9b78f58, MSJISstoUCS2s); + // cellL10n.AddFunc(0xcc1633cc, l10n_get_converter); + // cellL10n.AddFunc(0xd02ef83d, GB18030stoUTF8s); + // cellL10n.AddFunc(0xd8721e2c, SJISstoEUCJPs); + // cellL10n.AddFunc(0xd8cb24cb, UTF32stoUCS2s); + // cellL10n.AddFunc(0xd990858b, BIG5stoUTF8s); + // cellL10n.AddFunc(0xd9fb1224, EUCCNtoUCS2); + // cellL10n.AddFunc(0xda67b37f, UTF8stoSBCSs); + // cellL10n.AddFunc(0xdc54886c, UCS2stoEUCKRs); + // cellL10n.AddFunc(0xdd5ebdeb, UTF8stoSJISs); + // cellL10n.AddFunc(0xdefa1c17, UTF8stoHZs); + // cellL10n.AddFunc(0xe2eabb32, eucjp2kuten); + // cellL10n.AddFunc(0xe6d9e234, UTF8toBIG5); + cellL10n.AddFunc(0xe6f5711b, UTF16stoUTF8s); + // cellL10n.AddFunc(0xe956dc64, JISstoUCS2s); + // cellL10n.AddFunc(0xeabc3d00, GB18030toUTF8); + // cellL10n.AddFunc(0xeb3dc670, UTF8toSJIS); + // cellL10n.AddFunc(0xeb41cc68, ARIBstoUCS2s); + // cellL10n.AddFunc(0xeb685b83, UCS2stoUTF32s); + // cellL10n.AddFunc(0xebae29c0, UCS2stoSBCSs); + // cellL10n.AddFunc(0xee6c6a39, UCS2stoBIG5s); + // cellL10n.AddFunc(0xf1dcfa71, UCS2stoUHCs); + // cellL10n.AddFunc(0xf439728e, SJIStoEUCJP); + // cellL10n.AddFunc(0xf7681b9a, UTF8stoUTF16s); + // cellL10n.AddFunc(0xf9b1896d, SJISstoUCS2s); + // cellL10n.AddFunc(0xfa4a675a, BIG5stoUCS2s); + // cellL10n.AddFunc(0xfdbf6ac5, UTF8stoUCS2s); } \ No newline at end of file diff --git a/rpcs3/rpcs3.vcxproj b/rpcs3/rpcs3.vcxproj index 4c7a3726a3..4ff6fe50d4 100644 --- a/rpcs3/rpcs3.vcxproj +++ b/rpcs3/rpcs3.vcxproj @@ -291,6 +291,7 @@ + diff --git a/rpcs3/rpcs3.vcxproj.filters b/rpcs3/rpcs3.vcxproj.filters index b5f5f44515..bc2aa277e0 100644 --- a/rpcs3/rpcs3.vcxproj.filters +++ b/rpcs3/rpcs3.vcxproj.filters @@ -439,6 +439,9 @@ Emu\SysCalls\Modules + + Emu\SysCalls\Modules + From 898fbf02b802a980075b8b94ba8a683f3964e3ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandro=20S=C3=A1nchez=20Bach?= Date: Thu, 6 Mar 2014 13:27:58 +0100 Subject: [PATCH 13/13] Fixes in sceNpTrophy and FSEL (PPU instr.) --- rpcs3/Emu/Cell/PPUInterpreter.h | 2 +- rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/rpcs3/Emu/Cell/PPUInterpreter.h b/rpcs3/Emu/Cell/PPUInterpreter.h index 3413e2f3f0..2a0090c251 100644 --- a/rpcs3/Emu/Cell/PPUInterpreter.h +++ b/rpcs3/Emu/Cell/PPUInterpreter.h @@ -3717,7 +3717,7 @@ private: } void FSEL(u32 frd, u32 fra, u32 frc, u32 frb, bool rc) { - CPU.FPR[frd] = CPU.FPR[fra] < 0.0 ? CPU.FPR[frc] : CPU.FPR[frb]; + CPU.FPR[frd] = CPU.FPR[fra] >= 0.0 ? CPU.FPR[frc] : CPU.FPR[frb]; if(rc) UNK("fsel.");//CPU.UpdateCR1(CPU.FPR[frd]); } void FMUL(u32 frd, u32 fra, u32 frc, bool rc) diff --git a/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp b/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp index bae2bf372b..2198525289 100644 --- a/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sceNpTrophy.cpp @@ -111,10 +111,16 @@ int sceNpTrophyRegisterContext(u32 context, u32 handle, u32 statusCb_addr, u32 a return SCE_NP_TROPHY_ERROR_INVALID_ARGUMENT; if (options & (~(u64)1)) SCE_NP_TROPHY_ERROR_NOT_SUPPORTED; + if (context >= s_npTrophyInstance.contexts.size()) + return SCE_NP_TROPHY_ERROR_UNKNOWN_CONTEXT; // TODO: There are other possible errors - int ret; sceNpTrophyInternalContext& ctxt = s_npTrophyInstance.contexts[context]; + + if (!ctxt.trp_stream) + return SCE_NP_TROPHY_ERROR_CONF_DOES_NOT_EXIST; + + int ret; TRPLoader trp(*(ctxt.trp_stream)); // TODO: Get the path of the current user @@ -150,11 +156,16 @@ int sceNpTrophyGetRequiredDiskSpace(u32 context, u32 handle, mem64_t reqspace, u return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED; if (!reqspace.IsGood()) return SCE_NP_TROPHY_ERROR_INVALID_ARGUMENT; + if (context >= s_npTrophyInstance.contexts.size()) + return SCE_NP_TROPHY_ERROR_UNKNOWN_CONTEXT; // TODO: There are other possible errors sceNpTrophyInternalContext& ctxt = s_npTrophyInstance.contexts[context]; - reqspace = ctxt.trp_stream->GetSize(); // TODO: This is not accurate. It's just an approximation of the real value + if (!ctxt.trp_stream) + return SCE_NP_TROPHY_ERROR_CONF_DOES_NOT_EXIST; + + reqspace = ctxt.trp_stream->GetSize(); // TODO: This is not accurate. It's just an approximation of the real value return CELL_OK; }