mirror of
https://github.com/libretro/ppsspp.git
synced 2025-01-28 20:21:53 +00:00
spacing fix
This commit is contained in:
parent
e686ef46b8
commit
8ebb733a98
@ -17,61 +17,53 @@
|
||||
|
||||
#include "Globals.h"
|
||||
#include "HLE.h"
|
||||
#include "..\..\ext\zlib\zlib.h"
|
||||
#include "zlib.h"
|
||||
|
||||
int sceZlibDecompress(u32 OutBuffer, int OutBufferLength, u32 InBuffer, u32 Crc32Addr)
|
||||
{
|
||||
int err;
|
||||
int sceZlibDecompress(u32 OutBuffer, int OutBufferLength, u32 InBuffer, u32 Crc32Addr) {
|
||||
int err;
|
||||
uLong crc;
|
||||
z_stream stream;
|
||||
z_stream stream;
|
||||
u8 *outBufferPtr;
|
||||
u32 *crc32AddrPtr = 0;
|
||||
|
||||
if( !Memory::IsValidAddress( OutBuffer ) || !Memory::IsValidAddress( InBuffer ) )
|
||||
{
|
||||
ERROR_LOG( HLE, "sceZlibDecompress: Bad address %08x %08x", OutBuffer, InBuffer );
|
||||
if (!Memory::IsValidAddress(OutBuffer) || !Memory::IsValidAddress(InBuffer)) {
|
||||
ERROR_LOG(HLE, "sceZlibDecompress: Bad address %08x %08x", OutBuffer, InBuffer);
|
||||
return 0;
|
||||
}
|
||||
if( Crc32Addr )
|
||||
{
|
||||
if( !Memory::IsValidAddress( Crc32Addr ) )
|
||||
{
|
||||
ERROR_LOG( HLE, "sceZlibDecompress: Bad address %08x", Crc32Addr );
|
||||
if (Crc32Addr) {
|
||||
if (!Memory::IsValidAddress(Crc32Addr)) {
|
||||
ERROR_LOG(HLE, "sceZlibDecompress: Bad address %08x", Crc32Addr);
|
||||
return 0;
|
||||
}
|
||||
crc32AddrPtr = (u32 *)Memory::GetPointer( Crc32Addr );
|
||||
crc32AddrPtr = (u32 *)Memory::GetPointer(Crc32Addr);
|
||||
}
|
||||
outBufferPtr = Memory::GetPointer( OutBuffer );
|
||||
outBufferPtr = Memory::GetPointer(OutBuffer);
|
||||
stream.next_in = (Bytef*)Memory::GetPointer(InBuffer);
|
||||
stream.avail_in = (uInt)OutBufferLength;
|
||||
stream.next_out = outBufferPtr;
|
||||
stream.avail_out = (uInt)OutBufferLength;
|
||||
stream.zalloc = (alloc_func)0;
|
||||
stream.zfree = (free_func)0;
|
||||
err = inflateInit(&stream);
|
||||
if( err != Z_OK )
|
||||
{
|
||||
ERROR_LOG( HLE, "sceZlibDecompress: inflateInit failed %08x", err );
|
||||
stream.avail_in = (uInt)OutBufferLength;
|
||||
stream.next_out = outBufferPtr;
|
||||
stream.avail_out = (uInt)OutBufferLength;
|
||||
stream.zalloc = (alloc_func)0;
|
||||
stream.zfree = (free_func)0;
|
||||
err = inflateInit(&stream);
|
||||
if (err != Z_OK) {
|
||||
ERROR_LOG(HLE, "sceZlibDecompress: inflateInit failed %08x", err);
|
||||
return 0;
|
||||
}
|
||||
err = inflate( &stream, Z_FINISH );
|
||||
if( err != Z_STREAM_END )
|
||||
{
|
||||
inflateEnd( &stream );
|
||||
ERROR_LOG( HLE, "sceZlibDecompress: inflate failed %08x", err );
|
||||
err = inflate(&stream, Z_FINISH);
|
||||
if (err != Z_STREAM_END) {
|
||||
inflateEnd(&stream);
|
||||
ERROR_LOG(HLE, "sceZlibDecompress: inflate failed %08x", err);
|
||||
return 0;
|
||||
}
|
||||
inflateEnd( &stream );
|
||||
if( crc32AddrPtr )
|
||||
{
|
||||
crc = crc32( 0L, Z_NULL, 0 );
|
||||
*crc32AddrPtr = crc32( crc, outBufferPtr, stream.total_out );
|
||||
inflateEnd(&stream);
|
||||
if (crc32AddrPtr) {
|
||||
crc = crc32(0L, Z_NULL, 0);
|
||||
*crc32AddrPtr = crc32(crc, outBufferPtr, stream.total_out);
|
||||
}
|
||||
return stream.total_out;
|
||||
}
|
||||
|
||||
const HLEFunction sceDeflt[] =
|
||||
{
|
||||
const HLEFunction sceDeflt[] = {
|
||||
{0x0BA3B9CC, 0, "sceGzipGetCompressedData"},
|
||||
{0x106A3552, 0, "sceGzipGetName"},
|
||||
{0x1B5B82BC, 0, "sceGzipIsValid"},
|
||||
@ -86,7 +78,6 @@ const HLEFunction sceDeflt[] =
|
||||
{0xE46EB986, 0, "sceZlibIsValid"},
|
||||
};
|
||||
|
||||
void Register_sceDeflt()
|
||||
{
|
||||
void Register_sceDeflt() {
|
||||
RegisterModule("sceDeflt", ARRAY_SIZE(sceDeflt), sceDeflt);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user