X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=AcessNative%2Facesskernel_src%2Fvideo.c;h=d78f6dadbf3ce7aceb309d1f9d48130cb8f8742f;hb=9a9053e91df6e08761e2ce72be350c5c2233153b;hp=f3903fb20bacf378a6b7c04005c50a53257668e8;hpb=7f80ab30017689efe0aaaab18abc7ceda689d859;p=tpg%2Facess2.git diff --git a/AcessNative/acesskernel_src/video.c b/AcessNative/acesskernel_src/video.c index f3903fb2..d78f6dad 100644 --- a/AcessNative/acesskernel_src/video.c +++ b/AcessNative/acesskernel_src/video.c @@ -9,13 +9,13 @@ #include #include #include -#include +#include #include "ui.h" // === PROTOTYPES === int Video_Install(char **Arguments); -Uint64 Video_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer); -Uint64 Video_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer); +size_t Video_Read(tVFS_Node *Node, Uint64 Offset, size_t Length, void *Buffer, Uint Flags); +size_t Video_Write(tVFS_Node *Node, Uint64 Offset, size_t Length, const void *Buffer, Uint Flags); int Video_IOCtl(tVFS_Node *Node, int ID, void *Data); // --- 2D Acceleration Functions -- void Video_2D_Fill(void *Ent, Uint16 X, Uint16 Y, Uint16 W, Uint16 H, Uint32 Colour); @@ -23,12 +23,15 @@ void Video_2D_Blit(void *Ent, Uint16 DstX, Uint16 DstY, Uint16 SrcX, Uint16 SrcY // === GLOBALS === //MODULE_DEFINE(0, VERSION, NativeVideo, Video_Install, NULL, NULL); -tDevFS_Driver gVideo_DriverStruct = { - NULL, "NativeVideo", - { +tVFS_NodeType gVideo_NodeType = { .Read = Video_Read, .Write = Video_Write, .IOCtl = Video_IOCtl +}; +tDevFS_Driver gVideo_DriverStruct = { + NULL, "NativeVideo", + { + .Type = &gVideo_NodeType } }; int giVideo_DriverID; @@ -54,7 +57,7 @@ int Video_Install(char **Arguments) /** * \brief Read from framebuffer (unimplemented) */ -Uint64 Video_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) +size_t Video_Read(tVFS_Node *Node, Uint64 Offset, size_t Length, void *Buffer, Uint Flags) { return 0; } @@ -62,7 +65,7 @@ Uint64 Video_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) /** * \brief Write to the framebuffer */ -Uint64 Video_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) +size_t Video_Write(tVFS_Node *Node, Uint64 Offset, size_t Length, const void *Buffer, Uint Flags) { int i; ENTER("pNode XOffset XLength pBuffer", Node, Offset, Length, Buffer); @@ -76,7 +79,7 @@ Uint64 Video_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) { case VIDEO_BUFFMT_TEXT: { - tVT_Char *chars = Buffer; + const tVT_Char *chars = Buffer; // int pitch = giUI_Pitch; int widthInChars = giUI_Width/giVT_CharWidth; int heightInChars = giUI_Height/giVT_CharHeight; @@ -165,10 +168,12 @@ Uint64 Video_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) LOG("buffer = %p", Buffer); + Offset /= 4; startX = Offset % giUI_Width; startY = Offset / giUI_Width; - - if( Length + startX < giUI_Width ) + Length /= 4; + + if( startX + Length < giUI_Width ) { // Single line UI_BlitBitmap( @@ -176,6 +181,15 @@ Uint64 Video_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) Length, 1, Buffer); } + else if( startX == 0 ) + { + int lines = Length / giUI_Width; + int rem = Length % giUI_Width; + UI_BlitBitmap(0, startY, giUI_Width, lines, Buffer); + if( rem ) { + UI_BlitBitmap(0, startY + lines, rem, 1, (Uint32*)Buffer + lines*giUI_Width); + } + } else { // First scanline (partial or full) @@ -243,6 +257,8 @@ int Video_IOCtl(tVFS_Node *Node, int ID, void *Data) // Video mode control // - We cheat, and only have one mode case VIDEO_IOCTL_GETSETMODE: + // - Abuse GETSETMODE to update size + Node->Size = giUI_Pitch * giUI_Height; return 0; case VIDEO_IOCTL_FINDMODE: case VIDEO_IOCTL_MODEINFO: @@ -264,16 +280,14 @@ int Video_IOCtl(tVFS_Node *Node, int ID, void *Data) #if 0 case VIDEO_IOCTL_SETCURSOR: // Set cursor position #if !BLINKING_CURSOR - if(giVesaCursorX > 0) - Vesa_FlipCursor(Node); + if(giVideo_CursorX > 0) + Video_FlipCursor(Node); #endif - giVesaCursorX = ((tVideo_IOCtl_Pos*)Data)->x; - giVesaCursorY = ((tVideo_IOCtl_Pos*)Data)->y; - //Log_Debug("VESA", "Cursor position (%i,%i)", giVesaCursorX, giVesaCursorY); - if( - giVesaCursorX < 0 || giVesaCursorY < 0 - || giVesaCursorX >= gpVesaCurMode->width/giVT_CharWidth - || giVesaCursorY >= gpVesaCurMode->height/giVT_CharHeight) + giVideo_CursorX = ((tVideo_IOCtl_Pos*)Data)->x; + giVideo_CursorY = ((tVideo_IOCtl_Pos*)Data)->y; + if( giVideo_CursorX < 0 || giVesaCursorY < 0 + || giVideo_CursorX >= gpVesaCurMode->width/giVT_CharWidth + || giVideo_CursorY >= gpVesaCurMode->height/giVT_CharHeight) { #if BLINKING_CURSOR if(giVesaCursorTimer != -1) { @@ -296,9 +310,6 @@ int Video_IOCtl(tVFS_Node *Node, int ID, void *Data) //Log_Debug("VESA", "Cursor position (%i,%i) Timer %i", giVesaCursorX, giVesaCursorY, giVesaCursorTimer); return 0; #endif - - case VIDEO_IOCTL_REQLFB: // Request Linear Framebuffer - return 0; } return 0; }