Skip to content

Commit

Permalink
Merge branch 'develop' into native_rumble_support
Browse files Browse the repository at this point in the history
  • Loading branch information
Rackover authored Sep 29, 2024
2 parents b71338b + 1e7487e commit ec4d284
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 30 deletions.
2 changes: 1 addition & 1 deletion src/Components/Modules/Exception.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ namespace Components
// Combine with queued MinidumpsFolder
char filename[MAX_PATH]{};
CreateDirectoryA("minidumps", nullptr);
PathCombineA(filename, "minidumps\\", Utils::String::VA("%s-" VERSION "-%s.dmp", exeFileName, filenameFriendlyTime));
PathCombineA(filename, "minidumps\\", Utils::String::VA("%s-" REVISION_STR "-%s.dmp", exeFileName, filenameFriendlyTime));

constexpr auto fileShare = FILE_SHARE_READ | FILE_SHARE_WRITE;
HANDLE hFile = CreateFileA(filename, GENERIC_WRITE | GENERIC_READ, fileShare, nullptr, (fileShare & FILE_SHARE_WRITE) > 0 ? OPEN_ALWAYS : OPEN_EXISTING, NULL, nullptr);
Expand Down
5 changes: 2 additions & 3 deletions src/Components/Modules/Singleton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@ namespace Components
{
if (Flags::HasFlag("version"))
{
printf("%s", "IW4x " VERSION " (built " __DATE__ " " __TIME__ ")\n");
#ifdef EXPERIMENTAL_BUILD
printf("Revision: %i - develop\n", REVISION);
printf("%s", "IW4x " REVISION_STR "-develop (built " __DATE__ " " __TIME__ ")\n");
#else
printf("Revision: %i\n", REVISION);
printf("%s", "IW4x " REVISION_STR " (built " __DATE__ " " __TIME__ ")\n");
#endif

ExitProcess(EXIT_SUCCESS);
Expand Down
15 changes: 3 additions & 12 deletions src/Components/Modules/Updater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "Updater.hpp"
#include "Scheduler.hpp"
#include "version.hpp"

#include <Utils/WebIO.hpp>

Expand All @@ -13,21 +14,11 @@ namespace Components
{
const Game::dvar_t* cl_updateAvailable;

// If they use the alterware-launcher once to install they will have this file
// If they don't, what are they waiting for?
constexpr auto* REVISION_FILE = ".iw4xrevision";
constexpr auto* GITHUB_REMOTE_URL = "https://api.github.com/repos/iw4x/iw4x-client/releases/latest";
constexpr auto* INSTALL_GUIDE_REMOTE_URL = "https://forum.alterware.dev/t/how-to-install-the-alterware-launcher/56";

void CheckForUpdate()
{
std::string revision;
if (!Utils::IO::ReadFile(REVISION_FILE, &revision) || revision.empty())
{
Logger::Print("{} does not exist. Notifying the user an update is available\n", REVISION_FILE);
Game::Dvar_SetBool(cl_updateAvailable, true);
}

const auto result = Utils::WebIO("IW4x", GITHUB_REMOTE_URL).setTimeout(5000)->get();
if (result.empty())
{
Expand All @@ -52,8 +43,8 @@ namespace Components
return;
}

const auto* tag = doc["tag_name"].GetString();
if (revision != tag)
const std::string tag = doc["tag_name"].GetString();
if (REVISION_STR != tag)
{
// A new version came out!
Game::Dvar_SetBool(cl_updateAvailable, true);
Expand Down
8 changes: 4 additions & 4 deletions src/Resource.rc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "Windows.h"
#include "windows.h"

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
Expand All @@ -27,13 +27,13 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
// TEXTINCLUDE
//

1 TEXTINCLUDE
1 TEXTINCLUDE
BEGIN
"#include ""Windows.h""\r\n"
"#include ""windows.h""\r\n"
"\0"
END

2 TEXTINCLUDE
2 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
Expand Down
16 changes: 8 additions & 8 deletions src/STDInclude.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@
#define _WINSOCK_DEPRECATED_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <Windows.h>
#include <WinSock2.h>
#include <ShlObj.h>
#include <windows.h>
#include <winsock2.h>
#include <shlobj.h>
#include <timeapi.h>
#include <shellapi.h>
#include <wininet.h>
#include <d3d9.h>
#include <AclAPI.h>
#include <Psapi.h>
#include <TlHelp32.h>
#include <Shlwapi.h>
#include <aclapi.h>
#include <psapi.h>
#include <tlhelp32.h>
#include <shlwapi.h>

#include <DbgHelp.h>
#include <dbghelp.h>

#include <algorithm>
#include <cctype>
Expand Down
4 changes: 2 additions & 2 deletions src/Utils/WebIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ namespace Utils
if (success) *success = false;
if (!this->openConnection()) return {};

static const char* acceptTypes[] = { "application/x-www-form-urlencoded", nullptr };
static const char* acceptTypes[] = { "application/x-www-form-urlencoded", "application/json", nullptr };

DWORD dwFlag = INTERNET_FLAG_RELOAD | (this->isSecuredConnection() ? INTERNET_FLAG_SECURE : 0);

Expand Down Expand Up @@ -298,7 +298,7 @@ namespace Utils

DWORD statusCode = 404;
DWORD length = sizeof(statusCode);
if (HttpQueryInfoA(this->hFile_, HTTP_QUERY_FLAG_NUMBER | HTTP_QUERY_STATUS_CODE, &statusCode, &length, nullptr) == FALSE || (statusCode != 200 && statusCode != 201))
if (HttpQueryInfoA(this->hFile_, HTTP_QUERY_FLAG_NUMBER | HTTP_QUERY_STATUS_CODE, &statusCode, &length, nullptr) == FALSE || (statusCode != 200 && statusCode != 201 && statusCode != 304))
{
this->closeConnection();
return {};
Expand Down

0 comments on commit ec4d284

Please sign in to comment.