Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hw/xbox/nv2a/nv2a_pgraph.c
Original file line number Diff line number Diff line change
Expand Up @@ -1795,7 +1795,7 @@ static void pgraph_method(NV2AState *d,

} else {
NV2A_GL_DPRINTF(true, "EMPTY NV097_SET_BEGIN_END");
assert(false);
// assert(false);
}

/* End of visibility testing */
Expand Down
2 changes: 1 addition & 1 deletion hw/xbox/nv2a/nv2a_psh.c
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ static QString* psh_convert(struct PixelShader *ps)
case PS_TEXTUREMODES_DOT_RFLCT_SPEC:
qstring_append_fmt(vars, "vec4 t%d = vec4(0.0); /* PS_TEXTUREMODES_DOT_RFLCT_SPEC */\n",
i);
assert(false); /* Unimplemented */
//assert(false); /* Unimplemented */
break;
case PS_TEXTUREMODES_DOT_STR_3D:
qstring_append_fmt(vars, "vec4 t%d = vec4(0.0); /* PS_TEXTUREMODES_DOT_STR_3D */\n",
Expand Down
25 changes: 16 additions & 9 deletions hw/xbox/xid.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "hw/usb/desc.h"
#include "ui/input.h"

// #define DEBUG_XID
#define DEBUG_XID
#ifdef DEBUG_XID
#define DPRINTF printf
#else
Expand Down Expand Up @@ -112,7 +112,7 @@ static const USBDescIface desc_iface_xbox_gamepad = {
.bInterfaceProtocol = 0x00,
.eps = (USBDescEndpoint[]) {
{
.bEndpointAddress = USB_DIR_IN | 0x02,
.bEndpointAddress = USB_DIR_IN | 0x01,
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this comes from my Controller S. Need to review using Duke

Copy link
Copy Markdown

@dracc dracc Jul 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My Duke reports bEndpointAddress 0x02 EP 2 OUT

Link to full lsusb output

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool, yeah - I'll also look at a duke still. I plan to run linux in QEMU and then compare using libusb [with a real gamepad + virtual gamepad connected at once, sending both the same requests]

.bmAttributes = USB_ENDPOINT_XFER_INT,
.wMaxPacketSize = 0x20,
.bInterval = 4,
Expand Down Expand Up @@ -347,10 +347,10 @@ static void usb_xid_handle_control(USBDevice *dev, USBPacket *p,
DPRINTF("Set rumble power to 0x%x, 0x%x\n",
s->out_state.left_actuator_strength,
s->out_state.right_actuator_strength);
p->actual_length = s->out_state.length;
} else {
assert(false);
}
//p->status = USB_RET_STALL;
break;
/* XID requests */
case VendorInterfaceRequest | USB_REQ_GET_DESCRIPTOR:
Expand All @@ -364,9 +364,9 @@ static void usb_xid_handle_control(USBDevice *dev, USBPacket *p,
}
break;
case VendorInterfaceRequest | XID_GET_CAPABILITIES:
DPRINTF("xid XID_GET_CAPABILITIES 0x%x\n", value);
DPRINTF("xid 0x%X XID_GET_CAPABILITIES 0x%x\n", request, VendorInterfaceRequest);
/* FIXME: ! */
p->status = USB_RET_STALL;
// p->status = USB_RET_STALL;
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this one is what fixed the game - but needs further research

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very likely. This should return the capabilty masks.

//assert(false);
break;
case ((USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_DEVICE) << 8)
Expand Down Expand Up @@ -399,23 +399,30 @@ static void usb_xid_handle_data(USBDevice *dev, USBPacket *p)
{
USBXIDState *s = (USBXIDState *)dev;

DPRINTF("xid handle_data 0x%x %d 0x%zx\n", p->pid, p->ep->nr, p->iov.size);
if ((p->pid != 0x69) || (p->ep->nr != 1) || (p->iov.size != 0x20)) {
DPRINTF("xid handle_data 0x%x %d 0x%zx\n", p->pid, p->ep->nr, p->iov.size);
}
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a printf filter, can be ignored - but it's quite useful


switch (p->pid) {
case USB_TOKEN_IN:
if (p->ep->nr == 2) {
if (p->ep->nr == 1) {
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to reflect Controller S - see other change

if (s->in_dirty) {
usb_packet_copy(p, &s->in_state, s->in_state.bLength);
s->in_dirty = false;
} else {
p->status = USB_RET_NAK;
//p->status = USB_RET_NAK;
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Desperate attempts - can probably be reverted

Copy link
Copy Markdown
Owner Author

@JayFoxRox JayFoxRox Jul 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this was correct

}
} else {
assert(false);
}
break;
case USB_TOKEN_OUT:
p->status = USB_RET_STALL;
if (p->ep->nr == 2) {
assert(false);
} else {
p->status = USB_RET_STALL;
assert(false);
}
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More desperate tests, we pobably need something like this though?

Copy link
Copy Markdown
Owner Author

@JayFoxRox JayFoxRox Jul 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should also set the rumble; not sure about the still-unhandled case. but I assume STALL is correct

break;
default:
p->status = USB_RET_STALL;
Expand Down