Skip to content

forza91/CocosCreatorLinux

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Note: The source code of the applications involved in this project is provided solely for community use. The authors of this project will not be held responsible for any legal liability incurred from using the code for other purposes.

Usage

./Cocos-Creator --project 'PROJECT_PATH' --path 'PROJECT_PATH' --build 'platform=web-mobile;buildPath=BUILD_PATH'

Get Assets

1.Get the assets on Windows or Mac build according to this page, Cocos Creator 2.4.6 is supported:

CocosCreator(2.1~3.0)のエディタソースを解凍し、Electronコマンドで起動できるかの検

You can find the copy_editor.js and ccc2js.js in this repo.

resources
├── app
   ├── app.js
   ├── asset-db
   ├── build
   ├── dashboard
   ├── editor
   ├── editor-framework
   ├── electron.icns
   ├── node_modules (replace it)
   ├── package.json (replace it)
   ├── share
   └── themes
├── app.asar.unpacked
├── builtin
├── cocos2d-x
├── default_app.asar
├── electron.icns
├── engine
├── lib (Optional for AppImage, create by yourself)
├── LICENSE.rtf
├── static
├── templates
└── utils (replace it)

Electron Build

1.Add G_SLICE prefix to fix crashing on Ubuntu23.10

/resources/app.js
process.env.G_SLICE='always-malloc'

2.Install node@14.16.1 in your system

3.Install npm dependencies in USER directory

npm i electron@11.2.0 sharp@0.28.3 electron-builder@20.0.7

4.Replace the 'node_modules', 'package.json' and 'utils' by this repo.

5.Copy all files and folders in /resources from Windows/Mac install, except app.asar.

6.Now you are able to run with electron!

cd /resources/app
electron .

alt text alt text

AppImage Build

Since Appimage is read-only inside, we need to fix the cache dir frist.

1.Ignore internal assets auto saving /resources/app/asset-db/lib/meta.js

if(a.indexOf("default-assets")==-1){
t.writeFileSync(a,JSON.stringify(i,null,2));
}

2.Fix build cache path /resources/app/editor/core/gulp-build.js

...
os = require('os'),
...
jsCacheDir:Editor.url(os.homedir()+"/.cache/"+G),

3.Remove /resources/cocos2d-x/simulator/mac

4.Build AppImage

npm run build

The exec file will be in ./dist !!

alt text

Trouble Shooting

1.This version only supports Debian12, Ubuntu20-23 or the other distros published at the near time, such as Arch linux. Latest Linux will be crashed due to the sharp@0.28.3 and libvip libraries. You can found them in /resources/utils.

In AppImage, one possible solution is to replace the system libs by the libs from Debian12/Ubuntu20, however I dont know which one will fix the issue.

A.Place the libs in /resources/lib

B.Add the env in /resources/app.js

process.env.LD_LIBRARY_PATH = process.resourcesPath + '/lib';

2.Only Cocos Creator 2.4.3 ~ 2.4.6 is tested, it's not able to translate ccc to js in 2.4.7 and above.

3.Cocos may fail at first time build in a new BUILD_PATH, just re-build again.

4.There are some inhouse modules from Cocos in /resources/app/node_modules, such as @base.

About

Unofficial Cocos Creator 2.4 Linux rebuild by electron(AppImage)

Resources

Stars

5 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors