Merge remote-tracking branch 'origin/master'

This commit is contained in:
Yukino Song
2024-08-27 21:47:20 +08:00
36 changed files with 546 additions and 120 deletions

View File

@@ -1728,15 +1728,18 @@ namespace platf {
std::vector<supported_gamepad_t> &
supported_gamepads(input_t *input) {
bool enabled;
if (input) {
auto vigem = ((input_raw_t *) input)->vigem;
enabled = vigem != nullptr;
}
else {
enabled = false;
if (!input) {
static std::vector gps {
supported_gamepad_t { "auto", true, "" },
supported_gamepad_t { "x360", false, "" },
supported_gamepad_t { "ds4", false, "" },
};
return gps;
}
auto vigem = ((input_raw_t *) input)->vigem;
auto enabled = vigem != nullptr;
auto reason = enabled ? "" : "gamepads.vigem-not-available";
// ds4 == ps4

View File

@@ -1313,6 +1313,16 @@ namespace platf {
lifetime::exit_sunshine(0, true);
}
int
set_env(const std::string &name, const std::string &value) {
return _putenv_s(name.c_str(), value.c_str());
}
int
unset_env(const std::string &name) {
return _putenv_s(name.c_str(), "");
}
struct enum_wnd_context_t {
std::set<DWORD> process_ids;
bool requested_exit;

View File

@@ -37,7 +37,6 @@ constexpr auto DNS_QUERY_RESULTS_VERSION1 = 0x1;
#define SERVICE_DOMAIN "local"
constexpr auto SERVICE_INSTANCE_NAME = SV(SERVICE_NAME "." SERVICE_TYPE "." SERVICE_DOMAIN);
constexpr auto SERVICE_TYPE_DOMAIN = SV(SERVICE_TYPE "." SERVICE_DOMAIN);
#ifndef __MINGW32__
@@ -107,10 +106,11 @@ namespace platf::publish {
service(bool enable, PDNS_SERVICE_INSTANCE &existing_instance) {
auto alarm = safe::make_alarm<PDNS_SERVICE_INSTANCE>();
std::wstring name { SERVICE_INSTANCE_NAME.data(), SERVICE_INSTANCE_NAME.size() };
std::wstring domain { SERVICE_TYPE_DOMAIN.data(), SERVICE_TYPE_DOMAIN.size() };
auto host = from_utf8(boost::asio::ip::host_name() + ".local");
auto hostname = boost::asio::ip::host_name();
auto name = from_utf8(net::mdns_instance_name(hostname) + '.') + domain;
auto host = from_utf8(hostname + ".local");
DNS_SERVICE_INSTANCE instance {};
instance.pszInstanceName = name.data();