Подготовить автономную сборку и запуск перед разделением проектов

This commit is contained in:
Александр Петров
2026-09-15 23:04:04 +03:00
parent 5323b168a7
commit 0e74aaa7ee
116 changed files with 6908 additions and 333 deletions
+21 -8
View File
@@ -4,7 +4,6 @@
Использует копию системного HDD и собственную дискету/каталоги состояния.
Ничего не меняет в общих media или уже запущенном MAME.
"""
import importlib.util
import json
import os
from pathlib import Path
@@ -26,6 +25,8 @@ from sdbg.model import DebugMap
from sdbg.image import read_ihx
from sdbg.session import DebugSession
from mame_interactive import build_events
from make_disk import create_floppy_image
from mame_profile import MameProfile, write_keyboard_config
def wait_dap_stop(engine, timeout=15):
@@ -151,11 +152,13 @@ void worker(void) __banked {
launcher.terminate()
try: launcher.wait(timeout=8)
except subprocess.TimeoutExpired: launcher.kill();launcher.wait()
spec=importlib.util.spec_from_file_location('make_disk',ROOT/'mame/v306/make_disk.py')
disk=importlib.util.module_from_spec(spec);spec.loader.exec_module(disk)
disk.create_floppy_image(str(work/'probe.img'),[('PROBE.EXE',str(exe))])
profile=MameProfile.resolve()
if profile.binary is None and (ROOT/'mame/v306/mame.arm').is_file():
profile=MameProfile.resolve({'MAME_HOME':str(ROOT/'mame/v306')})
profile.validate(dss=True)
create_floppy_image(str(work/'probe.img'),[('PROBE.EXE',str(exe))])
system=work/'system.chd'
if not system.exists(): shutil.copyfile(ROOT/'mame/v306/IMG/sp_hdd_sys.chd',system)
if not system.exists(): shutil.copyfile(profile.system_hdd_image,system)
events=build_events([(10,'a:\\probe.exe\n')])
ev=',\n'.join('{'+f'{t},"{tag}",{mask},{value}'+'}' for t,tag,mask,value in events)
report=work/'result.jsonl'
@@ -234,15 +237,17 @@ emu.register_periodic(function()
end)
'''.replace('REPORT',json.dumps(str(report))).replace('EVENTS',ev)
.replace('SIGNATURE',','.join(map(str,signature))).replace('MAIN',str(main_address)))
command=[str(ROOT/'mame/v306/mame.arm'),'sprinter','-noreadconfig',
'-rompath',str(ROOT/'mame/v306/roms'),'-bios','v3.06','-kbd','ms_naturl,bios=sp2k',
command=[str(profile.binary),'sprinter','-noreadconfig',
'-rompath',str(profile.rompath),'-bios',profile.bios,'-kbd','ms_naturl,bios=sp2k',
'-video','none','-sound','none','-nothrottle','-skip_gameinfo',
'-beta:wd179x:0','35hd','-flop1',str(work/'probe.img'),
'-flop2',str(profile.dss_image),
'-hard1',str(system),'-debug','-debugger','none',
'-autoboot_delay','0','-autoboot_script',str(lua)]
for key in ['nvram','cfg','diff','snapshot']:
(work/key).mkdir(exist_ok=True)
command.extend(['-'+key+'_directory',str(work/key)])
write_keyboard_config(work/'cfg')
bridge_mode = '--bridge' in sys.argv
server_mode = '--server' in sys.argv
env = dict(os.environ)
@@ -254,8 +259,16 @@ end)
ipc=work/('ipc-'+uuid.uuid4().hex)
ipc.mkdir()
env.update(SDBG_IPC_DIR=str(ipc),SDBG_SESSION_ID=uuid.uuid4().hex)
plugin_paths = [ROOT / 'toolchain/mcp']
if profile.home:
installed = profile.home.parent / 'plugins'
if installed.is_dir():
plugin_paths.append(installed)
legacy = ROOT / 'mame/sources/MAME/plugins'
if legacy.is_dir():
plugin_paths.append(legacy)
command.extend(['-verbose','-plugin','sdbgbridge','-pluginspath',
str(ROOT/'toolchain/mcp')+';'+str(ROOT/'mame/sources/MAME/plugins')])
';'.join(map(str, plugin_paths))])
with (work/'mame.log').open('w') as log:
if not bridge_mode:
result=subprocess.run(command,cwd=work,env=env,stdout=log,stderr=subprocess.STDOUT,timeout=55)