L-Spiro / BeesNES

A sub–cycle-accurate Nintendo Entertainment System emulator.
MIT License
42 stars 3 forks source link

Input doesn't seem to work #4

Open FIM43-Redeye opened 3 weeks ago

FIM43-Redeye commented 3 weeks ago

Since this is a very small project, I'm not actually sure how to go ahead and report a bug, What I do know is that BeesNES doesn't seem to take any inputs from my keyboard, and when I do put in new input configs, they stay temporarily (for as long as the program is running) but disappear on restart. Any idea what's up?

L-Spiro commented 3 weeks ago

Someone else was having such an issue, and I suspect the reason is because there is something on your system that registers as a game controller. When a controller is plugged in, input uses that instead of the keyboard.

This is all temporary code; your key settings disappear because they are not saved to a settings file. In the final version it will check your controller settings and keyboard settings so this won't happen, but I still want to know what is causing it to think there is a controller attached when there seemingly isn't. The other person said he had no controllers attached.

If you are building the source, can you have it print the names of the controllers it is detecting?

In the final version, you will be able to specify at least 4 devices for input, and each device will be polled in order until a key-press is found, so this won't happen.

On Thu, Jun 6, 2024 at 8:19 AM FIM43-Redeye @.***> wrote:

Since this is a very small project, I'm not actually sure how to go ahead and report a bug, What I do know is that BeesNES doesn't seem to take any inputs from my keyboard, and when I do put in new input configs, they stay temporarily (for as long as the program is running) but disappear on restart. Any idea what's up?

— Reply to this email directly, view it on GitHub https://github.com/L-Spiro/BeesNES/issues/4, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABYFQ2X4GTYGEC5HXE5LO3DZF6MHDAVCNFSM6AAAAABI3UF7N6VHI2DSMVQWIX3LMV43ASLTON2WKOZSGMZTMOJXHA3DQMI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

FIM43-Redeye commented 3 weeks ago

So I'm building the source, but I'm unfortunately really not adept in C++ at all- I'm mostly really interested in this project and wanted to have a look, but to be honest, I don't really know where to begin, most of what I do is C#. Would a simple printf work? Should I use one for each function in Input that enumerates controllers? Apologies for my ineptitude.

L-Spiro commented 3 weeks ago

Find this function (…\BeesNES\Src\Input\LSNDirectInput8.cpp):

BOOL PASCAL CDirectInput8::DIEnumDevicesCallback_GatherDevices( LPCDIDEVICEINSTANCEW _lpdDi, LPVOID _pvRef ) {

Change it to:

BOOL PASCAL CDirectInput8::DIEnumDevicesCallback_GatherDevices( LPCDIDEVICEINSTANCEW _lpdDi, LPVOID _pvRef ) { std::vector pvVector = static_cast<std::vector >(_pvRef); pvVector->push_back( (*_lpdDi) );

  ::OutputDebugStringW( (*_lpdDi).tszProductName );
  ::OutputDebugStringW( L"\r\n" );
  return DIENUM_CONTINUE;

}

You can also breakpoint that line to see what it prints if you run in the debugger (via hitting F5).

Message ID: @.***>

FIM43-Redeye commented 3 weeks ago

So, oddly, that line doesn't seem to be called at all when I run it in the debugger. When I breakpoint it, the breakpoint never trips, and nothing prints to the debug window that looks like a product name.

Also, as a side note, I'm getting a 'symbols failed to load for wrap_oal.dll. Failed to find local symbol file wrap_oal.pdb' error too. Nothing big, but I know I installed the OpenAL SDK.

L-Spiro commented 3 weeks ago

Try the latest commit. It polls the keyboard even if a controller is detected.

On Fri, Jun 7, 2024 at 2:35 AM FIM43-Redeye @.***> wrote:

So, oddly, that line doesn't seem to be called at all when I run it in the debugger. When I breakpoint it, the breakpoint never trips, and nothing prints to the debug window that looks like a product name.

— Reply to this email directly, view it on GitHub https://github.com/L-Spiro/BeesNES/issues/4#issuecomment-2153063151, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABYFQ2UZUTJBQCELGJO7RYLZGCMXNAVCNFSM6AAAAABI3UF7N6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJTGA3DGMJVGE . You are receiving this because you commented.Message ID: @.***>

FIM43-Redeye commented 3 weeks ago

Still nothing, so far. Buttons are useless, but the wrap_oal problem disappeared, so that was probably on my end. Interestingly, when I do hook up a controller, it picks up on it just fine, but then I can't assign inputs with it at all.