add_resource invalid pointer error

Posted By: Reconnoiter

add_resource invalid pointer error - 05/12/17 10:44

Hey everyone,

I am trying to open the game wrs file within the map editor for the game. But I got an invalid pointer error with add_resource in the code below (don't really understand why):

(note: for some reason the code tags seem to convert double backslash to single backslash)

Code:
char* wrs_buffer;
int wrs_size = 0;

...
void blablabla () {

  wrs_buffer = file_load("D:\GStudio8\just a subfolder\MyGame\mygame.wrs", &wrs_size, &wrs_size);
  if (wrs_size > 0) {
		error("wrs found"); <- check
		add_resource(wrs_buffer); <- gives invalid pointer error
...

Posted By: txesmi

Re: add_resource invalid pointer error - 05/12/17 14:16

I do successfully use to add resource as follows:
Code:
add_resource ( "data\\animations.wrs" );


but now I read manuals example crazy
Posted By: Reconnoiter

Re: add_resource invalid pointer error - 05/12/17 17:13

Okay now I do it directly:
add_resource("D:GStudio8just a subfolderMyGamemygame.wrs");
and that does work lol. Weird acknex bug or such? Anyway do we still need to free(); the buffer?
Posted By: txesmi

Re: add_resource invalid pointer error - 05/14/17 06:13

Actually, it is not needed to preload a buffer. 'acklog' says nothing about unfreed memory at the end so... Thats all I can say laugh
Posted By: Reconnoiter

Re: add_resource invalid pointer error - 05/14/17 09:50

Originally Posted By: txesmi
Actually, it is not needed to preload a buffer. 'acklog' says nothing about unfreed memory at the end so... Thats all I can say laugh
, tnx for the check laugh
© 2024 lite-C Forums