Jump to content
Tuts 4 You

Masm32 Bass Source Code


Guest badboy

Recommended Posts

Guest badboy
Posted
 http://rapidshare.de/files/25159045/bass_src.zip.html

suported files MO3 / IT / XM / S3M / MTM / MOD / UMX/ MP3/WAV/MIDI AND MORE

enjoy

-Fudo

Posted

Oh.But it need bass.dll too.

Guest Buzifer
Posted
Oh.But it need bass.dll too.
http://www.dll-files.com/dllindex/download.php?bassdownload0UHeRAWJgV
Guest Firebreath
Posted

im wondering if i use, ufmod, bassmod, etc. in a keygen. would i have to include the dll file?

Posted

with ufmod you dont have to, but it only plays xm files and most effects, not all. with bass you need dll. so 5kb ufmod vs 100kb dll of bassmod

Posted
with ufmod you dont have to, but it only plays xm files and most effects, not all. with bass you need dll. so 5kb ufmod vs 100kb dll of bassmod

BASSMOD.dll is 34kb (unpacked) and can play XM, IT, S3M, MOD, MTM, UMX with very good results. But you do need to package the dll up with the keygen. PEBundle can do the job or the dll can be included as a resource.

Z

Posted

I agree with Ziggy :)

Posted (edited)

ufmod also dramatically increases the size of the tune, easily making up for the size of the dll, just might have to put a little more work into your code with bass/bassmod ;)

If anyone is actually interested in a version that creates the dll from resources at runtime (masm of course), leave a reply.

Edited by Ehtyar
Posted

A couple of months ago in2k posted a nice masm example of bassmod.dll loaded from a resource. I've attached a copy as the rapidshare link is dead.

Another example would be probably be useful.

Ziggy

bmd.zip

Guest Firebreath
Posted
ufmod also dramatically increases the size of the tune, easily making up for the size of the dll, just might have to put a little more work into your code with bass/bassmod ;)

If anyone is actually interested in a version that creates the dll from resources at runtime (masm of course), leave a reply.

that seems interesting; is it the same as what ziggy just posted?

Posted

yep, he beat me to it. started working on a c example last night. i prefer asm myself, but i need to learn c so i figured it was as good occasion as any to try. got everything working cept the play function fails and i have no idea why. anyway, if anyone's interested in a c version, leave a reply.

Guest badboy
Posted

bass.dll suport more music formats

.486
.model flat, stdcall
option casemap:noneinclude \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
include bass.incinclude \masm32\macros\macros.asmincludelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.libdialogproc proto :DWORD,:DWORD,:DWORD,:DWORD.datableh db "mod",0; change this to whatever prefix you want
syntax db "%d",0
rsrctype db "DLL",0
err db "can't read/write bass.dll",0
pathbuf db MAX_PATH dup(?)
buf db MAX_PATH dup(?); BASSMOD function names, add any others you'll need here
func1 db "BASS_Init",0
func2 db "BASS_Start",0func3 db "BASS_MusicLoad",0
func4 db "BASS_StreamCreateFile",0func5 db "BASS_ChannelPlay",0
func6 db "BASS_ChannelPause",0
func7 db "BASS_ChannelStop",0func8 db "BASS_MusicFree",0
func9 db "BASS_StreamFree",0
func10 db "BASS_Free",0
.data?hInstance dd ?
h dd ?; module handle
fh dd ?; file handle
w dd ?; receives the number of written bytes
s dd ?; size of resource (bass.dll)
buffer dd ?
resh dd ?
module dd ?
PlayOn dd ?; BASS function addresses, add any others you'll need here
BASS_Init_addr dd ?
BASS_Start_addr dd ?BASS_MusicLoad_addr dd ?
BASS_StreamCreateFile_addr dd ?BASS_ChannelPlay_addr dd ?
BASS_ChannelPause_addr dd ?
BASS_ChannelStop_addr dd ?BASS_MusicFree_addr dd ?
BASS_StreamFree_addr dd ?
BASS_Free_addr dd ?.codestart: invoke GetModuleHandle,0
mov hInstance, eax
invoke DialogBoxParam,hInstance,1000,0,addr dialogproc,0
invoke ExitProcess,0
InitBASSMOD proc
invoke FindResource,hInstance,1101,addr rsrctype
test eax,eax
jz bail_out
mov resh,eax
invoke LoadResource,hInstance,resh
invoke LockResource,eax
test eax,eax
jz bail_out
mov buffer,eax
invoke SizeofResource,hInstance,resh
mov s,eax
invoke GetTempPath,sizeof buf,addr buf
test eax,eax
jz bail_out
invoke GetTempFileName,addr buf,addr bleh,0,addr buf
test eax,eax
jz bail_out
invoke CreateFile,addr buf,GENERIC_WRITE,0,0,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,0
cmp eax,-1
je bail_out
mov fh,eax
invoke WriteFile,fh,buffer,s,addr w,0
invoke CloseHandle,fh
invoke LoadLibrary,addr buf
test eax,eax
jz bail_out
mov h,eax; start retrieving addresses, add any other calls for addresses you want to retrieve here
invoke GetProcAddress,h,addr func1
mov BASS_Init_addr,eax
invoke GetProcAddress,h,addr func2
mov BASS_Start_addr,eax
invoke GetProcAddress,h,addr func3
mov BASS_MusicLoad_addr,eax
invoke GetProcAddress,h,addr func4
mov BASS_StreamCreateFile_addr,eax
invoke GetProcAddress,h,addr func5
mov BASS_ChannelPlay_addr,eax
invoke GetProcAddress,h,addr func6
mov BASS_ChannelPause_addr,eax
invoke GetProcAddress,h,addr func7
mov BASS_ChannelStop_addr,eax
invoke GetProcAddress,h,addr func8
mov BASS_MusicFree_addr,eax
invoke GetProcAddress,h,addr func9
mov BASS_StreamFree_addr,eax
invoke GetProcAddress,h,addr func10
mov BASS_Free_addr,eax
mov eax,1
ret
bail_out:
xor eax,eax
ret
InitBASSMOD endpdialogproc proc hwnd:DWORD,m:DWORD,wp:DWORD,l:DWORD
LOCAL msg[5]:BYTE
LOCAL hResInfo:DWORD
LOCAL nMusicSize:DWORD
LOCAL pMusic:DWORD .if m==WM_INITDIALOG
invoke InitBASSMOD
.if !eax
invoke MessageBox,hwnd,addr err,addr err,MB_OK
invoke ExitProcess,0
.endif
push 0
push hwnd
push 0
push 44100
push -1
call BASS_Init_addr
call BASS_Start_addr
.if eax!=NULL
invoke FindResource,hInstance,1100,addr rsrctype
mov hResInfo,eax
invoke LoadResource,hInstance,hResInfo
invoke LockResource,eax
mov pMusic,eax
invoke SizeofResource, hInstance, hResInfo
mov nMusicSize, eax
.if eax!=NULL
push 0
push BASS_SAMPLE_LOOP or BASS_MUSIC_POSRESET or BASS_MUSIC_RAMPS
push nMusicSize
push 0
push pMusic
push 1
call BASS_MusicLoad_addr
.if !eax
push BASS_SAMPLE_LOOP or BASS_MUSIC_POSRESET or BASS_MUSIC_RAMPS
push nMusicSize
push 0
push pMusic
push 1
call BASS_StreamCreateFile_addr
.endif
mov module, eax
.endif
.else
invoke wsprintf,addr msg,addr syntax,FUNC(GetLastError)
invoke MessageBox,hwnd,addr msg,addr msg,MB_OK
.endif
mov PlayOn, FALSE
mov eax,1
ret .elseif m==WM_COMMAND
mov eax,wp
.if ax==30
invoke DestroyWindow,hwnd
.elseif ax==10
.if PlayOn == FALSE
push 0
push module
call BASS_ChannelPlay_addr
mov PlayOn, TRUE
.else
push module
call BASS_ChannelPause_addr
mov PlayOn, FALSE
.endif
.endif
.elseif m==WM_LBUTTONDOWN
invoke ReleaseCapture
invoke SendMessage,hwnd,WM_SYSCOMMAND,0F012h,0 .elseif m==WM_DESTROY
call BASS_Free_addr
invoke FreeLibrary,h
invoke DeleteFile,addr buf
.endif
xor eax,eax
ret
dialogproc endpend start
Posted

Code from the un4seen forum ported to bass, nice job. Anyway, remind me never to copy/paste typedefs *slaps self with tuna blablabla*. The c code is finnished and up for grabs for those who want :)

Posted (edited)

It's pretty good,Badboy!

But I can't get a point of calling SizeofResource and LockResource (in case of BASS_MusicLoad).

Edited by jn2k
Posted

SizeOfResource is passed to bass to specify the length of the tune, and LockResource prevents windows from swapping the data out of memory.

Posted

Thanks for an answer, Ehtyar!

I exactly know what these functions for.

I just would like to say what in case of calling BASS_MusicLoad it is not necessary.

You can check it in the help file.

Posted

Whoever said they were necessary? Since there is a space for the arguement in BASS, there is obviously some reason for it, so you might aswell use it. And as for LockResource, well i wouldn't really want a resource that's in constant use to be swapped out of memory...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...