diff --git a/data/Tupfile.lua b/data/Tupfile.lua index 7d849d925..0e86e839f 100644 --- a/data/Tupfile.lua +++ b/data/Tupfile.lua @@ -800,6 +800,7 @@ if tup.getconfig('NO_NASM') ~= 'full' then {"kolibrios/games/wolf3d/", VAR_CONTRIB .. "/games/wolf3d/wolf3d"}, {"kolibrios/games/wolf3d/", "common/games/wolf3d/*"}, {"kolibrios/emul/dgen/dgen", VAR_PROGS .. "/emulator/dgen-sdl-1.33/dgen"}, + {"kolibrios/emul/dgen/dgen_open", VAR_PROGS .. "/fs/wrap_open/wrap_open"}, {"kolibrios/emul/dgen/dgen.html", SRC_PROGS .. "/emulator/dgen-sdl-1.33/dgen.html"}, {"kolibrios/emul/dgen/dgenrc.html", SRC_PROGS .. "/emulator/dgen-sdl-1.33/dgenrc.html"}, }) diff --git a/data/common/settings/assoc.ini b/data/common/settings/assoc.ini index f8bf1f9bf..0558ddae4 100644 --- a/data/common/settings/assoc.ini +++ b/data/common/settings/assoc.ini @@ -190,8 +190,8 @@ gbc=/kolibrios/emul/gameboy min=/kolibrios/emul/pokemini nc=/kolibrios/utils/cnc_editor/cnc_editor ch8=/kolibrios/emul/chip8/chip8 -md=/kolibrios/emul/dgen/dgen -gen=/kolibrios/emul/dgen/dgen +md=/kolibrios/emul/dgen/dgen_open +gen=/kolibrios/emul/dgen/dgen_open rom=/kolibrios/emul/uxn zip=$Unz diff --git a/programs/fs/wrap_open/Tupfile.lua b/programs/fs/wrap_open/Tupfile.lua new file mode 100644 index 000000000..14eaf414b --- /dev/null +++ b/programs/fs/wrap_open/Tupfile.lua @@ -0,0 +1,3 @@ +if tup.getconfig("NO_FASM") ~= "" then return end +tup.include("../../use_fasm.lua") +tup.rule("wrap_open.asm", FASM .. " %f %o " .. tup.getconfig("KPACK_CMD"), "wrap_open") \ No newline at end of file diff --git a/programs/fs/wrap_open/wrap_open.asm b/programs/fs/wrap_open/wrap_open.asm new file mode 100644 index 000000000..db6362443 --- /dev/null +++ b/programs/fs/wrap_open/wrap_open.asm @@ -0,0 +1,63 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; Copyright (C) KolibriOS team 2013-2024. All rights reserved. ;; +;; Distributed under terms of the GNU General Public License. ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; wraps command line arguments in quotes and launches a target. + include 'KOSfuncs.inc' + include 'macros.inc' + + org 0x0 + use32 + + db 'MENUET01' + dd 1 + dd start + dd i_end + dd m_end + dd m_end + dd path + dd target_path + +start: + mov edi, target_path + or ecx, -1 + xor al, al + repne scasb + + sub edi, 6 + mov byte [edi], 0 + + cmp byte [path], 0 + je .launch + + mov byte [q_path], '"' + + mov edi, path + or ecx, -1 + xor al, al + repne scasb + + mov word [edi-1], '"' + + mov dword [fi + 8], q_path + +.launch: + mcall SF_FILE, fi + mcall SF_TERMINATE_PROCESS + +fi: + dd SSF_START_APP, 0, 0, 0, 0 + db 0 + dd target_path + +i_end: + +q_path rb 1 +path rb 255 + +target_path rb 1024 + +m_end: \ No newline at end of file