aboutsummaryrefslogtreecommitdiff
path: root/src/core/core.cpp
Commit message (Collapse)AuthorAgeFilesLines
* global: Use std::optional instead of boost::optional (#1578)Frederic L2018-10-301-1/+1
| | | | | | | | | | | | | | | | * get rid of boost::optional * Remove optional references * Use std::reference_wrapper for optional references * Fix clang format * Fix clang format part 2 * Adressed feedback * Fix clang format and MacOS build
* core: Add missing const variants of getters for the System classLioncash2018-10-281-2/+26
| | | | | | Many of the Current<Thing> getters (as well as a few others) were missing const qualified variants, which makes it a pain to retrieve certain things from const qualified references to System.
* core: Remove unnecessary assert in ArmInterface()Lioncash2018-10-181-2/+1
| | | | | CpuCore already does this sort of checking, so we can just call that instead of duplicating the assertions.
* core_cpu: Make Cpu scheduler instances unique_ptrs instead of shared_ptrsLioncash2018-10-151-4/+12
|
* core: Make the live Cpu instances unique_ptrs instead of shared_ptrsLioncash2018-10-151-9/+9
| | | | | | | | There's no need for shared ownership here, as the only owning class instance of those Cpu instances is the System class itself. We can also make the thread_to_cpu map use regular pointers instead of shared_ptrs, given that the Cpu instances will always outlive the cases where they're used with that map.
* core: Make the exclusive monitor a unique_ptr instead of a shared_ptrLioncash2018-10-151-2/+3
| | | | | | Like the barrier, this is owned entirely by the System and will always outlive the encompassing state, so shared ownership semantics aren't necessary here.
* core: Make CPUBarrier a unique_ptr instead of a shared_ptrLioncash2018-10-151-3/+3
| | | | | | This will always outlive the Cpu instances, since it's destroyed after we destroy the Cpu instances on shutdown, so there's no need for shared ownership semantics here.
* filesystem: Make CreateFactories() and InstallInterface() take a ↵Lioncash2018-10-131-1/+1
| | | | | | | | | VfsFilesystem instance by reference Neither of these functions alter the ownership of the provided pointer, so we can simply make the parameters a reference rather than a direct shared pointer alias. This way we also disallow passing incorrect memory values like nullptr.
* kernel/thread: Use a regular pointer for the owner/current processLioncash2018-10-101-3/+4
| | | | | | | | | | | There's no real need to use a shared pointer in these cases, and only makes object management more fragile in terms of how easy it would be to introduce cycles. Instead, just do the simple thing of using a regular pointer. Much of this is just a hold-over from citra anyways. It also doesn't make sense from a behavioral point of view for a process' thread to prolong the lifetime of the process itself (the process is supposed to own the thread, not the other way around).
* loader: Make the Load() function take a process as a regular reference, not ↵Lioncash2018-09-291-1/+1
| | | | | | | | | | a SharedPtr A process should never require being reference counted in this situation. If the handle to a process is freed before this function is called, it's definitely a bug with our lifetime management, so we can put the requirement in place for the API that the process must be a valid instance.
* vfs_concat/vfs_layered: Remove friend declarations from ConcatenatedVfsFileLioncash2018-09-251-1/+1
| | | | | | Given these are only added to the class to allow those functions to access the private constructor, it's a better approach to just make them static functions in the interface, to make the dependency explicit.
* Port #4182 from Citra: "Prefix all size_t with std::"fearlessTobi2018-09-151-7/+7
|
* core: Migrate current_process pointer to the kernelLioncash2018-09-061-4/+7
| | | | | | | | | | Given we now have the kernel as a class, it doesn't make sense to keep the current process pointer within the System class, as processes are related to the kernel. This also gets rid of a subtle case where memory wouldn't be freed on core shutdown, as the current_process pointer would never be reset, causing the pointed to contents to continue to live.
* core/core: Remove unnecessary sm/controller includeLioncash2018-09-061-1/+0
| | | | | | | | | | The only reason this include was necessary, was because the constructor wasn't defaulted in the cpp file and the compiler would inline it wherever it was used. However, given Controller is forward declared, all those inlined constructors would see an incomplete type, causing a compilation failure. So, we just place the constructor in the cpp file, where it can see the complete type definition, allowing us to remove this include.
* core: Use a raw pointer in GetGPUDebugContext.Markus Wick2018-09-041-2/+2
| | | | This helper is called very often. The memory ownership shall not be transfered, so just return the raw pointer.
* vfs_real: Forward declare IOFileLioncash2018-09-021-2/+3
| | | | | | Eliminates the need to rebuild some source files if the file_util header ever changes. This also uncovered some indirect inclusions, which have also been fixed.
* core/core: Replace includes with forward declarations where applicableLioncash2018-08-311-4/+15
| | | | | | | | | | | The follow-up to 88597535d629ea9a265f8bf0f00a9ce4dd5dc218, which replaces most of the includes in the core header with forward declarations. This makes it so that if any of the headers the core header was previously including change, then no one will need to rebuild the bulk of the core, due to core.h being quite a prevalent inclusion. This should make turnaround for changes much faster for developers.
* core: Make the main System class use the PImpl idiomLioncash2018-08-311-174/+341
| | | | | | | | | | | | | core.h is kind of a massive header in terms what it includes within itself. It includes VFS utilities, kernel headers, file_sys header, ARM-related headers, etc. This means that changing anything in the headers included by core.h essentially requires you to rebuild almost all of core. Instead, we can modify the System class to use the PImpl idiom, which allows us to move all of those headers to the cpp file and forward declare the bulk of the types that would otherwise be included, reducing compile times. This change specifically only performs the PImpl portion.
* kernel: Eliminate kernel global stateLioncash2018-08-281-4/+12
| | | | | | | | | | | | | | | | | | | | | | As means to pave the way for getting rid of global state within core, This eliminates kernel global state by removing all globals. Instead this introduces a KernelCore class which acts as a kernel instance. This instance lives in the System class, which keeps its lifetime contained to the lifetime of the System class. This also forces the kernel types to actually interact with the main kernel instance itself instead of having transient kernel state placed all over several translation units, keeping everything together. It also has a nice consequence of making dependencies much more explicit. This also makes our initialization a tad bit more correct. Previously we were creating a kernel process before the actual kernel was initialized, which doesn't really make much sense. The KernelCore class itself follows the PImpl idiom, which allows keeping all the implementation details sealed away from everything else, which forces the use of the exposed API and allows us to avoid any unnecessary inclusions within the main kernel header.
* core: Remove always true conditionals in Load()Lioncash2018-08-241-7/+4
| | | | | These conditions are always true, since the outer conditional already checks for these conditions.
* qt: Add 'Install to NAND' option to menuZach Hilman2018-08-111-0/+1
| | | | Prompts for title type on NCA files.
* loader: Join 0* files in directory if filename is 00Zach Hilman2018-08-111-1/+33
| | | | i.e. Load the concatenated 00+01 if 01 exists as well. Needed for split NAND NCAs.
* core: Namespace EmuWindowLioncash2018-08-111-2/+2
| | | | Gets the class out of the global namespace.
* loader: Add more descriptive errorsZach Hilman2018-08-091-22/+4
| | | Full list of new errors and descriptions in core/loader/loader.h
* core: Port core to VfsFilesystem for file accessZach Hilman2018-08-081-2/+6
|
* GDBStub works with both Unicorn and Dynarmic now (#941)Hedges2018-08-061-1/+4
| | | | | | * GDBStub works with both Unicorn and Dynarmic now * Tidy up
* Merge pull request #912 from lioncash/global-varbunnei2018-08-051-3/+6
|\ | | | | video_core: Eliminate the g_renderer global variable
| * renderer_base: Make Rasterizer() return the rasterizer by referenceLioncash2018-08-041-1/+1
| | | | | | | | | | | | | | All calling code assumes that the rasterizer will be in a valid state, which is a totally fine assumption. The only way the rasterizer wouldn't be is if initialization is done incorrectly or fails, which is checked against in System::Init().
| * video_core: Eliminate the g_renderer global variableLioncash2018-08-041-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We move the initialization of the renderer to the core class, while keeping the creation of it and any other specifics in video_core. This way we can ensure that the renderer is initialized and doesn't give unfettered access to the renderer. This also makes dependencies on types more explicit. For example, the GPU class doesn't need to depend on the existence of a renderer, it only needs to care about whether or not it has a rasterizer, but since it was accessing the global variable, it was also making the renderer a part of its dependency chain. By adjusting the interface, we can get rid of this dependency.
* | Merge pull request #849 from DarkLordZach/xcibunnei2018-08-041-4/+8
|\ \ | |/ |/| XCI and Encrypted NCA Support
| * Use more descriptive error codes and messagesZach Hilman2018-08-011-4/+8
| |
* | core/memory: Get rid of 3DS leftoversLioncash2018-08-031-3/+3
| | | | | | | | Removes leftover code from citra that isn't needed.
* | Merge pull request #892 from lioncash/globalbunnei2018-08-031-2/+2
|\ \ | | | | | | video_core: Make global EmuWindow instance part of the base renderer …
| * | video_core: Make global EmuWindow instance part of the base renderer classLioncash2018-08-011-2/+2
| |/ | | | | | | | | | | | | | | | | | | | | Makes the global a member of the RendererBase class. We also change this to be a reference. Passing any form of null pointer to these functions is incorrect entirely, especially given the code itself assumes that the pointer would always be in a valid state. This also makes it easier to follow the lifecycle of instances being used, as we explicitly interact the renderer with the rasterizer, rather than it just operating on a global pointer.
* | Merge pull request #894 from lioncash/objectbunnei2018-08-031-1/+0
|\ \ | | | | | | kernel: Move object class to its own source files
| * | kernel: Move object class to its own source filesLioncash2018-08-011-1/+0
| |/ | | | | | | | | | | General moving to keep kernel object types separate from the direct kernel code. Also essentially a preliminary cleanup before eliminating global kernel state in the kernel code.
* / hw: Remove unused filesLioncash2018-08-021-3/+0
|/ | | | | | None of these files are used in any meaningful way. They're just leftovers from citra. Also has the benefit of getting rid of an unused global variable.
* audio_core: Move to audout_u impl.bunnei2018-07-301-2/+0
| | | | - This is necessary so streams are created on the same thread.
* core: Add AudioCore to global state.bunnei2018-07-271-0/+2
|
* Implement exclusive monitorMerryMage2018-07-221-1/+2
|
* Merge pull request #687 from lioncash/instancebunnei2018-07-181-1/+3
|\ | | | | core: Don't construct instance of Core::System, just to access its live instance
| * core: Make System's default constructor privateLioncash2018-07-181-0/+2
| | | | | | | | | | | | This makes it a compilation error to construct additional instances of the System class directly, preventing accidental wasteful constructions over and over.
| * core: Don't construct instance of Core::System, just to access its live instanceLioncash2018-07-181-1/+1
| | | | | | | | | | | | | | | | | | This would result in a lot of allocations and related object construction, just to toss it all away immediately after the call. These are definitely not intentional, and it was intended that all of these should have been accessing the static function GetInstance() through the name itself, not constructed instances.
* | Virtual Filesystem 2: Electric Boogaloo (#676)Zach Hilman2018-07-181-1/+2
|/ | | | | | | | | | * Virtual Filesystem * Fix delete bug and documentate * Review fixes + other stuff * Fix puyo regression
* Revert "Virtual Filesystem (#597)"bunnei2018-07-071-2/+1
| | | | This reverts commit 12e9522b32d972a8e9b327c7ee7c14040a61ffdd.
* Virtual Filesystem (#597)Zach Hilman2018-07-061-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add VfsFile and VfsDirectory classes * Finish abstract Vfs classes * Implement RealVfsFile (computer fs backend) * Finish RealVfsFile and RealVfsDirectory * Finished OffsetVfsFile * More changes * Fix import paths * Major refactor * Remove double const * Use experimental/filesystem or filesystem depending on compiler * Port partition_filesystem * More changes * More Overhaul * FSP_SRV fixes * Fixes and testing * Try to get filesystem to compile * Filesystem on linux * Remove std::filesystem and document/test * Compile fixes * Missing include * Bug fixes * Fixes * Rename v_file and v_dir * clang-format fix * Rename NGLOG_* to LOG_* * Most review changes * Fix TODO * Guess 'main' to be Directory by filename
* Update clang formatJames Rowe2018-07-021-2/+2
|
* Rename logging macro back to LOG_*James Rowe2018-07-021-7/+7
|
* core: Run all CPU cores separately, even in single-thread mode.bunnei2018-05-101-6/+20
|
* threading: Reschedule only on cores that are necessary.bunnei2018-05-101-0/+5
|