Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9a3eeff439 | |||
| daf6ca4b25 | |||
| f909b1e8a3 | |||
| 03a35ab963 | |||
| cf410b6700 |
@@ -0,0 +1,36 @@
|
||||
Version 1.5.2
|
||||
-------------
|
||||
- Fix potential buffer overflow in MD5 digest conversion to string
|
||||
|
||||
Version 1.5.1
|
||||
-------------
|
||||
- C Standards compliance improvements
|
||||
- Build improvements
|
||||
|
||||
Version 1.5.0
|
||||
-------------
|
||||
- Initial tagged release after fork from ProSystem 1.3e with OpenEmu patches
|
||||
- Convert from C++ to C
|
||||
- Partial Expansion Module (XM) support
|
||||
- XRAM
|
||||
- XPokey (limited to single Pokey)
|
||||
- Added support for cartridges with sizes greater than 144k
|
||||
- Additional bank switching modes and cartridge types
|
||||
- Multiple bank switching fixes
|
||||
- Reworked cartridge header detection
|
||||
- Now properly detects bank switching, RAM, etc.
|
||||
- Detects Expansion Module (XM)
|
||||
- Detects High score cartridge
|
||||
- Detects Pokey at $0450
|
||||
- Cartridge database
|
||||
- Added several new cartridge properties
|
||||
- Pokey at $0450
|
||||
- Default difficulty switch settings
|
||||
- Expansion Module (XM) enabled/disabled
|
||||
- High score cartridge enabled/disabled
|
||||
- Database content
|
||||
- Fixed incorrect controller settings for Sirius, Crossbow,
|
||||
and Alien Brigade
|
||||
- Added many homebrew cartridges
|
||||
- Fixed issue occurring when Kangaroo and Holey were enabled (caused
|
||||
background to be displayed, resulting in large black squares)
|
||||
+2
-2
@@ -17,7 +17,7 @@
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.4.2</string>
|
||||
<string>1.5.2</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>OEGameCoreController</string>
|
||||
<key>OEGameCoreClass</key>
|
||||
@@ -37,7 +37,7 @@
|
||||
<key>OEGameCorePlayerCount</key>
|
||||
<string>2</string>
|
||||
<key>OEProjectURL</key>
|
||||
<string>http://home.comcast.net/~gscottstanton/</string>
|
||||
<string>https://gitlab.com/jgemu/prosystem</string>
|
||||
<key>OESystemIdentifiers</key>
|
||||
<array>
|
||||
<string>openemu.system.7800</string>
|
||||
|
||||
@@ -0,0 +1,340 @@
|
||||
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.
|
||||
-132
@@ -1,132 +0,0 @@
|
||||
/* crypt.h -- base code for crypt/uncrypt ZIPfile
|
||||
|
||||
|
||||
Version 1.01e, February 12th, 2005
|
||||
|
||||
Copyright (C) 1998-2005 Gilles Vollant
|
||||
|
||||
This code is a modified version of crypting code in Infozip distribution
|
||||
|
||||
The encryption/decryption parts of this source code (as opposed to the
|
||||
non-echoing password parts) were originally written in Europe. The
|
||||
whole source package can be freely distributed, including from the USA.
|
||||
(Prior to January 2000, re-export from the US was a violation of US law.)
|
||||
|
||||
This encryption code is a direct transcription of the algorithm from
|
||||
Roger Schlafly, described by Phil Katz in the file appnote.txt. This
|
||||
file (appnote.txt) is distributed with the PKZIP program (even in the
|
||||
version without encryption capabilities).
|
||||
|
||||
If you don't need crypting in your application, just define symbols
|
||||
NOCRYPT and NOUNCRYPT.
|
||||
|
||||
This code support the "Traditional PKWARE Encryption".
|
||||
|
||||
The new AES encryption added on Zip format by Winzip (see the page
|
||||
http://www.winzip.com/aes_info.htm ) and PKWare PKZip 5.x Strong
|
||||
Encryption is not supported.
|
||||
*/
|
||||
|
||||
#define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8))
|
||||
|
||||
/***********************************************************************
|
||||
* Return the next byte in the pseudo-random sequence
|
||||
*/
|
||||
static int decrypt_byte(unsigned long* pkeys, const unsigned long* pcrc_32_tab)
|
||||
{
|
||||
unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an
|
||||
* unpredictable manner on 16-bit systems; not a problem
|
||||
* with any known compiler so far, though */
|
||||
|
||||
temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2;
|
||||
return (int)(((temp * (temp ^ 1)) >> 8) & 0xff);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* Update the encryption keys with the next byte of plain text
|
||||
*/
|
||||
static int update_keys(unsigned long* pkeys,const unsigned long* pcrc_32_tab,int c)
|
||||
{
|
||||
(*(pkeys+0)) = CRC32((*(pkeys+0)), c);
|
||||
(*(pkeys+1)) += (*(pkeys+0)) & 0xff;
|
||||
(*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1;
|
||||
{
|
||||
register int keyshift = (int)((*(pkeys+1)) >> 24);
|
||||
(*(pkeys+2)) = CRC32((*(pkeys+2)), keyshift);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* Initialize the encryption keys and the random header according to
|
||||
* the given password.
|
||||
*/
|
||||
static void init_keys(const char* passwd,unsigned long* pkeys,const unsigned long* pcrc_32_tab)
|
||||
{
|
||||
*(pkeys+0) = 305419896L;
|
||||
*(pkeys+1) = 591751049L;
|
||||
*(pkeys+2) = 878082192L;
|
||||
while (*passwd != '\0') {
|
||||
update_keys(pkeys,pcrc_32_tab,(int)*passwd);
|
||||
passwd++;
|
||||
}
|
||||
}
|
||||
|
||||
#define zdecode(pkeys,pcrc_32_tab,c) \
|
||||
(update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab)))
|
||||
|
||||
#define zencode(pkeys,pcrc_32_tab,c,t) \
|
||||
(t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), t^(c))
|
||||
|
||||
#ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED
|
||||
|
||||
#define RAND_HEAD_LEN 12
|
||||
/* "last resort" source for second part of crypt seed pattern */
|
||||
# ifndef ZCR_SEED2
|
||||
# define ZCR_SEED2 3141592654UL /* use PI as default pattern */
|
||||
# endif
|
||||
|
||||
static int crypthead(passwd, buf, bufSize, pkeys, pcrc_32_tab, crcForCrypting)
|
||||
const char *passwd; /* password string */
|
||||
unsigned char *buf; /* where to write header */
|
||||
int bufSize;
|
||||
unsigned long* pkeys;
|
||||
const unsigned long* pcrc_32_tab;
|
||||
unsigned long crcForCrypting;
|
||||
{
|
||||
int n; /* index in random header */
|
||||
int t; /* temporary */
|
||||
int c; /* random byte */
|
||||
unsigned char header[RAND_HEAD_LEN-2]; /* random header */
|
||||
static unsigned calls = 0; /* ensure different random header each time */
|
||||
|
||||
if (bufSize<RAND_HEAD_LEN)
|
||||
return 0;
|
||||
|
||||
/* First generate RAND_HEAD_LEN-2 random bytes. We encrypt the
|
||||
* output of rand() to get less predictability, since rand() is
|
||||
* often poorly implemented.
|
||||
*/
|
||||
if (++calls == 1)
|
||||
{
|
||||
srand((unsigned)(time(NULL) ^ ZCR_SEED2));
|
||||
}
|
||||
init_keys(passwd, pkeys, pcrc_32_tab);
|
||||
for (n = 0; n < RAND_HEAD_LEN-2; n++)
|
||||
{
|
||||
c = (rand() >> 7) & 0xff;
|
||||
header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t);
|
||||
}
|
||||
/* Encrypt random header (last two bytes is high word of crc) */
|
||||
init_keys(passwd, pkeys, pcrc_32_tab);
|
||||
for (n = 0; n < RAND_HEAD_LEN-2; n++)
|
||||
{
|
||||
buf[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, header[n], t);
|
||||
}
|
||||
buf[n++] = zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 16) & 0xff, t);
|
||||
buf[n++] = zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 24) & 0xff, t);
|
||||
return n;
|
||||
}
|
||||
|
||||
#endif
|
||||
-426
@@ -1,426 +0,0 @@
|
||||
/****************************************************************************
|
||||
* *
|
||||
* HtmlHelp.h *
|
||||
* *
|
||||
* Copyright (c) 1996-1997, Microsoft Corp. All rights reserved. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#ifndef __HTMLHELP_H__
|
||||
#define __HTMLHELP_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
// Defines for Win64
|
||||
#ifndef _WIN64
|
||||
#define DWORD_PTR DWORD
|
||||
#endif
|
||||
|
||||
// Commands to pass to HtmlHelp()
|
||||
|
||||
#define HH_DISPLAY_TOPIC 0x0000
|
||||
#define HH_HELP_FINDER 0x0000 // WinHelp equivalent
|
||||
#define HH_DISPLAY_TOC 0x0001
|
||||
#define HH_DISPLAY_INDEX 0x0002
|
||||
#define HH_DISPLAY_SEARCH 0x0003
|
||||
#define HH_SET_WIN_TYPE 0x0004
|
||||
#define HH_GET_WIN_TYPE 0x0005
|
||||
#define HH_GET_WIN_HANDLE 0x0006
|
||||
#define HH_ENUM_INFO_TYPE 0x0007 // Get Info type name, call repeatedly to enumerate, -1 at end
|
||||
#define HH_SET_INFO_TYPE 0x0008 // Add Info type to filter.
|
||||
#define HH_SYNC 0x0009
|
||||
#define HH_RESERVED1 0x000A
|
||||
#define HH_RESERVED2 0x000B
|
||||
#define HH_RESERVED3 0x000C
|
||||
#define HH_KEYWORD_LOOKUP 0x000D
|
||||
#define HH_DISPLAY_TEXT_POPUP 0x000E // display string resource id or text in a popup window
|
||||
#define HH_HELP_CONTEXT 0x000F // display mapped numeric value in dwData
|
||||
#define HH_TP_HELP_CONTEXTMENU 0x0010 // text popup help, same as WinHelp HELP_CONTEXTMENU
|
||||
#define HH_TP_HELP_WM_HELP 0x0011 // text popup help, same as WinHelp HELP_WM_HELP
|
||||
#define HH_CLOSE_ALL 0x0012 // close all windows opened directly or indirectly by the caller
|
||||
#define HH_ALINK_LOOKUP 0x0013 // ALink version of HH_KEYWORD_LOOKUP
|
||||
#define HH_GET_LAST_ERROR 0x0014 // not currently implemented // See HHERROR.h
|
||||
#define HH_ENUM_CATEGORY 0x0015 // Get category name, call repeatedly to enumerate, -1 at end
|
||||
#define HH_ENUM_CATEGORY_IT 0x0016 // Get category info type members, call repeatedly to enumerate, -1 at end
|
||||
#define HH_RESET_IT_FILTER 0x0017 // Clear the info type filter of all info types.
|
||||
#define HH_SET_INCLUSIVE_FILTER 0x0018 // set inclusive filtering method for untyped topics to be included in display
|
||||
#define HH_SET_EXCLUSIVE_FILTER 0x0019 // set exclusive filtering method for untyped topics to be excluded from display
|
||||
#define HH_INITIALIZE 0x001C // Initializes the help system.
|
||||
#define HH_UNINITIALIZE 0x001D // Uninitializes the help system.
|
||||
#define HH_PRETRANSLATEMESSAGE 0x00fd // Pumps messages. (NULL, NULL, MSG*).
|
||||
#define HH_SET_GLOBAL_PROPERTY 0x00fc // Set a global property. (NULL, NULL, HH_GPROP)
|
||||
|
||||
#define HHWIN_PROP_TAB_AUTOHIDESHOW (1 << 0) // Automatically hide/show tri-pane window
|
||||
#define HHWIN_PROP_ONTOP (1 << 1) // Top-most window
|
||||
#define HHWIN_PROP_NOTITLEBAR (1 << 2) // no title bar
|
||||
#define HHWIN_PROP_NODEF_STYLES (1 << 3) // no default window styles (only HH_WINTYPE.dwStyles)
|
||||
#define HHWIN_PROP_NODEF_EXSTYLES (1 << 4) // no default extended window styles (only HH_WINTYPE.dwExStyles)
|
||||
#define HHWIN_PROP_TRI_PANE (1 << 5) // use a tri-pane window
|
||||
#define HHWIN_PROP_NOTB_TEXT (1 << 6) // no text on toolbar buttons
|
||||
#define HHWIN_PROP_POST_QUIT (1 << 7) // post WM_QUIT message when window closes
|
||||
#define HHWIN_PROP_AUTO_SYNC (1 << 8) // automatically ssync contents and index
|
||||
#define HHWIN_PROP_TRACKING (1 << 9) // send tracking notification messages
|
||||
#define HHWIN_PROP_TAB_SEARCH (1 << 10) // include search tab in navigation pane
|
||||
#define HHWIN_PROP_TAB_HISTORY (1 << 11) // include history tab in navigation pane
|
||||
#define HHWIN_PROP_TAB_FAVORITES (1 << 12) // include favorites tab in navigation pane
|
||||
#define HHWIN_PROP_CHANGE_TITLE (1 << 13) // Put current HTML title in title bar
|
||||
#define HHWIN_PROP_NAV_ONLY_WIN (1 << 14) // Only display the navigation window
|
||||
#define HHWIN_PROP_NO_TOOLBAR (1 << 15) // Don't display a toolbar
|
||||
#define HHWIN_PROP_MENU (1 << 16) // Menu
|
||||
#define HHWIN_PROP_TAB_ADVSEARCH (1 << 17) // Advanced FTS UI.
|
||||
#define HHWIN_PROP_USER_POS (1 << 18) // After initial creation, user controls window size/position
|
||||
#define HHWIN_PROP_TAB_CUSTOM1 (1 << 19) // Use custom tab #1
|
||||
#define HHWIN_PROP_TAB_CUSTOM2 (1 << 20) // Use custom tab #2
|
||||
#define HHWIN_PROP_TAB_CUSTOM3 (1 << 21) // Use custom tab #3
|
||||
#define HHWIN_PROP_TAB_CUSTOM4 (1 << 22) // Use custom tab #4
|
||||
#define HHWIN_PROP_TAB_CUSTOM5 (1 << 23) // Use custom tab #5
|
||||
#define HHWIN_PROP_TAB_CUSTOM6 (1 << 24) // Use custom tab #6
|
||||
#define HHWIN_PROP_TAB_CUSTOM7 (1 << 25) // Use custom tab #7
|
||||
#define HHWIN_PROP_TAB_CUSTOM8 (1 << 26) // Use custom tab #8
|
||||
#define HHWIN_PROP_TAB_CUSTOM9 (1 << 27) // Use custom tab #9
|
||||
#define HHWIN_TB_MARGIN (1 << 28) // the window type has a margin
|
||||
|
||||
#define HHWIN_PARAM_PROPERTIES (1 << 1) // valid fsWinProperties
|
||||
#define HHWIN_PARAM_STYLES (1 << 2) // valid dwStyles
|
||||
#define HHWIN_PARAM_EXSTYLES (1 << 3) // valid dwExStyles
|
||||
#define HHWIN_PARAM_RECT (1 << 4) // valid rcWindowPos
|
||||
#define HHWIN_PARAM_NAV_WIDTH (1 << 5) // valid iNavWidth
|
||||
#define HHWIN_PARAM_SHOWSTATE (1 << 6) // valid nShowState
|
||||
#define HHWIN_PARAM_INFOTYPES (1 << 7) // valid apInfoTypes
|
||||
#define HHWIN_PARAM_TB_FLAGS (1 << 8) // valid fsToolBarFlags
|
||||
#define HHWIN_PARAM_EXPANSION (1 << 9) // valid fNotExpanded
|
||||
#define HHWIN_PARAM_TABPOS (1 << 10) // valid tabpos
|
||||
#define HHWIN_PARAM_TABORDER (1 << 11) // valid taborder
|
||||
#define HHWIN_PARAM_HISTORY_COUNT (1 << 12) // valid cHistory
|
||||
#define HHWIN_PARAM_CUR_TAB (1 << 13) // valid curNavType
|
||||
|
||||
#define HHWIN_BUTTON_EXPAND (1 << 1) // Expand/contract button
|
||||
#define HHWIN_BUTTON_BACK (1 << 2) // Back button
|
||||
#define HHWIN_BUTTON_FORWARD (1 << 3) // Forward button
|
||||
#define HHWIN_BUTTON_STOP (1 << 4) // Stop button
|
||||
#define HHWIN_BUTTON_REFRESH (1 << 5) // Refresh button
|
||||
#define HHWIN_BUTTON_HOME (1 << 6) // Home button
|
||||
#define HHWIN_BUTTON_BROWSE_FWD (1 << 7) // not implemented
|
||||
#define HHWIN_BUTTON_BROWSE_BCK (1 << 8) // not implemented
|
||||
#define HHWIN_BUTTON_NOTES (1 << 9) // not implemented
|
||||
#define HHWIN_BUTTON_CONTENTS (1 << 10) // not implemented
|
||||
#define HHWIN_BUTTON_SYNC (1 << 11) // Sync button
|
||||
#define HHWIN_BUTTON_OPTIONS (1 << 12) // Options button
|
||||
#define HHWIN_BUTTON_PRINT (1 << 13) // Print button
|
||||
#define HHWIN_BUTTON_INDEX (1 << 14) // not implemented
|
||||
#define HHWIN_BUTTON_SEARCH (1 << 15) // not implemented
|
||||
#define HHWIN_BUTTON_HISTORY (1 << 16) // not implemented
|
||||
#define HHWIN_BUTTON_FAVORITES (1 << 17) // not implemented
|
||||
#define HHWIN_BUTTON_JUMP1 (1 << 18)
|
||||
#define HHWIN_BUTTON_JUMP2 (1 << 19)
|
||||
#define HHWIN_BUTTON_ZOOM (1 << 20)
|
||||
#define HHWIN_BUTTON_TOC_NEXT (1 << 21)
|
||||
#define HHWIN_BUTTON_TOC_PREV (1 << 22)
|
||||
|
||||
#define HHWIN_DEF_BUTTONS \
|
||||
(HHWIN_BUTTON_EXPAND | \
|
||||
HHWIN_BUTTON_BACK | \
|
||||
HHWIN_BUTTON_OPTIONS | \
|
||||
HHWIN_BUTTON_PRINT)
|
||||
|
||||
// Button IDs
|
||||
|
||||
#define IDTB_EXPAND 200
|
||||
#define IDTB_CONTRACT 201
|
||||
#define IDTB_STOP 202
|
||||
#define IDTB_REFRESH 203
|
||||
#define IDTB_BACK 204
|
||||
#define IDTB_HOME 205
|
||||
#define IDTB_SYNC 206
|
||||
#define IDTB_PRINT 207
|
||||
#define IDTB_OPTIONS 208
|
||||
#define IDTB_FORWARD 209
|
||||
#define IDTB_NOTES 210 // not implemented
|
||||
#define IDTB_BROWSE_FWD 211
|
||||
#define IDTB_BROWSE_BACK 212
|
||||
#define IDTB_CONTENTS 213 // not implemented
|
||||
#define IDTB_INDEX 214 // not implemented
|
||||
#define IDTB_SEARCH 215 // not implemented
|
||||
#define IDTB_HISTORY 216 // not implemented
|
||||
#define IDTB_FAVORITES 217 // not implemented
|
||||
#define IDTB_JUMP1 218
|
||||
#define IDTB_JUMP2 219
|
||||
#define IDTB_CUSTOMIZE 221
|
||||
#define IDTB_ZOOM 222
|
||||
#define IDTB_TOC_NEXT 223
|
||||
#define IDTB_TOC_PREV 224
|
||||
|
||||
// Notification codes
|
||||
|
||||
#define HHN_FIRST (0U-860U)
|
||||
#define HHN_LAST (0U-879U)
|
||||
|
||||
#define HHN_NAVCOMPLETE (HHN_FIRST-0)
|
||||
#define HHN_TRACK (HHN_FIRST-1)
|
||||
#define HHN_WINDOW_CREATE (HHN_FIRST-2)
|
||||
|
||||
typedef struct tagHHN_NOTIFY
|
||||
{
|
||||
NMHDR hdr;
|
||||
PCSTR pszUrl; // Multi-byte, null-terminated string
|
||||
} HHN_NOTIFY;
|
||||
|
||||
typedef struct tagHH_POPUP
|
||||
{
|
||||
int cbStruct; // sizeof this structure
|
||||
HINSTANCE hinst; // instance handle for string resource
|
||||
UINT idString; // string resource id, or text id if pszFile is specified in HtmlHelp call
|
||||
LPCTSTR pszText; // used if idString is zero
|
||||
POINT pt; // top center of popup window
|
||||
COLORREF clrForeground; // use -1 for default
|
||||
COLORREF clrBackground; // use -1 for default
|
||||
RECT rcMargins; // amount of space between edges of window and text, -1 for each member to ignore
|
||||
LPCTSTR pszFont; // facename, point size, char set, BOLD ITALIC UNDERLINE
|
||||
} HH_POPUP;
|
||||
|
||||
typedef struct tagHH_AKLINK
|
||||
{
|
||||
int cbStruct; // sizeof this structure
|
||||
BOOL fReserved; // must be FALSE (really!)
|
||||
LPCTSTR pszKeywords; // semi-colon separated keywords
|
||||
LPCTSTR pszUrl; // URL to jump to if no keywords found (may be NULL)
|
||||
LPCTSTR pszMsgText; // Message text to display in MessageBox if pszUrl is NULL and no keyword match
|
||||
LPCTSTR pszMsgTitle; // Message text to display in MessageBox if pszUrl is NULL and no keyword match
|
||||
LPCTSTR pszWindow; // Window to display URL in
|
||||
BOOL fIndexOnFail; // Displays index if keyword lookup fails.
|
||||
} HH_AKLINK;
|
||||
|
||||
enum {
|
||||
HHWIN_NAVTYPE_TOC,
|
||||
HHWIN_NAVTYPE_INDEX,
|
||||
HHWIN_NAVTYPE_SEARCH,
|
||||
HHWIN_NAVTYPE_FAVORITES,
|
||||
HHWIN_NAVTYPE_HISTORY, // not implemented
|
||||
HHWIN_NAVTYPE_AUTHOR,
|
||||
HHWIN_NAVTYPE_CUSTOM_FIRST = 11
|
||||
};
|
||||
|
||||
enum {
|
||||
IT_INCLUSIVE,
|
||||
IT_EXCLUSIVE,
|
||||
IT_HIDDEN,
|
||||
};
|
||||
|
||||
typedef struct tagHH_ENUM_IT
|
||||
{
|
||||
int cbStruct; // size of this structure
|
||||
int iType; // the type of the information type ie. Inclusive, Exclusive, or Hidden
|
||||
LPCSTR pszCatName; // Set to the name of the Category to enumerate the info types in a category; else NULL
|
||||
LPCSTR pszITName; // volitile pointer to the name of the infotype. Allocated by call. Caller responsible for freeing
|
||||
LPCSTR pszITDescription; // volitile pointer to the description of the infotype.
|
||||
} HH_ENUM_IT, *PHH_ENUM_IT;
|
||||
|
||||
typedef struct tagHH_ENUM_CAT
|
||||
{
|
||||
int cbStruct; // size of this structure
|
||||
LPCSTR pszCatName; // volitile pointer to the category name
|
||||
LPCSTR pszCatDescription; // volitile pointer to the category description
|
||||
} HH_ENUM_CAT, *PHH_ENUM_CAT;
|
||||
|
||||
typedef struct tagHH_SET_INFOTYPE
|
||||
{
|
||||
int cbStruct; // the size of this structure
|
||||
LPCSTR pszCatName; // the name of the category, if any, the InfoType is a member of.
|
||||
LPCSTR pszInfoTypeName; // the name of the info type to add to the filter
|
||||
} HH_SET_INFOTYPE, *PHH_SET_INFOTYPE;
|
||||
|
||||
typedef DWORD HH_INFOTYPE;
|
||||
typedef HH_INFOTYPE* PHH_INFOTYPE;
|
||||
|
||||
enum {
|
||||
HHWIN_NAVTAB_TOP,
|
||||
HHWIN_NAVTAB_LEFT,
|
||||
HHWIN_NAVTAB_BOTTOM,
|
||||
};
|
||||
|
||||
#define HH_MAX_TABS 19 // maximum number of tabs
|
||||
|
||||
enum {
|
||||
HH_TAB_CONTENTS,
|
||||
HH_TAB_INDEX,
|
||||
HH_TAB_SEARCH,
|
||||
HH_TAB_FAVORITES,
|
||||
HH_TAB_HISTORY,
|
||||
HH_TAB_AUTHOR,
|
||||
|
||||
HH_TAB_CUSTOM_FIRST = 11,
|
||||
HH_TAB_CUSTOM_LAST = HH_MAX_TABS
|
||||
};
|
||||
|
||||
#define HH_MAX_TABS_CUSTOM (HH_TAB_CUSTOM_LAST - HH_TAB_CUSTOM_FIRST + 1)
|
||||
|
||||
// HH_DISPLAY_SEARCH Command Related Structures and Constants
|
||||
|
||||
#define HH_FTS_DEFAULT_PROXIMITY (-1)
|
||||
|
||||
typedef struct tagHH_FTS_QUERY
|
||||
{
|
||||
int cbStruct; // Sizeof structure in bytes.
|
||||
BOOL fUniCodeStrings; // TRUE if all strings are unicode.
|
||||
LPCTSTR pszSearchQuery; // String containing the search query.
|
||||
LONG iProximity; // Word proximity.
|
||||
BOOL fStemmedSearch; // TRUE for StemmedSearch only.
|
||||
BOOL fTitleOnly; // TRUE for Title search only.
|
||||
BOOL fExecute; // TRUE to initiate the search.
|
||||
LPCTSTR pszWindow; // Window to display in
|
||||
} HH_FTS_QUERY;
|
||||
|
||||
// HH_WINTYPE Structure
|
||||
|
||||
typedef struct tagHH_WINTYPE {
|
||||
int cbStruct; // IN: size of this structure including all Information Types
|
||||
BOOL fUniCodeStrings; // IN/OUT: TRUE if all strings are in UNICODE
|
||||
LPCTSTR pszType; // IN/OUT: Name of a type of window
|
||||
DWORD fsValidMembers; // IN: Bit flag of valid members (HHWIN_PARAM_)
|
||||
DWORD fsWinProperties; // IN/OUT: Properties/attributes of the window (HHWIN_)
|
||||
|
||||
LPCTSTR pszCaption; // IN/OUT: Window title
|
||||
DWORD dwStyles; // IN/OUT: Window styles
|
||||
DWORD dwExStyles; // IN/OUT: Extended Window styles
|
||||
RECT rcWindowPos; // IN: Starting position, OUT: current position
|
||||
int nShowState; // IN: show state (e.g., SW_SHOW)
|
||||
|
||||
HWND hwndHelp; // OUT: window handle
|
||||
HWND hwndCaller; // OUT: who called this window
|
||||
|
||||
HH_INFOTYPE* paInfoTypes; // IN: Pointer to an array of Information Types
|
||||
|
||||
// The following members are only valid if HHWIN_PROP_TRI_PANE is set
|
||||
|
||||
HWND hwndToolBar; // OUT: toolbar window in tri-pane window
|
||||
HWND hwndNavigation; // OUT: navigation window in tri-pane window
|
||||
HWND hwndHTML; // OUT: window displaying HTML in tri-pane window
|
||||
int iNavWidth; // IN/OUT: width of navigation window
|
||||
RECT rcHTML; // OUT: HTML window coordinates
|
||||
|
||||
LPCTSTR pszToc; // IN: Location of the table of contents file
|
||||
LPCTSTR pszIndex; // IN: Location of the index file
|
||||
LPCTSTR pszFile; // IN: Default location of the html file
|
||||
LPCTSTR pszHome; // IN/OUT: html file to display when Home button is clicked
|
||||
DWORD fsToolBarFlags; // IN: flags controling the appearance of the toolbar
|
||||
BOOL fNotExpanded; // IN: TRUE/FALSE to contract or expand, OUT: current state
|
||||
int curNavType; // IN/OUT: UI to display in the navigational pane
|
||||
int tabpos; // IN/OUT: HHWIN_NAVTAB_TOP, HHWIN_NAVTAB_LEFT, or HHWIN_NAVTAB_BOTTOM
|
||||
int idNotify; // IN: ID to use for WM_NOTIFY messages
|
||||
BYTE tabOrder[HH_MAX_TABS + 1]; // IN/OUT: tab order: Contents, Index, Search, History, Favorites, Reserved 1-5, Custom tabs
|
||||
int cHistory; // IN/OUT: number of history items to keep (default is 30)
|
||||
LPCTSTR pszJump1; // Text for HHWIN_BUTTON_JUMP1
|
||||
LPCTSTR pszJump2; // Text for HHWIN_BUTTON_JUMP2
|
||||
LPCTSTR pszUrlJump1; // URL for HHWIN_BUTTON_JUMP1
|
||||
LPCTSTR pszUrlJump2; // URL for HHWIN_BUTTON_JUMP2
|
||||
RECT rcMinSize; // Minimum size for window (ignored in version 1)
|
||||
int cbInfoTypes; // size of paInfoTypes;
|
||||
LPCTSTR pszCustomTabs; // multiple zero-terminated strings
|
||||
} HH_WINTYPE, *PHH_WINTYPE;
|
||||
|
||||
enum {
|
||||
HHACT_TAB_CONTENTS,
|
||||
HHACT_TAB_INDEX,
|
||||
HHACT_TAB_SEARCH,
|
||||
HHACT_TAB_HISTORY,
|
||||
HHACT_TAB_FAVORITES,
|
||||
|
||||
HHACT_EXPAND,
|
||||
HHACT_CONTRACT,
|
||||
HHACT_BACK,
|
||||
HHACT_FORWARD,
|
||||
HHACT_STOP,
|
||||
HHACT_REFRESH,
|
||||
HHACT_HOME,
|
||||
HHACT_SYNC,
|
||||
HHACT_OPTIONS,
|
||||
HHACT_PRINT,
|
||||
HHACT_HIGHLIGHT,
|
||||
HHACT_CUSTOMIZE,
|
||||
HHACT_JUMP1,
|
||||
HHACT_JUMP2,
|
||||
HHACT_ZOOM,
|
||||
HHACT_TOC_NEXT,
|
||||
HHACT_TOC_PREV,
|
||||
HHACT_NOTES,
|
||||
|
||||
HHACT_LAST_ENUM,
|
||||
};
|
||||
|
||||
typedef struct tagHHNTRACK
|
||||
{
|
||||
NMHDR hdr;
|
||||
PCSTR pszCurUrl; // Multi-byte, null-terminated string
|
||||
int idAction; // HHACT_ value
|
||||
HH_WINTYPE* phhWinType; // Current window type structure
|
||||
} HHNTRACK;
|
||||
|
||||
HWND
|
||||
WINAPI
|
||||
HtmlHelpA(
|
||||
HWND hwndCaller,
|
||||
LPCSTR pszFile,
|
||||
UINT uCommand,
|
||||
DWORD_PTR dwData
|
||||
);
|
||||
|
||||
HWND
|
||||
WINAPI
|
||||
HtmlHelpW(
|
||||
HWND hwndCaller,
|
||||
LPCWSTR pszFile,
|
||||
UINT uCommand,
|
||||
DWORD_PTR dwData
|
||||
);
|
||||
#ifdef UNICODE
|
||||
#define HtmlHelp HtmlHelpW
|
||||
#else
|
||||
#define HtmlHelp HtmlHelpA
|
||||
#endif // !UNICODE
|
||||
|
||||
// Use the following for GetProcAddress to load from hhctrl.ocx
|
||||
|
||||
#define ATOM_HTMLHELP_API_ANSI (LPTSTR)((DWORD)((WORD)(14)))
|
||||
#define ATOM_HTMLHELP_API_UNICODE (LPTSTR)((DWORD)((WORD)(15)))
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Global Control Properties.
|
||||
//
|
||||
typedef enum tagHH_GPROPID
|
||||
{
|
||||
HH_GPROPID_SINGLETHREAD=1, // VARIANT_BOOL: True for single thread
|
||||
HH_GPROPID_TOOLBAR_MARGIN=2, // long: Provides a left/right margin around the toolbar.
|
||||
HH_GPROPID_UI_LANGUAGE=3, // long: LangId of the UI.
|
||||
HH_GPROPID_CURRENT_SUBSET=4, // BSTR: Current subset.
|
||||
HH_GPROPID_CONTENT_LANGUAGE=5 // long: LandId for desired content.
|
||||
} HH_GPROPID;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Global Property structure
|
||||
//
|
||||
#ifdef __oaidl_h__
|
||||
|
||||
#pragma pack(push, 8)
|
||||
|
||||
typedef struct tagHH_GLOBAL_PROPERTY
|
||||
{
|
||||
HH_GPROPID id;
|
||||
VARIANT var;
|
||||
} HH_GLOBAL_PROPERTY ;
|
||||
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // __HTMLHELP_H__
|
||||
-75
@@ -1,75 +0,0 @@
|
||||
/* ioapi.h -- IO base function header for compress/uncompress .zip
|
||||
files using zlib + zip or unzip API
|
||||
|
||||
Version 1.01e, February 12th, 2005
|
||||
|
||||
Copyright (C) 1998-2005 Gilles Vollant
|
||||
*/
|
||||
|
||||
#ifndef _ZLIBIOAPI_H
|
||||
#define _ZLIBIOAPI_H
|
||||
|
||||
|
||||
#define ZLIB_FILEFUNC_SEEK_CUR (1)
|
||||
#define ZLIB_FILEFUNC_SEEK_END (2)
|
||||
#define ZLIB_FILEFUNC_SEEK_SET (0)
|
||||
|
||||
#define ZLIB_FILEFUNC_MODE_READ (1)
|
||||
#define ZLIB_FILEFUNC_MODE_WRITE (2)
|
||||
#define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3)
|
||||
|
||||
#define ZLIB_FILEFUNC_MODE_EXISTING (4)
|
||||
#define ZLIB_FILEFUNC_MODE_CREATE (8)
|
||||
|
||||
|
||||
#ifndef ZCALLBACK
|
||||
|
||||
#if (defined(WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK)
|
||||
#define ZCALLBACK CALLBACK
|
||||
#else
|
||||
#define ZCALLBACK
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode));
|
||||
typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size));
|
||||
typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
|
||||
typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream));
|
||||
typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin));
|
||||
typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream));
|
||||
typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream));
|
||||
|
||||
typedef struct zlib_filefunc_def_s
|
||||
{
|
||||
open_file_func zopen_file;
|
||||
read_file_func zread_file;
|
||||
write_file_func zwrite_file;
|
||||
tell_file_func ztell_file;
|
||||
seek_file_func zseek_file;
|
||||
close_file_func zclose_file;
|
||||
testerror_file_func zerror_file;
|
||||
voidpf opaque;
|
||||
} zlib_filefunc_def;
|
||||
|
||||
|
||||
|
||||
void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
|
||||
|
||||
#define ZREAD(filefunc,filestream,buf,size) ((*((filefunc).zread_file))((filefunc).opaque,filestream,buf,size))
|
||||
#define ZWRITE(filefunc,filestream,buf,size) ((*((filefunc).zwrite_file))((filefunc).opaque,filestream,buf,size))
|
||||
#define ZTELL(filefunc,filestream) ((*((filefunc).ztell_file))((filefunc).opaque,filestream))
|
||||
#define ZSEEK(filefunc,filestream,pos,mode) ((*((filefunc).zseek_file))((filefunc).opaque,filestream,pos,mode))
|
||||
#define ZCLOSE(filefunc,filestream) ((*((filefunc).zclose_file))((filefunc).opaque,filestream))
|
||||
#define ZERROR(filefunc,filestream) ((*((filefunc).zerror_file))((filefunc).opaque,filestream))
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
-342
@@ -1,342 +0,0 @@
|
||||
/* unzip.h -- IO for uncompress .zip files using zlib
|
||||
Version 1.00, September 10th, 2003
|
||||
|
||||
Copyright (C) 1998-2003 Gilles Vollant
|
||||
|
||||
This unzip package allow extract file from .ZIP file, compatible with PKZip 2.04g
|
||||
WinZip, InfoZip tools and compatible.
|
||||
Encryption and multi volume ZipFile (span) are not supported.
|
||||
Old compressions used by old PKZip 1.x are not supported
|
||||
|
||||
|
||||
I WAIT FEEDBACK at mail info@winimage.com
|
||||
Visit also http://www.winimage.com/zLibDll/unzip.htm for evolution
|
||||
|
||||
Condition of use and distribution are the same than zlib :
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. 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.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
/* for more info about .ZIP format, see
|
||||
http://www.info-zip.org/pub/infozip/doc/appnote-981119-iz.zip
|
||||
http://www.info-zip.org/pub/infozip/doc/
|
||||
PkWare has also a specification at :
|
||||
ftp://ftp.pkware.com/probdesc.zip
|
||||
*/
|
||||
|
||||
#ifndef _unz_H
|
||||
#define _unz_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef _ZLIB_H
|
||||
#include "zlib.h"
|
||||
#endif
|
||||
|
||||
#ifndef _ZLIBIOAPI_H
|
||||
#include "ioapi.h"
|
||||
#endif
|
||||
|
||||
#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP)
|
||||
/* like the STRICT of WIN32, we define a pointer that cannot be converted
|
||||
from (void*) without cast */
|
||||
typedef struct TagunzFile__ { int unused; } unzFile__;
|
||||
typedef unzFile__ *unzFile;
|
||||
#else
|
||||
typedef voidp unzFile;
|
||||
#endif
|
||||
|
||||
|
||||
#define UNZ_OK (0)
|
||||
#define UNZ_END_OF_LIST_OF_FILE (-100)
|
||||
#define UNZ_ERRNO (Z_ERRNO)
|
||||
#define UNZ_EOF (0)
|
||||
#define UNZ_PARAMERROR (-102)
|
||||
#define UNZ_BADZIPFILE (-103)
|
||||
#define UNZ_INTERNALERROR (-104)
|
||||
#define UNZ_CRCERROR (-105)
|
||||
|
||||
/* tm_unz contain date/time info */
|
||||
typedef struct tm_unz_s
|
||||
{
|
||||
uInt tm_sec; /* seconds after the minute - [0,59] */
|
||||
uInt tm_min; /* minutes after the hour - [0,59] */
|
||||
uInt tm_hour; /* hours since midnight - [0,23] */
|
||||
uInt tm_mday; /* day of the month - [1,31] */
|
||||
uInt tm_mon; /* months since January - [0,11] */
|
||||
uInt tm_year; /* years - [1980..2044] */
|
||||
} tm_unz;
|
||||
|
||||
/* unz_global_info structure contain global data about the ZIPfile
|
||||
These data comes from the end of central dir */
|
||||
typedef struct unz_global_info_s
|
||||
{
|
||||
uLong number_entry; /* total number of entries in
|
||||
the central dir on this disk */
|
||||
uLong size_comment; /* size of the global comment of the zipfile */
|
||||
} unz_global_info;
|
||||
|
||||
|
||||
/* unz_file_info contain information about a file in the zipfile */
|
||||
typedef struct unz_file_info_s
|
||||
{
|
||||
uLong version; /* version made by 2 bytes */
|
||||
uLong version_needed; /* version needed to extract 2 bytes */
|
||||
uLong flag; /* general purpose bit flag 2 bytes */
|
||||
uLong compression_method; /* compression method 2 bytes */
|
||||
uLong dosDate; /* last mod file date in Dos fmt 4 bytes */
|
||||
uLong crc; /* crc-32 4 bytes */
|
||||
uLong compressed_size; /* compressed size 4 bytes */
|
||||
uLong uncompressed_size; /* uncompressed size 4 bytes */
|
||||
uLong size_filename; /* filename length 2 bytes */
|
||||
uLong size_file_extra; /* extra field length 2 bytes */
|
||||
uLong size_file_comment; /* file comment length 2 bytes */
|
||||
|
||||
uLong disk_num_start; /* disk number start 2 bytes */
|
||||
uLong internal_fa; /* internal file attributes 2 bytes */
|
||||
uLong external_fa; /* external file attributes 4 bytes */
|
||||
|
||||
tm_unz tmu_date;
|
||||
} unz_file_info;
|
||||
|
||||
extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1,
|
||||
const char* fileName2,
|
||||
int iCaseSensitivity));
|
||||
/*
|
||||
Compare two filename (fileName1,fileName2).
|
||||
If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
|
||||
If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
|
||||
or strcasecmp)
|
||||
If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
|
||||
(like 1 on Unix, 2 on Windows)
|
||||
*/
|
||||
|
||||
|
||||
extern unzFile ZEXPORT unzOpen OF((const char *path));
|
||||
/*
|
||||
Open a Zip file. path contain the full pathname (by example,
|
||||
on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer
|
||||
"zlib/zlib113.zip".
|
||||
If the zipfile cannot be opened (file don't exist or in not valid), the
|
||||
return value is NULL.
|
||||
Else, the return value is a unzFile Handle, usable with other function
|
||||
of this unzip package.
|
||||
*/
|
||||
|
||||
extern unzFile ZEXPORT unzOpen2 OF((const char *path,
|
||||
zlib_filefunc_def* pzlib_filefunc_def));
|
||||
/*
|
||||
Open a Zip file, like unzOpen, but provide a set of file low level API
|
||||
for read/write the zip file (see ioapi.h)
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzClose OF((unzFile file));
|
||||
/*
|
||||
Close a ZipFile opened with unzipOpen.
|
||||
If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
|
||||
these files MUST be closed with unzipCloseCurrentFile before call unzipClose.
|
||||
return UNZ_OK if there is no problem. */
|
||||
|
||||
extern int ZEXPORT unzGetGlobalInfo OF((unzFile file,
|
||||
unz_global_info *pglobal_info));
|
||||
/*
|
||||
Write info about the ZipFile in the *pglobal_info structure.
|
||||
No preparation of the structure is needed
|
||||
return UNZ_OK if there is no problem. */
|
||||
|
||||
|
||||
extern int ZEXPORT unzGetGlobalComment OF((unzFile file,
|
||||
char *szComment,
|
||||
uLong uSizeBuf));
|
||||
/*
|
||||
Get the global comment string of the ZipFile, in the szComment buffer.
|
||||
uSizeBuf is the size of the szComment buffer.
|
||||
return the number of byte copied or an error code <0
|
||||
*/
|
||||
|
||||
|
||||
/***************************************************************************/
|
||||
/* Unzip package allow you browse the directory of the zipfile */
|
||||
|
||||
extern int ZEXPORT unzGoToFirstFile OF((unzFile file));
|
||||
/*
|
||||
Set the current file of the zipfile to the first file.
|
||||
return UNZ_OK if there is no problem
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzGoToNextFile OF((unzFile file));
|
||||
/*
|
||||
Set the current file of the zipfile to the next file.
|
||||
return UNZ_OK if there is no problem
|
||||
return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzLocateFile OF((unzFile file,
|
||||
const char *szFileName,
|
||||
int iCaseSensitivity));
|
||||
/*
|
||||
Try locate the file szFileName in the zipfile.
|
||||
For the iCaseSensitivity signification, see unzStringFileNameCompare
|
||||
|
||||
return value :
|
||||
UNZ_OK if the file is found. It becomes the current file.
|
||||
UNZ_END_OF_LIST_OF_FILE if the file is not found
|
||||
*/
|
||||
|
||||
|
||||
/* ****************************************** */
|
||||
/* Ryan supplied functions */
|
||||
/* unz_file_info contain information about a file in the zipfile */
|
||||
typedef struct unz_file_pos_s
|
||||
{
|
||||
uLong pos_in_zip_directory; /* offset in zip file directory */
|
||||
uLong num_of_file; /* # of file */
|
||||
} unz_file_pos;
|
||||
|
||||
extern int ZEXPORT unzGetFilePos(
|
||||
unzFile file,
|
||||
unz_file_pos* file_pos);
|
||||
|
||||
extern int ZEXPORT unzGoToFilePos(
|
||||
unzFile file,
|
||||
unz_file_pos* file_pos);
|
||||
|
||||
/* ****************************************** */
|
||||
|
||||
extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file,
|
||||
unz_file_info *pfile_info,
|
||||
char *szFileName,
|
||||
uLong fileNameBufferSize,
|
||||
void *extraField,
|
||||
uLong extraFieldBufferSize,
|
||||
char *szComment,
|
||||
uLong commentBufferSize));
|
||||
/*
|
||||
Get Info about the current file
|
||||
if pfile_info!=NULL, the *pfile_info structure will contain somes info about
|
||||
the current file
|
||||
if szFileName!=NULL, the filemane string will be copied in szFileName
|
||||
(fileNameBufferSize is the size of the buffer)
|
||||
if extraField!=NULL, the extra field information will be copied in extraField
|
||||
(extraFieldBufferSize is the size of the buffer).
|
||||
This is the Central-header version of the extra field
|
||||
if szComment!=NULL, the comment string of the file will be copied in szComment
|
||||
(commentBufferSize is the size of the buffer)
|
||||
*/
|
||||
|
||||
/***************************************************************************/
|
||||
/* for reading the content of the current zipfile, you can open it, read data
|
||||
from it, and close it (you can close it before reading all the file)
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzOpenCurrentFile OF((unzFile file));
|
||||
/*
|
||||
Open for reading data the current file in the zipfile.
|
||||
If there is no error, the return value is UNZ_OK.
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzOpenCurrentFilePassword OF((unzFile file,
|
||||
const char* password));
|
||||
/*
|
||||
Open for reading data the current file in the zipfile.
|
||||
password is a crypting password
|
||||
If there is no error, the return value is UNZ_OK.
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzOpenCurrentFile2 OF((unzFile file,
|
||||
int* method,
|
||||
int* level,
|
||||
int raw));
|
||||
/*
|
||||
Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
|
||||
if raw==1
|
||||
*method will receive method of compression, *level will receive level of
|
||||
compression
|
||||
note : you can set level parameter as NULL (if you did not want known level,
|
||||
but you CANNOT set method parameter as NULL
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzOpenCurrentFile3 OF((unzFile file,
|
||||
int* method,
|
||||
int* level,
|
||||
int raw,
|
||||
const char* password));
|
||||
/*
|
||||
Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
|
||||
if raw==1
|
||||
*method will receive method of compression, *level will receive level of
|
||||
compression
|
||||
note : you can set level parameter as NULL (if you did not want known level,
|
||||
but you CANNOT set method parameter as NULL
|
||||
*/
|
||||
|
||||
|
||||
extern int ZEXPORT unzCloseCurrentFile OF((unzFile file));
|
||||
/*
|
||||
Close the file in zip opened with unzOpenCurrentFile
|
||||
Return UNZ_CRCERROR if all the file was read but the CRC is not good
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzReadCurrentFile OF((unzFile file,
|
||||
voidp buf,
|
||||
unsigned len));
|
||||
/*
|
||||
Read bytes from the current file (opened by unzOpenCurrentFile)
|
||||
buf contain buffer where data must be copied
|
||||
len the size of buf.
|
||||
|
||||
return the number of byte copied if somes bytes are copied
|
||||
return 0 if the end of file was reached
|
||||
return <0 with error code if there is an error
|
||||
(UNZ_ERRNO for IO error, or zLib error for uncompress error)
|
||||
*/
|
||||
|
||||
extern z_off_t ZEXPORT unztell OF((unzFile file));
|
||||
/*
|
||||
Give the current position in uncompressed data
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzeof OF((unzFile file));
|
||||
/*
|
||||
return 1 if the end of file was reached, 0 elsewhere
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file,
|
||||
voidp buf,
|
||||
unsigned len));
|
||||
/*
|
||||
Read extra field from the current file (opened by unzOpenCurrentFile)
|
||||
This is the local-header version of the extra field (sometimes, there is
|
||||
more info in the local-header version than in the central-header)
|
||||
|
||||
if buf==NULL, it return the size of the local extra field
|
||||
|
||||
if buf!=NULL, len is the size of the buffer, the extra header is copied in
|
||||
buf.
|
||||
the return value is the number of bytes copied in buf, or (if <0)
|
||||
the error code
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _unz_H */
|
||||
-323
@@ -1,323 +0,0 @@
|
||||
/* zconf.h -- configuration of the zlib compression library
|
||||
* Copyright (C) 1995-2003 Jean-loup Gailly.
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
/* @(#) $Id$ */
|
||||
|
||||
#ifndef ZCONF_H
|
||||
#define ZCONF_H
|
||||
|
||||
/*
|
||||
* If you *really* need a unique prefix for all types and library functions,
|
||||
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
|
||||
*/
|
||||
#ifdef Z_PREFIX
|
||||
# define deflateInit_ z_deflateInit_
|
||||
# define deflate z_deflate
|
||||
# define deflateEnd z_deflateEnd
|
||||
# define inflateInit_ z_inflateInit_
|
||||
# define inflate z_inflate
|
||||
# define inflateEnd z_inflateEnd
|
||||
# define deflateInit2_ z_deflateInit2_
|
||||
# define deflateSetDictionary z_deflateSetDictionary
|
||||
# define deflateCopy z_deflateCopy
|
||||
# define deflateReset z_deflateReset
|
||||
# define deflatePrime z_deflatePrime
|
||||
# define deflateParams z_deflateParams
|
||||
# define deflateBound z_deflateBound
|
||||
# define inflateInit2_ z_inflateInit2_
|
||||
# define inflateSetDictionary z_inflateSetDictionary
|
||||
# define inflateSync z_inflateSync
|
||||
# define inflateSyncPoint z_inflateSyncPoint
|
||||
# define inflateCopy z_inflateCopy
|
||||
# define inflateReset z_inflateReset
|
||||
# define compress z_compress
|
||||
# define compress2 z_compress2
|
||||
# define compressBound z_compressBound
|
||||
# define uncompress z_uncompress
|
||||
# define adler32 z_adler32
|
||||
# define crc32 z_crc32
|
||||
# define get_crc_table z_get_crc_table
|
||||
|
||||
# define Byte z_Byte
|
||||
# define uInt z_uInt
|
||||
# define uLong z_uLong
|
||||
# define Bytef z_Bytef
|
||||
# define charf z_charf
|
||||
# define intf z_intf
|
||||
# define uIntf z_uIntf
|
||||
# define uLongf z_uLongf
|
||||
# define voidpf z_voidpf
|
||||
# define voidp z_voidp
|
||||
#endif
|
||||
|
||||
#if defined(__MSDOS__) && !defined(MSDOS)
|
||||
# define MSDOS
|
||||
#endif
|
||||
#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
|
||||
# define OS2
|
||||
#endif
|
||||
#if defined(_WINDOWS) && !defined(WINDOWS)
|
||||
# define WINDOWS
|
||||
#endif
|
||||
#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
|
||||
# define WIN32
|
||||
#endif
|
||||
#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
|
||||
# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
|
||||
# ifndef SYS16BIT
|
||||
# define SYS16BIT
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Compile with -DMAXSEG_64K if the alloc function cannot allocate more
|
||||
* than 64k bytes at a time (needed on systems with 16-bit int).
|
||||
*/
|
||||
#ifdef SYS16BIT
|
||||
# define MAXSEG_64K
|
||||
#endif
|
||||
#ifdef MSDOS
|
||||
# define UNALIGNED_OK
|
||||
#endif
|
||||
|
||||
#ifdef __STDC_VERSION__
|
||||
# ifndef STDC
|
||||
# define STDC
|
||||
# endif
|
||||
# if __STDC_VERSION__ >= 199901L
|
||||
# ifndef STDC99
|
||||
# define STDC99
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
|
||||
# define STDC
|
||||
#endif
|
||||
#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
|
||||
# define STDC
|
||||
#endif
|
||||
#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
|
||||
# define STDC
|
||||
#endif
|
||||
#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
|
||||
# define STDC
|
||||
#endif
|
||||
|
||||
#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
|
||||
# define STDC
|
||||
#endif
|
||||
|
||||
#ifndef STDC
|
||||
# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
|
||||
# define const /* note: need a more gentle solution here */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Some Mac compilers merge all .h files incorrectly: */
|
||||
#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
|
||||
# define NO_DUMMY_DECL
|
||||
#endif
|
||||
|
||||
/* Maximum value for memLevel in deflateInit2 */
|
||||
#ifndef MAX_MEM_LEVEL
|
||||
# ifdef MAXSEG_64K
|
||||
# define MAX_MEM_LEVEL 8
|
||||
# else
|
||||
# define MAX_MEM_LEVEL 9
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Maximum value for windowBits in deflateInit2 and inflateInit2.
|
||||
* WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
|
||||
* created by gzip. (Files created by minigzip can still be extracted by
|
||||
* gzip.)
|
||||
*/
|
||||
#ifndef MAX_WBITS
|
||||
# define MAX_WBITS 15 /* 32K LZ77 window */
|
||||
#endif
|
||||
|
||||
/* The memory requirements for deflate are (in bytes):
|
||||
(1 << (windowBits+2)) + (1 << (memLevel+9))
|
||||
that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
|
||||
plus a few kilobytes for small objects. For example, if you want to reduce
|
||||
the default memory requirements from 256K to 128K, compile with
|
||||
make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
|
||||
Of course this will generally degrade compression (there's no free lunch).
|
||||
|
||||
The memory requirements for inflate are (in bytes) 1 << windowBits
|
||||
that is, 32K for windowBits=15 (default value) plus a few kilobytes
|
||||
for small objects.
|
||||
*/
|
||||
|
||||
/* Type declarations */
|
||||
|
||||
#ifndef OF /* function prototypes */
|
||||
# ifdef STDC
|
||||
# define OF(args) args
|
||||
# else
|
||||
# define OF(args) ()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* The following definitions for FAR are needed only for MSDOS mixed
|
||||
* model programming (small or medium model with some far allocations).
|
||||
* This was tested only with MSC; for other MSDOS compilers you may have
|
||||
* to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
|
||||
* just define FAR to be empty.
|
||||
*/
|
||||
#ifdef SYS16BIT
|
||||
# if defined(M_I86SM) || defined(M_I86MM)
|
||||
/* MSC small or medium model */
|
||||
# define SMALL_MEDIUM
|
||||
# ifdef _MSC_VER
|
||||
# define FAR _far
|
||||
# else
|
||||
# define FAR far
|
||||
# endif
|
||||
# endif
|
||||
# if (defined(__SMALL__) || defined(__MEDIUM__))
|
||||
/* Turbo C small or medium model */
|
||||
# define SMALL_MEDIUM
|
||||
# ifdef __BORLANDC__
|
||||
# define FAR _far
|
||||
# else
|
||||
# define FAR far
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(WINDOWS) || defined(WIN32)
|
||||
/* If building or using zlib as a DLL, define ZLIB_DLL.
|
||||
* This is not mandatory, but it offers a little performance increase.
|
||||
*/
|
||||
# ifdef ZLIB_DLL
|
||||
# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
|
||||
# ifdef ZLIB_INTERNAL
|
||||
# define ZEXTERN extern __declspec(dllexport)
|
||||
# else
|
||||
# define ZEXTERN extern __declspec(dllimport)
|
||||
# endif
|
||||
# endif
|
||||
# endif /* ZLIB_DLL */
|
||||
/* If building or using zlib with the WINAPI/WINAPIV calling convention,
|
||||
* define ZLIB_WINAPI.
|
||||
* Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
|
||||
*/
|
||||
# ifdef ZLIB_WINAPI
|
||||
# ifdef FAR
|
||||
# undef FAR
|
||||
# endif
|
||||
# include <windows.h>
|
||||
/* No need for _export, use ZLIB.DEF instead. */
|
||||
/* For complete Windows compatibility, use WINAPI, not __stdcall. */
|
||||
# define ZEXPORT WINAPI
|
||||
# ifdef WIN32
|
||||
# define ZEXPORTVA WINAPIV
|
||||
# else
|
||||
# define ZEXPORTVA FAR CDECL
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined (__BEOS__)
|
||||
# ifdef ZLIB_DLL
|
||||
# ifdef ZLIB_INTERNAL
|
||||
# define ZEXPORT __declspec(dllexport)
|
||||
# define ZEXPORTVA __declspec(dllexport)
|
||||
# else
|
||||
# define ZEXPORT __declspec(dllimport)
|
||||
# define ZEXPORTVA __declspec(dllimport)
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef ZEXTERN
|
||||
# define ZEXTERN extern
|
||||
#endif
|
||||
#ifndef ZEXPORT
|
||||
# define ZEXPORT
|
||||
#endif
|
||||
#ifndef ZEXPORTVA
|
||||
# define ZEXPORTVA
|
||||
#endif
|
||||
|
||||
#ifndef FAR
|
||||
# define FAR
|
||||
#endif
|
||||
|
||||
#if !defined(__MACTYPES__)
|
||||
typedef unsigned char Byte; /* 8 bits */
|
||||
#endif
|
||||
typedef unsigned int uInt; /* 16 bits or more */
|
||||
typedef unsigned long uLong; /* 32 bits or more */
|
||||
|
||||
#ifdef SMALL_MEDIUM
|
||||
/* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
|
||||
# define Bytef Byte FAR
|
||||
#else
|
||||
typedef Byte FAR Bytef;
|
||||
#endif
|
||||
typedef char FAR charf;
|
||||
typedef int FAR intf;
|
||||
typedef uInt FAR uIntf;
|
||||
typedef uLong FAR uLongf;
|
||||
|
||||
#ifdef STDC
|
||||
typedef void const *voidpc;
|
||||
typedef void FAR *voidpf;
|
||||
typedef void *voidp;
|
||||
#else
|
||||
typedef Byte const *voidpc;
|
||||
typedef Byte FAR *voidpf;
|
||||
typedef Byte *voidp;
|
||||
#endif
|
||||
|
||||
#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */
|
||||
# include <sys/types.h> /* for off_t */
|
||||
# include <unistd.h> /* for SEEK_* and off_t */
|
||||
# ifdef VMS
|
||||
# include <unixio.h> /* for off_t */
|
||||
# endif
|
||||
# define z_off_t off_t
|
||||
#endif
|
||||
#ifndef SEEK_SET
|
||||
# define SEEK_SET 0 /* Seek from beginning of file. */
|
||||
# define SEEK_CUR 1 /* Seek from current position. */
|
||||
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
|
||||
#endif
|
||||
#ifndef z_off_t
|
||||
# define z_off_t long
|
||||
#endif
|
||||
|
||||
#if defined(__OS400__)
|
||||
#define NO_vsnprintf
|
||||
#endif
|
||||
|
||||
#if defined(__MVS__)
|
||||
# define NO_vsnprintf
|
||||
# ifdef FAR
|
||||
# undef FAR
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* MVS linker does not support external names larger than 8 bytes */
|
||||
#if defined(__MVS__)
|
||||
# pragma map(deflateInit_,"DEIN")
|
||||
# pragma map(deflateInit2_,"DEIN2")
|
||||
# pragma map(deflateEnd,"DEEND")
|
||||
# pragma map(deflateBound,"DEBND")
|
||||
# pragma map(inflateInit_,"ININ")
|
||||
# pragma map(inflateInit2_,"ININ2")
|
||||
# pragma map(inflateEnd,"INEND")
|
||||
# pragma map(inflateSync,"INSY")
|
||||
# pragma map(inflateSetDictionary,"INSEDI")
|
||||
# pragma map(compressBound,"CMBND")
|
||||
# pragma map(inflate_table,"INTABL")
|
||||
# pragma map(inflate_fast,"INFA")
|
||||
# pragma map(inflate_copyright,"INCOPY")
|
||||
#endif
|
||||
|
||||
#endif /* ZCONF_H */
|
||||
@@ -1,235 +0,0 @@
|
||||
/* zip.h -- IO for compress .zip files using zlib
|
||||
Version 1.01e, February 12th, 2005
|
||||
|
||||
Copyright (C) 1998-2005 Gilles Vollant
|
||||
|
||||
This unzip package allow creates .ZIP file, compatible with PKZip 2.04g
|
||||
WinZip, InfoZip tools and compatible.
|
||||
Multi volume ZipFile (span) are not supported.
|
||||
Encryption compatible with pkzip 2.04g only supported
|
||||
Old compressions used by old PKZip 1.x are not supported
|
||||
|
||||
For uncompress .zip file, look at unzip.h
|
||||
|
||||
|
||||
I WAIT FEEDBACK at mail info@winimage.com
|
||||
Visit also http://www.winimage.com/zLibDll/unzip.html for evolution
|
||||
|
||||
Condition of use and distribution are the same than zlib :
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. 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.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
/* for more info about .ZIP format, see
|
||||
http://www.info-zip.org/pub/infozip/doc/appnote-981119-iz.zip
|
||||
http://www.info-zip.org/pub/infozip/doc/
|
||||
PkWare has also a specification at :
|
||||
ftp://ftp.pkware.com/probdesc.zip
|
||||
*/
|
||||
|
||||
#ifndef _zip_H
|
||||
#define _zip_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef _ZLIB_H
|
||||
#include "zlib.h"
|
||||
#endif
|
||||
|
||||
#ifndef _ZLIBIOAPI_H
|
||||
#include "ioapi.h"
|
||||
#endif
|
||||
|
||||
#if defined(STRICTZIP) || defined(STRICTZIPUNZIP)
|
||||
/* like the STRICT of WIN32, we define a pointer that cannot be converted
|
||||
from (void*) without cast */
|
||||
typedef struct TagzipFile__ { int unused; } zipFile__;
|
||||
typedef zipFile__ *zipFile;
|
||||
#else
|
||||
typedef voidp zipFile;
|
||||
#endif
|
||||
|
||||
#define ZIP_OK (0)
|
||||
#define ZIP_EOF (0)
|
||||
#define ZIP_ERRNO (Z_ERRNO)
|
||||
#define ZIP_PARAMERROR (-102)
|
||||
#define ZIP_BADZIPFILE (-103)
|
||||
#define ZIP_INTERNALERROR (-104)
|
||||
|
||||
#ifndef DEF_MEM_LEVEL
|
||||
# if MAX_MEM_LEVEL >= 8
|
||||
# define DEF_MEM_LEVEL 8
|
||||
# else
|
||||
# define DEF_MEM_LEVEL MAX_MEM_LEVEL
|
||||
# endif
|
||||
#endif
|
||||
/* default memLevel */
|
||||
|
||||
/* tm_zip contain date/time info */
|
||||
typedef struct tm_zip_s
|
||||
{
|
||||
uInt tm_sec; /* seconds after the minute - [0,59] */
|
||||
uInt tm_min; /* minutes after the hour - [0,59] */
|
||||
uInt tm_hour; /* hours since midnight - [0,23] */
|
||||
uInt tm_mday; /* day of the month - [1,31] */
|
||||
uInt tm_mon; /* months since January - [0,11] */
|
||||
uInt tm_year; /* years - [1980..2044] */
|
||||
} tm_zip;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
tm_zip tmz_date; /* date in understandable format */
|
||||
uLong dosDate; /* if dos_date == 0, tmu_date is used */
|
||||
/* uLong flag; */ /* general purpose bit flag 2 bytes */
|
||||
|
||||
uLong internal_fa; /* internal file attributes 2 bytes */
|
||||
uLong external_fa; /* external file attributes 4 bytes */
|
||||
} zip_fileinfo;
|
||||
|
||||
typedef const char* zipcharpc;
|
||||
|
||||
|
||||
#define APPEND_STATUS_CREATE (0)
|
||||
#define APPEND_STATUS_CREATEAFTER (1)
|
||||
#define APPEND_STATUS_ADDINZIP (2)
|
||||
|
||||
extern zipFile ZEXPORT zipOpen OF((const char *pathname, int append));
|
||||
/*
|
||||
Create a zipfile.
|
||||
pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on
|
||||
an Unix computer "zlib/zlib113.zip".
|
||||
if the file pathname exist and append==APPEND_STATUS_CREATEAFTER, the zip
|
||||
will be created at the end of the file.
|
||||
(useful if the file contain a self extractor code)
|
||||
if the file pathname exist and append==APPEND_STATUS_ADDINZIP, we will
|
||||
add files in existing zip (be sure you don't add file that doesn't exist)
|
||||
If the zipfile cannot be opened, the return value is NULL.
|
||||
Else, the return value is a zipFile Handle, usable with other function
|
||||
of this zip package.
|
||||
*/
|
||||
|
||||
/* Note : there is no delete function into a zipfile.
|
||||
If you want delete file into a zipfile, you must open a zipfile, and create another
|
||||
Of couse, you can use RAW reading and writing to copy the file you did not want delte
|
||||
*/
|
||||
|
||||
extern zipFile ZEXPORT zipOpen2 OF((const char *pathname,
|
||||
int append,
|
||||
zipcharpc* globalcomment,
|
||||
zlib_filefunc_def* pzlib_filefunc_def));
|
||||
|
||||
extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file,
|
||||
const char* filename,
|
||||
const zip_fileinfo* zipfi,
|
||||
const void* extrafield_local,
|
||||
uInt size_extrafield_local,
|
||||
const void* extrafield_global,
|
||||
uInt size_extrafield_global,
|
||||
const char* comment,
|
||||
int method,
|
||||
int level));
|
||||
/*
|
||||
Open a file in the ZIP for writing.
|
||||
filename : the filename in zip (if NULL, '-' without quote will be used
|
||||
*zipfi contain supplemental information
|
||||
if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local
|
||||
contains the extrafield data the the local header
|
||||
if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global
|
||||
contains the extrafield data the the local header
|
||||
if comment != NULL, comment contain the comment string
|
||||
method contain the compression method (0 for store, Z_DEFLATED for deflate)
|
||||
level contain the level of compression (can be Z_DEFAULT_COMPRESSION)
|
||||
*/
|
||||
|
||||
|
||||
extern int ZEXPORT zipOpenNewFileInZip2 OF((zipFile file,
|
||||
const char* filename,
|
||||
const zip_fileinfo* zipfi,
|
||||
const void* extrafield_local,
|
||||
uInt size_extrafield_local,
|
||||
const void* extrafield_global,
|
||||
uInt size_extrafield_global,
|
||||
const char* comment,
|
||||
int method,
|
||||
int level,
|
||||
int raw));
|
||||
|
||||
/*
|
||||
Same than zipOpenNewFileInZip, except if raw=1, we write raw file
|
||||
*/
|
||||
|
||||
extern int ZEXPORT zipOpenNewFileInZip3 OF((zipFile file,
|
||||
const char* filename,
|
||||
const zip_fileinfo* zipfi,
|
||||
const void* extrafield_local,
|
||||
uInt size_extrafield_local,
|
||||
const void* extrafield_global,
|
||||
uInt size_extrafield_global,
|
||||
const char* comment,
|
||||
int method,
|
||||
int level,
|
||||
int raw,
|
||||
int windowBits,
|
||||
int memLevel,
|
||||
int strategy,
|
||||
const char* password,
|
||||
uLong crcForCtypting));
|
||||
|
||||
/*
|
||||
Same than zipOpenNewFileInZip2, except
|
||||
windowBits,memLevel,,strategy : see parameter strategy in deflateInit2
|
||||
password : crypting password (NULL for no crypting)
|
||||
crcForCtypting : crc of file to compress (needed for crypting)
|
||||
*/
|
||||
|
||||
|
||||
extern int ZEXPORT zipWriteInFileInZip OF((zipFile file,
|
||||
const void* buf,
|
||||
unsigned len));
|
||||
/*
|
||||
Write data in the zipfile
|
||||
*/
|
||||
|
||||
extern int ZEXPORT zipCloseFileInZip OF((zipFile file));
|
||||
/*
|
||||
Close the current file in the zipfile
|
||||
*/
|
||||
|
||||
extern int ZEXPORT zipCloseFileInZipRaw OF((zipFile file,
|
||||
uLong uncompressed_size,
|
||||
uLong crc32));
|
||||
/*
|
||||
Close the current file in the zipfile, for fiel opened with
|
||||
parameter raw=1 in zipOpenNewFileInZip2
|
||||
uncompressed_size and crc32 are value for the uncompressed size
|
||||
*/
|
||||
|
||||
extern int ZEXPORT zipClose OF((zipFile file,
|
||||
const char* global_comment));
|
||||
/*
|
||||
Close the zipfile
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _zip_H */
|
||||
-1200
File diff suppressed because it is too large
Load Diff
+489
-489
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+118
-205
@@ -35,33 +35,27 @@
|
||||
/* End PBXAggregateTarget section */
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
82EC409F0FD9EC420017FC19 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 82EC409E0FD9EC420017FC19 /* libz.dylib */; };
|
||||
871EC9A224F08BF700CEC578 /* ExpansionModule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 871EC9A124F08BF600CEC578 /* ExpansionModule.cpp */; };
|
||||
8794D9691B74713300897F57 /* Sound.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 941F59AF17A6189D0005D7EA /* Sound.cpp */; };
|
||||
82EC409F0FD9EC420017FC19 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 82EC409E0FD9EC420017FC19 /* libz.tbd */; };
|
||||
87664D042956D3C70009C5C1 /* Palette.c in Sources */ = {isa = PBXBuildFile; fileRef = 87664CE62956D3C70009C5C1 /* Palette.c */; };
|
||||
87664D052956D3C70009C5C1 /* Memory.c in Sources */ = {isa = PBXBuildFile; fileRef = 87664CE82956D3C70009C5C1 /* Memory.c */; };
|
||||
87664D062956D3C70009C5C1 /* Maria.c in Sources */ = {isa = PBXBuildFile; fileRef = 87664CE92956D3C70009C5C1 /* Maria.c */; };
|
||||
87664D072956D3C70009C5C1 /* Cartridge.c in Sources */ = {isa = PBXBuildFile; fileRef = 87664CEC2956D3C70009C5C1 /* Cartridge.c */; };
|
||||
87664D082956D3C70009C5C1 /* Database.c in Sources */ = {isa = PBXBuildFile; fileRef = 87664CED2956D3C70009C5C1 /* Database.c */; };
|
||||
87664D092956D3C70009C5C1 /* Region.c in Sources */ = {isa = PBXBuildFile; fileRef = 87664CEF2956D3C70009C5C1 /* Region.c */; };
|
||||
87664D0A2956D3C70009C5C1 /* ExpansionModule.c in Sources */ = {isa = PBXBuildFile; fileRef = 87664CF02956D3C70009C5C1 /* ExpansionModule.c */; };
|
||||
87664D0B2956D3C70009C5C1 /* Riot.c in Sources */ = {isa = PBXBuildFile; fileRef = 87664CF12956D3C70009C5C1 /* Riot.c */; };
|
||||
87664D0C2956D3C70009C5C1 /* Bios.c in Sources */ = {isa = PBXBuildFile; fileRef = 87664CF22956D3C70009C5C1 /* Bios.c */; };
|
||||
87664D0D2956D3C70009C5C1 /* Sally.c in Sources */ = {isa = PBXBuildFile; fileRef = 87664CF32956D3C70009C5C1 /* Sally.c */; };
|
||||
87664D0E2956D3C70009C5C1 /* Pokey.c in Sources */ = {isa = PBXBuildFile; fileRef = 87664CF52956D3C70009C5C1 /* Pokey.c */; };
|
||||
87664D0F2956D3C70009C5C1 /* Sound.c in Sources */ = {isa = PBXBuildFile; fileRef = 87664CF72956D3C70009C5C1 /* Sound.c */; };
|
||||
87664D102956D3C70009C5C1 /* ProSystem.c in Sources */ = {isa = PBXBuildFile; fileRef = 87664CF92956D3C70009C5C1 /* ProSystem.c */; };
|
||||
87664D112956D3C70009C5C1 /* Tia.c in Sources */ = {isa = PBXBuildFile; fileRef = 87664CFD2956D3C70009C5C1 /* Tia.c */; };
|
||||
87664D122956D3C70009C5C1 /* md5.c in Sources */ = {isa = PBXBuildFile; fileRef = 87664CFF2956D3C70009C5C1 /* md5.c */; };
|
||||
87664D142956D46E0009C5C1 /* ProSystem.dat in Resources */ = {isa = PBXBuildFile; fileRef = 87664D132956D46D0009C5C1 /* ProSystem.dat */; };
|
||||
8D5B49B0048680CD000E48DA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C167DFE841241C02AAC07 /* InfoPlist.strings */; };
|
||||
8D5B49B4048680CD000E48DA /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */; };
|
||||
941DFB2715B6425200C6552F /* ProSystemGameCore.mm in Sources */ = {isa = PBXBuildFile; fileRef = 941DFB2615B6425200C6552F /* ProSystemGameCore.mm */; };
|
||||
941F59BF17A6189D0005D7EA /* Archive.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 941F598117A6189D0005D7EA /* Archive.cpp */; };
|
||||
941F59C017A6189D0005D7EA /* Bios.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 941F598317A6189D0005D7EA /* Bios.cpp */; };
|
||||
941F59C117A6189D0005D7EA /* Cartridge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 941F598517A6189D0005D7EA /* Cartridge.cpp */; };
|
||||
941F59C217A6189D0005D7EA /* Common.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 941F598717A6189D0005D7EA /* Common.cpp */; };
|
||||
941F59C317A6189D0005D7EA /* Database.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 941F598917A6189D0005D7EA /* Database.cpp */; };
|
||||
941F59C417A6189D0005D7EA /* Hash.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 941F598C17A6189D0005D7EA /* Hash.cpp */; };
|
||||
941F59C617A6189D0005D7EA /* Unzip.c in Sources */ = {isa = PBXBuildFile; fileRef = 941F599417A6189D0005D7EA /* Unzip.c */; };
|
||||
941F59C717A6189D0005D7EA /* Zip.c in Sources */ = {isa = PBXBuildFile; fileRef = 941F599717A6189D0005D7EA /* Zip.c */; };
|
||||
941F59C917A6189D0005D7EA /* Logger.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 941F599B17A6189D0005D7EA /* Logger.cpp */; };
|
||||
941F59CA17A6189D0005D7EA /* Maria.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 941F599D17A6189D0005D7EA /* Maria.cpp */; };
|
||||
941F59CB17A6189D0005D7EA /* Memory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 941F599F17A6189D0005D7EA /* Memory.cpp */; };
|
||||
941F59CC17A6189D0005D7EA /* Palette.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 941F59A217A6189D0005D7EA /* Palette.cpp */; };
|
||||
941F59CD17A6189D0005D7EA /* Pokey.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 941F59A417A6189D0005D7EA /* Pokey.cpp */; };
|
||||
941F59CE17A6189D0005D7EA /* ProSystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 941F59A617A6189D0005D7EA /* ProSystem.cpp */; };
|
||||
941F59CF17A6189D0005D7EA /* Region.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 941F59A917A6189D0005D7EA /* Region.cpp */; };
|
||||
941F59D017A6189D0005D7EA /* Riot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 941F59AB17A6189D0005D7EA /* Riot.cpp */; };
|
||||
941F59D117A6189D0005D7EA /* Sally.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 941F59AD17A6189D0005D7EA /* Sally.cpp */; };
|
||||
941F59D317A6189D0005D7EA /* Tia.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 941F59B117A6189D0005D7EA /* Tia.cpp */; };
|
||||
941F59D417A6189D0005D7EA /* Timer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 941F59B317A6189D0005D7EA /* Timer.cpp */; };
|
||||
941DFB2715B6425200C6552F /* ProSystemGameCore.m in Sources */ = {isa = PBXBuildFile; fileRef = 941DFB2615B6425200C6552F /* ProSystemGameCore.m */; };
|
||||
941F59DC17A62ADD0005D7EA /* OpenEmuBase.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 941F59DB17A62ADD0005D7EA /* OpenEmuBase.framework */; };
|
||||
941F59FC17A77CC90005D7EA /* ProSystem.dat in Resources */ = {isa = PBXBuildFile; fileRef = 941F59FB17A77CC90005D7EA /* ProSystem.dat */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
@@ -98,70 +92,45 @@
|
||||
089C167EFE841241C02AAC07 /* en */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||
089C167FFE841241C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
|
||||
1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
|
||||
82EC409E0FD9EC420017FC19 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; };
|
||||
871EC9A024F08BF600CEC578 /* ExpansionModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExpansionModule.h; sourceTree = "<group>"; };
|
||||
871EC9A124F08BF600CEC578 /* ExpansionModule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExpansionModule.cpp; sourceTree = "<group>"; };
|
||||
82EC409E0FD9EC420017FC19 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; };
|
||||
87664CE32956D3C70009C5C1 /* Sound.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Sound.h; sourceTree = "<group>"; };
|
||||
87664CE42956D3C70009C5C1 /* Pokey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Pokey.h; sourceTree = "<group>"; };
|
||||
87664CE52956D3C70009C5C1 /* Sally.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Sally.h; sourceTree = "<group>"; };
|
||||
87664CE62956D3C70009C5C1 /* Palette.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Palette.c; sourceTree = "<group>"; };
|
||||
87664CE72956D3C70009C5C1 /* Bios.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Bios.h; sourceTree = "<group>"; };
|
||||
87664CE82956D3C70009C5C1 /* Memory.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Memory.c; sourceTree = "<group>"; };
|
||||
87664CE92956D3C70009C5C1 /* Maria.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Maria.c; sourceTree = "<group>"; };
|
||||
87664CEA2956D3C70009C5C1 /* Tia.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Tia.h; sourceTree = "<group>"; };
|
||||
87664CEB2956D3C70009C5C1 /* ProSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProSystem.h; sourceTree = "<group>"; };
|
||||
87664CEC2956D3C70009C5C1 /* Cartridge.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Cartridge.c; sourceTree = "<group>"; };
|
||||
87664CED2956D3C70009C5C1 /* Database.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Database.c; sourceTree = "<group>"; };
|
||||
87664CEE2956D3C70009C5C1 /* md5.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = md5.h; sourceTree = "<group>"; };
|
||||
87664CEF2956D3C70009C5C1 /* Region.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Region.c; sourceTree = "<group>"; };
|
||||
87664CF02956D3C70009C5C1 /* ExpansionModule.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ExpansionModule.c; sourceTree = "<group>"; };
|
||||
87664CF12956D3C70009C5C1 /* Riot.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Riot.c; sourceTree = "<group>"; };
|
||||
87664CF22956D3C70009C5C1 /* Bios.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Bios.c; sourceTree = "<group>"; };
|
||||
87664CF32956D3C70009C5C1 /* Sally.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Sally.c; sourceTree = "<group>"; };
|
||||
87664CF42956D3C70009C5C1 /* Palette.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Palette.h; sourceTree = "<group>"; };
|
||||
87664CF52956D3C70009C5C1 /* Pokey.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Pokey.c; sourceTree = "<group>"; };
|
||||
87664CF62956D3C70009C5C1 /* Rect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Rect.h; sourceTree = "<group>"; };
|
||||
87664CF72956D3C70009C5C1 /* Sound.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Sound.c; sourceTree = "<group>"; };
|
||||
87664CF82956D3C70009C5C1 /* Database.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Database.h; sourceTree = "<group>"; };
|
||||
87664CF92956D3C70009C5C1 /* ProSystem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ProSystem.c; sourceTree = "<group>"; };
|
||||
87664CFA2956D3C70009C5C1 /* Cartridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Cartridge.h; sourceTree = "<group>"; };
|
||||
87664CFB2956D3C70009C5C1 /* Pair.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Pair.h; sourceTree = "<group>"; };
|
||||
87664CFC2956D3C70009C5C1 /* Maria.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Maria.h; sourceTree = "<group>"; };
|
||||
87664CFD2956D3C70009C5C1 /* Tia.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Tia.c; sourceTree = "<group>"; };
|
||||
87664CFE2956D3C70009C5C1 /* Memory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Memory.h; sourceTree = "<group>"; };
|
||||
87664CFF2956D3C70009C5C1 /* md5.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = md5.c; sourceTree = "<group>"; };
|
||||
87664D002956D3C70009C5C1 /* Region.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Region.h; sourceTree = "<group>"; };
|
||||
87664D012956D3C70009C5C1 /* ExpansionModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExpansionModule.h; sourceTree = "<group>"; };
|
||||
87664D022956D3C70009C5C1 /* Riot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Riot.h; sourceTree = "<group>"; };
|
||||
87664D032956D3C70009C5C1 /* Equates.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Equates.h; sourceTree = "<group>"; };
|
||||
87664D132956D46D0009C5C1 /* ProSystem.dat */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ProSystem.dat; sourceTree = "<group>"; };
|
||||
8D5B49B6048680CD000E48DA /* ProSystem.oecoreplugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ProSystem.oecoreplugin; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
941DFB2615B6425200C6552F /* ProSystemGameCore.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ProSystemGameCore.mm; sourceTree = "<group>"; };
|
||||
941F598117A6189D0005D7EA /* Archive.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Archive.cpp; sourceTree = "<group>"; };
|
||||
941F598217A6189D0005D7EA /* Archive.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Archive.h; sourceTree = "<group>"; };
|
||||
941F598317A6189D0005D7EA /* Bios.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Bios.cpp; sourceTree = "<group>"; };
|
||||
941F598417A6189D0005D7EA /* Bios.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Bios.h; sourceTree = "<group>"; };
|
||||
941F598517A6189D0005D7EA /* Cartridge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Cartridge.cpp; sourceTree = "<group>"; };
|
||||
941F598617A6189D0005D7EA /* Cartridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Cartridge.h; sourceTree = "<group>"; };
|
||||
941F598717A6189D0005D7EA /* Common.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Common.cpp; sourceTree = "<group>"; };
|
||||
941F598817A6189D0005D7EA /* Common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Common.h; sourceTree = "<group>"; };
|
||||
941F598917A6189D0005D7EA /* Database.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Database.cpp; sourceTree = "<group>"; };
|
||||
941F598A17A6189D0005D7EA /* Database.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Database.h; sourceTree = "<group>"; };
|
||||
941F598B17A6189D0005D7EA /* Equates.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Equates.h; sourceTree = "<group>"; };
|
||||
941F598C17A6189D0005D7EA /* Hash.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Hash.cpp; sourceTree = "<group>"; };
|
||||
941F598D17A6189D0005D7EA /* Hash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Hash.h; sourceTree = "<group>"; };
|
||||
941F598F17A6189D0005D7EA /* Crypt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Crypt.h; sourceTree = "<group>"; };
|
||||
941F599017A6189D0005D7EA /* HtmlHelp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HtmlHelp.h; sourceTree = "<group>"; };
|
||||
941F599217A6189D0005D7EA /* Ioapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Ioapi.h; sourceTree = "<group>"; };
|
||||
941F599317A6189D0005D7EA /* miniunz.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = miniunz.h; sourceTree = "<group>"; };
|
||||
941F599417A6189D0005D7EA /* Unzip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Unzip.c; sourceTree = "<group>"; };
|
||||
941F599517A6189D0005D7EA /* unzip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = unzip.h; sourceTree = "<group>"; };
|
||||
941F599617A6189D0005D7EA /* Zconf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Zconf.h; sourceTree = "<group>"; };
|
||||
941F599717A6189D0005D7EA /* Zip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Zip.c; sourceTree = "<group>"; };
|
||||
941F599817A6189D0005D7EA /* Zip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Zip.h; sourceTree = "<group>"; };
|
||||
941F599917A6189D0005D7EA /* Zlib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Zlib.h; sourceTree = "<group>"; };
|
||||
941F599B17A6189D0005D7EA /* Logger.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Logger.cpp; sourceTree = "<group>"; };
|
||||
941F599C17A6189D0005D7EA /* Logger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Logger.h; sourceTree = "<group>"; };
|
||||
941F599D17A6189D0005D7EA /* Maria.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Maria.cpp; sourceTree = "<group>"; };
|
||||
941F599E17A6189D0005D7EA /* Maria.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Maria.h; sourceTree = "<group>"; };
|
||||
941F599F17A6189D0005D7EA /* Memory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Memory.cpp; sourceTree = "<group>"; };
|
||||
941F59A017A6189D0005D7EA /* Memory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Memory.h; sourceTree = "<group>"; };
|
||||
941F59A117A6189D0005D7EA /* Pair.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Pair.h; sourceTree = "<group>"; };
|
||||
941F59A217A6189D0005D7EA /* Palette.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Palette.cpp; sourceTree = "<group>"; };
|
||||
941F59A317A6189D0005D7EA /* Palette.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Palette.h; sourceTree = "<group>"; };
|
||||
941F59A417A6189D0005D7EA /* Pokey.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Pokey.cpp; sourceTree = "<group>"; };
|
||||
941F59A517A6189D0005D7EA /* Pokey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Pokey.h; sourceTree = "<group>"; };
|
||||
941F59A617A6189D0005D7EA /* ProSystem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProSystem.cpp; sourceTree = "<group>"; };
|
||||
941F59A717A6189D0005D7EA /* ProSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProSystem.h; sourceTree = "<group>"; };
|
||||
941F59A817A6189D0005D7EA /* Rect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Rect.h; sourceTree = "<group>"; };
|
||||
941F59A917A6189D0005D7EA /* Region.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Region.cpp; sourceTree = "<group>"; };
|
||||
941F59AA17A6189D0005D7EA /* Region.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Region.h; sourceTree = "<group>"; };
|
||||
941F59AB17A6189D0005D7EA /* Riot.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Riot.cpp; sourceTree = "<group>"; };
|
||||
941F59AC17A6189D0005D7EA /* Riot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Riot.h; sourceTree = "<group>"; };
|
||||
941F59AD17A6189D0005D7EA /* Sally.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Sally.cpp; sourceTree = "<group>"; };
|
||||
941F59AE17A6189D0005D7EA /* Sally.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Sally.h; sourceTree = "<group>"; };
|
||||
941F59AF17A6189D0005D7EA /* Sound.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Sound.cpp; sourceTree = "<group>"; };
|
||||
941F59B017A6189D0005D7EA /* Sound.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Sound.h; sourceTree = "<group>"; };
|
||||
941F59B117A6189D0005D7EA /* Tia.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Tia.cpp; sourceTree = "<group>"; };
|
||||
941F59B217A6189D0005D7EA /* Tia.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Tia.h; sourceTree = "<group>"; };
|
||||
941F59B317A6189D0005D7EA /* Timer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Timer.cpp; sourceTree = "<group>"; };
|
||||
941F59B417A6189D0005D7EA /* Timer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Timer.h; sourceTree = "<group>"; };
|
||||
941F59B617A6189D0005D7EA /* Crypt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Crypt.h; sourceTree = "<group>"; };
|
||||
941F59B717A6189D0005D7EA /* HtmlHelp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HtmlHelp.h; sourceTree = "<group>"; };
|
||||
941F59B917A6189D0005D7EA /* Ioapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Ioapi.h; sourceTree = "<group>"; };
|
||||
941F59BA17A6189D0005D7EA /* Unzip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Unzip.h; sourceTree = "<group>"; };
|
||||
941F59BB17A6189D0005D7EA /* Zconf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Zconf.h; sourceTree = "<group>"; };
|
||||
941F59BC17A6189D0005D7EA /* Zip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Zip.h; sourceTree = "<group>"; };
|
||||
941F59BD17A6189D0005D7EA /* Zlib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Zlib.h; sourceTree = "<group>"; };
|
||||
941DFB2615B6425200C6552F /* ProSystemGameCore.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.objc; fileEncoding = 4; path = ProSystemGameCore.m; sourceTree = "<group>"; };
|
||||
941F59DB17A62ADD0005D7EA /* OpenEmuBase.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = OpenEmuBase.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
941F59FB17A77CC90005D7EA /* ProSystem.dat */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ProSystem.dat; sourceTree = SOURCE_ROOT; };
|
||||
941F5A2617A78FF20005D7EA /* OE7800SystemResponderClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OE7800SystemResponderClient.h; path = "../OpenEmu/SystemPlugins/Atari 7800/OE7800SystemResponderClient.h"; sourceTree = "<group>"; };
|
||||
B5008DAD0E8BFB3E005AECAF /* ProSystemGameCore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProSystemGameCore.h; sourceTree = "<group>"; };
|
||||
D2F7E65807B2D6F200F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
|
||||
@@ -174,7 +143,7 @@
|
||||
files = (
|
||||
941F59DC17A62ADD0005D7EA /* OpenEmuBase.framework in Frameworks */,
|
||||
8D5B49B4048680CD000E48DA /* Cocoa.framework in Frameworks */,
|
||||
82EC409F0FD9EC420017FC19 /* libz.dylib in Frameworks */,
|
||||
82EC409F0FD9EC420017FC19 /* libz.tbd in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -184,25 +153,24 @@
|
||||
089C166AFE841209C02AAC07 /* VisualBoyAdvance */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
94A9E27F157D637B0083A7DC /* Core */,
|
||||
87664CE12956D3B70009C5C1 /* Core */,
|
||||
08FB77AFFE84173DC02AAC07 /* Classes */,
|
||||
32C88E010371C26100C91783 /* Other Sources */,
|
||||
089C167CFE841241C02AAC07 /* Resources */,
|
||||
089C1671FE841209C02AAC07 /* Frameworks and Libraries */,
|
||||
089C1671FE841209C02AAC07 /* Frameworks */,
|
||||
19C28FB8FE9D52D311CA2CBB /* Products */,
|
||||
);
|
||||
name = VisualBoyAdvance;
|
||||
sourceTree = "<group>";
|
||||
usesTabs = 0;
|
||||
};
|
||||
089C1671FE841209C02AAC07 /* Frameworks and Libraries */ = {
|
||||
089C1671FE841209C02AAC07 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
82EC409E0FD9EC420017FC19 /* libz.dylib */,
|
||||
82EC409E0FD9EC420017FC19 /* libz.tbd */,
|
||||
1058C7ACFEA557BF11CA2CBB /* Linked Frameworks */,
|
||||
1058C7AEFEA557BF11CA2CBB /* Other Frameworks */,
|
||||
);
|
||||
name = "Frameworks and Libraries";
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
089C167CFE841241C02AAC07 /* Resources */ = {
|
||||
@@ -210,6 +178,7 @@
|
||||
children = (
|
||||
8D5B49B7048680CD000E48DA /* Info.plist */,
|
||||
089C167DFE841241C02AAC07 /* InfoPlist.strings */,
|
||||
87664D132956D46D0009C5C1 /* ProSystem.dat */,
|
||||
);
|
||||
name = Resources;
|
||||
sourceTree = "<group>";
|
||||
@@ -219,7 +188,7 @@
|
||||
children = (
|
||||
941F5A2617A78FF20005D7EA /* OE7800SystemResponderClient.h */,
|
||||
B5008DAD0E8BFB3E005AECAF /* ProSystemGameCore.h */,
|
||||
941DFB2615B6425200C6552F /* ProSystemGameCore.mm */,
|
||||
941DFB2615B6425200C6552F /* ProSystemGameCore.m */,
|
||||
);
|
||||
name = Classes;
|
||||
sourceTree = "<group>";
|
||||
@@ -251,101 +220,52 @@
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
32C88E010371C26100C91783 /* Other Sources */ = {
|
||||
87664CE12956D3B70009C5C1 /* Core */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
87664CE22956D3C70009C5C1 /* src */,
|
||||
);
|
||||
name = "Other Sources";
|
||||
name = Core;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
941F598017A6189D0005D7EA /* core */ = {
|
||||
87664CE22956D3C70009C5C1 /* src */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
941F598117A6189D0005D7EA /* Archive.cpp */,
|
||||
941F598217A6189D0005D7EA /* Archive.h */,
|
||||
941F598317A6189D0005D7EA /* Bios.cpp */,
|
||||
941F598417A6189D0005D7EA /* Bios.h */,
|
||||
941F598517A6189D0005D7EA /* Cartridge.cpp */,
|
||||
941F598617A6189D0005D7EA /* Cartridge.h */,
|
||||
941F598717A6189D0005D7EA /* Common.cpp */,
|
||||
941F598817A6189D0005D7EA /* Common.h */,
|
||||
941F598917A6189D0005D7EA /* Database.cpp */,
|
||||
941F598A17A6189D0005D7EA /* Database.h */,
|
||||
941F598B17A6189D0005D7EA /* Equates.h */,
|
||||
871EC9A124F08BF600CEC578 /* ExpansionModule.cpp */,
|
||||
871EC9A024F08BF600CEC578 /* ExpansionModule.h */,
|
||||
941F598C17A6189D0005D7EA /* Hash.cpp */,
|
||||
941F598D17A6189D0005D7EA /* Hash.h */,
|
||||
941F598E17A6189D0005D7EA /* lib */,
|
||||
941F599B17A6189D0005D7EA /* Logger.cpp */,
|
||||
941F599C17A6189D0005D7EA /* Logger.h */,
|
||||
941F599D17A6189D0005D7EA /* Maria.cpp */,
|
||||
941F599E17A6189D0005D7EA /* Maria.h */,
|
||||
941F599F17A6189D0005D7EA /* Memory.cpp */,
|
||||
941F59A017A6189D0005D7EA /* Memory.h */,
|
||||
941F59A117A6189D0005D7EA /* Pair.h */,
|
||||
941F59A217A6189D0005D7EA /* Palette.cpp */,
|
||||
941F59A317A6189D0005D7EA /* Palette.h */,
|
||||
941F59A417A6189D0005D7EA /* Pokey.cpp */,
|
||||
941F59A517A6189D0005D7EA /* Pokey.h */,
|
||||
941F59A617A6189D0005D7EA /* ProSystem.cpp */,
|
||||
941F59A717A6189D0005D7EA /* ProSystem.h */,
|
||||
941F59A817A6189D0005D7EA /* Rect.h */,
|
||||
941F59A917A6189D0005D7EA /* Region.cpp */,
|
||||
941F59AA17A6189D0005D7EA /* Region.h */,
|
||||
941F59AB17A6189D0005D7EA /* Riot.cpp */,
|
||||
941F59AC17A6189D0005D7EA /* Riot.h */,
|
||||
941F59AD17A6189D0005D7EA /* Sally.cpp */,
|
||||
941F59AE17A6189D0005D7EA /* Sally.h */,
|
||||
941F59AF17A6189D0005D7EA /* Sound.cpp */,
|
||||
941F59B017A6189D0005D7EA /* Sound.h */,
|
||||
941F59B117A6189D0005D7EA /* Tia.cpp */,
|
||||
941F59B217A6189D0005D7EA /* Tia.h */,
|
||||
941F59B317A6189D0005D7EA /* Timer.cpp */,
|
||||
941F59B417A6189D0005D7EA /* Timer.h */,
|
||||
87664CF22956D3C70009C5C1 /* Bios.c */,
|
||||
87664CE72956D3C70009C5C1 /* Bios.h */,
|
||||
87664CEC2956D3C70009C5C1 /* Cartridge.c */,
|
||||
87664CFA2956D3C70009C5C1 /* Cartridge.h */,
|
||||
87664CED2956D3C70009C5C1 /* Database.c */,
|
||||
87664CF82956D3C70009C5C1 /* Database.h */,
|
||||
87664D032956D3C70009C5C1 /* Equates.h */,
|
||||
87664CF02956D3C70009C5C1 /* ExpansionModule.c */,
|
||||
87664D012956D3C70009C5C1 /* ExpansionModule.h */,
|
||||
87664CE92956D3C70009C5C1 /* Maria.c */,
|
||||
87664CFC2956D3C70009C5C1 /* Maria.h */,
|
||||
87664CFF2956D3C70009C5C1 /* md5.c */,
|
||||
87664CEE2956D3C70009C5C1 /* md5.h */,
|
||||
87664CE82956D3C70009C5C1 /* Memory.c */,
|
||||
87664CFE2956D3C70009C5C1 /* Memory.h */,
|
||||
87664CFB2956D3C70009C5C1 /* Pair.h */,
|
||||
87664CE62956D3C70009C5C1 /* Palette.c */,
|
||||
87664CF42956D3C70009C5C1 /* Palette.h */,
|
||||
87664CF52956D3C70009C5C1 /* Pokey.c */,
|
||||
87664CE42956D3C70009C5C1 /* Pokey.h */,
|
||||
87664CF92956D3C70009C5C1 /* ProSystem.c */,
|
||||
87664CEB2956D3C70009C5C1 /* ProSystem.h */,
|
||||
87664CF62956D3C70009C5C1 /* Rect.h */,
|
||||
87664CEF2956D3C70009C5C1 /* Region.c */,
|
||||
87664D002956D3C70009C5C1 /* Region.h */,
|
||||
87664CF12956D3C70009C5C1 /* Riot.c */,
|
||||
87664D022956D3C70009C5C1 /* Riot.h */,
|
||||
87664CF32956D3C70009C5C1 /* Sally.c */,
|
||||
87664CE52956D3C70009C5C1 /* Sally.h */,
|
||||
87664CF72956D3C70009C5C1 /* Sound.c */,
|
||||
87664CE32956D3C70009C5C1 /* Sound.h */,
|
||||
87664CFD2956D3C70009C5C1 /* Tia.c */,
|
||||
87664CEA2956D3C70009C5C1 /* Tia.h */,
|
||||
);
|
||||
path = core;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
941F598E17A6189D0005D7EA /* lib */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
941F598F17A6189D0005D7EA /* Crypt.h */,
|
||||
941F599017A6189D0005D7EA /* HtmlHelp.h */,
|
||||
941F599217A6189D0005D7EA /* Ioapi.h */,
|
||||
941F599317A6189D0005D7EA /* miniunz.h */,
|
||||
941F599417A6189D0005D7EA /* Unzip.c */,
|
||||
941F599517A6189D0005D7EA /* unzip.h */,
|
||||
941F599617A6189D0005D7EA /* Zconf.h */,
|
||||
941F599717A6189D0005D7EA /* Zip.c */,
|
||||
941F599817A6189D0005D7EA /* Zip.h */,
|
||||
941F599917A6189D0005D7EA /* Zlib.h */,
|
||||
);
|
||||
path = lib;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
941F59B517A6189D0005D7EA /* Lib */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
941F59B617A6189D0005D7EA /* Crypt.h */,
|
||||
941F59B717A6189D0005D7EA /* HtmlHelp.h */,
|
||||
941F59B917A6189D0005D7EA /* Ioapi.h */,
|
||||
941F59BA17A6189D0005D7EA /* Unzip.h */,
|
||||
941F59BB17A6189D0005D7EA /* Zconf.h */,
|
||||
941F59BC17A6189D0005D7EA /* Zip.h */,
|
||||
941F59BD17A6189D0005D7EA /* Zlib.h */,
|
||||
);
|
||||
path = Lib;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
94A9E27F157D637B0083A7DC /* Core */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
941F59FB17A77CC90005D7EA /* ProSystem.dat */,
|
||||
941F598017A6189D0005D7EA /* core */,
|
||||
941F59B517A6189D0005D7EA /* Lib */,
|
||||
);
|
||||
path = Core;
|
||||
path = src;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
@@ -401,7 +321,7 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
8D5B49B0048680CD000E48DA /* InfoPlist.strings in Resources */,
|
||||
941F59FC17A77CC90005D7EA /* ProSystem.dat in Resources */,
|
||||
87664D142956D46E0009C5C1 /* ProSystem.dat in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -441,28 +361,22 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
8794D9691B74713300897F57 /* Sound.cpp in Sources */,
|
||||
941DFB2715B6425200C6552F /* ProSystemGameCore.mm in Sources */,
|
||||
941F59BF17A6189D0005D7EA /* Archive.cpp in Sources */,
|
||||
941F59C017A6189D0005D7EA /* Bios.cpp in Sources */,
|
||||
941F59C117A6189D0005D7EA /* Cartridge.cpp in Sources */,
|
||||
941F59C217A6189D0005D7EA /* Common.cpp in Sources */,
|
||||
941F59C317A6189D0005D7EA /* Database.cpp in Sources */,
|
||||
941F59C417A6189D0005D7EA /* Hash.cpp in Sources */,
|
||||
941F59C617A6189D0005D7EA /* Unzip.c in Sources */,
|
||||
941F59C717A6189D0005D7EA /* Zip.c in Sources */,
|
||||
941F59C917A6189D0005D7EA /* Logger.cpp in Sources */,
|
||||
941F59CA17A6189D0005D7EA /* Maria.cpp in Sources */,
|
||||
941F59CB17A6189D0005D7EA /* Memory.cpp in Sources */,
|
||||
941F59CC17A6189D0005D7EA /* Palette.cpp in Sources */,
|
||||
941F59CD17A6189D0005D7EA /* Pokey.cpp in Sources */,
|
||||
941F59CE17A6189D0005D7EA /* ProSystem.cpp in Sources */,
|
||||
941F59CF17A6189D0005D7EA /* Region.cpp in Sources */,
|
||||
871EC9A224F08BF700CEC578 /* ExpansionModule.cpp in Sources */,
|
||||
941F59D017A6189D0005D7EA /* Riot.cpp in Sources */,
|
||||
941F59D117A6189D0005D7EA /* Sally.cpp in Sources */,
|
||||
941F59D317A6189D0005D7EA /* Tia.cpp in Sources */,
|
||||
941F59D417A6189D0005D7EA /* Timer.cpp in Sources */,
|
||||
941DFB2715B6425200C6552F /* ProSystemGameCore.m in Sources */,
|
||||
87664D0C2956D3C70009C5C1 /* Bios.c in Sources */,
|
||||
87664D072956D3C70009C5C1 /* Cartridge.c in Sources */,
|
||||
87664D082956D3C70009C5C1 /* Database.c in Sources */,
|
||||
87664D0A2956D3C70009C5C1 /* ExpansionModule.c in Sources */,
|
||||
87664D062956D3C70009C5C1 /* Maria.c in Sources */,
|
||||
87664D122956D3C70009C5C1 /* md5.c in Sources */,
|
||||
87664D052956D3C70009C5C1 /* Memory.c in Sources */,
|
||||
87664D042956D3C70009C5C1 /* Palette.c in Sources */,
|
||||
87664D0E2956D3C70009C5C1 /* Pokey.c in Sources */,
|
||||
87664D102956D3C70009C5C1 /* ProSystem.c in Sources */,
|
||||
87664D092956D3C70009C5C1 /* Region.c in Sources */,
|
||||
87664D0B2956D3C70009C5C1 /* Riot.c in Sources */,
|
||||
87664D0D2956D3C70009C5C1 /* Sally.c in Sources */,
|
||||
87664D0F2956D3C70009C5C1 /* Sound.c in Sources */,
|
||||
87664D112956D3C70009C5C1 /* Tia.c in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -509,7 +423,6 @@
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.openemu.${PRODUCT_NAME:identifier}";
|
||||
PRODUCT_NAME = ProSystem;
|
||||
SKIP_INSTALL = YES;
|
||||
VALID_ARCHS = x86_64;
|
||||
WRAPPER_EXTENSION = oecoreplugin;
|
||||
};
|
||||
name = Debug;
|
||||
@@ -530,7 +443,6 @@
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.openemu.${PRODUCT_NAME:identifier}";
|
||||
PRODUCT_NAME = ProSystem;
|
||||
SKIP_INSTALL = YES;
|
||||
VALID_ARCHS = x86_64;
|
||||
WRAPPER_EXTENSION = oecoreplugin;
|
||||
};
|
||||
name = Release;
|
||||
@@ -565,6 +477,7 @@
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = "";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.11;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Debug;
|
||||
|
||||
@@ -89,10 +89,12 @@
|
||||
// Right difficulty switch defaults to right position, "(A)dvanced", which fixes Tower Toppler
|
||||
_inputState[RIGHT_DIFF_SWITCH] = RIGHT_POSITION;
|
||||
|
||||
if(cartridge_Load(path.fileSystemRepresentation))
|
||||
NSData *romData = [NSData dataWithContentsOfFile:path];
|
||||
|
||||
if(cartridge_Load((const uint8_t*)romData.bytes, (uint32_t)romData.length))
|
||||
{
|
||||
NSString *databasePath = [[[NSBundle bundleForClass:[self class]] resourcePath] stringByAppendingPathComponent:@"ProSystem.dat"];
|
||||
database_filename = databasePath.fileSystemRepresentation;
|
||||
NSURL *databaseURL = [self.owner.bundle URLForResource:@"ProSystem" withExtension:@"dat"];
|
||||
database_filename = databaseURL.fileSystemRepresentation;
|
||||
database_enabled = true;
|
||||
|
||||
// BIOS is optional
|
||||
@@ -100,15 +102,14 @@
|
||||
if (bios_Load(biosROM.fileSystemRepresentation))
|
||||
bios_enabled = true;
|
||||
|
||||
NSLog(@"[ProSystem] Headerless MD5 hash: %s", cartridge_digest.c_str());
|
||||
NSLog(@"[ProSystem] Header info (often wrong):\ntitle: %s\ntype: %d\nregion: %s\npokey: %s", cartridge_title.c_str(), cartridge_type, cartridge_region == REGION_NTSC ? "NTSC" : "PAL", cartridge_pokey ? "true" : "false");
|
||||
NSLog(@"[ProSystem] Headerless MD5 hash: %s", cart_digest);
|
||||
NSLog(@"[ProSystem] Header info (often wrong):\ntitle: %s\ntype: %d\nregion: %s\npokey: %s", cartridge_title, cartridge_type, cartridge_region == REGION_NTSC ? "NTSC" : "PAL", cartridge_pokey ? "true" : "false");
|
||||
|
||||
database_Load(cartridge_digest);
|
||||
database_Load(cart_digest);
|
||||
prosystem_Reset();
|
||||
|
||||
if (cart_in_db) {
|
||||
std::string title = common_Trim(cartridge_title);
|
||||
NSLog(@"[ProSystem] Database info:\ntitle: %@\ntype: %d\nregion: %s\npokey: %s", [NSString stringWithUTF8String:title.c_str()], cartridge_type, cartridge_region == REGION_NTSC ? "NTSC" : "PAL", cartridge_pokey ? "true" : "false");
|
||||
NSLog(@"[ProSystem] Database info:\ntitle: %@\ntype: %d\nregion: %s\npokey: %s", [[NSString stringWithUTF8String:cartridge_title] stringByTrimmingCharactersInSet:NSCharacterSet.whitespaceAndNewlineCharacterSet], cartridge_type, cartridge_region == REGION_NTSC ? "NTSC" : "PAL", cartridge_pokey ? "true" : "false");
|
||||
}
|
||||
|
||||
//sound_SetSampleRate(48000);
|
||||
@@ -133,10 +134,10 @@
|
||||
{
|
||||
prosystem_ExecuteFrame(_inputState);
|
||||
|
||||
_videoWidth = maria_visibleArea.GetLength();
|
||||
_videoHeight = maria_visibleArea.GetHeight();
|
||||
_videoWidth = ((maria_displayArea.right - maria_displayArea.left) + 1);
|
||||
_videoHeight = ((maria_visibleArea.bottom - maria_visibleArea.top) + 1);
|
||||
|
||||
uint8_t *buffer = maria_surface + ((maria_visibleArea.top - maria_displayArea.top) * maria_visibleArea.GetLength());
|
||||
uint8_t *buffer = maria_surface + ((maria_visibleArea.top - maria_displayArea.top) * _videoWidth);
|
||||
uint32_t *surface = (uint32_t *)_videoBuffer;
|
||||
int pitch = 320;
|
||||
|
||||
@@ -154,7 +155,7 @@
|
||||
}
|
||||
|
||||
int length = sound_Store(_soundBuffer);
|
||||
[[self ringBufferAtIndex:0] write:_soundBuffer maxLength:length];
|
||||
[[self audioBufferAtIndex:0] write:_soundBuffer maxLength:length];
|
||||
}
|
||||
|
||||
- (void)resetEmulation
|
||||
@@ -176,12 +177,12 @@
|
||||
|
||||
- (OEIntRect)screenRect
|
||||
{
|
||||
return OEIntRectMake(0, 0, maria_visibleArea.GetLength(), maria_visibleArea.GetHeight());
|
||||
return OEIntRectMake(0, 0, _videoWidth, _videoHeight);
|
||||
}
|
||||
|
||||
- (OEIntSize)aspectSize
|
||||
{
|
||||
return OEIntSizeMake(maria_visibleArea.GetLength(), maria_visibleArea.GetHeight());
|
||||
return OEIntSizeMake(_videoWidth, _videoHeight);
|
||||
}
|
||||
|
||||
- (OEIntSize)bufferSize
|
||||
@@ -220,7 +221,7 @@
|
||||
|
||||
- (void)saveStateToFileAtPath:(NSString *)fileName completionHandler:(void (^)(BOOL, NSError *))block
|
||||
{
|
||||
block(prosystem_Save(fileName.fileSystemRepresentation, false) ? YES : NO, nil);
|
||||
block(prosystem_Save(fileName.fileSystemRepresentation) ? YES : NO, nil);
|
||||
}
|
||||
|
||||
- (void)loadStateFromFileAtPath:(NSString *)fileName completionHandler:(void (^)(BOOL, NSError *))block
|
||||
@@ -0,0 +1,40 @@
|
||||
ProSystem JG
|
||||
------------
|
||||
ProSystem JG is an emulator for the Atari 7800.
|
||||
|
||||
This is a fork of ProSystem 1.3e with patches from OpenEmu, which contains
|
||||
patches derived from Wii7800 and js7800.
|
||||
|
||||
The code has been significantly altered. It was ported from C++ to C, and
|
||||
all of the dependencies and Windows-specific code were removed.
|
||||
|
||||
This repository lives at https://gitlab.com/jgemu/prosystem
|
||||
|
||||
Compiling
|
||||
---------
|
||||
Make sure you have The Jolly Good API's header files installed. If you did
|
||||
not install them, you will be required to include their path in CFLAGS.
|
||||
|
||||
Linux:
|
||||
make
|
||||
|
||||
macOS:
|
||||
make
|
||||
|
||||
BSD:
|
||||
gmake
|
||||
|
||||
Windows (MSYS2):
|
||||
make
|
||||
|
||||
The build will be output to "prosystem/". This directory may be used as is
|
||||
locally by copying it to your local "cores" directory, or may be installed
|
||||
system-wide using the "install" target specified in the Makefile.
|
||||
|
||||
Input Devices
|
||||
-------------
|
||||
ProSystem JG uses a game database to determine which input devices must be
|
||||
plugged in. The following input devices are currently supported:
|
||||
|
||||
7800 Joystick
|
||||
XG-1 Light Gun
|
||||
@@ -1,50 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// About.cpp
|
||||
// ----------------------------------------------------------------------------
|
||||
#include "About.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Procedure
|
||||
// ----------------------------------------------------------------------------
|
||||
static BOOL CALLBACK about_Procedure(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
|
||||
if(message == WM_INITDIALOG) {
|
||||
HWND hStaticVersion = GetDlgItem(hWnd, IDC_STATIC_VERSION2);
|
||||
std::string versionText = "Version " + common_Format(CONSOLE_VERSION, "%1.1f");
|
||||
SetWindowText(hStaticVersion, versionText.c_str( ));
|
||||
}
|
||||
else if(message == WM_COMMAND) {
|
||||
if(LOWORD(wParam) == IDCANCEL || LOWORD(wParam) == IDC_BUTTON_ABOUT_OK) {
|
||||
EndDialog(hWnd, 0);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Show
|
||||
// ----------------------------------------------------------------------------
|
||||
void about_Show(HWND hWnd, HINSTANCE hInstance) {
|
||||
DialogBox(hInstance, MAKEINTRESOURCE(IDD_DIALOG_ABOUT), hWnd, (DLGPROC)about_Procedure);
|
||||
}
|
||||
-39
@@ -1,39 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// About.h
|
||||
// ----------------------------------------------------------------------------
|
||||
#ifndef ABOUT_H
|
||||
#define ABOUT_H
|
||||
|
||||
#include <Windows.h>
|
||||
#include "Resource.h"
|
||||
#include "Common.h"
|
||||
#include "Console.h"
|
||||
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned short word;
|
||||
typedef unsigned int uint;
|
||||
|
||||
extern void about_Show(HWND hWnd, HINSTANCE hInstance);
|
||||
|
||||
#endif
|
||||
-216
@@ -1,216 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Common.cpp
|
||||
// ----------------------------------------------------------------------------
|
||||
#include "Common.h"
|
||||
|
||||
std::string common_defaultPath;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Format
|
||||
// ----------------------------------------------------------------------------
|
||||
std::string common_Format(double value) {
|
||||
return common_Format(value, "%f");
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Format
|
||||
// ----------------------------------------------------------------------------
|
||||
std::string common_Format(double value, std::string specification) {
|
||||
char buffer[17] = {0};
|
||||
sprintf(buffer, specification.c_str( ), value);
|
||||
return std::string(buffer);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Format
|
||||
// ----------------------------------------------------------------------------
|
||||
std::string common_Format(uint value) {
|
||||
char buffer[11] = {0};
|
||||
sprintf(buffer, "%d", value);
|
||||
return std::string(buffer);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Format
|
||||
// ----------------------------------------------------------------------------
|
||||
std::string common_Format(word value) {
|
||||
char buffer[6] = {0};
|
||||
sprintf(buffer, "%d", value);
|
||||
return std::string(buffer);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Format
|
||||
// ----------------------------------------------------------------------------
|
||||
std::string common_Format(byte value) {
|
||||
char buffer[4] = {0};
|
||||
sprintf(buffer, "%d", value);
|
||||
return std::string(buffer);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Format
|
||||
// ----------------------------------------------------------------------------
|
||||
std::string common_Format(bool value) {
|
||||
return (value)? "true": "false";
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Format
|
||||
// ----------------------------------------------------------------------------
|
||||
std::string common_Format(HRESULT result) {
|
||||
char buffer[10] = {0};
|
||||
sprintf(buffer, "%#8x", result);
|
||||
return std::string(buffer);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ParseUint
|
||||
// ----------------------------------------------------------------------------
|
||||
uint common_ParseUint(std::string text) {
|
||||
return (uint)atoi(text.c_str( ));
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ParseWord
|
||||
// ----------------------------------------------------------------------------
|
||||
word common_ParseWord(std::string text) {
|
||||
return (word)atoi(text.c_str( ));
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ParseByte
|
||||
// ----------------------------------------------------------------------------
|
||||
byte common_ParseByte(std::string text) {
|
||||
return (byte)atoi(text.c_str( ));
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ParseBool
|
||||
// ----------------------------------------------------------------------------
|
||||
bool common_ParseBool(std::string text) {
|
||||
if(text.compare("true") == 0 || text.compare("TRUE") == 0 || text.compare("True") == 0) {
|
||||
return true;
|
||||
}
|
||||
if(atoi(text.c_str( )) == 1) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Trim
|
||||
// ----------------------------------------------------------------------------
|
||||
std::string common_Trim(std::string target) {
|
||||
int index;
|
||||
for(index = target.length( ) - 1; index >= 0; index--) {
|
||||
if(target[index] != 0x20 && target[index] != '\n') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return target.substr(0, index + 1);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Remove
|
||||
// ----------------------------------------------------------------------------
|
||||
std::string common_Remove(std::string target, char value) {
|
||||
int length = 0;
|
||||
int index;
|
||||
for(index = 0; index < target.size( ); index++) {
|
||||
if(target[index] != value) {
|
||||
length++;
|
||||
}
|
||||
}
|
||||
|
||||
char* buffer = new char[length + 1];
|
||||
int count = 0;
|
||||
for(index = 0; index < target.size( ); index++) {
|
||||
if(target[index] != value) {
|
||||
buffer[count] = target[index];
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
buffer[length] = 0;
|
||||
std::string source = buffer;
|
||||
delete[ ] buffer;
|
||||
return source;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Replace (string, from, to)
|
||||
// ----------------------------------------------------------------------------
|
||||
std::string common_Replace(std::string target, char value1, char value2) {
|
||||
int length = 0;
|
||||
int index;
|
||||
for(index = 0; index < target.size( ); index++) {
|
||||
length++;
|
||||
}
|
||||
|
||||
char* buffer = new char[length + 1];
|
||||
for(index = 0; index < target.size( ); index++) {
|
||||
if(target[index] != value1) {
|
||||
buffer[index] = target[index];
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer[index] = value2;
|
||||
}
|
||||
}
|
||||
|
||||
buffer[length] = 0;
|
||||
std::string source = buffer;
|
||||
delete[ ] buffer;
|
||||
return source;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// GetErrorMessage
|
||||
// ----------------------------------------------------------------------------
|
||||
std::string common_GetErrorMessage( ) {
|
||||
return common_GetErrorMessage(GetLastError( ));
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// GetErrorMessage
|
||||
// ----------------------------------------------------------------------------
|
||||
std::string common_GetErrorMessage(DWORD error) {
|
||||
void* buffer;
|
||||
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&buffer, 0, NULL);
|
||||
std::string message((char*)buffer);
|
||||
LocalFree(buffer);
|
||||
return message;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// GetExtension
|
||||
// ----------------------------------------------------------------------------
|
||||
std::string common_GetExtension(std::string filename) {
|
||||
int position = filename.rfind('.');
|
||||
if(position != -1) {
|
||||
return filename.substr(position);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Common.h
|
||||
// ----------------------------------------------------------------------------
|
||||
#ifndef COMMON_H
|
||||
#define COMMON_H
|
||||
|
||||
#include <Windows.h>
|
||||
#include <String>
|
||||
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned short word;
|
||||
typedef unsigned int uint;
|
||||
|
||||
extern std::string common_Format(double value);
|
||||
extern std::string common_Format(double value, std::string specification);
|
||||
extern std::string common_Format(uint value);
|
||||
extern std::string common_Format(word value);
|
||||
extern std::string common_Format(byte value);
|
||||
extern std::string common_Format(bool value);
|
||||
extern std::string common_Format(HRESULT result);
|
||||
extern std::string common_Trim(std::string target);
|
||||
extern std::string common_Remove(std::string target, char value);
|
||||
extern std::string common_Replace(std::string target, char value1, char value2);
|
||||
extern std::string common_GetErrorMessage( );
|
||||
extern std::string common_GetErrorMessage(DWORD error);
|
||||
extern std::string common_GetExtension(std::string filename);
|
||||
extern uint common_ParseUint(std::string text);
|
||||
extern word common_ParseWord(std::string text);
|
||||
extern byte common_ParseByte(std::string text);
|
||||
extern bool common_ParseBool(std::string text);
|
||||
extern std::string common_defaultPath;
|
||||
|
||||
#endif
|
||||
@@ -1,317 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Configuration.cpp
|
||||
// ----------------------------------------------------------------------------
|
||||
#include "Configuration.h"
|
||||
#include "Console.h"
|
||||
|
||||
|
||||
bool configuration_enabled = true;
|
||||
bool screenshot1=false;
|
||||
bool screenshot2=false;
|
||||
uint samplerate;
|
||||
|
||||
|
||||
static const std::string CONFIGURATION_SECTION_CONSOLE = "Console";
|
||||
static const std::string CONFIGURATION_SECTION_RECENT = "Recent";
|
||||
static const std::string CONFIGURATION_SECTION_DISPLAY = "Display";
|
||||
static const std::string CONFIGURATION_SECTION_SOUND = "Sound";
|
||||
static const std::string CONFIGURATION_SECTION_EMULATION = "Emulation";
|
||||
static const std::string CONFIGURATION_SECTION_INPUT = "Input";
|
||||
|
||||
static std::string configuration_filename;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// CommandLine
|
||||
// ----------------------------------------------------------------------------
|
||||
std::string configuration_CommandLine(std::string commandLine) {
|
||||
char **argv;
|
||||
int argc,i;
|
||||
std::string tmp_string;
|
||||
|
||||
argc = __argc;
|
||||
argv = __argv;
|
||||
for ( i = 1; i < argc; ++i ) {
|
||||
if ( strstr(argv[i],"-Fullscreen") || strstr(argv[i],"-fullscreen") ) {
|
||||
if ( ++i < argc ) {
|
||||
if ( atoi(argv[i]) )
|
||||
display_fullscreen = true;
|
||||
else
|
||||
display_fullscreen = false;
|
||||
}
|
||||
}
|
||||
|
||||
else if ( strstr(argv[i],"-MenuEnabled") || strstr(argv[i],"-menuenabled") ) {
|
||||
if ( ++i < argc ) {
|
||||
if ( atoi(argv[i]) )
|
||||
display_menuenabled = true;
|
||||
else
|
||||
display_menuenabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
else if ( strstr(argv[i],"-Palette") || strstr(argv[i],"-palette") ) {
|
||||
if ( ++i < argc ) {
|
||||
tmp_string = argv[i];
|
||||
palette_default = false;
|
||||
palette_Load(common_Remove(tmp_string,'"'));
|
||||
}
|
||||
}
|
||||
|
||||
else if ( strstr(argv[i],"-Zoom") || strstr(argv[i],"-zoom") ) {
|
||||
if ( ++i < argc ) {
|
||||
display_zoom = atoi(argv[i]);
|
||||
}
|
||||
}
|
||||
|
||||
else if ( strstr(argv[i],"-Mute") || strstr(argv[i],"-mute") ) {
|
||||
if ( ++i < argc ) {
|
||||
if ( atoi(argv[i]) )
|
||||
sound_SetMuted(true);
|
||||
else
|
||||
sound_SetMuted(false);
|
||||
}
|
||||
}
|
||||
|
||||
else if ( strstr(argv[i],"-Latency") || strstr(argv[i],"-latency") ) {
|
||||
if ( ++i < argc ) {
|
||||
sound_latency = atoi(argv[i]);
|
||||
}
|
||||
}
|
||||
|
||||
else if ( strstr(argv[i],"-SampleRate") || strstr(argv[i],"-samplerate") ) {
|
||||
if ( ++i < argc ) {
|
||||
sound_SetSampleRate ( atoi(argv[i]) );
|
||||
samplerate=atoi(argv[i]);
|
||||
}
|
||||
}
|
||||
|
||||
else if ( strstr(argv[i],"-Region") || strstr(argv[i],"-region") ) {
|
||||
if ( ++i < argc ) {
|
||||
if ( strstr(argv[i],"PAL") )
|
||||
region_type = REGION_PAL;
|
||||
else if ( strstr(argv[i],"NTSC") )
|
||||
region_type = REGION_NTSC;
|
||||
else
|
||||
region_type = REGION_AUTO;
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
return tmp_string = argv[i];
|
||||
}
|
||||
|
||||
} /* end for each argument */
|
||||
menu_Refresh( );
|
||||
return tmp_string = "";
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// HasKey
|
||||
// ----------------------------------------------------------------------------
|
||||
static bool configuration_HasKey(std::string section, std::string name) {
|
||||
char value[128];
|
||||
GetPrivateProfileString(section.c_str( ), name.c_str( ), "__TEST__", value, 128, configuration_filename.c_str( ));
|
||||
std::string test = value;
|
||||
if(test != "__TEST__") {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// WritePrivatePath
|
||||
// ----------------------------------------------------------------------------
|
||||
static void configuration_WritePrivatePath(std::string section, std::string name, std::string path) {
|
||||
WritePrivateProfileString(section.c_str( ), name.c_str( ), path.c_str( ), configuration_filename.c_str( ));
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// WritePrivateBool
|
||||
// ----------------------------------------------------------------------------
|
||||
static void configuration_WritePrivateBool(std::string section, std::string name, bool value) {
|
||||
WritePrivateProfileString(section.c_str( ), name.c_str( ), common_Format(value).c_str( ), configuration_filename.c_str( ));
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// WritePrivateUint
|
||||
// ----------------------------------------------------------------------------
|
||||
static void configuration_WritePrivateUint(std::string section, std::string name, uint value) {
|
||||
WritePrivateProfileString(section.c_str( ), name.c_str( ), common_Format(value).c_str( ), configuration_filename.c_str( ));
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ReadPrivatePath
|
||||
// ----------------------------------------------------------------------------
|
||||
static std::string configuration_ReadPrivatePath(std::string section, std::string name, std::string defaultValue) {
|
||||
char path[_MAX_PATH];
|
||||
GetPrivateProfileString(section.c_str( ), name.c_str( ), defaultValue.c_str( ), path, _MAX_PATH, configuration_filename.c_str( ));
|
||||
return path;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ReadPrivateBool
|
||||
// ----------------------------------------------------------------------------
|
||||
static bool configuration_ReadPrivateBool(std::string section, std::string name, std::string defaultValue) {
|
||||
char value[6];
|
||||
GetPrivateProfileString(section.c_str( ), name.c_str( ), defaultValue.c_str( ), value, 6, configuration_filename.c_str( ));
|
||||
return common_ParseBool(value);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ReadPrivateUint
|
||||
// ----------------------------------------------------------------------------
|
||||
static uint configuration_ReadPrivateUint(std::string section, std::string name, uint value) {
|
||||
return GetPrivateProfileInt(section.c_str( ), name.c_str( ), value, configuration_filename.c_str( ));
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Load
|
||||
// ----------------------------------------------------------------------------
|
||||
std::string configuration_Load(std::string filename, std::string commandLine) {
|
||||
configuration_filename = filename;
|
||||
for(uint index = 0; index < 10; index++) {
|
||||
console_recent[index] = configuration_ReadPrivatePath(CONFIGURATION_SECTION_RECENT, "Recent" + common_Format(index), "");
|
||||
}
|
||||
|
||||
RECT windowRect = {0};
|
||||
windowRect.left = configuration_ReadPrivateUint(CONFIGURATION_SECTION_CONSOLE, "Window.Left", 0);
|
||||
windowRect.top = configuration_ReadPrivateUint(CONFIGURATION_SECTION_CONSOLE, "Window.Top", 0);
|
||||
windowRect.right = configuration_ReadPrivateUint(CONFIGURATION_SECTION_CONSOLE, "Window.Right", 0);
|
||||
windowRect.bottom = configuration_ReadPrivateUint(CONFIGURATION_SECTION_CONSOLE, "Window.Bottom", 0);
|
||||
console_SetWindowRect(windowRect);
|
||||
|
||||
display_stretched = configuration_ReadPrivateBool(CONFIGURATION_SECTION_DISPLAY, "Stretched", "false");
|
||||
//Leonis
|
||||
screenshot1 = configuration_ReadPrivateBool(CONFIGURATION_SECTION_DISPLAY, "Screenshot1", "false");
|
||||
screenshot2 = configuration_ReadPrivateBool(CONFIGURATION_SECTION_DISPLAY, "Screenshot2", "false");
|
||||
|
||||
display_mode.width = configuration_ReadPrivateUint(CONFIGURATION_SECTION_DISPLAY, "Mode.Width", 640);
|
||||
display_mode.height = configuration_ReadPrivateUint(CONFIGURATION_SECTION_DISPLAY, "Mode.Height", 480);
|
||||
display_mode.bpp = configuration_ReadPrivateUint(CONFIGURATION_SECTION_DISPLAY, "Mode.BPP", 8);
|
||||
|
||||
if(configuration_HasKey(CONFIGURATION_SECTION_DISPLAY, "Palette.Default") && configuration_HasKey(CONFIGURATION_SECTION_DISPLAY, "Palette.Filename")) {
|
||||
palette_default = configuration_ReadPrivateBool(CONFIGURATION_SECTION_DISPLAY, "Palette.Default", "true");
|
||||
if(!palette_default) {
|
||||
palette_Load(configuration_ReadPrivatePath(CONFIGURATION_SECTION_DISPLAY, "Palette.Filename", ""));
|
||||
}
|
||||
}
|
||||
|
||||
display_zoom = configuration_ReadPrivateUint(CONFIGURATION_SECTION_DISPLAY, "Zoom", 1);
|
||||
if ( !strstr(commandLine.c_str(),"Fullscreen") &&
|
||||
!strstr(commandLine.c_str(),"fullscreen") )
|
||||
display_fullscreen = configuration_ReadPrivateBool(CONFIGURATION_SECTION_DISPLAY, "Fullscreen", "false");
|
||||
if ( !strstr(commandLine.c_str(),"MenuEnabled") &&
|
||||
!strstr(commandLine.c_str(),"menuenabled") )
|
||||
display_menuenabled = configuration_ReadPrivateBool(CONFIGURATION_SECTION_DISPLAY, "MenuEnabled", "true");
|
||||
|
||||
sound_SetMuted(configuration_ReadPrivateBool(CONFIGURATION_SECTION_SOUND, "Mute", "false"));
|
||||
sound_latency = configuration_ReadPrivateUint(CONFIGURATION_SECTION_SOUND, "Latency", 1);
|
||||
sound_SetSampleRate(configuration_ReadPrivateUint(CONFIGURATION_SECTION_SOUND, "Sample.Rate", 44100));
|
||||
samplerate=configuration_ReadPrivateUint(CONFIGURATION_SECTION_SOUND, "Sample.Rate", 44100);
|
||||
|
||||
region_type = configuration_ReadPrivateUint(CONFIGURATION_SECTION_EMULATION, "Region", 2);
|
||||
console_frameSkip = configuration_ReadPrivateUint(CONFIGURATION_SECTION_EMULATION, "Frame.Skip", 0);
|
||||
|
||||
if(configuration_HasKey(CONFIGURATION_SECTION_EMULATION, "Bios.Enabled") && configuration_HasKey(CONFIGURATION_SECTION_EMULATION, "Bios.Filename")) {
|
||||
bios_enabled = configuration_ReadPrivateBool(CONFIGURATION_SECTION_EMULATION, "Bios.Enabled", "false");
|
||||
if(bios_enabled) {
|
||||
bios_Load(configuration_ReadPrivatePath(CONFIGURATION_SECTION_EMULATION, "Bios.Filename", ""));
|
||||
}
|
||||
}
|
||||
|
||||
if(configuration_HasKey(CONFIGURATION_SECTION_EMULATION, "Database.Enabled") && configuration_HasKey(CONFIGURATION_SECTION_EMULATION, "Database.Filename")) {
|
||||
database_enabled = configuration_ReadPrivateBool(CONFIGURATION_SECTION_EMULATION, "Database.Enabled", "true");
|
||||
if(database_enabled) {
|
||||
database_filename = configuration_ReadPrivatePath(CONFIGURATION_SECTION_EMULATION, "Database.Filename", "");
|
||||
}
|
||||
}
|
||||
|
||||
for(index = 0; index < 17; index++) {
|
||||
input_keys[index] = configuration_ReadPrivateUint(CONFIGURATION_SECTION_INPUT, "Key" + common_Format(index), input_keys[index]);
|
||||
input_devices[index] = configuration_ReadPrivateUint(CONFIGURATION_SECTION_INPUT, "Device" + common_Format(index), input_devices[index]);
|
||||
}
|
||||
for(index = 0; index < 2; index++) {
|
||||
user_keys[index] = configuration_ReadPrivateUint(CONFIGURATION_SECTION_INPUT, "User_Key" + common_Format(index), user_keys[index]);
|
||||
user_devices[index] = configuration_ReadPrivateUint(CONFIGURATION_SECTION_INPUT, "User_Device" + common_Format(index), user_devices[index]);
|
||||
user_modifiers[index] = configuration_ReadPrivateUint(CONFIGURATION_SECTION_INPUT, "User_Modifier" + common_Format(index), user_modifiers[index]);
|
||||
}
|
||||
|
||||
console_savePath = configuration_ReadPrivatePath(CONFIGURATION_SECTION_CONSOLE, "Save.Path", "");
|
||||
|
||||
return configuration_CommandLine(commandLine);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Save
|
||||
// ----------------------------------------------------------------------------
|
||||
void configuration_Save(std::string filename) {
|
||||
configuration_filename = filename;
|
||||
for(uint index = 0; index < 10; index++) {
|
||||
configuration_WritePrivatePath(CONFIGURATION_SECTION_RECENT, "Recent" + common_Format(index), console_recent[index]);
|
||||
}
|
||||
|
||||
configuration_WritePrivateBool(CONFIGURATION_SECTION_DISPLAY, "Fullscreen", display_IsFullscreen( ));
|
||||
configuration_WritePrivateBool(CONFIGURATION_SECTION_DISPLAY, "MenuEnabled", menu_IsEnabled( ));
|
||||
configuration_WritePrivateUint(CONFIGURATION_SECTION_DISPLAY, "Mode.Height", display_mode.height);
|
||||
configuration_WritePrivateUint(CONFIGURATION_SECTION_DISPLAY, "Mode.Width", display_mode.width);
|
||||
configuration_WritePrivateUint(CONFIGURATION_SECTION_DISPLAY, "Mode.BPP", display_mode.bpp);
|
||||
configuration_WritePrivateBool(CONFIGURATION_SECTION_DISPLAY, "Palette.Default", palette_default);
|
||||
configuration_WritePrivatePath(CONFIGURATION_SECTION_DISPLAY, "Palette.Filename", palette_filename);
|
||||
configuration_WritePrivateBool(CONFIGURATION_SECTION_DISPLAY, "Stretched", display_stretched);
|
||||
|
||||
//Leonis
|
||||
configuration_WritePrivateBool(CONFIGURATION_SECTION_DISPLAY, "Screenshot1", screenshot1);
|
||||
configuration_WritePrivateBool(CONFIGURATION_SECTION_DISPLAY, "Screenshot2", screenshot2);
|
||||
|
||||
configuration_WritePrivateUint(CONFIGURATION_SECTION_DISPLAY, "Zoom", display_zoom);
|
||||
|
||||
configuration_WritePrivateBool(CONFIGURATION_SECTION_SOUND, "Mute", sound_IsMuted( ));
|
||||
|
||||
configuration_WritePrivateUint(CONFIGURATION_SECTION_SOUND, "Sample.Rate", sound_GetSampleRate( ));
|
||||
configuration_WritePrivateUint(CONFIGURATION_SECTION_SOUND, "Latency", sound_latency);
|
||||
|
||||
configuration_WritePrivateUint(CONFIGURATION_SECTION_EMULATION, "Region", region_type);
|
||||
configuration_WritePrivateUint(CONFIGURATION_SECTION_EMULATION, "Frame.Skip", console_frameSkip);
|
||||
configuration_WritePrivatePath(CONFIGURATION_SECTION_EMULATION, "Bios.Filename", bios_filename);
|
||||
configuration_WritePrivateBool(CONFIGURATION_SECTION_EMULATION, "Bios.Enabled", bios_enabled);
|
||||
configuration_WritePrivatePath(CONFIGURATION_SECTION_EMULATION, "Database.Filename", database_filename);
|
||||
configuration_WritePrivateBool(CONFIGURATION_SECTION_EMULATION, "Database.Enabled", database_enabled);
|
||||
|
||||
for(index = 0; index < 17; index++) {
|
||||
configuration_WritePrivateUint(CONFIGURATION_SECTION_INPUT, "Key" + common_Format(index), input_keys[index]);
|
||||
configuration_WritePrivateUint(CONFIGURATION_SECTION_INPUT, "Device" + common_Format(index), input_devices[index]);
|
||||
}
|
||||
for(index = 0; index < 2; index++) {
|
||||
configuration_WritePrivateUint(CONFIGURATION_SECTION_INPUT, "User_Key" + common_Format(index), user_keys[index]);
|
||||
configuration_WritePrivateUint(CONFIGURATION_SECTION_INPUT, "User_Device" + common_Format(index), user_devices[index]);
|
||||
configuration_WritePrivateUint(CONFIGURATION_SECTION_INPUT, "User_Modifier" + common_Format(index), user_modifiers[index]);
|
||||
}
|
||||
configuration_WritePrivatePath(CONFIGURATION_SECTION_CONSOLE, "Save.Path", console_savePath);
|
||||
|
||||
RECT windowRect = console_GetWindowRect( );
|
||||
configuration_WritePrivateUint(CONFIGURATION_SECTION_CONSOLE, "Window.Left", windowRect.left);
|
||||
configuration_WritePrivateUint(CONFIGURATION_SECTION_CONSOLE, "Window.Top", windowRect.top);
|
||||
configuration_WritePrivateUint(CONFIGURATION_SECTION_CONSOLE, "Window.Right", windowRect.right);
|
||||
configuration_WritePrivateUint(CONFIGURATION_SECTION_CONSOLE, "Window.Bottom", windowRect.bottom);
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Configuration.h
|
||||
// ----------------------------------------------------------------------------
|
||||
#ifndef CONFIGURATION_H
|
||||
#define CONFIGURATION_H
|
||||
|
||||
#include <Windows.h>
|
||||
#include <String>
|
||||
#include "Console.h"
|
||||
|
||||
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned short word;
|
||||
typedef unsigned int uint;
|
||||
|
||||
extern std::string configuration_CommandLine(std::string commandLine);
|
||||
extern std::string configuration_Load(std::string filename, std::string commandLine);
|
||||
extern void configuration_Save(std::string filename);
|
||||
extern bool configuration_enabled;
|
||||
extern uint samplerate;
|
||||
|
||||
#endif
|
||||
-1063
File diff suppressed because it is too large
Load Diff
@@ -1,63 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Console.h
|
||||
// ----------------------------------------------------------------------------
|
||||
#ifndef CONSOLE_H
|
||||
#define CONSOLE_H
|
||||
#define CONSOLE_VERSION 1.3
|
||||
#define CONSOLE_TITLE "ProSystem Emulator"
|
||||
#define NULL 0
|
||||
|
||||
#include <Windows.h>
|
||||
#include <String>
|
||||
#include "Resource.h"
|
||||
#include "Menu.h"
|
||||
#include "Configuration.h"
|
||||
#include "Display.h"
|
||||
#include "Input.h"
|
||||
#include "Database.h"
|
||||
#include "Sound.h"
|
||||
#include "Timer.h"
|
||||
#include "ProSystem.h"
|
||||
#include "Help.h"
|
||||
#include "About.h"
|
||||
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned short word;
|
||||
typedef unsigned int uint;
|
||||
|
||||
extern bool console_Initialize(HINSTANCE hInstance, std::string commandLine);
|
||||
extern void console_Run( );
|
||||
extern void console_Open(std::string filename);
|
||||
extern void console_SetZoom(byte zoom);
|
||||
extern void console_SetFullscreen(bool fullscreen);
|
||||
extern RECT console_GetWindowRect( );
|
||||
extern void console_SetWindowRect(RECT windowRect);
|
||||
extern void console_SetMenuEnabled(bool enabled);
|
||||
extern void console_SetUserInput(byte *data, int index);
|
||||
extern void console_Exit(void);
|
||||
extern std::string console_recent[10];
|
||||
extern std::string console_savePath;
|
||||
extern byte console_frameSkip;
|
||||
|
||||
#endif
|
||||
@@ -1,81 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Database.cpp
|
||||
// ----------------------------------------------------------------------------
|
||||
#include "Database.h"
|
||||
|
||||
bool database_enabled = true;
|
||||
std::string database_filename;
|
||||
|
||||
static std::string database_GetValue(std::string entry) {
|
||||
int index = entry.rfind('=');
|
||||
return entry.substr(index + 1);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Initialize
|
||||
// ----------------------------------------------------------------------------
|
||||
void database_Initialize( ) {
|
||||
database_filename = common_defaultPath + "ProSystem.dat";
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Load
|
||||
// ----------------------------------------------------------------------------
|
||||
bool database_Load(std::string digest) {
|
||||
if(database_enabled) {
|
||||
logger_LogInfo(IDS_DATABASE1, database_filename);
|
||||
|
||||
FILE* file = fopen(database_filename.c_str( ), "r");
|
||||
if(file == NULL) {
|
||||
logger_LogError(IDS_DATABASE2,"");
|
||||
return false;
|
||||
}
|
||||
|
||||
char buffer[256];
|
||||
while(fgets(buffer, 256, file) != NULL) {
|
||||
std::string line = buffer;
|
||||
if(line.compare(1, 32, digest.c_str( )) == 0) {
|
||||
std::string entry[7];
|
||||
for(int index = 0; index < 7; index++) {
|
||||
fgets(buffer, 256, file);
|
||||
entry[index] = common_Remove(buffer, '\n');
|
||||
}
|
||||
|
||||
cartridge_title = database_GetValue(entry[0]);
|
||||
cartridge_type = common_ParseByte(database_GetValue(entry[1]));
|
||||
cartridge_pokey = common_ParseBool(database_GetValue(entry[2]));
|
||||
cartridge_controller[0] = common_ParseByte(database_GetValue(entry[3]));
|
||||
cartridge_controller[1] = common_ParseByte(database_GetValue(entry[4]));
|
||||
cartridge_region = common_ParseByte(database_GetValue(entry[5]));
|
||||
cartridge_flags = common_ParseUint(database_GetValue(entry[6]));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
fclose(file);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Database.h
|
||||
// ----------------------------------------------------------------------------
|
||||
#ifndef DATABASE_H
|
||||
#define DATABASE_H
|
||||
|
||||
#include <Windows.h>
|
||||
#include <String>
|
||||
#include "Cartridge.h"
|
||||
#include "Logger.h"
|
||||
#include "Common.h"
|
||||
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned short word;
|
||||
typedef unsigned int uint;
|
||||
|
||||
extern void database_Initialize( );
|
||||
extern bool database_Load(std::string digest);
|
||||
extern bool database_enabled;
|
||||
extern std::string database_filename;
|
||||
|
||||
#endif
|
||||
-745
@@ -1,745 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2003, 2004 Greg Stanton
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Display.cpp
|
||||
// ----------------------------------------------------------------------------
|
||||
#include "Display.h"
|
||||
#define DISPLAY_LENGTH 320
|
||||
#define DISPLAY_HEIGHT 292
|
||||
|
||||
bool display_stretched = false;
|
||||
bool display_menuenabled = true;
|
||||
byte display_zoom = 1;
|
||||
bool display_fullscreen = false;
|
||||
std::vector<Mode> display_modes;
|
||||
Mode display_mode = {640, 480, 8, 0, 0, 0};
|
||||
|
||||
static LPDIRECTDRAW display_ddraw = NULL;
|
||||
static LPDIRECTDRAWSURFACE display_primary = NULL;
|
||||
static LPDIRECTDRAWSURFACE display_offscreen = NULL;
|
||||
static LPDIRECTDRAWPALETTE display_palette = NULL;
|
||||
static LPDIRECTDRAWCLIPPER display_clipper = NULL;
|
||||
static HWND display_hWnd = NULL;
|
||||
static word display_palette16[256] = {0};
|
||||
static byte display_palette24[768] = {0};
|
||||
static uint display_palette32[256] = {0};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ToMode
|
||||
// ----------------------------------------------------------------------------
|
||||
static Mode display_ToMode(LPDDSURFACEDESC surfaceDesc) {
|
||||
Mode mode = {0};
|
||||
if(surfaceDesc != NULL) {
|
||||
mode.width = surfaceDesc->dwWidth;
|
||||
mode.height = surfaceDesc->dwHeight;
|
||||
mode.bpp = surfaceDesc->ddpfPixelFormat.dwRGBBitCount;
|
||||
mode.rmask = surfaceDesc->ddpfPixelFormat.dwRBitMask;
|
||||
mode.gmask = surfaceDesc->ddpfPixelFormat.dwGBitMask;
|
||||
mode.bmask = surfaceDesc->ddpfPixelFormat.dwBBitMask;
|
||||
}
|
||||
return mode;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// EnumerateModes
|
||||
// ----------------------------------------------------------------------------
|
||||
static HRESULT WINAPI display_EnumerateModes(LPDDSURFACEDESC surfaceDesc, LPVOID context) {
|
||||
Mode mode = display_ToMode(surfaceDesc);
|
||||
if(mode.width != 0 && mode.height != 0 && mode.bpp != 0) {
|
||||
display_modes.push_back(mode);
|
||||
}
|
||||
return DDENUMRET_OK;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// SetClipper
|
||||
// ----------------------------------------------------------------------------
|
||||
static bool display_SetClipper( ) {
|
||||
HRESULT hr = display_ddraw->CreateClipper(0, &display_clipper, NULL);
|
||||
if(FAILED(hr) || display_clipper == NULL) {
|
||||
logger_LogError(IDS_DISPLAY1,"");
|
||||
logger_LogError("",common_Format(hr));
|
||||
return false;
|
||||
}
|
||||
|
||||
hr = display_clipper->SetHWnd(0, display_hWnd);
|
||||
if(FAILED(hr)) {
|
||||
logger_LogError(IDS_DISPLAY2, "");
|
||||
logger_LogError("",common_Format(hr));
|
||||
return false;
|
||||
}
|
||||
|
||||
hr = display_primary->SetClipper(display_clipper);
|
||||
if(FAILED(hr)) {
|
||||
logger_LogError(IDS_DISPLAY3,"");
|
||||
logger_LogError("",common_Format(hr));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// GetColorBits
|
||||
// ----------------------------------------------------------------------------
|
||||
static void display_GetColorBits(uint bitMask, uint* shift, uint* bits) {
|
||||
*shift = 0;
|
||||
if(bitMask) {
|
||||
while((bitMask & 1) == 0) {
|
||||
(*shift)++;
|
||||
bitMask >>= 1;
|
||||
}
|
||||
}
|
||||
*bits = 0;
|
||||
while((bitMask & 1) != 0) {
|
||||
(*bits)++;
|
||||
bitMask >>= 1;
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// GetStretchedRect
|
||||
// ----------------------------------------------------------------------------
|
||||
static RECT display_GetStretchedRect( ) {
|
||||
RECT clientRect;
|
||||
GetClientRect(display_hWnd, &clientRect);
|
||||
|
||||
POINT point = {clientRect.left, clientRect.top};
|
||||
ClientToScreen(display_hWnd, &point);
|
||||
|
||||
RECT targetRect = {0};
|
||||
targetRect.left = point.x;
|
||||
targetRect.top = point.y;
|
||||
targetRect.right = targetRect.left + clientRect.right;
|
||||
targetRect.bottom = targetRect.top + clientRect.bottom;
|
||||
return targetRect;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// GetCenteredRect
|
||||
// ----------------------------------------------------------------------------
|
||||
static RECT display_GetCenteredRect( ) {
|
||||
RECT clientRect;
|
||||
GetClientRect(display_hWnd, &clientRect);
|
||||
|
||||
POINT center = {(clientRect.right + 1) / 2, (clientRect.bottom + 1) / 2};
|
||||
POINT corner = {center.x - ((maria_visibleArea.GetLength( ) * display_zoom) / 2), center.y - ((maria_visibleArea.GetHeight( ) * display_zoom) / 2)};
|
||||
ClientToScreen(display_hWnd, &corner);
|
||||
|
||||
RECT targetRect;
|
||||
targetRect.left = corner.x;
|
||||
targetRect.top = corner.y;
|
||||
targetRect.right = targetRect.left + (maria_visibleArea.GetLength( ) * display_zoom);
|
||||
targetRect.bottom = targetRect.top + (maria_visibleArea.GetHeight( ) * display_zoom);
|
||||
return targetRect;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// RestorePrimary
|
||||
// ----------------------------------------------------------------------------
|
||||
static bool display_RestorePrimary( ) {
|
||||
HRESULT hr = display_primary->Restore( );
|
||||
if(FAILED(hr)) {
|
||||
logger_LogError(IDS_DISPLAY4,"");
|
||||
logger_LogError("",common_Format(hr));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// RestoreOffscreen
|
||||
// ----------------------------------------------------------------------------
|
||||
static bool display_RestoreOffscreen( ) {
|
||||
HRESULT hr = display_offscreen->Restore( );
|
||||
if(FAILED(hr)) {
|
||||
logger_LogError(IDS_DISPLAY5,"");
|
||||
logger_LogError("",common_Format(hr));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ResetPalette08
|
||||
// ----------------------------------------------------------------------------
|
||||
static bool display_ResetPalette08( ) {
|
||||
if(display_ddraw == NULL) {
|
||||
logger_LogError(IDS_DISPLAY6,"");
|
||||
return false;
|
||||
}
|
||||
if(display_primary == NULL) {
|
||||
logger_LogError(IDS_DISPLAY7,"");
|
||||
return false;
|
||||
}
|
||||
if(display_offscreen == NULL) {
|
||||
logger_LogError(IDS_DISPLAY8,"");
|
||||
return false;
|
||||
}
|
||||
if(display_palette == NULL) {
|
||||
logger_LogError(IDS_DISPLAY9,"");
|
||||
return false;
|
||||
}
|
||||
|
||||
PALETTEENTRY paletteEntry[256];
|
||||
for(int index = 0; index < 256; index++) {
|
||||
PALETTEENTRY entry;
|
||||
entry.peRed = palette_data[(index * 3) + 0];
|
||||
entry.peGreen = palette_data[(index * 3) + 1];
|
||||
entry.peBlue = palette_data[(index * 3) + 2];
|
||||
entry.peFlags = 0;
|
||||
paletteEntry[index] = entry;
|
||||
}
|
||||
|
||||
HRESULT hr = display_palette->SetEntries(0, 0, 256, paletteEntry);
|
||||
if(FAILED(hr)) {
|
||||
logger_LogError(IDS_DISPLAY10,"");
|
||||
logger_LogError("",common_Format(hr));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ResetPalette16
|
||||
// ----------------------------------------------------------------------------
|
||||
static bool display_ResetPalette16( ) {
|
||||
if(display_ddraw == NULL) {
|
||||
logger_LogError(IDS_DISPLAY6,"");
|
||||
return false;
|
||||
}
|
||||
|
||||
DDSURFACEDESC surfaceDesc = {0};
|
||||
surfaceDesc.dwSize = sizeof(DDSURFACEDESC);
|
||||
HRESULT hr = display_ddraw->GetDisplayMode(&surfaceDesc);
|
||||
if(FAILED(hr)) {
|
||||
logger_LogError(IDS_DISPLAY11,"");
|
||||
logger_LogError("",common_Format(hr));
|
||||
return false;
|
||||
}
|
||||
|
||||
Mode mode16 = display_ToMode(&surfaceDesc);
|
||||
if(mode16.bpp != 16) {
|
||||
for(int index = 0; index < display_modes.size( ); index++) {
|
||||
Mode mode = display_modes[index];
|
||||
if(mode.bpp == 16) {
|
||||
mode16 = mode;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint rshift, rsize;
|
||||
uint bshift, bsize;
|
||||
uint gshift, gsize;
|
||||
|
||||
display_GetColorBits(mode16.rmask, &rshift, &rsize);
|
||||
display_GetColorBits(mode16.bmask, &bshift, &bsize);
|
||||
display_GetColorBits(mode16.gmask, &gshift, &gsize);
|
||||
|
||||
for(uint index = 0; index < 256; index++) {
|
||||
word r = ((palette_data[(index * 3) + 0] * (1 << rsize)) / 256) << rshift;
|
||||
word g = ((palette_data[(index * 3) + 1] * (1 << gsize)) / 256) << gshift;
|
||||
word b = ((palette_data[(index * 3) + 2] * (1 << bsize)) / 256) << bshift;
|
||||
display_palette16[index] = r | g | b;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ResetPalette24
|
||||
// ----------------------------------------------------------------------------
|
||||
static void display_ResetPalette24( ) {
|
||||
for(uint index = 0; index < 256; index++) {
|
||||
display_palette24[(index * 3) + 0] = palette_data[(index * 3) + 2];
|
||||
display_palette24[(index * 3) + 1] = palette_data[(index * 3) + 1];
|
||||
display_palette24[(index * 3) + 2] = palette_data[(index * 3) + 0];
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ResetPalette32
|
||||
// ----------------------------------------------------------------------------
|
||||
static void display_ResetPalette32( ) {
|
||||
for(uint index = 0; index < 256; index++) {
|
||||
uint r = palette_data[(index * 3) + 0] << 16;
|
||||
uint g = palette_data[(index * 3) + 1] << 8;
|
||||
uint b = palette_data[(index * 3) + 2];
|
||||
display_palette32[index] = r | g | b;
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ReleaseDirectDraw
|
||||
// ----------------------------------------------------------------------------
|
||||
static void display_ReleaseDirectDraw( ) {
|
||||
if(display_ddraw != NULL) {
|
||||
display_ddraw->Release( );
|
||||
display_ddraw = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ReleasePrimary
|
||||
// ----------------------------------------------------------------------------
|
||||
static void display_ReleasePrimary( ) {
|
||||
if(display_primary != NULL) {
|
||||
display_primary->SetPalette(NULL);
|
||||
display_primary->SetClipper(NULL);
|
||||
display_primary->Release( );
|
||||
display_primary = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ReleaseOffscreen
|
||||
// ----------------------------------------------------------------------------
|
||||
static void display_ReleaseOffscreen( ) {
|
||||
if(display_offscreen != NULL) {
|
||||
display_offscreen->Release( );
|
||||
display_offscreen = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ReleasePalette
|
||||
// ----------------------------------------------------------------------------
|
||||
static void display_ReleasePalette( ) {
|
||||
if(display_palette != NULL) {
|
||||
display_palette->Release( );
|
||||
display_palette = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ReleaseClipper
|
||||
// ----------------------------------------------------------------------------
|
||||
static void display_ReleaseClipper( ) {
|
||||
if(display_clipper != NULL) {
|
||||
display_clipper->Release( );
|
||||
display_clipper = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Initialize
|
||||
// ----------------------------------------------------------------------------
|
||||
bool display_Initialize(HWND hWnd) {
|
||||
if(hWnd == NULL) {
|
||||
logger_LogError(IDS_DISPLAY12,"");
|
||||
return false;
|
||||
}
|
||||
|
||||
HRESULT hr = DirectDrawCreate(NULL, &display_ddraw, NULL);
|
||||
if(FAILED(hr) || display_ddraw == NULL) {
|
||||
logger_LogError(IDS_DISPLAY13,"");
|
||||
logger_LogError("",common_Format(hr));
|
||||
return false;
|
||||
}
|
||||
|
||||
display_modes.clear( );
|
||||
hr = display_ddraw->EnumDisplayModes(DDEDM_STANDARDVGAMODES, NULL, NULL, display_EnumerateModes);
|
||||
if(FAILED(hr)) {
|
||||
logger_LogError(IDS_DISPLAY14,"");
|
||||
logger_LogError("",common_Format(hr));
|
||||
return false;
|
||||
}
|
||||
|
||||
display_ReleaseDirectDraw( );
|
||||
display_hWnd = hWnd;
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// SetFullscreen
|
||||
// ----------------------------------------------------------------------------
|
||||
bool display_SetFullscreen( ) {
|
||||
display_Release( );
|
||||
|
||||
HRESULT hr = DirectDrawCreate(NULL, &display_ddraw, NULL);
|
||||
if(FAILED(hr) || display_ddraw == NULL) {
|
||||
logger_LogError(IDS_DISPLAY13,"");
|
||||
logger_LogError("",common_Format(hr));
|
||||
return false;
|
||||
}
|
||||
|
||||
hr = display_ddraw->SetCooperativeLevel(display_hWnd, DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE);
|
||||
if(FAILED(hr)) {
|
||||
logger_LogError(IDS_DISPLAY15,"");
|
||||
logger_LogError("",common_Format(hr));
|
||||
return false;
|
||||
}
|
||||
|
||||
hr = display_ddraw->SetDisplayMode(display_mode.width, display_mode.height, display_mode.bpp);
|
||||
if(FAILED(hr)) {
|
||||
logger_LogError(IDS_DISPLAY16, common_Format(display_mode.width) + "x" + common_Format(display_mode.height) + "x" + common_Format(display_mode.bpp) + ".");
|
||||
logger_LogError("",common_Format(hr));
|
||||
return false;
|
||||
}
|
||||
|
||||
DDSURFACEDESC primaryDesc = {0};
|
||||
primaryDesc.dwSize = sizeof(DDSURFACEDESC);
|
||||
primaryDesc.dwFlags = DDSD_CAPS;
|
||||
primaryDesc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
|
||||
|
||||
hr = display_ddraw->CreateSurface(&primaryDesc, &display_primary, NULL);
|
||||
if(FAILED(hr) || display_primary == NULL) {
|
||||
logger_LogError(IDS_DISPLAY17,"");
|
||||
logger_LogError("",common_Format(hr));
|
||||
return false;
|
||||
}
|
||||
|
||||
DDSURFACEDESC offscreenDesc = {0};
|
||||
offscreenDesc.dwSize = sizeof(DDSURFACEDESC);
|
||||
offscreenDesc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
||||
offscreenDesc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
||||
offscreenDesc.dwWidth = DISPLAY_LENGTH;
|
||||
|
||||
offscreenDesc.dwHeight = DISPLAY_HEIGHT;
|
||||
|
||||
hr = display_ddraw->CreateSurface(&offscreenDesc, &display_offscreen, NULL);
|
||||
if(FAILED(hr) || display_offscreen == NULL) {
|
||||
logger_LogError(IDS_DISPLAY18,"");
|
||||
logger_LogError("",common_Format(hr));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!display_SetClipper( )) {
|
||||
logger_LogError(IDS_DISPLAY19,"");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(display_mode.bpp == 8) {
|
||||
PALETTEENTRY paletteEntry[256] = {0};
|
||||
hr = display_ddraw->CreatePalette(DDPCAPS_8BIT, paletteEntry, &display_palette, NULL);
|
||||
if(FAILED(hr) || display_palette == NULL) {
|
||||
logger_LogError(IDS_DISPLAY20,"");
|
||||
logger_LogError("",common_Format(hr));
|
||||
return false;
|
||||
}
|
||||
hr = display_primary->SetPalette(display_palette);
|
||||
if(FAILED(hr)) {
|
||||
logger_LogError(IDS_DISPLAY21,"");
|
||||
logger_LogError("",common_Format(hr));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
display_fullscreen = true;
|
||||
if(!display_ResetPalette( )) {
|
||||
logger_LogError(IDS_DISPLAY22,"");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// SetWindowed
|
||||
// ----------------------------------------------------------------------------
|
||||
bool display_SetWindowed( ) {
|
||||
display_Release( );
|
||||
|
||||
HRESULT hr = DirectDrawCreate(NULL, &display_ddraw, NULL);
|
||||
if(FAILED(hr) || display_ddraw == NULL) {
|
||||
logger_LogError(IDS_DISPLAY13,"");
|
||||
logger_LogError("",common_Format(hr));
|
||||
return false;
|
||||
}
|
||||
|
||||
hr = display_ddraw->SetCooperativeLevel(display_hWnd, DDSCL_NORMAL);
|
||||
if(FAILED(hr)) {
|
||||
logger_LogError(IDS_DISPLAY23,"");
|
||||
logger_LogError("",common_Format(hr));
|
||||
return false;
|
||||
}
|
||||
|
||||
DDSURFACEDESC primaryDesc = {0};
|
||||
primaryDesc.dwSize = sizeof(DDSURFACEDESC);
|
||||
primaryDesc.dwFlags = DDSD_CAPS;
|
||||
primaryDesc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
|
||||
|
||||
hr = display_ddraw->CreateSurface(&primaryDesc, &display_primary, NULL);
|
||||
if(FAILED(hr) || display_primary == NULL) {
|
||||
logger_LogError(IDS_DISPLAY17,"");
|
||||
logger_LogError("",common_Format(hr));
|
||||
return false;
|
||||
}
|
||||
|
||||
DDSURFACEDESC offscreenDesc = {0};
|
||||
offscreenDesc.dwSize = sizeof(DDSURFACEDESC);
|
||||
offscreenDesc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
||||
offscreenDesc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
||||
offscreenDesc.dwWidth = DISPLAY_LENGTH;
|
||||
offscreenDesc.dwHeight = DISPLAY_HEIGHT;
|
||||
|
||||
hr = display_ddraw->CreateSurface(&offscreenDesc, &display_offscreen, NULL);
|
||||
if(FAILED(hr) || display_offscreen == NULL) {
|
||||
logger_LogError(IDS_DISPLAY24,"");
|
||||
logger_LogError("",common_Format(hr));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!display_SetClipper( )) {
|
||||
logger_LogError(IDS_DISPLAY19,"");
|
||||
return false;
|
||||
}
|
||||
|
||||
display_fullscreen = false;
|
||||
if(!display_ResetPalette( )) {
|
||||
logger_LogError(IDS_DISPLAY22,"");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Show
|
||||
// ----------------------------------------------------------------------------
|
||||
bool display_Show( ) {
|
||||
if(display_ddraw == NULL) {
|
||||
logger_LogError(IDS_DISPLAY6,"");
|
||||
return false;
|
||||
}
|
||||
if(display_offscreen == NULL) {
|
||||
logger_LogError(IDS_DISPLAY8,"");
|
||||
return false;
|
||||
}
|
||||
if(display_primary == NULL) {
|
||||
logger_LogError(IDS_DISPLAY7,"");
|
||||
return false;
|
||||
}
|
||||
|
||||
uint height = maria_visibleArea.GetHeight( );
|
||||
uint length = maria_visibleArea.GetLength( );
|
||||
|
||||
DDSURFACEDESC offscreenDesc = {0};
|
||||
offscreenDesc.dwSize = sizeof(DDSURFACEDESC);
|
||||
HRESULT hr = display_offscreen->Lock(NULL, &offscreenDesc, DDLOCK_WAIT, NULL);
|
||||
if(FAILED(hr)) {
|
||||
logger_LogError(IDS_DISPLAY25,"");
|
||||
logger_LogError("",common_Format(hr));
|
||||
if(hr != DDERR_SURFACELOST || !display_RestoreOffscreen( )) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
const byte* buffer = maria_surface + ((maria_visibleArea.top - maria_displayArea.top) * maria_visibleArea.GetLength( ));
|
||||
|
||||
if(offscreenDesc.ddpfPixelFormat.dwRGBBitCount == 8) {
|
||||
byte* surface = (byte*)offscreenDesc.lpSurface;
|
||||
for(uint indexY = 0; indexY < height; indexY++) {
|
||||
for(uint indexX = 0; indexX < length; indexX += 4) {
|
||||
surface[indexX + 0] = buffer[indexX + 0];
|
||||
surface[indexX + 1] = buffer[indexX + 1];
|
||||
surface[indexX + 2] = buffer[indexX + 2];
|
||||
surface[indexX + 3] = buffer[indexX + 3];
|
||||
}
|
||||
surface += offscreenDesc.lPitch;
|
||||
buffer += length;
|
||||
}
|
||||
}
|
||||
else if(offscreenDesc.ddpfPixelFormat.dwRGBBitCount == 16) {
|
||||
word* surface = (word*)offscreenDesc.lpSurface;
|
||||
uint pitch = offscreenDesc.lPitch >> 1;
|
||||
for(uint indexY = 0; indexY < height; indexY++) {
|
||||
for(uint indexX = 0; indexX < length; indexX += 4) {
|
||||
surface[indexX + 0] = display_palette16[buffer[indexX + 0]];
|
||||
surface[indexX + 1] = display_palette16[buffer[indexX + 1]];
|
||||
surface[indexX + 2] = display_palette16[buffer[indexX + 2]];
|
||||
surface[indexX + 3] = display_palette16[buffer[indexX + 3]];
|
||||
}
|
||||
surface += pitch;
|
||||
buffer += length;
|
||||
}
|
||||
}
|
||||
else if(offscreenDesc.ddpfPixelFormat.dwRGBBitCount == 24) {
|
||||
byte* surface = (byte*)offscreenDesc.lpSurface;
|
||||
for(uint indexY = 0; indexY < height; indexY++) {
|
||||
for(uint indexX = 0; indexX < length; indexX++) {
|
||||
surface[(indexX * 3) + 0] = display_palette24[(buffer[indexX] * 3) + 0];
|
||||
surface[(indexX * 3) + 1] = display_palette24[(buffer[indexX] * 3) + 1];
|
||||
surface[(indexX * 3) + 2] = display_palette24[(buffer[indexX] * 3) + 2];
|
||||
}
|
||||
surface += offscreenDesc.lPitch;
|
||||
buffer += length;
|
||||
}
|
||||
}
|
||||
else if(offscreenDesc.ddpfPixelFormat.dwRGBBitCount == 32) {
|
||||
uint* surface = (uint*)offscreenDesc.lpSurface;
|
||||
uint pitch = offscreenDesc.lPitch >> 2;
|
||||
for(uint indexY = 0; indexY < height; indexY++) {
|
||||
for(uint indexX = 0; indexX < length; indexX += 4) {
|
||||
surface[indexX + 0] = display_palette32[buffer[indexX + 0]];
|
||||
surface[indexX + 1] = display_palette32[buffer[indexX + 1]];
|
||||
surface[indexX + 2] = display_palette32[buffer[indexX + 2]];
|
||||
surface[indexX + 3] = display_palette32[buffer[indexX + 3]];
|
||||
}
|
||||
surface += pitch;
|
||||
buffer += length;
|
||||
}
|
||||
}
|
||||
|
||||
hr = display_offscreen->Unlock(NULL);
|
||||
if(FAILED(hr)) {
|
||||
logger_LogError(IDS_DISPLAY26,"");
|
||||
logger_LogError("",common_Format(hr));
|
||||
if(hr != DDERR_SURFACELOST || !display_RestoreOffscreen( )) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
RECT targetRect = (display_stretched)? display_GetStretchedRect( ): display_GetCenteredRect( );
|
||||
RECT sourceRect = {0, 0, maria_visibleArea.GetLength( ), maria_visibleArea.GetHeight( )};
|
||||
|
||||
hr = display_primary->Blt(&targetRect, display_offscreen, &sourceRect, DDBLT_WAIT, NULL);
|
||||
if(FAILED(hr)) {
|
||||
logger_LogError(IDS_DISPLAY27,"");
|
||||
logger_LogError("",common_Format(hr));
|
||||
if(hr != DDERR_SURFACELOST || !display_RestorePrimary( )) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ResetPalette
|
||||
// ----------------------------------------------------------------------------
|
||||
bool display_ResetPalette( ) {
|
||||
display_ResetPalette24( );
|
||||
display_ResetPalette32( );
|
||||
if(!display_ResetPalette16( )) {
|
||||
logger_LogError(IDS_DISPLAY28,"");
|
||||
return false;
|
||||
}
|
||||
if(display_fullscreen && !display_ResetPalette08( )) {
|
||||
logger_LogError(IDS_DISPLAY29,"");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// TakeScreenshot
|
||||
// ----------------------------------------------------------------------------
|
||||
bool display_TakeScreenshot(std::string filename) {
|
||||
if(filename.empty( ) || filename.length == 0) {
|
||||
logger_LogError(IDS_DISPLAY30,"");
|
||||
return false;
|
||||
}
|
||||
|
||||
BITMAPFILEHEADER bitmapFileHeader = {0};
|
||||
bitmapFileHeader.bfType = 0x4d42;
|
||||
bitmapFileHeader.bfSize = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + (maria_visibleArea.GetArea( ) * 3);
|
||||
bitmapFileHeader.bfReserved1 = 0;
|
||||
bitmapFileHeader.bfReserved2 = 0;
|
||||
bitmapFileHeader.bfOffBits = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);
|
||||
|
||||
BITMAPINFOHEADER bitmapInfoHeader = {0};
|
||||
bitmapInfoHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
bitmapInfoHeader.biWidth = maria_visibleArea.GetLength( );
|
||||
bitmapInfoHeader.biHeight = maria_visibleArea.GetHeight( );
|
||||
bitmapInfoHeader.biPlanes = 1;
|
||||
bitmapInfoHeader.biBitCount = 24;
|
||||
|
||||
FILE* file = fopen(filename.c_str( ), "wb");
|
||||
if(file == NULL) {
|
||||
logger_LogError(IDS_DISPLAY31, filename);
|
||||
return false;
|
||||
}
|
||||
|
||||
fwrite(&bitmapFileHeader, sizeof(BITMAPFILEHEADER), 1, file);
|
||||
fwrite(&bitmapInfoHeader, sizeof(BITMAPINFOHEADER), 1, file);
|
||||
|
||||
const byte* buffer = maria_surface + (maria_visibleArea.top - maria_displayArea.top) * maria_visibleArea.GetLength( );
|
||||
|
||||
for(int row = maria_visibleArea.GetHeight( ) - 1; row >= 0; row--) {
|
||||
for(uint column = 0; column < maria_visibleArea.GetLength( ); column++) {
|
||||
byte entry = buffer[(row * maria_visibleArea.GetLength( )) + column];
|
||||
fwrite(&palette_data[(entry * 3) + 2], 1, 1, file);
|
||||
fwrite(&palette_data[(entry * 3) + 1], 1, 1, file);
|
||||
fwrite(&palette_data[(entry * 3) + 0], 1, 1, file);
|
||||
}
|
||||
}
|
||||
|
||||
fclose(file);
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Clear
|
||||
// ----------------------------------------------------------------------------
|
||||
bool display_Clear( ) {
|
||||
if(display_ddraw == NULL) {
|
||||
logger_LogError(IDS_DISPLAY6,"");
|
||||
return false;
|
||||
}
|
||||
if(display_offscreen == NULL) {
|
||||
logger_LogError(IDS_DISPLAY8,"");
|
||||
return false;
|
||||
}
|
||||
if(display_primary == NULL) {
|
||||
logger_LogError(IDS_DISPLAY7,"");
|
||||
return false;
|
||||
}
|
||||
|
||||
DDBLTFX bltFx;
|
||||
bltFx.dwSize = sizeof(DDBLTFX);
|
||||
bltFx.dwFillColor = 0;
|
||||
|
||||
HRESULT hr = display_offscreen->Blt(NULL, NULL, NULL, DDBLT_COLORFILL, &bltFx);
|
||||
if(FAILED(hr)) {
|
||||
logger_LogError(IDS_DISPLAY32,"");
|
||||
logger_LogError("",common_Format(hr));
|
||||
return false;
|
||||
}
|
||||
|
||||
hr = display_primary->Blt(NULL, NULL, NULL, DDBLT_COLORFILL, &bltFx);
|
||||
if(FAILED(hr)) {
|
||||
logger_LogError(IDS_DISPLAY33,"");
|
||||
logger_LogError("",common_Format(hr));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// IsFullscreen
|
||||
// ----------------------------------------------------------------------------
|
||||
bool display_IsFullscreen( ) {
|
||||
return display_fullscreen;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Release
|
||||
// ----------------------------------------------------------------------------
|
||||
void display_Release( ) {
|
||||
display_ReleaseClipper( );
|
||||
display_ReleasePalette( );
|
||||
display_ReleaseOffscreen( );
|
||||
display_ReleasePrimary( );
|
||||
display_ReleaseDirectDraw( );
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Display.h
|
||||
// ----------------------------------------------------------------------------
|
||||
#ifndef DISPLAY_H
|
||||
#define DISPLAY_H
|
||||
#define NULL 0
|
||||
|
||||
#include <Windows.h>
|
||||
#include <DDraw.h>
|
||||
#include <Vector>
|
||||
#include "Palette.h"
|
||||
#include "Maria.h"
|
||||
#include "Common.h"
|
||||
#include "Logger.h"
|
||||
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned short word;
|
||||
typedef unsigned int uint;
|
||||
|
||||
struct Mode {
|
||||
uint width;
|
||||
uint height;
|
||||
uint bpp;
|
||||
uint rmask;
|
||||
uint gmask;
|
||||
uint bmask;
|
||||
};
|
||||
|
||||
extern bool display_Initialize(HWND hWnd);
|
||||
extern bool display_SetFullscreen( );
|
||||
extern bool display_SetWindowed( );
|
||||
extern bool display_Show( );
|
||||
extern bool display_ResetPalette( );
|
||||
extern bool display_TakeScreenshot(std::string filename);
|
||||
extern bool display_Clear( );
|
||||
extern bool display_IsFullscreen( );
|
||||
extern void display_Release( );
|
||||
extern bool display_stretched;
|
||||
extern bool display_fullscreen;
|
||||
extern bool display_menuenabled;
|
||||
extern byte display_zoom;
|
||||
extern std::vector<Mode> display_modes;
|
||||
extern Mode display_mode;
|
||||
|
||||
#endif
|
||||
@@ -1,51 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Help.cpp
|
||||
// ----------------------------------------------------------------------------
|
||||
#include "Help.h"
|
||||
|
||||
static std::string help_filename;
|
||||
static HWND common_hWnd = NULL;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Initialize
|
||||
// ----------------------------------------------------------------------------
|
||||
void help_Initialize(HWND hWnd) {
|
||||
help_filename = common_defaultPath + "ProSystem.chm";
|
||||
common_hWnd = hWnd;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ShowContents
|
||||
// ----------------------------------------------------------------------------
|
||||
void help_ShowContents( ) {
|
||||
HtmlHelp(common_hWnd, help_filename.c_str( ), HH_DISPLAY_TOC, NULL);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ShowIndex
|
||||
// ----------------------------------------------------------------------------
|
||||
void help_ShowIndex( ) {
|
||||
HtmlHelp(common_hWnd, help_filename.c_str( ), HH_DISPLAY_INDEX, NULL);
|
||||
}
|
||||
|
||||
-42
@@ -1,42 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Help.h
|
||||
// ----------------------------------------------------------------------------
|
||||
#ifndef HELP_H
|
||||
#define HELP_H
|
||||
#define NULL 0
|
||||
|
||||
#include <Windows.h>
|
||||
#include <String>
|
||||
#include "Htmlhelp.h"
|
||||
#include "Common.h"
|
||||
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned short word;
|
||||
typedef unsigned int uint;
|
||||
|
||||
extern void help_Initialize(HWND hWnd);
|
||||
extern void help_ShowContents( );
|
||||
extern void help_ShowIndex( );
|
||||
|
||||
#endif
|
||||
-1350
File diff suppressed because it is too large
Load Diff
-79
@@ -1,79 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Input.h
|
||||
// ----------------------------------------------------------------------------
|
||||
#ifndef INPUT_H
|
||||
#define INPUT_H
|
||||
#ifndef DIRECTINPUT_VERSION
|
||||
#define DIRECTINPUT_VERSION 0x0700
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
JOY_AXIS_UP,
|
||||
JOY_AXIS_DOWN,
|
||||
JOY_AXIS_LEFT,
|
||||
JOY_AXIS_RIGHT,
|
||||
JOY_PAD_UP,
|
||||
JOY_PAD_DOWN,
|
||||
JOY_PAD_LEFT,
|
||||
JOY_PAD_RIGHT,
|
||||
JOY_BUTTON_1,
|
||||
JOY_BUTTON_2,
|
||||
JOY_BUTTON_3,
|
||||
JOY_BUTTON_4,
|
||||
JOY_BUTTON_5,
|
||||
JOY_BUTTON_6,
|
||||
JOY_BUTTON_7,
|
||||
JOY_BUTTON_8,
|
||||
JOY_BUTTON_9,
|
||||
JOY_BUTTON_10,
|
||||
JOY_BUTTON_11,
|
||||
JOY_BUTTON_12
|
||||
} e_joy_value;
|
||||
|
||||
#include <Windows.h>
|
||||
#include <DInput.h>
|
||||
#include "Resource.h"
|
||||
#include "Common.h"
|
||||
#include "Logger.h"
|
||||
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned short word;
|
||||
typedef unsigned int uint;
|
||||
|
||||
extern bool input_Initialize(HWND hWnd, HINSTANCE hInstance);
|
||||
extern bool input_GetKeyboardState(byte* input);
|
||||
extern void input_Release( );
|
||||
extern void input_ReleaseJoysticks( );
|
||||
extern void input_ShowController1Dialog(HWND hWnd, HINSTANCE hInstance);
|
||||
extern void input_ShowController2Dialog(HWND hWnd, HINSTANCE hInstance);
|
||||
extern void input_ShowConsoleDialog(HWND hWnd, HINSTANCE hInstance);
|
||||
extern void input_ShowUserDialog(HWND hWnd, HINSTANCE hInstance);
|
||||
extern byte input_keys[17];
|
||||
extern byte input_devices[17];
|
||||
extern byte user_keys[2];
|
||||
extern byte user_devices[2];
|
||||
extern byte user_modifiers[2];
|
||||
|
||||
#endif
|
||||
@@ -1,62 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Main.cpp
|
||||
// ----------------------------------------------------------------------------
|
||||
#include <Windows.h>
|
||||
#include <String>
|
||||
#include "Console.h"
|
||||
#include "Common.h"
|
||||
#include "Logger.h"
|
||||
#include "Input.h"
|
||||
#define NULL 0
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ParseDefaultPath
|
||||
// ----------------------------------------------------------------------------
|
||||
void main_ParseDefaultPath( ) {
|
||||
std::string commandLine = GetCommandLine( );
|
||||
if(commandLine[0] == '"') {
|
||||
common_defaultPath = common_Remove(commandLine.substr(0, commandLine.find('"', 1)), '"');
|
||||
common_defaultPath = common_defaultPath.substr(0, common_defaultPath.rfind("\\") + 1);
|
||||
}
|
||||
else {
|
||||
common_defaultPath = commandLine.substr(0, commandLine.find(' '));
|
||||
common_defaultPath = common_defaultPath.substr(0, common_defaultPath.rfind("\\") + 1);
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// WinMain
|
||||
// ----------------------------------------------------------------------------
|
||||
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR commandLine, int showCommand) {
|
||||
main_ParseDefaultPath( );
|
||||
logger_Initialize(common_defaultPath + "ProSystem.log");
|
||||
logger_level = LOGGER_LEVEL_DEBUG;
|
||||
|
||||
console_Initialize(hInstance, commandLine);
|
||||
|
||||
console_Run( );
|
||||
|
||||
logger_Release( );
|
||||
return 1;
|
||||
}
|
||||
-408
@@ -1,408 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Menu.cpp
|
||||
// ----------------------------------------------------------------------------
|
||||
#include "Menu.h"
|
||||
|
||||
HACCEL menu_hAccel = NULL;
|
||||
|
||||
static HMENU menu_hMenu = NULL;
|
||||
static HMENU menu_hFileMenu = NULL;
|
||||
static HMENU menu_hOptionsMenu = NULL;
|
||||
static HMENU menu_hRecentMenu = NULL;
|
||||
static HMENU menu_hDisplayMenu = NULL;
|
||||
static HMENU menu_hScreenshotMenu = NULL;
|
||||
static HMENU menu_hModesMenu = NULL;
|
||||
static HMENU menu_hSoundMenu = NULL;
|
||||
static HMENU menu_hSampleRateMenu = NULL;
|
||||
static HMENU menu_hLatencyMenu = NULL;
|
||||
static HMENU menu_hEmulationMenu = NULL;
|
||||
static HMENU menu_hFrameSkipMenu = NULL;
|
||||
static HMENU menu_hRegionsMenu = NULL;
|
||||
static HMENU menu_hInputMenu = NULL;
|
||||
static HMENU menu_hHelpMenu = NULL;
|
||||
static HWND menu_hWnd = NULL;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// RefreshDisplayMenu
|
||||
// ----------------------------------------------------------------------------
|
||||
static void menu_RefreshDisplayMenu( ) {
|
||||
//Leonis
|
||||
CheckMenuItem(menu_hScreenshotMenu, 0, MF_BYPOSITION | ((screenshot1)? MF_CHECKED: MF_UNCHECKED));
|
||||
CheckMenuItem(menu_hScreenshotMenu, 1, MF_BYPOSITION | ((screenshot2)? MF_CHECKED: MF_UNCHECKED));
|
||||
|
||||
CheckMenuItem(menu_hDisplayMenu, 0, MF_BYPOSITION | MF_UNCHECKED);
|
||||
CheckMenuItem(menu_hDisplayMenu, 2, MF_BYPOSITION | MF_UNCHECKED);
|
||||
CheckMenuItem(menu_hDisplayMenu, 5, MF_BYPOSITION | MF_UNCHECKED);
|
||||
CheckMenuItem(menu_hDisplayMenu, 6, MF_BYPOSITION | MF_UNCHECKED);
|
||||
CheckMenuItem(menu_hDisplayMenu, 7, MF_BYPOSITION | MF_UNCHECKED);
|
||||
CheckMenuItem(menu_hDisplayMenu, 8, MF_BYPOSITION | MF_UNCHECKED);
|
||||
if(display_IsFullscreen( )) {
|
||||
CheckMenuItem(menu_hDisplayMenu, 0, MF_BYPOSITION | MF_CHECKED);
|
||||
}
|
||||
if(display_stretched) {
|
||||
CheckMenuItem(menu_hDisplayMenu, 2, MF_BYPOSITION | MF_CHECKED);
|
||||
}
|
||||
CheckMenuItem(menu_hDisplayMenu, display_zoom + 4, MF_BYPOSITION | MF_CHECKED);
|
||||
|
||||
if(cartridge_IsLoaded( )) {
|
||||
EnableMenuItem(menu_hDisplayMenu, 10, MF_BYPOSITION | MF_ENABLED);
|
||||
}
|
||||
else {
|
||||
EnableMenuItem(menu_hDisplayMenu, 10, MF_BYPOSITION | MF_GRAYED);
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// RefreshModesMenu
|
||||
// ----------------------------------------------------------------------------
|
||||
static void menu_RefreshModesMenu( ) {
|
||||
int count = GetMenuItemCount(menu_hModesMenu);
|
||||
int index;
|
||||
for(index = count - 1; index >= 0; index--) {
|
||||
DeleteMenu(menu_hModesMenu, index, MF_BYPOSITION);
|
||||
}
|
||||
|
||||
count = 0;
|
||||
for(index = 0; index < display_modes.size( ); index++) {
|
||||
Mode mode = display_modes[index];
|
||||
if(mode.bpp == 8) {
|
||||
std::string description = common_Format(mode.width) + " x " + common_Format(mode.height);
|
||||
MENUITEMINFO item_info = {0};
|
||||
item_info.cbSize = sizeof(MENUITEMINFO);
|
||||
item_info.fMask = MIIM_DATA | MIIM_TYPE | MIIM_ID;
|
||||
item_info.dwItemData = (DWORD)&display_modes[index];
|
||||
item_info.dwTypeData = (char*)description.c_str( );
|
||||
item_info.wID = IDM_MODES_BASE + index;
|
||||
InsertMenuItem(menu_hModesMenu, count, TRUE, &item_info);
|
||||
if(display_mode.height == mode.height && display_mode.width == mode.width) {
|
||||
CheckMenuItem(menu_hModesMenu, count, MF_BYPOSITION | MF_CHECKED);
|
||||
}
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// RefreshOptionsMenu
|
||||
// ----------------------------------------------------------------------------
|
||||
static void menu_RefreshOptionsMenu( ) {
|
||||
if(cartridge_IsLoaded( )) {
|
||||
EnableMenuItem(menu_hOptionsMenu, 0, MF_BYPOSITION | MF_ENABLED);
|
||||
EnableMenuItem(menu_hOptionsMenu, 1, MF_BYPOSITION | MF_ENABLED);
|
||||
CheckMenuItem(menu_hOptionsMenu, 1, MF_BYPOSITION | ((prosystem_paused)? MF_CHECKED: MF_UNCHECKED));
|
||||
}
|
||||
else {
|
||||
EnableMenuItem(menu_hOptionsMenu, 0, MF_BYPOSITION | MF_GRAYED);
|
||||
EnableMenuItem(menu_hOptionsMenu, 1, MF_BYPOSITION | MF_GRAYED);
|
||||
CheckMenuItem(menu_hOptionsMenu, 1, MF_BYPOSITION | MF_UNCHECKED);
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// RefreshRecentMenu
|
||||
// ----------------------------------------------------------------------------
|
||||
static void menu_RefreshRecentMenu( ) {
|
||||
for(uint slot = 0; slot < 10; slot++) {
|
||||
ModifyMenu(menu_hRecentMenu, slot, MF_BYPOSITION, IDM_RECENT_SLOT0 + slot, std::string("&" + common_Format(slot) + " " + console_recent[slot]).c_str( ));
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// RefreshSoundMenu
|
||||
// ----------------------------------------------------------------------------
|
||||
static void menu_RefreshSoundMenu( ) {
|
||||
CheckMenuItem(menu_hSoundMenu, 0, MF_BYPOSITION | ((sound_IsMuted( ))? MF_CHECKED: MF_UNCHECKED));
|
||||
|
||||
CheckMenuItem(menu_hSampleRateMenu, 0, MF_BYPOSITION | MF_UNCHECKED);
|
||||
CheckMenuItem(menu_hSampleRateMenu, 1, MF_BYPOSITION | MF_UNCHECKED);
|
||||
CheckMenuItem(menu_hSampleRateMenu, 2, MF_BYPOSITION | MF_UNCHECKED);
|
||||
CheckMenuItem(menu_hSampleRateMenu, 3, MF_BYPOSITION | MF_UNCHECKED);
|
||||
CheckMenuItem(menu_hSampleRateMenu, 4, MF_BYPOSITION | MF_UNCHECKED);
|
||||
CheckMenuItem(menu_hSampleRateMenu, 5, MF_BYPOSITION | MF_UNCHECKED);
|
||||
|
||||
switch(sound_GetSampleRate( )) {
|
||||
case 11025:
|
||||
CheckMenuItem(menu_hSampleRateMenu, 0, MF_BYPOSITION | MF_CHECKED);
|
||||
break;
|
||||
case 22050:
|
||||
CheckMenuItem(menu_hSampleRateMenu, 1, MF_BYPOSITION | MF_CHECKED);
|
||||
break;
|
||||
case 31440:
|
||||
CheckMenuItem(menu_hSampleRateMenu, 2, MF_BYPOSITION | MF_CHECKED);
|
||||
break;
|
||||
case 44100:
|
||||
CheckMenuItem(menu_hSampleRateMenu, 3, MF_BYPOSITION | MF_CHECKED);
|
||||
break;
|
||||
case 48000:
|
||||
CheckMenuItem(menu_hSampleRateMenu, 4, MF_BYPOSITION | MF_CHECKED);
|
||||
break;
|
||||
case 96000:
|
||||
CheckMenuItem(menu_hSampleRateMenu, 5, MF_BYPOSITION | MF_CHECKED);
|
||||
break;
|
||||
}
|
||||
|
||||
CheckMenuItem(menu_hLatencyMenu, 0, MF_BYPOSITION | MF_UNCHECKED);
|
||||
CheckMenuItem(menu_hLatencyMenu, 1, MF_BYPOSITION | MF_UNCHECKED);
|
||||
CheckMenuItem(menu_hLatencyMenu, 2, MF_BYPOSITION | MF_UNCHECKED);
|
||||
CheckMenuItem(menu_hLatencyMenu, 3, MF_BYPOSITION | MF_UNCHECKED);
|
||||
CheckMenuItem(menu_hLatencyMenu, 4, MF_BYPOSITION | MF_UNCHECKED);
|
||||
CheckMenuItem(menu_hLatencyMenu, 5, MF_BYPOSITION | MF_UNCHECKED);
|
||||
CheckMenuItem(menu_hLatencyMenu, sound_latency, MF_BYPOSITION | MF_CHECKED);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// RefreshRegionsMenu
|
||||
// ----------------------------------------------------------------------------
|
||||
void menu_RefreshRegionsMenu( ) {
|
||||
CheckMenuItem(menu_hRegionsMenu, 0, MF_BYPOSITION | MF_UNCHECKED);
|
||||
CheckMenuItem(menu_hRegionsMenu, 2, MF_BYPOSITION | MF_UNCHECKED);
|
||||
CheckMenuItem(menu_hRegionsMenu, 3, MF_BYPOSITION | MF_UNCHECKED);
|
||||
switch(region_type) {
|
||||
case REGION_AUTO:
|
||||
CheckMenuItem(menu_hRegionsMenu, 0, MF_BYPOSITION | MF_CHECKED);
|
||||
break;
|
||||
case REGION_NTSC:
|
||||
CheckMenuItem(menu_hRegionsMenu, 2, MF_BYPOSITION | MF_CHECKED);
|
||||
break;
|
||||
case REGION_PAL:
|
||||
CheckMenuItem(menu_hRegionsMenu, 3, MF_BYPOSITION | MF_CHECKED);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// RefreshEmulationMenu
|
||||
// ----------------------------------------------------------------------------
|
||||
void menu_RefreshEmulationMenu( ) {
|
||||
CheckMenuItem(menu_hEmulationMenu, 2, MF_BYPOSITION | ((bios_enabled)? MF_CHECKED: MF_UNCHECKED));
|
||||
if(!cartridge_IsLoaded( )) {
|
||||
EnableMenuItem(menu_hEmulationMenu, 0, MF_BYPOSITION | MF_ENABLED);
|
||||
EnableMenuItem(menu_hEmulationMenu, 2, MF_BYPOSITION | MF_ENABLED);
|
||||
}
|
||||
else {
|
||||
EnableMenuItem(menu_hEmulationMenu, 0, MF_BYPOSITION | MF_GRAYED);
|
||||
EnableMenuItem(menu_hEmulationMenu, 2, MF_BYPOSITION | MF_GRAYED);
|
||||
}
|
||||
|
||||
CheckMenuItem(menu_hEmulationMenu, 3, MF_BYPOSITION | ((database_enabled)? MF_CHECKED: MF_UNCHECKED));
|
||||
for(int index = 0; index < 15; index++) {
|
||||
CheckMenuItem(menu_hFrameSkipMenu, index, MF_BYPOSITION | MF_UNCHECKED);
|
||||
}
|
||||
switch(console_frameSkip) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
case 10:
|
||||
CheckMenuItem(menu_hFrameSkipMenu, console_frameSkip, MF_BYPOSITION | MF_CHECKED);
|
||||
break;
|
||||
case 15:
|
||||
CheckMenuItem(menu_hFrameSkipMenu, 11, MF_BYPOSITION | MF_CHECKED);
|
||||
break;
|
||||
case 20:
|
||||
CheckMenuItem(menu_hFrameSkipMenu, 12, MF_BYPOSITION | MF_CHECKED);
|
||||
break;
|
||||
case 25:
|
||||
CheckMenuItem(menu_hFrameSkipMenu, 13, MF_BYPOSITION | MF_CHECKED);
|
||||
break;
|
||||
case 30:
|
||||
CheckMenuItem(menu_hFrameSkipMenu, 14, MF_BYPOSITION | MF_CHECKED);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// RefreshFileMenu
|
||||
// ----------------------------------------------------------------------------
|
||||
void menu_RefreshFileMenu( ) {
|
||||
if(cartridge_IsLoaded( )) {
|
||||
EnableMenuItem(menu_hFileMenu, 1, MF_BYPOSITION | MF_ENABLED);
|
||||
EnableMenuItem(menu_hFileMenu, 4, MF_BYPOSITION | MF_ENABLED);
|
||||
EnableMenuItem(menu_hFileMenu, 5, MF_BYPOSITION | MF_ENABLED);
|
||||
}
|
||||
else {
|
||||
EnableMenuItem(menu_hFileMenu, 1, MF_BYPOSITION | MF_GRAYED);
|
||||
EnableMenuItem(menu_hFileMenu, 4, MF_BYPOSITION | MF_GRAYED);
|
||||
EnableMenuItem(menu_hFileMenu, 5, MF_BYPOSITION | MF_GRAYED);
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Initialize
|
||||
// ----------------------------------------------------------------------------
|
||||
bool menu_Initialize(HWND hWnd, HINSTANCE hInstance) {
|
||||
if(hWnd == NULL) {
|
||||
logger_LogError(IDS_INPUT1,"");
|
||||
}
|
||||
if(hInstance == NULL) {
|
||||
logger_LogError(IDS_INPUT2,"");
|
||||
return false;
|
||||
}
|
||||
|
||||
menu_hMenu = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_MENU_MAIN));
|
||||
if(menu_hMenu == NULL) {
|
||||
logger_LogError(IDS_MENU2,"");
|
||||
logger_LogError("",common_GetErrorMessage( ));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!SetMenu(hWnd, menu_hMenu)) {
|
||||
logger_LogError(IDS_MENU3,"");
|
||||
logger_LogError("",common_GetErrorMessage( ));
|
||||
return false;
|
||||
}
|
||||
|
||||
menu_hAccel = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDR_ACCELERATOR));
|
||||
if(menu_hAccel == NULL) {
|
||||
logger_LogError(IDS_MENU4,"");
|
||||
logger_LogError("",common_GetErrorMessage( ));
|
||||
return false;
|
||||
}
|
||||
|
||||
menu_hFileMenu = GetSubMenu(menu_hMenu, 0);
|
||||
if(menu_hFileMenu == NULL) {
|
||||
logger_LogError(IDS_MENU5,"");
|
||||
return false;
|
||||
}
|
||||
|
||||
menu_hRecentMenu = GetSubMenu(menu_hFileMenu, 2);
|
||||
if(menu_hRecentMenu == NULL) {
|
||||
logger_LogError(IDS_MENU6,"");
|
||||
return false;
|
||||
}
|
||||
|
||||
menu_hOptionsMenu = GetSubMenu(menu_hMenu, 1);
|
||||
if(menu_hOptionsMenu == NULL) {
|
||||
logger_LogError(IDS_MENU7,"");
|
||||
return false;
|
||||
}
|
||||
|
||||
menu_hDisplayMenu = GetSubMenu(menu_hOptionsMenu, 3);
|
||||
if(menu_hDisplayMenu == NULL) {
|
||||
logger_LogError(IDS_MENU8,"");
|
||||
return false;
|
||||
}
|
||||
|
||||
menu_hScreenshotMenu = GetSubMenu(menu_hDisplayMenu, 10);
|
||||
if(menu_hScreenshotMenu == NULL) {
|
||||
logger_LogError(IDS_MENU8,"");
|
||||
return false;
|
||||
}
|
||||
|
||||
menu_hModesMenu = GetSubMenu(menu_hDisplayMenu, 1);
|
||||
if(menu_hModesMenu == NULL) {
|
||||
logger_LogError(IDS_MENU9,"");
|
||||
return false;
|
||||
}
|
||||
|
||||
menu_hSoundMenu = GetSubMenu(menu_hOptionsMenu, 4);
|
||||
if(menu_hSoundMenu == NULL) {
|
||||
logger_LogError(IDS_MENU10,"");
|
||||
return false;
|
||||
}
|
||||
|
||||
menu_hSampleRateMenu = GetSubMenu(menu_hSoundMenu, 2);
|
||||
if(menu_hSampleRateMenu == NULL) {
|
||||
logger_LogError(IDS_MENU11,"");
|
||||
return false;
|
||||
}
|
||||
|
||||
menu_hLatencyMenu = GetSubMenu(menu_hSoundMenu, 3);
|
||||
if(menu_hLatencyMenu == NULL) {
|
||||
logger_LogError(IDS_MENU11,"");
|
||||
return false;
|
||||
}
|
||||
|
||||
menu_hEmulationMenu = GetSubMenu(menu_hOptionsMenu, 5);
|
||||
if(menu_hEmulationMenu == NULL) {
|
||||
logger_LogError(IDS_MENU12,"");
|
||||
return false;
|
||||
}
|
||||
|
||||
menu_hRegionsMenu = GetSubMenu(menu_hEmulationMenu, 0);
|
||||
if(menu_hRegionsMenu == NULL) {
|
||||
logger_LogError(IDS_MENU13,"");
|
||||
return false;
|
||||
}
|
||||
|
||||
menu_hFrameSkipMenu = GetSubMenu(menu_hEmulationMenu, 1);
|
||||
if(menu_hFrameSkipMenu == NULL) {
|
||||
logger_LogError(IDS_MENU14,"");
|
||||
return false;
|
||||
}
|
||||
|
||||
menu_hInputMenu = GetSubMenu(menu_hOptionsMenu, 6);
|
||||
if(menu_hInputMenu == NULL) {
|
||||
logger_LogError(IDS_MENU15,"");
|
||||
return false;
|
||||
}
|
||||
|
||||
menu_hHelpMenu = GetSubMenu(menu_hMenu, 2);
|
||||
if(menu_hHelpMenu == NULL) {
|
||||
logger_LogError(IDS_MENU16,"");
|
||||
return false;
|
||||
}
|
||||
|
||||
menu_hWnd = hWnd;
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Refresh
|
||||
// ----------------------------------------------------------------------------
|
||||
void menu_Refresh( ) {
|
||||
menu_RefreshFileMenu( );
|
||||
menu_RefreshDisplayMenu( );
|
||||
menu_RefreshModesMenu( );
|
||||
menu_RefreshRecentMenu( );
|
||||
menu_RefreshOptionsMenu( );
|
||||
menu_RefreshSoundMenu( );
|
||||
menu_RefreshRegionsMenu( );
|
||||
menu_RefreshEmulationMenu( );
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// SetEnabled
|
||||
// ----------------------------------------------------------------------------
|
||||
void menu_SetEnabled(bool enabled) {
|
||||
if(enabled) {
|
||||
SetMenu(menu_hWnd, menu_hMenu);
|
||||
}
|
||||
else {
|
||||
SetMenu(menu_hWnd, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// IsEnabled
|
||||
// ----------------------------------------------------------------------------
|
||||
bool menu_IsEnabled( ) {
|
||||
return (GetMenu(menu_hWnd) == NULL)? false: true;
|
||||
}
|
||||
-53
@@ -1,53 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Menu.h
|
||||
// ----------------------------------------------------------------------------
|
||||
#ifndef MENU_H
|
||||
#define MENU_H
|
||||
#define NULL 0
|
||||
|
||||
#include <Windows.h>
|
||||
#include <String>
|
||||
#include "Resource.h"
|
||||
#include "Logger.h"
|
||||
#include "Console.h"
|
||||
#include "Common.h"
|
||||
#include "Display.h"
|
||||
#include "Sound.h"
|
||||
#include "Database.h"
|
||||
#include "Bios.h"
|
||||
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned short word;
|
||||
typedef unsigned int uint;
|
||||
|
||||
extern bool menu_Initialize(HWND hWnd, HINSTANCE hInstance);
|
||||
extern void menu_Refresh( );
|
||||
extern void menu_SetEnabled(bool enabled);
|
||||
extern bool menu_IsEnabled( );
|
||||
extern HACCEL menu_hAccel;
|
||||
extern bool screenshot1;
|
||||
extern bool screenshot2;
|
||||
|
||||
|
||||
#endif
|
||||
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 3.6 KiB |
@@ -1,560 +0,0 @@
|
||||
//Microsoft Developer Studio generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "afxres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Menu
|
||||
//
|
||||
|
||||
IDR_MENU_MAIN MENU DISCARDABLE
|
||||
BEGIN
|
||||
POPUP "&File"
|
||||
BEGIN
|
||||
MENUITEM "&Open...\tCtrl+O", IDM_FILE_OPEN
|
||||
MENUITEM "&Close", IDM_FILE_CLOSE
|
||||
POPUP "&Recent"
|
||||
BEGIN
|
||||
MENUITEM "&0", IDM_RECENT_SLOT0
|
||||
MENUITEM "&1", IDM_RECENT_SLOT1
|
||||
MENUITEM "&2", IDM_RECENT_SLOT2
|
||||
MENUITEM "&3", IDM_RECENT_SLOT3
|
||||
MENUITEM "&4", IDM_RECENT_SLOT4
|
||||
MENUITEM "&5", IDM_RECENT_SLOT5
|
||||
MENUITEM "&6", IDM_RECENT_SLOT6
|
||||
MENUITEM "&7", IDM_RECENT_SLOT7
|
||||
MENUITEM "&8", IDM_RECENT_SLOT8
|
||||
MENUITEM "&9", IDM_RECENT_SLOT9
|
||||
END
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Save...\tCtrl+S", IDM_FILE_SAVE
|
||||
MENUITEM "&Load...\tCtrl+L", IDM_FILE_LOAD
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Exit", IDM_FILE_EXIT
|
||||
END
|
||||
POPUP "&Options"
|
||||
BEGIN
|
||||
MENUITEM "&Reset\tCtrl+R", IDM_OPTIONS_RESET
|
||||
MENUITEM "&Pause\tCtrl+P", IDM_OPTIONS_PAUSE
|
||||
MENUITEM SEPARATOR
|
||||
POPUP "&Display"
|
||||
BEGIN
|
||||
MENUITEM "&Full Screen\tCtrl+F", IDM_DISPLAY_FULLSCREEN
|
||||
POPUP "&Modes"
|
||||
BEGIN
|
||||
MENUITEM " ", IDM_BLANK
|
||||
END
|
||||
MENUITEM "&Stretched", IDM_DISPLAY_STRETCHED
|
||||
MENUITEM "&Palette...", IDM_DISPLAY_PALETTE
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "x&1", IDM_DISPLAY_ZOOM1
|
||||
MENUITEM "x&2", IDM_DISPLAY_ZOOM2
|
||||
MENUITEM "x&3", IDM_DISPLAY_ZOOM3
|
||||
MENUITEM "x&4", IDM_DISPLAY_ZOOM4
|
||||
MENUITEM SEPARATOR
|
||||
POPUP "S&creenshot...\tF12"
|
||||
BEGIN
|
||||
MENUITEM "Remove non-web symbols", ID_OPTIONS_DISPLAY_SCREENSHOT_REMOVENONWEBSYMBOLS
|
||||
|
||||
MENUITEM "Replace spaces by ""_""", ID_OPTIONS_DISPLAY_SCREENSHOT_REPLACESPACESBY
|
||||
|
||||
END
|
||||
END
|
||||
POPUP "&Sound"
|
||||
BEGIN
|
||||
MENUITEM "&Mute\tCtrl+M", IDM_SOUND_MUTE
|
||||
MENUITEM SEPARATOR
|
||||
POPUP "&Sample Rate"
|
||||
BEGIN
|
||||
MENUITEM "11025", IDM_SAMPLERATE_11025
|
||||
MENUITEM "22050", IDM_SAMPLERATE_22050
|
||||
MENUITEM "31440", IDM_SAMPLERATE_31440
|
||||
MENUITEM "44100", IDM_SAMPLERATE_44100
|
||||
MENUITEM "48000", IDM_SAMPLERATE_48000
|
||||
MENUITEM "96000", IDM_SAMPLERATE_96000
|
||||
END
|
||||
POPUP "&Latency"
|
||||
BEGIN
|
||||
MENUITEM "&None", IDM_LATENCY_NONE
|
||||
MENUITEM "&Very Low", IDM_LATENCY_VERYLOW
|
||||
MENUITEM "&Low", IDM_LATENCY_LOW
|
||||
MENUITEM "&Medium", IDM_LATENCY_MEDIUM
|
||||
MENUITEM "&High", IDM_LATENCY_HIGH
|
||||
MENUITEM "&Very High", IDM_LATENCY_VERYHIGH
|
||||
END
|
||||
END
|
||||
POPUP "&Emulation"
|
||||
BEGIN
|
||||
POPUP "&Region"
|
||||
BEGIN
|
||||
MENUITEM "&Auto", IDM_REGION_AUTO
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&NTSC", IDM_REGION_NTSC
|
||||
MENUITEM "&PAL", IDM_REGION_PAL
|
||||
END
|
||||
POPUP "&Frame Skip"
|
||||
BEGIN
|
||||
MENUITEM "0", IDM_FRAMESKIP_0
|
||||
MENUITEM "1", IDM_FRAMESKIP_1
|
||||
MENUITEM "2", IDM_FRAMESKIP_2
|
||||
MENUITEM "3", IDM_FRAMESKIP_3
|
||||
MENUITEM "4", IDM_FRAMESKIP_4
|
||||
MENUITEM "5", IDM_FRAMESKIP_5
|
||||
MENUITEM "6", IDM_FRAMESKIP_6
|
||||
MENUITEM "7", IDM_FRAMESKIP_7
|
||||
MENUITEM "8", IDM_FRAMESKIP_8
|
||||
MENUITEM "9", IDM_FRAMESKIP_9
|
||||
MENUITEM "10", IDM_FRAMESKIP_10
|
||||
MENUITEM "15", IDM_FRAMESKIP_15
|
||||
MENUITEM "20", IDM_FRAMESKIP_20
|
||||
MENUITEM "25", IDM_FRAMESKIP_25
|
||||
MENUITEM "30", IDM_FRAMESKIP_30
|
||||
END
|
||||
MENUITEM "&BIOS...", IDM_EMULATION_BIOS
|
||||
MENUITEM "&Database...", IDM_EMULATION_DATABASE
|
||||
END
|
||||
POPUP "&Input"
|
||||
BEGIN
|
||||
MENUITEM "Controller &1...", IDM_INPUT_CONTROLLER1
|
||||
MENUITEM "Controller &2...", IDM_INPUT_CONTROLLER2
|
||||
MENUITEM "&Console...", IDM_INPUT_CONSOLE
|
||||
MENUITEM "&User...", IDM_INPUT_USER
|
||||
END
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Menu\tEsc", IDM_OPTIONS_MENU
|
||||
END
|
||||
POPUP "&Help"
|
||||
BEGIN
|
||||
MENUITEM "&Contents...\tF1", IDM_HELP_CONTENTS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&About...", IDM_HELP_ABOUT
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#include ""afxres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Accelerator
|
||||
//
|
||||
|
||||
IDR_ACCELERATOR ACCELERATORS DISCARDABLE
|
||||
BEGIN
|
||||
"F", IDM_DISPLAY_FULLSCREEN, VIRTKEY, CONTROL, NOINVERT
|
||||
"L", IDM_FILE_LOAD, VIRTKEY, CONTROL, NOINVERT
|
||||
"M", IDM_SOUND_MUTE, VIRTKEY, CONTROL, NOINVERT
|
||||
"O", IDM_FILE_OPEN, VIRTKEY, CONTROL, NOINVERT
|
||||
"P", IDM_OPTIONS_PAUSE, VIRTKEY, CONTROL, NOINVERT
|
||||
"R", IDM_OPTIONS_RESET, VIRTKEY, CONTROL, NOINVERT
|
||||
"S", IDM_FILE_SAVE, VIRTKEY, CONTROL, NOINVERT
|
||||
VK_F1, IDM_HELP_CONTENTS, VIRTKEY, NOINVERT
|
||||
VK_F12, IDM_DISPLAY_SCREENSHOT, VIRTKEY, NOINVERT
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDI_ICON_PROSYSTEM ICON DISCARDABLE "ProSystem.ico"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_DIALOG_ABOUT DIALOG DISCARDABLE 0, 0, 161, 94
|
||||
STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "About ProSystem"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
ICON IDI_ICON_PROSYSTEM,IDC_STATIC,5,4,20,20
|
||||
CTEXT "ProSystem Emulator",IDC_STATIC,33,6,73,8
|
||||
DEFPUSHBUTTON "OK",IDC_BUTTON_ABOUT_OK,60,69,45,14
|
||||
CTEXT "Copyright 2005 Greg Stanton",IDC_STATIC,19,33,125,8,
|
||||
SS_CENTERIMAGE
|
||||
CTEXT "Atari 7800",IDC_STATIC,35,15,68,8
|
||||
CTEXT "",IDC_STATIC_VERSION2,20,59,125,8,SS_CENTERIMAGE
|
||||
CTEXT "modified by Leonis, 2008",IDC_STATIC_VERSION3,19,43,125,
|
||||
8,SS_CENTERIMAGE
|
||||
END
|
||||
|
||||
IDD_DIALOG_CONTROLLER DIALOG DISCARDABLE 0, 0, 242, 154
|
||||
STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
COMBOBOX IDC_COMBO_CONTROLLER_UP,165,24,57,151,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Up",IDC_STATIC,7,26,36,10,SS_CENTERIMAGE
|
||||
LTEXT "Down",IDC_STATIC,7,41,36,10,SS_CENTERIMAGE
|
||||
LTEXT "Left",IDC_STATIC,7,56,36,10,SS_CENTERIMAGE
|
||||
LTEXT "Right",IDC_STATIC,7,71,36,10,SS_CENTERIMAGE
|
||||
LTEXT "Button 1",IDC_STATIC,7,86,36,10,SS_CENTERIMAGE
|
||||
LTEXT "Button 2",IDC_STATIC,7,101,36,10,SS_CENTERIMAGE
|
||||
PUSHBUTTON "OK",IDC_BUTTON_CONTROLLER_OK,80,124,40,14
|
||||
COMBOBOX IDC_COMBO_CONTROLLER_DOWN,165,39,57,151,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_COMBO_CONTROLLER_LEFT,165,54,57,151,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_COMBO_CONTROLLER_RIGHT,165,69,57,151,
|
||||
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_COMBO_CONTROLLER_BUTTON1,165,85,57,151,
|
||||
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_COMBO_CONTROLLER_BUTTON2,165,99,57,151,
|
||||
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
PUSHBUTTON "Cancel",IDC_BUTTON_CONTROLLER_CANCEL,122,124,40,14
|
||||
COMBOBOX IDC_COMBO_DEVICE_UP,45,24,115,151,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_COMBO_DEVICE_DOWN,45,39,115,151,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_COMBO_DEVICE_LEFT,45,54,115,151,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_COMBO_DEVICE_RIGHT,45,69,115,151,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_COMBO_DEVICE_BUTTON1,45,84,115,151,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_COMBO_DEVICE_BUTTON2,45,99,115,151,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Part / Key",IDC_STATIC,165,13,36,10,SS_CENTERIMAGE
|
||||
LTEXT "Device",IDC_STATIC,45,13,50,10,SS_CENTERIMAGE
|
||||
END
|
||||
|
||||
IDD_DIALOG_CONSOLE DIALOG DISCARDABLE 0, 0, 240, 135
|
||||
STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Console"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
COMBOBOX IDC_COMBO_CONSOLE_RESET,163,25,57,151,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Reset",-1,7,27,36,10,SS_CENTERIMAGE
|
||||
LTEXT "Select",-1,7,42,36,10,SS_CENTERIMAGE
|
||||
LTEXT "Pause",-1,7,57,36,10,SS_CENTERIMAGE
|
||||
LTEXT "R Difficulty",-1,7,72,36,10,SS_CENTERIMAGE
|
||||
LTEXT "L Difficulty",-1,7,87,36,10,SS_CENTERIMAGE
|
||||
PUSHBUTTON "OK",IDC_BUTTON_CONSOLE_OK,79,114,40,14
|
||||
COMBOBOX IDC_COMBO_CONSOLE_SELECT,163,39,57,151,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_COMBO_CONSOLE_PAUSE,163,54,57,151,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_COMBO_CONSOLE_RIGHT,163,70,57,151,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_COMBO_CONSOLE_LEFT,163,86,57,151,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
PUSHBUTTON "Cancel",IDC_BUTTON_CONSOLE_CANCEL,121,114,40,14
|
||||
COMBOBOX IDC_COMBO_DEVICE_RESET,46,25,110,151,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_COMBO_DEVICE_SELECT,46,39,110,151,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_COMBO_DEVICE_PAUSE,46,54,110,151,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_COMBO_DEVICE_RIGHTD,46,70,110,151,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_COMBO_DEVICE_LEFTD,46,86,110,151,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Device",-1,45,13,52,10,SS_CENTERIMAGE
|
||||
LTEXT "Part / Key",-1,165,13,36,10,SS_CENTERIMAGE
|
||||
END
|
||||
|
||||
IDD_DIALOG_USER DIALOG DISCARDABLE 0, 0, 311, 94
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Dialog"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDC_BUTTON_USER_OK,105,73,50,14
|
||||
PUSHBUTTON "Cancel",IDC_BUTTON_USER_CANCEL,160,73,50,14
|
||||
COMBOBOX IDC_COMBO_MOD_MENU,171,27,57,151,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Menu",IDC_STATIC,13,29,36,10,SS_CENTERIMAGE
|
||||
LTEXT "Exit",IDC_STATIC,13,44,36,10,SS_CENTERIMAGE
|
||||
COMBOBOX IDC_COMBO_MOD_EXIT,171,42,57,151,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_COMBO_DEVICE_MENU,51,27,115,151,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_COMBO_DEVICE_EXIT,51,42,115,151,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Modifier",IDC_STATIC,171,16,52,10,SS_CENTERIMAGE
|
||||
LTEXT "Device",IDC_STATIC,51,16,49,10,SS_CENTERIMAGE
|
||||
COMBOBOX IDC_COMBO_PART_MENU,237,27,57,151,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
COMBOBOX IDC_COMBO_PART_EXIT,237,42,57,151,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Part / Key",IDC_STATIC,237,16,36,10,SS_CENTERIMAGE
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO DISCARDABLE
|
||||
BEGIN
|
||||
IDD_DIALOG_ABOUT, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 154
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 87
|
||||
END
|
||||
|
||||
IDD_DIALOG_CONTROLLER, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 235
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 147
|
||||
END
|
||||
|
||||
IDD_DIALOG_CONSOLE, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 233
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 128
|
||||
END
|
||||
|
||||
IDD_DIALOG_USER, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 304
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 87
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_ZIP1 "Zip filename is invalid."
|
||||
IDS_ZIP2 "It is not a valid zip file:"
|
||||
IDS_ZIP3 "Failed to find the first file within the zip file."
|
||||
IDS_ZIP5 "Failed to retrieve the current zipped file info."
|
||||
IDS_ZIP6 "Data parameter is invalid."
|
||||
IDS_ZIP8 "Failed to read first file data within the zip file"
|
||||
IDS_ZIP9 "Filename is invalid."
|
||||
IDS_ZIP10 "Failed to create the zip file"
|
||||
IDS_ZIP11 "Failed to open a new file within the zip file"
|
||||
IDS_ZIP12 "Failed to write data to the zip file"
|
||||
IDS_BIOS1 "Bios filename is invalid."
|
||||
IDS_BIOS2 "Opening bios file"
|
||||
IDS_BIOS3 "Failed to open the bios file"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_BIOS4 "Failed to find the end of the bios file."
|
||||
IDS_BIOS5 "Failed to find the size of the bios file."
|
||||
IDS_BIOS6 "Failed to read the bios data."
|
||||
IDS_CARTRIDGE1 "Cartridge data is invalid."
|
||||
IDS_CARTRIDGE2 "Cartridge filename is invalid."
|
||||
IDS_CARTRIDGE3 "Failed to open the cartridge file for reading:"
|
||||
IDS_CARTRIDGE4 "Failed to find the end of the cartridge file."
|
||||
IDS_CARTRIDGE5 "Failed to find the size of the cartridge file."
|
||||
IDS_CARTRIDGE6 "Failed to read the cartridge data."
|
||||
IDS_CARTRIDGE7 "Failed to load the cartridge data into memory."
|
||||
IDS_PALETTE1 "Palette filename is invalid."
|
||||
IDS_PALETTE2 "Opening palette file:"
|
||||
IDS_PALETTE3 "Failed to open the palette file for reading:"
|
||||
IDS_PALETTE4 "Failed to read the palette data."
|
||||
IDS_PROSYSTEM1 "Filename is invalid."
|
||||
IDS_PROSYSTEM2 "Saving game state to file"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_SOUND14 "Failed to reset the position of the sound pointer in the sound buffer."
|
||||
IDS_SOUND15 "Failed to start playing the sound buffer."
|
||||
IDS_SOUND16 "Failed to stop the sound buffer."
|
||||
IDS_CARTRIDGE8 "Opening cartridge file"
|
||||
IDS_CARTRIDGE9 "ProSystem don't want to execute CC2 hacks."
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_PROSYSTEM3 "Failed to open the file for writing:"
|
||||
IDS_PROSYSTEM4 "Failed to write the save state data to the file"
|
||||
IDS_PROSYSTEM5 "Failed to compress the save state data to the file:"
|
||||
IDS_PROSYSTEM6 "Loading game state from file "
|
||||
IDS_PROSYSTEM7 "Failed to open the file for reading:"
|
||||
IDS_PROSYSTEM8 "Failed to find the end of the file."
|
||||
IDS_PROSYSTEM9 "Failed to find the size of the file."
|
||||
IDS_PROSYSTEM10 "Save state file has an invalid size."
|
||||
IDS_PROSYSTEM11 "Failed to read the file data."
|
||||
IDS_PROSYSTEM12 "Save state file has an invalid size."
|
||||
IDS_PROSYSTEM13 "File is not a valid ProSystem save state."
|
||||
IDS_PROSYSTEM14 "Load state digest does not match loaded cartridge digest"
|
||||
IDS_PROSYSTEM15 "Save state file has an invalid size."
|
||||
IDS_CONSOLE1 "Failed to save the screenshot to a file."
|
||||
IDS_CONSOLE2 "Failed to register the window class."
|
||||
IDS_CONSOLE3 "Failed to initialize the main menu."
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_CONSOLE4 "Failed to initialize the display."
|
||||
IDS_CONSOLE5 "Failed to set the display to windowed mode."
|
||||
IDS_CONSOLE6 "Failed to initialize the sound."
|
||||
IDS_CONSOLE7 "Failed to save the state to a file."
|
||||
IDS_DATABASE1 "Accessing database"
|
||||
IDS_DATABASE2 "Failed to open the database for reading."
|
||||
IDS_DISPLAY1 "Failed to create the clipper."
|
||||
IDS_DISPLAY2 "Failed to attach the window handle to the clipper."
|
||||
IDS_DISPLAY3 "Failed to attach the clipper to the primary surface."
|
||||
IDS_DISPLAY4 "Failed to restore the primary surface."
|
||||
IDS_DISPLAY5 "Failed to restore the offscreen surface."
|
||||
IDS_DISPLAY6 "Direct draw has not been initialized."
|
||||
IDS_DISPLAY7 "Direct draw primary surface is invalid."
|
||||
IDS_DISPLAY8 "Direct draw offscreen surface is invalid."
|
||||
IDS_DISPLAY9 "Direct draw palette is invalid."
|
||||
IDS_DISPLAY10 "Failed to set the palette entries into the palette."
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_DISPLAY11 "Failed to retrieve the display mode."
|
||||
IDS_DISPLAY12 "Window handle is invalid."
|
||||
IDS_DISPLAY13 "Failed to initialize direct draw."
|
||||
IDS_DISPLAY14 "Failed to enumerate display modes."
|
||||
IDS_DISPLAY15 "Failed to set the cooperative level to fullscreen/exclusive."
|
||||
IDS_DISPLAY16 "Failed to set the display mode to"
|
||||
IDS_DISPLAY17 "Failed to create the primary surface."
|
||||
IDS_DISPLAY18 "Failed to create the offscreen surface."
|
||||
IDS_DISPLAY19 "Failed to set the clipper."
|
||||
IDS_DISPLAY20 "Failed to create the 8-bit palette."
|
||||
IDS_DISPLAY21 "Failed to attach the palette to the primary surface."
|
||||
IDS_DISPLAY22 "Failed to reset the palette."
|
||||
IDS_DISPLAY23 "Failed to set the cooperative level to normal."
|
||||
IDS_DISPLAY24 "Failed to create the offscreen surface."
|
||||
IDS_DISPLAY25 "Failed to lock the offscreen surface."
|
||||
IDS_DISPLAY26 "Failed to unlock the offscreen surface."
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_DISPLAY27 "Failed to blit the offscreen surface data to the primary surface."
|
||||
IDS_DISPLAY28 "Failed to reset the palette for 16 bit per pixel modes."
|
||||
IDS_DISPLAY29 "Failed to reset the palette for 8 bit per pixel modes."
|
||||
IDS_DISPLAY30 "Screenshot filename is invalid."
|
||||
IDS_DISPLAY31 "Failed to open the screenshot file for writing:"
|
||||
IDS_DISPLAY32 "Failed to perform clear on offscreen surface."
|
||||
IDS_DISPLAY33 "Failed to perform clear on primary surface."
|
||||
IDS_INPUT1 "Handle to the window is invalid."
|
||||
IDS_INPUT2 "Handle to the application instance is invalid."
|
||||
IDS_INPUT3 "Failed to initialize direct input."
|
||||
IDS_INPUT4 "Failed to create the keyboard device."
|
||||
IDS_INPUT5 "Failed to set the keyboard format."
|
||||
IDS_INPUT6 "Failed to set the cooperative level."
|
||||
IDS_INPUT7 "Failed to aquire the keyboard."
|
||||
IDS_INPUT8 "Direct input has not been initialized."
|
||||
IDS_INPUT9 "Direct input keyboard has not been initialized."
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_INPUT10 "Keyboard input buffer is invalid."
|
||||
IDS_INPUT11 "Failed to retrieve the keyboard state."
|
||||
IDS_INPUT12 "Failed to retrieve the joystick state."
|
||||
IDS_MENU1 "Failed to load the menu resource."
|
||||
IDS_MENU2 "Failed to load the menu resource."
|
||||
IDS_MENU3 "Failed to attach the menu to the console."
|
||||
IDS_MENU4 "Failed to load the menu accelerator resource."
|
||||
IDS_MENU5 "Failed to retrieve a handle to the file menu."
|
||||
IDS_MENU6 "Failed to retrieve a handle to the recent menu."
|
||||
IDS_MENU7 "Failed to retrieve a handle to the opetions menu."
|
||||
IDS_MENU8 "Failed to retrieve a handle to the display menu."
|
||||
IDS_MENU9 "Failed to retrieve a handle to the modes menu."
|
||||
IDS_MENU10 "Failed to retrieve a handle to the sound menu."
|
||||
IDS_MENU11 "Failed to retrieve a handle to the latency menu."
|
||||
IDS_MENU12 "Failed to retrieve a handle to the emulation menu."
|
||||
IDS_MENU13 "Failed to retrieve a handle to the regions menu."
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_MENU14 "Failed to retrieve a handle to the frame skip menu."
|
||||
IDS_MENU15 "Failed to retrieve a handle to the input menu."
|
||||
IDS_MENU16 "Failed to retrieve a handle to the help menu."
|
||||
IDS_SOUND1 "Failed to restore the sound buffer."
|
||||
IDS_SOUND2 "Failed to release the sound buffer."
|
||||
IDS_SOUND3 "Failed to release direct sound."
|
||||
IDS_SOUND4 "Failed to initialize direct sound."
|
||||
IDS_SOUND5 "Failed to create the primary sound buffer."
|
||||
IDS_SOUND6 "Failed to set the default format."
|
||||
IDS_SOUND7 "Direct sound has not been initialized."
|
||||
IDS_SOUND8 "Direct sound primary buffer has not been initialized."
|
||||
IDS_SOUND9 "Failed to set the primary sound buffer's format."
|
||||
IDS_SOUND10 "Failed to create the sound buffer."
|
||||
IDS_SOUND11 "Direct sound buffer has not been initialized."
|
||||
IDS_SOUND12 "Failed to lock the sound buffer."
|
||||
IDS_SOUND13 "Failed to unlock the sound buffer."
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
-433
@@ -1,433 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Sound.cpp
|
||||
// ----------------------------------------------------------------------------
|
||||
#include "Sound.h"
|
||||
#define SOUND_LATENCY_SCALE 4
|
||||
|
||||
byte sound_latency = SOUND_LATENCY_VERY_LOW;
|
||||
|
||||
static const WAVEFORMATEX SOUND_DEFAULT_FORMAT = {WAVE_FORMAT_PCM, 1, 44100, 44100, 1, 8, 0};
|
||||
static LPDIRECTSOUND sound_dsound = NULL;
|
||||
static LPDIRECTSOUNDBUFFER sound_primaryBuffer = NULL;
|
||||
static LPDIRECTSOUNDBUFFER sound_buffer = NULL;
|
||||
static WAVEFORMATEX sound_format = SOUND_DEFAULT_FORMAT;
|
||||
static uint sound_counter = 0;
|
||||
static bool sound_muted = false;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// GetSampleLength
|
||||
// ----------------------------------------------------------------------------
|
||||
static uint sound_GetSampleLength(uint length, uint unit, uint unitMax) {
|
||||
uint sampleLength = length / unitMax;
|
||||
uint sampleRemain = length % unitMax;
|
||||
if(sampleRemain != 0 && sampleRemain >= unit) {
|
||||
sampleLength++;
|
||||
}
|
||||
return sampleLength;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Resample
|
||||
// ----------------------------------------------------------------------------
|
||||
static void sound_Resample(const byte* source, byte* target, int length) {
|
||||
int measurement = sound_format.nSamplesPerSec;
|
||||
int sourceIndex = 0;
|
||||
int targetIndex = 0;
|
||||
|
||||
while(targetIndex < length) {
|
||||
if(measurement >= 31440) {
|
||||
target[targetIndex++] = source[sourceIndex];
|
||||
measurement -= 31440;
|
||||
}
|
||||
else {
|
||||
sourceIndex++;
|
||||
measurement += sound_format.nSamplesPerSec;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// RestoreBuffer
|
||||
// ----------------------------------------------------------------------------
|
||||
static bool sound_RestoreBuffer( ) {
|
||||
if(sound_buffer != NULL) {
|
||||
HRESULT hr = sound_buffer->Restore( );
|
||||
if(FAILED(hr)) {
|
||||
logger_LogError(IDS_SOUND1,"");
|
||||
logger_LogError("",common_Format(hr));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ReleaseBuffer
|
||||
// ----------------------------------------------------------------------------
|
||||
static bool sound_ReleaseBuffer(LPDIRECTSOUNDBUFFER buffer) {
|
||||
if(buffer != NULL) {
|
||||
HRESULT hr = buffer->Release( );
|
||||
sound_buffer = NULL;
|
||||
if(FAILED(hr)) {
|
||||
logger_LogError(IDS_SOUND2,"");
|
||||
logger_LogError("",common_Format(hr));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ReleaseSound
|
||||
// ----------------------------------------------------------------------------
|
||||
static bool sound_ReleaseSound( ) {
|
||||
if(sound_dsound != NULL) {
|
||||
HRESULT hr = sound_dsound->Release( );
|
||||
sound_dsound = NULL;
|
||||
if(FAILED(hr)) {
|
||||
logger_LogError(IDS_SOUND3,"");
|
||||
logger_LogError("",common_Format(hr));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Initialize
|
||||
// ----------------------------------------------------------------------------
|
||||
bool sound_Initialize(HWND hWnd) {
|
||||
if(hWnd == NULL) {
|
||||
logger_LogError(IDS_INPUT1,"");
|
||||
return false;
|
||||
}
|
||||
|
||||
HRESULT hr = DirectSoundCreate(NULL, &sound_dsound, NULL);
|
||||
if(FAILED(hr) || sound_dsound == NULL) {
|
||||
logger_LogError(IDS_SOUND4,"");
|
||||
logger_LogError("",common_Format(hr));
|
||||
return false;
|
||||
}
|
||||
|
||||
hr = sound_dsound->SetCooperativeLevel(hWnd, DSSCL_PRIORITY);
|
||||
if(FAILED(hr)) {
|
||||
logger_LogError(IDS_INPUT6,"");
|
||||
logger_LogError("",common_Format(hr));
|
||||
return false;
|
||||
}
|
||||
|
||||
DSBUFFERDESC primaryDesc;
|
||||
primaryDesc.dwReserved = 0;
|
||||
primaryDesc.dwSize = sizeof(DSBUFFERDESC);
|
||||
primaryDesc.dwFlags = DSBCAPS_PRIMARYBUFFER;
|
||||
primaryDesc.dwBufferBytes = 0;
|
||||
primaryDesc.lpwfxFormat = NULL;
|
||||
|
||||
hr = sound_dsound->CreateSoundBuffer(&primaryDesc, &sound_primaryBuffer, NULL);
|
||||
if(FAILED(hr) || sound_primaryBuffer == NULL) {
|
||||
logger_LogError(IDS_SOUND5,"");
|
||||
logger_LogError("",common_Format(hr));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!sound_SetFormat(SOUND_DEFAULT_FORMAT)) {
|
||||
logger_LogError(IDS_SOUND6,"");
|
||||
return false;
|
||||
}
|
||||
|
||||
//Leonis
|
||||
sound_SetSampleRate(samplerate);
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// SetFormat
|
||||
// ----------------------------------------------------------------------------
|
||||
bool sound_SetFormat(WAVEFORMATEX format) {
|
||||
if(sound_dsound == NULL) {
|
||||
logger_LogError(IDS_SOUND7,"");
|
||||
return false;
|
||||
}
|
||||
if(sound_primaryBuffer == NULL) {
|
||||
logger_LogError(IDS_SOUND8,"");
|
||||
return false;
|
||||
}
|
||||
|
||||
HRESULT hr = sound_primaryBuffer->SetFormat(&format);
|
||||
if(FAILED(hr)) {
|
||||
logger_LogError(IDS_SOUND9,"");
|
||||
logger_LogError("",common_Format(hr));
|
||||
return false;
|
||||
}
|
||||
|
||||
DSBUFFERDESC secondaryDesc;
|
||||
secondaryDesc.dwReserved = 0;
|
||||
secondaryDesc.dwSize = sizeof(DSBUFFERDESC);
|
||||
secondaryDesc.dwFlags = DSBCAPS_GLOBALFOCUS;
|
||||
secondaryDesc.dwBufferBytes = format.nSamplesPerSec;
|
||||
secondaryDesc.lpwfxFormat = &format;
|
||||
|
||||
hr = sound_dsound->CreateSoundBuffer(&secondaryDesc, &sound_buffer, NULL);
|
||||
if(FAILED(hr) || sound_buffer == NULL) {
|
||||
logger_LogError(IDS_SOUND10,"");
|
||||
logger_LogError("",common_Format(hr));
|
||||
return false;
|
||||
}
|
||||
|
||||
sound_format = format;
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Store
|
||||
// ----------------------------------------------------------------------------
|
||||
bool sound_Store( ) {
|
||||
if(sound_dsound == NULL) {
|
||||
logger_LogError(IDS_SOUND7,"");
|
||||
return false;
|
||||
}
|
||||
if(sound_primaryBuffer == NULL) {
|
||||
logger_LogError(IDS_SOUND8,"");
|
||||
return false;
|
||||
}
|
||||
if(sound_buffer == NULL) {
|
||||
logger_LogError(IDS_SOUND11,"");
|
||||
return false;
|
||||
}
|
||||
|
||||
byte sample[1920];
|
||||
uint length = sound_GetSampleLength(sound_format.nSamplesPerSec, prosystem_frame, prosystem_frequency);
|
||||
sound_Resample(tia_buffer, sample, length);
|
||||
|
||||
if(cartridge_pokey) {
|
||||
byte pokeySample[1920];
|
||||
sound_Resample(pokey_buffer, pokeySample, length);
|
||||
for(int index = 0; index < length; index++) {
|
||||
sample[index] += pokeySample[index];
|
||||
sample[index] = sample[index] / 2;
|
||||
}
|
||||
}
|
||||
|
||||
DWORD lockCount = 0;
|
||||
byte* lockStream = NULL;
|
||||
DWORD wrapCount = 0;
|
||||
byte* wrapStream = NULL;
|
||||
|
||||
HRESULT hr = sound_buffer->Lock(sound_counter, length, (void**)&lockStream, &lockCount, (void**)&wrapStream, &wrapCount, 0);
|
||||
if(FAILED(hr) || lockStream == NULL) {
|
||||
logger_LogError(IDS_SOUND12,"");
|
||||
logger_LogError("",common_Format(hr));
|
||||
if(hr != DSERR_BUFFERLOST || !sound_RestoreBuffer( )) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
uint bufferCounter = 0;
|
||||
for(uint lockIndex = 0; lockIndex < lockCount; lockIndex++) {
|
||||
lockStream[lockIndex] = sample[bufferCounter++];
|
||||
}
|
||||
|
||||
for(uint wrapIndex = 0; wrapIndex < wrapCount; wrapIndex++) {
|
||||
wrapStream[wrapIndex] = sample[bufferCounter++];
|
||||
}
|
||||
|
||||
hr = sound_buffer->Unlock(lockStream, lockCount, wrapStream, wrapCount);
|
||||
if(FAILED(hr)) {
|
||||
logger_LogError(IDS_SOUND13,"");
|
||||
logger_LogError("",common_Format(hr));
|
||||
if(hr != DSERR_BUFFERLOST || !sound_RestoreBuffer( )) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
sound_counter += length;
|
||||
if(sound_counter >= sound_format.nSamplesPerSec) {
|
||||
sound_counter -= sound_format.nSamplesPerSec;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Clear
|
||||
// ----------------------------------------------------------------------------
|
||||
bool sound_Clear( ) {
|
||||
if(sound_dsound == NULL) {
|
||||
logger_LogError(IDS_SOUND7,"");
|
||||
return false;
|
||||
}
|
||||
if(sound_primaryBuffer == NULL) {
|
||||
logger_LogError(IDS_SOUND8,"");
|
||||
return false;
|
||||
}
|
||||
if(sound_buffer == NULL) {
|
||||
logger_LogError(IDS_SOUND11,"");
|
||||
return false;
|
||||
}
|
||||
|
||||
byte* lockStream = NULL;
|
||||
DWORD lockCount = 0;
|
||||
HRESULT hr = sound_buffer->Lock(0, sound_format.nSamplesPerSec, (void**)&lockStream, &lockCount, NULL, NULL, DSBLOCK_ENTIREBUFFER);
|
||||
if(FAILED(hr) || lockStream == NULL) {
|
||||
logger_LogError(IDS_SOUND12,"");
|
||||
logger_LogError("",common_Format(hr));
|
||||
if(hr != DSERR_BUFFERLOST || !sound_RestoreBuffer( )) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for(uint lockIndex = 0; lockIndex < lockCount; lockIndex++) {
|
||||
lockStream[lockIndex] = 0;
|
||||
}
|
||||
|
||||
hr = sound_buffer->Unlock(lockStream, lockCount, NULL, NULL);
|
||||
if(FAILED(hr)) {
|
||||
logger_LogError(IDS_SOUND13,"");
|
||||
logger_LogError("",common_Format(hr));
|
||||
if(hr != DSERR_BUFFERLOST || !sound_RestoreBuffer( )) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Play
|
||||
// ----------------------------------------------------------------------------
|
||||
bool sound_Play( ) {
|
||||
if(sound_dsound == NULL) {
|
||||
logger_LogError(IDS_SOUND7,"");
|
||||
return false;
|
||||
}
|
||||
if(sound_primaryBuffer == NULL) {
|
||||
logger_LogError(IDS_SOUND8,"");
|
||||
return false;
|
||||
}
|
||||
if(sound_buffer == NULL) {
|
||||
logger_LogError(IDS_SOUND11,"");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!sound_muted) {
|
||||
HRESULT hr = sound_buffer->SetCurrentPosition(0);
|
||||
if(FAILED(hr)) {
|
||||
logger_LogError(IDS_SOUND14,"");
|
||||
logger_LogError("",common_Format(hr));
|
||||
return false;
|
||||
}
|
||||
|
||||
hr = sound_buffer->Play(0, 0, DSBPLAY_LOOPING);
|
||||
if(FAILED(hr)) {
|
||||
logger_LogError(IDS_SOUND15,"");
|
||||
logger_LogError("",common_Format(hr));
|
||||
if(hr != DSERR_BUFFERLOST || !sound_RestoreBuffer( )) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
sound_counter = (sound_format.nSamplesPerSec / prosystem_frequency) * (sound_latency * SOUND_LATENCY_SCALE);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Stop
|
||||
// ----------------------------------------------------------------------------
|
||||
bool sound_Stop( ) {
|
||||
if(sound_dsound == NULL) {
|
||||
logger_LogError(IDS_SOUND7,"");
|
||||
return false;
|
||||
}
|
||||
if(sound_primaryBuffer == NULL) {
|
||||
logger_LogError(IDS_SOUND8,"");
|
||||
return false;
|
||||
}
|
||||
if(sound_buffer == NULL) {
|
||||
logger_LogError(IDS_SOUND11,"");
|
||||
return false;
|
||||
}
|
||||
|
||||
HRESULT hr = sound_buffer->Stop( );
|
||||
if(FAILED(hr)) {
|
||||
logger_LogError(IDS_SOUND16,"");
|
||||
logger_LogError("",common_Format(hr));
|
||||
if(hr != DSERR_BUFFERLOST || !sound_RestoreBuffer( )) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// SetSampleRate
|
||||
// ----------------------------------------------------------------------------
|
||||
bool sound_SetSampleRate(uint rate) {
|
||||
sound_format.nSamplesPerSec = rate;
|
||||
sound_format.nAvgBytesPerSec = rate;
|
||||
return sound_SetFormat(sound_format);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// GetSampleRate
|
||||
// ----------------------------------------------------------------------------
|
||||
uint sound_GetSampleRate( ) {
|
||||
return sound_format.nSamplesPerSec;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// SetMuted
|
||||
// ----------------------------------------------------------------------------
|
||||
bool sound_SetMuted(bool muted) {
|
||||
if(sound_muted != muted) {
|
||||
if(!muted) {
|
||||
if(!sound_Play( )) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(!sound_Stop( )) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
sound_muted = muted;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// IsMuted
|
||||
// ----------------------------------------------------------------------------
|
||||
bool sound_IsMuted( ) {
|
||||
return sound_muted;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Release
|
||||
// ----------------------------------------------------------------------------
|
||||
void sound_Release( ) {
|
||||
sound_ReleaseBuffer(sound_buffer);
|
||||
sound_ReleaseBuffer(sound_primaryBuffer);
|
||||
sound_ReleaseSound( );
|
||||
}
|
||||
-60
@@ -1,60 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Sound.h
|
||||
// ----------------------------------------------------------------------------
|
||||
#ifndef SOUND_H
|
||||
#define SOUND_H
|
||||
#define SOUND_LATENCY_NONE 0
|
||||
#define SOUND_LATENCY_VERY_LOW 1
|
||||
#define SOUND_LATENCY_LOW 2
|
||||
#define SOUND_LATENCY_MEDIUM 3
|
||||
#define SOUND_LATENCY_HIGH 4
|
||||
#define SOUND_LATENCY_VERY_HIGH 5
|
||||
#define NULL 0
|
||||
|
||||
#include <DSound.h>
|
||||
#include "Common.h"
|
||||
#include "Logger.h"
|
||||
#include "ProSystem.h"
|
||||
#include "Configuration.h"
|
||||
#include "Tia.h"
|
||||
#include "Pokey.h"
|
||||
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned short word;
|
||||
typedef unsigned int uint;
|
||||
|
||||
extern bool sound_Initialize(HWND hWnd);
|
||||
extern bool sound_Store( );
|
||||
extern bool sound_Clear( );
|
||||
extern bool sound_SetFormat(WAVEFORMATEX format);
|
||||
extern bool sound_Play( );
|
||||
extern bool sound_Stop( );
|
||||
extern bool sound_SetSampleRate(uint rate);
|
||||
extern uint sound_GetSampleRate( );
|
||||
extern bool sound_SetMuted(bool muted);
|
||||
extern bool sound_IsMuted( );
|
||||
extern void sound_Release( );
|
||||
extern byte sound_latency;
|
||||
|
||||
#endif
|
||||
@@ -1,73 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Timer.cpp
|
||||
// ----------------------------------------------------------------------------
|
||||
#include "Timer.h"
|
||||
|
||||
static LONGLONG timer_currentTime;
|
||||
static LONGLONG timer_nextTime;
|
||||
static LONGLONG timer_counterFrequency;
|
||||
static uint timer_frameTime;
|
||||
static bool timer_usingCounter = false;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Initialize
|
||||
// ----------------------------------------------------------------------------
|
||||
void timer_Initialize( ) {
|
||||
timer_usingCounter = (QueryPerformanceFrequency((LARGE_INTEGER*)&timer_counterFrequency))? true: false;
|
||||
timeBeginPeriod(1);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Reset
|
||||
// ----------------------------------------------------------------------------
|
||||
void timer_Reset( ) {
|
||||
if(timer_usingCounter) {
|
||||
QueryPerformanceCounter((LARGE_INTEGER*)&timer_nextTime);
|
||||
timer_frameTime = timer_counterFrequency / prosystem_frequency;
|
||||
timer_nextTime += timer_frameTime;
|
||||
}
|
||||
else {
|
||||
timer_frameTime = (1000.0 / (double)prosystem_frequency) * 1000;
|
||||
timer_currentTime = timeGetTime( ) * 1000;
|
||||
timer_nextTime = timer_currentTime + timer_frameTime;
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// IsTime
|
||||
// ----------------------------------------------------------------------------
|
||||
bool timer_IsTime( ) {
|
||||
if(timer_usingCounter) {
|
||||
QueryPerformanceCounter((LARGE_INTEGER*)&timer_currentTime);
|
||||
}
|
||||
else {
|
||||
timer_currentTime = timeGetTime( ) * 1000;
|
||||
}
|
||||
|
||||
if(timer_currentTime >= timer_nextTime) {
|
||||
timer_nextTime += timer_frameTime;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
-37
@@ -1,37 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Timer.h
|
||||
// ----------------------------------------------------------------------------
|
||||
#ifndef TIMER_H
|
||||
#define TIMER_H
|
||||
|
||||
#include <Windows.h>
|
||||
#include "ProSystem.h"
|
||||
#include "Logger.h"
|
||||
#include "Common.h"
|
||||
|
||||
extern void timer_Initialize( );
|
||||
extern void timer_Reset( );
|
||||
extern bool timer_IsTime( );
|
||||
|
||||
#endif
|
||||
-270
@@ -1,270 +0,0 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by ProSystem.rc
|
||||
//
|
||||
#define IDS_ZIP1 1
|
||||
#define IDS_ZIP2 2
|
||||
#define IDS_ZIP3 3
|
||||
#define IDS_ZIP5 5
|
||||
#define IDS_ZIP6 6
|
||||
#define IDS_ZIP8 8
|
||||
#define IDS_ZIP9 9
|
||||
#define IDS_ZIP10 10
|
||||
#define IDS_ZIP11 11
|
||||
#define IDS_ZIP12 12
|
||||
#define IDS_BIOS1 13
|
||||
#define IDS_BIOS2 14
|
||||
#define IDS_BIOS3 15
|
||||
#define IDS_BIOS4 16
|
||||
#define IDS_BIOS5 17
|
||||
#define IDS_BIOS6 18
|
||||
#define IDS_CARTRIDGE1 19
|
||||
#define IDS_CARTRIDGE2 20
|
||||
#define IDS_CARTRIDGE3 21
|
||||
#define IDS_CARTRIDGE4 22
|
||||
#define IDS_CARTRIDGE5 23
|
||||
#define IDS_CARTRIDGE6 24
|
||||
#define IDS_CARTRIDGE7 25
|
||||
#define IDS_PALETTE1 26
|
||||
#define IDS_PALETTE2 27
|
||||
#define IDS_PALETTE3 28
|
||||
#define IDS_PALETTE4 29
|
||||
#define IDS_PROSYSTEM1 30
|
||||
#define IDS_PROSYSTEM2 31
|
||||
#define IDS_PROSYSTEM3 32
|
||||
#define IDS_PROSYSTEM4 33
|
||||
#define IDS_PROSYSTEM5 34
|
||||
#define IDS_PROSYSTEM6 35
|
||||
#define IDS_PROSYSTEM7 36
|
||||
#define IDS_PROSYSTEM8 37
|
||||
#define IDS_PROSYSTEM9 38
|
||||
#define IDS_PROSYSTEM10 39
|
||||
#define IDS_PROSYSTEM11 40
|
||||
#define IDS_PROSYSTEM12 41
|
||||
#define IDS_PROSYSTEM13 42
|
||||
#define IDS_PROSYSTEM14 43
|
||||
#define IDS_PROSYSTEM15 44
|
||||
#define IDS_CONSOLE1 45
|
||||
#define IDS_CONSOLE2 46
|
||||
#define IDS_CONSOLE3 47
|
||||
#define IDS_CONSOLE4 48
|
||||
#define IDS_CONSOLE5 49
|
||||
#define IDS_CONSOLE6 50
|
||||
#define IDS_CONSOLE7 51
|
||||
#define IDS_DATABASE1 52
|
||||
#define IDS_DATABASE2 53
|
||||
#define IDS_DISPLAY1 54
|
||||
#define IDS_DISPLAY2 55
|
||||
#define IDS_DISPLAY3 56
|
||||
#define IDS_DISPLAY4 57
|
||||
#define IDS_DISPLAY5 58
|
||||
#define IDS_DISPLAY6 59
|
||||
#define IDS_DISPLAY7 60
|
||||
#define IDS_DISPLAY8 61
|
||||
#define IDS_DISPLAY9 62
|
||||
#define IDS_DISPLAY10 63
|
||||
#define IDS_DISPLAY11 64
|
||||
#define IDS_DISPLAY12 65
|
||||
#define IDS_DISPLAY13 66
|
||||
#define IDS_DISPLAY14 67
|
||||
#define IDS_DISPLAY15 68
|
||||
#define IDS_DISPLAY16 69
|
||||
#define IDS_DISPLAY17 70
|
||||
#define IDS_DISPLAY18 71
|
||||
#define IDS_DISPLAY19 72
|
||||
#define IDS_DISPLAY20 73
|
||||
#define IDS_DISPLAY21 74
|
||||
#define IDS_DISPLAY22 75
|
||||
#define IDS_DISPLAY23 76
|
||||
#define IDS_DISPLAY24 77
|
||||
#define IDS_DISPLAY25 78
|
||||
#define IDS_DISPLAY26 79
|
||||
#define IDS_DISPLAY27 80
|
||||
#define IDS_DISPLAY28 81
|
||||
#define IDS_DISPLAY29 82
|
||||
#define IDS_DISPLAY30 83
|
||||
#define IDS_DISPLAY31 84
|
||||
#define IDS_DISPLAY32 85
|
||||
#define IDS_DISPLAY33 86
|
||||
#define IDS_INPUT1 87
|
||||
#define IDS_INPUT2 88
|
||||
#define IDS_INPUT3 89
|
||||
#define IDS_INPUT4 90
|
||||
#define IDS_INPUT5 91
|
||||
#define IDS_INPUT6 92
|
||||
#define IDS_INPUT7 93
|
||||
#define IDS_INPUT8 94
|
||||
#define IDS_INPUT9 95
|
||||
#define IDS_INPUT10 96
|
||||
#define IDS_INPUT11 97
|
||||
#define IDS_INPUT12 98
|
||||
#define IDS_MENU1 99
|
||||
#define IDS_MENU2 100
|
||||
#define IDR_MAINMENU 101
|
||||
#define IDD_DIALOG_ABOUT 101
|
||||
#define IDR_MENU_MAIN 101
|
||||
#define IDS_MENU3 101
|
||||
#define IDR_ACCELERATOR 102
|
||||
#define IDD_DIALOG_CONTROLLER 102
|
||||
#define IDS_MENU4 102
|
||||
#define IDD_DIALOG_CONSOLE 103
|
||||
#define IDS_MENU5 103
|
||||
#define IDS_MENU6 104
|
||||
#define IDS_MENU7 105
|
||||
#define IDS_MENU8 106
|
||||
#define IDS_MENU9 107
|
||||
#define IDS_MENU10 108
|
||||
#define IDS_MENU11 109
|
||||
#define IDS_MENU12 110
|
||||
#define IDI_ICON_PROSYSTEM 111
|
||||
#define IDS_MENU13 111
|
||||
#define IDS_MENU14 112
|
||||
#define IDS_MENU15 113
|
||||
#define IDD_DIALOG_USER 114
|
||||
#define IDS_MENU16 114
|
||||
#define IDS_SOUND1 115
|
||||
#define IDS_SOUND2 116
|
||||
#define IDS_SOUND3 117
|
||||
#define IDS_SOUND4 118
|
||||
#define IDS_SOUND5 119
|
||||
#define IDS_SOUND6 120
|
||||
#define IDS_SOUND7 121
|
||||
#define IDS_SOUND8 122
|
||||
#define IDS_SOUND9 123
|
||||
#define IDS_SOUND10 124
|
||||
#define IDS_SOUND11 125
|
||||
#define IDS_SOUND12 126
|
||||
#define IDS_SOUND13 127
|
||||
#define IDS_SOUND14 128
|
||||
#define IDS_SOUND15 129
|
||||
#define IDS_SOUND16 130
|
||||
#define IDS_STRING132 132
|
||||
#define IDS_CARTRIDGE8 133
|
||||
#define IDS_CARTRIDGE9 134
|
||||
#define IDC_BUTTON_ABOUT_OK 1170
|
||||
#define IDC_BUTTON_CONTROLLER_OK 1175
|
||||
#define IDC_COMBO_CONTROLLER_UP 1176
|
||||
#define IDC_COMBO_CONTROLLER_DOWN 1177
|
||||
#define IDC_COMBO_CONTROLLER_LEFT 1178
|
||||
#define IDC_COMBO_PART_MENU 1178
|
||||
#define IDC_COMBO_CONTROLLER_RIGHT 1179
|
||||
#define IDC_COMBO_PART_EXIT 1179
|
||||
#define IDC_COMBO_CONTROLLER_BUTTON1 1180
|
||||
#define IDC_COMBO_CONSOLE_RESET 1181
|
||||
#define IDC_COMBO_DEVICE_UP 1181
|
||||
#define IDC_COMBO_CONSOLE_SELECT 1182
|
||||
#define IDC_COMBO_DEVICE_DOWN 1182
|
||||
#define IDC_COMBO_CONSOLE_PAUSE 1183
|
||||
#define IDC_COMBO_DEVICE_LEFT 1183
|
||||
#define IDC_COMBO_CONSOLE_RIGHT 1184
|
||||
#define IDC_COMBO_DEVICE_RIGHT 1184
|
||||
#define IDC_COMBO_CONSOLE_LEFT 1185
|
||||
#define IDC_COMBO_DEVICE_BUTTON1 1185
|
||||
#define IDC_COMBO_CONTROLLER_BUTTON2 1186
|
||||
#define IDC_BUTTON_CONSOLE_OK 1186
|
||||
#define IDC_BUTTON_CONTROLLER_CANCEL 1187
|
||||
#define IDC_COMBO_DEVICE_RESET 1187
|
||||
#define IDC_BUTTON_CONSOLE_CANCEL 1188
|
||||
#define IDC_COMBO_DEVICE_BUTTON2 1188
|
||||
#define IDC_COMBO_DEVICE_SELECT 1189
|
||||
#define IDC_COMBO_DEVICE_PAUSE 1190
|
||||
#define IDC_COMBO_DEVICE_MENU 1190
|
||||
#define IDC_STATIC_VERSION2 1190
|
||||
#define IDC_COMBO_DEVICE_RIGHTD 1191
|
||||
#define IDC_COMBO_DEVICE_EXIT 1191
|
||||
#define IDC_STATIC_VERSION3 1191
|
||||
#define IDC_COMBO_DEVICE_LEFTD 1192
|
||||
#define IDC_COMBO_MOD_MENU 1192
|
||||
#define IDC_COMBO_MOD_EXIT 1193
|
||||
#define IDC_BUTTON_USER_OK 1194
|
||||
#define IDC_BUTTON_USER_CANCEL 1195
|
||||
#define IDM_RECENT_SLOT0 30000
|
||||
#define IDM_RECENT_SLOT1 30001
|
||||
#define IDM_RECENT_SLOT2 30002
|
||||
#define IDM_RECENT_SLOT3 30003
|
||||
#define IDM_RECENT_SLOT4 30004
|
||||
#define IDM_RECENT_SLOT5 30005
|
||||
#define IDM_RECENT_SLOT6 30006
|
||||
#define IDM_RECENT_SLOT7 30007
|
||||
#define IDM_RECENT_SLOT8 30008
|
||||
#define IDM_RECENT_SLOT9 30009
|
||||
#define IDM_FILE_OPEN 40001
|
||||
#define IDM_FILE_CLOSE 40007
|
||||
#define IDM_SAVE_SAVEAS 40008
|
||||
#define IDM_LOAD_LOADFROM 40015
|
||||
#define IDM_FILE_EXIT 40021
|
||||
#define IDM_OPTIONS_RESET 40022
|
||||
#define IDM_OPTIONS_PAUSE 40023
|
||||
#define IDM_DISPLAY_FULLSCREEN 40024
|
||||
#define IDM_DISPLAY_ZOOM1 40025
|
||||
#define IDM_DISPLAY_ZOOM2 40026
|
||||
#define IDM_DISPLAY_ZOOM3 40027
|
||||
#define IDM_DISPLAY_ZOOM4 40028
|
||||
#define IDM_OPTIONS_MENU 40039
|
||||
#define IDM_HELP_ABOUT 40040
|
||||
#define IDM_OPTIONS_SETTINGS 40062
|
||||
#define IDM_SAVE_NEXT 40094
|
||||
#define IDM_DISPLAY_SCREENSHOT 40099
|
||||
#define IDM_DISPLAY_STRETCHED 40101
|
||||
#define IDM_SAMPLERATE_11025 40107
|
||||
#define IDM_SAMPLERATE_22050 40108
|
||||
#define IDM_SAMPLERATE_31440 40109
|
||||
#define IDM_SAMPLERATE_44100 40110
|
||||
#define IDM_SAMPLERATE_48000 40111
|
||||
#define IDM_SAMPLERATE_96000 40112
|
||||
#define IDM_LATENCY_NONE 40113
|
||||
#define IDM_LATENCY_VERYLOW 40114
|
||||
#define IDM_LATENCY_LOW 40115
|
||||
#define IDM_LATENCY_MEDIUM 40116
|
||||
#define IDM_LATENCY_HIGH 40117
|
||||
#define IDM_LATENCY_VERYHIGH 40118
|
||||
#define IDM_BLANK 40144
|
||||
#define IDM_FRAMESKIP_0 40146
|
||||
#define IDM_FRAMESKIP_1 40148
|
||||
#define IDM_FRAMESKIP_5 40160
|
||||
#define IDM_FRAMESKIP_10 40161
|
||||
#define IDM_FRAMESKIP_15 40162
|
||||
#define IDM_FRAMESKIP_20 40163
|
||||
#define IDM_FRAMESKIP_25 40164
|
||||
#define IDM_FRAMESKIP_30 40165
|
||||
#define IDM_FILE_SAVE 40167
|
||||
#define IDM_FILE_LOAD 40168
|
||||
#define IDM_DISPLAY_PALETTE 40169
|
||||
#define IDM_MUTE_TIA 40172
|
||||
#define IDM_SOUND_POKEY 40173
|
||||
#define IDM_MUTE_ALL 40174
|
||||
#define IDM_EMULATION_BIOS 40175
|
||||
#define IDM_OPTIONS_INPUT 40176
|
||||
#define IDM_REGION_AUTO 40177
|
||||
#define IDM_REGION_NTSC 40178
|
||||
#define IDM_REGION_PAL 40179
|
||||
#define IDM_FRAMESKIP_2 40181
|
||||
#define IDM_FRAMESKIP_3 40182
|
||||
#define IDM_FRAMESKIP_4 40183
|
||||
#define IDM_FRAMESKIP_6 40184
|
||||
#define IDM_FRAMESKIP_7 40185
|
||||
#define IDM_FRAMESKIP_8 40186
|
||||
#define IDM_FRAMESKIP_9 40187
|
||||
#define IDM_EMULATION_DATABASE 40189
|
||||
#define IDM_SOUND_MUTE 40190
|
||||
#define IDM_INPUT_CONTROLLER1 40191
|
||||
#define IDM_INPUT_CONTROLLER2 40192
|
||||
#define IDM_INPUT_CONSOLE 40193
|
||||
#define IDM_HELP_CONTENTS 40195
|
||||
#define IDM_HELP_INDEX 40196
|
||||
#define IDM_INPUT_USER 40198
|
||||
#define ID_OPTIONS_DISPLAY_SCREENSHOT_REMOVENONWEBSYMBOLS 40200
|
||||
#define ID_OPTIONS_DISPLAY_SCREENSHOT_REPLACESPACESBY 40201
|
||||
#define IDM_MODES_BASE 50000
|
||||
#define IDM_MODES_LAST 51000
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 117
|
||||
#define _APS_NEXT_COMMAND_VALUE 40202
|
||||
#define _APS_NEXT_CONTROL_VALUE 1196
|
||||
#define _APS_NEXT_SYMED_VALUE 119
|
||||
#endif
|
||||
#endif
|
||||
@@ -1,162 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Archive.cpp
|
||||
// ----------------------------------------------------------------------------
|
||||
#include "Archive.h"
|
||||
#define ARCHIVE_SOURCE "Archive.cpp"
|
||||
|
||||
#define _MAX_PATH 128
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// GetUncompressedFileSize
|
||||
// ----------------------------------------------------------------------------
|
||||
uint archive_GetUncompressedFileSize(std::string filename) {
|
||||
if(filename.empty( ) || filename.size( ) == 0) {
|
||||
logger_LogError("Zip filename is invalid.", ARCHIVE_SOURCE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
unzFile file = unzOpen(filename.c_str( ));
|
||||
if(file == NULL) {
|
||||
logger_LogInfo("Filename " + filename + " is not a valid zip file.", ARCHIVE_SOURCE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int result = unzGoToFirstFile(file);
|
||||
if(result != UNZ_OK) {
|
||||
logger_LogInfo("Failed to find the first file within the zip file.", ARCHIVE_SOURCE);
|
||||
logger_LogInfo("Result: " + result, ARCHIVE_SOURCE);
|
||||
unzClose(file);
|
||||
return 0;
|
||||
}
|
||||
|
||||
unz_file_info_s zipInfo = {0};
|
||||
char buffer[_MAX_PATH] = {0};
|
||||
result = unzGetCurrentFileInfo(file, &zipInfo, buffer, _MAX_PATH, NULL, 0, NULL, 0);
|
||||
if(result != UNZ_OK) {
|
||||
logger_LogInfo("Failed to retrieve the current zipped file info.", ARCHIVE_SOURCE);
|
||||
logger_LogInfo("Result: " + result, ARCHIVE_SOURCE);
|
||||
unzClose(file);
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint size = zipInfo.uncompressed_size;
|
||||
unzClose(file);
|
||||
return size;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Uncompress
|
||||
// ----------------------------------------------------------------------------
|
||||
bool archive_Uncompress(std::string filename, byte* data, uint size) {
|
||||
if(filename.empty( ) || filename.size( ) == 0) {
|
||||
logger_LogError("Zip filename is invalid.", ARCHIVE_SOURCE);
|
||||
return false;
|
||||
}
|
||||
if(data == NULL) {
|
||||
logger_LogError("Data parameter is invalid.", ARCHIVE_SOURCE);
|
||||
return false;
|
||||
}
|
||||
|
||||
unzFile file = unzOpen(filename.c_str( ));
|
||||
if(file == NULL) {
|
||||
logger_LogInfo("Filename " + filename + " is not a valid zip file.", ARCHIVE_SOURCE);
|
||||
return false;
|
||||
}
|
||||
|
||||
int result = unzGoToFirstFile(file);
|
||||
if(result != UNZ_OK) {
|
||||
logger_LogInfo("Failed to find the first file within the zip file " + filename + ".", ARCHIVE_SOURCE);
|
||||
logger_LogInfo("Result: " + result, ARCHIVE_SOURCE);
|
||||
unzClose(file);
|
||||
return false;
|
||||
}
|
||||
|
||||
result = unzOpenCurrentFile(file);
|
||||
if(result != UNZ_OK) {
|
||||
logger_LogInfo("Failed to open the first file within the zip file " + filename + ".", ARCHIVE_SOURCE);
|
||||
logger_LogInfo("Result: " + result, ARCHIVE_SOURCE);
|
||||
unzClose(file);
|
||||
return false;
|
||||
}
|
||||
|
||||
result = unzReadCurrentFile(file, data, size);
|
||||
if(result != size) {
|
||||
logger_LogInfo("Failed to read first file data within the zip file " + filename + ".", ARCHIVE_SOURCE);
|
||||
logger_LogInfo("Result: " + result, ARCHIVE_SOURCE);
|
||||
unzCloseCurrentFile(file);
|
||||
unzClose(file);
|
||||
return false;
|
||||
}
|
||||
|
||||
unzCloseCurrentFile(file);
|
||||
unzClose(file);
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Compress
|
||||
// ----------------------------------------------------------------------------
|
||||
bool archive_Compress(std::string zipFilename, std::string filename, const byte* data, uint size) {
|
||||
if(zipFilename.empty( ) || zipFilename.size( ) == 0) {
|
||||
logger_LogError("Zip filename is invalid.", ARCHIVE_SOURCE);
|
||||
return false;
|
||||
}
|
||||
if(filename.empty( ) || filename.size( ) == 0) {
|
||||
logger_LogError("Filename is invalid.", ARCHIVE_SOURCE);
|
||||
return false;
|
||||
}
|
||||
if(data == NULL) {
|
||||
logger_LogError("Data parameter is invalid.", ARCHIVE_SOURCE);
|
||||
return false;
|
||||
}
|
||||
|
||||
zipFile file = zipOpen(zipFilename.c_str( ), APPEND_STATUS_CREATE);
|
||||
if(file == NULL) {
|
||||
logger_LogInfo("Failed to create the zip file " + zipFilename + ".", ARCHIVE_SOURCE);
|
||||
return false;
|
||||
}
|
||||
|
||||
zip_fileinfo fileInfo = {0};
|
||||
fileInfo.dosDate = 1;
|
||||
|
||||
int result = zipOpenNewFileInZip(file, filename.c_str( ), &fileInfo, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_BEST_COMPRESSION);
|
||||
if(result != ZIP_OK) {
|
||||
logger_LogInfo("Failed to open a new file within the zip file " + filename + ".", ARCHIVE_SOURCE);
|
||||
logger_LogInfo("Result: " + result, ARCHIVE_SOURCE);
|
||||
zipClose(file, "Failed to compress.");
|
||||
return false;
|
||||
}
|
||||
|
||||
result = zipWriteInFileInZip(file, data, size);
|
||||
if(result != ZIP_OK) {
|
||||
logger_LogInfo("Failed to write data to the zip file " + filename + ".", ARCHIVE_SOURCE);
|
||||
zipCloseFileInZip(file);
|
||||
zipClose(file, "Failed to compress.");
|
||||
return false;
|
||||
}
|
||||
|
||||
zipCloseFileInZip(file);
|
||||
zipClose(file, "Comment");
|
||||
return true;
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Archive.h
|
||||
// ----------------------------------------------------------------------------
|
||||
#ifndef ARCHIVE_H
|
||||
#define ARCHIVE_H
|
||||
|
||||
#include <string>
|
||||
#include "Logger.h"
|
||||
#include "Cartridge.h"
|
||||
#include "zip.h"
|
||||
#include "unzip.h"
|
||||
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned short word;
|
||||
typedef unsigned int uint;
|
||||
|
||||
extern uint archive_GetUncompressedFileSize(std::string filename);
|
||||
extern bool archive_Uncompress(std::string filename, byte* data, uint size);
|
||||
extern bool archive_Compress(std::string zipFilename, std::string filename, const byte* data, uint size);
|
||||
|
||||
#endif
|
||||
-113
@@ -1,113 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Bios.cpp
|
||||
// ----------------------------------------------------------------------------
|
||||
#include "Bios.h"
|
||||
#define BIOS_SOURCE "Bios.cpp"
|
||||
|
||||
bool bios_enabled = false;
|
||||
std::string bios_filename;
|
||||
|
||||
static byte* bios_data = NULL;
|
||||
static word bios_size = 0;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Load
|
||||
// ----------------------------------------------------------------------------
|
||||
bool bios_Load(std::string filename) {
|
||||
if(filename.empty( ) || filename.length( ) == 0) {
|
||||
logger_LogError("Bios filename is invalid.", BIOS_SOURCE);
|
||||
return false;
|
||||
}
|
||||
|
||||
bios_Release( );
|
||||
logger_LogInfo("Opening bios file " + filename + ".", BIOS_SOURCE);
|
||||
|
||||
bios_size = archive_GetUncompressedFileSize(filename);
|
||||
if(bios_size == 0) {
|
||||
FILE* file = fopen(filename.c_str( ), "rb");
|
||||
if(file == NULL) {
|
||||
#ifndef WII
|
||||
logger_LogError("Failed to open the bios file " + filename + " for reading.", BIOS_SOURCE);
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
if(fseek(file, 0L, SEEK_END)) {
|
||||
fclose(file);
|
||||
logger_LogError("Failed to find the end of the bios file.", BIOS_SOURCE);
|
||||
return false;
|
||||
}
|
||||
|
||||
bios_size = ftell(file);
|
||||
if(fseek(file, 0L, SEEK_SET)) {
|
||||
fclose(file);
|
||||
logger_LogError("Failed to find the size of the bios file.", BIOS_SOURCE);
|
||||
return false;
|
||||
}
|
||||
|
||||
bios_data = new byte[bios_size];
|
||||
if(fread(bios_data, 1, bios_size, file) != bios_size && ferror(file)) {
|
||||
fclose(file);
|
||||
logger_LogError("Failed to read the bios data.", BIOS_SOURCE);
|
||||
bios_Release( );
|
||||
return false;
|
||||
}
|
||||
|
||||
fclose(file);
|
||||
}
|
||||
else {
|
||||
bios_data = new byte[bios_size];
|
||||
archive_Uncompress(filename, bios_data, bios_size);
|
||||
}
|
||||
|
||||
bios_filename = filename;
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// IsLoaded
|
||||
// ----------------------------------------------------------------------------
|
||||
bool bios_IsLoaded( ) {
|
||||
return (bios_data != NULL)? true: false;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Release
|
||||
// ----------------------------------------------------------------------------
|
||||
void bios_Release( ) {
|
||||
if(bios_data) {
|
||||
delete [ ] bios_data;
|
||||
bios_size = 0;
|
||||
bios_data = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Store
|
||||
// ----------------------------------------------------------------------------
|
||||
void bios_Store( ) {
|
||||
if(bios_data != NULL && bios_enabled) {
|
||||
memory_WriteROM(65536 - bios_size, bios_size, bios_data);
|
||||
}
|
||||
}
|
||||
@@ -1,505 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Cartridge.cpp
|
||||
// ----------------------------------------------------------------------------
|
||||
#include "Cartridge.h"
|
||||
#include "Region.h"
|
||||
|
||||
#include <string.h>
|
||||
#define CARTRIDGE_SOURCE "Cartridge.cpp"
|
||||
|
||||
std::string cartridge_title;
|
||||
std::string cartridge_description;
|
||||
std::string cartridge_year;
|
||||
std::string cartridge_maker;
|
||||
std::string cartridge_digest;
|
||||
std::string cartridge_filename;
|
||||
byte cartridge_type;
|
||||
byte cartridge_region;
|
||||
bool cartridge_pokey;
|
||||
bool cartridge_pokey450;
|
||||
byte cartridge_controller[2] = {1, 1};
|
||||
byte cartridge_bank;
|
||||
uint cartridge_flags;
|
||||
int cartridge_crosshair_x;
|
||||
int cartridge_crosshair_y;
|
||||
bool cartridge_dualanalog = false;
|
||||
bool cartridge_xm = false;
|
||||
bool cartridge_disable_bios = false;
|
||||
uint cartridge_hblank = 34;
|
||||
byte cartridge_left_switch = 1;
|
||||
byte cartridge_right_switch = 0;
|
||||
bool cartridge_swap_buttons = false;
|
||||
bool cartridge_hsc_enabled = false;
|
||||
|
||||
static byte* cartridge_buffer = NULL;
|
||||
static uint cartridge_size = 0;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// HasHeader
|
||||
// ----------------------------------------------------------------------------
|
||||
static bool cartridge_HasHeader(const byte* header) {
|
||||
const char HEADER_ID[ ] = {"ATARI7800"};
|
||||
for(int index = 0; index < 9; index++) {
|
||||
if(HEADER_ID[index] != header[index + 1]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Header for CC2 hack
|
||||
// ----------------------------------------------------------------------------
|
||||
static bool cartridge_CC2(const byte* header) {
|
||||
const char HEADER_ID[ ] = {">>"};
|
||||
for(int index = 0; index < 2; index++) {
|
||||
if(HEADER_ID[index] != header[index+1]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// GetBank
|
||||
// ----------------------------------------------------------------------------
|
||||
static uint cartridge_GetBank(byte bank) {
|
||||
if ((cartridge_type == CARTRIDGE_TYPE_SUPERCART || cartridge_type == CARTRIDGE_TYPE_SUPERCART_ROM || cartridge_type == CARTRIDGE_TYPE_SUPERCART_RAM) && cartridge_size <= 65536) {
|
||||
// for some of these carts, there are only 4 banks. in this case we ignore bit 3
|
||||
// previously, games of this type had to be doubled. The first 4 banks needed to be duplicated at the end of the ROM
|
||||
return (bank & 3);
|
||||
}
|
||||
|
||||
return bank;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// GetBankOffset
|
||||
// ----------------------------------------------------------------------------
|
||||
static uint cartridge_GetBankOffset(byte bank) {
|
||||
return cartridge_GetBank(bank) * 16384;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// WriteBank
|
||||
// ----------------------------------------------------------------------------
|
||||
static void cartridge_WriteBank(word address, byte bank) {
|
||||
uint offset = cartridge_GetBankOffset(bank);
|
||||
if(offset < cartridge_size) {
|
||||
memory_WriteROM(address, 16384, cartridge_buffer + offset);
|
||||
cartridge_bank = bank;
|
||||
}
|
||||
}
|
||||
|
||||
static void cartridge_SetTypeBySize(uint size) {
|
||||
if (size <= 0x10000) {
|
||||
cartridge_type = CARTRIDGE_TYPE_NORMAL;
|
||||
} else if (size == 0x24000 ) {
|
||||
cartridge_type = CARTRIDGE_TYPE_SUPERCART_LARGE;
|
||||
} else if (size == 0x20000 ) {
|
||||
cartridge_type = CARTRIDGE_TYPE_SUPERCART_ROM;
|
||||
} else {
|
||||
cartridge_type = CARTRIDGE_TYPE_SUPERCART;
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ReadHeader
|
||||
// ----------------------------------------------------------------------------
|
||||
static void cartridge_ReadHeader(const byte* header) {
|
||||
|
||||
char temp[33] = {0};
|
||||
for(int index = 0; index < 32; index++) {
|
||||
temp[index] = header[index + 17];
|
||||
}
|
||||
cartridge_title = temp;
|
||||
|
||||
cartridge_size = header[49] << 24;
|
||||
cartridge_size |= header[50] << 16;
|
||||
cartridge_size |= header[51] << 8;
|
||||
cartridge_size |= header[52];
|
||||
|
||||
if(header[53] == 0) {
|
||||
if(cartridge_size > 131072) {
|
||||
cartridge_type = CARTRIDGE_TYPE_SUPERCART_LARGE;
|
||||
}
|
||||
else if(header[54] == 2 || header[54] == 3) {
|
||||
cartridge_type = CARTRIDGE_TYPE_SUPERCART;
|
||||
}
|
||||
else if(header[54] == 4 || header[54] == 5 || header[54] == 6 || header[54] == 7) {
|
||||
cartridge_type = CARTRIDGE_TYPE_SUPERCART_RAM;
|
||||
}
|
||||
else if(header[54] == 8 || header[54] == 9 || header[54] == 10 || header[54] == 11) {
|
||||
cartridge_type = CARTRIDGE_TYPE_SUPERCART_ROM;
|
||||
}
|
||||
else {
|
||||
cartridge_type = CARTRIDGE_TYPE_NORMAL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(header[53] == 2 /*1*/) { // Wii: Abs and Act were swapped
|
||||
cartridge_type = CARTRIDGE_TYPE_ABSOLUTE;
|
||||
}
|
||||
else if(header[53] == 1 /*2*/) { // Wii: Abs and Act were swapped
|
||||
cartridge_type = CARTRIDGE_TYPE_ACTIVISION;
|
||||
}
|
||||
else {
|
||||
cartridge_type = CARTRIDGE_TYPE_NORMAL;
|
||||
}
|
||||
}
|
||||
|
||||
cartridge_pokey = (header[54] & 1)? true: false;
|
||||
cartridge_pokey450 = (header[54] & 0x40)? true : false;
|
||||
if (cartridge_pokey450) {
|
||||
cartridge_pokey = true;
|
||||
}
|
||||
cartridge_controller[0] = header[55];
|
||||
cartridge_controller[1] = header[56];
|
||||
cartridge_region = header[57];
|
||||
cartridge_flags = 0;
|
||||
cartridge_xm = (header[63] & 1)? true: false;
|
||||
cartridge_hsc_enabled = header[58]&0x01;
|
||||
|
||||
// Wii: Updates to header interpretation
|
||||
byte ct1 = header[54];
|
||||
if(header[53] == 0) {
|
||||
if ((ct1&0x0a)==0x0a) { // BIT1 and BIT3 (Supercart Large: 2) rom at $4000
|
||||
cartridge_type = CARTRIDGE_TYPE_SUPERCART_LARGE;
|
||||
} else if ((ct1&0x12)==0x12) { // BIT1 and BIT4 (Supercart ROM: 4) bank6 at $4000
|
||||
cartridge_type = CARTRIDGE_TYPE_SUPERCART_ROM;
|
||||
} else if ((ct1&0x06)==0x06) { // BIT1 and BIT2 (Supercart RAM: 3) ram at $4000
|
||||
cartridge_type = CARTRIDGE_TYPE_SUPERCART_RAM;
|
||||
} else if ((ct1&0x02)==0x02) { // BIT1 (Supercart) bank switched
|
||||
cartridge_type = CARTRIDGE_TYPE_SUPERCART;
|
||||
} else if (cartridge_size <= 0x10000 && ((ct1&0x04)==0x04)) { // Size < 64k && BIT2 (Normal RAM: ?) ram at $4000 )
|
||||
cartridge_type = CARTRIDGE_TYPE_NORMAL_RAM;
|
||||
} else {
|
||||
// Attempt to determine the cartridge type based on its size
|
||||
cartridge_SetTypeBySize(cartridge_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Load
|
||||
// ----------------------------------------------------------------------------
|
||||
static bool cartridge_Load(const byte* data, uint size) {
|
||||
if(size <= 128) {
|
||||
logger_LogError("Cartridge data is invalid.", CARTRIDGE_SOURCE);
|
||||
return false;
|
||||
}
|
||||
|
||||
cartridge_Release( );
|
||||
|
||||
byte header[128] = {0};
|
||||
for(int index = 0; index < 128; index++) {
|
||||
header[index] = data[index];
|
||||
}
|
||||
|
||||
if (cartridge_CC2(header)) {
|
||||
logger_LogError("Prosystem doesn't support CC2 hacks.", CARTRIDGE_SOURCE);
|
||||
return false;
|
||||
}
|
||||
|
||||
uint offset = 0;
|
||||
if(cartridge_HasHeader(header)) {
|
||||
cartridge_ReadHeader(header);
|
||||
size -= 128;
|
||||
offset = 128;
|
||||
|
||||
// Several cartridge headers do not have the proper size. So attempt to use the size
|
||||
// of the file.
|
||||
if (cartridge_size != size) {
|
||||
// Necessary for the following roms:
|
||||
// Impossible Mission hacks w/ C64 style graphics
|
||||
if (size % 1024 == 0) {
|
||||
cartridge_size = size;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
cartridge_size = size;
|
||||
// Attempt to guess the cartridge type based on its size
|
||||
cartridge_SetTypeBySize(size);
|
||||
}
|
||||
|
||||
cartridge_buffer = new byte[cartridge_size];
|
||||
for(int index = 0; index < cartridge_size; index++) {
|
||||
cartridge_buffer[index] = data[index + offset];
|
||||
}
|
||||
|
||||
cartridge_digest = hash_Compute(cartridge_buffer, cartridge_size);
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Load
|
||||
// ----------------------------------------------------------------------------
|
||||
bool cartridge_Load(std::string filename) {
|
||||
if(filename.empty( ) || filename.length( ) == 0) {
|
||||
logger_LogError("Cartridge filename is invalid.", CARTRIDGE_SOURCE);
|
||||
return false;
|
||||
}
|
||||
|
||||
cartridge_Release( );
|
||||
logger_LogInfo("Opening cartridge file " + filename + ".", CARTRIDGE_SOURCE);
|
||||
|
||||
byte* data = NULL;
|
||||
//uint size = archive_GetUncompressedFileSize(filename);
|
||||
uint size = 0;
|
||||
|
||||
if(size == 0) {
|
||||
FILE *file = fopen(filename.c_str( ), "rb");
|
||||
if(file == NULL) {
|
||||
logger_LogError("Failed to open the cartridge file " + filename + " for reading.", CARTRIDGE_SOURCE);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(fseek(file, 0L, SEEK_END)) {
|
||||
fclose(file);
|
||||
logger_LogError("Failed to find the end of the cartridge file.", CARTRIDGE_SOURCE);
|
||||
return false;
|
||||
}
|
||||
size = ftell(file);
|
||||
if(fseek(file, 0L, SEEK_SET)) {
|
||||
fclose(file);
|
||||
logger_LogError("Failed to find the size of the cartridge file.", CARTRIDGE_SOURCE);
|
||||
return false;
|
||||
}
|
||||
|
||||
data = new byte[size];
|
||||
if(fread(data, 1, size, file) != size && ferror(file)) {
|
||||
fclose(file);
|
||||
logger_LogError("Failed to read the cartridge data.", CARTRIDGE_SOURCE);
|
||||
cartridge_Release( );
|
||||
delete [ ] data;
|
||||
return false;
|
||||
}
|
||||
|
||||
fclose(file);
|
||||
}
|
||||
else {
|
||||
data = new byte[size];
|
||||
//archive_Uncompress(filename, data, size);
|
||||
}
|
||||
|
||||
if(!cartridge_Load(data, size)) {
|
||||
logger_LogError("Failed to load the cartridge data into memory.", CARTRIDGE_SOURCE);
|
||||
delete [ ] data;
|
||||
return false;
|
||||
}
|
||||
if(data != NULL) {
|
||||
delete [ ] data;
|
||||
}
|
||||
|
||||
cartridge_filename = filename;
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Store
|
||||
// ----------------------------------------------------------------------------
|
||||
void cartridge_Store( ) {
|
||||
switch(cartridge_type) {
|
||||
case CARTRIDGE_TYPE_NORMAL:
|
||||
memory_WriteROM(65536 - cartridge_size, cartridge_size, cartridge_buffer);
|
||||
break;
|
||||
case CARTRIDGE_TYPE_NORMAL_RAM:
|
||||
memory_WriteROM(65536 - cartridge_size, cartridge_size, cartridge_buffer);
|
||||
memory_ClearROM(16384, 16384);
|
||||
break;
|
||||
case CARTRIDGE_TYPE_SUPERCART: {
|
||||
uint offset = cartridge_size - 16384;
|
||||
if(offset < cartridge_size) {
|
||||
memory_WriteROM(49152, 16384, cartridge_buffer + offset);
|
||||
}
|
||||
} break;
|
||||
case CARTRIDGE_TYPE_SUPERCART_LARGE: {
|
||||
uint offset = cartridge_size - 16384;
|
||||
if(offset < cartridge_size) {
|
||||
memory_WriteROM(49152, 16384, cartridge_buffer + offset);
|
||||
memory_WriteROM(16384, 16384, cartridge_buffer + cartridge_GetBankOffset(0));
|
||||
}
|
||||
} break;
|
||||
case CARTRIDGE_TYPE_SUPERCART_RAM: {
|
||||
uint offset = cartridge_size - 16384;
|
||||
if(offset < cartridge_size) {
|
||||
memory_WriteROM(49152, 16384, cartridge_buffer + offset);
|
||||
memory_ClearROM(16384, 16384);
|
||||
}
|
||||
} break;
|
||||
case CARTRIDGE_TYPE_SUPERCART_ROM: {
|
||||
uint offset = cartridge_size - 16384;
|
||||
if(offset < cartridge_size && cartridge_GetBankOffset(6) < cartridge_size) {
|
||||
memory_WriteROM(49152, 16384, cartridge_buffer + offset);
|
||||
memory_WriteROM(16384, 16384, cartridge_buffer + cartridge_GetBankOffset(6));
|
||||
}
|
||||
} break;
|
||||
case CARTRIDGE_TYPE_ABSOLUTE:
|
||||
memory_WriteROM(16384, 16384, cartridge_buffer);
|
||||
memory_WriteROM(32768, 32768, cartridge_buffer + cartridge_GetBankOffset(2));
|
||||
break;
|
||||
case CARTRIDGE_TYPE_ACTIVISION:
|
||||
if(122880 < cartridge_size) {
|
||||
memory_WriteROM(40960, 16384, cartridge_buffer);
|
||||
memory_WriteROM(16384, 8192, cartridge_buffer + 106496);
|
||||
memory_WriteROM(24576, 8192, cartridge_buffer + 98304);
|
||||
memory_WriteROM(32768, 8192, cartridge_buffer + 122880);
|
||||
memory_WriteROM(57344, 8192, cartridge_buffer + 114688);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Write
|
||||
// ----------------------------------------------------------------------------
|
||||
void cartridge_Write(word address, byte data) {
|
||||
switch(cartridge_type) {
|
||||
case CARTRIDGE_TYPE_SUPERCART:
|
||||
case CARTRIDGE_TYPE_SUPERCART_RAM:
|
||||
case CARTRIDGE_TYPE_SUPERCART_ROM: {
|
||||
uint maxbank = cartridge_size / 16384;
|
||||
if(address >= 32768 && address < 49152 && cartridge_GetBank(data) < maxbank /*9*/) {
|
||||
cartridge_StoreBank(data);
|
||||
}
|
||||
} break;
|
||||
case CARTRIDGE_TYPE_SUPERCART_LARGE: {
|
||||
uint maxbank = cartridge_size / 16384;
|
||||
if(address >= 32768 && address < 49152 && cartridge_GetBank(data) < maxbank /*9*/) {
|
||||
cartridge_StoreBank(data + 1);
|
||||
}
|
||||
} break;
|
||||
case CARTRIDGE_TYPE_ABSOLUTE:
|
||||
if(address == 32768 && (data == 1 || data == 2)) {
|
||||
cartridge_StoreBank(data - 1);
|
||||
}
|
||||
break;
|
||||
case CARTRIDGE_TYPE_ACTIVISION:
|
||||
if(address >= 65408) {
|
||||
cartridge_StoreBank(address & 7);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
#if 0 // WIi: Moved to Memory.cpp
|
||||
if(cartridge_pokey && address >= 0x4000 && address <= 0x400f) {
|
||||
switch(address) {
|
||||
case POKEY_AUDF1:
|
||||
pokey_SetRegister(POKEY_AUDF1, data);
|
||||
break;
|
||||
case POKEY_AUDC1:
|
||||
pokey_SetRegister(POKEY_AUDC1, data);
|
||||
break;
|
||||
case POKEY_AUDF2:
|
||||
pokey_SetRegister(POKEY_AUDF2, data);
|
||||
break;
|
||||
case POKEY_AUDC2:
|
||||
pokey_SetRegister(POKEY_AUDC2, data);
|
||||
break;
|
||||
case POKEY_AUDF3:
|
||||
pokey_SetRegister(POKEY_AUDF3, data);
|
||||
break;
|
||||
case POKEY_AUDC3:
|
||||
pokey_SetRegister(POKEY_AUDC3, data);
|
||||
break;
|
||||
case POKEY_AUDF4:
|
||||
pokey_SetRegister(POKEY_AUDF4, data);
|
||||
break;
|
||||
case POKEY_AUDC4:
|
||||
pokey_SetRegister(POKEY_AUDC4, data);
|
||||
break;
|
||||
case POKEY_AUDCTL:
|
||||
pokey_SetRegister(POKEY_AUDCTL, data);
|
||||
break;
|
||||
case POKEY_SKCTLS:
|
||||
pokey_SetRegister(POKEY_SKCTLS, data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// StoreBank
|
||||
// ----------------------------------------------------------------------------
|
||||
void cartridge_StoreBank(byte bank) {
|
||||
switch(cartridge_type) {
|
||||
case CARTRIDGE_TYPE_SUPERCART:
|
||||
cartridge_WriteBank(32768, bank);
|
||||
break;
|
||||
case CARTRIDGE_TYPE_SUPERCART_RAM:
|
||||
cartridge_WriteBank(32768, bank);
|
||||
break;
|
||||
case CARTRIDGE_TYPE_SUPERCART_ROM:
|
||||
cartridge_WriteBank(32768, bank);
|
||||
break;
|
||||
case CARTRIDGE_TYPE_SUPERCART_LARGE:
|
||||
cartridge_WriteBank(32768, bank);
|
||||
break;
|
||||
case CARTRIDGE_TYPE_ABSOLUTE:
|
||||
cartridge_WriteBank(16384, bank);
|
||||
break;
|
||||
case CARTRIDGE_TYPE_ACTIVISION:
|
||||
cartridge_WriteBank(40960, bank);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// IsLoaded
|
||||
// ----------------------------------------------------------------------------
|
||||
bool cartridge_IsLoaded( ) {
|
||||
return (cartridge_buffer != NULL)? true: false;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Release
|
||||
// ----------------------------------------------------------------------------
|
||||
void cartridge_Release( ) {
|
||||
if(cartridge_buffer != NULL) {
|
||||
delete [ ] cartridge_buffer;
|
||||
cartridge_size = 0;
|
||||
cartridge_buffer = NULL;
|
||||
cartridge_title = "";
|
||||
cartridge_type = 0;
|
||||
cartridge_region = 0;
|
||||
cartridge_pokey = 0;
|
||||
cartridge_pokey450 = 0;
|
||||
cartridge_xm = false;
|
||||
// Default to joysticks
|
||||
memset( cartridge_controller, 1, sizeof( cartridge_controller ) );
|
||||
cartridge_bank = 0;
|
||||
cartridge_flags = 0;
|
||||
cartridge_disable_bios = false;
|
||||
cartridge_crosshair_x = 0;
|
||||
cartridge_crosshair_y = 0;
|
||||
cartridge_hblank = HBLANK_DEFAULT;
|
||||
cartridge_dualanalog = false;
|
||||
cartridge_left_switch = 1;
|
||||
cartridge_right_switch = 0;
|
||||
cartridge_swap_buttons = false;
|
||||
cartridge_hsc_enabled = false;
|
||||
}
|
||||
}
|
||||
-204
@@ -1,204 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Common.cpp
|
||||
// ----------------------------------------------------------------------------
|
||||
#include "Common.h"
|
||||
|
||||
std::string common_defaultPath;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Format
|
||||
// ----------------------------------------------------------------------------
|
||||
std::string common_Format(double value) {
|
||||
return common_Format(value, "%f");
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Format
|
||||
// ----------------------------------------------------------------------------
|
||||
std::string common_Format(double value, std::string specification) {
|
||||
char buffer[17] = {0};
|
||||
sprintf(buffer, specification.c_str( ), value);
|
||||
return std::string(buffer);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Format
|
||||
// ----------------------------------------------------------------------------
|
||||
std::string common_Format(uint value) {
|
||||
char buffer[11] = {0};
|
||||
sprintf(buffer, "%d", value);
|
||||
return std::string(buffer);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Format
|
||||
// ----------------------------------------------------------------------------
|
||||
std::string common_Format(word value) {
|
||||
char buffer[6] = {0};
|
||||
sprintf(buffer, "%d", value);
|
||||
return std::string(buffer);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Format
|
||||
// ----------------------------------------------------------------------------
|
||||
std::string common_Format(byte value) {
|
||||
char buffer[4] = {0};
|
||||
sprintf(buffer, "%d", value);
|
||||
return std::string(buffer);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Format
|
||||
// ----------------------------------------------------------------------------
|
||||
std::string common_Format(bool value) {
|
||||
return (value)? "true": "false";
|
||||
}
|
||||
# if 0
|
||||
// ----------------------------------------------------------------------------
|
||||
// Format
|
||||
// ----------------------------------------------------------------------------
|
||||
std::string common_Format(HRESULT result) {
|
||||
char buffer[10] = {0};
|
||||
sprintf(buffer, "%#8x", result);
|
||||
return std::string(buffer);
|
||||
}
|
||||
# endif
|
||||
// ----------------------------------------------------------------------------
|
||||
// ParseUint
|
||||
// ----------------------------------------------------------------------------
|
||||
uint common_ParseUint(std::string text) {
|
||||
return (uint)atoi(text.c_str( ));
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ParseInt
|
||||
// ----------------------------------------------------------------------------
|
||||
int common_ParseInt(std::string text) {
|
||||
return (int)atoi(text.c_str( ));
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ParseWord
|
||||
// ----------------------------------------------------------------------------
|
||||
word common_ParseWord(std::string text) {
|
||||
return (word)atoi(text.c_str( ));
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ParseByte
|
||||
// ----------------------------------------------------------------------------
|
||||
byte common_ParseByte(std::string text) {
|
||||
return (byte)atoi(text.c_str( ));
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ParseBool
|
||||
// ----------------------------------------------------------------------------
|
||||
bool common_ParseBool(std::string text) {
|
||||
if(text.compare("true") == 0 || text.compare("TRUE") == 0 || text.compare("True") == 0) {
|
||||
return true;
|
||||
}
|
||||
if(atoi(text.c_str( )) == 1) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Trim
|
||||
// ----------------------------------------------------------------------------
|
||||
std::string common_Trim(std::string target) {
|
||||
int index;
|
||||
for(index = target.length( ) - 1; index >= 0; index--) {
|
||||
if(target[index] != 0x20 && target[index] != '\n') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return target.substr(0, index + 1);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Remove
|
||||
// ----------------------------------------------------------------------------
|
||||
std::string common_Remove(std::string target, char value) {
|
||||
target.erase(std::remove(target.begin(), target.end(), value), target.end());
|
||||
return target;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Replace (string, from, to)
|
||||
// ----------------------------------------------------------------------------
|
||||
std::string common_Replace(std::string target, char value1, char value2) {
|
||||
int length = 0;
|
||||
int index;
|
||||
for(index = 0; index < target.size( ); index++) {
|
||||
length++;
|
||||
}
|
||||
|
||||
char* buffer = new char[length + 1];
|
||||
for(index = 0; index < target.size( ); index++) {
|
||||
if(target[index] != value1) {
|
||||
buffer[index] = target[index];
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer[index] = value2;
|
||||
}
|
||||
}
|
||||
|
||||
buffer[length] = 0;
|
||||
std::string source = buffer;
|
||||
delete[ ] buffer;
|
||||
return source;
|
||||
}
|
||||
# if 0
|
||||
// ----------------------------------------------------------------------------
|
||||
// GetErrorMessage
|
||||
// ----------------------------------------------------------------------------
|
||||
std::string common_GetErrorMessage( ) {
|
||||
return common_GetErrorMessage(GetLastError( ));
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// GetErrorMessage
|
||||
// ----------------------------------------------------------------------------
|
||||
std::string common_GetErrorMessage(DWORD error) {
|
||||
void* buffer;
|
||||
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&buffer, 0, NULL);
|
||||
std::string message((char*)buffer);
|
||||
LocalFree(buffer);
|
||||
return message;
|
||||
}
|
||||
# endif
|
||||
// ----------------------------------------------------------------------------
|
||||
// GetExtension
|
||||
// ----------------------------------------------------------------------------
|
||||
std::string common_GetExtension(std::string filename) {
|
||||
int position = filename.rfind('.');
|
||||
if(position != -1) {
|
||||
return filename.substr(position);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Common.h
|
||||
// ----------------------------------------------------------------------------
|
||||
#ifndef COMMON_H
|
||||
#define COMMON_H
|
||||
|
||||
#include <string>
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned short word;
|
||||
typedef unsigned int uint;
|
||||
|
||||
extern std::string common_Format(double value);
|
||||
extern std::string common_Format(double value, std::string specification);
|
||||
extern std::string common_Format(uint value);
|
||||
extern std::string common_Format(word value);
|
||||
extern std::string common_Format(byte value);
|
||||
extern std::string common_Format(bool value);
|
||||
//extern std::string common_Format(HRESULT result);
|
||||
extern std::string common_Trim(std::string target);
|
||||
extern std::string common_Remove(std::string target, char value);
|
||||
extern std::string common_Replace(std::string target, char value1, char value2);
|
||||
extern std::string common_GetErrorMessage( );
|
||||
//extern std::string common_GetErrorMessage(DWORD error);
|
||||
extern std::string common_GetExtension(std::string filename);
|
||||
extern uint common_ParseUint(std::string text);
|
||||
extern int common_ParseInt(std::string text);
|
||||
extern word common_ParseWord(std::string text);
|
||||
extern byte common_ParseByte(std::string text);
|
||||
extern bool common_ParseBool(std::string text);
|
||||
extern std::string common_defaultPath;
|
||||
|
||||
#endif
|
||||
@@ -1,139 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Database.cpp
|
||||
// ----------------------------------------------------------------------------
|
||||
#include "Database.h"
|
||||
#define DATABASE_SOURCE "Database.cpp"
|
||||
|
||||
bool cart_in_db = false;
|
||||
bool database_enabled = true;
|
||||
std::string database_filename;
|
||||
|
||||
static std::string database_GetValue(std::string entry) {
|
||||
int index = entry.rfind('=');
|
||||
return entry.substr(index + 1);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Initialize
|
||||
// ----------------------------------------------------------------------------
|
||||
void database_Initialize( ) {
|
||||
database_filename = common_defaultPath + "ProSystem.dat";
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Load
|
||||
// ----------------------------------------------------------------------------
|
||||
bool database_Load(std::string digest) {
|
||||
cart_in_db = false;
|
||||
if(database_enabled) {
|
||||
logger_LogInfo("Accessing database " + database_filename + ".", DATABASE_SOURCE);
|
||||
|
||||
FILE* file = fopen(database_filename.c_str( ), "r");
|
||||
if(file == NULL) {
|
||||
logger_LogError("Failed to open the database for reading.", DATABASE_SOURCE);
|
||||
return false;
|
||||
}
|
||||
|
||||
// max count of items in the database
|
||||
static int count = 17;
|
||||
|
||||
char buffer[256];
|
||||
while(fgets(buffer, 256, file) != NULL) {
|
||||
std::string line = buffer;
|
||||
if(line.compare(1, 32, digest.c_str( )) == 0) {
|
||||
cart_in_db = true;
|
||||
std::string entry[count];
|
||||
for (int index = 0; index < count; index++) {
|
||||
buffer[0] = '\0';
|
||||
fgets(buffer, 256, file);
|
||||
if (strchr(buffer, '[')) {
|
||||
// Passed the current game in DB
|
||||
break;
|
||||
}
|
||||
entry[index] = common_Remove(buffer, '\n');
|
||||
entry[index] = common_Remove(entry[index], '\r');
|
||||
}
|
||||
|
||||
cartridge_title = database_GetValue(entry[0]);
|
||||
cartridge_type = common_ParseByte(database_GetValue(entry[1]));
|
||||
cartridge_pokey = common_ParseBool(database_GetValue(entry[2]));
|
||||
cartridge_controller[0] = common_ParseByte(database_GetValue(entry[3]));
|
||||
cartridge_controller[1] = common_ParseByte(database_GetValue(entry[4]));
|
||||
cartridge_region = common_ParseByte(database_GetValue(entry[5]));
|
||||
cartridge_flags = common_ParseUint(database_GetValue(entry[6]));
|
||||
|
||||
// Optionally load the lightgun crosshair offsets, hblank, dual analog
|
||||
for(int index = 7; index < count; index++)
|
||||
{
|
||||
if(entry[index].find("crossx") != std::string::npos)
|
||||
{
|
||||
cartridge_crosshair_x = common_ParseInt(database_GetValue(entry[index]));
|
||||
}
|
||||
if(entry[index].find("crossy") != std::string::npos)
|
||||
{
|
||||
cartridge_crosshair_y = common_ParseInt(database_GetValue(entry[index]));
|
||||
}
|
||||
if(entry[index].find("hblank") != std::string::npos)
|
||||
{
|
||||
cartridge_hblank = common_ParseInt(database_GetValue(entry[index]));
|
||||
}
|
||||
if(entry[index].find("dualanalog") != std::string::npos)
|
||||
{
|
||||
cartridge_dualanalog = common_ParseBool(database_GetValue(entry[index]));
|
||||
}
|
||||
if (entry[index].find("pokey450") != std::string::npos) {
|
||||
cartridge_pokey450 = common_ParseBool(database_GetValue(entry[index]));
|
||||
if (cartridge_pokey450) {
|
||||
cartridge_pokey = true;
|
||||
}
|
||||
}
|
||||
if (entry[index].find("xm") != std::string::npos) {
|
||||
cartridge_xm = common_ParseBool(database_GetValue(entry[index]));
|
||||
}
|
||||
if (entry[index].find("disablebios") != std::string::npos) {
|
||||
cartridge_disable_bios = common_ParseBool(database_GetValue(entry[index]));
|
||||
}
|
||||
if (entry[index].find("leftswitch") != std::string::npos) {
|
||||
cartridge_left_switch = common_ParseByte(database_GetValue(entry[index]));
|
||||
}
|
||||
if (entry[index].find("rightswitch") != std::string::npos) {
|
||||
cartridge_right_switch = common_ParseByte(database_GetValue(entry[index]));
|
||||
}
|
||||
if (entry[index].find("swapbuttons") != std::string::npos) {
|
||||
cartridge_swap_buttons = common_ParseBool(database_GetValue(entry[index]));
|
||||
}
|
||||
if (entry[index].find("hsc") != std::string::npos) {
|
||||
cartridge_hsc_enabled = common_ParseBool(database_GetValue(entry[index]));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
fclose(file);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
-235
@@ -1,235 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Hash.cpp
|
||||
// ----------------------------------------------------------------------------
|
||||
#include "Hash.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Step1
|
||||
// ----------------------------------------------------------------------------
|
||||
static uint hash_Step1(uint w, uint x, uint y, uint z, uint data, uint s) {
|
||||
w += (z ^ (x & (y ^ z))) + data;
|
||||
w = w << s | w >> (32 - s);
|
||||
w += x;
|
||||
return w;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Step2
|
||||
// ----------------------------------------------------------------------------
|
||||
static uint hash_Step2(uint w, uint x, uint y, uint z, uint data, uint s) {
|
||||
w += (y ^ (z & (x ^ y))) + data;
|
||||
w = w << s | w >> (32 - s);
|
||||
w += x;
|
||||
return w;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Step3
|
||||
// ----------------------------------------------------------------------------
|
||||
static uint hash_Step3(uint w, uint x, uint y, uint z, uint data, uint s) {
|
||||
w += (x ^ y ^ z) + data;
|
||||
w = w << s | w >> (32 - s);
|
||||
w += x;
|
||||
return w;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Step4
|
||||
// ----------------------------------------------------------------------------
|
||||
static uint hash_Step4(uint w, uint x, uint y, uint z, uint data, uint s) {
|
||||
w += (y ^ (x | ~z)) + data;
|
||||
w = w << s | w >> (32 - s);
|
||||
w += x;
|
||||
return w;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Transform
|
||||
// ----------------------------------------------------------------------------
|
||||
static void hash_Transform(uint out[4], uint in[16]) {
|
||||
uint a, b, c, d;
|
||||
|
||||
a = out[0];
|
||||
b = out[1];
|
||||
c = out[2];
|
||||
d = out[3];
|
||||
|
||||
a = hash_Step1(a, b, c, d, in[0] + 0xd76aa478, 7);
|
||||
d = hash_Step1(d, a, b, c, in[1] + 0xe8c7b756, 12);
|
||||
c = hash_Step1(c, d, a, b, in[2] + 0x242070db, 17);
|
||||
b = hash_Step1(b, c, d, a, in[3] + 0xc1bdceee, 22);
|
||||
a = hash_Step1(a, b, c, d, in[4] + 0xf57c0faf, 7);
|
||||
d = hash_Step1(d, a, b, c, in[5] + 0x4787c62a, 12);
|
||||
c = hash_Step1(c, d, a, b, in[6] + 0xa8304613, 17);
|
||||
b = hash_Step1(b, c, d, a, in[7] + 0xfd469501, 22);
|
||||
a = hash_Step1(a, b, c, d, in[8] + 0x698098d8, 7);
|
||||
d = hash_Step1(d, a, b, c, in[9] + 0x8b44f7af, 12);
|
||||
c = hash_Step1(c, d, a, b, in[10] + 0xffff5bb1, 17);
|
||||
b = hash_Step1(b, c, d, a, in[11] + 0x895cd7be, 22);
|
||||
a = hash_Step1(a, b, c, d, in[12] + 0x6b901122, 7);
|
||||
d = hash_Step1(d, a, b, c, in[13] + 0xfd987193, 12);
|
||||
c = hash_Step1(c, d, a, b, in[14] + 0xa679438e, 17);
|
||||
b = hash_Step1(b, c, d, a, in[15] + 0x49b40821, 22);
|
||||
|
||||
a = hash_Step2(a, b, c, d, in[1] + 0xf61e2562, 5);
|
||||
d = hash_Step2(d, a, b, c, in[6] + 0xc040b340, 9);
|
||||
c = hash_Step2(c, d, a, b, in[11] + 0x265e5a51, 14);
|
||||
b = hash_Step2(b, c, d, a, in[0] + 0xe9b6c7aa, 20);
|
||||
a = hash_Step2(a, b, c, d, in[5] + 0xd62f105d, 5);
|
||||
d = hash_Step2(d, a, b, c, in[10] + 0x02441453, 9);
|
||||
c = hash_Step2(c, d, a, b, in[15] + 0xd8a1e681, 14);
|
||||
b = hash_Step2(b, c, d, a, in[4] + 0xe7d3fbc8, 20);
|
||||
a = hash_Step2(a, b, c, d, in[9] + 0x21e1cde6, 5);
|
||||
d = hash_Step2(d, a, b, c, in[14] + 0xc33707d6, 9);
|
||||
c = hash_Step2(c, d, a, b, in[3] + 0xf4d50d87, 14);
|
||||
b = hash_Step2(b, c, d, a, in[8] + 0x455a14ed, 20);
|
||||
a = hash_Step2(a, b, c, d, in[13] + 0xa9e3e905, 5);
|
||||
d = hash_Step2(d, a, b, c, in[2] + 0xfcefa3f8, 9);
|
||||
c = hash_Step2(c, d, a, b, in[7] + 0x676f02d9, 14);
|
||||
b = hash_Step2(b, c, d, a, in[12] + 0x8d2a4c8a, 20);
|
||||
|
||||
a = hash_Step3(a, b, c, d, in[5] + 0xfffa3942, 4);
|
||||
d = hash_Step3(d, a, b, c, in[8] + 0x8771f681, 11);
|
||||
c = hash_Step3(c, d, a, b, in[11] + 0x6d9d6122, 16);
|
||||
b = hash_Step3(b, c, d, a, in[14] + 0xfde5380c, 23);
|
||||
a = hash_Step3(a, b, c, d, in[1] + 0xa4beea44, 4);
|
||||
d = hash_Step3(d, a, b, c, in[4] + 0x4bdecfa9, 11);
|
||||
c = hash_Step3(c, d, a, b, in[7] + 0xf6bb4b60, 16);
|
||||
b = hash_Step3(b, c, d, a, in[10] + 0xbebfbc70, 23);
|
||||
a = hash_Step3(a, b, c, d, in[13] + 0x289b7ec6, 4);
|
||||
d = hash_Step3(d, a, b, c, in[0] + 0xeaa127fa, 11);
|
||||
c = hash_Step3(c, d, a, b, in[3] + 0xd4ef3085, 16);
|
||||
b = hash_Step3(b, c, d, a, in[6] + 0x04881d05, 23);
|
||||
a = hash_Step3(a, b, c, d, in[9] + 0xd9d4d039, 4);
|
||||
d = hash_Step3(d, a, b, c, in[12] + 0xe6db99e5, 11);
|
||||
c = hash_Step3(c, d, a, b, in[15] + 0x1fa27cf8, 16);
|
||||
b = hash_Step3(b, c, d, a, in[2] + 0xc4ac5665, 23);
|
||||
|
||||
a = hash_Step4(a, b, c, d, in[0] + 0xf4292244, 6);
|
||||
d = hash_Step4(d, a, b, c, in[7] + 0x432aff97, 10);
|
||||
c = hash_Step4(c, d, a, b, in[14] + 0xab9423a7, 15);
|
||||
b = hash_Step4(b, c, d, a, in[5] + 0xfc93a039, 21);
|
||||
a = hash_Step4(a, b, c, d, in[12] + 0x655b59c3, 6);
|
||||
d = hash_Step4(d, a, b, c, in[3] + 0x8f0ccc92, 10);
|
||||
c = hash_Step4(c, d, a, b, in[10] + 0xffeff47d, 15);
|
||||
b = hash_Step4(b, c, d, a, in[1] + 0x85845dd1, 21);
|
||||
a = hash_Step4(a, b, c, d, in[8] + 0x6fa87e4f, 6);
|
||||
d = hash_Step4(d, a, b, c, in[15] + 0xfe2ce6e0, 10);
|
||||
c = hash_Step4(c, d, a, b, in[6] + 0xa3014314, 15);
|
||||
b = hash_Step4(b, c, d, a, in[13] + 0x4e0811a1, 21);
|
||||
a = hash_Step4(a, b, c, d, in[4] + 0xf7537e82, 6);
|
||||
d = hash_Step4(d, a, b, c, in[11] + 0xbd3af235, 10);
|
||||
c = hash_Step4(c, d, a, b, in[2] + 0x2ad7d2bb, 15);
|
||||
b = hash_Step4(b, c, d, a, in[9] + 0xeb86d391, 21);
|
||||
|
||||
out[0] += a;
|
||||
out[1] += b;
|
||||
out[2] += c;
|
||||
out[3] += d;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Compute
|
||||
// ----------------------------------------------------------------------------
|
||||
std::string hash_Compute(const byte* source, uint length) {
|
||||
uint buffer1[4] = {0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476};
|
||||
uint buffer2[2] = {0};
|
||||
byte buffer3[64] = {0};
|
||||
|
||||
uint temp = buffer2[0];
|
||||
if((buffer2[0] = temp + ((uint)length << 3)) < temp) {
|
||||
buffer2[1]++;
|
||||
}
|
||||
buffer2[1] += length >> 29;
|
||||
|
||||
temp = (temp >> 3) & 0x3f;
|
||||
if(temp) {
|
||||
byte* ptr = (byte*)buffer3 + temp;
|
||||
temp = 64 - temp;
|
||||
if(length < temp) {
|
||||
for(uint index = 0; index < length; index++) {
|
||||
ptr[index] = source[index];
|
||||
}
|
||||
}
|
||||
|
||||
for(uint index = 0; index < temp; index++) {
|
||||
ptr[index] = source[index];
|
||||
}
|
||||
|
||||
hash_Transform(buffer1, (uint*)buffer3);
|
||||
source += temp;
|
||||
length -= temp;
|
||||
}
|
||||
|
||||
while(length >= 64) {
|
||||
for(uint index = 0; index < 64; index++) {
|
||||
buffer3[index] = source[index];
|
||||
}
|
||||
hash_Transform(buffer1, (uint*)buffer3);
|
||||
source += 64;
|
||||
length -= 64;
|
||||
}
|
||||
|
||||
for(uint index = 0; index < length; index++) {
|
||||
buffer3[index] = source[index];
|
||||
}
|
||||
|
||||
uint count = (buffer2[0] >> 3) & 0x3f;
|
||||
byte* ptr = buffer3 + count;
|
||||
*ptr++ = 0x80;
|
||||
|
||||
count = 63 - count;
|
||||
|
||||
if(count < 8) {
|
||||
for(uint index = 0; index < count; index++) {
|
||||
ptr[index] = 0;
|
||||
}
|
||||
hash_Transform(buffer1, (uint*)buffer3);
|
||||
|
||||
for(uint index = 0; index < 56; index++) {
|
||||
buffer3[index] = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for(uint index = 0; index < count - 8; index++) {
|
||||
ptr[index] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
((uint*)buffer3)[14] = buffer2[0];
|
||||
((uint*)buffer3)[15] = buffer2[1];
|
||||
|
||||
hash_Transform(buffer1, (uint*)buffer3);
|
||||
|
||||
byte digest[16];
|
||||
byte* bufferptr = (byte*)buffer1;
|
||||
for(uint index = 0; index < 16; index++) {
|
||||
digest[index] = bufferptr[index];
|
||||
}
|
||||
|
||||
char buffer[33] = {0};
|
||||
sprintf(buffer, "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", digest[0], digest[1], digest[2], digest[3], digest[4], digest[5], digest[6], digest[7], digest[8], digest[9], digest[10], digest[11], digest[12], digest[13], digest[14], digest[15]);
|
||||
return std::string(buffer);
|
||||
}
|
||||
|
||||
-36
@@ -1,36 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Hash.h
|
||||
// ----------------------------------------------------------------------------
|
||||
#ifndef HASH_H
|
||||
#define HASH_H
|
||||
|
||||
#include <string>
|
||||
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned short word;
|
||||
typedef unsigned int uint;
|
||||
|
||||
extern std::string hash_Compute(const byte* source, uint length);
|
||||
|
||||
#endif
|
||||
-164
@@ -1,164 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Logger.cpp
|
||||
// ----------------------------------------------------------------------------
|
||||
#include "Logger.h"
|
||||
#define LOGGER_FILENAME "ProSystem.log"
|
||||
#include <iostream>
|
||||
|
||||
byte logger_level = LOGGER_LEVEL_DEBUG;
|
||||
static FILE* logger_file = NULL;
|
||||
char a[255]="";
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// GetTime
|
||||
// ----------------------------------------------------------------------------
|
||||
static std::string logger_GetTime( ) {
|
||||
time_t current;
|
||||
time(¤t);
|
||||
std::string timestring = ctime(¤t);
|
||||
return timestring.erase(timestring.find_first_of("\n"), 1);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Log
|
||||
// ----------------------------------------------------------------------------
|
||||
static void logger_Log(std::string message, byte level, std::string source) {
|
||||
if(logger_file != NULL) {
|
||||
std::string entry = "[" + logger_GetTime( ) + "]";
|
||||
switch(level) {
|
||||
case LOGGER_LEVEL_ERROR:
|
||||
entry += "[ERROR]";
|
||||
break;
|
||||
case LOGGER_LEVEL_INFO:
|
||||
entry += "[INFO ]";
|
||||
break;
|
||||
default:
|
||||
entry += "[DEBUG]";
|
||||
break;
|
||||
}
|
||||
entry += " " + message;
|
||||
if(source.length( ) > 0) {
|
||||
entry += " " + source;
|
||||
}
|
||||
entry += "\n";
|
||||
fwrite(entry.c_str( ), 1, entry.length( ), logger_file);
|
||||
fflush(logger_file);
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Initialize
|
||||
// ----------------------------------------------------------------------------
|
||||
bool logger_Initialize( ) {
|
||||
logger_file = fopen(LOGGER_FILENAME, "w");
|
||||
return (logger_file != NULL);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Initialize
|
||||
// ----------------------------------------------------------------------------
|
||||
bool logger_Initialize(std::string filename) {
|
||||
logger_file = fopen(filename.c_str( ), "w");
|
||||
return (logger_file != NULL);
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// LogError //////////
|
||||
// ----------------------------------------------------------------------------
|
||||
void logger_LogError(int message, std::string source) {
|
||||
std::cerr << message << source << std::endl;
|
||||
if(logger_level == LOGGER_LEVEL_ERROR || logger_level == LOGGER_LEVEL_INFO || logger_level == LOGGER_LEVEL_DEBUG) {
|
||||
// LoadString(GetModuleHandle(NULL),message, a, 180);
|
||||
// std::string b(a);
|
||||
// logger_Log(b, LOGGER_LEVEL_ERROR, source);
|
||||
logger_LogError(message, "");
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// LogError
|
||||
// ----------------------------------------------------------------------------
|
||||
void logger_LogError(std::string message, std::string source) {
|
||||
std::cerr << message << source << std::endl;
|
||||
if(logger_level == LOGGER_LEVEL_ERROR || logger_level == LOGGER_LEVEL_INFO || logger_level == LOGGER_LEVEL_DEBUG) {
|
||||
logger_Log(message, LOGGER_LEVEL_ERROR, source);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// LogInfo
|
||||
// ----------------------------------------------------------------------------
|
||||
void logger_LogInfo(int message, std::string source) {
|
||||
std::cerr << message << source << std::endl;
|
||||
if(logger_level == LOGGER_LEVEL_INFO || logger_level == LOGGER_LEVEL_DEBUG) {
|
||||
// LoadString(GetModuleHandle(NULL),message, a, 180);
|
||||
// std::string b(a);
|
||||
// logger_Log(b, LOGGER_LEVEL_INFO, source);
|
||||
logger_LogDebug(message, "");
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// LogInfo /////////
|
||||
// ----------------------------------------------------------------------------
|
||||
void logger_LogInfo(std::string message, std::string source) {
|
||||
std::cerr << message << source << std::endl;
|
||||
if(logger_level == LOGGER_LEVEL_INFO || logger_level == LOGGER_LEVEL_DEBUG) {
|
||||
logger_Log(message, LOGGER_LEVEL_INFO, source);
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// LogDebug ////////////
|
||||
// ----------------------------------------------------------------------------
|
||||
void logger_LogDebug(int message, std::string source) {
|
||||
std::cerr << message << source << std::endl;
|
||||
if(logger_level == LOGGER_LEVEL_DEBUG) {
|
||||
// LoadString(GetModuleHandle(NULL),message, a, 180);
|
||||
// std::string b(a);
|
||||
// logger_Log(b, LOGGER_LEVEL_DEBUG, source);
|
||||
logger_LogDebug(message, "");
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// LogDebug
|
||||
// ----------------------------------------------------------------------------
|
||||
void logger_LogDebug(std::string message, std::string source) {
|
||||
std::cerr << message << source << std::endl;
|
||||
if(logger_level == LOGGER_LEVEL_DEBUG) {
|
||||
logger_Log(message, LOGGER_LEVEL_DEBUG, source);
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Release
|
||||
// ----------------------------------------------------------------------------
|
||||
void logger_Release( ) {
|
||||
if(logger_file != NULL) {
|
||||
fclose(logger_file);
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Logger.h
|
||||
// ----------------------------------------------------------------------------
|
||||
#ifndef LOGGER_H
|
||||
#define LOGGER_H
|
||||
#define LOGGER_LEVEL_DEBUG 0
|
||||
#define LOGGER_LEVEL_INFO 1
|
||||
#define LOGGER_LEVEL_ERROR 2
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
#include <time.h>
|
||||
//#include "Windows.h"
|
||||
//#include "Resource.h"
|
||||
|
||||
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned short word;
|
||||
typedef unsigned int uint;
|
||||
|
||||
extern bool logger_Initialize( );
|
||||
extern bool logger_Initialize(std::string filename);
|
||||
extern void logger_LogError(std::string message, std::string source);
|
||||
extern void logger_LogError(int message, std::string source);
|
||||
extern void logger_LogInfo(std::string message, std::string source);
|
||||
extern void logger_LogInfo(int message, std::string source);
|
||||
extern void logger_LogDebug(std::string message, std::string source);
|
||||
extern void logger_LogDebug(int, std::string source);
|
||||
extern void logger_Release( );
|
||||
extern byte logger_level;
|
||||
|
||||
#endif
|
||||
-352
@@ -1,352 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Maria.c
|
||||
// ----------------------------------------------------------------------------
|
||||
#include "Maria.h"
|
||||
#define MARIA_LINERAM_SIZE 160
|
||||
|
||||
rect maria_displayArea = {0, 16, 319, 258};
|
||||
rect maria_visibleArea = {0, 26, 319, 248};
|
||||
byte maria_surface[MARIA_SURFACE_SIZE] = {0};
|
||||
word maria_scanline = 1;
|
||||
|
||||
static byte maria_lineRAM[MARIA_LINERAM_SIZE];
|
||||
static uint maria_cycles;
|
||||
static pair maria_dpp;
|
||||
static pair maria_dp;
|
||||
static pair maria_pp;
|
||||
static byte maria_horizontal;
|
||||
static byte maria_palette;
|
||||
static signed char maria_offset;
|
||||
static byte maria_h08;
|
||||
static byte maria_h16;
|
||||
static byte maria_wmode;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// StoreCell
|
||||
// ----------------------------------------------------------------------------
|
||||
static inline void maria_StoreCell(byte data) {
|
||||
if(maria_horizontal < MARIA_LINERAM_SIZE) {
|
||||
if(data) {
|
||||
maria_lineRAM[maria_horizontal] = maria_palette | data;
|
||||
}
|
||||
else {
|
||||
byte kmode = memory_ram[CTRL] & 4;
|
||||
if(kmode) {
|
||||
maria_lineRAM[maria_horizontal] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
maria_horizontal++;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// StoreCell
|
||||
// ----------------------------------------------------------------------------
|
||||
static inline void maria_StoreCell(byte high, byte low) {
|
||||
if(maria_horizontal < MARIA_LINERAM_SIZE) {
|
||||
if(low || high) {
|
||||
maria_lineRAM[maria_horizontal] = (maria_palette & 16) | high | low;
|
||||
}
|
||||
else {
|
||||
byte kmode = memory_ram[CTRL] & 4;
|
||||
if(kmode) {
|
||||
maria_lineRAM[maria_horizontal] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
maria_horizontal++;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// IsHolyDMA
|
||||
// ----------------------------------------------------------------------------
|
||||
static inline bool maria_IsHolyDMA( ) {
|
||||
if(maria_pp.w > 32767) {
|
||||
if(maria_h16 && (maria_pp.w & 4096)) {
|
||||
return true;
|
||||
}
|
||||
if(maria_h08 && (maria_pp.w & 2048)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// GetColor
|
||||
// ----------------------------------------------------------------------------
|
||||
static inline byte maria_GetColor(byte data) {
|
||||
if(data & 3) {
|
||||
return memory_ram[BACKGRND + data];
|
||||
}
|
||||
else {
|
||||
return memory_ram[BACKGRND];
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// StoreGraphic
|
||||
// ----------------------------------------------------------------------------
|
||||
static inline void maria_StoreGraphic( ) {
|
||||
byte data = memory_ram[maria_pp.w];
|
||||
if(maria_wmode) {
|
||||
if(maria_IsHolyDMA( )) {
|
||||
#if 0 // Wii: disabled due to rendering in Kangaroo mode
|
||||
maria_StoreCell(0, 0);
|
||||
maria_StoreCell(0, 0);
|
||||
#endif
|
||||
maria_horizontal+=2;
|
||||
}
|
||||
else {
|
||||
maria_StoreCell((data & 12), (data & 192) >> 6);
|
||||
maria_StoreCell((data & 48) >> 4, (data & 3) << 2);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(maria_IsHolyDMA( )) {
|
||||
#if 0 // Wii: disabled due to rendering in Kangaroo mode
|
||||
maria_StoreCell(0);
|
||||
maria_StoreCell(0);
|
||||
maria_StoreCell(0);
|
||||
maria_StoreCell(0);
|
||||
#endif
|
||||
maria_horizontal+=4;
|
||||
}
|
||||
else {
|
||||
maria_StoreCell((data & 192) >> 6);
|
||||
maria_StoreCell((data & 48) >> 4);
|
||||
maria_StoreCell((data & 12) >> 2);
|
||||
maria_StoreCell(data & 3);
|
||||
}
|
||||
}
|
||||
maria_pp.w++;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// WriteLineRAM
|
||||
// ----------------------------------------------------------------------------
|
||||
static inline void maria_WriteLineRAM(byte* buffer) {
|
||||
byte rmode = memory_ram[CTRL] & 3;
|
||||
if(rmode == 0) {
|
||||
// 160A/B
|
||||
int pixel = 0;
|
||||
for(int index = 0; index < MARIA_LINERAM_SIZE; index += 4) {
|
||||
word color;
|
||||
color = maria_GetColor(maria_lineRAM[index + 0]);
|
||||
buffer[pixel++] = color;
|
||||
buffer[pixel++] = color;
|
||||
color = maria_GetColor(maria_lineRAM[index + 1]);
|
||||
buffer[pixel++] = color;
|
||||
buffer[pixel++] = color;
|
||||
color = maria_GetColor(maria_lineRAM[index + 2]);
|
||||
buffer[pixel++] = color;
|
||||
buffer[pixel++] = color;
|
||||
color = maria_GetColor(maria_lineRAM[index + 3]);
|
||||
buffer[pixel++] = color;
|
||||
buffer[pixel++] = color;
|
||||
}
|
||||
}
|
||||
else if(rmode == 2) {
|
||||
// 320B/D
|
||||
int pixel = 0;
|
||||
for(int index = 0; index < MARIA_LINERAM_SIZE; index += 4) {
|
||||
buffer[pixel++] = maria_GetColor((maria_lineRAM[index + 0] & 16) | ((maria_lineRAM[index + 0] & 8) >> 3) | ((maria_lineRAM[index + 0] & 2)));
|
||||
buffer[pixel++] = maria_GetColor((maria_lineRAM[index + 0] & 16) | ((maria_lineRAM[index + 0] & 4) >> 2) | ((maria_lineRAM[index + 0] & 1) << 1));
|
||||
buffer[pixel++] = maria_GetColor((maria_lineRAM[index + 1] & 16) | ((maria_lineRAM[index + 1] & 8) >> 3) | ((maria_lineRAM[index + 1] & 2)));
|
||||
buffer[pixel++] = maria_GetColor((maria_lineRAM[index + 1] & 16) | ((maria_lineRAM[index + 1] & 4) >> 2) | ((maria_lineRAM[index + 1] & 1) << 1));
|
||||
buffer[pixel++] = maria_GetColor((maria_lineRAM[index + 2] & 16) | ((maria_lineRAM[index + 2] & 8) >> 3) | ((maria_lineRAM[index + 2] & 2)));
|
||||
buffer[pixel++] = maria_GetColor((maria_lineRAM[index + 2] & 16) | ((maria_lineRAM[index + 2] & 4) >> 2) | ((maria_lineRAM[index + 2] & 1) << 1));
|
||||
buffer[pixel++] = maria_GetColor((maria_lineRAM[index + 3] & 16) | ((maria_lineRAM[index + 3] & 8) >> 3) | ((maria_lineRAM[index + 3] & 2)));
|
||||
buffer[pixel++] = maria_GetColor((maria_lineRAM[index + 3] & 16) | ((maria_lineRAM[index + 3] & 4) >> 2) | ((maria_lineRAM[index + 3] & 1) << 1));
|
||||
}
|
||||
}
|
||||
else if(rmode == 3) {
|
||||
// 320A/C
|
||||
int pixel = 0;
|
||||
for(int index = 0; index < MARIA_LINERAM_SIZE; index += 4) {
|
||||
buffer[pixel++] = maria_GetColor((maria_lineRAM[index + 0] & 30));
|
||||
buffer[pixel++] = maria_GetColor((maria_lineRAM[index + 0] & 28) | ((maria_lineRAM[index + 0] & 1) << 1));
|
||||
buffer[pixel++] = maria_GetColor((maria_lineRAM[index + 1] & 30));
|
||||
buffer[pixel++] = maria_GetColor((maria_lineRAM[index + 1] & 28) | ((maria_lineRAM[index + 1] & 1) << 1));
|
||||
buffer[pixel++] = maria_GetColor((maria_lineRAM[index + 2] & 30));
|
||||
buffer[pixel++] = maria_GetColor((maria_lineRAM[index + 2] & 28) | ((maria_lineRAM[index + 2] & 1) << 1));
|
||||
buffer[pixel++] = maria_GetColor((maria_lineRAM[index + 3] & 30));
|
||||
buffer[pixel++] = maria_GetColor((maria_lineRAM[index + 3] & 28) | ((maria_lineRAM[index + 3] & 1) << 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// StoreLineRAM
|
||||
// ----------------------------------------------------------------------------
|
||||
static inline void maria_StoreLineRAM( ) {
|
||||
for(int index = 0; index < MARIA_LINERAM_SIZE; index++) {
|
||||
maria_lineRAM[index] = 0;
|
||||
}
|
||||
|
||||
byte mode = memory_ram[maria_dp.w + 1];
|
||||
while(mode & 0x5f) {
|
||||
byte width;
|
||||
byte indirect = 0;
|
||||
|
||||
maria_pp.b.l = memory_ram[maria_dp.w];
|
||||
maria_pp.b.h = memory_ram[maria_dp.w + 2];
|
||||
|
||||
if(mode & 31) {
|
||||
maria_cycles += 8; // Maria cycles (Header 4 byte)
|
||||
maria_palette = (memory_ram[maria_dp.w + 1] & 224) >> 3;
|
||||
maria_horizontal = memory_ram[maria_dp.w + 3];
|
||||
width = memory_ram[maria_dp.w + 1] & 31;
|
||||
width = ((~width) & 31) + 1;
|
||||
maria_dp.w += 4;
|
||||
}
|
||||
else {
|
||||
maria_cycles += 12; // Maria cycles (Header 5 byte)
|
||||
maria_palette = (memory_ram[maria_dp.w + 3] & 224) >> 3;
|
||||
maria_horizontal = memory_ram[maria_dp.w + 4];
|
||||
indirect = memory_ram[maria_dp.w + 1] & 32;
|
||||
maria_wmode = memory_ram[maria_dp.w + 1] & 128;
|
||||
width = memory_ram[maria_dp.w + 3] & 31;
|
||||
width = (width == 0)? 32: ((~width) & 31) + 1;
|
||||
maria_dp.w += 5;
|
||||
}
|
||||
|
||||
if(!indirect) {
|
||||
maria_pp.b.h += maria_offset;
|
||||
for(int index = 0; index < width; index++) {
|
||||
maria_cycles += 3; // Maria cycles (Direct graphic read)
|
||||
maria_StoreGraphic( );
|
||||
}
|
||||
}
|
||||
else {
|
||||
byte cwidth = memory_ram[CTRL] & 16;
|
||||
pair basePP = maria_pp;
|
||||
for(int index = 0; index < width; index++) {
|
||||
maria_cycles += 3; // Maria cycles (Indirect)
|
||||
maria_pp.b.l = memory_ram[basePP.w++];
|
||||
maria_pp.b.h = memory_ram[CHARBASE] + maria_offset;
|
||||
maria_cycles += 3; // Maria cycles (Indirect, 1 byte)
|
||||
maria_StoreGraphic( );
|
||||
if(cwidth) {
|
||||
maria_cycles += 3; // Maria cycles (Indirect, 2 bytes)
|
||||
maria_StoreGraphic( );
|
||||
}
|
||||
}
|
||||
}
|
||||
mode = memory_ram[maria_dp.w + 1];
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Reset
|
||||
// ----------------------------------------------------------------------------
|
||||
void maria_Reset( ) {
|
||||
maria_scanline = 1;
|
||||
for(int index = 0; index < MARIA_SURFACE_SIZE; index++) {
|
||||
maria_surface[index] = 0;
|
||||
}
|
||||
|
||||
maria_cycles = 0;
|
||||
maria_dpp.w = 0;
|
||||
maria_dp.w = 0;
|
||||
maria_pp.w = 0;
|
||||
maria_horizontal = 0;
|
||||
maria_palette = 0;
|
||||
maria_offset = 0;
|
||||
maria_h08 = 0;
|
||||
maria_h16 = 0;
|
||||
maria_wmode = 0;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// RenderScanline
|
||||
// ----------------------------------------------------------------------------
|
||||
uint maria_RenderScanline( ) {
|
||||
maria_cycles = 0;
|
||||
|
||||
// lightgun flash
|
||||
// Displays the background color when Maria is disabled (if applicable)
|
||||
if( ( ( memory_ram[CTRL] & 96 ) != 64 ) &&
|
||||
maria_scanline >= maria_visibleArea.top &&
|
||||
maria_scanline <= maria_visibleArea.bottom ) {
|
||||
byte bgcolor = maria_GetColor(0);
|
||||
byte *bgstart = maria_surface + ((maria_scanline - maria_displayArea.top) * maria_displayArea.GetLength());
|
||||
for(uint index = 0; index < MARIA_LINERAM_SIZE; index++ ) {
|
||||
*bgstart++ = bgcolor;
|
||||
*bgstart++ = bgcolor;
|
||||
}
|
||||
}
|
||||
|
||||
if((memory_ram[CTRL] & 96) == 64 && maria_scanline >= maria_displayArea.top && maria_scanline <= maria_displayArea.bottom) {
|
||||
maria_cycles += 5; // Maria cycles (DMA Startup)
|
||||
if(maria_scanline == maria_displayArea.top) {
|
||||
maria_cycles += 10; // Maria cycles (End of VBLANK)
|
||||
maria_dpp.b.l = memory_ram[DPPL];
|
||||
maria_dpp.b.h = memory_ram[DPPH];
|
||||
maria_h08 = memory_ram[maria_dpp.w] & 32;
|
||||
maria_h16 = memory_ram[maria_dpp.w] & 64;
|
||||
maria_offset = memory_ram[maria_dpp.w] & 15;
|
||||
maria_dp.b.l = memory_ram[maria_dpp.w + 2];
|
||||
maria_dp.b.h = memory_ram[maria_dpp.w + 1];
|
||||
if(memory_ram[maria_dpp.w] & 128) {
|
||||
maria_cycles += 20; // Maria cycles (NMI) /*29, 16, 20*/
|
||||
sally_ExecuteNMI( );
|
||||
}
|
||||
}
|
||||
else if(maria_scanline >= maria_visibleArea.top && maria_scanline <= maria_visibleArea.bottom) {
|
||||
maria_WriteLineRAM(maria_surface + ((maria_scanline - maria_displayArea.top) * maria_displayArea.GetLength( )));
|
||||
}
|
||||
if(maria_scanline != maria_displayArea.bottom) {
|
||||
maria_dp.b.l = memory_ram[maria_dpp.w + 2];
|
||||
maria_dp.b.h = memory_ram[maria_dpp.w + 1];
|
||||
maria_StoreLineRAM( );
|
||||
maria_offset--;
|
||||
if(maria_offset < 0) {
|
||||
maria_cycles += 10; // Maria cycles (Last line of zone) /*20*/
|
||||
maria_dpp.w += 3;
|
||||
maria_h08 = memory_ram[maria_dpp.w] & 32;
|
||||
maria_h16 = memory_ram[maria_dpp.w] & 64;
|
||||
maria_offset = memory_ram[maria_dpp.w] & 15;
|
||||
if(memory_ram[maria_dpp.w] & 128) {
|
||||
maria_cycles += 20; // Maria cycles (NMI) /*29, 16, 20*/
|
||||
sally_ExecuteNMI( );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
maria_cycles += 4; // Maria cycles (Other lines of zone)
|
||||
}
|
||||
}
|
||||
}
|
||||
return maria_cycles;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Clear
|
||||
// ----------------------------------------------------------------------------
|
||||
void maria_Clear( ) {
|
||||
for(int index = 0; index < MARIA_SURFACE_SIZE; index++) {
|
||||
maria_surface[index] = 0;
|
||||
}
|
||||
}
|
||||
-216
@@ -1,216 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Memory.cpp
|
||||
// ----------------------------------------------------------------------------
|
||||
#include "Memory.h"
|
||||
#include "ExpansionModule.h"
|
||||
|
||||
byte memory_ram[MEMORY_SIZE] = {0};
|
||||
byte memory_rom[MEMORY_SIZE] = {0};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Reset
|
||||
// ----------------------------------------------------------------------------
|
||||
void memory_Reset( ) {
|
||||
uint index;
|
||||
for(index = 0; index < MEMORY_SIZE; index++) {
|
||||
memory_ram[index] = 0;
|
||||
memory_rom[index] = 1;
|
||||
}
|
||||
for(index = 0; index < 16384; index++) {
|
||||
memory_rom[index] = 0;
|
||||
}
|
||||
}
|
||||
// ----------------------------------------------------------------------------
|
||||
// Read
|
||||
// ----------------------------------------------------------------------------
|
||||
byte memory_Read(word address) {
|
||||
byte tmp_byte;
|
||||
|
||||
if (cartridge_xm) {
|
||||
if ((address >= 0x0470 && address < 0x0480) ||
|
||||
(xm_pokey_enabled && (address >= 0x0450 && address < 0x0470)) ||
|
||||
(xm_mem_enabled && (address >= 0x4000 && address < 0x8000))) {
|
||||
return xm_Read(address);
|
||||
}
|
||||
}
|
||||
|
||||
if (cartridge_pokey && (
|
||||
(!cartridge_pokey450 && (address >= 0x4000 && address <= 0x400f)) ||
|
||||
(cartridge_pokey450 && (address >= 0x0450 && address < 0x0470)))) {
|
||||
return pokey_GetRegister(
|
||||
cartridge_pokey450 ? 0x4000 + (address - 0x0450) : address);
|
||||
}
|
||||
|
||||
switch ( address ) {
|
||||
case INTIM:
|
||||
case INTIM | 0x2:
|
||||
memory_ram[INTFLG] &= 0x7f;
|
||||
return memory_ram[INTIM];
|
||||
break;
|
||||
case INTFLG:
|
||||
case INTFLG | 0x2:
|
||||
tmp_byte = memory_ram[INTFLG];
|
||||
memory_ram[INTFLG] &= 0x7f;
|
||||
return tmp_byte;
|
||||
break;
|
||||
default:
|
||||
return memory_ram[address];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Write
|
||||
// ----------------------------------------------------------------------------
|
||||
void memory_Write(word address, byte data) {
|
||||
if (cartridge_xm &&
|
||||
((address >= 0x0470 && address < 0x0480) ||
|
||||
((xm_pokey_enabled && (address >= 0x0450 && address < 0x0470)) ||
|
||||
(xm_mem_enabled && (address >= 0x4000 && address < 0x8000))))) {
|
||||
xm_Write(address, data);
|
||||
return;
|
||||
}
|
||||
|
||||
if (cartridge_pokey && (
|
||||
(!cartridge_pokey450 && (address >= 0x4000 && address <= 0x400f)) ||
|
||||
(cartridge_pokey450 && (address >= 0x0450 && address < 0x0470)))) {
|
||||
pokey_SetRegister(
|
||||
(cartridge_pokey450 ? 0x4000 + (address - 0x0450) : address), data);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!memory_rom[address]) {
|
||||
switch(address) {
|
||||
case WSYNC:
|
||||
if(!(cartridge_flags & 128)) {
|
||||
memory_ram[WSYNC] = true;
|
||||
}
|
||||
break;
|
||||
case INPTCTRL:
|
||||
if(data == 22 && cartridge_IsLoaded( )) {
|
||||
cartridge_Store( );
|
||||
}
|
||||
else if(data == 2 && bios_enabled) {
|
||||
bios_Store( );
|
||||
}
|
||||
break;
|
||||
case INPT0:
|
||||
break;
|
||||
case INPT1:
|
||||
break;
|
||||
case INPT2:
|
||||
break;
|
||||
case INPT3:
|
||||
break;
|
||||
case INPT4:
|
||||
break;
|
||||
case INPT5:
|
||||
break;
|
||||
case AUDC0:
|
||||
tia_SetRegister(AUDC0, data);
|
||||
break;
|
||||
case AUDC1:
|
||||
tia_SetRegister(AUDC1, data);
|
||||
break;
|
||||
case AUDF0:
|
||||
tia_SetRegister(AUDF0, data);
|
||||
break;
|
||||
case AUDF1:
|
||||
tia_SetRegister(AUDF1, data);
|
||||
break;
|
||||
case AUDV0:
|
||||
tia_SetRegister(AUDV0, data);
|
||||
break;
|
||||
case AUDV1:
|
||||
tia_SetRegister(AUDV1, data);
|
||||
break;
|
||||
case SWCHA: /*gdement: Writing here actually writes to DRA inside the RIOT chip.
|
||||
This value only indirectly affects output of SWCHA. Ditto for SWCHB.*/
|
||||
riot_SetDRA(data);
|
||||
break;
|
||||
case SWCHB:
|
||||
riot_SetDRB(data);
|
||||
break;
|
||||
case TIM1T:
|
||||
case TIM1T | 0x8:
|
||||
riot_SetTimer(TIM1T, data);
|
||||
break;
|
||||
case TIM8T:
|
||||
case TIM8T | 0x8:
|
||||
riot_SetTimer(TIM8T, data);
|
||||
break;
|
||||
case TIM64T:
|
||||
case TIM64T | 0x8:
|
||||
riot_SetTimer(TIM64T, data);
|
||||
break;
|
||||
case T1024T:
|
||||
case T1024T | 0x8:
|
||||
riot_SetTimer(T1024T, data);
|
||||
break;
|
||||
default:
|
||||
memory_ram[address] = data;
|
||||
if(address >= 8256 && address <= 8447) {
|
||||
memory_ram[address - 8192] = data;
|
||||
}
|
||||
else if(address >= 8512 && address <= 8702) {
|
||||
memory_ram[address - 8192] = data;
|
||||
}
|
||||
else if(address >= 64 && address <= 255) {
|
||||
memory_ram[address + 8192] = data;
|
||||
}
|
||||
else if(address >= 320 && address <= 511) {
|
||||
memory_ram[address + 8192] = data;
|
||||
}
|
||||
break;
|
||||
/*TODO: gdement: test here for debug port. Don't put it in the switch because that will change behavior.*/
|
||||
}
|
||||
}
|
||||
else {
|
||||
cartridge_Write(address, data);
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// WriteROM
|
||||
// ----------------------------------------------------------------------------
|
||||
void memory_WriteROM(word address, uint size, const byte* data) {
|
||||
if((address + size) <= MEMORY_SIZE && data != NULL) {
|
||||
for(uint index = 0; index < size; index++) {
|
||||
memory_ram[address + index] = data[index];
|
||||
memory_rom[address + index] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ClearROM
|
||||
// ----------------------------------------------------------------------------
|
||||
void memory_ClearROM(word address, uint size) {
|
||||
if((address + size) <= MEMORY_SIZE) {
|
||||
for(uint index = 0; index < size; index++) {
|
||||
memory_ram[address + index] = 0;
|
||||
memory_rom[address + index] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,132 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Palette.h
|
||||
// ----------------------------------------------------------------------------
|
||||
#include "Palette.h"
|
||||
#define PALETTE_SOURCE "Palette.cpp"
|
||||
|
||||
std::string palette_filename;
|
||||
bool palette_default = true;
|
||||
byte palette_data[PALETTE_SIZE] = {
|
||||
0x00,0x00,0x00,0x25,0x25,0x25,0x34,0x34,0x34,0x4F,0x4F,0x4F,
|
||||
0x5B,0x5B,0x5B,0x69,0x69,0x69,0x7B,0x7B,0x7B,0x8A,0x8A,0x8A,
|
||||
0xA7,0xA7,0xA7,0xB9,0xB9,0xB9,0xC5,0xC5,0xC5,0xD0,0xD0,0xD0,
|
||||
0xD7,0xD7,0xD7,0xE1,0xE1,0xE1,0xF4,0xF4,0xF4,0xFF,0xFF,0xFF,
|
||||
0x4C,0x32,0x00,0x62,0x3A,0x00,0x7B,0x4A,0x00,0x9A,0x60,0x00,
|
||||
0xB5,0x74,0x00,0xCC,0x85,0x00,0xE7,0x9E,0x08,0xF7,0xAF,0x10,
|
||||
0xFF,0xC3,0x18,0xFF,0xD0,0x20,0xFF,0xD8,0x28,0xFF,0xDF,0x30,
|
||||
0xFF,0xE6,0x3B,0xFF,0xF4,0x40,0xFF,0xFA,0x4B,0xFF,0xFF,0x50,
|
||||
0x99,0x25,0x00,0xAA,0x25,0x00,0xB4,0x25,0x00,0xD3,0x30,0x00,
|
||||
0xDD,0x48,0x02,0xE2,0x50,0x09,0xF4,0x67,0x00,0xF4,0x75,0x10,
|
||||
0xFF,0x9E,0x10,0xFF,0xAC,0x20,0xFF,0xBA,0x3A,0xFF,0xBF,0x50,
|
||||
0xFF,0xC6,0x6D,0xFF,0xD5,0x80,0xFF,0xE4,0x90,0xFF,0xE6,0x99,
|
||||
0x98,0x0C,0x0C,0x99,0x0C,0x0C,0xC2,0x13,0x00,0xD3,0x13,0x00,
|
||||
0xE2,0x35,0x00,0xE3,0x40,0x00,0xE4,0x40,0x20,0xE5,0x52,0x30,
|
||||
0xFD,0x78,0x54,0xFF,0x8A,0x6A,0xFF,0x98,0x7C,0xFF,0xA4,0x8B,
|
||||
0xFF,0xB3,0x9E,0xFF,0xC2,0xB2,0xFF,0xD0,0xBA,0xFF,0xD7,0xC0,
|
||||
0x99,0x00,0x00,0xA9,0x00,0x00,0xC2,0x04,0x00,0xD3,0x04,0x00,
|
||||
0xDA,0x04,0x00,0xDB,0x08,0x00,0xE4,0x20,0x20,0xF6,0x40,0x40,
|
||||
0xFB,0x70,0x70,0xFB,0x7E,0x7E,0xFB,0x8F,0x8F,0xFF,0x9F,0x9F,
|
||||
0xFF,0xAB,0xAB,0xFF,0xB9,0xB9,0xFF,0xC9,0xC9,0xFF,0xCF,0xCF,
|
||||
0x7E,0x00,0x50,0x80,0x00,0x50,0x80,0x00,0x5F,0x95,0x0B,0x74,
|
||||
0xAA,0x22,0x88,0xBB,0x2F,0x9A,0xCE,0x3F,0xAD,0xD7,0x5A,0xB6,
|
||||
0xE4,0x67,0xC3,0xEF,0x72,0xCE,0xFB,0x7E,0xDA,0xFF,0x8D,0xE1,
|
||||
0xFF,0x9D,0xE5,0xFF,0xA5,0xE7,0xFF,0xAF,0xEA,0xFF,0xB8,0xEC,
|
||||
0x48,0x00,0x6C,0x5C,0x04,0x88,0x65,0x0D,0x90,0x7B,0x23,0xA7,
|
||||
0x93,0x3B,0xBF,0x9D,0x45,0xC9,0xA7,0x4F,0xD3,0xB2,0x5A,0xDE,
|
||||
0xBD,0x65,0xE9,0xC5,0x6D,0xF1,0xCE,0x76,0xFA,0xD5,0x83,0xFF,
|
||||
0xDA,0x90,0xFF,0xDE,0x9C,0xFF,0xE2,0xA9,0xFF,0xE6,0xB6,0xFF,
|
||||
0x1B,0x00,0x70,0x22,0x1B,0x8D,0x37,0x30,0xA2,0x48,0x41,0xB3,
|
||||
0x59,0x52,0xC4,0x63,0x5C,0xCE,0x6F,0x68,0xDA,0x7D,0x76,0xE8,
|
||||
0x87,0x80,0xF8,0x93,0x8C,0xFF,0x9D,0x97,0xFF,0xA8,0xA3,0xFF,
|
||||
0xB3,0xAF,0xFF,0xBC,0xB8,0xFF,0xC4,0xC1,0xFF,0xDA,0xD1,0xFF,
|
||||
0x00,0x0D,0x7F,0x00,0x12,0xA7,0x00,0x18,0xC0,0x0A,0x2B,0xD1,
|
||||
0x1B,0x4A,0xE3,0x2F,0x58,0xF0,0x37,0x68,0xFF,0x49,0x79,0xFF,
|
||||
0x5B,0x85,0xFF,0x6D,0x96,0xFF,0x7F,0xA3,0xFF,0x8C,0xAD,0xFF,
|
||||
0x96,0xB4,0xFF,0xA8,0xC0,0xFF,0xB7,0xCB,0xFF,0xC6,0xD6,0xFF,
|
||||
0x00,0x29,0x5A,0x00,0x38,0x76,0x00,0x48,0x92,0x00,0x5C,0xAC,
|
||||
0x00,0x71,0xC6,0x00,0x86,0xD0,0x0A,0x9B,0xDF,0x1A,0xA8,0xEC,
|
||||
0x2B,0xB6,0xFF,0x3F,0xC2,0xFF,0x45,0xCB,0xFF,0x59,0xD3,0xFF,
|
||||
0x7F,0xDA,0xFF,0x8F,0xDE,0xFF,0xA0,0xE2,0xFF,0xB0,0xEB,0xFF,
|
||||
0x00,0x38,0x39,0x00,0x3C,0x48,0x00,0x3D,0x5B,0x02,0x66,0x7F,
|
||||
0x03,0x73,0x83,0x00,0x9C,0xAA,0x00,0xA1,0xBB,0x01,0xA4,0xCC,
|
||||
0x03,0xBB,0xFF,0x05,0xDA,0xE2,0x18,0xE5,0xFF,0x34,0xEA,0xFF,
|
||||
0x49,0xEF,0xFF,0x66,0xF2,0xFF,0x84,0xF4,0xFF,0x9E,0xF9,0xFF,
|
||||
0x00,0x4A,0x00,0x00,0x5D,0x00,0x00,0x70,0x00,0x00,0x8B,0x00,
|
||||
0x00,0xA9,0x00,0x00,0xBB,0x05,0x00,0xBD,0x00,0x02,0xD0,0x05,
|
||||
0x1A,0xD5,0x40,0x5A,0xF1,0x77,0x82,0xEF,0xA7,0x84,0xED,0xD1,
|
||||
0x89,0xFF,0xED,0x7D,0xFF,0xFF,0x93,0xFF,0xFF,0x9B,0xFF,0xFF,
|
||||
0x22,0x4A,0x03,0x27,0x53,0x04,0x30,0x64,0x05,0x3C,0x77,0x0C,
|
||||
0x45,0x8C,0x11,0x5A,0xA5,0x13,0x1B,0xD2,0x09,0x1F,0xDD,0x00,
|
||||
0x3D,0xCD,0x2D,0x3D,0xCD,0x30,0x58,0xCC,0x40,0x60,0xD3,0x50,
|
||||
0xA2,0xEC,0x55,0xB3,0xF2,0x4A,0xBB,0xF6,0x5D,0xC4,0xF8,0x70,
|
||||
0x2E,0x3F,0x0C,0x36,0x4A,0x0F,0x40,0x56,0x15,0x46,0x5F,0x17,
|
||||
0x57,0x77,0x1A,0x65,0x85,0x1C,0x74,0x93,0x1D,0x8F,0xA5,0x25,
|
||||
0xAD,0xB7,0x2C,0xBC,0xC7,0x30,0xC9,0xD5,0x33,0xD4,0xE0,0x3B,
|
||||
0xE0,0xEC,0x42,0xEA,0xF6,0x45,0xF0,0xFD,0x47,0xF4,0xFF,0x6F,
|
||||
0x55,0x24,0x00,0x5A,0x2C,0x00,0x6C,0x3B,0x00,0x79,0x4B,0x00,
|
||||
0xB9,0x75,0x00,0xBB,0x85,0x00,0xC1,0xA1,0x20,0xD0,0xB0,0x2F,
|
||||
0xDE,0xBE,0x3F,0xE6,0xC6,0x45,0xED,0xCD,0x57,0xF5,0xDB,0x62,
|
||||
0xFB,0xE5,0x69,0xFC,0xEE,0x6F,0xFD,0xF3,0x77,0xFD,0xF3,0x7F,
|
||||
0x5C,0x27,0x00,0x5C,0x2F,0x00,0x71,0x3B,0x00,0x7B,0x48,0x00,
|
||||
0xB9,0x68,0x20,0xBB,0x72,0x20,0xC5,0x86,0x29,0xD7,0x96,0x33,
|
||||
0xE6,0xA4,0x40,0xF4,0xB1,0x4B,0xFD,0xC1,0x58,0xFF,0xCC,0x55,
|
||||
0xFF,0xD4,0x61,0xFF,0xDD,0x69,0xFF,0xE6,0x79,0xFF,0xEA,0x98
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Load
|
||||
// ----------------------------------------------------------------------------
|
||||
bool palette_Load(std::string filename) {
|
||||
if(filename.empty( ) || filename.length( ) == 0) {
|
||||
logger_LogError("Palette filename is invalid.", PALETTE_SOURCE);
|
||||
return false;
|
||||
}
|
||||
|
||||
logger_LogInfo("Opening palette file " + filename + ".", PALETTE_SOURCE);
|
||||
|
||||
FILE* file = fopen(filename.c_str( ), "rb");
|
||||
if(file == NULL) {
|
||||
logger_LogError("Failed to open the palette file " + filename + " for reading.", PALETTE_SOURCE);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(fread(palette_data, 1, PALETTE_SIZE, file) != PALETTE_SIZE) {
|
||||
fclose(file);
|
||||
logger_LogError("Failed to read the palette data.", PALETTE_SOURCE);
|
||||
return false;
|
||||
}
|
||||
|
||||
fclose(file);
|
||||
palette_filename = filename;
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Load
|
||||
// ----------------------------------------------------------------------------
|
||||
void palette_Load(const byte* data) {
|
||||
for(int index = 0; index < PALETTE_SIZE; index++) {
|
||||
palette_data[index] = data[index];
|
||||
}
|
||||
}
|
||||
-512
@@ -1,512 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// PokeySound is Copyright(c) 1997 by Ron Fries
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it
|
||||
// under the terms of version 2 of the GNU Library General Public License
|
||||
// as published by the Free Software Foundation.
|
||||
//
|
||||
// This library 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 Library
|
||||
// General Public License for more details.
|
||||
// To obtain a copy of the GNU Library General Public License, write to the
|
||||
// Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
// Any permitted reproduction of these routines, in whole or in part, must
|
||||
// bear this legend.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Pokey.cpp
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "Pokey.h"
|
||||
#include "ProSystem.h"
|
||||
#define POKEY_NOTPOLY5 0x80
|
||||
#define POKEY_POLY4 0x40
|
||||
#define POKEY_PURE 0x20
|
||||
#define POKEY_VOLUME_ONLY 0x10
|
||||
#define POKEY_VOLUME_MASK 0x0f
|
||||
#define POKEY_POLY9 0x80
|
||||
#define POKEY_CH1_179 0x40
|
||||
#define POKEY_CH3_179 0x20
|
||||
#define POKEY_CH1_CH2 0x10
|
||||
#define POKEY_CH3_CH4 0x08
|
||||
#define POKEY_CH1_FILTER 0x04
|
||||
#define POKEY_CH2_FILTER 0x02
|
||||
#define POKEY_CLOCK_15 0x01
|
||||
#define POKEY_DIV_64 28
|
||||
#define POKEY_DIV_15 114
|
||||
#define POKEY_POLY4_SIZE 0x000f
|
||||
#define POKEY_POLY5_SIZE 0x001f
|
||||
#define POKEY_POLY9_SIZE 0x01ff
|
||||
#define POKEY_POLY17_SIZE 0x0001ffff
|
||||
#define POKEY_CHANNEL1 0
|
||||
#define POKEY_CHANNEL2 1
|
||||
#define POKEY_CHANNEL3 2
|
||||
#define POKEY_CHANNEL4 3
|
||||
#define POKEY_SAMPLE 4
|
||||
|
||||
#define SK_RESET 0x03
|
||||
|
||||
byte pokey_buffer[POKEY_BUFFER_SIZE] = {0};
|
||||
uint pokey_size = (POKEY_BUFFER_SIZE - 512); // 524 previously
|
||||
|
||||
static uint pokey_frequency = 1787520;
|
||||
static uint pokey_sampleRate = 31440;
|
||||
static uint pokey_soundCntr = 0;
|
||||
static byte pokey_audf[4];
|
||||
static byte pokey_audc[4];
|
||||
static byte pokey_audctl;
|
||||
static byte pokey_output[4];
|
||||
static byte pokey_outVol[4];
|
||||
static byte pokey_poly04[POKEY_POLY4_SIZE] = {1,1,0,1,1,1,0,0,0,0,1,0,1,0,0};
|
||||
static byte pokey_poly05[POKEY_POLY5_SIZE] = {0,0,1,1,0,0,0,1,1,1,1,0,0,1,0,1,0,1,1,0,1,1,1,0,1,0,0,0,0,0,1};
|
||||
static byte pokey_poly17[POKEY_POLY17_SIZE];
|
||||
static uint pokey_poly17Size;
|
||||
static uint pokey_polyAdjust;
|
||||
static uint pokey_poly04Cntr;
|
||||
static uint pokey_poly05Cntr;
|
||||
static uint pokey_poly17Cntr;
|
||||
static uint pokey_divideMax[4];
|
||||
static uint pokey_divideCount[4];
|
||||
static uint pokey_sampleMax;
|
||||
static uint pokey_sampleCount[2];
|
||||
static uint pokey_baseMultiplier;
|
||||
|
||||
static byte rand9[0x1ff];
|
||||
static byte rand17[0x1ffff];
|
||||
static uint r9;
|
||||
static uint r17;
|
||||
static byte SKCTL;
|
||||
byte RANDOM;
|
||||
|
||||
byte POT_input[8] = {228, 228, 228, 228, 228, 228, 228, 228};
|
||||
static int pot_scanline;
|
||||
|
||||
static ulong random_scanline_counter;
|
||||
static ulong prev_random_scanline_counter;
|
||||
|
||||
static void rand_init(byte *rng, int size, int left, int right, int add)
|
||||
{
|
||||
int mask = (1 << size) - 1;
|
||||
int i, x = 0;
|
||||
|
||||
for( i = 0; i < mask; i++ )
|
||||
{
|
||||
if (size == 17)
|
||||
*rng = x >> 6; /* use bits 6..13 */
|
||||
else
|
||||
*rng = x; /* use bits 0..7 */
|
||||
rng++;
|
||||
/* calculate next bit */
|
||||
x = ((x << left) + (x >> right) + add) & mask;
|
||||
}
|
||||
}
|
||||
|
||||
void pokey_setSampleRate( uint rate ) {
|
||||
pokey_sampleRate = rate;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Reset
|
||||
// ----------------------------------------------------------------------------
|
||||
void pokey_Reset( ) {
|
||||
pot_scanline = 0;
|
||||
pokey_soundCntr = 0;
|
||||
|
||||
for(int index = 0; index < POKEY_POLY17_SIZE; index++) {
|
||||
pokey_poly17[index] = rand( ) & 1;
|
||||
}
|
||||
pokey_polyAdjust = 0;
|
||||
pokey_poly04Cntr = 0;
|
||||
pokey_poly05Cntr = 0;
|
||||
pokey_poly17Cntr = 0;
|
||||
|
||||
pokey_sampleMax = ((uint)pokey_frequency << 8) / pokey_sampleRate;
|
||||
|
||||
pokey_sampleCount[0] = 0;
|
||||
pokey_sampleCount[1] = 0;
|
||||
|
||||
pokey_poly17Size = POKEY_POLY17_SIZE;
|
||||
|
||||
for(int channel = POKEY_CHANNEL1; channel <= POKEY_CHANNEL4; channel++) {
|
||||
pokey_outVol[channel] = 0;
|
||||
pokey_output[channel] = 0;
|
||||
pokey_divideCount[channel] = 0;
|
||||
pokey_divideMax[channel] = 0x7fffffffL;
|
||||
pokey_audc[channel] = 0;
|
||||
pokey_audf[channel] = 0;
|
||||
}
|
||||
|
||||
for(int i = 0; i < 8; i++) {
|
||||
POT_input[i] = 228;
|
||||
}
|
||||
|
||||
pokey_audctl = 0;
|
||||
pokey_baseMultiplier = POKEY_DIV_64;
|
||||
|
||||
/* initialize the random arrays */
|
||||
rand_init(rand9, 9, 8, 1, 0x00180);
|
||||
rand_init(rand17, 17,16, 1, 0x1c000);
|
||||
|
||||
SKCTL = SK_RESET;
|
||||
RANDOM = 0;
|
||||
|
||||
r9 = 0;
|
||||
r17 = 0;
|
||||
random_scanline_counter = 0;
|
||||
prev_random_scanline_counter = 0;
|
||||
}
|
||||
|
||||
/* Called prior to each frame */
|
||||
void pokey_Frame() {
|
||||
}
|
||||
|
||||
/* Called prior to each scanline */
|
||||
void pokey_Scanline() {
|
||||
random_scanline_counter += CYCLES_PER_SCANLINE;
|
||||
|
||||
if (pot_scanline < 228)
|
||||
pot_scanline++;
|
||||
}
|
||||
|
||||
byte pokey_GetRegister(word address) {
|
||||
byte data = 0;
|
||||
|
||||
byte addr = address & 0x0f;
|
||||
if (addr < 8) {
|
||||
byte b = POT_input[addr];
|
||||
if (b <= pot_scanline)
|
||||
return b;
|
||||
return pot_scanline;
|
||||
}
|
||||
|
||||
switch (address) {
|
||||
case POKEY_ALLPOT: {
|
||||
byte b = 0;
|
||||
for (int i = 0; i < 8; i++)
|
||||
if (POT_input[addr] <= pot_scanline)
|
||||
b &= ~(1 << i); /* reset bit if pot value known */
|
||||
return b;
|
||||
}
|
||||
case POKEY_RANDOM:
|
||||
ulong curr_scanline_counter =
|
||||
( random_scanline_counter + prosystem_cycles + prosystem_extra_cycles );
|
||||
|
||||
if( SKCTL & SK_RESET )
|
||||
{
|
||||
ulong adjust = ( ( curr_scanline_counter - prev_random_scanline_counter ) >> 2 );
|
||||
r9 = (uint)((adjust + r9) % 0x001ff);
|
||||
r17 = (uint)((adjust + r17) % 0x1ffff);
|
||||
}
|
||||
else
|
||||
{
|
||||
r9 = 0;
|
||||
r17 = 0;
|
||||
}
|
||||
if( pokey_audctl & POKEY_POLY9 )
|
||||
{
|
||||
RANDOM = rand9[r9];
|
||||
}
|
||||
else
|
||||
{
|
||||
RANDOM = rand17[r17];
|
||||
}
|
||||
|
||||
prev_random_scanline_counter = curr_scanline_counter;
|
||||
|
||||
RANDOM = RANDOM ^ 0xff;
|
||||
data = RANDOM;
|
||||
break;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// SetRegister
|
||||
// ----------------------------------------------------------------------------
|
||||
void pokey_SetRegister(word address, byte value) {
|
||||
byte channelMask;
|
||||
switch(address) {
|
||||
case POKEY_POTGO:
|
||||
if (!(SKCTL & 4))
|
||||
pot_scanline = 0; /* slow pot mode */
|
||||
return;
|
||||
|
||||
case POKEY_SKCTLS:
|
||||
SKCTL = value;
|
||||
if (value & 4)
|
||||
pot_scanline = 228; /* fast pot mode - return results immediately */
|
||||
return;
|
||||
|
||||
case POKEY_AUDF1:
|
||||
pokey_audf[POKEY_CHANNEL1] = value;
|
||||
channelMask = 1 << POKEY_CHANNEL1;
|
||||
if(pokey_audctl & POKEY_CH1_CH2) {
|
||||
channelMask |= 1 << POKEY_CHANNEL2;
|
||||
}
|
||||
break;
|
||||
|
||||
case POKEY_AUDC1:
|
||||
pokey_audc[POKEY_CHANNEL1] = value;
|
||||
channelMask = 1 << POKEY_CHANNEL1;
|
||||
break;
|
||||
|
||||
case POKEY_AUDF2:
|
||||
pokey_audf[POKEY_CHANNEL2] = value;
|
||||
channelMask = 1 << POKEY_CHANNEL2;
|
||||
break;
|
||||
|
||||
case POKEY_AUDC2:
|
||||
pokey_audc[POKEY_CHANNEL2] = value;
|
||||
channelMask = 1 << POKEY_CHANNEL2;
|
||||
break;
|
||||
|
||||
case POKEY_AUDF3:
|
||||
pokey_audf[POKEY_CHANNEL3] = value;
|
||||
channelMask = 1 << POKEY_CHANNEL3;
|
||||
|
||||
if(pokey_audctl & POKEY_CH3_CH4) {
|
||||
channelMask |= 1 << POKEY_CHANNEL4;
|
||||
}
|
||||
break;
|
||||
|
||||
case POKEY_AUDC3:
|
||||
pokey_audc[POKEY_CHANNEL3] = value;
|
||||
channelMask = 1 << POKEY_CHANNEL3;
|
||||
break;
|
||||
|
||||
case POKEY_AUDF4:
|
||||
pokey_audf[POKEY_CHANNEL4] = value;
|
||||
channelMask = 1 << POKEY_CHANNEL4;
|
||||
break;
|
||||
|
||||
case POKEY_AUDC4:
|
||||
pokey_audc[POKEY_CHANNEL4] = value;
|
||||
channelMask = 1 << POKEY_CHANNEL4;
|
||||
break;
|
||||
|
||||
case POKEY_AUDCTL:
|
||||
pokey_audctl = value;
|
||||
channelMask = 15;
|
||||
if(pokey_audctl & POKEY_POLY9) {
|
||||
pokey_poly17Size = POKEY_POLY9_SIZE;
|
||||
}
|
||||
else {
|
||||
pokey_poly17Size = POKEY_POLY17_SIZE;
|
||||
}
|
||||
if(pokey_audctl & POKEY_CLOCK_15) {
|
||||
pokey_baseMultiplier = POKEY_DIV_15;
|
||||
}
|
||||
else {
|
||||
pokey_baseMultiplier = POKEY_DIV_64;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
channelMask = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
uint newValue = 0;
|
||||
|
||||
if(channelMask & (1 << POKEY_CHANNEL1)) {
|
||||
if(pokey_audctl & POKEY_CH1_179) {
|
||||
newValue = pokey_audf[POKEY_CHANNEL1] + 4;
|
||||
}
|
||||
else {
|
||||
newValue = (pokey_audf[POKEY_CHANNEL1] + 1) * pokey_baseMultiplier;
|
||||
}
|
||||
|
||||
if(newValue != pokey_divideMax[POKEY_CHANNEL1]) {
|
||||
pokey_divideMax[POKEY_CHANNEL1] = newValue;
|
||||
if(pokey_divideCount[POKEY_CHANNEL1] > newValue) {
|
||||
pokey_divideCount[POKEY_CHANNEL1] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(channelMask & (1 << POKEY_CHANNEL2)) {
|
||||
if(pokey_audctl & POKEY_CH1_CH2) {
|
||||
if(pokey_audctl & POKEY_CH1_179) {
|
||||
newValue = pokey_audf[POKEY_CHANNEL2] * 256 + pokey_audf[POKEY_CHANNEL1] + 7;
|
||||
}
|
||||
else {
|
||||
newValue = (pokey_audf[POKEY_CHANNEL2] * 256 + pokey_audf[POKEY_CHANNEL1] + 1) * pokey_baseMultiplier;
|
||||
}
|
||||
}
|
||||
else {
|
||||
newValue = (pokey_audf[POKEY_CHANNEL2] + 1) * pokey_baseMultiplier;
|
||||
}
|
||||
if(newValue != pokey_divideMax[POKEY_CHANNEL2]) {
|
||||
pokey_divideMax[POKEY_CHANNEL2] = newValue;
|
||||
if(pokey_divideCount[POKEY_CHANNEL2] > newValue) {
|
||||
pokey_divideCount[POKEY_CHANNEL2] = newValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(channelMask & (1 << POKEY_CHANNEL3)) {
|
||||
if(pokey_audctl & POKEY_CH3_179) {
|
||||
newValue = pokey_audf[POKEY_CHANNEL3] + 4;
|
||||
}
|
||||
else {
|
||||
newValue= (pokey_audf[POKEY_CHANNEL3] + 1) * pokey_baseMultiplier;
|
||||
}
|
||||
if(newValue!= pokey_divideMax[POKEY_CHANNEL3]) {
|
||||
pokey_divideMax[POKEY_CHANNEL3] = newValue;
|
||||
if(pokey_divideCount[POKEY_CHANNEL3] > newValue) {
|
||||
pokey_divideCount[POKEY_CHANNEL3] = newValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(channelMask & (1 << POKEY_CHANNEL4)) {
|
||||
if(pokey_audctl & POKEY_CH3_CH4) {
|
||||
if(pokey_audctl & POKEY_CH3_179) {
|
||||
newValue = pokey_audf[POKEY_CHANNEL4] * 256 + pokey_audf[POKEY_CHANNEL3] + 7;
|
||||
}
|
||||
else {
|
||||
newValue = (pokey_audf[POKEY_CHANNEL4] * 256 + pokey_audf[POKEY_CHANNEL3] + 1) * pokey_baseMultiplier;
|
||||
}
|
||||
}
|
||||
else {
|
||||
newValue = (pokey_audf[POKEY_CHANNEL4] + 1) * pokey_baseMultiplier;
|
||||
}
|
||||
if(newValue != pokey_divideMax[POKEY_CHANNEL4]) {
|
||||
pokey_divideMax[POKEY_CHANNEL4] = newValue;
|
||||
if(pokey_divideCount[POKEY_CHANNEL4] > newValue) {
|
||||
pokey_divideCount[POKEY_CHANNEL4] = newValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(byte channel = POKEY_CHANNEL1; channel <= POKEY_CHANNEL4; channel++) {
|
||||
if(channelMask & (1 << channel)) {
|
||||
if((pokey_audc[channel] & POKEY_VOLUME_ONLY) ||
|
||||
((pokey_audc[channel] & POKEY_VOLUME_MASK) == 0) ||
|
||||
(pokey_divideMax[channel] < (pokey_sampleMax >> 8))) {
|
||||
#if 1 // WII
|
||||
pokey_outVol[channel] = 1;
|
||||
#else
|
||||
pokey_outVol[channel] = pokey_audc[channel] & POKEY_VOLUME_MASK;
|
||||
#endif
|
||||
pokey_divideCount[channel] = 0x7fffffff;
|
||||
pokey_divideMax[channel] = 0x7fffffff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Process
|
||||
// ----------------------------------------------------------------------------
|
||||
void pokey_Process(uint length) {
|
||||
byte* buffer = pokey_buffer + pokey_soundCntr;
|
||||
//#ifdef BIG_ENDIAN
|
||||
// uint* sampleCntrPtrB = (uint*)((byte*)&pokey_sampleCount[0] + 3);
|
||||
//#else
|
||||
uint* sampleCntrPtrB = (uint*)((byte*)&pokey_sampleCount[0] + 1);
|
||||
//#endif
|
||||
uint size = length;
|
||||
|
||||
while(length) {
|
||||
|
||||
byte currentValue;
|
||||
byte nextEvent = POKEY_SAMPLE;
|
||||
uint eventMin = *sampleCntrPtrB;
|
||||
|
||||
byte channel;
|
||||
for(channel = POKEY_CHANNEL1; channel <= POKEY_CHANNEL4; channel++) {
|
||||
if(pokey_divideCount[channel] <= eventMin) {
|
||||
eventMin = pokey_divideCount[channel];
|
||||
nextEvent = channel;
|
||||
}
|
||||
}
|
||||
|
||||
for(channel = POKEY_CHANNEL1; channel <= POKEY_CHANNEL4; channel++) {
|
||||
pokey_divideCount[channel] -= eventMin;
|
||||
}
|
||||
|
||||
*sampleCntrPtrB -= eventMin;
|
||||
pokey_polyAdjust += eventMin;
|
||||
|
||||
if(nextEvent != POKEY_SAMPLE) {
|
||||
pokey_poly04Cntr = (pokey_poly04Cntr + pokey_polyAdjust) % POKEY_POLY4_SIZE;
|
||||
pokey_poly05Cntr = (pokey_poly05Cntr + pokey_polyAdjust) % POKEY_POLY5_SIZE;
|
||||
pokey_poly17Cntr = (pokey_poly17Cntr + pokey_polyAdjust) % pokey_poly17Size;
|
||||
pokey_polyAdjust = 0;
|
||||
pokey_divideCount[nextEvent] += pokey_divideMax[nextEvent];
|
||||
|
||||
if((pokey_audc[nextEvent] & POKEY_NOTPOLY5) || pokey_poly05[pokey_poly05Cntr]) {
|
||||
if(pokey_audc[nextEvent] & POKEY_PURE) {
|
||||
pokey_output[nextEvent] = !pokey_output[nextEvent];
|
||||
}
|
||||
else if (pokey_audc[nextEvent] & POKEY_POLY4) {
|
||||
pokey_output[nextEvent] = pokey_poly04[pokey_poly04Cntr];
|
||||
}
|
||||
else {
|
||||
pokey_output[nextEvent] = pokey_poly17[pokey_poly17Cntr];
|
||||
}
|
||||
}
|
||||
|
||||
if(pokey_output[nextEvent]) {
|
||||
pokey_outVol[nextEvent] = pokey_audc[nextEvent] & POKEY_VOLUME_MASK;
|
||||
}
|
||||
else {
|
||||
pokey_outVol[nextEvent] = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
//#ifdef BIG_ENDIAN
|
||||
// *(pokey_sampleCount + 1) += pokey_sampleMax;
|
||||
//#else
|
||||
*pokey_sampleCount += pokey_sampleMax;
|
||||
//#endif
|
||||
currentValue = 0;
|
||||
|
||||
for(channel = POKEY_CHANNEL1; channel <= POKEY_CHANNEL4; channel++) {
|
||||
currentValue += pokey_outVol[channel];
|
||||
}
|
||||
|
||||
currentValue = (currentValue << 2) + 8;
|
||||
*buffer++ = currentValue;
|
||||
length--;
|
||||
}
|
||||
}
|
||||
|
||||
pokey_soundCntr += size;
|
||||
if(pokey_soundCntr >= pokey_size) {
|
||||
pokey_soundCntr = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Clear
|
||||
// ----------------------------------------------------------------------------
|
||||
void pokey_Clear( ) {
|
||||
pokey_soundCntr = 0;
|
||||
memset(pokey_buffer, 0, POKEY_BUFFER_SIZE);
|
||||
}
|
||||
@@ -1,640 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2003, 2004 Greg Stanton
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// ProSystem.cpp
|
||||
// ----------------------------------------------------------------------------
|
||||
#include "ProSystem.h"
|
||||
#define PRO_SYSTEM_STATE_HEADER "PRO-SYSTEM STATE"
|
||||
#define PRO_SYSTEM_SOURCE "ProSystem.cpp"
|
||||
|
||||
bool prosystem_active = false;
|
||||
bool prosystem_paused = false;
|
||||
word prosystem_frequency = 60;
|
||||
byte prosystem_frame = 0;
|
||||
word prosystem_scanlines = 262;
|
||||
uint prosystem_cycles = 0;
|
||||
int lightgun_scanline = 0;
|
||||
float lightgun_cycle = 0;
|
||||
|
||||
// Whether the last CPU operation resulted in a half cycle (need to take it
|
||||
// into consideration)
|
||||
extern bool half_cycle;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Reset
|
||||
// ----------------------------------------------------------------------------
|
||||
void prosystem_Reset( ) {
|
||||
if(cartridge_IsLoaded( )) {
|
||||
prosystem_paused = false;
|
||||
prosystem_frame = 0;
|
||||
sally_Reset( );
|
||||
region_Reset( );
|
||||
tia_Clear( );
|
||||
tia_Reset( );
|
||||
pokey_Clear( );
|
||||
pokey_Reset( );
|
||||
xm_Reset( );
|
||||
memory_Reset( );
|
||||
maria_Clear( );
|
||||
maria_Reset( );
|
||||
riot_Reset( );
|
||||
if(bios_enabled) {
|
||||
bios_Store( );
|
||||
}
|
||||
else {
|
||||
cartridge_Store( );
|
||||
}
|
||||
prosystem_cycles = sally_ExecuteRES( );
|
||||
prosystem_active = true;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Strobe based on the current lightgun location
|
||||
*/
|
||||
static void prosystem_FireLightGun()
|
||||
{
|
||||
if( ( ( maria_scanline >= lightgun_scanline ) &&
|
||||
( maria_scanline <= ( lightgun_scanline + 3 ) ) ) &&
|
||||
( prosystem_cycles >= ((int)lightgun_cycle ) - 1 ) )
|
||||
{
|
||||
memory_ram[INPT4] &= 0x7f;
|
||||
}
|
||||
else
|
||||
{
|
||||
memory_ram[INPT4] |= 0x80;
|
||||
}
|
||||
}
|
||||
|
||||
uint prosystem_extra_cycles = 0;
|
||||
// ----------------------------------------------------------------------------
|
||||
// ExecuteFrame
|
||||
// ----------------------------------------------------------------------------
|
||||
void prosystem_ExecuteFrame(const byte* input) {
|
||||
// Is WSYNC enabled for the current frame?
|
||||
bool wsync = !(cartridge_flags & CARTRIDGE_WSYNC_MASK);
|
||||
|
||||
// Is Maria cycle stealing enabled for the current frame?
|
||||
bool cycle_stealing = !(cartridge_flags & CARTRIDGE_CYCLE_STEALING_MASK);
|
||||
|
||||
// Is the lightgun enabled for the current frame?
|
||||
bool lightgun = ((cartridge_controller[0] & CARTRIDGE_CONTROLLER_LIGHTGUN) && (memory_ram[CTRL] & 96) != 64);
|
||||
|
||||
riot_SetInput(input);
|
||||
|
||||
prosystem_extra_cycles = 0;
|
||||
|
||||
if(cartridge_pokey || cartridge_xm) pokey_Frame();
|
||||
|
||||
for(maria_scanline = 1; maria_scanline <= prosystem_scanlines; maria_scanline++) {
|
||||
if(maria_scanline == maria_displayArea.top) {
|
||||
memory_ram[MSTAT] = 0;
|
||||
}
|
||||
else if(maria_scanline == maria_displayArea.bottom) {
|
||||
memory_ram[MSTAT] = 128;
|
||||
}
|
||||
|
||||
// Was a WSYNC performed withing the current scanline?
|
||||
bool wsync_scanline = false;
|
||||
|
||||
uint cycles = 0;
|
||||
|
||||
if(!cycle_stealing || (memory_ram[CTRL] & 96 ) != 64) {
|
||||
// Exact cycle counts when Maria is disabled
|
||||
prosystem_cycles %= CYCLES_PER_SCANLINE;
|
||||
prosystem_extra_cycles = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
prosystem_extra_cycles = (prosystem_cycles % CYCLES_PER_SCANLINE);
|
||||
|
||||
// Some fudge for Maria cycles. Unfortunately Maria cycle counting
|
||||
// isn't exact (This adds some extra cycles).
|
||||
prosystem_cycles = 0;
|
||||
}
|
||||
|
||||
// If lightgun is enabled, check to see if it should be fired
|
||||
if(lightgun) prosystem_FireLightGun();
|
||||
|
||||
while(prosystem_cycles < cartridge_hblank) {
|
||||
cycles = sally_ExecuteInstruction( );
|
||||
prosystem_cycles += (cycles << 2);
|
||||
if(half_cycle) prosystem_cycles += 2;
|
||||
|
||||
if(riot_timing) {
|
||||
riot_UpdateTimer(cycles);
|
||||
}
|
||||
|
||||
// If lightgun is enabled, check to see if it should be fired
|
||||
if(lightgun) prosystem_FireLightGun();
|
||||
|
||||
if(memory_ram[WSYNC] && wsync) {
|
||||
memory_ram[WSYNC] = false;
|
||||
wsync_scanline = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
cycles = maria_RenderScanline( );
|
||||
|
||||
if(cycle_stealing) {
|
||||
prosystem_cycles += cycles;
|
||||
|
||||
if(riot_timing) {
|
||||
riot_UpdateTimer(cycles >> 2);
|
||||
}
|
||||
}
|
||||
|
||||
while(!wsync_scanline && prosystem_cycles < CYCLES_PER_SCANLINE) {
|
||||
cycles = sally_ExecuteInstruction( );
|
||||
prosystem_cycles += (cycles << 2);
|
||||
if(half_cycle) prosystem_cycles += 2;
|
||||
|
||||
// If lightgun is enabled, check to see if it should be fired
|
||||
if(lightgun) prosystem_FireLightGun();
|
||||
|
||||
if(riot_timing) {
|
||||
riot_UpdateTimer(cycles);
|
||||
}
|
||||
|
||||
if(memory_ram[WSYNC] && wsync) {
|
||||
memory_ram[WSYNC] = false;
|
||||
wsync_scanline = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If a WSYNC was performed and the current cycle count is less than
|
||||
// the cycles per scanline, add those cycles to current timers.
|
||||
if(wsync_scanline && prosystem_cycles < CYCLES_PER_SCANLINE) {
|
||||
if(riot_timing)
|
||||
{
|
||||
riot_UpdateTimer((CYCLES_PER_SCANLINE - prosystem_cycles) >> 2);
|
||||
}
|
||||
prosystem_cycles = CYCLES_PER_SCANLINE;
|
||||
}
|
||||
|
||||
// If lightgun is enabled, check to see if it should be fired
|
||||
if(lightgun) prosystem_FireLightGun();
|
||||
|
||||
tia_Process(2);
|
||||
if(cartridge_pokey || cartridge_xm) {
|
||||
pokey_Process(2);
|
||||
}
|
||||
|
||||
if(cartridge_pokey || cartridge_xm) pokey_Scanline();
|
||||
}
|
||||
|
||||
prosystem_frame++;
|
||||
if(prosystem_frame >= prosystem_frequency) {
|
||||
prosystem_frame = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Save
|
||||
// ----------------------------------------------------------------------------
|
||||
bool prosystem_Save(std::string filename, bool compress) {
|
||||
if(filename.empty( ) || filename.length( ) == 0) {
|
||||
logger_LogError("Filename is invalid.", PRO_SYSTEM_SOURCE);
|
||||
return false;
|
||||
}
|
||||
|
||||
logger_LogInfo("Saving game state to file " + filename + ".", PRO_SYSTEM_SOURCE);
|
||||
|
||||
byte loc_buffer[33000 + XM_RAM_SIZE + 4] = {0};
|
||||
|
||||
uint size = 0;
|
||||
|
||||
uint index;
|
||||
for(index = 0; index < 16; index++) {
|
||||
loc_buffer[size + index] = PRO_SYSTEM_STATE_HEADER[index];
|
||||
}
|
||||
size += 16;
|
||||
|
||||
loc_buffer[size++] = 1;
|
||||
for(index = 0; index < 4; index++) {
|
||||
loc_buffer[size + index] = 0;
|
||||
}
|
||||
size += 4;
|
||||
|
||||
for(index = 0; index < 32; index++) {
|
||||
loc_buffer[size + index] = cartridge_digest[index];
|
||||
}
|
||||
size += 32;
|
||||
|
||||
loc_buffer[size++] = sally_a;
|
||||
loc_buffer[size++] = sally_x;
|
||||
loc_buffer[size++] = sally_y;
|
||||
loc_buffer[size++] = sally_p;
|
||||
loc_buffer[size++] = sally_s;
|
||||
loc_buffer[size++] = sally_pc.b.l;
|
||||
loc_buffer[size++] = sally_pc.b.h;
|
||||
loc_buffer[size++] = cartridge_bank;
|
||||
|
||||
for(index = 0; index < 16384; index++) {
|
||||
loc_buffer[size + index] = memory_ram[index];
|
||||
}
|
||||
size += 16384;
|
||||
|
||||
if(cartridge_type == CARTRIDGE_TYPE_SUPERCART_RAM) {
|
||||
for(index = 0; index < 16384; index++) {
|
||||
loc_buffer[size + index] = memory_ram[16384 + index];
|
||||
}
|
||||
size += 16384;
|
||||
}
|
||||
|
||||
// RIOT state
|
||||
loc_buffer[size++] = riot_dra;
|
||||
loc_buffer[size++] = riot_drb;
|
||||
loc_buffer[size++] = riot_timing;
|
||||
loc_buffer[size++] = ( 0xff & ( riot_timer >> 8 ) );
|
||||
loc_buffer[size++] = ( 0xff & riot_timer );
|
||||
loc_buffer[size++] = riot_intervals;
|
||||
loc_buffer[size++] = ( 0xff & ( riot_clocks >> 8 ) );
|
||||
loc_buffer[size++] = ( 0xff & riot_clocks );
|
||||
|
||||
// XM (if applicable)
|
||||
if (cartridge_xm) {
|
||||
loc_buffer[size++] = xm_reg;
|
||||
loc_buffer[size++] = xm_bank;
|
||||
loc_buffer[size++] = xm_pokey_enabled;
|
||||
loc_buffer[size++] = xm_mem_enabled;
|
||||
|
||||
for (index = 0; index < XM_RAM_SIZE; index++) {
|
||||
loc_buffer[size + index] = xm_ram[index];
|
||||
}
|
||||
size += XM_RAM_SIZE;
|
||||
}
|
||||
|
||||
FILE* file = fopen(filename.c_str( ), "wb");
|
||||
if(file == NULL) {
|
||||
logger_LogError("Failed to open the file " + filename + " for writing.", PRO_SYSTEM_SOURCE);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(fwrite(loc_buffer, 1, size, file) != size) {
|
||||
fclose(file);
|
||||
logger_LogError("Failed to write the save state data to the file " + filename + ".", PRO_SYSTEM_SOURCE);
|
||||
return false;
|
||||
}
|
||||
|
||||
fflush(file);
|
||||
fclose(file);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool prosystem_Save_buffer(byte *buffer)
|
||||
{
|
||||
uint size = 0;
|
||||
uint index;
|
||||
|
||||
for(index = 0; index < 16; index++) {
|
||||
buffer[size + index] = PRO_SYSTEM_STATE_HEADER[index];
|
||||
}
|
||||
size += 16;
|
||||
|
||||
buffer[size++] = 1;
|
||||
for(index = 0; index < 4; index++) {
|
||||
buffer[size + index] = 0;
|
||||
}
|
||||
size += 4;
|
||||
|
||||
for(index = 0; index < 32; index++) {
|
||||
buffer[size + index] = cartridge_digest[index];
|
||||
}
|
||||
size += 32;
|
||||
|
||||
buffer[size++] = sally_a;
|
||||
buffer[size++] = sally_x;
|
||||
buffer[size++] = sally_y;
|
||||
buffer[size++] = sally_p;
|
||||
buffer[size++] = sally_s;
|
||||
buffer[size++] = sally_pc.b.l;
|
||||
buffer[size++] = sally_pc.b.h;
|
||||
buffer[size++] = cartridge_bank;
|
||||
|
||||
for(index = 0; index < 16384; index++) {
|
||||
buffer[size + index] = memory_ram[index];
|
||||
}
|
||||
size += 16384;
|
||||
|
||||
if(cartridge_type == CARTRIDGE_TYPE_SUPERCART_RAM) {
|
||||
for(index = 0; index < 16384; index++) {
|
||||
buffer[size + index] = memory_ram[16384 + index];
|
||||
}
|
||||
size += 16384;
|
||||
}
|
||||
|
||||
// RIOT state
|
||||
buffer[size++] = riot_dra;
|
||||
buffer[size++] = riot_drb;
|
||||
buffer[size++] = riot_timing;
|
||||
buffer[size++] = ( 0xff & ( riot_timer >> 8 ) );
|
||||
buffer[size++] = ( 0xff & riot_timer );
|
||||
buffer[size++] = riot_intervals;
|
||||
buffer[size++] = ( 0xff & ( riot_clocks >> 8 ) );
|
||||
buffer[size++] = ( 0xff & riot_clocks );
|
||||
|
||||
// XM (if applicable)
|
||||
if (cartridge_xm) {
|
||||
buffer[size++] = xm_reg;
|
||||
buffer[size++] = xm_bank;
|
||||
buffer[size++] = xm_pokey_enabled;
|
||||
buffer[size++] = xm_mem_enabled;
|
||||
|
||||
for (index = 0; index < XM_RAM_SIZE; index++) {
|
||||
buffer[size + index] = xm_ram[index];
|
||||
}
|
||||
size += XM_RAM_SIZE;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Load
|
||||
// ----------------------------------------------------------------------------
|
||||
bool prosystem_Load(const std::string filename) {
|
||||
if(filename.empty( ) || filename.length( ) == 0) {
|
||||
logger_LogError("Filename is invalid.", PRO_SYSTEM_SOURCE);
|
||||
return false;
|
||||
}
|
||||
|
||||
logger_LogInfo("Loading game state from file " + filename + ".", PRO_SYSTEM_SOURCE);
|
||||
|
||||
byte loc_buffer[33000 + XM_RAM_SIZE + 4] = {0};
|
||||
|
||||
uint size = archive_GetUncompressedFileSize(filename);
|
||||
if(size == 0) {
|
||||
FILE* file = fopen(filename.c_str( ), "rb");
|
||||
if(file == NULL) {
|
||||
logger_LogError("Failed to open the file " + filename + " for reading.", PRO_SYSTEM_SOURCE);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(fseek(file, 0L, SEEK_END)) {
|
||||
fclose(file);
|
||||
logger_LogError("Failed to find the end of the file.", PRO_SYSTEM_SOURCE);
|
||||
return false;
|
||||
}
|
||||
|
||||
size = ftell(file);
|
||||
if(fseek(file, 0L, SEEK_SET)) {
|
||||
fclose(file);
|
||||
logger_LogError("Failed to find the size of the file.", PRO_SYSTEM_SOURCE);
|
||||
return false;
|
||||
}
|
||||
|
||||
if( size != 16445 && size != 32829 && /* no RIOT */
|
||||
size != 16453 && size != 32837 && /* with RIOT */
|
||||
size != (16453 + 4 + XM_RAM_SIZE) && /* XM without supercart ram */
|
||||
size != (32837 + 4 + XM_RAM_SIZE)) /* XM with supercart ram */
|
||||
{
|
||||
fclose(file);
|
||||
logger_LogError("Save state file has an invalid size.", PRO_SYSTEM_SOURCE);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(fread(loc_buffer, 1, size, file) != size && ferror(file)) {
|
||||
fclose(file);
|
||||
logger_LogError("Failed to read the file data.", PRO_SYSTEM_SOURCE);
|
||||
return false;
|
||||
}
|
||||
fclose(file);
|
||||
}
|
||||
else {
|
||||
logger_LogError("Save state file has an invalid size.", PRO_SYSTEM_SOURCE);
|
||||
return false;
|
||||
}
|
||||
|
||||
uint offset = 0;
|
||||
uint index;
|
||||
for(index = 0; index < 16; index++) {
|
||||
if(loc_buffer[offset + index] != PRO_SYSTEM_STATE_HEADER[index]) {
|
||||
logger_LogError("File is not a valid ProSystem save state.", PRO_SYSTEM_SOURCE);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
offset += 16;
|
||||
byte version = loc_buffer[offset++];
|
||||
|
||||
uint date = 0;
|
||||
for(index = 0; index < 4; index++) {
|
||||
}
|
||||
offset += 4;
|
||||
|
||||
prosystem_Reset( );
|
||||
|
||||
char digest[33] = {0};
|
||||
for(index = 0; index < 32; index++) {
|
||||
digest[index] = loc_buffer[offset + index];
|
||||
}
|
||||
offset += 32;
|
||||
if(cartridge_digest != std::string(digest)) {
|
||||
logger_LogError("Load state digest [" + std::string(digest) + "] does not match loaded cartridge digest [" + cartridge_digest + "].", PRO_SYSTEM_SOURCE);
|
||||
return false;
|
||||
}
|
||||
|
||||
sally_a = loc_buffer[offset++];
|
||||
sally_x = loc_buffer[offset++];
|
||||
sally_y = loc_buffer[offset++];
|
||||
sally_p = loc_buffer[offset++];
|
||||
sally_s = loc_buffer[offset++];
|
||||
sally_pc.b.l = loc_buffer[offset++];
|
||||
sally_pc.b.h = loc_buffer[offset++];
|
||||
|
||||
cartridge_StoreBank(loc_buffer[offset++]);
|
||||
|
||||
for(index = 0; index < 16384; index++) {
|
||||
memory_ram[index] = loc_buffer[offset + index];
|
||||
}
|
||||
offset += 16384;
|
||||
|
||||
if(cartridge_type == CARTRIDGE_TYPE_SUPERCART_RAM) {
|
||||
if (size != 32829 && /* no RIOT */
|
||||
size != 32837 && /* with RIOT */
|
||||
size != (32837 + 4 + XM_RAM_SIZE)) /* XM */ {
|
||||
logger_LogError("Save state file has an invalid size.", PRO_SYSTEM_SOURCE);
|
||||
return false;
|
||||
}
|
||||
for(index = 0; index < 16384; index++) {
|
||||
memory_ram[16384 + index] = loc_buffer[offset + index];
|
||||
}
|
||||
offset += 16384;
|
||||
}
|
||||
|
||||
if (size == 16453 || /* no supercart ram */
|
||||
size == 32837 || /* supercart ram */
|
||||
size == (16453 + 4 + XM_RAM_SIZE) || /* xm, no supercart ram */
|
||||
size == (32837 + 4 + XM_RAM_SIZE)) /* xm, supercart ram */ {
|
||||
// RIOT state
|
||||
riot_dra = loc_buffer[offset++];
|
||||
riot_drb = loc_buffer[offset++];
|
||||
riot_timing = loc_buffer[offset++];
|
||||
riot_timer = ( loc_buffer[offset++] << 8 );
|
||||
riot_timer |= loc_buffer[offset++];
|
||||
riot_intervals = loc_buffer[offset++];
|
||||
riot_clocks = ( loc_buffer[offset++] << 8 );
|
||||
riot_clocks |= loc_buffer[offset++];
|
||||
}
|
||||
|
||||
// XM (if applicable)
|
||||
if (cartridge_xm) {
|
||||
if ((size != (16453 + 4 + XM_RAM_SIZE)) &&
|
||||
(size != (32837 + 4 + XM_RAM_SIZE))) {
|
||||
logger_LogError("Save state file has an invalid size.", PRO_SYSTEM_SOURCE);
|
||||
return false;
|
||||
}
|
||||
xm_reg = loc_buffer[offset++];
|
||||
xm_bank = loc_buffer[offset++];
|
||||
xm_pokey_enabled = loc_buffer[offset++];
|
||||
xm_mem_enabled = loc_buffer[offset++];
|
||||
|
||||
for (index = 0; index < XM_RAM_SIZE; index++) {
|
||||
xm_ram[index] = loc_buffer[offset++];
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool prosystem_Load_buffer(const byte *buffer)
|
||||
{
|
||||
uint size = cartridge_type == CARTRIDGE_TYPE_SUPERCART_RAM ? 32837 : 16453;
|
||||
if(cartridge_xm) {
|
||||
size += 4 + XM_RAM_SIZE;
|
||||
}
|
||||
uint offset = 0;
|
||||
uint index;
|
||||
|
||||
for(index = 0; index < 16; index++) {
|
||||
if(buffer[offset + index] != PRO_SYSTEM_STATE_HEADER[index]) {
|
||||
logger_LogError("File is not a valid ProSystem save state.", PRO_SYSTEM_SOURCE);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
offset += 16;
|
||||
|
||||
byte version = buffer[offset++];
|
||||
//uint date = 0;
|
||||
|
||||
offset += 4;
|
||||
|
||||
//prosystem_Reset(); // TODO doesn't seem necessary but needs investigation
|
||||
|
||||
char digest[33] = {0};
|
||||
for(index = 0; index < 32; index++) {
|
||||
digest[index] = buffer[offset + index];
|
||||
}
|
||||
offset += 32;
|
||||
if(cartridge_digest != std::string(digest)) {
|
||||
logger_LogError("Load state digest [" + std::string(digest) + "] does not match loaded cartridge digest [" + cartridge_digest + "].", PRO_SYSTEM_SOURCE);
|
||||
return false;
|
||||
}
|
||||
|
||||
sally_a = buffer[offset++];
|
||||
sally_x = buffer[offset++];
|
||||
sally_y = buffer[offset++];
|
||||
sally_p = buffer[offset++];
|
||||
sally_s = buffer[offset++];
|
||||
sally_pc.b.l = buffer[offset++];
|
||||
sally_pc.b.h = buffer[offset++];
|
||||
|
||||
cartridge_StoreBank(buffer[offset++]);
|
||||
|
||||
for(index = 0; index < 16384; index++) {
|
||||
memory_ram[index] = buffer[offset + index];
|
||||
}
|
||||
offset += 16384;
|
||||
|
||||
if(cartridge_type == CARTRIDGE_TYPE_SUPERCART_RAM) {
|
||||
if (size != 32829 && /* no RIOT */
|
||||
size != 32837 && /* with RIOT */
|
||||
size != (32837 + 4 + XM_RAM_SIZE)) /* XM */ {
|
||||
logger_LogError("Save state file has an invalid size.", PRO_SYSTEM_SOURCE);
|
||||
return false;
|
||||
}
|
||||
for(index = 0; index < 16384; index++) {
|
||||
memory_ram[16384 + index] = buffer[offset + index];
|
||||
}
|
||||
offset += 16384;
|
||||
}
|
||||
|
||||
if (size == 16453 || /* no supercart ram */
|
||||
size == 32837 || /* supercart ram */
|
||||
size == (16453 + 4 + XM_RAM_SIZE) || /* xm, no supercart ram */
|
||||
size == (32837 + 4 + XM_RAM_SIZE)) /* xm, supercart ram */ {
|
||||
// RIOT state
|
||||
riot_dra = buffer[offset++];
|
||||
riot_drb = buffer[offset++];
|
||||
riot_timing = buffer[offset++];
|
||||
riot_timer = ( buffer[offset++] << 8 );
|
||||
riot_timer |= buffer[offset++];
|
||||
riot_intervals = buffer[offset++];
|
||||
riot_clocks = ( buffer[offset++] << 8 );
|
||||
riot_clocks |= buffer[offset++];
|
||||
}
|
||||
|
||||
// XM (if applicable)
|
||||
if (cartridge_xm) {
|
||||
if ((size != (16453 + 4 + XM_RAM_SIZE)) &&
|
||||
(size != (32837 + 4 + XM_RAM_SIZE))) {
|
||||
logger_LogError("Save state file has an invalid size.", PRO_SYSTEM_SOURCE);
|
||||
return false;
|
||||
}
|
||||
xm_reg = buffer[offset++];
|
||||
xm_bank = buffer[offset++];
|
||||
xm_pokey_enabled = buffer[offset++];
|
||||
xm_mem_enabled = buffer[offset++];
|
||||
|
||||
for (index = 0; index < XM_RAM_SIZE; index++) {
|
||||
xm_ram[index] = buffer[offset++];
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Pause
|
||||
// ----------------------------------------------------------------------------
|
||||
void prosystem_Pause(bool pause) {
|
||||
if(prosystem_active) {
|
||||
prosystem_paused = pause;
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Close
|
||||
// ----------------------------------------------------------------------------
|
||||
void prosystem_Close( ) {
|
||||
prosystem_active = false;
|
||||
prosystem_paused = false;
|
||||
cartridge_Release( );
|
||||
maria_Reset( );
|
||||
maria_Clear( );
|
||||
memory_Reset( );
|
||||
tia_Reset( );
|
||||
tia_Clear( );
|
||||
}
|
||||
-52
@@ -1,52 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Rect.h
|
||||
// ----------------------------------------------------------------------------
|
||||
#ifndef RECT_H
|
||||
#define RECT_H
|
||||
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned short word;
|
||||
typedef unsigned int uint;
|
||||
|
||||
struct Rects {
|
||||
uint left;
|
||||
uint top;
|
||||
uint right;
|
||||
uint bottom;
|
||||
|
||||
uint GetArea( ) {
|
||||
return GetLength( ) * GetHeight( );
|
||||
}
|
||||
|
||||
uint GetLength( ) {
|
||||
return (right - left) + 1;
|
||||
}
|
||||
|
||||
uint GetHeight( ) {
|
||||
return (bottom - top) + 1;
|
||||
}
|
||||
};
|
||||
|
||||
typedef Rects rect;
|
||||
#endif
|
||||
-204
@@ -1,204 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Region.h
|
||||
// ----------------------------------------------------------------------------
|
||||
#include "Region.h"
|
||||
|
||||
byte region_type = REGION_AUTO;
|
||||
|
||||
static const rect REGION_DISPLAY_AREA_NTSC = {0, 16, 319, 258};
|
||||
static const rect REGION_VISIBLE_AREA_NTSC = {0, 26, 319, 250};
|
||||
static const byte REGION_FREQUENCY_NTSC = 60;
|
||||
static const word REGION_SCANLINES_NTSC = 262;
|
||||
|
||||
static const rect REGION_DISPLAY_AREA_PAL = {0, 16, 319, 308};
|
||||
static const rect REGION_VISIBLE_AREA_PAL = {0, 26, 319, 297};
|
||||
static const byte REGION_FREQUENCY_PAL = 50;
|
||||
static const word REGION_SCANLINES_PAL = 312;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// PALETTE NTSC
|
||||
// ----------------------------------------------------------------------------
|
||||
static const byte REGION_PALETTE_NTSC[ ] = {
|
||||
0x00,0x00,0x00,0x25,0x25,0x25,0x34,0x34,0x34,0x4F,0x4F,0x4F,
|
||||
0x5B,0x5B,0x5B,0x69,0x69,0x69,0x7B,0x7B,0x7B,0x8A,0x8A,0x8A,
|
||||
0xA7,0xA7,0xA7,0xB9,0xB9,0xB9,0xC5,0xC5,0xC5,0xD0,0xD0,0xD0,
|
||||
0xD7,0xD7,0xD7,0xE1,0xE1,0xE1,0xF4,0xF4,0xF4,0xFF,0xFF,0xFF,
|
||||
0x4C,0x32,0x00,0x62,0x3A,0x00,0x7B,0x4A,0x00,0x9A,0x60,0x00,
|
||||
0xB5,0x74,0x00,0xCC,0x85,0x00,0xE7,0x9E,0x08,0xF7,0xAF,0x10,
|
||||
0xFF,0xC3,0x18,0xFF,0xD0,0x20,0xFF,0xD8,0x28,0xFF,0xDF,0x30,
|
||||
0xFF,0xE6,0x3B,0xFF,0xF4,0x40,0xFF,0xFA,0x4B,0xFF,0xFF,0x50,
|
||||
0x99,0x25,0x00,0xAA,0x25,0x00,0xB4,0x25,0x00,0xD3,0x30,0x00,
|
||||
0xDD,0x48,0x02,0xE2,0x50,0x09,0xF4,0x67,0x00,0xF4,0x75,0x10,
|
||||
0xFF,0x9E,0x10,0xFF,0xAC,0x20,0xFF,0xBA,0x3A,0xFF,0xBF,0x50,
|
||||
0xFF,0xC6,0x6D,0xFF,0xD5,0x80,0xFF,0xE4,0x90,0xFF,0xE6,0x99,
|
||||
0x98,0x0C,0x0C,0x99,0x0C,0x0C,0xC2,0x13,0x00,0xD3,0x13,0x00,
|
||||
0xE2,0x35,0x00,0xE3,0x40,0x00,0xE4,0x40,0x20,0xE5,0x52,0x30,
|
||||
0xFD,0x78,0x54,0xFF,0x8A,0x6A,0xFF,0x98,0x7C,0xFF,0xA4,0x8B,
|
||||
0xFF,0xB3,0x9E,0xFF,0xC2,0xB2,0xFF,0xD0,0xBA,0xFF,0xD7,0xC0,
|
||||
0x99,0x00,0x00,0xA9,0x00,0x00,0xC2,0x04,0x00,0xD3,0x04,0x00,
|
||||
0xDA,0x04,0x00,0xDB,0x08,0x00,0xE4,0x20,0x20,0xF6,0x40,0x40,
|
||||
0xFB,0x70,0x70,0xFB,0x7E,0x7E,0xFB,0x8F,0x8F,0xFF,0x9F,0x9F,
|
||||
0xFF,0xAB,0xAB,0xFF,0xB9,0xB9,0xFF,0xC9,0xC9,0xFF,0xCF,0xCF,
|
||||
0x7E,0x00,0x50,0x80,0x00,0x50,0x80,0x00,0x5F,0x95,0x0B,0x74,
|
||||
0xAA,0x22,0x88,0xBB,0x2F,0x9A,0xCE,0x3F,0xAD,0xD7,0x5A,0xB6,
|
||||
0xE4,0x67,0xC3,0xEF,0x72,0xCE,0xFB,0x7E,0xDA,0xFF,0x8D,0xE1,
|
||||
0xFF,0x9D,0xE5,0xFF,0xA5,0xE7,0xFF,0xAF,0xEA,0xFF,0xB8,0xEC,
|
||||
0x48,0x00,0x6C,0x5C,0x04,0x88,0x65,0x0D,0x90,0x7B,0x23,0xA7,
|
||||
0x93,0x3B,0xBF,0x9D,0x45,0xC9,0xA7,0x4F,0xD3,0xB2,0x5A,0xDE,
|
||||
0xBD,0x65,0xE9,0xC5,0x6D,0xF1,0xCE,0x76,0xFA,0xD5,0x83,0xFF,
|
||||
0xDA,0x90,0xFF,0xDE,0x9C,0xFF,0xE2,0xA9,0xFF,0xE6,0xB6,0xFF,
|
||||
0x1B,0x00,0x70,0x22,0x1B,0x8D,0x37,0x30,0xA2,0x48,0x41,0xB3,
|
||||
0x59,0x52,0xC4,0x63,0x5C,0xCE,0x6F,0x68,0xDA,0x7D,0x76,0xE8,
|
||||
0x87,0x80,0xF8,0x93,0x8C,0xFF,0x9D,0x97,0xFF,0xA8,0xA3,0xFF,
|
||||
0xB3,0xAF,0xFF,0xBC,0xB8,0xFF,0xC4,0xC1,0xFF,0xDA,0xD1,0xFF,
|
||||
0x00,0x0D,0x7F,0x00,0x12,0xA7,0x00,0x18,0xC0,0x0A,0x2B,0xD1,
|
||||
0x1B,0x4A,0xE3,0x2F,0x58,0xF0,0x37,0x68,0xFF,0x49,0x79,0xFF,
|
||||
0x5B,0x85,0xFF,0x6D,0x96,0xFF,0x7F,0xA3,0xFF,0x8C,0xAD,0xFF,
|
||||
0x96,0xB4,0xFF,0xA8,0xC0,0xFF,0xB7,0xCB,0xFF,0xC6,0xD6,0xFF,
|
||||
0x00,0x29,0x5A,0x00,0x38,0x76,0x00,0x48,0x92,0x00,0x5C,0xAC,
|
||||
0x00,0x71,0xC6,0x00,0x86,0xD0,0x0A,0x9B,0xDF,0x1A,0xA8,0xEC,
|
||||
0x2B,0xB6,0xFF,0x3F,0xC2,0xFF,0x45,0xCB,0xFF,0x59,0xD3,0xFF,
|
||||
0x7F,0xDA,0xFF,0x8F,0xDE,0xFF,0xA0,0xE2,0xFF,0xB0,0xEB,0xFF,
|
||||
0x00,0x38,0x39,0x00,0x3C,0x48,0x00,0x3D,0x5B,0x02,0x66,0x7F,
|
||||
0x03,0x73,0x83,0x00,0x9C,0xAA,0x00,0xA1,0xBB,0x01,0xA4,0xCC,
|
||||
0x03,0xBB,0xFF,0x05,0xDA,0xE2,0x18,0xE5,0xFF,0x34,0xEA,0xFF,
|
||||
0x49,0xEF,0xFF,0x66,0xF2,0xFF,0x84,0xF4,0xFF,0x9E,0xF9,0xFF,
|
||||
0x00,0x4A,0x00,0x00,0x5D,0x00,0x00,0x70,0x00,0x00,0x8B,0x00,
|
||||
0x00,0xA9,0x00,0x00,0xBB,0x05,0x00,0xBD,0x00,0x02,0xD0,0x05,
|
||||
0x1A,0xD5,0x40,0x5A,0xF1,0x77,0x82,0xEF,0xA7,0x84,0xED,0xD1,
|
||||
0x89,0xFF,0xED,0x7D,0xFF,0xFF,0x93,0xFF,0xFF,0x9B,0xFF,0xFF,
|
||||
0x22,0x4A,0x03,0x27,0x53,0x04,0x30,0x64,0x05,0x3C,0x77,0x0C,
|
||||
0x45,0x8C,0x11,0x5A,0xA5,0x13,0x1B,0xD2,0x09,0x1F,0xDD,0x00,
|
||||
0x3D,0xCD,0x2D,0x3D,0xCD,0x30,0x58,0xCC,0x40,0x60,0xD3,0x50,
|
||||
0xA2,0xEC,0x55,0xB3,0xF2,0x4A,0xBB,0xF6,0x5D,0xC4,0xF8,0x70,
|
||||
0x2E,0x3F,0x0C,0x36,0x4A,0x0F,0x40,0x56,0x15,0x46,0x5F,0x17,
|
||||
0x57,0x77,0x1A,0x65,0x85,0x1C,0x74,0x93,0x1D,0x8F,0xA5,0x25,
|
||||
0xAD,0xB7,0x2C,0xBC,0xC7,0x30,0xC9,0xD5,0x33,0xD4,0xE0,0x3B,
|
||||
0xE0,0xEC,0x42,0xEA,0xF6,0x45,0xF0,0xFD,0x47,0xF4,0xFF,0x6F,
|
||||
0x55,0x24,0x00,0x5A,0x2C,0x00,0x6C,0x3B,0x00,0x79,0x4B,0x00,
|
||||
0xB9,0x75,0x00,0xBB,0x85,0x00,0xC1,0xA1,0x20,0xD0,0xB0,0x2F,
|
||||
0xDE,0xBE,0x3F,0xE6,0xC6,0x45,0xED,0xCD,0x57,0xF5,0xDB,0x62,
|
||||
0xFB,0xE5,0x69,0xFC,0xEE,0x6F,0xFD,0xF3,0x77,0xFD,0xF3,0x7F,
|
||||
0x5C,0x27,0x00,0x5C,0x2F,0x00,0x71,0x3B,0x00,0x7B,0x48,0x00,
|
||||
0xB9,0x68,0x20,0xBB,0x72,0x20,0xC5,0x86,0x29,0xD7,0x96,0x33,
|
||||
0xE6,0xA4,0x40,0xF4,0xB1,0x4B,0xFD,0xC1,0x58,0xFF,0xCC,0x55,
|
||||
0xFF,0xD4,0x61,0xFF,0xDD,0x69,0xFF,0xE6,0x79,0xFF,0xEA,0x98
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// PALETTE PAL
|
||||
// --------------------------------------------------------------------------------------
|
||||
static const byte REGION_PALETTE_PAL[ ] = {
|
||||
0x00,0x00,0x00,0x1c,0x1c,0x1c,0x39,0x39,0x39,0x59,0x59,0x59,
|
||||
0x79,0x79,0x79,0x92,0x92,0x92,0xab,0xab,0xab,0xbc,0xbc,0xbc,
|
||||
0xcd,0xcd,0xcd,0xd9,0xd9,0xd9,0xe6,0xe6,0xe6,0xec,0xec,0xec,
|
||||
0xf2,0xf2,0xf2,0xf8,0xf8,0xf8,0xff,0xff,0xff,0xff,0xff,0xff,
|
||||
0x26,0x30,0x01,0x24,0x38,0x03,0x23,0x40,0x05,0x51,0x54,0x1b,
|
||||
0x80,0x69,0x31,0x97,0x81,0x35,0xaf,0x99,0x3a,0xc2,0xa7,0x3e,
|
||||
0xd5,0xb5,0x43,0xdb,0xc0,0x3d,0xe1,0xcb,0x38,0xe2,0xd8,0x36,
|
||||
0xe3,0xe5,0x34,0xef,0xf2,0x58,0xfb,0xff,0x7d,0xfb,0xff,0x7d,
|
||||
0x39,0x17,0x01,0x5e,0x23,0x04,0x83,0x30,0x08,0xa5,0x47,0x16,
|
||||
0xc8,0x5f,0x24,0xe3,0x78,0x20,0xff,0x91,0x1d,0xff,0xab,0x1d,
|
||||
0xff,0xc5,0x1d,0xff,0xce,0x34,0xff,0xd8,0x4c,0xff,0xe6,0x51,
|
||||
0xff,0xf4,0x56,0xff,0xf9,0x77,0xff,0xff,0x98,0xff,0xff,0x98,
|
||||
0x45,0x19,0x04,0x72,0x1e,0x11,0x9f,0x24,0x1e,0xb3,0x3a,0x20,
|
||||
0xc8,0x51,0x22,0xe3,0x69,0x20,0xff,0x81,0x1e,0xff,0x8c,0x25,
|
||||
0xff,0x98,0x2c,0xff,0xae,0x38,0xff,0xc5,0x45,0xff,0xc5,0x59,
|
||||
0xff,0xc6,0x6d,0xff,0xd5,0x87,0xff,0xe4,0xa1,0xff,0xe4,0xa1,
|
||||
0x4a,0x17,0x04,0x7e,0x1a,0x0d,0xb2,0x1d,0x17,0xc8,0x21,0x19,
|
||||
0xdf,0x25,0x1c,0xec,0x3b,0x38,0xfa,0x52,0x55,0xfc,0x61,0x61,
|
||||
0xff,0x70,0x6e,0xff,0x7f,0x7e,0xff,0x8f,0x8f,0xff,0x9d,0x9e,
|
||||
0xff,0xab,0xad,0xff,0xb9,0xbd,0xff,0xc7,0xce,0xff,0xc7,0xce,
|
||||
0x05,0x05,0x68,0x3b,0x13,0x6d,0x71,0x22,0x72,0x8b,0x2a,0x8c,
|
||||
0xa5,0x32,0xa6,0xb9,0x38,0xba,0xcd,0x3e,0xcf,0xdb,0x47,0xdd,
|
||||
0xea,0x51,0xeb,0xf4,0x5f,0xf5,0xfe,0x6d,0xff,0xfe,0x7a,0xfd,
|
||||
0xff,0x87,0xfb,0xff,0x95,0xfd,0xff,0xa4,0xff,0xff,0xa4,0xff,
|
||||
0x28,0x04,0x79,0x40,0x09,0x84,0x59,0x0f,0x90,0x70,0x24,0x9d,
|
||||
0x88,0x39,0xaa,0xa4,0x41,0xc3,0xc0,0x4a,0xdc,0xd0,0x54,0xed,
|
||||
0xe0,0x5e,0xff,0xe9,0x6d,0xff,0xf2,0x7c,0xff,0xf8,0x8a,0xff,
|
||||
0xff,0x98,0xff,0xfe,0xa1,0xff,0xfe,0xab,0xff,0xfe,0xab,0xff,
|
||||
0x35,0x08,0x8a,0x42,0x0a,0xad,0x50,0x0c,0xd0,0x64,0x28,0xd0,
|
||||
0x79,0x45,0xd0,0x8d,0x4b,0xd4,0xa2,0x51,0xd9,0xb0,0x58,0xec,
|
||||
0xbe,0x60,0xff,0xc5,0x6b,0xff,0xcc,0x77,0xff,0xd1,0x83,0xff,
|
||||
0xd7,0x90,0xff,0xdb,0x9d,0xff,0xdf,0xaa,0xff,0xdf,0xaa,0xff,
|
||||
0x05,0x1e,0x81,0x06,0x26,0xa5,0x08,0x2f,0xca,0x26,0x3d,0xd4,
|
||||
0x44,0x4c,0xde,0x4f,0x5a,0xee,0x5a,0x68,0xff,0x65,0x75,0xff,
|
||||
0x71,0x83,0xff,0x80,0x91,0xff,0x90,0xa0,0xff,0x97,0xa9,0xff,
|
||||
0x9f,0xb2,0xff,0xaf,0xbe,0xff,0xc0,0xcb,0xff,0xc0,0xcb,0xff,
|
||||
0x05,0x1e,0x81,0x06,0x26,0xa5,0x08,0x2f,0xca,0x26,0x3d,0xd4,
|
||||
0x44,0x4c,0xde,0x4f,0x5a,0xee,0x5a,0x68,0xff,0x65,0x75,0xff,
|
||||
0x71,0x83,0xff,0x80,0x91,0xff,0x90,0xa0,0xff,0x97,0xa9,0xff,
|
||||
0x9f,0xb2,0xff,0xaf,0xbe,0xff,0xc0,0xcb,0xff,0xc0,0xcb,0xff,
|
||||
0x0c,0x04,0x8b,0x22,0x18,0xa0,0x38,0x2d,0xb5,0x48,0x3e,0xc7,
|
||||
0x58,0x4f,0xda,0x61,0x59,0xec,0x6b,0x64,0xff,0x7a,0x74,0xff,
|
||||
0x8a,0x84,0xff,0x91,0x8e,0xff,0x99,0x98,0xff,0xa5,0xa3,0xff,
|
||||
0xb1,0xae,0xff,0xb8,0xb8,0xff,0xc0,0xc2,0xff,0xc0,0xc2,0xff,
|
||||
0x1d,0x29,0x5a,0x1d,0x38,0x76,0x1d,0x48,0x92,0x1c,0x5c,0xac,
|
||||
0x1c,0x71,0xc6,0x32,0x86,0xcf,0x48,0x9b,0xd9,0x4e,0xa8,0xec,
|
||||
0x55,0xb6,0xff,0x70,0xc7,0xff,0x8c,0xd8,0xff,0x93,0xdb,0xff,
|
||||
0x9b,0xdf,0xff,0xaf,0xe4,0xff,0xc3,0xe9,0xff,0xc3,0xe9,0xff,
|
||||
0x2f,0x43,0x02,0x39,0x52,0x02,0x44,0x61,0x03,0x41,0x7a,0x12,
|
||||
0x3e,0x94,0x21,0x4a,0x9f,0x2e,0x57,0xab,0x3b,0x5c,0xbd,0x55,
|
||||
0x61,0xd0,0x70,0x69,0xe2,0x7a,0x72,0xf5,0x84,0x7c,0xfa,0x8d,
|
||||
0x87,0xff,0x97,0x9a,0xff,0xa6,0xad,0xff,0xb6,0xad,0xff,0xb6,
|
||||
0x0a,0x41,0x08,0x0d,0x54,0x0a,0x10,0x68,0x0d,0x13,0x7d,0x0f,
|
||||
0x16,0x92,0x12,0x19,0xa5,0x14,0x1c,0xb9,0x17,0x1e,0xc9,0x19,
|
||||
0x21,0xd9,0x1b,0x47,0xe4,0x2d,0x6e,0xf0,0x40,0x78,0xf7,0x4d,
|
||||
0x83,0xff,0x5b,0x9a,0xff,0x7a,0xb2,0xff,0x9a,0xb2,0xff,0x9a,
|
||||
0x04,0x41,0x0b,0x05,0x53,0x0e,0x06,0x66,0x11,0x07,0x77,0x14,
|
||||
0x08,0x88,0x17,0x09,0x9b,0x1a,0x0b,0xaf,0x1d,0x48,0xc4,0x1f,
|
||||
0x86,0xd9,0x22,0x8f,0xe9,0x24,0x99,0xf9,0x27,0xa8,0xfc,0x41,
|
||||
0xb7,0xff,0x5b,0xc9,0xff,0x6e,0xdc,0xff,0x81,0xdc,0xff,0x81,
|
||||
0x02,0x35,0x0f,0x07,0x3f,0x15,0x0c,0x4a,0x1c,0x2d,0x5f,0x1e,
|
||||
0x4f,0x74,0x20,0x59,0x83,0x24,0x64,0x92,0x28,0x82,0xa1,0x2e,
|
||||
0xa1,0xb0,0x34,0xa9,0xc1,0x3a,0xb2,0xd2,0x41,0xc4,0xd9,0x45,
|
||||
0xd6,0xe1,0x49,0xe4,0xf0,0x4e,0xf2,0xff,0x53,0xf2,0xff,0x53,
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Reset
|
||||
// ----------------------------------------------------------------------------
|
||||
void region_Reset( ) {
|
||||
if(region_type == REGION_PAL || (region_type == REGION_AUTO && cartridge_region == REGION_PAL)) {
|
||||
maria_displayArea = REGION_DISPLAY_AREA_PAL;
|
||||
maria_visibleArea = REGION_VISIBLE_AREA_PAL;
|
||||
if(palette_default)
|
||||
palette_Load(REGION_PALETTE_PAL); // Added check for default - bberlin
|
||||
prosystem_frequency = REGION_FREQUENCY_PAL;
|
||||
prosystem_scanlines = REGION_SCANLINES_PAL;
|
||||
tia_size = 624;
|
||||
pokey_size = 624;
|
||||
}
|
||||
else {
|
||||
maria_displayArea = REGION_DISPLAY_AREA_NTSC;
|
||||
maria_visibleArea = REGION_VISIBLE_AREA_NTSC;
|
||||
if(palette_default)
|
||||
palette_Load(REGION_PALETTE_NTSC); // Added check for default - bberlin
|
||||
prosystem_frequency = REGION_FREQUENCY_NTSC;
|
||||
prosystem_scanlines = REGION_SCANLINES_NTSC;
|
||||
tia_size = 524;
|
||||
pokey_size = 524;
|
||||
}
|
||||
pokey_setSampleRate((prosystem_scanlines * prosystem_frequency) << 1);
|
||||
}
|
||||
-270
@@ -1,270 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Riot.cpp
|
||||
// ----------------------------------------------------------------------------
|
||||
#include "Riot.h"
|
||||
|
||||
bool riot_timing = false;
|
||||
word riot_timer = TIM64T;
|
||||
byte riot_intervals;
|
||||
|
||||
byte riot_dra = 0;
|
||||
byte riot_drb = 0;
|
||||
static bool riot_elapsed;
|
||||
static int riot_currentTime;
|
||||
word riot_clocks;
|
||||
|
||||
void riot_Reset(void) {
|
||||
riot_SetDRA(0);
|
||||
riot_SetDRB(0);
|
||||
|
||||
riot_timing = false;
|
||||
riot_timer = TIM64T;
|
||||
riot_intervals = 0;
|
||||
riot_clocks = 0;
|
||||
|
||||
riot_elapsed = false;
|
||||
riot_currentTime = 0;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// SetInput
|
||||
// +----------+--------------+-------------------------------------------------
|
||||
// | Offset | Controller | Control
|
||||
// +----------+--------------+-------------------------------------------------
|
||||
// | 00 | Joystick 1 | Right
|
||||
// | 01 | Joystick 1 | Left
|
||||
// | 02 | Joystick 1 | Down
|
||||
// | 03 | Joystick 1 | Up
|
||||
// | 04 | Joystick 1 | Button 1
|
||||
// | 05 | Joystick 1 | Button 2
|
||||
// | 06 | Joystick 2 | Right
|
||||
// | 07 | Joystick 2 | Left
|
||||
// | 08 | Joystick 2 | Down
|
||||
// | 09 | Joystick 2 | Up
|
||||
// | 10 | Joystick 2 | Button 1
|
||||
// | 11 | Joystick 2 | Button 2
|
||||
// | 12 | Console | Reset
|
||||
// | 13 | Console | Select
|
||||
// | 14 | Console | Pause
|
||||
// | 15 | Console | Left Difficulty
|
||||
// | 16 | Console | Right Difficulty
|
||||
// +----------+--------------+-------------------------------------------------
|
||||
void riot_SetInput(const byte* input) {
|
||||
|
||||
/*gdement: Comments are messy, but wanted to document how this all works.
|
||||
Changed this routine to support 1 vs 2 button modes.
|
||||
Also added the interaction of CTLSWA and DRA on the SWCHA output, and same for SWCHB.
|
||||
SWCHA is directionals. SWCHB is console switches and button mode.
|
||||
button signals are in high bits of INPT0-5.*/
|
||||
|
||||
memory_ram[SWCHA] = ((~memory_ram[CTLSWA]) | riot_dra); /*SWCHA as driven by RIOT*/
|
||||
/*now console switches will force bits to ground:*/
|
||||
if (input[0x00]) memory_ram[SWCHA] = memory_ram[SWCHA] &~ 0x80;
|
||||
if (input[0x01]) memory_ram[SWCHA] = memory_ram[SWCHA] &~ 0x40;
|
||||
if (input[0x02]) memory_ram[SWCHA] = memory_ram[SWCHA] &~ 0x20;
|
||||
if (input[0x03]) memory_ram[SWCHA] = memory_ram[SWCHA] &~ 0x10;
|
||||
if (input[0x06]) memory_ram[SWCHA] = memory_ram[SWCHA] &~ 0x08;
|
||||
if (input[0x07]) memory_ram[SWCHA] = memory_ram[SWCHA] &~ 0x04;
|
||||
if (input[0x08]) memory_ram[SWCHA] = memory_ram[SWCHA] &~ 0x02;
|
||||
if (input[0x09]) memory_ram[SWCHA] = memory_ram[SWCHA] &~ 0x01;
|
||||
/*Switches can always push the appropriate bit of SWCHA to ground, as in above code block.
|
||||
In addition, RIOT can be configured to drive ground even when switch is open.
|
||||
By doing this it's possible for real hardware to behave as if switches are permanently held (tested this).*/
|
||||
|
||||
|
||||
/*As with swcha, the value seen at SWCHB is derived from CTLSWB and DRB (an internal RIOT register)
|
||||
(Any write to SWCHB actually gets stored in DRB)
|
||||
If a given bit in CTLSWB is 0 (input mode), then RIOT puts a 1 on SWCHB.
|
||||
If bit in CTLSWB is 1 (output mode), then RIOT puts stored DRB value on SWCHB.
|
||||
The SWCHB outputs from RIOT can be overdriven to 0 by console switches.
|
||||
The CTLSWB/DRB interaction is important at bits 2 and 4, which control button mode for each player.
|
||||
Bit 5 appears unused, and other bits are the console switches.
|
||||
|
||||
CTLSWB DRB SWCHB result on button mode (for bits 2 and 4)
|
||||
------- --- ----- -----------------------------------------
|
||||
0 0 1 1 button mode - this is default state after boot
|
||||
0 1 1 1 button mode
|
||||
1 0 0 2 button mode
|
||||
1 1 1 1 button mode
|
||||
This chart was confirmed on hardware
|
||||
From the default state after boot, simply changing CTLSWB to 1 will result in 2 button mode.
|
||||
Some games rely on this, and don't actually store anything to SWCHB.*/
|
||||
|
||||
memory_ram[SWCHB] = ((~memory_ram[CTLSWB]) | riot_drb); /*SWCHB as driven by RIOT*/
|
||||
|
||||
if(input != NULL)
|
||||
{
|
||||
/*now the console switches can force certain bits to ground:*/
|
||||
if (input[0x0c]) memory_ram[SWCHB] = memory_ram[SWCHB] &~ 0x01;
|
||||
if (input[0x0d]) memory_ram[SWCHB] = memory_ram[SWCHB] &~ 0x02;
|
||||
if (input[0x0e]) memory_ram[SWCHB] = memory_ram[SWCHB] &~ 0x08;
|
||||
if (input[0x0f]) memory_ram[SWCHB] = memory_ram[SWCHB] &~ 0x40;
|
||||
if (input[0x10]) memory_ram[SWCHB] = memory_ram[SWCHB] &~ 0x80;
|
||||
}
|
||||
|
||||
/*When in 1 button mode, only the legacy 2600 button signal is active. The others stay off.
|
||||
When in 2 button mode, only the new signals are active. 2600 button stays off. (tested)
|
||||
see: http://www.atariage.com/forums/index.php?showtopic=127162
|
||||
also see 7800 schematic and RIOT datasheet */
|
||||
|
||||
if(memory_ram[SWCHB] & 0x04) //first player in 1 button mode
|
||||
{
|
||||
memory_ram[INPT0] &= 0x7f; //new style buttons are always off in this mode
|
||||
memory_ram[INPT1] &= 0x7f;
|
||||
if(input[0x04] || input[0x05]) //in this mode, either button triggers only the legacy button signal
|
||||
{
|
||||
memory_ram[INPT4] &= 0x7f; //this button signal activates by turning off the high bit
|
||||
}
|
||||
else
|
||||
{
|
||||
memory_ram[INPT4] |= 0x80;
|
||||
}
|
||||
}
|
||||
else //first player in 2 button mode
|
||||
{
|
||||
memory_ram[INPT4] |= 0x80; //2600 button is always off in this mode
|
||||
if(input[0x04]) //left button (button 1)
|
||||
{
|
||||
memory_ram[INPT1] |= 0x80; //these buttons activate by turning on the high bit.
|
||||
}
|
||||
else
|
||||
{
|
||||
memory_ram[INPT1] &= 0x7f;
|
||||
}
|
||||
if(input[0x05]) //right button (button 2)
|
||||
{
|
||||
memory_ram[INPT0] |= 0x80;
|
||||
}
|
||||
else
|
||||
{
|
||||
memory_ram[INPT0] &= 0x7f;
|
||||
}
|
||||
}
|
||||
|
||||
/*now repeat for 2nd player*/
|
||||
if(memory_ram[SWCHB] & 0x10)
|
||||
{
|
||||
memory_ram[INPT2] &= 0x7f;
|
||||
memory_ram[INPT3] &= 0x7f;
|
||||
if(input[0x0a] || input[0x0b])
|
||||
{
|
||||
memory_ram[INPT5] &= 0x7f;
|
||||
}
|
||||
else
|
||||
{
|
||||
memory_ram[INPT5] |= 0x80;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
memory_ram[INPT5] |= 0x80;
|
||||
if(input[0x0a])
|
||||
{
|
||||
memory_ram[INPT3] |= 0x80;
|
||||
}
|
||||
else
|
||||
{
|
||||
memory_ram[INPT3] &= 0x7f;
|
||||
}
|
||||
if(input[0x0b])
|
||||
{
|
||||
memory_ram[INPT2] |= 0x80;
|
||||
}
|
||||
else
|
||||
{
|
||||
memory_ram[INPT2] &= 0x7f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************************
|
||||
* riot_setDRA(byte data) and riot_setDRB(byte data) gdement
|
||||
* -------------------------------------------------
|
||||
* Stores a value written to SWCHA/SWCHB into the RIOT's internal DRA/DRB registers.
|
||||
* These are distinct from what you see when reading SWCHA/SWCHB.
|
||||
***********************************************************************************/
|
||||
void riot_SetDRA(byte data) {
|
||||
riot_dra=data;
|
||||
}
|
||||
void riot_SetDRB(byte data) {
|
||||
riot_drb=data;
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// SetTimer
|
||||
// ----------------------------------------------------------------------------
|
||||
void riot_SetTimer(word timer, byte intervals) {
|
||||
riot_timer = timer;
|
||||
riot_intervals = intervals;
|
||||
switch(timer) {
|
||||
case T1024T:
|
||||
riot_clocks = 1024;
|
||||
riot_timing = true;
|
||||
break;
|
||||
case TIM1T:
|
||||
riot_clocks = 1;
|
||||
riot_timing = true;
|
||||
break;
|
||||
case TIM8T:
|
||||
riot_clocks = 8;
|
||||
riot_timing = true;
|
||||
break;
|
||||
case TIM64T:
|
||||
riot_clocks = 64;
|
||||
riot_timing = true;
|
||||
break;
|
||||
}
|
||||
if(riot_timing) {
|
||||
riot_currentTime = riot_clocks * intervals;
|
||||
riot_elapsed = false;
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// UpdateTimer
|
||||
// ----------------------------------------------------------------------------
|
||||
void riot_UpdateTimer(byte cycles) {
|
||||
riot_currentTime -= cycles;
|
||||
if(!riot_elapsed && riot_currentTime > 0) {
|
||||
memory_Write(INTIM, riot_currentTime / riot_clocks);
|
||||
}
|
||||
else {
|
||||
if(riot_elapsed) {
|
||||
if(riot_currentTime >= -255) {
|
||||
memory_Write(INTIM, riot_currentTime);
|
||||
}
|
||||
else {
|
||||
memory_Write(INTIM, 0);
|
||||
riot_timing = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
riot_currentTime = riot_clocks;
|
||||
memory_Write(INTIM, 0);
|
||||
memory_ram[INTFLG] |= 0x80;
|
||||
riot_elapsed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
-1773
File diff suppressed because it is too large
Load Diff
-206
@@ -1,206 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// TiaSound is Copyright(c) 1997 by Ron Fries
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it
|
||||
// under the terms of version 2 of the GNU Library General Public License
|
||||
// as published by the Free Software Foundation.
|
||||
//
|
||||
// This library 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 Library
|
||||
// General Public License for more details.
|
||||
// To obtain a copy of the GNU Library General Public License, write to the
|
||||
// Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
// Any permitted reproduction of these routines, in whole or in part, must
|
||||
// bear this legend.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Tia.cpp
|
||||
// ----------------------------------------------------------------------------
|
||||
#include "Tia.h"
|
||||
#include <string.h>
|
||||
#define TIA_POLY4_SIZE 15
|
||||
#define TIA_POLY5_SIZE 31
|
||||
#define TIA_POLY9_SIZE 511
|
||||
|
||||
byte tia_buffer[TIA_BUFFER_SIZE] = {0};
|
||||
uint tia_size = TIA_BUFFER_SIZE; // previously was 524
|
||||
|
||||
static const byte TIA_POLY4[ ] = {1,1,0,1,1,1,0,0,0,0,1,0,1,0,0};
|
||||
static const byte TIA_POLY5[ ] = {0,0,1,0,1,1,0,0,1,1,1,1,1,0,0,0,1,1,0,1,1,1,0,1,0,1,0,0,0,0,1};
|
||||
static const byte TIA_POLY9[ ] = {0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0,1,1,1,0,0,1,0,1,0,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,0,1,1,1,0,1,1,0,0,1,0,0,1,1,1,1,0,1,0,0,0,0,1,1,0,1,1,0,0,0,1,0,0,0,1,1,1,1,0,1,0,1,1,0,1,0,1,0,0,0,0,1,1,0,1,0,1,0,0,0,1,0,1,0,0,0,1,1,1,0,0,1,1,0,1,1,0,0,1,1,1,1,1,0,0,1,1,0,0,0,1,1,0,1,0,0,0,1,1,0,0,1,1,1,1,0,0,1,0,0,0,1,1,1,0,0,1,1,0,1,0,1,1,0,1,1,0,1,0,0,1,0,0,1,1,1,1,1,1,0,1,1,1,1,0,1,1,0,0,0,0,1,1,1,1,1,0,0,0,1,0,0,0,0,1,0,0,0,1,0,1,0,1,1,0,0,0,0,1,0,1,1,1,1,0,1,0,0,0,1,1,0,0,0,1,1,1,0,1,1,1,0,1,0,0,0,0,0,0,0,0,1,0,1,0,0,1,0,0,0,0,1,1,1,0,0,0,1,1,1,0,0,1,1,0,0,1,0,0,1,0,1,1,0,0,0,0,1,0,0,0,1,0,0,0,1,0,1,1,1,1,0,0,0,1,1,1,0,0,0,1,0,0,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,0,1,0,1,1,1,1,0,0,1,0,1,0,1,1,1,0,0,0,0,0,1,1,0,1,1,0,0,0,1,0,1,0,1,0,0,0,0,1,0,1,1,1,0,0,0,0,1,0,0,1,0,1,0,0,0,1,0,1,1,1,0,0,1,1,1,1,1,1,1,0,0,0,0,0,1,0,0,1,1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,0,0,0,1,1,0,1,0,0,0,0,0,1,1,1,1,0,0,1,0,0,1,0,1,1,1,1,1,1,1,0,1,0,0,1,0,0,0,1,1,0,1,1,1,0,0,0,1,0,1,0,0,1,0,1,0,1,0,1,1,1,0,0,1,0,1,1,0,0,1,1,1,1,1,0,0,0,1,1,0};
|
||||
static const byte TIA_DIV31[ ] = {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0};
|
||||
static byte tia_volume[2] = {0};
|
||||
static byte tia_counterMax[2] = {0};
|
||||
static byte tia_counter[2] = {0};
|
||||
static byte tia_audc[2] = {0};
|
||||
static byte tia_audf[2] = {0};
|
||||
static byte tia_audv[2] = {0};
|
||||
static uint tia_poly4Cntr[2] = {0};
|
||||
static uint tia_poly5Cntr[2] = {0};
|
||||
static uint tia_poly9Cntr[2] = {0};
|
||||
static uint tia_soundCntr = 0;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ProcessChannel
|
||||
// ----------------------------------------------------------------------------
|
||||
static void tia_ProcessChannel(byte channel) {
|
||||
tia_poly5Cntr[channel]++;
|
||||
if(tia_poly5Cntr[channel] == TIA_POLY5_SIZE) {
|
||||
tia_poly5Cntr[channel] = 0;
|
||||
}
|
||||
if(((tia_audc[channel] & 2) == 0) || (((tia_audc[channel] & 1) == 0) && TIA_DIV31[tia_poly5Cntr[channel]]) || (((tia_audc[channel] & 1) == 1) && TIA_POLY5[tia_poly5Cntr[channel]])) {
|
||||
if(tia_audc[channel] & 4) {
|
||||
tia_volume[channel] = (!tia_volume[channel])? tia_audv[channel]: 0;
|
||||
}
|
||||
else if(tia_audc[channel] & 8) {
|
||||
if(tia_audc[channel] == 8) {
|
||||
tia_poly9Cntr[channel]++;
|
||||
if(tia_poly9Cntr[channel] == TIA_POLY9_SIZE) {
|
||||
tia_poly9Cntr[channel] = 0;
|
||||
}
|
||||
tia_volume[channel] = (TIA_POLY9[tia_poly9Cntr[channel]])? tia_audv[channel]: 0;
|
||||
}
|
||||
else {
|
||||
tia_volume[channel] = (TIA_POLY5[tia_poly5Cntr[channel]])? tia_audv[channel]: 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
tia_poly4Cntr[channel]++;
|
||||
if(tia_poly4Cntr[channel] == TIA_POLY4_SIZE) {
|
||||
tia_poly4Cntr[channel] = 0;
|
||||
}
|
||||
tia_volume[channel] = (TIA_POLY4[tia_poly4Cntr[channel]])? tia_audv[channel]: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Reset
|
||||
// ----------------------------------------------------------------------------
|
||||
void tia_Reset( ) {
|
||||
tia_soundCntr = 0;
|
||||
for(int index = 0; index < 2; index++) {
|
||||
tia_volume[index] = 0;
|
||||
tia_counterMax[index] = 0;
|
||||
tia_counter[index] = 0;
|
||||
tia_audc[index] = 0;
|
||||
tia_audf[index] = 0;
|
||||
tia_audv[index] = 0;
|
||||
tia_poly4Cntr[index] = 0;
|
||||
tia_poly5Cntr[index] = 0;
|
||||
tia_poly9Cntr[index] = 0;
|
||||
}
|
||||
tia_Clear( );
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Clear
|
||||
// ----------------------------------------------------------------------------
|
||||
void tia_Clear( ) {
|
||||
tia_soundCntr = 0;
|
||||
memset(tia_buffer, 0, TIA_BUFFER_SIZE);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// SetRegister
|
||||
// ----------------------------------------------------------------------------
|
||||
void tia_SetRegister(word address, byte data) {
|
||||
byte channel;
|
||||
byte frequency;
|
||||
|
||||
switch(address) {
|
||||
case AUDC0:
|
||||
tia_audc[0] = data & 15;
|
||||
channel = 0;
|
||||
break;
|
||||
case AUDC1:
|
||||
tia_audc[1] = data & 15;
|
||||
channel = 1;
|
||||
break;
|
||||
case AUDF0:
|
||||
tia_audf[0] = data & 31;
|
||||
channel = 0;
|
||||
break;
|
||||
case AUDF1:
|
||||
tia_audf[1] = data & 31;
|
||||
channel = 1;
|
||||
break;
|
||||
case AUDV0:
|
||||
tia_audv[0] = (data & 15) << 2;
|
||||
channel = 0;
|
||||
break;
|
||||
case AUDV1:
|
||||
tia_audv[1] = (data & 15) << 2;
|
||||
channel = 1;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
if(tia_audc[channel] == 0) {
|
||||
frequency = 0;
|
||||
tia_volume[channel] = tia_audv[channel];
|
||||
}
|
||||
else {
|
||||
frequency = tia_audf[channel] + 1;
|
||||
if(tia_audc[channel] > 11) {
|
||||
frequency *= 3;
|
||||
}
|
||||
}
|
||||
|
||||
if(frequency != tia_counterMax[channel]) {
|
||||
tia_counterMax[channel] = frequency;
|
||||
if(tia_counter[channel] == 0 || frequency == 0) {
|
||||
tia_counter[channel] = frequency;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// Process
|
||||
// --------------------------------------------------------------------------------------
|
||||
void tia_Process(uint length) {
|
||||
for(uint index = 0; index < length; index++) {
|
||||
if(tia_counter[0] > 1) {
|
||||
tia_counter[0]--;
|
||||
}
|
||||
else if(tia_counter[0] == 1) {
|
||||
tia_counter[0] = tia_counterMax[0];
|
||||
tia_ProcessChannel(0);
|
||||
}
|
||||
if(tia_counter[1] > 1) {
|
||||
tia_counter[1]--;
|
||||
}
|
||||
else if(tia_counter[1] == 1) {
|
||||
tia_counter[1] = tia_counterMax[1];
|
||||
tia_ProcessChannel(1);
|
||||
}
|
||||
tia_buffer[tia_soundCntr++] = tia_volume[0] + tia_volume[1];
|
||||
if(tia_soundCntr >= tia_size) {
|
||||
tia_soundCntr = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Timer.cpp
|
||||
// ----------------------------------------------------------------------------
|
||||
#include "Timer.h"
|
||||
|
||||
typedef unsigned long long uInt64;
|
||||
|
||||
static uInt64 timer_currentTime;
|
||||
static uInt64 timer_nextTime;
|
||||
static uInt64 timer_counterFrequency;
|
||||
static uint timer_frameTime;
|
||||
static bool timer_usingCounter = false;
|
||||
# if 0
|
||||
// ----------------------------------------------------------------------------
|
||||
// Initialize
|
||||
// ----------------------------------------------------------------------------
|
||||
void timer_Initialize( ) {
|
||||
timer_usingCounter = (QueryPerformanceFrequency((LARGE_INTEGER*)&timer_counterFrequency))? true: false;
|
||||
timeBeginPeriod(1);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Reset
|
||||
// ----------------------------------------------------------------------------
|
||||
void timer_Reset( ) {
|
||||
if(timer_usingCounter) {
|
||||
QueryPerformanceCounter((LARGE_INTEGER*)&timer_nextTime);
|
||||
timer_frameTime = timer_counterFrequency / prosystem_frequency;
|
||||
timer_nextTime += timer_frameTime;
|
||||
}
|
||||
else {
|
||||
timer_frameTime = (1000.0 / (double)prosystem_frequency) * 1000;
|
||||
timer_currentTime = timeGetTime( ) * 1000;
|
||||
timer_nextTime = timer_currentTime + timer_frameTime;
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// IsTime
|
||||
// ----------------------------------------------------------------------------
|
||||
bool timer_IsTime( ) {
|
||||
if(timer_usingCounter) {
|
||||
QueryPerformanceCounter((LARGE_INTEGER*)&timer_currentTime);
|
||||
}
|
||||
else {
|
||||
timer_currentTime = timeGetTime( ) * 1000;
|
||||
}
|
||||
|
||||
if(timer_currentTime >= timer_nextTime) {
|
||||
timer_nextTime += timer_frameTime;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
# endif
|
||||
@@ -1,132 +0,0 @@
|
||||
/* crypt.h -- base code for crypt/uncrypt ZIPfile
|
||||
|
||||
|
||||
Version 1.01e, February 12th, 2005
|
||||
|
||||
Copyright (C) 1998-2005 Gilles Vollant
|
||||
|
||||
This code is a modified version of crypting code in Infozip distribution
|
||||
|
||||
The encryption/decryption parts of this source code (as opposed to the
|
||||
non-echoing password parts) were originally written in Europe. The
|
||||
whole source package can be freely distributed, including from the USA.
|
||||
(Prior to January 2000, re-export from the US was a violation of US law.)
|
||||
|
||||
This encryption code is a direct transcription of the algorithm from
|
||||
Roger Schlafly, described by Phil Katz in the file appnote.txt. This
|
||||
file (appnote.txt) is distributed with the PKZIP program (even in the
|
||||
version without encryption capabilities).
|
||||
|
||||
If you don't need crypting in your application, just define symbols
|
||||
NOCRYPT and NOUNCRYPT.
|
||||
|
||||
This code support the "Traditional PKWARE Encryption".
|
||||
|
||||
The new AES encryption added on Zip format by Winzip (see the page
|
||||
http://www.winzip.com/aes_info.htm ) and PKWare PKZip 5.x Strong
|
||||
Encryption is not supported.
|
||||
*/
|
||||
|
||||
#define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8))
|
||||
|
||||
/***********************************************************************
|
||||
* Return the next byte in the pseudo-random sequence
|
||||
*/
|
||||
static int decrypt_byte(unsigned long* pkeys, const unsigned long* pcrc_32_tab)
|
||||
{
|
||||
unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an
|
||||
* unpredictable manner on 16-bit systems; not a problem
|
||||
* with any known compiler so far, though */
|
||||
|
||||
temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2;
|
||||
return (int)(((temp * (temp ^ 1)) >> 8) & 0xff);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* Update the encryption keys with the next byte of plain text
|
||||
*/
|
||||
static int update_keys(unsigned long* pkeys,const unsigned long* pcrc_32_tab,int c)
|
||||
{
|
||||
(*(pkeys+0)) = CRC32((*(pkeys+0)), c);
|
||||
(*(pkeys+1)) += (*(pkeys+0)) & 0xff;
|
||||
(*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1;
|
||||
{
|
||||
register int keyshift = (int)((*(pkeys+1)) >> 24);
|
||||
(*(pkeys+2)) = CRC32((*(pkeys+2)), keyshift);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* Initialize the encryption keys and the random header according to
|
||||
* the given password.
|
||||
*/
|
||||
static void init_keys(const char* passwd,unsigned long* pkeys,const unsigned long* pcrc_32_tab)
|
||||
{
|
||||
*(pkeys+0) = 305419896L;
|
||||
*(pkeys+1) = 591751049L;
|
||||
*(pkeys+2) = 878082192L;
|
||||
while (*passwd != '\0') {
|
||||
update_keys(pkeys,pcrc_32_tab,(int)*passwd);
|
||||
passwd++;
|
||||
}
|
||||
}
|
||||
|
||||
#define zdecode(pkeys,pcrc_32_tab,c) \
|
||||
(update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab)))
|
||||
|
||||
#define zencode(pkeys,pcrc_32_tab,c,t) \
|
||||
(t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), t^(c))
|
||||
|
||||
#ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED
|
||||
|
||||
#define RAND_HEAD_LEN 12
|
||||
/* "last resort" source for second part of crypt seed pattern */
|
||||
# ifndef ZCR_SEED2
|
||||
# define ZCR_SEED2 3141592654UL /* use PI as default pattern */
|
||||
# endif
|
||||
|
||||
static int crypthead(passwd, buf, bufSize, pkeys, pcrc_32_tab, crcForCrypting)
|
||||
const char *passwd; /* password string */
|
||||
unsigned char *buf; /* where to write header */
|
||||
int bufSize;
|
||||
unsigned long* pkeys;
|
||||
const unsigned long* pcrc_32_tab;
|
||||
unsigned long crcForCrypting;
|
||||
{
|
||||
int n; /* index in random header */
|
||||
int t; /* temporary */
|
||||
int c; /* random byte */
|
||||
unsigned char header[RAND_HEAD_LEN-2]; /* random header */
|
||||
static unsigned calls = 0; /* ensure different random header each time */
|
||||
|
||||
if (bufSize<RAND_HEAD_LEN)
|
||||
return 0;
|
||||
|
||||
/* First generate RAND_HEAD_LEN-2 random bytes. We encrypt the
|
||||
* output of rand() to get less predictability, since rand() is
|
||||
* often poorly implemented.
|
||||
*/
|
||||
if (++calls == 1)
|
||||
{
|
||||
srand((unsigned)(time(NULL) ^ ZCR_SEED2));
|
||||
}
|
||||
init_keys(passwd, pkeys, pcrc_32_tab);
|
||||
for (n = 0; n < RAND_HEAD_LEN-2; n++)
|
||||
{
|
||||
c = (rand() >> 7) & 0xff;
|
||||
header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t);
|
||||
}
|
||||
/* Encrypt random header (last two bytes is high word of crc) */
|
||||
init_keys(passwd, pkeys, pcrc_32_tab);
|
||||
for (n = 0; n < RAND_HEAD_LEN-2; n++)
|
||||
{
|
||||
buf[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, header[n], t);
|
||||
}
|
||||
buf[n++] = zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 16) & 0xff, t);
|
||||
buf[n++] = zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 24) & 0xff, t);
|
||||
return n;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,426 +0,0 @@
|
||||
/****************************************************************************
|
||||
* *
|
||||
* HtmlHelp.h *
|
||||
* *
|
||||
* Copyright (c) 1996-1997, Microsoft Corp. All rights reserved. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#ifndef __HTMLHELP_H__
|
||||
#define __HTMLHELP_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
// Defines for Win64
|
||||
#ifndef _WIN64
|
||||
#define DWORD_PTR DWORD
|
||||
#endif
|
||||
|
||||
// Commands to pass to HtmlHelp()
|
||||
|
||||
#define HH_DISPLAY_TOPIC 0x0000
|
||||
#define HH_HELP_FINDER 0x0000 // WinHelp equivalent
|
||||
#define HH_DISPLAY_TOC 0x0001
|
||||
#define HH_DISPLAY_INDEX 0x0002
|
||||
#define HH_DISPLAY_SEARCH 0x0003
|
||||
#define HH_SET_WIN_TYPE 0x0004
|
||||
#define HH_GET_WIN_TYPE 0x0005
|
||||
#define HH_GET_WIN_HANDLE 0x0006
|
||||
#define HH_ENUM_INFO_TYPE 0x0007 // Get Info type name, call repeatedly to enumerate, -1 at end
|
||||
#define HH_SET_INFO_TYPE 0x0008 // Add Info type to filter.
|
||||
#define HH_SYNC 0x0009
|
||||
#define HH_RESERVED1 0x000A
|
||||
#define HH_RESERVED2 0x000B
|
||||
#define HH_RESERVED3 0x000C
|
||||
#define HH_KEYWORD_LOOKUP 0x000D
|
||||
#define HH_DISPLAY_TEXT_POPUP 0x000E // display string resource id or text in a popup window
|
||||
#define HH_HELP_CONTEXT 0x000F // display mapped numeric value in dwData
|
||||
#define HH_TP_HELP_CONTEXTMENU 0x0010 // text popup help, same as WinHelp HELP_CONTEXTMENU
|
||||
#define HH_TP_HELP_WM_HELP 0x0011 // text popup help, same as WinHelp HELP_WM_HELP
|
||||
#define HH_CLOSE_ALL 0x0012 // close all windows opened directly or indirectly by the caller
|
||||
#define HH_ALINK_LOOKUP 0x0013 // ALink version of HH_KEYWORD_LOOKUP
|
||||
#define HH_GET_LAST_ERROR 0x0014 // not currently implemented // See HHERROR.h
|
||||
#define HH_ENUM_CATEGORY 0x0015 // Get category name, call repeatedly to enumerate, -1 at end
|
||||
#define HH_ENUM_CATEGORY_IT 0x0016 // Get category info type members, call repeatedly to enumerate, -1 at end
|
||||
#define HH_RESET_IT_FILTER 0x0017 // Clear the info type filter of all info types.
|
||||
#define HH_SET_INCLUSIVE_FILTER 0x0018 // set inclusive filtering method for untyped topics to be included in display
|
||||
#define HH_SET_EXCLUSIVE_FILTER 0x0019 // set exclusive filtering method for untyped topics to be excluded from display
|
||||
#define HH_INITIALIZE 0x001C // Initializes the help system.
|
||||
#define HH_UNINITIALIZE 0x001D // Uninitializes the help system.
|
||||
#define HH_PRETRANSLATEMESSAGE 0x00fd // Pumps messages. (NULL, NULL, MSG*).
|
||||
#define HH_SET_GLOBAL_PROPERTY 0x00fc // Set a global property. (NULL, NULL, HH_GPROP)
|
||||
|
||||
#define HHWIN_PROP_TAB_AUTOHIDESHOW (1 << 0) // Automatically hide/show tri-pane window
|
||||
#define HHWIN_PROP_ONTOP (1 << 1) // Top-most window
|
||||
#define HHWIN_PROP_NOTITLEBAR (1 << 2) // no title bar
|
||||
#define HHWIN_PROP_NODEF_STYLES (1 << 3) // no default window styles (only HH_WINTYPE.dwStyles)
|
||||
#define HHWIN_PROP_NODEF_EXSTYLES (1 << 4) // no default extended window styles (only HH_WINTYPE.dwExStyles)
|
||||
#define HHWIN_PROP_TRI_PANE (1 << 5) // use a tri-pane window
|
||||
#define HHWIN_PROP_NOTB_TEXT (1 << 6) // no text on toolbar buttons
|
||||
#define HHWIN_PROP_POST_QUIT (1 << 7) // post WM_QUIT message when window closes
|
||||
#define HHWIN_PROP_AUTO_SYNC (1 << 8) // automatically ssync contents and index
|
||||
#define HHWIN_PROP_TRACKING (1 << 9) // send tracking notification messages
|
||||
#define HHWIN_PROP_TAB_SEARCH (1 << 10) // include search tab in navigation pane
|
||||
#define HHWIN_PROP_TAB_HISTORY (1 << 11) // include history tab in navigation pane
|
||||
#define HHWIN_PROP_TAB_FAVORITES (1 << 12) // include favorites tab in navigation pane
|
||||
#define HHWIN_PROP_CHANGE_TITLE (1 << 13) // Put current HTML title in title bar
|
||||
#define HHWIN_PROP_NAV_ONLY_WIN (1 << 14) // Only display the navigation window
|
||||
#define HHWIN_PROP_NO_TOOLBAR (1 << 15) // Don't display a toolbar
|
||||
#define HHWIN_PROP_MENU (1 << 16) // Menu
|
||||
#define HHWIN_PROP_TAB_ADVSEARCH (1 << 17) // Advanced FTS UI.
|
||||
#define HHWIN_PROP_USER_POS (1 << 18) // After initial creation, user controls window size/position
|
||||
#define HHWIN_PROP_TAB_CUSTOM1 (1 << 19) // Use custom tab #1
|
||||
#define HHWIN_PROP_TAB_CUSTOM2 (1 << 20) // Use custom tab #2
|
||||
#define HHWIN_PROP_TAB_CUSTOM3 (1 << 21) // Use custom tab #3
|
||||
#define HHWIN_PROP_TAB_CUSTOM4 (1 << 22) // Use custom tab #4
|
||||
#define HHWIN_PROP_TAB_CUSTOM5 (1 << 23) // Use custom tab #5
|
||||
#define HHWIN_PROP_TAB_CUSTOM6 (1 << 24) // Use custom tab #6
|
||||
#define HHWIN_PROP_TAB_CUSTOM7 (1 << 25) // Use custom tab #7
|
||||
#define HHWIN_PROP_TAB_CUSTOM8 (1 << 26) // Use custom tab #8
|
||||
#define HHWIN_PROP_TAB_CUSTOM9 (1 << 27) // Use custom tab #9
|
||||
#define HHWIN_TB_MARGIN (1 << 28) // the window type has a margin
|
||||
|
||||
#define HHWIN_PARAM_PROPERTIES (1 << 1) // valid fsWinProperties
|
||||
#define HHWIN_PARAM_STYLES (1 << 2) // valid dwStyles
|
||||
#define HHWIN_PARAM_EXSTYLES (1 << 3) // valid dwExStyles
|
||||
#define HHWIN_PARAM_RECT (1 << 4) // valid rcWindowPos
|
||||
#define HHWIN_PARAM_NAV_WIDTH (1 << 5) // valid iNavWidth
|
||||
#define HHWIN_PARAM_SHOWSTATE (1 << 6) // valid nShowState
|
||||
#define HHWIN_PARAM_INFOTYPES (1 << 7) // valid apInfoTypes
|
||||
#define HHWIN_PARAM_TB_FLAGS (1 << 8) // valid fsToolBarFlags
|
||||
#define HHWIN_PARAM_EXPANSION (1 << 9) // valid fNotExpanded
|
||||
#define HHWIN_PARAM_TABPOS (1 << 10) // valid tabpos
|
||||
#define HHWIN_PARAM_TABORDER (1 << 11) // valid taborder
|
||||
#define HHWIN_PARAM_HISTORY_COUNT (1 << 12) // valid cHistory
|
||||
#define HHWIN_PARAM_CUR_TAB (1 << 13) // valid curNavType
|
||||
|
||||
#define HHWIN_BUTTON_EXPAND (1 << 1) // Expand/contract button
|
||||
#define HHWIN_BUTTON_BACK (1 << 2) // Back button
|
||||
#define HHWIN_BUTTON_FORWARD (1 << 3) // Forward button
|
||||
#define HHWIN_BUTTON_STOP (1 << 4) // Stop button
|
||||
#define HHWIN_BUTTON_REFRESH (1 << 5) // Refresh button
|
||||
#define HHWIN_BUTTON_HOME (1 << 6) // Home button
|
||||
#define HHWIN_BUTTON_BROWSE_FWD (1 << 7) // not implemented
|
||||
#define HHWIN_BUTTON_BROWSE_BCK (1 << 8) // not implemented
|
||||
#define HHWIN_BUTTON_NOTES (1 << 9) // not implemented
|
||||
#define HHWIN_BUTTON_CONTENTS (1 << 10) // not implemented
|
||||
#define HHWIN_BUTTON_SYNC (1 << 11) // Sync button
|
||||
#define HHWIN_BUTTON_OPTIONS (1 << 12) // Options button
|
||||
#define HHWIN_BUTTON_PRINT (1 << 13) // Print button
|
||||
#define HHWIN_BUTTON_INDEX (1 << 14) // not implemented
|
||||
#define HHWIN_BUTTON_SEARCH (1 << 15) // not implemented
|
||||
#define HHWIN_BUTTON_HISTORY (1 << 16) // not implemented
|
||||
#define HHWIN_BUTTON_FAVORITES (1 << 17) // not implemented
|
||||
#define HHWIN_BUTTON_JUMP1 (1 << 18)
|
||||
#define HHWIN_BUTTON_JUMP2 (1 << 19)
|
||||
#define HHWIN_BUTTON_ZOOM (1 << 20)
|
||||
#define HHWIN_BUTTON_TOC_NEXT (1 << 21)
|
||||
#define HHWIN_BUTTON_TOC_PREV (1 << 22)
|
||||
|
||||
#define HHWIN_DEF_BUTTONS \
|
||||
(HHWIN_BUTTON_EXPAND | \
|
||||
HHWIN_BUTTON_BACK | \
|
||||
HHWIN_BUTTON_OPTIONS | \
|
||||
HHWIN_BUTTON_PRINT)
|
||||
|
||||
// Button IDs
|
||||
|
||||
#define IDTB_EXPAND 200
|
||||
#define IDTB_CONTRACT 201
|
||||
#define IDTB_STOP 202
|
||||
#define IDTB_REFRESH 203
|
||||
#define IDTB_BACK 204
|
||||
#define IDTB_HOME 205
|
||||
#define IDTB_SYNC 206
|
||||
#define IDTB_PRINT 207
|
||||
#define IDTB_OPTIONS 208
|
||||
#define IDTB_FORWARD 209
|
||||
#define IDTB_NOTES 210 // not implemented
|
||||
#define IDTB_BROWSE_FWD 211
|
||||
#define IDTB_BROWSE_BACK 212
|
||||
#define IDTB_CONTENTS 213 // not implemented
|
||||
#define IDTB_INDEX 214 // not implemented
|
||||
#define IDTB_SEARCH 215 // not implemented
|
||||
#define IDTB_HISTORY 216 // not implemented
|
||||
#define IDTB_FAVORITES 217 // not implemented
|
||||
#define IDTB_JUMP1 218
|
||||
#define IDTB_JUMP2 219
|
||||
#define IDTB_CUSTOMIZE 221
|
||||
#define IDTB_ZOOM 222
|
||||
#define IDTB_TOC_NEXT 223
|
||||
#define IDTB_TOC_PREV 224
|
||||
|
||||
// Notification codes
|
||||
|
||||
#define HHN_FIRST (0U-860U)
|
||||
#define HHN_LAST (0U-879U)
|
||||
|
||||
#define HHN_NAVCOMPLETE (HHN_FIRST-0)
|
||||
#define HHN_TRACK (HHN_FIRST-1)
|
||||
#define HHN_WINDOW_CREATE (HHN_FIRST-2)
|
||||
|
||||
typedef struct tagHHN_NOTIFY
|
||||
{
|
||||
NMHDR hdr;
|
||||
PCSTR pszUrl; // Multi-byte, null-terminated string
|
||||
} HHN_NOTIFY;
|
||||
|
||||
typedef struct tagHH_POPUP
|
||||
{
|
||||
int cbStruct; // sizeof this structure
|
||||
HINSTANCE hinst; // instance handle for string resource
|
||||
UINT idString; // string resource id, or text id if pszFile is specified in HtmlHelp call
|
||||
LPCTSTR pszText; // used if idString is zero
|
||||
POINT pt; // top center of popup window
|
||||
COLORREF clrForeground; // use -1 for default
|
||||
COLORREF clrBackground; // use -1 for default
|
||||
RECT rcMargins; // amount of space between edges of window and text, -1 for each member to ignore
|
||||
LPCTSTR pszFont; // facename, point size, char set, BOLD ITALIC UNDERLINE
|
||||
} HH_POPUP;
|
||||
|
||||
typedef struct tagHH_AKLINK
|
||||
{
|
||||
int cbStruct; // sizeof this structure
|
||||
BOOL fReserved; // must be FALSE (really!)
|
||||
LPCTSTR pszKeywords; // semi-colon separated keywords
|
||||
LPCTSTR pszUrl; // URL to jump to if no keywords found (may be NULL)
|
||||
LPCTSTR pszMsgText; // Message text to display in MessageBox if pszUrl is NULL and no keyword match
|
||||
LPCTSTR pszMsgTitle; // Message text to display in MessageBox if pszUrl is NULL and no keyword match
|
||||
LPCTSTR pszWindow; // Window to display URL in
|
||||
BOOL fIndexOnFail; // Displays index if keyword lookup fails.
|
||||
} HH_AKLINK;
|
||||
|
||||
enum {
|
||||
HHWIN_NAVTYPE_TOC,
|
||||
HHWIN_NAVTYPE_INDEX,
|
||||
HHWIN_NAVTYPE_SEARCH,
|
||||
HHWIN_NAVTYPE_FAVORITES,
|
||||
HHWIN_NAVTYPE_HISTORY, // not implemented
|
||||
HHWIN_NAVTYPE_AUTHOR,
|
||||
HHWIN_NAVTYPE_CUSTOM_FIRST = 11
|
||||
};
|
||||
|
||||
enum {
|
||||
IT_INCLUSIVE,
|
||||
IT_EXCLUSIVE,
|
||||
IT_HIDDEN,
|
||||
};
|
||||
|
||||
typedef struct tagHH_ENUM_IT
|
||||
{
|
||||
int cbStruct; // size of this structure
|
||||
int iType; // the type of the information type ie. Inclusive, Exclusive, or Hidden
|
||||
LPCSTR pszCatName; // Set to the name of the Category to enumerate the info types in a category; else NULL
|
||||
LPCSTR pszITName; // volitile pointer to the name of the infotype. Allocated by call. Caller responsible for freeing
|
||||
LPCSTR pszITDescription; // volitile pointer to the description of the infotype.
|
||||
} HH_ENUM_IT, *PHH_ENUM_IT;
|
||||
|
||||
typedef struct tagHH_ENUM_CAT
|
||||
{
|
||||
int cbStruct; // size of this structure
|
||||
LPCSTR pszCatName; // volitile pointer to the category name
|
||||
LPCSTR pszCatDescription; // volitile pointer to the category description
|
||||
} HH_ENUM_CAT, *PHH_ENUM_CAT;
|
||||
|
||||
typedef struct tagHH_SET_INFOTYPE
|
||||
{
|
||||
int cbStruct; // the size of this structure
|
||||
LPCSTR pszCatName; // the name of the category, if any, the InfoType is a member of.
|
||||
LPCSTR pszInfoTypeName; // the name of the info type to add to the filter
|
||||
} HH_SET_INFOTYPE, *PHH_SET_INFOTYPE;
|
||||
|
||||
typedef DWORD HH_INFOTYPE;
|
||||
typedef HH_INFOTYPE* PHH_INFOTYPE;
|
||||
|
||||
enum {
|
||||
HHWIN_NAVTAB_TOP,
|
||||
HHWIN_NAVTAB_LEFT,
|
||||
HHWIN_NAVTAB_BOTTOM,
|
||||
};
|
||||
|
||||
#define HH_MAX_TABS 19 // maximum number of tabs
|
||||
|
||||
enum {
|
||||
HH_TAB_CONTENTS,
|
||||
HH_TAB_INDEX,
|
||||
HH_TAB_SEARCH,
|
||||
HH_TAB_FAVORITES,
|
||||
HH_TAB_HISTORY,
|
||||
HH_TAB_AUTHOR,
|
||||
|
||||
HH_TAB_CUSTOM_FIRST = 11,
|
||||
HH_TAB_CUSTOM_LAST = HH_MAX_TABS
|
||||
};
|
||||
|
||||
#define HH_MAX_TABS_CUSTOM (HH_TAB_CUSTOM_LAST - HH_TAB_CUSTOM_FIRST + 1)
|
||||
|
||||
// HH_DISPLAY_SEARCH Command Related Structures and Constants
|
||||
|
||||
#define HH_FTS_DEFAULT_PROXIMITY (-1)
|
||||
|
||||
typedef struct tagHH_FTS_QUERY
|
||||
{
|
||||
int cbStruct; // Sizeof structure in bytes.
|
||||
BOOL fUniCodeStrings; // TRUE if all strings are unicode.
|
||||
LPCTSTR pszSearchQuery; // String containing the search query.
|
||||
LONG iProximity; // Word proximity.
|
||||
BOOL fStemmedSearch; // TRUE for StemmedSearch only.
|
||||
BOOL fTitleOnly; // TRUE for Title search only.
|
||||
BOOL fExecute; // TRUE to initiate the search.
|
||||
LPCTSTR pszWindow; // Window to display in
|
||||
} HH_FTS_QUERY;
|
||||
|
||||
// HH_WINTYPE Structure
|
||||
|
||||
typedef struct tagHH_WINTYPE {
|
||||
int cbStruct; // IN: size of this structure including all Information Types
|
||||
BOOL fUniCodeStrings; // IN/OUT: TRUE if all strings are in UNICODE
|
||||
LPCTSTR pszType; // IN/OUT: Name of a type of window
|
||||
DWORD fsValidMembers; // IN: Bit flag of valid members (HHWIN_PARAM_)
|
||||
DWORD fsWinProperties; // IN/OUT: Properties/attributes of the window (HHWIN_)
|
||||
|
||||
LPCTSTR pszCaption; // IN/OUT: Window title
|
||||
DWORD dwStyles; // IN/OUT: Window styles
|
||||
DWORD dwExStyles; // IN/OUT: Extended Window styles
|
||||
RECT rcWindowPos; // IN: Starting position, OUT: current position
|
||||
int nShowState; // IN: show state (e.g., SW_SHOW)
|
||||
|
||||
HWND hwndHelp; // OUT: window handle
|
||||
HWND hwndCaller; // OUT: who called this window
|
||||
|
||||
HH_INFOTYPE* paInfoTypes; // IN: Pointer to an array of Information Types
|
||||
|
||||
// The following members are only valid if HHWIN_PROP_TRI_PANE is set
|
||||
|
||||
HWND hwndToolBar; // OUT: toolbar window in tri-pane window
|
||||
HWND hwndNavigation; // OUT: navigation window in tri-pane window
|
||||
HWND hwndHTML; // OUT: window displaying HTML in tri-pane window
|
||||
int iNavWidth; // IN/OUT: width of navigation window
|
||||
RECT rcHTML; // OUT: HTML window coordinates
|
||||
|
||||
LPCTSTR pszToc; // IN: Location of the table of contents file
|
||||
LPCTSTR pszIndex; // IN: Location of the index file
|
||||
LPCTSTR pszFile; // IN: Default location of the html file
|
||||
LPCTSTR pszHome; // IN/OUT: html file to display when Home button is clicked
|
||||
DWORD fsToolBarFlags; // IN: flags controling the appearance of the toolbar
|
||||
BOOL fNotExpanded; // IN: TRUE/FALSE to contract or expand, OUT: current state
|
||||
int curNavType; // IN/OUT: UI to display in the navigational pane
|
||||
int tabpos; // IN/OUT: HHWIN_NAVTAB_TOP, HHWIN_NAVTAB_LEFT, or HHWIN_NAVTAB_BOTTOM
|
||||
int idNotify; // IN: ID to use for WM_NOTIFY messages
|
||||
BYTE tabOrder[HH_MAX_TABS + 1]; // IN/OUT: tab order: Contents, Index, Search, History, Favorites, Reserved 1-5, Custom tabs
|
||||
int cHistory; // IN/OUT: number of history items to keep (default is 30)
|
||||
LPCTSTR pszJump1; // Text for HHWIN_BUTTON_JUMP1
|
||||
LPCTSTR pszJump2; // Text for HHWIN_BUTTON_JUMP2
|
||||
LPCTSTR pszUrlJump1; // URL for HHWIN_BUTTON_JUMP1
|
||||
LPCTSTR pszUrlJump2; // URL for HHWIN_BUTTON_JUMP2
|
||||
RECT rcMinSize; // Minimum size for window (ignored in version 1)
|
||||
int cbInfoTypes; // size of paInfoTypes;
|
||||
LPCTSTR pszCustomTabs; // multiple zero-terminated strings
|
||||
} HH_WINTYPE, *PHH_WINTYPE;
|
||||
|
||||
enum {
|
||||
HHACT_TAB_CONTENTS,
|
||||
HHACT_TAB_INDEX,
|
||||
HHACT_TAB_SEARCH,
|
||||
HHACT_TAB_HISTORY,
|
||||
HHACT_TAB_FAVORITES,
|
||||
|
||||
HHACT_EXPAND,
|
||||
HHACT_CONTRACT,
|
||||
HHACT_BACK,
|
||||
HHACT_FORWARD,
|
||||
HHACT_STOP,
|
||||
HHACT_REFRESH,
|
||||
HHACT_HOME,
|
||||
HHACT_SYNC,
|
||||
HHACT_OPTIONS,
|
||||
HHACT_PRINT,
|
||||
HHACT_HIGHLIGHT,
|
||||
HHACT_CUSTOMIZE,
|
||||
HHACT_JUMP1,
|
||||
HHACT_JUMP2,
|
||||
HHACT_ZOOM,
|
||||
HHACT_TOC_NEXT,
|
||||
HHACT_TOC_PREV,
|
||||
HHACT_NOTES,
|
||||
|
||||
HHACT_LAST_ENUM,
|
||||
};
|
||||
|
||||
typedef struct tagHHNTRACK
|
||||
{
|
||||
NMHDR hdr;
|
||||
PCSTR pszCurUrl; // Multi-byte, null-terminated string
|
||||
int idAction; // HHACT_ value
|
||||
HH_WINTYPE* phhWinType; // Current window type structure
|
||||
} HHNTRACK;
|
||||
|
||||
HWND
|
||||
WINAPI
|
||||
HtmlHelpA(
|
||||
HWND hwndCaller,
|
||||
LPCSTR pszFile,
|
||||
UINT uCommand,
|
||||
DWORD_PTR dwData
|
||||
);
|
||||
|
||||
HWND
|
||||
WINAPI
|
||||
HtmlHelpW(
|
||||
HWND hwndCaller,
|
||||
LPCWSTR pszFile,
|
||||
UINT uCommand,
|
||||
DWORD_PTR dwData
|
||||
);
|
||||
#ifdef UNICODE
|
||||
#define HtmlHelp HtmlHelpW
|
||||
#else
|
||||
#define HtmlHelp HtmlHelpA
|
||||
#endif // !UNICODE
|
||||
|
||||
// Use the following for GetProcAddress to load from hhctrl.ocx
|
||||
|
||||
#define ATOM_HTMLHELP_API_ANSI (LPTSTR)((DWORD)((WORD)(14)))
|
||||
#define ATOM_HTMLHELP_API_UNICODE (LPTSTR)((DWORD)((WORD)(15)))
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Global Control Properties.
|
||||
//
|
||||
typedef enum tagHH_GPROPID
|
||||
{
|
||||
HH_GPROPID_SINGLETHREAD=1, // VARIANT_BOOL: True for single thread
|
||||
HH_GPROPID_TOOLBAR_MARGIN=2, // long: Provides a left/right margin around the toolbar.
|
||||
HH_GPROPID_UI_LANGUAGE=3, // long: LangId of the UI.
|
||||
HH_GPROPID_CURRENT_SUBSET=4, // BSTR: Current subset.
|
||||
HH_GPROPID_CONTENT_LANGUAGE=5 // long: LandId for desired content.
|
||||
} HH_GPROPID;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Global Property structure
|
||||
//
|
||||
#ifdef __oaidl_h__
|
||||
|
||||
#pragma pack(push, 8)
|
||||
|
||||
typedef struct tagHH_GLOBAL_PROPERTY
|
||||
{
|
||||
HH_GPROPID id;
|
||||
VARIANT var;
|
||||
} HH_GLOBAL_PROPERTY ;
|
||||
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // __HTMLHELP_H__
|
||||
@@ -1,75 +0,0 @@
|
||||
/* ioapi.h -- IO base function header for compress/uncompress .zip
|
||||
files using zlib + zip or unzip API
|
||||
|
||||
Version 1.01e, February 12th, 2005
|
||||
|
||||
Copyright (C) 1998-2005 Gilles Vollant
|
||||
*/
|
||||
|
||||
#ifndef _ZLIBIOAPI_H
|
||||
#define _ZLIBIOAPI_H
|
||||
|
||||
|
||||
#define ZLIB_FILEFUNC_SEEK_CUR (1)
|
||||
#define ZLIB_FILEFUNC_SEEK_END (2)
|
||||
#define ZLIB_FILEFUNC_SEEK_SET (0)
|
||||
|
||||
#define ZLIB_FILEFUNC_MODE_READ (1)
|
||||
#define ZLIB_FILEFUNC_MODE_WRITE (2)
|
||||
#define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3)
|
||||
|
||||
#define ZLIB_FILEFUNC_MODE_EXISTING (4)
|
||||
#define ZLIB_FILEFUNC_MODE_CREATE (8)
|
||||
|
||||
|
||||
#ifndef ZCALLBACK
|
||||
|
||||
#if (defined(WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK)
|
||||
#define ZCALLBACK CALLBACK
|
||||
#else
|
||||
#define ZCALLBACK
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode));
|
||||
typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size));
|
||||
typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
|
||||
typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream));
|
||||
typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin));
|
||||
typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream));
|
||||
typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream));
|
||||
|
||||
typedef struct zlib_filefunc_def_s
|
||||
{
|
||||
open_file_func zopen_file;
|
||||
read_file_func zread_file;
|
||||
write_file_func zwrite_file;
|
||||
tell_file_func ztell_file;
|
||||
seek_file_func zseek_file;
|
||||
close_file_func zclose_file;
|
||||
testerror_file_func zerror_file;
|
||||
voidpf opaque;
|
||||
} zlib_filefunc_def;
|
||||
|
||||
|
||||
|
||||
void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
|
||||
|
||||
#define ZREAD(filefunc,filestream,buf,size) ((*((filefunc).zread_file))((filefunc).opaque,filestream,buf,size))
|
||||
#define ZWRITE(filefunc,filestream,buf,size) ((*((filefunc).zwrite_file))((filefunc).opaque,filestream,buf,size))
|
||||
#define ZTELL(filefunc,filestream) ((*((filefunc).ztell_file))((filefunc).opaque,filestream))
|
||||
#define ZSEEK(filefunc,filestream,pos,mode) ((*((filefunc).zseek_file))((filefunc).opaque,filestream,pos,mode))
|
||||
#define ZCLOSE(filefunc,filestream) ((*((filefunc).zclose_file))((filefunc).opaque,filestream))
|
||||
#define ZERROR(filefunc,filestream) ((*((filefunc).zerror_file))((filefunc).opaque,filestream))
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
-1299
File diff suppressed because it is too large
Load Diff
@@ -1,323 +0,0 @@
|
||||
/* zconf.h -- configuration of the zlib compression library
|
||||
* Copyright (C) 1995-2003 Jean-loup Gailly.
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
/* @(#) $Id$ */
|
||||
|
||||
#ifndef ZCONF_H
|
||||
#define ZCONF_H
|
||||
|
||||
/*
|
||||
* If you *really* need a unique prefix for all types and library functions,
|
||||
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
|
||||
*/
|
||||
#ifdef Z_PREFIX
|
||||
# define deflateInit_ z_deflateInit_
|
||||
# define deflate z_deflate
|
||||
# define deflateEnd z_deflateEnd
|
||||
# define inflateInit_ z_inflateInit_
|
||||
# define inflate z_inflate
|
||||
# define inflateEnd z_inflateEnd
|
||||
# define deflateInit2_ z_deflateInit2_
|
||||
# define deflateSetDictionary z_deflateSetDictionary
|
||||
# define deflateCopy z_deflateCopy
|
||||
# define deflateReset z_deflateReset
|
||||
# define deflatePrime z_deflatePrime
|
||||
# define deflateParams z_deflateParams
|
||||
# define deflateBound z_deflateBound
|
||||
# define inflateInit2_ z_inflateInit2_
|
||||
# define inflateSetDictionary z_inflateSetDictionary
|
||||
# define inflateSync z_inflateSync
|
||||
# define inflateSyncPoint z_inflateSyncPoint
|
||||
# define inflateCopy z_inflateCopy
|
||||
# define inflateReset z_inflateReset
|
||||
# define compress z_compress
|
||||
# define compress2 z_compress2
|
||||
# define compressBound z_compressBound
|
||||
# define uncompress z_uncompress
|
||||
# define adler32 z_adler32
|
||||
# define crc32 z_crc32
|
||||
# define get_crc_table z_get_crc_table
|
||||
|
||||
# define Byte z_Byte
|
||||
# define uInt z_uInt
|
||||
# define uLong z_uLong
|
||||
# define Bytef z_Bytef
|
||||
# define charf z_charf
|
||||
# define intf z_intf
|
||||
# define uIntf z_uIntf
|
||||
# define uLongf z_uLongf
|
||||
# define voidpf z_voidpf
|
||||
# define voidp z_voidp
|
||||
#endif
|
||||
|
||||
#if defined(__MSDOS__) && !defined(MSDOS)
|
||||
# define MSDOS
|
||||
#endif
|
||||
#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
|
||||
# define OS2
|
||||
#endif
|
||||
#if defined(_WINDOWS) && !defined(WINDOWS)
|
||||
# define WINDOWS
|
||||
#endif
|
||||
#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
|
||||
# define WIN32
|
||||
#endif
|
||||
#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
|
||||
# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
|
||||
# ifndef SYS16BIT
|
||||
# define SYS16BIT
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Compile with -DMAXSEG_64K if the alloc function cannot allocate more
|
||||
* than 64k bytes at a time (needed on systems with 16-bit int).
|
||||
*/
|
||||
#ifdef SYS16BIT
|
||||
# define MAXSEG_64K
|
||||
#endif
|
||||
#ifdef MSDOS
|
||||
# define UNALIGNED_OK
|
||||
#endif
|
||||
|
||||
#ifdef __STDC_VERSION__
|
||||
# ifndef STDC
|
||||
# define STDC
|
||||
# endif
|
||||
# if __STDC_VERSION__ >= 199901L
|
||||
# ifndef STDC99
|
||||
# define STDC99
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
|
||||
# define STDC
|
||||
#endif
|
||||
#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
|
||||
# define STDC
|
||||
#endif
|
||||
#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
|
||||
# define STDC
|
||||
#endif
|
||||
#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
|
||||
# define STDC
|
||||
#endif
|
||||
|
||||
#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
|
||||
# define STDC
|
||||
#endif
|
||||
|
||||
#ifndef STDC
|
||||
# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
|
||||
# define const /* note: need a more gentle solution here */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Some Mac compilers merge all .h files incorrectly: */
|
||||
#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
|
||||
# define NO_DUMMY_DECL
|
||||
#endif
|
||||
|
||||
/* Maximum value for memLevel in deflateInit2 */
|
||||
#ifndef MAX_MEM_LEVEL
|
||||
# ifdef MAXSEG_64K
|
||||
# define MAX_MEM_LEVEL 8
|
||||
# else
|
||||
# define MAX_MEM_LEVEL 9
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Maximum value for windowBits in deflateInit2 and inflateInit2.
|
||||
* WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
|
||||
* created by gzip. (Files created by minigzip can still be extracted by
|
||||
* gzip.)
|
||||
*/
|
||||
#ifndef MAX_WBITS
|
||||
# define MAX_WBITS 15 /* 32K LZ77 window */
|
||||
#endif
|
||||
|
||||
/* The memory requirements for deflate are (in bytes):
|
||||
(1 << (windowBits+2)) + (1 << (memLevel+9))
|
||||
that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
|
||||
plus a few kilobytes for small objects. For example, if you want to reduce
|
||||
the default memory requirements from 256K to 128K, compile with
|
||||
make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
|
||||
Of course this will generally degrade compression (there's no free lunch).
|
||||
|
||||
The memory requirements for inflate are (in bytes) 1 << windowBits
|
||||
that is, 32K for windowBits=15 (default value) plus a few kilobytes
|
||||
for small objects.
|
||||
*/
|
||||
|
||||
/* Type declarations */
|
||||
|
||||
#ifndef OF /* function prototypes */
|
||||
# ifdef STDC
|
||||
# define OF(args) args
|
||||
# else
|
||||
# define OF(args) ()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* The following definitions for FAR are needed only for MSDOS mixed
|
||||
* model programming (small or medium model with some far allocations).
|
||||
* This was tested only with MSC; for other MSDOS compilers you may have
|
||||
* to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
|
||||
* just define FAR to be empty.
|
||||
*/
|
||||
#ifdef SYS16BIT
|
||||
# if defined(M_I86SM) || defined(M_I86MM)
|
||||
/* MSC small or medium model */
|
||||
# define SMALL_MEDIUM
|
||||
# ifdef _MSC_VER
|
||||
# define FAR _far
|
||||
# else
|
||||
# define FAR far
|
||||
# endif
|
||||
# endif
|
||||
# if (defined(__SMALL__) || defined(__MEDIUM__))
|
||||
/* Turbo C small or medium model */
|
||||
# define SMALL_MEDIUM
|
||||
# ifdef __BORLANDC__
|
||||
# define FAR _far
|
||||
# else
|
||||
# define FAR far
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(WINDOWS) || defined(WIN32)
|
||||
/* If building or using zlib as a DLL, define ZLIB_DLL.
|
||||
* This is not mandatory, but it offers a little performance increase.
|
||||
*/
|
||||
# ifdef ZLIB_DLL
|
||||
# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
|
||||
# ifdef ZLIB_INTERNAL
|
||||
# define ZEXTERN extern __declspec(dllexport)
|
||||
# else
|
||||
# define ZEXTERN extern __declspec(dllimport)
|
||||
# endif
|
||||
# endif
|
||||
# endif /* ZLIB_DLL */
|
||||
/* If building or using zlib with the WINAPI/WINAPIV calling convention,
|
||||
* define ZLIB_WINAPI.
|
||||
* Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
|
||||
*/
|
||||
# ifdef ZLIB_WINAPI
|
||||
# ifdef FAR
|
||||
# undef FAR
|
||||
# endif
|
||||
# include <windows.h>
|
||||
/* No need for _export, use ZLIB.DEF instead. */
|
||||
/* For complete Windows compatibility, use WINAPI, not __stdcall. */
|
||||
# define ZEXPORT WINAPI
|
||||
# ifdef WIN32
|
||||
# define ZEXPORTVA WINAPIV
|
||||
# else
|
||||
# define ZEXPORTVA FAR CDECL
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined (__BEOS__)
|
||||
# ifdef ZLIB_DLL
|
||||
# ifdef ZLIB_INTERNAL
|
||||
# define ZEXPORT __declspec(dllexport)
|
||||
# define ZEXPORTVA __declspec(dllexport)
|
||||
# else
|
||||
# define ZEXPORT __declspec(dllimport)
|
||||
# define ZEXPORTVA __declspec(dllimport)
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef ZEXTERN
|
||||
# define ZEXTERN extern
|
||||
#endif
|
||||
#ifndef ZEXPORT
|
||||
# define ZEXPORT
|
||||
#endif
|
||||
#ifndef ZEXPORTVA
|
||||
# define ZEXPORTVA
|
||||
#endif
|
||||
|
||||
#ifndef FAR
|
||||
# define FAR
|
||||
#endif
|
||||
|
||||
#if !defined(__MACTYPES__)
|
||||
typedef unsigned char Byte; /* 8 bits */
|
||||
#endif
|
||||
typedef unsigned int uInt; /* 16 bits or more */
|
||||
typedef unsigned long uLong; /* 32 bits or more */
|
||||
|
||||
#ifdef SMALL_MEDIUM
|
||||
/* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
|
||||
# define Bytef Byte FAR
|
||||
#else
|
||||
typedef Byte FAR Bytef;
|
||||
#endif
|
||||
typedef char FAR charf;
|
||||
typedef int FAR intf;
|
||||
typedef uInt FAR uIntf;
|
||||
typedef uLong FAR uLongf;
|
||||
|
||||
#ifdef STDC
|
||||
typedef void const *voidpc;
|
||||
typedef void FAR *voidpf;
|
||||
typedef void *voidp;
|
||||
#else
|
||||
typedef Byte const *voidpc;
|
||||
typedef Byte FAR *voidpf;
|
||||
typedef Byte *voidp;
|
||||
#endif
|
||||
|
||||
#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */
|
||||
# include <sys/types.h> /* for off_t */
|
||||
# include <unistd.h> /* for SEEK_* and off_t */
|
||||
# ifdef VMS
|
||||
# include <unixio.h> /* for off_t */
|
||||
# endif
|
||||
# define z_off_t off_t
|
||||
#endif
|
||||
#ifndef SEEK_SET
|
||||
# define SEEK_SET 0 /* Seek from beginning of file. */
|
||||
# define SEEK_CUR 1 /* Seek from current position. */
|
||||
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
|
||||
#endif
|
||||
#ifndef z_off_t
|
||||
# define z_off_t long
|
||||
#endif
|
||||
|
||||
#if defined(__OS400__)
|
||||
#define NO_vsnprintf
|
||||
#endif
|
||||
|
||||
#if defined(__MVS__)
|
||||
# define NO_vsnprintf
|
||||
# ifdef FAR
|
||||
# undef FAR
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* MVS linker does not support external names larger than 8 bytes */
|
||||
#if defined(__MVS__)
|
||||
# pragma map(deflateInit_,"DEIN")
|
||||
# pragma map(deflateInit2_,"DEIN2")
|
||||
# pragma map(deflateEnd,"DEEND")
|
||||
# pragma map(deflateBound,"DEBND")
|
||||
# pragma map(inflateInit_,"ININ")
|
||||
# pragma map(inflateInit2_,"ININ2")
|
||||
# pragma map(inflateEnd,"INEND")
|
||||
# pragma map(inflateSync,"INSY")
|
||||
# pragma map(inflateSetDictionary,"INSEDI")
|
||||
# pragma map(compressBound,"CMBND")
|
||||
# pragma map(inflate_table,"INTABL")
|
||||
# pragma map(inflate_fast,"INFA")
|
||||
# pragma map(inflate_copyright,"INCOPY")
|
||||
#endif
|
||||
|
||||
#endif /* ZCONF_H */
|
||||
-1220
File diff suppressed because it is too large
Load Diff
-235
@@ -1,235 +0,0 @@
|
||||
/* zip.h -- IO for compress .zip files using zlib
|
||||
Version 1.01e, February 12th, 2005
|
||||
|
||||
Copyright (C) 1998-2005 Gilles Vollant
|
||||
|
||||
This unzip package allow creates .ZIP file, compatible with PKZip 2.04g
|
||||
WinZip, InfoZip tools and compatible.
|
||||
Multi volume ZipFile (span) are not supported.
|
||||
Encryption compatible with pkzip 2.04g only supported
|
||||
Old compressions used by old PKZip 1.x are not supported
|
||||
|
||||
For uncompress .zip file, look at unzip.h
|
||||
|
||||
|
||||
I WAIT FEEDBACK at mail info@winimage.com
|
||||
Visit also http://www.winimage.com/zLibDll/unzip.html for evolution
|
||||
|
||||
Condition of use and distribution are the same than zlib :
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. 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.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
/* for more info about .ZIP format, see
|
||||
http://www.info-zip.org/pub/infozip/doc/appnote-981119-iz.zip
|
||||
http://www.info-zip.org/pub/infozip/doc/
|
||||
PkWare has also a specification at :
|
||||
ftp://ftp.pkware.com/probdesc.zip
|
||||
*/
|
||||
|
||||
#ifndef _zip_H
|
||||
#define _zip_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef _ZLIB_H
|
||||
#include "zlib.h"
|
||||
#endif
|
||||
|
||||
#ifndef _ZLIBIOAPI_H
|
||||
#include "ioapi.h"
|
||||
#endif
|
||||
|
||||
#if defined(STRICTZIP) || defined(STRICTZIPUNZIP)
|
||||
/* like the STRICT of WIN32, we define a pointer that cannot be converted
|
||||
from (void*) without cast */
|
||||
typedef struct TagzipFile__ { int unused; } zipFile__;
|
||||
typedef zipFile__ *zipFile;
|
||||
#else
|
||||
typedef voidp zipFile;
|
||||
#endif
|
||||
|
||||
#define ZIP_OK (0)
|
||||
#define ZIP_EOF (0)
|
||||
#define ZIP_ERRNO (Z_ERRNO)
|
||||
#define ZIP_PARAMERROR (-102)
|
||||
#define ZIP_BADZIPFILE (-103)
|
||||
#define ZIP_INTERNALERROR (-104)
|
||||
|
||||
#ifndef DEF_MEM_LEVEL
|
||||
# if MAX_MEM_LEVEL >= 8
|
||||
# define DEF_MEM_LEVEL 8
|
||||
# else
|
||||
# define DEF_MEM_LEVEL MAX_MEM_LEVEL
|
||||
# endif
|
||||
#endif
|
||||
/* default memLevel */
|
||||
|
||||
/* tm_zip contain date/time info */
|
||||
typedef struct tm_zip_s
|
||||
{
|
||||
uInt tm_sec; /* seconds after the minute - [0,59] */
|
||||
uInt tm_min; /* minutes after the hour - [0,59] */
|
||||
uInt tm_hour; /* hours since midnight - [0,23] */
|
||||
uInt tm_mday; /* day of the month - [1,31] */
|
||||
uInt tm_mon; /* months since January - [0,11] */
|
||||
uInt tm_year; /* years - [1980..2044] */
|
||||
} tm_zip;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
tm_zip tmz_date; /* date in understandable format */
|
||||
uLong dosDate; /* if dos_date == 0, tmu_date is used */
|
||||
/* uLong flag; */ /* general purpose bit flag 2 bytes */
|
||||
|
||||
uLong internal_fa; /* internal file attributes 2 bytes */
|
||||
uLong external_fa; /* external file attributes 4 bytes */
|
||||
} zip_fileinfo;
|
||||
|
||||
typedef const char* zipcharpc;
|
||||
|
||||
|
||||
#define APPEND_STATUS_CREATE (0)
|
||||
#define APPEND_STATUS_CREATEAFTER (1)
|
||||
#define APPEND_STATUS_ADDINZIP (2)
|
||||
|
||||
extern zipFile ZEXPORT zipOpen OF((const char *pathname, int append));
|
||||
/*
|
||||
Create a zipfile.
|
||||
pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on
|
||||
an Unix computer "zlib/zlib113.zip".
|
||||
if the file pathname exist and append==APPEND_STATUS_CREATEAFTER, the zip
|
||||
will be created at the end of the file.
|
||||
(useful if the file contain a self extractor code)
|
||||
if the file pathname exist and append==APPEND_STATUS_ADDINZIP, we will
|
||||
add files in existing zip (be sure you don't add file that doesn't exist)
|
||||
If the zipfile cannot be opened, the return value is NULL.
|
||||
Else, the return value is a zipFile Handle, usable with other function
|
||||
of this zip package.
|
||||
*/
|
||||
|
||||
/* Note : there is no delete function into a zipfile.
|
||||
If you want delete file into a zipfile, you must open a zipfile, and create another
|
||||
Of couse, you can use RAW reading and writing to copy the file you did not want delte
|
||||
*/
|
||||
|
||||
extern zipFile ZEXPORT zipOpen2 OF((const char *pathname,
|
||||
int append,
|
||||
zipcharpc* globalcomment,
|
||||
zlib_filefunc_def* pzlib_filefunc_def));
|
||||
|
||||
extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file,
|
||||
const char* filename,
|
||||
const zip_fileinfo* zipfi,
|
||||
const void* extrafield_local,
|
||||
uInt size_extrafield_local,
|
||||
const void* extrafield_global,
|
||||
uInt size_extrafield_global,
|
||||
const char* comment,
|
||||
int method,
|
||||
int level));
|
||||
/*
|
||||
Open a file in the ZIP for writing.
|
||||
filename : the filename in zip (if NULL, '-' without quote will be used
|
||||
*zipfi contain supplemental information
|
||||
if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local
|
||||
contains the extrafield data the the local header
|
||||
if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global
|
||||
contains the extrafield data the the local header
|
||||
if comment != NULL, comment contain the comment string
|
||||
method contain the compression method (0 for store, Z_DEFLATED for deflate)
|
||||
level contain the level of compression (can be Z_DEFAULT_COMPRESSION)
|
||||
*/
|
||||
|
||||
|
||||
extern int ZEXPORT zipOpenNewFileInZip2 OF((zipFile file,
|
||||
const char* filename,
|
||||
const zip_fileinfo* zipfi,
|
||||
const void* extrafield_local,
|
||||
uInt size_extrafield_local,
|
||||
const void* extrafield_global,
|
||||
uInt size_extrafield_global,
|
||||
const char* comment,
|
||||
int method,
|
||||
int level,
|
||||
int raw));
|
||||
|
||||
/*
|
||||
Same than zipOpenNewFileInZip, except if raw=1, we write raw file
|
||||
*/
|
||||
|
||||
extern int ZEXPORT zipOpenNewFileInZip3 OF((zipFile file,
|
||||
const char* filename,
|
||||
const zip_fileinfo* zipfi,
|
||||
const void* extrafield_local,
|
||||
uInt size_extrafield_local,
|
||||
const void* extrafield_global,
|
||||
uInt size_extrafield_global,
|
||||
const char* comment,
|
||||
int method,
|
||||
int level,
|
||||
int raw,
|
||||
int windowBits,
|
||||
int memLevel,
|
||||
int strategy,
|
||||
const char* password,
|
||||
uLong crcForCtypting));
|
||||
|
||||
/*
|
||||
Same than zipOpenNewFileInZip2, except
|
||||
windowBits,memLevel,,strategy : see parameter strategy in deflateInit2
|
||||
password : crypting password (NULL for no crypting)
|
||||
crcForCtypting : crc of file to compress (needed for crypting)
|
||||
*/
|
||||
|
||||
|
||||
extern int ZEXPORT zipWriteInFileInZip OF((zipFile file,
|
||||
const void* buf,
|
||||
unsigned len));
|
||||
/*
|
||||
Write data in the zipfile
|
||||
*/
|
||||
|
||||
extern int ZEXPORT zipCloseFileInZip OF((zipFile file));
|
||||
/*
|
||||
Close the current file in the zipfile
|
||||
*/
|
||||
|
||||
extern int ZEXPORT zipCloseFileInZipRaw OF((zipFile file,
|
||||
uLong uncompressed_size,
|
||||
uLong crc32));
|
||||
/*
|
||||
Close the current file in the zipfile, for fiel opened with
|
||||
parameter raw=1 in zipOpenNewFileInZip2
|
||||
uncompressed_size and crc32 are value for the uncompressed size
|
||||
*/
|
||||
|
||||
extern int ZEXPORT zipClose OF((zipFile file,
|
||||
const char* global_comment));
|
||||
/*
|
||||
Close the zipfile
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _zip_H */
|
||||
-1200
File diff suppressed because it is too large
Load Diff
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* 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 Library 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.
|
||||
*/
|
||||
#ifndef MINIUNZ_H
|
||||
#define MINIUNZ_H
|
||||
|
||||
//! Look for possible filename in zip archive
|
||||
char *find_possible_filename_in_zip (char *zipfilename, const char* extstr);
|
||||
|
||||
//! Extract file content from zip archive
|
||||
int extract_file_in_memory (char *zipfilename, char *archivedfile,
|
||||
size_t * unzipped_size);
|
||||
|
||||
#endif
|
||||
@@ -1,275 +0,0 @@
|
||||
/* unzip.h -- IO for uncompress .zip files using zlib
|
||||
Version 0.15 beta, Mar 19th, 1998,
|
||||
|
||||
Copyright (C) 1998 Gilles Vollant
|
||||
|
||||
This unzip package allow extract file from .ZIP file, compatible with PKZip 2.04g
|
||||
WinZip, InfoZip tools and compatible.
|
||||
Encryption and multi volume ZipFile (span) are not supported.
|
||||
Old compressions used by old PKZip 1.x are not supported
|
||||
|
||||
THIS IS AN ALPHA VERSION. AT THIS STAGE OF DEVELOPPEMENT, SOMES API OR STRUCTURE
|
||||
CAN CHANGE IN FUTURE VERSION !!
|
||||
I WAIT FEEDBACK at mail info@winimage.com
|
||||
Visit also http://www.winimage.com/zLibDll/unzip.htm for evolution
|
||||
|
||||
Condition of use and distribution are the same than zlib :
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. 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.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
|
||||
*/
|
||||
/* for more info about .ZIP format, see
|
||||
ftp://ftp.cdrom.com/pub/infozip/doc/appnote-970311-iz.zip
|
||||
PkWare has also a specification at :
|
||||
ftp://ftp.pkware.com/probdesc.zip */
|
||||
|
||||
#ifndef _unz_H
|
||||
#define _unz_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef _ZLIB_H
|
||||
#include "zlib.h"
|
||||
#endif
|
||||
|
||||
#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP)
|
||||
/* like the STRICT of WIN32, we define a pointer that cannot be converted
|
||||
from (void*) without cast */
|
||||
typedef struct TagunzFile__ { int unused; } unzFile__;
|
||||
typedef unzFile__ *unzFile;
|
||||
#else
|
||||
typedef voidp unzFile;
|
||||
#endif
|
||||
|
||||
|
||||
#define UNZ_OK (0)
|
||||
#define UNZ_END_OF_LIST_OF_FILE (-100)
|
||||
#define UNZ_ERRNO (Z_ERRNO)
|
||||
#define UNZ_EOF (0)
|
||||
#define UNZ_PARAMERROR (-102)
|
||||
#define UNZ_BADZIPFILE (-103)
|
||||
#define UNZ_INTERNALERROR (-104)
|
||||
#define UNZ_CRCERROR (-105)
|
||||
|
||||
/* tm_unz contain date/time info */
|
||||
typedef struct tm_unz_s
|
||||
{
|
||||
uInt tm_sec; /* seconds after the minute - [0,59] */
|
||||
uInt tm_min; /* minutes after the hour - [0,59] */
|
||||
uInt tm_hour; /* hours since midnight - [0,23] */
|
||||
uInt tm_mday; /* day of the month - [1,31] */
|
||||
uInt tm_mon; /* months since January - [0,11] */
|
||||
uInt tm_year; /* years - [1980..2044] */
|
||||
} tm_unz;
|
||||
|
||||
/* unz_global_info structure contain global data about the ZIPfile
|
||||
These data comes from the end of central dir */
|
||||
typedef struct unz_global_info_s
|
||||
{
|
||||
uLong number_entry; /* total number of entries in
|
||||
the central dir on this disk */
|
||||
uLong size_comment; /* size of the global comment of the zipfile */
|
||||
} unz_global_info;
|
||||
|
||||
|
||||
/* unz_file_info contain information about a file in the zipfile */
|
||||
typedef struct unz_file_info_s
|
||||
{
|
||||
uLong version; /* version made by 2 bytes */
|
||||
uLong version_needed; /* version needed to extract 2 bytes */
|
||||
uLong flag; /* general purpose bit flag 2 bytes */
|
||||
uLong compression_method; /* compression method 2 bytes */
|
||||
uLong dosDate; /* last mod file date in Dos fmt 4 bytes */
|
||||
uLong crc; /* crc-32 4 bytes */
|
||||
uLong compressed_size; /* compressed size 4 bytes */
|
||||
uLong uncompressed_size; /* uncompressed size 4 bytes */
|
||||
uLong size_filename; /* filename length 2 bytes */
|
||||
uLong size_file_extra; /* extra field length 2 bytes */
|
||||
uLong size_file_comment; /* file comment length 2 bytes */
|
||||
|
||||
uLong disk_num_start; /* disk number start 2 bytes */
|
||||
uLong internal_fa; /* internal file attributes 2 bytes */
|
||||
uLong external_fa; /* external file attributes 4 bytes */
|
||||
|
||||
tm_unz tmu_date;
|
||||
} unz_file_info;
|
||||
|
||||
extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1,
|
||||
const char* fileName2,
|
||||
int iCaseSensitivity));
|
||||
/*
|
||||
Compare two filename (fileName1,fileName2).
|
||||
If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
|
||||
If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
|
||||
or strcasecmp)
|
||||
If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
|
||||
(like 1 on Unix, 2 on Windows)
|
||||
*/
|
||||
|
||||
|
||||
extern unzFile ZEXPORT unzOpen OF((const char *path));
|
||||
/*
|
||||
Open a Zip file. path contain the full pathname (by example,
|
||||
on a Windows NT computer "c:\\zlib\\zlib111.zip" or on an Unix computer
|
||||
"zlib/zlib111.zip".
|
||||
If the zipfile cannot be opened (file don't exist or in not valid), the
|
||||
return value is NULL.
|
||||
Else, the return value is a unzFile Handle, usable with other function
|
||||
of this unzip package.
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzClose OF((unzFile file));
|
||||
/*
|
||||
Close a ZipFile opened with unzipOpen.
|
||||
If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
|
||||
these files MUST be closed with unzipCloseCurrentFile before call unzipClose.
|
||||
return UNZ_OK if there is no problem. */
|
||||
|
||||
extern int ZEXPORT unzGetGlobalInfo OF((unzFile file,
|
||||
unz_global_info *pglobal_info));
|
||||
/*
|
||||
Write info about the ZipFile in the *pglobal_info structure.
|
||||
No preparation of the structure is needed
|
||||
return UNZ_OK if there is no problem. */
|
||||
|
||||
|
||||
extern int ZEXPORT unzGetGlobalComment OF((unzFile file,
|
||||
char *szComment,
|
||||
uLong uSizeBuf));
|
||||
/*
|
||||
Get the global comment string of the ZipFile, in the szComment buffer.
|
||||
uSizeBuf is the size of the szComment buffer.
|
||||
return the number of byte copied or an error code <0
|
||||
*/
|
||||
|
||||
|
||||
/***************************************************************************/
|
||||
/* Unzip package allow you browse the directory of the zipfile */
|
||||
|
||||
extern int ZEXPORT unzGoToFirstFile OF((unzFile file));
|
||||
/*
|
||||
Set the current file of the zipfile to the first file.
|
||||
return UNZ_OK if there is no problem
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzGoToNextFile OF((unzFile file));
|
||||
/*
|
||||
Set the current file of the zipfile to the next file.
|
||||
return UNZ_OK if there is no problem
|
||||
return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzLocateFile OF((unzFile file,
|
||||
const char *szFileName,
|
||||
int iCaseSensitivity));
|
||||
/*
|
||||
Try locate the file szFileName in the zipfile.
|
||||
For the iCaseSensitivity signification, see unzStringFileNameCompare
|
||||
|
||||
return value :
|
||||
UNZ_OK if the file is found. It becomes the current file.
|
||||
UNZ_END_OF_LIST_OF_FILE if the file is not found
|
||||
*/
|
||||
|
||||
|
||||
extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file,
|
||||
unz_file_info *pfile_info,
|
||||
char *szFileName,
|
||||
uLong fileNameBufferSize,
|
||||
void *extraField,
|
||||
uLong extraFieldBufferSize,
|
||||
char *szComment,
|
||||
uLong commentBufferSize));
|
||||
/*
|
||||
Get Info about the current file
|
||||
if pfile_info!=NULL, the *pfile_info structure will contain somes info about
|
||||
the current file
|
||||
if szFileName!=NULL, the filemane string will be copied in szFileName
|
||||
(fileNameBufferSize is the size of the buffer)
|
||||
if extraField!=NULL, the extra field information will be copied in extraField
|
||||
(extraFieldBufferSize is the size of the buffer).
|
||||
This is the Central-header version of the extra field
|
||||
if szComment!=NULL, the comment string of the file will be copied in szComment
|
||||
(commentBufferSize is the size of the buffer)
|
||||
*/
|
||||
|
||||
/***************************************************************************/
|
||||
/* for reading the content of the current zipfile, you can open it, read data
|
||||
from it, and close it (you can close it before reading all the file)
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzOpenCurrentFile OF((unzFile file));
|
||||
/*
|
||||
Open for reading data the current file in the zipfile.
|
||||
If there is no error, the return value is UNZ_OK.
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzCloseCurrentFile OF((unzFile file));
|
||||
/*
|
||||
Close the file in zip opened with unzOpenCurrentFile
|
||||
Return UNZ_CRCERROR if all the file was read but the CRC is not good
|
||||
*/
|
||||
|
||||
|
||||
extern int ZEXPORT unzReadCurrentFile OF((unzFile file,
|
||||
voidp buf,
|
||||
unsigned len));
|
||||
/*
|
||||
Read bytes from the current file (opened by unzOpenCurrentFile)
|
||||
buf contain buffer where data must be copied
|
||||
len the size of buf.
|
||||
|
||||
return the number of byte copied if somes bytes are copied
|
||||
return 0 if the end of file was reached
|
||||
return <0 with error code if there is an error
|
||||
(UNZ_ERRNO for IO error, or zLib error for uncompress error)
|
||||
*/
|
||||
|
||||
extern z_off_t ZEXPORT unztell OF((unzFile file));
|
||||
/*
|
||||
Give the current position in uncompressed data
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzeof OF((unzFile file));
|
||||
/*
|
||||
return 1 if the end of file was reached, 0 elsewhere
|
||||
*/
|
||||
|
||||
extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file,
|
||||
voidp buf,
|
||||
unsigned len));
|
||||
/*
|
||||
Read extra field from the current file (opened by unzOpenCurrentFile)
|
||||
This is the local-header version of the extra field (sometimes, there is
|
||||
more info in the local-header version than in the central-header)
|
||||
|
||||
if buf==NULL, it return the size of the local extra field
|
||||
|
||||
if buf!=NULL, len is the size of the buffer, the extra header is copied in
|
||||
buf.
|
||||
the return value is the number of bytes copied in buf, or (if <0)
|
||||
the error code
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _unz_H */
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _ __ ___
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ / / / _
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / ___/ /__/
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
// Copyright 2020 Rupert Carmichael
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Bios.c
|
||||
// ----------------------------------------------------------------------------
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "Bios.h"
|
||||
|
||||
bool bios_enabled = false;
|
||||
char bios_filename[256];
|
||||
|
||||
static uint8_t* bios_data = NULL;
|
||||
static uint16_t bios_size = 0;
|
||||
|
||||
bool bios_Load(const char *filename) {
|
||||
bios_Release();
|
||||
//logger_LogInfo("Opening bios file " + filename + ".", BIOS_SOURCE);
|
||||
|
||||
if (bios_size == 0) {
|
||||
FILE* file = fopen(filename, "rb");
|
||||
if (file == NULL) {
|
||||
//logger_LogError("Failed to open the bios file " + filename + " for reading.", BIOS_SOURCE);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fseek(file, 0L, SEEK_END)) {
|
||||
fclose(file);
|
||||
//logger_LogError("Failed to find the end of the bios file.", BIOS_SOURCE);
|
||||
return false;
|
||||
}
|
||||
|
||||
bios_size = ftell(file);
|
||||
if (fseek(file, 0L, SEEK_SET)) {
|
||||
fclose(file);
|
||||
//logger_LogError("Failed to find the size of the bios file.", BIOS_SOURCE);
|
||||
return false;
|
||||
}
|
||||
|
||||
bios_data = (uint8_t*)malloc(bios_size * sizeof(uint8_t));
|
||||
if (fread(bios_data, 1, bios_size, file) != bios_size && ferror(file)) {
|
||||
fclose(file);
|
||||
//logger_LogError("Failed to read the bios data.", BIOS_SOURCE);
|
||||
bios_Release( );
|
||||
return false;
|
||||
}
|
||||
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
snprintf(bios_filename, sizeof(bios_filename), "%s", filename);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool bios_IsLoaded(void) {
|
||||
return (bios_data != NULL) ? true : false;
|
||||
}
|
||||
|
||||
void bios_Release(void) {
|
||||
if (bios_data) {
|
||||
free(bios_data);
|
||||
bios_size = 0;
|
||||
bios_data = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void bios_Store(void) {
|
||||
if (bios_data != NULL && bios_enabled) {
|
||||
memory_WriteROM(65536 - bios_size, bios_size, bios_data);
|
||||
}
|
||||
}
|
||||
Executable → Regular
+11
-17
@@ -1,11 +1,12 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _ __ ___
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ / / / _
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / ___/ /__/
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// Copyright 2020 Rupert Carmichael
|
||||
//
|
||||
// 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
|
||||
@@ -25,20 +26,13 @@
|
||||
#ifndef BIOS_H
|
||||
#define BIOS_H
|
||||
|
||||
#include <string>
|
||||
#include "Memory.h"
|
||||
#include "Archive.h"
|
||||
#include "Logger.h"
|
||||
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned short word;
|
||||
typedef unsigned int uint;
|
||||
|
||||
extern bool bios_Load(std::string filename);
|
||||
extern bool bios_IsLoaded( );
|
||||
extern void bios_Store( );
|
||||
extern void bios_Release( );
|
||||
extern std::string bios_filename;
|
||||
extern bool bios_Load(const char *filename);
|
||||
extern bool bios_IsLoaded(void);
|
||||
extern void bios_Store(void);
|
||||
extern void bios_Release(void);
|
||||
extern char bios_filename[256];
|
||||
extern bool bios_enabled;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
+476
@@ -0,0 +1,476 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _ __ ___
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ / / / _
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / ___/ /__/
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
// Copyright 2020 Rupert Carmichael
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Cartridge.c
|
||||
// ----------------------------------------------------------------------------
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "Cartridge.h"
|
||||
|
||||
char cart_digest[33];
|
||||
|
||||
const char *cartridge_filename;
|
||||
char cartridge_title[33];
|
||||
uint8_t cartridge_type;
|
||||
uint8_t cartridge_region;
|
||||
bool cartridge_pokey;
|
||||
bool cartridge_pokey450;
|
||||
uint8_t cartridge_controller[2];
|
||||
uint8_t cartridge_bank;
|
||||
uint32_t cartridge_flags;
|
||||
int cartridge_crosshair_x;
|
||||
int cartridge_crosshair_y;
|
||||
bool cartridge_dualanalog = false;
|
||||
bool cartridge_xm = false;
|
||||
bool cartridge_disable_bios = false;
|
||||
uint8_t cartridge_left_switch = 1;
|
||||
uint8_t cartridge_right_switch = 0;
|
||||
bool cartridge_swap_buttons = false;
|
||||
bool cartridge_hsc_enabled = false;
|
||||
uint32_t cartridge_hblank = HBLANK_DEFAULT;
|
||||
|
||||
static uint8_t *cartridge_buffer = NULL;
|
||||
static size_t cartridge_size = 0;
|
||||
|
||||
static bool cartridge_HasHeader(const uint8_t* header) {
|
||||
const char HEADER_ID[ ] = {"ATARI7800"};
|
||||
|
||||
for (int index = 0; index < 9; index++) {
|
||||
if (HEADER_ID[index] != header[index + 1]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool cartridge_CC2(const uint8_t* header) {
|
||||
const char HEADER_ID[ ] = {">>"};
|
||||
for (int index = 0; index < 2; index++) {
|
||||
if (HEADER_ID[index] != header[index+1]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static uint32_t cartridge_GetBank(uint8_t bank) {
|
||||
if ((cartridge_type == CARTRIDGE_TYPE_SUPERCART ||
|
||||
cartridge_type == CARTRIDGE_TYPE_SUPERCART_ROM ||
|
||||
cartridge_type == CARTRIDGE_TYPE_SUPERCART_RAM) &&
|
||||
cartridge_size <= 65536) {
|
||||
// for some of these carts, there are only 4 banks. in this case we
|
||||
// ignore bit 3 previously, games of this type had to be doubled. The
|
||||
// first 4 banks needed to be duplicated at the end of the ROM
|
||||
return (bank & 3);
|
||||
}
|
||||
|
||||
return bank;
|
||||
}
|
||||
|
||||
static uint32_t cartridge_GetBankOffset(uint8_t bank) {
|
||||
return cartridge_GetBank(bank) * 16384;
|
||||
}
|
||||
|
||||
static void cartridge_WriteBank(uint16_t address, uint8_t bank) {
|
||||
uint32_t offset = cartridge_GetBankOffset(bank);
|
||||
if (offset < cartridge_size) {
|
||||
memory_WriteROM(address, 16384, cartridge_buffer + offset);
|
||||
cartridge_bank = bank;
|
||||
}
|
||||
}
|
||||
|
||||
static void cartridge_SetTypeBySize(uint32_t size) {
|
||||
if (size <= 0x10000) {
|
||||
cartridge_type = CARTRIDGE_TYPE_NORMAL;
|
||||
}
|
||||
else if (size == 0x24000) {
|
||||
cartridge_type = CARTRIDGE_TYPE_SUPERCART_LARGE;
|
||||
}
|
||||
else if (size == 0x20000) {
|
||||
cartridge_type = CARTRIDGE_TYPE_SUPERCART_ROM;
|
||||
}
|
||||
else {
|
||||
cartridge_type = CARTRIDGE_TYPE_SUPERCART;
|
||||
}
|
||||
}
|
||||
|
||||
static void cartridge_ReadHeader(const uint8_t* header) {
|
||||
for (int index = 0; index < 32; index++) {
|
||||
cartridge_title[index] = header[index + 17];
|
||||
}
|
||||
|
||||
cartridge_size = header[49] << 24;
|
||||
cartridge_size |= header[50] << 16;
|
||||
cartridge_size |= header[51] << 8;
|
||||
cartridge_size |= header[52];
|
||||
|
||||
if (header[53] == 0) {
|
||||
if (cartridge_size > 131072) {
|
||||
cartridge_type = CARTRIDGE_TYPE_SUPERCART_LARGE;
|
||||
}
|
||||
else if (header[54] == 2 || header[54] == 3) {
|
||||
cartridge_type = CARTRIDGE_TYPE_SUPERCART;
|
||||
}
|
||||
else if (header[54] == 4 || header[54] == 5 || header[54] == 6 ||
|
||||
header[54] == 7) {
|
||||
cartridge_type = CARTRIDGE_TYPE_SUPERCART_RAM;
|
||||
}
|
||||
else if (header[54] == 8 || header[54] == 9 || header[54] == 10 ||
|
||||
header[54] == 11) {
|
||||
cartridge_type = CARTRIDGE_TYPE_SUPERCART_ROM;
|
||||
}
|
||||
else {
|
||||
cartridge_type = CARTRIDGE_TYPE_NORMAL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (header[53] == 2 /*1*/) { // Wii: Abs and Act were swapped
|
||||
cartridge_type = CARTRIDGE_TYPE_ABSOLUTE;
|
||||
}
|
||||
else if (header[53] == 1 /*2*/) { // Wii: Abs and Act were swapped
|
||||
cartridge_type = CARTRIDGE_TYPE_ACTIVISION;
|
||||
}
|
||||
else {
|
||||
cartridge_type = CARTRIDGE_TYPE_NORMAL;
|
||||
}
|
||||
}
|
||||
|
||||
cartridge_pokey = (header[54] & 1) ? true : false;
|
||||
cartridge_pokey450 = (header[54] & 0x40)? true : false;
|
||||
if (cartridge_pokey450) {
|
||||
cartridge_pokey = true;
|
||||
}
|
||||
cartridge_controller[0] = header[55];
|
||||
cartridge_controller[1] = header[56];
|
||||
cartridge_region = header[57];
|
||||
cartridge_flags = 0;
|
||||
cartridge_xm = (header[63] & 1) ? true: false;
|
||||
cartridge_hsc_enabled = header[58] & 0x01;
|
||||
|
||||
// Wii: Updates to header interpretation
|
||||
uint8_t ct1 = header[54];
|
||||
if (header[53] == 0) {
|
||||
// BIT1 and BIT3 (Supercart Large: 2) rom at $4000
|
||||
if ((ct1 & 0x0a) == 0x0a) {
|
||||
cartridge_type = CARTRIDGE_TYPE_SUPERCART_LARGE;
|
||||
}
|
||||
// BIT1 and BIT4 (Supercart ROM: 4) bank6 at $4000
|
||||
else if ((ct1 & 0x12) == 0x12) {
|
||||
cartridge_type = CARTRIDGE_TYPE_SUPERCART_ROM;
|
||||
}
|
||||
// BIT1 and BIT2 (Supercart RAM: 3) ram at $4000
|
||||
else if ((ct1 & 0x06) == 0x06) {
|
||||
cartridge_type = CARTRIDGE_TYPE_SUPERCART_RAM;
|
||||
}
|
||||
// BIT1 (Supercart) bank switched
|
||||
else if ((ct1 & 0x02) == 0x02) {
|
||||
cartridge_type = CARTRIDGE_TYPE_SUPERCART;
|
||||
}
|
||||
// Size < 64k && BIT2 (Normal RAM: ?) ram at $4000 )
|
||||
else if (cartridge_size <= 0x10000 && ((ct1&0x04)==0x04)) {
|
||||
cartridge_type = CARTRIDGE_TYPE_NORMAL_RAM;
|
||||
}
|
||||
// Attempt to determine the cartridge type based on its size
|
||||
else {
|
||||
cartridge_SetTypeBySize(cartridge_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Convert a nybble's hexadecimal representation to a lower case ASCII char
|
||||
static inline char nyb_hexchar(unsigned nyb) {
|
||||
nyb &= 0xf; // Lower nybble only
|
||||
if (nyb >= 10)
|
||||
nyb += 'a' - 10;
|
||||
else
|
||||
nyb += '0';
|
||||
return (char)nyb;
|
||||
}
|
||||
|
||||
bool cartridge_Load(const uint8_t* data, uint32_t size) {
|
||||
if (size <= 128) {
|
||||
// Cartridge data is invalid.
|
||||
return false;
|
||||
}
|
||||
|
||||
cartridge_Release( );
|
||||
|
||||
uint8_t header[128] = {0};
|
||||
|
||||
for(int index = 0; index < 128; index++) {
|
||||
header[index] = data[index];
|
||||
}
|
||||
|
||||
if (cartridge_CC2(header)) {
|
||||
// Prosystem doesn't support CC2 hacks.
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t offset = 0;
|
||||
|
||||
if (cartridge_HasHeader(header)) {
|
||||
cartridge_ReadHeader(header);
|
||||
size -= 128;
|
||||
offset = 128;
|
||||
|
||||
// Several cartridge headers do not have the proper size. So attempt to
|
||||
// use the size of the file.
|
||||
if (cartridge_size != size) {
|
||||
// Necessary for the following roms:
|
||||
// Impossible Mission hacks w/ C64 style graphics
|
||||
if (size % 1024 == 0) {
|
||||
cartridge_size = size;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
cartridge_size = size;
|
||||
// Attempt to guess the cartridge type based on its size
|
||||
cartridge_SetTypeBySize(size);
|
||||
}
|
||||
|
||||
cartridge_buffer = (uint8_t*)malloc(cartridge_size * sizeof(uint8_t));
|
||||
|
||||
for(size_t index = 0; index < cartridge_size; index++) {
|
||||
cartridge_buffer[index] = data[index + offset];
|
||||
}
|
||||
|
||||
// Different from the file md5sum which starts from the header vs rom data
|
||||
MD5_CTX c;
|
||||
size_t md5len = cartridge_size;
|
||||
uint8_t *dataptr = cartridge_buffer;
|
||||
unsigned char digest[16];
|
||||
MD5_Init(&c);
|
||||
MD5_Update(&c, dataptr, md5len);
|
||||
MD5_Final(digest, &c);
|
||||
/*for (int i = 0; i < 16; i++) {
|
||||
snprintf(&(cart_digest[i * 2]), 16 * 2, "%02x", (unsigned)digest[i]);
|
||||
}*/
|
||||
|
||||
// Convert the digest to a string without dodgy calls to snprintf
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
cart_digest[i * 2] = nyb_hexchar(digest[i] >> 4);
|
||||
cart_digest[(i * 2) + 1] = nyb_hexchar(digest[i]);
|
||||
}
|
||||
cart_digest[32] = '\0';
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void cartridge_Store(void) {
|
||||
switch(cartridge_type) {
|
||||
case CARTRIDGE_TYPE_NORMAL: {
|
||||
memory_WriteROM(65536 - cartridge_size, cartridge_size, cartridge_buffer);
|
||||
break;
|
||||
}
|
||||
case CARTRIDGE_TYPE_NORMAL_RAM: {
|
||||
memory_WriteROM(65536 - cartridge_size, cartridge_size, cartridge_buffer);
|
||||
memory_ClearROM(16384, 16384);
|
||||
break;
|
||||
}
|
||||
case CARTRIDGE_TYPE_SUPERCART: {
|
||||
uint32_t offset = cartridge_size - 16384;
|
||||
if (offset < cartridge_size) {
|
||||
memory_WriteROM(49152, 16384, cartridge_buffer + offset);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CARTRIDGE_TYPE_SUPERCART_LARGE: {
|
||||
uint32_t offset = cartridge_size - 16384;
|
||||
if (offset < cartridge_size) {
|
||||
memory_WriteROM(49152, 16384, cartridge_buffer + offset);
|
||||
memory_WriteROM(16384, 16384, cartridge_buffer + cartridge_GetBankOffset(0));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CARTRIDGE_TYPE_SUPERCART_RAM: {
|
||||
uint32_t offset = cartridge_size - 16384;
|
||||
if (offset < cartridge_size) {
|
||||
memory_WriteROM(49152, 16384, cartridge_buffer + offset);
|
||||
memory_ClearROM(16384, 16384);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CARTRIDGE_TYPE_SUPERCART_ROM: {
|
||||
uint32_t offset = cartridge_size - 16384;
|
||||
if (offset < cartridge_size && cartridge_GetBankOffset(6) < cartridge_size) {
|
||||
memory_WriteROM(49152, 16384, cartridge_buffer + offset);
|
||||
memory_WriteROM(16384, 16384, cartridge_buffer + cartridge_GetBankOffset(6));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CARTRIDGE_TYPE_ABSOLUTE: {
|
||||
memory_WriteROM(16384, 16384, cartridge_buffer);
|
||||
memory_WriteROM(32768, 32768, cartridge_buffer + cartridge_GetBankOffset(2));
|
||||
break;
|
||||
}
|
||||
case CARTRIDGE_TYPE_ACTIVISION: {
|
||||
if (122880 < cartridge_size) {
|
||||
memory_WriteROM(40960, 16384, cartridge_buffer);
|
||||
memory_WriteROM(16384, 8192, cartridge_buffer + 106496);
|
||||
memory_WriteROM(24576, 8192, cartridge_buffer + 98304);
|
||||
memory_WriteROM(32768, 8192, cartridge_buffer + 122880);
|
||||
memory_WriteROM(57344, 8192, cartridge_buffer + 114688);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void cartridge_Write(uint16_t address, uint8_t data) {
|
||||
switch(cartridge_type) {
|
||||
case CARTRIDGE_TYPE_SUPERCART:
|
||||
case CARTRIDGE_TYPE_SUPERCART_RAM:
|
||||
case CARTRIDGE_TYPE_SUPERCART_ROM:
|
||||
if (address >= 32768 && address < 49152 && data < 9) {
|
||||
cartridge_StoreBank(data);
|
||||
}
|
||||
break;
|
||||
|
||||
case CARTRIDGE_TYPE_SUPERCART_LARGE:
|
||||
if (address >= 32768 && address < 49152 && data < 9) {
|
||||
cartridge_StoreBank(data + 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case CARTRIDGE_TYPE_ABSOLUTE:
|
||||
if (address == 32768 && (data == 1 || data == 2)) {
|
||||
cartridge_StoreBank(data - 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case CARTRIDGE_TYPE_ACTIVISION:
|
||||
if (address >= 65408) {
|
||||
cartridge_StoreBank(address & 7);
|
||||
}
|
||||
break;
|
||||
}
|
||||
#if 0 // Wii: Moved to Memory.cpp
|
||||
if (cartridge_pokey && address >= 0x4000 && address <= 0x400f) {
|
||||
switch (address) {
|
||||
case POKEY_AUDF1:
|
||||
pokey_SetRegister(POKEY_AUDF1, data);
|
||||
break;
|
||||
|
||||
case POKEY_AUDC1:
|
||||
pokey_SetRegister(POKEY_AUDC1, data);
|
||||
break;
|
||||
|
||||
case POKEY_AUDF2:
|
||||
pokey_SetRegister(POKEY_AUDF2, data);
|
||||
break;
|
||||
|
||||
case POKEY_AUDC2:
|
||||
pokey_SetRegister(POKEY_AUDC2, data);
|
||||
break;
|
||||
|
||||
case POKEY_AUDF3:
|
||||
pokey_SetRegister(POKEY_AUDF3, data);
|
||||
break;
|
||||
|
||||
case POKEY_AUDC3:
|
||||
pokey_SetRegister(POKEY_AUDC3, data);
|
||||
break;
|
||||
|
||||
case POKEY_AUDF4:
|
||||
pokey_SetRegister(POKEY_AUDF4, data);
|
||||
break;
|
||||
|
||||
case POKEY_AUDC4:
|
||||
pokey_SetRegister(POKEY_AUDC4, data);
|
||||
break;
|
||||
|
||||
case POKEY_AUDCTL:
|
||||
pokey_SetRegister(POKEY_AUDCTL, data);
|
||||
break;
|
||||
|
||||
case POKEY_SKCTLS:
|
||||
pokey_SetRegister(POKEY_SKCTLS, data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void cartridge_StoreBank(uint8_t bank) {
|
||||
switch (cartridge_type) {
|
||||
case CARTRIDGE_TYPE_SUPERCART:
|
||||
cartridge_WriteBank(32768, bank);
|
||||
break;
|
||||
|
||||
case CARTRIDGE_TYPE_SUPERCART_RAM:
|
||||
cartridge_WriteBank(32768, bank);
|
||||
break;
|
||||
|
||||
case CARTRIDGE_TYPE_SUPERCART_ROM:
|
||||
cartridge_WriteBank(32768, bank);
|
||||
break;
|
||||
|
||||
case CARTRIDGE_TYPE_SUPERCART_LARGE:
|
||||
cartridge_WriteBank(32768, bank);
|
||||
break;
|
||||
|
||||
case CARTRIDGE_TYPE_ABSOLUTE:
|
||||
cartridge_WriteBank(16384, bank);
|
||||
break;
|
||||
|
||||
case CARTRIDGE_TYPE_ACTIVISION:
|
||||
cartridge_WriteBank(40960, bank);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool cartridge_IsLoaded(void) {
|
||||
return (cartridge_buffer != NULL) ? true : false;
|
||||
}
|
||||
|
||||
void cartridge_Release(void) {
|
||||
if(cartridge_buffer != NULL) {
|
||||
free(cartridge_buffer);
|
||||
cartridge_size = 0;
|
||||
cartridge_buffer = NULL;
|
||||
cartridge_title[0] = '\0';
|
||||
cartridge_type = 0;
|
||||
cartridge_region = 0;
|
||||
cartridge_pokey = 0;
|
||||
cartridge_pokey450 = 0;
|
||||
cartridge_xm = false;
|
||||
// Default to joysticks
|
||||
memset(cartridge_controller, 1, sizeof(cartridge_controller));
|
||||
cartridge_bank = 0;
|
||||
cartridge_flags = 0;
|
||||
cartridge_disable_bios = false;
|
||||
cartridge_crosshair_x = 0;
|
||||
cartridge_crosshair_y = 0;
|
||||
cartridge_hblank = HBLANK_DEFAULT;
|
||||
cartridge_dualanalog = false;
|
||||
cartridge_left_switch = 1;
|
||||
cartridge_right_switch = 0;
|
||||
cartridge_swap_buttons = false;
|
||||
cartridge_hsc_enabled = false;
|
||||
}
|
||||
}
|
||||
Executable → Regular
+25
-35
@@ -1,11 +1,12 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _ __ ___
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ / / / _
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / ___/ /__/
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// Copyright 2020 Rupert Carmichael
|
||||
//
|
||||
// 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
|
||||
@@ -24,6 +25,7 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
#ifndef CARTRIDGE_H
|
||||
#define CARTRIDGE_H
|
||||
|
||||
#define CARTRIDGE_TYPE_NORMAL 0
|
||||
#define CARTRIDGE_TYPE_SUPERCART 1
|
||||
#define CARTRIDGE_TYPE_SUPERCART_LARGE 2
|
||||
@@ -40,53 +42,41 @@
|
||||
|
||||
#define HBLANK_DEFAULT 34
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
#include "Equates.h"
|
||||
#include "Memory.h"
|
||||
#include "Hash.h"
|
||||
#include "Logger.h"
|
||||
#include "md5.h"
|
||||
#include "Pokey.h"
|
||||
#include "Archive.h"
|
||||
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned short word;
|
||||
typedef unsigned int uint;
|
||||
|
||||
extern bool cartridge_Load(std::string filename);
|
||||
extern void cartridge_Store( );
|
||||
extern void cartridge_StoreBank(byte bank);
|
||||
extern void cartridge_Write(word address, byte data);
|
||||
extern bool cartridge_IsLoaded( );
|
||||
extern void cartridge_Release( );
|
||||
extern std::string cartridge_digest;
|
||||
extern std::string cartridge_title;
|
||||
extern std::string cartridge_description;
|
||||
extern std::string cartridge_year;
|
||||
extern std::string cartridge_maker;
|
||||
extern std::string cartridge_filename;
|
||||
extern byte cartridge_type;
|
||||
extern byte cartridge_region;
|
||||
extern bool cartridge_Load(const uint8_t* data, uint32_t size);
|
||||
extern void cartridge_Store(void);
|
||||
extern void cartridge_StoreBank(uint8_t bank);
|
||||
extern void cartridge_Write(uint16_t address, uint8_t data);
|
||||
extern bool cartridge_IsLoaded(void);
|
||||
extern void cartridge_Release(void);
|
||||
extern char cart_digest[33];
|
||||
extern const char *cartridge_filename;
|
||||
extern char cartridge_title[33];
|
||||
extern uint8_t cartridge_type;
|
||||
extern uint8_t cartridge_region;
|
||||
extern bool cartridge_pokey;
|
||||
extern bool cartridge_pokey450;
|
||||
extern bool cartridge_xm;
|
||||
extern byte cartridge_controller[2];
|
||||
extern byte cartridge_bank;
|
||||
extern uint cartridge_flags;
|
||||
extern uint8_t cartridge_controller[2];
|
||||
extern uint8_t cartridge_bank;
|
||||
extern uint32_t cartridge_flags;
|
||||
extern bool cartridge_disable_bios;
|
||||
extern byte cartridge_left_switch;
|
||||
extern byte cartridge_right_switch;
|
||||
extern uint8_t cartridge_left_switch;
|
||||
extern uint8_t cartridge_right_switch;
|
||||
extern bool cartridge_swap_buttons;
|
||||
extern bool cartridge_hsc_enabled;
|
||||
|
||||
// The x offset for the lightgun crosshair (allows per cartridge adjustments)
|
||||
extern int cartridge_crosshair_x;
|
||||
// The y offset for the lightgun crosshair (allows per cartridge adjustments)
|
||||
extern int cartridge_crosshair_y;
|
||||
// The hblank prior to DMA
|
||||
extern uint cartridge_hblank;
|
||||
extern uint32_t cartridge_hblank;
|
||||
// Whether the cartridge supports dual analog
|
||||
extern bool cartridge_dualanalog;
|
||||
// Whether the high score cart is enabled
|
||||
extern bool cartridge_hsc_enabled;
|
||||
|
||||
#endif
|
||||
+124
@@ -0,0 +1,124 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _ __ ___
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ / / / _
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / ___/ /__/
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
// Copyright 2020 Rupert Carmichael
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Database.c
|
||||
// ----------------------------------------------------------------------------
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "Database.h"
|
||||
|
||||
bool cart_in_db = false;
|
||||
bool database_enabled = true;
|
||||
const char *database_filename;
|
||||
|
||||
bool database_Load(const char *digest) {
|
||||
cart_in_db = false;
|
||||
|
||||
if (database_enabled) {
|
||||
FILE* file = fopen(database_filename, "r");
|
||||
if (file == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// max count of items in the database
|
||||
static int count = 17;
|
||||
|
||||
char buffer[256];
|
||||
while (fgets(buffer, 256, file) != NULL) {
|
||||
if (strstr(buffer, digest)) {
|
||||
cart_in_db = true;
|
||||
char entry[count][256];
|
||||
for (int index = 0; index < count; ++index) {
|
||||
char *buf = fgets(buffer, 256, file);
|
||||
buffer[strcspn(buf, "\r\n")] = 0;
|
||||
snprintf(entry[index], sizeof(entry[index]), "%s", buffer);
|
||||
}
|
||||
|
||||
cartridge_type = (uint8_t)atoi(strchr(entry[1], '=') + 1);
|
||||
|
||||
cartridge_pokey = (uint8_t)atoi(strchr(entry[2], '=') + 1);
|
||||
|
||||
cartridge_controller[0] = (uint8_t)atoi(strchr(entry[3], '=') + 1);
|
||||
cartridge_controller[1] = (uint8_t)atoi(strchr(entry[4], '=') + 1);
|
||||
|
||||
cartridge_region = (uint8_t)atoi(strchr(entry[5], '=') + 1);
|
||||
|
||||
cartridge_flags = (uint32_t)atoi(strchr(entry[6], '=') + 1);
|
||||
|
||||
// Optionally load the lightgun crosshair offsets, hblank, dual analog
|
||||
for (int index = 7; index < 11; ++index) {
|
||||
if (strstr(entry[index], "crossx")) {
|
||||
cartridge_crosshair_x = (int)atoi(strchr(entry[index], '=') + 1);
|
||||
}
|
||||
|
||||
if (strstr(entry[index], "crossy")) {
|
||||
cartridge_crosshair_y = (int)atoi(strchr(entry[index], '=') + 1);
|
||||
}
|
||||
|
||||
if (strstr(entry[index], "hblank")) {
|
||||
cartridge_hblank = (int)atoi(strchr(entry[index], '=') + 1);
|
||||
}
|
||||
|
||||
if (strstr(entry[index], "dualanalog")) {
|
||||
cartridge_dualanalog = (uint8_t)atoi(strchr(entry[index], '=') + 1);
|
||||
}
|
||||
|
||||
if (strstr(entry[index], "pokey450")) {
|
||||
cartridge_pokey450 = (uint8_t)atoi(strchr(entry[index], '=') + 1);
|
||||
if (cartridge_pokey450) {
|
||||
cartridge_pokey = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (strstr(entry[index], "disablebios")) {
|
||||
cartridge_disable_bios = (uint8_t)atoi(strchr(entry[index], '=') + 1);
|
||||
}
|
||||
|
||||
if (strstr(entry[index], "leftswitch")) {
|
||||
cartridge_left_switch = (uint8_t)atoi(strchr(entry[index], '=') + 1);
|
||||
}
|
||||
|
||||
if (strstr(entry[index], "rightswitch")) {
|
||||
cartridge_right_switch = (uint8_t)atoi(strchr(entry[index], '=') + 1);
|
||||
}
|
||||
|
||||
if (strstr(entry[index], "swapbuttons")) {
|
||||
cartridge_swap_buttons = (uint8_t)atoi(strchr(entry[index], '=') + 1);
|
||||
}
|
||||
|
||||
if (strstr(entry[index], "hsc")) {
|
||||
cartridge_hsc_enabled = (uint8_t)atoi(strchr(entry[index], '=') + 1);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
fclose(file);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
Executable → Regular
+8
-15
@@ -1,11 +1,12 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _ __ ___
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ / / / _
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / ___/ /__/
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// Copyright 2020 Rupert Carmichael
|
||||
//
|
||||
// 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
|
||||
@@ -25,19 +26,11 @@
|
||||
#ifndef DATABASE_H
|
||||
#define DATABASE_H
|
||||
|
||||
#include <string>
|
||||
#include "Cartridge.h"
|
||||
#include "Logger.h"
|
||||
#include "Common.h"
|
||||
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned short word;
|
||||
typedef unsigned int uint;
|
||||
|
||||
extern void database_Initialize( );
|
||||
extern bool database_Load(std::string digest);
|
||||
extern bool database_enabled;
|
||||
extern std::string database_filename;
|
||||
extern bool database_Load(const char *digest);
|
||||
extern bool cart_in_db;
|
||||
extern bool database_enabled;
|
||||
extern const char *database_filename;
|
||||
|
||||
#endif
|
||||
Executable → Regular
+6
-5
@@ -1,11 +1,12 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _ __ ___
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ / / / _
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / ___/ /__/
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// Copyright 2020 Rupert Carmichael
|
||||
//
|
||||
// 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
|
||||
@@ -71,7 +72,7 @@
|
||||
#define P7C2 62
|
||||
#define P7C3 63
|
||||
#define SWCHA 640
|
||||
#define CTLSWA 641
|
||||
#define CTLSWA 641
|
||||
#define SWCHB 642
|
||||
#define CTLSWB 643
|
||||
#define INTIM 644
|
||||
@@ -1,81 +1,84 @@
|
||||
/*
|
||||
Memory map:
|
||||
|
||||
POKEY1 $0450 $045F 16 bytes
|
||||
POKEY2* $0460 $046F 16 bytes
|
||||
XCTRL $0470 $047F 1 byte
|
||||
RAM $4000 $7FFF 16384 bytes
|
||||
|
||||
XCTRL Bit Description
|
||||
|
||||
+-------------------------------+
|
||||
| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|
||||
+-------------------------------+
|
||||
| | | | | | | |
|
||||
| | | | | | | +-- Bank select bit 0 \
|
||||
| | | | | | +------ Bank select bit 1 | Totally 128 KByte in 16 KByte banks
|
||||
| | | | | +---------- Bank select bit 3 /
|
||||
| | | | +-------------- Enable memory bit (1 = Memory enabled, 0 after power on)
|
||||
| | | +------------------ Enable POKEY bit** (1 = POKEY enabled, 0 after power on)
|
||||
| | |
|
||||
NA NA NA = Not Available or Not Used
|
||||
|
||||
* = Can be mounted piggy back on the first POKEY. Description how to do this will come when i have tried it out.
|
||||
** This bit controls both POKEY chip select signals.
|
||||
|
||||
|
||||
The mapping is totally non compatible with pretty much everything.
|
||||
There is a bank select latch located at $0470 and the POKEY is located at $0450
|
||||
(There's also a chip select output ($0460) on the PLD which alows you to simply piggy back a second POKEY).
|
||||
Since the PLD is reconfigurable I could map the POKEY (or the RAM for that matter) to pretty much anything
|
||||
if you wanted to. However since the PLD is soldered under the POKEY this needs to be configured before delivery.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "ExpansionModule.h"
|
||||
|
||||
byte xm_ram[XM_RAM_SIZE] = {0};
|
||||
byte xm_reg = 0;
|
||||
byte xm_bank = 0;
|
||||
bool xm_pokey_enabled = false;
|
||||
bool xm_mem_enabled = false;
|
||||
|
||||
void xm_Reset() {
|
||||
memset(xm_ram, 0, XM_RAM_SIZE);
|
||||
xm_bank = 0;
|
||||
xm_reg = 0;
|
||||
xm_pokey_enabled = false;
|
||||
xm_mem_enabled = false;
|
||||
}
|
||||
|
||||
byte xm_Read(word address) {
|
||||
if (xm_pokey_enabled && (address >= 0x0450 && address < 0x0460)) {
|
||||
byte b = pokey_GetRegister(0x4000 + (address - 0x0450));
|
||||
return b;
|
||||
} else if (xm_pokey_enabled && (address >= 0x0460 && address < 0x0470)) {
|
||||
byte b = pokey_GetRegister(0x4000 + (address - 0x0460));
|
||||
return b;
|
||||
} else if (xm_mem_enabled && (address >= 0x4000 && address < 0x8000)) {
|
||||
byte b = xm_ram[(xm_bank * 0x4000) + (address - 0x4000)];
|
||||
return b;
|
||||
} else if (address >= 0x0470 && address < 0x0480) {
|
||||
// TODO: Should the value be returned?
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void xm_Write(word address, byte data) {
|
||||
if (xm_pokey_enabled && (address >= 0x0450 && address < 0x0460)) {
|
||||
pokey_SetRegister(0x4000 + (address - 0x0450), data);
|
||||
} else if (xm_pokey_enabled && (address >= 0x0460 && address < 0x0470)) {
|
||||
pokey_SetRegister(0x4000 + (address - 0x0460), data);
|
||||
} else if (xm_mem_enabled && (address >= 0x4000 && address < 0x8000)) {
|
||||
|
||||
xm_ram[(xm_bank * 0x4000) + (address - 0x4000)] = data;
|
||||
} else if (address >= 0x0470 && address < 0x0480) {
|
||||
xm_reg = data;
|
||||
xm_bank = xm_reg & 7;
|
||||
xm_pokey_enabled = (xm_reg & 0x10) > 0;
|
||||
xm_mem_enabled = (xm_reg & 0x08) > 0;
|
||||
}
|
||||
}
|
||||
/*
|
||||
Memory map:
|
||||
POKEY1 $0450 $045F 16 bytes
|
||||
POKEY2* $0460 $046F 16 bytes
|
||||
XCTRL $0470 $047F 1 byte
|
||||
RAM $4000 $7FFF 16384 bytes
|
||||
XCTRL Bit Description
|
||||
+-------------------------------+
|
||||
| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|
||||
+-------------------------------+
|
||||
| | | | | | | |
|
||||
| | | | | | | +-- Bank select bit 0 \
|
||||
| | | | | | +------ Bank select bit 1 | Totally 128 KByte in 16 KByte banks
|
||||
| | | | | +---------- Bank select bit 3 /
|
||||
| | | | +-------------- Enable memory bit (1 = Memory enabled, 0 after power on)
|
||||
| | | +------------------ Enable POKEY bit** (1 = POKEY enabled, 0 after power on)
|
||||
| | |
|
||||
NA NA NA = Not Available or Not Used
|
||||
* = Can be mounted piggy back on the first POKEY. Description how to do this will come when i have tried it out.
|
||||
** This bit controls both POKEY chip select signals.
|
||||
The mapping is totally non compatible with pretty much everything.
|
||||
There is a bank select latch located at $0470 and the POKEY is located at $0450
|
||||
(There's also a chip select output ($0460) on the PLD which alows you to simply piggy back a second POKEY).
|
||||
Since the PLD is reconfigurable I could map the POKEY (or the RAM for that matter) to pretty much anything
|
||||
if you wanted to. However since the PLD is soldered under the POKEY this needs to be configured before delivery.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "ExpansionModule.h"
|
||||
|
||||
uint8_t xm_ram[XM_RAM_SIZE] = {0};
|
||||
uint8_t xm_reg = 0;
|
||||
uint8_t xm_bank = 0;
|
||||
bool xm_pokey_enabled = false;
|
||||
bool xm_mem_enabled = false;
|
||||
|
||||
void xm_Reset(void) {
|
||||
for (int i = 0; i < XM_RAM_SIZE; i++) {
|
||||
xm_ram[i] = 0;
|
||||
}
|
||||
xm_bank = 0;
|
||||
xm_reg = 0;
|
||||
xm_pokey_enabled = false;
|
||||
xm_mem_enabled = false;
|
||||
}
|
||||
|
||||
uint8_t xm_Read(uint16_t address) {
|
||||
if (xm_pokey_enabled && (address >= 0x0450 && address < 0x0460)) {
|
||||
uint8_t b = pokey_GetRegister(0x4000 + (address - 0x0450));
|
||||
return b;
|
||||
}
|
||||
else if (xm_pokey_enabled && (address >= 0x0460 && address < 0x0470)) {
|
||||
uint8_t b = pokey_GetRegister(0x4000 + (address - 0x0460));
|
||||
return b;
|
||||
}
|
||||
else if (xm_mem_enabled && (address >= 0x4000 && address < 0x8000)) {
|
||||
uint8_t b = xm_ram[(xm_bank * 0x4000) + (address - 0x4000)];
|
||||
return b;
|
||||
}
|
||||
else if (address >= 0x0470 && address < 0x0480) {
|
||||
// TODO: Should the value be returned?
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void xm_Write(uint16_t address, uint8_t data) {
|
||||
if (xm_pokey_enabled && (address >= 0x0450 && address < 0x0460)) {
|
||||
pokey_SetRegister(0x4000 + (address - 0x0450), data);
|
||||
}
|
||||
else if (xm_pokey_enabled && (address >= 0x0460 && address < 0x0470)) {
|
||||
pokey_SetRegister(0x4000 + (address - 0x0460), data);
|
||||
}
|
||||
else if (xm_mem_enabled && (address >= 0x4000 && address < 0x8000)) {
|
||||
xm_ram[(xm_bank * 0x4000) + (address - 0x4000)] = data;
|
||||
}
|
||||
else if (address >= 0x0470 && address < 0x0480) {
|
||||
xm_reg = data;
|
||||
xm_bank = xm_reg & 7;
|
||||
xm_pokey_enabled = (xm_reg & 0x10) > 0;
|
||||
xm_mem_enabled = (xm_reg & 0x08) > 0;
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,18 @@
|
||||
#ifndef EXPANSIONMODULE_H
|
||||
#define EXPANSIONMODULE_H
|
||||
|
||||
#include "Cartridge.h"
|
||||
#include "Memory.h"
|
||||
|
||||
#define XM_RAM_SIZE 0x20000
|
||||
|
||||
extern byte xm_ram[XM_RAM_SIZE];
|
||||
extern bool xm_pokey_enabled;
|
||||
extern bool xm_mem_enabled;
|
||||
extern byte xm_reg;
|
||||
extern byte xm_bank;
|
||||
|
||||
|
||||
void xm_Reset();
|
||||
byte xm_Read(word address);
|
||||
void xm_Write(word address, byte data);
|
||||
#endif
|
||||
#ifndef EXPANSIONMODULE_H
|
||||
#define EXPANSIONMODULE_H
|
||||
|
||||
#include "Cartridge.h"
|
||||
#include "Memory.h"
|
||||
|
||||
#define XM_RAM_SIZE 0x20000
|
||||
|
||||
extern uint8_t xm_ram[XM_RAM_SIZE];
|
||||
extern bool xm_pokey_enabled;
|
||||
extern bool xm_mem_enabled;
|
||||
extern uint8_t xm_reg;
|
||||
extern uint8_t xm_bank;
|
||||
|
||||
void xm_Reset(void);
|
||||
uint8_t xm_Read(uint16_t address);
|
||||
void xm_Write(uint16_t address, uint8_t data);
|
||||
#endif
|
||||
+326
@@ -0,0 +1,326 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _ __ ___
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ / / / _
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / ___/ /__/
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
// Copyright 2020 Rupert Carmichael
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Maria.c
|
||||
// ----------------------------------------------------------------------------
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "Maria.h"
|
||||
#define MARIA_LINERAM_SIZE 160
|
||||
|
||||
rect maria_displayArea = {0, 16, 319, 258};
|
||||
rect maria_visibleArea = {0, 26, 319, 248};
|
||||
uint8_t maria_surface[MARIA_SURFACE_SIZE] = {0};
|
||||
uint16_t maria_scanline = 1;
|
||||
|
||||
static uint8_t maria_lineRAM[MARIA_LINERAM_SIZE];
|
||||
static uint32_t maria_cycles;
|
||||
static pair maria_dpp;
|
||||
static pair maria_dp;
|
||||
static pair maria_pp;
|
||||
static uint8_t maria_horizontal;
|
||||
static uint8_t maria_palette;
|
||||
static signed char maria_offset;
|
||||
static uint8_t maria_h08;
|
||||
static uint8_t maria_h16;
|
||||
static uint8_t maria_wmode;
|
||||
|
||||
static inline void maria_StoreCell(uint8_t data) {
|
||||
if (maria_horizontal < MARIA_LINERAM_SIZE) {
|
||||
if (data) {
|
||||
maria_lineRAM[maria_horizontal] = maria_palette | data;
|
||||
}
|
||||
else {
|
||||
uint8_t kmode = memory_ram[CTRL] & 4;
|
||||
if (kmode) {
|
||||
maria_lineRAM[maria_horizontal] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
maria_horizontal++;
|
||||
}
|
||||
|
||||
static inline void maria_StoreCell2(uint8_t high, uint8_t low) {
|
||||
if (maria_horizontal < MARIA_LINERAM_SIZE) {
|
||||
if (low || high) {
|
||||
maria_lineRAM[maria_horizontal] = (maria_palette & 16) | high | low;
|
||||
}
|
||||
else {
|
||||
uint8_t kmode = memory_ram[CTRL] & 4;
|
||||
if (kmode) {
|
||||
maria_lineRAM[maria_horizontal] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
maria_horizontal++;
|
||||
}
|
||||
|
||||
static inline bool maria_IsHolyDMA(void) {
|
||||
if (maria_pp.w > 32767) {
|
||||
if (maria_h16 && (maria_pp.w & 4096)) {
|
||||
return true;
|
||||
}
|
||||
if (maria_h08 && (maria_pp.w & 2048)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline uint8_t maria_GetColor(uint8_t data) {
|
||||
if (data & 3) {
|
||||
return memory_ram[BACKGRND + data];
|
||||
}
|
||||
else {
|
||||
return memory_ram[BACKGRND];
|
||||
}
|
||||
}
|
||||
|
||||
static inline void maria_StoreGraphic(void) {
|
||||
uint8_t data = memory_ram[maria_pp.w];
|
||||
if (maria_wmode) {
|
||||
if (maria_IsHolyDMA()) {
|
||||
maria_StoreCell2(0, 0);
|
||||
maria_StoreCell2(0, 0);
|
||||
}
|
||||
else {
|
||||
maria_StoreCell2((data & 12), (data & 192) >> 6);
|
||||
maria_StoreCell2((data & 48) >> 4, (data & 3) << 2);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(maria_IsHolyDMA()) {
|
||||
maria_StoreCell(0);
|
||||
maria_StoreCell(0);
|
||||
maria_StoreCell(0);
|
||||
maria_StoreCell(0);
|
||||
}
|
||||
else {
|
||||
maria_StoreCell((data & 192) >> 6);
|
||||
maria_StoreCell((data & 48) >> 4);
|
||||
maria_StoreCell((data & 12) >> 2);
|
||||
maria_StoreCell(data & 3);
|
||||
}
|
||||
}
|
||||
maria_pp.w++;
|
||||
}
|
||||
|
||||
static inline void maria_WriteLineRAM(uint8_t* buffer) {
|
||||
uint8_t rmode = memory_ram[CTRL] & 3;
|
||||
if (rmode == 0) { // 160A/B
|
||||
int pixel = 0;
|
||||
for (int index = 0; index < MARIA_LINERAM_SIZE; index += 4) {
|
||||
uint16_t color;
|
||||
color = maria_GetColor(maria_lineRAM[index + 0]);
|
||||
buffer[pixel++] = color;
|
||||
buffer[pixel++] = color;
|
||||
color = maria_GetColor(maria_lineRAM[index + 1]);
|
||||
buffer[pixel++] = color;
|
||||
buffer[pixel++] = color;
|
||||
color = maria_GetColor(maria_lineRAM[index + 2]);
|
||||
buffer[pixel++] = color;
|
||||
buffer[pixel++] = color;
|
||||
color = maria_GetColor(maria_lineRAM[index + 3]);
|
||||
buffer[pixel++] = color;
|
||||
buffer[pixel++] = color;
|
||||
}
|
||||
}
|
||||
else if (rmode == 2) { // 320B/D
|
||||
int pixel = 0;
|
||||
for (int index = 0; index < MARIA_LINERAM_SIZE; index += 4) {
|
||||
buffer[pixel++] = maria_GetColor((maria_lineRAM[index + 0] & 16) | ((maria_lineRAM[index + 0] & 8) >> 3) | ((maria_lineRAM[index + 0] & 2)));
|
||||
buffer[pixel++] = maria_GetColor((maria_lineRAM[index + 0] & 16) | ((maria_lineRAM[index + 0] & 4) >> 2) | ((maria_lineRAM[index + 0] & 1) << 1));
|
||||
buffer[pixel++] = maria_GetColor((maria_lineRAM[index + 1] & 16) | ((maria_lineRAM[index + 1] & 8) >> 3) | ((maria_lineRAM[index + 1] & 2)));
|
||||
buffer[pixel++] = maria_GetColor((maria_lineRAM[index + 1] & 16) | ((maria_lineRAM[index + 1] & 4) >> 2) | ((maria_lineRAM[index + 1] & 1) << 1));
|
||||
buffer[pixel++] = maria_GetColor((maria_lineRAM[index + 2] & 16) | ((maria_lineRAM[index + 2] & 8) >> 3) | ((maria_lineRAM[index + 2] & 2)));
|
||||
buffer[pixel++] = maria_GetColor((maria_lineRAM[index + 2] & 16) | ((maria_lineRAM[index + 2] & 4) >> 2) | ((maria_lineRAM[index + 2] & 1) << 1));
|
||||
buffer[pixel++] = maria_GetColor((maria_lineRAM[index + 3] & 16) | ((maria_lineRAM[index + 3] & 8) >> 3) | ((maria_lineRAM[index + 3] & 2)));
|
||||
buffer[pixel++] = maria_GetColor((maria_lineRAM[index + 3] & 16) | ((maria_lineRAM[index + 3] & 4) >> 2) | ((maria_lineRAM[index + 3] & 1) << 1));
|
||||
}
|
||||
}
|
||||
else if (rmode == 3) { // 320A/C
|
||||
int pixel = 0;
|
||||
for (int index = 0; index < MARIA_LINERAM_SIZE; index += 4) {
|
||||
buffer[pixel++] = maria_GetColor((maria_lineRAM[index + 0] & 30));
|
||||
buffer[pixel++] = maria_GetColor((maria_lineRAM[index + 0] & 28) | ((maria_lineRAM[index + 0] & 1) << 1));
|
||||
buffer[pixel++] = maria_GetColor((maria_lineRAM[index + 1] & 30));
|
||||
buffer[pixel++] = maria_GetColor((maria_lineRAM[index + 1] & 28) | ((maria_lineRAM[index + 1] & 1) << 1));
|
||||
buffer[pixel++] = maria_GetColor((maria_lineRAM[index + 2] & 30));
|
||||
buffer[pixel++] = maria_GetColor((maria_lineRAM[index + 2] & 28) | ((maria_lineRAM[index + 2] & 1) << 1));
|
||||
buffer[pixel++] = maria_GetColor((maria_lineRAM[index + 3] & 30));
|
||||
buffer[pixel++] = maria_GetColor((maria_lineRAM[index + 3] & 28) | ((maria_lineRAM[index + 3] & 1) << 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void maria_StoreLineRAM(void) {
|
||||
for(int index = 0; index < MARIA_LINERAM_SIZE; index++) {
|
||||
maria_lineRAM[index] = 0;
|
||||
}
|
||||
|
||||
uint8_t mode = memory_ram[maria_dp.w + 1];
|
||||
while(mode & 0x5f) {
|
||||
uint8_t width;
|
||||
uint8_t indirect = 0;
|
||||
|
||||
maria_pp.b.l = memory_ram[maria_dp.w];
|
||||
maria_pp.b.h = memory_ram[maria_dp.w + 2];
|
||||
|
||||
if (mode & 31) {
|
||||
maria_cycles += 8; // Maria cycles (Header 4 uint8_t)
|
||||
maria_palette = (memory_ram[maria_dp.w + 1] & 224) >> 3;
|
||||
maria_horizontal = memory_ram[maria_dp.w + 3];
|
||||
width = memory_ram[maria_dp.w + 1] & 31;
|
||||
width = ((~width) & 31) + 1;
|
||||
maria_dp.w += 4;
|
||||
}
|
||||
else {
|
||||
maria_cycles += 12; // Maria cycles (Header 5 uint8_t)
|
||||
maria_palette = (memory_ram[maria_dp.w + 3] & 224) >> 3;
|
||||
maria_horizontal = memory_ram[maria_dp.w + 4];
|
||||
indirect = memory_ram[maria_dp.w + 1] & 32;
|
||||
maria_wmode = memory_ram[maria_dp.w + 1] & 128;
|
||||
width = memory_ram[maria_dp.w + 3] & 31;
|
||||
width = (width == 0)? 32: ((~width) & 31) + 1;
|
||||
maria_dp.w += 5;
|
||||
}
|
||||
|
||||
if (!indirect) {
|
||||
maria_pp.b.h += maria_offset;
|
||||
for (int index = 0; index < width; index++) {
|
||||
maria_cycles += 3; // Maria cycles (Direct graphic read)
|
||||
maria_StoreGraphic( );
|
||||
}
|
||||
}
|
||||
else {
|
||||
uint8_t cwidth = memory_ram[CTRL] & 16;
|
||||
pair basePP = maria_pp;
|
||||
for (int index = 0; index < width; index++) {
|
||||
maria_cycles += 3; // Maria cycles (Indirect)
|
||||
maria_pp.b.l = memory_ram[basePP.w++];
|
||||
maria_pp.b.h = memory_ram[CHARBASE] + maria_offset;
|
||||
|
||||
maria_cycles += 3; // Maria cycles (Indirect, 1 uint8_t)
|
||||
maria_StoreGraphic( );
|
||||
|
||||
if (cwidth) {
|
||||
maria_cycles += 3; // Maria cycles (Indirect, 2 uint8_ts)
|
||||
maria_StoreGraphic( );
|
||||
}
|
||||
}
|
||||
}
|
||||
mode = memory_ram[maria_dp.w + 1];
|
||||
}
|
||||
}
|
||||
|
||||
void maria_Reset(void) {
|
||||
maria_scanline = 1;
|
||||
|
||||
for(int index = 0; index < MARIA_SURFACE_SIZE; index++) {
|
||||
maria_surface[index] = 0;
|
||||
}
|
||||
|
||||
maria_cycles = 0;
|
||||
maria_dpp.w = 0;
|
||||
maria_dp.w = 0;
|
||||
maria_pp.w = 0;
|
||||
maria_horizontal = 0;
|
||||
maria_palette = 0;
|
||||
maria_offset = 0;
|
||||
maria_h08 = 0;
|
||||
maria_h16 = 0;
|
||||
maria_wmode = 0;
|
||||
}
|
||||
|
||||
uint32_t maria_RenderScanline(void) {
|
||||
maria_cycles = 0;
|
||||
|
||||
// lightgun flash
|
||||
// Displays the background color when Maria is disabled (if applicable)
|
||||
if (((memory_ram[CTRL] & 96 ) != 64 ) &&
|
||||
maria_scanline >= maria_visibleArea.top &&
|
||||
maria_scanline <= maria_visibleArea.bottom) {
|
||||
uint8_t bgcolor = maria_GetColor(0);
|
||||
uint8_t *bgstart = maria_surface + ((maria_scanline - maria_displayArea.top) *
|
||||
((maria_displayArea.right - maria_displayArea.left) + 1));
|
||||
|
||||
for(uint32_t index = 0; index < MARIA_LINERAM_SIZE; index++ ) {
|
||||
*bgstart++ = bgcolor;
|
||||
*bgstart++ = bgcolor;
|
||||
}
|
||||
}
|
||||
|
||||
if ((memory_ram[CTRL] & 96) == 64 && maria_scanline >= maria_displayArea.top && maria_scanline <= maria_displayArea.bottom) {
|
||||
maria_cycles += 5; // Maria cycles (DMA Startup)
|
||||
|
||||
if (maria_scanline == maria_displayArea.top) {
|
||||
maria_cycles += 10; // Maria cycles (End of VBLANK)
|
||||
maria_dpp.b.l = memory_ram[DPPL];
|
||||
maria_dpp.b.h = memory_ram[DPPH];
|
||||
maria_h08 = memory_ram[maria_dpp.w] & 32;
|
||||
maria_h16 = memory_ram[maria_dpp.w] & 64;
|
||||
maria_offset = memory_ram[maria_dpp.w] & 15;
|
||||
maria_dp.b.l = memory_ram[maria_dpp.w + 2];
|
||||
maria_dp.b.h = memory_ram[maria_dpp.w + 1];
|
||||
|
||||
if (memory_ram[maria_dpp.w] & 128) {
|
||||
maria_cycles += 20; // Maria cycles (NMI) /*29, 16, 20*/
|
||||
sally_ExecuteNMI( );
|
||||
}
|
||||
}
|
||||
else if (maria_scanline >= maria_visibleArea.top && maria_scanline <= maria_visibleArea.bottom) {
|
||||
maria_WriteLineRAM(maria_surface + ((maria_scanline - maria_displayArea.top) *
|
||||
((maria_displayArea.right - maria_displayArea.left) + 1)));
|
||||
}
|
||||
|
||||
if (maria_scanline != maria_displayArea.bottom) {
|
||||
maria_dp.b.l = memory_ram[maria_dpp.w + 2];
|
||||
maria_dp.b.h = memory_ram[maria_dpp.w + 1];
|
||||
maria_StoreLineRAM( );
|
||||
maria_offset--;
|
||||
|
||||
if (maria_offset < 0) {
|
||||
maria_cycles += 10; // Maria cycles (Last line of zone) /*20*/
|
||||
maria_dpp.w += 3;
|
||||
maria_h08 = memory_ram[maria_dpp.w] & 32;
|
||||
maria_h16 = memory_ram[maria_dpp.w] & 64;
|
||||
maria_offset = memory_ram[maria_dpp.w] & 15;
|
||||
if(memory_ram[maria_dpp.w] & 128) {
|
||||
maria_cycles += 20; // Maria cycles (NMI) /*29, 16, 20*/
|
||||
sally_ExecuteNMI( );
|
||||
}
|
||||
}
|
||||
else {
|
||||
maria_cycles += 4; // Maria cycles (Other lines of zone)
|
||||
}
|
||||
}
|
||||
}
|
||||
return maria_cycles;
|
||||
}
|
||||
|
||||
void maria_Clear(void) {
|
||||
for(int index = 0; index < MARIA_SURFACE_SIZE; index++) {
|
||||
maria_surface[index] = 0;
|
||||
}
|
||||
}
|
||||
Executable → Regular
+12
-14
@@ -1,11 +1,12 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _ __ ___
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ / / / _
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / ___/ /__/
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// Copyright 2020 Rupert Carmichael
|
||||
//
|
||||
// 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
|
||||
@@ -24,6 +25,7 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
#ifndef MARIA_H
|
||||
#define MARIA_H
|
||||
|
||||
#define MARIA_SURFACE_SIZE 93440
|
||||
|
||||
#include "Equates.h"
|
||||
@@ -32,16 +34,12 @@
|
||||
#include "Rect.h"
|
||||
#include "Sally.h"
|
||||
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned short word;
|
||||
typedef unsigned int uint;
|
||||
|
||||
extern void maria_Reset( );
|
||||
extern uint maria_RenderScanline( );
|
||||
extern void maria_Clear( );
|
||||
extern void maria_Reset(void);
|
||||
extern uint32_t maria_RenderScanline(void);
|
||||
extern void maria_Clear(void);
|
||||
extern rect maria_displayArea;
|
||||
extern rect maria_visibleArea;
|
||||
extern byte maria_surface[MARIA_SURFACE_SIZE];
|
||||
extern word maria_scanline;
|
||||
extern uint8_t maria_surface[MARIA_SURFACE_SIZE];
|
||||
extern uint16_t maria_scanline;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
+226
@@ -0,0 +1,226 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _ __ ___
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ / / / _
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / ___/ /__/
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
// Copyright 2020 Rupert Carmichael
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Memory.cpp
|
||||
// ----------------------------------------------------------------------------
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "Memory.h"
|
||||
#include "ExpansionModule.h"
|
||||
|
||||
uint8_t memory_ram[MEMORY_SIZE] = {0};
|
||||
uint8_t memory_rom[MEMORY_SIZE] = {0};
|
||||
|
||||
void memory_Reset(void) {
|
||||
uint32_t index;
|
||||
|
||||
for (index = 0; index < MEMORY_SIZE; index++) {
|
||||
memory_ram[index] = 0;
|
||||
memory_rom[index] = 1;
|
||||
}
|
||||
|
||||
for (index = 0; index < 16384; index++) {
|
||||
memory_rom[index] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t memory_Read(uint16_t address) {
|
||||
uint8_t tmp_uint8_t;
|
||||
|
||||
/*if (cartridge_pokey && address == POKEY_RANDOM) {
|
||||
return pokey_GetRegister(POKEY_RANDOM);
|
||||
}*/
|
||||
if (cartridge_xm) {
|
||||
if ((address >= 0x0470 && address < 0x0480) ||
|
||||
(xm_pokey_enabled && (address >= 0x0450 && address < 0x0470)) ||
|
||||
(xm_mem_enabled && (address >= 0x4000 && address < 0x8000))) {
|
||||
return xm_Read(address);
|
||||
}
|
||||
}
|
||||
|
||||
if (cartridge_pokey &&
|
||||
((!cartridge_pokey450 && (address >= 0x4000 && address <= 0x400f)) ||
|
||||
(cartridge_pokey450 && (address >= 0x0450 && address < 0x0470)))) {
|
||||
return pokey_GetRegister(
|
||||
cartridge_pokey450 ? 0x4000 + (address - 0x0450) : address
|
||||
);
|
||||
}
|
||||
|
||||
switch (address) {
|
||||
case INTIM:
|
||||
case INTIM | 0x2:
|
||||
memory_ram[INTFLG] &= 0x7f;
|
||||
return memory_ram[INTIM];
|
||||
|
||||
case INTFLG:
|
||||
case INTFLG | 0x2:
|
||||
tmp_uint8_t = memory_ram[INTFLG];
|
||||
memory_ram[INTFLG] &= 0x7f;
|
||||
return tmp_uint8_t;
|
||||
|
||||
default:
|
||||
return memory_ram[address];
|
||||
}
|
||||
}
|
||||
|
||||
void memory_Write(uint16_t address, uint8_t data) {
|
||||
if (cartridge_xm &&
|
||||
((address >= 0x0470 && address < 0x0480) ||
|
||||
((xm_pokey_enabled && (address >= 0x0450 && address < 0x0470)) ||
|
||||
(xm_mem_enabled && (address >= 0x4000 && address < 0x8000))))) {
|
||||
xm_Write(address, data);
|
||||
return;
|
||||
}
|
||||
|
||||
if (cartridge_pokey &&
|
||||
((!cartridge_pokey450 && (address >= 0x4000 && address <= 0x400f)) ||
|
||||
(cartridge_pokey450 && (address >= 0x0450 && address < 0x0470)))) {
|
||||
pokey_SetRegister(
|
||||
(cartridge_pokey450 ? 0x4000 + (address - 0x0450) : address), data
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!memory_rom[address]) {
|
||||
switch(address) {
|
||||
case WSYNC:
|
||||
if (!(cartridge_flags & 128)) {
|
||||
memory_ram[WSYNC] = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case INPTCTRL:
|
||||
if (data == 22 && cartridge_IsLoaded()) {
|
||||
cartridge_Store();
|
||||
}
|
||||
else if (data == 2 && bios_enabled) {
|
||||
bios_Store();
|
||||
}
|
||||
break;
|
||||
|
||||
case INPT0:
|
||||
case INPT1:
|
||||
case INPT2:
|
||||
case INPT3:
|
||||
case INPT4:
|
||||
case INPT5:
|
||||
break;
|
||||
|
||||
case AUDC0:
|
||||
tia_SetRegister(AUDC0, data);
|
||||
break;
|
||||
|
||||
case AUDC1:
|
||||
tia_SetRegister(AUDC1, data);
|
||||
break;
|
||||
|
||||
case AUDF0:
|
||||
tia_SetRegister(AUDF0, data);
|
||||
break;
|
||||
|
||||
case AUDF1:
|
||||
tia_SetRegister(AUDF1, data);
|
||||
break;
|
||||
|
||||
case AUDV0:
|
||||
tia_SetRegister(AUDV0, data);
|
||||
break;
|
||||
|
||||
case AUDV1:
|
||||
tia_SetRegister(AUDV1, data);
|
||||
break;
|
||||
|
||||
/*gdement: Writing here actually writes to DRA inside the RIOT chip.
|
||||
This value only indirectly affects output of SWCHA. Ditto for SWCHB.*/
|
||||
case SWCHA:
|
||||
riot_SetDRA(data);
|
||||
break;
|
||||
|
||||
case SWCHB:
|
||||
riot_SetDRB(data);
|
||||
break;
|
||||
|
||||
case TIM1T:
|
||||
case TIM1T | 0x8:
|
||||
riot_SetTimer(TIM1T, data);
|
||||
break;
|
||||
|
||||
case TIM8T:
|
||||
case TIM8T | 0x8:
|
||||
riot_SetTimer(TIM8T, data);
|
||||
break;
|
||||
|
||||
case TIM64T:
|
||||
case TIM64T | 0x8:
|
||||
riot_SetTimer(TIM64T, data);
|
||||
break;
|
||||
|
||||
case T1024T:
|
||||
case T1024T | 0x8:
|
||||
riot_SetTimer(T1024T, data);
|
||||
break;
|
||||
|
||||
default:
|
||||
memory_ram[address] = data;
|
||||
|
||||
if (address >= 8256 && address <= 8447) {
|
||||
memory_ram[address - 8192] = data;
|
||||
}
|
||||
else if (address >= 8512 && address <= 8702) {
|
||||
memory_ram[address - 8192] = data;
|
||||
}
|
||||
else if (address >= 64 && address <= 255) {
|
||||
memory_ram[address + 8192] = data;
|
||||
}
|
||||
else if (address >= 320 && address <= 511) {
|
||||
memory_ram[address + 8192] = data;
|
||||
}
|
||||
break;
|
||||
}
|
||||
/*TODO: gdement: test here for debug port. Don't put it in the switch
|
||||
because that will change behavior.*/
|
||||
}
|
||||
else {
|
||||
cartridge_Write(address, data);
|
||||
}
|
||||
}
|
||||
|
||||
void memory_WriteROM(uint16_t address, uint32_t size, const uint8_t* data) {
|
||||
if ((address + size) <= MEMORY_SIZE && data != NULL) {
|
||||
for (uint32_t index = 0; index < size; index++) {
|
||||
memory_ram[address + index] = data[index];
|
||||
memory_rom[address + index] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void memory_ClearROM(uint16_t address, uint32_t size) {
|
||||
if ((address + size) <= MEMORY_SIZE) {
|
||||
for (uint32_t index = 0; index < size; index++) {
|
||||
memory_ram[address + index] = 0;
|
||||
memory_rom[address + index] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable → Regular
+12
-14
@@ -1,10 +1,11 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _ __ ___
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ / / / _
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / ___/ /__/
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
// Copyright 2020 Rupert Carmichael
|
||||
//
|
||||
// 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
|
||||
@@ -24,7 +25,6 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
#ifndef MEMORY_H
|
||||
#define MEMORY_H
|
||||
#define MEMORY_SIZE 65536
|
||||
|
||||
#include "Equates.h"
|
||||
#include "Bios.h"
|
||||
@@ -32,16 +32,14 @@
|
||||
#include "Tia.h"
|
||||
#include "Riot.h"
|
||||
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned short word;
|
||||
typedef unsigned int uint;
|
||||
#define MEMORY_SIZE 65536
|
||||
|
||||
extern void memory_Reset( );
|
||||
extern byte memory_Read(word address);
|
||||
extern void memory_Write(word address, byte data);
|
||||
extern void memory_WriteROM(word address, uint size, const byte* data);
|
||||
extern void memory_ClearROM(word address, uint size);
|
||||
extern byte memory_ram[MEMORY_SIZE];
|
||||
extern byte memory_rom[MEMORY_SIZE];
|
||||
extern void memory_Reset(void);
|
||||
extern uint8_t memory_Read(uint16_t address);
|
||||
extern void memory_Write(uint16_t address, uint8_t data);
|
||||
extern void memory_WriteROM(uint16_t address, uint32_t size, const uint8_t* data);
|
||||
extern void memory_ClearROM(uint16_t address, uint32_t size);
|
||||
extern uint8_t memory_ram[MEMORY_SIZE];
|
||||
extern uint8_t memory_rom[MEMORY_SIZE];
|
||||
|
||||
#endif
|
||||
Executable → Regular
+13
-15
@@ -1,11 +1,12 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _ __ ___
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ / / / _
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / ___/ /__/
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// Copyright 2020 Rupert Carmichael
|
||||
//
|
||||
// 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
|
||||
@@ -25,17 +26,14 @@
|
||||
#ifndef PAIR_H
|
||||
#define PAIR_H
|
||||
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned short word;
|
||||
typedef unsigned int uint;
|
||||
typedef struct Join {
|
||||
uint8_t l;
|
||||
uint8_t h;
|
||||
} Join;
|
||||
|
||||
union Pair {
|
||||
word w;
|
||||
struct Join {
|
||||
byte l;
|
||||
byte h;
|
||||
} b;
|
||||
};
|
||||
typedef union Pair {
|
||||
uint16_t w;
|
||||
Join b;
|
||||
} pair;
|
||||
|
||||
typedef Pair pair;
|
||||
#endif
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _ __ ___
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ / / / _
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / ___/ /__/
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
// Copyright 2020 Rupert Carmichael
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Palette.c
|
||||
// ----------------------------------------------------------------------------
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "Palette.h"
|
||||
|
||||
bool palette_default = true;
|
||||
uint8_t palette_data[PALETTE_SIZE] = {
|
||||
0x00,0x00,0x00,0x25,0x25,0x25,0x34,0x34,0x34,0x4F,0x4F,0x4F,
|
||||
0x5B,0x5B,0x5B,0x69,0x69,0x69,0x7B,0x7B,0x7B,0x8A,0x8A,0x8A,
|
||||
0xA7,0xA7,0xA7,0xB9,0xB9,0xB9,0xC5,0xC5,0xC5,0xD0,0xD0,0xD0,
|
||||
0xD7,0xD7,0xD7,0xE1,0xE1,0xE1,0xF4,0xF4,0xF4,0xFF,0xFF,0xFF,
|
||||
0x4C,0x32,0x00,0x62,0x3A,0x00,0x7B,0x4A,0x00,0x9A,0x60,0x00,
|
||||
0xB5,0x74,0x00,0xCC,0x85,0x00,0xE7,0x9E,0x08,0xF7,0xAF,0x10,
|
||||
0xFF,0xC3,0x18,0xFF,0xD0,0x20,0xFF,0xD8,0x28,0xFF,0xDF,0x30,
|
||||
0xFF,0xE6,0x3B,0xFF,0xF4,0x40,0xFF,0xFA,0x4B,0xFF,0xFF,0x50,
|
||||
0x99,0x25,0x00,0xAA,0x25,0x00,0xB4,0x25,0x00,0xD3,0x30,0x00,
|
||||
0xDD,0x48,0x02,0xE2,0x50,0x09,0xF4,0x67,0x00,0xF4,0x75,0x10,
|
||||
0xFF,0x9E,0x10,0xFF,0xAC,0x20,0xFF,0xBA,0x3A,0xFF,0xBF,0x50,
|
||||
0xFF,0xC6,0x6D,0xFF,0xD5,0x80,0xFF,0xE4,0x90,0xFF,0xE6,0x99,
|
||||
0x98,0x0C,0x0C,0x99,0x0C,0x0C,0xC2,0x13,0x00,0xD3,0x13,0x00,
|
||||
0xE2,0x35,0x00,0xE3,0x40,0x00,0xE4,0x40,0x20,0xE5,0x52,0x30,
|
||||
0xFD,0x78,0x54,0xFF,0x8A,0x6A,0xFF,0x98,0x7C,0xFF,0xA4,0x8B,
|
||||
0xFF,0xB3,0x9E,0xFF,0xC2,0xB2,0xFF,0xD0,0xBA,0xFF,0xD7,0xC0,
|
||||
0x99,0x00,0x00,0xA9,0x00,0x00,0xC2,0x04,0x00,0xD3,0x04,0x00,
|
||||
0xDA,0x04,0x00,0xDB,0x08,0x00,0xE4,0x20,0x20,0xF6,0x40,0x40,
|
||||
0xFB,0x70,0x70,0xFB,0x7E,0x7E,0xFB,0x8F,0x8F,0xFF,0x9F,0x9F,
|
||||
0xFF,0xAB,0xAB,0xFF,0xB9,0xB9,0xFF,0xC9,0xC9,0xFF,0xCF,0xCF,
|
||||
0x7E,0x00,0x50,0x80,0x00,0x50,0x80,0x00,0x5F,0x95,0x0B,0x74,
|
||||
0xAA,0x22,0x88,0xBB,0x2F,0x9A,0xCE,0x3F,0xAD,0xD7,0x5A,0xB6,
|
||||
0xE4,0x67,0xC3,0xEF,0x72,0xCE,0xFB,0x7E,0xDA,0xFF,0x8D,0xE1,
|
||||
0xFF,0x9D,0xE5,0xFF,0xA5,0xE7,0xFF,0xAF,0xEA,0xFF,0xB8,0xEC,
|
||||
0x48,0x00,0x6C,0x5C,0x04,0x88,0x65,0x0D,0x90,0x7B,0x23,0xA7,
|
||||
0x93,0x3B,0xBF,0x9D,0x45,0xC9,0xA7,0x4F,0xD3,0xB2,0x5A,0xDE,
|
||||
0xBD,0x65,0xE9,0xC5,0x6D,0xF1,0xCE,0x76,0xFA,0xD5,0x83,0xFF,
|
||||
0xDA,0x90,0xFF,0xDE,0x9C,0xFF,0xE2,0xA9,0xFF,0xE6,0xB6,0xFF,
|
||||
0x1B,0x00,0x70,0x22,0x1B,0x8D,0x37,0x30,0xA2,0x48,0x41,0xB3,
|
||||
0x59,0x52,0xC4,0x63,0x5C,0xCE,0x6F,0x68,0xDA,0x7D,0x76,0xE8,
|
||||
0x87,0x80,0xF8,0x93,0x8C,0xFF,0x9D,0x97,0xFF,0xA8,0xA3,0xFF,
|
||||
0xB3,0xAF,0xFF,0xBC,0xB8,0xFF,0xC4,0xC1,0xFF,0xDA,0xD1,0xFF,
|
||||
0x00,0x0D,0x7F,0x00,0x12,0xA7,0x00,0x18,0xC0,0x0A,0x2B,0xD1,
|
||||
0x1B,0x4A,0xE3,0x2F,0x58,0xF0,0x37,0x68,0xFF,0x49,0x79,0xFF,
|
||||
0x5B,0x85,0xFF,0x6D,0x96,0xFF,0x7F,0xA3,0xFF,0x8C,0xAD,0xFF,
|
||||
0x96,0xB4,0xFF,0xA8,0xC0,0xFF,0xB7,0xCB,0xFF,0xC6,0xD6,0xFF,
|
||||
0x00,0x29,0x5A,0x00,0x38,0x76,0x00,0x48,0x92,0x00,0x5C,0xAC,
|
||||
0x00,0x71,0xC6,0x00,0x86,0xD0,0x0A,0x9B,0xDF,0x1A,0xA8,0xEC,
|
||||
0x2B,0xB6,0xFF,0x3F,0xC2,0xFF,0x45,0xCB,0xFF,0x59,0xD3,0xFF,
|
||||
0x7F,0xDA,0xFF,0x8F,0xDE,0xFF,0xA0,0xE2,0xFF,0xB0,0xEB,0xFF,
|
||||
0x00,0x38,0x39,0x00,0x3C,0x48,0x00,0x3D,0x5B,0x02,0x66,0x7F,
|
||||
0x03,0x73,0x83,0x00,0x9C,0xAA,0x00,0xA1,0xBB,0x01,0xA4,0xCC,
|
||||
0x03,0xBB,0xFF,0x05,0xDA,0xE2,0x18,0xE5,0xFF,0x34,0xEA,0xFF,
|
||||
0x49,0xEF,0xFF,0x66,0xF2,0xFF,0x84,0xF4,0xFF,0x9E,0xF9,0xFF,
|
||||
0x00,0x4A,0x00,0x00,0x5D,0x00,0x00,0x70,0x00,0x00,0x8B,0x00,
|
||||
0x00,0xA9,0x00,0x00,0xBB,0x05,0x00,0xBD,0x00,0x02,0xD0,0x05,
|
||||
0x1A,0xD5,0x40,0x5A,0xF1,0x77,0x82,0xEF,0xA7,0x84,0xED,0xD1,
|
||||
0x89,0xFF,0xED,0x7D,0xFF,0xFF,0x93,0xFF,0xFF,0x9B,0xFF,0xFF,
|
||||
0x22,0x4A,0x03,0x27,0x53,0x04,0x30,0x64,0x05,0x3C,0x77,0x0C,
|
||||
0x45,0x8C,0x11,0x5A,0xA5,0x13,0x1B,0xD2,0x09,0x1F,0xDD,0x00,
|
||||
0x3D,0xCD,0x2D,0x3D,0xCD,0x30,0x58,0xCC,0x40,0x60,0xD3,0x50,
|
||||
0xA2,0xEC,0x55,0xB3,0xF2,0x4A,0xBB,0xF6,0x5D,0xC4,0xF8,0x70,
|
||||
0x2E,0x3F,0x0C,0x36,0x4A,0x0F,0x40,0x56,0x15,0x46,0x5F,0x17,
|
||||
0x57,0x77,0x1A,0x65,0x85,0x1C,0x74,0x93,0x1D,0x8F,0xA5,0x25,
|
||||
0xAD,0xB7,0x2C,0xBC,0xC7,0x30,0xC9,0xD5,0x33,0xD4,0xE0,0x3B,
|
||||
0xE0,0xEC,0x42,0xEA,0xF6,0x45,0xF0,0xFD,0x47,0xF4,0xFF,0x6F,
|
||||
0x55,0x24,0x00,0x5A,0x2C,0x00,0x6C,0x3B,0x00,0x79,0x4B,0x00,
|
||||
0xB9,0x75,0x00,0xBB,0x85,0x00,0xC1,0xA1,0x20,0xD0,0xB0,0x2F,
|
||||
0xDE,0xBE,0x3F,0xE6,0xC6,0x45,0xED,0xCD,0x57,0xF5,0xDB,0x62,
|
||||
0xFB,0xE5,0x69,0xFC,0xEE,0x6F,0xFD,0xF3,0x77,0xFD,0xF3,0x7F,
|
||||
0x5C,0x27,0x00,0x5C,0x2F,0x00,0x71,0x3B,0x00,0x7B,0x48,0x00,
|
||||
0xB9,0x68,0x20,0xBB,0x72,0x20,0xC5,0x86,0x29,0xD7,0x96,0x33,
|
||||
0xE6,0xA4,0x40,0xF4,0xB1,0x4B,0xFD,0xC1,0x58,0xFF,0xCC,0x55,
|
||||
0xFF,0xD4,0x61,0xFF,0xDD,0x69,0xFF,0xE6,0x79,0xFF,0xEA,0x98
|
||||
};
|
||||
|
||||
void palette_Load(const uint8_t* data) {
|
||||
for (int index = 0; index < PALETTE_SIZE; index++) {
|
||||
palette_data[index] = data[index];
|
||||
}
|
||||
}
|
||||
Executable → Regular
+6
-13
@@ -5,7 +5,7 @@
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
//
|
||||
// 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
|
||||
@@ -24,19 +24,12 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
#ifndef PALETTE_H
|
||||
#define PALETTE_H
|
||||
|
||||
#define PALETTE_SIZE 768
|
||||
|
||||
#include <string>
|
||||
#include "Logger.h"
|
||||
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned short word;
|
||||
typedef unsigned int uint;
|
||||
|
||||
extern bool palette_Load(std::string filename);
|
||||
extern void palette_Load(const byte* data);
|
||||
extern std::string palette_filename;
|
||||
extern byte palette_data[PALETTE_SIZE];
|
||||
extern void palette_Load(const uint8_t* data);
|
||||
extern const char *palette_filename;
|
||||
extern uint8_t palette_data[PALETTE_SIZE];
|
||||
extern bool palette_default;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
+500
@@ -0,0 +1,500 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _ __ ___
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ / / / _
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / ___/ /__/
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
// Copyright 2020 Rupert Carmichael
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// PokeySound is Copyright(c) 1997 by Ron Fries
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it
|
||||
// under the terms of version 2 of the GNU Library General Public License
|
||||
// as published by the Free Software Foundation.
|
||||
//
|
||||
// This library 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 Library
|
||||
// General Public License for more details.
|
||||
// To obtain a copy of the GNU Library General Public License, write to the
|
||||
// Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
// Any permitted reproduction of these routines, in whole or in part, must
|
||||
// bear this legend.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Pokey.c
|
||||
// ----------------------------------------------------------------------------
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "Pokey.h"
|
||||
#include "ProSystem.h"
|
||||
|
||||
#define POKEY_NOTPOLY5 0x80
|
||||
#define POKEY_POLY4 0x40
|
||||
#define POKEY_PURE 0x20
|
||||
#define POKEY_VOLUME_ONLY 0x10
|
||||
#define POKEY_VOLUME_MASK 0x0f
|
||||
#define POKEY_POLY9 0x80
|
||||
#define POKEY_CH1_179 0x40
|
||||
#define POKEY_CH3_179 0x20
|
||||
#define POKEY_CH1_CH2 0x10
|
||||
#define POKEY_CH3_CH4 0x08
|
||||
#define POKEY_CH1_FILTER 0x04
|
||||
#define POKEY_CH2_FILTER 0x02
|
||||
#define POKEY_CLOCK_15 0x01
|
||||
#define POKEY_DIV_64 28
|
||||
#define POKEY_DIV_15 114
|
||||
#define POKEY_POLY4_SIZE 0x000f
|
||||
#define POKEY_POLY5_SIZE 0x001f
|
||||
#define POKEY_POLY9_SIZE 0x01ff
|
||||
#define POKEY_POLY17_SIZE 0x0001ffff
|
||||
#define POKEY_CHANNEL1 0
|
||||
#define POKEY_CHANNEL2 1
|
||||
#define POKEY_CHANNEL3 2
|
||||
#define POKEY_CHANNEL4 3
|
||||
#define POKEY_SAMPLE 4
|
||||
|
||||
#define SK_RESET 0x03
|
||||
|
||||
uint8_t pokey_buffer[POKEY_BUFFER_SIZE] = {0};
|
||||
uint32_t pokey_size = (POKEY_BUFFER_SIZE - 512); // 524 previously
|
||||
|
||||
static uint32_t pokey_frequency = 1787520;
|
||||
static uint32_t pokey_sampleRate = 31440;
|
||||
static uint32_t pokey_soundCntr = 0;
|
||||
static uint8_t pokey_audf[4];
|
||||
static uint8_t pokey_audc[4];
|
||||
static uint8_t pokey_audctl;
|
||||
static uint8_t pokey_output[4];
|
||||
static uint8_t pokey_outVol[4];
|
||||
static uint8_t pokey_poly04[POKEY_POLY4_SIZE] = {1,1,0,1,1,1,0,0,0,0,1,0,1,0,0};
|
||||
static uint8_t pokey_poly05[POKEY_POLY5_SIZE] = {0,0,1,1,0,0,0,1,1,1,1,0,0,1,0,1,0,1,1,0,1,1,1,0,1,0,0,0,0,0,1};
|
||||
static uint8_t pokey_poly17[POKEY_POLY17_SIZE];
|
||||
static uint32_t pokey_poly17Size;
|
||||
static uint32_t pokey_polyAdjust;
|
||||
static uint32_t pokey_poly04Cntr;
|
||||
static uint32_t pokey_poly05Cntr;
|
||||
static uint32_t pokey_poly17Cntr;
|
||||
static uint32_t pokey_divideMax[4];
|
||||
static uint32_t pokey_divideCount[4];
|
||||
static uint32_t pokey_sampleMax;
|
||||
static uint32_t pokey_sampleCount[2];
|
||||
static uint32_t pokey_baseMultiplier;
|
||||
|
||||
static uint8_t rand9[0x1ff];
|
||||
static uint8_t rand17[0x1ffff];
|
||||
static uint32_t r9;
|
||||
static uint32_t r17;
|
||||
static uint8_t SKCTL;
|
||||
uint8_t RANDOM;
|
||||
|
||||
uint8_t POT_input[8] = {228, 228, 228, 228, 228, 228, 228, 228};
|
||||
static int pot_scanline;
|
||||
|
||||
static unsigned long long random_scanline_counter;
|
||||
static unsigned long long prev_random_scanline_counter;
|
||||
|
||||
static void rand_init(uint8_t *rng, int size, int left, int right, int add) {
|
||||
int mask = (1 << size) - 1;
|
||||
int i, x = 0;
|
||||
|
||||
for (i = 0; i < mask; i++) {
|
||||
if (size == 17)
|
||||
*rng = x >> 6; // use bits 6..13
|
||||
else
|
||||
*rng = x; // use bits 0..7
|
||||
rng++;
|
||||
// calculate next bit
|
||||
x = ((x << left) + (x >> right) + add) & mask;
|
||||
}
|
||||
}
|
||||
|
||||
void pokey_setSampleRate( uint32_t rate ) {
|
||||
pokey_sampleRate = rate;
|
||||
}
|
||||
|
||||
void pokey_Reset(void) {
|
||||
pot_scanline = 0;
|
||||
pokey_soundCntr = 0;
|
||||
|
||||
for (int index = 0; index < POKEY_POLY17_SIZE; index++) {
|
||||
pokey_poly17[index] = rand( ) & 1;
|
||||
}
|
||||
|
||||
pokey_polyAdjust = 0;
|
||||
pokey_poly04Cntr = 0;
|
||||
pokey_poly05Cntr = 0;
|
||||
pokey_poly17Cntr = 0;
|
||||
|
||||
pokey_sampleMax = ((uint32_t)pokey_frequency << 8) / pokey_sampleRate;
|
||||
|
||||
pokey_sampleCount[0] = 0;
|
||||
pokey_sampleCount[1] = 0;
|
||||
|
||||
pokey_poly17Size = POKEY_POLY17_SIZE;
|
||||
|
||||
for (int channel = POKEY_CHANNEL1; channel <= POKEY_CHANNEL4; channel++) {
|
||||
pokey_outVol[channel] = 0;
|
||||
pokey_output[channel] = 0;
|
||||
pokey_divideCount[channel] = 0;
|
||||
pokey_divideMax[channel] = 0x7fffffffL;
|
||||
pokey_audc[channel] = 0;
|
||||
pokey_audf[channel] = 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 8; i++) {
|
||||
POT_input[i] = 228;
|
||||
}
|
||||
|
||||
pokey_audctl = 0;
|
||||
pokey_baseMultiplier = POKEY_DIV_64;
|
||||
|
||||
// initialize the random arrays
|
||||
rand_init(rand9, 9, 8, 1, 0x00180);
|
||||
rand_init(rand17, 17,16, 1, 0x1c000);
|
||||
|
||||
SKCTL = SK_RESET;
|
||||
RANDOM = 0;
|
||||
|
||||
r9 = 0;
|
||||
r17 = 0;
|
||||
random_scanline_counter = 0;
|
||||
prev_random_scanline_counter = 0;
|
||||
}
|
||||
|
||||
// Called prior to each frame
|
||||
void pokey_Frame(void) {
|
||||
}
|
||||
|
||||
// Called prior to each scanline
|
||||
void pokey_Scanline(void) {
|
||||
random_scanline_counter += CYCLES_PER_SCANLINE;
|
||||
|
||||
if (pot_scanline < 228)
|
||||
pot_scanline++;
|
||||
}
|
||||
|
||||
uint8_t pokey_GetRegister(uint16_t address) {
|
||||
uint8_t data = 0;
|
||||
|
||||
uint8_t addr = address & 0x0f;
|
||||
if (addr < 8) {
|
||||
uint8_t b = POT_input[addr];
|
||||
if (b <= pot_scanline)
|
||||
return b;
|
||||
return pot_scanline;
|
||||
}
|
||||
|
||||
switch (address) {
|
||||
case POKEY_ALLPOT: {
|
||||
uint8_t b = 0;
|
||||
for (int i = 0; i < 8; i++)
|
||||
if (POT_input[addr] <= pot_scanline)
|
||||
b &= ~(1 << i); /* reset bit if pot value known */
|
||||
return b;
|
||||
}
|
||||
case POKEY_RANDOM: {
|
||||
unsigned long long curr_scanline_counter =
|
||||
(random_scanline_counter + prosystem_cycles + prosystem_extra_cycles);
|
||||
|
||||
if (SKCTL & SK_RESET ) {
|
||||
unsigned long long adjust = ((curr_scanline_counter - prev_random_scanline_counter) >> 2);
|
||||
r9 = (uint32_t)((adjust + r9) % 0x001ff);
|
||||
r17 = (uint32_t)((adjust + r17) % 0x1ffff);
|
||||
}
|
||||
else {
|
||||
r9 = 0;
|
||||
r17 = 0;
|
||||
}
|
||||
if (pokey_audctl & POKEY_POLY9) {
|
||||
RANDOM = rand9[r9];
|
||||
}
|
||||
else {
|
||||
RANDOM = rand17[r17];
|
||||
}
|
||||
|
||||
prev_random_scanline_counter = curr_scanline_counter;
|
||||
RANDOM = RANDOM ^ 0xff;
|
||||
data = RANDOM;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
void pokey_SetRegister(uint16_t address, uint8_t value) {
|
||||
uint8_t channelMask;
|
||||
|
||||
switch (address) {
|
||||
case POKEY_POTGO:
|
||||
if (!(SKCTL & 4))
|
||||
pot_scanline = 0; /* slow pot mode */
|
||||
return;
|
||||
|
||||
case POKEY_SKCTLS:
|
||||
SKCTL = value;
|
||||
/* fast pot mode - return results immediately */
|
||||
if (value & 4)
|
||||
pot_scanline = 228;
|
||||
return;
|
||||
|
||||
case POKEY_AUDF1:
|
||||
pokey_audf[POKEY_CHANNEL1] = value;
|
||||
channelMask = 1 << POKEY_CHANNEL1;
|
||||
if (pokey_audctl & POKEY_CH1_CH2) {
|
||||
channelMask |= 1 << POKEY_CHANNEL2;
|
||||
}
|
||||
break;
|
||||
|
||||
case POKEY_AUDC1:
|
||||
pokey_audc[POKEY_CHANNEL1] = value;
|
||||
channelMask = 1 << POKEY_CHANNEL1;
|
||||
break;
|
||||
|
||||
case POKEY_AUDF2:
|
||||
pokey_audf[POKEY_CHANNEL2] = value;
|
||||
channelMask = 1 << POKEY_CHANNEL2;
|
||||
break;
|
||||
|
||||
case POKEY_AUDC2:
|
||||
pokey_audc[POKEY_CHANNEL2] = value;
|
||||
channelMask = 1 << POKEY_CHANNEL2;
|
||||
break;
|
||||
|
||||
case POKEY_AUDF3:
|
||||
pokey_audf[POKEY_CHANNEL3] = value;
|
||||
channelMask = 1 << POKEY_CHANNEL3;
|
||||
|
||||
if (pokey_audctl & POKEY_CH3_CH4) {
|
||||
channelMask |= 1 << POKEY_CHANNEL4;
|
||||
}
|
||||
break;
|
||||
|
||||
case POKEY_AUDC3:
|
||||
pokey_audc[POKEY_CHANNEL3] = value;
|
||||
channelMask = 1 << POKEY_CHANNEL3;
|
||||
break;
|
||||
|
||||
case POKEY_AUDF4:
|
||||
pokey_audf[POKEY_CHANNEL4] = value;
|
||||
channelMask = 1 << POKEY_CHANNEL4;
|
||||
break;
|
||||
|
||||
case POKEY_AUDC4:
|
||||
pokey_audc[POKEY_CHANNEL4] = value;
|
||||
channelMask = 1 << POKEY_CHANNEL4;
|
||||
break;
|
||||
|
||||
case POKEY_AUDCTL:
|
||||
pokey_audctl = value;
|
||||
channelMask = 15;
|
||||
if (pokey_audctl & POKEY_POLY9) {
|
||||
pokey_poly17Size = POKEY_POLY9_SIZE;
|
||||
}
|
||||
else {
|
||||
pokey_poly17Size = POKEY_POLY17_SIZE;
|
||||
}
|
||||
|
||||
if (pokey_audctl & POKEY_CLOCK_15) {
|
||||
pokey_baseMultiplier = POKEY_DIV_15;
|
||||
}
|
||||
else {
|
||||
pokey_baseMultiplier = POKEY_DIV_64;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
channelMask = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
uint32_t newValue = 0;
|
||||
|
||||
if (channelMask & (1 << POKEY_CHANNEL1)) {
|
||||
if (pokey_audctl & POKEY_CH1_179) {
|
||||
newValue = pokey_audf[POKEY_CHANNEL1] + 4;
|
||||
}
|
||||
else {
|
||||
newValue = (pokey_audf[POKEY_CHANNEL1] + 1) * pokey_baseMultiplier;
|
||||
}
|
||||
|
||||
if (newValue != pokey_divideMax[POKEY_CHANNEL1]) {
|
||||
pokey_divideMax[POKEY_CHANNEL1] = newValue;
|
||||
if(pokey_divideCount[POKEY_CHANNEL1] > newValue) {
|
||||
pokey_divideCount[POKEY_CHANNEL1] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (channelMask & (1 << POKEY_CHANNEL2)) {
|
||||
if (pokey_audctl & POKEY_CH1_CH2) {
|
||||
if (pokey_audctl & POKEY_CH1_179) {
|
||||
newValue = pokey_audf[POKEY_CHANNEL2] * 256 + pokey_audf[POKEY_CHANNEL1] + 7;
|
||||
}
|
||||
else {
|
||||
newValue = (pokey_audf[POKEY_CHANNEL2] * 256 + pokey_audf[POKEY_CHANNEL1] + 1) * pokey_baseMultiplier;
|
||||
}
|
||||
}
|
||||
else {
|
||||
newValue = (pokey_audf[POKEY_CHANNEL2] + 1) * pokey_baseMultiplier;
|
||||
}
|
||||
if (newValue != pokey_divideMax[POKEY_CHANNEL2]) {
|
||||
pokey_divideMax[POKEY_CHANNEL2] = newValue;
|
||||
if (pokey_divideCount[POKEY_CHANNEL2] > newValue) {
|
||||
pokey_divideCount[POKEY_CHANNEL2] = newValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (channelMask & (1 << POKEY_CHANNEL3)) {
|
||||
if (pokey_audctl & POKEY_CH3_179) {
|
||||
newValue = pokey_audf[POKEY_CHANNEL3] + 4;
|
||||
}
|
||||
else {
|
||||
newValue= (pokey_audf[POKEY_CHANNEL3] + 1) * pokey_baseMultiplier;
|
||||
}
|
||||
|
||||
if (newValue!= pokey_divideMax[POKEY_CHANNEL3]) {
|
||||
pokey_divideMax[POKEY_CHANNEL3] = newValue;
|
||||
|
||||
if (pokey_divideCount[POKEY_CHANNEL3] > newValue) {
|
||||
pokey_divideCount[POKEY_CHANNEL3] = newValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (channelMask & (1 << POKEY_CHANNEL4)) {
|
||||
if (pokey_audctl & POKEY_CH3_CH4) {
|
||||
if (pokey_audctl & POKEY_CH3_179) {
|
||||
newValue = pokey_audf[POKEY_CHANNEL4] * 256 + pokey_audf[POKEY_CHANNEL3] + 7;
|
||||
}
|
||||
else {
|
||||
newValue = (pokey_audf[POKEY_CHANNEL4] * 256 + pokey_audf[POKEY_CHANNEL3] + 1) * pokey_baseMultiplier;
|
||||
}
|
||||
}
|
||||
else {
|
||||
newValue = (pokey_audf[POKEY_CHANNEL4] + 1) * pokey_baseMultiplier;
|
||||
}
|
||||
|
||||
if (newValue != pokey_divideMax[POKEY_CHANNEL4]) {
|
||||
pokey_divideMax[POKEY_CHANNEL4] = newValue;
|
||||
|
||||
if (pokey_divideCount[POKEY_CHANNEL4] > newValue) {
|
||||
pokey_divideCount[POKEY_CHANNEL4] = newValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (uint8_t channel = POKEY_CHANNEL1; channel <= POKEY_CHANNEL4; channel++) {
|
||||
if (channelMask & (1 << channel)) {
|
||||
if ((pokey_audc[channel] & POKEY_VOLUME_ONLY) ||
|
||||
((pokey_audc[channel] & POKEY_VOLUME_MASK) == 0) ||
|
||||
(pokey_divideMax[channel] < (pokey_sampleMax >> 8))) {
|
||||
#if 1 // WII
|
||||
pokey_outVol[channel] = 1;
|
||||
#else
|
||||
pokey_outVol[channel] = pokey_audc[channel] & POKEY_VOLUME_MASK;
|
||||
#endif
|
||||
pokey_divideCount[channel] = 0x7fffffff;
|
||||
pokey_divideMax[channel] = 0x7fffffff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void pokey_Process(uint32_t length) {
|
||||
uint8_t* buffer = pokey_buffer + pokey_soundCntr;
|
||||
uint32_t* sampleCntrPtr = (uint32_t*)((uint8_t*)(&pokey_sampleCount[0]) + 1);
|
||||
uint32_t size = length;
|
||||
|
||||
while(length) {
|
||||
uint8_t currentValue;
|
||||
uint8_t nextEvent = POKEY_SAMPLE;
|
||||
uint32_t eventMin = *sampleCntrPtr;
|
||||
|
||||
uint8_t channel;
|
||||
|
||||
for (channel = POKEY_CHANNEL1; channel <= POKEY_CHANNEL4; channel++) {
|
||||
if (pokey_divideCount[channel] <= eventMin) {
|
||||
eventMin = pokey_divideCount[channel];
|
||||
nextEvent = channel;
|
||||
}
|
||||
}
|
||||
|
||||
for(channel = POKEY_CHANNEL1; channel <= POKEY_CHANNEL4; channel++) {
|
||||
pokey_divideCount[channel] -= eventMin;
|
||||
}
|
||||
|
||||
*sampleCntrPtr -= eventMin;
|
||||
pokey_polyAdjust += eventMin;
|
||||
|
||||
if (nextEvent != POKEY_SAMPLE) {
|
||||
pokey_poly04Cntr = (pokey_poly04Cntr + pokey_polyAdjust) % POKEY_POLY4_SIZE;
|
||||
pokey_poly05Cntr = (pokey_poly05Cntr + pokey_polyAdjust) % POKEY_POLY5_SIZE;
|
||||
pokey_poly17Cntr = (pokey_poly17Cntr + pokey_polyAdjust) % pokey_poly17Size;
|
||||
pokey_polyAdjust = 0;
|
||||
pokey_divideCount[nextEvent] += pokey_divideMax[nextEvent];
|
||||
|
||||
if ((pokey_audc[nextEvent] & POKEY_NOTPOLY5) || pokey_poly05[pokey_poly05Cntr]) {
|
||||
if (pokey_audc[nextEvent] & POKEY_PURE) {
|
||||
pokey_output[nextEvent] = !pokey_output[nextEvent];
|
||||
}
|
||||
else if (pokey_audc[nextEvent] & POKEY_POLY4) {
|
||||
pokey_output[nextEvent] = pokey_poly04[pokey_poly04Cntr];
|
||||
}
|
||||
else {
|
||||
pokey_output[nextEvent] = pokey_poly17[pokey_poly17Cntr];
|
||||
}
|
||||
}
|
||||
|
||||
if (pokey_output[nextEvent]) {
|
||||
pokey_outVol[nextEvent] = pokey_audc[nextEvent] & POKEY_VOLUME_MASK;
|
||||
}
|
||||
else {
|
||||
pokey_outVol[nextEvent] = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
*pokey_sampleCount += pokey_sampleMax;
|
||||
currentValue = 0;
|
||||
|
||||
for (channel = POKEY_CHANNEL1; channel <= POKEY_CHANNEL4; channel++) {
|
||||
currentValue += pokey_outVol[channel];
|
||||
}
|
||||
|
||||
currentValue = (currentValue << 2) + 8;
|
||||
*buffer++ = currentValue;
|
||||
length--;
|
||||
}
|
||||
}
|
||||
|
||||
pokey_soundCntr += size;
|
||||
|
||||
if (pokey_soundCntr >= pokey_size) {
|
||||
pokey_soundCntr = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void pokey_Clear(void) {
|
||||
for (int index = 0; index < POKEY_BUFFER_SIZE; index++) {
|
||||
pokey_buffer[index] = 0;
|
||||
}
|
||||
}
|
||||
Executable → Regular
+30
-33
@@ -1,11 +1,12 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _ __ ___
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ / / / _
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / ___/ /__/
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// Copyright 2020 Rupert Carmichael
|
||||
//
|
||||
// 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
|
||||
@@ -21,25 +22,26 @@
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// PokeySound is Copyright(c) 1997 by Ron Fries
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it
|
||||
// under the terms of version 2 of the GNU Library General Public License
|
||||
// as published by the Free Software Foundation.
|
||||
//
|
||||
// This library 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 Library
|
||||
// General Public License for more details.
|
||||
// To obtain a copy of the GNU Library General Public License, write to the
|
||||
// Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
// Any permitted reproduction of these routines, in whole or in part, must
|
||||
// bear this legend.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it
|
||||
// under the terms of version 2 of the GNU Library General Public License
|
||||
// as published by the Free Software Foundation.
|
||||
//
|
||||
// This library 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 Library
|
||||
// General Public License for more details.
|
||||
// To obtain a copy of the GNU Library General Public License, write to the
|
||||
// Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
// Any permitted reproduction of these routines, in whole or in part, must
|
||||
// bear this legend.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Pokey.h
|
||||
// ----------------------------------------------------------------------------
|
||||
#ifndef POKEY_H
|
||||
#define POKEY_H
|
||||
|
||||
#define POKEY_BUFFER_SIZE 624
|
||||
#define POKEY_AUDF1 0x4000
|
||||
#define POKEY_AUDC1 0x4001
|
||||
@@ -72,21 +74,16 @@
|
||||
#define POKEY_IRQST 0x400e
|
||||
#define POKEY_SKSTAT 0x400f
|
||||
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned short word;
|
||||
typedef unsigned int uint;
|
||||
typedef unsigned long long ulong;
|
||||
extern void pokey_Reset(void);
|
||||
extern void pokey_SetRegister(uint16_t address, uint8_t value);
|
||||
extern uint8_t pokey_GetRegister(uint16_t address);
|
||||
extern void pokey_Process(uint32_t length);
|
||||
extern void pokey_Clear(void);
|
||||
extern uint8_t pokey_buffer[POKEY_BUFFER_SIZE];
|
||||
extern uint32_t pokey_size;
|
||||
|
||||
extern void pokey_Reset( );
|
||||
extern void pokey_SetRegister(word address, byte value);
|
||||
extern byte pokey_GetRegister(word address);
|
||||
extern void pokey_Process(uint length);
|
||||
extern void pokey_Clear( );
|
||||
extern byte pokey_buffer[POKEY_BUFFER_SIZE];
|
||||
extern uint pokey_size;
|
||||
|
||||
extern void pokey_Frame();
|
||||
extern void pokey_Scanline();
|
||||
extern void pokey_setSampleRate(uint rate);
|
||||
extern void pokey_Frame(void);
|
||||
extern void pokey_Scanline(void);
|
||||
extern void pokey_setSampleRate(uint32_t rate);
|
||||
|
||||
#endif
|
||||
+597
@@ -0,0 +1,597 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _ __ ___
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ / / / _
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / ___/ /__/
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2003, 2004 Greg Stanton
|
||||
// Copyright 2020 Rupert Carmichael
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// ProSystem.c
|
||||
// ----------------------------------------------------------------------------
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "ProSystem.h"
|
||||
#define PRO_SYSTEM_STATE_HEADER "PRO-SYSTEM STATE"
|
||||
#define PRO_SYSTEM_SOURCE "ProSystem.c"
|
||||
|
||||
bool prosystem_active = false;
|
||||
bool prosystem_paused = false;
|
||||
uint16_t prosystem_frequency = 60;
|
||||
uint8_t prosystem_frame = 0;
|
||||
uint16_t prosystem_scanlines = 262;
|
||||
uint32_t prosystem_cycles = 0;
|
||||
uint32_t prosystem_extra_cycles = 0;
|
||||
int lightgun_scanline = 0;
|
||||
float lightgun_cycle = 0;
|
||||
|
||||
// Whether the last CPU operation resulted in a half cycle (need to take it
|
||||
// into consideration)
|
||||
extern bool half_cycle;
|
||||
|
||||
void prosystem_Reset(void) {
|
||||
if (cartridge_IsLoaded()) {
|
||||
prosystem_paused = false;
|
||||
prosystem_frame = 0;
|
||||
sally_Reset();
|
||||
region_Reset();
|
||||
tia_Clear();
|
||||
tia_Reset();
|
||||
pokey_Clear();
|
||||
pokey_Reset();
|
||||
xm_Reset();
|
||||
memory_Reset();
|
||||
maria_Clear();
|
||||
maria_Reset();
|
||||
riot_Reset();
|
||||
|
||||
if (bios_enabled) {
|
||||
bios_Store();
|
||||
}
|
||||
else {
|
||||
cartridge_Store();
|
||||
}
|
||||
|
||||
prosystem_cycles = sally_ExecuteRES();
|
||||
prosystem_active = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Strobe based on the current lightgun location
|
||||
static void prosystem_FireLightGun(void) {
|
||||
if (((maria_scanline >= lightgun_scanline) &&
|
||||
(maria_scanline <= ( lightgun_scanline + 3 ))) &&
|
||||
((int)prosystem_cycles >= ((int)lightgun_cycle ) - 1 )) {
|
||||
memory_ram[INPT4] &= 0x7f;
|
||||
}
|
||||
else {
|
||||
memory_ram[INPT4] |= 0x80;
|
||||
}
|
||||
}
|
||||
|
||||
void prosystem_ExecuteFrame(const uint8_t* input) {
|
||||
// Is WSYNC enabled for the current frame?
|
||||
bool wsync = !(cartridge_flags & CARTRIDGE_WSYNC_MASK);
|
||||
|
||||
// Is Maria cycle stealing enabled for the current frame?
|
||||
bool cycle_stealing = !(cartridge_flags & CARTRIDGE_CYCLE_STEALING_MASK);
|
||||
|
||||
// Is the lightgun enabled for the current frame?
|
||||
bool lightgun = ((cartridge_controller[0] & CARTRIDGE_CONTROLLER_LIGHTGUN) && (memory_ram[CTRL] & 96) != 64);
|
||||
|
||||
riot_SetInput(input);
|
||||
|
||||
prosystem_extra_cycles = 0;
|
||||
|
||||
if (cartridge_pokey || cartridge_xm) pokey_Frame();
|
||||
|
||||
for (maria_scanline = 1; maria_scanline <= prosystem_scanlines; maria_scanline++) {
|
||||
if (maria_scanline == maria_displayArea.top) {
|
||||
memory_ram[MSTAT] = 0;
|
||||
}
|
||||
else if(maria_scanline == maria_displayArea.bottom) {
|
||||
memory_ram[MSTAT] = 128;
|
||||
}
|
||||
|
||||
// Was a WSYNC performed withing the current scanline?
|
||||
bool wsync_scanline = false;
|
||||
|
||||
uint32_t cycles = 0;
|
||||
|
||||
if (!cycle_stealing || (memory_ram[CTRL] & 96 ) != 64) {
|
||||
// Exact cycle counts when Maria is disabled
|
||||
prosystem_cycles %= CYCLES_PER_SCANLINE;
|
||||
prosystem_extra_cycles = 0;
|
||||
}
|
||||
else {
|
||||
prosystem_extra_cycles = (prosystem_cycles % CYCLES_PER_SCANLINE);
|
||||
|
||||
// Some fudge for Maria cycles. Unfortunately Maria cycle counting
|
||||
// isn't exact (This adds some extra cycles).
|
||||
prosystem_cycles = 0;
|
||||
}
|
||||
|
||||
// If lightgun is enabled, check to see if it should be fired
|
||||
if (lightgun) prosystem_FireLightGun();
|
||||
|
||||
while (prosystem_cycles < cartridge_hblank) {
|
||||
cycles = sally_ExecuteInstruction( );
|
||||
prosystem_cycles += (cycles << 2);
|
||||
|
||||
if (half_cycle) prosystem_cycles += 2;
|
||||
|
||||
if (riot_timing) {
|
||||
riot_UpdateTimer(cycles);
|
||||
}
|
||||
|
||||
// If lightgun is enabled, check to see if it should be fired
|
||||
if (lightgun) prosystem_FireLightGun();
|
||||
|
||||
if (memory_ram[WSYNC] && wsync) {
|
||||
memory_ram[WSYNC] = false;
|
||||
wsync_scanline = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
cycles = maria_RenderScanline( );
|
||||
|
||||
if (cycle_stealing) {
|
||||
prosystem_cycles += cycles;
|
||||
|
||||
if(riot_timing) {
|
||||
riot_UpdateTimer(cycles >> 2);
|
||||
}
|
||||
}
|
||||
|
||||
while (!wsync_scanline && prosystem_cycles < CYCLES_PER_SCANLINE) {
|
||||
cycles = sally_ExecuteInstruction();
|
||||
prosystem_cycles += (cycles << 2);
|
||||
|
||||
if(half_cycle) prosystem_cycles += 2;
|
||||
|
||||
// If lightgun is enabled, check to see if it should be fired
|
||||
if (lightgun) prosystem_FireLightGun();
|
||||
|
||||
if (riot_timing) {
|
||||
riot_UpdateTimer(cycles);
|
||||
}
|
||||
|
||||
if(memory_ram[WSYNC] && wsync) {
|
||||
memory_ram[WSYNC] = false;
|
||||
wsync_scanline = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If a WSYNC was performed and the current cycle count is less than
|
||||
// the cycles per scanline, add those cycles to current timers.
|
||||
if (wsync_scanline && prosystem_cycles < CYCLES_PER_SCANLINE) {
|
||||
if (riot_timing) {
|
||||
riot_UpdateTimer((CYCLES_PER_SCANLINE - prosystem_cycles) >> 2);
|
||||
}
|
||||
prosystem_cycles = CYCLES_PER_SCANLINE;
|
||||
}
|
||||
|
||||
// If lightgun is enabled, check to see if it should be fired
|
||||
if (lightgun) prosystem_FireLightGun();
|
||||
|
||||
tia_Process(2);
|
||||
|
||||
if (cartridge_pokey || cartridge_xm) {
|
||||
pokey_Process(2);
|
||||
}
|
||||
|
||||
if (cartridge_pokey || cartridge_xm) pokey_Scanline();
|
||||
}
|
||||
|
||||
prosystem_frame++;
|
||||
|
||||
if (prosystem_frame >= prosystem_frequency) {
|
||||
prosystem_frame = 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool prosystem_Save(const char *filename) {
|
||||
uint8_t loc_buffer[33000 + XM_RAM_SIZE + 4] = {0};
|
||||
|
||||
uint32_t size = 0;
|
||||
|
||||
uint32_t index;
|
||||
|
||||
for (index = 0; index < 16; index++) {
|
||||
loc_buffer[size + index] = PRO_SYSTEM_STATE_HEADER[index];
|
||||
}
|
||||
size += 16;
|
||||
|
||||
loc_buffer[size++] = 1;
|
||||
for (index = 0; index < 4; index++) {
|
||||
loc_buffer[size + index] = 0;
|
||||
}
|
||||
size += 4;
|
||||
|
||||
for (index = 0; index < 32; index++) {
|
||||
loc_buffer[size + index] = cart_digest[index];
|
||||
}
|
||||
size += 32;
|
||||
|
||||
loc_buffer[size++] = sally_a;
|
||||
loc_buffer[size++] = sally_x;
|
||||
loc_buffer[size++] = sally_y;
|
||||
loc_buffer[size++] = sally_p;
|
||||
loc_buffer[size++] = sally_s;
|
||||
loc_buffer[size++] = sally_pc.b.l;
|
||||
loc_buffer[size++] = sally_pc.b.h;
|
||||
loc_buffer[size++] = cartridge_bank;
|
||||
|
||||
for (index = 0; index < 16384; index++) {
|
||||
loc_buffer[size + index] = memory_ram[index];
|
||||
}
|
||||
size += 16384;
|
||||
|
||||
if (cartridge_type == CARTRIDGE_TYPE_SUPERCART_RAM) {
|
||||
for(index = 0; index < 16384; index++) {
|
||||
loc_buffer[size + index] = memory_ram[16384 + index];
|
||||
}
|
||||
size += 16384;
|
||||
}
|
||||
|
||||
// RIOT state
|
||||
loc_buffer[size++] = riot_dra;
|
||||
loc_buffer[size++] = riot_drb;
|
||||
loc_buffer[size++] = riot_timing;
|
||||
loc_buffer[size++] = ( 0xff & ( riot_timer >> 8 ) );
|
||||
loc_buffer[size++] = ( 0xff & riot_timer );
|
||||
loc_buffer[size++] = riot_intervals;
|
||||
loc_buffer[size++] = ( 0xff & ( riot_clocks >> 8 ) );
|
||||
loc_buffer[size++] = ( 0xff & riot_clocks );
|
||||
|
||||
// XM (if applicable)
|
||||
if (cartridge_xm) {
|
||||
loc_buffer[size++] = xm_reg;
|
||||
loc_buffer[size++] = xm_bank;
|
||||
loc_buffer[size++] = xm_pokey_enabled;
|
||||
loc_buffer[size++] = xm_mem_enabled;
|
||||
|
||||
for (index = 0; index < XM_RAM_SIZE; index++) {
|
||||
loc_buffer[size + index] = xm_ram[index];
|
||||
}
|
||||
size += XM_RAM_SIZE;
|
||||
}
|
||||
|
||||
FILE* file = fopen(filename, "wb");
|
||||
if (file == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fwrite(loc_buffer, 1, size, file) != size) {
|
||||
fclose(file);
|
||||
return false;
|
||||
}
|
||||
|
||||
fflush(file);
|
||||
fclose(file);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool prosystem_Save_buffer(uint8_t *buffer) {
|
||||
uint32_t size = 0;
|
||||
uint32_t index;
|
||||
|
||||
for (index = 0; index < 16; index++) {
|
||||
buffer[size + index] = PRO_SYSTEM_STATE_HEADER[index];
|
||||
}
|
||||
size += 16;
|
||||
|
||||
buffer[size++] = 1;
|
||||
for (index = 0; index < 4; index++) {
|
||||
buffer[size + index] = 0;
|
||||
}
|
||||
size += 4;
|
||||
|
||||
for (index = 0; index < 32; index++) {
|
||||
buffer[size + index] = cart_digest[index];
|
||||
}
|
||||
size += 32;
|
||||
|
||||
buffer[size++] = sally_a;
|
||||
buffer[size++] = sally_x;
|
||||
buffer[size++] = sally_y;
|
||||
buffer[size++] = sally_p;
|
||||
buffer[size++] = sally_s;
|
||||
buffer[size++] = sally_pc.b.l;
|
||||
buffer[size++] = sally_pc.b.h;
|
||||
buffer[size++] = cartridge_bank;
|
||||
|
||||
for (index = 0; index < 16384; index++) {
|
||||
buffer[size + index] = memory_ram[index];
|
||||
}
|
||||
size += 16384;
|
||||
|
||||
if (cartridge_type == CARTRIDGE_TYPE_SUPERCART_RAM) {
|
||||
for (index = 0; index < 16384; index++) {
|
||||
buffer[size + index] = memory_ram[16384 + index];
|
||||
}
|
||||
size += 16384;
|
||||
}
|
||||
|
||||
// RIOT state
|
||||
buffer[size++] = riot_dra;
|
||||
buffer[size++] = riot_drb;
|
||||
buffer[size++] = riot_timing;
|
||||
buffer[size++] = ( 0xff & ( riot_timer >> 8 ) );
|
||||
buffer[size++] = ( 0xff & riot_timer );
|
||||
buffer[size++] = riot_intervals;
|
||||
buffer[size++] = ( 0xff & ( riot_clocks >> 8 ) );
|
||||
buffer[size++] = ( 0xff & riot_clocks );
|
||||
|
||||
// XM (if applicable)
|
||||
if (cartridge_xm) {
|
||||
buffer[size++] = xm_reg;
|
||||
buffer[size++] = xm_bank;
|
||||
buffer[size++] = xm_pokey_enabled;
|
||||
buffer[size++] = xm_mem_enabled;
|
||||
|
||||
for (index = 0; index < XM_RAM_SIZE; index++) {
|
||||
buffer[size + index] = xm_ram[index];
|
||||
}
|
||||
size += XM_RAM_SIZE;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool prosystem_Load(const char *filename) {
|
||||
uint8_t loc_buffer[33000 + XM_RAM_SIZE + 4] = {0};
|
||||
|
||||
uint32_t size = 0;
|
||||
if (size == 0) {
|
||||
FILE* file = fopen(filename, "rb");
|
||||
if (file == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fseek(file, 0L, SEEK_END)) {
|
||||
fclose(file);
|
||||
return false;
|
||||
}
|
||||
|
||||
size = ftell(file);
|
||||
if (fseek(file, 0L, SEEK_SET)) {
|
||||
fclose(file);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (size != 16445 && size != 32829 && /* no RIOT */
|
||||
size != 16453 && size != 32837 && /* with RIOT */
|
||||
size != (16453 + 4 + XM_RAM_SIZE) && /* XM without supercart ram */
|
||||
size != (32837 + 4 + XM_RAM_SIZE)) /* XM with supercart ram */
|
||||
{
|
||||
fclose(file);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fread(loc_buffer, 1, size, file) != size && ferror(file)) {
|
||||
fclose(file);
|
||||
return false;
|
||||
}
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
uint32_t offset = 0;
|
||||
uint32_t index;
|
||||
for (index = 0; index < 16; index++) {
|
||||
if (loc_buffer[offset + index] != PRO_SYSTEM_STATE_HEADER[index]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
offset += 16;
|
||||
//uint8_t version = loc_buffer[offset++];
|
||||
offset++;
|
||||
|
||||
for (index = 0; index < 4; index++) {
|
||||
}
|
||||
offset += 4;
|
||||
|
||||
prosystem_Reset();
|
||||
|
||||
char digest[33] = {0};
|
||||
for (index = 0; index < 32; index++) {
|
||||
digest[index] = loc_buffer[offset + index];
|
||||
}
|
||||
offset += 32;
|
||||
|
||||
if (strcmp(cart_digest, digest)) { // Not the same
|
||||
return false;
|
||||
}
|
||||
|
||||
sally_a = loc_buffer[offset++];
|
||||
sally_x = loc_buffer[offset++];
|
||||
sally_y = loc_buffer[offset++];
|
||||
sally_p = loc_buffer[offset++];
|
||||
sally_s = loc_buffer[offset++];
|
||||
sally_pc.b.l = loc_buffer[offset++];
|
||||
sally_pc.b.h = loc_buffer[offset++];
|
||||
|
||||
cartridge_StoreBank(loc_buffer[offset++]);
|
||||
|
||||
for(index = 0; index < 16384; index++) {
|
||||
memory_ram[index] = loc_buffer[offset + index];
|
||||
}
|
||||
offset += 16384;
|
||||
|
||||
if (cartridge_type == CARTRIDGE_TYPE_SUPERCART_RAM) {
|
||||
if (size != 32829 && /* no RIOT */
|
||||
size != 32837 && /* with RIOT */
|
||||
size != (32837 + 4 + XM_RAM_SIZE)) /* XM */ {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (index = 0; index < 16384; index++) {
|
||||
memory_ram[16384 + index] = loc_buffer[offset + index];
|
||||
}
|
||||
offset += 16384;
|
||||
}
|
||||
|
||||
if (size == 16453 || /* no supercart ram */
|
||||
size == 32837 || /* supercart ram */
|
||||
size == (16453 + 4 + XM_RAM_SIZE) || /* xm, no supercart ram */
|
||||
size == (32837 + 4 + XM_RAM_SIZE)) /* xm, supercart ram */ {
|
||||
// RIOT state
|
||||
riot_dra = loc_buffer[offset++];
|
||||
riot_drb = loc_buffer[offset++];
|
||||
riot_timing = loc_buffer[offset++];
|
||||
riot_timer = ( loc_buffer[offset++] << 8 );
|
||||
riot_timer |= loc_buffer[offset++];
|
||||
riot_intervals = loc_buffer[offset++];
|
||||
riot_clocks = ( loc_buffer[offset++] << 8 );
|
||||
riot_clocks |= loc_buffer[offset++];
|
||||
}
|
||||
|
||||
// XM (if applicable)
|
||||
if (cartridge_xm) {
|
||||
if ((size != (16453 + 4 + XM_RAM_SIZE)) &&
|
||||
(size != (32837 + 4 + XM_RAM_SIZE))) {
|
||||
return false; // Save state file has an invalid size
|
||||
}
|
||||
xm_reg = loc_buffer[offset++];
|
||||
xm_bank = loc_buffer[offset++];
|
||||
xm_pokey_enabled = loc_buffer[offset++];
|
||||
xm_mem_enabled = loc_buffer[offset++];
|
||||
|
||||
for (index = 0; index < XM_RAM_SIZE; index++) {
|
||||
xm_ram[index] = loc_buffer[offset++];
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool prosystem_Load_buffer(const uint8_t *buffer) {
|
||||
uint32_t size = cartridge_type == CARTRIDGE_TYPE_SUPERCART_RAM ? 32837 : 16453;
|
||||
if(cartridge_xm) {
|
||||
size += 4 + XM_RAM_SIZE;
|
||||
}
|
||||
uint32_t offset = 0;
|
||||
uint32_t index;
|
||||
|
||||
for (index = 0; index < 16; index++) {
|
||||
if (buffer[offset + index] != PRO_SYSTEM_STATE_HEADER[index]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
offset += 16;
|
||||
|
||||
//uint8_t version = buffer[offset++];
|
||||
offset++;
|
||||
//uint32_t date = 0;
|
||||
|
||||
offset += 4;
|
||||
|
||||
//prosystem_Reset(); // TODO doesn't seem necessary but needs investigation
|
||||
|
||||
char digest[33] = {0};
|
||||
for (index = 0; index < 32; index++) {
|
||||
digest[index] = buffer[offset + index];
|
||||
}
|
||||
offset += 32;
|
||||
|
||||
if (strcmp(cart_digest, digest)) { // Not the same
|
||||
return false;
|
||||
}
|
||||
|
||||
sally_a = buffer[offset++];
|
||||
sally_x = buffer[offset++];
|
||||
sally_y = buffer[offset++];
|
||||
sally_p = buffer[offset++];
|
||||
sally_s = buffer[offset++];
|
||||
sally_pc.b.l = buffer[offset++];
|
||||
sally_pc.b.h = buffer[offset++];
|
||||
|
||||
cartridge_StoreBank(buffer[offset++]);
|
||||
|
||||
for (index = 0; index < 16384; index++) {
|
||||
memory_ram[index] = buffer[offset + index];
|
||||
}
|
||||
offset += 16384;
|
||||
|
||||
if (cartridge_type == CARTRIDGE_TYPE_SUPERCART_RAM) {
|
||||
if (size != 32829 && /* no RIOT */
|
||||
size != 32837 && /* with RIOT */
|
||||
size != (32837 + 4 + XM_RAM_SIZE)) /* XM */ {
|
||||
return false; // Save state file has an invalid size.
|
||||
}
|
||||
for (index = 0; index < 16384; index++) {
|
||||
memory_ram[16384 + index] = buffer[offset + index];
|
||||
}
|
||||
offset += 16384;
|
||||
}
|
||||
|
||||
if (size == 16453 || /* no supercart ram */
|
||||
size == 32837 || /* supercart ram */
|
||||
size == (16453 + 4 + XM_RAM_SIZE) || /* xm, no supercart ram */
|
||||
size == (32837 + 4 + XM_RAM_SIZE)) /* xm, supercart ram */ {
|
||||
// RIOT state
|
||||
riot_dra = buffer[offset++];
|
||||
riot_drb = buffer[offset++];
|
||||
riot_timing = buffer[offset++];
|
||||
riot_timer = ( buffer[offset++] << 8 );
|
||||
riot_timer |= buffer[offset++];
|
||||
riot_intervals = buffer[offset++];
|
||||
riot_clocks = ( buffer[offset++] << 8 );
|
||||
riot_clocks |= buffer[offset++];
|
||||
}
|
||||
|
||||
// XM (if applicable)
|
||||
if (cartridge_xm) {
|
||||
if ((size != (16453 + 4 + XM_RAM_SIZE)) &&
|
||||
(size != (32837 + 4 + XM_RAM_SIZE))) {
|
||||
return false; // Save state file has an invalid size.
|
||||
}
|
||||
xm_reg = buffer[offset++];
|
||||
xm_bank = buffer[offset++];
|
||||
xm_pokey_enabled = buffer[offset++];
|
||||
xm_mem_enabled = buffer[offset++];
|
||||
|
||||
for (index = 0; index < XM_RAM_SIZE; index++) {
|
||||
xm_ram[index] = buffer[offset++];
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void prosystem_Pause(bool pause) {
|
||||
if (prosystem_active) {
|
||||
prosystem_paused = pause;
|
||||
}
|
||||
}
|
||||
|
||||
void prosystem_Close(void) {
|
||||
prosystem_active = false;
|
||||
prosystem_paused = false;
|
||||
cartridge_Release();
|
||||
maria_Reset();
|
||||
maria_Clear();
|
||||
memory_Reset();
|
||||
tia_Reset();
|
||||
tia_Clear();
|
||||
}
|
||||
Executable → Regular
+18
-23
@@ -1,11 +1,12 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _ __ ___
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ / / / _
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / ___/ /__/
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// Copyright 2020 Rupert Carmichael
|
||||
//
|
||||
// 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
|
||||
@@ -25,8 +26,6 @@
|
||||
#ifndef PRO_SYSTEM_H
|
||||
#define PRO_SYSTEM_H
|
||||
|
||||
#include <string>
|
||||
#include <stdio.h>
|
||||
#include "Equates.h"
|
||||
#include "Bios.h"
|
||||
#include "Cartridge.h"
|
||||
@@ -35,14 +34,18 @@
|
||||
#include "Region.h"
|
||||
#include "Riot.h"
|
||||
#include "Sally.h"
|
||||
#include "Archive.h"
|
||||
#include "Tia.h"
|
||||
#include "Pokey.h"
|
||||
#include "ExpansionModule.h"
|
||||
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned short word;
|
||||
typedef unsigned int uint;
|
||||
extern void prosystem_Reset(void);
|
||||
extern void prosystem_ExecuteFrame(const uint8_t* input);
|
||||
extern bool prosystem_Save(const char *filename);
|
||||
extern bool prosystem_Load(const char *filename);
|
||||
extern bool prosystem_Save_buffer(uint8_t *buffer);
|
||||
extern bool prosystem_Load_buffer(const uint8_t *buffer);
|
||||
extern void prosystem_Pause(bool pause);
|
||||
extern void prosystem_Close(void);
|
||||
|
||||
// The number of cycles per scan line
|
||||
#define CYCLES_PER_SCANLINE 454
|
||||
@@ -53,21 +56,13 @@ typedef unsigned int uint;
|
||||
// The number of cycles indented (after HBLANK) prior to checking for a hit
|
||||
#define LG_CYCLES_INDENT 52
|
||||
|
||||
extern void prosystem_Reset( );
|
||||
extern void prosystem_ExecuteFrame(const byte* input);
|
||||
extern bool prosystem_Save(std::string filename, bool compress);
|
||||
extern bool prosystem_Load(std::string filename);
|
||||
extern bool prosystem_Save_buffer(byte *buffer);
|
||||
extern bool prosystem_Load_buffer(const byte *buffer);
|
||||
extern void prosystem_Pause(bool pause);
|
||||
extern void prosystem_Close( );
|
||||
extern bool prosystem_active;
|
||||
extern bool prosystem_paused;
|
||||
extern word prosystem_frequency;
|
||||
extern byte prosystem_frame;
|
||||
extern word prosystem_scanlines;
|
||||
extern uint prosystem_cycles;
|
||||
extern uint prosystem_extra_cycles;
|
||||
extern uint16_t prosystem_frequency;
|
||||
extern uint8_t prosystem_frame;
|
||||
extern uint16_t prosystem_scanlines;
|
||||
extern uint32_t prosystem_cycles;
|
||||
extern uint32_t prosystem_extra_cycles;
|
||||
|
||||
// The scanline that the lightgun shot occurred at
|
||||
extern int lightgun_scanline;
|
||||
Executable → Regular
+15
-15
@@ -1,11 +1,12 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _ __ ___
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ / / / _
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / ___/ /__/
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// Copyright 2020 Rupert Carmichael
|
||||
//
|
||||
// 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
|
||||
@@ -20,17 +21,16 @@
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Timer.h
|
||||
// Rect.h
|
||||
// ----------------------------------------------------------------------------
|
||||
#ifndef TIMER_H
|
||||
#define TIMER_H
|
||||
#ifndef RECT_H
|
||||
#define RECT_H
|
||||
|
||||
#include "ProSystem.h"
|
||||
#include "Logger.h"
|
||||
#include "Common.h"
|
||||
typedef struct Rects {
|
||||
uint32_t left;
|
||||
uint32_t top;
|
||||
uint32_t right;
|
||||
uint32_t bottom;
|
||||
} rect;
|
||||
|
||||
extern void timer_Initialize( );
|
||||
extern void timer_Reset( );
|
||||
extern bool timer_IsTime( );
|
||||
|
||||
#endif
|
||||
#endif
|
||||
+204
@@ -0,0 +1,204 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _ __ ___
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ / / / _
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / ___/ /__/
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
// Copyright 2020 Rupert Carmichael
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Region.c
|
||||
// ----------------------------------------------------------------------------
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "Region.h"
|
||||
|
||||
uint8_t region_type = REGION_AUTO;
|
||||
|
||||
static const rect REGION_DISPLAY_AREA_NTSC = {0, 16, 319, 258};
|
||||
static const rect REGION_VISIBLE_AREA_NTSC = {0, 26, 319, 250};
|
||||
static const uint8_t REGION_FREQUENCY_NTSC = 60;
|
||||
static const uint16_t REGION_SCANLINES_NTSC = 262;
|
||||
|
||||
static const rect REGION_DISPLAY_AREA_PAL = {0, 16, 319, 308};
|
||||
static const rect REGION_VISIBLE_AREA_PAL = {0, 26, 319, 297};
|
||||
static const uint8_t REGION_FREQUENCY_PAL = 50;
|
||||
static const uint16_t REGION_SCANLINES_PAL = 312;
|
||||
|
||||
static const uint8_t REGION_PALETTE_NTSC[] = {
|
||||
0x00,0x00,0x00,0x25,0x25,0x25,0x34,0x34,0x34,0x4F,0x4F,0x4F,
|
||||
0x5B,0x5B,0x5B,0x69,0x69,0x69,0x7B,0x7B,0x7B,0x8A,0x8A,0x8A,
|
||||
0xA7,0xA7,0xA7,0xB9,0xB9,0xB9,0xC5,0xC5,0xC5,0xD0,0xD0,0xD0,
|
||||
0xD7,0xD7,0xD7,0xE1,0xE1,0xE1,0xF4,0xF4,0xF4,0xFF,0xFF,0xFF,
|
||||
0x4C,0x32,0x00,0x62,0x3A,0x00,0x7B,0x4A,0x00,0x9A,0x60,0x00,
|
||||
0xB5,0x74,0x00,0xCC,0x85,0x00,0xE7,0x9E,0x08,0xF7,0xAF,0x10,
|
||||
0xFF,0xC3,0x18,0xFF,0xD0,0x20,0xFF,0xD8,0x28,0xFF,0xDF,0x30,
|
||||
0xFF,0xE6,0x3B,0xFF,0xF4,0x40,0xFF,0xFA,0x4B,0xFF,0xFF,0x50,
|
||||
0x99,0x25,0x00,0xAA,0x25,0x00,0xB4,0x25,0x00,0xD3,0x30,0x00,
|
||||
0xDD,0x48,0x02,0xE2,0x50,0x09,0xF4,0x67,0x00,0xF4,0x75,0x10,
|
||||
0xFF,0x9E,0x10,0xFF,0xAC,0x20,0xFF,0xBA,0x3A,0xFF,0xBF,0x50,
|
||||
0xFF,0xC6,0x6D,0xFF,0xD5,0x80,0xFF,0xE4,0x90,0xFF,0xE6,0x99,
|
||||
0x98,0x0C,0x0C,0x99,0x0C,0x0C,0xC2,0x13,0x00,0xD3,0x13,0x00,
|
||||
0xE2,0x35,0x00,0xE3,0x40,0x00,0xE4,0x40,0x20,0xE5,0x52,0x30,
|
||||
0xFD,0x78,0x54,0xFF,0x8A,0x6A,0xFF,0x98,0x7C,0xFF,0xA4,0x8B,
|
||||
0xFF,0xB3,0x9E,0xFF,0xC2,0xB2,0xFF,0xD0,0xBA,0xFF,0xD7,0xC0,
|
||||
0x99,0x00,0x00,0xA9,0x00,0x00,0xC2,0x04,0x00,0xD3,0x04,0x00,
|
||||
0xDA,0x04,0x00,0xDB,0x08,0x00,0xE4,0x20,0x20,0xF6,0x40,0x40,
|
||||
0xFB,0x70,0x70,0xFB,0x7E,0x7E,0xFB,0x8F,0x8F,0xFF,0x9F,0x9F,
|
||||
0xFF,0xAB,0xAB,0xFF,0xB9,0xB9,0xFF,0xC9,0xC9,0xFF,0xCF,0xCF,
|
||||
0x7E,0x00,0x50,0x80,0x00,0x50,0x80,0x00,0x5F,0x95,0x0B,0x74,
|
||||
0xAA,0x22,0x88,0xBB,0x2F,0x9A,0xCE,0x3F,0xAD,0xD7,0x5A,0xB6,
|
||||
0xE4,0x67,0xC3,0xEF,0x72,0xCE,0xFB,0x7E,0xDA,0xFF,0x8D,0xE1,
|
||||
0xFF,0x9D,0xE5,0xFF,0xA5,0xE7,0xFF,0xAF,0xEA,0xFF,0xB8,0xEC,
|
||||
0x48,0x00,0x6C,0x5C,0x04,0x88,0x65,0x0D,0x90,0x7B,0x23,0xA7,
|
||||
0x93,0x3B,0xBF,0x9D,0x45,0xC9,0xA7,0x4F,0xD3,0xB2,0x5A,0xDE,
|
||||
0xBD,0x65,0xE9,0xC5,0x6D,0xF1,0xCE,0x76,0xFA,0xD5,0x83,0xFF,
|
||||
0xDA,0x90,0xFF,0xDE,0x9C,0xFF,0xE2,0xA9,0xFF,0xE6,0xB6,0xFF,
|
||||
0x1B,0x00,0x70,0x22,0x1B,0x8D,0x37,0x30,0xA2,0x48,0x41,0xB3,
|
||||
0x59,0x52,0xC4,0x63,0x5C,0xCE,0x6F,0x68,0xDA,0x7D,0x76,0xE8,
|
||||
0x87,0x80,0xF8,0x93,0x8C,0xFF,0x9D,0x97,0xFF,0xA8,0xA3,0xFF,
|
||||
0xB3,0xAF,0xFF,0xBC,0xB8,0xFF,0xC4,0xC1,0xFF,0xDA,0xD1,0xFF,
|
||||
0x00,0x0D,0x7F,0x00,0x12,0xA7,0x00,0x18,0xC0,0x0A,0x2B,0xD1,
|
||||
0x1B,0x4A,0xE3,0x2F,0x58,0xF0,0x37,0x68,0xFF,0x49,0x79,0xFF,
|
||||
0x5B,0x85,0xFF,0x6D,0x96,0xFF,0x7F,0xA3,0xFF,0x8C,0xAD,0xFF,
|
||||
0x96,0xB4,0xFF,0xA8,0xC0,0xFF,0xB7,0xCB,0xFF,0xC6,0xD6,0xFF,
|
||||
0x00,0x29,0x5A,0x00,0x38,0x76,0x00,0x48,0x92,0x00,0x5C,0xAC,
|
||||
0x00,0x71,0xC6,0x00,0x86,0xD0,0x0A,0x9B,0xDF,0x1A,0xA8,0xEC,
|
||||
0x2B,0xB6,0xFF,0x3F,0xC2,0xFF,0x45,0xCB,0xFF,0x59,0xD3,0xFF,
|
||||
0x7F,0xDA,0xFF,0x8F,0xDE,0xFF,0xA0,0xE2,0xFF,0xB0,0xEB,0xFF,
|
||||
0x00,0x38,0x39,0x00,0x3C,0x48,0x00,0x3D,0x5B,0x02,0x66,0x7F,
|
||||
0x03,0x73,0x83,0x00,0x9C,0xAA,0x00,0xA1,0xBB,0x01,0xA4,0xCC,
|
||||
0x03,0xBB,0xFF,0x05,0xDA,0xE2,0x18,0xE5,0xFF,0x34,0xEA,0xFF,
|
||||
0x49,0xEF,0xFF,0x66,0xF2,0xFF,0x84,0xF4,0xFF,0x9E,0xF9,0xFF,
|
||||
0x00,0x4A,0x00,0x00,0x5D,0x00,0x00,0x70,0x00,0x00,0x8B,0x00,
|
||||
0x00,0xA9,0x00,0x00,0xBB,0x05,0x00,0xBD,0x00,0x02,0xD0,0x05,
|
||||
0x1A,0xD5,0x40,0x5A,0xF1,0x77,0x82,0xEF,0xA7,0x84,0xED,0xD1,
|
||||
0x89,0xFF,0xED,0x7D,0xFF,0xFF,0x93,0xFF,0xFF,0x9B,0xFF,0xFF,
|
||||
0x22,0x4A,0x03,0x27,0x53,0x04,0x30,0x64,0x05,0x3C,0x77,0x0C,
|
||||
0x45,0x8C,0x11,0x5A,0xA5,0x13,0x1B,0xD2,0x09,0x1F,0xDD,0x00,
|
||||
0x3D,0xCD,0x2D,0x3D,0xCD,0x30,0x58,0xCC,0x40,0x60,0xD3,0x50,
|
||||
0xA2,0xEC,0x55,0xB3,0xF2,0x4A,0xBB,0xF6,0x5D,0xC4,0xF8,0x70,
|
||||
0x2E,0x3F,0x0C,0x36,0x4A,0x0F,0x40,0x56,0x15,0x46,0x5F,0x17,
|
||||
0x57,0x77,0x1A,0x65,0x85,0x1C,0x74,0x93,0x1D,0x8F,0xA5,0x25,
|
||||
0xAD,0xB7,0x2C,0xBC,0xC7,0x30,0xC9,0xD5,0x33,0xD4,0xE0,0x3B,
|
||||
0xE0,0xEC,0x42,0xEA,0xF6,0x45,0xF0,0xFD,0x47,0xF4,0xFF,0x6F,
|
||||
0x55,0x24,0x00,0x5A,0x2C,0x00,0x6C,0x3B,0x00,0x79,0x4B,0x00,
|
||||
0xB9,0x75,0x00,0xBB,0x85,0x00,0xC1,0xA1,0x20,0xD0,0xB0,0x2F,
|
||||
0xDE,0xBE,0x3F,0xE6,0xC6,0x45,0xED,0xCD,0x57,0xF5,0xDB,0x62,
|
||||
0xFB,0xE5,0x69,0xFC,0xEE,0x6F,0xFD,0xF3,0x77,0xFD,0xF3,0x7F,
|
||||
0x5C,0x27,0x00,0x5C,0x2F,0x00,0x71,0x3B,0x00,0x7B,0x48,0x00,
|
||||
0xB9,0x68,0x20,0xBB,0x72,0x20,0xC5,0x86,0x29,0xD7,0x96,0x33,
|
||||
0xE6,0xA4,0x40,0xF4,0xB1,0x4B,0xFD,0xC1,0x58,0xFF,0xCC,0x55,
|
||||
0xFF,0xD4,0x61,0xFF,0xDD,0x69,0xFF,0xE6,0x79,0xFF,0xEA,0x98
|
||||
};
|
||||
|
||||
static const uint8_t REGION_PALETTE_PAL[] = {
|
||||
0x00,0x00,0x00,0x1c,0x1c,0x1c,0x39,0x39,0x39,0x59,0x59,0x59,
|
||||
0x79,0x79,0x79,0x92,0x92,0x92,0xab,0xab,0xab,0xbc,0xbc,0xbc,
|
||||
0xcd,0xcd,0xcd,0xd9,0xd9,0xd9,0xe6,0xe6,0xe6,0xec,0xec,0xec,
|
||||
0xf2,0xf2,0xf2,0xf8,0xf8,0xf8,0xff,0xff,0xff,0xff,0xff,0xff,
|
||||
0x26,0x30,0x01,0x24,0x38,0x03,0x23,0x40,0x05,0x51,0x54,0x1b,
|
||||
0x80,0x69,0x31,0x97,0x81,0x35,0xaf,0x99,0x3a,0xc2,0xa7,0x3e,
|
||||
0xd5,0xb5,0x43,0xdb,0xc0,0x3d,0xe1,0xcb,0x38,0xe2,0xd8,0x36,
|
||||
0xe3,0xe5,0x34,0xef,0xf2,0x58,0xfb,0xff,0x7d,0xfb,0xff,0x7d,
|
||||
0x39,0x17,0x01,0x5e,0x23,0x04,0x83,0x30,0x08,0xa5,0x47,0x16,
|
||||
0xc8,0x5f,0x24,0xe3,0x78,0x20,0xff,0x91,0x1d,0xff,0xab,0x1d,
|
||||
0xff,0xc5,0x1d,0xff,0xce,0x34,0xff,0xd8,0x4c,0xff,0xe6,0x51,
|
||||
0xff,0xf4,0x56,0xff,0xf9,0x77,0xff,0xff,0x98,0xff,0xff,0x98,
|
||||
0x45,0x19,0x04,0x72,0x1e,0x11,0x9f,0x24,0x1e,0xb3,0x3a,0x20,
|
||||
0xc8,0x51,0x22,0xe3,0x69,0x20,0xff,0x81,0x1e,0xff,0x8c,0x25,
|
||||
0xff,0x98,0x2c,0xff,0xae,0x38,0xff,0xc5,0x45,0xff,0xc5,0x59,
|
||||
0xff,0xc6,0x6d,0xff,0xd5,0x87,0xff,0xe4,0xa1,0xff,0xe4,0xa1,
|
||||
0x4a,0x17,0x04,0x7e,0x1a,0x0d,0xb2,0x1d,0x17,0xc8,0x21,0x19,
|
||||
0xdf,0x25,0x1c,0xec,0x3b,0x38,0xfa,0x52,0x55,0xfc,0x61,0x61,
|
||||
0xff,0x70,0x6e,0xff,0x7f,0x7e,0xff,0x8f,0x8f,0xff,0x9d,0x9e,
|
||||
0xff,0xab,0xad,0xff,0xb9,0xbd,0xff,0xc7,0xce,0xff,0xc7,0xce,
|
||||
0x05,0x05,0x68,0x3b,0x13,0x6d,0x71,0x22,0x72,0x8b,0x2a,0x8c,
|
||||
0xa5,0x32,0xa6,0xb9,0x38,0xba,0xcd,0x3e,0xcf,0xdb,0x47,0xdd,
|
||||
0xea,0x51,0xeb,0xf4,0x5f,0xf5,0xfe,0x6d,0xff,0xfe,0x7a,0xfd,
|
||||
0xff,0x87,0xfb,0xff,0x95,0xfd,0xff,0xa4,0xff,0xff,0xa4,0xff,
|
||||
0x28,0x04,0x79,0x40,0x09,0x84,0x59,0x0f,0x90,0x70,0x24,0x9d,
|
||||
0x88,0x39,0xaa,0xa4,0x41,0xc3,0xc0,0x4a,0xdc,0xd0,0x54,0xed,
|
||||
0xe0,0x5e,0xff,0xe9,0x6d,0xff,0xf2,0x7c,0xff,0xf8,0x8a,0xff,
|
||||
0xff,0x98,0xff,0xfe,0xa1,0xff,0xfe,0xab,0xff,0xfe,0xab,0xff,
|
||||
0x35,0x08,0x8a,0x42,0x0a,0xad,0x50,0x0c,0xd0,0x64,0x28,0xd0,
|
||||
0x79,0x45,0xd0,0x8d,0x4b,0xd4,0xa2,0x51,0xd9,0xb0,0x58,0xec,
|
||||
0xbe,0x60,0xff,0xc5,0x6b,0xff,0xcc,0x77,0xff,0xd1,0x83,0xff,
|
||||
0xd7,0x90,0xff,0xdb,0x9d,0xff,0xdf,0xaa,0xff,0xdf,0xaa,0xff,
|
||||
0x05,0x1e,0x81,0x06,0x26,0xa5,0x08,0x2f,0xca,0x26,0x3d,0xd4,
|
||||
0x44,0x4c,0xde,0x4f,0x5a,0xee,0x5a,0x68,0xff,0x65,0x75,0xff,
|
||||
0x71,0x83,0xff,0x80,0x91,0xff,0x90,0xa0,0xff,0x97,0xa9,0xff,
|
||||
0x9f,0xb2,0xff,0xaf,0xbe,0xff,0xc0,0xcb,0xff,0xc0,0xcb,0xff,
|
||||
0x05,0x1e,0x81,0x06,0x26,0xa5,0x08,0x2f,0xca,0x26,0x3d,0xd4,
|
||||
0x44,0x4c,0xde,0x4f,0x5a,0xee,0x5a,0x68,0xff,0x65,0x75,0xff,
|
||||
0x71,0x83,0xff,0x80,0x91,0xff,0x90,0xa0,0xff,0x97,0xa9,0xff,
|
||||
0x9f,0xb2,0xff,0xaf,0xbe,0xff,0xc0,0xcb,0xff,0xc0,0xcb,0xff,
|
||||
0x0c,0x04,0x8b,0x22,0x18,0xa0,0x38,0x2d,0xb5,0x48,0x3e,0xc7,
|
||||
0x58,0x4f,0xda,0x61,0x59,0xec,0x6b,0x64,0xff,0x7a,0x74,0xff,
|
||||
0x8a,0x84,0xff,0x91,0x8e,0xff,0x99,0x98,0xff,0xa5,0xa3,0xff,
|
||||
0xb1,0xae,0xff,0xb8,0xb8,0xff,0xc0,0xc2,0xff,0xc0,0xc2,0xff,
|
||||
0x1d,0x29,0x5a,0x1d,0x38,0x76,0x1d,0x48,0x92,0x1c,0x5c,0xac,
|
||||
0x1c,0x71,0xc6,0x32,0x86,0xcf,0x48,0x9b,0xd9,0x4e,0xa8,0xec,
|
||||
0x55,0xb6,0xff,0x70,0xc7,0xff,0x8c,0xd8,0xff,0x93,0xdb,0xff,
|
||||
0x9b,0xdf,0xff,0xaf,0xe4,0xff,0xc3,0xe9,0xff,0xc3,0xe9,0xff,
|
||||
0x2f,0x43,0x02,0x39,0x52,0x02,0x44,0x61,0x03,0x41,0x7a,0x12,
|
||||
0x3e,0x94,0x21,0x4a,0x9f,0x2e,0x57,0xab,0x3b,0x5c,0xbd,0x55,
|
||||
0x61,0xd0,0x70,0x69,0xe2,0x7a,0x72,0xf5,0x84,0x7c,0xfa,0x8d,
|
||||
0x87,0xff,0x97,0x9a,0xff,0xa6,0xad,0xff,0xb6,0xad,0xff,0xb6,
|
||||
0x0a,0x41,0x08,0x0d,0x54,0x0a,0x10,0x68,0x0d,0x13,0x7d,0x0f,
|
||||
0x16,0x92,0x12,0x19,0xa5,0x14,0x1c,0xb9,0x17,0x1e,0xc9,0x19,
|
||||
0x21,0xd9,0x1b,0x47,0xe4,0x2d,0x6e,0xf0,0x40,0x78,0xf7,0x4d,
|
||||
0x83,0xff,0x5b,0x9a,0xff,0x7a,0xb2,0xff,0x9a,0xb2,0xff,0x9a,
|
||||
0x04,0x41,0x0b,0x05,0x53,0x0e,0x06,0x66,0x11,0x07,0x77,0x14,
|
||||
0x08,0x88,0x17,0x09,0x9b,0x1a,0x0b,0xaf,0x1d,0x48,0xc4,0x1f,
|
||||
0x86,0xd9,0x22,0x8f,0xe9,0x24,0x99,0xf9,0x27,0xa8,0xfc,0x41,
|
||||
0xb7,0xff,0x5b,0xc9,0xff,0x6e,0xdc,0xff,0x81,0xdc,0xff,0x81,
|
||||
0x02,0x35,0x0f,0x07,0x3f,0x15,0x0c,0x4a,0x1c,0x2d,0x5f,0x1e,
|
||||
0x4f,0x74,0x20,0x59,0x83,0x24,0x64,0x92,0x28,0x82,0xa1,0x2e,
|
||||
0xa1,0xb0,0x34,0xa9,0xc1,0x3a,0xb2,0xd2,0x41,0xc4,0xd9,0x45,
|
||||
0xd6,0xe1,0x49,0xe4,0xf0,0x4e,0xf2,0xff,0x53,0xf2,0xff,0x53,
|
||||
};
|
||||
|
||||
void region_Reset(void) {
|
||||
if (region_type == REGION_PAL || (region_type == REGION_AUTO && cartridge_region == REGION_PAL)) {
|
||||
maria_displayArea = REGION_DISPLAY_AREA_PAL;
|
||||
maria_visibleArea = REGION_VISIBLE_AREA_PAL;
|
||||
|
||||
if (palette_default) // Added check for default - bberlin
|
||||
palette_Load(REGION_PALETTE_PAL);
|
||||
|
||||
prosystem_frequency = REGION_FREQUENCY_PAL;
|
||||
prosystem_scanlines = REGION_SCANLINES_PAL;
|
||||
tia_size = 624;
|
||||
pokey_size = 624;
|
||||
}
|
||||
else {
|
||||
maria_displayArea = REGION_DISPLAY_AREA_NTSC;
|
||||
maria_visibleArea = REGION_VISIBLE_AREA_NTSC;
|
||||
|
||||
if (palette_default) // Added check for default - bberlin
|
||||
palette_Load(REGION_PALETTE_NTSC);
|
||||
|
||||
prosystem_frequency = REGION_FREQUENCY_NTSC;
|
||||
prosystem_scanlines = REGION_SCANLINES_NTSC;
|
||||
tia_size = 524;
|
||||
pokey_size = 524;
|
||||
}
|
||||
|
||||
pokey_setSampleRate((prosystem_scanlines * prosystem_frequency) << 1);
|
||||
}
|
||||
Executable → Regular
+9
-11
@@ -1,11 +1,12 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _ __ ___
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ / / / _
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / ___/ /__/
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// Copyright 2020 Rupert Carmichael
|
||||
//
|
||||
// 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
|
||||
@@ -24,6 +25,7 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
#ifndef REGION_H
|
||||
#define REGION_H
|
||||
|
||||
#define REGION_NTSC 0
|
||||
#define REGION_PAL 1
|
||||
#define REGION_AUTO 2
|
||||
@@ -34,11 +36,7 @@
|
||||
#include "Palette.h"
|
||||
#include "Tia.h"
|
||||
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned short word;
|
||||
typedef unsigned int uint;
|
||||
extern void region_Reset(void);
|
||||
extern uint8_t region_type;
|
||||
|
||||
extern void region_Reset( );
|
||||
extern byte region_type;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
+257
@@ -0,0 +1,257 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _ __ ___
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ / / / _
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / ___/ /__/
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
// Copyright 2020 Rupert Carmichael
|
||||
//
|
||||
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
// ----------------------------------------------------------------------------
|
||||
// Riot.c
|
||||
// ----------------------------------------------------------------------------
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "Riot.h"
|
||||
|
||||
bool riot_timing = false;
|
||||
uint16_t riot_timer = TIM64T;
|
||||
uint8_t riot_intervals;
|
||||
|
||||
uint8_t riot_dra = 0;
|
||||
uint8_t riot_drb = 0;
|
||||
static bool riot_elapsed;
|
||||
static int riot_currentTime;
|
||||
uint16_t riot_clocks;
|
||||
|
||||
void riot_Reset(void) {
|
||||
riot_SetDRA(0);
|
||||
riot_SetDRB(0);
|
||||
|
||||
riot_timing = false;
|
||||
riot_timer = TIM64T;
|
||||
riot_intervals = 0;
|
||||
riot_clocks = 0;
|
||||
|
||||
riot_elapsed = false;
|
||||
riot_currentTime = 0;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// SetInput
|
||||
// +----------+--------------+-------------------------------------------------
|
||||
// | Offset | Controller | Control
|
||||
// +----------+--------------+-------------------------------------------------
|
||||
// | 00 | Joystick 1 | Right
|
||||
// | 01 | Joystick 1 | Left
|
||||
// | 02 | Joystick 1 | Down
|
||||
// | 03 | Joystick 1 | Up
|
||||
// | 04 | Joystick 1 | Button 1
|
||||
// | 05 | Joystick 1 | Button 2
|
||||
// | 06 | Joystick 2 | Right
|
||||
// | 07 | Joystick 2 | Left
|
||||
// | 08 | Joystick 2 | Down
|
||||
// | 09 | Joystick 2 | Up
|
||||
// | 10 | Joystick 2 | Button 1
|
||||
// | 11 | Joystick 2 | Button 2
|
||||
// | 12 | Console | Reset
|
||||
// | 13 | Console | Select
|
||||
// | 14 | Console | Pause
|
||||
// | 15 | Console | Left Difficulty
|
||||
// | 16 | Console | Right Difficulty
|
||||
// +----------+--------------+-------------------------------------------------
|
||||
void riot_SetInput(const uint8_t* input) {
|
||||
|
||||
/*gdement: Comments are messy, but wanted to document how this all works.
|
||||
Changed this routine to support 1 vs 2 button modes.
|
||||
Also added the interaction of CTLSWA and DRA on the SWCHA output, and same
|
||||
for SWCHB. SWCHA is directionals. SWCHB is console switches and button
|
||||
mode. Button signals are in high bits of INPT0-5.*/
|
||||
|
||||
memory_ram[SWCHA] = ((~memory_ram[CTLSWA]) | riot_dra); /*SWCHA as driven by RIOT*/
|
||||
/*now console switches will force bits to ground:*/
|
||||
if (input[0x00]) memory_ram[SWCHA] = memory_ram[SWCHA] &~ 0x80;
|
||||
if (input[0x01]) memory_ram[SWCHA] = memory_ram[SWCHA] &~ 0x40;
|
||||
if (input[0x02]) memory_ram[SWCHA] = memory_ram[SWCHA] &~ 0x20;
|
||||
if (input[0x03]) memory_ram[SWCHA] = memory_ram[SWCHA] &~ 0x10;
|
||||
if (input[0x06]) memory_ram[SWCHA] = memory_ram[SWCHA] &~ 0x08;
|
||||
if (input[0x07]) memory_ram[SWCHA] = memory_ram[SWCHA] &~ 0x04;
|
||||
if (input[0x08]) memory_ram[SWCHA] = memory_ram[SWCHA] &~ 0x02;
|
||||
if (input[0x09]) memory_ram[SWCHA] = memory_ram[SWCHA] &~ 0x01;
|
||||
/*Switches can always push the appropriate bit of SWCHA to ground, as in above code block.
|
||||
In addition, RIOT can be configured to drive ground even when switch is open.
|
||||
By doing this it's possible for real hardware to behave as if switches are permanently held (tested this).*/
|
||||
|
||||
/*As with swcha, the value seen at SWCHB is derived from CTLSWB and DRB (an internal RIOT register)
|
||||
(Any write to SWCHB actually gets stored in DRB)
|
||||
If a given bit in CTLSWB is 0 (input mode), then RIOT puts a 1 on SWCHB.
|
||||
If bit in CTLSWB is 1 (output mode), then RIOT puts stored DRB value on SWCHB.
|
||||
The SWCHB outputs from RIOT can be overdriven to 0 by console switches.
|
||||
The CTLSWB/DRB interaction is important at bits 2 and 4, which control button mode for each player.
|
||||
Bit 5 appears unused, and other bits are the console switches.
|
||||
|
||||
CTLSWB DRB SWCHB result on button mode (for bits 2 and 4)
|
||||
------- --- ----- -----------------------------------------
|
||||
0 0 1 1 button mode - this is default state after boot
|
||||
0 1 1 1 button mode
|
||||
1 0 0 2 button mode
|
||||
1 1 1 1 button mode
|
||||
This chart was confirmed on hardware
|
||||
From the default state after boot, simply changing CTLSWB to 1 will result in 2 button mode.
|
||||
Some games rely on this, and don't actually store anything to SWCHB.*/
|
||||
|
||||
memory_ram[SWCHB] = ((~memory_ram[CTLSWB]) | riot_drb); /*SWCHB as driven by RIOT*/
|
||||
|
||||
if (input != NULL) {
|
||||
/*now the console switches can force certain bits to ground:*/
|
||||
if (input[0x0c]) memory_ram[SWCHB] = memory_ram[SWCHB] &~ 0x01;
|
||||
if (input[0x0d]) memory_ram[SWCHB] = memory_ram[SWCHB] &~ 0x02;
|
||||
if (input[0x0e]) memory_ram[SWCHB] = memory_ram[SWCHB] &~ 0x08;
|
||||
if (input[0x0f]) memory_ram[SWCHB] = memory_ram[SWCHB] &~ 0x40;
|
||||
if (input[0x10]) memory_ram[SWCHB] = memory_ram[SWCHB] &~ 0x80;
|
||||
}
|
||||
|
||||
/*When in 1 button mode, only the legacy 2600 button signal is active. The others stay off.
|
||||
When in 2 button mode, only the new signals are active. 2600 button stays off. (tested)
|
||||
see: http://www.atariage.com/forums/index.php?showtopic=127162
|
||||
also see 7800 schematic and RIOT datasheet */
|
||||
|
||||
if (memory_ram[SWCHB] & 0x04) { //first player in 1 button mode
|
||||
memory_ram[INPT0] &= 0x7f; //new style buttons are always off in this mode
|
||||
memory_ram[INPT1] &= 0x7f;
|
||||
|
||||
//in this mode, either button triggers only the legacy button signal
|
||||
if (input[0x04] || input[0x05]) {
|
||||
memory_ram[INPT4] &= 0x7f; //this button signal activates by turning off the high bit
|
||||
}
|
||||
else {
|
||||
memory_ram[INPT4] |= 0x80;
|
||||
}
|
||||
}
|
||||
else { //first player in 2 button mode
|
||||
memory_ram[INPT4] |= 0x80; //2600 button is always off in this mode
|
||||
if (input[0x04]) { //left button (button 1)
|
||||
memory_ram[INPT1] |= 0x80; //these buttons activate by turning on the high bit.
|
||||
}
|
||||
else {
|
||||
memory_ram[INPT1] &= 0x7f;
|
||||
}
|
||||
if (input[0x05]) { //right button (button 2)
|
||||
memory_ram[INPT0] |= 0x80;
|
||||
}
|
||||
else {
|
||||
memory_ram[INPT0] &= 0x7f;
|
||||
}
|
||||
}
|
||||
|
||||
/*now repeat for 2nd player*/
|
||||
if (memory_ram[SWCHB] & 0x10) {
|
||||
memory_ram[INPT2] &= 0x7f;
|
||||
memory_ram[INPT3] &= 0x7f;
|
||||
|
||||
if (input[0x0a] || input[0x0b]) {
|
||||
memory_ram[INPT5] &= 0x7f;
|
||||
}
|
||||
else {
|
||||
memory_ram[INPT5] |= 0x80;
|
||||
}
|
||||
}
|
||||
else {
|
||||
memory_ram[INPT5] |= 0x80;
|
||||
|
||||
if (input[0x0a]) {
|
||||
memory_ram[INPT3] |= 0x80;
|
||||
}
|
||||
else {
|
||||
memory_ram[INPT3] &= 0x7f;
|
||||
}
|
||||
|
||||
if (input[0x0b]) {
|
||||
memory_ram[INPT2] |= 0x80;
|
||||
}
|
||||
else {
|
||||
memory_ram[INPT2] &= 0x7f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*Stores a value written to SWCHA/SWCHB into the RIOT's internal DRA/DRB
|
||||
registers. These are distinct from what you see when reading SWCHA/SWCHB.*/
|
||||
void riot_SetDRA(uint8_t data) {
|
||||
riot_dra=data;
|
||||
}
|
||||
|
||||
void riot_SetDRB(uint8_t data) {
|
||||
riot_drb=data;
|
||||
}
|
||||
|
||||
void riot_SetTimer(uint16_t timer, uint8_t intervals) {
|
||||
riot_timer = timer;
|
||||
riot_intervals = intervals;
|
||||
|
||||
switch (timer) {
|
||||
case T1024T:
|
||||
riot_clocks = 1024;
|
||||
riot_timing = true;
|
||||
break;
|
||||
|
||||
case TIM1T:
|
||||
riot_clocks = 1;
|
||||
riot_timing = true;
|
||||
break;
|
||||
|
||||
case TIM8T:
|
||||
riot_clocks = 8;
|
||||
riot_timing = true;
|
||||
break;
|
||||
|
||||
case TIM64T:
|
||||
riot_clocks = 64;
|
||||
riot_timing = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (riot_timing) {
|
||||
riot_currentTime = riot_clocks * intervals;
|
||||
riot_elapsed = false;
|
||||
}
|
||||
}
|
||||
|
||||
void riot_UpdateTimer(uint8_t cycles) {
|
||||
riot_currentTime -= cycles;
|
||||
if (!riot_elapsed && riot_currentTime > 0) {
|
||||
memory_Write(INTIM, riot_currentTime / riot_clocks);
|
||||
}
|
||||
else {
|
||||
if (riot_elapsed) {
|
||||
if(riot_currentTime >= -255) {
|
||||
memory_Write(INTIM, riot_currentTime);
|
||||
}
|
||||
else {
|
||||
memory_Write(INTIM, 0);
|
||||
riot_timing = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
riot_currentTime = riot_clocks;
|
||||
memory_Write(INTIM, 0);
|
||||
memory_ram[INTFLG] |= 0x80;
|
||||
riot_elapsed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable → Regular
+15
-18
@@ -1,11 +1,12 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ /
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / emulator
|
||||
// ___ ___ ___ ___ ___ ____ ___ _ _ __ ___
|
||||
// /__/ /__/ / / /__ /__/ /__ / /_ / |/ / / / _
|
||||
// / / \ /__/ ___/ ___/ ___/ / /__ / / ___/ /__/
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
// Copyright 2005 Greg Stanton
|
||||
//
|
||||
// Copyright 2020 Rupert Carmichael
|
||||
//
|
||||
// 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
|
||||
@@ -28,21 +29,17 @@
|
||||
#include "Equates.h"
|
||||
#include "Memory.h"
|
||||
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned short word;
|
||||
typedef unsigned int uint;
|
||||
|
||||
extern void riot_Reset(void);
|
||||
extern void riot_SetInput(const byte* input);
|
||||
extern void riot_SetDRA(byte data);
|
||||
extern void riot_SetDRB(byte data);
|
||||
extern void riot_SetTimer(word timer, byte intervals);
|
||||
extern void riot_UpdateTimer(byte cycles);
|
||||
extern void riot_SetInput(const uint8_t* input);
|
||||
extern void riot_SetDRA(uint8_t data);
|
||||
extern void riot_SetDRB(uint8_t data);
|
||||
extern void riot_SetTimer(uint16_t timer, uint8_t intervals);
|
||||
extern void riot_UpdateTimer(uint8_t cycles);
|
||||
extern bool riot_timing;
|
||||
extern word riot_timer;
|
||||
extern byte riot_intervals;
|
||||
extern byte riot_dra;
|
||||
extern byte riot_drb;
|
||||
extern word riot_clocks;
|
||||
extern uint16_t riot_timer;
|
||||
extern uint8_t riot_intervals;
|
||||
extern uint8_t riot_dra;
|
||||
extern uint8_t riot_drb;
|
||||
extern uint16_t riot_clocks;
|
||||
|
||||
#endif
|
||||
+1534
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user