RinasSam
Member
I want to share a tutorial with you all about how to use the Code::Blocks (which will be referred to as CB in this thread) IDE for PS2 development.
This tutorial should work for both Linux and Windows.
Before Starting, What is Code::Blocks?
-Code::Blocks (CB) is a free C and C++ integrated development environment (IDE) that is designed to be highly extensible and configurable. It includes a wide range of features including:
Step 1: Getting CB:
You can get CB from their downloads page: http://www.codeblocks.org/downloads
Make sure to install the one for your OS if you are going to download from the binary builds.
For Windows users it is best to install the mingw-setup installer.
Step 2: Getting The PS2DEV Tools:
-If you are on Linux:
Note 1: The precompiled toolchain may be old.
Note 2: The C++ compiler (g++) is NOT included in the precompiled toolchain. You can however, easily get it by searching for it on the internet.
[OPTIONAL] Step 3: Getting PCSX2:
PCSX2 is a Playstation 2 emulator for the PC. It is possible to use PCSX2 for PS2 development.
In this tutorial we will be using PCSX2 1.4.0.
If you are on Linux, get it from here: https://pcsx2.net/download/releases/linux/category/3-linux.html
If you are on Windows, get it from here: https://pcsx2.net/download/releases/archive-download/category/43-pcsx2-v1-4-0.html
Note 1: It is best to download the portable executables.
Note 2:I was NOT able to use the newer versions of PCSX2 for PS2 development with CB. Only version 1.4.0 worked well.
Step 4: Setting Up CB:
Extra Information: How to Setup Code Completion?
After creating a new project, head to Project > Properties > C/C++ Parser Options and make sure that Additional Search Paths look similar to this:
Notes About the Preconfigured PS2.cbp File:
1-It will launch PCSX2 to run your program if you are in Debug mode.
2-It will run ps2client if you are on release mode.
If you do NOT want that just head to Project > Build Options:
Step 5 [FINALE]: Testing Your Setup:
To test your setup use an example ps2dev project (the usb_mass source is one of the best ones to use) and add its files to the project. Then build the project and hope that your setup is working.
Conclusion:
So this marks the end of this tutorial on setting up CB for PS2 development. I hope you found this useful.
If you have any question, problems, or remarks feel free to leave them here.
This tutorial should work for both Linux and Windows.
Before Starting, What is Code::Blocks?
-Code::Blocks (CB) is a free C and C++ integrated development environment (IDE) that is designed to be highly extensible and configurable. It includes a wide range of features including:
- Multiple Compiler Support (more compilers can be supported manually).
- Syntax Highlighting.
- Code Completion (very useful feature).
- Documentation Generator.
- External Customizable Tools.
- Games to keep you occupied while waiting for your code to compile (No joke it even has Tetris).
- and Much More. Read more about CB's features here: http://www.codeblocks.org/features
- A compiler.
- A linker.
Step 1: Getting CB:
You can get CB from their downloads page: http://www.codeblocks.org/downloads
Make sure to install the one for your OS if you are going to download from the binary builds.
For Windows users it is best to install the mingw-setup installer.
Step 2: Getting The PS2DEV Tools:
-If you are on Linux:
- Get Git. Use your distro's package manager to install it. Two of the most popular package managers on Linux are apt and pacman.
- Get the PS2DEV tools here: https://github.com/ps2dev/ps2dev
- Make sure to read README.MD for the installation instructions.
- Get the precompiled PS2DEV tools with MSYS here: https://github.com/ps2dev/ps2toolchain/releases
- Extract it to a good location. (C:\) works well.
Note 1: The precompiled toolchain may be old.
Note 2: The C++ compiler (g++) is NOT included in the precompiled toolchain. You can however, easily get it by searching for it on the internet.
[OPTIONAL] Step 3: Getting PCSX2:
PCSX2 is a Playstation 2 emulator for the PC. It is possible to use PCSX2 for PS2 development.
In this tutorial we will be using PCSX2 1.4.0.
If you are on Linux, get it from here: https://pcsx2.net/download/releases/linux/category/3-linux.html
If you are on Windows, get it from here: https://pcsx2.net/download/releases/archive-download/category/43-pcsx2-v1-4-0.html
Note 1: It is best to download the portable executables.
Note 2:I was NOT able to use the newer versions of PCSX2 for PS2 development with CB. Only version 1.4.0 worked well.
Step 4: Setting Up CB:
- Run CB on your machine.
- Click on Settings > Compiler...
- You should see the Global Compiler Settings screen:
- Check if the GNU GCC Compiler is correctly set.
- Click on the Copy button.
- In the dialog asking to enter the new compiler name, enter a name for the compiler. I chose PS2-GCC.
- Go to Toolchain Executables.
- If you are on Windows, change the compiler's installation directory to the one in your MSYS directory (should be C:\path\to\msys\MinGW)
- In Program Files:
make sure that the program setup looks like the image above.
Note 1: The C compiler may be gcc or mingw32-gcc
Note 2: The C++ compiler may be g++ or mingw32-g++
Note 3: The Linker for dynamic libs should be the same as the C++ compiler.
Note 4: The Make program may be make or ming32-make
- Head over to Additional Paths.
- Add the bin folders of MSYS, PS2DEV, PS2SDK, EE, IOP, and DVP here.
If you are on Windows it will look something like this:
Note: add the PCSX2 folder (the one with the PCSX2 executable) of PCSX2 if you plan on using it for PS2 development. - The compiler should be set up now. Click OK and go to Settings > Environment > Environment Variables:
- Add the following Env. variables:
-PS2DEV = path/to/ps2dev folder
-PS2SDK = $(PS2DEV)/ps2sdk
-PS2SDKSRC = $(PS2DEV)/ps2sdksrc
-PS2LIB = $(PS2DEV)/ps2lib
-PS2ETH = $(PS2DEV)/ps2eth
-GSKIT = $(PS2DEV)/gsKit - Click on Set Now.
Now everything should be set up. Only 3 things are left to be done:
a- Setting up Code Completion to work with PS2 development.
b- Setting up useful tools for PS2 development.
c- Setting up an example project. - We will start by setting up the tools. Head to Tools > Configure tools...:
- Add ps2client and set it up to look similar to this:
- Reset tool is the same as ps2client but instead of the parameters being execee host:output, it is just reset.
- If you are on Windows you may also want to add the MSYS shell. Configure it to similar to this:
- You can also set up PCSX2. Remember to set the parameters to:
--console --nogui --elf="${PROJECT_DIR}${TARGET_OUTPUT_FILE}"
- Now we can set up Code Completion and a template project in a few simple steps.
Use the preconfigured CB project file I have included in this thread (PS2.zip. It includes the PS2.cbp preconfigured project file).
- Open the preconfigured .cbp file with CB.
- Click on File > Save Project As Template.
- Give it a name and save it.
Extra Information: How to Setup Code Completion?
After creating a new project, head to Project > Properties > C/C++ Parser Options and make sure that Additional Search Paths look similar to this:
Notes About the Preconfigured PS2.cbp File:
1-It will launch PCSX2 to run your program if you are in Debug mode.
2-It will run ps2client if you are on release mode.
If you do NOT want that just head to Project > Build Options:
- Go to debug and remove everything.
- Go to release and remove everything.
- If asked to save changes say yes.
Step 5 [FINALE]: Testing Your Setup:
To test your setup use an example ps2dev project (the usb_mass source is one of the best ones to use) and add its files to the project. Then build the project and hope that your setup is working.
Conclusion:
So this marks the end of this tutorial on setting up CB for PS2 development. I hope you found this useful.
If you have any question, problems, or remarks feel free to leave them here.
Attachments
Last edited by a moderator:
