Commit graph

6057 commits

Author SHA1 Message Date
Weiyi Wang 3db8915356 ldr_ro: properly map CRS/CRO buffer 2018-11-11 12:39:05 -05:00
Weiyi Wang 617b388354 Kernel/Process: implement prvileged Map/Unmap
This is used by svcControlProcessMemory and maps memory as Locked/AliasCode pair.

Also fixed a bug where map didn't apply specified permissions to the alias memory
2018-11-11 12:39:05 -05:00
Ben f43524fff1
Merge pull request #4415 from wwylele/tls-state
Kernel: correct MemoryState for TLS
2018-11-11 17:53:18 +01:00
Weiyi Wang 3d73b8d694 Common/Bitfield: store value as unsigned type
Storing signed type causes the following behaviour: extractValue can do overflow/negative left shift. Now it only relies on two implementation-defined behaviours (which are almost always defined as we want): unsigned->signed conversion and signed right shift
2018-11-10 23:42:39 -05:00
Weiyi Wang 5179915fb4 filesys/ncch: prevent buffer overflow on calculating SHA256 2018-11-10 22:58:32 -05:00
Zach Hilman 31c394e9b5 qt: Add help option to open yuzu folder 2018-11-09 17:00:14 +01:00
Weiyi Wang d0edb81182 Memory: convert PAddr for N3DS FCRAM extension 2018-11-09 10:40:04 -05:00
Weiyi Wang 98ddea4ddd Kernel: correct MemoryState for TLS 2018-11-09 00:14:13 -05:00
Weiyi Wang 5325388e24 SVC: QueryMemory merges similar VMA 2018-11-08 20:42:21 -05:00
Weiyi Wang 2654a679b3 Memory: replace PhysicalToVirtualAddress with a more dedicated function
There is no external use of PhysicalToVirtualAddress any more, so it there is no need to have a generic function that handles all physical regions. Also, the previous APT change makes it possible that linear heap has some regions mapped to old and new VAddr regions at the same time, so we need to check both region and mark cached for the mapped one. RasterizerMarkRegionCached would skip the unmapped one in its loop
2018-11-08 00:19:57 -05:00
Weiyi Wang 8c65433ab5 Kernel, APT: SharedFont/SharedMemoryOnSharedDevice should always use old linear heap VAddr 2018-11-08 00:19:19 -05:00
Valentin Vanelslande 0f4a6e39c9
ldr_ro: change std::tie to structured binding 2018-11-07 13:38:52 -05:00
Weiyi Wang 1444d60109
Merge pull request #4400 from wwylele/core-timing-global
CoreTiming: wrap into class
2018-11-06 20:04:56 -05:00
Weiyi Wang 2067946f59
Kernel: reimplement memory management on physical FCRAM (#4392)
* Kernel: reimplement memory management on physical FCRAM

* Kernel/Process: Unmap does not care the source memory permission

What game usually does is after mapping the memory, they reprotect the source memory as no permission to avoid modification there

* Kernel/SharedMemory: zero initialize new-allocated memory

* Process/Thread: zero new TLS entry

* Kernel: fix a bug where code segments memory usage are accumulated twice

It is added to both misc and heap (done inside HeapAlloc), which results a doubled number reported by svcGetProcessInfo. While we are on it, we just merge the three number misc, heap and linear heap usage together, as there is no where they are distinguished.

Question: is TLS page also added to this number?

* Kernel/SharedMemory: add more object info on mapping error

* Process: lower log level; SharedMemory: store phys offset

* VMManager: add helper function to retrieve backing block list for a range
2018-11-06 15:00:47 -05:00
Weiyi Wang 9458e4d8ec CoreTiming: wrap into class 2018-11-04 10:26:38 -05:00
Weiyi Wang 2d9dfe5bce Kernel: thread manager still has to be destructed first 2018-11-04 09:29:28 -05:00
Weiyi Wang 57e1f47a52 Kernel: destruct thread/timer managers after processes (#4399)
Processes can keep some Thread/Timer object alive while the manager is already destructed, resulting use-after-free in Thread::Stop and Timer::dtor. To resolve this, the manager objects should be destructed after all related object destructed.
Fixes a bug where quiting citra causes crash while the game is using a Timer.
2018-11-04 10:24:37 +01:00
zhupengfei ab07d44193
citra_qt/configuration: fix language configuration issues 2018-11-03 09:34:01 +08:00
Weiyi Wang fc84091d88 Service, Kernel: move named port list to kernel 2018-11-01 12:56:40 -04:00
Weiyi Wang ece96807c4 Kernel: move memory_regions into Kernel instance 2018-11-01 12:56:40 -04:00
Weiyi Wang 263290d48c HLE: move SharedPage into Kernel
similar to config_mem, kernel is responsible for setting up this
2018-11-01 12:56:40 -04:00
Weiyi Wang 773ec47629 Kernel: make config_mem and MapSharedPages members of KernelSystem 2018-11-01 12:56:40 -04:00
Weiyi Wang 95790218f2 HLE: move config_mem to kernel
ConfigMem is initialized in kernel and only used by kernel. It is also likely how it works on real 3DS
2018-11-01 11:21:34 -04:00
Weiyi Wang a753b9c6cc
Merge pull request #4228 from NarcolepticK/lle-mapped-buffer
LLE Mapped Buffer: Add unmapping of write buffer, zero-size, and multiple page handling
2018-10-30 19:18:11 -04:00
Weiyi Wang 445538c2cf
Merge pull request #4371 from wwylele/kernel-global-3
Kernel: eliminate global state for threads and timers
2018-10-30 00:36:10 -04:00
Weiyi Wang 2183d0d6be core: use internal kernel pointer directly 2018-10-30 00:35:37 -04:00
Weiyi Wang bd4beb6558
Merge pull request #4386 from wwylele/codeset-class
Kernel/CodeSet: change struct to class
2018-10-30 00:30:50 -04:00
NarcolepticK c97146226a LLE Mapped Buffer: Addressed comments. 2018-10-29 18:35:34 -04:00
Weiyi Wang f63098ccdf Kernel/CodeSet: change struct to class
Fix a warning where class definition and forward declaration mismatch. CodeSet is a kernel object and have ctor/dtor/private members like others, so in convention it should be a class
2018-10-28 10:35:40 -04:00
Weiyi Wang 67888f92e5
Merge pull request #4348 from B3n30/native_firm_keys
Load keys from save mode native firm
2018-10-28 10:24:29 -04:00
bunnei 9d05fbbef4
Merge pull request #4369 from FearlessTobi/compat-new
compatdb: Use a seperate endpoint for testcase submission
2018-10-28 03:53:10 -04:00
bunnei 3219bdb30d
Merge pull request #4382 from FearlessTobi/reset-defaults
configure_general: Add an option to reset defaults
2018-10-28 03:52:10 -04:00
fearlessTobi 96ee82c464 configure_general: Add an option to reset defaults 2018-10-27 22:43:29 +02:00
fearlessTobi 236a7dba7e Move "Report compatibility" button to Emulation tab 2018-10-27 12:20:03 +02:00
fearlessTobi b7117bf050 compatdb: Use a seperate endpoint for testcase submission 2018-10-27 12:20:03 +02:00
Weiyi Wang 5b7d21c3cd FileSys/DelayGenerator: add missing #include and virtual dtor (#4363)
* FileSys/DelayGenerator: add missing #include and virtual dtor

Added the needed include so that it won't cause error if another file includes this without including the depended files

Deleting a virtual class via base type without virtual dtor is UB, which happens inFileBackend.

* FileSys/DelayGenerator: move function definition into cpp file/n/nTo avoid generating vtable in all units that includes the header file

* filesys/delay_generator: rearrange #include
2018-10-27 12:46:03 +08:00
Weiyi Wang fa46dbdf0b
Merge pull request #4376 from FearlessTobi/port-1571
Port yuzu-emu/yuzu#1571: "graphic_breakpoints: Correct translation of strings in BreakpointModel's data() function"
2018-10-26 22:40:55 -04:00
Weiyi Wang 724b458a83
Merge pull request #4373 from FearlessTobi/port-1553
Port yuzu-emu/yuzu#1553: "common: Remove memory_util.h/.cpp"
2018-10-26 22:38:18 -04:00
Weiyi Wang f274340001
Merge pull request #4374 from FearlessTobi/frontend-ports
Port various frontend cleanups from yuzu
2018-10-26 22:38:07 -04:00
Weiyi Wang 477cda1a7e
Merge pull request #4364 from wwylele/gl-error-tr
citra_qt: fix translation for opengl version error
2018-10-26 22:37:47 -04:00
Weiyi Wang 59cb0ec570
Merge pull request #4359 from FearlessTobi/port-webstuff
web_service: Port yuzu-emu/yuzu#1465 and Port yuzu-emu/yuzu#1473 (Many self-contained changes)
2018-10-26 22:34:51 -04:00
fearlessTobi d28233961b Put WebResult into a seperate file 2018-10-27 00:39:02 +02:00
fearlessTobi 494d86d083 graphic_breakpoints: Correct translation of strings in BreakpointModel's data() function
tr() will not function properly on static/global data like this, as the
object is only ever constructed once, so the strings won't translate if
the language is changed without restarting the program, which is
undesirable. Instead we can just turn the map into a plain old function
that maps the values to their equivalent strings. This is also lessens
the memory allocated, since it's only allocating memory for the strings
themselves, and not an encompassing map as well.
2018-10-27 00:33:31 +02:00
Lioncash 9f6c1b058a CMakeLists: Use PROJECT_SOURCE_DIR instead of CMAKE_SOURCE_DIR
This is more localized to what we want to enforce directory-wise with
the project. CMAKE_SOURCE_DIR indicates the root of the source tree, but
this would cause the wrong behavior if someone included yuzu as part of
a larger buildsystem (for whatever reason). Instead, we want to use the
directory where the "project(yuzu)" command was declared as the root
path reference.
2018-10-27 00:20:52 +02:00
fearlessTobi 446989aaaf common: Actually remove memory_util.cpp 2018-10-27 00:14:23 +02:00
Lioncash a74d97b15f configure_system: Default initialize member variables
These should be initialized to deterministic values so it's easier to
catch improper behavior, as it'll always be reproducable, instead of
performing uninitialized reads.
2018-10-27 00:02:27 +02:00
Lioncash 470cc66049 configure_system: Amend function casing 2018-10-27 00:00:43 +02:00
Lioncash 97cdf44ddd configure_system: Add missing override specifier on the destructor 2018-10-26 23:59:18 +02:00
Lioncash 452cfb46a9 configure_system: Make public slots private
These are only used within this class, so we can make them private to
keep their use contained. This also gets rid of the pre-Qt5 'slot'
identifier, since Qt 5's connection syntax doesn't require a function to
be declared a slot anymore.
2018-10-26 23:58:37 +02:00
Lioncash 027197cf1f bootmanager: Use QStringLiteral instead of std::string to represent the window title
This gets rid of an unnecessary type conversion. We can just use the
regular QStringLiteral to already format the string as the type
setWindowTitle accepts instead of converting from a std::string
instance.
2018-10-26 23:56:04 +02:00
Lioncash bf6dd78324 yuzu/configuration/config: Use a std::unique_ptr for qt_config instead of a raw pointer
Same behavior, less code.
2018-10-26 23:53:58 +02:00
Lioncash f4bd5c3559 yuzu/configuration/config: Reorganize member variable and function layout
Makes the class layout consistent with the others.
2018-10-26 23:52:25 +02:00
Lioncash 452ccf02a6 game_list: Make game list column headers translatable
These are user-facing strings, so they should be marked as translatable
2018-10-26 23:51:04 +02:00
Lioncash 0242d2b13a common: Remove memory_util.cpp/.h
Everything from here is completely unused and also written with the
notion of supporting 32-bit architecture variants in mind. Given the
Switch itself is on a 64-bit architecture, we won't be supporting 32-bit
architectures. If we need specific allocation functions in the future,
it's likely more worthwhile to new functions for that purpose.
2018-10-26 23:39:08 +02:00
Weiyi Wang e5b93741d3 kernel/timer: add TimerManager for timer system states 2018-10-26 16:07:45 -04:00
Weiyi Wang 20ae37ba4f kernel/Thread: move thread list into the manager 2018-10-26 16:07:45 -04:00
Weiyi Wang 7fc61920cc kernel/Thread: move thread wake up table and callback handle into the manager 2018-10-26 16:07:45 -04:00
Weiyi Wang 0478bc3dee Kernel/Thread: move thread queue, current thread, and scheduling related function into the manager
As we touched it, remove IPC::GetCommandBuffer
2018-10-26 16:07:11 -04:00
Weiyi Wang 876729ab52 kernel/thread: move next_thread_id into manager 2018-10-26 16:07:11 -04:00
Weiyi Wang 34f1fe088c kernel/thread: add ThreadManager 2018-10-26 16:07:11 -04:00
Weiyi Wang f3ee5feb02
Merge pull request #4358 from wwylele/kernel-global-2
kernel: Eliminate global state in process and handle_table
2018-10-26 15:51:36 -04:00
Weiyi Wang 8ad6cbfde2 kernel/thread: change owner_process parameter to reference
To enforce a valid process object
2018-10-26 09:37:46 -04:00
Weiyi Wang b4062abc11 cubeb_sink: ignore null-name device when selecting
We already ignore them on listing devices. We should do the same when selecting devices. This fix a crash when opening a specific device while there is a null device in the list
2018-10-26 09:17:44 -04:00
Weiyi Wang fa0e82b812
SeedDB: replace seek(tell, set) with seek(cur) (#4344) 2018-10-25 21:39:26 -04:00
Weiyi Wang e5c5d1ecce Kernel: change owner_process in Thread/SharedMemory to raw pointer
Otherwise circular ownership would form in Process->handle_table->thread->owner_process
2018-10-25 19:54:06 -04:00
Weiyi Wang 92b1a5c546 citra_qt: fix translation for opengl version error
variable in tr() won't trigger linguist to generate translation entry. Instead it needs a string literal
2018-10-25 14:30:46 -04:00
Pengfei Zhu c5b7018625
citra_qt: add seconds section to clock settings (#4347)
* citra_qt: add seconds section to clock settings

Simple fix to make the UI more usable.

* Use an ISO styled format string

Not actually tested locally
2018-10-25 21:29:43 +08:00
Tobias dec3fb2dcf nfc: Add Amiibo support (REOPENED) (#4337)
* Initial implementation

* Various fixes and new features

* Address some review comments

* Fixes

* Address more comments

* Use g_hle_lock

* Add more state checking, remove unneeded include

* Minor changes
2018-10-24 21:01:38 -04:00
Weiyi Wang 6742472133
Merge pull request #4235 from FearlessTobi/port-1259
Port various game_list changes from yuzu
2018-10-24 20:57:58 -04:00
Lioncash 6147bb622d CMakeLists: Use target_compile_definitions instead of add_definitions to define YUZU_ENABLE_COMPATIBILITY_REPORTING
Keeps the definition constrained to the citra_qt target and prevents
polluting anything else in the same directory (should that ever happen).
It also keeps it consistent with how the USE_DISCORD_PRESENCE definition
is introduced below it.
2018-10-23 16:16:11 +02:00
Weiyi Wang 8d32843d68 thread/kernel: remove unused callback_id
we use the thread id for the same purpose now
2018-10-23 10:06:32 -04:00
Lioncash 6fb6737642 core/CMakeLists: Make all web_service-related libraries private
Now that all external dependencies are hidden, we can remove
json-headers from the publically linked libraries, as the use of this
library is now completely hidden from external users of the web_service
library. We can also make the web_services library private as well,
considering it's not a requirement. If a library needs to link in
web_service, it should be done explicitly -- not via indirect linking.
2018-10-23 15:43:40 +02:00
Lioncash 8b98560ebb web_backend: Make Client use the PImpl idiom
Like with TelemetryJson, we can make the implementation details private
and avoid the need to expose httplib to external libraries that need to
use the Client class.
2018-10-23 15:42:22 +02:00
Lioncash 25038aeb0d telemetry_json: Use the PImpl idiom to avoid unnecessary dependency exposure
Users of the web_service library shouldn't need to care about an
external library like json.h. However, given it's exposed in our
interface, this requires that other libraries publicly link in the JSON
library. We can do better.

By using the PImpl idiom, we can hide this dependency in the cpp file
and remove the need to link that library in altogether.
2018-10-23 15:35:17 +02:00
Lioncash 131ce59800 telemetry_json: Add missing override specifier to the destructor of TelemetryJson 2018-10-23 15:33:41 +02:00
Lioncash 8747d93f6a telemetry_json: Take std::string parameters by value
Taking them by const reference isn't advisable here, because it means
the std::move calls were doing nothing and we were always copying the
std::string instances.
2018-10-23 15:33:34 +02:00
Lioncash c9013c481a telemetry_json: Remove unnecessary includes
Removes unused includes. Also rectifies a missing <chrono> include.
2018-10-23 15:33:18 +02:00
Lioncash 7142d3cf78 telemetry_session: Remove doxygen comment for a non-existent parameter
There's no "func" parameter, so this can just be removed.
2018-10-23 15:30:07 +02:00
Lioncash 61627c2042 telemetry_session: Add missing includes
Prevents potential compilation issues in the future by including missing
headers for certain functions and types.
2018-10-23 15:28:50 +02:00
Lioncash d5bb2a21aa telemetry_session: Remove unimplemented FinalizeAsyncJob prototype
This isn't implemented anywhere, so it can just be removed.
2018-10-23 15:27:05 +02:00
Weiyi Wang eb285c33fd kernel: make handle table per-process 2018-10-22 21:32:34 -04:00
Weiyi Wang fda2a5cf54 kernel/thread: use std::unordered_map for callback record 2018-10-22 21:32:34 -04:00
Weiyi Wang 5b45a3e1b5 Kernel/Timer: use unordered_map for callback recording 2018-10-22 21:32:34 -04:00
Weiyi Wang 8fb3d8ff38 kernel/process: move current process to kernel instance
Two functional change:
QueryProcessMemory uses the process passed from handle instead current_process
Thread::Stop() uses TLS from owner_process instead of current_process
2018-10-22 21:32:34 -04:00
Weiyi Wang d9342622b0 kennel/process: move process list to kernel instance 2018-10-22 21:32:34 -04:00
Weiyi Wang 4238754d8c kernel/process: move next_process_id to kernel instance 2018-10-22 09:30:48 -04:00
Lioncash 930abb4b5e svc: Correct vma_map boundary check within QueryProcessMemory
This should be using the process instance retrieved within the function,
and not g_current_process, otherwise this is potentially comparing
iterators from unrelated vma_map instances (which is undefined
behavior).
2018-10-21 22:00:12 -04:00
Weiyi Wang 57ce5079bc
Merge pull request #4336 from wwylele/file-util-mingw
Only redefine some 64-bit file operation for MSVC
2018-10-21 20:34:48 -04:00
Weiyi Wang 6f1759c5bd
Merge pull request #4341 from wwylele/kernel-global
Kernel: make a kernel instance and remove object ID counter from global state
2018-10-21 18:53:36 -04:00
Zak Kurka 92f8b71137 Make ApplyIPS static and private 2018-10-21 10:42:23 -05:00
Zak Kurka 05c1816504 Stay in bounds 2018-10-21 07:48:54 -05:00
Zak Kurka 1c62bc06cf Add rle record support 2018-10-21 07:48:29 -05:00
Zak Kurka d8284dfacc Log invalid IPS attempt 2018-10-21 07:47:27 -05:00
Zak Kurka d0b54e9939 Check for EOF 2018-10-20 23:25:16 -05:00
Zak Kurka 2778801dc5 Updated based on review 2018-10-20 19:45:16 -05:00
Zak Kurka 2a5b56bb1d Be more intentional with check 2018-10-20 18:17:54 -05:00
Zak Kurka 261dc33507 Merge branch 'master' of github.com:citra-emu/citra into ips-patches 2018-10-20 18:11:38 -05:00
Zak Kurka bf50bb06f1 Minor style changes and use memcpy 2018-10-20 18:10:32 -05:00
Weiyi Wang 11729eafe1
Merge pull request #4315 from FearlessTobi/port-1332
WebService: Backport review comments from yuzu-emu/yuzu#1332
2018-10-20 18:05:06 -04:00
Zak Kurka 2496ecbaf6 Added IPS patching 2018-10-20 13:09:05 -05:00