IncPlusPlus / titanfall2-rp

Titanfall 2 Discord Rich Presence
MIT License
8 stars 2 forks source link

Add invites #76

Open IncPlusPlus opened 3 years ago

IncPlusPlus commented 3 years ago

Allow for people to join games or create invitations through discord. This one is gonna be the absolute hardest to implement. I'm not sure if it's even gonna be possible externally.

This may or may not be a useful resource

The goal here is to use a discord RP button that says "ask to join" and stuff like that.

headassbtw commented 2 years ago

i may have an idea on this, i’ll look into it

IncPlusPlus commented 2 years ago

I've been working on this obsessively over the past several weeks. As it turns out, all of the invite handling happens in the Origin.exe process in OriginClient.dll. I've gotten a setup that allows for the reliable injection of the .NET Core CLR and my own executable code into the active Origin instance. The injected code hooks the right functions to be able to know when invites are sent and received by the client. It can also call those functions itself. Right now, I'm able to call functions to invite a user by their Origin ID and accept an incoming invite from a specific ID.

The current priority is to check whether it's possible to send an invite to an Origin user who isn't on the sender's friends list. If that's possible, that'd make my life a lot easier. If not, there are more APIs that I'll need to tear apart involving querying the friends list, adding friends, and then sending/accepting the invite. This is super complicated for a simple request of "can you add the join button?" but it's actually possible! I didn't think it could ever happen but by being mind-bogglingly stubborn, I've gotten close to making this a reality. Let's just hope that the EA app doesn't improve their Titanfall 2 rich presence beyond the stub of an implementation they already have and invalidate all my hard work.

btarg commented 2 years ago

Can't wait to see this feature! Northstar doesn't make it super easy to join a friend's game so this is an important feature to have

IncPlusPlus commented 2 years ago

While I did manage to get Origin invites working (with one caveat), my work is now useless since uhhhhh... this is happening.

image

@iCrazyBlaze I hadn't even started looking into how to make this possible with Northstar. Northstar doesn't utilize the Origin lobby functionality at all from what I can tell. It's gonna be pretty hard for me to integrate Northstar into this (the implementation will be completely different) but I'll sure as hell try.