More UWP prep

This commit is contained in:
Henrik Rydgard 2017-02-25 00:25:46 +01:00
parent fa80cfa4aa
commit 03dab0fdbd
27 changed files with 210 additions and 209 deletions

View File

@ -78,10 +78,7 @@ inline u64 __rotr64(u64 x, unsigned int shift){
#if _M_IX86
#define Crash() {__asm int 3}
#else
extern "C" {
__declspec(dllimport) void __stdcall DebugBreak(void);
}
#define Crash() {DebugBreak();}
#define Crash() {__debugbreak();}
#endif // M_IX86
#endif // WIN32 ndef

View File

@ -556,11 +556,12 @@ bool CreateEmptyFile(const std::string &filename)
return true;
}
#if !PPSSPP_PLATFORM(UWP)
// Deletes the given directory and anything under it. Returns true on success.
bool DeleteDirRecursively(const std::string &directory)
{
#if PPSSPP_PLATFORM(UWP)
return false;
#else
INFO_LOG(COMMON, "DeleteDirRecursively: %s", directory.c_str());
#ifdef _WIN32
@ -629,11 +630,10 @@ bool DeleteDirRecursively(const std::string &directory)
closedir(dirp);
#endif
File::DeleteDir(directory);
return true;
#endif
}
#endif
// Create directory and copy contents (does not overwrite existing files)
void CopyDir(const std::string &source_path, const std::string &dest_path)

View File

@ -7,6 +7,7 @@
#include "base/basictypes.h"
#include "VulkanContext.h"
#include "GPU/Common/ShaderCommon.h"
#ifdef USE_CRT_DBG
#undef new
@ -1327,100 +1328,6 @@ void TransitionImageLayout(VkCommandBuffer cmd, VkImage image, VkImageAspectFlag
vkCmdPipelineBarrier(cmd, src_stages, dest_stages, 0, 0, nullptr, 0, nullptr, 1, &image_memory_barrier);
}
void init_resources(TBuiltInResource &Resources) {
Resources.maxLights = 32;
Resources.maxClipPlanes = 6;
Resources.maxTextureUnits = 32;
Resources.maxTextureCoords = 32;
Resources.maxVertexAttribs = 64;
Resources.maxVertexUniformComponents = 4096;
Resources.maxVaryingFloats = 64;
Resources.maxVertexTextureImageUnits = 32;
Resources.maxCombinedTextureImageUnits = 80;
Resources.maxTextureImageUnits = 32;
Resources.maxFragmentUniformComponents = 4096;
Resources.maxDrawBuffers = 32;
Resources.maxVertexUniformVectors = 128;
Resources.maxVaryingVectors = 8;
Resources.maxFragmentUniformVectors = 16;
Resources.maxVertexOutputVectors = 16;
Resources.maxFragmentInputVectors = 15;
Resources.minProgramTexelOffset = -8;
Resources.maxProgramTexelOffset = 7;
Resources.maxClipDistances = 8;
Resources.maxComputeWorkGroupCountX = 65535;
Resources.maxComputeWorkGroupCountY = 65535;
Resources.maxComputeWorkGroupCountZ = 65535;
Resources.maxComputeWorkGroupSizeX = 1024;
Resources.maxComputeWorkGroupSizeY = 1024;
Resources.maxComputeWorkGroupSizeZ = 64;
Resources.maxComputeUniformComponents = 1024;
Resources.maxComputeTextureImageUnits = 16;
Resources.maxComputeImageUniforms = 8;
Resources.maxComputeAtomicCounters = 8;
Resources.maxComputeAtomicCounterBuffers = 1;
Resources.maxVaryingComponents = 60;
Resources.maxVertexOutputComponents = 64;
Resources.maxGeometryInputComponents = 64;
Resources.maxGeometryOutputComponents = 128;
Resources.maxFragmentInputComponents = 128;
Resources.maxImageUnits = 8;
Resources.maxCombinedImageUnitsAndFragmentOutputs = 8;
Resources.maxCombinedShaderOutputResources = 8;
Resources.maxImageSamples = 0;
Resources.maxVertexImageUniforms = 0;
Resources.maxTessControlImageUniforms = 0;
Resources.maxTessEvaluationImageUniforms = 0;
Resources.maxGeometryImageUniforms = 0;
Resources.maxFragmentImageUniforms = 8;
Resources.maxCombinedImageUniforms = 8;
Resources.maxGeometryTextureImageUnits = 16;
Resources.maxGeometryOutputVertices = 256;
Resources.maxGeometryTotalOutputComponents = 1024;
Resources.maxGeometryUniformComponents = 1024;
Resources.maxGeometryVaryingComponents = 64;
Resources.maxTessControlInputComponents = 128;
Resources.maxTessControlOutputComponents = 128;
Resources.maxTessControlTextureImageUnits = 16;
Resources.maxTessControlUniformComponents = 1024;
Resources.maxTessControlTotalOutputComponents = 4096;
Resources.maxTessEvaluationInputComponents = 128;
Resources.maxTessEvaluationOutputComponents = 128;
Resources.maxTessEvaluationTextureImageUnits = 16;
Resources.maxTessEvaluationUniformComponents = 1024;
Resources.maxTessPatchComponents = 120;
Resources.maxPatchVertices = 32;
Resources.maxTessGenLevel = 64;
Resources.maxViewports = 16;
Resources.maxVertexAtomicCounters = 0;
Resources.maxTessControlAtomicCounters = 0;
Resources.maxTessEvaluationAtomicCounters = 0;
Resources.maxGeometryAtomicCounters = 0;
Resources.maxFragmentAtomicCounters = 8;
Resources.maxCombinedAtomicCounters = 8;
Resources.maxAtomicCounterBindings = 1;
Resources.maxVertexAtomicCounterBuffers = 0;
Resources.maxTessControlAtomicCounterBuffers = 0;
Resources.maxTessEvaluationAtomicCounterBuffers = 0;
Resources.maxGeometryAtomicCounterBuffers = 0;
Resources.maxFragmentAtomicCounterBuffers = 1;
Resources.maxCombinedAtomicCounterBuffers = 1;
Resources.maxAtomicCounterBufferSize = 16384;
Resources.maxTransformFeedbackBuffers = 4;
Resources.maxTransformFeedbackInterleavedComponents = 64;
Resources.maxCullDistances = 8;
Resources.maxCombinedClipAndCullDistances = 8;
Resources.maxSamples = 4;
Resources.limits.nonInductiveForLoops = 1;
Resources.limits.whileLoops = 1;
Resources.limits.doWhileLoops = 1;
Resources.limits.generalUniformIndexing = 1;
Resources.limits.generalAttributeMatrixVectorIndexing = 1;
Resources.limits.generalVaryingIndexing = 1;
Resources.limits.generalSamplerIndexing = 1;
Resources.limits.generalVariableIndexing = 1;
Resources.limits.generalConstantMatrixVectorIndexing = 1;
}
EShLanguage FindLanguage(const VkShaderStageFlagBits shader_type) {
switch (shader_type) {

View File

@ -3,6 +3,7 @@
// Refer to the license.txt file included.
#ifndef MOBILE_DEVICE
#if defined(__FreeBSD__)
#define __STDC_CONSTANT_MACROS 1
#endif
@ -11,6 +12,8 @@
#include <cstdint>
#include <sstream>
#ifdef USE_FFMPEG
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
@ -18,6 +21,8 @@ extern "C" {
#include <libswscale/swscale.h>
}
#endif
#include "Common/FileUtil.h"
#include "Common/MsgHandler.h"
#include "Common/ColorConv.h"
@ -29,6 +34,8 @@ extern "C" {
#include "GPU/Common/GPUDebugInterface.h"
#ifdef USE_FFMPEG
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55, 28, 1)
#define av_frame_alloc avcodec_alloc_frame
#define av_frame_free avcodec_free_frame
@ -38,8 +45,11 @@ static AVFormatContext* s_format_context = nullptr;
static AVStream* s_stream = nullptr;
static AVFrame* s_src_frame = nullptr;
static AVFrame* s_scaled_frame = nullptr;
static int s_bytes_per_pixel;
static SwsContext* s_sws_context = nullptr;
#endif
static int s_bytes_per_pixel;
static int s_width;
static int s_height;
static bool s_start_dumping = false;
@ -48,12 +58,12 @@ static int s_current_height;
static int s_file_index = 0;
static GPUDebugBuffer buf;
static void InitAVCodec()
{
static void InitAVCodec() {
static bool first_run = true;
if (first_run)
{
if (first_run) {
#ifdef USE_FFMPEG
av_register_all();
#endif
first_run = false;
}
}
@ -72,8 +82,8 @@ bool AVIDump::Start(int w, int h)
return success;
}
bool AVIDump::CreateAVI()
{
bool AVIDump::CreateAVI() {
#ifdef USE_FFMPEG
AVCodec* codec = nullptr;
s_format_context = avformat_alloc_context();
@ -132,15 +142,21 @@ bool AVIDump::CreateAVI()
}
return true;
#else
return false;
#endif
}
static void PreparePacket(AVPacket* pkt)
{
#ifdef USE_FFMPEG
static void PreparePacket(AVPacket* pkt) {
av_init_packet(pkt);
pkt->data = nullptr;
pkt->size = 0;
}
#endif
void AVIDump::AddFrame()
{
gpuDebug->GetCurrentFramebuffer(buf, GPU_DBG_FRAMEBUF_DISPLAY);
@ -149,6 +165,9 @@ void AVIDump::AddFrame()
CheckResolution(w, h);
u8 *flipbuffer = nullptr;
const u8 *buffer = ConvertBufferTo888RGB(buf, flipbuffer, w, h);
#ifdef USE_FFMPEG
s_src_frame->data[0] = const_cast<u8*>(buffer);
s_src_frame->linesize[0] = w * 3;
s_src_frame->format = AV_PIX_FMT_RGB24;
@ -194,18 +213,22 @@ void AVIDump::AddFrame()
}
if (error)
ERROR_LOG(G3D, "Error while encoding video: %d", error);
#endif
}
void AVIDump::Stop()
{
void AVIDump::Stop() {
#ifdef USE_FFMPEG
av_write_trailer(s_format_context);
CloseFile();
s_file_index = 0;
#endif
NOTICE_LOG(G3D, "Stopping frame dump");
}
void AVIDump::CloseFile()
{
void AVIDump::CloseFile() {
#ifdef USE_FFMPEG
if (s_stream)
{
if (s_stream->codec)
@ -233,10 +256,11 @@ void AVIDump::CloseFile()
sws_freeContext(s_sws_context);
s_sws_context = nullptr;
}
#endif
}
void AVIDump::CheckResolution(int width, int height)
{
void AVIDump::CheckResolution(int width, int height) {
#ifdef USE_FFMPEG
// We check here to see if the requested width and height have changed since the last frame which
// was dumped, then create a new file accordingly. However, is it possible for the width and height
// to have a value of zero. If this is the case, simply keep the last known resolution of the video
@ -250,5 +274,6 @@ void AVIDump::CheckResolution(int width, int height)
s_current_width = width;
s_current_height = height;
}
#endif USE_FFMPEG
}
#endif

View File

@ -956,7 +956,7 @@ void SymbolMap::GetLabels(std::vector<LabelDefinition> &dest) const
}
}
#if defined(_WIN32)
#if defined(_WIN32) && !PPSSPP_PLATFORM(UWP)
struct DefaultSymbol {
u32 address;
@ -1026,5 +1026,4 @@ void SymbolMap::FillSymbolListBox(HWND listbox,SymbolType symType) const {
SendMessage(listbox, WM_SETREDRAW, TRUE, 0);
RedrawWindow(listbox, NULL, NULL, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN);
}
#endif

View File

@ -323,7 +323,7 @@ void PSPSaveDialog::DisplaySaveList(bool canMove)
w = 144;
h = 80;
x = 27;
b = 1.2;
b = 1.2f;
PPGeDrawRect(x-b, y-b, x+w+b, y, CalcFadedColor(0xD0FFFFFF)); // top border
PPGeDrawRect(x-b, y, x, y+h, CalcFadedColor(0xD0FFFFFF)); // left border
PPGeDrawRect(x-b, y+h, x+w+b, y+h+b, CalcFadedColor(0xD0FFFFFF)); //bottom border

101
GPU/Common/ShaderCommon.cpp Normal file
View File

@ -0,0 +1,101 @@
#ifdef USE_CRT_DBG
#undef new
#endif
#include "ext/glslang/SPIRV/GlslangToSpv.h"
void init_resources(TBuiltInResource &Resources) {
Resources.maxLights = 32;
Resources.maxClipPlanes = 6;
Resources.maxTextureUnits = 32;
Resources.maxTextureCoords = 32;
Resources.maxVertexAttribs = 64;
Resources.maxVertexUniformComponents = 4096;
Resources.maxVaryingFloats = 64;
Resources.maxVertexTextureImageUnits = 32;
Resources.maxCombinedTextureImageUnits = 80;
Resources.maxTextureImageUnits = 32;
Resources.maxFragmentUniformComponents = 4096;
Resources.maxDrawBuffers = 32;
Resources.maxVertexUniformVectors = 128;
Resources.maxVaryingVectors = 8;
Resources.maxFragmentUniformVectors = 16;
Resources.maxVertexOutputVectors = 16;
Resources.maxFragmentInputVectors = 15;
Resources.minProgramTexelOffset = -8;
Resources.maxProgramTexelOffset = 7;
Resources.maxClipDistances = 8;
Resources.maxComputeWorkGroupCountX = 65535;
Resources.maxComputeWorkGroupCountY = 65535;
Resources.maxComputeWorkGroupCountZ = 65535;
Resources.maxComputeWorkGroupSizeX = 1024;
Resources.maxComputeWorkGroupSizeY = 1024;
Resources.maxComputeWorkGroupSizeZ = 64;
Resources.maxComputeUniformComponents = 1024;
Resources.maxComputeTextureImageUnits = 16;
Resources.maxComputeImageUniforms = 8;
Resources.maxComputeAtomicCounters = 8;
Resources.maxComputeAtomicCounterBuffers = 1;
Resources.maxVaryingComponents = 60;
Resources.maxVertexOutputComponents = 64;
Resources.maxGeometryInputComponents = 64;
Resources.maxGeometryOutputComponents = 128;
Resources.maxFragmentInputComponents = 128;
Resources.maxImageUnits = 8;
Resources.maxCombinedImageUnitsAndFragmentOutputs = 8;
Resources.maxCombinedShaderOutputResources = 8;
Resources.maxImageSamples = 0;
Resources.maxVertexImageUniforms = 0;
Resources.maxTessControlImageUniforms = 0;
Resources.maxTessEvaluationImageUniforms = 0;
Resources.maxGeometryImageUniforms = 0;
Resources.maxFragmentImageUniforms = 8;
Resources.maxCombinedImageUniforms = 8;
Resources.maxGeometryTextureImageUnits = 16;
Resources.maxGeometryOutputVertices = 256;
Resources.maxGeometryTotalOutputComponents = 1024;
Resources.maxGeometryUniformComponents = 1024;
Resources.maxGeometryVaryingComponents = 64;
Resources.maxTessControlInputComponents = 128;
Resources.maxTessControlOutputComponents = 128;
Resources.maxTessControlTextureImageUnits = 16;
Resources.maxTessControlUniformComponents = 1024;
Resources.maxTessControlTotalOutputComponents = 4096;
Resources.maxTessEvaluationInputComponents = 128;
Resources.maxTessEvaluationOutputComponents = 128;
Resources.maxTessEvaluationTextureImageUnits = 16;
Resources.maxTessEvaluationUniformComponents = 1024;
Resources.maxTessPatchComponents = 120;
Resources.maxPatchVertices = 32;
Resources.maxTessGenLevel = 64;
Resources.maxViewports = 16;
Resources.maxVertexAtomicCounters = 0;
Resources.maxTessControlAtomicCounters = 0;
Resources.maxTessEvaluationAtomicCounters = 0;
Resources.maxGeometryAtomicCounters = 0;
Resources.maxFragmentAtomicCounters = 8;
Resources.maxCombinedAtomicCounters = 8;
Resources.maxAtomicCounterBindings = 1;
Resources.maxVertexAtomicCounterBuffers = 0;
Resources.maxTessControlAtomicCounterBuffers = 0;
Resources.maxTessEvaluationAtomicCounterBuffers = 0;
Resources.maxGeometryAtomicCounterBuffers = 0;
Resources.maxFragmentAtomicCounterBuffers = 1;
Resources.maxCombinedAtomicCounterBuffers = 1;
Resources.maxAtomicCounterBufferSize = 16384;
Resources.maxTransformFeedbackBuffers = 4;
Resources.maxTransformFeedbackInterleavedComponents = 64;
Resources.maxCullDistances = 8;
Resources.maxCombinedClipAndCullDistances = 8;
Resources.maxSamples = 4;
Resources.limits.nonInductiveForLoops = 1;
Resources.limits.whileLoops = 1;
Resources.limits.doWhileLoops = 1;
Resources.limits.generalUniformIndexing = 1;
Resources.limits.generalAttributeMatrixVectorIndexing = 1;
Resources.limits.generalVaryingIndexing = 1;
Resources.limits.generalSamplerIndexing = 1;
Resources.limits.generalVariableIndexing = 1;
Resources.limits.generalConstantMatrixVectorIndexing = 1;
}

View File

@ -113,4 +113,7 @@ public:
virtual ~ShaderManagerCommon() {}
virtual void DirtyLastShader() = 0;
};
};
struct TBuiltInResource;
void init_resources(TBuiltInResource &Resources);

View File

@ -15,7 +15,7 @@
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#ifndef ANDROID
#if !defined(ANDROID)
#include <memory>
#include <vector>

View File

@ -456,7 +456,7 @@ static void SplinePatchFullQuality(u8 *&dest, u16 *indices, int &count, const Sp
char temp[512];
snprintf(temp, sizeof(temp), "count_u: %d count_v: %d patch_w: %d patch_h: %d ii: %d jj: %d iu: %d iv: %d patch_div_s: %d patch_div_t: %d\n", spatch.count_u, spatch.count_v, patch_w, patch_h, ii, jj, iu, iv, patch_div_s, patch_div_t);
OutputDebugStringA(temp);
DebugBreak();
Crash();
}*/
SimpleVertex *a = spatch.points[idx];
AccumulateWeighted(vert_pos, a->pos, fv);

View File

@ -22,11 +22,11 @@
#include "GPU/GPU.h"
#include "GPU/GPUInterface.h"
#include "GPU/GLES/GPU_GLES.h"
#if PPSSPP_PLATFORM(UWP)
#include "GPU/D3D11/GPU_D3D11.h"
#else
#include "GPU/GLES/GPU_GLES.h"
#ifndef NO_VULKAN
#include "GPU/Vulkan/GPU_Vulkan.h"

View File

@ -273,6 +273,7 @@
<ClCompile Include="Common\GPUStateUtils.cpp" />
<ClCompile Include="Common\IndexGenerator.cpp" />
<ClCompile Include="Common\PostShader.cpp" />
<ClCompile Include="Common\ShaderCommon.cpp" />
<ClCompile Include="Common\ShaderId.cpp" />
<ClCompile Include="Common\ShaderTranslation.cpp" />
<ClCompile Include="Common\ShaderUniforms.cpp" />

View File

@ -507,5 +507,8 @@
<ClCompile Include="Common\ShaderTranslation.cpp">
<Filter>Common</Filter>
</ClCompile>
<ClCompile Include="Common\ShaderCommon.cpp">
<Filter>Common</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@ -19,7 +19,7 @@
#include "Core/Host.h"
#include "Core/Config.h"
#include "GPU/GPUState.h"
#include "GPU/GLES/DrawEngineGLES.h"
#include "GPU/Common/DrawEngineCommon.h"
#include "GPU/Common/VertexDecoderCommon.h"
#include "GPU/Common/SplineCommon.h"

View File

@ -359,9 +359,11 @@ void SystemInfoScreen::CreateViews() {
deviceSpecs->Add(new InfoItem("Model", draw->GetInfoString(InfoField::RENDERER)));
#ifdef _WIN32
deviceSpecs->Add(new InfoItem("Driver Version", System_GetProperty(SYSPROP_GPUDRIVER_VERSION)));
#if !PPSSPP_PLATFORM(UWP)
if (GetGPUBackend() == GPUBackend::DIRECT3D9) {
deviceSpecs->Add(new InfoItem("D3DX Version", StringFromFormat("%d", GetD3DXVersion())));
}
#endif
#endif
deviceSpecs->Add(new ItemHeader("OS Information"));
deviceSpecs->Add(new InfoItem("Memory Page Size", StringFromFormat("%d bytes", GetMemoryProtectPageSize())));

View File

@ -25,6 +25,7 @@
#include "gfx_es2/gpu_features.h"
#include "gfx_es2/draw_buffer.h"
#include "i18n/i18n.h"
#include "util/text/utf8.h"
#include "ui/view.h"
#include "ui/viewgroup.h"
#include "ui/ui_context.h"
@ -55,11 +56,10 @@
#include "GPU/GPUInterface.h"
#include "GPU/GLES/FramebufferManagerGLES.h"
#if defined(_WIN32)
#if defined(_WIN32) && !PPSSPP_PLATFORM(UWP)
#pragma warning(disable:4091) // workaround bug in VS2015 headers
#include "Windows/MainWindow.h"
#include <shlobj.h>
#include "util/text/utf8.h"
#include "Windows/W32Util/ShellUtil.h"
#endif
@ -1176,8 +1176,10 @@ void DeveloperToolsScreen::CreateViews() {
list->Add(new CheckBox(&g_Config.bShowDeveloperMenu, dev->T("Show Developer Menu")));
list->Add(new CheckBox(&g_Config.bDumpDecryptedEboot, dev->T("Dump Decrypted Eboot", "Dump Decrypted EBOOT.BIN (If Encrypted) When Booting Game")));
#if !PPSSPP_PLATFORM(UWP)
Choice *cpuTests = new Choice(dev->T("Run CPU Tests"));
list->Add(cpuTests)->OnClick.Handle(this, &DeveloperToolsScreen::OnRunCPUTests);
#ifdef IOS
const std::string testDirectory = g_Config.flash0Directory + "../";
#else
@ -1186,6 +1188,7 @@ void DeveloperToolsScreen::CreateViews() {
if (!File::Exists(testDirectory + "pspautotests/tests/")) {
cpuTests->SetEnabled(false);
}
#endif
list->Add(new CheckBox(&g_Config.bEnableLogging, dev->T("Enable Logging")))->OnClick.Handle(this, &DeveloperToolsScreen::OnLoggingChanged);
list->Add(new Choice(dev->T("Logging Channels")))->OnClick.Handle(this, &DeveloperToolsScreen::OnLogConfig);
@ -1237,7 +1240,9 @@ UI::EventReturn DeveloperToolsScreen::OnLoggingChanged(UI::EventParams &e) {
}
UI::EventReturn DeveloperToolsScreen::OnRunCPUTests(UI::EventParams &e) {
#if !PPSSPP_PLATFORM(UWP)
RunTests();
#endif
return UI::EVENT_DONE;
}

View File

@ -430,11 +430,15 @@ UI::EventReturn GameBrowser::HomeClick(UI::EventParams &e) {
else
return UI::EVENT_DONE;
#elif defined(_WIN32)
#if PPSSPP_PLATFORM(UWP)
// TODO UWP
#else
I18NCategory *mm = GetI18NCategory("MainMenu");
std::string folder = W32Util::BrowseForFolder(MainWindow::GetHWND(), mm->T("Choose folder"));
if (!folder.size())
return UI::EVENT_DONE;
path_.SetPath(folder);
#endif
#else
path_.SetPath(getenv("HOME"));
#endif

View File

@ -634,7 +634,11 @@ void NativeInitGraphics(GraphicsContext *graphicsContext) {
#ifdef _WIN32
winAudioBackend = CreateAudioBackend((AudioBackendType)g_Config.iAudioBackend);
#if PPSSPP_PLATFORM(UWP)
// TODO UWP
#else
winAudioBackend->Init(MainWindow::GetHWND(), &Win32Mix, 44100);
#endif
#endif
g_gameInfoCache = new GameInfoCache();

View File

@ -1,11 +1,16 @@
#pragma once
#include "ppsspp_config.h"
#if !PPSSPP_PLATFORM(UWP)
#include "Common/CommonWindows.h"
#include <string>
#include "Core/System.h"
#include "MainWindowMenu.h"
namespace MainWindow
{
enum {
@ -68,3 +73,5 @@ namespace MainWindow
void SetInternalResolution(int res = -1);
void SetWindowSize(int zoom);
}
#endif

View File

@ -896,83 +896,6 @@ bool jpeg_encoder::process_scanline(const void* pScanline)
return m_all_stream_writes_succeeded;
}
class cfile_stream : public output_stream
{
cfile_stream(const cfile_stream &);
cfile_stream &operator= (const cfile_stream &);
FILE* m_pFile;
bool m_bStatus;
public:
cfile_stream() : m_pFile(NULL), m_bStatus(false) { }
virtual ~cfile_stream()
{
close();
}
bool open(const char *pFilename)
{
close();
m_pFile = fopen(pFilename, "wb");
m_bStatus = (m_pFile != NULL);
return m_bStatus;
}
bool close()
{
if (m_pFile)
{
if (fclose(m_pFile) == EOF)
{
m_bStatus = false;
}
m_pFile = NULL;
}
return m_bStatus;
}
virtual bool put_buf(const void* pBuf, int len)
{
m_bStatus = m_bStatus && (fwrite(pBuf, len, 1, m_pFile) == 1);
return m_bStatus;
}
uint get_size() const
{
return m_pFile ? ftell(m_pFile) : 0;
}
};
// Writes JPEG image to file.
bool compress_image_to_jpeg_file(const char *pFilename, int width, int height, int num_channels, const uint8 *pImage_data, const params &comp_params)
{
cfile_stream dst_stream;
if (!dst_stream.open(pFilename))
return false;
jpge::jpeg_encoder dst_image;
if (!dst_image.init(&dst_stream, width, height, num_channels, comp_params))
return false;
for (uint pass_index = 0; pass_index < dst_image.get_total_passes(); pass_index++)
{
for (int i = 0; i < height; i++)
{
const uint8* pBuf = pImage_data + i * width * num_channels;
if (!dst_image.process_scanline(pBuf))
return false;
}
if (!dst_image.process_scanline(NULL))
return false;
}
dst_image.deinit();
return dst_stream.close();
}
class memory_stream : public output_stream
{
memory_stream(const memory_stream &);

View File

@ -31,7 +31,7 @@ float TextDrawerWordWrapper::MeasureWidth(const char *str, size_t bytes) {
return w;
}
#if defined(_WIN32) && !defined(USING_QT_UI)
#if defined(_WIN32) && !defined(USING_QT_UI) && !PPSSPP_PLATFORM(UWP)
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>

View File

@ -8,6 +8,8 @@
#pragma once
#include "ppsspp_config.h"
#include <map>
#include <memory>
@ -80,7 +82,7 @@ private:
TextDrawerContext *ctx_;
#if defined(USING_QT_UI)
std::map<uint32_t, QFont *> fontMap_;
#elif defined(_WIN32)
#elif defined(_WIN32) && !PPSSPP_PLATFORM(UWP)
std::map<uint32_t, std::unique_ptr<TextDrawerFontContext>> fontMap_;
#endif

View File

@ -1,13 +1,20 @@
#include "ppsspp_config.h"
#include <cstring>
#include "base/logging.h"
#include "base/stringutil.h"
#if !PPSSPP_PLATFORM(UWP)
#include "gfx/gl_common.h"
#include "gfx_es2/gpu_features.h"
#if defined(_WIN32)
#include "GL/wglew.h"
#endif
#endif
#include "gfx_es2/gpu_features.h"
#if defined(USING_GLES2)
#if defined(__ANDROID__)
@ -75,6 +82,9 @@ void ProcessGPUFeatures() {
// http://stackoverflow.com/questions/16147700/opengl-es-using-tegra-specific-extensions-gl-ext-texture-array
void CheckGLExtensions() {
#if !PPSSPP_PLATFORM(UWP)
// Make sure to only do this once. It's okay to call CheckGLExtensions from wherever.
if (extensionsDone)
return;
@ -394,6 +404,9 @@ void CheckGLExtensions() {
int error = glGetError();
if (error)
ELOG("GL error in init: %i", error);
#endif
}
void SetGLCoreContext(bool flag) {

View File

@ -2,7 +2,10 @@
#ifdef _WIN32
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <winsock2.h>
#include <ws2tcpip.h>
#include <io.h>

View File

@ -1,6 +1,8 @@
#ifdef _WIN32
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <winsock2.h>
#include <ws2tcpip.h>
#include <io.h>

View File

@ -168,7 +168,7 @@ ud_insn_hex(struct ud* u)
/* for each byte used to decode instruction */
for (i = 0; i < ud_insn_len(u) && i < sizeof(u->insn_hexcode) / 2;
++i, ++src_ptr) {
sprintf(src_hex, "%02x", *src_ptr & 0xFF);
snprintf(src_hex, 64 - i * 2, "%02x", *src_ptr & 0xFF);
src_hex += 2;
}
}

View File

@ -77,7 +77,7 @@
// Covers both 32 and 64bit Windows
#define PPSSPP_PLATFORM_WINDOWS 1
// UWP trickery
#ifdef WINAPI_FAMILY
#if defined(WINAPI_FAMILY) && defined(WINAPI_FAMILY_PARTITION)
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
#define PPSSPP_PLATFORM_UWP 1
#endif