GFL New Source Conversion help. !! Working !!

Just starting out? Need help? Post your questions and find answers here.
Doobrey
Enthusiast
Enthusiast
Posts: 218
Joined: Sat Apr 26, 2003 4:47 am
Location: Dullsville..population: me
Contact:

Post by Doobrey »

Inner wrote: It's alot diferent trying to convert a programming language when the only comments in the source are french
Wow, the code you`re porting has comments? :wink:

I always find the best way of working things out is to take a break from it, as I tend to overlook the bleeding obvious and look in the wrong place.

eg..earlier today, my winamp plugin stopped drawing properly..the plot() command worked, but the box() didn`t draw anything, even when loaded with static values known to fit on screen..spent 1/2 hr fiddling about, even a backup known to work was now buggy.
Took a break, had a coffee and a ciggy, then I figured I should reboot the computer just incase it`s a gfx driver problem...and it was :evil:

Windows is now really getting to me..wanna throw the bloody machine out of the window somedays..although filling the case with 1/2 lb of gelignite would be more fun...
freak
PureBasic Team
PureBasic Team
Posts: 5948
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

Hey Doobrey, would you mind releasing some kind of 'skeleton' for a
winamp plugin once you're done?
Would be cool.

Inner:
I had a look at your VB translation, and as I see it, you converted all
Byte types to '.w'. Why that? Should be '.b', shouldn't it?

With '.w', the structure sizes don't match to those in the dll, and you will
only get nonsense back/to the dll, which can lead to crashes.

Also here: (GflLib.pb, line 229)
"Extension.b[16]" is wrong. You need 16 Strings of 8 byte length.

Do "Extension.b[128]". Just make sure, you peek out the right string
when reading it, remember there are 16 of them in there.

Another big mistake is hidden in GflLibExt.pb line 54:
"StretchDIBits" is not a function out of this library, it is out of the windows
GDI library, so it is simply a WinAPI command.
must look like this:

StretchDIBits_(hdc,x,y,dx,dy,SrcX,SrcY,wSrcWidth,wSrcHeight,lpBits,lpBitsInfo,wUsage,dwRop)


Little pointer thing:
in line 170 you call "*DibInfo.BITMAPINFO=extGetDIBFromBitmap(BITMAP)"

'BITMAP' doesn not exist, so I assume, it must be '*bmp' which is the
pointer that was originaly past to this function:

*DibInfo.BITMAPINFO=extGetDIBFromBitmap(*bmp)

Also, in example.pb line 53, you call a function with *GflBitmap as a
parameter, but everywhere else, it is only 'GflBitmap' so remove the *
or you have a NULL pointer there.

Ok, now there are no crashes anymore, when executing, but the window
remains empty here. Dunno why.
Maybe you can go on from this point, I don't like to look through
everything to find out, what each command is supposed to do, in order
to find out what's wrong. Maybe you can do that faster.

Here are the files with the updates i've made:
http://freak.purearea.net/stuff/GFL.zip

Hope it helps...

Timo
quidquid Latine dictum sit altum videtur
User avatar
Inner
PureBasic Expert
PureBasic Expert
Posts: 714
Joined: Fri Apr 25, 2003 4:47 pm
Location: New Zealand

Post by Inner »

had a look at your VB translation, and as I see it, you converted all
Byte types to '.w'. Why that? Should be '.b', shouldn't it?
because of the signed byte thing, I figured that because we can only do;
-127 to +127 this might confuse GFL a bit, I've since fixed that and put them back to bytes however I am a little terrorifed that this is going to break.
Another big mistake is hidden in GflLibExt.pb line 54:
"StretchDIBits" is not a function out of this library, it is out of the windows
GDI library, so it is simply a WinAPI command.
must look like this:
I discovered this just moments ago, however as you'll see by the source below, the window is still somewhat blank dispite being give the correct values and data.. hall of the weird!.
'BITMAP' doesn not exist, so I assume, it must be '*bmp' which is the
pointer that was originaly past to this function:
Indeed it was.

http://www.inet.net.nz/~tjr/irc/GFL_PB4.zip

This is the closest so far, the only thing it isn't doing is drawing the the data to the window, I've done a dump of the memory area that _Data points to and it's valid, it just won't draw for some reason.

Freak - thank you so much for your help :), be asured that should this thing ever work, I shall credit you.

oh p.s all the drawing for the image is done in the call back function for the window, in example.pb under WM_PAINT, for obvious reasons.
Doobrey
Enthusiast
Enthusiast
Posts: 218
Joined: Sat Apr 26, 2003 4:47 am
Location: Dullsville..population: me
Contact:

Post by Doobrey »

@ Freak
I`ll post it to the tips& tricks section once I`ve cleaned up the code and tried out a few other things eg tried to get the spectrum data from linear to a log scale, cos it just looks plain wrong in linear :((
User avatar
Inner
PureBasic Expert
PureBasic Expert
Posts: 714
Joined: Fri Apr 25, 2003 4:47 pm
Location: New Zealand

Post by Inner »

Working!!!!!!!!!!!!!!!

http://www.inet.net.nz/~tjr/irc/GFL_PB5W.zip

finally displays pictures, it probably has many bugs, but at least it's displaying a picture now, many thanks to freak, how when I clean up the source and add all the other functions, will be plastered at the top of each source file as being a contributing help factor..
Num3
PureBasic Expert
PureBasic Expert
Posts: 2812
Joined: Fri Apr 25, 2003 4:51 pm
Location: Portugal, Lisbon
Contact:

Post by Num3 »

Doobrey wrote: Took a break, had a coffee and a ciggy, then I figured I should reboot the computer just incase it`s a gfx driver problem...and it was :evil:

Windows EULA States (The one no one reads):twisted:

We do not garantee this OS will work, so:

Always make backups
Always reboot if you can't get something too work properly
If that fails, reinstall windows and use the backups you created !

:wink:
Doobrey
Enthusiast
Enthusiast
Posts: 218
Joined: Sat Apr 26, 2003 4:47 am
Location: Dullsville..population: me
Contact:

Post by Doobrey »

Nah, you got the order wrong...

If it crashes, swear at the computer.
If that fails, reboot.
If that fails, swear some more.
If that fails, kick the computer.
If that fails, reinstall Windows
If that fails, string a dozen swearwords together, and plug the CPU into the mains voltage.
If that fails, buy a Mac and burn the Windows CD. :twisted:
User avatar
Inner
PureBasic Expert
PureBasic Expert
Posts: 714
Joined: Fri Apr 25, 2003 4:47 pm
Location: New Zealand

Post by Inner »

I don't know what it is and the rest of the world and windows, I've never had a problem with Windows XP, and a slight hick up with Windows 2000, Windows Me ( I never installed ), Windows 98Se the apitame of all evil, and the less said about 95 the better.

I apply these rules to computers;
Pray it turns on in the morning, and thank my heavnly father for the gift that he has deposited on my desk.
Don't over clock
Don't hit your pc
Don't fiddle with something you know nothing about
If it works, leave it the heck alone.
Don't run games, they'll bugger ya computer up in less time that it takes you to sneeze.
Search the web for a salution if all fails
If all else still fails re-write the entire code from the beginning.
If still, call for help & pray.
And if no one helps, rely on God.

--

of p.s, during the porting of this code a bug in PB was found in a structure called BITMAPINFO, that is why you see my own _BITMAPINFO structures.
User avatar
Inner
PureBasic Expert
PureBasic Expert
Posts: 714
Joined: Fri Apr 25, 2003 4:47 pm
Location: New Zealand

Post by Inner »

_Intro_
-------

These sources require the "libgfl193.dll" which can be downloaded from;

http://www.xnview.com - download the SDK

if you find any bugs please report them to tjr_inner@yahoo.co.nz and I'll do
my best to fix them, or you could fix it yourself and send me the fix.

_History_
---------

v0.1
----
Fixed array out of bounds, 255 should have been 256!.
Fixed some structure items defined as byte
Fixed colormap, GIF's & PNG's should load properly and display proper colors
Fixed byte conversion on the colormap array.
(gripe!, no unsigned chars are a pain!, and not to mention slow down excution)
(because of the constant conversion of data type. )
Added 99% of the infomation gathering functions, convertered a few others.
eventually they'll all work, I don't believe in doing things half arsed, just
displaying a picture is not enough.
Added Thanks/Help.

http://www.inet.net.nz/~tjr/irc/GFL_PB01.zip

This is probably the wrong area of the forum to have this, what does anyone else think ?
User avatar
Inner
PureBasic Expert
PureBasic Expert
Posts: 714
Joined: Fri Apr 25, 2003 4:47 pm
Location: New Zealand

Post by Inner »

Doobrey
Enthusiast
Enthusiast
Posts: 218
Joined: Sat Apr 26, 2003 4:47 am
Location: Dullsville..population: me
Contact:

Post by Doobrey »

Inner wrote: If still, call for help & pray.
And if no one helps, rely on God.
Ah..there`s your answer..he knows how to fight the darkside that is Microsoft.

Strange as this sounds, the most stable version of windows I`ve used has been Win95..at one point it was almost 14 months before I had to reinstall the OS.
Trouble is, I needed USB..so it was over to 98SE

WinME is the OS that Microsoft tries to forget about..I once wasted 2 days trying to get sound working on a friends PC, gave up and installed 98 instead.

And I don`t agree with the Microsoft`s EULA in the lastest version of Windows..plus they seem even more bloated and full of "features" that probably 1% of users would even use.
And why did MS give XP such a cruddy default sking..it looks like a kids toy.
Post Reply