summaryrefslogtreecommitdiff
path: root/Source
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
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')
-rw-r--r--Source/Core/Core/Src/Core.cpp4
-rw-r--r--Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp2
-rw-r--r--Source/Core/DiscIO/Src/BannerLoader.cpp21
-rw-r--r--Source/Core/DiscIO/Src/BannerLoader.h2
-rw-r--r--Source/Core/DiscIO/Src/BannerLoaderGC.cpp17
-rw-r--r--Source/Dolphin.sln17
-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
10 files changed, 50 insertions, 95 deletions
diff --git a/Source/Core/Core/Src/Core.cpp b/Source/Core/Core/Src/Core.cpp
index 327fa3b3c3..fc3a26716b 100644
--- a/Source/Core/Core/Src/Core.cpp
+++ b/Source/Core/Core/Src/Core.cpp
@@ -553,10 +553,10 @@ static inline std::string GenerateScreenshotName()
std::string tempname, name;
tempname = FULL_SCREENSHOTS_DIR + GetStartupParameter().GetUniqueID();
- name = StringFromFormat("%s-%d.bmp", tempname.c_str(), index);
+ name = StringFromFormat("%s-%d.png", tempname.c_str(), index);
while(File::Exists(name.c_str()))
- name = StringFromFormat("%s-%d.bmp", tempname.c_str(), ++index);
+ name = StringFromFormat("%s-%d.png", tempname.c_str(), ++index);
return name;
}
diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp
index 9bb7212ea1..72493d8555 100644
--- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp
+++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_net.cpp
@@ -330,7 +330,7 @@ u32 CWII_IPC_HLE_Device_net_ip_top::ExecuteCommand(u32 _Command, u32 _BufferIn,
struct sockaddr_in address;
int Return = accept(S, (struct sockaddr *)&address, &addrlen);
GC_sockaddr_in *addr = (GC_sockaddr_in*)Memory::GetPointer(BufferOut);
- addr->sin_family = address.sin_family;
+ addr->sin_family = (u8)address.sin_family;
addr->sin_addr.s_addr_ = address.sin_addr.s_addr;
addr->sin_port = address.sin_port;
socklen_t *Len = (socklen_t *)Memory::GetPointer(BufferOut + 0x04);
diff --git a/Source/Core/DiscIO/Src/BannerLoader.cpp b/Source/Core/DiscIO/Src/BannerLoader.cpp
index 3288e1e848..b18fc61dc8 100644
--- a/Source/Core/DiscIO/Src/BannerLoader.cpp
+++ b/Source/Core/DiscIO/Src/BannerLoader.cpp
@@ -30,14 +30,14 @@
namespace DiscIO
{
-bool IBannerLoader::CopyToStringAndCheck(std::string& _rDestination, const char* _src)
+void IBannerLoader::CopyToStringAndCheck(std::string& _rDestination, const char* _src)
{
static bool bValidChars[256];
static bool bInitialized = false;
if (!bInitialized)
{
- for (int i = 0; i < 256; i++)
+ for (int i = 0; i < 0x20; i++)
{
bValidChars[i] = false;
}
@@ -55,7 +55,6 @@ bool IBannerLoader::CopyToStringAndCheck(std::string& _rDestination, const char*
bInitialized = true;
}
- bool bResult = true;
char destBuffer[2048] = {0};
char* dest = destBuffer;
const char* src = _src;
@@ -69,8 +68,8 @@ bool IBannerLoader::CopyToStringAndCheck(std::string& _rDestination, const char*
if (bValidChars[c] == false)
{
- bResult = false;
- break;
+ src++;
+ continue;
}
*dest = c;
@@ -79,19 +78,9 @@ bool IBannerLoader::CopyToStringAndCheck(std::string& _rDestination, const char*
}
// finalize the string
- if (bResult)
- {
- *dest = 0x00;
- }
- else
- {
- dest[0] = ' ';
- dest[1] = 0x00;
- }
+ *dest = 0x00;
_rDestination = destBuffer;
-
- return(bResult);
}
bool IBannerLoader::CopyBeUnicodeToString( std::string& _rDestination, const u16* _src, int length )
diff --git a/Source/Core/DiscIO/Src/BannerLoader.h b/Source/Core/DiscIO/Src/BannerLoader.h
index 40f48b7135..02d60858e4 100644
--- a/Source/Core/DiscIO/Src/BannerLoader.h
+++ b/Source/Core/DiscIO/Src/BannerLoader.h
@@ -47,7 +47,7 @@ class IBannerLoader
protected:
- bool CopyToStringAndCheck(std::string& _rDestination, const char* _src);
+ void CopyToStringAndCheck(std::string& _rDestination, const char* _src);
bool CopyBeUnicodeToString(std::string& _rDestination, const u16* _src, int length);
private:
diff --git a/Source/Core/DiscIO/Src/BannerLoaderGC.cpp b/Source/Core/DiscIO/Src/BannerLoaderGC.cpp
index 459a082093..2270c91ce0 100644
--- a/Source/Core/DiscIO/Src/BannerLoaderGC.cpp
+++ b/Source/Core/DiscIO/Src/BannerLoaderGC.cpp
@@ -57,7 +57,7 @@ CBannerLoaderGC::~CBannerLoaderGC()
bool
CBannerLoaderGC::IsValid()
{
- return(m_IsValid);
+ return m_IsValid;
}
@@ -66,13 +66,13 @@ CBannerLoaderGC::GetBanner(u32* _pBannerImage)
{
if (!IsValid())
{
- return(false);
+ return false;
}
DVDBanner2* pBanner = (DVDBanner2*)m_pBannerFile;
decode5A3image(_pBannerImage, pBanner->image, DVD_BANNER_WIDTH, DVD_BANNER_HEIGHT);
- return(true);
+ return true;
}
@@ -83,7 +83,7 @@ CBannerLoaderGC::GetName(std::string _rName[])
if (!IsValid())
{
- return(false);
+ return false;
}
// find Banner type
@@ -151,12 +151,9 @@ CBannerLoaderGC::GetCompany(std::string& _rCompany)
DVDBanner2* pBanner = (DVDBanner2*)m_pBannerFile;
- if (!CopyToStringAndCheck(_rCompany, pBanner->comment[0].shortMaker))
- {
- return(false);
- }
+ CopyToStringAndCheck(_rCompany, pBanner->comment[0].shortMaker);
- return(true);
+ return true;
}
@@ -167,7 +164,7 @@ CBannerLoaderGC::GetDescription(std::string* _rDescription)
if (!IsValid())
{
- return(false);
+ return false;
}
// find Banner type
diff --git a/Source/Dolphin.sln b/Source/Dolphin.sln
index 949e51ba49..4bb6db3dc9 100644
--- a/Source/Dolphin.sln
+++ b/Source/Dolphin.sln
@@ -42,6 +42,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Plugin_VideoOGL", "Plugins\
ProjectSection(ProjectDependencies) = postProject
{C7E5D50A-2916-464B-86A7-E10B3CC88ADA} = {C7E5D50A-2916-464B-86A7-E10B3CC88ADA}
{11F55366-12EC-4C44-A8CB-1D4E315D61ED} = {11F55366-12EC-4C44-A8CB-1D4E315D61ED}
+ {3E03C179-8251-46E4-81F4-466F114BAC63} = {3E03C179-8251-46E4-81F4-466F114BAC63}
{0E231FB1-F3C9-4724-ACCB-DE8BCB3C089E} = {0E231FB1-F3C9-4724-ACCB-DE8BCB3C089E}
{E5D1F0C0-AA07-4841-A4EB-4CF4DAA6B0FA} = {E5D1F0C0-AA07-4841-A4EB-4CF4DAA6B0FA}
{1C8436C9-DBAF-42BE-83BC-CF3EC9175ABE} = {1C8436C9-DBAF-42BE-83BC-CF3EC9175ABE}
@@ -447,22 +448,6 @@ Global
{8D612734-FAA5-4B8A-804F-4DEA2367D495}.Release|Win32.Build.0 = Release|Win32
{8D612734-FAA5-4B8A-804F-4DEA2367D495}.Release|x64.ActiveCfg = Release|x64
{8D612734-FAA5-4B8A-804F-4DEA2367D495}.Release|x64.Build.0 = Release|x64
- {ADF64291-57ED-4B7A-AB76-37B4A991504B}.Debug|Win32.ActiveCfg = Debug|Win32
- {ADF64291-57ED-4B7A-AB76-37B4A991504B}.Debug|Win32.Build.0 = Debug|Win32
- {ADF64291-57ED-4B7A-AB76-37B4A991504B}.Debug|x64.ActiveCfg = Debug|x64
- {ADF64291-57ED-4B7A-AB76-37B4A991504B}.Debug|x64.Build.0 = Debug|x64
- {ADF64291-57ED-4B7A-AB76-37B4A991504B}.DebugFast|Win32.ActiveCfg = DebugFast|Win32
- {ADF64291-57ED-4B7A-AB76-37B4A991504B}.DebugFast|Win32.Build.0 = DebugFast|Win32
- {ADF64291-57ED-4B7A-AB76-37B4A991504B}.DebugFast|x64.ActiveCfg = DebugFast|x64
- {ADF64291-57ED-4B7A-AB76-37B4A991504B}.DebugFast|x64.Build.0 = DebugFast|x64
- {ADF64291-57ED-4B7A-AB76-37B4A991504B}.Release_JITIL|Win32.ActiveCfg = Release|Win32
- {ADF64291-57ED-4B7A-AB76-37B4A991504B}.Release_JITIL|Win32.Build.0 = Release|Win32
- {ADF64291-57ED-4B7A-AB76-37B4A991504B}.Release_JITIL|x64.ActiveCfg = Release|x64
- {ADF64291-57ED-4B7A-AB76-37B4A991504B}.Release_JITIL|x64.Build.0 = Release|x64
- {ADF64291-57ED-4B7A-AB76-37B4A991504B}.Release|Win32.ActiveCfg = Release|Win32
- {ADF64291-57ED-4B7A-AB76-37B4A991504B}.Release|Win32.Build.0 = Release|Win32
- {ADF64291-57ED-4B7A-AB76-37B4A991504B}.Release|x64.ActiveCfg = Release|x64
- {ADF64291-57ED-4B7A-AB76-37B4A991504B}.Release|x64.Build.0 = Release|x64
{C7E5D50A-2916-464B-86A7-E10B3CC88ADA}.Debug|Win32.ActiveCfg = Debug|Win32
{C7E5D50A-2916-464B-86A7-E10B3CC88ADA}.Debug|Win32.Build.0 = Debug|Win32
{C7E5D50A-2916-464B-86A7-E10B3CC88ADA}.Debug|x64.ActiveCfg = Debug|x64
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);