PS3 Cobra improvement for PSX/PS2 emulation

Isn't the seeking done by the absolute time? I think the data should be fed from 3:00:00, not 2:58:00.

The file seek is done by LBA. Each record starts from LBA 13350 (first record offset 0 is read at LBA - 13350).
upload_2022-6-1_14-54-2.png


As you can see in the file capture below, the numbers marked in red are the user data that start in 2:58.00.
if (user_data)
lba_to_msf_bcd(lba, &subq->min, &subq->sec, &subq->frame);


The numbers in yellow are amin:asec:aframe:
lba_to_msf_bcd(lba + 150, &subq->amin, &subq->asec, &subq->aframe); // 150 = 2 secs (2 * 75 frames)
upload_2022-6-1_14-44-49.png


subq->control_adr = 0x41;
subq->track_number = 0x01;
subq->index_number = 0x01;

subq->crc = varies depending the LBA record. e.g. For LBA 13350 (02:58.00), the CRC is 0x0A35.

Anyway I tested displacing the records to LBA 13500 (3:00.00) and the result is the same. The red line in Sydney 2000 (Europe).
 
Ok, there was an error in the one LC sector in the file indeed. It does work great after fixing it!

As you can see there is a need to make a proper handling of the external subchannel files, as the .M3S is completely unsupported and nonexistent nowadays. Unfortunately, I am not a programmer and I cannot make any valuable contributions. I can only make suggestions which could be unreliable often from the programming perspective. Here is my point of view on it:
1. The most common RAW subcode data formats are: .SUB (non-interleaved CloneCD) and .MDF (interleaved Alcohol 120%). I understand the biggest problem would be picking the SubQ values only. As the files do contain full SubQ dump, supporting them would fix the games with GetlocP tracking issues (Tomb Raider series, Ninja: Shadow of Darkness), in addition to the Libcrypt games.
2. The most common Libcrypt specific formats are: .SBI and .LSD. The problem is they do contain only the Libcrypt sectors inside (16 or 32) and the .SBI lacks the CRC checksum, so the recalculation is additionally needed (ironically, the protection relies on corrupted checksum and the format does lack any of them).

To me, it looks like the first one is the highest priority one, as you can make a .SUB file from all the formats, but not the other way around.

I confirm I was wrong with that PSX video patch - it is certainly needed for the video mode to switch correctly. Maybe it could be polished a bit to fix some remaining issues.
 
Ok, there was an error in the one LC sector in the file indeed. It does work great after fixing it!

As you can see there is a need to make a proper handling of the external subchannel files, as the .M3S is completely unsupported and nonexistent nowadays. Unfortunately, I am not a programmer and I cannot make any valuable contributions. I can only make suggestions which could be unreliable often from the programming perspective. Here is my point of view on it:
1. The most common RAW subcode data formats are: .SUB (non-interleaved CloneCD) and .MDF (interleaved Alcohol 120%). I understand the biggest problem would be picking the SubQ values only. As the files do contain full SubQ dump, supporting them would fix the games with GetlocP tracking issues (Tomb Raider series, Ninja: Shadow of Darkness), in addition to the Libcrypt games.
2. The most common Libcrypt specific formats are: .SBI and .LSD. The problem is they do contain only the Libcrypt sectors inside (16 or 32) and the .SBI lacks the CRC checksum, so the recalculation is additionally needed (ironically, the protection relies on corrupted checksum and the format does lack any of them).

To me, it looks like the first one is the highest priority one, as you can make a .SUB file from all the formats, but not the other way around.

I confirm I was wrong with that PSX video patch - it is certainly needed for the video mode to switch correctly. Maybe it could be polished a bit to fix some remaining issues.

Do you have the fixed .m3s to test it? I changed the extension from .sch to .m3s now that you confirmed that it works.

Here is the source code and the payload for 4.88 CEX (it should work on 4.89 too).

I would need to understand the SUB/MDF formats to extract the subq->crc and subq->control_adr to be able to implement it directly in the payload. Meanwhile I don't think it would be a big problem if the converter for .sbi to .m3s is provided.

At least now it is more compatible than it was before, if the correct file is provided. It's only one additional step in the preparation of the content.
 

Attachments

The problem is there is no .m3s converter and everything has to be done manually. Here are some source codes of PSX libcrypt software:
GitHub - Dremora/psxt001z: Something from the past. Please don't judge me on this code — it's from 2005 ‍♂️
GitHub - Kippykip/SBITools: Conversion between Sony PlayStation .SBI LibCrypt files

How to make .m3s file by hand?

1. Generate a dummy .m3s file by psxt001z:
Code:
psxt001z.exe --m3s subchannel.m3s
2. Open the file in the hex editor and go to the redump site of an LC protected game.
3. Locate every MSF of the LC sector (the hex string to look for is "00 MM SS FF", for example, "00 03 09 56" is 03:09:56) and replace every single one with the corrupted one.
 

Attachments

The problem is there is no .m3s converter and everything has to be done manually. Here are some source codes of PSX libcrypt software:
GitHub - Dremora/psxt001z: Something from the past. Please don't judge me on this code — it's from 2005 ‍♂️
GitHub - Kippykip/SBITools: Conversion between Sony PlayStation .SBI LibCrypt files

How to make .m3s file by hand?

1. Generate a dummy .m3s file by psxt001z:
Code:
psxt001z.exe --m3s subchannel.m3s
2. Open the file in the hex editor and go to the redump site of an LC protected game.
3. Locate every MSF of the LC sector (the hex string to look for is "00 MM SS FF", for example, "00 03 09 56" is 03:09:56) and replace every single one with the corrupted one.

I managed to play Sydney 2000 with your instructions.

Here is a tool very easy to create the M3S file required by MAMBA.
NOTE: It is not exactly .M3S, but almost. The ignored records are 00 filled. Only the LibCrypt subchannels have data.

It doesn't require psxt001z.exe. You only go to redump.org, copy the LibCrypt text (32 lines) to a TEXT file.
Then parse the text file with LC.EXE and put the generated M3S in the same folder of the PSXISO with the same file name of the CUE/BIN.

Example. FFIX.CUE, FFIX.BIN, FFIX.M3S


I included the required Mamba payload. All the source codes is also included.

EDIT:
Tested Vagrant Story SLES-02754 and it works fine too.

EDIT2:
Removed the attachment. The payload v5 handles the LSD format. See the post below.
 
Last edited:
I think I should revert the file extension of the custom subchannel file to .sch to avoid confusion with real .m3s

I don't like none of these file extensions. So I'm open for suggestions :D
 
If you want to get close to the official sony formats with the subchannel file extension you could use .PGD
Are not exactly the same, but the struct _SubChannelQ from cobra source is pretty much the same than this table in wiki
https://github.com/Evilnat/Cobra-PS3/blob/master/8.3/4.88/NORMAL/CEX/SRC/stage2/scsi.h#L209-L224
https://www.psdevwiki.com/ps3/ISO.BIN.EDAT#Subchannel_data

The .PGD files are used by the PSOne classics, is just they doesnt have the CRC at the ending
And there is a tool made by kozarovv that can extract the PGD files from the official PSOne classics https://www.mediafire.com/file/ytg875p1a6ph89f/psxtract-2-master.zip/file
 
I decided to go with LSD format which looks to be very straightforward and according to @Agrippa it is commonly used by the scene.

I'm including the payload (with the source code) and the LSD patched from Kippykip repo

Basically needs to rename the LSD file with the same name of the CUE/BIN.

e.g. FFIX.BIN/FFIX.CUE/FFIX.LSD (the file extension can be .lsd or .LSD)

Here is an online database for LSD
https://ps3.aldostools.org/lsd.html

EDIT:
Updated the payload MAMBA-8.4_v6 to work with NET/NTFS/EXFAT/FAT32/HDD loading the LSD patch from a centralized database in /dev_hdd0/tmp/lsd. The package is included.
 

Attachments

Last edited:
hi dude! any chance for select hz and interlaced/progressive for ps1/ps2 games?

The new code in Mamba allows to select video mode (PAL/NTSC) if the PSXISO includes these words in the file name.
If it includes the word PAL it will use 720x576 @ 50hz and sets the PSX BIOS to product code 0x85 (Europe region)
If it includes the word NTSC it will use 720x480 @ 60hz and sets the PSXBIOS to product code 0x82 (debug/region free)

In regards to progressive/interlace selection, it needs to reverse VSH to find the proper memory offset to apply the patch on PSX.
For PS2, it would require to reverse 3 ps2 emulators to find the offset. That's beyond my current skills.

BTW I submitted a pull request on Evilnat's Cobra repository to include the new patches.
 
It was included in Rebug earlier, but it turned out it did affect some PS3 games breaking their fonts. At least that is how I remember.
 
Well, I am partially an idiot. It seems like the TV I have does not support 50Hz as I previously thought. It seems like it interprets the 50Hz signal as 60Hz, or it stealthily has support for it without devices thinking it does...most likely the former.

Would it be possible to patch/ignore the video mode check and allow the PAL games to boot regardless? PAL PS2 games boot through WebMAN without any issue and display just fine, and PS one Classics do as well if they are booting with upscaling turned on. I get the error thrown if upscaling is turned off.

I just want to boot Hellnight from WebMAN MOD without going into IRISMAN and without having the PS3 XMB show up when pressing the PS button. And I also do not want to create a package for the game either. The game is sick. Would something like this be possible?
 
The upscaling (and smoothing) for PS1 games can be enabled automatically because are passed as arguments to the emu, as shown in this lists https://www.psdevwiki.com/ps3/PS1_Emulation#Arguments
Im not sure under which conditions should be enabled automatically (PAL game on a PAL console ?)... but the point is cobra can do it without much hassle
Actually, as far i understand that 2 arguments passed to the emu are taken from xRegistry.sys but the arguments passed to cobra can override whatever you select in XMB settings

Btw, that list of arguments in wiki seems outdated... to me it looks there are only 2 formats, for ps1_emu (the original with 7 arguments) and the other with 9 arguments (for ps1_newemu and ps1_netemu)
In other words... ps1_netemu "inherited" the arguments from ps1_newemu
 
Well, I am partially an idiot. It seems like the TV I have does not support 50Hz as I previously thought. It seems like it interprets the 50Hz signal as 60Hz, or it stealthily has support for it without devices thinking it does...most likely the former.

Would it be possible to patch/ignore the video mode check and allow the PAL games to boot regardless? PAL PS2 games boot through WebMAN without any issue and display just fine, and PS one Classics do as well if they are booting with upscaling turned on. I get the error thrown if upscaling is turned off.

I just want to boot Hellnight from WebMAN MOD without going into IRISMAN and without having the PS3 XMB show up when pressing the PS button. And I also do not want to create a package for the game either. The game is sick. Would something like this be possible?

The new PS1 patches in MAMBA are independent of the backup manager.

Among the recent changes you can force the video mode that you want adding the word NTSC or PAL to the file name of the game. You can check if it does want you need.

I have made some pull requests to Evilnat's repository. So I hope that he includes the new bios/video patches and support for LibCrypt subchannel data in the new release of his CFW.

These new patches can be added to PS3HEN too if @esc0rtd3w wants to include them.
 
hello. but for force the various resolution/hz on ps2 games? and the cobra fan : why i need every boot the fan setup? (i use the cfw tool menu under network column firts line)
 
The proper format for every CD based PS1/PS2 game is neither iso, nor cue/bin.
Nowadays there are certains formats that support subchannel data, such as:

ccd/img/sub - format from clonecd, the best one for compatibility including burning softwares
mds/mdf - format from alcohol 120%, it could be useful but alcohol couldn't manage properly audio track pregap
chd - used for mame games, but could store proper infos for ps cd based discs
cue/bin/sbi - not a format handled by burning softwares, only by emulators, sbi only contains partial info of the subchannels
cue/bin/lsd - same as above, not even handled by emulator iirc, but lsd stores more info than sbi

The goal of the scene is imo to elect a proper format, or maybe create an own standard that supports multitrack info for audio and subchannel info for libcrypt. It could be useful to have a single file format just as we use iso single file for dvds.

There is a tool that i found in redump forums that can bypass alcohol pregap mess in building proper images.
sbitools+clonecd is also a valid method, but i repeat that could be interesting to elect a new single file image format for storing every info about ps disc based titles.
 
The proper format for every CD based PS1/PS2 game is neither iso, nor cue/bin.
Nowadays there are certains formats that support subchannel data, such as:

ccd/img/sub - format from clonecd, the best one for compatibility including burning softwares
mds/mdf - format from alcohol 120%, it could be useful but alcohol couldn't manage properly audio track pregap
chd - used for mame games, but could store proper infos for ps cd based discs
cue/bin/sbi - not a format handled by burning softwares, only by emulators, sbi only contains partial info of the subchannels
cue/bin/lsd - same as above, not even handled by emulator iirc, but lsd stores more info than sbi

The goal of the scene is imo to elect a proper format, or maybe create an own standard that supports multitrack info for audio and subchannel info for libcrypt. It could be useful to have a single file format just as we use iso single file for dvds.

There is a tool that i found in redump forums that can bypass alcohol pregap mess in building proper images.
sbitools+clonecd is also a valid method, but i repeat that could be interesting to elect a new single file image format for storing every info about ps disc based titles.

for my opinion best one is the trimmed iso 1:1 iso is a waste of space. offcourse best compatibility and sound multitrack support is the best choice. for ps3 we need a format better compatible with the hd (it is ext3?) after for external backup we have ntfs support (+4gb). fat32 32k? idk what is the best combo for reading speed, save space ecc
 

Similar threads

Back
Top