| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- /*
- ** Command & Conquer Generals(tm)
- ** Copyright 2025 Electronic Arts Inc.
- **
- ** This program is free software: you can redistribute it and/or modify
- ** it under the terms of the GNU General Public License as published by
- ** the Free Software Foundation, either version 3 of the License, or
- ** (at your option) any later version.
- **
- ** This program is distributed in the hope that it will be useful,
- ** but WITHOUT ANY WARRANTY; without even the implied warranty of
- ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ** GNU General Public License for more details.
- **
- ** You should have received a copy of the GNU General Public License
- ** along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
- #include <string>
- #include <stdio.h>
- #include "registry.h"
- void FormatURLFromRegistry( std::string& gamePatchURL, std::string& mapPatchURL,
- std::string& configURL, std::string& motdURL )
- {
- std::string sku = "generals";
- std::string language = "english";
- unsigned int version = 0; // invalid version - can't get on with a corrupt reg.
- unsigned int mapVersion = 0; // invalid version - can't get on with a corrupt reg.
- std::string baseURL = "http://servserv.generals.ea.com/servserv/";
- baseURL.append(sku);
- baseURL.append("/");
- GetStringFromRegistry("", "BaseURL", baseURL);
- GetStringFromRegistry("", "Language", language);
- GetUnsignedIntFromRegistry("", "Version", version);
- GetUnsignedIntFromRegistry("", "MapPackVersion", mapVersion);
- char buf[256];
- _snprintf(buf, 256, "%s%s-%d.txt", baseURL.c_str(), language.c_str(), version);
- gamePatchURL = buf;
- _snprintf(buf, 256, "%smaps-%d.txt", baseURL.c_str(), mapVersion);
- mapPatchURL = buf;
- _snprintf(buf, 256, "%sconfig.txt", baseURL.c_str());
- configURL = buf;
- _snprintf(buf, 256, "%sMOTD-%s.txt", baseURL.c_str(), language.c_str());
- motdURL = buf;
- }
|