frida-il2cpp-bridge icon indicating copy to clipboard operation
frida-il2cpp-bridge copied to clipboard

Documentation and tests

Open vfsfitvnm opened this issue 1 year ago • 11 comments

Hi all! This discussion made me realize we need to massively improve the documentation and usability of this project.

  • Newcomers often find difficult to get started - and I really can't blame them.
  • There are no tests/code coverage/benchmarks - and I can't blame me either!

However, we can address these two problems if we had the source code of a simple game, so that we could create a tutorial to show how to think and what to do when using frida-il2cpp-bridge (also, it would allow testing!).

For documenting, the ideal game should be catchy and well-made, whereas it should be cross-platform and compatible with the Unity versions supported by frida-il2cpp-bridge for testing.

Edit: https://github.com/vfsfitvnm/frida-il2cpp-bridge/issues/261#issuecomment-1493015414 We can have separated sources for testing and documenting.

Steps:

  • [ ] Find or create a game that satisfies that is well-made, open source, cross-platform and has a permissive license.
  • [ ] Create or use a build system to build the game for different platforms so that people can easily download the binaries.
  • [ ] Write a comprehensive walkthrough to illustrate the basics of Frida, Il2Cpp and TypeScript and possible usages against the game (i.e. how to have infinite health).
  • [x] Find a way to build IL2CPP tests sources. Ideally, we should also edit the IL2CPP source code to apply some common anti reverse engineering techniques (for code coverage).
  • [x] Determine where these tests should run (locally or GitHub actions).
  • [ ] Write tests.

This is the high level plan - I don't even know the feasibility of it. Most importantly, I don't know how much time it requires and I can't even estimate its time of arrival (ETA).

Possibly useful: https://github.com/game-ci/docker https://github.com/nneonneo/Il2CppVersions

vfsfitvnm avatar Mar 10 '23 11:03 vfsfitvnm

For the game, these are some possible choices. Beware I didn't check if they fulfill the requirements - and we should ask the author(s) for permission, first.

  • https://github.com/wankcn/PirateBomb-2DMobileGame
  • https://github.com/kidagine/Darklings-FightingGame
  • https://github.com/zigurous/unity-dino-game-tutorial
  • https://github.com/SurajSSingh/Unity-2-Platforming-Game
  • https://github.com/FelixEder/RetroFutureGame
  • https://github.com/ddsurvivor/CardGameTutorial
  • https://github.com/dylanmpeck/PompaDroid
  • https://github.com/Guznat/FantasyTrip
  • https://github.com/geraked/game-tiptop
  • https://github.com/geekymoose/ShippedTooSoon
  • https://github.com/imjotaefe/2dGameUnity
  • https://github.com/Xenomega/Sycophant

vfsfitvnm avatar Mar 10 '23 11:03 vfsfitvnm

I just created a template for this library and I think it could be a good starting point for beginners. Please let me know if there are any issues that I should correct.

ChuJiani avatar Mar 12 '23 11:03 ChuJiani

Thanks, it looks good! Here's another template :P

vfsfitvnm avatar Mar 12 '23 20:03 vfsfitvnm

perfect ~

Chensem avatar Mar 14 '23 06:03 Chensem

Find a way to build IL2CPP tests sources. Ideally, we should also edit the IL2CPP source code to apply some common anti reverse engineering techniques (for code coverage).

Thanks to @djkaty (blog, file) I managed to build a "standalone" shared library for Linux, GameAssembly.so (already played around with frida-il2cpp-bridge :stuck_out_tongue_winking_eye: ).

It means testing does not need a real game anymore! This simplifies the whole process by a lot.

Bash script: https://gist.github.com/vfsfitvnm/bada5805f46d5198e8757986fa9c8cc9

vfsfitvnm avatar Apr 01 '23 15:04 vfsfitvnm

Thanks to @djkaty (blog, file) I managed to build a "standalone" shared library for Linux, GameAssembly.so (already played around with frida-il2cpp-bridge 😜 ).

It means testing does not need a real game anymore! This simplifies the whole process by a lot.

Bash script: https://gist.github.com/vfsfitvnm/bada5805f46d5198e8757986fa9c8cc9

Sick project, would never have seen it without the tag mention. Looks really impressive, amazing work!

djkaty avatar Apr 02 '23 10:04 djkaty

Sick project, would never have seen it without the tag mention. Looks really impressive, amazing work!

Thank you for the kind words, but it wouldn't have been possible without Frida! And, of course, thank you for your valuable resources about IL2CPP :smiley_cat:

vfsfitvnm avatar Apr 02 '23 11:04 vfsfitvnm

Determine where these tests should run (locally or GitHub actions).

The biggest concern with using GitHub Actions is the slow feedback (i.e. I don't want to push and wait to see if I broke something), so local tests are preferred. However, if I got it correctly, GitHub Actions can be ran on Windows and MacOS too at no cost - so I can comfortably make changes or tests to see if I broke cross platforming.

So, the answer is both (https://github.com/nektos/act)! Writing the actions will be very painful, however :<

vfsfitvnm avatar Apr 07 '23 11:04 vfsfitvnm

Alright, the first step to setup a test environment would be building and publishing Docker images (we cannot use https://github.com/game-ci/docker as they only provide 2018+ images):

  • One image to rule them all, or one image per Unity version? I have zero Docker knowledge, but I don't want to download a whole ubuntu-latest for each Unity version.
  • Download and extract the Unity editor;
  • Download and extract the IL2CPP Linux standalone support;
  • Delete/do not extract any unnecessary file so that the total size is > 300MB (instead of > 5GB).

Using Docker images isn't absolutely necessary - we could do that process within the runner itself and cache the whole unity directory instead (downloading and extracting takes some time). However, GitHub's cache has a limit of 10GB per repository and it gets evicted after being unused for 7 days. We should be fine with that, however I don't know how caching would play in a local environment using https://github.com/nektos/act.

vfsfitvnm avatar Jul 03 '23 16:07 vfsfitvnm

Can we use INDEPENDENT GAMES or BUY-OUTS for single player games for testing and documenting?

UPON-2021 avatar Oct 07 '23 06:10 UPON-2021

I don't know, we must ask for permission to the owner(s) of the game, but I don't think they would accept (comprehensibly).

I already run tests locally (see the test folder), they surely need more work, but a real game isn't necessary anymore.

vfsfitvnm avatar Oct 07 '23 09:10 vfsfitvnm