Half-Life for Dreamcast has some functional multiplayer components

Discussion in 'Sega Dreamcast Development and Research' started by TerdFerguson, Jul 13, 2015.

  1. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    All of the following is from valve developer community, quoting makes the text funky. The others not here are not listed and seem to be Dreamcast exclusive

    These are for Half-Life Dedicated Server. But are in the Dreamcast binary. '-game' and '-condebug' are also listed for GoldSRC
    • -game <game> - Specifies which game/mod to run. Default is "valve".
    • -zone <bytes> - Specifies the amount of Bytes of memory for use with the console system.
    • -maxplayers <number> - Sets the maximum number of players that will be able to join your server.
    • -condebug - Stores console output to "Half-Life\qconsole.log".

    Besides the self explanatory ones (-nosound) the rest are not listed. '-basedir' and '-safe' are listed as Source engine parameters but with no definition
     
  2. americandad

    americandad Familiar Face

    Joined:
    Jul 4, 2011
    Messages:
    1,439
    Likes Received:
    275
    Didn't CSDC team already do this?
     
  3. Anthony817

    Anthony817 Familiar Face

    Joined:
    May 12, 2010
    Messages:
    1,078
    Likes Received:
    535
    Yes, they used custom HUD's and everything on most of their total conversion/PC mod ports.
     
    americandad likes this.
  4. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    I see. It was exciting at the time anyway
     
    Anthony817 likes this.
  5. americandad

    americandad Familiar Face

    Joined:
    Jul 4, 2011
    Messages:
    1,439
    Likes Received:
    275
    Huh. I know I've said this already, but wouldn't it be a good idea to try and read their research (csdc) and try and get in contact with them? Not trying to be an arse, but it seems like you're reinventing the wheel a lot of the time. Sorry again if I sound like an asshole.
     
    Anthony817 likes this.
  6. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    Keep in mind that most of this stuff was done in 2008-2011. Many of the people i've contacted like Moi are no longer around in the DC scene/got lives or something. I can try contacting them, but I figured that anyone with knowledge on this, and is still active, would be here anyway

    It is a little late for that anyhow, I'm now at the barrier point of where anyone got with this. Moi compiled the DLL, but I think he gave up to quickly. So from here on in it is uncharted territory as far as Half-Life:Dreamcast is concerned
     
    Anthony817 and americandad like this.
  7. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    When Sizious re-enabled the 'connect' commands, he used an xdelta3 patch. How does one go about making another one of those? I'm thinking the response "Stuffcmds : execute command line parameters" is another loopback response similar to 'connect is not valid from the console'. It may be possible I'm not using the command correctly, but even when run via valve.rc on startup, I still get the same response

    I'll try using it on PC via valve.rc. And see if I still get the same response. Then perhaps I am using it wrong

    Edit: I actually get the same response on PC. So i'm probably using it wrong. I'll try to get it working on PC then try on Dreamcast

    Edit2:
     
    Last edited: Feb 14, 2016
  8. Trident6

    Trident6 Spirited Member

    Joined:
    Oct 17, 2015
    Messages:
    119
    Likes Received:
    55
  9. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    I did not have much luck with the 'setinfo' cmd. I'm going to test other things, like loading from raw files on a blank SD card since DreamShell supports windows CE now

    But I think we should maybe discuss options of injecting the dll into the exe
    I did some comparisons of the SH4/WinCE DLL and the EXE

    They are very similar in terms of characteristics
    [​IMG]
    [​IMG]
    [​IMG]

    Areas/blocks where the strings are located are very similar also
    [​IMG]
    There are a bunch of new strings, but after that the structure is very similar to the EXE
    [​IMG]
    I'm not sure if this is somewhat of a duplicate, tired
    [​IMG]

    Since they are so similar, my thinking is it would a lot easier to patch/merge the dll and exe. But this is speculation

    I have not uploaded the DLL yet because Tasos, who compiled it, is probably going to make more changes to know it loaded if I can figure out loading it natively. I am a long ways from ruling that out

    However, If it comes to injecting/patching/merging the two. The development of an application to do so, and the open sourcing of Tasos' compile ready souces would get two birds with one stone

    Multiplayer aside, it would allow people to port singleplayer mods that require new DLL files (real tired of the word DLL by now haha). Allowing a plethora of new Dreamcast games. And for multiplayer, it would probably allow new functions to be added for handling the modem/broadband adapter/ and microphone (might as well add mic support if it is possible). As well as allowing development of Dreamcast exclusive mods

    -------

    Again, there is still a bunch of things I want to test. I got the 'download' command to work by using the 'cmd' command. Running 'cmd download dlls/mp.dll' crashes the game. The error is "got to cl_parsedownload" which is a good sign. I've been trying to get the file to download when the game is loading the map/connecting to local server. But I crash back to console with the message "sz_getspace: overflow"

    This is why I'm going to try getting the game to run via raw files on the root of a blank SD card using DreamShell. There are a bunch of functions that write to files, which obviously cannot be done on-disc. So if I can get that working it will allow me to try more things. Though I have not tried RC4 yet, I know you can run binaries from the command line. So perhaps if I can run the EXE without it being in an ISO, I can also use command line options

    I'm very optimistic about loading this DLL. Though I am just trying to prove the concept of loading one. If and when I do, or a patcher is developed, it will be left up to the community to add multiplayer and hopefully microphone support also. If nobody is interested, I'll be content with proving the concept that it can be done

    -------

    Well this ended up being quite a really long post. Sorry if this annoys people. I've been at this for like 6 or 7 hours. Off to sleep, I'll update this thread with results of the things I mentioned. And upload that DLL within the next week unless anyone wants to test before then
     
    wombat and Anthony817 like this.
  10. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    If you have any suggestions on how to use it properly I'll be glad to try them. The parameters I tried were

    (+client.dll and +serverside are the only two + parameters I was able to find though I tried a few from PC version)
    stuffcmds +client.dll dlls/mp.dll
    stuffcmds +dll dlls/mp.dll
    stuffcmds +game cstrike
    stuffcmds +serverside dlls/mp.dll
     
  11. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    Apologies it took me so long to upload this. I have done a little more testing. But have not gotten more blank CDs to test on hardware

    The tests I did tonight on hardware were renaming the hl.dll extension to hl.vms, copying it to the VMU, saving the file name that the console see's back to hl.dll (205 blocks) and using 'load /VMU/HL.DLL'

    I got 'absurd mnemoalloc' crash, but tried loading the auto load CFG file and got the same result. So we can rule out the crash being from MMU issues, it was an MMU crash. But not because of the DLL, anything that is not a save will produce this error. I tried taking the header data from the VMS file and putting it into the first line of the DLL in Notepad++. But this did not seem to make any difference

    One idea I had was trying to examine the header data from the VMU auto config file, and save files. Because the header data I'm fairly certain is what makes the engine load it on startup. I do not think you can just make a text file with your config, change the extension to VMS and call it halflife.cfg when copying it to VMU. I will test this tomorrow to be sure. But if we can examine the binary to find the calls for the data in the header, perhaps there is data in the binary also to load other types of files. Like liblist.gam, custom spray images like Jet Grind Radio (there is a strong possibility of this considering sprays work), or valve.rc

    I tried modding the valve.rc file and testing on an emulator a couple days ago, but still got the 'stuffcmds : execute command line parameters" console output. When I tried on Steam PC version I also got this result however. I was reading somewhere that stuffcmds alone is just a command that tells the engine to stuff the parameters put in the shortcut on PC. So there it's possible there is no valid parameter after stuffcmds. I know that if you remove stuffcmds from valve.rc on PC, the engine will not run. But I am not sure if this is only for mods, or for Half-Life itself

    Though, considering it behaves the same way it does on PC, perhaps there is in fact a way to append parameters like on PC. I was thinking perhaps in the 1ST_READ.BIN or ip.bin. I've tried briefly looking for the original leak of this, but only found dead links. If someone has or finds working links to Half-Life_Xandu (it is something like that) please let me know. Perhaps when TuxTheWise made the DCRES edition of this he made a new IP.BIN. I'm fairly certain when this was leaked, it was not in GD-R form, but the raw files were handed off. Likely from the dev unit and it used emulation mode (though I am not sure how dev units work for running raw files). But if there was an original ip.bin perhaps there are some clues to this. Because the one in the DCRES release i'm using, the ip.bin is a genericly generated one labeled 'Crazy Taxi'. I know Sizious' tool for creating one is 'Crazy Taxi' by default. And most scene releases have the crazy taxi labeled ip.bin

    If we can figure out if and how cmdline parameters are run, the params for PC still apply but this is unlikely. If they do, then that is likely how we would load this

    ------

    What I'm going to try next

    Running Half-Life from raw files on the root of an SD card since DreamShell now supports Windows CE games. Perhaps it can run the binary of Half-Life. If it can, and it works with raw files, then perhaps the various functions that write to files will work. Because obviously, it cannot write to a CD. Though it looks like it does attempt to. I will then try adding the parameters when running via DreamShell's command line

    Testing Blue-Shift's liblist.gam file (unmodified, both liblist and leaving original files) with various file structures. Having the DLL in the PAK0.PAK file, not in the PAK, attempting to make a PAK1.PAK (additional files are added to a PAK1.PAK file, I think this is for Quake, but I think GoldSRC functions the same way). When you select 'New Game-->Blue Shift' the engine runs the 'startgame barney' command followed by 'skill (1 through 3)' and 'map b0a0'. This is how I discovered the 'startgame' command. It may be possible it runs the liblist.gam file. But the fact that it is left in there from gearbox is the main reason of my hunch that this can be loaded. If it was left there intentionally, it must have been used. Maybe at one time, then later it was compiled into the binary. But the fact that it is there, and left unremoved (we have version 1.0.1.3 and Dreamcast build # 1673 (it is in the 1600s)) should not be discredited

    That is all the science notes I have today. Apologies if it is a little open ended

    ------

    Attached is the hl.dll Tasos compiled for anyone else to do their own testing on this subject. There is one compiled with unmodified HLSDK sources, and a second with color variables chaned. Though Tasos notified me that the values he edited may not have been for the general hud color, or anything. He may compile another with more changes, which I will upload here

    I'm hoping we can find a way to load these natively. That would conclude this thread. It would then be up to the community to add hardware support, internet connectivity, and/or port mods. I am only trying to prove the concept. The rest is there, and functional. With a visible internet connection this can be played online
     

    Attached Files:

    Anthony817 likes this.
  12. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    Tasos made another set of changes to the code

    [​IMG]

    Attached is the new DLL for anyone to perform their own tests

    I tried testing on emulator, but I cannot use the tilde key and for whatever reason cannot bind 'toggleconsole' to another key in the game's cfg files. I will do testing tomorrow on hardware when I get some CDs
     

    Attached Files:

    Anthony817 likes this.
  13. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    Did some more testing. Still no luck loading the DLL. I tried editing the liblist.gam to match the amount of bytes of Blue-Shift with the added DLL. Then putting the dll and liblist.gam in a PAK1.PAK file, PAK1.PAK works but still no dice. I think there is a way to trick the engine into loading it, but I have not found anything yet. Considering everything else from PC is in the engine, this has to be somewhere. Especially considering Gearbox's liblist.gam file

    Also Half-Life does not boot with DreamShell RC4 thus it cannot from command line. I do not think command line would work at all even if HLDC worked via isoloader
    ---
    Something interesting I came across (kind of cool I'm still finding things). There is a command 'new' that does nothing by itself, but when I run 'cmd new', it returns to console like 'connect' but the engine then crashes. Everytime the crash happens it's at address 00144B5C and stack address 0C3BFC04. And I think these addresses are always the same "PR: 00144B0A GBR: 0C3BFBB0 SR: 00008000

    If there is anyone that knows SH4 assembly, it would be cool if you can use hex rays and see what you can find. But i'd imagine there would be a real lot to sort through

    I'll keep testing and periodically updating this
     
  14. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    I did some more general testing, skimming through the engine but still have not found anything. I'm running out of ideas unfortunately. I'll keep testing with different ways to arrange the files. It's just odd that everything else is 1:1 with PC besides for that. If I can figure out command line parameters, then there may be some hope

    A couple people mentioned the possibility of hooking code into the binary for initializing the external network. But would developing a program that can merge a mod DLL with the EXE with minimal MMU virtual address write errors, or hooking code to load the DLL, be far less of an undertaking?

    With that, we could get a couple hundred new Dreamcast games http://www.moddb.com/games/half-life/mods and allow someone to try writing code for initializing the modem. I'd really like to hear from someone highly skilled in regards to that
    ---------

    After all this I'm considering HLDC modding as a hobby. I have a 116 hours or so experience in Hammer Editor for CSS a few years ago maybe port some extensionless mods for a few new Dreamcast games :cool::cool::cool: Also considering a "high fps" version of the game with slightly downscaled textures and lower polycount models from the original PC version
     
    Anthony817 likes this.
  15. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    I did some more testing again tonight. This time I tried to compare how the Steam PC version and DC version are alike and different. They're mostly 1:1

    On PC, you cannot type 'gamedir cstrike' then CS loads with DLLs maps and all. You have to start the game in CS. When you type 'map undertow' via console at main menu, the server is setup exactly the same as how the DC server is setup (type 'status' on DC and PC and you will see what I mean)

    I then tried getting CS' files/DLL to load on startup using the base PC Half-Life binary/EXE. To do this, I removed all files in the 'valve' folder and put them somewhere else, copied all the 'cstrike' files into the 'valve' folder and moved the 'valve' files back into the folder without replacing any of the 'cstrike' files. Doing this made CS load up

    Because of this, I do not think loading a mod DLL is impossible or not in the DC engine. I think it was approached wrongly. When you want to load a mod, the engine must be started in that mod. Like I said, you cannot use console commands to change it after the game is started

    So I tried translating how I got CS to load over to Dreamcast, and I got a new pause menu/console background image like PC. I'm not sure if anyone has done this like the custom HUD in an earlier post. But I'm fairly certain nobody has loaded this Blue-Shift menu image correctly. Perhaps it was not implemented yet because the BG remains the same when playing an unmodified Half-Life/Blue-Shift game
    [​IMG]

    I may have gotten the DLL to load also, not sure, it is doubtful that I did. But when I try 'impulse 101' to give all weapons/items 'give item_suit' among other things the engine crashes with "SYS_FILEREADASYNC ON UNREGISTERED SYNC HANDLE" whenever a scripted sequence happens. This is probably because when I made this disc to test, I removed all the files from the PAK files and put them as folders on disc

    I have 2 CDs left. Later I'm going to try combining Half-Life's and Blue-Shift's files into one PAK file and see if that fixes the crash. After that I cannot do anymore hardware tests until next week. But I'll probably buy a big stack of CD-Rs
    ---
    Also that 'cmd new' command that crashes the Dreamcast GoldSRC engine also crashes Steam PC engine
     
    Anthony817 likes this.
  16. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    An update:

    I've continued experimenting different ways to run cmdline parameters. I have not had any success in doing so yet, but I have a few ideas from my tests. I tried using another 1ST_READ.BIN (DC bootstrap is IP.BIN --> 1ST_READ.BIN --> GAME.EXE) from a WinCE program on the Dreamcast which was DCMP3. I renamed HALFLIFE_DC.EXE to DCMP3.EXE and the game loaded fine. Meaning the 1ST_READ.BIN is not game specific and just initializes the WinCE kernel (I'm sure many others already knew this)

    Someone did mention to me that because there is no actual OS or command line, parameters are impossible. But the parameters are just arguments that "stuffcmds" runs at engine launch in the valve.rc file. A way to call or append those arguments so "stuffcmds" can run them is seemingly all that is needed. Which is where I name my ideas for doing so

    Hopefully someone can chime in and offer suggestions or information on how to go about them
    • Find out how to make a new 1ST_READ.BIN to run the game's binary with '-dll dlls/hl.dll' or '-nomouse' to verify it works
    • Find addresses called when the parameters are run on PC, and patch the Dreamcast binary so when the binary is executed it emulates the parameters being called so "stuffcmds" can run them
    • Develop a simple WinCE application that will prompt a user to type their parameters, and run them with the binary
    • Find a way to run parameters within the engine's console after the binary is executed
    The params may not do anything, but there is a bunch of functions not listed as strings in the binary. So the '-dll' parameter is our best lead. Else, we may have to resort to patching the DLL into the binary. Which could get messy and buggy
    https://developer.valvesoftware.com/wiki/Command_Line_Options#Goldsource_Games
     
    Anthony817 likes this.
  17. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    A cool development:

    I found in the WinCE development kit files for an image to boot Windows CE, and an 'image configuration tool'. In the config tool you can set a binary to launch on boot, add and remove various drivers in the WinCE kernel, and set to initialize the modem drivers, serial drivers, RAS/WinSock drivers/services and DirectShow (which we would not need) drivers/services
    [​IMG]

    At first, the game crashed on boot. But I know it ran through the WinCE kernel because just before crash/reboot, the lambda icon displayed on the VMU. But 16 CD-Rs later, the Half-Life binary now loads via Windows CE kernel!

    This may sound like a glorified boot-loader. But it allows complete control over the WinCE kernel and registry. It may not dial the modem. But I am 100% certain the drivers are loaded. A few posts back, I mentioned to Sizious the possibility of using the registry to add any and all functions that would be called via 'hooking'. This is how that would be accomplished if it came down to hacking. To clarify, rather than hooking the drivers into the binary, hooks would only be needed for using the functions already loaded

    I can also connect my retail Dreamcast to the WinCE dev software and debug with command line access via the Dreamcast's serial port. I'm trying to obtain a coders cable for that purpose

    One last thing is, adding "-dll dlls/hl.dll" after the 'autorun: HALFLIFE_DC.EXE' input box above had no effect. But the game does still load correctly. Meaning other parameters I know of in the binary can possibly be tested. I'm hoping they work, so I know how to run parameters in the future. But the non-effect of the parameters could be because the image was rendered in retail mode rather than debug, if I do not test the debug kernel tonight I will test tomorrow after work

    A cool day for this indeed
     
    Anthony817 likes this.
  18. Anthony817

    Anthony817 Familiar Face

    Joined:
    May 12, 2010
    Messages:
    1,078
    Likes Received:
    535
  19. alex81

    alex81 Rising Member

    Joined:
    Mar 27, 2010
    Messages:
    74
    Likes Received:
    3
    I think you must try add parameters like in PC ver. CS
    and create cstrike folder with game files.

    As i know in dc halflife hl.dll is included in DC_HALFLIFE.EXE

    Also all WinCE DLL for modem init, winsock init ect. must be placed in WinCE folder on CD and added to list in Dreamcast image configuration tool.
     
    Anthony817 likes this.
  20. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    I did not try the '-game' parameter, but I did try more parameters after that post last night and none seems to have any effect. Running the game via the WinCE kernel breaks mouse support for some reason, so I cannot properly test the '-nomouse' parameter. Which is the only non-dll related parameter I tested

    Though I did a bunch of tests having the dll in cstrike/dlls/hl.dll. As of last night I was testing the dll in valve/dlls/hl.dll. But I will try the '-game' parameter with the dll in the mod folder later

    If you mean the dll is included in the game files, that is not the case. Tasos had to compile one for me. But if you mean the hl.dll is embedded within the EXE I can say that is probably the case with Blue-Shift. If we can find exactly where in the EXE the dll is embedded, then a patcher can be developed to replace it with a new mod DLL

    I have the WinCE image files on the root directory of the CD the same way it is in the kit, with the Half-Life files also. All of the driver DLLs are in a folder called "OS" by default. Though I will try renaming it to "WinCE" later. It would be pretty incredible if it initializes and dials the modem on Half-Life launch

    The modem can probably be set to dial on launch using the registry files on the CD image. Here is "autorun.reg", you can also see all the parameters I tested last night
    Code:
    [HKEY_LOCAL_MACHINE\init]
        "Autorun"="HALFLIFE_DC.EXE +client.dll dlls/hl.dll +dll dlls/hl.dll -dll dlls/hl.dll -nomouse -maxplayers 16  -w 1024 -h 768"
    
    
    I'll attach the complete registry file since quoting it is too long

    If we can figure out the proper registry values to dial the modem it can probably be added to the autorun.reg and reginit.ini file

    So rather than coding all of the drivers and everything into the DLL, if we can load the DLL either natively or by hacks/patches, drivers for mouse/microphone/hopefully broadband adapter in addition to the existing modem drivers can be added, and the new DLL can be coded to use those drivers rather than coded within the dll
     

    Attached Files:

    Anthony817 likes this.
sonicdude10
Draft saved Draft deleted
Insert every image as a...
  1.  0%

Share This Page