2017-02-24 19:50:27 +00:00
|
|
|
|
#include "pch.h"
|
|
|
|
|
#include "PPSSPP_UWPMain.h"
|
|
|
|
|
|
|
|
|
|
#include <mutex>
|
|
|
|
|
|
2017-02-27 10:32:40 +00:00
|
|
|
|
#include "base/basictypes.h"
|
2017-02-24 19:50:27 +00:00
|
|
|
|
#include "Common/FileUtil.h"
|
|
|
|
|
#include "Common/Log.h"
|
|
|
|
|
#include "Common/LogManager.h"
|
|
|
|
|
#include "Core/System.h"
|
2017-02-27 10:32:40 +00:00
|
|
|
|
#include "Core/Loaders.h"
|
2017-02-24 19:50:27 +00:00
|
|
|
|
#include "base/NativeApp.h"
|
2017-02-27 10:00:57 +00:00
|
|
|
|
#include "base/timeutil.h"
|
2017-02-24 19:50:27 +00:00
|
|
|
|
#include "input/input_state.h"
|
|
|
|
|
#include "file/vfs.h"
|
|
|
|
|
#include "file/zip_read.h"
|
|
|
|
|
#include "file/file_util.h"
|
2017-02-28 00:47:13 +00:00
|
|
|
|
#include "net/http_client.h"
|
|
|
|
|
#include "net/resolve.h"
|
2017-02-24 19:50:27 +00:00
|
|
|
|
#include "base/display.h"
|
|
|
|
|
#include "util/text/utf8.h"
|
|
|
|
|
#include "Common/DirectXHelper.h"
|
2017-02-27 10:00:57 +00:00
|
|
|
|
#include "NKCodeFromWindowsSystem.h"
|
2017-02-24 19:50:27 +00:00
|
|
|
|
#include "XAudioSoundStream.h"
|
2017-02-27 10:32:40 +00:00
|
|
|
|
#include "UWPHost.h"
|
|
|
|
|
#include "StorageFileLoader.h"
|
2017-02-24 19:50:27 +00:00
|
|
|
|
|
|
|
|
|
using namespace UWP;
|
|
|
|
|
using namespace Windows::Foundation;
|
2017-02-26 14:40:53 +00:00
|
|
|
|
using namespace Windows::Storage;
|
2017-02-27 10:32:40 +00:00
|
|
|
|
using namespace Windows::Storage::Streams;
|
2017-02-24 19:50:27 +00:00
|
|
|
|
using namespace Windows::System::Threading;
|
2017-02-27 10:32:40 +00:00
|
|
|
|
using namespace Windows::ApplicationModel::DataTransfer;
|
2017-02-24 19:50:27 +00:00
|
|
|
|
using namespace Concurrency;
|
|
|
|
|
|
2017-02-27 10:32:40 +00:00
|
|
|
|
// UGLY!
|
|
|
|
|
PPSSPP_UWPMain *g_main;
|
2017-03-01 11:51:06 +00:00
|
|
|
|
extern WindowsAudioBackend *winAudioBackend;
|
2017-02-24 19:50:27 +00:00
|
|
|
|
// TODO: Use Microsoft::WRL::ComPtr<> for D3D11 objects?
|
2017-02-26 14:40:53 +00:00
|
|
|
|
// TODO: See https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/WindowsAudioSession for WASAPI with UWP
|
2017-02-27 10:32:40 +00:00
|
|
|
|
// TODO: Low latency input: https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/LowLatencyInput/cpp
|
2017-02-24 19:50:27 +00:00
|
|
|
|
|
|
|
|
|
// Loads and initializes application assets when the application is loaded.
|
2017-02-27 10:32:40 +00:00
|
|
|
|
PPSSPP_UWPMain::PPSSPP_UWPMain(App ^app, const std::shared_ptr<DX::DeviceResources>& deviceResources) :
|
|
|
|
|
app_(app),
|
2017-02-24 19:50:27 +00:00
|
|
|
|
m_deviceResources(deviceResources)
|
|
|
|
|
{
|
2017-02-27 10:32:40 +00:00
|
|
|
|
g_main = this;
|
|
|
|
|
|
2017-02-28 00:47:13 +00:00
|
|
|
|
net::Init();
|
|
|
|
|
|
2017-02-27 10:32:40 +00:00
|
|
|
|
host = new UWPHost();
|
2017-02-24 19:50:27 +00:00
|
|
|
|
// Register to be notified if the Device is lost or recreated
|
|
|
|
|
m_deviceResources->RegisterDeviceNotify(this);
|
|
|
|
|
|
2017-02-26 14:40:53 +00:00
|
|
|
|
// create_task(KnownFolders::GetFolderForUserAsync(nullptr, KnownFolderId::RemovableDevices)).then([this](StorageFolder ^));
|
|
|
|
|
|
2017-02-24 19:50:27 +00:00
|
|
|
|
// TODO: Change the timer settings if you want something other than the default variable timestep mode.
|
|
|
|
|
// e.g. for 60 FPS fixed timestep update logic, call:
|
|
|
|
|
/*
|
|
|
|
|
m_timer.SetFixedTimeStep(true);
|
|
|
|
|
m_timer.SetTargetElapsedSeconds(1.0 / 60);
|
|
|
|
|
*/
|
|
|
|
|
|
2017-02-27 09:28:57 +00:00
|
|
|
|
ctx_.reset(new UWPGraphicsContext(deviceResources));
|
2017-02-24 19:50:27 +00:00
|
|
|
|
|
|
|
|
|
const std::string &exePath = File::GetExeDirectory();
|
|
|
|
|
VFSRegister("", new DirectoryAssetReader((exePath + "/Content/").c_str()));
|
|
|
|
|
VFSRegister("", new DirectoryAssetReader(exePath.c_str()));
|
|
|
|
|
|
|
|
|
|
wchar_t lcCountry[256];
|
|
|
|
|
|
|
|
|
|
std::string langRegion;
|
|
|
|
|
if (0 != GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT, LOCALE_SNAME, lcCountry, 256)) {
|
|
|
|
|
langRegion = ConvertWStringToUTF8(lcCountry);
|
|
|
|
|
for (size_t i = 0; i < langRegion.size(); i++) {
|
|
|
|
|
if (langRegion[i] == '-')
|
|
|
|
|
langRegion[i] = '_';
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
langRegion = "en_US";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char configFilename[MAX_PATH] = { 0 };
|
|
|
|
|
char controlsConfigFilename[MAX_PATH] = { 0 };
|
|
|
|
|
|
2017-02-28 00:47:13 +00:00
|
|
|
|
std::wstring memstickFolderW = ApplicationData::Current->LocalFolder->Path->Data();
|
|
|
|
|
|
|
|
|
|
g_Config.memStickDirectory = ReplaceAll(ConvertWStringToUTF8(memstickFolderW), "\\", "/");
|
|
|
|
|
if (g_Config.memStickDirectory.back() != '/')
|
|
|
|
|
g_Config.memStickDirectory += "/";
|
|
|
|
|
|
2017-02-24 19:50:27 +00:00
|
|
|
|
// On Win32 it makes more sense to initialize the system directories here
|
|
|
|
|
// because the next place it was called was in the EmuThread, and it's too late by then.
|
|
|
|
|
InitSysDirectories();
|
|
|
|
|
|
|
|
|
|
// Load config up here, because those changes below would be overwritten
|
|
|
|
|
// if it's not loaded here first.
|
|
|
|
|
g_Config.AddSearchPath(GetSysDirectory(DIRECTORY_SYSTEM));
|
|
|
|
|
g_Config.SetDefaultPath(GetSysDirectory(DIRECTORY_SYSTEM));
|
|
|
|
|
g_Config.Load(configFilename, controlsConfigFilename);
|
|
|
|
|
|
|
|
|
|
bool debugLogLevel = false;
|
|
|
|
|
|
|
|
|
|
g_Config.iGPUBackend = GPU_BACKEND_DIRECT3D11;
|
2017-02-27 10:32:40 +00:00
|
|
|
|
g_Config.bSeparateCPUThread = false;
|
2017-02-24 19:50:27 +00:00
|
|
|
|
|
|
|
|
|
#ifdef _DEBUG
|
|
|
|
|
g_Config.bEnableLogging = true;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
LogManager::Init();
|
|
|
|
|
|
2017-02-28 00:47:13 +00:00
|
|
|
|
if (debugLogLevel) {
|
2017-02-24 19:50:27 +00:00
|
|
|
|
LogManager::GetInstance()->SetAllLogLevels(LogTypes::LDEBUG);
|
2017-02-28 00:47:13 +00:00
|
|
|
|
}
|
2017-02-24 19:50:27 +00:00
|
|
|
|
|
|
|
|
|
const char *argv[2] = { "fake", nullptr };
|
|
|
|
|
|
2017-02-28 00:47:13 +00:00
|
|
|
|
|
|
|
|
|
std::string cacheFolder = ConvertWStringToUTF8(ApplicationData::Current->LocalFolder->Path->Data());
|
|
|
|
|
|
|
|
|
|
NativeInit(1, argv, "", "", cacheFolder.c_str(), false);
|
2017-02-24 19:50:27 +00:00
|
|
|
|
|
2017-02-27 09:28:57 +00:00
|
|
|
|
NativeInitGraphics(ctx_.get());
|
2017-02-26 14:40:53 +00:00
|
|
|
|
NativeResized();
|
2017-02-27 09:28:57 +00:00
|
|
|
|
|
|
|
|
|
int width = m_deviceResources->GetScreenViewport().Width;
|
|
|
|
|
int height = m_deviceResources->GetScreenViewport().Height;
|
|
|
|
|
|
|
|
|
|
ctx_->GetDrawContext()->HandleEvent(Draw::Event::GOT_BACKBUFFER, width, height, m_deviceResources->GetBackBufferRenderTargetView());
|
2017-02-24 19:50:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PPSSPP_UWPMain::~PPSSPP_UWPMain() {
|
2017-02-27 09:28:57 +00:00
|
|
|
|
ctx_->GetDrawContext()->HandleEvent(Draw::Event::LOST_BACKBUFFER, 0, 0, nullptr);
|
2017-02-24 19:50:27 +00:00
|
|
|
|
NativeShutdownGraphics();
|
|
|
|
|
NativeShutdown();
|
|
|
|
|
|
|
|
|
|
// Deregister device notification
|
|
|
|
|
m_deviceResources->RegisterDeviceNotify(nullptr);
|
2017-02-28 00:47:13 +00:00
|
|
|
|
net::Shutdown();
|
2017-02-24 19:50:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Updates application state when the window size changes (e.g. device orientation change)
|
|
|
|
|
void PPSSPP_UWPMain::CreateWindowSizeDependentResources() {
|
|
|
|
|
// TODO: Replace this with the size-dependent initialization of your app's content.
|
|
|
|
|
NativeResized();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Renders the current frame according to the current application state.
|
|
|
|
|
// Returns true if the frame was rendered and is ready to be displayed.
|
|
|
|
|
bool PPSSPP_UWPMain::Render() {
|
2017-03-16 13:44:22 +00:00
|
|
|
|
ctx_->GetDrawContext()->HandleEvent(Draw::Event::PRESENTED, 0, 0, nullptr, nullptr);
|
2017-02-27 10:32:40 +00:00
|
|
|
|
NativeUpdate();
|
2017-02-27 10:00:57 +00:00
|
|
|
|
|
|
|
|
|
time_update();
|
2017-02-24 19:50:27 +00:00
|
|
|
|
auto context = m_deviceResources->GetD3DDeviceContext();
|
|
|
|
|
|
|
|
|
|
// Reset the viewport to target the whole screen.
|
|
|
|
|
auto viewport = m_deviceResources->GetScreenViewport();
|
|
|
|
|
|
|
|
|
|
pixel_xres = viewport.Width;
|
|
|
|
|
pixel_yres = viewport.Height;
|
|
|
|
|
|
|
|
|
|
g_dpi = m_deviceResources->GetDpi();
|
|
|
|
|
g_dpi_scale = 96.0f / g_dpi;
|
|
|
|
|
|
|
|
|
|
pixel_in_dps = 1.0f / g_dpi_scale;
|
|
|
|
|
|
|
|
|
|
dp_xres = pixel_xres * g_dpi_scale;
|
|
|
|
|
dp_yres = pixel_yres * g_dpi_scale;
|
|
|
|
|
|
|
|
|
|
context->RSSetViewports(1, &viewport);
|
|
|
|
|
|
2017-02-27 10:00:57 +00:00
|
|
|
|
ctx_->GetDrawContext()->BindBackbufferAsRenderTarget();
|
2017-02-24 19:50:27 +00:00
|
|
|
|
|
2017-02-27 09:28:57 +00:00
|
|
|
|
NativeRender(ctx_.get());
|
2017-02-24 19:50:27 +00:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Notifies renderers that device resources need to be released.
|
|
|
|
|
void PPSSPP_UWPMain::OnDeviceLost() {
|
2017-02-27 09:28:57 +00:00
|
|
|
|
ctx_->GetDrawContext()->HandleEvent(Draw::Event::LOST_DEVICE, 0, 0, nullptr);
|
2017-02-24 19:50:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Notifies renderers that device resources may now be recreated.
|
2017-02-27 09:28:57 +00:00
|
|
|
|
void PPSSPP_UWPMain::OnDeviceRestored() {
|
2017-02-24 19:50:27 +00:00
|
|
|
|
CreateWindowSizeDependentResources();
|
2017-02-26 14:40:53 +00:00
|
|
|
|
|
2017-02-27 09:28:57 +00:00
|
|
|
|
ctx_->GetDrawContext()->HandleEvent(Draw::Event::GOT_DEVICE, 0, 0, nullptr);
|
2017-02-24 19:50:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-02-27 10:00:57 +00:00
|
|
|
|
void PPSSPP_UWPMain::OnKeyDown(int scanCode, Windows::System::VirtualKey virtualKey, int repeatCount) {
|
|
|
|
|
auto iter = virtualKeyCodeToNKCode.find(virtualKey);
|
|
|
|
|
if (iter != virtualKeyCodeToNKCode.end()) {
|
|
|
|
|
KeyInput key{};
|
|
|
|
|
key.deviceId = DEVICE_ID_KEYBOARD;
|
|
|
|
|
key.keyCode = iter->second;
|
|
|
|
|
key.flags = KEY_DOWN | (repeatCount > 1 ? KEY_IS_REPEAT : 0);
|
|
|
|
|
NativeKey(key);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PPSSPP_UWPMain::OnKeyUp(int scanCode, Windows::System::VirtualKey virtualKey) {
|
|
|
|
|
auto iter = virtualKeyCodeToNKCode.find(virtualKey);
|
|
|
|
|
if (iter != virtualKeyCodeToNKCode.end()) {
|
|
|
|
|
KeyInput key{};
|
|
|
|
|
key.deviceId = DEVICE_ID_KEYBOARD;
|
|
|
|
|
key.keyCode = iter->second;
|
|
|
|
|
key.flags = KEY_UP;
|
|
|
|
|
NativeKey(key);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-01 22:40:52 +00:00
|
|
|
|
void PPSSPP_UWPMain::OnMouseWheel(float delta) {
|
|
|
|
|
int key = NKCODE_EXT_MOUSEWHEEL_UP;
|
|
|
|
|
if (delta < 0) {
|
|
|
|
|
key = NKCODE_EXT_MOUSEWHEEL_DOWN;
|
|
|
|
|
} else if (delta == 0) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
KeyInput keyInput{};
|
|
|
|
|
keyInput.keyCode = key;
|
|
|
|
|
keyInput.deviceId = DEVICE_ID_MOUSE;
|
|
|
|
|
keyInput.flags = KEY_DOWN | KEY_UP;
|
|
|
|
|
NativeKey(keyInput);
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-27 10:32:40 +00:00
|
|
|
|
void PPSSPP_UWPMain::OnTouchEvent(int touchEvent, int touchId, float x, float y, double timestamp) {
|
|
|
|
|
// It appears that Windows' touchIds start from 1. Let's fix that.
|
|
|
|
|
touchId--;
|
|
|
|
|
|
|
|
|
|
TouchInput input{};
|
|
|
|
|
input.id = touchId;
|
|
|
|
|
input.x = x;
|
|
|
|
|
input.y = y;
|
|
|
|
|
input.flags = touchEvent;
|
|
|
|
|
input.timestamp = timestamp;
|
|
|
|
|
NativeTouch(input);
|
|
|
|
|
|
|
|
|
|
KeyInput key{};
|
|
|
|
|
key.deviceId = DEVICE_ID_MOUSE;
|
|
|
|
|
if (touchEvent & TOUCH_DOWN) {
|
|
|
|
|
key.keyCode = NKCODE_EXT_MOUSEBUTTON_1;
|
|
|
|
|
key.flags = KEY_DOWN;
|
|
|
|
|
NativeKey(key);
|
|
|
|
|
}
|
|
|
|
|
if (touchEvent & TOUCH_UP) {
|
|
|
|
|
key.keyCode = NKCODE_EXT_MOUSEBUTTON_1;
|
|
|
|
|
key.flags = KEY_UP;
|
|
|
|
|
NativeKey(key);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PPSSPP_UWPMain::OnSuspend() {
|
|
|
|
|
// TODO
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PPSSPP_UWPMain::LoadStorageFile(StorageFile ^file) {
|
|
|
|
|
OverrideNextLoader(new StorageFileLoader(file), FILETYPE_PSP_ISO);
|
|
|
|
|
NativeMessageReceived("boot", "override://");
|
|
|
|
|
}
|
2017-02-27 10:00:57 +00:00
|
|
|
|
|
2017-02-24 19:50:27 +00:00
|
|
|
|
UWPGraphicsContext::UWPGraphicsContext(std::shared_ptr<DX::DeviceResources> resources) {
|
2017-02-27 09:28:57 +00:00
|
|
|
|
draw_ = Draw::T3DCreateD3D11Context(resources->GetD3DDevice(), resources->GetD3DDeviceContext(), resources->GetD3DDevice(), resources->GetD3DDeviceContext(), 0);
|
2017-02-24 19:50:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UWPGraphicsContext::Shutdown() {
|
2017-02-27 09:28:57 +00:00
|
|
|
|
delete draw_;
|
2017-02-24 19:50:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UWPGraphicsContext::SwapInterval(int interval) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string System_GetProperty(SystemProperty prop) {
|
|
|
|
|
static bool hasCheckedGPUDriverVersion = false;
|
|
|
|
|
switch (prop) {
|
|
|
|
|
case SYSPROP_NAME:
|
2017-02-27 10:32:40 +00:00
|
|
|
|
return "Windows 10 Universal";
|
2017-02-24 19:50:27 +00:00
|
|
|
|
case SYSPROP_LANGREGION:
|
|
|
|
|
return "en_US"; // TODO UWP
|
|
|
|
|
case SYSPROP_CLIPBOARD_TEXT:
|
2017-02-27 10:32:40 +00:00
|
|
|
|
/* TODO: Need to either change this API or do this on a thread in an ugly fashion.
|
|
|
|
|
DataPackageView ^view = Clipboard::GetContent();
|
|
|
|
|
if (view) {
|
|
|
|
|
string text = await view->GetTextAsync();
|
|
|
|
|
}
|
|
|
|
|
*/
|
2017-02-24 19:50:27 +00:00
|
|
|
|
return "";
|
|
|
|
|
case SYSPROP_GPUDRIVER_VERSION:
|
|
|
|
|
return "";
|
|
|
|
|
default:
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int System_GetPropertyInt(SystemProperty prop) {
|
|
|
|
|
switch (prop) {
|
|
|
|
|
case SYSPROP_AUDIO_SAMPLE_RATE:
|
2017-03-01 11:51:06 +00:00
|
|
|
|
return winAudioBackend ? winAudioBackend->GetSampleRate() : -1;
|
2017-02-24 19:50:27 +00:00
|
|
|
|
case SYSPROP_DISPLAY_REFRESH_RATE:
|
|
|
|
|
return 60000;
|
|
|
|
|
case SYSPROP_DEVICE_TYPE:
|
|
|
|
|
return DEVICE_TYPE_DESKTOP;
|
2017-02-27 10:32:40 +00:00
|
|
|
|
case SYSPROP_HAS_FILE_BROWSER:
|
|
|
|
|
return true;
|
2017-02-24 19:50:27 +00:00
|
|
|
|
default:
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void System_SendMessage(const char *command, const char *parameter) {
|
2017-02-27 10:32:40 +00:00
|
|
|
|
using namespace concurrency;
|
|
|
|
|
|
|
|
|
|
if (!strcmp(command, "finish")) {
|
|
|
|
|
// Not really supposed to support this under UWP.
|
|
|
|
|
} else if (!strcmp(command, "browse_file")) {
|
|
|
|
|
auto picker = ref new Windows::Storage::Pickers::FileOpenPicker();
|
|
|
|
|
picker->ViewMode = Pickers::PickerViewMode::List;
|
|
|
|
|
picker->FileTypeFilter->Append(".cso");
|
|
|
|
|
picker->FileTypeFilter->Append(".iso");
|
|
|
|
|
picker->FileTypeFilter->Append(".bin");
|
2017-02-28 00:47:13 +00:00
|
|
|
|
picker->SuggestedStartLocation = Pickers::PickerLocationId::DocumentsLibrary;
|
2017-02-27 10:32:40 +00:00
|
|
|
|
|
|
|
|
|
create_task(picker->PickSingleFileAsync()).then([](StorageFile ^file){
|
|
|
|
|
g_main->LoadStorageFile(file);
|
|
|
|
|
/*
|
|
|
|
|
std::thread([file] {
|
|
|
|
|
create_task(file->OpenReadAsync()).then([](IRandomAccessStreamWithContentType^ imgStream) {
|
|
|
|
|
imgStream->Seek(0);
|
|
|
|
|
IBuffer ^buffer = ref new Streams::Buffer(2048);
|
|
|
|
|
auto readTask = create_task(imgStream->ReadAsync(buffer, 2048, InputStreamOptions::None));
|
|
|
|
|
readTask.wait();
|
|
|
|
|
});
|
|
|
|
|
}).detach();
|
|
|
|
|
*/
|
|
|
|
|
});
|
|
|
|
|
}
|
2017-02-24 19:50:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LaunchBrowser(const char *url) {
|
2017-02-27 10:32:40 +00:00
|
|
|
|
Platform::String ^pstr = ref new Platform::String(ConvertUTF8ToWString(url).c_str());
|
|
|
|
|
auto uri = ref new Windows::Foundation::Uri(pstr);
|
|
|
|
|
|
|
|
|
|
create_task(Windows::System::Launcher::LaunchUriAsync(uri)).then([](bool b) {});
|
2017-02-24 19:50:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Vibrate(int length_ms) {
|
2017-02-28 00:47:13 +00:00
|
|
|
|
#if _M_ARM
|
|
|
|
|
if (length_ms == -1 || length_ms == -3)
|
|
|
|
|
length_ms = 50;
|
|
|
|
|
else if (length_ms == -2)
|
|
|
|
|
length_ms = 25;
|
|
|
|
|
else
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
auto timeSpan = Windows::Foundation::TimeSpan();
|
|
|
|
|
timeSpan.Duration = length_ms * 10000;
|
|
|
|
|
Windows::Phone::Devices::Notification::VibrationDevice::GetDefault()->Vibrate(timeSpan);
|
|
|
|
|
#endif
|
2017-02-24 19:50:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-02-27 10:32:40 +00:00
|
|
|
|
void System_AskForPermission(SystemPermission permission) {
|
|
|
|
|
// Do nothing
|
|
|
|
|
}
|
2017-02-24 19:50:27 +00:00
|
|
|
|
|
|
|
|
|
PermissionStatus System_GetPermissionStatus(SystemPermission permission) {
|
|
|
|
|
return PERMISSION_STATUS_GRANTED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool System_InputBoxGetString(const char *title, const char *defaultValue, char *outValue, size_t outLength) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool System_InputBoxGetWString(const wchar_t *title, const std::wstring &defaultvalue, std::wstring &outvalue) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|