-
Notifications
You must be signed in to change notification settings - Fork 0
/
init-arcade.yml
executable file
·793 lines (705 loc) · 21.1 KB
/
init-arcade.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
#!/usr/bin/ansible-playbook
---
#
# Builds software for a Raspberry Pi based arcade machine in a
# qemu-arm-static chroot environment.
#
# Cross-compilation is faster and helps extend the life of the
# Raspberry Pi's SD card.
#
# Then,
#
# Configures hosts in an inventory group named "arcade_group"
# consisting of real Raspberry Pi devices with networking and
# SSH service available, then installs the software built in
# the chroot environment.
#
# To run:
# init-arcade.yml -e cli_chroot_path=/path/to/chroot \
# -e cli_image_file=/path/to/raspbian.img
#
# To skip the build phase, add -e cli_skip_build=true.
#
# References:
# - GCC compiler optimization for ARM-based systems
# https://gist.github.com/fm4dd/c663217935dc17f0fc73c9c81b0aa845
# - Building SFML for Raspberry Pi without X11
# https://github.com/mickelson/sfml-pi/blob/master/readme.md
# - Pac-Man Vector Art (source of splash screen artwork)
# https://www.classicgaming.cc/classics/pac-man/vector-art
#
# PHASE 1: Prepare chroot environment
- hosts: localhost
connection: local
vars:
bind_mounts:
- proc
- sys
- dev
- dev/pts
tasks:
- name: Check Ansible version
assert:
that: "ansible_version.full is version('2.9', '>=')"
msg: "This playbook requires Ansible 2.9 or later"
- name: Check if user is root
fail:
msg: "This playbook must be run as root"
when: ansible_user_uid != 0
- name: Check for required variables
fail:
msg: "Variable {{ item }} is not defined"
when: item is undefined
loop:
- cli_image_file
- cli_chroot_path
- name: Copy files from image into chroot directory
script: "rpi_copyrootfs.sh -i {{ cli_image_file }} -d {{ cli_chroot_path }}"
args:
creates: "{{ cli_chroot_path }}"
- name: Copy /etc/resolv.conf into chroot directory
copy:
src: /etc/resolv.conf
dest: "{{ cli_chroot_path }}/etc/resolv.conf"
mode: preserve
- name: Copy qemu-arm-static into chroot directory
copy:
src: /usr/bin/qemu-arm-static
dest: "{{ cli_chroot_path }}/bin/qemu-arm-static"
mode: preserve
- name: Create a mock shell for Ansible's chroot plugin
copy:
content: |
#!/bin/sh
/bin/qemu-arm-static /bin/sh "$@"
dest: "{{ cli_chroot_path }}/bin/qemu-sh"
mode: '0755'
owner: root
group: root
- name: Check for mount points in chroot directory
stat:
path: "{{ cli_chroot_path }}/{{ item }}"
loop: "{{ bind_mounts }}"
register: mount_point_stat
- name: Validate mount points in chroot directory
fail:
msg: "Missing mount point: {{ cli_chroot_path }}/{{ item.item }}"
when: not (item.stat.exists and item.stat.isdir)
loop: "{{ mount_point_stat.results }}"
- name: Find existing bind mounts in chroot directory
command: "findmnt --mountpoint {{ cli_chroot_path }}/{{ item }}"
register: bind_mount_status
ignore_errors: yes
loop: "{{ bind_mounts }}"
- name: Create missing bind mounts in chroot directory
command: "mount --bind /{{ item.item }} {{ cli_chroot_path }}/{{ item.item }}"
when: item.rc == 1
loop: "{{ bind_mount_status.results }}"
- name: Comment out ld.so.preload in chroot directory
replace:
path: "{{ cli_chroot_path }}/etc/ld.so.preload"
regexp: '^(/.+)$'
replace: '#\1'
- name: Add chroot path to inventory for next play
add_host:
name: "{{ cli_chroot_path }}"
groups: chroot_group
ansible_connection: chroot
ansible_executable: /bin/qemu-sh
# PHASE 2: Build software for ARM architecture
- hosts: chroot_group
become: yes
become_user: pi
vars:
git_base_dir: "{{ ansible_user_dir }}/git"
sdl_git_repo_url: https://github.com/libsdl-org/SDL.git
sdl_git_repo_ref: release-2.30.7
sdlttf_git_repo_url: https://github.com/libsdl-org/SDL_ttf.git
sdlttf_git_repo_ref: release-2.22.0
mame_git_repo_url: https://github.com/mbarnes/mame.git
mame_git_repo_ref: subtarget-cocktail-0270
sfml_pi_git_repo_url: https://github.com/mickelson/sfml-pi.git
sfml_pi_git_repo_ref: master
#attract_git_repo_url: https://github.com/mickelson/attract.git
#attract_git_repo_ref: v2.7.0
attract_git_repo_url: https://github.com/mbarnes/attract.git
attract_git_repo_ref: mouse-menu-navigation
#raspberry_pi_cpu: cortex-a53 # Raspberry Pi 3
raspberry_pi_cpu: cortex-a72 # Raspberry Pi 4
raspberry_pi_cflags: >-
-mcpu={{ raspberry_pi_cpu }}
-mtune={{ raspberry_pi_cpu }}
-mfloat-abi=hard
-mfpu=neon-fp-armv8
tasks:
- name: Skip build if cli_skip_build requested
meta: end_play
when: cli_skip_build | default(false)
- name: Set virtual CPU count from localhost
set_fact:
ansible_processor_vcpus: "{{ hostvars['localhost']['ansible_facts']['processor_vcpus'] }}"
- name: Install build dependencies
apt:
# Allow duplicates here if multiple
# components have a common dependency.
name:
- git
- build-essential
- python3-apt
# For SDL
- automake
- libasound2-dev
- libdbus-1-dev
- libdrm-dev
- libfreetype6-dev
- libgbm-dev
- libgles2-mesa-dev
- libudev-dev
# For MAME
- libasio-dev
- libasound2-dev
- libflac-dev
- libfontconfig1-dev
- libgles2-mesa-dev
- libglm-dev
- libglvnd-dev
- libjpeg62-turbo-dev
- libpulse-dev
- libpugixml-dev
- libsqlite3-dev
- libutf8proc-dev
- libxi-dev
- rapidjson-dev
# For SFML
- cmake
- libdrm-dev
- libegl1-mesa-dev
- libflac-dev
- libfreetype6-dev
- libgbm-dev
- libjpeg62-turbo-dev
- libogg-dev
- libopenal-dev
- libudev-dev
- libvorbis-dev
# For Attract-Mode
- libarchive-dev
- libavcodec-dev
- libavformat-dev
- libcurl4-openssl-dev
- libdrm-dev
- libfontconfig1-dev
- libfreetype6-dev
- libgbm-dev
- libglu1-mesa-dev
- libjpeg62-turbo-dev
- libopenal-dev
- libswresample-dev
- libswscale-dev
update_cache: yes
become: yes
become_user: root
- name: Create git directory
file:
path: "{{ git_base_dir }}"
state: directory
# SDL modifies its own "include/SDL_config.h" during
# configuration. To avoid needless recompilation on
# future playbook runs, note the file's modification
# time before reconfiguring the source code and then
# restore the modification time if the file contents
# have not changed.
- name: Examine SDL_config.h
stat:
path: "{{ git_base_dir }}/SDL/include/SDL_config.h"
register: sdl_config_h_old
- name: Clone SDL from git
git:
repo: "{{ sdl_git_repo_url }}"
dest: "{{ git_base_dir }}/SDL"
version: "{{ sdl_git_repo_ref }}"
depth: 1
# Running configure creates local
# modifications in the repository
force: yes
- name: Configure SDL to use OpenGL ES
command:
chdir: "{{ git_base_dir }}/SDL"
argv:
- "./configure"
- "--host=armv7l-raspberry-linux-gnueabihf"
- "--disable-arm-simd"
- "--disable-esd"
- "--disable-jack"
- "--disable-pulseaudio"
- "--disable-sndio"
- "--disable-video-opengl"
- "--disable-video-opengles1"
- "--disable-video-rpi"
- "--disable-video-vulkan"
- "--disable-video-wayland"
- "--disable-video-x11"
- "--enable-alsa"
- "--enable-arm-neon"
- "--enable-video-kmsdrm"
- "--enable-video-opengles2"
- name: Examine SDL_config.h
stat:
path: "{{ sdl_config_h_old.stat.path }}"
register: sdl_config_h_new
when: sdl_config_h_old.stat.exists
- name: Restore SDL_config.h modification time
file:
path: "{{ sdl_config_h_old.stat.path }}"
modification_time: "{{ '%Y%m%d%H%M.%S' | strftime(sdl_config_h_old.stat.mtime) }}"
when:
- sdl_config_h_old.stat.exists
- sdl_config_h_old.stat.checksum == sdl_config_h_new.stat.checksum
- name: Build SDL from git
make:
chdir: "{{ git_base_dir }}/SDL"
params:
CFLAGS: "{{ raspberry_pi_cflags }}"
"--jobs": "{{ ansible_processor_vcpus }}"
- name: Install SDL as root
make:
chdir: "{{ git_base_dir }}/SDL"
target: install
become: yes
become_user: root
- name: Clone SDL_ttf from git
git:
repo: "{{ sdlttf_git_repo_url }}"
dest: "{{ git_base_dir }}/SDL_ttf"
version: "{{ sdlttf_git_repo_ref }}"
depth: 1
# Running configure creates local
# modifications in the repository
force: yes
# XXX Upstream uses a newer automake version than what
# Raspbian currently provides (1.16.5 vs 1.16.3),
# so this step avoids a version conflict.
- name: Generate build files for SDL_ttf
command:
chdir: "{{ git_base_dir }}/SDL_ttf"
argv:
- "./autogen.sh"
- name: Configure SDL_ttf
command:
chdir: "{{ git_base_dir }}/SDL_ttf"
argv:
- "./configure"
- name: Build SDL_ttf from git
make:
chdir: "{{ git_base_dir }}/SDL_ttf"
params:
"--jobs": "{{ ansible_processor_vcpus }}"
- name: Install SDL_ttf as root
make:
chdir: "{{ git_base_dir }}/SDL_ttf"
target: install
become: yes
become_user: root
- name: Run ldconfig as root
command: /sbin/ldconfig
become: yes
become_user: root
- name: Clone MAME from git
git:
repo: "{{ mame_git_repo_url }}"
dest: "{{ git_base_dir }}/mame"
version: "{{ mame_git_repo_ref }}"
# Depth should be sufficient to cover all
# my customizations for SUBTARGET=cocktail.
depth: 40
- name: Build MAME from git (this can take a LONG time)
make:
chdir: "{{ git_base_dir }}/mame"
params:
"--jobs": "{{ ansible_processor_vcpus }}"
REGENIE: 1
NOWERROR: 1
IGNORE_GIT: 1
NO_OPENGL: 1
NO_X11: 1
NO_USE_XINPUT: 1
TARGETOS: linux
ARCHOPTS: "{{ raspberry_pi_cflags }}"
USE_SYSTEM_LIB_ASIO: 1
USE_SYSTEM_LIB_EXPAT: 1
USE_SYSTEM_LIB_ZLIB: 1
USE_SYSTEM_LIB_JPEG: 1
USE_SYSTEM_LIB_FLAC: 1
USE_SYSTEM_LIB_SQLITE3: 1
USE_SYSTEM_LIB_UTF8PROC: 1
USE_SYSTEM_LIB_GLM: 1
USE_SYSTEM_LIB_RAPIDJSON: 1
USE_SYSTEM_LIB_PUGIXML: 1
- name: Install MAME binary as root
copy:
src: "{{ git_base_dir }}/mame/mamecocktail"
dest: /usr/local/bin/mamecocktail
remote_src: yes
mode: u=rwx,g=rx,o=rx
owner: root
group: root
become: yes
become_user: root
- name: Install MAME plugins as root
copy:
src: "{{ git_base_dir }}/mame/plugins"
dest: /usr/local/games/mame
remote_src: yes
mode: preserve
become: yes
become_user: root
- name: Clone SFML for the Raspberry Pi from git
git:
repo: "{{ sfml_pi_git_repo_url }}"
dest: "{{ git_base_dir }}/sfml-pi"
version: "{{ sfml_pi_git_repo_ref }}"
depth: 1
- name: Prepare SFML for the Raspberry Pi sources
command:
chdir: "{{ git_base_dir }}/sfml-pi"
argv:
- "/usr/bin/cmake"
- "-DSFML_DRM=1"
- "."
- name: Build SFML for the Raspberry Pi from git
make:
chdir: "{{ git_base_dir }}/sfml-pi"
params:
"--jobs": "{{ ansible_processor_vcpus }}"
- name: Install SFML for the Raspberry Pi as root
make:
chdir: "{{ git_base_dir }}/sfml-pi"
target: install
become: yes
become_user: root
- name: Clone Attract-Mode from git
git:
repo: "{{ attract_git_repo_url }}"
dest: "{{ git_base_dir }}/attract"
version: "{{ attract_git_repo_ref }}"
depth: 1
- name: Build Attract-Mode from git
make:
chdir: "{{ git_base_dir }}/attract"
params:
"--jobs": "{{ ansible_processor_vcpus }}"
USE_DRM: 1
USE_MMAL: 1
- name: Install Attract-Mode as root
make:
chdir: "{{ git_base_dir }}/attract"
target: install
params:
USE_DRM: 1
USE_MMAL: 1
become: yes
become_user: root
# PHASE 3: Configure Raspberry Pi hosts
- hosts: arcade_group
remote_user: pi
vars:
- journal_max_disk_usage: 128M
- mame_base_dir: "{{ ansible_user_dir }}/mame"
- boot_cmdline:
# Kernel parameter documentation:
# https://github.com/torvalds/linux/blob/master/Documentation/admin-guide/kernel-parameters.txt
# Common Raspberry Pi kernel parameters:
# https://www.raspberrypi.org/documentation/configuration/cmdline-txt.md
- console=serial0,115200
- console=tty3
- root=/dev/mmcblk0p2
- rootfstype=ext4
- elevator=deadline
- fsck.repair=yes
- rootwait
- quiet
# Disable Raspberry Pi logo
- logo.nologo
# Remove cursor on virtual terminals
- vt.global_cursor_default=0
# Rotate the HDMI 1 display 90 degrees
# Resolution agrees with hdmi_mode below.
- video=HDMI-A-1:1280x1024@60,rotate=90
# Disable console blank timer
- consoleblank=0
- config_txt_default: "https://raw.githubusercontent.com/RPi-Distro/pi-gen/master/stage1/00-boot-files/files/config.txt"
- config_txt_changes:
# hdmi_group: DMT / hdmi_mode: 1280x1024 60 Hz
- option: hdmi_group
value: 2
- option: hdmi_mode
value: 35
# Disable rainbow splash screen on boot
- section: all
option: disable_splash
value: 1
handlers:
- name: Restart journald
systemd:
name: systemd-journald.service
state: restarted
become: yes
tasks:
- name: System-level tasks
become: yes
block:
- name: Set hostname to arcade
hostname:
name: "{{ inventory_hostname }}"
- name: Update 127.0.1.1 hosts entry
lineinfile:
path: /etc/hosts
regexp: '^127\.0\.1\.1'
line: "127.0.1.1\t{{ inventory_hostname }}"
- name: Limit journal disk usage
lineinfile:
path: /etc/systemd/journald.conf
regexp: "^#?SystemMaxUse="
line: "SystemMaxUse={{ journal_max_disk_usage }}"
notify: Restart journald
- name: Configure kernel parameters
copy:
content: "{{ boot_cmdline | join(' ') }}"
dest: /boot/cmdline.txt
mode: '0755'
owner: root
group: root
- name: Get default Raspberry Pi config
get_url:
url: "{{ config_txt_default }}"
dest: /boot/config.txt
mode: u=rwx,g=rx,o=rx
owner: root
group: root
- name: Uncomment select Raspberry Pi options
lineinfile:
path: /boot/config.txt
regexp: '^#({{ item }}=.*)'
line: "\\g<1>"
backrefs: yes
loop:
- hdmi_group
- hdmi_mode
- name: Tweak Raspberry Pi config
ini_file:
path: /boot/config.txt
section: "{{ item.section | default(None) }}"
option: "{{ item.option }}"
value: "{{ item.value }}"
no_extra_spaces: yes
loop: "{{ config_txt_changes }}"
- name: Add user to "render" group
user:
name: "{{ ansible_ssh_user }}"
groups: render
append: yes
- name: Install required packages
package:
name:
- console-tools
- fbi
- tmux
- vim
# For MAME
- libegl1
- libgles2
- libpugixml1v5
- libutf8proc2
# For Attract-Mode
- libarchive13
- libavformat59
- libgbm1
- libopenal1
- libswscale6
state: present
# This task is for removing obsolete dependency
# packages from previously installed MAME builds.
- name: Remove obsolete packages
package:
name:
- libuv1
state: absent
- name: Display a splash screen during boot
copy:
src: "{{ item }}"
dest: "/etc/systemd/system/{{ item }}"
loop:
- splashscreen.path
- splashscreen.service
- name: Enable the splash screen path unit
systemd:
name: splashscreen.path
enabled: yes
daemon_reload: yes
# This specifically targets Alt-Left and Alt-Right bindings,
# which can easily get triggered during game play and switch
# the active VT away from the splash screen. This change is
# transient, so it runs as a boot-time crontab entry.
- name: Disable key bindings with a boot-time crontab entry
cron:
name: Disable key bindings that can be triggered during game play
user: root
cron_file: keybindings
special_time: reboot
job: >
dumpkeys --keys-only |
grep --extended-regexp --invert-match "(Incr|Decr)_Console" |
loadkeys
- name: Configure systemd to launch Attract-Mode
copy:
src: attract.conf
dest: /etc/systemd/system/[email protected]/
- name: Synchronize locally installed software
synchronize:
src: "{{ cli_chroot_path }}/usr/local/"
dest: /usr/local
- name: Run ldconfig on new libraries
command: ldconfig /usr/local/lib
# End of block
# MAME 0.237 renamed the high score directory to "hiscore".
- name: Check for old high score directory
stat:
path: "{{ mame_base_dir }}/hi"
register: old_hiscore_dir
- name: Migrate old high score directory
command: "mv hi hiscore"
args:
chdir: "{{ mame_base_dir }}"
when:
- old_hiscore_dir.stat.isdir is defined
- old_hiscore_dir.stat.isdir
- name: Check for old ini directory
stat:
path: "{{ ansible_user_dir }}/.mame"
register: old_mame_ini_dir
- name: Migrate old ini directory
command: "mv {{ ansible_user_dir }}/.mame ini"
args:
chdir: "{{ mame_base_dir }}"
when:
- old_mame_ini_dir.stat.isdir is defined
- old_mame_ini_dir.stat.isdir
- name: Create MAME directory structure
file:
path: "{{ mame_base_dir }}/{{ item }}"
state: directory
loop:
- cfg
- dats
- flyers
- hiscore
- ini/source
- nvram
- roms
- samples
- snaps
- videos
- name: Synchronize home directory files
synchronize:
src: home/
dest: "{{ ansible_user_dir }}"
# Skip updating files that already exist on the destination
# because some games (Qix and Zoo Keeper) configure cocktail
# mode in nvram and we don't want to overwrite high scores.
- name: Syncronize home directory files without overwriting
synchronize:
src: home-no-overwrite/
dest: "{{ ansible_user_dir }}"
rsync_opts: --ignore-existing
- name: Generate default mame configuration
command: /usr/local/bin/mamecocktail -createconfig
args:
chdir: "{{ mame_base_dir }}/ini"
- name: Customize mame configuration (mame.ini)
lineinfile:
path: "{{ mame_base_dir }}/ini/mame.ini"
regexp: "^({{ item.key }}\\s+)"
line: "\\g<1>{{ item.value }}"
backrefs: yes
loop:
- key: autorol
value: 1
- key: autostretchxy
value: 1
- key: dial_device
value: mouse
- key: pluginspath
value: /usr/local/games/mame/plugins
- key: rompath
value: roms
- key: samplerate
value: 44100
- key: skip_gameinfo
value: 1
- key: skip_warnings
value: 1
- key: trackball_device
value: mouse
- key: unevenstretch
value: 0
- key: video
value: accel
- key: videodriver
value: kmsdrm
- key: waitvsync
value: 1
- name: Customize mame configuration (plugin.ini)
lineinfile:
path: "{{ mame_base_dir }}/ini/plugin.ini"
regexp: "^({{ item.key }}\\s+)"
line: "\\g<1>{{ item.value }}"
backrefs: yes
loop:
- key: hiscore
value: 1
- name: Customize horizontal games (horizont.ini)
copy:
content: |
# Rotate for vertical monitor
rol 1
# This distorts the aspect ratio but fills the vertical monitor
keepaspect 0
dest: "{{ mame_base_dir }}/ini/horizont.ini"
mode: '0644'
- name: Customize Capcom Bowling (capbowl.ini)
copy:
content: |
# This distorts the aspect ratio but fills the vertical monitor
keepaspect 0
dest: "{{ mame_base_dir }}/ini/capbowl.ini"
mode: '0644'
- name: Customize qix driver (source/qix.ini)
copy:
content: |
# Flip screen for cocktail mode (set in nvram)
flipx 1
flipy 1
dest: "{{ mame_base_dir }}/ini/source/qix.ini"
mode: '0644'
- name: Verify ROM sets
command: /usr/local/bin/mamecocktail -verifyroms
args:
chdir: "{{ mame_base_dir }}"
changed_when: False
- name: Verify sample sets
command: /usr/local/bin/mamecocktail -verifysamples
args:
chdir: "{{ mame_base_dir }}"
changed_when: False
- name: Generate romlist for mame (first time only)
command: /usr/local/bin/attract --build-romlist mame
args:
creates: "{{ ansible_user_dir }}/.attract/romlists/mame.txt"
register: attract_build_romlist
- name: Scrape artwork for mame (first time only)
command: /usr/local/bin/attract --scrape-art mame
when: attract_build_romlist.changed
register: attract_scrape_art
# Ignore any scraping errors since it's non-critical and
# depends on 3rd party services which may be unavailable.
ignore_errors: yes