Compare commits

..

No commits in common. "master" and "v5.5.4" have entirely different histories.

5 changed files with 22 additions and 108 deletions

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

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<?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_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_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)"
Version="$(var.VCREDIST_VER).0"
Hash="$(var.VCREDIST_X86_SHA1)"/>
<!-- Newer version installed is fine -->

View File

@ -542,42 +542,6 @@ 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;
@ -912,7 +876,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_NAME | REG_NOTIFY_CHANGE_LAST_SET, nullptr, false)) == ERROR_SUCCESS) {
while ((err = RegNotifyChangeKeyValue(key, true, REG_NOTIFY_CHANGE_LAST_SET, nullptr, false)) == ERROR_SUCCESS) {
bool currentGameStreamState = IsGameStreamEnabled();
if (lastGameStreamState != currentGameStreamState) {
SetEvent((HANDLE)Context);
@ -972,18 +936,10 @@ int Run(bool standaloneExe)
bool gameStreamEnabled = IsGameStreamEnabled();
if (gameStreamEnabled) {
printf("GFE GameStream is ON!\n");
printf("GameStream is ON!\n");
}
else {
printf("GFE GameStream is OFF!\n");
if (IsAlternateHostSoftwareRunning()) {
printf("Sunshine is RUNNING!\n");
gameStreamEnabled = true;
}
else {
printf("Sunshine is NOT RUNNING!\n");
}
printf("GameStream is OFF!\n");
}
// Acquire the mapping lock and update port mappings

View File

@ -238,28 +238,7 @@ bool ExecuteCommand(PCSTR command, PCHAR outputBuffer, DWORD outputBufferLength)
return true;
}
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)
bool IsGameStreamEnabled()
{
DWORD error;
DWORD enabled;
@ -269,10 +248,8 @@ bool IsGameStreamEnabled(bool sunshineRunning)
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);
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");
}
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");
return false;
}
@ -284,10 +261,8 @@ bool IsGameStreamEnabled(bool sunshineRunning)
if (error != ERROR_SUCCESS) {
fprintf(LOG_OUT, "RegQueryValueExA() failed: %d\n", error);
}
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");
}
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 {
@ -1349,19 +1324,9 @@ int main(int argc, char* argv[])
fprintf(CONSOLE_OUT, "Checking if GameStream is enabled...\n");
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;
}
// First check if GameStream is enabled
if (!IsGameStreamEnabled()) {
return -1;
}
if (IsCurrentlyStreaming()) {
@ -1370,7 +1335,7 @@ int main(int argc, char* argv[])
return -1;
}
if (gfeGameStreamRunning && !IsConsoleSessionActive()) {
if (!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");
@ -1438,15 +1403,8 @@ 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)) {
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.");
}
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.");
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,6,1,0
#define VER_VERSION_STR "5.6.1.0"
#define VER_VERSION 5,5,4,0
#define VER_VERSION_STR "5.5.4.0"
#define VER_COMPANYNAME_STR "Moonlight Game Streaming Project"
#define VER_PRODUCTNAME_STR "Moonlight Internet Hosting Tool"