mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-04 10:03:36 +00:00
ScreenShot: move to common windows implementation
This commit is contained in:
parent
532eff450e
commit
70a9213d69
|
@ -398,6 +398,9 @@ copy /Y "$(OutDir)$(TargetName).*" "$(Mupen64PluginsDir_x64)")</Command>
|
||||||
<ClCompile Include="..\..\src\windows\ZilmarAPIImpl_windows.cpp">
|
<ClCompile Include="..\..\src\windows\ZilmarAPIImpl_windows.cpp">
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)'=='Debug_mupenplus' Or '$(Configuration)'=='Release_mupenplus'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)'=='Debug_mupenplus' Or '$(Configuration)'=='Release_mupenplus'">true</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\src\windows\ScreenShot.cpp">
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)'=='Debug_mupenplus' Or '$(Configuration)'=='Release_mupenplus'">true</ExcludedFromBuild>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\ZilmarPluginAPI.cpp">
|
<ClCompile Include="..\..\src\ZilmarPluginAPI.cpp">
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)'=='Debug_mupenplus' Or '$(Configuration)'=='Release_mupenplus'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)'=='Debug_mupenplus' Or '$(Configuration)'=='Release_mupenplus'">true</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|
|
@ -145,6 +145,9 @@
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\windows\ZilmarAPIImpl_windows.cpp">
|
<ClCompile Include="..\..\src\windows\ZilmarAPIImpl_windows.cpp">
|
||||||
<Filter>Source Files\windows</Filter>
|
<Filter>Source Files\windows</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\src\windows\ScreenShot.cpp">
|
||||||
|
<Filter>Source Files\windows</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\GLideNUI\Config_GLidenUI.cpp">
|
<ClCompile Include="..\..\src\GLideNUI\Config_GLidenUI.cpp">
|
||||||
<Filter>Source Files\windows</Filter>
|
<Filter>Source Files\windows</Filter>
|
||||||
|
|
|
@ -107,7 +107,6 @@
|
||||||
<ClCompile Include="..\..\src\GLideNUI-wtl\IniFileClass.cpp" />
|
<ClCompile Include="..\..\src\GLideNUI-wtl\IniFileClass.cpp" />
|
||||||
<ClCompile Include="..\..\src\GLideNUI-wtl\InputDialog.cpp" />
|
<ClCompile Include="..\..\src\GLideNUI-wtl\InputDialog.cpp" />
|
||||||
<ClCompile Include="..\..\src\GLideNUI-wtl\Language.cpp" />
|
<ClCompile Include="..\..\src\GLideNUI-wtl\Language.cpp" />
|
||||||
<ClCompile Include="..\..\src\GLideNUI-wtl\ScreenShot.cpp" />
|
|
||||||
<ClCompile Include="..\..\src\GLideNUI-wtl\Settings.cpp" />
|
<ClCompile Include="..\..\src\GLideNUI-wtl\Settings.cpp" />
|
||||||
<ClCompile Include="..\..\src\GLideNUI-wtl\util\StdString.cpp" />
|
<ClCompile Include="..\..\src\GLideNUI-wtl\util\StdString.cpp" />
|
||||||
<ClCompile Include="..\..\src\GLideNUI-wtl\util\util.cpp" />
|
<ClCompile Include="..\..\src\GLideNUI-wtl\util\util.cpp" />
|
||||||
|
|
|
@ -66,9 +66,6 @@
|
||||||
<ClCompile Include="..\..\src\GLideNUI-wtl\IniFileClass.cpp">
|
<ClCompile Include="..\..\src\GLideNUI-wtl\IniFileClass.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\GLideNUI-wtl\ScreenShot.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\src\GLideNUI-wtl\Settings.cpp">
|
<ClCompile Include="..\..\src\GLideNUI-wtl\Settings.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|
|
@ -127,7 +127,6 @@
|
||||||
<ClCompile Include="Release\moc_ConfigDialog.cpp">
|
<ClCompile Include="Release\moc_ConfigDialog.cpp">
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)'=='Debug'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)'=='Debug'">true</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\GLideNUI\ScreenShot.cpp" />
|
|
||||||
<ClCompile Include="..\..\src\GLideNUI\Settings.cpp" />
|
<ClCompile Include="..\..\src\GLideNUI\Settings.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -69,9 +69,6 @@
|
||||||
<ClCompile Include="..\..\src\GLideNUI\GLideNUI.cpp">
|
<ClCompile Include="..\..\src\GLideNUI\GLideNUI.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\src\GLideNUI\ScreenShot.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\src\GLideNUI\Settings.cpp">
|
<ClCompile Include="..\..\src\GLideNUI\Settings.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|
|
@ -128,7 +128,6 @@ set(GLideNUI_SOURCES
|
||||||
GLideNUI/ConfigDialog.cpp
|
GLideNUI/ConfigDialog.cpp
|
||||||
GLideNUI/Config_GLideNUI.cpp
|
GLideNUI/Config_GLideNUI.cpp
|
||||||
GLideNUI/GLideNUI.cpp
|
GLideNUI/GLideNUI.cpp
|
||||||
GLideNUI/ScreenShot.cpp
|
|
||||||
GLideNUI/Settings.cpp
|
GLideNUI/Settings.cpp
|
||||||
GLideNUI/QtKeyToHID.cpp
|
GLideNUI/QtKeyToHID.cpp
|
||||||
GLideNUI/HIDKeyToName.cpp
|
GLideNUI/HIDKeyToName.cpp
|
||||||
|
@ -223,6 +222,7 @@ else(MUPENPLUSAPI)
|
||||||
windows/GLideN64_windows.cpp
|
windows/GLideN64_windows.cpp
|
||||||
windows/MemoryStatus_windows.cpp
|
windows/MemoryStatus_windows.cpp
|
||||||
windows/ZilmarAPIImpl_windows.cpp
|
windows/ZilmarAPIImpl_windows.cpp
|
||||||
|
windows/ScreenShot.cpp
|
||||||
Graphics/OpenGLContext/windows/windows_DisplayWindow.cpp
|
Graphics/OpenGLContext/windows/windows_DisplayWindow.cpp
|
||||||
Graphics/OpenGLContext/windows/WindowsWGL.cpp
|
Graphics/OpenGLContext/windows/WindowsWGL.cpp
|
||||||
${GLideNUI_SOURCES}
|
${GLideNUI_SOURCES}
|
||||||
|
|
|
@ -19,7 +19,6 @@ EXPORT bool CALL RunConfig(const wchar_t * _strFileName, const char * _romName,
|
||||||
EXPORT int CALL RunAbout(const wchar_t * _strFileName);
|
EXPORT int CALL RunAbout(const wchar_t * _strFileName);
|
||||||
EXPORT void CALL LoadConfig(const wchar_t * _strFileName);
|
EXPORT void CALL LoadConfig(const wchar_t * _strFileName);
|
||||||
EXPORT void CALL LoadCustomRomSettings(const wchar_t * _strFileName, const char * _romName);
|
EXPORT void CALL LoadCustomRomSettings(const wchar_t * _strFileName, const char * _romName);
|
||||||
EXPORT void CALL SaveScreenshot(const wchar_t * _folder, const char * _name, int _width, int _height, const unsigned char * _data);
|
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,6 @@ EXPORT bool CALL RunConfig(const wchar_t * _strFileName, const char * _romName,
|
||||||
EXPORT int CALL RunAbout(const wchar_t * _strFileName);
|
EXPORT int CALL RunAbout(const wchar_t * _strFileName);
|
||||||
EXPORT void CALL LoadConfig(const wchar_t * _strFileName);
|
EXPORT void CALL LoadConfig(const wchar_t * _strFileName);
|
||||||
EXPORT void CALL LoadCustomRomSettings(const wchar_t * _strFileName, const char * _romName);
|
EXPORT void CALL LoadCustomRomSettings(const wchar_t * _strFileName, const char * _romName);
|
||||||
EXPORT void CALL SaveScreenshot(const wchar_t * _folder, const char * _name, int _width, int _height, const unsigned char * _data);
|
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
#include <QDir>
|
|
||||||
#include <QFile>
|
|
||||||
#include <QImage>
|
|
||||||
#include <QImageWriter>
|
|
||||||
#include "GLideNUI.h"
|
|
||||||
|
|
||||||
#include "../Config.h"
|
|
||||||
|
|
||||||
EXPORT void CALL SaveScreenshot(const wchar_t * _folder, const char * _name, int _width, int _height, const unsigned char * _data)
|
|
||||||
{
|
|
||||||
const char * png = "png";
|
|
||||||
const char * jpg = "jpg";
|
|
||||||
const char * fileExt = config.texture.screenShotFormat == 0 ? png : jpg;
|
|
||||||
QString folderName = QString::fromWCharArray(_folder);
|
|
||||||
QDir folder;
|
|
||||||
if (!folder.exists(folderName) && !folder.mkpath(folderName))
|
|
||||||
return;
|
|
||||||
|
|
||||||
QString romName(_name);
|
|
||||||
romName = romName.replace(' ', '_');
|
|
||||||
romName = romName.replace(':', ';');
|
|
||||||
QString fileName;
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < 1000; ++i) {
|
|
||||||
fileName = fileName.asprintf("%lsGLideN64_%ls_%03i.%s", folderName.data(), romName.data(), i, fileExt);
|
|
||||||
QFile f(fileName);
|
|
||||||
if (!f.exists())
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (i == 1000)
|
|
||||||
return;
|
|
||||||
QImage image(_data, _width, _height, QImage::Format_RGB888);
|
|
||||||
QImageWriter writer(fileName, fileExt);
|
|
||||||
writer.write(image.mirrored());
|
|
||||||
}
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <Graphics/Context.h>
|
#include <Graphics/Context.h>
|
||||||
#include <Graphics/Parameters.h>
|
#include <Graphics/Parameters.h>
|
||||||
#include <DisplayWindow.h>
|
#include <DisplayWindow.h>
|
||||||
|
#include <windows/ScreenShot.h>
|
||||||
#include <Graphics/OpenGLContext/ThreadedOpenGl/opengl_Wrapper.h>
|
#include <Graphics/OpenGLContext/ThreadedOpenGl/opengl_Wrapper.h>
|
||||||
|
|
||||||
using namespace opengl;
|
using namespace opengl;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#include "GLideNUI.h"
|
|
||||||
#include "../Config.h"
|
|
||||||
#include "util/util.h"
|
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
|
||||||
|
#include "Config.h"
|
||||||
#include "../GLideNHQ/inc/png.h"
|
#include "../GLideNHQ/inc/png.h"
|
||||||
|
|
||||||
void write_png_file(const wchar_t * file_name, int width, int height, const uint8_t *buffer)
|
void write_png_file(const wchar_t * file_name, int width, int height, const uint8_t *buffer)
|
||||||
|
@ -77,7 +76,7 @@ void write_png_file(const wchar_t * file_name, int width, int height, const uint
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT void CALL SaveScreenshot(const wchar_t * _folder, const char * _name, int _width, int _height, const unsigned char * _data)
|
void SaveScreenshot(const wchar_t * _folder, const char * _name, int _width, int _height, const unsigned char * _data)
|
||||||
{
|
{
|
||||||
const wchar_t * fileExt = L"png";
|
const wchar_t * fileExt = L"png";
|
||||||
|
|
||||||
|
@ -96,7 +95,9 @@ EXPORT void CALL SaveScreenshot(const wchar_t * _folder, const char * _name, int
|
||||||
if ((FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
|
if ((FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
std::wstring romName = ToUTF16(_name);
|
wchar_t wbuf[MAX_PATH];
|
||||||
|
mbstowcs(wbuf, _name, MAX_PATH);
|
||||||
|
std::wstring romName = std::wstring(wbuf);
|
||||||
for (size_t i = 0, n = romName.size(); i < n; i++) {
|
for (size_t i = 0, n = romName.size(); i < n; i++) {
|
||||||
if (romName[i] == L' ') romName[i] = L'_';
|
if (romName[i] == L' ') romName[i] = L'_';
|
||||||
if (romName[i] == L':') romName[i] = L';';
|
if (romName[i] == L':') romName[i] = L';';
|
6
src/windows/ScreenShot.h
Normal file
6
src/windows/ScreenShot.h
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#ifndef SCREENSHOT_H
|
||||||
|
#define SCREENSHOT_H
|
||||||
|
|
||||||
|
void SaveScreenshot(const wchar_t * _folder, const char * _name, int _width, int _height, const unsigned char * _data);
|
||||||
|
|
||||||
|
#endif // SCREENSHOT_H
|
Loading…
Reference in New Issue
Block a user