diff --git a/contrib/C_Layer/proc_lib/kolibri_colordialog.h b/contrib/C_Layer/proc_lib/kolibri_colordialog.h new file mode 100644 index 0000000000..e696709ad5 --- /dev/null +++ b/contrib/C_Layer/proc_lib/kolibri_colordialog.h @@ -0,0 +1,48 @@ +#ifndef KOLIBRI_COLORIALOG_H +#define KOLIBRI_COLORIALOG_H + +char cd_com_area_name[] = "FFFFFFFF_color_dialog"; +char cd_start_path[] = "/rd/1/colrdial"; + +struct color_dialog { + unsigned int type; + unsigned int procinfo; + unsigned int com_area_name; + unsigned int com_area; + unsigned int start_path; + unsigned int draw_window; + unsigned int status; + unsigned short x_size; + unsigned short x_start; + unsigned short y_size; + unsigned short y_start; + unsigned int color_type; + unsigned int color; +}; + +void cd_fake_on_redraw(void) {} + +struct open_dialog* kolibri_new_color_dialog(unsigned int type, unsigned short tlx, unsigned short tly, unsigned short x_size, unsigned short y_size) +{ + struct color_dialog *new_colordialog = (struct color_dialog *)malloc(sizeof(struct color_dialog)); + char *proc_info = (char *)calloc(1024, sizeof(char)); + + new_colordialog -> type = type; + new_colordialog -> procinfo = proc_info; + new_colordialog -> com_area_name = &cd_com_area_name; + new_colordialog -> com_area = 0; + new_colordialog -> start_path = &cd_start_path; + new_colordialog -> draw_window = &cd_fake_on_redraw; + new_colordialog -> status = 0; + new_colordialog -> x_size = x_size; + new_colordialog -> x_start = tlx; + new_colordialog -> y_size = y_size; + new_colordialog -> y_start = tly; + new_colordialog -> color_type = 0; + new_colordialog -> color = 0; + return new_colordialog; +} + +extern void (*ColorDialog_init)(struct open_dialog *) __attribute__((__stdcall__)); +extern void (*ColorDialog_start)(struct open_dialog *) __attribute__((__stdcall__)); +#endif /* KOLIBRI_COLORDIALOG_H */ diff --git a/contrib/C_Layer/proc_lib/kolibri_opendialog.h b/contrib/C_Layer/proc_lib/kolibri_opendialog.h new file mode 100644 index 0000000000..0778cd96da --- /dev/null +++ b/contrib/C_Layer/proc_lib/kolibri_opendialog.h @@ -0,0 +1,67 @@ +#ifndef KOLIBRI_OPENDIALOG_H +#define KOLIBRI_OPENDIALOG_H + +char sz_com_area_name[] = "FFFFFFFF_open_dialog"; +char sz_dir_default_path[] = "/rd/1"; +char sz_start_path[] = "/rd/1/File managers/opendial"; + +struct open_dialog { + unsigned int mode; + unsigned int procinfo; + unsigned int com_area_name; + unsigned int com_area; + unsigned int opendir_path; + unsigned int dir_default_path; + unsigned int start_path; + unsigned int draw_window; + unsigned int status; + unsigned int openfile_path; + unsigned int filename_area; + unsigned int filter_area; + unsigned short x_size; + unsigned short x_start; + unsigned short y_size; + unsigned short y_start; +}; + +struct od_filter { + unsigned int size; + unsigned char end; +}; + +void fake_on_redraw(void) {} + +struct open_dialog* kolibri_new_open_dialog(unsigned int mode, unsigned short tlx, unsigned short tly, unsigned short x_size, unsigned short y_size) +{ + struct open_dialog *new_opendialog = (struct open_dialog *)malloc(sizeof(struct open_dialog)); + struct od_filter *new_od_filter = (struct od_filter *)malloc(sizeof(struct od_filter)); + char *plugin_path = (char *)calloc(4096, sizeof(char)); + char *openfile_path = (char *)calloc(4096, sizeof(char)); + char *proc_info = (char *)calloc(1024, sizeof(char)); + char *filename_area = (char *)calloc(256, sizeof(char)); + + new_od_filter -> size = 0; + new_od_filter -> end = 0; + + new_opendialog -> mode = mode; + new_opendialog -> procinfo = proc_info; + new_opendialog -> com_area_name = &sz_com_area_name; + new_opendialog -> com_area = 0; + new_opendialog -> opendir_path = plugin_path; + new_opendialog -> dir_default_path = &sz_dir_default_path; + new_opendialog -> start_path = &sz_start_path; + new_opendialog -> draw_window = &fake_on_redraw; + new_opendialog -> status = 0; + new_opendialog -> openfile_path = openfile_path; + new_opendialog -> filename_area = filename_area; + new_opendialog -> filter_area = new_od_filter; + new_opendialog -> x_size = x_size; + new_opendialog -> x_start = tlx; + new_opendialog -> y_size = y_size; + new_opendialog -> y_start = tly; + return new_opendialog; +} + +extern void (*OpenDialog_init)(struct open_dialog *) __attribute__((__stdcall__)); +extern void (*OpenDialog_start)(struct open_dialog *) __attribute__((__stdcall__)); +#endif /* KOLIBRI_OPENDIALOG_H */ diff --git a/contrib/C_Layer/proc_lib/kolibri_proclib.h b/contrib/C_Layer/proc_lib/kolibri_proclib.h new file mode 100644 index 0000000000..4b2a603eab --- /dev/null +++ b/contrib/C_Layer/proc_lib/kolibri_proclib.h @@ -0,0 +1,22 @@ +#ifndef KOLIBRI_PROCLIB_H +#define KOLIBRI_PROCLIB_H + +int kolibri_proclib_init(void) +{ + int asm_init_status = init_proclib_asm(); + + /* just return asm_init_status? or return init_proclib_asm() ?*/ + + if(asm_init_status == 0) + return 0; + else + return 1; +} + +enum Mode { + OD_OPEN, + OD_SAVE, + OD_DIR +}; + +#endif /* KOLIBRI_PROCLIB_H */ diff --git a/contrib/C_Layer/proc_lib/loadproclib.asm b/contrib/C_Layer/proc_lib/loadproclib.asm new file mode 100644 index 0000000000..51a812bcbe --- /dev/null +++ b/contrib/C_Layer/proc_lib/loadproclib.asm @@ -0,0 +1,45 @@ + +format coff +use32 ; Tell compiler to use 32 bit instructions + +section '.init' code ; Keep this line before includes or GCC messes up call addresses + +include 'proc32.inc' +include 'macros.inc' +purge section,mov,add,sub + +include 'dll.inc' + +public init_proclib as '_init_proclib_asm' +;;; Returns 0 on success. -1 on failure. + +proc init_proclib + + mcall 68,11 + + stdcall dll.Load, @IMPORT + test eax, eax + jnz error + + mov eax, 0 + ret + +error: + mov eax, -1 + ret +endp + +@IMPORT: +library lib_boxlib, 'proc_lib.obj' + +import lib_boxlib, \ + OpenDialog_init, 'OpenDialog_init' , \ + OpenDialog_start, 'OpenDialog_start' , \ + ColorDialog_init, 'ColorDialog_init' , \ + ColorDialog_start, 'ColorDialog_start' + +public OpenDialog_init as '_OpenDialog_init' +public OpenDialog_start as '_OpenDialog_start' + +public ColorDialog_init as '_ColorDialog_init' +public ColorDialog_start as '_ColorDialog_start'