diff --git a/CMakeLists.txt b/CMakeLists.txt index bf98e39d6..f61e28daf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1154,6 +1154,8 @@ add_library(${CoreLibName} ${CoreLinkType} Core/HLE/KernelWaitHelpers.h Core/HLE/__sceAudio.cpp Core/HLE/__sceAudio.h + Core/HLE/sceAdler.cpp + Core/HLE/sceAdler.h Core/HLE/sceAtrac.cpp Core/HLE/sceAtrac.h Core/HLE/sceAudio.cpp diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj index 86ee969ce..e28a0ae69 100644 --- a/Core/Core.vcxproj +++ b/Core/Core.vcxproj @@ -213,6 +213,7 @@ + @@ -458,6 +459,7 @@ + diff --git a/Core/Core.vcxproj.filters b/Core/Core.vcxproj.filters index fc6dd3759..74bb12e08 100644 --- a/Core/Core.vcxproj.filters +++ b/Core/Core.vcxproj.filters @@ -165,6 +165,9 @@ HLE\Kernel + + HLE\Libraries + HLE\Libraries @@ -643,6 +646,9 @@ HLE\Kernel + + HLE\Libraries + HLE\Libraries diff --git a/Core/HLE/HLETables.cpp b/Core/HLE/HLETables.cpp index bba5b44d1..f15f41bb9 100644 --- a/Core/HLE/HLETables.cpp +++ b/Core/HLE/HLETables.cpp @@ -70,6 +70,7 @@ #include "sceMt19937.h" #include "sceUsbGps.h" #include "sceSha256.h" +#include "sceAdler.h" #define N(s) s @@ -332,5 +333,6 @@ void RegisterAllModules() { Register_sceUsbGps(); Register_sceLibFttt(); Register_sceSha256(); + Register_sceAdler(); } diff --git a/Core/HLE/sceAdler.cpp b/Core/HLE/sceAdler.cpp new file mode 100644 index 000000000..788ea5881 --- /dev/null +++ b/Core/HLE/sceAdler.cpp @@ -0,0 +1,46 @@ +// Copyright (c) 2012- 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 "../ext/zlib/zlib.h" + +#include "sceAdler.h" +#include "Common/Log.h" +#include "Core/HLE/HLE.h" +#include "Core/HLE/FunctionWrappers.h" + +static u32 sceAdler32(u32 adler, u32 data, u32 datalen) { + if (!Memory::IsValidAddress(data) || !Memory::IsValidAddress(data + datalen)) { + ERROR_LOG(HLE, "sceAdler32(adler=%08x, data=%08x, datalen=%08x) - bad address(es)", adler, data, datalen); + return -1; + } + INFO_LOG(HLE, "sceAdler32(adler=%08x, data=%08x, datalen=%08x)", adler, data, datalen); + + u8 *buf = Memory::GetPointerUnchecked(data); + u32 ret = adler32(adler, buf, datalen); + + return ret; +} + +const HLEFunction sceAdler[] = +{ + { 0x9702EF11, WrapU_UUU, "sceAdler32" }, +}; + +void Register_sceAdler() +{ + RegisterModule("sceAdler", ARRAY_SIZE(sceAdler), sceAdler); +} \ No newline at end of file diff --git a/Core/HLE/sceAdler.h b/Core/HLE/sceAdler.h new file mode 100644 index 000000000..b739adb61 --- /dev/null +++ b/Core/HLE/sceAdler.h @@ -0,0 +1,20 @@ +// Copyright (c) 2012- 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_sceAdler(); \ No newline at end of file diff --git a/android/jni/Android.mk b/android/jni/Android.mk index af2241bea..b0ce2a6be 100644 --- a/android/jni/Android.mk +++ b/android/jni/Android.mk @@ -219,6 +219,7 @@ EXEC_AND_LIB_FILES := \ $(SRC)/Core/HLE/HLETables.cpp \ $(SRC)/Core/HLE/ReplaceTables.cpp \ $(SRC)/Core/HLE/HLE.cpp \ + $(SRC)/Core/HLE/sceAdler.cpp \ $(SRC)/Core/HLE/sceAtrac.cpp \ $(SRC)/Core/HLE/__sceAudio.cpp.arm \ $(SRC)/Core/HLE/sceAudio.cpp.arm \