Stuck with 1.106 and FastLib

Blitz3D Forums/Blitz3D Programming/Stuck with 1.106 and FastLib

RustyKristi(Posted 2014) [#1]
I have read that there's an issue with FastLib not working with the latest version. So if I am to add Fast libraries on my game I will be stuck with v1.106?

That's a shame. Is there a workaround on this since the code is already out in the open?


Rick Nasher(Posted 2014) [#2]
I have FastLib, last thing I've seen is:

http://www.blitzbasic.com/Community/posts.php?topic=102094

Currently running on V1.106 and Win7 and haven't tried it on Win8 or with >V1.106 .


RustyKristi(Posted 2014) [#3]
Thanks for the info Rick. What I'm concerned about is the open source version which is at v1.108. I would like to make some changes to the code in the future or if needed but since the source is the latest, I can't use it and have FastLibs at the same time.

Seems to be a small issue at the moment but I guess the future of blitz is now moving towards custom shaders and using DX9/11, and maybe Ploppy's Hardwired masterpiece would be the next viable solution.


Rick Nasher(Posted 2014) [#4]
Yup, everyone who loves Blitz3d is keeping their fingers crossed for that one.


videz(Posted 2014) [#5]
Yes for a couple of weeks of tinkering I finally have a grasp that the easy of use and prototyping capabilities of blitz3d for me is unrivaled.

It is very easy to create a game prototype from scratch with the help and backing of the plethora of code archives and 10 years of information shared here. I'm also hoping and routing for Hardwired to pull through and soon will support this great project! :)


Rroff(Posted 2014) [#6]
Same boat here - stuck on 1.106 if I want to use FastLibs which is quite important.

I had problems with the Windows 8 fix implementation of my own as I had to compile separate binaries due to some systems otherwise crashing out at that point - I probably should just take a look at how its done in the B3D source and convert that back to B3D native code.

EDIT: Its done pretty much the same method as I use in native B3D so not sure why mine crashes on certain systems due to issues with different versions of ddraw.

EDIT2: Ah I see - its not just checking if the library exists before calling it, it is also checking the function exists before trying to set compatibility flags, will have to remember to fix that when I get back to coding.


Rroff(Posted 2014) [#7]
Just saw this http://www.blitzbasic.com/Community/posts.php?topic=102094

EDIT: Completely off the cuff programming almost done in my head and untested so might not work at all but this _should_ implement the Windows 8 fix for those still on v1.106 without a 3rd party dll and work on older machines and some weird setups that seem to crash out otherwise:

;kernel32.decls
;.lib "kernel32.dll"
;GetProcAddress%( hModule%, lpProcName$ ) : "GetProcAddress"
;GetModuleHandle%( lpModuleName$ ) : "GetModuleHandleA"

Function bbWin8fix()
	Local ddraw = GetModuleHandle("ddraw.dll") ; if it exists ddraw.dll should have been loaded by b3d
	Local procaddr
	Local apibank
	Local apiout
	
	If (Not ddraw) Then ; failed ddraw.dll wasn't loaded or not present on system (Windows XP and earlier?)
		Return 0
	EndIf
	
	procaddr = GetProcAddress(ddraw,"SetAppCompatData")
	
	If (Not procaddr) Then ; failed - SetAppCompatData doesn't exist in this version of ddraw.dll (_shouldn't_ happen)
		Return 0
	EndIf
	
	apibank = CreateBank(8)

	PokeInt apibank,0,12
	PokeInt apibank,4,0

	apiout = CallDLL("ddraw.dll","SetAppCompatData",apibank)

	FreeBank apibank

	Return apiout

End Function


Obviously needs the kernel32.decls if you don't already have those functions.

EDIT2: This is more or less reproducing what calldll does internally anyway so not sure if it will be any different to the issues on some older machines with trying to call ddraw.dll.


Rroff(Posted 2014) [#8]
^^ So basically I can't remember what the issues was with doing it in B3D natively - whether calldll wasn't having the desired effect or if it was still crashing on older systems like a userlib for ddraw.dll does and don't have either an older system or a Windows 8 system to hand at the moment to test - that code is basically doing the same as the calldll function does internally though slightly different via getmodulehandle instead of loadlibrary but will leave the code up for reference as it might be useful for somone doing something else.


videz(Posted 2014) [#9]
Hi Rroff. I will also try this one when I get a chance. I'm currently using Win7 only

I was also hoping for getting v1.108 to work with FastLibs. But I guess this should be totally in the hands of the author of FastLib (Mikhail) unless you have something up your sleeve.. :)

Thanks.


Rroff(Posted 2015) [#10]
Heh wouldn't even know where to start on that one - would need some serious debugging and hooking/address translocation I'm guessing.


Jimmy(Posted 2015) [#11]
Been expeimenting as thibgs seem to have changed with windows versions. Stikl no luck on the titlebar icon.

Tab/task icon I've suceezed with so far
I post what I've suceeded with so far.

This code below is a programmers mess while he tries to learn
a new API :s

The sendmessage sewm to be the newer way and it dupports title (small icon 16x16) and tab (big icon 32x32),
But it crashes 90% of the times and the rest gives a clean space OR actually work 1% of the times.

Using Windows 7 here.

Any ideas how to go aboyt the titlebar icon without recompiling blitz?

[/code]
setappicon("1.ico")

Graphics 1280,800,0,2:SetBuffer BackBuffer()
repeat
; delay 1
flip
until mousedown(2)

Function SetAppIcon(iconname$)
iconname$="icon2.ico" ; extract and load its own exe file icon
WM_SETICON = $80
LR_LOADFROMFILE = $10
ICON_SMALL = 0 ; 16x16
ICON_BIG = 1 ; 32x32
IMAGE_ICON = 1
GCL_HICON = -14
hWnd = api_GetActiveWindow() : hDC = api_GetDC(hWnd) : imageid = LoadIcon( hWnd, iconname$,0)
; imageid = api_LoadImage(Api_GetModuleHandle_Null(0), iconname$, IMAGE_ICON, 16,16, LR_LOADFROMFILE)
; imageid = api_LoadIcon(hWnd,iconname$)
; api_SetClassLong(hWnd,GCL_HICON, imageid)
;Flip
api_SendMessage(hWnd, WM_SETICON, ICON_SMALL, imageid)
api_SendMessage(hWnd, WM_SETICON, ICON_BIG, imageid)
;api_DrawIcon( hDC, 75, 75, imageid )
;WaitKey
End Function

; Notes of the used API calls and where to add them
; -------------------------------------------------
; kernel32.decls FILE ADD:
; Api_GetModuleHandle_Null%(lpModuleName%):"GetModuleHandleA"
;
; shell32.decls FILE ADD:
; LoadIcon%(hWND%,File$,Index%) : "ExtractIconA"
; api_ExtractIcon% ( hWnd%, File$, Index% ) : "ExtractIconA"
;
; user32 FILE ADD:
; api_DrawIcon% (hdc%, x%, y%, hIcon%) : "DrawIcon"
; api_DrawIconEx% (hdc%, xLeft%, yTop%, hIcon%, cxWidth%, cyWidth%, istepIfAniCur%, hbrFlickerFreeDraw%, diFlags%) : "DrawIconEx"
; api_LoadIcon% (hInstance%, lpIconName$) : "LoadIconA"
; api_LoadImage% (hInst%, lpsz$, un1%, n1%, n2%, un2%) : "LoadImageA"
; api_GetDC% (hwnd%) : "GetDC"
; api_SetActiveWindow% (hwnd%) : "SetActiveWindow"
; api_SetClassLong% (hwnd%, nIndex%, dwNewLong%) : "SetClassLongA"

; Programmers scratchbook
; -----------------------
; old in user32.decls crashed
; api_SendMessage% (hwnd%, wMsg%, wParam%, lParam*) : "SendMessageA"
;
; new in user32.decls empty icon in titlebar
; api_SendMessage% (hwnd%, wMsg%, wParam%, lParam$) : "SendMessageA"
;
[/code]



; notice also the "loadicon" clone, does not seem to be the source of error though


RGR(Posted 2015) [#12]
If you remove the slash from the first time you use the code tag this may be visible as code


videz(Posted 2015) [#13]
Interesting code Jimmy. What I'm puzzled about is why the default IDE and the output exe doesn't have the rocket icon. The console icon is the default instead and seems that this was an intentional coding by BRL not to have an icon resource in it..