ROM Hack RELEASE GDrive Token Generator for SX Installer (Authenticated Google Drive Support)

Arkangelshadow

Well-Known Member
Member
Joined
Jun 6, 2013
Messages
148
Trophies
0
Age
36
XP
1,108
Country
Mexico
Thx, everything worked fine as I have access to the files via "mounting" the google drive folder; but it takes too long to load, and it didn't tell me which games require updates or dlc.
 

lahma

Member
OP
Newcomer
Joined
Nov 29, 2017
Messages
23
Trophies
0
XP
195
Country
United States
Thx, everything worked fine as I have access to the files via "mounting" the google drive folder; but it takes too long to load, and it didn't tell me which games require updates or dlc.
I'm not sure what you mean by "mounting" the Google Drive folder (do you mean the "File Browser"?). When I load Tinfoil (without connecting to a NUT server), it only takes a few seconds to parse my Google Drive folder. I have my gdrive path set directly to the folder containing only my Switch files though, so even though my Switch folder has many hundreds of NSPs/XCIs/etc, it only has to parse those files and not everything else on my Google Drive. If you want Tinfoil to parse your gdrive path on startup (so that it can be used in the list of new games/updates/dlc), highlight it inside of "File Browser", hit "X" on your controller, set ENABLED to 'YES', and then hit "X" again to save. If ENABLED is set to 'NO', then Tinfoil does not parse the directory at all upon startup and the only way to access the files within is directly through "File Browser".

Another thing to be aware of is if you have ENABLED set to 'YES' on a location that is inaccessible (such as a 'nut://' address but you do not have your NUT server running), it will take a very long time for Tinfoil to startup because it is trying to access that address but can't. The timeout value for how long it continues to try to access an inaccessible address can be changed but its probably best just to set the ENABLED value appropriately for all of your locations instead.

One thing I'm not sure of is how Tinfoil parses Switch files on Google Drive. While it may actually read the header of each file in order to ascertain the title id and version # of each, it parses my gdrive folder so quickly that I doubt whether this is actually the case. If I had to guess, I would say that it is instead reading that info from the filename of each file instead. If this is indeed the case (perhaps @blawar can answer this), then you will need to ensure that you have all of your Switch files on your Google Drive are named appropriately (such as 'Celeste [01002b30028f6800][v196608].nsp') so that it can correctly parse them to use them in the New Games/Updates/DLC sections.

Hopefully I was able to answer your question. If I misunderstood, please clarify what you need help with, and I'll do my best to help out.
 

Arkangelshadow

Well-Known Member
Member
Joined
Jun 6, 2013
Messages
148
Trophies
0
Age
36
XP
1,108
Country
Mexico
Hi, thx for your answer. I'm using SX Installer; and by "mounting the gdrive" i'm refering to the file browser.

I went to the file browser, and i was already enabled. The file browser is pointed to a folder in the gdrive that has 3 subfolders (base,dlc,updates).

If i click on dlc, it takes a large amount of time before it can show me files; wich i can now order (thx to you) but can't know if i have it installed or not.

But the gdrive files only appear via file browser; and not on the left menu as in some "packs".
 

lahma

Member
OP
Newcomer
Joined
Nov 29, 2017
Messages
23
Trophies
0
XP
195
Country
United States
Hi, thx for your answer. I'm using SX Installer; and by "mounting the gdrive" i'm refering to the file browser.

I went to the file browser, and i was already enabled. The file browser is pointed to a folder in the gdrive that has 3 subfolders (base,dlc,updates).

If i click on dlc, it takes a large amount of time before it can show me files; wich i can now order (thx to you) but can't know if i have it installed or not.

But the gdrive files only appear via file browser; and not on the left menu as in some "packs".
Obviously, I'm a bit late here lol... Sorry, I didn't even see that I had a reply on the thread. As far as having the gdrive files show up in the left menu, you can now "Pin" any gdrive directory and those files should show up there. Just browse to the Google Drive folder you desire and push in/click the right stick (I think.. it should say at the bottom of the screen) and it should accomplish what you're trying to do.

On the newest version of Tinfoil (7.01), I'm experiencing some other issues with gdrive paths that I contacted @blawar about (such as having issues using folder IDs as the 'path' and also issues using raw path labels as 'path' that are pointing to folders containing lots of files, ex: 'root/switch/games'). Whenever I hear back from him, I will update the thread as well as the instructions on my Github.

--------------------- MERGED ---------------------------

This works very well, thank you for the very readable guide!
You're very welcome! Took me a lot of trial, error, and heartache to figure it all out, so I felt compelled to share my findings with others :) Glad you found it useful.
 

eXhumer1

Member
Newcomer
Joined
May 1, 2019
Messages
7
Trophies
0
XP
117
Country
Canada
I have a few questions.

Why have you opted for oauth2client, a deprecated oauth2 python library instead of the ones mentioned in the deprecation notice?
Why have you not used the same methods outlined in nut for token creation and the oauth library used in nut instead of making your own methods and using deprecated oauth library?

https://pastebin.com/bf8Fx2up

EDIT: Also forgot to ask another question, why are you building a Google Drive service for, returning it with your method and not using it anywhere?
EDIT2: Also forgot to ask another question, why is your scope read-only? IIRC (although I could very well be wrong here), you can also write to the gdrive protocol in tinfoil/sx-installer. So, I'm not sure why you did that for also.
 
Last edited by eXhumer1,

lahma

Member
OP
Newcomer
Joined
Nov 29, 2017
Messages
23
Trophies
0
XP
195
Country
United States
I have a few questions.

Why have you opted for oauth2client, a deprecated oauth2 python library instead of the ones mentioned in the deprecation notice?
Why have you not used the same methods outlined in nut for token creation and the oauth library used in nut instead of making your own methods and using deprecated oauth library?

https://pastebin.com/bf8Fx2up

EDIT: Also forgot to ask another question, why are you building a Google Drive service for, returning it with your method and not using it anywhere?
EDIT2: Also forgot to ask another question, why is your scope read-only? IIRC (although I could very well be wrong here), you can also write to the gdrive protocol in tinfoil/sx-installer. So, I'm not sure why you did that for also.
I already replied to the issue you filed on my Github. I will try to reply to your other questions here when I get a chance. Just a bit busy at the moment. (Quick Hint: Lots of things have changed in Tinfoil since I wrote the utility and all its documentation... Tinfoil used to only support reading from GDrive (no save support to gdrive) and you could only create the initial authentication token while being connected to a PC via NUT.)
 
Last edited by lahma,

blawar

Developer
Developer
Joined
Nov 21, 2016
Messages
1,706
Trophies
1
Age
38
XP
4,260
Country
United States
I already replied to the issue you filed on my Github. I will try to reply to your other questions here when I get a chance. Just a bit busy at the moment. (Quick Hint: Lots of things have changed in Tinfoil since I wrote the utility and all its documentation... Tinfoil used to only support reading from GDrive (no save support to gdrive) and you could only create the initial authentication token while being connected to a PC via NUT.)

Your app is still useful when the user doesn't want to use NUT or manually create the required files on a PC.
 

lahma

Member
OP
Newcomer
Joined
Nov 29, 2017
Messages
23
Trophies
0
XP
195
Country
United States
Your app is still useful when the user doesn't want to use NUT or manually create the required files on a PC.
Hey @blawar , I sent you a PM a couple of days ago but I'm going to repeat my msg/questions here in case someone else has input on the topic or can answer any of my questions. If/when you have time to address any of this, your input would be greatly appreciated.

Just have a quick question (or maybe observation) about Google Drive support in the latest version of Tinfoil (v7.01). On the previous version, when you were adding a Google Drive path, you could put the folder ID of any folder on your gdrive as 'path' and it would work just fine. Now, that does not appear to be working... which would be fine if a normal raw path worked (which it does appear to work to some extent) but it appears that something funny is going on. For example, if I add a new gdrive location with no path, it opens it just fine. If I add one with the path set to 'root', it opens up to the root "My Drive" folder perfectly fine (and opens it almost immediately). However, if I start doing my fine-grained paths than that, I start getting very strange behavior.

Just as an example, my gdrive has a valid path of "root/temp" (and the temp folder has just a few files in it), but if I put that in as my path, it appears to completely lock up the app. However, just by accident, I left it sitting there in that locked state for probably 5-10 min, and eventually, it actually did open that folder. That got me curious, so I tried pointing it to the raw path of my Switch Games directory once again (in my case "root/backup/Switch Games") and again it appeared to freeze... I left it like that for probably 40 min and it never did open the folder. That folder has 100's of GBs of Switch games, but it opened it very quickly on the previous version (even though I was using a folder ID instead of the raw path). All of these paths have 'Enabled' set to 'False' and none of them are pinned.

In the big spectrum of things, none of this is a huge deal as I can just navigate to my Switch Games directory from gdrive location with a blank path... I'm mostly trying to figure all of this out so I can update my project documentation since a lot of it is no longer valid (since raw folder IDs appear to no longer be working). I also have a lot of people contacting me to ask for help figuring out why their gdrive paths are not working in Tinfoil/SX Installer.
 
General chit-chat
Help Users
    Spring_Spring @ Spring_Spring: and post it uwu