diff --git a/rpcs3/Emu/Io/MouseHandler.h b/rpcs3/Emu/Io/MouseHandler.h index b23a404633..d937bf25c9 100644 --- a/rpcs3/Emu/Io/MouseHandler.h +++ b/rpcs3/Emu/Io/MouseHandler.h @@ -127,7 +127,7 @@ public: { CellMouseData& data = GetData(p); data.update = CELL_MOUSE_DATA_UPDATE; - data.wheel = rotation; + data.wheel = rotation/120; //120=event.GetWheelDelta() } } } diff --git a/rpcs3/Emu/SysCalls/Modules/cellGifDec.cpp b/rpcs3/Emu/SysCalls/Modules/cellGifDec.cpp index 1049103aeb..e35da3dd45 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGifDec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellGifDec.cpp @@ -197,20 +197,19 @@ int cellGifDecDecodeData(u32 mainHandle, u32 subHandle, u32 data_addr, u32 dataC for(u32 i = 0; i < fileSize; i++){ gif[i] = Memory.Read8(buffer+i); } + Memory.Free(buffer); unsigned char *image = stbi_load_from_memory((const unsigned char*)gif, fileSize, &width, &height, &actual_components, 4); - if (!image) - { - Memory.Free(buffer); - return CELL_GIFDEC_ERROR_STREAM_FORMAT; - } + delete[] gif; + if (!image) return CELL_GIFDEC_ERROR_STREAM_FORMAT; + u32 image_size = width * height * 4; if (inParam.colorSpace == CELL_GIFDEC_RGBA){ for(u32 i = 0; i < image_size; i+=4){ Memory.Write8(data_addr+i+0, image[i+0]); Memory.Write8(data_addr+i+1, image[i+1]); Memory.Write8(data_addr+i+2, image[i+2]); - Memory.Write8(data_addr+i+3, image[i+3]); // (This can be optimized by using Write32) + Memory.Write8(data_addr+i+3, image[i+3]); } } if (inParam.colorSpace == CELL_GIFDEC_ARGB){ @@ -221,7 +220,7 @@ int cellGifDecDecodeData(u32 mainHandle, u32 subHandle, u32 data_addr, u32 dataC Memory.Write8(data_addr+i+3, image[i+2]); } } - Memory.Free(buffer); + delete[] image; //The output data is an image (dataOutInfo.recordType = 1) Memory.Write32(dataOutInfo_addr, 1); diff --git a/rpcs3/Emu/SysCalls/Modules/cellJpgDec.cpp b/rpcs3/Emu/SysCalls/Modules/cellJpgDec.cpp index 05eeaf7f04..c9cbaba239 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellJpgDec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellJpgDec.cpp @@ -217,13 +217,12 @@ int cellJpgDecDecodeData(u32 mainHandle, u32 subHandle, u32 data_addr, u32 dataC for(u32 i = 0; i < fileSize; i++){ jpg[i] = Memory.Read8(buffer+i); } + Memory.Free(buffer); unsigned char *image = stbi_load_from_memory((const unsigned char*)jpg, fileSize, &width, &height, &actual_components, 4); - if (!image) - { - Memory.Free(buffer); - return CELL_JPGDEC_ERROR_STREAM_FORMAT; - } + delete[] jpg; + if (!image) return CELL_JPGDEC_ERROR_STREAM_FORMAT; + u32 image_size = width * height * 4; if (inParam.outputColorSpace == CELL_JPG_RGBA){ for(u32 i = 0; i < image_size; i+=4){ @@ -241,7 +240,7 @@ int cellJpgDecDecodeData(u32 mainHandle, u32 subHandle, u32 data_addr, u32 dataC Memory.Write8(data_addr+i+3, image[i+2]); } } - Memory.Free(buffer); + delete[] image; return CELL_OK; } diff --git a/rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp b/rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp index d260312d8f..1a93351259 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp @@ -202,13 +202,12 @@ int cellPngDecDecodeData(u32 mainHandle, u32 subHandle, u32 data_addr, u32 dataC for(u32 i = 0; i < fileSize; i++){ png[i] = Memory.Read8(buffer+i); } + Memory.Free(buffer); unsigned char *image = stbi_load_from_memory((const unsigned char*)png, fileSize, &width, &height, &actual_components, 4); - if (!image) - { - Memory.Free(buffer); - return CELL_PNGDEC_ERROR_STREAM_FORMAT; - } + delete[] png; + if (!image) return CELL_PNGDEC_ERROR_STREAM_FORMAT; + u32 image_size = width * height * 4; if (inParam.outputColorSpace == CELL_PNGDEC_RGBA){ for(u32 i = 0; i < image_size; i+=4){ @@ -226,7 +225,7 @@ int cellPngDecDecodeData(u32 mainHandle, u32 subHandle, u32 data_addr, u32 dataC Memory.Write8(data_addr+i+3, image[i+2]); } } - Memory.Free(buffer); + delete[] image; return CELL_OK; }