Posted November 17, 201014 yr 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!
November 18, 201014 yr 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..
November 22, 201014 yr Author 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
November 22, 201014 yr Author I just loaded your project and it works fine for me the music works?!!?
November 22, 201014 yr Yes it does. Do you have an error message, or the project runs fine but the music isn't playing?
November 27, 201014 yr Author 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?
November 17, 201212 yr 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.
December 13, 201212 yr 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
Create an account or sign in to comment