From b072cbca93e9a0bded032fc79c678308d6875a58 Mon Sep 17 00:00:00 2001 From: aap Date: Mon, 29 Jun 2020 12:12:52 +0200 Subject: [PATCH 1/3] cleanup --- src/render/MBlur.cpp | 12 ++++++------ src/render/MBlur.h | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/render/MBlur.cpp b/src/render/MBlur.cpp index 0ab9e8df..f2b94848 100644 --- a/src/render/MBlur.cpp +++ b/src/render/MBlur.cpp @@ -188,31 +188,31 @@ CMBlur::CreateImmediateModeData(RwCamera *cam, RwRect *rect) } void -CMBlur::MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blur, int32 type, uint32 addalpha) +CMBlur::MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blur, int32 type, uint32 bluralpha) { RwRGBA color = { (RwUInt8)red, (RwUInt8)green, (RwUInt8)blue, (RwUInt8)blur }; #ifdef GTA_PS2 if( pFrontBuffer ) - OverlayRender(cam, pFrontBuffer, color, type, addalpha); + OverlayRender(cam, pFrontBuffer, color, type, bluralpha); #else if(BlurOn){ if(pFrontBuffer){ if(ms_bJustInitialised) ms_bJustInitialised = false; else - OverlayRender(cam, pFrontBuffer, color, type, addalpha); + OverlayRender(cam, pFrontBuffer, color, type, bluralpha); } RwRasterPushContext(pFrontBuffer); RwRasterRenderFast(RwCameraGetRaster(cam), 0, 0); RwRasterPopContext(); }else{ - OverlayRender(cam, nil, color, type, addalpha); + OverlayRender(cam, nil, color, type, bluralpha); } #endif } void -CMBlur::OverlayRender(RwCamera *cam, RwRaster *raster, RwRGBA color, int32 type, uint32 addalpha) +CMBlur::OverlayRender(RwCamera *cam, RwRaster *raster, RwRGBA color, int32 type, int32 bluralpha) { int r, g, b, a; @@ -281,7 +281,7 @@ CMBlur::OverlayRender(RwCamera *cam, RwRaster *raster, RwRGBA color, int32 type, RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA); RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, Vertex, 4, Index, 6); - a = addalpha/2; + a = bluralpha/2; if(a < 30) a = 30; diff --git a/src/render/MBlur.h b/src/render/MBlur.h index 157f2882..e2e5d38c 100644 --- a/src/render/MBlur.h +++ b/src/render/MBlur.h @@ -12,6 +12,6 @@ public: static RwBool MotionBlurOpen(RwCamera *cam); static RwBool MotionBlurClose(void); static void CreateImmediateModeData(RwCamera *cam, RwRect *rect); - static void MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blur, int32 type, uint32 addalpha); - static void OverlayRender(RwCamera *cam, RwRaster *raster, RwRGBA color, int32 type, uint32 bluralpha); + static void MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blur, int32 type, uint32 bluralpha); + static void OverlayRender(RwCamera *cam, RwRaster *raster, RwRGBA color, int32 type, int32 bluralpha); }; From 6d396ba73b8954bd44df9e1700ee1a5815956428 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Tue, 30 Jun 2020 07:43:20 +0300 Subject: [PATCH 2/3] Fix MBlur --- src/render/MBlur.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/render/MBlur.cpp b/src/render/MBlur.cpp index f2b94848..fe30ee0b 100644 --- a/src/render/MBlur.cpp +++ b/src/render/MBlur.cpp @@ -1,5 +1,9 @@ #define WITHWINDOWS +#define WITHD3D #include "common.h" +#ifndef LIBRW +#include +#endif #include "RwHelper.h" #include "Camera.h" @@ -15,6 +19,9 @@ bool CMBlur::BlurOn; static RwIm2DVertex Vertex[4]; static RwImVertexIndex Index[6] = { 0, 1, 2, 0, 2, 3 }; +#ifndef LIBRW +extern "C" D3DCAPS8 _RwD3D8DeviceCaps; +#endif RwBool CMBlur::MotionBlurOpen(RwCamera *cam) { @@ -62,12 +69,11 @@ CMBlur::MotionBlurOpen(RwCamera *cam) if(BlurOn) { - int32 width = Pow(2.0f, int32(log2(RwRasterGetWidth (RwCameraGetRaster(cam))))+1); - int32 height = Pow(2.0f, int32(log2(RwRasterGetHeight(RwCameraGetRaster(cam))))+1); - int32 depth = RwRasterGetDepth(RwCameraGetRaster(cam)); + uint32 width = Pow(2.0f, int32(log2(RwRasterGetWidth (RwCameraGetRaster(cam))))+1); + uint32 height = Pow(2.0f, int32(log2(RwRasterGetHeight(RwCameraGetRaster(cam))))+1); + uint32 depth = RwRasterGetDepth(RwCameraGetRaster(cam)); #ifndef LIBRW - extern D3DCAPS8 _RwD3D8DeviceCaps; extern DWORD _dwMemTotalVideo; if ( _RwD3D8DeviceCaps.MaxTextureWidth >= width && _RwD3D8DeviceCaps.MaxTextureHeight >= height ) { From c80bdf3a2a898297eb385659288efca43d8b106b Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Tue, 30 Jun 2020 07:43:55 +0300 Subject: [PATCH 3/3] Rename IsAnyButtonPressed to CheckForInput --- src/core/Pad.cpp | 9 ++++----- src/core/Pad.h | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp index 9065c8ca..851625d2 100644 --- a/src/core/Pad.cpp +++ b/src/core/Pad.cpp @@ -344,15 +344,14 @@ void AltDodoCheat(void) #endif bool -CControllerState::IsAnyButtonPressed(void) +CControllerState::CheckForInput(void) { return !!RightStickX || !!RightStickY || !!LeftStickX || !!LeftStickY || !!DPadUp || !!DPadDown || !!DPadLeft || !!DPadRight || !!Triangle || !!Cross || !!Circle || !!Square || !!Start || !!Select || !!LeftShoulder1 || !!LeftShoulder2 || !!RightShoulder1 || !!RightShoulder2 - || !!LeftShock || !!RightShock - || !!NetworkTalk; + || !!LeftShock || !!RightShock; } void @@ -1074,7 +1073,7 @@ void CPad::UpdatePads(void) CapturePad(0); #endif #ifdef DETECT_PAD_INPUT_SWITCH - if (GetPad(0)->PCTempJoyState.IsAnyButtonPressed()) + if (GetPad(0)->PCTempJoyState.CheckForInput()) IsAffectedByController = true; else { #endif @@ -1084,7 +1083,7 @@ void CPad::UpdatePads(void) #ifdef DETECT_PAD_INPUT_SWITCH } - if (IsAffectedByController && (GetPad(0)->PCTempKeyState.IsAnyButtonPressed() || GetPad(0)->PCTempMouseState.IsAnyButtonPressed())) + if (IsAffectedByController && (GetPad(0)->PCTempKeyState.CheckForInput() || GetPad(0)->PCTempMouseState.CheckForInput())) IsAffectedByController = false; #endif diff --git a/src/core/Pad.h b/src/core/Pad.h index 6f20571f..8c3bc752 100644 --- a/src/core/Pad.h +++ b/src/core/Pad.h @@ -29,7 +29,7 @@ public: float GetRightStickX(void) { return RightStickX/32767.0f; }; float GetRightStickY(void) { return RightStickY/32767.0f; }; - bool IsAnyButtonPressed(); + bool CheckForInput(); void Clear(void); }; VALIDATE_SIZE(CControllerState, 0x2A);