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:
    Did you feed the hamster in your internet router? It prob died and is running slow now.
  • Xdqwerty @ Xdqwerty:
    @BigOnYa, why did you start saying my pc has a hamster in the first place?
    +1
  • BigOnYa @ BigOnYa:
    Its actua!ly just a old joke, meaning its slow. Was just kidding around with you.
    +1
  • BigOnYa @ BigOnYa:
    I bet @AncientBoi has some hamsters hidden somewhere tho....
    +2
  • Psionic Roshambo @ Psionic Roshambo:
    I think Game streaming should work like this.... Local Hardware able the run the game fine, game engine and common assets stored locally, all FMV and music and textures could be streaming
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    Some temporary storage
  • Xdqwerty @ Xdqwerty:
    also @BigOnYa im making some progress on my gdevelop project, implemented various mechanics
  • Psionic Roshambo @ Psionic Roshambo:
    They went all in on streaming, should have been more of a hybrid approach
    +1
  • BigOnYa @ BigOnYa:
    Or free government supplied high speed internet be nice also. Like Obama care. Xdqwerty that's cool, its time consuming but rewarding once done or playable, to see what you've made from scratch. Animations take forever, but worth it.
    +1
  • Xdqwerty @ Xdqwerty:
    @BigOnYa, although the bullets are a bit buggy
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    Not to mention this would be a massive pain to pirate
  • Xdqwerty @ Xdqwerty:
    @BigOnYa,
    and the visual aspect of the game is quite crude (the sprite that looks best is that of the protagonist just because he is a stickman with sunglasses)
    +1
  • BigOnYa @ BigOnYa:
    There is a bullets behaviour you assign to your character, that makes the code easier, under "behaviours"
  • Xdqwerty @ Xdqwerty:
    i meant that when the character is pointing to the right, the bullets spawn where they should, but when he is on the right, they move to the right but the spawn point is incorrect
  • BigOnYa @ BigOnYa:
    Itch.io has lots of free assets also. Under the bullets behavior tab, there is a "rotate bullets" option, can try that. Or in the code can try
    - fire bullet Player.X(PlayerDirection)
  • Xdqwerty @ Xdqwerty:
    im taking a break for today anyway
    +1
  • BigOnYa @ BigOnYa:
    YEa gotta after a while, looking at code for long periods will bug your eyes.
    +1
  • BigOnYa @ BigOnYa:
    That's cool tho, I'm proud of you going back to it, not giving up. It is difficult at first to learn, but fun once you get the hang of it. I think I've watched every tutorial video there is, but I still struggle sometimes to get stuff to work right. But gotta keep trying dif things, and eventually you will get it right.
    +1
  • K3Nv2 @ K3Nv2:
    Lol McDonald's has a grandma mcflurry
  • Xdqwerty @ Xdqwerty:
    @K3Nv2, furry grandma?
  • BigOnYa @ BigOnYa:
    It sounds good actually, I like butterscotch
  • K3Nv2 @ K3Nv2:
    It sucked don't know wtf these little bits and pieces are they use now
    K3Nv2 @ K3Nv2: It sucked don't know wtf these little bits and pieces are they use now