PiZZAMiN Posted November 17, 2010 Posted November 17, 2010 Okay, so I wanted to put an XM in a crack-me, but I can't figure out how to! I have AutoIT source, but playing from resources is very hard and dialogs are very annoying. I don't do vb6, and the .bas file doesn't work so here is the autoit source to play a file to prove i have checked docs and searched the web. #include <ButtonConstants.au3>#include <EditConstants.au3>#include <GUIConstantsEx.au3>#include <WindowsConstants.au3>$filedir = FileOpenDialog('Open the mod file', @ScriptDir, 'Mod files (*.xm)', 1)Global $bassdll = DllOpen("BASSMOD.dll") , $Init[1]Global $Chan, $Init, $VolLevel$Init = DllCall($bassdll, "int", "BASSMOD_Init", "int", -1, "int", 44100, "int", 0)$string = DllStructCreate("char[255]")DllStructSetData($string, 1, $filedir)$load = DllCall($bassdll, "int", "BASSMOD_MusicLoad", _ "int", 0, _ "ptr", DllStructGetPtr($string), _ ;"ptr", $string, _ "int", 0, _ "int", 0, _ "int", 4 + 1024);~ $Chan = 0;~ $Inst = 0$VolLevel = 100;$volume = DllCall($bassdll, "int", "BASSMOD_MusicSetVolume", "int", BitOR(BitAND($Chan, 0xFFFF), BitShift($Inst, -16)), "int", $VolLevel)$Volume = DllCall($BASSDLL, "int", "BASSMOD_SetVolume", "int", $VolLevel)DllCall($bassdll, "int", "BASSMOD_MusicPlay")While 1 $msg = GUIGetMsg() If $msg = -3 Then OnAutoItExit() Sleep(10)WEndFunc OnAutoItExit() If Not (FileExists("BASSMOD.DLL")) Then Exit Else DllCall($bassdll, "int", "BASSMOD_MusicFree") DllClose($bassdll) EndIf ExitEndFunc Thanks in advance, and I thank anyone who can help!
feverr Posted November 18, 2010 Posted November 18, 2010 Hi! I can't remember if i ever tried, but i guess you can't play xm files directly from ressources.. However, you can extract it at runtime in the temp folder for example: Import the xm file you want to play in ressources and name it "xmfile". Then extract it at runtime (form_load) to the temp folder: Private Sub Form_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim XMFilename as String = "myxmfile.xm" ' name of the xm file after extraction. Dim TempPath as String = System.IO.Path.GetTempPath() ' get the temp folder path Dim ExtractPath as string = TempPath & "\" & XMFilename ' file extraction path + xm filename ' extract the xm file to your temp folder Try System.IO.File.WriteAllBytes(ExtractPath, My.Resources.xmfile()) Catch ex As Exception MsgBox(ex.Message) 'if it fails End TryEnd Sub Once it's extracted you can use DirectX or FMod to play it, here is the FMod way: Declarations: Public Declare Function FSOUND_Init Lib "fmod.dll" Alias "_FSOUND_Init@12" (ByVal mixrate As Integer, ByVal maxchannels As Integer, ByVal flags As Integer) As BytePublic Declare Function FMUSIC_LoadSong Lib "fmod.dll" Alias "_FMUSIC_LoadSong@4" (ByVal name As String) As IntegerPublic Declare Function FMUSIC_PlaySong Lib "fmod.dll" Alias "_FMUSIC_PlaySong@4" (ByVal module As Integer) As Byte Add this to your form_load sub: FSOUND_Init (44001, 128, 0) And to play the song: Dim XMPointer as Integer = 0XMPointer = FMUSIC_LoadSong(System.IO.Path.GetTempPath() & "\myxmfile.xm") ' path to the xm file in the temp folderFMUSIC_PlaySong (XMPointer) ' play the music That's all hope this helped, if you need anything else, feel free to ask..
PiZZAMiN Posted November 22, 2010 Author Posted November 22, 2010 That's all hope this helped, if you need anything else, feel free to ask.. I can't get it to work here is my project file... Download Thanks in advance
feverr Posted November 22, 2010 Posted November 22, 2010 I just loaded your project and it works fine for me
PiZZAMiN Posted November 22, 2010 Author Posted November 22, 2010 I just loaded your project and it works fine for me the music works?!!?
feverr Posted November 22, 2010 Posted November 22, 2010 Yes it does. Do you have an error message, or the project runs fine but the music isn't playing?
PiZZAMiN Posted November 27, 2010 Author Posted November 27, 2010 Oh nvm forgot the fmod.dll in same directory, but how do I deinitialize or stop the sound at any time, so when the load is clicked in my trainer, the sound stops?
air. Posted November 17, 2012 Posted November 17, 2012 I can't get it to work here is my project file...DownloadThanks in advanceHello good Sir,Mediafire has deletded it, May You please upload it .Thank You.
Freefall63 Posted December 13, 2012 Posted December 13, 2012 Hello I have made a solution for you. Positive is, it is a full .NET solution.Negative: most chiptunes don´t work properly, because Sharpmod & NAudio are still under development. I think supported formats were *.s3m, *.xm and *.mod files. Just include the .NET dll´s afterwards with ilmerge and you have a standalone pure .NET chip Player. Cheers dude, I hope it helps.VB .NET Mod Player from Resource by Freefall.rar
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