ROM Hack Custom sensors in cartridges: how does one read data?

wgroeneveld

New Member
OP
Newbie
Joined
Jul 2, 2020
Messages
2
Trophies
0
Age
43
XP
41
Country
Belgium
Hi GBATemp community,

I'm trying to understand how custom sensors added to certain cartridges work, such as Boktai's sunlight sensor. the thread "boktai-solar-sensor-patch-kit.245127" (cant post a link...) lists a neat ROM hack where I can defer the address in the assembly where the sensor data is read. And I understand that any game can solder on any kind of sensor, it's game-specific, not platform-specific.

I'm a software guy, not a hardware one, so I wonder: to the devs just 'know' you have to read memory location XXXX and that's where the sensor will be? (like VRAM at 0x6000xx etc...) I presume that is the case. Meaning I can create a game that has a "light sensor" (at a certain pre-set address?) and mGBA could manipulate it's values using emulation->solar sensor->increase brightness menus. Or is there some kind of bridge between GBA BIOS/IRQ calls for sensors built-in?

Thanks for clearing that up!
 

Sterophonick

Stupid Retro Tech Cat
Member
Joined
Jul 17, 2018
Messages
570
Trophies
0
Location
Spamton's Keygen Dungeon
Website
sterophonick.github.io
XP
2,250
Country
United States
I believe the console has some GPIO ports that are located somewhere in the address space of ROM, (but these bytes are not part of ROM, and are erased when the console is shut off) and there is code to decode the data this is given to the system. This is how the RTC and Gyroscope work.
 
Last edited by Sterophonick,

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,403
Country
United Kingdom
http://problemkaputt.de/gbatek.htm#gbacartridges if you just wanted protocols.

Beyond that not sure if you are asking for a reverse engineering guide (most such things are tapped every frame, or have direct things you can search for as cheats just like you would search for lives, hardware debugging was kind of a thing but easy enough to set a breakpoint or even static disassembly analysis for such things) or an electronics design guide (short version if you are software and are used to various APIs and whatever to communicate between programs then same applies to electronics -- http://dangerousprototypes.com/docs/Bus_Pirate is a reverse engineering tool but provides a nice overview of most of the comms protocols, you might even recognise a few of them from the gbatek document linked at the start. You then have two main approaches unless the console affords you another by some other bus, and that is you edit what it thinks is the ROM, which is technically how many flash carts work but was popular back in older devices, or you edit what it thinks/normally uses as a save which is what most things do).
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • BigOnYa @ BigOnYa:
    This was one of the craziest movies I've seen about our food industry, lots of stuff I didn't know. A must see. https://youtu.be/OqzjC-ENrl8?si=GYxmdY5nShzGniVi
  • OctoAori20 @ OctoAori20:
    Oh, that dude?
  • OctoAori20 @ OctoAori20:
    I stopped believing or caring about that dude when I found out about some of the more questionable nonsense he did in his life.
  • BigOnYa @ BigOnYa:
    Like what? I didn't know or hear.
  • K3Nv2 @ K3Nv2:
    You mean like every famous person that ever existed
    +1
  • K3Nv2 @ K3Nv2:
    I get so tired of hearing oh I liked him until...
  • OctoAori20 @ OctoAori20:
    I just know dude was a chronic alcoholic and such.
  • BigOnYa @ BigOnYa:
    I've been to his chicken restaurant he started in his 2nd movie, Holy Chicken, was pretty good. It is only 15-20 miles from me in Ohio. It only lasted 1 yr or so then closed tho.
  • OctoAori20 @ OctoAori20:
    There are very few people I just have just an immense dislike of and he's one of those very few people, the only other example is Gene Simmons. My musician uncle on my mother's side of the family actually met Gene once during some event and said he was the most unpleasant person to be around.
  • K3Nv2 @ K3Nv2:
    I met myself once turns out that guy is a giant piece of shit that doesn't deserve any of my respect
  • BigOnYa @ BigOnYa:
    Damn alcoholics! (Sshhh- Opens another beer)
  • OctoAori20 @ OctoAori20:
    Agreed, Ken
  • OctoAori20 @ OctoAori20:
    I can't say I've ever tried even a sip of beer tbh-
  • K3Nv2 @ K3Nv2:
    You met yourself also and is a giant piece of shit?
    +1
  • OctoAori20 @ OctoAori20:
    Then again, I don't think I'd really enjoy it //shrug
  • OctoAori20 @ OctoAori20:
    I'm sure it's an acquired taste :P
  • K3Nv2 @ K3Nv2:
    Poor lad can never enjoy the amazing taste of four loko
    +1
  • BigOnYa @ BigOnYa:
    Root beer is a gateway drink, don't ever try it either.
  • K3Nv2 @ K3Nv2:
    @BigOnYa, don't you love how smooth MD20 is
  • BigOnYa @ BigOnYa:
    Mad dog 20 20? Oh yea fixed the typo. I haven't seen that or had forever. Do they still make it?
  • K3Nv2 @ K3Nv2:
    I think it's why I'm alive
    +1
  • BigOnYa @ BigOnYa:
    What happens if when playing Paper Mario, you start a fire in-game?
  • Psionic Roshambo @ Psionic Roshambo:
    Paper Mario is a drug dealer and he is all about the paper yo lol
    Psionic Roshambo @ Psionic Roshambo: Paper Mario is a drug dealer and he is all about the paper yo lol