Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
526 commits
Select commit Hold shift + click to select a range
d75052a
First implementation of clientID used to detect/force old connection …
RedFlames Apr 28, 2023
c6764c6
Rewrite those guest name conditionals in Client, change generated Gue…
RedFlames Apr 28, 2023
dfd0367
Roll back this Guest-or-not-Guest approach to disambiguating names
RedFlames Apr 28, 2023
31c0d45
Fix potential ArgumentException being thrown trying to set Timer.Inte…
RedFlames May 1, 2023
7c006e1
Tidy up arrays of randomized name parts a bit, increase to 30x30 options
RedFlames May 1, 2023
56d1a09
Change LogLevel of logging ClientID/InstanceID, not a warning
RedFlames May 1, 2023
e18b6ec
Merge pull request #95 from RedFlames/tab-complete-improvements
RedFlames May 1, 2023
f31898f
Update English.txt (fixed double space)
RedFlames May 2, 2023
914ab69
Replace TODO 'tbd' comment with description of status quo
RedFlames May 2, 2023
b01806e
Expand lists of possible guest name elements, avoid duplication when …
RedFlames May 2, 2023
7018b8c
Base Guest name generation condition off actual handshake/auth Name r…
RedFlames May 2, 2023
dc34e0d
Update CelesteNetClient.cs
RedFlames May 3, 2023
e846ae5
Merge pull request #96 from RedFlames/guest-client-identifiers
RedFlames May 3, 2023
0016bf5
Log the LFSR mask and tokens until we fix it
RedFlames May 5, 2023
57c28b4
Merge pull request #98 from RedFlames/conn-token-logging
RedFlames May 5, 2023
cc0d6f7
Update version to 2.2.0, bump Everest dependency 3205 -> 3761
RedFlames May 6, 2023
6f763e2
Quick fix for the crash with GravityHelper's IL Hook on the 16, will …
RedFlames May 6, 2023
c98fc01
Choose LFSR polynomial randomly from a list of known-good ones
May 14, 2023
4adde98
Null-check Client and Client.Data in all the places in the components…
RedFlames Jun 5, 2023
bc7ab5e
Use the 'global_name' from Discord's JSON (a user's new global displa…
RedFlames Jun 8, 2023
d458fe4
Merge pull request #104 from RedFlames/discord-unique-username-changes
RedFlames Jun 8, 2023
247b792
Update RCEPPublic.cs
RedFlames Jun 8, 2023
5f86f47
Allow broadcasting targeted messages
SnipUndercover Jun 23, 2023
65625dc
Slightly move Chat commands around in the ChatModule
RedFlames Jul 1, 2023
7d2845e
Rename all the 'ChatCMD' stuff because I always thought it looked bad…
RedFlames Jul 1, 2023
1f902cf
Restrict which channels can be created in the server: No empty/whites…
RedFlames Jul 6, 2023
070e9d5
Ported over the commands rewrite from end of 2021... with some improv…
RedFlames Jul 7, 2023
1468c0c
Change args to be nullable in Cmd Runs, always override Run instead o…
RedFlames Jul 9, 2023
5754364
Be smarter about which Exceptions from parsing/running a command get …
RedFlames Jul 12, 2023
4b23595
Missed some 'Exception' type exceptions, and remove unused array from…
RedFlames Jul 12, 2023
c39b1a6
Only actually check player session state on param parsing if 'ParamPl…
RedFlames Jul 13, 2023
00f7cf0
Fix /help command not listing commands that have no ArgParsers.
RedFlames Jul 13, 2023
e79d4f7
Change the args[0] type checks to switch expressions with type matchi…
RedFlames Jul 13, 2023
8f29de2
Hide private /cc messages (#107)
SnipUndercover Jul 13, 2023
00251c3
English.txt setting fixups (#102)
SnipUndercover Jul 13, 2023
a823abf
At least log a warning if any part of was null in a component's Init…
RedFlames Jul 23, 2023
2dff3de
Change many of the `if (Foo?.Bar ?? false)` to just compare the Nulla…
RedFlames Jul 31, 2023
2cbee6e
Use Sessions directly + refactor
SnipUndercover Jul 31, 2023
52a56ec
Merge pull request #103 from RedFlames/avoid-client-context-NREs
RedFlames Aug 1, 2023
b1956de
Merge pull request #106 from SnipUndercover/targeted-broadcasts
RedFlames Aug 1, 2023
b0fccc6
Add Avali skin mod to FAQ page (#110)
RedFlames Aug 1, 2023
e58f34e
Merge pull request #108 from RedFlames/chat-module-split
RedFlames Aug 1, 2023
a10f0cf
Merge branch '0x0ade:main' into chat-commands-rewrite-2023
RedFlames Aug 1, 2023
82bcbf8
Code Cleanup on 'using' directives
RedFlames Aug 1, 2023
b33da62
Limit HairCount in graphics data (#112)
RedFlames Aug 2, 2023
d30cc31
New client version v2.2.2
RedFlames Aug 2, 2023
82b9a60
Return WebSocket command success instead of null (#111)
SnipUndercover Aug 23, 2023
35ee378
Prevent broadcasting targeted broadcasts to everyone (#113)
SnipUndercover Aug 23, 2023
c07248d
Prevent multiple messages from clashing (#114)
SnipUndercover Aug 23, 2023
e79cb01
Send player UIDs to authorized WebSockets (#115)
SnipUndercover Aug 23, 2023
f33ea60
Fix status WSCMD never actually parsing the payload (#117)
SnipUndercover Aug 23, 2023
b719375
Detect Everest Core installs and use legacyRef folder via CelesteNet.…
RedFlames Dec 29, 2023
6b6f31d
Merge pull request #118 from RedFlames/core-migrate-project
RedFlames Feb 24, 2024
d315bf7
Build client with net7.0 as Core mod (#120)
RedFlames Feb 28, 2024
6893780
Cleanup usings (finally) (#121)
SnipUndercover Feb 28, 2024
0569367
Bump YamlDotNet version
SnipUndercover Feb 28, 2024
45e549d
Bump System.Drawing.Common version
SnipUndercover Feb 28, 2024
32c1567
Make tag endings consistent
SnipUndercover Feb 28, 2024
c783fbb
Bump Newtonsoft.Json version
SnipUndercover Feb 28, 2024
72c58fd
Bump Mono.Options version
SnipUndercover Feb 28, 2024
d0bb7fa
Bump Microsoft.CodeAnalysis versions
SnipUndercover Feb 28, 2024
9640d1c
Bump MessagePack versions
SnipUndercover Feb 28, 2024
f7f79af
Remove unnecessary `System.Net.Http` reference
SnipUndercover Feb 28, 2024
7134940
Bump Microsoft.Data.Sqlite version
SnipUndercover Feb 28, 2024
84f20d8
Bump MonoMod versions
SnipUndercover Feb 29, 2024
43c8c97
Fix game freeze if StartThread and RecvThread both try to dispose Cli…
RedFlames Mar 5, 2024
ef13971
Fix Exceptions thrown on server by trying to lock StateLock on a play…
RedFlames Mar 5, 2024
2b5f13f
Merge pull request #123 from RedFlames/start-disconnect-lock-freeze
RedFlames Mar 5, 2024
4040a92
Merge branch 'main' into update-nuget-packages
SnipUndercover Mar 9, 2024
00de74c
Fix invalid priority
SnipUndercover Mar 9, 2024
e132ce1
Remove unused Steamworks.NET.dll dependency
SnipUndercover Mar 10, 2024
bdc331d
Reference .NET Core Everest
SnipUndercover Mar 10, 2024
00b0417
Build CelesteNet.Server.FrontendModule against .NET 7
SnipUndercover Mar 10, 2024
ca6c278
Build CelesteNet.Server.ChatModule against .NET 7
SnipUndercover Mar 10, 2024
0b7cc16
Build CelesteNet.Server.SqliteModule against .NET 7
SnipUndercover Mar 10, 2024
512c5d3
Remove CelesteNet.Shared .NET 6 build target
SnipUndercover Mar 10, 2024
f8d3eb6
Remove unused libraries
SnipUndercover Mar 10, 2024
0169bc7
Remove unused .NET Framework ref assemblies
SnipUndercover Mar 10, 2024
ed9f706
Remove unnecessary NullableAttributes.cs reference
SnipUndercover Mar 10, 2024
8020031
Remove unnecessary warning suppression
SnipUndercover Mar 10, 2024
c5be3a9
Unify .NET Framework/Core code paths
SnipUndercover Mar 10, 2024
a3b54be
Remove dummy AssemblyLoadContext implementations
SnipUndercover Mar 10, 2024
2fe368f
Use latest C# version
SnipUndercover Mar 10, 2024
4be0e1f
Fix deprecation warnings
SnipUndercover Mar 10, 2024
9b43b72
Fix missing MonoMod.Utils assembly
SnipUndercover Mar 10, 2024
9b7078a
Extend/change administrative features (#119)
RedFlames Mar 10, 2024
0b62377
Only copy Celeste when building the server
SnipUndercover Mar 10, 2024
075526a
Fix handshake with a ReadLine that REALLY doesn't try to buffer any o…
RedFlames Mar 17, 2024
8623716
Merge pull request #125 from RedFlames/really-stop-buffering-streams
RedFlames Mar 17, 2024
4c4cbb6
Add some silly little self-tests to Sqlite Module except not even usi…
RedFlames Mar 23, 2024
b6741f2
Merge pull request #124 from SnipUndercover/net-core-migration-part2
RedFlames Mar 24, 2024
0e25250
Merge pull request #126 from RedFlames/sqlite-module-selftests
RedFlames Mar 24, 2024
540b076
Introduce chat module config word lists that will be used to filter i…
RedFlames Mar 27, 2024
dea9271
Restructure some of how PrepareAndLog is called in ChatModule
RedFlames Mar 27, 2024
688897d
Make the `Target` property on DataChat obsolete and try to make its T…
RedFlames Mar 27, 2024
edd5c83
Merge branch 'main' into chat-commands-rewrite-2023
RedFlames Mar 27, 2024
a8e8ae5
Appease (some of) the green squiggles in VS.
RedFlames Mar 28, 2024
89ece21
Deal with some more issues in the Param classes
RedFlames Mar 28, 2024
8de92a6
Merge pull request #109 from RedFlames/chat-commands-rewrite-2023
RedFlames Mar 28, 2024
73ab000
Merge branch 'main' into chat-filter-words
RedFlames Mar 28, 2024
9d59a7c
Implement basic word filtering and apply it to names.
RedFlames Mar 28, 2024
7d05441
Fix issue with ParseAndRun when msg.Text doesn't start with command i…
RedFlames Mar 28, 2024
2d8d7ae
Reintroduce CmdEnv.Text with fixed handling
RedFlames Mar 28, 2024
06fee5d
Merge pull request #127 from RedFlames/chat-command-rewrite-hotfix
RedFlames Mar 28, 2024
f350667
Merge branch 'main' into chat-filter-words
RedFlames Mar 28, 2024
549b6fd
Start applying word filtering, with options for which channels/channe…
RedFlames Mar 29, 2024
ae5acb0
Add optional parameter in ApplyFilterHandling rather than the unused …
RedFlames Mar 29, 2024
9a8f3f5
Improve the 'filter' data send to Frontend and Websockets when a chat…
RedFlames Mar 29, 2024
53edba1
Move FilterDecision and FilterDecisionCause out of ChatModule class, …
RedFlames Mar 29, 2024
de2a015
Make sure to clear & update filter string HashSets whenever settings …
RedFlames Mar 29, 2024
641fbbf
A comment acknowledging my bad design
RedFlames Mar 30, 2024
d5c9ba8
Implement crab day (:crab:)
Mar 31, 2024
438d29a
Fix some issues with sessions getting dc'd during handshake still sho…
RedFlames Apr 13, 2024
208d550
Merge pull request #129 from RedFlames/session-early-dc-fix
RedFlames Apr 13, 2024
2a23447
This fix was already in main now and this makes more sense. An un-Ali…
RedFlames Apr 13, 2024
5e292bf
Merge branch 'main' into chat-filter-words
RedFlames Apr 13, 2024
2ebafe6
Remove all the character-class style Regex uses in ContainsFilteredWo…
RedFlames Apr 14, 2024
8b034cb
Chat filters, minor code cleanups
RedFlames Apr 20, 2024
0e663a6
Clean up json of "filter" WS cmd
RedFlames Apr 20, 2024
77b0510
Merge pull request #128 from RedFlames/chat-filter-words
RedFlames Apr 20, 2024
ffc97c8
Update CelesteNet.props
RedFlames Apr 20, 2024
df7cbdf
Implement avatar rounded resizing with ImageSharp from their example …
RedFlames Apr 20, 2024
da04933
Copy ImageSharp DLLs alongside FrontendModule output
RedFlames Apr 20, 2024
a5692de
Comment about ImageSharp sample code
RedFlames Apr 20, 2024
1ce1f42
Merge pull request #130 from RedFlames/image-library-change
RedFlames Apr 20, 2024
ab24076
Apply tag overlays onto avatars again, had been dropped when switchin…
RedFlames Apr 20, 2024
523d021
Merge pull request #131 from RedFlames/imagesharp-fixup
RedFlames Apr 20, 2024
5d846f4
Fix corner-rounding (ImageSharp example thoroughly broken fr) without…
RedFlames Apr 21, 2024
9342df8
Merge pull request #132 from RedFlames/imagesharp-fixup
RedFlames Apr 21, 2024
ef8df41
First attempt at spreading out the avatar fragment sends on the serve…
RedFlames Apr 21, 2024
c0db048
Log ClearAvatarQueues
RedFlames Apr 21, 2024
519729b
Client class shouldn't be using its field IsAlive to mean Disposed, I…
RedFlames Apr 21, 2024
43f0e1a
Slight fix(?) to when Client actually gets disposed on SafeDisposeTri…
RedFlames Apr 21, 2024
9be4249
Merge pull request #134 from RedFlames/client-lifecycle-edge-cases
RedFlames Apr 21, 2024
731d17c
Reinstate ClientOptions.AvatarsDisabled behavior, I accidentally had …
RedFlames Apr 26, 2024
a369d7a
Integrate Extras module into main repo
RedFlames Apr 28, 2024
66d53b4
Drop the data type logging there
RedFlames Apr 28, 2024
04b3adb
Fix /r command error returned on invalid last whisper session
RedFlames Apr 29, 2024
362a0a3
Restore ReadLine behavior in handshake to return last line and then n…
RedFlames Apr 29, 2024
cea1742
Attempt to catch that NRE someone had in CelesteNetEmoteComponent.Upd…
RedFlames Apr 29, 2024
4bbedb8
Force C# LangVersion back to 11, you need net8.0 SDK to build with co…
RedFlames Apr 29, 2024
959bd39
Bump up some of the LogLevels in the handshake to see authentication …
RedFlames Apr 29, 2024
2d987c9
DataChat.ToString implementation should respect its 'useDisplayName' …
RedFlames Apr 30, 2024
3b3e56b
Inject FullName rather than DisplayName into server-generated chat me…
RedFlames Apr 30, 2024
d70740a
Can remove this now that avatars aren't included in command responses…
RedFlames May 1, 2024
8bae0fb
Add a 'missing' avatar emoji that automatically acts as a placeholder…
RedFlames May 1, 2024
aa54841
Merge pull request #136 from RedFlames/extras-revert
RedFlames May 2, 2024
c6ff333
Merge pull request #133 from RedFlames/avatars-out-of-handshake
RedFlames May 2, 2024
d2f2945
Merge pull request #137 from RedFlames/misc-fixes-2024-04
RedFlames May 2, 2024
c3e4e59
Remove submodule entirely
RedFlames May 2, 2024
cffdd6f
New client version v2.3.0 released
RedFlames May 5, 2024
abe8a5c
Add RCEPs for 'testing' the avatar processing/re-processing individua…
RedFlames May 16, 2024
0fd7584
Fix: Only send new players' avatar to other sessions, if those have a…
RedFlames May 16, 2024
9936f5b
Make the 'overwrite' parts of the avatar-fixing related EPs require E…
RedFlames May 17, 2024
3f2781f
Merge pull request #138 from RedFlames/avatar-corner-fixer
RedFlames May 17, 2024
7f4ac17
Fix panel endpoint matching in js frontend sync callbacks
RedFlames May 18, 2024
5e01707
I did an oopsie in PR #134 where chat's Dispose doesn't unsubscribe f…
RedFlames May 18, 2024
a54e513
Almost remove the `TextInput.OnInput` -= line there... oops. And add …
RedFlames May 18, 2024
a29d336
Rewrite chat Active setter, splitting parts than can always be done (…
RedFlames May 19, 2024
5595144
Prevent chat from opening when a TextMenu.Modal is open. Ideally woul…
RedFlames May 19, 2024
5de0bf6
Publishing v2.3.1 as a hotfix
RedFlames May 19, 2024
218210e
Merge pull request #139 from RedFlames/chat-open-disconnect-lockup
RedFlames May 19, 2024
0797829
Changed UserData LoadAll & LoadRegistered to return Dictionary with U…
RedFlames May 30, 2024
d9d3bee
Accounts panel filter modes work-in-progress
RedFlames Jun 11, 2024
0e15628
Allow re-joining with invalid channel name in LastChannelUserInfo, re…
RedFlames Jun 13, 2024
ea08482
Add RCEP and frontend button that delete extra user data for a user (…
RedFlames Jun 13, 2024
40b02b2
Merge pull request #141 from RedFlames/illegal-channel-joins
RedFlames Jun 15, 2024
72d9d48
Implement local vs. server-side filtering
RedFlames Jun 22, 2024
1924369
Fix up wscmd 'update' panel ep matching hopefully for the last time.
RedFlames Jun 29, 2024
ba8eb58
Merge branch 'main' into frontend-rework-accounts-panel
RedFlames Jun 29, 2024
4f057f3
Fix accounts.js comment
RedFlames Jun 29, 2024
d3b4a0a
Forgot to track the 'seen' uids on the optimized userinfos EP, so ban…
RedFlames Jun 29, 2024
afb7841
Merge pull request #140 from RedFlames/frontend-rework-accounts-panel
RedFlames Jul 1, 2024
7836d2b
Attempting to fix three places where thread roles can die unexpectedl…
RedFlames Jul 5, 2024
76ca9fd
The ret == EINTR incident
RedFlames Jul 5, 2024
5d66eaf
Forgot to remove jump label
RedFlames Jul 5, 2024
21bf63d
Use the unbuffered ReadLine in the server-side handshake as well, and…
RedFlames Jul 6, 2024
2ad5b60
Merge pull request #143 from RedFlames/tcpepollpoller-exceptions
RedFlames Jul 6, 2024
a70ba40
Avatar send queue safeguard (#142)
RedFlames Jul 6, 2024
5db6821
CmdEnv.Text property implementation had a bug related to lettercasing…
RedFlames Jul 7, 2024
0310403
Prevent Log spam when TAS or whoever deep-clones a bunch of stuff
RedFlames Jul 12, 2024
e6afcf3
Create UserData directories if they don't exist at module init
RedFlames Jul 12, 2024
7a014b7
Fall back to a minimum default thread pool size if Settings.NetPlusTh…
RedFlames Jul 12, 2024
acd7ffe
Add Settings.HostOverride string for temporarily overriding which ser…
RedFlames Jul 12, 2024
be017af
Slight logging augmentations for associating sessions with UIDs / con…
RedFlames Jul 14, 2024
e3db6b8
Fix TagAdd wscmd
RedFlames Jul 14, 2024
9ba43ed
Turn Settings.HostOverride into ServerOverride because this makes way…
RedFlames Jul 15, 2024
c3ea3f5
Forgot the SettingIgnore attribute on ClientIDSending
RedFlames Jul 15, 2024
5203964
Log both finds and switch order of checking playerUID/conUID for bans…
RedFlames Jul 17, 2024
dff5f77
Copy paste mistake in prev commit
RedFlames Jul 17, 2024
2028c4b
Merge pull request #146 from RedFlames/misc-fixes-2024-07
RedFlames Jul 17, 2024
ba11520
Add incremental delay to prevent connection attempt spam
RedFlames Jul 12, 2024
f9b7f74
Add slight randomness to reconnect delays for when the server restart…
RedFlames Jul 13, 2024
0af2345
Fix warning 'CS8601: Possible null reference assignment' in YamlHelpe…
RedFlames Jul 20, 2024
c994b96
Handle possible null stream in TokenGenerator static ctor and throw e…
RedFlames Jul 20, 2024
32b40f5
Fix null-related build warnings
RedFlames Jul 20, 2024
9c6284d
Make Module.Start honor AutoReconnect setting, don't 'break' Connecte…
RedFlames Jul 20, 2024
98b2f8b
Hopefully better handling of which Status component to show connectio…
RedFlames Jul 20, 2024
2c8413c
Merge pull request #147 from RedFlames/client-reconnect-cooldown
RedFlames Jul 20, 2024
14eaf80
Merge pull request #149 from RedFlames/fix-server-compile-warnings
RedFlames Jul 20, 2024
f90b20a
/locate command
balt-dev Jul 21, 2024
7f42447
Rework /locate to resolve the message client-side
balt-dev Jul 21, 2024
18e292b
Fix spacing on icon
balt-dev Jul 21, 2024
ecb78f3
Properly handle when SID is empty
balt-dev Jul 21, 2024
857face
Remove stray logging
balt-dev Jul 21, 2024
5a74bd2
Reformat HandleLocate
balt-dev Jul 21, 2024
df22745
Remove static import and nullable annotation
balt-dev Jul 23, 2024
4fcca11
Change placeholder message
balt-dev Jul 23, 2024
7acc34a
Add CelesteNetSupportedClientFeatures
Jul 23, 2024
bd04a11
Refactor the extended handshake
Jul 23, 2024
f1cf1ba
Merge branch '0x0ade:main' into main
balt-dev Jul 23, 2024
e246603
Fix ExtendedHandshake connection data
Jul 24, 2024
d62eb18
Actually implement IConnectionInfoProvider
Jul 24, 2024
395470b
Rename ConnInfo to ExtHandshakeCheckValues
Jul 24, 2024
a164dea
Add client feature gateway to /locate
balt-dev Jul 24, 2024
27ac4d7
Fix ContainsKey / ContainsValue confusion
Jul 24, 2024
14ac642
Merge branch '0x0ade:main' into main
balt-dev Jul 24, 2024
7c543a5
Refactor AreaData related logic of CelesteNetPlayerListComponent.GetS…
RedFlames Aug 5, 2024
e4841fc
Forgot to add CelesteNet.Client/CelesteNetLocationInfo.cs to repo...!
RedFlames Aug 5, 2024
76db019
Remove duplicated code in CelesteNetLocationInfo ctor
RedFlames Aug 5, 2024
4cd4cbc
No idea why `using System.Data;` was in here.
RedFlames Aug 5, 2024
96abd4b
Use Ordinal instead of InvariantCulture comparison
SnipUndercover Aug 6, 2024
b7f8649
When sending CelesteNetClientOptions as header strings during the han…
RedFlames Aug 18, 2024
6c5611b
PrepareAndLog shouldn't be called for the locate response, especially…
RedFlames Aug 18, 2024
567bb00
Merge pull request #150 from balt-dev/main
RedFlames Aug 18, 2024
f6357bf
Merge pull request #152 from SnipUndercover/use-ordinal-comparison
RedFlames Aug 18, 2024
7d915ce
New client version v2.4.0 released
RedFlames Aug 20, 2024
629a1ce
Turns out PrepareAndLog was necessary in locate cmd after all, becaus…
RedFlames Aug 21, 2024
d0d9f6a
Fix issue with DataContext.WaitForAsync refactor, where token cancela…
RedFlames Aug 21, 2024
456efdf
The 'Connected' options is now named 'Connect to <server>' with name …
RedFlames Aug 24, 2024
2f40296
Show ExtraServers on Release builds as well if any are added. Only sh…
RedFlames Aug 25, 2024
41bae2a
Fix Server getting saved with ServerOverride's value which never shou…
RedFlames Aug 25, 2024
711748e
Give 'Server' a custom setter since that's public, and simplify Effec…
RedFlames Aug 25, 2024
8ecfb31
Merge pull request #155 from RedFlames/clear-up-localhost-attempts
RedFlames Aug 25, 2024
b68bf9e
New client version v2.4.1 released (hotfix with PR #155)
RedFlames Aug 25, 2024
405a7e5
("Optionally") remove all Monocle and Celeste references from Server …
RedFlames Sep 6, 2024
0268c57
Adjust CelesteNetRenderHelper IL to mostly mess with GraphicsDevice.V…
RedFlames Dec 10, 2024
f02ad6f
Enable nullable context in Client project (#160)
RedFlames Dec 20, 2024
e7378e3
Merge branch 'main' into fix-engine-viewport-better-maybe
RedFlames Dec 20, 2024
6fad8fb
Merge pull request #163 from RedFlames/fix-engine-viewport-better-maybe
RedFlames Dec 21, 2024
d8b3fde
Don't always throw exceptions in DataContext.Read that will kill a co…
RedFlames Dec 21, 2024
84763b3
Fully ignore DataNetEmoji in Client (hides own avatar when avatars di…
RedFlames Dec 21, 2024
c922419
Use custom exception during data read/writes and just log them when t…
RedFlames Dec 24, 2024
e40f3ad
Merge pull request #168 from RedFlames/length-mismatch-correction-oth…
RedFlames Dec 24, 2024
ad40da3
implement session-level interactions override
corkr900 Oct 13, 2024
5e58524
Create ModInterop for getting/setting the session-level interactions …
corkr900 Mar 22, 2025
ca93b0e
Merge pull request #172 from corkr900/main
RedFlames May 4, 2025
e510adb
Fix #175: simply add Ghost colliding logic
unknownersamli Jun 21, 2025
2dd1703
Add new property to describe the Ghost whether it is grabable
Jun 24, 2025
ac1be20
Change Collidable logic again or you cant stamp on Ghost while it is …
Jun 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ root = true
indent_style = space
indent_size = 4

[*.js]
indent_style = space
indent_size = 2

# https://kent-boogaart.com/blog/editorconfig-reference-for-c-developers

csharp_indent_block_contents = true
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# publishing byproducts
PubClient/
PubServer/
CelesteNet.Client.zip

# celeste reference libraries, in case someone really doesn't
# want cnet to be cloned in the Mods folder
lib-stripped/

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
Expand Down
5 changes: 2 additions & 3 deletions CelesteNet.Client/CelesteNet.Client.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<LangVersion>9</LangVersion> <!-- FIXME: Figure out why dotnet needs this! -->
<TargetFrameworks>net452</TargetFrameworks>
<TargetFrameworks>net7.0</TargetFrameworks>
<AssemblyName>CelesteNet.Client</AssemblyName>
<RootNamespace>Celeste.Mod.CelesteNet.Client</RootNamespace>
<Nullable>disable</Nullable>
<!-->Nullable>disable</Nullable-->
</PropertyGroup>

<Import Project="..\CelesteNet.props" />
Expand Down
133 changes: 97 additions & 36 deletions CelesteNet.Client/CelesteNetClient.cs
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
using Celeste.Mod.CelesteNet.DataTypes;
using MonoMod.Utils;
using System;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Celeste.Mod.CelesteNet.DataTypes;

namespace Celeste.Mod.CelesteNet.Client {

using cIDSendMode = CelesteNetClientSettings.ClientIDSendMode;

public class CelesteNetClient : IDisposable {

public readonly CelesteNetClientSettings Settings;
public readonly CelesteNetClientOptions Options;

public readonly DataContext Data;

public CelesteNetConnection Con;
public CelesteNetConnection? Con;
public readonly IConnectionFeature[] ConFeatures;
public volatile bool EndOfStream = false, SafeDisposeTriggered = false;
public volatile bool EndOfStream = false, SafeDisposeTriggered = false, Disposed = false;
public ConnectionErrorCodeException? LastConnectionError;

private bool _IsAlive;
public bool IsAlive {
Expand All @@ -38,11 +36,11 @@ public bool IsAlive {
public bool IsReady { get; protected set; }
private readonly ManualResetEventSlim _ReadyEvent;

public DataPlayerInfo PlayerInfo;
public DataPlayerInfo? PlayerInfo;

private readonly object StartStopLock = new();

private System.Timers.Timer HeartbeatTimer;
private System.Timers.Timer? HeartbeatTimer;

public CelesteNetClient()
: this(new(), new()) {
Expand All @@ -52,22 +50,43 @@ public CelesteNetClient(CelesteNetClientSettings settings, CelesteNetClientOptio
Settings = settings;
Options = options;

Options.AvatarsDisabled = !Settings.ReceivePlayerAvatars;
Options.ClientID = Settings.ClientID;
Options.InstanceID = Settings.InstanceID;

Options.SupportedClientFeatures |= CelesteNetSupportedClientFeatures.LocateCommand;

bool isServerLocalhost = Settings.Host == "localhost" || Settings.Host == "127.0.0.1";

if (Settings.ClientIDSending == cIDSendMode.Off || (Settings.ClientIDSending == cIDSendMode.NotOnLocalhost && isServerLocalhost))
Options.ClientID = 0;

Logger.Log(LogLevel.DEV, "lifecycle", $"CelesteNetClient created");

Data = new();

Logger.Log(LogLevel.INF, "data", "Rescanning all data types");
Data.IDToDataType.Clear();
Data.DataTypeToID.Clear();

Data.RescanDataTypes(CelesteNetClientModule.GetTypes());

Data.RegisterHandlersIn(this);

_ReadyEvent = new(false);

// Find connection features
List<IConnectionFeature> conFeatures = new();
foreach (Type type in CelesteNetUtils.GetTypes()) {
foreach (Type type in CelesteNetClientModule.GetTypes()) {
try {
if (!typeof(IConnectionFeature).IsAssignableFrom(type) || type.IsAbstract)
continue;
} catch {
} catch (Exception e) {
Logger.Log(LogLevel.VVV, "main", $"CelesteNetClient - conFeature threw {e.Message}");
continue;
}

IConnectionFeature feature = (IConnectionFeature) Activator.CreateInstance(type);
IConnectionFeature? feature = (IConnectionFeature?) Activator.CreateInstance(type);
if (feature == null)
throw new Exception($"Cannot create instance of connection feature {type.FullName}");
Logger.Log(LogLevel.VVV, "main", $"Found connection feature: {type.FullName}");
Expand All @@ -77,16 +96,20 @@ public CelesteNetClient(CelesteNetClientSettings settings, CelesteNetClientOptio
}

public void Start(CancellationToken token) {
if (IsAlive)
if (IsAlive) {
Logger.Log(LogLevel.DEV, "lifecycle", $"CelesteNetClient: Start called but IsAlive already");
return;
}
IsAlive = true;

lock (StartStopLock) {
if (IsReady)
if (IsReady) {
Logger.Log(LogLevel.DEV, "lifecycle", $"CelesteNetClient: Start called but IsReady already");
return;
}
Logger.Log(LogLevel.CRI, "main", $"Startup");

switch (Settings.ConnectionType) {
switch (Settings.Debug.ConnectionType) {
case ConnectionType.Auto:
case ConnectionType.TCPUDP:
case ConnectionType.TCP:
Expand All @@ -100,7 +123,8 @@ public void Start(CancellationToken token) {
sockAll.Add(new Socket(AddressFamily.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp));
if (Socket.OSSupportsIPv4)
sockAll.Add(new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp));
Socket sock = null;
Socket? sock = null;
LastConnectionError = null;
try {
uint conToken;
IConnectionFeature[] conFeatures;
Expand All @@ -114,9 +138,9 @@ public void Start(CancellationToken token) {
sockTry.Dispose();
}
})) {
Exception sockEx = null;
Exception? sockEx = null;
IPAddress[] addresses = Dns.GetHostAddresses(Settings.Host);
Tuple<uint, IConnectionFeature[], CelesteNetTCPUDPConnection.Settings> teapotRes = null;
Tuple<uint, IConnectionFeature[], CelesteNetTCPUDPConnection.Settings>? teapotRes = null;

foreach (Socket sockTry in sockAll)
Logger.Log(LogLevel.DBG, "main", $"... with socket type {sockTry.AddressFamily}");
Expand All @@ -133,8 +157,11 @@ public void Start(CancellationToken token) {
sock = sockTry;
sock.ReceiveTimeout = sock.SendTimeout = 2000;
sock.Connect(address, Settings.Port);

LastConnectionError = sockEx as ConnectionErrorCodeException;

// Do the teapot handshake here, as a successful "connection" doesn't mean that the server can handle IPv6.
teapotRes = Handshake.DoTeapotHandshake<CelesteNetClientTCPUDPConnection.Settings>(sock, ConFeatures, Settings.Name, Options);
teapotRes = Handshake.DoTeapotHandshake<CelesteNetClientTCPUDPConnection.Settings>(sock, ConFeatures, Settings.NameKey, Options);
Logger.Log(LogLevel.INF, "main", $"Connecting to {address} ({address.AddressFamily}) succeeded");
break;
} catch (Exception e) {
Expand All @@ -156,7 +183,8 @@ public void Start(CancellationToken token) {
continue;
try {
sockTry.Close();
} catch {
} catch (Exception e) {
Logger.Log(LogLevel.DEV, "lifecycle", $"CelesteNetClient Start: sock close caught '{e.Message}'");
}
sockTry.Dispose();
}
Expand All @@ -177,21 +205,21 @@ public void Start(CancellationToken token) {
conToken = teapotRes.Item1;
conFeatures = teapotRes.Item2;
settings = teapotRes.Item3;
Logger.Log(LogLevel.INF, "main", $"Teapot handshake success: token {conToken} conFeatures '{conFeatures.Select(f => f.GetType().FullName).Aggregate((string) null, (a, f) => (a == null) ? f : $"{a}, {f}")}'");
Logger.Log(LogLevel.INF, "main", $"Teapot handshake success: token {conToken} conFeatures '{conFeatures.Select(f => f.GetType().FullName).Aggregate((string?) null, (a, f) => (a == null) ? f : $"{a}, {f}")}'");
sock.ReceiveTimeout = sock.SendTimeout = (int) (settings.HeartbeatInterval * settings.MaxHeartbeatDelay);
}

// Create a connection and start the heartbeat timer
CelesteNetClientTCPUDPConnection con = new(this, conToken, settings, sock);
con.OnDisconnect += _ => Dispose();
if (Settings.ConnectionType == ConnectionType.TCP)
if (Settings.Debug.ConnectionType == ConnectionType.TCP)
con.UseUDP = false;

// Initialize the heartbeat timer
HeartbeatTimer = new(settings.HeartbeatInterval);
HeartbeatTimer.AutoReset = true;
HeartbeatTimer.Elapsed += (_, _) => {
string disposeReason = con.DoHeartbeatTick();
string? disposeReason = con.DoHeartbeatTick();
if (disposeReason != null) {
Logger.Log(LogLevel.CRI, "main", disposeReason);
Dispose();
Expand All @@ -200,16 +228,18 @@ public void Start(CancellationToken token) {
HeartbeatTimer.Start();

// Do the regular connection handshake
Handshake.DoConnectionHandshake(Con, conFeatures, token);
Handshake.DoConnectionHandshake(con, conFeatures, token);
Logger.Log(LogLevel.INF, "main", $"Connection handshake success");

Con = con;
} catch {
} catch (Exception e) {
Logger.Log(LogLevel.DEV, "lifecycle", $"CelesteNetClient Start: Caught exception, will throw: '{e.Message}'");
Con?.Dispose();
foreach (Socket sockTry in sockAll) {
try {
sockTry.Close();
} catch {
} catch (Exception se) {
Logger.Log(LogLevel.DEV, "lifecycle", $"CelesteNetClient Start: sock close caught '{se.Message}'");
}
sockTry.Dispose();
}
Expand All @@ -220,10 +250,11 @@ public void Start(CancellationToken token) {
break;

default:
throw new NotSupportedException($"Unsupported connection type {Settings.ConnectionType}");
throw new NotSupportedException($"Unsupported connection type {Settings.Debug.ConnectionType}");
}
}

Logger.Log(LogLevel.VVV, "main", $"Client Start: Waiting for Ready");
// Wait until the server sent the ready packet
_ReadyEvent.Wait(token);
SendFilterList();
Expand All @@ -233,8 +264,11 @@ public void Start(CancellationToken token) {
}

public void Dispose() {
if (!IsAlive)
if (Disposed) {
Logger.Log(LogLevel.DEV, "lifecycle", $"CelesteNetClient Dispose called but already disposed");
return;
}
Disposed = true;
IsAlive = false;

lock (StartStopLock) {
Expand Down Expand Up @@ -271,21 +305,48 @@ public T Send<T>(T data) where T : DataType<T> {
}

public DataType SendAndHandle(DataType data) {
Con?.Send(data);
Data.Handle(null, data);
if (Con != null) {
Con.Send(data);
Data.Handle(Con, data);
}
return data;
}

public T SendAndHandle<T>(T data) where T : DataType<T> {
Con?.Send(data);
Data.Handle(null, data);
if (Con != null) {
Con.Send(data);
Data.Handle(Con, data);
}
return data;
}

public void Handle(CelesteNetConnection con, DataPlayerInfo info) {
// The first DataPlayerInfo sent from the server is our own
if (PlayerInfo == null || PlayerInfo.ID == info.ID)
if (PlayerInfo == null || PlayerInfo.ID == info.ID) {
PlayerInfo = info;

if (Settings.NameKey == "Guest" && info.Name == "Guest") {
// strip off any '#x' suffix
int i = info.FullName.IndexOf('#');
string newName = i > 0 ? info.FullName.Substring(0, i) : info.FullName;

// take on the 'generated' Guest name
if (newName != "Guest") {
Logger.Log(LogLevel.INF, "playerinfo", $"Connected as Guest, but got '{newName}'. Saving fixed Guest name to config.");
Settings.Name = newName;
}
}
}
}

public bool Filter(CelesteNetConnection con, DataPlayerInfo info) {
if (info == null)
return false;

if(Options.AvatarsDisabled) {
info.DisplayName = info.FullName;
}
return true;
}

public void Handle(CelesteNetConnection con, DataReady ready) {
Expand Down
Loading