id: a4ed47acdd624e71b9ec4c9a7fa9643e
parent_id: cc08684fcdf94dd08403b339ab641bdd
item_type: 1
item_id: 6c0dcb2a567348fd9796f50c790082e4
item_updated_time: 1780468962335
title_diff: "[]"
body_diff: "[{\"diffs\":[[0,\"ase 1.1 \"],[-1,\"complete\"],[1,\"— bug found, needs fix\"],[0,\"** — com\"]],\"start1\":6545,\"start2\":6545,\"length1\":24,\"length2\":38},{\"diffs\":[[0,\"g.lua`\\\n\\\n\"],[1,\"**🐛 CONFIRMED BUG: `require(\\\"socket.udp\\\")` is incorrect** — see Section 13 for details\\\n\\\n\"],[0,\"**Files:\"]],\"start1\":7319,\"start2\":7319,\"length1\":16,\"length2\":105},{\"diffs\":[[0,\"— **\"],[-1,\"DONE\"],[1,\"BUG FOUND, NEEDS FIX\"],[0,\"** (\"]],\"start1\":11964,\"start2\":11964,\"length1\":12,\"length2\":28},{\"diffs\":[[0,\"allbacks\"],[1,\"\\\n  - [ ] **FIX: Correct LuaSocket require pattern** — `require(\\\"socket.udp\\\")` → `require(\\\"socket\\\")` + `socket.udp()`\\\n  - [ ] **CLEANUP: Remove duplicate in `extension/lua/ac-telemetry-plugin/`** to prevent double UDP transmission\\\n  - [ ] **DECIDE: apps/lua vs extension/lua deployment** — see Section 13.4\"],[0,\"\\\n\\\n- **1.\"]],\"start1\":12495,\"start2\":12495,\"length1\":16,\"length2\":321},{\"diffs\":[[0,\"1.1 \"],[-1,\"done** — plugin + listener working\"],[1,\"— bug fix needed**\"],[0,\" |\\\n|\"]],\"start1\":17096,\"start2\":17096,\"length1\":42,\"length2\":26},{\"diffs\":[[0,\"ow issue\"],[1,\", updated with confirmed root cause\"],[0,\"*\\\n\\\n###\"],[1,\" 13.1\"],[0,\" How CSP\"]],\"start1\":17543,\"start2\":17543,\"length1\":22,\"length2\":62},{\"diffs\":[[0,\"### \"],[-1,\"Diagnosis: Why Both Apps Show B\"],[1,\"13.2 CONFIRMED BUG: `require(\\\"socket.udp\\\")` — Wrong Module Path\\\n\\\n**Root cause of the b\"],[0,\"lank \"],[-1,\"W\"],[1,\"w\"],[0,\"indow\"],[-1,\"s\\\n\\\n####\"],[1,\" in\"],[0,\" `ac\"]],\"start1\":18275,\"start2\":18275,\"length1\":57,\"length2\":108},{\"diffs\":[[0,\"gin`\"],[-1,\" — Likely LuaSocket failure\\\n\\\nThe script loads at the top of\"],[1,\".**\\\n\\\nOur code (in\"],[0,\" `sr\"]],\"start1\":18397,\"start2\":18397,\"length1\":67,\"length2\":25},{\"diffs\":[[0,\"try.lua`\"],[1,\")\"],[0,\":\\\n```lua\"]],\"start1\":18430,\"start2\":18430,\"length1\":16,\"length2\":17},{\"diffs\":[[0,\"et.udp\\\")\"],[1,\"   -- ❌ WRONG\"],[0,\"\\\nlocal u\"]],\"start1\":18476,\"start2\":18476,\"length1\":16,\"length2\":29},{\"diffs\":[[0,\"``\\\n\\\n\"],[-1,\"This runs **at module load time**, not inside a function. If LuaSocket's `socket.udp` module is not available in the CSP LuaJIT environment (or if the module path differs), the `require()` ca\"],[1,\"**`socket.udp` is NOT a LuaSocket module.** It is a *function* on the socket table. In CSP's bundled LuaSocket:\\\n\\\n| What we wrote | What it tries to find | Does it exist? |\\\n|---|---|---|\\\n| `require(\\\"socket.udp\\\")` | A Lua file at `socket/udp.lua` or C module `socket.udp` | **NO** — no such file exists |\\\n\\\n**CSP's bundled LuaSocket files** (at `extension/internal/lua-shared/`):\\\n```\\\nsocket.lua              ← main module (does require(\\\"socket.core\\\"))\\\nsocket/ftp.lua\\\nsocket/headers.lua\\\nsocket/http.lua\\\nsocket/mbox.lua\\\nsocket/smtp.lua\\\nsocket/tp.lua\\\nsocket/url.lua\\\n```\\\n\\\nNote: **No `socket/udp.lua` file exists.** UDP functionality is built into the native C module `socket.core` and exposed as a function.\\\n\\\n**The correct pattern** (used by all CSP built-in scripts):\\\n```lua\\\nlocal socket = require(\\\"socket\\\")       -- loads socket.lua → socket.core (native C)\\\nlocal udp = socket.udp()               -- creates UDP socket object\\\n```\\\n\\\nOr using CSP's shared module prefix:\\\n```lua\\\nlocal socket = require(\\\"shared/socket\\\")  -- explicit path to extension/internal/lua-shared/socket.lua\\\nlocal udp = socket.udp()\\\n```\\\n\\\n**Evidence**: Grep across the entire AC installation finds zero uses of `require(\\\"socket.udp\\\")` other than our plugin. A\"],[0,\"ll \"],[1,\"o\"],[0,\"th\"],[-1,\"rows an error. Since t\"],[1,\"er scripts that need socket use `require(\\\"socket\\\")` or `require(\\\"shared/socket\\\")`.\\\n\\\n**The crash cascade**:\\\n1. `require(\\\"socket.udp\\\")` → module not found → error\\\n2. T\"],[0,\"his \"]],\"start1\":18520,\"start2\":18520,\"length1\":226,\"length2\":1401},{\"diffs\":[[0,\"cope\"],[-1,\",\"],[0,\" i\"],[-1,\"t cascades: `require(\\\"src.telemetry\\\")` in `main.lua` also fails → the entire script fails to load\"],[1,\"n `telemetry.lua`, so the entire module fails to load\\\n3. `require(\\\"src.telemetry\\\")` in `main.lua` → error propagates\\\n4. `main.lua` never finishes executing\"],[0,\" → `\"]],\"start1\":19935,\"start2\":19935,\"length1\":108,\"length2\":165},{\"diffs\":[[0,\" defined\"],[-1,\" →\"],[1,\"\\\n5.\"],[0,\" CSP cre\"]],\"start1\":20127,\"start2\":20127,\"length1\":18,\"length2\":19},{\"diffs\":[[0,\"rom \"],[-1,\"the \"],[0,\"manifest\"],[1,\".ini\"],[0,\" but\"]],\"start1\":20169,\"start2\":20169,\"length1\":20,\"length2\":20},{\"diffs\":[[0,\"s no\"],[-1,\"thing to draw\"],[1,\" callback\"],[0,\" → *\"]],\"start1\":20192,\"start2\":20192,\"length1\":21,\"length2\":17},{\"diffs\":[[0,\"ow**\"],[-1,\".\"],[0,\"\\\n\\\n**\"],[-1,\"To verify**: Check CSP log at `extension/logs/csp-lua.log` or the in-game CSP console (Ctrl+Shift+C) for require errors like `module 'socket.udp' not found`.\\\n\\\n**Fix options**:\\\n1. **Wrap LuaSocket in a pcall** — defer the require to first use, or catch the error gracefully\\\n2. **Check LuaSocket availability** — CSP bundles LuaSocket but the module path might be different (e.g., `require(\\\"socket\\\")` then `socket.udp()` instead of `require(\\\"socket.udp\\\")`)\\\n3. **Use CSP's built-in networking** —\"],[1,\"Required fix** in `src/telemetry.lua`:\\\n```lua\\\nlocal socket = require(\\\"socket\\\")\\\nlocal udp = socket.udp()\\\n```\\\n\\\n### 13.3 ac-tracer: Missing `lib/` Directory (Confirmed — NOT a CSP issue)\\\n\\\n**CSP does NOT provide the `lib/` modules that ac-tracer needs.** These are app-local modules specific to ac-tracer.\\\n\\\n**How CSP module resolution works:**\\\n- `require('lib.core.state')` resolves to `<app-dir>/lib/core/state.lua` (relative to the app directory)\\\n- `package.add(dir)` can add additional search roots (documented in CSP SDK at `extension/internal/lua-sdk/ac_apps/README.md`)\\\n- CSP shared modules use `require('shared/...')` prefix → resolves to `extension/internal/lua-shared/`\\\n- ac-tracer does NOT call `package.add()` — it relies on default resolution\\\n\\\n**CSP shared libraries available** (at `extension/internal/lua-shared/`):\\\n\\\n| Category | Modules |\\\n|---|---|\\\n| **Socket** (LuaSocket) | `socket`, `socket/smtp`, `socket/http`, `socket/ftp`, `socket/tp`, `socket/url`, `socket/headers` |\\\n| **OpenSSL** | `openssl`, `openssl/ssl`, `openssl/x509/*`, `openssl/ocsp/*`, etc. |\\\n| **Sim helpers** | `sim/traffic`, `sim/cars`, `sim/ai`, `sim/weather`, `sim/chat`, `sim/surfaces`, `sim/ghost`, `sim/motec` |\\\n| **Utils** | `utils/binary`, `utils/steam`, `utils/tts`, `utils/sqlite`, `utils/dbstorage`, `utils/qr`, `utils/obs` |\\\n| **Web** | `web/browser`, `web/ui` |\\\n| **Other** | `ltn12`, `mime`, `math/cubic`, `ui/virtualizing`, `vr/grab`, `dualsense/*` |\\\n\\\n**None of these match** `lib.core.state`, `lib.windows.*`, etc. — those are ac-tracer's own modules that simply weren't included in the distribution.\\\n\\\n### 13.4 Deployment Decision: `apps/lua/` vs `extension/lua/`\\\n\\\n#### Current problem: duplicate copies\\\n\\\nThe plugin exists in TWO locations:\\\n1. **`apps/lua/ac-telemetry-plugin/`** — has `[WINDOW_...]` + `LAZY = FULL` + `script.windowMain`\\\n2. **`extension/lua/ac-telemetry-plugin/`** — has `[SCRIPT]` only, headless\\\n\\\nBoth have `script.update(dt)` → `telemetry.update(dt)` → UDP send. **If both load simultaneously, telemetry is sent twice per frame.**\\\n\\\n#### Comparison\\\n\\\n| Aspect | `apps/lua/` (In-Game App) | `extension/lua/` (Extension) |\\\n|---|---|---|\\\n| **Manifest** | `[ABOUT]` + `[CORE]` + `[WINDOW_...]` | `[ABOUT]` only, or `[ABOUT]` + subsystem sections |\\\n| **App bar** | ✅ Appears in CSP app launcher, user can toggle on/off | ❌ No app bar presence |\\\n| **Window callbacks** | `script.windowMain(dt)` for IMGUI drawing | None — no UI |\\\n| **Loading** | `LAZY = FULL`: loads when opened, unloads when closed | Loaded by subsystem or at startup |\\\n| **User control** | User can enable/disable, drag windows | Runs automatically (selectable in CSP settings for some) |\\\n| **Standard pattern** |\"],[0,\" CSP\"],[-1,\" has `web.request()` and other HTTP/websocket APIs that may be more reliable than raw LuaSocket\\\n\\\n#### `ac-tracer` — Missing `lib/` directory\\\n\\\nThe script requires 11 modules that do not exist on disk:\\\n```\\\nlib.core.state, lib.core.settings, lib.core.scoring,\\\nlib.windows.corner_analysis, lib.windows.lap_telemetry,\\\nlib.windows.lap_picker, lib.windows.delta_bar, lib.windows.main,\\\nlib.ui.utils, lib.ui.theme, lib.traffic\\\n```\\\n\\\nThe `ac-tracer` directory only contains `ac-tracer.lua`, `manifest.ini`, icons, and `tracks/*.csv`. The entire `lib/` source tree is missing — likely it was not copied from the git repository or the distribution was incomplete. Same failure mode: first `require('lib.core.state')` throws → entire script fails → all 5 window callbacks are undefined → **5 blank windows**.\\\n\\\n###\"],[1,\"'s built-in apps use this: CspDebug, AppShelf, Mumble | Tools, game modes, cameras, FFB, PP filters |\\\n| **Subsystem dir** | Flat: `apps/lua/<appname>/` | Categorized: `extension/lua/<category>/<name>/` |\\\n\\\n#### Recommendation: `apps/lua/` (In-Game App)\\\n\\\n**Keep `apps/lua/ac-telemetry-plugin/` and delete the `extension/lua/` copy.** Reasons:\\\n\\\n1. **Visual feedback**: The app window shows the user that telemetry is being sent (\\\"AC Telemetry ●\\\")\\\n2. **User control**: Can be toggled from the app bar — user decides when to start/stop telemetry\\\n3. **Standard pattern**: All CSP apps that users interact with live in `apps/lua/`\\\n4. **Settings support**: `[WINDOW_...]` manifest supports `FUNCTION_SETTINGS` for a settings panel (useful for host/port configuration)\\\n5. **`LAZY = FULL`**: Only runs when needed — doesn't waste resources when closed\\\n6. **The `extension/lua/` copy is misplaced**: It's at the root level (`extension/lua/ac-telemetry-plugin/`), not under a recognized subsystem directory (`tools/`, `new-modes/`, etc.)\\\n\\\n#### Alternative: Headless `extension/lua/` approach\\\n\\\nIf you want telemetry to **always run** without user intervention:\\\n- Place under `extension/lua/tools/ac-telemetry/` (recognized subsystem)\\\n- Use `[ABOUT]` + `[SCRIPT]` manifest\\\n- No window, no app bar icon\\\n- Would run automatically without user needing to click anything\\\n- But: no visual feedback, no settings UI, no way to know it's working\\\n\\\n### 13.5 Proton Rendering Considerations\\\n\\\nThe blank windows are **confirmed to be script crash bugs**, not Proton rendering issues. However, Proton/DXVK can cause secondary rendering issues:\\\n\\\n- **`NO_BACKGROUND` flag**: Creates a transparent window. Under DXVK/WineD3D, transparency compositing may behave differently than Windows D3D11. If the text renders but is invisible, try removing `NO_BACKGROUND,NO_TITLE_BAR` flags.\\\n- **`FADING` flag**: Windows fade when not focused. Proton's focus detection via Wine might not work correctly, causing windows to remain fully transparent.\\\n- **ImGui rendering**: CSP uses Dear ImGui for all Lua UI. Under Proton, ImGui rendering goes through WineD3D/DXVK — generally works well but can have edge cases with specific DXVK versions.\\\n\\\n**For Phase 1, these are not the primary issue.** Once the LuaSocket bug is fixed, the window should show the \\\"AC Telemetry ●\\\" text. If it still appears blank after the fix, then investigate Proton rendering:\\\n1. Remove `NO_BACKGROUND,NO_TITLE_BAR` flags temporarily\\\n2. Remove `FADING` flag\\\n3. Try a larger window size to confirm rendering is working\\\n4. Check DXVK version (`dxvk --version`)\\\n\\\n### 13.6 UDP Configuration: Current and Future Options\\\n\\\n#### Current: `config.lua` (hardcoded)\\\n\\\n```lua\\\nlocal config = {\\\n    target_host = \\\"127.0.0.1\\\",\\\n    target_port = 5005,\\\n    send_interval = 1 / 60,\\\n}\\\nreturn config\\\n```\\\n\\\n**Pros**: Simple, no overhead, easy to understand\\\n**Cons**: Requires file editing + AC restart to change; no validation\\\n\\\n#### Option A: In-Game Settings Panel (Recommended for Phase 2)\\\n\\\nUse `[SETTINGS]` in manifest.ini to add a gear icon that opens a settings window:\\\n\\\n```lua\\\nfunction script.windowSettings(dt)\\\n    ui.text(\\\"UDP Target\\\")\\\n    ui.inputText(\\\"Host\\\", storage.targetHost)\\\n    ui.inputText(\\\"Port\\\", storage.targetPort)\\\n    if ui.button(\\\"Apply\\\") then\\\n        reconnect()\\\n    end\\\nend\\\n```\\\n\\\nPersist with `ac.storage()` — survives app restarts within a session.\\\n\\\n#### Option B: `ac.storage()` + config.lua defaults (Recommended for Phase 1 fix)\\\n\\\nLoad defaults from `config.lua`, allow override from `ac.storage()`:\\\n\\\n```lua\\\nlocal defaults = require(\\\"config\\\")\\\nlocal storage = ac.storage({\\\n    target_host = defaults.target_host,\\\n    target_port = defaults.target_port,\\\n})\\\n```\\\n\\\nThis gives you file-based defaults with runtime persistence. No UI needed.\\\n\\\n#### Option C: CSP INI Settings (Alternative)\\\n\\\nUse `[SETTINGS_MYSETTING]` in manifest.ini for sliders/inputs that CSP renders natively. Simpler than custom settings window but less flexible.\\\n\\\n#### For cross-machine deployment (analysis machine on different IP)\\\n\\\nChange `target_host` from `\\\"127.0.0.1\\\"` to the analysis machine's LAN IP (e.g., `\\\"192.168.1.100\\\"`). The UDP datagram goes through Proton's network stack → Linux kernel → LAN → analysis machine. No special configuration needed — standard UDP networking.\\\n\\\n---\\\n\\\n## 14.\"],[0,\" CSP\"]],\"start1\":20220,\"start2\":20220,\"length1\":1309,\"length2\":7003},{\"diffs\":[[0,\"eckbox\\\n\\\n\"],[-1,\"###\"],[1,\"---\\\n\\\n## 15.\"],[0,\" CSP Bui\"]],\"start1\":28969,\"start2\":28969,\"length1\":19,\"length2\":27},{\"diffs\":[[0,\" with 96\"],[1,\"+\"],[0,\" Lua scr\"]],\"start1\":29034,\"start2\":29034,\"length1\":16,\"length2\":17},{\"diffs\":[[0,\"### \"],[-1,\"LuaSocket in CSP — Notes\\\n\\\nCSP bundles LuaSocket but the module loading may differ from standalone Lua:\\\n- Try `require(\\\"socket\\\")` first, then\"],[1,\"CSP Internal Lua Apps (in `extension/internal/lua-apps/`)\\\n\\\nCSP's own built-in apps that\"],[0,\" use \"],[-1,\"`socket.udp()` as a method\\\n- Or try `require(\\\"socket.core\\\")` which is the C core that LuaSocket wraps\\\n- CSP also provides `web.request()` for HTTP and may have WebSocket support\\\n- Check CSP documentation or `extension/lua-shared/` for available networking modules\\\n- Alternative: Use CSP's built-in `ac.sendChatMessage()` or file-based IPC as a last resort\"],[1,\"the same `[WINDOW_...]` pattern:\\\n\\\n| App | Purpose | LAZY | Windows |\\\n|-----|---------|------|---------|\\\n| CspDebug | Debug lights, physics outlines, VAO | FULL | 2 (main + settings) |\\\n| AppShelf | App launcher/organizer | FULL | 1 |\\\n| Mumble | Voice chat positioning | 0 (always on) | 1 |\"],[0,\"\\\n\\\n--\"]],\"start1\":29920,\"start2\":29920,\"length1\":508,\"length2\":388},{\"diffs\":[[0,\"3 — \"],[-1,\"diagnosis and\"],[1,\"confirmed LuaSocket bug,\"],[0,\" CSP \"],[-1,\"Lua \"],[0,\"arch\"]],\"start1\":30544,\"start2\":30544,\"length1\":30,\"length2\":37},{\"diffs\":[[0,\"document\"],[-1,\"ation\"],[1,\"ed*\\\n*Bug fix needed: `require(\\\"socket.udp\\\")` → `require(\\\"socket\\\")` + `socket.udp()`\"],[0,\"*\"]],\"start1\":30590,\"start2\":30590,\"length1\":14,\"length2\":92}]"
metadata_diff: {"new":{},"deleted":[]}
encryption_cipher_text: 
encryption_applied: 0
updated_time: 2026-06-03T06:47:52.569Z
created_time: 2026-06-03T06:47:52.569Z
type_: 13