One of the joys of Reverse Engineering PS4 files is having to deal with nameless functions, since Sony have come up with an ingenious (?) way to create shared libraries without including any symbol names, but still have a way to resolve functions, using Name Identifier (NID).

What is an NID?


That, it's just a form of ID that can be used to identify a function, the way it works is, when devs build apps, the write the code and use the function name, but when the app is built the names are stripped out and instead NIDs and address locations are used to identify which function to call and where.

So what do we need to resolver NID into function names?
there are 3 main parts to this:

  1. String table offset
    • contain names of libraries and modules that are used in sprx/bin but it also contains the actual NIDs
  2. Symbol table offset
    • contains function/symbol address and it's associated String id
      • This table contains only the address of internal functions only
  3. Runtime/Dynamic relocation table offset
    • contains function/symbol address and it's associated String id
      • This table contains the addresses of external functions

If you're keeping up, you probably realised that by now we can associate a function/symbol address with it's NID but we made no association between NIDs and function names, well that's is the tricky part, you see there is no real way to make an association, the current way I'm ware of, is looking at debug messages within a library as some of those messages would mention the name of the functions involved, for example this:

 result = SUB_260(unk_252D64, 0LL, 0LL, 0LL, 0LL);
  if ( (_DWORD)result )
    result = printf("sceSysmoduleUnloadModuleByNameInternal Error:ret=%08x", (unsigned int)result);

we can deduce from this snippet that SUB_260 is sceSysmoduleUnloadModuleByNameInternal since the error being printed is clearly from SUB_260, and since we can associate function address (0x260) to it's NID, we can associate NID to a name.

"but that sounds laborious", you say!!
well ya it is but thanks to the work of @idc we have a database of over 10,000 functions!!

As for the plugin you can find the source on github.

If you're not using IDA, building the source would generate an executable that will printout NID, symbol address and it's associated name, just so, I tried to break all the functionality into manageable bits so it can be easily ported to other tools(contact me if you need help)