Garry's Mod

Garry's Mod

Onvoldoende beoordelingen
Tools for Unpacking, Decompiling, Compiling, and Installing Addons
Door Magiknight1
This is for people who want to modify existing addons for Garry’s Mod but don’t yet have the knowledge to unpack and decompile game files and then get their files into the game after making changes. This guide does not show how to edit any files.

This guide is for:

-People who crave the knowledge for:
--Accessing addon files
--Getting their own addons into the game whether edited or original

-Catered to, but not exclusively for, people who wish to access the contents of model files (in the Appendices)


This guide assumes you have basic proficiency in:

-Windows
-File Explorer
-Web Browsing (e.g. Google Chrome or Firefox)
-Navigating the Steam desktop client
   
Prijs
Toevoegen aan favorieten
Toegevoegd aan favorieten
Verwijderen uit favorieten
Introduction
So, you want to edit an existing addon – remix it so to speak. But when you go to the addon folder in your game directory, all you see is a .gma file you can’t do anything with. That’s because this file is a package of more files for the addon.

Also, you can’t just put a .gma file into the addons and expect the game to register it; you’ll need a tool for that.
Overview of the Phases
-Phase 0 explains getting the Crowbar application.
--It is used for Phase 1 and both Appendices.
--It’s main purpose is to unpack, decompile, and compile game files for Garry’s Mod.

-Phase 1 explains how to unpack the .gma files with Crowbar.
--Phase 1 Alt is for people who prefer getting the unpacked files via Github.

-The Appendices are only for people who are interested in models.
--You follow both in order (making edits in between) if you are editing a model for an addon.
--You just follow Appendix B and not Appendix A along with the other phases as needed if you created the model yourself.

-Phase 2 explains how to get the addon files into the game with gmpublisher (does not involve packing with Crowbar).
Navigating this Guide
Which one of these people describes you? If so, follow the guide in the order given:
-I want to edit the .gma file for an existing addon not including the model file (because I am not interested in it or it doesn’t exist):
--Phase 0**
--Phase 1*
(Make your edits)
--Phase 2

-I want to edit the .gma file for an existing addon, including the model file:
--Phase 0
--Phase 1*
--Appendix A
(Make your edits)
--Appendix B
--Phase 2

-I have created my own addon that does not include a(n) (uncompiled) model and am ready to put the files into the game.
--Phase 2

-I have created my own addon that includes an uncompiled model and want to put the files into the game.
--Phase 0
--Appendix B
--Phase 2

*NOTE: If you prefer to try get the unpacked files through a Github repository instead, follow Phase 1 Alt.

**NOTE: Phase 0 is optional in this scenario if you can get the unpacked files through a Github repository.
Phase 0: Downloading and Running Crowbar
Premise: Crowbar is a tool you can use for unpacking .gma files. With it you can also compile and decompile .mdl model files.

1) Download Crowbar[github.com]. Download the ZIP file specifically (you may need to scroll down a little).

2) In file explorer, unpack the Zip folder you downloaded. It contains an executable file with the whole application.

3) Run the crowbar executable file found in the Crowbar folder.
Phase 1: Unpacking the .gma File
Premise: To gain access to the files in the addon you want to modify you’ll want to unpack the .gma file the addon comes with. To unpack the file you’ll want to use an application called Crowbar.

1) On the crowbar application click the ‘Unpack’ tab near the top of the application screen.

2) On the ‘Unpack’ tab click the ‘Browse’ button that’s on the same row as ‘Package:’ near the top of the application screen.

3) Navigate to your addons and click the .gma file you want to unpack and then click ‘Open’ near the lower right corner of the file select screen. In my case it is located in:
-C:\Program Files (x86)\Steam\steamapps\common\GarrysMod\garrysmod\addons

4) In the middle of the application screen under ‘Contents of package’, you will see a preview of the output folders.

5) To unpack the file in the same location it's currently in, click the ‘Unpack’ button which is on the same row as the ‘Skip Current Package’, ‘Cancel Unpack’, and ‘Use All in Decompile’ buttons located a little lower than the middle of the application screen.

Optionally, to choose a different location click the drop down button (‘Same folder’) in the ‘Output to:’ row and select ‘Work folder’ in the drop down menu. Then click the ‘Browse’ button on the same row to select a different location for the output.

6) Wait for the .gma file to unpack. The output folder structure should be the same as the preview in 4).

7) Use the ‘Goto’ button in the lower right corner of the application screen to get to the outputted files.
Phase 1 Alt: Getting the Files Directly from Github
Premise: To gain access to an unpacked version of the addon you can go directly to the online Github repository the files are hosted on. Alternatively, you can unpack the .gma file yourself if you prefer that or can’t find the Github repository for the addon. If that’s the case do Phase 1 Alt instead of Phase 1.

1) Find the link for the addon. You might be able to find it on its Workshop page or through a Search Browser (e.g. Google). If you are using a Search Browser try ‘[Name of Addon] Garry’s Mod’.

If you can’t find the repository, go to Phase 1.

2) Once you’ve found the repository, download the ZIP for the addon.

3) Unpack the ZIP for the addon.
Appendix A: Decompiling Model files
Premise: If you want to edit a model or view it’s files you can decompile the .mdl file using Crowbar.

1) On the Crowbar application click on the ‘Decompile’ tab near the top of the application screen.

2) On the ‘Decompile’ tab click the ‘Browse’ button that’s on the same row as ‘MDL input:’ near the top of the application screen.

3) Navigate to and select the .mdl file you want to decompile. Then click ‘Open’ near the lower right corner of the file select screen.

4) To decompile the file using the default option, click ‘Use Default’. Then click the ‘Decompile’ button which is on the same row as the ‘Skip Current Model’, ‘Cancel Decompile’, and ‘Use All in Compile’ buttons located a little lower than the middle of the application screen.
Optionally, to use a different location in place of the default option click the drop down button in the ‘Output to:’ row and select ‘Work folder’ in the drop down menu. Then click the ‘Browse’ button to select a different location for the output.

5) Wait for the .mdl file to decompile. You can use the ‘Goto’ button in the lower right corner of the screen to get to it directly:
In my case, here’s what the output looks like.
Appendix B: (Re)compiling Model Files
Premise: After editing a model or creating your own, you can use Crowbar to compile it.

1) Click on the ‘Compile’ tab near the top of the application screen.

2) On the ‘Compile’ tab ensure ‘File’ is selected next to ‘QC Input’. Click the ‘Browse’ button that’s on the same row as ‘QC input:’ near the top of the application screen.

3) Navigate to and select the .qc file you want to compile. Then click ‘Open’ near the lower right corner of the file select screen.

4) I recommend compiling the .qc file in a subfolder (of the QC input). To do that click the dropdown button right next to ‘Output to:’ and select ‘Subfolder (of QC input)’. Afterwards, click the ‘Use Default’ button on the right end of the ‘Output to:’ row.

Optionally, to choose a different location click the drop down button in the ‘Output to:’ row and select ‘Work folder’ in the drop down menu. Then click the ‘Browse’ button to select a different location for the output.

5) Then click the ‘Compile’ button which is on the same row as the ‘Skip Current Model’ and ‘Cancel Compile’ buttons located a little lower than the middle of the application screen.

6) Wait for the .qc file to compile. You should get a .mdl file as the output.

7) Go to the .mdl file you compiled by clicking the ‘Goto’ button in the lower right corner of the application screen.

8) Optionally, if you edited an existing addon and have the unpacked files for it, place the model file in the same location as where you got it from.
Phase 2: Getting the Edited Addon into the Game
Premise: Once you’ve made all the edits you need, it’s time to get the files into the game. You’ll use a different tool for this than Crowbar. You’ll use gmpublisher. Then you’ll go to the Workshop to subscribe to the addon you published to get it into your game.

1) Log into Steam if you haven’t already – via the desktop client of course.

2) Download gmpublisher[github.com]. Download the .msi file under the latest release.

3) In file explorer, run the gmpublisher installer file you downloaded and follow the instructions.

4) Open the gmpublisher application you installed (if it isn’t already opened). I opened it by clicking the search bar near the Windows icon, typing in ‘gmpublisher’, and clicking on gmpublisher.

5) On the gmpublisher application screen, click ‘Publish New…’ (the icon with the circle and the big ‘+’).

6) Click the folder icon right next to the ‘Addon Path…’ text box (NOT the ‘Browse…’ button right under the ‘gmpublisher.download’ icon).

7) Navigate to the folder that contains your entire addon and then click ‘Select Folder’. It should be a folder containing a lua folder and an ‘addon’ JSON file at the least and any other folders for the addon if applicable. (You may have to create a folder to put the other folders in like I did before doing this). (Also, the JSON file is hidden on the image, because the image is a browser that is trying to find a folder, not a file).

8) Give your addon a title by clicking the textbox containing ‘Title’ and typing in the title.

9) Click on the ‘Type’ button and select a label that best describes the addon.

10) Click on the ‘Tag 1’ button and select a tag that best describes the addon. You can do this for the second and third tags too if you want.

(Optional) You can give your addon a thumbnail by clicking the ‘Browse…’ icon just under the gmpublisher.download icon.

11) Click ‘Publish!’ to publish the addon. This will put the addon into the Steam Workshop for you to use in the game.

12) On the Main Workshop Screen for Garry’s Mod (the screen that appears when you click ‘Workshop’ with Garry’s Mod selected) hover your mouse over ‘Your Files’ which is under ‘Your Workshop Files’ which is under ‘Search Garry’s Mod’ and click on ‘Files you’ve posted’.

13) Hover your mouse over the addon you posted and click the green ‘+’ sign to subscribe to the addon and get it into the game. Or you can click on the addon icon and click the green ‘Subscribe’ button.

14) If you are still subscribed to the addon you modified (if applicable), you’ll need to disable it. Then your newly modified addon should appear.