189 Commits

Author SHA1 Message Date
gblues
8a4c5086fb Finish HID implementation for WiiU GCA adapter
== DETAILS

(I think)

- Uncomment the call in the read loop to start feeding packets to the
  driver
- implement the GCA packet driver
- implement the pad interface
- fix indentations in GCA driver

== TESTING
Compiles. Haven't tested yet.
2018-03-29 23:37:11 -07:00
gblues
180d6a28bf Fix up HID device driver initialization
== DETAILS
Turns out the cause of the crash was a bad cast, resulting in a
function call to nowhere.

Also, I think the DSI exception handler only works on the primary core;
when this was happening in the background thread, I got a black
screen error instead.

Next up: finishing up the GCA driver.
2018-03-29 23:37:11 -07:00
gblues
dc6f4c23ed Rename hid_driver_instance members for clarity 2018-03-29 23:37:11 -07:00
gblues
4b9d5c0ab7 Start implementing "detach" code path
== DETAILS
We're at a point where we need to do more than just
clean up a local data structure, so I've started
implementing the "detach" part of the code so that
everything gets cleaned up properly.

Also, added error handling inside the polling
thread.

== TESTING

Have not tested yet.
2018-03-29 23:37:11 -07:00
gblues
0100d58ffb WIP: evolve driver implementation
== DETAILS

I've created the concept of a hid_driver_instance_t which is basically
a central place to store the hid pad driver, hid subsystem driver,
the pad list, and the instance data for the above in a central location.

The HID pad device drivers can use it to perform HID operations in a
generic manner.

This is more-or-less a pause point so I can catch up with upstream.

== TESTING

Haven't tested this yet. Compiles without warnings though!
2018-03-29 23:37:11 -07:00
gblues
41ce8853d7 Add name for hid device; implement detect
== DETAILS

- detect() methods in device_* files now check for VID/PID
  instead of just returning false
- add "name" field on hid device, mainly for logging purposes

== TESTING
Verified my WiiU GC adapter detected properly
2018-03-29 23:37:11 -07:00
gblues
ae19eed00f implement hid device search 2018-03-29 23:37:11 -07:00
not6
af8559bc19
Update imports.h
add OSGetCurrentThread and OSExitThread.
2018-02-25 13:53:57 +00:00
twinaphex
4f7f237644 (Wiiu) uniquely name global variable 'pos' to prevent collissions with
variables in other cores (like freeintv)
2018-02-03 15:40:54 +01:00
Ash
af37d3780a
[WiiU] Fix indentation, for real this time
-_-
2018-01-30 17:43:45 +11:00
Ash
68f7aeadb2
[WiiU] Reformat line indents
Not sure what happened there. Do we need a squash merge now?
2018-01-30 17:38:16 +11:00
Ash
3a442af6be
[WiiU] Add missing time/clock libc functions
Add some timing functions so that we can know the time (woo-hoo?)
I use errno here, which worries me a bit. I wouldn't put it past
devkitPPC to have it as a null pointer or something.

Can confirm this makes XMB's clock work, much to @cucholix's delight;
I'm sure ;D
2018-01-30 17:14:58 +11:00
Twinaphex
0c3a684e2c
Merge pull request #6192 from gblues/master
Fix memory management bugs
2018-01-28 08:48:21 +01:00
gblues
f2ea5dde11 Fix memory management bugs
== DETAILS

 * Fix double-free in hidpad shutdown code
 * Fix possible double-free in hidpad error handling code
 * Fix memory leak in adapter delete method
2018-01-27 22:54:59 -08:00
Twinaphex
a3757cea70
Merge pull request #6165 from gblues/master
Fix wiimote detection
2018-01-24 06:38:19 +01:00
gblues
9e2d53dc99 Fix wiimote detection
== DETAILS
When I split out wiiu_gamepad into multiple sub-drivers, I missed a spot.

The code expects the device type to be initialized to a magic number
(0xfd), and instead it was getting initalized to zero, which meant it
never triggered the detection process.

I re-added the initialization, and now it works.

== TESTING

Tested with nestopia core to confirm autodetect and game response works.
2018-01-23 19:57:51 -08:00
aliaspider
c8027ebe1d (tools) add the tool used to generate the d3d headers. 2018-01-21 04:28:06 +01:00
gblues
86ac651edf Fix disabled HID code, add defensive programming
== DETAILS

1. Noticed that the HID driver wasn't loading after setting WIIU_HID=1. Found
   that the HID driver init was ifdef'd out. Removed that.

2. Current theory around "System Memory Error 160-2203" is in-memory
   corruption. So, to try to identify it:

   - Created a routine that does a hex dump of the RPX over the logger. (I
     have a python3 script that can extract the hex dump back into a binary
     file). If a SME occurs with this routine enabled, we can see if the
     corruption is happening at read-time, or somewhere between when we send
     the RPX to the loader and try to execute it.

   - I noticed that we allocate slightly more memory than the RPX actually
     needs, and we don't zero the memory, which means there's a handful of
     bytes at the end that could be anything. I added a call to memset() to
     zero out the memory prior to loading the RPX off the SD card.

And, of course, after adding those, I haven't been able to reproduce the
System Memory Error, so maybe the uninitialized memory was the problem?

Here's hoping.
2018-01-18 19:57:19 -08:00
gblues
1515bd8c1b Minor cleanups
== DETAILS
- Add *.swp to gitignore so editor swap files don't get committed
- Remove unneeded commented-out defines from WiiU build
- Start on fix for DSI when switching cores on WiiU

== TESTING
Sigh. I'm back at "System Memory error", which makes me think the problem
might be the SD card. (On the plus side, I manually verified the hash so
at least the copy process is working).

So, that's to say that I can't actually test to see if the DSI error is
fixed.
2018-01-13 12:16:37 -08:00
aliaspider
24cb240079 (WIIU) add remaining menu shaders.
- move some files around.
2018-01-12 02:54:45 +01:00
aliaspider
eac088696a (WIIU) add ribbon shader. fix menu bg gradient. 2018-01-11 02:09:03 +01:00
Twinaphex
ae9e13324d
Merge pull request #6073 from aliaspider/master
(WIIU) improve support for custom shaders.
2018-01-09 03:22:49 +01:00
aliaspider
dc7c0a570f (WIIU) revert changes to net_listen.sh 2018-01-09 03:07:41 +01:00
aliaspider
42905d9bbb (WIIU) add a better converter for slang shaders. 2018-01-09 03:05:29 +01:00
gblues
5894d0ef86 Remove all HID code from WiiU build via ifdef
== DETAILS
We're trying to track down the source of crashes when switching cores.
To rule out the HID code, this commit does the following:

- Wraps the library imports in an ifdef
- Wraps the object files in conditionals in Makefile.wiiu
- In wiiu_joypad, calls into the hidpad driver are wrapped in ifdef

== TESTING
This didn't solve the "System memory error" crash I've been experiencing.
But, maybe it will impact the other flavors of crashes others are seeing.
2018-01-07 20:26:24 -08:00
aliaspider
6b24663dd9 (WIIU) add more NULL check to *_free functions. 2018-01-07 03:45:41 +01:00
aliaspider
7cc34302f4 (WIIU) check for NULL in gfd_free 2018-01-07 03:40:03 +01:00
aliaspider
517a3f801f (WIIU) add a tool to convert slang shaders. 2018-01-07 03:26:14 +01:00
Alfredo Monclus
bbd9a6566c WiiU: C89 style comments 2018-01-06 09:44:03 -03:00
twinaphex
8c20206afa Update 2018-01-06 12:35:00 +01:00
gblues
560a5f0a4f Fix the blocking call to HIDRead()
== DETAILS

TIL that the "max_packet_size_*" fields in the HIDDevice struct
are actually requirements, not maximums.

The reason HIDRead() was blocking was because the HIDWrite() that
sent the activation command was silently failing.

The reason HIDWrite() was silently failing was because I was using too
small of a buffer for the device.

In this case: the Wii U GC adapter, which has a "max" tx packet size of 5.

"max" is misleading. You actually have to write all 5 bytes.

Which means: copying the 1-byte buffer to the 5-byte buffer, and writing
the 5-byte buffer via HIDWrite().

So, in summary:

- Use correct semantics for HIDWrite() so that HIDRead() can work.
- Update the OSThread struct to reflect the current knowledge over at
  WUT. It's unlikely this was actually causing a problem, but never
  hurts to be more correct.

== TESTING
I temporarily enabled the call to log_buffer() and confirmed that the
GC adapter's state is successfully being read.
2018-01-05 23:12:42 -08:00
gblues
5b13f85967 Use the right value for BIT256_GET macro
== DETAILS

The BIT256_GET() macro expects a bit number (from 0-255), and we're giving it
a 32-bit mask (0x000080000).

Solution:

- Define VPAD_BUTTON_xxx_BIT macros using the bit number
- Use said macro in wiiu_input.c
- organizational cleanup:

  * put VPAD_BUTTON_TOUCH into the enum in stead of as a hokey define
  * put the touch bits in the right order
  * put in placeholder enums for (currently) unused bits
2018-01-05 20:03:10 -08:00
Andrés
dedcd26495
Merge pull request #6053 from aliaspider/master
(WIIU) add preliminary multi-pass shader support.
2018-01-05 21:48:30 -05:00
aliaspider
55d262f5d8 (WIIU) add preliminary multi-pass shader support.
can load *.slangp and *.slang files. since there is no runtime compiler,
precompiled shaders (*.gsh) need to be present next to each *.slang
source file.
2018-01-06 03:39:53 +01:00
Twinaphex
3dff396ff4
Merge pull request #6050 from aliaspider/master
(WIIU) add a frame shader to match the shaders used by gl/vulkan
2018-01-05 13:49:10 +01:00
aliaspider
8e095164e0 (WIIU) add a frame shader to match the shaders used by the gl/vulkan
drivers.
2018-01-05 13:18:55 +01:00
twinaphex
cf8e7cd362 (wiiu) small style nits; declare variables at top; C comments 2018-01-05 13:09:05 +01:00
Twinaphex
af9911df8a
Merge pull request #6048 from gblues/master
Fix RETRO_DEVICE_ID_POINTER_PRESSED handling
2018-01-05 12:39:52 +01:00
gblues
34b120c269 Fix unfreed memory bug
== DETAILS
This should fix #6025.

After confirming that dummying out the init block of the HID subsystem
driver eliminated the crash, I narrowed it down to the event loop.

And that's when I noticed that, when the thread consumes the event,
it doesn't free it.

Oops.

Updated the event loop to free the event after it has been processed.

== TESTING
Local build, was able to load multiple ROMs in succession where prior
I was getting the system memory errors.

I've #if 0'd out a call to HIDRead that is still getting deadlocked,
because it slows down the startup/shutdown process.
2018-01-05 00:16:59 -08:00
gblues
3a0468523a Fix RETRO_DEVICE_ID_POINTER_PRESSED handling
== DETAILS

The joypad driver was only copying the first 16 bits when executing
get_buttons(). The touchpad button is bit 19, so as a result
RETRO_DEVICE_ID_POINTER_PRESSED would never fire.

We fix this for now by copying 32 bits.

== TESTING

Will need someone to verify. I don't  have a core handy that leverages
the pointer device state functionality.
2018-01-04 22:13:30 -08:00
aliaspider
3979d03cb3 (WIIU) add a gfd shader file reader. 2018-01-04 23:03:11 +01:00
aliaspider
a7632620da (WIIU) add a sprite shader. 2018-01-04 17:38:04 +01:00
aliaspider
e63697dca7 (WIIU) fix net logger. 2018-01-04 17:21:16 +01:00
gblues
80cdb92154 Re-re-fix wpad scaling. For real this time.
== DETAILS

@r-type got me the link to the fixed-fixed version.

Which was actually closer to where I was originally!

So:

- Revert the previous commit
- Apply the actual changes needed to fix the problem
- Bring in and fix the logging code from the previous implementation

== TESTING
- Verified that top-left is -0x7fff,-0x7fff and that bottom-right is
  0x7fff, 0x7fff.

== REVIEW
@QuarkTheAwesome @r-type @twinaphex
2018-01-03 21:32:00 -08:00
gblues
c1ef5c5497 Revert "Fix wiiu touchpad scaling"
This reverts commit 1d933a6b52e15ec281deb2aff5151292b8ebe655.
2018-01-03 19:57:38 -08:00
gblues
1d933a6b52 Fix wiiu touchpad scaling
== DETAILS

Apparently when I refactored this code, I missed out on the fix for
touchpad coordinates that @QuarkTheAwesome had committed.

Oops.

- Fix the touchpad coordinates
- Remove unneeded references to video driver in wpad_driver.c
- Remove unneeded video driver include in pad_driver.h
- Add logging in wpad_driver to verify the fix (#ifdef'd out by default)

== TESTING

Verified fix manually.
2018-01-02 23:25:03 -08:00
aliaspider
0a32642f17 (WIIU) shader: use a single attribute stream. 2017-12-31 14:06:49 +01:00
gblues
c2d2fe971e Add timeout for HID thread shutdown
== DETAILS
If a call to HIDRead() ends up blocking indefinitely, it will
cause the shutdown process to wait forever.

To avoid a deadlock, I've put in a retry counter so that it will
give up after 5s and print a warning to the log.
2017-12-30 20:59:07 -08:00
Twinaphex
d9c0f769c7
Merge pull request #6006 from aliaspider/master
(WIIU) update shader and add alpha blending to menu + overlays.
2017-12-31 00:21:53 +01:00
aliaspider
b371f4bb32 (WIIU) add a color attribute to tex_shader.
+ some fixes to overlay and menu display code.
2017-12-30 23:21:32 +01:00