How to include resource files in Theos makefile?

I made a fully functional setup with theos, and I need to use the image file in it the correct code to get the image (checked on Xcode). but the image is not included in the final DEB file.

and I have this make file:

SDKVERSION=6.0 include theos/makefiles/common.mk include theos/makefiles/tweak.mk TWEAK_NAME = MyTweak MyTweak_FRAMEWORKS = Foundation CoreGraphics UIKit MyTweak_FILES = Tweak.xm image.png include $(THEOS_MAKE_PATH)/tweak.mk 

But when I try to compile, I get:

  No rule to make target `obj/image.png.o', needed by `obj/MyTweak.dylib'. Stop. 

What can I do to turn it on?

(Sorry for the poor syntax by asking iphone).

+7
source share
2 answers

This is not how you enable resources using theos. The MyTweak_FILES variable should only include files that can be compiled. Make a file handles resources differently.

To enable resources, you need to create a package as follows.

1) Create a folder called Resources in the tweak.xm directory.

2) Put all your resource files (all your PNGs) in this folder.

3) Add the following information to your file

 BUNDLE_NAME = your_bundle_identifier your_bundle_identifier_INSTALL_PATH = /Library/MobileSubstrate/DynamicLibraries include $(THEOS)/makefiles/bundle.mk 

4) Define your package as follows on top of the tweak.xm file.

 #define kBundlePath @"/Library/MobileSubstrate/DynamicLibraries/your_bundle_identifier.bundle" 

5) Now you can initialize the package and use the images in your setup as follows:

 NSBundle *bundle = [[[NSBundle alloc] initWithPath:kBundlePath] autorelease]; NSString *imagePath = [bundle pathForResource:@"your_image_name" ofType:@"png"]; UIImage *myImage = [UIImage imageWithContentsOfFile:imagePath] 

In the steps above, replace your_bundle_identifier with your bundle identifier, which will be in the control file. (ex: com.yourdomain.tweak_name)

Also replace your_image_name with the name of the image you want to use.

You can pretty much use any resources (for example: sound files) above.

+6
source

In addition to the posted answer, a common practice is to place packages in "/ Library / Application Support /" rather than "/ Library / MobileSubstrate / DynamicLibraries /"

0
source

All Articles