03-20-2012, 08:29 AM
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
03-20-2012, 08:42 AM
03-20-2012, 08:42 AM
Are you applying with tgit or using patch from the cli?
03-20-2012, 08:56 AM
(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.
03-20-2012, 09:23 AM
This patch is for some reason not in git patch format, it applies with the patch utility:
Here's the patch in the correct format. Be sure to change the copyright notice as needed.
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.hHere'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.903-20-2012, 10:19 AM
Thanks
Imma try it (hope neobrain doesn't mind
)
Edit: Now I get this: "fatal: corrupt patch at line 11"
Imma try it (hope neobrain doesn't mind
)Edit: Now I get this: "fatal: corrupt patch at line 11"
03-22-2012, 11:04 AM
Randomly I made a twitter (I know I'm crazy) so you can follow me when I post a build/youtube video 
https://twitter.com/#!/extremedude1

https://twitter.com/#!/extremedude1
03-26-2012, 12:55 AM
Well I couldn't get dolphin to compile and stupid me forgot to copy the log soz >.>
04-02-2012, 01:22 AM
04-08-2012, 11:49 PM