Implement sceAdler32

This commit is contained in:
daniel229 2015-02-08 09:35:00 +08:00
parent 05fc4cfd63
commit 851070a6f8
7 changed files with 79 additions and 0 deletions

View File

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

View File

@ -213,6 +213,7 @@
<ClCompile Include="HLE\proAdhoc.cpp" />
<ClCompile Include="HLE\proAdhocServer.cpp" />
<ClCompile Include="HLE\ReplaceTables.cpp" />
<ClCompile Include="HLE\sceAdler.cpp" />
<ClCompile Include="HLE\sceAtrac.cpp" />
<ClCompile Include="HLE\sceAudio.cpp" />
<ClCompile Include="HLE\sceAudiocodec.cpp" />
@ -458,6 +459,7 @@
<ClInclude Include="HLE\proAdhoc.h" />
<ClInclude Include="HLE\proAdhocServer.h" />
<ClInclude Include="HLE\ReplaceTables.h" />
<ClInclude Include="HLE\sceAdler.h" />
<ClInclude Include="HLE\sceAtrac.h" />
<ClInclude Include="HLE\sceAudio.h" />
<ClInclude Include="HLE\sceAudiocodec.h" />

View File

@ -165,6 +165,9 @@
<ClCompile Include="HLE\sceKernelMutex.cpp">
<Filter>HLE\Kernel</Filter>
</ClCompile>
<ClCompile Include="HLE\sceAdler.cpp">
<Filter>HLE\Libraries</Filter>
</ClCompile>
<ClCompile Include="HLE\sceAtrac.cpp">
<Filter>HLE\Libraries</Filter>
</ClCompile>
@ -643,6 +646,9 @@
<ClInclude Include="HLE\sceKernelMutex.h">
<Filter>HLE\Kernel</Filter>
</ClInclude>
<ClInclude Include="HLE\sceAdler.h">
<Filter>HLE\Libraries</Filter>
</ClInclude>
<ClInclude Include="HLE\sceAtrac.h">
<Filter>HLE\Libraries</Filter>
</ClInclude>

View File

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

46
Core/HLE/sceAdler.cpp Normal file
View File

@ -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>, "sceAdler32" },
};
void Register_sceAdler()
{
RegisterModule("sceAdler", ARRAY_SIZE(sceAdler), sceAdler);
}

20
Core/HLE/sceAdler.h Normal file
View File

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

View File

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