├── LICENSE ├── README.md ├── preview0.png ├── preview1.png ├── renderdoc_generate_latest.ps1 └── renderdoc_generate_project.ps1 /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Jan Vorisek 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # renderdoc-gms2-kit 2 | 3 | ## What? 4 | Since GameMaker:Studio 2 generates development builds in such a way that makes it hard to debug them inside [RenderDoc](https://renderdoc.org/ "An essential tool for every graphics programmer."), I've developed a PowerShell script that automatically finds the path to the latest build and generates a settings file that can be loaded into the aforementioned tool. 5 | 6 | ## How to? 7 | 1) Inside GMS2, run and close the game. This will create a temporary build. 8 | 2) Depending on your requirements, run one of the provided scripts. If all goes well, a _*.cap_ file will be generated. 9 | 3) If you have it installed, double-clicking the newly-created settings file should open up RenderDoc with the settings already in place. You can also load it directly in the GUI (_Launch Application -> Load Settings_). 10 | 4) Click the _Launch_ button, this will start the game via RenderDoc. Proceed as you normally would. 11 | 12 | 13 | ## The script comes in two flavours: 14 | 15 | [renderdoc_generate_latest.ps1](renderdoc_generate_latest.ps1) - Generates a settings file for the last created GMS2 build, you can run this from wherever you like. 16 | [renderdoc_generate_project.ps1](renderdoc_generate_project.ps1) - A project-specific version of the former, needs to be placed in the folder where the .yyp file is. 17 | 18 | ## Additional notes 19 | 20 | You can modify the other launch settings inside RenderDoc however you like and overwrite the original settings file. After that, when you run the script again, your changes will be kept. 21 | 22 | GMS2 uses temporary mount points to run the development builds from. I did not implement this, as it would require providing a separate script to do the unmounting, which would be unpractical. As far as I can tell, using the absolute paths instead seems to work fine, but if you run into issues, let me know. 23 | 24 | This works with both YYC and VM builds. 25 | A relatively new version of Windows 10 required. 26 | 27 | ### Written by [@odditica](https://twitter.com/odditica). 28 | 29 | --- 30 | 31 | ![](preview0.png) 32 | 33 | ![](preview1.png) 34 | -------------------------------------------------------------------------------- /preview0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odditica/renderdoc-gms2-kit/9ed1b60a17ac1b39f133cb44cc1e9c0710ea0bd7/preview0.png -------------------------------------------------------------------------------- /preview1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/odditica/renderdoc-gms2-kit/9ed1b60a17ac1b39f133cb44cc1e9c0710ea0bd7/preview1.png -------------------------------------------------------------------------------- /renderdoc_generate_latest.ps1: -------------------------------------------------------------------------------- 1 | # GameMaker: Studio 2 RenderDoc settings generator script. 2 | # By @odditica. 10/04/20. 3 | # 4 | # https://github.com/odditica/renderdoc-gms2-kit/ 5 | # 6 | # This version of the script generates a settings file for the last project you've built. 7 | # 8 | # 1) Start (build) the game in GMS2 and close it. 9 | # 2) Run this script. 10 | # 3) In RenderDoc, load the generated settings file and launch the game. 11 | 12 | function bail($message) { 13 | Write-Host "$message" 14 | Read-Host -Prompt "Press Enter to exit" 15 | exit 16 | } 17 | 18 | $MODE_NONE=-1 19 | $MODE_VM=0 20 | $MODE_YYC=1 21 | $MODE=$MODE_NONE 22 | 23 | # Find the latest *.win/*.exe. 24 | 25 | $TEMP_PATH="$env:LOCALAPPDATA\GameMakerStudio2\GMS2TEMP\" 26 | if (! (Test-Path -Path "$TEMP_PATH")) { 27 | bail("Base data path not found!`n(Expected: $TEMP_PATH)") 28 | } 29 | 30 | $BUILD_PATH=Get-ChildItem -Path $TEMP_PATH -Recurse -Include "*.exe", "*.win" | Sort-Object LastWriteTime -Descending | Select-Object -first 1 | select -ExpandProperty FullName 31 | if ($BUILD_PATH -match '.exe$') { 32 | $MODE=$MODE_YYC 33 | } else { 34 | if ($BUILD_PATH -match '.win$') { 35 | $MODE=$MODE_VM 36 | } 37 | } 38 | 39 | if ($MODE -eq $MODE_VM) { 40 | 41 | # Find the runner 42 | 43 | $RUNTIME_PATH="$env:ProgramData\GameMakerStudio2\Cache\runtimes\" 44 | if (! (Test-Path -Path "$RUNTIME_PATH")) { 45 | bail("Runtime path not found!`n(Expected: $RUNTIME_PATH)") 46 | } 47 | $RUNNER_PATH=Get-ChildItem -Path $RUNTIME_PATH -Recurse -Filter "Runner.exe" | Sort-Object LastWriteTime -Descending | Select-Object -first 1 | select -ExpandProperty FullName 48 | if (! (Test-Path -Path $RUNNER_PATH)) { 49 | bail("No runner found!`n(Expected: $RUNNER_PATH)") 50 | } 51 | } else { 52 | if ($MODE -eq $MODE_NONE) { 53 | bail("No compatible build found (neither YYC nor VM).") 54 | } 55 | } 56 | 57 | # Template used to generate the settings file. 58 | 59 | $RENDERDOC_JSON_TEMPLATE='{ 60 | "rdocCaptureSettings": 1, 61 | "settings": { 62 | "autoStart": false, 63 | "commandLine": "", 64 | "environment": [ 65 | ], 66 | "executable": "", 67 | "inject": false, 68 | "numQueuedFrames": 0, 69 | "options": { 70 | "allowFullscreen": true, 71 | "allowVSync": true, 72 | "apiValidation": false, 73 | "captureAllCmdLists": false, 74 | "captureCallstacks": false, 75 | "captureCallstacksOnlyDraws": false, 76 | "debugOutputMute": true, 77 | "delayForDebugger": 0, 78 | "hookIntoChildren": false, 79 | "refAllResources": false, 80 | "verifyBufferAccess": false 81 | }, 82 | "queuedFrameCap": 0, 83 | "workingDir": "" 84 | } 85 | }' 86 | 87 | $RENDERDOC_SETTINGS_FILENAME=".\renderdoc_settings.cap" 88 | 89 | # If the settings file already exists, only change the required values, otherwise create a new one. 90 | 91 | if (Test-Path -Path "$RENDERDOC_SETTINGS_FILENAME") { 92 | $RENDERDOC_SETTINGS_JSON = Get-Content -Raw -Path "$RENDERDOC_SETTINGS_FILENAME" | ConvertFrom-Json 93 | if (( $RENDERDOC_SETTINGS_JSON.settings.commandLine -eq $Null ) -or ( $RENDERDOC_SETTINGS_JSON.settings.executable -eq $Null ) ) { 94 | bail("Existing RenderDoc settings file doesn't contain expected fields. This is likely due to a recent RenderDoc update, meaning this script will need to be updated - please report on GitHub.") 95 | } 96 | } else { 97 | $RENDERDOC_SETTINGS_JSON = $RENDERDOC_JSON_TEMPLATE | ConvertFrom-Json 98 | } 99 | 100 | if ($MODE -eq $MODE_VM) { 101 | $RENDERDOC_SETTINGS_JSON.settings.commandLine="-game `"$($BUILD_PATH)`"" 102 | $RENDERDOC_SETTINGS_JSON.settings.executable = "$RUNNER_PATH" 103 | } else { 104 | if ($MODE -eq $MODE_YYC) { 105 | $RENDERDOC_SETTINGS_JSON.settings.commandLine="" 106 | $RENDERDOC_SETTINGS_JSON.settings.executable = "$BUILD_PATH" 107 | } 108 | } 109 | 110 | $RENDERDOC_SETTINGS_JSON | ConvertTo-Json | Out-File -encoding ascii "$RENDERDOC_SETTINGS_FILENAME" -------------------------------------------------------------------------------- /renderdoc_generate_project.ps1: -------------------------------------------------------------------------------- 1 | # GameMaker: Studio 2 RenderDoc settings generator script. 2 | # By @odditica. 10/04/20. 3 | # 4 | # https://github.com/odditica/renderdoc-gms2-kit/ 5 | # 6 | # 1) Place this script in the project folder (where the *.yyp file is) 7 | # 2) Start (build) the game in GMS2 and close it. 8 | # 3) Run this script. 9 | # 4) In RenderDoc, load the generated settings file and launch the game. 10 | 11 | function bail($message) { 12 | Write-Host "$message" 13 | Read-Host -Prompt "Press Enter to exit" 14 | exit 15 | } 16 | 17 | $MODE_NONE=-1 18 | $MODE_VM=0 19 | $MODE_YYC=1 20 | 21 | $MODE=$MODE_NONE 22 | 23 | cd "$PSScriptRoot" 24 | 25 | # Figure out the project name 26 | 27 | $PROJECT_NAME=(Get-ChildItem -Path *.yyp -Name) | Sort-Object LastWriteTime -Descending | Select-Object -first 1 | sed 's/.yyp//' 28 | if (! $PROJECT_NAME) { 29 | bail("*.yyp file not found!") 30 | } 31 | 32 | # Find .win file 33 | 34 | $TEMP_PATH="$env:LOCALAPPDATA\GameMakerStudio2\GMS2TEMP\" 35 | if (! (Test-Path -Path "$TEMP_PATH")) { 36 | bail("Base data path not found!`n(Expected: $TEMP_PATH)") 37 | } 38 | 39 | $BUILD_PATH=Get-ChildItem -Path $TEMP_PATH -Recurse -Include "$($PROJECT_NAME).exe", "$($PROJECT_NAME).win" | Sort-Object LastWriteTime -Descending | Select-Object -first 1 | select -ExpandProperty FullName 40 | if ($BUILD_PATH -match '.exe$') { 41 | $MODE=$MODE_YYC 42 | } else { 43 | if ($BUILD_PATH -match '.win$') { 44 | $MODE=$MODE_VM 45 | } 46 | } 47 | 48 | if ($MODE -eq $MODE_VM) { 49 | 50 | # Find the runner 51 | 52 | $RUNTIME_PATH="$env:ProgramData\GameMakerStudio2\Cache\runtimes\" 53 | if (! (Test-Path -Path "$RUNTIME_PATH")) { 54 | bail("Runtime path not found!`n(Expected: $RUNTIME_PATH)") 55 | } 56 | $RUNNER_PATH=Get-ChildItem -Path $RUNTIME_PATH -Recurse -Filter "Runner.exe" | Sort-Object LastWriteTime -Descending | Select-Object -first 1 | select -ExpandProperty FullName 57 | if (! (Test-Path -Path $RUNNER_PATH)) { 58 | bail("No runner found!`n(Expected: $RUNNER_PATH)") 59 | } 60 | } else { 61 | if ($MODE -eq $MODE_NONE) { 62 | bail("No compatible build found (neither YYC nor VM).") 63 | } 64 | } 65 | 66 | # Template used to generate the settings file. 67 | 68 | $RENDERDOC_JSON_TEMPLATE='{ 69 | "rdocCaptureSettings": 1, 70 | "settings": { 71 | "autoStart": false, 72 | "commandLine": "", 73 | "environment": [ 74 | ], 75 | "executable": "", 76 | "inject": false, 77 | "numQueuedFrames": 0, 78 | "options": { 79 | "allowFullscreen": true, 80 | "allowVSync": true, 81 | "apiValidation": false, 82 | "captureAllCmdLists": false, 83 | "captureCallstacks": false, 84 | "captureCallstacksOnlyDraws": false, 85 | "debugOutputMute": true, 86 | "delayForDebugger": 0, 87 | "hookIntoChildren": false, 88 | "refAllResources": false, 89 | "verifyBufferAccess": false 90 | }, 91 | "queuedFrameCap": 0, 92 | "workingDir": "" 93 | } 94 | }' 95 | 96 | $RENDERDOC_SETTINGS_FILENAME=".\renderdoc_settings_$($PROJECT_NAME).cap" 97 | 98 | # If the settings file already exists, only change the required values, otherwise create a new one. 99 | 100 | if (Test-Path -Path "$RENDERDOC_SETTINGS_FILENAME") { 101 | $RENDERDOC_SETTINGS_JSON = Get-Content -Raw -Path "$RENDERDOC_SETTINGS_FILENAME" | ConvertFrom-Json 102 | if (( $RENDERDOC_SETTINGS_JSON.settings.commandLine -eq $Null ) -or ( $RENDERDOC_SETTINGS_JSON.settings.executable -eq $Null ) ) { 103 | bail("Existing RenderDoc settings file doesn't contain expected fields. This is likely due to a recent RenderDoc update, meaning this script will need to be updated - please report on GitHub.") 104 | } 105 | } else { 106 | $RENDERDOC_SETTINGS_JSON = $RENDERDOC_JSON_TEMPLATE | ConvertFrom-Json 107 | } 108 | 109 | if ($MODE -eq $MODE_VM) { 110 | $RENDERDOC_SETTINGS_JSON.settings.commandLine="-game `"$($BUILD_PATH)`"" 111 | $RENDERDOC_SETTINGS_JSON.settings.executable = "$RUNNER_PATH" 112 | } else { 113 | if ($MODE -eq $MODE_YYC) { 114 | $RENDERDOC_SETTINGS_JSON.settings.commandLine="" 115 | $RENDERDOC_SETTINGS_JSON.settings.executable = "$BUILD_PATH" 116 | } 117 | } 118 | 119 | $RENDERDOC_SETTINGS_JSON | ConvertTo-Json | Out-File -encoding ascii "$RENDERDOC_SETTINGS_FILENAME" --------------------------------------------------------------------------------