Skip to content

Commit 75dbd71

Browse files
committed
Make otx work as a 64-bit executable
1 parent eda8f5c commit 75dbd71

28 files changed

+1137
-871
lines changed

main.m

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,18 @@ int main(
2727
int result = 1;
2828

2929
#ifdef OTX_CLI
30-
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
31-
CLIController* controller =
30+
@autoreleasepool {
31+
CLIController* controller =
3232
[[CLIController alloc] initWithArgs: argv count: argc];
3333

34-
if (controller)
35-
{
36-
[controller processFile];
37-
[controller release];
38-
result = noErr;
34+
if (controller)
35+
{
36+
[controller processFile];
37+
result = noErr;
38+
}
39+
else
40+
result = -1;
3941
}
40-
else
41-
result = -1;
42-
43-
[pool release];
4442
#else
4543
result = NSApplicationMain(argc, (const char**)argv);
4644
#endif

otx.xcodeproj/project.pbxproj

Lines changed: 10 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
25A62EFE0C38A7C500B08D38 /* Prefs General Icon.tif in Resources */ = {isa = PBXBuildFile; fileRef = 25A62EFB0C38A7C500B08D38 /* Prefs General Icon.tif */; };
3232
25A62EFF0C38A7C500B08D38 /* Main Window Background.tif in Resources */ = {isa = PBXBuildFile; fileRef = 25A62EFC0C38A7C500B08D38 /* Main Window Background.tif */; };
3333
25A62F060C38A86C00B08D38 /* App Icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 25A62F050C38A86C00B08D38 /* App Icon.icns */; };
34+
55E1267E14DE58BB003B4A16 /* ObjcTypes.m in Sources */ = {isa = PBXBuildFile; fileRef = 55E1267C14DE46F3003B4A16 /* ObjcTypes.m */; };
3435
8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */ = {isa = PBXBuildFile; fileRef = 29B97318FDCFA39411CA2CEA /* MainMenu.nib */; };
3536
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
36-
E13539830A6817C700CBDDE5 /* ObjcSwap.c in Sources */ = {isa = PBXBuildFile; fileRef = E13539820A6817C700CBDDE5 /* ObjcSwap.c */; };
3737
E145F6D30B437F5900615A16 /* SmoothViewAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = E145F6D20B437F5900615A16 /* SmoothViewAnimation.m */; };
3838
E182007209AE4CD800584B07 /* AppController.m in Sources */ = {isa = PBXBuildFile; fileRef = E182007009AE4CD800584B07 /* AppController.m */; };
3939
E1978C9E0AC603A40096EE62 /* Help in Resources */ = {isa = PBXBuildFile; fileRef = E1978C6A0AC603A40096EE62 /* Help */; };
@@ -57,7 +57,6 @@
5757
E1F81ADD0AE1EEEC003D8E2C /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E1F81AC80AE1EEEB003D8E2C /* Carbon.framework */; };
5858
E1F81B090AE1EF07003D8E2C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E1F81ADE0AE1EF07003D8E2C /* CoreFoundation.framework */; };
5959
E1F81B3F0AE1EF2D003D8E2C /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E1F81B0A0AE1EF2C003D8E2C /* Security.framework */; };
60-
E1FA33DC0B10081B0060060A /* ObjcSwap.c in Sources */ = {isa = PBXBuildFile; fileRef = E13539820A6817C700CBDDE5 /* ObjcSwap.c */; };
6160
E1FA33E40B1008290060060A /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E1F81AC80AE1EEEB003D8E2C /* Carbon.framework */; };
6261
E1FA33E50B1008290060060A /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
6362
E1FA33E60B1008290060060A /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E1F81ADE0AE1EF07003D8E2C /* CoreFoundation.framework */; };
@@ -80,7 +79,6 @@
8079
/* Begin PBXFileReference section */
8180
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
8281
13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
83-
2524F42F0E94A8ED008C1C42 /* ObjcSwap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ObjcSwap.h; path = source/ObjcSwap.h; sourceTree = "<group>"; };
8482
252DFA080C9D2E7D00C712BD /* ErrorReporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ErrorReporter.h; path = source/Protocols/ErrorReporter.h; sourceTree = "<group>"; };
8583
252DFAB90C9D38A100C712BD /* SysUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SysUtils.h; path = source/Categories/SysUtils.h; sourceTree = "<group>"; };
8684
252DFABA0C9D38A100C712BD /* SysUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SysUtils.m; path = source/Categories/SysUtils.m; sourceTree = "<group>"; };
@@ -110,11 +108,12 @@
110108
29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
111109
29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
112110
32CA4F630368D1EE00C91783 /* otx_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = otx_Prefix.pch; sourceTree = "<group>"; };
111+
55E1267B14DE46F3003B4A16 /* ObjcTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ObjcTypes.h; path = source/ObjcTypes.h; sourceTree = "<group>"; };
112+
55E1267C14DE46F3003B4A16 /* ObjcTypes.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ObjcTypes.m; path = source/ObjcTypes.m; sourceTree = "<group>"; };
113113
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
114114
8D1107320486CEB800E47090 /* otx.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = otx.app; sourceTree = BUILT_PRODUCTS_DIR; };
115115
E1167F1C09C8086900E7398D /* StolenDefs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StolenDefs.h; path = source/StolenDefs.h; sourceTree = "<group>"; };
116116
E13539810A68178D00CBDDE5 /* SyscallStrings.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SyscallStrings.h; path = source/SyscallStrings.h; sourceTree = "<group>"; };
117-
E13539820A6817C700CBDDE5 /* ObjcSwap.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = ObjcSwap.c; path = source/ObjcSwap.c; sourceTree = "<group>"; };
118117
E13539900A68185500CBDDE5 /* AppController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = AppController.h; path = source/AppController.h; sourceTree = "<group>"; };
119118
E145F6D10B437F5900615A16 /* SmoothViewAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SmoothViewAnimation.h; path = source/SmoothViewAnimation.h; sourceTree = "<group>"; };
120119
E145F6D20B437F5900615A16 /* SmoothViewAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SmoothViewAnimation.m; path = source/SmoothViewAnimation.m; sourceTree = "<group>"; };
@@ -246,8 +245,8 @@
246245
29B97315FDCFA39411CA2CEA /* Other Sources */ = {
247246
isa = PBXGroup;
248247
children = (
249-
2524F42F0E94A8ED008C1C42 /* ObjcSwap.h */,
250-
E13539820A6817C700CBDDE5 /* ObjcSwap.c */,
248+
55E1267B14DE46F3003B4A16 /* ObjcTypes.h */,
249+
55E1267C14DE46F3003B4A16 /* ObjcTypes.m */,
251250
E1F483530B38DB4200CECE18 /* SharedDefs.h */,
252251
E1167F1C09C8086900E7398D /* StolenDefs.h */,
253252
E13539810A68178D00CBDDE5 /* SyscallStrings.h */,
@@ -437,7 +436,6 @@
437436
buildActionMask = 2147483647;
438437
files = (
439438
E182007209AE4CD800584B07 /* AppController.m in Sources */,
440-
E13539830A6817C700CBDDE5 /* ObjcSwap.c in Sources */,
441439
E1FA34030B100D060060060A /* main.m in Sources */,
442440
E1B132600B180B25002EB674 /* ExeProcessor.m in Sources */,
443441
E1B132640B180B66002EB674 /* PPCProcessor.m in Sources */,
@@ -466,7 +464,6 @@
466464
isa = PBXSourcesBuildPhase;
467465
buildActionMask = 2147483647;
468466
files = (
469-
E1FA33DC0B10081B0060060A /* ObjcSwap.c in Sources */,
470467
E1FA34500B105E4F0060060A /* CLIController.m in Sources */,
471468
E1FA36570B12EE0A0060060A /* main.m in Sources */,
472469
E1B1325F0B180B25002EB674 /* ExeProcessor.m in Sources */,
@@ -487,6 +484,7 @@
487484
25924BAD0D4D855E0050AA16 /* Arch64Specifics.m in Sources */,
488485
25924BB60D4D85A00050AA16 /* SysUtils.m in Sources */,
489486
25924C210D4D89AE0050AA16 /* Searchers64.m in Sources */,
487+
55E1267E14DE58BB003B4A16 /* ObjcTypes.m in Sources */,
490488
);
491489
runOnlyForDeploymentPostprocessing = 0;
492490
};
@@ -560,13 +558,8 @@
560558
isa = XCBuildConfiguration;
561559
buildSettings = {
562560
ALWAYS_SEARCH_USER_PATHS = YES;
563-
ARCHS = "$(NATIVE_ARCH_ACTUAL)";
564-
GCC_CW_ASM_SYNTAX = NO;
561+
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
565562
GCC_C_LANGUAGE_STANDARD = c99;
566-
GCC_DYNAMIC_NO_PIC = YES;
567-
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
568-
GCC_FAST_OBJC_DISPATCH = YES;
569-
GCC_MODEL_TUNING = G5;
570563
GCC_OPTIMIZATION_LEVEL = 0;
571564
GCC_PREFIX_HEADER = otx_Prefix.pch;
572565
GCC_PREPROCESSOR_DEFINITIONS = OTX_DEBUG;
@@ -578,8 +571,7 @@
578571
GCC_WARN_UNUSED_LABEL = YES;
579572
GCC_WARN_UNUSED_PARAMETER = NO;
580573
GCC_WARN_UNUSED_VARIABLE = YES;
581-
MACOSX_DEPLOYMENT_TARGET = 10.4;
582-
OTHER_CFLAGS = "-falign-loops=16";
574+
MACOSX_DEPLOYMENT_TARGET = 10.7;
583575
SDKROOT = macosx;
584576
WARNING_CFLAGS = "-wall";
585577
};
@@ -590,14 +582,8 @@
590582
buildSettings = {
591583
ALWAYS_SEARCH_USER_PATHS = YES;
592584
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
593-
GCC_CW_ASM_SYNTAX = NO;
594585
GCC_C_LANGUAGE_STANDARD = c99;
595-
GCC_DYNAMIC_NO_PIC = YES;
596-
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
597-
GCC_ENABLE_OBJC_GC = unsupported;
598-
GCC_FAST_OBJC_DISPATCH = YES;
599-
GCC_MODEL_TUNING = G5;
600-
GCC_OPTIMIZATION_LEVEL = 3;
586+
GCC_OPTIMIZATION_LEVEL = s;
601587
GCC_PREFIX_HEADER = otx_Prefix.pch;
602588
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
603589
GCC_WARN_ABOUT_RETURN_TYPE = YES;
@@ -606,8 +592,7 @@
606592
GCC_WARN_UNUSED_LABEL = YES;
607593
GCC_WARN_UNUSED_PARAMETER = NO;
608594
GCC_WARN_UNUSED_VARIABLE = YES;
609-
MACOSX_DEPLOYMENT_TARGET = 10.4;
610-
OTHER_CFLAGS = "-falign-loops=16";
595+
MACOSX_DEPLOYMENT_TARGET = 10.7;
611596
SDKROOT = macosx;
612597
};
613598
name = Release;
@@ -616,17 +601,14 @@
616601
isa = XCBuildConfiguration;
617602
buildSettings = {
618603
COPY_PHASE_STRIP = NO;
619-
GCC_DYNAMIC_NO_PIC = YES;
620604
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
621-
GCC_MODEL_TUNING = G5;
622605
GCC_PRECOMPILE_PREFIX_HEADER = YES;
623606
GCC_PREFIX_HEADER = otx_Prefix.pch;
624607
GCC_PREPROCESSOR_DEFINITIONS = (
625608
OTX_CLI,
626609
OTX_DEBUG,
627610
);
628611
INSTALL_PATH = "$(HOME)/bin";
629-
OTHER_CFLAGS = "-falign-loops=16";
630612
PRODUCT_NAME = otx;
631613
};
632614
name = Debug;
@@ -635,14 +617,11 @@
635617
isa = XCBuildConfiguration;
636618
buildSettings = {
637619
COPY_PHASE_STRIP = YES;
638-
GCC_DYNAMIC_NO_PIC = YES;
639620
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
640-
GCC_MODEL_TUNING = G5;
641621
GCC_PRECOMPILE_PREFIX_HEADER = YES;
642622
GCC_PREFIX_HEADER = otx_Prefix.pch;
643623
GCC_PREPROCESSOR_DEFINITIONS = OTX_CLI;
644624
INSTALL_PATH = "$(HOME)/bin";
645-
OTHER_CFLAGS = "-falign-loops=16";
646625
PRODUCT_NAME = otx;
647626
};
648627
name = Release;

source/Categories/Objc64Accessors.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ - (BOOL)getObjcDescription: (char**)outDescription
118118
{
119119
case CFStringType:
120120
{
121-
cf_string_object_64 cfString = *(cf_string_object_64*)inObject;
121+
cfstring_object_64 cfString = *(cfstring_object_64*)inObject;
122122

123123
if (cfString.oc_string.length == 0)
124124
break;
@@ -130,7 +130,7 @@ - (BOOL)getObjcDescription: (char**)outDescription
130130

131131
case OCStrObjectType:
132132
{
133-
objc2_64_string_object ocString = *(objc2_64_string_object*)inObject;
133+
nxstring_object_64 ocString = *(nxstring_object_64*)inObject;
134134

135135
if (ocString.length == 0)
136136
break;
@@ -228,11 +228,11 @@ - (BOOL)getObjcClassPtr: (objc2_64_class_t**)outClassPtr
228228
- (BOOL)getObjcMetaClass: (objc2_64_class_t*)outClass
229229
fromClass: (objc2_64_class_t*)inClass;
230230
{
231-
/* if ((uint32_t)inClass->isa >= iMetaClassSect.s.addr &&
232-
(uint32_t)inClass->isa < iMetaClassSect.s.addr + iMetaClassSect.s.size)
231+
/* if (inClass->isa >= iMetaClassSect.s.addr &&
232+
inClass->isa < iMetaClassSect.s.addr + iMetaClassSect.s.size)
233233
{
234234
*outClass = *(objc_class*)(iMetaClassSect.contents +
235-
((uint32_t)inClass->isa - iMetaClassSect.s.addr));
235+
(inClass->isa - iMetaClassSect.s.addr));
236236
237237
return YES;
238238
}*/

source/Categories/ObjcAccessors.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,30 @@
1212

1313
@interface Exe32Processor(ObjcAccessors)
1414

15-
- (BOOL)getObjcClassPtr: (objc_class**)outClass
15+
- (BOOL)getObjcClassPtr: (objc1_32_class**)outClass
1616
fromMethod: (uint32_t)inAddress;
17-
- (BOOL)getObjcCatPtr: (objc_category**)outCat
17+
- (BOOL)getObjcCatPtr: (objc1_32_category**)outCat
1818
fromMethod: (uint32_t)inAddress;
1919
- (BOOL)getObjcMethod: (MethodInfo**)outMI
2020
fromAddress: (uint32_t)inAddress;
21-
- (BOOL)getObjcMethodList: (objc_method_list*)outList
22-
methods: (objc_method**)outMethods
21+
- (BOOL)getObjcMethodList: (objc1_32_method_list*)outList
22+
methods: (objc1_32_method**)outMethods
2323
fromAddress: (uint32_t)inAddress;
2424
- (BOOL)getObjcDescription: (char**)outDescription
2525
fromObject: (const char*)inObject
2626
type: (UInt8)inType;
27-
- (BOOL)getObjcSymtab: (objc_symtab*)outSymTab
28-
defs: (void***)outDefs
29-
fromModule: (objc_module*)inModule;
30-
- (BOOL)getObjcClass: (objc_class*)outClass
27+
- (BOOL)getObjcSymtab: (objc1_32_symtab*)outSymTab
28+
defs: (uint32_t **)outDefs
29+
fromModule: (objc1_32_module*)inModule;
30+
- (BOOL)getObjcClass: (objc1_32_class*)outClass
3131
fromDef: (uint32_t)inDef;
32-
- (BOOL)getObjcCategory: (objc_category*)outCat
32+
- (BOOL)getObjcCategory: (objc1_32_category*)outCat
3333
fromDef: (uint32_t)inDef;
34-
- (BOOL)getObjcClass: (objc_class*)outClass
34+
- (BOOL)getObjcClass: (objc1_32_class*)outClass
3535
fromName: (const char*)inName;
36-
- (BOOL)getObjcClassPtr: (objc_class**)outClassPtr
36+
- (BOOL)getObjcClassPtr: (objc1_32_class**)outClassPtr
3737
fromName: (const char*)inName;
38-
- (BOOL)getObjcMetaClass: (objc_class*)outClass
39-
fromClass: (objc_class*)inClass;
38+
- (BOOL)getObjcMetaClass: (objc1_32_class*)outClass
39+
fromClass: (objc1_32_class*)inClass;
4040

4141
@end

0 commit comments

Comments
 (0)