forked from KolibriOS/kolibrios
Kolibri N9 Installer Alpha
git-svn-id: svn://kolibrios.org@4113 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
edcb8e9226
commit
86577b5602
@ -1,5 +1,9 @@
|
||||
@del lang.h--
|
||||
@echo #define LANG_ENG 1 >lang.h--
|
||||
|
||||
..\C--\C-- main.c
|
||||
@del installer.kex
|
||||
@rename main.com installer.kex
|
||||
@pause
|
||||
@del lang.h--
|
||||
@del warning.txt
|
9
programs/cmm/installer/_compile_ru.bat
Normal file
9
programs/cmm/installer/_compile_ru.bat
Normal file
@ -0,0 +1,9 @@
|
||||
@del lang.h--
|
||||
@echo #define LANG_RUS 1 >lang.h--
|
||||
|
||||
..\C--\C-- main.c
|
||||
@del installer.kex
|
||||
@rename main.com installer.kex
|
||||
@pause
|
||||
@del lang.h--
|
||||
@del warning.txt
|
20
programs/cmm/installer/add_appl_dir.c
Normal file
20
programs/cmm/installer/add_appl_dir.c
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
struct sysdir
|
||||
{
|
||||
char name[64];
|
||||
char path[64];
|
||||
} sysdir;
|
||||
|
||||
|
||||
:int SetAddApplDir(dword tName, tPath)
|
||||
{
|
||||
int i;
|
||||
strcpy(#sysdir.name, tName);
|
||||
strcpy(#sysdir.path, tPath);
|
||||
debug(#sysdir.name);
|
||||
debug(#sysdir.path);
|
||||
$mov eax, 30
|
||||
$mov ebx, 3
|
||||
ECX = #sysdir;
|
||||
$int 0x40
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
void HalloLoop()
|
||||
{
|
||||
byte id, key;
|
||||
goto _HALLO_DRAW;
|
||||
loop() switch(WaitEvent())
|
||||
{
|
||||
case evButton:
|
||||
id=GetButtonID();
|
||||
if(id == 1) ExitProcess();
|
||||
if (id == 11) RunProgram("/sys/htmlv", "http://kolibri-n.org/index.php");
|
||||
if (id == 10) GotoInstall();
|
||||
break;
|
||||
case evKey:
|
||||
key = GetKey();
|
||||
if (key == 13) GotoInstall();
|
||||
break;
|
||||
|
||||
case evReDraw: _HALLO_DRAW:
|
||||
if !(DefineWindow("Prepearing installation", "Install")) break;
|
||||
|
||||
HalloWindow();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void HalloWindow()
|
||||
{
|
||||
int free_ram;
|
||||
unsigned char free_ram_text[256];
|
||||
|
||||
|
||||
WriteTextB(TEXTX, 80, 0x90, 0xCC00CC, "KolibriN 8.2a Upgrade Pack is ready for install.");
|
||||
DrawLink(TEXTX, 95, 0x90, 11, "http://kolibri-n.org");
|
||||
|
||||
free_ram = GetFreeRAM()/1024;
|
||||
strcpy(#free_ram_text, "You have ");
|
||||
strcat(#free_ram_text, itoa(free_ram));
|
||||
strcat(#free_ram_text, " MB of free RAM. You need 100 Mb for installation.");
|
||||
|
||||
WriteText(TEXTX, 140, 0x80, 0, #free_ram_text);
|
||||
WriteText(TEXTX, 160, 0x80, 0, "Please, close all opened applications before start.");
|
||||
}
|
||||
|
||||
void GotoInstall()
|
||||
{
|
||||
if (GetFreeRAM()/1024>100) InstallationLoop();
|
||||
else notify("You do not have enought free RAM for installation!");
|
||||
}
|
@ -1,108 +0,0 @@
|
||||
|
||||
void InstallationLoop()
|
||||
{
|
||||
byte id, key, started=false;
|
||||
goto _INSTALL_DRAW;
|
||||
|
||||
loop() switch(WaitEvent())
|
||||
{
|
||||
case evButton:
|
||||
id=GetButtonID();
|
||||
if(id == 1) ExitProcess();
|
||||
if (id == 11) RunProgram("/sys/htmlv", "http://kolibri-n.org/donate.php");
|
||||
if (id == 10) HalloLoop();
|
||||
break;
|
||||
case evKey:
|
||||
key = GetKey();
|
||||
break;
|
||||
|
||||
case evReDraw: _INSTALL_DRAW:
|
||||
if !(DefineWindow("Installation Started", "Stop")) break;
|
||||
if (started) break;
|
||||
started = true;
|
||||
Install();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
char iclock[3]={1,2};
|
||||
void ShowProgress(dword text1)
|
||||
{
|
||||
iclock[0]><iclock[1];
|
||||
_PutImage(WIN_W+LOGOW/2, WIN_H+LOGOH/2, LOGOW,LOGOH, LOGOW*LOGOH*3*iclock[0]+ #logo);
|
||||
if (text1)
|
||||
{
|
||||
DrawBar(TEXTX, BLACK_H+30, Form.cwidth-TEXTX, 12, 0xFFFfff);
|
||||
DrawBar(TEXTX, BLACK_H+50, Form.cwidth-TEXTX, 12, 0xFFFfff);
|
||||
WriteText(TEXTX, BLACK_H+30, 0x80, 0, text1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Install()
|
||||
{
|
||||
int i;
|
||||
proc_info Process;
|
||||
|
||||
ShowProgress("Mounting virtual disk...");
|
||||
//if (TmpDiskAdd(9, 100)!=0) RunProgram("/sys/tmpdisk", "a9s100");
|
||||
for (i=0; i<256; i++;)
|
||||
{
|
||||
GetProcessInfo(#Process, i);
|
||||
if (i==Form.ID) || (strcmp(#Process.name, "OS")==0) continue;
|
||||
//debug(#Process.name);
|
||||
KillProcess(i);
|
||||
}
|
||||
//RunProgram("/sys/develop/board", NULL); //temp============
|
||||
RunProgram("/sys/REFRSCRN", NULL);
|
||||
//pause(100);
|
||||
ShowProgress("Copying files...");
|
||||
copyf("/sys/docpack", "/kolibrios/docpack");
|
||||
DeleteFile("/sys/docpack");
|
||||
copyf(abspath("sys"), "/rd/1");
|
||||
//copyf(abspath("tmp"), "/tmp9/1");
|
||||
SetAddApplDir("kolibrios", abspath("kolibrios"));
|
||||
|
||||
ShowProgress("Post install actions...");
|
||||
RunProgram("/sys/launcher", NULL);
|
||||
SetSystemSkin("/kolibrios/skins/latte.skn");
|
||||
EndLoop();
|
||||
}
|
||||
|
||||
void copyf_Action(dword filename)
|
||||
{
|
||||
if (CheckEvent()==evReDraw) { DefineWindow("Installation Started", "Stop"); ShowProgress("Copying files..."); }
|
||||
ShowProgress(NULL);
|
||||
DrawBar(TEXTX, BLACK_H+50, Form.cwidth-TEXTX, 12, 0xFFFfff);
|
||||
WriteText(TEXTX, BLACK_H+50, 0x80, 0, filename);
|
||||
}
|
||||
|
||||
|
||||
void EndLoop()
|
||||
{
|
||||
byte id, key;
|
||||
|
||||
goto _END_DRAW;
|
||||
|
||||
loop() switch(WaitEvent())
|
||||
{
|
||||
case evButton:
|
||||
id=GetButtonID();
|
||||
if(id == 1) ExitProcess();
|
||||
if (id == 11) RunProgram("/sys/htmlv", "http://kolibri-n.org/index.php");
|
||||
if (id == 10) ExitProcess();
|
||||
break;
|
||||
case evKey:
|
||||
key = GetKey();
|
||||
break;
|
||||
|
||||
case evReDraw: _END_DRAW:
|
||||
if !(DefineWindow("Installation complete", "Exit")) break;
|
||||
WriteText(TEXTX, BLACK_H*2, 0x80, 0, "KolibriN install complete.");
|
||||
WriteText(TEXTX, BLACK_H*2+40, 0x80, 0, "I spent a lot of time improving KolibriN, so I hope you'll like it.");
|
||||
WriteText(TEXTX, BLACK_H*2+55, 0x80, 0, "Please, donate as much as you can to help me further improve Kolibri,");
|
||||
WriteText(TEXTX, BLACK_H*2+70, 0x80, 0, "the project I love so much. Visit my site for more information:");
|
||||
DrawLink(TEXTX, BLACK_H*2+85, 0x80, 11, "http://kolibri-n.org/donate.php");
|
||||
}
|
||||
}
|
||||
|
138
programs/cmm/installer/installer.c
Normal file
138
programs/cmm/installer/installer.c
Normal file
@ -0,0 +1,138 @@
|
||||
#define MEMSIZE 0xA1000
|
||||
#include "..\lib\kolibri.h"
|
||||
#include "..\lib\strings.h"
|
||||
#include "..\lib\figures.h"
|
||||
#include "..\lib\encoding.h"
|
||||
#include "..\lib\file_system.h"
|
||||
#include "..\lib\mem.h"
|
||||
#include "..\lib\dll.h"
|
||||
#include "..\lib\copyf.h"
|
||||
//*.obj libraries
|
||||
#include "..\lib\lib.obj\box_lib.h"
|
||||
|
||||
|
||||
#define LOGOW 16
|
||||
#define LOGOH 16
|
||||
#define BLACK_H 40
|
||||
#define TEXTX 20
|
||||
#define WIN_W 300
|
||||
#define WIN_H 200
|
||||
|
||||
unsigned char logo[LOGOW*LOGOH*3]= FROM "img\logo.raw";
|
||||
|
||||
proc_info Form;
|
||||
system_colors sc;
|
||||
char dialog;
|
||||
enum {
|
||||
INSTALL,
|
||||
END
|
||||
};
|
||||
|
||||
#ifdef LANG_RUS
|
||||
?define T_WTITILE "Установка Kolibri N9"
|
||||
?define T_END "Установка KolibriN успешно завершена."
|
||||
#else
|
||||
?define T_WTITILE "Kolibri N9 Setup"
|
||||
?define T_END "KolibriN install complete."
|
||||
#endif
|
||||
|
||||
|
||||
int DefineWindow(dword wtitle, wbutton)
|
||||
{
|
||||
sc.get();
|
||||
DefineAndDrawWindow(GetScreenWidth()-WIN_W/2,GetScreenHeight()-WIN_H/2-30, WIN_W+9, WIN_H+GetSkinHeight()+4,0x74,0,T_WTITILE);
|
||||
GetProcessInfo(#Form, SelfInfo);
|
||||
if (Form.status_window>2) return 0; //rolled_up
|
||||
|
||||
DrawBar(0, 0, Form.cwidth, BLACK_H, 0);
|
||||
_PutImage(BLACK_H-LOGOW/2, BLACK_H-LOGOH/2, LOGOW,LOGOH, #logo);
|
||||
WriteTextB(BLACK_H-LOGOW + LOGOW, BLACK_H-6/2, 0x90, 0xFFFfff, wtitle);
|
||||
DrawBar(0, BLACK_H, Form.cwidth, Form.cheight-BLACK_H, 0xFFFfff);
|
||||
DrawCaptButton(Form.cwidth-107, Form.cheight-40, 90, 24, 10, sc.work_button, sc.work_button_text,wbutton);
|
||||
return 1;
|
||||
}
|
||||
|
||||
#include "add_appl_dir.c";
|
||||
#include "dialogs.c";
|
||||
|
||||
void main()
|
||||
{
|
||||
mem_Init();
|
||||
InstallationLoop(INSTALL);
|
||||
}
|
||||
|
||||
char iclock[3]={1,2};
|
||||
|
||||
void InstallationLoop(int dialog_t)
|
||||
{
|
||||
byte id, key, started=false;
|
||||
int free_ram;
|
||||
unsigned char free_ram_text[256];
|
||||
|
||||
dialog = dialog_t;
|
||||
goto _DRAW_WIN;
|
||||
|
||||
loop() switch(WaitEvent())
|
||||
{
|
||||
case evButton:
|
||||
id=GetButtonID();
|
||||
if (id == 01) ExitProcess();
|
||||
if (id == 11) RunProgram("/sys/htmlv", "http://kolibri-n.org/index.php");
|
||||
if (id == 10)
|
||||
{
|
||||
if (dialog==INSTALL) InstallationLoop(END);
|
||||
else if (dialog==END) ExitProcess();
|
||||
}
|
||||
break;
|
||||
|
||||
case evReDraw:
|
||||
_DRAW_WIN:
|
||||
if (dialog==INSTALL)
|
||||
{
|
||||
if !(DefineWindow("Installation Started", "Stop")) break;
|
||||
//iclock[0]><iclock[1];
|
||||
_PutImage(Form.cwidth-LOGOW/2, Fprm.height-LOGOH/2+BLACK_H, LOGOW,LOGOH, LOGOW*LOGOH*3*iclock[0]+ #logo);
|
||||
|
||||
if (!started)
|
||||
{
|
||||
started = true;
|
||||
if (GetFreeRAM()/1024<15) notify("Too less free ram. May cause problems");
|
||||
Install();
|
||||
}
|
||||
}
|
||||
if (dialog==END)
|
||||
{
|
||||
if !(DefineWindow("Installation complete", "Exit")) break;
|
||||
WriteText(TEXTX, BLACK_H*2, 0x80, 0, T_END);
|
||||
DrawLink(TEXTX, BLACK_H*2+55, 0x80, 11, "http://kolibri-n.org");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Install()
|
||||
{
|
||||
int i;
|
||||
proc_info Process;
|
||||
|
||||
for (i=0; i<256; i++;)
|
||||
{
|
||||
GetProcessInfo(#Process, i);
|
||||
if (i==Form.ID) || (strcmp(#Process.name, "OS")==0) continue;
|
||||
KillProcess(i);
|
||||
}
|
||||
SetAddApplDir("kolibrios", abspath("kolibrios")+1);
|
||||
RunProgram("/sys/REFRSCRN", NULL);
|
||||
copyf(abspath("sys"), "/rd/1");
|
||||
RunProgram("/sys/launcher", NULL);
|
||||
SetSystemSkin("/kolibrios/skins/latte.skn");
|
||||
InstallationLoop(END);
|
||||
//===to tmp===
|
||||
// RunProgram("/sys/tmpdisk", "a9s100");
|
||||
// copyf(abspath("tmp"), "/tmp9/1");
|
||||
}
|
||||
|
||||
void copyf_Draw_Progress(dword filename) { return; }
|
||||
|
||||
|
||||
stop:
|
@ -1,90 +0,0 @@
|
||||
#define MEMSIZE 0xA1000
|
||||
#include "..\lib\kolibri.h"
|
||||
#include "..\lib\strings.h"
|
||||
#include "..\lib\figures.h"
|
||||
#include "..\lib\encoding.h"
|
||||
#include "..\lib\file_system.h"
|
||||
#include "..\lib\mem.h"
|
||||
#include "..\lib\dll.h"
|
||||
#include "..\lib\copyf.h"
|
||||
//*.obj libraries
|
||||
#include "..\lib\lib.obj\box_lib.h"
|
||||
#include "..\lib\lib.obj\libio_lib.h"
|
||||
#include "..\lib\lib.obj\libimg_lib.h"
|
||||
#include "..\lib\lib.obj\truetype.h"
|
||||
|
||||
|
||||
#define LOGOW 16
|
||||
#define LOGOH 16
|
||||
#define BLACK_H 40
|
||||
#define TEXTX 20
|
||||
#define WIN_W 500
|
||||
#define WIN_H 350
|
||||
|
||||
unsigned char logo[LOGOW*LOGOH*3]= FROM "img\logo.raw";
|
||||
|
||||
proc_info Form;
|
||||
system_colors sc;
|
||||
char dialog;
|
||||
enum {
|
||||
HALLO,
|
||||
INSTALL,
|
||||
END
|
||||
};
|
||||
|
||||
int DefineWindow(dword wtitle, wbutton)
|
||||
{
|
||||
sc.get();
|
||||
DefineAndDrawWindow(GetScreenWidth()-WIN_W/2,GetScreenHeight()-WIN_H/2-30, WIN_W+9, WIN_H+GetSkinHeight()+4, 0x74,0xFFFfff);
|
||||
DrawTitle("KolibriN 8.2a Setup");
|
||||
GetProcessInfo(#Form, SelfInfo);
|
||||
if (Form.status_window>2) return 0; //rolled_up
|
||||
|
||||
DrawBar(0, 0, Form.cwidth, BLACK_H, 0);
|
||||
_PutImage(BLACK_H-LOGOW/2, BLACK_H-LOGOH/2, LOGOW,LOGOH, #logo);
|
||||
WriteTextB(BLACK_H-LOGOW + LOGOW, BLACK_H-6/2, 0x90, 0xFFFfff, wtitle);
|
||||
DrawBar(0, BLACK_H, Form.cwidth, Form.cheight-BLACK_H, 0xFFFfff);
|
||||
DrawCaptButton(Form.cwidth-107, Form.cheight-40, 90, 24, 10, sc.work_button, sc.work_button_text,wbutton);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
struct sysdir
|
||||
{
|
||||
char name[64];
|
||||
char path[64];
|
||||
} sysdir;
|
||||
|
||||
|
||||
int SetAddApplDir(dword tName, tPath)
|
||||
{
|
||||
int i;
|
||||
strcpy(#sysdir.name, tName);
|
||||
strcpy(#sysdir.path, tPath);
|
||||
if (sysdir.name[0]=='/') strcpy(#sysdir.name, #sysdir.name+1);
|
||||
if (sysdir.path[0]=='/') strcpy(#sysdir.path, #sysdir.path+1);
|
||||
i = strlen(#sysdir.name);
|
||||
if (sysdir.name[i]=='/') sysdir.name[i]='\0';
|
||||
i = strlen(#sysdir.path);
|
||||
if (sysdir.path[i]=='/') sysdir.path[i]='\0';
|
||||
debug(#sysdir.name);
|
||||
debug(#sysdir.path);
|
||||
$mov eax, 30
|
||||
$mov ebx, 3
|
||||
ECX = #sysdir;
|
||||
$int 0x40
|
||||
}
|
||||
|
||||
|
||||
#include "tmp_add.c"
|
||||
#include "hallo.c";
|
||||
#include "installation.c";
|
||||
|
||||
void main()
|
||||
{
|
||||
mem_Init();
|
||||
HalloLoop();
|
||||
}
|
||||
|
||||
|
||||
stop:
|
@ -1,38 +0,0 @@
|
||||
struct ioctl_struct
|
||||
{
|
||||
dword handle;
|
||||
dword io_code;
|
||||
dword input;
|
||||
dword inp_size;
|
||||
dword output;
|
||||
dword out_size;
|
||||
};
|
||||
|
||||
struct add_disk_struc
|
||||
{
|
||||
dword DiskSize; // in sectors, 1 sector = 512 bytes. Include FAT service data
|
||||
unsigned char DiskId; // from 0 to 9
|
||||
};
|
||||
|
||||
ioctl_struct ioctl;
|
||||
add_disk_struc add_disk;
|
||||
|
||||
int TmpDiskAdd(int disk_id, disk_size)
|
||||
{
|
||||
int driver_handle, driver_rezult;
|
||||
driver_handle = LoadDriver("tmpdisk");
|
||||
if (driver_handle==0) return 7;
|
||||
|
||||
add_disk.DiskId = disk_id;
|
||||
add_disk.DiskSize = disk_size * 2048;
|
||||
|
||||
ioctl.handle = driver_handle;
|
||||
ioctl.io_code = 1;
|
||||
ioctl.input = #add_disk;
|
||||
ioctl.inp_size = sizeof(add_disk);
|
||||
ioctl.output = 0;
|
||||
ioctl.out_size = 0;
|
||||
|
||||
driver_rezult = RuleDriver(#ioctl);
|
||||
return driver_rezult;
|
||||
}
|
Loading…
Reference in New Issue
Block a user