Skip to content

Commit f330a89

Browse files
committed
amiberry - Update to v5.1 and rework amiberry/uae4all modules
Update amiberry version to v5.1 tag Remove no longer needed libxml2-dev dependency Add patch for amiberry Makefile so it doesn't override our CFLAGS/CPPFLAGS/LDFLAGS Remove -O3 from Makefile so it uses our default optimisation level. Previously this was -Ofast but from my own testing -O2 with our compiler flags works best. Modify build_amiberry with updated paths for caps bootstrap/configure. Override CPUFLAGS for amiberry, so our flags are used, rather than the ones hard-coded into the Makefile. Include abr and kickstarts folder in install_amiberry. The kickstarts folder includes a freely distributable AROS rom, so let's include it. Symlink cd32.nvr from "$md_inst/data" to "$md_conf_root/amiga/amiberry" so it's writable by amiberry. Split uae4arm's shared configure function out so uae4arm and amiberry now only share the launcher code. There is a small amount of duplication with some folder creation in configure_amiberry but it makes sense to split them due to the new amiberry changes. Rework uae4arm/amiberry configure functions to simplify logic and remove nesting by changing order of calls. Change the addEmulator calls in uae4arm and amiberry due to parameter ordering changes in the shared launcher script. Move rom location for amiberry/uae4arm/uae4all to $biosdir/amiga Create update hook to move / symlink kickstart ROMs from $biosdir to $biosdir/amiga Add .lha to module description extensions Added .chd extension to platforms.cfg Rework the logic in the shared launcher script: * Instead of setting EMULATOR variable via sed in uae4arm/amiberry we just change "use_amiberry=0" to "use_amiberry=1" in configure_amiberry. * Argument ordering is changed to simplify the logic. Previously the launch script expected [CONFIG] [ROM/GAME], and setting [CONFIG] to auto or "" would handle it automatically. Now it uses [ROM/GAME] [ARGS]. As passing in a configuration was optional, it made it simpler just to have the ROM first, and then allow additional arguments to be sent to the emulator. * We now build up an parameters array which avoids duplication and simplifies the code - There is only a single call to launch uae4arm/amiberry with the processed parameters. * Switched to using the amiberry --model parameter over our previous rp-a500.uae/rp-a1200.uae configs. Users who have set a particular rom to use amiberry-a500/amiberry-a1200 will still get the same functionality but it will instead use --model A500/A1200. A per rom .uae config can still be saved with customised settings for an adf etc. * added support for .chd files for amiberry How uae4arm.sh handles launching: * If the first argument (ROM/GAME) is a .cue or .lha file, and we are launching amiberry, use amiberry's --autoload function. * Otherwise if a rom argument is present, see if it's an archive (only zip supported currently). If it is, unpack all known disk image extensions from the archive attach each one as floppy drive arguments (-0 / -1 / -2 etc) * If it's not an archive, treat it as a disk image itself, and try and find additional files starting with the same name (eg Game_Disk1/Game_Disk2) and attach them as floppy drive arguments. * We then check if there is a .uae config file with the same name as the ROM argument in the ROM's folder or in amiberry's conf folder. * If there isn't we will try and use a config based on the filename. For uae4arm it will use the pre-installed rp-a500.uae config by default and rp-a1200.uae for any files containing AGA or CD32. For amiberry we use the --model parameter which chooses a default config based on argument. By default we use A500, but switch to A500P if a file contains ECS and A1200 if a file contains AGA, and CD32/CDTV if those strings are included also (Although cd images are handled separately so this may not be too useful). * We always set -G to not show the GUI when the first argument is present - to override this the first argument can be blank and manual parameters can be used (or the amiberry executable can just be used directly)
1 parent 1aa7823 commit f330a89

File tree

6 files changed

+207
-109
lines changed

6 files changed

+207
-109
lines changed

platforms.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
ags_exts=".exe"
55
ags_fullname="Adventure Game Studio"
66

7-
amiga_exts=".adf .adz .cue .dms .ipf .lha .m3u .sh .uae .zip"
7+
amiga_exts=".adf .adz .chd .cue .dms .ipf .lha .m3u .sh .uae .zip"
88
amiga_fullname="Commodore Amiga"
99

1010
amstradcpc_exts=".cdt .cpc .dsk .zip"

scriptmodules/emulators/amiberry.sh

Lines changed: 60 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,22 @@
1111

1212
rp_module_id="amiberry"
1313
rp_module_desc="Amiga emulator with JIT support (forked from uae4arm)"
14-
rp_module_help="ROM Extension: .adf .ipf .zip\n\nCopy your Amiga games to $romdir/amiga\n\nCopy the required BIOS files\nkick13.rom\nkick20.rom\nkick31.rom\nto $biosdir"
14+
rp_module_help="ROM Extension: .adf .chd .ipf .lha .zip\n\nCopy your Amiga games to $romdir/amiga\n\nCopy the required BIOS files\nkick13.rom\nkick20.rom\nkick31.rom\nto $biosdir/amiga"
1515
rp_module_licence="GPL3 https://raw.githubusercontent.com/midwan/amiberry/master/COPYING"
16-
rp_module_repo="git https://github.com/midwan/amiberry v3.3"
16+
rp_module_repo="git https://github.com/midwan/amiberry v5.1"
1717
rp_module_section="opt"
1818
rp_module_flags="!all arm"
1919

20+
function _update_hook_amiberry() {
21+
local rom
22+
for rom in kick13.rom kick20.rom kick31.rom; do
23+
# if we have a kickstart rom in $biosdir, move it to $biosdir/amiga and symlink the old location
24+
if [[ -f "$biosdir/$rom" && ! -h "$biosdir/$rom" ]]; then
25+
moveConfigFile "$biosdir/$rom" "$biosdir/amiga/$rom"
26+
fi
27+
done
28+
}
29+
2030
function _get_platform_amiberry() {
2131
local platform="$__platform-sdl2"
2232
if isPlatform "dispmanx"; then
@@ -34,7 +44,7 @@ function _get_platform_amiberry() {
3444
}
3545

3646
function depends_amiberry() {
37-
local depends=(autoconf libpng-dev libmpeg2-4-dev zlib1g-dev libmpg123-dev libflac-dev libxml2-dev libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev)
47+
local depends=(autoconf libpng-dev libmpeg2-4-dev zlib1g-dev libmpg123-dev libflac-dev libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev)
3848

3949
isPlatform "dispmanx" && depends+=(libraspberrypi-dev)
4050
isPlatform "vero4k" && depends+=(vero3-userland-dev-osmc)
@@ -44,43 +54,70 @@ function depends_amiberry() {
4454

4555
function sources_amiberry() {
4656
gitPullOrClone
57+
applyPatch "$md_data/01_preserve_env.diff"
4758
# use our default optimisation level
48-
sed -i "s/-Ofast//" "$md_build/Makefile"
59+
sed -i "/CFLAGS += -O3/d" "$md_build/Makefile"
4960
}
5061

5162
function build_amiberry() {
5263
local platform=$(_get_platform_amiberry)
5364
cd external/capsimg
54-
./bootstrap.fs
55-
./configure.fs
56-
make -f Makefile.fs clean
57-
make -f Makefile.fs
65+
./bootstrap
66+
./configure
67+
make clean
68+
make
5869
cd "$md_build"
5970
make clean
60-
make PLATFORM="$platform"
71+
make PLATFORM="$platform" CPUFLAGS="$__cpu_flags"
6172
md_ret_require="$md_build/amiberry"
6273
}
6374

6475
function install_amiberry() {
6576
md_ret_files=(
77+
'abr'
6678
'amiberry'
6779
'data'
6880
'external/capsimg/capsimg.so'
81+
'kickstarts'
6982
)
7083

7184
cp -R "$md_build/whdboot" "$md_inst/whdboot-dist"
7285
}
7386

7487
function configure_amiberry() {
75-
configure_uae4arm
88+
addEmulator 1 "amiberry" "amiga" "$md_inst/amiberry.sh %ROM%"
89+
addEmulator 0 "amiberry-a500" "amiga" "$md_inst/amiberry.sh %ROM% --model A500"
90+
addEmulator 0 "amiberry-a500plus" "amiga" "$md_inst/amiberry.sh %ROM% --model A500P"
91+
addEmulator 0 "amiberry-a1200" "amiga" "$md_inst/amiberry.sh %ROM% --model A1200"
92+
addEmulator 0 "amiberry-a4000" "amiga" "$md_inst/amiberry.sh %ROM% --model A4000"
93+
addEmulator 0 "amiberry-cdtv" "amiga" "$md_inst/amiberry.sh %ROM% --model CDTV"
94+
addEmulator 0 "amiberry-cd32" "amiga" "$md_inst/amiberry.sh %ROM% --model CD32"
95+
addSystem "amiga"
7696

7797
[[ "$md_mode" == "remove" ]] && return
7898

99+
mkRomDir "amiga"
100+
101+
mkUserDir "$md_conf_root/amiga"
102+
mkUserDir "$md_conf_root/amiga/amiberry"
103+
104+
# move config / save folders to $md_conf_root/amiga/amiberry
105+
local dir
106+
for dir in conf savestates screenshots; do
107+
moveConfigDir "$md_inst/$dir" "$md_conf_root/amiga/amiberry/$dir"
108+
done
109+
110+
# symlink cd32.nvr from $md_inst/data to "$md_conf_root/amiga/amiberry
111+
moveConfigFile "$md_inst/data/cd32.nvr" "$md_conf_root/amiga/amiberry/cd32.nvr"
112+
113+
moveConfigDir "$md_inst/kickstarts" "$biosdir/amiga"
114+
chown -R $user:$user "$biosdir/amiga"
115+
79116
# symlink the retroarch config / autoconfigs for amiberry to use
80117
ln -sf "$configdir/all/retroarch/autoconfig" "$md_inst/controllers"
81118
ln -sf "$configdir/all/retroarch.cfg" "$md_inst/conf/retroarch.cfg"
82119

83-
local config_dir="$md_conf_root/amiga/$md_id"
120+
local config_dir="$md_conf_root/amiga/amiberry"
84121

85122
# create whdboot config area
86123
moveConfigDir "$md_inst/whdboot" "$config_dir/whdboot"
@@ -89,4 +126,16 @@ function configure_amiberry() {
89126
cp -R "$md_inst/whdboot-dist/"{game-data,save-data,boot-data.zip,WHDLoad} "$config_dir/whdboot/"
90127

91128
chown -R $user:$user "$config_dir/whdboot"
129+
130+
# copy shared uae4arm/amiberry launch script while setting is_amiberry=1
131+
sed "s/is_amiberry=0/is_amiberry=1/" "$md_data/../uae4arm/uae4arm.sh" >"$md_inst/amiberry.sh"
132+
chmod a+x "$md_inst/amiberry.sh"
133+
134+
local script="+Start Amiberry.sh"
135+
cat > "$romdir/amiga/$script" << _EOF_
136+
#!/bin/bash
137+
"$md_inst/amiberry.sh"
138+
_EOF_
139+
chmod a+x "$romdir/amiga/$script"
140+
chown $user:$user "$romdir/amiga/$script"
92141
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
diff --git a/Makefile b/Makefile
2+
index 29969690..dc798edf 100644
3+
--- a/Makefile
4+
+++ b/Makefile
5+
@@ -17,10 +17,10 @@ SDL_CONFIG ?= sdl2-config
6+
export SDL_CFLAGS := $(shell $(SDL_CONFIG) --cflags)
7+
export SDL_LDFLAGS := $(shell $(SDL_CONFIG) --libs)
8+
9+
-CPPFLAGS = -MD -MT $@ -MF $(@:%.o=%.d) $(SDL_CFLAGS) -Iexternal/libguisan/include -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Isrc/archivers -Isrc/floppybridge -DAMIBERRY -D_FILE_OFFSET_BITS=64
10+
-CFLAGS=-pipe -Wno-shift-overflow -Wno-narrowing
11+
+CPPFLAGS += -MD -MT $@ -MF $(@:%.o=%.d) $(SDL_CFLAGS) -Iexternal/libguisan/include -Isrc -Isrc/osdep -Isrc/threaddep -Isrc/include -Isrc/archivers -Isrc/floppybridge -DAMIBERRY -D_FILE_OFFSET_BITS=64
12+
+CFLAGS += -pipe -Wno-shift-overflow -Wno-narrowing
13+
USE_LD ?= gold
14+
-LDFLAGS = $(SDL_LDFLAGS) -lSDL2_image -lSDL2_ttf -lguisan -Lexternal/libguisan/lib
15+
+LDFLAGS += $(SDL_LDFLAGS) -lSDL2_image -lSDL2_ttf -lguisan -Lexternal/libguisan/lib
16+
ifneq ($(strip $(USE_LD)),)
17+
LDFLAGS += -fuse-ld=$(USE_LD)
18+
endif

scriptmodules/emulators/uae4all.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
rp_module_id="uae4all"
1313
rp_module_desc="Amiga emulator UAE4All"
14-
rp_module_help="ROM Extension: .adf\n\nCopy your Amiga games to $romdir/amiga\n\nCopy the required BIOS files\nkick13.rom\nkick20.rom\nkick31.rom\nto $biosdir"
14+
rp_module_help="ROM Extension: .adf\n\nCopy your Amiga games to $romdir/amiga\n\nCopy the required BIOS files\nkick13.rom\nkick20.rom\nkick31.rom\nto $biosdir/amiga"
1515
rp_module_licence="GPL2 https://raw.githubusercontent.com/RetroPie/uae4all2/retropie/copying"
1616
rp_module_repo="git https://github.com/RetroPie/uae4all2.git retropie"
1717
rp_module_section="opt"
@@ -76,13 +76,13 @@ function configure_uae4all() {
7676
if [[ ! -h "$md_inst/kickstarts" ]]; then
7777
rm -f "$md_inst/kickstarts/"{kick12.rom,kick13.rom,kick20.rom,kick31.rom}
7878
fi
79-
moveConfigDir "$md_inst/kickstarts" "$biosdir"
79+
moveConfigDir "$md_inst/kickstarts" "$biosdir/amiga"
8080

8181
rm -f "$romdir/amiga/+Start UAE4All.sh"
8282
if [[ "$md_mode" == "install" ]]; then
8383
if [[ ! -f "$biosdir/aros-amiga-m68k-ext.bin" ]]; then
8484
# unpack aros kickstart
85-
unzip -j "aros20140110.zip" -d "$biosdir"
85+
unzip -j "aros20140110.zip" -d "$biosdir/amiga"
8686
fi
8787

8888
cat > "$romdir/amiga/+Start UAE4All.sh" << _EOF_

scriptmodules/emulators/uae4arm.sh

Lines changed: 53 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
rp_module_id="uae4arm"
1313
rp_module_desc="Amiga emulator with JIT support"
14-
rp_module_help="ROM Extension: .adf\n\nCopy your Amiga games to $romdir/amiga\n\nCopy the required BIOS files\nkick13.rom\nkick20.rom\nkick31.rom\nto $biosdir"
14+
rp_module_help="ROM Extension: .adf\n\nCopy your Amiga games to $romdir/amiga\n\nCopy the required BIOS files\nkick13.rom\nkick20.rom\nkick31.rom\nto $biosdir/amiga"
1515
rp_module_licence="GPL2"
1616
rp_module_repo="git https://github.com/Chips-fr/uae4arm-rpi.git master"
1717
rp_module_section="opt"
@@ -43,67 +43,60 @@ function install_uae4arm() {
4343
}
4444

4545
function configure_uae4arm() {
46+
addEmulator 1 "uae4arm" "amiga" "$md_inst/uae4arm.sh %ROM%"
47+
addEmulator 0 "uae4arm-a500" "amiga" "$md_inst/uae4arm.sh %ROM% -config=conf/rp-a500.uae"
48+
addEmulator 0 "uae4arm-a1200" "amiga" "$md_inst/uae4arm.sh %ROM% -config=conf/rp-a1200.uae"
49+
addSystem "amiga"
50+
51+
[[ "$md_mode" == "remove" ]] && return
52+
4653
mkRomDir "amiga"
4754

48-
if [[ "$md_mode" == "install" ]]; then
49-
mkUserDir "$md_conf_root/amiga"
50-
mkUserDir "$md_conf_root/amiga/$md_id"
51-
52-
# move config / save folders to $md_conf_root/amiga/$md_id
53-
local dir
54-
for dir in conf savestates screenshots; do
55-
moveConfigDir "$md_inst/$dir" "$md_conf_root/amiga/$md_id/$dir"
56-
done
57-
58-
# and kickstart dir (removing old symlinks first)
59-
if [[ ! -h "$md_inst/kickstarts" ]]; then
60-
rm -f "$md_inst/kickstarts/"{kick12.rom,kick13.rom,kick20.rom,kick31.rom}
61-
fi
62-
moveConfigDir "$md_inst/kickstarts" "$biosdir"
63-
64-
local conf="$(mktemp)"
65-
iniConfig "=" "" "$conf"
66-
iniSet "config_description" "RetroPie A500, 68000, OCS, 512KB Chip + 512KB Slow Fast"
67-
iniSet "chipmem_size" "1"
68-
iniSet "bogomem_size" "2"
69-
iniSet "chipset" "ocs"
70-
iniSet "cachesize" "0"
71-
iniSet "kickstart_rom_file" "\$(FILE_PATH)/kick13.rom"
72-
copyDefaultConfig "$conf" "$md_conf_root/amiga/$md_id/conf/rp-a500.uae"
73-
rm "$conf"
74-
75-
conf="$(mktemp)"
76-
iniConfig "=" "" "$conf"
77-
iniSet "config_description" "RetroPie A1200, 68EC020, AGA, 2MB Chip"
78-
iniSet "chipmem_size" "4"
79-
iniSet "finegrain_cpu_speed" "1024"
80-
iniSet "cpu_type" "68ec020"
81-
iniSet "cpu_model" "68020"
82-
iniSet "chipset" "aga"
83-
iniSet "cachesize" "0"
84-
iniSet "kickstart_rom_file" "\$(FILE_PATH)/kick31.rom"
85-
copyDefaultConfig "$conf" "$md_conf_root/amiga/$md_id/conf/rp-a1200.uae"
86-
rm "$conf"
87-
88-
# copy launch script (used for uae4arm and amiberry)
89-
sed "s/EMULATOR/$md_id/" "$scriptdir/scriptmodules/$md_type/uae4arm/uae4arm.sh" >"$md_inst/$md_id.sh"
90-
chmod a+x "$md_inst/$md_id.sh"
91-
92-
local script="+Start UAE4Arm.sh"
93-
[[ "$md_id" == "amiberry" ]] && script="+Start Amiberry.sh"
94-
rm -f "$romdir/amiga/$script"
95-
if [[ "$md_mode" == "install" ]]; then
96-
cat > "$romdir/amiga/$script" << _EOF_
55+
mkUserDir "$md_conf_root/amiga"
56+
mkUserDir "$md_conf_root/amiga/uae4arm"
57+
58+
# move config / save folders to $md_conf_root/amiga/uae4arm
59+
local dir
60+
for dir in conf savestates screenshots; do
61+
moveConfigDir "$md_inst/$dir" "$md_conf_root/amiga/uae4arm/$dir"
62+
done
63+
64+
moveConfigDir "$md_inst/kickstarts" "$biosdir/amiga"
65+
chown -R $user:$user "$biosdir/amiga"
66+
67+
local conf="$(mktemp)"
68+
iniConfig "=" "" "$conf"
69+
iniSet "config_description" "RetroPie A500, 68000, OCS, 512KB Chip + 512KB Slow Fast"
70+
iniSet "chipmem_size" "1"
71+
iniSet "bogomem_size" "2"
72+
iniSet "chipset" "ocs"
73+
iniSet "cachesize" "0"
74+
iniSet "kickstart_rom_file" "\$(FILE_PATH)/kick13.rom"
75+
copyDefaultConfig "$conf" "$md_conf_root/amiga/uae4arm/conf/rp-a500.uae"
76+
rm "$conf"
77+
78+
conf="$(mktemp)"
79+
iniConfig "=" "" "$conf"
80+
iniSet "config_description" "RetroPie A1200, 68EC020, AGA, 2MB Chip"
81+
iniSet "chipmem_size" "4"
82+
iniSet "finegrain_cpu_speed" "1024"
83+
iniSet "cpu_type" "68ec020"
84+
iniSet "cpu_model" "68020"
85+
iniSet "chipset" "aga"
86+
iniSet "cachesize" "0"
87+
iniSet "kickstart_rom_file" "\$(FILE_PATH)/kick31.rom"
88+
copyDefaultConfig "$conf" "$md_conf_root/amiga/uae4arm/conf/rp-a1200.uae"
89+
rm "$conf"
90+
91+
# copy shared uae4arm/amiberry launch script
92+
cp "$md_data/uae4arm.sh" "$md_inst/"
93+
chmod a+x "$md_inst/uae4arm.sh"
94+
95+
local script="+Start UAE4Arm.sh"
96+
cat > "$romdir/amiga/$script" << _EOF_
9797
#!/bin/bash
98-
"$md_inst/$md_id.sh"
98+
"$md_inst/uae4arm.sh"
9999
_EOF_
100-
chmod a+x "$romdir/amiga/$script"
101-
chown $user:$user "$romdir/amiga/$script"
102-
fi
103-
fi
104-
105-
addEmulator 1 "$md_id" "amiga" "$md_inst/$md_id.sh auto %ROM%"
106-
addEmulator 1 "$md_id-a500" "amiga" "$md_inst/$md_id.sh rp-a500.uae %ROM%"
107-
addEmulator 1 "$md_id-a1200" "amiga" "$md_inst/$md_id.sh rp-a1200.uae %ROM%"
108-
addSystem "amiga"
100+
chmod a+x "$romdir/amiga/$script"
101+
chown $user:$user "$romdir/amiga/$script"
109102
}

0 commit comments

Comments
 (0)