Commit graph

959 commits

Author SHA1 Message Date
Subv c9c1ba0952 Kernel/IPC: Implement StaticBuffer translation for HLE services that use the HLERequestContext architecture.
The real kernel requires services to set up their static buffer targets ahead of time. This implementation does not require that and will simply create the storage for the buffers as they are processed in the incoming IPC request.

Static buffers are kept in an unordered_map keyed by their buffer id, and are written into the already-setup area of the request thread when responding an IPC request.

This fixes a regression (crash) introduced in #2992.

This PR introduces more warnings due to the [[deprecated]] attribute being added to void PushStaticBuffer(VAddr buffer_vaddr, size_t size, u8 buffer_id); and VAddr PopStaticBuffer(size_t* data_size);
2017-11-12 11:00:00 -05:00
Sebastian Valle 7d12aaaa20
Merge pull request #3087 from shinyquagsire23/am-more-errors
Services/AM: Add errors and adjust naming for accuracy
2017-11-07 09:09:48 -05:00
shinyquagsire23 c07f1b275c Services/AM: Rename and readjust GetNumContentInfos for accuracy 2017-11-06 21:36:49 -07:00
shinyquagsire23 d854d4119a Services/AM: Rename and adjust ListContentInfos for accuracy 2017-11-06 21:35:00 -07:00
shinyquagsire23 c6e43ae79d Services/AM: Rename and adjust FindContentInfos for accuracy 2017-11-06 21:35:00 -07:00
shinyquagsire23 69cc04a06d Services/AM: Fix warnings 2017-11-06 21:34:54 -07:00
Subv d1de6b8864 HLE/APT: Try to launch a native applet in PrepareToStartLibraryApplet and PreloadLibraryApplet before falling back to HLE applets.
With this commit, you can run native applets if they are in the correct folder of your virtual NAND.

Trying to exit the applet will currently cause an invalid read loop due to svcExitProcess not being implemented.
2017-11-06 16:42:26 -05:00
Subv ecb1c6d2a1 HLE/APT: Added a function to retrieve the titleid of an applet based on the current system region.
The table was taken from the real APT service, but is incomplete due to the sheer amount of data it contains. There's 29 applets with 7 possible titleids. This table should be filled as needed.
2017-11-06 16:42:26 -05:00
Subv 191565a1b8 HLE/NS: Added a function to launch titles installed to the virtual NAND/SD card.
It uses AM::GetTitleContentPath to retrieve the path of the program to launch.
2017-11-06 15:12:15 -05:00
bunnei 6e12b11353
Merge pull request #3078 from Subv/ac_sessions
Services/AC: Corrected the number of concurrent connections for AC_I and AC_U
2017-11-06 13:21:29 -05:00
Sebastian Valle 8ba2de1580
Merge pull request #3029 from shinyquagsire23/am-title-install
Services/AM: Add CIA title installation support.
2017-11-05 21:23:55 -05:00
shinyquagsire23 e00a45c500 Services/AM: Add CIA title installation support. 2017-11-05 13:26:29 -07:00
shinyquagsire23 7ea04bb55c Services/AM: Fix log commands 2017-11-05 13:26:29 -07:00
shinyquagsire23 ce806dcdf6 file_sys/title_metadata: Allow loading from both files, FileBackends, and data 2017-11-05 13:26:29 -07:00
Subv d4077b0196 Services/AC: Corrected the number of concurrent connections for AC_I and AC_U
The number was reverse engineered from the AC module.
2017-11-05 14:28:06 -05:00
Weiyi Wang 4fc0448093
Merge pull request #3064 from wwylele/printf-warnings
Clean all format warnings
2017-11-05 10:32:46 +02:00
bunnei 5885ca4503
Merge pull request #3067 from Hexagon12/wsacleanup-soc-fix
Removed duplicate calls of WSACleanup in soc_u.
2017-11-04 13:39:09 -04:00
James Rowe c14f802381
Merge pull request #2992 from Subv/ac_srvframework
Services/AC: Converted the ac:i and ac:u services to the new service framework.
2017-11-04 10:42:09 -06:00
Sebastian Valle 3fe9b332bc
Merge pull request #2989 from B3n30/sendTo_PullPacket_Bind
Service/UDS: Implement Bind, Unbind, SendTo, PullPacket, and GetNodeInformation
2017-11-04 10:58:49 -05:00
Hexagon12 695ff7cff3
Clang pls (again) 2017-11-04 17:41:20 +02:00
Hexagon12 81e36150d3
Clang pls 2017-11-04 17:32:12 +02:00
B3n30 ed9db735a2 Service/UDS: Updated BeginHostingNetwork 2017-11-04 15:41:54 +01:00
B3n30 f6d16c3f87 Service/UDS: Implement Unbind and GetNodeInformation 2017-11-04 15:41:54 +01:00
B3n30 230ea063a5 Service/UDS: Implement SendTo, PullPacket, HandleSecureData, and Bind 2017-11-04 15:41:27 +01:00
Hexagon12 4ded138139
Update soc_u.cpp 2017-11-04 16:30:48 +02:00
Hexagon12 5d123144ff
Removed all instances of WSACleanup();. 2017-11-04 15:03:04 +02:00
wwylele 499508389c core: clear format warnings 2017-11-01 12:35:32 +02:00
Subv 95df4e674a Services/AC: Converted the ac:i and ac:u services to the new service framework. 2017-10-27 19:39:19 -05:00
shinyquagsire23 2e38ea7a33 Services/AM: Implement GetPatchTitleInfos, correct error codes/returns, misc fixes 2017-10-26 21:06:29 -06:00
Sebastian Valle aee8bf680c Merge pull request #3032 from Dragios/errno
Remove some errno constants as it was already defined
2017-10-23 10:30:18 -05:00
Dragios eb671d8513 Remove some errno constants as it was already defined 2017-10-22 14:22:27 +08:00
Dragios e46f66a5fa Remove Crypto++ weak algorithm warning 2017-10-22 13:56:59 +08:00
James Rowe dcb48840c3 Merge pull request #2993 from shinyquagsire23/am-and-archive-ncch-rework
AM Service and NCCH Archive Rework
2017-10-20 22:59:38 -06:00
shinyquagsire23 1ac5137655 file_sys/archive_ncch: Use AM to get title content path, add ExeFS support and support for additional content indexes 2017-10-18 21:19:40 -06:00
shinyquagsire23 b9fc359e7e Services/AM: Add title scanning, move to ipc_helper.h, implement most stubbed service calls 2017-10-18 21:19:34 -06:00
Dragios 83e5f639e6 Change command header in nwm::UDS Initialize function 2017-10-09 09:10:48 +08:00
Sebastian Valle 84c344b9b1 Merge pull request #2953 from Subv/applet_launch
HLE/APT: Always set up the APT parameter when starting a library applet.
2017-10-04 15:01:58 -05:00
Subv 5bae5a48b9 Services/NIM: Implement CheckForSysUpdateEvent.
Implementation verified by reverse engineering.
This lets the Home Menu boot without crashing on startup.
2017-09-30 13:21:45 -05:00
B3n30 afb1012bcd Services/UDS: Handle the rest of the connection sequence. (#2963)
Services/UDS: Handle the rest of the connection sequence.
2017-09-30 18:18:45 +02:00
Subv f9d55ecf3f HLE: Implemented SleepClientThread and ContinueClientThread functions to make performing async tasks on the host while in an HLE service function easier.
An HLE service function that wants to perform an async operation should put the caller guest thread to sleep using SleepClientThread, passing in a callback to execute when the thread is resumed.
SleepClientThread returns a ThreadContinuationToken that should be stored and used with ContinueClientThread to resume the guest thread when the host async operation completes.
2017-09-30 11:16:55 -05:00
Sebastian Valle 7056b9c46a Merge pull request #2946 from Subv/home_menu_apt
Implement PrepareToStartNewestHomeMenu and fixed an APT regression.
2017-09-30 10:47:42 -05:00
Huw Pascoe a13ab958cb Fixed type conversion ambiguity 2017-09-30 09:34:35 +01:00
mailwl 8883dca514 Service/PTM: Stub GetStepHistory function 2017-09-29 15:34:41 +03:00
Subv e27ae04696 HLE/APT: Always set up the APT parameter when starting a library applet.
Only use the HLE interface if an HLE applet with the desired id was started.

This commit reorganizes the APT code surrounding parameter creation and delivery to make it easier to support LLE applets in the future.

As future work, the HLE applet interface can be reworked to utilize the same facilities as the LLE interface.
2017-09-25 23:47:50 -05:00
Subv 774e7deae8 HLE/Archives: Allow multiple loaded applications to access their SelfNCCH archive independently.
The loaders now register each loaded ROM with the SelfNCCH factory, which keeps the data around for the duration of the emulation session.

When opening the SelfNCCH archive, the factory queries the current program's programid and uses that as a key to the map that contains the NCCHData structure (RomFS, Icon, Banner, etc).

3dsx files do not have a programid and will use a default of 0 for this value, thus, only 1 3dsx file with RomFS is loadable at the same time.
2017-09-25 09:45:02 -05:00
B3n30 a21b9deb98 Merge pull request #2948 from Subv/register_service
HLE/SRV: Implemented RegisterService.
2017-09-25 08:22:05 +02:00
B3n30 d673d508dd Services/UDS: Added a function to send EAPoL-Start packets (#2920)
* Services/UDS: Added a function to generate the EAPoL-Start packet body.

* Services/UDS: Added filter for beacons.

* Services/UDS: Lock a mutex when accessing connection_status from both the emulation and network thread.

* Services/UDS: Handle the Association Response frame and respond with the EAPoL-Start frame.

* fixup: make use of current_node, changed received_beacons into a list, mutex and assert corrections

* fixup: fix damn clang-format
2017-09-25 08:16:27 +02:00
Subv 7096f01c14 HLE/APT: Always return an error from PrepareToStartNewestHomeMenu so that the Home Menu doesn't try to reboot the system.
As per 3dbrew:
"During Home Menu start-up it uses APT:PrepareToStartNewestHomeMenu. If that doesn't return an error(normally NS returns 0xC8A0CFFC for that), Home Menu starts a hardware reboot with APT:StartNewestHomeMenu etc. "
2017-09-24 08:59:31 -05:00
Subv b57d58c0dc HLE/APT: Prepare the APT Wakeup parameter when the game calls Initialize
We need to know what is being run so we can set the APT parameter destination AppId correctly.
Delaying the preparation of the parameter until we know which AppId is running lets us support booting both the Home Menu and normal game Applications.
2017-09-24 08:59:30 -05:00
Subv 0b33e36292 HLE/SRV: Implemented RegisterService.
Now system modules can do more than just crash immediately on startup.
2017-09-24 00:12:58 -05:00
Yuri Kunde Schlesner 255fd8768d Merge pull request #2906 from Subv/ns_new_framework
Services/NS: Port ns:s to the new service framework.
2017-09-16 21:13:51 +02:00
Subv 3d86e3afc4 Services/NS: Port ns:s to the new service framework. 2017-09-16 10:52:45 -05:00
bunnei 588077184b Merge pull request #2915 from wwylele/font-archive-2
APT: load different shared font depending on the region
2017-09-11 21:39:56 -04:00
Weiyi Wang 617b6974b9 Merge pull request #2831 from Subv/uds_auth
Services/UDS: Handle beacon frames and the basic AP connection sequence frames.
2017-09-05 15:03:56 +03:00
wwylele 59a9aaf388 APT: load different shared font depending on the region 2017-09-03 12:34:11 +03:00
Subv f64cd87604 Services/UDS: Remove an old duplicated declaration of WifiPacket. 2017-08-27 10:48:15 -05:00
Subv d088dbfbe1 Services/UDS: Handle the connection sequence packets.
There is currently no stage tracking, a client is considered "Connected" when it receives the EAPoL Logoff packet from the server, this is not yet implemented.
2017-08-27 10:48:13 -05:00
Subv 2e9f544ecc Services/UDS: Store the received beacon frames until RecvBeaconBroadcastData is called, up to 15 beacons at the same time, removing any older beacon frames when the limit is exceeded. 2017-08-27 10:48:11 -05:00
Subv 54411bef4e Services/UDS: Add functions to generate 802.11 auth and assoc response frames. 2017-08-27 10:48:09 -05:00
wwylele c84e60b470 HID: use TouchDevice for touch pad 2017-08-24 13:56:43 +03:00
James Rowe bbfa9d0635 Merge pull request #2861 from wwylele/motion-refactor
Refactor MotionEmu into a InputDevice
2017-08-19 23:43:01 -06:00
wwylele 54c0c8adee HID: fix a comment and a warning 2017-08-20 08:37:48 +03:00
Yuri Kunde Schlesner 21204ba488 Merge pull request #2881 from MerryMage/dsp-firm-check
dsp_dsp: Remove size assertion in LoadComponent
2017-08-15 20:14:41 -07:00
MerryMage b67c2dc82c dsp_dsp: Remove size assertion in LoadComponent 2017-08-15 10:16:50 +01:00
Sebastian Valle d59f503729 Merge pull request #2843 from Subv/applet_slots
Services/APT: Use an array to hold data about the 4 possible concurrent applet types (Application, Library, HomeMenu, System)
2017-08-12 10:27:57 -05:00
wwylele 867eabd6b7 HID: use MotionDevice for Accelerometer and Gyroscope 2017-08-11 11:03:18 +03:00
Weiyi Wang aaf5161344 Merge pull request #2863 from wwylele/pad-state-zero
HID: zero unused PadState bits
2017-08-10 17:50:18 +03:00
wwylele 599de29ea3 HID: zero unused PadState bits 2017-08-10 17:01:03 +03:00
bunnei c2466a2f19 Merge pull request #2862 from j-selby/update-cryptopp
Update CryptoPP (byte ambiguity)
2017-08-09 16:18:43 -04:00
mailwl a6273dd56a Service/dlp: Update function tables according 3dbrew 2017-08-09 16:14:07 +03:00
James 1a44949ef7 Update cryptopp 2017-08-08 17:50:09 +10:00
Subv 177e8ce655 Services/APT: Use the AppletAttributes union directly when dealing with applet attrs. 2017-08-07 16:09:55 -05:00
Subv 73fba0de46 Services/APT: Use an array to hold data about the 4 possible concurrent applet types (Application, Library, HomeMenu, System).
This gives each applet type its own set of events as per the real NS module.
2017-08-07 14:53:58 -05:00
bunnei 5c631ec9c5 telemetry: Add field for RequiresSharedFont. 2017-08-03 20:10:37 -04:00
bunnei f15e5522dc Merge pull request #2840 from Subv/apt_parameter
Services/APT: Corrected the behavior of the Receive/Send/Glance/CancelParameter functions
2017-07-27 11:14:27 -04:00
Weiyi Wang 045d0b5bbd Merge pull request #2799 from yuriks/virtual-cached-range-flush
Add address conversion functions returning optional, Add function to flush virtual region from rasterizer cache
2017-07-22 10:15:52 +03:00
Subv e59ab7c1d6 Service/APT: Log Send/Cancel/Receive/GlanceParameter calls even if they return an error. 2017-07-21 15:03:06 -05:00
Subv 68596a7068 Services/APT: Return the proper error code when calling SendParameter with an outstanding parameter already in memory. 2017-07-21 14:59:26 -05:00
Subv a9bc417f59 Services/APT: Reset the APT parameter inside CancelParameter if the conditions are met. 2017-07-21 14:59:25 -05:00
Subv e403638d9b Services/APT: Properly clear the apt parameter after a successful ReceiveParameter call. 2017-07-21 14:59:22 -05:00
Subv 2dc720c355 Services/APT: Use the right error codes in ReceiveParameter and GlanceParameter when the parameter doesn't exist. 2017-07-21 14:59:21 -05:00
Subv 5682608df7 Services/APT: Use boost::optional for the APT parameter structure. 2017-07-21 14:59:20 -05:00
B3n30 7dbbd8a02e stubbed frd::UnscrambleLocalFriendCode (#2827) 2017-07-16 21:32:08 -05:00
Weiyi Wang e634b75754 Merge pull request #2784 from wwylele/font-archive
load shared font from system archive
2017-07-16 20:12:55 +03:00
mailwl 8582194a4c Service/boss:P: Add some functions to FunctionTable 2017-07-01 12:21:38 +03:00
Sebastian Valle fa53ccc74b Merge pull request #2778 from Subv/uds_more
Services/UDS: Stub SendTo to generate the unencrypted data frames with the right headers
2017-06-26 19:35:52 -05:00
Subv 2eb174713b UDS: Use the ToDS and FromDS fields to properly calculate the AAD used during encryption. 2017-06-26 12:24:14 -05:00
Subv 1f1739d366 UDS: Move the UDS keyslot used to generate the CCMP key to the AES::KeySlotID enum. 2017-06-26 12:24:13 -05:00
Subv 87168bfe8b UDS: Run clang-format. 2017-06-26 12:24:11 -05:00
Subv 9befb8c887 UDS: Added functions to encrypt and decrypt the data frames.
The responsibility of encryption and encapsulation into an 802.11 MAC frame will fall into the callers of GenerateDataPayload.
2017-06-26 12:24:09 -05:00
wwylele 9549eed0be apt: load shared font from system archive 2017-06-26 01:38:12 +03:00
wwylele 22994607cc apt/shared_font: don't relocate zero offset 2017-06-26 00:43:23 +03:00
Yuri Kunde Schlesner d553135748 Memory: Add function to flush a virtual range from the rasterizer cache
This is slightly more ergonomic to use, correctly handles virtual
regions which are disjoint in physical addressing space, and checks only
regions which can be cached by the rasterizer.
2017-06-21 22:57:12 -07:00
Yuri Kunde Schlesner 326e7c7020 Memory: Make PhysicalToVirtualAddress return a boost::optional
And fix a few places in the code to take advantage of that.
2017-06-21 22:55:17 -07:00
Yuri Kunde Schlesner b21dfbb295 Merge pull request #2790 from yuriks/remove-movefrom
Remove ResultVal::MoveFrom
2017-06-20 22:04:09 -07:00
Sebastian Valle 96dcccc80c Merge pull request #2779 from Subv/uds_more2
UDS: Added a hook for updating the connection status when a client connects to the network.
2017-06-21 02:29:00 +00:00
Yuri Kunde Schlesner 723dc644fa ResultVal: Remove MoveFrom()
Replace it with std::move(result_val).Unwrap(), or Foo().Unwrap() in
case you already have an rvalue.
2017-06-18 19:03:15 -07:00
Yuri Kunde Schlesner 0dfafdbe59 Kernel/IPC: Make HLERequestContext usable from outside kernel 2017-06-18 16:05:12 -07:00
Subv 812b404492 UDS: Clarify comment about the first 4 bytes of the SecureData header.
It is likely that these 4 bytes are actually a different header, part of some protocol that encapsulates the SecureData protocol.
2017-06-15 12:08:55 -05:00
Subv 61ce89a55a UDS: Return the correct error messages in SendTo when not connected to a network or trying to send to itself. 2017-06-15 12:08:54 -05:00