Caanoo / WIZ How To Compile Bennu Gd --> Caanoo


RZZ

Still Fresh
Joined
Aug 30, 2010
Messages
47
Age
41
Location
Pizza, Mafia, Spaghetti
very noob question:

I'm using bennu gd for my first, little game, but I can't understand how to compile: if I press "F9" I obtain only .exe file for windows, how can I obtain .gpe file ?
thanks
 
Yeah, I am also having difficulty figuring out how to get started with Bennu dev,. can't really figure how to compile at all. Where to put things and where the compiled file should be found are the issues,. . any good info please. Would be nice if it had a proper IDE with a "build for windows/linux/caanoo" type menu. Guess I will plug away at it when I find some more time to,. . looks promising though.
 
Compile your Bennu source (usually .prg) using the Bennu compiler (bgdc) on your development machine to generate a Bennu bytecode file (usually .dcb) which you then pass as an argument to the Bennu interpreter (bgdi).
 
Peter R said:
Compile your Bennu source (usually .prg) using the Bennu compiler (bgdc) on your development machine to generate a Bennu bytecode file (usually .dcb) which you then pass as an argument to the Bennu interpreter (bgdi).

in the same folder, in my SD card, in my caanoo, i put:

-bgd-runtime files
-"game".prg
-"game".fpg
-all the other files needed

ther i run a .gpe script wich contains:

bgdc "name".prg
bgdi "name"

is it correct?
my caanoo freez as I execute .gpe script
 
Last edited by a moderator:
never used bennu, but you really should not compile your bennu thing on the caanoo. compile it on your PC (bgdc name.prg) and then just launch it on the caanoo.
 
RZZ said:
Peter R said:
Compile your Bennu source (usually .prg) using the Bennu compiler (bgdc) on your development machine to generate a Bennu bytecode file (usually .dcb) which you then pass as an argument to the Bennu interpreter (bgdi).

in the same folder, in my SD card, in my caanoo, i put:

-bgd-runtime files
-"game".prg
-"game".fpg
-all the other files needed

ther i run a .gpe script wich contains:

bgdc "name".prg
bgdi "name"

is it correct?
my caanoo freez as I execute .gpe script


As an example : here is the script used by the "Laser sword demo" :

Code:
LD_LIBRARY_PATH=../bgd-runtime:$LD_LIBRARY_PATH
PATH=$PATH:../bgd-runtime
echo 2 > /proc/cpu/alignment

bgdi applaser.dcb

cd /usr/gp2x
exec /usr/gp2x/gp2xmenu

The last 2 lines restores the caanoo menu after the program exits.
without those 2 lines, you will only have a black screen after the program exits.

For the
Code:
echo 2 > /proc/cpu/alignment
I am not really sure what it does, but I think it is a compatibility trick for Bennu GD.
Try it, it may solve your problem.

Hope this helps.
 
Last edited by a moderator:
thanks pierre for your explanation
I maneged to run my game on caanoo ( :lol: )
best code i found for .gpe file is:


#!/bin/sh
LD_LIBRARY_PATH=../bgd-runtime:$LD_LIBRARY_PATH
PATH=$PATH:../bgd-runtime

echo 2 > /proc/cpu/alignment

for prg in *.prg; do
name=`basename $prg .prg`
bgdc $prg
bgdi $name
done

cd /usr/gp2x
exec /usr/gp2x/gp2xmenu




you don't need to change anything but the file-name.gpe because all .prg files found in the folder are compiled


if I'm going on like this, in 1 year I will release my game :) an r-type 2D shoot'em up
 
OK !

so I just have to delete

"bgdc $prg"

and put .dcb file in folder?

is best to compile my code on dev machine, to avoid code to be compiled every time I execute .gpe file, or is any other reason?
 
RZZ said:
OK !

so I just have to delete

"bgdc $prg"

and put .dcb file in folder?

yes, you call "bgdc $prg" on your main machine (PC), copy the ".dcb" file to your caanoo and just use "bgdi name_of_the_prg.db" to launch it.

RZZ said:
is best to compile my code on dev machine, to avoid code to be compiled every time I execute .gpe file, or is any other reason?

short answer: yes.

long answer: if you compile it on the caanoo it may get pretty boring - i don't know how fast the compiler is, but when your project gets bigger you just need the raw power of a PC to compile.
another reason is, that the end user just doesnt need and often doesnt want to have the source code, give him the final _and working_ build and he'd be happy.
that would be like, you download an application and need to compile it first before you're able to run it. and not like only once, but over and over again for every start - that's the way your script works. kinda ... u know ;)
 
Last edited by a moderator:
Very useful thread, I learnt some things from here ^^.

By the way, that line:

pierre said:
For the
Code:
echo 2 > /proc/cpu/alignment
I am not really sure what it does, but I think it is a compatibility trick for Bennu GD.

redirects the standard error output to a file named "alignment" so it won't print on screen while the program/game is running.

Salut!
 
Last edited by a moderator:
2x3r said:
pierre said:
For the
Code:
echo 2 > /proc/cpu/alignment
I am not really sure what it does, but I think it is a compatibility trick for Bennu GD.

redirects the standard error output to a file named "alignment" so it won't print on screen while the program/game is running.

sorry to say, but that's just totally wrong. this writes "2" in the /proc/cpu/alignment file, it has nothing to do with redirection. the value of 2 fixes misaligned memory access.
 
Last edited by a moderator:
crow_riot said:
2x3r said:
pierre said:
For the
Code:
echo 2 > /proc/cpu/alignment
I am not really sure what it does, but I think it is a compatibility trick for Bennu GD.

redirects the standard error output to a file named "alignment" so it won't print on screen while the program/game is running.

sorry to say, but that's just totally wrong. this writes "2" in the /proc/cpu/alignment file, it has nothing to do with redirection. the value of 2 fixes misaligned memory access.

Wow! Hahahhah!! I got it then totally wrong... The key is in the "invisible" space between... That explains why I never get the name of the file. Heheh... Anyway, it's always welcome a correction man! Now I'd like to comment just two little variants of that line just for clearance and better understanding. What will each line do?

1)
Code:
echo "2" > /proc/cpu/alignment
Would it work as well? I think so. Even like this:
Code:
echo "2"> /proc/cpu/alignment

But if the line's like this (notice the subtle lack of space between '2' and '>'):

2)
Code:
echo 2> /proc/cpu/alignment
Then it would do that error redirection that I missunderstood before.

Salut!^^
 
Last edited by a moderator:
as I said i managed to run my game on caanoo but only if my .gpe file contains:

for prg in *.prg; do
name=`basename $prg .prg`
bgdc $prg
bgdi $name
done

if, as suggested i delete bgdc $prg line, (obviously pre-compiled file is there !) the game doesen't start, why?
 
Back
Top