Commit graph

4061 commits

Author SHA1 Message Date
Pengfei Zhu
41bff0e3b7
Merge pull request #5316 from lioncash/init
core: Resolve -Wreorder warnings
2020-05-02 15:42:31 +08:00
Lioncash
563a540dfd core: Resolve -Wreorder warnings
Ensures the initialization order matches the actual order that the class
member variables will be initialized in.
2020-05-01 23:32:46 -04:00
Lioncash
a32ad7f1f2 soc_u: Prevent undefined behavior with CTRPollFD
This class is memcpy-ed and memcpy has the requirement that data passed
to it must be trivially copyable, otherwise the behavior is undefined.

This is trivial to resolve as BitField was made trivially copyable a
while ago, so this explicit copy assignment operator isn't necessary.
2020-05-01 22:30:10 -04:00
Pengfei Zhu
70a43be714
Merge pull request #5306 from lioncash/view2
file-sys: Make use of std::string_view where applicable
2020-05-02 08:07:10 +08:00
Pengfei Zhu
8e7abecf7e
Merge pull request #5307 from lioncash/guard
file_sys/seed_db: Add missing include guard
2020-05-02 08:04:58 +08:00
Pengfei Zhu
5a008a74fa
Merge pull request #5304 from lioncash/layered
layered_fs: Mark functions as static where applicable
2020-05-02 08:02:35 +08:00
Pengfei Zhu
6907568034
Merge pull request #5309 from lioncash/dtor
applets: Make destructors virtual where applicable
2020-05-02 08:02:14 +08:00
Pengfei Zhu
59984df603
Merge pull request #5308 from lioncash/rsa
core/hw/rsa: Minor cleanup
2020-05-02 08:01:58 +08:00
Lioncash
89eeb64854 applets/swkbd: Make destructor virtual
Prevents undefined behavior when destroying a derived class through a
base class pointer.
2020-05-01 10:44:31 -04:00
Lioncash
aeb6a037ed applets/mii_selector: Make destructor virtual
Prevents undefined behavior when destroying derived classes through a
base class pointer.
2020-05-01 10:42:57 -04:00
Lioncash
3ab0701192 core/hw/rsa: Make GetSignature() a const member function
This doesn't directly modify instance state, so it can be made const.
2020-05-01 10:17:43 -04:00
Lioncash
c55e81b946 core/hw/rsa: Make operator bool explicit
Prevents error-prone implicit conversions to bool from occurring.
2020-05-01 10:14:50 -04:00
Lioncash
75bac1e514 core/hw/rsa: Take std::vector instances by value
Allows us to std::move them and allow calling code to eliminate copies
from occurring entirely.
2020-05-01 10:14:07 -04:00
Lioncash
98385b75d6 file_sys/seed_db: Add missing include guard
Prevents any potential inclusion errors from occurring.
2020-05-01 09:59:58 -04:00
Lioncash
10a32c94b6 title_metadata: Take std::vector by const reference in Load()
This isn't modified in the implementation, so this can be a const
reference to eliminate an unnecessary heap reallocation.
2020-05-01 09:53:44 -04:00
Lioncash
147073a5a0 file-sys: Make use of std::string_view where applicable
Same behavior, but makes the interface more flexible and allows
non-std::string instances to be used with it.
2020-05-01 09:49:36 -04:00
Lioncash
37a6ea72e5 layered_fs: Mark functions as static where applicable
Makes them internally linked and prevents potential
-Wmissing-declaration warnings.
2020-05-01 09:35:59 -04:00
Lioncash
9cff314abb service/ir: Remove erroneous forward declaration
This can be removed as it's not used. Even if it were however, it would
be an incorrect forward declaration, as ServiceManager exists within the
Service::SM namespace, not the top-level SM namespace.
2020-05-01 08:54:27 -04:00
FearlessTobi
7f8151b9b9 savedata_archive: Make GetFreeBytes return a more accurate value
Previously, we were returning a value that was way too big, causing an integer overflow in Fractured Souls.
According to wwylele, the biggest oberserved save size for 3DS is 1MB, so this new value should leave plenty of room, even if games use a bigger size.
2020-04-29 05:42:40 +02:00
Mat M
98fe5f82c5
memory: Make getter functions const qualified where applicable (#5251)
Many of these functions are capable of being used within const contexts,
so we can apply the const qualifier in some cases and add const based
overloads for others, which makes the interface a little bit more
flexible and const-correct.
2020-04-28 14:43:52 -05:00
Mat M
96832a2c82
core/memory: Make use of std::move in Entry::operator= (#5233)
* core/memory: Amend unusual return value of operator=

operator= usually returns a reference to this. Given there's no comment
explaining why void was used, this can be assumed to be an oversight.

* core/memory: Make use of std::move in Entry::operator=

Same behavior, minus the need for an atomic reference count increment
and decrement (since MemoryRef contains a std::shared_ptr).
2020-04-28 14:39:02 -05:00
badda71
f18aef0579
add program counter in unmapped memory access log messages (#5149)
* add program counter in unmapped memory access log messages
2020-04-27 16:31:34 +02:00
Ben
39463f1f6d
ArmInterface: return ref instead of copy for GetTimer (#5227)
* ArmInterface: return ref instead of copy for GetTimer

* ArmInterface: add const ref GetTimer

* ArmInterface: return raw pointer instead of shared_ptr in GetTimer

* remove more unnecessary shared_ptr usage

* Fix save states

* fix unit tests
2020-04-22 07:44:58 +02:00
Mat M
b82d4315fe
custom_tex_cache: Remove reliance on the global system instance (#5252)
Removes direct usages of Core::System::GetInstance() and instead passes
the direct necessities through the interface.
2020-04-20 21:50:16 -05:00
Sebastian Valle
3597921ec5
Merge pull request #5235 from lioncash/move
ipc_helpers: Make PushStaticBuffer take std::vector by value
2020-04-19 21:51:52 -05:00
Ben
0f72dd6d85
Merge pull request #5250 from lioncash/build
core/memory: Fix #5246
2020-04-19 19:39:32 +02:00
Ben
1856752b61
Merge pull request #5203 from Subv/apt_title_allowed
Services/APT: Implemented the IsTitleAllowed function.
2020-04-19 16:50:47 +02:00
Ben
182aa1e39d
Merge pull request #5238 from lioncash/return
kernel/shared_page: Silence missing return warning in GetInitTime()
2020-04-19 11:31:45 +02:00
Mat M
8014c67faa
service: Resolve trivially avoidable copies (#5237)
* am/am: Avoid redundant copy in GetProgramInfoFromCia()

We can just use a reference to the title metadata. Avoids copying
several data entries and std::vector instances that don't need to be
copied.

* hle/service: Avoid redundant copying of std::string

GetUserPath() returns the path as a reference, so we can make use of
said reference to avoid making copies.
2020-04-19 09:24:37 +02:00
Mat M
e54b640e0b
nwm/nwm_uds: Avoid copying all elements in channel_data map where applicable (#5236)
By using a reference here, we avoid copying every single element in the
map, each of which contains a std::share_ptr and std::deque containing
std::vectors.
2020-04-19 07:57:57 +02:00
Lioncash
99eedced4a core/memory: Fix #5246
We can simplify the overload sent to be less confusing (and
error-prone), while also unbreaking 32-bit builds.
2020-04-19 01:56:03 -04:00
Lioncash
f7ad004fb0 kernel/shared_page: Silence missing return warning in GetInitTime()
We can use UNREACHABLE_MSG to indicate that this path isn't intended to
be reached, as it would indicate a wrong enum value.
2020-04-18 19:48:54 -04:00
Lioncash
7eabcdf1c3 apt/applet_manager: std::move parameter in GlanceParameter()
Same behavior, minus a redundant copy.
2020-04-18 19:22:03 -04:00
Lioncash
a6e37b48e9 ipc_helpers: Make PushStaticBuffer take std::vector by value
Allows interfaces to move the vector into the calls, avoiding any
reallocations.

Many existing call sites already std::move into the parameter, expecting
a move to occur. Only a few remain where this wasn't already
being done, which we can convert over.
2020-04-18 19:17:11 -04:00
Lioncash
8b22c80ba2 core/memory: Resolve sign conversion in serialize()
auto i = 0 deduces to an int, which was being compared with a size_t
within the loop condition.
2020-04-18 18:50:40 -04:00
Hamish Milne
397bd1bb73
Fix MIC_U serialization and timing (#5223)
* Fix MIC_U serialization and timing

* Better sample rate conversion

* Actually should be every 15 samples

* Reduce rounding errors
2020-04-18 20:52:56 +02:00
Sebastian Valle
75c9784239
Services/APT: Implemented the GetCaptureInfo function. (#5194)
This one is similar to the ReceiveCaptureBufferInfo function except it doesn't clear the capture buffer, according to 3dbrew.

This function is used by the Home Menu
2020-04-18 20:48:09 +02:00
Subv
07f49e588e Services/APT: Implemented the IsTitleAllowed function.
The Home Menu uses this to determine whether it is allowed to launch an app (call StartApplication)

This is a no-op for us, we allow any and all titles to be launched. The official APT module holds a list of some forbidden titles like some versions of IronFall and Flipnote Studio 3D.
2020-04-18 00:26:08 -05:00
Pengfei Zhu
8967b403b9
Merge pull request #5196 from Subv/apt_sys_menu_arg
Services/APT: Implemented the Store/LoadSysMenuArg functions.
2020-04-18 13:24:10 +08:00
Pengfei Zhu
47829ee095
Merge pull request #5213 from Subv/fs_resource
Services/FS: Stubbed GetSdmcArchiveResource and GetNandArchiveResource.
2020-04-18 13:22:21 +08:00
Ben
c605bb42db
Merge pull request #4908 from hamish-milne/feature/savestates-2
Save states
2020-04-17 21:52:51 +02:00
Hamish Milne
f5b23eff4b Correctly register AddressArbiter as a type of WakeupCallback 2020-04-17 14:13:22 +01:00
Hamish Milne
026a63bcf7
Merge pull request #5130 from B3n30/warn_if_cia_contend_is_encrypted
Show an error if CIA contend is encrypted
2020-04-17 00:09:36 +01:00
Hamish Milne
ab998b04c8
Merge pull request #5108 from B3n30/load_aes_key_X0x25_from_nativeFirm
Load NCCHSecure2 keyX from native firm
2020-04-17 00:07:15 +01:00
Hamish Milne
7af4b1a18e Merge branch 'master' into feature/savestates-2 2020-04-17 00:01:43 +01:00
Hamish Milne
9afd58cec2
Merge pull request #5185 from MerryMage/fix-gdbstub
gdbstub: Fix some gdbstub jankiness
2020-04-16 23:52:00 +01:00
Hamish Milne
d6c84227d8 Fixed NWM not responding 2020-04-16 20:44:25 +01:00
Hamish Milne
9cd669db84 Merge branch 'master' into feature/savestates-2 2020-04-16 19:03:49 +01:00
Subv
0d8c3ee1d3 Services/APT: Implemented the Store/LoadSysMenuArg functions.
They are called by the Home Menu during initialization.

These functions will not see much use until we actually implement application jumping and system rebooting. For now we just need them to prevent some unmapped reads in the Home Menu due to the static buffers not being properly set up.
2020-04-15 22:32:11 -05:00
Subv
783e7af5b2 Services/FS: Stubbed GetSdmcArchiveResource and GetNandArchiveResource.
Also rewritten how GetArchiveResource works so that they all use the same interface.
We should decide what to do with these at some point.

Related to #3131 and #3110
2020-04-15 16:52:55 -05:00