mirror of https://github.com/PCSX2/pcsx2.git
Merge pull request #1791 from turtleli/remove-old-cdvd
Remove old cdvd plugins
This commit is contained in:
commit
9393b20e13
|
@ -1,327 +0,0 @@
|
|||
------------------------------------------------------------------
|
||||
This file is part of bzip2/libbzip2, a program and library for
|
||||
lossless, block-sorting data compression.
|
||||
|
||||
bzip2/libbzip2 version 1.0.6 of 6 September 2010
|
||||
Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
|
||||
|
||||
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||
README file.
|
||||
|
||||
This program is released under the terms of the license contained
|
||||
in the file LICENSE.
|
||||
------------------------------------------------------------------
|
||||
|
||||
|
||||
0.9.0
|
||||
~~~~~
|
||||
First version.
|
||||
|
||||
|
||||
0.9.0a
|
||||
~~~~~~
|
||||
Removed 'ranlib' from Makefile, since most modern Unix-es
|
||||
don't need it, or even know about it.
|
||||
|
||||
|
||||
0.9.0b
|
||||
~~~~~~
|
||||
Fixed a problem with error reporting in bzip2.c. This does not effect
|
||||
the library in any way. Problem is: versions 0.9.0 and 0.9.0a (of the
|
||||
program proper) compress and decompress correctly, but give misleading
|
||||
error messages (internal panics) when an I/O error occurs, instead of
|
||||
reporting the problem correctly. This shouldn't give any data loss
|
||||
(as far as I can see), but is confusing.
|
||||
|
||||
Made the inline declarations disappear for non-GCC compilers.
|
||||
|
||||
|
||||
0.9.0c
|
||||
~~~~~~
|
||||
Fixed some problems in the library pertaining to some boundary cases.
|
||||
This makes the library behave more correctly in those situations. The
|
||||
fixes apply only to features (calls and parameters) not used by
|
||||
bzip2.c, so the non-fixedness of them in previous versions has no
|
||||
effect on reliability of bzip2.c.
|
||||
|
||||
In bzlib.c:
|
||||
* made zero-length BZ_FLUSH work correctly in bzCompress().
|
||||
* fixed bzWrite/bzRead to ignore zero-length requests.
|
||||
* fixed bzread to correctly handle read requests after EOF.
|
||||
* wrong parameter order in call to bzDecompressInit in
|
||||
bzBuffToBuffDecompress. Fixed.
|
||||
|
||||
In compress.c:
|
||||
* changed setting of nGroups in sendMTFValues() so as to
|
||||
do a bit better on small files. This _does_ effect
|
||||
bzip2.c.
|
||||
|
||||
|
||||
0.9.5a
|
||||
~~~~~~
|
||||
Major change: add a fallback sorting algorithm (blocksort.c)
|
||||
to give reasonable behaviour even for very repetitive inputs.
|
||||
Nuked --repetitive-best and --repetitive-fast since they are
|
||||
no longer useful.
|
||||
|
||||
Minor changes: mostly a whole bunch of small changes/
|
||||
bugfixes in the driver (bzip2.c). Changes pertaining to the
|
||||
user interface are:
|
||||
|
||||
allow decompression of symlink'd files to stdout
|
||||
decompress/test files even without .bz2 extension
|
||||
give more accurate error messages for I/O errors
|
||||
when compressing/decompressing to stdout, don't catch control-C
|
||||
read flags from BZIP2 and BZIP environment variables
|
||||
decline to break hard links to a file unless forced with -f
|
||||
allow -c flag even with no filenames
|
||||
preserve file ownerships as far as possible
|
||||
make -s -1 give the expected block size (100k)
|
||||
add a flag -q --quiet to suppress nonessential warnings
|
||||
stop decoding flags after --, so files beginning in - can be handled
|
||||
resolved inconsistent naming: bzcat or bz2cat ?
|
||||
bzip2 --help now returns 0
|
||||
|
||||
Programming-level changes are:
|
||||
|
||||
fixed syntax error in GET_LL4 for Borland C++ 5.02
|
||||
let bzBuffToBuffDecompress return BZ_DATA_ERROR{_MAGIC}
|
||||
fix overshoot of mode-string end in bzopen_or_bzdopen
|
||||
wrapped bzlib.h in #ifdef __cplusplus ... extern "C" { ... }
|
||||
close file handles under all error conditions
|
||||
added minor mods so it compiles with DJGPP out of the box
|
||||
fixed Makefile so it doesn't give problems with BSD make
|
||||
fix uninitialised memory reads in dlltest.c
|
||||
|
||||
0.9.5b
|
||||
~~~~~~
|
||||
Open stdin/stdout in binary mode for DJGPP.
|
||||
|
||||
0.9.5c
|
||||
~~~~~~
|
||||
Changed BZ_N_OVERSHOOT to be ... + 2 instead of ... + 1. The + 1
|
||||
version could cause the sorted order to be wrong in some extremely
|
||||
obscure cases. Also changed setting of quadrant in blocksort.c.
|
||||
|
||||
0.9.5d
|
||||
~~~~~~
|
||||
The only functional change is to make bzlibVersion() in the library
|
||||
return the correct string. This has no effect whatsoever on the
|
||||
functioning of the bzip2 program or library. Added a couple of casts
|
||||
so the library compiles without warnings at level 3 in MS Visual
|
||||
Studio 6.0. Included a Y2K statement in the file Y2K_INFO. All other
|
||||
changes are minor documentation changes.
|
||||
|
||||
1.0
|
||||
~~~
|
||||
Several minor bugfixes and enhancements:
|
||||
|
||||
* Large file support. The library uses 64-bit counters to
|
||||
count the volume of data passing through it. bzip2.c
|
||||
is now compiled with -D_FILE_OFFSET_BITS=64 to get large
|
||||
file support from the C library. -v correctly prints out
|
||||
file sizes greater than 4 gigabytes. All these changes have
|
||||
been made without assuming a 64-bit platform or a C compiler
|
||||
which supports 64-bit ints, so, except for the C library
|
||||
aspect, they are fully portable.
|
||||
|
||||
* Decompression robustness. The library/program should be
|
||||
robust to any corruption of compressed data, detecting and
|
||||
handling _all_ corruption, instead of merely relying on
|
||||
the CRCs. What this means is that the program should
|
||||
never crash, given corrupted data, and the library should
|
||||
always return BZ_DATA_ERROR.
|
||||
|
||||
* Fixed an obscure race-condition bug only ever observed on
|
||||
Solaris, in which, if you were very unlucky and issued
|
||||
control-C at exactly the wrong time, both input and output
|
||||
files would be deleted.
|
||||
|
||||
* Don't run out of file handles on test/decompression when
|
||||
large numbers of files have invalid magic numbers.
|
||||
|
||||
* Avoid library namespace pollution. Prefix all exported
|
||||
symbols with BZ2_.
|
||||
|
||||
* Minor sorting enhancements from my DCC2000 paper.
|
||||
|
||||
* Advance the version number to 1.0, so as to counteract the
|
||||
(false-in-this-case) impression some people have that programs
|
||||
with version numbers less than 1.0 are in some way, experimental,
|
||||
pre-release versions.
|
||||
|
||||
* Create an initial Makefile-libbz2_so to build a shared library.
|
||||
Yes, I know I should really use libtool et al ...
|
||||
|
||||
* Make the program exit with 2 instead of 0 when decompression
|
||||
fails due to a bad magic number (ie, an invalid bzip2 header).
|
||||
Also exit with 1 (as the manual claims :-) whenever a diagnostic
|
||||
message would have been printed AND the corresponding operation
|
||||
is aborted, for example
|
||||
bzip2: Output file xx already exists.
|
||||
When a diagnostic message is printed but the operation is not
|
||||
aborted, for example
|
||||
bzip2: Can't guess original name for wurble -- using wurble.out
|
||||
then the exit value 0 is returned, unless some other problem is
|
||||
also detected.
|
||||
|
||||
I think it corresponds more closely to what the manual claims now.
|
||||
|
||||
|
||||
1.0.1
|
||||
~~~~~
|
||||
* Modified dlltest.c so it uses the new BZ2_ naming scheme.
|
||||
* Modified makefile-msc to fix minor build probs on Win2k.
|
||||
* Updated README.COMPILATION.PROBLEMS.
|
||||
|
||||
There are no functionality changes or bug fixes relative to version
|
||||
1.0.0. This is just a documentation update + a fix for minor Win32
|
||||
build problems. For almost everyone, upgrading from 1.0.0 to 1.0.1 is
|
||||
utterly pointless. Don't bother.
|
||||
|
||||
|
||||
1.0.2
|
||||
~~~~~
|
||||
A bug fix release, addressing various minor issues which have appeared
|
||||
in the 18 or so months since 1.0.1 was released. Most of the fixes
|
||||
are to do with file-handling or documentation bugs. To the best of my
|
||||
knowledge, there have been no data-loss-causing bugs reported in the
|
||||
compression/decompression engine of 1.0.0 or 1.0.1.
|
||||
|
||||
Note that this release does not improve the rather crude build system
|
||||
for Unix platforms. The general plan here is to autoconfiscate/
|
||||
libtoolise 1.0.2 soon after release, and release the result as 1.1.0
|
||||
or perhaps 1.2.0. That, however, is still just a plan at this point.
|
||||
|
||||
Here are the changes in 1.0.2. Bug-reporters and/or patch-senders in
|
||||
parentheses.
|
||||
|
||||
* Fix an infinite segfault loop in 1.0.1 when a directory is
|
||||
encountered in -f (force) mode.
|
||||
(Trond Eivind Glomsrod, Nicholas Nethercote, Volker Schmidt)
|
||||
|
||||
* Avoid double fclose() of output file on certain I/O error paths.
|
||||
(Solar Designer)
|
||||
|
||||
* Don't fail with internal error 1007 when fed a long stream (> 48MB)
|
||||
of byte 251. Also print useful message suggesting that 1007s may be
|
||||
caused by bad memory.
|
||||
(noticed by Juan Pedro Vallejo, fixed by me)
|
||||
|
||||
* Fix uninitialised variable silly bug in demo prog dlltest.c.
|
||||
(Jorj Bauer)
|
||||
|
||||
* Remove 512-MB limitation on recovered file size for bzip2recover
|
||||
on selected platforms which support 64-bit ints. At the moment
|
||||
all GCC supported platforms, and Win32.
|
||||
(me, Alson van der Meulen)
|
||||
|
||||
* Hard-code header byte values, to give correct operation on platforms
|
||||
using EBCDIC as their native character set (IBM's OS/390).
|
||||
(Leland Lucius)
|
||||
|
||||
* Copy file access times correctly.
|
||||
(Marty Leisner)
|
||||
|
||||
* Add distclean and check targets to Makefile.
|
||||
(Michael Carmack)
|
||||
|
||||
* Parameterise use of ar and ranlib in Makefile. Also add $(LDFLAGS).
|
||||
(Rich Ireland, Bo Thorsen)
|
||||
|
||||
* Pass -p (create parent dirs as needed) to mkdir during make install.
|
||||
(Jeremy Fusco)
|
||||
|
||||
* Dereference symlinks when copying file permissions in -f mode.
|
||||
(Volker Schmidt)
|
||||
|
||||
* Majorly simplify implementation of uInt64_qrm10.
|
||||
(Bo Lindbergh)
|
||||
|
||||
* Check the input file still exists before deleting the output one,
|
||||
when aborting in cleanUpAndFail().
|
||||
(Joerg Prante, Robert Linden, Matthias Krings)
|
||||
|
||||
Also a bunch of patches courtesy of Philippe Troin, the Debian maintainer
|
||||
of bzip2:
|
||||
|
||||
* Wrapper scripts (with manpages): bzdiff, bzgrep, bzmore.
|
||||
|
||||
* Spelling changes and minor enhancements in bzip2.1.
|
||||
|
||||
* Avoid race condition between creating the output file and setting its
|
||||
interim permissions safely, by using fopen_output_safely().
|
||||
No changes to bzip2recover since there is no issue with file
|
||||
permissions there.
|
||||
|
||||
* do not print senseless report with -v when compressing an empty
|
||||
file.
|
||||
|
||||
* bzcat -f works on non-bzip2 files.
|
||||
|
||||
* do not try to escape shell meta-characters on unix (the shell takes
|
||||
care of these).
|
||||
|
||||
* added --fast and --best aliases for -1 -9 for gzip compatibility.
|
||||
|
||||
|
||||
1.0.3 (15 Feb 05)
|
||||
~~~~~~~~~~~~~~~~~
|
||||
Fixes some minor bugs since the last version, 1.0.2.
|
||||
|
||||
* Further robustification against corrupted compressed data.
|
||||
There are currently no known bitstreams which can cause the
|
||||
decompressor to crash, loop or access memory which does not
|
||||
belong to it. If you are using bzip2 or the library to
|
||||
decompress bitstreams from untrusted sources, an upgrade
|
||||
to 1.0.3 is recommended. This fixes CAN-2005-1260.
|
||||
|
||||
* The documentation has been converted to XML, from which html
|
||||
and pdf can be derived.
|
||||
|
||||
* Various minor bugs in the documentation have been fixed.
|
||||
|
||||
* Fixes for various compilation warnings with newer versions of
|
||||
gcc, and on 64-bit platforms.
|
||||
|
||||
* The BZ_NO_STDIO cpp symbol was not properly observed in 1.0.2.
|
||||
This has been fixed.
|
||||
|
||||
|
||||
1.0.4 (20 Dec 06)
|
||||
~~~~~~~~~~~~~~~~~
|
||||
Fixes some minor bugs since the last version, 1.0.3.
|
||||
|
||||
* Fix file permissions race problem (CAN-2005-0953).
|
||||
|
||||
* Avoid possible segfault in BZ2_bzclose. From Coverity's NetBSD
|
||||
scan.
|
||||
|
||||
* 'const'/prototype cleanups in the C code.
|
||||
|
||||
* Change default install location to /usr/local, and handle multiple
|
||||
'make install's without error.
|
||||
|
||||
* Sanitise file names more carefully in bzgrep. Fixes CAN-2005-0758
|
||||
to the extent that applies to bzgrep.
|
||||
|
||||
* Use 'mktemp' rather than 'tempfile' in bzdiff.
|
||||
|
||||
* Tighten up a couple of assertions in blocksort.c following automated
|
||||
analysis.
|
||||
|
||||
* Fix minor doc/comment bugs.
|
||||
|
||||
|
||||
1.0.5 (10 Dec 07)
|
||||
~~~~~~~~~~~~~~~~~
|
||||
Security fix only. Fixes CERT-FI 20469 as it applies to bzip2.
|
||||
|
||||
|
||||
1.0.6 (6 Sept 10)
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
* Security fix for CVE-2010-0405. This was reported by Mikolaj
|
||||
Izdebski.
|
||||
|
||||
* Make the documentation build on Ubuntu 10.04
|
|
@ -1,42 +0,0 @@
|
|||
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
This program, "bzip2", the associated library "libbzip2", and all
|
||||
documentation, are copyright (C) 1996-2010 Julian R Seward. All
|
||||
rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
3. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
|
||||
4. The name of the author may not be used to endorse or promote
|
||||
products derived from this software without specific prior written
|
||||
permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
Julian Seward, jseward@bzip.org
|
||||
bzip2/libbzip2 version 1.0.6 of 6 September 2010
|
||||
|
||||
--------------------------------------------------------------------------
|
|
@ -1,215 +0,0 @@
|
|||
|
||||
This is the README for bzip2/libzip2.
|
||||
This version is fully compatible with the previous public releases.
|
||||
|
||||
------------------------------------------------------------------
|
||||
This file is part of bzip2/libbzip2, a program and library for
|
||||
lossless, block-sorting data compression.
|
||||
|
||||
bzip2/libbzip2 version 1.0.6 of 6 September 2010
|
||||
Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
|
||||
|
||||
Please read the WARNING, DISCLAIMER and PATENTS sections in this file.
|
||||
|
||||
This program is released under the terms of the license contained
|
||||
in the file LICENSE.
|
||||
------------------------------------------------------------------
|
||||
|
||||
Complete documentation is available in Postscript form (manual.ps),
|
||||
PDF (manual.pdf) or html (manual.html). A plain-text version of the
|
||||
manual page is available as bzip2.txt.
|
||||
|
||||
|
||||
HOW TO BUILD -- UNIX
|
||||
|
||||
Type 'make'. This builds the library libbz2.a and then the programs
|
||||
bzip2 and bzip2recover. Six self-tests are run. If the self-tests
|
||||
complete ok, carry on to installation:
|
||||
|
||||
To install in /usr/local/bin, /usr/local/lib, /usr/local/man and
|
||||
/usr/local/include, type
|
||||
|
||||
make install
|
||||
|
||||
To install somewhere else, eg, /xxx/yyy/{bin,lib,man,include}, type
|
||||
|
||||
make install PREFIX=/xxx/yyy
|
||||
|
||||
If you are (justifiably) paranoid and want to see what 'make install'
|
||||
is going to do, you can first do
|
||||
|
||||
make -n install or
|
||||
make -n install PREFIX=/xxx/yyy respectively.
|
||||
|
||||
The -n instructs make to show the commands it would execute, but not
|
||||
actually execute them.
|
||||
|
||||
|
||||
HOW TO BUILD -- UNIX, shared library libbz2.so.
|
||||
|
||||
Do 'make -f Makefile-libbz2_so'. This Makefile seems to work for
|
||||
Linux-ELF (RedHat 7.2 on an x86 box), with gcc. I make no claims
|
||||
that it works for any other platform, though I suspect it probably
|
||||
will work for most platforms employing both ELF and gcc.
|
||||
|
||||
bzip2-shared, a client of the shared library, is also built, but not
|
||||
self-tested. So I suggest you also build using the normal Makefile,
|
||||
since that conducts a self-test. A second reason to prefer the
|
||||
version statically linked to the library is that, on x86 platforms,
|
||||
building shared objects makes a valuable register (%ebx) unavailable
|
||||
to gcc, resulting in a slowdown of 10%-20%, at least for bzip2.
|
||||
|
||||
Important note for people upgrading .so's from 0.9.0/0.9.5 to version
|
||||
1.0.X. All the functions in the library have been renamed, from (eg)
|
||||
bzCompress to BZ2_bzCompress, to avoid namespace pollution.
|
||||
Unfortunately this means that the libbz2.so created by
|
||||
Makefile-libbz2_so will not work with any program which used an older
|
||||
version of the library. I do encourage library clients to make the
|
||||
effort to upgrade to use version 1.0, since it is both faster and more
|
||||
robust than previous versions.
|
||||
|
||||
|
||||
HOW TO BUILD -- Windows 95, NT, DOS, Mac, etc.
|
||||
|
||||
It's difficult for me to support compilation on all these platforms.
|
||||
My approach is to collect binaries for these platforms, and put them
|
||||
on the master web site (http://www.bzip.org). Look there. However
|
||||
(FWIW), bzip2-1.0.X is very standard ANSI C and should compile
|
||||
unmodified with MS Visual C. If you have difficulties building, you
|
||||
might want to read README.COMPILATION.PROBLEMS.
|
||||
|
||||
At least using MS Visual C++ 6, you can build from the unmodified
|
||||
sources by issuing, in a command shell:
|
||||
|
||||
nmake -f makefile.msc
|
||||
|
||||
(you may need to first run the MSVC-provided script VCVARS32.BAT
|
||||
so as to set up paths to the MSVC tools correctly).
|
||||
|
||||
|
||||
VALIDATION
|
||||
|
||||
Correct operation, in the sense that a compressed file can always be
|
||||
decompressed to reproduce the original, is obviously of paramount
|
||||
importance. To validate bzip2, I used a modified version of Mark
|
||||
Nelson's churn program. Churn is an automated test driver which
|
||||
recursively traverses a directory structure, using bzip2 to compress
|
||||
and then decompress each file it encounters, and checking that the
|
||||
decompressed data is the same as the original.
|
||||
|
||||
|
||||
|
||||
Please read and be aware of the following:
|
||||
|
||||
WARNING:
|
||||
|
||||
This program and library (attempts to) compress data by
|
||||
performing several non-trivial transformations on it.
|
||||
Unless you are 100% familiar with *all* the algorithms
|
||||
contained herein, and with the consequences of modifying them,
|
||||
you should NOT meddle with the compression or decompression
|
||||
machinery. Incorrect changes can and very likely *will*
|
||||
lead to disastrous loss of data.
|
||||
|
||||
|
||||
DISCLAIMER:
|
||||
|
||||
I TAKE NO RESPONSIBILITY FOR ANY LOSS OF DATA ARISING FROM THE
|
||||
USE OF THIS PROGRAM/LIBRARY, HOWSOEVER CAUSED.
|
||||
|
||||
Every compression of a file implies an assumption that the
|
||||
compressed file can be decompressed to reproduce the original.
|
||||
Great efforts in design, coding and testing have been made to
|
||||
ensure that this program works correctly. However, the complexity
|
||||
of the algorithms, and, in particular, the presence of various
|
||||
special cases in the code which occur with very low but non-zero
|
||||
probability make it impossible to rule out the possibility of bugs
|
||||
remaining in the program. DO NOT COMPRESS ANY DATA WITH THIS
|
||||
PROGRAM UNLESS YOU ARE PREPARED TO ACCEPT THE POSSIBILITY, HOWEVER
|
||||
SMALL, THAT THE DATA WILL NOT BE RECOVERABLE.
|
||||
|
||||
That is not to say this program is inherently unreliable.
|
||||
Indeed, I very much hope the opposite is true. bzip2/libbzip2
|
||||
has been carefully constructed and extensively tested.
|
||||
|
||||
|
||||
PATENTS:
|
||||
|
||||
To the best of my knowledge, bzip2/libbzip2 does not use any
|
||||
patented algorithms. However, I do not have the resources
|
||||
to carry out a patent search. Therefore I cannot give any
|
||||
guarantee of the above statement.
|
||||
|
||||
|
||||
|
||||
WHAT'S NEW IN 0.9.0 (as compared to 0.1pl2) ?
|
||||
|
||||
* Approx 10% faster compression, 30% faster decompression
|
||||
* -t (test mode) is a lot quicker
|
||||
* Can decompress concatenated compressed files
|
||||
* Programming interface, so programs can directly read/write .bz2 files
|
||||
* Less restrictive (BSD-style) licensing
|
||||
* Flag handling more compatible with GNU gzip
|
||||
* Much more documentation, i.e., a proper user manual
|
||||
* Hopefully, improved portability (at least of the library)
|
||||
|
||||
WHAT'S NEW IN 0.9.5 ?
|
||||
|
||||
* Compression speed is much less sensitive to the input
|
||||
data than in previous versions. Specifically, the very
|
||||
slow performance caused by repetitive data is fixed.
|
||||
* Many small improvements in file and flag handling.
|
||||
* A Y2K statement.
|
||||
|
||||
WHAT'S NEW IN 1.0.0 ?
|
||||
|
||||
See the CHANGES file.
|
||||
|
||||
WHAT'S NEW IN 1.0.2 ?
|
||||
|
||||
See the CHANGES file.
|
||||
|
||||
WHAT'S NEW IN 1.0.3 ?
|
||||
|
||||
See the CHANGES file.
|
||||
|
||||
WHAT'S NEW IN 1.0.4 ?
|
||||
|
||||
See the CHANGES file.
|
||||
|
||||
WHAT'S NEW IN 1.0.5 ?
|
||||
|
||||
See the CHANGES file.
|
||||
|
||||
WHAT'S NEW IN 1.0.6 ?
|
||||
|
||||
See the CHANGES file.
|
||||
|
||||
|
||||
I hope you find bzip2 useful. Feel free to contact me at
|
||||
jseward@bzip.org
|
||||
if you have any suggestions or queries. Many people mailed me with
|
||||
comments, suggestions and patches after the releases of bzip-0.15,
|
||||
bzip-0.21, and bzip2 versions 0.1pl2, 0.9.0, 0.9.5, 1.0.0, 1.0.1,
|
||||
1.0.2 and 1.0.3, and the changes in bzip2 are largely a result of this
|
||||
feedback. I thank you for your comments.
|
||||
|
||||
bzip2's "home" is http://www.bzip.org/
|
||||
|
||||
Julian Seward
|
||||
jseward@bzip.org
|
||||
Cambridge, UK.
|
||||
|
||||
18 July 1996 (version 0.15)
|
||||
25 August 1996 (version 0.21)
|
||||
7 August 1997 (bzip2, version 0.1)
|
||||
29 August 1997 (bzip2, version 0.1pl2)
|
||||
23 August 1998 (bzip2, version 0.9.0)
|
||||
8 June 1999 (bzip2, version 0.9.5)
|
||||
4 Sept 1999 (bzip2, version 0.9.5d)
|
||||
5 May 2000 (bzip2, version 1.0pre8)
|
||||
30 December 2001 (bzip2, version 1.0.2pre1)
|
||||
15 February 2005 (bzip2, version 1.0.3)
|
||||
20 December 2006 (bzip2, version 1.0.4)
|
||||
10 December 2007 (bzip2, version 1.0.5)
|
||||
6 Sept 2010 (bzip2, version 1.0.6)
|
File diff suppressed because it is too large
Load Diff
|
@ -1,93 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Devel|Win32">
|
||||
<Configuration>Devel</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{F4EB4AB2-C595-4B05-8BC0-059024BC796C}</ProjectGuid>
|
||||
<RootNamespace>bzip2</RootNamespace>
|
||||
<ProjectName>bzip2</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Devel|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Devel|Win32'" Label="PropertySheets">
|
||||
<Import Project="..\DefaultProjectRootDir.props" />
|
||||
<Import Project="..\3rdparty.props" />
|
||||
<Import Project="..\..\common\vsprops\CodeGen_Devel.props" />
|
||||
<Import Project="..\..\common\vsprops\IncrementalLinking.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="..\DefaultProjectRootDir.props" />
|
||||
<Import Project="..\3rdparty.props" />
|
||||
<Import Project="..\..\common\vsprops\CodeGen_Release.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="..\DefaultProjectRootDir.props" />
|
||||
<Import Project="..\3rdparty.props" />
|
||||
<Import Project="..\..\common\vsprops\CodeGen_Debug.props" />
|
||||
<Import Project="..\..\common\vsprops\IncrementalLinking.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Devel|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Devel|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Devel|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectName)</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Devel|Win32'">$(ProjectName)-dev</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="blocksort.c" />
|
||||
<ClCompile Include="bzlib.c" />
|
||||
<ClCompile Include="compress.c" />
|
||||
<ClCompile Include="crctable.c" />
|
||||
<ClCompile Include="decompress.c" />
|
||||
<ClCompile Include="huffman.c" />
|
||||
<ClCompile Include="randtable.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="bzlib.h" />
|
||||
<ClInclude Include="bzlib_private.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -1,44 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="blocksort.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="bzlib.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="compress.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="crctable.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="decompress.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="huffman.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="randtable.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="bzlib.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="bzlib_private.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
File diff suppressed because it is too large
Load Diff
|
@ -1,282 +0,0 @@
|
|||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*--- Public header file for the library. ---*/
|
||||
/*--- bzlib.h ---*/
|
||||
/*-------------------------------------------------------------*/
|
||||
|
||||
/* ------------------------------------------------------------------
|
||||
This file is part of bzip2/libbzip2, a program and library for
|
||||
lossless, block-sorting data compression.
|
||||
|
||||
bzip2/libbzip2 version 1.0.6 of 6 September 2010
|
||||
Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
|
||||
|
||||
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||
README file.
|
||||
|
||||
This program is released under the terms of the license contained
|
||||
in the file LICENSE.
|
||||
------------------------------------------------------------------ */
|
||||
|
||||
|
||||
#ifndef _BZLIB_H
|
||||
#define _BZLIB_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define BZ_RUN 0
|
||||
#define BZ_FLUSH 1
|
||||
#define BZ_FINISH 2
|
||||
|
||||
#define BZ_OK 0
|
||||
#define BZ_RUN_OK 1
|
||||
#define BZ_FLUSH_OK 2
|
||||
#define BZ_FINISH_OK 3
|
||||
#define BZ_STREAM_END 4
|
||||
#define BZ_SEQUENCE_ERROR (-1)
|
||||
#define BZ_PARAM_ERROR (-2)
|
||||
#define BZ_MEM_ERROR (-3)
|
||||
#define BZ_DATA_ERROR (-4)
|
||||
#define BZ_DATA_ERROR_MAGIC (-5)
|
||||
#define BZ_IO_ERROR (-6)
|
||||
#define BZ_UNEXPECTED_EOF (-7)
|
||||
#define BZ_OUTBUFF_FULL (-8)
|
||||
#define BZ_CONFIG_ERROR (-9)
|
||||
|
||||
typedef
|
||||
struct {
|
||||
char *next_in;
|
||||
unsigned int avail_in;
|
||||
unsigned int total_in_lo32;
|
||||
unsigned int total_in_hi32;
|
||||
|
||||
char *next_out;
|
||||
unsigned int avail_out;
|
||||
unsigned int total_out_lo32;
|
||||
unsigned int total_out_hi32;
|
||||
|
||||
void *state;
|
||||
|
||||
void *(*bzalloc)(void *,int,int);
|
||||
void (*bzfree)(void *,void *);
|
||||
void *opaque;
|
||||
}
|
||||
bz_stream;
|
||||
|
||||
|
||||
#ifndef BZ_IMPORT
|
||||
#define BZ_EXPORT
|
||||
#endif
|
||||
|
||||
#ifndef BZ_NO_STDIO
|
||||
/* Need a definitition for FILE */
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# include <windows.h>
|
||||
# ifdef small
|
||||
/* windows.h define small to char */
|
||||
# undef small
|
||||
# endif
|
||||
# ifdef BZ_EXPORT
|
||||
# define BZ_API(func) WINAPI func
|
||||
# define BZ_EXTERN extern
|
||||
# else
|
||||
/* import windows dll dynamically */
|
||||
# define BZ_API(func) (WINAPI * func)
|
||||
# define BZ_EXTERN
|
||||
# endif
|
||||
#else
|
||||
# define BZ_API(func) func
|
||||
# define BZ_EXTERN extern
|
||||
#endif
|
||||
|
||||
|
||||
/*-- Core (low-level) library functions --*/
|
||||
|
||||
BZ_EXTERN int BZ_API(BZ2_bzCompressInit) (
|
||||
bz_stream* strm,
|
||||
int blockSize100k,
|
||||
int verbosity,
|
||||
int workFactor
|
||||
);
|
||||
|
||||
BZ_EXTERN int BZ_API(BZ2_bzCompress) (
|
||||
bz_stream* strm,
|
||||
int action
|
||||
);
|
||||
|
||||
BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) (
|
||||
bz_stream* strm
|
||||
);
|
||||
|
||||
BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) (
|
||||
bz_stream *strm,
|
||||
int verbosity,
|
||||
int small
|
||||
);
|
||||
|
||||
BZ_EXTERN int BZ_API(BZ2_bzDecompress) (
|
||||
bz_stream* strm
|
||||
);
|
||||
|
||||
BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) (
|
||||
bz_stream *strm
|
||||
);
|
||||
|
||||
|
||||
|
||||
/*-- High(er) level library functions --*/
|
||||
|
||||
#ifndef BZ_NO_STDIO
|
||||
#define BZ_MAX_UNUSED 5000
|
||||
|
||||
typedef void BZFILE;
|
||||
|
||||
BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) (
|
||||
int* bzerror,
|
||||
FILE* f,
|
||||
int verbosity,
|
||||
int small,
|
||||
void* unused,
|
||||
int nUnused
|
||||
);
|
||||
|
||||
BZ_EXTERN void BZ_API(BZ2_bzReadClose) (
|
||||
int* bzerror,
|
||||
BZFILE* b
|
||||
);
|
||||
|
||||
BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) (
|
||||
int* bzerror,
|
||||
BZFILE* b,
|
||||
void** unused,
|
||||
int* nUnused
|
||||
);
|
||||
|
||||
BZ_EXTERN int BZ_API(BZ2_bzRead) (
|
||||
int* bzerror,
|
||||
BZFILE* b,
|
||||
void* buf,
|
||||
int len
|
||||
);
|
||||
|
||||
BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) (
|
||||
int* bzerror,
|
||||
FILE* f,
|
||||
int blockSize100k,
|
||||
int verbosity,
|
||||
int workFactor
|
||||
);
|
||||
|
||||
BZ_EXTERN void BZ_API(BZ2_bzWrite) (
|
||||
int* bzerror,
|
||||
BZFILE* b,
|
||||
void* buf,
|
||||
int len
|
||||
);
|
||||
|
||||
BZ_EXTERN void BZ_API(BZ2_bzWriteClose) (
|
||||
int* bzerror,
|
||||
BZFILE* b,
|
||||
int abandon,
|
||||
unsigned int* nbytes_in,
|
||||
unsigned int* nbytes_out
|
||||
);
|
||||
|
||||
BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) (
|
||||
int* bzerror,
|
||||
BZFILE* b,
|
||||
int abandon,
|
||||
unsigned int* nbytes_in_lo32,
|
||||
unsigned int* nbytes_in_hi32,
|
||||
unsigned int* nbytes_out_lo32,
|
||||
unsigned int* nbytes_out_hi32
|
||||
);
|
||||
#endif
|
||||
|
||||
|
||||
/*-- Utility functions --*/
|
||||
|
||||
BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) (
|
||||
char* dest,
|
||||
unsigned int* destLen,
|
||||
char* source,
|
||||
unsigned int sourceLen,
|
||||
int blockSize100k,
|
||||
int verbosity,
|
||||
int workFactor
|
||||
);
|
||||
|
||||
BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) (
|
||||
char* dest,
|
||||
unsigned int* destLen,
|
||||
char* source,
|
||||
unsigned int sourceLen,
|
||||
int small,
|
||||
int verbosity
|
||||
);
|
||||
|
||||
|
||||
/*--
|
||||
Code contributed by Yoshioka Tsuneo (tsuneo@rr.iij4u.or.jp)
|
||||
to support better zlib compatibility.
|
||||
This code is not _officially_ part of libbzip2 (yet);
|
||||
I haven't tested it, documented it, or considered the
|
||||
threading-safeness of it.
|
||||
If this code breaks, please contact both Yoshioka and me.
|
||||
--*/
|
||||
|
||||
BZ_EXTERN const char * BZ_API(BZ2_bzlibVersion) (
|
||||
void
|
||||
);
|
||||
|
||||
#ifndef BZ_NO_STDIO
|
||||
BZ_EXTERN BZFILE * BZ_API(BZ2_bzopen) (
|
||||
const char *path,
|
||||
const char *mode
|
||||
);
|
||||
|
||||
BZ_EXTERN BZFILE * BZ_API(BZ2_bzdopen) (
|
||||
int fd,
|
||||
const char *mode
|
||||
);
|
||||
|
||||
BZ_EXTERN int BZ_API(BZ2_bzread) (
|
||||
BZFILE* b,
|
||||
void* buf,
|
||||
int len
|
||||
);
|
||||
|
||||
BZ_EXTERN int BZ_API(BZ2_bzwrite) (
|
||||
BZFILE* b,
|
||||
void* buf,
|
||||
int len
|
||||
);
|
||||
|
||||
BZ_EXTERN int BZ_API(BZ2_bzflush) (
|
||||
BZFILE* b
|
||||
);
|
||||
|
||||
BZ_EXTERN void BZ_API(BZ2_bzclose) (
|
||||
BZFILE* b
|
||||
);
|
||||
|
||||
BZ_EXTERN const char * BZ_API(BZ2_bzerror) (
|
||||
BZFILE *b,
|
||||
int *errnum
|
||||
);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*--- end bzlib.h ---*/
|
||||
/*-------------------------------------------------------------*/
|
|
@ -1,509 +0,0 @@
|
|||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*--- Private header file for the library. ---*/
|
||||
/*--- bzlib_private.h ---*/
|
||||
/*-------------------------------------------------------------*/
|
||||
|
||||
/* ------------------------------------------------------------------
|
||||
This file is part of bzip2/libbzip2, a program and library for
|
||||
lossless, block-sorting data compression.
|
||||
|
||||
bzip2/libbzip2 version 1.0.6 of 6 September 2010
|
||||
Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
|
||||
|
||||
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||
README file.
|
||||
|
||||
This program is released under the terms of the license contained
|
||||
in the file LICENSE.
|
||||
------------------------------------------------------------------ */
|
||||
|
||||
|
||||
#ifndef _BZLIB_PRIVATE_H
|
||||
#define _BZLIB_PRIVATE_H
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef BZ_NO_STDIO
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#include "bzlib.h"
|
||||
|
||||
|
||||
|
||||
/*-- General stuff. --*/
|
||||
|
||||
#define BZ_VERSION "1.0.6, 6-Sept-2010"
|
||||
|
||||
typedef char Char;
|
||||
typedef unsigned char Bool;
|
||||
typedef unsigned char UChar;
|
||||
typedef int Int32;
|
||||
typedef unsigned int UInt32;
|
||||
typedef short Int16;
|
||||
typedef unsigned short UInt16;
|
||||
|
||||
#define True ((Bool)1)
|
||||
#define False ((Bool)0)
|
||||
|
||||
#ifndef __GNUC__
|
||||
#define __inline__ /* */
|
||||
#endif
|
||||
|
||||
#ifndef BZ_NO_STDIO
|
||||
|
||||
extern void BZ2_bz__AssertH__fail ( int errcode );
|
||||
#define AssertH(cond,errcode) \
|
||||
{ if (!(cond)) BZ2_bz__AssertH__fail ( errcode ); }
|
||||
|
||||
#if BZ_DEBUG
|
||||
#define AssertD(cond,msg) \
|
||||
{ if (!(cond)) { \
|
||||
fprintf ( stderr, \
|
||||
"\n\nlibbzip2(debug build): internal error\n\t%s\n", msg );\
|
||||
exit(1); \
|
||||
}}
|
||||
#else
|
||||
#define AssertD(cond,msg) /* */
|
||||
#endif
|
||||
|
||||
#define VPrintf0(zf) \
|
||||
fprintf(stderr,zf)
|
||||
#define VPrintf1(zf,za1) \
|
||||
fprintf(stderr,zf,za1)
|
||||
#define VPrintf2(zf,za1,za2) \
|
||||
fprintf(stderr,zf,za1,za2)
|
||||
#define VPrintf3(zf,za1,za2,za3) \
|
||||
fprintf(stderr,zf,za1,za2,za3)
|
||||
#define VPrintf4(zf,za1,za2,za3,za4) \
|
||||
fprintf(stderr,zf,za1,za2,za3,za4)
|
||||
#define VPrintf5(zf,za1,za2,za3,za4,za5) \
|
||||
fprintf(stderr,zf,za1,za2,za3,za4,za5)
|
||||
|
||||
#else
|
||||
|
||||
extern void bz_internal_error ( int errcode );
|
||||
#define AssertH(cond,errcode) \
|
||||
{ if (!(cond)) bz_internal_error ( errcode ); }
|
||||
#define AssertD(cond,msg) do { } while (0)
|
||||
#define VPrintf0(zf) do { } while (0)
|
||||
#define VPrintf1(zf,za1) do { } while (0)
|
||||
#define VPrintf2(zf,za1,za2) do { } while (0)
|
||||
#define VPrintf3(zf,za1,za2,za3) do { } while (0)
|
||||
#define VPrintf4(zf,za1,za2,za3,za4) do { } while (0)
|
||||
#define VPrintf5(zf,za1,za2,za3,za4,za5) do { } while (0)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#define BZALLOC(nnn) (strm->bzalloc)(strm->opaque,(nnn),1)
|
||||
#define BZFREE(ppp) (strm->bzfree)(strm->opaque,(ppp))
|
||||
|
||||
|
||||
/*-- Header bytes. --*/
|
||||
|
||||
#define BZ_HDR_B 0x42 /* 'B' */
|
||||
#define BZ_HDR_Z 0x5a /* 'Z' */
|
||||
#define BZ_HDR_h 0x68 /* 'h' */
|
||||
#define BZ_HDR_0 0x30 /* '0' */
|
||||
|
||||
/*-- Constants for the back end. --*/
|
||||
|
||||
#define BZ_MAX_ALPHA_SIZE 258
|
||||
#define BZ_MAX_CODE_LEN 23
|
||||
|
||||
#define BZ_RUNA 0
|
||||
#define BZ_RUNB 1
|
||||
|
||||
#define BZ_N_GROUPS 6
|
||||
#define BZ_G_SIZE 50
|
||||
#define BZ_N_ITERS 4
|
||||
|
||||
#define BZ_MAX_SELECTORS (2 + (900000 / BZ_G_SIZE))
|
||||
|
||||
|
||||
|
||||
/*-- Stuff for randomising repetitive blocks. --*/
|
||||
|
||||
extern Int32 BZ2_rNums[512];
|
||||
|
||||
#define BZ_RAND_DECLS \
|
||||
Int32 rNToGo; \
|
||||
Int32 rTPos \
|
||||
|
||||
#define BZ_RAND_INIT_MASK \
|
||||
s->rNToGo = 0; \
|
||||
s->rTPos = 0 \
|
||||
|
||||
#define BZ_RAND_MASK ((s->rNToGo == 1) ? 1 : 0)
|
||||
|
||||
#define BZ_RAND_UPD_MASK \
|
||||
if (s->rNToGo == 0) { \
|
||||
s->rNToGo = BZ2_rNums[s->rTPos]; \
|
||||
s->rTPos++; \
|
||||
if (s->rTPos == 512) s->rTPos = 0; \
|
||||
} \
|
||||
s->rNToGo--;
|
||||
|
||||
|
||||
|
||||
/*-- Stuff for doing CRCs. --*/
|
||||
|
||||
extern UInt32 BZ2_crc32Table[256];
|
||||
|
||||
#define BZ_INITIALISE_CRC(crcVar) \
|
||||
{ \
|
||||
crcVar = 0xffffffffL; \
|
||||
}
|
||||
|
||||
#define BZ_FINALISE_CRC(crcVar) \
|
||||
{ \
|
||||
crcVar = ~(crcVar); \
|
||||
}
|
||||
|
||||
#define BZ_UPDATE_CRC(crcVar,cha) \
|
||||
{ \
|
||||
crcVar = (crcVar << 8) ^ \
|
||||
BZ2_crc32Table[(crcVar >> 24) ^ \
|
||||
((UChar)cha)]; \
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-- States and modes for compression. --*/
|
||||
|
||||
#define BZ_M_IDLE 1
|
||||
#define BZ_M_RUNNING 2
|
||||
#define BZ_M_FLUSHING 3
|
||||
#define BZ_M_FINISHING 4
|
||||
|
||||
#define BZ_S_OUTPUT 1
|
||||
#define BZ_S_INPUT 2
|
||||
|
||||
#define BZ_N_RADIX 2
|
||||
#define BZ_N_QSORT 12
|
||||
#define BZ_N_SHELL 18
|
||||
#define BZ_N_OVERSHOOT (BZ_N_RADIX + BZ_N_QSORT + BZ_N_SHELL + 2)
|
||||
|
||||
|
||||
|
||||
|
||||
/*-- Structure holding all the compression-side stuff. --*/
|
||||
|
||||
typedef
|
||||
struct {
|
||||
/* pointer back to the struct bz_stream */
|
||||
bz_stream* strm;
|
||||
|
||||
/* mode this stream is in, and whether inputting */
|
||||
/* or outputting data */
|
||||
Int32 mode;
|
||||
Int32 state;
|
||||
|
||||
/* remembers avail_in when flush/finish requested */
|
||||
UInt32 avail_in_expect;
|
||||
|
||||
/* for doing the block sorting */
|
||||
UInt32* arr1;
|
||||
UInt32* arr2;
|
||||
UInt32* ftab;
|
||||
Int32 origPtr;
|
||||
|
||||
/* aliases for arr1 and arr2 */
|
||||
UInt32* ptr;
|
||||
UChar* block;
|
||||
UInt16* mtfv;
|
||||
UChar* zbits;
|
||||
|
||||
/* for deciding when to use the fallback sorting algorithm */
|
||||
Int32 workFactor;
|
||||
|
||||
/* run-length-encoding of the input */
|
||||
UInt32 state_in_ch;
|
||||
Int32 state_in_len;
|
||||
BZ_RAND_DECLS;
|
||||
|
||||
/* input and output limits and current posns */
|
||||
Int32 nblock;
|
||||
Int32 nblockMAX;
|
||||
Int32 numZ;
|
||||
Int32 state_out_pos;
|
||||
|
||||
/* map of bytes used in block */
|
||||
Int32 nInUse;
|
||||
Bool inUse[256];
|
||||
UChar unseqToSeq[256];
|
||||
|
||||
/* the buffer for bit stream creation */
|
||||
UInt32 bsBuff;
|
||||
Int32 bsLive;
|
||||
|
||||
/* block and combined CRCs */
|
||||
UInt32 blockCRC;
|
||||
UInt32 combinedCRC;
|
||||
|
||||
/* misc administratium */
|
||||
Int32 verbosity;
|
||||
Int32 blockNo;
|
||||
Int32 blockSize100k;
|
||||
|
||||
/* stuff for coding the MTF values */
|
||||
Int32 nMTF;
|
||||
Int32 mtfFreq [BZ_MAX_ALPHA_SIZE];
|
||||
UChar selector [BZ_MAX_SELECTORS];
|
||||
UChar selectorMtf[BZ_MAX_SELECTORS];
|
||||
|
||||
UChar len [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
|
||||
Int32 code [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
|
||||
Int32 rfreq [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
|
||||
/* second dimension: only 3 needed; 4 makes index calculations faster */
|
||||
UInt32 len_pack[BZ_MAX_ALPHA_SIZE][4];
|
||||
|
||||
}
|
||||
EState;
|
||||
|
||||
|
||||
|
||||
/*-- externs for compression. --*/
|
||||
|
||||
extern void
|
||||
BZ2_blockSort ( EState* );
|
||||
|
||||
extern void
|
||||
BZ2_compressBlock ( EState*, Bool );
|
||||
|
||||
extern void
|
||||
BZ2_bsInitWrite ( EState* );
|
||||
|
||||
extern void
|
||||
BZ2_hbAssignCodes ( Int32*, UChar*, Int32, Int32, Int32 );
|
||||
|
||||
extern void
|
||||
BZ2_hbMakeCodeLengths ( UChar*, Int32*, Int32, Int32 );
|
||||
|
||||
|
||||
|
||||
/*-- states for decompression. --*/
|
||||
|
||||
#define BZ_X_IDLE 1
|
||||
#define BZ_X_OUTPUT 2
|
||||
|
||||
#define BZ_X_MAGIC_1 10
|
||||
#define BZ_X_MAGIC_2 11
|
||||
#define BZ_X_MAGIC_3 12
|
||||
#define BZ_X_MAGIC_4 13
|
||||
#define BZ_X_BLKHDR_1 14
|
||||
#define BZ_X_BLKHDR_2 15
|
||||
#define BZ_X_BLKHDR_3 16
|
||||
#define BZ_X_BLKHDR_4 17
|
||||
#define BZ_X_BLKHDR_5 18
|
||||
#define BZ_X_BLKHDR_6 19
|
||||
#define BZ_X_BCRC_1 20
|
||||
#define BZ_X_BCRC_2 21
|
||||
#define BZ_X_BCRC_3 22
|
||||
#define BZ_X_BCRC_4 23
|
||||
#define BZ_X_RANDBIT 24
|
||||
#define BZ_X_ORIGPTR_1 25
|
||||
#define BZ_X_ORIGPTR_2 26
|
||||
#define BZ_X_ORIGPTR_3 27
|
||||
#define BZ_X_MAPPING_1 28
|
||||
#define BZ_X_MAPPING_2 29
|
||||
#define BZ_X_SELECTOR_1 30
|
||||
#define BZ_X_SELECTOR_2 31
|
||||
#define BZ_X_SELECTOR_3 32
|
||||
#define BZ_X_CODING_1 33
|
||||
#define BZ_X_CODING_2 34
|
||||
#define BZ_X_CODING_3 35
|
||||
#define BZ_X_MTF_1 36
|
||||
#define BZ_X_MTF_2 37
|
||||
#define BZ_X_MTF_3 38
|
||||
#define BZ_X_MTF_4 39
|
||||
#define BZ_X_MTF_5 40
|
||||
#define BZ_X_MTF_6 41
|
||||
#define BZ_X_ENDHDR_2 42
|
||||
#define BZ_X_ENDHDR_3 43
|
||||
#define BZ_X_ENDHDR_4 44
|
||||
#define BZ_X_ENDHDR_5 45
|
||||
#define BZ_X_ENDHDR_6 46
|
||||
#define BZ_X_CCRC_1 47
|
||||
#define BZ_X_CCRC_2 48
|
||||
#define BZ_X_CCRC_3 49
|
||||
#define BZ_X_CCRC_4 50
|
||||
|
||||
|
||||
|
||||
/*-- Constants for the fast MTF decoder. --*/
|
||||
|
||||
#define MTFA_SIZE 4096
|
||||
#define MTFL_SIZE 16
|
||||
|
||||
|
||||
|
||||
/*-- Structure holding all the decompression-side stuff. --*/
|
||||
|
||||
typedef
|
||||
struct {
|
||||
/* pointer back to the struct bz_stream */
|
||||
bz_stream* strm;
|
||||
|
||||
/* state indicator for this stream */
|
||||
Int32 state;
|
||||
|
||||
/* for doing the final run-length decoding */
|
||||
UChar state_out_ch;
|
||||
Int32 state_out_len;
|
||||
Bool blockRandomised;
|
||||
BZ_RAND_DECLS;
|
||||
|
||||
/* the buffer for bit stream reading */
|
||||
UInt32 bsBuff;
|
||||
Int32 bsLive;
|
||||
|
||||
/* misc administratium */
|
||||
Int32 blockSize100k;
|
||||
Bool smallDecompress;
|
||||
Int32 currBlockNo;
|
||||
Int32 verbosity;
|
||||
|
||||
/* for undoing the Burrows-Wheeler transform */
|
||||
Int32 origPtr;
|
||||
UInt32 tPos;
|
||||
Int32 k0;
|
||||
Int32 unzftab[256];
|
||||
Int32 nblock_used;
|
||||
Int32 cftab[257];
|
||||
Int32 cftabCopy[257];
|
||||
|
||||
/* for undoing the Burrows-Wheeler transform (FAST) */
|
||||
UInt32 *tt;
|
||||
|
||||
/* for undoing the Burrows-Wheeler transform (SMALL) */
|
||||
UInt16 *ll16;
|
||||
UChar *ll4;
|
||||
|
||||
/* stored and calculated CRCs */
|
||||
UInt32 storedBlockCRC;
|
||||
UInt32 storedCombinedCRC;
|
||||
UInt32 calculatedBlockCRC;
|
||||
UInt32 calculatedCombinedCRC;
|
||||
|
||||
/* map of bytes used in block */
|
||||
Int32 nInUse;
|
||||
Bool inUse[256];
|
||||
Bool inUse16[16];
|
||||
UChar seqToUnseq[256];
|
||||
|
||||
/* for decoding the MTF values */
|
||||
UChar mtfa [MTFA_SIZE];
|
||||
Int32 mtfbase[256 / MTFL_SIZE];
|
||||
UChar selector [BZ_MAX_SELECTORS];
|
||||
UChar selectorMtf[BZ_MAX_SELECTORS];
|
||||
UChar len [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
|
||||
|
||||
Int32 limit [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
|
||||
Int32 base [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
|
||||
Int32 perm [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
|
||||
Int32 minLens[BZ_N_GROUPS];
|
||||
|
||||
/* save area for scalars in the main decompress code */
|
||||
Int32 save_i;
|
||||
Int32 save_j;
|
||||
Int32 save_t;
|
||||
Int32 save_alphaSize;
|
||||
Int32 save_nGroups;
|
||||
Int32 save_nSelectors;
|
||||
Int32 save_EOB;
|
||||
Int32 save_groupNo;
|
||||
Int32 save_groupPos;
|
||||
Int32 save_nextSym;
|
||||
Int32 save_nblockMAX;
|
||||
Int32 save_nblock;
|
||||
Int32 save_es;
|
||||
Int32 save_N;
|
||||
Int32 save_curr;
|
||||
Int32 save_zt;
|
||||
Int32 save_zn;
|
||||
Int32 save_zvec;
|
||||
Int32 save_zj;
|
||||
Int32 save_gSel;
|
||||
Int32 save_gMinlen;
|
||||
Int32* save_gLimit;
|
||||
Int32* save_gBase;
|
||||
Int32* save_gPerm;
|
||||
|
||||
}
|
||||
DState;
|
||||
|
||||
|
||||
|
||||
/*-- Macros for decompression. --*/
|
||||
|
||||
#define BZ_GET_FAST(cccc) \
|
||||
/* c_tPos is unsigned, hence test < 0 is pointless. */ \
|
||||
if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return True; \
|
||||
s->tPos = s->tt[s->tPos]; \
|
||||
cccc = (UChar)(s->tPos & 0xff); \
|
||||
s->tPos >>= 8;
|
||||
|
||||
#define BZ_GET_FAST_C(cccc) \
|
||||
/* c_tPos is unsigned, hence test < 0 is pointless. */ \
|
||||
if (c_tPos >= (UInt32)100000 * (UInt32)ro_blockSize100k) return True; \
|
||||
c_tPos = c_tt[c_tPos]; \
|
||||
cccc = (UChar)(c_tPos & 0xff); \
|
||||
c_tPos >>= 8;
|
||||
|
||||
#define SET_LL4(i,n) \
|
||||
{ if (((i) & 0x1) == 0) \
|
||||
s->ll4[(i) >> 1] = (s->ll4[(i) >> 1] & 0xf0) | (n); else \
|
||||
s->ll4[(i) >> 1] = (s->ll4[(i) >> 1] & 0x0f) | ((n) << 4); \
|
||||
}
|
||||
|
||||
#define GET_LL4(i) \
|
||||
((((UInt32)(s->ll4[(i) >> 1])) >> (((i) << 2) & 0x4)) & 0xF)
|
||||
|
||||
#define SET_LL(i,n) \
|
||||
{ s->ll16[i] = (UInt16)(n & 0x0000ffff); \
|
||||
SET_LL4(i, n >> 16); \
|
||||
}
|
||||
|
||||
#define GET_LL(i) \
|
||||
(((UInt32)s->ll16[i]) | (GET_LL4(i) << 16))
|
||||
|
||||
#define BZ_GET_SMALL(cccc) \
|
||||
/* c_tPos is unsigned, hence test < 0 is pointless. */ \
|
||||
if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return True; \
|
||||
cccc = BZ2_indexIntoF ( s->tPos, s->cftab ); \
|
||||
s->tPos = GET_LL(s->tPos);
|
||||
|
||||
|
||||
/*-- externs for decompression. --*/
|
||||
|
||||
extern Int32
|
||||
BZ2_indexIntoF ( Int32, Int32* );
|
||||
|
||||
extern Int32
|
||||
BZ2_decompress ( DState* );
|
||||
|
||||
extern void
|
||||
BZ2_hbCreateDecodeTables ( Int32*, Int32*, Int32*, UChar*,
|
||||
Int32, Int32, Int32 );
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*-- BZ_NO_STDIO seems to make NULL disappear on some platforms. --*/
|
||||
|
||||
#ifdef BZ_NO_STDIO
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*--- end bzlib_private.h ---*/
|
||||
/*-------------------------------------------------------------*/
|
|
@ -1,672 +0,0 @@
|
|||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*--- Compression machinery (not incl block sorting) ---*/
|
||||
/*--- compress.c ---*/
|
||||
/*-------------------------------------------------------------*/
|
||||
|
||||
/* ------------------------------------------------------------------
|
||||
This file is part of bzip2/libbzip2, a program and library for
|
||||
lossless, block-sorting data compression.
|
||||
|
||||
bzip2/libbzip2 version 1.0.6 of 6 September 2010
|
||||
Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
|
||||
|
||||
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||
README file.
|
||||
|
||||
This program is released under the terms of the license contained
|
||||
in the file LICENSE.
|
||||
------------------------------------------------------------------ */
|
||||
|
||||
|
||||
/* CHANGES
|
||||
0.9.0 -- original version.
|
||||
0.9.0a/b -- no changes in this file.
|
||||
0.9.0c -- changed setting of nGroups in sendMTFValues()
|
||||
so as to do a bit better on small files
|
||||
*/
|
||||
|
||||
#include "bzlib_private.h"
|
||||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
/*--- Bit stream I/O ---*/
|
||||
/*---------------------------------------------------*/
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
void BZ2_bsInitWrite ( EState* s )
|
||||
{
|
||||
s->bsLive = 0;
|
||||
s->bsBuff = 0;
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
static
|
||||
void bsFinishWrite ( EState* s )
|
||||
{
|
||||
while (s->bsLive > 0) {
|
||||
s->zbits[s->numZ] = (UChar)(s->bsBuff >> 24);
|
||||
s->numZ++;
|
||||
s->bsBuff <<= 8;
|
||||
s->bsLive -= 8;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
#define bsNEEDW(nz) \
|
||||
{ \
|
||||
while (s->bsLive >= 8) { \
|
||||
s->zbits[s->numZ] \
|
||||
= (UChar)(s->bsBuff >> 24); \
|
||||
s->numZ++; \
|
||||
s->bsBuff <<= 8; \
|
||||
s->bsLive -= 8; \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
static
|
||||
__inline__
|
||||
void bsW ( EState* s, Int32 n, UInt32 v )
|
||||
{
|
||||
bsNEEDW ( n );
|
||||
s->bsBuff |= (v << (32 - s->bsLive - n));
|
||||
s->bsLive += n;
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
static
|
||||
void bsPutUInt32 ( EState* s, UInt32 u )
|
||||
{
|
||||
bsW ( s, 8, (u >> 24) & 0xffL );
|
||||
bsW ( s, 8, (u >> 16) & 0xffL );
|
||||
bsW ( s, 8, (u >> 8) & 0xffL );
|
||||
bsW ( s, 8, u & 0xffL );
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
static
|
||||
void bsPutUChar ( EState* s, UChar c )
|
||||
{
|
||||
bsW( s, 8, (UInt32)c );
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
/*--- The back end proper ---*/
|
||||
/*---------------------------------------------------*/
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
static
|
||||
void makeMaps_e ( EState* s )
|
||||
{
|
||||
Int32 i;
|
||||
s->nInUse = 0;
|
||||
for (i = 0; i < 256; i++)
|
||||
if (s->inUse[i]) {
|
||||
s->unseqToSeq[i] = s->nInUse;
|
||||
s->nInUse++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
static
|
||||
void generateMTFValues ( EState* s )
|
||||
{
|
||||
UChar yy[256];
|
||||
Int32 i, j;
|
||||
Int32 zPend;
|
||||
Int32 wr;
|
||||
Int32 EOB;
|
||||
|
||||
/*
|
||||
After sorting (eg, here),
|
||||
s->arr1 [ 0 .. s->nblock-1 ] holds sorted order,
|
||||
and
|
||||
((UChar*)s->arr2) [ 0 .. s->nblock-1 ]
|
||||
holds the original block data.
|
||||
|
||||
The first thing to do is generate the MTF values,
|
||||
and put them in
|
||||
((UInt16*)s->arr1) [ 0 .. s->nblock-1 ].
|
||||
Because there are strictly fewer or equal MTF values
|
||||
than block values, ptr values in this area are overwritten
|
||||
with MTF values only when they are no longer needed.
|
||||
|
||||
The final compressed bitstream is generated into the
|
||||
area starting at
|
||||
(UChar*) (&((UChar*)s->arr2)[s->nblock])
|
||||
|
||||
These storage aliases are set up in bzCompressInit(),
|
||||
except for the last one, which is arranged in
|
||||
compressBlock().
|
||||
*/
|
||||
UInt32* ptr = s->ptr;
|
||||
UChar* block = s->block;
|
||||
UInt16* mtfv = s->mtfv;
|
||||
|
||||
makeMaps_e ( s );
|
||||
EOB = s->nInUse+1;
|
||||
|
||||
for (i = 0; i <= EOB; i++) s->mtfFreq[i] = 0;
|
||||
|
||||
wr = 0;
|
||||
zPend = 0;
|
||||
for (i = 0; i < s->nInUse; i++) yy[i] = (UChar) i;
|
||||
|
||||
for (i = 0; i < s->nblock; i++) {
|
||||
UChar ll_i;
|
||||
AssertD ( wr <= i, "generateMTFValues(1)" );
|
||||
j = ptr[i]-1; if (j < 0) j += s->nblock;
|
||||
ll_i = s->unseqToSeq[block[j]];
|
||||
AssertD ( ll_i < s->nInUse, "generateMTFValues(2a)" );
|
||||
|
||||
if (yy[0] == ll_i) {
|
||||
zPend++;
|
||||
} else {
|
||||
|
||||
if (zPend > 0) {
|
||||
zPend--;
|
||||
while (True) {
|
||||
if (zPend & 1) {
|
||||
mtfv[wr] = BZ_RUNB; wr++;
|
||||
s->mtfFreq[BZ_RUNB]++;
|
||||
} else {
|
||||
mtfv[wr] = BZ_RUNA; wr++;
|
||||
s->mtfFreq[BZ_RUNA]++;
|
||||
}
|
||||
if (zPend < 2) break;
|
||||
zPend = (zPend - 2) / 2;
|
||||
};
|
||||
zPend = 0;
|
||||
}
|
||||
{
|
||||
register UChar rtmp;
|
||||
register UChar* ryy_j;
|
||||
register UChar rll_i;
|
||||
rtmp = yy[1];
|
||||
yy[1] = yy[0];
|
||||
ryy_j = &(yy[1]);
|
||||
rll_i = ll_i;
|
||||
while ( rll_i != rtmp ) {
|
||||
register UChar rtmp2;
|
||||
ryy_j++;
|
||||
rtmp2 = rtmp;
|
||||
rtmp = *ryy_j;
|
||||
*ryy_j = rtmp2;
|
||||
};
|
||||
yy[0] = rtmp;
|
||||
j = ryy_j - &(yy[0]);
|
||||
mtfv[wr] = j+1; wr++; s->mtfFreq[j+1]++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (zPend > 0) {
|
||||
zPend--;
|
||||
while (True) {
|
||||
if (zPend & 1) {
|
||||
mtfv[wr] = BZ_RUNB; wr++;
|
||||
s->mtfFreq[BZ_RUNB]++;
|
||||
} else {
|
||||
mtfv[wr] = BZ_RUNA; wr++;
|
||||
s->mtfFreq[BZ_RUNA]++;
|
||||
}
|
||||
if (zPend < 2) break;
|
||||
zPend = (zPend - 2) / 2;
|
||||
};
|
||||
zPend = 0;
|
||||
}
|
||||
|
||||
mtfv[wr] = EOB; wr++; s->mtfFreq[EOB]++;
|
||||
|
||||
s->nMTF = wr;
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
#define BZ_LESSER_ICOST 0
|
||||
#define BZ_GREATER_ICOST 15
|
||||
|
||||
static
|
||||
void sendMTFValues ( EState* s )
|
||||
{
|
||||
Int32 v, t, i, j, gs, ge, totc, bt, bc, iter;
|
||||
Int32 nSelectors, alphaSize, minLen, maxLen, selCtr;
|
||||
Int32 nGroups, nBytes;
|
||||
|
||||
/*--
|
||||
UChar len [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
|
||||
is a global since the decoder also needs it.
|
||||
|
||||
Int32 code[BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
|
||||
Int32 rfreq[BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
|
||||
are also globals only used in this proc.
|
||||
Made global to keep stack frame size small.
|
||||
--*/
|
||||
|
||||
|
||||
UInt16 cost[BZ_N_GROUPS];
|
||||
Int32 fave[BZ_N_GROUPS];
|
||||
|
||||
UInt16* mtfv = s->mtfv;
|
||||
|
||||
if (s->verbosity >= 3)
|
||||
VPrintf3( " %d in block, %d after MTF & 1-2 coding, "
|
||||
"%d+2 syms in use\n",
|
||||
s->nblock, s->nMTF, s->nInUse );
|
||||
|
||||
alphaSize = s->nInUse+2;
|
||||
for (t = 0; t < BZ_N_GROUPS; t++)
|
||||
for (v = 0; v < alphaSize; v++)
|
||||
s->len[t][v] = BZ_GREATER_ICOST;
|
||||
|
||||
/*--- Decide how many coding tables to use ---*/
|
||||
AssertH ( s->nMTF > 0, 3001 );
|
||||
if (s->nMTF < 200) nGroups = 2; else
|
||||
if (s->nMTF < 600) nGroups = 3; else
|
||||
if (s->nMTF < 1200) nGroups = 4; else
|
||||
if (s->nMTF < 2400) nGroups = 5; else
|
||||
nGroups = 6;
|
||||
|
||||
/*--- Generate an initial set of coding tables ---*/
|
||||
{
|
||||
Int32 nPart, remF, tFreq, aFreq;
|
||||
|
||||
nPart = nGroups;
|
||||
remF = s->nMTF;
|
||||
gs = 0;
|
||||
while (nPart > 0) {
|
||||
tFreq = remF / nPart;
|
||||
ge = gs-1;
|
||||
aFreq = 0;
|
||||
while (aFreq < tFreq && ge < alphaSize-1) {
|
||||
ge++;
|
||||
aFreq += s->mtfFreq[ge];
|
||||
}
|
||||
|
||||
if (ge > gs
|
||||
&& nPart != nGroups && nPart != 1
|
||||
&& ((nGroups-nPart) % 2 == 1)) {
|
||||
aFreq -= s->mtfFreq[ge];
|
||||
ge--;
|
||||
}
|
||||
|
||||
if (s->verbosity >= 3)
|
||||
VPrintf5( " initial group %d, [%d .. %d], "
|
||||
"has %d syms (%4.1f%%)\n",
|
||||
nPart, gs, ge, aFreq,
|
||||
(100.0 * (float)aFreq) / (float)(s->nMTF) );
|
||||
|
||||
for (v = 0; v < alphaSize; v++)
|
||||
if (v >= gs && v <= ge)
|
||||
s->len[nPart-1][v] = BZ_LESSER_ICOST; else
|
||||
s->len[nPart-1][v] = BZ_GREATER_ICOST;
|
||||
|
||||
nPart--;
|
||||
gs = ge+1;
|
||||
remF -= aFreq;
|
||||
}
|
||||
}
|
||||
|
||||
/*---
|
||||
Iterate up to BZ_N_ITERS times to improve the tables.
|
||||
---*/
|
||||
for (iter = 0; iter < BZ_N_ITERS; iter++) {
|
||||
|
||||
for (t = 0; t < nGroups; t++) fave[t] = 0;
|
||||
|
||||
for (t = 0; t < nGroups; t++)
|
||||
for (v = 0; v < alphaSize; v++)
|
||||
s->rfreq[t][v] = 0;
|
||||
|
||||
/*---
|
||||
Set up an auxiliary length table which is used to fast-track
|
||||
the common case (nGroups == 6).
|
||||
---*/
|
||||
if (nGroups == 6) {
|
||||
for (v = 0; v < alphaSize; v++) {
|
||||
s->len_pack[v][0] = (s->len[1][v] << 16) | s->len[0][v];
|
||||
s->len_pack[v][1] = (s->len[3][v] << 16) | s->len[2][v];
|
||||
s->len_pack[v][2] = (s->len[5][v] << 16) | s->len[4][v];
|
||||
}
|
||||
}
|
||||
|
||||
nSelectors = 0;
|
||||
totc = 0;
|
||||
gs = 0;
|
||||
while (True) {
|
||||
|
||||
/*--- Set group start & end marks. --*/
|
||||
if (gs >= s->nMTF) break;
|
||||
ge = gs + BZ_G_SIZE - 1;
|
||||
if (ge >= s->nMTF) ge = s->nMTF-1;
|
||||
|
||||
/*--
|
||||
Calculate the cost of this group as coded
|
||||
by each of the coding tables.
|
||||
--*/
|
||||
for (t = 0; t < nGroups; t++) cost[t] = 0;
|
||||
|
||||
if (nGroups == 6 && 50 == ge-gs+1) {
|
||||
/*--- fast track the common case ---*/
|
||||
register UInt32 cost01, cost23, cost45;
|
||||
register UInt16 icv;
|
||||
cost01 = cost23 = cost45 = 0;
|
||||
|
||||
# define BZ_ITER(nn) \
|
||||
icv = mtfv[gs+(nn)]; \
|
||||
cost01 += s->len_pack[icv][0]; \
|
||||
cost23 += s->len_pack[icv][1]; \
|
||||
cost45 += s->len_pack[icv][2]; \
|
||||
|
||||
BZ_ITER(0); BZ_ITER(1); BZ_ITER(2); BZ_ITER(3); BZ_ITER(4);
|
||||
BZ_ITER(5); BZ_ITER(6); BZ_ITER(7); BZ_ITER(8); BZ_ITER(9);
|
||||
BZ_ITER(10); BZ_ITER(11); BZ_ITER(12); BZ_ITER(13); BZ_ITER(14);
|
||||
BZ_ITER(15); BZ_ITER(16); BZ_ITER(17); BZ_ITER(18); BZ_ITER(19);
|
||||
BZ_ITER(20); BZ_ITER(21); BZ_ITER(22); BZ_ITER(23); BZ_ITER(24);
|
||||
BZ_ITER(25); BZ_ITER(26); BZ_ITER(27); BZ_ITER(28); BZ_ITER(29);
|
||||
BZ_ITER(30); BZ_ITER(31); BZ_ITER(32); BZ_ITER(33); BZ_ITER(34);
|
||||
BZ_ITER(35); BZ_ITER(36); BZ_ITER(37); BZ_ITER(38); BZ_ITER(39);
|
||||
BZ_ITER(40); BZ_ITER(41); BZ_ITER(42); BZ_ITER(43); BZ_ITER(44);
|
||||
BZ_ITER(45); BZ_ITER(46); BZ_ITER(47); BZ_ITER(48); BZ_ITER(49);
|
||||
|
||||
# undef BZ_ITER
|
||||
|
||||
cost[0] = cost01 & 0xffff; cost[1] = cost01 >> 16;
|
||||
cost[2] = cost23 & 0xffff; cost[3] = cost23 >> 16;
|
||||
cost[4] = cost45 & 0xffff; cost[5] = cost45 >> 16;
|
||||
|
||||
} else {
|
||||
/*--- slow version which correctly handles all situations ---*/
|
||||
for (i = gs; i <= ge; i++) {
|
||||
UInt16 icv = mtfv[i];
|
||||
for (t = 0; t < nGroups; t++) cost[t] += s->len[t][icv];
|
||||
}
|
||||
}
|
||||
|
||||
/*--
|
||||
Find the coding table which is best for this group,
|
||||
and record its identity in the selector table.
|
||||
--*/
|
||||
bc = 999999999; bt = -1;
|
||||
for (t = 0; t < nGroups; t++)
|
||||
if (cost[t] < bc) { bc = cost[t]; bt = t; };
|
||||
totc += bc;
|
||||
fave[bt]++;
|
||||
s->selector[nSelectors] = bt;
|
||||
nSelectors++;
|
||||
|
||||
/*--
|
||||
Increment the symbol frequencies for the selected table.
|
||||
--*/
|
||||
if (nGroups == 6 && 50 == ge-gs+1) {
|
||||
/*--- fast track the common case ---*/
|
||||
|
||||
# define BZ_ITUR(nn) s->rfreq[bt][ mtfv[gs+(nn)] ]++
|
||||
|
||||
BZ_ITUR(0); BZ_ITUR(1); BZ_ITUR(2); BZ_ITUR(3); BZ_ITUR(4);
|
||||
BZ_ITUR(5); BZ_ITUR(6); BZ_ITUR(7); BZ_ITUR(8); BZ_ITUR(9);
|
||||
BZ_ITUR(10); BZ_ITUR(11); BZ_ITUR(12); BZ_ITUR(13); BZ_ITUR(14);
|
||||
BZ_ITUR(15); BZ_ITUR(16); BZ_ITUR(17); BZ_ITUR(18); BZ_ITUR(19);
|
||||
BZ_ITUR(20); BZ_ITUR(21); BZ_ITUR(22); BZ_ITUR(23); BZ_ITUR(24);
|
||||
BZ_ITUR(25); BZ_ITUR(26); BZ_ITUR(27); BZ_ITUR(28); BZ_ITUR(29);
|
||||
BZ_ITUR(30); BZ_ITUR(31); BZ_ITUR(32); BZ_ITUR(33); BZ_ITUR(34);
|
||||
BZ_ITUR(35); BZ_ITUR(36); BZ_ITUR(37); BZ_ITUR(38); BZ_ITUR(39);
|
||||
BZ_ITUR(40); BZ_ITUR(41); BZ_ITUR(42); BZ_ITUR(43); BZ_ITUR(44);
|
||||
BZ_ITUR(45); BZ_ITUR(46); BZ_ITUR(47); BZ_ITUR(48); BZ_ITUR(49);
|
||||
|
||||
# undef BZ_ITUR
|
||||
|
||||
} else {
|
||||
/*--- slow version which correctly handles all situations ---*/
|
||||
for (i = gs; i <= ge; i++)
|
||||
s->rfreq[bt][ mtfv[i] ]++;
|
||||
}
|
||||
|
||||
gs = ge+1;
|
||||
}
|
||||
if (s->verbosity >= 3) {
|
||||
VPrintf2 ( " pass %d: size is %d, grp uses are ",
|
||||
iter+1, totc/8 );
|
||||
for (t = 0; t < nGroups; t++)
|
||||
VPrintf1 ( "%d ", fave[t] );
|
||||
VPrintf0 ( "\n" );
|
||||
}
|
||||
|
||||
/*--
|
||||
Recompute the tables based on the accumulated frequencies.
|
||||
--*/
|
||||
/* maxLen was changed from 20 to 17 in bzip2-1.0.3. See
|
||||
comment in huffman.c for details. */
|
||||
for (t = 0; t < nGroups; t++)
|
||||
BZ2_hbMakeCodeLengths ( &(s->len[t][0]), &(s->rfreq[t][0]),
|
||||
alphaSize, 17 /*20*/ );
|
||||
}
|
||||
|
||||
|
||||
AssertH( nGroups < 8, 3002 );
|
||||
AssertH( nSelectors < 32768 &&
|
||||
nSelectors <= (2 + (900000 / BZ_G_SIZE)),
|
||||
3003 );
|
||||
|
||||
|
||||
/*--- Compute MTF values for the selectors. ---*/
|
||||
{
|
||||
UChar pos[BZ_N_GROUPS], ll_i, tmp2, tmp;
|
||||
for (i = 0; i < nGroups; i++) pos[i] = i;
|
||||
for (i = 0; i < nSelectors; i++) {
|
||||
ll_i = s->selector[i];
|
||||
j = 0;
|
||||
tmp = pos[j];
|
||||
while ( ll_i != tmp ) {
|
||||
j++;
|
||||
tmp2 = tmp;
|
||||
tmp = pos[j];
|
||||
pos[j] = tmp2;
|
||||
};
|
||||
pos[0] = tmp;
|
||||
s->selectorMtf[i] = j;
|
||||
}
|
||||
};
|
||||
|
||||
/*--- Assign actual codes for the tables. --*/
|
||||
for (t = 0; t < nGroups; t++) {
|
||||
minLen = 32;
|
||||
maxLen = 0;
|
||||
for (i = 0; i < alphaSize; i++) {
|
||||
if (s->len[t][i] > maxLen) maxLen = s->len[t][i];
|
||||
if (s->len[t][i] < minLen) minLen = s->len[t][i];
|
||||
}
|
||||
AssertH ( !(maxLen > 17 /*20*/ ), 3004 );
|
||||
AssertH ( !(minLen < 1), 3005 );
|
||||
BZ2_hbAssignCodes ( &(s->code[t][0]), &(s->len[t][0]),
|
||||
minLen, maxLen, alphaSize );
|
||||
}
|
||||
|
||||
/*--- Transmit the mapping table. ---*/
|
||||
{
|
||||
Bool inUse16[16];
|
||||
for (i = 0; i < 16; i++) {
|
||||
inUse16[i] = False;
|
||||
for (j = 0; j < 16; j++)
|
||||
if (s->inUse[i * 16 + j]) inUse16[i] = True;
|
||||
}
|
||||
|
||||
nBytes = s->numZ;
|
||||
for (i = 0; i < 16; i++)
|
||||
if (inUse16[i]) bsW(s,1,1); else bsW(s,1,0);
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
if (inUse16[i])
|
||||
for (j = 0; j < 16; j++) {
|
||||
if (s->inUse[i * 16 + j]) bsW(s,1,1); else bsW(s,1,0);
|
||||
}
|
||||
|
||||
if (s->verbosity >= 3)
|
||||
VPrintf1( " bytes: mapping %d, ", s->numZ-nBytes );
|
||||
}
|
||||
|
||||
/*--- Now the selectors. ---*/
|
||||
nBytes = s->numZ;
|
||||
bsW ( s, 3, nGroups );
|
||||
bsW ( s, 15, nSelectors );
|
||||
for (i = 0; i < nSelectors; i++) {
|
||||
for (j = 0; j < s->selectorMtf[i]; j++) bsW(s,1,1);
|
||||
bsW(s,1,0);
|
||||
}
|
||||
if (s->verbosity >= 3)
|
||||
VPrintf1( "selectors %d, ", s->numZ-nBytes );
|
||||
|
||||
/*--- Now the coding tables. ---*/
|
||||
nBytes = s->numZ;
|
||||
|
||||
for (t = 0; t < nGroups; t++) {
|
||||
Int32 curr = s->len[t][0];
|
||||
bsW ( s, 5, curr );
|
||||
for (i = 0; i < alphaSize; i++) {
|
||||
while (curr < s->len[t][i]) { bsW(s,2,2); curr++; /* 10 */ };
|
||||
while (curr > s->len[t][i]) { bsW(s,2,3); curr--; /* 11 */ };
|
||||
bsW ( s, 1, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
if (s->verbosity >= 3)
|
||||
VPrintf1 ( "code lengths %d, ", s->numZ-nBytes );
|
||||
|
||||
/*--- And finally, the block data proper ---*/
|
||||
nBytes = s->numZ;
|
||||
selCtr = 0;
|
||||
gs = 0;
|
||||
while (True) {
|
||||
if (gs >= s->nMTF) break;
|
||||
ge = gs + BZ_G_SIZE - 1;
|
||||
if (ge >= s->nMTF) ge = s->nMTF-1;
|
||||
AssertH ( s->selector[selCtr] < nGroups, 3006 );
|
||||
|
||||
if (nGroups == 6 && 50 == ge-gs+1) {
|
||||
/*--- fast track the common case ---*/
|
||||
UInt16 mtfv_i;
|
||||
UChar* s_len_sel_selCtr
|
||||
= &(s->len[s->selector[selCtr]][0]);
|
||||
Int32* s_code_sel_selCtr
|
||||
= &(s->code[s->selector[selCtr]][0]);
|
||||
|
||||
# define BZ_ITAH(nn) \
|
||||
mtfv_i = mtfv[gs+(nn)]; \
|
||||
bsW ( s, \
|
||||
s_len_sel_selCtr[mtfv_i], \
|
||||
s_code_sel_selCtr[mtfv_i] )
|
||||
|
||||
BZ_ITAH(0); BZ_ITAH(1); BZ_ITAH(2); BZ_ITAH(3); BZ_ITAH(4);
|
||||
BZ_ITAH(5); BZ_ITAH(6); BZ_ITAH(7); BZ_ITAH(8); BZ_ITAH(9);
|
||||
BZ_ITAH(10); BZ_ITAH(11); BZ_ITAH(12); BZ_ITAH(13); BZ_ITAH(14);
|
||||
BZ_ITAH(15); BZ_ITAH(16); BZ_ITAH(17); BZ_ITAH(18); BZ_ITAH(19);
|
||||
BZ_ITAH(20); BZ_ITAH(21); BZ_ITAH(22); BZ_ITAH(23); BZ_ITAH(24);
|
||||
BZ_ITAH(25); BZ_ITAH(26); BZ_ITAH(27); BZ_ITAH(28); BZ_ITAH(29);
|
||||
BZ_ITAH(30); BZ_ITAH(31); BZ_ITAH(32); BZ_ITAH(33); BZ_ITAH(34);
|
||||
BZ_ITAH(35); BZ_ITAH(36); BZ_ITAH(37); BZ_ITAH(38); BZ_ITAH(39);
|
||||
BZ_ITAH(40); BZ_ITAH(41); BZ_ITAH(42); BZ_ITAH(43); BZ_ITAH(44);
|
||||
BZ_ITAH(45); BZ_ITAH(46); BZ_ITAH(47); BZ_ITAH(48); BZ_ITAH(49);
|
||||
|
||||
# undef BZ_ITAH
|
||||
|
||||
} else {
|
||||
/*--- slow version which correctly handles all situations ---*/
|
||||
for (i = gs; i <= ge; i++) {
|
||||
bsW ( s,
|
||||
s->len [s->selector[selCtr]] [mtfv[i]],
|
||||
s->code [s->selector[selCtr]] [mtfv[i]] );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
gs = ge+1;
|
||||
selCtr++;
|
||||
}
|
||||
AssertH( selCtr == nSelectors, 3007 );
|
||||
|
||||
if (s->verbosity >= 3)
|
||||
VPrintf1( "codes %d\n", s->numZ-nBytes );
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
void BZ2_compressBlock ( EState* s, Bool is_last_block )
|
||||
{
|
||||
if (s->nblock > 0) {
|
||||
|
||||
BZ_FINALISE_CRC ( s->blockCRC );
|
||||
s->combinedCRC = (s->combinedCRC << 1) | (s->combinedCRC >> 31);
|
||||
s->combinedCRC ^= s->blockCRC;
|
||||
if (s->blockNo > 1) s->numZ = 0;
|
||||
|
||||
if (s->verbosity >= 2)
|
||||
VPrintf4( " block %d: crc = 0x%08x, "
|
||||
"combined CRC = 0x%08x, size = %d\n",
|
||||
s->blockNo, s->blockCRC, s->combinedCRC, s->nblock );
|
||||
|
||||
BZ2_blockSort ( s );
|
||||
}
|
||||
|
||||
s->zbits = (UChar*) (&((UChar*)s->arr2)[s->nblock]);
|
||||
|
||||
/*-- If this is the first block, create the stream header. --*/
|
||||
if (s->blockNo == 1) {
|
||||
BZ2_bsInitWrite ( s );
|
||||
bsPutUChar ( s, BZ_HDR_B );
|
||||
bsPutUChar ( s, BZ_HDR_Z );
|
||||
bsPutUChar ( s, BZ_HDR_h );
|
||||
bsPutUChar ( s, (UChar)(BZ_HDR_0 + s->blockSize100k) );
|
||||
}
|
||||
|
||||
if (s->nblock > 0) {
|
||||
|
||||
bsPutUChar ( s, 0x31 ); bsPutUChar ( s, 0x41 );
|
||||
bsPutUChar ( s, 0x59 ); bsPutUChar ( s, 0x26 );
|
||||
bsPutUChar ( s, 0x53 ); bsPutUChar ( s, 0x59 );
|
||||
|
||||
/*-- Now the block's CRC, so it is in a known place. --*/
|
||||
bsPutUInt32 ( s, s->blockCRC );
|
||||
|
||||
/*--
|
||||
Now a single bit indicating (non-)randomisation.
|
||||
As of version 0.9.5, we use a better sorting algorithm
|
||||
which makes randomisation unnecessary. So always set
|
||||
the randomised bit to 'no'. Of course, the decoder
|
||||
still needs to be able to handle randomised blocks
|
||||
so as to maintain backwards compatibility with
|
||||
older versions of bzip2.
|
||||
--*/
|
||||
bsW(s,1,0);
|
||||
|
||||
bsW ( s, 24, s->origPtr );
|
||||
generateMTFValues ( s );
|
||||
sendMTFValues ( s );
|
||||
}
|
||||
|
||||
|
||||
/*-- If this is the last block, add the stream trailer. --*/
|
||||
if (is_last_block) {
|
||||
|
||||
bsPutUChar ( s, 0x17 ); bsPutUChar ( s, 0x72 );
|
||||
bsPutUChar ( s, 0x45 ); bsPutUChar ( s, 0x38 );
|
||||
bsPutUChar ( s, 0x50 ); bsPutUChar ( s, 0x90 );
|
||||
bsPutUInt32 ( s, s->combinedCRC );
|
||||
if (s->verbosity >= 2)
|
||||
VPrintf1( " final combined CRC = 0x%08x\n ", s->combinedCRC );
|
||||
bsFinishWrite ( s );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*--- end compress.c ---*/
|
||||
/*-------------------------------------------------------------*/
|
|
@ -1,104 +0,0 @@
|
|||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*--- Table for doing CRCs ---*/
|
||||
/*--- crctable.c ---*/
|
||||
/*-------------------------------------------------------------*/
|
||||
|
||||
/* ------------------------------------------------------------------
|
||||
This file is part of bzip2/libbzip2, a program and library for
|
||||
lossless, block-sorting data compression.
|
||||
|
||||
bzip2/libbzip2 version 1.0.6 of 6 September 2010
|
||||
Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
|
||||
|
||||
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||
README file.
|
||||
|
||||
This program is released under the terms of the license contained
|
||||
in the file LICENSE.
|
||||
------------------------------------------------------------------ */
|
||||
|
||||
|
||||
#include "bzlib_private.h"
|
||||
|
||||
/*--
|
||||
I think this is an implementation of the AUTODIN-II,
|
||||
Ethernet & FDDI 32-bit CRC standard. Vaguely derived
|
||||
from code by Rob Warnock, in Section 51 of the
|
||||
comp.compression FAQ.
|
||||
--*/
|
||||
|
||||
UInt32 BZ2_crc32Table[256] = {
|
||||
|
||||
/*-- Ugly, innit? --*/
|
||||
|
||||
0x00000000L, 0x04c11db7L, 0x09823b6eL, 0x0d4326d9L,
|
||||
0x130476dcL, 0x17c56b6bL, 0x1a864db2L, 0x1e475005L,
|
||||
0x2608edb8L, 0x22c9f00fL, 0x2f8ad6d6L, 0x2b4bcb61L,
|
||||
0x350c9b64L, 0x31cd86d3L, 0x3c8ea00aL, 0x384fbdbdL,
|
||||
0x4c11db70L, 0x48d0c6c7L, 0x4593e01eL, 0x4152fda9L,
|
||||
0x5f15adacL, 0x5bd4b01bL, 0x569796c2L, 0x52568b75L,
|
||||
0x6a1936c8L, 0x6ed82b7fL, 0x639b0da6L, 0x675a1011L,
|
||||
0x791d4014L, 0x7ddc5da3L, 0x709f7b7aL, 0x745e66cdL,
|
||||
0x9823b6e0L, 0x9ce2ab57L, 0x91a18d8eL, 0x95609039L,
|
||||
0x8b27c03cL, 0x8fe6dd8bL, 0x82a5fb52L, 0x8664e6e5L,
|
||||
0xbe2b5b58L, 0xbaea46efL, 0xb7a96036L, 0xb3687d81L,
|
||||
0xad2f2d84L, 0xa9ee3033L, 0xa4ad16eaL, 0xa06c0b5dL,
|
||||
0xd4326d90L, 0xd0f37027L, 0xddb056feL, 0xd9714b49L,
|
||||
0xc7361b4cL, 0xc3f706fbL, 0xceb42022L, 0xca753d95L,
|
||||
0xf23a8028L, 0xf6fb9d9fL, 0xfbb8bb46L, 0xff79a6f1L,
|
||||
0xe13ef6f4L, 0xe5ffeb43L, 0xe8bccd9aL, 0xec7dd02dL,
|
||||
0x34867077L, 0x30476dc0L, 0x3d044b19L, 0x39c556aeL,
|
||||
0x278206abL, 0x23431b1cL, 0x2e003dc5L, 0x2ac12072L,
|
||||
0x128e9dcfL, 0x164f8078L, 0x1b0ca6a1L, 0x1fcdbb16L,
|
||||
0x018aeb13L, 0x054bf6a4L, 0x0808d07dL, 0x0cc9cdcaL,
|
||||
0x7897ab07L, 0x7c56b6b0L, 0x71159069L, 0x75d48ddeL,
|
||||
0x6b93dddbL, 0x6f52c06cL, 0x6211e6b5L, 0x66d0fb02L,
|
||||
0x5e9f46bfL, 0x5a5e5b08L, 0x571d7dd1L, 0x53dc6066L,
|
||||
0x4d9b3063L, 0x495a2dd4L, 0x44190b0dL, 0x40d816baL,
|
||||
0xaca5c697L, 0xa864db20L, 0xa527fdf9L, 0xa1e6e04eL,
|
||||
0xbfa1b04bL, 0xbb60adfcL, 0xb6238b25L, 0xb2e29692L,
|
||||
0x8aad2b2fL, 0x8e6c3698L, 0x832f1041L, 0x87ee0df6L,
|
||||
0x99a95df3L, 0x9d684044L, 0x902b669dL, 0x94ea7b2aL,
|
||||
0xe0b41de7L, 0xe4750050L, 0xe9362689L, 0xedf73b3eL,
|
||||
0xf3b06b3bL, 0xf771768cL, 0xfa325055L, 0xfef34de2L,
|
||||
0xc6bcf05fL, 0xc27dede8L, 0xcf3ecb31L, 0xcbffd686L,
|
||||
0xd5b88683L, 0xd1799b34L, 0xdc3abdedL, 0xd8fba05aL,
|
||||
0x690ce0eeL, 0x6dcdfd59L, 0x608edb80L, 0x644fc637L,
|
||||
0x7a089632L, 0x7ec98b85L, 0x738aad5cL, 0x774bb0ebL,
|
||||
0x4f040d56L, 0x4bc510e1L, 0x46863638L, 0x42472b8fL,
|
||||
0x5c007b8aL, 0x58c1663dL, 0x558240e4L, 0x51435d53L,
|
||||
0x251d3b9eL, 0x21dc2629L, 0x2c9f00f0L, 0x285e1d47L,
|
||||
0x36194d42L, 0x32d850f5L, 0x3f9b762cL, 0x3b5a6b9bL,
|
||||
0x0315d626L, 0x07d4cb91L, 0x0a97ed48L, 0x0e56f0ffL,
|
||||
0x1011a0faL, 0x14d0bd4dL, 0x19939b94L, 0x1d528623L,
|
||||
0xf12f560eL, 0xf5ee4bb9L, 0xf8ad6d60L, 0xfc6c70d7L,
|
||||
0xe22b20d2L, 0xe6ea3d65L, 0xeba91bbcL, 0xef68060bL,
|
||||
0xd727bbb6L, 0xd3e6a601L, 0xdea580d8L, 0xda649d6fL,
|
||||
0xc423cd6aL, 0xc0e2d0ddL, 0xcda1f604L, 0xc960ebb3L,
|
||||
0xbd3e8d7eL, 0xb9ff90c9L, 0xb4bcb610L, 0xb07daba7L,
|
||||
0xae3afba2L, 0xaafbe615L, 0xa7b8c0ccL, 0xa379dd7bL,
|
||||
0x9b3660c6L, 0x9ff77d71L, 0x92b45ba8L, 0x9675461fL,
|
||||
0x8832161aL, 0x8cf30badL, 0x81b02d74L, 0x857130c3L,
|
||||
0x5d8a9099L, 0x594b8d2eL, 0x5408abf7L, 0x50c9b640L,
|
||||
0x4e8ee645L, 0x4a4ffbf2L, 0x470cdd2bL, 0x43cdc09cL,
|
||||
0x7b827d21L, 0x7f436096L, 0x7200464fL, 0x76c15bf8L,
|
||||
0x68860bfdL, 0x6c47164aL, 0x61043093L, 0x65c52d24L,
|
||||
0x119b4be9L, 0x155a565eL, 0x18197087L, 0x1cd86d30L,
|
||||
0x029f3d35L, 0x065e2082L, 0x0b1d065bL, 0x0fdc1becL,
|
||||
0x3793a651L, 0x3352bbe6L, 0x3e119d3fL, 0x3ad08088L,
|
||||
0x2497d08dL, 0x2056cd3aL, 0x2d15ebe3L, 0x29d4f654L,
|
||||
0xc5a92679L, 0xc1683bceL, 0xcc2b1d17L, 0xc8ea00a0L,
|
||||
0xd6ad50a5L, 0xd26c4d12L, 0xdf2f6bcbL, 0xdbee767cL,
|
||||
0xe3a1cbc1L, 0xe760d676L, 0xea23f0afL, 0xeee2ed18L,
|
||||
0xf0a5bd1dL, 0xf464a0aaL, 0xf9278673L, 0xfde69bc4L,
|
||||
0x89b8fd09L, 0x8d79e0beL, 0x803ac667L, 0x84fbdbd0L,
|
||||
0x9abc8bd5L, 0x9e7d9662L, 0x933eb0bbL, 0x97ffad0cL,
|
||||
0xafb010b1L, 0xab710d06L, 0xa6322bdfL, 0xa2f33668L,
|
||||
0xbcb4666dL, 0xb8757bdaL, 0xb5365d03L, 0xb1f740b4L
|
||||
};
|
||||
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*--- end crctable.c ---*/
|
||||
/*-------------------------------------------------------------*/
|
|
@ -1,646 +0,0 @@
|
|||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*--- Decompression machinery ---*/
|
||||
/*--- decompress.c ---*/
|
||||
/*-------------------------------------------------------------*/
|
||||
|
||||
/* ------------------------------------------------------------------
|
||||
This file is part of bzip2/libbzip2, a program and library for
|
||||
lossless, block-sorting data compression.
|
||||
|
||||
bzip2/libbzip2 version 1.0.6 of 6 September 2010
|
||||
Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
|
||||
|
||||
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||
README file.
|
||||
|
||||
This program is released under the terms of the license contained
|
||||
in the file LICENSE.
|
||||
------------------------------------------------------------------ */
|
||||
|
||||
|
||||
#include "bzlib_private.h"
|
||||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
static
|
||||
void makeMaps_d ( DState* s )
|
||||
{
|
||||
Int32 i;
|
||||
s->nInUse = 0;
|
||||
for (i = 0; i < 256; i++)
|
||||
if (s->inUse[i]) {
|
||||
s->seqToUnseq[s->nInUse] = i;
|
||||
s->nInUse++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
#define RETURN(rrr) \
|
||||
{ retVal = rrr; goto save_state_and_return; };
|
||||
|
||||
#define GET_BITS(lll,vvv,nnn) \
|
||||
case lll: s->state = lll; \
|
||||
while (True) { \
|
||||
if (s->bsLive >= nnn) { \
|
||||
UInt32 v; \
|
||||
v = (s->bsBuff >> \
|
||||
(s->bsLive-nnn)) & ((1 << nnn)-1); \
|
||||
s->bsLive -= nnn; \
|
||||
vvv = v; \
|
||||
break; \
|
||||
} \
|
||||
if (s->strm->avail_in == 0) RETURN(BZ_OK); \
|
||||
s->bsBuff \
|
||||
= (s->bsBuff << 8) | \
|
||||
((UInt32) \
|
||||
(*((UChar*)(s->strm->next_in)))); \
|
||||
s->bsLive += 8; \
|
||||
s->strm->next_in++; \
|
||||
s->strm->avail_in--; \
|
||||
s->strm->total_in_lo32++; \
|
||||
if (s->strm->total_in_lo32 == 0) \
|
||||
s->strm->total_in_hi32++; \
|
||||
}
|
||||
|
||||
#define GET_UCHAR(lll,uuu) \
|
||||
GET_BITS(lll,uuu,8)
|
||||
|
||||
#define GET_BIT(lll,uuu) \
|
||||
GET_BITS(lll,uuu,1)
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
#define GET_MTF_VAL(label1,label2,lval) \
|
||||
{ \
|
||||
if (groupPos == 0) { \
|
||||
groupNo++; \
|
||||
if (groupNo >= nSelectors) \
|
||||
RETURN(BZ_DATA_ERROR); \
|
||||
groupPos = BZ_G_SIZE; \
|
||||
gSel = s->selector[groupNo]; \
|
||||
gMinlen = s->minLens[gSel]; \
|
||||
gLimit = &(s->limit[gSel][0]); \
|
||||
gPerm = &(s->perm[gSel][0]); \
|
||||
gBase = &(s->base[gSel][0]); \
|
||||
} \
|
||||
groupPos--; \
|
||||
zn = gMinlen; \
|
||||
GET_BITS(label1, zvec, zn); \
|
||||
while (1) { \
|
||||
if (zn > 20 /* the longest code */) \
|
||||
RETURN(BZ_DATA_ERROR); \
|
||||
if (zvec <= gLimit[zn]) break; \
|
||||
zn++; \
|
||||
GET_BIT(label2, zj); \
|
||||
zvec = (zvec << 1) | zj; \
|
||||
}; \
|
||||
if (zvec - gBase[zn] < 0 \
|
||||
|| zvec - gBase[zn] >= BZ_MAX_ALPHA_SIZE) \
|
||||
RETURN(BZ_DATA_ERROR); \
|
||||
lval = gPerm[zvec - gBase[zn]]; \
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
Int32 BZ2_decompress ( DState* s )
|
||||
{
|
||||
UChar uc;
|
||||
Int32 retVal;
|
||||
Int32 minLen, maxLen;
|
||||
bz_stream* strm = s->strm;
|
||||
|
||||
/* stuff that needs to be saved/restored */
|
||||
Int32 i;
|
||||
Int32 j;
|
||||
Int32 t;
|
||||
Int32 alphaSize;
|
||||
Int32 nGroups;
|
||||
Int32 nSelectors;
|
||||
Int32 EOB;
|
||||
Int32 groupNo;
|
||||
Int32 groupPos;
|
||||
Int32 nextSym;
|
||||
Int32 nblockMAX;
|
||||
Int32 nblock;
|
||||
Int32 es;
|
||||
Int32 N;
|
||||
Int32 curr;
|
||||
Int32 zt;
|
||||
Int32 zn;
|
||||
Int32 zvec;
|
||||
Int32 zj;
|
||||
Int32 gSel;
|
||||
Int32 gMinlen;
|
||||
Int32* gLimit;
|
||||
Int32* gBase;
|
||||
Int32* gPerm;
|
||||
|
||||
if (s->state == BZ_X_MAGIC_1) {
|
||||
/*initialise the save area*/
|
||||
s->save_i = 0;
|
||||
s->save_j = 0;
|
||||
s->save_t = 0;
|
||||
s->save_alphaSize = 0;
|
||||
s->save_nGroups = 0;
|
||||
s->save_nSelectors = 0;
|
||||
s->save_EOB = 0;
|
||||
s->save_groupNo = 0;
|
||||
s->save_groupPos = 0;
|
||||
s->save_nextSym = 0;
|
||||
s->save_nblockMAX = 0;
|
||||
s->save_nblock = 0;
|
||||
s->save_es = 0;
|
||||
s->save_N = 0;
|
||||
s->save_curr = 0;
|
||||
s->save_zt = 0;
|
||||
s->save_zn = 0;
|
||||
s->save_zvec = 0;
|
||||
s->save_zj = 0;
|
||||
s->save_gSel = 0;
|
||||
s->save_gMinlen = 0;
|
||||
s->save_gLimit = NULL;
|
||||
s->save_gBase = NULL;
|
||||
s->save_gPerm = NULL;
|
||||
}
|
||||
|
||||
/*restore from the save area*/
|
||||
i = s->save_i;
|
||||
j = s->save_j;
|
||||
t = s->save_t;
|
||||
alphaSize = s->save_alphaSize;
|
||||
nGroups = s->save_nGroups;
|
||||
nSelectors = s->save_nSelectors;
|
||||
EOB = s->save_EOB;
|
||||
groupNo = s->save_groupNo;
|
||||
groupPos = s->save_groupPos;
|
||||
nextSym = s->save_nextSym;
|
||||
nblockMAX = s->save_nblockMAX;
|
||||
nblock = s->save_nblock;
|
||||
es = s->save_es;
|
||||
N = s->save_N;
|
||||
curr = s->save_curr;
|
||||
zt = s->save_zt;
|
||||
zn = s->save_zn;
|
||||
zvec = s->save_zvec;
|
||||
zj = s->save_zj;
|
||||
gSel = s->save_gSel;
|
||||
gMinlen = s->save_gMinlen;
|
||||
gLimit = s->save_gLimit;
|
||||
gBase = s->save_gBase;
|
||||
gPerm = s->save_gPerm;
|
||||
|
||||
retVal = BZ_OK;
|
||||
|
||||
switch (s->state) {
|
||||
|
||||
GET_UCHAR(BZ_X_MAGIC_1, uc);
|
||||
if (uc != BZ_HDR_B) RETURN(BZ_DATA_ERROR_MAGIC);
|
||||
|
||||
GET_UCHAR(BZ_X_MAGIC_2, uc);
|
||||
if (uc != BZ_HDR_Z) RETURN(BZ_DATA_ERROR_MAGIC);
|
||||
|
||||
GET_UCHAR(BZ_X_MAGIC_3, uc)
|
||||
if (uc != BZ_HDR_h) RETURN(BZ_DATA_ERROR_MAGIC);
|
||||
|
||||
GET_BITS(BZ_X_MAGIC_4, s->blockSize100k, 8)
|
||||
if (s->blockSize100k < (BZ_HDR_0 + 1) ||
|
||||
s->blockSize100k > (BZ_HDR_0 + 9)) RETURN(BZ_DATA_ERROR_MAGIC);
|
||||
s->blockSize100k -= BZ_HDR_0;
|
||||
|
||||
if (s->smallDecompress) {
|
||||
s->ll16 = BZALLOC( s->blockSize100k * 100000 * sizeof(UInt16) );
|
||||
s->ll4 = BZALLOC(
|
||||
((1 + s->blockSize100k * 100000) >> 1) * sizeof(UChar)
|
||||
);
|
||||
if (s->ll16 == NULL || s->ll4 == NULL) RETURN(BZ_MEM_ERROR);
|
||||
} else {
|
||||
s->tt = BZALLOC( s->blockSize100k * 100000 * sizeof(Int32) );
|
||||
if (s->tt == NULL) RETURN(BZ_MEM_ERROR);
|
||||
}
|
||||
|
||||
GET_UCHAR(BZ_X_BLKHDR_1, uc);
|
||||
|
||||
if (uc == 0x17) goto endhdr_2;
|
||||
if (uc != 0x31) RETURN(BZ_DATA_ERROR);
|
||||
GET_UCHAR(BZ_X_BLKHDR_2, uc);
|
||||
if (uc != 0x41) RETURN(BZ_DATA_ERROR);
|
||||
GET_UCHAR(BZ_X_BLKHDR_3, uc);
|
||||
if (uc != 0x59) RETURN(BZ_DATA_ERROR);
|
||||
GET_UCHAR(BZ_X_BLKHDR_4, uc);
|
||||
if (uc != 0x26) RETURN(BZ_DATA_ERROR);
|
||||
GET_UCHAR(BZ_X_BLKHDR_5, uc);
|
||||
if (uc != 0x53) RETURN(BZ_DATA_ERROR);
|
||||
GET_UCHAR(BZ_X_BLKHDR_6, uc);
|
||||
if (uc != 0x59) RETURN(BZ_DATA_ERROR);
|
||||
|
||||
s->currBlockNo++;
|
||||
if (s->verbosity >= 2)
|
||||
VPrintf1 ( "\n [%d: huff+mtf ", s->currBlockNo );
|
||||
|
||||
s->storedBlockCRC = 0;
|
||||
GET_UCHAR(BZ_X_BCRC_1, uc);
|
||||
s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc);
|
||||
GET_UCHAR(BZ_X_BCRC_2, uc);
|
||||
s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc);
|
||||
GET_UCHAR(BZ_X_BCRC_3, uc);
|
||||
s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc);
|
||||
GET_UCHAR(BZ_X_BCRC_4, uc);
|
||||
s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc);
|
||||
|
||||
GET_BITS(BZ_X_RANDBIT, s->blockRandomised, 1);
|
||||
|
||||
s->origPtr = 0;
|
||||
GET_UCHAR(BZ_X_ORIGPTR_1, uc);
|
||||
s->origPtr = (s->origPtr << 8) | ((Int32)uc);
|
||||
GET_UCHAR(BZ_X_ORIGPTR_2, uc);
|
||||
s->origPtr = (s->origPtr << 8) | ((Int32)uc);
|
||||
GET_UCHAR(BZ_X_ORIGPTR_3, uc);
|
||||
s->origPtr = (s->origPtr << 8) | ((Int32)uc);
|
||||
|
||||
if (s->origPtr < 0)
|
||||
RETURN(BZ_DATA_ERROR);
|
||||
if (s->origPtr > 10 + 100000*s->blockSize100k)
|
||||
RETURN(BZ_DATA_ERROR);
|
||||
|
||||
/*--- Receive the mapping table ---*/
|
||||
for (i = 0; i < 16; i++) {
|
||||
GET_BIT(BZ_X_MAPPING_1, uc);
|
||||
if (uc == 1)
|
||||
s->inUse16[i] = True; else
|
||||
s->inUse16[i] = False;
|
||||
}
|
||||
|
||||
for (i = 0; i < 256; i++) s->inUse[i] = False;
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
if (s->inUse16[i])
|
||||
for (j = 0; j < 16; j++) {
|
||||
GET_BIT(BZ_X_MAPPING_2, uc);
|
||||
if (uc == 1) s->inUse[i * 16 + j] = True;
|
||||
}
|
||||
makeMaps_d ( s );
|
||||
if (s->nInUse == 0) RETURN(BZ_DATA_ERROR);
|
||||
alphaSize = s->nInUse+2;
|
||||
|
||||
/*--- Now the selectors ---*/
|
||||
GET_BITS(BZ_X_SELECTOR_1, nGroups, 3);
|
||||
if (nGroups < 2 || nGroups > 6) RETURN(BZ_DATA_ERROR);
|
||||
GET_BITS(BZ_X_SELECTOR_2, nSelectors, 15);
|
||||
if (nSelectors < 1) RETURN(BZ_DATA_ERROR);
|
||||
for (i = 0; i < nSelectors; i++) {
|
||||
j = 0;
|
||||
while (True) {
|
||||
GET_BIT(BZ_X_SELECTOR_3, uc);
|
||||
if (uc == 0) break;
|
||||
j++;
|
||||
if (j >= nGroups) RETURN(BZ_DATA_ERROR);
|
||||
}
|
||||
s->selectorMtf[i] = j;
|
||||
}
|
||||
|
||||
/*--- Undo the MTF values for the selectors. ---*/
|
||||
{
|
||||
UChar pos[BZ_N_GROUPS], tmp, v;
|
||||
for (v = 0; v < nGroups; v++) pos[v] = v;
|
||||
|
||||
for (i = 0; i < nSelectors; i++) {
|
||||
v = s->selectorMtf[i];
|
||||
tmp = pos[v];
|
||||
while (v > 0) { pos[v] = pos[v-1]; v--; }
|
||||
pos[0] = tmp;
|
||||
s->selector[i] = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
/*--- Now the coding tables ---*/
|
||||
for (t = 0; t < nGroups; t++) {
|
||||
GET_BITS(BZ_X_CODING_1, curr, 5);
|
||||
for (i = 0; i < alphaSize; i++) {
|
||||
while (True) {
|
||||
if (curr < 1 || curr > 20) RETURN(BZ_DATA_ERROR);
|
||||
GET_BIT(BZ_X_CODING_2, uc);
|
||||
if (uc == 0) break;
|
||||
GET_BIT(BZ_X_CODING_3, uc);
|
||||
if (uc == 0) curr++; else curr--;
|
||||
}
|
||||
s->len[t][i] = curr;
|
||||
}
|
||||
}
|
||||
|
||||
/*--- Create the Huffman decoding tables ---*/
|
||||
for (t = 0; t < nGroups; t++) {
|
||||
minLen = 32;
|
||||
maxLen = 0;
|
||||
for (i = 0; i < alphaSize; i++) {
|
||||
if (s->len[t][i] > maxLen) maxLen = s->len[t][i];
|
||||
if (s->len[t][i] < minLen) minLen = s->len[t][i];
|
||||
}
|
||||
BZ2_hbCreateDecodeTables (
|
||||
&(s->limit[t][0]),
|
||||
&(s->base[t][0]),
|
||||
&(s->perm[t][0]),
|
||||
&(s->len[t][0]),
|
||||
minLen, maxLen, alphaSize
|
||||
);
|
||||
s->minLens[t] = minLen;
|
||||
}
|
||||
|
||||
/*--- Now the MTF values ---*/
|
||||
|
||||
EOB = s->nInUse+1;
|
||||
nblockMAX = 100000 * s->blockSize100k;
|
||||
groupNo = -1;
|
||||
groupPos = 0;
|
||||
|
||||
for (i = 0; i <= 255; i++) s->unzftab[i] = 0;
|
||||
|
||||
/*-- MTF init --*/
|
||||
{
|
||||
Int32 ii, jj, kk;
|
||||
kk = MTFA_SIZE-1;
|
||||
for (ii = 256 / MTFL_SIZE - 1; ii >= 0; ii--) {
|
||||
for (jj = MTFL_SIZE-1; jj >= 0; jj--) {
|
||||
s->mtfa[kk] = (UChar)(ii * MTFL_SIZE + jj);
|
||||
kk--;
|
||||
}
|
||||
s->mtfbase[ii] = kk + 1;
|
||||
}
|
||||
}
|
||||
/*-- end MTF init --*/
|
||||
|
||||
nblock = 0;
|
||||
GET_MTF_VAL(BZ_X_MTF_1, BZ_X_MTF_2, nextSym);
|
||||
|
||||
while (True) {
|
||||
|
||||
if (nextSym == EOB) break;
|
||||
|
||||
if (nextSym == BZ_RUNA || nextSym == BZ_RUNB) {
|
||||
|
||||
es = -1;
|
||||
N = 1;
|
||||
do {
|
||||
/* Check that N doesn't get too big, so that es doesn't
|
||||
go negative. The maximum value that can be
|
||||
RUNA/RUNB encoded is equal to the block size (post
|
||||
the initial RLE), viz, 900k, so bounding N at 2
|
||||
million should guard against overflow without
|
||||
rejecting any legitimate inputs. */
|
||||
if (N >= 2*1024*1024) RETURN(BZ_DATA_ERROR);
|
||||
if (nextSym == BZ_RUNA) es = es + (0+1) * N; else
|
||||
if (nextSym == BZ_RUNB) es = es + (1+1) * N;
|
||||
N = N * 2;
|
||||
GET_MTF_VAL(BZ_X_MTF_3, BZ_X_MTF_4, nextSym);
|
||||
}
|
||||
while (nextSym == BZ_RUNA || nextSym == BZ_RUNB);
|
||||
|
||||
es++;
|
||||
uc = s->seqToUnseq[ s->mtfa[s->mtfbase[0]] ];
|
||||
s->unzftab[uc] += es;
|
||||
|
||||
if (s->smallDecompress)
|
||||
while (es > 0) {
|
||||
if (nblock >= nblockMAX) RETURN(BZ_DATA_ERROR);
|
||||
s->ll16[nblock] = (UInt16)uc;
|
||||
nblock++;
|
||||
es--;
|
||||
}
|
||||
else
|
||||
while (es > 0) {
|
||||
if (nblock >= nblockMAX) RETURN(BZ_DATA_ERROR);
|
||||
s->tt[nblock] = (UInt32)uc;
|
||||
nblock++;
|
||||
es--;
|
||||
};
|
||||
|
||||
continue;
|
||||
|
||||
} else {
|
||||
|
||||
if (nblock >= nblockMAX) RETURN(BZ_DATA_ERROR);
|
||||
|
||||
/*-- uc = MTF ( nextSym-1 ) --*/
|
||||
{
|
||||
Int32 ii, jj, kk, pp, lno, off;
|
||||
UInt32 nn;
|
||||
nn = (UInt32)(nextSym - 1);
|
||||
|
||||
if (nn < MTFL_SIZE) {
|
||||
/* avoid general-case expense */
|
||||
pp = s->mtfbase[0];
|
||||
uc = s->mtfa[pp+nn];
|
||||
while (nn > 3) {
|
||||
Int32 z = pp+nn;
|
||||
s->mtfa[(z) ] = s->mtfa[(z)-1];
|
||||
s->mtfa[(z)-1] = s->mtfa[(z)-2];
|
||||
s->mtfa[(z)-2] = s->mtfa[(z)-3];
|
||||
s->mtfa[(z)-3] = s->mtfa[(z)-4];
|
||||
nn -= 4;
|
||||
}
|
||||
while (nn > 0) {
|
||||
s->mtfa[(pp+nn)] = s->mtfa[(pp+nn)-1]; nn--;
|
||||
};
|
||||
s->mtfa[pp] = uc;
|
||||
} else {
|
||||
/* general case */
|
||||
lno = nn / MTFL_SIZE;
|
||||
off = nn % MTFL_SIZE;
|
||||
pp = s->mtfbase[lno] + off;
|
||||
uc = s->mtfa[pp];
|
||||
while (pp > s->mtfbase[lno]) {
|
||||
s->mtfa[pp] = s->mtfa[pp-1]; pp--;
|
||||
};
|
||||
s->mtfbase[lno]++;
|
||||
while (lno > 0) {
|
||||
s->mtfbase[lno]--;
|
||||
s->mtfa[s->mtfbase[lno]]
|
||||
= s->mtfa[s->mtfbase[lno-1] + MTFL_SIZE - 1];
|
||||
lno--;
|
||||
}
|
||||
s->mtfbase[0]--;
|
||||
s->mtfa[s->mtfbase[0]] = uc;
|
||||
if (s->mtfbase[0] == 0) {
|
||||
kk = MTFA_SIZE-1;
|
||||
for (ii = 256 / MTFL_SIZE-1; ii >= 0; ii--) {
|
||||
for (jj = MTFL_SIZE-1; jj >= 0; jj--) {
|
||||
s->mtfa[kk] = s->mtfa[s->mtfbase[ii] + jj];
|
||||
kk--;
|
||||
}
|
||||
s->mtfbase[ii] = kk + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*-- end uc = MTF ( nextSym-1 ) --*/
|
||||
|
||||
s->unzftab[s->seqToUnseq[uc]]++;
|
||||
if (s->smallDecompress)
|
||||
s->ll16[nblock] = (UInt16)(s->seqToUnseq[uc]); else
|
||||
s->tt[nblock] = (UInt32)(s->seqToUnseq[uc]);
|
||||
nblock++;
|
||||
|
||||
GET_MTF_VAL(BZ_X_MTF_5, BZ_X_MTF_6, nextSym);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* Now we know what nblock is, we can do a better sanity
|
||||
check on s->origPtr.
|
||||
*/
|
||||
if (s->origPtr < 0 || s->origPtr >= nblock)
|
||||
RETURN(BZ_DATA_ERROR);
|
||||
|
||||
/*-- Set up cftab to facilitate generation of T^(-1) --*/
|
||||
/* Check: unzftab entries in range. */
|
||||
for (i = 0; i <= 255; i++) {
|
||||
if (s->unzftab[i] < 0 || s->unzftab[i] > nblock)
|
||||
RETURN(BZ_DATA_ERROR);
|
||||
}
|
||||
/* Actually generate cftab. */
|
||||
s->cftab[0] = 0;
|
||||
for (i = 1; i <= 256; i++) s->cftab[i] = s->unzftab[i-1];
|
||||
for (i = 1; i <= 256; i++) s->cftab[i] += s->cftab[i-1];
|
||||
/* Check: cftab entries in range. */
|
||||
for (i = 0; i <= 256; i++) {
|
||||
if (s->cftab[i] < 0 || s->cftab[i] > nblock) {
|
||||
/* s->cftab[i] can legitimately be == nblock */
|
||||
RETURN(BZ_DATA_ERROR);
|
||||
}
|
||||
}
|
||||
/* Check: cftab entries non-descending. */
|
||||
for (i = 1; i <= 256; i++) {
|
||||
if (s->cftab[i-1] > s->cftab[i]) {
|
||||
RETURN(BZ_DATA_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
s->state_out_len = 0;
|
||||
s->state_out_ch = 0;
|
||||
BZ_INITIALISE_CRC ( s->calculatedBlockCRC );
|
||||
s->state = BZ_X_OUTPUT;
|
||||
if (s->verbosity >= 2) VPrintf0 ( "rt+rld" );
|
||||
|
||||
if (s->smallDecompress) {
|
||||
|
||||
/*-- Make a copy of cftab, used in generation of T --*/
|
||||
for (i = 0; i <= 256; i++) s->cftabCopy[i] = s->cftab[i];
|
||||
|
||||
/*-- compute the T vector --*/
|
||||
for (i = 0; i < nblock; i++) {
|
||||
uc = (UChar)(s->ll16[i]);
|
||||
SET_LL(i, s->cftabCopy[uc]);
|
||||
s->cftabCopy[uc]++;
|
||||
}
|
||||
|
||||
/*-- Compute T^(-1) by pointer reversal on T --*/
|
||||
i = s->origPtr;
|
||||
j = GET_LL(i);
|
||||
do {
|
||||
Int32 tmp = GET_LL(j);
|
||||
SET_LL(j, i);
|
||||
i = j;
|
||||
j = tmp;
|
||||
}
|
||||
while (i != s->origPtr);
|
||||
|
||||
s->tPos = s->origPtr;
|
||||
s->nblock_used = 0;
|
||||
if (s->blockRandomised) {
|
||||
BZ_RAND_INIT_MASK;
|
||||
BZ_GET_SMALL(s->k0); s->nblock_used++;
|
||||
BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK;
|
||||
} else {
|
||||
BZ_GET_SMALL(s->k0); s->nblock_used++;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
/*-- compute the T^(-1) vector --*/
|
||||
for (i = 0; i < nblock; i++) {
|
||||
uc = (UChar)(s->tt[i] & 0xff);
|
||||
s->tt[s->cftab[uc]] |= (i << 8);
|
||||
s->cftab[uc]++;
|
||||
}
|
||||
|
||||
s->tPos = s->tt[s->origPtr] >> 8;
|
||||
s->nblock_used = 0;
|
||||
if (s->blockRandomised) {
|
||||
BZ_RAND_INIT_MASK;
|
||||
BZ_GET_FAST(s->k0); s->nblock_used++;
|
||||
BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK;
|
||||
} else {
|
||||
BZ_GET_FAST(s->k0); s->nblock_used++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
RETURN(BZ_OK);
|
||||
|
||||
|
||||
|
||||
endhdr_2:
|
||||
|
||||
GET_UCHAR(BZ_X_ENDHDR_2, uc);
|
||||
if (uc != 0x72) RETURN(BZ_DATA_ERROR);
|
||||
GET_UCHAR(BZ_X_ENDHDR_3, uc);
|
||||
if (uc != 0x45) RETURN(BZ_DATA_ERROR);
|
||||
GET_UCHAR(BZ_X_ENDHDR_4, uc);
|
||||
if (uc != 0x38) RETURN(BZ_DATA_ERROR);
|
||||
GET_UCHAR(BZ_X_ENDHDR_5, uc);
|
||||
if (uc != 0x50) RETURN(BZ_DATA_ERROR);
|
||||
GET_UCHAR(BZ_X_ENDHDR_6, uc);
|
||||
if (uc != 0x90) RETURN(BZ_DATA_ERROR);
|
||||
|
||||
s->storedCombinedCRC = 0;
|
||||
GET_UCHAR(BZ_X_CCRC_1, uc);
|
||||
s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc);
|
||||
GET_UCHAR(BZ_X_CCRC_2, uc);
|
||||
s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc);
|
||||
GET_UCHAR(BZ_X_CCRC_3, uc);
|
||||
s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc);
|
||||
GET_UCHAR(BZ_X_CCRC_4, uc);
|
||||
s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc);
|
||||
|
||||
s->state = BZ_X_IDLE;
|
||||
RETURN(BZ_STREAM_END);
|
||||
|
||||
default: AssertH ( False, 4001 );
|
||||
}
|
||||
|
||||
AssertH ( False, 4002 );
|
||||
|
||||
save_state_and_return:
|
||||
|
||||
s->save_i = i;
|
||||
s->save_j = j;
|
||||
s->save_t = t;
|
||||
s->save_alphaSize = alphaSize;
|
||||
s->save_nGroups = nGroups;
|
||||
s->save_nSelectors = nSelectors;
|
||||
s->save_EOB = EOB;
|
||||
s->save_groupNo = groupNo;
|
||||
s->save_groupPos = groupPos;
|
||||
s->save_nextSym = nextSym;
|
||||
s->save_nblockMAX = nblockMAX;
|
||||
s->save_nblock = nblock;
|
||||
s->save_es = es;
|
||||
s->save_N = N;
|
||||
s->save_curr = curr;
|
||||
s->save_zt = zt;
|
||||
s->save_zn = zn;
|
||||
s->save_zvec = zvec;
|
||||
s->save_zj = zj;
|
||||
s->save_gSel = gSel;
|
||||
s->save_gMinlen = gMinlen;
|
||||
s->save_gLimit = gLimit;
|
||||
s->save_gBase = gBase;
|
||||
s->save_gPerm = gPerm;
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*--- end decompress.c ---*/
|
||||
/*-------------------------------------------------------------*/
|
|
@ -1,205 +0,0 @@
|
|||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*--- Huffman coding low-level stuff ---*/
|
||||
/*--- huffman.c ---*/
|
||||
/*-------------------------------------------------------------*/
|
||||
|
||||
/* ------------------------------------------------------------------
|
||||
This file is part of bzip2/libbzip2, a program and library for
|
||||
lossless, block-sorting data compression.
|
||||
|
||||
bzip2/libbzip2 version 1.0.6 of 6 September 2010
|
||||
Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
|
||||
|
||||
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||
README file.
|
||||
|
||||
This program is released under the terms of the license contained
|
||||
in the file LICENSE.
|
||||
------------------------------------------------------------------ */
|
||||
|
||||
|
||||
#include "bzlib_private.h"
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
#define WEIGHTOF(zz0) ((zz0) & 0xffffff00)
|
||||
#define DEPTHOF(zz1) ((zz1) & 0x000000ff)
|
||||
#define MYMAX(zz2,zz3) ((zz2) > (zz3) ? (zz2) : (zz3))
|
||||
|
||||
#define ADDWEIGHTS(zw1,zw2) \
|
||||
(WEIGHTOF(zw1)+WEIGHTOF(zw2)) | \
|
||||
(1 + MYMAX(DEPTHOF(zw1),DEPTHOF(zw2)))
|
||||
|
||||
#define UPHEAP(z) \
|
||||
{ \
|
||||
Int32 zz, tmp; \
|
||||
zz = z; tmp = heap[zz]; \
|
||||
while (weight[tmp] < weight[heap[zz >> 1]]) { \
|
||||
heap[zz] = heap[zz >> 1]; \
|
||||
zz >>= 1; \
|
||||
} \
|
||||
heap[zz] = tmp; \
|
||||
}
|
||||
|
||||
#define DOWNHEAP(z) \
|
||||
{ \
|
||||
Int32 zz, yy, tmp; \
|
||||
zz = z; tmp = heap[zz]; \
|
||||
while (True) { \
|
||||
yy = zz << 1; \
|
||||
if (yy > nHeap) break; \
|
||||
if (yy < nHeap && \
|
||||
weight[heap[yy+1]] < weight[heap[yy]]) \
|
||||
yy++; \
|
||||
if (weight[tmp] < weight[heap[yy]]) break; \
|
||||
heap[zz] = heap[yy]; \
|
||||
zz = yy; \
|
||||
} \
|
||||
heap[zz] = tmp; \
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
void BZ2_hbMakeCodeLengths ( UChar *len,
|
||||
Int32 *freq,
|
||||
Int32 alphaSize,
|
||||
Int32 maxLen )
|
||||
{
|
||||
/*--
|
||||
Nodes and heap entries run from 1. Entry 0
|
||||
for both the heap and nodes is a sentinel.
|
||||
--*/
|
||||
Int32 nNodes, nHeap, n1, n2, i, j, k;
|
||||
Bool tooLong;
|
||||
|
||||
Int32 heap [ BZ_MAX_ALPHA_SIZE + 2 ];
|
||||
Int32 weight [ BZ_MAX_ALPHA_SIZE * 2 ];
|
||||
Int32 parent [ BZ_MAX_ALPHA_SIZE * 2 ];
|
||||
|
||||
for (i = 0; i < alphaSize; i++)
|
||||
weight[i+1] = (freq[i] == 0 ? 1 : freq[i]) << 8;
|
||||
|
||||
while (True) {
|
||||
|
||||
nNodes = alphaSize;
|
||||
nHeap = 0;
|
||||
|
||||
heap[0] = 0;
|
||||
weight[0] = 0;
|
||||
parent[0] = -2;
|
||||
|
||||
for (i = 1; i <= alphaSize; i++) {
|
||||
parent[i] = -1;
|
||||
nHeap++;
|
||||
heap[nHeap] = i;
|
||||
UPHEAP(nHeap);
|
||||
}
|
||||
|
||||
AssertH( nHeap < (BZ_MAX_ALPHA_SIZE+2), 2001 );
|
||||
|
||||
while (nHeap > 1) {
|
||||
n1 = heap[1]; heap[1] = heap[nHeap]; nHeap--; DOWNHEAP(1);
|
||||
n2 = heap[1]; heap[1] = heap[nHeap]; nHeap--; DOWNHEAP(1);
|
||||
nNodes++;
|
||||
parent[n1] = parent[n2] = nNodes;
|
||||
weight[nNodes] = ADDWEIGHTS(weight[n1], weight[n2]);
|
||||
parent[nNodes] = -1;
|
||||
nHeap++;
|
||||
heap[nHeap] = nNodes;
|
||||
UPHEAP(nHeap);
|
||||
}
|
||||
|
||||
AssertH( nNodes < (BZ_MAX_ALPHA_SIZE * 2), 2002 );
|
||||
|
||||
tooLong = False;
|
||||
for (i = 1; i <= alphaSize; i++) {
|
||||
j = 0;
|
||||
k = i;
|
||||
while (parent[k] >= 0) { k = parent[k]; j++; }
|
||||
len[i-1] = j;
|
||||
if (j > maxLen) tooLong = True;
|
||||
}
|
||||
|
||||
if (! tooLong) break;
|
||||
|
||||
/* 17 Oct 04: keep-going condition for the following loop used
|
||||
to be 'i < alphaSize', which missed the last element,
|
||||
theoretically leading to the possibility of the compressor
|
||||
looping. However, this count-scaling step is only needed if
|
||||
one of the generated Huffman code words is longer than
|
||||
maxLen, which up to and including version 1.0.2 was 20 bits,
|
||||
which is extremely unlikely. In version 1.0.3 maxLen was
|
||||
changed to 17 bits, which has minimal effect on compression
|
||||
ratio, but does mean this scaling step is used from time to
|
||||
time, enough to verify that it works.
|
||||
|
||||
This means that bzip2-1.0.3 and later will only produce
|
||||
Huffman codes with a maximum length of 17 bits. However, in
|
||||
order to preserve backwards compatibility with bitstreams
|
||||
produced by versions pre-1.0.3, the decompressor must still
|
||||
handle lengths of up to 20. */
|
||||
|
||||
for (i = 1; i <= alphaSize; i++) {
|
||||
j = weight[i] >> 8;
|
||||
j = 1 + (j / 2);
|
||||
weight[i] = j << 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
void BZ2_hbAssignCodes ( Int32 *code,
|
||||
UChar *length,
|
||||
Int32 minLen,
|
||||
Int32 maxLen,
|
||||
Int32 alphaSize )
|
||||
{
|
||||
Int32 n, vec, i;
|
||||
|
||||
vec = 0;
|
||||
for (n = minLen; n <= maxLen; n++) {
|
||||
for (i = 0; i < alphaSize; i++)
|
||||
if (length[i] == n) { code[i] = vec; vec++; };
|
||||
vec <<= 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
void BZ2_hbCreateDecodeTables ( Int32 *limit,
|
||||
Int32 *base,
|
||||
Int32 *perm,
|
||||
UChar *length,
|
||||
Int32 minLen,
|
||||
Int32 maxLen,
|
||||
Int32 alphaSize )
|
||||
{
|
||||
Int32 pp, i, j, vec;
|
||||
|
||||
pp = 0;
|
||||
for (i = minLen; i <= maxLen; i++)
|
||||
for (j = 0; j < alphaSize; j++)
|
||||
if (length[j] == i) { perm[pp] = j; pp++; };
|
||||
|
||||
for (i = 0; i < BZ_MAX_CODE_LEN; i++) base[i] = 0;
|
||||
for (i = 0; i < alphaSize; i++) base[length[i]+1]++;
|
||||
|
||||
for (i = 1; i < BZ_MAX_CODE_LEN; i++) base[i] += base[i-1];
|
||||
|
||||
for (i = 0; i < BZ_MAX_CODE_LEN; i++) limit[i] = 0;
|
||||
vec = 0;
|
||||
|
||||
for (i = minLen; i <= maxLen; i++) {
|
||||
vec += (base[i+1] - base[i]);
|
||||
limit[i] = vec-1;
|
||||
vec <<= 1;
|
||||
}
|
||||
for (i = minLen + 1; i <= maxLen; i++)
|
||||
base[i] = ((limit[i-1] + 1) << 1) - base[i];
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*--- end huffman.c ---*/
|
||||
/*-------------------------------------------------------------*/
|
|
@ -1,84 +0,0 @@
|
|||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*--- Table for randomising repetitive blocks ---*/
|
||||
/*--- randtable.c ---*/
|
||||
/*-------------------------------------------------------------*/
|
||||
|
||||
/* ------------------------------------------------------------------
|
||||
This file is part of bzip2/libbzip2, a program and library for
|
||||
lossless, block-sorting data compression.
|
||||
|
||||
bzip2/libbzip2 version 1.0.6 of 6 September 2010
|
||||
Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>
|
||||
|
||||
Please read the WARNING, DISCLAIMER and PATENTS sections in the
|
||||
README file.
|
||||
|
||||
This program is released under the terms of the license contained
|
||||
in the file LICENSE.
|
||||
------------------------------------------------------------------ */
|
||||
|
||||
|
||||
#include "bzlib_private.h"
|
||||
|
||||
|
||||
/*---------------------------------------------*/
|
||||
Int32 BZ2_rNums[512] = {
|
||||
619, 720, 127, 481, 931, 816, 813, 233, 566, 247,
|
||||
985, 724, 205, 454, 863, 491, 741, 242, 949, 214,
|
||||
733, 859, 335, 708, 621, 574, 73, 654, 730, 472,
|
||||
419, 436, 278, 496, 867, 210, 399, 680, 480, 51,
|
||||
878, 465, 811, 169, 869, 675, 611, 697, 867, 561,
|
||||
862, 687, 507, 283, 482, 129, 807, 591, 733, 623,
|
||||
150, 238, 59, 379, 684, 877, 625, 169, 643, 105,
|
||||
170, 607, 520, 932, 727, 476, 693, 425, 174, 647,
|
||||
73, 122, 335, 530, 442, 853, 695, 249, 445, 515,
|
||||
909, 545, 703, 919, 874, 474, 882, 500, 594, 612,
|
||||
641, 801, 220, 162, 819, 984, 589, 513, 495, 799,
|
||||
161, 604, 958, 533, 221, 400, 386, 867, 600, 782,
|
||||
382, 596, 414, 171, 516, 375, 682, 485, 911, 276,
|
||||
98, 553, 163, 354, 666, 933, 424, 341, 533, 870,
|
||||
227, 730, 475, 186, 263, 647, 537, 686, 600, 224,
|
||||
469, 68, 770, 919, 190, 373, 294, 822, 808, 206,
|
||||
184, 943, 795, 384, 383, 461, 404, 758, 839, 887,
|
||||
715, 67, 618, 276, 204, 918, 873, 777, 604, 560,
|
||||
951, 160, 578, 722, 79, 804, 96, 409, 713, 940,
|
||||
652, 934, 970, 447, 318, 353, 859, 672, 112, 785,
|
||||
645, 863, 803, 350, 139, 93, 354, 99, 820, 908,
|
||||
609, 772, 154, 274, 580, 184, 79, 626, 630, 742,
|
||||
653, 282, 762, 623, 680, 81, 927, 626, 789, 125,
|
||||
411, 521, 938, 300, 821, 78, 343, 175, 128, 250,
|
||||
170, 774, 972, 275, 999, 639, 495, 78, 352, 126,
|
||||
857, 956, 358, 619, 580, 124, 737, 594, 701, 612,
|
||||
669, 112, 134, 694, 363, 992, 809, 743, 168, 974,
|
||||
944, 375, 748, 52, 600, 747, 642, 182, 862, 81,
|
||||
344, 805, 988, 739, 511, 655, 814, 334, 249, 515,
|
||||
897, 955, 664, 981, 649, 113, 974, 459, 893, 228,
|
||||
433, 837, 553, 268, 926, 240, 102, 654, 459, 51,
|
||||
686, 754, 806, 760, 493, 403, 415, 394, 687, 700,
|
||||
946, 670, 656, 610, 738, 392, 760, 799, 887, 653,
|
||||
978, 321, 576, 617, 626, 502, 894, 679, 243, 440,
|
||||
680, 879, 194, 572, 640, 724, 926, 56, 204, 700,
|
||||
707, 151, 457, 449, 797, 195, 791, 558, 945, 679,
|
||||
297, 59, 87, 824, 713, 663, 412, 693, 342, 606,
|
||||
134, 108, 571, 364, 631, 212, 174, 643, 304, 329,
|
||||
343, 97, 430, 751, 497, 314, 983, 374, 822, 928,
|
||||
140, 206, 73, 263, 980, 736, 876, 478, 430, 305,
|
||||
170, 514, 364, 692, 829, 82, 855, 953, 676, 246,
|
||||
369, 970, 294, 750, 807, 827, 150, 790, 288, 923,
|
||||
804, 378, 215, 828, 592, 281, 565, 555, 710, 82,
|
||||
896, 831, 547, 261, 524, 462, 293, 465, 502, 56,
|
||||
661, 821, 976, 991, 658, 869, 905, 758, 745, 193,
|
||||
768, 550, 608, 933, 378, 286, 215, 979, 792, 961,
|
||||
61, 688, 793, 644, 986, 403, 106, 366, 905, 644,
|
||||
372, 567, 466, 434, 645, 210, 389, 550, 919, 135,
|
||||
780, 773, 635, 389, 707, 100, 626, 958, 165, 504,
|
||||
920, 176, 193, 713, 857, 265, 203, 50, 668, 108,
|
||||
645, 990, 626, 197, 510, 357, 358, 850, 858, 364,
|
||||
936, 638
|
||||
};
|
||||
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*--- end randtable.c ---*/
|
||||
/*-------------------------------------------------------------*/
|
|
@ -289,11 +289,7 @@ endif()
|
|||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Super-seeded by cdvdGigaherz
|
||||
set(CDVDisoEFP FALSE)
|
||||
set(CDVDolio FALSE)
|
||||
set(CDVDpeops FALSE)
|
||||
set(CDVDlinuz FALSE) # used to be compiled on linux
|
||||
set(CDVDiso FALSE) # used to be compiled on linux
|
||||
|
||||
# [TODO] Write CMakeLists.txt for these plugins. (or not ;) )
|
||||
set(PeopsSPU2 FALSE)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.25123.0
|
||||
VisualStudioVersion = 14.0.25420.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "3rdparty", "3rdparty", "{78EBE642-7A4D-4EA7-86BE-5639C6646C38}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
|
@ -18,7 +18,6 @@ EndProject
|
|||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Include", "Include", "{0FADC26C-0E9D-4DD7-84B1-BF4F7754E90C}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
common\include\afxresmw.h = common\include\afxresmw.h
|
||||
common\include\intrin_x86.h = common\include\intrin_x86.h
|
||||
common\include\Pcsx2Api.h = common\include\Pcsx2Api.h
|
||||
common\include\Pcsx2Defs.h = common\include\Pcsx2Defs.h
|
||||
common\include\Pcsx2Types.h = common\include\Pcsx2Types.h
|
||||
|
@ -33,31 +32,25 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "wx", "wx", "{62BF822E-6A12-
|
|||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZeroGS", "plugins\zerogs\dx\Windows\zerogs.vcxproj", "{5C6B7D28-E73D-4F71-8FC0-17ADA640EBD8}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CDVDiso", "plugins\CDVDiso\src\Windows\CDVDiso.vcxproj", "{5F78E90B-BD22-47B1-9CA5-7A80F4DF5EF3}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SoundTouch", "3rdparty\soundtouch\SoundTouch.vcxproj", "{E9B51944-7E6D-4BCD-83F2-7BBD5A46182D}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "3rdparty\zlib\zlib.vcxproj", "{2F6C0388-20CB-4242-9F6C-A6EBB6A83F47}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bzip2", "3rdparty\bzip2\bzip2.vcxproj", "{F4EB4AB2-C595-4B05-8BC0-059024BC796C}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZeroSPU2", "plugins\zerospu2\Windows\ZeroSPU2.vcxproj", "{7F059854-568D-4E08-9D00-1E78E203E4DC}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CDVDolio", "plugins\CDVDolio\CDVDolio.vcxproj", "{FCDF5AE2-EA47-4CC6-9F20-23A0517FEBCB}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "utilities", "common\build\Utilities\utilities.vcxproj", "{4639972E-424E-4E13-8B07-CA403C481346}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libjpeg7", "3rdparty\libjpeg\libjpeg.vcxproj", "{BC236261-77E8-4567-8D09-45CD02965EB6}"
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libjpeg", "3rdparty\libjpeg\libjpeg.vcxproj", "{BC236261-77E8-4567-8D09-45CD02965EB6}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PadSSSPSX", "plugins\SSSPSXPAD\PadSSSPSX.vcxproj", "{6C8D28E4-447E-4856-BD9E-6B8F5E7C58C9}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZZOgl", "plugins\zzogl-pg\opengl\Win32\zerogsogl.vcxproj", "{2D4E85B2-F47F-4D65-B091-701E5C031DAC}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxBase30", "3rdparty\wxwidgets3.0\build\msw\wx30_base.vcxproj", "{3FCC50C2-81E9-5DB2-B8D8-2129427568B1}"
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wx30_base", "3rdparty\wxwidgets3.0\build\msw\wx30_base.vcxproj", "{3FCC50C2-81E9-5DB2-B8D8-2129427568B1}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxConfig30", "3rdparty\wxwidgets3.0\build\msw\wx30_config.vcxproj", "{01F4CE10-2CFB-41A8-B41F-E54337868A1D}"
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wx30_config", "3rdparty\wxwidgets3.0\build\msw\wx30_config.vcxproj", "{01F4CE10-2CFB-41A8-B41F-E54337868A1D}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxCore30", "3rdparty\wxwidgets3.0\build\msw\wx30_core.vcxproj", "{6744DAD8-9C70-574A-BFF2-9F8DDDB24A75}"
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wx30_core", "3rdparty\wxwidgets3.0\build\msw\wx30_core.vcxproj", "{6744DAD8-9C70-574A-BFF2-9F8DDDB24A75}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpng", "3rdparty\libpng\projects\vstudio\libpng\libpng.vcxproj", "{D6973076-9317-4EF2-A0B8-B7A18AC0713E}"
|
||||
EndProject
|
||||
|
@ -82,15 +75,6 @@ Global
|
|||
{5C6B7D28-E73D-4F71-8FC0-17ADA640EBD8}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{5C6B7D28-E73D-4F71-8FC0-17ADA640EBD8}.Release|Win32.Build.0 = Release|Win32
|
||||
{5C6B7D28-E73D-4F71-8FC0-17ADA640EBD8}.Release|x64.ActiveCfg = Release|Win32
|
||||
{5F78E90B-BD22-47B1-9CA5-7A80F4DF5EF3}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{5F78E90B-BD22-47B1-9CA5-7A80F4DF5EF3}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{5F78E90B-BD22-47B1-9CA5-7A80F4DF5EF3}.Debug|x64.ActiveCfg = Debug|Win32
|
||||
{5F78E90B-BD22-47B1-9CA5-7A80F4DF5EF3}.Devel|Win32.ActiveCfg = Devel|Win32
|
||||
{5F78E90B-BD22-47B1-9CA5-7A80F4DF5EF3}.Devel|Win32.Build.0 = Devel|Win32
|
||||
{5F78E90B-BD22-47B1-9CA5-7A80F4DF5EF3}.Devel|x64.ActiveCfg = Devel|Win32
|
||||
{5F78E90B-BD22-47B1-9CA5-7A80F4DF5EF3}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{5F78E90B-BD22-47B1-9CA5-7A80F4DF5EF3}.Release|Win32.Build.0 = Release|Win32
|
||||
{5F78E90B-BD22-47B1-9CA5-7A80F4DF5EF3}.Release|x64.ActiveCfg = Release|Win32
|
||||
{E9B51944-7E6D-4BCD-83F2-7BBD5A46182D}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{E9B51944-7E6D-4BCD-83F2-7BBD5A46182D}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{E9B51944-7E6D-4BCD-83F2-7BBD5A46182D}.Debug|x64.ActiveCfg = Debug|x64
|
||||
|
@ -112,15 +96,6 @@ Global
|
|||
{2F6C0388-20CB-4242-9F6C-A6EBB6A83F47}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{2F6C0388-20CB-4242-9F6C-A6EBB6A83F47}.Release|Win32.Build.0 = Release|Win32
|
||||
{2F6C0388-20CB-4242-9F6C-A6EBB6A83F47}.Release|x64.ActiveCfg = Release|Win32
|
||||
{F4EB4AB2-C595-4B05-8BC0-059024BC796C}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{F4EB4AB2-C595-4B05-8BC0-059024BC796C}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{F4EB4AB2-C595-4B05-8BC0-059024BC796C}.Debug|x64.ActiveCfg = Debug|Win32
|
||||
{F4EB4AB2-C595-4B05-8BC0-059024BC796C}.Devel|Win32.ActiveCfg = Devel|Win32
|
||||
{F4EB4AB2-C595-4B05-8BC0-059024BC796C}.Devel|Win32.Build.0 = Devel|Win32
|
||||
{F4EB4AB2-C595-4B05-8BC0-059024BC796C}.Devel|x64.ActiveCfg = Devel|Win32
|
||||
{F4EB4AB2-C595-4B05-8BC0-059024BC796C}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{F4EB4AB2-C595-4B05-8BC0-059024BC796C}.Release|Win32.Build.0 = Release|Win32
|
||||
{F4EB4AB2-C595-4B05-8BC0-059024BC796C}.Release|x64.ActiveCfg = Release|Win32
|
||||
{7F059854-568D-4E08-9D00-1E78E203E4DC}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{7F059854-568D-4E08-9D00-1E78E203E4DC}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{7F059854-568D-4E08-9D00-1E78E203E4DC}.Debug|x64.ActiveCfg = Debug|Win32
|
||||
|
@ -130,18 +105,6 @@ Global
|
|||
{7F059854-568D-4E08-9D00-1E78E203E4DC}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{7F059854-568D-4E08-9D00-1E78E203E4DC}.Release|Win32.Build.0 = Release|Win32
|
||||
{7F059854-568D-4E08-9D00-1E78E203E4DC}.Release|x64.ActiveCfg = Release|Win32
|
||||
{FCDF5AE2-EA47-4CC6-9F20-23A0517FEBCB}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{FCDF5AE2-EA47-4CC6-9F20-23A0517FEBCB}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{FCDF5AE2-EA47-4CC6-9F20-23A0517FEBCB}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{FCDF5AE2-EA47-4CC6-9F20-23A0517FEBCB}.Debug|x64.Build.0 = Debug|x64
|
||||
{FCDF5AE2-EA47-4CC6-9F20-23A0517FEBCB}.Devel|Win32.ActiveCfg = Release|Win32
|
||||
{FCDF5AE2-EA47-4CC6-9F20-23A0517FEBCB}.Devel|Win32.Build.0 = Release|Win32
|
||||
{FCDF5AE2-EA47-4CC6-9F20-23A0517FEBCB}.Devel|x64.ActiveCfg = Release|x64
|
||||
{FCDF5AE2-EA47-4CC6-9F20-23A0517FEBCB}.Devel|x64.Build.0 = Release|x64
|
||||
{FCDF5AE2-EA47-4CC6-9F20-23A0517FEBCB}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{FCDF5AE2-EA47-4CC6-9F20-23A0517FEBCB}.Release|Win32.Build.0 = Release|Win32
|
||||
{FCDF5AE2-EA47-4CC6-9F20-23A0517FEBCB}.Release|x64.ActiveCfg = Release|x64
|
||||
{FCDF5AE2-EA47-4CC6-9F20-23A0517FEBCB}.Release|x64.Build.0 = Release|x64
|
||||
{4639972E-424E-4E13-8B07-CA403C481346}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{4639972E-424E-4E13-8B07-CA403C481346}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{4639972E-424E-4E13-8B07-CA403C481346}.Debug|x64.ActiveCfg = Debug|Win32
|
||||
|
@ -243,12 +206,9 @@ Global
|
|||
{0FADC26C-0E9D-4DD7-84B1-BF4F7754E90C} = {88F517F9-CE1C-4005-9BDF-4481FEB55053}
|
||||
{62BF822E-6A12-49A8-BE8C-C55A9BCA24DA} = {0FADC26C-0E9D-4DD7-84B1-BF4F7754E90C}
|
||||
{5C6B7D28-E73D-4F71-8FC0-17ADA640EBD8} = {703FD00B-D7A0-41E3-BD03-CEC86B385DAF}
|
||||
{5F78E90B-BD22-47B1-9CA5-7A80F4DF5EF3} = {703FD00B-D7A0-41E3-BD03-CEC86B385DAF}
|
||||
{E9B51944-7E6D-4BCD-83F2-7BBD5A46182D} = {78EBE642-7A4D-4EA7-86BE-5639C6646C38}
|
||||
{2F6C0388-20CB-4242-9F6C-A6EBB6A83F47} = {78EBE642-7A4D-4EA7-86BE-5639C6646C38}
|
||||
{F4EB4AB2-C595-4B05-8BC0-059024BC796C} = {78EBE642-7A4D-4EA7-86BE-5639C6646C38}
|
||||
{7F059854-568D-4E08-9D00-1E78E203E4DC} = {703FD00B-D7A0-41E3-BD03-CEC86B385DAF}
|
||||
{FCDF5AE2-EA47-4CC6-9F20-23A0517FEBCB} = {703FD00B-D7A0-41E3-BD03-CEC86B385DAF}
|
||||
{4639972E-424E-4E13-8B07-CA403C481346} = {88F517F9-CE1C-4005-9BDF-4481FEB55053}
|
||||
{BC236261-77E8-4567-8D09-45CD02965EB6} = {78EBE642-7A4D-4EA7-86BE-5639C6646C38}
|
||||
{6C8D28E4-447E-4856-BD9E-6B8F5E7C58C9} = {703FD00B-D7A0-41E3-BD03-CEC86B385DAF}
|
||||
|
|
|
@ -1,78 +0,0 @@
|
|||
CDVDiso v0.5
|
||||
------------
|
||||
|
||||
This is an extension to use with play station2 emulators
|
||||
as PCSX2 (only one right now).
|
||||
The plugin is free open source code.
|
||||
|
||||
Linux requeriments:
|
||||
------------------
|
||||
You need the GTK library, compiled with GTK v1.2.5,
|
||||
the Zlib library (v1.1.3) and the bz2 library (v1.0.0).
|
||||
|
||||
Usage:
|
||||
-----
|
||||
Place the file "libCDVDiso.so" (linux) or "CDVDiso.dll" (win32) at the Plugin
|
||||
directory of the Emulator to use it.
|
||||
|
||||
Linux only: Also place the cfgCDVDiso file at your $HOME directory or at the
|
||||
Emulator directory.
|
||||
|
||||
Configuration:
|
||||
-------------
|
||||
You can either write the iso you want to use in the config dialog, or everytime
|
||||
you run the emu open it, if you're doing this don't write anything in the dialog.
|
||||
|
||||
Creating an iso (linux only):
|
||||
---------------
|
||||
To create an iso you can use the buttons 'Create Iso' or 'Create Compressed Iso',
|
||||
the file will be the one in the Iso Edit, and the Cdrom Device is the cdrom that
|
||||
will be used as source.
|
||||
The compression method is specified by the Compression Method Combo.
|
||||
|
||||
Note: This will fail if the file in the Iso Edit already exists (if it's
|
||||
compressed the .Z or .bz suffix will be added).
|
||||
|
||||
Compressed isos:
|
||||
---------------
|
||||
You must create them by the Compress Iso button, this will create a .Z or .bz
|
||||
file (the compressed image) and a .Z.table or .bz.index file (this is a table,
|
||||
for speed reasons), both will be created in the same dir the selected iso
|
||||
image, the original image will not be deleted and/or changed, and also you can
|
||||
decompress the compressed iso with Decompress Iso button.
|
||||
The compression method is specified by the Compression Method Combo.
|
||||
|
||||
Note: you only can decompress the images with the Decompress button, not with
|
||||
compress or bzip2.
|
||||
|
||||
Compression Method:
|
||||
------------------
|
||||
.Z - compress faster: this will compress faster, but not as good as the .bz.
|
||||
.bz - compress better: will compress better, but slower.
|
||||
|
||||
Changes:
|
||||
-------
|
||||
v0.5:
|
||||
* Added block dumping code
|
||||
* Added BZ2/Z2 format ;)
|
||||
* Added optimaze asm code of zlib with vsnet2003 only. Compression / Uncompression should be faster now (shadow)
|
||||
* Added Vsnet2005 beta1 project files + amd64 asm optimaze code for zlib (shadow)
|
||||
|
||||
v0.4:
|
||||
* Rewrote mostly ;)
|
||||
* .bz is still unsupported
|
||||
|
||||
v0.3:
|
||||
* Better Iso detection, thx florin :)
|
||||
* Updated to PS2Edefs v0.4.5
|
||||
|
||||
v0.2:
|
||||
* Added support for isos using 2048 blocksize
|
||||
* Nero images are supported
|
||||
* Better extension filtering
|
||||
|
||||
v0.1:
|
||||
* First Release
|
||||
* Tested with Pcsx2
|
||||
|
||||
Email: <linuzappz@hotmail.com>
|
|
@ -1,159 +0,0 @@
|
|||
/* CDVDiso
|
||||
* Copyright (C) 2002-2004 CDVDiso 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 __CDVDISO_H__
|
||||
#define __CDVDISO_H__
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable : 4018)
|
||||
#endif
|
||||
|
||||
#include "PS2Edefs.h"
|
||||
#include "libiso.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define EXPORT_C_(type) extern "C" __declspec(dllexport) type CALLBACK
|
||||
#else
|
||||
#define EXPORT_C_(type) extern "C" __attribute__((stdcall, externally_visible, visibility("default"))) type
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define EXPORT_C_(type) __declspec(dllexport) type __stdcall
|
||||
#else
|
||||
#define EXPORT_C_(type) __attribute__((stdcall, externally_visible, visibility("default"))) type
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
EXPORT_C_(u32)
|
||||
PS2EgetLibType();
|
||||
EXPORT_C_(u32)
|
||||
PS2EgetLibVersion2(u32 type);
|
||||
EXPORT_C_(char *)
|
||||
PS2EgetLibName();
|
||||
|
||||
|
||||
EXPORT_C_(s32)
|
||||
CDVDinit();
|
||||
EXPORT_C_(s32)
|
||||
CDVDopen(const char *pTitleFilename);
|
||||
EXPORT_C_(void)
|
||||
CDVDclose();
|
||||
EXPORT_C_(void)
|
||||
CDVDshutdown();
|
||||
EXPORT_C_(s32)
|
||||
CDVDreadTrack(u32 lsn, int mode);
|
||||
|
||||
// return can be NULL (for async modes)
|
||||
EXPORT_C_(u8 *)
|
||||
CDVDgetBuffer();
|
||||
|
||||
EXPORT_C_(s32)
|
||||
CDVDreadSubQ(u32 lsn, cdvdSubQ *subq); //read subq from disc (only cds have subq data)
|
||||
EXPORT_C_(s32)
|
||||
CDVDgetTN(cdvdTN *Buffer); //disk information
|
||||
EXPORT_C_(s32)
|
||||
CDVDgetTD(u8 Track, cdvdTD *Buffer); //track info: min,sec,frame,type
|
||||
EXPORT_C_(s32)
|
||||
CDVDgetTOC(void *toc); //gets ps2 style toc from disc
|
||||
EXPORT_C_(s32)
|
||||
CDVDgetDiskType(); //CDVD_TYPE_xxxx
|
||||
EXPORT_C_(s32)
|
||||
CDVDgetTrayStatus(); //CDVD_TRAY_xxxx
|
||||
EXPORT_C_(s32)
|
||||
CDVDctrlTrayOpen(); //open disc tray
|
||||
EXPORT_C_(s32)
|
||||
CDVDctrlTrayClose(); //close disc tray
|
||||
|
||||
// extended funcs
|
||||
|
||||
EXPORT_C_(void)
|
||||
CDVDconfigure();
|
||||
EXPORT_C_(void)
|
||||
CDVDabout();
|
||||
EXPORT_C_(s32)
|
||||
CDVDtest();
|
||||
EXPORT_C_(void)
|
||||
CDVDnewDiskCB(void (*callback)());
|
||||
|
||||
#define CDVD_LOG __Log
|
||||
extern FILE *cdvdLog;
|
||||
|
||||
void __Log(char *fmt, ...);
|
||||
|
||||
#define VERBOSE 1
|
||||
|
||||
#define DEV_DEF ""
|
||||
#define CDDEV_DEF "/dev/cdrom"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int slsn;
|
||||
int elsn;
|
||||
#ifdef _WINDOWS_
|
||||
HANDLE handle;
|
||||
#else
|
||||
FILE *handle;
|
||||
#endif
|
||||
} _cdIso;
|
||||
|
||||
extern _cdIso cdIso[8];
|
||||
|
||||
#define CD_FRAMESIZE_RAW 2352
|
||||
#define DATA_SIZE (CD_FRAMESIZE_RAW - 12)
|
||||
|
||||
#define itob(i) ((i) / 10 * 16 + (i) % 10) /* u_char to BCD */
|
||||
#define btoi(b) ((b) / 16 * 10 + (b) % 16) /* BCD to u_char */
|
||||
|
||||
#define MSF2SECT(m, s, f) (((m)*60 + (s)-2) * 75 + (f))
|
||||
|
||||
extern const u8 version;
|
||||
extern const u8 revision;
|
||||
extern const u8 build;
|
||||
|
||||
extern char IsoFile[256];
|
||||
extern char IsoCWD[256];
|
||||
extern char CdDev[256];
|
||||
|
||||
extern int BlockDump;
|
||||
extern isoFile *fdump;
|
||||
extern isoFile *iso;
|
||||
|
||||
extern u8 cdbuffer[];
|
||||
extern u8 *pbuffer;
|
||||
extern int cdblocksize;
|
||||
extern int cdblockofs;
|
||||
extern int cdoffset;
|
||||
extern int cdtype;
|
||||
extern int cdblocks;
|
||||
|
||||
extern int Zmode; // 1 Z - 2 bz2
|
||||
extern int fmode; // 0 - file / 1 - Zfile
|
||||
extern char *Ztable;
|
||||
|
||||
extern char *methods[];
|
||||
|
||||
void UpdateZmode();
|
||||
void CfgOpenFile();
|
||||
void SysMessage(char *fmt, ...);
|
||||
|
||||
#endif
|
|
@ -1,557 +0,0 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "CDVDiso.h"
|
||||
#include "Config.h"
|
||||
|
||||
#ifndef MAX_PATH
|
||||
#define MAX_PATH 255
|
||||
#endif
|
||||
|
||||
char IsoFile[256];
|
||||
char IsoCWD[256];
|
||||
char CdDev[256];
|
||||
|
||||
_cdIso cdIso[8];
|
||||
u8 *pbuffer;
|
||||
int cdblocksize;
|
||||
int cdblockofs;
|
||||
int cdoffset;
|
||||
int cdtype;
|
||||
int cdblocks;
|
||||
|
||||
int Zmode; // 1 Z - 2 bz2
|
||||
int fmode; // 0 - file / 1 - Zfile
|
||||
char *Ztable;
|
||||
|
||||
int BlockDump;
|
||||
isoFile *fdump;
|
||||
isoFile *iso;
|
||||
|
||||
FILE *cdvdLog = NULL;
|
||||
|
||||
// This var is used to detect resume-style behavior of the Pcsx2 emulator,
|
||||
// and skip prompting the user for a new CD when it's likely they want to run the existing one.
|
||||
static char cdvdCurrentIso[MAX_PATH];
|
||||
|
||||
char *methods[] =
|
||||
{
|
||||
".Z - compress faster",
|
||||
".BZ - compress better",
|
||||
NULL};
|
||||
|
||||
#ifdef PCSX2_DEBUG
|
||||
char *LibName = "Linuz Iso CDVD (Debug) ";
|
||||
#else
|
||||
char *LibName = "Linuz Iso CDVD ";
|
||||
#endif
|
||||
|
||||
const u8 version = PS2E_CDVD_VERSION;
|
||||
const u8 revision = 0;
|
||||
const u8 build = 9;
|
||||
|
||||
u8 cdbuffer[CD_FRAMESIZE_RAW * 10] = {0};
|
||||
|
||||
s32 msf_to_lba(u8 m, u8 s, u8 f)
|
||||
{
|
||||
u32 lsn;
|
||||
lsn = f;
|
||||
lsn += (s - 2) * 75;
|
||||
lsn += m * 75 * 60;
|
||||
return lsn;
|
||||
}
|
||||
|
||||
void lba_to_msf(s32 lba, u8 *m, u8 *s, u8 *f)
|
||||
{
|
||||
lba += 150;
|
||||
*m = lba / (60 * 75);
|
||||
*s = (lba / 75) % 60;
|
||||
*f = lba % 75;
|
||||
}
|
||||
|
||||
#define btoi(b) ((b) / 16 * 10 + (b) % 16) /* BCD to u_char */
|
||||
#define itob(i) ((i) / 10 * 16 + (i) % 10) /* u_char to BCD */
|
||||
|
||||
|
||||
EXPORT_C_(char *)
|
||||
PS2EgetLibName()
|
||||
{
|
||||
return LibName;
|
||||
}
|
||||
|
||||
EXPORT_C_(u32)
|
||||
PS2EgetLibType()
|
||||
{
|
||||
return PS2E_LT_CDVD;
|
||||
}
|
||||
|
||||
EXPORT_C_(u32)
|
||||
PS2EgetLibVersion2(u32 type)
|
||||
{
|
||||
return (version << 16) | (revision << 8) | build;
|
||||
}
|
||||
|
||||
#ifdef PCSX2_DEBUG
|
||||
void __Log(char *fmt, ...)
|
||||
{
|
||||
va_list list;
|
||||
|
||||
if (cdvdLog == NULL)
|
||||
return;
|
||||
|
||||
va_start(list, fmt);
|
||||
vfprintf(cdvdLog, fmt, list);
|
||||
va_end(list);
|
||||
}
|
||||
#else
|
||||
#define __Log 0 &&
|
||||
#endif
|
||||
|
||||
|
||||
EXPORT_C_(s32)
|
||||
CDVDinit()
|
||||
{
|
||||
#ifdef PCSX2_DEBUG
|
||||
cdvdLog = fopen("logs/cdvdLog.txt", "w");
|
||||
if (cdvdLog == NULL) {
|
||||
cdvdLog = fopen("cdvdLog.txt", "w");
|
||||
if (cdvdLog == NULL) {
|
||||
SysMessage("Can't create cdvdLog.txt");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
setvbuf(cdvdLog, NULL, _IONBF, 0);
|
||||
CDVD_LOG("CDVDinit\n");
|
||||
#endif
|
||||
|
||||
cdvdCurrentIso[0] = 0;
|
||||
memset(cdIso, 0, sizeof(cdIso));
|
||||
return 0;
|
||||
}
|
||||
|
||||
EXPORT_C_(void)
|
||||
CDVDshutdown()
|
||||
{
|
||||
cdvdCurrentIso[0] = 0;
|
||||
#ifdef CDVD_LOG
|
||||
if (cdvdLog != NULL)
|
||||
fclose(cdvdLog);
|
||||
#endif
|
||||
}
|
||||
|
||||
EXPORT_C_(s32)
|
||||
CDVDopen(const char *pTitle)
|
||||
{
|
||||
LoadConf();
|
||||
|
||||
if (pTitle != NULL)
|
||||
strcpy(IsoFile, pTitle);
|
||||
|
||||
if (*IsoFile == 0)
|
||||
strcpy(IsoFile, cdvdCurrentIso);
|
||||
|
||||
if (*IsoFile == 0) {
|
||||
char temp[256];
|
||||
|
||||
CfgOpenFile();
|
||||
|
||||
if (IsoFile[0] == 0) {
|
||||
// user pressed CANCEL
|
||||
return 1;
|
||||
}
|
||||
|
||||
strcpy(temp, IsoFile);
|
||||
*IsoFile = 0;
|
||||
SaveConf();
|
||||
strcpy(IsoFile, temp);
|
||||
}
|
||||
|
||||
iso = isoOpen(IsoFile);
|
||||
if (iso == NULL) {
|
||||
SysMessage("Error loading %s\nMake sure the iso file is not mounted in any disk emulation software!", IsoFile);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (iso->type == ISOTYPE_DVD)
|
||||
cdtype = CDVD_TYPE_PS2DVD;
|
||||
else if (iso->type == ISOTYPE_AUDIO)
|
||||
cdtype = CDVD_TYPE_CDDA;
|
||||
else
|
||||
cdtype = CDVD_TYPE_PS2CD;
|
||||
|
||||
if (BlockDump) {
|
||||
char fname_only[MAX_PATH];
|
||||
|
||||
#ifdef _WIN32
|
||||
char fname[MAX_PATH], ext[MAX_PATH];
|
||||
_splitpath(IsoFile, NULL, NULL, fname, ext);
|
||||
_makepath(fname_only, NULL, NULL, fname, NULL);
|
||||
#else
|
||||
char *p, *plast;
|
||||
|
||||
plast = p = strchr(IsoFile, '/');
|
||||
while (p != NULL) {
|
||||
plast = p;
|
||||
p = strchr(p + 1, '/');
|
||||
}
|
||||
|
||||
// Lets not create dumps in the plugin directory.
|
||||
strcpy(fname_only, "../");
|
||||
if (plast != NULL)
|
||||
strcat(fname_only, plast + 1);
|
||||
else
|
||||
strcat(fname_only, IsoFile);
|
||||
|
||||
plast = p = strchr(fname_only, '.');
|
||||
|
||||
while (p != NULL) {
|
||||
plast = p;
|
||||
p = strchr(p + 1, '.');
|
||||
}
|
||||
|
||||
if (plast != NULL)
|
||||
*plast = 0;
|
||||
|
||||
#endif
|
||||
strcat(fname_only, ".dump");
|
||||
fdump = isoCreate(fname_only, ISOFLAGS_BLOCKDUMP);
|
||||
if (fdump)
|
||||
isoSetFormat(fdump, iso->blockofs, iso->blocksize, iso->blocks);
|
||||
} else {
|
||||
fdump = NULL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
EXPORT_C_(void)
|
||||
CDVDclose()
|
||||
{
|
||||
if (!iso)
|
||||
return;
|
||||
|
||||
strcpy(cdvdCurrentIso, IsoFile);
|
||||
|
||||
isoClose(iso);
|
||||
if (fdump != NULL)
|
||||
isoClose(fdump);
|
||||
}
|
||||
|
||||
EXPORT_C_(s32)
|
||||
CDVDreadSubQ(u32 lsn, cdvdSubQ *subq)
|
||||
{
|
||||
if (!iso)
|
||||
return -1;
|
||||
|
||||
// fake it
|
||||
u8 min, sec, frm;
|
||||
subq->ctrl = 4;
|
||||
subq->mode = 1;
|
||||
subq->trackNum = itob(1);
|
||||
subq->trackIndex = itob(1);
|
||||
|
||||
lba_to_msf(lsn, &min, &sec, &frm);
|
||||
subq->trackM = itob(min);
|
||||
subq->trackS = itob(sec);
|
||||
subq->trackF = itob(frm);
|
||||
|
||||
subq->pad = 0;
|
||||
|
||||
lba_to_msf(lsn + (2 * 75), &min, &sec, &frm);
|
||||
subq->discM = itob(min);
|
||||
subq->discS = itob(sec);
|
||||
subq->discF = itob(frm);
|
||||
return 0;
|
||||
}
|
||||
|
||||
EXPORT_C_(s32)
|
||||
CDVDgetTN(cdvdTN *Buffer)
|
||||
{
|
||||
Buffer->strack = 1;
|
||||
Buffer->etrack = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
EXPORT_C_(s32)
|
||||
CDVDgetTD(u8 Track, cdvdTD *Buffer)
|
||||
{
|
||||
if (!iso)
|
||||
return -1;
|
||||
|
||||
if (Track == 0) {
|
||||
Buffer->lsn = iso->blocks;
|
||||
} else {
|
||||
Buffer->type = CDVD_MODE1_TRACK;
|
||||
Buffer->lsn = 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static s32 layer1start = -1;
|
||||
|
||||
static bool testForPartitionInfo(const u8 (&tempbuffer)[CD_FRAMESIZE_RAW])
|
||||
{
|
||||
const int off = iso->blockofs;
|
||||
|
||||
// test for: CD001
|
||||
return (
|
||||
(tempbuffer[off + 1] == 0x43) &&
|
||||
(tempbuffer[off + 2] == 0x44) &&
|
||||
(tempbuffer[off + 3] == 0x30) &&
|
||||
(tempbuffer[off + 4] == 0x30) &&
|
||||
(tempbuffer[off + 5] == 0x31));
|
||||
}
|
||||
|
||||
EXPORT_C_(s32)
|
||||
CDVDgetTOC(void *toc)
|
||||
{
|
||||
if (!iso)
|
||||
return -1;
|
||||
|
||||
u8 type = CDVDgetDiskType();
|
||||
u8 *tocBuff = (u8 *)toc;
|
||||
|
||||
//__Log("CDVDgetTOC\n");
|
||||
|
||||
if (type == CDVD_TYPE_DVDV || type == CDVD_TYPE_PS2DVD) {
|
||||
// get dvd structure format
|
||||
// scsi command 0x43
|
||||
memset(tocBuff, 0, 2048);
|
||||
|
||||
if (layer1start != -2 && iso->blocks >= 0x300000) {
|
||||
//int off = iso->blockofs;
|
||||
|
||||
// dual sided
|
||||
tocBuff[0] = 0x24;
|
||||
tocBuff[1] = 0x02;
|
||||
tocBuff[2] = 0xF2;
|
||||
tocBuff[3] = 0x00;
|
||||
tocBuff[4] = 0x41;
|
||||
tocBuff[5] = 0x95;
|
||||
|
||||
tocBuff[14] = 0x60; // dual sided, ptp
|
||||
|
||||
tocBuff[16] = 0x00;
|
||||
tocBuff[17] = 0x03;
|
||||
tocBuff[18] = 0x00;
|
||||
tocBuff[19] = 0x00;
|
||||
|
||||
// search for it
|
||||
if (layer1start == -1) {
|
||||
printf("CDVD: searching for layer1...");
|
||||
|
||||
/*tempbuffer = (u8*)malloc(CD_FRAMESIZE_RAW * 10);
|
||||
for (layer1start = (iso->blocks / 2 - 0x10) & ~0xf; layer1start < 0x200010; layer1start += 16)
|
||||
{
|
||||
isoReadBlock(iso, tempbuffer, layer1start);
|
||||
// CD001
|
||||
if (tempbuffer[off+1] == 0x43 &&
|
||||
tempbuffer[off+2] == 0x44 &&
|
||||
tempbuffer[off+3] == 0x30 &&
|
||||
tempbuffer[off+4] == 0x30 &&
|
||||
tempbuffer[off+5] == 0x31)
|
||||
break;
|
||||
}
|
||||
free(tempbuffer);*/
|
||||
|
||||
uint midsector = (iso->blocks / 2) & ~0xf;
|
||||
uint deviation = 0;
|
||||
|
||||
while ((layer1start == -1) && (deviation < midsector - 16)) {
|
||||
u8 tempbuffer[CD_FRAMESIZE_RAW];
|
||||
isoReadBlock(iso, tempbuffer, midsector - deviation);
|
||||
|
||||
if (testForPartitionInfo(tempbuffer))
|
||||
layer1start = midsector - deviation;
|
||||
else {
|
||||
isoReadBlock(iso, tempbuffer, midsector + deviation);
|
||||
if (testForPartitionInfo(tempbuffer))
|
||||
layer1start = midsector + deviation;
|
||||
}
|
||||
|
||||
if (layer1start != -1) {
|
||||
if (tempbuffer[iso->blockofs] != 0x01) {
|
||||
fprintf(stderr, "(LinuzCDVDiso): Invalid partition type on layer 1!? (type=0x%x)", tempbuffer[iso->blockofs]);
|
||||
}
|
||||
}
|
||||
deviation += 16;
|
||||
}
|
||||
|
||||
|
||||
if (layer1start == -1) {
|
||||
printf("(LinuzCDVDiso): Couldn't find second layer on dual layer... ignoring\n");
|
||||
// fake it
|
||||
tocBuff[0] = 0x04;
|
||||
tocBuff[1] = 0x02;
|
||||
tocBuff[2] = 0xF2;
|
||||
tocBuff[3] = 0x00;
|
||||
tocBuff[4] = 0x86;
|
||||
tocBuff[5] = 0x72;
|
||||
|
||||
tocBuff[16] = 0x00;
|
||||
tocBuff[17] = 0x03;
|
||||
tocBuff[18] = 0x00;
|
||||
tocBuff[19] = 0x00;
|
||||
layer1start = -2;
|
||||
return 0;
|
||||
}
|
||||
|
||||
printf("(LinuzCDVDiso): found at 0x%8.8x\n", layer1start);
|
||||
layer1start = layer1start + 0x30000 - 1;
|
||||
}
|
||||
|
||||
tocBuff[20] = layer1start >> 24;
|
||||
tocBuff[21] = (layer1start >> 16) & 0xff;
|
||||
tocBuff[22] = (layer1start >> 8) & 0xff;
|
||||
tocBuff[23] = (layer1start >> 0) & 0xff;
|
||||
} else {
|
||||
// fake it
|
||||
tocBuff[0] = 0x04;
|
||||
tocBuff[1] = 0x02;
|
||||
tocBuff[2] = 0xF2;
|
||||
tocBuff[3] = 0x00;
|
||||
tocBuff[4] = 0x86;
|
||||
tocBuff[5] = 0x72;
|
||||
|
||||
tocBuff[16] = 0x00;
|
||||
tocBuff[17] = 0x03;
|
||||
tocBuff[18] = 0x00;
|
||||
tocBuff[19] = 0x00;
|
||||
}
|
||||
} else if ((type == CDVD_TYPE_CDDA) || (type == CDVD_TYPE_PS2CDDA) ||
|
||||
(type == CDVD_TYPE_PS2CD) || (type == CDVD_TYPE_PSCDDA) || (type == CDVD_TYPE_PSCD)) {
|
||||
// cd toc
|
||||
// (could be replaced by 1 command that reads the full toc)
|
||||
u8 min, sec, frm;
|
||||
s32 i, err;
|
||||
cdvdTN diskInfo;
|
||||
cdvdTD trackInfo;
|
||||
memset(tocBuff, 0, 1024);
|
||||
if (CDVDgetTN(&diskInfo) == -1) {
|
||||
diskInfo.etrack = 0;
|
||||
diskInfo.strack = 1;
|
||||
}
|
||||
if (CDVDgetTD(0, &trackInfo) == -1)
|
||||
trackInfo.lsn = 0;
|
||||
|
||||
tocBuff[0] = 0x41;
|
||||
tocBuff[1] = 0x00;
|
||||
|
||||
//Number of FirstTrack
|
||||
tocBuff[2] = 0xA0;
|
||||
tocBuff[7] = itob(diskInfo.strack);
|
||||
|
||||
//Number of LastTrack
|
||||
tocBuff[12] = 0xA1;
|
||||
tocBuff[17] = itob(diskInfo.etrack);
|
||||
|
||||
//DiskLength
|
||||
lba_to_msf(trackInfo.lsn, &min, &sec, &frm);
|
||||
tocBuff[22] = 0xA2;
|
||||
tocBuff[27] = itob(min);
|
||||
tocBuff[28] = itob(sec);
|
||||
|
||||
for (i = diskInfo.strack; i <= diskInfo.etrack; i++) {
|
||||
err = CDVDgetTD(i, &trackInfo);
|
||||
lba_to_msf(trackInfo.lsn, &min, &sec, &frm);
|
||||
tocBuff[i * 10 + 30] = trackInfo.type;
|
||||
tocBuff[i * 10 + 32] = err == -1 ? 0 : itob(i); //number
|
||||
tocBuff[i * 10 + 37] = itob(min);
|
||||
tocBuff[i * 10 + 38] = itob(sec);
|
||||
tocBuff[i * 10 + 39] = itob(frm);
|
||||
}
|
||||
} else
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
EXPORT_C_(s32)
|
||||
CDVDreadTrack(u32 lsn, int mode)
|
||||
{
|
||||
if (!iso)
|
||||
return -1;
|
||||
|
||||
int _lsn = lsn;
|
||||
|
||||
//__Log("CDVDreadTrack: %x %x\n", lsn, mode);
|
||||
if (_lsn < 0) {
|
||||
// lsn = 2097152 + (-_lsn);
|
||||
lsn = iso->blocks - (-_lsn);
|
||||
}
|
||||
// printf ("CDRreadTrack %d\n", lsn);
|
||||
|
||||
isoReadBlock(iso, cdbuffer, lsn);
|
||||
if (fdump != NULL) {
|
||||
isoWriteBlock(fdump, cdbuffer, lsn);
|
||||
}
|
||||
|
||||
pbuffer = cdbuffer;
|
||||
switch (mode) {
|
||||
case CDVD_MODE_2352:
|
||||
break;
|
||||
case CDVD_MODE_2340:
|
||||
pbuffer += 12;
|
||||
break;
|
||||
case CDVD_MODE_2328:
|
||||
pbuffer += 24;
|
||||
break;
|
||||
case CDVD_MODE_2048:
|
||||
pbuffer += 24;
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
EXPORT_C_(u8 *)
|
||||
CDVDgetBuffer()
|
||||
{
|
||||
return pbuffer;
|
||||
}
|
||||
|
||||
EXPORT_C_(s32)
|
||||
CDVDgetDiskType()
|
||||
{
|
||||
return cdtype;
|
||||
}
|
||||
|
||||
EXPORT_C_(s32)
|
||||
CDVDgetTrayStatus()
|
||||
{
|
||||
return CDVD_TRAY_CLOSE;
|
||||
}
|
||||
|
||||
EXPORT_C_(s32)
|
||||
CDVDctrlTrayOpen()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
EXPORT_C_(s32)
|
||||
CDVDctrlTrayClose()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
EXPORT_C_(s32)
|
||||
CDVDtest()
|
||||
{
|
||||
if (*IsoFile == 0)
|
||||
return 0;
|
||||
|
||||
iso = isoOpen(IsoFile);
|
||||
if (iso == NULL)
|
||||
return -1;
|
||||
isoClose(iso);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
# Check that people use the good file
|
||||
if(NOT TOP_CMAKE_WAS_SOURCED)
|
||||
message(FATAL_ERROR "
|
||||
You did not 'cmake' the good CMakeLists.txt file. Use the one in the top dir.
|
||||
It is advice to delete all wrongly generated cmake stuff => CMakeFiles & CMakeCache.txt")
|
||||
endif()
|
||||
|
||||
|
||||
# plugin name
|
||||
set(Output CDVDiso)
|
||||
set(CDVDisoFinalFlags "")
|
||||
|
||||
# CDVDiso sources
|
||||
set(CDVDisoSources
|
||||
CDVDisop.cpp
|
||||
libiso.cpp)
|
||||
|
||||
# CDVDiso headers
|
||||
set(CDVDisoHeaders
|
||||
CDVDiso.h
|
||||
libiso.h)
|
||||
|
||||
# CDVDiso Linux sources
|
||||
set(CDVDisoLinuxSources
|
||||
Linux/Config.cpp
|
||||
Linux/interface.c
|
||||
Linux/Linux.cpp
|
||||
Linux/support.c)
|
||||
|
||||
# CDVDiso Linux headers
|
||||
set(CDVDisoLinuxHeaders
|
||||
Linux/callbacks.h
|
||||
Linux/Config.h
|
||||
Linux/interface.h
|
||||
Linux/support.h)
|
||||
|
||||
set(CDVDisoFinalSources
|
||||
${CDVDisoSources}
|
||||
${CDVDisoHeaders}
|
||||
${CDVDisoLinuxSources}
|
||||
${CDVDisoLinuxHeaders}
|
||||
)
|
||||
|
||||
set(CDVDisoFinalLibs
|
||||
${BZIP2_LIBRARIES}
|
||||
)
|
||||
|
||||
# add additional include directories
|
||||
include_directories(Linux)
|
||||
|
||||
add_pcsx2_plugin(${Output} "${CDVDisoFinalSources}" "${CDVDisoFinalLibs}" "${CDVDisoFinalFlags}")
|
|
@ -1,422 +0,0 @@
|
|||
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
|
||||
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
|
||||
|
||||
<glade-interface>
|
||||
|
||||
<widget class="GtkWindow" id="Config">
|
||||
<property name="border_width">5</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes">CDVD Config Dialog</property>
|
||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||
<property name="window_position">GTK_WIN_POS_NONE</property>
|
||||
<property name="modal">False</property>
|
||||
<property name="resizable">True</property>
|
||||
<property name="destroy_with_parent">False</property>
|
||||
<property name="decorated">True</property>
|
||||
<property name="skip_taskbar_hint">False</property>
|
||||
<property name="skip_pager_hint">False</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
|
||||
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||
<property name="focus_on_map">True</property>
|
||||
<property name="urgency_hint">False</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox1">
|
||||
<property name="border_width">5</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">5</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">10</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkEntry" id="GtkEntry_Iso">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">True</property>
|
||||
<property name="visibility">True</property>
|
||||
<property name="max_length">0</property>
|
||||
<property name="text" translatable="yes"></property>
|
||||
<property name="has_frame">True</property>
|
||||
<property name="invisible_char">*</property>
|
||||
<property name="activates_default">False</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="button5">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Select Iso</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<signal name="clicked" handler="OnFileSel"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox2">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">10</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkProgressBar" id="GtkProgressBar_Progress">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">GTK_PROGRESS_LEFT_TO_RIGHT</property>
|
||||
<property name="fraction">0</property>
|
||||
<property name="pulse_step">0.10000000149</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="button6">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Stop</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<signal name="clicked" handler="OnStop"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="pack_type">GTK_PACK_END</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox4">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">5</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label2">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Compression Method:</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCombo" id="GtkCombo_Method">
|
||||
<property name="visible">True</property>
|
||||
<property name="value_in_list">False</property>
|
||||
<property name="allow_empty">True</property>
|
||||
<property name="case_sensitive">False</property>
|
||||
<property name="enable_arrow_keys">True</property>
|
||||
<property name="enable_arrows_always">False</property>
|
||||
|
||||
<child internal-child="entry">
|
||||
<widget class="GtkEntry" id="combo-entry1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">True</property>
|
||||
<property name="visibility">True</property>
|
||||
<property name="max_length">0</property>
|
||||
<property name="text" translatable="yes"></property>
|
||||
<property name="has_frame">True</property>
|
||||
<property name="invisible_char">*</property>
|
||||
<property name="activates_default">False</property>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child internal-child="list">
|
||||
<widget class="GtkList" id="convertwidget1">
|
||||
<property name="visible">True</property>
|
||||
<property name="selection_mode">GTK_SELECTION_BROWSE</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkListItem" id="convertwidget2">
|
||||
<property name="visible">True</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="convertwidget3">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"></property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHButtonBox" id="hbuttonbox2">
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_DEFAULT_STYLE</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="GtkButton_Compress">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Compress Iso</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<signal name="clicked" handler="OnCompress"/>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="GtkButton_Decompress">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Decompress Iso</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<signal name="clicked" handler="OnDecompress"/>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox3">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">5</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Cdrom Device: </property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkEntry" id="GtkEntry_CdDev">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">True</property>
|
||||
<property name="visibility">True</property>
|
||||
<property name="max_length">0</property>
|
||||
<property name="text" translatable="yes"></property>
|
||||
<property name="has_frame">True</property>
|
||||
<property name="invisible_char">*</property>
|
||||
<property name="activates_default">False</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHButtonBox" id="hbuttonbox3">
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_DEFAULT_STYLE</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="GtkButton_Create">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Create Iso</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<signal name="clicked" handler="OnCreate"/>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="GtkButton_CreateZ">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Create Compressed Iso</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<signal name="clicked" handler="OnCreateZ"/>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="checkBlockDump">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Create a dump of the running iso</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHButtonBox" id="hbuttonbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_DEFAULT_STYLE</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="button1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label">gtk-ok</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<signal name="clicked" handler="OnOk"/>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="button2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label">gtk-cancel</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<signal name="clicked" handler="OnCancel" last_modification_time="Fri, 26 Dec 2008 04:55:33 GMT"/>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
</glade-interface>
|
|
@ -1,328 +0,0 @@
|
|||
/* CDVDiso
|
||||
* Copyright (C) 2002-2004 CDVDiso 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 "Config.h"
|
||||
|
||||
const char *s_strIniPath = "./inis/CDVDiso.ini";
|
||||
GtkWidget *AboutDlg, *ConfDlg, *MsgDlg, *FileSel;
|
||||
GtkWidget *Edit, *CdEdit;
|
||||
|
||||
void LoadConf()
|
||||
{
|
||||
FILE *f;
|
||||
char cfg[256];
|
||||
|
||||
//sprintf(cfg, "%s/.PS2E/CDVDiso.cfg", getenv("HOME"));
|
||||
strcpy(cfg, s_strIniPath);
|
||||
f = fopen(cfg, "r");
|
||||
|
||||
if (f == NULL) {
|
||||
printf("Unable to load %s\n", cfg);
|
||||
strcpy(IsoFile, DEV_DEF);
|
||||
strcpy(CdDev, CDDEV_DEF);
|
||||
BlockDump = 0;
|
||||
SaveConf();
|
||||
return;
|
||||
}
|
||||
|
||||
fscanf(f, "IsoFile = %[^\n]\n", IsoFile);
|
||||
fscanf(f, "CdDev = %[^\n]\n", CdDev);
|
||||
fscanf(f, "BlockDump = %d\n", &BlockDump);
|
||||
|
||||
if (!strncmp(IsoFile, "CdDev =", 9))
|
||||
*IsoFile = 0; // quick fix
|
||||
if (*CdDev == 0)
|
||||
strcpy(CdDev, CDDEV_DEF);
|
||||
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
void SaveConf()
|
||||
{
|
||||
FILE *f;
|
||||
char cfg[256];
|
||||
|
||||
//sprintf(cfg, "%s/.PS2E", getenv("HOME"));
|
||||
|
||||
//mkdir(cfg, 0755);
|
||||
//sprintf(cfg, "%s/.PS2E/CDVDiso.cfg", getenv("HOME"));
|
||||
strcpy(cfg, s_strIniPath);
|
||||
|
||||
f = fopen(cfg, "w");
|
||||
if (f == NULL) {
|
||||
printf("Unable to save %s\n", cfg);
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(f, "IsoFile = %s\n", IsoFile);
|
||||
fprintf(f, "CdDev = %s\n", CdDev);
|
||||
fprintf(f, "BlockDump = %d\n", BlockDump);
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
void SysMessage(char *fmt, ...)
|
||||
{
|
||||
va_list list;
|
||||
char tmp[256];
|
||||
char cmd[256];
|
||||
|
||||
va_start(list, fmt);
|
||||
vsprintf(tmp, fmt, list);
|
||||
va_end(list);
|
||||
|
||||
sprintf(cmd, "message \"%s\"", tmp);
|
||||
SysMessageLoc(tmp);
|
||||
}
|
||||
|
||||
void OnFile_Ok()
|
||||
{
|
||||
const gchar *File;
|
||||
|
||||
gtk_widget_hide(FileSel);
|
||||
File = gtk_file_selection_get_filename(GTK_FILE_SELECTION(FileSel));
|
||||
strcpy(IsoFile, File);
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
void OnFile_Cancel()
|
||||
{
|
||||
gtk_widget_hide(FileSel);
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
void CfgOpenFile()
|
||||
{
|
||||
GtkWidget *Ok, *Cancel;
|
||||
|
||||
FileSel = gtk_file_selection_new("Select Iso File");
|
||||
|
||||
Ok = GTK_FILE_SELECTION(FileSel)->ok_button;
|
||||
gtk_signal_connect(GTK_OBJECT(Ok), "clicked",
|
||||
GTK_SIGNAL_FUNC(OnFile_Ok), NULL);
|
||||
gtk_widget_show(Ok);
|
||||
|
||||
Cancel = GTK_FILE_SELECTION(FileSel)->cancel_button;
|
||||
gtk_signal_connect(GTK_OBJECT(Cancel), "clicked",
|
||||
GTK_SIGNAL_FUNC(OnFile_Cancel), NULL);
|
||||
gtk_widget_show(Cancel);
|
||||
|
||||
gtk_widget_show(FileSel);
|
||||
gdk_window_raise(FileSel->window);
|
||||
|
||||
gtk_main();
|
||||
|
||||
SaveConf();
|
||||
}
|
||||
|
||||
void OnMsg_Ok()
|
||||
{
|
||||
gtk_widget_destroy(MsgDlg);
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
void SysMessageLoc(char *fmt, ...)
|
||||
{
|
||||
GtkWidget *Ok, *Txt;
|
||||
GtkWidget *Box, *Box1;
|
||||
va_list list;
|
||||
int w;
|
||||
char msg[512];
|
||||
|
||||
va_start(list, fmt);
|
||||
vsprintf(msg, fmt, list);
|
||||
va_end(list);
|
||||
|
||||
if (msg[strlen(msg) - 1] == '\n')
|
||||
msg[strlen(msg) - 1] = 0;
|
||||
|
||||
w = strlen(msg) * 6 + 20;
|
||||
|
||||
MsgDlg = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
gtk_widget_set_usize(MsgDlg, w, 70);
|
||||
gtk_window_set_position(GTK_WINDOW(MsgDlg), GTK_WIN_POS_CENTER);
|
||||
gtk_window_set_title(GTK_WINDOW(MsgDlg), "cdriso Msg");
|
||||
gtk_container_set_border_width(GTK_CONTAINER(MsgDlg), 0);
|
||||
|
||||
Box = gtk_vbox_new(0, 0);
|
||||
gtk_container_add(GTK_CONTAINER(MsgDlg), Box);
|
||||
gtk_widget_show(Box);
|
||||
|
||||
Txt = gtk_label_new(msg);
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(Box), Txt, FALSE, FALSE, 5);
|
||||
gtk_widget_show(Txt);
|
||||
|
||||
Box1 = gtk_hbutton_box_new();
|
||||
gtk_box_pack_start(GTK_BOX(Box), Box1, FALSE, FALSE, 0);
|
||||
gtk_widget_show(Box1);
|
||||
|
||||
Ok = gtk_button_new_with_label("Ok");
|
||||
gtk_signal_connect(GTK_OBJECT(Ok), "clicked", GTK_SIGNAL_FUNC(OnMsg_Ok), NULL);
|
||||
gtk_container_add(GTK_CONTAINER(Box1), Ok);
|
||||
GTK_WIDGET_SET_FLAGS(Ok, GTK_CAN_DEFAULT);
|
||||
gtk_widget_show(Ok);
|
||||
|
||||
gtk_widget_show(MsgDlg);
|
||||
|
||||
gtk_main();
|
||||
}
|
||||
|
||||
void OnOk(GtkButton *button, gpointer user_data)
|
||||
{
|
||||
const char *tmp;
|
||||
|
||||
stop = true;
|
||||
tmp = gtk_entry_get_text(GTK_ENTRY(Edit));
|
||||
strcpy(IsoFile, tmp);
|
||||
tmp = gtk_entry_get_text(GTK_ENTRY(CdEdit));
|
||||
strcpy(CdDev, tmp);
|
||||
|
||||
if
|
||||
is_checked(ConfDlg, "checkBlockDump")
|
||||
BlockDump = 1;
|
||||
else
|
||||
BlockDump = 0;
|
||||
|
||||
SaveConf();
|
||||
gtk_widget_destroy(ConfDlg);
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
void OnCancel(GtkButton *button, gpointer user_data)
|
||||
{
|
||||
stop = true;
|
||||
gtk_widget_destroy(ConfDlg);
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
void OnFileSel_Ok()
|
||||
{
|
||||
const gchar *File;
|
||||
|
||||
File = gtk_file_selection_get_filename(GTK_FILE_SELECTION(FileSel));
|
||||
gtk_entry_set_text(GTK_ENTRY(Edit), File);
|
||||
gtk_widget_destroy(FileSel);
|
||||
}
|
||||
|
||||
void OnFileSel_Cancel()
|
||||
{
|
||||
gtk_widget_destroy(FileSel);
|
||||
}
|
||||
|
||||
void OnFileSel(GtkButton *button, gpointer user_data)
|
||||
{
|
||||
GtkWidget *Ok, *Cancel;
|
||||
|
||||
FileSel = gtk_file_selection_new("Select Psx Iso File");
|
||||
gtk_file_selection_set_filename(GTK_FILE_SELECTION(FileSel), IsoFile);
|
||||
|
||||
Ok = GTK_FILE_SELECTION(FileSel)->ok_button;
|
||||
gtk_signal_connect(GTK_OBJECT(Ok), "clicked", GTK_SIGNAL_FUNC(OnFileSel_Ok), NULL);
|
||||
gtk_widget_show(Ok);
|
||||
|
||||
Cancel = GTK_FILE_SELECTION(FileSel)->cancel_button;
|
||||
gtk_signal_connect(GTK_OBJECT(Cancel), "clicked", GTK_SIGNAL_FUNC(OnFileSel_Cancel), NULL);
|
||||
gtk_widget_show(Cancel);
|
||||
|
||||
gtk_widget_show(FileSel);
|
||||
gdk_window_raise(FileSel->window);
|
||||
}
|
||||
|
||||
|
||||
EXPORT_C_(void)
|
||||
CDVDconfigure()
|
||||
{
|
||||
int i;
|
||||
|
||||
LoadConf();
|
||||
|
||||
ConfDlg = create_Config();
|
||||
|
||||
Edit = lookup_widget(ConfDlg, "GtkEntry_Iso");
|
||||
gtk_entry_set_text(GTK_ENTRY(Edit), IsoFile);
|
||||
CdEdit = lookup_widget(ConfDlg, "GtkEntry_CdDev");
|
||||
gtk_entry_set_text(GTK_ENTRY(CdEdit), CdDev);
|
||||
|
||||
Progress = lookup_widget(ConfDlg, "GtkProgressBar_Progress");
|
||||
|
||||
BtnCompress = lookup_widget(ConfDlg, "GtkButton_Compress");
|
||||
BtnDecompress = lookup_widget(ConfDlg, "GtkButton_Decompress");
|
||||
BtnCreate = lookup_widget(ConfDlg, "GtkButton_Create");
|
||||
BtnCreateZ = lookup_widget(ConfDlg, "GtkButton_CreateZ");
|
||||
|
||||
methodlist = NULL;
|
||||
for (i = 0; i < 2; i++)
|
||||
methodlist = g_list_append(methodlist, methods[i]);
|
||||
|
||||
Method = lookup_widget(ConfDlg, "GtkCombo_Method");
|
||||
gtk_combo_set_popdown_strings(GTK_COMBO(Method), methodlist);
|
||||
if (strstr(IsoFile, ".Z") != NULL)
|
||||
gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(Method)->entry), methods[0]);
|
||||
else
|
||||
gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(Method)->entry), methods[1]);
|
||||
|
||||
set_checked(ConfDlg, "checkBlockDump", (BlockDump == 1));
|
||||
|
||||
gtk_widget_show_all(ConfDlg);
|
||||
gtk_main();
|
||||
}
|
||||
|
||||
void OnAboutOk(GtkMenuItem *menuitem, gpointer userdata)
|
||||
{
|
||||
gtk_widget_hide(AboutDlg);
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
EXPORT_C_(void)
|
||||
CDVDabout()
|
||||
{
|
||||
GtkWidget *Label;
|
||||
GtkWidget *Ok;
|
||||
GtkWidget *Box, *BBox;
|
||||
char AboutText[255];
|
||||
|
||||
sprintf(AboutText, "%s %d.%d\n", LibName, revision, build);
|
||||
|
||||
AboutDlg = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
gtk_widget_set_usize(AboutDlg, 260, 80);
|
||||
gtk_window_set_title(GTK_WINDOW(AboutDlg), "CDVD About Dialog");
|
||||
gtk_window_set_position(GTK_WINDOW(AboutDlg), GTK_WIN_POS_CENTER);
|
||||
gtk_container_set_border_width(GTK_CONTAINER(AboutDlg), 10);
|
||||
|
||||
Box = gtk_vbox_new(0, 0);
|
||||
gtk_container_add(GTK_CONTAINER(AboutDlg), Box);
|
||||
gtk_widget_show(Box);
|
||||
|
||||
Label = gtk_label_new(AboutText);
|
||||
gtk_box_pack_start(GTK_BOX(Box), Label, FALSE, FALSE, 0);
|
||||
gtk_widget_show(Label);
|
||||
|
||||
BBox = gtk_hbutton_box_new();
|
||||
gtk_box_pack_start(GTK_BOX(Box), BBox, FALSE, FALSE, 0);
|
||||
gtk_widget_show(BBox);
|
||||
|
||||
Ok = gtk_button_new_with_label("Ok");
|
||||
gtk_signal_connect(GTK_OBJECT(Ok), "clicked",
|
||||
GTK_SIGNAL_FUNC(OnAboutOk), NULL);
|
||||
gtk_container_add(GTK_CONTAINER(BBox), Ok);
|
||||
GTK_WIDGET_SET_FLAGS(Ok, GTK_CAN_DEFAULT);
|
||||
gtk_widget_show(Ok);
|
||||
|
||||
gtk_widget_show(AboutDlg);
|
||||
gtk_main();
|
||||
}
|
|
@ -1,79 +0,0 @@
|
|||
/* CDVDiso
|
||||
* Copyright (C) 2002-2004 CDVDiso 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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <linux/cdrom.h>
|
||||
#include <zlib.h>
|
||||
#include <bzlib.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "support.h"
|
||||
#include "callbacks.h"
|
||||
#include "interface.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "CDVDiso.h"
|
||||
|
||||
void SaveConf();
|
||||
void LoadConf();
|
||||
extern void SysMessageLoc(char *fmt, ...);
|
||||
|
||||
extern char *LibName;
|
||||
|
||||
extern const u8 revision;
|
||||
extern const u8 build;
|
||||
|
||||
extern GtkWidget *AboutDlg, *ConfDlg, *MsgDlg, *FileSel;
|
||||
extern GtkWidget *Edit, *CdEdit;
|
||||
extern bool stop;
|
||||
|
||||
extern GtkWidget *Method, *Progress;
|
||||
extern GtkWidget *BtnCompress, *BtnDecompress;
|
||||
extern GtkWidget *BtnCreate, *BtnCreateZ;
|
||||
|
||||
extern GList *methodlist;
|
||||
|
||||
// Make it easier to check and set checkmarks in the gui
|
||||
#define is_checked(main_widget, widget_name) (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(main_widget, widget_name))))
|
||||
#define set_checked(main_widget, widget_name, state) gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(main_widget, widget_name)), state)
|
||||
|
||||
|
||||
extern void OnFileSel(GtkButton *button, gpointer user_data);
|
||||
extern void OnStop(GtkButton *button, gpointer user_data);
|
||||
extern void OnCompress(GtkButton *button, gpointer user_data);
|
||||
extern void OnDecompress(GtkButton *button, gpointer user_data);
|
||||
extern void OnCreate(GtkButton *button, gpointer user_data);
|
||||
extern void OnCreateZ(GtkButton *button, gpointer user_data);
|
||||
extern void OnOk(GtkButton *button, gpointer user_data);
|
||||
extern void OnCancel(GtkButton *button, gpointer user_data);
|
|
@ -1,674 +0,0 @@
|
|||
/* CDVDiso
|
||||
* Copyright (C) 2002-2004 CDVDiso 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 "Config.h"
|
||||
|
||||
unsigned char Zbuf[CD_FRAMESIZE_RAW * 10 * 2];
|
||||
|
||||
GtkWidget *Method, *Progress;
|
||||
GtkWidget *BtnCompress, *BtnDecompress;
|
||||
GtkWidget *BtnCreate, *BtnCreateZ;
|
||||
|
||||
GList *methodlist;
|
||||
extern char *methods[];
|
||||
unsigned char param[4];
|
||||
int cddev = -1;
|
||||
bool stop;
|
||||
|
||||
#define CD_LEADOUT (0xaa)
|
||||
|
||||
union
|
||||
{
|
||||
struct cdrom_msf msf;
|
||||
unsigned char buf[CD_FRAMESIZE_RAW];
|
||||
} cr;
|
||||
|
||||
void OnStop(GtkButton *button, gpointer user_data)
|
||||
{
|
||||
stop = true;
|
||||
}
|
||||
|
||||
void UpdZmode()
|
||||
{
|
||||
const char *tmp;
|
||||
|
||||
tmp = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(Method)->entry));
|
||||
if (!strcmp(tmp, methods[0]))
|
||||
Zmode = 1;
|
||||
else
|
||||
Zmode = 2;
|
||||
}
|
||||
|
||||
char buffer[2352 * 10];
|
||||
|
||||
void OnCompress(GtkButton *button, gpointer user_data)
|
||||
{
|
||||
struct stat buf;
|
||||
u32 lsn;
|
||||
u8 cdbuff[10 * 2352];
|
||||
char Zfile[256];
|
||||
const char *tmp;
|
||||
int ret = 0;
|
||||
isoFile *src;
|
||||
isoFile *dst;
|
||||
|
||||
tmp = gtk_entry_get_text(GTK_ENTRY(Edit));
|
||||
strcpy(IsoFile, tmp);
|
||||
UpdZmode();
|
||||
|
||||
if (Zmode == 1)
|
||||
sprintf(Zfile, "%s.Z2", IsoFile);
|
||||
if (Zmode == 2)
|
||||
sprintf(Zfile, "%s.BZ2", IsoFile);
|
||||
|
||||
if (stat(Zfile, &buf) != -1) {
|
||||
/*char str[256];*/
|
||||
return;
|
||||
/* sprintf(str, "'%s' already exists, overwrite?", Zfile);
|
||||
if (MessageBox(hDlg, str, "Question", MB_YESNO) != IDYES) {
|
||||
return;
|
||||
}*/
|
||||
}
|
||||
|
||||
src = isoOpen(IsoFile);
|
||||
if (src == NULL)
|
||||
return;
|
||||
dst = isoCreate(Zfile, Zmode == 1 ? ISOFLAGS_Z2 : ISOFLAGS_BZ2);
|
||||
if (dst == NULL)
|
||||
return;
|
||||
|
||||
gtk_widget_set_sensitive(BtnCompress, FALSE);
|
||||
gtk_widget_set_sensitive(BtnDecompress, FALSE);
|
||||
gtk_widget_set_sensitive(BtnCreate, FALSE);
|
||||
gtk_widget_set_sensitive(BtnCreateZ, FALSE);
|
||||
stop = false;
|
||||
|
||||
for (lsn = 0; lsn < src->blocks; lsn++) {
|
||||
printf("block %d ", lsn);
|
||||
putchar(13);
|
||||
fflush(stdout);
|
||||
ret = isoReadBlock(src, cdbuff, lsn);
|
||||
if (ret == -1)
|
||||
break;
|
||||
ret = isoWriteBlock(dst, cdbuff, lsn);
|
||||
if (ret == -1)
|
||||
break;
|
||||
|
||||
gtk_progress_bar_update(GTK_PROGRESS_BAR(Progress), (lsn * 100) / src->blocks);
|
||||
while (gtk_events_pending())
|
||||
gtk_main_iteration();
|
||||
if (stop)
|
||||
break;
|
||||
}
|
||||
isoClose(src);
|
||||
isoClose(dst);
|
||||
|
||||
if (!stop)
|
||||
gtk_entry_set_text(GTK_ENTRY(Edit), IsoFile);
|
||||
|
||||
gtk_widget_set_sensitive(BtnCompress, TRUE);
|
||||
gtk_widget_set_sensitive(BtnDecompress, TRUE);
|
||||
gtk_widget_set_sensitive(BtnCreate, TRUE);
|
||||
gtk_widget_set_sensitive(BtnCreateZ, TRUE);
|
||||
|
||||
if (!stop) {
|
||||
if (ret == -1) {
|
||||
SysMessageLoc("Error compressing iso image");
|
||||
} else {
|
||||
SysMessageLoc("Iso image compressed OK");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OnDecompress(GtkButton *button, gpointer user_data)
|
||||
{
|
||||
#if 0
|
||||
struct stat buf;
|
||||
FILE *f;
|
||||
unsigned long c = 0, p = 0, s;
|
||||
char table[256];
|
||||
char *tmp;
|
||||
int blocks;
|
||||
|
||||
tmp = gtk_entry_get_text(GTK_ENTRY(Edit));
|
||||
strcpy(IsoFile, tmp);
|
||||
|
||||
if (strstr(IsoFile, ".Z") != NULL) Zmode = 1;
|
||||
else Zmode = 2;
|
||||
|
||||
strcpy(table, IsoFile);
|
||||
if (Zmode == 1) strcat(table, ".table");
|
||||
else strcat(table, ".index");
|
||||
|
||||
if (stat(table, &buf) == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Zmode == 1)
|
||||
c = s = buf.st_size / 6;
|
||||
else
|
||||
c = s = (buf.st_size / 4) - 1;
|
||||
|
||||
f = fopen(table, "rb");
|
||||
Ztable = (char*)malloc(buf.st_size);
|
||||
fread(Ztable, 1, buf.st_size, f);
|
||||
fclose(f);
|
||||
|
||||
cdHandle[0] = fopen(IsoFile, "rb");
|
||||
if (cdHandle[0] == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Zmode == 1)
|
||||
IsoFile[strlen(IsoFile) - 2] = 0;
|
||||
else
|
||||
IsoFile[strlen(IsoFile) - 3] = 0;
|
||||
|
||||
f = fopen(IsoFile, "wb");
|
||||
if (f == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_widget_set_sensitive(BtnCompress, FALSE);
|
||||
gtk_widget_set_sensitive(BtnDecompress, FALSE);
|
||||
gtk_widget_set_sensitive(BtnCreate, FALSE);
|
||||
gtk_widget_set_sensitive(BtnCreateZ, FALSE);
|
||||
stop = false;
|
||||
|
||||
if (Zmode == 1)
|
||||
{
|
||||
blocks = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
blocks = 10;
|
||||
}
|
||||
|
||||
while (c--)
|
||||
{
|
||||
unsigned long size, pos, ssize;
|
||||
float per;
|
||||
|
||||
if (Zmode == 1)
|
||||
{
|
||||
pos = *(unsigned long*) & Ztable[p * 6];
|
||||
fseek(cdHandle[0], pos, SEEK_SET);
|
||||
|
||||
ssize = *(unsigned short*) & Ztable[p * 6 + 4];
|
||||
fread(Zbuf, 1, ssize, cdHandle[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
pos = *(unsigned long*) & Ztable[p * 4];
|
||||
fseek(cdHandle[0], pos, SEEK_SET);
|
||||
|
||||
ssize = *(unsigned long*) & Ztable[p * 4 + 4] - pos;
|
||||
fread(Zbuf, 1, ssize, cdHandle[0]);
|
||||
}
|
||||
|
||||
size = CD_FRAMESIZE_RAW * blocks;
|
||||
if (Zmode == 1)
|
||||
uncompress(cdbuffer, &size, Zbuf, ssize);
|
||||
else
|
||||
BZ2_bzBuffToBuffDecompress(cdbuffer, (unsigned int*)&size, Zbuf, ssize, 0, 0);
|
||||
|
||||
fwrite(cdbuffer, 1, size, f);
|
||||
|
||||
p++;
|
||||
|
||||
per = ((float)p / s);
|
||||
|
||||
gtk_progress_bar_update(GTK_PROGRESS_BAR(Progress), per);
|
||||
while (gtk_events_pending()) gtk_main_iteration();
|
||||
|
||||
if (stop) break;
|
||||
}
|
||||
if (!stop) gtk_entry_set_text(GTK_ENTRY(Edit), IsoFile);
|
||||
|
||||
fclose(f);
|
||||
fclose(cdHandle[0]);
|
||||
cdHandle[0] = NULL;
|
||||
free(Ztable);
|
||||
Ztable = NULL;
|
||||
|
||||
gtk_widget_set_sensitive(BtnCompress, TRUE);
|
||||
gtk_widget_set_sensitive(BtnDecompress, TRUE);
|
||||
gtk_widget_set_sensitive(BtnCreate, TRUE);
|
||||
gtk_widget_set_sensitive(BtnCreateZ, TRUE);
|
||||
|
||||
if (!stop) SysMessageLoc("Iso Image Decompressed OK");
|
||||
#endif
|
||||
}
|
||||
|
||||
void incSector()
|
||||
{
|
||||
param[2]++;
|
||||
if (param[2] == 75) {
|
||||
param[2] = 0;
|
||||
param[1]++;
|
||||
}
|
||||
if (param[1] == 60) {
|
||||
param[1] = 0;
|
||||
param[0]++;
|
||||
}
|
||||
}
|
||||
|
||||
long CDR_open(void)
|
||||
{
|
||||
if (cddev != -1)
|
||||
return 0;
|
||||
cddev = open(CdDev, O_RDONLY);
|
||||
if (cddev == -1) {
|
||||
printf("CDR: Could not open %s\n", CdDev);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
long CDR_close(void)
|
||||
{
|
||||
if (cddev == -1)
|
||||
return 0;
|
||||
close(cddev);
|
||||
cddev = -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// return Starting and Ending Track
|
||||
// buffer:
|
||||
// byte 0 - start track
|
||||
// byte 1 - end track
|
||||
long CDR_getTN(unsigned char *buffer)
|
||||
{
|
||||
struct cdrom_tochdr toc;
|
||||
|
||||
if (ioctl(cddev, CDROMREADTOCHDR, &toc) == -1)
|
||||
return -1;
|
||||
|
||||
buffer[0] = toc.cdth_trk0; // start track
|
||||
buffer[1] = toc.cdth_trk1; // end track
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// return Track Time
|
||||
// buffer:
|
||||
// byte 0 - frame
|
||||
// byte 1 - second
|
||||
// byte 2 - minute
|
||||
long CDR_getTD(unsigned char track, unsigned char *buffer)
|
||||
{
|
||||
struct cdrom_tocentry entry;
|
||||
|
||||
if (track == 0)
|
||||
track = 0xaa; // total time
|
||||
entry.cdte_track = track;
|
||||
entry.cdte_format = CDROM_MSF;
|
||||
|
||||
if (ioctl(cddev, CDROMREADTOCENTRY, &entry) == -1)
|
||||
return -1;
|
||||
|
||||
buffer[0] = entry.cdte_addr.msf.minute; /* minute */
|
||||
buffer[1] = entry.cdte_addr.msf.second; /* second */
|
||||
buffer[2] = entry.cdte_addr.msf.frame; /* frame */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// read track
|
||||
// time:
|
||||
// byte 0 - minute
|
||||
// byte 1 - second
|
||||
// byte 2 - frame
|
||||
unsigned char *CDR_readTrack(unsigned char *time)
|
||||
{
|
||||
cr.msf.cdmsf_min0 = time[0];
|
||||
cr.msf.cdmsf_sec0 = time[1];
|
||||
cr.msf.cdmsf_frame0 = time[2];
|
||||
|
||||
if (ioctl(cddev, CDROMREADRAW, &cr) == -1)
|
||||
return NULL;
|
||||
return cr.buf;
|
||||
}
|
||||
|
||||
|
||||
void OnCreate(GtkButton *button, gpointer user_data)
|
||||
{
|
||||
FILE *f;
|
||||
struct stat buf;
|
||||
struct tm *Tm;
|
||||
time_t Ttime;
|
||||
unsigned long ftrack, ltrack;
|
||||
unsigned long p = 0, s;
|
||||
unsigned char *buffer;
|
||||
unsigned char bufferz[2352];
|
||||
unsigned char start[4], end[4];
|
||||
const char *tmp;
|
||||
#ifdef VERBOSE
|
||||
unsigned long count = 0;
|
||||
int i = 0;
|
||||
#endif
|
||||
|
||||
memset(bufferz, 0, sizeof(bufferz));
|
||||
ftrack = 1;
|
||||
ltrack = CD_LEADOUT;
|
||||
|
||||
tmp = gtk_entry_get_text(GTK_ENTRY(Edit));
|
||||
strcpy(IsoFile, tmp);
|
||||
|
||||
if (stat(IsoFile, &buf) == 0) {
|
||||
printf("File %s Already exists\n", IsoFile);
|
||||
return;
|
||||
}
|
||||
|
||||
if (CDR_open() == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (CDR_getTD(ftrack, start) == -1) {
|
||||
printf("Error getting TD\n");
|
||||
|
||||
CDR_close();
|
||||
return;
|
||||
}
|
||||
if (CDR_getTD(ltrack, end) == -1) {
|
||||
printf("Error getting TD\n");
|
||||
|
||||
CDR_close();
|
||||
return;
|
||||
}
|
||||
|
||||
f = fopen(IsoFile, "wb");
|
||||
if (f == NULL) {
|
||||
CDR_close();
|
||||
printf("Error opening %s", IsoFile);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("Making Iso: from %2.2d:%2.2d:%2.2d to %2.2d:%2.2d:%2.2d\n",
|
||||
start[0], start[1], start[2], end[0], end[1], end[2]);
|
||||
|
||||
memcpy(param, start, 3);
|
||||
|
||||
time(&Ttime);
|
||||
|
||||
stop = false;
|
||||
s = MSF2SECT(end[0], end[1], end[2]);
|
||||
gtk_widget_set_sensitive(BtnCompress, FALSE);
|
||||
gtk_widget_set_sensitive(BtnDecompress, FALSE);
|
||||
gtk_widget_set_sensitive(BtnCreate, FALSE);
|
||||
gtk_widget_set_sensitive(BtnCreateZ, FALSE);
|
||||
|
||||
for (;;) /* loop until end */
|
||||
{
|
||||
float per;
|
||||
|
||||
if ((param[0] == end[0]) & (param[1] == end[1]) & (param[2] == end[2]))
|
||||
break;
|
||||
buffer = CDR_readTrack(param);
|
||||
if (buffer == NULL) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 10; i++) {
|
||||
buffer = CDR_readTrack(param);
|
||||
if (buffer != NULL)
|
||||
break;
|
||||
}
|
||||
if (buffer == NULL) {
|
||||
printf("Error Reading %2d:%2d:%2d\n", param[0], param[1], param[2]);
|
||||
buffer = bufferz;
|
||||
buffer[12] = param[0];
|
||||
buffer[13] = param[1];
|
||||
buffer[14] = param[2];
|
||||
buffer[15] = 0x2;
|
||||
}
|
||||
}
|
||||
fwrite(buffer, 1, 2352, f);
|
||||
#ifdef VERBOSE
|
||||
count += CD_FRAMESIZE_RAW;
|
||||
|
||||
printf("reading %2d:%2d:%2d ", param[0], param[1], param[2]);
|
||||
if ((time(NULL) - Ttime) != 0) {
|
||||
i = (count / 1024) / (time(NULL) - Ttime);
|
||||
printf("( %5dKbytes/s, %dX)", i, i / 150);
|
||||
}
|
||||
putchar(13);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
incSector();
|
||||
|
||||
p++;
|
||||
per = ((float)p / s);
|
||||
gtk_progress_bar_update(GTK_PROGRESS_BAR(Progress), per);
|
||||
while (gtk_events_pending())
|
||||
gtk_main_iteration();
|
||||
if (stop)
|
||||
break;
|
||||
}
|
||||
|
||||
Ttime = time(NULL) - Ttime;
|
||||
Tm = gmtime(&Ttime);
|
||||
printf("\nTotal Time used: %d:%d:%d\n", Tm->tm_hour, Tm->tm_min,
|
||||
Tm->tm_sec);
|
||||
|
||||
CDR_close();
|
||||
fclose(f);
|
||||
|
||||
gtk_widget_set_sensitive(BtnCompress, TRUE);
|
||||
gtk_widget_set_sensitive(BtnDecompress, TRUE);
|
||||
gtk_widget_set_sensitive(BtnCreate, TRUE);
|
||||
gtk_widget_set_sensitive(BtnCreateZ, TRUE);
|
||||
|
||||
if (!stop)
|
||||
SysMessageLoc("Iso Image Created OK");
|
||||
}
|
||||
|
||||
void OnCreateZ(GtkButton *button, gpointer user_data)
|
||||
{
|
||||
FILE *f;
|
||||
FILE *t;
|
||||
struct stat buf;
|
||||
struct tm *Tm;
|
||||
time_t Ttime;
|
||||
unsigned long ftrack, ltrack;
|
||||
unsigned long p = 0, s, c = 0;
|
||||
unsigned char *buffer;
|
||||
unsigned char bufferz[2352];
|
||||
unsigned char start[4], end[4];
|
||||
char table[256];
|
||||
const char *tmp;
|
||||
int b, blocks;
|
||||
#ifdef VERBOSE
|
||||
unsigned long count = 0;
|
||||
int i = 0;
|
||||
#endif
|
||||
|
||||
memset(bufferz, 0, sizeof(bufferz));
|
||||
ftrack = 1;
|
||||
ltrack = CD_LEADOUT;
|
||||
|
||||
tmp = gtk_entry_get_text(GTK_ENTRY(Edit));
|
||||
strcpy(IsoFile, tmp);
|
||||
|
||||
UpdZmode();
|
||||
|
||||
if (Zmode == 1) {
|
||||
blocks = 1;
|
||||
if (strstr(IsoFile, ".Z") == NULL)
|
||||
strcat(IsoFile, ".Z");
|
||||
} else {
|
||||
blocks = 10;
|
||||
if (strstr(IsoFile, ".bz") == NULL)
|
||||
strcat(IsoFile, ".bz");
|
||||
}
|
||||
|
||||
if (stat(IsoFile, &buf) == 0) {
|
||||
printf("File %s Already exists\n", IsoFile);
|
||||
return;
|
||||
}
|
||||
|
||||
strcpy(table, IsoFile);
|
||||
if (Zmode == 1)
|
||||
strcat(table, ".table");
|
||||
else
|
||||
strcat(table, ".index");
|
||||
|
||||
t = fopen(table, "wb");
|
||||
|
||||
if (t == NULL)
|
||||
return;
|
||||
if (CDR_open() == -1) {
|
||||
fclose(t);
|
||||
return;
|
||||
}
|
||||
if (CDR_getTD(ftrack, start) == -1) {
|
||||
printf("Error getting TD\n");
|
||||
CDR_close();
|
||||
fclose(t);
|
||||
return;
|
||||
}
|
||||
|
||||
if (CDR_getTD(ltrack, end) == -1) {
|
||||
printf("Error getting TD\n");
|
||||
CDR_close();
|
||||
fclose(t);
|
||||
return;
|
||||
}
|
||||
|
||||
f = fopen(IsoFile, "wb");
|
||||
if (f == NULL) {
|
||||
CDR_close();
|
||||
fclose(t);
|
||||
printf("Error opening %s", IsoFile);
|
||||
return;
|
||||
}
|
||||
|
||||
printf("Making Iso: from %2.2d:%2.2d:%2.2d to %2.2d:%2.2d:%2.2d\n",
|
||||
start[0], start[1], start[2], end[0], end[1], end[2]);
|
||||
|
||||
memcpy(param, start, 3);
|
||||
|
||||
time(&Ttime);
|
||||
|
||||
stop = false;
|
||||
s = MSF2SECT(end[0], end[1], end[2]) / blocks;
|
||||
gtk_widget_set_sensitive(BtnCompress, FALSE);
|
||||
gtk_widget_set_sensitive(BtnDecompress, FALSE);
|
||||
gtk_widget_set_sensitive(BtnCreate, FALSE);
|
||||
gtk_widget_set_sensitive(BtnCreateZ, FALSE);
|
||||
|
||||
for (;;) /* loop until end */
|
||||
{
|
||||
unsigned long size;
|
||||
unsigned char Zbuf[CD_FRAMESIZE_RAW * 10 * 2];
|
||||
float per;
|
||||
|
||||
for (b = 0; b < blocks; b++) {
|
||||
if ((param[0] == end[0]) & (param[1] == end[1]) & (param[2] == end[2]))
|
||||
break;
|
||||
|
||||
buffer = CDR_readTrack(param);
|
||||
if (buffer == NULL) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 10; i++) {
|
||||
buffer = CDR_readTrack(param);
|
||||
if (buffer != NULL)
|
||||
break;
|
||||
}
|
||||
|
||||
if (buffer == NULL) {
|
||||
printf("Error Reading %2d:%2d:%2d\n", param[0], param[1], param[2]);
|
||||
buffer = bufferz;
|
||||
buffer[12] = param[0];
|
||||
buffer[13] = param[1];
|
||||
buffer[14] = param[2];
|
||||
buffer[15] = 0x2;
|
||||
}
|
||||
}
|
||||
memcpy(cdbuffer + b * CD_FRAMESIZE_RAW, buffer, CD_FRAMESIZE_RAW);
|
||||
|
||||
incSector();
|
||||
}
|
||||
if ((param[0] == end[0]) & (param[1] == end[1]) & (param[2] == end[2]))
|
||||
break;
|
||||
|
||||
size = CD_FRAMESIZE_RAW * blocks * 2;
|
||||
if (Zmode == 1)
|
||||
compress(Zbuf, &size, cdbuffer, CD_FRAMESIZE_RAW);
|
||||
else
|
||||
BZ2_bzBuffToBuffCompress((char *)Zbuf, (unsigned int *)&size, (char *)cdbuffer, CD_FRAMESIZE_RAW * 10, 1, 0, 30);
|
||||
|
||||
fwrite(&c, 1, 4, t);
|
||||
if (Zmode == 1)
|
||||
fwrite(&size, 1, 2, t);
|
||||
|
||||
fwrite(Zbuf, 1, size, f);
|
||||
|
||||
c += size;
|
||||
#ifdef VERBOSE
|
||||
count += CD_FRAMESIZE_RAW * blocks;
|
||||
|
||||
printf("reading %2d:%2d:%2d ", param[0], param[1], param[2]);
|
||||
if ((time(NULL) - Ttime) != 0) {
|
||||
i = (count / 1024) / (time(NULL) - Ttime);
|
||||
printf("( %5dKbytes/s, %dX)", i, i / 150);
|
||||
}
|
||||
putchar(13);
|
||||
fflush(stdout);
|
||||
#endif
|
||||
|
||||
p++;
|
||||
per = ((float)p / s);
|
||||
|
||||
gtk_progress_bar_update(GTK_PROGRESS_BAR(Progress), per);
|
||||
while (gtk_events_pending())
|
||||
gtk_main_iteration();
|
||||
|
||||
if (stop)
|
||||
break;
|
||||
}
|
||||
if (Zmode == 2)
|
||||
fwrite(&c, 1, 4, f);
|
||||
|
||||
if (!stop)
|
||||
gtk_entry_set_text(GTK_ENTRY(Edit), IsoFile);
|
||||
|
||||
Ttime = time(NULL) - Ttime;
|
||||
Tm = gmtime(&Ttime);
|
||||
printf("\nTotal Time used: %d:%d:%d\n", Tm->tm_hour, Tm->tm_min,
|
||||
Tm->tm_sec);
|
||||
|
||||
CDR_close();
|
||||
fclose(f);
|
||||
fclose(t);
|
||||
|
||||
gtk_widget_set_sensitive(BtnCompress, TRUE);
|
||||
gtk_widget_set_sensitive(BtnDecompress, TRUE);
|
||||
gtk_widget_set_sensitive(BtnCreate, TRUE);
|
||||
gtk_widget_set_sensitive(BtnCreateZ, TRUE);
|
||||
|
||||
if (!stop)
|
||||
SysMessageLoc("Compressed Iso Image Created OK");
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
|
||||
CC = gcc
|
||||
|
||||
PLUGIN = libCDVDiso.so
|
||||
CFG = cfgCDVDiso
|
||||
MKISO = mkiso
|
||||
CFLAGS = -fPIC -Wall -g -I.. -I. -D_FILE_OFFSET_BITS=64 -Wextra
|
||||
OBJS = ../CDVDisop.o Config.o Linux.o ../libiso.o
|
||||
CFGOBJS = conf.o interface.o support.o ${OBJS}
|
||||
LIBS = -lz -lbz2 -lstdc++
|
||||
CFGLIBS = $(shell pkg-config --libs gtk+-2.0) ${LIBS}
|
||||
CFLAGS += $(shell pkg-config --cflags gtk+-2.0) -I../../../../common/include -I../../../../3rdparty
|
||||
DEPS:= $(OBJS:.o=.d) $(CFGOBJS:.o=.d)
|
||||
|
||||
all: plugin cfg
|
||||
install: all
|
||||
|
||||
plugin: ${OBJS}
|
||||
rm -f ${PLUGIN}
|
||||
${CC} -shared -Wl,-soname,${PLUGIN} ${CFLAGS} ${OBJS} -o ${PLUGIN} ${LIBS}
|
||||
|
||||
cfg: ${CFGOBJS}
|
||||
rm -f ${CFG}
|
||||
${CC} ${CFLAGS} ${CFGOBJS} -o ${CFG} ${CFGLIBS}
|
||||
strip ${CFG}
|
||||
|
||||
clean:
|
||||
rm -f ${OBJS} ${DEPS} ${PLUGIN} ${CFGOBJS} ${CFG}
|
||||
|
||||
%.o: %.c
|
||||
${CC} ${CFLAGS} -c -o $@ $< -MD -MF $(patsubst %.o,%.d,$@)
|
||||
|
||||
-include ${DEPS}
|
|
@ -1,74 +0,0 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "callbacks.h"
|
||||
#include "interface.h"
|
||||
#include "support.h"
|
||||
|
||||
|
||||
void
|
||||
OnFileSel (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
OnStop (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
OnCompress (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
OnDecompress (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
OnCreate (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
OnCreateZ (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
OnOk (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
OnCancel (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
#include <gtk/gtk.h>
|
||||
|
||||
|
||||
void OnFileSel(GtkButton *button,
|
||||
gpointer user_data);
|
||||
|
||||
void OnStop(GtkButton *button,
|
||||
gpointer user_data);
|
||||
|
||||
void OnCompress(GtkButton *button,
|
||||
gpointer user_data);
|
||||
|
||||
void OnDecompress(GtkButton *button,
|
||||
gpointer user_data);
|
||||
|
||||
void OnCreate(GtkButton *button,
|
||||
gpointer user_data);
|
||||
|
||||
void OnCreateZ(GtkButton *button,
|
||||
gpointer user_data);
|
||||
|
||||
void OnOk(GtkButton *button,
|
||||
gpointer user_data);
|
||||
|
||||
void OnCancel(GtkButton *button,
|
||||
gpointer user_data);
|
|
@ -1,251 +0,0 @@
|
|||
/*
|
||||
* DO NOT EDIT THIS FILE - it is generated by Glade.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "callbacks.h"
|
||||
#include "interface.h"
|
||||
#include "support.h"
|
||||
|
||||
#define GLADE_HOOKUP_OBJECT(component,widget,name) \
|
||||
g_object_set_data_full (G_OBJECT (component), name, \
|
||||
gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref)
|
||||
|
||||
#define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \
|
||||
g_object_set_data (G_OBJECT (component), name, widget)
|
||||
|
||||
GtkWidget*
|
||||
create_Config (void)
|
||||
{
|
||||
GtkWidget *Config;
|
||||
GtkWidget *vbox1;
|
||||
GtkWidget *hbox1;
|
||||
GtkWidget *GtkEntry_Iso;
|
||||
GtkWidget *button5;
|
||||
GtkWidget *hbox2;
|
||||
GtkWidget *GtkProgressBar_Progress;
|
||||
GtkWidget *button6;
|
||||
GtkWidget *hbox4;
|
||||
GtkWidget *label2;
|
||||
GtkWidget *GtkCombo_Method;
|
||||
GList *GtkCombo_Method_items = NULL;
|
||||
GtkWidget *combo_entry1;
|
||||
GtkWidget *hbuttonbox2;
|
||||
GtkWidget *GtkButton_Compress;
|
||||
GtkWidget *GtkButton_Decompress;
|
||||
GtkWidget *hbox3;
|
||||
GtkWidget *label1;
|
||||
GtkWidget *GtkEntry_CdDev;
|
||||
GtkWidget *hbuttonbox3;
|
||||
GtkWidget *GtkButton_Create;
|
||||
GtkWidget *GtkButton_CreateZ;
|
||||
GtkWidget *checkBlockDump;
|
||||
GtkWidget *hbuttonbox1;
|
||||
GtkWidget *button1;
|
||||
GtkWidget *button2;
|
||||
|
||||
Config = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_widget_set_name (Config, "Config");
|
||||
gtk_container_set_border_width (GTK_CONTAINER (Config), 5);
|
||||
gtk_window_set_title (GTK_WINDOW (Config), _("CDVD Config Dialog"));
|
||||
|
||||
vbox1 = gtk_vbox_new (FALSE, 5);
|
||||
gtk_widget_set_name (vbox1, "vbox1");
|
||||
gtk_widget_show (vbox1);
|
||||
gtk_container_add (GTK_CONTAINER (Config), vbox1);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox1), 5);
|
||||
|
||||
hbox1 = gtk_hbox_new (FALSE, 10);
|
||||
gtk_widget_set_name (hbox1, "hbox1");
|
||||
gtk_widget_show (hbox1);
|
||||
gtk_box_pack_start (GTK_BOX (vbox1), hbox1, TRUE, TRUE, 0);
|
||||
|
||||
GtkEntry_Iso = gtk_entry_new ();
|
||||
gtk_widget_set_name (GtkEntry_Iso, "GtkEntry_Iso");
|
||||
gtk_widget_show (GtkEntry_Iso);
|
||||
gtk_box_pack_start (GTK_BOX (hbox1), GtkEntry_Iso, TRUE, TRUE, 0);
|
||||
|
||||
button5 = gtk_button_new_with_mnemonic (_("Select Iso"));
|
||||
gtk_widget_set_name (button5, "button5");
|
||||
gtk_widget_show (button5);
|
||||
gtk_box_pack_start (GTK_BOX (hbox1), button5, FALSE, FALSE, 0);
|
||||
|
||||
hbox2 = gtk_hbox_new (FALSE, 10);
|
||||
gtk_widget_set_name (hbox2, "hbox2");
|
||||
gtk_widget_show (hbox2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox1), hbox2, FALSE, FALSE, 0);
|
||||
|
||||
GtkProgressBar_Progress = gtk_progress_bar_new ();
|
||||
gtk_widget_set_name (GtkProgressBar_Progress, "GtkProgressBar_Progress");
|
||||
gtk_widget_show (GtkProgressBar_Progress);
|
||||
gtk_box_pack_start (GTK_BOX (hbox2), GtkProgressBar_Progress, TRUE, FALSE, 0);
|
||||
|
||||
button6 = gtk_button_new_with_mnemonic (_("Stop"));
|
||||
gtk_widget_set_name (button6, "button6");
|
||||
gtk_widget_show (button6);
|
||||
gtk_box_pack_end (GTK_BOX (hbox2), button6, FALSE, FALSE, 0);
|
||||
|
||||
hbox4 = gtk_hbox_new (FALSE, 5);
|
||||
gtk_widget_set_name (hbox4, "hbox4");
|
||||
gtk_widget_show (hbox4);
|
||||
gtk_box_pack_start (GTK_BOX (vbox1), hbox4, TRUE, TRUE, 0);
|
||||
|
||||
label2 = gtk_label_new (_("Compression Method:"));
|
||||
gtk_widget_set_name (label2, "label2");
|
||||
gtk_widget_show (label2);
|
||||
gtk_box_pack_start (GTK_BOX (hbox4), label2, FALSE, FALSE, 0);
|
||||
gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_CENTER);
|
||||
|
||||
GtkCombo_Method = gtk_combo_new ();
|
||||
g_object_set_data (G_OBJECT (GTK_COMBO (GtkCombo_Method)->popwin),
|
||||
"GladeParentKey", GtkCombo_Method);
|
||||
gtk_widget_set_name (GtkCombo_Method, "GtkCombo_Method");
|
||||
gtk_widget_show (GtkCombo_Method);
|
||||
gtk_box_pack_start (GTK_BOX (hbox4), GtkCombo_Method, TRUE, FALSE, 0);
|
||||
GtkCombo_Method_items = g_list_append (GtkCombo_Method_items, (gpointer) "");
|
||||
gtk_combo_set_popdown_strings (GTK_COMBO (GtkCombo_Method), GtkCombo_Method_items);
|
||||
g_list_free (GtkCombo_Method_items);
|
||||
|
||||
combo_entry1 = GTK_COMBO (GtkCombo_Method)->entry;
|
||||
gtk_widget_set_name (combo_entry1, "combo_entry1");
|
||||
gtk_widget_show (combo_entry1);
|
||||
|
||||
hbuttonbox2 = gtk_hbutton_box_new ();
|
||||
gtk_widget_set_name (hbuttonbox2, "hbuttonbox2");
|
||||
gtk_widget_show (hbuttonbox2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox1), hbuttonbox2, TRUE, TRUE, 0);
|
||||
|
||||
GtkButton_Compress = gtk_button_new_with_mnemonic (_("Compress Iso"));
|
||||
gtk_widget_set_name (GtkButton_Compress, "GtkButton_Compress");
|
||||
gtk_widget_show (GtkButton_Compress);
|
||||
gtk_container_add (GTK_CONTAINER (hbuttonbox2), GtkButton_Compress);
|
||||
GTK_WIDGET_SET_FLAGS (GtkButton_Compress, GTK_CAN_DEFAULT);
|
||||
|
||||
GtkButton_Decompress = gtk_button_new_with_mnemonic (_("Decompress Iso"));
|
||||
gtk_widget_set_name (GtkButton_Decompress, "GtkButton_Decompress");
|
||||
gtk_widget_show (GtkButton_Decompress);
|
||||
gtk_container_add (GTK_CONTAINER (hbuttonbox2), GtkButton_Decompress);
|
||||
GTK_WIDGET_SET_FLAGS (GtkButton_Decompress, GTK_CAN_DEFAULT);
|
||||
|
||||
hbox3 = gtk_hbox_new (FALSE, 5);
|
||||
gtk_widget_set_name (hbox3, "hbox3");
|
||||
gtk_widget_show (hbox3);
|
||||
gtk_box_pack_start (GTK_BOX (vbox1), hbox3, FALSE, FALSE, 0);
|
||||
|
||||
label1 = gtk_label_new (_("Cdrom Device: "));
|
||||
gtk_widget_set_name (label1, "label1");
|
||||
gtk_widget_show (label1);
|
||||
gtk_box_pack_start (GTK_BOX (hbox3), label1, FALSE, FALSE, 0);
|
||||
gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_CENTER);
|
||||
|
||||
GtkEntry_CdDev = gtk_entry_new ();
|
||||
gtk_widget_set_name (GtkEntry_CdDev, "GtkEntry_CdDev");
|
||||
gtk_widget_show (GtkEntry_CdDev);
|
||||
gtk_box_pack_start (GTK_BOX (hbox3), GtkEntry_CdDev, TRUE, TRUE, 0);
|
||||
|
||||
hbuttonbox3 = gtk_hbutton_box_new ();
|
||||
gtk_widget_set_name (hbuttonbox3, "hbuttonbox3");
|
||||
gtk_widget_show (hbuttonbox3);
|
||||
gtk_box_pack_start (GTK_BOX (vbox1), hbuttonbox3, TRUE, TRUE, 0);
|
||||
|
||||
GtkButton_Create = gtk_button_new_with_mnemonic (_("Create Iso"));
|
||||
gtk_widget_set_name (GtkButton_Create, "GtkButton_Create");
|
||||
gtk_widget_show (GtkButton_Create);
|
||||
gtk_container_add (GTK_CONTAINER (hbuttonbox3), GtkButton_Create);
|
||||
GTK_WIDGET_SET_FLAGS (GtkButton_Create, GTK_CAN_DEFAULT);
|
||||
|
||||
GtkButton_CreateZ = gtk_button_new_with_mnemonic (_("Create Compressed Iso"));
|
||||
gtk_widget_set_name (GtkButton_CreateZ, "GtkButton_CreateZ");
|
||||
gtk_widget_show (GtkButton_CreateZ);
|
||||
gtk_container_add (GTK_CONTAINER (hbuttonbox3), GtkButton_CreateZ);
|
||||
GTK_WIDGET_SET_FLAGS (GtkButton_CreateZ, GTK_CAN_DEFAULT);
|
||||
|
||||
checkBlockDump = gtk_check_button_new_with_mnemonic (_("Create a dump of the running iso"));
|
||||
gtk_widget_set_name (checkBlockDump, "checkBlockDump");
|
||||
gtk_widget_show (checkBlockDump);
|
||||
gtk_box_pack_start (GTK_BOX (vbox1), checkBlockDump, FALSE, FALSE, 0);
|
||||
|
||||
hbuttonbox1 = gtk_hbutton_box_new ();
|
||||
gtk_widget_set_name (hbuttonbox1, "hbuttonbox1");
|
||||
gtk_widget_show (hbuttonbox1);
|
||||
gtk_box_pack_start (GTK_BOX (vbox1), hbuttonbox1, TRUE, TRUE, 0);
|
||||
|
||||
button1 = gtk_button_new_from_stock ("gtk-ok");
|
||||
gtk_widget_set_name (button1, "button1");
|
||||
gtk_widget_show (button1);
|
||||
gtk_container_add (GTK_CONTAINER (hbuttonbox1), button1);
|
||||
GTK_WIDGET_SET_FLAGS (button1, GTK_CAN_DEFAULT);
|
||||
|
||||
button2 = gtk_button_new_from_stock ("gtk-cancel");
|
||||
gtk_widget_set_name (button2, "button2");
|
||||
gtk_widget_show (button2);
|
||||
gtk_container_add (GTK_CONTAINER (hbuttonbox1), button2);
|
||||
GTK_WIDGET_SET_FLAGS (button2, GTK_CAN_DEFAULT);
|
||||
|
||||
g_signal_connect ((gpointer) button5, "clicked",
|
||||
G_CALLBACK (OnFileSel),
|
||||
NULL);
|
||||
g_signal_connect ((gpointer) button6, "clicked",
|
||||
G_CALLBACK (OnStop),
|
||||
NULL);
|
||||
g_signal_connect ((gpointer) GtkButton_Compress, "clicked",
|
||||
G_CALLBACK (OnCompress),
|
||||
NULL);
|
||||
g_signal_connect ((gpointer) GtkButton_Decompress, "clicked",
|
||||
G_CALLBACK (OnDecompress),
|
||||
NULL);
|
||||
g_signal_connect ((gpointer) GtkButton_Create, "clicked",
|
||||
G_CALLBACK (OnCreate),
|
||||
NULL);
|
||||
g_signal_connect ((gpointer) GtkButton_CreateZ, "clicked",
|
||||
G_CALLBACK (OnCreateZ),
|
||||
NULL);
|
||||
g_signal_connect ((gpointer) button1, "clicked",
|
||||
G_CALLBACK (OnOk),
|
||||
NULL);
|
||||
g_signal_connect ((gpointer) button2, "clicked",
|
||||
G_CALLBACK (OnCancel),
|
||||
NULL);
|
||||
|
||||
/* Store pointers to all widgets, for use by lookup_widget(). */
|
||||
GLADE_HOOKUP_OBJECT_NO_REF (Config, Config, "Config");
|
||||
GLADE_HOOKUP_OBJECT (Config, vbox1, "vbox1");
|
||||
GLADE_HOOKUP_OBJECT (Config, hbox1, "hbox1");
|
||||
GLADE_HOOKUP_OBJECT (Config, GtkEntry_Iso, "GtkEntry_Iso");
|
||||
GLADE_HOOKUP_OBJECT (Config, button5, "button5");
|
||||
GLADE_HOOKUP_OBJECT (Config, hbox2, "hbox2");
|
||||
GLADE_HOOKUP_OBJECT (Config, GtkProgressBar_Progress, "GtkProgressBar_Progress");
|
||||
GLADE_HOOKUP_OBJECT (Config, button6, "button6");
|
||||
GLADE_HOOKUP_OBJECT (Config, hbox4, "hbox4");
|
||||
GLADE_HOOKUP_OBJECT (Config, label2, "label2");
|
||||
GLADE_HOOKUP_OBJECT (Config, GtkCombo_Method, "GtkCombo_Method");
|
||||
GLADE_HOOKUP_OBJECT (Config, combo_entry1, "combo_entry1");
|
||||
GLADE_HOOKUP_OBJECT (Config, hbuttonbox2, "hbuttonbox2");
|
||||
GLADE_HOOKUP_OBJECT (Config, GtkButton_Compress, "GtkButton_Compress");
|
||||
GLADE_HOOKUP_OBJECT (Config, GtkButton_Decompress, "GtkButton_Decompress");
|
||||
GLADE_HOOKUP_OBJECT (Config, hbox3, "hbox3");
|
||||
GLADE_HOOKUP_OBJECT (Config, label1, "label1");
|
||||
GLADE_HOOKUP_OBJECT (Config, GtkEntry_CdDev, "GtkEntry_CdDev");
|
||||
GLADE_HOOKUP_OBJECT (Config, hbuttonbox3, "hbuttonbox3");
|
||||
GLADE_HOOKUP_OBJECT (Config, GtkButton_Create, "GtkButton_Create");
|
||||
GLADE_HOOKUP_OBJECT (Config, GtkButton_CreateZ, "GtkButton_CreateZ");
|
||||
GLADE_HOOKUP_OBJECT (Config, checkBlockDump, "checkBlockDump");
|
||||
GLADE_HOOKUP_OBJECT (Config, hbuttonbox1, "hbuttonbox1");
|
||||
GLADE_HOOKUP_OBJECT (Config, button1, "button1");
|
||||
GLADE_HOOKUP_OBJECT (Config, button2, "button2");
|
||||
|
||||
return Config;
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
/*
|
||||
* DO NOT EDIT THIS FILE - it is generated by Glade.
|
||||
*/
|
||||
|
||||
GtkWidget *create_Config(void);
|
|
@ -1,144 +0,0 @@
|
|||
/*
|
||||
* DO NOT EDIT THIS FILE - it is generated by Glade.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "support.h"
|
||||
|
||||
GtkWidget*
|
||||
lookup_widget (GtkWidget *widget,
|
||||
const gchar *widget_name)
|
||||
{
|
||||
GtkWidget *parent, *found_widget;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (GTK_IS_MENU (widget))
|
||||
parent = gtk_menu_get_attach_widget (GTK_MENU (widget));
|
||||
else
|
||||
parent = widget->parent;
|
||||
if (!parent)
|
||||
parent = (GtkWidget*) g_object_get_data (G_OBJECT (widget), "GladeParentKey");
|
||||
if (parent == NULL)
|
||||
break;
|
||||
widget = parent;
|
||||
}
|
||||
|
||||
found_widget = (GtkWidget*) g_object_get_data (G_OBJECT (widget),
|
||||
widget_name);
|
||||
if (!found_widget)
|
||||
g_warning ("Widget not found: %s", widget_name);
|
||||
return found_widget;
|
||||
}
|
||||
|
||||
static GList *pixmaps_directories = NULL;
|
||||
|
||||
/* Use this function to set the directory containing installed pixmaps. */
|
||||
void
|
||||
add_pixmap_directory (const gchar *directory)
|
||||
{
|
||||
pixmaps_directories = g_list_prepend (pixmaps_directories,
|
||||
g_strdup (directory));
|
||||
}
|
||||
|
||||
/* This is an internally used function to find pixmap files. */
|
||||
static gchar*
|
||||
find_pixmap_file (const gchar *filename)
|
||||
{
|
||||
GList *elem;
|
||||
|
||||
/* We step through each of the pixmaps directory to find it. */
|
||||
elem = pixmaps_directories;
|
||||
while (elem)
|
||||
{
|
||||
gchar *pathname = g_strdup_printf ("%s%s%s", (gchar*)elem->data,
|
||||
G_DIR_SEPARATOR_S, filename);
|
||||
if (g_file_test (pathname, G_FILE_TEST_EXISTS))
|
||||
return pathname;
|
||||
g_free (pathname);
|
||||
elem = elem->next;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* This is an internally used function to create pixmaps. */
|
||||
GtkWidget*
|
||||
create_pixmap (GtkWidget *widget,
|
||||
const gchar *filename)
|
||||
{
|
||||
gchar *pathname = NULL;
|
||||
GtkWidget *pixmap;
|
||||
|
||||
if (!filename || !filename[0])
|
||||
return gtk_image_new ();
|
||||
|
||||
pathname = find_pixmap_file (filename);
|
||||
|
||||
if (!pathname)
|
||||
{
|
||||
g_warning (_("Couldn't find pixmap file: %s"), filename);
|
||||
return gtk_image_new ();
|
||||
}
|
||||
|
||||
pixmap = gtk_image_new_from_file (pathname);
|
||||
g_free (pathname);
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
/* This is an internally used function to create pixmaps. */
|
||||
GdkPixbuf*
|
||||
create_pixbuf (const gchar *filename)
|
||||
{
|
||||
gchar *pathname = NULL;
|
||||
GdkPixbuf *pixbuf;
|
||||
GError *error = NULL;
|
||||
|
||||
if (!filename || !filename[0])
|
||||
return NULL;
|
||||
|
||||
pathname = find_pixmap_file (filename);
|
||||
|
||||
if (!pathname)
|
||||
{
|
||||
g_warning (_("Couldn't find pixmap file: %s"), filename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_file (pathname, &error);
|
||||
if (!pixbuf)
|
||||
{
|
||||
fprintf (stderr, "Failed to load pixbuf file: %s: %s\n",
|
||||
pathname, error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
g_free (pathname);
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
/* This is used to set ATK action descriptions. */
|
||||
void
|
||||
glade_set_atk_action_description (AtkAction *action,
|
||||
const gchar *action_name,
|
||||
const gchar *description)
|
||||
{
|
||||
gint n_actions, i;
|
||||
|
||||
n_actions = atk_action_get_n_actions (action);
|
||||
for (i = 0; i < n_actions; i++)
|
||||
{
|
||||
if (!strcmp (atk_action_get_name (action, i), action_name))
|
||||
atk_action_set_description (action, i, description);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
/*
|
||||
* DO NOT EDIT THIS FILE - it is generated by Glade.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
/*
|
||||
* Standard gettext macros.
|
||||
*/
|
||||
#ifdef ENABLE_NLS
|
||||
#include <libintl.h>
|
||||
#undef _
|
||||
#define _(String) dgettext(PACKAGE, String)
|
||||
#define Q_(String) g_strip_context((String), gettext(String))
|
||||
#ifdef gettext_noop
|
||||
#define N_(String) gettext_noop(String)
|
||||
#else
|
||||
#define N_(String) (String)
|
||||
#endif
|
||||
#else
|
||||
#define textdomain(String) (String)
|
||||
#define gettext(String) (String)
|
||||
#define dgettext(Domain, Message) (Message)
|
||||
#define dcgettext(Domain, Message, Type) (Message)
|
||||
#define bindtextdomain(Domain, Directory) (Domain)
|
||||
#define _(String) (String)
|
||||
#define Q_(String) g_strip_context((String), (String))
|
||||
#define N_(String) (String)
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Public Functions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This function returns a widget in a component created by Glade.
|
||||
* Call it with the toplevel widget in the component (i.e. a window/dialog),
|
||||
* or alternatively any widget in the component, and the name of the widget
|
||||
* you want returned.
|
||||
*/
|
||||
GtkWidget *lookup_widget(GtkWidget *widget,
|
||||
const gchar *widget_name);
|
||||
|
||||
|
||||
/* Use this function to set the directory containing installed pixmaps. */
|
||||
void add_pixmap_directory(const gchar *directory);
|
||||
|
||||
|
||||
/*
|
||||
* Private Functions.
|
||||
*/
|
||||
|
||||
/* This is used to create the pixmaps used in the interface. */
|
||||
GtkWidget *create_pixmap(GtkWidget *widget,
|
||||
const gchar *filename);
|
||||
|
||||
/* This is used to create the pixbufs used in the interface. */
|
||||
GdkPixbuf *create_pixbuf(const gchar *filename);
|
||||
|
||||
/* This is used to set ATK action descriptions. */
|
||||
void glade_set_atk_action_description(AtkAction *action,
|
||||
const gchar *action_name,
|
||||
const gchar *description);
|
|
@ -1,26 +0,0 @@
|
|||
; CDVDiso.def : Declares the module parameters for the DLL.
|
||||
|
||||
EXPORTS
|
||||
; Explicit exports can go here
|
||||
PS2EgetLibType @2
|
||||
PS2EgetLibName @3
|
||||
PS2EgetLibVersion2 @4
|
||||
CDVDinit @5
|
||||
CDVDshutdown @6
|
||||
CDVDopen @7
|
||||
CDVDclose @8
|
||||
CDVDreadTrack @9
|
||||
CDVDgetBuffer @10
|
||||
CDVDreadSubQ @11
|
||||
CDVDgetTN @12
|
||||
CDVDgetTD @13
|
||||
CDVDgetTOC @14
|
||||
CDVDgetDiskType @15
|
||||
CDVDgetTrayStatus @16
|
||||
CDVDctrlTrayOpen @17
|
||||
CDVDctrlTrayClose @18
|
||||
|
||||
CDVDconfigure @19
|
||||
CDVDtest @20
|
||||
CDVDabout @21
|
||||
|
|
@ -1,127 +0,0 @@
|
|||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "afxresmw.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Spanish (Argentina) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ESS)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_SPANISH, SUBLANG_SPANISH_ARGENTINA
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#include ""afxresmw.h""\r\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"\r\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_CONFIG DIALOGEX 0, 0, 212, 161
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "CDVDconfigure"
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x0
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,105,140,50,14
|
||||
EDITTEXT IDC_ISOFILE,10,10,145,14,ES_AUTOHSCROLL
|
||||
PUSHBUTTON "Cancel",IDCANCEL,160,140,50,14
|
||||
PUSHBUTTON "Select Iso",IDC_SELECTISO,160,10,45,14
|
||||
PUSHBUTTON "Compress Iso",IDC_COMPRESSISO,33,75,65,14
|
||||
PUSHBUTTON "Decompress Iso",IDC_DECOMPRESSISO,113,75,65,14
|
||||
COMBOBOX IDC_METHOD,120,55,85,50,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",PBS_SMOOTH | WS_BORDER,10,35,145,14
|
||||
LTEXT "Compression Method:",IDC_STATIC,29,57,69,8
|
||||
PUSHBUTTON "Stop",IDC_STOP,160,35,45,14
|
||||
GROUPBOX "",IDC_STATIC,5,0,205,95
|
||||
GROUPBOX "Options",IDC_STATIC,5,100,205,30
|
||||
CONTROL "Enable Block Dump => ""ISO name.dump""",IDC_BLOCKDUMP,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,115,148,10
|
||||
END
|
||||
|
||||
IDD_ABOUT DIALOG 0, 0, 177, 106
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "CDVDabout"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,65,85,50,14
|
||||
LTEXT "CDVDiso Driver",IDC_NAME,70,10,50,8
|
||||
GROUPBOX "",IDC_STATIC,5,35,170,40
|
||||
LTEXT "Thanks to:\n mooby - coding hints and .bz support\n Brenden Conte - linux conf bugfix",IDC_STATIC,10,45,160,25
|
||||
LTEXT "Author: linuzappz <linuzappz@hotmail.com>",IDC_STATIC,20,20,141,10
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO
|
||||
BEGIN
|
||||
IDD_CONFIG, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 205
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 154
|
||||
END
|
||||
|
||||
IDD_ABOUT, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 170
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 99
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#endif // Spanish (Argentina) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
|
@ -1,163 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Devel|Win32">
|
||||
<Configuration>Devel</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectName>CDVDiso</ProjectName>
|
||||
<ProjectGuid>{5F78E90B-BD22-47B1-9CA5-7A80F4DF5EF3}</ProjectGuid>
|
||||
<RootNamespace>CDVDiso</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Devel|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Devel|Win32'" Label="PropertySheets">
|
||||
<Import Project="..\..\..\..\common\vsprops\plugin_svnroot.props" />
|
||||
<Import Project="..\..\..\..\common\vsprops\BaseProperties.props" />
|
||||
<Import Project="..\..\..\..\common\vsprops\3rdpartyDeps.props" />
|
||||
<Import Project="..\..\..\..\common\vsprops\CodeGen_Devel.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="..\..\..\..\common\vsprops\plugin_svnroot.props" />
|
||||
<Import Project="..\..\..\..\common\vsprops\BaseProperties.props" />
|
||||
<Import Project="..\..\..\..\common\vsprops\3rdpartyDeps.props" />
|
||||
<Import Project="..\..\..\..\common\vsprops\CodeGen_Release.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="..\..\..\..\common\vsprops\plugin_svnroot.props" />
|
||||
<Import Project="..\..\..\..\common\vsprops\BaseProperties.props" />
|
||||
<Import Project="..\..\..\..\common\vsprops\3rdpartyDeps.props" />
|
||||
<Import Project="..\..\..\..\common\vsprops\CodeGen_Debug.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Devel|Win32'">true</LinkIncremental>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Devel|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Devel|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Devel|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Devel|Win32'">$(ProjectName)-dev</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<AdditionalIncludeDirectories>$(SvnRootDir)\3rdparty\bzip2;$(SvnRootDir)\3rdparty\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<ModuleDefinitionFile>.\CDVDiso.def</ModuleDefinitionFile>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<AdditionalIncludeDirectories>$(SvnRootDir)\3rdparty\bzip2;$(SvnRootDir)\3rdparty\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<ModuleDefinitionFile>.\CDVDiso.def</ModuleDefinitionFile>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Devel|Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<AdditionalIncludeDirectories>$(SvnRootDir)\3rdparty\bzip2;$(SvnRootDir)\3rdparty\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<ModuleDefinitionFile>.\CDVDiso.def</ModuleDefinitionFile>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\CDVDisop.cpp">
|
||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Devel|Win32'">CompileAsCpp</CompileAs>
|
||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Config.cpp">
|
||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Devel|Win32'">CompileAsCpp</CompileAs>
|
||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\libiso.cpp">
|
||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Devel|Win32'">CompileAsCpp</CompileAs>
|
||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Win32.cpp">
|
||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Devel|Win32'">CompileAsCpp</CompileAs>
|
||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsCpp</CompileAs>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\CDVDiso.h" />
|
||||
<ClInclude Include="Config.h" />
|
||||
<ClInclude Include="..\libiso.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="CDVDiso.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\..\3rdparty\bzip2\bzip2.vcxproj">
|
||||
<Project>{f4eb4ab2-c595-4b05-8bc0-059024bc796c}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\3rdparty\zlib\zlib.vcxproj">
|
||||
<Project>{2f6c0388-20cb-4242-9f6c-a6ebb6a83f47}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -1,50 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\CDVDisop.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Config.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\libiso.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Win32.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\CDVDiso.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Config.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\libiso.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="resource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="CDVDiso.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -1,51 +0,0 @@
|
|||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include "../CDVDiso.h"
|
||||
|
||||
#define GetKeyV(name, var, s, t) \
|
||||
size = s; \
|
||||
type = t; \
|
||||
RegQueryValueEx(myKey, name, 0, &type, (LPBYTE)var, &size);
|
||||
|
||||
#define GetKeyVdw(name, var) \
|
||||
GetKeyV(name, var, 4, REG_DWORD);
|
||||
|
||||
#define SetKeyV(name, var, s, t) \
|
||||
RegSetValueEx(myKey, name, 0, t, (LPBYTE)var, s);
|
||||
|
||||
#define SetKeyVdw(name, var) \
|
||||
SetKeyV(name, var, 4, REG_DWORD);
|
||||
|
||||
void SaveConf()
|
||||
{
|
||||
HKEY myKey;
|
||||
DWORD myDisp;
|
||||
|
||||
RegCreateKeyEx(HKEY_CURRENT_USER, "Software\\PS2Eplugin\\CDVD\\CDVDiso", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &myKey, &myDisp);
|
||||
|
||||
SetKeyV("IsoFile", IsoFile, sizeof(IsoFile), REG_BINARY);
|
||||
SetKeyV("CurrentWorkingFolder", IsoCWD, sizeof(IsoCWD), REG_BINARY);
|
||||
SetKeyVdw("BlockDump", &BlockDump);
|
||||
|
||||
RegCloseKey(myKey);
|
||||
}
|
||||
|
||||
void LoadConf()
|
||||
{
|
||||
HKEY myKey;
|
||||
DWORD type, size;
|
||||
|
||||
memset(IsoFile, 0, sizeof(IsoFile));
|
||||
|
||||
if (RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\PS2Eplugin\\CDVD\\CDVDiso", 0, KEY_ALL_ACCESS, &myKey) != ERROR_SUCCESS) {
|
||||
SaveConf();
|
||||
return;
|
||||
}
|
||||
|
||||
GetKeyV("IsoFile", IsoFile, sizeof(IsoFile), REG_BINARY);
|
||||
GetKeyV("CurrentWorkingFolder", IsoCWD, sizeof(IsoCWD), REG_BINARY);
|
||||
GetKeyVdw("BlockDump", &BlockDump);
|
||||
|
||||
RegCloseKey(myKey);
|
||||
}
|
|
@ -1,2 +0,0 @@
|
|||
void SaveConf();
|
||||
void LoadConf();
|
|
@ -1,57 +0,0 @@
|
|||
#
|
||||
# Makefile for MINGW32
|
||||
#
|
||||
|
||||
|
||||
all: cdvdiso
|
||||
|
||||
PLUGIN = CDVDiso.dll
|
||||
|
||||
CC = gcc
|
||||
NASM = nasmw
|
||||
RM = rm -f
|
||||
AR = ar
|
||||
STRIP = strip
|
||||
RC = windres
|
||||
|
||||
OPTIMIZE = -O2 -fomit-frame-pointer -finline-functions -ffast-math -fno-strict-aliasing
|
||||
FLAGS = -D__WIN32__ -D__MINGW32__ # -DENABLE_NLS -DPACKAGE=\"pcsx2\"
|
||||
RC1FLAGS = -d__MINGW32__
|
||||
LIBS = -L./ -lcomctl32 -lwsock32 -lwinmm -lgdi32 -lcomdlg32 #-lintl
|
||||
RESOBJ = cdvdiso.o
|
||||
|
||||
OBJS = ../CDVDiso.o ../libiso.o
|
||||
OBJS+= Config.o Win32.o ${RESOBJ}
|
||||
OBJS+= ../zlib/adler32.o ../zlib/compress.o ../zlib/crc32.o ../zlib/gzio.o ../zlib/uncompr.o ../zlib/deflate.o ../zlib/trees.o \
|
||||
../zlib/zutil.o ../zlib/inflate.o ../zlib/infback.o ../zlib/inftrees.o ../zlib/inffast.o
|
||||
OBJS+= ../bzip2/blocksort.o ../bzip2/bzlib.o \
|
||||
../bzip2/compress.o ../bzip2/crctable.o \
|
||||
../bzip2/decompress.o ../bzip2/huffman.o \
|
||||
../bzip2/randtable.o
|
||||
|
||||
DEPS:= $(OBJS:.o=.d)
|
||||
|
||||
CFLAGS = -Wall ${OPTIMIZE} -I. -I.. -I/usr/local/include -I../zlib -I../bzip2 ${FLAGS}
|
||||
|
||||
cdvdiso: ${OBJS}
|
||||
dllwrap --def plugin.def -o ${PLUGIN} ${OBJS} ${LIBS}
|
||||
# ${CC} -shared -Wl,--kill-at,--output-def,plugin.def ${CFLAGS} ${OBJS} -o ${PLUGIN} ${LIBS}
|
||||
${STRIP} ${PLUGIN}
|
||||
|
||||
.PHONY: clean cdvdiso
|
||||
|
||||
clean:
|
||||
${RM} ${OBJS} ${DEPS} ${PCSX2}
|
||||
|
||||
%.o: %.asm
|
||||
${NASM} ${ASMFLAGS} -o $@ $<
|
||||
|
||||
%.o: %.c
|
||||
${CC} ${CFLAGS} -c -o $@ $< -MD -MF $(patsubst %.o,%.d,$@)
|
||||
|
||||
${RESOBJ}: CDVDiso.rc
|
||||
${RC} -D__MINGW32__ -I rc -O coff -o $@ -i $<
|
||||
|
||||
-include ${DEPS}
|
||||
|
||||
|
|
@ -1,374 +0,0 @@
|
|||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
#include <commctrl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <direct.h>
|
||||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <zlib/zlib.h>
|
||||
|
||||
|
||||
#include "Config.h"
|
||||
#include "../CDVDiso.h"
|
||||
#include "resource.h"
|
||||
|
||||
HINSTANCE hInst;
|
||||
#define MAXFILENAME 256
|
||||
|
||||
u8 Zbuf[2352 * 10 * 2];
|
||||
HWND hDlg;
|
||||
HWND hProgress;
|
||||
HWND hIsoFile;
|
||||
HWND hMethod;
|
||||
HWND hBlockDump;
|
||||
int stop;
|
||||
|
||||
void SysMessage(char *fmt, ...)
|
||||
{
|
||||
va_list list;
|
||||
char tmp[512];
|
||||
|
||||
va_start(list, fmt);
|
||||
vsprintf(tmp, fmt, list);
|
||||
va_end(list);
|
||||
MessageBox(GetActiveWindow(), tmp, "CDVDiso Msg", 0);
|
||||
}
|
||||
|
||||
int _GetFile(char *out)
|
||||
{
|
||||
OPENFILENAME ofn;
|
||||
char szFileName[MAXFILENAME];
|
||||
char szFileTitle[MAXFILENAME];
|
||||
|
||||
memset(&szFileName, 0, sizeof(szFileName));
|
||||
memset(&szFileTitle, 0, sizeof(szFileTitle));
|
||||
|
||||
ofn.lStructSize = sizeof(OPENFILENAME);
|
||||
ofn.hwndOwner = GetActiveWindow();
|
||||
ofn.lpstrFilter =
|
||||
"Supported Formats\0*.bin;*.iso;*.img;*.nrg;*.mdf;*.Z;*.Z2;*.BZ2;*.dump\0"
|
||||
"Cd Iso Format (*.bin;*.iso;*.img;*.nrg;*.mdf)\0"
|
||||
"*.bin;*.iso;*.img;*.nrg;*.mdf\0"
|
||||
"Compressed Z Iso Format (*.Z;*.Z2)\0"
|
||||
"*.Z;*.Z2\0Compressed BZ Iso Format (*.BZ2)\0"
|
||||
"*.BZ2\0Block Dumps (*.dump)\0*.dump\0All Files\0*.*\0";
|
||||
|
||||
ofn.lpstrCustomFilter = NULL;
|
||||
ofn.nMaxCustFilter = 0;
|
||||
ofn.nFilterIndex = 1;
|
||||
ofn.lpstrFile = szFileName;
|
||||
ofn.nMaxFile = MAXFILENAME;
|
||||
ofn.lpstrInitialDir = (IsoCWD[0] == 0) ? NULL : IsoCWD;
|
||||
ofn.lpstrFileTitle = szFileTitle;
|
||||
ofn.nMaxFileTitle = MAXFILENAME;
|
||||
ofn.lpstrTitle = NULL;
|
||||
ofn.lpstrDefExt = NULL;
|
||||
ofn.Flags = OFN_HIDEREADONLY;
|
||||
|
||||
if (GetOpenFileName((LPOPENFILENAME)&ofn)) {
|
||||
strcpy(out, szFileName);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int _OpenFile(int saveConf)
|
||||
{
|
||||
|
||||
int retval = 0;
|
||||
|
||||
// for saving the pcsx2 current working directory;
|
||||
char *cwd_pcsx2 = _getcwd(NULL, MAXFILENAME);
|
||||
|
||||
if (IsoCWD[0] != 0)
|
||||
_chdir(IsoCWD);
|
||||
|
||||
if (_GetFile(IsoFile) == 1) {
|
||||
// Save the user's new cwd:
|
||||
if (_getcwd(IsoCWD, MAXFILENAME) == NULL)
|
||||
IsoCWD[0] = 0;
|
||||
|
||||
if (saveConf)
|
||||
SaveConf();
|
||||
|
||||
retval = 1;
|
||||
}
|
||||
|
||||
// Restore Pcsx2's path.
|
||||
if (cwd_pcsx2 != NULL) {
|
||||
_chdir(cwd_pcsx2);
|
||||
free(cwd_pcsx2);
|
||||
cwd_pcsx2 = NULL;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
void CfgOpenFile()
|
||||
{
|
||||
_OpenFile(TRUE);
|
||||
}
|
||||
|
||||
void UpdZmode()
|
||||
{
|
||||
if (ComboBox_GetCurSel(hMethod) == 0) {
|
||||
Zmode = 1;
|
||||
} else {
|
||||
Zmode = 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SysUpdate()
|
||||
{
|
||||
MSG msg;
|
||||
|
||||
while (PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE)) {
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
|
||||
void OnCompress()
|
||||
{
|
||||
u32 lsn;
|
||||
u8 cdbuff[10 * 2352];
|
||||
char Zfile[256];
|
||||
int ret;
|
||||
isoFile *src;
|
||||
isoFile *dst;
|
||||
|
||||
Edit_GetText(hIsoFile, IsoFile, 256);
|
||||
UpdZmode();
|
||||
|
||||
if (Zmode == 1) {
|
||||
sprintf(Zfile, "%s.Z2", IsoFile);
|
||||
} else {
|
||||
sprintf(Zfile, "%s.BZ2", IsoFile);
|
||||
}
|
||||
|
||||
src = isoOpen(IsoFile);
|
||||
if (src == NULL)
|
||||
return;
|
||||
if (Zmode == 1) {
|
||||
dst = isoCreate(Zfile, ISOFLAGS_Z2);
|
||||
} else {
|
||||
dst = isoCreate(Zfile, ISOFLAGS_BZ2);
|
||||
}
|
||||
if (dst == NULL)
|
||||
return;
|
||||
|
||||
isoSetFormat(dst, src->blockofs, src->blocksize, src->blocks);
|
||||
Button_Enable(GetDlgItem(hDlg, IDC_COMPRESSISO), FALSE);
|
||||
Button_Enable(GetDlgItem(hDlg, IDC_DECOMPRESSISO), FALSE);
|
||||
stop = 0;
|
||||
|
||||
for (lsn = 0; lsn < src->blocks; lsn++) {
|
||||
//printf("block %d ", lsn);
|
||||
//putchar(13);
|
||||
//fflush(stdout);
|
||||
ret = isoReadBlock(src, cdbuff, lsn);
|
||||
if (ret == -1)
|
||||
break;
|
||||
ret = isoWriteBlock(dst, cdbuff, lsn);
|
||||
if (ret == -1)
|
||||
break;
|
||||
|
||||
SendMessage(hProgress, PBM_SETPOS, (lsn * 100) / src->blocks, 0);
|
||||
SysUpdate();
|
||||
if (stop)
|
||||
break;
|
||||
}
|
||||
isoClose(src);
|
||||
isoClose(dst);
|
||||
|
||||
if (!stop)
|
||||
Edit_SetText(hIsoFile, Zfile);
|
||||
|
||||
Button_Enable(GetDlgItem(hDlg, IDC_COMPRESSISO), TRUE);
|
||||
Button_Enable(GetDlgItem(hDlg, IDC_DECOMPRESSISO), TRUE);
|
||||
|
||||
if (!stop) {
|
||||
if (ret == -1) {
|
||||
SysMessage("Error compressing iso image");
|
||||
} else {
|
||||
SysMessage("Iso image compressed OK");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OnDecompress()
|
||||
{
|
||||
char file[256];
|
||||
u8 cdbuff[10 * 2352];
|
||||
u32 lsn;
|
||||
isoFile *src;
|
||||
isoFile *dst;
|
||||
int ret;
|
||||
|
||||
Edit_GetText(hIsoFile, IsoFile, 256);
|
||||
|
||||
src = isoOpen(IsoFile);
|
||||
if (src == NULL)
|
||||
return;
|
||||
|
||||
strcpy(file, IsoFile);
|
||||
if (src->flags & ISOFLAGS_Z) {
|
||||
file[strlen(file) - 2] = 0;
|
||||
} else if (src->flags & ISOFLAGS_Z2) {
|
||||
file[strlen(file) - 3] = 0;
|
||||
} else if (src->flags & ISOFLAGS_BZ2) {
|
||||
file[strlen(file) - 3] = 0;
|
||||
} else {
|
||||
SysMessage("%s is not a compressed image", IsoFile);
|
||||
return;
|
||||
}
|
||||
|
||||
dst = isoCreate(file, 0);
|
||||
if (dst == NULL)
|
||||
return;
|
||||
|
||||
isoSetFormat(dst, src->blockofs, src->blocksize, src->blocks);
|
||||
Button_Enable(GetDlgItem(hDlg, IDC_COMPRESSISO), FALSE);
|
||||
Button_Enable(GetDlgItem(hDlg, IDC_DECOMPRESSISO), FALSE);
|
||||
stop = 0;
|
||||
|
||||
for (lsn = 0; lsn < src->blocks; lsn++) {
|
||||
printf("block %d ", lsn);
|
||||
putchar(13);
|
||||
fflush(stdout);
|
||||
ret = isoReadBlock(src, cdbuff, lsn);
|
||||
if (ret == -1)
|
||||
break;
|
||||
ret = isoWriteBlock(dst, cdbuff, lsn);
|
||||
if (ret == -1)
|
||||
break;
|
||||
|
||||
SendMessage(hProgress, PBM_SETPOS, (lsn * 100) / src->blocks, 0);
|
||||
SysUpdate();
|
||||
if (stop)
|
||||
break;
|
||||
}
|
||||
if (!stop)
|
||||
Edit_SetText(hIsoFile, file);
|
||||
|
||||
isoClose(src);
|
||||
isoClose(dst);
|
||||
|
||||
Button_Enable(GetDlgItem(hDlg, IDC_COMPRESSISO), TRUE);
|
||||
Button_Enable(GetDlgItem(hDlg, IDC_DECOMPRESSISO), TRUE);
|
||||
|
||||
if (!stop) {
|
||||
if (ret == -1) {
|
||||
SysMessage("Error decompressing iso image");
|
||||
} else {
|
||||
SysMessage("Iso image decompressed OK");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
int i;
|
||||
|
||||
switch (uMsg) {
|
||||
case WM_INITDIALOG:
|
||||
hDlg = hW;
|
||||
LoadConf();
|
||||
|
||||
hProgress = GetDlgItem(hW, IDC_PROGRESS);
|
||||
hIsoFile = GetDlgItem(hW, IDC_ISOFILE);
|
||||
hMethod = GetDlgItem(hW, IDC_METHOD);
|
||||
hBlockDump = GetDlgItem(hW, IDC_BLOCKDUMP);
|
||||
|
||||
for (i = 0; methods[i] != NULL; i++) {
|
||||
ComboBox_AddString(hMethod, methods[i]);
|
||||
}
|
||||
|
||||
Edit_SetText(hIsoFile, IsoFile);
|
||||
ComboBox_SetCurSel(hMethod, 0);
|
||||
/* if (strstr(IsoFile, ".Z") != NULL)
|
||||
ComboBox_SetCurSel(hMethod, 1);
|
||||
else ComboBox_SetCurSel(hMethod, 0);*/
|
||||
Button_SetCheck(hBlockDump, BlockDump);
|
||||
|
||||
return TRUE;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam)) {
|
||||
case IDC_SELECTISO:
|
||||
if (_OpenFile(FALSE) == 1)
|
||||
Edit_SetText(hIsoFile, IsoFile);
|
||||
return TRUE;
|
||||
|
||||
case IDC_COMPRESSISO:
|
||||
OnCompress();
|
||||
return TRUE;
|
||||
|
||||
case IDC_DECOMPRESSISO:
|
||||
OnDecompress();
|
||||
return TRUE;
|
||||
|
||||
case IDC_STOP:
|
||||
stop = 1;
|
||||
return TRUE;
|
||||
|
||||
case IDCANCEL:
|
||||
EndDialog(hW, TRUE);
|
||||
return TRUE;
|
||||
|
||||
case IDOK:
|
||||
Edit_GetText(hIsoFile, IsoFile, 256);
|
||||
BlockDump = Button_GetCheck(hBlockDump);
|
||||
|
||||
SaveConf();
|
||||
EndDialog(hW, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
EXPORT_C_(void)
|
||||
CDVDconfigure()
|
||||
{
|
||||
DialogBox(hInst,
|
||||
MAKEINTRESOURCE(IDD_CONFIG),
|
||||
GetActiveWindow(),
|
||||
(DLGPROC)ConfigureDlgProc);
|
||||
}
|
||||
|
||||
BOOL CALLBACK AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (uMsg) {
|
||||
case WM_INITDIALOG:
|
||||
return TRUE;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam)) {
|
||||
case IDOK:
|
||||
EndDialog(hW, TRUE);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
EXPORT_C_(void)
|
||||
CDVDabout()
|
||||
{
|
||||
DialogBox(hInst,
|
||||
MAKEINTRESOURCE(IDD_ABOUT),
|
||||
GetActiveWindow(),
|
||||
(DLGPROC)AboutDlgProc);
|
||||
}
|
||||
|
||||
BOOL APIENTRY DllMain(HANDLE hModule, // DLL INIT
|
||||
DWORD dwReason,
|
||||
LPVOID lpReserved)
|
||||
{
|
||||
hInst = (HINSTANCE)hModule;
|
||||
return TRUE; // very quick :)
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by CDVDiso.rc
|
||||
//
|
||||
#define IDD_CONFDLG 101
|
||||
#define IDD_CONFIG 101
|
||||
#define IDD_ABOUT 103
|
||||
#define IDC_NAME 1000
|
||||
#define IDC_ISOFILE 1000
|
||||
#define IDC_SELECTISO 1001
|
||||
#define IDC_COMPRESSISO 1002
|
||||
#define IDC_DECOMPRESSISO 1003
|
||||
#define IDC_METHOD 1004
|
||||
#define IDC_PROGRESS 1005
|
||||
#define IDC_STOP 1006
|
||||
#define IDC_BLOCKDUMP 1007
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 105
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1008
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -1,67 +0,0 @@
|
|||
#ifndef __LIBISO_H__
|
||||
#define __LIBISO_H__
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable : 4018)
|
||||
#endif
|
||||
|
||||
#define ISOTYPE_ILLEGAL 0
|
||||
#define ISOTYPE_CD 1
|
||||
#define ISOTYPE_DVD 2
|
||||
#define ISOTYPE_AUDIO 3
|
||||
|
||||
#define ISOFLAGS_Z 0x0001
|
||||
#define ISOFLAGS_Z2 0x0002
|
||||
#define ISOFLAGS_BLOCKDUMP 0x0004
|
||||
#define ISOFLAGS_MULTI 0x0008
|
||||
#define ISOFLAGS_BZ2 0x0010
|
||||
|
||||
#define CD_FRAMESIZE_RAW 2352
|
||||
#define DATA_SIZE (CD_FRAMESIZE_RAW - 12)
|
||||
|
||||
#define itob(i) ((i) / 10 * 16 + (i) % 10) /* u_char to BCD */
|
||||
#define btoi(b) ((b) / 16 * 10 + (b) % 16) /* BCD to u_char */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u32 slsn;
|
||||
u32 elsn;
|
||||
void *handle;
|
||||
} _multih;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char filename[256];
|
||||
u32 type;
|
||||
u32 flags;
|
||||
u32 offset;
|
||||
u32 blockofs;
|
||||
u32 blocksize;
|
||||
u32 blocks;
|
||||
void *handle;
|
||||
void *htable;
|
||||
char *Ztable;
|
||||
u32 *dtable;
|
||||
int dtablesize;
|
||||
_multih multih[8];
|
||||
int buflsn;
|
||||
u8 *buffer;
|
||||
} isoFile;
|
||||
|
||||
|
||||
isoFile *isoOpen(const char *filename);
|
||||
isoFile *isoCreate(const char *filename, int mode);
|
||||
int isoSetFormat(isoFile *iso, int blockofs, int blocksize, int blocks);
|
||||
int isoDetect(isoFile *iso);
|
||||
int isoReadBlock(isoFile *iso, u8 *dst, int lsn);
|
||||
int isoWriteBlock(isoFile *iso, u8 *src, int lsn);
|
||||
void isoClose(isoFile *iso);
|
||||
|
||||
void *_openfile(const char *filename, int flags);
|
||||
u64 _tellfile(void *handle);
|
||||
int _seekfile(void *handle, u64 offset, int whence);
|
||||
int _readfile(void *handle, void *dst, int size);
|
||||
int _writefile(void *handle, const void *src, int size);
|
||||
void _closefile(void *handle);
|
||||
|
||||
#endif /* __LIBISO_H__ */
|
|
@ -1,167 +0,0 @@
|
|||
/* CDVDiso
|
||||
* Copyright (C) 2002-2004 CDVDiso 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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "string.h"
|
||||
|
||||
#include "CDVDiso.h"
|
||||
|
||||
|
||||
void Compress(char *filename, int mode)
|
||||
{
|
||||
struct stat buf;
|
||||
u32 lsn;
|
||||
u8 cdbuff[1024 * 16];
|
||||
char Zfile[256];
|
||||
int ret = 0;
|
||||
isoFile *src;
|
||||
isoFile *dst;
|
||||
|
||||
if (mode == 1) {
|
||||
sprintf(Zfile, "%s.Z2", filename);
|
||||
} else {
|
||||
sprintf(Zfile, "%s.BZ2", filename);
|
||||
}
|
||||
|
||||
if (stat(Zfile, &buf) != -1) {
|
||||
printf("'%s' already exists\n", Zfile);
|
||||
return;
|
||||
/* sprintf(str, "'%s' already exists, overwrite?", Zfile);
|
||||
if (MessageBox(hDlg, str, "Question", MB_YESNO) != IDYES) {
|
||||
return;
|
||||
}*/
|
||||
}
|
||||
|
||||
printf("src %s; dst %s\n", filename, Zfile);
|
||||
src = isoOpen(filename);
|
||||
if (src == NULL)
|
||||
return;
|
||||
|
||||
if (mode == 1) {
|
||||
dst = isoCreate(Zfile, ISOFLAGS_Z2);
|
||||
} else {
|
||||
dst = isoCreate(Zfile, ISOFLAGS_BZ2);
|
||||
}
|
||||
isoSetFormat(dst, src->blockofs, src->blocksize, src->blocks);
|
||||
if (dst == NULL)
|
||||
return;
|
||||
|
||||
for (lsn = 0; lsn < src->blocks; lsn++) {
|
||||
printf("block %d ", lsn);
|
||||
putchar(13);
|
||||
fflush(stdout);
|
||||
ret = isoReadBlock(src, cdbuff, lsn);
|
||||
if (ret == -1)
|
||||
break;
|
||||
ret = isoWriteBlock(dst, cdbuff, lsn);
|
||||
if (ret == -1)
|
||||
break;
|
||||
}
|
||||
isoClose(src);
|
||||
isoClose(dst);
|
||||
|
||||
if (ret == -1) {
|
||||
printf("Error compressing iso image\n");
|
||||
} else {
|
||||
printf("Iso image compressed OK\n");
|
||||
}
|
||||
}
|
||||
|
||||
void Decompress(char *filename)
|
||||
{
|
||||
struct stat buf;
|
||||
char file[256];
|
||||
u8 cdbuff[10 * 2352];
|
||||
u32 lsn;
|
||||
isoFile *src;
|
||||
isoFile *dst;
|
||||
int ret = 0;
|
||||
|
||||
src = isoOpen(filename);
|
||||
if (src == NULL)
|
||||
return;
|
||||
|
||||
strcpy(file, filename);
|
||||
if (src->flags & ISOFLAGS_Z)
|
||||
file[strlen(file) - 2] = 0;
|
||||
else if (src->flags & ISOFLAGS_Z2)
|
||||
file[strlen(file) - 3] = 0;
|
||||
else if (src->flags & ISOFLAGS_BZ2)
|
||||
file[strlen(file) - 3] = 0;
|
||||
else {
|
||||
printf("%s is not a compressed image\n", filename);
|
||||
return;
|
||||
}
|
||||
|
||||
if (stat(file, &buf) != -1) {
|
||||
char str[256];
|
||||
sprintf(str, "'%s' already exists", file);
|
||||
isoClose(src);
|
||||
return;
|
||||
}
|
||||
|
||||
dst = isoCreate(file, 0);
|
||||
if (dst == NULL)
|
||||
return;
|
||||
isoSetFormat(dst, src->blockofs, src->blocksize, src->blocks);
|
||||
|
||||
for (lsn = 0; lsn < src->blocks; lsn++) {
|
||||
printf("block %d ", lsn);
|
||||
putchar(13);
|
||||
fflush(stdout);
|
||||
ret = isoReadBlock(src, cdbuff, lsn);
|
||||
if (ret == -1)
|
||||
break;
|
||||
ret = isoWriteBlock(dst, cdbuff, lsn);
|
||||
if (ret == -1)
|
||||
break;
|
||||
}
|
||||
|
||||
isoClose(src);
|
||||
isoClose(dst);
|
||||
|
||||
if (ret == -1)
|
||||
printf("Error decompressing iso image\n");
|
||||
else
|
||||
printf("Iso image decompressed OK\n");
|
||||
}
|
||||
|
||||
|
||||
/*int main(int argc, char *argv[])
|
||||
{
|
||||
if (argc < 3) return 0;
|
||||
|
||||
switch (argv[1][0])
|
||||
{
|
||||
case 'c':
|
||||
Compress(argv[2], 1);
|
||||
break;
|
||||
case 'C':
|
||||
Compress(argv[2], 2);
|
||||
break;
|
||||
case 'd':
|
||||
Decompress(argv[2]);
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}*/
|
|
@ -1,206 +0,0 @@
|
|||
# Microsoft Developer Studio Project File - Name="mkiso" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=mkiso - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "mkiso.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "mkiso.mak" CFG="mkiso - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "mkiso - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "mkiso - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "mkiso - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "../" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "__WIN32__" /D "__MSCW32__" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x2c0a /d "NDEBUG"
|
||||
# ADD RSC /l 0x2c0a /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
|
||||
!ELSEIF "$(CFG)" == "mkiso - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "./" /I "../" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "__WIN32__" /FD /GZ /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE RSC /l 0x2c0a /d "_DEBUG"
|
||||
# ADD RSC /l 0x2c0a /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib zlib.lib libbz2.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"msvcrt.lib" /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "mkiso - Win32 Release"
|
||||
# Name "mkiso - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\libiso.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\mkiso.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# Begin Group "zlib"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\adler32.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\compress.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\crc32.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\crc32.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\deflate.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\deflate.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\gvmat32c.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\gzio.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\infback.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\inffas8664.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\inffast.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\inffast.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\inffixed.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\inflate.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\inflate.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\inftrees.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\inftrees.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\trees.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\trees.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\uncompr.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\zconf.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\zlib.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\zutil.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\zlib\zutil.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
|
@ -1,29 +0,0 @@
|
|||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "mkiso"=.\mkiso.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
CDVDisoEFP v0.6 Changes:
|
||||
--------------------
|
||||
|
||||
v0.6:
|
||||
* Completely re-wrote screens (efp)
|
||||
* Used device access sources from CDVDlinuz to get data from DVDs. (efp)
|
||||
* Added ability to read devices from Windows XP (efp)
|
||||
Note: only ISO and CDDA seem to be readable from CDs at this time.
|
||||
If your trying to get another format, use Linux.
|
||||
DVD5 is readable. Don't have a DVD9 game to test. (I think - efp)
|
||||
* Separated image file access by OS. (Linux, Windows) (efp)
|
||||
* Separated Multi-file/Compression/Image-Typing to their own source files. (efp)
|
||||
* Added a few entries to the Image Typing database, based on Linux CD-ROM sources (efp)
|
||||
* Added Table Rebuild (for those who lost .table files.) (efp)
|
||||
* Put in a separate source program to compare two ISOs for data accuracy. (efp)
|
||||
* Renamed executables and config files (so not to conflict with CDVDiso) (efp)
|
||||
* Internalized the .INI File code (to allow use in other OS-es besides Windows) (efp)
|
||||
* Added temporarily a .toc file saving track info (for PS1 and Music CDs) (efp)
|
||||
* Added a new compression format. (BZip2 Size) (efp)
|
||||
* Added .glade files at linuzappz's request (efp)
|
||||
* Upgraded to 0.6.0 beta PS2Edef.h definitions (efp)
|
||||
|
||||
* Data buffer start position re-set for CDs. (shadow caught the problem while testing)
|
||||
* Supported images grouped in "Browse" button (shadow's suggestion)
|
||||
* Initial Image reminder added to Windows CDVDOpen() (shadow's suggestion)
|
||||
* used 64 bit fstat (fstat64) for correct sizes on >2GB files in Linux (efp)
|
||||
* Adjusted CD types to allow for PS2 CDs (shadow pointed out an example iso)
|
||||
* Added changing CDs/DVDs while emulation stopped (shadow's suggestion)
|
||||
Built in an "open tray" delay when switching media. (efp)
|
||||
* Added ".img" to Image Filter (although .cue/.sub files aren't tapped.) (efp)
|
||||
* Added ".nrg" to Image Filter (shadow's suggestion)
|
||||
* In Windows, when newly selected from the PCSX2 configure screen, CDVDinit()
|
||||
(as well as InitConf()) are not called. Fixed (EFP)
|
||||
|
||||
v0.5:
|
||||
* Added block dumping code
|
||||
* Added BZ2/Z2 format ;)
|
||||
* Added optimaze asm code of zlib with vsnet2003 only. Compression / Uncompression should be faster now (shadow)
|
||||
* Added Vsnet2005 beta1 project files + amd64 asm optimaze code for zlib (shadow)
|
||||
|
||||
v0.4:
|
||||
* Rewrote mostly ;)
|
||||
* .bz is still unsupported
|
||||
|
||||
v0.3:
|
||||
* Better Iso detection, thx florin :)
|
||||
* Updated to PS2Edefs v0.4.5
|
||||
|
||||
v0.2:
|
||||
* Added support for isos using 2048 blocksize
|
||||
* Nero images are supported
|
||||
* Better extension filtering
|
||||
|
||||
v0.1:
|
||||
* First Release
|
||||
* Tested with Pcsx2
|
||||
|
||||
Email: <linuzappz@hotmail.com>
|
|
@ -1,16 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
curdir=`pwd`
|
||||
|
||||
echo -------------------
|
||||
echo Building CDVDisoEFP
|
||||
echo -------------------
|
||||
|
||||
cd ${curdir}/src/Linux
|
||||
make $@
|
||||
|
||||
if [ -s cfgCDVDisoEFP ] && [ -s libCDVDisoEFP.so ]
|
||||
then
|
||||
# copy the files
|
||||
cp cfgCDVDisoEFP libCDVDisoEFP.so ${PCSX2PLUGINS}
|
||||
fi
|
|
@ -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,55 +0,0 @@
|
|||
CDVDiso v0.6
|
||||
------------
|
||||
|
||||
This is an extension to use with play station2 emulators
|
||||
as PCSX2 (only one right now).
|
||||
The plugin is free open source code.
|
||||
|
||||
Linux requirements:
|
||||
------------------
|
||||
You need the GTK library, compiled with GTK v2.6.1 (at least).
|
||||
|
||||
Usage:
|
||||
-----
|
||||
For those using Windows, place the file "CDVDisoEFP.dll" in the Plugin
|
||||
directory of the Emulator to use it.
|
||||
|
||||
For Linux users, place the file "libCDVDisoEFP.so" in the plugin
|
||||
directory of the Emulator. Also, place the file "cfgCDVDisoEFP" in the "cfg"
|
||||
directory of the Emulator to use it.
|
||||
|
||||
Configuration:
|
||||
-------------
|
||||
You must select the iso you want to use in the Configuration dialog. You
|
||||
will come back to this dialog should the Emulator want another disc.
|
||||
|
||||
Creating an iso (linux, Windows XP only):
|
||||
---------------
|
||||
To create an iso you can use the button 'Make Image'. The file
|
||||
will be the one in the Iso Edit, and the Source Device is the CDRom or
|
||||
DVD drive that will have the disc you want to make an image of.
|
||||
The compression method is specified by the Compression Method Combo.
|
||||
|
||||
Note: This will fail if the file already exists (if it's compressed
|
||||
a .z or .bz2 suffix will be added).
|
||||
|
||||
Compressed isos:
|
||||
---------------
|
||||
You can create them using the Convert button. This will create a .Z or .bz
|
||||
file (the compressed image) and a .z.table or .bz2.table file (this is a
|
||||
table, for speed reasons.) Both will be created in the same dir as the
|
||||
selected image. The original image will not be deleted and/or changed. Also,
|
||||
you can decompress a compressed image by selecting "None" in the
|
||||
Compression Method Combo.
|
||||
|
||||
Note: you only can decompress the images with this program; not with
|
||||
compress or bzip2.
|
||||
|
||||
Compression Method:
|
||||
------------------
|
||||
.z speed - fast compression, small blocks, table in memory.
|
||||
.bz2 speed - average compression, 32k - 40k blocks, table in memory.
|
||||
.bz2 size - best compression, 60k - 62k blocks, table on file.
|
||||
|
||||
|
||||
Email: <linuzappz@hotmail.com>
|
|
@ -1,401 +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,35 +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,410 +0,0 @@
|
|||
/* CDVDiso.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
|
||||
#define CDVDdefs
|
||||
#include "PS2Edefs.h"
|
||||
#include "conf.h"
|
||||
#include "actualfile.h"
|
||||
#include "isofile.h"
|
||||
#include "logfile.h"
|
||||
#include "convert.h"
|
||||
#include "version.h"
|
||||
#include "CDVDiso.h"
|
||||
struct IsoFile *isofile;
|
||||
char isobuffer[2448];
|
||||
char isocdcheck[2448];
|
||||
int isomode;
|
||||
int deviceopencount; // 0 = Closed, 1+ = Open
|
||||
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);
|
||||
}
|
||||
s32 CALLBACK CDVDinit()
|
||||
{
|
||||
int i;
|
||||
|
||||
InitLog();
|
||||
if (OpenLog() != 0) return(-1); // Couldn't open Log File? Abort.
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDinit()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
InitConf();
|
||||
isofile = NULL;
|
||||
isomode = -1;
|
||||
for (i = 0; i < 2048; i++) isocdcheck[i] = 0;
|
||||
deviceopencount = 0;
|
||||
|
||||
return(0);
|
||||
} // END CDVDinit()
|
||||
void CALLBACK CDVDshutdown()
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDshutdown()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
isofile = IsoFileClose(isofile);
|
||||
CloseLog();
|
||||
} // END CDVDshutdown()
|
||||
s32 CALLBACK CDVDopen(const char* pTitleFilename)
|
||||
{
|
||||
int retval;
|
||||
int i;
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDopen()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
LoadConf();
|
||||
if (pTitleFilename != NULL) strcpy(conf.isoname, pTitleFilename);
|
||||
if ((conf.isoname[0] == 0) ||
|
||||
((conf.startconfigure != 0) && (deviceopencount == 0)) ||
|
||||
((conf.restartconfigure != 0) && (deviceopencount > 0)))
|
||||
{
|
||||
ExecCfg("configure");
|
||||
LoadConf();
|
||||
} // ENDIF- Haven't initialized the configure program yet? Do so now.
|
||||
isofile = IsoFileOpenForRead(conf.isoname);
|
||||
if (isofile == NULL)
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: Failed to open ISO file!");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
// return(-1); // Taken out for "NULL" device simulation
|
||||
for (i = 0; i < 2048; i++) isocdcheck[i] = 0;
|
||||
return(0);
|
||||
} // ENDIF- Trouble opening file? Abort.
|
||||
retval = IsoFileSeek(isofile, 16);
|
||||
if (retval != 0) return(-1);
|
||||
retval = IsoFileRead(isofile, isobuffer);
|
||||
if (retval != 0) return(-1);
|
||||
if (deviceopencount > 0)
|
||||
{
|
||||
i = 0;
|
||||
while ((i < 2048) && (isocdcheck[i] == isobuffer[i])) i++;
|
||||
if (i == 2048) deviceopencount = 0; // Same CD/DVD? No delay.
|
||||
} // ENDIF- Is this a restart? Check for disc change.
|
||||
for (i = 0; i < 2048; i++) isocdcheck[i] = isobuffer[i];
|
||||
return(0);
|
||||
} // END CDVDopen()
|
||||
|
||||
void CALLBACK CDVDclose()
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDclose()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
isofile = IsoFileClose(isofile);
|
||||
deviceopencount = 50;
|
||||
} // END CDVDclose()
|
||||
|
||||
s32 CALLBACK CDVDreadSubQ(u32 lsn, cdvdSubQ* subq)
|
||||
{
|
||||
char temptime[3];
|
||||
int i;
|
||||
int pos;
|
||||
u32 tracklsn;
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDreadSubQ()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
if (isofile == NULL) return(-1);
|
||||
if (deviceopencount > 0) return(-1);
|
||||
if ((isofile->cdvdtype == CDVD_TYPE_PS2DVD) ||
|
||||
(isofile->cdvdtype == CDVD_TYPE_DVDV))
|
||||
{
|
||||
return(-1); // DVDs don't have SubQ data
|
||||
} // ENDIF- Trying to get a SubQ from a DVD?
|
||||
// fake it
|
||||
i = BCDTOHEX(isofile->toc[7]);
|
||||
pos = i * 10;
|
||||
pos += 30;
|
||||
temptime[0] = BCDTOHEX(isofile->toc[pos + 7]);
|
||||
temptime[1] = BCDTOHEX(isofile->toc[pos + 8]);
|
||||
temptime[2] = BCDTOHEX(isofile->toc[pos + 9]);
|
||||
tracklsn = MSFtoLBA(temptime);
|
||||
while ((i < BCDTOHEX(isofile->toc[17])) && (tracklsn < lsn))
|
||||
{
|
||||
i++;
|
||||
pos = i * 10;
|
||||
pos += 30;
|
||||
temptime[0] = BCDTOHEX(isofile->toc[pos + 7]);
|
||||
temptime[1] = BCDTOHEX(isofile->toc[pos + 8]);
|
||||
temptime[2] = BCDTOHEX(isofile->toc[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)
|
||||
{
|
||||
if (isofile == NULL) return(-1);
|
||||
if (deviceopencount > 0) return(-1);
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDgetTN()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
if ((isofile->cdvdtype == CDVD_TYPE_PS2DVD) ||
|
||||
(isofile->cdvdtype == CDVD_TYPE_DVDV))
|
||||
{
|
||||
Buffer->strack = 1;
|
||||
Buffer->etrack = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
Buffer->strack = BCDTOHEX(isofile->toc[7]);
|
||||
Buffer->etrack = BCDTOHEX(isofile->toc[17]);
|
||||
} // ENDIF- Retrieve track info from a DVD? (or a CD?)
|
||||
return(0);
|
||||
} // END CDVDgetTN()
|
||||
|
||||
s32 CALLBACK CDVDgetTD(u8 track, cdvdTD *Buffer)
|
||||
{
|
||||
u8 actualtrack;
|
||||
int pos;
|
||||
char temptime[3];
|
||||
if (isofile == NULL) return(-1);
|
||||
if (deviceopencount > 0) return(-1);
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDgetTD()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
actualtrack = track;
|
||||
if (actualtrack == 0xaa) actualtrack = 0;
|
||||
if ((isofile->cdvdtype == CDVD_TYPE_PS2DVD) ||
|
||||
(isofile->cdvdtype == CDVD_TYPE_DVDV))
|
||||
{
|
||||
if (actualtrack <= 1)
|
||||
{
|
||||
Buffer->type = 0;
|
||||
Buffer->lsn = isofile->filesectorsize;
|
||||
}
|
||||
else
|
||||
{
|
||||
Buffer->type = CDVD_MODE1_TRACK;
|
||||
Buffer->lsn = 0;
|
||||
} // ENDIF- Whole disc? (or single track?)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (actualtrack == 0)
|
||||
{
|
||||
Buffer->type = 0;
|
||||
temptime[0] = BCDTOHEX(isofile->toc[27]);
|
||||
temptime[1] = BCDTOHEX(isofile->toc[28]);
|
||||
temptime[2] = BCDTOHEX(isofile->toc[29]);
|
||||
Buffer->lsn = MSFtoLBA(temptime);
|
||||
}
|
||||
else
|
||||
{
|
||||
pos = actualtrack * 10;
|
||||
pos += 30;
|
||||
Buffer->type = isofile->toc[pos];
|
||||
temptime[0] = BCDTOHEX(isofile->toc[pos + 7]);
|
||||
temptime[1] = BCDTOHEX(isofile->toc[pos + 8]);
|
||||
temptime[2] = BCDTOHEX(isofile->toc[pos + 9]);
|
||||
Buffer->lsn = MSFtoLBA(temptime);
|
||||
} // ENDIF- Whole disc? (or single track?)
|
||||
} // ENDIF- Retrieve track info from a DVD? (or a CD?)
|
||||
return(0);
|
||||
} // END CDVDgetTD()
|
||||
|
||||
s32 CALLBACK CDVDgetTOC(void* toc)
|
||||
{
|
||||
int i;
|
||||
if (isofile == NULL) return(-1);
|
||||
if (deviceopencount > 0) return(-1);
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDgetTOC()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
for (i = 0; i < 2048; i++) *(((char *) toc) + i) = isofile->toc[i];
|
||||
return(0);
|
||||
} // END CDVDgetTOC()
|
||||
|
||||
s32 CALLBACK CDVDreadTrack(u32 lsn, int mode)
|
||||
{
|
||||
int retval;
|
||||
if (isofile == NULL) return(-1);
|
||||
if (deviceopencount > 0)
|
||||
{
|
||||
deviceopencount--;
|
||||
return(-1);
|
||||
} // ENDIF- Simulate a temporarily open device?
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDreadTrack(%u)", lsn);
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
retval = IsoFileSeek(isofile, (off64_t) lsn);
|
||||
if (retval != 0)
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: Trouble finding the sector!");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
return(-1);
|
||||
} // ENDIF- Trouble finding the sector?
|
||||
retval = IsoFileRead(isofile, isobuffer);
|
||||
if (retval != 0)
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: Trouble reading the sector!");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
return(-1);
|
||||
} // ENDIF- Trouble finding the sector?
|
||||
isomode = mode;
|
||||
return(0);
|
||||
} // END CDVDreadTrack()
|
||||
|
||||
u8* CALLBACK CDVDgetBuffer()
|
||||
{
|
||||
int offset;
|
||||
if (isofile == NULL) return(NULL);
|
||||
if (deviceopencount > 0) return(NULL);
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDgetBuffer()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
offset = 0;
|
||||
switch (isomode)
|
||||
{
|
||||
case CDVD_MODE_2352:
|
||||
offset = 0;
|
||||
break;
|
||||
case CDVD_MODE_2340:
|
||||
offset = 12;
|
||||
break;
|
||||
case CDVD_MODE_2328:
|
||||
case CDVD_MODE_2048:
|
||||
offset = 24;
|
||||
break;
|
||||
} // ENDSWITCH isomode- offset to where data it wants is.
|
||||
if (offset > isofile->blockoffset) offset = isofile->blockoffset;
|
||||
return(isobuffer + offset);
|
||||
} // END CDVDgetBuffer()
|
||||
s32 CALLBACK CDVDgetDiskType()
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDgetDiskType()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
|
||||
if (isofile == NULL) return(CDVD_TYPE_NODISC);
|
||||
if (deviceopencount > 0)
|
||||
{
|
||||
deviceopencount--;
|
||||
return(CDVD_TYPE_DETCT);
|
||||
} // ENDIF- Simulate a temporarily open device?
|
||||
|
||||
return(isofile->cdvdtype);
|
||||
} // END CDVDgetDiskType()
|
||||
s32 CALLBACK CDVDgetTrayStatus()
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDgetTrayStatus()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
if (isofile == NULL) return(CDVD_TRAY_OPEN);
|
||||
if (deviceopencount > 30)
|
||||
{
|
||||
deviceopencount--;
|
||||
return(CDVD_TRAY_OPEN);
|
||||
} // ENDIF- Simulate a temporarily open device?
|
||||
return(CDVD_TRAY_CLOSE);
|
||||
} // END CDVDgetTrayStatus()
|
||||
s32 CALLBACK CDVDctrlTrayOpen()
|
||||
{
|
||||
int i;
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDctrlTrayOpen()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
|
||||
// Close()
|
||||
isofile = IsoFileClose(isofile);
|
||||
deviceopencount = 50;
|
||||
|
||||
// and re-Open()
|
||||
if ((conf.isoname[0] == 0) ||
|
||||
((conf.restartconfigure != 0) && (deviceopencount > 0)))
|
||||
{
|
||||
ExecCfg("configure");
|
||||
LoadConf();
|
||||
} // ENDIF- Haven't initialized the configure program yet? Do so now.
|
||||
isofile = IsoFileOpenForRead(conf.isoname);
|
||||
if (isofile == NULL)
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: Failed to open ISO file!");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
} // ENDIF- Trouble opening file? Abort.
|
||||
if (deviceopencount > 0)
|
||||
{
|
||||
i = 0;
|
||||
while ((i < 2048) && (isocdcheck[i] == isobuffer[i])) i++;
|
||||
if (i == 2048) deviceopencount = 0; // Same CD/DVD? No delay.
|
||||
} // ENDIF- Is this a restart? Check for disc change.
|
||||
for (i = 0; i < 2048; i++) isocdcheck[i] = isobuffer[i];
|
||||
return(0);
|
||||
} // END CDVDctrlTrayOpen()
|
||||
|
||||
s32 CALLBACK CDVDctrlTrayClose()
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDctrlTrayClose()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
return(0);
|
||||
} // END CDVDctrlTrayClose()
|
||||
void CALLBACK CDVDconfigure()
|
||||
{
|
||||
ExecCfg("configure");
|
||||
} // END CDVDconfigure()
|
||||
s32 CALLBACK CDVDtest()
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDtest()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
InitConf(); // Odd... hasn't CDVDinit been called yet?
|
||||
LoadConf();
|
||||
|
||||
if (conf.isoname[0] == 0) return(0); // No name chosen yet. Catch on Open()
|
||||
if (IsIsoFile(conf.isoname) == 0) return(0); // Valid name. Go.
|
||||
return(-1); // Invalid name - reconfigure first.
|
||||
// Note really need this? Why not just return(0)...
|
||||
} // END CDVDtest()
|
||||
|
||||
void CALLBACK CDVDabout()
|
||||
{
|
||||
ExecCfg("about");
|
||||
} // END CDVDabout()
|
|
@ -1,26 +0,0 @@
|
|||
/* CDVDiso.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 CDVDISO_H
|
||||
#define CDVDISO_H
|
||||
|
||||
// #define VERBOSE_FUNCTION_INTERFACE
|
||||
|
||||
#endif /* CDVDISO_H */
|
|
@ -1,653 +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"
|
||||
|
||||
|
||||
// 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,34 +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,91 +0,0 @@
|
|||
|
||||
PLUGIN = libCDVDisoEFP.so
|
||||
PLUGINOBJS = CDVDiso.o
|
||||
PLUGINHEADERS = CDVDiso.h
|
||||
PLUGINFLAGS = -fPIC -Wall -O2 -fomit-frame-pointer -D_LARGEFILE64_SOURCE \
|
||||
-I.. -I. -I./Linux -m32
|
||||
PLUGINLIBS = -lz -lbz2
|
||||
|
||||
CFG = cfgCDVDisoEFP
|
||||
CFGOBJS = interface.o aboutbox.o mainbox.o selectionbox.o \
|
||||
devicebox.o conversionbox.o progressbox.o messagebox.o \
|
||||
tablerebuild.o device.o CD.o DVD.o
|
||||
CFGHEADERS = interface.h aboutbox.h mainbox.h selectionbox.h \
|
||||
devicebox.h conversionbox.h progressbox.h messagebox.h \
|
||||
tablerebuild.h device.h CD.h DVD.h
|
||||
CFGFLAGS = -fPIC -Wall -O2 -fomit-frame-pointer -D_LARGEFILE64_SOURCE \
|
||||
-I.. -I. -I./Linux -m32
|
||||
CFGLIBS = -lz -lbz2
|
||||
|
||||
COMP = compCDVDisoEFP
|
||||
COMPOBJS = comparisonbox.o progressbox.o messagebox.o \
|
||||
comparisondummy.o
|
||||
COMPHEADERS = progressbox.h messagebox.h
|
||||
|
||||
SHAREDOBJS = ../version.o actualfile.o ../isofile.o conf.o logfile.o \
|
||||
../imagetype.o ../multifile.o ../isocompress.o ../convert.o \
|
||||
../gzipv1.o ../blockv2.o ../gzipv2.o ../ecma119.o \
|
||||
../bzip2v3.o ../bzip2v2.o \
|
||||
../toc.o ../ini.o
|
||||
SHAREDHEADERS = ../version.h actualfile.h ../isofile.h conf.h logfile.h \
|
||||
../imagetype.h ../multifile.h ../isocompress.h ../convert.h \
|
||||
../gzipv1.h ../blockv2.h ../gzipv2.h ../bzip2v2.h ../ecma119.h \
|
||||
../toc.h ../ini.h ../bzip2v3.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)
|
||||
|
||||
compare: $(COMPOBJS) $(SHAREDOBJS)
|
||||
rm -f $(COMP)
|
||||
$(CC) $(CFGFLAGS) $(GTKFLAGS) $(CFGLIBS) $(GTKLIBS) \
|
||||
$(COMPOBJS) $(SHAREDOBJS) -o $(COMP)
|
||||
strip $(COMP)
|
||||
|
||||
$(PLUGINOBJS) $(SHAREDOBJS): %.o: %.c
|
||||
$(CC) $(PLUGINFLAGS) -c $< -o $@
|
||||
|
||||
$(CFGOBJS) ../comparisonbox.o ../comparisondummy.o: %.o: %.c
|
||||
$(CC) $(CFGFLAGS) $(GTKFLAGS) -c $< -o $@
|
||||
|
||||
.PHONY : clean allclean
|
||||
clean:
|
||||
-rm -f $(PLUGINOBJS) $(PLUGIN) $(CFGOBJS) $(CFG) \
|
||||
$(COMP) $(COMPOBJS) $(SHAREDOBJS)
|
||||
-rm -f *~ temp.txt ../*~ ../temp.txt ../../*~
|
||||
|
||||
allclean:
|
||||
-rm -f $(PLUGINOBJS) $(PLUGIN) $(CFGOBJS) $(CFG) \
|
||||
$(COMP) $(COMPOBJS) $(SHAREDOBJS)
|
||||
-rm -f *~ temp.txt ../*~ ../temp.txt ../../*~
|
||||
-rm -f ../../$(PLUGIN) ../../$(CFG)
|
||||
|
|
@ -1,109 +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/gtkbutton.h> // gtk_button_new_with_label()
|
||||
#include <gtk/gtkcontainer.h> // gtk_container_add()
|
||||
#include <gtk/gtkhbbox.h> // gtk_hbutton_box_new()
|
||||
#include <gtk/gtklabel.h> // gtk_label_new()
|
||||
#include <gtk/gtkmain.h> // gtk_init(), gtk_main(), gtk_main_quit()
|
||||
#include <gtk/gtkvbox.h> // gtk_vbox_new()
|
||||
#include <gtk/gtkwindow.h> // gtk_window_new()
|
||||
|
||||
#include "version.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 CDVDisoEFP");
|
||||
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,118 +0,0 @@
|
|||
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
|
||||
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
|
||||
|
||||
<glade-interface>
|
||||
<requires lib="gnome"/>
|
||||
|
||||
<widget class="GtkWindow" id="dotwindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes">About CDVDiso</property>
|
||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||
<property name="window_position">GTK_WIN_POS_CENTER</property>
|
||||
<property name="modal">True</property>
|
||||
<property name="resizable">False</property>
|
||||
<property name="destroy_with_parent">False</property>
|
||||
<property name="decorated">True</property>
|
||||
<property name="skip_taskbar_hint">False</property>
|
||||
<property name="skip_pager_hint">False</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
|
||||
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">CDVDiso ISO Driver v0.6</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label2">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Author: linuzappz <linuzappz@hotmail.com></property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label3">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Modified by: shadow, efp</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHButtonBox" id="hbuttonbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_DEFAULT_STYLE</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="button1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Ok</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
</glade-interface>
|
|
@ -1,34 +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/gtkwidget.h>
|
||||
|
||||
struct AboutBoxData
|
||||
{
|
||||
GtkWidget *window; // GtkWindow - About Box
|
||||
};
|
||||
extern struct AboutBoxData aboutbox;
|
||||
|
||||
extern void AboutBoxDisplay();
|
||||
|
||||
#endif /* ABOUTBOX_H */
|
|
@ -1,238 +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,45 +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,453 +0,0 @@
|
|||
/* comparisonbox.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 <gtk/gtkbutton.h> // gtk_button_new_with_label()
|
||||
#include <gtk/gtkcontainer.h> // gtk_container_add()
|
||||
#include <gtk/gtkentry.h> // gtk_entry_new()
|
||||
#include <gtk/gtkfilesel.h> // gtk_file_selection_set_filename()
|
||||
#include <gtk/gtkhbbox.h> // gtk_hbutton_box_new()
|
||||
#include <gtk/gtkhbox.h> // gtk_hbox_new()
|
||||
#include <gtk/gtkhseparator.h> // gtk_hseparator_new()
|
||||
#include <gtk/gtklabel.h> // gtk_label_new()
|
||||
#include <gtk/gtkmain.h> // gtk_init(), gtk_main(), gtk_main_quit()
|
||||
#include <gtk/gtkvbox.h> // gtk_vbox_new()
|
||||
#include <gtk/gtkwidget.h>
|
||||
#include <gtk/gtkwindow.h> // gtk_window_new()
|
||||
|
||||
#include "logfile.h"
|
||||
#include "conf.h"
|
||||
#include "isofile.h"
|
||||
#include "isocompress.h" // compressdesc[]
|
||||
#include "multifile.h" // multinames[]
|
||||
#include "tablerebuild.h" // IsoTableRebuild()
|
||||
#include "progressbox.h"
|
||||
#include "messagebox.h"
|
||||
|
||||
|
||||
struct MainBoxData
|
||||
{
|
||||
GtkWidget *window; // GtkWindow
|
||||
GtkWidget *file1; // GtkEntry
|
||||
GtkWidget *desc1; // GtkLabel
|
||||
GtkWidget *file2; // GtkEntry
|
||||
GtkWidget *desc2; // GtkLabel
|
||||
GtkWidget *okbutton; // GtkButton
|
||||
// Leaving the Cancel button unblocked... for emergency shutdown
|
||||
|
||||
int stop; // Variable signal to stop long processes
|
||||
};
|
||||
|
||||
|
||||
struct MainBoxData mainbox;
|
||||
|
||||
|
||||
void MainBoxDestroy()
|
||||
{
|
||||
if (mainbox.window != NULL)
|
||||
{
|
||||
gtk_widget_destroy(mainbox.window);
|
||||
mainbox.window = NULL;
|
||||
mainbox.file1 = NULL;
|
||||
mainbox.desc1 = NULL;
|
||||
mainbox.file2 = NULL;
|
||||
mainbox.desc2 = NULL;
|
||||
mainbox.okbutton = NULL;
|
||||
} // ENDIF- Do we have a Main Window still?
|
||||
} // END MainBoxDestroy()
|
||||
|
||||
|
||||
void MainBoxUnfocus()
|
||||
{
|
||||
gtk_widget_set_sensitive(mainbox.file1, FALSE);
|
||||
gtk_widget_set_sensitive(mainbox.file2, FALSE);
|
||||
gtk_widget_set_sensitive(mainbox.okbutton, FALSE);
|
||||
gtk_window_iconify(GTK_WINDOW(mainbox.window));
|
||||
} // END MainBoxUnfocus()
|
||||
|
||||
|
||||
gint MainBoxFile1Event(GtkWidget *widget, GdkEvent event, gpointer data)
|
||||
{
|
||||
int returnval;
|
||||
char templine[256];
|
||||
struct IsoFile *tempfile;
|
||||
|
||||
returnval = IsIsoFile(gtk_entry_get_text(GTK_ENTRY(mainbox.file1)));
|
||||
if (returnval == -1)
|
||||
{
|
||||
gtk_label_set_text(GTK_LABEL(mainbox.desc1), "File Type: ---");
|
||||
return(TRUE);
|
||||
} // ENDIF- Not a name of any sort?
|
||||
|
||||
if (returnval == -2)
|
||||
{
|
||||
gtk_label_set_text(GTK_LABEL(mainbox.desc1), "File Type: Not a file");
|
||||
return(TRUE);
|
||||
} // ENDIF- Not a regular file?
|
||||
|
||||
if (returnval == -3)
|
||||
{
|
||||
gtk_label_set_text(GTK_LABEL(mainbox.desc1), "File Type: Not a valid image file");
|
||||
return(TRUE);
|
||||
} // ENDIF- Not an Image file?
|
||||
|
||||
if (returnval == -4)
|
||||
{
|
||||
gtk_label_set_text(GTK_LABEL(mainbox.desc1), "File Type: Missing Table File (will rebuild)");
|
||||
return(TRUE);
|
||||
} // ENDIF- Missing Compression seek table?
|
||||
|
||||
tempfile = IsoFileOpenForRead(gtk_entry_get_text(GTK_ENTRY(mainbox.file1)));
|
||||
sprintf(templine, "File Type: %s%s%s",
|
||||
multinames[tempfile->multi],
|
||||
tempfile->imagename,
|
||||
compressdesc[tempfile->compress]);
|
||||
gtk_label_set_text(GTK_LABEL(mainbox.desc1), templine);
|
||||
tempfile = IsoFileClose(tempfile);
|
||||
return(TRUE);
|
||||
} // END MainBoxFileEvent()
|
||||
|
||||
|
||||
gint MainBoxFile2Event(GtkWidget *widget, GdkEvent event, gpointer data)
|
||||
{
|
||||
int returnval;
|
||||
char templine[256];
|
||||
struct IsoFile *tempfile;
|
||||
|
||||
returnval = IsIsoFile(gtk_entry_get_text(GTK_ENTRY(mainbox.file2)));
|
||||
if (returnval == -1)
|
||||
{
|
||||
gtk_label_set_text(GTK_LABEL(mainbox.desc2), "File Type: ---");
|
||||
return(TRUE);
|
||||
} // ENDIF- Not a name of any sort?
|
||||
|
||||
if (returnval == -2)
|
||||
{
|
||||
gtk_label_set_text(GTK_LABEL(mainbox.desc2), "File Type: Not a file");
|
||||
return(TRUE);
|
||||
} // ENDIF- Not a regular file?
|
||||
|
||||
if (returnval == -3)
|
||||
{
|
||||
gtk_label_set_text(GTK_LABEL(mainbox.desc2), "File Type: Not a valid image file");
|
||||
return(TRUE);
|
||||
} // ENDIF- Not an Image file?
|
||||
|
||||
if (returnval == -4)
|
||||
{
|
||||
gtk_label_set_text(GTK_LABEL(mainbox.desc2), "File Type: Missing Table File (will rebuild)");
|
||||
return(TRUE);
|
||||
} // ENDIF- Missing Compression seek table?
|
||||
|
||||
tempfile = IsoFileOpenForRead(gtk_entry_get_text(GTK_ENTRY(mainbox.file2)));
|
||||
sprintf(templine, "File Type: %s%s%s",
|
||||
multinames[tempfile->multi],
|
||||
tempfile->imagename,
|
||||
compressdesc[tempfile->compress]);
|
||||
gtk_label_set_text(GTK_LABEL(mainbox.desc2), templine);
|
||||
tempfile = IsoFileClose(tempfile);
|
||||
return(TRUE);
|
||||
} // END MainBoxFileEvent()
|
||||
|
||||
|
||||
void MainBoxRefocus()
|
||||
{
|
||||
GdkEvent event;
|
||||
|
||||
MainBoxFile1Event(NULL, event, NULL);
|
||||
MainBoxFile2Event(NULL, event, NULL);
|
||||
|
||||
gtk_widget_set_sensitive(mainbox.file1, TRUE);
|
||||
gtk_widget_set_sensitive(mainbox.file2, TRUE);
|
||||
gtk_widget_set_sensitive(mainbox.okbutton, TRUE);
|
||||
gtk_window_set_focus(GTK_WINDOW(mainbox.window), mainbox.file1);
|
||||
gtk_window_deiconify(GTK_WINDOW(mainbox.window));
|
||||
} // END MainBoxRefocus()
|
||||
|
||||
|
||||
gint MainBoxCancelEvent(GtkWidget *widget, GdkEvent event, gpointer data)
|
||||
{
|
||||
mainbox.stop = 1; // Halt all long processess...
|
||||
|
||||
MessageBoxDestroy();
|
||||
ProgressBoxDestroy();
|
||||
MainBoxDestroy();
|
||||
|
||||
gtk_main_quit();
|
||||
return(TRUE);
|
||||
} // END MainBoxCancelEvent()
|
||||
|
||||
|
||||
gint MainBoxOKEvent(GtkWidget *widget, GdkEvent event, gpointer data)
|
||||
{
|
||||
const char *tempisoname1;
|
||||
const char *tempisoname2;
|
||||
struct IsoFile *tempiso1;
|
||||
struct IsoFile *tempiso2;
|
||||
int stop;
|
||||
off64_t endsector;
|
||||
off64_t sector;
|
||||
int retval;
|
||||
char tempblock1[2448];
|
||||
char tempblock2[2448];
|
||||
int i;
|
||||
|
||||
MainBoxUnfocus();
|
||||
|
||||
tempisoname1 = gtk_entry_get_text(GTK_ENTRY(mainbox.file1));
|
||||
tempisoname2 = gtk_entry_get_text(GTK_ENTRY(mainbox.file2));
|
||||
tempiso1 = NULL;
|
||||
tempiso2 = NULL;
|
||||
|
||||
tempiso1 = IsoFileOpenForRead(tempisoname1);
|
||||
if (tempiso1 == NULL)
|
||||
{
|
||||
MainBoxRefocus();
|
||||
MessageBoxShow("First file is not a Valid Image File.", 0);
|
||||
tempisoname1 = NULL;
|
||||
tempisoname2 = NULL;
|
||||
return(TRUE);
|
||||
} // ENDIF- Not an ISO file? Message and Stop here.
|
||||
|
||||
tempiso2 = IsoFileOpenForRead(tempisoname2);
|
||||
if (tempiso2 == NULL)
|
||||
{
|
||||
MainBoxRefocus();
|
||||
MessageBoxShow("Second file is not a Valid Image File.", 0);
|
||||
tempiso1 = IsoFileClose(tempiso1);
|
||||
tempisoname1 = NULL;
|
||||
tempisoname2 = NULL;
|
||||
return(TRUE);
|
||||
} // ENDIF- Not an ISO file? Message and Stop here.
|
||||
|
||||
if (tempiso1->blocksize != tempiso2->blocksize)
|
||||
{
|
||||
MainBoxRefocus();
|
||||
MessageBoxShow("Block sizes in Image files do not match.", 0);
|
||||
tempiso1 = IsoFileClose(tempiso1);
|
||||
tempiso2 = IsoFileClose(tempiso2);
|
||||
tempisoname1 = NULL;
|
||||
tempisoname2 = NULL;
|
||||
return(TRUE);
|
||||
} // ENDIF- Not an ISO file? Message and Stop here.
|
||||
|
||||
if (tempiso1->multi == 1)
|
||||
{
|
||||
i = 0;
|
||||
while ((i < 10) &&
|
||||
(IsoFileSeek(tempiso1, tempiso1->multisectorend[i] + 1) == 0)) i++;
|
||||
endsector = tempiso1->multisectorend[tempiso1->multiend];
|
||||
}
|
||||
else
|
||||
{
|
||||
endsector = tempiso1->filesectorsize;
|
||||
} // ENDIF- Get ending sector from multifile? (Or single file?)
|
||||
IsoFileSeek(tempiso1, 0);
|
||||
|
||||
if (tempiso2->multi == 1)
|
||||
{
|
||||
i = 0;
|
||||
while ((i < 10) &&
|
||||
(IsoFileSeek(tempiso2, tempiso2->multisectorend[i] + 1) == 0)) i++;
|
||||
sector = tempiso2->multisectorend[tempiso2->multiend];
|
||||
}
|
||||
else
|
||||
{
|
||||
sector = tempiso2->filesectorsize;
|
||||
} // ENDIF- Get ending sector from multifile? (Or single file?)
|
||||
IsoFileSeek(tempiso2, 0);
|
||||
if (sector != endsector)
|
||||
{
|
||||
MainBoxRefocus();
|
||||
MessageBoxShow("Number of blocks in Image files do not match.", 0);
|
||||
tempiso1 = IsoFileClose(tempiso1);
|
||||
tempiso2 = IsoFileClose(tempiso2);
|
||||
tempisoname1 = NULL;
|
||||
tempisoname2 = NULL;
|
||||
return(TRUE);
|
||||
} // ENDIF- Number of blocks don't match? Say so.
|
||||
|
||||
sprintf(tempblock1, "%s == %s ?", tempisoname1, tempisoname2);
|
||||
ProgressBoxStart(tempblock1, endsector);
|
||||
|
||||
stop = 0;
|
||||
mainbox.stop = 0;
|
||||
progressbox.stop = 0;
|
||||
while ((stop == 0) && (tempiso1->sectorpos < endsector))
|
||||
{
|
||||
retval = IsoFileRead(tempiso1, tempblock1);
|
||||
if (retval < 0)
|
||||
{
|
||||
MainBoxRefocus();
|
||||
MessageBoxShow("Trouble reading first file.", 0);
|
||||
stop = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
retval = IsoFileRead(tempiso2, tempblock2);
|
||||
if (retval < 0)
|
||||
{
|
||||
MainBoxRefocus();
|
||||
MessageBoxShow("Trouble reading second file.", 0);
|
||||
stop = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
i = 0;
|
||||
while ((i < tempiso1->blocksize) && (tempblock1[i] == tempblock2[i])) i++;
|
||||
if (i < tempiso1->blocksize)
|
||||
{
|
||||
MainBoxRefocus();
|
||||
MessageBoxShow("Trouble reading second file.", 0);
|
||||
stop = 1;
|
||||
} // ENDIF- Sectors don't match? Say so.
|
||||
} // ENDIF- Trouble reading second file?
|
||||
} // ENDIF- Trouble reading first file?
|
||||
|
||||
ProgressBoxTick(tempiso1->sectorpos);
|
||||
while (gtk_events_pending()) gtk_main_iteration();
|
||||
|
||||
if (mainbox.stop != 0) stop = 2;
|
||||
if (progressbox.stop != 0) stop = 2;
|
||||
} // ENDWHILE- Comparing two files... sector by sector
|
||||
|
||||
if (stop == 0)
|
||||
{
|
||||
MainBoxRefocus();
|
||||
MessageBoxShow("Images Match.", 0);
|
||||
} // ENDIF- Everything checked out? Say so.
|
||||
tempiso1 = IsoFileClose(tempiso1);
|
||||
tempiso2 = IsoFileClose(tempiso2);
|
||||
tempisoname1 = NULL;
|
||||
tempisoname2 = NULL;
|
||||
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), "CDVDisoEFP Comparsion");
|
||||
gtk_window_set_position(GTK_WINDOW(mainbox.window), GTK_WIN_POS_CENTER);
|
||||
// gtk_window_set_resizable(GTK_WINDOW(mainbox.window), FALSE);
|
||||
|
||||
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("First Iso File:");
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), item, FALSE, FALSE, 0);
|
||||
gtk_widget_show(item);
|
||||
item = NULL;
|
||||
|
||||
mainbox.file1 = gtk_entry_new();
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), mainbox.file1, TRUE, TRUE, 0);
|
||||
gtk_widget_show(mainbox.file1);
|
||||
g_signal_connect(G_OBJECT(mainbox.file1), "changed",
|
||||
G_CALLBACK(MainBoxFile1Event), NULL);
|
||||
hbox1 = NULL;
|
||||
|
||||
mainbox.desc1 = gtk_label_new("File Type: ---");
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), mainbox.desc1, FALSE, FALSE, 0);
|
||||
gtk_widget_show(mainbox.desc1);
|
||||
|
||||
item = gtk_hseparator_new();
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), item, TRUE, TRUE, 0);
|
||||
gtk_widget_show(item);
|
||||
item = NULL;
|
||||
|
||||
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("Second Iso File:");
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), item, FALSE, FALSE, 0);
|
||||
gtk_widget_show(item);
|
||||
item = NULL;
|
||||
|
||||
mainbox.file2 = gtk_entry_new();
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), mainbox.file2, TRUE, TRUE, 0);
|
||||
gtk_widget_show(mainbox.file2);
|
||||
g_signal_connect(G_OBJECT(mainbox.file2), "changed",
|
||||
G_CALLBACK(MainBoxFile2Event), NULL);
|
||||
hbox1 = NULL;
|
||||
|
||||
mainbox.desc2 = gtk_label_new("File Type: ---");
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), mainbox.desc2, FALSE, FALSE, 0);
|
||||
gtk_widget_show(mainbox.desc2);
|
||||
|
||||
hbox1 = gtk_hbutton_box_new();
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), hbox1, TRUE, TRUE, 0);
|
||||
gtk_widget_show(hbox1);
|
||||
|
||||
mainbox.okbutton = gtk_button_new_with_label("Compare");
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), mainbox.okbutton, TRUE, TRUE, 0);
|
||||
gtk_widget_show(mainbox.okbutton);
|
||||
g_signal_connect(G_OBJECT(mainbox.okbutton), "clicked",
|
||||
G_CALLBACK(MainBoxOKEvent), NULL);
|
||||
|
||||
item = gtk_button_new_with_label("Exit");
|
||||
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.file1), conf.isoname);
|
||||
gtk_entry_set_text(GTK_ENTRY(mainbox.file2), conf.isoname);
|
||||
} // END MainBoxDisplay()
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
gtk_init(NULL, NULL);
|
||||
|
||||
OpenLog();
|
||||
InitConf();
|
||||
LoadConf();
|
||||
MainBoxDisplay();
|
||||
ProgressBoxDisplay();
|
||||
MessageBoxDisplay();
|
||||
|
||||
gtk_widget_show_all(mainbox.window);
|
||||
gtk_main();
|
||||
CloseLog();
|
||||
return(0);
|
||||
} // END main()
|
|
@ -1,227 +0,0 @@
|
|||
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
|
||||
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
|
||||
|
||||
<glade-interface>
|
||||
<requires lib="gnome"/>
|
||||
|
||||
<widget class="GtkWindow" id="dotwindow">
|
||||
<property name="border_width">5</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes">CDVDiso Comparison</property>
|
||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||
<property name="window_position">GTK_WIN_POS_CENTER</property>
|
||||
<property name="modal">False</property>
|
||||
<property name="resizable">True</property>
|
||||
<property name="destroy_with_parent">False</property>
|
||||
<property name="decorated">True</property>
|
||||
<property name="skip_taskbar_hint">False</property>
|
||||
<property name="skip_pager_hint">False</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
|
||||
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">First Iso File:</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">5</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkEntry" id="dotfile1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">True</property>
|
||||
<property name="visibility">True</property>
|
||||
<property name="max_length">0</property>
|
||||
<property name="text" translatable="yes"></property>
|
||||
<property name="has_frame">True</property>
|
||||
<property name="invisible_char" translatable="yes">*</property>
|
||||
<property name="activates_default">False</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">5</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="dotdesc1">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">File Type: ---</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHSeparator" id="hseparator1">
|
||||
<property name="visible">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox2">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label3">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Second Iso File:</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">5</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkEntry" id="dotfile2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">True</property>
|
||||
<property name="visibility">True</property>
|
||||
<property name="max_length">0</property>
|
||||
<property name="text" translatable="yes"></property>
|
||||
<property name="has_frame">True</property>
|
||||
<property name="invisible_char" translatable="yes">*</property>
|
||||
<property name="activates_default">False</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">5</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="dotdesc2">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">File Type: ---</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHButtonBox" id="hbuttonbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_DEFAULT_STYLE</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="dotokbutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Compare</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="button2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Exit</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">5</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
</glade-interface>
|
|
@ -1,30 +0,0 @@
|
|||
/* comparisondummy.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.
|
||||
*/
|
||||
|
||||
|
||||
void ConversionBoxRefocus()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void DeviceBoxRefocus()
|
||||
{
|
||||
return;
|
||||
}
|
|
@ -1,204 +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/cfgCDVDisoEFP", \
|
||||
"../cfg/cfgCDVDisoEFP", \
|
||||
"./cfgCDVDisoEFP", \
|
||||
"../cfgCDVDisoEFP", \
|
||||
"./plugins/cfgCDVDisoEFP", \
|
||||
"../plugins/cfgCDVDisoEFP", \
|
||||
NULL
|
||||
};
|
||||
|
||||
const char *confnames[] = { "IsoFile", "CdDev", NULL };
|
||||
const u8 defaultdevice[] = DEFAULT_DEVICE;
|
||||
const char defaulthome[] = "../inis";
|
||||
const char defaultdirectory[] = ".PS2E";
|
||||
const char defaultfile[] = "CDVDisoEFP.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 */
|
||||
conf.isoname[0] = 0; // Empty the iso name
|
||||
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", "IsoFile", conf.isoname);
|
||||
if (retval < 0)
|
||||
{
|
||||
sprintf(conf.isoname, "[Put an Image Name here]");
|
||||
} // ENDIF- Couldn't find keyword? Fill in a default
|
||||
|
||||
retval = INILoadString(conffilename, "Settings", "Device", conf.devicename);
|
||||
if (retval < 0)
|
||||
{
|
||||
sprintf(conf.devicename, "/dev/dvd");
|
||||
} // ENDIF- Couldn't find keyword? Fill in a default
|
||||
retval = INILoadUInt(conffilename, "Settings", "OpenOnStart", &conf.startconfigure);
|
||||
if (retval < 0)
|
||||
{
|
||||
conf.startconfigure = 0; // False
|
||||
} // ENDIF- Couldn't find keyword? Fill in a default
|
||||
|
||||
retval = INILoadUInt(conffilename, "Settings", "OpenOnRestart", &conf.restartconfigure);
|
||||
if (retval < 0)
|
||||
{
|
||||
conf.restartconfigure = 1; // True
|
||||
} // 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", "IsoFile", conf.isoname);
|
||||
INISaveString(conffilename, "Settings", "Device", conf.devicename);
|
||||
INISaveUInt(conffilename, "Settings", "OpenOnStart", conf.startconfigure);
|
||||
INISaveUInt(conffilename, "Settings", "OpenOnRestart", conf.restartconfigure);
|
||||
} // END SaveConf()
|
|
@ -1,55 +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 isoname[256];
|
||||
u8 devicename[256];
|
||||
unsigned int startconfigure;
|
||||
unsigned int restartconfigure;
|
||||
} CDVDconf;
|
||||
extern CDVDconf conf;
|
||||
|
||||
#define DEFAULT_DEVICE "K:\\"
|
||||
|
||||
|
||||
// Configuration Functions
|
||||
|
||||
extern void InitConf();
|
||||
extern void LoadConf();
|
||||
extern void SaveConf();
|
||||
|
||||
extern void ExecCfg(char *arg);
|
||||
|
||||
|
||||
#endif /* CONF_H */
|
|
@ -1,417 +0,0 @@
|
|||
/* conversionbox.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/types.h> // off64_t
|
||||
|
||||
#include <gtk/gtkbutton.h> // gtk_button_new_with_label()
|
||||
#include <gtk/gtkcombobox.h> // gtk_combo_box_new()
|
||||
#include <gtk/gtkcheckbutton.h> // gtk_check_button_new()
|
||||
#include <gtk/gtkcontainer.h> // gtk_container_add()
|
||||
#include <gtk/gtkentry.h> // gtk_entry_new()
|
||||
#include <gtk/gtkfilesel.h> // gtk_file_selection_set_filename()
|
||||
#include <gtk/gtkhbbox.h> // gtk_hbutton_box_new()
|
||||
#include <gtk/gtkhbox.h> // gtk_hbox_new()
|
||||
#include <gtk/gtkhseparator.h> // gtk_hseparator_new()
|
||||
#include <gtk/gtklabel.h> // gtk_label_new()
|
||||
#include <gtk/gtkmain.h> // gtk_main_iteration()
|
||||
#include <gtk/gtktogglebutton.h> // gtk_toggle_button_get_active()
|
||||
#include <gtk/gtkvbox.h> // gtk_vbox_new()
|
||||
#include <gtk/gtkwindow.h> // gtk_window_new()
|
||||
|
||||
#include "isofile.h"
|
||||
#include "isocompress.h" // compressdesc[]
|
||||
#include "imagetype.h" // imagedata[]
|
||||
#include "multifile.h" // multinames[]
|
||||
#include "toc.h"
|
||||
#include "progressbox.h"
|
||||
#include "messagebox.h"
|
||||
#include "selectionbox.h"
|
||||
#include "mainbox.h"
|
||||
#include "conversionbox.h"
|
||||
|
||||
|
||||
struct ConversionBoxData conversionbox;
|
||||
|
||||
|
||||
void ConversionBoxDestroy()
|
||||
{
|
||||
if (conversionbox.window != NULL)
|
||||
{
|
||||
gtk_widget_destroy(conversionbox.window);
|
||||
conversionbox.window = NULL;
|
||||
conversionbox.file = NULL;
|
||||
conversionbox.selectbutton = NULL;
|
||||
conversionbox.filedesc = NULL;
|
||||
conversionbox.compress = NULL;
|
||||
conversionbox.multi = NULL;
|
||||
conversionbox.okbutton = NULL;
|
||||
conversionbox.cancelbutton = NULL;
|
||||
} // ENDIF- Do we have a Main Window still?
|
||||
} // END ConversionBoxDestroy()
|
||||
|
||||
|
||||
void ConversionBoxUnfocus()
|
||||
{
|
||||
gtk_widget_set_sensitive(conversionbox.file, FALSE);
|
||||
gtk_widget_set_sensitive(conversionbox.selectbutton, FALSE);
|
||||
gtk_widget_set_sensitive(conversionbox.compress, FALSE);
|
||||
gtk_widget_set_sensitive(conversionbox.multi, FALSE);
|
||||
gtk_widget_set_sensitive(conversionbox.okbutton, FALSE);
|
||||
gtk_widget_set_sensitive(conversionbox.cancelbutton, FALSE);
|
||||
// gtk_window_iconify(GTK_WINDOW(conversionbox.window));
|
||||
gtk_widget_hide(conversionbox.window);
|
||||
} // END ConversionBoxUnfocus()
|
||||
|
||||
|
||||
gint ConversionBoxFileEvent(GtkWidget *widget, GdkEvent event, gpointer data)
|
||||
{
|
||||
int returnval;
|
||||
char templine[256];
|
||||
struct IsoFile *tempfile;
|
||||
|
||||
returnval = IsIsoFile(gtk_entry_get_text(GTK_ENTRY(conversionbox.file)));
|
||||
if (returnval == -1)
|
||||
{
|
||||
gtk_label_set_text(GTK_LABEL(conversionbox.filedesc), "File Type: ---");
|
||||
return(TRUE);
|
||||
} // ENDIF- Not a name of any sort?
|
||||
|
||||
if (returnval == -2)
|
||||
{
|
||||
gtk_label_set_text(GTK_LABEL(conversionbox.filedesc),
|
||||
"File Type: Not a file");
|
||||
return(TRUE);
|
||||
} // ENDIF- Not a regular file?
|
||||
|
||||
if (returnval == -3)
|
||||
{
|
||||
gtk_label_set_text(GTK_LABEL(conversionbox.filedesc),
|
||||
"File Type: Not a valid image file");
|
||||
return(TRUE);
|
||||
} // ENDIF- Not a regular file?
|
||||
|
||||
if (returnval == -4)
|
||||
{
|
||||
gtk_label_set_text(GTK_LABEL(conversionbox.filedesc),
|
||||
"File Type: Missing Table File (will rebuild)");
|
||||
return(TRUE);
|
||||
} // ENDIF- Not a regular file?
|
||||
|
||||
tempfile = IsoFileOpenForRead(gtk_entry_get_text(GTK_ENTRY(conversionbox.file)));
|
||||
sprintf(templine, "File Type: %s%s%s",
|
||||
multinames[tempfile->multi],
|
||||
tempfile->imagename,
|
||||
compressdesc[tempfile->compress]);
|
||||
gtk_label_set_text(GTK_LABEL(conversionbox.filedesc), templine);
|
||||
tempfile = IsoFileClose(tempfile);
|
||||
return(TRUE);
|
||||
} // END ConversionBoxFileEvent()
|
||||
|
||||
|
||||
void ConversionBoxRefocus()
|
||||
{
|
||||
GdkEvent event;
|
||||
|
||||
ConversionBoxFileEvent(NULL, event, NULL);
|
||||
|
||||
gtk_widget_set_sensitive(conversionbox.file, TRUE);
|
||||
gtk_widget_set_sensitive(conversionbox.selectbutton, TRUE);
|
||||
gtk_widget_set_sensitive(conversionbox.compress, TRUE);
|
||||
gtk_widget_set_sensitive(conversionbox.multi, TRUE);
|
||||
gtk_widget_set_sensitive(conversionbox.okbutton, TRUE);
|
||||
gtk_widget_set_sensitive(conversionbox.cancelbutton, TRUE);
|
||||
gtk_window_set_focus(GTK_WINDOW(conversionbox.window), conversionbox.file);
|
||||
gtk_widget_show_all(conversionbox.window);
|
||||
gtk_window_deiconify(GTK_WINDOW(conversionbox.window));
|
||||
} // END ConversionBoxRefocus()
|
||||
|
||||
|
||||
gint ConversionBoxCancelEvent(GtkWidget *widget, GdkEvent event, gpointer data)
|
||||
{
|
||||
gtk_widget_hide(conversionbox.window);
|
||||
MainBoxRefocus();
|
||||
return(TRUE);
|
||||
} // END ConversionBoxCancelEvent()
|
||||
|
||||
|
||||
gint ConversionBoxOKEvent(GtkWidget *widget, GdkEvent event, gpointer data)
|
||||
{
|
||||
char templine[256];
|
||||
char tempblock[2352];
|
||||
const char *filename;
|
||||
int compressmethod;
|
||||
int multi;
|
||||
struct IsoFile *fromfile;
|
||||
struct IsoFile *tofile;
|
||||
int i;
|
||||
off64_t endsector;
|
||||
int stop;
|
||||
int retval;
|
||||
|
||||
ConversionBoxUnfocus();
|
||||
|
||||
filename = gtk_entry_get_text(GTK_ENTRY(conversionbox.file));
|
||||
if (IsIsoFile(filename) < 0)
|
||||
{
|
||||
filename = NULL;
|
||||
MessageBoxShow("Not a valid file", 3);
|
||||
return(TRUE);
|
||||
} // ENDIF- Not an Iso File? Stop early.
|
||||
|
||||
compressmethod = gtk_combo_box_get_active(GTK_COMBO_BOX(conversionbox.compress));
|
||||
if (compressmethod > 0) compressmethod += 2;
|
||||
multi = 0;
|
||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(conversionbox.multi)) == TRUE)
|
||||
multi = 1;
|
||||
|
||||
fromfile = NULL;
|
||||
fromfile = IsoFileOpenForRead(filename);
|
||||
if (fromfile == NULL)
|
||||
{
|
||||
filename = NULL;
|
||||
MessageBoxShow("Cannot opening the source file", 3);
|
||||
return(TRUE);
|
||||
} // ENDIF- Not an Iso File? Stop early.
|
||||
|
||||
if ((compressmethod == fromfile->compress) &&
|
||||
(multi == fromfile->multi))
|
||||
{
|
||||
fromfile = IsoFileClose(fromfile);
|
||||
filename = NULL;
|
||||
MessageBoxShow("Compress/Multifile methods match - no need to convert", 3);
|
||||
return(TRUE);
|
||||
} // ENDIF- Not an Iso File? Stop early.
|
||||
|
||||
tofile = IsoFileOpenForWrite(filename,
|
||||
GetImageTypeConvertTo(fromfile->imagetype),
|
||||
multi,
|
||||
compressmethod);
|
||||
if (tofile == NULL)
|
||||
{
|
||||
fromfile = IsoFileClose(fromfile);
|
||||
filename = NULL;
|
||||
MessageBoxShow("Cannot create the new file", 3);
|
||||
return(TRUE);
|
||||
} // ENDIF- Not an Iso File? Stop early.
|
||||
|
||||
if (fromfile->multi == 1)
|
||||
{
|
||||
i = 0;
|
||||
while ((i < 10) &&
|
||||
(IsoFileSeek(fromfile, fromfile->multisectorend[i] + 1) == 0)) i++;
|
||||
endsector = fromfile->multisectorend[fromfile->multiend];
|
||||
}
|
||||
else
|
||||
{
|
||||
endsector = fromfile->filesectorsize;
|
||||
} // ENDIF- Get ending sector from multifile? (Or single file?)
|
||||
IsoFileSeek(fromfile, 0);
|
||||
|
||||
// Open Progress Bar
|
||||
sprintf(templine, "%s: %s%s -> %s%s",
|
||||
filename,
|
||||
multinames[fromfile->multi],
|
||||
compressdesc[fromfile->compress],
|
||||
multinames[tofile->multi],
|
||||
compressdesc[tofile->compress]);
|
||||
ProgressBoxStart(templine, endsector);
|
||||
|
||||
tofile->cdvdtype = fromfile->cdvdtype;
|
||||
for (i = 0; i < 2048; i++) tofile->toc[i] = fromfile->toc[i];
|
||||
|
||||
stop = 0;
|
||||
mainbox.stop = 0;
|
||||
progressbox.stop = 0;
|
||||
while ((stop == 0) && (tofile->sectorpos < endsector))
|
||||
{
|
||||
retval = IsoFileRead(fromfile, tempblock);
|
||||
if (retval < 0)
|
||||
{
|
||||
MessageBoxShow("Trouble reading source file", 3);
|
||||
stop = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
retval = IsoFileWrite(tofile, tempblock);
|
||||
if (retval < 0)
|
||||
{
|
||||
MessageBoxShow("Trouble writing new file", 3);
|
||||
stop = 1;
|
||||
} // ENDIF- Trouble writing out the next block?
|
||||
} // ENDIF- Trouble reading in the next block?
|
||||
|
||||
ProgressBoxTick(tofile->sectorpos);
|
||||
while (gtk_events_pending()) gtk_main_iteration();
|
||||
|
||||
if (mainbox.stop != 0) stop = 2;
|
||||
if (progressbox.stop != 0) stop = 2;
|
||||
} // ENDWHILE- Not stopped for some reason...
|
||||
|
||||
ProgressBoxStop();
|
||||
|
||||
if (stop == 0)
|
||||
{
|
||||
if (tofile->multi == 1) tofile->name[tofile->multipos] = '0'; // First file
|
||||
strcpy(templine, tofile->name);
|
||||
|
||||
// fromfile = IsoFileCloseAndDelete(fromfile);
|
||||
fromfile = IsoFileClose(fromfile);
|
||||
|
||||
IsoSaveTOC(tofile);
|
||||
tofile = IsoFileClose(tofile);
|
||||
gtk_entry_set_text(GTK_ENTRY(mainbox.file), templine);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
fromfile = IsoFileClose(fromfile);
|
||||
tofile = IsoFileCloseAndDelete(tofile);
|
||||
} // ENDIF- Did we succeed in the transfer?
|
||||
|
||||
if (stop != 1) ConversionBoxRefocus();
|
||||
if (stop == 0) ConversionBoxCancelEvent(widget, event, data);
|
||||
return(TRUE);
|
||||
} // END ConversionBoxOKEvent()
|
||||
|
||||
|
||||
gint ConversionBoxBrowseEvent(GtkWidget *widget, GdkEvent event, gpointer data)
|
||||
{
|
||||
ConversionBoxUnfocus();
|
||||
|
||||
// Transfer file name to file selection
|
||||
gtk_file_selection_set_filename(GTK_FILE_SELECTION(selectionbox.window),
|
||||
gtk_entry_get_text(GTK_ENTRY(conversionbox.file)));
|
||||
selectionbox.wherefrom = 3; // From the Conversion Window
|
||||
SelectionBoxRefocus();
|
||||
return(TRUE);
|
||||
} // END ConversionBoxBrowseEvent()
|
||||
|
||||
|
||||
void ConversionBoxDisplay()
|
||||
{
|
||||
GtkWidget *item;
|
||||
GtkWidget *hbox1;
|
||||
GtkWidget *vbox1;
|
||||
int nameptr;
|
||||
|
||||
conversionbox.window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
gtk_container_set_border_width(GTK_CONTAINER(conversionbox.window), 5);
|
||||
gtk_window_set_title(GTK_WINDOW(conversionbox.window), "CDVDisoEFP File Conversion");
|
||||
gtk_window_set_position(GTK_WINDOW(conversionbox.window), GTK_WIN_POS_CENTER);
|
||||
|
||||
g_signal_connect(G_OBJECT(conversionbox.window), "delete_event",
|
||||
G_CALLBACK(ConversionBoxCancelEvent), NULL);
|
||||
|
||||
vbox1 = gtk_vbox_new(FALSE, 5);
|
||||
gtk_container_add(GTK_CONTAINER(conversionbox.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("Iso File:");
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), item, FALSE, FALSE, 0);
|
||||
gtk_widget_show(item);
|
||||
item = NULL;
|
||||
|
||||
conversionbox.file = gtk_entry_new();
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), conversionbox.file, TRUE, TRUE, 0);
|
||||
gtk_widget_show(conversionbox.file);
|
||||
g_signal_connect(G_OBJECT(conversionbox.file), "changed",
|
||||
G_CALLBACK(ConversionBoxFileEvent), NULL);
|
||||
|
||||
conversionbox.selectbutton = gtk_button_new_with_label("Browse");
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), conversionbox.selectbutton, FALSE, FALSE, 0);
|
||||
gtk_widget_show(conversionbox.selectbutton);
|
||||
g_signal_connect(G_OBJECT(conversionbox.selectbutton), "clicked",
|
||||
G_CALLBACK(ConversionBoxBrowseEvent), NULL);
|
||||
hbox1 = NULL;
|
||||
|
||||
conversionbox.filedesc = gtk_label_new("File Type: ---");
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), conversionbox.filedesc, FALSE, FALSE, 0);
|
||||
gtk_widget_show(conversionbox.filedesc);
|
||||
// ConversionBoxFileEvent(NULL, 0, NULL); // Work out compromise later...
|
||||
|
||||
item = gtk_hseparator_new();
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), item, TRUE, TRUE, 0);
|
||||
gtk_widget_show(item);
|
||||
item = NULL;
|
||||
|
||||
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("Change Compression To:");
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), item, FALSE, FALSE, 0);
|
||||
gtk_widget_show(item);
|
||||
item = NULL;
|
||||
|
||||
conversionbox.compress = gtk_combo_box_new_text();
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), conversionbox.compress, FALSE, FALSE, 0);
|
||||
nameptr = 0;
|
||||
while (compressnames[nameptr] != NULL)
|
||||
{
|
||||
gtk_combo_box_append_text(GTK_COMBO_BOX(conversionbox.compress),
|
||||
compressnames[nameptr]);
|
||||
nameptr++;
|
||||
} // ENDWHILE- loading compression types into combo box
|
||||
gtk_combo_box_set_active(GTK_COMBO_BOX(conversionbox.compress), 0); // Temp Line
|
||||
gtk_widget_show(conversionbox.compress);
|
||||
hbox1 = NULL;
|
||||
|
||||
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("Multiple Files (all under 2 GB):");
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), item, FALSE, FALSE, 0);
|
||||
gtk_widget_show(item);
|
||||
item = NULL;
|
||||
|
||||
conversionbox.multi = gtk_check_button_new();
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), conversionbox.multi, FALSE, FALSE, 0);
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(conversionbox.multi), FALSE);
|
||||
gtk_widget_show(conversionbox.multi);
|
||||
hbox1 = NULL;
|
||||
|
||||
hbox1 = gtk_hbutton_box_new();
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), hbox1, TRUE, TRUE, 0);
|
||||
gtk_widget_show(hbox1);
|
||||
|
||||
conversionbox.okbutton = gtk_button_new_with_label("Change File");
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), conversionbox.okbutton, TRUE, TRUE, 0);
|
||||
gtk_widget_show(conversionbox.okbutton);
|
||||
g_signal_connect(G_OBJECT(conversionbox.okbutton), "clicked",
|
||||
G_CALLBACK(ConversionBoxOKEvent), NULL);
|
||||
|
||||
conversionbox.cancelbutton = gtk_button_new_with_label("Cancel");
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), conversionbox.cancelbutton, TRUE, TRUE, 0);
|
||||
gtk_widget_show(conversionbox.cancelbutton);
|
||||
g_signal_connect(G_OBJECT(conversionbox.cancelbutton), "clicked",
|
||||
G_CALLBACK(ConversionBoxCancelEvent), NULL);
|
||||
hbox1 = NULL;
|
||||
vbox1 = NULL;
|
||||
} // END ConversionBoxDisplay()
|
|
@ -1,272 +0,0 @@
|
|||
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
|
||||
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
|
||||
|
||||
<glade-interface>
|
||||
<requires lib="gnome"/>
|
||||
|
||||
<widget class="GtkWindow" id="dotwindow">
|
||||
<property name="border_width">5</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes">CDVDiso File Conversion</property>
|
||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||
<property name="window_position">GTK_WIN_POS_CENTER</property>
|
||||
<property name="modal">False</property>
|
||||
<property name="resizable">True</property>
|
||||
<property name="destroy_with_parent">False</property>
|
||||
<property name="decorated">True</property>
|
||||
<property name="skip_taskbar_hint">False</property>
|
||||
<property name="skip_pager_hint">False</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
|
||||
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Iso File:</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">5</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkEntry" id="dotfile">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">True</property>
|
||||
<property name="visibility">True</property>
|
||||
<property name="max_length">0</property>
|
||||
<property name="text" translatable="yes"></property>
|
||||
<property name="has_frame">True</property>
|
||||
<property name="invisible_char" translatable="yes">*</property>
|
||||
<property name="activates_default">False</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="dotselectbutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Browse</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="dotdesc">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">File Type: ---</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHSeparator" id="hseparator1">
|
||||
<property name="visible">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox2">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label3">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Change Compression To:</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">5</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkComboBoxEntry" id="dotcompress">
|
||||
<property name="visible">True</property>
|
||||
<property name="items" translatable="yes">None
|
||||
GZip (for speed)
|
||||
BZip2 (for speed)
|
||||
BZip2 (for size)
|
||||
</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">5</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox3">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label4">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Multiple Files (all under 2 GB): </property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="dotmulti">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes"></property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHButtonBox" id="hbuttonbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_DEFAULT_STYLE</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="dotokbutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Change File</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="dotcancelbutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Cancel</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
</glade-interface>
|
|
@ -1,44 +0,0 @@
|
|||
/* conversionbox.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 CONVERSIONBOX_H
|
||||
#define CONVERSIONBOX_H
|
||||
|
||||
#include <gtk/gtkwidget.h>
|
||||
|
||||
struct ConversionBoxData
|
||||
{
|
||||
GtkWidget *window; // GtkWindow
|
||||
GtkWidget *file; // GtkEntry
|
||||
GtkWidget *selectbutton; // GtkButton
|
||||
GtkWidget *filedesc; // GtkLabel
|
||||
GtkWidget *compress; // GtkComboBox
|
||||
GtkWidget *multi; // GtkCheckButton
|
||||
GtkWidget *okbutton; // GtkButton
|
||||
GtkWidget *cancelbutton; // GtkButton
|
||||
};
|
||||
|
||||
extern struct ConversionBoxData conversionbox;
|
||||
|
||||
extern void ConversionBoxDestroy();
|
||||
extern void ConversionBoxRefocus();
|
||||
extern void ConversionBoxDisplay();
|
||||
|
||||
#endif /* CONVERSIONBOX_H */
|
|
@ -1,415 +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.
|
||||
#include "logfile.h"
|
||||
#include "conf.h"
|
||||
#include "CD.h"
|
||||
#include "DVD.h"
|
||||
#include "device.h"
|
||||
// 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()
|
||||
{
|
||||
// s32 s32result;
|
||||
int zerospeed;
|
||||
|
||||
zerospeed = 0;
|
||||
|
||||
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,55 +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,470 +0,0 @@
|
|||
/* devicebox.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/gtkbutton.h> // gtk_button_new_with_label()
|
||||
#include <gtk/gtkcombobox.h> // gtk_combo_box_new()
|
||||
#include <gtk/gtkcheckbutton.h> // gtk_check_button_new()
|
||||
#include <gtk/gtkcontainer.h> // gtk_container_add()
|
||||
#include <gtk/gtkentry.h> // gtk_entry_new()
|
||||
#include <gtk/gtkfilesel.h> // gtk_file_selection_set_filename()
|
||||
#include <gtk/gtkhbbox.h> // gtk_hbutton_box_new()
|
||||
#include <gtk/gtkhbox.h> // gtk_hbox_new()
|
||||
#include <gtk/gtkhseparator.h> // gtk_hseparator_new()
|
||||
#include <gtk/gtklabel.h> // gtk_label_new()
|
||||
#include <gtk/gtkmain.h> // gtk_main_iteration()
|
||||
#include <gtk/gtktogglebutton.h> // gtk_toggle_button_get_active()
|
||||
#include <gtk/gtkvbox.h> // gtk_vbox_new()
|
||||
#include <gtk/gtkwindow.h> // gtk_window_new()
|
||||
|
||||
#define CDVDdefs
|
||||
#include "PS2Edefs.h"
|
||||
|
||||
#include "conf.h"
|
||||
#include "device.h"
|
||||
#include "isofile.h"
|
||||
#include "isocompress.h" // compressdesc[]
|
||||
// #include "imagetype.h" // imagedata[].name
|
||||
#include "multifile.h" // multinames[]
|
||||
#include "toc.h"
|
||||
#include "progressbox.h"
|
||||
#include "messagebox.h"
|
||||
#include "selectionbox.h"
|
||||
#include "mainbox.h"
|
||||
#include "devicebox.h"
|
||||
|
||||
|
||||
struct DeviceBoxData devicebox;
|
||||
|
||||
|
||||
void DeviceBoxDestroy()
|
||||
{
|
||||
if (devicebox.window != NULL)
|
||||
{
|
||||
gtk_widget_destroy(devicebox.window);
|
||||
devicebox.window = NULL;
|
||||
devicebox.device = NULL;
|
||||
devicebox.devicedesc = NULL;
|
||||
devicebox.file = NULL;
|
||||
devicebox.selectbutton = NULL;
|
||||
devicebox.filedesc = NULL;
|
||||
devicebox.compress = NULL;
|
||||
devicebox.multi = NULL;
|
||||
devicebox.okbutton = NULL;
|
||||
devicebox.cancelbutton = NULL;
|
||||
} // ENDIF- Do we have a Main Window still?
|
||||
} // END DeviceBoxDestroy()
|
||||
|
||||
|
||||
void DeviceBoxUnfocus()
|
||||
{
|
||||
gtk_widget_set_sensitive(devicebox.device, FALSE);
|
||||
gtk_widget_set_sensitive(devicebox.file, FALSE);
|
||||
gtk_widget_set_sensitive(devicebox.selectbutton, FALSE);
|
||||
gtk_widget_set_sensitive(devicebox.compress, FALSE);
|
||||
gtk_widget_set_sensitive(devicebox.multi, FALSE);
|
||||
gtk_widget_set_sensitive(devicebox.okbutton, FALSE);
|
||||
gtk_widget_set_sensitive(devicebox.cancelbutton, FALSE);
|
||||
gtk_widget_hide(devicebox.window);
|
||||
// gtk_window_iconify(GTK_WINDOW(devicebox.window));
|
||||
} // END DeviceBoxUnfocus()
|
||||
|
||||
|
||||
gint DeviceBoxDeviceEvent(GtkWidget *widget, GdkEvent event, gpointer data)
|
||||
{
|
||||
struct stat filestat;
|
||||
int returnval;
|
||||
|
||||
returnval = stat(gtk_entry_get_text(GTK_ENTRY(devicebox.device)), &filestat);
|
||||
if (returnval == -1)
|
||||
{
|
||||
gtk_label_set_text(GTK_LABEL(devicebox.devicedesc), "Device Type: ---");
|
||||
return(TRUE);
|
||||
} // ENDIF- Not a name of any sort?
|
||||
|
||||
if (S_ISDIR(filestat.st_mode) != 0)
|
||||
{
|
||||
gtk_label_set_text(GTK_LABEL(devicebox.devicedesc), "Device Type: Not a device");
|
||||
return(TRUE);
|
||||
} // ENDIF- Not a regular file?
|
||||
|
||||
gtk_label_set_text(GTK_LABEL(devicebox.devicedesc), "Device Type: Device Likely");
|
||||
return(TRUE);
|
||||
} // END DeviceBoxDeviceEvent()
|
||||
|
||||
|
||||
gint DeviceBoxFileEvent(GtkWidget *widget, GdkEvent event, gpointer data)
|
||||
{
|
||||
int returnval;
|
||||
char templine[256];
|
||||
struct IsoFile *tempfile;
|
||||
|
||||
returnval = IsIsoFile(gtk_entry_get_text(GTK_ENTRY(devicebox.file)));
|
||||
if (returnval == -1)
|
||||
{
|
||||
gtk_label_set_text(GTK_LABEL(devicebox.filedesc), "File Type: ---");
|
||||
return(TRUE);
|
||||
} // ENDIF- Not a name of any sort?
|
||||
|
||||
if (returnval == -2)
|
||||
{
|
||||
gtk_label_set_text(GTK_LABEL(devicebox.filedesc), "File Type: Not a file");
|
||||
return(TRUE);
|
||||
} // ENDIF- Not a regular file?
|
||||
|
||||
if (returnval == -3)
|
||||
{
|
||||
gtk_label_set_text(GTK_LABEL(devicebox.filedesc), "File Type: Not a valid image file");
|
||||
return(TRUE);
|
||||
} // ENDIF- Not an image file?
|
||||
|
||||
if (returnval == -4)
|
||||
{
|
||||
gtk_label_set_text(GTK_LABEL(devicebox.filedesc), "File Type: Missing Table File (will rebuild)");
|
||||
return(TRUE);
|
||||
} // ENDIF- Not a regular file?
|
||||
|
||||
tempfile = IsoFileOpenForRead(gtk_entry_get_text(GTK_ENTRY(devicebox.file)));
|
||||
sprintf(templine, "File Type: %s%s%s",
|
||||
multinames[tempfile->multi],
|
||||
tempfile->imagename,
|
||||
compressdesc[tempfile->compress]);
|
||||
gtk_label_set_text(GTK_LABEL(devicebox.filedesc), templine);
|
||||
tempfile = IsoFileClose(tempfile);
|
||||
return(TRUE);
|
||||
} // END DeviceBoxFileEvent()
|
||||
|
||||
|
||||
void DeviceBoxRefocus()
|
||||
{
|
||||
GdkEvent event;
|
||||
|
||||
DeviceBoxDeviceEvent(NULL, event, NULL);
|
||||
DeviceBoxFileEvent(NULL, event, NULL);
|
||||
|
||||
gtk_widget_set_sensitive(devicebox.device, TRUE);
|
||||
gtk_widget_set_sensitive(devicebox.file, TRUE);
|
||||
gtk_widget_set_sensitive(devicebox.selectbutton, TRUE);
|
||||
gtk_widget_set_sensitive(devicebox.compress, TRUE);
|
||||
gtk_widget_set_sensitive(devicebox.multi, TRUE);
|
||||
gtk_widget_set_sensitive(devicebox.okbutton, TRUE);
|
||||
gtk_widget_set_sensitive(devicebox.cancelbutton, TRUE);
|
||||
gtk_window_set_focus(GTK_WINDOW(devicebox.window), devicebox.file);
|
||||
gtk_widget_show_all(devicebox.window);
|
||||
gtk_window_deiconify(GTK_WINDOW(devicebox.window));
|
||||
} // END DeviceBoxRefocus()
|
||||
|
||||
|
||||
gint DeviceBoxCancelEvent(GtkWidget *widget, GdkEvent event, gpointer data)
|
||||
{
|
||||
gtk_widget_hide(devicebox.window);
|
||||
MainBoxRefocus();
|
||||
return(TRUE);
|
||||
} // END DeviceBoxCancelEvent()
|
||||
|
||||
|
||||
gint DeviceBoxOKEvent(GtkWidget *widget, GdkEvent event, gpointer data)
|
||||
{
|
||||
char templine[256];
|
||||
u8 tempbuffer[2352];
|
||||
struct IsoFile *tofile;
|
||||
const char *tempdevice;
|
||||
s32 retval;
|
||||
cdvdTD cdvdtd;
|
||||
int stop;
|
||||
int compressmethod;
|
||||
int multi;
|
||||
int imagetype;
|
||||
int i;
|
||||
|
||||
DeviceBoxUnfocus();
|
||||
|
||||
tempdevice = gtk_entry_get_text(GTK_ENTRY(devicebox.device));
|
||||
strcpy(conf.devicename, tempdevice); // Temporarily put in new device name
|
||||
tempdevice = NULL;
|
||||
retval = DeviceOpen();
|
||||
if (retval != 0)
|
||||
{
|
||||
DeviceClose();
|
||||
MessageBoxShow("Could not open the device", 2);
|
||||
return(TRUE);
|
||||
} // ENDIF- Trouble opening device? Abort here.
|
||||
|
||||
DeviceTrayStatus();
|
||||
retval = DiscInserted();
|
||||
if (retval != 0)
|
||||
{
|
||||
DeviceClose();
|
||||
MessageBoxShow("No disc in the device\r\nPlease put a disc in and try again.", 2);
|
||||
return(TRUE);
|
||||
} // ENDIF- Trouble opening device? Abort here.
|
||||
|
||||
retval = DeviceGetTD(0, &cdvdtd); // Fish for Ending Sector
|
||||
if (retval < 0)
|
||||
{
|
||||
DeviceClose();
|
||||
MessageBoxShow("Could not retrieve disc sector size", 2);
|
||||
return(TRUE);
|
||||
} // ENDIF- Trouble getting disc sector count?
|
||||
|
||||
compressmethod = gtk_combo_box_get_active(GTK_COMBO_BOX(devicebox.compress));
|
||||
if (compressmethod > 0) compressmethod += 2;
|
||||
multi = 0;
|
||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(devicebox.multi)) == TRUE)
|
||||
multi = 1;
|
||||
|
||||
imagetype = 0;
|
||||
if ((disctype != CDVD_TYPE_PS2DVD) &&
|
||||
(disctype != CDVD_TYPE_DVDV)) imagetype = 8;
|
||||
|
||||
tofile = IsoFileOpenForWrite(gtk_entry_get_text(GTK_ENTRY(devicebox.file)),
|
||||
imagetype,
|
||||
multi,
|
||||
compressmethod);
|
||||
if (tofile == NULL)
|
||||
{
|
||||
DeviceClose();
|
||||
MessageBoxShow("Could not create the new ISO file", 2);
|
||||
return(TRUE);
|
||||
} // ENDIF- Trouble opening the ISO file?
|
||||
|
||||
// Open Progress Bar
|
||||
sprintf(templine, "%s -> %s",
|
||||
gtk_entry_get_text(GTK_ENTRY(devicebox.device)), tofile->name);
|
||||
ProgressBoxStart(templine, (off64_t) cdvdtd.lsn);
|
||||
|
||||
tofile->cdvdtype = disctype;
|
||||
for (i = 0; i < 2048; i++) tofile->toc[i] = tocbuffer[i];
|
||||
|
||||
stop = 0;
|
||||
mainbox.stop = 0;
|
||||
progressbox.stop = 0;
|
||||
while ((stop == 0) && (tofile->sectorpos < cdvdtd.lsn))
|
||||
{
|
||||
if (imagetype == 0)
|
||||
{
|
||||
retval = DeviceReadTrack((u32) tofile->sectorpos,
|
||||
CDVD_MODE_2048,
|
||||
tempbuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
retval = DeviceReadTrack((u32) tofile->sectorpos,
|
||||
CDVD_MODE_2352,
|
||||
tempbuffer);
|
||||
} // ENDIF- Are we reading a DVD sector? (Or a CD sector?)
|
||||
if (retval < 0)
|
||||
{
|
||||
for (i = 0; i < 2352; i++)
|
||||
{
|
||||
tempbuffer[i] = 0;
|
||||
} // NEXT i- Zeroing the buffer
|
||||
} // ENDIF- Trouble reading next block?
|
||||
retval = IsoFileWrite(tofile, tempbuffer);
|
||||
if (retval < 0)
|
||||
{
|
||||
MessageBoxShow("Trouble writing new file", 3);
|
||||
stop = 1;
|
||||
} // ENDIF- Trouble writing out the next block?
|
||||
|
||||
ProgressBoxTick(tofile->sectorpos);
|
||||
while (gtk_events_pending()) gtk_main_iteration();
|
||||
|
||||
if (mainbox.stop != 0) stop = 2;
|
||||
if (progressbox.stop != 0) stop = 2;
|
||||
} // ENDWHILE- No reason found to stop...
|
||||
|
||||
ProgressBoxStop();
|
||||
|
||||
if (stop == 0)
|
||||
{
|
||||
if (tofile->multi == 1) tofile->name[tofile->multipos] = '0'; // First file
|
||||
strcpy(templine, tofile->name);
|
||||
} // ENDIF- Did we succeed with the transfer?
|
||||
|
||||
DeviceClose();
|
||||
if (stop == 0)
|
||||
{
|
||||
IsoSaveTOC(tofile);
|
||||
tofile = IsoFileClose(tofile);
|
||||
gtk_entry_set_text(GTK_ENTRY(mainbox.file), templine);
|
||||
}
|
||||
else
|
||||
{
|
||||
tofile = IsoFileCloseAndDelete(tofile);
|
||||
} // ENDIF- (Failed to complete writing file? Get rid of the garbage files.)
|
||||
|
||||
if (stop != 1) DeviceBoxRefocus();
|
||||
if (stop == 0) DeviceBoxCancelEvent(widget, event, data);
|
||||
return(TRUE);
|
||||
} // END DeviceBoxOKEvent()
|
||||
|
||||
|
||||
gint DeviceBoxBrowseEvent(GtkWidget *widget, GdkEvent event, gpointer data)
|
||||
{
|
||||
DeviceBoxUnfocus();
|
||||
|
||||
// Transfer file name to file selection
|
||||
gtk_file_selection_set_filename(GTK_FILE_SELECTION(selectionbox.window),
|
||||
gtk_entry_get_text(GTK_ENTRY(devicebox.file)));
|
||||
selectionbox.wherefrom = 2; // From the Device Window
|
||||
SelectionBoxRefocus();
|
||||
return(TRUE);
|
||||
} // END DeviceBoxBrowseEvent()
|
||||
|
||||
|
||||
void DeviceBoxDisplay()
|
||||
{
|
||||
GtkWidget *item;
|
||||
GtkWidget *hbox1;
|
||||
GtkWidget *vbox1;
|
||||
int nameptr;
|
||||
|
||||
devicebox.window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
gtk_container_set_border_width(GTK_CONTAINER(devicebox.window), 5);
|
||||
gtk_window_set_title(GTK_WINDOW(devicebox.window), "CDVDisoEFP ISO Creation");
|
||||
gtk_window_set_position(GTK_WINDOW(devicebox.window), GTK_WIN_POS_CENTER);
|
||||
|
||||
g_signal_connect(G_OBJECT(devicebox.window), "delete_event",
|
||||
G_CALLBACK(DeviceBoxCancelEvent), NULL);
|
||||
|
||||
vbox1 = gtk_vbox_new(FALSE, 5);
|
||||
gtk_container_add(GTK_CONTAINER(devicebox.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("Source CD/DVD Device:");
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), item, FALSE, FALSE, 0);
|
||||
gtk_widget_show(item);
|
||||
item = NULL;
|
||||
|
||||
devicebox.device = gtk_entry_new();
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), devicebox.device, TRUE, TRUE, 0);
|
||||
gtk_widget_show(devicebox.device);
|
||||
g_signal_connect(G_OBJECT(devicebox.device), "changed",
|
||||
G_CALLBACK(DeviceBoxDeviceEvent), NULL);
|
||||
hbox1 = NULL;
|
||||
|
||||
devicebox.devicedesc = gtk_label_new("Device Type: ---");
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), devicebox.devicedesc, FALSE, FALSE, 0);
|
||||
gtk_widget_show(devicebox.devicedesc);
|
||||
|
||||
item = gtk_hseparator_new();
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), item, TRUE, TRUE, 0);
|
||||
gtk_widget_show(item);
|
||||
item = NULL;
|
||||
|
||||
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("Iso File:");
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), item, FALSE, FALSE, 0);
|
||||
gtk_widget_show(item);
|
||||
item = NULL;
|
||||
|
||||
devicebox.file = gtk_entry_new();
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), devicebox.file, TRUE, TRUE, 0);
|
||||
gtk_widget_show(devicebox.file);
|
||||
g_signal_connect(G_OBJECT(devicebox.file), "changed",
|
||||
G_CALLBACK(DeviceBoxFileEvent), NULL);
|
||||
|
||||
devicebox.selectbutton = gtk_button_new_with_label("Browse");
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), devicebox.selectbutton, FALSE, FALSE, 0);
|
||||
gtk_widget_show(devicebox.selectbutton);
|
||||
g_signal_connect(G_OBJECT(devicebox.selectbutton), "clicked",
|
||||
G_CALLBACK(DeviceBoxBrowseEvent), NULL);
|
||||
hbox1 = NULL;
|
||||
|
||||
devicebox.filedesc = gtk_label_new("File Type: ---");
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), devicebox.filedesc, FALSE, FALSE, 0);
|
||||
gtk_widget_show(devicebox.filedesc);
|
||||
|
||||
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("New File Compression:");
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), item, FALSE, FALSE, 0);
|
||||
gtk_widget_show(item);
|
||||
item = NULL;
|
||||
|
||||
devicebox.compress = gtk_combo_box_new_text();
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), devicebox.compress, FALSE, FALSE, 0);
|
||||
nameptr = 0;
|
||||
while (compressnames[nameptr] != NULL)
|
||||
{
|
||||
gtk_combo_box_append_text(GTK_COMBO_BOX(devicebox.compress),
|
||||
compressnames[nameptr]);
|
||||
nameptr++;
|
||||
} // ENDWHILE- loading compression types into combo box
|
||||
gtk_combo_box_set_active(GTK_COMBO_BOX(devicebox.compress), 0); // Temp Line
|
||||
gtk_widget_show(devicebox.compress);
|
||||
hbox1 = NULL;
|
||||
|
||||
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("Multiple Files (all under 2 GB):");
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), item, FALSE, FALSE, 0);
|
||||
gtk_widget_show(item);
|
||||
item = NULL;
|
||||
|
||||
devicebox.multi = gtk_check_button_new();
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), devicebox.multi, FALSE, FALSE, 0);
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(devicebox.multi), FALSE);
|
||||
gtk_widget_show(devicebox.multi);
|
||||
hbox1 = NULL;
|
||||
|
||||
hbox1 = gtk_hbutton_box_new();
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), hbox1, TRUE, TRUE, 0);
|
||||
gtk_widget_show(hbox1);
|
||||
|
||||
devicebox.okbutton = gtk_button_new_with_label("Make File");
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), devicebox.okbutton, TRUE, TRUE, 0);
|
||||
gtk_widget_show(devicebox.okbutton);
|
||||
g_signal_connect(G_OBJECT(devicebox.okbutton), "clicked",
|
||||
G_CALLBACK(DeviceBoxOKEvent), NULL);
|
||||
|
||||
devicebox.cancelbutton = gtk_button_new_with_label("Cancel");
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), devicebox.cancelbutton, TRUE, TRUE, 0);
|
||||
gtk_widget_show(devicebox.cancelbutton);
|
||||
g_signal_connect(G_OBJECT(devicebox.cancelbutton), "clicked",
|
||||
G_CALLBACK(DeviceBoxCancelEvent), NULL);
|
||||
hbox1 = NULL;
|
||||
vbox1 = NULL;
|
||||
|
||||
// Device text not set until now to get the correct description.
|
||||
gtk_entry_set_text(GTK_ENTRY(devicebox.device), conf.devicename);
|
||||
|
||||
DeviceInit(); // Initialize device access
|
||||
} // END DeviceBoxDisplay()
|
|
@ -1,345 +0,0 @@
|
|||
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
|
||||
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
|
||||
|
||||
<glade-interface>
|
||||
|
||||
<widget class="GtkWindow" id="dotwindow">
|
||||
<property name="border_width">5</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes">CDVDiso ISO Creation</property>
|
||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||
<property name="window_position">GTK_WIN_POS_CENTER</property>
|
||||
<property name="modal">False</property>
|
||||
<property name="resizable">True</property>
|
||||
<property name="destroy_with_parent">False</property>
|
||||
<property name="decorated">True</property>
|
||||
<property name="skip_taskbar_hint">False</property>
|
||||
<property name="skip_pager_hint">False</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
|
||||
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Source CD/DVD Device:</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">5</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkEntry" id="dotdevice">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">True</property>
|
||||
<property name="visibility">True</property>
|
||||
<property name="max_length">0</property>
|
||||
<property name="text" translatable="yes">/dev/dvd</property>
|
||||
<property name="has_frame">True</property>
|
||||
<property name="invisible_char" translatable="yes">*</property>
|
||||
<property name="activates_default">False</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">5</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="dotdevicedesc">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Device Type: ---</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHSeparator" id="hseparator1">
|
||||
<property name="visible">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox2">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label3">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Iso File:</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">5</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkEntry" id="dotfile">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">True</property>
|
||||
<property name="visibility">True</property>
|
||||
<property name="max_length">0</property>
|
||||
<property name="text" translatable="yes"></property>
|
||||
<property name="has_frame">True</property>
|
||||
<property name="invisible_char" translatable="yes">*</property>
|
||||
<property name="activates_default">False</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">5</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="dotselectbutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Browse</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">5</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="dotfiledesc">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">File Type: ---</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox3">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label5">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">New File Compression:</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">5</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkComboBoxEntry" id="dotcompress">
|
||||
<property name="visible">True</property>
|
||||
<property name="items" translatable="yes">None
|
||||
GZip (for speed)
|
||||
BZip2 (for speed)
|
||||
BZip2 (for size)
|
||||
</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">5</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox4">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label6">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Multiple Files (all under 2GB):</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">5</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="dotmulti">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes"></property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHButtonBox" id="hbuttonbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_DEFAULT_STYLE</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="dotokbutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Make File</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="dotcancelbutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Cancel</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
</glade-interface>
|
|
@ -1,47 +0,0 @@
|
|||
/* devicebox.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 DEVICEBOX_H
|
||||
#define DEVICEBOX_H
|
||||
|
||||
#include <gtk/gtkwidget.h>
|
||||
|
||||
struct DeviceBoxData
|
||||
{
|
||||
GtkWidget *window; // GtkWindow
|
||||
GtkWidget *device; // GtkEntry
|
||||
GtkWidget *devicedesc; // GtkLabel
|
||||
GtkWidget *file; // GtkEntry
|
||||
GtkWidget *selectbutton; // GtkButton
|
||||
GtkWidget *filedesc; // GtkLabel
|
||||
GtkWidget *compress; // GtkComboBox
|
||||
GtkWidget *multi; // GtkCheckButton
|
||||
GtkWidget *okbutton; // GtkButton
|
||||
GtkWidget *cancelbutton; // GtkButton
|
||||
};
|
||||
|
||||
extern struct DeviceBoxData devicebox;
|
||||
|
||||
extern void DeviceBoxDestroy();
|
||||
// extern void DeviceBoxUnfocus();
|
||||
extern void DeviceBoxRefocus();
|
||||
extern void DeviceBoxDisplay();
|
||||
|
||||
#endif /* DEVICEBOX_H */
|
|
@ -1,71 +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/gtkmain.h> // gtk_init(), gtk_main(), gtk_main_quit()
|
||||
#include <gtk/gtkwidget.h> // gtk_widget_show_all()
|
||||
|
||||
#include "logfile.h"
|
||||
#include "conf.h"
|
||||
#include "aboutbox.h"
|
||||
#include "mainbox.h"
|
||||
#include "devicebox.h"
|
||||
#include "selectionbox.h"
|
||||
#include "progressbox.h"
|
||||
#include "messagebox.h"
|
||||
#include "conversionbox.h"
|
||||
#include "interface.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();
|
||||
DeviceBoxDisplay();
|
||||
ConversionBoxDisplay();
|
||||
ProgressBoxDisplay();
|
||||
MessageBoxDisplay();
|
||||
SelectionBoxDisplay();
|
||||
|
||||
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,26 +0,0 @@
|
|||
/* interface.h
|
||||
* Copyright (C) 2002-2004 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 INTERFACE_H
|
||||
#define INTERFACE_H
|
||||
|
||||
// Place holder... for now
|
||||
|
||||
#endif /* INTERFACE_H */
|
|
@ -1,83 +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,35 +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,317 +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 <gtk/gtkbutton.h> // gtk_button_new_with_label()
|
||||
#include <gtk/gtkcheckbutton.h> // gtk_check_button_new_with_label()
|
||||
#include <gtk/gtkcontainer.h> // gtk_container_add()
|
||||
#include <gtk/gtkentry.h> // gtk_entry_new()
|
||||
#include <gtk/gtkfilesel.h> // gtk_file_selection_set_filename()
|
||||
#include <gtk/gtkhbbox.h> // gtk_hbutton_box_new()
|
||||
#include <gtk/gtkhbox.h> // gtk_hbox_new()
|
||||
#include <gtk/gtklabel.h> // gtk_label_new()
|
||||
#include <gtk/gtkmain.h> // gtk_init(), gtk_main(), gtk_main_quit()
|
||||
#include <gtk/gtktogglebutton.h> // gtk_toggle_button_set_active(), (_get_)
|
||||
#include <gtk/gtkvbox.h> // gtk_vbox_new()
|
||||
#include <gtk/gtkwindow.h> // gtk_window_new()
|
||||
#include "conf.h"
|
||||
#include "isofile.h"
|
||||
#include "isocompress.h" // compressdesc[]
|
||||
// #include "imagetype.h" // imagedata[].name
|
||||
#include "multifile.h" // multinames[]
|
||||
#include "tablerebuild.h" // IsoTableRebuild()
|
||||
#include "devicebox.h"
|
||||
#include "conversionbox.h"
|
||||
#include "progressbox.h"
|
||||
#include "messagebox.h"
|
||||
#include "selectionbox.h"
|
||||
#include "mainbox.h"
|
||||
|
||||
struct MainBoxData mainbox;
|
||||
|
||||
void MainBoxDestroy()
|
||||
{
|
||||
if (mainbox.window != NULL)
|
||||
{
|
||||
gtk_widget_destroy(mainbox.window);
|
||||
mainbox.window = NULL;
|
||||
mainbox.file = NULL;
|
||||
mainbox.selectbutton = NULL;
|
||||
mainbox.desc = NULL;
|
||||
mainbox.startcheck = NULL;
|
||||
mainbox.restartcheck = NULL;
|
||||
mainbox.okbutton = NULL;
|
||||
mainbox.devbutton = NULL;
|
||||
mainbox.convbutton = NULL;
|
||||
} // ENDIF- Do we have a Main Window still?
|
||||
} // END MainBoxDestroy()
|
||||
|
||||
void MainBoxUnfocus()
|
||||
{
|
||||
gtk_widget_set_sensitive(mainbox.file, FALSE);
|
||||
gtk_widget_set_sensitive(mainbox.selectbutton, FALSE);
|
||||
gtk_widget_set_sensitive(mainbox.startcheck, FALSE);
|
||||
gtk_widget_set_sensitive(mainbox.restartcheck, FALSE);
|
||||
gtk_widget_set_sensitive(mainbox.okbutton, FALSE);
|
||||
gtk_widget_set_sensitive(mainbox.devbutton, FALSE);
|
||||
gtk_widget_set_sensitive(mainbox.convbutton, FALSE);
|
||||
gtk_window_iconify(GTK_WINDOW(mainbox.window));
|
||||
} // END MainBoxUnfocus()
|
||||
|
||||
gint MainBoxFileEvent(GtkWidget *widget, GdkEvent event, gpointer data)
|
||||
{
|
||||
int returnval;
|
||||
char templine[256];
|
||||
struct IsoFile *tempfile;
|
||||
returnval = IsIsoFile(gtk_entry_get_text(GTK_ENTRY(mainbox.file)));
|
||||
if (returnval == -1)
|
||||
{
|
||||
gtk_label_set_text(GTK_LABEL(mainbox.desc), "File Type: ---");
|
||||
return(TRUE);
|
||||
} // ENDIF- Not a name of any sort?
|
||||
if (returnval == -2)
|
||||
{
|
||||
gtk_label_set_text(GTK_LABEL(mainbox.desc), "File Type: Not a file");
|
||||
return(TRUE);
|
||||
} // ENDIF- Not a regular file?
|
||||
|
||||
if (returnval == -3)
|
||||
{
|
||||
gtk_label_set_text(GTK_LABEL(mainbox.desc), "File Type: Not a valid image file");
|
||||
return(TRUE);
|
||||
} // ENDIF- Not an Image file?
|
||||
if (returnval == -4)
|
||||
{
|
||||
gtk_label_set_text(GTK_LABEL(mainbox.desc), "File Type: Missing Table File (will rebuild)");
|
||||
return(TRUE);
|
||||
} // ENDIF- Missing Compression seek table?
|
||||
|
||||
tempfile = IsoFileOpenForRead(gtk_entry_get_text(GTK_ENTRY(mainbox.file)));
|
||||
sprintf(templine, "File Type: %s%s%s",
|
||||
multinames[tempfile->multi],
|
||||
tempfile->imagename,
|
||||
compressdesc[tempfile->compress]);
|
||||
gtk_label_set_text(GTK_LABEL(mainbox.desc), templine);
|
||||
tempfile = IsoFileClose(tempfile);
|
||||
return(TRUE);
|
||||
} // END MainBoxFileEvent()
|
||||
|
||||
void MainBoxRefocus()
|
||||
{
|
||||
GdkEvent event;
|
||||
|
||||
MainBoxFileEvent(NULL, event, NULL);
|
||||
|
||||
gtk_widget_set_sensitive(mainbox.file, TRUE);
|
||||
gtk_widget_set_sensitive(mainbox.selectbutton, TRUE);
|
||||
gtk_widget_set_sensitive(mainbox.startcheck, TRUE);
|
||||
gtk_widget_set_sensitive(mainbox.restartcheck, TRUE);
|
||||
gtk_widget_set_sensitive(mainbox.okbutton, TRUE);
|
||||
gtk_widget_set_sensitive(mainbox.devbutton, TRUE);
|
||||
gtk_widget_set_sensitive(mainbox.convbutton, TRUE);
|
||||
gtk_window_set_focus(GTK_WINDOW(mainbox.window), mainbox.file);
|
||||
gtk_window_deiconify(GTK_WINDOW(mainbox.window));
|
||||
} // END MainBoxRefocus()
|
||||
|
||||
gint MainBoxCancelEvent(GtkWidget *widget, GdkEvent event, gpointer data)
|
||||
{
|
||||
mainbox.stop = 1; // Halt all long processess...
|
||||
MessageBoxDestroy();
|
||||
SelectionBoxDestroy();
|
||||
ProgressBoxDestroy();
|
||||
ConversionBoxDestroy();
|
||||
DeviceBoxDestroy();
|
||||
MainBoxDestroy();
|
||||
|
||||
gtk_main_quit();
|
||||
return(TRUE);
|
||||
} // END MainBoxCancelEvent()
|
||||
|
||||
gint MainBoxOKEvent(GtkWidget *widget, GdkEvent event, gpointer data)
|
||||
{
|
||||
const char *tempisoname;
|
||||
|
||||
MainBoxUnfocus();
|
||||
|
||||
tempisoname = gtk_entry_get_text(GTK_ENTRY(mainbox.file));
|
||||
if (*(tempisoname) != 0)
|
||||
{
|
||||
if (IsIsoFile(tempisoname) == -4)
|
||||
{
|
||||
IsoTableRebuild(tempisoname);
|
||||
MainBoxRefocus();
|
||||
return(TRUE);
|
||||
} // ENDIF- Do we need to rebuild an image file's index before using it?
|
||||
|
||||
if (IsIsoFile(tempisoname) < 0)
|
||||
{
|
||||
tempisoname = NULL;
|
||||
MainBoxRefocus();
|
||||
MessageBoxShow("Not a Valid Image File.", 1);
|
||||
return(TRUE);
|
||||
} // ENDIF- Not an ISO file? Message and Stop here.
|
||||
} // ENDIF- Is there an ISO file to check out?
|
||||
|
||||
strcpy(conf.isoname, tempisoname);
|
||||
tempisoname = NULL;
|
||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mainbox.startcheck)) == FALSE)
|
||||
{
|
||||
conf.startconfigure = 0; // FALSE
|
||||
}
|
||||
else
|
||||
{
|
||||
conf.startconfigure = 1; // TRUE
|
||||
} // ENDIF- Was this check button turned off?
|
||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mainbox.restartcheck)) == FALSE)
|
||||
{
|
||||
conf.restartconfigure = 0; // FALSE
|
||||
}
|
||||
else
|
||||
{
|
||||
conf.restartconfigure = 1; // TRUE
|
||||
} // ENDIF- Was this check button turned off?
|
||||
SaveConf();
|
||||
MainBoxCancelEvent(widget, event, data);
|
||||
return(TRUE);
|
||||
} // END MainBoxOKEvent()
|
||||
|
||||
gint MainBoxBrowseEvent(GtkWidget *widget, GdkEvent event, gpointer data)
|
||||
{
|
||||
MainBoxUnfocus();
|
||||
gtk_file_selection_set_filename(GTK_FILE_SELECTION(selectionbox.window),
|
||||
gtk_entry_get_text(GTK_ENTRY(mainbox.file)));
|
||||
selectionbox.wherefrom = 1; // From the Main Window
|
||||
SelectionBoxRefocus();
|
||||
return(TRUE);
|
||||
} // END MainBoxBrowseEvent()
|
||||
|
||||
gint MainBoxDeviceEvent(GtkWidget *widget, GdkEvent event, gpointer data)
|
||||
{
|
||||
MainBoxUnfocus();
|
||||
|
||||
gtk_entry_set_text(GTK_ENTRY(devicebox.file),
|
||||
gtk_entry_get_text(GTK_ENTRY(mainbox.file)));
|
||||
gtk_window_set_focus(GTK_WINDOW(devicebox.window), devicebox.file);
|
||||
gtk_widget_show_all(devicebox.window);
|
||||
return(TRUE);
|
||||
} // END MainBoxBrowseEvent()
|
||||
|
||||
gint MainBoxConversionEvent(GtkWidget *widget, GdkEvent event, gpointer data)
|
||||
{
|
||||
MainBoxUnfocus();
|
||||
gtk_entry_set_text(GTK_ENTRY(conversionbox.file),
|
||||
gtk_entry_get_text(GTK_ENTRY(mainbox.file)));
|
||||
gtk_window_set_focus(GTK_WINDOW(conversionbox.window), conversionbox.file);
|
||||
gtk_widget_show_all(conversionbox.window);
|
||||
return(TRUE);
|
||||
} // END MainBoxBrowseEvent()
|
||||
|
||||
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), "CDVDisoEFP 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("Iso File:");
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), item, FALSE, FALSE, 0);
|
||||
gtk_widget_show(item);
|
||||
item = NULL;
|
||||
|
||||
mainbox.file = gtk_entry_new();
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), mainbox.file, TRUE, TRUE, 0);
|
||||
gtk_widget_show(mainbox.file);
|
||||
g_signal_connect(G_OBJECT(mainbox.file), "changed",
|
||||
G_CALLBACK(MainBoxFileEvent), NULL);
|
||||
|
||||
mainbox.selectbutton = gtk_button_new_with_label("Browse");
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), mainbox.selectbutton, FALSE, FALSE, 0);
|
||||
gtk_widget_show(mainbox.selectbutton);
|
||||
g_signal_connect(G_OBJECT(mainbox.selectbutton), "clicked",
|
||||
G_CALLBACK(MainBoxBrowseEvent), 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_hbox_new(FALSE, 10);
|
||||
// gtk_box_pack_start(GTK_BOX(vbox1), hbox1, TRUE, TRUE, 0);
|
||||
// gtk_widget_show(hbox1);
|
||||
mainbox.startcheck = gtk_check_button_new_with_label("Show Configure screen when starting emulation");
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), mainbox.startcheck, FALSE, FALSE, 0);
|
||||
gtk_widget_show(mainbox.startcheck);
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mainbox.startcheck), FALSE);
|
||||
if (conf.startconfigure != 0)
|
||||
{
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mainbox.startcheck), TRUE);
|
||||
} // ENDIF- Is this box supposed to be checked?
|
||||
mainbox.restartcheck = gtk_check_button_new_with_label("Show Configure screen when restarting emulation");
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), mainbox.restartcheck, FALSE, FALSE, 0);
|
||||
gtk_widget_show(mainbox.restartcheck);
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mainbox.restartcheck), FALSE);
|
||||
if (conf.restartconfigure != 0)
|
||||
{
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mainbox.restartcheck), TRUE);
|
||||
} // ENDIF- Is this box supposed to be checked?
|
||||
hbox1 = gtk_hbutton_box_new();
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), hbox1, TRUE, TRUE, 0);
|
||||
gtk_widget_show(hbox1);
|
||||
mainbox.okbutton = gtk_button_new_with_label("Ok");
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), mainbox.okbutton, TRUE, TRUE, 0);
|
||||
gtk_widget_show(mainbox.okbutton);
|
||||
g_signal_connect(G_OBJECT(mainbox.okbutton), "clicked",
|
||||
G_CALLBACK(MainBoxOKEvent), NULL);
|
||||
mainbox.devbutton = gtk_button_new_with_label("Get from Disc");
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), mainbox.devbutton, TRUE, TRUE, 0);
|
||||
gtk_widget_show(mainbox.devbutton);
|
||||
g_signal_connect(G_OBJECT(mainbox.devbutton), "clicked",
|
||||
G_CALLBACK(MainBoxDeviceEvent), NULL);
|
||||
mainbox.convbutton = gtk_button_new_with_label("Convert");
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), mainbox.convbutton, TRUE, TRUE, 0);
|
||||
gtk_widget_show(mainbox.convbutton);
|
||||
g_signal_connect(G_OBJECT(mainbox.convbutton), "clicked",
|
||||
G_CALLBACK(MainBoxConversionEvent), 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.file), conf.isoname);
|
||||
} // END MainBoxDisplay()
|
|
@ -1,219 +0,0 @@
|
|||
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
|
||||
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
|
||||
|
||||
<glade-interface>
|
||||
|
||||
<widget class="GtkWindow" id="dotwindow">
|
||||
<property name="border_width">5</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes">CDVDiso Configuration</property>
|
||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||
<property name="window_position">GTK_WIN_POS_CENTER</property>
|
||||
<property name="modal">False</property>
|
||||
<property name="resizable">True</property>
|
||||
<property name="destroy_with_parent">False</property>
|
||||
<property name="decorated">True</property>
|
||||
<property name="skip_taskbar_hint">False</property>
|
||||
<property name="skip_pager_hint">False</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
|
||||
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Iso File:</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">5</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkEntry" id="dotfile">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">True</property>
|
||||
<property name="visibility">True</property>
|
||||
<property name="max_length">0</property>
|
||||
<property name="text" translatable="yes"></property>
|
||||
<property name="has_frame">True</property>
|
||||
<property name="invisible_char" translatable="yes">*</property>
|
||||
<property name="activates_default">False</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">5</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="dotselectbutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Browse</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="dotdesc">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">File Type: ---</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="checkstart">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Show Configure screen when starting emulation</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="checkrestart">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Show Configure screen when restarting emulation</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHButtonBox" id="hbuttonbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_DEFAULT_STYLE</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="dotokbutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Ok</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="dotdevbutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Get from Disc</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="dotconvbutton">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Convert</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="button5">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Cancel</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
</glade-interface>
|
|
@ -1,51 +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/gtkwidget.h>
|
||||
|
||||
|
||||
struct MainBoxData
|
||||
{
|
||||
GtkWidget *window; // GtkWindow
|
||||
GtkWidget *file; // GtkEntry
|
||||
GtkWidget *selectbutton; // GtkButton
|
||||
GtkWidget *desc; // GtkLabel
|
||||
GtkWidget *startcheck; // GtkCheckBox
|
||||
GtkWidget *restartcheck; // GtkCheckBox
|
||||
GtkWidget *devbutton; // GtkButton
|
||||
GtkWidget *convbutton; // GtkButton
|
||||
GtkWidget *okbutton; // GtkButton
|
||||
// Leaving the Cancel button unblocked... for emergency shutdown
|
||||
|
||||
int stop; // Variable signal to stop long processes
|
||||
};
|
||||
|
||||
extern struct MainBoxData mainbox;
|
||||
|
||||
extern void MainBoxRefocus();
|
||||
extern void MainBoxDisplay();
|
||||
|
||||
|
||||
#endif /* MAINBOX_H */
|
|
@ -1,108 +0,0 @@
|
|||
/* messagebox.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 <gtk/gtkbutton.h> // gtk_button_new_with_label()
|
||||
#include <gtk/gtkhbbox.h> // gtk_hbutton_box_new()
|
||||
#include <gtk/gtklabel.h> // gtk_label_new()
|
||||
#include <gtk/gtkmain.h> // gtk_init(), gtk_main(), gtk_main_quit()
|
||||
#include <gtk/gtkvbox.h> // gtk_vbox_new()
|
||||
#include <gtk/gtkwindow.h> // gtk_window_new()
|
||||
#include "mainbox.h"
|
||||
#include "devicebox.h"
|
||||
#include "conversionbox.h"
|
||||
#include "messagebox.h"
|
||||
|
||||
struct MessageBoxData messagebox;
|
||||
|
||||
void MessageBoxDestroy()
|
||||
{
|
||||
if (messagebox.window != NULL)
|
||||
{
|
||||
gtk_widget_destroy(messagebox.window);
|
||||
messagebox.window = NULL;
|
||||
messagebox.desc = NULL;
|
||||
} // ENDIF- Do we have a Main Window still?
|
||||
} // END MessageBoxDestroy()
|
||||
|
||||
void MessageBoxShow(char *message, int wherefrom)
|
||||
{
|
||||
gtk_label_set_text(GTK_LABEL(messagebox.desc), message);
|
||||
messagebox.wherefrom = wherefrom;
|
||||
gtk_widget_show_all(messagebox.window);
|
||||
gtk_window_deiconify(GTK_WINDOW(messagebox.window));
|
||||
} // END MessageBox()
|
||||
|
||||
gint MessageBoxCancelEvent(GtkWidget *widget, GdkEvent event, gpointer data)
|
||||
{
|
||||
gtk_widget_hide(messagebox.window);
|
||||
switch (messagebox.wherefrom)
|
||||
{
|
||||
case 1:
|
||||
MainBoxRefocus();
|
||||
break;
|
||||
case 2:
|
||||
DeviceBoxRefocus();
|
||||
break;
|
||||
case 3:
|
||||
ConversionBoxRefocus();
|
||||
break;
|
||||
} // ENDSWITCH- Whose window do I get to re-focus when this is done?
|
||||
return(TRUE);
|
||||
} // END MessageBoxCancelEvent()
|
||||
|
||||
void MessageBoxDisplay()
|
||||
{
|
||||
GtkWidget *item;
|
||||
GtkWidget *hbox1;
|
||||
GtkWidget *vbox1;
|
||||
|
||||
messagebox.window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
gtk_container_set_border_width(GTK_CONTAINER(messagebox.window), 5);
|
||||
gtk_window_set_title(GTK_WINDOW(messagebox.window), "CDVDisoEFP");
|
||||
gtk_window_set_position(GTK_WINDOW(messagebox.window), GTK_WIN_POS_CENTER);
|
||||
gtk_window_set_resizable(GTK_WINDOW(messagebox.window), FALSE);
|
||||
|
||||
g_signal_connect(G_OBJECT(messagebox.window), "delete_event",
|
||||
G_CALLBACK(MessageBoxCancelEvent), NULL);
|
||||
vbox1 = gtk_vbox_new(FALSE, 5);
|
||||
gtk_container_add(GTK_CONTAINER(messagebox.window), vbox1);
|
||||
gtk_container_set_border_width(GTK_CONTAINER(vbox1), 5);
|
||||
gtk_widget_show(vbox1);
|
||||
|
||||
messagebox.desc = gtk_label_new("Hi There!\r\nHow are you doing?");
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), messagebox.desc, FALSE, FALSE, 0);
|
||||
gtk_widget_show(messagebox.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("Cancel");
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), item, TRUE, TRUE, 0);
|
||||
GTK_WIDGET_SET_FLAGS(item, GTK_CAN_DEFAULT);
|
||||
gtk_widget_show(item);
|
||||
g_signal_connect(G_OBJECT(item), "clicked",
|
||||
G_CALLBACK(MessageBoxCancelEvent), NULL);
|
||||
item = NULL;
|
||||
hbox1 = NULL;
|
||||
vbox1 = NULL;
|
||||
} // END MessageBoxDisplay()
|
|
@ -1,76 +0,0 @@
|
|||
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
|
||||
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
|
||||
|
||||
<glade-interface>
|
||||
<requires lib="gnome"/>
|
||||
|
||||
<widget class="GtkWindow" id="dotwindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes">CDVDiso</property>
|
||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||
<property name="window_position">GTK_WIN_POS_CENTER</property>
|
||||
<property name="modal">False</property>
|
||||
<property name="resizable">False</property>
|
||||
<property name="destroy_with_parent">False</property>
|
||||
<property name="decorated">True</property>
|
||||
<property name="skip_taskbar_hint">False</property>
|
||||
<property name="skip_pager_hint">False</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
|
||||
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="dotdesc">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Hello there
|
||||
How are you doing?</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHButtonBox" id="hbuttonbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_DEFAULT_STYLE</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="button1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">button1</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
</glade-interface>
|
|
@ -1,44 +0,0 @@
|
|||
/* messagebox.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 MESSAGEBOX_H
|
||||
#define MESSAGEBOX_H
|
||||
|
||||
|
||||
#include <gtk/gtkwidget.h>
|
||||
|
||||
|
||||
struct MessageBoxData
|
||||
{
|
||||
GtkWidget *window; // GtkWindow
|
||||
GtkWidget *desc; // GtkLabel
|
||||
|
||||
int wherefrom; // Whom do I refocus when the message is read?
|
||||
};
|
||||
|
||||
extern struct MessageBoxData messagebox;
|
||||
|
||||
extern void MessageBoxDestroy();
|
||||
extern void MessageBoxShow(char *message, int wherefrom);
|
||||
extern void MessageBoxDisplay();
|
||||
|
||||
|
||||
#endif /* MESSAGEBOX_H */
|
|
@ -1,134 +0,0 @@
|
|||
/* progressbox.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 <sys/types.h> // off64_t
|
||||
|
||||
#include <gtk/gtkbutton.h> // gtk_button_new_with_label()
|
||||
#include <gtk/gtkcontainer.h> // gtk_container_add()
|
||||
#include <gtk/gtkfilesel.h> // gtk_file_selection_set_filename()
|
||||
#include <gtk/gtkhbbox.h> // gtk_hbutton_box_new()
|
||||
#include <gtk/gtkhbox.h> // gtk_hbox_new()
|
||||
#include <gtk/gtklabel.h> // gtk_label_new()
|
||||
#include <gtk/gtkmain.h> // gtk_main_iteration(), gtk_events_pending()
|
||||
#include <gtk/gtkprogressbar.h> // gtk_progress_bar_new()
|
||||
#include <gtk/gtkvbox.h> // gtk_vbox_new()
|
||||
#include <gtk/gtkwindow.h> // gtk_window_new()
|
||||
#include "progressbox.h"
|
||||
|
||||
struct ProgressBoxData progressbox;
|
||||
char progressboxline[256];
|
||||
|
||||
void ProgressBoxDestroy()
|
||||
{
|
||||
if (progressbox.window != NULL)
|
||||
{
|
||||
gtk_widget_destroy(progressbox.window);
|
||||
progressbox.window = NULL;
|
||||
progressbox.desc = NULL;
|
||||
} // ENDIF- Do we have a Main Window still?
|
||||
} // END ProgressBoxDestroy()
|
||||
|
||||
void ProgressBoxStart(char *description, off64_t maximum)
|
||||
{
|
||||
gtk_label_set_text(GTK_LABEL(progressbox.desc), description);
|
||||
|
||||
progressbox.max = maximum;
|
||||
progressbox.gmax = maximum;
|
||||
progressbox.lastpct = 100;
|
||||
progressbox.stop = 0;
|
||||
ProgressBoxTick(0);
|
||||
gtk_widget_show_all(progressbox.window);
|
||||
gtk_window_deiconify(GTK_WINDOW(progressbox.window));
|
||||
} // END ProgressBoxStart()
|
||||
|
||||
void ProgressBoxTick(off64_t current)
|
||||
{
|
||||
gdouble gcur;
|
||||
off64_t thispct;
|
||||
gcur = current;
|
||||
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progressbox.bar),
|
||||
gcur / progressbox.gmax);
|
||||
sprintf(progressboxline, "%llu of %llu", current, progressbox.max);
|
||||
gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progressbox.bar), progressboxline);
|
||||
|
||||
if (progressbox.max >= 100)
|
||||
{
|
||||
thispct = current / (progressbox.max / 100);
|
||||
if (thispct != progressbox.lastpct)
|
||||
{
|
||||
sprintf(progressboxline, "%llu%% CDVDisoEFP Progress", thispct);
|
||||
gtk_window_set_title(GTK_WINDOW(progressbox.window), progressboxline);
|
||||
progressbox.lastpct = thispct;
|
||||
} // ENDIF- Change in percentage? (Avoiding title flicker)
|
||||
} // ENDIF- Our maximum # over 100? (Avoiding divide-by-zero error)
|
||||
while (gtk_events_pending()) gtk_main_iteration(); // Give time for window to redraw.
|
||||
} // END ProgressBoxTick()
|
||||
|
||||
void ProgressBoxStop()
|
||||
{
|
||||
gtk_widget_hide(progressbox.window);
|
||||
gtk_window_set_title(GTK_WINDOW(progressbox.window), "CDVDisoEFP Progress");
|
||||
} // END ProgressBoxStop()
|
||||
|
||||
gint ProgressBoxCancelEvent(GtkWidget *widget, GdkEvent event, gpointer data)
|
||||
{
|
||||
progressbox.stop = 1;
|
||||
|
||||
return(TRUE);
|
||||
} // END ProgressBoxCancelEvent()
|
||||
|
||||
void ProgressBoxDisplay()
|
||||
{
|
||||
GtkWidget *item;
|
||||
GtkWidget *hbox1;
|
||||
GtkWidget *vbox1;
|
||||
progressbox.window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
gtk_container_set_border_width(GTK_CONTAINER(progressbox.window), 5);
|
||||
gtk_window_set_title(GTK_WINDOW(progressbox.window), "CDVDisoEFP Progress");
|
||||
gtk_window_set_position(GTK_WINDOW(progressbox.window), GTK_WIN_POS_CENTER);
|
||||
gtk_window_set_resizable(GTK_WINDOW(progressbox.window), FALSE);
|
||||
g_signal_connect(G_OBJECT(progressbox.window), "delete_event",
|
||||
G_CALLBACK(ProgressBoxCancelEvent), NULL);
|
||||
|
||||
vbox1 = gtk_vbox_new(FALSE, 5);
|
||||
gtk_container_add(GTK_CONTAINER(progressbox.window), vbox1);
|
||||
gtk_container_set_border_width(GTK_CONTAINER(vbox1), 5);
|
||||
gtk_widget_show(vbox1);
|
||||
progressbox.desc = gtk_label_new("Twiddling Thumbs");
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), progressbox.desc, FALSE, FALSE, 0);
|
||||
gtk_widget_show(progressbox.desc);
|
||||
progressbox.bar = gtk_progress_bar_new();
|
||||
gtk_box_pack_start(GTK_BOX(vbox1), progressbox.bar, FALSE, FALSE, 0);
|
||||
gtk_widget_show(progressbox.bar);
|
||||
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("Cancel");
|
||||
gtk_box_pack_start(GTK_BOX(hbox1), item, TRUE, TRUE, 0);
|
||||
GTK_WIDGET_SET_FLAGS(item, GTK_CAN_DEFAULT);
|
||||
gtk_widget_show(item);
|
||||
g_signal_connect(G_OBJECT(item), "clicked",
|
||||
G_CALLBACK(ProgressBoxCancelEvent), NULL);
|
||||
item = NULL;
|
||||
hbox1 = NULL;
|
||||
vbox1 = NULL;
|
||||
} // END ProgressBoxDisplay()
|
|
@ -1,95 +0,0 @@
|
|||
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
|
||||
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
|
||||
|
||||
<glade-interface>
|
||||
<requires lib="gnome"/>
|
||||
|
||||
<widget class="GtkWindow" id="dotwindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes">CDVDiso Progress</property>
|
||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||
<property name="window_position">GTK_WIN_POS_CENTER</property>
|
||||
<property name="modal">False</property>
|
||||
<property name="resizable">True</property>
|
||||
<property name="destroy_with_parent">False</property>
|
||||
<property name="decorated">True</property>
|
||||
<property name="skip_taskbar_hint">False</property>
|
||||
<property name="skip_pager_hint">False</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
|
||||
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="dotdesc">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">/dev/dvd -> /usr/src/iso/GameImage.iso</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkEntry" id="dotbar">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">True</property>
|
||||
<property name="visibility">True</property>
|
||||
<property name="max_length">0</property>
|
||||
<property name="text" translatable="yes">Progress Bar: 12758 of 131509</property>
|
||||
<property name="has_frame">True</property>
|
||||
<property name="invisible_char" translatable="yes">*</property>
|
||||
<property name="activates_default">False</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHButtonBox" id="hbuttonbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_DEFAULT_STYLE</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="button1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Cancel</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
</glade-interface>
|
|
@ -1,56 +0,0 @@
|
|||
/* progressbox.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 PROGRESSBOX_H
|
||||
#define PROGRESSBOX_H
|
||||
|
||||
|
||||
#include <sys/types.h> // off64_t
|
||||
|
||||
#include <gtk/gtkwidget.h> // GtkWidget
|
||||
|
||||
|
||||
extern const char *compressnames[];
|
||||
|
||||
struct ProgressBoxData
|
||||
{
|
||||
GtkWidget *window; // GtkWindow
|
||||
GtkWidget *desc; // GtkLabel - What are we showing progress on?
|
||||
GtkWidget *bar; // GtkProgressBar
|
||||
|
||||
off64_t max;
|
||||
gdouble gmax;
|
||||
off64_t lastpct;
|
||||
|
||||
int stop; // Someone pressed the Stop button
|
||||
};
|
||||
|
||||
extern struct ProgressBoxData progressbox;
|
||||
|
||||
|
||||
extern void ProgressBoxStart(char *description, off64_t maximum);
|
||||
extern void ProgressBoxTick(off64_t current);
|
||||
extern void ProgressBoxStop();
|
||||
extern void ProgressBoxDestroy();
|
||||
extern void ProgressBoxDisplay();
|
||||
|
||||
|
||||
#endif /* MAINBOX_H */
|
|
@ -1,99 +0,0 @@
|
|||
/* selectionbox.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 <glib-object.h> // g_signal_connect()
|
||||
#include <gtk/gtkentry.h> // gtk_entry_set_text()
|
||||
#include <gtk/gtkfilesel.h> // gtk_file_selection_new()
|
||||
|
||||
#include "devicebox.h"
|
||||
#include "conversionbox.h"
|
||||
#include "selectionbox.h"
|
||||
#include "mainbox.h"
|
||||
|
||||
struct SelectionBoxData selectionbox;
|
||||
|
||||
void SelectionBoxDestroy()
|
||||
{
|
||||
if (selectionbox.window != NULL)
|
||||
{
|
||||
gtk_widget_destroy(selectionbox.window);
|
||||
selectionbox.window = NULL;
|
||||
} // ENDIF- Do we have a Main Window still?
|
||||
} // END SelectionBoxDestroy()
|
||||
|
||||
void SelectionBoxRefresh()
|
||||
{
|
||||
} // END SelectionBoxRefresh()
|
||||
|
||||
void SelectionBoxUnfocus()
|
||||
{
|
||||
gtk_widget_hide(selectionbox.window);
|
||||
} // END SelectionBoxUnfocus()
|
||||
|
||||
void SelectionBoxRefocus()
|
||||
{
|
||||
gtk_widget_show(selectionbox.window);
|
||||
} // END SelectionBoxRefocus()
|
||||
|
||||
gint SelectionBoxCancelEvent(GtkWidget *widget, GdkEvent event, gpointer data)
|
||||
{
|
||||
SelectionBoxUnfocus();
|
||||
switch (selectionbox.wherefrom)
|
||||
{
|
||||
case 1:
|
||||
gtk_entry_set_text(GTK_ENTRY(mainbox.file),
|
||||
gtk_file_selection_get_filename(GTK_FILE_SELECTION(selectionbox.window)));
|
||||
MainBoxRefocus();
|
||||
break;
|
||||
case 2:
|
||||
gtk_entry_set_text(GTK_ENTRY(devicebox.file),
|
||||
gtk_file_selection_get_filename(GTK_FILE_SELECTION(selectionbox.window)));
|
||||
DeviceBoxRefocus();
|
||||
break;
|
||||
case 3:
|
||||
gtk_entry_set_text(GTK_ENTRY(conversionbox.file),
|
||||
gtk_file_selection_get_filename(GTK_FILE_SELECTION(selectionbox.window)));
|
||||
ConversionBoxRefocus();
|
||||
break;
|
||||
} // ENDSWITCH wherefrom- What Box called us?
|
||||
return(TRUE);
|
||||
} // END SelectionBoxCancelEvent()
|
||||
|
||||
gint SelectionBoxOKEvent(GtkWidget *widget, GdkEvent event, gpointer data)
|
||||
{
|
||||
// Validate listed file(?)
|
||||
// Transfer file name to calling window?
|
||||
SelectionBoxCancelEvent(widget, event, data);
|
||||
return(TRUE);
|
||||
} // END SelectionBoxOKEvent()
|
||||
|
||||
void SelectionBoxDisplay()
|
||||
{
|
||||
selectionbox.window = gtk_file_selection_new("Select an ISO file");
|
||||
g_signal_connect(G_OBJECT(selectionbox.window), "delete_event",
|
||||
G_CALLBACK(SelectionBoxCancelEvent), NULL);
|
||||
g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(selectionbox.window)->ok_button),
|
||||
"clicked", G_CALLBACK(SelectionBoxOKEvent), NULL);
|
||||
g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(selectionbox.window)->cancel_button),
|
||||
"clicked", G_CALLBACK(SelectionBoxCancelEvent), NULL);
|
||||
selectionbox.wherefrom = 0; // Called by no one... yet.
|
||||
} // END SelectionBoxDisplay()
|
|
@ -1,44 +0,0 @@
|
|||
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
|
||||
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
|
||||
|
||||
<glade-interface>
|
||||
<requires lib="gnome"/>
|
||||
|
||||
<widget class="GtkFileSelection" id="dotwindow">
|
||||
<property name="border_width">10</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes">Select an ISO File</property>
|
||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||
<property name="window_position">GTK_WIN_POS_NONE</property>
|
||||
<property name="modal">False</property>
|
||||
<property name="resizable">True</property>
|
||||
<property name="destroy_with_parent">False</property>
|
||||
<property name="decorated">True</property>
|
||||
<property name="skip_taskbar_hint">False</property>
|
||||
<property name="skip_pager_hint">False</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
|
||||
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||
<property name="show_fileops">True</property>
|
||||
|
||||
<child internal-child="cancel_button">
|
||||
<widget class="GtkButton" id="cancel_button1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child internal-child="ok_button">
|
||||
<widget class="GtkButton" id="ok_button1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
</glade-interface>
|
|
@ -1,47 +0,0 @@
|
|||
/* selectionbox.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 SELECTIONBOX_H
|
||||
#define SELECTIONBOX_H
|
||||
|
||||
|
||||
#include <gtk/gtkwidget.h>
|
||||
|
||||
|
||||
struct SelectionBoxData
|
||||
{
|
||||
GtkWidget *window; // GtkWindow
|
||||
|
||||
int wherefrom; // Which box called you?
|
||||
// 1 = MainBox
|
||||
// 2 = DeviceBox
|
||||
// 3 = ConversionBox
|
||||
};
|
||||
|
||||
extern struct SelectionBoxData selectionbox;
|
||||
|
||||
|
||||
extern void SelectionBoxDestroy();
|
||||
extern void SelectionBoxRefocus();
|
||||
extern void SelectionBoxDisplay();
|
||||
|
||||
|
||||
#endif /* SELECTIONBOX_H */
|
|
@ -1,190 +0,0 @@
|
|||
/* tablerebuild.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 <stdlib.h> // malloc()
|
||||
|
||||
// #include <gtk/gtkmain.h> // gtk_main_iteration()
|
||||
|
||||
#include "mainbox.h"
|
||||
#include "progressbox.h"
|
||||
#include "isofile.h"
|
||||
#include "multifile.h"
|
||||
#include "isocompress.h" // CompressClose()
|
||||
#include "gzipv1.h"
|
||||
#include "gzipv2.h"
|
||||
#include "bzip2v2.h"
|
||||
#include "bzip2v3.h"
|
||||
#include "actualfile.h" // ACTUALHANDLENULL
|
||||
|
||||
void IsoTableRebuild(const char *filename)
|
||||
{
|
||||
struct IsoFile *datafile;
|
||||
struct IsoFile *tablefile;
|
||||
int retval;
|
||||
char tempblock[65536];
|
||||
int stop;
|
||||
struct TableData table;
|
||||
datafile = IsoFileOpenForRead(filename);
|
||||
// Note: This is the start of the "Multifile" process. It's commented
|
||||
// out so at least we can rebuild 1 part of a multifile at a time.
|
||||
// IsoNameStripExt(datafile);
|
||||
// IsoNameStripMulti(datafile);
|
||||
|
||||
// Prep tablefile to hold ONLY a table (no data)
|
||||
tablefile = (struct IsoFile *) malloc(sizeof(struct IsoFile));
|
||||
if (tablefile == NULL)
|
||||
{
|
||||
datafile = IsoFileClose(datafile);
|
||||
return;
|
||||
} // ENDIF- Failed to allocate? Abort.
|
||||
tablefile->sectorpos = 0;
|
||||
tablefile->openforread = 0;
|
||||
tablefile->filebytepos = 0;
|
||||
tablefile->filebytesize = 0;
|
||||
tablefile->filesectorpos = 0;
|
||||
tablefile->filesectorsize = 0;
|
||||
tablefile->handle = ACTUALHANDLENULL;
|
||||
tablefile->namepos = 0;
|
||||
while ((tablefile->namepos < 255) &&
|
||||
(*(filename + tablefile->namepos) != 0))
|
||||
{
|
||||
tablefile->name[tablefile->namepos] = *(filename + tablefile->namepos);
|
||||
tablefile->namepos++;
|
||||
} // ENDWHILE- Copying file name into tablefile
|
||||
tablefile->name[tablefile->namepos] = 0; // And 0-terminate.
|
||||
tablefile->imageheader = datafile->imageheader;
|
||||
tablefile->blocksize = datafile->blocksize;
|
||||
tablefile->blockoffset = datafile->blockoffset;
|
||||
tablefile->cdvdtype = 0; // Not important right now.
|
||||
|
||||
tablefile->compress = datafile->compress;
|
||||
tablefile->compresspos = datafile->compresspos;
|
||||
tablefile->numsectors = datafile->numsectors;
|
||||
tablefile->tabledata = NULL;
|
||||
switch (tablefile->compress)
|
||||
{
|
||||
case 1:
|
||||
retval = GZipV1OpenTableForWrite(tablefile);
|
||||
break;
|
||||
case 2:
|
||||
retval = -1;
|
||||
break;
|
||||
case 3:
|
||||
retval = GZipV2OpenTableForWrite(tablefile);
|
||||
break;
|
||||
case 4:
|
||||
retval = BZip2V2OpenTableForWrite(tablefile);
|
||||
break;
|
||||
case 5:
|
||||
retval = BZip2V3OpenTableForWrite(tablefile);
|
||||
break;
|
||||
default:
|
||||
retval = -1;
|
||||
break;
|
||||
} // ENDSWITCH compress- Which table are we writing out?
|
||||
if (retval < 0)
|
||||
{
|
||||
datafile = IsoFileClose(datafile);
|
||||
return;
|
||||
} // ENDIF- Failed to open table file? Abort
|
||||
|
||||
sprintf(tempblock, "Rebuilding table for %s", datafile->name);
|
||||
ProgressBoxStart(tempblock, datafile->filebytesize);
|
||||
stop = 0;
|
||||
mainbox.stop = 0;
|
||||
progressbox.stop = 0;
|
||||
while ((stop == 0) && (datafile->filebytepos < datafile->filebytesize))
|
||||
{
|
||||
switch (datafile->compress)
|
||||
{
|
||||
case 1:
|
||||
retval = GZipV1Read(datafile, 0, tempblock);
|
||||
break;
|
||||
case 2:
|
||||
retval = -1;
|
||||
break;
|
||||
case 3:
|
||||
retval = GZipV2Read(datafile, 0, tempblock);
|
||||
break;
|
||||
case 4:
|
||||
retval = BZip2V2Read(datafile, 0, tempblock);
|
||||
break;
|
||||
case 5:
|
||||
retval = BZip2V3Read(datafile, 0, tempblock);
|
||||
break;
|
||||
default:
|
||||
retval = -1;
|
||||
break;
|
||||
} // ENDSWITCH compress- Scanning for the next complete compressed block
|
||||
|
||||
if (retval <= 0)
|
||||
{
|
||||
#ifdef FUNCTION_WARNING_TABLEREBUILD
|
||||
PrintLog("CDVDiso rebuild: failed to decompress - data corrupt");
|
||||
#endif /* FUNCTION_WARNING_TABLEREBUILD */
|
||||
stop = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
table.offset = datafile->filebytepos - retval;
|
||||
table.size = retval;
|
||||
switch (tablefile->compress)
|
||||
{
|
||||
case 1:
|
||||
retval = GZipV1WriteTable(tablefile, table);
|
||||
break;
|
||||
case 2:
|
||||
retval = -1;
|
||||
break;
|
||||
case 3:
|
||||
retval = GZipV2WriteTable(tablefile, table);
|
||||
break;
|
||||
case 4:
|
||||
retval = BZip2V2WriteTable(tablefile, table);
|
||||
break;
|
||||
case 5:
|
||||
retval = BZip2V3WriteTable(tablefile, table);
|
||||
break;
|
||||
default:
|
||||
retval = -1;
|
||||
break;
|
||||
} // ENDSWITCH compress- Writing out the relavent table facts
|
||||
if (retval < 0) stop = 1;
|
||||
} // ENDIF- Do we have a valid record to write an entry for?
|
||||
ProgressBoxTick(datafile->filebytepos);
|
||||
// while(gtk_events_pending()) gtk_main_iteration();
|
||||
|
||||
if (mainbox.stop != 0) stop = 2;
|
||||
if (progressbox.stop != 0) stop = 2;
|
||||
} // ENDWHILE- Read in the data file and writing a table, 1 block at a time
|
||||
|
||||
ProgressBoxStop();
|
||||
|
||||
CompressClose(tablefile); // Guarentee the table is flushed and closed.
|
||||
if (stop != 0)
|
||||
{
|
||||
ActualFileDelete(tablefile->tablename);
|
||||
} // ENDIF- Aborted or trouble? Delete the table file
|
||||
tablefile = IsoFileClose(tablefile);
|
||||
datafile = IsoFileClose(datafile);
|
||||
return;
|
||||
} // END IsoTableRebuild()
|
|
@ -1,32 +0,0 @@
|
|||
/* tablerebuild.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 TABLEREBUILD_H
|
||||
#define TABLEREBUILD_H
|
||||
|
||||
|
||||
// #define FUNCTION_WARNING_TABLEREBUILD
|
||||
|
||||
|
||||
extern void IsoTableRebuild(const char *filename);
|
||||
|
||||
|
||||
#endif /* TABLEREBUILD_H */
|
|
@ -1,725 +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(off64_t *mem);
|
||||
void CALLBACK GSreadFIFO2(off64_t *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)(off64_t *pMem);
|
||||
typedef void (CALLBACK* _GSreadFIFO2)(off64_t *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,52 +0,0 @@
|
|||
#ifndef __PS2ETYPES_H__
|
||||
#define __PS2ETYPES_H__
|
||||
|
||||
#ifndef ARRAYSIZE
|
||||
#define ARRAYSIZE(x) (sizeof(x)/sizeof((x)[0]))
|
||||
#endif
|
||||
|
||||
// Basic types
|
||||
#if defined(_MSC_VER)
|
||||
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
|
||||
#define PCSX2_ALIGNED16(x) __declspec(align(16)) x
|
||||
#else
|
||||
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
|
||||
#if defined(__MINGW32__)
|
||||
#define PCSX2_ALIGNED16(x) __declspec(align(16)) x
|
||||
#else
|
||||
#define PCSX2_ALIGNED16(x) x __attribute((aligned(16)))
|
||||
#endif
|
||||
#ifndef __forceinline
|
||||
#define __forceinline inline
|
||||
#endif
|
||||
#endif
|
||||
typedef struct
|
||||
{
|
||||
int size;
|
||||
s8 *data;
|
||||
} freezeData;
|
||||
#endif /* __PS2ETYPES_H__ */
|
|
@ -1,393 +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("CDVD 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("CDVDiso CD: Couldn't read a sector raw!");
|
||||
PrintError("CDVDiso 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("CDVDiso CD: Couldn't read a cooked sector!");
|
||||
PrintError("CDVDiso 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("CDVDiso CD: Short block! only got %u out of %u bytes",
|
||||
byteswritten, cdblocksize);
|
||||
PrintError("CDVDiso 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("CDVDiso 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("CDVDiso 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("CDVDiso 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("CDVDiso 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("CDVDiso 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("CDVDiso CD: Can't get TOC!");
|
||||
PrintError("CDVDiso 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("CDVDiso 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("CDVDiso 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("CDVDiso 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,44 +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,541 +0,0 @@
|
|||
/* CDVDiso.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
|
||||
#define CDVDdefs
|
||||
#include "../PS2Edefs.h"
|
||||
|
||||
#include "conf.h"
|
||||
#include "actualfile.h"
|
||||
#include "../isofile.h"
|
||||
#include "logfile.h"
|
||||
#include "../convert.h"
|
||||
#include "../version.h"
|
||||
#include "screens.h"
|
||||
#include "mainbox.h" // Initialize mainboxwindow
|
||||
#include "progressbox.h" // Initialize progressboxwindow
|
||||
#include "conversionbox.h" // Initialize conversionboxwindow
|
||||
#include "devicebox.h" // Initialize deviceboxwindow
|
||||
#include "CDVDiso.h"
|
||||
struct IsoFile *isofile;
|
||||
char isobuffer[2448];
|
||||
char isocdcheck[2048];
|
||||
int isomode;
|
||||
int deviceopencount;
|
||||
HINSTANCE progmodule;
|
||||
BOOL APIENTRY DllMain(HANDLE hModule,
|
||||
DWORD param,
|
||||
LPVOID reserved)
|
||||
{
|
||||
switch (param)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
progmodule = hModule;
|
||||
// mainboxwindow = NULL;
|
||||
// progressboxwindow = NULL;
|
||||
// conversionboxwindow = NULL;
|
||||
// deviceboxwindow = 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()
|
||||
{
|
||||
int i;
|
||||
InitLog();
|
||||
if (OpenLog() != 0) return(-1); // Couldn't open Log File? Abort.
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDinit()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
InitConf();
|
||||
isofile = NULL;
|
||||
isomode = -1;
|
||||
deviceopencount = 0;
|
||||
for (i = 0; i < 2048; i++) isocdcheck[i] = 0;
|
||||
mainboxwindow = NULL;
|
||||
progressboxwindow = NULL;
|
||||
conversionboxwindow = NULL;
|
||||
deviceboxwindow = NULL;
|
||||
|
||||
return(0);
|
||||
} // END CDVDinit()
|
||||
void CALLBACK CDVDshutdown()
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDshutdown()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
isofile = IsoFileClose(isofile);
|
||||
// Close Windows as well? (Just in case)
|
||||
CloseLog();
|
||||
} // END CDVDshutdown()
|
||||
|
||||
s32 CALLBACK CDVDopen(const char* pTitleFilename)
|
||||
{
|
||||
HWND lastwindow;
|
||||
int i;
|
||||
int retval;
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDopen()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
lastwindow = GetActiveWindow();
|
||||
LoadConf();
|
||||
if (pTitleFilename != NULL) strcpy(conf.isoname, pTitleFilename);
|
||||
if ((conf.isoname[0] == 0) || (conf.isoname[0] == '[') ||
|
||||
((conf.startconfigure == 1) && (deviceopencount == 0)) ||
|
||||
((conf.restartconfigure == 1) && (deviceopencount > 0)))
|
||||
{
|
||||
DialogBox(progmodule,
|
||||
MAKEINTRESOURCE(DLG_0200),
|
||||
lastwindow,
|
||||
(DLGPROC)MainBoxCallback);
|
||||
SetActiveWindow(lastwindow);
|
||||
LoadConf();
|
||||
// Blank out the name in config file afterwards? Seems excessive.
|
||||
} // ENDIF- Haven't initialized the configure program yet? Do so now.
|
||||
lastwindow = NULL;
|
||||
isofile = IsoFileOpenForRead(conf.isoname);
|
||||
if (isofile == NULL)
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: Failed to open ISO file!");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
// return(-1); // Removed to simulate disc not in drive.
|
||||
for (i = 0; i < 2048; i++) isocdcheck[i] = 0;
|
||||
return(0);
|
||||
} // ENDIF- Trouble opening file? Abort.
|
||||
retval = IsoFileSeek(isofile, 16);
|
||||
if (retval != 0) return(-1);
|
||||
retval = IsoFileRead(isofile, isobuffer);
|
||||
if (retval != 0) return(-1);
|
||||
if (deviceopencount > 0)
|
||||
{
|
||||
i = 0;
|
||||
while ((i < 2048) && (isocdcheck[i] == isobuffer[i])) i++;
|
||||
if (i == 2048) deviceopencount = 0; // Same CD/DVD? No delay.
|
||||
} // ENDIF- Is this a restart? Check for disc change.
|
||||
for (i = 0; i < 2048; i++) isocdcheck[i] = isobuffer[i];
|
||||
return(0);
|
||||
} // END CDVDopen()
|
||||
|
||||
void CALLBACK CDVDclose()
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDclose()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
isofile = IsoFileClose(isofile);
|
||||
deviceopencount = 50;
|
||||
} // END CDVDclose()
|
||||
|
||||
s32 CALLBACK CDVDreadSubQ(u32 lsn, cdvdSubQ* subq)
|
||||
{
|
||||
char temptime[3];
|
||||
int i;
|
||||
int pos;
|
||||
u32 tracklsn;
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDreadSubQ()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
|
||||
if (isofile == NULL) return(-1);
|
||||
if (deviceopencount > 0)
|
||||
{
|
||||
deviceopencount--;
|
||||
if (deviceopencount > 0) return(-1);
|
||||
} // ENDIF- Still simulating device tray open?
|
||||
|
||||
if ((isofile->cdvdtype == CDVD_TYPE_PS2DVD) ||
|
||||
(isofile->cdvdtype == CDVD_TYPE_DVDV))
|
||||
{
|
||||
return(-1); // DVDs don't have SubQ data
|
||||
} // ENDIF- Trying to get a SubQ from a DVD?
|
||||
// fake it
|
||||
i = BCDTOHEX(isofile->toc[7]);
|
||||
pos = i * 10;
|
||||
pos += 30;
|
||||
temptime[0] = BCDTOHEX(isofile->toc[pos + 7]);
|
||||
temptime[1] = BCDTOHEX(isofile->toc[pos + 8]);
|
||||
temptime[2] = BCDTOHEX(isofile->toc[pos + 9]);
|
||||
tracklsn = MSFtoLBA(temptime);
|
||||
while ((i < BCDTOHEX(isofile->toc[17])) && (tracklsn < lsn))
|
||||
{
|
||||
i++;
|
||||
pos = i * 10;
|
||||
pos += 30;
|
||||
temptime[0] = BCDTOHEX(isofile->toc[pos + 7]);
|
||||
temptime[1] = BCDTOHEX(isofile->toc[pos + 8]);
|
||||
temptime[2] = BCDTOHEX(isofile->toc[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("CDVDiso interface: CDVDgetTN()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
|
||||
if (isofile == NULL) return(-1);
|
||||
if (deviceopencount > 0)
|
||||
{
|
||||
deviceopencount--;
|
||||
if (deviceopencount > 0) return(-1);
|
||||
} // ENDIF- Still simulating device tray open?
|
||||
|
||||
if ((isofile->cdvdtype == CDVD_TYPE_PS2DVD) ||
|
||||
(isofile->cdvdtype == CDVD_TYPE_DVDV))
|
||||
{
|
||||
Buffer->strack = 1;
|
||||
Buffer->etrack = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
Buffer->strack = BCDTOHEX(isofile->toc[7]);
|
||||
Buffer->etrack = BCDTOHEX(isofile->toc[17]);
|
||||
} // ENDIF- Retrieve track info from a DVD? (or a CD?)
|
||||
return(0);
|
||||
} // END CDVDgetTN()
|
||||
s32 CALLBACK CDVDgetTD(u8 track, cdvdTD *Buffer)
|
||||
{
|
||||
u8 actualtrack;
|
||||
int pos;
|
||||
char temptime[3];
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDgetTD()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
|
||||
if (isofile == NULL) return(-1);
|
||||
if (deviceopencount > 0)
|
||||
{
|
||||
deviceopencount--;
|
||||
if (deviceopencount > 0) return(-1);
|
||||
} // ENDIF- Still simulating device tray open?
|
||||
|
||||
actualtrack = track;
|
||||
if (actualtrack == 0xaa) actualtrack = 0;
|
||||
if ((isofile->cdvdtype == CDVD_TYPE_PS2DVD) ||
|
||||
(isofile->cdvdtype == CDVD_TYPE_DVDV))
|
||||
{
|
||||
if (actualtrack <= 1)
|
||||
{
|
||||
Buffer->type = 0;
|
||||
Buffer->lsn = isofile->filesectorsize;
|
||||
}
|
||||
else
|
||||
{
|
||||
Buffer->type = CDVD_MODE1_TRACK;
|
||||
Buffer->lsn = 0;
|
||||
} // ENDIF- Whole disc? (or single track?)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (actualtrack == 0)
|
||||
{
|
||||
Buffer->type = 0;
|
||||
temptime[0] = BCDTOHEX(isofile->toc[27]);
|
||||
temptime[1] = BCDTOHEX(isofile->toc[28]);
|
||||
temptime[2] = BCDTOHEX(isofile->toc[29]);
|
||||
Buffer->lsn = MSFtoLBA(temptime);
|
||||
}
|
||||
else
|
||||
{
|
||||
pos = actualtrack * 10;
|
||||
pos += 30;
|
||||
Buffer->type = isofile->toc[pos];
|
||||
temptime[0] = BCDTOHEX(isofile->toc[pos + 7]);
|
||||
temptime[1] = BCDTOHEX(isofile->toc[pos + 8]);
|
||||
temptime[2] = BCDTOHEX(isofile->toc[pos + 9]);
|
||||
Buffer->lsn = MSFtoLBA(temptime);
|
||||
} // ENDIF- Whole disc? (or single track?)
|
||||
} // ENDIF- Retrieve track info from a DVD? (or a CD?)
|
||||
return(0);
|
||||
} // END CDVDgetTD()
|
||||
|
||||
s32 CALLBACK CDVDgetTOC(void* toc)
|
||||
{
|
||||
int i;
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDgetTOC()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
if (isofile == NULL) return(-1);
|
||||
if (deviceopencount > 0)
|
||||
{
|
||||
deviceopencount--;
|
||||
if (deviceopencount > 0) return(-1);
|
||||
} // ENDIF- Still simulating device tray open?
|
||||
for (i = 0; i < 2048; i++) *(((char *) toc) + i) = isofile->toc[i];
|
||||
return(0);
|
||||
} // END CDVDgetTOC()
|
||||
|
||||
s32 CALLBACK CDVDreadTrack(u32 lsn, int mode)
|
||||
{
|
||||
int retval;
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDreadTrack(%u)", lsn);
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
if (isofile == NULL) return(-1);
|
||||
if (deviceopencount > 0)
|
||||
{
|
||||
deviceopencount--;
|
||||
if (deviceopencount > 0) return(-1);
|
||||
} // ENDIF- Still simulating device tray open?
|
||||
retval = IsoFileSeek(isofile, (off64_t) lsn);
|
||||
if (retval != 0)
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: Trouble finding the sector!");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
return(-1);
|
||||
} // ENDIF- Trouble finding the sector?
|
||||
retval = IsoFileRead(isofile, isobuffer);
|
||||
if (retval != 0)
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: Trouble reading the sector!");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
return(-1);
|
||||
} // ENDIF- Trouble finding the sector?
|
||||
isomode = mode;
|
||||
return(0);
|
||||
} // END CDVDreadTrack()
|
||||
|
||||
u8* CALLBACK CDVDgetBuffer()
|
||||
{
|
||||
int offset;
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDgetBuffer()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
if (isofile == NULL) return(NULL);
|
||||
if (deviceopencount > 0)
|
||||
{
|
||||
deviceopencount--;
|
||||
if (deviceopencount > 0) return(NULL);
|
||||
} // ENDIF- Still simulating device tray open?
|
||||
offset = 0;
|
||||
switch (isomode)
|
||||
{
|
||||
case CDVD_MODE_2352:
|
||||
offset = 0;
|
||||
break;
|
||||
case CDVD_MODE_2340:
|
||||
offset = 12;
|
||||
break;
|
||||
case CDVD_MODE_2328:
|
||||
case CDVD_MODE_2048:
|
||||
offset = 24;
|
||||
break;
|
||||
} // ENDSWITCH isomode- offset to where data it wants is.
|
||||
if (offset > isofile->blockoffset) offset = isofile->blockoffset;
|
||||
return(isobuffer + offset);
|
||||
} // END CDVDgetBuffer()
|
||||
s32 CALLBACK CDVDgetDiskType()
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
// PrintLog("CDVDiso interface: CDVDgetDiskType()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
|
||||
if (isofile == NULL) return(CDVD_TYPE_NODISC);
|
||||
if (deviceopencount > 0)
|
||||
{
|
||||
deviceopencount--;
|
||||
if (deviceopencount > 0) return(CDVD_TYPE_DETCT);
|
||||
} // ENDIF- Still simulating device tray open?
|
||||
|
||||
return(isofile->cdvdtype);
|
||||
} // END CDVDgetDiskType()
|
||||
s32 CALLBACK CDVDgetTrayStatus()
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
// PrintLog("CDVDiso interface: CDVDgetTrayStatus()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
if (isofile == NULL) return(CDVD_TRAY_OPEN);
|
||||
if (deviceopencount > 30)
|
||||
{
|
||||
deviceopencount--;
|
||||
return(CDVD_TRAY_OPEN);
|
||||
} // ENDIF- Still simulating device tray open?
|
||||
return(CDVD_TRAY_CLOSE);
|
||||
} // END CDVDgetTrayStatus()
|
||||
s32 CALLBACK CDVDctrlTrayOpen()
|
||||
{
|
||||
HWND lastwindow;
|
||||
int i;
|
||||
int retval;
|
||||
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDctrlTrayOpen()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
// CDVDclose();
|
||||
isofile = IsoFileClose(isofile);
|
||||
deviceopencount = 50;
|
||||
// CDVDopen();
|
||||
lastwindow = GetActiveWindow();
|
||||
LoadConf();
|
||||
if ((conf.isoname[0] == 0) || (conf.isoname[0] == '[') ||
|
||||
((conf.restartconfigure == 1) && (deviceopencount > 0)))
|
||||
{
|
||||
DialogBox(progmodule,
|
||||
MAKEINTRESOURCE(DLG_0200),
|
||||
lastwindow,
|
||||
(DLGPROC)MainBoxCallback);
|
||||
SetActiveWindow(lastwindow);
|
||||
LoadConf();
|
||||
// Blank out the name in config file afterwards? Seems excessive.
|
||||
} // ENDIF- Haven't initialized the configure program yet? Do so now.
|
||||
lastwindow = NULL;
|
||||
deviceopencount = 0; // Temp line!
|
||||
// NOTE: What happened to repetitive polling when disc not in drive?
|
||||
isofile = IsoFileOpenForRead(conf.isoname);
|
||||
if (isofile == NULL)
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: Failed to open ISO file!");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
// return(-1); // Removed to simulate disc not in drive.
|
||||
for (i = 0; i < 2048; i++) isocdcheck[i] = 0;
|
||||
return(0);
|
||||
} // ENDIF- Trouble opening file? Abort.
|
||||
retval = IsoFileSeek(isofile, 16);
|
||||
if (retval != 0) return(-1);
|
||||
retval = IsoFileRead(isofile, isobuffer);
|
||||
if (retval != 0) return(-1);
|
||||
if (deviceopencount > 0)
|
||||
{
|
||||
i = 0;
|
||||
while ((i < 2048) && (isocdcheck[i] == isobuffer[i])) i++;
|
||||
if (i == 2048) deviceopencount = 0; // Same CD/DVD? No delay.
|
||||
} // ENDIF- Is this a restart? Check for disc change.
|
||||
for (i = 0; i < 2048; i++) isocdcheck[i] = isobuffer[i];
|
||||
return(0);
|
||||
} // END CDVDctrlTrayOpen()
|
||||
|
||||
s32 CALLBACK CDVDctrlTrayClose()
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDctrlTrayClose()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
return(0);
|
||||
} // END CDVDctrlTrayClose()
|
||||
s32 CALLBACK CDVDtest()
|
||||
{
|
||||
#ifdef VERBOSE_FUNCTION_INTERFACE
|
||||
PrintLog("CDVDiso interface: CDVDtest()");
|
||||
#endif /* VERBOSE_FUNCTION_INTERFACE */
|
||||
// InitConf(); // Shouldn't need this. Doesn't CDVDInit() get called first?
|
||||
LoadConf();
|
||||
|
||||
if (conf.isoname[0] == 0) return(0); // No name chosen yet. Catch on Open()
|
||||
if (IsIsoFile(conf.isoname) == 0) return(0); // Valid name. Go.
|
||||
return(-1); // Invalid name - reconfigure first.
|
||||
// Note really need this? Why not just return(0)...
|
||||
} // 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,31 +0,0 @@
|
|||
/* CDVDiso.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 CDVDISO_H
|
||||
#define CDVDISO_H
|
||||
|
||||
#include <windows.h> // HINSTANCE
|
||||
|
||||
// #define VERBOSE_FUNCTION_INTERFACE
|
||||
|
||||
extern HINSTANCE progmodule;
|
||||
extern char isobuffer[];
|
||||
|
||||
#endif /* CDVDISO_H */
|
|
@ -1,412 +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("CDVDiso 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("CDVDiso DVD: Couldn't start session!");
|
||||
PrintError("CDVDiso 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("CDVDiso DVD: Couldn't get layer data!");
|
||||
PrintError("CDVDiso 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("CDVDiso DVD: Book Type: DVD-ROM");
|
||||
break;
|
||||
case 1:
|
||||
PrintLog("CDVDiso DVD: Book Type: DVD-RAM");
|
||||
break;
|
||||
case 2:
|
||||
PrintLog("CDVDiso DVD: Book Type: DVD-R");
|
||||
break;
|
||||
case 3:
|
||||
PrintLog("CDVDiso DVD: Book Type: DVD-RW");
|
||||
break;
|
||||
case 9:
|
||||
PrintLog("CDVDiso DVD: Book Type: DVD+RW");
|
||||
break;
|
||||
default:
|
||||
PrintLog("CDVDiso DVD: Book Type: Unknown (%i)", layer.d.BookType);
|
||||
break;
|
||||
} // ENDSWITCH- Displaying the Book Type
|
||||
PrintLog("CDVDiso DVD: Book Version %i", layer.d.BookVersion);
|
||||
switch (layer.d.MinimumRate)
|
||||
{
|
||||
case 0:
|
||||
PrintLog("CDVDiso DVD: Use Minimum Rate for: DVD-ROM");
|
||||
break;
|
||||
case 1:
|
||||
PrintLog("CDVDiso DVD: Use Minimum Rate for: DVD-RAM");
|
||||
break;
|
||||
case 2:
|
||||
PrintLog("CDVDiso DVD: Use Minimum Rate for: DVD-R");
|
||||
break;
|
||||
case 3:
|
||||
PrintLog("CDVDiso DVD: Use Minimum Rate for: DVD-RW");
|
||||
break;
|
||||
case 9:
|
||||
PrintLog("CDVDiso DVD: Use Minimum Rate for: DVD+RW");
|
||||
break;
|
||||
default:
|
||||
PrintLog("CDVDiso DVD: Use Minimum Rate for: Unknown (%i)", layer.d.MinimumRate);
|
||||
break;
|
||||
} // ENDSWITCH- Displaying the Minimum (Spin?) Rate
|
||||
switch (layer.d.DiskSize)
|
||||
{
|
||||
case 0:
|
||||
PrintLog("CDVDiso DVD: Physical Disk Size: 120mm");
|
||||
break;
|
||||
case 1:
|
||||
PrintLog("CDVDiso DVD: Physical Disk Size: 80mm");
|
||||
break;
|
||||
default:
|
||||
PrintLog("CDVDiso DVD: Physical Disk Size: Unknown (%i)", layer.d.DiskSize);
|
||||
break;
|
||||
} // ENDSWITCH- What's the Disk Size?
|
||||
switch (layer.d.LayerType)
|
||||
{
|
||||
case 1:
|
||||
PrintLog("CDVDiso DVD: Layer Type: Read-Only");
|
||||
break;
|
||||
case 2:
|
||||
PrintLog("CDVDiso DVD: Layer Type: Recordable");
|
||||
break;
|
||||
case 4:
|
||||
PrintLog("CDVDiso DVD: Layer Type: Rewritable");
|
||||
break;
|
||||
default:
|
||||
PrintLog("CDVDiso DVD: Layer Type: Unknown (%i)", layer.d.LayerType);
|
||||
break;
|
||||
} // ENDSWITCH- Displaying the Layer Type
|
||||
switch (layer.d.TrackPath)
|
||||
{
|
||||
case 0:
|
||||
PrintLog("CDVDiso DVD: Track Path: PTP");
|
||||
break;
|
||||
case 1:
|
||||
PrintLog("CDVDiso DVD: Track Path: OTP");
|
||||
break;
|
||||
default:
|
||||
PrintLog("CDVDiso DVD: Track Path: Unknown (%i)", layer.d.TrackPath);
|
||||
break;
|
||||
} // ENDSWITCH- What's Track Path Layout?
|
||||
PrintLog("CDVDiso DVD: Number of Layers: %i", layer.d.NumberOfLayers + 1);
|
||||
switch (layer.d.TrackDensity)
|
||||
{
|
||||
case 0:
|
||||
PrintLog("CDVDiso DVD: Track Density: .74 m/track");
|
||||
break;
|
||||
case 1:
|
||||
PrintLog("CDVDiso DVD: Track Density: .8 m/track");
|
||||
break;
|
||||
case 2:
|
||||
PrintLog("CDVDiso DVD: Track Density: .615 m/track");
|
||||
break;
|
||||
default:
|
||||
PrintLog("CDVDiso DVD: Track Density: Unknown (%i)", layer.d.TrackDensity);
|
||||
break;
|
||||
} // ENDSWITCH- Displaying the Layer Type
|
||||
switch (layer.d.LinearDensity)
|
||||
{
|
||||
case 0:
|
||||
PrintLog("CDVDiso DVD: Linear Density: .267 m/bit");
|
||||
break;
|
||||
case 1:
|
||||
PrintLog("CDVDiso DVD: Linear Density: .293 m/bit");
|
||||
break;
|
||||
case 2:
|
||||
PrintLog("CDVDiso DVD: Linear Density: .409 to .435 m/bit");
|
||||
break;
|
||||
case 4:
|
||||
PrintLog("CDVDiso DVD: Linear Density: .280 to .291 m/bit");
|
||||
break;
|
||||
case 8:
|
||||
PrintLog("CDVDiso DVD: Linear Density: .353 m/bit");
|
||||
break;
|
||||
default:
|
||||
PrintLog("CDVDiso DVD: Linear Density: Unknown (%i)", layer.d.LinearDensity);
|
||||
break;
|
||||
} // ENDSWITCH- Displaying the Book Type
|
||||
if (layer.d.StartingDataSector == 0x30000)
|
||||
{
|
||||
PrintLog("CDVDiso DVD: Starting Sector: %lu (DVD-ROM, DVD-R, DVD-RW)",
|
||||
layer.d.StartingDataSector);
|
||||
}
|
||||
else if (layer.d.StartingDataSector == 0x31000)
|
||||
{
|
||||
PrintLog("CDVDiso DVD: Starting Sector: %lu (DVD-RAM, DVD+RW)",
|
||||
layer.d.StartingDataSector);
|
||||
}
|
||||
else
|
||||
{
|
||||
PrintLog("CDVDiso DVD: Starting Sector: %lu", layer.d.StartingDataSector);
|
||||
} // ENDLONGIF- What does the starting sector tell us?
|
||||
PrintLog("CDVDiso DVD: End of Layer 0: %lu", layer.d.EndLayerZeroSector);
|
||||
PrintLog("CDVDiso DVD: Ending Sector: %lu", layer.d.EndDataSector);
|
||||
if (layer.d.BCAFlag != 0) PrintLog("CDVDiso 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("CDVDiso DVD: Couldn't end the session!");
|
||||
PrintError("CDVDiso 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("CDVDiso 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("CDVDiso DVD: Couldn't read sector!");
|
||||
PrintError("CDVDiso 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("CDVDiso CD: Short block! only got %u out of %u bytes",
|
||||
byteswritten, 2048);
|
||||
PrintError("CDVDiso 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("CDVDiso 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("CDVDiso 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("CDVDiso 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("CDVDiso DVD: Found Single-Sided DVD.");
|
||||
#endif /* VERBOSE_DISC_INFO */
|
||||
disctype = CDVD_TYPE_DETCTDVDS;
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef VERBOSE_DISC_INFO
|
||||
PrintLog("CDVDiso 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("CDVDiso DVD: Found Playstation 2 DVD.");
|
||||
#endif /* VERBOSE_DISC_TYPE */
|
||||
tempdisctype = CDVD_TYPE_PS2DVD;
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef VERBOSE_DISC_TYPE
|
||||
PrintLog("CDVDiso 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,33 +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 */
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue