2018-02-05 15:21:39 +00:00
|
|
|
#include "pch.h"
|
2017-02-24 19:50:27 +00:00
|
|
|
#include "PPSSPP_UWPMain.h"
|
|
|
|
|
|
|
|
#include <mutex>
|
2023-03-24 18:57:24 +00:00
|
|
|
#include <list>
|
|
|
|
#include <memory>
|
2017-02-24 19:50:27 +00:00
|
|
|
|
2020-10-04 18:48:47 +00:00
|
|
|
#include "Common/File/FileUtil.h"
|
|
|
|
#include "Common/Net/HTTPClient.h"
|
|
|
|
#include "Common/Net/Resolve.h"
|
2020-10-04 21:24:14 +00:00
|
|
|
#include "Common/GPU/thin3d_create.h"
|
2020-08-15 18:53:08 +00:00
|
|
|
|
2020-09-29 10:44:47 +00:00
|
|
|
#include "Common/Common.h"
|
2020-10-03 22:25:21 +00:00
|
|
|
#include "Common/Input/InputState.h"
|
|
|
|
#include "Common/File/VFS/VFS.h"
|
2023-03-06 14:30:39 +00:00
|
|
|
#include "Common/File/VFS/DirectoryReader.h"
|
2020-10-03 22:25:21 +00:00
|
|
|
#include "Common/Thread/ThreadUtil.h"
|
|
|
|
#include "Common/Data/Encoding/Utf8.h"
|
2017-02-24 19:50:27 +00:00
|
|
|
#include "Common/DirectXHelper.h"
|
2020-10-04 18:48:47 +00:00
|
|
|
#include "Common/File/FileUtil.h"
|
2020-08-15 18:53:08 +00:00
|
|
|
#include "Common/Log.h"
|
|
|
|
#include "Common/LogManager.h"
|
|
|
|
#include "Common/TimeUtil.h"
|
2020-09-29 19:58:58 +00:00
|
|
|
#include "Common/StringUtils.h"
|
2020-10-04 08:30:18 +00:00
|
|
|
#include "Common/System/Display.h"
|
|
|
|
#include "Common/System/NativeApp.h"
|
2023-03-22 14:35:21 +00:00
|
|
|
#include "Common/System/Request.h"
|
2020-08-15 18:53:08 +00:00
|
|
|
|
|
|
|
#include "Core/System.h"
|
|
|
|
#include "Core/Loaders.h"
|
|
|
|
#include "Core/Config.h"
|
|
|
|
|
2023-03-24 18:57:24 +00:00
|
|
|
#include "Windows/InputDevice.h"
|
2023-03-24 22:28:30 +00:00
|
|
|
#include "Windows/XinputDevice.h"
|
2017-02-27 10:00:57 +00:00
|
|
|
#include "NKCodeFromWindowsSystem.h"
|
2017-02-24 19:50:27 +00:00
|
|
|
#include "XAudioSoundStream.h"
|
2017-03-02 16:07:12 +00:00
|
|
|
#include "UWPUtil.h"
|
2017-03-07 09:33:53 +00:00
|
|
|
#include "App.h"
|
2017-02-24 19:50:27 +00:00
|
|
|
|
2023-04-28 19:22:17 +00:00
|
|
|
// UWP Storage helper includes
|
|
|
|
#include "UWPHelpers/StorageManager.h"
|
|
|
|
#include "UWPHelpers/StorageAsync.h"
|
|
|
|
#include <UWPHelpers/LaunchItem.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;
|
2019-05-11 11:22:20 +00:00
|
|
|
using namespace Windows::Devices::Enumeration;
|
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;
|
2019-06-06 21:15:24 +00:00
|
|
|
std::string langRegion;
|
2023-03-24 18:57:24 +00:00
|
|
|
std::list<std::unique_ptr<InputDevice>> g_input;
|
|
|
|
|
2023-04-28 19:22:17 +00:00
|
|
|
// This item will be assigned by 'App.cpp' at 'App::OnActivated'
|
|
|
|
LaunchItem launchItem;
|
|
|
|
|
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-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
|
|
|
|
2021-05-15 16:59:25 +00:00
|
|
|
const Path &exePath = File::GetExeDirectory();
|
2023-03-06 14:30:39 +00:00
|
|
|
g_VFS.Register("", new DirectoryReader(exePath / "Content"));
|
|
|
|
g_VFS.Register("", new DirectoryReader(exePath));
|
2017-02-24 19:50:27 +00:00
|
|
|
|
|
|
|
wchar_t lcCountry[256];
|
|
|
|
|
|
|
|
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";
|
|
|
|
}
|
|
|
|
|
2017-02-28 00:47:13 +00:00
|
|
|
std::wstring memstickFolderW = ApplicationData::Current->LocalFolder->Path->Data();
|
2021-05-15 05:48:04 +00:00
|
|
|
g_Config.memStickDirectory = Path(memstickFolderW);
|
2017-02-28 00:47:13 +00:00
|
|
|
|
2020-01-05 17:04:07 +00:00
|
|
|
// On Win32 it makes more sense to initialize the system directories here
|
2017-02-24 19:50:27 +00:00
|
|
|
// because the next place it was called was in the EmuThread, and it's too late by then.
|
|
|
|
InitSysDirectories();
|
|
|
|
|
2020-08-15 16:40:50 +00:00
|
|
|
LogManager::Init(&g_Config.bEnableLogging);
|
2017-03-07 09:10:40 +00:00
|
|
|
|
2017-02-24 19:50:27 +00:00
|
|
|
// Load config up here, because those changes below would be overwritten
|
|
|
|
// if it's not loaded here first.
|
2021-05-30 10:45:12 +00:00
|
|
|
g_Config.SetSearchPath(GetSysDirectory(DIRECTORY_SYSTEM));
|
2021-05-30 10:39:16 +00:00
|
|
|
g_Config.Load();
|
2017-02-24 19:50:27 +00:00
|
|
|
|
|
|
|
bool debugLogLevel = false;
|
2023-04-28 19:22:17 +00:00
|
|
|
|
2018-02-05 15:21:39 +00:00
|
|
|
g_Config.iGPUBackend = (int)GPUBackend::DIRECT3D11;
|
2023-04-28 19:22:17 +00:00
|
|
|
|
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 };
|
|
|
|
|
2023-04-28 19:22:17 +00:00
|
|
|
std::string cacheFolder = ConvertWStringToUTF8(ApplicationData::Current->TemporaryFolder->Path->Data());
|
2017-03-07 09:33:53 +00:00
|
|
|
|
2018-12-10 13:55:07 +00:00
|
|
|
NativeInit(1, argv, "", "", cacheFolder.c_str());
|
2017-02-24 19:50:27 +00:00
|
|
|
|
2023-04-28 19:22:17 +00:00
|
|
|
// Set log file location
|
|
|
|
if (g_Config.bEnableLogging) {
|
|
|
|
// Do cleanup first
|
|
|
|
CleanupLogs();
|
|
|
|
LogManager::GetInstance()->ChangeFileLog(GetLogFile().c_str());
|
|
|
|
}
|
|
|
|
|
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());
|
2023-03-24 18:57:24 +00:00
|
|
|
|
|
|
|
// add first XInput device to respond
|
|
|
|
g_input.push_back(std::make_unique<XinputDevice>());
|
|
|
|
|
2017-04-05 12:13:25 +00:00
|
|
|
InputDevice::BeginPolling();
|
2017-02-24 19:50:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
PPSSPP_UWPMain::~PPSSPP_UWPMain() {
|
2017-04-05 12:13:25 +00:00
|
|
|
InputDevice::StopPolling();
|
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();
|
2023-03-06 13:23:56 +00:00
|
|
|
g_VFS.Clear();
|
2017-02-24 19:50:27 +00:00
|
|
|
|
|
|
|
// 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() {
|
2017-03-07 09:10:40 +00:00
|
|
|
ctx_->GetDrawContext()->HandleEvent(Draw::Event::LOST_BACKBUFFER, 0, 0, nullptr);
|
|
|
|
|
2017-02-24 19:50:27 +00:00
|
|
|
NativeResized();
|
2017-03-07 09:33:53 +00:00
|
|
|
|
2017-03-07 09:10:40 +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
|
|
|
}
|
|
|
|
|
2023-04-28 19:22:17 +00:00
|
|
|
void PPSSPP_UWPMain::BootToLaunchFile() {
|
|
|
|
if (launchItem.IsValid() && !launchItem.IsHandled()) {
|
|
|
|
launchItem.SetState(true);
|
|
|
|
std::string path = launchItem.GetFilePath();
|
|
|
|
if (!path.empty()) {
|
|
|
|
NativeMessageReceived("boot", path.c_str());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-02-24 19:50:27 +00:00
|
|
|
// 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
|
|
|
|
2023-04-28 19:22:17 +00:00
|
|
|
// This is not perfect but it will do the job
|
|
|
|
BootToLaunchFile();
|
|
|
|
|
2017-03-02 16:07:12 +00:00
|
|
|
static bool hasSetThreadName = false;
|
|
|
|
if (!hasSetThreadName) {
|
2020-11-30 23:46:26 +00:00
|
|
|
SetCurrentThreadName("UWPRenderThread");
|
2017-03-02 16:07:12 +00:00
|
|
|
hasSetThreadName = true;
|
|
|
|
}
|
|
|
|
|
2017-02-24 19:50:27 +00:00
|
|
|
auto context = m_deviceResources->GetD3DDeviceContext();
|
|
|
|
|
2017-03-05 00:39:26 +00:00
|
|
|
switch (m_deviceResources->ComputeDisplayRotation()) {
|
2023-02-25 12:09:44 +00:00
|
|
|
case DXGI_MODE_ROTATION_IDENTITY: g_display.rotation = DisplayRotation::ROTATE_0; break;
|
|
|
|
case DXGI_MODE_ROTATION_ROTATE90: g_display.rotation = DisplayRotation::ROTATE_90; break;
|
|
|
|
case DXGI_MODE_ROTATION_ROTATE180: g_display.rotation = DisplayRotation::ROTATE_180; break;
|
|
|
|
case DXGI_MODE_ROTATION_ROTATE270: g_display.rotation = DisplayRotation::ROTATE_270; break;
|
2017-03-05 00:39:26 +00:00
|
|
|
}
|
|
|
|
// Not super elegant but hey.
|
2023-02-25 12:09:44 +00:00
|
|
|
memcpy(&g_display.rot_matrix, &m_deviceResources->GetOrientationTransform3D(), sizeof(float) * 16);
|
2017-03-05 00:39:26 +00:00
|
|
|
|
2017-03-07 09:33:53 +00:00
|
|
|
// Reset the viewport to target the whole screen.
|
|
|
|
auto viewport = m_deviceResources->GetScreenViewport();
|
|
|
|
|
2023-02-25 12:09:44 +00:00
|
|
|
g_display.pixel_xres = viewport.Width;
|
|
|
|
g_display.pixel_yres = viewport.Height;
|
2017-02-24 19:50:27 +00:00
|
|
|
|
2023-02-25 12:09:44 +00:00
|
|
|
if (g_display.rotation == DisplayRotation::ROTATE_90 || g_display.rotation == DisplayRotation::ROTATE_270) {
|
2017-03-05 00:39:26 +00:00
|
|
|
// We need to swap our width/height.
|
2023-02-25 12:09:44 +00:00
|
|
|
std::swap(g_display.pixel_xres, g_display.pixel_yres);
|
2017-03-05 00:39:26 +00:00
|
|
|
}
|
|
|
|
|
2023-02-25 12:09:44 +00:00
|
|
|
g_display.dpi = m_deviceResources->GetActualDpi();
|
2017-03-05 13:00:03 +00:00
|
|
|
|
|
|
|
if (System_GetPropertyInt(SYSPROP_DEVICE_TYPE) == DEVICE_TYPE_MOBILE) {
|
|
|
|
// Boost DPI a bit to look better.
|
2023-02-25 12:09:44 +00:00
|
|
|
g_display.dpi *= 96.0f / 136.0f;
|
2017-03-05 13:00:03 +00:00
|
|
|
}
|
2023-02-25 12:09:44 +00:00
|
|
|
g_display.dpi_scale_x = 96.0f / g_display.dpi;
|
|
|
|
g_display.dpi_scale_y = 96.0f / g_display.dpi;
|
2017-02-24 19:50:27 +00:00
|
|
|
|
2023-02-25 12:09:44 +00:00
|
|
|
g_display.pixel_in_dps_x = 1.0f / g_display.dpi_scale_x;
|
|
|
|
g_display.pixel_in_dps_y = 1.0f / g_display.dpi_scale_y;
|
2017-02-24 19:50:27 +00:00
|
|
|
|
2023-02-25 12:09:44 +00:00
|
|
|
g_display.dp_xres = g_display.pixel_xres * g_display.dpi_scale_x;
|
|
|
|
g_display.dp_yres = g_display.pixel_yres * g_display.dpi_scale_y;
|
2017-02-24 19:50:27 +00:00
|
|
|
|
|
|
|
context->RSSetViewports(1, &viewport);
|
|
|
|
|
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-03-07 09:33:53 +00:00
|
|
|
bool PPSSPP_UWPMain::OnHardwareButton(HardwareButton button) {
|
|
|
|
KeyInput keyInput{};
|
|
|
|
keyInput.deviceId = DEVICE_ID_KEYBOARD;
|
|
|
|
keyInput.flags = KEY_DOWN | KEY_UP;
|
|
|
|
switch (button) {
|
|
|
|
case HardwareButton::BACK:
|
|
|
|
keyInput.keyCode = NKCODE_BACK;
|
|
|
|
return NativeKey(keyInput);
|
|
|
|
default:
|
|
|
|
return false;
|
2017-03-05 00:39:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-02-27 10:32:40 +00:00
|
|
|
void PPSSPP_UWPMain::OnTouchEvent(int touchEvent, int touchId, float x, float y, double timestamp) {
|
2017-03-07 09:33:53 +00:00
|
|
|
// We get the coordinate in Windows' device independent pixels already. So let's undo that,
|
|
|
|
// and then apply our own "dpi".
|
2017-08-07 11:18:19 +00:00
|
|
|
float dpiFactor_x = m_deviceResources->GetActualDpi() / 96.0f;
|
2017-08-08 08:13:17 +00:00
|
|
|
float dpiFactor_y = dpiFactor_x;
|
2023-02-25 12:09:44 +00:00
|
|
|
dpiFactor_x /= g_display.pixel_in_dps_x;
|
|
|
|
dpiFactor_y /= g_display.pixel_in_dps_y;
|
2017-03-07 09:33:53 +00:00
|
|
|
|
2017-02-27 10:32:40 +00:00
|
|
|
TouchInput input{};
|
|
|
|
input.id = touchId;
|
2017-08-07 11:18:19 +00:00
|
|
|
input.x = x * dpiFactor_x;
|
|
|
|
input.y = y * dpiFactor_y;
|
2017-02-27 10:32:40 +00:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2017-02-27 10:00:57 +00:00
|
|
|
|
2017-02-24 19:50:27 +00:00
|
|
|
UWPGraphicsContext::UWPGraphicsContext(std::shared_ptr<DX::DeviceResources> resources) {
|
2018-12-10 13:55:07 +00:00
|
|
|
std::vector<std::string> adapterNames;
|
|
|
|
|
2017-03-05 00:39:26 +00:00
|
|
|
draw_ = Draw::T3DCreateD3D11Context(
|
2018-12-10 13:55:07 +00:00
|
|
|
resources->GetD3DDevice(), resources->GetD3DDeviceContext(), resources->GetD3DDevice(), resources->GetD3DDeviceContext(), resources->GetDeviceFeatureLevel(), 0, adapterNames);
|
2017-10-20 12:45:00 +00:00
|
|
|
bool success = draw_->CreatePresets();
|
2020-08-15 22:38:55 +00:00
|
|
|
_assert_(success);
|
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) {
|
2020-01-05 17:04:07 +00:00
|
|
|
|
2017-02-24 19:50:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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:
|
2019-06-06 21:15:24 +00:00
|
|
|
return langRegion;
|
2017-02-24 19:50:27 +00:00
|
|
|
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 "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-06 15:37:04 +00:00
|
|
|
std::vector<std::string> System_GetPropertyStringVec(SystemProperty prop) {
|
2021-01-09 22:45:49 +00:00
|
|
|
std::vector<std::string> result;
|
2021-01-06 15:37:04 +00:00
|
|
|
switch (prop) {
|
2021-01-09 22:45:49 +00:00
|
|
|
case SYSPROP_TEMP_DIRS:
|
|
|
|
{
|
|
|
|
std::wstring tempPath(MAX_PATH, '\0');
|
|
|
|
size_t sz = GetTempPath((DWORD)tempPath.size(), &tempPath[0]);
|
|
|
|
if (sz >= tempPath.size()) {
|
|
|
|
tempPath.resize(sz);
|
|
|
|
sz = GetTempPath((DWORD)tempPath.size(), &tempPath[0]);
|
|
|
|
}
|
|
|
|
// Need to resize off the null terminator either way.
|
|
|
|
tempPath.resize(sz);
|
|
|
|
result.push_back(ConvertWStringToUTF8(tempPath));
|
|
|
|
|
2023-04-28 19:22:17 +00:00
|
|
|
// As per below 'getenv' isn't supported
|
|
|
|
// https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/getenv-wgetenv?view=msvc-170
|
|
|
|
/*if (getenv("TMPDIR") && strlen(getenv("TMPDIR")) != 0)
|
2021-01-09 22:45:49 +00:00
|
|
|
result.push_back(getenv("TMPDIR"));
|
2021-01-10 19:33:17 +00:00
|
|
|
if (getenv("TMP") && strlen(getenv("TMP")) != 0)
|
2021-01-09 22:45:49 +00:00
|
|
|
result.push_back(getenv("TMP"));
|
2021-01-10 19:33:17 +00:00
|
|
|
if (getenv("TEMP") && strlen(getenv("TEMP")) != 0)
|
2023-04-28 19:22:17 +00:00
|
|
|
result.push_back(getenv("TEMP"));*/
|
|
|
|
|
2021-01-09 22:45:49 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2021-01-06 15:37:04 +00:00
|
|
|
default:
|
2021-01-09 22:45:49 +00:00
|
|
|
return result;
|
2021-01-06 15:37:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-02-24 19:50:27 +00:00
|
|
|
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;
|
2023-04-28 19:22:17 +00:00
|
|
|
|
2017-02-24 19:50:27 +00:00
|
|
|
case SYSPROP_DEVICE_TYPE:
|
2019-05-13 07:38:04 +00:00
|
|
|
{
|
|
|
|
auto ver = Windows::System::Profile::AnalyticsInfo::VersionInfo;
|
|
|
|
if (ver->DeviceFamily == "Windows.Mobile") {
|
|
|
|
return DEVICE_TYPE_MOBILE;
|
|
|
|
} else if (ver->DeviceFamily == "Windows.Xbox") {
|
|
|
|
return DEVICE_TYPE_TV;
|
|
|
|
} else {
|
|
|
|
return DEVICE_TYPE_DESKTOP;
|
|
|
|
}
|
|
|
|
}
|
2023-04-28 19:22:17 +00:00
|
|
|
case SYSPROP_DISPLAY_XRES:
|
|
|
|
{
|
|
|
|
CoreWindow^ corewindow = CoreWindow::GetForCurrentThread();
|
|
|
|
return (int)corewindow->Bounds.Width;
|
|
|
|
}
|
|
|
|
case SYSPROP_DISPLAY_YRES:
|
|
|
|
{
|
|
|
|
CoreWindow^ corewindow = CoreWindow::GetForCurrentThread();
|
|
|
|
return (int)corewindow->Bounds.Height;
|
|
|
|
}
|
2017-06-09 09:23:28 +00:00
|
|
|
default:
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-05 17:04:07 +00:00
|
|
|
float System_GetPropertyFloat(SystemProperty prop) {
|
|
|
|
switch (prop) {
|
|
|
|
case SYSPROP_DISPLAY_REFRESH_RATE:
|
|
|
|
return 60.f;
|
2020-05-25 22:10:55 +00:00
|
|
|
case SYSPROP_DISPLAY_SAFE_INSET_LEFT:
|
|
|
|
case SYSPROP_DISPLAY_SAFE_INSET_RIGHT:
|
|
|
|
case SYSPROP_DISPLAY_SAFE_INSET_TOP:
|
|
|
|
case SYSPROP_DISPLAY_SAFE_INSET_BOTTOM:
|
|
|
|
return 0.0f;
|
2020-01-05 17:04:07 +00:00
|
|
|
default:
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-10 20:34:44 +00:00
|
|
|
void System_Toast(const char *str) {}
|
|
|
|
|
2017-06-09 09:23:28 +00:00
|
|
|
bool System_GetPropertyBool(SystemProperty prop) {
|
|
|
|
switch (prop) {
|
2023-02-02 13:54:50 +00:00
|
|
|
case SYSPROP_HAS_OPEN_DIRECTORY:
|
2023-04-28 19:22:17 +00:00
|
|
|
return true;
|
2017-02-27 10:32:40 +00:00
|
|
|
case SYSPROP_HAS_FILE_BROWSER:
|
2017-06-09 09:23:28 +00:00
|
|
|
return true;
|
2020-12-20 00:28:43 +00:00
|
|
|
case SYSPROP_HAS_FOLDER_BROWSER:
|
2023-04-28 19:22:17 +00:00
|
|
|
return true; // now supported
|
2017-06-09 09:23:28 +00:00
|
|
|
case SYSPROP_HAS_IMAGE_BROWSER:
|
2023-03-22 14:35:21 +00:00
|
|
|
return true; // we just use the file browser
|
2017-06-09 09:23:28 +00:00
|
|
|
case SYSPROP_HAS_BACK_BUTTON:
|
|
|
|
return true;
|
2017-04-05 14:21:08 +00:00
|
|
|
case SYSPROP_APP_GOLD:
|
|
|
|
#ifdef GOLD
|
2017-06-09 09:23:28 +00:00
|
|
|
return true;
|
2017-04-05 14:21:08 +00:00
|
|
|
#else
|
2017-06-09 09:23:28 +00:00
|
|
|
return false;
|
2017-04-05 14:21:08 +00:00
|
|
|
#endif
|
2021-02-21 21:02:11 +00:00
|
|
|
case SYSPROP_CAN_JIT:
|
|
|
|
return true;
|
2021-04-26 05:54:28 +00:00
|
|
|
case SYSPROP_HAS_KEYBOARD:
|
|
|
|
return true;
|
2017-02-24 19:50:27 +00:00
|
|
|
default:
|
2017-06-09 09:23:28 +00:00
|
|
|
return false;
|
2017-02-24 19:50:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-03-21 10:10:09 +00:00
|
|
|
void System_Notify(SystemNotification notification) {
|
|
|
|
switch (notification) {
|
2023-03-24 18:57:24 +00:00
|
|
|
case SystemNotification::POLL_CONTROLLERS:
|
|
|
|
{
|
|
|
|
for (const auto &device : g_input)
|
|
|
|
{
|
|
|
|
if (device->UpdateState() == InputDevice::UPDATESTATE_SKIP_PAD)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2023-03-21 10:10:09 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-03-22 14:35:21 +00:00
|
|
|
bool System_MakeRequest(SystemRequestType type, int requestId, const std::string ¶m1, const std::string ¶m2, int param3) {
|
|
|
|
switch (type) {
|
2023-04-28 19:22:17 +00:00
|
|
|
|
|
|
|
case SystemRequestType::EXIT_APP:
|
|
|
|
{
|
|
|
|
bool state = false;
|
|
|
|
ExecuteTask(state, Windows::UI::ViewManagement::ApplicationView::GetForCurrentView()->TryConsolidateAsync());
|
|
|
|
if (!state) {
|
|
|
|
// Notify the user?
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
case SystemRequestType::RESTART_APP:
|
|
|
|
{
|
|
|
|
Windows::ApplicationModel::Core::AppRestartFailureReason error;
|
|
|
|
ExecuteTask(error, Windows::ApplicationModel::Core::CoreApplication::RequestRestartAsync(nullptr));
|
|
|
|
if (error != Windows::ApplicationModel::Core::AppRestartFailureReason::RestartPending) {
|
|
|
|
// Shutdown
|
|
|
|
System_MakeRequest(SystemRequestType::EXIT_APP, requestId, param1, param2, param3);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
2023-03-22 14:35:21 +00:00
|
|
|
case SystemRequestType::BROWSE_FOR_IMAGE:
|
|
|
|
{
|
2023-04-28 19:22:17 +00:00
|
|
|
std::vector<std::string> supportedExtensions = { ".jpg", ".png" };
|
2017-03-02 16:07:12 +00:00
|
|
|
|
2023-04-28 19:22:17 +00:00
|
|
|
//Call file picker
|
|
|
|
ChooseFile(supportedExtensions).then([requestId](std::string filePath) {
|
|
|
|
if (filePath.size() > 1) {
|
|
|
|
g_requestManager.PostSystemSuccess(requestId, filePath.c_str());
|
2023-03-22 14:35:21 +00:00
|
|
|
}
|
2023-04-28 19:22:17 +00:00
|
|
|
else {
|
|
|
|
g_requestManager.PostSystemFailure(requestId);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
case SystemRequestType::BROWSE_FOR_FILE:
|
|
|
|
{
|
|
|
|
std::vector<std::string> supportedExtensions = { ".cso", ".bin", ".iso", ".elf", ".zip" };
|
|
|
|
switch ((BrowseFileType)param3) {
|
|
|
|
case BrowseFileType::INI:
|
|
|
|
supportedExtensions = { ".ini" };
|
|
|
|
break;
|
|
|
|
case BrowseFileType::DB:
|
|
|
|
supportedExtensions = { ".db" };
|
|
|
|
break;
|
|
|
|
case BrowseFileType::ANY:
|
|
|
|
supportedExtensions = {};
|
|
|
|
break;
|
2023-03-22 14:35:21 +00:00
|
|
|
}
|
2017-03-02 16:07:12 +00:00
|
|
|
|
2023-04-28 19:22:17 +00:00
|
|
|
//Call file picker
|
|
|
|
ChooseFile(supportedExtensions).then([requestId](std::string filePath) {
|
|
|
|
if (filePath.size() > 1) {
|
|
|
|
g_requestManager.PostSystemSuccess(requestId, filePath.c_str());
|
|
|
|
}
|
|
|
|
else {
|
2023-03-22 14:35:21 +00:00
|
|
|
g_requestManager.PostSystemFailure(requestId);
|
2017-03-02 16:07:12 +00:00
|
|
|
}
|
2017-02-27 10:32:40 +00:00
|
|
|
});
|
2023-04-28 19:22:17 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
case SystemRequestType::BROWSE_FOR_FOLDER:
|
|
|
|
{
|
|
|
|
ChooseFolder().then([requestId](std::string folderPath) {
|
|
|
|
if (folderPath.size() > 1) {
|
|
|
|
g_requestManager.PostSystemSuccess(requestId, folderPath.c_str());
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
g_requestManager.PostSystemFailure(requestId);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
case SystemRequestType::NOTIFY_UI_STATE:
|
|
|
|
{
|
|
|
|
if (!param1.empty() && !strcmp(param1.c_str(), "menu")) {
|
|
|
|
if (launchItem.IsValid() && launchItem.IsHandled()) {
|
|
|
|
launchItem.Close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
case SystemRequestType::COPY_TO_CLIPBOARD:
|
|
|
|
{
|
|
|
|
auto dataPackage = ref new DataPackage();
|
|
|
|
dataPackage->RequestedOperation = DataPackageOperation::Copy;
|
|
|
|
dataPackage->SetText(convert(param1));
|
|
|
|
Clipboard::SetContent(dataPackage);
|
2023-03-22 14:35:21 +00:00
|
|
|
return true;
|
|
|
|
}
|
2023-03-22 21:17:53 +00:00
|
|
|
case SystemRequestType::TOGGLE_FULLSCREEN_STATE:
|
|
|
|
{
|
2019-06-07 13:52:05 +00:00
|
|
|
auto view = Windows::UI::ViewManagement::ApplicationView::GetForCurrentView();
|
2021-01-09 22:17:41 +00:00
|
|
|
bool flag = !view->IsFullScreenMode;
|
2023-03-22 21:17:53 +00:00
|
|
|
if (param1 == "0") {
|
2021-01-09 22:17:41 +00:00
|
|
|
flag = false;
|
2023-03-22 21:17:53 +00:00
|
|
|
} else if (param1 == "1"){
|
2021-01-09 22:17:41 +00:00
|
|
|
flag = true;
|
2019-06-07 13:52:05 +00:00
|
|
|
}
|
2021-01-09 22:17:41 +00:00
|
|
|
if (flag) {
|
2019-06-07 13:52:05 +00:00
|
|
|
view->TryEnterFullScreenMode();
|
2021-01-09 22:17:41 +00:00
|
|
|
} else {
|
|
|
|
view->ExitFullScreenMode();
|
2019-06-07 13:52:05 +00:00
|
|
|
}
|
2023-03-22 21:17:53 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
return false;
|
2017-02-27 10:32:40 +00:00
|
|
|
}
|
2017-02-24 19:50:27 +00:00
|
|
|
}
|
|
|
|
|
2023-03-21 09:42:23 +00:00
|
|
|
void System_ShowFileInFolder(const char *path) {
|
2023-04-28 19:22:17 +00:00
|
|
|
auto ver = Windows::System::Profile::AnalyticsInfo::VersionInfo;
|
|
|
|
if (ver->DeviceFamily == "Windows.Xbox") {
|
|
|
|
// Unsupported
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
OpenFolder(std::string(path));
|
|
|
|
}
|
2019-05-21 21:22:56 +00:00
|
|
|
}
|
|
|
|
|
2023-03-21 09:42:23 +00:00
|
|
|
void System_LaunchUrl(LaunchUrlType urlType, const char *url) {
|
2017-03-02 16:07:12 +00:00
|
|
|
auto uri = ref new Windows::Foundation::Uri(ToPlatformString(url));
|
2017-02-27 10:32:40 +00:00
|
|
|
|
|
|
|
create_task(Windows::System::Launcher::LaunchUriAsync(uri)).then([](bool b) {});
|
2017-02-24 19:50:27 +00:00
|
|
|
}
|
|
|
|
|
2023-03-21 09:42:23 +00:00
|
|
|
void System_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;
|
2017-03-03 21:48:05 +00:00
|
|
|
// TODO: Can't use this?
|
|
|
|
// Windows::Phone::Devices::Notification::VibrationDevice::GetDefault()->Vibrate(timeSpan);
|
2017-02-28 00:47:13 +00:00
|
|
|
#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;
|
|
|
|
}
|
|
|
|
|
2019-05-11 11:22:20 +00:00
|
|
|
std::string GetCPUBrandString() {
|
|
|
|
Platform::String^ cpu_id = nullptr;
|
|
|
|
Platform::String^ cpu_name = nullptr;
|
2020-01-05 17:04:07 +00:00
|
|
|
|
2019-05-11 11:22:20 +00:00
|
|
|
// GUID_DEVICE_PROCESSOR: {97FADB10-4E33-40AE-359C-8BEF029DBDD0}
|
|
|
|
Platform::String^ if_filter = L"System.Devices.InterfaceClassGuid:=\"{97FADB10-4E33-40AE-359C-8BEF029DBDD0}\"";
|
|
|
|
|
|
|
|
// Enumerate all CPU DeviceInterfaces, and get DeviceInstanceID of the first one.
|
|
|
|
auto if_task = create_task(
|
|
|
|
DeviceInformation::FindAllAsync(if_filter)).then([&](DeviceInformationCollection ^ collection) {
|
|
|
|
if (collection->Size > 0) {
|
|
|
|
auto cpu = collection->GetAt(0);
|
|
|
|
auto id = cpu->Properties->Lookup(L"System.Devices.DeviceInstanceID");
|
|
|
|
cpu_id = dynamic_cast<Platform::String^>(id);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
try {
|
|
|
|
if_task.wait();
|
|
|
|
}
|
|
|
|
catch (const std::exception & e) {
|
|
|
|
const char* what = e.what();
|
2020-08-15 14:25:50 +00:00
|
|
|
INFO_LOG(SYSTEM, "%s", what);
|
2019-05-11 11:22:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (cpu_id != nullptr) {
|
|
|
|
// Get the Device with the same ID as the DeviceInterface
|
|
|
|
// Then get the name (description) of that Device
|
|
|
|
// We have to do this because the DeviceInterface we get doesn't have a proper description.
|
|
|
|
Platform::String^ dev_filter = L"System.Devices.DeviceInstanceID:=\"" + cpu_id + L"\"";
|
|
|
|
|
|
|
|
auto dev_task = create_task(
|
|
|
|
DeviceInformation::FindAllAsync(dev_filter, {}, DeviceInformationKind::Device)).then(
|
|
|
|
[&](DeviceInformationCollection ^ collection) {
|
|
|
|
if (collection->Size > 0) {
|
|
|
|
cpu_name = collection->GetAt(0)->Name;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
try {
|
|
|
|
dev_task.wait();
|
|
|
|
}
|
|
|
|
catch (const std::exception & e) {
|
|
|
|
const char* what = e.what();
|
2020-08-15 14:25:50 +00:00
|
|
|
INFO_LOG(SYSTEM, "%s", what);
|
2019-05-11 11:22:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cpu_name != nullptr) {
|
|
|
|
return FromPlatformString(cpu_name);
|
|
|
|
} else {
|
|
|
|
return "Unknown";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-07 09:33:53 +00:00
|
|
|
// Emulation of TlsAlloc for Windows 10. Used by glslang. Doesn't actually seem to work, other than fixing the linking errors?
|
2017-03-03 21:48:05 +00:00
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
DWORD WINAPI __imp_TlsAlloc() {
|
|
|
|
return FlsAlloc(nullptr);
|
|
|
|
}
|
|
|
|
BOOL WINAPI __imp_TlsFree(DWORD index) {
|
|
|
|
return FlsFree(index);
|
|
|
|
}
|
|
|
|
BOOL WINAPI __imp_TlsSetValue(DWORD dwTlsIndex, LPVOID lpTlsValue) {
|
|
|
|
return FlsSetValue(dwTlsIndex, lpTlsValue);
|
|
|
|
}
|
|
|
|
LPVOID WINAPI __imp_TlsGetValue(DWORD dwTlsIndex) {
|
|
|
|
return FlsGetValue(dwTlsIndex);
|
|
|
|
}
|
|
|
|
}
|