Rev 3975 | Rev 5499 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3866 | punk_joker | 1 | #define MEMSIZE 0xA0000 |
3067 | leency | 2 | #include "..\lib\kolibri.h" |
5482 | leency | 3 | #include "..\lib\mem.h" |
4 | #include "..\lib\strings.h" |
||
3067 | leency | 5 | #include "..\lib\file_system.h" |
6 | |||
5482 | leency | 7 | #include "..\lib\dll.h" |
8 | #include "..\lib\lib.obj\libio_lib.h" |
||
9 | #include "..\lib\lib.obj\libini.h" |
||
10 | |||
3109 | leency | 11 | #ifndef AUTOBUILD |
12 | #include "lang.h--" |
||
13 | #endif |
||
3067 | leency | 14 | |
15 | ///////////////////////////////////////////////////////////////////////////////////////// |
||
3975 | leency | 16 | ///////////////////////// Program data //////////////////// |
3067 | leency | 17 | ///////////////////////////////////////////////////////////////////////////////////////// |
18 | |||
19 | struct ioctl_struct |
||
20 | { |
||
21 | dword handle; |
||
22 | dword io_code; |
||
23 | dword input; |
||
24 | dword inp_size; |
||
25 | dword output; |
||
26 | dword out_size; |
||
27 | }; |
||
28 | |||
29 | #define DEV_ADD_DISK 1 //input = structure add_disk_struc |
||
30 | #define DEV_DEL_DISK 2 //input = structure del_disk_struc |
||
31 | |||
32 | struct add_disk_struc |
||
33 | { |
||
34 | dword DiskSize; // in sectors, 1 sector = 512 bytes. Include FAT service data |
||
35 | unsigned char DiskId; // from 0 to 9 |
||
36 | }; |
||
37 | |||
38 | struct del_disk_struc |
||
39 | { |
||
40 | unsigned char DiskId; //from 0 to 9 |
||
41 | }; |
||
42 | |||
43 | |||
44 | ioctl_struct ioctl; |
||
45 | add_disk_struc add_disk; |
||
46 | del_disk_struc del_disk; |
||
47 | |||
48 | int driver_handle; |
||
49 | |||
5482 | leency | 50 | dword disk_sizes[10]; |
51 | |||
3067 | leency | 52 | ///////////////////////////////////////////////////////////////////////////////////////// |
3975 | leency | 53 | ///////////////////////// Code //////////////////// |
3067 | leency | 54 | ///////////////////////////////////////////////////////////////////////////////////////// |
55 | #include "t_console.c" |
||
5482 | leency | 56 | #include "t_gui.c" |
3067 | leency | 57 | |
58 | |||
59 | void main() |
||
60 | { |
||
61 | driver_handle = LoadDriver("tmpdisk"); |
||
62 | if (driver_handle==0) |
||
63 | { |
||
5482 | leency | 64 | notify("'TmpDisk\nError: /rd1/1/drivers/tmpdisk.obj driver loading failed\nvirtual disk wouldn't be added' -tE"); |
3067 | leency | 65 | ExitProcess(); |
66 | } |
||
3440 | leency | 67 | |
5482 | leency | 68 | GetDiskSizesFromIni(); |
3067 | leency | 69 | |
70 | if (param) |
||
71 | Console_Work(); |
||
72 | else |
||
73 | Main_Window(); |
||
74 | |||
5482 | leency | 75 | SaveDiskSizesToIni(); |
3067 | leency | 76 | ExitProcess(); |
77 | } |
||
78 | |||
5482 | leency | 79 | |
80 | void GetDiskSizesFromIni() |
||
81 | { |
||
82 | char i, key[2]; |
||
83 | if (load_dll2(libini, #lib_init,1)!=0) notify("Error: library doesn't exists - libini"); |
||
84 | for (i=0; i<=9; i++) |
||
85 | { |
||
86 | key[0]=i+'0'; |
||
87 | ini_get_int stdcall ("/sys/settings/tmpdisk.ini", "DiskSizes", #key, 0); |
||
88 | disk_sizes[i] = EAX; |
||
89 | } |
||
90 | } |
||
91 | |||
92 | void SaveDiskSizesToIni() |
||
93 | { |
||
94 | char i, key[2]; |
||
95 | for (i=0; i<=9; i++) |
||
96 | { |
||
97 | key[0]=i+'0'; |
||
98 | ini_set_int stdcall ("/sys/settings/tmpdisk.ini", "DiskSizes", #key, disk_sizes[i]); |
||
99 | } |
||
100 | } |
||
101 | |||
102 | |||
3067 | leency | 103 | stop:=9;>=9;> |