Forum: Official Open PS2 Loader Forum - Discussion and information on the Official Open PS2 Loader.


The above video goes away if you are a member and logged in, so log in now!




 
Would you like to get all the new info from
PSX-Scene in your email each day?




Want to learn more about the team keeping you up to date with the latest scene news?

Read about them now!

Check out our Developer bios, too!

 


User Tag List

Thread: OPL load games from usb subfolder
  

Results 1 to 10 of 10
  1. #1 OPL load games from usb subfolder 
    saulogpc is offline Registered User
    Join Date
    Nov 2010
    Posts
    8
    Downloads
    0
    Uploads
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    0
    Likes Received
    0
    Hi,

    I'd like to know if it's possible to edit the source of OPL, so that it can load games from usb subfolders.

    I'm able to compile OPL by myself, so i just need some help to edit the right files.

    Tried studying "usbsuport.c" but without success.

    If anyone can help me, i'll be thankful.
    Reply With Quote  

  2. #2  
    izdubar's Avatar
    izdubar is offline Babylon User
    Join Date
    Nov 2009
    Posts
    869
    Downloads
    0
    Uploads
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    0
    Likes Received
    2
    In usbsupport.c function usbFindPartition, change the 3 "mass" path there:

    Code:
                    snprintf(path, 64, "mass%d:%s", i, name);
    		fd = fioOpen(path, O_RDONLY);
    
    		if(fd >= 0) {
    			snprintf(target, 8, "mass%d:", i);
    			fioClose(fd);
    			return 1;
    		}
    	}
    
    	// default to first partition (for themes, ...)
    	sprintf(target, "mass0:");
    To:


    Code:
                    snprintf(path, 64, "mass%d:mysubfolder/%s", i, name);
    		fd = fioOpen(path, O_RDONLY);
    
    		if(fd >= 0) {
    			snprintf(target, 8, "mass%d:mysubfolder/", i);
    			fioClose(fd);
    			return 1;
    		}
    	}
    
    	// default to first partition (for themes, ...)
    	sprintf(target, "mass0:mysubfolder/");

    EDIT: oh wait, you must change the size of char buffer too. And that may have a lot repercussions.

    In usbsupport.c

    Code:
    static char usbPrefix[8];
    Code:
    static char usbPrefix[32];
    <- any value you need, accordingly to your path size

    function usbLoadModules:

    Code:
    char path[32];
    sprintf(path, "%sTHM/", usbPrefix);
    In opl.c eventually, function tryAlternateDevice:

    Code:
    static int tryAlternateDevice(int types) {
    	char path[64];
    <- hold usbprefix content + "conf_opl.cfg"

    And a lot more function in supportbase.c/system.c, every one that use the "usbprefix" as parameter...

    Code:
    sbIsSameSize(usbPrefix, usbULSizePrev);
    sbReadList(&usbGames, usbPrefix, "/", &usbULSizePrev, &usbGameCount);
    sbDelete(&usbGames, usbPrefix, "/", usbGameCount, id);
    usbPrepareMcemu (vmc_path)
    usbGetArt
    sysCheckVMC(usbPrefix, "/", name, createSize);
    Lots of changes in fact
    Last edited by izdubar; 11-04-2010 at 06:03 AM.
    Reply With Quote  

  3. #3  
    saulogpc is offline Registered User
    Join Date
    Nov 2010
    Posts
    8
    Downloads
    0
    Uploads
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    0
    Likes Received
    0
    Hi, izdubar.
    Thank you so much, i'll make the changes when i get home.
    Reply With Quote  

  4. #4  
    saulogpc is offline Registered User
    Join Date
    Nov 2010
    Posts
    8
    Downloads
    0
    Uploads
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    0
    Likes Received
    0
    Oh man, that doesn't work yet.
    I made the changes and OPL is able to list the games in the subfolder PS2SMB of the NAS, when it's connected to the usb port. But when i start any game, it freezes on a white screen.
    Could you, please, tell more about the size of char buffer?
    Because i believe that is the point i'm making a mistake.
    As you read, the folder i want is "mass0:PS2SMB/" but i don't know which size of buffer i use. Tried 64 for every function and the result was the white screen.
    Thanks in advance.
    Reply With Quote  

  5. #5  
    izdubar's Avatar
    izdubar is offline Babylon User
    Join Date
    Nov 2009
    Posts
    869
    Downloads
    0
    Uploads
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    0
    Likes Received
    2
    Send me your code so I can quick check.

    Make a diff ("hg diff > mod.diff").

    The size of the "char buffer" should just be enough to hol your whole path string. The widest case is probably when building the VMC path, for example:

    mass0:PS2SMB/VMC/myVMCName.bin

    That thing should fit into your char buffer. 64 should be enough as VMC name and Game name are limited to 32 char. Which mean you still have 32 char for "mass0:PS2SMB/..." (... = either "THM/", "VMC/VMCName", "ART/" ...)

    But I hope you changed too the counter into the snprintf and other similar statement ? In my first post it was just a rapid explnation, but it was "incorrect". Here the good line:

    snprintf(target, 8, "mass%d:", i);

    ->

    snprintf(target, 14, "mass%d:PS2SMB/", i);


    Btw you made me find a bug into the USB device code, but it was only happening when "fragmentation check" is enabled for file parts, which is probably not for most people as it is failing somewhere else anyway
    It's too late to think that we can worship human emotions
    Because we've already evolved into machines in our minds
    Reply With Quote  

  6. #6  
    saulogpc is offline Registered User
    Join Date
    Nov 2010
    Posts
    8
    Downloads
    0
    Uploads
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    0
    Likes Received
    0
    Sorry, i don't know what "make a diff" means , so i will post the lines i edited here.
    in usbsupport.c:
    Code:
    static char usbPrefix[32];
    Code:
    int usbFindPartition(char *target, char *name) {
    	int i, fd;
    	char path[64];
    
    	for(i=0; i<5; i++) {
    		snprintf(path, 64, "mass%d:PS2SMB/%s", i, name);
    		fd = fioOpen(path, O_RDONLY);
    
    		if(fd >= 0) {
    			snprintf(target, 14, "mass%d:PS2SMB/", i);
    			fioClose(fd);
    			return 1;
    		}
    	}
    
    	// default to first partition (for themes, ...)
    	sprintf(target, "mass0:PS2SMB/");
    	return 0;
    }
    Code:
    // update Themes
    	usbFindPartition(usbPrefix, "ul.cfg");
    	char path[64];
    I didn't edit the other files, because you told me "64" is enough in my case, and this is the default i found in that files.

    The first time i edited, i used "32" in snprintf, but using "14" OPL returns me the same white screen after trying to load a game.

    I can't understand why that doesn't work, because if OPL is able to list the games, i think it's accessing the subfolder "PS2SMB".

    I also tried using a pen drive instead of the NAS, but i got the same result

    Any idea?
    Reply With Quote  

  7. #7  
    saulogpc is offline Registered User
    Join Date
    Nov 2010
    Posts
    8
    Downloads
    0
    Uploads
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    0
    Likes Received
    0
    Hey izdubar, thanks for helping me, but i think i don't have enough knowledge to get OPL to work the way i want.
    Tried different values and a short path like "P/" instead of "PS2SMB/" but i always get the same result!
    Is there any other instruction you can give me?
    Bye
    Reply With Quote  

  8. #8  
    izdubar's Avatar
    izdubar is offline Babylon User
    Join Date
    Nov 2009
    Posts
    869
    Downloads
    0
    Uploads
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    0
    Likes Received
    2
    In revision 507:

    Quote Originally Posted by izdubar
    You can now configure an USB prefix folder. This is useful for people wanting to use the same external USB device either connected on their NAS and accessed through SMB, or directly (in traveler mode) to the PS2.

    Usually NAS don't allow to share the "root" of the device, so you have to put your games into, let's say a "PS2SMB" folder.

    When using this same device in USB mode, simply enter "PS2SMB" as USB prefix and your gone.

    (The prefix is limited to 32 characters)
    EDIT: It doesn't work (except in GUi) ... I know why however and will fix it next week
    Last edited by izdubar; 12-11-2010 at 06:17 PM.
    It's too late to think that we can worship human emotions
    Because we've already evolved into machines in our minds
    Reply With Quote  

  9. #9  
    saulogpc is offline Registered User
    Join Date
    Nov 2010
    Posts
    8
    Downloads
    0
    Uploads
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    0
    Likes Received
    0
    Thank you so much izdubar.
    That's what i've been trying to do, but of course, your knowledge is much bigger than mine!

    Thaks again

    Bye
    Reply With Quote  

  10. #10  
    izdubar's Avatar
    izdubar is offline Babylon User
    Join Date
    Nov 2009
    Posts
    869
    Downloads
    0
    Uploads
    0
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Likes Given
    0
    Likes Received
    2
    It works now in revision 509.

    Please check and report me if something is wrong.
    Reply With Quote  

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •