Commit graph

82 commits

Author SHA1 Message Date
bunnei
a0ee597b19
Merge pull request #4203 from VolcaEM/services
service: Update function tables
2020-07-11 00:02:36 -04:00
VolcaEM
6a0010d0c6
service: Update function tables 2020-06-29 04:01:34 +02:00
Fernando Sahmkow
e31425df38 General: Recover Prometheus project from harddrive failure
This commit: Implements CPU Interrupts, Replaces Cycle Timing for Host 
Timing, Reworks the Kernel's Scheduler, Introduce Idle State and 
Suspended State, Recreates the bootmanager, Initializes Multicore 
system.
2020-06-27 11:35:06 -04:00
bunnei
bba54e1880 time_zone: Use std::chrono::seconds for strong typing. 2020-05-12 18:44:07 -04:00
bunnei
3c8cd62b0d hle: service: time_zone_manager: Use current time zone setting. 2020-05-11 17:55:25 -04:00
bunnei
eb26e9e711
Merge pull request #3730 from lioncash/time
service/time: Remove reliance on the global system accessor
2020-04-23 02:41:38 -04:00
bunnei
9bf3abcb63
Merge pull request #3698 from lioncash/warning
General: Resolve minor assorted warnings
2020-04-21 14:11:18 -04:00
Lioncash
bfee33cce3 service/time: Remove reliance on the global system accessor
Eliminates usages of the global system accessor and instead passes the
existing system instance into the interfaces.
2020-04-19 16:31:28 -04:00
Lioncash
7714b02d95 time/system_clock_core: Remove unnecessary initializer
This is already initialized within the class body.
2020-04-17 20:04:06 -04:00
Lioncash
b533f18ab9 service/time: Mark IsStandardNetworkSystemClockAccuracySufficient as const
This doesn't modify internal member state.
2020-04-17 20:02:45 -04:00
Lioncash
0cfd3b94db service/time: Add virtual destructors where applicable
Many of these implementations are used to implement a polymorphic
interface. While not directly used polymorphically, this prevents
virtual destruction from ever becoming an issue.
2020-04-17 19:59:31 -04:00
bunnei
67b3df683b service: time: Update for new shared memory layout. 2020-04-17 00:59:33 -04:00
Lioncash
337f2dc11f time_zone_manager: Resolve sign conversion warnings
ttis and ats will never exceed the length of INT32_MAX in our case, so
this is safe.
2020-04-16 22:23:59 -04:00
bunnei
79c1269f0f
Merge pull request #3673 from lioncash/extra
CMakeLists: Specify -Wextra on linux builds
2020-04-16 21:12:33 -04:00
Lioncash
1c340c6efa CMakeLists: Specify -Wextra on linux builds
Allows reporting more cases where logic errors may exist, such as
implicit fallthrough cases, etc.

We currently ignore unused parameters, since we currently have many
cases where this is intentional (virtual interfaces).

While we're at it, we can also tidy up any existing code that causes
warnings. This also uncovered a few bugs as well.
2020-04-15 21:33:46 -04:00
bunnei
eb676c343a service: time: Implement CalculateStandardUserSystemClockDifferenceByUser.
- Used by Animal Crossing: New Horizons.
2020-04-14 22:28:41 -04:00
bunnei
a60f34a850 services: time: Implement CalculateSpanBetween.
- Used by Super Smash Bros. Ultimate.
2020-03-27 10:42:13 -04:00
ReinUsesLisp
ac7ee21331 time_zone_content_manager: Fix out of bounds read
There were cases where raw_data didn't contain enough
space to hold the zero terminator.

This was caught with -fsanitize=address.
2020-03-18 19:06:16 -03:00
Fernando Sahmkow
1e6f8aba04 Core: Set all hardware emulation constants in a single file. 2020-02-11 20:19:11 -04:00
bunnei
ed76c71319 service: time: Implement ToPosixTimeWithMyRule.
- Used by Pokemon Mystery Dungeon.
2020-01-22 23:20:19 -05:00
bunnei
7113236b30 time: Fix month off-by-one error.
- Fixes timestamp in ZLA and Astral Chain saves.
2020-01-20 14:20:32 -05:00
bunnei
be5c149d37 service: time: Implement GetStandardLocalSystemClock. 2020-01-04 22:18:54 -05:00
bunnei
361285add9 time: Remove overflow error checking (currently breaks ADO builds). 2020-01-04 13:48:31 -05:00
bunnei
a4e840181c service: time: Implement GetClockSnapshotFromSystemClockContext. 2020-01-04 13:48:30 -05:00
bunnei
fab2607c6b service: time: Implement IsStandardNetworkSystemClockAccuracySufficient. 2020-01-04 13:48:30 -05:00
bunnei
78f977c980 service: time: Rewrite implementation of glue services. 2020-01-04 13:48:29 -05:00
bunnei
50c7539108
Merge pull request #3094 from lioncash/tables
service: Update function tables
2019-11-24 20:30:58 -05:00
bunnei
9046d4a548
kernel: Replace usage of boost::intrusive_ptr with std::shared_ptr for kernel objects. (#3154)
* kernel: Replace usage of boost::intrusive_ptr with std::shared_ptr for kernel objects.

- See https://github.com/citra-emu/citra/pull/4710 for details.
2019-11-24 20:15:51 -05:00
Lioncash
e21b6ff79d service: Update function tables
Keeps the function tables up to date.

Updated based off information from Switchbrew.
2019-11-12 10:32:56 -05:00
Lioncash
f11b87ebf1 service: Resolve sign conversion errors
These are fairly trivial to resolve and most of the changes entail
using RESULT_UNKNOWN over ResultCode(-1).
2019-11-12 07:55:39 -05:00
David Marcec
2c6e4ce0ad Deglobalize System: Time 2019-09-22 16:38:02 +10:00
David Marcec
f67039c067 Addressed issues 2019-06-26 16:52:34 +10:00
David Marcec
19dc36ce06 Implement Time::GetSharedMemoryNativeHandle
This PR attempts to implement the shared memory provided by GetSharedMemoryNativeHandle. There is still more work to be done however that requires a rehaul of the current time module to handle clock contexts. This PR is mainly to get the basic functionality of the SharedMemory working and allow the use of addition to it whilst things get improved on.

Things to note:
Memory Barriers are used in the SharedMemory and a better solution would need to be done to implement this. Currently in this PR I’m faking the memory barriers as everything is sync and single threaded. They work by incrementing the counter and just populate the two data slots. On data reading, it will read the last added data.

Specific values in the shared memory would need to be updated periodically. This isn't included in this PR since we don't actively do this yet. In a later PR when time is refactored this should be done.

Finally, as we don't handle clock contexts. When time is refactored, we will need to update the shared memory for specific contexts. This PR does this already however since the contexts are all identical and not separated. We're just updating the same values for each context which in this case is empty.

Tiime:SetStandardUserSystemClockAutomaticCorrectionEnabled, Time:IsStandardUserSystemClockAutomaticCorrectionEnabled are also partially implemented in this PR. The reason the implementation is partial is because once again, a lack of clock contexts. This will be improved on in a future PR.

This PR closes issue #2556
2019-06-26 00:45:53 +10:00
Lioncash
2548661c08 core/core_timing_util: Amend casing of cyclesTo* functions
Makes the casing consistent with all of our general function naming
conventions.
2019-06-04 20:31:46 -04:00
Lioncash
42f5fd0ab3 core/core_timing_util: Use std::chrono types for specifying time units
Makes the interface more type-safe and consistent in terms of return
values.
2019-06-04 20:31:24 -04:00
Lioncash
ca96dc4676 service: Update service function tables
Updates function tables based off information from SwitchBrew.
2019-04-11 02:47:00 -04:00
Lioncash
bd983414f6 core_timing: Convert core timing into a class
Gets rid of the largest set of mutable global state within the core.
This also paves a way for eliminating usages of GetInstance() on the
System class as a follow-up.

Note that no behavioral changes have been made, and this simply extracts
the functionality into a class. This also has the benefit of making
dependencies on the core timing functionality explicit within the
relevant interfaces.
2019-02-15 21:50:25 -05:00
Lioncash
48d9d66dc5 core_timing: Rename CoreTiming namespace to Core::Timing
Places all of the timing-related functionality under the existing Core
namespace to keep things consistent, rather than having the timing
utilities sitting in its own completely separate namespace.
2019-02-12 12:42:17 -05:00
Zach Hilman
05dbb47af5 settings: Use std::chrono::seconds instead of s64 for RTC 2019-01-07 19:19:40 -05:00
Zach Hilman
dbb1eb9c29 time: Use custom RTC settings if applicable for game 2019-01-07 19:19:40 -05:00
Lioncash
fa97f50bff service/time: Minor cleanup to GetClockSnapshot()
Moves some variables closer to their actual usage sites.
2018-12-29 21:42:13 -05:00
Lioncash
af51f123fa service/time: Fill in some structures and remove padding where not necessary 2018-12-29 18:26:32 -05:00
David Marcec
a2cc3b10bb Changed logging to be "Log before execution", Added more error logging, all services should now log on some level 2018-11-26 17:06:13 +11:00
David Marcec
c440e8b8e1 Implemented CalculateStandardUserSystemClockDifferenceByUser
Seems pokemon calls this sometimes and it caused "random crashes"
2018-11-17 14:01:16 +11:00
David Marcec
48cd61d9c8 Added maybe_unused 2018-11-10 18:07:34 +11:00
David Marcec
ddc242dd51 Added ToPosixTime & ToPosixTimeWithMyRule
Added instead of using a seperate PR to prevent conflicts
2018-11-10 17:41:57 +11:00
David Marcec
84c6134264 Added consts and static 2018-11-10 12:31:48 +11:00
David Marcec
4f78f5c0df Implement GetClockSnapshot
Needed by megaman 11
2018-11-10 01:25:56 +11:00
Lioncash
6ac955a0b4 hle/service: Default constructors and destructors in the cpp file where applicable
When a destructor isn't defaulted into a cpp file, it can cause the use
of forward declarations to seemingly fail to compile for non-obvious
reasons. It also allows inlining of the construction/destruction logic
all over the place where a constructor or destructor is invoked, which
can lead to code bloat. This isn't so much a worry here, given the
services won't be created and destroyed frequently.

The cause of the above mentioned non-obvious errors can be demonstrated
as follows:

------- Demonstrative example, if you know how the described error happens, skip forwards -------

Assume we have the following in the header, which we'll call "thing.h":

\#include <memory>

// Forward declaration. For example purposes, assume the definition
// of Object is in some header named "object.h"
class Object;

class Thing {
public:
    // assume no constructors or destructors are specified here,
    // or the constructors/destructors are defined as:
    //
    // Thing() = default;
    // ~Thing() = default;
    //

    // ... Some interface member functions would be defined here

private:
    std::shared_ptr<Object> obj;
};

If this header is included in a cpp file, (which we'll call "main.cpp"),
this will result in a compilation error, because even though no
destructor is specified, the destructor will still need to be generated by
the compiler because std::shared_ptr's destructor is *not* trivial (in
other words, it does something other than nothing), as std::shared_ptr's
destructor needs to do two things:

1. Decrement the shared reference count of the object being pointed to,
   and if the reference count decrements to zero,

2. Free the Object instance's memory (aka deallocate the memory it's
   pointing to).

And so the compiler generates the code for the destructor doing this inside main.cpp.

Now, keep in mind, the Object forward declaration is not a complete type. All it
does is tell the compiler "a type named Object exists" and allows us to
use the name in certain situations to avoid a header dependency. So the
compiler needs to generate destruction code for Object, but the compiler
doesn't know *how* to destruct it. A forward declaration doesn't tell
the compiler anything about Object's constructor or destructor. So, the
compiler will issue an error in this case because it's undefined
behavior to try and deallocate (or construct) an incomplete type and
std::shared_ptr and std::unique_ptr make sure this isn't the case
internally.

Now, if we had defaulted the destructor in "thing.cpp", where we also
include "object.h", this would never be an issue, as the destructor
would only have its code generated in one place, and it would be in a
place where the full class definition of Object would be visible to the
compiler.

---------------------- End example ----------------------------

Given these service classes are more than certainly going to change in
the future, this defaults the constructors and destructors into the
relevant cpp files to make the construction and destruction of all of
the services consistent and unlikely to run into cases where forward
declarations are indirectly causing compilation errors. It also has the
plus of avoiding the need to rebuild several services if destruction
logic changes, since it would only be necessary to recompile the single
cpp file.
2018-09-10 23:55:31 -04:00
Lioncash
20c976ff2a service/time: Amend command IDs of ToPosixTime() and ToPosixTimeWithMyRule()
Updates the ID of these based off the information on Switch Brew.
2018-08-07 03:18:07 -04:00