Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* public domain */
- #include <stdio.h>
- #include <stdlib.h>
- #include <inttypes.h>
- uint8_t* rom_space;
- int main(void) {
- FILE* fp;
- rom_space = (uint8_t*)malloc(sizeof(uint8_t) * 1048576);
- if(rom_space == NULL) return 0;
- fp = fopen("Gold_debug.gbc","rb");
- if(fp == NULL) {
- puts("could not open Gold_debug.gbc!");
- free(rom_space);
- return 0;
- }
- fread(rom_space, sizeof(uint8_t), 1048576, fp);
- fclose(fp);
- rom_space[0x147] = 0x13;
- rom_space[0x14D] = 0xC4;
- fp = fopen("__GOLD_DEBUG_BLPATCHED.gbc","wb");
- if(fp == NULL) {
- puts("could not write the patched rom file");
- free(rom_space);
- return 0;
- }
- fwrite(rom_space, sizeof(uint8_t), 1048576, fp);
- fclose(fp);
- puts("Wrote patched file successfully!");
- free(rom_space);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment