VOGONS


CVS build with MSVC6

Topic actions

  • This topic is locked. You cannot reply or edit posts.

First post, by kjliew

User metadata
Rank Oldbie
Rank
Oldbie

First of all, great job to all DosBox developers. DosBox is indeed a wonderful piece of marvel. I can now play some old DOS gooddies in XP in windowed mode. Believe me, it really helps for some games to be able to open up notepad to take some notes during gameplay rather than resort to pen and paper. And, most notable, wonderful sound system emulation at decent speed.

I am most interested with current CVS version of DosBox. Well, the official release 0.60 is really great undoubtedly, but the CVS version has DirectDraw Overlay support which speeds up screen drawing of supported display mode tremendeously, leaving more CPU power for increasing DOSBox CPU cycle and smooth sound. Just for comparison, with no frameskip, full sound and DOSBox CPU cycle at 1800, DOSBox 0.60 is stressing my PIII 1Ghz at ~99%, but with DOSBox CVS, the CPU utilization is mere ~16%. And, I can pump up the CPU cycle to >4000 with CPU utilization hovering at ~80%, and still with smooth sound!!!!

However, DosBox CVS can no longer be built by MSVC6 SP5 which is my prefered tools. I don't have MSVC.net. I know that someone in the forum already mentioned that don't use MSVC6 as the code produced is not correct, but I want to know if this also affect MSVC6 with latest service pack update. I am able to build from source the offical release DOSBox 0.60 with VC6 SP5 and run most of the known working DOS games flawlessly. To someone knowledgeable in the VC6 issue, please provide more information and someway to expose the error (eg. games run in DOSBox built from MinGW/MSVC.net, but not from MSVC6.

I am getting a few of compile errors with the latest DOSBox source from CVS (Jan 6). There seems to be some re-write of the rendering code (render.cpp, render.h, render_normal.h, render_scale2x.h etc.) to use C++ template instead of the macro used in DOSBox 0.60 source. There is also some re-write in ntddscsi.h which uses DEFINE_GUID macro, but did not include the neccessary header file (initguid.h and objbase.h), and some minor errors that break the build from MSVC6.

I can resolve all the build errors and produce a successful DOSBox CVS build with MSVC6 but the software behaves erraneously. It starts up to the DOSBox usual welcome screen with big text size, as if the screen was 320x200, and some protection faults that cause DOSBox to quit.

The same source from CVS (without the modification for MSVC6) build perfectly from MinGW. I am going to try to use MinGW to build the MSVC6 source to see if it works. I am pretty sure the modification I made for MSVC6 doesn't change anything functionally. It's a simple re-write to get around the build error. I am fine if anyone want to look at the changes.

Please feel free to provide inputs of any nature even very technically. And, Thank You for DOSBox, a truly marvellous piece of software.

Reply 2 of 32, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

please post your changes somewhere.
The dosbox developpers don't use visualC 6 anymore because of that bad code thingie. I don't remember which game it was though.

The ntdd* rewrite wasn't nice but is needed. So any fixes (header wise) will be appriciated.

Try building dosbox with a minimal of support libraries. (so only sdl)

Water flows down the stream
How to ask questions the smart way!

Reply 3 of 32, by kjliew

User metadata
Rank Oldbie
Rank
Oldbie

Yes, I'm building DOSBox CVS with the minimum support DLL. So far, only SDL is linked. I don't have write access to CVS currently. I am using CVSGrab from behind firewall. I guess I will post the changes as a patch. For the meantime, I'm going to debug the MSVC6 build before I post them. My guess is that there must be a memory allocation error somewhere in the MSVC6 build as even MOUNT and CONFIG cause a fault in DOSBox console.

Reply 5 of 32, by kjliew

User metadata
Rank Oldbie
Rank
Oldbie

Done, still doesn't work. Yesterday, I started with DOSBox 0.60 source which is OK with MSVC6 build, and gradually merge each module from DOSBox CVS. I merged most of the changes and found out that only the rendering code is breaking MSVC6 build. I left a few files unmerged, which is:
render.cpp
render.h
video.h
vga_draw.h
render_normal.h
render_scale2x.h
render_template.h

Look like the re-write of the rendering code (which include YUV overlay support) is causing the main problem with MSVC6. I am going to dig further into that......

Also, it seems that DOSBox CVS is slower than DOSBox 0.60 unless an Overlay is used. I saw some surface blit code in DOSBox 0.60 and the code is removed from DOSBox CVS. Any plan to put back surface blit code for display adapter that don't support overlay?

Also, with overlay enabled, DOSBox CVS cannot do fullscreen..... but not a major complain from myself since I prefer to play in windowed DOSBox.

Reply 6 of 32, by Harekiet

User metadata
Rank DOSBox Author
Rank
DOSBox Author

The surface blit code was never actually used, and i think the dosbox CVS rendering was faster with my profiling compared to the old versions.
MSVC 6 is probably making optimizing errors in the new rendering code, you could try to disable optimizing or run the debug build and see if it runs then. If it runs then you can be pretty sure it's an optimizing bug.

Reply 7 of 32, by kjliew

User metadata
Rank Oldbie
Rank
Oldbie

The debug build is broken,too, and in the same way. There is no optimization turned on with debug build. Yeah, you're right, I re-compiled DOSBox CVS using core_normal CPU core, and re-gained back the speed I used to have with DOSBox 0.60, after reading some input from other from my other thread regarding difference in CPU core.

Reply 8 of 32, by kjliew

User metadata
Rank Oldbie
Rank
Oldbie

After several attempts to fix DOSBox CVS code to build under MSVC6+SP5, finally, I made it...... Here let me summerize the reasons why MSVC6 build is broken after DOSBox 0.60. I used the source I grabbed with CVSGrab at March 19, '04.

The re-write of rendering code using C++ template is the major culprit. MSVC6 doesn't fully support C++ template at its time of release. The problems are:
-MSVC6 cannot instantiate a function pointer based on C++ template function, which DOSBox used for its rendering handler. Well, not a big deal, since the compiler spits out errors on such codes. A rewrite to workaround this is simple.
-MSVC6 cannot support variables instantiation that can be bypassed by "case" statement. The compiler also spits out errors on such codes. Workaround is simple, too,ie. move variables instantiation out of "switch{}".
-MSVC6 cannot support referencing variables used in template <>, and the compiler just keep quiet about THIS!!!!! Shit!!!! For eg.
template <int a>
int foo(){
switch (a) {
case 1: return 1;break;
case 2: return 2;break;
......
}
}
The above code compiled without any error, but the result return by foo() is undetermined. Hence, the rendering code produced from MSVC is completely broken. A re-write is absolutely needed.

After all these have been taken care of, building the latest DOSBox with MSVC6 is successful. There are some minor optimization issues, all can be resolved easily. I maintained most of the original DOSBox optimization, but changed some. They are:
- replace #define INLINE __forceinline to __inline in config.h
- switch code generation from PentiumPro to Blend*.
- replace /O1 (minimize size) to /Ox (full optimization)

I do not have solid data to prove which binary is better, MinGW or MSVC6, particularly speed wise, but MSVC6 definitely has an advantage in size, ~200k smaller (which I don't really care....) The real advantage that MSVC6 gives me is a full development and debugging environment that allow me to debug and analyze the code, and even add my own enhancement should I need to, all in a very convenient way.

I hope this article will help others who feel the same way as I do, and don't justify the need to get MSVC .Net. I also hope this can help DOSBox to gain more development resource from people who would like to help, not familiar with MinGW/Linux but MSVC6, and don't have access to MSVC .Net.

Reply 9 of 32, by jbillena

User metadata
Rank Newbie
Rank
Newbie

kjliew!!!!

hi, i need your help... i am having problems compiling DOSBOX .60.
i got some libs and includes file from everywhere (SDL, SDL_net, png, libpng <-- i cant find Windows librabry for this ) but after getting them
all. there are linking errors.

can you just zipped ALL THE CODES, LIBRARIES, INCLUDES needed to compile DOSBOX .60 in VC6????? please....

i think my problem is getting libpng.lib for windows but i'm doing
a shortcut since you already have compiled DOSBOX .60. thank you
very much, dude!

if you can, just email the compressed files. or email a link so i could just
download it from there.

here's my email jbillena@tspi.com.ph

yelp help

Reply 10 of 32, by jbillena

User metadata
Rank Newbie
Rank
Newbie

HELP!!!

can anyone help me building dosbox .60 using MSVC++ 6?
i already downloaded the source codes but the libraries and
include files are a bit tricky to find (SDL, SDL_net, png, pdcurses,
libpng).

if you have build dosbox .60 on MSVC++6 please share your
libraries. my OS is WIN98SE. thanks

here's my email address: jbillena@tspi.com.ph

PLEASE!!!!

yelp help

Reply 11 of 32, by kjliew

User metadata
Rank Oldbie
Rank
Oldbie

Hi Jbillena,

You can download SDL and SDL_net from http://www.libsdl.org/. You need the development libraries, not just the runtime.

The rest of them (png, libpng, zlib, pdcurses) can be downloaded from http://sourceforge.net/projects/gnuwin32.

If you know how to use VC6, you should already know how to deal with project settings to include additional header and library files.

Reply 14 of 32, by jbillena

User metadata
Rank Newbie
Rank
Newbie

i already compiled and build dosbox .60. you're all a great help guys!
though i have a warning:

--------------------Configuration: dosbox - Win32 Debug--------------------
Linking...
MSVCRTD.lib(cinitexe.obj) : warning LNK4098: defaultlib "msvcrt.lib" conflicts with use of other libs; use /NODEFAULTLIB:library

dosbox.exe - 0 error(s), 1 warning(s)

--------------------------------------------

care to help me remove this warning?
OS: Win98SE
IE: IE v 6
-------------------------------------------

kudos to all of you.

about the zlib: libz.lib ... my build didn't look for a libz.lib to link but zlib.lib.
i do however found a zlib.lib under SDL_image.

my questions are... is libz.lib really needed? and why isn't zlib.lib
included in the downloadable zlib libraries? i spent my whole afternoon
trying to find that damn zlib.lib.

now, i need some hints where i could get started trying
to allow it to display japanese fonts.

by the way, anex86 emulator do display japanese fonts but
the japanese documentations is giving me headaches. i can
read simple japanese but that doesnt mean i like it hehehehe.

thanks to all of you!!!
this is actually fun.

yelp help

Reply 15 of 32, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

well the warning can not be removed and is harmless.

about zlib... only needed for libpng. so if you have no screenshots no zlib needed. so you can remove it from the linking line

(sorry but linux has nice configure scripts which maintain that. but visual C++ can't do that as nicely.

Water flows down the stream
How to ask questions the smart way!

Reply 17 of 32, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

0.60 is still possible 😀

anyway maybe remove that "support" for the next verson.
(just remove it from the makefile.am) so it doesn't get in the source binearies. cvs users can still use it then.

Water flows down the stream
How to ask questions the smart way!

Reply 18 of 32, by Markus

User metadata
Rank Newbie
Rank
Newbie

There might be another way to get a successful build with VC6 without changing anything in the sources, albeit with a little outside help.
Install the .net-framework and you'll get the commandline compiler cl.exe - it's actually the same as you get with VC .net, but it doesn't offer any optimising features.
Export a standard makefile from VC6 and change this to use the .net cl.exe and compile the sourcefiles, that cause troubles.
Compile the rest with VC6 and link.
I used to do this stunt with scummvm before I changed to VC .net.

Reply 19 of 32, by Zantagor

User metadata
Rank Newbie
Rank
Newbie

I went to http://sourceforge.net/projects/gnuwin32 but all I got was an empty page.

I tried downloading zlib and libpng from their respective sites, but libpng won't compile because the zlib I got from the official site seemed to be missing a few files.

any idea?