mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-25 08:06:49 +03:00
Port libSDL from Menuetlibc to Newlib
git-svn-id: svn://kolibrios.org@6347 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
2a90425400
commit
7199ee861f
@ -1,46 +1,67 @@
|
||||
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
|
||||
CC = kos32-gcc
|
||||
AR = kos32-ar
|
||||
LD = kos32-ld
|
||||
|
||||
SDK_DIR:= $(abspath ../../..)
|
||||
|
||||
endian_OBJS = endian/SDL_endian.o
|
||||
file_OBJS = file/SDL_rwops.o
|
||||
hermes_OBJS = hermes/mmxp2_32.obj hermes/mmx_main.obj hermes/x86p_16.obj \
|
||||
hermes/x86p_32.obj hermes/x86_main.obj
|
||||
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 = -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__ \
|
||||
-I../../newlib/libc/include/
|
||||
|
||||
|
||||
LDFLAGS = -shared -s -T../../newlib/libc/app.lds -nostdlib --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
|
||||
|
||||
ARFLAGS = crs
|
||||
|
||||
#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
|
||||
|
||||
%.obj : %.asm Makefile
|
||||
nasm -f coff $< $
|
||||
|
||||
%.o : %.c Makefile
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
clean:
|
||||
-rm -f */*.o
|
||||
|
||||
|
||||
|
@ -115,7 +115,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
printf("Setting FIRST=VALUE1 in the environment... ");
|
||||
fflush(stdout);
|
||||
if ( putenv("FIRST=VALUE1") == 0 ) {
|
||||
if ( sdlputenv("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 ( putenv("SECOND=VALUE2") == 0 ) {
|
||||
if ( sdlputenv("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 ( putenv("FIRST=NOVALUE") == 0 ) {
|
||||
if ( sdlputenv("FIRST=NOVALUE") == 0 ) {
|
||||
printf("okay\n");
|
||||
} else {
|
||||
printf("failed\n");
|
||||
|
@ -1,11 +1,11 @@
|
||||
#include "SDL_audio.h"
|
||||
#include <menuet/os.h>
|
||||
#include <kos32sys.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sound.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static void GetNotify(__u32* event)
|
||||
static void GetNotify(uint32_t* 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 __u32 main_tid;
|
||||
static uint32_t main_tid;
|
||||
static char audio_thread_stack[40960];
|
||||
static __u32 used_format=0;
|
||||
static uint32_t 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;
|
||||
__u32 event[6];
|
||||
uint32_t event[6];
|
||||
// initialize
|
||||
if (CreateBuffer(used_format|PCM_RING, 0, &hBuff))
|
||||
{
|
||||
audio_response=1;
|
||||
__menuet__sys_exit();
|
||||
__asm__ __volatile__("int $0x40" ::"a"(-1));
|
||||
}
|
||||
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) __menuet__sys_exit();
|
||||
// wait for resume
|
||||
if (!data) __asm__ __volatile__("int $0x40" ::"a"(-1));
|
||||
// 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);
|
||||
__menuet__sys_exit();
|
||||
}
|
||||
__asm__ __volatile__("int $0x40" ::"a"(-1));
|
||||
}
|
||||
else
|
||||
{
|
||||
GetProcessInfo(main_slot);
|
||||
if (pinfo[0x32]==9 || *(__u32*)(pinfo+0x1E)!=main_tid)
|
||||
if (pinfo[0x32]==9 || *(uint32_t*)(pinfo+0x1E)!=main_tid)
|
||||
{
|
||||
audio_command = AUDIO_DIE;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (bPaused)
|
||||
__menuet__delay100(5);
|
||||
delay(500);
|
||||
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 = *(__u32*)(pinfo+0x1E);
|
||||
main_tid = *(uint32_t*)(pinfo+0x1E);
|
||||
for (main_slot=0;;main_slot++)
|
||||
{
|
||||
GetProcessInfo(main_slot);
|
||||
if (pinfo[0x32]!=9 && *(__u32*)(pinfo+0x1E)==main_tid)
|
||||
if (pinfo[0x32]!=9 && *(uint32_t*)(pinfo+0x1E)==main_tid)
|
||||
break;
|
||||
}
|
||||
audio_tid=CreateThread(audio_thread,audio_thread_stack+40960);
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
BITS 32
|
||||
|
||||
|
||||
|
||||
GLOBAL _ConvertMMXpII32_24RGB888
|
||||
GLOBAL _ConvertMMXpII32_16RGB565
|
||||
GLOBAL _ConvertMMXpII32_16BGR565
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include<menuet/os.h>
|
||||
#include<kos32sys.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include "SDL.h"
|
||||
#include "SDL_sysevents.h"
|
||||
#include "SDL_sysvideo.h"
|
||||
@ -161,9 +162,9 @@ void MenuetOS_PumpEvents(_THIS)
|
||||
int i;
|
||||
SDL_keysym key;
|
||||
static int ext_code=0;
|
||||
static __u8 old_mode=0;
|
||||
static uint8_t old_mode=0;
|
||||
for (;;) {
|
||||
i=__menuet__check_for_event();
|
||||
i=check_os_event();
|
||||
switch(i)
|
||||
{
|
||||
case 0:
|
||||
@ -172,7 +173,7 @@ void MenuetOS_PumpEvents(_THIS)
|
||||
MenuetOS_SDL_RepaintWnd();
|
||||
break;
|
||||
case 2:
|
||||
key.scancode = __menuet__getkey();
|
||||
key.scancode = get_key;
|
||||
if (key.scancode == 0xE0 || key.scancode == 0xE1)
|
||||
{ext_code=key.scancode;break;}
|
||||
if (ext_code == 0xE1 && (key.scancode & 0x7F) == 0x1D) break;
|
||||
@ -198,7 +199,7 @@ void MenuetOS_PumpEvents(_THIS)
|
||||
SDL_PrivateKeyboard(code,&key);
|
||||
break;
|
||||
case 3:
|
||||
if(__menuet__get_button_id()==1) exit(0);
|
||||
if(get_os_button()==1) exit(0);
|
||||
break;
|
||||
case 6: {
|
||||
int __tmp,mx,my;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <menuet/os.h>
|
||||
#include <kos32sys.h>
|
||||
#include "SDL.h"
|
||||
#include "SDL_error.h"
|
||||
#include "SDL_video.h"
|
||||
@ -11,6 +11,25 @@
|
||||
#include "SDL_menuetvideo.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 int was_initialized=0;
|
||||
|
||||
@ -32,8 +51,8 @@ static int IsStyle4Available=0;
|
||||
|
||||
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();
|
||||
sys_create_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
|
||||
@ -41,10 +60,11 @@ void MenuetOS_SDL_RepaintWnd(void)
|
||||
#endif
|
||||
,0,(int)vm_suf->hidden->__title);
|
||||
if(vm_suf && vm_suf->hidden->__video_buffer)
|
||||
__menuet__putimage(0,0,
|
||||
put_image(0,0,
|
||||
vm_suf->hidden->win_size_x,vm_suf->hidden->win_size_y,
|
||||
vm_suf->hidden->__video_buffer);
|
||||
__menuet__window_redraw(2);
|
||||
|
||||
begin_draw();;
|
||||
}
|
||||
|
||||
static int MenuetOS_AllocHWSurface(_THIS,SDL_Surface * surface)
|
||||
@ -69,7 +89,7 @@ static void MenuetOS_DirectUpdate(_THIS,int numrects,SDL_Rect * rects)
|
||||
{
|
||||
if(numrects)
|
||||
{
|
||||
__menuet__putimage(0,0,
|
||||
put_image(0,0,
|
||||
vm_suf->hidden->win_size_x,vm_suf->hidden->win_size_y,
|
||||
this->hidden->__video_buffer);
|
||||
}
|
||||
@ -126,7 +146,7 @@ SDL_Surface * MenuetOS_SetVideoMode(_THIS, SDL_Surface *current, int width, int
|
||||
}
|
||||
else
|
||||
{
|
||||
__menuet__set_bitfield_for_wanted_events(0x27);
|
||||
set_wanted_events_mask(0x27);
|
||||
was_initialized=1;
|
||||
MenuetOS_SDL_RepaintWnd();
|
||||
}
|
||||
@ -194,8 +214,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);
|
||||
put_image(0,0,surface->w,surface->h, surface->pixels);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user