A Sega Model 3 Arcade Emulator
These instructions are intended for users who are not developers and have at best a beginner's familiarity with command lines. Please follow all steps exactly as shown here and use the exact same folder names everywhere or the procedures will not work.
This all may look daunting but Tasks 1-6 only need to be performed once. Pulling the latest source code and building Supermodel will then only consist of Tasks 8 and then 7.
It is highly recommended that before embarking on Task 1, you read through all of the instructions once, even if none of it makes sense. Having a "bird's eye view" of the entire process will make the individual steps a little bit more comfortable to process.
MSYS2 provides a UNIX-like environment for building software on Windows. We will use it to install a compiler and the SDL2 libraries required by Supermodel.
Go to https://msys2.org. Scroll down to Installation and locate the download link for the installer, which at the time of this writing is named msys2-x86_64-20200720.exe. Download it.
Run the installer. When prompted for the installation folder, use C:\msys64. Make sure your view matches the one below before proceeding. If you opt to use a different folder, you will need to make the necessary adjustments to folder paths in subsequent steps.
Click Next when the folder name is correct and the installer will begin installing. The process is very straightforward.
Open the MSYS2 shell. We will use this to fetch the compiler and required libraries. Open the Start menu and type msys2. The MSYS2 program icon should appear.
Click on it to open the MSYS2 terminal. If for some reason MSYS2 does not appear in your Start menu query, make sure it installed correctly by locating the installation folder using File Explorer. You may also launch it from there by opening msys2.exe.
GCC is the C++ compiler we will be using to build Supermodel. It is the compiler of choice for people who value liberty and performance.
In the MSYS2 terminal opened in Step 1.4, type the following command:
pacman -S mingw64/mingw-w64-x86_64-gcc
Press Enter and you will be asked to confirm.
Press y and Pacman, the package manager, will download and install GCC.
GCC is now installed. However, in order to use it, we must add its folder to the system PATH variable, which Windows searches for executable programs.
Open the Start menu and start typing environment. You should immediately see "Edit the system environment variables" appear.
Click on it. You can alternatively choose to edit only the variables belonging to your account. A dialog with several options will appear.
Click Environment Variables... near the bottom. A dialog showing user and system environment variables will appear.
Select the PATH variable in the user variables list and click Edit. Alternatively, you may edit the PATH or Path variable in the system variables list below. Click New to add a new path. We want to add the location that the GCC executable (along with other build tools) was installed to, which is C:\msys64\mingw64\bin:
Close all the environment variable dialogs by clicking OK. From now on, GCC will be accessible from the Windows Command Prompt but not, ironically, MSYS2. We will test this next.
Open a Command Prompt window by pressing Start and typing cmd.
Once open, type gcc and press Enter. You should see:
If instead you get an error indicating the command was not recognized, go back and make sure the PATH variable was set correctly and that the added folder exists and contains gcc.exe. You may have installed MSYS2 in a different folder and will need to adjust accordingly.
Make is a simple build system -- a tool that reads a Makefile describing how the source code is structured in order to issue the necessary commands to compile the code.
Return to the MSYS2 terminal window and type the following command:
pacman -S mingw64/mingw-w64-x86_64-make
Press Enter and confirm.
Make is now installed.
SDL2 is a multi-platform game development library that Supermodel uses to display display graphics, output audio, and read inputs.
In the MSYS2 terminal window, type the following command:
pacman -S mingw64/mingw-w64-x86_64-SDL2
Press Enter and confirm.
SDL2 is now installed.
By default, Supermodel builds without experimental network board support. If you want to enable this feature, the SDL2 networking libraries must be installed first. In MSYS2, type:
pacman -S mingw64/mingw-w64-x86_64-SDL2_net
The SDL2 networking library is now installed.
The Supermodel source code is stored in a Subversion (SVN) repository. TortoiseSVN is a popular SVN client that we will use to check out and update the Supermodel source code.
Navigate to https://tortoisesvn.net.
Go to the Downloads page and find the latest version near the top. Choose the version appropriate for your OS (since this guide assumes a 64-bit OS, download that one if you are unsure).
Run the installer you downloaded in the previous step.
Click Next to proceed and use the default installation settings.
That was easy, wasn't it?
We must now obtain a snapshot of Supermodel's source code straight from the SVN repository. In the future, we will merely have to pull the updates.
We will check the source code out into a folder directly on the C: drive. Open File Explorer. Notice in the image below that the C: drive can be accessed through the left navigation pane. It is labeled Local Disk (C:).
Click on it to view its contents.
In the main window pane, right click a blank region and a context menu will appear:
Notice the presence of SVN-related options. Select SVN Checkout... Then, enter the URL of the repository and checkout directory exactly like this:
Click OK to perform the checkout and the download will commence. Once finished, the current revision number will be printed and you can click OK to dismiss the window.
The latest Supermodel source code is now in your hands! Let's compile it!
Follow this procedure whether checking out a fresh copy of the source code or after updating to the latest revision.
Return to the Command Prompt we opened in Step 2.3 or launch a new one. We will use this Command Prompt to build Supermodel from this point onward.
The source code was checked out to C:\model3emu. We need to go there in the Command Prompt. Type:
Run the following command to clean up any leftover build output:
mingw32-make -f Makefiles\Makefile.Win32 clean
If you have just checked out the source code for the very first time, this command will print an error that can safely be ignored.
After cleaning up, simply run:
mingw32-make -f Makefiles\Makefile.Win32
The Make program will begin to compile each of Supermodel's source code files.
After several minutes, supermodel.exe will be produced. You can find it in C:\model3emu\bin64. To use it, copy it back to either C:\model3emu or, preferrably, a dedicated Supermodel directory.
NOTE: This Supermodel build depends on SDL2.dll, which is located in C:\msys64\mingw64\bin. Because we added this folder to our PATH, Windows will be able to find it when Supermodel is executed. However, should you wish to distribute your build, make sure to include it.
If you wish to compile in experimental network board support, you will have to edit Options.inc in the Makefiles folder using a text editor. Find the NET_BOARD variable and set it to 1 so that it reads:
NET_BOARD = 1
To update the source code to the latest revision, follow these steps. Note that sometimes, code check-ins can break Supermodel and either the program will no longer compile or will function incorrectly. Needless to say, make backups of supermodel.exe if this is a concern.
Open up your C: drive in File Explorer and locate (but don't enter) the Supermodel source folder that the code was checked out into in Task 6 above. It should be named model3emu.
Right click on the model3emu folder and a context menu will appear. There will be an SVN Update option. Select that.
TortoiseSVN will update the source files to the latest version.
That's it. Now simply repeat Task 7 to compile Supermodel.