diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj index 2abdcccce..cc7f5e926 100644 --- a/Core/Core.vcxproj +++ b/Core/Core.vcxproj @@ -36,7 +36,7 @@ StaticLibrary false - true + false MultiByte @@ -142,7 +142,7 @@ false false Speed - true + false true USE_FFMPEG;_CRT_SECURE_NO_WARNINGS;_MBCS;%(PreprocessorDefinitions) @@ -497,4 +497,4 @@ - + \ No newline at end of file diff --git a/Core/HLE/scePsmf.cpp b/Core/HLE/scePsmf.cpp index 8f60c37ad..822a94201 100644 --- a/Core/HLE/scePsmf.cpp +++ b/Core/HLE/scePsmf.cpp @@ -110,6 +110,13 @@ public: Psmf(u32 data); ~Psmf(); void DoState(PointerWrap &p); + + bool isValidCurrentStreamNumber() { + return currentStreamNum >= 0 && currentStreamNum < streamMap.size(); // urgh, checking size isn't really right here. + } + + void setStreamNum(int num); + bool setStreamWithType(int type, int channel); u32 magic; u32 version; @@ -209,6 +216,7 @@ public: p.Do(channel); } + int type; int channel; }; @@ -317,6 +325,45 @@ void PsmfPlayer::DoState(PointerWrap &p) { p.DoMarker("PsmfPlayer"); } +void Psmf::setStreamNum(int num) { + currentStreamNum = num; + if (!isValidCurrentStreamNumber()) + return; + PsmfStreamMap::iterator iter = streamMap.find(currentStreamNum); + if (iter == streamMap.end()) + return; + + int type = iter->second->type; + int channel = iter->second->channel; + switch (type) { + case PSMF_AVC_STREAM: + if (currentVideoStreamNum != num) { + // TODO: Tell video mediaengine or something about channel. + currentVideoStreamNum = num; + } + break; + + case PSMF_ATRAC_STREAM: + case PSMF_PCM_STREAM: + if (currentAudioStreamNum != num) { + // TODO: Tell audio mediaengine or something about channel. + currentAudioStreamNum = num; + } + break; + } +} + +bool Psmf::setStreamWithType(int type, int channel) { + for (PsmfStreamMap::iterator iter = streamMap.begin(); iter != streamMap.end(); ++iter) { + if (iter->second->type == type) { + setStreamNum(iter->first); + return true; + } + } + return false; +} + + static std::map psmfMap; static std::map psmfPlayerMap; @@ -407,18 +454,37 @@ u32 scePsmfGetNumberOfSpecificStreams(u32 psmfStruct, u32 streamType) u32 scePsmfSpecifyStreamWithStreamType(u32 psmfStruct, u32 streamType, u32 channel) { + Psmf *psmf = getPsmf(psmfStruct); + if (!psmf) { + ERROR_LOG(HLE, "scePsmfSpecifyStreamWithStreamType - invalid psmf"); + return ERROR_PSMF_NOT_FOUND; + } ERROR_LOG(HLE, "UNIMPL scePsmfSpecifyStreamWithStreamType(%08x, %08x, %i)", psmfStruct, streamType, channel); + if (!psmf->setStreamWithType(streamType, channel)) { + psmf->setStreamNum(-1); + } return 0; } u32 scePsmfSpecifyStreamWithStreamTypeNumber(u32 psmfStruct, u32 streamType, u32 typeNum) { + Psmf *psmf = getPsmf(psmfStruct); + if (!psmf) { + ERROR_LOG(HLE, "scePsmfSpecifyStream - invalid psmf"); + return ERROR_PSMF_NOT_FOUND; + } ERROR_LOG(HLE, "UNIMPL scePsmfSpecifyStreamWithStreamTypeNumber(%08x, %08x, %08x)", psmfStruct, streamType, typeNum); return 0; } -u32 scePsmfSpecifyStream(u32 psmfPlayer, int streamNum) { - ERROR_LOG(HLE, "UNIMPL scePsmfSpecifyStream(%08x, %i)", psmfPlayer, streamNum); +u32 scePsmfSpecifyStream(u32 psmfStruct, int streamNum) { + Psmf *psmf = getPsmf(psmfStruct); + if (!psmf) { + ERROR_LOG(HLE, "scePsmfSpecifyStream - invalid psmf"); + return ERROR_PSMF_NOT_FOUND; + } + INFO_LOG(HLE, "scePsmfSpecifyStream(%08x, %i)", psmfStruct, streamNum); + psmf->setStreamNum(streamNum); return 0; } diff --git a/UI/UI.vcxproj b/UI/UI.vcxproj index 3fa2a68de..c3c7a867a 100644 --- a/UI/UI.vcxproj +++ b/UI/UI.vcxproj @@ -63,14 +63,14 @@ StaticLibrary false v100 - true + false MultiByte StaticLibrary false v100 - true + false MultiByte diff --git a/ext/libkirk/libkirk.vcxproj b/ext/libkirk/libkirk.vcxproj index e8bf5a842..e7514705c 100644 --- a/ext/libkirk/libkirk.vcxproj +++ b/ext/libkirk/libkirk.vcxproj @@ -39,14 +39,14 @@ StaticLibrary false v100 - true + false MultiByte StaticLibrary false v100 - true + false MultiByte diff --git a/headless/Headless.vcxproj b/headless/Headless.vcxproj index 631acf45c..d91b3a637 100644 --- a/headless/Headless.vcxproj +++ b/headless/Headless.vcxproj @@ -38,13 +38,13 @@ Application false - true + false MultiByte Application false - true + false MultiByte diff --git a/native b/native index 628005799..c94767905 160000 --- a/native +++ b/native @@ -1 +1 @@ -Subproject commit 628005799f57aff04694d618dc59d1efb0a3fe44 +Subproject commit c94767905aa6fc1f0853e052948d2ebc27eb1b9b diff --git a/unittest/UnitTests.vcxproj b/unittest/UnitTests.vcxproj index f84fb58eb..1ef2ccc32 100644 --- a/unittest/UnitTests.vcxproj +++ b/unittest/UnitTests.vcxproj @@ -41,14 +41,14 @@ Application false v100 - true + false MultiByte Application false v100 - true + false MultiByte