ShendoXT / memcardrex

Advanced PlayStation 1 Memory Card editor
GNU General Public License v3.0
432 stars 53 forks source link

Make it easier to consolidate multiple .VMP save files from PSP into single .MCD save file for Duckstation #37

Closed ttang4299 closed 1 year ago

ttang4299 commented 1 year ago

I have made an important edit at the bottom of this issue log. Please read it in its entirety before responding appropriately.

Hi, I have a couple dozen PS1 save files from my PSP that I'm trying to transfer for use with the Duckstation PS1 emulator. Roughly half have the filename of SCEVMC0 and the remaining save files are named SCEVMC1, so I assume they are for memory card slot 1 and memory card slot 2 respectively. See attached screenshot below for the filenames I am working with.

scevmc

I'm looking to have all my games share the same 2 memory cards instead of each game using its own memory card, so I want to consolidate all these files into just 2 save files. (EDIT: as explained at the bottom, I now much rather prefer the saves remain separate but all batch converted and inserted into their respective folders, so please ignore this statement)

However, every time I open either the files named SCEVMC0 or the files named SCEVMC1 altogether, I get over 40 tabs opened for every single file. It would be cumbersome and time-consuming to drag and drop each file to the one I want saved.

mcr

I would much rather prefer MemcardRex to automatically detect which memory card the files are for, and then automatically combine all the .VMP save files into 1 or 2 .MCD save files, with just a few simple clicks and without requiring any dragging and dropping (EDIT: please ignore this statement). Would that be possible to implement?

EDIT (Dec 13th 2022): I would like to note that the files in the screenshots above were batch extracted by me from individual folders that the PSP made a directory for. For future users of this tool, it might actually be more useful to just batch convert each individual save and output them to their respective folders, as I have learned since that games usually have individual save files for emulation to prevent potential issues. I think it may be possible that Duckstation already searches for saves within these respective folders. Each folder has been named after the game's respective game ID. I will attach more helpful screenshots below to show both what the directory looks like as a whole, and what can be expected to be found inside each folder.

psx2

psx3

ShendoXT commented 1 year ago

Sorry but this is a bit outside of the scope of MemcardRex but none the less I found a solution for you. I made a simple batch script which will do the job for you in no time. It works on Windows 10, I tested it.

Simply make a new file called "PSP2Duck.bat", place it in the main directory where all of your other directories are, paste this code into it and then simply run it.

@echo off
setlocal EnableDelayedExpansion 

if not exist "memcards" mkdir "memcards"

for /d %%a in ("S*") do (
 set DirName=%%a
 set ProdCode=!DirName:~0,4!-!DirName:~4,5!
 echo Converting "!DirName!" directory to "!ProdCode!" Memory Cards

if exist !DirName!\SCEVMC0.VMP (
 powershell "gc !DirName!\SCEVMC0.VMP -Encoding byte -Tail 131072 | sc memcards\!ProdCode!_1.mcd -Encoding byte"
 powershell "gc !DirName!\SCEVMC1.VMP -Encoding byte -Tail 131072 | sc memcards\!ProdCode!_2.mcd -Encoding byte"
)
)

This will make a new directory called memcards and it will take each card from the respective folder and convert it from .VMP to .mcd which DuckStation use.

The reason this works is simply because VMP files are MCD files with extra 128 byte header. This script removes that header and you are left with the raw .mcd file.

Once you run it, it will take a while, depending on the number of directories you have. Don't forget to configure DuckStation to use Serial as the base for the Memory Cards. converted memcards