예제 #1
0
        private int BuildClipPlanesImpl(RwCamera *rwCamera)
        {
            if (rwCamera == (void *)0)
            {
                return(BuildClipPlanesHook.OriginalFunction(rwCamera));
            }

            // Get window client size dimensions.
            var windowHandle = Variables.WindowHandle;

            if (!windowHandle.IsNull)
            {
                // Get current resolution (size of window client area)
                RECT clientSize = new RECT();
                User32_Gdi.GetClientRect(Variables.WindowHandle, ref clientSize);

                float aspectRatio         = AspectConverter.ToAspectRatio(ref clientSize);
                float relativeAspectRatio = AspectConverter.GetRelativeAspect(aspectRatio);

                // Stretch X/Y
                (*rwCamera).StretchViewWindow(aspectRatio, relativeAspectRatio, AspectRatioLimit);

                // Call original.
                int result = BuildClipPlanesHook.OriginalFunction(rwCamera);

                // Reverse Stretch of X/Y
                (*rwCamera).UnStretchViewWindow(aspectRatio, relativeAspectRatio, AspectRatioLimit);
                return(result);
            }

            return(BuildClipPlanesHook.OriginalFunction(rwCamera));
        }
예제 #2
0
        /* Patching Resolution Changes Section */
        private void OnLocationChange(User32.HWINEVENTHOOK hWinEventHook, uint winEvent, HWND hWnd, int idObject, int idChild, uint idEventThread, uint dwmsEventTime)
        {
            if (idObject != 0 || idChild != 0)
            {
                return;
            }

            if (winEvent == EventObjectLocationchange)
            {
                // Two things performed here.
                RECT rect = new RECT();
                User32_Gdi.GetClientRect(Variables.WindowHandle, ref rect);

                Patch(rect.Width, rect.Height);
            }
        }
예제 #3
0
        private void SetViewWindowImpl(RwCamera *rwCamera, RwView *view)
        {
            SetViewWindowHook.OriginalFunction(rwCamera, view);

            var windowHandle = Variables.WindowHandle;

            if (!windowHandle.IsNull)
            {
                // Get current resolution (size of window client area)
                RECT clientSize = new RECT();
                User32_Gdi.GetClientRect(Variables.WindowHandle, ref clientSize);

                float aspectRatio         = AspectConverter.ToAspectRatio(ref clientSize);
                float relativeAspectRatio = AspectConverter.GetRelativeAspect(aspectRatio);

                // Unstretch X/Y
                (*rwCamera).UnStretchRecipViewWindow(aspectRatio, relativeAspectRatio, AspectRatioLimit);
            }
        }
예제 #4
0
        /* Patching Resolution Changes Section */
        private void OnLocationChange(User32.HWINEVENTHOOK hWinEventHook, uint winEvent, HWND hWnd, int idObject, int idChild, uint idEventThread, uint dwmsEventTime)
        {
            if (idObject != 0 || idChild != 0)
            {
                return;
            }

            if (winEvent == EventObjectLocationchange)
            {
                // Two things performed here.
                RECT rect = new RECT();
                User32_Gdi.GetClientRect(Variables.WindowHandle, ref rect);
                CurrentHeight       = rect.Height;
                CurrentWidth        = rect.Width;
                ActualAspectRatio   = CurrentWidth / (float)CurrentHeight;
                RelativeAspectRatio = AspectConverter.GetRelativeAspect(ActualAspectRatio);

                Resized?.Invoke(this);
            }
        }