开源掌机程序编译

发布时间 2023-11-22 16:31:01作者: JeasonBoy

主要记录一些开源软件的跨平台编译

 

1.mgba:一个性能比较强的gba模拟器,支持SDL跟QT

linux编译:

mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr ..
make
sudo make install

不过不知道为啥,Lua5.1的路径总是找不到,即使安装了,导致编译报错,解决方法是把Lua去掉:cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DUSE_LUA=OFF ..

 依赖:

Qt 5: for the GUI frontend. Qt Multimedia or SDL are required for audio.
SDL: for a more basic frontend and gamepad support in the Qt frontend. SDL 2 is recommended, but 1.2 is supported.
zlib and libpng: for screenshot support and savestate-in-PNG support.
libedit: for command-line debugger support.
ffmpeg or libav: for video, GIF, WebP, and APNG recording.
libzip or zlib: for loading ROMs stored in zip files.
SQLite3: for game databases.
libelf: for ELF loading.
Lua: for scripting.
json-c: for the scripting storage API.

运行:

mgba game.gbc  // 默认sdl版本

mgba-qt game.gbc //qt版本(有菜单)

 

 

2.gmenu2x:一个嵌入式设备用的轻量级菜单UI

编译:

make -f Makefile.miyoo        //构建miyoo平台的bin文件
make -f Makefile.miyoo dist    //构建miyoo平台的发布项目,会生成一个文件夹,包括gmenu2x需要用到的各种资源文件
注意,以上miyoo平台的构建需要有miyoo的sdk,毕竟是跨平台编译,需要跨平台编译器


linux通用编译:安装依赖:

  sudo apt-get install -y build-essential libsdl-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libboost-all-dev libfreetype6-dev libbz2-dev libmpg123-dev

  make -f Makefile.linux dist

运行:

cd dist/linux
./gmenu2x

 

网友移植的树莓派版本(其实树莓派也可以直接用上面的版本):lualiliu/GMenuNext-on-raspberry-pi: GMenuNext is a fork of GMenu2X developed to Raspberry Pi (github.com)

编译:

在raspberry pi中安装各种libsdl依赖

make dist

编译后的文件在dist文件夹中。

映射到fb1(如TFT屏幕)

安装屏幕驱动(install screen driver)

将:gmenu2x.cpp(lines 367)

putenv((char*)"FRAMEBUFFER=/dev/fb0");

putenv((char*)"SDL_FBDEV=/dev/fb0");

修改为:

putenv((char*)"FRAMEBUFFER=/dev/fb1");

putenv((char*)"SDL_FBDEV=/dev/fb1");