Fix @open to quote paths for DGEN compatibility

Added quote_param in open.asm to wrap paths in quotes.
Added strip_quotes macro in macros.inc and applied it
to kiv.asm, tinypad.asm, kpack.asm, and unz.asm.
This commit is contained in:
2026-02-24 14:06:02 +02:00
parent f9425f5bd0
commit c8efe352dc
6 changed files with 73 additions and 3 deletions

View File

@@ -107,6 +107,7 @@ __section @CODE ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
mov [s_search.size],ecx
rep movsb
strip_quotes @PARAMS
cmp byte[@PARAMS],0
jz no_params

View File

@@ -95,6 +95,7 @@ include 'dialogs.inc'
start:
strip_quotes params
;dnl
;dpsP params
;dnl

View File

@@ -613,3 +613,40 @@ EVM_STACK2 = 1000000000b
EVM_MOUSE_FILTER = 0x80000000
EVM_CURSOR_FILTER = 0x40000000
macro strip_quotes buffer {
local .done
local .shift
local .find_end
push eax esi edi
mov edi, buffer
cmp byte [edi], '"'
jne .done
;; shift string left by 1 to remove first quote
mov esi, edi
inc esi
.shift:
mov al, [esi]
mov [edi], al
inc esi
inc edi
test al, al
jnz .shift
;; now find the last quote (if any) and nullify it
mov edi, buffer
.find_end:
mov al, [edi]
test al, al
jz .done
cmp al, '"'
jne @f
mov byte [edi], 0
jmp .done
@@:
inc edi
jmp .find_end
.done:
pop edi esi eax
}

View File

@@ -47,6 +47,7 @@ START:
invoke sort.START, 1
strip_quotes __params
mov ecx, 1 ; for 15.4: 1 = tile
cmp word[__params], '\T'
jz set_bgr

View File

@@ -34,6 +34,7 @@ START:
mcall SF_SYS_MISC,SSF_HEAP_INIT
mcall SF_SET_EVENTS_MASK,0x80000027
strip_quotes params
load_libraries l_libs_start,load_lib_end
cmp eax,-1
je exit

View File

@@ -204,13 +204,14 @@ end if
;; if dialog
mov eax, [param_s]
mov [is_openas + 8], eax
cmpne [eax], byte '~', @f
inc [param_s]
mov eax, [param_s]
stdcall quote_param, [param_s], param_quoted
mov [is_openas + 8], eax
jmp start_dialog
@@:
stdcall quote_param, [param_s], param_quoted
mov [is_openas + 8], eax
;; if without '.' - execute
stdcall string.last_index_of, [param_s], '.', 1
@@ -257,7 +258,7 @@ end if
invoke libini.get_str, assoc_ini, buffer + 1, assoc_ini.exec, buffer, 2048, undefined
cmpe [buffer], byte 0, ini_error
@@:
mov eax, [param_s]
stdcall quote_param, [param_s], param_quoted
mov [is_open + 8], eax
mcall 70, is_open
jmp exit
@@ -886,6 +887,33 @@ end if
;----------------------
proc quote_param uses esi edi, _src, _dst
mov esi, [_src]
mov edi, [_dst]
cmp byte [esi], '"'
je .already_quoted
mov byte [edi], '"'
inc edi
.q_loop:
mov al, [esi]
test al, al
jz .q_end
mov [edi], al
inc esi
inc edi
jmp .q_loop
.q_end:
mov word [edi], '"'
mov eax, [_dst]
jmp .ret
.already_quoted:
mov eax, [_src]
.ret:
ret
endp
;----------------------
proc get_index
stdcall get_index_cur, [last_x], [last_y]
ret
@@ -1061,6 +1089,7 @@ end if
buffer7 rb 32 ;for sorting
buffer8 rd 2048
paramorig rb 2048
param_quoted rb 2048
_stack rb 2048
params rb 256
memory: