2020-12-23 17:14:13 +00:00
|
|
|
|
2024-06-27 18:14:23 +00:00
|
|
|
MB_AUTOEXEC_VERSION ?= on
|
2020-12-23 17:14:13 +00:00
|
|
|
MB_AUTOEXEC_STARTUP_TIMEOUT ?= 60
|
|
|
|
MB_AUTOEXEC_STARTUP_EXITCODE ?= 124
|
|
|
|
MB_AUTOEXEC_TEST_TIMEOUT ?= 120
|
|
|
|
MB_AUTOEXEC_TEST_EXITCODE ?= 1
|
2021-07-06 18:56:16 +00:00
|
|
|
MB_AUTOEXEC_CMD_TIMEOUT ?= 300
|
|
|
|
MB_AUTOEXEC_CMD_EXITCODE ?= 1
|
2020-12-23 17:14:13 +00:00
|
|
|
|
|
|
|
define mb_autoexec_append_cmd
|
|
|
|
echo "$(2)\r" >> $(1)/autoexec.bat
|
|
|
|
endef
|
|
|
|
define mb_autoexec_append_echo
|
2024-06-29 01:08:21 +00:00
|
|
|
$(call mb_autoexec_append_cmd,$(1),echo $(subst >,>,$(2)))
|
2020-12-23 17:14:13 +00:00
|
|
|
endef
|
|
|
|
define mb_autoexec_append_rem
|
|
|
|
$(call mb_autoexec_append_cmd,$(1),rem $(2))
|
|
|
|
endef
|
2024-06-29 13:47:52 +00:00
|
|
|
define mb_autoexec_append_show_gui
|
|
|
|
$(call mb_autoexec_append_cmd,$(1),omsxctl boot_mode_show_gui)
|
2020-12-23 17:14:13 +00:00
|
|
|
endef
|
|
|
|
define mb_autoexec_append_stop_fail
|
|
|
|
$(call mb_autoexec_append_cmd,$(1),omsxctl fail_after 0)
|
|
|
|
endef
|
|
|
|
define mb_autoexec_append_exit
|
2024-06-29 13:47:52 +00:00
|
|
|
$(if $(filter on,$(MB_FLIGHT_SCREEN)),$(call mb_autoexec_append_save_screenshot,$(1)))
|
|
|
|
$(call mb_autoexec_append_cmd,$(1),omsxctl boot_exec_exit)
|
2020-12-23 17:14:13 +00:00
|
|
|
endef
|
2024-06-29 02:46:30 +00:00
|
|
|
define mb_autoexec_append_joyporta_mouse
|
|
|
|
$(call mb_autoexec_append_cmd,$(1),omsxctl plug joyporta mouse)
|
|
|
|
endef
|
2024-06-29 13:47:52 +00:00
|
|
|
define mb_autoexec_append_save_screenshot
|
|
|
|
$(call mb_autoexec_append_cmd,$(1),omsxctl save_flight_screenshot $(2))
|
|
|
|
endef
|
|
|
|
define mb_autoexec_append_save_video
|
|
|
|
$(call mb_autoexec_append_cmd,$(1),omsxctl save_flight_video $(2))
|
|
|
|
endef
|
2024-06-27 14:58:21 +00:00
|
|
|
define mb_autoexec_append_safe_test
|
2024-06-28 21:27:47 +00:00
|
|
|
$(call mb_autoexec_append_cmd,$(1),omsxctl fail_after $(if $(3),$(3),$(MB_AUTOEXEC_TEST_TIMEOUT)) seconds failed_test $(if $(4),$(4),$(MB_AUTOEXEC_TEST_EXITCODE)))
|
2024-06-29 01:08:21 +00:00
|
|
|
$(call mb_autoexec_append_echo,$(1),Running test: $(2))
|
2024-06-26 00:26:48 +00:00
|
|
|
$(call mb_autoexec_append_cmd,$(1),$(2))
|
|
|
|
endef
|
2024-06-27 14:58:21 +00:00
|
|
|
define mb_autoexec_append_safe_cmd
|
2024-06-28 21:27:47 +00:00
|
|
|
$(call mb_autoexec_append_cmd,$(1),omsxctl fail_after $(if $(3),$(3),$(MB_AUTOEXEC_CMD_TIMEOUT)) seconds failed_cmd $(if $(4),$(4),$(MB_AUTOEXEC_CMD_EXITCODE)))
|
2024-06-29 01:08:21 +00:00
|
|
|
$(call mb_autoexec_append_echo,$(1),Running command: $(2))
|
2024-06-27 14:58:21 +00:00
|
|
|
$(call mb_autoexec_append_cmd,$(1),$(2))
|
|
|
|
endef
|
2020-12-23 17:14:13 +00:00
|
|
|
define mb_autoexec_write_default
|
2024-06-29 22:12:21 +00:00
|
|
|
@echo === Writing autoexec.bat for $@
|
2024-06-27 17:09:38 +00:00
|
|
|
@echo -n "" > $(1)/autoexec.bat
|
|
|
|
$(if $(filter 40,$(2)),$(call mb_autoexec_append_cmd,$(1),mode 40),$(call mb_autoexec_append_cmd,$(1),mode 80))
|
2024-06-29 13:47:52 +00:00
|
|
|
$(call mb_autoexec_append_echo,$(1),==== MSXBUILD ====)
|
|
|
|
$(if $(filter 40,$(2)),$(call mb_autoexec_append_echo,$(1),Boot mode 40),$(call mb_autoexec_append_echo,$(1),Boot mode 80))
|
|
|
|
$(call mb_autoexec_append_cmd,$(1),omsxctl boot_exec_color_dark)
|
2024-06-29 14:04:44 +00:00
|
|
|
$(if $(filter on,$(MB_FLIGHT_VIDEO)),$(call mb_autoexec_append_save_video,$(1)))
|
2024-06-27 14:58:21 +00:00
|
|
|
$(call mb_autoexec_append_cmd,$(1),omsxctl fail_after $(MB_AUTOEXEC_STARTUP_TIMEOUT) seconds failed_exec $(MB_AUTOEXEC_STARTUP_EXITCODE))
|
2024-06-27 18:14:23 +00:00
|
|
|
$(if $(filter on,$(MB_AUTOEXEC_VERSION)),$(call mb_autoexec_append_cmd,$(1),ver))
|
2024-06-29 00:49:16 +00:00
|
|
|
$(if $(wildcard $(1)/utils),$(call mb_autoexec_append_cmd,$(1),PATH + A:\))
|
|
|
|
$(if $(wildcard $(1)/utils),$(call mb_autoexec_append_cmd,$(1),PATH + A:\UTILS))
|
|
|
|
$(if $(wildcard $(1)/utils),$(call mb_autoexec_append_cmd,$(1),PATH))
|
2024-06-29 13:47:52 +00:00
|
|
|
$(if $(filter on,$(MB_AUTOEXEC_VERSION)),$(call mb_autoexec_append_cmd,$(1),omsxctl boot_exec_config_info))
|
|
|
|
$(call mb_autoexec_append_echo,$(1),Run folder $(1))
|
|
|
|
$(call mb_autoexec_append_echo,$(1),Run target $@)
|
2020-12-23 17:14:13 +00:00
|
|
|
endef
|
|
|
|
|
2024-06-29 13:47:52 +00:00
|
|
|
define _mb_autoexec_show_gui
|
2024-06-27 17:09:38 +00:00
|
|
|
$(call mb_autoexec_write_default,$(1),$(2))
|
2020-12-23 17:14:13 +00:00
|
|
|
$(call mb_autoexec_append_stop_fail,$(1))
|
2024-06-29 13:47:52 +00:00
|
|
|
$(call mb_autoexec_append_show_gui,$(1))
|
2024-06-29 02:46:30 +00:00
|
|
|
$(if $(filter mouse,$(4)),$(call mb_autoexec_append_joyporta_mouse,$(1)))
|
2024-06-29 13:47:52 +00:00
|
|
|
$(call mb_autoexec_append_echo,$(1),Type shutdown to stop emulation)
|
2024-06-29 01:08:21 +00:00
|
|
|
$(if $(3),$(call mb_autoexec_append_echo,$(1),Running command: $(3)))
|
2024-06-27 17:09:38 +00:00
|
|
|
$(if $(3),$(call mb_autoexec_append_cmd,$(1),$(3)))
|
2020-12-23 17:14:13 +00:00
|
|
|
endef
|
2024-06-29 13:47:52 +00:00
|
|
|
define mb_autoexec_show_gui40
|
|
|
|
$(call _mb_autoexec_show_gui,$(1),40,$(2))
|
2024-06-27 17:09:38 +00:00
|
|
|
endef
|
2024-06-29 13:47:52 +00:00
|
|
|
define mb_autoexec_show_gui40_mouse
|
|
|
|
$(call _mb_autoexec_show_gui,$(1),40,$(2),mouse)
|
2024-06-29 02:46:30 +00:00
|
|
|
endef
|
2024-06-29 13:47:52 +00:00
|
|
|
define mb_autoexec_show_gui80
|
|
|
|
$(call _mb_autoexec_show_gui,$(1),80,$(2))
|
2024-06-27 17:09:38 +00:00
|
|
|
endef
|
2024-06-29 13:47:52 +00:00
|
|
|
define mb_autoexec_show_gui80_mouse
|
|
|
|
$(call _mb_autoexec_show_gui,$(1),80,$(2),mouse)
|
2024-06-29 02:46:30 +00:00
|
|
|
endef
|
2024-06-27 17:09:38 +00:00
|
|
|
|
|
|
|
define mb_autoexec_safe_cmd
|
|
|
|
$(call mb_autoexec_write_default,$(1),$(3))
|
2024-06-27 14:58:21 +00:00
|
|
|
$(call mb_autoexec_append_safe_cmd,$(1),$(2))
|
2020-12-23 17:14:13 +00:00
|
|
|
$(call mb_autoexec_append_exit,$(1))
|
|
|
|
endef
|
2024-06-27 17:09:38 +00:00
|
|
|
define mb_autoexec_safe_test
|
|
|
|
$(call mb_autoexec_write_default,$(1),$(3))
|
2024-06-27 14:58:21 +00:00
|
|
|
$(call mb_autoexec_append_safe_test,$(1),$(2))
|
2020-12-23 17:14:13 +00:00
|
|
|
$(call mb_autoexec_append_exit,$(1))
|
|
|
|
endef
|