April 27, 2024, 10:12:32 am
OOooooooooooh! I see!I'm sorry, I don't think I understand--what exactly is the context that you're using this in? What gun is this being plugged into?I believe so but I will double check to be sure. I did make an edit to my previous post about not having the trigger and pump wired through the pico board, so I think that may have something to do with it as well. I'll get those wired up tomorrow and report back. They are mapped to the right and left mouse button through a third party app.So, I'm having an issue where it doesn't seem to be working properly unless I open the GUI then select the port, unselect it, then reselect it. It pops up with an error about the data not being received in time but it will operate fine until I close the error box. I'm on the latest version. Any ideas?You would be the first to run into such an issue without the app having crashed. Is it the latest versions of both halves? OS/version?
I'm a bit confused by it all. That said, I don't recall buttons not being hooked up to be the cause?
Sorry, I should have given much more context.
So I have the xbox 360 version of the top shot elite rifle which I am adding the IR camera via a pi pico2040 so I can use it for shooters in various emulators on my windows 10 PC. I'm currently using RE:Umbrella chronicles on the Dolphin emulator for all me testing. Since I can't use 2 seperate input devices as a single controller, I'm using a program that maps the xbox buttons to the keyboard and was using the IR as basically just the mouse pointer.
The only thing wired up to to the pico currently is the IR camera and none of the other buttons.
I believe this may be where the issue is as when I run the first time config on the GUI it is asking to use the trigger button to initiate it. So since the trigger isn't wired up through the pico and instead mapped to the mouse as an xbox button, I think it's causing the issue.
I'm sorry, I don't think I understand--what exactly is the context that you're using this in? What gun is this being plugged into?I believe so but I will double check to be sure. I did make an edit to my previous post about not having the trigger and pump wired through the pico board, so I think that may have something to do with it as well. I'll get those wired up tomorrow and report back. They are mapped to the right and left mouse button through a third party app.So, I'm having an issue where it doesn't seem to be working properly unless I open the GUI then select the port, unselect it, then reselect it. It pops up with an error about the data not being received in time but it will operate fine until I close the error box. I'm on the latest version. Any ideas?You would be the first to run into such an issue without the app having crashed. Is it the latest versions of both halves? OS/version?
I'm a bit confused by it all. That said, I don't recall buttons not being hooked up to be the cause?
I'm sorry, I don't think I understand--what exactly is the context that you're using this in? What gun is this being plugged into?I believe so but I will double check to be sure. I did make an edit to my previous post about not having the trigger and pump wired through the pico board, so I think that may have something to do with it as well. I'll get those wired up tomorrow and report back. They are mapped to the right and left mouse button through a third party app.So, I'm having an issue where it doesn't seem to be working properly unless I open the GUI then select the port, unselect it, then reselect it. It pops up with an error about the data not being received in time but it will operate fine until I close the error box. I'm on the latest version. Any ideas?You would be the first to run into such an issue without the app having crashed. Is it the latest versions of both halves? OS/version?
I believe so but I will double check to be sure. I did make an edit to my previous post about not having the trigger and pump wired through the pico board, so I think that may have something to do with it as well. I'll get those wired up tomorrow and report back. They are mapped to the right and left mouse button through a third party app.So, I'm having an issue where it doesn't seem to be working properly unless I open the GUI then select the port, unselect it, then reselect it. It pops up with an error about the data not being received in time but it will operate fine until I close the error box. I'm on the latest version. Any ideas?You would be the first to run into such an issue without the app having crashed. Is it the latest versions of both halves? OS/version?
So, I'm having an issue where it doesn't seem to be working properly unless I open the GUI then select the port, unselect it, then reselect it. It pops up with an error about the data not being received in time but it will operate fine until I close the error box. I'm on the latest version. Any ideas?You would be the first to run into such an issue without the app having crashed. Is it the latest versions of both halves? OS/version?
// Merge in the wheel edge latch bit
if (m_hdc68k_wheel_edge)
{
result ^= 0x4000;
printf("hdc68k_port1_r: merge latch result=%04X m_hdc68k_last_wheel=%04X\n", result, m_hdc68k_last_wheel);
m_hdc68k_wheel_edge = 0;
}
m_hdc68k_last_port1 = result;
return result;
}
uint16_t harddriv_state::hda68k_port1_r()
{
uint16_t result = m_a80000->read();
if (m_hdc68k_wheel_edge)
{
result ^= 0x4000;
printf("hda68k_port1_r: merge latch result=%04X m_hdc68k_last_wheel=%04X\n", result, m_hdc68k_last_wheel);
m_hdc68k_wheel_edge = 0;
}
return result;
}
uint16_t harddriv_state::hdc68k_wheel_r()
{
static float ema_wheel = 0.0f; // Persistent storage of EMA across calls
static const float alpha = 0.05f; // Smoothing factor for EMA, adjustable
static bool initialized = false; // To check if ema_wheel is initialized
uint16_t new_wheel = m_12badc[0].read_safe(0xffff);
// Display the wheel position when left shift is pressed
if (machine().input().code_pressed(KEYCODE_LSHIFT))
{
popmessage("wheel new=%04X", new_wheel);
}
// Determine if the current game is Hard Drivin's Airborne
bool is_hdrivair = (machine().system().name == std::string("hdrivair"));
// Separate edge detection logic for hdrivair and non-hdrivair games
if (is_hdrivair)
{
// Use a specific mask for Hard Drivin's Airborne (placeholder for future changes)
if ((m_hdc68k_last_wheel & 0x0c00) != (new_wheel & 0x0c00))
{
m_hdc68k_wheel_edge = m_hdc68k_wheel_edge == 0 ? 1 : 0;
}
}
else
{
// Use the default mask for other games
if ((m_hdc68k_last_wheel & 0x0c00) != (new_wheel & 0x0c00))
{
m_hdc68k_wheel_edge = m_hdc68k_wheel_edge == 0 ? 1 : 0;
}
}
if (is_hdrivair)
{
// EMA calculation only for Hard Drivin's Airborne
if (!initialized)
{
ema_wheel = new_wheel; // Initialize EMA with the first reading
initialized = true;
}
else
{
ema_wheel = alpha * new_wheel + (1 - alpha) * ema_wheel; // Update EMA
}
}
else
{
// For other games, use the raw wheel data without EMA
ema_wheel = new_wheel;
}
m_hdc68k_last_wheel = new_wheel;
uint16_t output;
if (is_hdrivair)
{
// Hard Drivin's Airborne specific processing
output = (static_cast<uint16_t>(ema_wheel) << 7) & 0xFFF0; // Shift and mask for hdrivair
}
else
{
// For other games, shift left by 8 and set the last hex digit to 0xFF
output = (static_cast<uint16_t>(ema_wheel) << 8) | 0xFF;
}
// Return the processed wheel value
return output;
}