diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bd9f093 --- /dev/null +++ b/.gitignore @@ -0,0 +1,24 @@ +# OS X +.DS_Store + +# Xcode +build/ +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata +*.xccheckout +profile +*.moved-aside +DerivedData +*.hmap +*.ipa + +# CocoaPods +Pods + diff --git a/README.md b/README.md new file mode 100644 index 0000000..53a9b5b --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# RSInjector + +Rocksmith 2014 uses a DSA signature to verify the authenticity of songs. +This app is a runtime patch for Rocksmith 2014 OSX which allows playing +custom CDLC content. + +See [http://forums.smithyanvil.com/](http://forums.smithyanvil.com/) for more info diff --git a/RS2014.icns b/RS2014.icns new file mode 100755 index 0000000..71cba21 Binary files /dev/null and b/RS2014.icns differ diff --git a/RSBypass/RSBypass.xcodeproj/project.pbxproj b/RSBypass/RSBypass.xcodeproj/project.pbxproj new file mode 100644 index 0000000..5a73043 --- /dev/null +++ b/RSBypass/RSBypass.xcodeproj/project.pbxproj @@ -0,0 +1,251 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 43D7132E1829382F0089274E /* RSBypass-Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = 43D71327182937A10089274E /* RSBypass-Prefix.pch */; }; + 43D7132F182938310089274E /* RSBypass.h in Headers */ = {isa = PBXBuildFile; fileRef = 43D71328182937A10089274E /* RSBypass.h */; }; + 43D713301829383C0089274E /* RSBypass.m in Sources */ = {isa = PBXBuildFile; fileRef = 43D71329182937A10089274E /* RSBypass.m */; }; + FA88A0861680711D00915B81 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA88A0851680711D00915B81 /* Cocoa.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 43D71327182937A10089274E /* RSBypass-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "RSBypass-Prefix.pch"; path = "RSBypass/RSBypass-Prefix.pch"; sourceTree = SOURCE_ROOT; }; + 43D71328182937A10089274E /* RSBypass.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RSBypass.h; path = RSBypass/RSBypass.h; sourceTree = SOURCE_ROOT; }; + 43D71329182937A10089274E /* RSBypass.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RSBypass.m; path = RSBypass/RSBypass.m; sourceTree = SOURCE_ROOT; }; + FA88A0821680711D00915B81 /* RSBypass.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = RSBypass.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; + FA88A0851680711D00915B81 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; + FA88A0881680711D00915B81 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; + FA88A08A1680711D00915B81 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + FA88A07F1680711D00915B81 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + FA88A0861680711D00915B81 /* Cocoa.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + FA88A0771680711D00915B81 = { + isa = PBXGroup; + children = ( + FA88A08B1680711D00915B81 /* RSBypass */, + FA88A0841680711D00915B81 /* Frameworks */, + FA88A0831680711D00915B81 /* Products */, + ); + sourceTree = ""; + }; + FA88A0831680711D00915B81 /* Products */ = { + isa = PBXGroup; + children = ( + FA88A0821680711D00915B81 /* RSBypass.dylib */, + ); + name = Products; + sourceTree = ""; + }; + FA88A0841680711D00915B81 /* Frameworks */ = { + isa = PBXGroup; + children = ( + FA88A08A1680711D00915B81 /* Foundation.framework */, + FA88A0881680711D00915B81 /* AppKit.framework */, + FA88A0851680711D00915B81 /* Cocoa.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + FA88A08B1680711D00915B81 /* RSBypass */ = { + isa = PBXGroup; + children = ( + 43D71327182937A10089274E /* RSBypass-Prefix.pch */, + 43D71328182937A10089274E /* RSBypass.h */, + 43D71329182937A10089274E /* RSBypass.m */, + ); + name = RSBypass; + path = CalculatorOverrides; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + FA88A0801680711D00915B81 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 43D7132F182938310089274E /* RSBypass.h in Headers */, + 43D7132E1829382F0089274E /* RSBypass-Prefix.pch in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + FA88A0811680711D00915B81 /* RSBypass */ = { + isa = PBXNativeTarget; + buildConfigurationList = FA88A0931680711D00915B81 /* Build configuration list for PBXNativeTarget "RSBypass" */; + buildPhases = ( + FA88A07E1680711D00915B81 /* Sources */, + FA88A07F1680711D00915B81 /* Frameworks */, + FA88A0801680711D00915B81 /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = RSBypass; + productName = CalculatorOverrides; + productReference = FA88A0821680711D00915B81 /* RSBypass.dylib */; + productType = "com.apple.product-type.library.dynamic"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + FA88A0791680711D00915B81 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0450; + ORGANIZATIONNAME = "Alexandre Colucci"; + }; + buildConfigurationList = FA88A07C1680711D00915B81 /* Build configuration list for PBXProject "RSBypass" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = FA88A0771680711D00915B81; + productRefGroup = FA88A0831680711D00915B81 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + FA88A0811680711D00915B81 /* RSBypass */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + FA88A07E1680711D00915B81 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 43D713301829383C0089274E /* RSBypass.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + FA88A0911680711D00915B81 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.8; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx10.8; + VALID_ARCHS = i386; + }; + name = Debug; + }; + FA88A0921680711D00915B81 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.8; + SDKROOT = macosx10.8; + VALID_ARCHS = i386; + }; + name = Release; + }; + FA88A0941680711D00915B81 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "RSBypass/RSBypass-Prefix.pch"; + PRODUCT_NAME = RSBypass; + SDKROOT = macosx10.8; + VALID_ARCHS = i386; + }; + name = Debug; + }; + FA88A0951680711D00915B81 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "RSBypass/RSBypass-Prefix.pch"; + PRODUCT_NAME = RSBypass; + SDKROOT = macosx10.8; + VALID_ARCHS = i386; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + FA88A07C1680711D00915B81 /* Build configuration list for PBXProject "RSBypass" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FA88A0911680711D00915B81 /* Debug */, + FA88A0921680711D00915B81 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + FA88A0931680711D00915B81 /* Build configuration list for PBXNativeTarget "RSBypass" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FA88A0941680711D00915B81 /* Debug */, + FA88A0951680711D00915B81 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = FA88A0791680711D00915B81 /* Project object */; +} diff --git a/RSBypass/RSBypass.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/RSBypass/RSBypass.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..4868540 --- /dev/null +++ b/RSBypass/RSBypass.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/RSBypass/RSBypass/RSBypass-Prefix.pch b/RSBypass/RSBypass/RSBypass-Prefix.pch new file mode 100644 index 0000000..ee7b6eb --- /dev/null +++ b/RSBypass/RSBypass/RSBypass-Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the 'CalculatorOverrides' target in the 'CalculatorOverrides' project +// + +#ifdef __OBJC__ + #import +#endif diff --git a/RSBypass/RSBypass/RSBypass.h b/RSBypass/RSBypass/RSBypass.h new file mode 100644 index 0000000..fd8b507 --- /dev/null +++ b/RSBypass/RSBypass/RSBypass.h @@ -0,0 +1,5 @@ +#import + +@interface RSBypass : NSObject + +@end diff --git a/RSBypass/RSBypass/RSBypass.m b/RSBypass/RSBypass/RSBypass.m new file mode 100644 index 0000000..99f4378 --- /dev/null +++ b/RSBypass/RSBypass/RSBypass.m @@ -0,0 +1,57 @@ +#include +#include + +#import "RSBypass.h" + +typedef uint32_t DWORD; +typedef int8_t BYTE; + + +// These numbers come from otool -lv +const DWORD segStart = 0x001000; +const size_t segLen = 0x0135b000; + +// Could be made more general to bypass all signature checks +// including ini files... +// For the time being only patches the sig verif of sng files +const char* hint = "\x0f\x84\xc6\x0a\x00\x00"; + + +bool bCompare(const BYTE* pData, const BYTE * bMask, const char* szMask) { + for (; *szMask; ++szMask, ++pData, ++bMask) + if (*szMask == 'x' && *pData != *bMask) + return 0; + return (*szMask) == 0; +} + +void* FindPattern(DWORD dwAddress, size_t dwLen, BYTE* bMask, char* szMask) { + for (DWORD i = 0; i < dwLen; i++) + if (bCompare((BYTE*)(dwAddress + i), bMask, szMask)) + return (void*)(dwAddress + i); + return NULL; +} + + +@implementation RSBypass ++(void)load +{ + void* ptr = FindPattern(segStart, segLen, + (BYTE*)hint, "xxxxxx"); + if (ptr) { + + long page_size = sysconf(_SC_PAGESIZE); + void* page_start = (long)ptr & -page_size; + +// NSLog(@"Removing memory protection"); + mprotect(page_start, page_size, PROT_READ | PROT_WRITE | PROT_EXEC); + +// NSLog(@"RSInjector: Bypassing signature check at %p", ptr); + memset(ptr, 0x90, 6); + msync(ptr, 6, MS_SYNC); + + // Restoring memory protection + mprotect(page_start, page_size, PROT_READ | PROT_EXEC); + + } +} +@end diff --git a/RSInjector.xcodeproj/project.pbxproj b/RSInjector.xcodeproj/project.pbxproj new file mode 100644 index 0000000..ed2a8b5 --- /dev/null +++ b/RSInjector.xcodeproj/project.pbxproj @@ -0,0 +1,336 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 4396270118293D0900C11BA2 /* RS2014.icns in Resources */ = {isa = PBXBuildFile; fileRef = 4396270018293D0900C11BA2 /* RS2014.icns */; }; + 43D71346182939B30089274E /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 43D7133C1829398C0089274E /* AppDelegate.m */; }; + 43D71347182939B30089274E /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 43D71341182939A60089274E /* main.m */; }; + 43D71348182939CA0089274E /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 43D7133D1829398C0089274E /* MainMenu.xib */; }; + 43D7134C18293B2D0089274E /* RSBypass.dylib in Resources */ = {isa = PBXBuildFile; fileRef = 43D71337182938DB0089274E /* RSBypass.dylib */; }; + FA130E6416806E36002E4BF9 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA130E6316806E36002E4BF9 /* Cocoa.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 43D71336182938DB0089274E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 43D71332182938DB0089274E /* RSBypass.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = FA88A0821680711D00915B81; + remoteInfo = RSBypass; + }; + 43D7134D18293B4E0089274E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 43D71332182938DB0089274E /* RSBypass.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = FA88A0811680711D00915B81; + remoteInfo = RSBypass; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 4396270018293D0900C11BA2 /* RS2014.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = RS2014.icns; sourceTree = ""; }; + 43D71332182938DB0089274E /* RSBypass.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RSBypass.xcodeproj; path = RSBypass/RSBypass.xcodeproj; sourceTree = ""; }; + 43D7133B1829398C0089274E /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = RSInjector/AppDelegate.h; sourceTree = SOURCE_ROOT; }; + 43D7133C1829398C0089274E /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = RSInjector/AppDelegate.m; sourceTree = SOURCE_ROOT; }; + 43D7133E1829398C0089274E /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = RSInjector/en.lproj/MainMenu.xib; sourceTree = SOURCE_ROOT; }; + 43D71341182939A60089274E /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = RSInjector/main.m; sourceTree = SOURCE_ROOT; }; + 43D71342182939A60089274E /* RSInjector-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "RSInjector-Info.plist"; path = "RSInjector/RSInjector-Info.plist"; sourceTree = SOURCE_ROOT; }; + 43D71343182939A60089274E /* RSInjector-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "RSInjector-Prefix.pch"; path = "RSInjector/RSInjector-Prefix.pch"; sourceTree = SOURCE_ROOT; }; + FA130E5F16806E36002E4BF9 /* RSInjector.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RSInjector.app; sourceTree = BUILT_PRODUCTS_DIR; }; + FA130E6316806E36002E4BF9 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; + FA130E6616806E36002E4BF9 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; + FA130E6816806E36002E4BF9 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + FA130E5C16806E36002E4BF9 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + FA130E6416806E36002E4BF9 /* Cocoa.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 43D71333182938DB0089274E /* Products */ = { + isa = PBXGroup; + children = ( + 43D71337182938DB0089274E /* RSBypass.dylib */, + ); + name = Products; + sourceTree = ""; + }; + FA130E5416806E36002E4BF9 = { + isa = PBXGroup; + children = ( + 4396270018293D0900C11BA2 /* RS2014.icns */, + FA130E6916806E36002E4BF9 /* RSInjector */, + FA130E6216806E36002E4BF9 /* Frameworks */, + FA130E6016806E36002E4BF9 /* Products */, + 43D71332182938DB0089274E /* RSBypass.xcodeproj */, + ); + sourceTree = ""; + }; + FA130E6016806E36002E4BF9 /* Products */ = { + isa = PBXGroup; + children = ( + FA130E5F16806E36002E4BF9 /* RSInjector.app */, + ); + name = Products; + sourceTree = ""; + }; + FA130E6216806E36002E4BF9 /* Frameworks */ = { + isa = PBXGroup; + children = ( + FA130E6816806E36002E4BF9 /* Foundation.framework */, + FA130E6616806E36002E4BF9 /* AppKit.framework */, + FA130E6316806E36002E4BF9 /* Cocoa.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + FA130E6916806E36002E4BF9 /* RSInjector */ = { + isa = PBXGroup; + children = ( + 43D7133B1829398C0089274E /* AppDelegate.h */, + 43D7133C1829398C0089274E /* AppDelegate.m */, + 43D7133D1829398C0089274E /* MainMenu.xib */, + FA130E6A16806E36002E4BF9 /* Supporting Files */, + ); + name = RSInjector; + path = CalculatorLauncher; + sourceTree = ""; + }; + FA130E6A16806E36002E4BF9 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 43D71341182939A60089274E /* main.m */, + 43D71342182939A60089274E /* RSInjector-Info.plist */, + 43D71343182939A60089274E /* RSInjector-Prefix.pch */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + FA130E5E16806E36002E4BF9 /* RSInjector */ = { + isa = PBXNativeTarget; + buildConfigurationList = FA130E7D16806E36002E4BF9 /* Build configuration list for PBXNativeTarget "RSInjector" */; + buildPhases = ( + FA130E5B16806E36002E4BF9 /* Sources */, + FA130E5C16806E36002E4BF9 /* Frameworks */, + FA130E5D16806E36002E4BF9 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 43D7134E18293B4E0089274E /* PBXTargetDependency */, + ); + name = RSInjector; + productName = CalculatorLauncher; + productReference = FA130E5F16806E36002E4BF9 /* RSInjector.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + FA130E5616806E36002E4BF9 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0450; + ORGANIZATIONNAME = "Alexandre Colucci"; + }; + buildConfigurationList = FA130E5916806E36002E4BF9 /* Build configuration list for PBXProject "RSInjector" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = FA130E5416806E36002E4BF9; + productRefGroup = FA130E6016806E36002E4BF9 /* Products */; + projectDirPath = ""; + projectReferences = ( + { + ProductGroup = 43D71333182938DB0089274E /* Products */; + ProjectRef = 43D71332182938DB0089274E /* RSBypass.xcodeproj */; + }, + ); + projectRoot = ""; + targets = ( + FA130E5E16806E36002E4BF9 /* RSInjector */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXReferenceProxy section */ + 43D71337182938DB0089274E /* RSBypass.dylib */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.dylib"; + path = RSBypass.dylib; + remoteRef = 43D71336182938DB0089274E /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXReferenceProxy section */ + +/* Begin PBXResourcesBuildPhase section */ + FA130E5D16806E36002E4BF9 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 43D71348182939CA0089274E /* MainMenu.xib in Resources */, + 4396270118293D0900C11BA2 /* RS2014.icns in Resources */, + 43D7134C18293B2D0089274E /* RSBypass.dylib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + FA130E5B16806E36002E4BF9 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 43D71346182939B30089274E /* AppDelegate.m in Sources */, + 43D71347182939B30089274E /* main.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 43D7134E18293B4E0089274E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = RSBypass; + targetProxy = 43D7134D18293B4E0089274E /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 43D7133D1829398C0089274E /* MainMenu.xib */ = { + isa = PBXVariantGroup; + children = ( + 43D7133E1829398C0089274E /* en */, + ); + name = MainMenu.xib; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + FA130E7B16806E36002E4BF9 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.8; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx10.8; + VALID_ARCHS = i386; + }; + name = Debug; + }; + FA130E7C16806E36002E4BF9 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.8; + SDKROOT = macosx10.8; + VALID_ARCHS = i386; + }; + name = Release; + }; + FA130E7E16806E36002E4BF9 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + COMBINE_HIDPI_IMAGES = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "RSInjector/RSInjector-Prefix.pch"; + INFOPLIST_FILE = "$(SRCROOT)/RSInjector/RSInjector-Info.plist"; + PRODUCT_NAME = RSInjector; + SDKROOT = macosx10.8; + VALID_ARCHS = i386; + WRAPPER_EXTENSION = app; + }; + name = Debug; + }; + FA130E7F16806E36002E4BF9 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + COMBINE_HIDPI_IMAGES = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "RSInjector/RSInjector-Prefix.pch"; + INFOPLIST_FILE = "$(SRCROOT)/RSInjector/RSInjector-Info.plist"; + PRODUCT_NAME = RSInjector; + SDKROOT = macosx10.8; + VALID_ARCHS = i386; + WRAPPER_EXTENSION = app; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + FA130E5916806E36002E4BF9 /* Build configuration list for PBXProject "RSInjector" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FA130E7B16806E36002E4BF9 /* Debug */, + FA130E7C16806E36002E4BF9 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + FA130E7D16806E36002E4BF9 /* Build configuration list for PBXNativeTarget "RSInjector" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FA130E7E16806E36002E4BF9 /* Debug */, + FA130E7F16806E36002E4BF9 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = FA130E5616806E36002E4BF9 /* Project object */; +} diff --git a/RSInjector.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/RSInjector.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..8fe39ca --- /dev/null +++ b/RSInjector.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/RSInjector/AppDelegate.h b/RSInjector/AppDelegate.h new file mode 100644 index 0000000..5234658 --- /dev/null +++ b/RSInjector/AppDelegate.h @@ -0,0 +1,5 @@ +#import + +@interface AppDelegate : NSObject + +@end diff --git a/RSInjector/AppDelegate.m b/RSInjector/AppDelegate.m new file mode 100644 index 0000000..fbe38f4 --- /dev/null +++ b/RSInjector/AppDelegate.m @@ -0,0 +1,72 @@ +#import "AppDelegate.h" + +@implementation AppDelegate + +- (void)dealloc +{ + [super dealloc]; +} + +-(void)bringToFrontApplicationWithBundleIdentifier:(NSString*)inBundleIdentifier +{ + NSArray* appsArray = [NSRunningApplication runningApplicationsWithBundleIdentifier:inBundleIdentifier]; + if([appsArray count] > 0) + { + [[appsArray objectAtIndex:0] activateWithOptions:NSApplicationActivateIgnoringOtherApps]; + } + + [[NSApplication sharedApplication] terminate:self]; +} + +- (NSString *)getSteamPath +{ + NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); + NSString *basepath = [paths objectAtIndex:0]; + + // TODO: ask for path if not found and store in plist + NSString *exe_path = [NSString stringWithFormat:@"%@/%@", + basepath, @"Steam/SteamApps/common/Rocksmith2014/"]; + + return exe_path; +} + +- (void)launchRS:(NSString *)withTarget +{ + NSString *dyldLibrary = [[NSBundle bundleForClass:[self class]] pathForResource:@"RSBypass" ofType:@"dylib"]; + + NSString *launcherString = [NSString stringWithFormat:@"DYLD_INSERT_LIBRARIES=\"%@\" \"%@\" &", dyldLibrary, withTarget]; + + system([launcherString UTF8String]); + + [self performSelector:@selector(bringToFrontApplicationWithBundleIdentifier:) withObject:@"Ubisoft.Rocksmith2014" afterDelay:2.0]; + +} + +- (void)applicationDidFinishLaunching:(NSNotification *)aNotification +{ + + NSString *target = @"./Rocksmith2014.app/Contents/MacOS/Rocksmith2014"; + + NSString *appPath = [NSString stringWithFormat:@"%@/../", + [[NSBundle mainBundle] bundlePath]]; + + [[NSFileManager defaultManager] changeCurrentDirectoryPath:appPath]; + + if([[NSFileManager defaultManager] fileExistsAtPath:target] == FALSE) + { + // If RS was not found in the current directory we try steam + [[NSFileManager defaultManager] changeCurrentDirectoryPath:[self getSteamPath]]; + } + + + if([[NSFileManager defaultManager] fileExistsAtPath:target]) + [self launchRS:target]; + else + { + NSAlert* alert = [[[NSAlert alloc] init] autorelease]; + [alert setMessageText:@"Rocksmith2014.app not found !"]; + [alert runModal]; + } +} + +@end diff --git a/RSInjector/RSInjector-Info.plist b/RSInjector/RSInjector-Info.plist new file mode 100644 index 0000000..95ed99e --- /dev/null +++ b/RSInjector/RSInjector-Info.plist @@ -0,0 +1,36 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + RS2014 + CFBundleIdentifier + org.xav.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSMinimumSystemVersion + ${MACOSX_DEPLOYMENT_TARGET} + LSUIElement + + NSHumanReadableCopyright + + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/RSInjector/RSInjector-Prefix.pch b/RSInjector/RSInjector-Prefix.pch new file mode 100644 index 0000000..68324d3 --- /dev/null +++ b/RSInjector/RSInjector-Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the 'CalculatorLauncher' target in the 'CalculatorLauncher' project +// + +#ifdef __OBJC__ + #import +#endif diff --git a/RSInjector/en.lproj/MainMenu.xib b/RSInjector/en.lproj/MainMenu.xib new file mode 100644 index 0000000..b087f6c --- /dev/null +++ b/RSInjector/en.lproj/MainMenu.xib @@ -0,0 +1,574 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Default + + + + + + + Left to Right + + + + + + + Right to Left + + + + + + + + + + + Default + + + + + + + Left to Right + + + + + + + Right to Left + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/RSInjector/main.m b/RSInjector/main.m new file mode 100644 index 0000000..27f298f --- /dev/null +++ b/RSInjector/main.m @@ -0,0 +1,6 @@ +#import + +int main(int argc, char *argv[]) +{ + return NSApplicationMain(argc, (const char **)argv); +}