Basic Memory Card Example

Programming examples for the Psy-Q SDK
Post Reply
User avatar
LameGuy64
Psy-Q Enthusiast
Psy-Q Enthusiast
Posts: 380
Joined: April 10th, 2013, 3:47 pm
I am a: Hobbyist Game Developer
Motto: Commercial or not, play it!
PlayStation Model: H2000/7000
Location: Philippines
Contact:

Basic Memory Card Example

Post by LameGuy64 » April 2nd, 2015, 6:11 pm

I was going to release this example last year but I forgot where I placed it until now. Unlike the memory card examples that came with the Psy-Q SDK which used _bu_init() and open() which tends to be unreliable, this one uses libmcrd which is a lot more reliable and is easier to use.

This example demonstrates the basics of handling Memory Cards such as detecting whether or not a card is attached, listing the files inside a card and creating a test save block. It does not display the title names and icons of save blocks though but it shouldn't be too difficult to implement it yourself.
You do not have the required permissions to view the files attached to this post.
Please don't forget to include my name if you share my work around. Credit where it is due.

Dev. Console: SCPH-7000 with SCPH-7501 ROM, MM3, PAL color fix, Direct AV ports, DB-9 port for Serial I/O, and a Xplorer FX with Caetla 0.35.

DTL-H2000 PC: Dell Optiplex GX110, Windows 98SE & Windows XP, Pentium III 933MHz, 384MB SDRAM, ATI Radeon 7000 VE 64MB, Soundblaster Audigy, 40GB Seagate HDD, Hitachi Lite-on CD-RW Drive, ZIP 250 and 3.5" Floppy.

User avatar
kostasvs
What is PSXDEV?
What is PSXDEV?
Posts: 2
Joined: December 28th, 2018, 6:49 am
I am a: Gamedev Enthusiast
PlayStation Model: SCPH-101
Want to Find: Gamedev info
Looking to: Make games, I hope
Location: Greece
Contact:

Re: Basic Memory Card Example

Post by kostasvs » January 13th, 2019, 1:51 am

Sorry for the old bump (AFAIK there's no rule against it). In case anyone needs a psymake-compatible "makefile.mak", here's what worked for me:

Code: Select all

# -----------------------------------------
#       PlayStation 1 Psy-Q Makefile
# -----------------------------------------

all:
	del memcard.exe
	del memcard.cpe
	cls
	
	ccpsx -Xo$80010000 -O3 -Wall memcard.c -omemcard.cpe
	cpe2x /ce memcard.cpe
If you get "Symbol [...] not defined" errors, you must add "libmcrd.lib" in the second line of C:\psyq\bin\PSYQ.INI. The one in "C:\psyq\psyq\PSYQ.INI" did not have any effect for me.

Finally, if you are testing with PSXeven, you have to "format" your memory cards using Tools --> Memcard Manager --> Format. The example tries to format them, but the changes don't seem to remain in the emulator if you don't format the cards manually.

LameGuy64, thank you so much for all your examples and posts. They have helped me a lot, and I'm sure they've helped everyone else too.

User avatar
MrQuetch
Curious PSXDEV User
Curious PSXDEV User
Posts: 24
Joined: April 1st, 2018, 9:34 am
Motto: You can accomplish anything.
Looking to: Create professional homebrew.
Location: United States

Re: Basic Memory Card Example

Post by MrQuetch » October 5th, 2019, 3:25 pm

kostasvs wrote:
January 13th, 2019, 1:51 am
Sorry for the old bump (AFAIK there's no rule against it). In case anyone needs a psymake-compatible "makefile.mak", here's what worked for me:

Code: Select all

# -----------------------------------------
#       PlayStation 1 Psy-Q Makefile
# -----------------------------------------

all:
	del memcard.exe
	del memcard.cpe
	cls
	
	ccpsx -Xo$80010000 -O3 -Wall memcard.c -omemcard.cpe
	cpe2x /ce memcard.cpe
If you get "Symbol [...] not defined" errors, you must add "libmcrd.lib" in the second line of C:\psyq\bin\PSYQ.INI. The one in "C:\psyq\psyq\PSYQ.INI" did not have any effect for me.

Finally, if you are testing with PSXeven, you have to "format" your memory cards using Tools --> Memcard Manager --> Format. The example tries to format them, but the changes don't seem to remain in the emulator if you don't format the cards manually.

LameGuy64, thank you so much for all your examples and posts. They have helped me a lot, and I'm sure they've helped everyone else too.
I'm aware this is old, but thank you so much, kostavs! Your one and only post is legendary! You have saved me tons of hours. I had already spent a half-hour to an hour figuring out why I was receiving that error. It's strange the SDK developers didn't just stick that in - it would've been so fast and easy to.

User avatar
kostasvs
What is PSXDEV?
What is PSXDEV?
Posts: 2
Joined: December 28th, 2018, 6:49 am
I am a: Gamedev Enthusiast
PlayStation Model: SCPH-101
Want to Find: Gamedev info
Looking to: Make games, I hope
Location: Greece
Contact:

Re: Basic Memory Card Example

Post by kostasvs » October 5th, 2019, 6:07 pm

Glad I helped :D best of luck to you!

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests