diff --git a/Common/CommonFuncs.h b/Common/CommonFuncs.h index a1d26ba26d..3f885639b7 100644 --- a/Common/CommonFuncs.h +++ b/Common/CommonFuncs.h @@ -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 diff --git a/Common/FileUtil.cpp b/Common/FileUtil.cpp index 968bcf1993..eac8240a93 100644 --- a/Common/FileUtil.cpp +++ b/Common/FileUtil.cpp @@ -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) diff --git a/Common/Vulkan/VulkanContext.cpp b/Common/Vulkan/VulkanContext.cpp index 053aa06a7d..1cc81ac414 100644 --- a/Common/Vulkan/VulkanContext.cpp +++ b/Common/Vulkan/VulkanContext.cpp @@ -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) { diff --git a/Core/AVIDump.cpp b/Core/AVIDump.cpp index 3074d23eaa..226f44dabd 100644 --- a/Core/AVIDump.cpp +++ b/Core/AVIDump.cpp @@ -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 #include +#ifdef USE_FFMPEG + extern "C" { #include #include @@ -18,6 +21,8 @@ extern "C" { #include } +#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(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 diff --git a/Core/Debugger/SymbolMap.cpp b/Core/Debugger/SymbolMap.cpp index 7528a53673..80935a9db6 100644 --- a/Core/Debugger/SymbolMap.cpp +++ b/Core/Debugger/SymbolMap.cpp @@ -956,7 +956,7 @@ void SymbolMap::GetLabels(std::vector &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 diff --git a/Core/Dialog/PSPSaveDialog.cpp b/Core/Dialog/PSPSaveDialog.cpp index ef818e70fb..601bb0b5b8 100755 --- a/Core/Dialog/PSPSaveDialog.cpp +++ b/Core/Dialog/PSPSaveDialog.cpp @@ -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 diff --git a/GPU/Common/ShaderCommon.cpp b/GPU/Common/ShaderCommon.cpp new file mode 100644 index 0000000000..1cbc7d3be5 --- /dev/null +++ b/GPU/Common/ShaderCommon.cpp @@ -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; +} \ No newline at end of file diff --git a/GPU/Common/ShaderCommon.h b/GPU/Common/ShaderCommon.h index 4392e4ae4d..5cf3c05c14 100644 --- a/GPU/Common/ShaderCommon.h +++ b/GPU/Common/ShaderCommon.h @@ -113,4 +113,7 @@ public: virtual ~ShaderManagerCommon() {} virtual void DirtyLastShader() = 0; -}; \ No newline at end of file +}; + +struct TBuiltInResource; +void init_resources(TBuiltInResource &Resources); diff --git a/GPU/Common/ShaderTranslation.cpp b/GPU/Common/ShaderTranslation.cpp index fdf79d5c68..675451fca6 100644 --- a/GPU/Common/ShaderTranslation.cpp +++ b/GPU/Common/ShaderTranslation.cpp @@ -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 #include diff --git a/GPU/Common/SplineCommon.cpp b/GPU/Common/SplineCommon.cpp index f9fae37606..d53b75202f 100644 --- a/GPU/Common/SplineCommon.cpp +++ b/GPU/Common/SplineCommon.cpp @@ -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); diff --git a/GPU/GPU.cpp b/GPU/GPU.cpp index 22147fd940..0cd5c85c49 100644 --- a/GPU/GPU.cpp +++ b/GPU/GPU.cpp @@ -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" diff --git a/GPU/GPU.vcxproj b/GPU/GPU.vcxproj index 281010b16f..ec6a24e1aa 100644 --- a/GPU/GPU.vcxproj +++ b/GPU/GPU.vcxproj @@ -273,6 +273,7 @@ + diff --git a/GPU/GPU.vcxproj.filters b/GPU/GPU.vcxproj.filters index 931b4a97d0..9032efdb16 100644 --- a/GPU/GPU.vcxproj.filters +++ b/GPU/GPU.vcxproj.filters @@ -507,5 +507,8 @@ Common + + Common + \ No newline at end of file diff --git a/GPU/Software/TransformUnit.cpp b/GPU/Software/TransformUnit.cpp index c45bc37c0e..5fd39c6974 100644 --- a/GPU/Software/TransformUnit.cpp +++ b/GPU/Software/TransformUnit.cpp @@ -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" diff --git a/UI/DevScreens.cpp b/UI/DevScreens.cpp index 1a3b236a16..d98e4b4646 100644 --- a/UI/DevScreens.cpp +++ b/UI/DevScreens.cpp @@ -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()))); diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index e8a0327711..5dfe5eeeb2 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -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 -#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; } diff --git a/UI/MainScreen.cpp b/UI/MainScreen.cpp index b014a0888c..b8ccc4042e 100644 --- a/UI/MainScreen.cpp +++ b/UI/MainScreen.cpp @@ -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 diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index f69bea1a87..b2ba6ad4ea 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -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(); diff --git a/Windows/MainWindow.h b/Windows/MainWindow.h index c03b2b2687..17d8a8651e 100644 --- a/Windows/MainWindow.h +++ b/Windows/MainWindow.h @@ -1,11 +1,16 @@ #pragma once +#include "ppsspp_config.h" + +#if !PPSSPP_PLATFORM(UWP) + #include "Common/CommonWindows.h" #include #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 \ No newline at end of file diff --git a/ext/native/ext/jpge/jpge.cpp b/ext/native/ext/jpge/jpge.cpp index d355b4f414..1800e500e9 100644 --- a/ext/native/ext/jpge/jpge.cpp +++ b/ext/native/ext/jpge/jpge.cpp @@ -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 &); diff --git a/ext/native/gfx_es2/draw_text.cpp b/ext/native/gfx_es2/draw_text.cpp index d574f4396b..7fedca678e 100644 --- a/ext/native/gfx_es2/draw_text.cpp +++ b/ext/native/gfx_es2/draw_text.cpp @@ -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 diff --git a/ext/native/gfx_es2/draw_text.h b/ext/native/gfx_es2/draw_text.h index 1d47d76291..12efdf0148 100644 --- a/ext/native/gfx_es2/draw_text.h +++ b/ext/native/gfx_es2/draw_text.h @@ -8,6 +8,8 @@ #pragma once +#include "ppsspp_config.h" + #include #include @@ -80,7 +82,7 @@ private: TextDrawerContext *ctx_; #if defined(USING_QT_UI) std::map fontMap_; -#elif defined(_WIN32) +#elif defined(_WIN32) && !PPSSPP_PLATFORM(UWP) std::map> fontMap_; #endif diff --git a/ext/native/gfx_es2/gpu_features.cpp b/ext/native/gfx_es2/gpu_features.cpp index ca4e48faff..afe59835df 100644 --- a/ext/native/gfx_es2/gpu_features.cpp +++ b/ext/native/gfx_es2/gpu_features.cpp @@ -1,13 +1,20 @@ +#include "ppsspp_config.h" + #include #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) { diff --git a/ext/native/net/http_server.cpp b/ext/native/net/http_server.cpp index 4d55afcdaf..45fb1fe8b4 100644 --- a/ext/native/net/http_server.cpp +++ b/ext/native/net/http_server.cpp @@ -2,7 +2,10 @@ #ifdef _WIN32 +#ifndef NOMINMAX #define NOMINMAX +#endif + #include #include #include diff --git a/ext/native/net/sinks.cpp b/ext/native/net/sinks.cpp index 39339c87b4..aaac2f1888 100644 --- a/ext/native/net/sinks.cpp +++ b/ext/native/net/sinks.cpp @@ -1,6 +1,8 @@ #ifdef _WIN32 +#ifndef NOMINMAX #define NOMINMAX +#endif #include #include #include diff --git a/ext/udis86/udis86.c b/ext/udis86/udis86.c index f957de45ec..ffc45733a3 100644 --- a/ext/udis86/udis86.c +++ b/ext/udis86/udis86.c @@ -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; } } diff --git a/ppsspp_config.h b/ppsspp_config.h index ec4f1659d0..a05ce6fbe7 100644 --- a/ppsspp_config.h +++ b/ppsspp_config.h @@ -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