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).
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.
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.
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.
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.
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!
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).
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.
@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.
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).
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.
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.
@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.
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.)