Dolphin, the GameCube and Wii emulator - Forums

Full Version: Dolphin builds by ExtremeDude2, updated weekly, currently at 3.5-368 [Stopped]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
*phew*
..
Don't you just have to apply the patch via tgit or w/e and compile?
(03-20-2012, 08:29 AM)neobrain Wrote: [ -> ]*phew*
..
Don't you just have to apply the patch via tgit or w/e and compile?

(03-20-2012, 05:31 AM)ExtremeDude2 Wrote: [ -> ]Edit 2: I keep getting a "Patch format detection failed" error.
Are you applying with tgit or using patch from the cli?
(03-20-2012, 08:42 AM)neobrain Wrote: [ -> ]Are you applying with tgit or using patch from the cli?

I assume you mean tortoisegit, if so yes.
This patch is for some reason not in git patch format, it applies with the patch utility:
Code:
sven@linuxbox ~/S/dolphin-emu> cat scale.patch |patch -p1
patching file Source/Core/VideoCommon/Src/RenderBase.cpp
patching file Source/Core/VideoCommon/Src/RenderBase.h

Here's the patch in the correct format. Be sure to change the copyright notice as needed.
Code:
From 936fad8aefd8afbf810a499c0fc9da8058f8acfd Mon Sep 17 00:00:00 2001
From: CHANGE ME
Date: Tue, 20 Mar 2012 00:21:40 +0100
Subject: [PATCH] re-format the scale patch

---
Source/Core/VideoCommon/Src/RenderBase.cpp |   68 ++++++++++++++++------------
Source/Core/VideoCommon/Src/RenderBase.h   |   13 +++--
2 files changed, 47 insertions(+), 34 deletions(-)

diff --git a/Source/Core/VideoCommon/Src/RenderBase.cpp b/Source/Core/VideoCommon/Src/RenderBase.cpp
index 3b06bbb..f4c5f1c 100644
--- a/Source/Core/VideoCommon/Src/RenderBase.cpp
+++ b/Source/Core/VideoCommon/Src/RenderBase.cpp
@@ -61,6 +61,8 @@ volatile bool Renderer::s_bScreenshot;
// The framebuffer size
int Renderer::s_target_width;
int Renderer::s_target_height;
+float Renderer::s_target_xscale;
+float Renderer::s_target_yscale;

// TODO: Add functionality to reinit all the render targets when the window is resized.
int Renderer::s_backbuffer_width;
@@ -136,33 +138,33 @@ void Renderer::RenderToXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRect
    }
}

-void Renderer::CalculateTargetScale(int x, int y, int &scaledX, int &scaledY)
+void Renderer::CalculateTargetScale(float &scaleX, float &scaleY)
{
    switch (g_ActiveConfig.iEFBScale)
    {
        case 3: // 1.5x
-            scaledX = (x / 2) * 3;
-            scaledY = (y / 2) * 3;
+            scaleX = 1.5f;
+            scaleY = 1.5f;
            break;
        case 4: // 2x
-            scaledX = x * 2;
-            scaledY = y * 2;
+            scaleX = 2;
+            scaleY = 2;
            break;
        case 5: // 2.5x
-            scaledX = (x / 2) * 5;
-            scaledY = (y / 2) * 5;
+            scaleX = 2.5f;
+            scaleY = 2.5f;
            break;
        case 6: // 3x
-            scaledX = x * 3;
-            scaledY = y * 3;
+            scaleX = 3;
+            scaleY = 3;
            break;
        case 7: // 4x
-            scaledX = x * 4;
-            scaledY = y * 4;
+            scaleX = 4;
+            scaleY = 4;
            break;
        default:
-            scaledX = x;
-            scaledY = y;
+            scaleX = 1;
+            scaleY = 1;
            break;
    };
}
@@ -170,29 +172,32 @@ void Renderer::CalculateTargetScale(int x, int y, int &scaledX, int &scaledY)
// return true if target size changed
bool Renderer::CalculateTargetSize(int multiplier)
{
-    int newEFBWidth, newEFBHeight;
+    float newEFBWidth, newEFBHeight;
+    float newEFBXScale, newEFBYScale;
    switch (s_LastEFBScale)
    {
        case 0: // fractional
-            newEFBWidth = (int)(EFB_WIDTH * xScale);
-            newEFBHeight = (int)(EFB_HEIGHT * yScale);
+            newEFBXScale = xScale;
+            newEFBYScale = yScale;
            break;
        case 1: // integral
-            newEFBWidth = EFB_WIDTH * (int)ceilf(xScale);
-            newEFBHeight = EFB_HEIGHT * (int)ceilf(yScale);
+            newEFBXScale = ceilf(xScale);
+            newEFBYScale = ceilf(yScale);
            break;
        default:
-            CalculateTargetScale(EFB_WIDTH, EFB_HEIGHT, newEFBWidth, newEFBHeight);
+            CalculateTargetScale(newEFBXScale, newEFBYScale);
            break;
    }

-    newEFBWidth *= multiplier;
-    newEFBHeight *= multiplier;
+    newEFBXScale *= multiplier;
+    newEFBYScale *= multiplier;

-    if (newEFBWidth != s_target_width || newEFBHeight != s_target_height)
+    if (newEFBXScale != s_target_xscale || newEFBYScale != s_target_yscale)
    {
-        s_target_width  = newEFBWidth;
-        s_target_height = newEFBHeight;
+        s_target_xscale = newEFBXScale;
+        s_target_yscale = newEFBYScale;
+        s_target_width  = ceilf(EFB_WIDTH * s_target_xscale);
+        s_target_height = ceilf(EFB_HEIGHT * s_target_yscale);
        return true;
    }
    return false;
@@ -325,13 +330,13 @@ void Renderer::CalculateXYScale(const TargetRectangle& dst_rect)
        if (g_ActiveConfig.b3DVision)
        {
            // This works, yet the version in the else doesn't. No idea why.
-            xScale = (float)(s_backbuffer_width-1) / (float)(s_XFB_width-1);
-            yScale = (float)(s_backbuffer_height-1) / (float)(s_XFB_height-1);
+            xScale = (float)(s_backbuffer_width) / (float)(s_XFB_width);
+            yScale = (float)(s_backbuffer_height) / (float)(s_XFB_height);
        }
        else
        {
-            xScale = (float)(dst_rect.right - dst_rect.left - 1) / (float)(s_XFB_width-1);
-            yScale = (float)(dst_rect.bottom - dst_rect.top - 1) / (float)(s_XFB_height-1);
+            xScale = (float)(dst_rect.right - dst_rect.left) / (float)(s_XFB_width);
+            yScale = (float)(dst_rect.bottom - dst_rect.top) / (float)(s_XFB_height);
        }
    }
}
@@ -343,8 +348,13 @@ void Renderer::SetWindowSize(int width, int height)
    if (height < 1)
        height = 1;

+    float xscale;
+    float yscale;
+
    // Scale the window size by the EFB scale.
-    CalculateTargetScale(width, height, width, height);
+    CalculateTargetScale(xscale, yscale);
+    width = ceilf(width * xscale);
+    height = ceilf(height * yscale);

    Host_RequestRenderWindowSize(width, height);
}
diff --git a/Source/Core/VideoCommon/Src/RenderBase.h b/Source/Core/VideoCommon/Src/RenderBase.h
index e8d4c55..5a3dd66 100644
--- a/Source/Core/VideoCommon/Src/RenderBase.h
+++ b/Source/Core/VideoCommon/Src/RenderBase.h
@@ -86,12 +86,12 @@ public:
    virtual TargetRectangle ConvertEFBRectangle(const EFBRectangle& rc) = 0;

    // Use this to upscale native EFB coordinates to IDEAL internal resolution
-    static unsigned int EFBToScaledX(int x) { return x * GetTargetWidth() / EFB_WIDTH; }
-    static unsigned int EFBToScaledY(int y) { return y * GetTargetHeight() / EFB_HEIGHT; }
+    static unsigned int EFBToScaledX(int x) { return floorf(x * s_target_xscale + 0.5f); }
+    static unsigned int EFBToScaledY(int y) { return floorf(y * s_target_yscale + 0.5f); }

    // Floating point versions of the above - only use them if really necessary
-    static float EFBToScaledXf(float x) { return x * ((float)GetTargetWidth() / (float)EFB_WIDTH); }
-    static float EFBToScaledYf(float y) { return y * ((float)GetTargetHeight() / (float)EFB_HEIGHT); }
+    static float EFBToScaledXf(float x) { return x * s_target_xscale; }
+    static float EFBToScaledYf(float y) { return y * s_target_yscale; }

    // Random utilities
    static void SetScreenshot(const char *filename);
@@ -132,7 +132,7 @@ public:

protected:

-    static void CalculateTargetScale(int x, int y, int &scaledX, int &scaledY);
+    static void CalculateTargetScale(float &scaleX, float &scaleY);
    static bool CalculateTargetSize(int multiplier = 1);
    static void CalculateXYScale(const TargetRectangle& dst_rect);

@@ -155,6 +155,9 @@ protected:
    static int s_target_width;
    static int s_target_height;

+    static float s_target_xscale;
+    static float s_target_yscale;
+
    // TODO: Add functionality to reinit all the render targets when the window is resized.
    static int s_backbuffer_width;
    static int s_backbuffer_height;
--
1.7.9
Thanks Big Grin Imma try it (hope neobrain doesn't mind Big Grin)

Edit: Now I get this: "fatal: corrupt patch at line 11"
Randomly I made a twitter (I know I'm crazy) so you can follow me when I post a build/youtube video Big Grin

https://twitter.com/#!/extremedude1
Well I couldn't get dolphin to compile and stupid me forgot to copy the log soz >.>