User:AndrewNeo/The HL2 Xbox Project

From Valve Developer Community
Jump to navigation Jump to search

This page is to document my project involving attempting to mess around with Half-Life 2 on the Xbox, in an attempt to see what is possible compared to the PC version of the game.
My goal is, at minimum, to attempt to run custom compiled maps on the Xbox version of Half-Life 2.
Please do not edit this page, this is my 'journal' of sorts. Please leave any comments on the talk page. If Valve (not a standard wiki user) finds this to be out of the wiki's context or if I should just stop in general, please leave me a message.

And a short note: I believe for the most part what I'm doing is not wrong. Valve is happy to give us the SDK and other tools for the PC version. The Xbox version has most of the same stuff. I'm just trying to see if it's possible to put things from the PC to the Xbox.. think of it this way. Wouldn't it be kind of cool to play SP maps (no mods, obviously) to play on the Xbox? Like MINERVA or Mistake Of Pythagoras? I would.

Initial Look

The disc seems to have relatively simple layout, with BSP files and some files containing language-based data. It also has simple Xbox-format movies as well as the music in WAV format. Also, I'm sure that the game is not moddable, because the client-server style engine in the PC version isn't in the Xbox version.

Playing with Mods

I'm going to say this right off the bat, because I've seen it pop up all over. People think they'll be able to play Garry's Mod on the Xbox. I had my suspicions before playing, and now seeing the layout of the content on the disk and hard drive, I can say for sure that it will be next to impossible to run a mod on the Xbox version of Half-Life 2. I have two primary reasons for this.

  1. On the PC the Source engine (and even Goldsrc) uses the client/server method to run the real games or mods. The Xbox version uses one XBE to run the game, so even if the client/server method exists, the only way to run a mod would be to recompile the source, which would require the original (illegally) from Valve.
  2. Even if you had it, the original mod author would have to take the work to get their mod working properly on the xbox. This would require the XDK (illegal), the original source code for HL2 on the Xbox (illegal) and a modded xbox or a Xbox dev kit. Releasing the source or binary with these methods would probably get Valve to take you to court. While the XDK can be found illegally on the internet, we all know what happened the last time HL2 source code was stolen.

Retail disc layout

  • Root
    • Standard default.xbe (Probably points to hl2_xbox.xbe)
    • hl2_xbox.xbe (Around 8mb, probably the engine)
    • GameMedia
      • zip0_xbox.xz_ (Probably the main game contents, like a GCF file except in Xbox format?)
      • zip0_xbox_(language).xz_ (Most likely language specific things like speech and closed captioning)
      • Maps
        • All the standard HL2 SP BSP files.
      • Sound
        • Music
          • Most (all?) the HL2 music files in WAV format from the source sounds.gcf
          • Stingers
            • More music from source sounds.gcf
    • LoaderMedia
      • Demo_Attract.xmv (Regular Xbox video file, attract video that plays when idle)
      • install.txt (!!! Something interesting, has something about copying files.. left behind?)
      • loader.xpr (Don't know, I think xpr's are normal files)
      • Title_load.xmv (Video that plays while game loads)
      • Valve_leader.xmv (Our favorite video that plays when HL2 starts)

Save layout

  • TDATA\45410091\hl2
    • hl2x
      • cfg
        • continue.cfg (Unknown, binary)
        • xboxuser.cfg (Much like our config file, has some binary at the end (checksum?))
      • maps (empty)
      • SAVE
        • _transition (Save file at transition point?)
        • autosave (Save file at autosave)
        • (map).hl# (Save points through game, unknown numbering format)

xboxuser.cfg

This is not a generic file, this is my own save file.

unbindall
bind "UP" "slot1"
bind "DOWN" "slot3"
bind "LEFT" "slot4"
bind "RIGHT" "slot2"
bind "STICK1" "+duck"
bind "STICK2" "toggle_zoom"
bind "A" "+jump"
bind "B" "+reload"
bind "X" "+speed"
bind "Y" "+use"
bind "BLACK" "impulse 50"
bind "WHITE" "impulse 100"
bind "L TRIGGER" "+attack2"
bind "R TRIGGER" "+attack"
bind "S1_UP" "xmove"
x_mapnum "0"
r_gamma "0.5"
snd_musicvolume "0.9"
volume "1.0"
skill "1"
closecaption "0"
sv_unlockedchapters "2"
cl_rumblescale "1.0"
sk_allow_autoaim "1"
cc_subtitles "0"
xc_pitchsensitivity "-1.000000"
xc_yawsensitivity "1.3"
xc_southpaw "0"
hud_fastswitch "0"

The binary at the end of the file, in hex:

00 89 07 22 c3 b7 e9 c4 cf 11 94 cf ed 6a d2 3e 67 93 75 1c 

I believe it is some sort of checksum, to keep the file from being manually modified. I am yet to try and modify the file myself.

Cache layout

This was the contents of my X drive (cache) when I shut the machine down in the middle of the game. All normal files also have a .mrk, which I assume has something to do with the xbox cache instead of HL2X.

  • Y:
    • version_235.txt (This is a copy of install.txt above, I believe, apparently its target destination)
    • hl2
      • hl2x
        • maps
          • The map last/currently loaded
        • save
        • zip0_xbox.xzp (Extracted from zip0_xbox.xz_ on the disk?)
        • zip0_xbox_english.xzp (Extracted from zip0_xbox_english.xz_ on the disk?)
    • LoaderMedia
      • Title_Load.xmv (Probably from the disc, cached to be played)

BSP files

The BSP files have the same names as single player Half-Life 2.

XZP files

Here's the format someone from the Xbox-Scene forums sent me. This is the same format used in my UnXZP program and is now inside GCFScape.

Header (36 Bytes long)

[4] Bytes - ID - 70695A78
[4] Bytes - unknown (Compressed = 1 Decompressed = 6?)
[4] Bytes - Number of Files - Uknown (Related to Total Files)
[4] Bytes - Number of Files Text Listing
[4] Bytes - Unknown
[4] Bytes - Uknown
[4] Bytes - Number of Files - Uknown 2 (Related to Number of File Names)
[4] Bytes - Offset to (Table 2) (Take (Number of Files - Uknown 2) * 12 for size)
[4] Bytes - Table 2 + Text String Table Size



After Header take Number of Files - Uknown + Number of Files Text Listing * 12 for entries
Table 1
[4] Bytes - ID ( This references ID in (Table 2 Uknown))
[4] Bytes - File Size
[4] Bytes - Offset


Table 2 Uknown
[4] Bytes - File ID
[4] Bytes - Filename Offset (string, null terminated)
[4] Bytes - Time created?


Table 3 (Strings begins right after Table2)
String~ Null Terminated

~~~~~~~~~~~~~~~~~~
After Table 3 (strings)
[4] Bytes - File Size (End Of File)
[4] Bytes - 74467A58 Always (might indicate the file has ended)

Day Logs

January 21, 2006

I've rented Half-Life 2 for the Xbox. The structure of the disc seems pretty simple, and the single-player BSP files are exposed. I need to look into the individual files a bit more.

January 25, 2006

Started this project on the wiki. Hope to get some more information.
Checked the disc's filesystem and wrote some stuff down on it, posted above. xz_ files don't seem to match the XZP files as read on the Free60 wiki. Valve's propriatary format? Will look into savegames and data on disk tommorow.
I've also read that the finalization from beta to release of the last Source SDK beta has removed Xbox map compile ability. Maybe someone backed their versions up.. mine apparently disappeared, once again.

March 03, 2006

I'm kind of stuck until we can extract files from the xz_ archives. I need to look at the cache after the game has run to see what's left over, and see if anything useful is inside. I haven't poked around as much as I should have, especially seeing not only are others trying to work with it, but they've been pointing at this page, too. Any help would really be appreciated, feel free to contact me, primarily through e-mail or instant messangers. I'll join in forum threads, or an IRC channel if you can get enough people together. Okay, I've found the actual XZP files, but they are still not in the same format the Xbox 360 uses, so the Free60 page is useless to us, at least from what I can tell. More later.

March 07, 2006

With the help of someone from Xbox-Scene and their hex-editor skills (I have none, I took one look at the file and got all confused) I got a rough layout of the XZP file, and after two hours of realizing I didn't know enough C++ to do it, I busted out PHP and worked for another good three hours working all the kinks out of an extractor. Works good for me! Download here. Discuss here. Future versions won't be written in PHP/Phalanger and will probably be written in VB.NET or C#, with a GUI, depending on how I feel when I write it.

Since we've gotten the XZP format done, next is to see what the xz_ files on the disc really are. Apparently it's just a zipped form of the XZP files, but I haven't gotten around to looking yet.

March 09, 2006

After getting the XZP files extracted, I talked to Nem, and GCFScape 1.4.1 now has the ability to extract XZP files. Yay!