Jump to content

Help using data from resource


Recommended Posts

Hi AutoIt Forums,

I've been reading Zedna's UDF on including binary data in your script. I would ultimately like to attach a dll (bassmod) and a xm file (chiptune), and would like the dll to access the chiptune? Is this currently possible with AutoIt?

http://www.autoitscript.com/forum/index.php?showtopic=51103 <--- Zedna's UDF

http://www.autoitscript.com/forum/index.php?showtopic=52712 <--- Chip-It

This is what I have so far, but it doesn't work. Does anyone know what I am doing wrong?

#AutoIt3Wrapper_useupx=n
#AutoIt3Wrapper_run_after=ResHacker.exe -add %out%, %out%, 2.xm, rcdata, TEST_XM_1, 0
;#AutoIt3Wrapper_run_after="c:\Program Files\AutoIt3\Aut2Exe\upx.exe" --best "%out%"

#include "resources.au3"

$hBmp = _ResourceGet("TEST_XM", $RT_RCDATA)

If FileExists("BASSMOD.dll") Then
$bassdll = DllOpen("BASSMOD.dll")
$Init = DllCall($bassdll, "int", "BASSMOD_Init", "int", -1, "int", 44100, "int", 0)
$Name_H = DllStructCreate("char[255]")
DllStructSetData($Name_H, 1, "$hBmp")
$Lod = DllCall($bassdll, "int", "BASSMOD_MusicLoad", "int", 0, _
                "ptr", DllStructGetPtr($Name_H), _
                "int", 0, _
                "int", 0, _
                "int", 1028)
DllCall($bassdll, "int:cdecl", "BASSMOD_MusicPlay", "int", $Init[0])
EndIf

While 1
    $msg = GUIGetMsg()
    IF $msg = -3 Then Exit
WEnd

Func OnAutoItExit()
    If Not (FileExists("BASSMOD.DLL")) Then
        Exit
    Else
        DllCall($bassdll, "int:cdecl", "BASSMOD_MusicFree", "int", $Init[0])
        DllClose($bassdll)
    EndIf
EndFunc

Or would anyone know where to get started?

Link to comment
Share on other sites

The second link of my post in this topic has a working mod player, and I have successfully used it to play files that are on the hard drive. What I really want to do is have the bassmod.dll and *.xm file embedded as a resource and have a stand alone compiled script that doesn't write to the hard drive.

Thank you anyways muttley

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...