Advertisement
Huntereb

ARM11 Mario Kart 7 Unlock Everything

Jan 24th, 2015
822
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.19 KB | None | 0 0
  1. #define START_SECTION __attribute__ ((section (".text.start"), naked))
  2.  
  3. // make sure code is PIE
  4. #ifndef __PIE__
  5. #error "Must compile with -fPIE"
  6. #endif
  7.  
  8. int(*IFile_Open)(void *this, const short *path, int flags) = 0x0022FE08;
  9. int(*IFile_Write)(void *this, unsigned int *written, void *src, unsigned int len) = 0x00168764;
  10. int (*GX_SetTextureCopy)(void *input_buffer, void *output_buffer, unsigned int size, int in_x, int in_y, int out_x, int out_y, int flags) = 0x0011DD48;
  11. int (*GSPGPU_FlushDataCache)(void *addr, unsigned int len) = 0x00191504;
  12. int (*svcSleepThread)(unsigned long long nanoseconds) = 0x0023FFE8;
  13.  
  14. int uvl_entry();
  15.  
  16. int START_SECTION
  17. uvl_start ()
  18. {
  19.     __asm__ volatile (".word 0xE1A00000");
  20.     uvl_entry();
  21.     __asm__ volatile ("bx lr");
  22. }
  23.  
  24. int
  25. uvl_entry ()
  26. {
  27.     unsigned int addr;
  28.     void *this = 0x08F10000;
  29.     int *written = 0x08F01000;
  30.     int *buf = 0x18410000;
  31.  
  32.     unsigned int i;
  33.  
  34.     //IFile_Open(this, L"dmc:/mem-0xFFFF0000.bin", 6);
  35.     svcSleepThread(0x400000LL);
  36.  
  37.     //copy block of memory to buffer
  38.     addr = 0x1413C140;      //This is the address we'll take memory from in the game
  39.     GSPGPU_FlushDataCache(addr, 0x10000);
  40.     GX_SetTextureCopy(addr, buf, 0x10000, 0, 0, 0, 0, 8);
  41.     GSPGPU_FlushDataCache(buf, 0x10000);
  42.  
  43.     i = 1;
  44.  
  45.     buf[i] = 0xFF01869F;//VR + Tracks
  46.    
  47.     i = 2;
  48.  
  49.     buf[i] = 0xFFFFFFFF;//Characters
  50.  
  51.     i = 4;
  52.  
  53.     buf[i] = 0x0000FFFF;//Karts
  54.  
  55.     i = 5;
  56.  
  57.     buf[i] = 0x000000FF;//Wheels
  58.  
  59.     i = 6;
  60.  
  61.     buf[i] = 0x000000FF;//Gliders
  62.  
  63.     i = 7;
  64.  
  65.     buf[i] = 0x000900FF;//Mirror Mode & Title Art & 10,000 VR flag
  66.  
  67.     //flush back to memory and also write to file for debuging
  68.     svcSleepThread(0x400000LL);
  69.     GSPGPU_FlushDataCache(buf, 0x10000);
  70.     GX_SetTextureCopy(buf, addr, 0x10000, 0, 0, 0, 0, 8);
  71.     GSPGPU_FlushDataCache(addr, 0x10000);
  72.     //IFile_Write(this, written, buf, 0x10000);
  73.     svcSleepThread(0x400000LL);
  74.  
  75.     //Write screen buff so we know it worked
  76.     GSPGPU_FlushDataCache(0x18000000, 0x00038400);
  77.     GX_SetTextureCopy(0x18000000, 0x1F48F000, 0x00038400, 0, 0, 0, 0, 8);
  78.     svcSleepThread(0x400000LL);
  79.     GSPGPU_FlushDataCache(0x18000000, 0x00038400);
  80.     GX_SetTextureCopy(0x18000000, 0x1F4C7800, 0x00038400, 0, 0, 0, 0, 8);
  81.     svcSleepThread(0x400000LL);
  82.  
  83.     return 0;
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement