From 99c4a00dae5595f06e41166044f6cc8a89869812 Mon Sep 17 00:00:00 2001 From: Florin9doi Date: Sat, 3 Aug 2019 18:33:43 +0300 Subject: [PATCH] sceUsbMic --- CMakeLists.txt | 2 ++ Core/Core.vcxproj | 2 ++ Core/Core.vcxproj.filters | 6 +++++ Core/HLE/HLETables.cpp | 2 ++ Core/HLE/sceUsbCam.cpp | 13 +++++++++- Core/HLE/sceUsbMic.cpp | 52 +++++++++++++++++++++++++++++++++++++++ Core/HLE/sceUsbMic.h | 20 +++++++++++++++ android/jni/Android.mk | 1 + 8 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 Core/HLE/sceUsbMic.cpp create mode 100644 Core/HLE/sceUsbMic.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c1f15559..e8d02cdab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1647,6 +1647,8 @@ add_library(${CoreLibName} ${CoreLinkType} Core/HLE/sceUsbCam.h Core/HLE/sceUsbGps.cpp Core/HLE/sceUsbGps.h + Core/HLE/sceUsbMic.cpp + Core/HLE/sceUsbMic.h Core/HLE/sceUtility.cpp Core/HLE/sceUtility.h Core/HLE/sceVaudio.cpp diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj index 937ab02ac..22d258eca 100644 --- a/Core/Core.vcxproj +++ b/Core/Core.vcxproj @@ -374,6 +374,7 @@ + @@ -901,6 +902,7 @@ + diff --git a/Core/Core.vcxproj.filters b/Core/Core.vcxproj.filters index b459851f7..7f096c1b5 100644 --- a/Core/Core.vcxproj.filters +++ b/Core/Core.vcxproj.filters @@ -737,6 +737,9 @@ Debugger\WebSocket + + HLE\Libraries + @@ -1367,6 +1370,9 @@ Debugger\WebSocket + + HLE\Libraries + diff --git a/Core/HLE/HLETables.cpp b/Core/HLE/HLETables.cpp index ed1331f3a..0f4c440c4 100644 --- a/Core/HLE/HLETables.cpp +++ b/Core/HLE/HLETables.cpp @@ -69,6 +69,7 @@ #include "sceUsbAcc.h" #include "sceUsbCam.h" #include "sceUsbGps.h" +#include "sceUsbMic.h" #include "sceUtility.h" #include "sceVaudio.h" #include "sceMt19937.h" @@ -298,6 +299,7 @@ void RegisterAllModules() { Register_sceNetIfhandle(); Register_KUBridge(); Register_sceUsbAcc(); + Register_sceUsbMic(); // add new modules here. } diff --git a/Core/HLE/sceUsbCam.cpp b/Core/HLE/sceUsbCam.cpp index 2f624cb80..e1b5986e8 100644 --- a/Core/HLE/sceUsbCam.cpp +++ b/Core/HLE/sceUsbCam.cpp @@ -50,6 +50,17 @@ static int sceUsbCamStopMic() { return 0; } +static int sceUsbCamReadMicBlocking(u32 bufAddr, u32 size) { + INFO_LOG(HLE, "UNIMPL sceUsbCamReadMicBlocking: size: %d", size); + for (unsigned int i = 0; i < size; i++) { + if (Memory::IsValidAddress(bufAddr + i)) { + Memory::Write_U8(i & 0xFF, bufAddr + i); + } + } + hleEatMicro(1000000 / micParam.frequency * (size / 2)); + return size; +} + static int sceUsbCamSetupVideo(u32 paramAddr, u32 workareaAddr, int wasize) { INFO_LOG(HLE, "UNIMPL sceUsbCamSetupVideo"); if (Memory::IsValidRange(paramAddr, sizeof(videoParam))) { @@ -115,7 +126,7 @@ const HLEFunction sceUsbCam[] = { 0X2E930264, nullptr, "sceUsbCamSetupMicEx", '?', "" }, { 0X82A64030, &WrapI_V, "sceUsbCamStartMic", 'i', "" }, { 0X5145868A, &WrapI_V, "sceUsbCamStopMic", 'i', "" }, - { 0X36636925, nullptr, "sceUsbCamReadMicBlocking", '?', "" }, + { 0X36636925, &WrapI_UU, "sceUsbCamReadMicBlocking", 'i', "xx" }, { 0X3DC0088E, nullptr, "sceUsbCamReadMic", '?', "" }, { 0XB048A67D, nullptr, "sceUsbCamWaitReadMicEnd", '?', "" }, { 0XF8847F60, nullptr, "sceUsbCamPollReadMicEnd", '?', "" }, diff --git a/Core/HLE/sceUsbMic.cpp b/Core/HLE/sceUsbMic.cpp new file mode 100644 index 000000000..306f527da --- /dev/null +++ b/Core/HLE/sceUsbMic.cpp @@ -0,0 +1,52 @@ +// Copyright (c) 2019- PPSSPP Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0 or later versions. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official git repository and contact information can be found at +// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. + +#include + +#include "base/NativeApp.h" +#include "Common/ChunkFile.h" +#include "Core/HLE/HLE.h" +#include "Core/HLE/FunctionWrappers.h" +#include "Core/HLE/sceUsbMic.h" +#include "Core/MemMapHelpers.h" + +static int sceUsbMicInputBlocking(u32 size, u32 samplerate, u32 bufAddr) { + INFO_LOG(HLE, "UNIMPL sceUsbMicInputBlocking: size: %d, samplerate: %d", size, samplerate); + for (unsigned int i = 0; i < size; i++) { + if (Memory::IsValidAddress(bufAddr + i)) { + Memory::Write_U8(i & 0xFF, bufAddr + i); + } + } + hleEatMicro(1000000 / samplerate * (size / 2)); + return size; +} + +const HLEFunction sceUsbMic[] = +{ + {0x06128E42, nullptr, "sceUsbMicPollInputEnd", '?', "" }, + {0x2E6DCDCD, &WrapI_UUU, "sceUsbMicInputBlocking", 'i', "xxx" }, + {0x45310F07, nullptr, "sceUsbMicInputInitEx", '?', "" }, + {0x5F7F368D, nullptr, "sceUsbMicInput", '?', "" }, + {0x63400E20, nullptr, "sceUsbMicGetInputLength", '?', "" }, + {0xB8E536EB, nullptr, "sceUsbMicInputInit", '?', "" }, + {0xF899001C, nullptr, "sceUsbMicWaitInputEnd", '?', "" }, +}; + +void Register_sceUsbMic() +{ + RegisterModule("sceUsbMic", ARRAY_SIZE(sceUsbMic), sceUsbMic); +} diff --git a/Core/HLE/sceUsbMic.h b/Core/HLE/sceUsbMic.h new file mode 100644 index 000000000..6540246f1 --- /dev/null +++ b/Core/HLE/sceUsbMic.h @@ -0,0 +1,20 @@ +// Copyright (c) 2019- PPSSPP Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0 or later versions. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official git repository and contact information can be found at +// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. + +#pragma once + +void Register_sceUsbMic(); diff --git a/android/jni/Android.mk b/android/jni/Android.mk index 985b8efa8..3853fa124 100644 --- a/android/jni/Android.mk +++ b/android/jni/Android.mk @@ -394,6 +394,7 @@ EXEC_AND_LIB_FILES := \ $(SRC)/Core/HLE/sceUsbAcc.cpp \ $(SRC)/Core/HLE/sceUsbCam.cpp \ $(SRC)/Core/HLE/sceUsbGps.cpp \ + $(SRC)/Core/HLE/sceUsbMic.cpp \ $(SRC)/Core/HLE/sceUtility.cpp \ $(SRC)/Core/HLE/sceVaudio.cpp \ $(SRC)/Core/HLE/scePspNpDrm_user.cpp \