From 10ba3b881d229854aa28891e03c5de45b3278d1a Mon Sep 17 00:00:00 2001 From: ashmew2 Date: Wed, 30 Mar 2016 22:39:02 +0000 Subject: [PATCH] Revert SDL to menuetlibc git-svn-id: svn://kolibrios.org@6386 a494cfbc-eb01-0410-851d-a64ba20cac60 --- .../sources/SDL-1.2.2/include/SDL_getenv.h | 2 +- contrib/sdk/sources/SDL-1.2.2/src/Makefile | 160 +++++------------- contrib/sdk/sources/SDL-1.2.2/src/SDL_fatal.c | 2 +- .../sdk/sources/SDL-1.2.2/src/SDL_getenv.c | 6 +- contrib/sdk/sources/SDL-1.2.2/src/Tupfile.lua | 6 +- .../SDL-1.2.2/src/audio/SDL_kolibri_audio.c | 28 +-- .../sources/SDL-1.2.2/src/hermes/mmxp2_32.asm | 2 +- .../sources/SDL-1.2.2/src/hermes/x86_main.asm | 20 ++- .../SDL-1.2.2/src/timer/dummy/SDL_systimer.c | 3 +- .../src/video/menuetos/SDL_menuetevents.c | 25 +-- .../src/video/menuetos/SDL_menuetvideo.c | 68 ++++---- 11 files changed, 128 insertions(+), 194 deletions(-) diff --git a/contrib/sdk/sources/SDL-1.2.2/include/SDL_getenv.h b/contrib/sdk/sources/SDL-1.2.2/include/SDL_getenv.h index a3bee45d8..9d96f7654 100644 --- a/contrib/sdk/sources/SDL-1.2.2/include/SDL_getenv.h +++ b/contrib/sdk/sources/SDL-1.2.2/include/SDL_getenv.h @@ -15,7 +15,7 @@ extern "C" { /* Put a variable of the form "name=value" into the environment */ extern DECLSPEC int SDL_putenv(const char *variable); -#define sdlputenv(X) SDL_putenv(X) +#define putenv(X) SDL_putenv(X) /* Retrieve a variable named "name" from the environment */ extern DECLSPEC char *SDL_getenv(const char *name); diff --git a/contrib/sdk/sources/SDL-1.2.2/src/Makefile b/contrib/sdk/sources/SDL-1.2.2/src/Makefile index 7991affe2..2a1b1f54d 100644 --- a/contrib/sdk/sources/SDL-1.2.2/src/Makefile +++ b/contrib/sdk/sources/SDL-1.2.2/src/Makefile @@ -1,114 +1,46 @@ -LIBRARY = SDL - -CC = kos32-gcc -AR = kos32-ar -LD = kos32-ld -STRIP = kos32-strip - -SDK_DIR:= $(abspath ../../..) - -endian_OBJS = endian/SDL_endian.o -file_OBJS = file/SDL_rwops.o -hermes_OBJS = hermes/mmxp2_32.o hermes/mmx_main.o hermes/x86p_16.o \ - hermes/x86p_32.o hermes/x86_main.o -thread_OBJS = thread/SDL_syscond.o thread/SDL_sysmutex.o thread/SDL_syssem.o \ - thread/SDL_systhread.o thread/SDL_thread.o -timer_OBJS = timer/SDL_timer.o timer/dummy/SDL_systimer.o -event_OBJS = events/SDL_active.o events/SDL_events.o events/SDL_expose.o \ - events/SDL_keyboard.o events/SDL_mouse.o events/SDL_quit.o \ - events/SDL_resize.o -video_OBJS = video/SDL_blit_0.o video/SDL_blit_1.o video/SDL_blit_A.o \ - video/SDL_blit.o video/SDL_blit_N.o video/SDL_bmp.o \ - video/SDL_cursor.o video/SDL_gamma.o video/SDL_pixels.o \ - video/SDL_RLEaccel.o video/SDL_stretch.o video/SDL_surface.o \ - video/SDL_video.o video/SDL_yuv.o video/SDL_yuv_mmx.o \ - video/SDL_yuv_sw.o video/menuetos/SDL_menuetevents.o \ - video/menuetos/SDL_menuetvideo.o -audio_OBJS = ../../sound/src/init.obj ../../sound/src/setbuf.obj \ - ../../sound/src/stopbuf.obj ../../sound/src/sndgetsize.obj audio/SDL_kolibri_audio.o - -curr_OBJS = SDL.o SDL_error.o SDL_fatal.o SDL_getenv.o - -OBJECTS = $(endian_OBJS) $(file_OBJS) $(hermes_OBJS) $(thread_OBJS) \ - $(timer_OBJS) $(event_OBJS) $(video_OBJS) $(curr_OBJS) $(audio_OBJS) - -CFLAGS = -c -O2 -D_REENTRANT -I../include -I. -DPACKAGE=\"SDL\" -DVERSION=\"1.2.2\" \ - -fexpensive-optimizations -Wall -DENABLE_AUDIO -UDISABLE_AUDIO -DDISABLE_JOYSTICK \ - -DDISABLE_CDROM -DDISABLE_THREADS -DENABLE_TIMERS \ - -DUSE_ASMBLIT -Ihermes -Iaudio -Ivideo -Ievents \ - -Ijoystick -Icdrom -Ithread -Itimer -Iendian -Ifile -DENABLE_MENUETOS \ - -DNO_SIGNAL_H -DDISABLE_STDIO -DNEED_SDL_GETENV -DENABLE_FILE -UDISABLE_FILE \ - -D__MENUETOS__ -DDEBUG_VIDEO -UWIN32 -U_Win32 -U_WIN32 -U__MINGW32__ - - -LDFLAGS = -shared -s -nostdlib -T../../newlib/dll.lds --entry _DllStartup --image-base=0 -# --image-base 0 -L/home/autobuild/tools/win32/mingw32/lib -lgcc /home/autobuild/tools/win32/lib/libz.a /home/autobuild/tools/win32/lib/libdll.a /home/autobuild/tools/win32/lib/libapp.a /home/autobuild/tools/win32/lib/libc.dll.a - -LDFLAGS+= --out-implib lib$(LIBRARY).dll.a - -ARFLAGS = crs - -INCLUDES= -I../../newlib/libc/include -I./include -I./include/freetype/config - -LIBPATH:= -L../../../lib -L/home/autobuild/tools/win32/mingw32/lib - -LIBS:= -ldll -lc.dll -lgcc - -#include $(MENUETDEV)/makefiles/Makefile_for_lib - -# all: libSDL.a - -# install: libSDL.a -# mv -f libSDL.a $(SDK_DIR)/lib - -# libSDL.a: $(OBJS) -# $(AR) $(ARFLAGS) libSDL.a - -# ../../sound/src/init.o : ../../sound/src/init.asm Makefile -# fasm ../../sound/src/init.asm ../../sound/src/init.o - -# ../../sound/src/setbuf.o : ../../sound/src/setbuf.asm Makefile -# fasm ../../sound/src/setbuf.asm ../../sound/src/setbuf.o - -# ../../sound/src/stopbuf.o : ../../sound/src/stopbuf.asm -# fasm ../../sound/src/stopbuf.asm ../../sound/src/stopbuf.o - -# ../../sound/src/sndgetsize.o : ../../sound/src/sndgetsize.asm -# fasm ../../sound/src/sndgetsize.asm ../../sound/src/sndgetsize.o - -%.o : %.asm Makefile - nasm -f win32 $< -o $@ - -%.obj : %.asm Makefile - fasm $< $@ - -# %.o : %.c Makefile -# $(CC) $(CFLAGS) -o $@ $< - -# clean: -# -rm -f */*.o - - -all:lib$(LIBRARY).a $(LIBRARY).dll - -lib$(LIBRARY).a: $(OBJECTS) Makefile - $(AR) cvrs lib$(LIBRARY).a $(OBJECTS) - mv -f lib$(LIBRARY).a ../../../lib - -$(LIBRARY).dll: $(OBJECTS) Makefile - $(warning "$(LD) $(LDFLAGS) $(LIBPATH) -o $@ $(OBJECTS) $(LIBS)") - $(LD) $(LDFLAGS) $(LIBPATH) -o $@ $(OBJECTS) $(LIBS) - $(STRIP) $@ - #sed -f ../newlib/cmd1.sed lib$(LIBRARY).def > mem - #sed -f ../newlib/cmd2.sed mem >$(LIBRARY).inc - mv -f $@ ../../../bin - mv -f lib$(LIBRARY).dll.a ../../../lib - - -%.o : %.c Makefile - $(CC) $(INCLUDES) $(CFLAGS) $(DEFINES) -o $@ $< - -clean: - rm -rf *.o - rm -rf */*.o - rm -f */*/*.o +OUTFILE = ../lib/libSDL.a + +endian_OBJS = endian/SDL_endian.o +file_OBJS = file/SDL_rwops.o +hermes_OBJS = hermes/mmxp2_32.o hermes/mmx_main.o hermes/x86p_16.o \ + hermes/x86p_32.o hermes/x86_main.o +thread_OBJS = thread/SDL_syscond.o thread/SDL_sysmutex.o thread/SDL_syssem.o \ + thread/SDL_systhread.o thread/SDL_thread.o +timer_OBJS = timer/SDL_timer.o timer/dummy/SDL_systimer.o +event_OBJS = events/SDL_active.o events/SDL_events.o events/SDL_expose.o \ + events/SDL_keyboard.o events/SDL_mouse.o events/SDL_quit.o \ + events/SDL_resize.o +video_OBJS = video/SDL_blit_0.o video/SDL_blit_1.o video/SDL_blit_A.o \ + video/SDL_blit.o video/SDL_blit_N.o video/SDL_bmp.o \ + video/SDL_cursor.o video/SDL_gamma.o video/SDL_pixels.o \ + video/SDL_RLEaccel.o video/SDL_stretch.o video/SDL_surface.o \ + video/SDL_video.o video/SDL_yuv.o video/SDL_yuv_mmx.o \ + video/SDL_yuv_sw.o video/menuetos/SDL_menuetevents.o \ + video/menuetos/SDL_menuetvideo.o +audio_OBJS = audio/SDL_kolibri_audio.o \ + audio/klbr_sdk/src/init.o audio/klbr_sdk/src/setbuf.o \ + audio/klbr_sdk/src/stopbuf.o audio/klbr_sdk/src/sndgetsize.o + +curr_OBJS = SDL.o SDL_error.o SDL_fatal.o SDL_getenv.o + +OBJS = $(endian_OBJS) $(file_OBJS) $(hermes_OBJS) $(thread_OBJS) \ + $(timer_OBJS) $(event_OBJS) $(video_OBJS) $(curr_OBJS) $(audio_OBJS) + +CFLAGS = -D_REENTRANT -I../include -I. -DPACKAGE=\"SDL\" -DVERSION=\"1.2.2\" \ + -fexpensive-optimizations -Wall -DENABLE_AUDIO -UDISABLE_AUDIO -DDISABLE_JOYSTICK \ + -DDISABLE_CDROM -DDISABLE_THREADS -DENABLE_TIMERS \ + -DUSE_ASMBLIT -Ihermes -Iaudio -Ivideo -Ievents \ + -Ijoystick -Icdrom -Ithread -Itimer -Iendian -Ifile -DENABLE_MENUETOS \ + -DNO_SIGNAL_H -DDISABLE_STDIO -DNEED_SDL_GETENV -DENABLE_FILE -UDISABLE_FILE \ + -D__MENUETOS__ -DDEBUG_VIDEO -UWIN32 + +include $(MENUETDEV)/makefiles/Makefile_for_lib + +audio/klbr_sdk/src/init.o : audio/klbr_sdk/src/init.asm + fasm audio/klbr_sdk/src/init.asm audio/klbr_sdk/src/init.o +audio/klbr_sdk/src/setbuf.o : audio/klbr_sdk/src/setbuf.asm + fasm audio/klbr_sdk/src/setbuf.asm audio/klbr_sdk/src/setbuf.o +audio/klbr_sdk/src/stopbuf.o : audio/klbr_sdk/src/stopbuf.asm + fasm audio/klbr_sdk/src/stopbuf.asm audio/klbr_sdk/src/stopbuf.o +audio/klbr_sdk/src/sndgetsize.o : audio/klbr_sdk/src/sndgetsize.asm + fasm audio/klbr_sdk/src/sndgetsize.asm audio/klbr_sdk/src/sndgetsize.o diff --git a/contrib/sdk/sources/SDL-1.2.2/src/SDL_fatal.c b/contrib/sdk/sources/SDL-1.2.2/src/SDL_fatal.c index 256d37322..17a32e065 100644 --- a/contrib/sdk/sources/SDL-1.2.2/src/SDL_fatal.c +++ b/contrib/sdk/sources/SDL-1.2.2/src/SDL_fatal.c @@ -30,7 +30,7 @@ void SDL_printf_error(const char * fmt,...) int pid; va_list args; va_start(args,fmt); - printf(fmt,args); + __libclog_vprintf(fmt,args); exit(-1); } diff --git a/contrib/sdk/sources/SDL-1.2.2/src/SDL_getenv.c b/contrib/sdk/sources/SDL-1.2.2/src/SDL_getenv.c index 859686d17..98ce19900 100644 --- a/contrib/sdk/sources/SDL-1.2.2/src/SDL_getenv.c +++ b/contrib/sdk/sources/SDL-1.2.2/src/SDL_getenv.c @@ -115,7 +115,7 @@ int main(int argc, char *argv[]) } printf("Setting FIRST=VALUE1 in the environment... "); fflush(stdout); - if ( sdlputenv("FIRST=VALUE1") == 0 ) { + if ( putenv("FIRST=VALUE1") == 0 ) { printf("okay\n"); } else { printf("failed\n"); @@ -130,7 +130,7 @@ int main(int argc, char *argv[]) } printf("Setting SECOND=VALUE2 in the environment... "); fflush(stdout); - if ( sdlputenv("SECOND=VALUE2") == 0 ) { + if ( putenv("SECOND=VALUE2") == 0 ) { printf("okay\n"); } else { printf("failed\n"); @@ -145,7 +145,7 @@ int main(int argc, char *argv[]) } printf("Setting FIRST=NOVALUE in the environment... "); fflush(stdout); - if ( sdlputenv("FIRST=NOVALUE") == 0 ) { + if ( putenv("FIRST=NOVALUE") == 0 ) { printf("okay\n"); } else { printf("failed\n"); diff --git a/contrib/sdk/sources/SDL-1.2.2/src/Tupfile.lua b/contrib/sdk/sources/SDL-1.2.2/src/Tupfile.lua index f4d60f426..7a3fa7425 100644 --- a/contrib/sdk/sources/SDL-1.2.2/src/Tupfile.lua +++ b/contrib/sdk/sources/SDL-1.2.2/src/Tupfile.lua @@ -1,8 +1,8 @@ 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_menuetlibc.lua") tup.include("../../../../../programs/use_sound.lua") -INCLUDES = INCLUDES .. " -I. -I../include -I../../newlib/libc/include/ -Ihermes -Iaudio -Ivideo -Ievents -Ijoystick -Icdrom -Ithread -Itimer -Iendian -Ifile" +INCLUDES = INCLUDES .. " -I. -I../include -Ihermes -Iaudio -Ivideo -Ievents -Ijoystick -Icdrom -Ithread -Itimer -Iendian -Ifile" 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' @@ -26,7 +26,7 @@ FOLDERS = { 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 win32 -o %o %f", v .. "%B.o") + tup.foreach_rule(v .. "*.asm", "nasm -f coff -o %o %f", v .. "%B.o") ) end tup.rule(OBJS, "kos32-ar rcs %o %f", {"../../../lib/libSDL.a", "../../../lib/"}) diff --git a/contrib/sdk/sources/SDL-1.2.2/src/audio/SDL_kolibri_audio.c b/contrib/sdk/sources/SDL-1.2.2/src/audio/SDL_kolibri_audio.c index afd4703e2..3b99fe5fa 100644 --- a/contrib/sdk/sources/SDL-1.2.2/src/audio/SDL_kolibri_audio.c +++ b/contrib/sdk/sources/SDL-1.2.2/src/audio/SDL_kolibri_audio.c @@ -1,11 +1,11 @@ #include "SDL_audio.h" -#include +#include #include #include #include #include -static void GetNotify(uint32_t* event) +static void GetNotify(__u32* event) { __asm__("int $0x40" :: "a"(68),"b"(14),"c"(event)); } @@ -36,9 +36,9 @@ static SNDBUF hBuff=0; static char* data=NULL; static int audio_tid=0; static int main_slot; -static uint32_t main_tid; +static __u32 main_tid; static char audio_thread_stack[40960]; -static uint32_t used_format=0; +static __u32 used_format=0; static volatile int mix_size=0; static void (*callback)(void* userdata, Uint8* stream, int len); @@ -81,20 +81,20 @@ static void audio_thread(void) { SDL_printf("audio_thread created\n"); int bPaused; - uint32_t event[6]; + __u32 event[6]; // initialize if (CreateBuffer(used_format|PCM_RING, 0, &hBuff)) { audio_response=1; - __asm__ __volatile__("int $0x40" ::"a"(-1)); + __menuet__sys_exit(); } GetBufferSize(hBuff, &mix_size); SDL_printf("buffer created, size is %d\n",mix_size); mix_size >>= 1; data = malloc(mix_size); audio_response=1; - if (!data) __asm__ __volatile__("int $0x40" ::"a"(-1)); - // wait for resume + if (!data) __menuet__sys_exit(); + // wait for resume while (audio_command!=AUDIO_RESUME) Yield(); // initialize @@ -130,19 +130,19 @@ static void audio_thread(void) audio_response = 1; StopBuffer(hBuff); DestroyBuffer(hBuff); - __asm__ __volatile__("int $0x40" ::"a"(-1)); - } + __menuet__sys_exit(); + } else { GetProcessInfo(main_slot); - if (pinfo[0x32]==9 || *(uint32_t*)(pinfo+0x1E)!=main_tid) + if (pinfo[0x32]==9 || *(__u32*)(pinfo+0x1E)!=main_tid) { audio_command = AUDIO_DIE; continue; } } if (bPaused) - delay(500); + __menuet__delay100(5); else { GetNotify(event); @@ -230,11 +230,11 @@ int SDL_OpenAudio(SDL_AudioSpec* desired, SDL_AudioSpec* obtained) callback=desired->callback; userdata=desired->userdata; GetProcessInfo(-1); - main_tid = *(uint32_t*)(pinfo+0x1E); + main_tid = *(__u32*)(pinfo+0x1E); for (main_slot=0;;main_slot++) { GetProcessInfo(main_slot); - if (pinfo[0x32]!=9 && *(uint32_t*)(pinfo+0x1E)==main_tid) + if (pinfo[0x32]!=9 && *(__u32*)(pinfo+0x1E)==main_tid) break; } audio_tid=CreateThread(audio_thread,audio_thread_stack+40960); diff --git a/contrib/sdk/sources/SDL-1.2.2/src/hermes/mmxp2_32.asm b/contrib/sdk/sources/SDL-1.2.2/src/hermes/mmxp2_32.asm index e8f226b19..552b48437 100644 --- a/contrib/sdk/sources/SDL-1.2.2/src/hermes/mmxp2_32.asm +++ b/contrib/sdk/sources/SDL-1.2.2/src/hermes/mmxp2_32.asm @@ -20,7 +20,7 @@ BITS 32 - + GLOBAL _ConvertMMXpII32_24RGB888 GLOBAL _ConvertMMXpII32_16RGB565 GLOBAL _ConvertMMXpII32_16BGR565 diff --git a/contrib/sdk/sources/SDL-1.2.2/src/hermes/x86_main.asm b/contrib/sdk/sources/SDL-1.2.2/src/hermes/x86_main.asm index 12aded56b..917a61572 100644 --- a/contrib/sdk/sources/SDL-1.2.2/src/hermes/x86_main.asm +++ b/contrib/sdk/sources/SDL-1.2.2/src/hermes/x86_main.asm @@ -10,12 +10,19 @@ ; BITS 32 - -SECTION .text ALIGN=16 - + GLOBAL _ConvertX86 GLOBAL _x86return + GLOBAL _Hermes_X86_CPU + + +SECTION .data + +cpu_flags dd 0 + + +SECTION .text ;; _ConvertX86: ;; [ESP+8] ConverterInfo* @@ -54,7 +61,7 @@ y_loop: jmp [ebp+32] -_x86return: +_x86return: add esi,[ebp+12] add edi,[ebp+28] @@ -117,8 +124,3 @@ _Hermes_X86_CPU: .L1: xor eax,eax ret - -section '.DATA' ALIGN=16 - -cpu_flags dd 0 - diff --git a/contrib/sdk/sources/SDL-1.2.2/src/timer/dummy/SDL_systimer.c b/contrib/sdk/sources/SDL-1.2.2/src/timer/dummy/SDL_systimer.c index 5c834ea41..4230b0651 100644 --- a/contrib/sdk/sources/SDL-1.2.2/src/timer/dummy/SDL_systimer.c +++ b/contrib/sdk/sources/SDL-1.2.2/src/timer/dummy/SDL_systimer.c @@ -31,7 +31,6 @@ static char rcsid = #include #include #include -#include #include "SDL_error.h" #include "SDL_timer.h" @@ -89,7 +88,7 @@ Uint32 SDL_GetTicks (void) void SDL_Delay (Uint32 ms) { -delay(ms * 100); + __menuet__delay100(ms); /* Uint32 start = SDL_GetTicks(); do __asm__("int $0x40" :: "a"(68),"b"(1)); diff --git a/contrib/sdk/sources/SDL-1.2.2/src/video/menuetos/SDL_menuetevents.c b/contrib/sdk/sources/SDL-1.2.2/src/video/menuetos/SDL_menuetevents.c index bdc54eff4..a4e94e89d 100644 --- a/contrib/sdk/sources/SDL-1.2.2/src/video/menuetos/SDL_menuetevents.c +++ b/contrib/sdk/sources/SDL-1.2.2/src/video/menuetos/SDL_menuetevents.c @@ -1,7 +1,6 @@ -#include +#include #include #include -#include #include "SDL.h" #include "SDL_sysevents.h" #include "SDL_sysvideo.h" @@ -162,29 +161,21 @@ void MenuetOS_PumpEvents(_THIS) int i; SDL_keysym key; static int ext_code=0; - static uint8_t old_mode=0; - + static __u8 old_mode=0; for (;;) { - i=check_os_event(); - unsigned int k; - - switch(i) - { + i=__menuet__check_for_event(); + switch(i) + { case 0: return; case 1: - MenuetOS_SDL_RepaintWnd(); break; - case 2: - __asm__ __volatile__("int $0x40":"=a"(k):"a"(2)); - key.scancode = (k >> 8) & 0xFF; - + key.scancode = __menuet__getkey(); if (key.scancode == 0xE0 || key.scancode == 0xE1) {ext_code=key.scancode;break;} - - if (ext_code == 0xE1 && (key.scancode & 0x7F) == 0x1D) { break;} + if (ext_code == 0xE1 && (key.scancode & 0x7F) == 0x1D) break; if (ext_code == 0xE1 && key.scancode == 0xC5) {ext_code=0;break;} key.mod = GetModState(); if (ext_code == 0xE1) key.mod &= ~KMOD_CTRL; @@ -207,7 +198,7 @@ void MenuetOS_PumpEvents(_THIS) SDL_PrivateKeyboard(code,&key); break; case 3: - if(get_os_button()==1) exit(0); + if(__menuet__get_button_id()==1) exit(0); break; case 6: { int __tmp,mx,my; diff --git a/contrib/sdk/sources/SDL-1.2.2/src/video/menuetos/SDL_menuetvideo.c b/contrib/sdk/sources/SDL-1.2.2/src/video/menuetos/SDL_menuetvideo.c index 3b11a061c..9a69457b3 100644 --- a/contrib/sdk/sources/SDL-1.2.2/src/video/menuetos/SDL_menuetvideo.c +++ b/contrib/sdk/sources/SDL-1.2.2/src/video/menuetos/SDL_menuetvideo.c @@ -1,6 +1,6 @@ #include #include -#include +#include #include "SDL.h" #include "SDL_error.h" #include "SDL_video.h" @@ -11,25 +11,6 @@ #include "SDL_menuetvideo.h" #include -struct process_table_entry -{ - uint32_t cpu_usage; - uint16_t pos_in_windowing_stack; - uint16_t win_stack_val_at_ecx; - uint16_t reserved1; - char name[12]; - uint32_t memstart; - uint32_t memused; - uint32_t pid; - uint32_t winx_start,winy_start; - uint32_t winx_size,winy_size; - uint16_t thread_state; - uint16_t reserved2; - uint32_t client_left,client_top,client_width,client_height; - uint8_t window_state; - uint8_t reserved3[1024-71]; -}; - static SDL_VideoDevice * vm_suf=NULL; static int was_initialized=0; @@ -51,15 +32,22 @@ static int IsStyle4Available=0; void MenuetOS_SDL_RepaintWnd(void) { - begin_draw(); - sys_create_window(1,1,vm_suf->hidden->win_size_x+9,vm_suf->hidden->win_size_y+get_skinh()+4, (int)vm_suf->hidden->__title, 0x000000,0x34000000); + __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, +#ifdef KEEP_OBSOLETE_STYLE3 + IsStyle4Available?0x34000000:0x33000000 +#else + 0x34000000 +#endif + ,0,(int)vm_suf->hidden->__title); + + // __asm__ __volatile__("int3"); if(vm_suf && vm_suf->hidden->__video_buffer) - put_image(1,1, + __menuet__putimage(0,0, vm_suf->hidden->win_size_x,vm_suf->hidden->win_size_y, vm_suf->hidden->__video_buffer); - - end_draw(); + __menuet__window_redraw(2); } static int MenuetOS_AllocHWSurface(_THIS,SDL_Surface * surface) @@ -84,7 +72,7 @@ static void MenuetOS_DirectUpdate(_THIS,int numrects,SDL_Rect * rects) { if(numrects) { - put_image(1,1, + __menuet__putimage(0,0, vm_suf->hidden->win_size_x,vm_suf->hidden->win_size_y, this->hidden->__video_buffer); } @@ -123,12 +111,33 @@ SDL_Surface * MenuetOS_SetVideoMode(_THIS, SDL_Surface *current, int width, int current->w=width; current->h=height; current->pitch=width*(bpp>>3); + + char info[100]; + sprintf(info, "width = %d, height = %d, pitch = %d, bpp = %d\n", current->w, current->h, current->pitch, bpp); + + void debug_board_write_byte(const char ch){ + __asm__ __volatile__( + "int $0x40" + : + :"a"(63), "b"(1), "c"(ch)); + } + + void debug_board_write_str(const char* str){ + while(*str) + debug_board_write_byte(*str++); + } + + debug_board_write_str(info); + // __asm__ __volatile__("int3"); + current->pixels=this->hidden->__video_buffer=realloc(this->hidden->__video_buffer, current->pitch*current->h); this->hidden->__lines=(unsigned char **)realloc(this->hidden->__lines, sizeof(unsigned char *)*current->h); + for(ly=0,lx=current->pixels;lyh;ly++,lx+=current->pitch) - this->hidden->__lines[ly]=lx; + this->hidden->__lines[ly]=lx; + this->UpdateRects=MenuetOS_DirectUpdate; this->hidden->win_size_x=width; this->hidden->win_size_y=height; @@ -141,7 +150,7 @@ SDL_Surface * MenuetOS_SetVideoMode(_THIS, SDL_Surface *current, int width, int } else { - set_wanted_events_mask(0x27); + __menuet__set_bitfield_for_wanted_events(0x27); was_initialized=1; MenuetOS_SDL_RepaintWnd(); } @@ -209,7 +218,8 @@ static int MenuetOS_VideoInit(_THIS,SDL_PixelFormat * vformat) static int MenuetOS_FlipHWSurface(_THIS,SDL_Surface * surface) { - put_image(1,1,surface->w,surface->h, surface->pixels); + __menuet__putimage(0,0,surface->w,surface->h, + surface->pixels); return 0; }