Compare commits

...

8 Commits

Author SHA1 Message Date
Cameron Gutman
ddd86d91eb Update GSv6Fwd to 2.6r2 2023-08-26 00:54:15 -05:00
Cameron Gutman
546e30f363 Version 5.6.1 2023-08-26 00:04:30 -05:00
Cameron Gutman
432c2e226c Monitor for name changes too to detect deletion of the NvStream subkey 2023-08-25 23:33:54 -05:00
Cameron Gutman
cc98c2cd17 Version 5.6 2023-05-27 22:34:23 -05:00
Cameron Gutman
c8a5fe2efa Update VCRedist 2023-05-27 22:27:41 -05:00
Cameron Gutman
6d5d83d420 Avoid deleting Sunshine's UPnP port mappings 2023-05-27 22:26:08 -05:00
Cameron Gutman
1e1d347052 Add limited support for testing Sunshine 2023-05-27 22:18:31 -05:00
Cameron Gutman
307623914b Update VCRedist 2022-08-09 20:28:40 -05:00
5 changed files with 108 additions and 22 deletions

@ -1 +1 @@
Subproject commit 48c0136b9d65fd3901de2d2593d98528ca5d1906
Subproject commit e0db902f7dffb80aa63d5d330fceed243efe66a4

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<?define VCREDIST_VER = "14.31.31103" ?>
<?define VCREDIST_X86_SIZE = "13725768" ?>
<?define VCREDIST_X86_SHA1 = "15fe8e70c3c5582b70df173cd9b580331677735a" ?>
<?define VCREDIST_X86_URL = "https://download.visualstudio.microsoft.com/download/pr/144a5711-f076-44fa-bf55-f7e0121eb30c/B7AE307237F869E09F7413691A2CD1944357B5CEE28049C0A0D3430B47BB3EDC/VC_redist.x86.exe" ?>
<?define VCREDIST_VER = "14.36.32532.0" ?>
<?define VCREDIST_X86_SIZE = "13837672" ?>
<?define VCREDIST_X86_SHA1 = "C9B5B7969E499A4FD9E580EF4187322778E1936A" ?>
<?define VCREDIST_X86_URL = "https://download.visualstudio.microsoft.com/download/pr/eaab1f82-787d-4fd7-8c73-f782341a0c63/5365A927487945ECB040E143EA770ADBB296074ECE4021B1D14213BDE538C490/VC_redist.x86.exe" ?>
<?define VCREDIST_X86_UPGRADE_CODE = "65E5BD06-6392-3027-8C26-853107D3CF1A" ?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
@ -39,7 +39,7 @@
<RemotePayload Description="Microsoft Visual C++ 2015-2022 Redistributable - x86"
ProductName="Microsoft Visual C++ 2015-2022 Redistributable - x86"
Size="$(var.VCREDIST_X86_SIZE)"
Version="$(var.VCREDIST_VER).0"
Version="$(var.VCREDIST_VER)"
Hash="$(var.VCREDIST_X86_SHA1)"/>
<!-- Newer version installed is fine -->

View File

@ -542,6 +542,42 @@ bool IsGameStreamEnabled()
return enabled != 0;
}
bool IsAlternateHostSoftwareRunning()
{
int err;
PMIB_TCPTABLE tcp_table = nullptr;
ULONG table_size = 0;
do {
// Query all open TCPv4 sockets
err = GetTcpTable(tcp_table, &table_size, false);
if (err == ERROR_INSUFFICIENT_BUFFER) {
free(tcp_table);
tcp_table = (PMIB_TCPTABLE)malloc(table_size);
}
} while (err == ERROR_INSUFFICIENT_BUFFER);
if (!tcp_table || err != NO_ERROR) {
printf("GetTcpTable() failed: %d\n", err);
free(tcp_table);
return false;
}
bool result = false;
for (DWORD i = 0; i < tcp_table->dwNumEntries; i++) {
auto& entry = tcp_table->table[i];
// Look for TCP 47989 port in the listening state
if (entry.dwLocalPort == _byteswap_ushort(47989) && entry.dwState == MIB_TCP_STATE_LISTEN) {
result = true;
break;
}
}
free(tcp_table);
return result;
}
void UpdatePortMappingsForTarget(bool enable, char* targetAddressIP4, char* internalAddressIP4, char* upstreamAddressIP4)
{
natpmp_t natpmp;
@ -876,7 +912,7 @@ DWORD WINAPI GameStreamStateChangeThread(PVOID Context)
// Notify the main thread when the GameStream state changes
bool lastGameStreamState = IsGameStreamEnabled();
while ((err = RegNotifyChangeKeyValue(key, true, REG_NOTIFY_CHANGE_LAST_SET, nullptr, false)) == ERROR_SUCCESS) {
while ((err = RegNotifyChangeKeyValue(key, true, REG_NOTIFY_CHANGE_NAME | REG_NOTIFY_CHANGE_LAST_SET, nullptr, false)) == ERROR_SUCCESS) {
bool currentGameStreamState = IsGameStreamEnabled();
if (lastGameStreamState != currentGameStreamState) {
SetEvent((HANDLE)Context);
@ -936,10 +972,18 @@ int Run(bool standaloneExe)
bool gameStreamEnabled = IsGameStreamEnabled();
if (gameStreamEnabled) {
printf("GameStream is ON!\n");
printf("GFE GameStream is ON!\n");
}
else {
printf("GameStream is OFF!\n");
printf("GFE GameStream is OFF!\n");
if (IsAlternateHostSoftwareRunning()) {
printf("Sunshine is RUNNING!\n");
gameStreamEnabled = true;
}
else {
printf("Sunshine is NOT RUNNING!\n");
}
}
// Acquire the mapping lock and update port mappings

View File

@ -238,7 +238,28 @@ bool ExecuteCommand(PCSTR command, PCHAR outputBuffer, DWORD outputBufferLength)
return true;
}
bool IsGameStreamEnabled()
bool IsSunshineRunning()
{
bool ret = false;
HANDLE processSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
PROCESSENTRY32 procEntry;
procEntry.dwSize = sizeof(procEntry);
Process32First(processSnapshot, &procEntry);
do {
if (_stricmp(procEntry.szExeFile, "sunshine.exe") == 0) {
ret = true;
break;
}
} while (Process32Next(processSnapshot, &procEntry));
CloseHandle(processSnapshot);
return ret;
}
bool IsGameStreamEnabled(bool sunshineRunning)
{
DWORD error;
DWORD enabled;
@ -248,8 +269,10 @@ bool IsGameStreamEnabled()
error = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software\\NVIDIA Corporation\\NvStream", 0, KEY_READ | KEY_WOW64_64KEY, &key);
if (error != ERROR_SUCCESS) {
fprintf(LOG_OUT, "RegOpenKeyEx() failed: %d\n", error);
DisplayMessage("GeForce Experience was not detected on this PC. Make sure you're installing this utility on your GeForce GameStream-compatible PC, not the device running Moonlight.",
"https://github.com/moonlight-stream/moonlight-docs/wiki/Setup-Guide");
if (!sunshineRunning) {
DisplayMessage("Neither GeForce Experience nor Sunshine are running on this PC. Make sure you're installing this utility on your host PC, not the device running Moonlight.",
"https://github.com/moonlight-stream/moonlight-docs/wiki/Setup-Guide");
}
return false;
}
@ -261,8 +284,10 @@ bool IsGameStreamEnabled()
if (error != ERROR_SUCCESS) {
fprintf(LOG_OUT, "RegQueryValueExA() failed: %d\n", error);
}
DisplayMessage("GameStream is not enabled in GeForce Experience. Please open GeForce Experience settings, navigate to the Shield tab, and turn GameStream on.",
"https://github.com/moonlight-stream/moonlight-docs/wiki/Setup-Guide");
if (!sunshineRunning) {
DisplayMessage("GameStream is not enabled in GeForce Experience. Please open GeForce Experience settings, navigate to the Shield tab, and turn GameStream on.",
"https://github.com/moonlight-stream/moonlight-docs/wiki/Setup-Guide");
}
return false;
}
else {
@ -1324,9 +1349,19 @@ int main(int argc, char* argv[])
fprintf(CONSOLE_OUT, "Checking if GameStream is enabled...\n");
// First check if GameStream is enabled
if (!IsGameStreamEnabled()) {
return -1;
bool sunshineRunning = IsSunshineRunning();
bool gfeGameStreamRunning = true;
if (!IsGameStreamEnabled(sunshineRunning)) {
if (sunshineRunning) {
DisplayMessage("The Moonlight Internet Hosting Tool is not designed for use with Sunshine.\n\n"
"To stream over the Internet with Sunshine, simply enable the UPnP option in the Sunshine Web UI.\n\n"
"Test results WILL be inaccurate if the Port option in Sunshine has been adjusted from the default value of 47989!",
nullptr, MpWarn, false);
gfeGameStreamRunning = false;
}
else {
return -1;
}
}
if (IsCurrentlyStreaming()) {
@ -1335,7 +1370,7 @@ int main(int argc, char* argv[])
return -1;
}
if (!IsConsoleSessionActive()) {
if (gfeGameStreamRunning && !IsConsoleSessionActive()) {
DisplayMessage("The system display is currently locked. You must sign in to your PC again to use GameStream.\n\n"
"This is most often due to Microsoft Remote Desktop locking the screen. Use an alternate GameStream-compatible remote desktop solution like Chrome Remote Desktop or TeamViewer to unlock the PC and prevent this error in the future.",
"https://github.com/moonlight-stream/moonlight-docs/wiki/Internet-Streaming-Errors#display-locked-error");
@ -1403,8 +1438,15 @@ int main(int argc, char* argv[])
sin.sin_addr = in4addr_loopback;
fprintf(LOG_OUT, "Testing GameStream ports via loopback\n");
if (!TestAllPorts(&ss, nullptr, portMsgBuf, sizeof(portMsgBuf), false, true)) {
snprintf(msgBuf, sizeof(msgBuf),
"Local GameStream connectivity check failed.\n\nFirst, try reinstalling GeForce Experience. If that doesn't resolve the problem, try temporarily disabling your antivirus and firewall.");
if (gfeGameStreamRunning) {
snprintf(msgBuf, sizeof(msgBuf),
"Local GameStream connectivity check failed.\n\nFirst, try reinstalling GeForce Experience. If that doesn't resolve the problem, try temporarily disabling your antivirus and firewall.");
}
else {
snprintf(msgBuf, sizeof(msgBuf),
"Local GameStream connectivity check failed.\n\nFirst, try restarting Sunshine. If that doesn't resolve the problem, try temporarily disabling your antivirus and firewall.\n\nNOTE: Sunshine must be configured to use the default 47989 port to test with this tool.");
}
DisplayMessage(msgBuf, "https://github.com/moonlight-stream/moonlight-docs/wiki/Troubleshooting");
return -1;
}

View File

@ -1,7 +1,7 @@
#pragma once
#define VER_VERSION 5,5,4,0
#define VER_VERSION_STR "5.5.4.0"
#define VER_VERSION 5,6,1,0
#define VER_VERSION_STR "5.6.1.0"
#define VER_COMPANYNAME_STR "Moonlight Game Streaming Project"
#define VER_PRODUCTNAME_STR "Moonlight Internet Hosting Tool"