Author Topic: UFMOD >>Step By Step Guide<<  (Read 11997 times)

0 Members and 1 Guest are viewing this topic.

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17407
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
UFMOD >>Step By Step Guide<<
« on: August 13, 2006 »
Here is a step by step guide to get a song to be included in a demo and compile it in freebasic.
First of all I want to thank Rbraz / Gvy because I am using one of his tools and some of his code here.
Also credit to Radix, I've used one of his tracks because it's small and good.

First of all download the attachment and unzip it to your desktop, you'll see that it contains
a folder called ufmod toolkit.
Inside the folder you will find;


Bin2Bas.exe
example no music.bas
ufmod.bi
ufmod.o
mustro.bas
music


The first thing I would like you to do is just to run example no music from Fbide.
You'll see a pretty 3D starfield, nothing else. Don't change anything in the listing for now.

First we'll convert the music.

The file Music in the folder used to be called "filename.xm" I just renamed it to "Music"
for your purposes, whatever XM file you use, just rename the file to "Music" this makes things easier.

We are now going to convert this with Bin2Bas so that it can be included as part of your exe.


go to the start menu on your computer
click on run
type cmd and then press enter
type cd desktop
then cd ufmod toolkit
now type Bin2Bas Music Music.bas
now type exit


In the folder ufmod toolkit you will see that another file has appeared called Music.bas
It's much bigger than the original but don't worry about that as it will shrink when compiled!

Now we need to go to wherever you have freebasic stored on your pc.

On my computer it is in;
C:\FreeBasic


So click on My computer
Then Local Disk (C:)
Then open the Freebasic folder.


We need to copy the following files from ufmod toolkit into the freebasic folder.


ufmod.bi
Music.bas
mustro.bas
ufmod.o


Now we are ready to make our 1 file exe with music :-)


Back to the start menu
run
cmd
cd\
cd freebasic
fbc -s gui ufmod.o mustro.bas


and that's it.

Your freebasic folder now contains a file called mustro.exe which if you pack it with UPX will shrink to about 30kb.
The file you compiled "mustro.bas" is identical to "example no music.bas" except that mustro has 6 comments removed.
If you can't figure out how to include ufmod after reading this tut you probably shouldn't be
coding, but if you need more help, ask.

[ edit ~ It packs down to 19.5 kb with upx -9 !!! ]
« Last Edit: August 13, 2006 by Shockwave »
Shockwave ^ Codigos
Challenge Trophies Won:

thrawn89

  • Guest
Re: UFMOD >>Step By Step Guide<<
« Reply #1 on: August 13, 2006 »
Quote
[ edit ~ It packs down to 19.5 kb with upx -9 !!! ]

Huzzah!  :||

Thrawn

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2756
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Re: UFMOD >>Step By Step Guide<<
« Reply #2 on: August 13, 2006 »
There's a little error in your code (mustro.bas), in fact it's my fault, check out this line:
Code: [Select]
hWave = uFMOD_PlaySong(@Music(0),50600,XM_MEMORY)
I forgot to mention what this number is (50600), it's the length of your music (in bytes), which in my example it should be 50601 ( just a little typo  ::) ).
And that music you have used it should be 10171 (look at music.bas --> dim shared music(0 to 10170) = 10171

 :cheers:
Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17407
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: UFMOD >>Step By Step Guide<<
« Reply #3 on: August 13, 2006 »
Ooops! I wasted 40k!
Thanks Rbraz.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline DrewPee

  • I Toast Therefore I am
  • Pentium
  • *****
  • Posts: 563
  • Karma: 25
  • Eat Cheese - It's good for you!
    • View Profile
    • Retro Computer Museum
Re: UFMOD >>Step By Step Guide<<
« Reply #4 on: August 13, 2006 »
Once again - thanks guys - excuse for me being a bit thick!

DrewPee
DrewPee
aka Falcon of The Lost Boyz (Amiga)
Ex-Amiga Coder and Graphic Designer
Administrator of > www.retrocomputermuseum.co.uk

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17407
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: UFMOD >>Step By Step Guide<<
« Reply #5 on: August 13, 2006 »
You're not thick Drew, now go and make something nice with it :)
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Dad1916

  • Atari ST
  • ***
  • Posts: 112
  • Karma: 3
    • View Profile
Re: UFMOD >>Step By Step Guide<<
« Reply #6 on: August 14, 2006 »
Thanks for the step by step guide Shockwave. O0 O0

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17407
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: UFMOD >>Step By Step Guide<<
« Reply #7 on: August 14, 2006 »
You're welcome Rootuid :)

Sorry for my little 40kb oversight guys.
You can get the size that the line;

hWave = uFMOD_PlaySong(@Music(0),50600,XM_MEMORY)

Should contain by loading in the file Music.bas and seeing how much space it allocates for the array.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: UFMOD >>Step By Step Guide<<
« Reply #8 on: August 21, 2006 »
Top tutorial dude, and really helped me understand how to use Bin2Bas ( I was dragging the files over the exe )

Hip Hip Hurray to Shockwave And Rbraz.

Cheers,
Clyde.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17407
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: UFMOD >>Step By Step Guide<<
« Reply #9 on: August 21, 2006 »
Bin2bas is essential afaic, I couldn't manage without a program like that now.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline bikerboy

  • Amiga 1200
  • ****
  • Posts: 349
  • Karma: 12
    • View Profile
Re: UFMOD >>Step By Step Guide<<
« Reply #10 on: December 21, 2008 »
very useful tut man thanx :cheers:

what is the difference between those two?

fbc -s gui ufmod.o mustro.bas
fbc -s console ufmod.o Your_Intro_Name_Here.bas
« Last Edit: December 21, 2008 by va!n »


Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17407
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: UFMOD >>Step By Step Guide<<
« Reply #11 on: December 21, 2008 »
The difference is that one of them compiles a program that doesnt create a console window and the other compiles a program that does.
Shockwave ^ Codigos
Challenge Trophies Won: