diff --git a/core/core.vcxproj b/core/core.vcxproj
old mode 100644
new mode 100755
index 30145a0..fb32895
--- a/core/core.vcxproj
+++ b/core/core.vcxproj
@@ -153,6 +153,7 @@
+
@@ -354,13 +355,13 @@
DynamicLibrary
true
- v143
+ v145
Unicode
DynamicLibrary
false
- v143
+ v145
true
Unicode
@@ -397,7 +398,7 @@
true
MultiThreadedDebug
true
- /await /utf-8 /Zc:externConstexpr /Zc:throwingNew /Zc:__cplusplus
+ /utf-8 /Zc:externConstexpr /Zc:throwingNew /Zc:__cplusplus
Async
$(IntDir)\%(RelativeDir)
stdcpplatest
@@ -431,7 +432,7 @@
true
MultiThreaded
true
- /await /utf-8 /Zc:externConstexpr /Zc:throwingNew /Zc:__cplusplus
+ /utf-8 /Zc:externConstexpr /Zc:throwingNew /Zc:__cplusplus
@@ -640,4 +641,4 @@
-
+
\ No newline at end of file
diff --git a/core/src/addon/package_manager.cpp b/core/src/addon/package_manager.cpp
index c9134d3..08d4ba4 100755
--- a/core/src/addon/package_manager.cpp
+++ b/core/src/addon/package_manager.cpp
@@ -28,6 +28,7 @@
#include "core.hpp"
#include "downloader.hpp"
#include "utilities/xml.hpp"
+#include "utilities/coroutine.hpp"
#include "utility.hpp"
#include
@@ -594,9 +595,9 @@ std::future windower::package_manager::update_sources(bool force)
{}
std::vector files;
- for (auto source : m_package_sources)
+ for (auto const& source : m_package_sources)
{
- auto url = source.url;
+ auto url{source.url};
auto path = staging_path / source.guid;
if (url.empty() || url.back() != u8'/')
{
@@ -650,7 +651,7 @@ windower::package_manager::update_source(source source, bool force)
std::vector files;
{
- auto url = source.url;
+ auto url{source.url};
auto path = staging_path / source.guid;
if (url.empty() || url.back() != u8'/')
{
@@ -766,7 +767,7 @@ windower::package_manager::install_or_update(
std::vector jobs;
for (auto const& p : packages)
{
- auto root_url = p.root_url;
+ auto root_url{p.root_url};
if (root_url.empty() || root_url.back() != u8'/')
{
root_url.append(1, u8'/');
@@ -776,7 +777,8 @@ windower::package_manager::install_or_update(
for (auto const& file : p.files)
{
auto url = root_url + file.generic_u8string();
- auto path = (staging_path / file).make_preferred();
+ auto path = staging_path / file;
+ path.make_preferred();
fs::create_directories(path.parent_path());
auto const time =
last_modified(m_installed_package_directory / file, force);
@@ -801,7 +803,7 @@ windower::package_manager::install_or_update(
it2->name + u8"\"";
if (windower::core::instance().settings.verbose_logging)
{
- for (auto r : results)
+ for (auto const& r : results)
{
::check(r);
}
@@ -828,7 +830,7 @@ windower::package_manager::install_or_update(
}
std::lock_guard lock{m_mutex};
- for (auto r : results)
+ for (auto const& r : results)
{
auto path = m_installed_package_directory /
relative(r.file().path, staging_path);
diff --git a/core/src/addon/scheduler.cpp b/core/src/addon/scheduler.cpp
old mode 100644
new mode 100755
index c704977..002b3d6
--- a/core/src/addon/scheduler.cpp
+++ b/core/src/addon/scheduler.cpp
@@ -35,11 +35,10 @@
#include
#include
#include
+#include
#include
#include
-#include
-
bool windower::operator<=(wait_state const& lhs, wait_state const& rhs) noexcept
{
static_assert(
@@ -65,7 +64,7 @@ windower::task::task(task&& other) noexcept : m_coroutine{other.m_coroutine}
}
windower::task::task(
- std::experimental::coroutine_handle coroutine) noexcept :
+ std::coroutine_handle coroutine) noexcept :
m_coroutine{coroutine}
{}
diff --git a/core/src/addon/scheduler.hpp b/core/src/addon/scheduler.hpp
old mode 100644
new mode 100755
index 0530145..555b55e
--- a/core/src/addon/scheduler.hpp
+++ b/core/src/addon/scheduler.hpp
@@ -29,6 +29,7 @@
#include
#include
+#include
#include
#include
#include
@@ -37,8 +38,6 @@
#include
#include
-#include
-
namespace windower
{
@@ -75,18 +74,17 @@ class task
auto get_return_object() noexcept
{
return task{
- std::experimental::coroutine_handle::from_promise(
- *this)};
+ std::coroutine_handle::from_promise(*this)};
}
auto initial_suspend() noexcept
{
- return std::experimental::suspend_always{};
+ return std::suspend_always{};
}
auto final_suspend() noexcept
{
- return std::experimental::suspend_always{};
+ return std::suspend_always{};
}
void return_void() noexcept {}
@@ -118,7 +116,7 @@ class task
bool await_ready() const noexcept { return !m_condition; }
void
- await_suspend(std::experimental::coroutine_handle<>) const noexcept
+ await_suspend(std::coroutine_handle<>) const noexcept
{}
bool await_resume() const noexcept { return m_condition; }
@@ -152,9 +150,9 @@ class task
void tag(void const*) const noexcept;
private:
- std::experimental::coroutine_handle m_coroutine;
+ std::coroutine_handle m_coroutine;
- explicit task(std::experimental::coroutine_handle) noexcept;
+ explicit task(std::coroutine_handle) noexcept;
};
class scheduler
diff --git a/core/src/command_handlers.cpp b/core/src/command_handlers.cpp
old mode 100644
new mode 100755
index e1a7e59..47ca822
--- a/core/src/command_handlers.cpp
+++ b/core/src/command_handlers.cpp
@@ -28,6 +28,7 @@
#include "core.hpp"
#include "errors/command_error.hpp"
#include "unicode.hpp"
+#include "utilities/coroutine.hpp"
#include "utility.hpp"
#include
diff --git a/core/src/downloader.cpp b/core/src/downloader.cpp
old mode 100644
new mode 100755
index db7a0c5..9626613
--- a/core/src/downloader.cpp
+++ b/core/src/downloader.cpp
@@ -27,6 +27,7 @@
#include "core.hpp"
#include "handle.hpp"
#include "unicode.hpp"
+#include "utilities/coroutine.hpp"
#include "version.hpp"
#include
@@ -35,6 +36,7 @@
#include
#include
+#include
#include
#include
#include
@@ -43,8 +45,6 @@
#include
#include
-#include
-
namespace
{
@@ -388,7 +388,7 @@ struct windower::downloader::job::impl
std::vector const files;
std::mutex mutex;
std::atomic complete = false;
- std::experimental::coroutine_handle<> resumable = nullptr;
+ std::coroutine_handle<> resumable = nullptr;
};
windower::downloader::job::awaiter::awaiter(job const& job) noexcept :
@@ -401,7 +401,7 @@ bool windower::downloader::job::awaiter::await_ready() const noexcept
}
void windower::downloader::job::awaiter::await_suspend(
- std::experimental::coroutine_handle<> resumable) const
+ std::coroutine_handle<> resumable) const
{
std::lock_guard lock{m_job.m_impl->mutex};
if (m_job.m_impl->complete)
diff --git a/core/src/downloader.hpp b/core/src/downloader.hpp
old mode 100644
new mode 100755
index 1678fea..67d0ee2
--- a/core/src/downloader.hpp
+++ b/core/src/downloader.hpp
@@ -27,6 +27,7 @@
#include
#include
+#include
#include
#include
#include
@@ -36,8 +37,6 @@
#include
#include
-#include
-
namespace windower
{
@@ -103,7 +102,7 @@ class downloader
bool await_ready() const noexcept;
- void await_suspend(std::experimental::coroutine_handle<>) const;
+ void await_suspend(std::coroutine_handle<>) const;
std::vector await_resume() const;
diff --git a/core/src/hooks/ffximain.cpp b/core/src/hooks/ffximain.cpp
old mode 100644
new mode 100755
index 482633e..890fe64
--- a/core/src/hooks/ffximain.cpp
+++ b/core/src/hooks/ffximain.cpp
@@ -594,9 +594,9 @@ void const* windower::ffximain::menu(
for (auto it = hooks::menu_ptr; it && it->data; std::advance(it, 1))
{
auto const name_ptr = static_cast(it->name);
- auto const name_size = std::size(it->name);
+ auto constexpr name_size = std::size(it->name);
auto const type_ptr = static_cast(it->type);
- auto const type_size = std::size(it->type);
+ auto constexpr type_size = std::size(it->type);
if (std::u8string_view{name_ptr, name_size} == name &&
std::u8string_view{type_ptr, type_size} == type)
diff --git a/core/src/scanner.hpp b/core/src/scanner.hpp
old mode 100644
new mode 100755
index 7652d62..924f217
--- a/core/src/scanner.hpp
+++ b/core/src/scanner.hpp
@@ -198,7 +198,7 @@ class signature
inline namespace signature_literals
{
-consteval signature operator"" _sig(char8_t const* string, std::size_t size)
+consteval signature operator ""_sig(char8_t const* string, std::size_t size)
{
return signature{std::u8string_view{string, size}};
}
diff --git a/core/src/utilities/coroutine.hpp b/core/src/utilities/coroutine.hpp
new file mode 100755
index 0000000..5447303
--- /dev/null
+++ b/core/src/utilities/coroutine.hpp
@@ -0,0 +1,112 @@
+/*
+ * Copyright © Windower Dev Team
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation files
+ * (the "Software"),to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#pragma once
+
+#include
+#include
+#include
+
+template
+ requires(!std::is_void_v && !std::is_reference_v)
+struct std::coroutine_traits<
+ std::future, T&, Args...>
+{
+ struct promise_type : std::promise
+ {
+ std::future get_return_object() noexcept
+ {
+ return this->get_future();
+ }
+
+ std::suspend_never initial_suspend() const noexcept { return {}; }
+ std::suspend_never final_suspend() const noexcept { return {}; }
+
+ void return_value(R const& value) noexcept(
+ std::is_nothrow_copy_constructible_v)
+ {
+ this->set_value(value);
+ }
+
+ void return_value(R&& value) noexcept(
+ std::is_nothrow_move_constructible_v)
+ {
+ this->set_value(std::move(value));
+ }
+
+ void unhandled_exception() noexcept
+ {
+ this->set_exception(std::current_exception());
+ }
+ };
+};
+
+template
+struct std::coroutine_traits<
+ std::future, T&, Args...>
+{
+ struct promise_type : std::promise
+ {
+ std::future get_return_object() noexcept
+ {
+ return this->get_future();
+ }
+
+ std::suspend_never initial_suspend() const noexcept { return {}; }
+ std::suspend_never final_suspend() const noexcept { return {}; }
+
+ void return_void() noexcept { this->set_value(); }
+
+ void unhandled_exception() noexcept
+ {
+ this->set_exception(std::current_exception());
+ }
+ };
+};
+
+template
+auto operator co_await(std::future future) noexcept
+ requires(!std::is_reference_v)
+{
+ struct awaiter : std::future
+ {
+ bool await_ready() const noexcept
+ {
+ return this->wait_for(std::chrono::seconds(0)) !=
+ std::future_status::timeout;
+ }
+
+ void await_suspend(std::coroutine_handle<> continuation) const
+ {
+ std::thread([this, continuation] {
+ this->await_ready();
+ continuation();
+ }).detach();
+ }
+
+ R await_resume() { return this->get(); }
+ };
+
+ return awaiter{std::move(future)};
+}
diff --git a/extern/luajit/luajit.vcxproj b/extern/luajit/luajit.vcxproj
old mode 100644
new mode 100755
index 3dad982..34f1b40
--- a/extern/luajit/luajit.vcxproj
+++ b/extern/luajit/luajit.vcxproj
@@ -20,13 +20,13 @@
StaticLibrary
true
- v143
+ v145
Unicode
StaticLibrary
false
- v143
+ v145
true
Unicode
@@ -81,7 +81,7 @@
-
+
var compilePattern = new Regex(@"^@set LJCOMPILE=cl\b");
var linkPattern = new Regex(@"^@set LJLINK=link\b");