2020-12-23 17:14:13 +00:00
|
|
|
|
2024-06-27 18:14:23 +00:00
|
|
|
MB_AUTOEXEC_BYSELF ?= on
|
2024-06-27 14:58:21 +00:00
|
|
|
MB_AUTOEXEC_BYSELF_MSG ?= Run msxbuild:
|
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
|
|
|
|
$(call mb_autoexec_append_cmd,$(1),echo $(2))
|
|
|
|
endef
|
|
|
|
define mb_autoexec_append_rem
|
|
|
|
$(call mb_autoexec_append_cmd,$(1),rem $(2))
|
|
|
|
endef
|
|
|
|
define mb_autoexec_append_gui_mode
|
2024-06-23 23:44:27 +00:00
|
|
|
$(call mb_autoexec_append_echo,$(1),Enabling SDL renderer.)
|
2024-06-27 17:09:38 +00:00
|
|
|
$(call mb_autoexec_append_cmd,$(1),omsxctl set renderer SDL)
|
2024-06-23 23:44:27 +00:00
|
|
|
$(call mb_autoexec_append_echo,$(1),Enabling CPU throttling.)
|
2024-06-27 17:09:38 +00:00
|
|
|
$(call mb_autoexec_append_cmd,$(1),omsxctl set throttle on)
|
2020-12-23 17:14:13 +00:00
|
|
|
endef
|
|
|
|
define mb_autoexec_append_stop_fail
|
|
|
|
$(call mb_autoexec_append_echo,$(1),Disabling automatic failure.)
|
|
|
|
$(call mb_autoexec_append_cmd,$(1),omsxctl fail_after 0)
|
|
|
|
endef
|
|
|
|
define mb_autoexec_append_exit
|
|
|
|
$(call mb_autoexec_append_cmd,$(1),omsxctl exit 0)
|
|
|
|
endef
|
2024-06-27 14:58:21 +00:00
|
|
|
define mb_autoexec_append_safe_test
|
2024-06-26 00:26:48 +00:00
|
|
|
$(call mb_autoexec_append_cmd,$(1),omsxctl fail_after $(MB_AUTOEXEC_TEST_TIMEOUT) seconds failed_test $(MB_AUTOEXEC_TEST_EXITCODE))
|
|
|
|
$(call mb_autoexec_append_echo,$(1),Running test '$(2)')
|
|
|
|
$(call mb_autoexec_append_cmd,$(1),$(2))
|
|
|
|
endef
|
2024-06-27 14:58:21 +00:00
|
|
|
define mb_autoexec_append_safe_cmd
|
|
|
|
$(call mb_autoexec_append_cmd,$(1),omsxctl fail_after $(MB_AUTOEXEC_CMD_TIMEOUT) seconds failed_cmd $(MB_AUTOEXEC_CMD_EXITCODE))
|
|
|
|
$(call mb_autoexec_append_echo,$(1),Running test '$(2)')
|
|
|
|
$(call mb_autoexec_append_cmd,$(1),$(2))
|
|
|
|
endef
|
2020-12-23 17:14:13 +00:00
|
|
|
define mb_autoexec_write_default
|
2024-06-27 17:09:38 +00:00
|
|
|
@echo === Writing autoexec.bat for $(notdir $(1))
|
|
|
|
@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))
|
|
|
|
$(if $(filter 40,$(2)),$(call mb_autoexec_append_echo,$(1),Enabled mode 40.),$(call mb_autoexec_append_echo,$(1),Enabled mode 80.))
|
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 17:09:38 +00:00
|
|
|
$(call mb_autoexec_append_cmd,$(1),omsxctl setcolor 4 000)
|
|
|
|
$(call mb_autoexec_append_cmd,$(1),omsxctl setcolor 15 777)
|
2024-06-27 18:14:23 +00:00
|
|
|
$(if $(filter on,$(MB_AUTOEXEC_VERSION)),$(call mb_autoexec_append_cmd,$(1),ver))
|
|
|
|
$(if $(filter on,$(MB_AUTOEXEC_BYSELF)),$(call mb_autoexec_append_echo,$(1),$(MB_AUTOEXEC_BYSELF_MSG) $(notdir $(1))))
|
2020-12-23 17:14:13 +00:00
|
|
|
endef
|
|
|
|
|
2024-06-27 17:09:38 +00:00
|
|
|
define _mb_autoexec_open_gui
|
|
|
|
$(call mb_autoexec_write_default,$(1),$(2))
|
2020-12-23 17:14:13 +00:00
|
|
|
$(call mb_autoexec_append_stop_fail,$(1))
|
2024-06-21 19:08:09 +00:00
|
|
|
$(call mb_autoexec_append_gui_mode,$(1))
|
2024-06-23 23:39:59 +00:00
|
|
|
$(call mb_autoexec_append_echo,$(1),Type shutdown to stop emulation.)
|
2024-06-27 17:09:38 +00:00
|
|
|
$(if $(3),$(call mb_autoexec_append_echo,$(1),Running command '$(3)'))
|
|
|
|
$(if $(3),$(call mb_autoexec_append_cmd,$(1),$(3)))
|
2020-12-23 17:14:13 +00:00
|
|
|
endef
|
2024-06-27 17:09:38 +00:00
|
|
|
define mb_autoexec_open_gui40
|
|
|
|
$(call _mb_autoexec_open_gui,$(1),40)
|
|
|
|
endef
|
|
|
|
define mb_autoexec_open_gui40_cmd
|
|
|
|
$(call _mb_autoexec_open_gui,$(1),40,$(2))
|
|
|
|
endef
|
|
|
|
define mb_autoexec_open_gui80
|
|
|
|
$(call _mb_autoexec_open_gui,$(1),80)
|
2020-12-23 17:14:13 +00:00
|
|
|
endef
|
2024-06-27 17:09:38 +00:00
|
|
|
define mb_autoexec_open_gui80_cmd
|
|
|
|
$(call _mb_autoexec_open_gui,$(1),80,$(2))
|
|
|
|
endef
|
|
|
|
|
|
|
|
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
|