Exetools

Exetools (https://forum.exetools.com/index.php)
-   General Discussion (https://forum.exetools.com/forumdisplay.php?f=2)
-   -   XM files in ASM [Mini-tutorial] (https://forum.exetools.com/showthread.php?t=8554)

ADX 12-01-2005 20:50

XM files in ASM [Mini-tutorial]
 
If you want to put a XM (Modular Music) in your assembler programs, you can follow these steps:

Quote:

To play music, I use the MiniFMOD 1.60 library.

In the RC (Resource) file:

#define IDM_MUSIC 400
IDM_MUSIC RCDATA "music.xm"


In the .asm file:
You may include the libraries:

include mfmplayer.inc
includelib mfmplayer.lib


Declare the music const:

.const
IDM_MUSIC equ 400


Add the data variables:

nMusicSize DWORD ?
pMusic LPVOID ?


Put the this code on the start of the app:

start:
;chiptune
INVOKE GetModuleHandle, NULL
mov hInstance, eax
; Load the music
push esi
INVOKE FindResource, hInstance, IDM_MUSIC, RT_RCDATA
push eax
INVOKE SizeofResource, hInstance, eax
mov nMusicSize, eax
pop eax
INVOKE LoadResource, hInstance, eax
INVOKE LockResource, eax
mov esi, eax
mov eax, nMusicSize
add eax, SIZEOF nMusicSize
INVOKE GlobalAlloc, GPTR, eax
mov pMusic, eax
mov ecx, nMusicSize
mov dword ptr [eax], ecx
add eax, SIZEOF nMusicSize
mov edi, eax
rep movsb
pop esi

...
...
end start

And the code for execute the music:

invoke mfmPlay, pMusic

To free the memory (music stops):

INVOKE GlobalFree, pMusic

The needed files and this txt is attached.

This is all!
Tested on WinXP SP2. WinAsm 5.1. Compiled with MASM 8.2 (compatible with SP2)
Be happy :D !
(If you find another good "minituto" like this one, you can put it here.)

this is another not-so-mini tutorial on the same topic: hxxp://www.freewebtown.com/fusionrulez/database/xmmusicasm.zip by fornix

[EDIT:JMI] DO NOT ANSWER YOUR OWN POST. USE THE EDIT BUTTION TO ADDED TO THE ORIGINAL. OTHERWISE IT LOOKS LIKE POST COUNT PADDING AND THAT WILL GET YOU BANNED.
[About the edit:ADX]Hey, sorry JMI, I'm not answered my own post :confused: (and I'm editting now), and I found this "thing" on the net, this isn't made by me, and I didn't know about the really author of that. I don't want to "padding" posts, it's only a post for the people who don't knows how to add xm files in assember (like me). In any case, sorry, I'm new.
My regards: ADX


(So, thanks to fornix for that tutorial)

Byez

ADX Note: Because we found the author (fornix) of this tutorial, I removed the attachment.

Android 12-02-2005 13:20

Thanks for the tutorial, but is there any one which is in C or C++ ?
Plese share it, if you have any.
Regards,
Android.

acme 12-02-2005 19:50

Basexm Player Sources 11 By Shub-nigurrath, from accessroot... i think

visit:
h**p://releases.accessroot.com/

diablo2oo2 12-02-2005 21:56

1 Attachment(s)
Quote:

Originally Posted by Android
Thanks for the tutorial, but is there any one which is in C or C++ ?
Plese share it, if you have any.
Regards,
Android.

got one here

ADX 12-02-2005 22:19

Some sources
 
Well, I found something.
A Thread about XM in ASM [English]:
hxxp://www.reversing.be/forum/viewtopic.php?p=1648
In this web you can find the sources to add XM in Delphi (you need to register) [Spanish]:
hxxp://redhawk.hispadominio.com/
Thanks :)

Byez

asterix 12-02-2005 22:31

ufmod.lib and more examples
http://www.wasm.ru/src/4/ufmod.zip

xtiaoshi 12-03-2005 00:13

Extremely significant.

goggles99 12-03-2005 00:58

Channels seem reversed
 
Very nice contribs guys, thanks.
One small thing I noticed about these libs is that they reverse the right and left music channels VS WinAmp 5. Which one is correct? :confused:

ADX 12-04-2005 02:23

Some answers
 
@goggles99, I'm not sure about that. You can post this in the FMOD forum (If you are talking about MiniFMOD library: mfmplay). The programmers of this libraries will answer you (I think :D). Look at hxxp://www.fmod.com.
You can go here for uFMOD library, Korean site (and I think you can talk about, but in Korean language): hxxp://www.asmlove.co.kr/bbs/zboard.php?id=asm_forum&no=6.
About C++ and uFMOD: hxxp://www.wasm.ru/forum/index.php/index.php?action=vthread&forum=5&topic=8986
The Canterwood site. You can get here asm sources of keygens that uses XM, and more more much :D. hxxp://canterwood.online.fr/
I think this will be useful four your projects!

Byez

Android 12-05-2005 20:30

Quote:

Originally Posted by diablo2oo2
got one here

Thanks for the help.
Regards.
Android.


All times are GMT +8. The time now is 05:01.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX