Revert SDL to menuetlibc

git-svn-id: svn://kolibrios.org@6386 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
ashmew2 2016-03-30 22:39:02 +00:00
parent 410b1a3707
commit 10ba3b881d
11 changed files with 128 additions and 194 deletions

View File

@ -15,7 +15,7 @@ extern "C" {
/* Put a variable of the form "name=value" into the environment */ /* Put a variable of the form "name=value" into the environment */
extern DECLSPEC int SDL_putenv(const char *variable); 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 */ /* Retrieve a variable named "name" from the environment */
extern DECLSPEC char *SDL_getenv(const char *name); extern DECLSPEC char *SDL_getenv(const char *name);

View File

@ -1,114 +1,46 @@
LIBRARY = SDL OUTFILE = ../lib/libSDL.a
CC = kos32-gcc endian_OBJS = endian/SDL_endian.o
AR = kos32-ar file_OBJS = file/SDL_rwops.o
LD = kos32-ld hermes_OBJS = hermes/mmxp2_32.o hermes/mmx_main.o hermes/x86p_16.o \
STRIP = kos32-strip hermes/x86p_32.o hermes/x86_main.o
thread_OBJS = thread/SDL_syscond.o thread/SDL_sysmutex.o thread/SDL_syssem.o \
SDK_DIR:= $(abspath ../../..) thread/SDL_systhread.o thread/SDL_thread.o
timer_OBJS = timer/SDL_timer.o timer/dummy/SDL_systimer.o
endian_OBJS = endian/SDL_endian.o event_OBJS = events/SDL_active.o events/SDL_events.o events/SDL_expose.o \
file_OBJS = file/SDL_rwops.o events/SDL_keyboard.o events/SDL_mouse.o events/SDL_quit.o \
hermes_OBJS = hermes/mmxp2_32.o hermes/mmx_main.o hermes/x86p_16.o \ events/SDL_resize.o
hermes/x86p_32.o hermes/x86_main.o video_OBJS = video/SDL_blit_0.o video/SDL_blit_1.o video/SDL_blit_A.o \
thread_OBJS = thread/SDL_syscond.o thread/SDL_sysmutex.o thread/SDL_syssem.o \ video/SDL_blit.o video/SDL_blit_N.o video/SDL_bmp.o \
thread/SDL_systhread.o thread/SDL_thread.o video/SDL_cursor.o video/SDL_gamma.o video/SDL_pixels.o \
timer_OBJS = timer/SDL_timer.o timer/dummy/SDL_systimer.o video/SDL_RLEaccel.o video/SDL_stretch.o video/SDL_surface.o \
event_OBJS = events/SDL_active.o events/SDL_events.o events/SDL_expose.o \ video/SDL_video.o video/SDL_yuv.o video/SDL_yuv_mmx.o \
events/SDL_keyboard.o events/SDL_mouse.o events/SDL_quit.o \ video/SDL_yuv_sw.o video/menuetos/SDL_menuetevents.o \
events/SDL_resize.o video/menuetos/SDL_menuetvideo.o
video_OBJS = video/SDL_blit_0.o video/SDL_blit_1.o video/SDL_blit_A.o \ audio_OBJS = audio/SDL_kolibri_audio.o \
video/SDL_blit.o video/SDL_blit_N.o video/SDL_bmp.o \ audio/klbr_sdk/src/init.o audio/klbr_sdk/src/setbuf.o \
video/SDL_cursor.o video/SDL_gamma.o video/SDL_pixels.o \ audio/klbr_sdk/src/stopbuf.o audio/klbr_sdk/src/sndgetsize.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 \ curr_OBJS = SDL.o SDL_error.o SDL_fatal.o SDL_getenv.o
video/SDL_yuv_sw.o video/menuetos/SDL_menuetevents.o \
video/menuetos/SDL_menuetvideo.o OBJS = $(endian_OBJS) $(file_OBJS) $(hermes_OBJS) $(thread_OBJS) \
audio_OBJS = ../../sound/src/init.obj ../../sound/src/setbuf.obj \ $(timer_OBJS) $(event_OBJS) $(video_OBJS) $(curr_OBJS) $(audio_OBJS)
../../sound/src/stopbuf.obj ../../sound/src/sndgetsize.obj audio/SDL_kolibri_audio.o
CFLAGS = -D_REENTRANT -I../include -I. -DPACKAGE=\"SDL\" -DVERSION=\"1.2.2\" \
curr_OBJS = SDL.o SDL_error.o SDL_fatal.o SDL_getenv.o -fexpensive-optimizations -Wall -DENABLE_AUDIO -UDISABLE_AUDIO -DDISABLE_JOYSTICK \
-DDISABLE_CDROM -DDISABLE_THREADS -DENABLE_TIMERS \
OBJECTS = $(endian_OBJS) $(file_OBJS) $(hermes_OBJS) $(thread_OBJS) \ -DUSE_ASMBLIT -Ihermes -Iaudio -Ivideo -Ievents \
$(timer_OBJS) $(event_OBJS) $(video_OBJS) $(curr_OBJS) $(audio_OBJS) -Ijoystick -Icdrom -Ithread -Itimer -Iendian -Ifile -DENABLE_MENUETOS \
-DNO_SIGNAL_H -DDISABLE_STDIO -DNEED_SDL_GETENV -DENABLE_FILE -UDISABLE_FILE \
CFLAGS = -c -O2 -D_REENTRANT -I../include -I. -DPACKAGE=\"SDL\" -DVERSION=\"1.2.2\" \ -D__MENUETOS__ -DDEBUG_VIDEO -UWIN32
-fexpensive-optimizations -Wall -DENABLE_AUDIO -UDISABLE_AUDIO -DDISABLE_JOYSTICK \
-DDISABLE_CDROM -DDISABLE_THREADS -DENABLE_TIMERS \ include $(MENUETDEV)/makefiles/Makefile_for_lib
-DUSE_ASMBLIT -Ihermes -Iaudio -Ivideo -Ievents \
-Ijoystick -Icdrom -Ithread -Itimer -Iendian -Ifile -DENABLE_MENUETOS \ audio/klbr_sdk/src/init.o : audio/klbr_sdk/src/init.asm
-DNO_SIGNAL_H -DDISABLE_STDIO -DNEED_SDL_GETENV -DENABLE_FILE -UDISABLE_FILE \ fasm audio/klbr_sdk/src/init.asm audio/klbr_sdk/src/init.o
-D__MENUETOS__ -DDEBUG_VIDEO -UWIN32 -U_Win32 -U_WIN32 -U__MINGW32__ 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
LDFLAGS = -shared -s -nostdlib -T../../newlib/dll.lds --entry _DllStartup --image-base=0 fasm audio/klbr_sdk/src/stopbuf.asm audio/klbr_sdk/src/stopbuf.o
# --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 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
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

View File

@ -30,7 +30,7 @@ void SDL_printf_error(const char * fmt,...)
int pid; int pid;
va_list args; va_list args;
va_start(args,fmt); va_start(args,fmt);
printf(fmt,args); __libclog_vprintf(fmt,args);
exit(-1); exit(-1);
} }

View File

@ -115,7 +115,7 @@ int main(int argc, char *argv[])
} }
printf("Setting FIRST=VALUE1 in the environment... "); printf("Setting FIRST=VALUE1 in the environment... ");
fflush(stdout); fflush(stdout);
if ( sdlputenv("FIRST=VALUE1") == 0 ) { if ( putenv("FIRST=VALUE1") == 0 ) {
printf("okay\n"); printf("okay\n");
} else { } else {
printf("failed\n"); printf("failed\n");
@ -130,7 +130,7 @@ int main(int argc, char *argv[])
} }
printf("Setting SECOND=VALUE2 in the environment... "); printf("Setting SECOND=VALUE2 in the environment... ");
fflush(stdout); fflush(stdout);
if ( sdlputenv("SECOND=VALUE2") == 0 ) { if ( putenv("SECOND=VALUE2") == 0 ) {
printf("okay\n"); printf("okay\n");
} else { } else {
printf("failed\n"); printf("failed\n");
@ -145,7 +145,7 @@ int main(int argc, char *argv[])
} }
printf("Setting FIRST=NOVALUE in the environment... "); printf("Setting FIRST=NOVALUE in the environment... ");
fflush(stdout); fflush(stdout);
if ( sdlputenv("FIRST=NOVALUE") == 0 ) { if ( putenv("FIRST=NOVALUE") == 0 ) {
printf("okay\n"); printf("okay\n");
} else { } else {
printf("failed\n"); printf("failed\n");

View File

@ -1,8 +1,8 @@
if tup.getconfig("NO_GCC") ~= "" or tup.getconfig("NO_NASM") ~= "" then return end if tup.getconfig("NO_GCC") ~= "" or tup.getconfig("NO_NASM") ~= "" then return end
tup.include("../../../../../programs/use_gcc.lua") tup.include("../../../../../programs/use_gcc.lua")
tup.include("../../../../../programs/use_newlib.lua") tup.include("../../../../../programs/use_menuetlibc.lua")
tup.include("../../../../../programs/use_sound.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 .. ' -D_REENTRANT -DPACKAGE=\"SDL\" -DVERSION=\"1.2.2\"'
CFLAGS = CFLAGS .. ' -DENABLE_AUDIO -UDISABLE_AUDIO -DDISABLE_JOYSTICK' CFLAGS = CFLAGS .. ' -DENABLE_AUDIO -UDISABLE_AUDIO -DDISABLE_JOYSTICK'
CFLAGS = CFLAGS .. ' -DDISABLE_CDROM -DDISABLE_THREADS -DENABLE_TIMERS' CFLAGS = CFLAGS .. ' -DDISABLE_CDROM -DDISABLE_THREADS -DENABLE_TIMERS'
@ -26,7 +26,7 @@ FOLDERS = {
for i,v in ipairs(FOLDERS) do for i,v in ipairs(FOLDERS) do
compile_gcc(v .. "*.c", v .. "%B.o") compile_gcc(v .. "*.c", v .. "%B.o")
tup.append_table(OBJS, 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 end
tup.rule(OBJS, "kos32-ar rcs %o %f", {"../../../lib/libSDL.a", "../../../lib/<libSDL>"}) tup.rule(OBJS, "kos32-ar rcs %o %f", {"../../../lib/libSDL.a", "../../../lib/<libSDL>"})

View File

@ -1,11 +1,11 @@
#include "SDL_audio.h" #include "SDL_audio.h"
#include <kos32sys.h> #include <menuet/os.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sound.h> #include <sound.h>
#include <stdio.h> #include <stdio.h>
static void GetNotify(uint32_t* event) static void GetNotify(__u32* event)
{ {
__asm__("int $0x40" :: "a"(68),"b"(14),"c"(event)); __asm__("int $0x40" :: "a"(68),"b"(14),"c"(event));
} }
@ -36,9 +36,9 @@ static SNDBUF hBuff=0;
static char* data=NULL; static char* data=NULL;
static int audio_tid=0; static int audio_tid=0;
static int main_slot; static int main_slot;
static uint32_t main_tid; static __u32 main_tid;
static char audio_thread_stack[40960]; static char audio_thread_stack[40960];
static uint32_t used_format=0; static __u32 used_format=0;
static volatile int mix_size=0; static volatile int mix_size=0;
static void (*callback)(void* userdata, Uint8* stream, int len); static void (*callback)(void* userdata, Uint8* stream, int len);
@ -81,20 +81,20 @@ static void audio_thread(void)
{ {
SDL_printf("audio_thread created\n"); SDL_printf("audio_thread created\n");
int bPaused; int bPaused;
uint32_t event[6]; __u32 event[6];
// initialize // initialize
if (CreateBuffer(used_format|PCM_RING, 0, &hBuff)) if (CreateBuffer(used_format|PCM_RING, 0, &hBuff))
{ {
audio_response=1; audio_response=1;
__asm__ __volatile__("int $0x40" ::"a"(-1)); __menuet__sys_exit();
} }
GetBufferSize(hBuff, &mix_size); GetBufferSize(hBuff, &mix_size);
SDL_printf("buffer created, size is %d\n",mix_size); SDL_printf("buffer created, size is %d\n",mix_size);
mix_size >>= 1; mix_size >>= 1;
data = malloc(mix_size); data = malloc(mix_size);
audio_response=1; audio_response=1;
if (!data) __asm__ __volatile__("int $0x40" ::"a"(-1)); if (!data) __menuet__sys_exit();
// wait for resume // wait for resume
while (audio_command!=AUDIO_RESUME) while (audio_command!=AUDIO_RESUME)
Yield(); Yield();
// initialize // initialize
@ -130,19 +130,19 @@ static void audio_thread(void)
audio_response = 1; audio_response = 1;
StopBuffer(hBuff); StopBuffer(hBuff);
DestroyBuffer(hBuff); DestroyBuffer(hBuff);
__asm__ __volatile__("int $0x40" ::"a"(-1)); __menuet__sys_exit();
} }
else else
{ {
GetProcessInfo(main_slot); 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; audio_command = AUDIO_DIE;
continue; continue;
} }
} }
if (bPaused) if (bPaused)
delay(500); __menuet__delay100(5);
else else
{ {
GetNotify(event); GetNotify(event);
@ -230,11 +230,11 @@ int SDL_OpenAudio(SDL_AudioSpec* desired, SDL_AudioSpec* obtained)
callback=desired->callback; callback=desired->callback;
userdata=desired->userdata; userdata=desired->userdata;
GetProcessInfo(-1); GetProcessInfo(-1);
main_tid = *(uint32_t*)(pinfo+0x1E); main_tid = *(__u32*)(pinfo+0x1E);
for (main_slot=0;;main_slot++) for (main_slot=0;;main_slot++)
{ {
GetProcessInfo(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; break;
} }
audio_tid=CreateThread(audio_thread,audio_thread_stack+40960); audio_tid=CreateThread(audio_thread,audio_thread_stack+40960);

View File

@ -20,7 +20,7 @@
BITS 32 BITS 32
GLOBAL _ConvertMMXpII32_24RGB888 GLOBAL _ConvertMMXpII32_24RGB888
GLOBAL _ConvertMMXpII32_16RGB565 GLOBAL _ConvertMMXpII32_16RGB565
GLOBAL _ConvertMMXpII32_16BGR565 GLOBAL _ConvertMMXpII32_16BGR565

View File

@ -10,12 +10,19 @@
; ;
BITS 32 BITS 32
SECTION .text ALIGN=16
GLOBAL _ConvertX86 GLOBAL _ConvertX86
GLOBAL _x86return GLOBAL _x86return
GLOBAL _Hermes_X86_CPU GLOBAL _Hermes_X86_CPU
SECTION .data
cpu_flags dd 0
SECTION .text
;; _ConvertX86: ;; _ConvertX86:
;; [ESP+8] ConverterInfo* ;; [ESP+8] ConverterInfo*
@ -54,7 +61,7 @@ y_loop:
jmp [ebp+32] jmp [ebp+32]
_x86return: _x86return:
add esi,[ebp+12] add esi,[ebp+12]
add edi,[ebp+28] add edi,[ebp+28]
@ -117,8 +124,3 @@ _Hermes_X86_CPU:
.L1: .L1:
xor eax,eax xor eax,eax
ret ret
section '.DATA' ALIGN=16
cpu_flags dd 0

View File

@ -31,7 +31,6 @@ static char rcsid =
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include <kos32sys.h>
#include "SDL_error.h" #include "SDL_error.h"
#include "SDL_timer.h" #include "SDL_timer.h"
@ -89,7 +88,7 @@ Uint32 SDL_GetTicks (void)
void SDL_Delay (Uint32 ms) void SDL_Delay (Uint32 ms)
{ {
delay(ms * 100); __menuet__delay100(ms);
/* Uint32 start = SDL_GetTicks(); /* Uint32 start = SDL_GetTicks();
do do
__asm__("int $0x40" :: "a"(68),"b"(1)); __asm__("int $0x40" :: "a"(68),"b"(1));

View File

@ -1,7 +1,6 @@
#include <kos32sys.h> #include<menuet/os.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <sys/types.h>
#include "SDL.h" #include "SDL.h"
#include "SDL_sysevents.h" #include "SDL_sysevents.h"
#include "SDL_sysvideo.h" #include "SDL_sysvideo.h"
@ -162,29 +161,21 @@ void MenuetOS_PumpEvents(_THIS)
int i; int i;
SDL_keysym key; SDL_keysym key;
static int ext_code=0; static int ext_code=0;
static uint8_t old_mode=0; static __u8 old_mode=0;
for (;;) { for (;;) {
i=check_os_event(); i=__menuet__check_for_event();
unsigned int k; switch(i)
{
switch(i)
{
case 0: case 0:
return; return;
case 1: case 1:
MenuetOS_SDL_RepaintWnd(); MenuetOS_SDL_RepaintWnd();
break; break;
case 2: case 2:
__asm__ __volatile__("int $0x40":"=a"(k):"a"(2)); key.scancode = __menuet__getkey();
key.scancode = (k >> 8) & 0xFF;
if (key.scancode == 0xE0 || key.scancode == 0xE1) if (key.scancode == 0xE0 || key.scancode == 0xE1)
{ext_code=key.scancode;break;} {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;} if (ext_code == 0xE1 && key.scancode == 0xC5) {ext_code=0;break;}
key.mod = GetModState(); key.mod = GetModState();
if (ext_code == 0xE1) key.mod &= ~KMOD_CTRL; if (ext_code == 0xE1) key.mod &= ~KMOD_CTRL;
@ -207,7 +198,7 @@ void MenuetOS_PumpEvents(_THIS)
SDL_PrivateKeyboard(code,&key); SDL_PrivateKeyboard(code,&key);
break; break;
case 3: case 3:
if(get_os_button()==1) exit(0); if(__menuet__get_button_id()==1) exit(0);
break; break;
case 6: { case 6: {
int __tmp,mx,my; int __tmp,mx,my;

View File

@ -1,6 +1,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <kos32sys.h> #include <menuet/os.h>
#include "SDL.h" #include "SDL.h"
#include "SDL_error.h" #include "SDL_error.h"
#include "SDL_video.h" #include "SDL_video.h"
@ -11,25 +11,6 @@
#include "SDL_menuetvideo.h" #include "SDL_menuetvideo.h"
#include <string.h> #include <string.h>
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 SDL_VideoDevice * vm_suf=NULL;
static int was_initialized=0; static int was_initialized=0;
@ -51,15 +32,22 @@ static int IsStyle4Available=0;
void MenuetOS_SDL_RepaintWnd(void) void MenuetOS_SDL_RepaintWnd(void)
{ {
begin_draw(); __menuet__window_redraw(1);
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__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) 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->win_size_x,vm_suf->hidden->win_size_y,
vm_suf->hidden->__video_buffer); vm_suf->hidden->__video_buffer);
__menuet__window_redraw(2);
end_draw();
} }
static int MenuetOS_AllocHWSurface(_THIS,SDL_Surface * surface) static int MenuetOS_AllocHWSurface(_THIS,SDL_Surface * surface)
@ -84,7 +72,7 @@ static void MenuetOS_DirectUpdate(_THIS,int numrects,SDL_Rect * rects)
{ {
if(numrects) if(numrects)
{ {
put_image(1,1, __menuet__putimage(0,0,
vm_suf->hidden->win_size_x,vm_suf->hidden->win_size_y, vm_suf->hidden->win_size_x,vm_suf->hidden->win_size_y,
this->hidden->__video_buffer); this->hidden->__video_buffer);
} }
@ -123,12 +111,33 @@ SDL_Surface * MenuetOS_SetVideoMode(_THIS, SDL_Surface *current, int width, int
current->w=width; current->w=width;
current->h=height; current->h=height;
current->pitch=width*(bpp>>3); 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->pixels=this->hidden->__video_buffer=realloc(this->hidden->__video_buffer,
current->pitch*current->h); current->pitch*current->h);
this->hidden->__lines=(unsigned char **)realloc(this->hidden->__lines, this->hidden->__lines=(unsigned char **)realloc(this->hidden->__lines,
sizeof(unsigned char *)*current->h); sizeof(unsigned char *)*current->h);
for(ly=0,lx=current->pixels;ly<current->h;ly++,lx+=current->pitch) for(ly=0,lx=current->pixels;ly<current->h;ly++,lx+=current->pitch)
this->hidden->__lines[ly]=lx; this->hidden->__lines[ly]=lx;
this->UpdateRects=MenuetOS_DirectUpdate; this->UpdateRects=MenuetOS_DirectUpdate;
this->hidden->win_size_x=width; this->hidden->win_size_x=width;
this->hidden->win_size_y=height; this->hidden->win_size_y=height;
@ -141,7 +150,7 @@ SDL_Surface * MenuetOS_SetVideoMode(_THIS, SDL_Surface *current, int width, int
} }
else else
{ {
set_wanted_events_mask(0x27); __menuet__set_bitfield_for_wanted_events(0x27);
was_initialized=1; was_initialized=1;
MenuetOS_SDL_RepaintWnd(); MenuetOS_SDL_RepaintWnd();
} }
@ -209,7 +218,8 @@ static int MenuetOS_VideoInit(_THIS,SDL_PixelFormat * vformat)
static int MenuetOS_FlipHWSurface(_THIS,SDL_Surface * surface) 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; return 0;
} }