/programs/network/netsurf/build.bat |
---|
0,0 → 1,2 |
fasm nsinstall.asm nsinstall |
pause |
/programs/network/netsurf/notify.asm |
---|
0,0 → 1,147 |
NOTIFY_RUN: |
;; Make param |
stdcall string.copy, sz_quote, params |
stdcall string.copy, filelist_first, current_filename |
call make_text |
stdcall string.concatenate, sz_quote, params |
stdcall string.concatenate, sz_flags, params |
;; RUN NOTIFY |
mcall 70, fi_launch |
;; CONVERT PID TO STR |
mov ebx, 10 |
mov ecx, 0 |
@@: |
mov edx, 0 |
div ebx |
push edx |
inc ecx |
cmpne eax, 0, @b |
mov ebx, ctrl.name |
@@: |
pop eax |
add al, "0" |
mov [ebx], al |
inc ebx |
loop @b |
;; ADD POSTFIX TO STR |
mov dword [ebx + 0], "-NOT" |
mov dword [ebx + 4], "IFY" |
;; OPEN CONTROLLER (0x08 + 0x01 -- CREATE AND READ/WRITE) |
mcall 68, 22, ctrl.name, 2048, 0x09 |
mov [ctrl.addr], eax |
;; WAIT UNTIL CONTROLLER BECOMES READY TO USE |
add eax, NTCTRL_READY |
@@: |
mcall 5, 1 |
cmpe byte [eax], 0, @b |
;; CONFIG PBAR |
mov eax, [ctrl.addr] |
add eax, NTCTRL_PBAR_MAX |
mov dword [eax], 55 |
mov eax, [ctrl.addr] |
add eax, NTCTRL_PBAR_CUR |
mov dword [eax], 0 |
mov eax, [ctrl.addr] |
add eax, NTCTRL_APPLY_PBAR |
mov byte [eax], 1 |
ret |
NOTIFY_CHANGE: |
;; CHANGE TIMER |
inc dword [timer] |
mov ebx, dword [timer] |
;; SEND TIMER TO PBAR |
mov eax, [ctrl.addr] |
add eax, NTCTRL_PBAR_CUR |
mov dword [eax], ebx |
;; APPLY PBAR |
mov eax, [ctrl.addr] |
add eax, NTCTRL_APPLY_PBAR |
mov byte [eax], 1 |
;; CNANGE TEXT |
mov byte [params], 0 |
call make_text |
;; SEND TEXT TO NOTIFY |
mov eax, [ctrl.addr] |
add eax, NTCTRL_TEXT |
stdcall string.copy, params, eax |
;; APPLY NEW TEXT |
mov eax, [ctrl.addr] |
add eax, NTCTRL_APPLY_TEXT |
mov byte [eax], 1 |
ret |
EXIT: |
;; CHANGE ICON |
mov eax, [ctrl.addr] |
add eax, NTCTRL_ICON |
mov byte [eax], 4 |
;; APPLY NEW ICON |
mov eax, [ctrl.addr] |
add eax, NTCTRL_APPLY_ICON |
mov byte [eax], 1 |
;; CNANGE TEXT |
mov byte [params], 0 |
stdcall string.concatenate, sz_final_text, params |
;; SEND TEXT TO NOTIFY |
mov eax, [ctrl.addr] |
add eax, NTCTRL_TEXT |
stdcall string.copy, params, eax |
;; APPLY NEW TEXT |
mov eax, [ctrl.addr] |
add eax, NTCTRL_APPLY_TEXT |
mov byte [eax], 1 |
mcall 5, 300 |
mcall 70, fileopen |
;; CLOSE NOTIFY |
mov eax, [ctrl.addr] |
add eax, NTCTRL_CLOSE |
mov byte [eax], 1 |
mcall -1 |
;------------------------------------------------------------------------------- |
make_text: |
stdcall string.concatenate, sz_text, params |
stdcall string.concatenate, sz_sec_line_start, params |
stdcall string.concatenate, current_filename, params |
ret |
;------------------------------------------------------------------------------- |
/programs/network/netsurf/nsinstall.asm |
---|
34,7 → 34,11 |
include '../../dll.inc' |
include '../../debug-fdo.inc' |
include '../../develop/libraries/http/http.inc' |
include '../../notify.inc' |
include '../../string.inc' |
include 'notify.asm' |
virtual at 0 |
http_msg http_msg |
end virtual |
106,11 → 110,11 |
.file_error: |
DEBUGF 1, "file_erroR with eax = %u!", eax |
mcall -1 |
call EXIT |
.http_error: |
DEBUGF 1, "http_erroR!" |
mcall -1 |
call EXIT |
.http_transfer_done: |
;; Write any remaining bytes from the http buffer into the file |
158,7 → 162,7 |
jz .success |
DEBUGF 1, "Failed to create folder: %s\n", [newfolder] |
mcall -1 |
call EXIT |
.success: |
popa |
167,6 → 171,7 |
START: |
mcall 68, 11 ; init heap |
call NOTIFY_RUN |
; load libraries |
stdcall dll.Load, @IMPORT |
225,6 → 230,9 |
;; current_filename is now set to the name of the file |
;; current_url is now set to the name of the file we will get after download |
DEBUGF 2, "Fetching : %s", current_filename |
pusha |
call NOTIFY_CHANGE |
popa |
stdcall get_file_over_http, current_url, current_filename |
DEBUGF 2, "...DONE!\n" |
jmp .get_next_file |
233,12 → 241,12 |
DEBUGF 2, "-------------------------\n" |
DEBUGF 2, "NETSURF INSTALLED. Enjoy!\n" |
DEBUGF 2, "-------------------------\n" |
mcall -1 |
call EXIT |
;; Inform user that all files are done |
.all_files_done_error: |
DEBUGF 1, "FATAL ERROR: FAILED.\n", eax |
mcall -1 |
call EXIT |
;--------------------------------------------------------------------- |
; Data area |
262,6 → 270,10 |
url db 'www.ashmew2.me/',0 |
; I don't know why NOTIFY_CHANGE doesn't work for the first file |
; so I use this small shit to fix it at NOTIFY_RUN phase |
filelist_first db '/tmp0/1/netsurf-kolibrios', 0 |
filelist db 'netsurf-kolibrios', 0 |
db 'netsurf-kolibrios.map', 0 |
db 'res/adblock.css', 0 |
340,4 → 352,38 |
socketdata rb 4096 |
current_url rb URLMAXLEN |
current_filename rb FILENAMEMAXLEN |
;===================================================================== |
; NOTIFY DATA |
timer dd 0 |
params rb 256 |
ctrl: |
.name rb 32 |
.addr rd 1 |
rb 2048 |
sz_text: |
db "Netsurf installer ", 0 |
sz_quote: |
db "'", 0 |
sz_sec_line_start: |
db 10, "Fetching:",10, 0 |
sz_flags: |
db "Ddcpt", 0 |
sz_final_text: |
db "Netsurf installer",10,"Download complete.",10,"Enjoy!",0 |
fi_launch: |
dd 7, 0, params, 0, 0 |
db "@notify", 0 |
fileopen dd 7 |
dd 0 ; flags |
dd 0 ; parameters |
dd 0 ; reserved |
dd 0 ; reserved |
db "/tmp0/1/netsurf-kolibrios", 0 ; path |
;===================================================================== |
I_END: |