Page 1 of 1

How to compile WinQuake in 2017?

Posted: Fri May 05, 2017 1:53 am
by mankrip
I still use an extremely old and sluggish Celeron laptop for coding. In it, I still use MASM32 and the MSVC++ 2003 Toolkit for compiling, and a really old version of Code::Blocks as an IDE. There's no VC workspace & project files for my engine anymore, all I'm doing is for Code::Blocks.

I want to migrate my coding work to my Windows 7 laptop, but I'm aware that development tools have changed a lot. Which tools (C/C++ compiler, x86 ASM compiler, linker, IDE, libraries) would be recommended for my work? Anything that suits vanilla WinQuake should work, maybe except for the VCC/CB project & workspace files' differences.

In the meantime, I guess I'll do some research now.

Re: How to compile WinQuake in 2017?

Posted: Fri May 05, 2017 10:56 am
by mh
Visual C++ 2008 Express is capable of compiling WinQuake direct from source and without needing to install any other headers, libs, MASMs, or anything - just a fresh install of VCPP on a fresh install of Windows and fix up the crap with hwnd_dialog and it works.

The only other thing you need to do is, if you grab the source from ID's github, convert line endings from UNIX to Windows in the project files.

Of course I'm not sure how easy or difficult it is to get hold of 2008 Express these days.

Re: How to compile WinQuake in 2017?

Posted: Sat May 06, 2017 12:49 pm
by Baker
Mark V compiles with assembly language out-of-the-box in:

1) Code Blocks
2) Visual Studio 2008 Express

http://download.microsoft.com/download/ ... 397868.iso

SP1 patch: http://download.microsoft.com/download/ ... 504728.iso

(And ancient Visual Studio 6, if that project build isn't broken).

Now --- I didn't invent the technique. I stole the Visual Studio 2008 trick from MH and the CodeBlocks trick from QBism.

Short version: Open up mark_v.vcproj or mark_v.cbp in a text editor. You could as an alternative use qbism's source code for peeking at how to do CodeBlocks.

But the nice thing, you can do it with Microsoft's stuff or in another environment using no Microsoft stuff (CodeBlocks).

p.s. It's easy once you get it working. CodeBlocks needs the .S in the .S files to be capitalized. With VS 2008, you have to use .asm if I recall. CodeBlocks is the easier to setup because to get the .asm files you'll need to compile .s files to .asm and that pretty much means running ancient Visual Studio once.

Anyway, it's quite possible. It is also not any fun setting up, but you only have to do that once.

/Project files. Always the absolute worst nightmare ... Makes low-level coding seem easy by comparison .... :mrgreen:

Re: How to compile WinQuake in 2017?

Posted: Sat May 06, 2017 1:50 pm
by Spike
the vanilla source was made for msvc5-with-masm(sold separately!), with some extra steps in the project file to convert the .s files to uncommented(and thus totally unreadable) .asm.

iiuc, masm is now included as part of msvc itself nowadays, so things are much easier to get going. it should normally be easy enough to convert project files (even from really old versions), but make sure there's no spaces in any paths.
if you have any problems then it'll be from microsoft changing headers in their apparent effort to annoy everyone with extra leading underscores that prevent the code from running in eg linux. There's other stuff like DWORD_PTRs that allow the win32 api to compile for win64 too, as well as possible conflicts between outdated headerfiles like the directx ones included in the quake zip.

if you want to support win64, you'll probably want to strip the assembler anyway. 32bit asm will not compile for 64bit at all, don't try. there's other issues with 64bit anyway, so probably you won't care for 64bit... noone else really does.

I can't comment on codeblocks. if you've no asm then it shouldn't be too hard to throw all the .c files into a new project. with gcc-based 32bit toolchains just add .s to compile with gas instead of gcc. It might take a few tries until you get all the right -Ddefines and -Llibraries for your toolchain, but shouldn't take much of your time if you're watching TV at the same time, yay adverts?

Re: How to compile WinQuake in 2017?

Posted: Sat May 06, 2017 2:38 pm
by mh
With VS 2008 (and 2008 Express) you can use gas2masm in the stock project, directly from source, to convert the .s files to .asm files, then remove the .s from your project and add the .asm; result will have the constraint that it's no longer portable between compilers of course but as a trade-off you've now no longer got external dependencies. Your choice.

I can quite easily put together a WinQuake source package that will compile clean with a fresh install of 2008 (or 2008 Express) in maybe 15 minutes or so. Once you know what needs to be done it's quick and simple.

Re: How to compile WinQuake in 2017?

Posted: Sat May 06, 2017 8:37 pm
by Baker
I haven't thought about assembly language in a while.

But now that I look, I don't have any .asm files in Mark V's Visual Studio project. I have .s files. Both the Visual Studio 2008 and CodeBlocks use the .s files, although they are upper .S files because of CodeBlocks.

Apparently, I came up with a better solution than .asm files and then forgot about it. I also do not have a gas2masm build in my project.

Looks like I built gas2masm.exe and it lives in a subfolder and the .S files run it against gas2masm as a Custom Build Step in Visual Studio. CodeBlocks can use the .S natively so it just builds them as is because .S files are "GNU Assembly Files" (gas 2 masm --- get it?).

The Visual Studio and CodeBlocks both use the .S files and there are no .asm files anywhere.

/Then apparently I said "Ok, great." and moved on to something else. The great thing about getting something working reliably and cleanly is that you can take it for granted and forget all about it.

Re: How to compile WinQuake in 2017?

Posted: Mon May 15, 2017 10:28 am
by revelator
the old assembler files are actually intel syntax which gcc's as.exe (or gas) can understand :)
the MS projects from back then used a rather crude but working converter (gas2masm) to convert the gnu assembler files into masm compatible assembler files.
So if you use gcc + codeblocks its pretty easy to compile these into the source.

As spike mentioned gas2masm does destroy comments though, and 64 bit is off the table unless you can rewrite the assembler code to 64 bit.