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 short __u16;
|
||||||
typedef unsigned long __u32;
|
typedef unsigned long __u32;
|
||||||
|
|
||||||
|
#pragma pack(push)
|
||||||
struct process_table_entry
|
struct process_table_entry
|
||||||
{
|
{
|
||||||
__u32 cpu_usage;
|
__u32 cpu_usage;
|
||||||
@ -28,6 +29,15 @@ struct process_table_entry
|
|||||||
__u8 reserved3[1024-71];
|
__u8 reserved3[1024-71];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef union{
|
||||||
|
unsigned val;
|
||||||
|
struct{
|
||||||
|
short h;
|
||||||
|
short w;
|
||||||
|
};
|
||||||
|
}__kos__screen_t;
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
static inline
|
static inline
|
||||||
void __kos__define_window(__u16 x1,__u16 y1,__u16 xsize,__u16 ysize,
|
void __kos__define_window(__u16 x1,__u16 y1,__u16 xsize,__u16 ysize,
|
||||||
__u32 body_color,__u32 grab_color,__u32 frame_color)
|
__u32 body_color,__u32 grab_color,__u32 frame_color)
|
||||||
@ -73,7 +83,7 @@ int __kos__check_for_event(void)
|
|||||||
static inline
|
static inline
|
||||||
int __kos__set_events_mask(__u32 mask)
|
int __kos__set_events_mask(__u32 mask)
|
||||||
{
|
{
|
||||||
register __u32 val;
|
__u32 val;
|
||||||
asm volatile ("int $0x40":"=a"(val):"a"(40), "b"(mask));
|
asm volatile ("int $0x40":"=a"(val):"a"(40), "b"(mask));
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
@ -99,8 +109,54 @@ int __kos__get_button_id()
|
|||||||
return val>>8;
|
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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -85,13 +85,11 @@ Uint32 SDL_GetTicks (void)
|
|||||||
return (curtime-starttime)*10;
|
return (curtime-starttime)*10;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDL_Delay (Uint32 ms)
|
void SDL_Delay(unsigned ms){
|
||||||
{
|
unsigned start = SDL_GetTicks();
|
||||||
__kos__delay100(ms);
|
do{
|
||||||
/* Uint32 start = SDL_GetTicks();
|
__kos__delay100(1);
|
||||||
do
|
}while (SDL_GetTicks()-start < ms);
|
||||||
__asm__("int $0x40" :: "a"(68),"b"(1));
|
|
||||||
while (SDL_GetTicks()-start < ms);*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDL_SYS_TimerInit(void)
|
int SDL_SYS_TimerInit(void)
|
||||||
|
@ -17,13 +17,6 @@ static int was_initialized=0;
|
|||||||
static int has_null_cursor=0;
|
static int has_null_cursor=0;
|
||||||
static int null_cursor;
|
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
|
//#define KEEP_OBSOLETE_STYLE3
|
||||||
|
|
||||||
#ifdef KEEP_OBSOLETE_STYLE3
|
#ifdef KEEP_OBSOLETE_STYLE3
|
||||||
@ -33,7 +26,7 @@ static int IsStyle4Available=0;
|
|||||||
void MenuetOS_SDL_RepaintWnd(void)
|
void MenuetOS_SDL_RepaintWnd(void)
|
||||||
{
|
{
|
||||||
__kos__window_redraw(1);
|
__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
|
#ifdef KEEP_OBSOLETE_STYLE3
|
||||||
IsStyle4Available?0x34000000:0x33000000
|
IsStyle4Available?0x34000000:0x33000000
|
||||||
#else
|
#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));
|
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)
|
SDL_Surface * MenuetOS_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags)
|
||||||
{
|
{
|
||||||
int ly;
|
int ly;
|
||||||
@ -120,10 +102,10 @@ 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];
|
char info[100];
|
||||||
sprintf(info, "width = %d, height = %d, pitch = %d, bpp = %d\n", current->w, current->h, current->pitch, bpp);
|
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");
|
// __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,
|
||||||
@ -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_x=width;
|
||||||
this->hidden->win_size_y=height;
|
this->hidden->win_size_y=height;
|
||||||
vm_suf=this;
|
vm_suf=this;
|
||||||
|
|
||||||
|
|
||||||
if (was_initialized)
|
if (was_initialized)
|
||||||
{
|
{
|
||||||
unsigned newheight = height+get_skinh()+4;
|
unsigned newheight = height+__kos__get_skinh()+4;
|
||||||
unsigned newwidth = width+9;
|
unsigned newwidth = width+9;
|
||||||
__asm__("int $0x40"::"a"(67),"b"(-1),"c"(-1),"d"(newwidth),"S"(newheight));
|
|
||||||
|
__kos__change_window(-1, -1, newwidth, newheight);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
__kos__set_events_mask(0x27);
|
__kos__set_events_mask(0x27);
|
||||||
was_initialized=1;
|
was_initialized=1;
|
||||||
MenuetOS_SDL_RepaintWnd();
|
MenuetOS_SDL_RepaintWnd();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user