274 Commits

Author SHA1 Message Date
JosJuice
f09ceaa735 Move IOFile to a separate file
Reduces the number of files that need to be recompiled
when making changes to FileUtil.h.
2017-06-15 21:33:50 +02:00
Léo Lam
17ef4c8046 StringUtil: Make SplitString return by value
Simpler usage.
2017-06-11 16:48:20 +02:00
Leo Lam
25850dd366 Merge pull request #5563 from leoetlino/internal-functions
IOS/ES: Make NandUtils member functions
2017-06-09 17:52:09 +02:00
Leo Lam
9885a2bb28 Merge pull request #5575 from leoetlino/setup-stream-key
IOS/ES: Implement ES_SetUpStreamKey
2017-06-08 20:11:14 +02:00
Léo Lam
7b4404c7d5 IOS/ES: Implement ES_SetUpStreamKey
This ioctlv is used to get an IOSC decrypt handle for a title.
It is known to be used internally by the WFS modules, but it can also
be used from the PPC under some conditions.

Brings us down to 2 essentially unimplementable ioctlvs (syscalls which
seem to return kernel thread priorities...), and 1 known but
unimplemented ioctlv (VerifySign).
2017-06-08 18:15:03 +02:00
Léo Lam
e240e260d9 IOSC: Fix the SetOwnership implementation 2017-06-08 18:15:03 +02:00
Léo Lam
47e0a1656e IOS/ES: Make NandUtils member functions
In the future, NAND filesystem access will be limited to one IOS
instance, for safety reasons and to make it possible to consider
supporting NAND images. This means that any code accessing the NAND
filesystem must go through the FS device, both for code that is
external to IOS and internal.

Because we don't want to introduce any singleton, this requires
internal IOS code that needs NAND access to be part of an IOS device
class, so they can access the FS device easily.

Making some of the internal ES implementation functions member
functions also prevents them from being (mis)used outside of IOS,
since they cannot be called everywhere anymore.
2017-06-08 17:44:00 +02:00
Shawn Hoffman
55062afea9 move IOS::HLE::WriteReturnValue to .cpp file 2017-06-08 00:07:10 -07:00
Shawn Hoffman
ead4f19654 ios/usbv4: initialize TransferCommand::data_address to 0 2017-06-07 19:52:08 -07:00
Shawn Hoffman
983f70c9ea ios: treat return values as s32 2017-06-07 19:52:07 -07:00
Shawn Hoffman
ebd3d43b7d ios/es: make fd s32 -> quiets warnings 2017-06-07 19:52:07 -07:00
Shawn Hoffman
8f12d7fb3c ios/net/ip/top: introduce a helper to write ip addr (quiets warning) 2017-06-07 19:52:07 -07:00
Shawn Hoffman
4a1b32afe4 windows: use proper type/constant for NET_IFINDEX in ios hle 2017-06-07 19:52:07 -07:00
Shawn Hoffman
f730b775b6 quiet warnings about possibly-uninitialized variable usage 2017-06-07 19:52:07 -07:00
Shawn Hoffman
8d37301b19 msbuild: Remove hack for ObjectFileName (reduces build parallelism). 2017-06-07 17:30:05 -07:00
Lioncash
b676edd80c Core: include what you use
Eliminates a swath of indirectly included standard headers
2017-06-07 01:20:48 -04:00
Léo Lam
065261dbad Boot: Unify the ELF and DOL code paths
They're essentially the same. To achieve this, this commit unifies
DolReader and ElfReader into a common interface for boot executable
readers, so the only remaining difference between ELF and DOL is
how which volume is inserted.
2017-06-06 16:30:54 +02:00
Léo Lam
22992ae41e Boot: Clean up the boot code
* Move out boot parameters to a separate struct, which is not part
  of SConfig/ConfigManager because there is no reason for it to
  be there.

* Move out file name parsing and constructing the appropriate params
  from paths to a separate function that does that, and only that.

* For every different boot type we support, add a proper struct with
  only the required parameters, with descriptive names and use
  std::variant to only store what we need.

* Clean up the bHLE_BS2 stuff which made no sense sometimes. Now
  instead of using bHLE_BS2 for two different things, both for storing
  the user config setting and as a runtime boot parameter,
  we simply replace the Disc boot params with BootParameters::IPL.

* Const correctness so it's clear what can or cannot update the config.

* Drop unused parameters and unneeded checks.

* Make a few checks a lot more concise. (Looking at you, extension
  checks for disc images.)

* Remove a mildly terrible workaround where we needed to pass an empty
  string in order to boot the GC IPL without any game inserted.
  (Not required anymore thanks to std::variant and std::optional.)

The motivation for this are multiple: cleaning up and being able to add
support for booting an installed NAND title. Without this change, it'd
be pretty much impossible to implement that.

Also, using std::visit with std::variant makes the compiler do
additional type checks: now we're guaranteed that the boot code will
handle all boot types and no invalid boot type will be possible.
2017-06-06 16:27:52 +02:00
Léo Lam
4d2fb9b9ba Core: Replace BOOT_MIOS with an explicit "is MIOS" flag
I didn't know better back then, but the boot type is only supposed to
be used for the actual boot params. It shouldn't be used or changed
after booting.
2017-06-06 16:21:58 +02:00
JosJuice
b2af07a7b7 DiscIO: Remove C/I/S prefixes from class names
These prefixes were inconsistent with the rest of Dolphin.

I'm also renaming VolumeWiiCrypted to VolumeWii because of 1113b13.
2017-06-06 12:31:59 +02:00
Léo Lam
d9fd056803 Fix minor formatting issues
These were not caught by the lint script while it was broken.
2017-06-05 02:32:19 +02:00
Sepalani
140969000e IOS/Network: Fix some error return values 2017-06-04 05:48:41 +01:00
Sepalani
3b217adc5e IOS/Network: Use Wii's fd in logs rather than host's fd 2017-06-04 05:48:40 +01:00
Sepalani
55a59421d9 IOS/Network: Handle SO_ENETRESET 2017-06-04 05:48:38 +01:00
Sepalani
3b48e613e5 IOS/Network: Handle SO_ENOMEM 2017-06-04 05:48:36 +01:00
Sepalani
a3c4070d91 IOS/Network: Handle SO_EPROTOTYPE 2017-06-04 05:48:31 +01:00
Sepalani
b327fd8b2c IOS/Network: Handle SO_EMFILE 2017-06-04 05:47:56 +01:00
Sepalani
ef20e85661 IOS/Network: Handle SO_EPROTONOSUPPORT 2017-06-04 05:47:48 +01:00
Sepalani
1c18dc48c7 IOS/Network: Handle SO_EAFNOSUPPORT 2017-06-04 05:44:48 +01:00
Sepalani
5a9e61997c IOS/Network: Emulate socket fd table 2017-06-04 04:26:25 +01:00
Léo Lam
9d52ab5144 IOS/ES: Move ImportTicket write function
This commit moves the write function to where it should be (IOS),
especially when ES::ImportTicket() is the only place to use it.

Prevents misusing the ticket import function, and removes one unsafe
direct write to the NAND that does not go through IOS.

This also fixes the destination path: the session root is the one which
should be used for determining the ticket path, not the configured one.
2017-06-03 17:43:16 +02:00
Léo Lam
545006f666 Use std::optional for ESFormats/SharedContentMap 2017-06-03 12:36:24 +02:00
Sepalani
5e4986d835 IP/Top: Properly fix GetAddrInfo 2017-06-01 17:05:12 +01:00
Sepalani
726d8de16c IP/Top: Fix GetAddrInfo written socket 2017-06-01 15:17:59 +01:00
Sepalani
e90404a4f6 IP/Top: Use a constant for addrinfo size 2017-05-29 21:00:22 +01:00
Léo Lam
b5a2f34a37 Check TMD sizes using the actual constant
0x49e4 is the actual maximum TMD size (which is checked against in ES).
IsValidTMDSize is added to ESFormats to avoid duplicating the constant.
2017-05-26 11:27:43 +02:00
Léo Lam
57ce091ef5 IOS/ES: Implement ES_DeleteStreamKey (0x3d) 2017-05-24 18:16:35 +02:00
Léo Lam
90d590d1f3 IOS/ES: Implement ES_DeleteContent (0x3e) 2017-05-24 18:16:35 +02:00
Léo Lam
ced049c5e8 IOS/ES: Prevent usage of ES_DiVerifyWithView for the PPC
ES_DiVerifyWithView (0x3b) is another private ioctlv that can only be
used from DI. Calling it from anywhere else returns -1017.
2017-05-24 18:16:34 +02:00
Mat M
4bfd464b0c Merge pull request #5468 from leoetlino/headers
Fix some header includes
2017-05-22 21:22:04 -04:00
Léo Lam
531378e8e6 IOSC: Fix header includes 2017-05-22 02:07:14 +02:00
Léo Lam
7bdf3d7ea7 ESFormats: Fix header includes 2017-05-22 02:06:49 +02:00
Léo Lam
48d02f91a8 IOS/ES: Mark ioctlv 0x3f as invalid
It's not used in IOS. Looks like they just decided to skip 0x3f.
2017-05-21 12:28:30 +02:00
Léo Lam
e92308fe7e IOS/ES: Implement ES_GetTicketFromView ioctlvs
This implements ioctlvs 0x40, 0x43, 0x44.
2017-05-21 12:28:30 +02:00
Leo Lam
7af05fd9e6 Merge pull request #5454 from leoetlino/es-delete-shared-content
IOS/ES: Implement ES_DeleteSharedContent
2017-05-21 12:11:48 +02:00
JosJuice
1575020c3a VolumeWiiCrypted: Get title keys from TicketReader 2017-05-20 20:44:12 +02:00
Léo Lam
2e8e420623 IOS/ES: Implement ES_DeleteSharedContent 2017-05-20 14:46:28 +02:00
JosJuice
fa06d10f4a Merge pull request #2353 from JosJuice/wii-partition-cleanup
VolumeWiiCrypted: Replace ChangePartition with a partition parameter
2017-05-16 23:06:32 +02:00
JosJuice
19b8f1c10a VolumeWiiCrypted: Replace ChangePartition with a partition parameter
By removing mutable state in VolumeWiiCrypted, this change makes
partition-related code simpler. It also gets rid of other ugly things,
like ISOProperties's "over 9000" loop that creates a list of
partitions by trying possible combinations, and DiscScrubber's
volume swapping that recreates the entire volume when it needs to
change partition.
2017-05-16 22:58:15 +02:00
Leo Lam
d2d7247ebe Merge pull request #5430 from sepalani/connect-log
IOS/Network: Log IOCTL_SO_CONNECT return value
2017-05-15 18:12:56 +02:00