Register - Login
Views: 99794707
Main - Memberlist - Active users - Calendar - Wiki - IRC Chat - Online users
Ranks - Rules/FAQ - Stats - Latest Posts - Color Chart - Smilies
05-03-22 05:17:45 AM
Jul - General Game/ROM Hacking - Bootstrapping executable code from Pokémon Red/Blue's save New poll - New thread - New reply
Next newer thread | Next older thread
nitro2k01
Random nobody
Level: 6


Posts: 2/6
EXP: 813
For next: 94

Since: 12-10-13


Since last post: 8.4 years
Last activity: 8.2 years

Posted on 12-10-13 07:53:02 AM Link | Quote
Most people seem to be interested in hacks they can perform "in the box", i.e. using button input only, with or without tool-assistance. I'm looking for sort of the opposite. Given control over the SRAM contents, I want to run my own code as soon as possible, perhaps without needing to press A to load the file if possible. I plan to investigate this myself, but if there are existing resources on this specific scenario, I'd be interested.
GuyPerfect
Catgirl
Level: 68


Posts: 881/1096
EXP: 2665654
For next: 63146

Since: 07-23-07


Since last post: 1.7 years
Last activity: 219 days

Posted on 12-10-13 03:48:31 PM Link | Quote
I'm not clear on exactly what you're trying to do. Could you post a for-instance scenario and step me through it so I have a better idea?

As for the save data, I've got that fairly well documented over yonder. As Pokémon uses MBC3, the SRAM is activated by writing 0x0A to 0x0000, which exposes SRAM banks to 0xA000-0xBFFF. Each SRAM bank is 8KB of the save data, which can be selected into that address range by writing the bank number to 0x4000.

Armed with that knowledge, you should be able to write any boot code you want and have it work with the save data.
2Tie

Rumours of my death have been greatly exaggerated.
Level: 70


Posts: 300/1230
EXP: 2878362
For next: 137449

Since: 02-22-10

Pronouns: anything works
From: here

Since last post: 6 days
Last activity: 1 day

Posted on 12-10-13 05:03:55 PM Link | Quote
Guy, I believe he means that, while you can technically create your own Gameboy game using the first-gen pokemon games, like in this video or this one for example, he wants to be able to run his own code/program enabled or programmed in the SRAM ASAP (most likely at the Continue screen or upon loading the save).

As for Nitro, I'd look at the links in the description of the first video if you've haven't already. :3

____________________

2Tie, the JCS CHAMP (whenever I'm around)
Rawr~
nitro2k01
Random nobody
Level: 6


Posts: 3/6
EXP: 813
For next: 94

Since: 12-10-13


Since last post: 8.4 years
Last activity: 8.2 years

Posted on 12-10-13 06:26:03 PM Link | Quote
Originally posted by 2Tie
Guy, I believe he means that, while you can technically create your own Gameboy game using the first-gen pokemon games, like in this video or this one for example, he wants to be able to run his own code/program enabled or programmed in the SRAM ASAP (most likely at the Continue screen or upon loading the save).

As for Nitro, I'd look at the links in the description of the first video if you've haven't already. :3
Yes, exactly, abusing the cartridge SRAM as program storage, which I want running as soon as possible. This could be fun/useful for people who own a cartridge flasher and can write arbitrary SRAM.

The only really relevant link there is to VBA-clojure, which is an extremely cool project, but again based on the premise of entering data as keystrokes. With control over SRAM you could perhaps do better. I'll poke around in BGB eventually, which will probably lead to me finding something interesting.
Sanqui
2060
💛🤍💜🖤🦉
Level: 87


Posts: 1238/2066
EXP: 6311211
For next: 81563

Since: 12-20-09

Pronouns: any ✨
From: Czechia | Estonia

Since last post: 14 days
Last activity: 20 hours

Posted on 12-10-13 06:35:07 PM Link | Quote


*Sanky flops.

level 59

exp 1659508

exppct 85.8%

numposts 1238

 
SRAM is first touched in the main menu (after title screen). That's the theoretical earliest you could run custom code.
I think the best option would be to insert a custom map header in SRAM, and make it run a custom script. Map scripts aren't executed in the main menu, so I think the best you can achieve is having it run your code as soon as you hit CONTINUE.

____________________
I hate to just gloss over things • I keep hoping, but nothing takes form • "The stars watch over us," you say • But aren't they only at night?
Papaver avatar by RacieB
stag019

Red Koopa
Level: 26


Posts: 101/129
EXP: 91339
For next: 10936

Since: 09-11-11


Since last post: 5.6 years
Last activity: 2.1 years

Posted on 12-10-13 07:17:02 PM (last edited by stag019 at 12-10-13 09:49:41 PM) Link | Quote
The easiest way would probably be this:
http://forums.glitchcity.info/index.php/topic,6638.0.html

You would still have to go into the game and select an item, but that doesn't take too long.
I could write you up a save file that has all the data in the proper place in the save file, and point you to a big chunk of save data that you could use (probably the Pokemon in the boxes).

Edit: Combining Sanky and my idea I have a .sav file now for Pokemon Red or Blue that, when hitting the continue button, causes the code in the .sav file at 0x30C0 to run (and you have at least 0x462 bytes to work with). The only problems are:
  1. There is a checksum on these bytes that must be fixed. I wrote a quick and dirty small tiny C program for that: here
  2. Once it run and you return, it runs the code again for every frame you're on the overworld for. I don't know how important this is to you.
If you want me to fix the second one, I'll look for a way to do that; if not, just ask and I'll upload the .sav file somewhere.

Edit 2: Done with the fixing thing. Download here. And if someone wants to mirror this because I can't guarantee it will always be available.
IIMarckus
Member
Level: 25


Posts: 96/111
EXP: 82290
For next: 7330

Since: 10-11-08


Since last post: 3.0 years
Last activity: 1.8 years

Posted on 12-14-13 04:12:37 AM Link | Quote
Originally posted by stag019
And if someone wants to mirror this because I can't guarantee it will always be available.

Sure.

____________________

Next newer thread | Next older thread
Jul - General Game/ROM Hacking - Bootstrapping executable code from Pokémon Red/Blue's save New poll - New thread - New reply


Rusted Logic

Acmlmboard - commit 47be4dc [2021-08-23]
©2000-2022 Acmlm, Xkeeper, Kaito Sinclaire, et al.

32 database queries, 1 query cache hits.
Query execution time: 0.103061 seconds
Script execution time: 0.014046 seconds
Total render time: 0.117107 seconds