### Initialize DMA Memory and Connect to Game Process (C#) Source: https://context7.com/lone-dma/lone-eft-dma-radar/llms.txt Initializes the DMA memory interface and establishes a connection to the game process. It includes event handlers for process lifecycle (starting, started, stopped) and raid lifecycle (started, stopped). Game state can be accessed via static properties like Memory.InRaid, Memory.LocalPlayer, Memory.Players, and Memory.Game. ```csharp using System; using System.Threading.Tasks; using eft_dma_radar.DMA; // Initialize DMA module and start memory worker thread await Memory.ModuleInitAsync(); // Subscribe to process lifecycle events Memory.ProcessStarting += (sender, e) => { Console.WriteLine("Waiting for game process..."); }; Memory.ProcessStarted += (sender, e) => { Console.WriteLine($"Game process started: {Memory.GameProcess.Name}"); }; Memory.ProcessStopped += (sender, e) => { Console.WriteLine("Game process stopped"); }; // Subscribe to raid lifecycle events Memory.RaidStarted += (sender, e) => { Console.WriteLine($"Raid started: {Memory.Game?.MapName ?? "Unknown"}"); Console.WriteLine($"Local player: {Memory.LocalPlayer?.Name ?? "Unknown"}"); }; Memory.RaidStopped += (sender, e) => { Console.WriteLine("Raid ended"); }; // Memory.MemoryPrimaryWorker() runs automatically in background thread // Access current game state via static properties: if (Memory.InRaid) { var localPlayer = Memory.LocalPlayer; var allPlayers = Memory.Players; var gameWorld = Memory.Game; } ``` -------------------------------- ### Integrate Web Radar Server using SignalR in C# Source: https://context7.com/lone-dma/lone-eft-dma-radar/llms.txt Hosts a SignalR-based web server to enable remote radar viewing. Configures server settings like port, tick rate, password, and CORS. It automatically starts the server and can optionally attempt to forward the port using UPnP. Clients can connect using a SignalR JavaScript client to receive game state updates. ```csharp using eft_dma_radar.Web.WebRadar; using System; using System.Threading.Tasks; // Configure web radar server var config = new WebRadarConfig { Enabled = true, Port = 8080, TickRateHz = 20, // 20 updates per second Password = "mySecurePassword123", UseUPnP = true, // Auto port forwarding AllowedOrigins = "*" // CORS }; // Create and start server var webRadarServer = new WebRadarServer(config); await webRadarServer.StartAsync(); Console.WriteLine($"Web Radar Server running on:"); Console.WriteLine($" Local: http://localhost:{config.Port}"); if (config.UseUPnP) { // UPnP will attempt to forward port automatically var publicIP = await GetPublicIPAsync(); Console.WriteLine($" Public: http://{publicIP}:{config.Port}"); } // Server automatically broadcasts game state to connected clients // Clients connect via SignalR JavaScript client: /* const connection = new signalR.HubConnectionBuilder() .withUrl("http://localhost:8080/radar-hub", { accessTokenFactory: () => "mySecurePassword123" }) .build(); connection.on("ReceiveRadarUpdate", (data) => { console.log("Players:", data.players); console.log("Loot:", data.loot); console.log("Local Player:", data.localPlayer); // Render on web-based radar display }); await connection.start(); */ // Stop server gracefully await webRadarServer.StopAsync(); ``` -------------------------------- ### Memory Initialization and DMA Connection Source: https://context7.com/lone-dma/lone-eft-dma-radar/llms.txt Initializes the DMA memory interface and establishes a connection to the game process. It also provides event handlers for process and raid lifecycle events. ```APIDOC ## Memory Initialization and DMA Connection ### Description Initializes the DMA memory interface and establishes a connection to the game process. It also provides event handlers for process and raid lifecycle events. ### Method Asynchronous initialization method. ### Endpoint N/A (This is a library initialization) ### Parameters None ### Request Example ```csharp using System; using System.Threading.Tasks; using eft_dma_radar.DMA; // Initialize DMA module and start memory worker thread await Memory.ModuleInitAsync(); // Subscribe to process lifecycle events Memory.ProcessStarting += (sender, e) => { Console.WriteLine("Waiting for game process..."); }; Memory.ProcessStarted += (sender, e) => { Console.WriteLine($"Game process started: {Memory.GameProcess.Name}"); }; Memory.ProcessStopped += (sender, e) => { Console.WriteLine("Game process stopped"); }; // Subscribe to raid lifecycle events Memory.RaidStarted += (sender, e) => { Console.WriteLine($"Raid started: {Memory.Game?.MapName ?? "Unknown"}"); Console.WriteLine($"Local player: {Memory.LocalPlayer?.Name ?? "Unknown"}"); }; Memory.RaidStopped += (sender, e) => { Console.WriteLine("Raid ended"); }; // Memory.MemoryPrimaryWorker() runs automatically in background thread // Access current game state via static properties: if (Memory.InRaid) { var localPlayer = Memory.LocalPlayer; var allPlayers = Memory.Players; var gameWorld = Memory.Game; } ``` ### Response #### Success Response Initialization is performed asynchronously. Game state can be accessed via static properties after successful initialization and when the game is running. #### Response Example (No direct response, but access to static properties like `Memory.LocalPlayer`, `Memory.Players`, `Memory.Game` is enabled upon success.) #### Error Handling Exceptions may be thrown during initialization if DMA hardware is not properly set up or accessible. ``` -------------------------------- ### Manage EFT DMA Radar Configuration in C# Source: https://context7.com/lone-dma/lone-eft-dma-radar/llms.txt Manages application configuration, automatically loading settings from a JSON file and allowing modifications to DMA, UI, loot, and web radar parameters. The configuration is persisted atomically to prevent corruption during application crashes, ensuring data integrity through a temp file, move, and backup process. ```csharp using eft_dma_radar; using System; // Configuration is automatically loaded from %AppData%\Lone-EFT-DMA\Config-EFT.json var config = EftDmaConfig.Instance; // DMA Settings config.DMA.FpgaAlgo = FpgaAlgo.Auto; config.DMA.EnableMemMap = true; // UI Settings config.UI.FPS = 60; config.UI.WindowScale = 1.5f; config.UI.ZoomLevel = 100; config.UI.AimLineLength = 1500; config.UI.MaxDistance = 350; // Don't render beyond 350m // Loot Settings config.Loot.Enabled = true; config.Loot.MinValue = 50000; // 50k rubles config.Loot.MinValueValuable = 200000; // 200k rubles config.Loot.PricePerSlot = true; // Calculate value per inventory slot config.Loot.PriceMode = LootPriceMode.FleaMarket; // Color Customization config.Colors.LocalPlayer = SKColor.Parse("#00FF00"); config.Colors.Teammate = SKColor.Parse("#0000FF"); config.Colors.PMC = SKColor.Parse("#FF0000"); config.Colors.Scav = SKColor.Parse("#FFA500"); config.Colors.Boss = SKColor.Parse("#FF00FF"); config.Colors.LootValuable = SKColor.Parse("#FFD700"); // Web Radar Settings config.WebRadar.Enabled = false; config.WebRadar.Port = 8080; config.WebRadar.TickRateHz = 20; config.WebRadar.Password = "changeMe"; // Save configuration (automatically saved on app shutdown) config.SaveToFile(); Console.WriteLine($"Configuration saved to: {config.ConfigFilePath}"); // Configuration is persisted atomically: // 1. Write to temp file // 2. Move to main config file // 3. Create backup // This ensures no corruption on crashes ``` -------------------------------- ### Configure Profile API Providers in JSON Source: https://github.com/lone-dma/lone-eft-dma-radar/wiki/Player-Profile-Lookup This JSON snippet shows the configuration section for enabling and prioritizing different profile API providers. You can set which services to use and their order of operation by adjusting the 'enabled' flag and 'priority' values. Ensure 'YOURAPIKEYHERE' is replaced with your actual API key for eft-api.tech. ```json { "profileApi": { "tarkovDev": { "priority_v2": 1000, "enabled": true }, "eftApiTech": { "priority": 10, "enabled": false, "requestsPerMinute": 5, "apiKey": "YOURAPIKEYHERE" } } } ``` -------------------------------- ### Player Grouping and Teammate Detection in C# Source: https://context7.com/lone-dma/lone-eft-dma-radar/llms.txt This C# code snippet demonstrates how to group players based on spawn proximity and shared movement patterns within the Escape from Tarkov game world. It utilizes the Memory class to access game state, identify local player's group ID, list teammates, and detect potential enemy groups and solo players, calculating distances and displaying relevant information. ```csharp using eft_dma_radar.Tarkov.World; using System; using System.Linq; if (Memory.InRaid && Memory.Game != null) { var gameWorld = Memory.Game; var localPlayer = Memory.LocalPlayer; // Groups are automatically calculated by GameWorld.RefreshGroups() // Players within 25m at raid start are grouped together var myGroupId = localPlayer.GroupId; var teammates = Memory.Players .Where(p => p.IsAlive && p.GroupId == myGroupId && p != localPlayer) .ToList(); Console.WriteLine($"Your Group ID: {myGroupId}"); Console.WriteLine($"Teammates: {teammates.Count}"); foreach (var teammate in teammates) { var distance = Vector3.Distance(teammate.Position, localPlayer.Position); Console.WriteLine($" {teammate.Name} ({teammate.Type}) - {distance:F1}m away"); Console.WriteLine($" Health: {teammate.Health.Current}/{teammate.Health.Max}"); Console.WriteLine($" Equipment: ₽{teammate.Equipment.TotalValue:N0}"); } // Find other groups (potential enemies) var enemyGroups = Memory.Players .Where(p => p.IsAlive && p.IsActive) .Where(p => p.GroupId != myGroupId) .GroupBy(p => p.GroupId) .OrderBy(g => g.Min(p => Vector3.Distance(p.Position, localPlayer.Position))); Console.WriteLine($"\nEnemy Groups Detected: {enemyGroups.Count()}"); foreach (var group in enemyGroups) { var closestMember = group.OrderBy(p => Vector3.Distance(p.Position, localPlayer.Position)).First(); var distance = Vector3.Distance(closestMember.Position, localPlayer.Position); Console.WriteLine($" Group {group.Key}: {group.Count()} members, " + $"closest at {distance:F1}m"); foreach (var member in group) { Console.WriteLine($" - {member.Name} ({member.Type}) " + $"Level {member.Level}"); } } // Solo players (GroupId == 0 or unique ID) var soloPlayers = Memory.Players .Where(p => p.IsAlive && p.IsActive) .Where(p => p.GroupId != myGroupId) .Where(p => !Memory.Players.Any(other => other != p && other.GroupId == p.GroupId)) .ToList(); Console.WriteLine($"\nSolo Players: {soloPlayers.Count}"); foreach (var solo in soloPlayers.OrderBy(p => Vector3.Distance(p.Position, localPlayer.Position)).Take(5)) { var distance = Vector3.Distance(solo.Position, localPlayer.Position); Console.WriteLine($" {solo.Name} ({solo.Type}) at {distance:F1}m"); } } ``` -------------------------------- ### Read Game Memory with Scatter Operations (C#) Source: https://context7.com/lone-dma/lone-eft-dma-radar/llms.txt Performs efficient batch memory reads using scatter-gather DMA operations. This method is more efficient than individual reads. It allows preparing multiple reads for different data types and addresses, executing them in a single DMA transaction, and handling the results. Direct single reads are also provided as an alternative. ```csharp using eft_dma_radar.DMA; using System; // Create scatter read for batch operations (more efficient than individual reads) using var scatter = Memory.CreateScatter(); // Prepare multiple reads ulong playerHealthAddr = 0x12345678; ulong playerPosAddr = 0x23456789; ulong inventoryAddr = 0x34567890; scatter.PrepareReadValue(playerHealthAddr); scatter.PrepareReadValue(playerPosAddr); scatter.PrepareReadPtr(inventoryAddr); // Read pointer value // Handle results when scatter completes scatter.Completed += (sender, s) => { if (s.ReadValue(playerHealthAddr, out var health)) Console.WriteLine($"Health: {health}"); if (s.ReadValue(playerPosAddr, out var position)) Console.WriteLine($"Position: {position.x}, {position.y}, {position.z}"); if (s.ReadPtr(inventoryAddr, out var invPtr)) Console.WriteLine($"Inventory Pointer: 0x{invPtr:X}"); }; // Execute all reads in single DMA transactionscatter.Execute(); // Alternative: Direct single reads (less efficient) var singleValue = Memory.ReadValue(0x12345678); var ptr = Memory.ReadPtr(0x23456789); var buffer = new byte[256]; Memory.ReadSpan(0x34567890, buffer); ``` -------------------------------- ### Configure Twitch API Credentials in JSON Source: https://github.com/lone-dma/lone-eft-dma-radar/wiki/Twitch-Integration This snippet shows how to configure your Twitch API Client ID and Client Secret within the `Config-EFT.json` file. These credentials are required for the Twitch Integration to function correctly, allowing the radar to query the Twitch API. ```json { "twitchApi": { "clientId": "YOURCLIENTID", "clientSecret": "YOURCLIENTSECRET" } } ``` -------------------------------- ### Reading Game Memory with Scatter Operations Source: https://context7.com/lone-dma/lone-eft-dma-radar/llms.txt Performs efficient batch memory reads using scatter-gather DMA operations for improved performance compared to individual reads. ```APIDOC ## Reading Game Memory with Scatter Operations ### Description Performs efficient batch memory reads using scatter-gather DMA operations for improved performance compared to individual reads. ### Method Asynchronous execution of scatter reads. ### Endpoint N/A (This is a library function) ### Parameters None ### Request Example ```csharp using eft_dma_radar.DMA; using System; // Create scatter read for batch operations (more efficient than individual reads) using var scatter = Memory.CreateScatter(); // Prepare multiple reads ulong playerHealthAddr = 0x12345678; ulong playerPosAddr = 0x23456789; ulong inventoryAddr = 0x34567890; scatter.PrepareReadValue(playerHealthAddr); scatter.PrepareReadValue(playerPosAddr); scatter.PrepareReadPtr(inventoryAddr); // Read pointer value // Handle results when scatter completes scatter.Completed += (sender, s) => { if (s.ReadValue(playerHealthAddr, out var health)) Console.WriteLine($"Health: {health}"); if (s.ReadValue(playerPosAddr, out var position)) Console.WriteLine($"Position: {position.x}, {position.y}, {position.z}"); if (s.ReadPtr(inventoryAddr, out var invPtr)) Console.WriteLine($"Inventory Pointer: 0x{invPtr:X}"); }; // Execute all reads in single DMA transaction scatter.Execute(); // Alternative: Direct single reads (less efficient) var singleValue = Memory.ReadValue(0x12345678); var ptr = Memory.ReadPtr(0x23456789); var buffer = new byte[256]; Memory.ReadSpan(0x34567890, buffer); ``` ### Response #### Success Response (via Scatter.Completed event) - **ReadValue** (bool) - Returns true if the read was successful, and the value is populated in the output parameter. - **ReadPtr** (bool) - Returns true if the read was successful, and the pointer value is populated in the output parameter. #### Response Example (within Scatter.Completed event) ```json { "Health": 100.0, "Position": {"x": 10.5, "y": 20.2, "z": 5.8}, "Inventory Pointer": "0xABCDEF1234567890" } ``` #### Error Handling If scatter read operations fail, the `Completed` event may not be triggered or `ReadValue`/`ReadPtr` methods will return false, indicating the data could not be retrieved. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.