libraries/libmcrd: Difference between revisions
| Revision as of 02:58, 23 October 2026 RemmyLee (Run-time library pages: 20 libraries from the Library Overview and Reference 4.4) | Revision as of 03:05, 23 October 2026 RemmyLee (File libraries under their SDK: /sdk/psy-q/; Psy-Q page; sidebar SDKs and System software) | ||
| Line 1: | Line 1: | ||
| − | --- | ||
| − | title: Extended Memory Card Library (libmcrd) | ||
| − | type: component | ||
| − | summary: Provides a high-level interface for accessing the Memory Card. | ||
| − | category: Libraries | ||
| − | info: Library = libmcrd.lib | ||
| − | info: Header File = libmcrd.h | ||
| − | --- | ||
| − | |||
| − | ## Overview | ||
| − | |||
| − | The Extended Memory Card Library (libmcrd) provides a high-level interface to the Memory Cards inserted in the PlayStation. It checks whether a card is present, uninitialized or invalid, reads and writes data, formats a card, creates and deletes files and returns the directory information.[^o6-3] | ||
| − | |||
| − | A program that uses libmcrd links with libmcrd.lib and includes libmcrd.h. libmcrd calls [libcard](/libraries/libcard/) and libapi internally, so libcard.lib and libapi.lib are also part of the link.[^o6-3] | ||
| − | |||
| − | ## Card Status | ||
| − | |||
| − | The Memory Card can be inserted or removed while the PlayStation is on, so an application must allow for a change of card at any time. MemCardAccept() determines whether a card has been inserted or removed and returns the status of the card.[^o6-3] | ||
| − | |||
| − | A card that has just been inserted is a new card. Because a new card may be unformatted or invalid, the library refuses to access it until MemCardAccept() has run, and every other function, such as MemCardReadFile(), returns "New card detected" until then. MemCardAccept() also performs the format check, so it need not be called a second time for the same card.[^o6-3] | ||
| − | |||
| − | ## Read and Write Errors | ||
| − | |||
| − | Communication errors can occur while the card is read or written. libmcrd retries the errors of a read itself, so the application needs no error handling for reads. Errors during a write, however, are not handled by the library. The application checks the written data itself. Reading the data back is one way to check it.[^o6-3] | ||
| − | |||
| − | ## libcard and the Card BIOS | ||
| − | |||
| − | libmcrd uses the functions and resources of libcard and the card BIOS. The HwCARD and SwCARD events are among these resources. Consequently, an application that uses libmcrd cannot use libcard or the card BIOS directly. An application that needs an operation libmcrd cannot perform must therefore do all its Memory Card operations with libcard and the card BIOS.[^o6-4] | ||
| − | |||
| − | ## Multi Tap | ||
| − | |||
| − | libmcrd keeps only one directory information buffer for each port of the PlayStation. When several Memory Cards are connected to one Multi Tap, it can therefore hold the directory of only one of them. The program calls MemCardAccept() each time it accesses a different card.[^o6-4] | ||
| − | |||
| − | When the controller is also used, MemCardInit(0) and MemCardStart() are called before the controller is initialized.[^o13-18] | ||
| − | |||
| − | ## Memory Card | ||
| − | |||
| − | The Memory Card keeps its data after the PlayStation is powered off or reset. It holds 120 KB after format, accessed in 128-byte sectors, and communicates over a synchronous serial port shared with the controller. No access is possible for 20 ms after a sector is written, and continuous reading reaches about 10 KB/sec. The card is guaranteed for 100,000 writes.[^o6-4] | ||
| − | |||
| − | ## Rules for Use | ||
| − | |||
| − | The Memory Card is shared by many applications and is used by common rules. No standard screen is required for a full or unformatted card, but the user is told before a card is formatted, and formatting is never automatic. The user is also told when a card is expected and none is found. The product catalogs give the required capacity in blocks of 8192 bytes.[^o6-5] | ||
| − | |||
| − | File names and file headers have the same form as under libcard. The name is 'B', the region letter, the SCE product number and a user part, and the header starts with the magic number "SC". The Shift-JIS name in the header may not use the codes 0x84bf to 0x889e.[^o6-5][^o6-6] | ||
| − | |||
| − | A reset, removal or power off during a write can destroy the data, and neither the hardware nor the library protects it. The application therefore writes the data twice with a checksum at the end of each sector and uses the other copy when a checksum fails.[^o6-6] | ||
| − | |||
| − | ## Functions | ||
| − | |||
| − | In the tables below, Introduced is the run-time library version that added the item.[^reff53] | ||
| − | |||
| − | libmcrd has the following functions:[^reff53] | ||
| − | |||
| − | Table: libmcrd functions | ||
| − | |||
| − | | Function | Introduced | Purpose | | ||
| − | | --- | --- | --- | | ||
| − | | `MemCardAccept` | 4.0 | Check Memory Card status. | | ||
| − | | `MemCardCallback` | 4.0 | Define exit callback. | | ||
| − | | `MemCardClose` | 4.0 | Close file. | | ||
| − | | `MemCardCreateFile` | 4.0 | Create a new file in the Memory Card. | | ||
| − | | `MemCardDeleteFile` | 4.0 | Delete file from Memory Card. | | ||
| − | | `MemCardEnd` | 4.0 | Terminate Memory Card system. | | ||
| − | | `MemCardExist` | 4.0 | Get connection status of card. | | ||
| − | | `MemCardFormat` | 4.0 | Format Memory Card. | | ||
| − | | `MemCardGetDirentry` | 4.0 | Get directory information from Memory Card. | | ||
| − | | `MemCardInit` | 4.0 | Initialize Memory Card system. | | ||
| − | | `MemCardOpen` | 4.0 | Open file. | | ||
| − | | `MemCardReadData` | 4.0 | Read data from Memory Card. | | ||
| − | | `MemCardReadFile` | 4.0 | Read file from Memory Card. | | ||
| − | | `MemCardStart` | 4.0 | Start Memory Card system. | | ||
| − | | `MemCardStop` | 4.0 | Stop Memory Card system. | | ||
| − | | `MemCardSync` | 4.0 | Wait for completion of an asynchronous function or check status. | | ||
| − | | `MemCardUnformat` | 4.3 | Uninitialize a Memory Card (for debugging only). | | ||
| − | | `MemCardWriteData` | 4.0 | Write data to Memory Card. | | ||
| − | | `MemCardWriteFile` | 4.0 | Write file to Memory Card. | | ||
| − | |||
| − | ## References | ||
| − | |||
| − | [^o6-3]: Sony Computer Entertainment Inc. Run-Time Library Overview. Run-Time Library 4.4. January 1999. Page 6-3. | ||
| − | [^o6-4]: Sony Computer Entertainment Inc. Run-Time Library Overview. Run-Time Library 4.4. January 1999. Page 6-4. | ||
| − | [^o6-5]: Sony Computer Entertainment Inc. Run-Time Library Overview. Run-Time Library 4.4. January 1999. Page 6-5. | ||
| − | [^o6-6]: Sony Computer Entertainment Inc. Run-Time Library Overview. Run-Time Library 4.4. January 1999. Page 6-6. | ||
| − | [^o13-18]: Sony Computer Entertainment Inc. Run-Time Library Overview. Run-Time Library 4.4. January 1999. Page 13-18. | ||
| − | [^reff53]: Sony Computer Entertainment Inc. Run-Time Library Reference. Run-Time Library 4.4. January 1999. Pages 5-3 to 5-21. | ||