CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
Path: blob/master/Core/HLE/sceAdler.cpp
Views: 1401
// Copyright (c) 2012- PPSSPP Project.12// This program is free software: you can redistribute it and/or modify3// it under the terms of the GNU General Public License as published by4// the Free Software Foundation, version 2.0 or later versions.56// This program is distributed in the hope that it will be useful,7// but WITHOUT ANY WARRANTY; without even the implied warranty of8// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9// GNU General Public License 2.0 for more details.1011// A copy of the GPL 2.0 should have been included with the program.12// If not, see http://www.gnu.org/licenses/1314// Official git repository and contact information can be found at15// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.1617#ifdef SHARED_ZLIB18#include <zlib.h>19#else20#include "../ext/zlib/zlib.h"21#endif2223#include "sceAdler.h"24#include "Common/Log.h"25#include "Core/HLE/HLE.h"26#include "Core/HLE/FunctionWrappers.h"2728static u32 sceAdler32(u32 adler, u32 data, u32 datalen) {29if (!Memory::IsValidAddress(data) || !Memory::IsValidAddress(data + datalen - 1)) {30ERROR_LOG(Log::sceMisc, "sceAdler32(adler=%08x, data=%08x, datalen=%08x) - bad address(es)", adler, data, datalen);31return -1;32}33INFO_LOG(Log::sceMisc, "sceAdler32(adler=%08x, data=%08x, datalen=%08x)", adler, data, datalen);3435u8 *buf = Memory::GetPointerWriteUnchecked(data);36u32 ret = adler32(adler, buf, datalen);3738return ret;39}4041const HLEFunction sceAdler[] = {42{0X9702EF11, &WrapU_UUU<sceAdler32>, "sceAdler32", 'x', "xxx"},43};4445void Register_sceAdler() {46RegisterModule("sceAdler", ARRAY_SIZE(sceAdler), sceAdler);47}484950