[Scummvm-git-logs] scummvm master -> c240af799fa61f647073cfa5b94d76b26880c143
sev-
sev at scummvm.org
Sat Aug 18 13:49:23 CEST 2018
This automated email contains information about 8 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
ce1868a28a PSP: Fix usage of obsolete libpng APIs
c494123996 PSP: Fix loading of 4-bit PNG images
452e979101 PSP: Fix invalid return type of PspIoStream
042650157a PSP: Fix strict aliasing violation
334e0e7463 PSP: Remove dead code
e49e34eede PSP: Fix wrong/dangerous C-style casts
7016c86d53 PSP: Fix bad indentation
c240af799f PSP: Fix compilation failures when debug printing is enabled
Commit: ce1868a28abea643e3b4fe7797ec4328d6b54091
https://github.com/scummvm/scummvm/commit/ce1868a28abea643e3b4fe7797ec4328d6b54091
Author: Colin Snover (github.com at zetafleet.com)
Date: 2018-08-18T13:49:15+02:00
Commit Message:
PSP: Fix usage of obsolete libpng APIs
These APIs were deprecated as early as libpng1.2 and were removed
by libpng1.5.
Changed paths:
backends/platform/psp/png_loader.cpp
diff --git a/backends/platform/psp/png_loader.cpp b/backends/platform/psp/png_loader.cpp
index e54541b..277546a 100644
--- a/backends/platform/psp/png_loader.cpp
+++ b/backends/platform/psp/png_loader.cpp
@@ -99,7 +99,7 @@ void PngLoader::warningFn(png_structp png_ptr, png_const_charp warning_msg) {
// Read function for png library to be able to read from our SeekableReadStream
//
void PngLoader::libReadFunc(png_structp pngPtr, png_bytep data, png_size_t length) {
- Common::SeekableReadStream &file = *(Common::SeekableReadStream *)pngPtr->io_ptr;
+ Common::SeekableReadStream &file = *(Common::SeekableReadStream *)png_get_io_ptr(pngPtr);
file.read(data, length);
}
@@ -114,7 +114,7 @@ bool PngLoader::basicImageLoad() {
_infoPtr = png_create_info_struct(_pngPtr);
if (!_infoPtr) {
- png_destroy_read_struct(&_pngPtr, png_infopp_NULL, png_infopp_NULL);
+ png_destroy_read_struct(&_pngPtr, NULL, NULL);
return false;
}
// Set the png lib to use our read function
@@ -126,11 +126,14 @@ bool PngLoader::basicImageLoad() {
png_read_info(_pngPtr, _infoPtr);
int interlaceType;
png_get_IHDR(_pngPtr, _infoPtr, (png_uint_32 *)&_width, (png_uint_32 *)&_height, &_bitDepth,
- &_colorType, &interlaceType, int_p_NULL, int_p_NULL);
+ &_colorType, &interlaceType, NULL, NULL);
_channels = png_get_channels(_pngPtr, _infoPtr);
- if (_colorType & PNG_COLOR_MASK_PALETTE)
- _paletteSize = _infoPtr->num_palette;
+ if (_colorType & PNG_COLOR_MASK_PALETTE) {
+ int paletteSize;
+ png_get_PLTE(_pngPtr, _infoPtr, NULL, &paletteSize);
+ _paletteSize = paletteSize;
+ }
return true;
}
@@ -142,7 +145,7 @@ bool PngLoader::findImageDimensions() {
bool status = basicImageLoad();
PSP_DEBUG_PRINT("width[%d], height[%d], paletteSize[%d], bitDepth[%d], channels[%d], rowBytes[%d]\n", _width, _height, _paletteSize, _bitDepth, _channels, _infoPtr->rowbytes);
- png_destroy_read_struct(&_pngPtr, &_infoPtr, png_infopp_NULL);
+ png_destroy_read_struct(&_pngPtr, &_infoPtr, NULL);
return status;
}
@@ -153,22 +156,28 @@ bool PngLoader::loadImageIntoBuffer() {
DEBUG_ENTER_FUNC();
if (!basicImageLoad()) {
- png_destroy_read_struct(&_pngPtr, &_infoPtr, png_infopp_NULL);
+ png_destroy_read_struct(&_pngPtr, &_infoPtr, NULL);
return false;
}
png_set_strip_16(_pngPtr); // Strip off 16 bit channels in case they occur
if (_paletteSize) {
// Copy the palette
- png_colorp srcPal = _infoPtr->palette;
- for (int i = 0; i < _infoPtr->num_palette; i++) {
- unsigned char alphaVal = (i < _infoPtr->num_trans) ? _infoPtr->trans[i] : 0xFF; // Load alpha if it's there
+ png_colorp srcPal;
+ int numPalette;
+ png_get_PLTE(_pngPtr, _infoPtr, &srcPal, &numPalette);
+ png_bytep transAlpha;
+ int numTrans;
+ png_color_16p transColor;
+ png_get_tRNS(_pngPtr, _infoPtr, &transAlpha, &numTrans, &transColor);
+ for (int i = 0; i < numPalette; i++) {
+ unsigned char alphaVal = (i < numTrans) ? transAlpha[i] : 0xFF; // Load alpha if it's there
_palette->setSingleColorRGBA(i, srcPal->red, srcPal->green, srcPal->blue, alphaVal);
srcPal++;
}
} else { // Not a palettized image
if (_colorType == PNG_COLOR_TYPE_GRAY && _bitDepth < 8)
- png_set_gray_1_2_4_to_8(_pngPtr); // Round up grayscale images
+ png_set_expand_gray_1_2_4_to_8(_pngPtr); // Round up grayscale images
if (png_get_valid(_pngPtr, _infoPtr, PNG_INFO_tRNS))
png_set_tRNS_to_alpha(_pngPtr); // Convert trans channel to alpha for 32 bits
@@ -188,18 +197,18 @@ bool PngLoader::loadImageIntoBuffer() {
unsigned char *line = (unsigned char*) malloc(rowBytes);
if (!line) {
- png_destroy_read_struct(&_pngPtr, png_infopp_NULL, png_infopp_NULL);
+ png_destroy_read_struct(&_pngPtr, NULL, NULL);
PSP_ERROR("Couldn't allocate line\n");
return false;
}
for (size_t y = 0; y < _height; y++) {
- png_read_row(_pngPtr, line, png_bytep_NULL);
+ png_read_row(_pngPtr, line, NULL);
_buffer->copyFromRect(line, rowBytes, 0, y, _width, 1); // Copy into buffer
}
free(line);
png_read_end(_pngPtr, _infoPtr);
- png_destroy_read_struct(&_pngPtr, &_infoPtr, png_infopp_NULL);
+ png_destroy_read_struct(&_pngPtr, &_infoPtr, NULL);
return true;
}
Commit: c494123996d026223362ec5d28e23693ce981981
https://github.com/scummvm/scummvm/commit/c494123996d026223362ec5d28e23693ce981981
Author: rsn8887 (rsn8887 at users.noreply.github.com)
Date: 2018-08-18T13:49:15+02:00
Commit Message:
PSP: Fix loading of 4-bit PNG images
This fixes the loading of vkbd images from kbd subfolder:
kbd/keys_s_c4.png
kbd/keys_s4.png
kbd/nums_s4.png
kbd/keys_c4.png
kbd/syms_s4.png
kbd/keys4.png
kbd/nums4.png
kbd/syms4.png
Changed paths:
backends/platform/psp/png_loader.cpp
diff --git a/backends/platform/psp/png_loader.cpp b/backends/platform/psp/png_loader.cpp
index 277546a..91187ae 100644
--- a/backends/platform/psp/png_loader.cpp
+++ b/backends/platform/psp/png_loader.cpp
@@ -44,7 +44,7 @@ PngLoader::Status PngLoader::allocate() {
_buffer->setSize(_width, _height, _sizeBy);
- uint32 bitsPerPixel = _bitDepth * _channels;
+ uint32 bitsPerPixel = _bitDepth;
if (_paletteSize) { // 8 or 4-bit image
if (bitsPerPixel == 4) {
@@ -87,7 +87,7 @@ bool PngLoader::load() {
PSP_DEBUG_PRINT("succeded in loading image\n");
- if (_paletteSize == 16) // 4-bit
+ if (_bitDepth == 4) // 4-bit
_buffer->flipNibbles(); // required because of PNG 4-bit format
return true;
}
Commit: 452e979101da7586042bbe07691b99773e398f1e
https://github.com/scummvm/scummvm/commit/452e979101da7586042bbe07691b99773e398f1e
Author: Colin Snover (github.com at zetafleet.com)
Date: 2018-08-18T13:49:15+02:00
Commit Message:
PSP: Fix invalid return type of PspIoStream
The underlying API returns a SceUID, which is not valid to be
casted to a pointer.
Changed paths:
backends/fs/psp/psp-stream.cpp
backends/fs/psp/psp-stream.h
diff --git a/backends/fs/psp/psp-stream.cpp b/backends/fs/psp/psp-stream.cpp
index c9b2fc7..51720b5 100644
--- a/backends/fs/psp/psp-stream.cpp
+++ b/backends/fs/psp/psp-stream.cpp
@@ -82,7 +82,7 @@ PspIoStream::~PspIoStream() {
/* Function to open the file pointed to by the path.
*
*/
-void *PspIoStream::open() {
+SceUID PspIoStream::open() {
DEBUG_ENTER_FUNC();
if (PowerMan.beginCriticalSection()) {
@@ -91,9 +91,9 @@ void *PspIoStream::open() {
}
_handle = sceIoOpen(_path.c_str(), _writeMode ? PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC : PSP_O_RDONLY, 0777);
- if (!_handle) {
+ if (_handle <= 0) {
_error = true;
- _handle = NULL;
+ _handle = 0;
}
// Get the file size. This way is much faster than going to the end of the file and back
@@ -107,7 +107,7 @@ void *PspIoStream::open() {
PowerMan.endCriticalSection();
- return (void *)_handle;
+ return _handle;
}
bool PspIoStream::err() const {
diff --git a/backends/fs/psp/psp-stream.h b/backends/fs/psp/psp-stream.h
index 734cb66..fe1d797 100644
--- a/backends/fs/psp/psp-stream.h
+++ b/backends/fs/psp/psp-stream.h
@@ -69,7 +69,7 @@ public:
PspIoStream(const Common::String &path, bool writeMode);
virtual ~PspIoStream();
- void * open(); // open the file pointed to by the file path
+ SceUID open(); // open the file pointed to by the file path
bool err() const;
void clearErr();
Commit: 042650157a7d3fb02e0e436cd43665b5b1e67a75
https://github.com/scummvm/scummvm/commit/042650157a7d3fb02e0e436cd43665b5b1e67a75
Author: Colin Snover (github.com at zetafleet.com)
Date: 2018-08-18T13:49:15+02:00
Commit Message:
PSP: Fix strict aliasing violation
Casting through pointer to void just to truncate a value to uint32
is incorrect.
Changed paths:
backends/fs/psp/psp-stream.cpp
diff --git a/backends/fs/psp/psp-stream.cpp b/backends/fs/psp/psp-stream.cpp
index 51720b5..8cefd41 100644
--- a/backends/fs/psp/psp-stream.cpp
+++ b/backends/fs/psp/psp-stream.cpp
@@ -99,7 +99,7 @@ SceUID PspIoStream::open() {
// Get the file size. This way is much faster than going to the end of the file and back
SceIoStat stat;
sceIoGetstat(_path.c_str(), &stat);
- _fileSize = *((uint32 *)(void *)&stat.st_size); // 4GB file (32 bits) is big enough for us
+ _fileSize = stat.st_size; // 4GB file (32 bits) is big enough for us
PSP_DEBUG_PRINT("%s filesize[%d]\n", _path.c_str(), _fileSize);
Commit: 334e0e74637482e286f62b3df9908310df86e1e2
https://github.com/scummvm/scummvm/commit/334e0e74637482e286f62b3df9908310df86e1e2
Author: Colin Snover (github.com at zetafleet.com)
Date: 2018-08-18T13:49:15+02:00
Commit Message:
PSP: Remove dead code
Changed paths:
backends/platform/psp/cursor.cpp
diff --git a/backends/platform/psp/cursor.cpp b/backends/platform/psp/cursor.cpp
index b7c69d5..06c5e49 100644
--- a/backends/platform/psp/cursor.cpp
+++ b/backends/platform/psp/cursor.cpp
@@ -220,10 +220,6 @@ inline void Cursor::adjustXYForScreenSize(int32 &x, int32 &y) {
void Cursor::setScreenPaletteScummvmPixelFormat(const Graphics::PixelFormat *format) {
DEBUG_ENTER_FUNC();
- uint32 oldPaletteSize = 0;
- if (_screenPalette.isAllocated())
- oldPaletteSize = _screenPalette.getSizeInBytes();
-
PSPPixelFormat::Type bufferType = PSPPixelFormat::Type_Unknown;
PSPPixelFormat::Type paletteType = PSPPixelFormat::Type_Unknown;
bool swapRedBlue = false;
@@ -247,14 +243,11 @@ void Cursor::setSizeAndScummvmPixelFormat(uint32 width, uint32 height, const Gra
PSP_DEBUG_PRINT("useCursorPalette[%s]\n", _useCursorPalette ? "true" : "false");
- uint32 oldBufferSize = 0, oldPaletteSize = 0;
+ uint32 oldBufferSize = 0;
if (_buffer.isAllocated())
oldBufferSize = _buffer.getSizeInBytes();
- if (_palette.isAllocated())
- oldPaletteSize = _palette.getSizeInBytes();
-
setSize(width, height);
PSPPixelFormat::Type bufferType = PSPPixelFormat::Type_Unknown;
Commit: e49e34eeded57392bf6f5f2996e23ec61cf28430
https://github.com/scummvm/scummvm/commit/e49e34eeded57392bf6f5f2996e23ec61cf28430
Author: Colin Snover (github.com at zetafleet.com)
Date: 2018-08-18T13:49:15+02:00
Commit Message:
PSP: Fix wrong/dangerous C-style casts
Changed paths:
backends/platform/psp/default_display_client.cpp
backends/platform/psp/memory.cpp
backends/platform/psp/memory.h
backends/platform/psp/mp3.cpp
diff --git a/backends/platform/psp/default_display_client.cpp b/backends/platform/psp/default_display_client.cpp
index f2d8a7c..1f0cef2 100644
--- a/backends/platform/psp/default_display_client.cpp
+++ b/backends/platform/psp/default_display_client.cpp
@@ -125,13 +125,13 @@ void Overlay::setSize(uint32 width, uint32 height) {
void Overlay::copyToArray(void *buf, int pitch) {
DEBUG_ENTER_FUNC();
- _buffer.copyToArray((byte *)buf, pitch); // Change to bytes
+ _buffer.copyToArray((byte *)buf, pitch);
}
void Overlay::copyFromRect(const void *buf, int pitch, int x, int y, int w, int h) {
DEBUG_ENTER_FUNC();
- _buffer.copyFromRect((byte *)buf, pitch, x, y, w, h); // Change to bytes
+ _buffer.copyFromRect((const byte *)buf, pitch, x, y, w, h);
// debug
//_buffer.print(0xFF);
setDirty();
diff --git a/backends/platform/psp/memory.cpp b/backends/platform/psp/memory.cpp
index 72a526c..55b56bd 100644
--- a/backends/platform/psp/memory.cpp
+++ b/backends/platform/psp/memory.cpp
@@ -72,7 +72,7 @@ void PspMemory::copy(byte *dst, const byte *src, uint32 bytes) {
if (alignSrc) { // we'll need to realign our reads
copy32Misaligned((uint32 *)dst, src, bytes, alignSrc);
} else {
- copy32Aligned((uint32 *)dst, (uint32 *)src, bytes);
+ copy32Aligned((uint32 *)dst, (const uint32 *)src, bytes);
}
#ifdef TEST_MEMORY_COPY
@@ -141,7 +141,7 @@ void PspMemory::copy32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes)
PSP_DEBUG_PRINT("bytesLeft[%d]\n", bytesLeft);
byte *dst = (byte *)dst32;
- byte *src = (byte *)src32;
+ const byte *src = (const byte *)src32;
while (bytesLeft--) {
*dst++ = *src++;
@@ -343,7 +343,7 @@ void PspMemorySwap::swap32Aligned(uint32 *dst32, const uint32 *src32, uint32 byt
bytesLeft = bytes & 0x3;
if (bytesLeft) { // for swap, can only be 1 short left
- *((uint16 *)dst32) = format.swapRedBlue16(*((uint16 *)src32));
+ *((uint16 *)dst32) = format.swapRedBlue16(*((const uint16 *)src32));
}
}
diff --git a/backends/platform/psp/memory.h b/backends/platform/psp/memory.h
index f794eb0..edf19b1 100644
--- a/backends/platform/psp/memory.h
+++ b/backends/platform/psp/memory.h
@@ -72,7 +72,7 @@ public:
// This is the interface to the outside world
static void *fastCopy(void *dstv, const void *srcv, int32 bytes) {
byte *dst = (byte *)dstv;
- byte *src = (byte *)srcv;
+ const byte *src = (const byte *)srcv;
if (bytes < MIN_AMOUNT_FOR_COMPLEX_COPY) {
copy8(dst, src, bytes);
@@ -114,9 +114,9 @@ private:
public:
static void fastSwap(byte *dst, const byte *src, uint32 bytes, PSPPixelFormat &format) {
if (bytes < MIN_AMOUNT_FOR_COMPLEX_COPY * 2) {
- swap16((uint16 *)dst, (uint16 *)src, bytes, format);
+ swap16((uint16 *)dst, (const uint16 *)src, bytes, format);
} else { // go to more powerful copy
- swap((uint16 *)dst, (uint16 *)src, bytes, format);
+ swap((uint16 *)dst, (const uint16 *)src, bytes, format);
}
}
};
diff --git a/backends/platform/psp/mp3.cpp b/backends/platform/psp/mp3.cpp
index 6db2a73..9e55fc7 100644
--- a/backends/platform/psp/mp3.cpp
+++ b/backends/platform/psp/mp3.cpp
@@ -98,13 +98,13 @@ bool Mp3PspStream::initDecoder() {
uint32 firmware = sceKernelDevkitVersion();
PSP_DEBUG_PRINT("Firmware version 0x%x\n", firmware);
if (firmware == 0x01050001){
- if (!loadStartAudioModule((char *)(void *)"flash0:/kd/me_for_vsh.prx",
+ if (!loadStartAudioModule("flash0:/kd/me_for_vsh.prx",
PSP_MEMORY_PARTITION_KERNEL)) {
PSP_ERROR("failed to load me_for_vsh.prx. ME cannot start.\n");
_decoderFail = true;
return false;
}
- if (!loadStartAudioModule((char *)(void *)"flash0:/kd/audiocodec.prx", PSP_MEMORY_PARTITION_KERNEL)) {
+ if (!loadStartAudioModule("flash0:/kd/audiocodec.prx", PSP_MEMORY_PARTITION_KERNEL)) {
PSP_ERROR("failed to load audiocodec.prx. ME cannot start.\n");
_decoderFail = true;
return false;
Commit: 7016c86d5348586fd798650f46804665f207dcd0
https://github.com/scummvm/scummvm/commit/7016c86d5348586fd798650f46804665f207dcd0
Author: Colin Snover (github.com at zetafleet.com)
Date: 2018-08-18T13:49:15+02:00
Commit Message:
PSP: Fix bad indentation
Changed paths:
backends/platform/psp/memory.h
diff --git a/backends/platform/psp/memory.h b/backends/platform/psp/memory.h
index edf19b1..39b2dd5 100644
--- a/backends/platform/psp/memory.h
+++ b/backends/platform/psp/memory.h
@@ -103,13 +103,13 @@ private:
static void swap32Misaligned(uint32 *dst32, const uint16 *src16, uint32 bytes, PSPPixelFormat &format);
// For swapping, we know that we have multiples of 16 bits
static void swap16(uint16 *dst16, const uint16 *src16, uint32 bytes, PSPPixelFormat &format) {
- PSP_DEBUG_PRINT("swap16 called with dst16[%p], src16[%p], bytes[%d]\n", dst16, src16, bytes);
- uint32 shorts = bytes >> 1;
+ PSP_DEBUG_PRINT("swap16 called with dst16[%p], src16[%p], bytes[%d]\n", dst16, src16, bytes);
+ uint32 shorts = bytes >> 1;
- while (shorts--) {
- *dst16++ = format.swapRedBlue16(*src16++);
+ while (shorts--) {
+ *dst16++ = format.swapRedBlue16(*src16++);
+ }
}
-}
public:
static void fastSwap(byte *dst, const byte *src, uint32 bytes, PSPPixelFormat &format) {
Commit: c240af799fa61f647073cfa5b94d76b26880c143
https://github.com/scummvm/scummvm/commit/c240af799fa61f647073cfa5b94d76b26880c143
Author: Colin Snover (github.com at zetafleet.com)
Date: 2018-08-18T13:49:15+02:00
Commit Message:
PSP: Fix compilation failures when debug printing is enabled
Changed paths:
backends/platform/psp/display_manager.cpp
backends/platform/psp/osys_psp.cpp
backends/platform/psp/png_loader.cpp
diff --git a/backends/platform/psp/display_manager.cpp b/backends/platform/psp/display_manager.cpp
index 54ad0d3..fd94827 100644
--- a/backends/platform/psp/display_manager.cpp
+++ b/backends/platform/psp/display_manager.cpp
@@ -435,7 +435,7 @@ bool DisplayManager::renderAll() {
_overlay->isDirty() ? "true" : "false",
_cursor->isDirty() ? "true" : "false",
_keyboard->isDirty() ? "true" : "false",
- _imageViewer->isDirty() ? "true" : "false",
+ _imageViewer->isDirty() ? "true" : "false"
);
_masterGuRenderer.guPreRender(); // Set up rendering
diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp
index 314580f..5d9e3ab 100644
--- a/backends/platform/psp/osys_psp.cpp
+++ b/backends/platform/psp/osys_psp.cpp
@@ -314,7 +314,7 @@ void OSystem_PSP::setMouseCursor(const void *buf, uint w, uint h, int hotspotX,
_displayManager.waitUntilRenderFinished();
_pendingUpdate = false;
- PSP_DEBUG_PRINT("pbuf[%p], w[%u], h[%u], hotspot:X[%d], Y[%d], keycolor[%d], scale[%d], pformat[%p]\n", buf, w, h, hotspotX, hotspotY, keycolor, cursorTargetScale, format);
+ PSP_DEBUG_PRINT("pbuf[%p], w[%u], h[%u], hotspot:X[%d], Y[%d], keycolor[%d], scale[%d], pformat[%p]\n", buf, w, h, hotspotX, hotspotY, keycolor, !dontScale, format);
if (format) {
PSP_DEBUG_PRINT("format: bpp[%d], rLoss[%d], gLoss[%d], bLoss[%d], aLoss[%d], rShift[%d], gShift[%d], bShift[%d], aShift[%d]\n", format->bytesPerPixel, format->rLoss, format->gLoss, format->bLoss, format->aLoss, format->rShift, format->gShift, format->bShift, format->aShift);
}
diff --git a/backends/platform/psp/png_loader.cpp b/backends/platform/psp/png_loader.cpp
index 91187ae..502ebf5 100644
--- a/backends/platform/psp/png_loader.cpp
+++ b/backends/platform/psp/png_loader.cpp
@@ -144,7 +144,7 @@ bool PngLoader::findImageDimensions() {
bool status = basicImageLoad();
- PSP_DEBUG_PRINT("width[%d], height[%d], paletteSize[%d], bitDepth[%d], channels[%d], rowBytes[%d]\n", _width, _height, _paletteSize, _bitDepth, _channels, _infoPtr->rowbytes);
+ PSP_DEBUG_PRINT("width[%d], height[%d], paletteSize[%d], bitDepth[%d], channels[%d], rowBytes[%d]\n", _width, _height, _paletteSize, _bitDepth, _channels, png_get_rowbytes(_pngPtr, _infoPtr));
png_destroy_read_struct(&_pngPtr, &_infoPtr, NULL);
return status;
}
More information about the Scummvm-git-logs
mailing list