Advertisement
FishamanP

swiss_chts_from_sdgecko_b.patch

Sep 10th, 2015
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.29 KB | None | 0 0
  1. diff --git cube/swiss/source/swiss.c cube/swiss/source/swiss.c
  2. index 5d9be84..bfce8b4 100644
  3. --- cube/swiss/source/swiss.c
  4. +++ cube/swiss/source/swiss.c
  5. @@ -1371,17 +1371,25 @@ int info_game()
  6. }
  7. }
  8. // Look for a cheats file based on the GameID
  9. + // If game is not on SD Gecko, search for codes on the SD Gecko in slot B
  10. if(PAD_ButtonsHeld(0) & PAD_BUTTON_Y) {
  11. char trimmedGameId[8];
  12. memset(trimmedGameId, 0, 8);
  13. memcpy(trimmedGameId, (char*)&GCMDisk, 6);
  14. file_handle *cheatsFile = memalign(32,sizeof(file_handle));
  15. - memcpy(cheatsFile, deviceHandler_initial, sizeof(file_handle));
  16. - sprintf(cheatsFile->name, "%s/cheats/%s.txt", deviceHandler_initial->name, trimmedGameId);
  17. + if (curDevice != SD_CARD) {
  18. + memcpy(cheatsFile, &initial_SD1, sizeof(file_handle));
  19. + deviceHandler_FAT_init(cheatsFile);
  20. + sprintf(cheatsFile->name, "%s/cheats/%s.txt", (&initial_SD1)->name, trimmedGameId);
  21. + }
  22. + else {
  23. + memcpy(cheatsFile, deviceHandler_initial, sizeof(file_handle));
  24. + sprintf(cheatsFile->name, "%s/cheats/%s.txt", deviceHandler_initial->name, trimmedGameId);
  25. + }
  26. print_gecko("Looking for cheats file @ %s\r\n", cheatsFile->name);
  27. cheatsFile->size = -1;
  28.  
  29. - if(deviceHandler_readFile(cheatsFile, &trimmedGameId, 8) != 8) {
  30. + if(deviceHandler_FAT_readFile(cheatsFile, &trimmedGameId, 8) != 8) {
  31. while(PAD_ButtonsHeld(0) & PAD_BUTTON_Y);
  32. DrawFrameStart();
  33. DrawMessageBox(D_INFO,"No cheats file found.\nPress A to continue.");
  34. @@ -1393,12 +1401,15 @@ int info_game()
  35. print_gecko("Cheats file found with size %i\r\n", cheatsFile->size);
  36. char *cheats_buffer = memalign(32, cheatsFile->size);
  37. if(cheats_buffer) {
  38. - deviceHandler_seekFile(cheatsFile, 0, DEVICE_HANDLER_SEEK_SET);
  39. - deviceHandler_readFile(cheatsFile, cheats_buffer, cheatsFile->size);
  40. + deviceHandler_FAT_seekFile(cheatsFile, 0, DEVICE_HANDLER_SEEK_SET);
  41. + deviceHandler_FAT_readFile(cheatsFile, cheats_buffer, cheatsFile->size);
  42. parseCheats(cheats_buffer);
  43. free(cheats_buffer);
  44. DrawCheatsSelector(getRelativeName(allFiles[curSelection].name));
  45. }
  46. + if (curDevice != SD_CARD) {
  47. + deviceHandler_FAT_deinit(cheatsFile);
  48. + }
  49. }
  50. while(PAD_ButtonsHeld(0) & PAD_BUTTON_A){ VIDEO_WaitVSync (); }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement