From f17949b189ea7596c68e018075eacb0cf261666c Mon Sep 17 00:00:00 2001 From: Milo Akerman <40443620+MiloAkerman@users.noreply.github.com> Date: Thu, 30 Dec 2021 00:03:42 -0500 Subject: Created BUILD.md with build instructions --- BUILD.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 BUILD.md diff --git a/BUILD.md b/BUILD.md new file mode 100644 index 00000000..75f824bd --- /dev/null +++ b/BUILD.md @@ -0,0 +1,31 @@ +# Build Instructions +The following steps will allow you to compile your own NorthstarLauncher executable from the code in this repository. If you still have questions, you may ask in the [Discord Server](https://discord.gg/r2northstar) + +*This guide assumes you have already installed Northstar as shown in [this page](https://github.com/R2Northstar/Northstar/wiki/Basic-Setup)* + +### Steps +1. **Download the code** from the [R2Northstar/NorthstarLauncher](https://github.com/R2Northstar/NorthstarLauncher) repo +2. **Unzip the file.** +3. **Place the file somewhere memorable,** such as in your Documents directory +4. **Install Visual Studio 2022** from [this link](https://visualstudio.microsoft.com/downloads/). Northstar uses the vc2022 compiler, which is provided with Visual Studio. *You only need to download the Community edition.* +5. If you are prompted to download Workloads, check "Desktop Development with C++" If you are not prompted, don't worry, you'll be able to install this later on as well. + +![Desktop Development Workload](https://user-images.githubusercontent.com/40443620/147722260-b6ec90e9-7b74-4fb7-b512-680c039afaef.png) + +6. **Open the NorthstarLauncher folder** you unzipped with Visual Studio. A tab should open on the right hand side titled "Solution Explorer." + + + +This is a good time to edit the code. From the Solution Explorer, you can find any file you want to modify and do so. Don't forget to save your changes. + +7. **Double click on R2Northstar.sln** in the Solution Explorer. If you have not installed the Desktop Development Workload, you might be prompted now. If everything is correct, the Solution Explorer should change to two files: Northstar and NorthstarLauncher +8. In the top ribbon, press on **Build,** then **Build Solution.** + +![Build Ribbon Button](https://user-images.githubusercontent.com/40443620/147722646-3f50f6f4-61dd-4458-8f16-7dafec0be979.png) + +9. Wait for your build to finish. You can check on its status from the Output tab at the bottom +10. Once your build is finished, **Open the directory in File Explorer.** Then, go to x86 > Debug. You should see NorthstarLauncher.exe and Northstar.dll, as well as a couple other files. +11. **_In your Titanfall2 directory_**, move the preexisting NorthstarLauncher.exe and Northstar.dll into a new folder. You'll want to keep the default launcher backed up before testing any changes. +12. Back in the build debug directory, **Move NorthstarLauncher.exe and Northstar.dll to your Titanfall2 folder.** + +If everything is correct, you should now be able to launch the Northstar client with your changes applied. -- cgit v1.2.3 From e123245200cb6619467b8859c488b39f9cb2f38f Mon Sep 17 00:00:00 2001 From: BobTheBob <32057864+BobTheBob9@users.noreply.github.com> Date: Thu, 30 Dec 2021 18:09:36 +0000 Subject: move to server auth token system for verifying gameserver auth messages, rather than ip --- NorthstarDedicatedTest/masterserver.cpp | 5 ++++- NorthstarDedicatedTest/masterserver.h | 1 + NorthstarDedicatedTest/miscclientfixes.cpp | 6 ++++++ NorthstarDedicatedTest/serverauthentication.cpp | 18 +++++++++--------- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/NorthstarDedicatedTest/masterserver.cpp b/NorthstarDedicatedTest/masterserver.cpp index c4f576e3..e8ed3327 100644 --- a/NorthstarDedicatedTest/masterserver.cpp +++ b/NorthstarDedicatedTest/masterserver.cpp @@ -637,6 +637,7 @@ void MasterServerManager::AddSelfToServerList(int port, int authPort, char* name std::thread requestThread([this, port, authPort, strName, strDescription, strMap, strPlaylist, maxPlayers, strPassword] { m_ownServerId[0] = 0; + m_ownServerAuthToken[0] = 0; // build modinfo obj rapidjson::Document modinfoDoc; @@ -733,7 +734,7 @@ void MasterServerManager::AddSelfToServerList(int port, int authPort, char* name goto REQUEST_END_CLEANUP; } - if (!serverAddedJson.HasMember("id") || !serverAddedJson["id"].IsString()) + if (!serverAddedJson.HasMember("id") || !serverAddedJson["id"].IsString() || !serverAddedJson.HasMember("serverAuthToken") || !serverAddedJson["serverAuthToken"].IsString()) { spdlog::error("Failed reading masterserver response: malformed json object"); goto REQUEST_END_CLEANUP; @@ -742,6 +743,8 @@ void MasterServerManager::AddSelfToServerList(int port, int authPort, char* name strncpy(m_ownServerId, serverAddedJson["id"].GetString(), sizeof(m_ownServerId)); m_ownServerId[sizeof(m_ownServerId) - 1] = 0; + strncpy(m_ownServerAuthToken, serverAddedJson["serverAuthToken"].GetString(), sizeof(m_ownServerAuthToken)); + m_ownServerAuthToken[sizeof(m_ownServerAuthToken) - 1] = 0; // heartbeat thread // ideally this should actually be done in main thread, rather than on it's own thread, so it'd stop if server freezes diff --git a/NorthstarDedicatedTest/masterserver.h b/NorthstarDedicatedTest/masterserver.h index 9b55adda..1c57904b 100644 --- a/NorthstarDedicatedTest/masterserver.h +++ b/NorthstarDedicatedTest/masterserver.h @@ -71,6 +71,7 @@ private: public: char m_ownServerId[33]; + char m_ownServerAuthToken[33]; char m_ownClientAuthToken[33]; bool m_bOriginAuthWithMasterServerDone = false; diff --git a/NorthstarDedicatedTest/miscclientfixes.cpp b/NorthstarDedicatedTest/miscclientfixes.cpp index d9fab647..dc68d18c 100644 --- a/NorthstarDedicatedTest/miscclientfixes.cpp +++ b/NorthstarDedicatedTest/miscclientfixes.cpp @@ -37,4 +37,10 @@ void InitialiseMiscClientFixes(HMODULE baseAddress) // will say i have about 0 clue what exactly these functions do, testing this it doesn't even seem like they do much of anything i can see tbh ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x5A92D0, &CrashingWeaponActivityFunc0Hook, reinterpret_cast(&CrashingWeaponActivityFunc0)); ENABLER_CREATEHOOK(hook, (char*)baseAddress + 0x5A9310, &CrashingWeaponActivityFunc1Hook, reinterpret_cast(&CrashingWeaponActivityFunc1)); + + // experimental: allow cl_extrapolate to be enabled without cheats + { + void* ptr = (char*)baseAddress + 0x275F9D9; + *((char*)ptr) = (char)0; + } } \ No newline at end of file diff --git a/NorthstarDedicatedTest/serverauthentication.cpp b/NorthstarDedicatedTest/serverauthentication.cpp index 5351dfdc..32eb67fc 100644 --- a/NorthstarDedicatedTest/serverauthentication.cpp +++ b/NorthstarDedicatedTest/serverauthentication.cpp @@ -68,15 +68,15 @@ void ServerAuthenticationManager::StartPlayerAuthServer() m_playerAuthServer.Post("/authenticate_incoming_player", [this](const httplib::Request& request, httplib::Response& response) { // can't just do request.remote_addr == Cvar_ns_masterserver_hostname->m_pszString because the cvar can be a url, gotta resolve an ip from it for comparisons - unsigned long remoteAddr = inet_addr(request.remote_addr.c_str()); - - char* addrPtr = Cvar_ns_masterserver_hostname->m_pszString; - char* typeStart = strstr(addrPtr, "://"); - if (typeStart) - addrPtr = typeStart + 3; - hostent* resolvedRemoteAddr = gethostbyname((const char*)addrPtr); - - if (!request.has_param("id") || !request.has_param("authToken") || request.body.size() >= 65335 || !resolvedRemoteAddr || ((in_addr**)resolvedRemoteAddr->h_addr_list)[0]->S_un.S_addr != remoteAddr) + //unsigned long remoteAddr = inet_addr(request.remote_addr.c_str()); + // + //char* addrPtr = Cvar_ns_masterserver_hostname->m_pszString; + //char* typeStart = strstr(addrPtr, "://"); + //if (typeStart) + // addrPtr = typeStart + 3; + //hostent* resolvedRemoteAddr = gethostbyname((const char*)addrPtr); + + if (!request.has_param("id") || !request.has_param("authToken") || request.body.size() >= 65335 || !request.has_param("serverAuthToken") || strcmp(g_MasterServerManager->m_ownServerAuthToken, request.get_param_value("serverAuthToken").c_str()))// || !resolvedRemoteAddr || ((in_addr**)resolvedRemoteAddr->h_addr_list)[0]->S_un.S_addr != remoteAddr) { response.set_content("{\"success\":false}", "application/json"); return; -- cgit v1.2.3 From f341986b591cee533994597de418df1752ad5e97 Mon Sep 17 00:00:00 2001 From: BobTheBob <32057864+BobTheBob9@users.noreply.github.com> Date: Thu, 30 Dec 2021 23:31:52 +0000 Subject: force ipv4 while ipv6 is still unsupported --- NorthstarDedicatedTest/masterserver.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/NorthstarDedicatedTest/masterserver.cpp b/NorthstarDedicatedTest/masterserver.cpp index e8ed3327..0913be11 100644 --- a/NorthstarDedicatedTest/masterserver.cpp +++ b/NorthstarDedicatedTest/masterserver.cpp @@ -95,6 +95,7 @@ void MasterServerManager::AuthenticateOriginWithMasterServer(char* uid, char* or curl_easy_setopt(curl, CURLOPT_URL, fmt::format("{}/client/origin_auth?id={}&token={}", Cvar_ns_masterserver_hostname->m_pszString, uidStr, tokenStr).c_str()); curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET"); curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); + curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, CurlWriteToStringBufferCallback); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer); @@ -167,6 +168,7 @@ void MasterServerManager::RequestServerList() curl_easy_setopt(curl, CURLOPT_URL, fmt::format("{}/client/servers", Cvar_ns_masterserver_hostname->m_pszString).c_str()); curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET"); curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); + curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, CurlWriteToStringBufferCallback); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer); @@ -304,6 +306,7 @@ void MasterServerManager::RequestMainMenuPromos() curl_easy_setopt(curl, CURLOPT_URL, fmt::format("{}/client/mainmenupromos", Cvar_ns_masterserver_hostname->m_pszString).c_str()); curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET"); curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); + curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, CurlWriteToStringBufferCallback); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer); @@ -414,6 +417,7 @@ void MasterServerManager::AuthenticateWithOwnServer(char* uid, char* playerToken curl_easy_setopt(curl, CURLOPT_URL, fmt::format("{}/client/auth_with_self?id={}&playerToken={}", Cvar_ns_masterserver_hostname->m_pszString, uidStr, tokenStr).c_str()); curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST"); curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); + curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, CurlWriteToStringBufferCallback); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer); @@ -538,6 +542,7 @@ void MasterServerManager::AuthenticateWithServer(char* uid, char* playerToken, c std::string readBuffer; curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST"); curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); + curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, CurlWriteToStringBufferCallback); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer); @@ -670,6 +675,7 @@ void MasterServerManager::AddSelfToServerList(int port, int authPort, char* name std::string readBuffer; curl_easy_setopt(curl, CURLOPT_POST, 1L); curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); + curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, CurlWriteToStringBufferCallback); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer); @@ -758,6 +764,7 @@ void MasterServerManager::AddSelfToServerList(int port, int authPort, char* name std::string readBuffer; curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST"); curl_easy_setopt(curl, CURLOPT_URL, fmt::format("{}/server/heartbeat?id={}&playerCount={}", Cvar_ns_masterserver_hostname->m_pszString, m_ownServerId, g_ServerAuthenticationManager->m_additionalPlayerData.size()).c_str()); + curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, CurlWriteToStringBufferCallback); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer); @@ -802,6 +809,7 @@ void MasterServerManager::UpdateServerMapAndPlaylist(char* map, char* playlist, std::string readBuffer; curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST"); curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); + curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, CurlWriteToStringBufferCallback); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer); @@ -842,6 +850,7 @@ void MasterServerManager::UpdateServerPlayerCount(int playerCount) std::string readBuffer; curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST"); curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); + curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, CurlWriteToStringBufferCallback); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer); curl_easy_setopt(curl, CURLOPT_URL, fmt::format("{}/server/update_values?id={}&playerCount={}", Cvar_ns_masterserver_hostname->m_pszString, m_ownServerId, playerCount).c_str()); @@ -879,6 +888,7 @@ void MasterServerManager::WritePlayerPersistentData(char* playerId, char* pdata, std::string readBuffer; curl_easy_setopt(curl, CURLOPT_URL, fmt::format("{}/accounts/write_persistence?id={}&serverId={}", Cvar_ns_masterserver_hostname->m_pszString, strPlayerId, m_ownServerId).c_str()); curl_easy_setopt(curl, CURLOPT_POST, 1L); + curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, CurlWriteToStringBufferCallback); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer); @@ -920,6 +930,7 @@ void MasterServerManager::RemoveSelfFromServerList() std::string readBuffer; curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "DELETE"); curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); + curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, CurlWriteToStringBufferCallback); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer); curl_easy_setopt(curl, CURLOPT_URL, fmt::format("{}/server/remove_server?id={}", Cvar_ns_masterserver_hostname->m_pszString, m_ownServerId).c_str()); -- cgit v1.2.3