Advertisement
gopro2027

Universal Useful SPRX Stuff

Aug 18th, 2021
1,849
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. //put this code to get snprintf easily
  2. #include <sys/dbg.h>
  3.  
  4. CDECL int _sys_printf(char* format, ...);
  5. #define printf _sys_printf
  6.  
  7. CDECL int _sys_sprintf(char* buffer, char* format, ...);
  8. #define sprintf _sys_sprintf
  9.  
  10. CDECL int _sys_snprintf(char* buffer, int size, char* format, ...);
  11. #define snprintf _sys_snprintf
  12.  
  13.  
  14. //the call function, pretty much completely eliminates the need to create an opd struct and define a function in the eboot
  15. template <typename T>
  16. __ALWAYS_INLINE T (*call(unsigned int address, unsigned int toc = TOC))(...) {
  17.     volatile opd_s opd = {address,toc};
  18.     T(*func)(...) = (T(*)(...))&opd;
  19.     return func;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement