2013-08-10 19:47:40 +02:00
|
|
|
#define MEMSIZE 0xA0000
|
2012-11-26 16:26:15 +01:00
|
|
|
#include "..\lib\kolibri.h"
|
2015-02-27 02:44:22 +01:00
|
|
|
#include "..\lib\mem.h"
|
|
|
|
#include "..\lib\strings.h"
|
2018-04-03 15:57:56 +02:00
|
|
|
#include "..\lib\fs.h"
|
2012-11-26 16:26:15 +01:00
|
|
|
|
2015-02-27 02:44:22 +01:00
|
|
|
#include "..\lib\dll.h"
|
2017-10-05 00:59:57 +02:00
|
|
|
#include "..\lib\obj\libio.h"
|
2015-03-05 21:55:28 +01:00
|
|
|
#include "..\lib\obj\libini.h"
|
2015-02-27 02:44:22 +01:00
|
|
|
|
2012-12-15 01:28:00 +01:00
|
|
|
#ifndef AUTOBUILD
|
|
|
|
#include "lang.h--"
|
|
|
|
#endif
|
2012-11-26 16:26:15 +01:00
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////
|
2013-10-05 00:02:44 +02:00
|
|
|
///////////////////////// Program data ////////////////////
|
2012-11-26 16:26:15 +01:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
struct ioctl_struct
|
|
|
|
{
|
|
|
|
dword handle;
|
|
|
|
dword io_code;
|
|
|
|
dword input;
|
|
|
|
dword inp_size;
|
|
|
|
dword output;
|
|
|
|
dword out_size;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define DEV_ADD_DISK 1 //input = structure add_disk_struc
|
|
|
|
#define DEV_DEL_DISK 2 //input = structure del_disk_struc
|
|
|
|
|
|
|
|
struct add_disk_struc
|
|
|
|
{
|
|
|
|
dword DiskSize; // in sectors, 1 sector = 512 bytes. Include FAT service data
|
|
|
|
unsigned char DiskId; // from 0 to 9
|
|
|
|
};
|
|
|
|
|
|
|
|
struct del_disk_struc
|
|
|
|
{
|
|
|
|
unsigned char DiskId; //from 0 to 9
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
ioctl_struct ioctl;
|
|
|
|
add_disk_struc add_disk;
|
|
|
|
del_disk_struc del_disk;
|
|
|
|
|
|
|
|
int driver_handle;
|
|
|
|
|
2015-02-27 02:44:22 +01:00
|
|
|
dword disk_sizes[10];
|
|
|
|
|
2017-10-05 11:37:50 +02:00
|
|
|
_ini ini = { "/sys/settings/tmpdisk.ini", "DiskSizes" };
|
|
|
|
|
2012-11-26 16:26:15 +01:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////
|
2013-10-05 00:02:44 +02:00
|
|
|
///////////////////////// Code ////////////////////
|
2012-11-26 16:26:15 +01:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
#include "t_console.c"
|
2015-02-27 02:44:22 +01:00
|
|
|
#include "t_gui.c"
|
2012-11-26 16:26:15 +01:00
|
|
|
|
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
driver_handle = LoadDriver("tmpdisk");
|
|
|
|
if (driver_handle==0)
|
|
|
|
{
|
2015-02-27 02:44:22 +01:00
|
|
|
notify("'TmpDisk\nError: /rd1/1/drivers/tmpdisk.obj driver loading failed\nvirtual disk wouldn't be added' -tE");
|
2012-11-26 16:26:15 +01:00
|
|
|
ExitProcess();
|
|
|
|
}
|
2013-04-02 15:33:32 +02:00
|
|
|
|
2015-02-27 02:44:22 +01:00
|
|
|
GetDiskSizesFromIni();
|
2012-11-26 16:26:15 +01:00
|
|
|
|
|
|
|
if (param)
|
|
|
|
Console_Work();
|
|
|
|
else
|
|
|
|
Main_Window();
|
|
|
|
|
2015-02-27 02:44:22 +01:00
|
|
|
SaveDiskSizesToIni();
|
2012-11-26 16:26:15 +01:00
|
|
|
ExitProcess();
|
|
|
|
}
|
|
|
|
|
2015-02-27 02:44:22 +01:00
|
|
|
|
|
|
|
void GetDiskSizesFromIni()
|
|
|
|
{
|
|
|
|
char i, key[2];
|
|
|
|
if (load_dll2(libini, #lib_init,1)!=0) notify("Error: library doesn't exists - libini");
|
2015-08-03 12:16:37 +02:00
|
|
|
key[1]=0;
|
2015-02-27 02:44:22 +01:00
|
|
|
for (i=0; i<=9; i++)
|
|
|
|
{
|
|
|
|
key[0]=i+'0';
|
2017-10-05 11:37:50 +02:00
|
|
|
disk_sizes[i] = ini.GetInt(#key, 0);
|
2015-02-27 02:44:22 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SaveDiskSizesToIni()
|
|
|
|
{
|
|
|
|
char i, key[2];
|
2015-08-03 12:16:37 +02:00
|
|
|
key[1]=0;
|
2015-02-27 02:44:22 +01:00
|
|
|
for (i=0; i<=9; i++)
|
|
|
|
{
|
|
|
|
key[0]=i+'0';
|
2017-10-05 11:37:50 +02:00
|
|
|
ini.SetInt(#key, disk_sizes[i]);
|
2015-02-27 02:44:22 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-11-26 16:26:15 +01:00
|
|
|
stop:
|