From d7c79399a4bb139bf7fdfb517166b11dc4e6729f Mon Sep 17 00:00:00 2001
From: Ricky Merc <65817116+RickyB505@users.noreply.github.com>
Date: Tue, 28 Jul 2026 13:43:17 -0400
Subject: [PATCH] Changes
---
MenuAPI.sln | 34 ------------------
MenuAPI.slnx | 4 +++
MenuAPI/MenuAPI.csproj | 4 ---
MenuAPI/MenuController.cs | 73 ++++++++++++++++++++++++++++++++-------
TestMenu/TestMenu.csproj | 5 ---
5 files changed, 65 insertions(+), 55 deletions(-)
delete mode 100644 MenuAPI.sln
create mode 100644 MenuAPI.slnx
diff --git a/MenuAPI.sln b/MenuAPI.sln
deleted file mode 100644
index 8c5989a..0000000
--- a/MenuAPI.sln
+++ /dev/null
@@ -1,34 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.29319.158
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MenuAPI", "MenuAPI\MenuAPI.csproj", "{9C746601-9F3D-4B0D-877C-1C7BC493C5BC}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestMenu", "TestMenu\TestMenu.csproj", "{A91669DA-E3C1-4DC3-A3A6-97476B17214A}"
- ProjectSection(ProjectDependencies) = postProject
- {9C746601-9F3D-4B0D-877C-1C7BC493C5BC} = {9C746601-9F3D-4B0D-877C-1C7BC493C5BC}
- EndProjectSection
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug FiveM|Any CPU = Debug FiveM|Any CPU
- Release FiveM|Any CPU = Release FiveM|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {9C746601-9F3D-4B0D-877C-1C7BC493C5BC}.Debug FiveM|Any CPU.ActiveCfg = Debug FiveM|Any CPU
- {9C746601-9F3D-4B0D-877C-1C7BC493C5BC}.Debug FiveM|Any CPU.Build.0 = Debug FiveM|Any CPU
- {9C746601-9F3D-4B0D-877C-1C7BC493C5BC}.Release FiveM|Any CPU.ActiveCfg = Release FiveM|Any CPU
- {9C746601-9F3D-4B0D-877C-1C7BC493C5BC}.Release FiveM|Any CPU.Build.0 = Release FiveM|Any CPU
- {A91669DA-E3C1-4DC3-A3A6-97476B17214A}.Debug FiveM|Any CPU.ActiveCfg = Debug FiveM|Any CPU
- {A91669DA-E3C1-4DC3-A3A6-97476B17214A}.Debug FiveM|Any CPU.Build.0 = Debug FiveM|Any CPU
- {A91669DA-E3C1-4DC3-A3A6-97476B17214A}.Release FiveM|Any CPU.ActiveCfg = Release FiveM|Any CPU
- {A91669DA-E3C1-4DC3-A3A6-97476B17214A}.Release FiveM|Any CPU.Build.0 = Release FiveM|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {EE5A945A-4A5A-42DE-89AB-7AE2C7645EE3}
- EndGlobalSection
-EndGlobal
diff --git a/MenuAPI.slnx b/MenuAPI.slnx
new file mode 100644
index 0000000..d47d0f1
--- /dev/null
+++ b/MenuAPI.slnx
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/MenuAPI/MenuAPI.csproj b/MenuAPI/MenuAPI.csproj
index 65cb29a..3975113 100644
--- a/MenuAPI/MenuAPI.csproj
+++ b/MenuAPI/MenuAPI.csproj
@@ -31,10 +31,6 @@
-
-
-
-
diff --git a/MenuAPI/MenuController.cs b/MenuAPI/MenuController.cs
index d05f71d..eb40812 100644
--- a/MenuAPI/MenuController.cs
+++ b/MenuAPI/MenuController.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Threading;
using System.Threading.Tasks;
using CitizenFX.Core;
@@ -103,14 +104,62 @@ public enum MenuAlignmentOption
///
public void Initialize()
{
- API.SetInterval(ProcessMenus, 3, 0);
- API.SetInterval(DrawInstructionalButtons, 3, 0);
- API.SetInterval(ProcessMainButtons, 3, 0);
- API.SetInterval(ProcessDirectionalButtons, 100l, 0);
- API.SetInterval(ProcessToggleMenuButton, 3, 0);
- API.SetInterval(MenuButtonsDisableChecks, 3, 0);
+ LoopProcessMenus();
+ LoopDrawInstructionalButtons();
+ LoopProcessMainButtons();
+ LoopProcessDirectionalButtons();
+ LoopProcessToggleMenuButton();
+ LoopMenuButtonsDisableChecks();
}
+ async void LoopProcessMenus()
+ {
+ while (true)
+ {
+ await ProcessMenus();
+ await API.Yield();
+ }
+ }
+ async void LoopDrawInstructionalButtons()
+ {
+ while (true)
+ {
+ await DrawInstructionalButtons();
+ await API.Yield();
+ }
+ }
+ async void LoopProcessMainButtons()
+ {
+ while (true)
+ {
+ await ProcessMainButtons();
+ await API.Yield();
+ }
+ }
+ async void LoopProcessDirectionalButtons()
+ {
+ while (true)
+ {
+ await ProcessDirectionalButtons();
+ await API.Yield();
+ }
+ }
+ async void LoopProcessToggleMenuButton()
+ {
+ while (true)
+ {
+ await ProcessToggleMenuButton();
+ await API.Yield();
+ }
+ }
+ async void LoopMenuButtonsDisableChecks()
+ {
+ while (true)
+ {
+ await MenuButtonsDisableChecks();
+ await API.Yield();
+ }
+ }
///
/// This binds the menu to the and sets the menu's parent to .
///
@@ -220,7 +269,7 @@ public static Menu GetCurrentMenu()
/// Process the select & go back/cancel buttons.
///
///
- private async void ProcessMainButtons()
+ private async Task ProcessMainButtons()
{
if (!IsAnyMenuOpen())
{
@@ -362,7 +411,7 @@ private bool IsDownPressed()
/// Processes the menu toggle button to check if the menu should open or close.
///
///
- private async void ProcessToggleMenuButton()
+ private async Task ProcessToggleMenuButton()
{
if (!MenuToggleKeyIsValid)
{
@@ -401,7 +450,7 @@ private async Task ProcessToggleMenuButtonFiveM()
/// Process left/right/up/down buttons (also holding down buttons will speed up after 3 iterations)
///
///
- private async void ProcessDirectionalButtons()
+ private async Task ProcessDirectionalButtons()
{
// Return if the buttons are not currently enabled.
if (!AreMenuButtonsEnabled)
@@ -692,7 +741,7 @@ private async Task HandleUpNavigation(Menu currentMenu)
}
}
- private async void MenuButtonsDisableChecks()
+ private async Task MenuButtonsDisableChecks()
{
bool isInputVisible() => UpdateOnscreenKeyboard() == 0;
if (isInputVisible())
@@ -847,7 +896,7 @@ private static void DisableRadioInputs()
/// Draws all the menus that are visible on the screen.
///
///
- private static async void ProcessMenus()
+ private static async Task ProcessMenus()
{
if (!(
Menus.Any() &&
@@ -901,7 +950,7 @@ private static async Task DrawMenus()
}
}
- internal static async void DrawInstructionalButtons()
+ internal static async Task DrawInstructionalButtons()
{
if (
IsPlayerSwitchInProgress() ||
diff --git a/TestMenu/TestMenu.csproj b/TestMenu/TestMenu.csproj
index 01d13bb..b51af3b 100644
--- a/TestMenu/TestMenu.csproj
+++ b/TestMenu/TestMenu.csproj
@@ -8,12 +8,7 @@
default
-
- FIVEM
-
-
-