[?] loading files

[?] loading files

Messagede tomchi » Jeu 21 Juin 2012 06:39

Hi,

In order to reduce RAM usage of a game I'm (once every 2 years ) working on, heavy usage of BLOAD makes it crash. Older version of the game using inlines works ok.

I know FILESELECT is kind of buggy when it comes to do nasty stuffs, if one can consider MALLOC is a nasty command :P

So, here's what I do, can't post the complete source of the game indeed ;) :

in the init proc :
Code: Tout sélectionner
  ' DETERMINE LE CHEMIN COURANT POUR LE PROG APRES COMPILE
  chemin$=CHR$(GEMDOS(25)+65)+":"+DIR$(0)+"\"


then when a file is needed, just call a proc this way:

Code: Tout sélectionner
@charge("blah.sht",place%)


Code: Tout sélectionner
 > PROCEDURE charge(fichier$,emplacement%)
  oussa$=chemin$+"datas.rz\"+fichier$+chr$(0)
'cmd$=chr$(0)
'env$=chr$(0)+chr$(0)
'bp%=gemdos(63,L:V:oussa$,L:flong%)
  BLOAD oussa$,emplacement%
RETURN


It all works well twice= loading menu, menu runs, select something, load files, run the something, load menu files, run menu *2
and then it doesn't want to load anymore. Checked as many things as i can inside the code, seems ther's no mistake left.

Then, I made the prog just loop the menu : load menu files, run menu, select something, load menu files, run menu
And I still got the same prob.

So wether there's an error in the code i can't find, wether BLOAD ain't that rock solid command.

I also tried with OPEN/BGET , still same prob. As you can see in the above code, I'm about to go into gemdos call but, damn i don't know how to do / not sure it will work better.

As anyone experienced something like that ? Any idea ?

Thx
Avatar de l’utilisateur
tomchi
Administrateur du site
 
Messages: 342
Inscription: Mer 15 Oct 2008 20:51

Re: [?] loading files

Messagede lp060 » Jeu 21 Juin 2012 20:39

Are you very sure that the buffer area you load it into is large enough? If it happens to be to small, weird problems can occur.
Avatar de l’utilisateur
lp060
 
Messages: 144
Inscription: Dim 14 Déc 2008 23:12
Localisation: My desk

Re: [?] loading files

Messagede tomchi » Jeu 21 Juin 2012 21:19

reading your answer, i understand that BLOAD may not be faulty, that means i introduced a bug i spent hours tracking without finding it ...

gonna check this and maybe raise the reserve amount
Avatar de l’utilisateur
tomchi
Administrateur du site
 
Messages: 342
Inscription: Mer 15 Oct 2008 20:51

Re: [?] loading files

Messagede tomchi » Jeu 21 Juin 2012 22:32

POINT !

Thx lonny, you were right, raised reserve and could make more loops, then checked for something like DIM and found i called a proc each time in which was something like text$=text$+"blah" .....
Avatar de l’utilisateur
tomchi
Administrateur du site
 
Messages: 342
Inscription: Mer 15 Oct 2008 20:51

Re: [?] loading files

Messagede leglod » Lun 2 Juil 2012 09:30

As-tu utiliser Reserve avant de faire des Malloc, faut pas oublier que l'interpreteur utilise de la memoire , mais bon si tu utilise une machine de 4 mo ca ne devrait pas poser de probleme reste a savoir si le GFA a prévue cela , c'est quel version ?

A l'epoque quand j'ai commencer je n'avais que 512 mo , du coup j'ai vite abandonner malloc et fait des trucs pas propre , je reserver ma memoire en partant de l'adresse video et en soustrayant mes buffers , en esperant ne pas marcher sur l'interpreteur :lol:
Avatar de l’utilisateur
leglod
 
Messages: 182
Inscription: Jeu 6 Nov 2008 22:33
Localisation: Montpellier (34) sud France

Re: [?] loading files

Messagede tomchi » Lun 2 Juil 2012 11:09

:)
je te rassures, MALLOC et RESERVE sont mes amis, j'ai appris à bien les utiliser, comme je disais à lonny, l'erreur s'était glissée dans la definition d'une chaine de caractères à laquelle à chaque appel au menu je rajoutai de la longueur, mais l'erreur est fixée depuis longtemps, enfin disons que j'en suis à règler d'autres bugs ;)
Avatar de l’utilisateur
tomchi
Administrateur du site
 
Messages: 342
Inscription: Mer 15 Oct 2008 20:51


Retourner vers English section

Qui est en ligne

Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 1 invité

cron