diff options
Diffstat (limited to 'drivers/windows')
-rw-r--r-- | drivers/windows/dir_access_windows.cpp | 8 | ||||
-rw-r--r-- | drivers/windows/dir_access_windows.h | 6 | ||||
-rw-r--r-- | drivers/windows/file_access_windows.cpp | 8 | ||||
-rw-r--r-- | drivers/windows/file_access_windows.h | 2 | ||||
-rw-r--r-- | drivers/windows/mutex_windows.cpp | 4 | ||||
-rw-r--r-- | drivers/windows/mutex_windows.h | 2 | ||||
-rw-r--r-- | drivers/windows/rw_lock_windows.cpp | 72 | ||||
-rw-r--r-- | drivers/windows/rw_lock_windows.h | 37 | ||||
-rw-r--r-- | drivers/windows/semaphore_windows.cpp | 4 | ||||
-rw-r--r-- | drivers/windows/semaphore_windows.h | 2 | ||||
-rw-r--r-- | drivers/windows/shell_windows.cpp | 4 | ||||
-rw-r--r-- | drivers/windows/shell_windows.h | 2 | ||||
-rw-r--r-- | drivers/windows/thread_windows.cpp | 4 | ||||
-rw-r--r-- | drivers/windows/thread_windows.h | 2 |
14 files changed, 132 insertions, 25 deletions
diff --git a/drivers/windows/dir_access_windows.cpp b/drivers/windows/dir_access_windows.cpp index ad4e8f301c..14742aa420 100644 --- a/drivers/windows/dir_access_windows.cpp +++ b/drivers/windows/dir_access_windows.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -59,7 +59,7 @@ struct DirAccessWindowsPrivate { // CreateFolderAsync -bool DirAccessWindows::list_dir_begin() { +Error DirAccessWindows::list_dir_begin() { _cisdir=false; _cishidden=false; @@ -67,7 +67,7 @@ bool DirAccessWindows::list_dir_begin() { list_dir_end(); p->h = FindFirstFileExW((current_dir+"\\*").c_str(), FindExInfoStandard, &p->fu, FindExSearchNameMatch, NULL, 0); - return (p->h==INVALID_HANDLE_VALUE); + return (p->h==INVALID_HANDLE_VALUE) ? ERR_CANT_OPEN : OK; } @@ -349,7 +349,7 @@ DirAccessWindows::DirAccessWindows() { drive_count=0; -#ifdef WINRT_ENABLED +#ifdef UWP_ENABLED Windows::Storage::StorageFolder ^install_folder = Windows::ApplicationModel::Package::Current->InstalledLocation; change_dir(install_folder->Path->Data()); diff --git a/drivers/windows/dir_access_windows.h b/drivers/windows/dir_access_windows.h index 6861291fd9..f4105b7bc9 100644 --- a/drivers/windows/dir_access_windows.h +++ b/drivers/windows/dir_access_windows.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -44,7 +44,7 @@ struct DirAccessWindowsPrivate; class DirAccessWindows : public DirAccess { enum { - MAX_DRIVES=25 + MAX_DRIVES=26 }; @@ -62,7 +62,7 @@ class DirAccessWindows : public DirAccess { public: - virtual bool list_dir_begin(); ///< This starts dir listing + virtual Error list_dir_begin(); ///< This starts dir listing virtual String get_next(); virtual bool current_is_dir() const; virtual bool current_is_hidden() const; diff --git a/drivers/windows/file_access_windows.cpp b/drivers/windows/file_access_windows.cpp index 36dcab1d67..183cec96ec 100644 --- a/drivers/windows/file_access_windows.cpp +++ b/drivers/windows/file_access_windows.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -28,8 +28,6 @@ /*************************************************************************/ #ifdef WINDOWS_ENABLED -#define WINVER 0x0500 - #include <windows.h> #include "shlwapi.h" #include "file_access_windows.h" @@ -125,8 +123,8 @@ void FileAccessWindows::close() { bool rename_error; -#ifdef WINRT_ENABLED - // WinRT has no PathFileExists, so we check attributes instead +#ifdef UWP_ENABLED + // UWP has no PathFileExists, so we check attributes instead DWORD fileAttr; fileAttr = GetFileAttributesW(save_path.c_str()); diff --git a/drivers/windows/file_access_windows.h b/drivers/windows/file_access_windows.h index b02b6f66a7..9f06918b72 100644 --- a/drivers/windows/file_access_windows.h +++ b/drivers/windows/file_access_windows.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/drivers/windows/mutex_windows.cpp b/drivers/windows/mutex_windows.cpp index f63415d0f8..6ae7e52124 100644 --- a/drivers/windows/mutex_windows.cpp +++ b/drivers/windows/mutex_windows.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -81,7 +81,7 @@ MutexWindows::MutexWindows() { #ifdef WINDOWS_USE_MUTEX mutex = CreateMutex( NULL, FALSE, NULL ); #else - #ifdef WINRT_ENABLED + #ifdef UWP_ENABLED InitializeCriticalSectionEx( &mutex, 0, 0 ); #else InitializeCriticalSection( &mutex ); diff --git a/drivers/windows/mutex_windows.h b/drivers/windows/mutex_windows.h index 4cff027906..4202735f2b 100644 --- a/drivers/windows/mutex_windows.h +++ b/drivers/windows/mutex_windows.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/drivers/windows/rw_lock_windows.cpp b/drivers/windows/rw_lock_windows.cpp new file mode 100644 index 0000000000..0da7bf4bd5 --- /dev/null +++ b/drivers/windows/rw_lock_windows.cpp @@ -0,0 +1,72 @@ + +#if defined(WINDOWS_ENABLED) + +#include "os/memory.h" +#include "rw_lock_windows.h" +#include "error_macros.h" +#include <stdio.h> + +void RWLockWindows::read_lock() { + + AcquireSRWLockShared(&lock); + +} + +void RWLockWindows::read_unlock() { + + ReleaseSRWLockShared(&lock); +} + +Error RWLockWindows::read_try_lock() { + + if (TryAcquireSRWLockShared(&lock)==0) { + return ERR_BUSY; + } else { + return OK; + } + +} + +void RWLockWindows::write_lock() { + + AcquireSRWLockExclusive(&lock); + +} + +void RWLockWindows::write_unlock() { + + ReleaseSRWLockExclusive(&lock); +} + +Error RWLockWindows::write_try_lock() { + if (TryAcquireSRWLockExclusive(&lock)==0) { + return ERR_BUSY; + } else { + return OK; + } +} + + +RWLock *RWLockWindows::create_func_windows() { + + return memnew( RWLockWindows ); +} + +void RWLockWindows::make_default() { + + create_func=create_func_windows; +} + + +RWLockWindows::RWLockWindows() { + + InitializeSRWLock(&lock); +} + + +RWLockWindows::~RWLockWindows() { + + +} + +#endif diff --git a/drivers/windows/rw_lock_windows.h b/drivers/windows/rw_lock_windows.h new file mode 100644 index 0000000000..c089c31c33 --- /dev/null +++ b/drivers/windows/rw_lock_windows.h @@ -0,0 +1,37 @@ +#ifndef RWLOCKWINDOWS_H +#define RWLOCKWINDOWS_H + +#if defined(WINDOWS_ENABLED) + +#include <windows.h> +#include "os/rw_lock.h" + +class RWLockWindows : public RWLock { + + + SRWLOCK lock; + + static RWLock *create_func_windows(); + +public: + + virtual void read_lock(); + virtual void read_unlock(); + virtual Error read_try_lock(); + + virtual void write_lock(); + virtual void write_unlock(); + virtual Error write_try_lock(); + + static void make_default(); + + RWLockWindows(); + + ~RWLockWindows(); + +}; + +#endif + + +#endif // RWLOCKWINDOWS_H diff --git a/drivers/windows/semaphore_windows.cpp b/drivers/windows/semaphore_windows.cpp index 8d11d1b1c1..cdd1a7b888 100644 --- a/drivers/windows/semaphore_windows.cpp +++ b/drivers/windows/semaphore_windows.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -71,7 +71,7 @@ void SemaphoreWindows::make_default() { SemaphoreWindows::SemaphoreWindows() { -#ifdef WINRT_ENABLED +#ifdef UWP_ENABLED semaphore=CreateSemaphoreEx( NULL, 0, diff --git a/drivers/windows/semaphore_windows.h b/drivers/windows/semaphore_windows.h index e8836e49dc..564087a691 100644 --- a/drivers/windows/semaphore_windows.h +++ b/drivers/windows/semaphore_windows.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/drivers/windows/shell_windows.cpp b/drivers/windows/shell_windows.cpp index c69d371a65..a96bc6a7db 100644 --- a/drivers/windows/shell_windows.cpp +++ b/drivers/windows/shell_windows.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -28,7 +28,7 @@ /*************************************************************************/ #ifdef WINDOWS_ENABLED -#ifdef WINRT_ENABLED +#ifdef UWP_ENABLED // Use Launcher class on windows 8 diff --git a/drivers/windows/shell_windows.h b/drivers/windows/shell_windows.h index 6f97964a09..92203df98a 100644 --- a/drivers/windows/shell_windows.h +++ b/drivers/windows/shell_windows.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/drivers/windows/thread_windows.cpp b/drivers/windows/thread_windows.cpp index 884575e81e..dbe2f93fd4 100644 --- a/drivers/windows/thread_windows.cpp +++ b/drivers/windows/thread_windows.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -28,7 +28,7 @@ /*************************************************************************/ #include "thread_windows.h" -#if defined(WINDOWS_ENABLED) && !defined(WINRT_ENABLED) +#if defined(WINDOWS_ENABLED) && !defined(UWP_ENABLED) #include "os/memory.h" diff --git a/drivers/windows/thread_windows.h b/drivers/windows/thread_windows.h index 1c90504dde..c8f395e062 100644 --- a/drivers/windows/thread_windows.h +++ b/drivers/windows/thread_windows.h @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ |