Commit Graph

41516 Commits

Author SHA1 Message Date
Dentomologist ecf4f1b1f9 NetKDRequestDevice: Fix nullptr dereference crash
Keep a shared_ptr to NetKDTimeDevice inside NetKDRequestDevice.

This allows the KDDownload task to finish its work without potentially
trying to dereference nullptr, which can potentially come from either
GetIOS() or GetDeviceByName() if EmulationKernel's destructor has
started running.
2023-12-24 16:46:08 -08:00
Dentomologist dd1f5f9726 NetKDRequestDevice: Fix use-after-free crash
Explicitly shut down work queues in NetKDRequestDevice's destructor to
prevent their threads from accessing members after they've been freed.

This crash would occur sporadically if NetKDRequestDevice's periodic
download or mail checks happened to overlap with emulation shutdown in
the wrong way.

An example sequence of events that could cause the crash:
* m_scheduler_timer_thread queues a periodic Download event in
  m_scheduler_work_queue, then waits for m_shutdown_event.
* A request to stop emulation results in s_ios being reset by the CPU
  thread. This triggers NetKDRequestDevice's destructor which sets
  m_shutdown_event and joins m_scheduler_timer_thread.
* m_scheduler_timer_thread wakes from m_shutdown_event and returns from
  its thread function, ending the thread.
* The CPU thread resumes execution at the end of NetKDRequestDevice's
  destructor and begins destroying NetKDRequestDevice's members in
  reverse declaration order.
* m_http is declared after m_scheduler_work_queue and is therefore
  destroyed earlier.
* m_scheduler_work_queue's destructor calls its Shutdown function, which
  by default finishes the work items in the queue.
* The queued Download event calls KDDownload which calls m_http.Get()
  which calls Fetch() which passes garbage data from the freed m_curl
  into curl_easy_setopt().
* Curl promptly crashes.

Shutting down the work queues manually in the destructor prevents the
above because m_http and the other members don't get freed until after
the queue threads finish.
2023-12-24 15:04:35 -08:00
BlakDulz 45d3c41d68 Make DocumentProvider Support Thumbnail
This  will make DocumentUI or the built-in Android System Internal Files Manager app showing Thumbnail of Image file instead of image type icon.
2023-12-24 15:34:10 +07:00
Sepalani e9fa335fbe Socket: Fix a nullptr dereference when operations are pending 2023-12-24 09:23:02 +04:00
BlakDulz d667fca8d3 Implement Refresh on DocumentProvider
"When interacting with DocumentUI or the built-in Android System Internal Files Manager app and performing Create, Rename, and Delete operations, DocumentsUI will not automatically refresh the changes.
Previously, users had to manually pull down from the top to refresh the changes. This commit aims to fix this issue by automatically notifying the system that changes have occurred and triggering a requery."
2023-12-23 23:26:54 +07:00
Tilka 57327be7f3
Merge pull request #12460 from lioncash/pix
VideoCommon/PixelEngine: Passthrough system instance in constructor
2023-12-22 20:07:06 +00:00
Lioncache a23cf2121d VideoCommon/PixelEngine: Generify lock guards
We don't need to specify the type of the mutex being passed in.
2023-12-22 14:19:29 -05:00
Lioncache 0505f057ca VideoCommon/PixelEngine: Remove global system accessor in UpdateInterrupts()
Now that the system instance is passed through, this is no longer necessary.
2023-12-22 14:19:29 -05:00
Lioncache e539dbba4c VideoCommon/PixelEngine: Passthrough system instance in constructor
Simplifies the interface in terms of usage
2023-12-22 14:19:26 -05:00
Mai b1438c224f
Merge pull request #12439 from lioncash/sprintf
Core: Use fmt over sprintf in trivial cases
2023-12-21 17:17:21 -05:00
Mai 6c2da5229e
Merge pull request #12458 from JosJuice/jitarm64-logic-i2r-not-nothing
JitArm64: Fix the "do nothing" cases of ANDI2R and friends
2023-12-21 17:13:20 -05:00
JosJuice d8c78f2a92 JitArm64: Fix the "do nothing" cases of ANDI2R and friends
So somehow I forgot that AArch64 uses three-operand encoding...

Fixes a regression from 6303416201 which manifested in various ways,
such as incorrect rendering of the Wind Waker title screen.
2023-12-21 20:51:32 +01:00
Tilka 8d4575cfd8
Merge pull request #12454 from lioncash/proc
VideoCommon/CommandProcessor: Pass system instance through constructor
2023-12-21 17:46:28 +00:00
Mai f7b655e5da
Merge pull request #12456 from iwubcode/android_reduce_pixel_samplers_to_8
VideoCommon: revert max pixel samplers back to 8 for Android
2023-12-21 10:35:48 -05:00
iwubcode 79648e1c24 VideoCommon: revert max pixel shader samplers back to 8 for Android devices.
It was reported that some games (Zelda Wind Waker and Zelda Twilight Princess but others may also exhibit the issue) have graphical issues with the max pixel samplers set to 16 on some Android devices (ex: Pixel6); since this was increased for a performance heavy feature (custom shaders) just disable it for now.  In the future, this could be handled more elegantly
2023-12-21 00:36:44 -06:00
Lioncache f97b2d472a VideoCommon/CommandProcessor: Pass system instance through constructor
Makes the use of the interface a little less noisy, especially given
how much of the interface depends on an instance being present.
2023-12-20 09:02:53 -05:00
Tilka 70b7a59456
Merge pull request #12451 from lioncash/fifo
VideoCommon/Fifo: Pass system instance through FifoManager constructor
2023-12-20 12:45:38 +00:00
Tilka 01340d7f8d
Merge pull request #12442 from lioncash/hle
Core/HLE/HLE: Remove global system accessors
2023-12-20 12:41:09 +00:00
iwubcode 3c00689bd6 docs: update CustomPipeline graphics mod docs based on changes in syntax to support new functionality 2023-12-19 21:52:30 -06:00
iwubcode fcfcf14e07 VideoCommon: when loading a texture asset, set sampler to linear sampler if the texture type is not defined and the 2d texture is assumed 2023-12-19 21:51:42 -06:00
iwubcode ae758f489a VideoCommon: update custom pipeline action to support a variety of texture samplers (2D, 2D array, and cube maps) 2023-12-19 21:51:42 -06:00
Tillmann Karras ddb4566a41 VideoCommon: apply "force 24-bit color" to EFB-to-VRAM copies as well 2023-12-20 02:25:07 +00:00
Admiral H. Curtiss acd76918d7
Merge pull request #12448 from lioncash/es
Core/IOS/ES: Remove global system accessor in InitializeEmulationState()
2023-12-19 04:26:08 +01:00
Lioncache b0d244b772 VideoCommon/Fifo: Pass system instance through FifoManager constructor
Given how many member functions make use of the system instance,
it's likely just better to pass the system instance in on construction.

Makes the interface a little less noisy to use.
2023-12-18 22:03:25 -05:00
OatmealDome 186b2f4e92
Merge pull request #12450 from lioncash/cheats
CheatSearch: Get rid of global system accessors
2023-12-18 20:10:48 -05:00
OatmealDome 475c142e22
Merge pull request #12449 from lioncash/uicommon
UICommon: Remove global system accessor in TriggerSTMPowerEvent()
2023-12-18 20:10:23 -05:00
Lioncache dec53848f5 CheatSearch: Get rid of global system accessors
We can retrieve the system via the CPUThreadGuard instances.
2023-12-18 19:24:35 -05:00
Lioncache 00f494307f UICommon: Remove global system accessor in TriggerSTMPowerEvent()
This can be passed through via the IOS instance.
2023-12-18 19:17:16 -05:00
Lioncache c0b7e9cd94 Core/HLE/HLE: Remove global system accessor from ExecuteFromJIT()
We can just pass in our system instance via the ABI function helpers.
2023-12-18 19:11:52 -05:00
Lioncache f4277a901a Core/HLE/HLE: Remove global system accessors
We can get rid of the global system accessors by requiring passing in
relevant state that the function needs and making callsites do the work.

This *does* add a global accessor to the PPCAnalyzer, however, this already
has global accessors present elsewhere within its code, so they can be removed
all at once in a follow up change.
2023-12-18 19:11:49 -05:00
Lioncache f1b18d8ae3 Core/IOS/ES: Remove global system accessor in InitializeEmulationState()
We can pass the core timing instance into the function.
2023-12-18 19:06:45 -05:00
Admiral H. Curtiss 251c7a1030
Merge pull request #12445 from lioncash/gecko
Core/GeckoCode: Remove global system accessors
2023-12-18 23:54:22 +01:00
Admiral H. Curtiss 57b4379364
Merge pull request #12441 from lioncash/ios
Core/IOS/IOS: Remove global system accessors
2023-12-18 23:30:38 +01:00
Admiral H. Curtiss 7f01c1ed5b
Merge pull request #12446 from lioncash/patch
Core/PatchEngine: Get rid of global system accessors
2023-12-18 23:24:51 +01:00
Admiral H. Curtiss ccedd45c11
Merge pull request #12447 from lioncash/ppc
Core/Debugger/PPCDebugInterface: Remove global system accessor
2023-12-18 23:23:13 +01:00
Lioncache ca5695aef2 Core/Debugger/PPCDebugInterface: Remove global system accessor
We can use the CPUThreadGuard instance to get the active system instance.
2023-12-18 16:57:50 -05:00
Lioncache 3802c7bf11 Core/PatchEngine: Get rid of global system accessors
We can pass the system instance into ApplyFramePatches() instead,
especially considering the patch engine callback already has it
available.
2023-12-18 16:48:25 -05:00
Lioncache cea58759d9 Core/GeckoCode: unsigned int -> u32
Same thing for all intents and purposes, less to read.
2023-12-18 16:39:04 -05:00
Lioncache bb866248cf Core/GeckoCode: Avoid signed conversion in RunCodeHandler()
i is being used alongside unsigned types, so it should be unsigned as well.
2023-12-18 16:38:41 -05:00
Lioncache 1ceaa8c52a Core/GeckoCode: Remove global system accessor
We can use the CPUThreadGuard instance to retrieve the system instance instead.
2023-12-18 16:35:52 -05:00
Tilka 0cab6583a9
Merge pull request #12444 from lioncash/map
Core/Debugger_SymbolMap: Minor interface cleanup
2023-12-18 21:07:32 +00:00
Lioncache 472c65ed35 Core/Debugger_SymbolMap: Make GetCallstack() less verbose
This also allows the constructed CallstackEntry instances to be moved into
the output vector, rather than being copied.
2023-12-18 15:46:32 -05:00
Lioncache 75ec350dc4 Core/Debugger_SymbolMap: Remove redundant system parameters from interface
The CPU thread guard already allows access to the system instance. We can
remove the system parameter to reduce rendundancy here.
2023-12-18 15:46:22 -05:00
Lioncache 514b3e6f55 Core/Debugger_SymbolMap: Remove AddAutoBreakpoints()
This is wholly unused in current code.
2023-12-18 15:24:58 -05:00
Tilka c188dc2788
Merge pull request #12430 from Tilka/cnk_c4
GameSettings: fix C4 texture tiling in Crash Nitro Kart
2023-12-18 20:11:24 +00:00
Filoppi e456bef163 Input: Improve Controller Interface devices threading
This specific issue was already addressed by https://github.com/dolphin-emu/dolphin/pull/11635
though I felt like there was something more we could do, and wasn't too happy with the
likelihood of devices update calls being skipped (due to `m_devices_population_mutex` being locked).
2023-12-18 21:45:22 +02:00
Lioncache 04300114f7 Core/HLE/HLE_OS: Mark helpers as static where applicable
Previously, these were given external linkage when they're only used within
this translation unit.
2023-12-18 13:44:55 -05:00
Lioncache c4df659e21 HLE_OS: Get rid of global system accessors
Thread guards provide access to the current active system instance.
2023-12-18 13:39:53 -05:00
Lioncache c3c39de212 HLE_Misc: Get rid of global system accessors
Thread guards provide access to the current active system instance.
2023-12-18 13:33:07 -05:00
Tilka e498759d14
Merge pull request #12440 from lioncash/memcard
Core/EXI/EXI_DeviceMemoryCard: Remove global system accessor
2023-12-18 18:11:02 +00:00