Commit graph

131 commits

Author SHA1 Message Date
Lioncash
5484742fda core_cpu: Make Cpu scheduler instances unique_ptrs instead of shared_ptrs 2018-10-15 14:15:56 -04:00
Lioncash
5c0408596f kernel/thread: Use a regular pointer for the owner/current process
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).
2018-10-10 02:04:55 -04:00
fearlessTobi
63c2e32e20 Port #4182 from Citra: "Prefix all size_t with std::" 2018-09-15 15:21:06 +02:00
Lioncash
3f17fe7133 core: Migrate current_process pointer to the kernel
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.
2018-09-06 20:52:58 -04:00
Markus Wick
dce624e3f1 core: Use a raw pointer in GetGPUDebugContext.
This helper is called very often. The memory ownership shall not be transfered, so just return the raw pointer.
2018-09-04 14:10:05 +02:00
Lioncash
4a587b81b2 core/core: Replace includes with forward declarations where applicable
The follow-up to e2457418da, 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.
2018-08-31 16:30:14 -04:00
Lioncash
e2457418da core: Make the main System class use the PImpl idiom
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.
2018-08-31 07:16:57 -04:00
Lioncash
0cbcd6ec9a kernel: Eliminate kernel global state
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.
2018-08-28 22:31:51 -04:00
bunnei
62edc01525
Merge pull request #1175 from lioncash/ns
core: Namespace all code in the arm subdirectory under the Core namespace
2018-08-27 18:17:12 -04:00
bunnei
f96ded9815
Merge pull request #1174 from lioncash/debug
debug_utils: Minor individual interface changes
2018-08-27 15:44:29 -04:00
Lioncash
43e0d865fa core: Namespace all code in the arm subdirectory under the Core namespace
Gets all of these types and interfaces out of the global namespace.
2018-08-24 21:50:39 -04:00
Lioncash
c65713832c debug_utils: Remove unused includes
Quite a bit of these aren't necessary directly within the debug_utils
header and can be removed or included where actually necessary.
2018-08-24 20:49:14 -04:00
Zach Hilman
67fa51ea2f qt: Add filename and title id to window title while running 2018-08-23 14:12:56 -04:00
Lioncash
a0ce6de913 core: Delete System copy/move constructors and assignment operators
Prevents potentially making copies or doing silly things by accident
with the System instance, particularly given our current core is
designed (unfortunately) around one instantiable instance.

This will prevent the accidental case of:

auto instance = System::Instance();

being compiled without warning when it's supposed to be:

auto& instance = System::Instance();
2018-08-16 10:21:14 -04:00
Lioncash
0a93b45b6a core: Namespace EmuWindow
Gets the class out of the global namespace.
2018-08-11 20:20:21 -04:00
Zach Hilman
ec3bef7b4c loader: Add more descriptive errors
Full list of new errors and descriptions in core/loader/loader.h
2018-08-09 21:06:59 -04:00
Zach Hilman
4b471f0554 core: Port core to VfsFilesystem for file access 2018-08-08 21:18:45 -04:00
Hedges
e2b74f6354 GDBStub works with both Unicorn and Dynarmic now (#941)
* GDBStub works with both Unicorn and Dynarmic now

* Tidy up
2018-08-06 22:01:24 -04:00
bunnei
c0af42d6eb
Merge pull request #912 from lioncash/global-var
video_core: Eliminate the g_renderer global variable
2018-08-05 16:37:39 -04:00
bunnei
2b06301dbf
Merge pull request #849 from DarkLordZach/xci
XCI and Encrypted NCA Support
2018-08-04 14:33:11 -04:00
Lioncash
6030c5ce41 video_core: Eliminate the g_renderer global variable
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.
2018-08-04 02:36:57 -04:00
Lioncash
26de4bb521 core/memory: Get rid of 3DS leftovers
Removes leftover code from citra that isn't needed.
2018-08-03 11:22:47 -04:00
bunnei
00ba704a7f
Merge pull request #892 from lioncash/global
video_core: Make global EmuWindow instance part of the base renderer …
2018-08-03 00:31:32 -04:00
Lioncash
bf45092c61 kernel: Move object class to its own source files
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.
2018-08-01 23:34:42 -04:00
Lioncash
0f2ac928f2 video_core: Make global EmuWindow instance part of the base renderer class
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.
2018-08-01 21:40:30 -04:00
Zach Hilman
187d8e215f Use more descriptive error codes and messages 2018-08-01 00:16:54 -04:00
bunnei
eaf66b4c9f audio_core: Move to audout_u impl.
- This is necessary so streams are created on the same thread.
2018-07-30 18:44:16 -04:00
bunnei
2a742229ee core: Add AudioCore to global state. 2018-07-27 22:33:37 -04:00
MerryMage
0b1c2e5505 Implement exclusive monitor 2018-07-22 15:55:17 +01:00
Lioncash
10d2ab8098 core: Make System's default constructor private
This makes it a compilation error to construct additional instances of
the System class directly, preventing accidental wasteful constructions
over and over.
2018-07-18 18:18:27 -04:00
bunnei
811dae12f9 core: Add several missing docstrings. 2018-05-10 19:34:54 -04:00
bunnei
edc52250b8 core: Run all CPU cores separately, even in single-thread mode. 2018-05-10 19:34:53 -04:00
bunnei
8aa5d25f82 threading: Reschedule only on cores that are necessary. 2018-05-10 19:34:52 -04:00
bunnei
9bf2a428f9 core: Add a configuration setting for use_multi_core. 2018-05-10 19:34:47 -04:00
bunnei
cba69fdcd4 core: Support session close with multicore. 2018-05-10 19:34:47 -04:00
bunnei
a434fdcb10 core: Implement multicore support. 2018-05-10 19:34:46 -04:00
bunnei
9776ff9179 core: Create a thread for each CPU core, keep in lock-step with a barrier. 2018-05-10 19:34:46 -04:00
bunnei
5590245930 core: Move common CPU core things to its own class. 2018-05-10 19:34:46 -04:00
Lioncash
659a612368 core: Relocate g_service_manager to the System class
Converts the service manager from a global into an instance-based
variable.
2018-04-20 19:44:32 -04:00
N00byKing
358050cfc6 core, main.h: Abort on 32Bit ROMs (#309)
* core, main.h: Abort on 32Bit ROMs

* main.cpp: Fix Grammar
2018-04-06 11:06:32 -04:00
Subv
0ce52b1da2 GPU: Make the debug_context variable a member of the frontend instead of a global. 2018-03-24 23:35:06 -05:00
bunnei
23a0d2d7b7
Merge pull request #193 from N00byKing/3184_2_robotic_boogaloo
Implement Pull #3184 from citra: core/arm: Improve timing accuracy before service calls in JIT (Rebased)
2018-03-18 22:35:47 -04:00
bunnei
7d6653268f core: Move process creation out of global state. 2018-03-14 18:42:19 -04:00
N00byKing
bc88cae0c7 Implements citra-emu/citra#3184 2018-02-25 11:44:21 +01:00
bunnei
ac81c02ed9 kernel: Use Scheduler class for threading. 2018-02-18 15:17:16 -05:00
bunnei
2d4a6883bc core: Use shared_ptr for cpu_core. 2018-02-18 14:52:09 -05:00
Subv
6cddf9d88e Make a GPU class in VideoCore to contain the GPU state.
Also moved the GPU MemoryManager class to video_core since it makes more sense for it to be there.
2018-02-11 23:44:12 -05:00
N00byKing
afa1ed6ad9
Correct Spelling 2018-01-23 14:20:18 +01:00
bunnei
24f10a20e7 core: Increase tight_loop 100x for speed. 2018-01-04 16:52:16 -05:00
bunnei
9b8e5bea66 core: Expose AppLoader as a public interface. 2017-08-03 20:10:37 -04:00
TheKoopaKingdom
f008b22e3b Addressed Bunnei's review comments, and made some other tweaks:
- Deleted GetStatus() because it wasn't used anywhere outside of Core::System.
 - Fixed design flaw where the message bar status could be set despite the game being stopped.
2017-06-02 18:40:39 -04:00
TheKoopaKingdom
a8aef599e0 Created a whitelist of system archives to prevent false positives creating dialogs. 2017-06-02 18:28:14 -04:00
TheKoopaKingdom
0409bdfea5 Optimized messages that were repetitive and added ability for core errors to specify more details optionally. 2017-06-02 18:28:14 -04:00
TheKoopaKingdom
37bec598ea Made some changes from review comments:
- Made LoadKernelSystemMode return a pair consisting of a system mode and a result code (Could use review).
- Deleted ErrorOpenGL error code in favor of just having ErrorVideoCore.
- Made dialog messages more clear.
- Compared archive ID in fs_user.cpp to ArchiveIdCode::NCCH as opposed to hex magic.
- Cleaned up some other stuff.
2017-06-02 18:28:14 -04:00
TheKoopaKingdom
1ecb322daa Added system for handling core errors in citra-qt. 2017-06-02 18:27:56 -04:00
bunnei
f3e14cae1e core: Keep track of telemetry for the current emulation session. 2017-05-24 19:16:22 -04:00
Yuri Kunde Schlesner
fb1979d7e2 Core: Re-write frame limiter
Now based on std::chrono, and also works in terms of emulated time
instead of frames, so we can in the future frame-limit even when the
display is disabled, etc.

The frame limiter can also be enabled along with v-sync now, which
should be useful for those with displays running at more than 60 Hz.
2017-02-26 17:22:04 -08:00
Yuri Kunde Schlesner
b285c2a4ed Core: Make PerfStats internally locked
More ergonomic to use and will be required for upcoming changes.
2017-02-26 17:22:03 -08:00
Yuri Kunde Schlesner
c75ae6c585 Add performance statistics to status bar 2017-02-26 17:22:03 -08:00
Kloen
b3a0b1489b core: inline CPU, 132 warnings fixed on GCC 2017-01-30 00:12:07 +01:00
bunnei
8b1e269e58 ThreadContext: Move from "core" to "arm_interface". 2016-12-22 00:27:49 -05:00
bunnei
e26fbfd1d7 core: Replace "AppCore" nomenclature with just "CPU". 2016-12-22 00:27:46 -05:00
bunnei
5ac5cbeab7 Address clang-format issues. 2016-12-21 23:48:14 -05:00
bunnei
4fc8b8229e core: Remove HLE module, consolidate code & various cleanups. 2016-12-21 23:48:13 -05:00
bunnei
232ef55c1a core: Consolidate core and system state, remove system module & cleanups. 2016-12-21 23:29:13 -05:00
Emmanuel Gil Peyrot
dc8479928c Sources: Run clang-format on everything. 2016-09-18 09:38:01 +09:00
LittleWhite
4be68dddfb Improve error report from Init() functions
Add error popup when citra initialization failed
2016-03-08 22:05:25 +01:00
Lioncash
cee8df6ff0 core: Use unique_ptr for holding the interpreter instances 2015-12-29 18:03:08 -05:00
Subv
1d02eb0587 Core/ARM11: Correct the size of the VFP register array in the ThreadContext structure.
The VFP registers are 64 bits each, and there are 32 of them.
2015-11-29 13:06:45 -05:00
Lioncash
8b2b620a5e dyncom: Remove more unused/unnecessary code
Gets rid of a sizeable amount of stuff in armdefs.
2015-04-20 16:30:34 -04:00
Lioncash
3f00dd9117 arm: Clean up ARMul_State
Remove unnecessary/unused struct variables.
2015-01-31 21:55:34 -05:00
Lioncash
f44781fd7b arm: Adios armemu 2015-01-31 20:43:03 -05:00
Yuri Kunde Schlesner
7b3452c730 Move ThreadContext to core/core.h and deal with the fallout 2015-01-09 03:51:55 -02:00
bunnei
853b46c681 Core: Change default CPU to dyncom. 2015-01-02 22:33:53 -05:00
purpasmart96
ebfd831ccb License change 2014-12-20 21:20:24 -08:00
bunnei
ce1125d490 Core: Changed RunLoop iterations to 1000 (slightly better performance). 2014-11-11 19:54:09 -05:00
archshift
0783498f57 Use configuration files to enable or disable the new dyncom interpreter. 2014-10-27 18:35:21 -07:00
bunnei
b5e6524594 ARM: Reorganized file structure to move shared SkyEye code to a more common area.
Removed s_ prefix
2014-10-25 14:11:39 -04:00
bunnei
eb36d3fc90 Core: Refactor core to use only one function for execution.
Core: Cleaned up comment to be more readable.

Citra: Changed loop to be more readable.
2014-08-30 23:23:38 -04:00
bunnei
de0a034a84 fixed project includes to use new directory structure 2014-04-08 20:15:08 -04:00
bunnei
63e46abdb8 got rid of 'src' folders in each sub-project 2014-04-08 19:25:03 -04:00
Renamed from src/core/src/core.h (Browse further)