Add system time configuration (#4043)

* Add setting to switch between a fixed start time and the system time

Add clock settings to SDL

Make clock configureable in qt

Add a SharedPage handler class

Init shared_page_handler for tests
This commit is contained in:
Ben 2018-08-26 19:47:45 +02:00 committed by James Rowe
parent 13262c187c
commit b20607dfc6
16 changed files with 220 additions and 61 deletions

View file

@ -10,6 +10,9 @@
* write access, according to 3dbrew; this is not emulated)
*/
#include <chrono>
#include <ctime>
#include <memory>
#include "common/bit_field.h"
#include "common/common_funcs.h"
#include "common/common_types.h"
@ -18,6 +21,10 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
namespace CoreTiming {
struct EventType;
}
namespace SharedPage {
// See http://3dbrew.org/wiki/Configuration_Memory#Shared_Memory_Page_For_ARM11_Processes
@ -74,14 +81,25 @@ struct SharedPageDef {
static_assert(sizeof(SharedPageDef) == Memory::SHARED_PAGE_SIZE,
"Shared page structure size is wrong");
extern SharedPageDef shared_page;
class Handler {
public:
Handler();
void Init();
void SetMacAddress(const MacAddress&);
void SetMacAddress(const MacAddress&);
void SetWifiLinkLevel(WifiLinkLevel);
void SetWifiLinkLevel(WifiLinkLevel);
void Set3DLed(u8);
void Set3DLed(u8);
SharedPageDef& GetSharedPage();
private:
u64 GetSystemTime() const;
void UpdateTimeCallback(u64 userdata, int cycles_late);
CoreTiming::EventType* update_time_event;
std::chrono::seconds init_time;
SharedPageDef shared_page;
};
} // namespace SharedPage