From 3ae83680d22fa5c346a0121f4c0e1eaf83df0f38 Mon Sep 17 00:00:00 2001 From: maxcodehack Date: Tue, 29 Dec 2020 14:32:46 +0000 Subject: [PATCH] Add SDL newlib to autbuild git-svn-id: svn://kolibrios.org@8495 a494cfbc-eb01-0410-851d-a64ba20cac60 --- .../sources/SDL-1.2.2_newlib/src/Tupfile.lua | 33 +++++++++++++++++++ .../src/video/menuetos/SDL_menuetvideo.c | 29 +++++++++------- programs/demos/SDL/Tupfile.lua | 16 +++++++++ 3 files changed, 67 insertions(+), 11 deletions(-) create mode 100755 contrib/sdk/sources/SDL-1.2.2_newlib/src/Tupfile.lua create mode 100755 programs/demos/SDL/Tupfile.lua diff --git a/contrib/sdk/sources/SDL-1.2.2_newlib/src/Tupfile.lua b/contrib/sdk/sources/SDL-1.2.2_newlib/src/Tupfile.lua new file mode 100755 index 0000000000..4920717da6 --- /dev/null +++ b/contrib/sdk/sources/SDL-1.2.2_newlib/src/Tupfile.lua @@ -0,0 +1,33 @@ +if tup.getconfig("NO_GCC") ~= "" or tup.getconfig("NO_NASM") ~= "" then return end +tup.include("../../../../../programs/use_gcc.lua") +tup.include("../../../../../programs/use_newlib.lua") +tup.include("../../../../../programs/use_sound.lua") +INCLUDES = INCLUDES .. " -I. -I../include -Ihermes -Iaudio -Ivideo -Ievents -Ijoystick -Icdrom -Ithread -Itimer -Iendian -Ifile -ISYSCALL/include" +CFLAGS = CFLAGS .. ' -D_REENTRANT -DPACKAGE=\"SDL\" -DVERSION=\"1.2.2\"' +CFLAGS = CFLAGS .. ' -DENABLE_AUDIO -UDISABLE_AUDIO -DDISABLE_JOYSTICK' +CFLAGS = CFLAGS .. ' -DDISABLE_CDROM -DDISABLE_THREADS -DENABLE_TIMERS' +CFLAGS = CFLAGS .. ' -DUSE_ASMBLIT -DENABLE_KOLIBRIOS -DNO_SIGNAL_H -DDISABLE_STDIO -DNEED_SDL_GETENV' +CFLAGS = CFLAGS .. ' -DENABLE_FILE -UDISABLE_FILE -D__KOLIBRIOS__ -DDEBUG_VIDEO -UWIN32' +FOLDERS = { + "", + "audio/", + "endian/", + "events/", + "file/", + "hermes/", + "joystick/", + "thread/", + "timer/", + "timer/dummy/", + "video/", + "video/menuetos/", + "SYSCALL/src/" +} + +for i,v in ipairs(FOLDERS) do + compile_gcc(v .. "*.c", v .. "%B.o") + tup.append_table(OBJS, + tup.foreach_rule(v .. "*.asm", "nasm -f coff -o %o %f", v .. "%B.o") + ) +end +tup.rule(OBJS, "kos32-ar rcs %o %f", {"../../../lib/libSDLn.a", "../../../lib/"}) diff --git a/contrib/sdk/sources/SDL-1.2.2_newlib/src/video/menuetos/SDL_menuetvideo.c b/contrib/sdk/sources/SDL-1.2.2_newlib/src/video/menuetos/SDL_menuetvideo.c index 48ac1cf637..b0a0fc2d5d 100755 --- a/contrib/sdk/sources/SDL-1.2.2_newlib/src/video/menuetos/SDL_menuetvideo.c +++ b/contrib/sdk/sources/SDL-1.2.2_newlib/src/video/menuetos/SDL_menuetvideo.c @@ -31,10 +31,20 @@ inline int get_skinh(void) static int IsStyle4Available=0; #endif +void kol_define_window(unsigned short x1,unsigned short y1,unsigned short xsize,unsigned short ysize, + unsigned long body_color,unsigned long grab_color,unsigned long frame_color) +{ + unsigned long 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 MenuetOS_SDL_RepaintWnd(void) { - __menuet__window_redraw(1); - __menuet__define_window(1,1,vm_suf->hidden->win_size_x+9,vm_suf->hidden->win_size_y+get_skinh()+4, + begin_draw(); + kol_define_window(1,1,vm_suf->hidden->win_size_x+9,vm_suf->hidden->win_size_y+get_skinh()+4, #ifdef KEEP_OBSOLETE_STYLE3 IsStyle4Available?0x34000000:0x33000000 #else @@ -45,10 +55,9 @@ void MenuetOS_SDL_RepaintWnd(void) // __asm__ __volatile__("int3"); if(vm_suf && vm_suf->hidden->__video_buffer) - __menuet__putimage(0,0, - vm_suf->hidden->win_size_x,vm_suf->hidden->win_size_y, - vm_suf->hidden->__video_buffer); - __menuet__window_redraw(2); + draw_bitmap(vm_suf->hidden->__video_buffer, 0,0, + vm_suf->hidden->win_size_x,vm_suf->hidden->win_size_y); + end_draw(); } static int MenuetOS_AllocHWSurface(_THIS,SDL_Surface * surface) @@ -73,9 +82,8 @@ static void MenuetOS_DirectUpdate(_THIS,int numrects,SDL_Rect * rects) { if(numrects) { - __menuet__putimage(0,0, - vm_suf->hidden->win_size_x,vm_suf->hidden->win_size_y, - this->hidden->__video_buffer); + draw_bitmap(this->hidden->__video_buffer, 0,0, + vm_suf->hidden->win_size_x,vm_suf->hidden->win_size_y); } } @@ -219,8 +227,7 @@ static int MenuetOS_VideoInit(_THIS,SDL_PixelFormat * vformat) static int MenuetOS_FlipHWSurface(_THIS,SDL_Surface * surface) { - __menuet__putimage(0,0,surface->w,surface->h, - surface->pixels); + draw_bitmap(surface->pixels, 0,0,surface->w,surface->h); return 0; } diff --git a/programs/demos/SDL/Tupfile.lua b/programs/demos/SDL/Tupfile.lua new file mode 100755 index 0000000000..eccf1a0200 --- /dev/null +++ b/programs/demos/SDL/Tupfile.lua @@ -0,0 +1,16 @@ +if tup.getconfig("NO_GCC") ~= "" then return end +HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../.." or tup.getconfig("HELPERDIR") +tup.include(HELPERDIR .. "/use_gcc.lua") +tup.include(HELPERDIR .. "/use_newlib.lua") +tup.include(HELPERDIR .. "/use_sound.lua") + +CFLAGS = CFLAGS .. " -std=c99" +INCLUDES = INCLUDES .. " -I../../../contrib/sdk/sources/SDL-1.2.2_newlib/include" +table.insert(LIBDEPS, "../../../contrib/sdk/lib/") +LIBS = "-lSDLn " .. LIBS + +-- Subsystem native +LDFLAGS = LDFLAGS .. " --subsystem native" + +compile_gcc{"SDLTest.c"} +link_gcc("SDLTest")