PCSX2 / pcsx2

PCSX2 - The Playstation 2 Emulator
https://pcsx2.net
GNU General Public License v3.0
11.81k stars 1.63k forks source link

[BUG]: Memory Card Folder wonkiness. #11537

Open Mike3137 opened 4 months ago

Mike3137 commented 4 months ago

Describe the Bug

Update: Just scroll down to my last comment for TLDR.

PCSX2 currently does not take into account at all that PS2 uses UTC+9 timestamps. (Well actually it seems to be +9 from whatever the bios time is set to. PCSX2 seems to default bios to UTC time which is sensible.) This results in the Unix time in the index files is 9 hours into the future, it is converted back again though so it is displayed correctly in bios. However it results in some strange timestamps when converting back and forth between file and folder type. Also note that converting Folder MC -> File MC reverses the file order and rootdir timestamps are set to all zero bytes. Check my log below for more details.

Reproduction Steps

  1. Check current unix time.
  2. Create memory card folder.
  3. Copy a save to it.
  4. Compare the unix time you noted and the unix time in the index file. Also convert back and forth and notice the file order reversing.

Expected Behavior

PS2 timestamps should be interpreted correctly and stored as an accurate Unix time, and converted back again to ps2 format correctly.

In my own program i simply do something like this:

void unix_to_jst(const time_t unixtime, struct tm *jst) {
    memset(jst, 0, sizeof(struct tm));
    const time_t adjusted_time = unixtime + 9 * 3600;
    gmtime_r(&adjusted_time, jst);
}

time_t jst_to_unix(struct tm *jst) {
    return timegm(jst) - 9 * 3600;
}

What about DST you may ask. Neither UTC nor JST (UTC+9) uses DST, they're always 9 hours apart. Once it has been converted to unix time you can do what you want with it, display it as UTC or local time or whatever. I noticed the code once had something similar to this, but I think it maybe only converted forward, not back again.

PCSX2 Revision

v1.7.5976

Operating System

Linux (64bit) - Specify distro below

If Linux - Specify Distro

Arch

Logs & Dumps

Output from my own program below. File MC timestamps are interpreted as UTC+9 (since that is how PS2 stores them) and displayed as UTC. (Meaning simply -9 hours from raw card date) Folder MC timestamps simply converts the unix time from the index file to UTC. pcsx2 stores the unix time in index files as +9 hours into the future for some reason. (Interprets the PS2 date (UTC+9) as if it was UTC). It is converted back correctly when read so it displays correctly in bios anyway. Actual Unix time around the same time (after) as tests: 1720773629

Sample regular memory card file (everything is correct):

perm attr  created      modified        path
drwx e---- 2024-07-12 08:38:56  2024-07-12 08:39:06 /. (1 items, 2 KiB allocated)
drwx e---- 2024-07-12 08:39:06  2024-07-12 08:39:08     /BASLUS-21075HG (3 items, 3 KiB allocated)
-rwx e---- 2024-07-12 08:39:06  2024-07-12 08:39:07         /BASLUS-21075HG (77168 bytes, 76 KiB allocated)
-rwx e---- 2024-07-12 08:39:07  2024-07-12 08:39:07         /icon00.ico (118616 bytes, 116 KiB allocated)
-rwx e---- 2024-07-12 08:39:08  2024-07-12 08:39:08         /icon.sys (964 bytes, 1 KiB allocated)

Memory card folder: All of the unix times stored in index files are +9 hours into the future.

$ROOT:
  timeCreated: 1720805900
  timeModified: 1720805902
'BASLUS-21075HG\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00':
  order: 1
  timeCreated: 1720805900
  timeModified: 1720805901
icon00.ico\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00:
  order: 2
  timeCreated: 1720805901
  timeModified: 1720805902
icon.sys\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00:
  order: 3
  timeCreated: 1720805902
  timeModified: 1720805902

Ignore rootdir timestamps for Folders MC, they're generated by my program at runtime. Timestamps on Folder MC are 9 hours into the future because of the unix time stored by pcsx2 in index files.

perm attr  created      modified        path
drwx e---- 2024-07-12 09:26:05  2024-07-12 09:26:05 /. (1 items, 2 KiB allocated) 
drwx e---- 2024-07-12 17:38:20  2024-07-12 17:38:22     /BASLUS-21075HG (3 items, 3 KiB allocated) 
-rwx e---- 2024-07-12 17:38:20  2024-07-12 17:38:21         /BASLUS-21075HG (77168 bytes, 76 KiB allocated)
-rwx e---- 2024-07-12 17:38:21  2024-07-12 17:38:22         /icon00.ico (118616 bytes, 116 KiB allocated)
-rwx e---- 2024-07-12 17:38:22  2024-07-12 17:38:22         /icon.sys (964 bytes, 1 KiB allocated)

converted to file: PCSX2 sets rootdir timestamps to all zero bytes when converting FolderMC -> File MC, displayed as 1899-12-30 15:00:00 here, why not simply generate a rootdir time from current time instead? On conversion to File MC, save dirs gets -9 hours from the unix time which results in the correct time again. Files gets -9 hours from the accurate date though. (-18 from the unix time stored) Note that the file order has been reversed. Also every time it is converted to file some extra time is added to file timestamps, 2-3 seconds here. (Don't know what's going on maybe it's based on current time when converted or something)

perm attr  created      modified        path
drwx e---- 1899-12-30 15:00:00  1899-12-30 15:00:00 /. (1 items, 2 KiB allocated) 
drwx e---- 2024-07-12 08:38:20  2024-07-12 08:38:22     /BASLUS-21075HG (3 items, 3 KiB allocated) 
-rwx e---- 2024-07-11 23:38:24  2024-07-11 23:38:24         /icon.sys (964 bytes, 1 KiB allocated) 
-rwx e---- 2024-07-11 23:38:24  2024-07-11 23:38:24         /icon00.ico (118616 bytes, 116 KiB allocated)
-rwx e---- 2024-07-11 23:38:24  2024-07-11 23:38:24         /BASLUS-21075HG (77168 bytes, 76 KiB allocated)

converted back to folder:

$ROOT:
  timeCreated: 1720805900
  timeModified: 1720805902
icon.sys\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00:
  order: 1
  timeCreated: 1720773504
  timeModified: 1720773504
icon00.ico\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00:
  order: 2
  timeCreated: 1720773504
  timeModified: 1720773504
'BASLUS-21075HG\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00':
  order: 3
  timeCreated: 1720773504
  timeModified: 1720773504

Ignore rootdir timestamps for Folders MC, they're generated by my program at runtime.

perm attr  created      modified        path
drwx e---- 2024-07-12 09:26:23  2024-07-12 09:26:23 /. (1 items, 2 KiB allocated) 
drwx e---- 2024-07-12 17:38:20  2024-07-12 17:38:22     /BASLUS-21075HG (3 items, 3 KiB allocated)
-rwx e---- 2024-07-12 08:38:24  2024-07-12 08:38:24         /icon.sys (964 bytes, 1 KiB allocated)
-rwx e---- 2024-07-12 08:38:24  2024-07-12 08:38:24         /icon00.ico (118616 bytes, 116 KiB allocated)
-rwx e---- 2024-07-12 08:38:24  2024-07-12 08:38:24         /BASLUS-21075HG (77168 bytes, 76 KiB allocated)

converted back to file again: 67 extra seconds added to file timestamps for some reason. (Maybe has to do with when it was converted or something.)

perm attr  created      modified        path
drwx e---- 1899-12-30 15:00:00  1899-12-30 15:00:00 /. (1 items, 2 KiB allocated) 
drwx e---- 2024-07-12 08:38:20  2024-07-12 08:38:22     /BASLUS-21075HG (3 items, 3 KiB allocated)
-rwx e---- 2024-07-11 23:39:33  2024-07-11 23:39:33         /BASLUS-21075HG (77168 bytes, 76 KiB allocated)
-rwx e---- 2024-07-11 23:39:33  2024-07-11 23:39:33         /icon00.ico (118616 bytes, 116 KiB allocated)
-rwx e---- 2024-07-11 23:39:33  2024-07-11 23:39:33         /icon.sys (964 bytes, 1 KiB allocated)

converted back to folder again:

$ROOT:
  timeCreated: 1720805900
  timeModified: 1720805902
'BASLUS-21075HG\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00':
  order: 1
  timeCreated: 1720773573
  timeModified: 1720773573
icon00.ico\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00:
  order: 2
  timeCreated: 1720773573
  timeModified: 1720773573
icon.sys\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00:
  order: 3
  timeCreated: 1720773573
  timeModified: 1720773573
perm attr  created      modified        path
drwx e---- 2024-07-12 09:28:23  2024-07-12 09:28:23 /. (1 items, 2 KiB allocated)
drwx e---- 2024-07-12 17:38:20  2024-07-12 17:38:22     /BASLUS-21075HG (3 items, 3 KiB allocated)
-rwx e---- 2024-07-12 08:39:33  2024-07-12 08:39:33         /BASLUS-21075HG (77168 bytes, 76 KiB allocated)
-rwx e---- 2024-07-12 08:39:33  2024-07-12 08:39:33         /icon00.ico (118616 bytes, 116 KiB allocated)
-rwx e---- 2024-07-12 08:39:33  2024-07-12 08:39:33         /icon.sys (964 bytes, 1 KiB allocated)
RedPanda4552 commented 4 months ago

Memory cards store timestamps in the directory entries as JST, that is simply a design quirk of the system and is accounted for by the running game or the BIOS. We in turn copy those raw timestamps from the directory entries into the index files. That is accurate and we are not going to change that, it makes no sense to add more timezone conversions when they are unnecessary.

Converting a folder back to a file and losing all timestamps is an interesting problem though. The conversion process should simply issue sequential reads across the entire card, which suggests something is wrong with how folder cards are assembling their virtual FAT. That has potential to be a clue to some other issues they have been having as well where it seems problems are coming from the ephemeral nature of the FAT on folder memcards.

Mike3137 commented 4 months ago

I see, it is not intended to be a real Unix time, will change my own program accordingly to interpret them as Unix time + 9 hours.

Also note that the file order is reversed when converting to file which defeats the purpose of storing that information in the first place.

Mike3137 commented 4 months ago

New results from the same files when taking into account that index files do not have actual unix time. Also getting rootdir times for Folder MCs by checking the superblock files timestamps now, makes it look right.

Sample File MC:

perm attr  created      modified        path
drwx e---- 2024-07-12 08:38:56  2024-07-12 08:39:06 /. (1 items, 2 KiB allocated)
drwx e---- 2024-07-12 08:39:06  2024-07-12 08:39:08     /BASLUS-21075HG (3 items, 3 KiB allocated)
-rwx e---- 2024-07-12 08:39:06  2024-07-12 08:39:07         /BASLUS-21075HG (77168 bytes, 76 KiB allocated)
-rwx e---- 2024-07-12 08:39:07  2024-07-12 08:39:07         /icon00.ico (118616 bytes, 116 KiB allocated)
-rwx e---- 2024-07-12 08:39:08  2024-07-12 08:39:08         /icon.sys (964 bytes, 1 KiB allocated)

Folder MC:

perm attr  created      modified        path
drwx e---- 2024-07-12 08:38:13  2024-07-12 08:38:13 /. (1 items, 2 KiB allocated)
drwx e---- 2024-07-12 08:38:20  2024-07-12 08:38:22     /BASLUS-21075HG (3 items, 3 KiB allocated)
-rwx e---- 2024-07-12 08:38:20  2024-07-12 08:38:21         /BASLUS-21075HG (77168 bytes, 76 KiB allocated)
-rwx e---- 2024-07-12 08:38:21  2024-07-12 08:38:22         /icon00.ico (118616 bytes, 116 KiB allocated)
-rwx e---- 2024-07-12 08:38:22  2024-07-12 08:38:22         /icon.sys (964 bytes, 1 KiB allocated)

Converted to file: Converting to file pcsx2 sets rootdir timestamps to all zero bytes.

perm attr  created      modified        path
drwx e---- 1899-12-30 15:00:00  1899-12-30 15:00:00 /. (1 items, 2 KiB allocated)
drwx e---- 2024-07-12 08:38:20  2024-07-12 08:38:22     /BASLUS-21075HG (3 items, 3 KiB allocated)
-rwx e---- 2024-07-11 23:38:24  2024-07-11 23:38:24         /icon.sys (964 bytes, 1 KiB allocated)
-rwx e---- 2024-07-11 23:38:24  2024-07-11 23:38:24         /icon00.ico (118616 bytes, 116 KiB allocated)
-rwx e---- 2024-07-11 23:38:24  2024-07-11 23:38:24         /BASLUS-21075HG (77168 bytes, 76 KiB allocated)

Converted back to folder:

perm attr  created      modified        path
drwx e---- 2024-07-12 08:39:33  2024-07-12 08:39:33 /. (1 items, 2 KiB allocated)
drwx e---- 2024-07-12 08:38:20  2024-07-12 08:38:22     /BASLUS-21075HG (3 items, 3 KiB allocated)
-rwx e---- 2024-07-11 23:38:24  2024-07-11 23:38:24         /icon.sys (964 bytes, 1 KiB allocated)
-rwx e---- 2024-07-11 23:38:24  2024-07-11 23:38:24         /icon00.ico (118616 bytes, 116 KiB allocated)
-rwx e---- 2024-07-11 23:38:24  2024-07-11 23:38:24         /BASLUS-21075HG (77168 bytes, 76 KiB allocated)

Converted back to file again: Converting to file pcsx2 sets rootdir timestamps to all zero bytes.

perm attr  created      modified        path
drwx e---- 1899-12-30 15:00:00  1899-12-30 15:00:00 /. (1 items, 2 KiB allocated)
drwx e---- 2024-07-12 08:38:20  2024-07-12 08:38:22     /BASLUS-21075HG (3 items, 3 KiB allocated)
-rwx e---- 2024-07-11 23:39:33  2024-07-11 23:39:33         /BASLUS-21075HG (77168 bytes, 76 KiB allocated)
-rwx e---- 2024-07-11 23:39:33  2024-07-11 23:39:33         /icon00.ico (118616 bytes, 116 KiB allocated)
-rwx e---- 2024-07-11 23:39:33  2024-07-11 23:39:33         /icon.sys (964 bytes, 1 KiB allocated)

Converted back to folder again:

perm attr  created      modified        path
drwx e---- 2024-07-12 08:39:40  2024-07-12 08:39:40 /. (1 items, 2 KiB allocated)
drwx e---- 2024-07-12 08:38:20  2024-07-12 08:38:22     /BASLUS-21075HG (3 items, 3 KiB allocated)
-rwx e---- 2024-07-11 23:39:33  2024-07-11 23:39:33         /BASLUS-21075HG (77168 bytes, 76 KiB allocated)
-rwx e---- 2024-07-11 23:39:33  2024-07-11 23:39:33         /icon00.ico (118616 bytes, 116 KiB allocated)
-rwx e---- 2024-07-11 23:39:33  2024-07-11 23:39:33         /icon.sys (964 bytes, 1 KiB allocated)
Mike3137 commented 3 months ago

Noticed that pcsx2 folder -> file convert actually changes the date of all file entries to (9 hours before) when the folder MC was created or modified. The file times are all based on when the folder MC was created.

Test folder I convert from:

PCSX2 convert to file result:

Original file MC, only touched by bios/games, for comparison:

perm attr    created        modified        path
drwx e--------4- 2016-10-23 12:04:56    2023-06-10 14:52:51 /. (12 items, 7 KiB allocated)
drwx e--------4- 2017-03-23 16:08:36    2017-03-23 16:17:12     /BASLUS-21326-SHF-000 (3 items, 3 KiB allocated)
-rwx e------8-4- 2017-03-23 16:08:36    2017-03-23 16:08:37         /SHF.ICO (46144 bytes, 46 KiB allocated)
-rwx e------8-4- 2017-03-23 16:17:12    2017-03-23 16:17:12         /BASLUS-21326-SHF-000 (16720 bytes, 17 KiB allocated)
-rwx e------8-4- 2017-03-23 16:17:12    2017-03-23 16:17:12         /icon.sys (964 bytes, 1 KiB allocated)
drwx e--------4- 2017-02-15 15:08:21    2017-03-21 22:40:43     /BESLES-82030-SH2 (4 items, 3 KiB allocated)
-rwx e------8-4- 2017-03-21 22:40:43    2017-03-21 22:40:43         /BESLES-82030-SH2 (1728 bytes, 2 KiB allocated)
-rwx e------8-4- 2017-03-21 22:40:42    2017-03-21 22:40:42         /SH2.ICO (39424 bytes, 39 KiB allocated)
-rwx e------8-4- 2017-02-15 15:08:22    2017-02-15 15:08:22         /icon.sys (964 bytes, 1 KiB allocated)
-rwx e------8-4- 2017-03-21 22:40:43    2017-03-21 22:40:43         /SH2-000 (12332 bytes, 13 KiB allocated)
drwx e--------4- 2017-03-08 20:53:09    2017-03-08 20:53:11     /BESLES-50677-SH1-00 (3 items, 3 KiB allocated)
-rwx e------8-4- 2017-03-08 20:53:09    2017-03-08 20:53:10         /TALIS.ICO (73840 bytes, 73 KiB allocated)
-rwx e------8-4- 2017-03-08 20:53:10    2017-03-08 20:53:10         /BESLES-50677-SH1-00 (8192 bytes, 8 KiB allocated)
-rwx e------8-4- 2017-03-08 20:53:10    2017-03-08 20:53:11         /icon.sys (964 bytes, 1 KiB allocated)
drwx e--------4- 2017-03-08 20:53:17    2017-03-08 20:53:19     /BESLES-50677-SH1-01 (3 items, 3 KiB allocated)
-rwx e------8-4- 2017-03-08 20:53:18    2017-03-08 20:53:18         /TALIS.ICO (73840 bytes, 73 KiB allocated)
-rwx e------8-4- 2017-03-08 20:53:18    2017-03-08 20:53:19         /BESLES-50677-SH1-01 (8192 bytes, 8 KiB allocated)
-rwx e------8-4- 2017-03-08 20:53:19    2017-03-08 20:53:19         /icon.sys (964 bytes, 1 KiB allocated)
drwx e--------4- 2017-03-23 16:41:57    2017-07-30 22:24:36     /BESLES-52322 (4 items, 3 KiB allocated)
-rwx e------8-4- 2017-03-23 16:41:57    2017-03-23 16:41:57         /dradra.ico (33112 bytes, 33 KiB allocated)
-rwx e------8-4- 2017-03-23 16:41:58    2017-03-23 16:41:58         /icon.sys (964 bytes, 1 KiB allocated)
-rwx e------8-4- 2017-03-23 16:41:58    2017-07-30 16:24:46         /BESLES-52322 (128 bytes, 1 KiB allocated)
-rwx e------8-4- 2017-03-23 16:58:27    2017-07-30 22:24:36         /gamefile (1296 bytes, 2 KiB allocated)
drwx e--------4- 2017-08-05 18:50:26    2017-10-19 14:54:39     /BESLES-53794 (6 items, 4 KiB allocated)
-rwx e------8-4- 2017-08-05 18:50:26    2017-08-05 18:50:27         /dradra2.ico (33112 bytes, 33 KiB allocated)
-rwx e------8-4- 2017-08-05 18:50:27    2017-08-05 18:50:28         /icon.sys (964 bytes, 1 KiB allocated)
-rwx e------8-4- 2017-08-05 18:50:28    2017-08-05 19:59:40         /BESLES-53794 (1024 bytes, 1 KiB allocated)
-rwx e------8-4- 2017-08-05 18:50:29    2017-08-05 18:50:29         /gfile02 (3072 bytes, 3 KiB allocated)
-rwx e------8-4- 2017-08-05 18:50:29    2017-08-05 18:50:30         /gfile03 (3072 bytes, 3 KiB allocated)
-rwx e------8-4- 2017-08-05 18:50:30    2017-10-19 14:54:39         /gfile01 (3072 bytes, 3 KiB allocated)
drwx e-h-------- 2017-08-07 10:52:02    2017-08-07 10:52:02     /BIDATA-SYSTEM (2 items, 2 KiB allocated)
-rwx e------8-4- 2017-08-07 10:52:02    2017-08-07 10:52:02         /history (462 bytes, 1 KiB allocated)
-rwx e------8-4- 2017-08-07 10:52:02    2017-08-07 10:52:02         /icon.sys (1776 bytes, 2 KiB allocated)
drwx e--------4- 2018-01-21 13:39:51    2018-02-14 14:51:19     /BASLUS-21201TOL-S01 (4 items, 3 KiB allocated)
-rwx e------8-4- 2018-01-21 13:39:51    2018-01-21 13:39:51         /icon.ico (15536 bytes, 16 KiB allocated)
-rwx e------8-4- 2018-02-14 14:51:18    2018-02-14 14:51:18         /BASLUS-21201TOL-S01 (1024 bytes, 1 KiB allocated)
-rwx e------8-4- 2018-02-14 14:51:18    2018-02-14 14:51:19         /savedata.dat (5120 bytes, 5 KiB allocated)
-rwx e------8-4- 2018-01-21 13:39:52    2018-02-14 14:51:19         /icon.sys (964 bytes, 1 KiB allocated)
drwx e--------4- 2020-01-08 19:45:48    2022-01-20 13:24:52     /BESLES-52801LOTRs000 (3 items, 3 KiB allocated)
-rwx e------8-4- 2022-01-20 13:24:51    2022-01-20 13:24:52         /BESLES-52801LOTRs000 (56800 bytes, 56 KiB allocated)
-rwx e------8-4- 2022-01-20 13:24:52    2022-01-20 13:24:52         /lotrtta.ico (45474 bytes, 45 KiB allocated)
-rwx e------8-4- 2022-01-20 13:24:52    2022-01-20 13:24:52         /icon.sys (964 bytes, 1 KiB allocated)
drwx e--------4- 2023-05-10 08:37:07    2023-05-10 08:49:33     /BASLUS-21075HG (3 items, 3 KiB allocated)
-rwx e------8-4- 2023-05-10 08:37:07    2023-05-10 08:49:33         /BASLUS-21075HG (77168 bytes, 76 KiB allocated)
-rwx e------8-4- 2023-05-10 08:37:13    2023-05-10 08:37:13         /icon00.ico (118616 bytes, 116 KiB allocated)
-rwx e------8-4- 2023-05-10 08:37:13    2023-05-10 08:37:14         /icon.sys (964 bytes, 1 KiB allocated)
drwx e--------4- 2023-06-10 14:52:50    2023-06-10 14:52:51     /BASLUS-21386_TOA_000 (3 items, 3 KiB allocated)
-rwx e------8-4- 2023-06-10 14:52:50    2023-06-10 14:52:50         /BASLUS-21386_TOA_000 (49096 bytes, 48 KiB allocated)
-rwx e------8-4- 2023-06-10 14:52:50    2023-06-10 14:52:50         /toa_game.ico (20304 bytes, 20 KiB allocated)
-rwx e------8-4- 2023-06-10 14:52:50    2023-06-10 14:52:51         /icon.sys (964 bytes, 1 KiB allocated)
drwx e--------4- 2023-06-10 14:52:51    2023-06-10 14:52:52     /BASLUS-21386_TOASYS (3 items, 3 KiB allocated)
-rwx e------8-4- 2023-06-10 14:52:51    2023-06-10 14:52:52         /BASLUS-21386_TOASYS (1832 bytes, 2 KiB allocated)
-rwx e------8-4- 2023-06-10 14:52:52    2023-06-10 14:52:52         /toa_sys.ico (19810 bytes, 20 KiB allocated)
-rwx e------8-4- 2023-06-10 14:52:52    2023-06-10 14:52:52         /icon.sys (964 bytes, 1 KiB allocated)
Mike3137 commented 3 months ago

PCSX2 simply copies actual host filesystem timestamps for the file entries when converting to a file MC, instead of taking the timestamps from the index files, then it copies that actual unix time which is not with +9 extra hours like what the index files use to the ps2 memory card file, and that is why there's an extra -9 hours on the resulting timestamps, besides being the completley wrong date.

So these are the issues I see for now with conversion to file MC:

I kind of wish the PCSX2 folder format allowed for storing rootdir timestamps so conversion could be 1:1. Aside from the rootdir timestamp my own program can (from what I can tell, there may be bugs) already convert 1:1, back and forth.

. / .. entries: . entries should have both creation and modified timestamps set to the creation timestamp for the save folders entry in the rootdir. The only exception is the root dir "." entry, modified date should be set to latest save dir creation timestamp. .. entries should have both creation and modified timestamps set to rootdir creation timestamp. This is what it looks like when handled by bios:

drwx e--------4- 2016-10-23 12:04:56    2023-06-10 14:52:51 /.
drwx e--------4- 2016-10-23 12:04:56    2023-06-10 14:52:51     /.
d-wx e-h------4- 2016-10-23 12:04:56    2016-10-23 12:04:56     /..
drwx e--------4- 2017-03-23 16:08:36    2017-03-23 16:17:12     /BASLUS-21326-SHF-000 (3 items, 3 KiB allocated)
drwx e--------4- 2017-03-23 16:08:36    2017-03-23 16:08:36         /.
drwx e--------4- 2016-10-23 12:04:56    2016-10-23 12:04:56         /..

How it looks when converted to File MC by PCSX2: All . and .. entries has zeroed bytes as timestamps.

drwx e--------4- 1899-12-30 15:00:00    1899-12-30 15:00:00 /.
drwx e--------4- 1899-12-30 15:00:00    1899-12-30 15:00:00     /.
d-wx e-h------4- 1899-12-30 15:00:00    1899-12-30 15:00:00     /..
drwx e--------4- 2017-03-23 16:08:36    2017-03-23 16:17:12     /BASLUS-21326-SHF-000 (3 items, 3 KiB allocated)
drwx e--------4- 1899-12-30 15:00:00    1899-12-30 15:00:00         /.
drwx e--------4- 1899-12-30 15:00:00    1899-12-30 15:00:00         /..