[TUT] Compiling Leaked Half-Life 2 Source Code (2003)

Discuss any beta and abandonware games.
baso
User avatar
Posts: 181
Joined: Fri Oct 06, 2006 2:51 pm
Location: Czech, Moravia

[TUT] Compiling Leaked Half-Life 2 Source Code (2003)

Post by baso »

Many users ask me how to compile leaked Half-Life 2 source code (2003). So I decided to write a tutorial.

You will need this tools:

-Visual Studio 6.0 (1998)
-Service Pack 5 for VS6.0
-Processor Pack 5 for VS6.0


and of course

-leaked Half-Life 2 source code (BA ftp: "/(Source) Games/PC/Half-Life 2 [source].rar")

To run compiled binaries you will also need some resources, scripts etc. from Half-Life 2 Anon Leak.

1) Install Visual Studio 6.0
Under Vista/7 run setup as administrator and ignore compatibility warnings - it will work fine.

2) Install Service Pack 5.0 for VS6.0
There is problem with SP5 setup under Vista/7... so expand "VS6sp5.exe" and open "sp598ent.stf", then go to line 29 and change:

Code: Select all

13				Group	28 36 38 29 30 32 26 27 14 25 16 17 20 18 19 15 39 21 22 24 23 43
to:

Code: Select all

13				Group	28 38 29 30 32 26 27 14 25 16 17 20 18 19 15 39 21 22 24 23 43
or download fixed file here.

3) Install Processor Pack 5 for VS6.0

4) Fix "mshtml.h" file:
There is bug in one VS6.0 header file. Open "<VS60_Install_path>\VC98\include\mshtml.h" and go to line 13616 and change def. "__RPC_VAR" to "__RPC_FAR".

So, function IHTMLStyleSheet_put_title_Stub() should look like this:

Code: Select all

void __RPC_STUB IHTMLStyleSheet_put_title_Stub(
    IRpcStubBuffer *This,
    IRpcChannelBuffer *_pRpcChannelBuffer,
    PRPC_MESSAGE _pRpcMessage,
    DWORD *_pdwStubPhase);


/* [id][propget] */ HRESULT STDMETHODCALLTYPE IHTMLStyleSheet_get_title_Proxy( 
    IHTMLStyleSheet __RPC_FAR * This,
    /* [out][retval] */ BSTR __RPC_FAR *p);
or download fixed file here.

5) Unpack Half-life 2 source

6) Build source code
To build all simply run "dev_build_all.bat" (Use "debug" or "d" parameter for debug build). Under Vista/7 few compatibility warnings will popup again...
If you get errors like "msdev is not a recognized command" or "vcvars32 is not a recognized command" you must add VC6.0 to your PATH sys. variable.

To (re)build single part of engine (i.e VGUI) run corresponding bat file (i.e. build_vgui2_dependents.bat) or open & build project file (i.e. vgui2\src\vgui_dll.dsp) in VS6.0.

7) Copy or create res. files
Copy resource, scripts etc. form Half-Life 2 Anon Leak (be careful: source code is outdated and do not support v.37 models! So you will need to update model loader code or "downgrade" leaked models.)

I have "minimum res. package" to run engine and load simple map (I don't have Leak on this computer so i will update tutorial later, or write another tut. about resources etc.).

8) Program, debug, program, debug...sleep

...BTW if you get something like this:
Image
you need to (re)build shaders.

And here is very old screen of my Source2K3 project:
Image

This is not final version of tutorial I definitely forgot something...

GOOD LUCK!
Last edited by baso on Wed Nov 18, 2009 3:43 pm, edited 2 times in total.
Image

dans34
User avatar
Donator
Posts: 1107
Joined: Tue Jan 06, 2009 11:35 am

Re: [TUT] Compiling The Half-Life 2 Source Code

Post by dans34 »

Nice guide

Inevitab13
Posts: 73
Joined: Sun Jun 29, 2008 3:55 am
Location: Auckland, New Zealand

Re: [TUT] Compiling Leaked Half-Life 2 Source Code (2003)

Post by Inevitab13 »

Yeah nice work on this. Should help the people who don't really know what they're doing.

lucas93
Posts: 913
Joined: Fri Mar 28, 2008 11:34 am

Re: [TUT] Compiling Leaked Half-Life 2 Source Code (2003)

Post by lucas93 »

Thanks heaps baso

ScarT
Posts: 110
Joined: Tue Oct 14, 2008 9:37 am

Re: [TUT] Compiling Leaked Half-Life 2 Source Code (2003)

Post by ScarT »

Not really sure what to say about this tbh.

MonsterMagnet
User avatar
Posts: 261
Joined: Sun Nov 01, 2009 1:55 am
Location: /dev/null

Re: [TUT] Compiling Leaked Half-Life 2 Source Code (2003)

Post by MonsterMagnet »

ScarT wrote:Not really sure what to say about this tbh.
That just makes it easier. Just say nothing
Co-Worker #1: "A boolean variable has two possible values: true or false."
Co-Worker #2: "Umm...true?"

ScarT
Posts: 110
Joined: Tue Oct 14, 2008 9:37 am

Re: [TUT] Compiling Leaked Half-Life 2 Source Code (2003)

Post by ScarT »

It does remind of the 2003/2005 days though when I first messed with the source code, and got results.

bob_george33
User avatar
Donator
Posts: 1167
Joined: Mon Mar 30, 2009 1:17 pm
Location: Western Australia

Re: [TUT] Compiling Leaked Half-Life 2 Source Code (2003)

Post by bob_george33 »

baso, will it work with service pack 6, because that is all I can find.

ScarT
Posts: 110
Joined: Tue Oct 14, 2008 9:37 am

Re: [TUT] Compiling Leaked Half-Life 2 Source Code (2003)

Post by ScarT »

No, Service Pack Six won't work. I've got a premade setup of Service Pack 5 lying around, let me upload it.
Edit: There you go.
http://rapidshare.com/files/313613336/S ... _ScarT.rar

lucas93
Posts: 913
Joined: Fri Mar 28, 2008 11:34 am

Re: [TUT] Compiling Leaked Half-Life 2 Source Code (2003)

Post by lucas93 »

I've managed to compile the TF2 binaries and fix the bug where the player would not spawn



Nowhere near as good as GabeN's

bob_george33
User avatar
Donator
Posts: 1167
Joined: Mon Mar 30, 2009 1:17 pm
Location: Western Australia

Re: [TUT] Compiling Leaked Half-Life 2 Source Code (2003)

Post by bob_george33 »

Thanks ScarT. I'm downloading it now. 4 hours and 7 minutes remaining because of my capped internet.

ScarT
Posts: 110
Joined: Tue Oct 14, 2008 9:37 am

Re: [TUT] Compiling Leaked Half-Life 2 Source Code (2003)

Post by ScarT »

Oh that sucks. It'll stay on my Rapidshare account for quite a while though, so don't worry It's already updated so it installs fine on Vista and above!

EvilGenius
User avatar
Posts: 39
Joined: Sun Aug 16, 2009 7:27 pm

Re: [TUT] Compiling Leaked Half-Life 2 Source Code (2003)

Post by EvilGenius »

Good tutorial but I'll wait till you update it.

ScarT
Posts: 110
Joined: Tue Oct 14, 2008 9:37 am

Re: [TUT] Compiling Leaked Half-Life 2 Source Code (2003)

Post by ScarT »

Update it with what? Also, part four of this tutorial isn't needed at all.

EvilGenius
User avatar
Posts: 39
Joined: Sun Aug 16, 2009 7:27 pm

Re: [TUT] Compiling Leaked Half-Life 2 Source Code (2003)

Post by EvilGenius »

ScarT wrote:Update it with what? Also, part four of this tutorial isn't needed at all.
He said he forgot something so I'll wait and see what he has to add. I have the source code somewhere for some time so I guess I should try and compile it.

ScarT
Posts: 110
Joined: Tue Oct 14, 2008 9:37 am

Re: [TUT] Compiling Leaked Half-Life 2 Source Code (2003)

Post by ScarT »

Probably the resources he mentions. I know the engine won't run if you just follow this tutorial.

aiz0
User avatar
Posts: 3
Joined: Sat Dec 12, 2009 8:35 pm

Re: [TUT] Compiling Leaked Half-Life 2 Source Code (2003)

Post by aiz0 »

Thanks for this awesome tutorial
I have a little problem, the ingame menu works fine for me, but when I'm start a map (console map xxx) crash the game
( dev_build_all.bat is fully compiled, resources (scripts,resource,models,materials,maps,cfg,scenes,sound) exist )
Could you please help me?

Thanks in advance

ScarT
Posts: 110
Joined: Tue Oct 14, 2008 9:37 am

Re: [TUT] Compiling Leaked Half-Life 2 Source Code (2003)

Post by ScarT »

Most likely happens because it tries to load a version 37 model, which this tutorial doesn't allow (seeing the leaked code is v35/36
).

aiz0
User avatar
Posts: 3
Joined: Sat Dec 12, 2009 8:35 pm

Re: [TUT] Compiling Leaked Half-Life 2 Source Code (2003)

Post by aiz0 »

Thanks ScarT for the answer
I have this source used.
http://opensvn.csie.org/Source3/
This work's with the leaked models ? or ?

ScarT
Posts: 110
Joined: Tue Oct 14, 2008 9:37 am

Re: [TUT] Compiling Leaked Half-Life 2 Source Code (2003)

Post by ScarT »

I'd say yes, but there's probably a bug with the Citizen models (we had loads of trouble with this in GabeN).

aiz0
User avatar
Posts: 3
Joined: Sat Dec 12, 2009 8:35 pm

Re: [TUT] Compiling Leaked Half-Life 2 Source Code (2003)

Post by aiz0 »

It does not work, what one could do there now ?

ScarT
Posts: 110
Joined: Tue Oct 14, 2008 9:37 am

Re: [TUT] Compiling Leaked Half-Life 2 Source Code (2003)

Post by ScarT »

I suggest learning C++ first. You'll really be lost in the source code without knowing C++.

lucas93
Posts: 913
Joined: Fri Mar 28, 2008 11:34 am

Re: [TUT] Compiling Leaked Half-Life 2 Source Code (2003)

Post by lucas93 »

aiz0 wrote:It does not work, what one could do there now ?
Use Source SDK to make a mod. The code is much neater and easier to use (imo).

Either way ScarT's correct, learn C++ if you haven't already.

src
User avatar
Donator
Posts: 25
Joined: Thu Dec 06, 2018 4:05 pm

Re: [TUT] Compiling Leaked Half-Life 2 Source Code (2003)

Post by src »

I know this post is old, but does anyone have the tools to compile the code, because all I could find is MS6.0 and sp6, and I read that sp6 doesn't work. If anyone could help me that'd be great.

oscareczek
User avatar
Posts: 700
Joined: Fri Apr 25, 2014 5:37 pm
Location: Poland

Re: [TUT] Compiling Leaked Half-Life 2 Source Code (2003)

Post by oscareczek »

I know I'm Polish and the site is Polish, so it was easier for Google, but still, it was the first result for "VS6SP5.EXE" http://ftp.wsisiz.edu.pl/pub/pc/microso ... vs6sp5.exe

Post Reply