eskin: check skin exists 5 times with delay

git-svn-id: svn://kolibrios.org@7939 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Leency committed 2020-05-17 18:05:05 +00:00
1 parent 6649d8f84c
commit f871bfac83
5 files changed
+41 -25

No files matched your search

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

+2 -2
View File
@@ -9,13 +9,13 @@
/SYS/SETUP BOOT 0 # Load device settings
/SYS/LOADDRV RDC 0 # videodriver for RDC M2010/M2012
/SYS/@TASKBAR "" 0 # Start taskbar
/SYS/@ICON "" 0 # Multithread icon
/SYS/ESKIN "" 0 # Set style
/SYS/@DOCKY "" 0 # Start docky
/SYS/@ICON "" 0 # Multithread icon
/SYS/NETWORK/NETCFG A 0 #
/SYS/NETWORK/@ZEROCONF "" 0 # Network configuration
/SYS/@VOLUME "" 0 # Start volume daemon
/SYS/@SS ASSM 0 # Screensaver
/SYS/@DOCKY "" 0 # Start docky
/SYS/TMPDISK A0 -1 # Add virtual RAM disk /tmp0/1
/SYS/SEARCHAP "" -1 # Search and mount additional system directory
/SYS/@HOTANGLES "" 0 # Start Hot Angles
+1
View File
@@ -7,6 +7,7 @@ tup.rule("easyshot.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPAC
tup.rule("calypte.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "calypte.com")
tup.rule("mblocks.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "mblocks.com")
tup.rule("notify.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "notify.com")
tup.rule("osupdate.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "osupdate.com")
tup.rule("pipet.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "pipet.com")
tup.rule("software_widget.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "software_widget.com")
+37 -22
View File
@@ -19,32 +19,41 @@
_http http;
proc_info Form;
bool install_complete = false;
sensor progress;
#define WINW 400
#define WINH 300
#define WINW 460
char accept_language[]="en"; //not used, necessary for http.get()
//#define LANG_RUS 1
#ifdef LANG_RUS
#define T_INTRO "Попробуйте новое визуальное оформление Колибри, которое раньше было доступно только в KolibriNext.";
#define T_INSTALL "Установить"
#define T_COMPLETE "Установка завершена"
#define WINH 345
#define T_WINDOW_TITLE "Онлайн обновление KolibriOS"
#define T_TITLE_H1 "ОНЛАЙН ОБНОВЛЕНИЕ"
#define T_INTRO "Данное приложение скачает последнюю версию KolibriOS и распакует ее на RAM-диск. При этом ядро не будет перезапущено, для этого необходимо сохранить образ и перезагрузится. Пожалуйста, закройте все открытые приложения перед началом обновления.
ВНИМАНИЕ: Все изменные файлы на RAM-диске будут перезаписаны!";
#define T_INSTALL "Обновить"
#define T_COMPLETE "Обновление завершено"
#define T_EXIT "Выход"
#define IMG_URL "http://builds.kolibrios.org/rus/data/data/kolibri.img"
#else
#define T_INTRO "This app will download the latest KolibriOS dirsto and update your RAM-disk with it. Kernel won't be restarted. Please close all opened apps before start.";
#define WINH 305
#define T_WINDOW_TITLE "KolibriOS Online Updater"
#define T_TITLE_H1 "ONLINE UPDATE"
#define T_INTRO "This app will download the latest KolibriOS dirsto and update your RAM-disk with it. Kernel won't be restarted.
Please close all opened apps before start.
ALERT: All chages on RAM-disk will be lost!";
#define T_INSTALL "Update"
#define T_COMPLETE "Update complete"
#define T_EXIT "Exit"
#define IMG_URL "http://builds.kolibrios.org/eng/data/data/kolibri.img"
#endif
bool install_complete = false;
char accept_language[]="en"; //not used, necessary for http.get()
void main()
{
word btn;
//load_dll(libini, #lib_init,1);
load_dll(libio, #libio_init,1);
load_dll(libimg, #libimg_init,1);
@@ -53,9 +62,7 @@ void main()
loop() switch(WaitEventTimeout(300) & 0xFF)
{
case evButton:
btn = GetButtonID();
if (btn == 1) ExitProcess();
else EventInstall();
if (GetButtonID() == 1) ExitProcess(); else EventInstall();
break;
case evKey:
@@ -74,8 +81,9 @@ void main()
case evNetwork:
if (http.transfer <= 0) break;
http.receive();
if (http.content_length) DrawProgressBar(30, WINH-140, WINW-60, 20, sc.work, 0xC3C3C3,
0x54B1D6, sc.work_text, 100 * http.content_received / http.content_length);
if (http.content_length) {
progress.draw_progress(http.content_length - http.content_received * progress.w / http.content_length);
}
if (http.receive_result == 0) EventDownloadComplete();
}
}
@@ -84,10 +92,15 @@ void draw_window()
{
sc.get();
DefineAndDrawWindow(screen.width-WINW/2,screen.height-WINH/2,
WINW+9,WINH+skin_height,0x34,sc.work,"KolibriOS Online Updater",0);
WINW+9,WINH+skin_height,0x34,sc.work,T_WINDOW_TITLE,0);
GetProcessInfo(#Form, -1);
WriteText(30, 20, 0x81, 0xEC008C, "ONLINE UPDATE");
if (install_complete) DrawInstallComplete(); else DrawIntro();
WriteText(30, 20, 0x81, 0xEC008C, T_TITLE_H1);
if (install_complete) {
DrawInstallComplete();
} else {
DrawIntro();
progress.set_size(30, WINH-130, WINW-60, 20);
}
}
void DrawIntro()
@@ -115,16 +128,18 @@ void EventDownloadComplete()
{
dword unimg_id, slot_n;
CreateFile(http.content_received, http.content_pointer, "/tmp0/1/last.img");
CreateFile(http.content_received, http.content_pointer, "/tmp0/1/latest.img");
http.free();
unimg_id = RunProgram("/tmp0/1/unimg", "/tmp0/1/last.img -e");
unimg_id = RunProgram("/sys/unimg", "/tmp0/1/latest.img /tmp0/1/latest_img -e");
do {
slot_n = GetProcessSlot(unimg_id);
pause(10);
} while (slot_n!=0);
copyf("/tmp0/1/KOLIBRI.IMG", "/rd/1");
copyf("/rd/1/settings", "/tmp0/1/settings_backup");
copyf("/tmp0/1/latest_img", "/rd/1");
copyf("/tmp0/1/settings_backup", "/rd/1/settings");
RestartAllProcess();
install_complete = true;
+1 -1
View File
@@ -1 +1 @@
use32 ␍ org 0x0 ␍ ␍ db 'MENUET01' ; 8 byte id ␍ dd 38 ; required os ␍ dd STARTAPP ; program start ␍ dd I_END ; program image size ␍ dd 0x1000000 ; required amount of memory ␍ dd 0x1000000 ; stack heap ␍ dd 0x0 ␍ dd 0x0 ␍ ␍include '../../../proc32.inc' ␍include '../../../macros.inc' ␍include '../../../dll.inc' ␍␍ ␍PATH_MAX equ 255 ␍␍STARTAPP: ␍ ; Initialize memory ␍ mcall 68, 11 ␍ ; Import libraries ␍ stdcall dll.Load,importTable ␍ ␍ ; Set button style: flat or gradient (3D)␍ invoke ini_get_int, aIni, aSection, aButtonStyle, 0␍ mov ecx, eax␍ mcall 48, 1␍␍get_bg:␍ invoke ini_get_str, aIni, aSection, aBgProgram, sz_app, PATH_MAX, 0␍ invoke ini_get_str, aIni, aSection, aBgParam, sz_param, PATH_MAX, 0␍ ␍ cmp byte[sz_param], '\'␍ jne set_bg␍␍ ; This is fix for KIV images located at /kolibrios and /usbhd drives␍ ; It checks is the file exists for 5 times with perioud 1 second␍ mov edi, 0␍@@:␍ mcall 70, KivFileRead␍ cmp eax,0␍ je set_bg␍ mcall 5, 100␍ inc edi␍ cmp edi, 5␍ jle @b␍ ; if not found then lets try to set bg anyway␍␍set_bg:␍ mcall 70, RunApp␍ ␍set_skin:␍ invoke ini_get_str, aIni, aSection, aSkinPath, sz_param, PATH_MAX, 0␍ cmp byte [sz_param], 0 ;no need to set skin it was not specified␍ je @f␍ mcall 48, 8, sz_param ␍@@:␍ mcall -1␍␍ ␍importTable: ␍library \ ␍ libini, 'libini.obj' ␍ ␍import libini, \ ␍ ini_get_str ,'ini_get_str', \ ␍ ini_get_int ,'ini_get_int' ␍ ␍RunApp:␍ dd 7 ; subfunction number ␍ dd 0 ; position in the file in bytes ␍ dd sz_param ; upper part of the position address ␍ dd 0 ; number of bytes to read ␍ dd 0 ; pointer to the buffer to write data ␍ db 0 ␍ dd sz_app ; pointer to the filename␍␍KivFileRead:␍ dd 0 ; subfunction number ␍ dd 0 ; position in the file in bytes ␍ dd 0 ; upper part of the position address ␍ dd 4 ; number of bytes to read ␍ dd buf ; pointer to the buffer to write data ␍ db 0 ␍ dd sz_param+4 ; pointer to the filename␍buf rb 4␍ ␍aIni db '/sys/settings/system.ini',0 ␍aSection db 'style',0␍␍aBgProgram db 'bg_program',0␍aBgParam db 'bg_param',0 ␍aButtonStyle db 'buttons_gradient',0␍aSkinPath db 'skin',0␍␍sz_app:␍ rb PATH_MAX␍sz_param: ␍ rb PATH_MAX␍ ␍I_END: ; End of application code and data marker ␍ ␍
use32 ␍ org 0x0 ␍ ␍ db 'MENUET01' ; 8 byte id ␍ dd 38 ; required os ␍ dd STARTAPP ; program start ␍ dd I_END ; program image size ␍ dd 0x1000000 ; required amount of memory ␍ dd 0x1000000 ; stack heap ␍ dd 0x0 ␍ dd 0x0 ␍ ␍include '../../../proc32.inc' ␍include '../../../macros.inc' ␍include '../../../dll.inc' ␍␍ ␍PATH_MAX equ 255 ␍␍STARTAPP: ␍ ; Initialize heap␍ mcall 68, 11 ␍ ; Import libraries ␍ stdcall dll.Load,importTable␍ ␍ ; Set button style: flat or gradient (3D)␍ invoke ini_get_int, aIni, aSection, aButtonStyle, 0␍ mov ecx, eax␍ mcall 48, 1␍␍ ; Set desktop background␍ invoke ini_get_str, aIni, aSection, aBgProgram, sz_app, PATH_MAX, 0␍ invoke ini_get_str, aIni, aSection, aBgParam, sz_param, PATH_MAX, 0␍ ␍ cmp byte[sz_param], '\' ;detecting KIV param like '\S__/path/to/img'␍ jne @f␍␍ m2m dword [ReadFile.path], sz_param+4␍ call check_file_exists␍␍@@:␍ mcall 70, RunApp␍ ␍ ; Set system skin␍ invoke ini_get_str, aIni, aSection, aSkinPath, sz_param, PATH_MAX, 0␍ cmp byte [sz_param], 0 ;no need to set skin if it was not specified␍ je @f␍ ␍ m2m dword [ReadFile.path], sz_param␍ call check_file_exists␍ ␍ mcall 48, 8, sz_param ␍@@:␍ ; Exit app␍ mcall -1␍␍;----------------------------------------------------------------␍; This is fix for files located at /kolibrios and /usbhd drives␍; It checks is the file exists for 5 times with perioud 1 second␍check_file_exists:␍ mov edi, 0␍@@:␍ mcall 70, ReadFile␍ cmp eax,0␍ je .exit␍ mcall 5, 100␍ inc edi␍ cmp edi, 5␍ jle @b␍.exit:␍ ret␍;----------------------------------------------------------------␍ ␍importTable: ␍library \ ␍ libini, 'libini.obj' ␍ ␍import libini, \ ␍ ini_get_str ,'ini_get_str', \ ␍ ini_get_int ,'ini_get_int' ␍ ␍RunApp:␍ dd 7 ; subfunction number ␍ dd 0 ; position in the file in bytes ␍ dd sz_param ; upper part of the position address ␍ dd 0 ; number of bytes to read ␍ dd 0 ; pointer to the buffer to write data ␍ db 0 ␍ dd sz_app ; pointer to the filename␍␍ReadFile:␍ dd 0 ; subfunction number ␍ dd 0 ; position in the file in bytes ␍ dd 0 ; upper part of the position address ␍ dd 4 ; number of bytes to read ␍ dd buf ; pointer to the buffer to write data ␍ db 0 ␍.path dd ? ; pointer to the filename␍buf rb 4␍ ␍aIni db '/sys/settings/system.ini',0 ␍aSection db 'style',0␍␍aBgProgram db 'bg_program',0␍aBgParam db 'bg_param',0 ␍aButtonStyle db 'buttons_gradient',0␍aSkinPath db 'skin',0␍␍sz_app:␍ rb PATH_MAX␍sz_param: ␍ rb PATH_MAX␍ ␍I_END: ; End of application code and data marker ␍ ␍