Jump to content

[SOLVED] Problems with FileSystem


ZioRed
 Share

Recommended Posts

When I call something like the following:

string filepath = Leadwerks.FileSystem.GetAbsolutePath("abstract::crawler.gmf");

 

The Core.AbstractPath() call returns me an error (Attempted to read or write protected memory)... but when I tried it some weeks ago it worked. Everyone else may try this?

?? FRANCESCO CROCETTI ??

http://skaredcreations.com

Link to comment
Share on other sites

I doubt, it should be some problem with the Core.AbstractPath, because loading it with Mesh.Load("abstract::crawler.gmf") works fine.

 

What is strange is that when I suggested to you the code in the other thread it worked, now the same command did not.

 

From that moment I downloaded several SDK update, may be something changed in the last engine updates (I'm using 2.31). Now I'm going to try that function in a C++ test client to see if it works there.

 

EDIT:

Tried the AbstractPath command on a C++ project and it works fine, so it's really strange. The declaration in the wrapper seems to be correct:

 

[DllImport(EngineDll, EntryPoint = "AbstractPath", CallingConvention = CallingConvention.StdCall)]
public static extern string AbstractPath(string _path);

 

Have someone any idea what may be the problem? The same command worked some weeks ago (before some updates of the 2.31 SDK), as I told, so I thought that it may be something in the last engine changes.

?? FRANCESCO CROCETTI ??

http://skaredcreations.com

Link to comment
Share on other sites

Well i guess i found a way to fix it.

 

As you use the Abstract Path you have to set it first with:

 

Leadwerks.FileSystem.AbstractPath = "Data";

 

After i did this, it works just fine :P

 

PS: However its wired that it does crash if you don't set it, that shouldn't be the case.

 

 

Mfg Imp

Link to comment
Share on other sites

mmh.. sounds strange, however if it fixes... Now I must going to almost re-write many part of both client and server because after the third wine glass I carelessly copy&pasted in my working source folder an old version of the solution.... leave me now to put aside that damned wine, before I think to retake the old C++ work! Q_Q

?? FRANCESCO CROCETTI ??

http://skaredcreations.com

Link to comment
Share on other sites

  • 3 weeks later...

Unfortunately this issue still occurs, most times it raises the AccessViolation exception (no matter calling or not RegisterAbstractPath before it).

 

A quick test code for it:

static void Main(string[] args)
{
Graphics.Initialize(800, 600);
Framework.Initialize(false);
Leadwerks.FileSystem.AbstractPath = "C:/Leadwerks Engine SDK";
string path = FileSystem.GetAbsolutePath("abstract::vehicle_monstertruck.gmf");
while (!Keyboard.KeyHit(Key.Escape) && !Leadwerks.Window.HasRequestedClose())
{
	Framework.Update();
	Framework.Render();
	Drawing.Text("Path: " + path, 0, 30);
	Graphics.Flip();
}
Engine.Terminate();
}

 

Inside the wrapper GetAbsolutePath only calls:

return Core.AbstractPath(abstractPath)

 

Anyone with engine source access could debug it when used with the wrapper? I'm available for quick testing on MSN (send me a PM to be added).

?? FRANCESCO CROCETTI ??

http://skaredcreations.com

Link to comment
Share on other sites

  • 3 weeks later...

My solution was lost, but it was a matter of changing ALL calls into Leadwerks commands that return strings to return an IntPtr, and using Marshal.PtrToStringAnsi to convert it to a string.

 

(Just re-added incase anyone searches this thread in the future)

52t__nvidia.png nVidia 530M cpu.gif Intel Core i7 - 2.3Ghz 114229_30245_16_hardware_memory_ram_icon.png 8GB DDR3 RAM Windows7_Start.gif Windows 7 Ultimate (64x)

-----

IconVisualStudio16.png Visual Studio 2010 Ultimate google-Chrome.png Google Chrome PhotoshopLinkIndicator.png Creative Suite 5 icon28.gif FL Studio 10 MicrosoftOfficeLive.png Office 15

-----

csharp.png Expert cpp.png Professional lua_icon.png Expert BMX Programmer

-----

i-windows-live-messenger-2009.pngskype-icon16.pngaim_online.pnggmail.pngicon_48x48_prism-facebook.pngtunein-web.pngyahoo.giftwitter16.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...