mirror of https://github.com/PCSX2/pcsx2.git
plugins: Remove cdvdlinuz
Superseded by PCSX2 internal ISO reader and cdvdGigaherz.
This commit is contained in:
parent
9b110d8c3c
commit
03acb22212
|
@ -290,7 +290,6 @@ endif()
|
|||
#-------------------------------------------------------------------------------
|
||||
# Super-seeded by cdvdGigaherz
|
||||
set(CDVDpeops FALSE)
|
||||
set(CDVDlinuz FALSE) # used to be compiled on linux
|
||||
|
||||
# [TODO] Write CMakeLists.txt for these plugins. (or not ;) )
|
||||
set(PeopsSPU2 FALSE)
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
Changes:
|
||||
-------
|
||||
CDVDlinuz v0.4 (efp):
|
||||
* Moved all "threaded" code to CDVDEFP (actual directory) (efp)
|
||||
* Copied mid-level (not low-level) device drivers from CDVDisoEFP (efp)
|
||||
* In Windows, when newly selected from the PCSX2 configure screen, CDVDinit()
|
||||
(as well as InitConf()) are not called. Fixed. (efp)
|
||||
|
||||
CDVDEFP v0.3 (efp):
|
||||
* Protection against "Interrupted system call" errors enhanced (threading)
|
||||
* Simplified ReadLoop completion detection code (threading)
|
||||
* Separated buffer.c from device.c for cross-CDVD portability.
|
||||
|
||||
CDVDEFP v0.2 (efp):
|
||||
* Separated out device command calls (for easier maintainability)
|
||||
* Added a read cache (currently sized at 512kb)
|
||||
* Added threading code (pthreads, because it's portable)
|
||||
* With threading comes tray polling (currently at 1/sec)
|
||||
* With threading comes a read-ahead function (currently set to 64kb)
|
||||
|
||||
CDVDEFP v0.1 (efp):
|
||||
* Updated to 0.6.0 (beta) specs
|
||||
* Removed Glade influence in Configure/About interfaces
|
||||
* Added O_NONBLOCK so disc is not required to be in drive when Pcsx2 starts
|
||||
discs can now be switched out at will.
|
||||
* Separated CD and DVD access calls for better maintainability
|
||||
* Removed 2GB byte limitation to DVD sector calls
|
||||
* Collected all info on disc when disc is first inserted
|
||||
* Expanded disc type detection to meet 0.6.0 specs.
|
||||
CD/DVD detection. PS1/PS2/CDDA/other detection.
|
||||
* Multilevel Debug info added (currently controlled by #defines)
|
||||
|
||||
CDVDlinuz v0.3 (linuzappz):
|
||||
* Updated to 0.4.3 specs
|
||||
|
||||
CDVDlinuz v0.2 (linuzappz):
|
||||
* Updated to 0.2.9 specs
|
||||
|
||||
CDVDlinuz v0.1 (linuzappz):
|
||||
* First Release
|
||||
* Tested with Pcsx2
|
||||
|
||||
Email: <linuzappz@hotmail.com>
|
|
@ -1,342 +0,0 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
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. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
||||
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
# CDVDlinuz Plugin
|
||||
|
||||
# plugin name
|
||||
set(Output CDVDlinuz)
|
||||
set(CDVDlinuzFinalFlags -D_LARGEFILE64_SOURCE)
|
||||
|
||||
# CDVDlinuz sources
|
||||
set(CDVDlinuzSources
|
||||
buffer.c
|
||||
convert.c
|
||||
ini.c
|
||||
version.c)
|
||||
|
||||
# CDVDlinuz headers
|
||||
set(CDVDlinuzHeaders
|
||||
buffer.h
|
||||
convert.h
|
||||
ini.h
|
||||
PS2Edefs.h
|
||||
PS2Etypes.h
|
||||
# ERROR It takes /usr/include/alsa/version.h
|
||||
# The content was move to Linux/CDVDlinuz.h
|
||||
# version.h
|
||||
)
|
||||
|
||||
# CDVDlinuz Linux sources
|
||||
set(CDVDlinuzLinuxSources
|
||||
Linux/aboutbox.c
|
||||
Linux/actualfile.c
|
||||
Linux/CD.c
|
||||
Linux/CDVDlinuz.c
|
||||
Linux/conf.c
|
||||
Linux/device.c
|
||||
Linux/DVD.c
|
||||
Linux/interface.c
|
||||
Linux/logfile.c
|
||||
Linux/mainbox.c)
|
||||
|
||||
# CDVDlinuz Linux headers
|
||||
set(CDVDlinuzLinuxHeaders
|
||||
Linux/aboutbox.h
|
||||
Linux/actualfile.h
|
||||
Linux/CD.h
|
||||
Linux/CDVDlinuz.h
|
||||
Linux/conf.h
|
||||
Linux/device.h
|
||||
Linux/DVD.h
|
||||
Linux/logfile.h
|
||||
Linux/mainbox.h)
|
||||
|
||||
set(CDVDlinuzFinalSources
|
||||
${CDVDlinuzSources}
|
||||
${CDVDlinuzHeaders}
|
||||
${CDVDlinuzLinuxSources}
|
||||
${CDVDlinuzLinuxHeaders}
|
||||
)
|
||||
|
||||
set(CDVDlinuzFinalLibs
|
||||
)
|
||||
|
||||
# add additional include directories
|
||||
include_directories(Linux)
|
||||
|
||||
add_pcsx2_plugin(${Output} "${CDVDlinuzFinalSources}" "${CDVDlinuzFinalLibs}" "${CDVDlinuzFinalFlags}")
|
|
@ -1,734 +0,0 @@
|
|||
/* CD.c
|
||||
|
||||
* Copyright (C) 2002-2005 PCSX2 Team
|
||||
|
||||
*
|
||||
|
||||
* 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 2 of the License, or
|
||||
|
||||
* (at your option) any later version.
|
||||
|
||||
*
|
||||
|
||||
* 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. See the
|
||||
|
||||
* GNU General Public License for more details.
|
||||
|
||||
*
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
|
||||
* along with this program; if not, write to the Free Software
|
||||
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <errno.h> // errno
|
||||
|
||||
#include <stddef.h> // NULL
|
||||
|
||||
#include <string.h> // strerror()
|
||||
|
||||
#include <fcntl.h> // open()
|
||||
|
||||
#include <sys/ioctl.h> // ioctl()
|
||||
|
||||
#include <sys/stat.h> // open()
|
||||
|
||||
#include <sys/types.h> // lseek(), open()
|
||||
|
||||
#include <unistd.h> // close(), lseek(), (sleep())
|
||||
|
||||
|
||||
|
||||
#include <linux/cdrom.h> // CD/DVD based ioctl() and defines.
|
||||
|
||||
|
||||
|
||||
#include "../convert.h"
|
||||
|
||||
#include "logfile.h"
|
||||
|
||||
#include "device.h"
|
||||
|
||||
#include "CD.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Constants
|
||||
|
||||
u8 *playstationcdname = "PLAYSTATION\0";
|
||||
|
||||
u8 *ps1name = "CD-XA001\0";
|
||||
|
||||
|
||||
|
||||
// CD-ROM temp storage structures (see linux/cdrom.h for details)
|
||||
|
||||
struct cdrom_tochdr cdheader;
|
||||
|
||||
struct cdrom_tocentry cdtrack;
|
||||
|
||||
struct cdrom_subchnl subchannel;
|
||||
|
||||
u8 cdtempbuffer[2352];
|
||||
|
||||
|
||||
|
||||
int cdmode; // mode of last CDVDreadTrack call (important for CDs)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Internal Functions
|
||||
|
||||
|
||||
|
||||
void InitCDSectorInfo() {
|
||||
|
||||
cdmode = -1;
|
||||
|
||||
} // END InitSectorInfo();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Function Calls from CDVD.c
|
||||
|
||||
|
||||
|
||||
void InitCDInfo() {
|
||||
|
||||
InitCDSectorInfo();
|
||||
|
||||
} // END InitDiscType()
|
||||
|
||||
|
||||
|
||||
s32 CDreadTrack(u32 lsn, int mode, u8 *buffer) {
|
||||
|
||||
s32 s32result;
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION
|
||||
|
||||
PrintLog("CDVD driver: CDreadTrack(%i)", lsn);
|
||||
|
||||
#endif /* VERBOSE_FUNCTION */
|
||||
|
||||
|
||||
|
||||
s32result = 0;
|
||||
|
||||
|
||||
|
||||
if(buffer == NULL) return(-1);
|
||||
|
||||
|
||||
|
||||
// The CD way of figuring out where to read.
|
||||
|
||||
LBAtoMSF(lsn, buffer);
|
||||
|
||||
|
||||
|
||||
switch(mode) {
|
||||
|
||||
case CDVD_MODE_2048:
|
||||
|
||||
case CDVD_MODE_2328:
|
||||
|
||||
case CDVD_MODE_2340:
|
||||
|
||||
case CDVD_MODE_2352:
|
||||
|
||||
errno = 4; // Interrupted system call... (simulated the first time)
|
||||
|
||||
while(errno == 4) {
|
||||
|
||||
errno = 0;
|
||||
|
||||
s32result = ioctl(devicehandle, CDROMREADRAW, buffer);
|
||||
|
||||
} // ENDWHILE- Continually being interrupted by the system...
|
||||
|
||||
break;
|
||||
|
||||
case CDVD_MODE_2368: // Unimplemented... as yet.
|
||||
|
||||
default:
|
||||
|
||||
#ifdef VERBOSE_WARNINGS
|
||||
|
||||
PrintLog("CDVD driver: Unknown Mode %i", mode);
|
||||
|
||||
#endif /* VERBOSE_WARNINGS */
|
||||
|
||||
return(-1); // Illegal Read Mode? Abort
|
||||
|
||||
break;
|
||||
|
||||
} // ENDSWITCH- Which read mode should we choose?
|
||||
|
||||
if((s32result == -1) || (errno != 0)) {
|
||||
|
||||
#ifdef VERBOSE_WARNINGS
|
||||
|
||||
PrintLog("CDVD driver: Error reading CD: %i:%s", errno, strerror(errno));
|
||||
|
||||
#endif /* VERBOSE_WARNINGS */
|
||||
|
||||
InitCDSectorInfo();
|
||||
|
||||
return(-1);
|
||||
|
||||
} // ENDIF- Trouble getting a track count?
|
||||
|
||||
|
||||
|
||||
cdmode = mode; // Save mode for buffer positioning later.
|
||||
|
||||
return(0); // Call accomplished
|
||||
|
||||
} // END CDreadTrack()
|
||||
|
||||
|
||||
|
||||
s32 CDgetBufferOffset() {
|
||||
|
||||
#ifdef VERBOSE_FUNCTION
|
||||
|
||||
PrintLog("CDVD driver: CDgetBufferOffset()");
|
||||
|
||||
#endif /* VERBOSE_FUNCTION */
|
||||
|
||||
|
||||
|
||||
switch(cdmode) {
|
||||
|
||||
case CDVD_MODE_2048:
|
||||
|
||||
return(0+24);
|
||||
|
||||
case CDVD_MODE_2328:
|
||||
|
||||
return(0+24);
|
||||
|
||||
case CDVD_MODE_2340:
|
||||
|
||||
return(0+12);
|
||||
|
||||
case CDVD_MODE_2352:
|
||||
|
||||
return(0+0);
|
||||
|
||||
case CDVD_MODE_2368: // Unimplemented... as yet.
|
||||
|
||||
default:
|
||||
|
||||
#ifdef VERBOSE_WARNINGS
|
||||
|
||||
PrintLog("CDVD driver: Unknown Mode %i", cdmode);
|
||||
|
||||
#endif /* VERBOSE_WARNINGS */
|
||||
|
||||
return(0); // Not to worry. for now.
|
||||
|
||||
} // ENDSWITCH- where should we put the buffer pointer?
|
||||
|
||||
} // END CDgetBuffer()
|
||||
|
||||
|
||||
|
||||
// I, personally, don't see the big deal with SubQ
|
||||
|
||||
// However, sooner or later I'll incorporate it into the Cache Buffer system
|
||||
|
||||
// (backward compatibility, and all that)
|
||||
|
||||
s32 CDreadSubQ(u32 lsn, cdvdSubQ *subq) {
|
||||
|
||||
int tempmode;
|
||||
|
||||
s32 s32result;
|
||||
|
||||
|
||||
|
||||
s32result = 0;
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION
|
||||
|
||||
PrintLog("CDVD driver: CDreadSubQ()");
|
||||
|
||||
#endif /* VERBOSE_FUNCTION */
|
||||
|
||||
|
||||
|
||||
tempmode = cdmode;
|
||||
|
||||
if(tempmode == -1) tempmode = CDVD_MODE_2352;
|
||||
|
||||
CDreadTrack(lsn, tempmode, cdtempbuffer);
|
||||
|
||||
if((s32result == -1) || (errno != 0)) {
|
||||
|
||||
#ifdef VERBOSE_WARNINGS
|
||||
|
||||
PrintLog("CDVD driver: Error prepping CD SubQ: %i:%s", errno, strerror(errno));
|
||||
|
||||
#endif /* VERBOSE_WARNINGS */
|
||||
|
||||
return(s32result);
|
||||
|
||||
} // ENDIF- Trouble?
|
||||
|
||||
|
||||
|
||||
subchannel.cdsc_format = CDROM_MSF;
|
||||
|
||||
s32result = ioctl(devicehandle, CDROMSUBCHNL, &subchannel);
|
||||
|
||||
if((s32result == -1) || (errno != 0)) {
|
||||
|
||||
#ifdef VERBOSE_WARNINGS
|
||||
|
||||
PrintLog("CDVD driver: Error reading CD SubQ: %i:%s", errno, strerror(errno));
|
||||
|
||||
#endif /* VERBOSE_WARNINGS */
|
||||
|
||||
return(s32result);
|
||||
|
||||
} // ENDIF- Trouble?
|
||||
|
||||
|
||||
|
||||
if(subq != NULL) {
|
||||
|
||||
subq->mode = subchannel.cdsc_adr;
|
||||
|
||||
subq->ctrl = subchannel.cdsc_ctrl;
|
||||
|
||||
subq->trackNum = subchannel.cdsc_trk;
|
||||
|
||||
subq->trackIndex = subchannel.cdsc_ind;
|
||||
|
||||
subq->trackM = subchannel.cdsc_reladdr.msf.minute;
|
||||
|
||||
subq->trackS = subchannel.cdsc_reladdr.msf.second;
|
||||
|
||||
subq->trackF = subchannel.cdsc_reladdr.msf.frame;
|
||||
|
||||
subq->discM = subchannel.cdsc_absaddr.msf.minute;
|
||||
|
||||
subq->discS = subchannel.cdsc_absaddr.msf.second;
|
||||
|
||||
subq->discF = subchannel.cdsc_absaddr.msf.frame;
|
||||
|
||||
} // ENDIF- Did the caller want all this data?
|
||||
|
||||
|
||||
|
||||
return(0);
|
||||
|
||||
} // END CDVDreadSubQ()
|
||||
|
||||
|
||||
|
||||
s32 CDgetTN(cdvdTN *cdvdtn) {
|
||||
|
||||
#ifdef VERBOSE_FUNCTION
|
||||
|
||||
PrintLog("CDVD driver: CDgetTN()");
|
||||
|
||||
#endif /* VERBOSE_FUNCTION */
|
||||
|
||||
|
||||
|
||||
if(cdvdtn != NULL) {
|
||||
|
||||
cdvdtn->strack = cdheader.cdth_trk0;
|
||||
|
||||
cdvdtn->etrack = cdheader.cdth_trk1;
|
||||
|
||||
} // ENDIF- programmer actually WANTS this info?
|
||||
|
||||
|
||||
|
||||
return(0); // Call accomplished
|
||||
|
||||
} // END CDVDgetTN()
|
||||
|
||||
|
||||
|
||||
s32 CDgetTD(u8 newtrack, cdvdTD *cdvdtd) {
|
||||
|
||||
u8 j;
|
||||
|
||||
u16 k;
|
||||
|
||||
char temptime[3];
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION
|
||||
|
||||
PrintLog("CDVD driver: CDgetTD()");
|
||||
|
||||
#endif /* VERBOSE_FUNCTION */
|
||||
|
||||
|
||||
|
||||
j = newtrack;
|
||||
|
||||
if(j == CDROM_LEADOUT) j = 0;
|
||||
|
||||
|
||||
|
||||
if(j == 0) {
|
||||
|
||||
k = 27;
|
||||
|
||||
} else {
|
||||
|
||||
k = j * 10 + 37;
|
||||
|
||||
} // ENDIF- Where to start hunting for this number?
|
||||
|
||||
|
||||
|
||||
if(cdvdtd != NULL) {
|
||||
|
||||
cdvdtd->type = tocbuffer[j*10 + 30];
|
||||
|
||||
|
||||
|
||||
temptime[0] = BCDTOHEX(tocbuffer[k]);
|
||||
|
||||
temptime[1] = BCDTOHEX(tocbuffer[k + 1]);
|
||||
|
||||
temptime[2] = BCDTOHEX(tocbuffer[k + 2]);
|
||||
|
||||
cdvdtd->lsn = MSFtoLBA(temptime);
|
||||
|
||||
} // ENDIF- Does the caller REALLY want this data?
|
||||
|
||||
|
||||
|
||||
return(0); // Call accomplished
|
||||
|
||||
} // END CDVDgetTD()
|
||||
|
||||
|
||||
|
||||
s32 CALLBACK CDgetDiskType(s32 ioctldisktype) {
|
||||
|
||||
s32 offset;
|
||||
|
||||
s32 s32result;
|
||||
|
||||
int i;
|
||||
|
||||
u8 j;
|
||||
|
||||
int tempdisctype;
|
||||
|
||||
|
||||
|
||||
offset = 0;
|
||||
|
||||
errno = 0;
|
||||
|
||||
i = 0;
|
||||
|
||||
j = 0;
|
||||
|
||||
tempdisctype = CDVD_TYPE_UNKNOWN;
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION
|
||||
|
||||
PrintLog("CDVD driver: CDgetDiskType()");
|
||||
|
||||
#endif /* VERBOSE_FUNCTION */
|
||||
|
||||
|
||||
|
||||
s32result = CDreadTrack(16, CDVD_MODE_2352, cdtempbuffer);
|
||||
|
||||
if((s32result != 0) || (errno != 0)) {
|
||||
|
||||
return(-1);
|
||||
|
||||
} // ENDIF- Cannot read the CD's ISO9660 volume sector? Abort
|
||||
|
||||
disctype = CDVD_TYPE_DETCTCD;
|
||||
|
||||
|
||||
|
||||
switch(ioctldisktype) {
|
||||
|
||||
case CDS_AUDIO:
|
||||
|
||||
#ifdef VERBOSE_DISC_TYPE
|
||||
|
||||
PrintLog("CDVD driver: Detected CDDA Audio disc.");
|
||||
|
||||
#endif /* VERBOSE_DISC_TYPE */
|
||||
|
||||
tempdisctype = CDVD_TYPE_CDDA;
|
||||
|
||||
tocbuffer[0] = 0x01;
|
||||
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case CDS_DATA_1:
|
||||
|
||||
case CDS_MIXED:
|
||||
|
||||
#ifdef VERBOSE_DISC_TYPE
|
||||
|
||||
PrintLog("CDVD driver: Detected CD disc.");
|
||||
|
||||
#endif /* VERBOSE_DISC_TYPE */
|
||||
|
||||
tocbuffer[0] = 0x41;
|
||||
|
||||
|
||||
|
||||
CDreadTrack(16, CDVD_MODE_2048, cdtempbuffer);
|
||||
|
||||
offset = CDgetBufferOffset();
|
||||
|
||||
i = 0;
|
||||
|
||||
while((*(playstationcdname + i) != 0) &&
|
||||
|
||||
(*(playstationcdname + i) == cdtempbuffer[offset + 8 + i])) i++;
|
||||
|
||||
if(*(playstationcdname + i) == 0) {
|
||||
|
||||
i = 0;
|
||||
|
||||
while((*(ps1name + i) != 0) &&
|
||||
|
||||
(*(ps1name + i) == cdtempbuffer[offset + 1024 + i])) i++;
|
||||
|
||||
if(*(ps1name + i) == 0) {
|
||||
|
||||
#ifdef VERBOSE_DISC_TYPE
|
||||
|
||||
PrintLog("CDVD driver: Detected Playstation CD disc.");
|
||||
|
||||
#endif /* VERBOSE_DISC_TYPE */
|
||||
|
||||
tempdisctype = CDVD_TYPE_PSCD;
|
||||
|
||||
} else {
|
||||
|
||||
#ifdef VERBOSE_DISC_TYPE
|
||||
|
||||
PrintLog("CDVD driver: Detected Playstation 2 CD disc.");
|
||||
|
||||
#endif /* VERBOSE_DISC_TYPE */
|
||||
|
||||
tempdisctype = CDVD_TYPE_PS2CD;
|
||||
|
||||
} // ENDIF- Did we find the CD ident? (For Playstation 1 CDs)
|
||||
|
||||
} else {
|
||||
|
||||
tempdisctype = CDVD_TYPE_UNKNOWN;
|
||||
|
||||
} // ENDIF- Did we find the Playstation name?
|
||||
|
||||
break;
|
||||
|
||||
|
||||
|
||||
default:
|
||||
|
||||
return(-1);
|
||||
|
||||
} // ENDSWITCH- What has ioctl disc type come up with?
|
||||
|
||||
|
||||
|
||||
// Collect TN data
|
||||
|
||||
cdheader.cdth_trk0 = 0;
|
||||
|
||||
cdheader.cdth_trk1 = 0;
|
||||
|
||||
|
||||
|
||||
s32result = ioctl(devicehandle, CDROMREADTOCHDR, &cdheader);
|
||||
|
||||
if((s32result == -1) || (errno != 0)) {
|
||||
|
||||
#ifdef VERBOSE_WARNINGS
|
||||
|
||||
PrintLog("CDVD driver: Error reading TN: (%i) %i:%s",
|
||||
|
||||
s32result, errno, strerror(errno));
|
||||
|
||||
#endif /* VERBOSE_WARNINGS */
|
||||
|
||||
cdheader.cdth_trk0 = 1;
|
||||
|
||||
cdheader.cdth_trk1 = 1;
|
||||
|
||||
} // ENDIF- Failed to read in track count? Assume 1 track.
|
||||
|
||||
#ifdef VERBOSE_DISC_INFO
|
||||
|
||||
PrintLog("CDVD driver: Track Number Range: %i-%i",
|
||||
|
||||
cdheader.cdth_trk0, cdheader.cdth_trk1);
|
||||
|
||||
#endif /* VERBOSE_DISC_INFO */
|
||||
|
||||
tocbuffer[2] = 0xA0;
|
||||
|
||||
tocbuffer[7] = HEXTOBCD(cdheader.cdth_trk0);
|
||||
|
||||
tocbuffer[12] = 0xA1;
|
||||
|
||||
tocbuffer[17] = HEXTOBCD(cdheader.cdth_trk1);
|
||||
|
||||
|
||||
|
||||
// Collect disc TD data
|
||||
|
||||
cdtrack.cdte_track = CDROM_LEADOUT;
|
||||
|
||||
cdtrack.cdte_format = CDROM_LBA;
|
||||
|
||||
s32result = ioctl(devicehandle, CDROMREADTOCENTRY, &cdtrack);
|
||||
|
||||
if((s32result == -1) || (errno != 0)) {
|
||||
|
||||
#ifdef VERBOSE_WARNINGS
|
||||
|
||||
PrintLog("CDVD driver: Error reading TD for disc: (%i) %i:%s",
|
||||
|
||||
s32result, errno, strerror(errno));
|
||||
|
||||
#endif /* VERBOSE_WARNINGS */
|
||||
|
||||
return(-1);
|
||||
|
||||
} // ENDIF- Trouble getting a track count?
|
||||
|
||||
|
||||
|
||||
LBAtoMSF(cdtrack.cdte_addr.lba, &tocbuffer[27]);
|
||||
|
||||
#ifdef VERBOSE_DISC_INFO
|
||||
|
||||
PrintLog("CDVD driver: Total Time: %i:%i",
|
||||
|
||||
tocbuffer[27], tocbuffer[28]);
|
||||
|
||||
#endif /* VERBOSE_DISC_INFO */
|
||||
|
||||
tocbuffer[27] = HEXTOBCD(tocbuffer[27]);
|
||||
|
||||
tocbuffer[28] = HEXTOBCD(tocbuffer[28]);
|
||||
|
||||
tocbuffer[29] = HEXTOBCD(tocbuffer[29]);
|
||||
|
||||
|
||||
|
||||
// Collect track TD data
|
||||
|
||||
for(j = cdheader.cdth_trk0; j <= cdheader.cdth_trk1; j++) {
|
||||
|
||||
cdtrack.cdte_track = j; // j-1?
|
||||
|
||||
cdtrack.cdte_format = CDROM_LBA;
|
||||
|
||||
s32result = ioctl(devicehandle, CDROMREADTOCENTRY, &cdtrack);
|
||||
|
||||
if((s32result == -1) || (errno != 0)) {
|
||||
|
||||
#ifdef VERBOSE_WARNINGS
|
||||
|
||||
PrintLog("CDVD driver: Error reading TD for track %i: (%i) %i:%s",
|
||||
|
||||
j, s32result, errno, strerror(errno));
|
||||
|
||||
#endif /* VERBOSE_WARNINGS */
|
||||
|
||||
// No more here...
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
LBAtoMSF(cdtrack.cdte_addr.lba, &tocbuffer[j*10 + 37]);
|
||||
|
||||
#ifdef VERBOSE_DISC_INFO
|
||||
|
||||
PrintLog("CDVD driver: Track %i: Data Mode %i Disc Start Time:%i:%i.%i\n",
|
||||
|
||||
j,
|
||||
|
||||
cdtrack.cdte_datamode,
|
||||
|
||||
tocbuffer[j*10+37],
|
||||
|
||||
tocbuffer[j*10+38],
|
||||
|
||||
tocbuffer[j*10+39]);
|
||||
|
||||
#endif /* VERBOSE_DISC_INFO */
|
||||
|
||||
tocbuffer[j*10 + 30] = cdtrack.cdte_datamode;
|
||||
|
||||
tocbuffer[j*10 + 32] = HEXTOBCD(j);
|
||||
|
||||
tocbuffer[j*10 + 37] = HEXTOBCD(tocbuffer[j*10 + 37]);
|
||||
|
||||
tocbuffer[j*10 + 38] = HEXTOBCD(tocbuffer[j*10 + 38]);
|
||||
|
||||
tocbuffer[j*10 + 39] = HEXTOBCD(tocbuffer[j*10 + 39]);
|
||||
|
||||
} // ENDIF- Trouble getting a track count?
|
||||
|
||||
} // NEXT j- Reading each track's info in turn
|
||||
|
||||
|
||||
|
||||
errno = 0;
|
||||
|
||||
disctype = tempdisctype; // Trigger the fact we have the info (finally)
|
||||
|
||||
return(disctype);
|
||||
|
||||
} // END CDVDgetDiskType()
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
/* CD.h
|
||||
|
||||
* Copyright (C) 2002-2005 PCSX2 Team
|
||||
|
||||
*
|
||||
|
||||
* 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 2 of the License, or
|
||||
|
||||
* (at your option) any later version.
|
||||
|
||||
*
|
||||
|
||||
* 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. See the
|
||||
|
||||
* GNU General Public License for more details.
|
||||
|
||||
*
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
|
||||
* along with this program; if not, write to the Free Software
|
||||
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef __CD_H__
|
||||
|
||||
#define __CD_H__
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define CDVDdefs
|
||||
|
||||
#include "../PS2Edefs.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Exported Functions
|
||||
|
||||
|
||||
|
||||
extern void InitCDInfo();
|
||||
|
||||
extern s32 CDreadTrack(u32 lsn, int mode, u8 *buffer);
|
||||
|
||||
extern s32 CDgetBufferOffset();
|
||||
|
||||
extern s32 CDreadSubQ(u32 lsn, cdvdSubQ *subq);
|
||||
|
||||
extern s32 CDgetTN(cdvdTN *cdvdtn);
|
||||
|
||||
extern s32 CDgetTD(u8 newtrack, cdvdTD *cdvdtd);
|
||||
|
||||
extern s32 CDgetDiskType(s32 ioctldisktype);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* __CD_H__ */
|
||||
|
|
@ -1,360 +0,0 @@
|
|||
/* CDVDlinuz.c
|
||||
* Copyright (C) 2002-2005 CDVDlinuz Team
|
||||
*
|
||||
* 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <errno.h> // errno
|
||||
#include <fcntl.h> // open()
|
||||
#include <stddef.h> // NULL
|
||||
#include <stdio.h> // printf()
|
||||
#include <stdlib.h> // getenv(), system()
|
||||
#include <string.h> // strerror(), sprintf()
|
||||
#include <sys/ioctl.h> // ioctl()
|
||||
#include <sys/stat.h> // stat()
|
||||
#include <sys/types.h> // stat()
|
||||
#include <time.h> // time_t, time(), struct timeval
|
||||
#include <unistd.h> // stat()
|
||||
|
||||
#define CDVDdefs
|
||||
#include "PS2Edefs.h"
|
||||
// #include "PS2Etypes.h"
|
||||
|
||||
#include "CDVDlinuz.h"
|
||||
|
||||
#include "buffer.h"
|
||||
#include "conf.h"
|
||||
#include "logfile.h"
|
||||
#include "CD.h" // InitCDInfo()
|
||||
#include "DVD.h" // InitDVDInfo()
|
||||
#include "device.h"
|
||||
|
||||
|
||||
// Globals
|
||||
|
||||
time_t lasttime;
|
||||
|
||||
|
||||
// Interface Functions
|
||||
|
||||
u32 CALLBACK PS2EgetLibType() {
|
||||
return(PS2E_LT_CDVD); // Library Type CDVD
|
||||
} // END PS2EgetLibType()
|
||||
|
||||
|
||||
u32 CALLBACK PS2EgetLibVersion2(u32 type) {
|
||||
return((version<<16)|(revision<<8)|build);
|
||||
} // END PS2EgetLibVersion2()
|
||||
|
||||
|
||||
char* CALLBACK PS2EgetLibName() {
|
||||
return(libname);
|
||||
} // END PS2EgetLibName()
|
||||
|
||||
|
||||
s32 CALLBACK CDVDinit() {
|
||||
errno = 0;
|
||||
|
||||
InitLog();
|
||||
if(OpenLog() != 0) return(-1);
|
||||
|
||||
#ifdef VERBOSE_FUNCTION
|
||||
PrintLog("CDVD interface: CDVDinit()");
|
||||
#endif /* VERBOSE_FUNCTION */
|
||||
|
||||
InitConf();
|
||||
|
||||
devicehandle = -1;
|
||||
devicecapability = 0;
|
||||
lasttime = time(NULL);
|
||||
|
||||
// Initialize DVD.c and CD.c as well
|
||||
InitDisc();
|
||||
InitDVDInfo();
|
||||
InitCDInfo();
|
||||
|
||||
return(0);
|
||||
} // END CDVDinit()
|
||||
|
||||
|
||||
void CALLBACK CDVDshutdown() {
|
||||
#ifdef VERBOSE_FUNCTION
|
||||
PrintLog("CDVD interface: CDVDshutdown()");
|
||||
#endif /* VERBOSE_FUNCTION */
|
||||
|
||||
DeviceClose();
|
||||
CloseLog();
|
||||
} // END CDVDshutdown()
|
||||
|
||||
|
||||
s32 CALLBACK CDVDopen(const char* pTitleFilename) {
|
||||
s32 s32result;
|
||||
|
||||
#ifdef VERBOSE_FUNCTION
|
||||
PrintLog("CDVD interface: CDVDopen()");
|
||||
#endif /* VERBOSE_FUNCTION */
|
||||
|
||||
InitBuffer();
|
||||
|
||||
LoadConf();
|
||||
|
||||
errno = 0;
|
||||
s32result = DeviceOpen();
|
||||
if(s32result != 0) return(s32result);
|
||||
if(errno != 0) return(-1);
|
||||
|
||||
return(0);
|
||||
} // END CDVDopen();
|
||||
|
||||
|
||||
void CALLBACK CDVDclose() {
|
||||
#ifdef VERBOSE_FUNCTION
|
||||
PrintLog("CDVD interface: CDVDclose()");
|
||||
#endif /* VERBOSE_FUNCTION */
|
||||
|
||||
DeviceClose();
|
||||
} // END CDVDclose()
|
||||
|
||||
|
||||
s32 CALLBACK CDVDreadTrack(u32 lsn, int mode) {
|
||||
s32 s32result;
|
||||
|
||||
#ifdef VERBOSE_FUNCTION
|
||||
PrintLog("CDVD interface: CDVDreadTrack(%i)", lsn);
|
||||
#endif /* VERBOSE_FUNCTION */
|
||||
|
||||
s32result = 0;
|
||||
errno = 0;
|
||||
|
||||
if(DiscInserted() == -1) return(-1);
|
||||
|
||||
if(userbuffer < BUFFERMAX) {
|
||||
if((bufferlist[userbuffer].lsn == lsn) &&
|
||||
(bufferlist[userbuffer].mode == mode)) {
|
||||
return(0);
|
||||
} // ENDIF- And it's the right one?
|
||||
} // ENDIF- Are we already pointing at the buffer?
|
||||
|
||||
userbuffer = FindListBuffer(lsn);
|
||||
if(userbuffer < BUFFERMAX) {
|
||||
if((bufferlist[userbuffer].lsn == lsn) &&
|
||||
(bufferlist[userbuffer].mode == mode)) {
|
||||
return(0);
|
||||
} // ENDIF- And it was the right one?
|
||||
} // ENDIF- Was a buffer found in the cache?
|
||||
|
||||
replacebuffer++;
|
||||
if(replacebuffer >= BUFFERMAX) replacebuffer = 0;
|
||||
userbuffer = replacebuffer;
|
||||
|
||||
if(bufferlist[replacebuffer].upsort != 0xffff) {
|
||||
RemoveListBuffer(replacebuffer);
|
||||
} // ENDIF- Reference already in place? Remove it.
|
||||
|
||||
s32result = DeviceReadTrack(lsn, mode, bufferlist[replacebuffer].buffer);
|
||||
bufferlist[replacebuffer].lsn = lsn;
|
||||
bufferlist[replacebuffer].mode = mode;
|
||||
bufferlist[replacebuffer].offset = DeviceBufferOffset();
|
||||
|
||||
if((s32result != 0) || (errno != 0)) {
|
||||
bufferlist[replacebuffer].mode = -1; // Error! flag buffer as such.
|
||||
} else {
|
||||
if((disctype != CDVD_TYPE_PS2DVD) && (disctype != CDVD_TYPE_DVDV)) {
|
||||
if(mode == CDVD_MODE_2352) {
|
||||
CDreadSubQ(lsn, &bufferlist[replacebuffer].subq);
|
||||
errno = 0;
|
||||
} // ENDIF- Read subq as well?
|
||||
} // ENDIF- Read a DVD buffer or a CD buffer?
|
||||
} // ENDIF-Read ok? Fill out rest of buffer info.
|
||||
AddListBuffer(replacebuffer);
|
||||
return(s32result);
|
||||
} // END CDVDreadTrack()
|
||||
|
||||
|
||||
u8* CALLBACK CDVDgetBuffer() {
|
||||
#ifdef VERBOSE_FUNCTION
|
||||
PrintLog("CDVD interface: CDVDgetBuffer()");
|
||||
#endif /* VERBOSE_FUNCTION */
|
||||
|
||||
if(DiscInserted() == -1) return(NULL);
|
||||
|
||||
if(userbuffer == 0xffff) {
|
||||
#ifdef VERBOSE_WARNINGS
|
||||
PrintLog("CDVD interface: Not pointing to a buffer!");
|
||||
#endif /* VERBOSE_WARNINGS */
|
||||
return(NULL); // No buffer reference?
|
||||
} // ENDIF- user buffer not pointing at anything? Abort
|
||||
|
||||
if(bufferlist[userbuffer].mode < 0) {
|
||||
#ifdef VERBOSE_WARNINGS
|
||||
PrintLog("CDVD interface: Error in buffer!");
|
||||
#endif /* VERBOSE_WARNINGS */
|
||||
return(NULL); // Bad Sector?
|
||||
} // ENDIF- Trouble reading physical sector? Tell them.
|
||||
|
||||
return(bufferlist[userbuffer].buffer + bufferlist[userbuffer].offset);
|
||||
} // END CDVDgetBuffer()
|
||||
|
||||
|
||||
// Note: without the lsn, I could pull the SubQ data directly from
|
||||
// the stored buffer (in buffer.h). Oh, well.
|
||||
s32 CALLBACK CDVDreadSubQ(u32 lsn, cdvdSubQ *subq) {
|
||||
#ifdef VERBOSE_FUNCTION
|
||||
PrintLog("CDVD interface: CDVDreadSubQ(%i)", lsn);
|
||||
#endif /* VERBOSE_FUNCTION */
|
||||
|
||||
if(DiscInserted() == -1) return(-1);
|
||||
|
||||
// DVDs don't have SubQ data
|
||||
if(disctype == CDVD_TYPE_PS2DVD) return(-1);
|
||||
if(disctype == CDVD_TYPE_DVDV) return(-1);
|
||||
|
||||
return(CDreadSubQ(lsn, subq));
|
||||
} // END CDVDreadSubQ()
|
||||
|
||||
|
||||
s32 CALLBACK CDVDgetTN(cdvdTN *cdvdtn) {
|
||||
#ifdef VERBOSE_FUNCTION
|
||||
PrintLog("CDVD interface: CDVDgetTN()");
|
||||
#endif /* VERBOSE_FUNCTION */
|
||||
|
||||
if(DiscInserted() == -1) return(-1);
|
||||
|
||||
if((disctype == CDVD_TYPE_PS2DVD) || (disctype == CDVD_TYPE_DVDV)) {
|
||||
return(DVDgetTN(cdvdtn));
|
||||
} else {
|
||||
return(CDgetTN(cdvdtn));
|
||||
} // ENDIF- Are we looking at a DVD?
|
||||
} // END CDVDgetTN()
|
||||
|
||||
|
||||
s32 CALLBACK CDVDgetTD(u8 newtrack, cdvdTD *cdvdtd) {
|
||||
#ifdef VERBOSE_FUNCTION
|
||||
PrintLog("CDVD interface: CDVDgetTD()");
|
||||
#endif /* VERBOSE_FUNCTION */
|
||||
|
||||
if(DiscInserted() == -1) return(-1);
|
||||
|
||||
if((disctype == CDVD_TYPE_PS2DVD) || (disctype == CDVD_TYPE_DVDV)) {
|
||||
return(DVDgetTD(newtrack, cdvdtd));
|
||||
} else {
|
||||
return(CDgetTD(newtrack, cdvdtd));
|
||||
} // ENDIF- Are we looking at a DVD?
|
||||
} // END CDVDgetTD()
|
||||
|
||||
|
||||
s32 CALLBACK CDVDgetTOC(void *toc) {
|
||||
// A structure to fill in, or at least some documentation on what
|
||||
// the PS2 expects from this call would be more helpful than a
|
||||
// "void *".
|
||||
|
||||
union {
|
||||
void *voidptr;
|
||||
u8 *u8ptr;
|
||||
} tocptr;
|
||||
s32 i;
|
||||
|
||||
#ifdef VERBOSE_FUNCTION
|
||||
PrintLog("CDVD interface: CDVDgetTOC()");
|
||||
#endif /* VERBOSE_FUNCTION */
|
||||
|
||||
if(toc == NULL) return(-1);
|
||||
if(DiscInserted() == -1) return(-1);
|
||||
|
||||
tocptr.voidptr = toc;
|
||||
for(i = 0; i < 1024; i++) *(tocptr.u8ptr + i) = tocbuffer[i];
|
||||
tocptr.voidptr = NULL;
|
||||
|
||||
return(0);
|
||||
} // END CDVDgetTOC()
|
||||
|
||||
|
||||
s32 CALLBACK CDVDgetDiskType() {
|
||||
#ifdef VERBOSE_FUNCTION
|
||||
// Called way too often in boot part of bios to be left in.
|
||||
// PrintLog("CDVD interface: CDVDgetDiskType()");
|
||||
#endif /* VERBOSE_FUNCTION */
|
||||
|
||||
if(lasttime != time(NULL)) {
|
||||
lasttime = time(NULL);
|
||||
DeviceTrayStatus();
|
||||
} // ENDIF- Has enough time passed between calls?
|
||||
|
||||
return(disctype);
|
||||
} // END CDVDgetDiskType()
|
||||
|
||||
|
||||
s32 CALLBACK CDVDgetTrayStatus() {
|
||||
#ifdef VERBOSE_FUNCTION
|
||||
PrintLog("CDVD interface: CDVDgetTrayStatus()");
|
||||
#endif /* VERBOSE_FUNCTION */
|
||||
|
||||
if(lasttime != time(NULL)) {
|
||||
lasttime = time(NULL);
|
||||
DeviceTrayStatus();
|
||||
} // ENDIF- Has enough time passed between calls?
|
||||
|
||||
return(traystatus);
|
||||
} // END CDVDgetTrayStatus()
|
||||
|
||||
|
||||
s32 CALLBACK CDVDctrlTrayOpen() {
|
||||
#ifdef VERBOSE_FUNCTION
|
||||
PrintLog("CDVD interface: CDVDctrlTrayOpen()");
|
||||
#endif /* VERBOSE_FUNCTION */
|
||||
|
||||
return(DeviceTrayOpen());
|
||||
} // END CDVDctrlTrayOpen()
|
||||
|
||||
|
||||
s32 CALLBACK CDVDctrlTrayClose() {
|
||||
#ifdef VERBOSE_FUNCTION
|
||||
PrintLog("CDVD interface: CDVDctrlTrayClose()");
|
||||
#endif /* VERBOSE_FUNCTION */
|
||||
|
||||
return(DeviceTrayClose());
|
||||
} // END CDVDctrlTrayClose()
|
||||
|
||||
|
||||
void CALLBACK CDVDconfigure() {
|
||||
ExecCfg("configure");
|
||||
} // END CDVDconfigure()
|
||||
|
||||
|
||||
void CALLBACK CDVDabout() {
|
||||
ExecCfg("about");
|
||||
} // END CDVDabout()
|
||||
|
||||
|
||||
s32 CALLBACK CDVDtest() {
|
||||
s32 s32result;
|
||||
|
||||
errno = 0;
|
||||
|
||||
if(devicehandle != -1) {
|
||||
#ifdef VERBOSE_WARNINGS
|
||||
PrintLog("CDVD interface: Device already open");
|
||||
#endif /* VERBOSE_WARNINGS */
|
||||
return(0);
|
||||
} // ENDIF- Is the CD/DVD already in use? That's fine.
|
||||
|
||||
#ifdef VERBOSE_FUNCTION
|
||||
PrintLog("CDVD driver: CDVDtest()");
|
||||
#endif /* VERBOSE_FUNCTION */
|
||||
|
||||
s32result = DeviceOpen();
|
||||
DeviceClose();
|
||||
return(s32result);
|
||||
} // END CDVDtest()
|
|
@ -1,63 +0,0 @@
|
|||
/* CDVDlinuz.h
|
||||
|
||||
* Copyright (C) 2002-2005 CDVDlinuz Team
|
||||
|
||||
*
|
||||
|
||||
* 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 2 of the License, or
|
||||
|
||||
* (at your option) any later version.
|
||||
|
||||
*
|
||||
|
||||
* 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. See the
|
||||
|
||||
* GNU General Public License for more details.
|
||||
|
||||
*
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
|
||||
* along with this program; if not, write to the Free Software
|
||||
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef __CDVDLINUZ_H__
|
||||
|
||||
#define __CDVDLINUZ_H__
|
||||
|
||||
#define CDVDdefs
|
||||
#include "PS2Edefs.h"
|
||||
|
||||
extern char *libname;
|
||||
|
||||
extern const unsigned char version;
|
||||
extern const unsigned char revision;
|
||||
extern const unsigned char build;
|
||||
|
||||
|
||||
|
||||
// #define VERBOSE_WARNINGS
|
||||
|
||||
// #define VERBOSE_FUNCTION
|
||||
|
||||
#define VERBOSE_DISC_INFO
|
||||
|
||||
#define VERBOSE_DISC_TYPE
|
||||
|
||||
#define READ_AHEAD_BUFFERS 32
|
||||
|
||||
#endif /* __CDVDLINUZ_H__ */
|
||||
|
|
@ -1,584 +0,0 @@
|
|||
/* DVD.c
|
||||
* Copyright (C) 2002-2005 PCSX2 Team
|
||||
*
|
||||
* 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
*/
|
||||
|
||||
#include <errno.h> // errno
|
||||
#include <stddef.h> // NULL
|
||||
#include <stdio.h> // sprintf()
|
||||
#include <string.h> // strerror(), memset(), memcpy()
|
||||
#include <fcntl.h> // open()
|
||||
#include <sys/ioctl.h> // ioctl()
|
||||
#include <sys/stat.h> // open()
|
||||
#include <sys/types.h> // lseek(), open()
|
||||
#include <unistd.h> // close(), lseek(), (sleep())
|
||||
|
||||
#include <linux/cdrom.h> // CD/DVD based ioctl() and defines.
|
||||
|
||||
#include "logfile.h"
|
||||
#include "device.h"
|
||||
#include "DVD.h"
|
||||
|
||||
#include "../PS2Etypes.h" // u8, u32
|
||||
|
||||
|
||||
// Constants
|
||||
u8 *playstationname = "PLAYSTATION\0";
|
||||
|
||||
// DVD storage structures (see linux/cdrom.h for details)
|
||||
dvd_struct dvdphysical;
|
||||
dvd_struct dvdcopyright[DVD_LAYERS];
|
||||
dvd_struct dvdbca;
|
||||
dvd_struct dvdmanufact[DVD_LAYERS];
|
||||
|
||||
u32 dvdlastlsn;
|
||||
u8 dvdtempbuffer[2064];
|
||||
|
||||
|
||||
// Internal Functions
|
||||
|
||||
void InitDVDSectorInfo() {
|
||||
dvdlastlsn = 0xffffffff;
|
||||
} // END InitSectorInfo();
|
||||
|
||||
void HexDump(u8 *strptr, u8 count) {
|
||||
int i;
|
||||
u8 ch[2];
|
||||
char hexline[81];
|
||||
int hexlinepos;
|
||||
|
||||
ch[1] = 0;
|
||||
|
||||
if(count == 0) count = 16;
|
||||
if((count < 1) || (count > 16)) return;
|
||||
|
||||
hexlinepos = 0;
|
||||
hexlinepos += sprintf(&hexline[hexlinepos], "CDVD driver: ");
|
||||
|
||||
for(i = 0; i < count; i++) {
|
||||
hexlinepos += sprintf(&hexline[hexlinepos], "%.2x ", (*(strptr + i)) * 1);
|
||||
} // NEXT i- printing each new Hex number
|
||||
|
||||
for(i = 0; i < count; i++) {
|
||||
if((*(strptr + i) < 32) || (*(strptr + i) > 127)) {
|
||||
hexlinepos += sprintf(&hexline[hexlinepos], ".");
|
||||
} else {
|
||||
ch[0] = *(strptr + i);
|
||||
hexlinepos += sprintf(&hexline[hexlinepos], "%s", ch);
|
||||
} // ENDIF- Is this an unprintable character?
|
||||
} // NEXT i- printing each new character
|
||||
PrintLog(hexline);
|
||||
} // ENDIF HexDump()
|
||||
|
||||
|
||||
//// DVD Structure Functions
|
||||
|
||||
s32 DVDreadPhysical() {
|
||||
s32 s32result;
|
||||
u8 i;
|
||||
|
||||
errno = 0;
|
||||
|
||||
#ifdef VERBOSE_FUNCTION
|
||||
PrintLog("CDVD driver: DVDreadPhysical()\n");
|
||||
#endif /* VERBOSE_FUNCTION */
|
||||
|
||||
memset(&dvdphysical, 0, sizeof(dvd_struct));
|
||||
dvdphysical.type = DVD_STRUCT_PHYSICAL;
|
||||
|
||||
i = DVD_LAYERS;
|
||||
while(i > 0) {
|
||||
i--;
|
||||
dvdphysical.physical.layer_num = i;
|
||||
errno = 0;
|
||||
s32result = ioctl(devicehandle, DVD_READ_STRUCT, &dvdphysical);
|
||||
} // ENDWHILE- reading in all physical layers...
|
||||
|
||||
if((s32result == -1) || (errno != 0)) {
|
||||
dvdphysical.type = 0xFF;
|
||||
#ifdef VERBOSE_WARNINGS
|
||||
PrintLog("CDVD driver: Error getting Physical structure: (%i) %i:%s", s32result, errno, strerror(errno));
|
||||
#endif /* VERBOSE_WARNINGS */
|
||||
return(-1);
|
||||
} // ENDIF- Problem with reading Layer 0 of the physical data? Abort
|
||||
|
||||
i = 3;
|
||||
while((i > 0) && (dvdphysical.physical.layer[i].end_sector == 0)) i--;
|
||||
dvdphysical.physical.layer_num = i;
|
||||
|
||||
#ifdef VERBOSE_DISC_INFO
|
||||
PrintLog("CDVD driver: Physical Characteristics");
|
||||
PrintLog("CDVD driver: Number of Layers: %i",
|
||||
(s32) dvdphysical.physical.layer_num + 1);
|
||||
for(i = 0; i <= dvdphysical.physical.layer_num; i++) {
|
||||
PrintLog("CDVD driver: Layer Number %i", i);
|
||||
switch(dvdphysical.physical.layer[i].book_type) {
|
||||
case 0:
|
||||
PrintLog("CDVD driver: Book Type: DVD-ROM");
|
||||
break;
|
||||
case 1:
|
||||
PrintLog("CDVD driver: Book Type: DVD-RAM");
|
||||
break;
|
||||
case 2:
|
||||
PrintLog("CDVD driver: Book Type: DVD-R");
|
||||
break;
|
||||
case 3:
|
||||
PrintLog("CDVD driver: Book Type: DVD-RW");
|
||||
break;
|
||||
case 9:
|
||||
PrintLog("CDVD driver: Book Type: DVD+RW");
|
||||
break;
|
||||
default:
|
||||
PrintLog("CDVD driver: Book Type: Unknown (%i)",
|
||||
dvdphysical.physical.layer[i].book_type);
|
||||
break;
|
||||
} // ENDSWITCH- Displaying the Book Type
|
||||
PrintLog("CDVD driver: Book Version %i",
|
||||
dvdphysical.physical.layer[i].book_version);
|
||||
switch(dvdphysical.physical.layer[i].min_rate) {
|
||||
case 0:
|
||||
PrintLog("CDVD driver: Use Minimum Rate for: DVD-ROM");
|
||||
break;
|
||||
case 1:
|
||||
PrintLog("CDVD driver: Use Minimum Rate for: DVD-RAM");
|
||||
break;
|
||||
case 2:
|
||||
PrintLog("CDVD driver: Use Minimum Rate for: DVD-R");
|
||||
break;
|
||||
case 3:
|
||||
PrintLog("CDVD driver: Use Minimum Rate for: DVD-RW");
|
||||
break;
|
||||
case 9:
|
||||
PrintLog("CDVD driver: Use Minimum Rate for: DVD+RW");
|
||||
break;
|
||||
default:
|
||||
PrintLog("CDVD driver: Use Minimum Rate for: Unknown (%i)",
|
||||
dvdphysical.physical.layer[i].min_rate);
|
||||
break;
|
||||
} // ENDSWITCH- Displaying the Minimum (Spin?) Rate
|
||||
switch(dvdphysical.physical.layer[i].disc_size) {
|
||||
case 0:
|
||||
PrintLog("CDVD driver: Physical Disk Size: 120mm");
|
||||
break;
|
||||
case 1:
|
||||
PrintLog("CDVD driver: Physical Disk Size: 80mm");
|
||||
break;
|
||||
default:
|
||||
PrintLog("CDVD driver: Physical Disk Size: Unknown (%i)",
|
||||
dvdphysical.physical.layer[i].disc_size);
|
||||
break;
|
||||
} // ENDSWITCH- What's the Disk Size?
|
||||
switch(dvdphysical.physical.layer[i].layer_type) {
|
||||
case 1:
|
||||
PrintLog("CDVD driver: Layer Type: Read-Only");
|
||||
break;
|
||||
case 2:
|
||||
PrintLog("CDVD driver: Layer Type: Recordable");
|
||||
break;
|
||||
case 4:
|
||||
PrintLog("CDVD driver: Layer Type: Rewritable");
|
||||
break;
|
||||
default:
|
||||
PrintLog("CDVD driver: Layer Type: Unknown (%i)",
|
||||
dvdphysical.physical.layer[i].layer_type);
|
||||
break;
|
||||
} // ENDSWITCH- Displaying the Layer Type
|
||||
switch(dvdphysical.physical.layer[i].track_path) {
|
||||
case 0:
|
||||
PrintLog("CDVD driver: Track Path: PTP");
|
||||
break;
|
||||
case 1:
|
||||
PrintLog("CDVD driver: Track Path: OTP");
|
||||
break;
|
||||
default:
|
||||
PrintLog("CDVD driver: Track Path: Unknown (%i)",
|
||||
dvdphysical.physical.layer[i].track_path);
|
||||
break;
|
||||
} // ENDSWITCH- What's Track Path Layout?
|
||||
// PrintLog("CDVD driver: Disc Size %i Layer Type %i Track Path %i Nlayers %i",
|
||||
// dvdphysical.physical.layer[i].nlayers);
|
||||
switch(dvdphysical.physical.layer[i].track_density) {
|
||||
case 0:
|
||||
PrintLog("CDVD driver: Track Density: .74 m/track");
|
||||
break;
|
||||
case 1:
|
||||
PrintLog("CDVD driver: Track Density: .8 m/track");
|
||||
break;
|
||||
case 2:
|
||||
PrintLog("CDVD driver: Track Density: .615 m/track");
|
||||
break;
|
||||
default:
|
||||
PrintLog("CDVD driver: Track Density: Unknown (%i)",
|
||||
dvdphysical.physical.layer[i].track_density);
|
||||
break;
|
||||
} // ENDSWITCH- Displaying the Track Density
|
||||
switch(dvdphysical.physical.layer[i].linear_density) {
|
||||
case 0:
|
||||
PrintLog("CDVD driver: Linear Density: .267 m/bit");
|
||||
break;
|
||||
case 1:
|
||||
PrintLog("CDVD driver: Linear Density: .293 m/bit");
|
||||
break;
|
||||
case 2:
|
||||
PrintLog("CDVD driver: Linear Density: .409 to .435 m/bit");
|
||||
break;
|
||||
case 4:
|
||||
PrintLog("CDVD driver: Linear Density: .280 to .291 m/bit");
|
||||
break;
|
||||
case 8:
|
||||
PrintLog("CDVD driver: Linear Density: .353 m/bit");
|
||||
break;
|
||||
default:
|
||||
PrintLog("CDVD driver: Linear Density: Unknown (%i)",
|
||||
dvdphysical.physical.layer[i].linear_density);
|
||||
break;
|
||||
} // ENDSWITCH- Displaying the Linear Density
|
||||
if(dvdphysical.physical.layer[i].start_sector == 0x30000) {
|
||||
PrintLog("CDVD driver: Starting Sector: %lu (DVD-ROM, DVD-R, DVD-RW)",
|
||||
dvdphysical.physical.layer[i].start_sector);
|
||||
} else if(dvdphysical.physical.layer[i].start_sector == 0x31000) {
|
||||
PrintLog("CDVD driver: Starting Sector: %lu (DVD-RAM, DVD+RW)",
|
||||
dvdphysical.physical.layer[i].start_sector);
|
||||
} else {
|
||||
PrintLog("CDVD driver: Starting Sector: %lu",
|
||||
dvdphysical.physical.layer[i].start_sector);
|
||||
} // ENDLONGIF- What does the starting sector tell us?
|
||||
PrintLog("CDVD driver: End of Layer 0: %lu",
|
||||
dvdphysical.physical.layer[i].end_sector_l0);
|
||||
PrintLog("CDVD driver: Ending Sector: %lu",
|
||||
dvdphysical.physical.layer[i].end_sector);
|
||||
if(dvdphysical.physical.layer[i].bca != 0)
|
||||
PrintLog("CDVD driver: BCA data present");
|
||||
} // NEXT i- Work our way through each layer...
|
||||
#endif /* VERBOSE_DISC_INFO */
|
||||
|
||||
return(0); // Success. Physical data stored for perusal.
|
||||
} // END DVDreadPhysical()
|
||||
|
||||
s32 DVDreadCopyright() {
|
||||
s32 s32result;
|
||||
u8 i;
|
||||
int successflag;
|
||||
|
||||
#ifdef VERBOSE_FUNCTION
|
||||
PrintLog("CDVD driver: DVDreadCopyright()");
|
||||
#endif /* VERBOSE_FUNCTION */
|
||||
|
||||
successflag = 0;
|
||||
|
||||
for(i = 0; i <= dvdphysical.physical.layer_num; i++) {
|
||||
memset(&dvdcopyright[i], 0, sizeof(dvd_struct));
|
||||
dvdcopyright[i].type = DVD_STRUCT_COPYRIGHT;
|
||||
dvdcopyright[i].copyright.layer_num = i;
|
||||
errno = 0;
|
||||
s32result = ioctl(devicehandle, DVD_READ_STRUCT, &dvdcopyright[i]);
|
||||
if(s32result == 0) {
|
||||
successflag = 1;
|
||||
} else {
|
||||
dvdcopyright[i].type = 0xFF;
|
||||
} // ENDIF-
|
||||
} // NEXT i- Getting copyright data for every known layer
|
||||
|
||||
if(successflag == 0) {
|
||||
#ifdef VERBOSE_WARNINGS
|
||||
PrintLog("CDVD driver: Error getting Copyright info: (%i) %i:%s", s32result, errno, strerror(errno));
|
||||
#endif /* VERBOSE_WARNINGS */
|
||||
return(-1);
|
||||
} // ENDIF- Problem with read of physical data?
|
||||
|
||||
#ifdef VERBOSE_DISC_INFO
|
||||
PrintLog("CDVD driver: Copyright Information\n");
|
||||
for(i = 0; i <= dvdphysical.physical.layer_num; i++) {
|
||||
if(dvdcopyright[i].type != 0xFF) {
|
||||
PrintLog("CDVD driver: Layer Number %i CPST %i RMI %i",
|
||||
dvdcopyright[i].copyright.layer_num,
|
||||
dvdcopyright[i].copyright.cpst,
|
||||
dvdcopyright[i].copyright.rmi);
|
||||
} // ENDIF- Were we successful reading this one?
|
||||
} // NEXT i- Printing out all copyright info found...
|
||||
#endif /* VERBOSE_DISC_INFO */
|
||||
|
||||
errno = 0;
|
||||
return(0); // Success. Copyright data stored for perusal.
|
||||
} // END DVDreadCopyright()
|
||||
|
||||
s32 DVDreadBCA() {
|
||||
s32 s32result;
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
errno = 0;
|
||||
|
||||
#ifdef VERBOSE_FUNCTION
|
||||
PrintLog("CDVD driver: DVDreadBCA()");
|
||||
#endif /* VERBOSE_FUNCTION */
|
||||
|
||||
memset(&dvdbca, 0, sizeof(dvd_struct));
|
||||
dvdbca.type = DVD_STRUCT_BCA;
|
||||
s32result = ioctl(devicehandle, DVD_READ_STRUCT, &dvdbca);
|
||||
if((s32result == -1) || (errno != 0)) {
|
||||
dvdbca.type = 0xFF;
|
||||
#ifdef VERBOSE_WARNINGS
|
||||
PrintLog("CDVD driver: Error getting BCA: (%i) %i:%s", s32result, errno, strerror(errno));
|
||||
#endif /* VERBOSE_WARNINGS */
|
||||
return(-1);
|
||||
} // ENDIF- Problem with read of physical data?
|
||||
|
||||
#ifdef VERBOSE_DISC_INFO
|
||||
PrintLog("CDVD driver: BCA Length %i Value:",
|
||||
dvdbca.bca.len);
|
||||
for(i = 0; i < 188-15; i += 16) {
|
||||
HexDump(dvdbca.bca.value+i, 16);
|
||||
} // NEXT i- dumping whole key data
|
||||
#endif /* VERBOSE_DISC_INFO */
|
||||
|
||||
return(0); // Success. BCA data stored for perusal.
|
||||
} // END DVDreadBCA()
|
||||
|
||||
s32 DVDreadManufact() {
|
||||
s32 s32result;
|
||||
u8 i;
|
||||
int successflag;
|
||||
int j;
|
||||
|
||||
#ifdef VERBOSE_FUNCTION
|
||||
PrintLog("CDVD driver: DVDreadManufact()");
|
||||
#endif /* VERBOSE_FUNCTION */
|
||||
|
||||
j = 0;
|
||||
successflag = 0;
|
||||
|
||||
for(i = 0; i <= dvdphysical.physical.layer_num; i++) {
|
||||
memset(&dvdmanufact[i], 0, sizeof(dvd_struct));
|
||||
dvdmanufact[i].type = DVD_STRUCT_MANUFACT;
|
||||
dvdmanufact[i].manufact.layer_num = i;
|
||||
errno = 0;
|
||||
s32result = ioctl(devicehandle, DVD_READ_STRUCT, &dvdmanufact[i]);
|
||||
if((s32result != 0) || (errno != 0)) {
|
||||
dvdmanufact[i].type = 0xFF;
|
||||
} else {
|
||||
successflag = 1;
|
||||
} // ENDIF- Did we fail to read in some manufacturer data?
|
||||
} // NEXT i- Collecting manufacturer data from all layers
|
||||
|
||||
if(successflag == 0) {
|
||||
#ifdef VERBOSE_WARNINGS
|
||||
PrintLog("CDVD driver: Error getting Manufact: (%i) %i:%s", s32result, errno, strerror(errno));
|
||||
#endif /* VERBOSE_WARNINGS */
|
||||
return(-1);
|
||||
} // ENDIF- Problem with read of physical data?
|
||||
|
||||
#ifdef VERBOSE_DISC_INFO
|
||||
PrintLog("CDVD driver: Manufact Data");
|
||||
for(i = 0; i <= dvdphysical.physical.layer_num; i++) {
|
||||
if(dvdmanufact[i].type != 0xFF) {
|
||||
PrintLog("CDVD driver: Layer %i Length %i Value:",
|
||||
dvdmanufact[i].manufact.layer_num,
|
||||
dvdmanufact[i].manufact.len);
|
||||
for(j = 0; j < 128-15; j += 16) {
|
||||
HexDump(dvdmanufact[i].manufact.value+j, 16);
|
||||
} // NEXT j- dumping whole key data
|
||||
} // ENDIF- Do we have data at this layer?
|
||||
} // NEXT i- Running through all the layers
|
||||
#endif /* VERBOSE_DISC_INFO */
|
||||
|
||||
errno = 0;
|
||||
return(0); // Success. Manufacturer's data stored for perusal.
|
||||
} // END DVDreadManufact()
|
||||
|
||||
|
||||
// External Functions
|
||||
|
||||
// Function Calls from CDVD.c
|
||||
|
||||
void InitDVDInfo() {
|
||||
int j;
|
||||
|
||||
dvdphysical.type = 0xFF; // Using for empty=0xff, full!=0xff test
|
||||
dvdbca.type = 0xFF;
|
||||
for(j = 0; j < DVD_LAYERS; j++) {
|
||||
dvdcopyright[j].type = 0xFF;
|
||||
dvdmanufact[j].type = 0xFF;
|
||||
} // NEXT j- Zeroing each layer of data
|
||||
InitDVDSectorInfo();
|
||||
} // END InitDiscType()
|
||||
|
||||
s32 DVDreadTrack(u32 lsn, int mode, u8 *buffer) {
|
||||
s32 s32result;
|
||||
off64_t offsettarget;
|
||||
off64_t offsetresult;
|
||||
|
||||
errno = 0;
|
||||
s32result = 0;
|
||||
offsetresult = 0;
|
||||
|
||||
#ifdef VERBOSE_FUNCTION
|
||||
PrintLog("CDVD driver: DVDreadTrack(%i)", lsn);
|
||||
#endif /* VERBOSE_FUNCTION */
|
||||
|
||||
if(lsn != dvdlastlsn + 1) {
|
||||
offsettarget = lsn;
|
||||
offsettarget *= 2048;
|
||||
errno = 4;
|
||||
while(errno == 4) {
|
||||
errno = 0;
|
||||
offsetresult = lseek64(devicehandle, offsettarget, SEEK_SET);
|
||||
} // ENDWHILE- waiting for the system interruptions to cease.
|
||||
if((offsetresult < 0) || (errno != 0)) {
|
||||
#ifdef VERBOSE_WARNINGS
|
||||
PrintLog("CDVD driver: Error on seek: %i:%s", errno, strerror(errno));
|
||||
#endif /* VERBOSE_WARNINGS */
|
||||
InitDVDSectorInfo();
|
||||
return(-1);
|
||||
} // ENDIF- trouble with seek? Reset pointer and abort
|
||||
} // ENDIF- Do we have to seek a new position to read?
|
||||
|
||||
errno = 4;
|
||||
while(errno == 4) {
|
||||
errno = 0;
|
||||
s32result = read(devicehandle, buffer, 2048);
|
||||
} // ENDWHILE- waiting for the system interruptions to cease.
|
||||
if((s32result != 2048) || (errno != 0)) {
|
||||
#ifdef VERBOSE_WARNINGS
|
||||
PrintLog("CDVD driver: DVD Short Block, Size: %i", s32result);
|
||||
PrintLog("CDVD driver: Error: %i:%s", errno, strerror(errno));
|
||||
#endif /* VERBOSE_WARNINGS */
|
||||
InitDVDSectorInfo();
|
||||
return(-1);
|
||||
} // ENDIF- Trouble reading the data? Reset pointer and abort
|
||||
|
||||
dvdlastlsn = lsn;
|
||||
return(0); // Call accomplished
|
||||
} // END DVDreadTrack()
|
||||
|
||||
s32 DVDgetTN(cdvdTN *cdvdtn) {
|
||||
#ifdef VERBOSE_FUNCTION
|
||||
PrintLog("CDVD driver: CDVDgetTN()");
|
||||
#endif /* VERBOSE_FUNCTION */
|
||||
|
||||
// Going to treat this as one large track for now.
|
||||
if(cdvdtn != NULL) {
|
||||
cdvdtn->strack = 1;
|
||||
cdvdtn->etrack = 1;
|
||||
} // ENDIF- programmer actually WANTS this info?
|
||||
|
||||
return(0); // Call accomplished
|
||||
} // END DVDgetTN()
|
||||
|
||||
s32 DVDgetTD(u8 newtrack, cdvdTD *cdvdtd) {
|
||||
#ifdef VERBOSE_FUNCTION
|
||||
PrintLog("CDVD driver: CDVDgetTD()");
|
||||
#endif /* VERBOSE_FUNCTION */
|
||||
|
||||
if((newtrack >= 2) && (newtrack != CDROM_LEADOUT)) return(-1);
|
||||
|
||||
if(cdvdtd != NULL) {
|
||||
cdvdtd->lsn = dvdphysical.physical.layer[0].end_sector
|
||||
- dvdphysical.physical.layer[0].start_sector
|
||||
+ 1;
|
||||
cdvdtd->type = CDVD_MODE_2048;
|
||||
} // ENDIF- Does the caller REALLY want this data?
|
||||
|
||||
return(0); // Call accomplished
|
||||
} // END DVDgetTD()
|
||||
|
||||
s32 DVDgetDiskType(s32 ioctldisktype) {
|
||||
s32 s32result;
|
||||
int i;
|
||||
s32 tempdisctype;
|
||||
|
||||
errno = 0;
|
||||
s32result = 0;
|
||||
i = 0;
|
||||
tempdisctype = CDVD_TYPE_UNKNOWN;
|
||||
|
||||
#ifdef VERBOSE_FUNCTION
|
||||
PrintLog("CDVD driver: DVDgetDiskType()");
|
||||
#endif /* VERBOSE_FUNCTION */
|
||||
|
||||
if((ioctldisktype != CDS_DATA_1) && (ioctldisktype != CDS_MIXED)) {
|
||||
return(-1);
|
||||
} // ENDIF- Not a data disc we know of? Abort then
|
||||
|
||||
s32result = DVDreadPhysical();
|
||||
if((s32result != 0) || (errno != 0)) {
|
||||
return(-1);
|
||||
} // ENDIF- Error reading the DVD physical structure? Not a DVD after all.
|
||||
|
||||
if(dvdphysical.physical.layer[0].end_sector >= (2048*1024)) {
|
||||
#ifdef VERBOSE_DISC_TYPE
|
||||
PrintLog("CDVD driver: DVD Found (Dual-Sided)");
|
||||
#endif /* VERBOSE_DISC_TYPE */
|
||||
disctype = CDVD_TYPE_DETCTDVDD;
|
||||
} else {
|
||||
#ifdef VERBOSE_DISC_TYPE
|
||||
PrintLog("CDVD driver: DVD Found (Single-Sided)");
|
||||
#endif /* VERBOSE_DISC_TYPE */
|
||||
disctype = CDVD_TYPE_DETCTDVDS;
|
||||
} // ENDIF- Definitely a DVD. Size Test?
|
||||
|
||||
// Read in the rest of the structures...
|
||||
DVDreadCopyright();
|
||||
DVDreadBCA();
|
||||
DVDreadManufact();
|
||||
|
||||
// Test for "Playstation" header
|
||||
s32result = DVDreadTrack(16, CDVD_MODE_2048, dvdtempbuffer);
|
||||
if(s32result != 0) {
|
||||
return(-1);
|
||||
} else {
|
||||
i = 0;
|
||||
while((*(playstationname + i) != 0) &&
|
||||
(*(playstationname + i) == dvdtempbuffer[8 + i])) {
|
||||
i++;
|
||||
} // ENDWHILE- Checking each letter of PLAYSTATION name for a match
|
||||
if(*(playstationname + i) == 0) {
|
||||
#ifdef VERBOSE_DISC_TYPE
|
||||
PrintLog("CDVD driver: Detected Playstation 2 DVD");
|
||||
#endif /* VERBOSE_DISC_TYPE */
|
||||
tempdisctype = CDVD_TYPE_PS2DVD;
|
||||
} else {
|
||||
#ifdef VERBOSE_DISC_TYPE
|
||||
PrintLog("CDVD driver: Guessing it's a Video DVD");
|
||||
#endif /* VERBOSE_DISC_TYPE */
|
||||
tempdisctype = CDVD_TYPE_DVDV;
|
||||
} // ENDIF- Did we find the Playstation name?
|
||||
} // ENDIF- Error reading disc volume information? Invalidate Disc
|
||||
|
||||
if(dvdphysical.physical.layer[0].end_sector >= (2048*1024)) {
|
||||
tocbuffer[0] = 0x24; // Dual-Sided DVD
|
||||
tocbuffer[4] = 0x41;
|
||||
tocbuffer[5] = 0x95;
|
||||
} else {
|
||||
tocbuffer[0] = 0x04; // Single-Sided DVD
|
||||
tocbuffer[4] = 0x86;
|
||||
tocbuffer[5] = 0x72;
|
||||
} // ENDIF- Are there too many sectors for a single-sided disc?
|
||||
|
||||
tocbuffer[1] = 0x02;
|
||||
tocbuffer[2] = 0xF2;
|
||||
tocbuffer[3] = 0x00;
|
||||
|
||||
tocbuffer[16] = 0x00;
|
||||
tocbuffer[17] = 0x03;
|
||||
tocbuffer[18] = 0x00;
|
||||
tocbuffer[19] = 0x00;
|
||||
|
||||
disctype = tempdisctype; // Triggers the fact the other info is available
|
||||
return(disctype);
|
||||
} // END DVDgetDiskType()
|
|
@ -1,78 +0,0 @@
|
|||
/* DVD.h
|
||||
|
||||
* Copyright (C) 2002-2005 PCSX2 Team
|
||||
|
||||
*
|
||||
|
||||
* 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 2 of the License, or
|
||||
|
||||
* (at your option) any later version.
|
||||
|
||||
*
|
||||
|
||||
* 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. See the
|
||||
|
||||
* GNU General Public License for more details.
|
||||
|
||||
*
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
|
||||
* along with this program; if not, write to the Free Software
|
||||
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef __DVD_H__
|
||||
|
||||
#define __DVD_H__
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define CDVDdefs
|
||||
|
||||
#include "PS2Edefs.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Exported Functions
|
||||
|
||||
|
||||
|
||||
extern void HexDump(u8 *strptr, u8 count);
|
||||
|
||||
extern void InitDVDInfo();
|
||||
|
||||
extern s32 DVDreadTrack(u32 lsn, int mode, u8 *buffer);
|
||||
|
||||
extern s32 DVDgetTN(cdvdTN *cdvdtn);
|
||||
|
||||
extern s32 DVDgetTD(u8 newtrack, cdvdTD *cdvdtd);
|
||||
|
||||
extern s32 DVDgetDiskType(s32 ioctldisktype);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* __DVD_H__ */
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
|
||||
PLUGIN = libCDVDlinuz.so
|
||||
PLUGINOBJS = CDVDlinuz.o ../buffer.o
|
||||
PLUGINHEADERS = CDVDlinuz.h ../buffer.h
|
||||
PLUGINFLAGS = -fPIC -Wall -O2 -fomit-frame-pointer -D_LARGEFILE64_SOURCE \
|
||||
-I.. -I. -I./Linux -m32
|
||||
PLUGINLIBS =
|
||||
|
||||
CFG = cfgCDVDlinuz
|
||||
CFGOBJS = aboutbox.o mainbox.o interface.o
|
||||
CFGHEADERS = aboutbox.h mainbox.h interface.h
|
||||
CFGFLAGS = -fPIC -Wall -O2 -fomit-frame-pointer -D_LARGEFILE64_SOURCE \
|
||||
-I.. -I. -I./Linux -m32
|
||||
CFGLIBS =
|
||||
|
||||
SHAREDOBJS = actualfile.o conf.o logfile.o \
|
||||
device.o CD.o DVD.o \
|
||||
../convert.o ../ini.o ../version.o
|
||||
SHAREDHEADERS = actualfile.h conf.h logfile.h \
|
||||
device.h CD.h DVD.h \
|
||||
../convert.h ../ini.h ../version.h
|
||||
|
||||
|
||||
CC = gcc
|
||||
|
||||
GTKFLAGS = $(shell pkg-config --cflags gtk+-2.0)
|
||||
|
||||
//GTKFLAGS += -DG_DISABLE_DEPRECATED \
|
||||
// -DGDK_DISABLE_DEPRECATED \
|
||||
// -DGDK_PIXBUF_DISABLE_DEPRECATED \
|
||||
// -DGTK_DISABLE_DEPRECATED
|
||||
|
||||
GTKLIBS = $(shell pkg-config --libs gtk+-2.0)
|
||||
# Do we need to remove "-rdynamic" as well? Or is that just the main program?
|
||||
|
||||
|
||||
all: plugin cfg
|
||||
install: all
|
||||
|
||||
release: plugin cfg
|
||||
cp $(PLUGIN) ../..
|
||||
cp $(CFG) ../..
|
||||
|
||||
plugin: $(PLUGINOBJS) $(SHAREDOBJS)
|
||||
# rm -f $(PLUGIN)
|
||||
$(CC) -shared -Wl,-soname,$(PLUGIN) $(PLUGINFLAGS) $(PLUGINLIBS) \
|
||||
$(PLUGINOBJS) $(SHAREDOBJS) -o $(PLUGIN)
|
||||
strip --strip-unneeded --strip-debug $(PLUGIN)
|
||||
|
||||
cfg: $(CFGOBJS) $(SHAREDOBJS)
|
||||
# rm -f $(CFG)
|
||||
$(CC) $(CFGFLAGS) $(GTKFLAGS) $(CFGLIBS) $(GTKLIBS) \
|
||||
$(CFGOBJS) $(SHAREDOBJS) -o $(CFG)
|
||||
strip $(CFG)
|
||||
|
||||
$(PLUGINOBJS) $(SHAREDOBJS): %.o: %.c
|
||||
$(CC) $(PLUGINFLAGS) -c $< -o $@
|
||||
|
||||
$(CFGOBJS): %.o: %.c
|
||||
$(CC) $(CFGFLAGS) $(GTKFLAGS) -c $< -o $@
|
||||
|
||||
.PHONY : clean allclean
|
||||
clean:
|
||||
-rm -f $(PLUGINOBJS) $(PLUGIN) $(CFGOBJS) $(CFG) $(SHAREDOBJS)
|
||||
-rm -f *~ temp.txt ../*~ ../temp.txt ../../*~
|
||||
|
||||
allclean:
|
||||
-rm -f $(PLUGINOBJS) $(PLUGIN) $(CFGOBJS) $(CFG) $(SHAREDOBJS)
|
||||
-rm -f *~ temp.txt ../*~ ../temp.txt ../../*~
|
||||
-rm -f ../../$(PLUGIN) ../../$(CFG)
|
||||
|
|
@ -1,192 +0,0 @@
|
|||
/* aboutbox.c
|
||||
|
||||
* Copyright (C) 2002-2005 PCSX2 Team
|
||||
|
||||
*
|
||||
|
||||
* 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 2 of the License, or
|
||||
|
||||
* (at your option) any later version.
|
||||
|
||||
*
|
||||
|
||||
* 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. See the
|
||||
|
||||
* GNU General Public License for more details.
|
||||
|
||||
*
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
|
||||
* along with this program; if not, write to the Free Software
|
||||
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <stddef.h> // NULL
|
||||
#include <stdio.h> // sprintf()
|
||||
#include <gtk/gtk.h>
|
||||
#include "CDVDlinuz.h"
|
||||
#include "aboutbox.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
struct AboutBoxData aboutbox;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
gint AboutBoxCancelEvent(GtkWidget *widget, GdkEvent event, gpointer data) {
|
||||
|
||||
if(aboutbox.window != NULL) {
|
||||
|
||||
gtk_widget_destroy(aboutbox.window);
|
||||
|
||||
aboutbox.window = NULL;
|
||||
|
||||
} // ENDIF- Do we have an About Box still?
|
||||
|
||||
|
||||
|
||||
gtk_main_quit();
|
||||
|
||||
return(TRUE);
|
||||
|
||||
} // END AboutBoxCancelEvent()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void AboutBoxDisplay() {
|
||||
|
||||
GtkWidget *item;
|
||||
|
||||
GtkWidget *container;
|
||||
|
||||
GtkWidget *vbox1;
|
||||
|
||||
char templine[256];
|
||||
|
||||
|
||||
|
||||
aboutbox.window = NULL;
|
||||
|
||||
aboutbox.window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
gtk_container_set_border_width(GTK_CONTAINER(aboutbox.window), 5);
|
||||
|
||||
gtk_window_set_title(GTK_WINDOW(aboutbox.window), "About CDVDlinuz");
|
||||
|
||||
gtk_window_set_position(GTK_WINDOW(aboutbox.window), GTK_WIN_POS_CENTER);
|
||||
|
||||
gtk_window_set_modal(GTK_WINDOW(aboutbox.window), TRUE);
|
||||
|
||||
gtk_window_set_resizable(GTK_WINDOW(aboutbox.window), FALSE);
|
||||
|
||||
|
||||
|
||||
g_signal_connect(G_OBJECT(aboutbox.window), "delete_event",
|
||||
|
||||
G_CALLBACK(AboutBoxCancelEvent), NULL);
|
||||
|
||||
|
||||
|
||||
vbox1 = gtk_vbox_new(FALSE, 5);
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(aboutbox.window), vbox1);
|
||||
|
||||
gtk_container_set_border_width(GTK_CONTAINER(vbox1), 5);
|
||||
|
||||
gtk_widget_show(vbox1);
|
||||
|
||||
|
||||
|
||||
sprintf(templine, "%s v%i.%i", libname, revision, build);
|
||||
|
||||
item = gtk_label_new(templine);
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), item, FALSE, FALSE, 0);
|
||||
|
||||
gtk_widget_show(item);
|
||||
|
||||
item = NULL;
|
||||
|
||||
|
||||
|
||||
item = gtk_label_new("Current Author: efp");
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), item, FALSE, FALSE, 0);
|
||||
|
||||
gtk_widget_show(item);
|
||||
|
||||
item = NULL;
|
||||
|
||||
|
||||
|
||||
item = gtk_label_new("Original code by: linuzappz & shadow");
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), item, FALSE, FALSE, 0);
|
||||
|
||||
gtk_widget_show(item);
|
||||
|
||||
item = NULL;
|
||||
|
||||
|
||||
|
||||
container = gtk_hbutton_box_new();
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), container, TRUE, TRUE, 0);
|
||||
|
||||
gtk_widget_show(container);
|
||||
|
||||
|
||||
|
||||
item = gtk_button_new_with_label("Ok");
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(container), item);
|
||||
|
||||
GTK_WIDGET_SET_FLAGS(item, GTK_CAN_DEFAULT);
|
||||
|
||||
gtk_widget_show(item);
|
||||
|
||||
|
||||
|
||||
g_signal_connect(G_OBJECT(item), "clicked",
|
||||
|
||||
G_CALLBACK(AboutBoxCancelEvent), NULL);
|
||||
|
||||
item = NULL;
|
||||
|
||||
container = NULL;
|
||||
|
||||
vbox1 = NULL;
|
||||
|
||||
|
||||
|
||||
gtk_widget_show(aboutbox.window);
|
||||
|
||||
gtk_main();
|
||||
|
||||
} // END AboutDisplay()
|
||||
|
|
@ -1,78 +0,0 @@
|
|||
/* aboutbox.h
|
||||
|
||||
* Copyright (C) 2002-2005 PCSX2 Team
|
||||
|
||||
*
|
||||
|
||||
* 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 2 of the License, or
|
||||
|
||||
* (at your option) any later version.
|
||||
|
||||
*
|
||||
|
||||
* 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. See the
|
||||
|
||||
* GNU General Public License for more details.
|
||||
|
||||
*
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
|
||||
* along with this program; if not, write to the Free Software
|
||||
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef ABOUTBOX_H
|
||||
|
||||
#define ABOUTBOX_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
struct AboutBoxData {
|
||||
|
||||
GtkWidget *window; // GtkWindow - About Box
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
extern struct AboutBoxData aboutbox;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern void AboutBoxDisplay();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* ABOUTBOX_H */
|
||||
|
|
@ -1,444 +0,0 @@
|
|||
/* actualfile.c
|
||||
|
||||
* Copyright (C) 2002-2005 PCSX2 Team
|
||||
|
||||
*
|
||||
|
||||
* 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 2 of the License, or
|
||||
|
||||
* (at your option) any later version.
|
||||
|
||||
*
|
||||
|
||||
* 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. See the
|
||||
|
||||
* GNU General Public License for more details.
|
||||
|
||||
*
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
|
||||
* along with this program; if not, write to the Free Software
|
||||
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <errno.h> // errno
|
||||
|
||||
#include <fcntl.h> // open()
|
||||
|
||||
#include <stdio.h> // rename()
|
||||
|
||||
#include <string.h> // strerror()
|
||||
|
||||
#include <sys/stat.h> // stat64(), open(), fstat()
|
||||
|
||||
#include <sys/types.h> // stat64(), open(), fstat(), lseek64()
|
||||
|
||||
#include <unistd.h> // stat64(), fstat(), lseek64(), read(), close(), write()
|
||||
|
||||
// unlink()
|
||||
|
||||
|
||||
|
||||
#include "logfile.h"
|
||||
|
||||
#include "actualfile.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int IsActualFile(const char *filename) {
|
||||
|
||||
int retval;
|
||||
|
||||
struct stat64 filestat;
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: IsActualFile(%s)", filename);
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
|
||||
|
||||
errno = 0;
|
||||
|
||||
retval = stat64(filename, &filestat);
|
||||
|
||||
if((retval < 0) || (errno != 0)) {
|
||||
|
||||
#ifdef VERBOSE_WARNING_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: Error retrieving stats on %s", filename);
|
||||
|
||||
PrintLog("CDVDiso file: %i:%s\n", errno, strerror(errno));
|
||||
|
||||
#endif /* VERBOSE_WARNING_ACTUALFILE */
|
||||
|
||||
return(-1); // Name doesn't exist.
|
||||
|
||||
} // ENDIF- Trouble getting stat on a file?
|
||||
|
||||
|
||||
|
||||
if(S_ISREG(filestat.st_mode) == 0) return(-2); // Not a regular file.
|
||||
|
||||
return(0); // Yep, that's a file.
|
||||
|
||||
} // END IsActualFile()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void ActualFileDelete(const char *filename) {
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileDelete(%s)", filename);
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
|
||||
|
||||
unlink(filename);
|
||||
|
||||
} // END ActualFileDelete()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void ActualFileRename(const char *origname, const char *newname) {
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileRename(%s->%s)", origname, newname);
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
|
||||
|
||||
rename(origname, newname);
|
||||
|
||||
return;
|
||||
|
||||
} // END ActualFileRename()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ACTUALHANDLE ActualFileOpenForRead(const char *filename) {
|
||||
|
||||
int newhandle;
|
||||
|
||||
|
||||
|
||||
if(filename == NULL) return(-1);
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileOpenForRead(%s)", filename);
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
|
||||
|
||||
errno = 0;
|
||||
|
||||
newhandle = open(filename, O_RDONLY | O_LARGEFILE);
|
||||
|
||||
if((newhandle < 0) || (errno != 0)) {
|
||||
|
||||
#ifdef VERBOSE_WARNING_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: Error opening file %s\n", filename);
|
||||
|
||||
PrintLog("CDVDiso file: (%i) %i:%s\n", newhandle, errno, strerror(errno));
|
||||
|
||||
#endif /* VERBOSE_WARNING_ACTUALFILE */
|
||||
|
||||
return(-1);
|
||||
|
||||
} // ENDIF- Error? Abort
|
||||
|
||||
|
||||
|
||||
return(newhandle);
|
||||
|
||||
} // END ActualFileOpenForRead()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
off64_t ActualFileSize(ACTUALHANDLE handle) {
|
||||
|
||||
int retval;
|
||||
|
||||
struct stat64 filestat;
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileSize()\n");
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
|
||||
|
||||
errno = 0;
|
||||
|
||||
retval = fstat64(handle, &filestat);
|
||||
|
||||
if((retval < 0) || (errno != 0)) return(-1); // Name doesn't exist.
|
||||
|
||||
return(filestat.st_size);
|
||||
|
||||
} // END ActualFileSize()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int ActualFileSeek(ACTUALHANDLE handle, off64_t position) {
|
||||
|
||||
off64_t moved;
|
||||
|
||||
|
||||
|
||||
if(handle < 0) return(-1);
|
||||
|
||||
if(position < 0) return(-1); // Maybe... position = 0?
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileSeek(%lli)", position);
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
|
||||
|
||||
errno = 0;
|
||||
|
||||
moved = lseek64(handle, position, SEEK_SET);
|
||||
|
||||
if(errno != 0) {
|
||||
|
||||
#ifdef VERBOSE_WARNING_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: Error on seek (%lli)", position);
|
||||
|
||||
PrintLog("CDVDiso file: %i:%s\n", errno, strerror(errno));
|
||||
|
||||
#endif /* VERBOSE_WARNING_ACTUALFILE */
|
||||
|
||||
return(-1);
|
||||
|
||||
} // ENDIF- Error? Abort
|
||||
|
||||
|
||||
|
||||
return(0);
|
||||
|
||||
} // END ActualFileSeek()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int ActualFileRead(ACTUALHANDLE handle, int bytes, char *buffer) {
|
||||
|
||||
int retval;
|
||||
|
||||
|
||||
|
||||
if(handle == ACTUALHANDLENULL) return(-1);
|
||||
|
||||
if(bytes < 1) return(-1);
|
||||
|
||||
if(buffer == NULL) return(-1);
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileRead(%i)", bytes);
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
|
||||
|
||||
errno = 0;
|
||||
|
||||
retval = read(handle, buffer, bytes);
|
||||
|
||||
if((retval < 0) || (errno != 0)) {
|
||||
|
||||
#ifdef VERBOSE_WARNING_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: Error reading from file!");
|
||||
|
||||
PrintLog("CDVDiso file: %i:%s", errno, strerror(errno));
|
||||
|
||||
#endif /* VERBOSE_WARNING_ACTUALFILE */
|
||||
|
||||
// return(-1);
|
||||
|
||||
} // ENDIF- Error? Abort
|
||||
|
||||
|
||||
|
||||
return(retval); // Send back how many bytes read
|
||||
|
||||
} // END ActualFileRead()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void ActualFileClose(ACTUALHANDLE handle) {
|
||||
|
||||
if(handle < 0) return;
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileClose()");
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
|
||||
|
||||
errno = 0;
|
||||
|
||||
close(handle);
|
||||
|
||||
return;
|
||||
|
||||
} // END ActualFileClose()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ACTUALHANDLE ActualFileOpenForWrite(const char *filename) {
|
||||
|
||||
int newhandle;
|
||||
|
||||
|
||||
|
||||
if(filename == NULL) return(-1);
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileOpenForWrite(%s)", filename);
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
|
||||
|
||||
errno = 0;
|
||||
|
||||
newhandle = open(filename, O_WRONLY | O_CREAT | O_LARGEFILE, 0644);
|
||||
|
||||
if((newhandle < 0) || (errno != 0)) {
|
||||
|
||||
#ifdef VERBOSE_WARNING_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: Error opening file %s", filename);
|
||||
|
||||
PrintLog("CDVDiso file: (%i) %i:%s", newhandle, errno, strerror(errno));
|
||||
|
||||
#endif /* VERBOSE_WARNING_ACTUALFILE */
|
||||
|
||||
return(-1);
|
||||
|
||||
} // ENDIF- Error? Abort
|
||||
|
||||
|
||||
|
||||
return(newhandle);
|
||||
|
||||
} // END ActualFileOpenForWrite()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int ActualFileWrite(ACTUALHANDLE handle, int bytes, char *buffer) {
|
||||
|
||||
int retval;
|
||||
|
||||
|
||||
|
||||
if(handle < 0) return(-1);
|
||||
|
||||
if(bytes < 1) return(-1);
|
||||
|
||||
if(buffer == NULL) return(-1);
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileWrite(%i)", bytes);
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
|
||||
|
||||
errno = 0;
|
||||
|
||||
retval = write(handle, buffer, bytes);
|
||||
|
||||
if((retval < 0) || (errno != 0)) {
|
||||
|
||||
#ifdef VERBOSE_WARNING_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: Error writing to file!");
|
||||
|
||||
PrintLog("CDVDiso file: %i:%s", errno, strerror(errno));
|
||||
|
||||
#endif /* VERBOSE_WARNING_ACTUALFILE */
|
||||
|
||||
// return(-1);
|
||||
|
||||
} // ENDIF- Error? Abort
|
||||
|
||||
|
||||
|
||||
return(retval); // Send back how many bytes written
|
||||
|
||||
} // END ActualFileWrite()
|
||||
|
|
@ -1,100 +0,0 @@
|
|||
/* actualfile.h
|
||||
|
||||
* Copyright (C) 2002-2005 PCSX2 Team
|
||||
|
||||
*
|
||||
|
||||
* 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 2 of the License, or
|
||||
|
||||
* (at your option) any later version.
|
||||
|
||||
*
|
||||
|
||||
* 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. See the
|
||||
|
||||
* GNU General Public License for more details.
|
||||
|
||||
*
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
|
||||
* along with this program; if not, write to the Free Software
|
||||
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef ACTUALFILE_H
|
||||
|
||||
#define ACTUALFILE_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <sys/types.h> // off64_t
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define ACTUALHANDLE int
|
||||
|
||||
#define ACTUALHANDLENULL -1
|
||||
|
||||
|
||||
|
||||
// #define VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
// #define VERBOSE_WARNING_ACTUALFILE
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern int IsActualFile(const char *filename);
|
||||
|
||||
extern void ActualFileDelete(const char *filename);
|
||||
|
||||
extern void ActualFileRename(const char *origname, const char *newname);
|
||||
|
||||
|
||||
|
||||
extern ACTUALHANDLE ActualFileOpenForRead(const char *filename);
|
||||
|
||||
extern off64_t ActualFileSize(ACTUALHANDLE handle);
|
||||
|
||||
extern int ActualFileSeek(ACTUALHANDLE handle, off64_t position);
|
||||
|
||||
extern int ActualFileRead(ACTUALHANDLE handle, int bytes, char *buffer);
|
||||
|
||||
extern void ActualFileClose(ACTUALHANDLE handle);
|
||||
|
||||
|
||||
|
||||
extern ACTUALHANDLE ActualFileOpenForWrite(const char *filename);
|
||||
|
||||
extern int ActualFileWrite(ACTUALHANDLE handle, int bytes, char *buffer);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* ACTUALFILE_H */
|
||||
|
|
@ -1,184 +0,0 @@
|
|||
/* conf.c
|
||||
* Copyright (C) 2002-2005 PCSX2 Team
|
||||
*
|
||||
* 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
*/
|
||||
|
||||
#include <errno.h> // errno
|
||||
#include <stddef.h> // NULL
|
||||
#include <stdio.h> // sprintf()
|
||||
#include <stdlib.h> // getenv()
|
||||
#include <string.h> // strerror()
|
||||
#include <sys/stat.h> // mkdir(), stat()
|
||||
#include <sys/types.h> // mkdir(), stat()
|
||||
#include <unistd.h> // stat()
|
||||
|
||||
// #define CDVDdefs
|
||||
// #include "../PS2Edefs.h"
|
||||
#include "logfile.h"
|
||||
#include "../ini.h"
|
||||
#include "conf.h"
|
||||
|
||||
|
||||
const char *cfgname[] = { \
|
||||
"./cfg/cfgCDVDlinuz", \
|
||||
"../cfg/cfgCDVDlinuz", \
|
||||
"./plugins/cfgCDVDlinuz", \
|
||||
"../plugins/cfgCDVDlinuz", \
|
||||
"./cfgCDVDlinuz", \
|
||||
"../cfgCDVDlinuz", \
|
||||
NULL };
|
||||
|
||||
const char *confnames[] = { "Device", NULL };
|
||||
const u8 defaultdevice[] = DEFAULT_DEVICE;
|
||||
const char defaulthome[] = "../inis";
|
||||
const char defaultdirectory[] = ".PS2E";
|
||||
const char defaultfile[] = "CDVDlinuz.ini";
|
||||
|
||||
char confdirname[256];
|
||||
char conffilename[256];
|
||||
|
||||
CDVDconf conf;
|
||||
|
||||
|
||||
void ExecCfg(char *arg) {
|
||||
int nameptr;
|
||||
struct stat filestat;
|
||||
char templine[256];
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_CONF
|
||||
PrintLog("CDVDiso interface: ExecCfg(%s)", arg);
|
||||
#endif /* VERBOSE FUNCTION_CONF */
|
||||
errno = 0;
|
||||
nameptr = 0;
|
||||
while((cfgname[nameptr] != NULL) &&
|
||||
(stat(cfgname[nameptr], &filestat) == -1)) nameptr++;
|
||||
errno = 0;
|
||||
|
||||
if(cfgname[nameptr] == NULL) {
|
||||
#ifdef VERBOSE_FUNCTION_CONF
|
||||
PrintLog("CDVDiso interface: Couldn't find configuration program!");
|
||||
#endif /* VERBOSE_FUNCTION_CONF */
|
||||
return;
|
||||
} // ENDIF- Did not find the executable?
|
||||
|
||||
sprintf(templine, "%s %s", cfgname[nameptr], arg);
|
||||
system(templine);
|
||||
} // END ExecCfg()
|
||||
|
||||
|
||||
void InitConf() {
|
||||
int i;
|
||||
int pos;
|
||||
char *envptr;
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_CONF
|
||||
PrintLog("CDVD config: InitConf()");
|
||||
#endif /* VERBOSE_FUNCTION_CONF */
|
||||
|
||||
i = 0;
|
||||
while((i < 255) && defaultdevice[i] != 0) {
|
||||
conf.devicename[i] = defaultdevice[i];
|
||||
i++;
|
||||
} // ENDWHILE- copying the default CD/DVD name in
|
||||
conf.devicename[i] = 0; // 0-terminate the device name
|
||||
|
||||
// Locating directory and file positions
|
||||
pos = 0;
|
||||
envptr = getenv("HOME");
|
||||
if(envptr == NULL) {
|
||||
// = <Default Home>
|
||||
i = 0;
|
||||
while((pos < 253) && (defaulthome[i] != 0)) {
|
||||
confdirname[pos] = defaulthome[i];
|
||||
conffilename[pos] = defaulthome[i];
|
||||
pos++;
|
||||
i++;
|
||||
} // NEXT- putting a default place to store configuration data
|
||||
|
||||
} else {
|
||||
// = <Env Home>/<Default Directory>
|
||||
i = 0;
|
||||
while((pos < 253) && (*(envptr + i) != 0)) {
|
||||
confdirname[pos] = *(envptr + i);
|
||||
conffilename[pos] = *(envptr + i);
|
||||
pos++;
|
||||
i++;
|
||||
} // ENDWHILE- copying home directory info in
|
||||
|
||||
if(confdirname[pos-1] != '/') {
|
||||
confdirname[pos] = '/';
|
||||
conffilename[pos] = '/';
|
||||
pos++;
|
||||
} // ENDIF- No directory separator here? Add one.
|
||||
|
||||
i = 0;
|
||||
while((pos < 253) && (defaultdirectory[i] != 0)) {
|
||||
confdirname[pos] = defaultdirectory[i];
|
||||
conffilename[pos] = defaultdirectory[i];
|
||||
pos++;
|
||||
i++;
|
||||
} // NEXT- putting a default place to store configuration data
|
||||
} // ENDIF- No Home directory?
|
||||
|
||||
confdirname[pos] = 0; // Directory reference finished
|
||||
|
||||
// += /<Config File Name>
|
||||
if(conffilename[pos-1] != '/') {
|
||||
conffilename[pos] = '/';
|
||||
pos++;
|
||||
} // ENDIF- No directory separator here? Add one.
|
||||
|
||||
i = 0;
|
||||
while((pos < 253) && (defaultfile[i] != 0)) {
|
||||
conffilename[pos] = defaultfile[i];
|
||||
pos++;
|
||||
i++;
|
||||
} // NEXT- putting a default place to store configuration data
|
||||
|
||||
conffilename[pos] = 0; // File reference finished
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_CONF
|
||||
PrintLog("CDVD config: Directory: %s\n", confdirname);
|
||||
PrintLog("CDVD config: File: %s\n", conffilename);
|
||||
#endif /* VERBOSE_FUNCTION_CONF */
|
||||
} // END InitConf()
|
||||
|
||||
|
||||
void LoadConf() {
|
||||
int retval;
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_CONF
|
||||
PrintLog("CDVD config: LoadConf()\n");
|
||||
#endif /* VERBOSE_FUNCTION_CONF */
|
||||
|
||||
retval = INILoadString(conffilename, "Settings", "Device", conf.devicename);
|
||||
if(retval < 0) {
|
||||
sprintf(conf.devicename, "/dev/dvd");
|
||||
} // ENDIF- Couldn't find keyword? Fill in a default
|
||||
} // END LoadConf()
|
||||
|
||||
|
||||
void SaveConf() {
|
||||
#ifdef VERBOSE_FUNCTION_CONF
|
||||
PrintLog("CDVD config: SaveConf()\n");
|
||||
#endif /* VERBOSE_FUNCTION_CONF */
|
||||
|
||||
mkdir(confdirname, 0755);
|
||||
|
||||
INISaveString(conffilename, "Settings", "Device", conf.devicename);
|
||||
} // END SaveConf()
|
|
@ -1,102 +0,0 @@
|
|||
/* conf.h
|
||||
|
||||
* Copyright (C) 2002-2005 PCSX2 Team
|
||||
|
||||
*
|
||||
|
||||
* 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 2 of the License, or
|
||||
|
||||
* (at your option) any later version.
|
||||
|
||||
*
|
||||
|
||||
* 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. See the
|
||||
|
||||
* GNU General Public License for more details.
|
||||
|
||||
*
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
|
||||
* along with this program; if not, write to the Free Software
|
||||
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef CONF_H
|
||||
|
||||
#define CONF_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define CDVDdefs
|
||||
|
||||
#include "../PS2Edefs.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define VERBOSE_FUNCTION_CONF
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Configuration Data
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
|
||||
u8 devicename[256];
|
||||
|
||||
} CDVDconf;
|
||||
|
||||
extern CDVDconf conf;
|
||||
|
||||
|
||||
|
||||
#define DEFAULT_DEVICE "/dev/cdrom"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Configuration Functions
|
||||
|
||||
|
||||
|
||||
extern void InitConf();
|
||||
|
||||
extern void LoadConf();
|
||||
|
||||
extern void SaveConf();
|
||||
|
||||
|
||||
|
||||
extern void ExecCfg(char *arg);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* CONF_H */
|
||||
|
|
@ -1,420 +0,0 @@
|
|||
/* device.c
|
||||
* Copyright (C) 2002-2005 PCSX2 Team
|
||||
*
|
||||
* 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* 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. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
*/
|
||||
|
||||
#include <errno.h> // errno
|
||||
#include <fcntl.h> // open()
|
||||
#include <stddef.h> // NULL
|
||||
#include <stdlib.h> // getenv()
|
||||
#include <string.h> // strerror()
|
||||
#include <sys/ioctl.h> // ioctl()
|
||||
#include <sys/stat.h> // open()
|
||||
#include <sys/types.h> // open()
|
||||
#include <time.h> // time_t, time(), struct timeval
|
||||
#include <unistd.h> // close(), select()
|
||||
|
||||
#include <linux/cdrom.h> // CD/DVD based ioctl() and defines.
|
||||
|
||||
// missing on some files for some reason.........
|
||||
#ifndef CDC_IOCTLS
|
||||
#define CDC_IOCTLS 0x400
|
||||
#endif
|
||||
|
||||
#include "logfile.h"
|
||||
#include "conf.h"
|
||||
#include "CD.h"
|
||||
#include "DVD.h"
|
||||
#include "device.h"
|
||||
|
||||
#include "../PS2Etypes.h" // u32, u8, s32
|
||||
|
||||
|
||||
// Globals
|
||||
|
||||
int devicehandle; // File Handle for the device/drive
|
||||
s32 devicecapability; // Capability Flags
|
||||
time_t lasttime; // Time marker (in case something gets called too often)
|
||||
s32 traystatus; // Is the CD/DVD tray open?
|
||||
|
||||
s32 disctype; // Type of disc in drive (Video DVD, PSX CD, etc.)
|
||||
u8 tocbuffer[2048];
|
||||
|
||||
|
||||
void DeviceInit() {
|
||||
devicehandle = -1;
|
||||
devicecapability = 0;
|
||||
lasttime = time(NULL);
|
||||
|
||||
InitDisc();
|
||||
} // END DeviceInit()
|
||||
|
||||
|
||||
// Called by DeviceOpen(), DeviceGetDiskType()
|
||||
void InitDisc() {
|
||||
int i;
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_DEVICE
|
||||
PrintLog("CDVD device: InitDisc()");
|
||||
#endif /* VERBOSE_FUNCTION_DEVICE */
|
||||
|
||||
if((disctype == CDVD_TYPE_PS2DVD) ||
|
||||
(disctype == CDVD_TYPE_DVDV)) {
|
||||
InitDVDInfo();
|
||||
} // ENDIF- Clean out DVD Disc Info?
|
||||
|
||||
if((disctype == CDVD_TYPE_PS2CD) ||
|
||||
(disctype == CDVD_TYPE_PS2CDDA) ||
|
||||
(disctype == CDVD_TYPE_PSCD) ||
|
||||
(disctype == CDVD_TYPE_PSCDDA) ||
|
||||
(disctype == CDVD_TYPE_CDDA)) {
|
||||
InitCDInfo();
|
||||
} // ENDIF- Clean out DVD Disc Info?
|
||||
|
||||
disctype = CDVD_TYPE_NODISC;
|
||||
for(i = 0; i > sizeof(tocbuffer); i++) tocbuffer[i] = 0x00;
|
||||
} // END InitDisc()
|
||||
|
||||
|
||||
s32 DiscInserted() {
|
||||
if(devicehandle == -1) return(-1);
|
||||
if(traystatus == CDVD_TRAY_OPEN) return(-1);
|
||||
if(disctype == CDVD_TYPE_ILLEGAL) return(-1);
|
||||
// if(disctype == CDVD_TYPE_UNKNOWN) return(-1); // Hmm. Let this one through?
|
||||
if(disctype == CDVD_TYPE_DETCTDVDD) return(-1);
|
||||
if(disctype == CDVD_TYPE_DETCTDVDS) return(-1);
|
||||
if(disctype == CDVD_TYPE_DETCTCD) return(-1);
|
||||
if(disctype == CDVD_TYPE_DETCT) return(-1);
|
||||
if(disctype == CDVD_TYPE_NODISC) return(-1);
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_DEVICE
|
||||
PrintLog("CDVD device: DiscInserted()");
|
||||
#endif /* VERBOSE_FUNCTION_DEVICE */
|
||||
|
||||
return(0);
|
||||
} // END DiscInserted()
|
||||
|
||||
|
||||
// Called by DeviceTrayStatus() and CDVDopen()
|
||||
s32 DeviceOpen() {
|
||||
// s32 s32result;
|
||||
|
||||
errno = 0;
|
||||
|
||||
if(devicehandle != -1) {
|
||||
#ifdef VERBOSE_WARNING_DEVICE
|
||||
PrintLog("CDVD device: Device already open!");
|
||||
#endif /* VERBOSE_WARNING_DEVICE */
|
||||
return(0);
|
||||
} // ENDIF- Is the CD/DVD already in use? That's fine.
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_DEVICE
|
||||
PrintLog("CDVD device: DeviceOpen()");
|
||||
#endif /* VERBOSE_FUNCTION_DEVICE */
|
||||
|
||||
// InitConf();
|
||||
// LoadConf(); // Should be done once before making this call
|
||||
|
||||
devicehandle = open(conf.devicename, O_RDONLY | O_NONBLOCK);
|
||||
if(devicehandle == -1) {
|
||||
#ifdef VERBOSE_WARNINGS
|
||||
PrintLog("CDVD device: Error opening device: %i:%s", errno, strerror(errno));
|
||||
#endif /* VERBOSE_WARNINGS */
|
||||
return(-1);
|
||||
} // ENDIF- Failed to open device? Abort
|
||||
|
||||
// Note: Hmm. Need a minimum capability in case this fails?
|
||||
devicecapability = ioctl(devicehandle, CDROM_GET_CAPABILITY);
|
||||
if(errno != 0) {
|
||||
#ifdef VERBOSE_WARNINGS
|
||||
PrintLog("CDVD device: Error getting device capabilities: %i:%s", errno, strerror(errno));
|
||||
#endif /* VERBOSE_WARNINGS */
|
||||
close(devicehandle);
|
||||
devicehandle = -1;
|
||||
devicecapability = 0;
|
||||
return(-1);
|
||||
} // ENDIF- Can't read drive capabilities? Close and Abort.
|
||||
|
||||
#ifdef VERBOSE_DISC_TYPE
|
||||
PrintLog("CDVD device: Device Type(s)");
|
||||
if(devicecapability < CDC_CD_R) PrintLog("CDVD device: CD");
|
||||
if(devicecapability & CDC_CD_R) PrintLog("CDVD device: CD-R");
|
||||
if(devicecapability & CDC_CD_RW) PrintLog("CDVD device: CD-RW");
|
||||
if(devicecapability & CDC_DVD) PrintLog("CDVD device: DVD");
|
||||
if(devicecapability & CDC_DVD_R) PrintLog("CDVD device: DVD-R");
|
||||
if(devicecapability & CDC_DVD_RAM) PrintLog("CDVD device: DVD-RAM");
|
||||
#endif /* VERBOSE_DISC_TYPE */
|
||||
#ifdef VERBOSE_DISC_INFO
|
||||
PrintLog("CDVD device: Device Capabilities:");
|
||||
if(devicecapability & CDC_CLOSE_TRAY) PrintLog("CDVD device: Can close a tray");
|
||||
if(devicecapability & CDC_OPEN_TRAY) PrintLog("CDVD device: Can open a tray");
|
||||
// if(devicecapability & CDC_LOCK) PrintLog("CDVD device: Can lock the drive door");
|
||||
if(devicecapability & CDC_SELECT_SPEED) PrintLog("CDVD device: Can change spin speed");
|
||||
// if(devicecapability & CDC_SELECT_DISC) PrintLog("CDVD device: Can change disks (multi-disk tray)");
|
||||
// if(devicecapability & CDC_MULTI_SESSION) PrintLog("CDVD device: Can read multi-session disks");
|
||||
// if(devicecapability & CDC_MCN) PrintLog("CDVD device: Can read Medium Catalog Numbers (maybe)");
|
||||
if(devicecapability & CDC_MEDIA_CHANGED) PrintLog("CDVD device: Can tell if the disc was changed");
|
||||
if(devicecapability & CDC_PLAY_AUDIO) PrintLog("CDVD device: Can play audio disks");
|
||||
// if(devicecapability & CDC_RESET) PrintLog("CDVD device: Can reset the device");
|
||||
if(devicecapability & CDC_IOCTLS) PrintLog("CDVD device: Odd IOCTLs. Not sure of compatability");
|
||||
if(devicecapability & CDC_DRIVE_STATUS) PrintLog("CDVD device: Can monitor the drive tray");
|
||||
#endif /* VERBOSE_DISC_INFO */
|
||||
|
||||
////// Should be called after an open (instead of inside of one)
|
||||
// InitDisc();
|
||||
// traystatus = CDVD_TRAY_OPEN; // Start with Tray Open
|
||||
// DeviceTrayStatus(); // Now find out for sure.
|
||||
|
||||
return(0); // Device opened and ready for use.
|
||||
} // END DeviceOpen()
|
||||
|
||||
|
||||
// Called by DeviceTrayStatus(), CDVDclose(), and CDVDshutdown()
|
||||
void DeviceClose() {
|
||||
if(devicehandle == -1) {
|
||||
#ifdef VERBOSE_FUNCTION_DEVICE
|
||||
PrintLog("CDVD device: Device already closed");
|
||||
#endif /* VERBOSE_FUNCTION_DEVICE */
|
||||
return;
|
||||
} // ENDIF- Device already closed? Ok.
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_DEVICE
|
||||
PrintLog("CDVD device: DeviceClose()");
|
||||
#endif /* VERBOSE_FUNCTION_DEVICE */
|
||||
|
||||
InitDisc();
|
||||
close(devicehandle);
|
||||
devicehandle = -1;
|
||||
devicecapability = 0;
|
||||
return;
|
||||
} // END CDVDclose()
|
||||
|
||||
|
||||
s32 DeviceReadTrack(u32 lsn, int mode, u8 *buffer) {
|
||||
s32 s32result;
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_DEVICE
|
||||
PrintLog("CDVD device: DeviceReadTrack(%i)", lsn);
|
||||
#endif /* VERBOSE_FUNCTION_DEVICE */
|
||||
|
||||
if(DiscInserted() == -1) return(-1);
|
||||
|
||||
// Get that data
|
||||
if((disctype == CDVD_TYPE_PS2DVD) || (disctype == CDVD_TYPE_DVDV)) {
|
||||
s32result = DVDreadTrack(lsn, mode, buffer);
|
||||
} else {
|
||||
s32result = CDreadTrack(lsn, mode, buffer);
|
||||
} //ENDIF- Read a DVD sector or a CD sector?
|
||||
|
||||
return(s32result);
|
||||
} // END DeviceReadTrack()
|
||||
|
||||
|
||||
s32 DeviceBufferOffset() {
|
||||
#ifdef VERBOSE_FUNCTION_DEVICE
|
||||
PrintLog("CDVD device: DeviceBufferOffset()");
|
||||
#endif /* VERBOSE_FUNCTION_DEVICE */
|
||||
|
||||
if(DiscInserted() == -1) return(-1);
|
||||
|
||||
if((disctype == CDVD_TYPE_PS2DVD) || (disctype == CDVD_TYPE_DVDV)) {
|
||||
return(0);
|
||||
} else {
|
||||
return(CDgetBufferOffset());
|
||||
} // ENDIF- Is this a DVD?
|
||||
} // END DeviceBufferOffset()
|
||||
|
||||
|
||||
s32 DeviceGetTD(u8 track, cdvdTD *cdvdtd) {
|
||||
if(DiscInserted() == -1) return(-1);
|
||||
|
||||
if((disctype == CDVD_TYPE_PS2DVD) || (disctype == CDVD_TYPE_DVDV)) {
|
||||
return(DVDgetTD(track, cdvdtd));
|
||||
} else {
|
||||
return(CDgetTD(track, cdvdtd));
|
||||
} // ENDIF- Is this a DVD?
|
||||
} // END DeviceGetTD()
|
||||
|
||||
|
||||
// Called by DeviceTrayStatus()
|
||||
s32 DeviceGetDiskType() {
|
||||
s32 s32result;
|
||||
s32 ioctldisktype;
|
||||
|
||||
errno = 0;
|
||||
|
||||
if(devicehandle == -1) {
|
||||
return(-1);
|
||||
} // ENDIF- Someone forget to open the device?
|
||||
|
||||
if(traystatus == CDVD_TRAY_OPEN) {
|
||||
return(disctype);
|
||||
} // ENDIF- Is the device tray open? No disc to check yet.
|
||||
|
||||
if(disctype != CDVD_TYPE_NODISC) {
|
||||
return(disctype);
|
||||
} // ENDIF- Already checked? Drive still closed? Disc hasn't changed.
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_DEVICE
|
||||
PrintLog("CDVD device: DeviceGetDiskType()");
|
||||
#endif /* VERBOSE_FUNCTION_DEVICE */
|
||||
disctype = CDVD_TYPE_DETCT;
|
||||
|
||||
ioctldisktype = ioctl(devicehandle, CDROM_DISC_STATUS);
|
||||
if(errno != 0) {
|
||||
#ifdef VERBOSE_WARNINGS
|
||||
PrintLog("CDVD device: Trouble reading Disc Type!");
|
||||
PrintLog("CDVD device: Error: %i:%s", errno, strerror(errno));
|
||||
#endif /* VERBOSE_WARNINGS */
|
||||
disctype = CDVD_TYPE_UNKNOWN;
|
||||
return(disctype);
|
||||
} // ENDIF- Trouble probing for a disc?
|
||||
|
||||
s32result = DVDgetDiskType(ioctldisktype);
|
||||
if(s32result != -1) {
|
||||
return(disctype);
|
||||
} // ENDIF- Did we find a disc type?
|
||||
|
||||
s32result = CDgetDiskType(ioctldisktype);
|
||||
if(s32result != -1) {
|
||||
return(disctype);
|
||||
} // ENDIF- Did we find a disc type?
|
||||
|
||||
disctype = CDVD_TYPE_UNKNOWN; // Not a CD? Not a DVD? Is is peanut butter?
|
||||
return(disctype);
|
||||
} // END CDVDgetDiskType()
|
||||
|
||||
|
||||
// Called by PollLoop() and CDVDgetTrayStatus()
|
||||
s32 DeviceTrayStatus() {
|
||||
s32 s32result;
|
||||
|
||||
errno = 0;
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_DEVICE
|
||||
PrintLog("CDVD device: DeviceTrayStatus()");
|
||||
#endif /* VERBOSE_FUNCTION_DEVICE */
|
||||
|
||||
if(devicehandle == -1) {
|
||||
return(-1);
|
||||
} // ENDIF- Someone forget to open the device?
|
||||
|
||||
if((devicecapability & CDC_DRIVE_STATUS) != 0) {
|
||||
s32result = ioctl(devicehandle, CDROM_DRIVE_STATUS);
|
||||
if(s32result < 0) {
|
||||
#ifdef VERBOSE_WARNINGS
|
||||
PrintLog("CDVD device: Trouble reading Drive Status!");
|
||||
PrintLog("CDVD device: Error: (%i) %i:%s", s32result, errno, strerror(errno));
|
||||
#endif /* VERBOSE_WARNINGS */
|
||||
s32result = CDS_TRAY_OPEN;
|
||||
} // ENDIF- Failure to get status? Assume it's open.
|
||||
errno = 0;
|
||||
|
||||
} else {
|
||||
s32result = ioctl(devicehandle, CDROM_DISC_STATUS);
|
||||
if(errno != 0) {
|
||||
#ifdef VERBOSE_WARNINGS
|
||||
PrintLog("CDVD device: Trouble detecting Disc Status presense!");
|
||||
PrintLog("CDVD device: Error: (%i) %i:%s", s32result, errno, strerror(errno));
|
||||
#endif /* VERBOSE_WARNINGS */
|
||||
s32result = CDS_TRAY_OPEN;
|
||||
errno = 0;
|
||||
} // ENDIF- Trouble?
|
||||
if(s32result == CDS_NO_DISC) {
|
||||
s32result = CDS_TRAY_OPEN;
|
||||
} // ENDIF- Is there no disc in the device? Guess the tray is open
|
||||
} // ENDIF- Can we poll the tray directly? (Or look at disc status instead?)
|
||||
|
||||
if(s32result == CDS_TRAY_OPEN) {
|
||||
traystatus = CDVD_TRAY_OPEN;
|
||||
if(disctype != CDVD_TYPE_NODISC) {
|
||||
DeviceClose(); // Kind of severe way of flushing all buffers.
|
||||
DeviceOpen();
|
||||
InitDisc();
|
||||
} // ENDIF- Tray just opened... clear disc info
|
||||
} else {
|
||||
traystatus = CDVD_TRAY_CLOSE;
|
||||
if(disctype == CDVD_TYPE_NODISC) {
|
||||
DeviceGetDiskType();
|
||||
} // ENDIF- Tray just closed? Get disc information
|
||||
} // ENDIF- Do we detect an open tray?
|
||||
return(traystatus);
|
||||
} // END CDVD_getTrayStatus()
|
||||
|
||||
|
||||
s32 DeviceTrayOpen() {
|
||||
s32 s32result;
|
||||
|
||||
errno = 0;
|
||||
|
||||
if(devicehandle == -1) {
|
||||
return(-1);
|
||||
} // ENDIF- Someone forget to open the device?
|
||||
|
||||
if((devicecapability & CDC_OPEN_TRAY) == 0) {
|
||||
return(-1);
|
||||
} // ENDIF- Don't have open capability? Error out.
|
||||
|
||||
// Tray already open? Exit.
|
||||
if(traystatus == CDVD_TRAY_OPEN) return(0);
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_DEVICE
|
||||
PrintLog("CDVD device: DeviceTrayOpen()");
|
||||
#endif /* VERBOSE_FUNCTION_DEVICE */
|
||||
|
||||
s32result = ioctl(devicehandle, CDROMEJECT);
|
||||
#ifdef VERBOSE_WARNINGS
|
||||
if((s32result != 0) || (errno != 0)) {
|
||||
PrintLog("CDVD device: Could not open the tray!");
|
||||
PrintLog("CDVD device: Error: (%i) %i:%s", s32result, errno, strerror(errno));
|
||||
} // ENDIF- Trouble?
|
||||
#endif /* VERBOSE_WARNINGS */
|
||||
return(s32result);
|
||||
} // END DeviceTrayOpen()
|
||||
|
||||
|
||||
s32 DeviceTrayClose() {
|
||||
s32 s32result;
|
||||
|
||||
errno = 0;
|
||||
|
||||
if(devicehandle == -1) {
|
||||
return(-1);
|
||||
} // ENDIF- Someone forget to open the device?
|
||||
|
||||
if((devicecapability & CDC_CLOSE_TRAY) == 0) {
|
||||
return(-1);
|
||||
} // ENDIF- Don't have close capability? Error out.
|
||||
|
||||
// Tray already closed? Exit.
|
||||
if(traystatus == CDVD_TRAY_CLOSE) return(0);
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_DEVICE
|
||||
PrintLog("CDVD device: DeviceTrayClose()");
|
||||
#endif /* VERBOSE_FUNCTION_DEVICE */
|
||||
|
||||
s32result = ioctl(devicehandle, CDROMCLOSETRAY);
|
||||
#ifdef VERBOSE_WARNINGS
|
||||
if((s32result != 0) || (errno != 0)) {
|
||||
PrintLog("CDVD device: Could not close the tray!");
|
||||
PrintLog("CDVD device: Error: (%i) %i:%s", s32result, errno, strerror(errno));
|
||||
} // ENDIF- Trouble?
|
||||
#endif /* VERBOSE_WARNINGS */
|
||||
return(s32result);
|
||||
} // END DeviceTrayClose()
|
||||
|
|
@ -1,128 +0,0 @@
|
|||
/* device.h
|
||||
|
||||
* Copyright (C) 2002-2005 PCSX2 Team
|
||||
|
||||
*
|
||||
|
||||
* 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 2 of the License, or
|
||||
|
||||
* (at your option) any later version.
|
||||
|
||||
*
|
||||
|
||||
* 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. See the
|
||||
|
||||
* GNU General Public License for more details.
|
||||
|
||||
*
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
|
||||
* along with this program; if not, write to the Free Software
|
||||
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef __DEVICE_H__
|
||||
|
||||
#define __DEVICE_H__
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <time.h> // time_t
|
||||
|
||||
|
||||
|
||||
#define CDVDdefs
|
||||
|
||||
#include "../PS2Edefs.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// #define VERBOSE_FUNCTION_DEVICE
|
||||
|
||||
// #define VERBOSE_WARNINGS
|
||||
|
||||
#define VERBOSE_DISC_TYPE
|
||||
|
||||
#define VERBOSE_DISC_INFO
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Device Data
|
||||
|
||||
|
||||
|
||||
extern int devicehandle;
|
||||
|
||||
extern s32 devicecapability; // Need to export?
|
||||
|
||||
|
||||
|
||||
extern time_t lasttime;
|
||||
|
||||
extern s32 traystatus;
|
||||
|
||||
extern s32 disctype;
|
||||
|
||||
extern u8 tocbuffer[];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Device Functions
|
||||
|
||||
|
||||
|
||||
extern void DeviceInit();
|
||||
|
||||
extern void InitDisc();
|
||||
|
||||
extern s32 DiscInserted();
|
||||
|
||||
extern s32 DeviceOpen();
|
||||
|
||||
extern void DeviceClose();
|
||||
|
||||
extern s32 DeviceReadTrack(u32 lsn, int mode, u8 *buffer);
|
||||
|
||||
extern s32 DeviceBufferOffset();
|
||||
|
||||
extern s32 DeviceGetTD(u8 track, cdvdTD *cdvdtd);
|
||||
|
||||
extern s32 DeviceGetDiskType();
|
||||
|
||||
extern s32 DeviceTrayStatus();
|
||||
|
||||
extern s32 DeviceTrayOpen();
|
||||
|
||||
extern s32 DeviceTrayClose();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* __DEVICE_H__ */
|
||||
|
|
@ -1,108 +0,0 @@
|
|||
/* interface.c
|
||||
|
||||
* Copyright (C) 2002-2005 PCSX2 Team
|
||||
|
||||
*
|
||||
|
||||
* 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 2 of the License, or
|
||||
|
||||
* (at your option) any later version.
|
||||
|
||||
*
|
||||
|
||||
* 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. See the
|
||||
|
||||
* GNU General Public License for more details.
|
||||
|
||||
*
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
|
||||
* along with this program; if not, write to the Free Software
|
||||
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <stddef.h> // NULL
|
||||
|
||||
#include <stdio.h> // sprintf()
|
||||
|
||||
#include <string.h> // strcmp()
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "logfile.h"
|
||||
|
||||
#include "conf.h"
|
||||
|
||||
#include "aboutbox.h"
|
||||
|
||||
#include "mainbox.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
if(argc != 2) return(1);
|
||||
|
||||
|
||||
|
||||
gtk_init(NULL, NULL);
|
||||
|
||||
|
||||
|
||||
if(!strcmp(argv[1], "about")) {
|
||||
|
||||
AboutBoxDisplay();
|
||||
|
||||
return(0);
|
||||
|
||||
|
||||
|
||||
} else if (!strcmp(argv[1], "configure")) {
|
||||
|
||||
OpenLog();
|
||||
|
||||
InitConf();
|
||||
|
||||
LoadConf();
|
||||
|
||||
MainBoxDisplay();
|
||||
|
||||
|
||||
|
||||
gtk_widget_show_all(mainbox.window);
|
||||
|
||||
gtk_main();
|
||||
|
||||
CloseLog();
|
||||
|
||||
return(0);
|
||||
|
||||
} // ENDLONGIF- Which display would you like to see?
|
||||
|
||||
|
||||
|
||||
return(1); // No Displays chosen? Abort!
|
||||
|
||||
} // END main()
|
||||
|
|
@ -1,180 +0,0 @@
|
|||
/* logfile.c
|
||||
|
||||
* Copyright (C) 2002-2005 PCSX2 Team
|
||||
|
||||
*
|
||||
|
||||
* 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 2 of the License, or
|
||||
|
||||
* (at your option) any later version.
|
||||
|
||||
*
|
||||
|
||||
* 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. See the
|
||||
|
||||
* GNU General Public License for more details.
|
||||
|
||||
*
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
|
||||
* along with this program; if not, write to the Free Software
|
||||
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <fcntl.h> // open
|
||||
|
||||
#include <stdio.h> // vsprintf()
|
||||
|
||||
#include <stdarg.h> // va_start(), va_end(), vsprintf()
|
||||
|
||||
#include <sys/stat.h> // mkdir(), open()
|
||||
|
||||
#include <sys/types.h> // mkdir(), open()
|
||||
|
||||
#include <unistd.h> // close(), write(), unlink()
|
||||
|
||||
|
||||
|
||||
#include "logfile.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int logfile;
|
||||
|
||||
char logfiletemp[2048];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void InitLog() {
|
||||
|
||||
// Token comment line
|
||||
|
||||
#ifdef VERBOSE_LOGFILE
|
||||
|
||||
mkdir("./logs", 0755);
|
||||
|
||||
|
||||
|
||||
unlink("./logs/CDVDlog.txt");
|
||||
|
||||
#endif /* VERBOSE LOGFILE */
|
||||
|
||||
} // END InitLog();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int OpenLog() {
|
||||
|
||||
// Token comment line
|
||||
|
||||
#ifdef VERBOSE_LOGFILE
|
||||
|
||||
logfile = -1;
|
||||
|
||||
logfile = open("./logs/CDVDlog.txt", O_WRONLY | O_CREAT | O_APPEND, 0755);
|
||||
|
||||
if(logfile == -1) return(-1);
|
||||
|
||||
#endif /* VERBOSE LOGFILE */
|
||||
|
||||
|
||||
|
||||
return(0);
|
||||
|
||||
} // END OpenLog();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void CloseLog() {
|
||||
|
||||
// Token comment line
|
||||
|
||||
#ifdef VERBOSE_LOGFILE
|
||||
|
||||
if(logfile != -1) {
|
||||
|
||||
close(logfile);
|
||||
|
||||
logfile = -1;
|
||||
|
||||
} // ENDIF- Is the log file actually open? Close it.
|
||||
|
||||
#endif /* VERBOSE LOGFILE */
|
||||
|
||||
} // END CloseLog()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void PrintLog(const char *fmt, ...) {
|
||||
|
||||
// Token comment line
|
||||
|
||||
#ifdef VERBOSE_LOGFILE
|
||||
|
||||
va_list list;
|
||||
|
||||
int len;
|
||||
|
||||
|
||||
|
||||
if(logfile == -1) return; // Log file not open.
|
||||
|
||||
|
||||
|
||||
va_start(list, fmt);
|
||||
|
||||
vsprintf(logfiletemp, fmt, list);
|
||||
|
||||
va_end(list);
|
||||
|
||||
|
||||
|
||||
len = 0;
|
||||
|
||||
while((len < 2048) && (logfiletemp[len] != 0)) len++;
|
||||
|
||||
if((len > 0) && (logfiletemp[len-1] == '\n')) len--;
|
||||
|
||||
if((len > 0) && (logfiletemp[len-1] == '\r')) len--;
|
||||
|
||||
logfiletemp[len] = 0; // Slice off the last "\r\n"...
|
||||
|
||||
|
||||
|
||||
write(logfile, logfiletemp, len);
|
||||
|
||||
write(logfile, "\r\n", 2); // ... and write out your own.
|
||||
|
||||
#endif /* VERBOSE LOGFILE */
|
||||
|
||||
} // END PrintLog()
|
||||
|
|
@ -1,70 +0,0 @@
|
|||
/* logfile.h
|
||||
|
||||
* Copyright (C) 2002-2005 PCSX2 Team
|
||||
|
||||
*
|
||||
|
||||
* 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 2 of the License, or
|
||||
|
||||
* (at your option) any later version.
|
||||
|
||||
*
|
||||
|
||||
* 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. See the
|
||||
|
||||
* GNU General Public License for more details.
|
||||
|
||||
*
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
|
||||
* along with this program; if not, write to the Free Software
|
||||
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef LOGFILE_H
|
||||
|
||||
#define LOGFILE_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define VERBOSE_LOGFILE
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern void InitLog();
|
||||
|
||||
extern int OpenLog();
|
||||
|
||||
extern void CloseLog();
|
||||
|
||||
extern void PrintLog(const char *format, ...);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* LOGFILE_H */
|
||||
|
|
@ -1,355 +0,0 @@
|
|||
/* mainbox.c
|
||||
|
||||
* Copyright (C) 2002-2005 PCSX2 Team
|
||||
|
||||
*
|
||||
|
||||
* 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 2 of the License, or
|
||||
|
||||
* (at your option) any later version.
|
||||
|
||||
*
|
||||
|
||||
* 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. See the
|
||||
|
||||
* GNU General Public License for more details.
|
||||
|
||||
*
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
|
||||
* along with this program; if not, write to the Free Software
|
||||
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <stddef.h> // NULL
|
||||
|
||||
#include <stdio.h> // sprintf()
|
||||
|
||||
#include <string.h> // strcpy()
|
||||
|
||||
#include <sys/stat.h> // stat()
|
||||
|
||||
#include <sys/types.h> // stat()
|
||||
|
||||
#include <unistd.h> // stat()
|
||||
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "conf.h"
|
||||
|
||||
// #include "logfile.h"
|
||||
|
||||
#include "device.h" // DeviceOpen(), DeviceClose()
|
||||
|
||||
#include "mainbox.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
struct MainBoxData mainbox;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void MainBoxDestroy() {
|
||||
|
||||
if(mainbox.window != NULL) {
|
||||
|
||||
gtk_widget_destroy(mainbox.window);
|
||||
|
||||
mainbox.window = NULL;
|
||||
|
||||
mainbox.device = NULL;
|
||||
|
||||
mainbox.desc = NULL;
|
||||
|
||||
} // ENDIF- Do we have a Main Window still?
|
||||
|
||||
} // END MainBoxDestroy()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void MainBoxUnfocus() {
|
||||
|
||||
gtk_widget_set_sensitive(mainbox.device, FALSE);
|
||||
|
||||
gtk_window_iconify(GTK_WINDOW(mainbox.window));
|
||||
|
||||
} // END MainBoxUnfocus()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
gint MainBoxDeviceEvent(GtkWidget *widget, GdkEvent event, gpointer data) {
|
||||
|
||||
struct stat filestat;
|
||||
|
||||
int retval;
|
||||
|
||||
|
||||
|
||||
retval = stat(gtk_entry_get_text(GTK_ENTRY(mainbox.device)), &filestat);
|
||||
|
||||
if(retval == -1) {
|
||||
|
||||
gtk_label_set_text(GTK_LABEL(mainbox.desc), "Device Type: ---");
|
||||
|
||||
return(TRUE);
|
||||
|
||||
} // ENDIF- Not a name of any sort?
|
||||
|
||||
|
||||
|
||||
if(S_ISDIR(filestat.st_mode) != 0) {
|
||||
|
||||
gtk_label_set_text(GTK_LABEL(mainbox.desc), "Device Type: Not a device");
|
||||
|
||||
return(TRUE);
|
||||
|
||||
} // ENDIF- Not a regular file?
|
||||
|
||||
|
||||
|
||||
gtk_label_set_text(GTK_LABEL(mainbox.desc), "Device Type: Device Likely");
|
||||
|
||||
return(TRUE);
|
||||
|
||||
} // END MainBoxFileEvent()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void MainBoxRefocus() {
|
||||
|
||||
GdkEvent event;
|
||||
|
||||
|
||||
|
||||
MainBoxDeviceEvent(NULL, event, NULL);
|
||||
|
||||
|
||||
|
||||
gtk_widget_set_sensitive(mainbox.device, TRUE);
|
||||
|
||||
gtk_window_set_focus(GTK_WINDOW(mainbox.window), mainbox.device);
|
||||
|
||||
gtk_window_deiconify(GTK_WINDOW(mainbox.window));
|
||||
|
||||
} // END MainBoxRefocus()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
gint MainBoxCancelEvent(GtkWidget *widget, GdkEvent event, gpointer data) {
|
||||
|
||||
MainBoxDestroy();
|
||||
|
||||
|
||||
|
||||
gtk_main_quit();
|
||||
|
||||
return(TRUE);
|
||||
|
||||
} // END MainBoxCancelEvent()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
gint MainBoxOKEvent(GtkWidget *widget, GdkEvent event, gpointer data) {
|
||||
|
||||
const char *tempdevice;
|
||||
|
||||
int retval;
|
||||
|
||||
|
||||
|
||||
MainBoxUnfocus();
|
||||
|
||||
|
||||
|
||||
tempdevice = gtk_entry_get_text(GTK_ENTRY(mainbox.device));
|
||||
|
||||
strcpy(conf.devicename, tempdevice); // Temporarily put in new device name
|
||||
|
||||
tempdevice = NULL;
|
||||
|
||||
if(*(conf.devicename) != 0) {
|
||||
|
||||
retval = DeviceOpen(); // Test by opening the device.
|
||||
|
||||
DeviceClose(); // Failed or not, close it.
|
||||
|
||||
if(retval != 0) {
|
||||
|
||||
MainBoxRefocus();
|
||||
|
||||
return(TRUE);
|
||||
|
||||
} // ENDIF- Not an ISO file? Message and Stop here.
|
||||
|
||||
} // ENDIF- Is there an ISO file to check out?
|
||||
|
||||
|
||||
|
||||
SaveConf();
|
||||
|
||||
|
||||
|
||||
MainBoxCancelEvent(widget, event, data);
|
||||
|
||||
return(TRUE);
|
||||
|
||||
} // END MainBoxOKEvent()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void MainBoxDisplay() {
|
||||
|
||||
GtkWidget *item;
|
||||
|
||||
GtkWidget *hbox1;
|
||||
|
||||
GtkWidget *vbox1;
|
||||
|
||||
|
||||
|
||||
mainbox.window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
gtk_container_set_border_width(GTK_CONTAINER(mainbox.window), 5);
|
||||
|
||||
gtk_window_set_title(GTK_WINDOW(mainbox.window), "CDVDlinuz Configuration");
|
||||
|
||||
gtk_window_set_position(GTK_WINDOW(mainbox.window), GTK_WIN_POS_CENTER);
|
||||
|
||||
|
||||
|
||||
g_signal_connect(G_OBJECT(mainbox.window), "delete_event",
|
||||
|
||||
G_CALLBACK(MainBoxCancelEvent), NULL);
|
||||
|
||||
|
||||
|
||||
vbox1 = gtk_vbox_new(FALSE, 5);
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(mainbox.window), vbox1);
|
||||
|
||||
gtk_container_set_border_width(GTK_CONTAINER(vbox1), 5);
|
||||
|
||||
gtk_widget_show(vbox1);
|
||||
|
||||
|
||||
|
||||
hbox1 = gtk_hbox_new(FALSE, 10);
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), hbox1, TRUE, TRUE, 0);
|
||||
|
||||
gtk_widget_show(hbox1);
|
||||
|
||||
|
||||
|
||||
item = gtk_label_new("CD/DVD Device:");
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), item, FALSE, FALSE, 0);
|
||||
|
||||
gtk_widget_show(item);
|
||||
|
||||
item = NULL;
|
||||
|
||||
|
||||
|
||||
mainbox.device = gtk_entry_new();
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), mainbox.device, TRUE, TRUE, 0);
|
||||
|
||||
gtk_widget_show(mainbox.device);
|
||||
|
||||
g_signal_connect(G_OBJECT(mainbox.device), "changed",
|
||||
|
||||
G_CALLBACK(MainBoxDeviceEvent), NULL);
|
||||
|
||||
hbox1 = NULL;
|
||||
|
||||
|
||||
|
||||
mainbox.desc = gtk_label_new("File Type: ---");
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), mainbox.desc, FALSE, FALSE, 0);
|
||||
|
||||
gtk_widget_show(mainbox.desc);
|
||||
|
||||
|
||||
|
||||
hbox1 = gtk_hbutton_box_new();
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), hbox1, TRUE, TRUE, 0);
|
||||
|
||||
gtk_widget_show(hbox1);
|
||||
|
||||
|
||||
|
||||
item = gtk_button_new_with_label("Ok");
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), item, TRUE, TRUE, 0);
|
||||
|
||||
gtk_widget_show(item);
|
||||
|
||||
g_signal_connect(G_OBJECT(item), "clicked",
|
||||
|
||||
G_CALLBACK(MainBoxOKEvent), NULL);
|
||||
|
||||
|
||||
|
||||
item = gtk_button_new_with_label("Cancel");
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), item, TRUE, TRUE, 0);
|
||||
|
||||
gtk_widget_show(item);
|
||||
|
||||
g_signal_connect(G_OBJECT(item), "clicked",
|
||||
|
||||
G_CALLBACK(MainBoxCancelEvent), NULL);
|
||||
|
||||
item = NULL;
|
||||
|
||||
hbox1 = NULL;
|
||||
|
||||
vbox1 = NULL;
|
||||
|
||||
|
||||
|
||||
// We held off setting the name until now... so description would show.
|
||||
|
||||
gtk_entry_set_text(GTK_ENTRY(mainbox.device), conf.devicename);
|
||||
|
||||
} // END MainBoxDisplay()
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
/* mainbox.h
|
||||
|
||||
* Copyright (C) 2002-2005 PCSX2 Team
|
||||
|
||||
*
|
||||
|
||||
* 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 2 of the License, or
|
||||
|
||||
* (at your option) any later version.
|
||||
|
||||
*
|
||||
|
||||
* 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. See the
|
||||
|
||||
* GNU General Public License for more details.
|
||||
|
||||
*
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
|
||||
* along with this program; if not, write to the Free Software
|
||||
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef MAINBOX_H
|
||||
|
||||
#define MAINBOX_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
struct MainBoxData {
|
||||
|
||||
GtkWidget *window; // GtkWindow
|
||||
|
||||
GtkWidget *device; // GtkEntry
|
||||
|
||||
GtkWidget *desc; // GtkLabel
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
extern struct MainBoxData mainbox;
|
||||
|
||||
|
||||
|
||||
// extern void MainBoxRefocus();
|
||||
|
||||
extern void MainBoxDisplay();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* MAINBOX_H */
|
||||
|
|
@ -1,808 +0,0 @@
|
|||
#ifndef __PS2EDEFS_H__
|
||||
#define __PS2EDEFS_H__
|
||||
|
||||
/*
|
||||
* PS2E Definitions v0.6.2 (beta)
|
||||
*
|
||||
* Author: linuzappz@hotmail.com
|
||||
* shadowpcsx2@yahoo.gr
|
||||
* florinsasu@hotmail.com
|
||||
*/
|
||||
|
||||
/*
|
||||
Notes:
|
||||
* Since this is still beta things may change.
|
||||
|
||||
* OSflags:
|
||||
__linux__ (linux OS)
|
||||
_WIN32 (win32 OS)
|
||||
|
||||
* common return values (for ie. GSinit):
|
||||
0 - success
|
||||
-1 - error
|
||||
|
||||
* reserved keys:
|
||||
F1 to F10 are reserved for the emulator
|
||||
|
||||
* plugins should NOT change the current
|
||||
working directory.
|
||||
(on win32, add flag OFN_NOCHANGEDIR for
|
||||
GetOpenFileName)
|
||||
|
||||
*/
|
||||
|
||||
#include "PS2Etypes.h"
|
||||
|
||||
#ifdef __linux__
|
||||
#define CALLBACK
|
||||
#else
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
|
||||
/* common defines */
|
||||
#if defined(GSdefs) || defined(PADdefs) || defined(SIOdefs) || \
|
||||
defined(SPU2defs) || defined(CDVDdefs) || defined(DEV9defs) || \
|
||||
defined(USBdefs) || defined(FWdefs)
|
||||
#define COMMONdefs
|
||||
#endif
|
||||
|
||||
// PS2EgetLibType returns (may be OR'd)
|
||||
#define PS2E_LT_GS 0x01
|
||||
#define PS2E_LT_PAD 0x02 // -=[ OBSOLETE ]=-
|
||||
#define PS2E_LT_SPU2 0x04
|
||||
#define PS2E_LT_CDVD 0x08
|
||||
#define PS2E_LT_DEV9 0x10
|
||||
#define PS2E_LT_USB 0x20
|
||||
#define PS2E_LT_FW 0x40
|
||||
#define PS2E_LT_SIO 0x80
|
||||
|
||||
// PS2EgetLibVersion2 (high 16 bits)
|
||||
#define PS2E_GS_VERSION 0x0006
|
||||
#define PS2E_PAD_VERSION 0x0002 // -=[ OBSOLETE ]=-
|
||||
#define PS2E_SPU2_VERSION 0x0005
|
||||
#define PS2E_CDVD_VERSION 0x0005
|
||||
#define PS2E_DEV9_VERSION 0x0003
|
||||
#define PS2E_USB_VERSION 0x0003
|
||||
#define PS2E_FW_VERSION 0x0002
|
||||
#define PS2E_SIO_VERSION 0x0001
|
||||
#ifdef COMMONdefs
|
||||
|
||||
u32 CALLBACK PS2EgetLibType(void);
|
||||
u32 CALLBACK PS2EgetLibVersion2(u32 type);
|
||||
char* CALLBACK PS2EgetLibName(void);
|
||||
|
||||
#endif
|
||||
|
||||
// key values:
|
||||
/* key values must be OS dependant:
|
||||
win32: the VK_XXX will be used (WinUser)
|
||||
linux: the XK_XXX will be used (XFree86)
|
||||
*/
|
||||
|
||||
// event values:
|
||||
#define KEYPRESS 1
|
||||
#define KEYRELEASE 2
|
||||
|
||||
typedef struct {
|
||||
u32 key;
|
||||
u32 event;
|
||||
} keyEvent;
|
||||
|
||||
// for 64bit compilers
|
||||
typedef char __keyEvent_Size__[(sizeof(keyEvent) == 8)?1:-1];
|
||||
|
||||
// plugin types
|
||||
#define SIO_TYPE_PAD 0x00000001
|
||||
#define SIO_TYPE_MTAP 0x00000004
|
||||
#define SIO_TYPE_RM 0x00000040
|
||||
#define SIO_TYPE_MC 0x00000100
|
||||
|
||||
typedef int (CALLBACK * SIOchangeSlotCB)(int slot);
|
||||
|
||||
typedef struct {
|
||||
u8 ctrl:4; // control and mode bits
|
||||
u8 mode:4; // control and mode bits
|
||||
u8 trackNum; // current track number (1 to 99)
|
||||
u8 trackIndex; // current index within track (0 to 99)
|
||||
u8 trackM; // current minute location on the disc (BCD encoded)
|
||||
u8 trackS; // current sector location on the disc (BCD encoded)
|
||||
u8 trackF; // current frame location on the disc (BCD encoded)
|
||||
u8 pad; // unused
|
||||
u8 discM; // current minute offset from first track (BCD encoded)
|
||||
u8 discS; // current sector offset from first track (BCD encoded)
|
||||
u8 discF; // current frame offset from first track (BCD encoded)
|
||||
} cdvdSubQ;
|
||||
|
||||
typedef struct { // NOT bcd coded
|
||||
u32 lsn;
|
||||
u8 type;
|
||||
} cdvdTD;
|
||||
|
||||
typedef struct {
|
||||
u8 strack; //number of the first track (usually 1)
|
||||
u8 etrack; //number of the last track
|
||||
} cdvdTN;
|
||||
|
||||
// CDVDreadTrack mode values:
|
||||
#define CDVD_MODE_2352 0 // full 2352 bytes
|
||||
#define CDVD_MODE_2340 1 // skip sync (12) bytes
|
||||
#define CDVD_MODE_2328 2 // skip sync+head+sub (24) bytes
|
||||
#define CDVD_MODE_2048 3 // skip sync+head+sub (24) bytes
|
||||
#define CDVD_MODE_2368 4 // full 2352 bytes + 16 subq
|
||||
|
||||
// CDVDgetDiskType returns:
|
||||
#define CDVD_TYPE_ILLEGAL 0xff // Illegal Disc
|
||||
#define CDVD_TYPE_DVDV 0xfe // DVD Video
|
||||
#define CDVD_TYPE_CDDA 0xfd // Audio CD
|
||||
#define CDVD_TYPE_PS2DVD 0x14 // PS2 DVD
|
||||
#define CDVD_TYPE_PS2CDDA 0x13 // PS2 CD (with audio)
|
||||
#define CDVD_TYPE_PS2CD 0x12 // PS2 CD
|
||||
#define CDVD_TYPE_PSCDDA 0x11 // PS CD (with audio)
|
||||
#define CDVD_TYPE_PSCD 0x10 // PS CD
|
||||
#define CDVD_TYPE_UNKNOWN 0x05 // Unknown
|
||||
#define CDVD_TYPE_DETCTDVDD 0x04 // Detecting Dvd Dual Sided
|
||||
#define CDVD_TYPE_DETCTDVDS 0x03 // Detecting Dvd Single Sided
|
||||
#define CDVD_TYPE_DETCTCD 0x02 // Detecting Cd
|
||||
#define CDVD_TYPE_DETCT 0x01 // Detecting
|
||||
#define CDVD_TYPE_NODISC 0x00 // No Disc
|
||||
|
||||
// CDVDgetTrayStatus returns:
|
||||
#define CDVD_TRAY_CLOSE 0x00
|
||||
#define CDVD_TRAY_OPEN 0x01
|
||||
|
||||
// cdvdTD.type (track types for cds)
|
||||
#define CDVD_AUDIO_TRACK 0x01
|
||||
#define CDVD_MODE1_TRACK 0x41
|
||||
#define CDVD_MODE2_TRACK 0x61
|
||||
|
||||
#define CDVD_AUDIO_MASK 0x00
|
||||
#define CDVD_DATA_MASK 0x40
|
||||
// CDROM_DATA_TRACK 0x04 //do not enable this! (from linux kernel)
|
||||
|
||||
typedef void (*DEV9callback)(int cycles);
|
||||
typedef int (*DEV9handler)(void);
|
||||
|
||||
typedef void (*USBcallback)(int cycles);
|
||||
typedef int (*USBhandler)(void);
|
||||
|
||||
// freeze modes:
|
||||
#define FREEZE_LOAD 0
|
||||
#define FREEZE_SAVE 1
|
||||
#define FREEZE_SIZE 2
|
||||
|
||||
typedef struct {
|
||||
char name[8];
|
||||
void *common;
|
||||
} GSdriverInfo;
|
||||
|
||||
#ifdef _WIN32
|
||||
typedef struct { // unsupported values must be set to zero
|
||||
HWND hWnd;
|
||||
HMENU hMenu;
|
||||
HWND hStatusWnd;
|
||||
} winInfo;
|
||||
#endif
|
||||
|
||||
/* GS plugin API */
|
||||
|
||||
// if this file is included with this define
|
||||
// the next api will not be skipped by the compiler
|
||||
#ifdef GSdefs
|
||||
|
||||
// basic funcs
|
||||
|
||||
s32 CALLBACK GSinit();
|
||||
s32 CALLBACK GSopen(void *pDsp, char *Title, int multithread);
|
||||
void CALLBACK GSclose();
|
||||
void CALLBACK GSshutdown();
|
||||
void CALLBACK GSvsync(int field);
|
||||
void CALLBACK GSgifTransfer1(u32 *pMem, u32 addr);
|
||||
void CALLBACK GSgifTransfer2(u32 *pMem, u32 size);
|
||||
void CALLBACK GSgifTransfer3(u32 *pMem, u32 size);
|
||||
void CALLBACK GSgifSoftReset(u32 mask);
|
||||
void CALLBACK GSreadFIFO(u64 *mem);
|
||||
void CALLBACK GSreadFIFO2(u64 *mem, int qwc);
|
||||
|
||||
// extended funcs
|
||||
|
||||
// GSkeyEvent gets called when there is a keyEvent from the PAD plugin
|
||||
void CALLBACK GSkeyEvent(keyEvent *ev);
|
||||
void CALLBACK GSchangeSaveState(int, const char* filename);
|
||||
void CALLBACK GSmakeSnapshot(char *path);
|
||||
void CALLBACK GSmakeSnapshot2(char *pathname, int* snapdone, int savejpg);
|
||||
void CALLBACK GSirqCallback(void (*callback)());
|
||||
void CALLBACK GSprintf(int timeout, char *fmt, ...);
|
||||
void CALLBACK GSsetBaseMem(void*);
|
||||
void CALLBACK GSsetGameCRC(int);
|
||||
|
||||
// controls frame skipping in the GS, if this routine isn't present, frame skipping won't be done
|
||||
void CALLBACK GSsetFrameSkip(int frameskip);
|
||||
|
||||
void CALLBACK GSreset();
|
||||
void CALLBACK GSwriteCSR(u32 value);
|
||||
void CALLBACK GSgetDriverInfo(GSdriverInfo *info);
|
||||
#ifdef _WIN32
|
||||
s32 CALLBACK GSsetWindowInfo(winInfo *info);
|
||||
#endif
|
||||
s32 CALLBACK GSfreeze(int mode, freezeData *data);
|
||||
void CALLBACK GSconfigure();
|
||||
void CALLBACK GSabout();
|
||||
s32 CALLBACK GStest();
|
||||
|
||||
#endif
|
||||
|
||||
/* PAD plugin API -=[ OBSOLETE ]=- */
|
||||
|
||||
// if this file is included with this define
|
||||
// the next api will not be skipped by the compiler
|
||||
#ifdef PADdefs
|
||||
|
||||
// basic funcs
|
||||
|
||||
s32 CALLBACK PADinit(u32 flags);
|
||||
s32 CALLBACK PADopen(void *pDsp);
|
||||
void CALLBACK PADclose();
|
||||
void CALLBACK PADshutdown();
|
||||
// PADkeyEvent is called every vsync (return NULL if no event)
|
||||
keyEvent* CALLBACK PADkeyEvent();
|
||||
u8 CALLBACK PADstartPoll(int pad);
|
||||
u8 CALLBACK PADpoll(u8 value);
|
||||
// returns: 1 if supported pad1
|
||||
// 2 if supported pad2
|
||||
// 3 if both are supported
|
||||
u32 CALLBACK PADquery();
|
||||
|
||||
// extended funcs
|
||||
|
||||
void CALLBACK PADgsDriverInfo(GSdriverInfo *info);
|
||||
void CALLBACK PADconfigure();
|
||||
void CALLBACK PADabout();
|
||||
s32 CALLBACK PADtest();
|
||||
|
||||
#endif
|
||||
|
||||
/* SIO plugin API */
|
||||
|
||||
// if this file is included with this define
|
||||
// the next api will not be skipped by the compiler
|
||||
#ifdef SIOdefs
|
||||
|
||||
// basic funcs
|
||||
|
||||
s32 CALLBACK SIOinit(u32 port, u32 slot, SIOchangeSlotCB f);
|
||||
s32 CALLBACK SIOopen(void *pDsp);
|
||||
void CALLBACK SIOclose();
|
||||
void CALLBACK SIOshutdown();
|
||||
u8 CALLBACK SIOstartPoll(u8 value);
|
||||
u8 CALLBACK SIOpoll(u8 value);
|
||||
// returns: SIO_TYPE_{PAD,MTAP,RM,MC}
|
||||
u32 CALLBACK SIOquery();
|
||||
|
||||
// extended funcs
|
||||
|
||||
void CALLBACK SIOconfigure();
|
||||
void CALLBACK SIOabout();
|
||||
s32 CALLBACK SIOtest();
|
||||
|
||||
#endif
|
||||
|
||||
/* SPU2 plugin API */
|
||||
|
||||
// if this file is included with this define
|
||||
// the next api will not be skipped by the compiler
|
||||
#ifdef SPU2defs
|
||||
|
||||
// basic funcs
|
||||
|
||||
s32 CALLBACK SPU2init();
|
||||
s32 CALLBACK SPU2open(void *pDsp);
|
||||
void CALLBACK SPU2close();
|
||||
void CALLBACK SPU2shutdown();
|
||||
void CALLBACK SPU2write(u32 mem, u16 value);
|
||||
u16 CALLBACK SPU2read(u32 mem);
|
||||
void CALLBACK SPU2readDMA4Mem(u16 *pMem, int size);
|
||||
void CALLBACK SPU2writeDMA4Mem(u16 *pMem, int size);
|
||||
void CALLBACK SPU2interruptDMA4();
|
||||
void CALLBACK SPU2readDMA7Mem(u16* pMem, int size);
|
||||
void CALLBACK SPU2writeDMA7Mem(u16 *pMem, int size);
|
||||
void CALLBACK SPU2interruptDMA7();
|
||||
u32 CALLBACK SPU2ReadMemAddr(int core);
|
||||
void CALLBACK SPU2WriteMemAddr(int core,u32 value);
|
||||
void CALLBACK SPU2irqCallback(void (*SPU2callback)(),void (*DMA4callback)(),void (*DMA7callback)());
|
||||
// extended funcs
|
||||
|
||||
void CALLBACK SPU2async(u32 cycles);
|
||||
s32 CALLBACK SPU2freeze(int mode, freezeData *data);
|
||||
void CALLBACK SPU2configure();
|
||||
void CALLBACK SPU2about();
|
||||
s32 CALLBACK SPU2test();
|
||||
|
||||
#endif
|
||||
|
||||
/* CDVD plugin API */
|
||||
|
||||
// if this file is included with this define
|
||||
// the next api will not be skipped by the compiler
|
||||
#ifdef CDVDdefs
|
||||
|
||||
// basic funcs
|
||||
|
||||
s32 CALLBACK CDVDinit();
|
||||
s32 CALLBACK CDVDopen(const char* pTitleFilename);
|
||||
void CALLBACK CDVDclose();
|
||||
void CALLBACK CDVDshutdown();
|
||||
s32 CALLBACK CDVDreadTrack(u32 lsn, int mode);
|
||||
|
||||
// return can be NULL (for async modes)
|
||||
u8* CALLBACK CDVDgetBuffer();
|
||||
|
||||
s32 CALLBACK CDVDreadSubQ(u32 lsn, cdvdSubQ* subq);//read subq from disc (only cds have subq data)
|
||||
s32 CALLBACK CDVDgetTN(cdvdTN *Buffer); //disk information
|
||||
s32 CALLBACK CDVDgetTD(u8 Track, cdvdTD *Buffer); //track info: min,sec,frame,type
|
||||
s32 CALLBACK CDVDgetTOC(void* toc); //gets ps2 style toc from disc
|
||||
s32 CALLBACK CDVDgetDiskType(); //CDVD_TYPE_xxxx
|
||||
s32 CALLBACK CDVDgetTrayStatus(); //CDVD_TRAY_xxxx
|
||||
s32 CALLBACK CDVDctrlTrayOpen(); //open disc tray
|
||||
s32 CALLBACK CDVDctrlTrayClose(); //close disc tray
|
||||
|
||||
// extended funcs
|
||||
|
||||
void CALLBACK CDVDconfigure();
|
||||
void CALLBACK CDVDabout();
|
||||
s32 CALLBACK CDVDtest();
|
||||
void CALLBACK CDVDnewDiskCB(void (*callback)());
|
||||
|
||||
#endif
|
||||
|
||||
/* DEV9 plugin API */
|
||||
|
||||
// if this file is included with this define
|
||||
// the next api will not be skipped by the compiler
|
||||
#ifdef DEV9defs
|
||||
|
||||
// basic funcs
|
||||
|
||||
// NOTE: The read/write functions CANNOT use XMM/MMX regs
|
||||
// If you want to use them, need to save and restore current ones
|
||||
s32 CALLBACK DEV9init();
|
||||
s32 CALLBACK DEV9open(void *pDsp);
|
||||
void CALLBACK DEV9close();
|
||||
void CALLBACK DEV9shutdown();
|
||||
u8 CALLBACK DEV9read8(u32 addr);
|
||||
u16 CALLBACK DEV9read16(u32 addr);
|
||||
u32 CALLBACK DEV9read32(u32 addr);
|
||||
void CALLBACK DEV9write8(u32 addr, u8 value);
|
||||
void CALLBACK DEV9write16(u32 addr, u16 value);
|
||||
void CALLBACK DEV9write32(u32 addr, u32 value);
|
||||
void CALLBACK DEV9readDMA8Mem(u32 *pMem, int size);
|
||||
void CALLBACK DEV9writeDMA8Mem(u32 *pMem, int size);
|
||||
// cycles = IOP cycles before calling callback,
|
||||
// if callback returns 1 the irq is triggered, else not
|
||||
void CALLBACK DEV9irqCallback(DEV9callback callback);
|
||||
DEV9handler CALLBACK DEV9irqHandler(void);
|
||||
|
||||
// extended funcs
|
||||
|
||||
s32 CALLBACK DEV9freeze(int mode, freezeData *data);
|
||||
void CALLBACK DEV9configure();
|
||||
void CALLBACK DEV9about();
|
||||
s32 CALLBACK DEV9test();
|
||||
|
||||
#endif
|
||||
|
||||
/* USB plugin API */
|
||||
|
||||
// if this file is included with this define
|
||||
// the next api will not be skipped by the compiler
|
||||
#ifdef USBdefs
|
||||
|
||||
// basic funcs
|
||||
|
||||
s32 CALLBACK USBinit();
|
||||
s32 CALLBACK USBopen(void *pDsp);
|
||||
void CALLBACK USBclose();
|
||||
void CALLBACK USBshutdown();
|
||||
u8 CALLBACK USBread8(u32 addr);
|
||||
u16 CALLBACK USBread16(u32 addr);
|
||||
u32 CALLBACK USBread32(u32 addr);
|
||||
void CALLBACK USBwrite8(u32 addr, u8 value);
|
||||
void CALLBACK USBwrite16(u32 addr, u16 value);
|
||||
void CALLBACK USBwrite32(u32 addr, u32 value);
|
||||
// cycles = IOP cycles before calling callback,
|
||||
// if callback returns 1 the irq is triggered, else not
|
||||
void CALLBACK USBirqCallback(USBcallback callback);
|
||||
USBhandler CALLBACK USBirqHandler(void);
|
||||
void CALLBACK USBsetRAM(void *mem);
|
||||
|
||||
// extended funcs
|
||||
|
||||
s32 CALLBACK USBfreeze(int mode, freezeData *data);
|
||||
void CALLBACK USBconfigure();
|
||||
void CALLBACK USBabout();
|
||||
s32 CALLBACK USBtest();
|
||||
|
||||
#endif
|
||||
|
||||
/* FW plugin API */
|
||||
|
||||
// if this file is included with this define
|
||||
// the next api will not be skipped by the compiler
|
||||
#ifdef FWdefs
|
||||
// basic funcs
|
||||
|
||||
// NOTE: The read/write functions CANNOT use XMM/MMX regs
|
||||
// If you want to use them, need to save and restore current ones
|
||||
s32 CALLBACK FWinit();
|
||||
s32 CALLBACK FWopen(void *pDsp);
|
||||
void CALLBACK FWclose();
|
||||
void CALLBACK FWshutdown();
|
||||
u32 CALLBACK FWread32(u32 addr);
|
||||
void CALLBACK FWwrite32(u32 addr, u32 value);
|
||||
void CALLBACK FWirqCallback(void (*callback)());
|
||||
|
||||
// extended funcs
|
||||
|
||||
s32 CALLBACK FWfreeze(int mode, freezeData *data);
|
||||
void CALLBACK FWconfigure();
|
||||
void CALLBACK FWabout();
|
||||
s32 CALLBACK FWtest();
|
||||
#endif
|
||||
|
||||
// might be useful for emulators
|
||||
#ifdef PLUGINtypedefs
|
||||
|
||||
typedef u32 (CALLBACK* _PS2EgetLibType)(void);
|
||||
typedef u32 (CALLBACK* _PS2EgetLibVersion2)(u32 type);
|
||||
typedef char*(CALLBACK* _PS2EgetLibName)(void);
|
||||
|
||||
// GS
|
||||
// NOTE: GSreadFIFOX/GSwriteCSR functions CANNOT use XMM/MMX regs
|
||||
// If you want to use them, need to save and restore current ones
|
||||
typedef s32 (CALLBACK* _GSinit)();
|
||||
typedef s32 (CALLBACK* _GSopen)(void *pDsp, char *Title, int multithread);
|
||||
typedef void (CALLBACK* _GSclose)();
|
||||
typedef void (CALLBACK* _GSshutdown)();
|
||||
typedef void (CALLBACK* _GSvsync)(int field);
|
||||
typedef void (CALLBACK* _GSgifTransfer1)(u32 *pMem, u32 addr);
|
||||
typedef void (CALLBACK* _GSgifTransfer2)(u32 *pMem, u32 size);
|
||||
typedef void (CALLBACK* _GSgifTransfer3)(u32 *pMem, u32 size);
|
||||
typedef void (CALLBACK* _GSgifSoftReset)(u32 mask);
|
||||
typedef void (CALLBACK* _GSreadFIFO)(u64 *pMem);
|
||||
typedef void (CALLBACK* _GSreadFIFO2)(u64 *pMem, int qwc);
|
||||
|
||||
typedef void (CALLBACK* _GSkeyEvent)(keyEvent* ev);
|
||||
typedef void (CALLBACK* _GSchangeSaveState)(int, const char* filename);
|
||||
typedef void (CALLBACK* _GSirqCallback)(void (*callback)());
|
||||
typedef void (CALLBACK* _GSprintf)(int timeout, char *fmt, ...);
|
||||
typedef void (CALLBACK* _GSsetBaseMem)(void*);
|
||||
typedef void (CALLBACK* _GSsetGameCRC)(int);
|
||||
typedef void (CALLBACK* _GSsetFrameSkip)(int frameskip);
|
||||
typedef void (CALLBACK* _GSreset)();
|
||||
typedef void (CALLBACK* _GSwriteCSR)(u32 value);
|
||||
typedef void (CALLBACK* _GSgetDriverInfo)(GSdriverInfo *info);
|
||||
#ifdef _WIN32
|
||||
typedef s32 (CALLBACK* _GSsetWindowInfo)(winInfo *info);
|
||||
#endif
|
||||
typedef void (CALLBACK* _GSmakeSnapshot)(char *path);
|
||||
typedef void (CALLBACK* _GSmakeSnapshot2)(char *path, int*, int);
|
||||
typedef s32 (CALLBACK* _GSfreeze)(int mode, freezeData *data);
|
||||
typedef void (CALLBACK* _GSconfigure)();
|
||||
typedef s32 (CALLBACK* _GStest)();
|
||||
typedef void (CALLBACK* _GSabout)();
|
||||
|
||||
// PAD
|
||||
typedef s32 (CALLBACK* _PADinit)(u32 flags);
|
||||
typedef s32 (CALLBACK* _PADopen)(void *pDsp);
|
||||
typedef void (CALLBACK* _PADclose)();
|
||||
typedef void (CALLBACK* _PADshutdown)();
|
||||
typedef keyEvent* (CALLBACK* _PADkeyEvent)();
|
||||
typedef u8 (CALLBACK* _PADstartPoll)(int pad);
|
||||
typedef u8 (CALLBACK* _PADpoll)(u8 value);
|
||||
typedef u32 (CALLBACK* _PADquery)();
|
||||
|
||||
typedef void (CALLBACK* _PADgsDriverInfo)(GSdriverInfo *info);
|
||||
typedef void (CALLBACK* _PADconfigure)();
|
||||
typedef s32 (CALLBACK* _PADtest)();
|
||||
typedef void (CALLBACK* _PADabout)();
|
||||
|
||||
// SIO
|
||||
typedef s32 (CALLBACK* _SIOinit)(u32 port, u32 slot, SIOchangeSlotCB f);
|
||||
typedef s32 (CALLBACK* _SIOopen)(void *pDsp);
|
||||
typedef void (CALLBACK* _SIOclose)();
|
||||
typedef void (CALLBACK* _SIOshutdown)();
|
||||
typedef u8 (CALLBACK* _SIOstartPoll)(u8 value);
|
||||
typedef u8 (CALLBACK* _SIOpoll)(u8 value);
|
||||
typedef u32 (CALLBACK* _SIOquery)();
|
||||
|
||||
typedef void (CALLBACK* _SIOconfigure)();
|
||||
typedef s32 (CALLBACK* _SIOtest)();
|
||||
typedef void (CALLBACK* _SIOabout)();
|
||||
|
||||
// SPU2
|
||||
// NOTE: The read/write functions CANNOT use XMM/MMX regs
|
||||
// If you want to use them, need to save and restore current ones
|
||||
typedef s32 (CALLBACK* _SPU2init)();
|
||||
typedef s32 (CALLBACK* _SPU2open)(void *pDsp);
|
||||
typedef void (CALLBACK* _SPU2close)();
|
||||
typedef void (CALLBACK* _SPU2shutdown)();
|
||||
typedef void (CALLBACK* _SPU2write)(u32 mem, u16 value);
|
||||
typedef u16 (CALLBACK* _SPU2read)(u32 mem);
|
||||
typedef void (CALLBACK* _SPU2readDMA4Mem)(u16 *pMem, int size);
|
||||
typedef void (CALLBACK* _SPU2writeDMA4Mem)(u16 *pMem, int size);
|
||||
typedef void (CALLBACK* _SPU2interruptDMA4)();
|
||||
typedef void (CALLBACK* _SPU2readDMA7Mem)(u16 *pMem, int size);
|
||||
typedef void (CALLBACK* _SPU2writeDMA7Mem)(u16 *pMem, int size);
|
||||
typedef void (CALLBACK* _SPU2interruptDMA7)();
|
||||
typedef void (CALLBACK* _SPU2irqCallback)(void (*SPU2callback)(),void (*DMA4callback)(),void (*DMA7callback)());
|
||||
typedef u32 (CALLBACK* _SPU2ReadMemAddr)(int core);
|
||||
typedef void (CALLBACK* _SPU2WriteMemAddr)(int core,u32 value);
|
||||
typedef void (CALLBACK* _SPU2async)(u32 cycles);
|
||||
typedef s32 (CALLBACK* _SPU2freeze)(int mode, freezeData *data);
|
||||
typedef void (CALLBACK* _SPU2configure)();
|
||||
typedef s32 (CALLBACK* _SPU2test)();
|
||||
typedef void (CALLBACK* _SPU2about)();
|
||||
|
||||
// CDVD
|
||||
// NOTE: The read/write functions CANNOT use XMM/MMX regs
|
||||
// If you want to use them, need to save and restore current ones
|
||||
typedef s32 (CALLBACK* _CDVDinit)();
|
||||
typedef s32 (CALLBACK* _CDVDopen)(const char* pTitleFilename);
|
||||
typedef void (CALLBACK* _CDVDclose)();
|
||||
typedef void (CALLBACK* _CDVDshutdown)();
|
||||
typedef s32 (CALLBACK* _CDVDreadTrack)(u32 lsn, int mode);
|
||||
typedef u8* (CALLBACK* _CDVDgetBuffer)();
|
||||
typedef s32 (CALLBACK* _CDVDreadSubQ)(u32 lsn, cdvdSubQ* subq);
|
||||
typedef s32 (CALLBACK* _CDVDgetTN)(cdvdTN *Buffer);
|
||||
typedef s32 (CALLBACK* _CDVDgetTD)(u8 Track, cdvdTD *Buffer);
|
||||
typedef s32 (CALLBACK* _CDVDgetTOC)(void* toc);
|
||||
typedef s32 (CALLBACK* _CDVDgetDiskType)();
|
||||
typedef s32 (CALLBACK* _CDVDgetTrayStatus)();
|
||||
typedef s32 (CALLBACK* _CDVDctrlTrayOpen)();
|
||||
typedef s32 (CALLBACK* _CDVDctrlTrayClose)();
|
||||
|
||||
typedef void (CALLBACK* _CDVDconfigure)();
|
||||
typedef s32 (CALLBACK* _CDVDtest)();
|
||||
typedef void (CALLBACK* _CDVDabout)();
|
||||
typedef void (CALLBACK* _CDVDnewDiskCB)(void (*callback)());
|
||||
|
||||
// DEV9
|
||||
// NOTE: The read/write functions CANNOT use XMM/MMX regs
|
||||
// If you want to use them, need to save and restore current ones
|
||||
typedef s32 (CALLBACK* _DEV9init)();
|
||||
typedef s32 (CALLBACK* _DEV9open)(void *pDsp);
|
||||
typedef void (CALLBACK* _DEV9close)();
|
||||
typedef void (CALLBACK* _DEV9shutdown)();
|
||||
typedef u8 (CALLBACK* _DEV9read8)(u32 mem);
|
||||
typedef u16 (CALLBACK* _DEV9read16)(u32 mem);
|
||||
typedef u32 (CALLBACK* _DEV9read32)(u32 mem);
|
||||
typedef void (CALLBACK* _DEV9write8)(u32 mem, u8 value);
|
||||
typedef void (CALLBACK* _DEV9write16)(u32 mem, u16 value);
|
||||
typedef void (CALLBACK* _DEV9write32)(u32 mem, u32 value);
|
||||
typedef void (CALLBACK* _DEV9readDMA8Mem)(u32 *pMem, int size);
|
||||
typedef void (CALLBACK* _DEV9writeDMA8Mem)(u32 *pMem, int size);
|
||||
typedef void (CALLBACK* _DEV9irqCallback)(DEV9callback callback);
|
||||
typedef DEV9handler (CALLBACK* _DEV9irqHandler)(void);
|
||||
|
||||
typedef s32 (CALLBACK* _DEV9freeze)(int mode, freezeData *data);
|
||||
typedef void (CALLBACK* _DEV9configure)();
|
||||
typedef s32 (CALLBACK* _DEV9test)();
|
||||
typedef void (CALLBACK* _DEV9about)();
|
||||
|
||||
// USB
|
||||
// NOTE: The read/write functions CANNOT use XMM/MMX regs
|
||||
// If you want to use them, need to save and restore current ones
|
||||
typedef s32 (CALLBACK* _USBinit)();
|
||||
typedef s32 (CALLBACK* _USBopen)(void *pDsp);
|
||||
typedef void (CALLBACK* _USBclose)();
|
||||
typedef void (CALLBACK* _USBshutdown)();
|
||||
typedef u8 (CALLBACK* _USBread8)(u32 mem);
|
||||
typedef u16 (CALLBACK* _USBread16)(u32 mem);
|
||||
typedef u32 (CALLBACK* _USBread32)(u32 mem);
|
||||
typedef void (CALLBACK* _USBwrite8)(u32 mem, u8 value);
|
||||
typedef void (CALLBACK* _USBwrite16)(u32 mem, u16 value);
|
||||
typedef void (CALLBACK* _USBwrite32)(u32 mem, u32 value);
|
||||
typedef void (CALLBACK* _USBirqCallback)(USBcallback callback);
|
||||
typedef USBhandler (CALLBACK* _USBirqHandler)(void);
|
||||
typedef void (CALLBACK* _USBsetRAM)(void *mem);
|
||||
|
||||
typedef s32 (CALLBACK* _USBfreeze)(int mode, freezeData *data);
|
||||
typedef void (CALLBACK* _USBconfigure)();
|
||||
typedef s32 (CALLBACK* _USBtest)();
|
||||
typedef void (CALLBACK* _USBabout)();
|
||||
|
||||
//FW
|
||||
typedef s32 (CALLBACK* _FWinit)();
|
||||
typedef s32 (CALLBACK* _FWopen)(void *pDsp);
|
||||
typedef void (CALLBACK* _FWclose)();
|
||||
typedef void (CALLBACK* _FWshutdown)();
|
||||
typedef u32 (CALLBACK* _FWread32)(u32 mem);
|
||||
typedef void (CALLBACK* _FWwrite32)(u32 mem, u32 value);
|
||||
typedef void (CALLBACK* _FWirqCallback)(void (*callback)());
|
||||
|
||||
typedef s32 (CALLBACK* _FWfreeze)(int mode, freezeData *data);
|
||||
typedef void (CALLBACK* _FWconfigure)();
|
||||
typedef s32 (CALLBACK* _FWtest)();
|
||||
typedef void (CALLBACK* _FWabout)();
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef PLUGINfuncs
|
||||
|
||||
// GS
|
||||
_GSinit GSinit;
|
||||
_GSopen GSopen;
|
||||
_GSclose GSclose;
|
||||
_GSshutdown GSshutdown;
|
||||
_GSvsync GSvsync;
|
||||
_GSgifTransfer1 GSgifTransfer1;
|
||||
_GSgifTransfer2 GSgifTransfer2;
|
||||
_GSgifTransfer3 GSgifTransfer3;
|
||||
_GSgifSoftReset GSgifSoftReset;
|
||||
_GSreadFIFO GSreadFIFO;
|
||||
_GSreadFIFO2 GSreadFIFO2;
|
||||
|
||||
_GSkeyEvent GSkeyEvent;
|
||||
_GSchangeSaveState GSchangeSaveState;
|
||||
_GSmakeSnapshot GSmakeSnapshot;
|
||||
_GSmakeSnapshot2 GSmakeSnapshot2;
|
||||
_GSirqCallback GSirqCallback;
|
||||
_GSprintf GSprintf;
|
||||
_GSsetBaseMem GSsetBaseMem;
|
||||
_GSsetGameCRC GSsetGameCRC;
|
||||
_GSsetFrameSkip GSsetFrameSkip;
|
||||
_GSreset GSreset;
|
||||
_GSwriteCSR GSwriteCSR;
|
||||
_GSgetDriverInfo GSgetDriverInfo;
|
||||
#ifdef _WIN32
|
||||
_GSsetWindowInfo GSsetWindowInfo;
|
||||
#endif
|
||||
_GSfreeze GSfreeze;
|
||||
_GSconfigure GSconfigure;
|
||||
_GStest GStest;
|
||||
_GSabout GSabout;
|
||||
|
||||
// PAD1
|
||||
_PADinit PAD1init;
|
||||
_PADopen PAD1open;
|
||||
_PADclose PAD1close;
|
||||
_PADshutdown PAD1shutdown;
|
||||
_PADkeyEvent PAD1keyEvent;
|
||||
_PADstartPoll PAD1startPoll;
|
||||
_PADpoll PAD1poll;
|
||||
_PADquery PAD1query;
|
||||
|
||||
_PADgsDriverInfo PAD1gsDriverInfo;
|
||||
_PADconfigure PAD1configure;
|
||||
_PADtest PAD1test;
|
||||
_PADabout PAD1about;
|
||||
|
||||
// PAD2
|
||||
_PADinit PAD2init;
|
||||
_PADopen PAD2open;
|
||||
_PADclose PAD2close;
|
||||
_PADshutdown PAD2shutdown;
|
||||
_PADkeyEvent PAD2keyEvent;
|
||||
_PADstartPoll PAD2startPoll;
|
||||
_PADpoll PAD2poll;
|
||||
_PADquery PAD2query;
|
||||
|
||||
_PADgsDriverInfo PAD2gsDriverInfo;
|
||||
_PADconfigure PAD2configure;
|
||||
_PADtest PAD2test;
|
||||
_PADabout PAD2about;
|
||||
|
||||
// SIO[2]
|
||||
_SIOinit SIOinit[2][9];
|
||||
_SIOopen SIOopen[2][9];
|
||||
_SIOclose SIOclose[2][9];
|
||||
_SIOshutdown SIOshutdown[2][9];
|
||||
_SIOstartPoll SIOstartPoll[2][9];
|
||||
_SIOpoll SIOpoll[2][9];
|
||||
_SIOquery SIOquery[2][9];
|
||||
|
||||
_SIOconfigure SIOconfigure[2][9];
|
||||
_SIOtest SIOtest[2][9];
|
||||
_SIOabout SIOabout[2][9];
|
||||
|
||||
// SPU2
|
||||
_SPU2init SPU2init;
|
||||
_SPU2open SPU2open;
|
||||
_SPU2close SPU2close;
|
||||
_SPU2shutdown SPU2shutdown;
|
||||
_SPU2write SPU2write;
|
||||
_SPU2read SPU2read;
|
||||
_SPU2readDMA4Mem SPU2readDMA4Mem;
|
||||
_SPU2writeDMA4Mem SPU2writeDMA4Mem;
|
||||
_SPU2interruptDMA4 SPU2interruptDMA4;
|
||||
_SPU2readDMA7Mem SPU2readDMA7Mem;
|
||||
_SPU2writeDMA7Mem SPU2writeDMA7Mem;
|
||||
_SPU2interruptDMA7 SPU2interruptDMA7;
|
||||
_SPU2ReadMemAddr SPU2ReadMemAddr;
|
||||
_SPU2WriteMemAddr SPU2WriteMemAddr;
|
||||
_SPU2irqCallback SPU2irqCallback;
|
||||
|
||||
_SPU2async SPU2async;
|
||||
_SPU2freeze SPU2freeze;
|
||||
_SPU2configure SPU2configure;
|
||||
_SPU2test SPU2test;
|
||||
_SPU2about SPU2about;
|
||||
|
||||
// CDVD
|
||||
_CDVDinit CDVDinit;
|
||||
_CDVDopen CDVDopen;
|
||||
_CDVDclose CDVDclose;
|
||||
_CDVDshutdown CDVDshutdown;
|
||||
_CDVDreadTrack CDVDreadTrack;
|
||||
_CDVDgetBuffer CDVDgetBuffer;
|
||||
_CDVDreadSubQ CDVDreadSubQ;
|
||||
_CDVDgetTN CDVDgetTN;
|
||||
_CDVDgetTD CDVDgetTD;
|
||||
_CDVDgetTOC CDVDgetTOC;
|
||||
_CDVDgetDiskType CDVDgetDiskType;
|
||||
_CDVDgetTrayStatus CDVDgetTrayStatus;
|
||||
_CDVDctrlTrayOpen CDVDctrlTrayOpen;
|
||||
_CDVDctrlTrayClose CDVDctrlTrayClose;
|
||||
|
||||
_CDVDconfigure CDVDconfigure;
|
||||
_CDVDtest CDVDtest;
|
||||
_CDVDabout CDVDabout;
|
||||
_CDVDnewDiskCB CDVDnewDiskCB;
|
||||
|
||||
// DEV9
|
||||
_DEV9init DEV9init;
|
||||
_DEV9open DEV9open;
|
||||
_DEV9close DEV9close;
|
||||
_DEV9shutdown DEV9shutdown;
|
||||
_DEV9read8 DEV9read8;
|
||||
_DEV9read16 DEV9read16;
|
||||
_DEV9read32 DEV9read32;
|
||||
_DEV9write8 DEV9write8;
|
||||
_DEV9write16 DEV9write16;
|
||||
_DEV9write32 DEV9write32;
|
||||
_DEV9readDMA8Mem DEV9readDMA8Mem;
|
||||
_DEV9writeDMA8Mem DEV9writeDMA8Mem;
|
||||
_DEV9irqCallback DEV9irqCallback;
|
||||
_DEV9irqHandler DEV9irqHandler;
|
||||
|
||||
_DEV9configure DEV9configure;
|
||||
_DEV9freeze DEV9freeze;
|
||||
_DEV9test DEV9test;
|
||||
_DEV9about DEV9about;
|
||||
|
||||
// USB
|
||||
_USBinit USBinit;
|
||||
_USBopen USBopen;
|
||||
_USBclose USBclose;
|
||||
_USBshutdown USBshutdown;
|
||||
_USBread8 USBread8;
|
||||
_USBread16 USBread16;
|
||||
_USBread32 USBread32;
|
||||
_USBwrite8 USBwrite8;
|
||||
_USBwrite16 USBwrite16;
|
||||
_USBwrite32 USBwrite32;
|
||||
_USBirqCallback USBirqCallback;
|
||||
_USBirqHandler USBirqHandler;
|
||||
_USBsetRAM USBsetRAM;
|
||||
|
||||
_USBconfigure USBconfigure;
|
||||
_USBfreeze USBfreeze;
|
||||
_USBtest USBtest;
|
||||
_USBabout USBabout;
|
||||
|
||||
// FW
|
||||
_FWinit FWinit;
|
||||
_FWopen FWopen;
|
||||
_FWclose FWclose;
|
||||
_FWshutdown FWshutdown;
|
||||
_FWread32 FWread32;
|
||||
_FWwrite32 FWwrite32;
|
||||
_FWirqCallback FWirqCallback;
|
||||
|
||||
_FWconfigure FWconfigure;
|
||||
_FWfreeze FWfreeze;
|
||||
_FWtest FWtest;
|
||||
_FWabout FWabout;
|
||||
#endif
|
||||
|
||||
#endif /* __PS2EDEFS_H__ */
|
|
@ -1,86 +0,0 @@
|
|||
#ifndef __PS2ETYPES_H__
|
||||
|
||||
#define __PS2ETYPES_H__
|
||||
|
||||
|
||||
|
||||
// Basic types
|
||||
|
||||
#if defined(__MSCW32__)
|
||||
|
||||
|
||||
|
||||
typedef __int8 s8;
|
||||
|
||||
typedef __int16 s16;
|
||||
|
||||
typedef __int32 s32;
|
||||
|
||||
typedef __int64 s64;
|
||||
|
||||
|
||||
|
||||
typedef unsigned __int8 u8;
|
||||
|
||||
typedef unsigned __int16 u16;
|
||||
|
||||
typedef unsigned __int32 u32;
|
||||
|
||||
typedef unsigned __int64 u64;
|
||||
|
||||
|
||||
|
||||
#if defined(__x86_64__)
|
||||
|
||||
typedef u64 uptr;
|
||||
|
||||
#else
|
||||
|
||||
typedef u32 uptr;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#elif defined(__linux__) || defined(__MINGW32__)
|
||||
|
||||
|
||||
|
||||
typedef char s8;
|
||||
|
||||
typedef short s16;
|
||||
|
||||
typedef int s32;
|
||||
|
||||
typedef long long s64;
|
||||
|
||||
|
||||
|
||||
typedef unsigned char u8;
|
||||
|
||||
typedef unsigned short u16;
|
||||
|
||||
typedef unsigned int u32;
|
||||
|
||||
typedef unsigned long long u64;
|
||||
|
||||
|
||||
|
||||
#if defined(__x86_64__)
|
||||
|
||||
typedef u64 uptr;
|
||||
|
||||
#else
|
||||
|
||||
typedef u32 uptr;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif /* __PS2ETYPES_H__ */
|
||||
|
|
@ -1,774 +0,0 @@
|
|||
/* CD.c
|
||||
|
||||
* Copyright (C) 2002-2005 PCSX2 Team
|
||||
|
||||
*
|
||||
|
||||
* 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 2 of the License, or
|
||||
|
||||
* (at your option) any later version.
|
||||
|
||||
*
|
||||
|
||||
* 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. See the
|
||||
|
||||
* GNU General Public License for more details.
|
||||
|
||||
*
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
|
||||
* along with this program; if not, write to the Free Software
|
||||
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include <ddk/ntddcdrm.h> // IOCTL_CDROM...
|
||||
|
||||
|
||||
|
||||
#include <sys/types.h> // off64_t
|
||||
|
||||
|
||||
|
||||
#define CDVDdefs
|
||||
|
||||
#include "PS2Edefs.h"
|
||||
|
||||
|
||||
|
||||
#include "logfile.h"
|
||||
|
||||
#include "../convert.h" // MSFtoLBA(), HEXTOBCD()
|
||||
|
||||
#include "actualfile.h"
|
||||
|
||||
#include "device.h" // tocbuffer[], FinishCommand()
|
||||
|
||||
#include "CD.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int actualcdmode; // -1=ReadFile, 0=YellowMode2, 1=XAForm2, 2=CDDA
|
||||
|
||||
DWORD cdblocksize; // 2048 to 2352
|
||||
|
||||
int cdoffset; // 0, 8, 16, or 24
|
||||
|
||||
int cdmode;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void InitCDInfo() {
|
||||
|
||||
actualcdmode = -1;
|
||||
|
||||
cdblocksize = 2048;
|
||||
|
||||
cdmode = -1;
|
||||
|
||||
} // END InitCDInfo()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
s32 CDreadTrackPass(u32 lsn, int mode, u8 *buffer) {
|
||||
|
||||
RAW_READ_INFO rawinfo;
|
||||
|
||||
BOOL boolresult;
|
||||
|
||||
DWORD byteswritten;
|
||||
|
||||
DWORD errcode;
|
||||
|
||||
LARGE_INTEGER targetpos;
|
||||
|
||||
int i;
|
||||
|
||||
|
||||
|
||||
if((actualcdmode < -1) || (actualcdmode > 2)) return(-1);
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_DEVICE
|
||||
|
||||
PrintLog("CDVDlinuz CD: CDreadTrack(%llu, %i)", lsn, actualcdmode);
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_DEVICE */
|
||||
|
||||
|
||||
|
||||
if(actualcdmode >= 0) {
|
||||
|
||||
rawinfo.DiskOffset.QuadPart = lsn * 2048; // Yes, 2048.
|
||||
|
||||
rawinfo.SectorCount = 1;
|
||||
|
||||
rawinfo.TrackMode = actualcdmode;
|
||||
|
||||
boolresult = DeviceIoControl(devicehandle,
|
||||
|
||||
IOCTL_CDROM_RAW_READ,
|
||||
|
||||
&rawinfo,
|
||||
|
||||
sizeof(RAW_READ_INFO),
|
||||
|
||||
buffer,
|
||||
|
||||
2352,
|
||||
|
||||
&byteswritten,
|
||||
|
||||
&waitevent);
|
||||
|
||||
errcode = FinishCommand(boolresult);
|
||||
|
||||
|
||||
|
||||
if(errcode != 0) {
|
||||
|
||||
#ifdef VERBOSE_WARNING_DEVICE
|
||||
|
||||
PrintLog("CDVDlinuz CD: Couldn't read a sector raw!");
|
||||
|
||||
PrintError("CDVDlinuz CD", errcode);
|
||||
|
||||
#endif /* VERBOSE_WARNING_DEVICE */
|
||||
|
||||
return(-1);
|
||||
|
||||
} // ENDIF- Couldn't read a raw sector? Maybe not a CD.
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
targetpos.QuadPart = lsn * 2048;
|
||||
|
||||
waitevent.Offset = targetpos.LowPart;
|
||||
|
||||
waitevent.OffsetHigh = targetpos.HighPart;
|
||||
|
||||
|
||||
|
||||
boolresult = ReadFile(devicehandle,
|
||||
|
||||
buffer + 24,
|
||||
|
||||
2048,
|
||||
|
||||
&byteswritten,
|
||||
|
||||
&waitevent);
|
||||
|
||||
errcode = FinishCommand(boolresult);
|
||||
|
||||
|
||||
|
||||
if(errcode != 0) {
|
||||
|
||||
#ifdef VERBOSE_WARNING_DEVICE
|
||||
|
||||
PrintLog("CDVDlinuz CD: Couldn't read a cooked sector!");
|
||||
|
||||
PrintError("CDVDlinuz CD", errcode);
|
||||
|
||||
#endif /* VERBOSE_WARNING_DEVICE */
|
||||
|
||||
return(-1);
|
||||
|
||||
} // ENDIF- Trouble with seek? Report it.
|
||||
|
||||
|
||||
|
||||
for(i = 0; i < 24; i++) *(buffer + i) = 0;
|
||||
|
||||
for(i = 24 + 2048; i < 2352; i++) *(buffer + i) = 0;
|
||||
|
||||
} // ENDIF- Could we read a raw sector? Read another one!
|
||||
|
||||
|
||||
|
||||
if(boolresult == FALSE) {
|
||||
|
||||
boolresult = GetOverlappedResult(devicehandle,
|
||||
|
||||
&waitevent,
|
||||
|
||||
&byteswritten,
|
||||
|
||||
FALSE);
|
||||
|
||||
} // ENDIF- Did the initial call not complete? Get byteswritten for
|
||||
|
||||
// the completed call.
|
||||
|
||||
|
||||
|
||||
if(byteswritten < 2048) {
|
||||
|
||||
#ifdef VERBOSE_WARNING_DEVICE
|
||||
|
||||
errcode = GetLastError();
|
||||
|
||||
PrintLog("CDVDlinuz CD: Short block! only got %u out of %u bytes",
|
||||
|
||||
byteswritten, cdblocksize);
|
||||
|
||||
PrintError("CDVDlinuz CD", errcode);
|
||||
|
||||
#endif /* VERBOSE_WARNING_DEVICE */
|
||||
|
||||
return(-1);
|
||||
|
||||
} // ENDIF- Couldn't read a raw sector? Maybe not a CD.
|
||||
|
||||
|
||||
|
||||
cdmode = mode;
|
||||
|
||||
cdblocksize = byteswritten;
|
||||
|
||||
return(0);
|
||||
|
||||
} // END CDreadTrackPass()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
s32 CDreadTrack(u32 lsn, int mode, u8 *buffer) {
|
||||
|
||||
int retval;
|
||||
|
||||
int lastmode;
|
||||
|
||||
int i;
|
||||
|
||||
|
||||
|
||||
retval = CDreadTrackPass(lsn, mode, buffer);
|
||||
|
||||
if(retval >= 0) return(retval);
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_WARNING_DEVICE
|
||||
|
||||
PrintLog("CDVDlinuz CD: Same mode doesn't work. Scanning...");
|
||||
|
||||
#endif /* VERBOSE_WARNING_DEVICE */
|
||||
|
||||
|
||||
|
||||
lastmode = actualcdmode;
|
||||
|
||||
actualcdmode = 2;
|
||||
|
||||
while(actualcdmode >= -1) {
|
||||
|
||||
retval = CDreadTrackPass(lsn, mode, buffer);
|
||||
|
||||
if(retval >= 0) return(retval);
|
||||
|
||||
actualcdmode--;
|
||||
|
||||
} // ENDWHILE- Searching each mode for a way to read the sector
|
||||
|
||||
actualcdmode = lastmode; // None worked? Go back to first mode.
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_WARNING_DEVICE
|
||||
|
||||
PrintLog("CDVDlinuz CD: No modes work. Failing sector!");
|
||||
|
||||
#endif /* VERBOSE_WARNING_DEVICE */
|
||||
|
||||
|
||||
|
||||
for(i = 0; i < 2352; i++) *(buffer + i) = 0;
|
||||
|
||||
return(-1);
|
||||
|
||||
} // END CDreadTrack()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
s32 CDgetBufferOffset() {
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_DEVICE
|
||||
|
||||
PrintLog("CDVD CD: CDgetBufferOffset()");
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_DEVICE */
|
||||
|
||||
|
||||
|
||||
// Send a whole CDDA record in?
|
||||
|
||||
if((actualcdmode == CDDA) && (cdmode == CDVD_MODE_2352)) return(0);
|
||||
|
||||
|
||||
|
||||
// Otherwise, send the start of the data block in...
|
||||
|
||||
return(cdoffset);
|
||||
|
||||
} // END CDgetBufferOffset()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
s32 CDreadSubQ() {
|
||||
|
||||
return(-1);
|
||||
|
||||
} // END CDreadSubQ()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
s32 CDgetTN(cdvdTN *cdvdtn) {
|
||||
|
||||
cdvdtn->strack = BCDTOHEX(tocbuffer[7]);
|
||||
|
||||
cdvdtn->etrack = BCDTOHEX(tocbuffer[17]);
|
||||
|
||||
return(0);
|
||||
|
||||
} // END CDgetTN()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
s32 CDgetTD(u8 newtrack, cdvdTD *cdvdtd) {
|
||||
|
||||
u8 actualtrack;
|
||||
|
||||
int pos;
|
||||
|
||||
char temptime[3];
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_DEVICE
|
||||
|
||||
PrintLog("CDVDlinuz CD: CDgetTD()");
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_DEVICE */
|
||||
|
||||
|
||||
|
||||
actualtrack = newtrack;
|
||||
|
||||
if(actualtrack == 0xaa) actualtrack = 0;
|
||||
|
||||
|
||||
|
||||
if(actualtrack == 0) {
|
||||
|
||||
cdvdtd->type = 0;
|
||||
|
||||
temptime[0] = BCDTOHEX(tocbuffer[27]);
|
||||
|
||||
temptime[1] = BCDTOHEX(tocbuffer[28]);
|
||||
|
||||
temptime[2] = BCDTOHEX(tocbuffer[29]);
|
||||
|
||||
cdvdtd->lsn = MSFtoLBA(temptime);
|
||||
|
||||
} else {
|
||||
|
||||
pos = actualtrack * 10;
|
||||
|
||||
pos += 30;
|
||||
|
||||
cdvdtd->type = tocbuffer[pos];
|
||||
|
||||
temptime[0] = BCDTOHEX(tocbuffer[pos + 7]);
|
||||
|
||||
temptime[1] = BCDTOHEX(tocbuffer[pos + 8]);
|
||||
|
||||
temptime[2] = BCDTOHEX(tocbuffer[pos + 9]);
|
||||
|
||||
cdvdtd->lsn = MSFtoLBA(temptime);
|
||||
|
||||
} // ENDIF- Whole disc? (or single track?)
|
||||
|
||||
|
||||
|
||||
return(0);
|
||||
|
||||
} // END CDgetTD()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
s32 CDgetDiskType() {
|
||||
|
||||
CDROM_TOC cdinfo;
|
||||
|
||||
BOOL boolresult;
|
||||
|
||||
int retval;
|
||||
|
||||
DWORD byteswritten;
|
||||
|
||||
DWORD errcode;
|
||||
|
||||
u8 iso9660name[] = "CD001\0";
|
||||
|
||||
u8 playstationname[] = "PLAYSTATION\0";
|
||||
|
||||
u8 ps1name[] = "CD-XA001\0";
|
||||
|
||||
u8 tempbuffer[2448];
|
||||
|
||||
int tempdisctype;
|
||||
|
||||
int i;
|
||||
|
||||
int pos;
|
||||
|
||||
unsigned long volumesize;
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_DEVICE
|
||||
|
||||
PrintLog("CDVDlinuz CD: CDgetDiskType()");
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_DEVICE */
|
||||
|
||||
|
||||
|
||||
tempdisctype = CDVD_TYPE_UNKNOWN;
|
||||
|
||||
|
||||
|
||||
actualcdmode = 2;
|
||||
|
||||
retval = CDreadTrack(16, CDVD_MODE_2048, tempbuffer);
|
||||
|
||||
if(retval < 0) {
|
||||
|
||||
disctype = tempdisctype;
|
||||
|
||||
return(-1);
|
||||
|
||||
} // ENDIF- Couldn't read the directory sector? Abort.
|
||||
|
||||
|
||||
|
||||
disctype = CDVD_TYPE_DETCTCD;
|
||||
|
||||
tempdisctype = CDVD_TYPE_CDDA;
|
||||
|
||||
|
||||
|
||||
cdoffset = 0;
|
||||
|
||||
i = 0;
|
||||
|
||||
while((cdoffset <= 24) && (iso9660name[i] != 0)) {
|
||||
|
||||
i = 0;
|
||||
|
||||
while((iso9660name[i] != 0) &&
|
||||
|
||||
(iso9660name[i] == tempbuffer[cdoffset + 1 + i])) i++;
|
||||
|
||||
if(iso9660name[i] != 0) cdoffset += 8;
|
||||
|
||||
} // ENDWHILE- Trying to find a working offset for a ISO9660 record.
|
||||
|
||||
|
||||
|
||||
if(iso9660name[i] != 0) {
|
||||
|
||||
#ifdef VERBOSE_DISC_TYPE
|
||||
|
||||
PrintLog("Detected a CDDA (Music CD).");
|
||||
|
||||
#endif /* VERBOSE_DISC_TYPE */
|
||||
|
||||
tempdisctype = CDVD_TYPE_CDDA;
|
||||
|
||||
tocbuffer[0] = 0x01;
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
tocbuffer[0] = 0x41;
|
||||
|
||||
i = 0;
|
||||
|
||||
while((playstationname[i] != 0) &&
|
||||
|
||||
(playstationname[i] == tempbuffer[cdoffset + 8 + i])) i++;
|
||||
|
||||
if(playstationname[i] != 0) {
|
||||
|
||||
#ifdef VERBOSE_DISC_TYPE
|
||||
|
||||
PrintLog("Detected a non-Playstation CD.");
|
||||
|
||||
#endif /* VERBOSE_DISC_TYPE */
|
||||
|
||||
tempdisctype = CDVD_TYPE_UNKNOWN;
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
i = 0;
|
||||
|
||||
while((ps1name[i] != 0) &&
|
||||
|
||||
(ps1name[i] == tempbuffer[cdoffset + 1024 + i])) i++;
|
||||
|
||||
if(ps1name[i] != 0) {
|
||||
|
||||
#ifdef VERBOSE_DISC_TYPE
|
||||
|
||||
PrintLog("Detected a Playstation 2 CD.");
|
||||
|
||||
#endif /* VERBOSE_DISC_TYPE */
|
||||
|
||||
tempdisctype = CDVD_TYPE_PS2CD;
|
||||
|
||||
} else {
|
||||
|
||||
#ifdef VERBOSE_DISC_TYPE
|
||||
|
||||
PrintLog("Detected a Playstation CD.");
|
||||
|
||||
#endif /* VERBOSE_DISC_TYPE */
|
||||
|
||||
tempdisctype = CDVD_TYPE_PSCD;
|
||||
|
||||
} // ENDIF- Is this not a PlayStation Disc?
|
||||
|
||||
} // ENDIF- Is this not a PlayStation Disc?
|
||||
|
||||
} // ENDIF- Is this not an ISO9660 CD? (a CDDA, in other words?)
|
||||
|
||||
|
||||
|
||||
// Build the Fake TOC
|
||||
|
||||
tocbuffer[2] = 0xA0;
|
||||
|
||||
tocbuffer[7] = HEXTOBCD(1); // Starting Track
|
||||
|
||||
tocbuffer[12] = 0xA1;
|
||||
|
||||
tocbuffer[17] = HEXTOBCD(1); // Ending Track
|
||||
|
||||
|
||||
|
||||
volumesize = tempbuffer[84]; // Volume size (big endian)
|
||||
|
||||
volumesize *= 256;
|
||||
|
||||
volumesize += tempbuffer[85];
|
||||
|
||||
volumesize *= 256;
|
||||
|
||||
volumesize += tempbuffer[86];
|
||||
|
||||
volumesize *= 256;
|
||||
|
||||
volumesize += tempbuffer[87];
|
||||
|
||||
#ifdef VERBOSE_DISC_INFO
|
||||
|
||||
if(tempdisctype != CDVD_TYPE_CDDA) {
|
||||
|
||||
PrintLog("CDVDlinuz CD: ISO9660 size %llu", volumesize);
|
||||
|
||||
} // ENDIF- Data CD? Print size in blocks.
|
||||
|
||||
#endif /* VERBOSE_DISC_INFO */
|
||||
|
||||
|
||||
|
||||
LBAtoMSF(volumesize, &tocbuffer[27]);
|
||||
|
||||
tocbuffer[27] = HEXTOBCD(tocbuffer[27]);
|
||||
|
||||
tocbuffer[28] = HEXTOBCD(tocbuffer[28]);
|
||||
|
||||
tocbuffer[29] = HEXTOBCD(tocbuffer[29]);
|
||||
|
||||
|
||||
|
||||
tocbuffer[40] = 0x02; // Data Mode
|
||||
|
||||
tocbuffer[42] = 0x01; // Track #
|
||||
|
||||
LBAtoMSF(0, &tocbuffer[47]);
|
||||
|
||||
tocbuffer[47] = HEXTOBCD(tocbuffer[47]);
|
||||
|
||||
tocbuffer[48] = HEXTOBCD(tocbuffer[48]);
|
||||
|
||||
tocbuffer[49] = HEXTOBCD(tocbuffer[49]);
|
||||
|
||||
|
||||
|
||||
// Can we get the REAL TOC?
|
||||
|
||||
boolresult = DeviceIoControl(devicehandle,
|
||||
|
||||
IOCTL_CDROM_READ_TOC,
|
||||
|
||||
NULL,
|
||||
|
||||
0,
|
||||
|
||||
&cdinfo,
|
||||
|
||||
sizeof(CDROM_TOC),
|
||||
|
||||
&byteswritten,
|
||||
|
||||
NULL);
|
||||
|
||||
|
||||
|
||||
if(boolresult == FALSE) {
|
||||
|
||||
#ifdef VERBOSE_WARNING_DEVICE
|
||||
|
||||
errcode = GetLastError();
|
||||
|
||||
PrintLog("CDVDlinuz CD: Can't get TOC!");
|
||||
|
||||
PrintError("CDVDlinuz CD", errcode);
|
||||
|
||||
#endif /* VERBOSE_WARNING_DEVICE */
|
||||
|
||||
disctype = tempdisctype;
|
||||
|
||||
return(disctype);
|
||||
|
||||
} // ENDIF- Can't read the TOC? Accept the fake TOC then.
|
||||
|
||||
|
||||
|
||||
// Fill in the pieces of the REAL TOC.
|
||||
|
||||
#ifdef VERBOSE_DISC_INFO
|
||||
|
||||
PrintLog("CDVDlinuz CD: TOC First Track: %u Last Track: %u",
|
||||
|
||||
cdinfo.FirstTrack, cdinfo.LastTrack);
|
||||
|
||||
#endif /* VERBOSE_DISC_INFO */
|
||||
|
||||
tocbuffer[7] = HEXTOBCD(cdinfo.FirstTrack);
|
||||
|
||||
tocbuffer[17] = HEXTOBCD(cdinfo.LastTrack);
|
||||
|
||||
|
||||
|
||||
// for(i = cdinfo.FirstTrack; i <= cdinfo.LastTrack; i++) {
|
||||
|
||||
for(i = 0; i <= cdinfo.LastTrack - cdinfo.FirstTrack; i++) {
|
||||
|
||||
#ifdef VERBOSE_DISC_INFO
|
||||
|
||||
PrintLog("CDVDlinuz CD: TOC Track %u Disc Size: %u:%u.%u Data Mode %u",
|
||||
|
||||
cdinfo.TrackData[i].TrackNumber,
|
||||
|
||||
cdinfo.TrackData[i].Address[1] * 1,
|
||||
|
||||
cdinfo.TrackData[i].Address[2] * 1,
|
||||
|
||||
cdinfo.TrackData[i].Address[3] * 1,
|
||||
|
||||
cdinfo.TrackData[i].Control * 1);
|
||||
|
||||
#endif /* VERBOSE_DISC_INFO */
|
||||
|
||||
pos = i * 10 + 40;
|
||||
|
||||
tocbuffer[pos] = cdinfo.TrackData[i].Control;
|
||||
|
||||
tocbuffer[pos + 2] = HEXTOBCD(i + 1);
|
||||
|
||||
tocbuffer[pos + 7] = HEXTOBCD(cdinfo.TrackData[i].Address[1]);
|
||||
|
||||
tocbuffer[pos + 8] = HEXTOBCD(cdinfo.TrackData[i].Address[2]);
|
||||
|
||||
tocbuffer[pos + 9] = HEXTOBCD(cdinfo.TrackData[i].Address[3]);
|
||||
|
||||
} // NEXT i- Transferring Track data to the PS2 TOC
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_DISC_INFO
|
||||
|
||||
PrintLog("CDVDlinuz CD: TOC Disc Size: %u:%u.%u",
|
||||
|
||||
cdinfo.TrackData[i].Address[1] * 1,
|
||||
|
||||
cdinfo.TrackData[i].Address[2] * 1,
|
||||
|
||||
cdinfo.TrackData[i].Address[3] * 1);
|
||||
|
||||
#endif /* VERBOSE_DISC_INFO */
|
||||
|
||||
tocbuffer[27] = HEXTOBCD(cdinfo.TrackData[i].Address[1]);
|
||||
|
||||
tocbuffer[28] = HEXTOBCD(cdinfo.TrackData[i].Address[2]);
|
||||
|
||||
tocbuffer[29] = HEXTOBCD(cdinfo.TrackData[i].Address[3]);
|
||||
|
||||
|
||||
|
||||
disctype = tempdisctype;
|
||||
|
||||
return(disctype);
|
||||
|
||||
} // END CDgetDiskType()
|
||||
|
|
@ -1,88 +0,0 @@
|
|||
/* CD.h
|
||||
|
||||
* Copyright (C) 2002-2005 PCSX2 Team
|
||||
|
||||
*
|
||||
|
||||
* 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 2 of the License, or
|
||||
|
||||
* (at your option) any later version.
|
||||
|
||||
*
|
||||
|
||||
* 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. See the
|
||||
|
||||
* GNU General Public License for more details.
|
||||
|
||||
*
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
|
||||
* along with this program; if not, write to the Free Software
|
||||
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef CD_H
|
||||
|
||||
#define CD_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <windows.h> // DWORD
|
||||
|
||||
|
||||
|
||||
#define CDVDdefs
|
||||
|
||||
#include "PS2Edefs.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern DWORD cdblocksize;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern void InitCDInfo();
|
||||
|
||||
extern s32 CDreadTrack(u32 lsn, int mode, u8 *buffer);
|
||||
|
||||
extern s32 CDgetBufferOffset();
|
||||
|
||||
extern s32 CDreadSubQ();
|
||||
|
||||
extern s32 CDgetTN(cdvdTN *cdvdtn);
|
||||
|
||||
extern s32 CDgetTD(u8 newtrack, cdvdTD *cdvdtd);
|
||||
|
||||
extern s32 CDgetDiskType();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* CD_H */
|
||||
|
|
@ -1,868 +0,0 @@
|
|||
/* CDVDlinuz.c
|
||||
|
||||
* Copyright (C) 2002-2005 PCSX2 Team
|
||||
|
||||
*
|
||||
|
||||
* 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 2 of the License, or
|
||||
|
||||
* (at your option) any later version.
|
||||
|
||||
*
|
||||
|
||||
* 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. See the
|
||||
|
||||
* GNU General Public License for more details.
|
||||
|
||||
*
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
|
||||
* along with this program; if not, write to the Free Software
|
||||
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <windows.h> // BOOL, CALLBACK, APIENTRY
|
||||
|
||||
#include <windef.h> // NULL
|
||||
|
||||
|
||||
|
||||
#include <time.h> // time(), time_t
|
||||
|
||||
|
||||
|
||||
#define CDVDdefs
|
||||
|
||||
#include "../PS2Edefs.h"
|
||||
|
||||
|
||||
|
||||
#include "device.h"
|
||||
|
||||
#include "CD.h"
|
||||
|
||||
#include "DVD.h"
|
||||
|
||||
#include "../buffer.h"
|
||||
|
||||
#include "../convert.h"
|
||||
|
||||
#include "conf.h"
|
||||
|
||||
#include "logfile.h"
|
||||
|
||||
#include "../version.h"
|
||||
|
||||
#include "screens.h"
|
||||
|
||||
#include "mainbox.h" // Initialize mainboxwindow
|
||||
|
||||
#include "CDVDlinuz.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
HINSTANCE progmodule;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
BOOL APIENTRY DllMain(HANDLE hModule,
|
||||
|
||||
DWORD param,
|
||||
|
||||
LPVOID reserved) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
switch(param) {
|
||||
|
||||
case DLL_PROCESS_ATTACH:
|
||||
|
||||
progmodule = hModule;
|
||||
|
||||
// mainboxwindow = NULL;
|
||||
|
||||
return(TRUE);
|
||||
|
||||
break;
|
||||
|
||||
case DLL_PROCESS_DETACH:
|
||||
|
||||
// CDVDshutdown();
|
||||
|
||||
return(TRUE);
|
||||
|
||||
break;
|
||||
|
||||
case DLL_THREAD_ATTACH:
|
||||
|
||||
return(TRUE);
|
||||
|
||||
break;
|
||||
|
||||
case DLL_THREAD_DETACH:
|
||||
|
||||
return(TRUE);
|
||||
|
||||
break;
|
||||
|
||||
} // ENDSWITCH param- What does the OS want with us?
|
||||
|
||||
|
||||
|
||||
return(FALSE); // Wasn't on list? Wasn't handled.
|
||||
|
||||
} // END DllMain()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
char* CALLBACK PS2EgetLibName() {
|
||||
|
||||
return(libname);
|
||||
|
||||
} // END PS2EgetLibName()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
u32 CALLBACK PS2EgetLibType() {
|
||||
|
||||
return(PS2E_LT_CDVD);
|
||||
|
||||
} // END PS2getLibType()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
u32 CALLBACK PS2EgetLibVersion2(u32 type) {
|
||||
|
||||
return((version << 16) | (revision << 8) | build);
|
||||
|
||||
} // END PS2EgetLibVersion2()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
s32 CALLBACK CDVDinit() {
|
||||
|
||||
InitLog();
|
||||
|
||||
if(OpenLog() != 0) return(-1); // Couldn't open Log File? Abort.
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
|
||||
PrintLog("CDVDlinuz interface: CDVDinit()");
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
|
||||
|
||||
|
||||
InitConf();
|
||||
|
||||
|
||||
|
||||
DeviceInit();
|
||||
|
||||
InitCDInfo();
|
||||
|
||||
InitDVDInfo();
|
||||
|
||||
|
||||
|
||||
mainboxwindow = NULL;
|
||||
|
||||
|
||||
|
||||
return(0);
|
||||
|
||||
} // END CDVDinit()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void CALLBACK CDVDshutdown() {
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
|
||||
PrintLog("CDVDlinuz interface: CDVDshutdown()");
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
|
||||
|
||||
|
||||
DeviceClose();
|
||||
|
||||
|
||||
|
||||
// Close Windows as well? (Just in case)
|
||||
|
||||
|
||||
|
||||
CloseLog();
|
||||
|
||||
} // END CDVDshutdown()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
s32 CALLBACK CDVDopen() {
|
||||
|
||||
int retval;
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
|
||||
PrintLog("CDVDlinuz interface: CDVDopen()");
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
|
||||
|
||||
|
||||
InitBuffer();
|
||||
|
||||
|
||||
|
||||
LoadConf();
|
||||
|
||||
|
||||
|
||||
retval = DeviceOpen();
|
||||
|
||||
if(retval == 0) {
|
||||
|
||||
DeviceTrayStatus();
|
||||
|
||||
} // ENDIF- Did we open the device? Poll for media.
|
||||
|
||||
return(retval);
|
||||
|
||||
} // END CDVDopen()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void CALLBACK CDVDclose() {
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
|
||||
PrintLog("CDVDlinuz interface: CDVDclose()");
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
|
||||
DeviceClose();
|
||||
|
||||
} // END CDVDclose()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
s32 CALLBACK CDVDreadSubQ(u32 lsn, cdvdSubQ* subq) {
|
||||
|
||||
char temptime[3];
|
||||
|
||||
int i;
|
||||
|
||||
int pos;
|
||||
|
||||
u32 tracklsn;
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
|
||||
PrintLog("CDVDlinuz interface: CDVDreadSubQ()");
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
|
||||
|
||||
|
||||
if(DiscInserted() != 0) return(-1);
|
||||
|
||||
|
||||
|
||||
if((disctype == CDVD_TYPE_PS2DVD) || (disctype == CDVD_TYPE_DVDV)) {
|
||||
|
||||
return(-1); // DVDs don't have SubQ data
|
||||
|
||||
} // ENDIF- Trying to get a SubQ from a DVD?
|
||||
|
||||
|
||||
|
||||
// fake it
|
||||
|
||||
i = BCDTOHEX(tocbuffer[7]);
|
||||
|
||||
pos = i * 10;
|
||||
|
||||
pos += 30;
|
||||
|
||||
temptime[0] = BCDTOHEX(tocbuffer[pos + 7]);
|
||||
|
||||
temptime[1] = BCDTOHEX(tocbuffer[pos + 8]);
|
||||
|
||||
temptime[2] = BCDTOHEX(tocbuffer[pos + 9]);
|
||||
|
||||
tracklsn = MSFtoLBA(temptime);
|
||||
|
||||
while((i < BCDTOHEX(tocbuffer[17])) && (tracklsn < lsn)) {
|
||||
|
||||
i++;
|
||||
|
||||
pos = i * 10;
|
||||
|
||||
pos += 30;
|
||||
|
||||
temptime[0] = BCDTOHEX(tocbuffer[pos + 7]);
|
||||
|
||||
temptime[1] = BCDTOHEX(tocbuffer[pos + 8]);
|
||||
|
||||
temptime[2] = BCDTOHEX(tocbuffer[pos + 9]);
|
||||
|
||||
tracklsn = MSFtoLBA(temptime);
|
||||
|
||||
} // ENDIF- Loop through tracks searching for lsn track
|
||||
|
||||
i--;
|
||||
|
||||
|
||||
|
||||
subq->ctrl = 4;
|
||||
|
||||
subq->mode = 1;
|
||||
|
||||
subq->trackNum = HEXTOBCD(i);
|
||||
|
||||
subq->trackIndex = HEXTOBCD(i);
|
||||
|
||||
|
||||
|
||||
LBAtoMSF(lsn - tracklsn, temptime);
|
||||
|
||||
subq->trackM = HEXTOBCD(temptime[0]);
|
||||
|
||||
subq->trackS = HEXTOBCD(temptime[1]);
|
||||
|
||||
subq->trackF = HEXTOBCD(temptime[2]);
|
||||
|
||||
|
||||
|
||||
subq->pad = 0;
|
||||
|
||||
|
||||
|
||||
// lba_to_msf(lsn + (2*75), &min, &sec, &frm);
|
||||
|
||||
LBAtoMSF(lsn, temptime);
|
||||
|
||||
subq->discM = HEXTOBCD(temptime[0]);
|
||||
|
||||
subq->discS = HEXTOBCD(temptime[1]);
|
||||
|
||||
subq->discF = HEXTOBCD(temptime[2]);
|
||||
|
||||
return(0);
|
||||
|
||||
} // END CDVDreadSubQ()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
s32 CALLBACK CDVDgetTN(cdvdTN *Buffer) {
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
|
||||
PrintLog("CDVDlinuz interface: CDVDgetTN()");
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
|
||||
|
||||
|
||||
if(DiscInserted() != 0) return(-1);
|
||||
|
||||
|
||||
|
||||
if((disctype == CDVD_TYPE_PS2DVD) || (disctype == CDVD_TYPE_DVDV)) {
|
||||
|
||||
Buffer->strack = 1;
|
||||
|
||||
Buffer->etrack = 1;
|
||||
|
||||
} else {
|
||||
|
||||
Buffer->strack = BCDTOHEX(tocbuffer[7]);
|
||||
|
||||
Buffer->etrack = BCDTOHEX(tocbuffer[17]);
|
||||
|
||||
} // ENDIF- Retrieve track info from a DVD? (or a CD?)
|
||||
|
||||
|
||||
|
||||
return(0);
|
||||
|
||||
} // END CDVDgetTN()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
s32 CALLBACK CDVDgetTD(u8 track, cdvdTD *buffer) {
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
|
||||
PrintLog("CDVDlinuz interface: CDVDgetTD()");
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
|
||||
|
||||
|
||||
return(DeviceGetTD(track, buffer));
|
||||
|
||||
} // END CDVDgetTD()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
s32 CALLBACK CDVDgetTOC(void* toc) {
|
||||
|
||||
int i;
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
|
||||
PrintLog("CDVDlinuz interface: CDVDgetTOC()");
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
|
||||
|
||||
|
||||
if(DiscInserted() != 0) return(-1);
|
||||
|
||||
|
||||
|
||||
for(i = 0; i < 2048; i++) *(((char *) toc) + i) = tocbuffer[i];
|
||||
|
||||
return(0);
|
||||
|
||||
} // END CDVDgetTOC()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
s32 CALLBACK CDVDreadTrack(u32 lsn, int mode) {
|
||||
|
||||
int retval;
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
|
||||
PrintLog("CDVDlinuz interface: CDVDreadTrack(%u)", lsn);
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
|
||||
|
||||
|
||||
if(DiscInserted() == -1) return(-1);
|
||||
|
||||
|
||||
|
||||
if(userbuffer < BUFFERMAX) {
|
||||
|
||||
if((bufferlist[userbuffer].lsn == lsn) &&
|
||||
|
||||
(bufferlist[userbuffer].mode == mode)) {
|
||||
|
||||
return(0);
|
||||
|
||||
} // ENDIF- And it's the right one?
|
||||
|
||||
} // ENDIF- Are we already pointing at the buffer?
|
||||
|
||||
|
||||
|
||||
userbuffer = FindListBuffer(lsn);
|
||||
|
||||
if(userbuffer < BUFFERMAX) {
|
||||
|
||||
if((bufferlist[userbuffer].lsn == lsn) &&
|
||||
|
||||
(bufferlist[userbuffer].mode == mode)) {
|
||||
|
||||
return(0);
|
||||
|
||||
} // ENDIF- And it was the right one?
|
||||
|
||||
} // ENDIF- Was a buffer found in the cache?
|
||||
|
||||
|
||||
|
||||
replacebuffer++;
|
||||
|
||||
if(replacebuffer >= BUFFERMAX) replacebuffer = 0;
|
||||
|
||||
userbuffer = replacebuffer;
|
||||
|
||||
|
||||
|
||||
if(bufferlist[replacebuffer].upsort != 0xffff) {
|
||||
|
||||
RemoveListBuffer(replacebuffer);
|
||||
|
||||
} // ENDIF- Reference already in place? Remove it.
|
||||
|
||||
|
||||
|
||||
retval = DeviceReadTrack(lsn, mode, bufferlist[replacebuffer].buffer);
|
||||
|
||||
bufferlist[replacebuffer].lsn = lsn;
|
||||
|
||||
bufferlist[replacebuffer].mode = mode;
|
||||
|
||||
bufferlist[replacebuffer].offset = DeviceBufferOffset();
|
||||
|
||||
|
||||
|
||||
if(retval != 0) {
|
||||
|
||||
bufferlist[replacebuffer].mode = -1; // Error! flag buffer as such.
|
||||
|
||||
} else {
|
||||
|
||||
if((disctype != CDVD_TYPE_PS2DVD) && (disctype != CDVD_TYPE_DVDV)) {
|
||||
|
||||
if(mode == CDVD_MODE_2352) {
|
||||
|
||||
CDreadSubQ(lsn, &bufferlist[replacebuffer].subq);
|
||||
|
||||
} // ENDIF- Read subq as well?
|
||||
|
||||
} // ENDIF- Read a DVD buffer or a CD buffer?
|
||||
|
||||
} // ENDIF-Read ok? Fill out rest of buffer info.
|
||||
|
||||
AddListBuffer(replacebuffer);
|
||||
|
||||
return(retval);
|
||||
|
||||
} // END CDVDreadTrack()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
u8* CALLBACK CDVDgetBuffer() {
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
|
||||
PrintLog("CDVDlinuz interface: CDVDgetBuffer()");
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
|
||||
|
||||
|
||||
if(DiscInserted() == -1) return(NULL);
|
||||
|
||||
|
||||
|
||||
if(userbuffer == 0xffff) {
|
||||
|
||||
#ifdef VERBOSE_WARNINGS
|
||||
|
||||
PrintLog("CDVDlinuz interface: Not pointing to a buffer!");
|
||||
|
||||
#endif /* VERBOSE_WARNINGS */
|
||||
|
||||
return(NULL); // No buffer reference?
|
||||
|
||||
} // ENDIF- user buffer not pointing at anything? Abort
|
||||
|
||||
|
||||
|
||||
if(bufferlist[userbuffer].mode < 0) {
|
||||
|
||||
#ifdef VERBOSE_WARNINGS
|
||||
|
||||
PrintLog("CDVDlinuz interface: Error retrieving sector (ReadTrack call)");
|
||||
|
||||
#endif /* VERBOSE_WARNINGS */
|
||||
|
||||
return(NULL); // Bad Sector?
|
||||
|
||||
} // ENDIF- Trouble reading physical sector? Tell them.
|
||||
|
||||
|
||||
|
||||
return(bufferlist[userbuffer].buffer + bufferlist[userbuffer].offset);
|
||||
|
||||
} // END CDVDgetBuffer()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
s32 CALLBACK CDVDgetDiskType() {
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
|
||||
PrintLog("CDVDlinuz interface: CDVDgetDiskType()");
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
|
||||
|
||||
|
||||
if(lasttime != time(NULL)) {
|
||||
|
||||
lasttime = time(NULL);
|
||||
|
||||
DeviceTrayStatus();
|
||||
|
||||
} // ENDIF- Has enough time passed between calls?
|
||||
|
||||
|
||||
|
||||
return(disctype);
|
||||
|
||||
} // END CDVDgetDiskType()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
s32 CALLBACK CDVDgetTrayStatus() {
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
|
||||
PrintLog("CDVDlinuz interface: CDVDgetTrayStatus()");
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
|
||||
|
||||
|
||||
if(lasttime != time(NULL)) {
|
||||
|
||||
lasttime = time(NULL);
|
||||
|
||||
DeviceTrayStatus();
|
||||
|
||||
} // ENDIF- Has enough time passed between calls?
|
||||
|
||||
|
||||
|
||||
return(traystatus);
|
||||
|
||||
} // END CDVDgetTrayStatus()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
s32 CALLBACK CDVDctrlTrayOpen() {
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
|
||||
PrintLog("CDVDlinuz interface: CDVDctrlTrayOpen()");
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
|
||||
|
||||
|
||||
return(DeviceTrayOpen());
|
||||
|
||||
} // END CDVDctrlTrayOpen()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
s32 CALLBACK CDVDctrlTrayClose() {
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
|
||||
PrintLog("CDVDlinuz interface: CDVDctrlTrayClose()");
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
|
||||
|
||||
|
||||
return(DeviceTrayClose());
|
||||
|
||||
} // END CDVDctrlTrayClose()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
s32 CALLBACK CDVDtest() {
|
||||
|
||||
int retval;
|
||||
|
||||
|
||||
|
||||
errno = 0;
|
||||
|
||||
|
||||
|
||||
if(devicehandle != NULL) {
|
||||
|
||||
#ifdef VERBOSE_WARNINGS
|
||||
|
||||
PrintLog("CDVDlinuz interface: Device already open");
|
||||
|
||||
#endif /* VERBOSE_WARNINGS */
|
||||
|
||||
return(0);
|
||||
|
||||
} // ENDIF- Is the CD/DVD already in use? That's fine.
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
|
||||
PrintLog("CDVDlinuz interface: CDVDtest()");
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
|
||||
|
||||
|
||||
retval = DeviceOpen();
|
||||
|
||||
DeviceClose();
|
||||
|
||||
return(retval);
|
||||
|
||||
} // END CDVDtest()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void CALLBACK CDVDconfigure() {
|
||||
|
||||
HWND lastwindow;
|
||||
|
||||
|
||||
|
||||
lastwindow = GetActiveWindow();
|
||||
|
||||
DialogBox(progmodule,
|
||||
|
||||
MAKEINTRESOURCE(DLG_0200),
|
||||
|
||||
lastwindow,
|
||||
|
||||
(DLGPROC)MainBoxCallback);
|
||||
|
||||
SetActiveWindow(lastwindow);
|
||||
|
||||
lastwindow = NULL;
|
||||
|
||||
return;
|
||||
|
||||
} // END CDVDconfigure()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
BOOL CALLBACK AboutCallback(HWND window, UINT msg, WPARAM param, LPARAM param2) {
|
||||
|
||||
switch(msg) {
|
||||
|
||||
case WM_COMMAND:
|
||||
|
||||
switch(LOWORD(param)) {
|
||||
|
||||
case IDC_0104: // "Ok" Button
|
||||
|
||||
EndDialog(window, FALSE);
|
||||
|
||||
return(TRUE);
|
||||
|
||||
break;
|
||||
|
||||
} // ENDSWITCH param- Which Windows Message Command?
|
||||
|
||||
|
||||
|
||||
case WM_CLOSE:
|
||||
|
||||
EndDialog(window, FALSE);
|
||||
|
||||
return(TRUE);
|
||||
|
||||
break;
|
||||
|
||||
} // ENDSWITCH msg- what message has been sent to this window?
|
||||
|
||||
|
||||
|
||||
return(FALSE); // Not a recognisable message. Pass it back to the OS.
|
||||
|
||||
} // END AboutCallback()
|
||||
|
||||
|
||||
|
||||
void CALLBACK CDVDabout() {
|
||||
|
||||
HWND lastwindow;
|
||||
|
||||
|
||||
|
||||
lastwindow = GetActiveWindow();
|
||||
|
||||
DialogBox(progmodule,
|
||||
|
||||
MAKEINTRESOURCE(DLG_0100),
|
||||
|
||||
lastwindow,
|
||||
|
||||
(DLGPROC)AboutCallback);
|
||||
|
||||
SetActiveWindow(lastwindow);
|
||||
|
||||
return;
|
||||
|
||||
} // END CDVDabout()
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
/* CDVDlinuz.h
|
||||
|
||||
* Copyright (C) 2002-2005 PCSX2 Team
|
||||
|
||||
*
|
||||
|
||||
* 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 2 of the License, or
|
||||
|
||||
* (at your option) any later version.
|
||||
|
||||
*
|
||||
|
||||
* 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. See the
|
||||
|
||||
* GNU General Public License for more details.
|
||||
|
||||
*
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
|
||||
* along with this program; if not, write to the Free Software
|
||||
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef CDVDLINUZ_H
|
||||
|
||||
#define CDVDLINUZ_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <windows.h> // HINSTANCE
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// #define VERBOSE_WARNINGS
|
||||
|
||||
// #define VERBOSE_FUNCTION_INTERFACE
|
||||
|
||||
#define VERBOSE_DISC_INFO
|
||||
|
||||
#define VERBOSE_DISC_TYPE
|
||||
|
||||
|
||||
|
||||
#define READ_AHEAD_BUFFERS 32
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern HINSTANCE progmodule;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* CDVDLINUZ_H */
|
||||
|
|
@ -1,796 +0,0 @@
|
|||
/* DVD.c
|
||||
|
||||
* Copyright (C) 2002-2005 PCSX2 Team
|
||||
|
||||
*
|
||||
|
||||
* 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 2 of the License, or
|
||||
|
||||
* (at your option) any later version.
|
||||
|
||||
*
|
||||
|
||||
* 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. See the
|
||||
|
||||
* GNU General Public License for more details.
|
||||
|
||||
*
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
|
||||
* along with this program; if not, write to the Free Software
|
||||
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include <ddk/ntddcdvd.h> // IOCTL_DVD...
|
||||
|
||||
|
||||
|
||||
#include <sys/types.h> // off64_t
|
||||
|
||||
|
||||
|
||||
#define CDVDdefs
|
||||
|
||||
#include "PS2Edefs.h"
|
||||
|
||||
|
||||
|
||||
#include "logfile.h"
|
||||
|
||||
#include "device.h" // FinishCommand()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
struct {
|
||||
|
||||
DVD_DESCRIPTOR_HEADER h;
|
||||
|
||||
DVD_LAYER_DESCRIPTOR d;
|
||||
|
||||
} layer;
|
||||
|
||||
// DVD_LAYER_DESCRIPTOR layer;
|
||||
|
||||
// DVD_COPYRIGHT_DESCRIPTOR copyright;
|
||||
|
||||
// DVD_DISK_KEY_DESCRIPTOR disckey;
|
||||
|
||||
// DVD_BCA_DESCRIPTOR bca;
|
||||
|
||||
// DVD_MANUFACTURER_DESCRIPTOR manufact;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void InitDVDInfo() {
|
||||
|
||||
layer.d.EndDataSector = 0;
|
||||
|
||||
} // END InitDVDInfo()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
s32 DVDGetStructures() {
|
||||
|
||||
DVD_SESSION_ID sessionid;
|
||||
|
||||
DVD_READ_STRUCTURE request;
|
||||
|
||||
DWORD byteswritten;
|
||||
|
||||
BOOL boolresult;
|
||||
|
||||
DWORD errcode;
|
||||
|
||||
s32 retval;
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_DEVICE
|
||||
|
||||
PrintLog("CDVDlinuz DVD: DVDgetStructures()");
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_DEVICE */
|
||||
|
||||
|
||||
|
||||
boolresult = DeviceIoControl(devicehandle,
|
||||
|
||||
IOCTL_DVD_START_SESSION,
|
||||
|
||||
NULL,
|
||||
|
||||
0,
|
||||
|
||||
&sessionid,
|
||||
|
||||
sizeof(DVD_SESSION_ID),
|
||||
|
||||
&byteswritten,
|
||||
|
||||
&waitevent);
|
||||
|
||||
errcode = FinishCommand(boolresult);
|
||||
|
||||
if(errcode != 0) {
|
||||
|
||||
#ifdef VERBOSE_WARNING_DEVICE
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Couldn't start session!");
|
||||
|
||||
PrintError("CDVDlinuz DVD", errcode);
|
||||
|
||||
#endif /* VERBOSE_WARNING_DEVICE */
|
||||
|
||||
return(-1);
|
||||
|
||||
} // ENDIF- Couldn't start a user session on the DVD drive? Fail.
|
||||
|
||||
|
||||
|
||||
request.BlockByteOffset.QuadPart = 0;
|
||||
|
||||
request.Format = DvdPhysicalDescriptor;
|
||||
|
||||
request.SessionId = sessionid;
|
||||
|
||||
request.LayerNumber = 0;
|
||||
|
||||
retval = 0;
|
||||
|
||||
boolresult = DeviceIoControl(devicehandle,
|
||||
|
||||
IOCTL_DVD_READ_STRUCTURE,
|
||||
|
||||
&request,
|
||||
|
||||
sizeof(DVD_READ_STRUCTURE),
|
||||
|
||||
&layer,
|
||||
|
||||
sizeof(layer),
|
||||
|
||||
&byteswritten,
|
||||
|
||||
&waitevent);
|
||||
|
||||
errcode = FinishCommand(boolresult);
|
||||
|
||||
if(errcode != 0) {
|
||||
|
||||
#ifdef VERBOSE_WARNING_DEVICE
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Couldn't get layer data!");
|
||||
|
||||
PrintError("CDVDlinuz DVD", errcode);
|
||||
|
||||
#endif /* VERBOSE_WARNING_DEVICE */
|
||||
|
||||
retval = -1;
|
||||
|
||||
} // ENDIF- Couldn't get layer data? (Including DVD size) Abort.
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_DISC_INFO
|
||||
|
||||
switch(layer.d.BookType) {
|
||||
|
||||
case 0:
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Book Type: DVD-ROM");
|
||||
|
||||
break;
|
||||
|
||||
case 1:
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Book Type: DVD-RAM");
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Book Type: DVD-R");
|
||||
|
||||
break;
|
||||
|
||||
case 3:
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Book Type: DVD-RW");
|
||||
|
||||
break;
|
||||
|
||||
case 9:
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Book Type: DVD+RW");
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Book Type: Unknown (%i)", layer.d.BookType);
|
||||
|
||||
break;
|
||||
|
||||
} // ENDSWITCH- Displaying the Book Type
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Book Version %i", layer.d.BookVersion);
|
||||
|
||||
switch(layer.d.MinimumRate) {
|
||||
|
||||
case 0:
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Use Minimum Rate for: DVD-ROM");
|
||||
|
||||
break;
|
||||
|
||||
case 1:
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Use Minimum Rate for: DVD-RAM");
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Use Minimum Rate for: DVD-R");
|
||||
|
||||
break;
|
||||
|
||||
case 3:
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Use Minimum Rate for: DVD-RW");
|
||||
|
||||
break;
|
||||
|
||||
case 9:
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Use Minimum Rate for: DVD+RW");
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Use Minimum Rate for: Unknown (%i)", layer.d.MinimumRate);
|
||||
|
||||
break;
|
||||
|
||||
} // ENDSWITCH- Displaying the Minimum (Spin?) Rate
|
||||
|
||||
switch(layer.d.DiskSize) {
|
||||
|
||||
case 0:
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Physical Disk Size: 120mm");
|
||||
|
||||
break;
|
||||
|
||||
case 1:
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Physical Disk Size: 80mm");
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Physical Disk Size: Unknown (%i)", layer.d.DiskSize);
|
||||
|
||||
break;
|
||||
|
||||
} // ENDSWITCH- What's the Disk Size?
|
||||
|
||||
switch(layer.d.LayerType) {
|
||||
|
||||
case 1:
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Layer Type: Read-Only");
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Layer Type: Recordable");
|
||||
|
||||
break;
|
||||
|
||||
case 4:
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Layer Type: Rewritable");
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Layer Type: Unknown (%i)", layer.d.LayerType);
|
||||
|
||||
break;
|
||||
|
||||
} // ENDSWITCH- Displaying the Layer Type
|
||||
|
||||
switch(layer.d.TrackPath) {
|
||||
|
||||
case 0:
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Track Path: PTP");
|
||||
|
||||
break;
|
||||
|
||||
case 1:
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Track Path: OTP");
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Track Path: Unknown (%i)", layer.d.TrackPath);
|
||||
|
||||
break;
|
||||
|
||||
} // ENDSWITCH- What's Track Path Layout?
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Number of Layers: %i", layer.d.NumberOfLayers + 1);
|
||||
|
||||
switch(layer.d.TrackDensity) {
|
||||
|
||||
case 0:
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Track Density: .74 m/track");
|
||||
|
||||
break;
|
||||
|
||||
case 1:
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Track Density: .8 m/track");
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Track Density: .615 m/track");
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Track Density: Unknown (%i)", layer.d.TrackDensity);
|
||||
|
||||
break;
|
||||
|
||||
} // ENDSWITCH- Displaying the Layer Type
|
||||
|
||||
switch(layer.d.LinearDensity) {
|
||||
|
||||
case 0:
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Linear Density: .267 m/bit");
|
||||
|
||||
break;
|
||||
|
||||
case 1:
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Linear Density: .293 m/bit");
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Linear Density: .409 to .435 m/bit");
|
||||
|
||||
break;
|
||||
|
||||
case 4:
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Linear Density: .280 to .291 m/bit");
|
||||
|
||||
break;
|
||||
|
||||
case 8:
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Linear Density: .353 m/bit");
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Linear Density: Unknown (%i)", layer.d.LinearDensity);
|
||||
|
||||
break;
|
||||
|
||||
} // ENDSWITCH- Displaying the Book Type
|
||||
|
||||
if(layer.d.StartingDataSector == 0x30000) {
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Starting Sector: %lu (DVD-ROM, DVD-R, DVD-RW)",
|
||||
|
||||
layer.d.StartingDataSector);
|
||||
|
||||
} else if(layer.d.StartingDataSector == 0x31000) {
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Starting Sector: %lu (DVD-RAM, DVD+RW)",
|
||||
|
||||
layer.d.StartingDataSector);
|
||||
|
||||
} else {
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Starting Sector: %lu", layer.d.StartingDataSector);
|
||||
|
||||
} // ENDLONGIF- What does the starting sector tell us?
|
||||
|
||||
PrintLog("CDVDlinuz DVD: End of Layer 0: %lu", layer.d.EndLayerZeroSector);
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Ending Sector: %lu", layer.d.EndDataSector);
|
||||
|
||||
if(layer.d.BCAFlag != 0) PrintLog("CDVDlinuz DVD: BCA data present");
|
||||
|
||||
#endif /* VERBOSE_DISC_INFO */
|
||||
|
||||
|
||||
|
||||
boolresult = DeviceIoControl(devicehandle,
|
||||
|
||||
IOCTL_DVD_END_SESSION,
|
||||
|
||||
&sessionid,
|
||||
|
||||
sizeof(DVD_SESSION_ID),
|
||||
|
||||
NULL,
|
||||
|
||||
0,
|
||||
|
||||
&byteswritten,
|
||||
|
||||
&waitevent);
|
||||
|
||||
errcode = FinishCommand(boolresult);
|
||||
|
||||
if(errcode != 0) {
|
||||
|
||||
#ifdef VERBOSE_WARNING_DEVICE
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Couldn't end the session!");
|
||||
|
||||
PrintError("CDVDlinuz DVD", errcode);
|
||||
|
||||
#endif /* VERBOSE_WARNING_DEVICE */
|
||||
|
||||
} // ENDIF- Couldn't end the user session? Report it.
|
||||
|
||||
|
||||
|
||||
return(retval);
|
||||
|
||||
} // END DVDGetStructures()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
s32 DVDreadTrack(u32 lsn, int mode, u8 *buffer) {
|
||||
|
||||
LARGE_INTEGER targetpos;
|
||||
|
||||
DWORD byteswritten;
|
||||
|
||||
BOOL boolresult;
|
||||
|
||||
DWORD errcode;
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_DEVICE
|
||||
|
||||
PrintLog("CDVDlinuz DVD: DVDreadTrack(%lu)", lsn);
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_DEVICE */
|
||||
|
||||
|
||||
|
||||
targetpos.QuadPart = lsn * 2048;
|
||||
|
||||
waitevent.Offset = targetpos.LowPart;
|
||||
|
||||
waitevent.OffsetHigh = targetpos.HighPart;
|
||||
|
||||
|
||||
|
||||
boolresult = ReadFile(devicehandle,
|
||||
|
||||
buffer,
|
||||
|
||||
2048,
|
||||
|
||||
&byteswritten,
|
||||
|
||||
&waitevent);
|
||||
|
||||
errcode = FinishCommand(boolresult);
|
||||
|
||||
|
||||
|
||||
if(errcode != 0) {
|
||||
|
||||
#ifdef VERBOSE_WARNING_DEVICE
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Couldn't read sector!");
|
||||
|
||||
PrintError("CDVDlinuz DVD", errcode);
|
||||
|
||||
#endif /* VERBOSE_WARNING_DEVICE */
|
||||
|
||||
return(-1);
|
||||
|
||||
} // ENDIF- Trouble with the command? Report it.
|
||||
|
||||
|
||||
|
||||
if(boolresult == FALSE) {
|
||||
|
||||
boolresult = GetOverlappedResult(devicehandle,
|
||||
|
||||
&waitevent,
|
||||
|
||||
&byteswritten,
|
||||
|
||||
FALSE);
|
||||
|
||||
} // ENDIF- Did the initial call not complete? Get byteswritten for
|
||||
|
||||
// the completed call.
|
||||
|
||||
|
||||
|
||||
if(byteswritten < 2048) {
|
||||
|
||||
#ifdef VERBOSE_WARNING_DEVICE
|
||||
|
||||
errcode = GetLastError();
|
||||
|
||||
PrintLog("CDVDlinuz CD: Short block! only got %u out of %u bytes",
|
||||
|
||||
byteswritten, 2048);
|
||||
|
||||
PrintError("CDVDlinuz CD", errcode);
|
||||
|
||||
#endif /* VERBOSE_WARNING_DEVICE */
|
||||
|
||||
return(-1);
|
||||
|
||||
} // ENDIF- Didn't get enough bytes? Report and Abort!
|
||||
|
||||
|
||||
|
||||
return(0);
|
||||
|
||||
} // END DVDreadTrack()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
s32 DVDgetTN(cdvdTN *cdvdtn) {
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_DEVICE
|
||||
|
||||
PrintLog("CDVDlinuz DVD: DVDgetTN()");
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_DEVICE */
|
||||
|
||||
|
||||
|
||||
if(cdvdtn != NULL) {
|
||||
|
||||
cdvdtn->strack = 1;
|
||||
|
||||
cdvdtn->etrack = 1;
|
||||
|
||||
} // ENDIF- Does the user really want this data?
|
||||
|
||||
return(0);
|
||||
|
||||
} // END DVDgetTN()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
s32 DVDgetTD(u8 newtrack, cdvdTD *cdvdtd) {
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_DEVICE
|
||||
|
||||
PrintLog("CDVDlinuz DVD: DVDgetTD()");
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_DEVICE */
|
||||
|
||||
|
||||
|
||||
if((newtrack >= 2) && (newtrack != 0xAA)) return(-1); // Wrong track
|
||||
|
||||
|
||||
|
||||
if(cdvdtd != NULL) {
|
||||
|
||||
cdvdtd->type = 0;
|
||||
|
||||
cdvdtd->lsn = layer.d.EndDataSector - layer.d.StartingDataSector + 1;
|
||||
|
||||
} // ENDIF- Does the user really want this data?
|
||||
|
||||
return(0);
|
||||
|
||||
} // END DVDgetTD()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
s32 DVDgetDiskType() {
|
||||
|
||||
char playstationname[] = "PLAYSTATION\0";
|
||||
|
||||
int retval;
|
||||
|
||||
s32 tempdisctype;
|
||||
|
||||
char tempbuffer[2048];
|
||||
|
||||
int i;
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_DEVICE
|
||||
|
||||
PrintLog("CDVDlinuz DVD: DVDgetDiskType()");
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_DEVICE */
|
||||
|
||||
|
||||
|
||||
retval = DVDGetStructures();
|
||||
|
||||
if(retval < 0) return(-1); // Can't get DVD structures? Not a DVD then.
|
||||
|
||||
if(layer.d.EndDataSector == 0) return(-1); // Missing info? Abort.
|
||||
|
||||
|
||||
|
||||
retval = DVDreadTrack(16, CDVD_MODE_2048, tempbuffer);
|
||||
|
||||
if(retval < 0) {
|
||||
|
||||
return(-1);
|
||||
|
||||
} // ENDIF- Couldn't read the ISO9660 volume track? Fail.
|
||||
|
||||
|
||||
|
||||
tempdisctype = CDVD_TYPE_UNKNOWN;
|
||||
|
||||
if(layer.d.NumberOfLayers == 0) {
|
||||
|
||||
#ifdef VERBOSE_DISC_INFO
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Found Single-Sided DVD.");
|
||||
|
||||
#endif /* VERBOSE_DISC_INFO */
|
||||
|
||||
disctype = CDVD_TYPE_DETCTDVDS;
|
||||
|
||||
} else {
|
||||
|
||||
#ifdef VERBOSE_DISC_INFO
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Found Dual-Sided DVD.");
|
||||
|
||||
#endif /* VERBOSE_DISC_INFO */
|
||||
|
||||
disctype = CDVD_TYPE_DETCTDVDD;
|
||||
|
||||
} // ENDIF- Are we looking at a single layer DVD? (NumberOfLayers + 1)
|
||||
|
||||
|
||||
|
||||
i = 0;
|
||||
|
||||
while((playstationname[i] != 0) &&
|
||||
|
||||
(playstationname[i] == tempbuffer[8 + i])) i++;
|
||||
|
||||
if(playstationname[i] == 0) {
|
||||
|
||||
#ifdef VERBOSE_DISC_TYPE
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Found Playstation 2 DVD.");
|
||||
|
||||
#endif /* VERBOSE_DISC_TYPE */
|
||||
|
||||
tempdisctype = CDVD_TYPE_PS2DVD;
|
||||
|
||||
} else {
|
||||
|
||||
#ifdef VERBOSE_DISC_TYPE
|
||||
|
||||
PrintLog("CDVDlinuz DVD: Guessing it's a Video DVD.");
|
||||
|
||||
#endif /* VERBOSE_DISC_TYPE */
|
||||
|
||||
tempdisctype = CDVD_TYPE_DVDV;
|
||||
|
||||
} // ENDIF- Is this a playstation disc?
|
||||
|
||||
|
||||
|
||||
for(i = 0; i < 2048; i++) tocbuffer[i] = 0;
|
||||
|
||||
|
||||
|
||||
if(layer.d.NumberOfLayers == 0) {
|
||||
|
||||
tocbuffer[0] = 0x04;
|
||||
|
||||
tocbuffer[4] = 0x86;
|
||||
|
||||
tocbuffer[5] = 0x72;
|
||||
|
||||
} else {
|
||||
|
||||
tocbuffer[0] = 0x24;
|
||||
|
||||
tocbuffer[4] = 0x41;
|
||||
|
||||
tocbuffer[5] = 0x95;
|
||||
|
||||
} // ENDIF- Are we looking at a single layer DVD? (NumberOfLayers + 1)
|
||||
|
||||
|
||||
|
||||
tocbuffer[1] = 0x02;
|
||||
|
||||
tocbuffer[2] = 0xF2;
|
||||
|
||||
tocbuffer[3] = 0x00;
|
||||
|
||||
|
||||
|
||||
tocbuffer[16] = 0x00;
|
||||
|
||||
tocbuffer[17] = 0x03;
|
||||
|
||||
tocbuffer[18] = 0x00;
|
||||
|
||||
tocbuffer[19] = 0x00;
|
||||
|
||||
|
||||
|
||||
disctype = tempdisctype;
|
||||
|
||||
return(disctype);
|
||||
|
||||
} // END DVDgetDiskType()
|
||||
|
|
@ -1,74 +0,0 @@
|
|||
/* DVD.h
|
||||
|
||||
* Copyright (C) 2002-2005 PCSX2 Team
|
||||
|
||||
*
|
||||
|
||||
* 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 2 of the License, or
|
||||
|
||||
* (at your option) any later version.
|
||||
|
||||
*
|
||||
|
||||
* 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. See the
|
||||
|
||||
* GNU General Public License for more details.
|
||||
|
||||
*
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
|
||||
* along with this program; if not, write to the Free Software
|
||||
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef DVD_H
|
||||
|
||||
#define DVD_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define CDVDdefs
|
||||
|
||||
#include "PS2Edefs.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern void InitDVDInfo();
|
||||
|
||||
extern s32 DVDreadTrack(u32 lsn, int mode, u8 *buffer);
|
||||
|
||||
extern s32 DVDgetTN(cdvdTN *cdvdtn);
|
||||
|
||||
extern s32 DVDgetTD(u8 newtrack, cdvdTD *cdvdtd);
|
||||
|
||||
extern s32 DVDgetDiskType();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* DVD_H */
|
||||
|
|
@ -1,506 +0,0 @@
|
|||
/* actualfile.c
|
||||
|
||||
* Copyright (C) 2002-2005 PCSX2 Team
|
||||
|
||||
*
|
||||
|
||||
* 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 2 of the License, or
|
||||
|
||||
* (at your option) any later version.
|
||||
|
||||
*
|
||||
|
||||
* 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. See the
|
||||
|
||||
* GNU General Public License for more details.
|
||||
|
||||
*
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
|
||||
* along with this program; if not, write to the Free Software
|
||||
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
|
||||
#include <stddef.h> // NULL
|
||||
|
||||
|
||||
|
||||
#include "logfile.h"
|
||||
|
||||
#include "actualfile.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int IsActualFile(const char *filename) {
|
||||
|
||||
DWORD retval;
|
||||
|
||||
|
||||
|
||||
if(filename == NULL) return(-1);
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: IsActualFile(%s)", filename);
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
|
||||
|
||||
retval = GetFileAttributes(filename);
|
||||
|
||||
if(retval == INVALID_FILE_ATTRIBUTES) return(-1); // Name doesn't exist.
|
||||
|
||||
if((retval & FILE_ATTRIBUTE_DIRECTORY) != 0) return(-2);
|
||||
|
||||
|
||||
|
||||
return(0); // Yep, that's a file.
|
||||
|
||||
} // END IsActualFile()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void ActualFileDelete(const char *filename) {
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileDelete(%s)", filename);
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
|
||||
|
||||
DeleteFile(filename);
|
||||
|
||||
} // END ActualFileDelete()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void ActualFileRename(const char *origname, const char *newname) {
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileDelete(%s->%s)", origname, newname);
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
|
||||
|
||||
MoveFile(origname, newname);
|
||||
|
||||
return;
|
||||
|
||||
} // END ActualFileRename()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ACTUALHANDLE ActualFileOpenForRead(const char *filename) {
|
||||
|
||||
HANDLE newhandle;
|
||||
|
||||
|
||||
|
||||
if(filename == NULL) return(NULL);
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileOpenForRead(%s)", filename);
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
|
||||
|
||||
newhandle = CreateFile(filename,
|
||||
|
||||
GENERIC_READ,
|
||||
|
||||
FILE_SHARE_READ,
|
||||
|
||||
NULL,
|
||||
|
||||
OPEN_EXISTING,
|
||||
|
||||
FILE_FLAG_RANDOM_ACCESS,
|
||||
|
||||
NULL);
|
||||
|
||||
if(newhandle == INVALID_HANDLE_VALUE) {
|
||||
|
||||
#ifdef VERBOSE_WARNING_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: Error opening file %s", filename);
|
||||
|
||||
#endif /* VERBOSE_WARNING_ACTUALFILE */
|
||||
|
||||
return(NULL);
|
||||
|
||||
} // ENDIF- Error? Abort
|
||||
|
||||
|
||||
|
||||
return(newhandle);
|
||||
|
||||
} // END ActualFileOpenForRead()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
off64_t ActualFileSize(ACTUALHANDLE handle) {
|
||||
|
||||
int retval;
|
||||
|
||||
BY_HANDLE_FILE_INFORMATION info;
|
||||
|
||||
off64_t retsize;
|
||||
|
||||
|
||||
|
||||
if(handle == NULL) return(-1);
|
||||
|
||||
if(handle == INVALID_HANDLE_VALUE) return(-1);
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileSize()");
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
|
||||
|
||||
retval = GetFileInformationByHandle(handle, &info);
|
||||
|
||||
if(retval == 0) return(-1); // Handle doesn't exist...
|
||||
|
||||
|
||||
|
||||
retsize = info.nFileSizeHigh;
|
||||
|
||||
retsize *= 0x10000;
|
||||
|
||||
retsize *= 0x10000;
|
||||
|
||||
retsize += info.nFileSizeLow;
|
||||
|
||||
return(retsize);
|
||||
|
||||
} // END ActualFileSize()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int ActualFileSeek(ACTUALHANDLE handle, off64_t position) {
|
||||
|
||||
// int retval;
|
||||
|
||||
LARGE_INTEGER realpos;
|
||||
|
||||
DWORD errcode;
|
||||
|
||||
|
||||
|
||||
if(handle == NULL) return(-1);
|
||||
|
||||
if(handle == INVALID_HANDLE_VALUE) return(-1);
|
||||
|
||||
if(position < 0) return(-1);
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileSeek(%llu)", position);
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
|
||||
|
||||
realpos.QuadPart = position;
|
||||
|
||||
////// WinXP code for seek
|
||||
|
||||
// retval = SetFilePointerEx(handle,
|
||||
|
||||
// realpos,
|
||||
|
||||
// NULL,
|
||||
|
||||
// FILE_BEGIN);
|
||||
|
||||
// if(retval == 0) {
|
||||
|
||||
|
||||
|
||||
////// Win98 code for seek
|
||||
|
||||
realpos.LowPart = SetFilePointer(handle,
|
||||
|
||||
realpos.LowPart,
|
||||
|
||||
&realpos.HighPart,
|
||||
|
||||
FILE_BEGIN);
|
||||
|
||||
errcode = GetLastError();
|
||||
|
||||
if((realpos.LowPart == 0xFFFFFFFF) && (errcode != NO_ERROR)) {
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_WARNING_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: Error on seek (%llu)", position);
|
||||
|
||||
PrintError("CDVDiso file", errcode);
|
||||
|
||||
#endif /* VERBOSE_WARNING_ACTUALFILE */
|
||||
|
||||
return(-1);
|
||||
|
||||
} // ENDIF- Error? Abort
|
||||
|
||||
|
||||
|
||||
return(0);
|
||||
|
||||
} // END ActualFileSeek()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int ActualFileRead(ACTUALHANDLE handle, int bytes, char *buffer) {
|
||||
|
||||
int retval;
|
||||
|
||||
DWORD bytesread;
|
||||
|
||||
#ifdef VERBOSE_WARNING_ACTUALFILE
|
||||
|
||||
DWORD errcode;
|
||||
|
||||
#endif /* VERBOSE_WARNING_ACTUALFILE */
|
||||
|
||||
|
||||
|
||||
if(handle == NULL) return(-1);
|
||||
|
||||
if(handle == INVALID_HANDLE_VALUE) return(-1);
|
||||
|
||||
if(bytes < 1) return(-1);
|
||||
|
||||
if(buffer == NULL) return(-1);
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileRead(%i)", bytes);
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
|
||||
|
||||
retval = ReadFile(handle, buffer, bytes, &bytesread, NULL);
|
||||
|
||||
if(retval == 0) {
|
||||
|
||||
#ifdef VERBOSE_WARNING_ACTUALFILE
|
||||
|
||||
errcode = GetLastError();
|
||||
|
||||
PrintLog("CDVDiso file: Error reading from file");
|
||||
|
||||
PrintError("CDVDiso file", errcode);
|
||||
|
||||
#endif /* VERBOSE_WARNING_ACTUALFILE */
|
||||
|
||||
return(-1);
|
||||
|
||||
} // ENDIF- Error? Abort
|
||||
|
||||
if(bytesread < bytes) {
|
||||
|
||||
#ifdef VERBOSE_WARNING_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: Short Block! Only read %i out of %i bytes", bytesread, bytes);
|
||||
|
||||
#endif /* VERBOSE_WARNING_ACTUALFILE */
|
||||
|
||||
} // ENDIF- Error? Abort
|
||||
|
||||
|
||||
|
||||
return(bytesread); // Send back how many bytes read
|
||||
|
||||
} // END ActualFileRead()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void ActualFileClose(ACTUALHANDLE handle) {
|
||||
|
||||
if(handle == NULL) return;
|
||||
|
||||
if(handle == INVALID_HANDLE_VALUE) return;
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileClose()");
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
|
||||
|
||||
CloseHandle(handle);
|
||||
|
||||
return;
|
||||
|
||||
} // END ActualFileClose()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ACTUALHANDLE ActualFileOpenForWrite(const char *filename) {
|
||||
|
||||
HANDLE newhandle;
|
||||
|
||||
|
||||
|
||||
if(filename == NULL) return(NULL);
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileOpenForWrite(%s)", filename);
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
|
||||
|
||||
newhandle = CreateFile(filename,
|
||||
|
||||
GENERIC_WRITE,
|
||||
|
||||
0,
|
||||
|
||||
NULL,
|
||||
|
||||
CREATE_ALWAYS,
|
||||
|
||||
FILE_FLAG_SEQUENTIAL_SCAN,
|
||||
|
||||
NULL);
|
||||
|
||||
if(newhandle == INVALID_HANDLE_VALUE) {
|
||||
|
||||
#ifdef VERBOSE_WARNING_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: Error opening file %s", filename);
|
||||
|
||||
#endif /* VERBOSE_WARNING_ACTUALFILE */
|
||||
|
||||
return(NULL);
|
||||
|
||||
} // ENDIF- Error? Abort
|
||||
|
||||
|
||||
|
||||
return(newhandle);
|
||||
|
||||
} // END ActualFileOpenForWrite()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int ActualFileWrite(ACTUALHANDLE handle, int bytes, char *buffer) {
|
||||
|
||||
int retval;
|
||||
|
||||
DWORD byteswritten;
|
||||
|
||||
|
||||
|
||||
if(handle == NULL) return(-1);
|
||||
|
||||
if(handle == INVALID_HANDLE_VALUE) return(-1);
|
||||
|
||||
if(bytes < 1) return(-1);
|
||||
|
||||
if(buffer == NULL) return(-1);
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: ActualFileWrite(%i)", bytes);
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_ACTUALFILE */
|
||||
|
||||
|
||||
|
||||
retval = WriteFile(handle, buffer, bytes, &byteswritten, NULL);
|
||||
|
||||
if(retval == 0) {
|
||||
|
||||
#ifdef VERBOSE_WARNING_ACTUALFILE
|
||||
|
||||
PrintLog("CDVDiso file: Error writing to file!");
|
||||
|
||||
#endif /* VERBOSE_WARNING_ACTUALFILE */
|
||||
|
||||
// return(-1);
|
||||
|
||||
} // ENDIF- Error? Abort
|
||||
|
||||
|
||||
|
||||
return(byteswritten); // Send back how many bytes written
|
||||
|
||||
} // END ActualFileWrite()
|
||||
|
|
@ -1,104 +0,0 @@
|
|||
/* actualfile.h
|
||||
|
||||
* Copyright (C) 2002-2005 PCSX2 Team
|
||||
|
||||
*
|
||||
|
||||
* 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 2 of the License, or
|
||||
|
||||
* (at your option) any later version.
|
||||
|
||||
*
|
||||
|
||||
* 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. See the
|
||||
|
||||
* GNU General Public License for more details.
|
||||
|
||||
*
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
|
||||
* along with this program; if not, write to the Free Software
|
||||
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef ACTUALFILE_H
|
||||
|
||||
#define ACTUALFILE_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
|
||||
#include <sys/types.h> // off64_t
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define ACTUALHANDLE HANDLE
|
||||
|
||||
#define ACTUALHANDLENULL NULL
|
||||
|
||||
|
||||
|
||||
// #define VERBOSE_FUNCTION_ACTUALFILE
|
||||
|
||||
// #define VERBOSE_WARNING_ACTUALFILE
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern int IsActualFile(const char *filename);
|
||||
|
||||
extern void ActualFileDelete(const char *filename);
|
||||
|
||||
extern void ActualFileRename(const char *origname, const char *newname);
|
||||
|
||||
|
||||
|
||||
extern ACTUALHANDLE ActualFileOpenForRead(const char *filename);
|
||||
|
||||
extern off64_t ActualFileSize(ACTUALHANDLE handle);
|
||||
|
||||
extern int ActualFileSeek(ACTUALHANDLE handle, off64_t position);
|
||||
|
||||
extern int ActualFileRead(ACTUALHANDLE handle, int bytes, char *buffer);
|
||||
|
||||
extern void ActualFileClose(ACTUALHANDLE handle);
|
||||
|
||||
|
||||
|
||||
extern ACTUALHANDLE ActualFileOpenForWrite(const char *filename);
|
||||
|
||||
extern int ActualFileWrite(ACTUALHANDLE handle, int bytes, char *buffer);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* ACTUALFILE_H */
|
||||
|
|
@ -1,350 +0,0 @@
|
|||
/* conf.c
|
||||
|
||||
* Copyright (C) 2002-2005 PCSX2 Team
|
||||
|
||||
*
|
||||
|
||||
* 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 2 of the License, or
|
||||
|
||||
* (at your option) any later version.
|
||||
|
||||
*
|
||||
|
||||
* 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. See the
|
||||
|
||||
* GNU General Public License for more details.
|
||||
|
||||
*
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
|
||||
* along with this program; if not, write to the Free Software
|
||||
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <errno.h> // errno
|
||||
|
||||
#include <stddef.h> // NULL
|
||||
|
||||
#include <stdio.h> // sprintf()
|
||||
|
||||
#include <stdlib.h> // getenv()
|
||||
|
||||
#include <string.h> // strerror()
|
||||
|
||||
#include <sys/stat.h> // mkdir(), stat()
|
||||
|
||||
#include <sys/types.h> // mkdir(), stat(), fork()
|
||||
|
||||
#include <unistd.h> // stat(), fork(), execlp()
|
||||
|
||||
|
||||
|
||||
#include <windows.h> // CreateProcess()
|
||||
|
||||
|
||||
|
||||
// #define CDVDdefs
|
||||
|
||||
// #include "../PS2Edefs.h"
|
||||
|
||||
#include "../PS2Etypes.h" // u8
|
||||
|
||||
#include "logfile.h"
|
||||
|
||||
#include "../ini.h"
|
||||
|
||||
#include "conf.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const char *confnames[] = { "Device", NULL };
|
||||
|
||||
const u8 defaultdevice[] = DEFAULT_DEVICE;
|
||||
|
||||
const char defaulthome[] = "inis";
|
||||
|
||||
const char defaultdirectory[] = "HideMe.PS2E";
|
||||
|
||||
const char defaultfile[] = "CDVDlinuz.ini";
|
||||
|
||||
|
||||
|
||||
char confdirname[256];
|
||||
|
||||
char conffilename[256];
|
||||
|
||||
|
||||
|
||||
CDVDconf conf;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void InitConf() {
|
||||
|
||||
DWORD retval;
|
||||
|
||||
int i;
|
||||
|
||||
int pos;
|
||||
|
||||
char *envptr;
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_CONF
|
||||
|
||||
PrintLog("CDVD config: InitConf()");
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_CONF */
|
||||
|
||||
|
||||
|
||||
i = 0;
|
||||
|
||||
while((i < 255) && defaultdevice[i] != 0) {
|
||||
|
||||
conf.devicename[i] = defaultdevice[i];
|
||||
|
||||
i++;
|
||||
|
||||
} // ENDWHILE- copying the default CD/DVD name in
|
||||
|
||||
conf.devicename[i] = 0; // 0-terminate the device name
|
||||
|
||||
|
||||
|
||||
// Locating directory and file positions
|
||||
|
||||
pos = 0;
|
||||
|
||||
envptr = NULL;
|
||||
|
||||
// envptr = getenv("HOME");
|
||||
|
||||
if(envptr == NULL) {
|
||||
|
||||
// = <Default Home>
|
||||
|
||||
retval = GetCurrentDirectory(253, confdirname);
|
||||
|
||||
if(retval > 0) {
|
||||
|
||||
pos = retval;
|
||||
|
||||
} else {
|
||||
|
||||
pos = 2;
|
||||
|
||||
confdirname[0] = '.';
|
||||
|
||||
confdirname[1] = '\\';
|
||||
|
||||
} // ENDIF- Did we retrieve a directory reference?
|
||||
|
||||
|
||||
|
||||
i = 0;
|
||||
|
||||
while(i < pos) {
|
||||
|
||||
conffilename[i] = confdirname[i];
|
||||
|
||||
i++;
|
||||
|
||||
} // ENDWHILE- Copying dir info (so far) into file info
|
||||
|
||||
|
||||
|
||||
if(confdirname[pos-1] != '\\') {
|
||||
|
||||
confdirname[pos] = '\\';
|
||||
|
||||
conffilename[pos] = '\\';
|
||||
|
||||
pos++;
|
||||
|
||||
} // ENDIF- No directory separator here? Add one.
|
||||
|
||||
|
||||
|
||||
i = 0;
|
||||
|
||||
while((pos < 253) && (defaulthome[i] != 0)) {
|
||||
|
||||
confdirname[pos] = defaulthome[i];
|
||||
|
||||
conffilename[pos] = defaulthome[i];
|
||||
|
||||
pos++;
|
||||
|
||||
i++;
|
||||
|
||||
} // ENDWHILE- putting an offset where to store ini data
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
// = <Env Home>/<Default Directory>
|
||||
|
||||
i = 0;
|
||||
|
||||
while((pos < 253) && (*(envptr + i) != 0)) {
|
||||
|
||||
confdirname[pos] = *(envptr + i);
|
||||
|
||||
conffilename[pos] = *(envptr + i);
|
||||
|
||||
pos++;
|
||||
|
||||
i++;
|
||||
|
||||
} // ENDWHILE- copying home directory info in
|
||||
|
||||
|
||||
|
||||
if(confdirname[pos-1] != '\\') {
|
||||
|
||||
confdirname[pos] = '\\';
|
||||
|
||||
conffilename[pos] = '\\';
|
||||
|
||||
pos++;
|
||||
|
||||
} // ENDIF- No directory separator here? Add one.
|
||||
|
||||
|
||||
|
||||
i = 0;
|
||||
|
||||
while((pos < 253) && (defaultdirectory[i] != 0)) {
|
||||
|
||||
confdirname[pos] = defaultdirectory[i];
|
||||
|
||||
conffilename[pos] = defaultdirectory[i];
|
||||
|
||||
pos++;
|
||||
|
||||
i++;
|
||||
|
||||
} // NEXT- putting a default place to store configuration data
|
||||
|
||||
} // ENDIF- No Home directory?
|
||||
|
||||
|
||||
|
||||
confdirname[pos] = 0; // Directory reference finished
|
||||
|
||||
|
||||
|
||||
// += /<Config File Name>
|
||||
|
||||
if(conffilename[pos-1] != '\\') {
|
||||
|
||||
conffilename[pos] = '\\';
|
||||
|
||||
pos++;
|
||||
|
||||
} // ENDIF- No directory separator here? Add one.
|
||||
|
||||
|
||||
|
||||
i = 0;
|
||||
|
||||
while((pos < 253) && (defaultfile[i] != 0)) {
|
||||
|
||||
conffilename[pos] = defaultfile[i];
|
||||
|
||||
pos++;
|
||||
|
||||
i++;
|
||||
|
||||
} // NEXT- putting a default place to store configuration data
|
||||
|
||||
|
||||
|
||||
conffilename[pos] = 0; // File reference finished
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_CONF
|
||||
|
||||
PrintLog("CDVD config: Directory: %s", confdirname);
|
||||
|
||||
PrintLog("CDVD config: File: %s", conffilename);
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_CONF */
|
||||
|
||||
} // END InitConf()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void LoadConf() {
|
||||
|
||||
int retval;
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_CONF
|
||||
|
||||
PrintLog("CDVD config: LoadConf()");
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_CONF */
|
||||
|
||||
|
||||
|
||||
retval = INILoadString(conffilename, "Settings", "Device", conf.devicename);
|
||||
|
||||
if(retval < 0) {
|
||||
|
||||
sprintf(conf.devicename, "D:");
|
||||
|
||||
} // ENDIF- Couldn't find keyword? Fill in a default
|
||||
|
||||
} // END LoadConf()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void SaveConf() {
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_CONF
|
||||
|
||||
PrintLog("CDVD config: SaveConf()");
|
||||
|
||||
#endif /* VERBOSE_FUNCTION_CONF */
|
||||
|
||||
|
||||
|
||||
mkdir(confdirname);
|
||||
|
||||
|
||||
|
||||
INISaveString(conffilename, "Settings", "Device", conf.devicename);
|
||||
|
||||
} // END SaveConf()
|
||||
|
|
@ -1,98 +0,0 @@
|
|||
/* conf.h
|
||||
|
||||
* Copyright (C) 2002-2005 PCSX2 Team
|
||||
|
||||
*
|
||||
|
||||
* 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 2 of the License, or
|
||||
|
||||
* (at your option) any later version.
|
||||
|
||||
*
|
||||
|
||||
* 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. See the
|
||||
|
||||
* GNU General Public License for more details.
|
||||
|
||||
*
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
|
||||
* along with this program; if not, write to the Free Software
|
||||
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef CONF_H
|
||||
|
||||
#define CONF_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define CDVDdefs
|
||||
|
||||
#include "../PS2Edefs.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define VERBOSE_FUNCTION_CONF
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Configuration Data
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
|
||||
u8 devicename[256];
|
||||
|
||||
} CDVDconf;
|
||||
|
||||
extern CDVDconf conf;
|
||||
|
||||
|
||||
|
||||
#define DEFAULT_DEVICE "K:\\"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Configuration Functions
|
||||
|
||||
|
||||
|
||||
extern void InitConf();
|
||||
|
||||
extern void LoadConf();
|
||||
|
||||
extern void SaveConf();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* CONF_H */
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -1,128 +0,0 @@
|
|||
/* device.h
|
||||
|
||||
* Copyright (C) 2002-2005 PCSX2 Team
|
||||
|
||||
*
|
||||
|
||||
* 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 2 of the License, or
|
||||
|
||||
* (at your option) any later version.
|
||||
|
||||
*
|
||||
|
||||
* 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. See the
|
||||
|
||||
* GNU General Public License for more details.
|
||||
|
||||
*
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
|
||||
* along with this program; if not, write to the Free Software
|
||||
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef __DEVICE_H__
|
||||
|
||||
#define __DEVICE_H__
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <windows.h> // BOOL, DWORD
|
||||
|
||||
|
||||
|
||||
#include <time.h> // time_t
|
||||
|
||||
|
||||
|
||||
#define CDVDdefs
|
||||
|
||||
#include "../PS2Edefs.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// #define VERBOSE_FUNCTION_DEVICE
|
||||
|
||||
// #define VERBOSE_WARNING_DEVICE
|
||||
|
||||
#define VERBOSE_DISC_TYPE
|
||||
|
||||
#define VERBOSE_DISC_INFO
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern HANDLE devicehandle;
|
||||
|
||||
extern OVERLAPPED waitevent;
|
||||
|
||||
|
||||
|
||||
extern time_t lasttime;
|
||||
|
||||
extern s32 traystatus;
|
||||
|
||||
extern s32 disctype;
|
||||
|
||||
extern char tocbuffer[];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern void DeviceInit();
|
||||
|
||||
extern void InitDisc();
|
||||
|
||||
extern s32 DiscInserted();
|
||||
|
||||
extern DWORD FinishCommand(BOOL boolresult);
|
||||
|
||||
|
||||
|
||||
extern s32 DeviceOpen();
|
||||
|
||||
extern void DeviceClose();
|
||||
|
||||
extern s32 DeviceReadTrack(u32 lsn, int mode, u8 *buffer);
|
||||
|
||||
extern s32 DeviceBufferOffset();
|
||||
|
||||
extern s32 DeviceGetTD(u8 track, cdvdTD *cdvdtd);
|
||||
|
||||
extern s32 DeviceGetDiskType();
|
||||
|
||||
extern s32 DeviceTrayStatus();
|
||||
|
||||
extern s32 DeviceTrayOpen();
|
||||
|
||||
extern s32 DeviceTrayClose();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* __DEVICE_H__ */
|
||||
|
|
@ -1,238 +0,0 @@
|
|||
/* logfile.c
|
||||
|
||||
* Copyright (C) 2002-2005 PCSX2 Team
|
||||
|
||||
*
|
||||
|
||||
* 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 2 of the License, or
|
||||
|
||||
* (at your option) any later version.
|
||||
|
||||
*
|
||||
|
||||
* 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. See the
|
||||
|
||||
* GNU General Public License for more details.
|
||||
|
||||
*
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
|
||||
* along with this program; if not, write to the Free Software
|
||||
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
|
||||
// #include <fcntl.h> // open()
|
||||
|
||||
// #include <io.h> // mkdir()
|
||||
|
||||
#include <stddef.h> // NULL
|
||||
|
||||
#include <stdio.h> // vsprintf()
|
||||
|
||||
#include <stdarg.h> // va_start(), va_end(), vsprintf()
|
||||
|
||||
// #include <sys/stat.h> // open()
|
||||
|
||||
// #include <sys/types.h> // open()
|
||||
|
||||
|
||||
|
||||
#include "logfile.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
HANDLE logfile;
|
||||
|
||||
char logfiletemp[2048];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void InitLog() {
|
||||
|
||||
// Token comment line
|
||||
|
||||
#ifdef VERBOSE_LOGFILE
|
||||
|
||||
CreateDirectory("logs", NULL);
|
||||
|
||||
|
||||
|
||||
DeleteFile("logs\\CDVDlog.txt");
|
||||
|
||||
logfile = NULL;
|
||||
|
||||
#endif /* VERBOSE LOGFILE */
|
||||
|
||||
} // END InitLog();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int OpenLog() {
|
||||
|
||||
// Token comment line
|
||||
|
||||
#ifdef VERBOSE_LOGFILE
|
||||
|
||||
logfile = CreateFile("logs\\CDVDlog.txt",
|
||||
|
||||
GENERIC_WRITE,
|
||||
|
||||
0,
|
||||
|
||||
NULL,
|
||||
|
||||
CREATE_ALWAYS,
|
||||
|
||||
FILE_FLAG_SEQUENTIAL_SCAN,
|
||||
|
||||
NULL);
|
||||
|
||||
if(logfile == INVALID_HANDLE_VALUE) {
|
||||
|
||||
logfile = NULL;
|
||||
|
||||
return(-1);
|
||||
|
||||
} // ENDIF- Failed to open? Say so.
|
||||
|
||||
#endif /* VERBOSE LOGFILE */
|
||||
|
||||
|
||||
|
||||
return(0);
|
||||
|
||||
} // END OpenLog();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void CloseLog() {
|
||||
|
||||
// Token comment line
|
||||
|
||||
#ifdef VERBOSE_LOGFILE
|
||||
|
||||
if(logfile != NULL) {
|
||||
|
||||
CloseHandle(logfile);
|
||||
|
||||
logfile = NULL;
|
||||
|
||||
} // ENDIF- Is the log file actually open? Close it.
|
||||
|
||||
#endif /* VERBOSE LOGFILE */
|
||||
|
||||
} // END CloseLog()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void PrintLog(const char *fmt, ...) {
|
||||
|
||||
DWORD byteswritten;
|
||||
|
||||
|
||||
|
||||
// Token comment line
|
||||
|
||||
#ifdef VERBOSE_LOGFILE
|
||||
|
||||
va_list list;
|
||||
|
||||
int len;
|
||||
|
||||
|
||||
|
||||
if(logfile == NULL) return; // Log file not open... yet.
|
||||
|
||||
|
||||
|
||||
va_start(list, fmt);
|
||||
|
||||
vsprintf(logfiletemp, fmt, list);
|
||||
|
||||
va_end(list);
|
||||
|
||||
|
||||
|
||||
len = 0;
|
||||
|
||||
while((len < 2048) && (logfiletemp[len] != 0)) len++;
|
||||
|
||||
if((len > 0) && (logfiletemp[len-1] == '\n')) len--;
|
||||
|
||||
if((len > 0) && (logfiletemp[len-1] == '\r')) len--;
|
||||
|
||||
logfiletemp[len] = 0; // Slice off the last "\r\n"...
|
||||
|
||||
|
||||
|
||||
WriteFile(logfile, logfiletemp, len, &byteswritten, NULL);
|
||||
|
||||
WriteFile(logfile, "\r\n", 2, &byteswritten, NULL);
|
||||
|
||||
#endif /* VERBOSE LOGFILE */
|
||||
|
||||
} // END PrintLog()
|
||||
|
||||
|
||||
|
||||
void PrintError(const char *header, DWORD errcode) {
|
||||
|
||||
#ifdef VERBOSE_LOGFILE
|
||||
|
||||
TCHAR errmsg[256];
|
||||
|
||||
|
||||
|
||||
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | 80,
|
||||
|
||||
NULL,
|
||||
|
||||
errcode,
|
||||
|
||||
0,
|
||||
|
||||
errmsg,
|
||||
|
||||
256,
|
||||
|
||||
NULL);
|
||||
|
||||
PrintLog("%s: (%u) %s", header, errcode, errmsg);
|
||||
|
||||
#endif /* VERBOSE_WARNING_DEVICE */
|
||||
|
||||
} // END PrintError()
|
||||
|
|
@ -1,78 +0,0 @@
|
|||
/* logfile.h
|
||||
|
||||
* Copyright (C) 2002-2005 PCSX2 Team
|
||||
|
||||
*
|
||||
|
||||
* 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 2 of the License, or
|
||||
|
||||
* (at your option) any later version.
|
||||
|
||||
*
|
||||
|
||||
* 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. See the
|
||||
|
||||
* GNU General Public License for more details.
|
||||
|
||||
*
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
|
||||
* along with this program; if not, write to the Free Software
|
||||
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef LOGFILE_H
|
||||
|
||||
#define LOGFILE_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <windows.h> // Just for DWORD
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define VERBOSE_LOGFILE
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern void InitLog();
|
||||
|
||||
extern int OpenLog();
|
||||
|
||||
extern void CloseLog();
|
||||
|
||||
extern void PrintLog(const char *format, ...);
|
||||
|
||||
extern void PrintError(const char *header, DWORD errcode);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* LOGFILE_H */
|
||||
|
|
@ -1,346 +0,0 @@
|
|||
/* mainbox.c
|
||||
|
||||
* Copyright (C) 2002-2005 PCSX2 Team
|
||||
|
||||
*
|
||||
|
||||
* 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 2 of the License, or
|
||||
|
||||
* (at your option) any later version.
|
||||
|
||||
*
|
||||
|
||||
* 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. See the
|
||||
|
||||
* GNU General Public License for more details.
|
||||
|
||||
*
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
|
||||
* along with this program; if not, write to the Free Software
|
||||
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
// #include <windowsx.h> // Button_
|
||||
|
||||
#include <windef.h> // NULL
|
||||
|
||||
|
||||
|
||||
#include <stdio.h> // sprintf()
|
||||
|
||||
#include <string.h> // strcpy()
|
||||
|
||||
#include <sys/stat.h> // stat()
|
||||
|
||||
#include <sys/types.h> // stat()
|
||||
|
||||
#include <unistd.h> // stat()
|
||||
|
||||
|
||||
|
||||
#include "conf.h"
|
||||
|
||||
#include "device.h"
|
||||
|
||||
// #include "imagetype.h" // imagedata[].name
|
||||
|
||||
#include "screens.h" // DLG_, IDC_
|
||||
|
||||
#include "CDVDlinuz.h" // progmodule
|
||||
|
||||
#include "mainbox.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
HWND mainboxwindow;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void MainBoxDestroy() {
|
||||
|
||||
if(mainboxwindow != NULL) {
|
||||
|
||||
EndDialog(mainboxwindow, FALSE);
|
||||
|
||||
mainboxwindow = NULL;
|
||||
|
||||
} // ENDIF- Do we have a Main Window still?
|
||||
|
||||
} // END MainBoxDestroy()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void MainBoxUnfocus() {
|
||||
|
||||
// EnableWindow(?)
|
||||
|
||||
// gtk_widget_set_sensitive(mainbox.device, FALSE);
|
||||
|
||||
ShowWindow(mainboxwindow, SW_HIDE);
|
||||
|
||||
} // END MainBoxUnfocus()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void MainBoxDeviceEvent() {
|
||||
|
||||
char tempdevice[256];
|
||||
|
||||
struct stat filestat;
|
||||
|
||||
int returnval;
|
||||
|
||||
|
||||
|
||||
GetDlgItemText(mainboxwindow, IDC_0202, tempdevice, 256);
|
||||
|
||||
returnval = stat(tempdevice, &filestat);
|
||||
|
||||
if(returnval == -1) {
|
||||
|
||||
SetDlgItemText(mainboxwindow, IDC_0203, "Device Type: ---");
|
||||
|
||||
return;
|
||||
|
||||
} // ENDIF- Not a name of any sort?
|
||||
|
||||
|
||||
|
||||
if(S_ISDIR(filestat.st_mode) != 0) {
|
||||
|
||||
SetDlgItemText(mainboxwindow, IDC_0203, "Device Type: Not a device");
|
||||
|
||||
return;
|
||||
|
||||
} // ENDIF- Not a regular file?
|
||||
|
||||
|
||||
|
||||
SetDlgItemText(mainboxwindow, IDC_0203, "Device Type: Device Likely");
|
||||
|
||||
return;
|
||||
|
||||
} // END MainBoxFileEvent()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void MainBoxRefocus() {
|
||||
|
||||
MainBoxDeviceEvent();
|
||||
|
||||
|
||||
|
||||
// gtk_widget_set_sensitive(mainbox.device, TRUE);
|
||||
|
||||
// gtk_window_set_focus(GTK_WINDOW(mainbox.window), mainbox.device);
|
||||
|
||||
// ShowWindow(mainboxwindow, SW_RESTORE); // and/or, SW_SHOW? SW_SHOWNORMAL?
|
||||
|
||||
ShowWindow(mainboxwindow, SW_SHOW);
|
||||
|
||||
SetActiveWindow(mainboxwindow);
|
||||
|
||||
} // END MainBoxRefocus()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void MainBoxCancelEvent() {
|
||||
|
||||
MainBoxDestroy();
|
||||
|
||||
return;
|
||||
|
||||
} // END MainBoxCancelEvent()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void MainBoxOKEvent() {
|
||||
|
||||
int retval;
|
||||
|
||||
|
||||
|
||||
MainBoxUnfocus();
|
||||
|
||||
|
||||
|
||||
GetDlgItemText(mainboxwindow, IDC_0202, conf.devicename, 256);
|
||||
|
||||
retval = DeviceOpen();
|
||||
|
||||
DeviceClose();
|
||||
|
||||
if(retval != 0) {
|
||||
|
||||
MainBoxRefocus();
|
||||
|
||||
MessageBox(mainboxwindow,
|
||||
|
||||
"Could not open the device",
|
||||
|
||||
"CDVDlinuz Message",
|
||||
|
||||
MB_OK | MB_ICONWARNING | MB_SETFOREGROUND);
|
||||
|
||||
return;
|
||||
|
||||
} // ENDIF- Trouble opening device? Abort here.
|
||||
|
||||
|
||||
|
||||
SaveConf();
|
||||
|
||||
|
||||
|
||||
MainBoxCancelEvent();
|
||||
|
||||
return;
|
||||
|
||||
} // END MainBoxOKEvent()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void MainBoxDisplay() {
|
||||
|
||||
InitConf(); // Man, am I boiling mad! CDVDinit() should have been called first!
|
||||
|
||||
LoadConf();
|
||||
|
||||
|
||||
|
||||
// Adjust window position?
|
||||
|
||||
|
||||
|
||||
// We held off setting the name until now... so description would show.
|
||||
|
||||
SetDlgItemText(mainboxwindow, IDC_0202, conf.devicename);
|
||||
|
||||
|
||||
|
||||
// First Time - Show the window
|
||||
|
||||
ShowWindow(mainboxwindow, SW_SHOWNORMAL);
|
||||
|
||||
} // END MainBoxDisplay()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
BOOL CALLBACK MainBoxCallback(HWND window,
|
||||
|
||||
UINT msg,
|
||||
|
||||
WPARAM param,
|
||||
|
||||
LPARAM param2) {
|
||||
|
||||
switch(msg) {
|
||||
|
||||
case WM_INITDIALOG:
|
||||
|
||||
mainboxwindow = window;
|
||||
|
||||
MainBoxDisplay(); // In this case, final touches to this window.
|
||||
|
||||
return(FALSE); // And let Windows display this window.
|
||||
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case WM_CLOSE: // The "X" in the upper right corner was hit.
|
||||
|
||||
MainBoxCancelEvent();
|
||||
|
||||
return(TRUE);
|
||||
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case WM_COMMAND:
|
||||
|
||||
// Do we wish to capture 'ENTER/RETURN' and/or 'ESC' here?
|
||||
|
||||
|
||||
|
||||
switch(LOWORD(param)) {
|
||||
|
||||
case IDC_0202: // Devicename Edit Box
|
||||
|
||||
MainBoxDeviceEvent(); // Describe the File's type...
|
||||
|
||||
return(FALSE); // Let Windows handle the actual 'edit' processing...
|
||||
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case IDC_0204: // "Ok" Button
|
||||
|
||||
MainBoxOKEvent();
|
||||
|
||||
return(TRUE);
|
||||
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case IDC_0205: // "Cancel" Button
|
||||
|
||||
MainBoxCancelEvent();
|
||||
|
||||
return(TRUE);
|
||||
|
||||
break;
|
||||
|
||||
} // ENDSWITCH param- Which object got the message?
|
||||
|
||||
} // ENDSWITCH msg- what message has been sent to this window?
|
||||
|
||||
|
||||
|
||||
return(FALSE); // Not a recognized message? Tell Windows to handle it.
|
||||
|
||||
} // END MainBoxEventLoop()
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
/* mainbox.h
|
||||
|
||||
* Copyright (C) 2002-2005 PCSX2 Team
|
||||
|
||||
*
|
||||
|
||||
* 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 2 of the License, or
|
||||
|
||||
* (at your option) any later version.
|
||||
|
||||
*
|
||||
|
||||
* 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. See the
|
||||
|
||||
* GNU General Public License for more details.
|
||||
|
||||
*
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
|
||||
* along with this program; if not, write to the Free Software
|
||||
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef MAINBOX_H
|
||||
|
||||
#define MAINBOX_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <windows.h> // HWND
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern const char fileselection[];
|
||||
|
||||
|
||||
|
||||
extern HWND mainboxwindow;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern void MainBoxRefocus();
|
||||
|
||||
extern void MainBoxDisplay();
|
||||
|
||||
extern BOOL CALLBACK MainBoxCallback(HWND window,
|
||||
|
||||
UINT msg,
|
||||
|
||||
WPARAM param,
|
||||
|
||||
LPARAM param2);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* MAINBOX_H */
|
||||
|
|
@ -1 +0,0 @@
|
|||
mingw32-make -f Makefile.MinGW32 %1
|
|
@ -1,21 +0,0 @@
|
|||
EXPORTS
|
||||
PS2EgetLibType = PS2EgetLibType@0 @2
|
||||
PS2EgetLibName = PS2EgetLibName@0 @3
|
||||
PS2EgetLibVersion2 = PS2EgetLibVersion2@4 @4
|
||||
CDVDinit = CDVDinit@0 @5
|
||||
CDVDshutdown = CDVDshutdown@0 @6
|
||||
CDVDopen = CDVDopen@0 @7
|
||||
CDVDclose = CDVDclose@0 @8
|
||||
CDVDreadTrack = CDVDreadTrack@8 @9
|
||||
CDVDgetBuffer = CDVDgetBuffer@0 @10
|
||||
CDVDreadSubQ = CDVDreadSubQ@8 @11
|
||||
CDVDgetTN = CDVDgetTN@4 @12
|
||||
CDVDgetTD = CDVDgetTD@8 @13
|
||||
CDVDgetTOC = CDVDgetTOC@4 @14
|
||||
CDVDgetDiskType = CDVDgetDiskType@0 @15
|
||||
CDVDgetTrayStatus = CDVDgetTrayStatus@0 @16
|
||||
CDVDctrlTrayOpen = CDVDctrlTrayOpen@0 @17
|
||||
CDVDctrlTrayClose = CDVDctrlTrayClose@0 @18
|
||||
CDVDconfigure = CDVDconfigure@0 @19
|
||||
CDVDtest = CDVDtest@0 @20
|
||||
CDVDabout = CDVDabout@0 @21
|
|
@ -1,18 +0,0 @@
|
|||
/* Weditres generated include file. Do NOT edit */
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#define DLG_0100 100
|
||||
|
||||
#define IDC_0104 104
|
||||
|
||||
#define DLG_0200 200
|
||||
|
||||
#define IDC_0202 202
|
||||
|
||||
#define IDC_0203 203
|
||||
|
||||
#define IDC_0204 204
|
||||
|
||||
#define IDC_0205 205
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
/* Wedit generated resource file */
|
||||
#ifdef __LCC__
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include "screens.h"
|
||||
|
||||
|
||||
DLG_0100 DIALOG 2, 2, 140, 59
|
||||
STYLE DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "About CDVDlinuz"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
CTEXT "EFP polling CDVD Driver v0.4", 101, 11, 6, 118, 12
|
||||
CTEXT "Current Author: efp", 102, 12, 16, 118, 12
|
||||
CTEXT "Original code by: linuzappz && shadow", 103, 12, 26, 118, 12
|
||||
PUSHBUTTON "Ok", IDC_0104, 50, 37, 40, 14
|
||||
END
|
||||
|
||||
DLG_0200 DIALOG 4, 2, 241, 50
|
||||
STYLE WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "CDVDlinuz Configuration"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
LTEXT "CD/DVD device:", 201, 14, 8, 59, 12
|
||||
EDITTEXT IDC_0202, 71, 7, 164, 12, ES_AUTOHSCROLL
|
||||
CTEXT "Device Type: ---", IDC_0203, 10, 21, 220, 12
|
||||
PUSHBUTTON "Ok", IDC_0204, 15, 31, 48, 14
|
||||
PUSHBUTTON "Cancel", IDC_0205, 177, 31, 48, 14
|
||||
END
|
File diff suppressed because it is too large
Load Diff
|
@ -1,134 +0,0 @@
|
|||
/* buffer.h
|
||||
|
||||
* Copyright (C) 2002-2005 CDVDlinuz Team
|
||||
|
||||
*
|
||||
|
||||
* 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 2 of the License, or
|
||||
|
||||
* (at your option) any later version.
|
||||
|
||||
*
|
||||
|
||||
* 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. See the
|
||||
|
||||
* GNU General Public License for more details.
|
||||
|
||||
*
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
|
||||
* along with this program; if not, write to the Free Software
|
||||
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef __BUFFER_H__
|
||||
|
||||
#define __BUFFER_H__
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define CDVDdefs
|
||||
|
||||
#include "PS2Edefs.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// #define VERBOSE_FUNCTION_BUFFER
|
||||
|
||||
// #define VERBOSE_WARNINGS_BUFFER
|
||||
|
||||
|
||||
|
||||
// Remember, each buffer set is about 5k (packed. might be 4x that in-memory)
|
||||
|
||||
// Minimum: 16 Maximum: 32760
|
||||
|
||||
#define BUFFERMAX 256
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Buffer Structures
|
||||
|
||||
|
||||
|
||||
struct BufferList {
|
||||
|
||||
u16 upsort; // Don't alter this variable
|
||||
|
||||
u16 uppos; // Don't alter this variable
|
||||
|
||||
|
||||
|
||||
u32 lsn;
|
||||
|
||||
int mode; // -1 means error
|
||||
|
||||
u8 buffer[2368];
|
||||
|
||||
u8 offset;
|
||||
|
||||
cdvdSubQ subq;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Exported Variables
|
||||
|
||||
|
||||
|
||||
extern struct BufferList bufferlist[];
|
||||
|
||||
extern u16 userbuffer;
|
||||
|
||||
extern u16 replacebuffer;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Exported Functions
|
||||
|
||||
|
||||
|
||||
extern void InitBuffer();
|
||||
|
||||
extern u16 FindListBuffer(u32 lsn);
|
||||
|
||||
extern void RemoveListBuffer(u16 oldbuffer);
|
||||
|
||||
extern void AddListBuffer(u16 newbuffer);
|
||||
|
||||
#ifdef VERBOSE_WARNINGS_BUFFER
|
||||
|
||||
extern void PrintSortBuffers();
|
||||
|
||||
#endif /* VERBOSE_WARNINGS_BUFFER */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* __BUFFER_H__ */
|
||||
|
|
@ -1,236 +0,0 @@
|
|||
/* convert.c
|
||||
|
||||
* Copyright (C) 2002-2005 PCSX2 Team
|
||||
|
||||
*
|
||||
|
||||
* 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 2 of the License, or
|
||||
|
||||
* (at your option) any later version.
|
||||
|
||||
*
|
||||
|
||||
* 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. See the
|
||||
|
||||
* GNU General Public License for more details.
|
||||
|
||||
*
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
|
||||
* along with this program; if not, write to the Free Software
|
||||
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
|
||||
#include "convert.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
off64_t ConvertEndianOffset(off64_t number) {
|
||||
|
||||
#ifndef CONVERTLITTLEENDIAN
|
||||
|
||||
union {
|
||||
|
||||
off64_t n;
|
||||
|
||||
char c[sizeof(off64_t)];
|
||||
|
||||
} oldnumber, newnumber;
|
||||
|
||||
int i;
|
||||
|
||||
|
||||
|
||||
oldnumber.n = number;
|
||||
|
||||
for(i = 0; i < sizeof(off64_t); i++)
|
||||
|
||||
newnumber.c[i] = oldnumber.c[sizeof(off64_t) - 1 - i];
|
||||
|
||||
return(newnumber.n);
|
||||
|
||||
#else
|
||||
|
||||
return(number);
|
||||
|
||||
#endif /* CONVERTLITTLEENDIAN */
|
||||
|
||||
} // END ConvertEndianOffset()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
unsigned int ConvertEndianUInt(unsigned int number) {
|
||||
|
||||
#ifndef CONVERTLITTLEENDIAN
|
||||
|
||||
union {
|
||||
|
||||
unsigned int n;
|
||||
|
||||
char c[sizeof(unsigned int)];
|
||||
|
||||
} oldnumber, newnumber;
|
||||
|
||||
int i;
|
||||
|
||||
|
||||
|
||||
oldnumber.n = number;
|
||||
|
||||
for(i = 0; i < sizeof(unsigned int); i++)
|
||||
|
||||
newnumber.c[i] = oldnumber.c[sizeof(unsigned int) - 1 - i];
|
||||
|
||||
return(newnumber.n);
|
||||
|
||||
#else
|
||||
|
||||
return(number);
|
||||
|
||||
#endif /* CONVERTLITTLEENDIAN */
|
||||
|
||||
} // END ConvertEndianUInt()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
unsigned short ConvertEndianUShort(unsigned short number) {
|
||||
|
||||
#ifndef CONVERTLITTLEENDIAN
|
||||
|
||||
union {
|
||||
|
||||
unsigned short n;
|
||||
|
||||
char c[sizeof(unsigned short)];
|
||||
|
||||
} oldnumber, newnumber;
|
||||
|
||||
int i;
|
||||
|
||||
|
||||
|
||||
oldnumber.n = number;
|
||||
|
||||
for(i = 0; i < sizeof(unsigned short); i++)
|
||||
|
||||
newnumber.c[i] = oldnumber.c[sizeof(unsigned short) - 1 - i];
|
||||
|
||||
return(newnumber.n);
|
||||
|
||||
#else
|
||||
|
||||
return(number);
|
||||
|
||||
#endif /* CONVERTLITTLEENDIAN */
|
||||
|
||||
} // END ConvertEndianUShort()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Note: deposits M/S/F data in buffer[0]/[1]/[2] respectively.
|
||||
|
||||
void LBAtoMSF(unsigned long lsn, char *buffer) {
|
||||
|
||||
unsigned long templsn;
|
||||
|
||||
|
||||
|
||||
if(lsn >= 0xFFFFFFFF - 150) {
|
||||
|
||||
*(buffer + 2) = 75-1;
|
||||
|
||||
*(buffer + 1) = 60-1;
|
||||
|
||||
*(buffer) = 100-1;
|
||||
|
||||
} // ENDIF- Out of range?
|
||||
|
||||
|
||||
|
||||
templsn = lsn;
|
||||
|
||||
templsn += 150; // 2 second offset (75 Frames * 2 Seconds)
|
||||
|
||||
*(buffer + 2) = templsn % 75; // Remainder in frames
|
||||
|
||||
templsn -= *(buffer + 2);
|
||||
|
||||
templsn /= 75;
|
||||
|
||||
*(buffer + 1) = templsn % 60; // Remainder in seconds
|
||||
|
||||
templsn -= *(buffer + 1);
|
||||
|
||||
templsn /= 60;
|
||||
|
||||
*(buffer) = templsn; // Leftover quotient in minutes
|
||||
|
||||
} // END LBAtoMSF()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
unsigned long MSFtoLBA(char *buffer) {
|
||||
|
||||
unsigned long templsn;
|
||||
|
||||
|
||||
|
||||
if(buffer == NULL) return(0xFFFFFFFF);
|
||||
|
||||
|
||||
|
||||
templsn = *(buffer); // Minutes
|
||||
|
||||
templsn *= 60;
|
||||
|
||||
templsn += *(buffer + 1); // Seconds
|
||||
|
||||
templsn *= 75;
|
||||
|
||||
templsn += *(buffer + 2); // Frames
|
||||
|
||||
if(templsn < 150) return(0xFFFFFFFF);
|
||||
|
||||
templsn -= 150; // Offset
|
||||
|
||||
|
||||
|
||||
return(templsn);
|
||||
|
||||
} // END MSFtoLBA()
|
||||
|
|
@ -1,100 +0,0 @@
|
|||
/* convert.h
|
||||
|
||||
* Copyright (C) 2002-2005 PCSX2 Team
|
||||
|
||||
*
|
||||
|
||||
* 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 2 of the License, or
|
||||
|
||||
* (at your option) any later version.
|
||||
|
||||
*
|
||||
|
||||
* 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. See the
|
||||
|
||||
* GNU General Public License for more details.
|
||||
|
||||
*
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
|
||||
* along with this program; if not, write to the Free Software
|
||||
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef CONVERT_H
|
||||
|
||||
#define CONVERT_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include <sys/types.h> // off64_t
|
||||
|
||||
|
||||
|
||||
#ifdef __linux__
|
||||
|
||||
#include "endian.h"
|
||||
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
|
||||
#define CONVERTLITTLEENDIAN
|
||||
|
||||
#endif /* __BYTE_ORDER */
|
||||
|
||||
#endif /* __linux__ */
|
||||
|
||||
|
||||
|
||||
#ifdef __WIN32__
|
||||
|
||||
#define CONVERTLITTLEENDIAN
|
||||
|
||||
#endif /* __WIN32__ */
|
||||
|
||||
|
||||
|
||||
#define HEXTOBCD(i) (((i)/10*16) + ((i)%10))
|
||||
|
||||
#define BCDTOHEX(i) (((i)/16*10) + ((i)%16))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern off64_t ConvertEndianOffset(off64_t number);
|
||||
|
||||
extern unsigned int ConvertEndianUInt(unsigned int number);
|
||||
|
||||
extern unsigned short ConvertEndianUShort(unsigned short number);
|
||||
|
||||
|
||||
|
||||
extern void LBAtoMSF(unsigned long lsn, char *buffer);
|
||||
|
||||
extern unsigned long MSFtoLBA(char *buffer);
|
||||
|
||||
|
||||
|
||||
#endif /* CONVERT_H */
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -1,116 +0,0 @@
|
|||
/* ini.h
|
||||
|
||||
* Copyright (C) 2002-2005 PCSX2 Team
|
||||
|
||||
*
|
||||
|
||||
* 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 2 of the License, or
|
||||
|
||||
* (at your option) any later version.
|
||||
|
||||
*
|
||||
|
||||
* 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. See the
|
||||
|
||||
* GNU General Public License for more details.
|
||||
|
||||
*
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
|
||||
* along with this program; if not, write to the Free Software
|
||||
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef INI_H
|
||||
|
||||
#define INI_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// #define CDVDdefs
|
||||
|
||||
// #include "PS2Edefs.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// File format:
|
||||
|
||||
// [section]
|
||||
|
||||
// keyword=value
|
||||
|
||||
|
||||
|
||||
// file - Name of the INI file
|
||||
|
||||
// section - Section within the file
|
||||
|
||||
// keyword - Identifier for a value
|
||||
|
||||
// value - value to store with a keyword in a section in the file
|
||||
|
||||
// buffer - place to retrieve the value of a keyword
|
||||
|
||||
|
||||
|
||||
// return values: 0 = success, -1 = failure
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// #define VERBOSE_FUNCTION_INI
|
||||
|
||||
|
||||
|
||||
#define INIMAXLEN 255
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern int INISaveString(char *file, char *section, char *keyword, char *value);
|
||||
|
||||
extern int INILoadString(char *file, char *section, char *keyword, char *buffer);
|
||||
|
||||
|
||||
|
||||
extern int INISaveUInt(char *file, char *section, char *keyword, unsigned int value);
|
||||
|
||||
extern int INILoadUInt(char *file, char *section, char *keyword, unsigned int *buffer);
|
||||
|
||||
|
||||
|
||||
// NULL in the keyword below removes the whole section.
|
||||
|
||||
extern int INIRemove(char *file, char *section, char *keyword);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* INI_H */
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
/* version.c
|
||||
|
||||
* Copyright (C) 2002-2005 PCSX2 Team
|
||||
|
||||
*
|
||||
|
||||
* 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 2 of the License, or
|
||||
|
||||
* (at your option) any later version.
|
||||
|
||||
*
|
||||
|
||||
* 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. See the
|
||||
|
||||
* GNU General Public License for more details.
|
||||
|
||||
*
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
|
||||
* along with this program; if not, write to the Free Software
|
||||
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define CDVDdefs
|
||||
|
||||
#include "PS2Edefs.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
char *libname = "EFP polling CDVD Driver";
|
||||
|
||||
|
||||
|
||||
const unsigned char version = PS2E_CDVD_VERSION;
|
||||
|
||||
const unsigned char revision = 0;
|
||||
|
||||
const unsigned char build = 4;
|
||||
|
|
@ -1,74 +0,0 @@
|
|||
/* version.h
|
||||
|
||||
* Copyright (C) 2002-2005 PCSX2 Team
|
||||
|
||||
*
|
||||
|
||||
* 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 2 of the License, or
|
||||
|
||||
* (at your option) any later version.
|
||||
|
||||
*
|
||||
|
||||
* 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. See the
|
||||
|
||||
* GNU General Public License for more details.
|
||||
|
||||
*
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
|
||||
* along with this program; if not, write to the Free Software
|
||||
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
*
|
||||
|
||||
* PCSX2 members can be contacted through their website at www.pcsx2.net.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef VERSION_H
|
||||
|
||||
#define VERSION_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define CDVDdefs
|
||||
|
||||
#include "PS2Edefs.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
extern char *libname;
|
||||
|
||||
|
||||
|
||||
extern const unsigned char version;
|
||||
|
||||
extern const unsigned char revision;
|
||||
|
||||
extern const unsigned char build;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* VERSION_H */
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
curdir=`pwd`
|
||||
|
||||
echo ------------------
|
||||
echo Building CDVDlinuz
|
||||
echo ------------------
|
||||
|
||||
cd ${curdir}/Src/Linux
|
||||
make $@
|
||||
|
||||
if [ -s cfgCDVDlinuz ] && [ -s libCDVDlinuz.so ]
|
||||
then
|
||||
# copy the files
|
||||
cp cfgCDVDlinuz libCDVDlinuz.so ${PCSX2PLUGINS}
|
||||
fi
|
|
@ -1,37 +0,0 @@
|
|||
CDVDlinuz v0.4
|
||||
--------------
|
||||
|
||||
This is an extension to use with play station2 emulators
|
||||
as PCSX2 (only one right now).
|
||||
The plugin is free open source code.
|
||||
|
||||
Modified by efp to work with DVDs as well
|
||||
|
||||
To install in Windows:
|
||||
-----
|
||||
Place the file "CDVDlinuz.dll" in the "plugins" directory.
|
||||
|
||||
To install in Linux:
|
||||
-----
|
||||
Place the file "libCDVDlinuz.so" in the "plugins/" directory.
|
||||
Place the file "cfgCDVDlinuz" in the "cfg/" directory.
|
||||
|
||||
To activate in PCSX2:
|
||||
-----
|
||||
Start up PCSX2.
|
||||
Select "Configuration", then "Plugins and Bios".
|
||||
In the "Cdvdrom" pull-down menu, you should see:
|
||||
"EFP polling CDVD Driver v.04"
|
||||
Select it.
|
||||
Then press the "Configure" button under it.
|
||||
In the "CDVDlinuz Configuration" screen, type in where your CD or DVD
|
||||
device can be found.
|
||||
(In Linux, devices look like "/dev/<device>")
|
||||
(In Windows, devices look like "D:". There are other types of references to
|
||||
devices, but they haven't been tested.)
|
||||
Press to "OK" button to save your selection.
|
||||
Finally, put a CD or DVD in the selected drive, and run PCSX2.
|
||||
|
||||
Keep in mind the above instructions only cover the "CD/DVD" portion of
|
||||
PCSX2. All configuration options must be attended to before PCSX2 could run
|
||||
correctly.
|
|
@ -10,10 +10,6 @@ if(EXISTS "${CMAKE_SOURCE_DIR}/plugins/cdvdGigaherz" AND cdvdGigaherz)
|
|||
add_subdirectory(cdvdGigaherz/src)
|
||||
endif()
|
||||
|
||||
if(EXISTS "${CMAKE_SOURCE_DIR}/plugins/CDVDlinuz" AND CDVDlinuz)
|
||||
add_subdirectory(CDVDlinuz/Src)
|
||||
endif()
|
||||
|
||||
if(EXISTS "${CMAKE_SOURCE_DIR}/plugins/CDVDnull" AND CDVDnull)
|
||||
add_subdirectory(CDVDnull)
|
||||
endif()
|
||||
|
|
Loading…
Reference in New Issue