Cocoa Port:

- Add support for displaying the Real-Time Clock in the HUD.
This commit is contained in:
rogerman 2015-10-16 21:26:52 +00:00
parent a6a1875e05
commit dd305b36d9
12 changed files with 156 additions and 31 deletions

View File

@ -562,9 +562,8 @@ void DrawHUD()
if (CommonSettings.hud.ShowRTC)
{
DateTime tm = rtcGetTime();
static const char *wday[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
osd->addFixed(Hud.RTCDisplay.x, Hud.RTCDisplay.y, "%04d-%03s-%02d %s %02d:%02d:%02d", tm.get_Year(), DateTime::GetNameOfMonth(tm.get_Month()), tm.get_Day(), wday[tm.get_DayOfWeek()%7], tm.get_Hour(), tm.get_Minute(), tm.get_Second());
rtcGetTimeAsString(Hud.rtcString);
osd->addFixed(Hud.RTCDisplay.x, Hud.RTCDisplay.y, Hud.rtcString);
}
DrawStateSlots();

View File

@ -55,6 +55,7 @@ public:
fps3d = 0;
cpuload[0] = cpuload[1] = 0;
cpuloopIterationCount = 0;
memset(rtcString, 0, sizeof(rtcString));
clicked = false;
}
@ -72,6 +73,7 @@ public:
void reset();
int fps, fps3d, cpuload[2], cpuloopIterationCount;
char rtcString[25];
bool clicked;
};

View File

@ -5708,11 +5708,13 @@ OGLHUDLayer::OGLHUDLayer(OGLVideoOutput *oglVO)
_showRender3DFPS = false;
_showFrameIndex = false;
_showLagFrameCount = false;
_showRTC = false;
_lastVideoFPS = 0;
_lastRender3DFPS = 0;
_lastFrameIndex = 0;
_lastLagFrameCount = 0;
memset(_lastRTCString, 0, sizeof(_lastRTCString));
_textBoxLines = 0;
_textBoxWidth = 0;
@ -5921,12 +5923,13 @@ void OGLHUDLayer::SetFontUsingPath(const char *filePath)
glBindTexture(GL_TEXTURE_2D, 0);
}
void OGLHUDLayer::SetInfo(const uint32_t videoFPS, const uint32_t render3DFPS, const uint32_t frameIndex, const uint32_t lagFrameCount)
void OGLHUDLayer::SetInfo(const uint32_t videoFPS, const uint32_t render3DFPS, const uint32_t frameIndex, const uint32_t lagFrameCount, const char *rtcString)
{
this->_lastVideoFPS = videoFPS;
this->_lastRender3DFPS = render3DFPS;
this->_lastFrameIndex = frameIndex;
this->_lastLagFrameCount = lagFrameCount;
memcpy(this->_lastRTCString, rtcString, sizeof(this->_lastRTCString));
this->RefreshInfo();
}
@ -5978,6 +5981,17 @@ void OGLHUDLayer::RefreshInfo()
}
}
if (this->_showRTC)
{
ss << "RTC: " << this->_lastRTCString << "\n";
const GLint newTextBoxWidth = (charSize * 10.3f) + 6.5f;
if (newTextBoxWidth > this->_textBoxWidth)
{
this->_textBoxWidth = newTextBoxWidth;
}
}
this->_statusString = ss.str();
}
@ -6042,6 +6056,16 @@ bool OGLHUDLayer::GetShowLagFrameCount() const
return this->_showLagFrameCount;
}
void OGLHUDLayer::SetShowRTC(const bool visibleState)
{
this->_SetShowInfoItemOGL(this->_showRTC, visibleState);
}
bool OGLHUDLayer::GetShowRTC() const
{
return this->_showRTC;
}
void OGLHUDLayer::_ProcessVerticesOGL()
{
if (this->_textBoxLines <= 0)

View File

@ -318,11 +318,13 @@ protected:
bool _showRender3DFPS;
bool _showFrameIndex;
bool _showLagFrameCount;
bool _showRTC;
uint32_t _lastVideoFPS;
uint32_t _lastRender3DFPS;
uint32_t _lastFrameIndex;
uint32_t _lastLagFrameCount;
char _lastRTCString[25];
GLint _textBoxLines;
GLint _textBoxWidth;
@ -336,7 +338,7 @@ public:
void SetFontUsingPath(const char *filePath);
void SetInfo(const uint32_t videoFPS, const uint32_t render3DFPS, const uint32_t frameIndex, const uint32_t lagFrameCount);
void SetInfo(const uint32_t videoFPS, const uint32_t render3DFPS, const uint32_t frameIndex, const uint32_t lagFrameCount, const char *rtcString);
void RefreshInfo();
void SetShowVideoFPS(const bool visibleState);
@ -347,6 +349,8 @@ public:
bool GetShowFrameIndex() const;
void SetShowLagFrameCount(const bool visibleState);
bool GetShowLagFrameCount() const;
void SetShowRTC(const bool visibleState);
bool GetShowRTC() const;
virtual void SetViewportSizeOGL(GLsizei w, GLsizei h);
virtual void ProcessOGL();

View File

@ -52,6 +52,7 @@ struct NDSFrameInfo
uint32_t render3DFPS;
uint32_t frameIndex;
uint32_t lagFrameCount;
char rtcString[25];
};
typedef struct NDSFrameInfo NDSFrameInfo;

View File

@ -29,6 +29,7 @@
#include "../SPU.h"
#include "../movie.h"
#include "../metaspu/metaspu.h"
#include "../rtc.h"
#import <Cocoa/Cocoa.h>
@ -832,6 +833,7 @@
frameInfo.render3DFPS = Render3DFramesPerSecond;
frameInfo.frameIndex = currFrameCounter;
frameInfo.lagFrameCount = TotalLagFrames;
rtcGetTimeAsString(frameInfo.rtcString);
[(id<CocoaDSDisplayVideoDelegate>)delegate doProcessVideoFrameWithInfo:frameInfo];
}

View File

@ -13,7 +13,7 @@
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="795"/>
<integer value="29"/>
<integer value="10142"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@ -1671,7 +1671,6 @@
</object>
<object class="NSMenuItem" id="713295923">
<reference key="NSMenu" ref="240738211"/>
<bool key="NSIsDisabled">YES</bool>
<string key="NSTitle">Real-Time Clock</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
@ -5842,7 +5841,7 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2
<string key="NSReuseIdentifierKey">_NS:682</string>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="485509450">
<int key="NSCellFlags">-2080374784</int>
<int key="NSCellFlags">67108864</int>
<int key="NSCellFlags2">0</int>
<string key="NSContents">Enable Heads-Up Display</string>
<reference key="NSSupport" ref="462791774"/>
@ -5892,7 +5891,7 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2
<string key="NSReuseIdentifierKey">_NS:682</string>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="448115349">
<int key="NSCellFlags">-2080374784</int>
<int key="NSCellFlags">67108864</int>
<int key="NSCellFlags2">0</int>
<string key="NSContents">Show 3D Renderer FPS</string>
<reference key="NSSupport" ref="462791774"/>
@ -5917,7 +5916,7 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2
<string key="NSReuseIdentifierKey">_NS:682</string>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="151263599">
<int key="NSCellFlags">-2080374784</int>
<int key="NSCellFlags">67108864</int>
<int key="NSCellFlags2">0</int>
<string key="NSContents">Show Frame Index</string>
<reference key="NSSupport" ref="462791774"/>
@ -5942,7 +5941,7 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2
<string key="NSReuseIdentifierKey">_NS:682</string>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="577627485">
<int key="NSCellFlags">-2080374784</int>
<int key="NSCellFlags">67108864</int>
<int key="NSCellFlags2">0</int>
<string key="NSContents">Show Lag Counter</string>
<reference key="NSSupport" ref="462791774"/>
@ -5992,7 +5991,7 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2
<string key="NSReuseIdentifierKey">_NS:682</string>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="922088406">
<int key="NSCellFlags">603979776</int>
<int key="NSCellFlags">67108864</int>
<int key="NSCellFlags2">0</int>
<string key="NSContents">Show Real Time Clock</string>
<reference key="NSSupport" ref="462791774"/>
@ -21054,7 +21053,7 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2
<reference key="NSSuperview" ref="1004755540"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="975096499">
<int key="NSCellFlags">603979776</int>
<int key="NSCellFlags">67108864</int>
<int key="NSCellFlags2">131072</int>
<string key="NSContents">Real Time Clock</string>
<reference key="NSSupport" ref="26"/>
@ -29814,6 +29813,7 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2
<string>mainWindow.view.isHUDRender3DFPSVisible</string>
<string>mainWindow.view.isHUDFrameIndexVisible</string>
<string>mainWindow.view.isHUDLagFrameCountVisible</string>
<string>mainWindow.view.isHUDRealTimeClockVisible</string>
</object>
<string key="NSObjectClassName">EmuControllerDelegate</string>
<object class="_NSManagedProxy" key="_NSManagedProxy"/>
@ -30083,6 +30083,10 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2
<bool key="NSClearsFilterPredicateOnInsertion">YES</bool>
</object>
<object class="NSUserDefaultsController" id="178548672">
<object class="NSMutableArray" key="NSDeclaredKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>HUD_ShowRTC</string>
</object>
<bool key="NSSharedInstance">YES</bool>
</object>
</object>
@ -42648,6 +42652,46 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2
</object>
<int key="connectionID">10186</int>
</object>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
<string key="label">value: selection.mainWindow.view.isHUDRealTimeClockVisible</string>
<reference key="source" ref="523387766"/>
<reference key="destination" ref="258098641"/>
<object class="NSNibBindingConnector" key="connector">
<reference key="NSSource" ref="523387766"/>
<reference key="NSDestination" ref="258098641"/>
<string key="NSLabel">value: selection.mainWindow.view.isHUDRealTimeClockVisible</string>
<string key="NSBinding">value</string>
<string key="NSKeyPath">selection.mainWindow.view.isHUDRealTimeClockVisible</string>
<int key="NSNibBindingConnectorVersion">2</int>
</object>
</object>
<int key="connectionID">10187</int>
</object>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
<string key="label">value: values.HUD_ShowRTC</string>
<reference key="source" ref="821096320"/>
<reference key="destination" ref="178548672"/>
<object class="NSNibBindingConnector" key="connector">
<reference key="NSSource" ref="821096320"/>
<reference key="NSDestination" ref="178548672"/>
<string key="NSLabel">value: values.HUD_ShowRTC</string>
<string key="NSBinding">value</string>
<string key="NSKeyPath">values.HUD_ShowRTC</string>
<int key="NSNibBindingConnectorVersion">2</int>
</object>
</object>
<int key="connectionID">10188</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">toggleShowHUDRealTimeClock:</string>
<reference key="source" ref="1014"/>
<reference key="destination" ref="713295923"/>
</object>
<int key="connectionID">10189</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@ -43180,14 +43224,14 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="304092617"/>
<reference ref="523387766"/>
<reference ref="269230248"/>
<reference ref="189973188"/>
<reference ref="708958649"/>
<reference ref="272928836"/>
<reference ref="278136792"/>
<reference ref="302843702"/>
<reference ref="448396937"/>
<reference ref="708958649"/>
<reference ref="523387766"/>
</object>
<reference key="parent" ref="485576541"/>
</object>
@ -57617,9 +57661,9 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2
<reference ref="987081603"/>
<reference ref="162261505"/>
<reference ref="250008560"/>
<reference ref="821096320"/>
<reference ref="115372504"/>
<reference ref="770825807"/>
<reference ref="115372504"/>
<reference ref="821096320"/>
</object>
<reference key="parent" ref="460623416"/>
</object>
@ -62905,7 +62949,7 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<object class="NSAffineTransform">
<bytes key="NSTransformStruct">P4AAAL+AAABBkAAAwsYAAA</bytes>
<bytes key="NSTransformStruct">P4AAAL+AAABBgAAAwsYAAA</bytes>
</object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@ -62944,7 +62988,7 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<object class="NSAffineTransform">
<bytes key="NSTransformStruct">P4AAAL+AAABBkAAAwmwAAA</bytes>
<bytes key="NSTransformStruct">P4AAAL+AAABBgAAAwmwAAA</bytes>
</object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@ -63708,7 +63752,7 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2
</object>
</object>
<nil key="sourceID"/>
<int key="maxID">10186</int>
<int key="maxID">10189</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@ -67079,7 +67123,7 @@ y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp2
<integer value="3100" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<nil key="IBDocument.LastKnownRelativeProjectPath"/>
<string key="IBDocument.LastKnownRelativeProjectPath">../../DeSmuME (XCode 3).xcodeproj</string>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
<bool key="EncodedWithXMLCoder">YES</bool>

View File

@ -60,6 +60,7 @@ class OGLVideoOutput;
@property (assign) BOOL isHUDRender3DFPSVisible;
@property (assign) BOOL isHUDFrameIndexVisible;
@property (assign) BOOL isHUDLagFrameCountVisible;
@property (assign) BOOL isHUDRealTimeClockVisible;
@property (assign) BOOL useVerticalSync;
@property (assign) BOOL videoFiltersPreferGPU;
@property (assign) BOOL sourceDeposterize;

View File

@ -494,9 +494,9 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
[[self view] setIsHUDRender3DFPSVisible:[[NSUserDefaults standardUserDefaults] boolForKey:@"HUD_ShowRender3DFPS"]];
[[self view] setIsHUDFrameIndexVisible:[[NSUserDefaults standardUserDefaults] boolForKey:@"HUD_ShowFrameIndex"]];
[[self view] setIsHUDLagFrameCountVisible:[[NSUserDefaults standardUserDefaults] boolForKey:@"HUD_ShowLagFrameCount"]];
// TODO: Show HUD Input and RTC.
[[self view] setIsHUDRealTimeClockVisible:[[NSUserDefaults standardUserDefaults] boolForKey:@"HUD_ShowRTC"]];
// TODO: Show HUD Input.
//[[self view] setIsHUDInputVisible:[[NSUserDefaults standardUserDefaults] boolForKey:@"HUD_ShowInput"]];
//[[self view] setIsHUDRealTimeClockVisible:[[NSUserDefaults standardUserDefaults] boolForKey:@"HUD_ShowRTC"]];
}
- (NSSize) normalSize
@ -742,7 +742,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
- (IBAction) toggleShowHUDRealTimeClock:(id)sender
{
//[[self view] setIsHUDRealTimeClockVisible:![[self view] isHUDRealTimeClockVisible]];
[[self view] setIsHUDRealTimeClockVisible:![[self view] isHUDRealTimeClockVisible]];
}
- (IBAction) toggleKeepMinDisplaySizeAtNormal:(id)sender
@ -935,9 +935,9 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
[[NSUserDefaults standardUserDefaults] setBool:[[self view] isHUDRender3DFPSVisible] forKey:@"HUD_ShowRender3DFPS"];
[[NSUserDefaults standardUserDefaults] setBool:[[self view] isHUDFrameIndexVisible] forKey:@"HUD_ShowFrameIndex"];
[[NSUserDefaults standardUserDefaults] setBool:[[self view] isHUDLagFrameCountVisible] forKey:@"HUD_ShowLagFrameCount"];
// TODO: Show HUD Input and RTC.
[[NSUserDefaults standardUserDefaults] setBool:[[self view] isHUDRealTimeClockVisible] forKey:@"HUD_ShowRTC"];
// TODO: Show HUD Input.
//[[NSUserDefaults standardUserDefaults] setBool:[[self view] isHUDInputVisible] forKey:@"HUD_ShowInput"];
//[[NSUserDefaults standardUserDefaults] setBool:[[self view] isHUDRealTimeClockVisible] forKey:@"HUD_ShowRTC"];
}
- (IBAction) writeDefaultsDisplayVideoSettings:(id)sender
@ -1122,6 +1122,13 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
[(NSMenuItem *)theItem setState:([[self view] isHUDLagFrameCountVisible]) ? NSOnState : NSOffState];
}
}
else if (theAction == @selector(toggleShowHUDRealTimeClock:))
{
if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
{
[(NSMenuItem *)theItem setState:([[self view] isHUDRealTimeClockVisible]) ? NSOnState : NSOffState];
}
}
else if (theAction == @selector(toggleStatusBar:))
{
if ([(id)theItem isMemberOfClass:[NSMenuItem class]])
@ -1371,6 +1378,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
@dynamic isHUDRender3DFPSVisible;
@dynamic isHUDFrameIndexVisible;
@dynamic isHUDLagFrameCountVisible;
@dynamic isHUDRealTimeClockVisible;
@dynamic useVerticalSync;
@dynamic videoFiltersPreferGPU;
@dynamic sourceDeposterize;
@ -1585,6 +1593,28 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
return theState;
}
- (void) setIsHUDRealTimeClockVisible:(BOOL)theState
{
OSSpinLockLock(&spinlockIsHUDVisible);
CGLLockContext(cglDisplayContext);
CGLSetCurrentContext(cglDisplayContext);
oglv->GetHUDLayer()->SetShowRTC((theState) ? true : false);
[self drawVideoFrame];
CGLUnlockContext(cglDisplayContext);
OSSpinLockUnlock(&spinlockIsHUDVisible);
}
- (BOOL) isHUDRealTimeClockVisible
{
OSSpinLockLock(&spinlockIsHUDVisible);
const BOOL theState = (oglv->GetHUDLayer()->GetShowRTC()) ? YES : NO;
OSSpinLockUnlock(&spinlockIsHUDVisible);
return theState;
}
- (void) setUseVerticalSync:(BOOL)theState
{
OSSpinLockLock(&spinlockUseVerticalSync);
@ -2045,7 +2075,8 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
hudLayer->SetInfo(frameInfo.videoFPS,
frameInfo.render3DFPS,
frameInfo.frameIndex,
frameInfo.lagFrameCount);
frameInfo.lagFrameCount,
frameInfo.rtcString);
hudLayer->ProcessOGL();
}

View File

@ -632,9 +632,9 @@
const BOOL hudShowRender3DFPS = [(NSNumber *)[windowProperties valueForKey:@"hudShowRender3DFPS"] boolValue];
const BOOL hudShowFrameIndex = [(NSNumber *)[windowProperties valueForKey:@"hudShowFrameIndex"] boolValue];
const BOOL hudShowLagFrameCount = [(NSNumber *)[windowProperties valueForKey:@"hudShowLagFrameCount"] boolValue];
// TODO: Show HUD Input and RTC.
const BOOL hudShowRTC = [(NSNumber *)[windowProperties valueForKey:@"hudShowRTC"] boolValue];
// TODO: Show HUD Input.
//const BOOL hudShowInput = [(NSNumber *)[windowProperties valueForKey:@"hudShowInput"] boolValue];
//const BOOL hudShowRTC = [(NSNumber *)[windowProperties valueForKey:@"hudShowRTC"] boolValue];
const NSInteger screenshotFileFormat = [(NSNumber *)[windowProperties valueForKey:@"screenshotFileFormat"] integerValue];
const BOOL useVerticalSync = [(NSNumber *)[windowProperties valueForKey:@"useVerticalSync"] boolValue];
@ -670,6 +670,7 @@
[[windowController view] setIsHUDRender3DFPSVisible:hudShowRender3DFPS];
[[windowController view] setIsHUDFrameIndexVisible:hudShowFrameIndex];
[[windowController view] setIsHUDLagFrameCountVisible:hudShowLagFrameCount];
[[windowController view] setIsHUDRealTimeClockVisible:hudShowRTC];
[[windowController masterWindow] setFrameOrigin:NSMakePoint(frameX, frameY)];
@ -741,6 +742,7 @@
[NSNumber numberWithBool:[[windowController view] isHUDRender3DFPSVisible]], @"hudShowRender3DFPS",
[NSNumber numberWithBool:[[windowController view] isHUDFrameIndexVisible]], @"hudShowFrameIndex",
[NSNumber numberWithBool:[[windowController view] isHUDLagFrameCountVisible]], @"hudShowLagFrameCount",
[NSNumber numberWithBool:[[windowController view] isHUDRealTimeClockVisible]], @"hudShowRTC",
[NSNumber numberWithBool:[windowController isMinSizeNormal]], @"isMinSizeNormal",
[NSNumber numberWithBool:[windowController isShowingStatusBar]], @"isShowingStatusBar",
[NSNumber numberWithBool:isInFullScreenMode], @"isInFullScreenMode",
@ -748,9 +750,8 @@
windowFrameStr, @"windowFrame",
nil];
// TODO: Show HUD Input and RTC.
// TODO: Show HUD Input.
//[NSNumber numberWithBool:[[windowController view] isHUDInputVisible]], @"hudShowInput",
//[NSNumber numberWithBool:[[windowController view] isHUDRealTimeClockVisible]], @"hudShowRTC",
[windowPropertiesList addObject:windowProperties];
}

View File

@ -116,6 +116,21 @@ DateTime rtcGetTime(void)
}
}
void rtcGetTimeAsString(char *buffer)
{
static const char *wday[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
const DateTime rtcTime = rtcGetTime();
snprintf(buffer, 25, "%04d-%3s-%02d %s %02d:%02d:%02d",
rtcTime.get_Year(),
DateTime::GetNameOfMonth(rtcTime.get_Month()),
rtcTime.get_Day(),
wday[rtcTime.get_DayOfWeek()%7],
rtcTime.get_Hour(),
rtcTime.get_Minute(),
rtcTime.get_Second());
}
static void rtcRecv()
{
//INFO("RTC Read command 0x%02X\n", (rtc.cmd >> 1));

View File

@ -25,6 +25,7 @@
#include "utils/datetime.h"
DateTime rtcGetTime(void);
void rtcGetTimeAsString(char *buffer);
extern void rtcInit();
extern u16 rtcRead();