I cannot figure out how to convert my XM to a data dump that I could then use in my .data section
That is the easy part, use the attached tool: Just drag the xm file over the exe (works with any type of file, but there may be size limits, see SetClip$).
Once it's on the clipboard, use the data as follows:include \masm32\include\masm32rt.inc
.code
start:
mov ebx, offset dend
mov edi, offset dstart
sub ebx, edi
... your code here ...
print str$(edi), " is the start of the buffer", 13, 10
inkey str$(ebx), " bytes are available", 13, 10
exit
dstart:
db 045h, 078h, 074h, 065h, 06Eh, 064h, 065h, 064h, 020h, 04Dh, 06Fh, 064h, 075h, 06Ch, 065h, 03Ah
db 020h, 048h, 061h, 070h, 070h, 079h, 020h, 048h, 02Eh, 020h, 043h, 068h, 072h, 069h, 073h, 074h
...
db 021h, 000h, 000h, 000h, 020h, 020h, 020h, 020h, 020h, 020h, 020h, 073h, 069h, 067h, 06Eh, 065h
db 064h, 02Ch, 020h, 044h, 052h, 041h, 058h, 000h, 000h, 000h, 080h, 000h, 000h, 028h, 000h, 000h
db 000h
dend:
end start
Well that method was way too messy, so what I've done instead is added an obj file that was created from the XM file to the linker. I tried adding the inc file created from the XM to the linker instead, but Visual Studio complained that it was invalid.
The inc file has this in it:
; -----------------------------------------------------
; Include the contents of this file in your source file
; to access the data as an OFFSET and use the equate as
; the byte count for the file data in the object module
; -----------------------------------------------------
EXTERNDEF MyXMFile:DWORD
ln_MyXMFile equ <26087>
I've placed this code in the .data segment. I acquired a copy of the ufmod.inc and ufmod.lib and added them to my project like so:
include ufmod.inc
includelib ufmod.lib
After that, I tried loading the offset for my XM file in eax like this:
lea eax, MyXMFile
I followed this line up with:
invoke uFMOD_PlaySong, eax, 0, 0
Moving the offset of MyXMFile to eax seems to have worked, but when I try to do the "PlaySong" part, I get an entire collection of "unresolved external symbol" errors. Here is the section of Visual Studio's output pertaining to this issue.
1>ufmod.lib(ufmod.obj) : error LNK2001: unresolved external symbol __imp__waveOutClose@4
1>ufmod.lib(ufmod.obj) : error LNK2001: unresolved external symbol __imp__waveOutGetPosition@12
1>ufmod.lib(ufmod.obj) : error LNK2001: unresolved external symbol __imp__waveOutOpen@24
1>ufmod.lib(ufmod.obj) : error LNK2001: unresolved external symbol __imp__waveOutPrepareHeader@12
1>ufmod.lib(ufmod.obj) : error LNK2001: unresolved external symbol __imp__waveOutReset@4
1>ufmod.lib(ufmod.obj) : error LNK2001: unresolved external symbol __imp__waveOutUnprepareHeader@12
1>ufmod.lib(ufmod.obj) : error LNK2001: unresolved external symbol __imp__waveOutWrite@12
Where do I go from here? I am fairly certain that I am close, but I am still not quite there.