yamraaj Posted May 4, 2007 Posted May 4, 2007 (edited) mfmplayer=modified/ripped MiniFMOD Edited May 4, 2007 by yamraaj
Ufo-Pu55y Posted May 5, 2007 Author Posted May 5, 2007 (edited) mfmplayer=modified/ripped MiniFMODYa, I've read about it, too I like mfmplayer more, coz I can read out pattern+position with one call - with MiniFMOD I need two calls. Anyway I didn't understand a s* in the C++ source for MiniFMOD... I mean how to initialize So I went over to convert the MASM-Init of MFMPlayer into C++. That's, what I've got so far: unsigned long nMusicSize;LPVOID pMusic;HRSRC rec;HGLOBAL handle;void *nMusicData;// Initialize MiniFMODrec = FindResource(NULL, MAKEINTRESOURCE(ID_Chiptune), RT_RCDATA);nMusicSize = SizeofResource(NULL, rec);handle = LoadResource(NULL, rec);nMusicData = LockResource(handle);pMusic = GlobalAlloc(GPTR, nMusicSize+(sizeof nMusicSize)); Which is taken from: hInstance HINSTANCE ?nMusicSize DWORD ?pMusic LPVOID ?; Initialize MFMPLAYER: invoke FindResource, hInstance, ID_Chiptune, RT_RCDATApush eaxinvoke SizeofResource, hInstance, eaxmov nMusicSize, eaxpop eaxinvoke LoadResource, hInstance, eaxinvoke LockResource, eaxmov esi, eaxmov eax, nMusicSizeadd eax, SIZEOF nMusicSizeinvoke GlobalAlloc, GPTR, eaxmov pMusic, eaxmov ecx, nMusicSizemov dword ptr [eax], ecxadd eax, SIZEOF nMusicSizemov edi, eaxrep movsb But I've really got no clue, how to convert the last 5 MASM lines into C++ I mean how to pump the nMusicData into the allocated memory. Please, could somebody help me out ? It's for a good purpose... Edited May 5, 2007 by Ufo-Pu55y
human Posted May 5, 2007 Posted May 5, 2007 first learn basics of c++ then convert, all you need is pointers and type casting, copy you can do 2 ways, move bytes with for or use memcpy. when you declare char *mymusic you need to put in 1st 4 bytes size of xm, then 4 bytes later copy xm.
yamraaj Posted May 5, 2007 Posted May 5, 2007 If still not found http://blog.csdn.net/linhanshi/archive/200.../03/542586.aspx
Ufo-Pu55y Posted May 5, 2007 Author Posted May 5, 2007 (edited) If still not found http://blog.csdn.net/linhanshi/archive/200.../03/542586.aspx Ah, thanks, yamraaj !!! I'm still trying everything what comes on my way !But it's again (as always) kinda long winded approach with sh!tloads of .Cs and .Hs... Actually converting my whole MASM source into C++ was like a fingersnip, until I went to include mfmplayer/minifmod. But the init of it turned into hell for me... I didn't intend to go C++1337 - I just thought, that my tutorial would be more useful, if it comes with C++ sources, too... for the ones not familiar with MASM. I'm still yearning for a solid C++ coder, who could kick my a* and just tell me how to f* get the XM into the allocated memory Without any theory - just a handful of concrete lines of code... I'm already going nut with all these stars and parenthesis... Greets Edited May 5, 2007 by Ufo-Pu55y
Killboy Posted May 5, 2007 Posted May 5, 2007 Yeh, I think pointers are one of the biggest problems beginners encounter when learning C++...But once you got used to it (try coding some app that manipulates code or the PE header) it's easy...
human Posted May 5, 2007 Posted May 5, 2007 pointers are easy, real mess is type casting, something defined as char and you need to write word,byte,dword also alone calculate displacement, and according to type, try to find on next how to write dword to char type at position 3.none of tuts explain how to do it and its simplest thing in asm. thats why i prefer asm, fast, complex, small and only limitation is cpu and knowledge not syntax
Ufo-Pu55y Posted May 5, 2007 Author Posted May 5, 2007 pointers are easy, real mess is type casting, something defined as char and you need to write word,byte,dword also alone calculate displacement, and according to type, try to find on next how to write dword to char type at position 3.none of tuts explain how to do it and its simplest thing in asm. thats why i prefer asm, fast, complex, small and only limitation is cpu and knowledge not syntax You're mentioning exactly the problem, which I had the last hours I had to write a 'long' into an array of 'chars'. I was reading my a* off in google and ebooks, but NOTHING about that... On the other side, it's ok, I always wanted to know some C++. For example I didn't expect that I can even XOR or SHL/SHR in C++. So I went like this: nMusicData = LockResource(handle);char* MusicMem = 0;MusicMem = new char[nMusicSize+(sizeof nMusicSize)];long SizeConv = nMusicSize;MusicMem[0] = SizeConv;SizeConv >>= 8;MusicMem[1] = SizeConv;SizeConv >>= 8;MusicMem[2] = SizeConv;SizeConv >>= 8;MusicMem[3] = SizeConv;MusicMem += 4;memcpy(MusicMem, nMusicData, nMusicSize);mod = FMUSIC_LoadSong(MusicMem, NULL); Anyway I've got an exception after calling FMUSIC_LoadSong... :/ (... reading location 0x00000000) ??? Gotta try on
Killboy Posted May 6, 2007 Posted May 6, 2007 (edited) Correct me if Im wrong, wouldnt long to char array be like this: char Monkey[4]; long Whatever; char * MonkeyPtr = &Monkey; *(long *)MonkeyPtr = Whatever; I believe this one works as well: *(long *)Monkey = Whatever; Pointers can be used as arrays too, if im not totally mistaken: char * Blub = &Somewhere; Blub[1] is similar to *(Blub+1)) "write dword to char type at position 3" I think writing dword to dword pointer + 3 is harder :/ DwordPtr+1 is not DwordPtr + 1 byte but DwordPtr + 4 bytes (dword) Thats like increasing an array (DwordPtr and i++) Should be like this: *(DWORD *)((DWORD)DwordPtr+3) = Whatever; You gotta make the pointer a normal dword, add 3 to it (so it doesnt increase some array index of the pointer) and convert it back to a pointer.. Ugly but it should work Edited May 6, 2007 by Killboy
Ufo-Pu55y Posted May 7, 2007 Author Posted May 7, 2007 @Killboy: Thanks for clearing that up But the time of suffering has ended some mins ago... I've found a link for a template in an ARTeam topic: _http://jardinezchezjb.free.fr/tools/forumcrack-spaceship-template.zip I hope it's ok to attach it, too (coz it doesn't look like it lasts very long) : forumcrack_spaceship_template.zip 1) It uses MiniFMOD, the way I was interested in !!! 2) It has the f* greatest AboutBox, I've ever seen in my life !i!i!i! :thumbsup: *taking a bow to jB/FFF* Greets
ChupaChu Posted July 11, 2007 Posted July 11, 2007 @UFO-Pu55y: I am searching also for a way to implement MOD or XM music into my project. I am using a VB6, and have tried uFMOD but was not able to make it run on my system If you have any ideal or sugestion how to add background music to my VB6 project it would be greately apreciated!
Ufo-Pu55y Posted July 11, 2007 Author Posted July 11, 2007 I am using a VB6, and have tried uFMOD but was not able to make it run on my system Um.. did u try it like this ? VB_ufmod.rar Greets
ChupaChu Posted July 11, 2007 Posted July 11, 2007 (edited) I am using a VB6, and have tried uFMOD but was not able to make it run on my system Um.. did u try it like this ? VB_ufmod.rar Greets Yes, exactly that i tried. I get msgbox "uFMOD not found" - check txt for info.. I also folowed this instruction: WARNING!uFMOD currently supports ONLY Microsoft Visual Basic 6. Neither older releases, nor .NET are supported! So, you want to use uFMOD in your VB6 application? You'll need to complete the following steps: 1. You need to include uF_vb.bas (WINMM version) or DSuF_vb.bas (DirectX) into your project. Do not rename this file. Do not modify it's contents. Place it into the main directory of your project. Place ufmod.lib (WINMM version) or dsufmod.lib (DirectX) into the same location as uF_vb.bas or DSuF_vb.bas. Copy the DirectSound type library dsound.tlb to the same location when using the DirectX version. 2. Target type should be EXE. 3. Find the directory where VB6.EXE is installed (i.e. \Program Files\Microsoft Visual Studio\VB98\). Rename LINK.EXE to LNK.EXE. Copy the included link.exe file into that directory. Full source code is included. The modified linker is able to build any application: with or without uFMOD. Though, you may restore the original linker from LNK.EXE whenever you want to. I dont know hat i'm doing wrong EDIT: I just noticed that it does not work when you try to run the project, but when it gets compiled as exe - then it runs ok! Next problem i now have is i dont know how to buidl a valid .RES file?! (i tried syamtech Resource studio, but it creates unrecognizable .res file) I also tried to remove mini.res from original example (the one that works when compiled) and replace it with mine .xm file (using visual studio resurce editor), changed name and ID to mach original, but guess what!? - it does not make any sound at all Edited July 11, 2007 by ChupaChu
Departure Posted July 29, 2007 Posted July 29, 2007 Vb6 comes with a resource editor, it just needs to be included , you do this by going to add-ins, then add-in manager and choosing the resource editor from there,
hmi222 Posted March 25, 2008 Posted March 25, 2008 Did anybody ever see any LIBs to be able to play back other formats than ".xm" ???I was looking for a LIB that can play ".mod", but couldn't find one... ./Just look here for playing "FutureComposer-Modules" http://www.dawncreations.com/index.php?topic=258.0Cheers Hmi222
hmi222 Posted March 27, 2008 Posted March 27, 2008 A Small TinySID Player to play SID (C64) SOunds... Works greathttp://dbfinteractive.com/index.php?topic=2333.0
Ufo-Pu55y Posted March 27, 2008 Author Posted March 27, 2008 A Small TinySID Player to play SID (C64) SOunds... Works greathttp://dbfinteractive.com/index.php?topic=2333.0That sounds interesting :")But I couldn't find any lib.. only players. Is it available ?Thanks
hmi222 Posted March 27, 2008 Posted March 27, 2008 A Small TinySID Player to play SID (C64) SOunds... Works greathttp://dbfinteractive.com/index.php?topic=2333.0That sounds interesting :")But I couldn't find any lib.. only players. Is it available ?ThanksOh Sorry... think yu must be registered!wait ill send!
hmi222 Posted March 29, 2008 Posted March 29, 2008 New V2M library: LIBv2 V1.5http://www.1337haxorz.de/products.htmlWith Synthesizer stuff in it this time.....Best replayer I ve ever heard!Cheers hmi222
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now