|
D programming language by Digital Mars
最初由 auser 发布 Each language has it use. But the development is not easy. |
|
|
|
|
|
|
|
[翻译]从EXETOOL翻译一贴:XM files in ASM [Mini-tutorial]
How to play XM Music From your own code ======================================= Over View ========= Heya all, the perefect way to play XM music is by using the MiniFmod. since it is free to use, we can producereally cool keygens. i'v choosed keygens as the perfect taregt to play music on, as we all know its cool in the end. allright, lets begine. first we will deal with the music. The best way to find our XM music is the mod archive located at: http://www.modarchive.com/ it is a huge archive, and allot of cool music can be found there, so just before coding, select ur file (recomended size : 2k-30k) i especially like the "Hybrid Song.XM", (i first heard it in a installer of Worms :-) ) or "trainer.XM", but i am sure there are millions of them out there. once we choose our music, we need to dump its content!! now, sicne this article is for Visual C++ coders, our dump is apparently C++ style hex. for the dumping rutine we will use Thigo's exccelent Table Extractor, located at protools/anticrack..or just google for it. Duming Table ============ /* Dumping Hybrid Song.XM (51k) */ Load your XM file in Thigo's Table extractor, now we need to supply few info to the program: Address (HEX): 0 Items: Bytes Size (Bytes) of Table(Hex): CCD4 /* File Size */ Number Of Items on a Line: 20 /* put how many you like personally i put 20 */ C/C++ /* Dump Style Language */ Dump to file: checked /* [v] */ ok, we dont need anymore options filled, Press the "Go !" button and we see our thread make an effort to dump the Image as fast as possible ;-), 0....100%, great Table dumped in result.txt (same dir as the XM file). Coder Point of View =================== look at the dumped results.txt..geesh, it is very big..(300k) yes, thats the coast of files that have 20++k and above!, so keep in mind that since your making a keygen, the file should be as minimal as possible, but consider the best sound u can get :-) save this file somewhere, we need to use some source code from now on. The MiniFmod ============ information about MiniFmod 1.6: This small XM replay system only adds 5k to your exe! Now including FULL SOURCE CODE!!! FEXP tool to export a header based on your song, which will be compiled into MiniFMOD and exclude whole portions of code! Pre-buffered output for 0 latency, and high output stability 100% click free. XM sample callbacks for user generated or compressed XM samples! File system callbacks so you can specify whatever loading system you like! (disk/wad/memory) Copyright 2001-2002 Firelight Technologies Pty. The MiniFmod can be found at http://www.Fmod.org or for quick download: http://www.fmod.org/files/minifmod160.zip note: I dont use the GCC, so if you do, u'll have to sort things out :-) The Tools: ========== inside the MiniFmod package, there is a small tool called Fexp.exe, this will be our XMeffects optimizer for the dumped result.txt!! other that, we have the *.c/*.h files that we will incldue in our program. i have included a keygen template which will suite us for including the sound code. that way, we will code together step by step. ok, get the template and load the DSW into VC++ IDE. it is a very basic keygen with 3 buttons, Generate, Play, About. our main goal is to make the sound be playble via the Play button, it is later to be loaded automatiaclly when keygen starts. ok, so we have our keygen.cpp with everything ready. Starting to Code ================ the Sound must have an Handle, of course, that way we can determine whenever we try to stop, reload, and even sharing with other sound players (i.e: Winamp) as a global variable, we start with: FMUSIC_MODULE *mod; /* fmod music handler */ now, before we add more code, lets add to our project the minifmod functions and main code. make a new folder in the keygen's main folder, call it "Lib" you can see it is also in the minifmod16.zip copy the files from the minifmod16.zip\lib -> our lib folder note: in the zip\lib there is 2 folders named "debug/final" don'not copy its content! alright, now back to our project, in the project dir viewer, make a folder named "MiniFmod.c" (under the Source Files folder) add all *.c files into it from our lib folder. these files are: 1. Fmusic.c 2. Fsound.c 3. mixer_clipcopy.c 4. mixer_fpu_ramp.c 5. music_formatxm.c 6. system_file.c now we need to add the header files (*.h), make a new folder named "MiniFmod.h" (under the Header Files folder) add all *.h files into the it from our lib folder + the lib file. these files are: 1. minifmod.h 2. Mixer.h 3. mixer_clipcopy.h 4. mixer_fpu_ramp.h 5. Music.h 6. music_formatxm.h 7. Sound.h 8. system_file.h 9. system_memory 10. xmeffects.h 11. winmm.lib ; not an *.h file, but dont forget to add it too!!! now, since its a keygen and using the standard minifmod source is not enough, we will make some modifications into its code, that means some files from the original has been slighly modifyed to suite our needs! note: the modified files has been added to the source code, so i took of it already. another thing we need to do is to create a new folder named "loadmusic.h" (under the Header Files folder). now listen carefully, remember the result.txt we have dumped ? we will use it's hex dump as the file it self!, rename the result.txt -> music.h (as specified in the modified files :-)) open it (be carefull, editing big files can cause a crash :-)), now we need to edit the file a bit. original Dump: ============== static unsigned char table[52436] = {}; Modified Dump: ============== #define MUSIC_LEN 4092 static unsigned char music[]= { }; note: the diffrences, always do this when trying to load new music into ur keygen!!! once we finished editing and saving, we need to make a new *.h file: open notepad and write/paste this code: //=============================================================== #ifndef __LOADMUSIC_H__ #define __LOADMUSIC_H__ // Memory functions unsigned int memopen(char *name); void memclose(unsigned int handle); int memread(void *buffer, int size, unsigned int handle); void memseek(unsigned int handle, int pos, signed char mode); int memtell(unsigned int handle); void loadmusic(void); // Load music fucntion #endif //============================================================== its a few addons, basically we are making it easier for us to load the dumped xm file into memory and make it playble. save this file as loadmusic.h finally, we add those 2 files (music.h / loadmusic.h) into the loadmusic folder. last and not least, we need to add the loadmusic.cpp, which is ofcourse not a part of minifmod, as i said it is our modified code. make a folder named "loadmusic.c" (under the Source Files fodler). add this file (loadmusic.cpp) allright, this fun the setup part of minifmod, we now need to add those as #include in our main keygen.cpp #include "loadmusic\loadmusic.h" #include "lib\minifmod.h" #include "lib\buffer.h" note: if you take a look at loadmusic.cpp you can see our music.h declared there, along with our new modified functions. The Last Touch ============== we have declared the handle of our fmod music rememebr? FMUSIC_MODULE *mod; right, all we need to do is to set the Fmod up and load the dumped xm file (music.h) into memory and alst call the play function! at our play button id code (case IDC_PLAY:) we add this code: if (mod == NULL) // mod handle is free? (though it will work fine with other loaded audio devices) { // We defined our music file to be loaded in loadmusic.cpp // //=============================================================// loadmusic(); // Call & set ready memory to load the music if(!FSOUND_Init(44100, 0)) // intialize memory for sound and format { break; } mod = FMUSIC_LoadSong(NULL, NULL); // handle = LoadSong() FMUSIC_PlaySong(mod); // Play it (from memory), way cool!! } note: if you put this code in the WM_INITDIALOG, you will get autoplay effect when loading the keygen! if we want to Stop the music only thing we need to do is add new button called Stop, choose an ID to it and use this code: if (mod != NULL) // handle is loaded (playing)? { FMUSIC_FreeSong(mod); // Free memory (handle) FSOUND_Close(); // Close it (stop it from playing) mod=NULL; // make handle to be Free again } note: add same code at WM_CLOSE msg!! Important Tips ============== this is the part where if u dont read it, u will get a funny results when playing your XM file!! /* from Firelight's readme */ Making your exe even smaller with XMEFFECTS.H and FEXP.EXE: - Note all the effects in the xm replay code are wrapped with #ifdef's. They are defined in xmeffects.h. - Have a look in the zip/lib directory .. There is an executable called FEXP.EXE - Use FEXP.EXE on an xm file and it will generate xmeffects.h for you! - Recompile the minifmod library with the new xmeffects.h - See your exe size go down AGAIN! - (only play the song you fexp'ed or it will screw up on other songs probably :) ..) yup, this mean, we make a new xmeffects.h for each music file we dump!! else as said, we have a screwed up music :-) -> fexp Hybrid_Song.XM -> xmeffects.h overwrite the old xmeffects.h in our keygen\lib\ folder, and recompile our source code, see your music plays fine. some little note is that the minifmod abit looses the quality of the music, well this is understandble since minifmod is not a part of the fmod library, so it does miss some important stuff, but hey, nothing is perfect!! for me, it rox to have cool sound in keygens, and now you guys too. Ending ====== well,this complete the essay, the best way to learn from it is by using the files included in the compiled keygen, that way u can always have this as a base keygen. MiniFmod is coded by FireLight (r) Keygen source code + music coded by Ben & [Goofy] of FreeStylerS 2002 greets to all RCE members, and the REA community! |
|
多谢fly老大指点,刚才的贴实在是对不起!
在论坛以后使用别人的头像的复制品,我看很遗憾。 |
|
|
|
|
|
|
|
|
|
[ZT]HzorInline v 1.3 beta by arnix
- [ v 1.3 beta build 20051201 ] * Fixed "OEP +1 byte" NsPack modules bug + Added XP style manifest, if you don't like it just delete the "HzorInline.exe.manifest" file + Some PE file parsing improvments in the main program 附件:hzorinline_v1.3_b20051201.rar |
|
脱壳区无法进入 kv2006误报吗?
初次看到。 |
|
|
操作理由
RANk
{{ user_info.golds == '' ? 0 : user_info.golds }}
雪币
{{ experience }}
课程经验
{{ score }}
学习收益
{{study_duration_fmt}}
学习时长
基本信息
荣誉称号:
{{ honorary_title }}
能力排名:
No.{{ rank_num }}
等 级:
LV{{ rank_lv-100 }}
活跃值:
在线值:
浏览人数:{{ visits }}
最近活跃:{{ last_active_time }}
注册时间:{{ user_info.create_date_jsonfmt }}
勋章
兑换勋章
证书
证书查询 >
能力值