Skip to content

Compiling the plugin

Headshotnoby edited this page Apr 2, 2023 · 9 revisions

NOTE: If you have the Steam version of GTA SA, use the San Andreas Downgrader tool to bring it to v1.0

Setting up Code::Blocks and mingw-w64

  • First, go to the Code::Blocks download page on FossHUB and select the 32-bit version:
    image

  • Leave the component selection as is, and install
    image

  • Click "Yes" when it asks you if you want to run Code::Blocks now

  • Ignore the compiler auto-detection and click OK
    image

  • Minimize Code::Blocks for now.

  • Download the mingw-w64 compiler on SourceForge

  • Open the downloaded 7z file with 7-Zip or WinRAR (I will be using the former), and extract or copy the mingw32 folder directly to the C:\ drive
    image

  • Go back to Code::Blocks and open the compiler settings window (Settings > Compiler settings)
    image

  • Make sure "Selected compiler" is GNU GCC Compiler.

  • Go to the "Toolchain executables" tab and make sure it looks exactly like this. Change the Compiler's installation directory, C compiler, C++ compiler and Linker for dynamic libs:
    image

  • Click OK. Code::Blocks and the mingw-w64 compiler are now set up. Close Code::Blocks for now

Downloading plugin-sdk

  • Go to plugin-sdk's GitHub page
  • Click the green "Code" button and Download ZIP
    image
  • Open the zip, and extract or copy plugin-sdk-master to the C:\ drive as well, just like with mingw-w64
  • Go inside the newly extracted C:\plugin-sdk-master
    • To create the Code::Blocks Plugin-SDK workspace, replace tools\premake\premake5.exe with this version, otherwise it won't work
    • Also download this zip file and extract inside the C:\plugin-sdk-master folder so that plugin-sdk can compile without errors on mingw-w64
  • Open the "installer-launcher" program

image

  • On "Setup Plugin-SDK environment variables", change the first two: Plugin-SDK folder, and GTA San Andreas folder. Use the "..." button to navigate to their locations

    • Plugin-SDK folder: The folder where you extracted plugin-sdk.
    • GTA San Andreas folder: The folder where you installed GTA San Andreas. In case of Steam version it should be inside here: C:\Program Files (x86)\Steam\steamapps\common
    • Make sure to click the "Set" buttons afterwards
  • On "Create Plugin-SDK solution/workspace", select Code::Blocks from the dropdown list, and click Generate

  • You should now see this file in the plugin-sdk folder: plugin.workspace
    image

  • Re-open Code::Blocks, click "Open an existing project", then navigate to C:\plugin-sdk-master, and open the plugin.workspace file.

    • If Code::Blocks asked you if you want to associate file types and selected yes, you can open the plugin workspace file by double-clicking it
  • On the "Projects" pane in the left, make sure plugin_sa is selected by double-clicking it:
    image

  • Click the "+" icon on plugin_sa, "Resources", "shared", right-click "plugin.rc" and remove it from project. This file will not compile under mingw-w64 so we don't need it image

  • For the build target. make sure "Release" is selected instead of "zDebug":
    image

  • Click the gear icon on the left, or press CTRL+F9 to start building plugin_sa
    image

    • In case of errors, click "Build log" on the bottom (NOT "Build messages"), copy everything and report this to Issues, or contact me on the PC Port Central Discord at #mario-in-gta-sa
  • Assuming there are zero errors (warnings do not matter), close the plugin workspace
    image

  • plugin-sdk for GTA SA is now compiled! For the final phase we move on to sm64-san-andreas.

Downloading sm64-san-andreas

  • Go to this mod's GitHub page
  • Click the green "Code" button and Download ZIP
  • Open the ZIP and extract the sm64-san-andreas-master folder anywhere. Does not need to be directly in the C:\ drive
  • Go inside the extracted folder and open sm64-san-andreas.workspace with Code::Blocks
  • The Projects tab on the left should now look like this:
    image
  • Double-click libsm64 to select it for compiling
  • For the build target. make sure "Release" is selected instead of "Debug":
    image
  • Click the gear icon on the left, or press CTRL+F9
    image
  • Assuming there are zero errors (warnings do not matter), double-click the sm64-san-andreas project, right below libsm64, to select it.
  • Repeat the build target steps but this time it should say "GTASA Release"
  • Click the gear icon or CTRL+F9 again to compile the actual plugin itself
    • If you see this, just click OK ignore it
      image
      • However just to make sure, head on over to your GTA SA install folder and create a folder named "scripts", if it doesn't exist, to avoid further trouble
  • Wait for compilation to finish
  • If your GTA SA "scripts" folder looks like this, you're good to go!
    image
Clone this wiki locally