Golden Sun Hacking Community
February 25, 2018, 01:40:09 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
  Home   Forum   DC Wiki Help Search Calendar Downloads Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Android/iOS/PC Porting...?  (Read 1398 times)
0 Members and 1 Guest are viewing this topic.
Claros Flamestrike
Of the Vibrant Life
Mars Clan

Living vibrantly since 1989.™

Regular Member
*

Coins: 0
Offline Offline

Gender: Male
I am: cringing so hard, I think my face is stuck like this forever. Thanks, 2011 version of me! >_< lmao
Posts: 105

« on: April 25, 2017, 02:37:45 AM »

Okay, question for all you nerds who know assembly code. (Because I'm lazy and have no idea how to learn that crap. lmao)

I am looking into porting various games to different OSes through what I call "wrapped emulation". Dunno what it's actually called, but it basically entails running an emulator with a frontend to allow parts of the emulated game to be changed/edited/etc on the fly, usually via RAM or hard-mods to the game's code. I want to see if it's possible to do something like this with multiple games, (like porting Final Fantasy games to Android, but making them less @#$%), but I will use Golden Sun as an example, since it's both the topic of this forum and a game I want to do this with.

In Golden Sun, there are many windows/menus. The Psynergy menu, the Djinn menu, the Start Menu... Et cetera. What I want to do is implement full point/click and hotkey support to it via the "wrapped emulation" concept that I mentioned above. Emulate the game, then live-edit the RAM from a frontend that contains the emulator. Would probably utilize screenspace pixel analysis to detect if a menu is open. Could maybe even do it on the scale of icons and whatnot: have the wrapper scan for certain pixel patterns that match up with an icon, then go from there. But that still presents an interesting problem: scrolling.

The way that GS handles menus is pretty standard for D-pad-controlled games: move the cursor, accept the choice that's highlighted, boom, new menu opens, action is queued/taken, etc. In my vision for this, it would jump directly to the option closest to where the screen was touched: tap on Status from the Overworld menu, and it instantly opens the Status menu, rather than having to hit Right or Left on a D-pad, then A. This is where you assembly code nerds come into play.

I was curious if anyone had dug around in GS's code for long enough to possibly know where to find the pointers for "open menu x" or "execute action y" or "select item z on list a". More than likely, such things could be found in the RAM, much like how the Debug commands can be added to the Start menu by changing just a single address via memory editing. And that is my preferred way of doing this: create a wrapper that intercepts the RAM and live-edits the addresses based on user input. "If address a is set to value b, then create button at (x,y) that changes address c to value d upon use." Something like that.

So, in simpler English: I need the RAM addresses for "is menu a open", "open menu b", and "select list item c" for every menu in the game. I also would need to know more about how Golden Sun handles lists and menu items: is it a simple array that includes the values of whatever is in that slot? ("Slot 0 = 180 x 5, Slot 1 = null, Slot 2...") Or is it more complex? If anyone knows this stuff and could dump a collection of it for me, I'd love them forever. (I already love all of you forever, so it's kind of a moot point. But still!)

If anyone is confused and has any questions, feel free to ask! I might not reply right away, (lots of IRL stuffs going on right now; this is just something that I've been thinking about lately), but I will get back to you as soon as I can.

Anyway, cheers for now! =D?

- 2br02b, 2017

EDIT 1: I also would like to figure out point/click movement, but that can come later; a virtual joystick or WASD will suffice for now. *shrug* lol

EDIT 2: It also occurred to me that I could probably learn assembly code, specifically for GS, if someone has a link or download for a comprehensive tutorial on the language. I've been looking around the web for anything of worth, but I can only find old machine code stuffs and one very old, pre-2000 tutorial site on GBA assembly code that is so shoddily formatted that I can't understand it, at all. So any information about reading materials that you guys have or have used in the past would be appreciated! =D?
« Last Edit: April 25, 2017, 04:49:47 PM by Claros Flamestrike » Logged
View Profile WWW
Fox
Fox McCloud, the Hacking Doctor
Mercury Clan

Prodigy
*

Coins: 28
Offline Offline

I am: certainly not a Gallant!
Clan Position: Head Gallant
Posts: 2407

« Reply #1 on: April 26, 2017, 12:51:35 AM »

I not big on pixel analysis if there are other ways of doing it.... so umm.... yeah.

@EDIT 2 = Looking for the GBATEK bible...? It's a very precious source of information that should not be understated... GBATEK bible to the rescue! (Literally my favorite page for GBA and DS research.)

There is also the Thumb guide. http://forum.goldensunhacking.net/index.php?action=downloads;sa=view;down=27
 You could look at ARM, but isn't really necessary. (Some things like decompression routines may often use ARM, though.)
mov r3, 0x20 would be the same as r3=0x20 (Assume r#'s are just variables containing any number they have in them... usually the result goes in the first register listed depending on the instruction. In this example, that's r3.)

If the value was known, I could make that into more easily readable code like: mov hp, 0x20 (Might not be valid?) ... to kinda/sorta say the registers are just as much variables as in any other programming language (They can be set to values, they can be retrieved/etc.) ...
r0-r7 = General purpose
r8-r12 = General purpose ... Hi-registers ... In Thumb mode, only certain instructions can access them.... but should be available to the majority of ARM instructions.
r13/sp = Stack pointer (Most games have it, so get use to seeing it... Pointer to where to store information when you don't have enough registers... basically.... It's common to push/pop values in/out of here so functions have registers they can use. When calling functions, r0-r3 would be the arguments, if you have more than 4 arguments, they are stored in the stack... when the function is done with, the return value goes in r0 if there is one. (Sometimes you can have a second return value.. (r1... like in division)... but it is very rare.)
r14/lr = Link Register (Pointer to where you return when function you are in ends.)
r15.pc = Program Counter (Current place in execution.)

« Last Edit: April 26, 2017, 01:49:57 AM by Fox » Logged

Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Remember kids! Before you go on that interview, remember to wash your hands in teawater! *Coughs on hand* (Excuse me, I just coughed up a little teawater, so they're still clean!) You wouldn't want that hiring manager to be unimpressed.

May the force be with you!
Shoo! Why does it smell in here?
Maybe that's the wrong kind of force. *smirk*
View Profile
Claros Flamestrike
Of the Vibrant Life
Mars Clan

Living vibrantly since 1989.™

Regular Member
*

Coins: 0
Offline Offline

Gender: Male
I am: cringing so hard, I think my face is stuck like this forever. Thanks, 2011 version of me! >_< lmao
Posts: 105

« Reply #2 on: April 26, 2017, 03:51:24 PM »

@GBATEK: That looks MUCH cleaner/better than the one that I had found before. And it's for GBA, specifically, too, unlike the other one. (The other one was generalized assembly code stuffs, which probably wouldn't have helped, anyway.) So thanks for that. I'll look through it when I get some time. The THUMB chart should be interesting, too, considering the "if you have troubles understanding GBATEK" part in the description. With both, I should have no problems at least getting into it. So thanks for that!

@pixel analysis: I agree. But it was the only way that I could think to do it sans the assembly or RAM stuffs needed to hardmod it into the game. If we can get it all implemented through the game, a full wrapper might not be needed: just the input overlay to handle (x,y) clicks and scrolling. That would be nice. I'm just not sure how it all would work. With a headstart on GBA assembly code, though, I can at least get a look at it from the perspective of the game and figure some stuffs out on my own. But if anyone still wants to dig around for those menu addresses, though... >_> lol?

Anyway, thanks again. Got the THUMB chart downloaded and the GBATEK page bookmarked. I'll follow up here if I figure out anything/have any questions. =D?
Logged
View Profile WWW
Fox
Fox McCloud, the Hacking Doctor
Mercury Clan

Prodigy
*

Coins: 28
Offline Offline

I am: certainly not a Gallant!
Clan Position: Head Gallant
Posts: 2407

« Reply #3 on: April 27, 2017, 05:38:11 PM »

@GBATEK/thumb guide = You are welcome.

@pixel analysis = Umm... yeah... Since we're talking about clicks, it would have been cool to have converted GS into a DS game, but that's probably more difficult than it sounds?
But yeah, I figure having it implemented int the game itself, it could reduce the need for unnecessary execution. (e.g. Instead of checking if a menu is open for the life of the game, you could simply embed the code in the menu itself.)

@menu addresses = Well, general locations of most things have likely been documented (With the exception of anything we forgot about? -- Map code, while some was documented, has mostly been left alone.) -- So I don't figure a whole lot of digging would be necessary. Especially with breakpoint debugging.

« Last Edit: April 27, 2017, 05:48:56 PM by Fox » Logged

Golden Sun Docs: Broken Seal - The Lost Age - Dark Dawn | Mario Sports Docs: Mario Golf & Mario Tennis | Misc. Docs
Refer to Yoshi's Lighthouse for any M&L hacking needs...

Remember kids! Before you go on that interview, remember to wash your hands in teawater! *Coughs on hand* (Excuse me, I just coughed up a little teawater, so they're still clean!) You wouldn't want that hiring manager to be unimpressed.

May the force be with you!
Shoo! Why does it smell in here?
Maybe that's the wrong kind of force. *smirk*
View Profile
Pages: [1]   Go Up
  Print  
 
Jump to:  

Cbox
February 19, 2018, 09:50:20 PM
KyleRunner: "difficult thing about the army": I'm very good at taking orders, so I don't have issues with autority or discipline. The most difficult thing is to be away from my family sometimes. I lived an entire year away from my son, so I'd say that was the most hard part by far. Now it's great!
February 19, 2018, 05:51:35 AM
Fox: I'm happy to see we have plenty of people serving the country here. :)
February 19, 2018, 05:47:15 AM
Fox: Civilian here.
February 19, 2018, 03:05:38 AM
Majora: Good for you, something to be proud of. Air Force, here
February 19, 2018, 02:11:31 AM
Fox: That's good to hear... just checking if there were any possibility of doubt. What would you say was your most difficult thing about the army?
February 18, 2018, 12:39:38 PM
KyleRunner: Well, it was a destiny kinda thing, but I was very happy when I decided to join. It was just like I thought it would be (not in the beginning, though). I'm very pleased with my decision.
February 17, 2018, 11:32:41 PM
Fox: That's awesome!  Trying to figure what question I want to ask Something about how you felt when you made the decision to do the army, and whether it was different than your expectations/etc.
February 17, 2018, 01:53:41 PM
KyleRunner: Wow... My english got rusty. Anyway... I'm in the army now. My life turned 180. But I think it was for the best.
February 16, 2018, 12:45:45 AM
Fox: Hm? So where does that make you today?
February 16, 2018, 12:06:38 AM
KyleRunner: Five years ago I could not even imagine where I am today. I hope it works well for you too!
February 12, 2018, 07:22:50 PM
Fox: 2018 - The year that I will probably be working a manufacturing job. xP What would I have thought, if I told myself this five years ago. Eh?
January 28, 2018, 08:35:28 PM
Fox: You referring to changing the PC/leader sprite to someone else? - I forgot to mention that you can do this using VBA's memory viewer. (Found under Tools.)
January 28, 2018, 03:46:22 PM
shenlong: Hi, Im following up on @Raijinken's question about the sprite change... How do I access that to change it? and can you tell me what the values are for the characters? newbie here
January 26, 2018, 10:12:00 PM
roger: h a p p y  b i r t h d a y  z m a n
January 26, 2018, 01:38:04 AM
Fox: (Assuming you're going for "E")
January 26, 2018, 01:37:06 AM
Fox: So like... https://i.imgur.com/cI4Bgoy.png = Does not explain how it works, but follows this type of thinking.
January 25, 2018, 09:57:44 PM
Fox: Hm... Actually, this gives me an idea! What if the lighthouse becons on each lighthouse were actually portals?
January 25, 2018, 09:56:19 PM
Fox: Hard to explain without a diagram or something... but I could decide on that later. Right now, it turned out I dreamed of something! Something to do with going into the dark dimension... and to go between light and dark, required some energy (energy sphere/warp portal?) to be on... I forget most of the details of the dream now, but it's like you could get trapped in the dark world. Er...
January 25, 2018, 04:56:04 PM
KyleRunner: Can't understand... but... nice!
January 24, 2018, 06:20:33 AM
Fox: Third approach idea = Scan char tables and set up an array that helps to quickly jump over bits that are scanned in the char tables.... to kind of mimic an actual tree a bit better/ and reduce unnecessary scans.).... (untested, but what to know what it's speed is like.)

Affiliates
Temple of Kraden Golden Sunrise
Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.061 seconds with 22 queries.