P4: Lua io.AxisInverted always fails
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
バグは、scripting/api/libs/controls.cpp の io.AxisInverted 冒頭、279 行目付近にあるコントローラー ID のチェックと、バインディングを検索して JOY_REL_THROTTLE_AXIS で停止するループにあります。まず、その関数と、それが一致すべき軸ごとのプロパティ setter を読んでください。完了とは、再現手順の 3 つの呼び出し(マウスの反転、マウスの問い合わせ、ジョイスティック 0 の反転)が期待値を返し、その後 io.HeadingAxisPrimaryInverted と io.HeadingAxisSecondaryInverted が true を読むことです。この issue は関数を削除するかどうかを未決定のままにしているので、その選択を先に maintainer と確認してください。
索引モデルが issue の本文から書いたものです。
説明
This is minor: it only affects scripts, and the per-axis setters such as io.HeadingAxisPrimaryInverted work as a workaround.
Problem
The Lua function io.AxisInverted(cid, axis, inverted) never does anything. It always returns false, and setting an axis inverted through it doesn't change the binding.
The check on the controller ID at the top of the function (scripting/api/libs/controls.cpp:279) can never pass: the mouse (cid -1) fails joy < CID_JOY0, and every joystick (0 to 3) fails joy != CID_MOUSE. So the function returns its error value before it looks at any binding.
Steps to reproduce
- Current master (8afa31842), Debug build, Linux. MediaVPs 5.0.2, no other mods, SM1-01.
- By default the mouse X axis and joystick 0's X axis are bound to the heading axis.
- From a script, run:
io.AxisInverted(-1, 0, true)and thenio.AxisInverted(-1, 0)io.AxisInverted(0, 0, true)
- Read
io.HeadingAxisSecondaryInvertedandio.HeadingAxisPrimaryInverted.
Expected vs. actual behavior
Expected: the first call inverts the mouse binding and the second returns true; the third inverts the joystick binding. The heading axis properties then read true.
Actual: all three calls return false, and both heading properties stay false. Setting io.HeadingAxisPrimaryInverted = true directly does work, so the binding itself can be inverted.
Separately, even with the check fixed, the loop that searches for the binding stops at the relative throttle axis, so any axis action added after it would never be found.
Proposed fixes
- Change the check to reject only IDs that are neither the mouse nor a joystick:
(joy != CID_MOUSE) && ((joy < CID_JOY0) || (joy >= CID_JOY_MAX)). - Same as 1, and loop up to
JOY_AXIS_ENDinstead ofJOY_REL_THROTTLE_AXIS, so every axis action is searched. - Remove
AxisInvertedin favor of the per-action properties, if no script relies on it.
- 主要言語
- C++
- スター
- 488
- フォーク
- 184
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 33
環境構築
このプロジェクトの環境構築ファイルはまだ確認していません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
scp-fs2open/fs2open.github.com のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
scp-fs2open/fs2open.github.com#7956 ·
メンテナーはふだん 1 日以内に返信
-
bug HUD LLM-suggested
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
scp-fs2open/fs2open.github.com#7953 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 半日 初心者へのやさしさ 66/100
scp-fs2open/fs2open.github.com#7932 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
scp-fs2open/fs2open.github.com#7924 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
scp-fs2open/fs2open.github.com#7918 ·
メンテナーはふだん 1 日以内に返信
scp-fs2open/fs2open.github.com の issue をすべて見る
似ている issue
-
.NET ep:WebGPU platform:web
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
microsoft/onnxruntime#33755 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
grumpycoders/pcsx-redux#2530 ·
-
A-tools P-medium S-ready-to-start studio task
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
Status: Needs confirmation Status: Needs triage Type: Code Quality
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
Image.resolveAssetSource's TypeScript declaration drops the null it returns for an unknown assetオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
react/react-native#59648 ·
メンテナーはふだん 2 日以内に返信