[PS2] POPS stuff & POPStarter

Discussion in 'Sony Programming and Development' started by krHACKen, Apr 9, 2013.

  1. ps2netbox

    ps2netbox Spirited Member

    Joined:
    Dec 26, 2017
    Messages:
    116
    Likes Received:
    93
    dekkit likes this.
  2. ps2netbox

    ps2netbox Spirited Member

    Joined:
    Dec 26, 2017
    Messages:
    116
    Likes Received:
    93
    It is a bit complex .
    I put all source code of usbhdfsd.irx and code of my custom ps2atad.irx, dev9.c to one irx to get my usbhdfsd.irx and put it to mc0:/POPSTARTER/usbhdfsd.irx. Since I do not talk to real usb . usbd.irx is a dummy irx.

    After Popstarter launched POPS , it failed to OSD .
    So I guess if the size of usbhdfsd.irx is too big ( 170KB) . Then I write a compressed IRX loader。
    This is the final thing in mc0:/POPSTARTER/
    1) usbd.irx dummy irx, call RegisterLibEntry with retonly export-functions.
    2) usbhdfsd.irx which is a compressed irx loader . It read fake.irx , decompress it , call LoadModuleBuffer, and
    StartModule. Source code is attached as mload.rar.
    May be you need this or this simple idea , so OPL will need less memory to put in-game irx(*_cdvdman.irx) in kernel space for better game compatibility.
    3) fake.irx This is not a real irx ,but LZO compressedx IRX.

    All of them works fine. But get same result as uncompressed version.

    Yes , Pops open SLOT?.VMC with mode==3(O_WRONLY|O_RDONLY).
     

    Attached Files:

    AlGollan84 and UniqueUserName like this.
  3. wisi

    wisi Rising Member

    Joined:
    Apr 16, 2016
    Messages:
    53
    Likes Received:
    75
    Do the modules work correctly outside POPStarter? For example in with a test-program?
    In the log from pcsx2, the only file descriptor returned is 2, which means that each file was closed before opening the next. Is that what POPStarter did?
    Does POPS rely on game images being non-fragmented?
    Is write-support known to be working correctly - if a file was created with broken driver it might have damaged some of the contents of other files.
     
  4. sp193

    sp193 Site Soldier

    Joined:
    Mar 28, 2012
    Messages:
    2,217
    Likes Received:
    1,052
    Thank you for your explanation. One thing you may want to note is that AllocSysMemory and FreeSysMemory are critical regions, so you need to suspend interrupts before invoking these functions:
    Code:
    int OldState;
    
    CpuSuspendIntr(&OldState);
    ptr = AllocSysMemory(ALLOC_FIRST, size, NULL);
    CpuResumeIntr(OldState);
    
    Without doing this, it may be possible for the heap to be corrupted if another thread/interrupt handler accesses these functions.

    Since you don't need USBD.IRX, I think it should be fine to not even register an export table. As our homebrew SDK requires us to manually generate the import table (imports.lst), your fake usbhdfsd module should not import functions from usbd, if you do this.
    Originally, POPS was an emulator that ran from the HDD unit, so it had no support for USB anyway...

    If/when you complete this system, please remember to free the pIrx buffer because it is unneeded after you call LoadModuleBuffer. Your mload module can also return NOT RESIDENT at the end, so you can save on IOP RAM.

    Have you confirmed if all your modules (custom dev9, atad and hdd) do boot, from within your custom usbhdfsd module? If POPS is unable to access the game image file(s), then it will not work.

    @kHn: does POPS make infinite retries, if it cannot access the disc images? Or does it exit immediately, upon failing to access the files? If it does not, then this may be the source of the problem, if the interface takes a while to initialize (and if it happens outside of the loading of usbhdfsd).

    Thanks!

    OPL no longer has a problem with EE memory usage because only the necessary modules are stored in RAM. OPL no longer uses kernel memory either, since the kernel memory is usually used by Sony kernel patches and/or modchips. I managed to reduce its memory usage by manipulating the IOP boot sequence.
    IOP RAM is also saved for SMB by discarding the connection-initializing code after the connection is made (module returns NOT RESIDENT).
    If there are games that use the memory that OPL uses, they were deliberately made to block HDLoader from working. And those games (i.e. Virtua Quest, Sonic Unleashed) are hard to deal with, other than relocating the address of OPL.
     
    Last edited: Dec 28, 2017
    Armorant, kHn, AlGollan84 and 2 others like this.
  5. UniqueUserName

    UniqueUserName Trial and Error Professional

    Joined:
    Sep 16, 2016
    Messages:
    15
    Likes Received:
    31
    @ps2netbox

    Your work has attracted the attention of @Jolek (whom seems to very much approve) at psx-scene already:
    http://psx-scene.com/forums/f98/ps2usb-network-adapter-3xxxx-5xxxx-ps2-157652/#post1216332

    And it seems our very own @AlGollan84 has offered assistance with testing and creating compatibility sheets in Google Docs (these are his specialty for sure, and he does great work = see my signature for links of his).
    Same thread as linked above.

    I have submitted your work as news to psx-place as well, so you should have as much coverage as we can provide (these news-writers, also write news on several other of the largest homebrew sites). :)

    May I make a suggestion (after seeing your front-end GUI) ?
    Take a look at the files I modified a bit, for OPL, to the display setup and configuration.

    They were altered for better space management, for higher-resolution cover-art (which can be displayed much larger if you wish, or not at all, as well = Half-Screen-Covers/Half-Screen-Gamelist), and I also uploaded more than 1,000 high-res PS2-game-covers, all in one zip, that you may find interesting.

    Uploaded for the community as a teaser, from a project which I have yet to finish.
    The high-res PS1-game-covers Im currently working on are nearly completed (which may compliment your work discussed in this thread nicely). ;)

    Please let me know if any of my work would be welcome in your project ?
    As it is currently not-included within, nor owned by OPL development, or any other projects.
    Id like to take a look at your frontend config/display files as well, if you dont mind me submitting some ideas (maybe a little eye-candy-wizardry) to you.

    LINKS:
    http://www.psx-place.com/resources/opl-theme-theme-ucit-aka-split-screen-by-uniqueusername.376/
    http://www.psx-place.com/resources/...2-0-project-max-resolution-for-opl-0-9-3.596/

    Good luck with this most interesting development !
    I hope it is a success for sure.

    -Uni
     
    ps2netbox, pool7, kHn and 2 others like this.
  6. kHn

    kHn Rising Member

    Joined:
    Oct 11, 2017
    Messages:
    56
    Likes Received:
    189
    No retries, no loops. If the disc image cannot be opened, POPS printf two errors, terminates everything and invokes the exit syscall (kicks to the OSD immediately).
    I've removed my USB flash drive before POPS was executed, too see what it does when the file cannot be accessed. Also dumped the RAM with all the patches from POPStarter applied to POPS, to inspect the functions.

    @ps2netbox , please put this PATCH_0.BIN file in your POPS folder, then try to run the game in your PS2 console, with your custom hardware.
    If POPS freezes (permanent black screen) instead of exiting to the OSD, it's the confirmation that POPS fails to open the VCD file.
    And if it does not freeze (still quits to OSD), then the source of the problem is something else...

    Also, if you don't have an EE SIO debugging terminal, you can catch the printf output texts from the buffer at 0x80865950 while POPS is running.

    I'm off now, don't wanna touch POPStarter/POPS anymore.
     
  7. ps2netbox

    ps2netbox Spirited Member

    Joined:
    Dec 26, 2017
    Messages:
    116
    Likes Received:
    93
    Sorry for a long time to reply , I just come back from holiday.
    Before I wrote that code ,I searched ps2sdk with AllocSysMemory, some of them with CpuSuspendIntr ,some of them not . So I just chose the simple one.

    I free the memory at end of main :
    Code:
    clean:
    
        if(fd>0)   
            close(fd);
        if(pIrx)
            FreeSysMemory(pIrx);
        if(p)
            FreeSysMemory(p);
        return ret;
    }
    
    
    "return MODULE_RESIDENT_END " ,because I do not know whether popstarter will check return value .


    @kHn
    I have an EE serial terminal , and will try it tomorrow.

    Sine It woked in pcsx2 emulator, I think the main flow should be ok .
    Thank you !
     
    AlGollan84 likes this.
  8. ps2netbox

    ps2netbox Spirited Member

    Joined:
    Dec 26, 2017
    Messages:
    116
    Likes Received:
    93
    @kHn
    POPS freezes, but does not print any thing ...
     
    Last edited: Jan 2, 2018
    kHn likes this.
  9. sp193

    sp193 Site Soldier

    Joined:
    Mar 28, 2012
    Messages:
    2,217
    Likes Received:
    1,052
    Okay, so this means that POPS failed to open the VCD.

    Things you may want to check:
    • Do all your modules load successfully?
    • Do you create other threads to perform initialization?
    • Given that POPS was made to support the HDD and may still load dev9.irx, have you tried without loading your own dev9.irx?

    From the other thread:
    POPS was originally made to support the HDD unit. So to get it to work with USB, they had to redirect I/O.

    Welcome back! :D

    If you have not gotten a copy of the Sony PS2SDK documentation, you may want to. Even if it is not actually legal to distribute (copyrighted), the documentation there is the best.

    Our homebrew software may not have been always written in strict compliance with the Sony specifications.

    Ah okay, I must have missed it. Thanks.

    I understand. But when you are done, you can try because errors codes are negative and a successful load (regardless of what sort of success) will always cause a module ID (positive value) to be returned. So it should not be deemed as an error, unless POPStarter checks the module return value for RESIDENT END (which I think is unlikely).
     
  10. kHn

    kHn Rising Member

    Joined:
    Oct 11, 2017
    Messages:
    56
    Likes Received:
    189
    Yes, the freeze confirms that it fails to open the VCD file.


    In USB mode, none of the DEV9/HDD/PFS/ATAD modules are loaded. POPStarter simply patches POPS to skip the loading of these.

    IIRC, POPStarter resets the IOP with the IOPRP IMG of POPS, loads SIO2MAN (the one which is embedded in the POPS ELF), loads USBD from MC, loads USBHDFSD from MC, loads the PFS wrapper, marks a timed delay, and executes POPS.
    Optionally, POPStarter can load extra modules (named as MODULE_#.IRX), after SIO2MAN is loaded I think. And if one of the extra module is a SIO2MAN IRX, it is loaded instead of the one which is embedded in POPS.


    Another thing you may want to try : replace POPS_IOX.PAK with POPS.PAK (and remove POPS_IOX.PAK from your POPS folder).
    I cannot remember what I did to the IOPRP IMG of that POPS_IOX.PAK. All I know is that the patches it contains were wanted, at the time I've implemented the SMB mode. Maybe the said patches have side effects on your work. I... really have no idea of what the hax are.
    POPS.PAK has the original IOPRP IMG inside.

    Also, maybe try $USBDELAY_5 in CHEATS.TXT.
     
  11. ps2netbox

    ps2netbox Spirited Member

    Joined:
    Dec 26, 2017
    Messages:
    116
    Likes Received:
    93
    @sp193, @kHn,
    Now things get clear .
    Popstarter failed to load my custom IRX after pops started. But I dont know why , even if I put them on mass ( as MODULE_0.IRX).
    Let me try other method tomorrow .

    My hardware has a debug function , Writing to register spd_regbase+0x02 will be captued by logic analyzer .
    DEV9 or something is disabled by popstarter / POPS , so I must re init dev9 again before something like。
    Code:
       SPD_REG(2)='A’
    
    I will try to log to mc card tomorrow before init dev9.

    Thank you again !
     
    uyjulian, kHn and AlGollan84 like this.
  12. sp193

    sp193 Site Soldier

    Joined:
    Mar 28, 2012
    Messages:
    2,217
    Likes Received:
    1,052
    If you can get the return value, then it will be easier to know why. I guess, it may be a dependency problem.

    @kHn wrote that POPStarter will patch POPS to disable the loading of any DEV9 modules, when the USB version is used.

    The PlayStation 2 has no support for DEV9 by default, so you must load dev9.irx if you need to use it. Since POPS will no longer load dev9.irx for you, you have to do it (which was what you did, so please continue).
     
    pool7, AlGollan84 and kHn like this.
  13. kHn

    kHn Rising Member

    Joined:
    Oct 11, 2017
    Messages:
    56
    Likes Received:
    189
    POPStarter just cares about what's returned by SifExecModuleBuffer. Any positive value is deemed as a "valid" module ID. POPStarter prints the returned value on screen. When it's negative, it's treaten as fatal error and it quits to OSD after a few seconds. Values returned by modules are ignored.

    @ps2netbox ,
    If you load a module from another module, you must either check the LoadModuleBuffer function return value, or the module return value from StartModule. In the case of missing dependencies, LoadModuleBuffer would return -200 I think. But the problem is that POPStarter cannot handle the error that way, since it ignores what your IRX loader returns. So you may have to monitor things with printf/terminal.
     
    pool7, sp193 and AlGollan84 like this.
  14. ps2netbox

    ps2netbox Spirited Member

    Joined:
    Dec 26, 2017
    Messages:
    116
    Likes Received:
    93
    When POPStarter load usbd and usbhdfsd , mcman and mcserv are not loaded , So mload (usbhdfsd.irx) failed to load fakeusb.irx ...
     
    AlGollan84 and kHn like this.
  15. kHn

    kHn Rising Member

    Joined:
    Oct 11, 2017
    Messages:
    56
    Likes Received:
    189
    Oh, I see now :) .
    Of course, POPS has no mcman/mcserv modules.
    A long time ago, I've tried to load my own mem card modules and gain access to the PS2 memory card contents. It was for making a DVD compilation version of POPStarter and saving the VMC to a PS2 memory card. And for the life of me, I could not get this to work. All the IO functions returned errors.

    Good luck with the card access implementation under POPS, I hope this will work.
    Seriously I never found out why it didn't work on my side. Makes no sense.
     
    AlGollan84 likes this.
  16. ps2netbox

    ps2netbox Spirited Member

    Joined:
    Dec 26, 2017
    Messages:
    116
    Likes Received:
    93
    @sp193, @kHn,
    After embed the compressed irx in mload instead of loading from memory card . It woks!!!!!!
    Thank you very much !!!!

    Can you make a small popstarter change for me , 1) Just load usbd.irx usbhdfsd.ixr from memory instead of from mc0
    ( I can write my irxes to memory before start popstarter) Or 2) A tool to patch popstarter's embeded usbd and usbhdfsd ?

    It is not a big problem ,since my irx only need 100k memory card space ;) ,but if you can change this , it will be more clean.
     
    AlGollan84 likes this.
  17. sp193

    sp193 Site Soldier

    Joined:
    Mar 28, 2012
    Messages:
    2,217
    Likes Received:
    1,052
    But isn't this a better solution? Only 2 files will be required and the user can use a normal version of POPStarter (hence it can be replaced).
     
  18. ps2netbox

    ps2netbox Spirited Member

    Joined:
    Dec 26, 2017
    Messages:
    116
    Likes Received:
    93
    No .
    1) User need a memory card.
    2) Since I support exfat at ee side. (Faked) usbd/usbhsfsd must contain per-game config information.
    So every time OPL launch popstarter ,usbd/usbhsfd must be regenerated /patched .
    User can not simple use these files by copy.

    Now It seems not bad , so I will make it more user friendly .
    ( Drop VCD to usb hdd , game lists will be auto-updated , select and play.)
     
    AlGollan84 likes this.
  19. kHn

    kHn Rising Member

    Joined:
    Oct 11, 2017
    Messages:
    56
    Likes Received:
    189
    OK, I will try to implement that as soon as possible.
    Cannot try for now, because of an unpleasant christmas gift from Avast.
     
    L2000, AlGollan84 and ps2netbox like this.
  20. ps2netbox

    ps2netbox Spirited Member

    Joined:
    Dec 26, 2017
    Messages:
    116
    Likes Received:
    93
sonicdude10
Draft saved Draft deleted
Insert every image as a...
  1.  0%

Share This Page