Instructions_for_Standalone_ReefGame

advertisement
Instructions for Making a Standalone Version of ReefGame
Part I: Modifying the Cormas source code for ReefGame
This part is for ensuring that the Cormas source code being used is suitable for creating a runtime
version of ReefGame. If your Cormas source code is already updated for ReefGame, you can skip this
section and proceed to Part 2.
Step 1
Open ReefGame.
Step 2
Open the VisualWorks workspace for ReefGame. Select Program -> the simulation
organisation -> the scheduler.
Step 3
Press the Package tab and select the Cormas package.
Step 4
Select cormas -> SpaceInterface -> actions (under Instance tab) -> openCormasModel.
Step 5
Comment out ^self model cormasModel inspect and apply change (ctrl + s). This will
prevent the opening of the Inspector window (which causes the standalone version of
ReefGame to crash) from the menu bar of the Space interface.
Step 6
Select cormas -> SpaceModel -> private – mouse actions (under Instance tab) ->
performRedButton:.
Step 7
Comment out p inspect and apply change (ctrl + s). This will prevent the opening of the
Inspector window by left-clicking the Map.
Step 8
Select cormas -> Cormas -> paths (under Class tab) -> cormasPath.
Step 9
Comment out ^SourceFileManager default targetFile logicalName asFilename directory
and type the following codes:
| currentDir |
currentDir := Filename defaultDirectory.
^currentDir
Apply changes (ctrl + s).
Step 10
Go to the VisualWorks Laucher (F12) and save your image as
“reefgame_prepackaging.im” or any filename that would suggest that the saved image
file is ready to be packaged. Use this image file for opening the ReefGame model so that
the accompanying Cormas source code is always suitable for packaging ReefGame.
Part II: Packaging a runtime image for ReefGame
This part is for creating a runtime image of ReefGame that can be used without having to go through the
VisualWorks development environment. However, the runtime image is still dependent on the
VisualWorks program. I f you want a ReefGame program that could run on its own, you have to continue
up to Part 3 of this document.
Step 1
Open ReefGame and the windows that you want open when the program starts.
Step 2
Initialize ReefGame so that the game is ready to be played every time the program starts.
Step 3
Go to the VisualWorks Laucher (F12) and then open the Runtime Packager (Tools ->
Runtime Packager).
Step 4
Click Next.
Step 5
Skip Clean up image by clicking Next.
Step 6
The next step is Set common options. Click Do this step.
Step 7
In the Basics section, set the value of Runtime Image Path Name as “ReefGame.”
Step 8
In the Details section, make sure that the following options are checked:
- Clear parcel search path
- Skip default scan for unreferenced items
- Suppress splash screen and herald sound
The other options should remain unchecked.
Step 9
In the Stripping section, make sure that the following options are checked:
- Package external references
- Merge method and block byte codes
The other options should remain unchecked.
Step 10
Click OK and then click Next.
Step 11
Skip Specify classes and methods to keep by clicking Next.
Step 12
Skip Scan for unreferenced items by clicking Next.
Step 13
Skip Review kept classes and methods by clicking Next.
Step 14
Skip Runtime loadable parcels by clicking Next.
Step 15
The next step is Test application. Click Do this step.
Step 16
Click Begin Test.
Step 17
When the result is shown, click Accept Dynamic References.
Step 18
Click End Test, OK and then Next.
Step 19
Skip Set runtime memory parameters by clicking Next.
Step 20
The final step is Strip and save image. Click Do this step.
Step 21
When the prompt below appears, click Yes.
Step 22
When the prompt below appears, make sure that all non-ReefGame windows are closed
(except the VisualWorks Launcher and the Runtime Packager, these will be closed once
the packaging starts). Click Yes and wait for the processing to be finished.
Step 23
Once the processing is done, the runtime image file ReefGame.im can be found in your
Cormas folder. This program can be used in any computer that has VirtualWorks
installed. Take note, however, that its associated files should always come with it and are
placed in their designated folders. Thus, the Models folder (only the ReefGame directory
under it is necessary, you may exclude the other directories inside it) found in your
Cormas directory must always be copied with ReefGame.im.
Part III: Creating a standalone version of ReefGame
This part is for creating an executable version of ReefGame that can run without VisualWorks. However,
the result of this process is an OS-dependent program. For example, if these steps were done in a
Windows environment, the result is an exe program for Windows. The following steps are based in
Windows, though they are generally the same steps for other operating systems.
Step 1
Download Resource Hacker from http://www.users.on.net/johnson/resourcehacker/.
Extract the compressed files into a suitable directory (in this example, C:\Program
Files\ResourceHacker).
Step 2
Open your command line terminal. In Windows, this is the command prompt (Windows
key + r, then type “cmd”).
Step 2
If you are not in your base directory (C:\ in Windows), type “cd\” and press Enter.
Step 3
Go to the directory where your runtime image is saved. By default, it is saved in your
Cormas folder (C:\Program Files\Cincom\vw7.6nc\cormas in Windows). Type “cd
C:\Program Files\Cincom\vw7.6nc\cormas” and press Enter.
Step 4
Type the following command (do not copy-paste from this document and include the
quotation marks) before pressing the Enter key: “C:\Program
Files\ResourceHacker\ResHacker.exe” –addoverwrite “C:\Program
Files\Cincom\vw7.6nc\bin\win\visual.exe”, ReefGame.exe, ReefGame.im, 332, 332,
Notes about the command:
“C:\Program Files\ResourceHacker\ResHacker.exe” – the Resource Hacker program,
including its complete directory
–addoverwrite – the command for creating the standalone program
“C:\Program Files\Cincom\vw7.6nc\bin\win\visual.exe” – the VisualWorks program (not
VisualWorks.exe, which can also be found in the same directory)
ReefGame.exe – the name of the executable program (.exe is for Windows)
ReefGame.im – the name of the runtime image file created earlier
332, 332, – resource masks (just use these numbers for ReefGame)
Step 6
If an error message appears after pressing the Enter key, there’s something wrong with
some of your command parameters. Check if the directories are correct and if
ReefGame.im is present in your current directory.
Otherwise, the generation of the standalone program is successful. ReefGame.exe is
generated within the same directory where you typed the command (inside Cormas).
You can run this program in any computer running on Windows, provided that you also
copy with it its associated files (the Models folder).
Step 7
You can change ReefGame.exe’s icon through the Resource Hacker program. Run
ResHacker.exe then open (File -> Open) ReefGame.exe.
Right click the icon (labeled 1033 in this example) and select Replace Resource.
Click Open file with new icon then select the .ico file(image files are not accepted) that
you’re going to use.
After pressing Replace, ReefGame.exe will have a new icon.
Download