News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

using libv2 in masm

Started by bacchus, June 27, 2007, 01:33:12 PM

Previous topic - Next topic

bacchus

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 ?


drizz

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
The truth cannot be learned ... it can only be recognized.

drizz

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]
The truth cannot be learned ... it can only be recognized.

Mark Jones

...Amazing! I'm shocked nobody else has commented about this, it's simply unbelievable!
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

Frank

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:

drizz

The truth cannot be learned ... it can only be recognized.

Mark Jones

...Now if only there was a tracker front-end for writing new songs. :wink
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

Vortex


Genl

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?

drizz

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]
The truth cannot be learned ... it can only be recognized.

drizz

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]
The truth cannot be learned ... it can only be recognized.

Genl

Great work! Thank you, drizz! :thumbu

diablo2oo2

does the new lib work on vista and now also support loop playback?

Genl

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.

diablo2oo2

@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...