Exemplo n.º 1
0
        private int TObjCameraInit(IntPtr thisPointer, int camLimit)
        {
            // Backup old resolution.
            var windowHandle = Variables.WindowHandle;

            if (!windowHandle.IsNull)
            {
                User32_Gdi.GetWindowRect(windowHandle, out var windowRect);
                int resolutionXBackup = windowRect.Width;
                int resolutionYBackup = windowRect.Height;

                // Get new resolution
                int greaterResolution = resolutionXBackup > resolutionYBackup ? resolutionXBackup : resolutionYBackup;
                AspectConverter.WidthToResolution(greaterResolution, AspectConverter.OriginalGameAspect, out var resolution);

                // Temp resize window and execute.
                User32_Gdi.MoveWindow(windowHandle, windowRect.left, windowRect.top, resolution.Width, resolution.Height, false);

                int result = _cameraInitHook.OriginalFunction(thisPointer, camLimit);

                // Restore window.
                User32_Gdi.MoveWindow(windowHandle, windowRect.left, windowRect.top, resolutionXBackup, resolutionYBackup, false);

                return(result);
            }

            return(_cameraInitHook.OriginalFunction(thisPointer, camLimit));
        }
Exemplo n.º 2
0
    private int DrawFullVideoFrameHookImpl(int ebx, float x, float y, float width, float height, int a5, float a6, float a7)
    {
        x = AspectConverter.GetBorderWidthX(ActualAspectRatio, CurrentHeight) / 2;
        y = AspectConverter.GetBorderHeightY(ActualAspectRatio, CurrentWidth) / 2;

        return(_drawFullVideoFrameHook.OriginalFunction(ebx, x, y, width, height, a5, a6, a7));
    }
Exemplo n.º 3
0
    private bool RenderPrimitiveImpl(int a1, char *a2, int a3)
    {
        // Get vertex buffer.
        bool shift = false;

        if (_shiftOrthographicProjection.Count > 0)
        {
            shift = _shiftOrthographicProjection.Dequeue();
        }

        if (shift || _shiftProjectionFlag)
        {
            var vertexBufferPtr             = *(VertexBufferSubmission **)0xAA5048;
            var vertexBufferSubmissionThing = vertexBufferPtr->SubmissionThing != (void *)0
                ? (*vertexBufferPtr).SubmissionThing
                : (VertexBufferSubmissionDetails *)Fun_GetVertexBufferSubmission.GetWrapper()();

            // Convert.ToInt32 performs rounding!
            var extraLeftBorder = (short)(Convert.ToInt32(AspectConverter.GetBorderWidthX(ActualAspectRatio, CurrentHeight) / 2));
            var extraTopBorder  = (short)(Convert.ToInt32(AspectConverter.GetBorderHeightY(ActualAspectRatio, CurrentWidth) / 2));

            vertexBufferSubmissionThing->X += extraLeftBorder;
            vertexBufferSubmissionThing->Y += extraTopBorder;

            // Execute
            var result = _renderPrimitiveHook.OriginalFunction(a1, a2, a3);

            vertexBufferSubmissionThing->X -= extraLeftBorder;
            vertexBufferSubmissionThing->Y -= extraTopBorder;
            return(result);
        }

        return(_renderPrimitiveHook.OriginalFunction(a1, a2, a3));
    }
Exemplo n.º 4
0
    private int BuildClipPlanesImpl(RwCamera *rwCamera)
    {
        if (rwCamera == (void *)0)
        {
            return(BuildClipPlanesHook.OriginalFunction(rwCamera));
        }

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

        if (windowHandle != IntPtr.Zero)
        {
            // Get current resolution (size of window client area)
            RECT clientSize = new RECT();
            User32.GetClientRect(Window.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));
    }
Exemplo n.º 5
0
        public RenderHooks(float aspectRatioLimit, IReloadedHooks hooks)
        {
            _memory                    = Memory.CurrentProcess;
            _aspectConverter           = new AspectConverter(aspectRatioLimit);
            _draw2PViewPortHook        = hooks.CreateHook <sub_422AF0>(Draw2PViewportHook, 0x422AF0).Activate();
            _drawSpecialStageGaugeHook = hooks.CreateHook <sub_5263C0>(DrawSpecialStageGaugeImpl, 0x5263C0).Activate();
            _drawSpecialStageBarHook   = hooks.CreateHook <sub_526280>(DrawSpecialStageBarImpl, 0x526280, 0xD).Activate();
            _draw2PStatusHook          = hooks.CreateHook <sub_422A70>(Draw2pStatusImpl, 0x422A70).Activate();
            _renderPrimitiveHook       = hooks.CreateHook <_rwD3D8Im2DRenderPrimitive>(RenderPrimitiveImpl, 0x00662B00).Activate();
            _renderVideoHook           = hooks.CreateHook <sub_644450>(RenderVideoHookImpl, 0x644450).Activate();
            _drawFullVideoFrameHook    = hooks.CreateHook <DrawFullVideoFrame>(DrawFullVideoFrameHookImpl, 0x0042A100).Activate();
            _drawSmallVideoFrameHook   = hooks.CreateHook <DrawSmallFrame>(DrawSmallFrameImpl, 0x00429F80).Activate();
            _drawTitlecardElementsHook = hooks.CreateHook <sub_442850>(DrawTitlecardElementsImpl, 0x442850).Activate();
            _drawSpecialStageLinkHook  = hooks.CreateHook <sub_526F60>(DrawSpecialStageLinkImpl, 0x526F60).Activate();
            _getVertexBufferSubmission = hooks.CreateWrapper <sub_651E20>(0x651E20, out _);
            _drawNowLoadingHook        = hooks.CreateHook <sub_44EAC0>(DrawNowLoadingImpl, 0x44EAC0).Activate();
            _executeCreditsHook        = hooks.CreateHook <sub_4545F0>(ExecuteCredits, 0x4545F0).Activate();
            _drawResultScreenDotsHook  = hooks.CreateHook <sub_438A90>(DrawResultScreenDotsImpl, 0x438A90).Activate();
            _drawPowerupBoxHook        = hooks.CreateHook <DrawPowerupBox>(DrawPowerupBoxImpl, 0x479AB0).Activate();

            _drawEmeraldHookReverseWrap = hooks.CreateReverseWrapper <DrawEmeraldHook>(DrawSpecialStageEmeraldImpl);
            _addressOfHook = new Pinnable <IntPtr>(_drawEmeraldHookReverseWrap.WrapperPointer);
            _drawSpecialStageEmeraldIndicatorHook = hooks.CreateAsmHook(new[] {
                "use32",    // Offset to first param (after execution of code)
                "push eax", // + 8
                "push esi", // + 12
                "push ecx", // + 16
                "push edx", // + 20

                /* Push address of stack parameters up stack. */
                "lea edx, [esp + 32]",
                "lea ecx, [esp + 28]",
                "lea ebx, [esp + 24]",
                "lea eax, [esp + 20]",
                "push edx",
                "push ecx",
                "push ebx",
                "push eax",

                $"call dword [0x{(long)_addressOfHook.Pointer:X}]",
                "add esp, 16",

                "pop edx",
                "pop ecx",
                "pop esi",
                "pop eax"
            }, 0x458920).Activate();


            _memory.ChangePermission((IntPtr)_descriptionX, sizeof(void *), Kernel32.MEM_PROTECTION.PAGE_EXECUTE_READWRITE);
            _memory.ChangePermission((IntPtr)_descriptionY, sizeof(void *), Kernel32.MEM_PROTECTION.PAGE_EXECUTE_READWRITE);
            _memory.ChangePermission((IntPtr)_descriptionWidth, sizeof(void *), Kernel32.MEM_PROTECTION.PAGE_EXECUTE_READWRITE);
            _memory.ChangePermission((IntPtr)_descriptionHeight, sizeof(void *), Kernel32.MEM_PROTECTION.PAGE_EXECUTE_READWRITE);
            _memory.ChangePermission((IntPtr)_pickupBoxSeparation, sizeof(void *), Kernel32.MEM_PROTECTION.PAGE_EXECUTE_READWRITE);
            _memory.ChangePermission((IntPtr)_dotsVertSeparation, sizeof(void *), Kernel32.MEM_PROTECTION.PAGE_EXECUTE_READWRITE);
            _memory.ChangePermission((IntPtr)_dotsHorzSeparation, sizeof(void *), Kernel32.MEM_PROTECTION.PAGE_EXECUTE_READWRITE);
            _memory.ChangePermission((IntPtr)_dotsHeight, sizeof(void *), Kernel32.MEM_PROTECTION.PAGE_EXECUTE_READWRITE);
            _memory.ChangePermission((IntPtr)_dotsWidth, sizeof(void *), Kernel32.MEM_PROTECTION.PAGE_EXECUTE_READWRITE);
        }
Exemplo n.º 6
0
 private int DrawSpecialStageBarImpl(int preserveEax, float x, float y, float width, float height)
 {
     return(_drawSpecialStageBarHook.OriginalFunction(preserveEax,
                                                      AspectConverter.ProjectFromOldToNewCanvasX(x, RelativeAspectRatio, ActualAspectRatio),
                                                      AspectConverter.ProjectFromOldToNewCanvasY(y, RelativeAspectRatio, ActualAspectRatio),
                                                      AspectConverter.ScaleByRelativeAspectX(width, RelativeAspectRatio, ActualAspectRatio),
                                                      AspectConverter.ScaleByRelativeAspectY(height, RelativeAspectRatio, ActualAspectRatio)));
 }
Exemplo n.º 7
0
 private void *DrawSpecialStageEmeraldImpl(void *preserveEax, void *preserveEsi, float x, float y, float width, float height)
 {
     x      = AspectConverter.ProjectFromOldToNewCanvasX(x, RelativeAspectRatio, ActualAspectRatio);
     y      = AspectConverter.ProjectFromOldToNewCanvasY(y, RelativeAspectRatio, ActualAspectRatio);
     width  = AspectConverter.ScaleByRelativeAspectX(width, RelativeAspectRatio, ActualAspectRatio);
     height = AspectConverter.ScaleByRelativeAspectY(height, RelativeAspectRatio, ActualAspectRatio);
     return(_drawSpecialStageEmeraldHook.OriginalFunction(preserveEax, preserveEsi, x, y, width, height));
 }
Exemplo n.º 8
0
 private int Draw2pStatusImpl(int preserveEax, float x, float y, float width, float height)
 {
     _shiftOrthographicProjection.Enqueue(true);
     return(_draw2PStatusHook.OriginalFunction(preserveEax,
                                               AspectConverter.ScaleByRelativeAspectX(x, RelativeAspectRatio, ActualAspectRatio),
                                               AspectConverter.ScaleByRelativeAspectY(y, RelativeAspectRatio, ActualAspectRatio),
                                               AspectConverter.ScaleByRelativeAspectX(width, RelativeAspectRatio, ActualAspectRatio),
                                               AspectConverter.ScaleByRelativeAspectY(height, RelativeAspectRatio, ActualAspectRatio)));
 }
Exemplo n.º 9
0
 private int DrawSpecialStageGaugeImpl(int preserveEax, float x, float y, float width, float height, int a5, int a6, int a7, float a8, float a9)
 {
     return(_drawSpecialStageGaugeHook.OriginalFunction(preserveEax,
                                                        AspectConverter.ProjectFromOldToNewCanvasX(x, RelativeAspectRatio, ActualAspectRatio),
                                                        AspectConverter.ProjectFromOldToNewCanvasY(y, RelativeAspectRatio, ActualAspectRatio),
                                                        AspectConverter.ScaleByRelativeAspectX(width, RelativeAspectRatio, ActualAspectRatio),
                                                        AspectConverter.ScaleByRelativeAspectY(height, RelativeAspectRatio, ActualAspectRatio),
                                                        a5, a6, a7, a8, a9));
 }
    /// <summary>
    /// Returns the extra height added by the top and bottom borders extending before the 4:3 aspect.
    /// </summary>
    public float GetBorderHeightY(float actualAspect, float width)
    {
        if (actualAspect < AspectRatioLimit)
        {
            AspectConverter.WidthToResolution((int)width, actualAspect, out Resolution resolutionOurAspect);
            AspectConverter.WidthToResolution((int)width, AspectConverter.OriginalGameAspect, out Resolution resolutionGameAspect);

            return(resolutionOurAspect.Height - resolutionGameAspect.Height);
        }

        return(0);
    }
    /// <summary>
    /// Returns the extra width added by the left and right borders extending beyond the 4:3 aspect.
    /// </summary>
    public float GetBorderWidthX(float actualAspect, float height)
    {
        if (actualAspect > AspectRatioLimit)
        {
            AspectConverter.HeightToResolution((int)height, actualAspect, out Resolution resolutionOurAspect);
            AspectConverter.HeightToResolution((int)height, AspectConverter.OriginalGameAspect, out Resolution resolutionGameAspect);

            return(resolutionOurAspect.Width - resolutionGameAspect.Width);
        }

        return(0);
    }
    /// <summary>
    /// Used for shifting item locations of an orthographic projection (e.g. special stage HUD)
    /// that are relative to the left edge of the screen.
    /// Note: Assumes resolution is 640x480.
    /// </summary>
    /// <param name="originalPosition">Original position of the object.</param>
    /// <param name="relativeAspectRatio">Relative aspect ratio of the desired aspect compared to game's aspect.</param>
    /// <param name="actualAspect">The desired aspect ratio.</param>
    public float ProjectFromOldToNewCanvasX(float originalPosition, float relativeAspectRatio, float actualAspect)
    {
        if (actualAspect > AspectRatioLimit)
        {
            // Now the projection is the right size, however it is not centered to our screen.
            AspectConverter.HeightToResolution((int)GameCanvasHeight, actualAspect, out Resolution resolution); // Get resolution with our aspect equal to the height.
            float borderWidth            = resolution.Width - GameCanvasWidth;                                  // Get the extra width (left and right border)
            float leftBorderOnly         = (borderWidth / 2);                                                   // We only want left border.
            float originalPlusLeftBorder = leftBorderOnly + originalPosition;

            return(originalPlusLeftBorder / relativeAspectRatio);
        }

        return(originalPosition);
    }
    /// <summary>
    /// Used for shifting item locations of an orthographic projection (e.g. special stage HUD)
    /// that are relative to the top edge of the screen.
    /// Note: Assumes resolution is 640x480.
    /// </summary>
    /// <param name="originalPosition">Original position of the object.</param>
    /// <param name="relativeAspectRatio">Relative aspect ratio of the desired aspect compared to game's aspect.</param>
    /// <param name="actualAspect">The desired aspect ratio.</param>
    public float ProjectFromOldToNewCanvasY(float originalPosition, float relativeAspectRatio, float actualAspect)
    {
        if (actualAspect < AspectRatioLimit)
        {
            // Now the projection is the right size, however it is not centered to our screen.
            AspectConverter.WidthToResolution((int)GameCanvasWidth, actualAspect, out Resolution resolution); // Get resolution with our aspect equal to the height.
            float borderHeight          = resolution.Height - GameCanvasHeight;                               // Get the extra height (top and bottom border)
            float topBorderOnly         = (borderHeight / 2);                                                 // We only want top border.
            float originalPlusTopBorder = topBorderOnly + originalPosition;                                   // Our top border is in the aspect ratio it originated from,
            // we need to scale it to the new ratio.

            return(originalPlusTopBorder * relativeAspectRatio);
        }

        return(originalPosition);
    }
Exemplo n.º 14
0
    private int DrawTitlecardElementsImpl(int thisPtr)
    {
        *   _descriptionWidth  = AspectConverter.ScaleByRelativeAspectX(DefaultMissionDescriptionWidth, RelativeAspectRatio, ActualAspectRatio);
        *   _descriptionHeight = AspectConverter.ScaleByRelativeAspectY(DefaultMissionDescriptionHeight, RelativeAspectRatio, ActualAspectRatio);
        var additionalBorderX  = AspectConverter.GetBorderWidthX(ActualAspectRatio, AspectConverter.GameCanvasHeight) / 2F / AspectConverter.GameCanvasWidth;
        var additionalBorderY  = AspectConverter.GetBorderHeightY(ActualAspectRatio, AspectConverter.GameCanvasWidth) / 2F / AspectConverter.GameCanvasHeight;

        *_descriptionX = AspectConverter.ScaleByRelativeAspectX(DefaultMissionDescriptionX, RelativeAspectRatio, ActualAspectRatio) + AspectConverter.ScaleByRelativeAspectX(additionalBorderX, RelativeAspectRatio, ActualAspectRatio);
        *_descriptionY = AspectConverter.ScaleByRelativeAspectY(DefaultMissionDescriptionY, RelativeAspectRatio, ActualAspectRatio) + AspectConverter.ScaleByRelativeAspectY(additionalBorderY, RelativeAspectRatio, ActualAspectRatio);;

        var retVal = ExecuteWithScaleResolution(() => _drawTitlecardElementsHook.OriginalFunction(thisPtr));

        *_descriptionWidth  = DefaultMissionDescriptionWidth;
        *_descriptionHeight = DefaultMissionDescriptionHeight;
        *_descriptionX      = DefaultMissionDescriptionX;
        *_descriptionY      = DefaultMissionDescriptionY;

        return(retVal);
    }
Exemplo n.º 15
0
    private void SetViewWindowImpl(RwCamera *rwCamera, RwView *view)
    {
        SetViewWindowHook.OriginalFunction(rwCamera, view);

        var windowHandle = Window.WindowHandle;

        if (windowHandle != IntPtr.Zero)
        {
            // Get current resolution (size of window client area)
            RECT clientSize = new RECT();
            User32.GetClientRect(Window.WindowHandle, ref clientSize);

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

            // Unstretch X/Y
            (*rwCamera).UnStretchRecipViewWindow(aspectRatio, relativeAspectRatio, AspectRatioLimit);
        }
    }
Exemplo n.º 16
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);
            }
        }
Exemplo n.º 17
0
    public RenderHooks(float aspectRatioLimit, Reloaded.Hooks.ReloadedII.Interfaces.IReloadedHooks hooks)
    {
        _memory         = Memory.CurrentProcess;
        AspectConverter = new AspectConverter(aspectRatioLimit);

        _draw2PViewPortHook          = Fun_DrawViewPorts.Hook(Draw2PViewportHook).Activate();
        _drawSpecialStageGaugeHook   = Fun_DrawSpecialStageGauge.Hook(DrawSpecialStageGaugeImpl).Activate();
        _drawSpecialStageBarHook     = Fun_DrawSpecialStageBar.Hook(DrawSpecialStageBarImpl).Activate();
        _draw2PStatusHook            = Fun_DrawTwoPlayerStatusBar.Hook(Draw2pStatusImpl).Activate();
        _renderPrimitiveHook         = Fun_D3D8Im2DRenderPrimitive.Hook(RenderPrimitiveImpl).Activate();
        _renderVideoHook             = Fun_RenderVideoFrame.Hook(RenderVideoHookImpl).Activate();
        _drawFullVideoFrameHook      = Fun_DrawFullVideoFrame.Hook(DrawFullVideoFrameHookImpl).Activate();
        _drawSmallVideoFrameHook     = Fun_DrawSmallFrame.Hook(DrawSmallFrameImpl).Activate();
        _drawTitlecardElementsHook   = Fun_DrawTitlecardElements.Hook(DrawTitlecardElementsImpl).Activate();
        _drawSpecialStageLinkHook    = Fun_DrawSpecialStageLinkText.Hook(DrawSpecialStageLinkImpl).Activate();
        _drawNowLoadingHook          = Fun_DrawNowLoading.Hook(DrawNowLoadingImpl).Activate();
        _executeCreditsHook          = Fun_TObjCreditsExecute.Hook(ExecuteCredits).Activate();
        _drawResultScreenDotsHook    = Fun_DrawResultScreenLevelupDotsAndSomeOtherElements.Hook(DrawResultScreenDotsImpl).Activate();
        _drawPowerupBoxHook          = Fun_DrawPowerupBox.Hook(DrawPowerupBoxImpl).Activate();
        _drawSpecialStageEmeraldHook = Fun_DrawSpecialStageEmeraldAndResultScreenGauge.Hook(DrawSpecialStageEmeraldImpl).Activate();

        // Change permissions for game code regions.
        _memory.ChangePermission((IntPtr)_descriptionX, sizeof(void *), MEM_PROTECTION.PAGE_EXECUTE_READWRITE);
        _memory.ChangePermission((IntPtr)_descriptionY, sizeof(void *), MEM_PROTECTION.PAGE_EXECUTE_READWRITE);
        _memory.ChangePermission((IntPtr)_descriptionWidth, sizeof(void *), MEM_PROTECTION.PAGE_EXECUTE_READWRITE);
        _memory.ChangePermission((IntPtr)_descriptionHeight, sizeof(void *), MEM_PROTECTION.PAGE_EXECUTE_READWRITE);
        _memory.ChangePermission((IntPtr)_pickupBoxSeparation, sizeof(void *), MEM_PROTECTION.PAGE_EXECUTE_READWRITE);
        _memory.ChangePermission((IntPtr)_dotsVertSeparation, sizeof(void *), MEM_PROTECTION.PAGE_EXECUTE_READWRITE);
        _memory.ChangePermission((IntPtr)_dotsHorzSeparation, sizeof(void *), MEM_PROTECTION.PAGE_EXECUTE_READWRITE);
        _memory.ChangePermission((IntPtr)_dotsHeight, sizeof(void *), MEM_PROTECTION.PAGE_EXECUTE_READWRITE);
        _memory.ChangePermission((IntPtr)_dotsWidth, sizeof(void *), MEM_PROTECTION.PAGE_EXECUTE_READWRITE);


        _memory.ChangePermission((IntPtr)_dotsVertSeparation, sizeof(float), MEM_PROTECTION.PAGE_EXECUTE_READWRITE);
        _memory.ChangePermission((IntPtr)_dotsHorzSeparation, sizeof(float), MEM_PROTECTION.PAGE_EXECUTE_READWRITE);
        _memory.ChangePermission((IntPtr)_dotsHeight, sizeof(float), MEM_PROTECTION.PAGE_EXECUTE_READWRITE);
        _memory.ChangePermission((IntPtr)_dotsWidth, sizeof(float), MEM_PROTECTION.PAGE_EXECUTE_READWRITE);
    }
 public ResolutionVariablePatcher(float aspectRatioLimit)
 {
     _aspectConverter = new AspectConverter(aspectRatioLimit);
 }
Exemplo n.º 19
0
        /// <summary>
        /// Patches, mostly hardcoded resolution variables.
        /// </summary>
        public void Patch(int width, int height)
        {
            float floatWidth  = width;
            float floatHeight = height;

            _currentHeight       = height;
            _currentWidth        = width;
            _actualAspectRatio   = width / (float)height;
            _relativeAspectRatio = AspectConverter.GetRelativeAspect(_actualAspectRatio);

            // Set game resolution variables.
            Variables.ResolutionX.SetValue(ref width);
            Variables.ResolutionY.SetValue(ref height);

            Variables.MaestroResolutionX.SetValue(ref floatWidth);
            Variables.MaestroResolutionY.SetValue(ref floatHeight);

            // Pickup boxes.
            float *pickupBoxSize       = (float *)0x78A240;
            float *pickupBoxSeparation = (float *)0x78A618;

            Memory.CurrentProcess.SafeWrite((IntPtr)pickupBoxSize, ScaleByRelativeAspectX(0.03750000149F, _relativeAspectRatio, _actualAspectRatio));
            Memory.CurrentProcess.SafeWrite((IntPtr)pickupBoxSeparation, ScaleByRelativeAspectX(52F, _relativeAspectRatio, _actualAspectRatio));

            // Stage description.
            float *descriptionX      = (float *)0x78A4EC;
            float *descriptionY      = (float *)0x78A4E8;
            float *descriptionWidth  = (float *)0x745F3C;
            float *descriptionHeight = (float *)0x78A4E4;

            Memory.CurrentProcess.SafeWrite((IntPtr)descriptionWidth, ScaleByRelativeAspectX(DefaultMissionDescriptionWidth, _relativeAspectRatio, _actualAspectRatio));
            Memory.CurrentProcess.SafeWrite((IntPtr)descriptionHeight, ScaleByRelativeAspectY(DefaultMissionDescriptionHeight, _relativeAspectRatio, _actualAspectRatio));

            // => This item is not adjusted horizontally/vertically because the function that
            // draws it cannot be made to set _shiftOrthographicProjection.Enqueue(true)
            // Reason it cannot is because Last story for some reason calls the function in the BG.
            float gameScaleX = DefaultMissionDescriptionX * GameCanvasWidth;
            float gameScaleY = DefaultMissionDescriptionY * GameCanvasHeight;

            gameScaleX = ProjectFromOldToNewCanvasX(gameScaleX, _relativeAspectRatio, _actualAspectRatio) / GameCanvasWidth;
            gameScaleY = ProjectFromOldToNewCanvasY(gameScaleY, _relativeAspectRatio, _actualAspectRatio) / GameCanvasHeight;

            Memory.CurrentProcess.SafeWrite((IntPtr)descriptionX, gameScaleX);
            Memory.CurrentProcess.SafeWrite((IntPtr)descriptionY, gameScaleY);

            // Result screen
            float *dotsPercentageX    = (float *)0x745BA8;
            float *dotsPercentageY    = (float *)0x745F40;
            float *dotsVertSeparation = (float *)0x78A504;
            float *dotsHorzSeparation = (float *)0x78A248;
            float *dotsHeight         = (float *)0x78A508;
            float *dotsWidth          = (float *)0x78A31C;

            float percentOffsetXFromCenter = 0.5F - DefaultResultScreenDotsPercentageX;
            float newPercentageX           = 0.5F - ScaleByRelativeAspectX(percentOffsetXFromCenter, _relativeAspectRatio, _actualAspectRatio);

            float percentOffsetYFromCenter = 0.5F - DefaultResultScreenDotsPercentageY;
            float newPercentageY           = 0.5F - ScaleByRelativeAspectY(percentOffsetYFromCenter, _relativeAspectRatio, _actualAspectRatio);

            Memory.CurrentProcess.SafeWrite((IntPtr)dotsPercentageX, newPercentageX);
            Memory.CurrentProcess.SafeWrite((IntPtr)dotsPercentageY, newPercentageY);
            Memory.CurrentProcess.SafeWrite((IntPtr)dotsVertSeparation, ScaleByRelativeAspectY(DefaultResultScreenDotsVerticalSeparation, _relativeAspectRatio, _actualAspectRatio));
            Memory.CurrentProcess.SafeWrite((IntPtr)dotsHorzSeparation, ScaleByRelativeAspectX(DefaultResultScreenDotsHorizontalSeparation, _relativeAspectRatio, _actualAspectRatio));
            Memory.CurrentProcess.SafeWrite((IntPtr)dotsHeight, ScaleByRelativeAspectY(DefaultResultScreenDotsHeight, _relativeAspectRatio, _actualAspectRatio));
            Memory.CurrentProcess.SafeWrite((IntPtr)dotsWidth, ScaleByRelativeAspectX(DefaultResultScreenDotsWidth, _relativeAspectRatio, _actualAspectRatio));

            // Font notes
            // MESSAGE STRUCT SIZE: 0x1B4
            // POINTER TO SINGLETON INSTANCE AT 0xA777C8

            // Since Donut will probably be hogging the disassembly for another year, I can't update anything.
            // Here's the relevant offsets from the old code before complete switch to hooks.

            #region Old Code

            // A. Scaling
            // If Aspect > Aspect Limit, Shrink X
            // If Aspect < Aspect Limit, Shrink Y
            // See: rwCamera Stretch/Unstretch

            // B: Projecting
            // Converting object coordinates of 640x480 orthographic projections
            // to new object coordinates of our resolution.

            // Special stage gauge outline.
            // Memory.CurrentProcess.SafeWrite((IntPtr)0x527407, ProjectFromOldToNewCanvasX(460, relativeAspectRatio, actualAspectRatio)); // X
            // Memory.CurrentProcess.SafeWrite((IntPtr)0x527402, ProjectFromOldToNewCanvasY(38, relativeAspectRatio, actualAspectRatio));  // Y
            // Memory.CurrentProcess.SafeWrite((IntPtr)0x5273FD, ScaleByRelativeAspectX(128, relativeAspectRatio, actualAspectRatio));     // Width
            // Memory.CurrentProcess.SafeWrite((IntPtr)0x5273F8, ScaleByRelativeAspectY(32, relativeAspectRatio, actualAspectRatio));      // Height

            // Special stage gauge outline: Split Screen 1P
            // Memory.CurrentProcess.SafeWrite((IntPtr)0x52743F, ProjectFromOldToNewCanvasX(170, relativeAspectRatio, actualAspectRatio)); // X
            // Memory.CurrentProcess.SafeWrite((IntPtr)0x52743A, ProjectFromOldToNewCanvasY(38, relativeAspectRatio, actualAspectRatio));  // Y
            // Memory.CurrentProcess.SafeWrite((IntPtr)0x527435, ScaleByRelativeAspectX(128, relativeAspectRatio, actualAspectRatio));     // Width
            // Memory.CurrentProcess.SafeWrite((IntPtr)0x527430, ScaleByRelativeAspectY(32, relativeAspectRatio, actualAspectRatio));      // Height

            // Special stage gauge outline: Split Screen 2P
            // Scaling here the character switcher rendered by perspective projection cannot be moved.
            // Memory.CurrentProcess.SafeWrite((IntPtr)0x527467, ScaleByRelativeAspectX(140, relativeAspectRatio, actualAspectRatio));     // X
            // Memory.CurrentProcess.SafeWrite((IntPtr)0x527462, ProjectFromOldToNewCanvasY(38, relativeAspectRatio, actualAspectRatio));  // Y
            // Memory.CurrentProcess.SafeWrite((IntPtr)0x52745D, ScaleByRelativeAspectX(128, relativeAspectRatio, actualAspectRatio));     // Width
            // Memory.CurrentProcess.SafeWrite((IntPtr)0x527458, ScaleByRelativeAspectY(32, relativeAspectRatio, actualAspectRatio));      // Height

            // Special gauge (actual gauge)
            // Memory.CurrentProcess.SafeWrite((IntPtr)0x5274A1, ProjectFromOldToNewCanvasX(640, relativeAspectRatio, actualAspectRatio)); // Calculating X
            // Memory.CurrentProcess.SafeWrite((IntPtr)0x5274AB, ProjectFromOldToNewCanvasX(547, relativeAspectRatio, actualAspectRatio)); // Calculating X
            // Memory.CurrentProcess.SafeWrite((IntPtr)0x5274B5, ProjectFromOldToNewCanvasX(507, relativeAspectRatio, actualAspectRatio)); // Calculating X

            // Memory.CurrentProcess.SafeWrite((IntPtr)0x5274BF, ProjectFromOldToNewCanvasX(467, relativeAspectRatio, actualAspectRatio)); // X 2P
            // Memory.CurrentProcess.SafeWrite((IntPtr)0x745AF8, ProjectFromOldToNewCanvasX(30, relativeAspectRatio, actualAspectRatio));  // X Offset

            #endregion
        }