mirror of
https://github.com/moonlight-stream/Internet-Hosting-Tool.git
synced 2025-07-01 15:26:54 +00:00
Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
ddd86d91eb | ||
|
546e30f363 | ||
|
432c2e226c | ||
|
cc98c2cd17 | ||
|
c8a5fe2efa | ||
|
6d5d83d420 | ||
|
1e1d347052 | ||
|
307623914b |
@ -1 +1 @@
|
||||
Subproject commit 48c0136b9d65fd3901de2d2593d98528ca5d1906
|
||||
Subproject commit e0db902f7dffb80aa63d5d330fceed243efe66a4
|
@ -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 -->
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user