Additional UWP preparations

This commit is contained in:
Henrik Rydgard 2017-02-24 20:50:27 +01:00
parent f5fa238e22
commit fa80cfa4aa
15 changed files with 69 additions and 101 deletions

View File

@ -35,7 +35,6 @@
#include "md5.h"
#include <string.h>
#include <stdio.h>
/*
* 32-bit integer manipulation macros (little endian)
@ -291,38 +290,6 @@ void md5( unsigned char *input, int ilen, unsigned char output[16] )
memset( &ctx, 0, sizeof( md5_context ) );
}
/*
* output = MD5( file contents )
*/
int md5_file( char *path, unsigned char output[16] )
{
FILE *f;
size_t n;
md5_context ctx;
unsigned char buf[1024];
if( ( f = fopen( path, "rb" ) ) == NULL )
return( 1 );
md5_starts( &ctx );
while( ( n = fread( buf, 1, sizeof( buf ), f ) ) > 0 )
md5_update( &ctx, buf, (int) n );
md5_finish( &ctx, output );
memset( &ctx, 0, sizeof( md5_context ) );
if( ferror( f ) != 0 )
{
fclose( f );
return( 2 );
}
fclose( f );
return( 0 );
}
/*
* MD5 HMAC context setup
*/

View File

@ -325,38 +325,6 @@ void sha1( unsigned char *input, int ilen, unsigned char output[20] )
memset( &ctx, 0, sizeof( sha1_context ) );
}
/*
* output = SHA-1( file contents )
*/
int sha1_file( char *path, unsigned char output[20] )
{
FILE *f;
size_t n;
sha1_context ctx;
unsigned char buf[1024];
if( ( f = fopen( path, "rb" ) ) == NULL )
return( 1 );
sha1_starts( &ctx );
while( ( n = fread( buf, 1, sizeof( buf ), f ) ) > 0 )
sha1_update( &ctx, buf, (int) n );
sha1_finish( &ctx, output );
memset( &ctx, 0, sizeof( sha1_context ) );
if( ferror( f ) != 0 )
{
fclose( f );
return( 2 );
}
fclose( f );
return( 0 );
}
/*
* SHA-1 HMAC context setup
*/

View File

@ -35,6 +35,25 @@ bool DoesVersionMatchWindows(uint32_t major, uint32_t minor, uint32_t spMajor, u
#endif
}
bool IsVistaOrHigher() {
#if PPSSPP_PLATFORM(UWP)
return true;
#else
OSVERSIONINFOEX osvi;
DWORDLONG dwlConditionMask = 0;
int op = VER_GREATER_EQUAL;
ZeroMemory(&osvi, sizeof(osvi));
osvi.dwOSVersionInfoSize = sizeof(osvi);
osvi.dwMajorVersion = 6; // Vista is 6.0
osvi.dwMinorVersion = 0;
VER_SET_CONDITION(dwlConditionMask, VER_MAJORVERSION, op);
VER_SET_CONDITION(dwlConditionMask, VER_MINORVERSION, op);
return VerifyVersionInfo(&osvi, VER_MAJORVERSION | VER_MINORVERSION, dwlConditionMask) != FALSE;
#endif
}
std::string GetWindowsVersion() {
const bool IsWindowsXPSP2 = DoesVersionMatchWindows(5, 1, 2, 0, false);
const bool IsWindowsXPSP3 = DoesVersionMatchWindows(5, 1, 3, 0, false);

View File

@ -4,6 +4,7 @@
#ifdef _MSC_VER
bool IsVistaOrHigher();
bool DoesVersionMatchWindows(uint32_t major, uint32_t minor, uint32_t spMajor, uint32_t spMinor, bool acceptGreater);
std::string GetWindowsVersion();
std::string GetWindowsSystemArchitecture();

View File

@ -1,6 +1,7 @@
#pragma once
#include <string>
#include <cstring>
#include <cstdint>
#include "base/basictypes.h"

View File

@ -19,7 +19,7 @@
#include <algorithm>
#include "profiler/profiler.h"
#include "gfx/gl_common.h"
#include "gfx_es2/glsl_program.h"
#include "thin3d/thin3d.h"

View File

@ -21,7 +21,6 @@
#include <set>
#include <algorithm>
#include "gfx/gl_common.h"
#include "ext/native/thin3d/thin3d.h"
// Keeps track of allocated FBOs.
// Also provides facilities for drawing and later converting raw
@ -40,7 +39,7 @@ class ShaderManagerGLES;
// Simple struct for asynchronous PBO readbacks
struct AsyncPBO {
GLuint handle;
uint32_t handle;
u32 maxSize;
u32 fb_address;

View File

@ -15,6 +15,8 @@
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "ppsspp_config.h"
#include <algorithm>
#include "base/display.h"
@ -69,9 +71,12 @@
#include "UI/InstallZipScreen.h"
#include "UI/ProfilerDraw.h"
#ifdef _WIN32
#if defined(_WIN32) && !PPSSPP_PLATFORM(UWP)
#include "Windows/MainWindow.h"
#endif
#if !PPSSPP_PLATFORM(UWP)
#include "gfx/gl_common.h"
#endif
#ifndef MOBILE_DEVICE
AVIDump avi;
@ -150,15 +155,16 @@ void EmuScreen::bootGame(const std::string &filename) {
coreParam.cpuCore = (CPUCore)g_Config.iCpuCore;
coreParam.gpuCore = GPUCORE_GLES;
switch (GetGPUBackend()) {
case GPUBackend::DIRECT3D11:
coreParam.gpuCore = GPUCORE_DIRECTX11;
break;
#if !PPSSPP_PLATFORM(UWP)
case GPUBackend::OPENGL:
coreParam.gpuCore = GPUCORE_GLES;
break;
case GPUBackend::DIRECT3D9:
coreParam.gpuCore = GPUCORE_DIRECTX9;
break;
case GPUBackend::DIRECT3D11:
coreParam.gpuCore = GPUCORE_DIRECTX11;
break;
case GPUBackend::VULKAN:
coreParam.gpuCore = GPUCORE_VULKAN;
if (g_Config.iRenderingMode != FB_NON_BUFFERED_MODE) {
@ -172,6 +178,7 @@ void EmuScreen::bootGame(const std::string &filename) {
#endif
}
break;
#endif
}
if (g_Config.bSoftwareRendering) {
coreParam.gpuCore = GPUCORE_SOFTWARE;
@ -228,6 +235,7 @@ void EmuScreen::bootComplete() {
#endif
memset(virtKeys, 0, sizeof(virtKeys));
#if !PPSSPP_PLATFORM(UWP)
if (GetGPUBackend() == GPUBackend::OPENGL) {
const char *renderer = (const char*)glGetString(GL_RENDERER);
if (strstr(renderer, "Chainfire3D") != 0) {
@ -240,6 +248,7 @@ void EmuScreen::bootComplete() {
osm.Show("WARNING: GfxDebugOutput is enabled via ppsspp.ini. Things may be slow.", 10.0f, 0xFF30a0FF, -1, true);
}
}
#endif
if (Core_GetPowerSaving()) {
I18NCategory *sy = GetI18NCategory("System");

View File

@ -16,6 +16,8 @@
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include <algorithm>
#include "ppsspp_config.h"
#include "base/colorutil.h"
#include "base/timeutil.h"
#include "gfx_es2/draw_buffer.h"
@ -253,7 +255,7 @@ void GameScreen::update(InputState &input) {
}
UI::EventReturn GameScreen::OnShowInFolder(UI::EventParams &e) {
#ifdef _WIN32
#if defined(_WIN32) && !PPSSPP_PLATFORM(UWP)
std::string str = std::string("explorer.exe /select,\"") + ReplaceAll(gamePath_, "/", "\\") + "\"";
_wsystem(ConvertUTF8ToWString(str).c_str());
#endif

View File

@ -15,6 +15,8 @@
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "ppsspp_config.h"
#include "base/display.h" // Only to check screen aspect ratio with pixel_yres/pixel_xres
#include "base/colorutil.h"
@ -59,8 +61,10 @@
#include <shlobj.h>
#include "util/text/utf8.h"
#include "Windows/W32Util/ShellUtil.h"
#include "Windows/W32Util/Misc.h"
#endif
#if !PPSSPP_PLATFORM(UWP)
#include "gfx/gl_common.h"
#endif
#ifdef IOS
@ -80,6 +84,10 @@ bool GameSettingsScreen::UseVerticalLayout() const {
// This needs before run CheckGPUFeatures()
// TODO: Remove this if fix the issue
bool CheckSupportInstancedTessellation() {
#if PPSSPP_PLATFORM(UWP)
return true;
#else
// TODO: Make work with non-GL backends
int maxVertexTextureImageUnits;
glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &maxVertexTextureImageUnits);
bool vertexTexture = maxVertexTextureImageUnits >= 3; // At least 3 for hardware tessellation
@ -88,6 +96,7 @@ bool CheckSupportInstancedTessellation() {
bool textureFloat = gl_extensions.ARB_texture_float || gl_extensions.OES_texture_float || gl_extensions.OES_texture_half_float;
return instanceRendering && vertexTexture && textureFloat;
#endif
}
void GameSettingsScreen::CreateViews() {
@ -647,7 +656,7 @@ void GameSettingsScreen::CreateViews() {
#if defined(USING_WIN_UI)
systemSettings->Add(new CheckBox(&g_Config.bBypassOSKWithKeyboard, sy->T("Enable Windows native keyboard", "Enable Windows native keyboard")));
#endif
#if defined(_WIN32)
#if defined(_WIN32) && !PPSSPP_PLATFORM(UWP)
SavePathInMyDocumentChoice = systemSettings->Add(new CheckBox(&installed_, sy->T("Save path in My Documents", "Save path in My Documents")));
SavePathInMyDocumentChoice->OnClick.Handle(this, &GameSettingsScreen::OnSavePathMydoc);
SavePathInOtherChoice = systemSettings->Add(new CheckBox(&otherinstalled_, sy->T("Save path in installed.txt", "Save path in installed.txt")));
@ -809,7 +818,7 @@ UI::EventReturn GameSettingsScreen::OnJitAffectingSetting(UI::EventParams &e) {
return UI::EVENT_DONE;
}
#ifdef _WIN32
#if defined(_WIN32) && !PPSSPP_PLATFORM(UWP)
UI::EventReturn GameSettingsScreen::OnSavePathMydoc(UI::EventParams &e) {
const std::string PPSSPPpath = File::GetExeDirectory();
@ -987,7 +996,7 @@ void GlobalSettingsScreen::CreateViews() {
}*/
void GameSettingsScreen::CallbackRenderingBackend(bool yes) {
#if defined(_WIN32)
#if defined(_WIN32) && !PPSSPP_PLATFORM(UWP)
// If the user ends up deciding not to restart, set the config back to the current backend
// so it doesn't get switched by accident.
if (yes) {

View File

@ -23,6 +23,7 @@
//
// Windows has its own code that bypasses the framework entirely.
#include "ppsspp_config.h"
// Background worker threads should be spawned in NativeInit and joined
// in NativeShutdown.
@ -268,7 +269,7 @@ void NativeGetAppInfo(std::string *app_dir_name, std::string *app_nice_name, boo
#endif
}
#ifdef _WIN32
#if defined(_WIN32) && !PPSSPP_PLATFORM(UWP)
bool CheckFontIsUsable(const wchar_t *fontFace) {
wchar_t actualFontFace[1024] = { 0 };
@ -481,7 +482,7 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch
// Note to translators: do not translate this/add this to PPSSPP-lang's files.
// It's intended to be custom for every user.
// Only add it to your own personal copies of PPSSPP.
#ifdef _WIN32
#if defined(_WIN32) && !PPSSPP_PLATFORM(UWP)
// TODO: Could allow a setting to specify a font file to load?
// TODO: Make this a constant if we can sanely load the font on other systems?
AddFontResourceEx(L"assets/Roboto-Condensed.ttf", FR_PRIVATE, NULL);
@ -535,7 +536,7 @@ void NativeInitGraphics(GraphicsContext *graphicsContext) {
// memset(&ui_theme, 0, sizeof(ui_theme));
// New style theme
#ifdef _WIN32
#if defined(_WIN32) && !PPSSPP_PLATFORM(UWP)
ui_theme.uiFont = UI::FontStyle(UBUNTU24, g_Config.sFont.c_str(), 22);
ui_theme.uiFontSmall = UI::FontStyle(UBUNTU24, g_Config.sFont.c_str(), 15);
ui_theme.uiFontSmaller = UI::FontStyle(UBUNTU24, g_Config.sFont.c_str(), 12);
@ -582,7 +583,7 @@ void NativeInitGraphics(GraphicsContext *graphicsContext) {
if (!uiTexture) {
PanicAlert("Failed to load ui_atlas.zim.\n\nPlace it in the directory \"assets\" under your PPSSPP directory.");
ELOG("Failed to load ui_atlas.zim");
#ifdef _WIN32
#if defined(_WIN32) && !PPSSPP_PLATFORM(UWP)
UINT ExitCode = 0;
ExitProcess(ExitCode);
#endif
@ -1046,7 +1047,7 @@ void NativeShutdown() {
exit(0);
#endif
#ifdef _WIN32
#if defined(_WIN32) && !PPSSPP_PLATFORM(UWP)
RemoveFontResourceEx(L"assets/Roboto-Condensed.ttf", FR_PRIVATE, NULL);
#endif
}

View File

@ -4,9 +4,11 @@
#include <process.h>
#include "thread/threadutil.h"
#include "Common/OSVersion.h"
#include "Core/Reporting.h"
#include "Core/Util/AudioFormat.h"
#include "Windows/W32Util/Misc.h"
#include "Common/OSVersion.h"
#include "dsoundstream.h"

View File

@ -9,6 +9,7 @@
#include "Core/Config.h"
#include "Core/Reporting.h"
#include "Common/OSVersion.h"
#include "Windows/GPU/D3D9Context.h"
#include "Windows/W32Util/Misc.h"
#include "thin3d/thin3d.h"

View File

@ -1,4 +1,5 @@
#include "stdafx.h"
#include "ppsspp_config.h"
#include "CommonWindows.h"
#include <WinUser.h>
@ -8,19 +9,12 @@
#include "Misc.h"
#include "util/text/utf8.h"
bool IsVistaOrHigher() {
OSVERSIONINFOEX osvi;
DWORDLONG dwlConditionMask = 0;
int op = VER_GREATER_EQUAL;
ZeroMemory(&osvi, sizeof(osvi));
osvi.dwOSVersionInfoSize = sizeof(osvi);
osvi.dwMajorVersion = 6; // Vista is 6.0
osvi.dwMinorVersion = 0;
VER_SET_CONDITION(dwlConditionMask, VER_MAJORVERSION, op);
VER_SET_CONDITION(dwlConditionMask, VER_MINORVERSION, op);
return VerifyVersionInfo(&osvi, VER_MAJORVERSION | VER_MINORVERSION, dwlConditionMask) != FALSE;
bool KeyDownAsync(int vkey) {
#if PPSSPP_PLATFORM(UWP)
return 0;
#else
return (GetAsyncKeyState(vkey) & 0x8000) != 0;
#endif
}
namespace W32Util

View File

@ -2,8 +2,6 @@
#include "Common/CommonWindows.h"
bool IsVistaOrHigher();
namespace W32Util
{
void CenterWindow(HWND hwnd);
@ -36,10 +34,7 @@ struct GenericListViewDef
// the most significant bit states whether the key is currently down.
// simply checking if it's != 0 is not enough, as bit0 is set if
// the key was pressed between the last call to GetAsyncKeyState
inline bool KeyDownAsync(int vkey)
{
return (GetAsyncKeyState(vkey) & 0x8000) != 0;
}
bool KeyDownAsync(int vkey);
class GenericListControl
{