diff --git a/ZuneModCore/Mods/WebservicesMod.cs b/ZuneModCore/Mods/WebservicesMod.cs index 844855d..bc44404 100644 --- a/ZuneModCore/Mods/WebservicesMod.cs +++ b/ZuneModCore/Mods/WebservicesMod.cs @@ -154,9 +154,19 @@ public class WebservicesMod(ModMetadata metadata) : Mod(metadata), IAsyncInit return $"Failed to reach \"{newHost}\". Ping status: {ping.Status}"; } - // Patch ZuneServices.dll to use the new host instead of zune.net + // Read URL block as string zsDllReader.BaseStream.Position = ZUNESERVICES_ENDPOINTS_BLOCK_OFFSET; string endpointBlock = System.Text.Encoding.Unicode.GetString(zsDllReader.ReadBytes(ZUNESERVICES_ENDPOINTS_BLOCK_LENGTH)); + + // Try to determine previous host + try + { + var firstUrl = endpointBlock[..endpointBlock.IndexOf('\0')]; + oldHost = firstUrl.Substring(11, oldHost.Length); + } + catch { } + + // Patch ZuneServices.dll to use the new host instead of zune.net endpointBlock = endpointBlock.Replace("resources." + oldHost, "www.zuneupdate.com"); // Use zuneupdate.com until resources.zunes.me is online endpointBlock = endpointBlock.Replace(oldHost, newHost); byte[] endpointBytes = System.Text.Encoding.Unicode.GetBytes(endpointBlock);