Commit graph

4043 commits

Author SHA1 Message Date
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
Sebastian Valle 9ae37da292
Kernel/Process: Fixed scheduling multiple processes in the SysCore using Dynarmic (#5193)
* Kernel/Process: Notify the CPUs that a new pagetable has been set every time the process they're executing changes.

Previously the page table would only be changed when the current CPU's page table was changed, this lead to stale JIT states and the PC going to 0 when context-switching a different core inside the ThreadManager::SwitchContext function because the JIT for a new pagetable is only constructed upon receiving the change notification.

* Kernel/Process: Use the relevant CPU's last process to determine when to switch its current process.

Previously it was checking the kernel's current_process variable, which gets overwritten every time a CPU runs its slice. The rescheduling happens after all CPUs have run their slice so the code was effectively only checking the last CPU's process.
2020-04-15 14:35:19 +02:00
Valentin Vanelslande 263e5be78e
Fix Luigi's Mansion can't remove amiibo bug (#5200)
* Fix Luigi's Mansion can't remove amiibo bug
2020-04-14 14:33:49 +02:00
Hamish Milne 3a651ac9fc Fix clang format 2020-04-13 18:08:15 +01:00
Hamish Milne d53e94db88 Show save/load errors to the user 2020-04-12 23:12:15 +01:00
Hamish Milne 915c426dc9 Merge remote-tracking branch 'upstream/master' into feature/savestates-2 2020-04-12 22:26:24 +01:00
Mat M f75cc8be64
Merge pull request #5184 from MerryMage/dyn-update-2020-04
Update dynarmic (Apr 2020)
2020-04-12 09:10:21 -04:00
Hamish Milne 828f88d20a Merge branch 'master' into feature/savestates-2 2020-04-12 11:24:06 +01:00
Hamish Milne 77c4b26e6c Attempt to improve save/load during frame advance 2020-04-11 22:25:57 +01:00
Hamish Milne 19872b599b Fix button state not persisting between loads 2020-04-11 20:47:14 +01:00
Hamish Milne 34af0d3452 Attempt to fix network bug 2020-04-11 20:33:38 +01:00
Hamish Milne 4be752dd98 Allow GDB debugging through loads 2020-04-11 19:47:31 +01:00
Hamish Milne e6b40486c5 Add a couple of useful SVC logs 2020-04-11 19:47:06 +01:00
Hamish Milne 3871d74bc2 Fix mic sharedmemory not being deallocated 2020-04-11 19:33:21 +01:00
Subv 0e88940df1 Warnings/Thread: Added missing case for the Dormant thread status in ResumeFromWait. 2020-04-11 12:24:09 -05:00
Hamish Milne e9ab8f82d4 Add disk archive serialization (fix crash in driver renegade etc.) 2020-04-11 11:52:11 +01:00
Hamish Milne a210e7e2bd Sync GPU state after loading (fix FE terrain bug) 2020-04-11 10:28:52 +01:00
Hamish Milne 7b3a8e9bf5 Fix clang format 2020-04-10 20:22:40 +01:00
Hamish Milne 7988978661 Fix VFP registers serialization (0 fps when loading etc.) 2020-04-10 19:36:38 +01:00