Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[BUG] GDIp Bug in DX8 Engines


abhi2011
 Share

Recommended Posts

Hey guys, 

So going through the entire code and more specifically through the GDIp code, I found a weird bug that JC left in with the original working DX8 engine. Almost every DX8 engine on this forum was based on JC's EO 3.0 and hence has this bug. I believe that this should be fixed. Even though it doesn't cause anything to crash and is pretty much harmless, it's still a coding mistake. 

**I urge all those who have created a DX8 engine and all those who are making a game in a DX8 engine to please fix this. **

In **cGDIPImage** find the method, **LoadPicture_FromNothing**

Change 

```
hImage = pvCreateSourcelessImage2(hImage, Width, Height, 1&, TokenClass, graphics)

```
to 

```
hImage = pvCreateSourcelessImage2(hImage, Width, Height, 0&, TokenClass, graphics)

```
Find **LoadTexture**. It'll most probably be in the Rendering module of your engine. 

Change this: 

```
Call ConvertedBitmap.LoadPicture_FromNothing(newHeight, newWidth, I, GDIToken) 'I HAVE NO IDEA why this is backwards but it works.

```
To this: 

```
Call ConvertedBitmap.LoadPicture_FromNothing(newWidth, newHeight, I, GDIToken) 'This is no longer backwards and it now works.

```
Make sure this is done for every call of **LoadPicture_FromNothing **i.e swap the first two parameters that correspond to the width and height of the Image.

So, what's this bug all about?

Well, LoadPicture_FromNothing is a method that JC created in the original cGDIpClass so that textures that don't have dimensions in the powers of two can be converted. He basically wanted to load up the original png file, make a new image with the dimensions which is a power of two closest to the original png. But, there was no method for creating an image from nothing. But when he actually wrote the code for it, he set up parameter wrong in the method. Originally it was **1& **but now, it's been changed to **0&**. That parameter is a flag for flipping the image i.e it swaps the width and height of the image. 

Now, is this fix an absolute necessary for your game to run smoothly without any crashes? Probably not. I haven't heard of any bugs caused due to this method. But, should you fix it? Absolutely. Mainly because it's a coding mistake that should be fixed. 

If you have any questions about this bug fix or would like to learn more about this then shoot me a PM and I'll be glad to help. 

Regards, 

Abhi2011
Link to comment
Share on other sites

The Crystalshire Developers Edition doesn't have the fix for that particular bug. But most other DX8 engines do. Please look into their source code. 

If you are in need of further help, please do not leave it here, but rather make a new topic in appropriate Forum Board.
Link to comment
Share on other sites

Just as a little note, only engines based off of JC's code will have this, there's a couple different variants of DirectX8 going around, some of which were written far before EO3 came out and not all of them use the same methods.
Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...
Hello! I am new here, ~~I found error hot key at top on right-side by corner and It was flash (blank often) I saved the log errors:~~

~~1.The following error occured at 'HandleUpdateQuest' In 'modHandleData'.

Run-time error '0': .

2.The following error occured at 'Form_Unload' In 'frmMain'.

Run-time error '0': .~~

~~3.Property Size in Font had an invalid value.~~

~~How I am going fix this?~~

EDIT: Never mind, It was my keyboard need replace new one.
Link to comment
Share on other sites

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...