From 318d7276c0d27700152d63c0534656479ee71a1b Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Fri, 2 Jan 2015 18:29:57 +0300 Subject: [PATCH] Warning fix --- rpcs3/Emu/Cell/PPUOpcodes.h | 2 + rpcs3/Emu/Cell/SPUOpcodes.h | 2 + rpcs3/Emu/SysCalls/Modules/cellAvconfExt.cpp | 15 ++++--- rpcs3/Emu/SysCalls/Modules/cellDmux.cpp | 2 +- rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp | 46 +++++++++++--------- rpcs3/Emu/SysCalls/Modules/cellSpurs.cpp | 4 +- rpcs3/Emu/SysCalls/SyncPrimitivesManager.cpp | 1 + 7 files changed, 42 insertions(+), 30 deletions(-) diff --git a/rpcs3/Emu/Cell/PPUOpcodes.h b/rpcs3/Emu/Cell/PPUOpcodes.h index 6c89edf81e..39b9e08aa9 100644 --- a/rpcs3/Emu/Cell/PPUOpcodes.h +++ b/rpcs3/Emu/Cell/PPUOpcodes.h @@ -451,6 +451,8 @@ namespace PPU_opcodes class PPUOpcodes { public: + virtual ~PPUOpcodes() {} + static u32 branchTarget(const u32 pc, const u32 imm) { return pc + (imm & ~0x3ULL); diff --git a/rpcs3/Emu/Cell/SPUOpcodes.h b/rpcs3/Emu/Cell/SPUOpcodes.h index 1538accd18..dd8a99b082 100644 --- a/rpcs3/Emu/Cell/SPUOpcodes.h +++ b/rpcs3/Emu/Cell/SPUOpcodes.h @@ -229,6 +229,8 @@ namespace SPU_opcodes class SPUOpcodes { public: + virtual ~SPUOpcodes() {} + static u32 branchTarget(const u32 pc, const s32 imm) { return (pc + (imm << 2)) & 0x3fffc; diff --git a/rpcs3/Emu/SysCalls/Modules/cellAvconfExt.cpp b/rpcs3/Emu/SysCalls/Modules/cellAvconfExt.cpp index 260c8eb9bb..9014f472f0 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellAvconfExt.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellAvconfExt.cpp @@ -16,16 +16,18 @@ int cellVideoOutGetScreenSize(u32 videoOut, vm::ptr screenSize) { cellAvconfExt->Warning("cellVideoOutGetScreenSize(videoOut=%d, screenSize_addr=0x%x)", videoOut, screenSize.addr()); - if (!videoOut == CELL_VIDEO_OUT_PRIMARY) + if (videoOut != CELL_VIDEO_OUT_PRIMARY) + { return CELL_VIDEO_OUT_ERROR_UNSUPPORTED_VIDEO_OUT; + } //TODO: Use virtual screen size #ifdef _WIN32 HDC screen = GetDC(NULL); - float diagonal = round(sqrt((pow(GetDeviceCaps(screen, HORZSIZE), 2) + pow(GetDeviceCaps(screen, VERTSIZE), 2))) * 0.0393); + float diagonal = roundf(sqrtf((powf(float(GetDeviceCaps(screen, HORZSIZE)), 2) + powf(float(GetDeviceCaps(screen, VERTSIZE)), 2))) * 0.0393f); #else // TODO: Linux implementation, without using wx - // float diagonal = round(sqrt((pow(wxGetDisplaySizeMM().GetWidth(), 2) + pow(wxGetDisplaySizeMM().GetHeight(), 2))) * 0.0393); + // float diagonal = roundf(sqrtf((powf(wxGetDisplaySizeMM().GetWidth(), 2) + powf(wxGetDisplaySizeMM().GetHeight(), 2))) * 0.0393f); #endif if (Ini.GS3DTV.GetValue()) @@ -55,7 +57,8 @@ void cellAvconfExt_init(Module *pxThis) { cellAvconfExt = pxThis; - cellAvconfExt->AddFunc(0x4ec8c141, cellVideoOutConvertCursorColor); - cellAvconfExt->AddFunc(0xfaa275a4, cellVideoOutGetScreenSize); - cellAvconfExt->AddFunc(0xc7020f62, cellVideoOutSetGamma); + REG_FUNC(cellAvconfExt, cellVideoOutConvertCursorColor); + REG_FUNC(cellAvconfExt, cellVideoOutGetScreenSize); + REG_FUNC(cellAvconfExt, cellVideoOutGetGamma); + REG_FUNC(cellAvconfExt, cellVideoOutSetGamma); } \ No newline at end of file diff --git a/rpcs3/Emu/SysCalls/Modules/cellDmux.cpp b/rpcs3/Emu/SysCalls/Modules/cellDmux.cpp index 3ad90bcc78..5c17b81125 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellDmux.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellDmux.cpp @@ -92,7 +92,7 @@ ElementaryStream::ElementaryStream(Demuxer* dmux, u32 addr, u32 size, u32 fidMaj , cbFunc(cbFunc) , cbArg(cbArg) , spec(spec) - , put(memAddr) + , put(a128(addr)) , put_count(0) , got_count(0) , released(0) diff --git a/rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp b/rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp index ba05527e58..973c1dff2b 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellPngDec.cpp @@ -77,13 +77,13 @@ s64 pngDecOpen( stream->fd = 0; stream->src = *src; - switch (src->srcSelect.ToLE()) + switch ((u32)src->srcSelect.ToBE()) { - case CELL_PNGDEC_BUFFER: + case se32(CELL_PNGDEC_BUFFER): stream->fileSize = src->streamSize.ToLE(); break; - case CELL_PNGDEC_FILE: + case se32(CELL_PNGDEC_FILE): // Get file descriptor vm::var> fd; int ret = cellFsOpen(vm::ptr::make(src->fileName.addr()), 0, fd, vm::ptr::make(0), 0); @@ -145,7 +145,7 @@ s64 pngReadHeader( auto buffer_32 = buffer.To>(); vm::var> pos, nread; - switch (stream->src.srcSelect.ToBE()) + switch ((u32)stream->src.srcSelect.ToBE()) { case se32(CELL_PNGDEC_BUFFER): memmove(buffer.begin(), stream->src.streamPtr.get_ptr(), buffer.size()); @@ -206,17 +206,21 @@ s64 pngDecSetParameter( current_outParam.outputHeight = current_info.imageHeight; current_outParam.outputColorSpace = inParam->outputColorSpace; - switch ((u32)current_outParam.outputColorSpace) + switch ((u32)current_outParam.outputColorSpace.ToBE()) { - case CELL_PNGDEC_PALETTE: - case CELL_PNGDEC_GRAYSCALE: current_outParam.outputComponents = 1; break; + case se32(CELL_PNGDEC_PALETTE): + case se32(CELL_PNGDEC_GRAYSCALE): + current_outParam.outputComponents = 1; break; - case CELL_PNGDEC_GRAYSCALE_ALPHA: current_outParam.outputComponents = 2; break; + case se32(CELL_PNGDEC_GRAYSCALE_ALPHA): + current_outParam.outputComponents = 2; break; - case CELL_PNGDEC_RGB: current_outParam.outputComponents = 3; break; + case se32(CELL_PNGDEC_RGB): + current_outParam.outputComponents = 3; break; - case CELL_PNGDEC_RGBA: - case CELL_PNGDEC_ARGB: current_outParam.outputComponents = 4; break; + case se32(CELL_PNGDEC_RGBA): + case se32(CELL_PNGDEC_ARGB): + current_outParam.outputComponents = 4; break; default: cellPngDec->Error("pngDecSetParameter: Unsupported color space (%d)", current_outParam.outputColorSpace.ToLE()); @@ -250,7 +254,7 @@ s64 pngDecodeData( vm::var png((u32)fileSize); vm::var> pos, nread; - switch (stream->src.srcSelect.ToBE()) + switch ((u32)stream->src.srcSelect.ToBE()) { case se32(CELL_PNGDEC_BUFFER): memmove(png.begin(), stream->src.streamPtr.get_ptr(), png.size()); @@ -279,10 +283,10 @@ s64 pngDecodeData( const int bytesPerLine = (u32)dataCtrlParam->outputBytesPerLine; uint image_size = width * height; - switch ((u32)current_outParam.outputColorSpace) + switch ((u32)current_outParam.outputColorSpace.ToBE()) { - case CELL_PNGDEC_RGB: - case CELL_PNGDEC_RGBA: + case se32(CELL_PNGDEC_RGB): + case se32(CELL_PNGDEC_RGBA): { const char nComponents = current_outParam.outputColorSpace == CELL_PNGDEC_RGBA ? 4 : 3; image_size *= nComponents; @@ -300,10 +304,10 @@ s64 pngDecodeData( { memcpy(data.get_ptr(), image.get(), image_size); } - } break; + } - case CELL_PNGDEC_ARGB: + case se32(CELL_PNGDEC_ARGB): { const int nComponents = 4; image_size *= nComponents; @@ -342,12 +346,12 @@ s64 pngDecodeData( memcpy(data.get_ptr(), img, image_size); delete[] img; } - } break; + } - case CELL_PNGDEC_GRAYSCALE: - case CELL_PNGDEC_PALETTE: - case CELL_PNGDEC_GRAYSCALE_ALPHA: + case se32(CELL_PNGDEC_GRAYSCALE): + case se32(CELL_PNGDEC_PALETTE): + case se32(CELL_PNGDEC_GRAYSCALE_ALPHA): cellPngDec->Error("pngDecodeData: Unsupported color space (%d)", current_outParam.outputColorSpace.ToLE()); break; diff --git a/rpcs3/Emu/SysCalls/Modules/cellSpurs.cpp b/rpcs3/Emu/SysCalls/Modules/cellSpurs.cpp index 744e39e35d..9de4374ca3 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellSpurs.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellSpurs.cpp @@ -2441,7 +2441,7 @@ s64 _cellSpursTasksetAttribute2Initialize(vm::ptr at return GetCurrentPPUThread().FastCall2(libsre + 0x1474C, libsre_rtoc); #else attribute->revision = revision; - attribute->name_addr = NULL; + attribute->name_addr = 0; attribute->argTaskset = 0; for (s32 i = 0; i < 8; i++) @@ -2554,7 +2554,7 @@ s64 _cellSpursTaskAttribute2Initialize(vm::ptr attribut #else attribute->revision = revision; attribute->sizeContext = 0; - attribute->eaContext = NULL; + attribute->eaContext = 0; for (s32 c = 0; c < 4; c++) { diff --git a/rpcs3/Emu/SysCalls/SyncPrimitivesManager.cpp b/rpcs3/Emu/SysCalls/SyncPrimitivesManager.cpp index b8212d285a..349e9782fe 100644 --- a/rpcs3/Emu/SysCalls/SyncPrimitivesManager.cpp +++ b/rpcs3/Emu/SysCalls/SyncPrimitivesManager.cpp @@ -67,6 +67,7 @@ std::string SyncPrimManager::GetSyncPrimName(u32 id, IDType type) } break; } + default: break; } LOG_ERROR(GENERAL, "SyncPrimManager::GetSyncPrimName(id=%d, type=%d) failed", id, type);