Glitch City Laboratories Archives

Glitch City Laboratories closed on 1 September 2020 (announcement). This is an archived copy of a thread from Glitch City Laboratories Forums.

You can join Glitch City Research Institute to ask questions or discuss current developments.

You may also download the archive of this forum in .tar.gz, .sql.gz, or .sqlite.gz formats.

Generation I Glitch Discussion

Changing encounter tables in r/b - Page 1

Changing encounter tables in r/b

Posted by: Codabra
Date: 2017-07-02 08:28:07
Hello people of glitch city. I was wondering if it is at all possible to change encounter tables in r/b permanently. Also I'm not asking about the old man glitch that only gets you three. It's also highly limited.

Thanks!

Re: Changing encounter tables in r/b

Posted by: ISSOtm
Date: 2017-07-02 09:46:46
"Permanently" changing the tables is trivial if you are ROM hacking the game, but if you want to "mod" the unmodified game to do just that, you will need ACE.
First, use an exploit like MrCheeze's virus (for the permanent ACE), and have the custom code do this : (written in C for better understanding)


struct EncounterTable {
  (...) /* Same struct as the game uses */
}

/* Used to store which maps are modded this way, and how they should be modded */
struct ModifMarker {
  char mapID;
  struct EncounterTable *ptr;
}


struct EncounterTable customTableRoute1 = {
  (...)
};

struct ModifMarker moddedMaps[] = {
  {
    mapID = 1, /* Route 1's ID */
    ptr = &customTableRoute1
  },
  {
    (...)
  }
};


/* Function ran by the virus's hook */
void customFunc() {
  for(int i = 0; i < (...) ; i++) {
    if(moddedMaps[i].mapID == *wCurMap) {
      memcpy(wGrassMons, moddedMaps[i].ptr, sizeof(struct EncounterTable));
    }
  }
}

Re: Changing encounter tables in r/b

Posted by: Codabra
Date: 2017-07-02 09:51:58
I mean by glitches I'm not making a Rom I have no understanding of programming at all contrary to my name

Re: Changing encounter tables in r/b

Posted by: ISSOtm
Date: 2017-07-02 13:57:33
Okay, so you would need a customized save file. It's a complicated process, mostly version dependent, so… I won't do it. Not motivated enough.

If you want to know :
1. It's possible
2. It's complicated
3. It's a *very* heavy operation. But it's possible.

Re: Changing encounter tables in r/b

Posted by: Parzival
Date: 2017-07-02 21:57:24
#movethisthread


:P

Re: Changing encounter tables in r/b

Posted by: Codabra
Date: 2017-07-04 16:45:25
So how would it be done?

Re: Changing encounter tables in r/b

Posted by: TheZZAZZGlitch
Date: 2017-07-04 18:54:41
It is possible with arbitrary code execution - a subclass of glitches that allows the player to run any code they desire on the console, essentially making it possible to do anything with the game. The most popular and most human-friendly method of acquiring arbitrary code execution on Gen I games is through a glitch item called 8F.

Once it's possible to run any code within the game, one might construct a stub of code that will run constantly in the background and would keep overwriting the encounter tables - just like a Gameshark would do.

Note that this isn't exactly changing the encounter tables "permanently". It only creates an illusion of a permanent change, by constantly overwriting the encounter tables loaded in RAM. If the save file is deleted, everything will be back to normal. Even restarting the game and reloading the save file would reverse the process. We can get around the second restriction by adding some extra code, but the first problem cannot be avoided.

There's at least one thing that glitches cannot and will never be able to do - permanently change the ROM. It's impossible to permanently modify the cartridge by just pure glitching. With enough work it's possible to simulate the ROM changes, by loading code into RAM and running it there - but it's still your original cartridge on the inside. Wipe the save file and everything will be gone.