This commit is contained in:
elisha464 2014-03-06 19:46:23 +02:00
commit e32a6a2eea
21 changed files with 510 additions and 132 deletions

View File

@ -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)

View File

@ -1,6 +1,7 @@
#include <stdafx.h>
#include <Utilities/SMutex.h>
__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::thread::id>()(std::this_thread::get_id());
}
__forceinline u32 SM_GetCurrentCPUThreadId()

View File

@ -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;
}
};
};

View File

@ -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})
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));
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;
}
}

View File

@ -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;
}
}

View File

@ -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);
extern bool DecryptSelf(const std::string& elf, const std::string& self);

View File

@ -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)
{
@ -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)

View File

@ -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++;

View File

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

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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);

View File

@ -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;
};

View File

@ -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"

View File

@ -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<SceNpCommunicationId> co
{
if (entry->flags & DirEntry_TypeDir)
{
std::shared_ptr<vfsFileBase> 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;
}
}
@ -158,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
@ -197,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;
}
@ -253,9 +217,23 @@ int sceNpTrophyGetTrophyIcon()
return CELL_OK;
}
int sceNpTrophyGetTrophyInfo()
int sceNpTrophyGetTrophyInfo(u32 context, u32 handle, s32 trophyId, mem_ptr_t<SceNpTrophyDetails> details, mem_ptr_t<SceNpTrophyData> 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;
}

View File

@ -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];
};

View File

@ -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())

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)

View File

@ -291,6 +291,8 @@
<ClCompile Include="Emu\SysCalls\Modules\cellGcmSys.cpp" />
<ClCompile Include="Emu\SysCalls\Modules\cellGifDec.cpp" />
<ClCompile Include="Emu\SysCalls\Modules\cellJpgDec.cpp" />
<ClCompile Include="Emu\SysCalls\Modules\cellL10n.cpp" />
<ClCompile Include="Emu\SysCalls\Modules\cellNetCtl.cpp" />
<ClCompile Include="Emu\SysCalls\Modules\cellPamf.cpp" />
<ClCompile Include="Emu\SysCalls\Modules\cellPngDec.cpp" />
<ClCompile Include="Emu\SysCalls\Modules\cellResc.cpp" />

View File

@ -436,6 +436,12 @@
<ClCompile Include="Crypto\utils.cpp">
<Filter>Crypto</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellNetCtl.cpp">
<Filter>Emu\SysCalls\Modules</Filter>
</ClCompile>
<ClCompile Include="Emu\SysCalls\Modules\cellL10n.cpp">
<Filter>Emu\SysCalls\Modules</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="rpcs3.rc" />