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

Add controller port configuration GUI and support virtual SB controller with feedback status #1196

Merged
merged 43 commits into from
May 29, 2018
Merged

Add controller port configuration GUI and support virtual SB controller with feedback status #1196

merged 43 commits into from
May 29, 2018

Conversation

jackchentwkh
Copy link
Contributor

@jackchentwkh jackchentwkh commented May 22, 2018

Using dialog to let user assign which host controller he want to assign to each xbox port.
add preliminary support for virtual SteelBatallion controller. input mapped to 1st Xinput and directinput,
key mapping will be provided later.
also add a new dialog via CxbxVSBC.dll for virtual SteelBatallion controller feedback status.
later I will add GUI input support via the same dialog.

besides the virtual SteelBatallion controller, the user configuration for host controller assignment is a major change.
I also add some new structures together with my new findings for the DeviceTable and DeviceInfo of xbox devices.

EDIT by RadWolfie:
Here's the new change to GUI. (Used to have option toggle XInput option.)
image
Only with Steel Batallion title, controller feedback status will open.
9bb0a29ed23adfbc

…event mis-use host equivalent.

Add newly findings for device table related info.
now the XINPUT_STATE is correctly refering to host type, no need to specify the name space.
Prepare for configurabale host input, and virtual xbox controller.
using console as controller output.
using XInput and direct input combined keys
now registry works.
SBC controller feedback
add possibility of using same dialog for virtual controller input.
sort of working.
revert the dlg message handling from wnd.cpp
modeless dialog got issues. modal dialog will occupy focus. only way is to use a DLL, load the DLL when cxbx-r emulation child process started, and create a dummy window from DLL then create a modal dialog.
lots of code change and clean up.
@jackchentwkh
Copy link
Contributor Author

jackchentwkh commented May 22, 2018

you'll need to patch the default.xbe to run SteelBatallion because of the DirectSound initialization issue.
as for the virtual SB controller.
here is the current configuration, you need 1 xinput controller and 1 direct input to get enough input.
vsbc
currently it's enough to get into the game.
but so far the game only got black screen. but you can hear sound effect when you fire weapon/turn the sight view

@PatrickvL
Copy link
Member

Please add a marker (like OLD_INPUT or something like that) to all code-blocks that you've disabled, and create an issue to remove all thusly marked code (otherwise, a lot of crap keeps lingering on).

@PatrickvL
Copy link
Member

PatrickvL commented May 22, 2018

Nearly all files in src/CxbxVSBC are marked binary - that can't be right!

Intentation and comment-style aren't consistent, please try to match existing code style.

Also, a number of .tlog files crept in - those don't seem necessary, so add them to .gitignore

EDIT by @RadWolfie:
Add src/CxbxVSBC/Release and src/CxbxVSBC/Debug to .gitignore. We should not include compiled build in main repo. Plus this is where .tlog files came from.

Copy link
Member

@RadWolfie RadWolfie left a comment

Choose a reason for hiding this comment

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

See my comments for change request.

I don't see why submodules need to be updated in this pull request. If we need to update the submodules, it must be on its own pull request.

As for files on github show "Binary file not shown.", are you saving them with windows' newline? If so, I'm not sure why it's showing the message.

@@ -223,7 +223,7 @@
</HeaderFileName>
</Midl>
<ClCompile>
<Optimization>Full</Optimization>
<Optimization>Disabled</Optimization>
Copy link
Member

Choose a reason for hiding this comment

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

Cannot be unoptimized in master branch.

@@ -128,13 +128,33 @@ Global
{B8D9AFC2-B38F-4714-846D-8A2754F076C9}.Debug_Direct3D9|Any CPU.Build.0 = Release|Win32
{B8D9AFC2-B38F-4714-846D-8A2754F076C9}.Debug_Direct3D9|Win32.ActiveCfg = Debug|Win32
{B8D9AFC2-B38F-4714-846D-8A2754F076C9}.Debug_Direct3D9|Win32.Build.0 = Debug|Win32
{B8D9AFC2-B38F-4714-846D-8A2754F076C9}.Debug_Direct3D9|x64.ActiveCfg = Debug|x64
Copy link
Member

Choose a reason for hiding this comment

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

Cannot have x64 build as Cxbx is only design to compile in x86 executable.

See below as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed with added commit

</ItemGroup>
<ItemGroup>
<None Include="..\..\CONTRIBUTORS" />
<None Include="..\..\COPYING" />
<None Include="..\..\README.md" />
<None Include="..\..\resource\.editorconfig" />
<None Include="..\..\resource\Logo.bmp" />
<None Include="..\..\resource\ribbon1.mfcribbon-ms" />
Copy link
Member

Choose a reason for hiding this comment

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

I do not see ribbon1.mfcribbon-ms file in this pull request.

Also, I don't think it should be in here since I never heard of mfcribbon-ms file extension.




void XTL::Load(const char *szRegistryKey)
Copy link
Member

Choose a reason for hiding this comment

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

Wrong place to put it. It should remain inside XBController.cpp file or different file inside /src/Common/Win32 directory. (part 1/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.

XBcontroller is for directinput, that's what I have in my mind.
are you sure the xbcontroller is generalized with xinput?

Copy link
Member

Choose a reason for hiding this comment

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

It may not contain any xinput. If you want to keep it separate, you can make a new file in src/Common/Win32 folder. I thought you had a new file in src/Common/Win32 directory for Xinput? All registry settings are in there to separate from main source code of Cxbx and CxbxKrnl's folders.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, let me check what I can do

// ******************************************************************
// * func: XTL::Save
// ******************************************************************
void XTL::Save(const char *szRegistryKey)
Copy link
Member

Choose a reason for hiding this comment

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

Wrong place to put it. It should remain inside XBController.cpp file or different file inside /src/Common/Win32 directory. (part 2/4)

}

//Set HostType and HostPort setting from global array per xbox port. The setted value will take effect from next time xbe loading.
void XTL::SetXboxPortToHostPort(DWORD dwXboxPort, DWORD dwHostType, DWORD dwHostPort)
Copy link
Member

Choose a reason for hiding this comment

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

Wrong place to put it. It should remain inside XBController.cpp file or different file inside /src/Common/Win32 directory. (part 3/4)

g_XboxPortMapHostPort[dwXboxPort] = dwHostPort;
}
//retrieve HostType and HostPort setting from global array per xbox port.
void XTL::GetXboxPortToHostPort(DWORD dwXboxPort, DWORD &dwHostType, DWORD &dwHostPort)
Copy link
Member

Choose a reason for hiding this comment

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

Wrong place to put it. It should remain inside XBController.cpp file or different file inside /src/Common/Win32 directory. (part 4/4)

@@ -633,6 +640,7 @@
<None Include="..\..\resource\.editorconfig">
<Filter>Code Format\resource</Filter>
</None>
<None Include="..\..\resource\ribbon1.mfcribbon-ms" />
Copy link
Member

Choose a reason for hiding this comment

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

Same here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the ribbon1 is added by VS, I don't know why it's there. I will remove it.

<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
Copy link
Member

Choose a reason for hiding this comment

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

I believe this is the fault. Also PlatformToolset is recommended to use $(DefaultPlatformToolset) above.

@@ -162,7 +162,7 @@
</HeaderFileName>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<Optimization>Full</Optimization>
Copy link
Member

Choose a reason for hiding this comment

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

Um... Debug should never have optimization? I think you choose "all configurations" to set full optimization by mistake.

@@ -101,7 +101,7 @@
</HeaderFileName>
</Midl>
<ClCompile>
<Optimization>Disabled</Optimization>
<Optimization>Full</Optimization>
Copy link
Member

Choose a reason for hiding this comment

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

Same here, see comment below.

// ******************************************************************
// accroding to XDK document, all game controller use 0x01 GAMEPAD device type. then specify the subtype in returned Capabilities when XInputGetCapabilities called.
#define X_XINPUT_DEVTYPE_GAMEPAD 0x01
// SteelBatalion controller is the only one with special device type other than 1.
Copy link

Choose a reason for hiding this comment

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

I repeat my previous comment: I suggest to drop references to the XDK in the code/comments, since it's technically illegal to have. Just say what the variable(s) is/are for, and we are good. Same for other instances in this PR

Copy link
Member

@RadWolfie RadWolfie May 23, 2018

Choose a reason for hiding this comment

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

What we can't do is copy and paste exact from source code. Reading/reviewing the help documentation is okay to mention if there are more complicated process need to explain (just can't have the word xdk in it).

For this type of note, I don't think it's worth mention the document here.

EDIT: Fix my wording.

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 agree. Direct mentioning to official resource will be removed.

@PatrickvL
Copy link
Member

@jackchentwkh @RadWolfie have either of you decided on what to do on the above mentioned review comments? It'd be nice to get this merged in soon! (Once deemed stable, that is)

@RadWolfie
Copy link
Member

There are variety needs to be fix, haven't seen new commits to resolve them from his end.

Right now, there's a merge conflict for build/win32/Cxbx.vcxproj.filters file.

@jackchentwkh
Copy link
Contributor Author

Sorry I was busy this week. Shall find some time this weekend.

@RadWolfie
Copy link
Member

After all the reviews been fixed. Verifying on my end to ensure configuration is working before approve to merge.

Copy link
Member

@RadWolfie RadWolfie left a comment

Choose a reason for hiding this comment

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

lgtm!

EDIT: My recommendation is to use squash and merge option.

Plus I do not own both Steel Battalion and hardware device. So I can't verify this part.

@PatrickvL
Copy link
Member

Lgtm - great job all around!

This should be the last fixup for pull request.
@RadWolfie
Copy link
Member

I took a peek in AppVeyor to find out both release and debug zipped folder doesn't contain CxbxVSBC.dll file. New commit should resolve it.

@jackchentwkh
Copy link
Contributor Author

jackchentwkh commented May 28, 2018

the newly merged LLE/HLE status altered the resource file which introduced conflicts.
I would suggest to merge this PR is there is no other objections.
I am working on USB pass through SB controller support and it's almost done.
this PR must be merged first so I can rebase my new code on it.
resource/Cxbx.aps shall be ignored

@ObiKKa
Copy link

ObiKKa commented May 28, 2018

Such wonderful GUI windows as seen in the original post. But I have found six typos that could be fixed before testing begins for alpha 0.1.
Plus, also, why is the line "Main Monitor Zoom" in mostly lower capital when almost all other letters on the second window are capitalised? Also why are there two copies of "Tuner Dial" in the same sector?

Typos:
STEEL BATALLION (In the title bar of the second window. It's "Steel Battalion". Double t, single l.)
Virtual SteelBatalion (Also this one with multiple handles in the first window. See line above here.)
MAIN WAPON CONTROL (Weapon)
SUB WAPON CTONTROL (Weapon Control)
COCKIT HATCH (Cockpit)
IGINITION (Ignition)

Maybe this one too?
FILT CONTROL SYSTEM (Filter?)

@jackchentwkh
Copy link
Contributor Author

@ObiKKa thanks a lot for the corrections for typo.
every correction is correct except the FILT which is what's one the original controller.
here is the original controller's layout.
sbc
I will issue a new commit to fix those typos and rebase conflict.

@jackchentwkh
Copy link
Contributor Author

I got trouble rebasing this PR to master.
after rebase, the project won't compile, and lots of include path settings are not taking effect.
Can someone help me solve the merge conflict and merge the PR as is.
then I can issue new PR for the typo correction and add USB pass through support for SB controller?

@RadWolfie
Copy link
Member

RadWolfie commented May 29, 2018

I'm working on it. Then we can resolve the merge conflict to get this in master soon as possible.

EDIT: Waiting for pull request jackchentwkh#4 to be merge. Then merge conflict should be resolve.

@LukeUsher LukeUsher merged commit 6edf293 into Cxbx-Reloaded:master May 29, 2018
@LukeUsher
Copy link
Member

@jackchentwkh please document any important information about the Steel Battalion on the Xbox Dev Wiki .

There's not much info there, and you've obviously done a great deal of research getting it into Cxbx-R

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.

6 participants