mirror of
https://github.com/ProjectLeonida/mandy.git
synced 2026-12-06 12:58:38 +00:00
Merge pull request #2239 from itsRevela
This commit is contained in:
@ -200,7 +200,7 @@ The API surface:
|
||||
|
||||
| interface | implemented | not implemented |
|
||||
|---|---|---|
|
||||
| `IGameInput` | `GetCurrentTimestamp` (µs), `GetCurrentReading`, `GetNextReading`, `GetPreviousReading`, `RegisterReadingCallback`, `RegisterDeviceCallback` (blocking and async enumeration), `RegisterGuideButtonCallback`, `RegisterKeyboardLayoutCallback` (never fires), `StopCallback`, `UnregisterCallback`, `CreateDispatcher`, `FindDeviceFromId`, `EnableOemDeviceSupport` (no-op), `SetFocusPolicy` (no-op) | `GetTemporalReading`, `CreateAggregateDevice`, `FindDeviceFromObject/PlatformHandle/PlatformString` |
|
||||
| `IGameInput` | `GetCurrentTimestamp` (µs), `GetCurrentReading`, `GetNextReading`, `GetPreviousReading`, `RegisterReadingCallback`, `RegisterDeviceCallback` (blocking and async enumeration), `RegisterGuideButtonCallback`, `RegisterKeyboardLayoutCallback` (never fires), `StopCallback`, `UnregisterCallback`, `CreateDispatcher`, `FindDeviceFromId`, `EnableOemDeviceSupport` (no-op), `SetFocusPolicy` (no-op) | `GetTemporalReading` (`E_NOTIMPL`, as in GameInput v0 itself; see below), `CreateAggregateDevice`, `FindDeviceFromObject/PlatformHandle/PlatformString` |
|
||||
| `IGameInputReading` | kind, sequence number, timestamp, device, gamepad state, UI navigation state, controller axes and buttons, motion state | raw report, keyboard, mouse, touch, arcade/flight stick, racing wheel (all return nothing) |
|
||||
| `IGameInputDevice` | device info, status, battery, `SetRumbleState` | force feedback and haptic motors (none reported), raw device I/O, power off, input synchronization (no-ops) |
|
||||
| `IGameInputDispatcher` | `Dispatch`, `OpenWaitHandle` | the quota (the queue is short) |
|
||||
@ -292,8 +292,12 @@ These need the game executable or a test on hardware:
|
||||
built against one of those, the vtables need a second set.
|
||||
- **IIDs.** `QueryInterface` answers the v0 IIDs from the public header.
|
||||
- **Reading history.** Microsoft's [next reading](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/input/gameinput/interfaces/igameinput/methods/igameinput_getnextreading)
|
||||
and [previous reading](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/input/gameinput/interfaces/igameinput/methods/igameinput_getpreviousreading) pages describe half a second of readings per device and failure when old readings leave the stream. The table above records the shim's HRESULT choices. Changes faster than the poll are not seen, and
|
||||
`GetTemporalReading` is not implemented.
|
||||
and [previous reading](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/input/gameinput/interfaces/igameinput/methods/igameinput_getpreviousreading) pages describe half a second of readings per device and failure when old readings leave the stream. The table above records the shim's HRESULT choices. Changes faster than the poll are not seen.
|
||||
`GetTemporalReading` returns `E_NOTIMPL` with a null reading on purpose: Microsoft's
|
||||
[reference page](https://learn.microsoft.com/en-us/gaming/gdk/docs/reference/input/gameinput/deprecated/interfaces/igameinput/methods/igameinput_gettemporalreading)
|
||||
says it "was never implemented in v0" and returns `E_NOTIMPL`, and v1 removed it. The v0 header (NuGet
|
||||
`Microsoft.GameInput` 0.2303.22621.3038) declares it as `(timestamp, device, reading)`, the layout the shim has;
|
||||
the page's five-parameter form does not match that header.
|
||||
- **UI navigation mapping** and the **controller-axis convention** (0..1 with sticks at 0.5) are this shim's choice,
|
||||
not measured from a console.
|
||||
- **Battery capacity** is reported as a fraction (remaining 0..1 of full 1), not in device units.
|
||||
|
||||
@ -1382,6 +1382,8 @@ public:
|
||||
IGameInputReading** out) override {
|
||||
return find_reading(ref, kind, device, out, false);
|
||||
}
|
||||
// E_NOTIMPL is GameInput v0's own answer: Microsoft's reference page says the method "was never implemented in
|
||||
// v0" and returns E_NOTIMPL, and v1 removed it. A history lookup here would give a title what no GameInput does.
|
||||
HRESULT STDMETHODCALLTYPE GetTemporalReading(uint64_t, IGameInputDevice*, IGameInputReading** out) override {
|
||||
if (!out) return E_POINTER;
|
||||
*out = nullptr;
|
||||
|
||||
@ -1107,6 +1107,17 @@ int main() {
|
||||
check(input->GetPreviousReading(idle, GameInputKindGamepad, dev, nullptr) == E_POINTER &&
|
||||
input->GetPreviousReading(nullptr, GameInputKindGamepad, dev, &hit) == E_INVALIDARG && !hit,
|
||||
"history: a null output is E_POINTER, a null reference E_INVALIDARG");
|
||||
// GetTemporalReading: E_NOTIMPL with a null reading, as GameInput v0 itself, for a timestamp in the history, one
|
||||
// before it and the current time, with and without a device filter.
|
||||
const uint64_t idle_us = idle->GetTimestamp();
|
||||
bool temporal_notimpl = true;
|
||||
for (const uint64_t at : {idle_us, idle_us - 1'000'000, input->GetCurrentTimestamp()})
|
||||
for (IGameInputDevice* filter : {dev, static_cast<IGameInputDevice*>(nullptr)}) {
|
||||
IGameInputReading* temporal = idle; // a stale value the call must clear
|
||||
temporal_notimpl &= input->GetTemporalReading(at, filter, &temporal) == E_NOTIMPL && !temporal;
|
||||
}
|
||||
check(temporal_notimpl && input->GetTemporalReading(idle_us, dev, nullptr) == E_POINTER,
|
||||
"history: GetTemporalReading is E_NOTIMPL with a null reading, as in GameInput v0");
|
||||
|
||||
// Two pads in one stream, one poll each: A on the Xbox pad, B on the DualSense, Y on the Xbox pad.
|
||||
IGameInputReading* start = current(input, dev);
|
||||
|
||||
Reference in New Issue
Block a user