The MASM Forum Archive 2004 to 2012

Specialised Projects => Assembler/Compiler Technology => Topic started by: bacchus on June 27, 2007, 01:33:12 PM

Title: using libv2 in masm
Post by: bacchus on June 27, 2007, 01:33:12 PM
i tried to use kb's/farbrausch Viruz2 libv2 replayer lib in an masm code, but got several link error's... after adding the needed c++ lib's , all what was asked for linking process.. but now stocking on an link error.

who has experients in mixing/linking c++ code into masm ?

Title: Re: using libv2 in masm
Post by: drizz on June 27, 2007, 02:04:56 PM
there shouldn't be any problems if you define your masm file like this:
;GUI
.686
.model flat,stdcall
option casemap:none
;; put include files here
;; put lib files here OR in linker command line
.code
WinMain proc STDCALL public uses esi edi ebx, hInst:HINSTANCE,hPrevInstance:HINSTANCE,lpCmdLine:LPWSTR,nShowCmd:SDWORD
ret
WinMain endp
end
;CONSOLE
.686
.model flat,stdcall
option casemap:none
;; put include files here
;; put lib files here OR in linker command line
.code
main proc C uses esi edi ebx argc:dword,argv:ptr dword
ret
main endp
end

ie, you don't force your entrypoint with start label and you define correct functions that are called after c++ lib startup
Title: Re: using libv2 in masm
Post by: drizz on June 27, 2007, 03:27:56 PM
i have converted the example from the package.  :8)
"includelib libcmt.lib" in source reffers to lib file that is part of "Visual C++ Toolkit 2003"
libc.inc is file that i made


[attachment deleted by admin]
Title: Re: using libv2 in masm
Post by: Mark Jones on October 10, 2007, 01:03:39 AM
...Amazing! I'm shocked nobody else has commented about this, it's simply unbelievable!
Title: Re: using libv2 in masm
Post by: Frank on October 10, 2007, 08:36:14 AM
Quote from: Mark Jones on October 10, 2007, 01:03:39 AM
...Amazing! I'm shocked nobody else has commented about this, it's simply unbelievable!
Mark Jones, you are absolutely right. Some guys here do incredibly good work but nobody comments, it's a shame. Let me fill the gap: VERY WELL DONE, DRIZZ! :clap:
Title: Re: using libv2 in masm
Post by: drizz on October 10, 2007, 10:38:13 AM
hehe thanks guys!
Title: Re: using libv2 in masm
Post by: Mark Jones on October 10, 2007, 03:27:36 PM
...Now if only there was a tracker front-end for writing new songs. :wink
Title: Re: using libv2 in masm
Post by: Vortex on October 10, 2007, 04:53:00 PM
Hi drizz,

Nice job :U
Title: Re: using libv2 in masm
Post by: Genl on May 16, 2008, 09:02:23 PM
V2 synthesizer system has been updated recently, now it's v1.5: http://www.1337haxorz.de/products.html
It supports more tunes and has more features now.

libv2 has been updated also, i tried it out but with no luck. First, there were problems converting libv.h to libv2.inc, it was solved by using h2incx with -u flag. But now i can't understand how to call all required functions, for example dsInit - it crashes my app if addressed to hWnd for some reason. Yeah, i'm a novice coder, so some things are too complicated for me now.

Will it be interesting enough for someone to help in sorting out all these things?
Title: Re: using libv2 in masm
Post by: drizz on May 17, 2008, 07:01:00 PM
Yeah the new lib is not very straight forward like the previous.
Example provided in the new package uses c++ source player that needs to be copiled with libv2 to play songs (or to write your own (translate) in desired language). So i have created a new "library", it is libv2 with that c++ code player and a proxy that calls that player with "C" defined functions suitable for linking with masm (and any other COFF compatible compiler). Of course libcmt.lib still has to be included. "Tune" file is converted to .obj file and linked with the project.

This is only for playing songs, nothing more and nothing less...

cheers

[attachment deleted by admin]
Title: Re: using libv2 in masm
Post by: drizz on May 18, 2008, 02:14:29 AM
I've made a workaround for libcmt, as to why the autors didn't compile their source with "/Zl" switch i don't know.
It seems to work without it...


[attachment deleted by admin]
Title: Re: using libv2 in masm
Post by: Genl on May 18, 2008, 05:00:27 PM
Great work! Thank you, drizz! :thumbu
Title: Re: using libv2 in masm
Post by: diablo2oo2 on May 19, 2008, 09:23:36 PM
does the new lib work on vista and now also support loop playback?
Title: Re: using libv2 in masm
Post by: Genl on May 26, 2008, 12:22:53 PM
diablo2oo2
I'm pretty sure it works on Vista, drizz's sample works at least. But unfortunately it crashes on many old tunes for me... At the other side it allows to play some new tunes created with updated V2-tracker.
And loop playback can be done using 'V2MIsPlaying' function in drizz's sample, dunno about original sources.
Title: Re: using libv2 in masm
Post by: diablo2oo2 on May 26, 2008, 09:18:33 PM
@Genl:
Thank you for this information. Since there are more old v2m tracks avaible on the web i think i will keep the old version of libv2...
Title: Re: using libv2 in masm
Post by: herge on May 30, 2008, 12:01:30 AM

Hi drizz:

I don't like the music but
I do like the code.

Great work.

Regards herge.