Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Limelight/Database/DataManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
framerate:(NSInteger)framerate
height:(NSInteger)height
width:(NSInteger)width
audioConfig:(NSInteger)audioConfig
audioConfig:(NSInteger)audioConfig
onscreenControls:(NSInteger)onscreenControls
relativeTouchSensitivity:(float)relativeTouchSensitivity
optimizeGames:(BOOL)optimizeGames
multiController:(BOOL)multiController
swapABXYButtons:(BOOL)swapABXYButtons
Expand Down
2 changes: 2 additions & 0 deletions Limelight/Database/DataManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ - (void) saveSettingsWithBitrate:(NSInteger)bitrate
width:(NSInteger)width
audioConfig:(NSInteger)audioConfig
onscreenControls:(NSInteger)onscreenControls
relativeTouchSensitivity:(float)relativeTouchSensitivity
optimizeGames:(BOOL)optimizeGames
multiController:(BOOL)multiController
swapABXYButtons:(BOOL)swapABXYButtons
Expand Down Expand Up @@ -87,6 +88,7 @@ - (void) saveSettingsWithBitrate:(NSInteger)bitrate
settingsToSave.btMouseSupport = btMouseSupport;
settingsToSave.absoluteTouchMode = absoluteTouchMode;
settingsToSave.statsOverlay = statsOverlay;
settingsToSave.relativeTouchSensitivity = [NSNumber numberWithFloat:relativeTouchSensitivity];

[self saveData];
}];
Expand Down
1 change: 1 addition & 0 deletions Limelight/Database/TemporarySettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
@property (nonatomic, retain) NSNumber * width;
@property (nonatomic, retain) NSNumber * audioConfig;
@property (nonatomic, retain) NSNumber * onscreenControls;
@property (nonatomic, retain) NSNumber * relativeTouchSensitivity;
@property (nonatomic, retain) NSString * uniqueId;
@property (nonatomic) BOOL useHevc;
@property (nonatomic) BOOL useFramePacing;
Expand Down
2 changes: 2 additions & 0 deletions Limelight/Database/TemporarySettings.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ - (id) initFromSettings:(Settings*)settings {
self.swapABXYButtons = [[NSUserDefaults standardUserDefaults] boolForKey:@"swapABXYButtons"];
self.btMouseSupport = [[NSUserDefaults standardUserDefaults] boolForKey:@"btMouseSupport"];
self.statsOverlay = [[NSUserDefaults standardUserDefaults] boolForKey:@"statsOverlay"];
self.relativeTouchSensitivity = [NSNumber numberWithFloat:[[NSUserDefaults standardUserDefaults] floatForKey:@"relativeTouchSensitivity"]];

NSInteger _screenSize = [[NSUserDefaults standardUserDefaults] integerForKey:@"streamResolution"];
switch (_screenSize) {
Expand Down Expand Up @@ -85,6 +86,7 @@ - (id) initFromSettings:(Settings*)settings {
self.btMouseSupport = settings.btMouseSupport;
self.absoluteTouchMode = settings.absoluteTouchMode;
self.statsOverlay = settings.statsOverlay;
self.relativeTouchSensitivity = settings.relativeTouchSensitivity;
#endif
self.uniqueId = settings.uniqueId;

Expand Down
2 changes: 1 addition & 1 deletion Limelight/Input/RelativeTouchHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ NS_ASSUME_NONNULL_BEGIN

@interface RelativeTouchHandler : UIResponder

-(id)initWithView:(StreamView*)view;
-(id)initWithView:(StreamView*)view sensitivityMultiplier:(float)sensitivityMultiplier;

@end

Expand Down
8 changes: 5 additions & 3 deletions Limelight/Input/RelativeTouchHandler.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ @implementation RelativeTouchHandler {
#endif

UIView* view;
float sensitivityMultiplier;
}

- (id)initWithView:(StreamView*)view {
- (id)initWithView:(StreamView*)view sensitivityMultiplier:(float)sensitivityMultiplier{
self = [self init];
self->view = view;
self->sensitivityMultiplier = sensitivityMultiplier;

#if TARGET_OS_TV
remotePressRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(remoteButtonPressed:)];
Expand Down Expand Up @@ -88,8 +90,8 @@ - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
if (touchLocation.x != currentLocation.x ||
touchLocation.y != currentLocation.y)
{
int deltaX = (currentLocation.x - touchLocation.x) * (REFERENCE_WIDTH / view.bounds.size.width);
int deltaY = (currentLocation.y - touchLocation.y) * (REFERENCE_HEIGHT / view.bounds.size.height);
int deltaX = (currentLocation.x - touchLocation.x) * (REFERENCE_WIDTH / view.bounds.size.width) * sensitivityMultiplier;
int deltaY = (currentLocation.y - touchLocation.y) * (REFERENCE_HEIGHT / view.bounds.size.height) * sensitivityMultiplier;

if (deltaX != 0 || deltaY != 0) {
LiSendMouseMoveEvent(deltaX, deltaY);
Expand Down
4 changes: 2 additions & 2 deletions Limelight/Input/StreamView.m
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ - (void) setupStreamView:(ControllerSupport*)controllerSupport

#if TARGET_OS_TV
// tvOS requires RelativeTouchHandler to manage Apple Remote input
self->touchHandler = [[RelativeTouchHandler alloc] initWithView:self];
self->touchHandler = [[RelativeTouchHandler alloc] initWithView:self sensitivityMultiplier:streamConfig.relativeTouchSensitivity];
#else
// iOS uses RelativeTouchHandler or AbsoluteTouchHandler depending on user preference
if (settings.absoluteTouchMode) {
self->touchHandler = [[AbsoluteTouchHandler alloc] initWithView:self];
}
else {
self->touchHandler = [[RelativeTouchHandler alloc] initWithView:self];
self->touchHandler = [[RelativeTouchHandler alloc] initWithView:self sensitivityMultiplier:streamConfig.relativeTouchSensitivity];
}

onScreenControls = [[OnScreenControls alloc] initWithView:self controllerSup:controllerSupport streamConfig:streamConfig];
Expand Down
2 changes: 1 addition & 1 deletion Limelight/Limelight.xcdatamodeld/.xccurrentversion
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<plist version="1.0">
<dict>
<key>_XCCurrentVersionName</key>
<string>Moonlight v1.9.xcdatamodel</string>
<string>Moonlight v1.10.xcdatamodel</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="20086" systemVersion="21G419" minimumToolsVersion="Xcode 7.3" sourceLanguage="Objective-C" userDefinedModelVersionIdentifier="">
<entity name="App" representedClassName="App" syncable="YES" codeGenerationType="class">
<attribute name="hdrSupported" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES" syncable="YES"/>
<attribute name="hidden" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES" syncable="YES"/>
<attribute name="id" attributeType="String" syncable="YES"/>
<attribute name="name" attributeType="String" syncable="YES"/>
<relationship name="host" maxCount="1" deletionRule="Nullify" destinationEntity="Host" inverseName="appList" inverseEntity="Host" syncable="YES"/>
</entity>
<entity name="Host" representedClassName="Host" syncable="YES" codeGenerationType="class">
<attribute name="address" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="externalAddress" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="ipv6Address" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="localAddress" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="mac" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="name" attributeType="String" syncable="YES"/>
<attribute name="pairState" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="NO" syncable="YES"/>
<attribute name="serverCert" optional="YES" attributeType="Binary" syncable="YES"/>
<attribute name="serverCodecModeSupport" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
<attribute name="uuid" optional="YES" attributeType="String" syncable="YES"/>
<relationship name="appList" optional="YES" toMany="YES" deletionRule="Cascade" destinationEntity="App" inverseName="host" inverseEntity="App" syncable="YES"/>
</entity>
<entity name="Settings" representedClassName="Settings" syncable="YES" codeGenerationType="class">
<attribute name="absoluteTouchMode" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES" syncable="YES"/>
<attribute name="audioConfig" attributeType="Integer 32" defaultValueString="2" usesScalarValueType="NO" syncable="YES"/>
<attribute name="bitrate" attributeType="Integer 32" defaultValueString="10000" usesScalarValueType="NO" syncable="YES"/>
<attribute name="btMouseSupport" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES" syncable="YES"/>
<attribute name="enableHdr" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES" syncable="YES"/>
<attribute name="framerate" attributeType="Integer 32" defaultValueString="60" usesScalarValueType="NO" syncable="YES"/>
<attribute name="height" attributeType="Integer 32" defaultValueString="720" usesScalarValueType="NO" syncable="YES"/>
<attribute name="multiController" attributeType="Boolean" defaultValueString="YES" usesScalarValueType="YES" syncable="YES"/>
<attribute name="onscreenControls" attributeType="Integer 32" defaultValueString="1" usesScalarValueType="NO" syncable="YES"/>
<attribute name="optimizeGames" attributeType="Boolean" defaultValueString="YES" usesScalarValueType="YES" syncable="YES"/>
<attribute name="playAudioOnPC" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES" syncable="YES"/>
<attribute name="relativeTouchSensitivity" attributeType="Float" defaultValueString="1" usesScalarValueType="NO" syncable="YES"/>
<attribute name="statsOverlay" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES" syncable="YES"/>
<attribute name="swapABXYButtons" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES" syncable="YES"/>
<attribute name="uniqueId" attributeType="String" syncable="YES"/>
<attribute name="useFramePacing" attributeType="Boolean" defaultValueString="NO" usesScalarValueType="YES" syncable="YES"/>
<attribute name="useHevc2" attributeType="Boolean" defaultValueString="YES" usesScalarValueType="YES" syncable="YES"/>
<attribute name="width" attributeType="Integer 32" defaultValueString="1280" usesScalarValueType="NO" syncable="YES"/>
</entity>
<elements>
<element name="App" positionX="0" positionY="54" width="128" height="118"/>
<element name="Host" positionX="0" positionY="0" width="128" height="210"/>
<element name="Settings" positionX="0" positionY="0" width="128" height="299"/>
</elements>
</model>
1 change: 1 addition & 0 deletions Limelight/Stream/StreamConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
@property int audioConfiguration;
@property BOOL enableHdr;
@property BOOL multiController;
@property float relativeTouchSensitivity;
@property BOOL allowHevc;
@property BOOL useFramePacing;
@property NSData* serverCert;
Expand Down
2 changes: 2 additions & 0 deletions Limelight/ViewControllers/MainFrameViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,8 @@ - (void) prepareToStreamApp:(TemporaryApp *)app {

_streamConfig.height = [streamSettings.height intValue];
_streamConfig.width = [streamSettings.width intValue];

_streamConfig.relativeTouchSensitivity = [streamSettings.relativeTouchSensitivity floatValue];
#if TARGET_OS_TV
// Don't allow streaming 4K on the Apple TV HD
struct utsname systemInfo;
Expand Down
11 changes: 11 additions & 0 deletions Limelight/ViewControllers/SettingsViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
@property (strong, nonatomic) IBOutlet UISegmentedControl *resolutionSelector;
@property (strong, nonatomic) IBOutlet UISegmentedControl *touchModeSelector;
@property (strong, nonatomic) IBOutlet UISegmentedControl *onscreenControlSelector;
@property (strong, nonatomic) IBOutlet UILabel *touchpadSensitivityLabel;
@property (strong, nonatomic) IBOutlet UISlider *touchpadSensitivitySlider;
@property (strong, nonatomic) IBOutlet UISegmentedControl *optimizeSettingsSelector;
@property (strong, nonatomic) IBOutlet UISegmentedControl *multiControllerSelector;
@property (strong, nonatomic) IBOutlet UISegmentedControl *swapABXYButtonsSelector;
Expand All @@ -26,6 +28,7 @@
@property (strong, nonatomic) IBOutlet UISegmentedControl *btMouseSelector;
@property (strong, nonatomic) IBOutlet UISegmentedControl *statsOverlaySelector;
@property (strong, nonatomic) IBOutlet UIScrollView *scrollView;
@property UIImpactFeedbackGenerator *impactFeedbackGenerator;

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunguarded-availability"
Expand All @@ -38,3 +41,11 @@
- (void) saveSettings;

@end

/// Performs linear interpolation between [0, 1] and [a, b] through t.
///
/// Source: https://stackoverflow.com/a/1820951
UIKIT_STATIC_INLINE float lerpf(float a, float b, float t)
{
return a + (b - a) * t;
}
Loading