Commit Graph

40 Commits

Author SHA1 Message Date
Cthulhu-throwaway
3aa1811ca9
(Network) Add getnameinfo_retro (#14278) 2022-08-04 13:22:49 +02:00
Nathan Strong
9b2d4236ad WIIU: Clean up a bunch of compiler warnings
== DETAILS
These changes fall into a few broad categories:

1. Explicitly undefine things we want to re-define due to conflicts with
   the version of devkitpro we're using
2. Clean up hex format specifiers to use `%lx` or `%lX` when working with
   long integers
3. Move variables inside the ifdef they're used in to squelch "unused variable"
   messages
4. Add parenthesis to make Wii U shader declarations stop complaining

And then there's a weird "misleading indent" warning that I fixed by just
rewriting a block of code to use a switch statement instead of if-then-else.

These changes work fine on Wii U, but we'll need to keep an eye on CI/CD to see
if other platform builds break.
2021-09-25 13:25:39 -07:00
Ash Logan
e5553bde4e wiiu: Network optimisations - WINSCALE, TCP sACK, large buffers
See code sample in https://github.com/devkitPro/wut/issues/169 and 
2430789406/src/net.c (L88)
2021-07-18 21:02:56 +10:00
Ash Logan
f22af81e7d (WiiU/wpad) Allow hotplugging Gamepad, support >1 channel 2020-05-17 16:32:51 +10:00
orbea
e062b98088 Remove trailing blank lines.
find . -type f -exec sed -i '${/^[[:space:]]*$/d;}' {} \+
2019-01-17 19:39:38 -08:00
orbea
bfc366decc Squeeze extra blank lines with cat(1).
Example:

find . -type f -iname '*.c' | while read -r i; do
  cat -s "$i" > "$i.new"
  mv "$i.new" "$i"
done
2019-01-08 11:04:58 -08:00
Nathan Strong
c5f9fc0a34 WiiU: fix network information
== DETAILS

For local netplay, it's useful to have your IP address easily
available. This commit makes the Information > Network Information
menu display the Wii U's IP address.

Change summary:
- Fix the logging init to be reentrant to avoid socket consumption
- Add implementation of POSIX `getifaddrs()` and `freeifaddrs()`
  to `missing_libc_functions.c`
- Remove compiler directives protecting the code paths that call
  `getifaddrs()` from being used in Wii U builds

== TESTING

Have tested locally, successfully get IP address information in
the Information > Network Information.

I think this may also fix NAT traversal. Will need to be tested.
2018-10-11 15:37:15 -07:00
Nathan Strong
d3f8d8a08d wiiu: small cleanup
== DETAILS
- remove extraneous '+' from a manually applied diff
- fix the net_listen.sh script so it works properly on
  Mac OSX

== TESTING
Works locally.
2018-10-10 11:38:03 -07:00
twinaphex
c2112c4cbf Commit this diff patch by gblues 2018-10-10 20:15:31 +02:00
gblues
f22c337cfc WIIU: cleanup and build-out of wiiu bootstrap code
I used the code in `wiiu/` to bootstrap my own WiiU homebrew app; this
PR reflects some changes I needed to make, that might be useful upstream.

1. Clean up filesystem initialization

Filesystem driver initialization was lumped in with filesystem mounting;
and that was a problem in my project, because I needed to be able to remount
the SD card on the fly. So, now it's split up.

I've added a callback object named "hooks" that can be used by consuming
applications to handle filesystem mounting and unmounting. If these hooks are
not provided, then the existing default behavior occurs.

2. Expand socket handling

- add `SO_NONBLOCK` flag for non-blocking socket I/O
- add normal errno defines like `EWOULDBLOCK` `EAGAIN`.

3. Remove RetroArch dependencies

- the exception handler protects usage of version_git with
  `#ifdef HAVE_GIT_VERSION` but not the include, so I added that.

  It also technically depends on version.h, but I'm not touching that.
  It's easy enough to implement and I needed the same functionality. I'm
  not sure what the best solution for that dependency is.

- missing_libc_functions.c included features/features_cpu.h which is
  a libretro include. This appears to be a stale include though, because
  everything compiles and works without it.

- an ifdef referencing the RA "WIIU" define, rather than the devkitpro
  "__wiiu__" define
2018-06-05 00:06:40 -07:00
gblues
23f0a85446 Implement UDP broadcast network logging on Wii U
== DETAILS

The broadcast address is a standard part of TCP/IP that is used to
send messages to everyone on the subnet. This patch updates the
logging code to do the following:

1. Derive the broadcast address from the Wii U's own IP address
   and subnet mask. These can all be obtained at runtime, which
   means we can...
2. Remove the PC_DEVELOPMENT_IP_ADDRESS define from Wii U's
   Makefile, because compiling in an IP is no longer needed.
3. Rewrite the net_listen script to listen for broadcast packets
   and print them out with timestamps.

Since it's using the broadcast address, the only requirement is
that the PC be on the same network subnet as the Wii U.

Because of the low overhead of UDP, I've made logging on by
default. This will make it a ton easier to get useful bug
reports from users.
2018-05-06 14:39:48 -07:00
gblues
04cefd27d1 Cleanup of Wii U launcher code
== DETAILS

The Wii U main entrypoints were embedded in the frontend driver,
which isn't a great place for them. Also, the `main()` method was
pretty long and monolithic. Now it's (much) less so.

Changes:

- Refactor out the main entrypoints into their own source files
  (`wiiu/main.c` and `wiiu/main.h`)
- Optimize includes in both files, so only the minimum needed to
  compile are included.
- The `main()` method is a lot easier to understand now. It's no longer
a confusing mess of ifdefs.
- There's a small amount of changes in the headers for future work, which
  is switching kpad_driver to be callback-driven. The only change here is
  to import the function that will be used, and define some data types.

Testing:
- Did local builds and confirmed build is successful
- Successfully loaded a core and switched among a few games
2018-04-30 21:56:06 -07:00
gblues
dca36ebaf8 Add small snippet for atomic value swapping
Fortunately, the gcc port implements the builtins and, from basic
testing, they seem to work.

This is only really useful on Wii U--other platforms have more
robust atomic operations, or aren't using gcc to build.
2018-04-14 01:26:26 -07:00
gblues
2cf89feb86 Code clean-up
== DETAILS

Now that I have a working implementation, it's time to tidy up a bit:

- there was no need for the HID subsystem's object data to have a reference
  to the global hid state (since it's global), so removed it.
- refactored the users of that member to use the global state, defining
  reusable macros.
- reorganized the information in *.h files
- removing the hid state also made the constructor changes to the hid driver
  unneeded, so I reverted those changes.

== TESTING
Confirmed clean build. Haven't tested the build yet to make sure everything
still works, though.
2018-03-31 22:25:30 -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
ae19eed00f implement hid device search 2018-03-29 23:37:11 -07:00
Alfredo Monclus
bbd9a6566c WiiU: C89 style comments 2018-01-06 09:44:03 -03: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
aliaspider
a7632620da (WIIU) add a sprite shader. 2018-01-04 17:38:04 +01:00
gblues
c1ef5c5497 Revert "Fix wiiu touchpad scaling"
This reverts commit 1d933a6b52.
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
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
aliaspider
f6fdd421c6 (WIIU) shaders: use bitfields for GPU register values. 2017-12-30 16:39:23 +01:00
gblues
65c177a0ee Move HID driver into wiiu/ code
== DETAILS

RetroArch's general HID drivers are intended as a full-on substitute for
other input drivers such as XInput, DInput, SDL, etc. The Wii U port is,
to my knowledge, the first case of heterogenous input drivers working
concurrently.

As such, I've moved things around:

- The HID driver source is moved into the wiiu/input/ directory alongside
  the joypad subdrivers.
- We no longer use the input_hid_init_first() method to instantiate; instead
  we just init the wiiu HID driver directly.
- The HID pad driver and HID subsystem driver enjoy a tighter coupling,
  mainly having to do with the initialization of the joypad connections
  list, because there's no way to inform the HID driver's init() method
  how many slots to allocate.

== TESTING
Will test in a moment, but at  least it compiles cleanly. ;)
2017-12-30 04:43:38 +01:00
gblues
0ae7ffe0d3 Clean up dumb compile warnings, fix crash bug
== DETAILS

- the free() method of the hid_driver_t interface needs its
  parameter defined as const in order for the compiler to stop
  complaining about losing const-ness.
- if a joypad list is created with <MAX_USERS slots in it, the
  destroy() function will crash because it assumes there are MAX_USERS
  entries.

  To do this, the allocate function creates n+1 slots, and gives the
  last slot a canary value that the destroy() method can then watch for
  when iterating through the list.
2017-12-30 04:43:27 +01:00
gblues
52c754cfa8 Split wiiu_gamepad into three sub-drivers
== DETAILS
Well, after a lot of code analysis, this seems like the
best way to handle things on the Wii U without also completely
re-architecting the I/O handling in RetroArch.

How it works:

- the top-level wiiu_joypad driver is now nothing more than a
  delegator.
- the wiiu-specific drivers live in `wiiu/input/`
- wpad_driver.c handles the WiiU gamepad
- kpad_driver.c handles the wiimotes
- hidpad_driver.c will handle HID devices like the GC adapter, DS3/DS4, etc.

  (I say "will" because this isn't implemented yet)

== TESTING
Haven't actually tried the build to see if it works, but it does
compile.
2017-12-30 04:43:18 +01:00
gblues
661e5bf50b Implement new functions in hid_driver_t in WiiU driver
== DETAILS

This implements the WiiU-specific functions.

Since the wiiu_hid_t data structure contains the handle and interface
index, the method signatures can be simplified quite a bit. And since
(at least for now) we want these to be synchronous, we don't need to
expose the callback parameters.
2017-12-30 04:41:19 +01:00
gblues
678c4093c1 Start adapting the dual shock 3 driver to use the new driver format.
== DETAILS

The handshake stuff is derived from the old HID2VPAD, just in knowing
what data goes in what report.

- Added the HID_REPORT_ flags to syshid.h
- Renamed the generic "REPORT_TYPE" flags to be meaningful
- also fixed incorrect parameter list for set_protocol
== TESTING
The functions aren't implemented in wiiu_hid.c just yet,
so this is gonna crash if you try to run it.
2017-12-30 04:41:12 +01:00
gblues
6904101c44 Clean up trailing whitespace
== DETAILS

Really simple code cleanup, because my editor flags trailing whitespaces
and it's pretty annoying.
2017-12-12 00:24:18 -08:00
aliaspider
5a92ec15cf (WiiU) fix netplay. 2017-05-26 12:32:45 +01:00
aliaspider
934f7c58ba (WiiU) enable networking. 2017-05-23 10:24:23 +01:00
aliaspider
b17e76d8b7 (WiiU) add freetype and stb font support.
freetype disabled by default due to requiring an external library.
2017-05-21 04:22:32 +01:00
aliaspider
8dee95651f (WiiU) add a font driver. 2017-05-21 03:05:41 +01:00
Maschell
fa0d82b188 [Wii U] Fixing the .rpx build 2017-05-20 13:13:52 +02:00
Maschell
da0f3620bc [Wii U] Adding missing includes and defines 2017-05-08 12:18:28 +02:00
xhp-creations
4915f452f5 WiiU Initial Keyboard Support
WiiU Initial Keyboard Support
2017-02-09 12:34:12 -05:00
aliaspider
8f88d8fb4d (WiiU) implement the missing requirement for core loading: exec,
exitspawn, set_fork and salamander.
2017-01-25 19:52:31 +01:00
aliaspider
021b510452 (WiiU) refactors/cleanups. 2017-01-23 16:14:05 +01:00