Cocoa Port: Fix a bunch of HUD coloring issues on PowerPC Macs.
- Also fix a display backlight intensity issue on big-endian systems.
This commit is contained in:
parent
c31a5717ab
commit
ba6e8e0bab
|
@ -777,11 +777,11 @@ typedef union
|
|||
u8 MainBacklight_Enable:1; // 3: Main display backlight; 0=Disable, 1=Enable
|
||||
u8 PowerLEDBlink_Enable:1; // 4: Power LED blink control; 0=Disable (Power LED remains steadily ON), 1=Enable
|
||||
u8 PowerLEDBlinkSpeed:1; // 5: Power LED blink speed when enabled; 0=Slow, 1=Fast
|
||||
u8 SystemPowerState:2; // 6: NDS system power state; 0=System is powered ON, 1=System is powered OFF
|
||||
u8 SystemPowerState:1; // 6: NDS system power state; 0=System is powered ON, 1=System is powered OFF
|
||||
u8 :1; // 7: Unused bit (should always be read as 0)
|
||||
#else
|
||||
u8 :1; // 7: Unused bit (should always be read as 0)
|
||||
u8 SystemPowerState:2; // 6: NDS system power state; 0=System is powered ON, 1=System is powered OFF
|
||||
u8 SystemPowerState:1; // 6: NDS system power state; 0=System is powered ON, 1=System is powered OFF
|
||||
u8 PowerLEDBlinkSpeed:1; // 5: Power LED blink speed when enabled; 0=Slow, 1=Fast
|
||||
u8 PowerLEDBlink_Enable:1; // 4: Power LED blink control; 0=Disable (LED is steady ON), 1=Enable
|
||||
u8 MainBacklight_Enable:1; // 3: Main display backlight; 0=Disable, 1=Enable
|
||||
|
|
|
@ -89,15 +89,15 @@ void ClientDisplayPresenter::__InstanceInit(const ClientDisplayPresenterProperti
|
|||
_showRTC = false;
|
||||
_showInputs = false;
|
||||
|
||||
_hudColorVideoFPS = 0xFFFFFFFF;
|
||||
_hudColorRender3DFPS = 0xFFFFFFFF;
|
||||
_hudColorFrameIndex = 0xFFFFFFFF;
|
||||
_hudColorLagFrameCount = 0xFFFFFFFF;
|
||||
_hudColorCPULoadAverage = 0xFFFFFFFF;
|
||||
_hudColorRTC = 0xFFFFFFFF;
|
||||
_hudColorInputAppliedAndPending = 0xFFFFFFFF;
|
||||
_hudColorInputAppliedOnly = 0xFF3030FF;
|
||||
_hudColorInputPendingOnly = 0xFF00C000;
|
||||
_hudColorVideoFPS = LE_TO_LOCAL_32(0xFFFFFFFF);
|
||||
_hudColorRender3DFPS = LE_TO_LOCAL_32(0xFFFFFFFF);
|
||||
_hudColorFrameIndex = LE_TO_LOCAL_32(0xFFFFFFFF);
|
||||
_hudColorLagFrameCount = LE_TO_LOCAL_32(0xFFFFFFFF);
|
||||
_hudColorCPULoadAverage = LE_TO_LOCAL_32(0xFFFFFFFF);
|
||||
_hudColorRTC = LE_TO_LOCAL_32(0xFFFFFFFF);
|
||||
_hudColorInputAppliedAndPending = LE_TO_LOCAL_32(0xFFFFFFFF);
|
||||
_hudColorInputAppliedOnly = LE_TO_LOCAL_32(0xFF3030FF);
|
||||
_hudColorInputPendingOnly = LE_TO_LOCAL_32(0xFF00C000);
|
||||
|
||||
_clientFrameInfo.videoFPS = 0;
|
||||
_ndsFrameInfo.clear();
|
||||
|
@ -755,7 +755,7 @@ uint32_t ClientDisplayPresenter::GetInputColorUsingStates(bool pendingState, boo
|
|||
}
|
||||
else
|
||||
{
|
||||
color = 0x80808080;
|
||||
color = LE_TO_LOCAL_32(0x80808080);
|
||||
}
|
||||
|
||||
return color;
|
||||
|
@ -1785,7 +1785,7 @@ void ClientDisplay3DPresenter::SetHUDColorVertices(uint32_t *vtxColorBufferPtr)
|
|||
|
||||
const char *cString = hudString.c_str();
|
||||
const size_t textLength = (hudString.length() <= HUD_TEXT_MAX_CHARACTERS) ? hudString.length() : HUD_TEXT_MAX_CHARACTERS;
|
||||
uint32_t currentColor = 0x40000000;
|
||||
uint32_t currentColor = LE_TO_LOCAL_32(0x40000000);
|
||||
|
||||
// First, calculate the color of the text box.
|
||||
// The text box should always be the first character in the string.
|
||||
|
@ -1917,7 +1917,7 @@ void ClientDisplay3DPresenter::SetHUDColorVertices(uint32_t *vtxColorBufferPtr)
|
|||
vtxColorBufferPtr[j+3] = inputColors[k]; // Bottom Left
|
||||
}
|
||||
|
||||
touchColor = ((this->_ndsFrameInfo.inputStatesPending.Touch != 0) && (this->_ndsFrameInfo.inputStatesApplied.Touch != 0)) ? 0x00000000 : (touchColor & 0x00FFFFFF) | (0x60000000);
|
||||
touchColor = ((this->_ndsFrameInfo.inputStatesPending.Touch != 0) && (this->_ndsFrameInfo.inputStatesApplied.Touch != 0)) ? 0x00000000 : (touchColor & LE_TO_LOCAL_32(0x00FFFFFF)) | LE_TO_LOCAL_32(0x60000000);
|
||||
|
||||
for (size_t k = 0; k < HUD_INPUT_TOUCH_LINE_ELEMENTS; i++, j+=4, k++)
|
||||
{
|
||||
|
|
|
@ -227,7 +227,7 @@ void ClientInputHandler::SetClientInputStateUsingID(NDSInputID inputID, bool pre
|
|||
if (this->_execControl != NULL)
|
||||
{
|
||||
NDSFrameInfo &frameInfoMutable = (NDSFrameInfo &)this->_execControl->GetNDSFrameInfo();
|
||||
const uint64_t bitValue = (1 << this->_inputStateBitMap[inputID]);
|
||||
const uint64_t bitValue = LOCAL_TO_LE_64(1ULL << this->_inputStateBitMap[inputID]);
|
||||
|
||||
frameInfoMutable.inputStatesPending.value = (this->_clientInputPending[inputID].isPressed) ? frameInfoMutable.inputStatesPending.value & ~bitValue : frameInfoMutable.inputStatesPending.value | bitValue;
|
||||
}
|
||||
|
|
|
@ -158,10 +158,17 @@ static NSDate *distantFutureDate = [[NSDate distantFuture] retain];
|
|||
|
||||
+ (NSColor *) NSColorFromRGBA8888:(uint32_t)theColor
|
||||
{
|
||||
#ifdef MSB_FIRST
|
||||
const CGFloat a = (CGFloat)((theColor >> 0) & 0xFF) / 255.0f;
|
||||
const CGFloat b = (CGFloat)((theColor >> 8) & 0xFF) / 255.0f;
|
||||
const CGFloat g = (CGFloat)((theColor >> 16) & 0xFF) / 255.0f;
|
||||
const CGFloat r = (CGFloat)((theColor >> 24) & 0xFF) / 255.0f;
|
||||
#else
|
||||
const CGFloat r = (CGFloat)((theColor >> 0) & 0xFF) / 255.0f;
|
||||
const CGFloat g = (CGFloat)((theColor >> 8) & 0xFF) / 255.0f;
|
||||
const CGFloat b = (CGFloat)((theColor >> 16) & 0xFF) / 255.0f;
|
||||
const CGFloat a = (CGFloat)((theColor >> 24) & 0xFF) / 255.0f;
|
||||
#endif
|
||||
|
||||
return [NSColor colorWithDeviceRed:r green:g blue:b alpha:a];
|
||||
}
|
||||
|
@ -180,10 +187,17 @@ static NSDate *distantFutureDate = [[NSDate distantFuture] retain];
|
|||
CGFloat r, g, b, a;
|
||||
[theColor getRed:&r green:&g blue:&b alpha:&a];
|
||||
|
||||
#ifdef MSB_FIRST
|
||||
return (((uint32_t)(a * 255.0f)) << 0) |
|
||||
(((uint32_t)(b * 255.0f)) << 8) |
|
||||
(((uint32_t)(g * 255.0f)) << 16) |
|
||||
(((uint32_t)(r * 255.0f)) << 24);
|
||||
#else
|
||||
return (((uint32_t)(r * 255.0f)) << 0) |
|
||||
(((uint32_t)(g * 255.0f)) << 8) |
|
||||
(((uint32_t)(b * 255.0f)) << 16) |
|
||||
(((uint32_t)(a * 255.0f)) << 24);
|
||||
#endif
|
||||
}
|
||||
|
||||
+ (NSInteger) appVersionNumeric
|
||||
|
@ -425,6 +439,7 @@ static NSDate *distantFutureDate = [[NSDate distantFuture] retain];
|
|||
[NSException raise:NSInternalInconsistencyException format:@"Value (%@) does not respond to -unsignedIntegerValue, -unsignedIntValue, -integerValue or -intValue.", [value class]];
|
||||
}
|
||||
|
||||
color32 = LE_TO_LOCAL_32(color32);
|
||||
return [CocoaDSUtil NSColorFromRGBA8888:color32];
|
||||
}
|
||||
|
||||
|
@ -443,6 +458,7 @@ static NSDate *distantFutureDate = [[NSDate distantFuture] retain];
|
|||
}
|
||||
|
||||
color32 = [CocoaDSUtil RGBA8888FromNSColor:(NSColor *)value];
|
||||
color32 = LE_TO_LOCAL_32(color32);
|
||||
return [NSNumber numberWithUnsignedInteger:color32];
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2013-2015 DeSmuME team
|
||||
Copyright (C) 2013-2017 DeSmuME team
|
||||
|
||||
This file is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include <AvailabilityMacros.h>
|
||||
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_5
|
||||
#if defined(MAC_OS_X_VERSION_10_6) && (MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_5)
|
||||
|
||||
#include <ostream>
|
||||
#include <istream>
|
||||
|
|
|
@ -493,12 +493,12 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
|
|||
[[self view] setIsHUDRealTimeClockVisible:[[NSUserDefaults standardUserDefaults] boolForKey:@"HUD_ShowRTC"]];
|
||||
[[self view] setIsHUDInputVisible:[[NSUserDefaults standardUserDefaults] boolForKey:@"HUD_ShowInput"]];
|
||||
|
||||
[[self view] setHudColorVideoFPS:[CocoaDSUtil NSColorFromRGBA8888:[[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_VideoFPS"]]];
|
||||
[[self view] setHudColorRender3DFPS:[CocoaDSUtil NSColorFromRGBA8888:[[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_Render3DFPS"]]];
|
||||
[[self view] setHudColorFrameIndex:[CocoaDSUtil NSColorFromRGBA8888:[[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_FrameIndex"]]];
|
||||
[[self view] setHudColorLagFrameCount:[CocoaDSUtil NSColorFromRGBA8888:[[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_LagFrameCount"]]];
|
||||
[[self view] setHudColorCPULoadAverage:[CocoaDSUtil NSColorFromRGBA8888:[[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_CPULoadAverage"]]];
|
||||
[[self view] setHudColorRTC:[CocoaDSUtil NSColorFromRGBA8888:[[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_RTC"]]];
|
||||
[[self view] setHudColorVideoFPS:[CocoaDSUtil NSColorFromRGBA8888:LE_TO_LOCAL_32([[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_VideoFPS"])]];
|
||||
[[self view] setHudColorRender3DFPS:[CocoaDSUtil NSColorFromRGBA8888:LE_TO_LOCAL_32([[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_Render3DFPS"])]];
|
||||
[[self view] setHudColorFrameIndex:[CocoaDSUtil NSColorFromRGBA8888:LE_TO_LOCAL_32([[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_FrameIndex"])]];
|
||||
[[self view] setHudColorLagFrameCount:[CocoaDSUtil NSColorFromRGBA8888:LE_TO_LOCAL_32([[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_LagFrameCount"])]];
|
||||
[[self view] setHudColorCPULoadAverage:[CocoaDSUtil NSColorFromRGBA8888:LE_TO_LOCAL_32([[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_CPULoadAverage"])]];
|
||||
[[self view] setHudColorRTC:[CocoaDSUtil NSColorFromRGBA8888:LE_TO_LOCAL_32([[NSUserDefaults standardUserDefaults] integerForKey:@"HUD_Color_RTC"])]];
|
||||
}
|
||||
|
||||
- (BOOL) masterStatusBarState
|
||||
|
|
Loading…
Reference in New Issue