mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Remove Windows XP code
This commit is contained in:
parent
da59deea84
commit
c7580b374c
|
@ -3458,22 +3458,6 @@ int open_link(const char *link)
|
|||
#endif
|
||||
}
|
||||
|
||||
int os_is_winxp_or_lower()
|
||||
{
|
||||
#if defined(CONF_FAMILY_WINDOWS)
|
||||
static const DWORD WINXP_MAJOR = 5;
|
||||
static const DWORD WINXP_MINOR = 1;
|
||||
OSVERSIONINFO ver;
|
||||
mem_zero(&ver, sizeof(OSVERSIONINFO));
|
||||
ver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
||||
GetVersionEx(&ver);
|
||||
return ver.dwMajorVersion < WINXP_MAJOR ||
|
||||
(ver.dwMajorVersion == WINXP_MAJOR && ver.dwMinorVersion <= WINXP_MINOR);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
struct SECURE_RANDOM_DATA
|
||||
{
|
||||
int initialized;
|
||||
|
|
|
@ -2129,16 +2129,6 @@ PROCESS shell_execute(const char *file);
|
|||
*/
|
||||
int kill_process(PROCESS process);
|
||||
|
||||
/*
|
||||
Function: os_is_winxp_or_lower
|
||||
Checks whether the program runs on Windows XP or lower.
|
||||
|
||||
Returns:
|
||||
1 - Windows XP or lower.
|
||||
0 - Higher Windows version, Linux, macOS, etc.
|
||||
*/
|
||||
int os_is_winxp_or_lower();
|
||||
|
||||
/*
|
||||
Function: generate_password
|
||||
Generates a null-terminated password of length `2 *
|
||||
|
|
|
@ -4501,11 +4501,7 @@ bool CClient::RaceRecord_IsRecording()
|
|||
void CClient::RequestDDNetInfo()
|
||||
{
|
||||
char aUrl[256];
|
||||
static bool s_IsWinXP = os_is_winxp_or_lower();
|
||||
if(s_IsWinXP)
|
||||
str_copy(aUrl, "http://info2.ddnet.tw/info", sizeof(aUrl));
|
||||
else
|
||||
str_copy(aUrl, "https://info2.ddnet.tw/info", sizeof(aUrl));
|
||||
str_copy(aUrl, "https://info2.ddnet.tw/info", sizeof(aUrl));
|
||||
|
||||
if(g_Config.m_BrIndicateFinished)
|
||||
{
|
||||
|
|
|
@ -102,7 +102,6 @@ void CUpdater::Init()
|
|||
m_pClient = Kernel()->RequestInterface<IClient>();
|
||||
m_pStorage = Kernel()->RequestInterface<IStorage>();
|
||||
m_pEngine = Kernel()->RequestInterface<IEngine>();
|
||||
m_IsWinXP = os_is_winxp_or_lower();
|
||||
}
|
||||
|
||||
CUpdater::~CUpdater()
|
||||
|
@ -204,13 +203,10 @@ bool CUpdater::ReplaceClient()
|
|||
char aPath[512];
|
||||
|
||||
// Replace running executable by renaming twice...
|
||||
if(!m_IsWinXP)
|
||||
{
|
||||
m_pStorage->RemoveBinaryFile(CLIENT_EXEC ".old");
|
||||
Success &= m_pStorage->RenameBinaryFile(PLAT_CLIENT_EXEC, CLIENT_EXEC ".old");
|
||||
str_format(aPath, sizeof(aPath), "update/%s", m_aClientExecTmp);
|
||||
Success &= m_pStorage->RenameBinaryFile(aPath, PLAT_CLIENT_EXEC);
|
||||
}
|
||||
m_pStorage->RemoveBinaryFile(CLIENT_EXEC ".old");
|
||||
Success &= m_pStorage->RenameBinaryFile(PLAT_CLIENT_EXEC, CLIENT_EXEC ".old");
|
||||
str_format(aPath, sizeof(aPath), "update/%s", m_aClientExecTmp);
|
||||
Success &= m_pStorage->RenameBinaryFile(aPath, PLAT_CLIENT_EXEC);
|
||||
#if !defined(CONF_FAMILY_WINDOWS)
|
||||
m_pStorage->GetBinaryPath(PLAT_CLIENT_EXEC, aPath, sizeof aPath);
|
||||
char aBuf[512];
|
||||
|
@ -387,23 +383,6 @@ void CUpdater::CommitUpdate()
|
|||
m_State = NEED_RESTART;
|
||||
else
|
||||
{
|
||||
if(!m_IsWinXP)
|
||||
m_pClient->Restart();
|
||||
else
|
||||
WinXpRestart();
|
||||
m_pClient->Restart();
|
||||
}
|
||||
}
|
||||
|
||||
void CUpdater::WinXpRestart()
|
||||
{
|
||||
char aBuf[512];
|
||||
IOHANDLE bhFile = io_open(m_pStorage->GetBinaryPath("du.bat", aBuf, sizeof aBuf), IOFLAG_WRITE);
|
||||
if(!bhFile)
|
||||
return;
|
||||
char bBuf[512];
|
||||
str_format(bBuf, sizeof(bBuf), ":_R\r\ndel \"" PLAT_CLIENT_EXEC "\"\r\nif exist \"" PLAT_CLIENT_EXEC "\" goto _R\r\n:_T\r\nmove /y \"update\\%s\" \"" PLAT_CLIENT_EXEC "\"\r\nif not exist \"" PLAT_CLIENT_EXEC "\" goto _T\r\nstart " PLAT_CLIENT_EXEC "\r\ndel \"du.bat\"\r\n", m_aClientExecTmp);
|
||||
io_write(bhFile, bBuf, str_length(bBuf));
|
||||
io_close(bhFile);
|
||||
shell_execute(aBuf);
|
||||
m_pClient->Quit();
|
||||
}
|
||||
|
|
|
@ -40,8 +40,6 @@ class CUpdater : public IUpdater
|
|||
class IStorage *m_pStorage;
|
||||
class IEngine *m_pEngine;
|
||||
|
||||
bool m_IsWinXP;
|
||||
|
||||
LOCK m_Lock;
|
||||
|
||||
int m_State;
|
||||
|
@ -80,7 +78,6 @@ public:
|
|||
virtual void InitiateUpdate();
|
||||
void Init();
|
||||
virtual void Update();
|
||||
void WinXpRestart();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue