Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: Device emulation #1478

Closed
wants to merge 38 commits into from
Closed

Conversation

faha223
Copy link
Contributor

@faha223 faha223 commented Jul 15, 2023

Added functionality to emulate an Xbox Controller S or a Steel Battalion controller in addition to the existing emulated Xbox controller

@faha223 faha223 changed the title Device emulation UI: Device emulation Sep 23, 2023
typedef struct XIDSteelBattalionOutputReport {
uint8_t report_id;
uint8_t length;
uint8_t CockpitHatch_EmergencyEject;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
uint8_t CockpitHatch_EmergencyEject;
uint8_t EmergencyEject : 4;
uint8_t CockpitHatch : 4;
uint8_t Ignition : 4;
uint8_t Start : 4;
....

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've never seen this syntax before, but it looks like it could be really useful. Thanks!


static void print_xid_steel_battalion_output_data(XIDSteelBattalionOutputReport *state)
{
print_steel_battalion_leds("Cockpit Hatch", "Emergency Eject", state->CockpitHatch_EmergencyEject);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
print_steel_battalion_leds("Cockpit Hatch", "Emergency Eject", state->CockpitHatch_EmergencyEject);
fprintf(stderr, "%s: %d\n", "Emergency Eject", state->EmergencyEject);
fprintf(stderr, "%s: %d\n", "Cockpit Hatch", state->CockpitHatch);
fprintf(stderr, "%s: %d\n", "Ignition", state->Ignition);
fprintf(stderr, "%s: %d\n", "Start", state->Start);
....

@carlosgamer23
Copy link

The emulator could make it easier by having its own frontend, something close to PCSX2, so we can organize the games and put our own covers on them. Have you also thought about creating a compression format for the isos? Something like Dolphin did with RVZ, so that it is supported by Xemu (maybe a compression format called .xe ? Haha 😅)

faha223 added 2 commits March 9, 2024 21:14
build: Update arm64 target, handle target/arch independent pkg names
@faha223
Copy link
Contributor Author

faha223 commented May 11, 2024

I'm thinking I should maybe add light gun to this

DRIVER_LIGHT_GUN_DISPLAY_NAME
};
bool is_selected = false;
for (int i = 0; i < 5; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
for (int i = 0; i < 5; i++) {
for (int i = 0; i < ARRAY_SIZE(driver_display_names); i++) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like this suggestion, but implementing it as-is causes the build to fail because the ARRAY_SIZE macro uses the struct keyword after all is resolved.

I'm going to play around with this and see if I can come up with a good solution

ui/xui/main-menu.cc Outdated Show resolved Hide resolved
ui/xui/main-menu.cc Outdated Show resolved Hide resolved
@faha223 faha223 marked this pull request as ready for review September 20, 2024 21:48
@MasonT8198
Copy link
Contributor

This looks great!

@@ -51,38 +53,61 @@ void InputManager::Update()

// Prevent controller events from going to the guest if they are being used
// to navigate the HUD
xemu_input_set_test_mode(controller_focus_capture); // FIXME: Rename 'test mode'
xemu_input_set_test_mode(
controller_focus_capture); // FIXME: Rename 'test mode'
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: why adjust the spacing


// Combine all controller states to allow any controller to navigate
m_buttons = 0;
int16_t axis[CONTROLLER_AXIS__COUNT] = {0};
int16_t axis[CONTROLLER_AXIS__COUNT] = { 0 };
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: spacing

@@ -125,7 +228,8 @@ bool xemu_input_bind_xmu(int player_index, int peripheral_port_index,
const char *filename, bool is_rebind);
void xemu_input_rebind_xmu(int port);
void xemu_input_unbind_xmu(int player_index, int peripheral_port_index);
int xemu_input_get_controller_default_bind_port(ControllerState *state, int start);
int xemu_input_get_controller_default_bind_port(ControllerState *state,
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: spacing

// Input state
uint16_t buttons;
int16_t axis[CONTROLLER_AXIS__COUNT];

// Rendering state hacked on here for convenience but needs to be moved (FIXME)
// Rendering state hacked on here for convenience but needs to be moved
// (FIXME)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Spacing

m_mouse_moved = true;
m_last_mouse_pos = current_mouse_pos;
m_navigating_with_controller = false;
}

// If mouse capturing is enabled (we are in a dialog), ensure the UI is alive
// If mouse capturing is enabled (we are in a dialog), ensure the UI is
// alive
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Spacing

@MasonT8198
Copy link
Contributor

MasonT8198 commented Jan 27, 2025

There are also some merge conflicts to be resolved however they don't seem super major, just a note, otherwise, great work!

@faha223
Copy link
Contributor Author

faha223 commented Jan 27, 2025

I'm closing this PR as it has been replaced by 4 smaller PRs that, when combined, accomplish the same thing

@faha223 faha223 closed this Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants