{"id":21407277,"url":"https://github.com/mkst/mwccgap","last_synced_at":"2025-07-14T00:33:34.642Z","repository":{"id":240195773,"uuid":"801229896","full_name":"mkst/mwccgap","owner":"mkst","description":"MWCC Global Assembly Processor","archived":false,"fork":false,"pushed_at":"2024-11-18T22:37:08.000Z","size":73,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-18T23:37:07.936Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mkst.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2024-05-15T20:40:41.000Z","updated_at":"2024-11-18T22:37:12.000Z","dependencies_parsed_at":"2024-05-17T08:54:25.613Z","dependency_job_id":"ef939e17-c6bf-476d-868f-85b0bc2b8bae","html_url":"https://github.com/mkst/mwccgap","commit_stats":null,"previous_names":["mkst/mwccgap"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkst%2Fmwccgap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkst%2Fmwccgap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkst%2Fmwccgap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkst%2Fmwccgap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mkst","download_url":"https://codeload.github.com/mkst/mwccgap/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225934012,"owners_count":17547728,"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","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":[],"created_at":"2024-11-22T16:45:53.484Z","updated_at":"2025-07-14T00:33:34.622Z","avatar_url":"https://github.com/mkst.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mwccgap AKA \"MWCC Global Assembly Processor\"\n\n`mwccgap` is a tool that enables individual functions within a C file to be replaced with assembly code, drawing heavy inspiration from [asm-processor](https://github.com/simonlindholm/asm-processor).\n\nWhile the MWCC compiler *does* support embedding raw assembly within a C file, it requires that all variables and functions be fully defined. This limitation makes the traditional [Ship of Theseus](https://en.wikipedia.org/wiki/Ship_of_Theseus) approach to matching decompiled code slow and cumbersome.\n\nUnlike `asm-processor`, which uses a `GLOBAL_ASM` pragma, `mwccgap` adopts an `INCLUDE_ASM` macro to align with the needs of its first supported project, which uses GCC. Future updates may add support for both approaches.\n\nWhen a function in a C file is marked defined using the `INCLUDE_ASM` macro, it is replaced with a series of `nop` instructions of the appropriate size during compilation. The C file is then compiled as usual. Separately, the assembly code for these functions is assembled, and the resulting object data is transplanted back into the C object. Symbols and relocations are updated as needed to ensure correctness.\n\nAny `.rodata` symbols defined in the assembly code will also be transplanted into the C object.\n\n## Usage\n\n```\nmwccgap input.c output.o [ -O4,p -sym on ... ]\n```\n\n`mwccgap` supports the following arguments:\n\n### `--mwcc-path` (path)\nThe path to the MWCC executable, defaults to `mwccpsp.exe`\n\n### `--as-path` (path)\nThe path to GNU as, defaults to `mipsel-linux-gnu-as`\n\n### `--as-march`\nThe `-march=` value to pass to GNU as, defaults to `allegrex`\n\n### `--as-mabi`\nThe `-mabi=` value to pass to GNU as, defaults to `32`\n\n### `--use-wibo`\nWhether or not to prefix the call to the MWCC executable with [wibo](https://github.com/decompals/wibo), defaults to **false**.\n\n### `--wibo-path`\nPath to `wibo` (i.e. if `wibo` is not on your path, or you wish to use `wine` instead), defaults to `wibo`.\n\n### `--asm-dir-prefix`\nOptional directory prefix for `INCLUDE_ASM` files.\n\n### `--macro-inc-path`\nOptional path to your `macro.inc` file.\n\n### `--target-encoding [sjis, ujis, etc]`\nOptional encoding that the input c file should be converted to, before being passed to the compiler.\n\n### `--src-dir`\nOptional path to use when passing data over stdin to interpret relative path include statements.\n\nAll additional arguments will be passed to the MWCC executable.\n\n\n## Quirks\n\n### \"@123\"\n\nSymbols that start with an `@` are not valid syntax. `mwccgap` will temporarily rename these symbols during processing.\n\n### foo$bar$baz\n\nSymbols that contain `$` are not valid synctax, `mwccgap` will temporarily rename these symbols during processing and also mark them as `static` (i.e. local to the file being compiled).\n\n## Limitations\n\nKnown limitations:\n\n- `.rodata` alignment set to `0x8` for all `INCLUDE_RODATA` sections.\n\n\n## Bugs\n\nThis project is in its infancy and is full of assumptions, and therefore likely riddled with bugs; PRs are welcomed!\n\n\n## Examples\n\nProjects that use `mwccgap` include:\n\n- \u003cimg src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/0/0e/PSP_Logo.svg/330px-PSP_Logo.svg.png\" alt=\"PSP\" width=\"48\"\u003e [Castlevania: Symphony of the Night Decompilation](https://github.com/Xeeynamo/sotn-decomp)\n- \u003cimg src=\"https://upload.wikimedia.org/wikipedia/commons/a/af/PlayStation_2_logo.png\" alt=\"PS2\" width=\"48\"\u003e [Street Fighter III: 3rd Strike](https://github.com/apstygo/sfiii-decomp)\n- \u003cimg src=\"https://upload.wikimedia.org/wikipedia/commons/a/af/PlayStation_2_logo.png\" alt=\"PS2\" width=\"48\"\u003e [Shaun Palmer's Pro Snowboarder](https://github.com/Daniel-McCarthy/SPPS)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkst%2Fmwccgap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmkst%2Fmwccgap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkst%2Fmwccgap/lists"}