ShowerThoughts
2009-07-28 23:58:11
Hey!
This is a rewrite of my older tutorial, because this one is Newbified and more read-able, the last one was good too, but I wanted it to be perfect. :)
I know YOU are reading this REPLY!(Something useful though!)
How to create Direct-Play/no-installation games or create portable/no-installation applications!
Few things you have to know:
The Install Directory is commonly known as: C:\Program Files + The folder(s) of the creator(s) of the game\application.
For example: C:\Program Files\Activision\Call of Duty 4 - Modern Warfare <— That is the Install Directory which contains the Installation (Game | Application) Files.
Index
- The concept.
- Pros and Cons of this concept.
- Requirements.
- Where to get these requirements.
- Creating a structure.
- Procedures | Functions.
- Creating a Direct-Play/No-installation game | Call of Duty 4 |.
— Install | Patch | Mod the installation.
— Move the game files.
— Move the My Documents game folder files(Possible/Optional).
— Get | Modify the information for Registry Entries
— Create an executable.
- Creating a Direct-Play/No-installation application | CCleaner |.
— Install | Patch | Mod the installation.
— Move the application files.
— Move the My Documents application folder files(Possible/Optional).
— Get | Modify the Registry Entries.
— Create an executable.
- How to use your portable/Direct-Play/no-installation.
- How to create an iso image/autorun.inf.
- How to burn your Direct-Play.
- Extra: How to create a fast updated installer for your game.
- Extra: Portable Downloads section.
Note: Shell Extension programs have a lot of registry files somewhere in the extension shell registry so I think you better avoid them unless you need them very badly, also sometimes you don't use those so yeah…
The concept.
The concept is actually just the fact that you can directly play the game.
Installing is just:
- Moving the files to your hard-disk.
- Adding registry keys to keep contact with these files (for information you inserted, i.e. Serial)
- Adding shortcuts.
- It optimizes with your PC. (Most of the time applications do this also on start-up, so: Don't worry :) ).
We create something that just runs the files from a specific folder or DVD/CD or flash-drive (USB).
The executable which we are going to create will dynamically change the registry entry for the so called "Install Directory".
For example when we burn it to a DVD it will run from the DVD because the executable changes specific settings.
Pros and Cons of this concept.
Pros:
- No installation, this can save a lot of time if you have a large game.
- If you have to patch it you can patch it once and use the patched Game Directory; no need to patch anymore (Will explain later on)
- You don't have to use the real DVD/CD, because you use something called "No CD/DVD crack".
- You can put your own serial/key in for LAN parties.(or of course buy the game another time and use that serial for HOME-USE)
- You can modify the game to your settings like Low or High and then if you use the Game Directory it will use them.
- You can modify your game directory and make it smaller by removing: Movies, Sounds and/or unneeded stuff.
- Not confirmed, but still you should be able to play LAN parties from one shared folder in the network.
Patching - if you have patched the game once the game directory contains the patched files which means you have never have to patch it again if you make it Direct-Play.
Cons:
- On the first launch, some games will show the game with a black surrounding, because the game hasn't been optimized with your computer yet. To fix, simply go to your game settings and fix it ;). (Most of the time not needed :))
- You will always need the portable device (Flash Drive) or CD/DVD. The fix is just copy the files to somewhere on your PC this is faster than installing it with the original installer.
Requirements.
We need some tools to create our own portable/Direct-Play/no-installation game or application.
Tools & Requirements:
- Delphi IDE, We must create an executable in Delphi.
- No-DVD crack, if you want not to get prompted with 'Insert your DVD/CD' all the time.
- ISO creator, if you want to create a Direct-Play DVD.
- ISO mounter, if you do not want to burn your Direct-Play repetitively for testing.
- ISO burner, if you want to burn your Direct-Play DVD.
- Punkbuster setup, if you want to have the latest Punkbuster on your direct play.
- A brain, if you want to create something.
Where to get these requirements.
Legend:
Red = Required | Blue = Recommended | Lime = Free
- Delphi IDE: Delphi 7 | Borland Delphi Studio | Google
- No-DVD crack: http://www.gamecopyworld.com/ | Google
- Iso creator: MagicIso | Nero | Imgburn | Google
- Iso mounter: MagicIso | Daemon Tools | Google
- Iso burner: MagicsIso | Nero | Imgburn | Google
- Brains: Google
Creating a structure.
Why create a structure?
You will understand the tutorial better and makes it much neater, why not?
Now, we want to have a folder with all our files, which will eventually be the end concept, and from which you can run your game/application or even create a DVD with those files..
Create a folder named to your game/application, which is on fast accessible location.
I recommend the desktop, because in this tutorial I will use the desktop location too.
I will show two examples: one of a game and one of an application.
Note: if I say 'D:\' it means 'DesktopDirectory:\', do NOT forget this.
For example: 'D:\cod 4' is the 'cod 4' folder on your desktop which for me is: H:\Documents and Settings\Owner\Desktop\cod 4
D:\cod 4 = H:\Documents and Settings\Owner\Desktop\cod 4
Do not forget!
We have to create 2 folders.
Create D:\<Insert_Name>
Create D:\<Insert_Name>\Install Files
Procedures | Functions.
Here you can find the procedures and functions needed later on in the tutorial.
Index
- function GetMyDocuments: string;
- function GetProgramFiles: string;
- function GetStartMenu: string;
You can get the My Documents location by using this code.
You can get the Program Files location using this code.
You can get the Start Menu location by using this code.
You can run for example an executable with this.
Creating a Direct-Play/No-installation game | Call of Duty 4 |.
In this chapter I will create Direct-Play of Call of Duty 4.
You can make your own of any game you want with just changing Call of Duty 4 to your game and of course changing the call of duty 4 specific/only stuff to your own game.
It is recommend (almost required) to read the chapters before this one.
Install | Patch | Mod the installation.
Install Call of Duty 4 to your computer.
If you want the patches, or you need them, install them before continuing.
Make sure you got the right No-DVD for the right game version.
Update Punkbuster with the Punkbuster setup.
If you are sure that you have installed | Patched | Updated everything to the latest, continue.
Move the game files.
Read the note at the 'Creating a structure' chapter.
We are going to create some folders.
Create 'D:\cod 4'
Create 'D:\cod 4\Install Files'
Create 'D:\cod 4\Install Files\Call of Duty 4 - Modern Warfare'
Now you have to copy the files from your Install Directory into your 'D:\cod 4\Call of Duty 4 - Modern Warfare'
Now the folder in 'D:\cod 4\Call of Duty 4 - Modern Warfare' will contain the same files as 'C:\Program Files\Activision\Call of Duty 4 - Modern Warfare'.
Note:
The Install Directory is commonly known as: 'C:\Program Files + The folder(s) of the creator(s) of the game/application'.
For example: 'C:\Program Files\Activision\Call of Duty 4 - Modern Warfare' <— That is the Install Directory which contains the Installation(Game | Application) Files.
If the Install Directory doesn’t contain the No-Dvd crack, still copy it into your: 'D:\cod 4\Call of Duty 4 - Modern Warfare' folder.
Get | Modify the Registry Entries.
We need the register editor made by Microsoft to search the registry entries we need for cod 4.
I have already found them of course :p.
Open up register editor by pushing the Windows Key + R at the same type until the Run window comes up.
Type 'regedit' (no '') and hit enter.
It is recommended to read and write the registry entries from and to the 'HKEY_LOCAL_MACHINE'.
Even if you have the registry in 'HKEY_CURRENT_USER' then still create them under 'HKEY_LOCAL_MACHINE' if this does not succeed try to create them under 'HKEY_CURRENT_USER' and it should work.
Note: Check 'HKEY_LOCAL_MACHINE\Software' and 'HKEY_CURRENT_USER\Software' to be sure you have everything.
You might found cod 4 already in 'HKEY_LOCAL_MACHINE\SOFTWARE\Activision\Call of Duty 4' click it and you will see information about the game when we are going to create our Direct-Play we have to change these values when the executable will be ran(Dynamic).
We can copy these information slow and fast and we will use the fast way Right click on 'HKEY_LOCAL_MACHINE\SOFTWARE\Activision\Call of Duty 4' and click export save it to 'D:\cod 4' for future reference.
Open it with notepad(Right click the file, then click 'Edit' | 'Open with…') and, IMO, the information is much more comfortable to work with,
program Project1; | Is just the name of the console application.
{$APPTYPE CONSOLE}| Is a comment saying that this is a console application.
uses SysUtils; | Is just including libraries/classes you need(Same as |C++ #include|C# using|Scar {.Include). Note: in this tutorial you have to add some classes/libraries.
begin
{ TODO -oUser -cConsole Main : Insert code here }
end. | Is the main loop, this is the first code that gets executed. (The comment says that you have to insert your code there,-.-")
I expect that you have some knowledge of using Delphi because you need to use some procedures functions to create your executable.
Remember that if I reference to a Procedure/Function, you need to see the 'Procedures | Functions.' Chapter.
We are going to add the create registry entries part.
We need to add the Registry class and the Windows class, add Registry and Windows to the uses.
Which can be in our case:
HKEY_LOCAL_MACHINE
or
HKEY_CURRENT_USER
I pick HKEY_LOCAL_MACHINE, because the call of duty 4 registry entries can be found there.
We have found the registry entries to create in the previous chapter.
Like I already told Direct-Play or portable games/applications are dynamic.
Let’s first create and fill in the static information we got and then make dynamic what has to be dynamic.
Like:
Go to the Procedures | Function chapter and place these procedures functions into your code:
function GetStartMenu;
Don't forget to add the classes to the uses.
Now we are going to use shellexecute to show a folder where the game be ran from, why I don't run it directly CoD 4 somehow does not allow to be ran from a different handle.
Don't forget to add ShellApi to the uses.
We are going to add the folder opening to our mainloop so it will become:
For you game only because CoD 4 blocks it somehow, I would advice to try if your game runs!
Now we have one problem: the PortableRootFolder will only be known in the CreateRegistryEntries procedure.
If we want to do it this way, then we must create a global variable.
At the top of the program a few lines beneath the uses, add var and write PortableRootFolder: string; one the next line;
Though, we have to remove:
PortableRootFolder will be set in the CreateRegistryEntries procedure, and so it will contain the right info for the CreateShortcut procedure we use.
The total console application:
Create the executable and put it inside: 'D:\cod4\<Here>'.
Now you should be able to run the portable game from any computer! :).
Total picture of structure:
D:\cod4
D:\cod4\PortableRunCod4.exe <—The one we created :) you can name it whatever you like.
D:\cod4\Install Files
D:\cod4\Install Files\Call of Duty 4 - Modern Warfare <— Which contains all the game files from for example C:\Program Files\Activision\Call of Duty 4 - Modern Warfare
You can also put the icon from the original game executeable on the new one, that's pretty nifty ;).
Portabling/Creating a Direct-Play/No-installation application | CCleaner |.
In this chapter, I will create a portable CCleaner, one of my favourite programs.
You can create your own portable application; Learning to do it yourself is the best way!
Install|Patch|Mod the installation.
Download and install the latest version of CCleaner.
Your application might need to be cracked, so put the crack files in the application directory commonly found in C:\Program Files\<Here>
Move the application files.
Now this takes like 1 sec compared to copying a game folder.
Create D:\CCleaner
Create D:\CCleaner\Install Files
Create D:\CCleaner\Install Files\CCleaner
Move C:\Program Files\CCleaner to D:\CCleaner\Install Files\CCleaner
Get|Modify the Registry Entries.
We need the register editor made by Microsoft to search the registry entries we need for CCleaner.
I have already found them, of course :p.
Open up register editor by pushing the Windows Key + R at the same type until the Run window comes up.
Type 'regedit' (no '') and hit enter.
It is recommend to read and write the registry entries from and to the 'HKEY_LOCAL_MACHINE'.
Even if you have the registry in 'HKEY_CURRENT_USE' then still create them under 'HKEY_LOCAL_MACHINE' if this does not succeeds try to create them under 'HKEY_CURRENT_USER' and you could succeed.
Note: Check 'HKEY_LOCAL_MACHINE\Software' and 'HKEY_CURRENT_USER\Software' to be sure you have everything.
You might found CCleaner already in 'HKEY_LOCAL_MACHINE\SOFTWARE\CCleaner' click it and you will see information about the application and we might have to change some of those values because they are dynamic.
We can copy these information slow and fast and we will use the fast way Right click on 'HKEY_LOCAL_MACHINE\SOFTWARE\CCleaner' and click export save it to 'D:\CCleaner' for future reference.
Open it with notepad (Right click the file, then click 'Edit'|'Open with…') and, imo, the information is much more comfortable to work with.
Only 2 registry entries.
There is only 1 thing you need to know and that is if you have @="H:\\Program Files\\CCleaner" that is the same in delphi like: ''="H:\\Program Files\\CCleaner"
since "@" and '' points DIRECTLY to the key.
One other things is UpdateCheck = 1 that means ON, in like the 100 cases software use 1 and 0 in a string 0 means OFF and 1 means ON(ON = True | OFF = False).
Create an executeable.
Start your Delphi IDE or something that can at least create a console application.
I am using Delphi 7.
Start a Console Application(File|New|Other..|Click 'Console Application'|Click Ok)
When you start it you will see this code:
program Project1; | Is just the name of the console application.
{$APPTYPE CONSOLE}| Is a comment saying that this is a console application.
uses SysUtils; | Is just including libraries/classes you need(Same as |C++ #include|C# using|Scar {.Include). Note: in this tutorial you have to add some classes/libraries.
begin
{ TODO -oUser -cConsole Main : Insert code here }
end. | Is the mainloop, this is the first code that gets executed.(The comment says that you have to insert your code there,-.-")
I expect that you have some knowledge of using Delphi because you need to use some procedures/functions to create your executable.
Remember that if I reference to a Procedure/Function, you need to see the 'Procedures | Functions.' Chapter.
We are going to add the create registry entries part.
We need to add the Registry class and the Windows class, and add Registry and Windows to the uses.
Lets create a CreateRegistryEntries procedure.
Which can be in our case:
HKEY_LOCAL_MACHINE
or
HKEY_CURRENT_USER
I pick HKEY_LOCAL_MACHINE, because the call of duty 4 registry entries can be found there.
We have found the registry entries to create in the previous chapter.
Like I already told Direct-Play or portable games/applications are dynamic.
Let’s first create and fill in the static information we got and then make dynamic what has to be dynamic.
Now let’s add the part that we will run CCleaner, we will code this into the main loop.
The code for the executable in total would be:
Place the executable in D:\CCleaner\<Here>.
You're done!
How to use your portable/Direct-Play/no-installation.
You can run your Direct Play from anywhere, places as your flash drive (USB), on a DVD/CD.
Did you after think about the fact that it is highly possible to run a Portable Game from a shared network?
I am going to try it on my next LAN party and will tell you how it went! :)
Theoretical it should work.
How to create an autorun.inf/iso image.
You can go advanced with autorun files, but this is definitely not needed.
Create a text file and open it with notepad.
Copy this into notepad:
Code:
[autorun]
Open=<YourJustCreatedExecuteableName>.exe
Icon=<YourJustCreatedExecuteableName>.exe,0
We create a portable application or game for example I just made cod4 portable, in my case it would then be:
Code:
[autorun]
Open=RunCoD4.exe
Icon=RunCoD4.exe,0
Now save this file as 'autorun.inf' and place it in your 'D:\<PortableName>\<Here>'.
That would be 'D:\cod 4\autorun.inf' for me.
Note: D:\cod4\ can also be 'D:\THIS IS THE FOLDER WHERE MY DIRECT PLAY FILES FOR THE GAME BATTLEFIELD 2 ARE' for example it doesn't matter, but the easiest would just be 'D:\<PortableName>'
To create the ISO image fire up MagicISO and go to File –> New –> Data CD/DVD image.
Rename the ISO name instead of these weird numbers on your left(Right-Click).
Drag the contents of your portable application/game into MagicISO also drag the autorun.inf you created into MagicISO, then save it as a ISO image.
How to test/burn your Direct-Play.
Now it is always smart to test your iso before you burn it so use a mounting tool like Daemon Tools or the free component of MagicISO to mount your CD/DVD.
To burn it you can do many things, in MagicISO go to Tools –> Burn CD/DVD with ISO …
Extra: How to create a fast | updated | installer for your game.
Coming Soon!
Extra: Portable Downloads Section.
CCleaner | Download | Note: CCleaner is free to use and I am a happy user for already serveral years!
CoD 4 | Download | Note: You have to put in your own Call of Duty game files.
Coming more!
Post your portables too!
Created in notepad*.
This is a rewrite of my older tutorial, because this one is Newbified and more read-able, the last one was good too, but I wanted it to be perfect. :)
I know YOU are reading this REPLY!(Something useful though!)
How to create Direct-Play/no-installation games or create portable/no-installation applications!
Few things you have to know:
The Install Directory is commonly known as: C:\Program Files + The folder(s) of the creator(s) of the game\application.
For example: C:\Program Files\Activision\Call of Duty 4 - Modern Warfare <— That is the Install Directory which contains the Installation (Game | Application) Files.
Index
- The concept.
- Pros and Cons of this concept.
- Requirements.
- Where to get these requirements.
- Creating a structure.
- Procedures | Functions.
- Creating a Direct-Play/No-installation game | Call of Duty 4 |.
— Install | Patch | Mod the installation.
— Move the game files.
— Move the My Documents game folder files(Possible/Optional).
— Get | Modify the information for Registry Entries
— Create an executable.
- Creating a Direct-Play/No-installation application | CCleaner |.
— Install | Patch | Mod the installation.
— Move the application files.
— Move the My Documents application folder files(Possible/Optional).
— Get | Modify the Registry Entries.
— Create an executable.
- How to use your portable/Direct-Play/no-installation.
- How to create an iso image/autorun.inf.
- How to burn your Direct-Play.
- Extra: How to create a fast updated installer for your game.
- Extra: Portable Downloads section.
Note: Shell Extension programs have a lot of registry files somewhere in the extension shell registry so I think you better avoid them unless you need them very badly, also sometimes you don't use those so yeah…
The concept.
The concept is actually just the fact that you can directly play the game.
Installing is just:
- Moving the files to your hard-disk.
- Adding registry keys to keep contact with these files (for information you inserted, i.e. Serial)
- Adding shortcuts.
- It optimizes with your PC. (Most of the time applications do this also on start-up, so: Don't worry :) ).
We create something that just runs the files from a specific folder or DVD/CD or flash-drive (USB).
The executable which we are going to create will dynamically change the registry entry for the so called "Install Directory".
For example when we burn it to a DVD it will run from the DVD because the executable changes specific settings.
Pros and Cons of this concept.
Pros:
- No installation, this can save a lot of time if you have a large game.
- If you have to patch it you can patch it once and use the patched Game Directory; no need to patch anymore (Will explain later on)
- You don't have to use the real DVD/CD, because you use something called "No CD/DVD crack".
- You can put your own serial/key in for LAN parties.(or of course buy the game another time and use that serial for HOME-USE)
- You can modify the game to your settings like Low or High and then if you use the Game Directory it will use them.
- You can modify your game directory and make it smaller by removing: Movies, Sounds and/or unneeded stuff.
- Not confirmed, but still you should be able to play LAN parties from one shared folder in the network.
Patching - if you have patched the game once the game directory contains the patched files which means you have never have to patch it again if you make it Direct-Play.
Cons:
- On the first launch, some games will show the game with a black surrounding, because the game hasn't been optimized with your computer yet. To fix, simply go to your game settings and fix it ;). (Most of the time not needed :))
- You will always need the portable device (Flash Drive) or CD/DVD. The fix is just copy the files to somewhere on your PC this is faster than installing it with the original installer.
Requirements.
We need some tools to create our own portable/Direct-Play/no-installation game or application.
Tools & Requirements:
- Delphi IDE, We must create an executable in Delphi.
- No-DVD crack, if you want not to get prompted with 'Insert your DVD/CD' all the time.
- ISO creator, if you want to create a Direct-Play DVD.
- ISO mounter, if you do not want to burn your Direct-Play repetitively for testing.
- ISO burner, if you want to burn your Direct-Play DVD.
- Punkbuster setup, if you want to have the latest Punkbuster on your direct play.
- A brain, if you want to create something.
Where to get these requirements.
Legend:
Red = Required | Blue = Recommended | Lime = Free
- Delphi IDE: Delphi 7 | Borland Delphi Studio | Google
- No-DVD crack: http://www.gamecopyworld.com/ | Google
- Iso creator: MagicIso | Nero | Imgburn | Google
- Iso mounter: MagicIso | Daemon Tools | Google
- Iso burner: MagicsIso | Nero | Imgburn | Google
- Brains: Google
Creating a structure.
Why create a structure?
You will understand the tutorial better and makes it much neater, why not?
Now, we want to have a folder with all our files, which will eventually be the end concept, and from which you can run your game/application or even create a DVD with those files..
Create a folder named to your game/application, which is on fast accessible location.
I recommend the desktop, because in this tutorial I will use the desktop location too.
I will show two examples: one of a game and one of an application.
Note: if I say 'D:\' it means 'DesktopDirectory:\', do NOT forget this.
For example: 'D:\cod 4' is the 'cod 4' folder on your desktop which for me is: H:\Documents and Settings\Owner\Desktop\cod 4
D:\cod 4 = H:\Documents and Settings\Owner\Desktop\cod 4
Do not forget!
We have to create 2 folders.
Create D:\<Insert_Name>
Create D:\<Insert_Name>\Install Files
Procedures | Functions.
Here you can find the procedures and functions needed later on in the tutorial.
Index
- function GetMyDocuments: string;
- function GetProgramFiles: string;
- function GetStartMenu: string;
You can get the My Documents location by using this code.
function GetMyDocuments: string;
var
r: Bool;
path: array[0..Max_Path] of Char;
begin
r := ShGetSpecialFolderPath(0, Path, CSIDL_Personal, False) ;
if not r then raise Exception.Create('Could not find My Documents folder location.') ;
Result := Path;
end;
Add ShlObj to the uses.You can get the Program Files location using this code.
function GetProgramFiles: string;
var
r: Bool;
path: array[0..Max_Path] of Char;
begin
Result := GetEnvironmentVariable('ProgramFiles');
end;
You can get the Start Menu location by using this code.
function GetStartMenu: string;
var
r: Bool;
path: array[0..Max_Path] of Char;
begin
r := ShGetSpecialFolderPath(0, Path, CSIDL_Personal, False) ;
if not r then raise Exception.Create('Could not find My Documents folder location.') ;
Result := Path;
end;
Add ShlObj to the uses.You can run for example an executable with this.
procedure Run(Path:string);
var
SEInfo: TShellExecuteInfo;
ExitCode: DWORD;
ExecuteFile, ParamString, StartInString: string;
begin
ExecuteFile := Path;
FillChar(SEInfo, SizeOf(SEInfo), 0);
SEInfo.cbSize := SizeOf(TShellExecuteInfo);
with SEInfo do begin
fMask := SEE_MASK_NOCLOSEPROCESS;
lpFile := PChar(ExecuteFile);
nShow := SW_SHOWNORMAL;
end;
ShellExecuteEx(@SEInfo);
end;
Add ShellApi to the uses.Creating a Direct-Play/No-installation game | Call of Duty 4 |.
In this chapter I will create Direct-Play of Call of Duty 4.
You can make your own of any game you want with just changing Call of Duty 4 to your game and of course changing the call of duty 4 specific/only stuff to your own game.
It is recommend (almost required) to read the chapters before this one.
Install | Patch | Mod the installation.
Install Call of Duty 4 to your computer.
If you want the patches, or you need them, install them before continuing.
Make sure you got the right No-DVD for the right game version.
Update Punkbuster with the Punkbuster setup.
If you are sure that you have installed | Patched | Updated everything to the latest, continue.
Move the game files.
Read the note at the 'Creating a structure' chapter.
We are going to create some folders.
Create 'D:\cod 4'
Create 'D:\cod 4\Install Files'
Create 'D:\cod 4\Install Files\Call of Duty 4 - Modern Warfare'
Now you have to copy the files from your Install Directory into your 'D:\cod 4\Call of Duty 4 - Modern Warfare'
Now the folder in 'D:\cod 4\Call of Duty 4 - Modern Warfare' will contain the same files as 'C:\Program Files\Activision\Call of Duty 4 - Modern Warfare'.
Note:
The Install Directory is commonly known as: 'C:\Program Files + The folder(s) of the creator(s) of the game/application'.
For example: 'C:\Program Files\Activision\Call of Duty 4 - Modern Warfare' <— That is the Install Directory which contains the Installation(Game | Application) Files.
If the Install Directory doesn’t contain the No-Dvd crack, still copy it into your: 'D:\cod 4\Call of Duty 4 - Modern Warfare' folder.
Get | Modify the Registry Entries.
We need the register editor made by Microsoft to search the registry entries we need for cod 4.
I have already found them of course :p.
Open up register editor by pushing the Windows Key + R at the same type until the Run window comes up.
Type 'regedit' (no '') and hit enter.
It is recommended to read and write the registry entries from and to the 'HKEY_LOCAL_MACHINE'.
Even if you have the registry in 'HKEY_CURRENT_USER' then still create them under 'HKEY_LOCAL_MACHINE' if this does not succeed try to create them under 'HKEY_CURRENT_USER' and it should work.
Note: Check 'HKEY_LOCAL_MACHINE\Software' and 'HKEY_CURRENT_USER\Software' to be sure you have everything.
You might found cod 4 already in 'HKEY_LOCAL_MACHINE\SOFTWARE\Activision\Call of Duty 4' click it and you will see information about the game when we are going to create our Direct-Play we have to change these values when the executable will be ran(Dynamic).
We can copy these information slow and fast and we will use the fast way Right click on 'HKEY_LOCAL_MACHINE\SOFTWARE\Activision\Call of Duty 4' and click export save it to 'D:\cod 4' for future reference.
Open it with notepad(Right click the file, then click 'Edit' | 'Open with…') and, IMO, the information is much more comfortable to work with,
[HKEY_LOCAL_MACHINE\SOFTWARE\Activision\Call of Duty 4]
"InstallPath"="H:\\Program Files\\Activision\\Call of Duty 4 - Modern Warfare\\"
"InstallDrive"="L:\\"
"Language"="enu"
"StartMenuFolder"="H:\\Documents and Settings\\All Users\\Start Menu\\Programs\\Activision\\Call of Duty(R) 4 - Modern Warfare(TM)"
"Version"="1.0"
"UninstallString"="H:\\Program Files\\InstallShield Installation Information\\{E48469CC-634E-4FD4-A122-1497C286D217}\\uninstall.exe -runfromtemp -l0x0409"
"EXEStringS"="H:\\Program Files\\Activision\\Call of Duty 4 - Modern Warfare\\iw3sp.exe"
"EXEStringM"="H:\\Program Files\\Activision\\Call of Duty 4 - Modern Warfare\\iw3mp.exe"
"QA"="14.0"
"Techhelp"="H:\\Program Files\\Activision\\Call of Duty 4 - Modern Warfare\\Docs\\Help\\readme.htm"
"codkey"="********************"
[Code]
I have not patched or updated the game, as it just works fine for me.
Your information might be little bit different.
We have the information we need now, in the next chapter we will create these registry entries with variables who contain dynamic paths/directories/information.
[B][SIZE="4"][COLOR="Orange"]Create an executable.[/COLOR][/SIZE][/B]
Start your Delphi IDE or at least something that can create a console application.
I am using Delphi 7.
Start a Console Application (File | New | Other.. |Click 'Console Application' | Click Ok)
When you start it you will see this code:
[Code]
program Project1;
{$APPTYPE CONSOLE}
uses
SysUtils;
begin
{ TODO -oUser -cConsole Main : Insert code here }
end.
I am going to explain in short what everything means.program Project1; | Is just the name of the console application.
{$APPTYPE CONSOLE}| Is a comment saying that this is a console application.
uses SysUtils; | Is just including libraries/classes you need(Same as |C++ #include|C# using|Scar {.Include). Note: in this tutorial you have to add some classes/libraries.
begin
{ TODO -oUser -cConsole Main : Insert code here }
end. | Is the main loop, this is the first code that gets executed. (The comment says that you have to insert your code there,-.-")
I expect that you have some knowledge of using Delphi because you need to use some procedures functions to create your executable.
Remember that if I reference to a Procedure/Function, you need to see the 'Procedures | Functions.' Chapter.
We are going to add the create registry entries part.
We need to add the Registry class and the Windows class, add Registry and Windows to the uses.
uses
SysUtils, Registry, Windows;
[Code]
With this Registry class we can create, read, edit and delete registry entries/keys.
Lets create a CreateRegistryEntries procedure.
[Code]
procedure CreateRegistryEntries;
var
Reg: TRegistry;
begin
Reg := TRegistry.Create;//Creates the registry so you can use it.
end.
Okay, we can now almost create registry entries, we have to set a registry RootKey.Which can be in our case:
HKEY_LOCAL_MACHINE
or
HKEY_CURRENT_USER
I pick HKEY_LOCAL_MACHINE, because the call of duty 4 registry entries can be found there.
procedure CreateRegistryEntries;
var
Reg: TRegistry;
begin
Reg := TRegistry.Create;//Creates the registry so you can use it.
Reg.RootKey := HKEY_LOCAL_MACHINE;
end.
We have found the registry entries to create in the previous chapter.
Like I already told Direct-Play or portable games/applications are dynamic.
Let’s first create and fill in the static information we got and then make dynamic what has to be dynamic.
[HKEY_LOCAL_MACHINE\SOFTWARE\Activision\Call of Duty 4]
"InstallPath"="H:\\Program Files\\Activision\\Call of Duty 4 - Modern Warfare\\"
"InstallDrive"="L:\\"
"Language"="enu"
"StartMenuFolder"="H:\\Documents and Settings\\All Users\\Start Menu\\Programs\\Activision\\Call of Duty(R) 4 - Modern Warfare(TM)"
"Version"="1.0"
"UninstallString"="H:\\Program Files\\InstallShield Installation Information\\{E48469CC-634E-4FD4-A122-1497C286D217}\\uninstall.exe -runfromtemp -l0x0409"
"EXEStringS"="H:\\Program Files\\Activision\\Call of Duty 4 - Modern Warfare\\iw3sp.exe"
"EXEStringM"="H:\\Program Files\\Activision\\Call of Duty 4 - Modern Warfare\\iw3mp.exe"
"QA"="14.0"
"Techhelp"="H:\\Program Files\\Activision\\Call of Duty 4 - Modern Warfare\\Docs\\Help\\readme.htm"
"codkey"="********************"
We are lucky that all this information is under the [HKEY_LOCAL_MACHINE\SOFTWARE\Activision\Call of Duty 4] key, make SURE when you create your portable game that if you have information under different keys like [HKEY_LOCAL_MACHINE\SOFTWARE\Activision\Call of Duty 4] and [HKEY_LOCAL_MACHINE\SOFTWARE\Activision\Call of Duty 4\ergc] that you create a second Reg!Like:
procedure CreateRegistryEntries;
var
Reg, Reg2: TRegistry;
begin
Reg := TRegistry.Create;//Creates the registry so you can use it.
Reg.RootKey := HKEY_LOCAL_MACHINE;
//Create entries.
Reg2 := TRegistry.Create;//Creates the registry so you can use it.
Reg2.RootKey := HKEY_LOCAL_MACHINE;
//Create entries on a different key.
end.
To get back to our piece.
procedure CreateRegistryEntries;
var
Reg: TRegistry;
begin
Reg := TRegistry.Create;//Creates the registry so you can use it.
Reg.RootKey := HKEY_LOCAL_MACHINE;
Reg.OpenKey('SOFTWARE\Activision\Call of Duty 4', True);//Opens the key and if it does not exist it creates it.
Reg.WriteString('InstallPath','');//dynamic
Reg.WriteString('InstallDrive','');//dynamic
Reg.WriteString('Language','enu');//static
Reg.WriteString('StartMenuFolder','');//dynamic
Reg.WriteString('Version','1.0');//static
Reg.WriteString('UninstallString','');
Reg.WriteString('EXEStringS','');//dynamic
Reg.WriteString('EXEStringM','');//dynamic
Reg.WriteString('QA','14.0');//static
Reg.WriteString('Techhelp','');//dynamic
Reg.WriteString('codkey','********************');//static
end;
For the dynamic one we have to get the information from the pc where the executable is run on.Go to the Procedures | Function chapter and place these procedures functions into your code:
function GetStartMenu;
Don't forget to add the classes to the uses.
procedure CreateRegistryEntries;
var
Reg: TRegistry;
PortableRootFolder, InstallDrive: string;
begin
PortableRootFolder := ExtractFileDir(ParamStr(0));//ParamStr(0) = 'D:\cod4\ExecuteableName.exe', so PortableRootFolder = 'D:\cod4'.
InstallDrive := ExtractFileDrive(ParamStr(0));//ParamStr(0) = 'D:\cod4\ExecuteableName.exe', so InstallDrive = 'D:\'.(so C:\, since D:\ is the desktop directory)
Reg := TRegistry.Create;//Creates the registry so you can use it.
Reg.RootKey := HKEY_LOCAL_MACHINE;
Reg.OpenKey('SOFTWARE\Activision\Call of Duty 4', True);//Opens the key and if it does not exist it creates it.
Reg.WriteString('InstallPath', PortableRootFolder+'\Install Files\Call of Duty 4 - Modern Warfare');
Reg.WriteString('InstallDrive', InstallDrive);
Reg.WriteString('Language','enu');
Reg.WriteString('StartMenuFolder', GetStartMenu);//You got this function from the Procedures | Function Chapter.
Reg.WriteString('Version','1.0');
Reg.WriteString('UninstallString','');//Not important
Reg.WriteString('EXEStringS', PortableRootFolder + '\Install Files\Call of Duty 4 - Modern Warfare\iw3sp.exe');
Reg.WriteString('EXEStringM', PortableRootFolder + '\Install Files\Call of Duty 4 - Modern Warfare\iw3mp.exe');
Reg.WriteString('QA','15.0');
Reg.WriteString('Techhelp', PortableRootFolder + '\Install Files\Call of Duty 4 - Modern Warfare\Docs\Help\readme.htm');
Reg.WriteString('codkey','********************');
end;
Now we are going to use shellexecute to show a folder where the game be ran from, why I don't run it directly CoD 4 somehow does not allow to be ran from a different handle.
Don't forget to add ShellApi to the uses.
We are going to add the folder opening to our mainloop so it will become:
begin
CreateRegistryEntries;
ShellExecute(Application.Handle,'open', Pchar(PortableRootFolder + '\Install Files\Call of Duty 4 - Modern Warfare'), nil, nil, SW_SHOWNORMAL);
end.
You can change PortableRootFolder + '\Install Files\Call of Duty 4 - Modern Warfare' into PortableRootFolder + '\Install Files\Call of Duty 4 - Modern Warfare\iw3sp.exe'For you game only because CoD 4 blocks it somehow, I would advice to try if your game runs!
Now we have one problem: the PortableRootFolder will only be known in the CreateRegistryEntries procedure.
If we want to do it this way, then we must create a global variable.
At the top of the program a few lines beneath the uses, add var and write PortableRootFolder: string; one the next line;
var
PortableRootFolder: string;
Now we have declared a global variable.Though, we have to remove:
PortableRootFolder: string;
From the CreateRegistryEntries procedure.PortableRootFolder will be set in the CreateRegistryEntries procedure, and so it will contain the right info for the CreateShortcut procedure we use.
The total console application:
program cod4;
{$APPTYPE CONSOLE}
uses
SysUtils, Windows, Registry, ShellApi, ShlObj, Forms;
var
PortableRootFolder: string;
function GetStartMenu: string;
var
r: Bool;
path: array[0..Max_Path] of Char;
begin
r := ShGetSpecialFolderPath(0, Path, CSIDL_STARTMENU, False) ;
if not r then raise Exception.Create('Could not find My Documents folder location.') ;
Result := Path;
end;
procedure CreateRegistryEntries;
var
Reg: TRegistry;
InstallDrive: string;
begin
PortableRootFolder := ExtractFileDir(ParamStr(0));//ParamStr(0) = 'D:\cod4\ExecuteableName.exe', so PortableRootFolder = 'D:\cod4'.
InstallDrive := ExtractFileDrive(ParamStr(0));//ParamStr(0) = 'D:\cod4\ExecuteableName.exe', so InstallDrive = 'D:\'.(so C:\, since D:\ is the desktop directory)
Reg := TRegistry.Create;//Creates the registry so you can use it.
Reg.RootKey := HKEY_LOCAL_MACHINE;
Reg.OpenKey('SOFTWARE\Activision\Call of Duty 4', True);//Opens the key and if it does not exist it creates it.
Reg.WriteString('InstallPath', PortableRootFolder+'\Install Files\Call of Duty 4 - Modern Warfare\');
Reg.WriteString('InstallDrive', InstallDrive);
Reg.WriteString('Language','enu');
Reg.WriteString('StartMenuFolder', GetStartMenu+'\Activision\Call of Duty(R) 4 - Modern Warfare(TM)');//You got this function from the Procedures | Function Chapter.
Reg.WriteString('Version','1.0');
Reg.WriteString('UninstallString','');//Not important
Reg.WriteString('EXEStringS', PortableRootFolder + '\Install Files\Call of Duty 4 - Modern Warfare\iw3sp.exe');
Reg.WriteString('EXEStringM', PortableRootFolder + '\Install Files\Call of Duty 4 - Modern Warfare\iw3mp.exe');
Reg.WriteString('QA','15.0');
Reg.WriteString('Techhelp', PortableRootFolder + '\Install Files\Call of Duty 4 - Modern Warfare\Docs\Help\readme.htm');
Reg.WriteString('codkey','********************');
end;
begin
CreateRegistryEntries;
ShellExecute(Application.Handle,'open', Pchar(PortableRootFolder + '\Install Files\Call of Duty 4 - Modern Warfare'), nil, nil, SW_SHOWNORMAL);
end.
Create the executable and put it inside: 'D:\cod4\<Here>'.
Now you should be able to run the portable game from any computer! :).
Total picture of structure:
D:\cod4
D:\cod4\PortableRunCod4.exe <—The one we created :) you can name it whatever you like.
D:\cod4\Install Files
D:\cod4\Install Files\Call of Duty 4 - Modern Warfare <— Which contains all the game files from for example C:\Program Files\Activision\Call of Duty 4 - Modern Warfare
You can also put the icon from the original game executeable on the new one, that's pretty nifty ;).
Portabling/Creating a Direct-Play/No-installation application | CCleaner |.
In this chapter, I will create a portable CCleaner, one of my favourite programs.
You can create your own portable application; Learning to do it yourself is the best way!
Install|Patch|Mod the installation.
Download and install the latest version of CCleaner.
Your application might need to be cracked, so put the crack files in the application directory commonly found in C:\Program Files\<Here>
Move the application files.
Now this takes like 1 sec compared to copying a game folder.
Create D:\CCleaner
Create D:\CCleaner\Install Files
Create D:\CCleaner\Install Files\CCleaner
Move C:\Program Files\CCleaner to D:\CCleaner\Install Files\CCleaner
Get|Modify the Registry Entries.
We need the register editor made by Microsoft to search the registry entries we need for CCleaner.
I have already found them, of course :p.
Open up register editor by pushing the Windows Key + R at the same type until the Run window comes up.
Type 'regedit' (no '') and hit enter.
It is recommend to read and write the registry entries from and to the 'HKEY_LOCAL_MACHINE'.
Even if you have the registry in 'HKEY_CURRENT_USE' then still create them under 'HKEY_LOCAL_MACHINE' if this does not succeeds try to create them under 'HKEY_CURRENT_USER' and you could succeed.
Note: Check 'HKEY_LOCAL_MACHINE\Software' and 'HKEY_CURRENT_USER\Software' to be sure you have everything.
You might found CCleaner already in 'HKEY_LOCAL_MACHINE\SOFTWARE\CCleaner' click it and you will see information about the application and we might have to change some of those values because they are dynamic.
We can copy these information slow and fast and we will use the fast way Right click on 'HKEY_LOCAL_MACHINE\SOFTWARE\CCleaner' and click export save it to 'D:\CCleaner' for future reference.
Open it with notepad (Right click the file, then click 'Edit'|'Open with…') and, imo, the information is much more comfortable to work with.
[HKEY_LOCAL_MACHINE\SOFTWARE\CCleaner]
"UpdateCheck"="1"
@="H:\\Program Files\\CCleaner"
Now this is going to be an easy job!Only 2 registry entries.
There is only 1 thing you need to know and that is if you have @="H:\\Program Files\\CCleaner" that is the same in delphi like: ''="H:\\Program Files\\CCleaner"
since "@" and '' points DIRECTLY to the key.
One other things is UpdateCheck = 1 that means ON, in like the 100 cases software use 1 and 0 in a string 0 means OFF and 1 means ON(ON = True | OFF = False).
Create an executeable.
Start your Delphi IDE or something that can at least create a console application.
I am using Delphi 7.
Start a Console Application(File|New|Other..|Click 'Console Application'|Click Ok)
When you start it you will see this code:
program Project1;
{$APPTYPE CONSOLE}
uses
SysUtils;
begin
{ TODO -oUser -cConsole Main : Insert code here }
end.
I am going to explain in short what everything means.program Project1; | Is just the name of the console application.
{$APPTYPE CONSOLE}| Is a comment saying that this is a console application.
uses SysUtils; | Is just including libraries/classes you need(Same as |C++ #include|C# using|Scar {.Include). Note: in this tutorial you have to add some classes/libraries.
begin
{ TODO -oUser -cConsole Main : Insert code here }
end. | Is the mainloop, this is the first code that gets executed.(The comment says that you have to insert your code there,-.-")
I expect that you have some knowledge of using Delphi because you need to use some procedures/functions to create your executable.
Remember that if I reference to a Procedure/Function, you need to see the 'Procedures | Functions.' Chapter.
We are going to add the create registry entries part.
We need to add the Registry class and the Windows class, and add Registry and Windows to the uses.
uses
SysUtils, Registry, Windows;
With this Registry class we can create, read, edit and delete registry entries/keys.Lets create a CreateRegistryEntries procedure.
procedure CreateRegistryEntries;
var
Reg: TRegistry;
begin
Reg := TRegistry.Create;//Creates the registry so you can use it.
end.
Okay, we can now almost create registry entries; now we have to set a registry RootKey.Which can be in our case:
HKEY_LOCAL_MACHINE
or
HKEY_CURRENT_USER
I pick HKEY_LOCAL_MACHINE, because the call of duty 4 registry entries can be found there.
procedure CreateRegistryEntries;
var
Reg: TRegistry;
begin
Reg := TRegistry.Create;//Creates the registry so you can use it.
Reg.RootKey := HKEY_LOCAL_MACHINE;
end.
We have found the registry entries to create in the previous chapter.
Like I already told Direct-Play or portable games/applications are dynamic.
Let’s first create and fill in the static information we got and then make dynamic what has to be dynamic.
[HKEY_LOCAL_MACHINE\SOFTWARE\CCleaner]
"UpdateCheck"="1"
@="H:\\Program Files\\CCleaner"
So dynamicly:
procedure CreateRegistryEntries;
var
Reg: TRegistry;
begin
PortableRootFolder := ExtractFileDir(ParamStr(0));//ParamStr(0) = 'D:\CCleaner\ExecuteableName.exe', so PortableRootFolder = 'D:\CCleaner'.
Reg := TRegistry.Create;//Creates the registry so you can use it.
Reg.RootKey := HKEY_LOCAL_MACHINE;
Reg.OpenKey('SOFTWARE\CCleaner', True);
Reg.WriteString('',PortableFolderRoot +'\Install Files\CCleaner');
Reg.WriteString('UpdateCheck','1');
end.
This wasn't that hard.Now let’s add the part that we will run CCleaner, we will code this into the main loop.
begin
CreateRegistryEntries;
ShellExecute(Application.Handle,'open', Pchar(PortableRootFolder + '\Install Files\CCleaner\CCleaner.exe'), nil, nil, SW_SHOWNORMAL);
end.
You have to add ShellApi, Forms to your uses.The code for the executable in total would be:
program CCleaner;
{$APPTYPE CONSOLE}
uses
SysUtils, Registry, Windows, Forms, ShellApi;
var
PortableRootFolder: string;
procedure CreateRegistryEntries;
var
Reg: TRegistry;
begin
PortableRootFolder := ExtractFileDir(ParamStr(0));//ParamStr(0) = 'D:\CCleaner\ExecuteableName.exe', so PortableRootFolder = 'D:\CCleaner'.
Reg := TRegistry.Create;//Creates the registry so you can use it.
Reg.RootKey := HKEY_LOCAL_MACHINE;
Reg.OpenKey('SOFTWARE\CCleaner', True);
Reg.WriteString('',PortableRootFolder +'\Install Files\CCleaner');
Reg.WriteString('UpdateCheck','1');
end;
begin
CreateRegistryEntries;
ShellExecute(Application.Handle,'open', Pchar(PortableRootFolder + '\Install Files\CCleaner\CCleaner.exe'), nil, nil, SW_SHOWNORMAL);
end.
Place the executable in D:\CCleaner\<Here>.
You're done!
How to use your portable/Direct-Play/no-installation.
You can run your Direct Play from anywhere, places as your flash drive (USB), on a DVD/CD.
Did you after think about the fact that it is highly possible to run a Portable Game from a shared network?
I am going to try it on my next LAN party and will tell you how it went! :)
Theoretical it should work.
How to create an autorun.inf/iso image.
You can go advanced with autorun files, but this is definitely not needed.
Create a text file and open it with notepad.
Copy this into notepad:
Code:
[autorun]
Open=<YourJustCreatedExecuteableName>.exe
Icon=<YourJustCreatedExecuteableName>.exe,0
We create a portable application or game for example I just made cod4 portable, in my case it would then be:
Code:
[autorun]
Open=RunCoD4.exe
Icon=RunCoD4.exe,0
Now save this file as 'autorun.inf' and place it in your 'D:\<PortableName>\<Here>'.
That would be 'D:\cod 4\autorun.inf' for me.
Note: D:\cod4\ can also be 'D:\THIS IS THE FOLDER WHERE MY DIRECT PLAY FILES FOR THE GAME BATTLEFIELD 2 ARE' for example it doesn't matter, but the easiest would just be 'D:\<PortableName>'
To create the ISO image fire up MagicISO and go to File –> New –> Data CD/DVD image.
Rename the ISO name instead of these weird numbers on your left(Right-Click).
Drag the contents of your portable application/game into MagicISO also drag the autorun.inf you created into MagicISO, then save it as a ISO image.
How to test/burn your Direct-Play.
Now it is always smart to test your iso before you burn it so use a mounting tool like Daemon Tools or the free component of MagicISO to mount your CD/DVD.
To burn it you can do many things, in MagicISO go to Tools –> Burn CD/DVD with ISO …
Extra: How to create a fast | updated | installer for your game.
Coming Soon!
Extra: Portable Downloads Section.
CCleaner | Download | Note: CCleaner is free to use and I am a happy user for already serveral years!
CoD 4 | Download | Note: You have to put in your own Call of Duty game files.
Coming more!
Post your portables too!
This tutorial has been made by Hermen Otter. :)
Created in notepad*.