Homebrew COMPLETED PyNX - Game Redirector

Should I add NPDM editing to this?

  • Yes

  • No


Results are only viewable after voting.

HoTsHoTz79

GIC-Developer
Member
Joined
May 9, 2018
Messages
322
Trophies
0
Age
39
XP
964
Country
Canada
found this @ line 139:
shutil.move(self.get_path() + '/RomFs', self.get_currently_used_by_path() + '/RomFs')

I did replace all with /RomFs/
above line was /RomFs ... missing the / at the end... so i just renamed those 2 with .bin at the end

gonna try this again

Ok was successful in switching between 2 games using same donor... details below:

Started from scratch, deleted config.ini file
Selected Donor = Dragon Quest Builder
Selected Game = Splatoon2
Game loads up

Clicked Put Games Back (PGB)
Worked

Tried another game
Selected Donor = Dragon Quest Builder
Selected Game = Arms
Error

Deleted config.ini file
Tried again
Worked

----------

in my opinion, config.ini needs to be updated to replace <donor tid>=<gamename> to <donor tid>=None
after a successful PGB action
 
Last edited by HoTsHoTz79,

ChainedHope

Active Member
OP
Newcomer
Joined
Dec 12, 2017
Messages
41
Trophies
0
Age
29
XP
195
Country
United States
Ok was successful in switching between 2 games using same donor... details below:

Started from scratch, deleted config.ini file
Selected Donor = Dragon Quest Builder
Selected Game = Splatoon2
Game loads up

Clicked Put Games Back (PGB)
Worked

Tried another game
Selected Donor = Dragon Quest Builder
Selected Game = Arms
Error

Deleted config.ini file
Tried again
Worked

----------

in my opinion, config.ini needs to be updated to replace <donor tid>=<gamename> to <donor tid>=None
after a successful PGB action
It does in my version, that wont be uploaded until tomorrow when I get another minor bug worked out and have time to look into a better UI option I just saw.
 
  • Like
Reactions: HoTsHoTz79

bedbug1226

Well-Known Member
Newcomer
Joined
Dec 1, 2014
Messages
83
Trophies
0
Age
30
XP
491
Country
United States
I wonder if you could add save movement too when we replace a game with layeredfs.

Example.

I have Skyrim installed to Octo.
I move Doom in to Octo thus moving Skyrim back to its folder.
Octo's current save info gets moved with Skyrim back to its folder and deleteing the save from Octo.
Doom's saves get moved from Doom folder to Octo or do nothing if new game.

Is this doable with PyNX?

Could you add compatibility for both unpacked romfs and romfs.bin?
However I think there might be some bugs when swapping a new game in anyway.
 
Last edited by bedbug1226,
D

Deleted-451877

Guest
Took a quick peek at your script, __init__'ing stuff to None is useless, you can just create that value later on when you actually write something to it.
Having 'None' as a string is weird, typically you can just leave the string empty.
More of a personal opinion, but I wouldn't define that much functions, it bloats the script and makes it unnecessarily hard to understand.
 

ChainedHope

Active Member
OP
Newcomer
Joined
Dec 12, 2017
Messages
41
Trophies
0
Age
29
XP
195
Country
United States
I wonder if you could add save movement too when we replace a game with layeredfs.

Example.

I have Skyrim installed to Octo.
I move Doom in to Octo thus moving Skyrim back to its folder.
Octo's current save info gets moved with Skyrim back to its folder and deleteing the save from Octo.
Doom's saves get moved from Doom folder to Octo or do nothing if new game.

Is this doable with PyNX?

Could you add compatibility for both unpacked romfs and romfs.bin?
However I think there might be some bugs when swapping a new game in anyway.

Saves are doable. I know PyNX can do it, but I haven't messed with it yet.
I didn't have time today to do much, but I have a toggle at the top of the script right now to switch between the romfs dir, romfs.bin, and romfs.romfs. I still need to test it before I upload.

Took a quick peek at your script, __init__'ing stuff to None is useless, you can just create that value later on when you actually write something to it.
Having 'None' as a string is weird, typically you can just leave the string empty.
More of a personal opinion, but I wouldn't define that much functions, it bloats the script and makes it unnecessarily hard to understand.

Mostly debugging with all the Nones. Also they were getting set to 'None' because I was using them for reading out in the 'show config' menu. Kept getting NoneType errors as my 'fuckit' approach was to just string everything while I got other parts to work.

The def thing could be worked on, my preference is to have the main section be completely clean with it getting more broken up as you dig further in. It could definitely be fixed for readability but as 90% of the users here wouldn't even open it, I doubt I will put the time into it. I'm probably just going to shove it on git for the next release and let people make changes as they want. As of now it works how I wanted it to and I havent had any real issues yet.

Is possible on 1.0 and do i need a original eshop oder cartridge for that?!
LFS to my knowledge only works on 5.x.
 

HoTsHoTz79

GIC-Developer
Member
Joined
May 9, 2018
Messages
322
Trophies
0
Age
39
XP
964
Country
Canada
I've moved over to github.
https://github.com/Kozlowlw/py-switch

People can make pull requests if they want to update functionality. I've also rewritten some parts of it (again)...
Testing is still being done, but if anyone wants to grab it they are welcome to.

Does this include the change you mentioned yesterday about updating the config.ini to <donor tid>=None after a successful "Put Games Back"?
 

kevin_1351

Well-Known Member
Newcomer
Joined
Apr 20, 2014
Messages
88
Trophies
0
Age
29
Location
Lugano, Switzerland
XP
497
Country
Switzerland
GameRedirectory is a PyNX script for managing your LayeredFs games. Follow the installation and how-to section.
Features: NPDM editing, moving files between a storage location (/switch/games/) and donors (/atmosphere/titles/), configuration file to keep track of what is where.

Downloads
GITHUB: https://github.com/Kozlowlw/py-switch


Old releases:
v1.0.3: https://mega.nz/#!h6xhkQhY!rbzaB0mozAjoYSjcZ-dfcBIFiIkt4fmcvN_O9e7Y5Rw
v1.0.2: https://mega.nz/#!0rZTGKaY!DQxYZzXoQ0NFdClAvFz4GGWtr0gLardSB6EEh_2jcj0
Beta-v1.0.1: https://mega.nz/#!ImpzWYBC!C2vMSiJSDkNrww6F83J0M0t8prhZYjetNYeBESWzTtU
v1.0.0 - https://mega.nz/#!kiRlxCZK!DA3hl5dr_ea37tPsA_IWkXDQzf1x0fF5mhM8mrsw51g

Installation:
  1. Put PyNX in /switch
  2. Put GameRedirector.py in /switch
  3. Put your titles in /switch/games/
How To Use:
  1. Launch PyNX.nro from hbl/hbm
  2. Select GameRedirector.py from the list (Up/Down on dpad/left joycon to move, a to select)
  3. Press 'a' again. The dialog doesn't pop up that asks if you want to run with v0.5.1 for some reason.
  4. Use 'Select Donor Title' to pick which game to redirect to (overwrite)
  5. Use 'Select Game Folder' to pick the game you want to redirect (play)
  6. Use 'Swap Files' to begin the process
  7. Press the home button to exit. The 'End' option kills my script, but not PyNX. I couldn't find a method for doing that in there library.
  8. Start the donor game and enjoy.
FAQ:
Q: What file structure do the /switch/games/ need to be in?
A: {GameName}/RomFs/* <---- NOTE: It defaults to a folder. If you want it to use .bin or .romfs then change it at the top of the script in the edit section.
{GameName}/ExeFs/*​

Q: How do I get my XCI into that structure?
A: You can use my python script (here) or any of the other XCI converters and just make the folders.

Q: What games work with what donors?
A: Check here [Also post what you try, so we get a better list]

Q: PyNX crashes/Homebrew doesn't load in LayeredFs patched kernel?
A: Right now you can only "sometimes" use homebrew alongside the LayeredFS kernels. Booting into a non-patched kernel [regular hetake] to use the script and then rebooting into your RomFS/LayeredFs patched kernel to run the game works too. This will hopefully be fixed at some point. I've heard Switchblade lets you run homebrew with less crashes.

Q: Your script crashed after running.
A: It happens. Try again.

Changelog:
V1.0.3 - Added .npdm editing. File structure has changed!!!! Games now go in /switch/games/{Game Name}/{ExeFs and RomFs dirs}. This also means that RomFs needs to be a folder now. You are welcome to change it in the code, but to make it better fit my python xci-to-lfs script its staying as a folder (literally change it to move '/RomFs/' to '/RomFs.bin' and it should work)

V1.0.2 - Updated.. Shouldn't have anymore issues with config files. Working on npdm and folder editing for v1.0.3. Will probably change file structure a bit if/when I do this.

V1.0.1 - Finished the config portion. Also managed to get moving files working instead of copying. It now takes less than a minute to move a previous redirect and move in a new game. #Success. This had very limited testing so... beta?

V1.0.0 - POC release. Works but super slow

It's really nice!

Please use a dictionary instead of two separate lists for the donors; or even better, let us set those in the config.

Also, if PyNX has that reach, please let us manage the saves too.
 
Last edited by kevin_1351,
  • Like
Reactions: ChainedHope

ChainedHope

Active Member
OP
Newcomer
Joined
Dec 12, 2017
Messages
41
Trophies
0
Age
29
XP
195
Country
United States
It's really nice!
Please use a dictionary instead of two separate lists for the donors; or even better, let us set those in the config.
Also, if PyNX has that reach, please let us manage the saves too.

The config is auto generated based on the script (was made that way so that people wouldn't mess up writing their own as things are case sensitive). Its not too hard to update the lists to use what you want as it is, but I might update it to use a dictionary instead as that would technically be a bit easier for people to add to (only marginally)

I'll play around with PyNX's built in save functions and see how easy/bad it is to move the saves around.

also @HoTsHoTz79 I pushed to the git with the config changes, Let me know if it works. I'm currently downloading a couple more .xci's to test with (been doing all my testing with 2 .xcis and I accidently deleted them while I was messing with something...)
 

kevin_1351

Well-Known Member
Newcomer
Joined
Apr 20, 2014
Messages
88
Trophies
0
Age
29
Location
Lugano, Switzerland
XP
497
Country
Switzerland
The config is auto generated based on the script (was made that way so that people wouldn't mess up writing their own as things are case sensitive). Its not too hard to update the lists to use what you want as it is, but I might update it to use a dictionary instead as that would technically be a bit easier for people to add to (only marginally)

I'll play around with PyNX's built in save functions and see how easy/bad it is to move the saves around.

IMO that file shouldn't be called config then. Since it's for the script itself. Please let us have a real config file where we could set our donors and some other stuff: i.e. bin or folder.

EDIT: I might even do it myself, but I'm still doing my exams this week :/

EDIT2: Also, I think it would be easier for you to work with json or yaml files instead of an ini. There are many great libs for that.
 
Last edited by kevin_1351,

ChainedHope

Active Member
OP
Newcomer
Joined
Dec 12, 2017
Messages
41
Trophies
0
Age
29
XP
195
Country
United States
IMO that file shouldn't be called config then. Since it's for the script itself. Please let us have a real config file where we could set our donors and some other stuff: i.e. bin or folder.

EDIT: I might even do it myself, but I'm still doing my exams this week :/
Its technically not wrong. config can be used for anything to do with configuration. It configures what games are where.
Tbf config.ini originally was going to store everything (file paths, donor tids, game directory), but to make things simple and keep small errors from popping up, it was changed to just store information of what was where.

You are welcome to make a pull request with changes. As long as they add functionality or fix issues, I will accept it.
 
  • Like
Reactions: kevin_1351

kevin_1351

Well-Known Member
Newcomer
Joined
Apr 20, 2014
Messages
88
Trophies
0
Age
29
Location
Lugano, Switzerland
XP
497
Country
Switzerland
Just for the record, I really enjoy your work. I just wanted to point out some things.
And as I said, next week I'll probably contribute, while trying to adhere to your conventions.

Thanks :)
 

ChainedHope

Active Member
OP
Newcomer
Joined
Dec 12, 2017
Messages
41
Trophies
0
Age
29
XP
195
Country
United States
Just for the record, I really enjoy your work. I just wanted to point out some things.
And as I said, next week I'll probably contribute, while trying to adhere to your conventions.

Thanks :)

I look forward to it :D
I'm taking your advice and checking if PyNX has included ConfigParser (I know I should have checked this already but... oh well?). If it does, I will make this an actual config file and rewrite the read_config and write_config portions.
Sorry If I sounded annoyed.. I just had to explain to someone that renaming and moving a file are literally the same thing and they fought me on it the entire way until I linked them a low level hardware document.
 

HoTsHoTz79

GIC-Developer
Member
Joined
May 9, 2018
Messages
322
Trophies
0
Age
39
XP
964
Country
Canada
@ChainedHope I only got chance to test it out once last night and it didn't work

  1. Grabbed the latest .py from github link
  2. deleted old config.ini
  3. Manually updated the Donor Title Name and ID in the .py file
  4. Ran .py
  5. Selected Donor as Dragon Quest Builder
  6. Selected Game as Wonder Boy
  7. Started... and it said going back to menu in 5 seconds
  8. checked the sd card and files were not moved
  9. config.ini did not get updated
So then i ran old 1.3 version
  • Same steps
  • and it worked
Just to confirm, i dont have to replace /romfs/ to /romfs.bin right? since i see variable was updated to cover all scenarios
 

ChainedHope

Active Member
OP
Newcomer
Joined
Dec 12, 2017
Messages
41
Trophies
0
Age
29
XP
195
Country
United States
@ChainedHope I only got chance to test it out once last night and it didn't work

  1. Grabbed the latest .py from github link
  2. deleted old config.ini
  3. Manually updated the Donor Title Name and ID in the .py file
  4. Ran .py
  5. Selected Donor as Dragon Quest Builder
  6. Selected Game as Wonder Boy
  7. Started... and it said going back to menu in 5 seconds
  8. checked the sd card and files were not moved
  9. config.ini did not get updated
So then i ran old 1.3 version
  • Same steps
  • and it worked
Just to confirm, i dont have to replace /romfs/ to /romfs.bin right? since i see variable was updated to cover all scenarios

Its a known issue with contextlib that I was testing. Apparently 'suppress' is completely skipping the move operations. I'm fixing it right now, should be able to push the new script with the better config.ini later today.
Also you just had to change the number at the top of the script (0 for directory, 1 for .bin, 2 for .romfs). In the new config version, you just need to change the option in config.ini under the [COMMON] section (it defaults to 'romfs'='/RomFs', just change '/RomFs/' to '/RomFs.bin'. You can also change where games are stored in the config as well now but it defaults to '/switch/games/'.)
 
Last edited by ChainedHope,
  • Like
Reactions: kevin_1351

ChainedHope

Active Member
OP
Newcomer
Joined
Dec 12, 2017
Messages
41
Trophies
0
Age
29
XP
195
Country
United States
Update is live on github. Delete your old config.ini and let it generate the new one. After that you can go in and edit it as you please.

There are three sections to the new config. COMMON, DONOR TITLES, and DONORS USED
COMMON holds paths. If you want to use a different structure for where your games are stored or what RomFS you are using, change it in here. ex for romfs.bin: romfs = /RomFs.bin
DONOR TITLES holds donor names and title ids
DONORS USED holds donor name and the game currently being used by it
If you change either of these, just make sure you have the same donor name in both sections or it might cause problems. I tried nesting the config but configparser didn't like it, so its two sections. If anyone knows how to get configparser working with nested parts without just splitting the return value, let me know.


You might notice some extra stuff in COMMON like exefs path, donor path, npdm file name... These are just precautions incase something changes with atmosphere in the future with their layeredfs implementation or a new file format is created that changes their locations. Right now you can leave these as they are.

Here is a sample config if you want to know how the generated one looks like
Code:
[COMMON]
romfs = /RomFs/
exefs = /ExeFs/
games path = /switch/games/
donor path = /atmosphere/titles/
npdm file = main.npdm

[DONOR TITLES]
the pinball arcade = 0100CD300880E000
hulu = 0100A66003384000
fortnite = 010025400AECE000
stern pinball arcade = 0100AE0006474000
octopath demo = 010096000B3EA000
pokémon quest = 01005D100807A000
pinball fx3 = 0100DB7003828000
pic-a-pix deluxe demo = 01006E30099B8000
kitten squad = 01000C900A136000
blazblue = 0100C6E00AF2C000
pixeljunk monsters 2 demo = 01004AF00A772000
paccman vs = 0100BA3003B70000
fallout shelter = 010043500A17A000

[DONORS USED]
the pinball arcade = None
hulu = None
fortnite = None
stern pinball arcade = None
octopath demo = None
pokémon quest = None
pinball fx3 = None
pic-a-pix deluxe demo = None
kitten squad = None
blazblue = None
pixeljunk monsters 2 demo = None
paccman vs = None
fallout shelter = None
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Xdqwerty @ Xdqwerty: yawn