News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: [PSP] Source of instruction call ?  (Read 964 times)

omarrrio

  • Jr. Member
  • **
  • Posts: 47
    • View Profile
[PSP] Source of instruction call ?
« on: February 19, 2017, 03:56:47 am »
Hi, is there anyway to know where a bit of instructions were called from ? or at least where the call was before it got removed ?
I apologize for my confusing question, i'll try to explain using images:


These 2 bits of instructions, are never called in game, so i can't use the run to cursor and their break points never hit, so i tried using the in-debugger Ctrl + F feature to search for jal ygsys_isdebugflag and jal ygsys_setdebugflag, they both hit nothing (i start the search from 0x08800000), so i try with another jump command, j ygsys_isdebugflag and j ygsys_setdebugflag do hit, but they only hit shortcuts:


Which in turn, aren't used by any other bit of instructions, so my question is, is it possible to know where were originally called ? Knowing that the game (Tag Force 1) has a prx for the debug menu/gameplay.

My theory is that, at boot, there is an instruction (maybe _main or main or even _start) that initializes isdebugflag so it gets the value stored in a0, the jr ra should return with the v0 valued at 0 or 1 (v0 being 1 probably so that 1 AND 0 = 0), and it would initialize setdebugflag, which in turn checks if v0 is equal to 0, and depending on the answer it should either load the game normally or in debug mode.

BlackDog61

  • Hero Member
  • *****
  • Posts: 784
    • View Profile
    • Super Robot Wars A Portable translation thread
Re: [PSP] Source of instruction call ?
« Reply #1 on: February 19, 2017, 05:24:40 pm »
It's possible what you are looking at is debug code that could get called in a debug version of the game, isn't called in the final version of the game but the developers forgot to remove the code.
A branch instruction could do what you said. Or a different function could write to the same target addressfor initialization (it wouldn't be the first time code gets duplicated in a useless way...)

There are static analyzers to build call/jump trees out of asm. The best one is IDA pro and isn't free at all. I haven't heard of others (and I don't really use these tools, anyway).

omarrrio

  • Jr. Member
  • **
  • Posts: 47
    • View Profile
Re: [PSP] Source of instruction call ?
« Reply #2 on: February 19, 2017, 06:10:14 pm »
Thank you for replying to my topic, you might be right and this could just be some fairy tale that i am looking for, but what about a game module (prx) that actually has debug texts and stuff, is there anyway i can make the game load it ?

BlackDog61

  • Hero Member
  • *****
  • Posts: 784
    • View Profile
    • Super Robot Wars A Portable translation thread
Re: [PSP] Source of instruction call ?
« Reply #3 on: February 20, 2017, 03:10:33 am »
There should be functions in the core PSP library to do that. Look for its documentation potentially floating around, or check if you would be lucky and the debugger would name them for you?

omarrrio

  • Jr. Member
  • **
  • Posts: 47
    • View Profile
Re: [PSP] Source of instruction call ?
« Reply #4 on: February 20, 2017, 07:17:35 am »
Exactly, in this game, the debugger fetches the entire list of instructions with names, only a few are not named, thank you man :)