diff --git a/contrib/media/updf/SYSCALL/src/Makefile b/contrib/media/updf/SYSCALL/src/Makefile deleted file mode 100755 index 195d540071..0000000000 --- a/contrib/media/updf/SYSCALL/src/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -CC = kos32-gcc -LD = kos32-ld - -SDK_DIR = $(abspath ../../../../sdk) - -CFLAGS = -c -fno-ident -O2 -fomit-frame-pointer -fno-ident -U__WIN32__ -U_Win32 -U_WIN32 -U__MINGW32__ -UWIN32 - -INCLUDES = -I ../include -I $(SDK_DIR)/sources/newlib/libc/include - -SYSCALL_SRC := $(notdir $(wildcard *.c)) -OBJECTS = $(patsubst %.c, %.o, $(SYSCALL_SRC)) - -default: $(patsubst %.c,%.o,$(SYSCALL_SRC)) - ar rcs libsyscall.a *.o - rm *.o - mv libsyscall.a ../../lib - -%.o : %.c Makefile $(SYSCALL_SRC) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ $< - -clean: - rm *.o diff --git a/contrib/media/updf/SYSCALL/src/backgr.c b/contrib/media/updf/SYSCALL/src/backgr.c deleted file mode 100755 index f9aa07fbf3..0000000000 --- a/contrib/media/updf/SYSCALL/src/backgr.c +++ /dev/null @@ -1,26 +0,0 @@ -#include - -void __menuet__set_background_size(__u32 xsz,__u32 ysz) -{ - __asm__ __volatile__("int $0x40"::"a"(15),"b"(1),"c"(xsz),"d"(ysz)); -} - -void __menuet__write_background_mem(__u32 pos,__u32 color) -{ - __asm__ __volatile__("int $0x40"::"a"(15),"b"(2),"c"(pos),"d"(color)); -} - -void __menuet__draw_background(void) -{ - __asm__ __volatile__("int $0x40"::"a"(15),"b"(3)); -} - -void __menuet__set_background_draw_type(int type) -{ - __asm__ __volatile__("int $0x40"::"a"(15),"b"(3),"c"(type)); -} - -void __menuet__background_blockmove(char * src_ptr,__u32 bgr_dst,__u32 count) -{ - __asm__ __volatile__("int $0x40"::"a"(15),"b"(3),"c"(src_ptr),"d"(bgr_dst),"S"(count)); -} diff --git a/contrib/media/updf/SYSCALL/src/bar.c b/contrib/media/updf/SYSCALL/src/bar.c deleted file mode 100755 index 828ad043fa..0000000000 --- a/contrib/media/updf/SYSCALL/src/bar.c +++ /dev/null @@ -1,9 +0,0 @@ -#include - -void __menuet__bar(__u16 x1,__u16 y1,__u16 xsize,__u16 ysize,__u32 color) -{ - __u32 a,b; - a=(x1<<16)|xsize; - b=(y1<<16)|ysize; - __asm__ __volatile__("int $0x40"::"a"(13),"b"(a),"c"(b),"d"(color)); -} diff --git a/contrib/media/updf/SYSCALL/src/button.c b/contrib/media/updf/SYSCALL/src/button.c deleted file mode 100755 index 25af0cfce5..0000000000 --- a/contrib/media/updf/SYSCALL/src/button.c +++ /dev/null @@ -1,17 +0,0 @@ -#include - -void __menuet__make_button(__u16 x1,__u16 y1,__u16 xsize,__u16 ysize, - int id,__u32 color) -{ - __u32 a,b; - a=(x1<<16)|xsize; - b=(y1<<16)|ysize; - __asm__ __volatile__("int $0x40"::"a"(8),"b"(a),"c"(b),"d"(id),"S"(color)); -} - -int __menuet__get_button_id(void) -{ - __u16 __ret; - __asm__ __volatile__("int $0x40":"=a"(__ret):"0"(17)); - if((__ret & 0xFF)==0) return (__ret>>8)&0xFF; else return -1; -} diff --git a/contrib/media/updf/SYSCALL/src/clock.c b/contrib/media/updf/SYSCALL/src/clock.c deleted file mode 100755 index 38b2e582af..0000000000 --- a/contrib/media/updf/SYSCALL/src/clock.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -__u32 __menuet__getsystemclock(void) -{ - __u32 __ret; - __asm__ __volatile__("int $0x40":"=a"(__ret):"0"(3)); - return __ret; -} diff --git a/contrib/media/updf/SYSCALL/src/cofflib.c b/contrib/media/updf/SYSCALL/src/cofflib.c deleted file mode 100755 index 9b3cfe553d..0000000000 --- a/contrib/media/updf/SYSCALL/src/cofflib.c +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include -#include - -IMP_TABLE __kolibri__cofflib_load(const char* name){ - __asm__ __volatile__("int $0x40"::"a"(68L),"b"(19L),"c"((__u32)name)); -} - -__u32 __kolibri__cofflib_getproc(IMP_TABLE lib, const char* name){ - if(!name || !name[0]) return 0; - int i; - for(i = 0; lib[i].name && strcmp(name, lib[i].name); i++); - if(lib[i].name) return (__u32)lib[i].pointer; - else return 0; -} diff --git a/contrib/media/updf/SYSCALL/src/date.c b/contrib/media/updf/SYSCALL/src/date.c deleted file mode 100755 index a2ca956fdf..0000000000 --- a/contrib/media/updf/SYSCALL/src/date.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -__u32 __menuet__get_date(void) -{ - __u32 __ret; - __asm__ __volatile__("int $0x40":"=a"(__ret):"0"(29)); - return __ret; -} \ No newline at end of file diff --git a/contrib/media/updf/SYSCALL/src/debug.c b/contrib/media/updf/SYSCALL/src/debug.c deleted file mode 100755 index d3916bb8a3..0000000000 --- a/contrib/media/updf/SYSCALL/src/debug.c +++ /dev/null @@ -1,5 +0,0 @@ -#include -void __menuet__debug_out(const char* str){ - while(*str) - __menuet__debug_out_byte(*str++); -} diff --git a/contrib/media/updf/SYSCALL/src/delay.c b/contrib/media/updf/SYSCALL/src/delay.c deleted file mode 100755 index 91365b2481..0000000000 --- a/contrib/media/updf/SYSCALL/src/delay.c +++ /dev/null @@ -1,11 +0,0 @@ -#include - -void __menuet__delay100(int m) -{ - __asm__ __volatile__("int $0x40"::"a"(5),"b"(m)); -} - -void __menuet__idle(void) -{ - __menuet__delay100(10); -} diff --git a/contrib/media/updf/SYSCALL/src/dga.c b/contrib/media/updf/SYSCALL/src/dga.c deleted file mode 100755 index 7b1386d427..0000000000 --- a/contrib/media/updf/SYSCALL/src/dga.c +++ /dev/null @@ -1,19 +0,0 @@ -#include - -void __menuet__dga_get_caps(int * xres,int * yres,int * bpp,int * bpscan) -{ - int p; - __asm__ __volatile__("int $0x40":"=a"(p):"0"(61),"b"(1)); - if(xres) *xres=(p>>16)&0xFFFF; - if(yres) *yres=p & 0xFFFF; - if(bpp) - { - __asm__ __volatile__("int $0x40":"=a"(p):"0"(61),"b"(2)); - *bpp=p; - } - if(bpscan) - { - __asm__ __volatile__("int $0x40":"=a"(p):"0"(61),"b"(3)); - *bpscan=p; - } -} diff --git a/contrib/media/updf/SYSCALL/src/event.c b/contrib/media/updf/SYSCALL/src/event.c deleted file mode 100755 index f5c8fc5f04..0000000000 --- a/contrib/media/updf/SYSCALL/src/event.c +++ /dev/null @@ -1,20 +0,0 @@ -#include - -int __menuet__wait_for_event(void) -{ - __u32 __ret; - __asm__ __volatile__("int $0x40":"=a"(__ret):"0"(10)); - return __ret; -} - -int __menuet__check_for_event(void) -{ - __u32 __ret; - __asm__ __volatile__("int $0x40":"=a"(__ret):"0"(11)); - return __ret; -} - -void __menuet__set_bitfield_for_wanted_events(__u32 ev) -{ - __asm__ __volatile__("int $0x40"::"a"(40),"b"(ev)); -} diff --git a/contrib/media/updf/SYSCALL/src/exit.c b/contrib/media/updf/SYSCALL/src/exit.c deleted file mode 100755 index e893e5bf43..0000000000 --- a/contrib/media/updf/SYSCALL/src/exit.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -void __menuet__sys_exit(void) -{ - __asm__ __volatile__("int $0x40"::"a"(0xFFFFFFFF)); -} diff --git a/contrib/media/updf/SYSCALL/src/file.c b/contrib/media/updf/SYSCALL/src/file.c deleted file mode 100755 index e6e462ebf0..0000000000 --- a/contrib/media/updf/SYSCALL/src/file.c +++ /dev/null @@ -1,45 +0,0 @@ -#include -#include -#include -#include - -__u32 __menuet__open(char * name,char * data) -{ - __u32 __ret; - __asm__ __volatile__("int $0x40":"=a"(__ret):"0"(6),"b"((__u32)name),"c"(0),"d"(0xFFFFFFFF),"S"((__u32)data)); - return __ret; -} - -void __menuet__save(char * name,char * data,__u32 count) -{ - __asm__ __volatile__("int $0x40"::"a"(33),"b"((__u32)name),"c"((__u32)data),"d"(count),"S"(0)); -} - -void __menuet__exec_ramdisk(char * filename,char * args,...) -{ - va_list argz; - char buffer[1024]; - memset(buffer,0,1024); - if(args) - { - va_start(argz,args); - vsprintf(buffer,args,argz); - } - va_end(argz); - __asm__ __volatile__("int $0x40"::"a"(19),"b"(filename),"c"((args ? buffer : NULL))); -} - -void __menuet__exec_hd(char * filename,char * args,...) -{ - va_list argz; - char buffer[1024]; - char work_area[0xFFFF]; - memset(buffer,0,1024); - if(args) - { - va_start(argz,args); - vsprintf(buffer,args,argz); - } - va_end(argz); - __asm__ __volatile__("int $0x40"::"a"(19),"b"(filename),"c"(args ? buffer : NULL),"d"(work_area)); -} diff --git a/contrib/media/updf/SYSCALL/src/image.c b/contrib/media/updf/SYSCALL/src/image.c deleted file mode 100755 index 5f7daa1319..0000000000 --- a/contrib/media/updf/SYSCALL/src/image.c +++ /dev/null @@ -1,9 +0,0 @@ -#include - -void __menuet__putimage(__u16 x1,__u16 y1,__u16 xsize,__u16 ysize,char * image) -{ - __u32 a,b; - a=(xsize<<16)|ysize; - b=(x1<<16)|y1; - __asm__ __volatile__("int $0x40"::"a"(7),"b"(image),"c"(a),"d"(b)); -} diff --git a/contrib/media/updf/SYSCALL/src/ipc.c b/contrib/media/updf/SYSCALL/src/ipc.c deleted file mode 100755 index 1cd818d82b..0000000000 --- a/contrib/media/updf/SYSCALL/src/ipc.c +++ /dev/null @@ -1,11 +0,0 @@ -#include - -void send_message(int pid,void * msg_ptr,int message_size) -{ - __asm__ __volatile__("int $0x40"::"a"(60),"b"(2),"c"(pid),"d"(msg_ptr),"S"(message_size)); -} - -void define_receive_area(msgrcva_t * rcva_ptr,int size) -{ - __asm__ __volatile__("int $0x40"::"a"(60),"b"(1),"c"(rcva_ptr),"d"(size)); -} diff --git a/contrib/media/updf/SYSCALL/src/irq.c b/contrib/media/updf/SYSCALL/src/irq.c deleted file mode 100755 index 372322501d..0000000000 --- a/contrib/media/updf/SYSCALL/src/irq.c +++ /dev/null @@ -1,62 +0,0 @@ -#include - -__u32 __menuet__get_irq_owner(__u32 irq) -{ - __u32 __ret; - __asm__ __volatile__("int $0x40":"=a"(__ret):"0"(41),"b"(irq)); - return __ret; -} - -int __menuet__get_data_read_by_irq(__u32 irq,__u32 * num_bytes_in_buf,__u8 * data) -{ - __u32 a,b,c; - __asm__ __volatile__("int $0x40":"=a"(a),"=b"(b),"=c"(c):"0"(42),"1"(irq)); - if(num_bytes_in_buf) *num_bytes_in_buf=a; - if(data) *data=b & 0xFF; - return c; -} - -int __menuet__send_data_to_device(__u16 port,__u8 val) -{ - int __ret; - __asm__ __volatile__("int $0x40":"=a"(__ret):"0"(43),"b"(port),"c"(val)); - return __ret; -} - -void __menuet__program_irq(void * intr_table,__u32 irq_num) -{ - __asm__ __volatile__("int $0x40"::"a"(44),"b"(intr_table),"c"(irq_num)); -} - -int __menuet__reserve_irq(int irqno) -{ - int __ret; - __asm__ __volatile__("int $0x40":"=a"(__ret):"0"(45),"b"(0),"c"(irqno)); - return __ret; -} - -int __menuet__free_irq(int irqno) -{ - int __ret; - __asm__ __volatile__("int $0x40":"=a"(__ret):"0"(45),"b"(1),"c"(irqno)); - return __ret; -} - -int __menuet__reserve_port_area(__u32 start,__u32 end) -{ - int __ret; - __asm__("int $0x40":"=a"(__ret):"a"(45),"b"(0),"c"(start),"d"(end)); - return __ret; -} - -int __menuet__free_port_area(__u32 start,__u32 end) -{ - int __ret; - __asm__("int $0x40":"=a"(__ret):"a"(45),"b"(1),"c"(start),"d"(end)); - return __ret; -} - -void __menuet__define_app_internal_intrs(void * intr_table) -{ - __asm__("int $0x40"::"a"(49),"b"(0),"c"(intr_table)); -} diff --git a/contrib/media/updf/SYSCALL/src/keyb.c b/contrib/media/updf/SYSCALL/src/keyb.c deleted file mode 100755 index 10f05b4ba3..0000000000 --- a/contrib/media/updf/SYSCALL/src/keyb.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -int __menuet__getkey(void) -{ - __u16 __ret; - __asm__ __volatile__("int $0x40":"=a"(__ret):"0"(2)); - if(!(__ret & 0xFF)) return (__ret>>8)&0xFF; else return 0; -} diff --git a/contrib/media/updf/SYSCALL/src/line.c b/contrib/media/updf/SYSCALL/src/line.c deleted file mode 100755 index d5aff6b364..0000000000 --- a/contrib/media/updf/SYSCALL/src/line.c +++ /dev/null @@ -1,9 +0,0 @@ -#include - -void __menuet__line(__u16 x1,__u16 y1,__u16 x2,__u16 y2,__u32 color) -{ - __u32 b,c; - b=(x1<<16)|x1; - c=(y1<<16)|y2; - __asm__ __volatile__("int $0x40"::"a"(38),"b"(b),"c"(c),"d"(color)); -} diff --git a/contrib/media/updf/SYSCALL/src/mpu401.c b/contrib/media/updf/SYSCALL/src/mpu401.c deleted file mode 100755 index 14a25ab488..0000000000 --- a/contrib/media/updf/SYSCALL/src/mpu401.c +++ /dev/null @@ -1,11 +0,0 @@ -#include - -void __menuet__reset_mpu401(void) -{ - __asm__ __volatile__("int $0x40"::"a"(20),"b"(1)); -} - -void __menuet__write_mpu401(__u8 d) -{ - __asm__ __volatile__("int $0x40"::"a"(20),"b"(2),"c"(d)); -} diff --git a/contrib/media/updf/SYSCALL/src/param.c b/contrib/media/updf/SYSCALL/src/param.c deleted file mode 100755 index 18de968c97..0000000000 --- a/contrib/media/updf/SYSCALL/src/param.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -#define APP_PARAM_SZ (1024) -#define APP_PATH_SZ (1024) - -char __menuet__app_param_area[APP_PARAM_SZ]; -char __menuet__app_path_area[APP_PATH_SZ]; diff --git a/contrib/media/updf/SYSCALL/src/pci.c b/contrib/media/updf/SYSCALL/src/pci.c deleted file mode 100755 index 13c9e8bf72..0000000000 --- a/contrib/media/updf/SYSCALL/src/pci.c +++ /dev/null @@ -1,50 +0,0 @@ -#include - -#define PCI_FN 62 - -void get_pci_version(__u8 * major,__u8 * minor) -{ - int r; - __asm__ __volatile__("int $0x40":"=a"(r):"0"(PCI_FN),"b"(0)); - *minor=r&0xFF; - *major=(r>>8)&0xFF; -} - -void pci_get_last_bus(__u8 * last_bus) -{ - __asm__ __volatile__("int $0x40":"=a"(*last_bus):"0"(PCI_FN),"b"(1)); -} - -void get_pci_access_mechanism(__u8 * mechanism) -{ - __asm__ __volatile__("int $0x40":"=a"(*mechanism):"0"(PCI_FN),"b"(2)); -} - -#define read_config(x,c,bits) \ - __u##bits pci_read_config_##x (__u8 bus,__u8 dev,__u8 fn,__u8 reg) \ - { \ - __u##bits __ret; \ - __u16 cx; \ - __u16 bx; \ - cx=(((fn&7)|(((dev)&~7)<<3))<<8)|reg; \ - bx=(bus<<8)|(c); \ - __asm__ __volatile__("int $0x40":"=a"(__ret):"0"(PCI_FN),"b"(bx),"c"(cx)); \ - return __ret; \ - } - -#define write_config(x,c,bits) \ - void pci_write_config_##x (__u8 bus,__u8 dev,__u8 fn,__u8 reg,__u##bits val) \ - { \ - __u16 cx,bx; \ - cx=(((fn&7)|(((dev)&~7)<<3))<<8)|reg; \ - bx=(bus<<8)|(c); \ - __asm__ __volatile__("int $0x40"::"a"(PCI_FN),"b"(bx),"c"(cx),"d"(val)); \ - } - -#define rw_config(x,c,bits) \ - read_config(x,4+c,bits) \ - write_config(x,7+c,bits) - -rw_config(byte,0,8) -rw_config(word,1,16) -rw_config(dword,2,32) diff --git a/contrib/media/updf/SYSCALL/src/pixel.c b/contrib/media/updf/SYSCALL/src/pixel.c deleted file mode 100755 index ed7d34f022..0000000000 --- a/contrib/media/updf/SYSCALL/src/pixel.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -void __menuet__putpixel(__u32 x,__u32 y,__u32 color) -{ - __asm__ __volatile__("int $0x40"::"a"(1),"b"(x),"c"(y),"d"(color)); -} diff --git a/contrib/media/updf/SYSCALL/src/process.c b/contrib/media/updf/SYSCALL/src/process.c deleted file mode 100755 index 98bb310994..0000000000 --- a/contrib/media/updf/SYSCALL/src/process.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -int __menuet__get_process_table(struct process_table_entry * proctab,int pid) -{ - int __ret; - __asm__ __volatile__("int $0x40":"=a"(__ret):"0"(9),"b"((__u32)proctab),"c"(pid)); - return __ret; -} diff --git a/contrib/media/updf/SYSCALL/src/screen.c b/contrib/media/updf/SYSCALL/src/screen.c deleted file mode 100755 index 8d3e30c8cf..0000000000 --- a/contrib/media/updf/SYSCALL/src/screen.c +++ /dev/null @@ -1,9 +0,0 @@ -#include - -void __menuet__get_screen_max(__u16 * x,__u16 * y) -{ - __u32 v; - __asm__ __volatile__("int $0x40":"=a"(v):"0"(14)); - if(x) *x=v>>16; - if(y) *y=v & 0xFFFF; -} diff --git a/contrib/media/updf/SYSCALL/src/sound.c b/contrib/media/updf/SYSCALL/src/sound.c deleted file mode 100755 index 2fee9b1568..0000000000 --- a/contrib/media/updf/SYSCALL/src/sound.c +++ /dev/null @@ -1,11 +0,0 @@ -#include - -void __menuet__sound_load_block(char * blockptr) -{ - __asm__ __volatile__("int $0x40"::"a"(55),"b"(0),"c"(blockptr)); -} - -void __menuet__sound_play_block(void) -{ - __asm__ __volatile__("int $0x40"::"a"(55),"b"(1)); -} diff --git a/contrib/media/updf/SYSCALL/src/systree.c b/contrib/media/updf/SYSCALL/src/systree.c deleted file mode 100755 index 77411a5e42..0000000000 --- a/contrib/media/updf/SYSCALL/src/systree.c +++ /dev/null @@ -1,16 +0,0 @@ -#include - -int __kolibri__system_tree_access(struct systree_info * info) -{ - int __ret; - int d0; - __asm__ __volatile__("int $0x40":"=a"(__ret),"=&b"(d0):"0"(70),"1"((__u32)info)); - return __ret; -} -int __kolibri__system_tree_access2(struct systree_info2 * info) -{ - int __ret; - int d0; - __asm__ __volatile__("int $0x40":"=a"(__ret),"=&b"(d0):"0"(70),"1"((__u32)info)); - return __ret; -} diff --git a/contrib/media/updf/SYSCALL/src/text.c b/contrib/media/updf/SYSCALL/src/text.c deleted file mode 100755 index 7769d88887..0000000000 --- a/contrib/media/updf/SYSCALL/src/text.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -void __menuet__write_text(__u16 x,__u16 y,__u32 color,char * text,int len) -{ - __asm__ __volatile__("int $0x40"::"a"(4),"b"((x<<16)|y),"c"(color),"d"((__u32)text),"S"(len)); -} diff --git a/contrib/media/updf/SYSCALL/src/thread.c b/contrib/media/updf/SYSCALL/src/thread.c deleted file mode 100755 index cf15b66f81..0000000000 --- a/contrib/media/updf/SYSCALL/src/thread.c +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include -#include - -void * __menuet__exec_thread(void (* func_ptr)(void),__u32 stack_size,int * retp) -{ - void * __stk, * __ret; - __ret=__stk=malloc(stack_size); - __stk+=stack_size-1; - __asm__ __volatile__("int $0x40":"=a"(*retp):"0"(51L),"b"(1L),"c"((__u32)func_ptr),"d"((__u32)__stk)); - return __ret; -} diff --git a/contrib/media/updf/SYSCALL/src/window.c b/contrib/media/updf/SYSCALL/src/window.c deleted file mode 100755 index 5ab0db8dbb..0000000000 --- a/contrib/media/updf/SYSCALL/src/window.c +++ /dev/null @@ -1,16 +0,0 @@ -#include - -void __menuet__define_window(__u16 x1,__u16 y1,__u16 xsize,__u16 ysize, - __u32 body_color,__u32 grab_color,__u32 frame_color) -{ - __u32 a,b; - a=(x1<<16)|xsize; - b=(y1<<16)|ysize; - __asm__ __volatile__("int $0x40"::"a"(0),"b"(a),"c"(b),"d"(body_color),"S"(grab_color), - "D"(frame_color)); -} - -void __menuet__window_redraw(int status) -{ - __asm__ __volatile__("int $0x40"::"a"(12),"b"(status)); -} diff --git a/contrib/media/updf/apps/Makefile b/contrib/media/updf/apps/Makefile index 59309afb2d..586158ce77 100755 --- a/contrib/media/updf/apps/Makefile +++ b/contrib/media/updf/apps/Makefile @@ -6,15 +6,13 @@ LDFLAGS = -static -nostdlib -T $(SDK_DIR)/sources/newlib/app.lds --image-base 0 CFLAGS = -c -fno-ident -O2 -fomit-frame-pointer -fno-ident -U__WIN32__ -U_Win32 -U_WIN32 -U__MINGW32__ -UWIN32 -INCLUDES = -I ../SYSCALL/include -I $(SDK_DIR)/sources/newlib/libc/include -I $(SDK_DIR)/sources/freetype/include -I $(SDK_DIR)/sources/zlib -I ../fitz -I ../pdf +INCLUDES = -I $(SDK_DIR)/sources/newlib/libc/include -I $(SDK_DIR)/sources/freetype/include -I $(SDK_DIR)/sources/zlib -I ../fitz -I ../pdf LIBPATH = -L $(SDK_DIR)/lib -L /home/autobuild/tools/win32/mingw32/lib -L ../lib APPS_SRC := $(notdir $(wildcard *.c)) default: $(patsubst %.c,%.o,$(APPS_SRC)) - $(LD) $(LDFLAGS) $(LIBPATH) -o updf kolibri.o pdfapp.o kos_main.o -lmupdf -lfreetype -lfitz -lgcc -lfitz -ldraw -ljpeg -ljbig2dec -lfreetype -lopenjpeg -lz -lc.dll -lsyscall --subsystem native -# yet not work -# $(LD) $(LDFLAGS) $(LIBPATH) -o pdfdraw kolibri.o pdfapp.o pdfdraw.o -lmupdf -lfreetype -lfitz -lgcc -lfitz -ldraw -ljpeg -ljbig2dec -lfreetype -lopenjpeg -lz -lc.dll -lsyscall --subsystem native + $(LD) $(LDFLAGS) $(LIBPATH) -o updf kolibri.o pdfapp.o kos_main.o -lmupdf -lfreetype -lfitz -lgcc -lfitz -ldraw -ljpeg -ljbig2dec -lfreetype -lopenjpeg -lz -lc.dll --subsystem native objcopy updf -O binary diff --git a/contrib/media/updf/apps/kolibri.c b/contrib/media/updf/apps/kolibri.c index 91d3b2c22a..f09b505cdc 100644 --- a/contrib/media/updf/apps/kolibri.c +++ b/contrib/media/updf/apps/kolibri.c @@ -485,3 +485,37 @@ void kos_blit(int dstx, int dsty, int w, int h, int srcx, } +void kos_move_window(int posx, int posy, int sizex, int sizey) +{ + __asm__ __volatile__( + "int $0x40" + ::"a"(67), + "b"(posx), + "c"(posy), + "d"(sizex), + "S"(sizey)); +}; + +void kos_text(int x, int y, int color, const char* text, int len) +{ + asm volatile ("int $0x40"::"a"(4),"b"((x<<16) | y),"c"(color),"d"((unsigned long)text),"S"(len)); +}; + +void kos_screen_max(int* x, int* y) +{ + unsigned long v; + __asm__ __volatile__( + "int $0x40" + :"=a"(v) + :"a"(14)); + + if(x) *x = v >> 16; + if(y) *y = v & 0xFFFF; +}; + +int kol_get_key() +{ + unsigned short __ret; + asm volatile("int $0x40":"=a"(__ret):"0"(2)); + if(!(__ret & 0xFF)) return (__ret>>8)&0xFF; else return 0; +} diff --git a/contrib/media/updf/apps/kolibri.h b/contrib/media/updf/apps/kolibri.h index 4e718397b8..b30e657fab 100644 --- a/contrib/media/updf/apps/kolibri.h +++ b/contrib/media/updf/apps/kolibri.h @@ -3,6 +3,16 @@ #define NULL ((void*)0) #endif +#define EVENT_REDRAW 0x00000001 +#define EVENT_KEY 0x00000002 +#define EVENT_BUTTON 0x00000004 +#define EVENT_END_REQUEST 0x00000008 +#define EVENT_DESKTOP_BACK_DRAW 0x00000010 +#define EVENT_MOUSE_CHANGE 0x00000020 +#define EVENT_IPC 0x00000040 +#define EVENT_MOUSE_CURSOR_MASK 0x40000000 +#define EVENT_MOUSE_WINDOW_MASK 0x80000000 + #define SHM_OPEN 0 #define SHM_OPEN_ALWAYS 0x04 #define SHM_CREATE 0x08 @@ -149,3 +159,41 @@ void kos_blit(int dstx, int dsty, int w, int h, int srcx, int srcy,int srcw, int srch, int stride, char *d); int kos_random(int num); int kos_get_mouse_wheels(void); + +#define OLD -1 +void kos_move_window(int posx, int posy, int sizex, int sizey); + +void kos_text(int x, int y, int color, const char* text, int len); + +void kol_btn_define(unsigned x, unsigned y, unsigned w, unsigned h, unsigned d, unsigned c); +void kos_screen_max(int* x, int* y); +int kol_get_key(); + +//// Struct from menuet/os.h + +typedef unsigned char __u8; +typedef unsigned short __u16; +typedef unsigned long __u32; + +#pragma pack(push,1) + +struct process_table_entry +{ + __u32 cpu_usage; + __u16 pos_in_windowing_stack; + __u16 win_stack_val_at_ecx; + __u16 reserved1; + char name[12]; + __u32 memstart; + __u32 memused; + __u32 pid; + __u32 winx_start,winy_start; + __u32 winx_size,winy_size; + __u16 thread_state; + __u16 reserved2; + __u32 client_left,client_top,client_width,client_height; + __u8 window_state; + __u8 reserved3[1024-71]; +}; + +#pragma pack(pop) diff --git a/contrib/media/updf/apps/kos_main.c b/contrib/media/updf/apps/kos_main.c index d008c373d2..e33435ec6a 100644 --- a/contrib/media/updf/apps/kos_main.c +++ b/contrib/media/updf/apps/kos_main.c @@ -1,14 +1,13 @@ -#include +/*==== INCLUDES ====*/ + +//#include +#include #include "fitz.h" #include "mupdf.h" #include "pdfapp.h" #include "icons/allbtns.h" #include "kolibri.h" -void run_app() -{ - return; -} /*==== DATA ====*/ @@ -58,7 +57,7 @@ void winblit(pdfapp_t *app); void DrawPagination(void); void HandleNewPageNumber(unsigned char key); void ApplyNewPageNumber(void); -void DrawWindow(void); +void DrawMainWindow(void); // not implemented yet @@ -230,14 +229,14 @@ void HandleNewPageNumber(unsigned char key) if (key==ASCII_KEY_ESC) { key_mode_enter_page_number = 0; - DrawWindow(); + DrawMainWindow(); return; } itoa(new_page_number, label_new_page, 10); strcat(label_new_page, "_"); kol_paint_bar(show_area_x, 6, show_area_w, 22, 0xFDF88E); - __menuet__write_text(show_area_x + show_area_w/2 - strlen(label_new_page)*6/2, 14, 0x000000, label_new_page, strlen(label_new_page)); + kos_text(show_area_x + show_area_w/2 - strlen(label_new_page)*6/2, 14, 0x000000, label_new_page, strlen(label_new_page)); if (new_page_number > gapp.pagecount) ApplyNewPageNumber(); } @@ -254,16 +253,16 @@ void DrawPagination(void) char pages_display[12]; kol_paint_bar(show_area_x, 6, show_area_w, 22, 0xF4F4F4); sprintf (pages_display, "%d/%d", gapp.pageno, gapp.pagecount); - __menuet__write_text(show_area_x + show_area_w/2 - strlen(pages_display)*6/2, 14, 0x000000, pages_display, strlen(pages_display)); + kos_text(show_area_x + show_area_w/2 - strlen(pages_display)*6/2, 14, 0x000000, pages_display, strlen(pages_display)); } void DrawToolbarButton(int x, char image_id) { - __menuet__make_button(x, 5, 26-1, 24-1, 10 + image_id + BT_HIDE, 0); - __menuet__putimage(x, 5, 26, 24, image_id * 24 * 26 * 3 + toolbar_image); + kol_btn_define(x, 5, 26-1, 24-1, 10 + image_id + BT_HIDE, 0); + draw_bitmap(image_id * 24 * 26 * 3 + toolbar_image, x, 5, 26, 24); } -void DrawWindow(void) +void DrawMainWindow(void) { kol_paint_bar(0, 0, Form.client_width, TOOLBAR_HEIGHT - 1, 0xe1e1e1); // bar on the top (buttons holder) kol_paint_bar(0, TOOLBAR_HEIGHT - 1, Form.client_width, 1, 0x7F7F7F); @@ -276,7 +275,7 @@ void DrawWindow(void) show_area_x = Form.client_width - show_area_w - 34; DrawToolbarButton(show_area_x - 26,4); //prev page DrawToolbarButton(show_area_x + show_area_w,5); //nex page - __menuet__make_button(show_area_x-1, 5, show_area_w+1, 23, 20 + BT_HIDE, 0xA4A4A4); + kol_btn_define(show_area_x-1, 5, show_area_w+1, 23, 20 + BT_HIDE, 0xA4A4A4); kol_paint_bar(show_area_x, 5, show_area_w, 1, 0xA4A4A4); kol_paint_bar(show_area_x, 28, show_area_w, 1, 0xA4A4A4); winblit(&gapp); @@ -334,7 +333,6 @@ void RunApp(char app[], char param[]) kol_file_70(&r); } - void PageZoomIn(void) { pdfapp_onkey(&gapp, '+'); @@ -398,38 +396,39 @@ int main (int argc, char* argv[]) kol_board_puts("Inital paint\n"); int butt, key, screen_max_x, screen_max_y; - __menuet__get_screen_max(&screen_max_x, &screen_max_y); - __menuet__set_bitfield_for_wanted_events(EVENT_REDRAW+EVENT_KEY+EVENT_BUTTON+EVENT_MOUSE_CHANGE); + kos_screen_max(&screen_max_x, &screen_max_y); + kol_event_mask(EVENT_REDRAW+EVENT_KEY+EVENT_BUTTON+EVENT_MOUSE_CHANGE); for(;;) { - switch(__menuet__wait_for_event()) + switch(get_os_event()) { case evReDraw: // gapp.shrinkwrap = 2; - __menuet__window_redraw(1); - __menuet__define_window(screen_max_x / 2 - 350-50+kos_random(50), + BeginDraw(); + kol_wnd_define(screen_max_x / 2 - 350-50+kos_random(50), screen_max_y / 2 - 300-50+kos_random(50), 700, 600, 0x73000000, 0x800000FF, Title); - __menuet__window_redraw(2); - __menuet__get_process_table(&Form, PID_WHOAMI); - if (Form.window_state > 2) continue; //fix rolled up + EndDraw(); + get_proc_info((char*)&Form); - // ?? - Form.client_width++; //fix for Menuet kernel bug - Form.client_height++; //fix for Menuet kernel bug + if (Form.window_state > 2) continue; // if Rolled-up - DrawWindow(); + // Minimal size (700x600) + if (Form.winx_size < 700) kos_move_window(OLD, OLD, 700, OLD); + if (Form.winy_size < 600) kos_move_window(OLD, OLD, OLD, 600); + + DrawMainWindow(); break; case evKey: - key = __menuet__getkey(); + key = kol_get_key(); if (key_mode_enter_page_number) { HandleNewPageNumber(key); break; } - if (key==ASCII_KEY_ESC) DrawWindow(); //close help + if (key==ASCII_KEY_ESC) DrawMainWindow(); //close help if (key==ASCII_KEY_PGDN) pdfapp_onkey(&gapp, ']'); if (key==ASCII_KEY_PGUP) pdfapp_onkey(&gapp, '['); if (key==ASCII_KEY_HOME) pdfapp_onkey(&gapp, 'g'); @@ -444,7 +443,7 @@ int main (int argc, char* argv[]) break; case evButton: - butt = __menuet__get_button_id(); + butt = get_os_button(); if(butt==1) exit(0); if(butt==10) RunOpenApp(argv[0]); if(butt==11) PageZoomOut(); //magnify - @@ -452,10 +451,10 @@ int main (int argc, char* argv[]) if(butt==13) //show help { kol_paint_bar(0, TOOLBAR_HEIGHT, Form.client_width, Form.client_height - TOOLBAR_HEIGHT, 0xF2F2F2); - __menuet__write_text(20, TOOLBAR_HEIGHT + 20 , 0x90000000, "uPDF for KolibriOS v1.2", 0); - __menuet__write_text(21, TOOLBAR_HEIGHT + 20 , 0x90000000, "uPDF for KolibriOS v1.2", 0); + kos_text(20, TOOLBAR_HEIGHT + 20 , 0x90000000, "uPDF for KolibriOS v1.2", 0); + kos_text(21, TOOLBAR_HEIGHT + 20 , 0x90000000, "uPDF for KolibriOS v1.2", 0); for (ii=0; help[ii]!=0; ii++) { - __menuet__write_text(20, TOOLBAR_HEIGHT + 60 + ii * 15, 0x80000000, help[ii], 0); + kos_text(20, TOOLBAR_HEIGHT + 60 + ii * 15, 0x80000000, help[ii], 0); } } if(butt==14) pdfapp_onkey(&gapp, '['); //previous page diff --git a/contrib/media/updf/apps/notes (копия).pdf b/contrib/media/updf/apps/notes (копия).pdf new file mode 100755 index 0000000000..c5f0fc344e Binary files /dev/null and b/contrib/media/updf/apps/notes (копия).pdf differ diff --git a/contrib/media/updf/apps/notes.pdf b/contrib/media/updf/apps/notes.pdf new file mode 100755 index 0000000000..c5f0fc344e Binary files /dev/null and b/contrib/media/updf/apps/notes.pdf differ diff --git a/contrib/media/updf/apps/pdf.pdf b/contrib/media/updf/apps/pdf.pdf new file mode 100755 index 0000000000..9202d665ec Binary files /dev/null and b/contrib/media/updf/apps/pdf.pdf differ diff --git a/contrib/media/updf/apps/qemu.sh b/contrib/media/updf/apps/qemu.sh new file mode 100755 index 0000000000..35a60f9743 --- /dev/null +++ b/contrib/media/updf/apps/qemu.sh @@ -0,0 +1 @@ +qemu-system-i386 -m 256 -boot d -cdrom /home/maxim/kolibri.iso -usb -usbdevice tablet -hda fat:rw:./ diff --git a/contrib/media/updf/apps/updf b/contrib/media/updf/apps/updf new file mode 100755 index 0000000000..2be5103367 Binary files /dev/null and b/contrib/media/updf/apps/updf differ diff --git a/contrib/media/updf/apps/updf.kex b/contrib/media/updf/apps/updf.kex new file mode 100755 index 0000000000..92c84937c8 Binary files /dev/null and b/contrib/media/updf/apps/updf.kex differ