{"id":21224004,"url":"https://github.com/sam-k0/gml-modding-sdk","last_synced_at":"2025-10-13T00:47:23.229Z","repository":{"id":90029181,"uuid":"476316440","full_name":"sam-k0/GML-Modding-SDK","owner":"sam-k0","description":"Make your game easily moddable from C++ DLLs","archived":false,"fork":false,"pushed_at":"2022-04-28T16:53:44.000Z","size":1478,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-13T00:47:19.700Z","etag":null,"topics":["cpp","game-maker-studio","game-modding","gamemaker","gml","modding"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sam-k0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-31T13:24:52.000Z","updated_at":"2025-10-03T10:32:42.000Z","dependencies_parsed_at":"2023-03-09T12:15:32.196Z","dependency_job_id":null,"html_url":"https://github.com/sam-k0/GML-Modding-SDK","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/sam-k0/GML-Modding-SDK","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sam-k0%2FGML-Modding-SDK","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sam-k0%2FGML-Modding-SDK/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sam-k0%2FGML-Modding-SDK/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sam-k0%2FGML-Modding-SDK/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sam-k0","download_url":"https://codeload.github.com/sam-k0/GML-Modding-SDK/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sam-k0%2FGML-Modding-SDK/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279013641,"owners_count":26085298,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","game-maker-studio","game-modding","gamemaker","gml","modding"],"created_at":"2024-11-20T22:54:28.494Z","updated_at":"2025-10-13T00:47:23.180Z","avatar_url":"https://github.com/sam-k0.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GML-Modding-SDK\n\nTutorial can be found in `Tutorial` !!!\nOr as a video here:\nhttps://www.youtube.com/watch?v=hQ7mBLIGf6U\n\n## Huh?\nYep. This is (becoming) an extension for making games made in GameMaker moddable!\n\nYou will be able to mod any game that includes this extension in runtime via DLL-injection.\n## (Game Developer) I want to make my game moddable! How?\nCurrently, it is as easy as drag-and dropping the extension package (which can be found in the releases tab)\nonto the GameMaker IDE window and importing everything\n\n## (Modder) I want to mod a game using this SDK!\nThis requires you to understand C++.\nI made a namespace called `gml::` which holds the functions from GameMaker.\n\nThe APIENTRY functions contains a method called `executePatching()` which gets called on-injection of the DLL.\nYou can either put your code there OR create a thread that runs the code parallel to the game.\n\nIf you understand programming you will eventually figure out what is smart and what not.\n\n## Information\nThis is STRONGLY dependent on YAL's repo \"function_get_address (https://github.com/YAL-GameMaker/function_get_address)\", \nwhich allowed you to get the addresses of GML-functions in runtime.\nThis right here is me taking his work and expanding it to present it in a 'less hacky way'.\n*Currently WIP and more like a proof-of-concept*\n\nYes, this allows you to use GML-code in C++\nOriginal readme can be found below because I don't wanna reinvent the wheel.\n\n\n\n# function_get_address\nSupported versions:\n\n* GameMaker: Studio: all versions released after 1.4.1773 (object value type wasn't supported before then)\n* GameMaker Studio 2: all versions before 2.2.2 (2.2.1.291 is the last one where this works)\n\n## What is this\nThis trick allows to acquire a pointer to a native GML function, as result allowing you to pass it to a native extension\nand have the later call it - for example, your extensions now can suddenly make buffers, or data structures, or even call\nGML code (to an extent)! A true extension rennaisance for the affected versions.\n\n## How this works\nLet's take a look at the heart of the system, the `function_get_closure` script\n```js\nvar name = argument0;\nvariable_global_set(name, variable_global_get(name));\nreturn ptr(variable_global_get(name));\n```\nSo you might be wondering what is even going on here.\n\nIn what is most likely to be what remains of some delayed or scrapped feature,\nrecent versions of GameMaker _kind of_ support C closures for built-in functions.\n\nExcept you can't get them because the global scope isn't populated with built-in function names.\n\nHowever, as an accident revealed, the way the built-in functions are expected to be set into scope,\nis that the scope needs variables defined with names but no values - not just `undefined`, but the\nspecial kind of value that resides in variables that were never assigned (`kind==VALUE_UNSET` on YYGML.h terms).\nAnd you can't just get such a value by passing an nonexistent variable to a function (which would give you a read error) -\nthe value must come from a GML function call.\n\nThis is where `variable_global_get` comes into play - due to a bug that hadn't been fixed until GMS2.2.2,\nif a nonexistent variable is being read via the function, it would return the exact thing that we need.\n\nAnd thus, `variable_global_set(name, variable_global_get(name));` will generate an index for a global variable\nwhile keeping it amiss, which allows the subsequent call to create a closure and return it, which we can get a pointer of.\n\nThen, on C side we can grab the actual function pointer from the closure, call (or store) it accordingly, and voila!\n\nWe can then add a bit of caching and a couple C++ wrappers to make it all nicer.\n\n## Limitations\n* You cannot get a pointer to `script_execute` specifically because it got optimized and is no longer a function as such\n  (that's why it's so fast)\n* It is unclear whether and how you could get pointers to GML instances for use in C code.  \n  For the most part, you don't need to, as you can use variable_instance_ functions to work with instances,\n  but calling instance-specific functions (which require valid self/other pointers) is problematic without these.\n* You can call GML code via `event_perform_object`, but you'll need to construct something resembling a valid `GMLInstance` first\n  (feel free to research alternatives).\n\n## Special thanks\nSaturnyoshi for gml.h file (as seen in [UGMMS](https://github.com/Saturnyoshi/UGMMS)),\nwhich allowed me to not write another one of these for this mini-demo.\n\n## If anyone from YoYo Games is reading this\nA built-in `function_get_address` would be nice, even if it was native-only (no HTML5) until further notice\n(besides, it's pretty trivial to get function pointers in JS anyway).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsam-k0%2Fgml-modding-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsam-k0%2Fgml-modding-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsam-k0%2Fgml-modding-sdk/lists"}