Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 11 additions & 4 deletions src/SharpModMenu/PlayerExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
{
public static ObserverInfo GetObserverInfo(this CCSPlayerController player)
{
if (!player.IsValid)
return new() { Mode = ObserverMode.Roaming, Observing = null };

if (!player.Pawn.IsValid || player.Pawn.Value is not CBasePlayerPawn pawn)
return new() { Mode = ObserverMode.Roaming, Observing = null };

Expand Down Expand Up @@ -79,15 +82,18 @@
};
}

public static CCSGOViewModel? GetPredictedViewmodel(this ObserverInfo observerInfo)
public static CBaseEntity? GetPredictedViewmodel(this ObserverInfo observerInfo)
{
// no viewmodel ability right now
return null;

if (observerInfo.Observing is not CCSPlayerPawnBase pawn)

Check warning on line 90 in src/SharpModMenu/PlayerExtensions.cs

View workflow job for this annotation

GitHub Actions / Continuous integration

Unreachable code detected
return null;
if (pawn.ViewModelServices is null)
return null;
//if (pawn.ViewModelServices is null)
// return null;
if (observerInfo.Mode != ObserverMode.FirstPerson)
return null;

/*
var offset = Schema.GetSchemaOffset("CCSPlayer_ViewModelServices", "m_hViewModel");
nint viewmodelHandleAddress = pawn.ViewModelServices.Handle + offset + 4;

Expand All @@ -101,5 +107,6 @@
}

return handle.Value;
*/
}
}
7 changes: 5 additions & 2 deletions src/SharpModMenu/PlayerMenuState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,8 @@
/// </summary>
private bool CreateInitialInvisibleWorldTextEntity()
{
return false;
var observerInfo = Player.GetObserverInfo();

Check warning on line 245 in src/SharpModMenu/PlayerMenuState.cs

View workflow job for this annotation

GitHub Actions / Continuous integration

Unreachable code detected

if (_CreatedFor.HasValue && _CreatedFor.Value == observerInfo.Observing?.Handle)
return false;
Expand Down Expand Up @@ -309,7 +310,7 @@
private static QAngle _Ang = new();
private void UpdateEntity(
CPointWorldText ent,
CCSGOViewModel? viewmodel,
CBaseEntity? viewmodel,
string newText,
Vector3 position,
Vector3 angles,
Expand Down Expand Up @@ -356,10 +357,12 @@
private readonly StringBuilder BackgroundSb = new();
private nint MenuCurrentObserver { get; set; } = nint.Zero;
private ObserverMode MenuCurrentObserverMode { get; set; }
private CCSGOViewModel? MenuCurrentViewmodel { get; set; }
private CBaseEntity? MenuCurrentViewmodel { get; set; }
public bool DrawActiveMenu()
{
return false; // nothing to parent to right now, further work needed

if (ReferenceEquals(CurrentMenu, LastPresented))

Check warning on line 365 in src/SharpModMenu/PlayerMenuState.cs

View workflow job for this annotation

GitHub Actions / Continuous integration

Unreachable code detected
{
if (CurrentMenu is not null && !CurrentMenu.IsDirty)
return true;
Expand Down
2 changes: 1 addition & 1 deletion src/SharpModMenu/SharpModMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
// https://github.com/CharlesBarone/CSSharp-Fixes/blob/9f20129bd4d17dcf7f30311ac0d24ec56895b04a/gamedata/cssharpfixes.json#L44
private static string ProcessUserCmdsSig => RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
? "48 8B C4 44 88 48 20 44 89 40 18 48 89 50 10 53"
: "55 48 89 E5 41 57 41 56 41 89 D6 41 55 41 54 49 89 FC 53 48 83 EC 38";
: "55 48 89 E5 41 57 41 56 41 55 41 54 53 48 89 FB 48 83 EC ? 89 4D";
// void* FASTCALL ProcessUsercmds(CCSPlayerController* player, CUserCmdPB* cmds, int cmdCount, bool paused, float margin);
private static MemoryFunctionWithReturn<nint, nint, int, bool, float, nint, nint>? ProcessUserCmdsFunc { get; set; }
private bool UseFallbackWasdInputMethod { get; set; } = false;
Expand Down Expand Up @@ -349,7 +349,7 @@

if (false)
{
var sb = new StringBuilder();

Check warning on line 352 in src/SharpModMenu/SharpModMenu.cs

View workflow job for this annotation

GitHub Actions / Continuous integration

Unreachable code detected
for (int n = 0; n < span.Length; n++)
{
if (n % 16 == 0)
Expand Down
3 changes: 2 additions & 1 deletion src/SharpModMenu/SharpModMenu.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CSSUniversalMenuAPI" Version="0.3.1" ExcludeAssets="runtime" />
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.331" />
<PackageReference Include="CSSUniversalMenuAPI" Version="0.4.0" ExcludeAssets="runtime" />
</ItemGroup>

</Project>