├── LICENSE
├── Makefile
├── README.md
├── doc
├── FAQ.txt
├── ToDo.txt
└── usb-verbose.txt
├── img
└── format.mcd
└── src
├── 98-playstation-card-reader.rules
├── main.c
└── ps3mca-ps1-driver.h
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | CC ?= gcc
2 | CFLAGS ?= $(shell pkg-config --cflags libusb-1.0)
3 | LDFLAGS ?= $(shell pkg-config --libs libusb-1.0)
4 |
5 | ps3mca-ps1: src/main.c
6 | $(CC) src/main.c -o ps3mca-ps1 $(CFLAGS) $(LDFLAGS)
7 | $(CC) -D DEBUG src/main.c -o ps3mca-ps1-debug $(CFLAGS) $(LDFLAGS)
8 |
9 | .PHONY: clean
10 | clean:
11 | rm -f ps3mca-ps1
12 | rm -f ps3mca-ps1-debug
13 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ps3mca-ps1
2 |
3 | this is a libusb driver to communicate with the PlayStation 3 Memory Card Adaptor CECHZM1 (SCPH-98042) for PS1 cards (SCPH-1020, SCPH-1170 and SCPH-119X), partially the PocketStation (SCPH-4000) and maybe other cards or device (like the MEMORY DISK DRIVE).
4 | The PS2 cards (SCPH-10020) and compatible is NOT supported (see doc/FAQ).
5 |
6 | ## Requirements
7 |
8 | * libusb 1.0;
9 | * PlayStation 3 Memory Card Adaptor CECHZM1 (SCPH-98042) or similar;
10 | * PS1 memory card, PocketStation and maybe other cards or device (like the MEMORY DISK DRIVE).
11 |
12 | ## Compiling
13 |
14 | make
15 |
16 | By default, the flags for libusb are looked up via pkg-config; these can be overridden by setting the CFLAGS and LDFLAGS environment variables.
17 |
18 |
19 | ## Usage
20 |
21 | "ps3mca-ps1 v" for verify what type of card is (PS1 or PS2).
22 | "ps3mca-ps1 s" for verify if is a original card. Some known bug (see doc/FAQ).
23 | "ps3mca-ps1 r" for reading.
24 | "ps3mca-ps1 w" for writing all memory card (WARNING need a write.mcd file), (see doc/FAQ).
25 | "ps3mca-ps1 w 0 1023" for writing memory card from frame 0 to frame 1023 (but you can select all value from 0 to 1023, first frame must be minor or at least equal to last frame) (WARNING need a write.mcd file), (see doc/FAQ).
26 |
27 |
28 | ## Supported file
29 |
30 | All pure (raw) image of memory card:
31 | `*.psm`, `*.ps`, `*.ddf`, `*.mcr`, `*.mcd`, `*.mc`...
32 |
33 | Not supported:
34 | Connectix Virtual Game Station format (.MEM): "VgsM", 64 bytes.
35 | PlayStation Magazine format (.PSX): "PSV", 256 bytes.
36 | Virtual Memory Card PS1 (.VM1): VM1 is a PS1 memory card in "PS3 format", used in PS3 internal HDD only.
37 |
38 | ## Author
39 |
40 | Written by [Paolo Caroni](kenren89@gmail.com) and released under the terms of the GNU GPL, version 3, or later.
41 | Please read doc/FAQ.txt before writing to me.
42 |
43 | ## License
44 |
45 | This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
46 |
47 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
48 | See the GNU General Public License for more details.
49 |
50 | You should have received a copy of the GNU General Public License along with this program.
51 | If not, see .
52 |
53 | ## Tested
54 |
55 | Reading 100%.
56 | Writing unofficial and original memory card 99% with some errors in the odd frame, unreadable on PS if you use emulator image (see doc/FAQ).
57 | Writing PocketStation 0.1%, DON'T use it, actually write only the fist frame, need different delay structure. (The clock isn't implemented yet.)
58 |
59 | ## Documentation
60 |
61 | PS1 Memory Card
62 |
63 |
64 | ## Other similar but unrelated projects
65 |
66 | **ps3-memorycard-adapter** is a python tool that read and write PS1 and PS2 card.
67 | Licence: GPLv2
68 |
69 |
70 | **ps3mca-tool** is a C program to read and write PS2 memory card.
71 | Licence: GPLv3+
72 |
73 | **WARNING**
74 | this project is removed on github because (probably) violate software patent.
75 | see:
76 |
77 | If you live on U.S.A. DON'T download it.
78 | In that confederation of states it is illegal (DMCA).
79 | If you live in any other states:
80 |
81 |
--------------------------------------------------------------------------------
/doc/FAQ.txt:
--------------------------------------------------------------------------------
1 | PS1 get id command (ASCII "S")
2 |
3 | Don't run it if you have already run other commands in the last 5/10 minutes.
4 | Maybe can be a good idea remove your PS3mca unplug the USB, wait several minutes and replug it, then run this command.
5 |
6 |
7 |
8 | PS1 write command (ASCII "W")
9 |
10 | First of all this command actally need a "write.mcd" file, if there isn't you obtain a segmentation fault.
11 | If you have a pure (raw) image of memory card (*.psm, *.ps, *.ddf, *.mcr, *.mc...) rename it to "write.mcd".
12 | This command rewrite all memory card, reducing his life (limited write cycles).
13 | As far as I could detect images of pcsx-r give problems on PS2 (my PSone is dead, I can play my PS1 games only on PS2 or on pcsx-r).
14 | Maybe can be a good idea wait several minutes if you have already run other commands.
15 |
16 |
17 |
18 | Why isn't in roadmap to support PS2 memorycard (SCPH-10020)?
19 |
20 | First because my PS2 is alive.
21 | Second because PS2 authentication isn't good documented.
22 | Third because exist already other libusb driver to read and write it (see README.md).
23 |
24 |
25 |
26 | Why isn't in roadmap to support PocketStation memorycard (SCPH-4000) properly?
27 |
28 | I tried for at least a year, I bought several pockestations used to test.
29 | I came to the conclusion that the ps3mca protocol does not support specific PocketStation commands.
30 | Therefore, support for the PocketStation is impossible due to hardware limitations.
31 | I have removed the PocketStation early support since 06 gen 2018.
32 |
--------------------------------------------------------------------------------
/doc/ToDo.txt:
--------------------------------------------------------------------------------
1 | ToDo list:
2 |
3 | - Correct writing support (errors in the odd frame);
4 |
5 | - Add clock support;
6 |
7 | - Split monolithic source;
8 |
9 | - Correct PocketStation writing (actually unsupported);
10 |
11 | - Make possible write only changed frame for improve lifetime of memorycard;
12 |
13 | - Understand why there is the problem if send cmd in sequence;
14 |
15 | - Test under other libusb O.S. (Windows, MacOSX, Android, OpenBSD/NetBSD, Haiku);
16 |
17 | - add the source directly on pcsx-r project?
18 |
--------------------------------------------------------------------------------
/doc/usb-verbose.txt:
--------------------------------------------------------------------------------
1 | Bus 004 Device 003: ID 054c:02ea Sony Corp. PlayStation 3 Memory Card Adaptor
2 | Couldn't open device, some information will be missing
3 | Device Descriptor:
4 | bLength 18
5 | bDescriptorType 1
6 | bcdUSB 1.10
7 | bDeviceClass 255 Vendor Specific Class
8 | bDeviceSubClass 0
9 | bDeviceProtocol 255
10 | bMaxPacketSize0 8
11 | idVendor 0x054c Sony Corp.
12 | idProduct 0x02ea PlayStation 3 Memory Card Adaptor
13 | bcdDevice 0.01
14 | iManufacturer 0
15 | iProduct 0
16 | iSerial 0
17 | bNumConfigurations 1
18 | Configuration Descriptor:
19 | bLength 9
20 | bDescriptorType 2
21 | wTotalLength 39
22 | bNumInterfaces 1
23 | bConfigurationValue 1
24 | iConfiguration 0
25 | bmAttributes 0x80
26 | (Bus Powered)
27 | MaxPower 128mA
28 | Interface Descriptor:
29 | bLength 9
30 | bDescriptorType 4
31 | bInterfaceNumber 0
32 | bAlternateSetting 0
33 | bNumEndpoints 3
34 | bInterfaceClass 255 Vendor Specific Class
35 | bInterfaceSubClass 0
36 | bInterfaceProtocol 255
37 | iInterface 0
38 | Endpoint Descriptor:
39 | bLength 7
40 | bDescriptorType 5
41 | bEndpointAddress 0x81 EP 1 IN
42 | bmAttributes 2
43 | Transfer Type Bulk
44 | Synch Type None
45 | Usage Type Data
46 | wMaxPacketSize 0x0040 1x 64 bytes
47 | bInterval 0
48 | Endpoint Descriptor:
49 | bLength 7
50 | bDescriptorType 5
51 | bEndpointAddress 0x02 EP 2 OUT
52 | bmAttributes 2
53 | Transfer Type Bulk
54 | Synch Type None
55 | Usage Type Data
56 | wMaxPacketSize 0x0040 1x 64 bytes
57 | bInterval 0
58 | Endpoint Descriptor:
59 | bLength 7
60 | bDescriptorType 5
61 | bEndpointAddress 0x83 EP 3 IN
62 | bmAttributes 3
63 | Transfer Type Interrupt
64 | Synch Type None
65 | Usage Type Data
66 | wMaxPacketSize 0x0001 1x 1 bytes
67 | bInterval 64
68 |
69 |
70 |
--------------------------------------------------------------------------------
/img/format.mcd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/paolo-caroni/ps3mca-ps1/f07c9f33c4cc1110dd68a1fb90cc5107d06b1542/img/format.mcd
--------------------------------------------------------------------------------
/src/98-playstation-card-reader.rules:
--------------------------------------------------------------------------------
1 | /* This file should be copyed on /etc/udev/rules.d on GNU/Linux OS and derived */
2 | /* Add permission to all user to have complete acces to PS1/2 memory card reader*/
3 | SUBSYSTEM=="usb", ATTR{idVendor}=="054c", ATTR{idProduct}=="02ea", MODE:="0666"
4 | /*ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="054c", ATTR{idProduct}=="02ea", SYMLINK="pscard%n", GROUP="plugdev", MODE:="0666"*/
5 |
6 |
--------------------------------------------------------------------------------
/src/main.c:
--------------------------------------------------------------------------------
1 | /*
2 | * this is a libusb program to communicate with the PlayStation 3 Memory Card Adaptor CECHZM1 (SCPH-98042) for PS1 cards (SCPH-1020,
3 | * SCPH-1170 and SCPH-119X), maybe the PocketStation (SCPH-4000) and maybe other cards or device (like the MEMORY DISK DRIVE).
4 | *
5 | * Copyright (C) 2017 Paolo Caroni
6 | *
7 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as
8 | * published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | * See the GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License along with this program.
15 | * If not, see .
16 | */
17 |
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include "ps3mca-ps1-driver.h"
24 |
25 | #if __APPLE__
26 | #include
27 | #if TARGET_OS_MAC
28 | #include // Makefile pkg-config call returns the full path on Mac OS (M1)
29 | #endif
30 | #else
31 | #include
32 | #endif
33 |
34 | void processMessage(const uint8_t*);
35 |
36 | int res = 0; /* Return codes from libusb functions */
37 | int ret = 0; /* Return codes from libusb functions */
38 | libusb_device_handle* handle = 0; /* Handle for USB device */
39 | int kernelDriverDetached = 0; /* Set to 1 if kernel driver detached */
40 | int numBytes = 0; /* Actual bytes transferred. */
41 |
42 |
43 | int c; /* Checksum loop indicator*/
44 |
45 | void delay(int milliseconds) /* Delay definition*/
46 | {
47 | long pause;
48 | clock_t now,then;
49 |
50 | pause = milliseconds*(CLOCKS_PER_SEC/1000);
51 | now = then = clock();
52 | while( (now-then) < pause )
53 | now = clock();
54 | }
55 |
56 | int open_ps3mca()
57 | {
58 |
59 | /* Initialise libusb. */
60 | res = libusb_init(0);
61 | if (res != 0)
62 | {
63 | fprintf(stderr, "Error initialising libusb.\n");
64 | return 1;
65 | }
66 |
67 | /* Get the first device with the matching Vendor ID and Product ID. */
68 | handle = libusb_open_device_with_vid_pid(0, USB_VENDOR, USB_PRODUCT);
69 | if (!handle)
70 | {
71 | fprintf(stderr, "Unable to open device.\n");
72 | fprintf(stderr, "Please verify PS3mca CECHZM1 (SCPH-98042) connection.\n");
73 | return 1;
74 | }
75 |
76 | /* Remove OS that don't support libusb_kernel_driver_active function.
77 | * Microsoft Windows 16bit*/
78 | #if defined (_WIN16)
79 | /* Microsoft Windows 32bit*/
80 | #elif defined (_WIN32)
81 | /* Microsoft Windows 64bit*/
82 | #elif defined (_WIN64)
83 | /* Mac OS*/
84 | #elif defined (__APPLE__)
85 | /* All other OS*/
86 | #else
87 | /* Check whether a kernel driver is attached to interface #0.
88 | * If so, we'll need to detach it.
89 | */
90 | if (libusb_kernel_driver_active(handle, 0))
91 | {
92 | res = libusb_detach_kernel_driver(handle, 0);
93 | if (res == 0)
94 | {
95 | kernelDriverDetached = 1;
96 | }
97 | else
98 | {
99 | fprintf(stderr, "Error detaching kernel driver.\n");
100 | return 1;
101 | }
102 | }
103 | #endif
104 |
105 | /* Claim interface #0. */
106 | res = libusb_claim_interface(handle, 0);
107 | if (res != 0)
108 | {
109 | fprintf(stderr, "Error claiming interface.\n");
110 | return 1;
111 | }
112 |
113 | return 0;
114 |
115 | }
116 |
117 | void close_ps3mca() /* Unmount the ps3mca*/
118 | {
119 |
120 | /* Release interface #0. */
121 | res = libusb_release_interface(handle, 0);
122 | if (0 != res)
123 | {
124 | fprintf(stderr, "Error releasing interface.\n");
125 | }
126 |
127 | /* If we detached a kernel driver from interface #0 earlier, we'll now
128 | * need to attach it again. */
129 | if (kernelDriverDetached)
130 | {
131 | libusb_attach_kernel_driver(handle, 0);
132 | }
133 |
134 | /* Shutdown libusb. */
135 | libusb_exit(0);
136 |
137 | }
138 |
139 |
140 | /* --------------------------------------------PS3mca verification of card (PS1 or PS2)---------------------------------------------*/
141 | int PS3mca_verify_card ()
142 | {
143 |
144 | if (open_ps3mca() != 0)
145 | {
146 | return 1;
147 | }
148 |
149 | uint8_t cmd_card_verification[2];
150 | uint8_t response_card_verification[2];
151 |
152 | /* This is the command get id for memory card (SCPH-1020) or PocketStation (SCPH-4000)*/
153 | memset(cmd_card_verification, 0, sizeof(cmd_card_verification));
154 | /* first 4 byte are about ps3 memory card adapter protocol*/
155 | cmd_card_verification[0] = PS3MCA_CMD_FIRST; /* First command for ps3mca protocol*/
156 | cmd_card_verification[1] = PS3MCA_CMD_VERIFY_CARD_TYPE; /* Verify what type of card (PS1 or PS2)*/
157 |
158 |
159 |
160 | /* Send the message to endpoint with a 5000ms timeout. */
161 | res = libusb_bulk_transfer(handle, BULK_WRITE_ENDPOINT, cmd_card_verification, sizeof(cmd_card_verification), &numBytes, USB_TIMEOUT);
162 | if (res == 0)
163 | {
164 | printf("\nType of Memory Card:\n");
165 | /* See on screen what is transmitted for debug purpose*/
166 | #if DEBUG
167 | printf("\n%d bytes transmitted successfully.\n", numBytes);
168 | printf("Send:\n");
169 | printf("%x \n", cmd_card_verification[0]);
170 | printf("%x \n", cmd_card_verification[1]);
171 | printf("\n");
172 | #endif
173 | }
174 | else
175 | {
176 | fprintf(stderr, "Error sending message to device.\n");
177 | }
178 |
179 | /* Clean response.*/
180 | memset(response_card_verification, 0, sizeof(response_card_verification));
181 |
182 | /* Listen for a message.*/
183 | /* Wait up to 5 seconds for a message to arrive on endpoint*/
184 | res = libusb_bulk_transfer(handle, BULK_READ_ENDPOINT, response_card_verification, sizeof(response_card_verification), &numBytes, USB_TIMEOUT);
185 | if (0 == res)
186 | {
187 | if (numBytes == sizeof(response_card_verification))
188 | {
189 | /* See on screen what arrive for debug purpose*/
190 | #if DEBUG
191 | printf("Received:\n");
192 | printf("%x \n", response_card_verification[0]);
193 | printf("%x \n", response_card_verification[1]);
194 | printf("\n");
195 | #endif
196 |
197 | /* Verify if there is a PS1 card*/
198 | if (response_card_verification[0] == RESPONSE_CODE & response_card_verification[1] == RESPONSE_PS1_CARD)
199 | {
200 | printf("PS1 Memory Card.\n\n");
201 | }
202 |
203 | /* Verify if there is a PS2 card*/
204 | else if (response_card_verification[0] == RESPONSE_CODE & response_card_verification[1] == RESPONSE_PS2_CARD)
205 | {
206 | printf("PS2 Memory Card.\nFor the moment isn't in roadmap to support it (see FAQ).\n\n");
207 | }
208 |
209 | /* Other unknown PS3mca error*/
210 | else
211 | {
212 | fprintf(stderr, "Unknown error on PS3mca protocol.\n");
213 | }
214 |
215 | }
216 | else
217 | {
218 | fprintf(stderr, "Received %d bytes, expected %lu.\n", numBytes, sizeof(response_card_verification));
219 | }
220 | }
221 | else
222 | {
223 | fprintf(stderr, "Error receiving message.\n");
224 | }
225 |
226 | /* Unmount the ps3mca*/
227 | close_ps3mca();
228 |
229 | return 0;
230 | }
231 | /* -----------------------------------------End of PS3mca verification of card (PS1 or PS2)-----------------------------------------*/
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 | /* -------------------------------------------------------PS1 command get id--------------------------------------------------------*/
241 | int PS1_get_id ()
242 | {
243 |
244 | if (open_ps3mca() != 0)
245 | {
246 | return 1;
247 | }
248 |
249 | uint8_t cmd_get_id[14];
250 |
251 | /* This is the command get id for memory card (SCPH-1020) or PocketStation (SCPH-4000)*/
252 | memset(cmd_get_id, 0, sizeof(cmd_get_id));
253 | /* first 4 byte are about ps3 memory card adapter protocol*/
254 | cmd_get_id[0] = PS3MCA_CMD_FIRST; /* First command for ps3mca protocol*/
255 | cmd_get_id[1] = PS3MCA_CMD_TYPE_LONG; /* PS1 type of command*/
256 | cmd_get_id[2] = 0x0a; /* 14-4=10=0ah lenght of command. Can be cmd_get_id[2]=sizeof(cmd_get_id)-4*/
257 | cmd_get_id[3] = 0x00; /* memset set all to 0x00, but I prefer to specify it a second time ;)*/
258 | /* this is the real command get id with lenght of 10=0x0a*/
259 | cmd_get_id[4] = PS1CARD_CMD_MEMORY_CARD_ACCESS; /* Memory Card Access, principal command for any action with any memory card*/
260 | cmd_get_id[5] = PS1CARD_CMD_GET_ID; /* Send Get ID Command (ASCII "S")*/
261 | cmd_get_id[6] = 0x00; /* Ask Memory Card ID1*/
262 | cmd_get_id[7] = 0x00; /* Ask Memory Card ID2*/
263 | cmd_get_id[8] = 0x00; /* Ask Command Acknowledge 1*/
264 | cmd_get_id[9] = 0x00; /* Ask Command Acknowledge 2*/
265 | cmd_get_id[10] = 0x00; /* Ask the first two significant digits of the number of frame*/
266 | cmd_get_id[11] = 0x00; /* Ask the last two significant digits of the number of frame*/
267 | cmd_get_id[12] = 0x00; /* Ask the first two significant digits of the frame size*/
268 | cmd_get_id[13] = 0x00; /* Ask the last two significant digits of the frame size*/
269 |
270 |
271 |
272 | /* Send the message to endpoint with a 5000ms timeout. */
273 | res = libusb_bulk_transfer(handle, BULK_WRITE_ENDPOINT, cmd_get_id, sizeof(cmd_get_id), &numBytes, USB_TIMEOUT);
274 | if (res == 0)
275 | {
276 | printf("\nSend PS1 GET ID COMMAND\n");
277 | /* See on screen what is transmitted for debug purpose*/
278 | #if DEBUG
279 | printf("\n%d bytes transmitted successfully.\n", numBytes);
280 | printf("Send:\n");
281 | printf("%x \n", cmd_get_id[0]);
282 | printf("%x \n", cmd_get_id[1]);
283 | printf("%x \n", cmd_get_id[2]);
284 | printf("%x \n", cmd_get_id[3]);
285 | printf("%x \n", cmd_get_id[4]);
286 | printf("%x \n", cmd_get_id[5]);
287 | printf("%x \n", cmd_get_id[6]);
288 | printf("%x \n", cmd_get_id[7]);
289 | printf("%x \n", cmd_get_id[8]);
290 | printf("%x \n", cmd_get_id[9]);
291 | printf("%x \n", cmd_get_id[10]);
292 | printf("%x \n", cmd_get_id[11]);
293 | printf("%x \n", cmd_get_id[12]);
294 | printf("%x \n", cmd_get_id[13]);
295 | printf("\n");
296 | #endif
297 | }
298 | else
299 | {
300 | fprintf(stderr, "Error sending message to device.\n");
301 | }
302 | /* Clean buffer.*/
303 | memset(bulk_buffer, 0, sizeof(bulk_buffer));
304 |
305 | /* Listen for a message.*/
306 | /* Wait up to 5 seconds for a message to arrive on endpoint*/
307 | res = libusb_bulk_transfer(handle, BULK_READ_ENDPOINT, bulk_buffer, sizeof(bulk_buffer), &numBytes, USB_TIMEOUT);
308 | if (0 == res)
309 | {
310 | if (numBytes <= sizeof(bulk_buffer))
311 | {
312 | /* See on screen what arrive for debug purpose*/
313 | #if DEBUG
314 | printf("Received:\n");
315 | printf("%x \n", bulk_buffer[0]);
316 | printf("%x \n", bulk_buffer[1]);
317 | printf("%x \n", bulk_buffer[2]);
318 | printf("%x \n", bulk_buffer[3]);
319 | printf("%x \n", bulk_buffer[4]);
320 | printf("%x \n", bulk_buffer[5]);
321 | printf("%x \n", bulk_buffer[6]);
322 | printf("%x \n", bulk_buffer[7]);
323 | printf("%x \n", bulk_buffer[8]);
324 | printf("%x \n", bulk_buffer[9]);
325 | printf("%x \n", bulk_buffer[10]);
326 | printf("%x \n", bulk_buffer[11]);
327 | printf("%x \n", bulk_buffer[12]);
328 | printf("%x \n", bulk_buffer[13]);
329 | printf("%x \n", bulk_buffer[14]);
330 | printf("%x \n", bulk_buffer[15]);
331 | printf("%x \n", bulk_buffer[16]);
332 | printf("%x \n", bulk_buffer[17]);
333 | printf("%x \n", bulk_buffer[18]);
334 | printf("%x \n", bulk_buffer[19]);
335 | printf("%x \n", bulk_buffer[20]);
336 | printf("%x \n", bulk_buffer[21]);
337 | printf("%x \n", bulk_buffer[22]);
338 | printf("%x \n", bulk_buffer[23]);
339 | printf("%x \n", bulk_buffer[24]);
340 | printf("%x \n", bulk_buffer[25]);
341 | printf("%x \n", bulk_buffer[26]);
342 | printf("%x \n", bulk_buffer[27]);
343 | printf("%x \n", bulk_buffer[28]);
344 | printf("%x \n", bulk_buffer[29]);
345 | printf("%x \n", bulk_buffer[30]);
346 | printf("%x \n", bulk_buffer[31]);
347 | printf("%x \n", bulk_buffer[32]);
348 | printf("%x \n", bulk_buffer[33]);
349 | printf("%x \n", bulk_buffer[34]);
350 | printf("%x \n", bulk_buffer[35]);
351 | printf("%x \n", bulk_buffer[36]);
352 | printf("%x \n", bulk_buffer[37]);
353 | printf("%x \n", bulk_buffer[38]);
354 | printf("%x \n", bulk_buffer[39]);
355 | printf("%x \n", bulk_buffer[40]);
356 | printf("%x \n", bulk_buffer[41]);
357 | printf("%x \n", bulk_buffer[42]);
358 | printf("%x \n", bulk_buffer[43]);
359 | printf("%x \n", bulk_buffer[44]);
360 | printf("%x \n", bulk_buffer[45]);
361 | printf("%x \n", bulk_buffer[46]);
362 | printf("%x \n", bulk_buffer[47]);
363 | printf("%x \n", bulk_buffer[48]);
364 | printf("%x \n", bulk_buffer[49]);
365 | printf("%x \n", bulk_buffer[50]);
366 | printf("%x \n", bulk_buffer[51]);
367 | printf("%x \n", bulk_buffer[52]);
368 | printf("%x \n", bulk_buffer[53]);
369 | printf("%x \n", bulk_buffer[54]);
370 | printf("%x \n", bulk_buffer[55]);
371 | printf("%x \n", bulk_buffer[56]);
372 | printf("%x \n", bulk_buffer[57]);
373 | printf("%x \n", bulk_buffer[58]);
374 | printf("%x \n", bulk_buffer[59]);
375 | printf("%x \n", bulk_buffer[60]);
376 | printf("%x \n", bulk_buffer[61]);
377 | printf("%x \n", bulk_buffer[62]);
378 | printf("%x \n", bulk_buffer[63]);
379 | printf("\n");
380 | #endif
381 |
382 | /* Verify if PS3mca send status succes code*/
383 | if (bulk_buffer[0] == RESPONSE_CODE & bulk_buffer[1] == RESPONSE_STATUS_SUCCES)
384 | {
385 | #if DEBUG
386 | printf("Autentication verified.\n\n");
387 | #endif
388 |
389 | /* Verify if is a memory card (SCPH-1020) or a PocketStation (SCPH-4000)*/
390 | if (bulk_buffer[6] == PS1CARD_REPLY_MC_ID_1 & bulk_buffer[7] == PS1CARD_REPLY_MC_ID_2 & bulk_buffer[8] == PS1CARD_REPLY_COMMAND_ACKNOWLEDGE_1 & bulk_buffer[9] == PS1CARD_REPLY_COMMAND_ACKNOWLEDGE_2 & bulk_buffer[10] == PS1CARD_REPLY_NUMBER_FRAME_1 & bulk_buffer[11] == PS1CARD_REPLY_NUMBER_FRAME_2 & bulk_buffer[12] == PS1CARD_REPLY_FRAME_SIZE_1 & bulk_buffer[13] == PS1CARD_REPLY_FRAME_SIZE_2)
391 | {
392 | printf("This card seems to be a original PS memory card (SCPH-1020), (SCPH-1170), (SCPH-119X) or a PocketStation (SCPH-4000).\n\n");
393 | }
394 |
395 | /* Other unknown memorycard*/
396 | else
397 | {
398 | printf("This seems to be a unofficial memorycard.\n");
399 | printf("See FAQ for PS1 get id command.\n\n");
400 | }
401 |
402 | }
403 |
404 | /* Verify if PS3mca send status wrong code*/
405 | else if (bulk_buffer[0] == RESPONSE_CODE & bulk_buffer[1] == RESPONSE_WRONG)
406 | {
407 | fprintf(stderr, "Autentication failed.\n");
408 | }
409 |
410 | /* Other unknown PS3mca error*/
411 | else
412 | {
413 | fprintf(stderr, "Unknown error on PS3mca protocol.\n");
414 | }
415 |
416 | }
417 | else
418 | {
419 | fprintf(stderr, "Received %d bytes, expected a maximum of %lu.\n", numBytes, sizeof(bulk_buffer));
420 | }
421 | }
422 | else
423 | {
424 | fprintf(stderr, "Error receiving message.\n");
425 | }
426 |
427 | /* Unmount the ps3mca*/
428 | close_ps3mca();
429 |
430 | return 0;
431 |
432 | }
433 | /* ----------------------------------------------------End of PS1 command get id----------------------------------------------------*/
434 |
435 |
436 |
437 |
438 |
439 |
440 | /* -------------------------------------------------------PS1 command read----------------------------------------------------------*/
441 | /* Command for read every single frame*/
442 | /* Reading Data from Memory Card
443 | Send Reply Comment
444 | 81h N/A Memory Card Access (unlike 01h=Controller access), dummy response
445 | 52h FLAG Send Read Command (ASCII "R"), Receive FLAG Byte
446 | 00h 5Ah Receive Memory Card ID1
447 | 00h 5Dh Receive Memory Card ID2
448 | MSB (00h) Send Address MSB ;\frame number (0..3FFh)
449 | LSB (pre) Send Address LSB ;/
450 | 00h 5Ch Receive Command Acknowledge 1 ;<-- late /ACK after this byte-pair
451 | 00h 5Dh Receive Command Acknowledge 2
452 | 00h MSB Receive Confirmed Address MSB
453 | 00h LSB Receive Confirmed Address LSB
454 | 00h ... Receive Data Frame (128 bytes)
455 | 00h CHK Receive Checksum (MSB xor LSB xor Data bytes)
456 | 00h 47h Receive Memory End Byte (should be always 47h="G"=Good for Read)
457 | */
458 | int PS1_read ()
459 | {
460 |
461 | if (open_ps3mca() != 0)
462 | {
463 | return 1;
464 | }
465 |
466 | // get the timestamp for file saving.
467 | char filename[70];
468 | time_t t = time(NULL);
469 | struct tm tm = *localtime(&t);
470 | sprintf(filename, "memory_card_out_%d-%02d-%02d_%02d-%02d-%02d.mcd", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
471 |
472 | uint8_t cmd_read[144];
473 | FILE *output=fopen( filename, "wb" ); /* Open and create a binary file output in writing*/
474 |
475 |
476 |
477 | /* Start of frame to frame loop*/
478 | for (frame = PS1CARD_MIN_FRAME; frame <= PS1CARD_MAX_FRAME; frame++)
479 | {
480 |
481 | /* Split frame value in two*/
482 | msb = (uint8_t)((frame & 0xFF00) >> 8);
483 | lsb = (uint8_t)(frame & 0x00FF);
484 | /* Clean command read*/
485 | memset(cmd_read, 0, sizeof(cmd_read));
486 | /* This is the write command for memory card (SCPH-1020) or PocketStation (SCPH-4000)*/
487 | /* first 4 byte are about ps3 memory card adapter protocol*/
488 | cmd_read[0] = PS3MCA_CMD_FIRST; /* First command for ps3mca protocol*/
489 | cmd_read[1] = PS3MCA_CMD_TYPE_LONG; /* PS1 type of command*/
490 | cmd_read[2] = 0x8c; /* 144-4=140=8ch lenght of command. Can be cmd_read[2]=sizeof(cmd_read)-4*/
491 | cmd_read[3] = 0x00; /* memset set all to 0x00, but I prefer to specify it a second time ;)*/
492 | /* this is the real command read with lenght of 140=0x8c*/
493 | cmd_read[4] = PS1CARD_CMD_MEMORY_CARD_ACCESS; /* Memory Card Access, principal command for any action with any memory card*/
494 | cmd_read[5] = PS1CARD_CMD_READ; /* Send Read Command (ASCII "R")*/
495 | cmd_read[6] = 0x00; /* Ask Memory Card ID1*/
496 | cmd_read[7] = 0x00; /* Ask Memory Card ID2*/
497 | cmd_read[8] = msb; /* First two significant digits of the frame value*/
498 | cmd_read[9] = lsb; /* Last two significant digits of the frame value*/
499 | /* Send 0x00 134 times (2 Command Acknowledge + 2 Confirmed Address + 128 Data Frame + 1 Checksum + 1 Memory End Byte)*/
500 |
501 |
502 |
503 | /* Send the message to endpoint with a 5000ms timeout. */
504 | res = libusb_bulk_transfer(handle, BULK_WRITE_ENDPOINT, cmd_read, sizeof(cmd_read), &numBytes, USB_TIMEOUT);
505 | if (res == 0)
506 | {
507 | /* See on screen what is transmitted for debug purpose*/
508 | #if DEBUG
509 | printf("\n%d bytes transmitted successfully on frame %d:\n", numBytes, frame);
510 | printf("Send:\n");
511 | printf("%x \n", cmd_read[0]);
512 | printf("%x \n", cmd_read[1]);
513 | printf("%x \n", cmd_read[2]);
514 | printf("%x \n", cmd_read[3]);
515 | printf("%x \n", cmd_read[4]);
516 | printf("%x \n", cmd_read[5]);
517 | printf("%x \n", cmd_read[6]);
518 | printf("%x \n", cmd_read[7]);
519 | printf("%x \n", cmd_read[8]);
520 | printf("%x \n", cmd_read[9]);
521 | printf("%x \n", cmd_read[10]);
522 | printf("%x \n", cmd_read[11]);
523 | printf("%x \n", cmd_read[12]);
524 | printf("%x \n", cmd_read[13]);
525 | printf("%x \n", cmd_read[142]);
526 | printf("%x \n", cmd_read[143]);
527 | printf("\n");
528 | #endif
529 | }
530 | else
531 | {
532 | fprintf(stderr, "Error sending message to device.\n");
533 | }
534 |
535 | /* Clean buffer.*/
536 | memset(ps1_ram_buffer, 0, sizeof(ps1_ram_buffer));
537 |
538 | /* Listen for a message.*/
539 | /* Wait up to 5 seconds for a message to arrive on endpoint*/
540 | res = libusb_bulk_transfer(handle, BULK_READ_ENDPOINT, ps1_ram_buffer, sizeof(ps1_ram_buffer), &numBytes, USB_TIMEOUT);
541 | if (0 == res)
542 | {
543 | if (numBytes <= sizeof(ps1_ram_buffer))
544 | {
545 | /* Verify if PS3mca send status succes code*/
546 | if (ps1_ram_buffer[0] == RESPONSE_CODE & ps1_ram_buffer[1] == RESPONSE_STATUS_SUCCES)
547 | {
548 | #if DEBUG
549 | printf("Autentication verified on frame %d.\n", frame);
550 | #endif
551 | #if VERBOSE
552 | printf("Reading frame %d.\n", frame);
553 | #endif
554 | }
555 |
556 | /* Verify if PS3mca send status wrong code*/
557 | else if (ps1_ram_buffer[0] == RESPONSE_CODE & ps1_ram_buffer[1] == RESPONSE_WRONG)
558 | {
559 | fprintf(stderr, "Autentication failed on frame %d.\n", frame);
560 | }
561 |
562 | /* Other unknown PS3mca error*/
563 | else
564 | {
565 | fprintf(stderr, "Unknown error on PS3mca protocol on frame %d.\n", frame);
566 | }
567 |
568 | /* Verify command acknowledge*/
569 | if (ps1_ram_buffer[10] == PS1CARD_REPLY_COMMAND_ACKNOWLEDGE_1 & ps1_ram_buffer[11] == PS1CARD_REPLY_COMMAND_ACKNOWLEDGE_2)
570 | {
571 | #if DEBUG
572 | printf("Good command acknowledge on frame %d.\n", frame);
573 | #endif
574 | }
575 |
576 | /* Unknown command acknowledge error*/
577 | else
578 | {
579 | fprintf(stderr, "Unknown command acknowledge error on frame %d.\n", frame);
580 | }
581 |
582 | /* Verify msb and lsb*/
583 | if (ps1_ram_buffer[12] == msb & ps1_ram_buffer[13] == lsb)
584 | {
585 | #if DEBUG
586 | printf("Confirmed frame number on frame %d.\n", frame);
587 | #endif
588 | }
589 |
590 | /* Unknown frame error*/
591 | else
592 | {
593 | fprintf(stderr, "Unknown frame number error on frame %d.\n", frame);
594 | fprintf(stderr, "Return frame number %d %d.\n\n", ps1_ram_buffer[12], ps1_ram_buffer[13]);
595 | }
596 |
597 | /* This permit to select and save only the received Data Frame (PS1CARD_FRAME_SIZE=128 bytes).*/
598 | /* First 14 bytes are about PS3mca (4 bytes) and PS1 (10 bytes) protocol.*/
599 | /* Last 2 bytes are Checksum & Memory End Byte.*/
600 | fwrite(&ps1_ram_buffer[14], 1, PS1CARD_FRAME_SIZE, output);
601 |
602 | /* Clean checksum.*/
603 | checksum = 0x00;
604 |
605 | /* Calc supposed checksum.*/
606 | for (c = 12; c < 12+2+PS1CARD_FRAME_SIZE; c++) /* Loop of msb + lsb + all data bytes*/
607 | {
608 | checksum = checksum ^ ps1_ram_buffer[c]; /* Checksum = MSB xor LSB xor all Data bytes*/
609 | }
610 |
611 | /* Verify checksum*/
612 | if (ps1_ram_buffer[142] == checksum)
613 | {
614 | #if DEBUG
615 | printf("Good checksum on frame %d.\n", frame);
616 | #endif
617 | }
618 |
619 | /* Checksum error*/
620 | else
621 | {
622 | fprintf(stderr, "Incorrect checksum on frame %d.\n", frame);
623 | fprintf(stderr, "Received %x, should be %x.\n\n", ps1_ram_buffer[142], checksum);
624 | }
625 |
626 |
627 | /* Verify MEB*/
628 | if (ps1_ram_buffer[143] == PS1CARD_REPLY_MEB_GOOD)
629 | {
630 | #if DEBUG
631 | printf("Good Memory End Byte on frame %d.\n", frame);
632 | #endif
633 | }
634 |
635 | /* Other unknown MEB error*/
636 | else
637 | {
638 | fprintf(stderr, "Unknown Memory End Byte on frame %d.\n", frame);
639 | fprintf(stderr, "Received %x, should be 47.\n\n", ps1_ram_buffer[143]);
640 | }
641 |
642 |
643 | }
644 | else
645 | {
646 | fprintf(stderr, "Received %d bytes, expected a maximum of %lu bytes on frame %d.\n", numBytes, sizeof(ps1_ram_buffer), frame);
647 | }
648 | }
649 |
650 |
651 | else
652 | {
653 | fprintf(stderr, "Error receiving message.\n");
654 | }
655 |
656 | }
657 |
658 | /* Clean and close the file output*/
659 | fflush(output);
660 | fclose(output);
661 |
662 | /* Unmount the ps3mca*/
663 | close_ps3mca();
664 |
665 | return 0;
666 |
667 | }
668 | /* ----------------------------------------------------End of PS1 command read------------------------------------------------------*/
669 |
670 |
671 |
672 |
673 |
674 |
675 |
676 |
677 | /* -------------------------------------------------------PS1 command write----------------------------------------------------------*/
678 | /* Command for start writing every single frame*/
679 | /* Writing Data to Memory Card
680 | Send Reply Comment
681 | 81h N/A Memory Card Access (unlike 01h=Controller access), dummy response
682 | 57h FLAG Send Write Command (ASCII "W"), Receive FLAG Byte
683 | 00h 5Ah Receive Memory Card ID1
684 | 00h 5Dh Receive Memory Card ID2
685 | MSB (00h) Send Address MSB ;\frame number (0..3FFh)
686 | LSB (pre) Send Address LSB ;/
687 | ... (pre) Send Data Sector (128 bytes)
688 | CHK (pre) Send Checksum (MSB xor LSB xor Data bytes)
689 | 00h 5Ch Receive Command Acknowledge 1
690 | 00h 5Dh Receive Command Acknowledge 2
691 | 00h 4xh Receive Memory End Byte (47h=Good, 4Eh=BadChecksum, FFh=BadSector)
692 | */
693 | int PS1_write ()
694 | {
695 |
696 | if (open_ps3mca() != 0)
697 | {
698 | return 1;
699 | }
700 |
701 | uint8_t cmd_write[142];
702 | FILE *input=fopen( "write.mcd", "rb" ); /* Open write.mcd in reading*/
703 |
704 | /* Verify first frame and last frame value, if impossible overwrite it*/
705 | if (!((first_frame >= PS1CARD_MIN_FRAME) && (first_frame <= PS1CARD_MAX_FRAME) && (last_frame >= PS1CARD_MIN_FRAME) && (last_frame <= PS1CARD_MAX_FRAME) && (first_frame <= last_frame)))
706 | {
707 | fprintf(stderr, "Error on number of sector, possible values are 0 to 1023.\n");
708 | fprintf(stderr, "First frame must be minor or equal of last frame.\n");
709 | fprintf(stderr, "Overwrite the frame sector by selecting all the memory card.\n");
710 | fprintf(stderr, "The original first_frame was %d, overwrited to 0\n", first_frame);
711 | fprintf(stderr, "The original last_frame was %d, overwrited to 1023\n", last_frame);
712 | first_frame = PS1CARD_MIN_FRAME;
713 | last_frame = PS1CARD_MAX_FRAME;
714 | }
715 |
716 | /* Start of frame to frame loop*/
717 | for (frame = first_frame; frame <= last_frame; frame++)
718 | {
719 |
720 | /* Split frame value in two*/
721 | msb = (uint8_t)((frame & 0xFF00) >> 8);
722 | lsb = (uint8_t)(frame & 0x00FF);
723 | /* Clean command write*/
724 | memset(cmd_write, 0, sizeof(cmd_write));
725 | /* This is the write command for memory card (SCPH-1020) or PocketStation (SCPH-4000)*/
726 | /* first 4 byte are about ps3 memory card adapter protocol*/
727 | cmd_write[0] = PS3MCA_CMD_FIRST; /* First command for ps3mca protocol*/
728 | cmd_write[1] = PS3MCA_CMD_TYPE_LONG; /* PS1 type of command*/
729 | cmd_write[2] = 0x8a; /* 142-4=138=8ah lenght of command. Can be cmd_write[2]=sizeof(cmd_write)-4*/
730 | cmd_write[3] = 0x00; /* memset set all to 0x00, but I prefer to specify it a second time ;)*/
731 | /* this is the real command write with lenght of 138=0x8a*/
732 | cmd_write[4] = PS1CARD_CMD_MEMORY_CARD_ACCESS; /* Memory Card Access, principal command for any action with any memory card*/
733 | cmd_write[5] = PS1CARD_CMD_WRITE; /* Send write Command (ASCII "W")*/
734 | cmd_write[6] = 0x00; /* Ask Memory Card ID1*/
735 | cmd_write[7] = 0x00; /* Ask Memory Card ID2*/
736 | cmd_write[8] = msb; /* First two significant digits of the frame value*/
737 | cmd_write[9] = lsb; /* Last two significant digits of the frame value*/
738 | fseek ( input, frame*PS1CARD_FRAME_SIZE, SEEK_SET); /* Read the file since frame value, needed for start on frame different to 0*/
739 | fread ( &cmd_write[10], 1, PS1CARD_FRAME_SIZE, input);/* Send Data Sector (128 bytes)*/
740 | cmd_write[139] = 0x00; /* Receive Command Acknowledge 1*/
741 | cmd_write[140] = 0x00; /* Receive Command Acknowledge 2*/
742 | cmd_write[141] = 0x00; /* Receive Memory End Byte (47h=Good, 4Eh=BadChecksum, FFh=BadSector)*/
743 |
744 |
745 |
746 | /* Send the message to endpoint with a 5000ms timeout. */
747 | res = libusb_bulk_transfer(handle, BULK_WRITE_ENDPOINT, cmd_write, sizeof(cmd_write), &numBytes, USB_TIMEOUT);
748 | if (res == 0)
749 | {
750 | /* See on screen what is transmitted for debug purpose*/
751 | #if DEBUG
752 | printf("%d bytes transmitted successfully on frame %d.\n", numBytes, frame);
753 | printf("Send:\n");
754 | printf("%x \n", cmd_write[0]);
755 | printf("%x \n", cmd_write[1]);
756 | printf("%x \n", cmd_write[2]);
757 | printf("%x \n", cmd_write[3]);
758 | printf("%x \n", cmd_write[4]);
759 | printf("%x \n", cmd_write[5]);
760 | printf("%x \n", cmd_write[6]);
761 | printf("%x \n", cmd_write[7]);
762 | printf("%x \n", cmd_write[8]);
763 | printf("%x \n", cmd_write[9]);
764 | printf("%x \n", cmd_write[10]);
765 | printf("%x \n", cmd_write[11]);
766 | printf("%x \n", cmd_write[12]);
767 | printf("%x \n", cmd_write[13]);
768 | printf("%x \n", cmd_write[14]);
769 | printf("%x \n", cmd_write[15]);
770 | printf("%x \n", cmd_write[16]);
771 | printf("%x \n", cmd_write[17]);
772 | printf("%x \n", cmd_write[18]);
773 | printf("%x \n", cmd_write[19]);
774 | printf("%x \n", cmd_write[20]);
775 | printf("%x \n", cmd_write[21]);
776 | printf("%x \n", cmd_write[22]);
777 | printf("%x \n", cmd_write[23]);
778 | printf("%x \n", cmd_write[24]);
779 | printf("%x \n", cmd_write[25]);
780 | printf("%x \n", cmd_write[26]);
781 | printf("%x \n", cmd_write[27]);
782 | printf("%x \n", cmd_write[28]);
783 | printf("%x \n", cmd_write[29]);
784 | printf("%x \n", cmd_write[30]);
785 | printf("%x \n", cmd_write[31]);
786 | printf("%x \n", cmd_write[32]);
787 | printf("%x \n", cmd_write[33]);
788 | printf("%x \n", cmd_write[34]);
789 | printf("%x \n", cmd_write[35]);
790 | printf("%x \n", cmd_write[36]);
791 | printf("%x \n", cmd_write[37]);
792 | printf("%x \n", cmd_write[38]);
793 | printf("%x \n", cmd_write[39]);
794 | printf("%x \n", cmd_write[40]);
795 | printf("%x \n", cmd_write[41]);
796 | printf("%x \n", cmd_write[42]);
797 | printf("%x \n", cmd_write[43]);
798 | printf("%x \n", cmd_write[44]);
799 | printf("%x \n", cmd_write[45]);
800 | printf("%x \n", cmd_write[46]);
801 | printf("%x \n", cmd_write[47]);
802 | printf("%x \n", cmd_write[48]);
803 | printf("%x \n", cmd_write[49]);
804 | printf("%x \n", cmd_write[50]);
805 | printf("%x \n", cmd_write[51]);
806 | printf("%x \n", cmd_write[52]);
807 | printf("%x \n", cmd_write[53]);
808 | printf("%x \n", cmd_write[54]);
809 | printf("%x \n", cmd_write[55]);
810 | printf("%x \n", cmd_write[56]);
811 | printf("%x \n", cmd_write[57]);
812 | printf("%x \n", cmd_write[58]);
813 | printf("%x \n", cmd_write[59]);
814 | printf("%x \n", cmd_write[60]);
815 | printf("%x \n", cmd_write[61]);
816 | printf("%x \n", cmd_write[62]);
817 | printf("%x \n", cmd_write[63]);
818 | printf("%x \n", cmd_write[64]);
819 | printf("%x \n", cmd_write[65]);
820 | printf("%x \n", cmd_write[66]);
821 | printf("%x \n", cmd_write[67]);
822 | printf("%x \n", cmd_write[68]);
823 | printf("%x \n", cmd_write[69]);
824 | printf("%x \n", cmd_write[70]);
825 | printf("%x \n", cmd_write[71]);
826 | printf("%x \n", cmd_write[72]);
827 | printf("%x \n", cmd_write[73]);
828 | printf("%x \n", cmd_write[74]);
829 | printf("%x \n", cmd_write[75]);
830 | printf("%x \n", cmd_write[76]);
831 | printf("%x \n", cmd_write[77]);
832 | printf("%x \n", cmd_write[78]);
833 | printf("%x \n", cmd_write[79]);
834 | printf("%x \n", cmd_write[80]);
835 | printf("%x \n", cmd_write[81]);
836 | printf("%x \n", cmd_write[82]);
837 | printf("%x \n", cmd_write[83]);
838 | printf("%x \n", cmd_write[84]);
839 | printf("%x \n", cmd_write[85]);
840 | printf("%x \n", cmd_write[86]);
841 | printf("%x \n", cmd_write[87]);
842 | printf("%x \n", cmd_write[88]);
843 | printf("%x \n", cmd_write[89]);
844 | printf("%x \n", cmd_write[90]);
845 | printf("%x \n", cmd_write[91]);
846 | printf("%x \n", cmd_write[92]);
847 | printf("%x \n", cmd_write[93]);
848 | printf("%x \n", cmd_write[94]);
849 | printf("%x \n", cmd_write[95]);
850 | printf("%x \n", cmd_write[96]);
851 | printf("%x \n", cmd_write[97]);
852 | printf("%x \n", cmd_write[98]);
853 | printf("%x \n", cmd_write[99]);
854 | printf("%x \n", cmd_write[100]);
855 | printf("%x \n", cmd_write[101]);
856 | printf("%x \n", cmd_write[102]);
857 | printf("%x \n", cmd_write[103]);
858 | printf("%x \n", cmd_write[104]);
859 | printf("%x \n", cmd_write[105]);
860 | printf("%x \n", cmd_write[106]);
861 | printf("%x \n", cmd_write[107]);
862 | printf("%x \n", cmd_write[108]);
863 | printf("%x \n", cmd_write[109]);
864 | printf("%x \n", cmd_write[110]);
865 | printf("%x \n", cmd_write[111]);
866 | printf("%x \n", cmd_write[112]);
867 | printf("%x \n", cmd_write[113]);
868 | printf("%x \n", cmd_write[114]);
869 | printf("%x \n", cmd_write[115]);
870 | printf("%x \n", cmd_write[116]);
871 | printf("%x \n", cmd_write[117]);
872 | printf("%x \n", cmd_write[118]);
873 | printf("%x \n", cmd_write[119]);
874 | printf("%x \n", cmd_write[120]);
875 | printf("%x \n", cmd_write[121]);
876 | printf("%x \n", cmd_write[122]);
877 | printf("%x \n", cmd_write[123]);
878 | printf("%x \n", cmd_write[124]);
879 | printf("%x \n", cmd_write[125]);
880 | printf("%x \n", cmd_write[126]);
881 | printf("%x \n", cmd_write[127]);
882 | printf("%x \n", cmd_write[128]);
883 | printf("%x \n", cmd_write[129]);
884 | printf("%x \n", cmd_write[130]);
885 | printf("%x \n", cmd_write[131]);
886 | printf("%x \n", cmd_write[132]);
887 | printf("%x \n", cmd_write[133]);
888 | printf("%x \n", cmd_write[134]);
889 | printf("%x \n", cmd_write[135]);
890 | printf("%x \n", cmd_write[136]);
891 | printf("%x \n", cmd_write[137]);
892 | printf("%x \n", cmd_write[138]);
893 | printf("%x \n", cmd_write[139]);
894 | printf("%x \n", cmd_write[140]);
895 | printf("%x \n", cmd_write[141]);
896 | #endif
897 |
898 | #if VERBOSE
899 | printf("Writing frame %d.\n", frame);
900 | #endif
901 | }
902 | else
903 | {
904 | fprintf(stderr, "Error sending message to device.\n");
905 | }
906 |
907 |
908 | /* Listen for a message.*/
909 | /* Wait up to 5 seconds for a message to arrive on endpoint*/
910 | res = libusb_bulk_transfer(handle, BULK_READ_ENDPOINT, ps1_ram_buffer, sizeof(ps1_ram_buffer), &numBytes, USB_TIMEOUT);
911 | if (0 == res)
912 | {
913 | if (numBytes <= sizeof(ps1_ram_buffer))
914 | {
915 | /* Verify if PS3mca send status succes code*/
916 | if (ps1_ram_buffer[0] == RESPONSE_CODE & ps1_ram_buffer[1] == RESPONSE_STATUS_SUCCES)
917 | {
918 | #if DEBUG
919 | printf("Autentication verified on frame %d.\n", frame);
920 | #endif
921 | }
922 |
923 | /* Verify if PS3mca send status wrong code*/
924 | else if (ps1_ram_buffer[0] == RESPONSE_CODE & ps1_ram_buffer[1] == RESPONSE_WRONG)
925 | {
926 | fprintf(stderr, "Autentication failed on frame %d.\n", frame);
927 | }
928 |
929 | /* Other unknown PS3mca error*/
930 | else
931 | {
932 | fprintf(stderr, "Unknown error on PS3mca protocol on frame %d.\n", frame);
933 | }
934 |
935 |
936 | /* Verify Memory End Byte (0x47h=Good)*/
937 | if (ps1_ram_buffer[141] == PS1CARD_REPLY_MEB_GOOD)
938 | {
939 | #if DEBUG
940 | printf("Good Memory End Byte on frame %d.\n", frame);
941 | #endif
942 | }
943 |
944 | /* Verify Memory End Byte (0x4E=BadChecksum)*/
945 | else if (ps1_ram_buffer[141] == PS1CARD_REPLY_MEB_BAD_CHECKSUM)
946 | {
947 | fprintf(stderr, "Bad Checksum Memory End Byte on frame %d.\n", frame);
948 |
949 | checksum = 0x00; /* Clean checksum*/
950 | for (c = 8; c < 8+2+PS1CARD_FRAME_SIZE; c++) /* Loop started at msb(8) and finished at last data byte(137)*/
951 | {
952 | checksum = checksum ^ cmd_write[c]; /* Checksum = MSB xor LSB xor all Data bytes*/
953 | }
954 | fprintf(stderr, "In your image checksum is %x, should be %x.\n", cmd_write[138], checksum);
955 | }
956 |
957 | /* Verify Memory End Byte (0xFF=BadFrame)*/
958 | else if (ps1_ram_buffer[141] == PS1CARD_REPLY_MEB_BAD_FRAME)
959 | {
960 | fprintf(stderr, "Bad frame Memory End Byte on frame %d.\n", frame);
961 | }
962 |
963 | /* Verify Memory End Byte (0xFD=Reject write to Directory Entries of currently executed file)*/
964 | else if (ps1_ram_buffer[141] == POCKETSTATION_REPLY_REJECT_EXECUTED)
965 | {
966 | fprintf(stderr, "WARNING Reject write to Directory Entries of currently executed file on frame %d.\n", frame);
967 | fprintf(stderr, "aborting for prevent to delete the currently executed file.\n");
968 | /* Clean and close the file input*/
969 | fflush(input);
970 | fclose(input);
971 | /* Unmount the ps3mca*/
972 | close_ps3mca();
973 | /* Close program with error status*/
974 | return -1;
975 | }
976 |
977 | /* Verify Memory End Byte (0xFE=Reject write to write-protected Broken Frame region)*/
978 | else if (ps1_ram_buffer[141] == POCKETSTATION_REPLY_REJECT_PROTECTED)
979 | {
980 | fprintf(stderr, "WARNING The write-protection is enabled by ComFlags.bit10 on frame %d.\n", frame);
981 | fprintf(stderr, "Please unable write protection.\nAborting...\n");
982 | /* Clean and close the file input*/
983 | fflush(input);
984 | fclose(input);
985 | /* Unmount the ps3mca*/
986 | close_ps3mca();
987 | /* Close program with error status*/
988 | return -1;
989 | }
990 |
991 | }
992 | else
993 | {
994 | fprintf(stderr, "Received %d bytes, expected a maximum of %lu on frame %d.\n", numBytes, sizeof(ps1_ram_buffer), frame);
995 | }
996 | }
997 |
998 |
999 | /* Wait for give time to write, on original card (slower) this time is important.*/
1000 | /* This time can make slower the writing data, if it's possible can be better implement directly the clock.*/
1001 | //sleep(1);
1002 | delay(writing_delay);
1003 | #if DEBUG
1004 | printf("Wait %dms for write the frame.\n\n", writing_delay);
1005 | #endif
1006 |
1007 |
1008 | /* Clean buffer.*/
1009 | memset(ps1_ram_buffer, 0, sizeof(ps1_ram_buffer));
1010 |
1011 | /* End of frame to frame loop*/
1012 | }
1013 |
1014 | /* Clean and close the file input*/
1015 | fflush(input);
1016 | fclose(input);
1017 |
1018 | /* Unmount the ps3mca*/
1019 | close_ps3mca();
1020 |
1021 | return 0;
1022 |
1023 | }
1024 | /* ----------------------------------------------------End of PS1 command write------------------------------------------------------*/
1025 |
1026 |
1027 |
1028 |
1029 |
1030 |
1031 |
1032 |
1033 |
1034 | /*-----------------------------------------------------------Main program-----------------------------------------------------------*/
1035 | int main(int argc, char* argv[])
1036 | {
1037 |
1038 | if (argc > 4)
1039 | {
1040 | fprintf(stderr, "Warning: uncorrect command. See usage of program.\n");
1041 | }
1042 |
1043 | if (argc < 2)
1044 | {
1045 | fprintf(stderr, "No options given!\n");
1046 | return 1;
1047 | }
1048 | else
1049 | {
1050 | /* Switch-case argv[1][0] select what command use*/
1051 | switch (argv[1][0])
1052 | {
1053 | default:
1054 | fprintf(stderr, "Unknown option %c\n", argv[1][0]);
1055 | break;
1056 |
1057 | case 'v':
1058 | /* If tipe "ps3mca-ps1 v"*/
1059 | if (argc == (2))
1060 | {
1061 | return PS3mca_verify_card ();
1062 | }
1063 | else
1064 | {
1065 | fprintf(stderr, "Warning: %s only processes one option at a time! %d were given.\n", argv[0], argc - 1);
1066 | return 1;
1067 | }
1068 | break;
1069 |
1070 | case 's':
1071 | /* If tipe "ps3mca-ps1 s"*/
1072 | if (argc == (2))
1073 | {
1074 | return PS1_get_id ();
1075 | }
1076 | else
1077 | {
1078 | fprintf(stderr, "Warning: %s only processes one option at a time! %d were given.\n", argv[0], argc - 1);
1079 | return 1;
1080 | }
1081 | break;
1082 |
1083 | case 'r':
1084 | /* If tipe "ps3mca-ps1 r"*/
1085 | if (argc == (2))
1086 | {
1087 | return PS1_read ();
1088 | }
1089 | else
1090 | {
1091 | fprintf(stderr, "Warning: %s only processes one option at a time! %d were given.\n", argv[0], argc - 1);
1092 | return 1;
1093 | }
1094 | break;
1095 |
1096 | case 'w':
1097 | /* If tipe "ps3mca-ps1 w"*/
1098 | if (argc == (2))
1099 | {
1100 | first_frame = PS1CARD_MIN_FRAME;
1101 | last_frame = PS1CARD_MAX_FRAME;
1102 | return PS1_write ();
1103 | }
1104 | /* If type "ps3mca-ps1 w number number"*/
1105 | else if (argc == (2+2))
1106 | {
1107 | first_frame = atoi(argv[2]);
1108 | last_frame = atoi(argv[3]);
1109 | return PS1_write ();
1110 | }
1111 | else
1112 | {
1113 | fprintf(stderr, "Error on usage of wirte command.\n");
1114 | return 1;
1115 | }
1116 | break;
1117 | }
1118 |
1119 |
1120 | }
1121 |
1122 | return 1;
1123 |
1124 | }
1125 | /*--------------------------------------------------------End of Main program-------------------------------------------------------*/
1126 |
1127 |
--------------------------------------------------------------------------------
/src/ps3mca-ps1-driver.h:
--------------------------------------------------------------------------------
1 | /*
2 | * this is a libusb program to communicate with the PlayStation 3 Memory Card Adaptor CECHZM1 (SCPH-98042) for PS1 cards (SCPH-1020,
3 | * SCPH-1170 and SCPH-119X), maybe the PocketStation (SCPH-4000) and maybe other cards or device (like the MEMORY DISK DRIVE).
4 | *
5 | * Copyright (C) 2017 Paolo Caroni
6 | *
7 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as
8 | * published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 | * See the GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License along with this program.
15 | * If not, see .
16 | */
17 |
18 |
19 | /* -------------------------------------------------PS3mca definitions and protocol-------------------------------------------------*/
20 | /* Define the USB device (CECHZM1)*/
21 | uint16_t USB_VENDOR = 0x054c; /* Sony Corp.*/
22 | uint16_t USB_PRODUCT = 0x02ea; /* PlayStation 3 Memory Card Adaptor*/
23 | unsigned int USB_TIMEOUT = 5000; /* USB timeout (milliseconds)*/
24 |
25 | uint8_t BULK_WRITE_ENDPOINT = 0x02; /* bEndpointAddress 0x02 EP 2 OUT (Bulk)*/
26 | uint8_t BULK_READ_ENDPOINT = 0x81; /* bEndpointAddress 0x81 EP 1 IN (Bulk)*/
27 | uint8_t bulk_buffer[64]; /* wMaxPacketSize 0x0040 1x 64 bytes*/
28 |
29 | /*uint8_t INTERRUPT_READ_ENDPOINT = 0x83; /* bEndpointAddress 0x83 EP 3 IN (Interrupt)*/
30 | /*int INTERRUPT_LENGTH = 1; /* wMaxPacketSize 0x0001 1x 1 bytes*/
31 |
32 | /* PS3mca commands*/
33 | uint8_t PS3MCA_CMD_FIRST = 0xaa; /* First command for ps3mca protocol*/
34 | uint8_t PS3MCA_CMD_TYPE_LONG = 0x42; /* PS1 type of command*/
35 | uint8_t PS3MCA_CMD_VERIFY_CARD_TYPE = 0x40; /* Verify what type of card (PS1 or PS2)*/
36 |
37 | /* PS3mca autentication response code*/
38 | uint8_t RESPONSE_CODE = 0x55; /* Expected response to PS3MCA_CMD_FIRST*/
39 | uint8_t RESPONSE_STATUS_SUCCES = 0x5a; /* Expected response to PS3MCA_CMD_TYPE_LONG*/
40 | uint8_t RESPONSE_WRONG = 0xaf; /* Response to PS3MCA_CMD_TYPE_LONG if autentication is failed*/
41 | uint8_t RESPONSE_PS1_CARD = 0x01; /* This is a PS1 card*/
42 | uint8_t RESPONSE_PS2_CARD = 0x02; /* This is a PS2 card, unused with this driver*/
43 |
44 | /* ----------------------------------------------End of PS3mca definitions and protocol---------------------------------------------*/
45 |
46 |
47 |
48 |
49 |
50 | /* ---------------------------------------------PS1 Memory Card definitions----------------------------------------------------------*/
51 | /* Information for PS1 memory card (SCPH-1020, SCPH-1170 and SCPH-119X)*/
52 | /*int PS1CARD_TOTAL_SIZE = 131072; /* 1024x128=131.072 bytes=131,1 kB=128 KiB=1 Megabit*/
53 | int PS1CARD_FRAME_SIZE = 128; /* frame is the equivalent of a disk sector=128 bytes*/
54 | uint16_t PS1CARD_MIN_FRAME = 0x0000; /* 0000h (0) min value frame*/
55 | uint16_t PS1CARD_MAX_FRAME = 0x03ff; /* 03ffh (1023) max value of frame (1024 total frame number but 0 is the first)*/
56 | uint16_t frame; /* Frame value, 0000h to 03ffh*/
57 | uint8_t msb; /* First two significant digits of the frame value*/
58 | uint8_t lsb; /* Last two significant digits of the frame value*/
59 | uint8_t checksum; /* Checksum variable*/
60 | uint8_t ps1_ram_buffer[256]; /* 256 bytes of RAM on chip*/
61 | /*int PS1CARD_BLOCK_SIZE = 8192; /* single block 1024x8=8192 bytes*/
62 | /*int PS1CARD_MAX_BLOCK = 16; /* max number of block (however 1 is lost for formatting MC)*/
63 |
64 | /* -------------------------------------------End of PS1 Memory Card definitions------------------------------------------------------*/
65 |
66 |
67 |
68 |
69 |
70 |
71 | /* --------------------------------------------------PS1 Memory Card commands list----------------------------------------------------*/
72 | /* Command list*/
73 | uint8_t PS1CARD_CMD_MEMORY_CARD_ACCESS = 0x81; /* Memory Card Access, principal command for any action with any memory card*/
74 |
75 | /* Classic PS1 commands list*/
76 | uint8_t PS1CARD_CMD_READ = 0x52; /* Send Read Command (ASCII "R")*/
77 | uint8_t PS1CARD_CMD_GET_ID = 0x53; /* Send Get ID Command (ASCII "S")*/
78 | uint8_t PS1CARD_CMD_WRITE = 0x57; /* Send Write Command (ASCII "W")*/
79 |
80 | /* Expected reply from memory card (SCPH-1020) or PocketStation (SCPH-4000) or maybe other cards devices*/
81 | uint8_t PS1CARD_REPLY_MC_ID_1 = 0x5a; /* Memory Card ID1*/
82 | uint8_t PS1CARD_REPLY_MC_ID_2 = 0x5d; /* Memory Card ID2*/
83 |
84 | uint8_t PS1CARD_REPLY_COMMAND_ACKNOWLEDGE_1 = 0x5c; /* Command Acknowledge 1*/
85 | uint8_t PS1CARD_REPLY_COMMAND_ACKNOWLEDGE_2 = 0x5d; /* Command Acknowledge 2*/
86 |
87 | uint8_t PS1CARD_REPLY_MEB_GOOD = 0x47; /* Memory End Byte Good (ASCII "G")*/
88 | uint8_t PS1CARD_REPLY_MEB_BAD_CHECKSUM = 0x4e; /* Memory End Byte BadChecksum (ASCII "N")*/
89 | uint8_t PS1CARD_REPLY_MEB_BAD_FRAME = 0xff; /* Memory End Byte BadFrame*/
90 | uint8_t POCKETSTATION_REPLY_REJECT_EXECUTED = 0xfd; /* Reject write to Directory Entries of currently executed file*/
91 | uint8_t POCKETSTATION_REPLY_REJECT_PROTECTED = 0xfe; /* Reject write to write-protected Broken Frame region*/
92 |
93 | uint8_t PS1CARD_REPLY_NUMBER_FRAME_1 = 0x04; /* First two significant digits of the number of frame*/
94 | uint8_t PS1CARD_REPLY_NUMBER_FRAME_2 = 0x00; /* Last two significant digits of the number of frame (0400h=1024)*/
95 | uint8_t PS1CARD_REPLY_FRAME_SIZE_1 = 0x00; /* First two significant digits of the frame size*/
96 | uint8_t PS1CARD_REPLY_FRAME_SIZE_2 = 0x80; /* Last two significant digits of the frame size (0080h=128)*/
97 |
98 |
99 | /* -----------------------------------------------End of PS1 Memory Card commands list------------------------------------------------*/
100 |
101 |
102 |
103 |
104 |
105 | /* --------------------------------------------------------Program definitions--------------------------------------------------------*/
106 | /* Variables list*/
107 | int writing_delay = 50; /* Milliseconds to wait on every frame*/
108 | uint16_t first_frame; /* First frame to be writed*/
109 | uint16_t last_frame; /* Last frame to be wited*/
110 |
111 | /* ----------------------------------------------------End of Program definitions-----------------------------------------------------*/
112 |
113 |
114 |
115 |
--------------------------------------------------------------------------------