Creating GameMaker Extensions outside of GM Studio

I’ve been getting back into GM Studio 1/2 lately and wanted to revive a project I was working on. My first step was to move everything into an extension (rather than the shitty drag and drop method I had suggested before to use)
After going through the GM Creating Extension tutorial it was pretty clear I was not going to go through the process of adding a function within GM Studio (click Add Function in dropdown + fill out form)
For most simple extensions this is probably fine but I’m hoping to add and remove functions at will. Rather than managing the extension through GameMaker I’d like to be able to create the .gmez file myself and have it properly import into GM Studio 1.4.9999
By default a user would simply Right click the extension, click Export extension and give it an appropriate name. The created file will automatically get the .gmez extension and you can drag and drop the file into any project and it should work as expected.
Here’s an extension I exported from GM 1.4.9999 that has already been setup to open with WinRAR on my machine

Contents are as follows:
exported_extension.gmez:
-- Test.extension.gmx
-- Test/
   -- custom.gml
   -- Assets/
      -- Objects/
      -- ALL IMPORTED ASSETS CAN GO HERE (scripts, sprites, datafiles, etc)/
So you might be wondering how I already knew to open that with WinRAR.. I paid for an extension and it was mentioned in the docs that I could either drag and drop the extension and go through the normal flow of importing the assets object OR I could open the .gmez file with 7zip/winrar… the curious reader might be thinking this is just a .zip/.rar that is renamed.. you’d be close but let me show you the science I did to make importing my own extension work correctly.
Open up the example.gmez with your hex editor of choice and let’s look for some magic numbers! (I use WinHex. If you don’t have a hex editor its probably time to add one to the toolkit)
Since I’m not a noob to magic numbers I already have the List of file signatures purple on google and know a simple search of “37” will get me what I need.. and of course 37 7A BC AF 27 1C tells us we are looking at a 7-zip file
With some knowledge about how .gmx files are structured we can easily add additional functions and edit the .gml files outside of GM entirely! A simple test is to extract the .gmez file and create a default 7zip archive and drag and drop it into GM to confirm the results.
Since I’ve been modifying a lot of .gmx files on the fly with my GM Companion IDE doing the same for extensions feels like a natural feature add in the future. For now a simple scripted solution will do to tidy up a Github repo and hopefully allow others to contribute easier moving forward.
Random Note: I added a file to my extension, deleted it, and exported the extension. When I inspected the contents of the .gmez I noticed that the file that I inserted (and definitely deleted) was in the extension (massive .gml imported so was easy to notice).. Within GameMaker there was no reference to the file.. but I’m 100% it would be included in whatever is compiled.. possible to hide malicious code? (PoC || GTFO)

Leave a Reply

Your email address will not be published. Required fields are marked *