• Welcome to Theos PowerBasic Museum 2017.

BassBox

Started by Patrice Terrier, October 08, 2007, 10:57:44 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Kent Sarikaya

I have a media center pc Patrice, I don't use my remote, I have a wireless keyboard and mouse that I use since most of what I watch is from the internet as vidcasts.
My Uncle has a Media Center PC and they use their remote and it is really quite nice how they did everything. I wouldn't put it as any priority, but I think support eventually will be a good thing for the remote.

Charles Pegge

#436
Patrice,

Updated zip 24 Feb 2008 see further on

After attempting a translation of BBPlugin.inc, and getting into deep water, I tried splitting BBPlugin,inc into a header file and a DLL. This will make BassBox much more accessible to Plugins written in different programming languages and save significant space in each plugin DLL.

The zip file below contains the new BBPluginUtil.dll to go in the main BassBox folder, all the modified Plugins, and the BBPluginUtil bas and inc files.

I hope this meets with your approval.

During the course of my translation efforts, I found a bug in BBPlugin.inc:
There is a boundary error which is not checked during compilation but Freebasic picked it up.

should be: DIM P(1 TO 12) AS LONG


             DIM P(1 TO 11) AS LONG
             ARRAY ASSIGN P() = 2,4,8,16,32,64,128,256,512,1024,2048,4096



Generally speaking, FB is much stricter about TYPE definitions, - one of the major hassles in translating from PB's relaxed interpretation of the Windows SDK. FB requires all SDK calls to be pass params BYVAL. Also Zstrings are always passed using a pointer BYVAL


Petr Schreiber

Charles,

nice job, that was lot of work to change all plugins. Very much valuated from my side!

Side comment: it took me some time to see the ARRAY ASSIGN is deadly fast, even if assigned values are expressions.
I used it in TBGL to speed up matrix multiplication and got very solid speed improvements comparing to PB native MAT functions.


Thanks,
Petr
AMD Sempron 3400+ | 1GB RAM @ 533MHz | GeForce 6200 / GeForce 9500GT | 32bit Windows XP SP3

psch.thinbasic.com

Charles Pegge

Fortunately the Plugins required very little work - just a few missing Declares. Nothing compared to translating BBPlugin.inc.

My mental grasp of matrix maths is rather limited. I can never remember which way to combine them. Apparently OpenGL does it the opposite way to conventional maths. I rely on blind obedience to make them work.


Patrice Terrier

#439
--Charles,

The changes you have done do not work on VISTA, see attached screen shot.

Looks like it couldn't find the texture's folder.

...


Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Charles Pegge


All I did was to create a separate header file and compile BBplugin.inc to a DLL. All the BB functions were given Aliases and designated as Export. They are all based on V 1.25 and the 01-19-2008 release of BBPlugin.inc

There was just the 1 bug fix mentioned above.

In the Plugins the include file was altered from "BBPlugin.inc" to BBPluginUtil.inc". Most of them required some missing Declares like glPushMatrix but nothing else was altered.

Do they all have the same problem? Some of mine do not use BBPluginUtils.


Patrice Terrier

Looks like it couldn't find the texture's folder.

Being out of home, I shall be unable to check the source code before the weekend.

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Charles Pegge

Thanks Patrice. I think I've done all the checking I can here. Hiding the texture folder reproduces the symptoms. Perhaps you can try moving the texture folder  to BBplugin\BBplugin\ to see if the path has been shifted down one level ??

Patrice Terrier

#443
DIM P(1 TO 11) AS LONG
             ARRAY ASSIGN P() = 2,4,8,16,32,64,128,256,512,1024,2048,4096


This would not caused an array bound error in PowerBASIC because the compiler just ignore the value 4096, that is indeed out of bound.

Thus writing

DIM P(1 TO 2) AS LONG
ARRAY ASSIGN P() = 2,4,8,16,32,64,128,256,512,1024,2048,4096

is perfectly legal in PB, as long as you use it together with the same BBPlugin.inc code that checks the array bounds:

             FOR K& = UBOUND(P) TO LBOUND(P) STEP -1
                 IF Xin = 0 AND ImgW > P(K&) - 1 THEN Xin = P(K&)
                 IF Yin = 0 AND ImgH > P(K&) - 1 THEN Yin = P(K&)
             NEXT
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Charles Pegge

The FB compiler does not let you get away with anything remotely suspicious without letting you know about it. Practices which we are accustomed to in PB often provoke stern warning messages if not outright rejection. This certainly catches more potential errors but after using PB, it takes some getting used to.

As a matter of interest, rge above code is very similar in FreeBasic but suffixes are no longer accepted:


             DIM K AS LONG
...
             DIM P(1 TO 12) AS LONG => { 2,4,8,16,32,64,128,256,512,1024,2048,4096 }
             FOR K = UBOUND(P) TO LBOUND(P) STEP -1
                 IF Xin = 0 AND ImgW > P(K) - 1 THEN Xin = P(K)
                 IF Yin = 0 AND ImgH > P(K) - 1 THEN Yin = P(K)
             NEXT


FB will also accept multidimensional initialisers {{,},{,},{,}} etc for multidimensional arrays or arrays of UDTs.

But Multidimensional arrays are in Row-Major order ie. highest first.

Patrice Terrier

FREEFRAME is an open-source cross-platform real-time video effects plugin system.

See it there

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Charles Pegge

#446
Patrice are these lines causing the problem in Vista. ie picking up the wrong current directory, when the plugin dll calls another  dll.?

In BBPluginUtil.inc: BBP_CreateGLTextureFromFile:
    CALL BBP_SplitN(BBP_ExeName, sPathName, "")
    IF INSTR(sImgName, sPathName) = 0 THEN sImgName = sPathName + sImgName



Patrice Terrier

#447
--Charles

You did a typo in the BBP_Exist function (see below in red)

FUNCTION BBP_Exist ALIAS "BBP_Exist LIB" (zFileSpec AS ASCIIZ) EXPORT AS LONG
    LOCAL fd AS WIN32_FIND_DATA, hFind AS LONG
    IF LEN(zFileSpec) THEN
       hFind = FindFirstFile(zFileSpec, fd)
       IF hFind <> -1 THEN
          CALL FindClose(hFind&)
          FUNCTION = -1
       END IF
    END IF
END FUNCTION

...
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com

Charles Pegge

Thank you Patrice. I hope everything else is in good order.

XP seems to be treating space as a symbol delimiter whereas Vista does not.

Updated Zip below:

Patrice Terrier

I have fixed a small glitch in the zSkin.inc, when the main window was maximized it was however still possible to move it arround, that is of course not the standard way (a maximized window can't be moved arround).

Here is how to fix it in zDefWindowproc:

       '//ELSE ' See %WM_LBUTTONDBLCLK below
       '//   IF p.Y < CaptionHeight THEN nRet = %HTCAPTION

       END IF
    ELSEIF Msg = %WM_LBUTTONDBLCLK THEN
       IF IsZoomed(hWnd) THEN
          p.X = LO(INTEGER, lParam): p.Y = HI(INTEGER, lParam)
          CALL zGetImageSize(zGetProperty(hWnd, %FORM_TopMid), 0, CaptionHeight)
          IF p.Y < CaptionHeight AND IsWindowVisible(GetDlgItem(hWnd, %ID_RESTORE)) THEN
             CALL zButtonSysCommand(hWnd, MAKLNG(%ID_RESTORE, 0))
          END IF
       END IF
    END IF


Complete source code there:


'// Monitor Windows DEF PROC to take over HITTEST detection
FUNCTION zDefWindowProc(BYVAL hWnd AS LONG, BYVAL Msg AS LONG, BYVAL wParam AS LONG, BYVAL lParam AS LONG) AS LONG
    LOCAL nRet, HITTEST, CaptionHeight AS LONG
    LOCAL rc AS RECT, p AS POINTAPI

    nRet = DefWindowProc(hWnd, Msg, wParam, lParam)

    IF Msg = %WM_NCHITTEST THEN
       CALL zGetImageSize(zGetProperty(hWnd, %FORM_TopMid), 0, CaptionHeight)
       p.X = LO(INTEGER, lParam): p.Y = HI(INTEGER, lParam)
       CALL ScreenToClient(hWnd, p)
       IF IsZoomed(hWnd) = 0 THEN
          IF nRet = %HTCLIENT THEN
             HITTEST = %HTCAPTION
             IF SK_DRAG_BACKGROUND() = 0 THEN
                IF p.Y > CaptionHeight AND CaptionHeight > 0 THEN
                   HITTEST = %HTNOWHERE
                   IF hWnd <> GetForegroundWindow THEN CALL SetFocus(hWnd)
                END IF
             END IF
             IF zWinResizable(hWnd) THEN ' We fool Window
                CALL GetClientRect (hWnd, rc)
                LOCAL xF, yF, xSide, Border AS LONG
                xF = rc.nRight: yF = rc.nBottom
                xSide = 0
                Border = GetSystemMetrics(32) ' %SM_CXFRAME
                IF ((p.X >= xF - Border) AND ((p.Y >= yF - Border))) THEN
                   HITTEST = %HTBOTTOMRIGHT
                ELSE
                   '// Left side
                   IF (p.X <= 8) THEN
                       IF (p.X <= Border) THEN HITTEST = %HTLEFT
                       xSide = 1
                   END IF
                   '// Right side
                   IF (p.X >= xF - 8) THEN
                       IF (p.X >= xF - Border) THEN HITTEST = %HTRIGHT
                       xSide = 2
                   END IF
                   '// Top side
                   IF (p.Y <= Border) THEN
                       HITTEST = %HTTOP
                       IF (xSide = 1) THEN
                           HITTEST = %HTTOPLEFT
                       ELSEIF (xSide = 2) THEN
                           HITTEST = %HTTOPRIGHT
                       END IF
                   END IF
                   '// Bottom side
                   IF (p.Y >= yF - Border) THEN
                       IF (xSide = 1) THEN
                           HITTEST = %HTBOTTOMLEFT
                       ELSE
                           HITTEST = %HTBOTTOM
                       END IF
                   END IF
                END IF
             END IF
             nRet = HITTEST
          END IF
       '//ELSE ' See %WM_LBUTTONDBLCLK below
       '//   IF p.Y < CaptionHeight THEN nRet = %HTCAPTION
       END IF
    ELSEIF Msg = %WM_LBUTTONDBLCLK THEN
       IF IsZoomed(hWnd) THEN
          p.X = LO(INTEGER, lParam): p.Y = HI(INTEGER, lParam)
          CALL zGetImageSize(zGetProperty(hWnd, %FORM_TopMid), 0, CaptionHeight)
          IF p.Y < CaptionHeight AND IsWindowVisible(GetDlgItem(hWnd, %ID_RESTORE)) THEN
             CALL zButtonSysCommand(hWnd, MAKLNG(%ID_RESTORE, 0))
          END IF
       END IF
    END IF

    FUNCTION = nRet
END FUNCTION
Patrice Terrier
GDImage (advanced graphic addon)
http://www.zapsolution.com