Compare commits
36
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1ed8821346 | ||
|
|
7c9ad9dde9 | ||
|
|
c8cf7a834f | ||
|
|
3b8dc9662d | ||
|
|
a8412100b4 | ||
|
|
f711f9286b | ||
|
|
7802c7b18a | ||
|
|
8a94db94a5 | ||
|
|
513af11464 | ||
|
|
e0e8a35364 | ||
|
|
f2ea10c1cd | ||
|
|
302bf7e221 | ||
|
|
a3af661ed6 | ||
|
|
e74f989500 | ||
|
|
4fe3987e39 | ||
|
|
060ec1a5d0 | ||
|
|
882f1f0242 | ||
|
|
02070aa233 | ||
|
|
d0244f1513 | ||
|
|
44465b3cc2 | ||
|
|
1df9d8496d | ||
|
|
7917972a37 | ||
|
|
8334324d9c | ||
|
|
2757ea7d3e | ||
|
|
bf8ae67dbf | ||
|
|
69bd99e991 | ||
|
|
3bde56821f | ||
|
|
2c22604f39 | ||
|
|
de952921ee | ||
|
|
7f44db1b7f | ||
|
|
f143ca1928 | ||
|
|
931071a0e9 | ||
|
|
bed9528756 | ||
|
|
570a432a84 | ||
|
|
1215116155 | ||
|
|
e470ef5db5 |
No files matched your search
@@ -0,0 +1,54 @@
|
||||
# =============================================================================
|
||||
# Apps
|
||||
# User-facing applications, games, multimedia, UI and desktop resources
|
||||
# =============================================================================
|
||||
|
||||
^programs/(cmm|demos|emulator|games|media|other)/.* @KolibriOS/apps
|
||||
^contrib/(games|media|other)/.* @KolibriOS/apps
|
||||
^skins/.* @KolibriOS/apps
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# System
|
||||
# Kernel, drivers, filesystems, SDK, libraries, toolchain and system utilities
|
||||
# =============================================================================
|
||||
|
||||
^kernel/.* @KolibriOS/system
|
||||
^drivers/.* @KolibriOS/system
|
||||
|
||||
^programs/(bcc32|develop|fs|hd_load|system|testing)/.* @KolibriOS/system
|
||||
^contrib/(C_Layer|sdk|toolchain)/.* @KolibriOS/system
|
||||
|
||||
# Shared system/API includes in programs/
|
||||
^programs/[^/]+\\.inc$ @KolibriOS/system
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# Network
|
||||
# Network stack, network drivers, protocols, libraries and network applications
|
||||
# =============================================================================
|
||||
|
||||
^kernel/trunk/network/.* @KolibriOS/network
|
||||
|
||||
^drivers/ethernet/.* @KolibriOS/network
|
||||
^drivers/(mii|netdrv)\\.inc$ @KolibriOS/network
|
||||
|
||||
^programs/network/.* @KolibriOS/network
|
||||
^programs/network\\.inc$ @KolibriOS/network
|
||||
|
||||
^programs/develop/libraries/(http|network|kos_mbedtls)/.* @KolibriOS/network
|
||||
|
||||
^contrib/network/.* @KolibriOS/network
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# DevOps
|
||||
# CI/CD, repository infrastructure, build system and autobuild configuration
|
||||
# =============================================================================
|
||||
|
||||
^\\.gitea/.* @KolibriOS/devops
|
||||
^_tools/.* @KolibriOS/devops
|
||||
|
||||
^\\.gitmodules$ @KolibriOS/devops
|
||||
^build\\.txt$ @KolibriOS/devops
|
||||
^tup\\.config\\.template$ @KolibriOS/devops
|
||||
@@ -19,3 +19,38 @@
|
||||
owner: "{{ storage_user }}"
|
||||
group: "{{ storage_user }}"
|
||||
mode: preserve
|
||||
|
||||
# per-program binaries browsable at <version>/<lang>/data/, like on the old builds server
|
||||
- name: Creating build tree folders
|
||||
ansible.builtin.file:
|
||||
path: "{{ storage_path }}/{{ version }}/{{ item | basename | regex_replace('\\.tar\\.gz$', '') }}/data"
|
||||
state: directory
|
||||
owner: "{{ storage_user }}"
|
||||
group: "{{ storage_user }}"
|
||||
mode: '0755'
|
||||
with_fileglob: "{{ tree_artifact_path }}/*.tar.gz"
|
||||
|
||||
- name: Unpacking build trees
|
||||
ansible.builtin.unarchive:
|
||||
src: "{{ item }}"
|
||||
dest: "{{ storage_path }}/{{ version }}/{{ item | basename | regex_replace('\\.tar\\.gz$', '') }}/data"
|
||||
owner: "{{ storage_user }}"
|
||||
group: "{{ storage_user }}"
|
||||
with_fileglob: "{{ tree_artifact_path }}/*.tar.gz"
|
||||
|
||||
# stable URL for the newest build: <storage_path>/latest/<lang>/...
|
||||
- name: Updating latest symlink
|
||||
ansible.builtin.file:
|
||||
src: "{{ version }}"
|
||||
dest: "{{ storage_path }}/latest"
|
||||
state: link
|
||||
force: true
|
||||
owner: "{{ storage_user }}"
|
||||
group: "{{ storage_user }}"
|
||||
|
||||
# emulators hardcode <site root>/<lang>/data/data/kolibri.img; storage_path is the ci folder, one level under the site root
|
||||
- name: Sending bare images to stable emulator paths
|
||||
ansible.builtin.copy:
|
||||
src: "{{ stable_artifact_path }}/"
|
||||
dest: "{{ storage_path }}/../"
|
||||
mode: preserve
|
||||
+83
-22
@@ -162,12 +162,13 @@ jobs:
|
||||
tup init
|
||||
tup variant ${{ matrix.lang }}.config
|
||||
|
||||
# build the image for language variant
|
||||
# build the image for language variant; keep the tup log for publishing
|
||||
- name: Build KolibriOS
|
||||
run: |
|
||||
set -o pipefail
|
||||
export PATH=/home/autobuild/tools/win32/bin:$PATH
|
||||
source kos32-export-env-vars ${{ gitea.workspace }}
|
||||
tup build-${{ matrix.lang }}
|
||||
tup build-${{ matrix.lang }} 2>&1 | tee build.log
|
||||
|
||||
# stamp the cache with its commit so later builds diff against it
|
||||
- name: Record cache base commit
|
||||
@@ -181,15 +182,26 @@ jobs:
|
||||
id: vars
|
||||
run: echo "descr=$(git describe --tags)" >> $GITEA_OUTPUT
|
||||
|
||||
# rename build outputs to their final names so artifacts are bare files
|
||||
- name: Rename images
|
||||
# stage build outputs under their final names, plus distribution kit and checksums
|
||||
- name: Prepare artifacts
|
||||
run: |
|
||||
set -e
|
||||
BASE="kolibrios-${{ steps.vars.outputs.descr }}-${{ matrix.lang }}"
|
||||
for ext in img iso raw; do
|
||||
cp "build-${{ matrix.lang }}/data/kolibri.$ext" \
|
||||
"kolibrios-${{ steps.vars.outputs.descr }}-${{ matrix.lang }}.$ext"
|
||||
cp "build-${{ matrix.lang }}/data/kolibri.$ext" "$BASE.$ext"
|
||||
done
|
||||
# zip: distr targets Windows/DOS users, Explorer opens it natively
|
||||
(cd "build-${{ matrix.lang }}/data" && zip -r -9 -q "${{ gitea.workspace }}/$BASE.distr.zip" distribution_kit)
|
||||
# whole build tree for per-program downloads; the big images ship separately
|
||||
tar -C "build-${{ matrix.lang }}" \
|
||||
--exclude './data/kolibri.iso' \
|
||||
--exclude './data/kolibri.raw' \
|
||||
--exclude './data/distribution_kit' \
|
||||
-czf "$BASE.tree.tar.gz" .
|
||||
sha256sum "$BASE".img "$BASE".iso "$BASE".raw "$BASE".distr.zip > "$BASE.sha256sums.txt"
|
||||
mv build.log "$BASE.build.log"
|
||||
|
||||
#publish the three images; longer retention for the floppy image.
|
||||
# publish the images; longer retention for the floppy image
|
||||
- name: Upload floppy image
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
@@ -211,6 +223,34 @@ jobs:
|
||||
path: kolibrios-${{ steps.vars.outputs.descr }}-${{ matrix.lang }}.raw
|
||||
retention-days: 15
|
||||
|
||||
- name: Upload distribution kit
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: kolibrios-${{ steps.vars.outputs.descr }}-${{ matrix.lang }}.distr.zip
|
||||
path: kolibrios-${{ steps.vars.outputs.descr }}-${{ matrix.lang }}.distr.zip
|
||||
retention-days: 30
|
||||
|
||||
- name: Upload checksums
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: kolibrios-${{ steps.vars.outputs.descr }}-${{ matrix.lang }}.sha256sums.txt
|
||||
path: kolibrios-${{ steps.vars.outputs.descr }}-${{ matrix.lang }}.sha256sums.txt
|
||||
retention-days: 90
|
||||
|
||||
- name: Upload build log
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: kolibrios-${{ steps.vars.outputs.descr }}-${{ matrix.lang }}.build.log
|
||||
path: kolibrios-${{ steps.vars.outputs.descr }}-${{ matrix.lang }}.build.log
|
||||
retention-days: 90
|
||||
|
||||
- name: Upload build tree
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: kolibrios-${{ steps.vars.outputs.descr }}-${{ matrix.lang }}.tree.tar.gz
|
||||
path: kolibrios-${{ steps.vars.outputs.descr }}-${{ matrix.lang }}.tree.tar.gz
|
||||
retention-days: 15
|
||||
|
||||
deploy:
|
||||
name: "Publish Images"
|
||||
runs-on: ubuntu-latest
|
||||
@@ -235,31 +275,50 @@ jobs:
|
||||
run: |
|
||||
set -eu
|
||||
|
||||
rm -rf ./norm-artifacts
|
||||
mkdir -p ./norm-artifacts
|
||||
rm -rf ./norm-artifacts ./stable-artifacts ./tree-artifacts
|
||||
mkdir -p ./norm-artifacts ./stable-artifacts ./tree-artifacts
|
||||
|
||||
find ./artifacts -type f \( \
|
||||
-name 'kolibrios-*.img' -o \
|
||||
-name 'kolibrios-*.iso' -o \
|
||||
-name 'kolibrios-*.raw' \
|
||||
\) | while read -r file; do
|
||||
fname="$(basename "$file")" # kolibrios-<descr>-<lang>.<ext>
|
||||
name_without_ext="${fname%.*}"
|
||||
lang="${name_without_ext##*-}"
|
||||
find ./artifacts -type f -name 'kolibrios-*' | while read -r file; do
|
||||
fname="$(basename "$file")" # kolibrios-<descr>-<lang>.<suffix>
|
||||
case "$fname" in
|
||||
*.tree.tar.gz) stem="${fname%.tree.tar.gz}";;
|
||||
*.distr.zip) stem="${fname%.distr.zip}";;
|
||||
*.sha256sums.txt) stem="${fname%.sha256sums.txt}";;
|
||||
*.build.log) stem="${fname%.build.log}";;
|
||||
*.img) stem="${fname%.img}";;
|
||||
*.iso) stem="${fname%.iso}";;
|
||||
*.raw) stem="${fname%.raw}";;
|
||||
*) continue;;
|
||||
esac
|
||||
lang="${stem##*-}" # <lang> has no dashes, <descr> may
|
||||
|
||||
mkdir -p "./norm-artifacts/$lang"
|
||||
cp "$file" "./norm-artifacts/$lang/$fname"
|
||||
case "$fname" in
|
||||
*.tree.tar.gz)
|
||||
# unpacked on the server into <version>/<lang>/data/ for per-program downloads
|
||||
cp "$file" "./tree-artifacts/$lang.tar.gz";;
|
||||
*.sha256sums.txt)
|
||||
cp "$file" "./norm-artifacts/$lang/sha256sums.txt";;
|
||||
*.build.log)
|
||||
cp "$file" "./norm-artifacts/$lang/build.log";;
|
||||
*.img)
|
||||
cp "$file" "./norm-artifacts/$lang/$fname"
|
||||
# emulators (e.g. v86) hardcode <lang>/data/data/kolibri.img at the site root
|
||||
mkdir -p "./stable-artifacts/$lang/data/data"
|
||||
cp "$file" "./stable-artifacts/$lang/data/data/kolibri.img";;
|
||||
*)
|
||||
cp "$file" "./norm-artifacts/$lang/$fname";;
|
||||
esac
|
||||
done
|
||||
|
||||
# derive the version (git describe) from an artifact name:
|
||||
# kolibrios-<descr>-<lang>.<ext> -> <descr>
|
||||
sample="$(find ./norm-artifacts -type f -name 'kolibrios-*' | head -n1)"
|
||||
# derive the version (git describe) from an artifact name: kolibrios-<descr>-<lang>.iso -> <descr>
|
||||
sample="$(find ./norm-artifacts -type f -name 'kolibrios-*.iso' | head -n1)"
|
||||
base="$(basename "${sample%.*}")" # kolibrios-<descr>-<lang>
|
||||
version="${base%-*}" # kolibrios-<descr>
|
||||
version="${version#kolibrios-}" # <descr>
|
||||
echo "version=$version" >> $GITEA_OUTPUT
|
||||
|
||||
find ./norm-artifacts -type f -print
|
||||
find ./norm-artifacts ./stable-artifacts ./tree-artifacts -type f -print
|
||||
|
||||
- name: Setup SSH
|
||||
run: |
|
||||
@@ -285,4 +344,6 @@ jobs:
|
||||
-e "storage_path=${{ secrets.STORAGE_PATH }}" \
|
||||
-e "version=${{ steps.normalize.outputs.version }}" \
|
||||
-e "artifact_path=${{ gitea.workspace }}/norm-artifacts" \
|
||||
-e "stable_artifact_path=${{ gitea.workspace }}/stable-artifacts" \
|
||||
-e "tree_artifact_path=${{ gitea.workspace }}/tree-artifacts" \
|
||||
-v
|
||||
@@ -34,11 +34,10 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
token: ${{ secrets.BOT_TOKEN }}
|
||||
|
||||
- name: Bump ${{ matrix.name }} and open PR
|
||||
env:
|
||||
TOKEN: ${{ secrets.BOT_TOKEN }}
|
||||
TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
API: ${{ github.api_url }}
|
||||
REPO: ${{ github.repository }}
|
||||
NAME: ${{ matrix.name }}
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
branch = main
|
||||
[submodule "programs/develop/oberon07"]
|
||||
path = programs/develop/oberon07
|
||||
url = https://github.com/AntKrotov/oberon-07-compiler.git
|
||||
url = https://git.kolibrios.org/KolibriOS/oberon-07-compiler.git
|
||||
branch = master
|
||||
[submodule "programs/cmm"]
|
||||
path = programs/cmm
|
||||
|
||||
+2
-1
@@ -542,7 +542,7 @@ tup.append_table(img_files, {
|
||||
{"NETWORK/PING", VAR_PROGS .. "/network/ping/ping"},
|
||||
{"NETWORK/NETCFG", VAR_PROGS .. "/network/netcfg/netcfg"},
|
||||
{"NETWORK/NETSTAT", VAR_PROGS .. "/network/netstat/netstat"},
|
||||
{"NETWORK/NSINST", VAR_PROGS .. "/network/netsurf/nsinstall"},
|
||||
{"NETWORK/NETSURF", VAR_PROGS .. "/network/netsurf/netsurf"},
|
||||
{"NETWORK/NSLOOKUP", VAR_PROGS .. "/network/nslookup/nslookup"},
|
||||
{"NETWORK/PASTA", VAR_PROGS .. "/network/pasta/pasta"},
|
||||
{"NETWORK/SYNERGYC", VAR_PROGS .. "/network/synergyc/synergyc"},
|
||||
@@ -573,6 +573,7 @@ tup.append_table(img_files, {
|
||||
{"DRIVERS/UHCI.SYS", VAR_DRVS .. "/usb/uhci.sys"},
|
||||
{"DRIVERS/OHCI.SYS", VAR_DRVS .. "/usb/ohci.sys"},
|
||||
{"DRIVERS/EHCI.SYS", VAR_DRVS .. "/usb/ehci.sys"},
|
||||
{"DRIVERS/XHCI.SYS", VAR_DRVS .. "/usb/xhci/xhci.sys"},
|
||||
{"DRIVERS/USBHID.SYS", VAR_DRVS .. "/usb/usbhid/usbhid.sys"},
|
||||
{"DRIVERS/USBFTDI.SYS", VAR_DRVS .. "/usb/usbftdi/usbftdi.sys"},
|
||||
{"DRIVERS/USBOTHER.SYS",VAR_DRVS .. "/usb/usbother/usbother.sys"},
|
||||
|
||||
Binary file not shown.
@@ -243,7 +243,7 @@ x=204
|
||||
y=0
|
||||
[22]
|
||||
name=NETSURF
|
||||
path=/sys/NETWORK/NSINST
|
||||
path=/sys/NETWORK/NETSURF
|
||||
param=
|
||||
ico=125
|
||||
x=204
|
||||
|
||||
@@ -116,6 +116,7 @@
|
||||
33 HTTPGet |network/httpget
|
||||
33 Downloader |network/dl
|
||||
12 WebView Browser |network/webview
|
||||
12 NetSurf |network/netsurf
|
||||
#13 **** SERVERS
|
||||
24 FTP |network/ftpd
|
||||
#14 **** OTHER
|
||||
|
||||
@@ -243,7 +243,7 @@ x=204
|
||||
y=0
|
||||
[22]
|
||||
name=NETSURF
|
||||
path=/sys/NETWORK/NSINST
|
||||
path=/sys/NETWORK/NETSURF
|
||||
param=
|
||||
ico=125
|
||||
x=204
|
||||
|
||||
@@ -121,6 +121,7 @@
|
||||
16 HTTPGet |network/httpget
|
||||
16 Descargas |network/dl
|
||||
16 Navegador WebView |network/webview
|
||||
12 NetSurf |network/netsurf
|
||||
#15 **** OTROS
|
||||
16 Reloj analвgico |demos/aclock
|
||||
16 Reloj binario |demos/bcdclk
|
||||
|
||||
@@ -243,7 +243,7 @@ x=204
|
||||
y=0
|
||||
[22]
|
||||
name=NETSURF
|
||||
path=/sys/NETWORK/NSINST
|
||||
path=/sys/NETWORK/NETSURF
|
||||
param=
|
||||
ico=125
|
||||
x=204
|
||||
|
||||
@@ -115,6 +115,7 @@
|
||||
33 HTTPGet |network/httpget
|
||||
33 Загрузчик |network/dl
|
||||
12 Браузер WebView |network/webview
|
||||
12 Браузер NetSurf |network/netsurf
|
||||
#14 **** Разное
|
||||
00 Эмуляторы* > |@6
|
||||
45 Создание скриншотов |scrshoot
|
||||
|
||||
@@ -1754,8 +1754,14 @@ proc disk_read_write stdcall uses ebx esi edi, \
|
||||
mov eax, [numsectors]
|
||||
mov eax, [eax]
|
||||
; 2. The transfer length for SCSI_{READ,WRITE}10 commands can not be greater
|
||||
; than 0xFFFF, so split the request to slices with <= 0xFFFF sectors.
|
||||
max_sectors_at_time = 0xFFFF
|
||||
; than 0xFFFF sectors, but that is not the practical limit: the field size is
|
||||
; the only thing the standard bounds, while real sticks hang their firmware on
|
||||
; multi-megabyte single commands. The kernel disk cache asks for as much as
|
||||
; CACHE_MAX_ALLOC_SIZE (4 MB) in one call, i.e. 8192 sectors, and that is
|
||||
; exactly where such sticks stop answering and re-enumerate. Linux caps
|
||||
; usb-storage at 240 sectors (120 KB) for the same reason; do the same and
|
||||
; split larger requests into slices.
|
||||
max_sectors_at_time = 240
|
||||
.split:
|
||||
push eax ; .length_rest
|
||||
cmp eax, max_sectors_at_time
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
if tup.getconfig("NO_FASM") ~= "" then return end
|
||||
ROOT = "../../.."
|
||||
tup.rule("xhci.asm", "fasm %f %o " .. tup.getconfig("PESTRIP_CMD") .. tup.getconfig("KPACK_CMD"), "%B.sys")
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,993 @@
|
||||
; Device slots, contexts and pipes for the xHCI driver.
|
||||
; This file is included from xhci.asm.
|
||||
|
||||
; =============================================================================
|
||||
; ============================ Context helpers ================================
|
||||
; =============================================================================
|
||||
|
||||
; Returns the address of one context inside a context structure.
|
||||
; in: eax = base of the structure, ecx = index of the context,
|
||||
; esi -> usb_controller.
|
||||
; out: eax = address of the context.
|
||||
proc xhci_context
|
||||
push ecx edx
|
||||
mov edx, [esi+xhci_controller.ContextSize-XCD]
|
||||
imul edx, ecx
|
||||
add eax, edx
|
||||
pop edx ecx
|
||||
ret
|
||||
endp
|
||||
|
||||
; Zeroes the Input Context. The caller must hold CmdLock.
|
||||
; in: esi -> usb_controller.
|
||||
proc xhci_clear_input_ctx
|
||||
push eax ecx edi
|
||||
mov edi, [esi+xhci_controller.InputCtx-XCD]
|
||||
xor eax, eax
|
||||
mov ecx, 33*64/4
|
||||
rep stosd
|
||||
pop edi ecx eax
|
||||
ret
|
||||
endp
|
||||
|
||||
; Returns the pipe of the default control endpoint of the same device, which
|
||||
; represents the device as a whole.
|
||||
; in: ebx -> xhci_pipe. out: eax -> xhci_pipe or 0.
|
||||
proc xhci_ctrl_pipe
|
||||
mov eax, [ebx+xhci_pipe.DevPage]
|
||||
test eax, eax
|
||||
jz .nothing
|
||||
mov eax, [eax+XHCI_PIPES_OFS+1*4]
|
||||
test eax, eax
|
||||
jz .nothing
|
||||
sub eax, sizeof.xhci_pipe
|
||||
.nothing:
|
||||
ret
|
||||
endp
|
||||
|
||||
; Fills the Slot Context of the Input Context from the device description kept
|
||||
; in a pipe. The caller must hold CmdLock.
|
||||
; in: esi -> usb_controller, ebx -> xhci_pipe describing the device,
|
||||
; ecx = value for the Context Entries field.
|
||||
proc xhci_fill_slot_ctx
|
||||
push eax ecx edx edi
|
||||
mov eax, [esi+xhci_controller.InputCtx-XCD]
|
||||
push ecx
|
||||
movi ecx, 1
|
||||
call xhci_context
|
||||
pop ecx
|
||||
mov edi, eax
|
||||
; dword 0: Route String, Speed and Context Entries.
|
||||
mov eax, [ebx+xhci_pipe.Route]
|
||||
and eax, 0FFFFFh
|
||||
if XHCI_SUPERSPEED
|
||||
; A SuperSpeed root-port device carries the raw PORTSC speed identifier;
|
||||
; its kernel-visible Speed pretends high-speed and must not get here.
|
||||
mov edx, [ebx+xhci_pipe.PSIV]
|
||||
test edx, edx
|
||||
jnz .havespeed
|
||||
end if
|
||||
mov edx, [ebx+xhci_pipe.Speed]
|
||||
cmp edx, USB_SPEED_FS
|
||||
jz .fs
|
||||
cmp edx, USB_SPEED_LS
|
||||
jz .ls
|
||||
movi edx, XHCI_PSI_HS
|
||||
jmp .havespeed
|
||||
.fs:
|
||||
movi edx, XHCI_PSI_FS
|
||||
jmp .havespeed
|
||||
.ls:
|
||||
movi edx, XHCI_PSI_LS
|
||||
.havespeed:
|
||||
shl edx, 20
|
||||
or eax, edx
|
||||
shl ecx, 27
|
||||
or eax, ecx
|
||||
mov [edi], eax
|
||||
; dword 1: Root Hub Port Number.
|
||||
mov eax, [ebx+xhci_pipe.RootPort]
|
||||
shl eax, 16
|
||||
mov [edi+4], eax
|
||||
; dword 2: the Transaction Translator, if the device is served by one.
|
||||
mov eax, [ebx+xhci_pipe.TTSlot]
|
||||
test eax, eax
|
||||
jz @f
|
||||
mov edx, [ebx+xhci_pipe.TTPort]
|
||||
shl edx, 8
|
||||
or eax, edx
|
||||
@@:
|
||||
mov [edi+8], eax
|
||||
and dword [edi+12], 0
|
||||
pop edi edx ecx eax
|
||||
ret
|
||||
endp
|
||||
|
||||
; Fills the Endpoint Context of the Input Context for the given pipe.
|
||||
; The caller must hold CmdLock.
|
||||
; in: esi -> usb_controller, ebx -> xhci_pipe.
|
||||
proc xhci_fill_ep_ctx
|
||||
push eax ecx edx edi
|
||||
mov eax, [esi+xhci_controller.InputCtx-XCD]
|
||||
mov ecx, [ebx+xhci_pipe.DCI]
|
||||
inc ecx
|
||||
call xhci_context
|
||||
mov edi, eax
|
||||
; dword 0: Interval.
|
||||
mov eax, [ebx+xhci_pipe.Interval]
|
||||
shl eax, 16
|
||||
mov [edi], eax
|
||||
; dword 1: Error Count, Endpoint Type, Max Burst Size and Max Packet Size.
|
||||
mov eax, [ebx+xhci_pipe.EpType]
|
||||
shl eax, 3
|
||||
or eax, 3 shl 1 ; three retries before giving up
|
||||
mov edx, [ebx+xhci_pipe.MaxPacket]
|
||||
mov ecx, edx
|
||||
shr ecx, 11
|
||||
and ecx, 3 ; extra transactions per microframe
|
||||
shl ecx, 8
|
||||
or eax, ecx
|
||||
if XHCI_SUPERSPEED
|
||||
; A SuperSpeed bulk endpoint may allow bursts of several packets; the field
|
||||
; shares its bits with the extra-transactions ones, which are zero then.
|
||||
mov ecx, [ebx+xhci_pipe.MaxBurst]
|
||||
shl ecx, 8
|
||||
or eax, ecx
|
||||
end if
|
||||
and edx, 7FFh
|
||||
shl edx, 16
|
||||
or eax, edx
|
||||
mov [edi+4], eax
|
||||
; dwords 2 and 3: the TR Dequeue Pointer with the Dequeue Cycle State.
|
||||
mov eax, [ebx+xhci_pipe.Enqueue]
|
||||
shl eax, 4
|
||||
add eax, [ebx+xhci_pipe.RingPhys]
|
||||
or eax, [ebx+xhci_pipe.Cycle]
|
||||
mov [edi+8], eax
|
||||
and dword [edi+12], 0
|
||||
; dword 4: Average TRB Length, only a hint for the bandwidth scheduler.
|
||||
mov eax, [ebx+xhci_pipe.MaxPacket]
|
||||
and eax, 7FFh
|
||||
cmp [ebx+xhci_pipe.EpType], XHCI_EP_CONTROL
|
||||
jnz @f
|
||||
movi eax, 8
|
||||
@@:
|
||||
mov [edi+16], eax
|
||||
and dword [edi+20], 0
|
||||
pop edi edx ecx eax
|
||||
ret
|
||||
endp
|
||||
|
||||
; =============================================================================
|
||||
; ============================== Slot commands ================================
|
||||
; =============================================================================
|
||||
|
||||
; Issues the Address Device command for a newly created default control pipe.
|
||||
; in: esi -> usb_controller, ebx -> xhci_pipe. out: eax = 0 on failure.
|
||||
proc xhci_address_device
|
||||
push ebx ecx edx edi
|
||||
lea ecx, [esi+xhci_controller.CmdLock-XCD]
|
||||
invoke MutexLock
|
||||
call xhci_clear_input_ctx
|
||||
mov edx, [esi+xhci_controller.InputCtx-XCD]
|
||||
mov dword [edx+4], 3 ; add the Slot Context and endpoint zero
|
||||
movi ecx, 1
|
||||
call xhci_fill_slot_ctx
|
||||
call xhci_fill_ep_ctx
|
||||
mov [ebx+xhci_pipe.MaxDCI], 1
|
||||
; Point the DCBAA entry of the slot at the Device Context.
|
||||
mov eax, [esi+xhci_controller.CommonPage-XCD]
|
||||
mov ecx, [ebx+xhci_pipe.SlotId]
|
||||
mov edx, [ebx+xhci_pipe.DevPagePhys]
|
||||
mov [eax+ecx*8], edx
|
||||
and dword [eax+ecx*8+4], 0
|
||||
mov edx, [ebx+xhci_pipe.SlotId]
|
||||
shl edx, 24
|
||||
or edx, XHCI_TRB_ADDRESS_DEV shl 10
|
||||
mov eax, [esi+xhci_controller.InputCtxPhys-XCD]
|
||||
push ebx
|
||||
xor ebx, ebx
|
||||
xor ecx, ecx
|
||||
call xhci_cmd_submit
|
||||
pop ebx
|
||||
push eax
|
||||
lea ecx, [esi+xhci_controller.CmdLock-XCD]
|
||||
invoke MutexUnlock
|
||||
pop eax
|
||||
cmp eax, XHCI_CC_SUCCESS
|
||||
jz .ok
|
||||
DEBUGF 1,'K : XHCI: Address Device failed, code %d\n',eax
|
||||
xor eax, eax
|
||||
jmp .nothing
|
||||
.ok:
|
||||
movi eax, 1
|
||||
.nothing:
|
||||
pop edi edx ecx ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
; Issues a Configure Endpoint command that adds the given endpoint.
|
||||
; in: esi -> usb_controller, ebx -> xhci_pipe of the endpoint,
|
||||
; edi -> xhci_pipe of the default control endpoint of the same device.
|
||||
; out: eax = completion code.
|
||||
proc xhci_configure_endpoint
|
||||
push ebx ecx edx esi edi
|
||||
lea ecx, [esi+xhci_controller.CmdLock-XCD]
|
||||
invoke MutexLock
|
||||
call xhci_clear_input_ctx
|
||||
; Drop the endpoint and add it again, so that reopening an endpoint that has
|
||||
; been closed before also works.
|
||||
mov ecx, [ebx+xhci_pipe.DCI]
|
||||
movi eax, 1
|
||||
shl eax, cl
|
||||
mov edx, [esi+xhci_controller.InputCtx-XCD]
|
||||
mov [edx], eax
|
||||
or eax, 1 ; the Slot Context is always added
|
||||
mov [edx+4], eax
|
||||
call xhci_fill_ep_ctx
|
||||
; The Context Entries field must cover every endpoint in use by the device.
|
||||
mov ecx, [ebx+xhci_pipe.DCI]
|
||||
cmp ecx, [edi+xhci_pipe.MaxDCI]
|
||||
jae @f
|
||||
mov ecx, [edi+xhci_pipe.MaxDCI]
|
||||
@@:
|
||||
mov [edi+xhci_pipe.MaxDCI], ecx
|
||||
push ebx
|
||||
mov ebx, edi
|
||||
call xhci_fill_slot_ctx
|
||||
pop ebx
|
||||
mov edx, [ebx+xhci_pipe.SlotId]
|
||||
shl edx, 24
|
||||
or edx, XHCI_TRB_CONFIG_EP shl 10
|
||||
mov eax, [esi+xhci_controller.InputCtxPhys-XCD]
|
||||
push ebx
|
||||
xor ebx, ebx
|
||||
xor ecx, ecx
|
||||
call xhci_cmd_submit
|
||||
pop ebx
|
||||
push eax
|
||||
lea ecx, [esi+xhci_controller.CmdLock-XCD]
|
||||
invoke MutexUnlock
|
||||
pop eax
|
||||
pop edi esi edx ecx ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
; Tells the controller where the endpoint has to continue from.
|
||||
; in: esi -> usb_controller, ebx -> xhci_pipe.
|
||||
proc xhci_set_dequeue
|
||||
pushad
|
||||
cmp [ebx+xhci_pipe.SlotId], 0
|
||||
jz .nothing
|
||||
mov eax, [ebx+xhci_pipe.Dequeue]
|
||||
shl eax, 4
|
||||
add eax, [ebx+xhci_pipe.RingPhys]
|
||||
or eax, [ebx+xhci_pipe.Cycle]
|
||||
mov ecx, [ebx+xhci_pipe.DCI]
|
||||
shl ecx, 16
|
||||
mov edx, [ebx+xhci_pipe.SlotId]
|
||||
shl edx, 24
|
||||
or edx, ecx
|
||||
or edx, XHCI_TRB_SET_DEQ shl 10
|
||||
xor ebx, ebx
|
||||
xor ecx, ecx
|
||||
call xhci_cmd_sync
|
||||
cmp eax, XHCI_CC_SUCCESS
|
||||
jz .nothing
|
||||
DEBUGF 1,'K : XHCI: Set TR Dequeue Pointer failed, code %d\n',eax
|
||||
.nothing:
|
||||
popad
|
||||
ret
|
||||
endp
|
||||
|
||||
; =============================================================================
|
||||
; =============================== New device ==================================
|
||||
; =============================================================================
|
||||
|
||||
; Called from xhci_port_init and from the hub support code when a new device
|
||||
; has been connected and reset. Enables a device slot for it and hands it over
|
||||
; to the protocol layer.
|
||||
; in: esi -> usb_controller, eax = speed. out: eax = 0 on failure.
|
||||
proc xhci_new_device
|
||||
push ebx ecx edx edi
|
||||
mov [esi+usb_controller.ResettingSpeed], al
|
||||
; 1. Reserve room for the pseudo-pipe that describes the new device. Only the
|
||||
; fields read by xhci_init_pipe are filled in; the layout matches a real pipe,
|
||||
; so the result can be passed to usb_new_device as a usb_pipe pointer.
|
||||
sub esp, sizeof.xhci_pipe + 4
|
||||
mov ebx, esp
|
||||
push ebx
|
||||
mov edi, ebx
|
||||
xor eax, eax
|
||||
mov ecx, (sizeof.xhci_pipe + 4)/4
|
||||
rep stosd
|
||||
pop ebx
|
||||
mov [ebx+sizeof.xhci_pipe], esi ; usb_pipe.Controller
|
||||
movzx eax, [esi+usb_controller.ResettingSpeed]
|
||||
mov [ebx+xhci_pipe.Speed], eax
|
||||
; 2. Compute the root hub port, the route string and the tier of the device.
|
||||
movzx edx, [esi+usb_controller.ResettingPort]
|
||||
mov edi, [esi+usb_controller.ResettingHub]
|
||||
test edi, edi
|
||||
jnz .behind_hub
|
||||
mov eax, [esi+xhci_controller.PortMap-XCD+edx*4]
|
||||
mov [ebx+xhci_pipe.RootPort], eax
|
||||
if XHCI_SUPERSPEED
|
||||
mov eax, [esi+xhci_controller.ResettingPSIV-XCD]
|
||||
mov [ebx+xhci_pipe.PSIV], eax
|
||||
end if
|
||||
jmp .have_topology
|
||||
.behind_hub:
|
||||
; The parent hub is a device too, and its own pipe carries the topology data.
|
||||
mov eax, [edi+USB_HUB_CONFIGPIPE]
|
||||
sub eax, sizeof.xhci_pipe
|
||||
mov ecx, [eax+xhci_pipe.RootPort]
|
||||
mov [ebx+xhci_pipe.RootPort], ecx
|
||||
mov ecx, [eax+xhci_pipe.Depth]
|
||||
mov eax, [eax+xhci_pipe.Route]
|
||||
; The route string holds one nibble per tier, at most five of them.
|
||||
cmp ecx, 5
|
||||
jae .have_route
|
||||
push ecx edx
|
||||
shl ecx, 2
|
||||
inc edx ; the route uses 1-based port numbers
|
||||
cmp edx, 15
|
||||
jbe @f
|
||||
movi edx, 15
|
||||
@@:
|
||||
shl edx, cl
|
||||
or eax, edx
|
||||
pop edx ecx
|
||||
.have_route:
|
||||
inc ecx
|
||||
mov [ebx+xhci_pipe.Depth], ecx
|
||||
mov [ebx+xhci_pipe.Route], eax
|
||||
; 3. Low- and full-speed devices behind a high-speed hub need the address of
|
||||
; the Transaction Translator that serves them.
|
||||
cmp [ebx+xhci_pipe.Speed], USB_SPEED_HS
|
||||
jz .have_topology
|
||||
push ebx
|
||||
mov ecx, edx
|
||||
mov edx, edi
|
||||
invoke usbhc_api.usb_get_tt
|
||||
pop ebx
|
||||
test edx, edx
|
||||
jz .have_topology
|
||||
sub edx, sizeof.xhci_pipe
|
||||
mov eax, [edx+xhci_pipe.SlotId]
|
||||
mov [ebx+xhci_pipe.TTSlot], eax
|
||||
inc ecx
|
||||
mov [ebx+xhci_pipe.TTPort], ecx
|
||||
.have_topology:
|
||||
; 4. Ask the controller for a device slot.
|
||||
xor eax, eax
|
||||
push ebx
|
||||
xor ebx, ebx
|
||||
xor ecx, ecx
|
||||
mov edx, XHCI_TRB_ENABLE_SLOT shl 10
|
||||
call xhci_cmd_sync
|
||||
pop ebx
|
||||
cmp eax, XHCI_CC_SUCCESS
|
||||
jnz .fail
|
||||
test edx, edx
|
||||
jz .fail
|
||||
mov [ebx+xhci_pipe.SlotId], edx
|
||||
DEBUGF 1,'K : XHCI new device: slot %d, root port %d, route %x, speed %d\n',edx,[ebx+xhci_pipe.RootPort],[ebx+xhci_pipe.Route],[ebx+xhci_pipe.Speed]
|
||||
; 5. Hand the device over to the protocol layer. It opens the pipe of the
|
||||
; default control endpoint, and that is where the slot is really addressed.
|
||||
lea ecx, [ebx+sizeof.xhci_pipe]
|
||||
invoke usbhc_api.usb_new_device
|
||||
test eax, eax
|
||||
jnz .done
|
||||
; 6. The protocol layer has failed; release the slot again.
|
||||
mov edx, [ebx+xhci_pipe.SlotId]
|
||||
shl edx, 24
|
||||
or edx, XHCI_TRB_DISABLE_SLOT shl 10
|
||||
xor eax, eax
|
||||
xor ebx, ebx
|
||||
xor ecx, ecx
|
||||
call xhci_cmd_sync
|
||||
xor eax, eax
|
||||
jmp .done
|
||||
.fail:
|
||||
dbgstr 'XHCI: Enable Slot failed'
|
||||
xor eax, eax
|
||||
.done:
|
||||
add esp, sizeof.xhci_pipe + 4
|
||||
pop edi edx ecx ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
; =============================================================================
|
||||
; ================================= Pipes =====================================
|
||||
; =============================================================================
|
||||
|
||||
proc xhci_alloc_pipe
|
||||
push ebx ecx edi
|
||||
mov ebx, xhci_ep_mutex
|
||||
invoke usbhc_api.usb_allocate_common, sizeof.xhci_pipe + sizeof.usb_pipe
|
||||
test eax, eax
|
||||
jz @f
|
||||
; Zero the whole block: the kernel may call FreePipe for a pipe whose InitPipe
|
||||
; has never run, and that path must not act on garbage.
|
||||
mov edi, eax
|
||||
push eax
|
||||
xor eax, eax
|
||||
movi ecx, (sizeof.xhci_pipe + sizeof.usb_pipe + 3)/4
|
||||
rep stosd
|
||||
pop eax
|
||||
add eax, sizeof.xhci_pipe
|
||||
@@:
|
||||
pop edi ecx ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
proc xhci_free_pipe stdcall, ptr:dword
|
||||
push ebx esi edi
|
||||
mov ebx, [ptr]
|
||||
sub ebx, sizeof.xhci_pipe
|
||||
mov esi, [ebx+sizeof.xhci_pipe+usb_pipe.Controller]
|
||||
test esi, esi
|
||||
jz .free
|
||||
cmp [ebx+xhci_pipe.SlotId], 0
|
||||
jz .drop_pipe
|
||||
cmp [ebx+xhci_pipe.DCI], 1
|
||||
jnz .drop_pipe
|
||||
; This is the default control endpoint, that is, the handle of the whole
|
||||
; device: release the slot together with the per-device page.
|
||||
mov ecx, [ebx+xhci_pipe.SlotId]
|
||||
mov edx, ecx
|
||||
shl edx, 24
|
||||
or edx, XHCI_TRB_DISABLE_SLOT shl 10
|
||||
xor eax, eax
|
||||
push ebx
|
||||
xor ebx, ebx
|
||||
xor ecx, ecx
|
||||
call xhci_cmd_sync
|
||||
pop ebx
|
||||
; The controller may access the Device Context until the command above
|
||||
; completes, so only now may the DCBAA entry and the slot table forget it.
|
||||
mov ecx, [ebx+xhci_pipe.SlotId]
|
||||
mov edi, [esi+xhci_controller.CommonPage-XCD]
|
||||
and dword [edi+ecx*8], 0
|
||||
and dword [edi+ecx*8+4], 0
|
||||
and [esi+xhci_controller.SlotPages-XCD+ecx*4], 0
|
||||
mov eax, [ebx+xhci_pipe.DevPage]
|
||||
test eax, eax
|
||||
jz .drop_ring
|
||||
invoke KernelFree, eax
|
||||
and [ebx+xhci_pipe.DevPage], 0
|
||||
jmp .drop_ring
|
||||
.drop_pipe:
|
||||
; Remove the pipe from the per-device table, if it is still listed there.
|
||||
; On disconnect the kernel releases the pipes of a device in arbitrary order,
|
||||
; and the pipe of the default control endpoint - the owner of the per-device
|
||||
; page - may well be freed before this one, taking the page with it. The
|
||||
; authoritative pointer is the one in SlotPages: it is cleared when the slot
|
||||
; is released, so it can never point to freed memory.
|
||||
mov ecx, [ebx+xhci_pipe.SlotId]
|
||||
test ecx, ecx
|
||||
jz .drop_ring
|
||||
mov eax, [esi+xhci_controller.SlotPages-XCD+ecx*4]
|
||||
test eax, eax
|
||||
jz .drop_ring
|
||||
mov ecx, [ebx+xhci_pipe.DCI]
|
||||
cmp ecx, 32
|
||||
jae .drop_ring
|
||||
and dword [eax+XHCI_PIPES_OFS+ecx*4], 0
|
||||
.drop_ring:
|
||||
mov eax, [ebx+xhci_pipe.Ring]
|
||||
test eax, eax
|
||||
jz @f
|
||||
invoke KernelFree, eax
|
||||
and [ebx+xhci_pipe.Ring], 0
|
||||
@@:
|
||||
mov eax, [ebx+xhci_pipe.RingMap]
|
||||
test eax, eax
|
||||
jz .free
|
||||
invoke KernelFree, eax
|
||||
and [ebx+xhci_pipe.RingMap], 0
|
||||
.free:
|
||||
pop edi esi ebx
|
||||
mov eax, [ptr]
|
||||
sub eax, sizeof.xhci_pipe
|
||||
invoke usbhc_api.usb_free_common, eax
|
||||
ret
|
||||
endp
|
||||
|
||||
; Allocates the transfer ring of a pipe.
|
||||
; in: ebx -> xhci_pipe. out: eax = 0 on failure.
|
||||
proc xhci_alloc_ring
|
||||
push ecx edx
|
||||
call xhci_alloc_page
|
||||
test eax, eax
|
||||
jz .nothing
|
||||
mov [ebx+xhci_pipe.RingMap], eax
|
||||
call xhci_alloc_page
|
||||
test eax, eax
|
||||
jnz @f
|
||||
invoke KernelFree, [ebx+xhci_pipe.RingMap]
|
||||
and [ebx+xhci_pipe.RingMap], 0
|
||||
xor eax, eax
|
||||
jmp .nothing
|
||||
@@:
|
||||
mov [ebx+xhci_pipe.Ring], eax
|
||||
mov [ebx+xhci_pipe.RingPhys], edx
|
||||
; The last entry returns to the beginning of the ring and toggles the cycle.
|
||||
lea ecx, [eax+(XHCI_RING_TRBS-1)*16]
|
||||
mov [ecx], edx
|
||||
mov dword [ecx+12], (XHCI_TRB_LINK shl 10) + XHCI_TRB_TC
|
||||
and [ebx+xhci_pipe.Enqueue], 0
|
||||
and [ebx+xhci_pipe.Dequeue], 0
|
||||
and [ebx+xhci_pipe.Reserved], 0
|
||||
and [ebx+xhci_pipe.FirstFix], 0
|
||||
mov [ebx+xhci_pipe.Cycle], XHCI_TRB_C
|
||||
movi eax, 1
|
||||
.nothing:
|
||||
pop edx ecx
|
||||
ret
|
||||
endp
|
||||
|
||||
; Stores the pipe in the per-device table used by the event ring handler.
|
||||
; in: ebx -> xhci_pipe.
|
||||
proc xhci_register_pipe
|
||||
push eax ecx edx
|
||||
mov eax, [ebx+xhci_pipe.DevPage]
|
||||
test eax, eax
|
||||
jz @f
|
||||
mov ecx, [ebx+xhci_pipe.DCI]
|
||||
cmp ecx, 32
|
||||
jae @f
|
||||
lea edx, [ebx+sizeof.xhci_pipe]
|
||||
mov [eax+XHCI_PIPES_OFS+ecx*4], edx
|
||||
@@:
|
||||
pop edx ecx eax
|
||||
ret
|
||||
endp
|
||||
|
||||
; Computes the Interval field of the Endpoint Context of an interrupt endpoint.
|
||||
; The kernel passes bInterval from the endpoint descriptor: for high-speed
|
||||
; devices it is an exponent of 125 us periods, for low- and full-speed devices
|
||||
; it is a number of frames.
|
||||
; in: ebx -> xhci_pipe, eax = bInterval.
|
||||
proc xhci_calc_interval
|
||||
push eax ecx
|
||||
cmp [ebx+xhci_pipe.Speed], USB_SPEED_HS
|
||||
jnz .low_speed
|
||||
test eax, eax
|
||||
jz @f
|
||||
dec eax
|
||||
@@:
|
||||
jmp .clamp
|
||||
.low_speed:
|
||||
; One frame equals eight periods of 125 us, hence the offset of three.
|
||||
test eax, eax
|
||||
jnz @f
|
||||
movi eax, 1
|
||||
@@:
|
||||
bsr ecx, eax
|
||||
lea eax, [ecx+3]
|
||||
.clamp:
|
||||
cmp eax, 15
|
||||
jbe @f
|
||||
movi eax, 15
|
||||
@@:
|
||||
mov [ebx+xhci_pipe.Interval], eax
|
||||
pop ecx eax
|
||||
ret
|
||||
endp
|
||||
|
||||
; Called from usb_open_pipe.
|
||||
; in: edi -> usb_pipe for the target, ecx -> usb_pipe of the config pipe,
|
||||
; esi -> usb_controller, eax -> usb_gtd of the first descriptor,
|
||||
; [ebp+12] = endpoint, [ebp+16] = maxpacket, [ebp+20] = type,
|
||||
; [ebp+24] = interval.
|
||||
; out: eax = 0 on failure.
|
||||
proc xhci_init_pipe
|
||||
virtual at ebp+8
|
||||
.config_pipe dd ?
|
||||
.endpoint dd ?
|
||||
.maxpacket dd ?
|
||||
.type dd ?
|
||||
.interval dd ?
|
||||
end virtual
|
||||
push ebx
|
||||
sub edi, sizeof.xhci_pipe
|
||||
sub ecx, sizeof.xhci_pipe
|
||||
mov ebx, edi ; ebx -> xhci_pipe being initialized
|
||||
; 1. Copy the description of the device from the config pipe.
|
||||
mov eax, [ecx+xhci_pipe.SlotId]
|
||||
mov [ebx+xhci_pipe.SlotId], eax
|
||||
mov eax, [ecx+xhci_pipe.DevPage]
|
||||
mov [ebx+xhci_pipe.DevPage], eax
|
||||
mov eax, [ecx+xhci_pipe.DevPagePhys]
|
||||
mov [ebx+xhci_pipe.DevPagePhys], eax
|
||||
mov eax, [ecx+xhci_pipe.Speed]
|
||||
mov [ebx+xhci_pipe.Speed], eax
|
||||
mov eax, [ecx+xhci_pipe.RootPort]
|
||||
mov [ebx+xhci_pipe.RootPort], eax
|
||||
mov eax, [ecx+xhci_pipe.Route]
|
||||
mov [ebx+xhci_pipe.Route], eax
|
||||
mov eax, [ecx+xhci_pipe.Depth]
|
||||
mov [ebx+xhci_pipe.Depth], eax
|
||||
mov eax, [ecx+xhci_pipe.TTSlot]
|
||||
mov [ebx+xhci_pipe.TTSlot], eax
|
||||
mov eax, [ecx+xhci_pipe.TTPort]
|
||||
mov [ebx+xhci_pipe.TTPort], eax
|
||||
if XHCI_SUPERSPEED
|
||||
mov eax, [ecx+xhci_pipe.PSIV]
|
||||
mov [ebx+xhci_pipe.PSIV], eax
|
||||
end if
|
||||
; 2. Work out the Device Context Index and the endpoint type.
|
||||
mov eax, [.endpoint]
|
||||
test eax, eax
|
||||
jz .control_ep
|
||||
mov ecx, eax
|
||||
and ecx, 15
|
||||
add ecx, ecx
|
||||
test al, 80h
|
||||
jz @f
|
||||
inc ecx
|
||||
or [ebx+xhci_pipe.Flags], XHCI_PIPE_IN
|
||||
@@:
|
||||
mov [ebx+xhci_pipe.DCI], ecx
|
||||
mov eax, [.type]
|
||||
cmp eax, BULK_PIPE
|
||||
jz .bulk
|
||||
cmp eax, INTERRUPT_PIPE
|
||||
jz .interrupt
|
||||
; A control endpoint other than endpoint zero is unusual but legal.
|
||||
mov [ebx+xhci_pipe.EpType], XHCI_EP_CONTROL
|
||||
jmp .have_type
|
||||
.bulk:
|
||||
movi eax, XHCI_EP_BULK_OUT
|
||||
test [ebx+xhci_pipe.Flags], XHCI_PIPE_IN
|
||||
jz @f
|
||||
movi eax, XHCI_EP_BULK_IN
|
||||
@@:
|
||||
mov [ebx+xhci_pipe.EpType], eax
|
||||
jmp .have_type
|
||||
.interrupt:
|
||||
movi eax, XHCI_EP_INT_OUT
|
||||
test [ebx+xhci_pipe.Flags], XHCI_PIPE_IN
|
||||
jz @f
|
||||
movi eax, XHCI_EP_INT_IN
|
||||
@@:
|
||||
mov [ebx+xhci_pipe.EpType], eax
|
||||
mov eax, [.interval]
|
||||
call xhci_calc_interval
|
||||
.have_type:
|
||||
mov eax, [.maxpacket]
|
||||
mov [ebx+xhci_pipe.MaxPacket], eax
|
||||
if XHCI_SUPERSPEED
|
||||
call xhci_ss_get_burst
|
||||
end if
|
||||
jmp .alloc_ring
|
||||
.control_ep:
|
||||
; The default control endpoint always has index one. Until the real packet size
|
||||
; is known from the device descriptor, use the value the specification requires
|
||||
; for the speed of the device: the kernel asks for 64 regardless of the speed,
|
||||
; which is wrong for low- and full-speed devices.
|
||||
mov [ebx+xhci_pipe.DCI], 1
|
||||
mov [ebx+xhci_pipe.EpType], XHCI_EP_CONTROL
|
||||
movi eax, 64
|
||||
cmp [ebx+xhci_pipe.Speed], USB_SPEED_HS
|
||||
jz @f
|
||||
movi eax, 8
|
||||
@@:
|
||||
if XHCI_SUPERSPEED
|
||||
; A SuperSpeed device always uses 512 bytes on the default control endpoint.
|
||||
cmp [ebx+xhci_pipe.PSIV], XHCI_PSI_SS
|
||||
jb @f
|
||||
mov eax, 512
|
||||
@@:
|
||||
end if
|
||||
mov [ebx+xhci_pipe.MaxPacket], eax
|
||||
.alloc_ring:
|
||||
; 3. Allocate the transfer ring.
|
||||
call xhci_alloc_ring
|
||||
test eax, eax
|
||||
jz .fail
|
||||
; 4. Choose the software list the pipe belongs to and insert it there. The
|
||||
; hardware knows nothing about these lists; they exist only so that the kernel
|
||||
; can walk all pipes and reinsert an aborted one.
|
||||
lea edx, [esi+xhci_controller.ControlED-XCD]
|
||||
cmp [.type], BULK_PIPE
|
||||
jb @f
|
||||
lea edx, [esi+xhci_controller.BulkED-XCD]
|
||||
jz @f
|
||||
lea edx, [esi+xhci_controller.IntED-XCD]
|
||||
@@:
|
||||
lea edi, [ebx+sizeof.xhci_pipe]
|
||||
mov [edi+usb_pipe.BaseList], edx
|
||||
mov ecx, [edx+usb_pipe.NextVirt]
|
||||
mov [edi+usb_pipe.NextVirt], ecx
|
||||
mov [edi+usb_pipe.PrevVirt], edx
|
||||
mov [ecx+usb_pipe.PrevVirt], edi
|
||||
mov [edx+usb_pipe.NextVirt], edi
|
||||
; 5. Now do the hardware part.
|
||||
cmp [.endpoint], 0
|
||||
jz .address_device
|
||||
call xhci_register_pipe
|
||||
mov edi, [.config_pipe]
|
||||
sub edi, sizeof.xhci_pipe
|
||||
call xhci_configure_endpoint
|
||||
xhci_trace 'K : XHCI open pipe: slot %d dci %d\n', [ebx+xhci_pipe.SlotId], [ebx+xhci_pipe.DCI]
|
||||
cmp eax, XHCI_CC_SUCCESS
|
||||
jz .success
|
||||
DEBUGF 1,'K : XHCI: Configure Endpoint failed, code %d\n',eax
|
||||
jmp .unlink_fail
|
||||
.address_device:
|
||||
; 6. This is a new device: allocate its Device Context, publish the slot and
|
||||
; let the controller give the device a bus address.
|
||||
call xhci_alloc_page
|
||||
test eax, eax
|
||||
jz .unlink_fail
|
||||
mov [ebx+xhci_pipe.DevPage], eax
|
||||
mov [ebx+xhci_pipe.DevPagePhys], edx
|
||||
mov ecx, [ebx+xhci_pipe.SlotId]
|
||||
mov [esi+xhci_controller.SlotPages-XCD+ecx*4], eax
|
||||
call xhci_register_pipe
|
||||
call xhci_address_device
|
||||
test eax, eax
|
||||
jz .free_devpage
|
||||
.success:
|
||||
; usb_open_pipe keeps the pointer to the new pipe in edi across this call, so
|
||||
; it has to be handed back untouched; the branch above has overwritten it with
|
||||
; the pipe of the default control endpoint.
|
||||
lea edi, [ebx+sizeof.xhci_pipe]
|
||||
pop ebx
|
||||
movi eax, 1
|
||||
ret
|
||||
.free_devpage:
|
||||
mov ecx, [ebx+xhci_pipe.SlotId]
|
||||
and [esi+xhci_controller.SlotPages-XCD+ecx*4], 0
|
||||
mov eax, [ebx+xhci_pipe.DevPage]
|
||||
invoke KernelFree, eax
|
||||
and [ebx+xhci_pipe.DevPage], 0
|
||||
.unlink_fail:
|
||||
; Undo the insertion into the software list before failing.
|
||||
lea edi, [ebx+sizeof.xhci_pipe]
|
||||
mov eax, [edi+usb_pipe.NextVirt]
|
||||
mov edx, [edi+usb_pipe.PrevVirt]
|
||||
mov [eax+usb_pipe.PrevVirt], edx
|
||||
mov [edx+usb_pipe.NextVirt], eax
|
||||
.fail:
|
||||
lea edi, [ebx+sizeof.xhci_pipe]
|
||||
pop ebx
|
||||
xor eax, eax
|
||||
ret
|
||||
endp
|
||||
|
||||
; Removes the pipe from the hardware configuration of the device.
|
||||
; in: esi -> usb_controller, ebx -> usb_pipe.
|
||||
proc xhci_unlink_pipe
|
||||
pushad
|
||||
sub ebx, sizeof.xhci_pipe
|
||||
cmp [ebx+xhci_pipe.SlotId], 0
|
||||
jz .nothing
|
||||
cmp [ebx+xhci_pipe.DCI], 1
|
||||
jz .nothing ; the slot itself is released by FreePipe
|
||||
call xhci_ctrl_pipe
|
||||
test eax, eax
|
||||
jz .nothing
|
||||
mov edi, eax ; edi -> pipe of endpoint zero
|
||||
lea ecx, [esi+xhci_controller.CmdLock-XCD]
|
||||
invoke MutexLock
|
||||
call xhci_clear_input_ctx
|
||||
mov ecx, [ebx+xhci_pipe.DCI]
|
||||
movi eax, 1
|
||||
shl eax, cl
|
||||
mov edx, [esi+xhci_controller.InputCtx-XCD]
|
||||
mov [edx], eax ; drop this endpoint
|
||||
mov dword [edx+4], 1 ; keep the Slot Context
|
||||
mov ecx, [edi+xhci_pipe.MaxDCI]
|
||||
test ecx, ecx
|
||||
jnz @f
|
||||
movi ecx, 1
|
||||
@@:
|
||||
push ebx
|
||||
mov ebx, edi
|
||||
call xhci_fill_slot_ctx
|
||||
pop ebx
|
||||
mov edx, [ebx+xhci_pipe.SlotId]
|
||||
shl edx, 24
|
||||
or edx, XHCI_TRB_CONFIG_EP shl 10
|
||||
mov eax, [esi+xhci_controller.InputCtxPhys-XCD]
|
||||
xor ebx, ebx
|
||||
xor ecx, ecx
|
||||
call xhci_cmd_submit
|
||||
lea ecx, [esi+xhci_controller.CmdLock-XCD]
|
||||
invoke MutexUnlock
|
||||
.nothing:
|
||||
popad
|
||||
ret
|
||||
endp
|
||||
|
||||
; Temporarily removes the pipe from the hardware schedule.
|
||||
; in: esi -> usb_controller, ebx -> usb_pipe.
|
||||
proc xhci_disable_pipe
|
||||
pushad
|
||||
sub ebx, sizeof.xhci_pipe
|
||||
cmp [ebx+xhci_pipe.SlotId], 0
|
||||
jz .nothing
|
||||
mov ecx, [ebx+xhci_pipe.DCI]
|
||||
shl ecx, 16
|
||||
mov edx, [ebx+xhci_pipe.SlotId]
|
||||
shl edx, 24
|
||||
or edx, ecx
|
||||
or edx, XHCI_TRB_STOP_EP shl 10
|
||||
xor eax, eax
|
||||
xor ebx, ebx
|
||||
xor ecx, ecx
|
||||
call xhci_cmd_sync
|
||||
.nothing:
|
||||
popad
|
||||
ret
|
||||
endp
|
||||
|
||||
; Reinserts the pipe into the hardware schedule after xhci_disable_pipe, with
|
||||
; an empty transfer queue.
|
||||
; in: esi -> usb_controller, ebx -> usb_pipe,
|
||||
; edx -> current descriptor, eax -> new last descriptor.
|
||||
proc xhci_enable_pipe
|
||||
pushad
|
||||
sub ebx, sizeof.xhci_pipe
|
||||
mov eax, [ebx+xhci_pipe.Ring]
|
||||
test eax, eax
|
||||
jz .nothing
|
||||
; The queue is empty now, so the ring can be restarted from its beginning.
|
||||
mov edi, eax
|
||||
xor eax, eax
|
||||
mov ecx, 0x1000/4
|
||||
rep stosd
|
||||
mov edi, [ebx+xhci_pipe.RingMap]
|
||||
mov ecx, 0x1000/4
|
||||
rep stosd
|
||||
mov edi, [ebx+xhci_pipe.Ring]
|
||||
add edi, (XHCI_RING_TRBS-1)*16
|
||||
mov eax, [ebx+xhci_pipe.RingPhys]
|
||||
mov [edi], eax
|
||||
mov dword [edi+12], (XHCI_TRB_LINK shl 10) + XHCI_TRB_TC
|
||||
and [ebx+xhci_pipe.Enqueue], 0
|
||||
and [ebx+xhci_pipe.Dequeue], 0
|
||||
and [ebx+xhci_pipe.Reserved], 0
|
||||
and [ebx+xhci_pipe.FirstFix], 0
|
||||
mov [ebx+xhci_pipe.Cycle], XHCI_TRB_C
|
||||
call xhci_set_dequeue
|
||||
.nothing:
|
||||
popad
|
||||
ret
|
||||
endp
|
||||
|
||||
; =============================================================================
|
||||
; ========================== Address and packet size ==========================
|
||||
; =============================================================================
|
||||
|
||||
; Called from usb_set_address_callback. The bus address is chosen by the
|
||||
; controller itself while executing the Address Device command, so the only
|
||||
; thing left to do is to remember the number the kernel has reserved: it asks
|
||||
; for it back on disconnect in order to mark it free again.
|
||||
; in: esi -> usb_controller, ebx -> usb_pipe, cl = address.
|
||||
proc xhci_set_device_address
|
||||
movzx eax, cl
|
||||
mov [ebx+xhci_pipe.Address-sizeof.xhci_pipe], eax
|
||||
jmp [usbhc_api.usb_subscribe_control]
|
||||
endp
|
||||
|
||||
; in: esi -> usb_controller, ebx -> usb_pipe. out: eax = address.
|
||||
proc xhci_get_device_address
|
||||
mov eax, [ebx+xhci_pipe.Address-sizeof.xhci_pipe]
|
||||
ret
|
||||
endp
|
||||
|
||||
; Called from usb_get_descr8_callback once the real packet size of the default
|
||||
; control endpoint is known. On xHCI that value lives in the Endpoint Context,
|
||||
; so an Evaluate Context command is needed to update it.
|
||||
; in: esi -> usb_controller, ebx -> usb_pipe, ecx = packet size.
|
||||
proc xhci_set_endpoint_packet_size
|
||||
push ebx ecx edx edi
|
||||
sub ebx, sizeof.xhci_pipe
|
||||
if XHCI_SUPERSPEED
|
||||
; For a SuperSpeed device bMaxPacketSize0 is an exponent, and the only value
|
||||
; the specification allows is 9: use 512 directly instead of the raw byte.
|
||||
cmp [ebx+xhci_pipe.PSIV], XHCI_PSI_SS
|
||||
jb @f
|
||||
mov ecx, 512
|
||||
@@:
|
||||
end if
|
||||
mov [ebx+xhci_pipe.MaxPacket], ecx
|
||||
lea ecx, [esi+xhci_controller.CmdLock-XCD]
|
||||
invoke MutexLock
|
||||
call xhci_clear_input_ctx
|
||||
mov edx, [esi+xhci_controller.InputCtx-XCD]
|
||||
mov dword [edx+4], 2 ; evaluate the default control endpoint
|
||||
call xhci_fill_ep_ctx
|
||||
mov edx, [ebx+xhci_pipe.SlotId]
|
||||
shl edx, 24
|
||||
or edx, XHCI_TRB_EVAL_CTX shl 10
|
||||
mov eax, [esi+xhci_controller.InputCtxPhys-XCD]
|
||||
push ebx
|
||||
xor ebx, ebx
|
||||
xor ecx, ecx
|
||||
call xhci_cmd_submit
|
||||
pop ebx
|
||||
cmp eax, XHCI_CC_SUCCESS
|
||||
jz @f
|
||||
DEBUGF 1,'K : XHCI: Evaluate Context failed, code %d\n',eax
|
||||
@@:
|
||||
lea ecx, [esi+xhci_controller.CmdLock-XCD]
|
||||
invoke MutexUnlock
|
||||
pop edi edx ecx ebx
|
||||
jmp [usbhc_api.usb_subscribe_control]
|
||||
endp
|
||||
|
||||
; If the descriptor that has just completed is the answer to a request for the
|
||||
; hub descriptor, tell the controller that the device is a hub: it has to know
|
||||
; that in order to serve the devices behind it.
|
||||
; in: ebx -> usb_gtd.
|
||||
proc xhci_check_hub_descriptor
|
||||
pushad
|
||||
cmp [ebx+usb_gtd.Callback], 0
|
||||
jz .nothing
|
||||
mov eax, [ebx+usb_gtd.Pipe]
|
||||
mov esi, [eax+usb_pipe.Controller]
|
||||
sub eax, sizeof.xhci_pipe
|
||||
test [eax+xhci_pipe.Flags], XHCI_PIPE_HUBPEND
|
||||
jz .nothing
|
||||
and [eax+xhci_pipe.Flags], not XHCI_PIPE_HUBPEND
|
||||
cmp [ebx+xhci_gtd.Status-sizeof.xhci_gtd], XHCI_CC_SUCCESS
|
||||
jnz .nothing
|
||||
mov edx, [eax+xhci_pipe.HubBuf]
|
||||
test edx, edx
|
||||
jz .nothing
|
||||
cmp byte [edx+1], 29h ; bDescriptorType
|
||||
jnz .nothing
|
||||
or [eax+xhci_pipe.Flags], XHCI_PIPE_ISHUB
|
||||
mov ebx, eax ; ebx -> xhci_pipe of the hub
|
||||
movzx edi, byte [edx+2] ; bNbrPorts
|
||||
movzx ebp, byte [edx+3] ; low byte of wHubCharacteristics
|
||||
shr ebp, 5
|
||||
and ebp, 3 ; Transaction Translator Think Time
|
||||
DEBUGF 1,'K : XHCI: device on slot %d is a hub with %d ports\n',[ebx+xhci_pipe.SlotId],edi
|
||||
lea ecx, [esi+xhci_controller.CmdLock-XCD]
|
||||
invoke MutexLock
|
||||
call xhci_clear_input_ctx
|
||||
mov eax, [esi+xhci_controller.InputCtx-XCD]
|
||||
mov dword [eax+4], 1 ; only the Slot Context is evaluated
|
||||
mov ecx, [ebx+xhci_pipe.MaxDCI]
|
||||
test ecx, ecx
|
||||
jnz @f
|
||||
movi ecx, 1
|
||||
@@:
|
||||
call xhci_fill_slot_ctx
|
||||
; Patch the Slot Context with the fields that describe a hub. Only Configure
|
||||
; Endpoint takes them into account, Evaluate Context would ignore them.
|
||||
mov eax, [esi+xhci_controller.InputCtx-XCD]
|
||||
movi ecx, 1
|
||||
call xhci_context
|
||||
or dword [eax], 1 shl 26 ; this device is a hub
|
||||
cmp [ebx+xhci_pipe.Speed], USB_SPEED_HS
|
||||
jnz @f
|
||||
shl ebp, 16
|
||||
or [eax+8], ebp
|
||||
@@:
|
||||
shl edi, 24
|
||||
or [eax+4], edi ; Number of Ports
|
||||
mov edx, [ebx+xhci_pipe.SlotId]
|
||||
shl edx, 24
|
||||
or edx, XHCI_TRB_CONFIG_EP shl 10
|
||||
mov eax, [esi+xhci_controller.InputCtxPhys-XCD]
|
||||
xor ebx, ebx
|
||||
xor ecx, ecx
|
||||
call xhci_cmd_submit
|
||||
cmp eax, XHCI_CC_SUCCESS
|
||||
jz @f
|
||||
DEBUGF 1,'K : XHCI: cannot mark the device as a hub, code %d\n',eax
|
||||
@@:
|
||||
lea ecx, [esi+xhci_controller.CmdLock-XCD]
|
||||
invoke MutexUnlock
|
||||
.nothing:
|
||||
popad
|
||||
ret
|
||||
endp
|
||||
@@ -0,0 +1,135 @@
|
||||
; SuperSpeed support for the xHCI driver, included from xhci.asm when
|
||||
; XHCI_SUPERSPEED is enabled. The pieces too small to live here - the port
|
||||
; map, the Slot Context speed, the 512-byte default control endpoint, the
|
||||
; Max Burst field of the Endpoint Context - sit in the other files under
|
||||
; "if XHCI_SUPERSPEED" guards; this file keeps the self-contained procedures.
|
||||
;
|
||||
; The kernel USB stack knows nothing about SuperSpeed, so it never learns
|
||||
; about it: a SuperSpeed device is announced as a high-speed one, which also
|
||||
; keeps the Transaction Translator logic away from it. The raw PORTSC speed
|
||||
; identifier travels in xhci_pipe.PSIV instead and reaches everything that
|
||||
; really needs it. SuperSpeed hubs are not supported: the kernel only speaks
|
||||
; the USB2 hub protocol, so a device behind a USB3 hub is served by the USB2
|
||||
; half of that hub at high speed.
|
||||
|
||||
; =============================================================================
|
||||
; ============================ SuperSpeed ports ===============================
|
||||
; =============================================================================
|
||||
|
||||
; Called from xhci_new_port for a SuperSpeed root port instead of the USB2
|
||||
; reset entry point: a SuperSpeed link trains itself and the port enables
|
||||
; itself on connect, reporting the speed with no reset at all. When the link
|
||||
; is already up, skip straight to the reset recovery stage, after which
|
||||
; xhci_port_init picks the device up; otherwise try a warm reset.
|
||||
; in: esi -> usb_controller, ecx = port index.
|
||||
proc xhci_ss_start_port
|
||||
push eax edx
|
||||
and [esi+usb_controller.ResettingHub], 0
|
||||
mov [esi+usb_controller.ResettingPort], cl
|
||||
push ecx
|
||||
invoke GetTimerTicks
|
||||
pop ecx
|
||||
mov [esi+usb_controller.ResetTime], eax
|
||||
mov [esi+xhci_controller.ResetStart-XCD], eax
|
||||
call xhci_port_reg
|
||||
mov eax, [edx]
|
||||
test al, XHCI_PORT_PED
|
||||
jz .warm_reset
|
||||
mov [esi+usb_controller.ResettingStatus], 2
|
||||
DEBUGF 1,'K : XHCI %x: SS port %d link is up, PORTSC=%x\n',esi,ecx,eax
|
||||
jmp .nothing
|
||||
.warm_reset:
|
||||
; Connected, but the link has not come up. The Port Reset bit is set while a
|
||||
; warm reset is running, so the ordinary reset-wait machinery in
|
||||
; xhci_port_reset_done serves this case unchanged; the extra WRC change bit is
|
||||
; acknowledged there together with the usual ones.
|
||||
mov dword [edx], XHCI_PORT_PP + XHCI_PORT_WPR
|
||||
mov [esi+usb_controller.ResettingStatus], 1
|
||||
DEBUGF 1,'K : XHCI %x: warm-resetting port %d, PORTSC=%x\n',esi,ecx,eax
|
||||
.nothing:
|
||||
pop edx eax
|
||||
ret
|
||||
endp
|
||||
|
||||
; The kernel restarts pending root ports through the NewPortReset entry of
|
||||
; usb_hardware_func directly, bypassing xhci_new_port; SuperSpeed ports must
|
||||
; not get the USB2 reset on that path either, so the entry points here.
|
||||
; in: esi -> usb_controller, ecx = port index.
|
||||
proc xhci_ss_port_reset
|
||||
bt [esi+xhci_controller.SSPortMask-XCD], ecx
|
||||
jnc xhci_new_port.reset
|
||||
call xhci_ss_start_port
|
||||
ret
|
||||
endp
|
||||
|
||||
; =============================================================================
|
||||
; ===================== Endpoint Companion descriptors ========================
|
||||
; =============================================================================
|
||||
|
||||
; Reads the SuperSpeed Endpoint Companion descriptor of a bulk endpoint and
|
||||
; keeps its bMaxBurst for the Endpoint Context, allowing bursts of up to
|
||||
; bMaxBurst+1 packets per transaction. Zero (no bursts) is always legal, so
|
||||
; any failure just leaves the field alone. Only bulk endpoints are considered:
|
||||
; a nonzero burst on a periodic endpoint would also require the Max ESIT
|
||||
; Payload fields, and real interrupt endpoints do not burst anyway.
|
||||
; Relies on the stack frame of usb_open_pipe exactly like xhci_init_pipe does:
|
||||
; [ebp+8] is the config pipe of the device.
|
||||
; in: ebx -> xhci_pipe of a non-control endpoint being opened.
|
||||
proc xhci_ss_get_burst
|
||||
push eax ecx edx edi
|
||||
; 1. Only SuperSpeed bulk endpoints are of interest.
|
||||
cmp [ebx+xhci_pipe.PSIV], XHCI_PSI_SS
|
||||
jb .nothing
|
||||
mov eax, [ebx+xhci_pipe.EpType]
|
||||
and al, 3
|
||||
cmp al, 2 ; bulk endpoint types are 2 and 6
|
||||
jnz .nothing
|
||||
; 2. Find the configuration data kept by the kernel behind the device
|
||||
; descriptor; it holds the endpoint descriptors with their companions.
|
||||
mov eax, [ebp+8]
|
||||
mov eax, [eax+usb_pipe.DeviceData]
|
||||
test eax, eax
|
||||
jz .nothing
|
||||
movzx edx, [eax+usb_device_data.DeviceDescrSize]
|
||||
mov edi, [eax+usb_device_data.ConfigDataSize]
|
||||
lea ecx, [eax+edx+usb_device_data.DeviceDescriptor]
|
||||
add edi, ecx ; edi -> end of the configuration data
|
||||
; 3. Reconstruct bEndpointAddress from the Device Context Index.
|
||||
mov edx, [ebx+xhci_pipe.DCI]
|
||||
shr edx, 1
|
||||
test [ebx+xhci_pipe.Flags], XHCI_PIPE_IN
|
||||
jz @f
|
||||
or dl, 80h
|
||||
@@:
|
||||
; 4. Walk the descriptors to the one of this endpoint.
|
||||
.walk:
|
||||
lea eax, [ecx+2]
|
||||
cmp eax, edi
|
||||
ja .nothing
|
||||
movzx eax, byte [ecx] ; bLength
|
||||
test eax, eax
|
||||
jz .nothing ; malformed data, stop
|
||||
cmp byte [ecx+1], 5 ; an endpoint descriptor?
|
||||
jnz .advance
|
||||
cmp [ecx+2], dl ; bEndpointAddress
|
||||
jnz .advance
|
||||
; 5. The companion descriptor (type 30h) immediately follows its endpoint.
|
||||
add ecx, eax
|
||||
lea eax, [ecx+3]
|
||||
cmp eax, edi
|
||||
ja .nothing
|
||||
cmp byte [ecx+1], 30h ; SuperSpeed Endpoint Companion
|
||||
jnz .nothing
|
||||
movzx eax, byte [ecx+2] ; bMaxBurst
|
||||
cmp eax, 15
|
||||
ja .nothing
|
||||
mov [ebx+xhci_pipe.MaxBurst], eax
|
||||
DEBUGF 1,'K : XHCI: slot %d dci %d bursts %d+1 packets\n',[ebx+xhci_pipe.SlotId],[ebx+xhci_pipe.DCI],eax
|
||||
jmp .nothing
|
||||
.advance:
|
||||
add ecx, eax
|
||||
jmp .walk
|
||||
.nothing:
|
||||
pop edi edx ecx eax
|
||||
ret
|
||||
endp
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1489,19 +1489,31 @@ dyndisk_handler:
|
||||
; 12. The fs operation has specified some partition.
|
||||
push edx ecx
|
||||
xor eax, eax
|
||||
mov ecx, eax
|
||||
lodsb
|
||||
@@:
|
||||
lea ecx, [ecx*4 + ecx]
|
||||
shl ecx, 1
|
||||
|
||||
sub eax, '0'
|
||||
jz .dyndisk_cleanup
|
||||
jb .dyndisk_cleanup
|
||||
cmp eax, 10
|
||||
jnc .dyndisk_cleanup
|
||||
mov ecx, eax
|
||||
|
||||
add ecx, eax
|
||||
cmp ecx, MAX_NUM_PARTITIONS
|
||||
ja .dyndisk_cleanup
|
||||
|
||||
lodsb
|
||||
cmp eax, '/'
|
||||
jz @f
|
||||
test eax, eax
|
||||
jnz .dyndisk_cleanup
|
||||
jnz @b
|
||||
dec esi
|
||||
@@:
|
||||
test ecx, ecx
|
||||
jz .dyndisk_cleanup
|
||||
|
||||
cmp byte [esi], 0
|
||||
jnz @f
|
||||
; partition info
|
||||
|
||||
@@ -4098,6 +4098,9 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
|
||||
* подфункция 7 - запуск программы
|
||||
* подфункция 8 - удаление файла/папки
|
||||
* подфункция 9 - создание папки
|
||||
* подфункция 10 - переименование/перемещение
|
||||
* подфункция 11 - создание симлинка
|
||||
* подфункция 12 - чтение симлинка
|
||||
Для CD-приводов в связи с аппаратными ограничениями доступны
|
||||
только подфункции 0,1,5 и 7, вызов других подфункций завершится
|
||||
ошибкой с кодом 2.
|
||||
@@ -4112,7 +4115,8 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
|
||||
[ebx] - SSF_READ_FILE (0), SSF_READ_FOLDER (1), SSF_CREATE_FILE (2),
|
||||
SSF_WRITE_FILE (3), SSF_SET_END (4), SSF_GET_INFO (5),
|
||||
SSF_SET_INFO (6), SSF_START_APP (7), SSF_DELETE (8),
|
||||
SSF_CREATE_FOLDER (9)
|
||||
SSF_CREATE_FOLDER (9), SSF_RENAME (10), SSF_CREATE_SYMLINK (11),
|
||||
SSF_READ_SYMLINK (12)
|
||||
======================================================================
|
||||
= Функция 70, подфункция 0 - чтение файла с поддержкой длинных имён. =
|
||||
======================================================================
|
||||
@@ -4464,6 +4468,62 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
|
||||
* Формирование нового пути отличается от общих правил:
|
||||
относительный путь относится к папке целевого файла (или папки),
|
||||
абсолютный путь считается от корня раздела.
|
||||
|
||||
---------------------- Константы для регистров: ----------------------
|
||||
eax - SF_FILE (70)
|
||||
[ebx] - SSF_RENAME (10)
|
||||
======================================================================
|
||||
=========== Функция 70, подфункция 11 - создание симлинка. ===========
|
||||
======================================================================
|
||||
Параметры:
|
||||
* eax = 70 - номер функции
|
||||
* ebx = указатель на информационную структуру
|
||||
Формат информационной структуры:
|
||||
* +0: dword: 11 = номер подфункции
|
||||
* +4: dword: 0 (зарезервировано)
|
||||
* +8: dword: 0 (зарезервировано)
|
||||
* +12 = +0xC: dword: 0 (зарезервировано)
|
||||
* +16 = +0x10: dword: указатель на строку с целевым путём
|
||||
* +20 = +0x14: путь, правила формирования имён указаны в общем
|
||||
описании (путь ссылки)
|
||||
Возвращаемое значение:
|
||||
* eax = 0 - успешно, иначе код ошибки файловой системы
|
||||
* ebx разрушается
|
||||
Замечания:
|
||||
* Родительская папка должна существовать.
|
||||
* Для CD функция не поддерживается (возвращает код ошибки 2).
|
||||
|
||||
---------------------- Константы для регистров: ----------------------
|
||||
eax - SF_FILE (70)
|
||||
[ebx] - SSF_CREATE_SYMLINK (11)
|
||||
======================================================================
|
||||
============ Функция 70, подфункция 12 - чтение симлинка. ============
|
||||
======================================================================
|
||||
Параметры:
|
||||
* eax = 70 - номер функции
|
||||
* ebx = указатель на информационную структуру
|
||||
Формат информационной структуры:
|
||||
* +0: dword: 12 = номер подфункции
|
||||
* +4: dword: 0 (зарезервировано)
|
||||
* +8: dword: 0 (зарезервировано)
|
||||
* +12 = +0xC: dword: размер буфера в байтах
|
||||
* +16 = +0x10: dword: указатель на буфер для целевого пути
|
||||
* +20 = +0x14: путь, правила формирования имён указаны в общем
|
||||
описании (путь ссылки)
|
||||
Возвращаемое значение:
|
||||
* eax = 0 - успешно, иначе код ошибки файловой системы
|
||||
* ebx = число байт, записанных в буфер
|
||||
Замечания:
|
||||
* Функция не следует по симлинку; она читает целевой путь,
|
||||
на который указывает симлинк.
|
||||
* Целевой путь всегда завершается нулём, в том числе при обрезании;
|
||||
записывается не более (размер буфера - 1) байт пути.
|
||||
* Значение в ebx включает завершающий 0, как в подфункции 2
|
||||
функции 30.
|
||||
|
||||
---------------------- Константы для регистров: ----------------------
|
||||
eax - SF_FILE (70)
|
||||
[ebx] - SSF_READ_SYMLINK (12)
|
||||
======================================================================
|
||||
========== Функция 71 - установить заголовок окна программы ==========
|
||||
======================================================================
|
||||
|
||||
@@ -4060,6 +4060,9 @@ Available subfunctions:
|
||||
* subfunction 7 - start application
|
||||
* subfunction 8 - delete file/folder
|
||||
* subfunction 9 - create folder
|
||||
* subfunction 10 - rename/move
|
||||
* subfunction 11 - create symlink
|
||||
* subfunction 12 - read symlink
|
||||
For CD-drives due to hardware limitations only subfunctions
|
||||
0,1,5 and 7 are available, other subfunctions return error
|
||||
with code 2.
|
||||
@@ -4073,7 +4076,8 @@ is called for corresponding device.
|
||||
[ebx] - SSF_READ_FILE (0), SSF_READ_FOLDER (1), SSF_CREATE_FILE (2),
|
||||
SSF_WRITE_FILE (3), SSF_SET_END (4), SSF_GET_INFO (5),
|
||||
SSF_SET_INFO (6), SSF_START_APP (7), SSF_DELETE (8),
|
||||
SSF_CREATE_FOLDER (9)
|
||||
SSF_CREATE_FOLDER (9), SSF_RENAME (10), SSF_CREATE_SYMLINK (11),
|
||||
SSF_READ_SYMLINK (12)
|
||||
======================================================================
|
||||
=== Function 70, subfunction 0 - read file with long names support. ==
|
||||
======================================================================
|
||||
@@ -4423,6 +4427,60 @@ Remarks:
|
||||
* New path forming differs from general rules:
|
||||
relative path relates to the target's parent folder,
|
||||
absolute path relates to the partition's root folder.
|
||||
|
||||
---------------------- Constants for registers: ----------------------
|
||||
eax - SF_FILE (70)
|
||||
[ebx] - SSF_RENAME (10)
|
||||
======================================================================
|
||||
=========== Function 70, subfunction 11 - create symlink. ============
|
||||
======================================================================
|
||||
Parameters:
|
||||
* eax = 70 - function number
|
||||
* ebx = pointer to the information structure
|
||||
Format of the information structure:
|
||||
* +0: dword: 11 = subfunction number
|
||||
* +4: dword: 0 (reserved)
|
||||
* +8: dword: 0 (reserved)
|
||||
* +12 = +0xC: dword: 0 (reserved)
|
||||
* +16 = +0x10: dword: pointer to the target path string
|
||||
* +20 = +0x14: path, general rules of names forming (link path)
|
||||
Returned value:
|
||||
* eax = 0 - success, otherwise file system error code
|
||||
* ebx destroyed
|
||||
Remarks:
|
||||
* The parent folder must already exist.
|
||||
* The function is not supported for CD (returns error code 2).
|
||||
|
||||
---------------------- Constants for registers: ----------------------
|
||||
eax - SF_FILE (70)
|
||||
[ebx] - SSF_CREATE_SYMLINK (11)
|
||||
======================================================================
|
||||
============ Function 70, subfunction 12 - read symlink. =============
|
||||
======================================================================
|
||||
Parameters:
|
||||
* eax = 70 - function number
|
||||
* ebx = pointer to the information structure
|
||||
Format of the information structure:
|
||||
* +0: dword: 12 = subfunction number
|
||||
* +4: dword: 0 (reserved)
|
||||
* +8: dword: 0 (reserved)
|
||||
* +12 = +0xC: dword: buffer size in bytes
|
||||
* +16 = +0x10: dword: pointer to buffer for target path
|
||||
* +20 = +0x14: path, general rules of names forming (link path)
|
||||
Returned value:
|
||||
* eax = 0 - success, otherwise file system error code
|
||||
* ebx = number of bytes written to the buffer
|
||||
Remarks:
|
||||
* The function does not follow the symlink; it reads the target path
|
||||
that the symlink points to.
|
||||
* The target path is always terminated with 0, even when truncated;
|
||||
at most (buffer size - 1) path bytes are written.
|
||||
* The value returned in ebx includes the terminating 0, as in
|
||||
subfunction 2 of function 30.
|
||||
|
||||
---------------------- Constants for registers: ----------------------
|
||||
eax - SF_FILE (70)
|
||||
[ebx] - SSF_READ_SYMLINK (12)
|
||||
======================================================================
|
||||
================== Function 71 - set window caption ==================
|
||||
======================================================================
|
||||
|
||||
+1034
-72
File diff suppressed because it is too large.
Load diff
@@ -2405,11 +2405,12 @@ fat_Write:
|
||||
; hd_extend_file can return three error codes: FAT table error, device error or disk full.
|
||||
; First two cases are fatal errors, in third case we may write some data
|
||||
cmp al, ERROR_DISK_FULL
|
||||
jnz @f
|
||||
jnz .noWrite
|
||||
; correct number of bytes to write
|
||||
mov ecx, [edi+28]
|
||||
cmp ecx, ebx
|
||||
ja .length_ok
|
||||
.noWrite:
|
||||
push 0
|
||||
.ret:
|
||||
pop eax eax eax ecx ecx
|
||||
|
||||
@@ -182,10 +182,22 @@ proc file_system_is_operation_safe stdcall, inf_struct_ptr: dword
|
||||
|
||||
.case6:
|
||||
cmp dword [ebx], 6
|
||||
jnz .switch_none
|
||||
jnz .case11
|
||||
mov ecx, 32
|
||||
jmp .end_switch
|
||||
|
||||
.case11:
|
||||
cmp dword [ebx], 11
|
||||
jnz .case12
|
||||
stdcall is_string_userspace, edx
|
||||
jmp .ret
|
||||
|
||||
.case12:
|
||||
cmp dword [ebx], 12
|
||||
jnz .switch_none
|
||||
mov ecx, dword [ebx + 12]
|
||||
jmp .end_switch
|
||||
|
||||
.switch_none:
|
||||
cmp ecx, ecx
|
||||
jmp .ret
|
||||
|
||||
@@ -48,6 +48,10 @@ dtext:
|
||||
add esp, 28
|
||||
ret
|
||||
|
||||
.nomem:
|
||||
add esp, 40
|
||||
ret
|
||||
|
||||
.redirect:
|
||||
mov ebp, [edi]
|
||||
add edi, 8
|
||||
@@ -81,6 +85,8 @@ dtext:
|
||||
mov [esp+32], eax
|
||||
imul ebp, eax
|
||||
stdcall kernel_alloc, ebp
|
||||
test eax, eax
|
||||
jz .nomem
|
||||
mov ecx, ebp
|
||||
shr ecx, 2
|
||||
mov [esp+36], eax
|
||||
|
||||
@@ -2124,11 +2124,11 @@ socket_free:
|
||||
mov ebx, eax
|
||||
cmp [eax + STREAM_SOCKET.rcv.start_ptr], 0
|
||||
je @f
|
||||
stdcall free_kernel_space, [eax + STREAM_SOCKET.rcv.start_ptr]
|
||||
stdcall kernel_free, [eax + STREAM_SOCKET.rcv.start_ptr]
|
||||
@@:
|
||||
cmp [ebx + STREAM_SOCKET.snd.start_ptr], 0
|
||||
je @f
|
||||
stdcall free_kernel_space, [ebx + STREAM_SOCKET.snd.start_ptr]
|
||||
stdcall kernel_free, [ebx + STREAM_SOCKET.snd.start_ptr]
|
||||
@@:
|
||||
mov eax, ebx
|
||||
.no_stream:
|
||||
|
||||
@@ -118,7 +118,7 @@ SS_MORETOCOME = 0x4000
|
||||
SS_BLOCKED = 0x8000
|
||||
|
||||
|
||||
SOCKET_BUFFER_SIZE = 4096*8 ; must be 4096*(power of 2) where 'power of 2' is at least 8
|
||||
SOCKET_BUFFER_SIZE = 4096*32 ; must be 4096*(power of 2) where 'power of 2' is at least 8
|
||||
MAX_backlog = 20 ; maximum backlog for stream sockets
|
||||
|
||||
; Error Codes
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
@fasm free3d04.asm free3d04
|
||||
if not exist free3d04 ( @pause )
|
||||
@@ -1,5 +0,0 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix en_US >lang.inc
|
||||
@fasm free3d04.asm free3d04
|
||||
@erase lang.inc
|
||||
@pause
|
||||
@@ -1,5 +0,0 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix ru_RU >lang.inc
|
||||
@fasm free3d04.asm free3d04
|
||||
@erase lang.inc
|
||||
@pause
|
||||
@@ -9,9 +9,10 @@
|
||||
;
|
||||
; Compile with FASM for Menuet (requires .INC files - see DATA Section)
|
||||
;
|
||||
; Willow - greatly srinked code size by using GIF texture and FPU to calculate sine table
|
||||
; Willow - greatly srinked code size by using packed texture and FPU to calculate sine table
|
||||
;
|
||||
; !!!! Don't use GIF_LITE.INC in your apps - it's modified for FREE3D !!!!
|
||||
; Textures are stored as a single 64x512 PNG embedded into the binary and
|
||||
; decoded at startup with libimg.
|
||||
;
|
||||
; Heavyiron - new 0-function of drawing window from kolibri (do not work correctly with menuet)
|
||||
|
||||
@@ -38,15 +39,17 @@ use32
|
||||
dd APP_MEM;0x100000 ; memory for app
|
||||
dd APP_MEM;0x100000 ; esp
|
||||
dd 0x0 , 0x0 ; I_Param , I_Icon
|
||||
include 'lang.inc'
|
||||
include '..\..\macros.inc'
|
||||
COLOR_ORDER equ OTHER
|
||||
include 'gif_lite.inc'
|
||||
include '..\..\proc32.inc'
|
||||
include '..\..\dll.inc'
|
||||
include '..\..\develop\libraries\libs-dev\libimg\libimg.inc'
|
||||
|
||||
START: ; start of execution
|
||||
mov esi,textures
|
||||
mov edi,ceil-8
|
||||
call ReadGIF
|
||||
mcall 68,11 ; init heap, libimg needs it
|
||||
stdcall dll.Load,@IMPORT
|
||||
test eax,eax
|
||||
jnz finish
|
||||
call load_textures
|
||||
mov esi,sinus
|
||||
mov ecx,360*10
|
||||
fninit
|
||||
@@ -291,6 +294,34 @@ m_right: ; turn right
|
||||
mcall
|
||||
|
||||
|
||||
; *********************************************
|
||||
; ******* LOAD TEXTURES ********
|
||||
; *********************************************
|
||||
; Decodes the embedded 64x512 PNG (8 stacked 64x64 tiles) into the raw
|
||||
; 0x00RRGGBB texture bank at [ceil].
|
||||
|
||||
load_textures:
|
||||
invoke img.decode,textures,textures.size,0
|
||||
test eax,eax
|
||||
jz finish
|
||||
mov ebx,eax
|
||||
invoke img.convert,ebx,0,Image.bpp32,0,0
|
||||
push eax
|
||||
invoke img.destroy,ebx
|
||||
pop ebx
|
||||
test ebx,ebx
|
||||
jz finish
|
||||
mov esi,[ebx+Image.Data]
|
||||
mov edi,ceil
|
||||
mov ecx,TEX_SIZE*8/4
|
||||
.copy:
|
||||
lodsd
|
||||
and eax,0x00FFFFFF ; drop alpha, the renderer stores 32 bit dwords
|
||||
stosd ; into a 24 bit image buffer
|
||||
loop .copy
|
||||
invoke img.destroy,ebx
|
||||
ret
|
||||
|
||||
; *********************************************
|
||||
; ******* WINDOW DEFINITIONS AND DRAW ********
|
||||
; *********************************************
|
||||
@@ -980,13 +1011,21 @@ dd 0x0001FFFF ; initial player position * 0xFFFF
|
||||
vpy:
|
||||
dd 0x0001FFFF
|
||||
|
||||
title db 'FISHEYE RAYCASTING ENGINE ETC. FREE3D',0
|
||||
title db 'Fisheye Raycasting Engine Etc. FREE3D',0
|
||||
|
||||
sindegree dd 0.0
|
||||
sininc dd 0.0017453292519943295769236907684886
|
||||
sindiv dd 6553.5
|
||||
textures:
|
||||
file 'texture.gif'
|
||||
file 'texture.png'
|
||||
.size = $ - textures
|
||||
|
||||
align 16
|
||||
@IMPORT:
|
||||
|
||||
library libimg , 'libimg.obj'
|
||||
|
||||
import libimg , libimg.init , 'lib_init' , img.decode , 'img_decode' , img.convert , 'img_convert', img.destroy , 'img_destroy'
|
||||
|
||||
align 4
|
||||
|
||||
|
||||
@@ -1,487 +0,0 @@
|
||||
; GIF LITE v3.0 by Willow
|
||||
; Written in pure assembler by Ivushkin Andrey aka Willow
|
||||
; Modified by Diamond
|
||||
;
|
||||
; This include file will contain functions to handle GIF image format
|
||||
;
|
||||
; Created: August 15, 2004
|
||||
; Last changed: June 24, 2007
|
||||
|
||||
; Requires kglobals.inc (iglobal/uglobal macro)
|
||||
; (program must 'include "kglobals.inc"' and say 'IncludeUGlobal'
|
||||
; somewhere in uninitialized data area).
|
||||
|
||||
; Configuration: [changed from program which includes this file]
|
||||
; 1. The constant COLOR_ORDER: must be one of
|
||||
; PALETTE - for 8-bit image with palette (sysfunction 65)
|
||||
; MENUETOS - for MenuetOS and KolibriOS color order (sysfunction 7)
|
||||
; OTHER - for standard color order
|
||||
; 2. Define constant GIF_SUPPORT_INTERLACED if you want to support interlaced
|
||||
; GIFs.
|
||||
; 3. Single image mode vs multiple image mode:
|
||||
; if the program defines the variable 'gif_img_count' of type dword
|
||||
; somewhere, ReadGIF will enter multiple image mode: gif_img_count
|
||||
; will be initialized with image count, output format is GIF_list,
|
||||
; the function GetGIFinfo retrieves Nth image info. Otherwise, ReadGIF
|
||||
; uses single image mode: exit after end of first image, output is
|
||||
; <dd width,height, times width*height[*3] db image>
|
||||
|
||||
if ~ (COLOR_ORDER in <PALETTE,MENUETOS,OTHER>)
|
||||
; This message may not appear under MenuetOS, so watch...
|
||||
display 'Please define COLOR_ORDER: PALETTE, MENUETOS or OTHER',13,10
|
||||
end if
|
||||
|
||||
if defined gif_img_count
|
||||
; virtual structure, used internally
|
||||
|
||||
struct GIF_list
|
||||
NextImg rd 1
|
||||
Left rw 1
|
||||
Top rw 1
|
||||
Width rw 1
|
||||
Height rw 1
|
||||
Delay rd 1
|
||||
Displacement rd 1 ; 0 = not specified
|
||||
; 1 = do not dispose
|
||||
; 2 = restore to background color
|
||||
; 3 = restore to previous
|
||||
if COLOR_ORDER eq PALETTE
|
||||
Image rd 1
|
||||
end if
|
||||
ends
|
||||
|
||||
struct GIF_info
|
||||
Left rw 1
|
||||
Top rw 1
|
||||
Width rw 1
|
||||
Height rw 1
|
||||
Delay rd 1
|
||||
Displacement rd 1
|
||||
if COLOR_ORDER eq PALETTE
|
||||
Palette rd 1
|
||||
end if
|
||||
ends
|
||||
|
||||
; ****************************************
|
||||
; FUNCTION GetGIFinfo - retrieve Nth image info
|
||||
; ****************************************
|
||||
; in:
|
||||
; esi - pointer to image list header
|
||||
; ecx - image_index (0...img_count-1)
|
||||
; edi - pointer to GIF_info structure to be filled
|
||||
|
||||
; out:
|
||||
; eax - pointer to RAW data, or 0, if error
|
||||
|
||||
GetGIFinfo:
|
||||
push esi ecx edi
|
||||
xor eax,eax
|
||||
jecxz .eloop
|
||||
.lp:
|
||||
mov esi,[esi]
|
||||
test esi,esi
|
||||
jz .error
|
||||
loop .lp
|
||||
.eloop:
|
||||
lodsd
|
||||
movsd
|
||||
movsd
|
||||
movsd
|
||||
movsd
|
||||
if COLOR_ORDER eq PALETTE
|
||||
lodsd
|
||||
mov [edi],esi
|
||||
else
|
||||
mov eax,esi
|
||||
end if
|
||||
.error:
|
||||
pop edi ecx esi
|
||||
ret
|
||||
|
||||
end if
|
||||
|
||||
_null fix 0x1000
|
||||
|
||||
; ****************************************
|
||||
; FUNCTION ReadGIF - unpacks GIF image
|
||||
; ****************************************
|
||||
; in:
|
||||
; esi - pointer to GIF file in memory
|
||||
; edi - pointer to output image list
|
||||
|
||||
; out:
|
||||
; eax - 0, all OK;
|
||||
; eax - 1, invalid signature;
|
||||
; eax >=8, unsupported image attributes
|
||||
;
|
||||
|
||||
ReadGIF:
|
||||
push esi edi
|
||||
mov [.cur_info],edi
|
||||
xor eax,eax
|
||||
mov [.globalColor],eax
|
||||
if defined gif_img_count
|
||||
mov [gif_img_count],eax
|
||||
mov [.anim_delay],eax
|
||||
mov [.anim_disp],eax
|
||||
end if
|
||||
inc eax
|
||||
cmp dword[esi],'GIF8'
|
||||
jne .ex ; signature
|
||||
mov ecx,[esi+0xa]
|
||||
add esi,0xd
|
||||
mov edi,esi
|
||||
test cl,cl
|
||||
jns .nextblock
|
||||
mov [.globalColor],esi
|
||||
call .Gif_skipmap
|
||||
.nextblock:
|
||||
cmp byte[edi],0x21
|
||||
jne .noextblock
|
||||
inc edi
|
||||
if defined gif_img_count
|
||||
cmp byte[edi],0xf9 ; Graphic Control Ext
|
||||
jne .no_gc
|
||||
movzx eax,word [edi+3]
|
||||
mov [.anim_delay],eax
|
||||
mov al,[edi+2]
|
||||
shr al,2
|
||||
and eax,7
|
||||
mov [.anim_disp],eax
|
||||
add edi,7
|
||||
jmp .nextblock
|
||||
.no_gc:
|
||||
end if
|
||||
inc edi
|
||||
.block_skip:
|
||||
movzx eax,byte[edi]
|
||||
lea edi,[edi+eax+1]
|
||||
test eax,eax
|
||||
jnz .block_skip
|
||||
jmp .nextblock
|
||||
.noextblock:
|
||||
mov al,8
|
||||
cmp byte[edi],0x2c ; image beginning
|
||||
jne .ex
|
||||
if defined gif_img_count
|
||||
inc [gif_img_count]
|
||||
end if
|
||||
inc edi
|
||||
mov esi,[.cur_info]
|
||||
if defined gif_img_count
|
||||
add esi,4
|
||||
end if
|
||||
xchg esi,edi
|
||||
if defined GIF_SUPPORT_INTERLACED
|
||||
movzx ecx,word[esi+4]
|
||||
mov [.width],ecx
|
||||
movzx eax,word[esi+6]
|
||||
imul eax,ecx
|
||||
if ~(COLOR_ORDER eq PALETTE)
|
||||
lea eax,[eax*3]
|
||||
end if
|
||||
mov [.img_end],eax
|
||||
inc eax
|
||||
mov [.row_end],eax
|
||||
and [.pass],0
|
||||
test byte[esi+8],40h
|
||||
jz @f
|
||||
if ~(COLOR_ORDER eq PALETTE)
|
||||
lea ecx,[ecx*3]
|
||||
end if
|
||||
mov [.row_end],ecx
|
||||
@@:
|
||||
end if
|
||||
if defined gif_img_count
|
||||
movsd
|
||||
movsd
|
||||
mov eax,[.anim_delay]
|
||||
stosd
|
||||
mov eax,[.anim_disp]
|
||||
stosd
|
||||
else
|
||||
movzx eax,word[esi+4]
|
||||
stosd
|
||||
movzx eax,word[esi+6]
|
||||
stosd
|
||||
add esi,8
|
||||
end if
|
||||
push edi
|
||||
mov ecx,[esi]
|
||||
inc esi
|
||||
test cl,cl
|
||||
js .uselocal
|
||||
push [.globalColor]
|
||||
mov edi,esi
|
||||
jmp .setPal
|
||||
.uselocal:
|
||||
call .Gif_skipmap
|
||||
push esi
|
||||
.setPal:
|
||||
movzx ecx,byte[edi]
|
||||
inc ecx
|
||||
mov [.codesize],ecx
|
||||
dec ecx
|
||||
if ~(COLOR_ORDER eq PALETTE)
|
||||
pop [.Palette]
|
||||
end if
|
||||
lea esi,[edi+1]
|
||||
mov edi,.gif_workarea
|
||||
xor eax,eax
|
||||
lodsb ; eax - block_count
|
||||
add eax,esi
|
||||
mov [.block_ofs],eax
|
||||
mov [.bit_count],8
|
||||
mov eax,1
|
||||
shl eax,cl
|
||||
mov [.CC],eax
|
||||
mov ecx,eax
|
||||
inc eax
|
||||
mov [.EOI],eax
|
||||
mov eax, _null shl 16
|
||||
.filltable:
|
||||
stosd
|
||||
inc eax
|
||||
loop .filltable
|
||||
if COLOR_ORDER eq PALETTE
|
||||
pop eax
|
||||
pop edi
|
||||
push edi
|
||||
scasd
|
||||
push esi
|
||||
mov esi,eax
|
||||
mov ecx,[.CC]
|
||||
@@:
|
||||
lodsd
|
||||
dec esi
|
||||
bswap eax
|
||||
shr eax,8
|
||||
stosd
|
||||
loop @b
|
||||
pop esi
|
||||
pop eax
|
||||
mov [eax],edi
|
||||
else
|
||||
pop edi
|
||||
end if
|
||||
if defined GIF_SUPPORT_INTERLACED
|
||||
mov [.img_start],edi
|
||||
add [.img_end],edi
|
||||
add [.row_end],edi
|
||||
end if
|
||||
.reinit:
|
||||
mov edx,[.EOI]
|
||||
inc edx
|
||||
push [.codesize]
|
||||
pop [.compsize]
|
||||
call .Gif_get_sym
|
||||
cmp eax,[.CC]
|
||||
je .reinit
|
||||
call .Gif_output
|
||||
.cycle:
|
||||
movzx ebx,ax
|
||||
call .Gif_get_sym
|
||||
cmp eax,edx
|
||||
jae .notintable
|
||||
cmp eax,[.CC]
|
||||
je .reinit
|
||||
cmp eax,[.EOI]
|
||||
je .end
|
||||
call .Gif_output
|
||||
.add:
|
||||
mov dword [.gif_workarea+edx*4],ebx
|
||||
cmp edx,0xFFF
|
||||
jae .cycle
|
||||
inc edx
|
||||
bsr ebx,edx
|
||||
cmp ebx,[.compsize]
|
||||
jne .noinc
|
||||
inc [.compsize]
|
||||
.noinc:
|
||||
jmp .cycle
|
||||
.notintable:
|
||||
push eax
|
||||
mov eax,ebx
|
||||
call .Gif_output
|
||||
push ebx
|
||||
movzx eax,bx
|
||||
call .Gif_output
|
||||
pop ebx eax
|
||||
jmp .add
|
||||
.end:
|
||||
if defined GIF_SUPPORT_INTERLACED
|
||||
mov edi,[.img_end]
|
||||
end if
|
||||
if defined gif_img_count
|
||||
mov eax,[.cur_info]
|
||||
mov [eax],edi
|
||||
mov [.cur_info],edi
|
||||
add esi,2
|
||||
xchg esi,edi
|
||||
.nxt:
|
||||
cmp byte[edi],0
|
||||
jnz .continue
|
||||
inc edi
|
||||
jmp .nxt
|
||||
.continue:
|
||||
cmp byte[edi],0x3b
|
||||
jne .nextblock
|
||||
xchg esi,edi
|
||||
and dword [eax],0
|
||||
end if
|
||||
xor eax,eax
|
||||
.ex:
|
||||
pop edi esi
|
||||
ret
|
||||
|
||||
.Gif_skipmap:
|
||||
; in: ecx - image descriptor, esi - pointer to colormap
|
||||
; out: edi - pointer to area after colormap
|
||||
|
||||
and ecx,111b
|
||||
inc ecx ; color map size
|
||||
mov ebx,1
|
||||
shl ebx,cl
|
||||
lea ebx,[ebx*2+ebx]
|
||||
lea edi,[esi+ebx]
|
||||
ret
|
||||
|
||||
.Gif_get_sym:
|
||||
mov ecx,[.compsize]
|
||||
push ecx
|
||||
xor eax,eax
|
||||
.shift:
|
||||
ror byte[esi],1
|
||||
rcr eax,1
|
||||
dec [.bit_count]
|
||||
jnz .loop1
|
||||
inc esi
|
||||
cmp esi,[.block_ofs]
|
||||
jb .noblock
|
||||
push eax
|
||||
xor eax,eax
|
||||
lodsb
|
||||
test eax,eax
|
||||
jnz .nextbl
|
||||
mov eax,[.EOI]
|
||||
sub esi,2
|
||||
add esp,8
|
||||
jmp .exx
|
||||
.nextbl:
|
||||
add eax,esi
|
||||
mov [.block_ofs],eax
|
||||
pop eax
|
||||
.noblock:
|
||||
mov [.bit_count],8
|
||||
.loop1:
|
||||
loop .shift
|
||||
pop ecx
|
||||
rol eax,cl
|
||||
.exx:
|
||||
xor ecx,ecx
|
||||
ret
|
||||
|
||||
.Gif_output:
|
||||
push esi eax edx
|
||||
mov edx,.gif_workarea
|
||||
.next:
|
||||
push word[edx+eax*4]
|
||||
mov ax,word[edx+eax*4+2]
|
||||
inc ecx
|
||||
cmp ax,_null
|
||||
jnz .next
|
||||
shl ebx,16
|
||||
mov bx,[esp]
|
||||
.loop2:
|
||||
pop ax
|
||||
|
||||
if COLOR_ORDER eq PALETTE
|
||||
stosb
|
||||
else
|
||||
lea esi,[eax+eax*2]
|
||||
add esi,[.Palette]
|
||||
|
||||
if COLOR_ORDER eq MENUETOS
|
||||
mov esi,[esi]
|
||||
bswap esi
|
||||
shr esi,8
|
||||
mov [edi],esi
|
||||
add edi,3
|
||||
else
|
||||
movsb
|
||||
movsb
|
||||
movsb
|
||||
mov byte [edi],0
|
||||
inc edi
|
||||
end if
|
||||
end if
|
||||
|
||||
if defined GIF_SUPPORT_INTERLACED
|
||||
cmp edi,[.row_end]
|
||||
jb .norowend
|
||||
mov eax,[.width]
|
||||
if ~(COLOR_ORDER eq PALETTE)
|
||||
lea eax,[eax*3]
|
||||
end if
|
||||
push eax
|
||||
sub edi,eax
|
||||
add eax,eax
|
||||
cmp [.pass],3
|
||||
jz @f
|
||||
add eax,eax
|
||||
cmp [.pass],2
|
||||
jz @f
|
||||
add eax,eax
|
||||
@@:
|
||||
add edi,eax
|
||||
pop eax
|
||||
cmp edi,[.img_end]
|
||||
jb .nextrow
|
||||
mov edi,[.img_start]
|
||||
inc [.pass]
|
||||
add edi,eax
|
||||
cmp [.pass],3
|
||||
jz @f
|
||||
add edi,eax
|
||||
cmp [.pass],2
|
||||
jz @f
|
||||
add edi,eax
|
||||
add edi,eax
|
||||
@@:
|
||||
.nextrow:
|
||||
add eax,edi
|
||||
mov [.row_end],eax
|
||||
xor eax,eax
|
||||
.norowend:
|
||||
end if
|
||||
|
||||
loop .loop2
|
||||
pop edx eax esi
|
||||
ret
|
||||
|
||||
uglobal
|
||||
align 4
|
||||
ReadGIF.globalColor rd 1
|
||||
ReadGIF.cur_info rd 1 ; image table pointer
|
||||
ReadGIF.codesize rd 1
|
||||
ReadGIF.compsize rd 1
|
||||
ReadGIF.bit_count rd 1
|
||||
ReadGIF.CC rd 1
|
||||
ReadGIF.EOI rd 1
|
||||
if ~(COLOR_ORDER eq PALETTE)
|
||||
ReadGIF.Palette rd 1
|
||||
end if
|
||||
ReadGIF.block_ofs rd 1
|
||||
if defined GIF_SUPPORT_INTERLACED
|
||||
ReadGIF.row_end rd 1
|
||||
ReadGIF.img_end rd 1
|
||||
ReadGIF.img_start rd 1
|
||||
ReadGIF.pass rd 1
|
||||
ReadGIF.width rd 1
|
||||
end if
|
||||
if defined gif_img_count
|
||||
ReadGIF.anim_delay rd 1
|
||||
ReadGIF.anim_disp rd 1
|
||||
end if
|
||||
ReadGIF.gif_workarea rb 16*1024
|
||||
endg
|
||||
@@ -10,11 +10,11 @@ By Dieter Marfurt
|
||||
|
||||
--------------------------------------------
|
||||
|
||||
Format of texture include files:
|
||||
Format of the texture file:
|
||||
|
||||
dd 0x00RRGGBB,0x00RRGGBB....
|
||||
|
||||
for 64*64 pixels.
|
||||
texture.png - a 64*512 image holding the 8 textures of 64*64 pixels
|
||||
stacked vertically. It is embedded into the binary and decoded at
|
||||
startup with libimg.
|
||||
|
||||
Have fun!
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 28 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
@@ -181,6 +181,7 @@ con_cls
|
||||
con_get_cursor_pos
|
||||
con_set_cursor_pos
|
||||
;____TIME____
|
||||
clock
|
||||
mktime
|
||||
time
|
||||
localtime
|
||||
|
||||
@@ -5,7 +5,7 @@ void shell_cls()
|
||||
__shell_init();
|
||||
if (__shell_is_init == __SHELL_INIT_OK)
|
||||
{
|
||||
*__shell_shm = SHELL_CLS;
|
||||
__shell_shm->cmd = SHELL_CLS;
|
||||
__SHELL_WAIT();
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ void shell_exit()
|
||||
{
|
||||
if (__shell_is_init == __SHELL_INIT_OK)
|
||||
{
|
||||
*__shell_shm = SHELL_EXIT;
|
||||
__shell_shm->cmd = SHELL_EXIT;
|
||||
__SHELL_WAIT();
|
||||
_ksys_shm_close(__shell_shm_name);
|
||||
}
|
||||
|
||||
@@ -8,9 +8,9 @@ unsigned shell_get_pid()
|
||||
__shell_init();
|
||||
if (__shell_is_init == __SHELL_INIT_OK)
|
||||
{
|
||||
*__shell_shm = SHELL_PID;
|
||||
__shell_shm->cmd = SHELL_PID;
|
||||
__SHELL_WAIT();
|
||||
memcpy(&pid, __shell_shm + 1, sizeof(unsigned));
|
||||
memcpy(&pid, __shell_shm->data, sizeof(unsigned));
|
||||
}
|
||||
|
||||
return pid;
|
||||
|
||||
@@ -6,10 +6,10 @@ char shell_getc()
|
||||
|
||||
if (__shell_is_init == __SHELL_INIT_OK)
|
||||
{
|
||||
*__shell_shm = SHELL_GETC;
|
||||
__shell_shm->cmd = SHELL_GETC;
|
||||
__SHELL_WAIT();
|
||||
|
||||
return *(__shell_shm + 1);
|
||||
return __shell_shm->data[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -7,9 +7,9 @@ void shell_gets(char *str, int n)
|
||||
|
||||
if (__shell_is_init == __SHELL_INIT_OK)
|
||||
{
|
||||
*__shell_shm = SHELL_GETS;
|
||||
__shell_shm->cmd = SHELL_GETS;
|
||||
__SHELL_WAIT();
|
||||
|
||||
strncpy(str, __shell_shm + 1, n);
|
||||
strncpy(str, __shell_shm->data, n);
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
char app_name[13];
|
||||
char __shell_shm_name[32];
|
||||
char *__shell_shm = NULL;
|
||||
struct shell_shm_buffer *__shell_shm = NULL;
|
||||
enum __SHELL_INIT_STATE __shell_is_init = __SHELL_NOT_LOADED;
|
||||
|
||||
int __shell_shm_init()
|
||||
@@ -17,12 +17,12 @@ int __shell_shm_init()
|
||||
|
||||
_ksys_thread_info(&proc_info, -1);
|
||||
PID = proc_info.pid;
|
||||
strncpy(app_name, (&proc_info)->name, 12);
|
||||
strncpy(app_name, proc_info.name, sizeof(app_name) - 1);
|
||||
|
||||
itoa(PID, __shell_shm_name);
|
||||
strcat(__shell_shm_name, "-SHELL");
|
||||
|
||||
return _ksys_shm_open(__shell_shm_name, KSYS_SHM_OPEN_ALWAYS | KSYS_SHM_WRITE, SHELL_SHM_MAX, &__shell_shm);
|
||||
return _ksys_shm_open(__shell_shm_name, KSYS_SHM_OPEN_ALWAYS | KSYS_SHM_WRITE, sizeof(*__shell_shm), (char **)&__shell_shm);
|
||||
}
|
||||
|
||||
void __shell_init()
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
|
||||
int shell_ping()
|
||||
{
|
||||
*__shell_shm = SHELL_PING;
|
||||
__shell_shm->cmd = SHELL_PING;
|
||||
|
||||
_ksys_thread_yield(); // hope shell is fast enough
|
||||
|
||||
size_t i = 0;
|
||||
while (*__shell_shm != SHELL_OK)
|
||||
while (__shell_shm->cmd != SHELL_OK)
|
||||
{
|
||||
if (i > (SHELL_PING_TIMEOUT / SHELL_PING_MIN_DELAY))
|
||||
{
|
||||
|
||||
@@ -5,8 +5,8 @@ void shell_printf(const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
vsnprintf(__shell_shm + 1, SHELL_SHM_MAX, format, ap);
|
||||
*__shell_shm = SHELL_PUTS;
|
||||
vsnprintf(__shell_shm->data, sizeof(__shell_shm->data), format, ap);
|
||||
__shell_shm->cmd = SHELL_PUTS;
|
||||
va_end(ap);
|
||||
__SHELL_WAIT();
|
||||
}
|
||||
@@ -6,8 +6,8 @@ void shell_putc(char c)
|
||||
|
||||
if (__shell_is_init == __SHELL_INIT_OK)
|
||||
{
|
||||
*(__shell_shm + 1) = c;
|
||||
*__shell_shm = SHELL_PUTC;
|
||||
__shell_shm->data[0] = c;
|
||||
__shell_shm->cmd = SHELL_PUTC;
|
||||
__SHELL_WAIT();
|
||||
}
|
||||
}
|
||||
@@ -6,16 +6,16 @@ void shell_write_string(const char *s, size_t len)
|
||||
__shell_init();
|
||||
if (__shell_is_init == __SHELL_INIT_OK)
|
||||
{
|
||||
if (len > SHELL_SHM_MAX - 1)
|
||||
if (len > sizeof(__shell_shm->data) - 1)
|
||||
{
|
||||
shell_write_string(s, SHELL_SHM_MAX - 1); // Outputs as much as it can.
|
||||
shell_write_string(s + (SHELL_SHM_MAX - 1), len - (SHELL_SHM_MAX - 1)); // Outputs the rest.
|
||||
shell_write_string(s, sizeof(__shell_shm->data) - 1); // Outputs as much as it can.
|
||||
shell_write_string(s + (sizeof(__shell_shm->data) - 1), len - (sizeof(__shell_shm->data) - 1)); // Outputs the rest.
|
||||
}
|
||||
else
|
||||
{
|
||||
memset(__shell_shm, 0, SHELL_SHM_MAX); // without int shell show \t, \n, lose chars and other trash
|
||||
memcpy(__shell_shm + 1, s, len);
|
||||
*__shell_shm = SHELL_PUTS;
|
||||
memset(__shell_shm->data, 0, sizeof(__shell_shm->data)); // without int shell show \t, \n, lose chars and other trash
|
||||
memcpy(__shell_shm->data, s, len);
|
||||
__shell_shm->cmd = SHELL_PUTS;
|
||||
__SHELL_WAIT();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,15 +9,17 @@
|
||||
#define __EXTERN extern
|
||||
#endif
|
||||
|
||||
#define SHELL_OK 0
|
||||
#define SHELL_EXIT 1
|
||||
#define SHELL_PUTC 2
|
||||
#define SHELL_PUTS 3
|
||||
#define SHELL_GETC 4
|
||||
#define SHELL_GETS 5
|
||||
#define SHELL_CLS 6
|
||||
#define SHELL_PID 7
|
||||
#define SHELL_PING 8
|
||||
enum SHELL_API_COMMANDS {
|
||||
SHELL_OK = 0,
|
||||
SHELL_EXIT = 1,
|
||||
SHELL_PUTC = 2,
|
||||
SHELL_PUTS = 3,
|
||||
SHELL_GETC = 4,
|
||||
SHELL_GETS = 5,
|
||||
SHELL_CLS = 6,
|
||||
SHELL_PID = 7,
|
||||
SHELL_PING = 8
|
||||
};
|
||||
|
||||
#define SHELL_SHM_MAX 1024 * 16
|
||||
|
||||
@@ -28,15 +30,22 @@ enum __SHELL_INIT_STATE {
|
||||
__SHELL_INIT_FAILED = 3 // fail init shell
|
||||
};
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct shell_shm_buffer {
|
||||
uint8_t cmd;
|
||||
char data[SHELL_SHM_MAX - sizeof(((struct shell_shm_buffer*)NULL)->cmd)];
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
__EXTERN char __shell_shm_name[32];
|
||||
__EXTERN char* __shell_shm;
|
||||
__EXTERN struct shell_shm_buffer* __shell_shm;
|
||||
__EXTERN enum __SHELL_INIT_STATE __shell_is_init;
|
||||
__EXTERN void __shell_init();
|
||||
|
||||
#define __SHELL_WAIT() \
|
||||
do { \
|
||||
_ksys_thread_yield(); \
|
||||
} while (*__shell_shm);
|
||||
} while (__shell_shm->cmd);
|
||||
|
||||
__EXTERN int shell_ping();
|
||||
__EXTERN unsigned shell_get_pid();
|
||||
@@ -52,4 +61,5 @@ __EXTERN void shell_printf(const char* format, ...);
|
||||
__EXTERN void shell_write_string(const char* s, size_t len);
|
||||
|
||||
__EXTERN void shell_cls();
|
||||
|
||||
#endif
|
||||
@@ -1844,11 +1844,12 @@ KOSAPI ksys70_status_t _ksys_file_read(const char* name, uint64_t offset, uint32
|
||||
|
||||
/*====== Function 70, subfunction 1 - read dir ======*/
|
||||
|
||||
KOSAPI ksys70_status_t _ksys_read_dir(const char* path, unsigned n, unsigned encoding, ksys_readdir_buff_t* buf)
|
||||
KOSAPI ksys70_status_t _ksys_read_dir(const char* path, unsigned start_block, unsigned encoding, unsigned n, ksys_readdir_buff_t* buf)
|
||||
{
|
||||
ksys70_t k;
|
||||
k.p00 = 1;
|
||||
k.p04 = encoding;
|
||||
k.p04dw = start_block;
|
||||
k.p08dw = encoding;
|
||||
k.p12 = n;
|
||||
k.p16 = buf;
|
||||
k.p20 = 0;
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
#ifndef _TIME_H_
|
||||
#define _TIME_H_
|
||||
|
||||
#include <sys/ksys.h>
|
||||
#include <stddef.h>
|
||||
|
||||
typedef unsigned long int clock_t;
|
||||
typedef unsigned long int time_t;
|
||||
#define clock() _ksys_get_clock()
|
||||
#define CLOCKS_PER_SEC 100
|
||||
|
||||
#pragma pack(push, 1)
|
||||
@@ -22,6 +21,7 @@ struct tm {
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
DLLAPI clock_t clock(void);
|
||||
DLLAPI time_t mktime(struct tm* timeptr);
|
||||
DLLAPI time_t time(time_t* timer);
|
||||
DLLAPI struct tm* localtime(const time_t* timer);
|
||||
|
||||
@@ -1,17 +1,22 @@
|
||||
#include <conio.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <sys/dir.h>
|
||||
#include <sys/dirent.h>
|
||||
|
||||
const char* folder_type = "Folder";
|
||||
const char* file_type = "File";
|
||||
const char folder_type[] = "Folder";
|
||||
const char file_type[] = "File";
|
||||
|
||||
const char green[] = "\033[32m";
|
||||
const char normal[] = "\033[0m";
|
||||
|
||||
int main()
|
||||
{
|
||||
char* path = getcwd(NULL, PATH_MAX);
|
||||
printf("Current directory: %s\n", path);
|
||||
if (mkdir("test")) {
|
||||
if (!mkdir("test")) {
|
||||
puts("Test folder created!");
|
||||
} else {
|
||||
puts("Error creating folder!");
|
||||
@@ -19,26 +24,28 @@ int main()
|
||||
|
||||
DIR* mydir = opendir(path);
|
||||
if (!mydir) {
|
||||
puts("File system error.");
|
||||
printf("File system error: %s.\n", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct dirent* file_info;
|
||||
char* str_type = NULL;
|
||||
putc(' ');
|
||||
while ((file_info = readdir(mydir)) != NULL) {
|
||||
char* str_type[max(sizeof(green), sizeof(normal)) + max(sizeof(folder_type), sizeof(file_type))];
|
||||
if (file_info->d_type == IS_FOLDER) {
|
||||
(*con_set_flags)(CON_COLOR_GREEN);
|
||||
str_type = (char*)folder_type;
|
||||
strcpy(str_type, green);
|
||||
strcat(str_type, folder_type);
|
||||
} else {
|
||||
(*con_set_flags)(7);
|
||||
str_type = (char*)file_type;
|
||||
strcpy(str_type, normal);
|
||||
strcat(str_type, file_type);
|
||||
}
|
||||
printf("%3d %20s %s\n ", file_info->d_ino, file_info->d_name, str_type);
|
||||
printf("%s%3d %20s %s\n ", normal, file_info->d_ino, file_info->d_name, str_type);
|
||||
};
|
||||
puts(normal);
|
||||
|
||||
setcwd("/sys/develop");
|
||||
path = getcwd(NULL, PATH_MAX);
|
||||
printf("Move to the directory: %s\n", path);
|
||||
free(path);
|
||||
return 0;
|
||||
}
|
||||
@@ -119,6 +119,7 @@
|
||||
#include "math/sinh.c"
|
||||
#include "math/tanh.c"
|
||||
|
||||
#include "time/clock.c"
|
||||
#include "time/asctime.c"
|
||||
#include "time/difftime.c"
|
||||
#include "time/localtime.c"
|
||||
@@ -338,6 +339,7 @@ ksys_dll_t EXPORTS[] = {
|
||||
{ "con_cls", &con_cls },
|
||||
{ "con_get_cursor_pos", &con_get_cursor_pos },
|
||||
{ "con_set_cursor_pos", &con_set_cursor_pos },
|
||||
{ "clock", &clock },
|
||||
{ "mktime", &mktime },
|
||||
{ "time", &time },
|
||||
{ "localtime", &localtime },
|
||||
|
||||
@@ -11,17 +11,26 @@
|
||||
|
||||
#define READDIR_BUF_LEN ((READDIR_ENCODING == KSYS_FILE_CP866) ? 264 : 520)
|
||||
|
||||
#define __CHECK_DIR_ERR(status, err, data, ...) \
|
||||
{ \
|
||||
if (status) { \
|
||||
void* _CHECK_DIR_ERR_ARGS[] = { data, __VA_ARGS__ }; \
|
||||
for (size_t i = 0; i < sizeof(_CHECK_DIR_ERR_ARGS) / sizeof(*_CHECK_DIR_ERR_ARGS); ++i) { \
|
||||
if (_CHECK_DIR_ERR_ARGS[i]) { \
|
||||
free(_CHECK_DIR_ERR_ARGS[i]); \
|
||||
} \
|
||||
} \
|
||||
errno = err; \
|
||||
return NULL; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define CHECK_DIR_ERR(path, n, data, ...) \
|
||||
data = malloc(sizeof(ksys_readdir_buff_t) + (sizeof(ksys_bdfe_t) + READDIR_BUF_LEN) * n); \
|
||||
if (!data || _ksys_read_dir(path, n, READDIR_ENCODING, data).status) { \
|
||||
void* _CHECK_DIR_ERR_ARGS[] = { data, __VA_ARGS__ }; \
|
||||
for (size_t i = 0; i < sizeof(_CHECK_DIR_ERR_ARGS) / sizeof(*_CHECK_DIR_ERR_ARGS); ++i) { \
|
||||
if (_CHECK_DIR_ERR_ARGS[i]) { \
|
||||
free(_CHECK_DIR_ERR_ARGS[i]); \
|
||||
} \
|
||||
} \
|
||||
errno = ENOTDIR; \
|
||||
return NULL; \
|
||||
{ \
|
||||
data = malloc(sizeof(ksys_readdir_buff_t) + (sizeof(ksys_bdfe_t) + READDIR_BUF_LEN) * n); \
|
||||
__CHECK_DIR_ERR(!data, ENOMEM, data, __VA_ARGS__); \
|
||||
int status = _ksys_read_dir(path, 0, READDIR_ENCODING, n, data).status; \
|
||||
__CHECK_DIR_ERR((status && status != KSYS_FS_ERR_EOF), status, data, __VA_ARGS__); \
|
||||
}
|
||||
|
||||
DIR* opendir(const char* path)
|
||||
@@ -43,14 +52,20 @@ DIR* opendir(const char* path)
|
||||
free(data);
|
||||
|
||||
list->objs = (struct dirent*)malloc(num_of_file * sizeof(struct dirent));
|
||||
if (list->objs == NULL) {
|
||||
errno = ENOMEM;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CHECK_DIR_ERR(path, num_of_file, data, list->objs, list);
|
||||
|
||||
num_of_file = data->blocks;
|
||||
|
||||
for (int i = 0; i < num_of_file; i++) {
|
||||
ksys_bdfe_t* d = (ksys_bdfe_t*)((char*)(&data->files) + ((sizeof(ksys_bdfe_t) + READDIR_BUF_LEN) * i));
|
||||
list->objs[i].d_ino = i;
|
||||
list->objs[i].d_type = d->attributes;
|
||||
strcpy(list->objs[i].d_name, d->name);
|
||||
strncpy(list->objs[i].d_name, &d->name, min(READDIR_BUF_LEN, sizeof(list->objs[i].d_name) / sizeof(*list->objs[i].d_name)));
|
||||
}
|
||||
free(data);
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
#include <time.h>
|
||||
#include <sys/ksys.h>
|
||||
|
||||
clock_t clock(void)
|
||||
{
|
||||
return _ksys_get_tick_count();
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -170,9 +170,6 @@ fb_draw_panel_selection:
|
||||
mov eax,fb_folder_block
|
||||
test eax,eax
|
||||
jz .end
|
||||
xor eax,eax
|
||||
cmp fb_select_panel_counter,eax
|
||||
je .end
|
||||
mov eax,fb_folder_block
|
||||
sub eax,fb_start_draw_line
|
||||
mov cx,fb_start_draw_cursor_line
|
||||
@@ -199,7 +196,29 @@ fb_draw_panel_selection:
|
||||
shl eax,16
|
||||
push eax
|
||||
add ebx,eax
|
||||
mcall SF_DRAW_RECT
|
||||
cmp fb_select_panel_counter,0 ; is the cursor in an inactive state?
|
||||
jne @f
|
||||
push ecx
|
||||
mov cx,2
|
||||
mcall SF_DRAW_RECT ; display the cursor in the inactive state
|
||||
ror ecx,16
|
||||
add cx,fb_line_size_y
|
||||
sub cx,2
|
||||
ror ecx,16
|
||||
mcall
|
||||
pop ecx
|
||||
mov bx,2
|
||||
mcall
|
||||
ror ebx,16
|
||||
add bx,fb_size_x
|
||||
sub bx,fb_icon_size_x
|
||||
sub bx,2+2 ; cursor border + text margin
|
||||
ror ebx,16
|
||||
mcall
|
||||
jmp .no_frame
|
||||
@@:
|
||||
mcall SF_DRAW_RECT ; display the cursor in the active state
|
||||
.no_frame:
|
||||
pop ebx
|
||||
cmp fb_all_redraw,0
|
||||
je .end
|
||||
@@ -286,7 +305,7 @@ fb_draw_folder_data:
|
||||
xor edx,edx
|
||||
div ebx
|
||||
pop edx ebx
|
||||
sub eax,23+2+2+2
|
||||
sub eax,25+2+2+2
|
||||
mov esi,fb_file_name_length
|
||||
mov fb_temp_counter,0
|
||||
mov fb_display_name_max_length,eax
|
||||
@@ -323,13 +342,14 @@ fb_draw_folder_data:
|
||||
xor eax,eax
|
||||
mov ax,fb_font_size_x
|
||||
imul eax,fb_display_name_max_length
|
||||
inc eax
|
||||
shl eax,16
|
||||
push edx
|
||||
add ebx,eax
|
||||
mov esi,2
|
||||
mov ecx,fb_reduct_text_color
|
||||
mov edx,dword fb_truncated_filename_char
|
||||
mcall SF_DRAW_TEXT
|
||||
mcall SF_DRAW_TEXT ; .. two dots
|
||||
pop edx
|
||||
.continue:
|
||||
pop ebx
|
||||
@@ -375,7 +395,8 @@ align 4
|
||||
mov eax,fb_select_color
|
||||
@@:
|
||||
mov edi,eax
|
||||
mcall SF_DRAW_TEXT
|
||||
add ebx,1 shl 16
|
||||
mcall SF_DRAW_TEXT ; file name
|
||||
popa
|
||||
ret
|
||||
;--------------------------------------
|
||||
@@ -432,6 +453,19 @@ fb_clear_line:
|
||||
sub bx,fb_icon_size_x
|
||||
sub bx,3
|
||||
rol ebx,16
|
||||
cmp fb_select_panel_counter,0 ; is the cursor in an inactive state?
|
||||
jne @f
|
||||
mov ax,fb_start_draw_cursor_line
|
||||
add ax,fb_start_y
|
||||
shl eax,16
|
||||
mov ax,fb_line_size_y
|
||||
cmp ecx,eax
|
||||
jne @f
|
||||
add ebx,2 shl 16
|
||||
sub ebx,4
|
||||
add ecx,2 shl 16
|
||||
sub ecx,4
|
||||
@@:
|
||||
mcall SF_DRAW_RECT,,,fb_background_color
|
||||
.end:
|
||||
popa
|
||||
@@ -444,13 +478,13 @@ fb_draw_type_size_date:
|
||||
test [edx-40],byte 0x10
|
||||
jz .copy_type
|
||||
mov [eax],dword '<DIR'
|
||||
mov [eax+4],word '> '
|
||||
mov [eax+4],dword '> '
|
||||
mov fb_file_name_length,0
|
||||
mov fb_extension_size,0
|
||||
jmp .start
|
||||
.copy_type:
|
||||
mov [eax],dword ' '
|
||||
mov [eax+4],word ' '
|
||||
mov [eax+4],dword ' '
|
||||
.start:
|
||||
mov esi,edx
|
||||
xor eax,eax
|
||||
@@ -505,16 +539,16 @@ fb_draw_type_size_date:
|
||||
mov eax,fb_type_table
|
||||
test [edx-40],byte 0x10
|
||||
jz .copy_size
|
||||
mov [eax+6],dword '----'
|
||||
mov [eax+6+4],word '- '
|
||||
mov [eax+7],dword '----'
|
||||
mov [eax+7+4],dword '-- '
|
||||
jmp .date
|
||||
;-----------------------------------------
|
||||
align 4
|
||||
.call_decimal_string:
|
||||
mov ebx,fb_type_table
|
||||
add ebx,9
|
||||
add ebx,10
|
||||
call fb_decimal_string
|
||||
mov [ebx+1],dl
|
||||
mov [ebx+1],dx
|
||||
jmp .size_convert_end
|
||||
;-----------------------------------------
|
||||
.qword_div:
|
||||
@@ -548,7 +582,7 @@ align 4
|
||||
call .qword_div
|
||||
pop ecx
|
||||
jz @f
|
||||
mov dl,byte 'E' ; Exa Byte
|
||||
mov dx,'E ' ; Exa Byte
|
||||
jmp .call_decimal_string
|
||||
@@:
|
||||
push ecx
|
||||
@@ -556,7 +590,7 @@ align 4
|
||||
call .qword_div
|
||||
pop ecx
|
||||
jz @f
|
||||
mov dl,byte 'P' ; Peta Byte
|
||||
mov dx,'P ' ; Peta Byte
|
||||
jmp .call_decimal_string
|
||||
@@:
|
||||
push ecx
|
||||
@@ -564,7 +598,7 @@ align 4
|
||||
call .qword_div
|
||||
pop ecx
|
||||
jz @f
|
||||
mov dl,byte 'T' ; Tera Byte
|
||||
mov dx,'T ' ; Tera Byte
|
||||
jmp .call_decimal_string
|
||||
@@:
|
||||
push ecx
|
||||
@@ -572,7 +606,7 @@ align 4
|
||||
call .qword_div
|
||||
pop ecx
|
||||
jz @f
|
||||
mov dl,byte 'G' ; Giga Byte
|
||||
mov dx,'G ' ; Giga Byte
|
||||
jmp .call_decimal_string
|
||||
@@:
|
||||
mov eax,[edx-40+32]
|
||||
@@ -580,19 +614,20 @@ align 4
|
||||
shr eax,20 ; /(1024*1024)
|
||||
test eax,eax
|
||||
jz @f
|
||||
mov dl,byte 'M' ; Mega Byte
|
||||
mov dx,'M ' ; Mega Byte
|
||||
jmp .call_decimal_string
|
||||
@@:
|
||||
mov eax,ebx
|
||||
shr eax,10 ; /1024
|
||||
test eax,eax
|
||||
jz @f
|
||||
mov dl,byte 'K' ; Kilo Byte
|
||||
mov dx,'K ' ; Kilo Byte
|
||||
jmp .call_decimal_string
|
||||
@@:
|
||||
mov eax,ebx
|
||||
mov ebx,fb_type_table
|
||||
add ebx,10
|
||||
mov dword[ebx+1],' ' ; clear K, M, ..., E
|
||||
call fb_decimal_string
|
||||
.size_convert_end:
|
||||
pop edx ebx
|
||||
@@ -608,22 +643,22 @@ align 4
|
||||
mov al,[edx-40+28]
|
||||
push ebx
|
||||
mov ebx,fb_type_table
|
||||
add ebx,12
|
||||
add ebx,14
|
||||
call fb_decimal_string_2 ; day
|
||||
mov al,[edx-40+29]
|
||||
mov ebx,fb_type_table
|
||||
add ebx,12+3
|
||||
add ebx,14+3
|
||||
call fb_decimal_string_2 ; month
|
||||
mov ax,[edx-40+30]
|
||||
mov ebx,fb_type_table
|
||||
add ebx,12+9
|
||||
add ebx,14+9
|
||||
mov [ebx-3], dword '0000'
|
||||
call fb_decimal_string ; year
|
||||
pop ebx
|
||||
;-----------------------------------------
|
||||
ror ebx,16
|
||||
add bx,fb_size_x
|
||||
sub ebx,161 ; 122+12+15
|
||||
sub ebx,173 ; 122+18+21
|
||||
rol ebx,16
|
||||
mov ecx,fb_text_color
|
||||
cmp fb_marked_file,0
|
||||
@@ -631,7 +666,7 @@ align 4
|
||||
mov ecx,fb_reduct_text_color
|
||||
@@:
|
||||
mov edx,fb_type_table
|
||||
mov esi,22
|
||||
mov esi,24 ; text length
|
||||
mov ax,fb_line_size_y
|
||||
sub ax,fb_font_size_y
|
||||
push ebx
|
||||
@@ -650,14 +685,41 @@ align 4
|
||||
mov eax,fb_select_color
|
||||
@@:
|
||||
mov edi,eax
|
||||
mcall SF_DRAW_TEXT
|
||||
mcall SF_DRAW_TEXT ; type size date
|
||||
.not_show_date:
|
||||
popa
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
fb_draw_icon:
|
||||
pusha
|
||||
pushad
|
||||
cmp fb_icon_raw_area,0
|
||||
jne .not_draw_null
|
||||
mov bx,[esp+18] ;coord x
|
||||
sub bx,2
|
||||
sub bx,fb_icon_size_x
|
||||
shl ebx,16
|
||||
mov bx,fb_icon_size_x
|
||||
mov cx,[esp+16] ;coord y
|
||||
shl ecx,16
|
||||
mov cx,fb_icon_size_y
|
||||
test [edx-40],byte 0x10
|
||||
jz @f
|
||||
mov edx,fb_select_color
|
||||
jmp .draw_r
|
||||
@@:
|
||||
mov edx,fb_background_color
|
||||
.draw_r:
|
||||
mcall SF_DRAW_RECT
|
||||
shr ebx,16
|
||||
shr ecx,16
|
||||
movzx eax,fb_icon_size_x
|
||||
movzx edx,fb_icon_size_y
|
||||
stdcall draw_edge, ebx, ecx, eax, edx,\
|
||||
fb_background_color, fb_select_color, fb_text_color
|
||||
popad
|
||||
ret
|
||||
.not_draw_null:
|
||||
xor eax,eax
|
||||
mov ax,fb_icon_size_y
|
||||
mov ebx,fb_resolution_raw
|
||||
@@ -698,11 +760,9 @@ fb_draw_icon:
|
||||
add dx,ax
|
||||
mov esi,fb_resolution_raw
|
||||
xor ebp,ebp
|
||||
push edi
|
||||
mov edi,fb_palette_raw
|
||||
mcall SF_PUT_IMAGE_EXT
|
||||
pop edi
|
||||
popa
|
||||
popad
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
; Convert of a binary number in decimal string form
|
||||
|
||||
@@ -1178,17 +1178,18 @@ proc png_colorspace_set_gamma, png_ptr:dword, colorspace:dword, gAMA:dword
|
||||
; In 1.6.0 this test replaces the ones in pngrutil.c, in the gAMA chunk
|
||||
; handling code, which only required the value to be >0.
|
||||
|
||||
png_debug 1, 'in png_colorspace_set_gamma'
|
||||
; charp errmsg;
|
||||
|
||||
; if (gAMA < 16 || gAMA > 625000000)
|
||||
; errmsg = "gamma value out of range";
|
||||
|
||||
;# ifdef PNG_READ_gAMA_SUPPORTED
|
||||
if PNG_READ_gAMA_SUPPORTED eq 1
|
||||
; Allow the application to set the gamma value more than once
|
||||
; else if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0 &&
|
||||
; (colorspace->flags & PNG_COLORSPACE_FROM_gAMA) != 0)
|
||||
; errmsg = "duplicate";
|
||||
;# endif
|
||||
end if
|
||||
|
||||
; Do nothing if the colorspace is already invalid
|
||||
; else if ((colorspace->flags & PNG_COLORSPACE_INVALID) != 0)
|
||||
|
||||
@@ -161,8 +161,7 @@ proc png_set_gAMA_fixed uses eax edi esi, png_ptr:dword, info_ptr:dword, file_ga
|
||||
or esi,esi
|
||||
jz .end_f ;if (..== 0 || ..== 0) return
|
||||
|
||||
mov eax,esi
|
||||
add eax,png_info_def.colorspace
|
||||
lea eax,[esi+png_info_def.colorspace]
|
||||
stdcall png_colorspace_set_gamma, edi, eax, [file_gamma]
|
||||
stdcall png_colorspace_sync_info, edi, esi
|
||||
.end_f:
|
||||
@@ -593,8 +592,10 @@ endp
|
||||
|
||||
;void (png_structrp png_ptr, png_inforp info_ptr, png_colorp palette, int num_palette)
|
||||
align 4
|
||||
proc png_set_PLTE uses eax edi esi, png_ptr:dword, info_ptr:dword, palette:dword, num_palette:dword
|
||||
; uint_32 max_palette_length;
|
||||
proc png_set_PLTE uses eax ecx edi esi, png_ptr:dword, info_ptr:dword, palette:dword, num_palette:dword
|
||||
locals
|
||||
max_palette_length rd 1 ;uint_32
|
||||
endl
|
||||
|
||||
png_debug1 1, 'in %s storage function', 'PLTE'
|
||||
|
||||
@@ -605,31 +606,53 @@ proc png_set_PLTE uses eax edi esi, png_ptr:dword, info_ptr:dword, palette:dword
|
||||
or esi,esi
|
||||
jz .end_f ;if (..==0 || ..==0) return
|
||||
|
||||
; max_palette_length = (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) ?
|
||||
; (1 << info_ptr->bit_depth) : PNG_MAX_PALETTE_LENGTH;
|
||||
;max_palette_length = (..==..) ? .. : ..
|
||||
cmp byte[esi+png_info_def.color_type],PNG_COLOR_TYPE_PALETTE
|
||||
jne @f
|
||||
xor eax,eax
|
||||
inc eax
|
||||
movzx ecx,byte[esi+png_info_def.bit_depth]
|
||||
shl eax,cl
|
||||
mov [max_palette_length],eax
|
||||
jmp .end0
|
||||
@@:
|
||||
mov [max_palette_length],PNG_MAX_PALETTE_LENGTH
|
||||
.end0:
|
||||
|
||||
; if (num_palette < 0 || num_palette > (int) max_palette_length)
|
||||
; {
|
||||
; if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
||||
; png_error(png_ptr, "Invalid palette length");
|
||||
;if (..<0 || ..>..)
|
||||
cmp [num_palette],0
|
||||
jl @f
|
||||
mov eax,[max_palette_length]
|
||||
cmp [num_palette],eax
|
||||
jle .end1
|
||||
@@:
|
||||
cmp byte[edi+png_struct.color_type],PNG_COLOR_TYPE_PALETTE ;if (..==..)
|
||||
jne @f
|
||||
png_error edi, 'Invalid palette length'
|
||||
jmp .end1
|
||||
@@: ;else
|
||||
png_warning edi, 'Invalid palette length'
|
||||
jmp .end_f
|
||||
.end1:
|
||||
|
||||
; else
|
||||
; {
|
||||
; png_warning(png_ptr, "Invalid palette length");
|
||||
|
||||
; return;
|
||||
; }
|
||||
; }
|
||||
|
||||
; if ((num_palette > 0 && palette == NULL) ||
|
||||
; (num_palette == 0
|
||||
cmp [num_palette],0
|
||||
jle @f
|
||||
cmp [palette],0
|
||||
je .end2
|
||||
@@:
|
||||
cmp [num_palette],0
|
||||
jne .end3
|
||||
;if ((..>0 && ..==0) || (..==0
|
||||
if PNG_MNG_FEATURES_SUPPORTED eq 1
|
||||
; && (png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) == 0
|
||||
; && (.. & PNG_FLAG_MNG_EMPTY_PLTE) == 0
|
||||
mov eax,[edi+png_struct.mng_features_permitted]
|
||||
and eax,PNG_FLAG_MNG_EMPTY_PLTE
|
||||
jnz .end3
|
||||
end if
|
||||
; ))
|
||||
; {
|
||||
; png_error(png_ptr, "Invalid palette");
|
||||
; }
|
||||
;))
|
||||
.end2:
|
||||
png_error edi, 'Invalid palette'
|
||||
.end3:
|
||||
|
||||
; It may not actually be necessary to set png_ptr->palette here;
|
||||
; we do it for backward compatibility with the way the png_handle_tRNS
|
||||
@@ -644,14 +667,26 @@ end if
|
||||
; of num_palette entries, in case of an invalid PNG file or incorrect
|
||||
; call to png_set_PLTE() with too-large sample values.
|
||||
|
||||
; png_ptr->palette = png_calloc(png_ptr,
|
||||
; PNG_MAX_PALETTE_LENGTH * (sizeof (png_color)));
|
||||
stdcall png_calloc, edi, PNG_MAX_PALETTE_LENGTH*sizeof.png_color
|
||||
mov [edi+png_struct.palette],eax
|
||||
|
||||
; if (num_palette > 0)
|
||||
; memcpy(png_ptr->palette, palette, num_palette * (sizeof (png_color)));
|
||||
;if (..>0)
|
||||
cmp [num_palette],0
|
||||
jle @f
|
||||
push esi edi
|
||||
mov ecx,[num_palette]
|
||||
imul ecx,sizeof.png_color
|
||||
mov esi,[palette]
|
||||
mov edi,eax
|
||||
rep movsb ;memcpy(png_ptr->palette, palette, ...
|
||||
pop edi esi
|
||||
@@:
|
||||
mov eax,[edi+png_struct.palette]
|
||||
mov [esi+png_info_def.palette],eax
|
||||
; info_ptr->num_palette = png_ptr->num_palette = (uint_16)num_palette;
|
||||
|
||||
mov eax,[num_palette]
|
||||
mov [edi+png_struct.num_palette],ax
|
||||
mov [esi+png_info_def.num_palette],ax
|
||||
|
||||
or dword[esi+png_info_def.free_me], PNG_FREE_PLTE
|
||||
or dword[esi+png_info_def.valid], PNG_INFO_PLTE
|
||||
|
||||
@@ -1925,6 +1925,7 @@ locals
|
||||
aindex dd 0 ;int ;= 0
|
||||
y dd ? ;uint_32 ;= image->height
|
||||
endl
|
||||
png_debug 1, 'in png_write_image_16bit'
|
||||
mov ebx,[argument]
|
||||
mov [display],ebx
|
||||
mov edx,[ebx+png_image_write_control.image]
|
||||
@@ -2118,6 +2119,7 @@ locals
|
||||
y dd ? ;uint_32 ;= image->height
|
||||
component dd ? ;uint_32
|
||||
endl
|
||||
png_debug 1, 'in png_write_image_8bit'
|
||||
mov ebx,[argument]
|
||||
mov [display],ebx
|
||||
mov edx,[ebx+png_image_write_control.image]
|
||||
@@ -2257,9 +2259,11 @@ locals
|
||||
afirst dd 0
|
||||
bgr dd 0
|
||||
num_trans dd 0
|
||||
i dd ?
|
||||
palette rb 256*sizeof.png_color
|
||||
tRNS rb 256 ;byte[]
|
||||
endl
|
||||
png_debug 1, 'in png_image_set_PLTE'
|
||||
pushad
|
||||
mov edx,[display]
|
||||
mov ebx,[edx+png_image_write_control.image]
|
||||
@@ -2296,30 +2300,33 @@ if PNG_FORMAT_BGR_SUPPORTED eq 1
|
||||
@@:
|
||||
end if
|
||||
|
||||
; int i;
|
||||
|
||||
xor eax,eax
|
||||
mov ecx,(256*sizeof.png_color)/4
|
||||
mov edi,ebp
|
||||
sub edi,256+256*sizeof.png_color
|
||||
lea edi,[ebp-256-256*sizeof.png_color]
|
||||
rep stosd ;memset(palette, 0, ...
|
||||
not eax
|
||||
mov ecx,256/4
|
||||
;;mov edi,ebp ;if 'tRNS' after 'palette' this code can be comment
|
||||
;;sub edi,256
|
||||
;lea edi,[ebp-256] ;if 'tRNS' after 'palette' this code can be comment
|
||||
rep stosd ;memset(tRNS, 255, ...
|
||||
|
||||
|
||||
; for (i=num_trans=0; i<entries; ++i)
|
||||
; {
|
||||
mov [i],0
|
||||
lea edx,[ebp-256] ;edx=&tRNS
|
||||
lea edi,[edx-256*sizeof.png_color]
|
||||
align 4
|
||||
.cycle0: ;for (i=num_trans=0; i<entries; ++i)
|
||||
; This gets automatically converted to sRGB with reversal of the
|
||||
; pre-multiplication if the color-map has an alpha channel.
|
||||
|
||||
; if ((format & PNG_FORMAT_FLAG_LINEAR) != 0)
|
||||
; {
|
||||
; png_const_uint_16p entry = cmap;
|
||||
|
||||
; entry += i * channels;
|
||||
;if ((..&..) != 0)
|
||||
mov eax,[format]
|
||||
and eax,PNG_FORMAT_FLAG_LINEAR
|
||||
or eax,eax
|
||||
jz .end0
|
||||
mov esi,[cmap] ;esi=entry uint_16p
|
||||
mov eax,[channels]
|
||||
mov ecx,eax
|
||||
imul eax,[i]
|
||||
add esi,eax ;+=i*channels;
|
||||
|
||||
; if ((channels & 1) != 0) /* no alpha */
|
||||
; {
|
||||
@@ -2369,46 +2376,86 @@ end if
|
||||
; palette[i].blue = palette[i].red = palette[i].green =
|
||||
; png_unpremultiply(entry[afirst], alpha, reciprocal);
|
||||
; }
|
||||
; }
|
||||
jmp .end1
|
||||
.end0: ;else Color-map has sRGB values
|
||||
mov esi,[cmap] ;esi=entry
|
||||
mov eax,[channels]
|
||||
mov ecx,eax
|
||||
imul eax,[i]
|
||||
add esi,eax ;+=i*channels;
|
||||
|
||||
; else /* Color-map has sRGB values */
|
||||
; {
|
||||
; bytep entry = cmap;
|
||||
;switch (channels)
|
||||
cmp ecx,4
|
||||
jne .end2
|
||||
mov eax,[afirst]
|
||||
or eax,eax
|
||||
jz @f
|
||||
xor eax,eax
|
||||
jmp .end3
|
||||
@@:
|
||||
mov eax,3
|
||||
.end3:
|
||||
mov al,byte[esi+eax]
|
||||
mov byte[edx],al ;tRNS[i] = entry[afirst ? 0 : 3]
|
||||
cmp al,255 ;if (..<..)
|
||||
je @f
|
||||
mov eax,[i]
|
||||
inc eax
|
||||
mov [num_trans],eax
|
||||
@@:
|
||||
dec ecx ; FALL THROUGH
|
||||
.end2:
|
||||
cmp ecx,3
|
||||
jne @f
|
||||
add esi,[afirst]
|
||||
mov eax,[bgr]
|
||||
xor eax,2
|
||||
lea eax,[esi+eax]
|
||||
mov al,byte[eax]
|
||||
stosb ;palette[i].blue
|
||||
|
||||
; entry += i * channels;
|
||||
lea eax,[esi+1]
|
||||
mov al,byte[eax]
|
||||
stosb ;palette[i].green
|
||||
|
||||
; switch (channels)
|
||||
; {
|
||||
; case 4:
|
||||
; tRNS[i] = entry[afirst ? 0 : 3];
|
||||
; if (tRNS[i] < 255)
|
||||
; num_trans = i+1;
|
||||
; /* FALL THROUGH */
|
||||
; case 3:
|
||||
; palette[i].blue = entry[afirst + (2 ^ bgr)];
|
||||
; palette[i].green = entry[afirst + 1];
|
||||
; palette[i].red = entry[afirst + bgr];
|
||||
; break;
|
||||
|
||||
; case 2:
|
||||
; tRNS[i] = entry[1 ^ afirst];
|
||||
; if (tRNS[i] < 255)
|
||||
; num_trans = i+1;
|
||||
; /* FALL THROUGH */
|
||||
; case 1:
|
||||
; palette[i].blue = palette[i].red = palette[i].green =
|
||||
; entry[afirst];
|
||||
; break;
|
||||
|
||||
; default:
|
||||
; break;
|
||||
; }
|
||||
; }
|
||||
; }
|
||||
mov eax,[bgr]
|
||||
lea eax,[esi+eax]
|
||||
mov al,byte[eax]
|
||||
stosb ;palette[i].red
|
||||
jmp .end1
|
||||
@@:
|
||||
cmp ecx,2
|
||||
jne @f
|
||||
xor eax,eax
|
||||
inc eax
|
||||
xor eax,[afirst]
|
||||
mov al,byte[esi+eax]
|
||||
mov byte[edx],al ;tRNS[i] = entry[1 ^ afirst]
|
||||
cmp al,255 ;if (..<..)
|
||||
je @f
|
||||
mov eax,[i]
|
||||
inc eax
|
||||
mov [num_trans],eax
|
||||
@@:
|
||||
dec ecx; FALL THROUGH
|
||||
@@:
|
||||
cmp ecx,1
|
||||
jne .end1
|
||||
mov eax,[afirst]
|
||||
mov al,byte[esi+eax]
|
||||
stosb
|
||||
stosb
|
||||
stosb
|
||||
.end1:
|
||||
inc edx
|
||||
mov eax,[entries]
|
||||
inc [i]
|
||||
cmp [i],eax
|
||||
jl .cycle0
|
||||
.cycle0end:
|
||||
|
||||
mov ecx,[ebx+png_image.opaque]
|
||||
mov eax,ebp
|
||||
sub eax,256+256*sizeof.png_color
|
||||
lea eax,[ebp-256-256*sizeof.png_color]
|
||||
stdcall png_set_PLTE, [ecx+png_control.png_ptr], [ecx+png_control.info_ptr], eax, [entries]
|
||||
|
||||
cmp dword[num_trans],0
|
||||
@@ -2820,9 +2867,26 @@ png_debug1 2, 'IDAT compress all len = %d', [len]
|
||||
mov edi,[buf_f]
|
||||
mov esi,[buf]
|
||||
|
||||
cmp eax,PNG_COLOR_TYPE_PALETTE
|
||||
je .cycle7
|
||||
cmp eax,PNG_COLOR_TYPE_RGB
|
||||
je .cycle0
|
||||
cmp eax,PNG_COLOR_TYPE_RGB_ALPHA
|
||||
je .cycle5
|
||||
|
||||
.cycle7: ;8 bit image palette
|
||||
cmp edx,1
|
||||
jl .cycle0end
|
||||
mov ecx,ebx
|
||||
xor al,al
|
||||
stosb ;insert filter (0 - none)
|
||||
align 4
|
||||
rep movsb
|
||||
dec edx
|
||||
jmp .cycle7
|
||||
.cycle7end:
|
||||
jmp .cycle5end
|
||||
|
||||
.cycle0: ;24 bit image
|
||||
cmp edx,1
|
||||
jl .cycle0end
|
||||
|
||||
@@ -1063,8 +1063,8 @@ align 4
|
||||
proc png_write_PLTE, png_ptr:dword, palette:dword, num_pal:dword
|
||||
locals
|
||||
;max_palette_length dd ? ;uint_32
|
||||
i dd ?
|
||||
pal_ptr dd ? ;png_const_colorp
|
||||
;i dd ?
|
||||
;pal_ptr dd ? ;png_const_colorp
|
||||
buf rb 3 ;byte[3]
|
||||
endl
|
||||
png_debug 1, 'in png_write_PLTE'
|
||||
@@ -1085,16 +1085,16 @@ pushad
|
||||
;mov [max_palette_length],eax
|
||||
.end0:
|
||||
|
||||
if PNG_MNG_FEATURES_SUPPORTED eq 1
|
||||
cmp [num_pal],eax
|
||||
jg @f
|
||||
if PNG_MNG_FEATURES_SUPPORTED eq 1
|
||||
mov eax,[edi+png_struct.mng_features_permitted]
|
||||
and eax,PNG_FLAG_MNG_EMPTY_PLTE
|
||||
jnz .end1
|
||||
end if
|
||||
cmp [num_pal],0
|
||||
jne .end1
|
||||
@@:
|
||||
end if
|
||||
|
||||
cmp byte[edi+png_struct.color_type],PNG_COLOR_TYPE_PALETTE ;if (..==..)
|
||||
jne @f
|
||||
@@ -1118,31 +1118,24 @@ end if
|
||||
|
||||
imul eax,3
|
||||
stdcall png_write_chunk_header, edi, png_PLTE, eax
|
||||
if PNG_POINTER_INDEXING_SUPPORTED eq 1
|
||||
|
||||
; for (i = 0, pal_ptr = palette; i < num_pal; i++, pal_ptr++)
|
||||
; {
|
||||
; buf[0] = pal_ptr->red;
|
||||
; buf[1] = pal_ptr->green;
|
||||
; buf[2] = pal_ptr->blue;
|
||||
; png_write_chunk_data(png_ptr, buf, (png_size_t)3);
|
||||
; }
|
||||
mov ecx,[num_pal]
|
||||
or ecx,ecx
|
||||
jz .cycle0end
|
||||
mov esi,[palette]
|
||||
lea ebx,[ebp-3] ;ebx = &buf
|
||||
align 4
|
||||
.cycle0: ;for (;;)
|
||||
lodsb
|
||||
mov [ebx],al
|
||||
lodsb
|
||||
mov [ebx+1],al
|
||||
lodsb
|
||||
mov [ebx+2],al
|
||||
stdcall png_write_chunk_data, edi, ebx, 3
|
||||
loop .cycle0
|
||||
.cycle0end:
|
||||
|
||||
else
|
||||
; This is a little slower but some buggy compilers need to do this
|
||||
; instead
|
||||
|
||||
; pal_ptr=palette;
|
||||
|
||||
; for (i = 0; i < num_pal; i++)
|
||||
; {
|
||||
; buf[0] = pal_ptr[i].red;
|
||||
; buf[1] = pal_ptr[i].green;
|
||||
; buf[2] = pal_ptr[i].blue;
|
||||
; png_write_chunk_data(png_ptr, buf, (png_size_t)3);
|
||||
; }
|
||||
|
||||
end if
|
||||
stdcall png_write_chunk_end, edi
|
||||
or dword[edi+png_struct.mode], PNG_HAVE_PLTE
|
||||
.end_f:
|
||||
|
||||
@@ -1163,7 +1163,7 @@ local .l1
|
||||
|
||||
;;================================================================================================;;
|
||||
align 4
|
||||
proc img.encode.png uses ebx edx, _img:dword, _common:dword, _specific:dword
|
||||
proc img.encode.png uses ebx edx edi, _img:dword, _common:dword, _specific:dword
|
||||
;;------------------------------------------------------------------------------------------------;;
|
||||
;? Encode image into raw data in png format ;;
|
||||
;;------------------------------------------------------------------------------------------------;;
|
||||
@@ -1175,12 +1175,15 @@ proc img.encode.png uses ebx edx, _img:dword, _common:dword, _specific:dword
|
||||
;< ecx = error code / the size of encoded data ;;
|
||||
;;================================================================================================;;
|
||||
locals
|
||||
colormap dd 0
|
||||
encoded_file rd 1
|
||||
encoded_file_size rd 1
|
||||
simag png_image
|
||||
endl
|
||||
mov ebx,[_img]
|
||||
mov eax,[ebx+Image.Type]
|
||||
cmp eax,Image.bpp8i
|
||||
je @f
|
||||
cmp eax,Image.bpp24
|
||||
je @f
|
||||
cmp eax,Image.bpp32
|
||||
@@ -1192,16 +1195,27 @@ endl
|
||||
mov dword[edx+png_image.version],PNG_IMAGE_VERSION
|
||||
mov ecx,[ebx+Image.Width]
|
||||
mov [edx+png_image.width],ecx ;Image width in pixels (columns)
|
||||
cmp eax,Image.bpp8i
|
||||
jne @f
|
||||
mov dword[edx+png_image.format],PNG_FORMAT_RGBA_COLORMAP
|
||||
mov eax,ecx
|
||||
imul eax,[ebx+Image.Height]
|
||||
add eax,[ebx+Image.Data]
|
||||
add [colormap],eax
|
||||
stdcall get_pallete_colors,eax
|
||||
mov dword[edx+png_image.colormap_entries],eax
|
||||
jmp .init
|
||||
@@:
|
||||
cmp eax,Image.bpp24
|
||||
jne @f
|
||||
mov dword[edx+png_image.format],PNG_FORMAT_RGB
|
||||
imul ecx,3
|
||||
@@:
|
||||
cmp eax,Image.bpp32
|
||||
jne @f
|
||||
jne .init
|
||||
mov dword[edx+png_image.format],PNG_FORMAT_RGBA
|
||||
shl ecx,2
|
||||
@@:
|
||||
.init:
|
||||
mov eax,[ebx+Image.Height]
|
||||
mov [edx+png_image.height],eax ;Image height in pixels (rows)
|
||||
;mov dword[edx+png_image.flags],PNG_IMAGE_FLAG_???
|
||||
@@ -1221,7 +1235,7 @@ endl
|
||||
@@:
|
||||
mov [encoded_file],eax
|
||||
lea edi,[edx-4]
|
||||
stdcall png_image_write_to_memory, edx,eax,edi,0,[ebx+Image.Data],ecx,0
|
||||
stdcall png_image_write_to_memory, edx,eax,edi,0,[ebx+Image.Data],ecx,[colormap]
|
||||
mov eax,[encoded_file]
|
||||
mov ecx,[encoded_file_size]
|
||||
jmp .quit
|
||||
@@ -1231,3 +1245,31 @@ endl
|
||||
.quit:
|
||||
ret
|
||||
endp
|
||||
|
||||
|
||||
|
||||
;;================================================================================================;;
|
||||
align 4
|
||||
proc get_pallete_colors uses ecx edi, palette:dword
|
||||
;;------------------------------------------------------------------------------------------------;;
|
||||
;? Determine the palette size. Locate two adjacent zero-value colors; ;;
|
||||
;? this marks the end of the palette. ;;
|
||||
;;------------------------------------------------------------------------------------------------;;
|
||||
mov ecx,256-1
|
||||
mov edi,[palette]
|
||||
xor eax,eax
|
||||
@@:
|
||||
repne scasd
|
||||
or ecx,ecx
|
||||
jz .max_pal
|
||||
cmp [edi],eax ;second color check
|
||||
jne @b ;find again
|
||||
sub edi,[palette]
|
||||
shr edi,2
|
||||
mov eax,edi
|
||||
jmp @f
|
||||
.max_pal:
|
||||
mov eax,256
|
||||
@@:
|
||||
ret
|
||||
endp
|
||||
@@ -1,5 +1,6 @@
|
||||
format MS COFF
|
||||
public EXPORTS
|
||||
include '../../../KOSfuncs.inc'
|
||||
section '.flat' code readable align 16
|
||||
; void __stdcall START(dword state);
|
||||
DLL_ENTRY equ 1
|
||||
@@ -60,6 +61,7 @@ START:
|
||||
; SORT_BY_ACCESSED = 12, SORT_BY_ACCESSED_REV = 13 };
|
||||
; int __stdcall sort_dir(BDFE* folder_data, unsigned num_folder_entries, sort_mode mode);
|
||||
; return: 0 = ok, 1 = error
|
||||
align 4
|
||||
sort_dir:
|
||||
cmp dword [esp+12], num_compare_fns
|
||||
jae .error
|
||||
@@ -73,9 +75,9 @@ sort_dir:
|
||||
jz .done
|
||||
cmp eax, ecx
|
||||
jae .memok
|
||||
push 68
|
||||
push SF_SYS_MISC
|
||||
pop eax
|
||||
push 12
|
||||
push SSF_MEM_ALLOC
|
||||
pop ebx
|
||||
int 0x40
|
||||
test eax, eax
|
||||
@@ -103,6 +105,8 @@ sort_dir:
|
||||
pop ecx
|
||||
mov ebx, edx
|
||||
sub esp, 304
|
||||
cld
|
||||
align 4
|
||||
.moveloop:
|
||||
mov esi, [ebx]
|
||||
test esi, esi
|
||||
@@ -139,9 +143,9 @@ sort_dir:
|
||||
.done_free:
|
||||
cmp edx, ptr_table
|
||||
jz .done
|
||||
push 68
|
||||
push SF_SYS_MISC
|
||||
pop eax
|
||||
push 13
|
||||
push SSF_MEM_FREE
|
||||
pop ebx
|
||||
mov ecx, edx
|
||||
int 0x40
|
||||
@@ -269,6 +273,7 @@ compare_name_rev:
|
||||
stc
|
||||
ret
|
||||
|
||||
align 4
|
||||
strcmpi:
|
||||
push eax
|
||||
@@:
|
||||
|
||||
+53
-32
@@ -1,6 +1,7 @@
|
||||
;------------------------------------------------------------------------------
|
||||
align 16
|
||||
button:
|
||||
mcall 17
|
||||
mcall SF_GET_BUTTON
|
||||
;--------------------------------------
|
||||
.1:
|
||||
cmp ah,101
|
||||
@@ -46,8 +47,8 @@ button:
|
||||
add eax,retrieved_devices_table+1
|
||||
mov esi,eax ; selected path
|
||||
|
||||
cmp [select_panel_counter],0
|
||||
jne @f
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je @f
|
||||
|
||||
call copy_folder_name
|
||||
jmp left_panel_read_folder
|
||||
@@ -105,22 +106,32 @@ button:
|
||||
cmp ah,157
|
||||
je delete_file
|
||||
|
||||
cmp ah,170
|
||||
je key_insert.1
|
||||
|
||||
cmp ah,171
|
||||
je symbol_a_up.ctrl
|
||||
|
||||
cmp ah,172
|
||||
je NumPad_minus_Up.ctrl
|
||||
|
||||
cmp ah,173
|
||||
je NumPad_sneg_Up.ctrl
|
||||
|
||||
cmp ah, 1
|
||||
jne still
|
||||
;--------------------------------------
|
||||
.exit:
|
||||
mcall -1
|
||||
mcall SF_TERMINATE_PROCESS
|
||||
;---------------------------------------------------------------------
|
||||
reload_dir:
|
||||
cmp [select_panel_counter],0
|
||||
jne @f
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je @f
|
||||
call proc_read_left_folder
|
||||
; mov [left_panel_clear_all],1
|
||||
call draw_left_panel
|
||||
jmp still
|
||||
@@:
|
||||
call proc_read_right_folder
|
||||
; mov [right_panel_clear_all],1
|
||||
call draw_right_panel
|
||||
jmp still
|
||||
;---------------------------------------------------------------------
|
||||
@@ -134,38 +145,43 @@ exit_dir_1:
|
||||
jmp key_28.1
|
||||
;---------------------------------------------------------------------
|
||||
left_panel_read_folder:
|
||||
mov [left_start_draw_cursor_line],0
|
||||
mov [fb_left.start_draw_cursor_line],0
|
||||
jmp proc_read_folder
|
||||
;---------------------------------------------------------------------
|
||||
right_panel_read_folder:
|
||||
mov [right_start_draw_cursor_line],0
|
||||
mov [fb_right.start_draw_cursor_line],0
|
||||
jmp proc_read_folder_1
|
||||
;---------------------------------------------------------------------
|
||||
left_sort_name:
|
||||
xor eax,eax
|
||||
cmp [left_sort_flag],eax
|
||||
je still
|
||||
je left_sort_date.2
|
||||
mov [left_sort_flag],eax
|
||||
jmp left_sort_date.1
|
||||
;---------------------------------------------------------------------
|
||||
left_sort_type:
|
||||
cmp [left_sort_flag],1
|
||||
je still
|
||||
mov [left_sort_flag],1
|
||||
jmp left_sort_date.1
|
||||
;---------------------------------------------------------------------
|
||||
left_sort_size:
|
||||
cmp [left_sort_flag],2
|
||||
je still
|
||||
je left_sort_date.2
|
||||
mov [left_sort_flag],2
|
||||
jmp left_sort_date.1
|
||||
;---------------------------------------------------------------------
|
||||
left_sort_size:
|
||||
cmp [left_sort_flag],6
|
||||
je left_sort_date.2
|
||||
mov [left_sort_flag],6
|
||||
jmp left_sort_date.1
|
||||
;---------------------------------------------------------------------
|
||||
left_sort_date:
|
||||
cmp [left_sort_flag],3
|
||||
je still
|
||||
mov [left_sort_flag],3
|
||||
cmp [left_sort_flag],4
|
||||
je left_sort_date.2
|
||||
mov [left_sort_flag],4
|
||||
jmp left_sort_date.1
|
||||
.2:
|
||||
xor [left_sort_flag],1
|
||||
.1:
|
||||
call draw_left_select_disk_button
|
||||
mov edx,0x80000000+142
|
||||
call clear_sort_buttons
|
||||
call draw_left_sort_button
|
||||
call left_sort_files
|
||||
call draw_left_panel
|
||||
@@ -174,28 +190,33 @@ left_sort_date:
|
||||
right_sort_name:
|
||||
xor eax,eax
|
||||
cmp [right_sort_flag],eax
|
||||
je still
|
||||
je right_sort_date.2
|
||||
mov [right_sort_flag],eax
|
||||
jmp right_sort_date.1
|
||||
;---------------------------------------------------------------------
|
||||
right_sort_type:
|
||||
cmp [right_sort_flag],1
|
||||
je still
|
||||
mov [right_sort_flag],1
|
||||
jmp right_sort_date.1
|
||||
;---------------------------------------------------------------------
|
||||
right_sort_size:
|
||||
cmp [right_sort_flag],2
|
||||
je still
|
||||
je right_sort_date.2
|
||||
mov [right_sort_flag],2
|
||||
jmp right_sort_date.1
|
||||
;---------------------------------------------------------------------
|
||||
right_sort_size:
|
||||
cmp [right_sort_flag],6
|
||||
je right_sort_date.2
|
||||
mov [right_sort_flag],6
|
||||
jmp right_sort_date.1
|
||||
;---------------------------------------------------------------------
|
||||
right_sort_date:
|
||||
cmp [right_sort_flag],3
|
||||
je still
|
||||
mov [right_sort_flag],3
|
||||
cmp [right_sort_flag],4
|
||||
je right_sort_date.2
|
||||
mov [right_sort_flag],4
|
||||
jmp right_sort_date.1
|
||||
.2:
|
||||
xor [right_sort_flag],1
|
||||
.1:
|
||||
call draw_right_select_disk_button
|
||||
mov edx,0x80000000+146
|
||||
call clear_sort_buttons
|
||||
call draw_right_sort_button
|
||||
call right_sort_files
|
||||
call draw_right_panel
|
||||
|
||||
+14
-12
@@ -12,17 +12,17 @@ confirmation_action:
|
||||
call draw_confirmation_menu
|
||||
;--------------------------------------
|
||||
.still:
|
||||
mcall 10
|
||||
cmp eax,1
|
||||
mcall SF_WAIT_EVENT
|
||||
cmp eax,EV_REDRAW
|
||||
je .red_1
|
||||
|
||||
cmp eax,2
|
||||
cmp eax,EV_KEY
|
||||
je key_menu_confirmation
|
||||
|
||||
cmp eax,3
|
||||
cmp eax,EV_BUTTON
|
||||
jne .still
|
||||
|
||||
mcall 17
|
||||
mcall SF_GET_BUTTON
|
||||
cmp ah,161
|
||||
je .no_del
|
||||
|
||||
@@ -32,7 +32,7 @@ confirmation_action:
|
||||
cmp ah,1
|
||||
jne .still
|
||||
|
||||
mcall -1
|
||||
mcall SF_TERMINATE_PROCESS
|
||||
;--------------------------------------
|
||||
.del:
|
||||
mov [work_confirmation_yes],1
|
||||
@@ -47,13 +47,14 @@ draw_confirmation_button:
|
||||
mov ecx,[window_high]
|
||||
mov ebx,[window_width]
|
||||
shr ecx,1
|
||||
sub ecx,[skin_high]
|
||||
shr ebx,1
|
||||
sub ebx,45
|
||||
sub ebx,50
|
||||
shl ecx,16
|
||||
shl ebx,16
|
||||
mov cx,15
|
||||
mov bx,40
|
||||
mcall 8,,,0x40000000+160,0xffffff
|
||||
mcall SF_DEFINE_BUTTON, ,,0x40000000+160,0xffffff
|
||||
add ebx,50 shl 16
|
||||
inc edx
|
||||
mcall
|
||||
@@ -65,12 +66,13 @@ draw_confirmation_menu:
|
||||
shr ecx,1
|
||||
shr ebx,1
|
||||
sub ecx,22
|
||||
sub ebx,60
|
||||
sub ecx,[skin_high]
|
||||
sub ebx,65
|
||||
shl ecx,16
|
||||
shl ebx,16
|
||||
mov cx,44
|
||||
mov bx,120
|
||||
mcall 13,,,0x6060ff
|
||||
mcall SF_DRAW_RECT, ,,0x6060ff
|
||||
push ebx ecx
|
||||
add ebx,15 shl 16
|
||||
add ecx,22 shl 16
|
||||
@@ -104,7 +106,7 @@ draw_confirmation_menu:
|
||||
shr ecx,16
|
||||
mov bx,cx
|
||||
add ebx,7 shl 16+2
|
||||
mcall 4,,0x90ffffff,[confirmation_type]
|
||||
mcall SF_DRAW_TEXT, ,0x90ffffff,[confirmation_type]
|
||||
add ebx,15 shl 16+20
|
||||
mcall ,,,type_yes
|
||||
add ebx,56 shl 16
|
||||
@@ -112,7 +114,7 @@ draw_confirmation_menu:
|
||||
ret
|
||||
;------------------------------------------------------------------------------
|
||||
key_menu_confirmation:
|
||||
mcall 2
|
||||
mcall SF_GET_KEY
|
||||
cmp [extended_key],1
|
||||
je .extended_key
|
||||
|
||||
|
||||
+101
-74
@@ -8,30 +8,30 @@ copy_file_f5:
|
||||
; mov byte [copy_many_files],al
|
||||
mov [current_progress_value],eax
|
||||
mov [current_progress_value_1],eax
|
||||
cmp [select_panel_counter],al
|
||||
jne .right_1
|
||||
cmp [left_marked_counter],eax
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je .right_1
|
||||
cmp [fb_left.marked_counter],eax
|
||||
jne .confirmation_action
|
||||
mov ax,[left_start_draw_cursor_line]
|
||||
mov ebx,10
|
||||
mov ax,[fb_left.start_draw_cursor_line]
|
||||
movzx ebx,[fb_left.line_size_y]
|
||||
div ebx
|
||||
mov ebx,[left_start_draw_line]
|
||||
mov ebx,[fb_left.start_draw_line]
|
||||
add ebx,eax
|
||||
imul ebx,304
|
||||
add ebx,[left_folder_data]
|
||||
add ebx,[fb_left.folder_data]
|
||||
call prepare_data_7
|
||||
call .copy_name
|
||||
jmp editbox_copy_name
|
||||
.right_1:
|
||||
cmp [right_marked_counter],eax
|
||||
cmp [fb_right.marked_counter],eax
|
||||
jne .confirmation_action
|
||||
mov ax,[right_start_draw_cursor_line]
|
||||
mov ebx,10
|
||||
mov ax,[fb_right.start_draw_cursor_line]
|
||||
movzx ebx,[fb_right.line_size_y]
|
||||
div ebx
|
||||
mov ebx,[right_start_draw_line]
|
||||
mov ebx,[fb_right.start_draw_line]
|
||||
add ebx,eax
|
||||
imul ebx,304
|
||||
add ebx,[right_folder_data]
|
||||
add ebx,[fb_right.folder_data]
|
||||
call prepare_data_7
|
||||
call .copy_name
|
||||
jmp editbox_copy_name
|
||||
@@ -65,9 +65,9 @@ copy_file_f5:
|
||||
mov edi, edit1
|
||||
mov ed_size, eax
|
||||
mov ed_pos, eax
|
||||
default_box
|
||||
cmp [select_panel_counter],0
|
||||
jne .right_2
|
||||
and word ed_flags,ed_shift_cl
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je .right_2
|
||||
mov esi,read_folder_name
|
||||
jmp @f
|
||||
.right_2:
|
||||
@@ -78,26 +78,29 @@ default_box
|
||||
ret
|
||||
;-------------------------------------------------------------
|
||||
editbox_copy_name:
|
||||
mcall 66, 1, 0
|
||||
mcall SF_KEYBOARD, SSF_SET_INPUT_MODE, 0
|
||||
jmp .red
|
||||
.red_1:
|
||||
call draw_window
|
||||
.red:
|
||||
call draw_editbox_copy_name
|
||||
.still:
|
||||
mcall 10
|
||||
cmp eax,1
|
||||
mcall SF_WAIT_EVENT
|
||||
cmp eax,EV_REDRAW
|
||||
je .red_1
|
||||
cmp eax,2
|
||||
cmp eax,EV_KEY
|
||||
je .key_copy
|
||||
cmp eax,3
|
||||
cmp eax,EV_BUTTON
|
||||
je .button_copy
|
||||
mouse_edit_box copy_editboxes
|
||||
if USE_STATIC_LIBS eq 0
|
||||
stdcall [edit_box_mouse], copy_editboxes
|
||||
else
|
||||
stdcall edit_box_mouse, copy_editboxes
|
||||
end if
|
||||
jmp .still
|
||||
;-------------------------------------------------------------
|
||||
.button_copy:
|
||||
mov eax,17
|
||||
mcall
|
||||
mcall SF_GET_BUTTON
|
||||
test ah,ah
|
||||
jz .still
|
||||
cmp ah,160
|
||||
@@ -106,7 +109,7 @@ editbox_copy_name:
|
||||
je .exit_without_copy
|
||||
cmp ah,1
|
||||
jne .still
|
||||
mcall -1
|
||||
mcall SF_TERMINATE_PROCESS
|
||||
.exit_with_copy:
|
||||
mov [max_progress_value],1
|
||||
mov [draw_all_progressbar],1
|
||||
@@ -121,18 +124,21 @@ editbox_copy_name:
|
||||
call proc_read_left_folder
|
||||
call proc_read_right_folder
|
||||
.exit_without_copy:
|
||||
mcall 66, 1, 1
|
||||
mcall SF_KEYBOARD, SSF_SET_INPUT_MODE, 1
|
||||
mov [move_file_flag],0
|
||||
jmp red
|
||||
;-------------------------------------------------------------
|
||||
.key_copy:
|
||||
mov eax,2
|
||||
mcall
|
||||
mcall SF_GET_KEY
|
||||
cmp ah,13
|
||||
je .exit_with_copy
|
||||
cmp ah,27
|
||||
je .exit_without_copy
|
||||
key_edit_box copy_editboxes
|
||||
if USE_STATIC_LIBS eq 0
|
||||
stdcall [edit_box_key], copy_editboxes
|
||||
else
|
||||
stdcall edit_box_key, copy_editboxes
|
||||
end if
|
||||
jmp .still
|
||||
;-------------------------------------------------------------
|
||||
draw_editbox_copy_name:
|
||||
@@ -146,7 +152,7 @@ draw_editbox_copy_name:
|
||||
shl ebx,16
|
||||
mov cx,60
|
||||
mov bx,174
|
||||
mcall 13, , ,0x6060ff ;0xff
|
||||
mcall SF_DRAW_RECT, , ,0x6060ff ;0xff
|
||||
pusha
|
||||
shr ebx,16
|
||||
add ebx,10
|
||||
@@ -155,7 +161,11 @@ draw_editbox_copy_name:
|
||||
mov eax,copy_editboxes
|
||||
mov dword [eax+4],ebx
|
||||
mov dword [eax+8],ecx
|
||||
draw_edit_box copy_editboxes
|
||||
if USE_STATIC_LIBS eq 0
|
||||
stdcall [edit_box_draw], copy_editboxes
|
||||
else
|
||||
stdcall edit_box_draw, copy_editboxes
|
||||
end if
|
||||
popa
|
||||
pusha
|
||||
add ebx,70 shl 16
|
||||
@@ -164,8 +174,7 @@ draw_editbox_copy_name:
|
||||
mov bx,40
|
||||
mov esi,0xffffff
|
||||
mov edx,0x40000000+160
|
||||
mov eax,8
|
||||
mcall
|
||||
mcall SF_DEFINE_BUTTON
|
||||
add ebx,50 shl 16
|
||||
inc edx
|
||||
mcall
|
||||
@@ -176,7 +185,7 @@ draw_editbox_copy_name:
|
||||
add ecx,37 shl 16
|
||||
mov bx,40
|
||||
mov cx,15
|
||||
mov edx,0
|
||||
xor edx,edx
|
||||
push ebx ecx
|
||||
sub ecx,1 shl 16
|
||||
sub ebx,1 shl 16
|
||||
@@ -198,12 +207,12 @@ draw_editbox_copy_name:
|
||||
add ebx,60 shl 16+1
|
||||
cmp [move_file_flag],0
|
||||
je .copy
|
||||
mov edx,move_type_1
|
||||
mov edx,sz_Move_file
|
||||
jmp @f
|
||||
.copy:
|
||||
mov edx,copy_type_1
|
||||
mov edx,sz_Copy_file
|
||||
@@:
|
||||
mcall 4, ,0x90ffffff
|
||||
mcall SF_DRAW_TEXT, ,0x90ffffff
|
||||
add ebx,18 shl 16+36
|
||||
mov edx,type_yes
|
||||
mcall
|
||||
@@ -215,31 +224,31 @@ draw_editbox_copy_name:
|
||||
copy_file_1:
|
||||
mov ebx,create_dir_name
|
||||
.1:
|
||||
mov [error_pointer],ebx
|
||||
cmp [select_panel_counter],0
|
||||
je .right_2
|
||||
mov esi,read_folder_name
|
||||
mov [error_pointer],ebx
|
||||
cmp [fb_left.select_panel_counter],1
|
||||
je .right_2
|
||||
mov esi,read_folder_name
|
||||
jmp @f
|
||||
.right_2:
|
||||
mov esi,read_folder_1_name
|
||||
mov esi,read_folder_1_name
|
||||
@@:
|
||||
mov edi,start_parameter
|
||||
call copy_path_1
|
||||
call get_file_size
|
||||
mov edi,start_parameter
|
||||
call copy_path_1
|
||||
call get_file_size
|
||||
test eax,eax
|
||||
jnz .error
|
||||
mov [read_file.Offset],eax
|
||||
mov [add_save_file.Offset],eax
|
||||
mov eax,[appl_memory]
|
||||
xor eax,eax
|
||||
mov [read_file.return],eax
|
||||
mov [save_file.pointer],eax
|
||||
mov [add_save_file.pointer],eax
|
||||
mcall 18,16
|
||||
mcall SF_SYSTEM, SSF_GET_FREE_RAM
|
||||
mov ebx,[file_features_temp_area+32]
|
||||
shr ebx,10
|
||||
shr eax,2
|
||||
cmp ebx,eax
|
||||
jb .copy_for_one
|
||||
jb .copy_for_one
|
||||
shl eax,10
|
||||
mov ecx,eax
|
||||
mov [read_file.size],eax
|
||||
@@ -263,10 +272,16 @@ copy_file_1:
|
||||
popa
|
||||
.continue_5:
|
||||
call progress_bar_copy ;_1
|
||||
call add_application_memory.1
|
||||
add ecx,[tm_size]
|
||||
mcall SF_SYS_MISC, SSF_MEM_REALLOC,, [tmp_memory]
|
||||
mov [tmp_memory],eax
|
||||
mov [tm_size],ecx
|
||||
mov [read_file.return],eax
|
||||
mov [save_file.pointer],eax
|
||||
mov [add_save_file.pointer],eax
|
||||
cmp [copy_many_files],byte 0
|
||||
jne @f
|
||||
inc [current_progress_value]
|
||||
inc [current_progress_value]
|
||||
call progress_bar_copy ;_1
|
||||
@@:
|
||||
call load_file
|
||||
@@ -274,7 +289,7 @@ copy_file_1:
|
||||
jnz .error
|
||||
cmp [copy_many_files],byte 0
|
||||
jne @f
|
||||
inc [current_progress_value_1]
|
||||
inc [current_progress_value_1]
|
||||
call progress_bar_copy ;_1
|
||||
@@:
|
||||
call write_file
|
||||
@@ -302,7 +317,7 @@ copy_file_1:
|
||||
inc [current_progress_value_1]
|
||||
call progress_bar_copy ;_1
|
||||
@@:
|
||||
call add_write_file
|
||||
mcall SF_FILE, add_save_file
|
||||
test eax,eax
|
||||
jnz .error_1
|
||||
jmp .continue
|
||||
@@ -319,66 +334,78 @@ copy_file_1:
|
||||
jnz .error_1
|
||||
inc [current_progress_value_1]
|
||||
call progress_bar_copy
|
||||
call add_write_file
|
||||
mcall SF_FILE, add_save_file
|
||||
test eax,eax
|
||||
jnz .error_1
|
||||
mov ecx,[appl_memory]
|
||||
sub ecx,[save_file.size]
|
||||
call sub_application_memory.1
|
||||
mcall SF_SYS_MISC, SSF_MEM_FREE, [tmp_memory]
|
||||
mov [tmp_memory],0
|
||||
mov [tm_size],0
|
||||
.exit:
|
||||
ret
|
||||
|
||||
|
||||
align 4
|
||||
.copy_for_one:
|
||||
call add_application_memory
|
||||
mov ecx,[file_features_temp_area+32]
|
||||
add ecx,[tm_size]
|
||||
mcall SF_SYS_MISC, SSF_MEM_REALLOC,, [tmp_memory]
|
||||
mov [tmp_memory],eax
|
||||
mov [tm_size],ecx
|
||||
mov [read_file.return],eax
|
||||
mov [save_file.pointer],eax
|
||||
mov [add_save_file.pointer],eax
|
||||
mov eax,[file_features_temp_area+32]
|
||||
mov [read_file.size],eax
|
||||
inc [current_progress_value]
|
||||
inc [current_progress_value]
|
||||
call progress_bar_copy
|
||||
call load_file
|
||||
test eax,eax
|
||||
jnz .error
|
||||
mov [save_file.size],ebx
|
||||
inc [current_progress_value_1]
|
||||
inc [current_progress_value_1]
|
||||
call progress_bar_copy
|
||||
call write_file
|
||||
test eax,eax
|
||||
jnz .error
|
||||
call sub_application_memory
|
||||
mcall SF_SYS_MISC, SSF_MEM_FREE, [tmp_memory]
|
||||
mov [tmp_memory],0
|
||||
mov [tm_size],0
|
||||
ret
|
||||
|
||||
.error:
|
||||
call start_error_window_thread
|
||||
call sub_application_memory
|
||||
mcall SF_SYS_MISC, SSF_MEM_FREE, [tmp_memory]
|
||||
mov [tmp_memory],0
|
||||
mov [tm_size],0
|
||||
add esp,4
|
||||
mov [move_file_flag],0
|
||||
jmp editbox_copy_name.exit_without_copy
|
||||
|
||||
.error_1:
|
||||
call start_error_window_thread
|
||||
mov ecx,[appl_memory]
|
||||
sub ecx,[save_file.size]
|
||||
call sub_application_memory.1
|
||||
mcall SF_SYS_MISC, SSF_MEM_FREE, [tmp_memory]
|
||||
mov [tmp_memory],0
|
||||
mov [tm_size],0
|
||||
add esp,4
|
||||
mov [move_file_flag],0
|
||||
jmp editbox_copy_name.exit_without_copy
|
||||
;-------------------------------------------------------------
|
||||
align 4
|
||||
copy_marked_files:
|
||||
mov [copy_many_files],byte 1
|
||||
mov [draw_all_progressbar],1
|
||||
xor eax,eax
|
||||
mov [current_progress_value],eax
|
||||
mov [current_progress_value_1],eax
|
||||
cmp [select_panel_counter],al
|
||||
jne .right_1
|
||||
mov eax,[left_marked_counter]
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je .right_1
|
||||
mov eax,[fb_left.marked_counter]
|
||||
mov [max_progress_value],eax
|
||||
mov ebp,[left_folder_block]
|
||||
mov ebp,[fb_left.folder_block]
|
||||
.start:
|
||||
mov ebx,ebp
|
||||
dec ebx
|
||||
imul ebx,304
|
||||
add ebx,[left_folder_data]
|
||||
add ebx,[fb_left.folder_data]
|
||||
add ebx,32+40
|
||||
test [ebx-40],byte 0x10
|
||||
jnz @f
|
||||
@@ -409,20 +436,20 @@ copy_marked_files:
|
||||
jnz .start
|
||||
cmp [move_file_flag],0
|
||||
je reload_dir_all
|
||||
mov [left_start_draw_cursor_line],0
|
||||
mov [fb_left.start_draw_cursor_line],0
|
||||
mov [move_file_flag],0
|
||||
mov [copy_many_files],byte 0
|
||||
jmp reload_dir_all
|
||||
|
||||
.right_1:
|
||||
mov eax,[right_marked_counter]
|
||||
mov eax,[fb_right.marked_counter]
|
||||
mov [max_progress_value],eax
|
||||
mov ebp,[right_folder_block]
|
||||
mov ebp,[fb_right.folder_block]
|
||||
.start_1:
|
||||
mov ebx,ebp
|
||||
dec ebx
|
||||
imul ebx,304
|
||||
add ebx,[right_folder_data]
|
||||
add ebx,[fb_right.folder_data]
|
||||
add ebx,32+40
|
||||
test [ebx-40],byte 0x10
|
||||
jnz @f
|
||||
@@ -453,7 +480,7 @@ copy_marked_files:
|
||||
jnz .start_1
|
||||
cmp [move_file_flag],0
|
||||
je reload_dir_all
|
||||
mov [right_start_draw_cursor_line],0
|
||||
mov [fb_right.start_draw_cursor_line],0
|
||||
mov [move_file_flag],0
|
||||
mov [copy_many_files],byte 0
|
||||
jmp reload_dir_all
|
||||
|
||||
@@ -4,28 +4,31 @@ create_directory:
|
||||
mov edi, edit1
|
||||
mov ed_size, dword 0
|
||||
mov ed_pos, dword 0
|
||||
default_box
|
||||
and word ed_flags,ed_shift_cl
|
||||
mov [create_dir_name],byte 0
|
||||
mcall 66, 1, 0
|
||||
mcall SF_KEYBOARD, SSF_SET_INPUT_MODE, 0
|
||||
jmp .red
|
||||
.red_1:
|
||||
call draw_window
|
||||
.red:
|
||||
call draw_create_dir
|
||||
.still:
|
||||
mcall 10
|
||||
cmp eax,1
|
||||
mcall SF_WAIT_EVENT
|
||||
cmp eax,EV_REDRAW
|
||||
je .red_1
|
||||
cmp eax,2
|
||||
cmp eax,EV_KEY
|
||||
je .key_create
|
||||
cmp eax,3
|
||||
cmp eax,EV_BUTTON
|
||||
je .button_create
|
||||
mouse_edit_box create_editboxes
|
||||
jmp .still
|
||||
if USE_STATIC_LIBS eq 0
|
||||
stdcall [edit_box_mouse], create_editboxes
|
||||
else
|
||||
stdcall edit_box_mouse, create_editboxes
|
||||
end if
|
||||
jmp .still
|
||||
;-------------------------------------------------------------
|
||||
.button_create:
|
||||
mov eax,17
|
||||
mcall
|
||||
mcall SF_GET_BUTTON
|
||||
test ah,ah
|
||||
jz .still
|
||||
cmp ah,160
|
||||
@@ -34,27 +37,30 @@ default_box
|
||||
je .exit_without_create
|
||||
cmp ah,1
|
||||
jne .still
|
||||
mcall -1
|
||||
mcall SF_TERMINATE_PROCESS
|
||||
.exit_with_create:
|
||||
call create_directory_1
|
||||
cmp [select_panel_counter],0
|
||||
jne @f
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je @f
|
||||
call proc_read_left_folder
|
||||
jmp .exit_without_create
|
||||
@@:
|
||||
call proc_read_right_folder
|
||||
.exit_without_create:
|
||||
mcall 66, 1, 1
|
||||
mcall SF_KEYBOARD, SSF_SET_INPUT_MODE, 1
|
||||
jmp red
|
||||
;-------------------------------------------------------------
|
||||
.key_create:
|
||||
mov eax,2
|
||||
mcall
|
||||
mcall SF_GET_KEY
|
||||
cmp ah,13
|
||||
je .exit_with_create
|
||||
cmp ah,27
|
||||
je .exit_without_create
|
||||
key_edit_box create_editboxes
|
||||
if USE_STATIC_LIBS eq 0
|
||||
stdcall [edit_box_key], create_editboxes
|
||||
else
|
||||
stdcall edit_box_key, create_editboxes
|
||||
end if
|
||||
jmp .still
|
||||
;-------------------------------------------------------------
|
||||
draw_create_dir:
|
||||
@@ -68,7 +74,7 @@ draw_create_dir:
|
||||
shl ebx,16
|
||||
mov cx,60
|
||||
mov bx,174
|
||||
mcall 13, , ,0x6060ff ;0xff
|
||||
mcall SF_DRAW_RECT, , ,0x6060ff ;0xff
|
||||
pusha
|
||||
shr ebx,16
|
||||
add ebx,10
|
||||
@@ -77,7 +83,11 @@ draw_create_dir:
|
||||
mov eax,create_editboxes
|
||||
mov dword [eax+4],ebx
|
||||
mov dword [eax+8],ecx
|
||||
draw_edit_box create_editboxes
|
||||
if USE_STATIC_LIBS eq 0
|
||||
stdcall [edit_box_draw], create_editboxes
|
||||
else
|
||||
stdcall edit_box_draw, create_editboxes
|
||||
end if
|
||||
popa
|
||||
pusha
|
||||
add ebx,70 shl 16
|
||||
@@ -86,8 +96,7 @@ draw_create_dir:
|
||||
mov bx,40
|
||||
mov esi,0xffffff
|
||||
mov edx,0x40000000+160
|
||||
mov eax,8
|
||||
mcall
|
||||
mcall SF_DEFINE_BUTTON
|
||||
add ebx,50 shl 16
|
||||
inc edx
|
||||
mcall
|
||||
@@ -98,7 +107,7 @@ draw_create_dir:
|
||||
add ecx,37 shl 16
|
||||
mov bx,40
|
||||
mov cx,15
|
||||
mov edx,0
|
||||
xor edx,edx
|
||||
push ebx ecx
|
||||
sub ecx,1 shl 16
|
||||
sub ebx,1 shl 16
|
||||
@@ -118,7 +127,7 @@ draw_create_dir:
|
||||
shr ecx,16
|
||||
mov bx,cx
|
||||
add ebx,30 shl 16+1
|
||||
mcall 4, ,0x90ffffff,create_dir ;[confirmation_type]
|
||||
mcall SF_DRAW_TEXT, ,0x90ffffff,sz_Create_dir ;[confirmation_type]
|
||||
add ebx,48 shl 16+36
|
||||
mov edx,type_yes
|
||||
mcall
|
||||
@@ -129,8 +138,8 @@ draw_create_dir:
|
||||
;-------------------------------------------------------------
|
||||
create_directory_1:
|
||||
mov edx,create_dir_name
|
||||
cmp [select_panel_counter],0
|
||||
jne @f
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je @f
|
||||
mov esi,read_folder_name
|
||||
jmp .start
|
||||
@@:
|
||||
@@ -153,15 +162,11 @@ create_directory_1:
|
||||
stosb
|
||||
test eax,eax
|
||||
jnz @b
|
||||
call create_directory_f70
|
||||
mcall SF_FILE, create_dir_file_data
|
||||
cmp eax,0
|
||||
je @f
|
||||
; mov ebx,0
|
||||
; sub ebx,eax
|
||||
; mov eax,ebx
|
||||
call start_error_window_thread
|
||||
@@:
|
||||
; call create_directory_f70
|
||||
ret
|
||||
;-------------------------------------------------------------
|
||||
clear_file_buffer:
|
||||
|
||||
@@ -4,28 +4,31 @@ create_new_file:
|
||||
mov edi, edit1
|
||||
mov ed_size, dword 0
|
||||
mov ed_pos, dword 0
|
||||
default_box
|
||||
and word ed_flags,ed_shift_cl
|
||||
mov [create_dir_name],byte 0
|
||||
mcall 66, 1, 0
|
||||
mcall SF_KEYBOARD, SSF_SET_INPUT_MODE, 0
|
||||
jmp .red
|
||||
.red_1:
|
||||
call draw_window
|
||||
.red:
|
||||
call draw_create_file
|
||||
.still:
|
||||
mcall 10
|
||||
cmp eax,1
|
||||
mcall SF_WAIT_EVENT
|
||||
cmp eax,EV_REDRAW
|
||||
je .red_1
|
||||
cmp eax,2
|
||||
cmp eax,EV_KEY
|
||||
je .key_create
|
||||
cmp eax,3
|
||||
cmp eax,EV_BUTTON
|
||||
je .button_create
|
||||
mouse_edit_box create_editboxes
|
||||
jmp .still
|
||||
if USE_STATIC_LIBS eq 0
|
||||
stdcall [edit_box_mouse], create_editboxes
|
||||
else
|
||||
stdcall edit_box_mouse, create_editboxes
|
||||
end if
|
||||
jmp .still
|
||||
;-------------------------------------------------------------
|
||||
.button_create:
|
||||
mov eax,17
|
||||
mcall
|
||||
mcall SF_GET_BUTTON
|
||||
test ah,ah
|
||||
jz .still
|
||||
cmp ah,160
|
||||
@@ -34,27 +37,30 @@ default_box
|
||||
je .exit_without_create
|
||||
cmp ah,1
|
||||
jne .still
|
||||
mcall -1
|
||||
mcall SF_TERMINATE_PROCESS
|
||||
.exit_with_create:
|
||||
call create_new_file_1
|
||||
cmp [select_panel_counter],0
|
||||
jne @f
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je @f
|
||||
call proc_read_left_folder
|
||||
jmp .exit_without_create
|
||||
@@:
|
||||
call proc_read_right_folder
|
||||
.exit_without_create:
|
||||
mcall 66, 1, 1
|
||||
mcall SF_KEYBOARD, SSF_SET_INPUT_MODE, 1
|
||||
jmp red
|
||||
;-------------------------------------------------------------
|
||||
.key_create:
|
||||
mov eax,2
|
||||
mcall
|
||||
mcall SF_GET_KEY
|
||||
cmp ah,13
|
||||
je .exit_with_create
|
||||
cmp ah,27
|
||||
je .exit_without_create
|
||||
key_edit_box create_editboxes
|
||||
if USE_STATIC_LIBS eq 0
|
||||
stdcall [edit_box_key], create_editboxes
|
||||
else
|
||||
stdcall edit_box_key, create_editboxes
|
||||
end if
|
||||
jmp .still
|
||||
;-------------------------------------------------------------
|
||||
draw_create_file:
|
||||
@@ -68,7 +74,7 @@ draw_create_file:
|
||||
shl ebx,16
|
||||
mov cx,60
|
||||
mov bx,174
|
||||
mcall 13, , ,0x6060ff ;0xff
|
||||
mcall SF_DRAW_RECT, , ,0x6060ff ;0xff
|
||||
pusha
|
||||
shr ebx,16
|
||||
add ebx,10
|
||||
@@ -77,17 +83,20 @@ draw_create_file:
|
||||
mov eax,create_editboxes
|
||||
mov dword [eax+4],ebx
|
||||
mov dword [eax+8],ecx
|
||||
draw_edit_box create_editboxes
|
||||
popa
|
||||
pusha
|
||||
add ebx,70 shl 16
|
||||
add ecx,37 shl 16
|
||||
if USE_STATIC_LIBS eq 0
|
||||
stdcall [edit_box_draw], create_editboxes
|
||||
else
|
||||
stdcall edit_box_draw, create_editboxes
|
||||
end if
|
||||
popa
|
||||
pusha
|
||||
add ebx,70 shl 16
|
||||
add ecx,37 shl 16
|
||||
mov cx,15
|
||||
mov bx,40
|
||||
mov esi,0xffffff
|
||||
mov edx,0x40000000+160
|
||||
mov eax,8
|
||||
mcall
|
||||
mcall SF_DEFINE_BUTTON
|
||||
add ebx,50 shl 16
|
||||
inc edx
|
||||
mcall
|
||||
@@ -98,7 +107,7 @@ draw_create_file:
|
||||
add ecx,37 shl 16
|
||||
mov bx,40
|
||||
mov cx,15
|
||||
mov edx,0
|
||||
xor edx,edx
|
||||
push ebx ecx
|
||||
sub ecx,1 shl 16
|
||||
sub ebx,1 shl 16
|
||||
@@ -118,7 +127,7 @@ draw_create_file:
|
||||
shr ecx,16
|
||||
mov bx,cx
|
||||
add ebx,30 shl 16+1
|
||||
mcall 4, ,0x90ffffff,create_file ;[confirmation_type]
|
||||
mcall SF_DRAW_TEXT, ,0x90ffffff,sz_Create_file ;[confirmation_type]
|
||||
add ebx,48 shl 16+36
|
||||
mov edx,type_yes
|
||||
mcall
|
||||
@@ -129,8 +138,8 @@ draw_create_file:
|
||||
;-------------------------------------------------------------
|
||||
create_new_file_1:
|
||||
mov edx,create_dir_name
|
||||
cmp [select_panel_counter],0
|
||||
jne @f
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je @f
|
||||
mov esi,read_folder_name
|
||||
jmp .start
|
||||
@@:
|
||||
@@ -156,12 +165,8 @@ create_new_file_1:
|
||||
call write_file
|
||||
cmp eax,0
|
||||
je @f
|
||||
; mov ebx,0
|
||||
; sub ebx,eax
|
||||
; mov eax,ebx
|
||||
call start_error_window_thread
|
||||
@@:
|
||||
; call create_directory_f70
|
||||
ret
|
||||
;-------------------------------------------------------------
|
||||
;clear_file_buffer:
|
||||
|
||||
+24
-69
@@ -1,4 +1,11 @@
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
if USE_STATIC_LIBS eq 0
|
||||
icons_max_size dd 0
|
||||
buttons_file_data:
|
||||
rb ICON_SIZE*numimages
|
||||
end if
|
||||
|
||||
align 4
|
||||
files_counter rd 1
|
||||
directories_counter rd 1
|
||||
@@ -35,53 +42,21 @@ date:
|
||||
open_param rd 1
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
PID rd 1
|
||||
active_process rd 1
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
window_high rd 1
|
||||
window_width rd 1
|
||||
window_status rd 1
|
||||
skin_high rd 1
|
||||
fbutton_width rd 1
|
||||
|
||||
left_panel_x:
|
||||
.size_x rw 1
|
||||
.start_x rw 1
|
||||
|
||||
left_panel_y:
|
||||
.size_y rw 1
|
||||
.start_y rw 1
|
||||
|
||||
right_panel_x:
|
||||
.size_x rw 1
|
||||
.start_x rw 1
|
||||
|
||||
right_panel_y:
|
||||
.size_y rw 1
|
||||
.start_y rw 1
|
||||
|
||||
left_panel_y_correct_size_y rw 1
|
||||
right_panel_y_correct_size_y rw 1
|
||||
|
||||
drawing_panel_folder rb 1 ; 1-left, 2 right
|
||||
window_status rb 1
|
||||
m_lost rb 1
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
mouse_position:
|
||||
.y rw 1
|
||||
.x rw 1
|
||||
mouse_keys rd 1
|
||||
mouse_keys_tick rd 1
|
||||
mouse_scroll_data:
|
||||
.vertical rw 1
|
||||
.horizontal rw 1
|
||||
left_scroll_compens rd 1
|
||||
right_scroll_compens rd 1
|
||||
mouse_keys_delta rb 1
|
||||
mouse_keys_delta_1 rb 1
|
||||
scroll_bar_event rb 1
|
||||
scroll_pointer rb 1
|
||||
scroll_pointer_1 rb 1
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
max_progress_value rd 1
|
||||
@@ -95,39 +70,15 @@ copy_many_files:
|
||||
rb 1
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
max_panel_line rd 1
|
||||
temp_panel_end rd 1
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
left_start_draw_line rd 1
|
||||
left_folder_block rd 1
|
||||
left_start_draw_cursor_line rw 1
|
||||
left_folder_block_1 rd 1
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
right_start_draw_line rd 1
|
||||
right_folder_block rd 1
|
||||
right_start_draw_cursor_line rw 1
|
||||
right_folder_block_1 rd 1
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
sort_counter rd 1
|
||||
sorting_low_limit rd 1
|
||||
sorting_high_limit rd 1
|
||||
dir_temp_counter rd 1
|
||||
dir_temp_counter_1 rd 1
|
||||
draw_scroll_character rb 1
|
||||
nesting_direction rb 1
|
||||
dir_or_file rb 1
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
left_marked_counter rd 1
|
||||
right_marked_counter rd 1
|
||||
confirmation_type rd 1
|
||||
recursive_pointer rd 1
|
||||
marked_file rb 1
|
||||
marked_action rb 1
|
||||
mark_action_counter rb 1
|
||||
work_confirmation rb 1
|
||||
work_confirmation_yes rb 1
|
||||
delete_marked_yes rb 1
|
||||
@@ -137,8 +88,6 @@ move_file_flag rb 1
|
||||
align 4
|
||||
start_draw_menu_cursor_line rd 1
|
||||
search_pre_folder rb 1
|
||||
not_clear_lines rb 1
|
||||
select_panel_counter rb 1
|
||||
extended_key rb 1
|
||||
press_enter_menu rb 1
|
||||
close_menu rb 1
|
||||
@@ -150,19 +99,17 @@ file_name_length rd 1
|
||||
temp_counter_dword rd 1
|
||||
error_pointer rd 1
|
||||
file_system_error rd 1
|
||||
end_tag rd 1
|
||||
icons_end_tag rd 1
|
||||
exit_to_dir rb 1
|
||||
exit_dir rb 1
|
||||
use_patch rb 1
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
appl_memory rd 1
|
||||
appl_memory_old rd 1
|
||||
buttons_img_start rd 1
|
||||
ini_file_start rd 1
|
||||
left_folder_data rd 1
|
||||
right_folder_data rd 1
|
||||
ini_size rd 1
|
||||
lfd_size rd 1
|
||||
rfd_size rd 1
|
||||
tmp_memory rd 1
|
||||
tm_size rd 1
|
||||
;---------------------------------------------------------------------
|
||||
shift_flag rb 1
|
||||
ctrl_flag rb 1
|
||||
@@ -198,9 +145,13 @@ align 4
|
||||
retrieved_devices_table:
|
||||
rb 10*100
|
||||
;---------------------------------------------------------------------
|
||||
converted_ini_buffer:
|
||||
rb 8192
|
||||
ini_src_end:
|
||||
rd 1
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
procinfo:
|
||||
rb 1024
|
||||
procinfo process_information
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
type_name:
|
||||
@@ -221,6 +172,8 @@ delete_dir_data:
|
||||
align 4
|
||||
extension_temp_storage:
|
||||
rb 256
|
||||
name_temp_area rb 256
|
||||
keymap_area rb 128
|
||||
;---------------------------------------------------------------------
|
||||
;stack
|
||||
align 4
|
||||
@@ -267,3 +220,5 @@ align 4
|
||||
read_folder_3_name:
|
||||
rb 64
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
sc system_colors
|
||||
+71
-77
@@ -1,8 +1,9 @@
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
delete_file:
|
||||
; call progress_bar
|
||||
; jmp still
|
||||
mov [confirmation_type],delete_type
|
||||
mov [confirmation_type],sz_Delete_files
|
||||
call confirmation_action
|
||||
cmp [work_confirmation_yes],1
|
||||
jne red ;reload_dir
|
||||
@@ -16,30 +17,30 @@ delete_file:
|
||||
|
||||
call delete_marked_files
|
||||
cmp [delete_marked_yes],1
|
||||
je .end_1 ;reload_dir_all
|
||||
je .end_1 ;reload_dir_all
|
||||
|
||||
xor eax,eax
|
||||
xor edx,edx
|
||||
cmp [select_panel_counter],0
|
||||
jne .right_1
|
||||
mov ax,[left_start_draw_cursor_line]
|
||||
mov ebx,10
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je .right_1
|
||||
mov ax,[fb_left.start_draw_cursor_line]
|
||||
movzx ebx,[fb_left.line_size_y]
|
||||
div ebx
|
||||
mov ebx,[left_start_draw_line]
|
||||
mov ebx,[fb_left.start_draw_line]
|
||||
add ebx,eax
|
||||
imul ebx,304
|
||||
add ebx,[left_folder_data]
|
||||
add ebx,[fb_left.folder_data]
|
||||
call prepare_data_7
|
||||
mov esi,read_folder_name ;read_folder.name
|
||||
jmp .end
|
||||
.right_1:
|
||||
mov ax,[right_start_draw_cursor_line]
|
||||
mov ebx,10
|
||||
mov ax,[fb_right.start_draw_cursor_line]
|
||||
movzx ebx,[fb_right.line_size_y]
|
||||
div ebx
|
||||
mov ebx,[right_start_draw_line]
|
||||
mov ebx,[fb_right.start_draw_line]
|
||||
add ebx,eax
|
||||
imul ebx,304
|
||||
add ebx,[right_folder_data]
|
||||
add ebx,[fb_right.folder_data]
|
||||
call prepare_data_7
|
||||
mov esi,read_folder_1_name ;read_folder_1.name
|
||||
.end:
|
||||
@@ -47,7 +48,7 @@ delete_file:
|
||||
mov edi,file_name ;delete_file_data.name
|
||||
call copy_path_1
|
||||
test [ebx-40],byte 0x10
|
||||
jz @f
|
||||
jz @f
|
||||
push eax ebx
|
||||
xor eax,eax
|
||||
mov [current_progress_value],eax
|
||||
@@ -63,14 +64,15 @@ delete_file:
|
||||
call start_error_window_thread
|
||||
jmp reload_dir_all
|
||||
.end_1:
|
||||
cmp [select_panel_counter],0
|
||||
jne .right
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je .right
|
||||
call proc_read_left_folder
|
||||
jmp red
|
||||
.right:
|
||||
call proc_read_right_folder
|
||||
jmp red
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
delete_marked_files:
|
||||
mov eax,[directories_counter]
|
||||
add eax,[files_counter]
|
||||
@@ -81,16 +83,14 @@ delete_marked_files:
|
||||
mov [delete_marked_yes],al
|
||||
mov [draw_all_progressbar],1
|
||||
|
||||
cmp [select_panel_counter],al
|
||||
jne .right_1
|
||||
; mov eax,[left_marked_counter]
|
||||
; mov [max_progress_value],eax
|
||||
mov ebp,[left_folder_block]
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je .right_1
|
||||
mov ebp,[fb_left.folder_block]
|
||||
.start:
|
||||
mov ebx,ebp
|
||||
dec ebx
|
||||
imul ebx,304
|
||||
add ebx,[left_folder_data]
|
||||
add ebx,[fb_left.folder_data]
|
||||
add ebx,32+40
|
||||
cmp [ebx+299-40],byte 0
|
||||
je @f
|
||||
@@ -108,18 +108,16 @@ delete_marked_files:
|
||||
jnz .start
|
||||
cmp [delete_marked_yes],0
|
||||
je @f
|
||||
mov [left_start_draw_cursor_line],0
|
||||
mov [fb_left.start_draw_cursor_line],0
|
||||
@@:
|
||||
ret
|
||||
.right_1:
|
||||
; mov eax,[right_marked_counter]
|
||||
; mov [max_progress_value],eax
|
||||
mov ebp,[right_folder_block]
|
||||
mov ebp,[fb_right.folder_block]
|
||||
.start_1:
|
||||
mov ebx,ebp
|
||||
dec ebx
|
||||
imul ebx,304
|
||||
add ebx,[right_folder_data]
|
||||
add ebx,[fb_right.folder_data]
|
||||
add ebx,32+40
|
||||
cmp [ebx+299-40],byte 0
|
||||
je @f
|
||||
@@ -137,10 +135,11 @@ delete_marked_files:
|
||||
jnz .start_1
|
||||
cmp [delete_marked_yes],0
|
||||
je @f
|
||||
mov [right_start_draw_cursor_line],0
|
||||
mov [fb_right.start_draw_cursor_line],0
|
||||
@@:
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
prepare_data_6:
|
||||
mov [error_pointer],ebx
|
||||
mov edi,file_name ;delete_file_data.name
|
||||
@@ -162,6 +161,7 @@ prepare_data_6:
|
||||
.continue:
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
prepare_data_7:
|
||||
add ebx,32+40
|
||||
cmp [ebx],word '..'
|
||||
@@ -173,88 +173,82 @@ prepare_data_7:
|
||||
.continue:
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
delete_dir:
|
||||
pusha
|
||||
mov [recursive_pointer],0
|
||||
mov eax,[appl_memory]
|
||||
mov [appl_memory_old],eax
|
||||
.1:
|
||||
mov [read_delete_dir_data.size],0
|
||||
mov [read_delete_dir_data.return],delete_dir_data
|
||||
call read_delete_dir
|
||||
test eax,eax
|
||||
jz @f
|
||||
mov [read_delete_dir_data.size],0
|
||||
mov [read_delete_dir_data.return],delete_dir_data
|
||||
mcall SF_FILE, read_delete_dir_data
|
||||
test eax,eax
|
||||
jz @f
|
||||
mov [error_pointer],file_name
|
||||
call start_error_window_thread
|
||||
call start_error_window_thread
|
||||
popa
|
||||
add esp,8+4
|
||||
jmp still
|
||||
add esp,8+4
|
||||
jmp still
|
||||
@@:
|
||||
mov eax,[delete_dir_data+8]
|
||||
test eax,eax
|
||||
jnz @f
|
||||
inc [current_progress_value]
|
||||
call progress_bar_delete
|
||||
call del_file
|
||||
test eax,eax
|
||||
jz .end
|
||||
mov eax,[delete_dir_data+8]
|
||||
test eax,eax
|
||||
jnz @f
|
||||
inc [current_progress_value]
|
||||
call progress_bar_delete
|
||||
call del_file
|
||||
test eax,eax
|
||||
jz .end
|
||||
mov [error_pointer],file_name
|
||||
call start_error_window_thread
|
||||
call start_error_window_thread
|
||||
popa
|
||||
add esp,8+4
|
||||
jmp still
|
||||
add esp,8+4
|
||||
jmp still
|
||||
@@:
|
||||
imul eax,304
|
||||
add eax,32
|
||||
mov ebx,eax
|
||||
add ebx,[appl_memory_old]
|
||||
cmp ebx,[appl_memory]
|
||||
jbe @f
|
||||
mov ecx,[appl_memory]
|
||||
mov ecx,ebx
|
||||
mov [appl_memory],ecx
|
||||
mcall 64,1
|
||||
@@:
|
||||
mov eax,[delete_dir_data+8]
|
||||
mov [read_delete_dir_data.size],eax
|
||||
mov eax,[appl_memory_old]
|
||||
mov [read_delete_dir_data.return],eax
|
||||
call read_delete_dir
|
||||
test eax,eax
|
||||
jz @f
|
||||
mov ecx,eax
|
||||
add ecx,[tm_size]
|
||||
mcall SF_SYS_MISC, SSF_MEM_REALLOC,, [tmp_memory]
|
||||
mov [tmp_memory],eax
|
||||
mov [tm_size],ecx
|
||||
|
||||
mov [read_delete_dir_data.return],eax
|
||||
mov eax,[delete_dir_data+8]
|
||||
mov [read_delete_dir_data.size],eax
|
||||
mcall SF_FILE, read_delete_dir_data
|
||||
test eax,eax
|
||||
jz @f
|
||||
mov [error_pointer],file_name
|
||||
call start_error_window_thread
|
||||
call start_error_window_thread
|
||||
popa
|
||||
add esp,8+4
|
||||
jmp still
|
||||
add esp,8+4
|
||||
jmp still
|
||||
@@:
|
||||
call delete_dir_1
|
||||
jc .1
|
||||
call delete_dir_1
|
||||
jc .1
|
||||
.end:
|
||||
call return_delete_path
|
||||
dec [recursive_pointer]
|
||||
cmp [recursive_pointer],0
|
||||
jge .1
|
||||
@@:
|
||||
mov ecx,[appl_memory_old]
|
||||
cmp [appl_memory],ecx
|
||||
je @f
|
||||
mov [appl_memory],ecx
|
||||
mcall 64,1
|
||||
@@:
|
||||
mcall SF_SYS_MISC, SSF_MEM_FREE, [tmp_memory]
|
||||
mov [tmp_memory],0
|
||||
mov [tm_size],0
|
||||
popa
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
delete_dir_1:
|
||||
mov ebp,[appl_memory_old]
|
||||
mov ebp,[tmp_memory]
|
||||
mov ebp,[ebp+8]
|
||||
align 4
|
||||
.start:
|
||||
test ebp,ebp
|
||||
jz .continue_4
|
||||
mov ebx,ebp
|
||||
dec ebx
|
||||
imul ebx,304
|
||||
add ebx,[appl_memory_old]
|
||||
add ebx,[tmp_memory]
|
||||
add ebx,32+40
|
||||
cmp [ebx],byte '.'
|
||||
jne @f
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
device_detect_f70:
|
||||
mov ax,[select_disk_char]
|
||||
mov [read_folder_2_name],ax
|
||||
mov [read_folder_3_name],ax
|
||||
; mov eax,left_folder_data_1
|
||||
; mov [read_folder_2.return],eax
|
||||
mcall 70, read_folder_2
|
||||
mcall SF_FILE, read_folder_2
|
||||
test eax,eax
|
||||
jz @f
|
||||
cmp eax,6
|
||||
@@ -21,7 +22,7 @@ device_detect_f70:
|
||||
call copy_folder_name_3
|
||||
; mov eax,right_folder_data_1
|
||||
; mov [read_folder_3.return],eax
|
||||
mcall 70, read_folder_3
|
||||
mcall SF_FILE, read_folder_3
|
||||
test eax,eax
|
||||
jz @f
|
||||
cmp eax,6
|
||||
@@ -56,7 +57,8 @@ device_detect_f70:
|
||||
cmp eax,[left_folder_block_1]
|
||||
jb .start_temp_counter_1
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
select_starting_directories:
|
||||
mov esi,retrieved_devices_table+1
|
||||
call copy_folder_name
|
||||
@@ -84,6 +86,7 @@ select_starting_directories:
|
||||
; mov [read_folder_1_name+6],byte 0
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
proc_copy_patch:
|
||||
@@:
|
||||
cld
|
||||
|
||||
+233
-759
File diff suppressed because it is too large.
Load diff
@@ -1,10 +1,11 @@
|
||||
;------------------------------------------------------------------------------
|
||||
align 4
|
||||
draw_device_button:
|
||||
call device_detect_f70
|
||||
mov edi,[retrieved_devices_table_counter]
|
||||
mov edx,120
|
||||
mov bx,[left_panel_x.start_x]
|
||||
mov cx,[left_panel_y.start_y]
|
||||
mov bx,[fb_left.start_x]
|
||||
mov cx,[fb_left.start_y]
|
||||
shl ebx,16
|
||||
sub cx,30
|
||||
shl ecx,16
|
||||
@@ -22,12 +23,11 @@ draw_device_button:
|
||||
jnz @b
|
||||
|
||||
sub esi,ebp
|
||||
lea esi,[esi*3]
|
||||
shl esi,1
|
||||
shl esi,3
|
||||
mov bx,si
|
||||
pop esi
|
||||
|
||||
mcall 8
|
||||
mcall SF_DEFINE_BUTTON
|
||||
|
||||
pusha
|
||||
mov eax,ebx
|
||||
@@ -36,7 +36,7 @@ draw_device_button:
|
||||
add ebx,eax
|
||||
mov bx,2
|
||||
inc ecx
|
||||
mcall 13,,,0xcccccc
|
||||
mcall SF_DRAW_RECT, ,,[sc.work]
|
||||
popa
|
||||
|
||||
pusha
|
||||
@@ -44,8 +44,8 @@ draw_device_button:
|
||||
inc edx
|
||||
shr ecx,16
|
||||
mov bx,cx
|
||||
add ebx,4 shl 16
|
||||
mcall 4,,0x90000000
|
||||
add ebx,8 shl 16
|
||||
mcall SF_DRAW_TEXT, ,0x90000000
|
||||
sub ebx,1 shl 16 + 1
|
||||
mcall ,,0x90ffffff
|
||||
popa
|
||||
@@ -60,17 +60,16 @@ draw_device_button:
|
||||
dec edi
|
||||
jnz .loop
|
||||
|
||||
xor eax,eax
|
||||
mov ax,[right_panel_x.start_x]
|
||||
add ax,[right_panel_x.size_x]
|
||||
movzx eax,[fb_right.start_x]
|
||||
add ax,[fb_right.size_x]
|
||||
add ax,[sb_right.x_size]
|
||||
ror ebx,16
|
||||
sub ax,bx
|
||||
rol ebx,16
|
||||
inc ax
|
||||
mov bx,ax
|
||||
|
||||
add ecx,1
|
||||
add ebx,1
|
||||
mcall 13,,,0xcccccc
|
||||
mcall SF_DRAW_RECT, ,,[sc.work]
|
||||
ret
|
||||
;------------------------------------------------------------------------------
|
||||
@@ -1,278 +0,0 @@
|
||||
; SEE YOU File FAQ.txt and HISTORY. Good Like!
|
||||
;;;;;;;;;;;;;;;;;;
|
||||
include 'editbox.mac' ;макрос который должен облегчить жизнь :) специально для editbox
|
||||
;;;;;;;;;;;;;;;;;;
|
||||
macro use_edit_box procinfo,scr_h,scr_w
|
||||
{
|
||||
edit_box:
|
||||
ed_width equ [edi] ;ширина компонента
|
||||
ed_left equ [edi+4] ;положение по оси х
|
||||
ed_top equ [edi+8] ;положение по оси у
|
||||
ed_color equ [edi+12] ;цвет фона компонента
|
||||
shift_color equ [edi+16] ;=0x6a9480
|
||||
ed_focus_border_color equ [edi+20] ;цвет рамки компонента
|
||||
ed_blur_border_color equ [edi+24] ;цвет не активного компонента
|
||||
ed_text_color equ [edi+28] ;цвет текста
|
||||
ed_max equ [edi+32] ;кол-во символов которые можно максимально ввести
|
||||
ed_text equ [edi+36] ;указатель на буфер
|
||||
ed_flags equ [edi+40] ;флаги
|
||||
ed_size equ [edi+42] ;кол-во символов
|
||||
ed_pos equ [edi+46] ;позиция курсора
|
||||
ed_offset equ [edi+50] ;смещение
|
||||
cl_curs_x equ [edi+54] ;предыдущее координата курсора по х
|
||||
cl_curs_y equ [edi+58] ;предыдущее координата курсора по у
|
||||
ed_shift_pos equ [edi+62] ;положение курсора
|
||||
ed_shift_pos_old equ [edi+66] ;старое положение курсора
|
||||
;==========================================================
|
||||
;=== процедура прорисовки =================================
|
||||
;==========================================================
|
||||
.draw:
|
||||
pusha
|
||||
;--- рисуем рамку ---
|
||||
call .draw_border ; Функция стабильна
|
||||
.draw_bg_cursor_text:
|
||||
;--- изменяем смещение, если надо ---
|
||||
call .check_offset ;вычисление позиции курсора стабильна
|
||||
;--- рисуем внутреннюю область ---
|
||||
call .draw_bg ;нарисовать прямоугольник рабочей области
|
||||
;---- рисуем выделение, по shift если есть
|
||||
call .draw_shift
|
||||
.draw_cursor_text:
|
||||
;--- рисуем курсор ---
|
||||
;--- может его не надо рисовать ----
|
||||
test word ed_flags,ed_focus
|
||||
je @f
|
||||
call .draw_cursor
|
||||
@@:
|
||||
call .draw_text
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;Общий выход из editbox для всех функций и пост обработчиков
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
.editbox_exit:
|
||||
edit_ex
|
||||
;==========================================================
|
||||
;=== обработка клавиатуры =================================
|
||||
;==========================================================
|
||||
.key:
|
||||
pusha
|
||||
test word ed_flags,ed_focus ; если не в фокусе, выходим
|
||||
je .editbox_exit
|
||||
test word ed_flags,ed_mouse_on
|
||||
jne .editbox_exit
|
||||
|
||||
;Проверка нажат shift ?
|
||||
call .check_shift
|
||||
;----------------------------------------------------------
|
||||
;--- проверяем, что нажато --------------------------------
|
||||
;----------------------------------------------------------
|
||||
use_key_process backspase,delete,left,right,home,end,insert
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;Заглушка на обработку клавиш вверх и вниз т.е. при обнаружении этих кодов происходит выход из обработчика
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
use_key_no_process up,down,esc
|
||||
;--- нажата другая клавиша ---
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;Проверка установлен ли флаг при котором нужно выводить только цифры в нужном боксе если такойнеобходимости нет нужно закоментировать макрос
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
use_key_figures_only
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;проверка на shift был ли нажат
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
are_key_shift_press
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; проверяем, находится ли курсор в конце + дальнейшая обработка
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
are_key_cur_end
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;Обработка клавиш insert,delete.backspase,home,end,left,right
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
use_work_key
|
||||
;==========================================================
|
||||
;=== обработка мыши =======================================
|
||||
;==========================================================
|
||||
.mouse:
|
||||
pusha
|
||||
;debug
|
||||
;----------------------------------------------------------
|
||||
;--- получаем состояние кнопок мыши -----------------------
|
||||
;----------------------------------------------------------
|
||||
mcall 37,2
|
||||
;----------------------------------------------------------
|
||||
;--- проверяем состояние ----------------------------------
|
||||
;----------------------------------------------------------
|
||||
test eax,1
|
||||
jnz .mouse_left_button
|
||||
and word ed_flags,ed_mouse_on_off
|
||||
xor ebx,ebx
|
||||
mov dword [mouse_flag],ebx
|
||||
jmp .editbox_exit
|
||||
.mouse_left_button:
|
||||
;----------------------------------------------------------
|
||||
;--- блокировка от фокусировки в других боксах при попадании на них курсора
|
||||
;----------------------------------------------------------
|
||||
mov eax,dword [mouse_flag]
|
||||
test eax,eax
|
||||
jz @f
|
||||
cmp eax,edi
|
||||
je @f
|
||||
jmp ._blur
|
||||
;----------------------------------------------------------
|
||||
;--- получаем координаты мыши относительно 0 т.е всей области экрана
|
||||
;----------------------------------------------------------
|
||||
@@: mcall 37,0
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;Функция обработки мышки получение координат и проверка их + выделения
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
use_work_mause scr_h,scr_w
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;Общие функции обработки
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
use_general_func
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;Функции для работы с key
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
use_key_func
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;Функции для работы с mouse
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
use_mouse_func scr_w
|
||||
}
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;Bit mask from editbox
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
ed_figure_only= 1000000000000000b ;одни символы
|
||||
ed_always_focus= 100000000000000b
|
||||
ed_focus= 10b ;фокус приложения
|
||||
ed_shift_on= 1000b ;если не установлен -значит впервые нажат shift,если был установлен, значит мы уже что - то делали удерживая shift
|
||||
ed_shift_on_off=1111111111110111b
|
||||
ed_shift= 100b ;включается при нажатии на shift т.е. если нажимаю
|
||||
ed_shift_off= 1111111111111011b
|
||||
ed_shift_bac= 10000b ;бит для очистки выделеного shift т.е. при установке говорит что есть выделение
|
||||
ed_shift_bac_cl=1111111111101111b ;очистка при удалении выделения
|
||||
ed_shift_cl= 1111111111100011b
|
||||
ed_shift_mcl= 1111111111111011b
|
||||
ed_left_fl= 100000b
|
||||
ed_right_fl= 1111111111011111b
|
||||
ed_offset_fl= 1000000b
|
||||
ed_offset_cl= 1111111110111111b
|
||||
ed_insert= 10000000b
|
||||
ed_insert_cl= 1111111101111111b
|
||||
ed_mouse_on = 100000000b
|
||||
ed_mous_adn_b= 100011000b
|
||||
ed_mouse_on_off=1111111011111111b
|
||||
ed_height=14 ; высота
|
||||
macro draw_edit_boxes start,_end,use_f9,procinfo
|
||||
{
|
||||
if use_f9 eq
|
||||
else
|
||||
mcall 9,procinfo,-1
|
||||
end if
|
||||
mov edi,start
|
||||
mov ecx,((_end-start)/ed_struc_size)
|
||||
@@:
|
||||
call edit_box.draw
|
||||
add edi,ed_struc_size
|
||||
loop @b
|
||||
}
|
||||
|
||||
macro mouse_edit_boxes start,_end
|
||||
{
|
||||
mov edi,start
|
||||
mov ecx,((_end-start)/ed_struc_size)
|
||||
@@:
|
||||
call edit_box.mouse
|
||||
add edi,ed_struc_size
|
||||
loop @b
|
||||
}
|
||||
|
||||
macro key_edit_boxes start,end
|
||||
{
|
||||
mov edi,start
|
||||
mov ecx,((end-start)/ed_struc_size)
|
||||
@@:
|
||||
call edit_box.key
|
||||
add edi,ed_struc_size
|
||||
loop @b
|
||||
}
|
||||
ed_struc_size=70
|
||||
struc edit_box width,left,top,color,shift_color,focus_border_color,\
|
||||
blur_border_color,text_color,max,text,flags,size,pos
|
||||
{
|
||||
.width dd width
|
||||
.left dd left
|
||||
.top dd top
|
||||
.color dd color
|
||||
.shift_color dd shift_color
|
||||
.focus_border_color dd focus_border_color
|
||||
.blur_border_color dd blur_border_color
|
||||
.text_color dd text_color
|
||||
.max dd max
|
||||
.text dd text
|
||||
.flags dw flags+0
|
||||
.size dd size+0
|
||||
.pos dd pos+0
|
||||
.offset dd 0
|
||||
.cl_curs_x dd 0
|
||||
.cl_curs_y dd 0
|
||||
.shift dd 0
|
||||
.shift_old dd 0
|
||||
}
|
||||
|
||||
|
||||
macro edit_boxes_set_sys_color start,end,color_table
|
||||
{
|
||||
mov edi,start
|
||||
mov ecx,((end-start)/ed_struc_size)
|
||||
mov esi,color_table
|
||||
@@:
|
||||
mov eax,[esi+36]
|
||||
mov ebx,[esi+20]
|
||||
mov ed_focus_border_color,eax
|
||||
shr bh,1
|
||||
shr bl,1
|
||||
shr ah,1
|
||||
shr al,1
|
||||
add ah,bh
|
||||
add al,bl
|
||||
ror eax,16
|
||||
ror ebx,16
|
||||
shr bl,1
|
||||
shr al,1
|
||||
add al,bl
|
||||
ror eax,16
|
||||
mov ed_blur_border_color,eax
|
||||
add edi,ed_struc_size
|
||||
loop @b
|
||||
}
|
||||
|
||||
macro draw_edit_box ed_ptr,use_f9,procinfo
|
||||
{
|
||||
if use_f9 eq
|
||||
else
|
||||
mcall 9,procinfo,-1
|
||||
end if
|
||||
mov edi,ed_ptr
|
||||
call edit_box.draw
|
||||
}
|
||||
|
||||
macro mouse_edit_box ed_ptr
|
||||
{
|
||||
mov edi,ed_ptr
|
||||
call edit_box.mouse
|
||||
}
|
||||
|
||||
macro key_edit_box ed_ptr
|
||||
{
|
||||
mov edi,ed_ptr
|
||||
call edit_box.key
|
||||
}
|
||||
macro default_box ed_ptr
|
||||
{
|
||||
pusha
|
||||
; xor eax,eax
|
||||
; mov ed_shift_pos,eax
|
||||
; mov ed_shift_pos_old,eax
|
||||
and word ed_flags,ed_shift_cl
|
||||
; mov ed_offset,eax
|
||||
popa
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -4,36 +4,33 @@ read_folder_error:
|
||||
read_folder_1_error:
|
||||
mov [error_pointer],read_folder_1_name ;read_folder_1.name
|
||||
jmp error_window
|
||||
initiation_error:
|
||||
mov [error_pointer],ini_file_name
|
||||
jmp error_window
|
||||
error_window:
|
||||
mov [file_system_error],eax
|
||||
.red:
|
||||
call draw_error_window
|
||||
.still:
|
||||
mcall 10
|
||||
cmp eax,1
|
||||
mcall SF_WAIT_EVENT
|
||||
cmp eax,EV_REDRAW
|
||||
je .red
|
||||
cmp eax,3
|
||||
cmp eax,EV_BUTTON
|
||||
je .button
|
||||
jmp .still
|
||||
.button:
|
||||
mcall -1
|
||||
mcall SF_TERMINATE_PROCESS
|
||||
jmp .still
|
||||
;---------------------------------------------------------------------
|
||||
draw_error_window:
|
||||
mcall 12, 1
|
||||
mcall 0,[error_window_x] ,[error_window_y], 0x03D22F36
|
||||
mcall 4,<10,30>,0x90ffffff,[error_pointer]
|
||||
mcall 4,<10,50>, ,error_type
|
||||
mcall 47,0xa0000,[file_system_error],<148,50>,0x10ffffff
|
||||
mcall 12, 2
|
||||
mcall SF_REDRAW, SSF_BEGIN_DRAW
|
||||
mcall SF_CREATE_WINDOW, [error_window_x] ,[error_window_y], 0x03D22F36
|
||||
mcall SF_DRAW_TEXT, <10,30>,0x90ffffff,[error_pointer]
|
||||
mcall SF_DRAW_TEXT, <10,50>, ,error_type
|
||||
mcall SF_DRAW_NUMBER, 0x800a0000,[file_system_error],<154,50>,0x10ffffff
|
||||
mcall SF_REDRAW, SSF_END_DRAW
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
start_error_window_thread:
|
||||
mov [file_system_error],eax
|
||||
mcall 9, procinfo, -1
|
||||
mcall SF_THREAD_INFO, procinfo, -1
|
||||
mov eax,[ebx+46]
|
||||
shr eax,1
|
||||
add eax,[ebx+38]
|
||||
@@ -44,7 +41,7 @@ start_error_window_thread:
|
||||
add eax,[ebx+34]
|
||||
sub eax,ERR_WINW/2
|
||||
mov [error_window_x+2],ax
|
||||
mcall 51,1,thread_start,thread_stack
|
||||
mcall SF_THREAD_CONTROL, SSF_CREATE_THREAD,thread_start,thread_stack
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
thread_start:
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
align 4
|
||||
files_information:
|
||||
xor eax,eax
|
||||
mov [alt_flag],al
|
||||
@@ -10,23 +11,23 @@ files_information:
|
||||
jmp still
|
||||
;------------------------------------------------------------------------------
|
||||
start_files_information_thread:
|
||||
mcall 9,procinfo,-1
|
||||
mov eax,[ebx+46]
|
||||
mcall SF_THREAD_INFO, procinfo,-1
|
||||
mov eax,[procinfo.box.height]
|
||||
shr eax,1
|
||||
add eax,[ebx+38]
|
||||
add eax,[procinfo.box.top]
|
||||
sub eax,INF_WINH/2
|
||||
mov [files_information_window_y+2],ax
|
||||
mov eax,[ebx+42]
|
||||
mov eax,[procinfo.box.width]
|
||||
shr eax,1
|
||||
add eax,[ebx+34]
|
||||
add eax,[procinfo.box.left]
|
||||
sub eax,INF_WINW/2
|
||||
mov [files_information_window_x+2],ax
|
||||
mcall 51,1,thread_files_information_start,thread_stack
|
||||
mcall SF_THREAD_CONTROL, SSF_CREATE_THREAD,thread_files_information_start,thread_stack
|
||||
ret
|
||||
;------------------------------------------------------------------------------
|
||||
draw_files_information_window:
|
||||
mcall 12,1
|
||||
mcall 0,[files_information_window_x],[files_information_window_y],0x33ffffcc,,infowin_title
|
||||
mcall SF_REDRAW, SSF_BEGIN_DRAW
|
||||
mcall SF_CREATE_WINDOW, [files_information_window_x],[files_information_window_y],0x33ffffcc,,infowin_title
|
||||
mov edx,INF_DATAX shl 16+INF_DATAY+INF_LINEH
|
||||
mov ebx,0x800a0000
|
||||
mov esi,0x10000000
|
||||
@@ -40,7 +41,7 @@ draw_files_information_window:
|
||||
;--------------------------------------
|
||||
.continue_4:
|
||||
; show files counter
|
||||
mcall 47,,[files_counter]
|
||||
mcall SF_DRAW_NUMBER, ,[files_counter]
|
||||
;--------------------------------------
|
||||
@@:
|
||||
cmp [inf_marked_yes],1
|
||||
@@ -60,7 +61,7 @@ draw_files_information_window:
|
||||
@@:
|
||||
; show file or directory size
|
||||
add edx,INF_LINEH
|
||||
mcall 47,0xc0140001,files_size
|
||||
mcall SF_DRAW_NUMBER, 0xc0140001,files_size
|
||||
;--------------------------------------
|
||||
mov ebp,date.create
|
||||
call show_date_and_time_of_files_information
|
||||
@@ -71,8 +72,8 @@ draw_files_information_window:
|
||||
mov ebp,date.access
|
||||
call show_date_and_time_of_files_information
|
||||
;--------------------------------------
|
||||
cmp [select_panel_counter],0
|
||||
jne .right_1
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je .right_1
|
||||
|
||||
mov edx,read_folder_name
|
||||
jmp @f
|
||||
@@ -81,7 +82,7 @@ draw_files_information_window:
|
||||
mov edx,read_folder_1_name
|
||||
;--------------------------------------
|
||||
@@:
|
||||
mcall 4,<INF_DATAX,INF_DATAY>,0x90000000, ;file_name
|
||||
mcall SF_DRAW_TEXT, <INF_DATAX,INF_DATAY>,0x90000000, ;file_name
|
||||
mcall ,<10,INF_DATAY>,0x90000000,type_location
|
||||
cmp [inf_marked_yes],1
|
||||
je .continue
|
||||
@@ -139,7 +140,7 @@ draw_files_information_window:
|
||||
add ebx,INF_LINEH
|
||||
mcall
|
||||
|
||||
mcall 12,2
|
||||
mcall SF_REDRAW, SSF_END_DRAW
|
||||
ret
|
||||
;------------------------------------------------------------------------------
|
||||
show_date_and_time_of_files_information:
|
||||
@@ -173,28 +174,29 @@ thread_files_information_start:
|
||||
call draw_files_information_window
|
||||
;--------------------------------------
|
||||
.still:
|
||||
mcall 10
|
||||
cmp eax,1
|
||||
mcall SF_WAIT_EVENT
|
||||
cmp eax,EV_REDRAW
|
||||
je .red
|
||||
|
||||
cmp eax,2
|
||||
cmp eax,EV_KEY
|
||||
je .key
|
||||
|
||||
cmp eax,3
|
||||
cmp eax,EV_BUTTON
|
||||
je .button
|
||||
|
||||
jmp .still
|
||||
;--------------------------------------
|
||||
.key:
|
||||
mcall 2
|
||||
mcall SF_GET_KEY
|
||||
;--------------------------------------
|
||||
.button:
|
||||
mcall -1
|
||||
jmp .still
|
||||
mcall SF_TERMINATE_PROCESS
|
||||
;jmp .still
|
||||
;------------------------------------------------------------------------------
|
||||
; фхыхэшх 64-сшЄэюую ўшёыр divident эр 16-сшЄэюх ўшёыю divisor.
|
||||
; ╫рёЄэюх яюьх∙рхЄё т 64-сшЄэє■ яхЁхьхээє■ quotent,
|
||||
; р юёЄрЄюъ - т 16-сшЄэє■ яхЁхьхээє■ modulo
|
||||
align 4
|
||||
Division_64bit:
|
||||
mov ax,[ebp+6]
|
||||
xor dx,dx
|
||||
@@ -222,6 +224,7 @@ quotent:
|
||||
;modulo:
|
||||
; rb 2
|
||||
;------------------------------------------------------------------------------
|
||||
align 4
|
||||
copy_type_name:
|
||||
push esi
|
||||
mov esi,ebx
|
||||
@@ -237,6 +240,7 @@ copy_type_name:
|
||||
pop esi
|
||||
ret
|
||||
;------------------------------------------------------------------------------
|
||||
align 4
|
||||
get_files_information:
|
||||
call get_information_marked_files
|
||||
cmp [inf_marked_yes],1
|
||||
@@ -244,28 +248,28 @@ get_files_information:
|
||||
|
||||
xor eax,eax
|
||||
xor edx,edx
|
||||
cmp [select_panel_counter],0
|
||||
jne .right_1
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je .right_1
|
||||
|
||||
mov ax,[left_start_draw_cursor_line]
|
||||
mov ebx,10
|
||||
mov ax,[fb_left.start_draw_cursor_line]
|
||||
movzx ebx,[fb_left.line_size_y]
|
||||
div ebx
|
||||
mov ebx,[left_start_draw_line]
|
||||
mov ebx,[fb_left.start_draw_line]
|
||||
add ebx,eax
|
||||
imul ebx,304
|
||||
add ebx,[left_folder_data]
|
||||
add ebx,[fb_left.folder_data]
|
||||
call prepare_data_8
|
||||
mov esi,read_folder_name
|
||||
jmp .end
|
||||
;--------------------------------------
|
||||
.right_1:
|
||||
mov ax,[right_start_draw_cursor_line]
|
||||
mov ebx,10
|
||||
mov ax,[fb_right.start_draw_cursor_line]
|
||||
movzx ebx,[fb_right.line_size_y]
|
||||
div ebx
|
||||
mov ebx,[right_start_draw_line]
|
||||
mov ebx,[fb_right.start_draw_line]
|
||||
add ebx,eax
|
||||
imul ebx,304
|
||||
add ebx,[right_folder_data]
|
||||
add ebx,[fb_right.folder_data]
|
||||
call prepare_data_8
|
||||
mov esi,read_folder_1_name
|
||||
;--------------------------------------
|
||||
@@ -327,19 +331,20 @@ get_files_information:
|
||||
.end_2:
|
||||
ret
|
||||
;------------------------------------------------------------------------------
|
||||
align 4
|
||||
get_information_marked_files:
|
||||
xor eax,eax
|
||||
mov [inf_marked_yes],al
|
||||
cmp [select_panel_counter],al
|
||||
jne .right_1
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je .right_1
|
||||
|
||||
mov ebp,[left_folder_block]
|
||||
mov ebp,[fb_left.folder_block]
|
||||
;--------------------------------------
|
||||
.start:
|
||||
mov ebx,ebp
|
||||
dec ebx
|
||||
imul ebx,304
|
||||
add ebx,[left_folder_data]
|
||||
add ebx,[fb_left.folder_data]
|
||||
add ebx,32+40
|
||||
cmp [ebx+299-40],byte 0
|
||||
je @f
|
||||
@@ -363,14 +368,15 @@ get_information_marked_files:
|
||||
|
||||
ret
|
||||
;--------------------------------------
|
||||
align 4
|
||||
.right_1:
|
||||
mov ebp,[right_folder_block]
|
||||
mov ebp,[fb_right.folder_block]
|
||||
;--------------------------------------
|
||||
.start_1:
|
||||
mov ebx,ebp
|
||||
dec ebx
|
||||
imul ebx,304
|
||||
add ebx,[right_folder_data]
|
||||
add ebx,[fb_right.folder_data]
|
||||
add ebx,32+40
|
||||
cmp [ebx+299-40],byte 0
|
||||
je @f
|
||||
@@ -394,6 +400,9 @@ get_information_marked_files:
|
||||
|
||||
ret
|
||||
;------------------------------------------------------------------------------
|
||||
; in:
|
||||
; ebp = ..._folder_block
|
||||
align 4
|
||||
prepare_data_9:
|
||||
mov [error_pointer],ebx
|
||||
mov edi,file_name
|
||||
@@ -423,6 +432,7 @@ prepare_data_9:
|
||||
.continue_1:
|
||||
ret
|
||||
;------------------------------------------------------------------------------
|
||||
align 4
|
||||
prepare_data_8:
|
||||
add ebx,32+40
|
||||
cmp [ebx],word '..'
|
||||
@@ -432,8 +442,8 @@ prepare_data_8:
|
||||
jne .continue
|
||||
|
||||
add esp,4+4
|
||||
cmp [select_panel_counter],0
|
||||
jne @f
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je @f
|
||||
|
||||
call proc_read_left_folder
|
||||
jmp red
|
||||
@@ -445,17 +455,18 @@ prepare_data_8:
|
||||
.continue:
|
||||
ret
|
||||
;------------------------------------------------------------------------------
|
||||
; in:
|
||||
; ebp = ..._folder_block
|
||||
align 4
|
||||
get_inf_dir:
|
||||
mov [nesting_direction],0
|
||||
pusha
|
||||
mov [recursive_pointer],0
|
||||
mov eax,[appl_memory]
|
||||
mov [appl_memory_old],eax
|
||||
;--------------------------------------
|
||||
.1:
|
||||
mov [read_delete_dir_data.size],0
|
||||
mov [read_delete_dir_data.return],delete_dir_data
|
||||
call read_delete_dir
|
||||
mcall SF_FILE, read_delete_dir_data
|
||||
test eax,eax
|
||||
jz @f
|
||||
|
||||
@@ -469,22 +480,17 @@ get_inf_dir:
|
||||
mov eax,[delete_dir_data+8]
|
||||
imul eax,304
|
||||
add eax,32
|
||||
mov ebx,eax
|
||||
add ebx,[appl_memory_old]
|
||||
cmp ebx,[appl_memory]
|
||||
jbe @f
|
||||
|
||||
mov ecx,[appl_memory]
|
||||
mov ecx,ebx
|
||||
mov [appl_memory],ecx
|
||||
mcall 64,1
|
||||
;--------------------------------------
|
||||
@@:
|
||||
mov ecx,eax
|
||||
add ecx,[tm_size]
|
||||
mcall SF_SYS_MISC, SSF_MEM_REALLOC,, [tmp_memory]
|
||||
mov [tmp_memory],eax
|
||||
mov [tm_size],ecx
|
||||
|
||||
mov [read_delete_dir_data.return],eax
|
||||
mov eax,[delete_dir_data+8]
|
||||
mov [read_delete_dir_data.size],eax
|
||||
mov eax,[appl_memory_old]
|
||||
mov [read_delete_dir_data.return],eax
|
||||
call read_delete_dir
|
||||
mcall SF_FILE, read_delete_dir_data
|
||||
test eax,eax
|
||||
jz @f
|
||||
|
||||
@@ -498,7 +504,8 @@ get_inf_dir:
|
||||
cmp [nesting_direction],0
|
||||
je @f
|
||||
|
||||
call get_inf_dir_2
|
||||
pop ebp
|
||||
call get_inf_dir_1.start
|
||||
jnc .end
|
||||
|
||||
dec ebp
|
||||
@@ -518,26 +525,16 @@ get_inf_dir:
|
||||
cmp [recursive_pointer],0
|
||||
jge .1
|
||||
|
||||
mov ecx,[appl_memory_old]
|
||||
cmp [appl_memory],ecx
|
||||
je @f
|
||||
|
||||
mov [appl_memory],ecx
|
||||
mcall 64,1
|
||||
;--------------------------------------
|
||||
@@:
|
||||
mcall SF_SYS_MISC, SSF_MEM_FREE, [tmp_memory]
|
||||
mov [tmp_memory],0
|
||||
mov [tm_size],0
|
||||
popa
|
||||
ret
|
||||
;------------------------------------------------------------------------------
|
||||
get_inf_dir_2:
|
||||
pop eax
|
||||
pop ebp
|
||||
push eax
|
||||
jmp get_inf_dir_1.start
|
||||
;--------------------------------------
|
||||
align 4
|
||||
get_inf_dir_1:
|
||||
inc [directories_counter]
|
||||
mov ebp,[appl_memory_old]
|
||||
mov ebp,[tmp_memory]
|
||||
mov ebp,[ebp+8]
|
||||
;--------------------------------------
|
||||
.start:
|
||||
@@ -546,7 +543,7 @@ get_inf_dir_1:
|
||||
mov ebx,ebp
|
||||
dec ebx
|
||||
imul ebx,304
|
||||
add ebx,[appl_memory_old]
|
||||
add ebx,[tmp_memory]
|
||||
add ebx,32+40
|
||||
cmp [ebx],byte '.'
|
||||
jne @f
|
||||
@@ -591,19 +588,3 @@ get_inf_dir_1:
|
||||
mov [nesting_direction],0
|
||||
ret
|
||||
;------------------------------------------------------------------------------
|
||||
;type_patch_test:
|
||||
; pusha
|
||||
; mcall 5,200
|
||||
; mcall 13,<290,300>,<3,13>,0x0
|
||||
; mcall 4,<300,5>,0x80FFFFFF,file_name ;[error_pointer]
|
||||
; mcall 47,0x160100,[recursive_pointer],<300,5>,0xffffff
|
||||
; mcall 47,0x160100,ebp,<300,5>,0xffffff
|
||||
; mcall 5,1
|
||||
; popa
|
||||
; ret
|
||||
;temp_value_1 db '1',0
|
||||
;temp_value_2 db '2',0
|
||||
;temp_value_3 db '3',0
|
||||
;temp_value_4 db '4',0
|
||||
;temp_value_5 db '5',0
|
||||
;------------------------------------------------------------------------------
|
||||
+138
-250
@@ -1,130 +1,86 @@
|
||||
read_delete_dir:
|
||||
mcall 70, read_delete_dir_data
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
create_directory_f70:
|
||||
mcall 70, create_dir_file_data
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
del_file:
|
||||
mcall 70, delete_file_data
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
start_appl:
|
||||
mcall 70, start_file_data
|
||||
mcall SF_FILE, delete_file_data
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
get_file_size:
|
||||
mcall 70, read_file_features
|
||||
mcall SF_FILE, read_file_features
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
load_file:
|
||||
mcall 70, read_file
|
||||
mcall SF_FILE, read_file
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
write_file:
|
||||
mcall 70, save_file
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
add_write_file:
|
||||
mcall 70, add_save_file
|
||||
mcall SF_FILE, save_file
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
; out:
|
||||
; eax - 0 or error code
|
||||
align 4
|
||||
proc_read_left_folder:
|
||||
mov ebx,304
|
||||
push ebx ecx
|
||||
mov ecx,[appl_memory]
|
||||
add ecx,ebx
|
||||
mov [esp],ebx
|
||||
mov ebx,[appl_memory]
|
||||
mov [esp+4],ebx
|
||||
mov [appl_memory],ecx
|
||||
mcall 64,1
|
||||
call move_up_right_table
|
||||
pop ecx ebx
|
||||
push ebx ecx edx
|
||||
mov ecx,[lfd_size]
|
||||
add ecx,304
|
||||
mcall SF_SYS_MISC, SSF_MEM_REALLOC,, [fb_left.folder_data]
|
||||
mov [fb_left.folder_data],eax
|
||||
mov [lfd_size],ecx
|
||||
stdcall mark_file_clear_all, eax, ecx
|
||||
pop edx ecx ebx
|
||||
|
||||
xor eax,eax
|
||||
mov [left_marked_counter],eax
|
||||
mov [fb_left.marked_counter],eax
|
||||
mov [read_folder.start],eax ;dword 0
|
||||
inc eax
|
||||
mov [read_folder.size],eax ;dword 1
|
||||
mov eax,[left_folder_data]
|
||||
push eax
|
||||
mov eax,[fb_left.folder_data]
|
||||
mov [read_folder.return],eax
|
||||
mcall 70, read_folder
|
||||
test eax,eax
|
||||
jz @f
|
||||
cmp eax,6
|
||||
jne .error_1
|
||||
@@:
|
||||
mov eax,[esp]
|
||||
cmp [eax+32+40],word 2Eh
|
||||
jne @f
|
||||
mov [read_folder.start],dword 1
|
||||
@@:
|
||||
mov ebx,[eax+8]
|
||||
mov [read_folder.size],ebx ;dword 10 ;5000
|
||||
imul ebx,304
|
||||
add ebx,32
|
||||
mov ecx,[right_folder_data]
|
||||
sub ecx,[left_folder_data]
|
||||
push ebx ecx
|
||||
cmp ebx,ecx
|
||||
je .continue
|
||||
sub ebx,ecx
|
||||
js .sub_mem
|
||||
.add_mem:
|
||||
mov ecx,[appl_memory]
|
||||
add ecx,ebx
|
||||
mov [esp],ebx
|
||||
mov ebx,[appl_memory]
|
||||
mov [esp+4],ebx
|
||||
mov [appl_memory],ecx
|
||||
mcall 64,1
|
||||
call move_up_right_table
|
||||
; mov [temp_znak],1
|
||||
jmp .continue
|
||||
.sub_mem:
|
||||
mov ebx,[esp]
|
||||
mov ecx,[esp+4]
|
||||
sub ebx,ecx
|
||||
mov ecx,[appl_memory]
|
||||
sub ecx,ebx
|
||||
mov [esp],ebx
|
||||
mov ebx,[appl_memory]
|
||||
mov [esp+4],ebx
|
||||
mov [appl_memory],ecx
|
||||
call move_down_right_table
|
||||
mcall 64,1
|
||||
; mov [temp_znak],2
|
||||
.continue:
|
||||
; mov edi,eax ;folder_data
|
||||
; call clear_folder_data_area
|
||||
mcall 70, read_folder
|
||||
mov [left_folder_block],ebx
|
||||
add esp,4*3
|
||||
|
||||
mcall SF_FILE, read_folder
|
||||
test eax,eax
|
||||
jz @f
|
||||
cmp eax,6
|
||||
jne .error
|
||||
@@:
|
||||
mov eax,[fb_left.folder_data]
|
||||
cmp [eax+32+40],word 2Eh
|
||||
jne @f
|
||||
mov [read_folder.start],dword 1
|
||||
@@:
|
||||
mov ecx,[eax+8] ; число файлов и папок
|
||||
mov [read_folder.size],ecx
|
||||
mov [sb_left.max_area],ecx
|
||||
imul ecx,304
|
||||
add ecx,32
|
||||
|
||||
push edx
|
||||
mcall SF_SYS_MISC, SSF_MEM_REALLOC,, [fb_left.folder_data]
|
||||
mov [fb_left.folder_data],eax
|
||||
mov [lfd_size],ecx
|
||||
mov [read_folder.return],eax
|
||||
stdcall mark_file_clear_all, eax, ecx
|
||||
pop edx
|
||||
|
||||
mcall SF_FILE, read_folder
|
||||
mov [fb_left.folder_block],ebx
|
||||
test eax,eax
|
||||
jz @f
|
||||
cmp eax,6
|
||||
jne .error
|
||||
align 4
|
||||
@@:
|
||||
push eax
|
||||
; call left_files_name_normalize
|
||||
call left_prepare_extension_start
|
||||
call left_sort_files
|
||||
pop eax
|
||||
; pusha
|
||||
; call draw_window
|
||||
; popa
|
||||
ret
|
||||
.error_1:
|
||||
add esp,4
|
||||
align 4
|
||||
.error:
|
||||
mov [left_folder_block],dword 2
|
||||
mov edi,[left_folder_data]
|
||||
mov [fb_left.folder_block],dword 2
|
||||
mov edi,[fb_left.folder_data]
|
||||
call error_handler
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
error_handler:
|
||||
push eax
|
||||
xor eax,eax
|
||||
@@ -154,193 +110,132 @@ error_handler:
|
||||
pop eax
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
; out:
|
||||
; eax - 0 or error code
|
||||
proc_read_right_folder:
|
||||
mov ecx,[appl_memory]
|
||||
push ebx ecx edx
|
||||
mov ecx,[rfd_size]
|
||||
add ecx,304
|
||||
mov [appl_memory],ecx
|
||||
mcall 64,1
|
||||
mcall SF_SYS_MISC, SSF_MEM_REALLOC,, [fb_right.folder_data]
|
||||
mov [fb_right.folder_data],eax
|
||||
mov [rfd_size],ecx
|
||||
stdcall mark_file_clear_all, eax, ecx
|
||||
pop edx ecx ebx
|
||||
|
||||
xor eax,eax
|
||||
mov [right_marked_counter],eax
|
||||
mov [fb_right.marked_counter],eax
|
||||
mov [read_folder_1.start],eax ;dword 0
|
||||
inc eax
|
||||
mov [read_folder_1.size],eax ;dword 1
|
||||
mov eax,[right_folder_data]
|
||||
push eax
|
||||
mov eax,[fb_right.folder_data]
|
||||
mov [read_folder_1.return],eax
|
||||
mcall 70, read_folder_1
|
||||
test eax,eax
|
||||
jz @f
|
||||
cmp eax,6
|
||||
jne .error_1
|
||||
@@:
|
||||
mov eax,[esp]
|
||||
cmp [eax+32+40],word 2Eh
|
||||
jne @f
|
||||
mov [read_folder_1.start],dword 1
|
||||
@@:
|
||||
mov ebx,[eax+8]
|
||||
mov [read_folder_1.size],ebx ;dword 10 ;5000
|
||||
imul ebx,304
|
||||
add ebx,32
|
||||
mov ecx,[appl_memory]
|
||||
sub ecx,[right_folder_data]
|
||||
push ebx ecx
|
||||
cmp ebx,ecx
|
||||
je .continue
|
||||
sub ebx,ecx
|
||||
js .sub_mem
|
||||
.add_mem:
|
||||
mov ecx,[appl_memory]
|
||||
add ecx,ebx
|
||||
mov [appl_memory],ecx
|
||||
mcall 64,1
|
||||
; mov [temp_znak],1
|
||||
jmp .continue
|
||||
.sub_mem:
|
||||
mov ebx,[esp]
|
||||
mov ecx,[esp+4]
|
||||
sub ebx,ecx
|
||||
mov ecx,[appl_memory]
|
||||
sub ecx,ebx
|
||||
mov [appl_memory],ecx
|
||||
mcall 64,1
|
||||
; mov [temp_znak],2
|
||||
.continue:
|
||||
; mov edi,eax ;folder_data_1
|
||||
; call clear_folder_data_area
|
||||
mcall 70, read_folder_1
|
||||
mov [right_folder_block],ebx
|
||||
add esp,4*3
|
||||
mcall SF_FILE, read_folder_1
|
||||
test eax,eax
|
||||
jz @f
|
||||
cmp eax,6
|
||||
jne .error
|
||||
@@:
|
||||
mov eax,[fb_right.folder_data]
|
||||
cmp [eax+32+40],word 2Eh
|
||||
jne @f
|
||||
mov [read_folder_1.start],dword 1
|
||||
@@:
|
||||
mov ecx,[eax+8] ; число файлов и папок
|
||||
mov [read_folder_1.size],ecx
|
||||
mov [sb_right.max_area],ecx
|
||||
imul ecx,304
|
||||
add ecx,32
|
||||
|
||||
push edx
|
||||
mcall SF_SYS_MISC, SSF_MEM_REALLOC,, [fb_right.folder_data]
|
||||
mov [fb_right.folder_data],eax
|
||||
mov [rfd_size],ecx
|
||||
mov [read_folder_1.return],eax
|
||||
stdcall mark_file_clear_all, eax, ecx
|
||||
pop edx
|
||||
|
||||
mcall SF_FILE, read_folder_1
|
||||
mov [fb_right.folder_block],ebx
|
||||
test eax,eax
|
||||
jz @f
|
||||
cmp eax,6
|
||||
jne .error
|
||||
align 4
|
||||
@@:
|
||||
push eax
|
||||
; call right_files_name_normalize
|
||||
call right_prepare_extension_start
|
||||
call right_sort_files
|
||||
pop eax
|
||||
; pusha
|
||||
; call draw_window
|
||||
; popa
|
||||
ret
|
||||
.error_1:
|
||||
add esp,4
|
||||
align 4
|
||||
.error:
|
||||
mov [right_folder_block],dword 2
|
||||
mov edi,[right_folder_data]
|
||||
mov [fb_right.folder_block],dword 2
|
||||
mov edi,[fb_right.folder_data]
|
||||
call error_handler
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
move_up_right_table:
|
||||
mov esi,[esp+8]
|
||||
mov ecx,esi
|
||||
sub ecx,[right_folder_data]
|
||||
mov edi,esi
|
||||
add edi,[esp+4]
|
||||
shr ecx,2
|
||||
std
|
||||
; rep movsb
|
||||
rep movsd
|
||||
mov eax,[esp+4]
|
||||
add [right_folder_data],eax
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
move_down_right_table:
|
||||
mov esi,[right_folder_data]
|
||||
mov edi,esi
|
||||
sub edi,[esp+4]
|
||||
push ecx
|
||||
mov ecx,[esp+12]
|
||||
sub ecx,[right_folder_data]
|
||||
shr ecx,2
|
||||
cld
|
||||
; rep movsb
|
||||
rep movsd
|
||||
pop ecx
|
||||
mov eax,[esp+4]
|
||||
sub [right_folder_data],eax
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
;clear_folder_data_area:
|
||||
; mov ecx,4096*10/4
|
||||
; xor eax,eax
|
||||
; cld
|
||||
; rep stosd
|
||||
; ret
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
proc_read_folder:
|
||||
call proc_read_left_folder
|
||||
; mov [left_panel_clear_all],1
|
||||
cmp [search_pre_folder],0
|
||||
jne @f
|
||||
mov [left_start_draw_cursor_line],0
|
||||
mov [left_start_draw_line],0
|
||||
mov [fb_left.start_draw_cursor_line],0
|
||||
mov [fb_left.start_draw_line],0
|
||||
mov [sb_left.position],0
|
||||
jmp .continue
|
||||
@@:
|
||||
mov edi,[left_folder_data]
|
||||
mov edi,[fb_left.folder_data]
|
||||
add edi,32+40
|
||||
sub edi,304
|
||||
xor ebp,ebp
|
||||
.search_file:
|
||||
cmp [left_folder_block],ebp
|
||||
cmp [fb_left.folder_block],ebp
|
||||
jbe .end_folder
|
||||
mov esi,[temp_counter_dword]
|
||||
mov ecx,[extension_size]
|
||||
add edi,304
|
||||
inc ebp
|
||||
cld
|
||||
; mov [temp_counter_dword_1],edi
|
||||
push edi
|
||||
rep cmpsb
|
||||
pop edi
|
||||
jne .search_file
|
||||
dec ebp
|
||||
mov eax,[left_folder_block]
|
||||
cmp [max_panel_line],eax
|
||||
mov eax,[fb_left.folder_block]
|
||||
cmp [fb_left.max_panel_line],eax
|
||||
js @f
|
||||
mov eax,ebp
|
||||
imul eax,10
|
||||
mov [left_start_draw_cursor_line],ax
|
||||
mov [left_start_draw_line],0
|
||||
movzx eax,[fb_left.line_size_y]
|
||||
imul eax,ebp
|
||||
mov [fb_left.start_draw_cursor_line],ax
|
||||
mov [fb_left.start_draw_line],0
|
||||
mov [sb_left.position],0
|
||||
jmp .end_folder
|
||||
@@:
|
||||
; sub eax,ebp
|
||||
; push eax
|
||||
; sub eax,[max_panel_line]
|
||||
; jns @f
|
||||
; mov eax,[max_panel_line]
|
||||
; sub eax,[esp]
|
||||
; imul eax,10
|
||||
; mov [left_start_draw_cursor_line],ax
|
||||
;@@:
|
||||
mov [left_start_draw_cursor_line],0
|
||||
mov [left_start_draw_line],ebp
|
||||
mov [fb_left.start_draw_cursor_line],0
|
||||
mov [fb_left.start_draw_line],ebp
|
||||
mov [sb_left.position],ebp
|
||||
.end_folder:
|
||||
mov [search_pre_folder],0
|
||||
.continue:
|
||||
call draw_left_panel
|
||||
call draw_left_select_disk_button
|
||||
; call draw_window
|
||||
; pop eax
|
||||
jmp still
|
||||
;---------------------------------------------------------------------
|
||||
proc_read_folder_1:
|
||||
call proc_read_right_folder
|
||||
; mov [right_panel_clear_all],1
|
||||
cmp [search_pre_folder],0
|
||||
jne @f
|
||||
mov [right_start_draw_cursor_line],0
|
||||
mov [right_start_draw_line],0
|
||||
mov [fb_right.start_draw_cursor_line],0
|
||||
mov [fb_right.start_draw_line],0
|
||||
mov [sb_right.position],0
|
||||
jmp .continue
|
||||
@@:
|
||||
mov edi,[right_folder_data]
|
||||
mov edi,[fb_right.folder_data]
|
||||
add edi,32+40
|
||||
sub edi,304
|
||||
xor ebp,ebp
|
||||
.search_file:
|
||||
cmp [right_folder_block],ebp
|
||||
cmp [fb_right.folder_block],ebp
|
||||
jbe .end_folder
|
||||
mov esi,[temp_counter_dword]
|
||||
mov ecx,[extension_size]
|
||||
@@ -353,26 +248,19 @@ proc_read_folder_1:
|
||||
pop edi
|
||||
jne .search_file
|
||||
dec ebp
|
||||
mov eax,[right_folder_block]
|
||||
cmp [max_panel_line],eax
|
||||
mov eax,[fb_right.folder_block]
|
||||
cmp [fb_right.max_panel_line],eax
|
||||
js @f
|
||||
mov eax,ebp
|
||||
imul eax,10
|
||||
mov [right_start_draw_cursor_line],ax
|
||||
mov [right_start_draw_line],0
|
||||
movzx eax,[fb_right.line_size_y]
|
||||
imul eax,ebp
|
||||
mov [fb_right.start_draw_cursor_line],ax
|
||||
mov [fb_right.start_draw_line],0
|
||||
mov [sb_right.position],0
|
||||
jmp .end_folder
|
||||
@@:
|
||||
; sub eax,ebp
|
||||
; push eax
|
||||
; sub eax,[max_panel_line]
|
||||
; jns @f
|
||||
; mov eax,[max_panel_line]
|
||||
; sub eax,[esp]
|
||||
; imul eax,10
|
||||
; mov [right_start_draw_cursor_line],ax
|
||||
;@@:
|
||||
mov [right_start_draw_cursor_line],0
|
||||
mov [right_start_draw_line],ebp
|
||||
mov [fb_right.start_draw_cursor_line],0
|
||||
mov [fb_right.start_draw_line],ebp
|
||||
mov [sb_right.position],ebp
|
||||
.end_folder:
|
||||
mov [search_pre_folder],0
|
||||
.continue:
|
||||
@@ -404,7 +292,7 @@ copy_folder_name_3:
|
||||
jmp copy_folder_name.1
|
||||
;---------------------------------------------------------------------
|
||||
read_folder:
|
||||
.subfunction dd 1
|
||||
.subfunction dd SSF_READ_FOLDER
|
||||
.start dd 0
|
||||
.flags dd 0
|
||||
.size dd 5000
|
||||
@@ -413,7 +301,7 @@ read_folder:
|
||||
.name: dd read_folder_name
|
||||
;---------------------------------------------------------------------
|
||||
read_folder_1:
|
||||
.subfunction dd 1
|
||||
.subfunction dd SSF_READ_FOLDER
|
||||
.start dd 0
|
||||
.flags dd 0
|
||||
.size dd 5000
|
||||
@@ -422,7 +310,7 @@ read_folder_1:
|
||||
.name: dd read_folder_1_name
|
||||
;---------------------------------------------------------------------
|
||||
read_folder_2:
|
||||
.subfunction dd 1
|
||||
.subfunction dd SSF_READ_FOLDER
|
||||
.start dd 0
|
||||
.flags dd 0
|
||||
.size dd 5000
|
||||
@@ -431,7 +319,7 @@ read_folder_2:
|
||||
.name: dd read_folder_2_name
|
||||
;---------------------------------------------------------------------
|
||||
read_folder_3:
|
||||
.subfunction dd 1
|
||||
.subfunction dd SSF_READ_FOLDER
|
||||
.start dd 0
|
||||
.flags dd 0
|
||||
.size dd 5000
|
||||
@@ -440,7 +328,7 @@ read_folder_3:
|
||||
.name: dd read_folder_3_name
|
||||
;---------------------------------------------------------------------
|
||||
read_file_features:
|
||||
.subfunction dd 5
|
||||
.subfunction dd SSF_GET_INFO
|
||||
.Offset dd 0
|
||||
.Offset_1 dd 0
|
||||
.size dd 0
|
||||
@@ -449,7 +337,7 @@ read_file_features:
|
||||
.name: dd file_name
|
||||
;---------------------------------------------------------------------
|
||||
read_file:
|
||||
.subfunction dd 0
|
||||
.subfunction dd SSF_READ_FILE
|
||||
.Offset dd 0
|
||||
.Offset_1 dd 0
|
||||
.size dd 0
|
||||
@@ -458,7 +346,7 @@ read_file:
|
||||
.name: dd file_name
|
||||
;---------------------------------------------------------------------
|
||||
save_file:
|
||||
.subfunction dd 2
|
||||
.subfunction dd SSF_CREATE_FILE
|
||||
.Offset dd 0
|
||||
.Offset_1 dd 0
|
||||
.size dd 0
|
||||
@@ -467,7 +355,7 @@ save_file:
|
||||
.name: dd start_parameter
|
||||
;---------------------------------------------------------------------
|
||||
add_save_file:
|
||||
.subfunction dd 3
|
||||
.subfunction dd SSF_WRITE_FILE
|
||||
.Offset dd 0
|
||||
.Offset_1 dd 0
|
||||
.size dd 0
|
||||
@@ -476,7 +364,7 @@ add_save_file:
|
||||
.name: dd start_parameter
|
||||
;---------------------------------------------------------------------
|
||||
create_dir_file_data:
|
||||
.subfunction dd 9
|
||||
.subfunction dd SSF_CREATE_FOLDER
|
||||
.flags dd 0
|
||||
.param dd 0
|
||||
.rezerv dd 0
|
||||
@@ -485,7 +373,7 @@ create_dir_file_data:
|
||||
.name: dd file_name
|
||||
;---------------------------------------------------------------------
|
||||
start_file_data:
|
||||
.subfunction dd 7
|
||||
.subfunction dd SSF_START_APP
|
||||
.flags dd 0
|
||||
.param dd 0
|
||||
.rezerv dd 0
|
||||
@@ -494,7 +382,7 @@ start_file_data:
|
||||
.name: dd file_name
|
||||
;---------------------------------------------------------------------
|
||||
delete_file_data:
|
||||
.subfunction dd 8
|
||||
.subfunction dd SSF_DELETE
|
||||
.flags dd 0
|
||||
.param dd 0
|
||||
.rezerv dd 0
|
||||
@@ -503,7 +391,7 @@ delete_file_data:
|
||||
.name: dd file_name
|
||||
;---------------------------------------------------------------------
|
||||
read_delete_dir_data:
|
||||
.subfunction dd 1
|
||||
.subfunction dd SSF_READ_FOLDER
|
||||
.start dd 0
|
||||
.flags dd 0
|
||||
.size dd 0
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 9.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 5.1 KiB |
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 5.1 KiB |
+130
-323
@@ -1,5 +1,6 @@
|
||||
align 4
|
||||
key:
|
||||
mcall 2
|
||||
mcall SF_GET_KEY
|
||||
cmp [extended_key],1
|
||||
je .extended_key
|
||||
test al, al
|
||||
@@ -11,8 +12,8 @@ key:
|
||||
@@:
|
||||
cmp ah,15
|
||||
jne .no_tab
|
||||
inc [select_panel_counter]
|
||||
and [select_panel_counter],1b
|
||||
xor [fb_left.select_panel_counter],1
|
||||
xor [fb_right.select_panel_counter],1
|
||||
call draw_left_panel
|
||||
call draw_right_panel
|
||||
jmp still
|
||||
@@ -81,323 +82,45 @@ key_80:
|
||||
cmp ah,80 ; arrow down
|
||||
jne key_72
|
||||
.1:
|
||||
cmp [select_panel_counter],0
|
||||
jne .right_1
|
||||
mov eax,[left_folder_block]
|
||||
dec eax
|
||||
imul eax,10
|
||||
cmp ax,[left_start_draw_cursor_line]
|
||||
jbe .marked_action ;still
|
||||
mov ax,[left_start_draw_cursor_line]
|
||||
add ax,10
|
||||
cmp ax,[left_panel_y_correct_size_y]
|
||||
jae @f
|
||||
.add_1:
|
||||
add [left_start_draw_cursor_line],10
|
||||
call draw_left_panel
|
||||
mov [drawing_panel_folder],1
|
||||
jmp still
|
||||
.all:
|
||||
sub ecx,10 shl 16
|
||||
mov edx,0xffffff
|
||||
mcall
|
||||
mov [not_clear_lines],1
|
||||
call draw_folder_data
|
||||
mov [not_clear_lines],0
|
||||
jmp still
|
||||
.marked_action:
|
||||
cmp [marked_action],0
|
||||
je still
|
||||
mov [marked_action],0
|
||||
call draw_left_panel
|
||||
jmp still
|
||||
.marked_action_1:
|
||||
cmp [marked_action],0
|
||||
je still
|
||||
mov [marked_action],0
|
||||
call draw_right_panel
|
||||
jmp still
|
||||
@@:
|
||||
mov eax,[left_folder_block]
|
||||
sub eax,[max_panel_line]
|
||||
test eax,0x80000000
|
||||
jz @f
|
||||
xor eax,eax
|
||||
@@:
|
||||
cmp [marked_action],0
|
||||
jne @f
|
||||
cmp [left_start_draw_line],eax
|
||||
je still
|
||||
@@:
|
||||
mov [marked_action],0
|
||||
inc [left_start_draw_line]
|
||||
call draw_left_panel
|
||||
jmp still
|
||||
.right_1:
|
||||
mov eax,[right_folder_block]
|
||||
dec eax
|
||||
imul eax,10
|
||||
cmp ax,[right_start_draw_cursor_line]
|
||||
jbe .marked_action_1 ;still
|
||||
mov ax,[right_start_draw_cursor_line]
|
||||
add ax,10
|
||||
cmp ax,[right_panel_y_correct_size_y]
|
||||
jae @f
|
||||
.add_2:
|
||||
add [right_start_draw_cursor_line],10
|
||||
call draw_right_panel
|
||||
mov [drawing_panel_folder],2
|
||||
jmp still
|
||||
@@:
|
||||
mov eax,[right_folder_block]
|
||||
sub eax,[max_panel_line]
|
||||
test eax,0x80000000
|
||||
jz @f
|
||||
xor eax,eax
|
||||
@@:
|
||||
cmp [marked_action],0
|
||||
jne @f
|
||||
cmp [right_start_draw_line],eax
|
||||
je still
|
||||
@@:
|
||||
mov [marked_action],0
|
||||
inc [right_start_draw_line]
|
||||
call draw_right_panel
|
||||
mov bx,1
|
||||
call fb_on_key
|
||||
jmp still
|
||||
;-------------------------------------------------------------
|
||||
key_72:
|
||||
cmp ah,72 ;arrow up
|
||||
jne key_81
|
||||
.1:
|
||||
cmp [select_panel_counter],0
|
||||
jne .right_1
|
||||
mov ax,[left_start_draw_cursor_line]
|
||||
add ax,[left_panel_y.start_y]
|
||||
cmp [left_panel_y.start_y],ax
|
||||
je @f
|
||||
sub [left_start_draw_cursor_line],10
|
||||
call draw_left_panel
|
||||
mov [drawing_panel_folder],1
|
||||
jmp still
|
||||
.all:
|
||||
add ecx,10 shl 16
|
||||
mov edx,0xffffff
|
||||
mcall
|
||||
mov [not_clear_lines],1
|
||||
call draw_folder_data
|
||||
mov [not_clear_lines],0
|
||||
jmp still
|
||||
@@:
|
||||
cmp [left_start_draw_line],0
|
||||
je still
|
||||
dec [left_start_draw_line]
|
||||
call draw_left_panel
|
||||
jmp still
|
||||
.right_1:
|
||||
mov ax,[right_start_draw_cursor_line]
|
||||
add ax,[right_panel_y.start_y]
|
||||
cmp [right_panel_y.start_y],ax
|
||||
je @f
|
||||
sub [right_start_draw_cursor_line],10
|
||||
call draw_right_panel
|
||||
mov [drawing_panel_folder],2
|
||||
jmp still
|
||||
@@:
|
||||
cmp [right_start_draw_line],0
|
||||
je still
|
||||
dec [right_start_draw_line]
|
||||
call draw_right_panel
|
||||
mov bx,2
|
||||
call fb_on_key
|
||||
jmp still
|
||||
;-------------------------------------------------------------
|
||||
key_81:
|
||||
cmp ah,81 ; PageDown
|
||||
jne key_73
|
||||
mov eax,[max_panel_line]
|
||||
cmp [select_panel_counter],0
|
||||
jne .right_1
|
||||
mov ebx,[left_folder_block]
|
||||
sub ebx,eax
|
||||
test ebx,0x80000000
|
||||
jnz .left_2
|
||||
sub ebx,[left_start_draw_line]
|
||||
cmp ebx,eax
|
||||
ja .ok_1
|
||||
mov ebx,[left_folder_block]
|
||||
sub ebx,eax
|
||||
call prepare_data_left_down
|
||||
ja @f
|
||||
cmp ebx,[left_start_draw_line]
|
||||
je still
|
||||
@@:
|
||||
mov [left_start_draw_line],ebx
|
||||
.left_3:
|
||||
dec eax
|
||||
imul eax,10
|
||||
.left_1:
|
||||
mov [left_start_draw_cursor_line],ax
|
||||
call draw_left_panel
|
||||
mov bx,3
|
||||
call fb_on_key
|
||||
jmp still
|
||||
.left_2:
|
||||
mov eax,[left_folder_block]
|
||||
sub eax,[left_start_draw_line]
|
||||
dec eax
|
||||
imul eax,10
|
||||
cmp ax,[left_start_draw_cursor_line]
|
||||
jbe still
|
||||
jmp .left_1
|
||||
.ok_1:
|
||||
add [left_start_draw_line],eax
|
||||
call draw_left_panel
|
||||
jmp still
|
||||
.right_1:
|
||||
mov ebx,[right_folder_block]
|
||||
sub ebx,eax
|
||||
test ebx,0x80000000
|
||||
jnz .right_3
|
||||
sub ebx,[right_start_draw_line]
|
||||
cmp ebx,eax
|
||||
jae .ok_2
|
||||
mov ebx,[right_folder_block]
|
||||
sub ebx,eax
|
||||
call prepare_data_right_down
|
||||
ja @f
|
||||
cmp ebx,[right_start_draw_line]
|
||||
je still
|
||||
@@:
|
||||
mov [right_start_draw_line],ebx
|
||||
.right_4:
|
||||
dec eax
|
||||
imul eax,10
|
||||
.right_2:
|
||||
mov [right_start_draw_cursor_line],ax
|
||||
call draw_right_panel
|
||||
jmp still
|
||||
.right_3:
|
||||
mov eax,[right_folder_block]
|
||||
sub eax,[right_start_draw_line]
|
||||
dec eax
|
||||
imul eax,10
|
||||
cmp ax,[right_start_draw_cursor_line]
|
||||
jbe still
|
||||
jmp .right_2
|
||||
.ok_2:
|
||||
add [right_start_draw_line],eax
|
||||
call draw_right_panel
|
||||
jmp still
|
||||
;-------------------------------------------------------------
|
||||
prepare_data_right_down:
|
||||
mov ecx,[right_folder_block]
|
||||
sub ecx,[right_start_draw_line]
|
||||
dec ecx
|
||||
imul ecx,10
|
||||
cmp cx,[right_start_draw_cursor_line]
|
||||
ret
|
||||
;-------------------------------------------------------------
|
||||
prepare_data_left_down:
|
||||
mov ecx,[left_folder_block]
|
||||
sub ecx,[left_start_draw_line]
|
||||
dec ecx
|
||||
imul ecx,10
|
||||
cmp cx,[left_start_draw_cursor_line]
|
||||
ret
|
||||
;-------------------------------------------------------------
|
||||
key_73:
|
||||
cmp ah,73 ; PageUp
|
||||
jne key_71
|
||||
mov eax,[max_panel_line]
|
||||
cmp [select_panel_counter],0
|
||||
jne .right_1
|
||||
mov ebx,[left_start_draw_line]
|
||||
sub ebx,eax
|
||||
test ebx,0x8000000
|
||||
jz @f
|
||||
cmp [left_start_draw_line],0
|
||||
jne .draw_line_1
|
||||
cmp [left_start_draw_cursor_line],0
|
||||
je still
|
||||
mov [left_start_draw_cursor_line],0
|
||||
.draw_line_1:
|
||||
mov [left_start_draw_line],0
|
||||
call draw_left_panel
|
||||
jmp still
|
||||
@@:
|
||||
sub [left_start_draw_line],eax
|
||||
call draw_left_panel
|
||||
jmp still
|
||||
.right_1:
|
||||
mov ebx,[right_start_draw_line]
|
||||
sub ebx,eax
|
||||
test ebx,0x80000000
|
||||
jz @f
|
||||
cmp [right_start_draw_line],0
|
||||
jne .draw_line_2
|
||||
cmp [right_start_draw_cursor_line],0
|
||||
je still
|
||||
mov [right_start_draw_cursor_line],0
|
||||
.draw_line_2:
|
||||
mov [right_start_draw_line],0
|
||||
call draw_right_panel
|
||||
jmp still
|
||||
@@:
|
||||
sub [right_start_draw_line],eax
|
||||
call draw_right_panel
|
||||
mov bx,4
|
||||
call fb_on_key
|
||||
jmp still
|
||||
;-------------------------------------------------------------
|
||||
key_71:
|
||||
cmp ah,71 ; Home
|
||||
jne key_79
|
||||
cmp [select_panel_counter],0
|
||||
jne .right_1
|
||||
cmp [left_start_draw_line],0
|
||||
jne .draw_left_panel
|
||||
cmp [left_start_draw_cursor_line],0
|
||||
je still
|
||||
.draw_left_panel:
|
||||
mov [left_start_draw_line],0
|
||||
mov [left_start_draw_cursor_line],0
|
||||
call draw_left_panel
|
||||
jmp still
|
||||
.right_1:
|
||||
cmp [right_start_draw_line],0
|
||||
jne .draw_right_panel
|
||||
cmp [right_start_draw_cursor_line],0
|
||||
je still
|
||||
.draw_right_panel:
|
||||
mov [right_start_draw_line],0
|
||||
mov [right_start_draw_cursor_line],0
|
||||
call draw_right_panel
|
||||
mov bx,5
|
||||
call fb_on_key
|
||||
jmp still
|
||||
;-------------------------------------------------------------
|
||||
key_79:
|
||||
cmp ah,79 ; End
|
||||
jne key_28
|
||||
cmp [select_panel_counter],0
|
||||
jne .right_1
|
||||
mov eax,[left_folder_block]
|
||||
sub eax,[max_panel_line]
|
||||
test eax,0x80000000
|
||||
jnz key_81.left_2
|
||||
call prepare_data_left_down
|
||||
ja @f
|
||||
cmp eax,[left_start_draw_line]
|
||||
je still
|
||||
@@:
|
||||
mov [left_start_draw_line],eax
|
||||
mov eax,[max_panel_line]
|
||||
jmp key_81.left_3
|
||||
.right_1:
|
||||
mov eax,[right_folder_block]
|
||||
sub eax,[max_panel_line]
|
||||
test eax,0x80000000
|
||||
jnz key_81.right_3
|
||||
call prepare_data_right_down
|
||||
ja @f
|
||||
cmp eax,[right_start_draw_line]
|
||||
je still
|
||||
@@:
|
||||
mov [right_start_draw_line],eax
|
||||
mov eax,[max_panel_line]
|
||||
jmp key_81.right_4
|
||||
mov bx,6
|
||||
call fb_on_key
|
||||
je still
|
||||
;-------------------------------------------------------------
|
||||
key_28:
|
||||
cmp ah,28 ; Enter
|
||||
@@ -412,8 +135,8 @@ key_28:
|
||||
|
||||
mov [open_param],0
|
||||
.2:
|
||||
cmp [select_panel_counter],0
|
||||
jne .right_1
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je .right_1
|
||||
mov ebp,read_folder_name ;read_folder.name
|
||||
call calculate_left_data_1
|
||||
add esi,32
|
||||
@@ -431,8 +154,9 @@ key_28:
|
||||
je .up_patch
|
||||
@@:
|
||||
call calculate_key_28_1
|
||||
mov [left_start_draw_cursor_line],0
|
||||
mov [left_start_draw_line],0
|
||||
mov [fb_left.start_draw_cursor_line],0
|
||||
mov [fb_left.start_draw_line],0
|
||||
mov [sb_left.position],0
|
||||
jmp proc_read_folder
|
||||
.up_patch:
|
||||
call calculate_key_28_2
|
||||
@@ -453,8 +177,9 @@ key_28:
|
||||
je .up_patch_1
|
||||
@@:
|
||||
call calculate_key_28_1
|
||||
mov [right_start_draw_cursor_line],0
|
||||
mov [right_start_draw_line],0
|
||||
mov [fb_right.start_draw_cursor_line],0
|
||||
mov [fb_right.start_draw_line],0
|
||||
mov [sb_right.position],0
|
||||
jmp proc_read_folder_1
|
||||
.up_patch_1:
|
||||
call calculate_key_28_2
|
||||
@@ -530,48 +255,52 @@ symbol_a_up:
|
||||
je still
|
||||
cmp [ctrl_flag],1
|
||||
je .ctrl
|
||||
cmp [alt_flag],1
|
||||
je still
|
||||
;cmp [alt_flag],1
|
||||
;je still
|
||||
jmp still
|
||||
.ctrl:
|
||||
mov [mark_action_counter],0
|
||||
jmp mark_all_file
|
||||
mov bx,9
|
||||
call fb_on_key
|
||||
jmp still
|
||||
;---------------------------------------------------------------------
|
||||
NumPad_plus_Up:
|
||||
cmp [shift_flag],1
|
||||
je still
|
||||
cmp [ctrl_flag],1
|
||||
je .ctrl
|
||||
cmp [alt_flag],1
|
||||
je still
|
||||
;cmp [alt_flag],1
|
||||
;je still
|
||||
jmp still
|
||||
.ctrl:
|
||||
mov [mark_action_counter],0
|
||||
jmp mark_all_file
|
||||
mov bx,9
|
||||
call fb_on_key
|
||||
jmp still
|
||||
;---------------------------------------------------------------------
|
||||
NumPad_minus_Up:
|
||||
cmp [shift_flag],1
|
||||
je still
|
||||
cmp [ctrl_flag],1
|
||||
je .ctrl
|
||||
cmp [alt_flag],1
|
||||
je still
|
||||
;cmp [alt_flag],1
|
||||
;je still
|
||||
jmp still
|
||||
.ctrl:
|
||||
mov [mark_action_counter],1
|
||||
jmp mark_all_file
|
||||
mov bx,10
|
||||
call fb_on_key
|
||||
jmp still
|
||||
;---------------------------------------------------------------------
|
||||
NumPad_sneg_Up:
|
||||
cmp [shift_flag],1
|
||||
je still
|
||||
cmp [ctrl_flag],1
|
||||
je .ctrl
|
||||
cmp [alt_flag],1
|
||||
je still
|
||||
;cmp [alt_flag],1
|
||||
;je still
|
||||
jmp still
|
||||
.ctrl:
|
||||
mov [mark_action_counter],2
|
||||
jmp mark_all_file
|
||||
mov bx,11
|
||||
call fb_on_key
|
||||
jmp still
|
||||
;---------------------------------------------------------------------
|
||||
f_key_f1:
|
||||
;sort_name:
|
||||
@@ -599,11 +328,11 @@ f_key_f3:
|
||||
je still
|
||||
cmp [ctrl_flag],1
|
||||
je .ctrl
|
||||
cmp [alt_flag],1
|
||||
je still
|
||||
;cmp [alt_flag],1
|
||||
;je still
|
||||
jmp still
|
||||
.ctrl:
|
||||
cmp [select_panel_counter],1
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je right_sort_name
|
||||
jmp left_sort_name
|
||||
;---------------------------------------------------------------------
|
||||
@@ -617,7 +346,7 @@ f_key_f4:
|
||||
je still
|
||||
jmp open_file_f4
|
||||
.ctrl:
|
||||
cmp [select_panel_counter],1
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je right_sort_type
|
||||
jmp left_sort_type
|
||||
;---------------------------------------------------------------------
|
||||
@@ -631,7 +360,7 @@ f_key_f5:
|
||||
je still
|
||||
jmp copy_file_f5
|
||||
.ctrl:
|
||||
cmp [select_panel_counter],1
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je right_sort_size
|
||||
jmp left_sort_size
|
||||
;---------------------------------------------------------------------
|
||||
@@ -647,7 +376,7 @@ f_key_f6:
|
||||
.shift:
|
||||
jmp still
|
||||
.ctrl:
|
||||
cmp [select_panel_counter],1
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je right_sort_date
|
||||
jmp left_sort_date
|
||||
;---------------------------------------------------------------------
|
||||
@@ -734,9 +463,87 @@ key_alt_down:
|
||||
;---------------------------------------------------------------------
|
||||
key_insert:
|
||||
cmp ah,82 ; Insert
|
||||
je mark_file
|
||||
jne @f
|
||||
.1:
|
||||
mov bx,8 ; mark file
|
||||
call fb_on_key
|
||||
jmp still
|
||||
@@:
|
||||
cmp ah,83
|
||||
je f_key_f8 ;delete_file
|
||||
key_end:
|
||||
jmp still
|
||||
;---------------------------------------------------------------------
|
||||
;in:
|
||||
; ax - key
|
||||
; bx - 1...12
|
||||
align 4
|
||||
fb_on_key:
|
||||
shr ax,8
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je .right_1
|
||||
mov [fb_left.key_action],bx
|
||||
mov [fb_left.key_action_num],ax
|
||||
stdcall [FileBrowser_key], fb_left
|
||||
call sb_left_update
|
||||
ret
|
||||
.right_1:
|
||||
mov [fb_right.key_action],bx
|
||||
mov [fb_right.key_action_num],ax
|
||||
stdcall [FileBrowser_key], fb_right
|
||||
call sb_right_update
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
;in:
|
||||
; ax - key
|
||||
; bx - 1...12
|
||||
; esi
|
||||
align 4
|
||||
fb_on_key_1:
|
||||
shr ax,8
|
||||
or esi,esi
|
||||
jnz .right_1
|
||||
mov [fb_left.key_action],bx
|
||||
mov [fb_left.key_action_num],ax
|
||||
stdcall [FileBrowser_key], fb_left
|
||||
call sb_left_update
|
||||
ret
|
||||
.right_1:
|
||||
mov [fb_right.key_action],bx
|
||||
mov [fb_right.key_action_num],ax
|
||||
stdcall [FileBrowser_key], fb_right
|
||||
call sb_right_update
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
sb_left_update:
|
||||
cmp [fb_left.draw_scroll_bar],0
|
||||
je @f
|
||||
mov eax,[fb_left.start_draw_line]
|
||||
mov [sb_left.position],eax
|
||||
;mov eax,[sb_left.max_area]
|
||||
;cmp eax,[sb_left.cur_area]
|
||||
;jbe @f
|
||||
;cmp [sb_left.cur_area],0
|
||||
;je @f
|
||||
stdcall [scrollbar_v_draw], sb_left
|
||||
mov [fb_left.draw_scroll_bar],0
|
||||
@@:
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
sb_right_update:
|
||||
cmp [fb_right.draw_scroll_bar],0
|
||||
je @f
|
||||
mov eax,[fb_right.start_draw_line]
|
||||
mov [sb_right.position],eax
|
||||
;mov eax,[sb_right.max_area]
|
||||
;cmp eax,[sb_right.cur_area]
|
||||
;jbe @f
|
||||
;cmp [sb_right.cur_area],0
|
||||
;je @f
|
||||
stdcall [scrollbar_v_draw], sb_right
|
||||
mov [fb_right.draw_scroll_bar],0
|
||||
@@:
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
+708
-125
@@ -3,7 +3,7 @@
|
||||
|
||||
;*****************************************************************************
|
||||
; KFM - Kolibri File Manager
|
||||
; Copyright (c) 2006 - 2014, Marat Zakiyanov aka Mario79, aka Mario
|
||||
; Copyright (c) 2006 - 2026, Marat Zakiyanov aka Mario79, aka Mario
|
||||
; All rights reserved.
|
||||
;
|
||||
; Redistribution and use in source and binary forms, with or without
|
||||
@@ -28,55 +28,114 @@
|
||||
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
;*****************************************************************************
|
||||
; KFM v0.48d 23/12/2021
|
||||
; KFM v0.49 05/10/2026
|
||||
;---------------------------------------------------------------------
|
||||
use32
|
||||
org 0x0
|
||||
|
||||
db 'MENUET01'
|
||||
dd 0x01
|
||||
dd START
|
||||
dd I_END
|
||||
dd mem
|
||||
dd stacktop
|
||||
dd 0x0
|
||||
dd path
|
||||
db 'MENUET01'
|
||||
dd 1, START, I_END, mem, stacktop, 0, path
|
||||
|
||||
;include 'lang.inc'
|
||||
;include 'kglobals.inc'
|
||||
;include 'macros.inc'
|
||||
include '../../proc32.inc'
|
||||
include '../../macros.inc'
|
||||
include '../../config.inc' ;for nightbuild
|
||||
;include '../../debug.inc' ;for nightbuild
|
||||
include '../../KOSfuncs.inc'
|
||||
|
||||
;define __DEBUG__ 1
|
||||
;define __DEBUG_LEVEL__ 1
|
||||
;include '../../debug-fdo.inc'
|
||||
include '../../load_lib.mac'
|
||||
include '../../develop/libraries/box_lib/box_lib.mac'
|
||||
|
||||
USE_STATIC_LIBS equ 0
|
||||
|
||||
F_BUT_PANEL_H equ 23
|
||||
FILE_BR_TOP_LINE equ F_BUT_PANEL_H+52
|
||||
FILE_BR_SEL_DR_W equ 60
|
||||
FILE_BR_COL_LEFT equ 60+15 ;ширина списка + отступ до кнопки name
|
||||
file_br_col_w1 dd ? ;name
|
||||
FILE_BR_COL_W2 equ 45 ;type
|
||||
FILE_BR_COL_W3 equ 45 ;size
|
||||
FILE_BR_COL_W4 equ 70 ;date
|
||||
|
||||
ICON_TOP_B = 1 ; top border
|
||||
ICON_BOT_B = 1
|
||||
ICON_LEFT_B = 1 ; left border
|
||||
ICON_RIGHT_B = 1
|
||||
BUTTON_SIZE_W = (18+ICON_LEFT_B+ICON_RIGHT_B)
|
||||
BUTTON_SIZE_H = (18+ICON_TOP_B+ICON_BOT_B)
|
||||
BUTTON_W_SP = (BUTTON_SIZE_W+6)
|
||||
ICON_SIZE = BUTTON_SIZE_W*BUTTON_SIZE_H*3
|
||||
|
||||
include 'editbox.inc'
|
||||
;use_edit_box
|
||||
use_edit_box procinfo
|
||||
;include 'ASCGL.INC'
|
||||
;---------------------------------------------------------------------
|
||||
include 'files.inc'
|
||||
;---------------------------------------------------------------------
|
||||
STRLEN = 1024
|
||||
|
||||
@use_library
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
START:
|
||||
mcall 9,procinfo,-1
|
||||
mov ecx,[ebx+30] ; PID
|
||||
mcall 18,21
|
||||
mov [active_process],eax ; WINDOW SLOT
|
||||
mov [appl_memory],mem
|
||||
load_libraries l_libs_start,end_l_libs
|
||||
purge copy_path
|
||||
|
||||
if USE_STATIC_LIBS eq 0
|
||||
cmp [library01.status_lib],0 ;boxlib
|
||||
jnz exit_apl.t_p
|
||||
end if
|
||||
cmp [library02.status_lib],0 ;sort
|
||||
jz @f
|
||||
mov [sort_init], f_null_1
|
||||
mov [sort_dir], f_null_3
|
||||
@@:
|
||||
cmp [library03.status_lib],0 ;menu
|
||||
jz @f
|
||||
mov [kmainmenu_dispatch_cursorevent], f_null_1
|
||||
mov [kmainmenu_draw], f_null_1
|
||||
@@:
|
||||
|
||||
stdcall [sort_init], 1
|
||||
mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors
|
||||
mcall SF_SYS_MISC, SSF_MEM_OPEN, str_icon_18,, 0
|
||||
mov [fb_left.icon_raw_area],eax
|
||||
mov [fb_left.resolution_raw],32
|
||||
mov [fb_right.icon_raw_area],eax
|
||||
mov [fb_right.resolution_raw],32
|
||||
|
||||
if USE_STATIC_LIBS eq 0
|
||||
; read icons
|
||||
mcall SF_SYS_MISC, SSF_MEM_OPEN, str_icon_18w,, 0
|
||||
or eax, eax
|
||||
jz @f
|
||||
mov [icons_max_size], edx
|
||||
mov esi, eax
|
||||
stdcall copy_icon, buttons_file_data,esi,1
|
||||
stdcall copy_icon, eax,esi,66
|
||||
stdcall copy_icon, eax,esi,0
|
||||
stdcall copy_icon, eax,esi,20
|
||||
stdcall copy_icon, eax,esi,31 ;30?
|
||||
stdcall copy_icon, eax,esi,55
|
||||
stdcall copy_icon, eax,esi,56
|
||||
stdcall copy_icon, eax,esi,67
|
||||
end if
|
||||
|
||||
mcall SF_THREAD_INFO, procinfo,-1
|
||||
mov ecx,[procinfo.PID]
|
||||
mcall SF_SYSTEM, SSF_GET_THREAD_SLOT
|
||||
mov [active_process],eax ; WINDOW SLOT
|
||||
|
||||
mov ax,[select_disk_char]
|
||||
mov [read_folder_name],ax
|
||||
mov [read_folder_1_name],ax
|
||||
call load_initiation_file
|
||||
|
||||
call init_menu
|
||||
call add_memory_for_folders
|
||||
call device_detect_f70
|
||||
call select_starting_directories
|
||||
mcall 66, 1, 1
|
||||
mov eax,1
|
||||
mcall SF_KEYBOARD, SSF_SET_INPUT_MODE, 1
|
||||
mov eax,2
|
||||
mov [left_sort_flag],eax
|
||||
mov [right_sort_flag],eax
|
||||
|
||||
@@ -103,9 +162,10 @@ START:
|
||||
cmp eax,6
|
||||
jne read_folder_1_error
|
||||
@@:
|
||||
mcall 40, 0x27
|
||||
mcall SF_SET_EVENTS_MASK, EVM_MOUSE + EVM_BUTTON + EVM_KEY + EVM_REDRAW
|
||||
jmp red_1
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
red:
|
||||
call get_window_param
|
||||
test [window_status],10b
|
||||
@@ -115,33 +175,35 @@ red:
|
||||
cmp [window_high],180
|
||||
ja @f
|
||||
mov esi,180
|
||||
mcall 67,-1,ebx,ebx
|
||||
mcall SF_CHANGE_WINDOW, -1,ebx,ebx
|
||||
@@:
|
||||
cmp [window_width],495
|
||||
ja red_1
|
||||
mov edx,495
|
||||
mcall 67,-1,ebx, ,ebx
|
||||
mcall SF_CHANGE_WINDOW, -1,ebx, ,ebx
|
||||
red_1:
|
||||
call draw_window
|
||||
;---------------------------------------------------------------------
|
||||
align 16
|
||||
still:
|
||||
mcall 10
|
||||
mcall SF_WAIT_EVENT
|
||||
|
||||
call check_active_process_for_clear_all_flags
|
||||
|
||||
cmp eax,1
|
||||
cmp eax,EV_REDRAW
|
||||
je red
|
||||
cmp eax,2
|
||||
cmp eax,EV_KEY
|
||||
je key
|
||||
cmp eax,3
|
||||
cmp eax,EV_BUTTON
|
||||
je button
|
||||
cmp eax,6
|
||||
cmp eax,EV_MOUSE
|
||||
je mouse
|
||||
jmp still
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
check_active_process_for_clear_all_flags:
|
||||
push eax
|
||||
mcall 18,7
|
||||
mcall SF_SYSTEM, SSF_GET_ACTIVE_WINDOW
|
||||
cmp [active_process],eax
|
||||
je .exit
|
||||
|
||||
@@ -166,43 +228,33 @@ check_active_process_for_clear_all_flags:
|
||||
pop eax
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
get_window_param:
|
||||
mcall 9, procinfo, -1
|
||||
mov eax,[ebx+46]
|
||||
mcall SF_THREAD_INFO, procinfo, -1
|
||||
mov eax,[procinfo.box.height]
|
||||
mov [window_high],eax
|
||||
mov eax,[ebx+42]
|
||||
mov eax,[procinfo.box.width]
|
||||
mov [window_width],eax
|
||||
mov eax,[ebx+70]
|
||||
mov [window_status],eax
|
||||
mcall 48,4
|
||||
mov al,[procinfo.wnd_state]
|
||||
mov [window_status],al
|
||||
mcall SF_STYLE_SETTINGS, SSF_GET_SKIN_HEIGHT
|
||||
mov [skin_high],eax
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
draw_window:
|
||||
mcall 12, 1
|
||||
xor esi,esi
|
||||
mcall 0, <20,728>, <20,460>, 0x43cccccc ; 0x805080D0, 0x005080D0
|
||||
mcall SF_REDRAW, SSF_BEGIN_DRAW
|
||||
xor esi,esi
|
||||
mcall SF_CREATE_WINDOW, <20,728>, <20,460>, 0x63cccccc ; 0x805080D0, 0x005080D0
|
||||
call get_window_param
|
||||
|
||||
mcall 71, 1, header_text
|
||||
mcall SF_SET_CAPTION, 1, header_text
|
||||
|
||||
test [window_status],100b ; window is rolled up
|
||||
jnz .exit
|
||||
test [window_status],100b ; window is rolled up
|
||||
jnz .exit
|
||||
|
||||
test [window_status],10b ; window is minimized to panel
|
||||
jnz .exit
|
||||
|
||||
; create_dir_name
|
||||
; start_parameter
|
||||
; file_name
|
||||
; [temp_edi]
|
||||
; header
|
||||
; delete_file_data.name
|
||||
; start_file_data.name
|
||||
; start_parameter
|
||||
; start_file_data.name
|
||||
; read_icon_file.name
|
||||
; read_file_features.name ;path ;header
|
||||
test [window_status],10b ; window is minimized to panel
|
||||
jnz .exit
|
||||
|
||||
cmp [window_high],180
|
||||
jb .exit
|
||||
@@ -220,66 +272,159 @@ draw_window:
|
||||
call draw_menu_bar
|
||||
call draw_buttons_panel
|
||||
.exit:
|
||||
mcall 12, 2
|
||||
mcall SF_REDRAW, SSF_END_DRAW
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
prepare_load_data:
|
||||
mov esi,path
|
||||
align 4
|
||||
load_initiation_file:
|
||||
mov esi,ini_file_name
|
||||
mov edi,file_name
|
||||
call copy_path
|
||||
call proc_copy_patch
|
||||
call get_file_size
|
||||
test eax,eax
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
prepare_load_data_1:
|
||||
mov [read_file.return],eax
|
||||
mov ebp,eax
|
||||
prepare_load_data_4:
|
||||
call load_file
|
||||
test eax,eax
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
prepare_load_data_2:
|
||||
call add_application_memory
|
||||
prepare_load_data_3:
|
||||
call add_application_memory
|
||||
mov eax,[file_features_temp_area+32]
|
||||
mov [read_file.size],eax
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
load_initiation_file:
|
||||
mov ebx,ini_file_name
|
||||
call prepare_load_data
|
||||
jnz initiation_error
|
||||
call prepare_load_data_3
|
||||
mov eax,[appl_memory]
|
||||
mov [left_folder_data],eax
|
||||
sub eax,[read_file.size]
|
||||
mov [read_file.return],eax
|
||||
jnz .err_msg
|
||||
mov ecx,[file_features_temp_area+32]
|
||||
or ecx,ecx
|
||||
jz .err_msg
|
||||
push edx
|
||||
mcall SF_SYS_MISC, SSF_MEM_REALLOC,, [ini_file_start]
|
||||
mov [ini_file_start],eax
|
||||
mov [ini_size],ecx
|
||||
mov [read_file.return],eax
|
||||
mov [read_file.size],ecx
|
||||
pop edx
|
||||
call load_file
|
||||
test eax,eax
|
||||
jnz initiation_error
|
||||
mov ebp,icons_associations
|
||||
call search_star_and_end_tags
|
||||
mov eax,[end_tag]
|
||||
mov [icons_end_tag],eax
|
||||
jnz .err_msg
|
||||
call calc_ini
|
||||
jmp @f
|
||||
.err_msg:
|
||||
notify_window_run error_open_ini_file
|
||||
@@:
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
add_memory_for_folders:
|
||||
mov ecx,[appl_memory]
|
||||
add ecx,304*32+32
|
||||
mov [right_folder_data],ecx
|
||||
add ecx,304*32+32
|
||||
mov [appl_memory],ecx
|
||||
mcall 64,1
|
||||
align 4
|
||||
calc_ini:
|
||||
; Convert the new "ID=ext,ext,..." icons18 layout from the loaded ini file into
|
||||
; the "ext=ID" CR/LF text that box_lib's FileBrowser expects, storing the result
|
||||
; in converted_ini_buffer. Every scan is bounded by ini_src_end, so a truncated
|
||||
; or malformed file can never read past the loaded buffer (it has no 0 terminator).
|
||||
pusha
|
||||
mov esi, [ini_file_start]
|
||||
mov eax, esi
|
||||
add eax, [ini_size]
|
||||
mov [ini_src_end], eax
|
||||
mov edi, converted_ini_buffer
|
||||
mov [fb_left.ini_file_start], edi
|
||||
mov [fb_right.ini_file_start], edi
|
||||
|
||||
mov eax,[left_folder_data]
|
||||
; find the "[icons18]" section header
|
||||
.find_section:
|
||||
cmp esi, [ini_src_end]
|
||||
jae .finished
|
||||
lodsb
|
||||
cmp al, '['
|
||||
jne .find_section
|
||||
cmp dword [esi], 'icon'
|
||||
jne .find_section
|
||||
.skip_header:
|
||||
cmp esi, [ini_src_end]
|
||||
jae .finished
|
||||
lodsb
|
||||
cmp al, 10
|
||||
jne .skip_header
|
||||
|
||||
; convert each "ID=ext,ext,..." line until the next section or EOF
|
||||
.parse_line:
|
||||
cmp esi, [ini_src_end]
|
||||
jae .finished
|
||||
cmp byte [esi], '['
|
||||
je .finished
|
||||
mov edx, esi ; edx = ID start
|
||||
.find_eq:
|
||||
cmp esi, [ini_src_end]
|
||||
jae .finished
|
||||
lodsb
|
||||
cmp al, '='
|
||||
jne .find_eq
|
||||
lea ebx, [esi-1]
|
||||
sub ebx, edx ; ebx = ID length
|
||||
|
||||
.next_ext:
|
||||
mov ebp, esi ; ebp = extension start
|
||||
.scan_ext:
|
||||
cmp esi, [ini_src_end]
|
||||
jae .finished
|
||||
lodsb
|
||||
cmp al, ','
|
||||
je .ext_sep
|
||||
cmp al, 13
|
||||
je .ext_eol
|
||||
cmp al, 10
|
||||
je .ext_eol
|
||||
jmp .scan_ext
|
||||
.ext_sep:
|
||||
call .emit_ext
|
||||
jmp .next_ext
|
||||
.ext_eol:
|
||||
call .emit_ext
|
||||
.skip_eol: ; absorb the whole CR/LF run (and blank lines)
|
||||
cmp esi, [ini_src_end]
|
||||
jae .finished
|
||||
lodsb
|
||||
cmp al, 13
|
||||
je .skip_eol
|
||||
cmp al, 10
|
||||
je .skip_eol
|
||||
dec esi
|
||||
jmp .parse_line
|
||||
|
||||
.finished:
|
||||
mov [fb_left.ini_file_end], edi
|
||||
mov [fb_right.ini_file_end], edi
|
||||
popa
|
||||
ret
|
||||
|
||||
; Emit one "ext=ID\r\n" record. esi-1 = delimiter just consumed, ebp = ext start,
|
||||
; edx/ebx = ID start/length. Empty extensions are skipped, esi is preserved.
|
||||
.emit_ext:
|
||||
push esi
|
||||
lea ecx, [esi-1]
|
||||
sub ecx, ebp ; ecx = extension length
|
||||
jecxz .emit_done ; drop empty extension
|
||||
mov esi, ebp
|
||||
rep movsb ; ext
|
||||
mov al, '='
|
||||
stosb
|
||||
mov esi, edx
|
||||
mov ecx, ebx
|
||||
rep movsb ; ID
|
||||
mov ax, 0x0A0D
|
||||
stosw ; CR, LF
|
||||
.emit_done:
|
||||
pop esi
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
add_memory_for_folders:
|
||||
mov ecx,304*32+32
|
||||
mov [lfd_size],ecx
|
||||
mov [rfd_size],ecx
|
||||
mcall SF_SYS_MISC, SSF_MEM_ALLOC
|
||||
mov [fb_left.folder_data],eax
|
||||
mov [read_folder.return],eax
|
||||
mov eax,[right_folder_data]
|
||||
mcall SF_SYS_MISC, SSF_MEM_ALLOC
|
||||
mov [fb_right.folder_data],eax
|
||||
mov [read_folder_1.return],eax
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
;in:
|
||||
; ebx - file name1
|
||||
; edi - buffer
|
||||
; esi - file path + '/' + file name0
|
||||
;out:
|
||||
; edi = file path + '/' + file name1
|
||||
align 4
|
||||
copy_path:
|
||||
xor eax,eax
|
||||
@@:
|
||||
@@ -305,6 +450,13 @@ copy_path:
|
||||
jnz @b
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
;in:
|
||||
; ebx - file name
|
||||
; edi - buffer
|
||||
; esi - file path
|
||||
;out:
|
||||
; edi = file path + '/' + file name
|
||||
align 4
|
||||
copy_path_1:
|
||||
xor eax,eax
|
||||
@@:
|
||||
@@ -323,28 +475,13 @@ copy_path_1:
|
||||
jnz @b
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
add_application_memory:
|
||||
mov ecx,[file_features_temp_area+32]
|
||||
.1:
|
||||
add ecx,[appl_memory]
|
||||
mov [appl_memory],ecx
|
||||
mcall 64,1
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
sub_application_memory:
|
||||
mov ecx,[appl_memory]
|
||||
sub ecx,[file_features_temp_area+32]
|
||||
.1:
|
||||
mov [appl_memory],ecx
|
||||
mcall 64,1
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
exit_apl:
|
||||
mov [confirmation_type],exit_type
|
||||
call confirmation_action
|
||||
cmp [work_confirmation_yes],1
|
||||
jne red
|
||||
mcall -1
|
||||
.t_p:
|
||||
mcall SF_TERMINATE_PROCESS
|
||||
;---------------------------------------------------------------------
|
||||
include 'key.inc'
|
||||
;---------------------------------------------------------------------
|
||||
@@ -388,15 +525,461 @@ include 'sort.inc'
|
||||
;---------------------------------------------------------------------
|
||||
include 'progrbar.inc'
|
||||
;---------------------------------------------------------------------
|
||||
include 'scroll.inc'
|
||||
;---------------------------------------------------------------------
|
||||
include 'file_inf.inc'
|
||||
;---------------------------------------------------------------------
|
||||
include 'text.inc'
|
||||
;---------------------------------------------------------------------
|
||||
;include_debug_strings
|
||||
plugins_directory db 0
|
||||
|
||||
system_dir_Boxlib db '/sys/lib/box_lib.obj',0
|
||||
system_dir_Sort db '/sys/lib/sort.obj',0
|
||||
system_dir_Kmenu db '/sys/lib/kmenu.obj',0
|
||||
|
||||
align 4
|
||||
l_libs_start:
|
||||
if USE_STATIC_LIBS eq 0
|
||||
library01 l_libs system_dir_Boxlib+9,file_name,system_dir_Boxlib,\
|
||||
import_box_lib,plugins_directory
|
||||
end if
|
||||
|
||||
library02 l_libs system_dir_Sort+9,file_name,system_dir_Sort,\
|
||||
Sort_import,plugins_directory
|
||||
|
||||
library03 l_libs system_dir_Kmenu+9,file_name,system_dir_Kmenu,\
|
||||
import_libkmenu,plugins_directory
|
||||
end_l_libs:
|
||||
|
||||
if USE_STATIC_LIBS eq 0
|
||||
include '../../develop/libraries/box_lib/import.inc'
|
||||
else
|
||||
include '../../develop/libraries/box_lib/keys.inc'
|
||||
include '../../develop/libraries/box_lib/editbox.asm'
|
||||
include '../../develop/libraries/box_lib/scrollbar.asm'
|
||||
include '../../develop/libraries/box_lib/filebrowser.asm'
|
||||
scrollbar_v_draw dd scroll_bar_vertical.draw
|
||||
scrollbar_v_mouse dd scroll_bar_vertical.mouse
|
||||
FileBrowser_draw dd fb_draw_panel
|
||||
FileBrowser_mouse dd fb_mouse
|
||||
FileBrowser_key dd fb_key
|
||||
end if
|
||||
|
||||
align 4
|
||||
f_null_3:
|
||||
ret 8
|
||||
align 4
|
||||
f_null_1:
|
||||
ret 4
|
||||
|
||||
align 4
|
||||
proc draw_edge uses eax ebx ecx edx edi esi, box_l:dword, box_t:dword, box_w:dword, box_h:dword,\
|
||||
col_0:dword, col_1:dword, col_2:dword
|
||||
|
||||
mov esi,[col_1]
|
||||
and esi,111111101111111011111110b
|
||||
|
||||
mov eax,SF_DRAW_RECT
|
||||
;bottom line
|
||||
mov edx,[col_2]
|
||||
mov ebx,[box_l]
|
||||
shl ebx,16
|
||||
add ebx,[box_w]
|
||||
inc ebx ;для заливки диагональных пикселей
|
||||
mov ecx,[box_t]
|
||||
add ecx,[box_h]
|
||||
shl ecx,16
|
||||
inc ecx
|
||||
|
||||
mov edi,3 ;for cycle
|
||||
@@:
|
||||
;calculate colors
|
||||
and edx,111111101111111011111110b
|
||||
add edx,esi
|
||||
shr edx,1
|
||||
;line move up and ->...<-
|
||||
sub ecx,1 shl 16 ;move up
|
||||
add ebx,1 shl 16 ;->...
|
||||
sub ebx,2 ;...<-
|
||||
;draw line
|
||||
int 0x40
|
||||
dec edi
|
||||
jnz @b
|
||||
|
||||
;right line
|
||||
mov edx,[col_2]
|
||||
mov ebx,[box_l]
|
||||
add ebx,[box_w]
|
||||
shl ebx,16
|
||||
inc ebx
|
||||
mov ecx,[box_t]
|
||||
shl ecx,16
|
||||
add ecx,[box_h]
|
||||
|
||||
mov edi,3 ;for cycle
|
||||
@@:
|
||||
;calculate colors
|
||||
and edx,111111101111111011111110b
|
||||
add edx,esi
|
||||
shr edx,1
|
||||
;line move left and ...
|
||||
sub ebx,1 shl 16 ;move left
|
||||
add ecx,1 shl 16
|
||||
sub ecx,2
|
||||
;draw line
|
||||
int 0x40
|
||||
dec edi
|
||||
jnz @b
|
||||
|
||||
;top line
|
||||
mov edx,[col_0]
|
||||
mov ebx,[box_l]
|
||||
shl ebx,16
|
||||
add ebx,[box_w]
|
||||
mov ecx,[box_t]
|
||||
shl ecx,16
|
||||
inc ecx
|
||||
|
||||
mov edi,3 ;for cycle
|
||||
@@:
|
||||
;calculate colors
|
||||
and edx,111111101111111011111110b
|
||||
add edx,esi
|
||||
shr edx,1
|
||||
;line move down and ->...<-
|
||||
add ecx,1 shl 16 ;move down
|
||||
add ebx,1 shl 16 ;->...
|
||||
sub ebx,2 ;...<-
|
||||
;draw line
|
||||
int 0x40
|
||||
dec edi
|
||||
jnz @b
|
||||
|
||||
;left line
|
||||
mov edx,[col_0]
|
||||
mov ebx,[box_l]
|
||||
shl ebx,16
|
||||
inc ebx
|
||||
mov ecx,[box_t]
|
||||
shl ecx,16
|
||||
add ecx,[box_h]
|
||||
|
||||
mov edi,3 ;for cycle
|
||||
@@:
|
||||
;calculate colors
|
||||
and edx,111111101111111011111110b
|
||||
add edx,esi
|
||||
shr edx,1
|
||||
;line move left and ...
|
||||
add ebx,1 shl 16 ;move left
|
||||
add ecx,1 shl 16
|
||||
sub ecx,2
|
||||
;draw line
|
||||
int 0x40
|
||||
dec edi
|
||||
jnz @b
|
||||
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
Sort_import:
|
||||
sort_init dd aSort_init
|
||||
sort_version dd aSort_version
|
||||
sort_dir dd aSort_SortDir
|
||||
sort_strcmpi dd aSort_strcmpi
|
||||
dd 0,0
|
||||
aSort_init db 'START',0
|
||||
aSort_version db 'version',0
|
||||
aSort_SortDir db 'SortDir',0
|
||||
aSort_strcmpi db 'strcmpi',0
|
||||
|
||||
align 4
|
||||
import_libkmenu:
|
||||
kmenu_init dd akmenu_init
|
||||
kmainmenu_draw dd akmainmenu_draw
|
||||
kmainmenu_dispatch_cursorevent dd akmainmenu_dispatch_cursorevent
|
||||
ksubmenu_new dd aksubmenu_new
|
||||
ksubmenu_delete dd aksubmenu_delete
|
||||
ksubmenu_draw dd aksubmenu_draw
|
||||
ksubmenu_add dd aksubmenu_add
|
||||
kmenuitem_new dd akmenuitem_new
|
||||
kmenuitem_delete dd akmenuitem_delete
|
||||
kmenuitem_draw dd akmenuitem_draw
|
||||
dd 0,0
|
||||
akmenu_init db 'kmenu_init',0
|
||||
akmainmenu_draw db 'kmainmenu_draw',0
|
||||
akmainmenu_dispatch_cursorevent db 'kmainmenu_dispatch_cursorevent',0
|
||||
aksubmenu_new db 'ksubmenu_new',0
|
||||
aksubmenu_delete db 'ksubmenu_delete',0
|
||||
aksubmenu_draw db 'ksubmenu_draw',0
|
||||
aksubmenu_add db 'ksubmenu_add',0
|
||||
akmenuitem_new db 'kmenuitem_new',0
|
||||
akmenuitem_delete db 'kmenuitem_delete',0
|
||||
akmenuitem_draw db 'kmenuitem_draw',0
|
||||
|
||||
;in:
|
||||
; buf_d = pointer to destination buffer 24-bit
|
||||
; buf_s = pointer to source buffer 32-bit (with icons)
|
||||
; ind = icon index
|
||||
;out:
|
||||
; eax = pointer to destination buffer + icon size
|
||||
align 4
|
||||
proc copy_icon uses ebx ecx esi edi, buf_d:dword, buf_s:dword, ind:dword
|
||||
mov edi,[buf_d]
|
||||
mov esi,[ind]
|
||||
imul esi,18*18*4
|
||||
cmp esi,[icons_max_size]
|
||||
jge .quit
|
||||
; fill the whole button area with sc.work:
|
||||
; write the first pixel, then propagate the 3-byte pattern with overlapping movsb
|
||||
mov eax,[sc.work_light]
|
||||
mov [edi],ax ; B, G
|
||||
shr eax,16
|
||||
mov [edi+2],al ; R
|
||||
push esi
|
||||
mov esi,edi
|
||||
add edi,3
|
||||
mov ecx,ICON_SIZE-3
|
||||
rep movsb
|
||||
pop esi
|
||||
; copy icon into the center
|
||||
add esi,[buf_s]
|
||||
mov edi,[buf_d]
|
||||
add edi,(BUTTON_SIZE_W*ICON_TOP_B+ICON_LEFT_B)*3
|
||||
mov ebx,18
|
||||
.cycle0:
|
||||
mov ecx,18
|
||||
.cycle1:
|
||||
cmp byte[esi+3],255
|
||||
je @f
|
||||
add edi,3 ;skip
|
||||
add esi,4
|
||||
loop .cycle1
|
||||
jmp .cycle1e
|
||||
@@:
|
||||
movsw ;copy
|
||||
movsb
|
||||
inc esi ; skip transparent byte
|
||||
loop .cycle1
|
||||
.cycle1e:
|
||||
add edi,(ICON_RIGHT_B+ICON_LEFT_B)*3
|
||||
dec ebx
|
||||
jnz .cycle0
|
||||
|
||||
; draw shadow 1
|
||||
mov eax,[sc.work]
|
||||
mov esi,[ind]
|
||||
imul esi,18*18*4
|
||||
add esi,(18+1)*4
|
||||
add esi,[buf_s]
|
||||
mov edi,[buf_d]
|
||||
add edi,(BUTTON_SIZE_W*(ICON_TOP_B+1)+ICON_LEFT_B+1)*3
|
||||
mov ebx,18-1
|
||||
.cycle2:
|
||||
mov ecx,18-1
|
||||
.cycle3:
|
||||
cmp byte[esi+3],255
|
||||
je @f
|
||||
cmp byte[esi+3-(18+1)*4],255
|
||||
jne @f
|
||||
stosw
|
||||
stosb
|
||||
jmp .1
|
||||
@@:
|
||||
add edi,3
|
||||
.1:
|
||||
add esi,4
|
||||
loop .cycle3
|
||||
add edi,(ICON_RIGHT_B+ICON_LEFT_B+1)*3
|
||||
add esi,4
|
||||
dec ebx
|
||||
jnz .cycle2
|
||||
|
||||
; draw shadow 2
|
||||
;mov eax,[sc.work]
|
||||
mov edi,[buf_d]
|
||||
add edi,(BUTTON_SIZE_W*(ICON_TOP_B+1)+ICON_LEFT_B+1)*3
|
||||
mov esi,[ind]
|
||||
imul esi,18*18*4
|
||||
add esi,[buf_s]
|
||||
mov ebx,18
|
||||
.cycle4:
|
||||
mov ecx,18
|
||||
.cycle5:
|
||||
cmp ebx,1
|
||||
jle .2
|
||||
cmp ecx,1
|
||||
jg @f
|
||||
.2:
|
||||
cmp byte[esi+3],255
|
||||
jne @f
|
||||
stosw
|
||||
stosb
|
||||
jmp .3
|
||||
@@:
|
||||
add edi,3
|
||||
.3:
|
||||
add esi,4
|
||||
loop .cycle5
|
||||
add edi,(ICON_RIGHT_B+ICON_LEFT_B)*3
|
||||
dec ebx
|
||||
jnz .cycle4
|
||||
|
||||
.quit:
|
||||
mov eax,[buf_d]
|
||||
add eax,ICON_SIZE
|
||||
ret
|
||||
endp
|
||||
|
||||
str_icon_18 db 'ICONS18',0
|
||||
|
||||
if USE_STATIC_LIBS eq 0
|
||||
numimages = 8
|
||||
str_icon_18w db 'ICONS18W',0
|
||||
end if
|
||||
|
||||
align 4
|
||||
fb_left:
|
||||
.type dd 0 ;+0
|
||||
.x:
|
||||
.size_x dw 400 ;+4
|
||||
.start_x dw 10 ;+6
|
||||
.y:
|
||||
.size_y dw 550 ;+8
|
||||
.start_y dw FILE_BR_TOP_LINE ;+10
|
||||
.icon_size_y dw 18 ; +12
|
||||
.icon_size_x dw 18 ; +14
|
||||
.line_size_x dw 0 ; +16
|
||||
.line_size_y dw 18+1 ; +18
|
||||
.type_size_x dw 0 ; +20
|
||||
.size_size_x dw 0 ; +22
|
||||
.date_size_x dw 0 ; +24
|
||||
.attributes_size_x dw 0 ; +26
|
||||
.icon_assoc_area dd 0 ; +28
|
||||
.icon_raw_area dd 0 ; +32
|
||||
.resolution_raw dd 0 ; +36
|
||||
.palette_raw dd 0 ; +40
|
||||
.directory_path_area dd 0 ; +44
|
||||
.file_name_area dd 0 ; +48
|
||||
.select_flag dd 0 ; +52
|
||||
.background_color dd 0xffffff ; +56
|
||||
.select_color dd 0xbbddff ; +60
|
||||
.seclect_text_color dd 0 ; +64
|
||||
.text_color dd 0 ; +68
|
||||
.reduct_text_color dd 0xff0000 ; +72
|
||||
.marked_text_color dd 0 ; +76
|
||||
.max_panel_line dd 0 ; +80
|
||||
.select_panel_counter dd 1 ; +84
|
||||
.folder_block dd 0 ; +88
|
||||
.start_draw_line dd 0 ; +92
|
||||
.start_draw_cursor_line dw 0 ; +96 ; pixels
|
||||
.folder_data dd 0 ; +98
|
||||
.temp_counter dd 0 ; +102
|
||||
.file_name_length dd 0 ; +106
|
||||
.marked_file dd 0 ; +110
|
||||
.extension_size dd 0 ; +114
|
||||
.extension_start dd 0 ; +118
|
||||
.type_table dd type_table ; +122
|
||||
.ini_file_start dd 0 ; +126
|
||||
.ini_file_end dd 0 ; +130
|
||||
.draw_scroll_bar dd 0 ; +134
|
||||
.font_size_y dw 9 ; +138
|
||||
.font_size_x dw 6 ; +140
|
||||
.mouse_keys dd 0 ; +142
|
||||
.mouse_keys_old dd 0 ; +146
|
||||
.mouse_pos dd 0 ; +150
|
||||
.mouse_keys_delta dd 0 ; +154
|
||||
.mouse_key_delay dd 50 ; +158
|
||||
.mouse_keys_tick dd 0 ; +162
|
||||
.start_draw_cursor_line_2 dw 0 ;+166
|
||||
.all_redraw dd 0 ;+168 0 - lines, 1 - all, 2 - folders+lines
|
||||
.selected_BDVK_adress dd 0 ;+172
|
||||
.key_action dw 0 ;+176
|
||||
.key_action_num dw 0 ;+178
|
||||
.name_temp_area dd name_temp_area ;+180
|
||||
.max_name_temp_size dd 0 ;+184
|
||||
.display_name_max_length dd 0 ;+188
|
||||
.draw_panel_selection_flag dd 0 ;+192
|
||||
.mouse_pos_old dd 0 ;+196
|
||||
.marked_counter dd 0 ;+200
|
||||
.keymap_pointer dd keymap_area ;+204
|
||||
|
||||
align 4
|
||||
fb_right:
|
||||
.type dd 0 ;+0
|
||||
.x:
|
||||
.size_x dw 400 ;+4
|
||||
.start_x dw 10 ;+6
|
||||
.y:
|
||||
.size_y dw 550 ;+8
|
||||
.start_y dw FILE_BR_TOP_LINE ;+10
|
||||
.icon_size_y dw 18 ; +12
|
||||
.icon_size_x dw 18 ; +14
|
||||
.line_size_x dw 0 ; +16
|
||||
.line_size_y dw 18+1 ; +18
|
||||
.type_size_x dw 0 ; +20
|
||||
.size_size_x dw 0 ; +22
|
||||
.date_size_x dw 0 ; +24
|
||||
.attributes_size_x dw 0 ; +26
|
||||
.icon_assoc_area dd 0 ; +28
|
||||
.icon_raw_area dd 0 ; +32
|
||||
.resolution_raw dd 0 ; +36
|
||||
.palette_raw dd 0 ; +40
|
||||
.directory_path_area dd 0 ; +44
|
||||
.file_name_area dd 0 ; +48
|
||||
.select_flag dd 0 ; +52
|
||||
.background_color dd 0xffffff ; +56
|
||||
.select_color dd 0xbbddff ; +60
|
||||
.seclect_text_color dd 0 ; +64
|
||||
.text_color dd 0 ; +68
|
||||
.reduct_text_color dd 0xff0000 ; +72
|
||||
.marked_text_color dd 0 ; +76
|
||||
.max_panel_line dd 0 ; +80
|
||||
.select_panel_counter dd 0 ; +84
|
||||
.folder_block dd 0 ; +88
|
||||
.start_draw_line dd 0 ; +92
|
||||
.start_draw_cursor_line dw 0 ; +96 ; pixels
|
||||
.folder_data dd 0 ; +98
|
||||
.temp_counter dd 0 ; +102
|
||||
.file_name_length dd 0 ; +106
|
||||
.marked_file dd 0 ; +110
|
||||
.extension_size dd 0 ; +114
|
||||
.extension_start dd 0 ; +118
|
||||
.type_table dd type_table ; +122
|
||||
.ini_file_start dd 0 ; +126
|
||||
.ini_file_end dd 0 ; +130
|
||||
.draw_scroll_bar dd 0 ; +134
|
||||
.font_size_y dw 9 ; +138
|
||||
.font_size_x dw 6 ; +140
|
||||
.mouse_keys dd 0 ; +142
|
||||
.mouse_keys_old dd 0 ; +146
|
||||
.mouse_pos dd 0 ; +150
|
||||
.mouse_keys_delta dd 0 ; +154
|
||||
.mouse_key_delay dd 50 ; +158
|
||||
.mouse_keys_tick dd 0 ; +162
|
||||
.start_draw_cursor_line_2 dw 0 ;+166
|
||||
.all_redraw dd 0 ;+168
|
||||
.selected_BDVK_adress dd 0 ;+172
|
||||
.key_action dw 0 ;+176
|
||||
.key_action_num dw 0 ;+178
|
||||
.name_temp_area dd name_temp_area ;+180
|
||||
.max_name_temp_size dd 0 ;+184
|
||||
.display_name_max_length dd 0 ;+188
|
||||
.draw_panel_selection_flag dd 0 ;+192
|
||||
.mouse_pos_old dd 0 ;+196
|
||||
.marked_counter dd 0 ;+200
|
||||
.keymap_pointer dd keymap_area ;+204
|
||||
|
||||
align 4
|
||||
mouse_scroll_data:
|
||||
.vertical rw 1
|
||||
.horizontal rw 1
|
||||
align 4
|
||||
sb_left scrollbar 15, 348, 200, FILE_BR_TOP_LINE, 16, 5, 1, 0, 0xeeeeee, 0xbbddff, 0, 1
|
||||
sb_right scrollbar 15, 708, 200, FILE_BR_TOP_LINE, 16, 5, 1, 0, 0xeeeeee, 0xbbddff, 0, 1
|
||||
|
||||
align 16
|
||||
I_END:
|
||||
;---------------------------------------------------------------------
|
||||
include 'data.inc'
|
||||
;---------------------------------------------------------------------
|
||||
mem:
|
||||
mem:
|
||||
+29
-140
@@ -1,158 +1,47 @@
|
||||
;---------------------------------------------------------------------
|
||||
mark_file:
|
||||
mov [marked_action],1
|
||||
cmp [select_panel_counter],0
|
||||
jne .right_1
|
||||
call calculate_left_data_1
|
||||
jmp .for_all
|
||||
.right_1:
|
||||
call calculate_right_data_1
|
||||
.for_all:
|
||||
add esi,32+299
|
||||
mov al,[esi]
|
||||
and al,1
|
||||
cmp [select_panel_counter],0
|
||||
jne .right_2
|
||||
test al,al
|
||||
jnz @f
|
||||
inc [left_marked_counter]
|
||||
jmp .for_all_1
|
||||
@@:
|
||||
dec [left_marked_counter]
|
||||
.for_all_1:
|
||||
mov al,[esi]
|
||||
inc al
|
||||
and al,1
|
||||
mov [esi],al
|
||||
jmp key_80.1
|
||||
.right_2:
|
||||
test al,al
|
||||
jnz @f
|
||||
inc [right_marked_counter]
|
||||
jmp .for_all_1
|
||||
@@:
|
||||
dec [right_marked_counter]
|
||||
jmp .for_all_1
|
||||
;---------------------------------------------------------------------
|
||||
;out:
|
||||
; esi = fb_left.folder_data + 304 *
|
||||
; * (fb_left.start_draw_line + fb_left.start_draw_cursor_line / fb_left.line_size_y)
|
||||
align 4
|
||||
calculate_left_data_1:
|
||||
xor eax,eax
|
||||
mov ax,[left_start_draw_cursor_line]
|
||||
movzx eax,[fb_left.start_draw_cursor_line]
|
||||
xor edx,edx
|
||||
mov ebx,10
|
||||
movzx ebx,[fb_left.line_size_y]
|
||||
div ebx
|
||||
mov esi,[left_start_draw_line]
|
||||
mov esi,[fb_left.start_draw_line]
|
||||
add esi,eax
|
||||
imul esi,304
|
||||
add esi,[left_folder_data]
|
||||
add esi,[fb_left.folder_data]
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
;out:
|
||||
; esi = fb_right.folder_data + 304 *
|
||||
; * (fb_right.start_draw_line + fb_right.start_draw_cursor_line / fb_right.line_size_y)
|
||||
align 4
|
||||
calculate_right_data_1:
|
||||
xor eax,eax
|
||||
mov ax,[right_start_draw_cursor_line]
|
||||
movzx eax,[fb_right.start_draw_cursor_line]
|
||||
xor edx,edx
|
||||
mov ebx,10
|
||||
movzx ebx,[fb_right.line_size_y]
|
||||
div ebx
|
||||
mov esi,[right_start_draw_line]
|
||||
mov esi,[fb_right.start_draw_line]
|
||||
add esi,eax
|
||||
imul esi,304
|
||||
add esi,[right_folder_data]
|
||||
add esi,[fb_right.folder_data]
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
mark_all_file:
|
||||
cmp [select_panel_counter],0
|
||||
jne .right_1
|
||||
mov ebp,[left_folder_block]
|
||||
.start:
|
||||
mov ebx,ebp
|
||||
dec ebx
|
||||
imul ebx,304
|
||||
add ebx,[left_folder_data]
|
||||
add ebx,32+40
|
||||
cmp [ebx],word '..'
|
||||
jne .continue
|
||||
cmp [ebx+2],byte 0
|
||||
je .continue_1
|
||||
.continue:
|
||||
call select_mark_action
|
||||
.continue_1:
|
||||
align 4
|
||||
proc mark_file_clear_all uses eax ecx edi, tmem:dword, tsize:dword
|
||||
xor al,al
|
||||
mov edi,[tmem]
|
||||
mov ecx,edi
|
||||
add ecx,[tsize]
|
||||
add edi,32+299
|
||||
cld
|
||||
@@:
|
||||
dec ebp
|
||||
jnz .start
|
||||
call draw_left_panel
|
||||
cmp [mark_action_counter],0
|
||||
jne @f
|
||||
mov eax,[left_folder_block]
|
||||
; dec eax
|
||||
; mov [left_marked_counter],eax
|
||||
; jmp still
|
||||
jmp .end
|
||||
@@:
|
||||
cmp [mark_action_counter],1
|
||||
jne @f
|
||||
mov [left_marked_counter],0
|
||||
jmp still
|
||||
@@:
|
||||
mov eax,[left_folder_block]
|
||||
sub eax,[left_marked_counter]
|
||||
.end:
|
||||
dec eax
|
||||
mov [left_marked_counter],eax
|
||||
jmp still
|
||||
.right_1:
|
||||
mov ebp,[right_folder_block]
|
||||
.start_1:
|
||||
mov ebx,ebp
|
||||
dec ebx
|
||||
imul ebx,304
|
||||
add ebx,[right_folder_data]
|
||||
add ebx,32+40
|
||||
cmp [ebx],word '..'
|
||||
jne .continue_2
|
||||
cmp [ebx+2],byte 0
|
||||
je .continue_3
|
||||
.continue_2:
|
||||
call select_mark_action
|
||||
.continue_3:
|
||||
@@:
|
||||
dec ebp
|
||||
jnz .start_1
|
||||
call draw_right_panel
|
||||
cmp [mark_action_counter],0
|
||||
jne @f
|
||||
mov eax,[right_folder_block]
|
||||
; dec eax
|
||||
; mov [right_marked_counter],eax
|
||||
; jmp still
|
||||
jmp .end_1
|
||||
@@:
|
||||
cmp [mark_action_counter],1
|
||||
jne @f
|
||||
mov [right_marked_counter],0
|
||||
jmp still
|
||||
@@:
|
||||
mov eax,[right_folder_block]
|
||||
sub eax,[right_marked_counter]
|
||||
.end_1:
|
||||
dec eax
|
||||
mov [right_marked_counter],eax
|
||||
jmp still
|
||||
;---------------------------------------------------------------------
|
||||
select_mark_action:
|
||||
add ebx,299-40
|
||||
cmp [mark_action_counter],0
|
||||
jne @f
|
||||
mov [ebx],byte 1
|
||||
jmp .continue
|
||||
@@:
|
||||
cmp [mark_action_counter],1
|
||||
jne @f
|
||||
mov [ebx],byte 0
|
||||
jmp .continue
|
||||
@@:
|
||||
mov al,[ebx]
|
||||
inc al
|
||||
and al,1
|
||||
mov [ebx],al
|
||||
.continue:
|
||||
stosb
|
||||
add edi,304-1
|
||||
cmp edi,ecx
|
||||
jl @b
|
||||
ret
|
||||
endp
|
||||
;---------------------------------------------------------------------
|
||||
+116
-21
@@ -1,40 +1,62 @@
|
||||
align 4
|
||||
main_menu dd 0
|
||||
main_menu_file dd 0
|
||||
main_menu_select dd 0
|
||||
main_menu_sort dd 0
|
||||
main_menu_help dd 0
|
||||
|
||||
KMENUITEM_NORMAL equ 0
|
||||
KMENUITEM_SUBMENU equ 1
|
||||
KMENUITEM_SEPARATOR equ 2
|
||||
|
||||
align 4
|
||||
draw_menu_bar:
|
||||
mov ecx,[skin_high]
|
||||
shl ecx,16
|
||||
mov cx,19
|
||||
pushad
|
||||
mov ecx,19
|
||||
mov ebx,[window_width]
|
||||
sub ebx,9
|
||||
add ebx,5 shl 16
|
||||
mcall 13,,,0xcccccc
|
||||
add ecx,37 shl 16
|
||||
mov cx,3
|
||||
mcall
|
||||
mcall SF_DRAW_RECT, ,,[sc.work]
|
||||
pushad
|
||||
cld
|
||||
stdcall [kmainmenu_draw], [main_menu]
|
||||
popad
|
||||
add ecx,(F_BUT_PANEL_H+19) shl 16
|
||||
mov cx,FILE_BR_TOP_LINE-F_BUT_PANEL_H-49
|
||||
mcall ; horizontal line before disk buttons
|
||||
push ecx
|
||||
add ecx,16 shl 16
|
||||
mcall
|
||||
ror ecx,16
|
||||
add cx,FILE_BR_TOP_LINE-F_BUT_PANEL_H-36
|
||||
ror ecx,16
|
||||
mov cx,3
|
||||
mcall ; horizontal line after disk buttons
|
||||
add ecx,16 shl 16
|
||||
mov cx,1
|
||||
mcall
|
||||
mcall ; horizontal line before sort buttons
|
||||
pop ecx
|
||||
add ecx,3 shl 16
|
||||
mov eax,[window_high]
|
||||
shr ecx,16
|
||||
add ecx,3
|
||||
mov eax,[window_high]
|
||||
sub eax,ecx
|
||||
sub eax,4
|
||||
shl ecx,16
|
||||
add ecx,eax
|
||||
mov bx,2
|
||||
sub ecx,33
|
||||
mcall 13
|
||||
sub ecx,[skin_high]
|
||||
mcall SF_DRAW_RECT ; left vertical line
|
||||
push ebx
|
||||
ror ebx,16
|
||||
mov bx,[right_panel_x.start_x]
|
||||
sub bx,2
|
||||
rol ebx,16
|
||||
movzx ebx,[fb_left.start_x]
|
||||
add bx,[fb_left.size_x]
|
||||
add bx,[sb_left.x_size]
|
||||
inc bx
|
||||
mov si,bx
|
||||
shl ebx,16
|
||||
add bx,[fb_right.start_x]
|
||||
sub bx,si
|
||||
push ecx
|
||||
sub ecx,13
|
||||
add ecx,13 shl 16
|
||||
mcall ; middle vertical line
|
||||
mcall ; middle vertical line
|
||||
pop ecx
|
||||
pop ebx
|
||||
mov ax,cx
|
||||
@@ -45,7 +67,80 @@ draw_menu_bar:
|
||||
mov eax,[window_width]
|
||||
mov bx,ax
|
||||
sub ebx,9
|
||||
mcall 13
|
||||
mcall SF_DRAW_RECT ; horizontal line before path to the current folder
|
||||
add ecx,15 shl 16
|
||||
mcall
|
||||
mcall ; horizontal line after path to the current folder
|
||||
popad
|
||||
ret
|
||||
|
||||
align 4
|
||||
init_menu:
|
||||
cmp [library03.status_lib],0 ; test load library
|
||||
jnz .end
|
||||
stdcall [kmenu_init], sc
|
||||
stdcall [ksubmenu_new]
|
||||
mov [main_menu], eax
|
||||
|
||||
stdcall [ksubmenu_new]
|
||||
mov [main_menu_file], eax
|
||||
stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_menu_Copy_file, 153
|
||||
stdcall [ksubmenu_add], [main_menu_file], eax
|
||||
stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_menu_Move_file, 154
|
||||
stdcall [ksubmenu_add], [main_menu_file], eax
|
||||
stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_menu_Create_dir, 152
|
||||
stdcall [ksubmenu_add], [main_menu_file], eax
|
||||
stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_menu_Delete_files, 157
|
||||
stdcall [ksubmenu_add], [main_menu_file], eax
|
||||
stdcall [kmenuitem_new], KMENUITEM_SEPARATOR, 0, 0
|
||||
stdcall [ksubmenu_add], [main_menu_file], eax
|
||||
stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_menu_Exit, 112
|
||||
stdcall [ksubmenu_add], [main_menu_file], eax
|
||||
stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_main_menu_File, [main_menu_file]
|
||||
stdcall [ksubmenu_add], [main_menu], eax
|
||||
|
||||
stdcall [ksubmenu_new]
|
||||
mov [main_menu_select], eax
|
||||
stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_menu_File_selection, 170
|
||||
stdcall [ksubmenu_add], [main_menu_select], eax
|
||||
stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_menu_Select_all, 171
|
||||
stdcall [ksubmenu_add], [main_menu_select], eax
|
||||
stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_menu_Clear_selection, 172
|
||||
stdcall [ksubmenu_add], [main_menu_select], eax
|
||||
stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_menu_Invert_selection, 173
|
||||
stdcall [ksubmenu_add], [main_menu_select], eax
|
||||
stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_main_menu_Select, [main_menu_select]
|
||||
stdcall [ksubmenu_add], [main_menu], eax
|
||||
|
||||
cmp [sort_init], f_null_1
|
||||
je @f
|
||||
stdcall [ksubmenu_new]
|
||||
mov [main_menu_sort], eax
|
||||
stdcall [kmenuitem_new], KMENUITEM_NORMAL, sort_button_name.name, 142
|
||||
stdcall [ksubmenu_add], [main_menu_sort], eax
|
||||
stdcall [kmenuitem_new], KMENUITEM_NORMAL, sort_button_name.type, 143
|
||||
stdcall [ksubmenu_add], [main_menu_sort], eax
|
||||
stdcall [kmenuitem_new], KMENUITEM_NORMAL, sort_button_name.size, 144
|
||||
stdcall [ksubmenu_add], [main_menu_sort], eax
|
||||
stdcall [kmenuitem_new], KMENUITEM_NORMAL, sort_button_name.date, 145
|
||||
stdcall [ksubmenu_add], [main_menu_sort], eax
|
||||
stdcall [kmenuitem_new], KMENUITEM_SEPARATOR, 0, 0
|
||||
stdcall [ksubmenu_add], [main_menu_sort], eax
|
||||
stdcall [kmenuitem_new], KMENUITEM_NORMAL, sort_button_name.name, 146
|
||||
stdcall [ksubmenu_add], [main_menu_sort], eax
|
||||
stdcall [kmenuitem_new], KMENUITEM_NORMAL, sort_button_name.type, 147
|
||||
stdcall [ksubmenu_add], [main_menu_sort], eax
|
||||
stdcall [kmenuitem_new], KMENUITEM_NORMAL, sort_button_name.size, 148
|
||||
stdcall [ksubmenu_add], [main_menu_sort], eax
|
||||
stdcall [kmenuitem_new], KMENUITEM_NORMAL, sort_button_name.date, 149
|
||||
stdcall [ksubmenu_add], [main_menu_sort], eax
|
||||
stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_main_menu_Sort, [main_menu_sort]
|
||||
stdcall [ksubmenu_add], [main_menu], eax
|
||||
@@:
|
||||
stdcall [ksubmenu_new]
|
||||
mov [main_menu_help], eax
|
||||
stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_menu_About, 101
|
||||
stdcall [ksubmenu_add], [main_menu_help], eax
|
||||
stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_main_menu_Help, [main_menu_help]
|
||||
stdcall [ksubmenu_add], [main_menu], eax
|
||||
.end:
|
||||
ret
|
||||
@@ -1,6 +1,6 @@
|
||||
;---------------------------------------------------------------------
|
||||
key_menu:
|
||||
mcall 2
|
||||
mcall SF_GET_KEY
|
||||
cmp [extended_key],1
|
||||
je .extended_key
|
||||
test al, al
|
||||
@@ -59,15 +59,15 @@ key_menu:
|
||||
.end_2:
|
||||
cmp [alt_flag],0
|
||||
je .for_all
|
||||
cmp [select_panel_counter],0
|
||||
cmp [fb_left.select_panel_counter],1
|
||||
je .end_1
|
||||
mov [close_menu],2
|
||||
ret
|
||||
.end_3:
|
||||
cmp [alt_flag],0
|
||||
je .for_all
|
||||
cmp [select_panel_counter],0
|
||||
jne .end_1
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je .end_1
|
||||
mov [close_menu],2
|
||||
ret
|
||||
.end_4:
|
||||
@@ -140,7 +140,7 @@ menu_key_82:
|
||||
xor ecx,ecx
|
||||
mov cl,[esi+2]
|
||||
sub ecx,0x30
|
||||
mcall 24,5
|
||||
mcall SF_CD, SSF_INSERT_TRAY
|
||||
@@:
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
@@ -156,7 +156,7 @@ menu_key_83:
|
||||
xor ecx,ecx
|
||||
mov cl,[esi+2]
|
||||
sub ecx,0x30
|
||||
mcall 24,4
|
||||
mcall SF_CD, SSF_EJECT_TRAY
|
||||
@@:
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
@@ -169,18 +169,17 @@ menu_key_28:
|
||||
menu_key_end:
|
||||
jmp key_menu.end
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
key_menu_left:
|
||||
mov [close_menu],0
|
||||
mov [press_enter_menu],0
|
||||
mov [press_enter_menu],0
|
||||
call key_menu
|
||||
cmp [press_enter_menu],1
|
||||
je .press_enter_menu
|
||||
cmp [close_menu],0
|
||||
je draw_left_select_disk_menu.red
|
||||
.1:
|
||||
; mov [left_panel_clear_all],1
|
||||
call draw_left_panel
|
||||
; mov [right_panel_clear_all],1
|
||||
call draw_right_panel
|
||||
cmp [alt_flag],0
|
||||
je still
|
||||
@@ -193,22 +192,21 @@ key_menu_left:
|
||||
add esi,retrieved_devices_table
|
||||
inc esi
|
||||
call copy_folder_name
|
||||
mov [left_start_draw_cursor_line],0
|
||||
call proc_read_folder
|
||||
jmp still
|
||||
mov [fb_left.start_draw_cursor_line],0
|
||||
jmp proc_read_folder
|
||||
;jmp still
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
key_menu_right:
|
||||
mov [close_menu],0
|
||||
mov [press_enter_menu],0
|
||||
mov [press_enter_menu],0
|
||||
call key_menu
|
||||
cmp [press_enter_menu],1
|
||||
je .press_enter_menu
|
||||
cmp [close_menu],0
|
||||
je draw_right_select_disk_menu.red
|
||||
.1:
|
||||
; mov [left_panel_clear_all],1
|
||||
call draw_left_panel
|
||||
; mov [right_panel_clear_all],1
|
||||
call draw_right_panel
|
||||
cmp [alt_flag],0
|
||||
je still
|
||||
@@ -221,27 +219,27 @@ key_menu_right:
|
||||
add esi,retrieved_devices_table
|
||||
inc esi
|
||||
call copy_folder_name_1
|
||||
mov [right_start_draw_cursor_line],0
|
||||
call proc_read_folder_1
|
||||
jmp still
|
||||
mov [fb_right.start_draw_cursor_line],0
|
||||
jmp proc_read_folder_1
|
||||
;jmp still
|
||||
;---------------------------------------------------------------------
|
||||
draw_left_select_disk_menu:
|
||||
call device_detect_f70
|
||||
mov [select_panel_counter],0
|
||||
mov [fb_left.select_panel_counter],1
|
||||
call draw_left_panel
|
||||
call draw_right_panel
|
||||
mov [start_draw_menu_cursor_line],0
|
||||
.red:
|
||||
call draw_left_menu
|
||||
.still:
|
||||
mcall 10
|
||||
cmp eax,1
|
||||
mcall SF_WAIT_EVENT
|
||||
cmp eax,EV_REDRAW
|
||||
je red
|
||||
cmp eax,2
|
||||
cmp eax,EV_KEY
|
||||
je key_menu_left
|
||||
cmp eax,3
|
||||
cmp eax,EV_BUTTON
|
||||
je @f
|
||||
cmp eax,6
|
||||
cmp eax,EV_MOUSE
|
||||
je mouse_menu_left
|
||||
jmp .still
|
||||
@@:
|
||||
@@ -250,21 +248,21 @@ draw_left_select_disk_menu:
|
||||
;---------------------------------------------------------------------
|
||||
draw_right_select_disk_menu:
|
||||
call device_detect_f70
|
||||
mov [select_panel_counter],1
|
||||
mov [fb_right.select_panel_counter],1
|
||||
call draw_left_panel
|
||||
call draw_right_panel
|
||||
mov [start_draw_menu_cursor_line],0
|
||||
.red:
|
||||
call draw_right_menu
|
||||
.still:
|
||||
mcall 10
|
||||
cmp eax,1
|
||||
mcall SF_WAIT_EVENT
|
||||
cmp eax,EV_REDRAW
|
||||
je red
|
||||
cmp eax,2
|
||||
cmp eax,EV_KEY
|
||||
je key_menu_right
|
||||
cmp eax,3
|
||||
cmp eax,EV_BUTTON
|
||||
je @f
|
||||
cmp eax,6
|
||||
cmp eax,EV_MOUSE
|
||||
je mouse_menu_right
|
||||
jmp .still
|
||||
@@:
|
||||
@@ -272,30 +270,28 @@ draw_right_select_disk_menu:
|
||||
jmp button
|
||||
;---------------------------------------------------------------------
|
||||
draw_left_menu:
|
||||
mov ebx,[left_panel_x]
|
||||
mov ebx,[fb_left.x]
|
||||
mov bx,60
|
||||
mov ecx,[left_panel_y]
|
||||
mov ecx,[fb_left.y]
|
||||
mov eax,[retrieved_devices_table_counter]
|
||||
mov cx,ax
|
||||
imul cx,10
|
||||
mov edx,0xffffcc
|
||||
dec ebx
|
||||
mov eax,13
|
||||
mcall
|
||||
dec ebx
|
||||
mcall SF_DRAW_RECT
|
||||
call draw_menu_Selection
|
||||
call draw_menu_data
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
draw_right_menu:
|
||||
mov ebx,[right_panel_x]
|
||||
mov ebx,[fb_right.x]
|
||||
mov bx,60
|
||||
mov ecx,[right_panel_y]
|
||||
mov ecx,[fb_right.y]
|
||||
mov eax,[retrieved_devices_table_counter]
|
||||
mov cx,ax
|
||||
imul cx,10
|
||||
mov edx,0xffffcc
|
||||
mov eax,13
|
||||
mcall
|
||||
mcall SF_DRAW_RECT
|
||||
call draw_menu_Selection
|
||||
call draw_menu_data
|
||||
ret
|
||||
@@ -306,7 +302,7 @@ draw_menu_data:
|
||||
mov bx,cx
|
||||
mov ebp,0
|
||||
.start:
|
||||
mcall 4, ,0x80000000
|
||||
mcall SF_DRAW_TEXT, ,0x80000000
|
||||
add ebx,10
|
||||
add edx,10
|
||||
inc ebp
|
||||
@@ -322,15 +318,14 @@ draw_menu_Selection:
|
||||
add ecx,eax
|
||||
mov cx,10
|
||||
mov edx,0xbbffbb
|
||||
mov eax,13
|
||||
mcall
|
||||
mcall SF_DRAW_RECT
|
||||
pop ecx ebx
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
mouse_menu_left:
|
||||
mcall 37,2
|
||||
mcall SF_MOUSE_GET, SSF_BUTTON
|
||||
mov [mouse_keys],eax
|
||||
mcall 37,1
|
||||
mcall SF_MOUSE_GET, SSF_WINDOW_POSITION
|
||||
mov [mouse_position],eax
|
||||
test eax,0x80000000
|
||||
jnz draw_left_select_disk_menu.still
|
||||
@@ -345,7 +340,7 @@ mouse_menu_left:
|
||||
cmp eax,[window_high]
|
||||
ja draw_left_select_disk_menu.still
|
||||
xor ecx,ecx
|
||||
mov cx,[left_panel_y.start_y]
|
||||
mov cx,[fb_left.start_y]
|
||||
cmp ax,cx
|
||||
jbe .close
|
||||
mov edx,[retrieved_devices_table_counter]
|
||||
@@ -353,13 +348,13 @@ mouse_menu_left:
|
||||
add cx,dx
|
||||
cmp ax,cx
|
||||
jae .close
|
||||
mov cx,[left_panel_x.start_x]
|
||||
mov cx,[fb_left.start_x]
|
||||
cmp bx,cx
|
||||
jbe .close
|
||||
add cx,60
|
||||
cmp bx,cx
|
||||
jae .close
|
||||
sub ax,[left_panel_y.start_y]
|
||||
sub ax,[fb_left.start_y]
|
||||
mov ebx,10
|
||||
xor edx,edx
|
||||
div ebx
|
||||
@@ -370,14 +365,13 @@ mouse_menu_left:
|
||||
.close:
|
||||
cmp [mouse_keys],0
|
||||
je draw_left_select_disk_menu.still
|
||||
; mov [left_panel_clear_all],1
|
||||
call draw_left_panel
|
||||
jmp still
|
||||
;---------------------------------------------------------------------
|
||||
mouse_menu_right:
|
||||
mcall 37,2
|
||||
mcall SF_MOUSE_GET, SSF_BUTTON
|
||||
mov [mouse_keys],eax
|
||||
mcall 37,1
|
||||
mcall SF_MOUSE_GET, SSF_WINDOW_POSITION
|
||||
mov [mouse_position],eax
|
||||
test eax,0x80000000
|
||||
jnz draw_right_select_disk_menu.still
|
||||
@@ -392,7 +386,7 @@ mouse_menu_right:
|
||||
cmp eax,[window_high]
|
||||
ja draw_right_select_disk_menu.still
|
||||
xor ecx,ecx
|
||||
mov cx,[right_panel_y.start_y]
|
||||
mov cx,[fb_right.start_y]
|
||||
cmp ax,cx
|
||||
jbe .close
|
||||
mov edx,[retrieved_devices_table_counter]
|
||||
@@ -400,13 +394,13 @@ mouse_menu_right:
|
||||
add cx,dx
|
||||
cmp ax,cx
|
||||
jae .close
|
||||
mov cx,[right_panel_x.start_x]
|
||||
mov cx,[fb_right.start_x]
|
||||
cmp bx,cx
|
||||
jbe .close
|
||||
add cx,60
|
||||
cmp bx,cx
|
||||
jae .close
|
||||
sub ax,[right_panel_y.start_y]
|
||||
sub ax,[fb_right.start_y]
|
||||
mov ebx,10
|
||||
xor edx,edx
|
||||
div ebx
|
||||
@@ -417,7 +411,6 @@ mouse_menu_right:
|
||||
.close:
|
||||
cmp [mouse_keys],0
|
||||
je draw_right_select_disk_menu.still
|
||||
; mov [right_panel_clear_all],1
|
||||
call draw_right_panel
|
||||
jmp still
|
||||
;---------------------------------------------------------------------
|
||||
+226
-254
@@ -1,266 +1,238 @@
|
||||
align 4
|
||||
mouse:
|
||||
mcall 18,7
|
||||
mcall SF_SYSTEM, SSF_GET_ACTIVE_WINDOW
|
||||
cmp [active_process],eax
|
||||
jne still
|
||||
mcall 37,7
|
||||
mov [mouse_scroll_data],eax
|
||||
; test eax,eax
|
||||
; jnz .continue_2
|
||||
mcall 37,2
|
||||
cmp [mouse_keys],eax
|
||||
je @f
|
||||
mov [mouse_keys],eax
|
||||
mov [mouse_keys_delta],0
|
||||
jmp .continue_2
|
||||
@@:
|
||||
mov [mouse_keys_delta],1
|
||||
.continue_2:
|
||||
mcall 37,1
|
||||
mov [mouse_position],eax
|
||||
; mcall 18,7
|
||||
; cmp [active_process],eax
|
||||
; jne still
|
||||
mov eax,[mouse_position]
|
||||
test eax,0x80000000
|
||||
jnz still
|
||||
test eax,0x8000
|
||||
jnz still
|
||||
mov ebx,eax
|
||||
shr ebx,16
|
||||
shl eax,16
|
||||
shr eax,16
|
||||
cmp [mouse_keys_delta],0
|
||||
je @f
|
||||
cmp [scroll_pointer],0
|
||||
jne .check_scroll_bar_left
|
||||
@@:
|
||||
cmp ebx,[window_width]
|
||||
ja still
|
||||
cmp eax,[window_high]
|
||||
ja still
|
||||
.check_scroll_bar_left:
|
||||
xor ecx,ecx
|
||||
mov cx,[left_panel_y.start_y]
|
||||
cmp [mouse_keys_delta],0
|
||||
je @f
|
||||
cmp [scroll_pointer],1
|
||||
je .check_scroll_bar_left_event
|
||||
cmp [scroll_pointer],2
|
||||
je .check_scroll_bar_right_event
|
||||
@@:
|
||||
cmp ax,cx
|
||||
jbe .other
|
||||
add cx,[left_panel_y.size_y]
|
||||
cmp ax,cx
|
||||
jae .other
|
||||
mov cx,[left_panel_x.start_x]
|
||||
cmp bx,cx
|
||||
jbe .other
|
||||
add cx,[left_panel_x.size_x]
|
||||
cmp bx,cx
|
||||
jae .check_scroll_bar_right
|
||||
mov edx,[left_folder_block]
|
||||
cmp edx,[max_panel_line]
|
||||
jbe @f
|
||||
.check_scroll_bar_left_event:
|
||||
mov [scroll_bar_event],0
|
||||
call check_scroll_left_event
|
||||
cmp [scroll_bar_event],0
|
||||
jne still
|
||||
mov [scroll_bar_event],0
|
||||
call check_scroll_bar_left_event
|
||||
cmp [scroll_bar_event],0
|
||||
jne still ;.continue
|
||||
; cmp [scroll_pointer],1
|
||||
; je .continue
|
||||
@@:
|
||||
call check_left_panel_mouse_event
|
||||
; jmp still
|
||||
.continue:
|
||||
; mov [temp_edx],mouse_left_panel
|
||||
; call mouse.draw_data
|
||||
; mov [scroll_pointer],0
|
||||
; mov [mouse_keys_delta_1],0
|
||||
jmp still
|
||||
cmp [library03.status_lib],0 ; test load library
|
||||
jnz .m_end
|
||||
cld
|
||||
stdcall [kmainmenu_dispatch_cursorevent], [main_menu]
|
||||
|
||||
.check_scroll_bar_right:
|
||||
xor ecx,ecx
|
||||
mov cx,[right_panel_x.start_x]
|
||||
cmp bx,cx
|
||||
jbe .other
|
||||
add cx,[right_panel_x.size_x]
|
||||
cmp bx,cx
|
||||
jae .other
|
||||
mov edx,[right_folder_block]
|
||||
cmp edx,[max_panel_line]
|
||||
jbe @f
|
||||
.check_scroll_bar_right_event:
|
||||
mov [scroll_bar_event],0
|
||||
call check_scroll_right_event
|
||||
cmp [scroll_bar_event],0
|
||||
jne still
|
||||
mov [scroll_bar_event],0
|
||||
call check_scroll_bar_right_event
|
||||
cmp [scroll_bar_event],0
|
||||
jne still ;.continue_1
|
||||
mov eax,[main_menu]
|
||||
cmp dword[eax+16],-1
|
||||
je @f
|
||||
mov [m_lost],1
|
||||
jmp still
|
||||
@@:
|
||||
call check_right_panel_mouse_event
|
||||
.continue_1:
|
||||
; mov [temp_edx],mouse_right_panel
|
||||
; call mouse.draw_data
|
||||
jmp still
|
||||
cmp [m_lost],0
|
||||
je .m_end
|
||||
dec [m_lost]
|
||||
jmp still
|
||||
.m_end:
|
||||
|
||||
.other:
|
||||
; mov [temp_edx],mouse_other_panel
|
||||
; call mouse.draw_data
|
||||
jmp still
|
||||
mcall SF_MOUSE_GET, SSF_SCROLL_DATA
|
||||
mov [mouse_scroll_data],eax
|
||||
mcall SF_MOUSE_GET, SSF_WINDOW_POSITION
|
||||
mov [mouse_position],eax
|
||||
|
||||
;.draw_data:
|
||||
; pusha
|
||||
; mov [temp_eax],eax
|
||||
; mcall 13,<190,400>,<3,15>,0x0
|
||||
; xor ecx,ecx
|
||||
; mov cx,[mouse_position.x]
|
||||
; mcall 47,0x80000, ,<200, 5>,0xffffff
|
||||
; mov cx,[mouse_position.y]
|
||||
; mcall 47,0x80000, ,<300, 5>,0xffffff
|
||||
; mcall 47,0x80000,[mouse_keys],<400, 5>,0xffffff
|
||||
; mcall 4,<500,5>,0xffffff,[temp_edx],5
|
||||
; mcall 47,0x80000,[mouse_keys],<200, 5>,0xffffff
|
||||
; popa
|
||||
; ret
|
||||
cmp [sb_left.delta2],0
|
||||
jnz .scrollbar_l
|
||||
cmp [sb_right.delta2],0
|
||||
jnz .scrollbar_r
|
||||
|
||||
mov [fb_left.select_flag],0
|
||||
stdcall [FileBrowser_mouse], fb_left
|
||||
cmp [fb_left.select_flag],0
|
||||
jz @f
|
||||
mov eax,fb_left.mouse_keys_delta
|
||||
cmp [eax],dword 3
|
||||
jne .scrollbar_l
|
||||
mov [eax],dword 0
|
||||
jmp key_28.1
|
||||
@@:
|
||||
mov [fb_right.select_flag],0
|
||||
stdcall [FileBrowser_mouse], fb_right
|
||||
cmp [fb_right.select_flag],0
|
||||
jz @f
|
||||
mov eax,fb_right.mouse_keys_delta
|
||||
cmp [eax],dword 3
|
||||
jne .scrollbar_r
|
||||
mov [eax],dword 0
|
||||
jmp key_28.1
|
||||
@@:
|
||||
|
||||
stdcall [scrollbar_v_mouse], sb_left
|
||||
cmp [sb_left.delta2],0
|
||||
jz @f
|
||||
cmp [fb_left.select_panel_counter],1
|
||||
je @f
|
||||
mov [fb_left.select_panel_counter],1
|
||||
mov [fb_right.select_panel_counter],0
|
||||
call on_fb_focus_change
|
||||
@@:
|
||||
cmp [sb_left.redraw],0
|
||||
jnz .check_scroll_event
|
||||
|
||||
stdcall [scrollbar_v_mouse], sb_right
|
||||
cmp [sb_right.delta2],0
|
||||
jz @f
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je @f
|
||||
mov [fb_left.select_panel_counter],0
|
||||
mov [fb_right.select_panel_counter],1
|
||||
call on_fb_focus_change
|
||||
@@:
|
||||
cmp [sb_right.redraw],0
|
||||
jnz .check_scroll_event
|
||||
;---------------------------------------------------
|
||||
align 4
|
||||
.scrollbar_l:
|
||||
mov eax,[sb_left.max_area]
|
||||
cmp eax,[sb_left.cur_area]
|
||||
jbe .check_scroll_event
|
||||
|
||||
stdcall [scrollbar_v_mouse], sb_left
|
||||
cmp [sb_left.redraw],0
|
||||
je .check_scroll_event
|
||||
mov [sb_left.redraw],0
|
||||
|
||||
mov [fb_left.all_redraw],2
|
||||
mov eax,[sb_left.position]
|
||||
mov ebx,fb_left
|
||||
call on_sb_change_fb_update
|
||||
mov [fb_left.start_draw_line],eax
|
||||
|
||||
stdcall [FileBrowser_draw], fb_left
|
||||
xor eax,eax
|
||||
mov [fb_left.all_redraw],eax
|
||||
jmp still
|
||||
;---------------------------------------------------
|
||||
align 4
|
||||
.scrollbar_r:
|
||||
mov eax,[sb_right.max_area]
|
||||
cmp eax,[sb_right.cur_area]
|
||||
jbe .check_scroll_event
|
||||
|
||||
stdcall [scrollbar_v_mouse], sb_right
|
||||
cmp [sb_right.redraw],0
|
||||
je .check_scroll_event
|
||||
mov [sb_right.redraw],0
|
||||
|
||||
mov [fb_right.all_redraw],2
|
||||
mov eax,[sb_right.position]
|
||||
mov ebx,fb_right
|
||||
call on_sb_change_fb_update
|
||||
mov [fb_right.start_draw_line],eax
|
||||
|
||||
stdcall [FileBrowser_draw], fb_right
|
||||
xor eax,eax
|
||||
mov [fb_right.all_redraw],eax
|
||||
jmp still
|
||||
;---------------------------------------------------
|
||||
align 4
|
||||
.check_scroll_event:
|
||||
mov eax,[mouse_position]
|
||||
movzx ebx,ax ; ebx mouse y
|
||||
shr eax,16 ; eax mouse x
|
||||
|
||||
mov cx,[fb_right.start_x]
|
||||
mov dx,[fb_left.start_y]
|
||||
|
||||
cmp bx,dx
|
||||
jb still ; min y
|
||||
|
||||
add dx,[fb_left.size_y]
|
||||
cmp bx,dx
|
||||
ja still ; max y
|
||||
|
||||
xor esi,esi
|
||||
cmp ax,cx
|
||||
jb @f ; coord x
|
||||
inc esi
|
||||
@@:
|
||||
cmp [fb_right.select_panel_counter],esi
|
||||
je .no_click
|
||||
mcall SF_MOUSE_GET, SSF_BUTTON_EXT
|
||||
bt eax,8
|
||||
jc @f
|
||||
bt eax,9
|
||||
jnc .no_click
|
||||
@@:
|
||||
mov [fb_right.select_panel_counter],esi
|
||||
xor esi,1
|
||||
mov [fb_left.select_panel_counter],esi
|
||||
xor esi,1
|
||||
call on_fb_focus_change
|
||||
.no_click:
|
||||
|
||||
mov eax,[mouse_scroll_data]
|
||||
test eax,eax
|
||||
jz still
|
||||
|
||||
test ax,0x8000
|
||||
jnz .decr
|
||||
shr eax,16
|
||||
test ax,0x8000
|
||||
jnz .decr_1
|
||||
|
||||
movzx ecx,[mouse_scroll_data.vertical]
|
||||
test ecx,ecx
|
||||
jnz @f
|
||||
mov cx,[mouse_scroll_data.horizontal]
|
||||
test ecx,ecx
|
||||
jz still
|
||||
@@:
|
||||
push ebx ecx
|
||||
mov ebx,1
|
||||
call fb_on_key_1
|
||||
pop ecx ebx
|
||||
dec ecx
|
||||
jnz @b
|
||||
jmp still
|
||||
;----------------------------------------
|
||||
.decr:
|
||||
movzx ebx,[mouse_scroll_data.vertical]
|
||||
jmp @f
|
||||
.decr_1:
|
||||
movzx ebx,[mouse_scroll_data.horizontal]
|
||||
@@:
|
||||
mov ecx,0xffff
|
||||
sub ecx,ebx
|
||||
inc ecx
|
||||
@@:
|
||||
push ebx ecx
|
||||
mov ebx,2
|
||||
call fb_on_key_1
|
||||
pop ecx ebx
|
||||
dec ecx
|
||||
jnz @b
|
||||
jmp still
|
||||
;---------------------------------------------------------------------
|
||||
check_left_panel_mouse_event:
|
||||
; cmp [scroll_pointer],0
|
||||
; je @f
|
||||
mov [scroll_pointer],0
|
||||
; ret
|
||||
;in:
|
||||
; eax - scrool bar position
|
||||
; ebx - pointer to file browser
|
||||
align 4
|
||||
on_sb_change_fb_update:
|
||||
cmp [ebx+fb_left.start_draw_line-fb_left],eax
|
||||
je .end
|
||||
push ecx edx
|
||||
mov ecx,eax
|
||||
sub ecx,[ebx+fb_left.start_draw_line-fb_left]
|
||||
movzx edx,word[ebx+fb_left.line_size_y-fb_left]
|
||||
imul ecx,edx
|
||||
mov dx,[ebx+fb_left.start_draw_cursor_line-fb_left]
|
||||
sub dx,cx
|
||||
cmp dx,0
|
||||
jge @f
|
||||
xor dx,dx
|
||||
@@:
|
||||
cmp [mouse_keys_delta],0
|
||||
jz .start
|
||||
cmp [mouse_keys],0
|
||||
jz .end
|
||||
.start:
|
||||
sub ax,[left_panel_y.start_y]
|
||||
mov ebx,10
|
||||
xor edx,edx
|
||||
div ebx
|
||||
imul eax,10
|
||||
cmp [select_panel_counter],0
|
||||
je @f
|
||||
mov [select_panel_counter],0
|
||||
mov [mouse_keys_delta_1],0
|
||||
push eax
|
||||
call draw_right_panel
|
||||
pop eax
|
||||
jmp .continue
|
||||
@@:
|
||||
cmp [left_start_draw_cursor_line],ax
|
||||
jne @f
|
||||
cmp [mouse_keys],0
|
||||
jnz .continue
|
||||
cmp [mouse_keys_delta],0
|
||||
je .enter
|
||||
@@:
|
||||
mov [mouse_keys_delta_1],0
|
||||
.continue:
|
||||
imul ebx,[left_folder_block],10
|
||||
cmp eax,ebx
|
||||
jb @f
|
||||
sub ebx,10
|
||||
mov [left_start_draw_cursor_line],bx
|
||||
jmp .continue_1
|
||||
@@:
|
||||
mov [left_start_draw_cursor_line],ax
|
||||
.continue_1:
|
||||
call draw_left_panel
|
||||
mov [ebx+fb_left.start_draw_cursor_line-fb_left],dx
|
||||
mov [ebx+fb_left.all_redraw-fb_left],1
|
||||
pop edx ecx
|
||||
.end:
|
||||
ret
|
||||
.enter:
|
||||
cmp [mouse_keys_delta_1],1
|
||||
je .enter_1
|
||||
mcall 26,9
|
||||
add eax,[mouse_key_delay]
|
||||
mov [mouse_keys_tick],eax
|
||||
mov [mouse_keys_delta_1],1
|
||||
jmp .continue_1
|
||||
.enter_1:
|
||||
mov [mouse_keys_delta_1],0
|
||||
mcall 26,9
|
||||
cmp eax,[mouse_keys_tick]
|
||||
jbe @f
|
||||
ret
|
||||
@@:
|
||||
add esp,4
|
||||
; call draw_left_panel
|
||||
jmp key_28.1
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
check_right_panel_mouse_event:
|
||||
; cmp [scroll_pointer],0
|
||||
; je @f
|
||||
mov [scroll_pointer],0
|
||||
; ret
|
||||
@@:
|
||||
cmp [mouse_keys_delta],0
|
||||
jz .start
|
||||
cmp [mouse_keys],0
|
||||
jz .end
|
||||
.start:
|
||||
sub ax,[right_panel_y.start_y]
|
||||
mov ebx,10
|
||||
xor edx,edx
|
||||
div ebx
|
||||
imul eax,10
|
||||
cmp [select_panel_counter],1
|
||||
je @f
|
||||
mov [select_panel_counter],1
|
||||
mov [mouse_keys_delta_1],0
|
||||
push eax
|
||||
call draw_left_panel
|
||||
pop eax
|
||||
jmp .continue
|
||||
@@:
|
||||
cmp [right_start_draw_cursor_line],ax
|
||||
jne @f
|
||||
cmp [mouse_keys],0
|
||||
jnz .continue
|
||||
cmp [mouse_keys_delta],0
|
||||
je .enter
|
||||
@@:
|
||||
mov [mouse_keys_delta_1],0
|
||||
; cmp [mouse_keys_delta],1
|
||||
; je .continue
|
||||
; cmp [right_start_draw_cursor_line],ax
|
||||
; je .enter
|
||||
.continue:
|
||||
imul ebx,[right_folder_block],10
|
||||
cmp eax,ebx
|
||||
jb @f
|
||||
sub ebx,10
|
||||
mov [right_start_draw_cursor_line],bx
|
||||
jmp .continue_1
|
||||
@@:
|
||||
mov [right_start_draw_cursor_line],ax
|
||||
.continue_1:
|
||||
call draw_right_panel
|
||||
.end:
|
||||
ret
|
||||
.enter:
|
||||
cmp [mouse_keys_delta_1],1
|
||||
je .enter_1
|
||||
mcall 26,9
|
||||
add eax,[mouse_key_delay]
|
||||
mov [mouse_keys_tick],eax
|
||||
mov [mouse_keys_delta_1],1
|
||||
jmp .continue_1
|
||||
.enter_1:
|
||||
mov [mouse_keys_delta_1],0
|
||||
mcall 26,9
|
||||
cmp eax,[mouse_keys_tick]
|
||||
jbe @f
|
||||
ret
|
||||
@@:
|
||||
add esp,4
|
||||
; call draw_right_panel
|
||||
jmp key_28.1
|
||||
align 4
|
||||
on_fb_focus_change:
|
||||
pushad
|
||||
call draw_left_panel_patch
|
||||
call draw_right_panel_patch
|
||||
popad
|
||||
mov [fb_left.all_redraw], 1
|
||||
mov [fb_right.all_redraw], 1
|
||||
stdcall [FileBrowser_draw], fb_left
|
||||
stdcall [FileBrowser_draw], fb_right
|
||||
mov [fb_left.all_redraw],0
|
||||
mov [fb_right.all_redraw],0
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
@@ -1,34 +1,35 @@
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
open_file_f4:
|
||||
cmp [select_panel_counter],0
|
||||
jne .right_1
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je .right_1
|
||||
.left_1:
|
||||
xor eax,eax
|
||||
mov ax,[left_start_draw_cursor_line]
|
||||
mov ax,[fb_left.start_draw_cursor_line]
|
||||
xor edx,edx
|
||||
mov ebx,10
|
||||
movzx ebx,[fb_left.line_size_y]
|
||||
div ebx
|
||||
mov esi,[left_start_draw_line]
|
||||
mov esi,[fb_left.start_draw_line]
|
||||
add esi,eax
|
||||
imul esi,304
|
||||
add esi,[left_folder_data]
|
||||
add esi,[fb_left.folder_data]
|
||||
add esi,32
|
||||
test [esi],byte 0x10
|
||||
jz file_no_folder_1
|
||||
jz file_no_folder_1
|
||||
jmp still
|
||||
.right_1:
|
||||
xor eax,eax
|
||||
mov ax,[right_start_draw_cursor_line]
|
||||
mov ax,[fb_right.start_draw_cursor_line]
|
||||
xor edx,edx
|
||||
mov ebx,10
|
||||
movzx ebx,[fb_right.line_size_y]
|
||||
div ebx
|
||||
mov esi,[right_start_draw_line]
|
||||
mov esi,[fb_right.start_draw_line]
|
||||
add esi,eax
|
||||
imul esi,304
|
||||
add esi,[right_folder_data]
|
||||
add esi,[fb_right.folder_data]
|
||||
add esi,32
|
||||
test [esi],byte 0x10
|
||||
jz file_no_folder_1
|
||||
jz file_no_folder_1
|
||||
jmp still
|
||||
;---------------------------------------------------------------------
|
||||
file_no_folder_1:
|
||||
@@ -37,7 +38,7 @@ file_no_folder_1:
|
||||
std
|
||||
lodsb
|
||||
cmp esi,edx
|
||||
je still
|
||||
je still
|
||||
cmp al,'.'
|
||||
jnz @b
|
||||
call calculate_file_no_folder_2
|
||||
@@ -73,7 +74,7 @@ file_no_folder:
|
||||
std
|
||||
lodsb
|
||||
cmp esi,edx
|
||||
je start_file
|
||||
je start_file
|
||||
cmp al,'.'
|
||||
jnz @b
|
||||
call calculate_file_no_folder_2
|
||||
@@ -85,8 +86,8 @@ file_no_folder:
|
||||
start_file:
|
||||
inc edx
|
||||
.1:
|
||||
cmp [select_panel_counter],0
|
||||
jne @f
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je @f
|
||||
mov esi,read_folder_name ;read_folder.name
|
||||
jmp .start
|
||||
@@:
|
||||
@@ -110,7 +111,7 @@ start_file:
|
||||
test eax,eax
|
||||
jnz @b
|
||||
mov [start_file_data.param],eax
|
||||
call start_appl
|
||||
mcall SF_FILE, start_file_data
|
||||
cmp eax,0
|
||||
jge @f
|
||||
mov ebx,0
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
progress_bar_delete:
|
||||
pusha
|
||||
cmp [max_progress_value],0
|
||||
@@ -17,17 +18,18 @@ progress_bar_delete:
|
||||
mov bx,cx
|
||||
sub ebx,13
|
||||
call clear_text_area_1
|
||||
mcall 4, ,0x90ffffff,file_name
|
||||
mcall SF_DRAW_TEXT, ,0x90ffffff,file_name
|
||||
cmp [draw_all_progressbar],0
|
||||
je .end
|
||||
sub ebx,13
|
||||
mov edx,delete_type
|
||||
mov edx,sz_Delete_files
|
||||
mcall
|
||||
.end:
|
||||
popa
|
||||
mov [draw_all_progressbar],0
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
progress_bar_copy:
|
||||
pusha
|
||||
call calculate_progress_data_4
|
||||
@@ -53,25 +55,26 @@ progress_bar_copy:
|
||||
@@:
|
||||
mov edx,0xff0000
|
||||
.continue_1:
|
||||
mcall
|
||||
mcall
|
||||
call calculate_progress_data_2
|
||||
shr ecx,16
|
||||
mov bx,cx
|
||||
sub ebx,11
|
||||
call clear_text_area_1
|
||||
mcall 4, ,0x80ffffff,start_parameter
|
||||
mcall SF_DRAW_TEXT, ,0x80ffffff,start_parameter
|
||||
sub ebx,[skin_high]
|
||||
sub ebx,30
|
||||
call clear_text_area_1
|
||||
mcall 4, ,0x80ffffff,file_name
|
||||
mcall SF_DRAW_TEXT, ,0x80ffffff,file_name
|
||||
cmp [draw_all_progressbar],0
|
||||
je .end
|
||||
sub ebx,13
|
||||
cmp [move_file_flag],1
|
||||
je @f
|
||||
mov edx,copy_type_1
|
||||
mov edx,sz_Copy_file
|
||||
jmp .continue
|
||||
@@:
|
||||
mov edx,move_type_1
|
||||
mov edx,sz_Move_file
|
||||
.continue:
|
||||
|
||||
mcall
|
||||
@@ -90,7 +93,7 @@ clear_text_area_1:
|
||||
mov eax,[window_width]
|
||||
sub eax,70
|
||||
mov bx,ax
|
||||
mov eax,13
|
||||
mov eax,SF_DRAW_RECT
|
||||
mov edx, 0x6060ff
|
||||
mcall
|
||||
pop ebx
|
||||
@@ -131,7 +134,7 @@ calculate_progress_data_2:
|
||||
;---------------------------------------------------------------------
|
||||
calculate_progress_data_3:
|
||||
mov bx,ax
|
||||
mov eax,13
|
||||
mov eax,SF_DRAW_RECT
|
||||
cmp [draw_all_progressbar],0
|
||||
je @f
|
||||
mov edx, 0x6060ff
|
||||
@@ -142,7 +145,7 @@ calculate_progress_data_3:
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
calculate_progress_data_4:
|
||||
mcall 11
|
||||
mcall SF_CHECK_EVENT
|
||||
cmp eax,1
|
||||
jne .1
|
||||
call draw_window
|
||||
|
||||
@@ -67,4 +67,8 @@
|
||||
; confirmation button
|
||||
; 160 - Yes
|
||||
; 161 - No
|
||||
;
|
||||
;
|
||||
; 170 - File selection
|
||||
; 171 - Select all
|
||||
; 172 - Clear selection
|
||||
; 173 - Invert selection
|
||||
@@ -1,543 +0,0 @@
|
||||
;---------------------------------------------------------------------
|
||||
check_scroll_left_event:
|
||||
pusha
|
||||
mov eax,[mouse_scroll_data]
|
||||
test eax,eax
|
||||
jz .end
|
||||
test ax,0x8000
|
||||
jnz .decr
|
||||
shr eax,16
|
||||
test ax,0x8000
|
||||
jnz .decr_1
|
||||
mov eax,[left_folder_block]
|
||||
sub eax,[max_panel_line]
|
||||
cmp [left_start_draw_line],eax
|
||||
jae .end
|
||||
movzx eax,[mouse_scroll_data.vertical]
|
||||
test eax,eax
|
||||
jnz @f
|
||||
movzx eax,[mouse_scroll_data.horizontal]
|
||||
@@:
|
||||
add [left_start_draw_line],eax
|
||||
jmp .draw
|
||||
.decr:
|
||||
movzx eax,[mouse_scroll_data.vertical]
|
||||
jmp @f
|
||||
.decr_1:
|
||||
movzx eax,[mouse_scroll_data.horizontal]
|
||||
@@:
|
||||
cmp [left_start_draw_line],0
|
||||
je .end
|
||||
mov ebx,0xffff
|
||||
sub ebx,eax
|
||||
inc ebx
|
||||
sub [left_start_draw_line],ebx
|
||||
cmp [left_start_draw_line],0
|
||||
jae .draw
|
||||
mov [left_start_draw_line],0
|
||||
.draw:
|
||||
call draw_left_panel
|
||||
mov [scroll_bar_event],1
|
||||
.end:
|
||||
popa
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
check_scroll_right_event:
|
||||
pusha
|
||||
mov eax,[mouse_scroll_data]
|
||||
test eax,eax
|
||||
jz .end
|
||||
test ax,0x8000
|
||||
jnz .decr
|
||||
shr eax,16
|
||||
test ax,0x8000
|
||||
jnz .decr_1
|
||||
mov eax,[right_folder_block]
|
||||
sub eax,[max_panel_line]
|
||||
cmp [right_start_draw_line],eax
|
||||
jae .end
|
||||
movzx eax,[mouse_scroll_data.vertical]
|
||||
test eax,eax
|
||||
jnz @f
|
||||
movzx eax,[mouse_scroll_data.horizontal]
|
||||
@@:
|
||||
add [right_start_draw_line],eax
|
||||
jmp .draw
|
||||
.decr:
|
||||
movzx eax,[mouse_scroll_data.vertical]
|
||||
jmp @f
|
||||
.decr_1:
|
||||
movzx eax,[mouse_scroll_data.horizontal]
|
||||
@@:
|
||||
cmp [right_start_draw_line],0
|
||||
je .end
|
||||
mov ebx,0xffff
|
||||
sub ebx,eax
|
||||
inc ebx
|
||||
sub [right_start_draw_line],ebx
|
||||
cmp [right_start_draw_line],0
|
||||
jae .draw
|
||||
mov [right_start_draw_line],0
|
||||
.draw:
|
||||
call draw_right_panel
|
||||
mov [scroll_bar_event],1
|
||||
.end:
|
||||
popa
|
||||
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
check_scroll_bar_left_event:
|
||||
mov [scroll_pointer],1
|
||||
cmp [mouse_keys_delta],0
|
||||
je @f
|
||||
cmp [mouse_keys],0
|
||||
jz .exit
|
||||
@@:
|
||||
sub ecx,15
|
||||
cmp bx,cx
|
||||
jb .exit
|
||||
@@:
|
||||
cmp [select_panel_counter],0
|
||||
je @f
|
||||
mov [select_panel_counter],0
|
||||
call draw_all_panels_for_scroll_bar
|
||||
@@:
|
||||
mov [scroll_bar_event],1
|
||||
mov cx,[left_panel_y.start_y]
|
||||
add cx,15
|
||||
cmp ax,cx
|
||||
ja .scroll
|
||||
cmp [left_start_draw_line],0
|
||||
jne @f
|
||||
ret
|
||||
@@:
|
||||
dec [left_start_draw_line]
|
||||
jmp .all
|
||||
.scroll:
|
||||
add cx,[left_panel_y.size_y]
|
||||
sub cx,30
|
||||
cmp ax,cx
|
||||
ja .down
|
||||
mov ebx,16 ;15
|
||||
add bx,[left_panel_y.start_y]
|
||||
sub cx,bx
|
||||
sub ax,bx
|
||||
mov ebx,eax
|
||||
mov eax,[left_folder_block]
|
||||
call calculate_for_scroll_bar
|
||||
cmp [left_start_draw_line],eax
|
||||
je .exit
|
||||
mov [left_start_draw_line],eax
|
||||
.all:
|
||||
call draw_left_panel
|
||||
.exit:
|
||||
ret
|
||||
.down:
|
||||
mov eax,[left_folder_block]
|
||||
sub eax,[max_panel_line]
|
||||
cmp [left_start_draw_line],eax
|
||||
jb @f
|
||||
ret
|
||||
@@:
|
||||
inc [left_start_draw_line]
|
||||
jmp .all
|
||||
;---------------------------------------------------------------------
|
||||
draw_all_panels_for_scroll_bar:
|
||||
push eax
|
||||
push ebx
|
||||
call draw_right_panel
|
||||
call draw_left_panel
|
||||
pop ebx
|
||||
pop eax
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
calculate_for_scroll_bar:
|
||||
sub eax,[max_panel_line]
|
||||
inc eax
|
||||
shl eax,10
|
||||
xor edx,edx
|
||||
div ecx
|
||||
shl edx,1
|
||||
cmp edx,ebx
|
||||
jb @f
|
||||
inc eax
|
||||
@@:
|
||||
imul eax,ebx
|
||||
shr eax,10
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
check_scroll_bar_right_event:
|
||||
mov [scroll_pointer],2
|
||||
cmp [mouse_keys_delta],0
|
||||
je @f
|
||||
cmp [mouse_keys],0
|
||||
jz .exit
|
||||
@@:
|
||||
sub ecx,15
|
||||
cmp bx,cx
|
||||
jb .exit
|
||||
@@:
|
||||
cmp [select_panel_counter],1
|
||||
je @f
|
||||
mov [select_panel_counter],1
|
||||
call draw_all_panels_for_scroll_bar
|
||||
@@:
|
||||
mov [scroll_bar_event],1
|
||||
mov cx,[right_panel_y.start_y]
|
||||
add cx,15
|
||||
cmp ax,cx
|
||||
ja .scroll
|
||||
cmp [right_start_draw_line],0
|
||||
jne @f
|
||||
ret
|
||||
@@:
|
||||
dec [right_start_draw_line]
|
||||
jmp .all
|
||||
.scroll:
|
||||
add cx,[right_panel_y.size_y]
|
||||
sub cx,30
|
||||
cmp ax,cx
|
||||
ja .down
|
||||
mov ebx,16 ;15
|
||||
add bx,[right_panel_y.start_y]
|
||||
sub cx,bx
|
||||
sub ax,bx
|
||||
mov ebx,eax
|
||||
mov eax,[right_folder_block]
|
||||
call calculate_for_scroll_bar
|
||||
cmp [right_start_draw_line],eax
|
||||
je .exit
|
||||
mov [right_start_draw_line],eax
|
||||
.all:
|
||||
call draw_right_panel
|
||||
.exit:
|
||||
ret
|
||||
.down:
|
||||
mov eax,[right_folder_block]
|
||||
sub eax,[max_panel_line]
|
||||
cmp [right_start_draw_line],eax
|
||||
jb @f
|
||||
ret
|
||||
@@:
|
||||
inc [right_start_draw_line]
|
||||
jmp .all
|
||||
;---------------------------------------------------------------------
|
||||
draw_scroll_bar_left:
|
||||
pusha
|
||||
mov eax,[left_folder_block]
|
||||
cmp eax,0
|
||||
jne @f
|
||||
inc eax
|
||||
@@:
|
||||
mov ebx,[max_panel_line]
|
||||
xor edx,edx
|
||||
div ebx
|
||||
cmp eax,0
|
||||
jne @f
|
||||
inc eax
|
||||
@@:
|
||||
mov ebx,eax
|
||||
xor eax,eax
|
||||
mov ax,[left_panel_x.size_x]
|
||||
sub eax,30
|
||||
xor edx,edx
|
||||
div ebx
|
||||
shr eax,1
|
||||
cmp eax,5
|
||||
jae @f
|
||||
mov eax,5
|
||||
@@:
|
||||
mov [left_scroll_compens],eax
|
||||
popa
|
||||
|
||||
mov [scroll_pointer_1],1
|
||||
pusha
|
||||
mov bx,[left_panel_x.start_x]
|
||||
add bx,[left_panel_x.size_x]
|
||||
sub bx,15
|
||||
shl ebx,16
|
||||
mov bx,15
|
||||
mov ecx,[left_panel_y]
|
||||
call calculate_for_draw_scroll_bar
|
||||
push ecx
|
||||
mov ax,[left_panel_y.size_y]
|
||||
sub eax,30 ;45
|
||||
sub eax,[left_scroll_compens]
|
||||
sub eax,[left_scroll_compens]
|
||||
shl eax,10
|
||||
push ebx
|
||||
mov ebx,[left_folder_block]
|
||||
call calculate_for_draw_scroll_bar_2
|
||||
mov ebx,[left_start_draw_line]
|
||||
imul eax,ebx
|
||||
pop ebx
|
||||
call calculate_for_draw_scroll_bar_1
|
||||
pop ecx
|
||||
ror ecx,16
|
||||
add cx,[left_panel_y.size_y]
|
||||
call calculate_for_draw_scroll_bar_3
|
||||
popa
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
draw_scroll_bar_right:
|
||||
pusha
|
||||
mov eax,[right_folder_block]
|
||||
cmp eax,0
|
||||
jne @f
|
||||
inc eax
|
||||
@@:
|
||||
mov ebx,[max_panel_line]
|
||||
xor edx,edx
|
||||
div ebx
|
||||
cmp eax,0
|
||||
jne @f
|
||||
inc eax
|
||||
@@:
|
||||
mov ebx,eax
|
||||
xor eax,eax
|
||||
mov ax,[right_panel_x.size_x]
|
||||
sub eax,30
|
||||
xor edx,edx
|
||||
div ebx
|
||||
shr eax,1
|
||||
cmp eax,5
|
||||
jae @f
|
||||
mov eax,5
|
||||
@@:
|
||||
mov [right_scroll_compens],eax
|
||||
popa
|
||||
mov [scroll_pointer_1],2
|
||||
pusha
|
||||
mov bx,[right_panel_x.start_x]
|
||||
add bx,[right_panel_x.size_x]
|
||||
sub bx,15
|
||||
shl ebx,16
|
||||
mov bx,15
|
||||
mov ecx,[right_panel_y]
|
||||
call calculate_for_draw_scroll_bar
|
||||
push ecx
|
||||
mov ax,[right_panel_y.size_y]
|
||||
sub eax,30 ;45
|
||||
sub eax,[right_scroll_compens]
|
||||
sub eax,[right_scroll_compens]
|
||||
shl eax,10
|
||||
push ebx
|
||||
mov ebx,[right_folder_block]
|
||||
call calculate_for_draw_scroll_bar_2
|
||||
mov ebx,[right_start_draw_line]
|
||||
imul eax,ebx
|
||||
pop ebx
|
||||
call calculate_for_draw_scroll_bar_1
|
||||
pop ecx
|
||||
ror ecx,16
|
||||
add cx,[right_panel_y.size_y]
|
||||
call calculate_for_draw_scroll_bar_3
|
||||
popa
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
calculate_for_draw_scroll_bar:
|
||||
mov edx,0xeeeeee
|
||||
mov eax,13
|
||||
pusha
|
||||
add ebx,1 shl 16
|
||||
mov bx,14
|
||||
add ecx,16 shl 16
|
||||
sub cx,31
|
||||
mcall
|
||||
popa
|
||||
xor edx,edx
|
||||
push ebx
|
||||
mov bx,1
|
||||
mcall
|
||||
push ecx
|
||||
add ebx,15 shl 16
|
||||
mcall
|
||||
pop ecx
|
||||
pop ebx
|
||||
mov [draw_scroll_character],1
|
||||
call draw_scroll_bar_srectangle
|
||||
xor eax,eax
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
calculate_for_draw_scroll_bar_1:
|
||||
shr eax,10
|
||||
ror ecx,16
|
||||
add cx,15
|
||||
cmp [scroll_pointer_1],1
|
||||
jne .right
|
||||
add ecx,[left_scroll_compens]
|
||||
jmp @f
|
||||
.right:
|
||||
add ecx,[right_scroll_compens]
|
||||
@@:
|
||||
add cx,ax
|
||||
rol ecx,16
|
||||
mov [draw_scroll_character],2
|
||||
call draw_scroll_bar_srectangle
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
calculate_for_draw_scroll_bar_2:
|
||||
sub ebx,[max_panel_line]
|
||||
cmp ebx,0
|
||||
ja @f
|
||||
mov ebx,1
|
||||
@@:
|
||||
xor edx,edx
|
||||
div ebx
|
||||
shl edx,1
|
||||
cmp edx,ebx
|
||||
jb @f
|
||||
inc eax
|
||||
@@:
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
calculate_for_draw_scroll_bar_3:
|
||||
sub cx,16
|
||||
rol ecx,16
|
||||
mov [draw_scroll_character],3
|
||||
call draw_scroll_bar_srectangle
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
;calculate_for_draw_scroll_bar_4:
|
||||
; push eax
|
||||
; push ebx
|
||||
;; shr eax,10
|
||||
; mov ebx,eax
|
||||
; xor eax,eax
|
||||
; mov ax,[left_panel_y.size_y]
|
||||
; xor edx,edx
|
||||
; div ebx
|
||||
;; mov esi,eax
|
||||
; pop ebx
|
||||
; pop eax
|
||||
; ret
|
||||
;---------------------------------------------------------------------
|
||||
draw_scroll_bar_srectangle:
|
||||
push ecx
|
||||
xor edx,edx
|
||||
mov eax,13
|
||||
mov cx,1
|
||||
cmp [draw_scroll_character],2
|
||||
je .draw_center
|
||||
mcall
|
||||
pusha
|
||||
add ecx,1 shl 16
|
||||
add ebx,1 shl 16
|
||||
mov cx,14
|
||||
mov bx,14
|
||||
mov edx,0xbbddff
|
||||
mcall
|
||||
xor edx,edx
|
||||
cmp [draw_scroll_character],1
|
||||
jne .draw_down
|
||||
add ebx,3 shl 16
|
||||
mov bx,7
|
||||
add ecx,8 shl 16
|
||||
mov cx,1
|
||||
mcall
|
||||
sub ecx,1 shl 16
|
||||
add ebx,1 shl 16
|
||||
mov bx,5
|
||||
mcall
|
||||
sub ecx,1 shl 16
|
||||
add ebx,1 shl 16
|
||||
mov bx,3
|
||||
mcall
|
||||
sub ecx,1 shl 16
|
||||
add ebx,1 shl 16
|
||||
mov bx,1
|
||||
mcall
|
||||
jmp .continue
|
||||
.draw_down:
|
||||
add ebx,3 shl 16
|
||||
mov bx,7
|
||||
add ecx,5 shl 16
|
||||
mov cx,1
|
||||
mcall
|
||||
add ecx,1 shl 16
|
||||
add ebx,1 shl 16
|
||||
mov bx,5
|
||||
mcall
|
||||
add ecx,1 shl 16
|
||||
add ebx,1 shl 16
|
||||
mov bx,3
|
||||
mcall
|
||||
add ecx,1 shl 16
|
||||
add ebx,1 shl 16
|
||||
mov bx,1
|
||||
mcall
|
||||
.continue:
|
||||
popa
|
||||
add ecx,15 shl 16
|
||||
mcall
|
||||
pop ecx
|
||||
ret
|
||||
|
||||
.draw_center:
|
||||
pusha
|
||||
add ecx,1 shl 16
|
||||
add ebx,1 shl 16
|
||||
push ecx
|
||||
cmp [scroll_pointer_1],1
|
||||
jne .right
|
||||
ror ecx,16
|
||||
sub ecx,[left_scroll_compens]
|
||||
rol ecx,16
|
||||
xor cx,cx
|
||||
add ecx,[left_scroll_compens]
|
||||
shl cx,1
|
||||
jmp .draw_center_continue
|
||||
.right:
|
||||
ror ecx,16
|
||||
sub ecx,[right_scroll_compens]
|
||||
rol ecx,16
|
||||
xor cx,cx
|
||||
add ecx,[right_scroll_compens]
|
||||
shl cx,1
|
||||
.draw_center_continue:
|
||||
mov bx,14
|
||||
mov edx,0xbbddff
|
||||
mcall
|
||||
xor edx,edx
|
||||
mov cx,1
|
||||
sub ecx,1 shl 16
|
||||
mcall
|
||||
pop ecx
|
||||
cmp [scroll_pointer_1],1
|
||||
jne .right_1
|
||||
cmp [left_scroll_compens],8
|
||||
jb .continue_1
|
||||
jmp .draw_center_continue_1
|
||||
.right_1:
|
||||
cmp [right_scroll_compens],8
|
||||
jb .continue_1
|
||||
.draw_center_continue_1:
|
||||
sub ecx,8 shl 16
|
||||
add ebx,2 shl 16
|
||||
mov bx,10
|
||||
add ecx,4 shl 16
|
||||
mov cx,1
|
||||
mcall
|
||||
add ecx,3 shl 16
|
||||
sub ebx,1 shl 16
|
||||
mov bx,12
|
||||
mcall
|
||||
add ebx,1 shl 16
|
||||
mov bx,10
|
||||
add ecx,3 shl 16
|
||||
mcall
|
||||
.continue_1:
|
||||
popa
|
||||
ror ecx,16
|
||||
cmp [scroll_pointer_1],1
|
||||
jne @f
|
||||
add ecx,[left_scroll_compens]
|
||||
jmp .draw_center_continue_2
|
||||
@@:
|
||||
add ecx,[right_scroll_compens]
|
||||
.draw_center_continue_2:
|
||||
rol ecx,16
|
||||
mcall
|
||||
pop ecx
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
+26
-879
@@ -1,888 +1,35 @@
|
||||
; in:
|
||||
; sort_type - 0=шь , 2=Ёрё°шЁхэшх, 4=тЁхь яюёыхфэхщ ьюфшЇшърЎшш, 6=ЁрчьхЁ,
|
||||
; 10=тЁхь ёючфрэш , 12=тЁхь яюёыхфэхую фюёЄєяр
|
||||
align 4
|
||||
proc sort_directory uses eax ebx, tmem:dword, sort_type:dword
|
||||
mov eax,[tmem]
|
||||
mov ebx,[eax+4] ; number of files
|
||||
add eax,32
|
||||
cmp [eax+40],word '..'
|
||||
jne @f
|
||||
cmp [eax+40+2],byte 0
|
||||
jne @f
|
||||
dec ebx
|
||||
add eax,304
|
||||
@@:
|
||||
stdcall [sort_dir], eax, ebx, [sort_type]
|
||||
ret
|
||||
endp
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
left_sort_files:
|
||||
; mcall 26,9
|
||||
; mov [timer_tick],eax
|
||||
cmp [left_folder_block], 0
|
||||
jz .nothing
|
||||
mov eax,[left_folder_data]
|
||||
add eax,32+40
|
||||
cmp [eax],word '..'
|
||||
jne @f
|
||||
cmp [eax+2],byte 0
|
||||
jne @f
|
||||
add [left_folder_data],304
|
||||
dec [left_folder_block]
|
||||
mov [exit_to_dir],1
|
||||
jz .return_exit_to_dir
|
||||
@@:
|
||||
; add memory for sorting
|
||||
mov ecx,[right_folder_data]
|
||||
sub ecx,[left_folder_data]
|
||||
mov ebx,[appl_memory]
|
||||
add ecx,ebx
|
||||
add ecx,4 ; фы ёЄЁрїютъш
|
||||
push ebx
|
||||
mov [appl_memory],ecx
|
||||
mcall 64,1
|
||||
mov edi,[esp]
|
||||
mov ecx,[appl_memory]
|
||||
sub ecx,edi
|
||||
shr ecx,2
|
||||
mov eax,0xffffffff
|
||||
cld
|
||||
rep stosd
|
||||
cmp [left_sort_flag],0
|
||||
je left_name_sort
|
||||
cmp [left_sort_flag],1
|
||||
je left_type_sort
|
||||
jmp left_size_date_sort
|
||||
.move_sorted_file:
|
||||
; move sorted file area in folder area
|
||||
mov esi,[esp]
|
||||
mov edi,[left_folder_data]
|
||||
add edi,32
|
||||
mov ecx,[right_folder_data]
|
||||
sub ecx,edi
|
||||
shr ecx,2
|
||||
cld
|
||||
rep movsd
|
||||
; sub memory for sorting
|
||||
pop ecx
|
||||
add ecx,4 ; фы ёЄЁрїютъш
|
||||
mov [appl_memory],ecx
|
||||
mcall 64,1
|
||||
cmp [exit_to_dir],0
|
||||
je @f
|
||||
.return_exit_to_dir:
|
||||
sub [left_folder_data],304
|
||||
inc [left_folder_block]
|
||||
mov [exit_to_dir],0
|
||||
@@:
|
||||
.nothing:
|
||||
; mcall 26,9
|
||||
; sub eax,[timer_tick]
|
||||
; mov [timer_tick],eax
|
||||
; call draw_window
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
left_name_sort:
|
||||
; sorting of files
|
||||
call prepare_data_1
|
||||
call left_name_sort_1
|
||||
call prepare_data_2
|
||||
call left_name_sort_1
|
||||
.1:
|
||||
call prepare_data_4
|
||||
jmp left_sort_files.move_sorted_file
|
||||
left_name_sort_1:
|
||||
xor ebp,ebp
|
||||
.copy_folders:
|
||||
call copy_folders_1
|
||||
je .file
|
||||
test [esi],byte 0x10
|
||||
jz .continue
|
||||
jmp @f
|
||||
.file:
|
||||
test [esi],byte 0x10
|
||||
jnz .continue
|
||||
@@:
|
||||
call prepare_data_3
|
||||
.start:
|
||||
push esi edi
|
||||
call sort_by_name.start
|
||||
jae .add_counter
|
||||
.no_add_counter:
|
||||
call move_area_for_bdvk
|
||||
pop edi esi
|
||||
jmp .end
|
||||
.add_counter:
|
||||
inc [sort_counter]
|
||||
pop edi esi
|
||||
call add_counter
|
||||
jae .start
|
||||
.end:
|
||||
call move_bdvk
|
||||
.continue:
|
||||
inc ebp
|
||||
cmp ebp,[left_folder_block]
|
||||
jb .copy_folders
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
left_type_sort:
|
||||
; sorting of files
|
||||
call left_prepare_extension_start_1
|
||||
call prepare_data_1
|
||||
call left_type_sort_1
|
||||
call prepare_data_2
|
||||
call left_type_sort_1
|
||||
jmp left_name_sort.1
|
||||
left_type_sort_1:
|
||||
xor ebp,ebp
|
||||
.copy_folders:
|
||||
call copy_folders_1
|
||||
je .file
|
||||
; test [esi],byte 0x10
|
||||
test al,ah
|
||||
jz .continue
|
||||
jmp @f
|
||||
.file:
|
||||
; test [esi],byte 0x10
|
||||
test al,ah
|
||||
jnz .continue
|
||||
@@:
|
||||
call prepare_data_3
|
||||
.start:
|
||||
push esi edi
|
||||
cmp [dir_or_file],1
|
||||
je @f
|
||||
call prepare_data_5
|
||||
@@:
|
||||
call sort_by_name.start
|
||||
je .1
|
||||
ja .add_counter
|
||||
.no_add_counter:
|
||||
; pushad
|
||||
; pushfd
|
||||
; dps 'left_type_sort'
|
||||
; newline
|
||||
; popfd
|
||||
; popad
|
||||
call move_area_for_bdvk
|
||||
pop edi esi
|
||||
jmp .end
|
||||
.1:
|
||||
cmp [dir_or_file],1
|
||||
je .add_counter
|
||||
call sort_by_name
|
||||
jbe .no_add_counter
|
||||
.add_counter:
|
||||
inc [sort_counter]
|
||||
pop edi esi
|
||||
call add_counter
|
||||
jae .start
|
||||
.end:
|
||||
call move_bdvk
|
||||
.continue:
|
||||
inc ebp
|
||||
cmp ebp,[left_folder_block]
|
||||
jb .copy_folders
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
left_size_date_sort:
|
||||
; sorting of files
|
||||
call prepare_data_1
|
||||
call left_size_date_sort_1
|
||||
call prepare_data_2
|
||||
call left_size_date_sort_1
|
||||
jmp left_name_sort.1
|
||||
left_size_date_sort_1:
|
||||
xor ebp,ebp
|
||||
.copy_folders:
|
||||
call copy_folders_1
|
||||
je .file
|
||||
test [esi],byte 0x10
|
||||
jz .continue
|
||||
jmp @f
|
||||
.file:
|
||||
test [esi],byte 0x10
|
||||
jnz .continue
|
||||
@@:
|
||||
call prepare_data_3
|
||||
.start:
|
||||
push esi edi
|
||||
mov eax,[left_sort_flag]
|
||||
cmp eax,2
|
||||
je .size_sort
|
||||
call sort_by_date
|
||||
; je .1
|
||||
jae .add_counter
|
||||
jmp .no_add_counter
|
||||
.size_sort:
|
||||
cmp [dir_or_file],0
|
||||
je .file_1
|
||||
call sort_by_name.start
|
||||
jmp @f
|
||||
.file_1:
|
||||
call sort_by_size
|
||||
@@:
|
||||
jae .add_counter
|
||||
.no_add_counter:
|
||||
call move_area_for_bdvk
|
||||
pop edi esi
|
||||
jmp .end
|
||||
;.1:
|
||||
; call sort_by_name.start
|
||||
; jbe .no_add_counter
|
||||
.add_counter:
|
||||
inc [sort_counter]
|
||||
pop edi esi
|
||||
call add_counter
|
||||
jae .start
|
||||
.end:
|
||||
call move_bdvk
|
||||
.continue:
|
||||
inc ebp
|
||||
cmp ebp,[left_folder_block]
|
||||
jb .copy_folders
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
left_prepare_extension_start:
|
||||
xor ebp,ebp
|
||||
cmp [left_folder_block],ebp
|
||||
je .exit
|
||||
mov esi,[left_folder_data]
|
||||
add esi,32+40
|
||||
.start:
|
||||
call prepare_extension_start_all
|
||||
cmp ebp,[left_folder_block]
|
||||
jb .start
|
||||
.exit:
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
prepare_extension_start_all:
|
||||
push esi
|
||||
call search_extension_start
|
||||
mov eax,esi
|
||||
pop esi
|
||||
sub eax,esi
|
||||
sub ebx,esi
|
||||
shl eax,16
|
||||
mov ax,bx
|
||||
mov [esi+300-40],eax
|
||||
mov [esi+299-40],byte 0
|
||||
add esi,304
|
||||
inc ebp
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
left_prepare_extension_start_1:
|
||||
xor ebp,ebp
|
||||
mov edi,[esp+4]
|
||||
.start:
|
||||
xor eax,eax
|
||||
mov [edi+300],eax
|
||||
add edi,304
|
||||
inc ebp
|
||||
cmp ebp,[left_folder_block]
|
||||
jb .start
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
;left_files_name_normalize:
|
||||
; xor ebp,ebp
|
||||
; mov esi,[left_folder_data]
|
||||
; add esi,32+40
|
||||
;.start:
|
||||
; push esi
|
||||
; mov al,[esi]
|
||||
; call char_toupper
|
||||
; mov [esi],al
|
||||
;@@:
|
||||
; inc esi
|
||||
; mov al,[esi]
|
||||
; test al,al
|
||||
; jz @f
|
||||
; call char_todown
|
||||
; mov [esi],al
|
||||
; jmp @b
|
||||
;@@:
|
||||
; pop esi
|
||||
; add esi,304
|
||||
; inc ebp
|
||||
; cmp ebp,[left_folder_block]
|
||||
; jb .start
|
||||
; ret
|
||||
;---------------------------------------------------------------------
|
||||
;right_files_name_normalize:
|
||||
; xor ebp,ebp
|
||||
; mov esi,[right_folder_data]
|
||||
; add esi,32+40
|
||||
;.start:
|
||||
; push esi
|
||||
; mov al,[esi]
|
||||
; call char_toupper
|
||||
; mov [esi],al
|
||||
;@@:
|
||||
; inc esi
|
||||
; mov al,[esi]
|
||||
; test al,al
|
||||
; jz @f
|
||||
; call char_todown
|
||||
; mov [esi],al
|
||||
; jmp @b
|
||||
;@@:
|
||||
; pop esi
|
||||
; add esi,304
|
||||
; inc ebp
|
||||
; cmp ebp,[right_folder_block]
|
||||
; jb .start
|
||||
; ret
|
||||
;---------------------------------------------------------------------
|
||||
right_prepare_extension_start:
|
||||
xor ebp,ebp
|
||||
cmp [right_folder_block],ebp
|
||||
je .exit
|
||||
mov esi,[right_folder_data]
|
||||
add esi,32+40
|
||||
.start:
|
||||
call prepare_extension_start_all
|
||||
cmp ebp,[right_folder_block]
|
||||
jb .start
|
||||
.exit:
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
right_prepare_extension_start_1:
|
||||
xor ebp,ebp
|
||||
mov edi,[esp+4]
|
||||
.start:
|
||||
xor eax,eax
|
||||
mov [edi+300],eax
|
||||
add edi,304
|
||||
inc ebp
|
||||
cmp ebp,[right_folder_block]
|
||||
jb .start
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
prepare_data_1:
|
||||
mov [dir_or_file],1
|
||||
mov [dir_temp_counter],0
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
prepare_data_2:
|
||||
mov eax,[dir_temp_counter]
|
||||
mov [dir_temp_counter_1],eax
|
||||
imul eax,304
|
||||
add [esp+4],eax
|
||||
mov [dir_or_file],0
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
prepare_data_3:
|
||||
mov edi,[esp+4+4]
|
||||
add esi,40
|
||||
add edi,40
|
||||
mov [sort_counter],0
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
prepare_data_4:
|
||||
mov eax,[dir_temp_counter_1]
|
||||
imul eax,304
|
||||
sub [esp+4],eax
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
prepare_data_5:
|
||||
xor eax,eax
|
||||
mov ax,[esi+302-40]
|
||||
add esi,eax
|
||||
mov ax,[edi+302-40]
|
||||
add edi,eax
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
sort_by_name:
|
||||
mov esi,[esp+8]
|
||||
mov edi,[esp+4]
|
||||
.start:
|
||||
cld
|
||||
lodsd
|
||||
mov ebx,[edi] ; bufer
|
||||
add edi,4
|
||||
cmp al,bl
|
||||
jnz @f
|
||||
test bl, bl
|
||||
jz @f
|
||||
cmp ah,bh
|
||||
jnz @f
|
||||
test bh, bh
|
||||
jz @f
|
||||
ror eax,16
|
||||
ror ebx,16
|
||||
cmp al,bl
|
||||
jnz @f
|
||||
test bl, bl
|
||||
jz @f
|
||||
cmp ah, bh
|
||||
jnz @f
|
||||
test bh, bh
|
||||
jnz .start
|
||||
@@:
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
sort_by_name_3:
|
||||
mov esi,[esp+8]
|
||||
mov edi,[esp+4]
|
||||
.start:
|
||||
cld
|
||||
lodsd
|
||||
mov ecx,4
|
||||
rep scasb
|
||||
jz .start
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
sort_by_name_1:
|
||||
mov esi,[esp+8]
|
||||
mov edi,[esp+4]
|
||||
cmp [edi],byte 255
|
||||
je @f
|
||||
.start:
|
||||
cld
|
||||
lodsb
|
||||
mov ah,[edi] ; bufer
|
||||
inc edi
|
||||
cmp al,ah
|
||||
jnz @f
|
||||
test ah, ah
|
||||
jnz .start
|
||||
cmp [fb_left.folder_block], 0
|
||||
jz @f
|
||||
stdcall sort_directory, [fb_left.folder_data], [left_sort_flag]
|
||||
@@:
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
sort_by_date:
|
||||
mov eax,[esi-12] ;+28-40]
|
||||
cmp eax,[edi-12] ;+28-40]
|
||||
jnz .end
|
||||
mov eax,[esi-16] ;+24-40]
|
||||
cmp eax,[edi-16] ;+24-40]
|
||||
.end:
|
||||
ret
|
||||
|
||||
;mov eax,[esi-12]
|
||||
;cmp eax,[edi-12]
|
||||
;jz @f
|
||||
;ret
|
||||
;@@:
|
||||
;mov eax,[esi-16]
|
||||
;cmp eax,[edi-16]
|
||||
;ret
|
||||
|
||||
;push ecx ; ьюцэю юяєёЄшЄ№, хёыш ecx эх црыъю
|
||||
;mov eax,[esi-12]
|
||||
;cmp eax,[edi-12]
|
||||
;setnz ch
|
||||
;adc ch,-2
|
||||
;mov eax,[esi-16]
|
||||
;cmp eax,[edi-16]
|
||||
;setnz cl
|
||||
;adc cl,-2
|
||||
;cmp cx,0xFEFE
|
||||
;pop ecx
|
||||
;ret
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
sort_by_size:
|
||||
mov eax,[esi-4] ;+36-40]
|
||||
cmp eax,[edi-4] ;+36-40]
|
||||
jnz .end
|
||||
mov eax,[esi-8] ;+32-40]
|
||||
cmp eax,[edi-8] ;+32-40]
|
||||
.end:
|
||||
ret
|
||||
|
||||
;mov eax,[esi-4]
|
||||
;cmp eax,[edi-4]
|
||||
;jz @f
|
||||
;ret
|
||||
;@@:
|
||||
;mov eax,[esi-8]
|
||||
;cmp eax,[edi-8]
|
||||
;ret
|
||||
|
||||
;push ecx ; ьюцэю юяєёЄшЄ№, хёыш ecx эх црыъю
|
||||
;mov eax,[esi-4]
|
||||
;cmp eax,[edi-4]
|
||||
;setnz ch
|
||||
;adc ch,-2
|
||||
;mov eax,[esi-8]
|
||||
;cmp eax,[edi-8]
|
||||
;setnz cl
|
||||
;adc cl,-2
|
||||
;cmp cx,0xFEFE
|
||||
;pop ecx
|
||||
;ret
|
||||
;---------------------------------------------------------------------
|
||||
add_counter:
|
||||
add edi,304
|
||||
mov eax,[appl_memory]
|
||||
sub eax,304-40
|
||||
cmp eax,edi
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
copy_folders_1:
|
||||
mov edi,ebp
|
||||
call multiple_304
|
||||
; imul edi,304
|
||||
mov esi,edi
|
||||
add esi,[left_folder_data]
|
||||
add esi,32
|
||||
mov ah,0x10
|
||||
mov al,[esi]
|
||||
cmp [dir_or_file],0
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
copy_folders_2:
|
||||
mov edi,ebp
|
||||
call multiple_304
|
||||
; imul edi,304
|
||||
mov esi,edi
|
||||
add esi,[right_folder_data]
|
||||
add esi,32
|
||||
cmp [dir_or_file],0
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
move_bdvk:
|
||||
sub esi,40
|
||||
mov edi,[sort_counter]
|
||||
call multiple_304
|
||||
add edi,[esp+4+4]
|
||||
call move_bdvk_1
|
||||
inc [dir_temp_counter]
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
move_bdvk_1:
|
||||
mov eax,[esi+300]
|
||||
mov [edi+300],eax
|
||||
mov ecx,0
|
||||
mov [edi+299],cl
|
||||
mov cx,[esi+300]
|
||||
add ecx,41
|
||||
ror ecx,2
|
||||
mov ax,cx
|
||||
xor cx,cx
|
||||
rol ecx,2
|
||||
mov bx,cx
|
||||
mov cx,ax
|
||||
cld
|
||||
rep movsd
|
||||
mov cx,bx
|
||||
rep movsb
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
multiple_304:
|
||||
shl edi,4
|
||||
mov eax,edi
|
||||
mov ebx,eax
|
||||
shl edi,5
|
||||
shl eax,3
|
||||
sub edi,eax
|
||||
mov eax,ebx
|
||||
shl ebx,2
|
||||
sub edi,ebx
|
||||
sub edi,eax
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
move_area_for_bdvk:
|
||||
mov eax,[dir_temp_counter]
|
||||
mov edi,[sort_counter]
|
||||
test eax,eax
|
||||
je .end
|
||||
cmp eax,edi
|
||||
jbe .end
|
||||
call multiple_304
|
||||
; imul edi,304
|
||||
mov ecx,edi
|
||||
mov edi,[dir_temp_counter]
|
||||
add edi,2
|
||||
call multiple_304
|
||||
; imul edi,304
|
||||
mov eax,ecx
|
||||
mov ebx,[esp+12+4]
|
||||
add edi,ebx
|
||||
mov edx,[appl_memory]
|
||||
cmp edi,edx
|
||||
jbe @f
|
||||
mov edi,edx
|
||||
@@:
|
||||
mov esi,edi
|
||||
sub esi,304
|
||||
mov ecx,edi
|
||||
sub ecx,ebx
|
||||
sub ecx,eax
|
||||
shr ecx,2
|
||||
; pushad
|
||||
; pushfd
|
||||
; dph [appl_memory]
|
||||
; newline
|
||||
; dps 'ECX:'
|
||||
; dpd ecx
|
||||
; newline
|
||||
; dps 'ESI:'
|
||||
; dpd esi
|
||||
; newline
|
||||
; dps 'EDI:'
|
||||
; dpd edi
|
||||
; newline
|
||||
; popfd
|
||||
; popad
|
||||
std
|
||||
rep movsd
|
||||
; pushad
|
||||
; pushfd
|
||||
; dps 'move_area_for_bdvk END'
|
||||
; newline
|
||||
; popfd
|
||||
; popad
|
||||
; mov eax,ecx
|
||||
; mov ebx,304
|
||||
; mov edx,0
|
||||
; div ebx
|
||||
; mov ecx,eax
|
||||
; sub ecx,2
|
||||
; mov eax,[appl_memory]
|
||||
; mov [temp_ecx],edi
|
||||
; mov [temp_ebx],esi
|
||||
; mov [temp_eax],eax
|
||||
; pusha
|
||||
; call draw_window
|
||||
; mcall 5,300
|
||||
; popa
|
||||
; sub edi,303
|
||||
; sub esi,303
|
||||
;@@:
|
||||
; push ecx esi edi
|
||||
; call move_bdvk_1
|
||||
; pop edi esi ecx
|
||||
; sub edi,304
|
||||
; sub esi,304
|
||||
; dec ecx
|
||||
; jnz @b
|
||||
.end:
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
search_extension_start:
|
||||
mov edx,esi
|
||||
xor eax,eax
|
||||
@@:
|
||||
cld
|
||||
lodsb
|
||||
test eax,eax
|
||||
jnz @b
|
||||
dec esi
|
||||
dec edx
|
||||
push esi
|
||||
@@:
|
||||
std
|
||||
lodsb
|
||||
cmp esi,edx
|
||||
je .end
|
||||
cmp al,'.'
|
||||
jnz @b
|
||||
add esi,2
|
||||
pop ebx
|
||||
ret
|
||||
.end:
|
||||
pop esi
|
||||
mov ebx,esi
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
right_sort_files:
|
||||
cmp [right_folder_block], 0
|
||||
jz .nothing
|
||||
mov eax,[right_folder_data]
|
||||
add eax,32+40
|
||||
cmp [eax],word '..'
|
||||
jne @f
|
||||
cmp [eax+2],byte 0
|
||||
jne @f
|
||||
add [right_folder_data],304
|
||||
dec [right_folder_block]
|
||||
mov [exit_to_dir],1
|
||||
jz .return_exit_to_dir
|
||||
cmp [fb_right.folder_block], 0
|
||||
jz @f
|
||||
stdcall sort_directory, [fb_right.folder_data], [right_sort_flag]
|
||||
@@:
|
||||
; add memory for sorting
|
||||
mov ecx,[appl_memory]
|
||||
push ecx
|
||||
sub ecx,[right_folder_data]
|
||||
add ecx,[esp]
|
||||
add ecx,4 ; фы ёЄЁрїютъш
|
||||
mov [appl_memory],ecx
|
||||
mcall 64,1
|
||||
mov edi,[esp]
|
||||
mov ecx,[appl_memory]
|
||||
sub ecx,edi
|
||||
shr ecx,2
|
||||
mov eax,0xffffffff
|
||||
cld
|
||||
rep stosd
|
||||
cmp [right_sort_flag],0
|
||||
je right_name_sort
|
||||
cmp [right_sort_flag],1
|
||||
je right_type_sort
|
||||
jmp right_size_date_sort
|
||||
.move_sorted_file:
|
||||
; move sorted file area in folder area
|
||||
mov esi,[esp]
|
||||
mov ecx,esi
|
||||
mov edi,[right_folder_data]
|
||||
add edi,32
|
||||
sub ecx,edi
|
||||
shr ecx,2
|
||||
cld
|
||||
rep movsd
|
||||
; sub memory for sorting
|
||||
pop ecx
|
||||
add ecx,4 ; фы ёЄЁрїютъш
|
||||
mov [appl_memory],ecx
|
||||
mcall 64,1
|
||||
cmp [exit_to_dir],0
|
||||
je @f
|
||||
.return_exit_to_dir:
|
||||
sub [right_folder_data],304
|
||||
inc [right_folder_block]
|
||||
mov [exit_to_dir],0
|
||||
@@:
|
||||
.nothing:
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
right_name_sort:
|
||||
; sorting of files
|
||||
call prepare_data_1
|
||||
call right_name_sort_1
|
||||
call prepare_data_2
|
||||
call right_name_sort_1
|
||||
.1:
|
||||
call prepare_data_4
|
||||
jmp right_sort_files.move_sorted_file
|
||||
right_name_sort_1:
|
||||
xor ebp,ebp
|
||||
.copy_folders:
|
||||
call copy_folders_2
|
||||
je .file
|
||||
test [esi],byte 0x10
|
||||
jz .continue
|
||||
jmp @f
|
||||
.file:
|
||||
test [esi],byte 0x10
|
||||
jnz .continue
|
||||
@@:
|
||||
call prepare_data_3
|
||||
.start:
|
||||
push esi edi
|
||||
call sort_by_name.start
|
||||
jae .add_counter
|
||||
.no_add_counter:
|
||||
call move_area_for_bdvk
|
||||
pop edi esi
|
||||
jmp .end
|
||||
.add_counter:
|
||||
inc [sort_counter]
|
||||
pop edi esi
|
||||
call add_counter
|
||||
jae .start
|
||||
.end:
|
||||
call move_bdvk
|
||||
.continue:
|
||||
inc ebp
|
||||
cmp ebp,[right_folder_block]
|
||||
jb .copy_folders
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
right_type_sort:
|
||||
; sorting of files
|
||||
call right_prepare_extension_start_1
|
||||
call prepare_data_1
|
||||
call right_type_sort_1
|
||||
call prepare_data_2
|
||||
call right_type_sort_1
|
||||
jmp right_name_sort.1
|
||||
right_type_sort_1:
|
||||
xor ebp,ebp
|
||||
.copy_folders:
|
||||
call copy_folders_2
|
||||
je .file
|
||||
test [esi],byte 0x10
|
||||
jz .continue
|
||||
jmp @f
|
||||
.file:
|
||||
test [esi],byte 0x10
|
||||
jnz .continue
|
||||
@@:
|
||||
call prepare_data_3
|
||||
.start:
|
||||
push esi edi
|
||||
cmp [dir_or_file],1
|
||||
je @f
|
||||
call prepare_data_5
|
||||
@@:
|
||||
call sort_by_name.start
|
||||
je .1
|
||||
ja .add_counter
|
||||
.no_add_counter:
|
||||
; pushad
|
||||
; pushfd
|
||||
; dps 'left_type_sort'
|
||||
; newline
|
||||
; popfd
|
||||
; popad
|
||||
call move_area_for_bdvk
|
||||
pop edi esi
|
||||
jmp .end
|
||||
.1:
|
||||
cmp [dir_or_file],1
|
||||
je .add_counter
|
||||
call sort_by_name
|
||||
jbe .no_add_counter
|
||||
.add_counter:
|
||||
inc [sort_counter]
|
||||
pop edi esi
|
||||
call add_counter
|
||||
jae .start
|
||||
.end:
|
||||
call move_bdvk
|
||||
.continue:
|
||||
inc ebp
|
||||
cmp ebp,[right_folder_block]
|
||||
jb .copy_folders
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
right_size_date_sort:
|
||||
; sorting of files
|
||||
call prepare_data_1
|
||||
call right_size_date_sort_1
|
||||
call prepare_data_2
|
||||
call right_size_date_sort_1
|
||||
jmp right_name_sort.1
|
||||
right_size_date_sort_1:
|
||||
xor ebp,ebp
|
||||
.copy_folders:
|
||||
call copy_folders_2
|
||||
je .file
|
||||
test [esi],byte 0x10
|
||||
jz .continue
|
||||
jmp @f
|
||||
.file:
|
||||
test [esi],byte 0x10
|
||||
jnz .continue
|
||||
@@:
|
||||
call prepare_data_3
|
||||
.start:
|
||||
push esi edi
|
||||
cmp [right_sort_flag],2
|
||||
je .size_sort
|
||||
call sort_by_date
|
||||
je .1
|
||||
ja .add_counter
|
||||
jmp .no_add_counter
|
||||
.size_sort:
|
||||
cmp [dir_or_file],0
|
||||
je .file_1
|
||||
call sort_by_name.start
|
||||
jmp @f
|
||||
.file_1:
|
||||
call sort_by_size
|
||||
@@:
|
||||
jae .add_counter
|
||||
.no_add_counter:
|
||||
call move_area_for_bdvk
|
||||
pop edi esi
|
||||
jmp .end
|
||||
.1:
|
||||
call sort_by_name.start
|
||||
jbe .no_add_counter
|
||||
.add_counter:
|
||||
inc [sort_counter]
|
||||
pop edi esi
|
||||
call add_counter
|
||||
jae .start
|
||||
.end:
|
||||
call move_bdvk
|
||||
.continue:
|
||||
inc ebp
|
||||
cmp ebp,[right_folder_block]
|
||||
jb .copy_folders
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
+47
-23
@@ -1,4 +1,8 @@
|
||||
header_text db 'Kolibri File Manager v0.48e',0
|
||||
header_text db 'Kolibri File Manager v0.49'
|
||||
if USE_STATIC_LIBS eq 1
|
||||
db ' static'
|
||||
end if
|
||||
db 0
|
||||
;---------------------------------------------------------------------
|
||||
fbutton_name:
|
||||
.f1 db '1 Help',0
|
||||
@@ -62,16 +66,20 @@ select_disk_char:
|
||||
truncated_filename_char db '..'
|
||||
;---------------------------------------------------------------------
|
||||
sort_button_name:
|
||||
.name db 'Name'
|
||||
.type db 'Type'
|
||||
.size db 'Size'
|
||||
.date db 'Date'
|
||||
.name db 'Name '
|
||||
.name_e db ' ',0
|
||||
.type db 'Type '
|
||||
.type_e db ' ',0
|
||||
.size db 'Size '
|
||||
.size_e db ' ',0
|
||||
.date db 'Date '
|
||||
.date_e db ' ',0
|
||||
;---------------------------------------------------------------------
|
||||
type_table:
|
||||
db '<DIR> '
|
||||
db '<DIR> '
|
||||
;---------------------------------------------------------------------
|
||||
size_table:
|
||||
db '1023b '
|
||||
db '1023b '
|
||||
;---------------------------------------------------------------------
|
||||
date_table:
|
||||
db ' . . 22:00 '
|
||||
@@ -80,36 +88,39 @@ year_table:
|
||||
db ' '
|
||||
;---------------------------------------------------------------------
|
||||
ini_file_name:
|
||||
db 'kfm.ini',0
|
||||
db '/sys/File managers/icon2ext.ini',0
|
||||
error_open_ini_file:
|
||||
db '"Initialization error',13,10,\
|
||||
'Error opening file ',39,'icon2ext.ini',39,'!" -tW',0
|
||||
;---------------------------------------------------------------------
|
||||
error_type:
|
||||
db 'File system error',0
|
||||
;---------------------------------------------------------------------
|
||||
delete_type:
|
||||
sz_Delete_files:
|
||||
db 'Delete file(s)',0
|
||||
;---------------------------------------------------------------------
|
||||
copy_type:
|
||||
db ' Copy files',0
|
||||
;---------------------------------------------------------------------
|
||||
copy_type_1:
|
||||
sz_Copy_file:
|
||||
db 'Copy file',0
|
||||
;---------------------------------------------------------------------
|
||||
move_type:
|
||||
db ' Move files',0
|
||||
;---------------------------------------------------------------------
|
||||
move_type_1:
|
||||
sz_Move_file:
|
||||
db 'Move file',0
|
||||
;---------------------------------------------------------------------
|
||||
rename_type:
|
||||
db ' Rename files',0
|
||||
;---------------------------------------------------------------------
|
||||
rename_type_1:
|
||||
sz_Rename_file:
|
||||
db 'Rename file',0
|
||||
;---------------------------------------------------------------------
|
||||
create_dir:
|
||||
sz_Create_dir:
|
||||
db 'Create directory',0
|
||||
;---------------------------------------------------------------------
|
||||
create_file:
|
||||
sz_Create_file:
|
||||
db 'Create file',0
|
||||
;---------------------------------------------------------------------
|
||||
exit_type:
|
||||
@@ -148,6 +159,23 @@ type_change:
|
||||
type_access:
|
||||
db 'Access date:',0
|
||||
;---------------------------------------------------------------------
|
||||
sz_main_menu_File db 'File',0
|
||||
sz_main_menu_Select db 'Select',0
|
||||
sz_main_menu_Sort db 'Sort',0
|
||||
sz_main_menu_Help db 'Help',0
|
||||
|
||||
sz_menu_File_selection db 'File selection Insert',0
|
||||
sz_menu_Select_all db 'Select all Ctrl+A',0
|
||||
sz_menu_Clear_selection db 'Clear selection Ctrl+Num-',0
|
||||
sz_menu_Invert_selection db 'Invert selection Ctrl+Num*',0
|
||||
|
||||
sz_menu_Copy_file db 'Copy file F5',0
|
||||
sz_menu_Move_file db 'Move file F6',0
|
||||
sz_menu_Create_dir db 'Create directory F7',0
|
||||
sz_menu_Delete_files db 'Delete file(s) F8',0
|
||||
sz_menu_Exit db 'Exit F12',0
|
||||
sz_menu_About db 'About KFM F1',0
|
||||
;---------------------------------------------------------------------
|
||||
type_limiters_data_time:
|
||||
db '/ / : :',0
|
||||
;---------------------------------------------------------------------
|
||||
@@ -200,19 +228,15 @@ mouse_key_delay dd 100
|
||||
;---------------------------------------------------------------------
|
||||
copy_editboxes:
|
||||
create_editboxes:
|
||||
edit1 edit_box 150,10,10,0xffffff,0xbbddff,0,0,0,255,create_dir_name,ed_focus+ed_always_focus,0
|
||||
copy_editboxes_end:
|
||||
create_editboxes_end:
|
||||
;---------------------------------------------------------------------
|
||||
;copy_editboxes:
|
||||
;edit2 edit_box 150,10,10,0xffffff,0,0,0,0,255,create_dir_name,ed_focus,0
|
||||
;copy_editboxes_end:
|
||||
edit1 edit_box 150,10,10, 0xffffff,0xbbddff,0,0,0,\
|
||||
255,create_dir_name,mouse_flag,ed_focus+ed_always_focus,0
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
sysopen:
|
||||
dd 7,0,start_parameter,0,0
|
||||
dd SSF_START_APP,0,start_parameter,0,0
|
||||
db '/sys/@open',0
|
||||
;---------------------------------------------------------------------
|
||||
if USE_STATIC_LIBS eq 1
|
||||
buttons_file_data file 'images/buttons.raw'
|
||||
icons_file_data file 'images/icons.raw'
|
||||
end if
|
||||
;---------------------------------------------------------------------
|
||||
@@ -1,60 +1,5 @@
|
||||
;---------------------------------------------------------------------
|
||||
get_icon_number:
|
||||
mov ebp,[extension_size] ;[icons_end_tag]
|
||||
test ebp,ebp
|
||||
jz .end
|
||||
call normalize_extension_of_file
|
||||
mov edx,[icons_end_tag]
|
||||
mov edi,[ini_file_start]
|
||||
dec edi
|
||||
.search_association:
|
||||
cmp edx,edi
|
||||
jbe .end
|
||||
mov esi,extension_temp_storage
|
||||
mov ecx,ebp
|
||||
test ecx,ecx
|
||||
je @f
|
||||
sub ecx,2
|
||||
@@:
|
||||
inc edi
|
||||
mov ebx,edi
|
||||
cld
|
||||
rep cmpsb
|
||||
mov edi,ebx
|
||||
jne .search_association
|
||||
mov esi,edi
|
||||
add esi,ebp
|
||||
test ebp,ebp
|
||||
je @f
|
||||
sub esi,2
|
||||
@@:
|
||||
cmp [esi],byte ' '
|
||||
jne .search_association
|
||||
inc esi
|
||||
xor ebx,ebx
|
||||
call .calculate
|
||||
imul eax,1000
|
||||
call .calculate_1
|
||||
imul eax,100
|
||||
call .calculate_1
|
||||
imul eax,10
|
||||
call .calculate_1
|
||||
add ebx,eax
|
||||
ret
|
||||
.end:
|
||||
mov ebx,2
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
.calculate_1:
|
||||
add ebx,eax
|
||||
.calculate:
|
||||
xor eax,eax
|
||||
cld
|
||||
lodsb
|
||||
sub eax,0x30
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
normalize_extension_of_file:
|
||||
proc normalize_extension_of_file
|
||||
push edi
|
||||
mov esi,[extension_start]
|
||||
mov edi,extension_temp_storage
|
||||
@@ -67,6 +12,7 @@ normalize_extension_of_file:
|
||||
jnz @b
|
||||
pop edi
|
||||
ret
|
||||
endp
|
||||
;---------------------------------------------------------------------
|
||||
open_file_with_appl_1:
|
||||
mov ebp,files_associations_1
|
||||
@@ -120,8 +66,8 @@ open_file_with_appl:
|
||||
|
||||
.run_sysopen:
|
||||
@@:
|
||||
cmp [select_panel_counter],0
|
||||
jne @f
|
||||
cmp [fb_right.select_panel_counter],1
|
||||
je @f
|
||||
mov esi,read_folder_name ;read_folder.name
|
||||
jmp .start
|
||||
@@:
|
||||
@@ -156,8 +102,7 @@ open_file_with_appl:
|
||||
jnz @b
|
||||
.continue:
|
||||
mov [start_file_data.param],start_parameter
|
||||
;call start_appl ;Leency
|
||||
mcall 70,sysopen ;Leency
|
||||
mcall SF_FILE, sysopen ;Leency
|
||||
cmp eax,0
|
||||
jge @f
|
||||
mov ebx,0
|
||||
@@ -170,38 +115,4 @@ open_file_with_appl:
|
||||
.end:
|
||||
mov eax,1
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
search_star_and_end_tags:
|
||||
mov edi,[ini_file_start]
|
||||
dec edi
|
||||
.search_tag1:
|
||||
cmp [left_folder_data],edi
|
||||
jbe .end
|
||||
mov esi,ebp
|
||||
mov ecx,22
|
||||
inc edi
|
||||
cld
|
||||
push edi
|
||||
rep cmpsb
|
||||
pop edi
|
||||
jne .search_tag1
|
||||
dec edi
|
||||
push edi
|
||||
.search_end_tag:
|
||||
cmp [left_folder_data],edi
|
||||
jbe .end
|
||||
mov esi,end_section_tag
|
||||
mov ecx,7
|
||||
inc edi
|
||||
cld
|
||||
push edi
|
||||
rep cmpsb
|
||||
pop edi
|
||||
jne .search_end_tag
|
||||
mov [end_tag],edi
|
||||
pop edi
|
||||
ret
|
||||
.end:
|
||||
mov ebp,-1
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
@@ -913,7 +913,7 @@ static off_t get_fileinfo(struct reader *rds,char *buf)
|
||||
#define syncsafe_to_long(buf,res) \
|
||||
( \
|
||||
(((buf)[0]|(buf)[1]|(buf)[2]|(buf)[3]) & 0x80) ? 0 : \
|
||||
(res = (((unsigned long) (buf)[0]) << 27) \
|
||||
(res = (((unsigned long) (buf)[0]) << 21) \
|
||||
| (((unsigned long) (buf)[1]) << 14) \
|
||||
| (((unsigned long) (buf)[2]) << 7) \
|
||||
| ((unsigned long) (buf)[3]) \
|
||||
|
||||
@@ -474,7 +474,7 @@ system_dir_ProcLib db '/sys/lib/proc_lib.obj',0
|
||||
;---------------------------------------------------------------------
|
||||
l_libs_start:
|
||||
library01 l_libs system_dir_Boxlib+9, library_path, system_dir_Boxlib, \
|
||||
Box_lib_import, plugins_directory
|
||||
import_box_lib, plugins_directory
|
||||
|
||||
library02 l_libs system_dir_Libini+9, library_path, system_dir_Libini, \
|
||||
Libini_import, plugins_directory
|
||||
@@ -728,83 +728,7 @@ aIni_set_int db 'ini_set_int',0
|
||||
aIni_set_color db 'ini_set_color',0
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
Box_lib_import:
|
||||
;init_lib dd a_init
|
||||
;version_lib dd a_version
|
||||
|
||||
edit_box_draw dd aEdit_box_draw
|
||||
edit_box_key dd aEdit_box_key
|
||||
edit_box_mouse dd aEdit_box_mouse
|
||||
;version_ed dd aVersion_ed
|
||||
|
||||
init_checkbox dd aInit_checkbox
|
||||
check_box_draw dd aCheck_box_draw
|
||||
check_box_mouse dd aCheck_box_mouse
|
||||
;version_ch dd aVersion_ch
|
||||
|
||||
option_box_draw dd aOption_box_draw
|
||||
option_box_mouse dd aOption_box_mouse
|
||||
;version_op dd aVersion_op
|
||||
|
||||
scrollbar_ver_draw dd aScrollbar_ver_draw
|
||||
scrollbar_ver_mouse dd aScrollbar_ver_mouse
|
||||
scrollbar_hor_draw dd aScrollbar_hor_draw
|
||||
scrollbar_hor_mouse dd aScrollbar_hor_mouse
|
||||
;version_scrollbar dd aVersion_scrollbar
|
||||
|
||||
dinamic_button_draw dd aDbutton_draw
|
||||
dinamic_button_mouse dd aDbutton_mouse
|
||||
;version_dbutton dd aVersion_dbutton
|
||||
|
||||
menu_bar_draw dd aMenu_bar_draw
|
||||
menu_bar_mouse dd aMenu_bar_mouse
|
||||
menu_bar_activate dd aMenu_bar_activate
|
||||
;version_menu_bar dd aVersion_menu_bar
|
||||
|
||||
;FileBrowser_draw dd aFileBrowser_draw
|
||||
;FileBrowser_mouse dd aFileBrowser_mouse
|
||||
;FileBrowser_key dd aFileBrowser_key
|
||||
;Version_FileBrowser dd aVersion_FileBrowser
|
||||
dd 0
|
||||
dd 0
|
||||
|
||||
;a_init db 'lib_init',0
|
||||
;a_version db 'version',0
|
||||
|
||||
aEdit_box_draw db 'edit_box_draw',0
|
||||
aEdit_box_key db 'edit_box_key',0
|
||||
aEdit_box_mouse db 'edit_box_mouse',0
|
||||
;aVersion_ed db 'version_ed',0
|
||||
|
||||
aInit_checkbox db 'init_checkbox2',0
|
||||
aCheck_box_draw db 'check_box_draw2',0
|
||||
aCheck_box_mouse db 'check_box_mouse2',0
|
||||
;aVersion_ch db 'version_ch2',0
|
||||
|
||||
aOption_box_draw db 'option_box_draw',0
|
||||
aOption_box_mouse db 'option_box_mouse',0
|
||||
;aVersion_op db 'version_op',0
|
||||
|
||||
aScrollbar_ver_draw db 'scrollbar_v_draw',0
|
||||
aScrollbar_ver_mouse db 'scrollbar_v_mouse',0
|
||||
aScrollbar_hor_draw db 'scrollbar_h_draw',0
|
||||
aScrollbar_hor_mouse db 'scrollbar_h_mouse',0
|
||||
;aVersion_scrollbar db 'version_scrollbar',0
|
||||
|
||||
aDbutton_draw db 'dbutton_draw',0
|
||||
aDbutton_mouse db 'dbutton_mouse',0
|
||||
;aVersion_dbutton db 'version_dbutton',0
|
||||
|
||||
aMenu_bar_draw db 'menu_bar_draw',0
|
||||
aMenu_bar_mouse db 'menu_bar_mouse',0
|
||||
aMenu_bar_activate db 'menu_bar_activate',0
|
||||
;aVersion_menu_bar db 'version_menu_bar',0
|
||||
|
||||
;aFileBrowser_draw db 'FileBrowser_draw',0
|
||||
;aFileBrowser_mouse db 'FileBrowser_mouse',0
|
||||
;aFileBrowser_key db 'FileBrowser_key',0
|
||||
;aVersion_FileBrowser db 'version_FileBrowser',0
|
||||
include '../../develop/libraries/box_lib/import.inc'
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
load_directory_pointer dd 0
|
||||
|
||||
@@ -421,8 +421,7 @@ draw_scrollbars:
|
||||
jbe @f
|
||||
cmp [scroll_bar_data_vertical.cur_area],0
|
||||
je @f
|
||||
push dword scroll_bar_data_vertical
|
||||
call [scrollbar_ver_draw]
|
||||
stdcall [scrollbar_v_draw], scroll_bar_data_vertical
|
||||
; draw_scroll_bar_vertical scroll_bar_data_vertical
|
||||
inc [draw_scrollbar_counter]
|
||||
@@:
|
||||
@@ -434,8 +433,7 @@ draw_scrollbars:
|
||||
jbe @f
|
||||
cmp [scroll_bar_data_horizontal.cur_area],0
|
||||
je @f
|
||||
push dword scroll_bar_data_horizontal
|
||||
call [scrollbar_hor_draw]
|
||||
stdcall [scrollbar_h_draw], scroll_bar_data_horizontal
|
||||
; draw_scroll_bar_horizontal scroll_bar_data_horizontal
|
||||
inc [draw_scrollbar_counter]
|
||||
@@:
|
||||
|
||||
@@ -18,49 +18,28 @@ draw_window:
|
||||
|
||||
call draw_other
|
||||
|
||||
push dword menu_data_1
|
||||
call [menu_bar_draw]
|
||||
push dword menu_data_2
|
||||
call [menu_bar_draw]
|
||||
push dword menu_data_3
|
||||
call [menu_bar_draw]
|
||||
push dword menu_data_4
|
||||
call [menu_bar_draw]
|
||||
push dword menu_data_5
|
||||
call [menu_bar_draw]
|
||||
push dword menu_data_6
|
||||
call [menu_bar_draw]
|
||||
stdcall [menu_bar_draw], menu_data_1
|
||||
stdcall [menu_bar_draw], menu_data_2
|
||||
stdcall [menu_bar_draw], menu_data_3
|
||||
stdcall [menu_bar_draw], menu_data_4
|
||||
stdcall [menu_bar_draw], menu_data_5
|
||||
stdcall [menu_bar_draw], menu_data_6
|
||||
|
||||
push dword dinamic_button_data_1
|
||||
call [dinamic_button_draw]
|
||||
push dword dinamic_button_data_2
|
||||
call [dinamic_button_draw]
|
||||
push dword dinamic_button_data_3
|
||||
call [dinamic_button_draw]
|
||||
push dword dinamic_button_data_4
|
||||
call [dinamic_button_draw]
|
||||
push dword dinamic_button_data_5
|
||||
call [dinamic_button_draw]
|
||||
push dword dinamic_button_data_6
|
||||
call [dinamic_button_draw]
|
||||
push dword dinamic_button_data_7
|
||||
call [dinamic_button_draw]
|
||||
push dword dinamic_button_data_8
|
||||
call [dinamic_button_draw]
|
||||
push dword dinamic_button_data_9
|
||||
call [dinamic_button_draw]
|
||||
push dword dinamic_button_data_10
|
||||
call [dinamic_button_draw]
|
||||
push dword dinamic_button_data_11
|
||||
call [dinamic_button_draw]
|
||||
push dword dinamic_button_data_12
|
||||
call [dinamic_button_draw]
|
||||
push dword dinamic_button_data_13
|
||||
call [dinamic_button_draw]
|
||||
push dword dinamic_button_data_14
|
||||
call [dinamic_button_draw]
|
||||
push dword dinamic_button_data_15
|
||||
call [dinamic_button_draw]
|
||||
stdcall [dbutton_draw], dinamic_button_data_1
|
||||
stdcall [dbutton_draw], dinamic_button_data_2
|
||||
stdcall [dbutton_draw], dinamic_button_data_3
|
||||
stdcall [dbutton_draw], dinamic_button_data_4
|
||||
stdcall [dbutton_draw], dinamic_button_data_5
|
||||
stdcall [dbutton_draw], dinamic_button_data_6
|
||||
stdcall [dbutton_draw], dinamic_button_data_7
|
||||
stdcall [dbutton_draw], dinamic_button_data_8
|
||||
stdcall [dbutton_draw], dinamic_button_data_9
|
||||
stdcall [dbutton_draw], dinamic_button_data_10
|
||||
stdcall [dbutton_draw], dinamic_button_data_11
|
||||
stdcall [dbutton_draw], dinamic_button_data_12
|
||||
stdcall [dbutton_draw], dinamic_button_data_13
|
||||
stdcall [dbutton_draw], dinamic_button_data_14
|
||||
stdcall [dbutton_draw], dinamic_button_data_15
|
||||
|
||||
mcall 13,<225,2>,<3,22>,0x677EA0 ;0x052B64
|
||||
mcall ,<280,2>
|
||||
|
||||
Loaded 100 of 128 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user