summaryrefslogtreecommitdiff
path: root/Source/Plugins
diff options
context:
space:
mode:
authorsl1nk3.s <sl1nk3.s@gmail.com>2009-07-28 23:38:49 +0000
committersl1nk3.s <sl1nk3.s@gmail.com>2009-07-28 23:38:49 +0000
commitcaf152fdd09fe7eda2b797f41b3a18db87a6071d (patch)
tree192efc6b13567a88e24595503206fd14e2f68136 /Source/Plugins
parentc86d2e5129fc0ecffa647db457aa99d13230ea29 (diff)
Fix screenshot offset as well as screenshot aspect ratio, also use PNG instead of BMP thanks to issue 1186.
Fix for opening.bnr containing bad chars where the loop would stop when encountering one (fixes Rogue Leader description, which was using 0x0d and 0x0a) git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3899 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Plugins')
-rw-r--r--Source/Plugins/Plugin_DSP_HLE/Src/MailHandler.cpp2
-rw-r--r--Source/Plugins/Plugin_VideoDX9/Src/main.cpp2
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/Render.cpp70
-rw-r--r--Source/Plugins/Plugin_nJoy_SDL/Src/Rumble.cpp8
4 files changed, 33 insertions, 49 deletions
diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/MailHandler.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/MailHandler.cpp
index f54e67f06a..8dbb416dcc 100644
--- a/Source/Plugins/Plugin_DSP_HLE/Src/MailHandler.cpp
+++ b/Source/Plugins/Plugin_DSP_HLE/Src/MailHandler.cpp
@@ -58,7 +58,7 @@ u16 CMailHandler::ReadDSPMailboxLow()
Update();
- return(result);
+ return result;
}
return 0x00;
diff --git a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp
index 15d8951220..786cb0e7ff 100644
--- a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp
+++ b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp
@@ -320,7 +320,7 @@ HRESULT ScreenShot(const char *File)
RECT rect;
::GetWindowRect(EmuWindow::GetWnd(), &rect);
- if (FAILED(D3DXSaveSurfaceToFile(File, D3DXIFF_JPG, surf, NULL, &rect)))
+ if (FAILED(D3DXSaveSurfaceToFile(File, D3DXIFF_PNG, surf, NULL, &rect)))
{
surf->Release();
return S_FALSE;
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp
index fa3cb86003..3392dc6153 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp
@@ -1282,18 +1282,10 @@ void Renderer::SetScreenshot(const char *filename)
bool Renderer::SaveRenderTarget(const char *filename, int W, int H, int YOffset)
{
- // The height seemed to often be one less than the setting (but sometimes not),
- // perhaps the source is the (bpmem.copyTexSrcWH.y + 1) in BPStructs.cpp that I'm guessing
- // is there because of how some GL function works. But the buffer we are reading from here
- // seems to have the necessary pixels for a complete height so we use the complete height
- // from the settings.
- if (!(g_Config.bNativeResolution || g_Config.b2xResolution))
- sscanf(g_Config.iInternalRes, "%dx%d", &W, &H);
-
-
u8 *data = (u8 *)malloc(3 * W * H);
glPixelStorei(GL_PACK_ALIGNMENT, 1);
- glReadPixels(0, YOffset, W, H, GL_RGB, GL_UNSIGNED_BYTE, data);
+
+ glReadPixels(0, Renderer::GetTargetHeight() - H + YOffset, W, H, GL_RGB, GL_UNSIGNED_BYTE, data);
// Show failure message
if (glGetError() != GL_NO_ERROR)
@@ -1306,51 +1298,45 @@ bool Renderer::SaveRenderTarget(const char *filename, int W, int H, int YOffset)
FlipImageData(data, W, H);
#if defined(HAVE_WX) && HAVE_WX
+ //Enable support for PNG file type.
+ wxImage::AddHandler( new wxPNGHandler );
+
// Create wxImage
wxImage a(W, H, data);
- // ---------------------------------------------------------------------
- // To get past the problem of non-4:3 and non-16:9 native resolution pictures (for example
- // in RE1 some pictures have non-4:3 resolutions like 640 x 448 and 512 x 448 and such that
- // are meant to be rescaled to 4:3, and most Wii games use 640 x 480 even for the 16:9 mode)
- // we let the user use the keep aspect ratio functions to control the resulting aspect ratio.
- // ŻŻŻŻŻŻŻŻŻŻŻŻŻ
- // We don't adjust non-native resolutions to avoid blurring the picture.
- // ŻŻŻŻŻŻŻŻŻŻŻŻŻ
- float Ratio = (float)W / (float)(H), TargetRatio;
- if ((g_Config.bNativeResolution || g_Config.b2xResolution) && (g_Config.bKeepAR169 || g_Config.bKeepAR43)
- && Ratio != 4.0/3.0 && Ratio != 16.0/9.0)
- {
- if (g_Config.bKeepAR43)
- TargetRatio = 4.0/3.0;
- else
- TargetRatio = 16.0/9.0;
- // Check if the height or width should be changed (we only increase the picture size, not
- // the other way around)
- if (Ratio < TargetRatio)
- {
- float fW = (float)H * TargetRatio;
- W = (int)fW;
- }
+ // These will contain the final image size
+ float FloatW = (float)W;
+ float FloatH = (float)H;
+
+ // Handle aspect ratio for the final screenshot to look exactly like what's on screen.
+ if (g_Config.bKeepAR43 || g_Config.bKeepAR169)
+ {
+ float Ratio = (FloatW / FloatH) / (g_Config.bKeepAR43 ? (4.0f / 3.0f) : (16.0f / 9.0f));
+
+ // If ratio > 1 the picture is too wide and we have to limit the width.
+ if (Ratio > 1)
+ FloatW /= Ratio;
+ // ratio == 1 or the image is too high, we have to limit the height.
else
- {
- float fH = (float)W * (1 / TargetRatio);
- H = (int)fH;
- }
- a.Rescale(W, H, wxIMAGE_QUALITY_HIGH);
+ FloatH *= Ratio;
+
+ a.Rescale((int)FloatW, (int)FloatH, wxIMAGE_QUALITY_HIGH);
}
- // ---------------------------------------------------------------------
- a.SaveFile(wxString::FromAscii(filename), wxBITMAP_TYPE_BMP);
+ a.SaveFile(wxString::FromAscii(filename), wxBITMAP_TYPE_PNG);
bool result = true;
// Show success messages
- OSD::AddMessage(StringFromFormat("Saved %i x %i %s\n", W, H, s_sScreenshotName.c_str()).c_str(), 2000);
+ OSD::AddMessage(StringFromFormat("Saved %i x %i %s\n", (int)FloatW, (int)FloatH, s_sScreenshotName.c_str()).c_str(), 2000);
+ // Finally kill the wxImage object
+ a.Destroy();
#else
bool result = SaveTGA(filename, W, H, data);
- free(data);
#endif
+ // Do not forget to release the data...
+ free(data);
+
return result;
}
diff --git a/Source/Plugins/Plugin_nJoy_SDL/Src/Rumble.cpp b/Source/Plugins/Plugin_nJoy_SDL/Src/Rumble.cpp
index 02cfbc939d..a394afe080 100644
--- a/Source/Plugins/Plugin_nJoy_SDL/Src/Rumble.cpp
+++ b/Source/Plugins/Plugin_nJoy_SDL/Src/Rumble.cpp
@@ -258,10 +258,10 @@ HRESULT InitRumble(HWND hWnd)
// Create the prepared effect
if (FAILED(hr = pRumble[i].g_pDevice->CreateEffect(GUID_ConstantForce, &pRumble[i].eff, &pRumble[i].g_pEffect, NULL)))
- return hr;
+ continue;
if (pRumble[i].g_pEffect == NULL)
- return E_FAIL;
+ continue;
}
}
@@ -367,10 +367,8 @@ VOID FreeDirectInput()
for (int i=0; i<4; i++) // Free all pads
{
- if (pRumble[i].g_pDevice) {
- pRumble[i].g_pEffect->Stop();
+ if (pRumble[i].g_pDevice)
pRumble[i].g_pDevice->Unacquire();
- }
SAFE_RELEASE(pRumble[i].g_pEffect);
SAFE_RELEASE(pRumble[i].g_pDevice);