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:
Kirill Lipatov (Leency) 2020-05-17 18:05:05 +00:00
parent 6649d8f84c
commit f871bfac83
5 changed files with 41 additions and 25 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

View File

@ -9,13 +9,13 @@
/SYS/SETUP BOOT 0 # Load device settings /SYS/SETUP BOOT 0 # Load device settings
/SYS/LOADDRV RDC 0 # videodriver for RDC M2010/M2012 /SYS/LOADDRV RDC 0 # videodriver for RDC M2010/M2012
/SYS/@TASKBAR "" 0 # Start taskbar /SYS/@TASKBAR "" 0 # Start taskbar
/SYS/@ICON "" 0 # Multithread icon
/SYS/ESKIN "" 0 # Set style /SYS/ESKIN "" 0 # Set style
/SYS/@DOCKY "" 0 # Start docky /SYS/@ICON "" 0 # Multithread icon
/SYS/NETWORK/NETCFG A 0 # /SYS/NETWORK/NETCFG A 0 #
/SYS/NETWORK/@ZEROCONF "" 0 # Network configuration /SYS/NETWORK/@ZEROCONF "" 0 # Network configuration
/SYS/@VOLUME "" 0 # Start volume daemon /SYS/@VOLUME "" 0 # Start volume daemon
/SYS/@SS ASSM 0 # Screensaver /SYS/@SS ASSM 0 # Screensaver
/SYS/@DOCKY "" 0 # Start docky
/SYS/TMPDISK A0 -1 # Add virtual RAM disk /tmp0/1 /SYS/TMPDISK A0 -1 # Add virtual RAM disk /tmp0/1
/SYS/SEARCHAP "" -1 # Search and mount additional system directory /SYS/SEARCHAP "" -1 # Search and mount additional system directory
/SYS/@HOTANGLES "" 0 # Start Hot Angles /SYS/@HOTANGLES "" 0 # Start Hot Angles

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("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("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("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("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") tup.rule("software_widget.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "software_widget.com")

View File

@ -19,32 +19,41 @@
_http http; _http http;
proc_info Form; proc_info Form;
bool install_complete = false;
sensor progress;
#define WINW 400 #define WINW 460
#define WINH 300
char accept_language[]="en"; //not used, necessary for http.get() //#define LANG_RUS 1
#ifdef LANG_RUS #ifdef LANG_RUS
#define T_INTRO "<22>®¯à®¡ã©â¥ ­®¢®¥ ¢¨§ã «ì­®¥ ®ä®à¬«¥­¨¥ Š®«¨¡à¨, ª®â®à®¥ à ­ìè¥ ¡ë«® ¤®áâ㯭® ⮫쪮 ¢ KolibriNext."; #define WINH 345
#define T_INSTALL "“áâ ­®¢¨âì" #define T_WINDOW_TITLE "Ž­« ©­ ®¡­®¢«¥­¨¥ KolibriOS"
#define T_COMPLETE "“áâ ­®¢ª  § ¢¥à襭 " #define T_TITLE_H1 "Ž<>€‰<E282AC> Ž<><C5BD>Ž<E280B9>ˆ…"
#define T_INTRO "„ ­­®¥ ¯à¨«®¦¥­¨¥ ᪠砥⠯®á«¥¤­îî ¢¥àá¨î KolibriOS ¨ à á¯ ªã¥â ¥¥ ­  RAM-¤¨áª. <20>ਠí⮬ ï¤à® ­¥ ¡ã¤¥â ¯¥à¥§ ¯ã饭®, ¤«ï í⮣® ­¥®¡å®¤¨¬® á®åà ­¨âì ®¡à § ¨ ¯¥à¥§ £à㧨âáï. <20>®¦ «ã©áâ , § ªà®©â¥ ¢á¥ ®âªàëâë¥ ¯à¨«®¦¥­¨ï ¯¥à¥¤ ­ ç «®¬ ®¡­®¢«¥­¨ï.
<EFBFBD>ˆŒ<EFBFBD>ˆ: ᥠ¨§¬¥­­ë¥ ä ©«ë ­  RAM-¤¨áª¥ ¡ã¤ãâ ¯¥à¥§ ¯¨á ­ë!";
#define T_INSTALL "Ž¡­®¢¨âì"
#define T_COMPLETE "Ž¡­®¢«¥­¨¥ § ¢¥à襭®"
#define T_EXIT "‚ë室" #define T_EXIT "‚ë室"
#define IMG_URL "http://builds.kolibrios.org/rus/data/data/kolibri.img" #define IMG_URL "http://builds.kolibrios.org/rus/data/data/kolibri.img"
#else #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_INSTALL "Update"
#define T_COMPLETE "Update complete" #define T_COMPLETE "Update complete"
#define T_EXIT "Exit" #define T_EXIT "Exit"
#define IMG_URL "http://builds.kolibrios.org/eng/data/data/kolibri.img" #define IMG_URL "http://builds.kolibrios.org/eng/data/data/kolibri.img"
#endif #endif
char accept_language[]="en"; //not used, necessary for http.get()
bool install_complete = false;
void main() void main()
{ {
word btn;
//load_dll(libini, #lib_init,1); //load_dll(libini, #lib_init,1);
load_dll(libio, #libio_init,1); load_dll(libio, #libio_init,1);
load_dll(libimg, #libimg_init,1); load_dll(libimg, #libimg_init,1);
@ -53,9 +62,7 @@ void main()
loop() switch(WaitEventTimeout(300) & 0xFF) loop() switch(WaitEventTimeout(300) & 0xFF)
{ {
case evButton: case evButton:
btn = GetButtonID(); if (GetButtonID() == 1) ExitProcess(); else EventInstall();
if (btn == 1) ExitProcess();
else EventInstall();
break; break;
case evKey: case evKey:
@ -74,8 +81,9 @@ void main()
case evNetwork: case evNetwork:
if (http.transfer <= 0) break; if (http.transfer <= 0) break;
http.receive(); http.receive();
if (http.content_length) DrawProgressBar(30, WINH-140, WINW-60, 20, sc.work, 0xC3C3C3, if (http.content_length) {
0x54B1D6, sc.work_text, 100 * http.content_received / http.content_length); progress.draw_progress(http.content_length - http.content_received * progress.w / http.content_length);
}
if (http.receive_result == 0) EventDownloadComplete(); if (http.receive_result == 0) EventDownloadComplete();
} }
} }
@ -84,10 +92,15 @@ void draw_window()
{ {
sc.get(); sc.get();
DefineAndDrawWindow(screen.width-WINW/2,screen.height-WINH/2, 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); GetProcessInfo(#Form, -1);
WriteText(30, 20, 0x81, 0xEC008C, "ONLINE UPDATE"); WriteText(30, 20, 0x81, 0xEC008C, T_TITLE_H1);
if (install_complete) DrawInstallComplete(); else DrawIntro(); if (install_complete) {
DrawInstallComplete();
} else {
DrawIntro();
progress.set_size(30, WINH-130, WINW-60, 20);
}
} }
void DrawIntro() void DrawIntro()
@ -115,16 +128,18 @@ void EventDownloadComplete()
{ {
dword unimg_id, slot_n; 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(); 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 { do {
slot_n = GetProcessSlot(unimg_id); slot_n = GetProcessSlot(unimg_id);
pause(10); pause(10);
} while (slot_n!=0); } 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(); RestartAllProcess();
install_complete = true; install_complete = true;

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 memory memory ; Set button style: flat or gradient (3D) memory invoke ini_get_int, aIni, aSection, aButtonStyle, 0 memory mov ecx, eax memory mcall 48, 1 @@: mcall 68, 11 memory cmp eax,0 je set_bg mcall 68, 11 stdcall dll.Load,importTable inc edi mcall 68, 11 ; Set button style: flat or gradient (3D) mcall 68, 11 invoke ini_get_int, aIni, aSection, aButtonStyle, 0 ; if not found then lets try to set bg anyway mcall 68, 11 mcall 48, 1 ; Import libraries ; Import libraries memory ; Import libraries mcall 68, 11 invoke ini_get_str, aIni, aSection, aSkinPath, sz_param, PATH_MAX, 0 ; Import libraries stdcall dll.Load,importTable ; Import libraries ; Import libraries ; Set button style: flat or gradient (3D) mcall 68, 11 ; Import libraries invoke ini_get_int, aIni, aSection, aButtonStyle, 0 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 mov ecx, eax 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 ; Set button style: flat or gradient (3D) 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 ; 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' ; Set button style: flat or gradient (3D) memory ; Set button style: flat or gradient (3D) ; Set button style: flat or gradient (3D) call check_file_exists @@: mcall 70, RunApp ; Import libraries memory ; Set button style: flat or gradient (3D) mov ecx, eax invoke ini_get_str, aIni, aSection, aSkinPath, sz_param, PATH_MAX, 0 ; Set button style: flat or gradient (3D) mcall 48, 1 je @f memory stdcall dll.Load,importTable m2m dword [ReadFile.path], sz_param call check_file_exists memory stdcall dll.Load,importTable mcall 48, 8, sz_param mcall 68, 11 invoke ini_get_int, aIni, aSection, aButtonStyle, 0 memory mcall -1 invoke ini_get_int, aIni, aSection, aButtonStyle, 0 mcall 68, 11 invoke ini_get_int, aIni, aSection, aButtonStyle, 0 ; Import libraries ; It checks is the file exists for 5 times with perioud 1 second check_file_exists: memory mcall 48, 1 mcall 68, 11 mcall 70, ReadFile cmp eax,0 je .exit mcall 68, 11 stdcall dll.Load,importTable mcall 68, 11 mcall 68, 11 ; Set button style: flat or gradient (3D) mcall 68, 11 invoke ini_get_int, aIni, aSection, aButtonStyle, 0 invoke ini_get_int, aIni, aSection, aButtonStyle, 0 mov ecx, eax 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 mov ecx, eax ; Import libraries 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