Code Monkey home page Code Monkey logo

northstarlauncher's Introduction

NorthstarLauncher

Build Status

Launcher used to modify Titanfall 2 to allow Northstar mods and custom content to be loaded.

Build

Check BUILD.md for instructions on how to compile, you can also download binaries built by GitHub Actions.

Format

This project uses clang-format, make sure you run clang-format -i --style=file --exclude=primedev/include primedev/*.cpp primedev/*.h when opening a Pull Request. Check the tool's website for instructions on how to integrate it with your IDE.

northstarlauncher's People

Contributors

abarichello avatar alystrasz avatar aspoonplaysgames avatar barnabwhy avatar bobthebob9 avatar catornot avatar cpdt avatar eladnlg avatar emma-miler avatar erlite avatar f1f7y avatar geckoeidechse avatar geniiii avatar glacir avatar h0l0thebard avatar happydoge avatar jakubiakdev avatar jan200101 avatar jjrcop avatar kittenpopo avatar kylegospo avatar legonzaur avatar luludotdev avatar miloakerman avatar p0358 avatar pg9182 avatar royalblue1 avatar scurex avatar uniboi avatar wolf109909 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

northstarlauncher's Issues

Rework path and input/output handling

Benefits:

  • Optionally run NS from any directory (this obviously won't be possible if using the ws2 proxy launcher, but it's still useful for other situations).
  • Allow everything to be read-only and shared except for the per-server data in a configurable location (for dedicated servers).
  • Make console input work on Wine (hopefully).
  • Make console output not be full of junk on Wine (hopefully).
  • Centralize path construction for NS data and resources.
  • Provide more flexibility for future improvements.

I'm currently thinking of implementing this by passing a config struct to the ns init function containing references to functions which resolve paths, read input, and write output. The bulk of the logic will still be in the DLL, and it will be possible to make the DLL standalone and inject it with other methods simply by having a default implementation there.

https://discord.com/channels/920776187884732556/943369531538173993/943574689035456512

... I'll also work on reworking the launcher exe to deal with paths and input/output and pass that config via a struct to the dll init function (although bob hasn't decided if he wants this in the end or not), making the dll use absolute paths for all ns stuff, and making it detect the titanfall path from either the current dir, the registry (for the installations using EAInstaller's touchup; i.e., steam and origin), or a command line flag / env var, which will allow use to have ns/tf2/ns mods/data in separate folders (greatly simplifying the install process, development, running multiple dedicated servers, and my container image entrypoint) (all of this is still tentative; it depends on how busy I am and whether tf2 itself works fine this way)

Note that I still haven't fully decided if I'm going to take this approach; I'm still in the phase of experimenting with possible solutions, and I'm also somewhat busy right now.

Client chat hooks memory leak

In the CHudChat::AddGameLine hook:

static void CHudChat__AddGameLineHook(void* self, const char* message, int inboxId, bool isTeam, bool isDead)
{
if (g_ClientSquirrelManager->setupfunc("CHudChat_ProcessMessageStartThread") != SQRESULT_ERROR)
{
// This hook is called for each HUD, but we only want our logic to run once.
if (!IsFirstHud(self))
{
return;
}
int senderId = inboxId & CUSTOM_MESSAGE_INDEX_MASK;

If squirrel->setupfunc does not error but IsFirstHud returns false, squirrel->call will never be called. The function that squirrel->setupfunc pushes to the stack will never be popped, leaking memory.

This will happen roughly four times for each chat message, since CHudChat::AddGameLine is called for every chat hud and IsFirstHud returns false for all but one of them.

Add CI / Github Actions

Some form of CI to build launcher binaries on every commit would help a lot with testing pre-releases and pull requests.
Would also be useful in the future when doing packaged releases on the main release repo.

Dedicated server won't show up in menu UI when console reports the server info.

When using the 1.0.1 version of the release, some(?) servers will not show up in the server browser although it is listed in the console.
image
(using custom masterserver in this pic, but it doesn't work even with bob's official server for me.)
reverting northstar.client mod back to 1.0.0 version solved the issue, server is properly displayed and connectable.

Allow mods to hook chat messages

Goal

By adding a way for mods to read chat messages mods can then be used to perform actions based on a message sent in chat.

Background

For example currently there are already mods that allow you to vote skip maps like Takyon.PlayerVote by issuing a command like !skip via the console.

The issue is that the console is not the most accessible place to issue such commands.

  • Players new to Northstar might not know how to open the console.
  • Players on keyboards other than ANSI-US or ISO-UK (like ISO-DE) might not even be able to open the console in the first place as the default key assigned to opening the console does not exist there. Instead those players first need to remap the console key by opening the keybinds settings file or adding a launch argument to Northstar.

Additional

Depending on the command it might not be wise to broadcast the message back to other players. So allowing a server mod to prevent forwarding such a message might be another thing worth investigating.

dedicated: Export prometheus metrics

The dedicated server should export metrics. I will probably work on an initial version of this in my docker image, but I may end up just directly implementing it in the launcher itself.

Some ideas for useful metrics:

  • counter northstar_instance_ticks_total
  • counter northstar_instance_uptime_seconds
  • gauge northstar_instance_info{arguments, game_port, auth_port} (more?) = 1 (maybe?)
  • gauge northstar_match_player_count
  • gauge northstar_match_player_limit
  • gauge northstar_match_info{playlist_name, map_name} = 1
  • gauge northstar_match_duration_seconds
  • histogram northstar_network_client_latency_milliseconds{uid} (maybe?)
  • counter northstar_network_receive_bytes
  • counter northstar_network_transmit_bytes
  • counter northstar_network_receive_packets
  • counter northstar_network_transmit_packets
  • guage northstar_cpu_seconds_total
  • guage northstar_memory_physical_bytes
  • guage northstar_memory_virtual_bytes

Fix logger not being initialized correctly sometimes

Not entirely sure what causes this yet, but sometimes the logger seem to not initialize correctly, leading to none of the spdlog::info messages being written to console. It's pretty annoying during debugging.

Secondary weapon keys are inverted with Anti-Titan weapons

When using the key to deploy my anti-titan weapon, it deploys my secondary sidearm and vice versa. Also, when using the switch weapon bind, it toggles between the anti-titan weapon and primary where is should toggle between side arm and primary. I think the logic should adhere to what the standard TF2 game has unless there is a really good reason to change this?

Server Failes to Fully Initialize - Attempted to read from: 0x00000030

I'm attempting to run the server under AMP by CubeCoders as a generic module. This runs under the Network Service user. I'm able to start the server fine using the same files outside of AMP, but get the attached error when attempting inside. I am more than willing/capable to diagnose the AMP side, but would appreciate any guidance on the NorthStar side. Can you please shed some light on where I might look for the cause?

nslog03-01-2022 05-14-44.txt

Game gets stuck on the menu

I was able to play when I first installed it but now it loads the screen that you would normally see the animation and Menu. I get the animation but no menu. There is an error on the console:

[info] Enabling hook OnCommandSubmittedHook
[info] Building custom scripts.rson
[info] changing mod search path from E:\Titanfall 2\Titanfall2\R2Northstar\mods\Northstar.Custom\mod to R2Northstar/mods\Northstar.Client
[info] changing mod search path from E:\Titanfall 2\Titanfall2\R2Northstar\mods\Northstar.Client\mod to R2Northstar/mods\Northstar.Custom
[info] changing mod search path from E:\Titanfall 2\Titanfall2\R2Northstar\mods\Northstar.Custom\mod to R2Northstar/mods\Northstar.Client
[info] changing mod search path from E:\Titanfall 2\Titanfall2\R2Northstar\mods\Northstar.Client\mod to R2Northstar/mods\Northstar.Custom
[info] changing mod search path from E:\Titanfall 2\Titanfall2\R2Northstar\mods\Northstar.Custom\mod to R2Northstar/mods\Northstar.Client
[error] CLIENT SCRIPT COMPILE ERROR Undefined variable "IsNorthstarServer"
[error] ui/openinvites.nut line [205] column [50]
[info] DestroyVM UI 0x626e700
[info] Building KeyValues for file playlists_v2.txt
[info] MountVPK vpk/client_mp_common.bsp
[info] MountVPK R2Northstar/mods\Northstar.Custom\vpk\client_mp_northstar_common.bsp
[info] 0x45cee80
[info] MountVPK vpk/client_mp_common.bsp
[info] MountVPK R2Northstar/mods\Northstar.Custom\vpk\client_mp_northstar_common.bsp
[info] 0x45cee80

Doesn't launch on Windows 7

Exactly what the title says. Followed the guide, compared my files to screenshots from other anons, and it just doesn't launch, giving pic related error.
error
Only difference found was the operating system

[Feature Request] Generate Titanfall2-unpacked.exe if missing

Right now, this launcher requires Titanfall2-unpacked.exe to be present with it in the zip file, which means distributing Respawn/EA owned assets.

I think it would be safer for the project if the launcher automatically unpacks/patches Titanfall2.exe into Titanfall2-unpacked.exe if the latter is missing, then launches it. This way you don't need to distribute the asset with the launcher.

Additionally, it could help speed up packaging new releases, because you don't need to include Titanfall2-unpacked.exe

Dropship Crash

Dedicated server seemingly crashing on dropship spawn.

unable to compile release/debug build for x86 (missing curl.h and rapidjson error)

hey all,
i'm trying to compile this launcher from source, and i can't seem to get it to build. the first error is that it's somehow not detecting i have curl installed, as it keeps complaining:
D:\git repos i stole lol\NorthstarLauncher\NorthstarDedicatedTest\masterserver.cpp(6,10): fatal error C1083: Cannot open include file: 'libcurl/include/curl/curl.h': No such file or directory
it's also complaining a lot about rapidjson, as it keeps saying:
C:\src\vcpkg\installed\x86-windows\include\rapidjson\document.h(665,59): error C2248: 'rapidjson::GenericMemberIterator<false,Encoding,Allocator>::Iterator': cannot access private typedef declared in class 'rapidjson::GenericMemberIterator<false,Encoding,Allocator>'
with
[
Encoding=rapidjson::UTF8<char>,
Allocator=rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator>
]
if i could get some help with this, that'd be amazing.

Allow the master server to identify the launcher version

The launcher should send a user agent with all requests just in case we ever need to make backwards-incompatible changes.

More specifically, this should be the launcher version, not the mod version, and dev builds should still specify the last released version.

Add update checker to launcher

To prevent players from running into issues due to using older versions of the client, Northstar launcher should do an update check every time it is launched.

A possible setup would having a file called VERSION.txt inside the release zip that contains the current version. That value is then compared to and endpoint on master server (like /client-version) and a warning is displayed if the versions don't match up.
Warning should however be skippable.
A failed connection to master server should also display a warning but that too should be skippable (to prevent DoSing all clients by just taking down server).

Additionally by exposing the newest/desired client version via master server, 3rd party master servers could also request older clients if they themselves are not up to date (due to breaking changes).

Add build docs

Add some build documentation so people can easily compile their own modified launchers

DLL deemed trojan malware

VirusTotal deems the .dll file malware.

obv. a false positive, as previously with NorthstarLauncher.exe

i've contacted MaxSecure about whitelisting the file, so i'll wait for an email response.

Access Violation (Additional logs posted)

This keeps happening on death of my player. (Not every time). It's always failing to read from 0x00001720
Scrolling up in the logs as stated in the documentation lead me to this error

[2022-02-21 14:33:55.787] [info] [CLIENT SCRIPT]  FULL OBITUARY INFO COULD NOT BE RESOLVED 
[2022-02-21 14:33:55.788] [info] [CLIENT SCRIPT]     attacker: entity (0: class C_World [0])
[2022-02-21 14:33:55.789] [info] [CLIENT SCRIPT]     attacker classname: class C_World
[2022-02-21 14:33:55.789] [info] [CLIENT SCRIPT]     attackerOwner: null
[2022-02-21 14:33:55.790] [info] [CLIENT SCRIPT]     victim: entity (11: player [11])
[2022-02-21 14:33:55.790] [info] [CLIENT SCRIPT]     victim classname: player
[2022-02-21 14:33:55.790] [info] [CLIENT SCRIPT]     victimOwner: null
[2022-02-21 14:33:55.791] [info] [CLIENT SCRIPT]     scriptDamageType: 0
[2022-02-21 14:33:55.791] [info] [CLIENT SCRIPT]     damageSourceId: 206
[2022-02-21 14:33:55.791] [info] [CLIENT SCRIPT]     sourceDisplayName: #DEATH_FALL

Feature: start Origin/EA minimized and add an option to close the console

Alt-tabbing and sharing screens on Discord can be a pain with the console window open, and not many people are going to use it anyways, so a command-line argument that can be placed into origin's launch args or into the Northstar arguments text file would be really nice to have. Also, when starting Northstar without Origin or EA Desktop open, when it opens the app it should be minimised or hiding in the system tray.

dedicated: Integrate stubs

TLDR: I got the dlls I created for my Docker container working on Windows, drastically reducing the resource usage of the dedicated server by eliminating the need for softwared3d11 (and the multiple gigabytes of memory usage) or a GPU. This will serve as an interim solution until @Mauler125 gets around to the patches for completely eliminating matsys.

Currently, you can simply copy the stubs into the bin/x64_retail dir, replacing the existing ones. I am planning to add functionality to load the DLLs explicitly from the bin/x64_dedi (or bin/x64_stubs maybe) dir instead (once they're loaded, windows resolves relative imports by the base module name, so we've effectively replaced the real DLLs) to streamline the process and eliminate the need to replace base game files.

  • Extract the stubs to a separate repo (NorthstarStubs).
  • Implement CI script and releases.
  • Move the repo to the NS org.
  • Make a release.
  • Implement stub loading in NorthstarLauncher.
  • Add the stubs to the Northstar CI script.
  • Update my northstar-dedicated repo to point to NorthstarStubs for the stubs.

pg9182/northstar-dedicated@6b5645e/src/d3d11
pg9182/northstar-dedicated@6b5645e/src/gfsdk
R2Northstar/Northstar#149 (comment)

Discord > #server-hosting > #windows-stubs : 943573635992547378

so as discussed on VC, I'll put the stubs in a new NorthstarStubs repo with CI and binary releases, then bob'll adopt it into the org and give me admin on that repo, then I'll open a PR to load the stubs in the launcher from bin/x64_dedi (if it exists) for dedi, then I'll open a PR to add the stubs to the release packages

Discord > #server-hosting > #windows-stubs : 943582877189292094

[as further discussed], we'll keep the softwared3d11 flag, but make the stubs the default (softwared3d11 will disable them but print a warning message)

Restrict filesystem calls of basegame to Titanfall2 directory

Intro

In order to reduce the damage any undetected exploit can do we should try to intercept filesystem calls of the Titanfall2 install and ensure that they are within the Titanfall2\.

This way any damage done by an exploit would be limited to within the Titanfall2 which both reduces the amount of damage it could do to the system as well reducing the amount of information it could leak from the users system, as the game install folder typically contains very little private information.

Testing:

In order to test whether such an implementation was successful, place a known working .bik menu video a folder above Titanfall2\.
So it would look as follows:

.
├───other-Steam/Origin-games
├───some-menu-video.bik
└───Titanfall2

Then launch Northstar and from the main menu inside the console run

script_ui DisableBackgroundMovie(); script_ui PlayVideo("../../../bik-filename-without-the-dot-bik", 0, 0, 0, 0, false)

If the video plays, the game can still read files outside the install folder meaning the implemented hook was not successful.

Possible issues:

  • Naturally the game reads a lot of files to load assets etc. so any hook needs to be very performant.
  • There are some files located outside of Titanfall2\ like Documents\Respawn\Titanfall2\local\settings.cfg that the game still needs to be able to access

Additional:

If there's anything sensitive in the Titanfall2 by default we should also restrict access to that part.
(Anything Origin related in their that contains sensitive stuff like authentication tokens etc?)

Crashes on respawn

I am not very gifted in the field of coding and whatnot but I'm having a rather consistent issue. Simply skipping the killcam and respawning results in a crash to desktop. Crash log attached
nslog2022-01-23 17-27-19.txt
.

Game makes system unresponse after staying long in lobby

Description

When keeping the game open for an hour while staying in lobby, windows becomes unresponsive with lagging mouse movement.

How to reproduce

  1. Start Titanfall through northstar
  2. Enter the multiplayer lobby
  3. Stay there for an hour

Specs

Game

  • Titanfall 2 (Steam) (on hdd, using DGPU)

System

  • Windows 10 LTSC 2021 (from ssd)
  • Intel I7-7700HQ
  • 16 GB DDR4 3200Mhz
  • NVIDIA GeForce 1050 TI Mobile
  • Seagate 256 NVME
  • Seagate 1TB 5400 RPM HDD

Notes

  • Titanfall 2 vanilla performs as expected
  • Northstar generates a lot of log information every second.
    Are the hooks being reapplied constantly?

Attachments

nslog31-12-2021 17-35-31.txt

Custom console window

We should create our own external console window, as the one we use right now makes it tricky to have a console window when invoked from another application.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.