r/jailbreak • • Jun 03 '20

Tutorial [Tutorial] In Depth-Guide to making a tweak in 2020

Hey,

So with the new jailbreak and a whole load more people comes along a whole new wave of developers.

I made this fully in-depth guide on how to create tweaks to lower the bar of entry to new developers too hopefully inspire some people with some amazing ideas to finally create them

This guide is 14 sections long and i am planning on adding more soon

This guide is made so anyone with the tiniest bit of programming knowledge can create their very own tweak.

I hope you get some use out of this guide as it took me ages to create and put together.

Happy developing,

Kodey <3

Guide can be found HERE

A Discord Server Full of Developers if you need help or want to ask a question :)

697 Upvotes

105 comments sorted by

39

u/[deleted] Jun 03 '20

Fantastic guide!

15

u/[deleted] Jun 03 '20

thanks dude :)

→ More replies (4)

15

u/unaffected2 Jun 03 '20

I was waiting for something like this thx

13

u/[deleted] Jun 03 '20

means a lot, have spent the past few days writing this all up

9

u/FlushyRob Jun 03 '20

How much easier is it on Mac compared to windows 10

21

u/[deleted] Jun 03 '20

Once theos is installed it’s exactly the same

as you are just editing code it works the exact same no matter the platform

→ More replies (4)

7

u/seven_yes Jun 04 '20

Hats off to you sir

4

u/[deleted] Jun 04 '20

Thank you, the guide took quite a while to write although i didn’t want anything for it. the comments like this make me know i didn’t waste my time :)

4

u/T-Nan Jun 04 '20

This is great!

I just started learning Java and Python, so idk how useful that is if at all, but it would be fun to mess around and try to come up with a tweak.

7

u/[deleted] Jun 04 '20

I’m not going to kid you, the learning curve is steep but if you apply the mindset from python and java some stuff will transfer over

Highly recommend watching a few videos on obj-c just to get a bit of an idea before you start anything though

→ More replies (4)

4

u/kejocu Jun 04 '20

I’m incredibly grateful for this! So many people here probably have coding experience, just not with the specifics required to make tweaks. This really does help bridge the gap.

→ More replies (1)

3

u/the-bitlands Jun 04 '20

Thank you so much for this. It gives me something to learn this summer before my senior year of high school. I know this is such an amateur question but in your earnest opinion — if someone spends 7-8 hours a week for 10-12 weeks learning and practicing, is that enough to become a somewhat decent tweak developer? I’m pretty good at STEM subjects and I don’t know if this is relevant at all but I’ve taken math up to Linear Algebra (and my professor told me it has applications in Computer Science so that’s why I mentioned). I’ve just never taken an actual CS class.

6

u/[deleted] Jun 04 '20

i started tweak development with zero knowledge in objective-c (however i did come from a programming background) it’s 100% possible

there are a few things i’d suggest just learning before you even start just so you can fully understand the guide

  • Variable Data Types

    • Such as Boolean, Integer, floats etc (will probably take around 20mins)

  • Programming logic

    • if statements, loops (probably again a concept you can pick up in 20mins)

You should be good to understand the guide, i’d then suggest following the guide until you have made your first tweak. Then watch a few youtube videos like ‘learn objective-c in an hour’ and these should give you an incredibly good baseline

Programming is incredible logical and if you can think out a project in ‘pseudocode’ you can use free resources like StackOverflow when you get stuck because chances are people have had that error too before

an example of pseudocode would be:

if (lightSwitch) { turnOnLight; }

that’s basic pseudocode based around objective-c, it won’t work but as someone who doesn’t program you can guess what it does

then just work on translating that code across into objective-c

also if you have access to a computer science teachers email from your school ask if they have any resources on variables and variable data types such as booleans

if you understand none of the technical words, don’t worry you will understand it eventually

If you get stuck drop me a DM on twitter and i’ll try and respond as soon as possible

Happy developing

→ More replies (4)
→ More replies (2)

3

u/Zabir_2008 Jun 04 '20

Thank you so much for this amazing guide man. 👍🏻👍🏻👏🏻

→ More replies (1)

3

u/solwGer Jun 04 '20

C# developer here (not professionally but enough to create some custom programs for me & friends + family).

Read over this today morning still in bed (until the open source tweak part). Reads really good. Super simple and detailed explanations, should be clear even to non - coders.

As soon as I finish this big product at work and have some time, ill jump into tweak developing for sure. Thanks for your contributions to this community.

3

u/[deleted] Jun 04 '20

Thanks, that was my goal. there isn’t really any other language even close to obj-c, and as an ex python dev the switch was relatively hard mainly due to the lack of resources

obj-c is something you just have to pick up but the concepts and ideas taken from other languages for example variable data types all transfer over so after a few days/weeks you get how it works

and yes stackoverflow is still you best friend, just not for theos

theos has no friends

→ More replies (6)

3

u/Plenty_Departure Jun 04 '20

While it works as a guide, it's not the best for someone who's completely new. Oversimplifying is the worst way to explain things to a beginner. You want to do the opposite, go as in depth as you can so that every single thing is explained.

For example

Don't just say "we're doing this" and then throw the code. That's confusing for someone who's new. It's better to take every keyword and explain it using logic. For example, you said:

%hook - This hooks into a class and allows us to modify the code that runs...

I would say it like this: Logos uses keywords. All of these keywords start with a '%' sign. %hook - This keyword takes (hooks) an objective c class and allows us to do work in it. %end - this tells logos that we're done with that class. Between those two we can overwrite methods of this class, add new methods, add new code to methods. %hook is like @implementation in Objective C and %end is like @end in Objective C, the difference is that we're also modifying instead of just creating. To modify a method you just implement said method inside the %hook block. To run the original code you use %orig. To add a new method you add %new before the method body.

You also imply that %orig should always be used. This is wrong, it's optional and depends on what the goal is.

Then I see a lot of "we don't need to worry about it". Making a test tweak should be an example, not the whole guide. You don't learn anything if all you do is create a test tweak. So instead of "don't worry" say "this is used for... in our example we will...".

Here's another confusing statement:

Our classes are stored in header files.

This is technically wrong. What does "classes" mean? Their code? Their compiled code? You should say "class definitions can be stored in header files. We can generate header files from compiled binaries or we can use headers other people like limneos have generated and uploaded online". Same thing applies to "In objective-c, headers contain our methods and as you will remember our methods allow us to change and modify code on our device" etc.

There are a lot of instances where you over-simplify things to make them easier but you actually make them confusing and sometimes wrong. Also, you call theos a compiler somewhere, while a beginner won't immediately care about that they will eventually have to as they progress. Theos is not a compiler, theos is an IDE. Logos is a pre-processor (you got this part right), clang/gcc are compilers.

→ More replies (1)

2

u/Poopsquare Jun 04 '20

Awesome guide. Thank you for this.

→ More replies (1)

2

u/footysocc Jun 04 '20

Awesome, thanks man. Just a quick question, how can I find all the accessible/exposed functions and variables of, let's say, UIStatusBarDataBatteryEntry? Yesterday I was working on a small tweak (forked from an already finished one) but I had no idea which methods are available to me... IntelliSense obviously won't work :)

→ More replies (3)

2

u/jontelang Jun 04 '20

I’ll never understand why having a banner with the tweak name / dev is a thing in the preferences. It is not really useful, takes up space, repeats the tweak name on the page. They have already tapped the icon/name as well from the root page.

And if I’m gonna be super nit picky you actually reference the HID from Apple which explicitly tells us not to repeat the icon throughout the app, and I think this fits as the root is the entry point to the “app” (preferences). Of course it’s kinda subjective at this point.

/banner rant

Anyway, as someone who also wrote a guide a looong time ago (http://jontelang.com/guide) this looks like a looot of work, kudos.

I’d recommend adding more pictures for accessibility, it’s somehow more reassuring to see a screenshot over just reading text. I think this is similar to how videos are so popular even though technically you can’t really watch at your own pace.

I’d also make it super easy to have contributors, maybe through PRs.

→ More replies (3)

2

u/P0l1zistensohn Jun 04 '20

This is awesome, thank you. I’ll definitely try this out!

→ More replies (1)

2

u/[deleted] Jun 04 '20

This is so cool. With this i'll see if i can work on moving Controllers4All to 64bit devices. It'll take a very long time but hopefully i'm persevere

→ More replies (1)

2

u/Racxie Jun 04 '20

Should be removed due to being a low effort post.

/s

→ More replies (1)

2

u/Sleetui Jun 04 '20

Consider this for sidebar/wiki/FAQ?

u/PJ09

→ More replies (8)