@@ -795,20 +795,19 @@ static u32 scePsmfGetAudioInfo(u32 psmfStruct, u32 audioInfoAddr) {
795
795
static u32 scePsmfGetCurrentStreamType (u32 psmfStruct, u32 typeAddr, u32 channelAddr) {
796
796
Psmf *psmf = getPsmf (psmfStruct);
797
797
if (!psmf) {
798
- ERROR_LOG (ME, " scePsmfGetCurrentStreamType(%08x, %08x, %08x): invalid psmf" , psmfStruct, typeAddr, channelAddr);
799
- return ERROR_PSMF_NOT_FOUND;
798
+ return hleLogError (ME, ERROR_PSMF_NOT_INITIALIZED, " invalid psmf" );
800
799
}
801
- INFO_LOG (ME, " scePsmfGetCurrentStreamType(%08x, %08x, %08x)" , psmfStruct, typeAddr, channelAddr);
802
- if (Memory::IsValidAddress (typeAddr)) {
803
- u32 type = 0 , channel = 0 ;
804
- if (psmf->streamMap .find (psmf->currentStreamNum ) != psmf->streamMap .end ())
805
- type = psmf->streamMap [psmf->currentStreamNum ]->type ;
806
- if (psmf->streamMap .find (psmf->currentStreamNum ) != psmf->streamMap .end ())
807
- channel = psmf->streamMap [psmf->currentStreamNum ]->channel ;
808
- Memory::Write_U32 (type, typeAddr);
809
- Memory::Write_U32 (channel, channelAddr);
800
+ if (psmf->currentStreamNum == ERROR_PSMF_NOT_INITIALIZED) {
801
+ return hleLogError (ME, ERROR_PSMF_NOT_INITIALIZED, " no stream set" );
810
802
}
811
- return 0 ;
803
+ if (!Memory::IsValidAddress (typeAddr) || !Memory::IsValidAddress (channelAddr)) {
804
+ return hleLogError (ME, SCE_KERNEL_ERROR_ILLEGAL_ADDRESS, " bad pointers" );
805
+ }
806
+ if (psmf->currentStreamType != -1 ) {
807
+ Memory::Write_U32 (psmf->currentStreamType , typeAddr);
808
+ Memory::Write_U32 (psmf->currentStreamChannel , channelAddr);
809
+ }
810
+ return hleLogSuccessI (ME, 0 );
812
811
}
813
812
814
813
static u32 scePsmfGetStreamSize (u32 psmfStruct, u32 sizeAddr)
0 commit comments