forked from KolibriOS/kolibrios
eskin: fix for KIV images located at /kolibrios and /usbhd drives, it checks is the file exists for 5 times with perioud 1 second
fNav, kfar: add assoc dtp=skincfg cmm/osupdate: upload git-svn-id: svn://kolibrios.org@7938 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
bb77db0f44
commit
6649d8f84c
@ -1 +1 @@
|
||||
/sys/TinyPad: asm, inc, txt, mac, log, dat
/sys/media/kiv: gif, bmp, png, tga, jpg, ico, cur, tif, tiff, jpeg, ppm, pgm, pbm, pnm, pcx, wbmp, xcf
/sys/Network/Webview: htm, html, mht, xhtml, docx, url
/sys/fb2read: fb2
/sys/develop/cObj: obj
/sys/skincfg: skn
/sys/rtfRead: rtf
/sys/develop/t_edit: cpp, h, c, c--, pas, set, ext, ini
/sys/media/mgb: mgb
/sys/media/pixie: mp3
/sys/media/AC97SND: wav, xm
/sys/media/MIDAMP: mid
/sys/media/listplay: m3u, lap, asf
/sys/shell: sh
/sys/3d/view3ds: 3ds, asc
/sys/graph: cvs, grf
/sys/unz: zip, 7z
/sys/unimg: img
/sys/table: csv
/kolibrios/media/updf: pdf
/kolibrios/media/fplay: avi, mpg, mov, flv, wmv, vob, mkv, mp4, mpeg, divx, 3gp, webm
/kolibrios/emul/zsnes: smc
/kolibrios/emul/psx4all: mcr
/kolibrios/emul/fceu/fceu: nes
/kolibrios/emul/e80/e80: sna
/kolibrios/emul/gameboy: gb, gbc
/kolibrios/emul/pokemini: min
/sys/develop/heed:
|
||||
/sys/TinyPad: asm, inc, txt, mac, log, dat
/sys/media/kiv: gif, bmp, png, tga, jpg, ico, cur, tif, tiff, jpeg, ppm, pgm, pbm, pnm, pcx, wbmp, xcf
/sys/Network/Webview: htm, html, mht, xhtml, docx, url
/sys/fb2read: fb2
/sys/develop/cObj: obj
/sys/skincfg: skn, dtp
/sys/rtfRead: rtf
/sys/develop/t_edit: cpp, h, c, c--, pas, set, ext, ini
/sys/media/mgb: mgb
/sys/media/pixie: mp3
/sys/media/AC97SND: wav, xm
/sys/media/MIDAMP: mid
/sys/media/listplay: m3u, lap, asf
/sys/shell: sh
/sys/3d/view3ds: 3ds, asc
/sys/graph: cvs, grf
/sys/unz: zip, 7z
/sys/unimg: img
/sys/table: csv
/kolibrios/media/updf: pdf
/kolibrios/media/fplay: avi, mpg, mov, flv, wmv, vob, mkv, mp4, mpeg, divx, 3gp, webm
/kolibrios/emul/zsnes: smc
/kolibrios/emul/psx4all: mcr
/kolibrios/emul/fceu/fceu: nes
/kolibrios/emul/e80/e80: sna
/kolibrios/emul/gameboy: gb, gbc
/kolibrios/emul/pokemini: min
/sys/develop/heed:
|
@ -24,6 +24,7 @@ rtf=/sys/RtfRead
|
||||
asc=/sys/3d/view3ds
|
||||
lif=/kolibrios/demos/life2
|
||||
skn=/sys/skincfg
|
||||
dtp=/sys/skincfg
|
||||
lap=/sys/media/listplay
|
||||
asf=/sys/media/listplay
|
||||
m3u=/sys/media/AC97SND
|
||||
|
148
programs/cmm/misc/osupdate.c
Normal file
148
programs/cmm/misc/osupdate.c
Normal file
@ -0,0 +1,148 @@
|
||||
#define MEMSIZE 1024*460
|
||||
|
||||
#include "../lib/io.h"
|
||||
#include "../lib/gui.h"
|
||||
#include "../lib/copyf.h"
|
||||
|
||||
#include "../lib/obj/libini.h"
|
||||
#include "../lib/obj/libio.h"
|
||||
#include "../lib/obj/libimg.h"
|
||||
#include "../lib/obj/http.h"
|
||||
#include "../lib/obj/network.h"
|
||||
|
||||
#include "../lib/patterns/restart_process.h"
|
||||
#include "../lib/patterns/http_downloader.h"
|
||||
|
||||
#ifndef AUTOBUILD
|
||||
#include "lang.h--"
|
||||
#endif
|
||||
|
||||
_http http;
|
||||
proc_info Form;
|
||||
|
||||
#define WINW 400
|
||||
#define WINH 300
|
||||
|
||||
char accept_language[]="en"; //not used, necessary for http.get()
|
||||
|
||||
#ifdef LANG_RUS
|
||||
#define T_INTRO "<22>®¯à®¡ã©â¥ ®¢®¥ ¢¨§ã «ì®¥ ®ä®à¬«¥¨¥ Š®«¨¡à¨, ª®â®à®¥ à ìè¥ ¡ë«® ¤®áâ㯮 ⮫쪮 ¢ KolibriNext.";
|
||||
#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 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;
|
||||
|
||||
void main()
|
||||
{
|
||||
word btn;
|
||||
//load_dll(libini, #lib_init,1);
|
||||
load_dll(libio, #libio_init,1);
|
||||
load_dll(libimg, #libimg_init,1);
|
||||
load_dll(libHTTP, #http_lib_init,1);
|
||||
SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_STACK);
|
||||
loop() switch(WaitEventTimeout(300) & 0xFF)
|
||||
{
|
||||
case evButton:
|
||||
btn = GetButtonID();
|
||||
if (btn == 1) ExitProcess();
|
||||
else EventInstall();
|
||||
break;
|
||||
|
||||
case evKey:
|
||||
GetKeys();
|
||||
if (key_scancode == SCAN_CODE_ESC) ExitProcess();
|
||||
if (key_scancode == SCAN_CODE_ENTER) {
|
||||
if (install_complete) ExitProcess();
|
||||
else EventInstall();
|
||||
}
|
||||
break;
|
||||
|
||||
case evReDraw:
|
||||
draw_window();
|
||||
break;
|
||||
|
||||
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.receive_result == 0) EventDownloadComplete();
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
GetProcessInfo(#Form, -1);
|
||||
WriteText(30, 20, 0x81, 0xEC008C, "ONLINE UPDATE");
|
||||
if (install_complete) DrawInstallComplete(); else DrawIntro();
|
||||
}
|
||||
|
||||
void DrawIntro()
|
||||
{
|
||||
DrawTextViewArea(30, 50, WINW-60, WINH-80,
|
||||
T_INTRO, -1, sc.work_text);
|
||||
DrawCaptButton(WINW-110/2, WINH-70, 110, 28, 9999,
|
||||
0x0092D8, 0xFFFfff, T_INSTALL);
|
||||
}
|
||||
|
||||
void DrawInstallComplete()
|
||||
{
|
||||
DrawIcon32(WINW-32/2, 140, sc.work, 49);
|
||||
WriteTextCenter(0,185, WINW, sc.work_text, T_COMPLETE);
|
||||
DrawCaptButton(WINW-110/2, WINH-70, 110, 28, 1,
|
||||
0x0092D8, 0xFFFfff, T_EXIT);
|
||||
}
|
||||
|
||||
void EventInstall()
|
||||
{
|
||||
http.get(IMG_URL);
|
||||
}
|
||||
|
||||
void EventDownloadComplete()
|
||||
{
|
||||
dword unimg_id, slot_n;
|
||||
|
||||
CreateFile(http.content_received, http.content_pointer, "/tmp0/1/last.img");
|
||||
http.free();
|
||||
|
||||
unimg_id = RunProgram("/tmp0/1/unimg", "/tmp0/1/last.img -e");
|
||||
do {
|
||||
slot_n = GetProcessSlot(unimg_id);
|
||||
pause(10);
|
||||
} while (slot_n!=0);
|
||||
|
||||
copyf("/tmp0/1/KOLIBRI.IMG", "/rd/1");
|
||||
|
||||
RestartAllProcess();
|
||||
install_complete = true;
|
||||
draw_window();
|
||||
}
|
||||
|
||||
void RestartAllProcess() {
|
||||
int i;
|
||||
proc_info Process;
|
||||
for (i=0; i<MAX_PROCESS_COUNT; i++;)
|
||||
{
|
||||
GetProcessInfo(#Process, i);
|
||||
if (Process.name)
|
||||
&& (!streq(#Process.name, "OS"))
|
||||
&& (Process.ID != Form.ID)
|
||||
KillProcess(Process.ID);
|
||||
}
|
||||
RunProgram("/sys/launcher", NULL);
|
||||
}
|
||||
|
||||
void Operation_Draw_Progress(dword filename) { debug("copying: "); debugln(filename); }
|
@ -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
set_bg:
invoke ini_get_str, aIni, aSection, aBgProgram, sz_buffer, PATH_MAX, 0
invoke ini_get_str, aIni, aSection, aBgParam, sz_param, PATH_MAX, 0
m2m dword [InfoStructure+8], sz_param ; pointer to the parametrs
m2m dword [InfoStructure+21], sz_buffer ; pointer to the file name
mcall 70, InfoStructure
set_skin:
invoke ini_get_str, aIni, aSection, aSkinPath, sz_param, PATH_MAX, 0
set_bg:
set_bg:
set_bg:
set_bg:
invoke ini_get_str, aIni, aSection, aBgProgram, sz_buffer, PATH_MAX, 0
set_bg:
invoke ini_get_str, aIni, aSection, aBgParam, sz_param, PATH_MAX, 0
set_bg:
m2m dword [InfoStructure+8], sz_param ; pointer to the parametrs
set_bg:
m2m dword [InfoStructure+21], sz_buffer ; pointer to the file name
set_bg:
mcall 70, InfoStructure
set_bg:
set_bg:
set_skin:
set_bg:
invoke ini_get_str, aIni, aSection, aSkinPath, sz_param, PATH_MAX, 0
mcall 70, InfoStructure
invoke ini_get_str, aIni, aSection, aBgProgram, sz_buffer, PATH_MAX, 0
set_bg:
endp
importTable:
library \
libini, 'libini.obj'
import libini, \
ini_get_str ,'ini_get_str', \
ini_get_int ,'ini_get_int'
InfoStructure:
dd 7 ; subfunction number
dd 0 ; position in the file in bytes
dd ? ; upper part of the position address
dd 0 ; number of bytes to read
dd 0 ; pointer to the buffer to write data
db 0
invoke ini_get_str, aIni, aSection, aBgParam, sz_param, PATH_MAX, 0
set_skin:
invoke ini_get_str, aIni, aSection, aBgParam, sz_param, PATH_MAX, 0
invoke ini_get_str, aIni, aSection, aSkinPath, sz_param, PATH_MAX, 0
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
m2m dword [InfoStructure+8], sz_param ; pointer to the parametrs
:
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 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
m2m dword [InfoStructure+21], sz_buffer ; pointer to the file name
set_bg:
m2m dword [InfoStructure+21], sz_buffer ; pointer to the file name
invoke ini_get_str, aIni, aSection, aBgProgram, sz_buffer, PATH_MAX, 0
m2m dword [InfoStructure+21], sz_buffer ; pointer to the file name
invoke ini_get_str, aIni, aSection, aBgParam, sz_param, PATH_MAX, 0
m2m dword [InfoStructure+21], sz_buffer ; pointer to the file name
m2m dword [InfoStructure+8], sz_param ; pointer to the parametrs
m2m dword [InfoStructure+21], sz_buffer ; pointer to the file name
m2m dword [InfoStructure+21], sz_buffer ; pointer to the file name
@@:
m2m dword [InfoStructure+21], sz_buffer ; pointer to the file name
mcall 70, InfoStructure
m2m dword [InfoStructure+21], sz_buffer ; pointer to the file name
m2m dword [InfoStructure+21], sz_buffer ; pointer to the file name
set_skin:
m2m dword [InfoStructure+21], sz_buffer ; pointer to the file name
invoke ini_get_str, aIni, aSection, aSkinPath, sz_param, PATH_MAX, 0
mcall 70, InfoStructure
mcall 70, InfoStructure
set_bg:
mcall 70, InfoStructure
invoke ini_get_str, aIni, aSection, aBgProgram, sz_buffer, PATH_MAX, 0
mcall 70, InfoStructure
invoke ini_get_str, aIni, aSection, aBgParam, sz_param, PATH_MAX, 0
set_bg:
mcall 70, InfoStructure
mcall 70, InfoStructure
m2m dword [InfoStructure+8], sz_param ; pointer to the parametrs
mcall 70, InfoStructure
m2m dword [InfoStructure+21], sz_buffer ; pointer to the file name
set_skin:
invoke ini_get_str, aIni, aSection, aSkinPath, sz_param, PATH_MAX, 0
set_bg:
set_bg:
set_bg:
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
mcall 70, InfoStructure
set_skin:
mcall 70, InfoStructure
invoke ini_get_str, aIni, aSection, aSkinPath, sz_param, PATH_MAX, 0
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
:
rb PATH_MAX
sz_param:
rb PATH_MAX
I_END: ; End of application code and data marker
|
@ -106,25 +106,8 @@ load_libraries l_libs_start,end_l_libs
|
||||
jz close
|
||||
;---------------------------------------------------------------------
|
||||
; set default pathes
|
||||
mov edi,skin_info
|
||||
mov esi,default_skin
|
||||
xor eax,eax
|
||||
cld
|
||||
@@:
|
||||
lodsb
|
||||
stosb
|
||||
test eax,eax
|
||||
jnz @b
|
||||
|
||||
mov edi,dtp_name
|
||||
mov esi,default_dtp
|
||||
xor eax,eax
|
||||
cld
|
||||
@@:
|
||||
lodsb
|
||||
stosb
|
||||
test eax,eax
|
||||
jnz @b
|
||||
stdcall string.copy, default_skin, skin_info
|
||||
stdcall string.copy, default_dtp, dtp_name
|
||||
;---------------------------------------------------------------------
|
||||
; check app param
|
||||
stdcall string.length, app_param
|
||||
@ -136,28 +119,12 @@ load_libraries l_libs_start,end_l_libs
|
||||
jne no_param
|
||||
|
||||
load_dtp_from_param:
|
||||
mov edi,dtp_name
|
||||
mov esi,app_param
|
||||
xor eax,eax
|
||||
cld
|
||||
@@:
|
||||
lodsb
|
||||
stosb
|
||||
test eax,eax
|
||||
jnz @b
|
||||
stdcall string.copy, app_param, dtp_name
|
||||
call load_dtp_file.1
|
||||
jmp skin_path_ready
|
||||
|
||||
load_skin_from_param:
|
||||
mov edi,skin_info
|
||||
mov esi,app_param
|
||||
xor eax,eax
|
||||
cld
|
||||
@@:
|
||||
lodsb
|
||||
stosb
|
||||
test eax,eax
|
||||
jnz @b
|
||||
stdcall string.copy, app_param, skin_info
|
||||
call load_skin_file.2
|
||||
jmp skin_path_ready
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user