bmap_create() acknexwrapper VS2010

Posted By: pararealist

bmap_create() acknexwrapper VS2010 - 04/08/11 13:32

A7 Com
AcknexWrapper
VS 2010

I seem to have found a problem with bmap_create, that maybe you
can clear up or explain. I did not want to post in BUGS as it is not really clear if it is.

At first i thought it was a wrapper problem as bmap_create was returning null
but i finaly with Stromausfall's help narrowed it down.

If i put the bitmap in the folder where the executable runs (bin) it loads the
bitmap without problem, but if in a sub folder of the executable folder f.i (bin\textures)
bmap_create will return null.

The paths are added like so:
Path:
public static String textures = Application.StartupPath + @"\defaults\textures\";
and use like so:
water_bump = BMAP.bmap_create( textures + "waves2.tga" );

All other load or create commands load from this type of path fine, but bmap_create does not.

The paths are also added using add_folder().

It just seems strange that bmap_create() alone (at least i have not yet encountered any other)
has this behaviour.

Any ideas?
Posted By: William

Re: bmap_create() acknexwrapper VS2010 - 04/08/11 15:01

Hmm... this is interesting find. A year ago I tried using bmap_create to load an unload all my huge background files in the Silas menus from memory before gameplay(instead of just defining them as bmaps). It actually worked very well and I was pleased, except for the fact that there was a problem that made it unusable for me. It would keep returning random Invalid Pointer errors after I created them, even though it would work most of the time. It actually worked about 90% of the time, but that one error here and there made it unusable.

My process was:

BMAP* btimer;

I would switch between these steps below:

btimer = bmap_create("backtime.dds"); - Call before panel is visible in menu

ptr_remove(btimer); - Call after panel is reset and before gameplay

I also used add_folder and the bmaps were in a path. But I guess my problem may be different than the one above. I soon abandoned this method as I thought it was too unstable or I did not properly code it.
Posted By: pararealist

Re: bmap_create() acknexwrapper VS2010 - 04/08/11 15:40

The strange thing for me is if bmap is in top folder where
app runs it loads ok, only in a sub folder it returns null.
And it seems to only affect bmap_create().
Posted By: William

Re: bmap_create() acknexwrapper VS2010 - 04/08/11 15:50

My problem I believe was related to bmap_create too. But it was a different issue than yours, since it would return invalid randomly and worked other times.
Posted By: wdlmaster

Re: bmap_create() acknexwrapper VS2010 - 04/08/11 21:57

Quote:

...only in a sub folder it returns null.

You need two backslashes:
Code:
bmp = bmap_create ("subfolder\\test.tga");


works perfect (A7 com)
Posted By: pararealist

Re: bmap_create() acknexwrapper VS2010 - 04/09/11 11:31

Using c# and acknex wrapper here.

but i already tried two backslashes in

public static String textures = Application.StartupPath + @"\\defaults\textures\\";

instead of
public static String textures = Application.StartupPath + @"\defaults\textures\";

with same result.
Posted By: SchokoKeks

Re: bmap_create() acknexwrapper VS2010 - 04/09/11 12:41

I have no knowledge about the c# wrapper, but String isn't the same as STRING or char.

Does it automatically convert a String to an engine STRING* or char* ? If yes, then never mind my reply.
Posted By: pararealist

Re: bmap_create() acknexwrapper VS2010 - 04/09/11 13:22

just in case you do use it sometime, STRING* is not implemented in wrapper because c# strings are ok to use.
Posted By: jcl

Re: bmap_create() acknexwrapper VS2010 - 04/11/11 13:39

You can read bmaps from any folder. The problem was that you gave an invalid bmap name. File names for engine objects must only contain letters, digits, underscore, and extension - no paths, back slashes, or the like.
Posted By: pararealist

Re: bmap_create() acknexwrapper VS2010 - 04/15/11 13:17

Quote:
You can read bmaps from any folder. The problem was that you gave an invalid bmap name. File names for engine objects must only contain letters, digits, underscore, and extension - no paths, back slashes, or the like.


Quote:
The paths are added like so:
Path:
public static String textures = Application.StartupPath + @"\defaults\textures\";
and use like so:
water_bump = BMAP.bmap_create( textures + "waves2.tga" );

All other load or create commands load from this type of path fine, but bmap_create does not.


sorry i do not understand where you mean there is an invalid character? Do you mean this @ ?

The other commands have no problem with the same path, or are they not engine objects?

please point out where the path/filename is invalid, as i cannot see it right now.
Posted By: Uhrwerk

Re: bmap_create() acknexwrapper VS2010 - 04/15/11 16:01

The problem is, that you're giving the complete file name including the path. You only have to pass the filename withouth the path. I.e.

"C:\Test\Myimg.bmp" <- Bad idea because of the backslash and the colon.

"Myimg.bmp" <- That's the way to go.
Posted By: pararealist

Re: bmap_create() acknexwrapper VS2010 - 04/16/11 09:24

So for bmap_create() use just the filename?,
will try this when i get home and see.
Thanks for the clarity.
© 2024 lite-C Forums