Tutorial Solar2D (former Corona Lab) game modding tutorial

hemoridhero

Platinian
Original poster
Jul 29, 2020
26
28
18
33
Tokyo
How to identify if a game is built using Coronalab: There's a "libcorona.so" in /lib folder.

They changed their name to Solar2D as corona is a really bad name since 2020 ^-^ It's a rare engine, few games uses it. Oh well, let's get started.

Tools you'll need:

APK packing/unpacking tool - e.g apktool. Guides available online, not covered here.

Corona Archiver

Any code editor, I use VSC, you can use notepad but... It won't be pleasant

Luadec51 (for lua v5.1) or Luadec (for 5.2/3, compile on your own) - Check the game's lua version by searching in lib/liblua.so

luacX.X.exe from Official Lua Sourceforge. The version must match the game's lua version!

version.JPG


Optional: jdk for signing the final apk (guides available online, not covered here).

WARNING: LUADEC IS BUGGY. SOMETIMES IT WILL BREAK THE CODE. THEREFORE THIS METHOD MAY NOT WORK WITH YOUR GAME.

------------------------------


Let's get started.

1. Unpack the apk using apktool or something else. This part is covered by other tutorials so I won't spend much time here.

2: Coronalab uses lua, and the script is compiled to a file called "resource.car", usually in /assets. Find the file, copy "corona-archiver.exe" to that directory.

3: In that directory: Create an empty folder, remember its name, and type "cmd" in the address bar. Then, paste:
corona-archiver -u resource.car *your folder name*

4: A bunch of .lu files should now be there. They are compiled lua scripts. Copy Luadec and luac to this directory, Start CMD here, decompile any script by this command:
luadec51 filename.lu > filename.lua

5: A .lua file should appear. This is the script itself. Edit and save it however you'd like.
If the script is empty, or contain any decompiler error, editing and recompiling will not work. This is due to the inadequacy of Luadec, there's no way to fix this.
Do think of creative ways of modding - strings of the same size is directly editable, compare compiled hex code pre-post edit, delete irrelevant & broken parts prior to recompile, etc.

6: Recompile the script using luac.exe. Depending on your luac version (X.X), use this command:

luacX.X -o *file-name.lua*
A file called "luac.out" should appear in the folder. BACK UP, then delete the original .lu file, rename "luac.out" to it.

7: Compile the new resource.car using this command (check the cmd directory!):

corona-archiver -p 'input_dir' 'output_file'

8: That's your edited file. Pack and sign the apk, and have fun!

Screenshot_20210110-124025_OverRapid.jpg
 
Last edited:

hemoridhero

Platinian
Original poster
Jul 29, 2020
26
28
18
33
Tokyo
For anyone who's wondering, the game is Overrapid. No mod exists for this app, anywhere. I mod for my personal enjoyment and will likely never upload them.
 

AndnixSH

PMT Elite Modder
Staff member
Modding-Team
Jun 27, 2017
4,680
296,905
1,213
Modding World
Nice tutorial!
I remember that resource.car on other game called Fun Run. Back then i was too noob that I can't compile ??
 
  • Like
Reactions: hemoridhero

hemoridhero

Platinian
Original poster
Jul 29, 2020
26
28
18
33
Tokyo
Um Thankyou for the response.
here's the link of the game:-
the main.lua was always blank
Tested both your game and my original mod, yours won't work entirely while mine's broken in some files.
Luadec is just too old and limited. This method may worked in 2015 but... Probably not that well today.
 
  • Like
Reactions: DDeveloper

LEIIKUN

Retired Staff
Retired but loved <3
Oct 13, 2019
502
10,946
1,193
20
Davao
I do always get
Code:
unexpected symbol near ' '
when trying to recompile the script/.lua file
 

Claire8825

Platinian
Dec 4, 2023
7
0
1
24
Decompiled .lu -- > .lua, edited everything what needed for me, and now i want to compile the file .lua --> .lu

Anyone can help?