SDL:
- Fixed SDL_Delay. - Refactoring git-svn-id: svn://kolibrios.org@9211 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
5410543f49
commit
d26508bea9
@ -9,6 +9,7 @@ typedef unsigned char __u8;
|
||||
typedef unsigned short __u16;
|
||||
typedef unsigned long __u32;
|
||||
|
||||
#pragma pack(push)
|
||||
struct process_table_entry
|
||||
{
|
||||
__u32 cpu_usage;
|
||||
@ -28,6 +29,15 @@ struct process_table_entry
|
||||
__u8 reserved3[1024-71];
|
||||
};
|
||||
|
||||
typedef union{
|
||||
unsigned val;
|
||||
struct{
|
||||
short h;
|
||||
short w;
|
||||
};
|
||||
}__kos__screen_t;
|
||||
#pragma pack(pop)
|
||||
|
||||
static inline
|
||||
void __kos__define_window(__u16 x1,__u16 y1,__u16 xsize,__u16 ysize,
|
||||
__u32 body_color,__u32 grab_color,__u32 frame_color)
|
||||
@ -73,7 +83,7 @@ int __kos__check_for_event(void)
|
||||
static inline
|
||||
int __kos__set_events_mask(__u32 mask)
|
||||
{
|
||||
register __u32 val;
|
||||
__u32 val;
|
||||
asm volatile ("int $0x40":"=a"(val):"a"(40), "b"(mask));
|
||||
return val;
|
||||
}
|
||||
@ -99,8 +109,54 @@ int __kos__get_button_id()
|
||||
return val>>8;
|
||||
}
|
||||
|
||||
|
||||
static inline
|
||||
void __kos__change_window(int new_x, int new_y, int new_w, int new_h)
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"int $0x40"
|
||||
::"a"(67), "b"(new_x), "c"(new_y), "d"(new_w),"S"(new_h)
|
||||
);
|
||||
}
|
||||
|
||||
static inline
|
||||
__kos__screen_t __kos__screen_size(void)
|
||||
{
|
||||
__kos__screen_t size;
|
||||
__asm__ __volatile__(
|
||||
"int $0x40"
|
||||
:"=a"(size)
|
||||
:"a"(14)
|
||||
:"memory"
|
||||
);
|
||||
return size;
|
||||
}
|
||||
|
||||
static inline
|
||||
int __kos__get_skinh(void)
|
||||
{
|
||||
int res;
|
||||
__asm__ ("int $0x40" : "=a"(res) : "a"(48),"b"(4));
|
||||
return res;
|
||||
}
|
||||
|
||||
static inline
|
||||
void __kos__dbg_write_byte(const char ch){
|
||||
__asm__ __volatile__(
|
||||
"int $0x40"
|
||||
::"a"(63), "b"(1), "c"(ch)
|
||||
);
|
||||
}
|
||||
|
||||
static inline
|
||||
void __kos__dbg_write_str(const char* str){
|
||||
while(*str){
|
||||
__kos__dbg_write_byte(*str++);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@ -85,13 +85,11 @@ Uint32 SDL_GetTicks (void)
|
||||
return (curtime-starttime)*10;
|
||||
}
|
||||
|
||||
void SDL_Delay (Uint32 ms)
|
||||
{
|
||||
__kos__delay100(ms);
|
||||
/* Uint32 start = SDL_GetTicks();
|
||||
do
|
||||
__asm__("int $0x40" :: "a"(68),"b"(1));
|
||||
while (SDL_GetTicks()-start < ms);*/
|
||||
void SDL_Delay(unsigned ms){
|
||||
unsigned start = SDL_GetTicks();
|
||||
do{
|
||||
__kos__delay100(1);
|
||||
}while (SDL_GetTicks()-start < ms);
|
||||
}
|
||||
|
||||
int SDL_SYS_TimerInit(void)
|
||||
|
@ -17,13 +17,6 @@ static int was_initialized=0;
|
||||
static int has_null_cursor=0;
|
||||
static int null_cursor;
|
||||
|
||||
inline int get_skinh(void)
|
||||
{
|
||||
int res;
|
||||
__asm__ ("int $0x40" : "=a"(res) : "a"(48),"b"(4));
|
||||
return res;
|
||||
}
|
||||
|
||||
//#define KEEP_OBSOLETE_STYLE3
|
||||
|
||||
#ifdef KEEP_OBSOLETE_STYLE3
|
||||
@ -33,7 +26,7 @@ static int IsStyle4Available=0;
|
||||
void MenuetOS_SDL_RepaintWnd(void)
|
||||
{
|
||||
__kos__window_redraw(1);
|
||||
__kos__define_window(1,1,vm_suf->hidden->win_size_x+9,vm_suf->hidden->win_size_y+get_skinh()+4,
|
||||
__kos__define_window(1, 1, vm_suf->hidden->win_size_x+9,vm_suf->hidden->win_size_y+__kos__get_skinh()+4,
|
||||
#ifdef KEEP_OBSOLETE_STYLE3
|
||||
IsStyle4Available?0x34000000:0x33000000
|
||||
#else
|
||||
@ -100,17 +93,6 @@ void MenuetOS_SetCaption(_THIS,const char * title,const char * icon)
|
||||
if(was_initialized) __asm__("int $0x40"::"a"(71),"b"(1),"c"(title));
|
||||
}
|
||||
|
||||
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++);
|
||||
}
|
||||
|
||||
SDL_Surface * MenuetOS_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags)
|
||||
{
|
||||
int ly;
|
||||
@ -120,10 +102,10 @@ 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);
|
||||
debug_board_write_str(info);
|
||||
__kos__dbg_write_str(info);
|
||||
// __asm__ __volatile__("int3");
|
||||
|
||||
current->pixels=this->hidden->__video_buffer=realloc(this->hidden->__video_buffer,
|
||||
@ -138,15 +120,18 @@ SDL_Surface * MenuetOS_SetVideoMode(_THIS, SDL_Surface *current, int width, int
|
||||
this->hidden->win_size_x=width;
|
||||
this->hidden->win_size_y=height;
|
||||
vm_suf=this;
|
||||
|
||||
|
||||
if (was_initialized)
|
||||
{
|
||||
unsigned newheight = height+get_skinh()+4;
|
||||
unsigned newwidth = width+9;
|
||||
__asm__("int $0x40"::"a"(67),"b"(-1),"c"(-1),"d"(newwidth),"S"(newheight));
|
||||
unsigned newheight = height+__kos__get_skinh()+4;
|
||||
unsigned newwidth = width+9;
|
||||
|
||||
__kos__change_window(-1, -1, newwidth, newheight);
|
||||
}
|
||||
else
|
||||
{
|
||||
__kos__set_events_mask(0x27);
|
||||
__kos__set_events_mask(0x27);
|
||||
was_initialized=1;
|
||||
MenuetOS_SDL_RepaintWnd();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user