Very old Powder Toy source code tar ~2009
This commit is contained in:
parent
dad7b3a1ab
commit
9c1ffdccc1
340
LICENSE
Normal file
340
LICENSE
Normal file
@ -0,0 +1,340 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 2, June 1991
|
||||||
|
|
||||||
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||||
|
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 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.
|
74
Makefile
Normal file
74
Makefile
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
SOURCES := powder.c http.c md5.c update.c
|
||||||
|
HEADERS := font.h http.h md5.h icon.h update.h fbi.h
|
||||||
|
|
||||||
|
CFLAGS := -Wall -std=c99 -D_POSIX_C_SOURCE=200112L -fgnu89-inline
|
||||||
|
OFLAGS := -O3 -ffast-math -ftree-vectorize -funsafe-math-optimizations
|
||||||
|
LFLAGS := -lSDL -lm -lbz2
|
||||||
|
MFLAGS_SSE3 := -march=k8 -DX86 -DX86_SSE3 -msse3
|
||||||
|
MFLAGS_SSE2 := -march=k8 -DX86 -DX86_SSE2
|
||||||
|
MFLAGS_SSE := -march=pentium3 -DX86 -DX86_SSE
|
||||||
|
|
||||||
|
LINUX_TARG := powder-64-sse2 powder-sse powder-sse2
|
||||||
|
WIN32_TARG := powder-sse.exe powder-sse2.exe
|
||||||
|
|
||||||
|
powder: $(SOURCES) $(HEADERS)
|
||||||
|
gcc -m64 -DINTERNAL -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN64
|
||||||
|
|
||||||
|
powder-sse3: $(SOURCES) $(HEADERS)
|
||||||
|
gcc -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN32
|
||||||
|
strip $@
|
||||||
|
powder-sse2: $(SOURCES) $(HEADERS)
|
||||||
|
gcc -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE2) $(SOURCES) -DLIN32
|
||||||
|
strip $@
|
||||||
|
powder-sse: $(SOURCES) $(HEADERS)
|
||||||
|
gcc -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE) $(SOURCES) -DLIN32
|
||||||
|
strip $@
|
||||||
|
|
||||||
|
powder-64-sse3: $(SOURCES) $(HEADERS)
|
||||||
|
gcc -m64 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN64
|
||||||
|
strip $@
|
||||||
|
powder-64-sse2: $(SOURCES) $(HEADERS)
|
||||||
|
gcc -m64 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE2) $(SOURCES) -DLIN64
|
||||||
|
strip $@
|
||||||
|
|
||||||
|
powder-res.o: powder-res.rc powder.ico
|
||||||
|
i586-mingw32msvc-windres powder-res.rc powder-res.o
|
||||||
|
|
||||||
|
powder-sse3.exe: $(SOURCES) $(HEADERS) powder-res.o
|
||||||
|
i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE3) $(SOURCES) powder-res.o -lmingw32 -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32
|
||||||
|
strip $@
|
||||||
|
chmod 0644 $@
|
||||||
|
powder-sse2.exe: $(SOURCES) $(HEADERS) powder-res.o
|
||||||
|
i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE2) $(SOURCES) powder-res.o -lmingw32 -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32
|
||||||
|
strip $@
|
||||||
|
chmod 0644 $@
|
||||||
|
powder-sse.exe: $(SOURCES) $(HEADERS) powder-res.o
|
||||||
|
i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE) $(SOURCES) powder-res.o -lmingw32 -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32
|
||||||
|
strip $@
|
||||||
|
chmod 0644 $@
|
||||||
|
|
||||||
|
powder-src.tar.bz2: *.c *.h *.rc *.ico Makefile
|
||||||
|
mkdir powder-src
|
||||||
|
cp *.c *.h *.rc *.ico Makefile powder-src/
|
||||||
|
tar cfj powder-src.tar.bz2 powder-src
|
||||||
|
rm -rf powder-src
|
||||||
|
|
||||||
|
release: $(LINUX_TARG) $(WIN32_TARG) powder-src.tar.bz2
|
||||||
|
tar cfz powder-linux.tar.gz $(LINUX_TARG)
|
||||||
|
cp /usr/i586-mingw32msvc/bin/SDL.dll .
|
||||||
|
zip powder-win32.zip $(WIN32_TARG) SDL.dll
|
||||||
|
mkdir -p release
|
||||||
|
mv powder-linux.tar.gz release/
|
||||||
|
mv powder-win32.zip release/
|
||||||
|
mv powder-src.tar.bz2 release/
|
||||||
|
cp powder-sse.exe powder.exe
|
||||||
|
rm -f release/powder.zip
|
||||||
|
zip release/powder.zip powder.exe SDL.dll
|
||||||
|
cp powder-64-sse2 release/powder64
|
||||||
|
rm -f release/powder64.gz
|
||||||
|
gzip release/powder64
|
||||||
|
rm -f release/powder.gz
|
||||||
|
cp powder-sse release/powder
|
||||||
|
gzip release/powder
|
||||||
|
cd release; tar czf powder-bin.tar.gz powder.gz powder64.gz powder-linux.tar.gz powder-win32.zip powder.zip; cd ..
|
||||||
|
rm -f $(LINUX_TARG) $(WIN32_TARG) SDL.dll powder.exe
|
223
fbi.h
Normal file
223
fbi.h
Normal file
@ -0,0 +1,223 @@
|
|||||||
|
#define FBI_W 268
|
||||||
|
#define FBI_H 201
|
||||||
|
#define FBI_CMP 3464
|
||||||
|
|
||||||
|
unsigned char fbi[FBI_CMP] = {
|
||||||
|
0x42, 0x5A, 0x68, 0x39, 0x31, 0x41, 0x59, 0x26, 0x53, 0x59, 0xE5, 0x00, 0x24, 0xC9, 0x00, 0x01,
|
||||||
|
0x88, 0x7F, 0xFF, 0xD2, 0x49, 0x24, 0xB2, 0x68, 0x24, 0xB2, 0x48, 0x14, 0x90, 0x49, 0x24, 0x9A,
|
||||||
|
0x48, 0x28, 0x92, 0x09, 0x24, 0x96, 0x41, 0x04, 0x92, 0x49, 0x26, 0x92, 0x49, 0x01, 0x82, 0x41,
|
||||||
|
0x24, 0x92, 0xC8, 0x60, 0x1D, 0x5E, 0xF2, 0x57, 0xD8, 0x02, 0xD1, 0xA9, 0x65, 0x8D, 0xB0, 0x00,
|
||||||
|
0x01, 0xAD, 0x1A, 0x24, 0x12, 0xA3, 0x4A, 0xD3, 0x6C, 0x1B, 0x60, 0x00, 0x69, 0x40, 0x24, 0x6B,
|
||||||
|
0x4B, 0xDE, 0x2F, 0x7A, 0x88, 0x8B, 0xD6, 0x1B, 0x29, 0x8D, 0x33, 0x85, 0xDC, 0x15, 0xAE, 0x08,
|
||||||
|
0xC9, 0x6C, 0xEB, 0xA3, 0xBB, 0xAB, 0x80, 0x50, 0x05, 0x04, 0x54, 0xCD, 0x92, 0x4C, 0x40, 0x1A,
|
||||||
|
0x68, 0x68, 0xF5, 0x00, 0xD0, 0xD0, 0x00, 0x0D, 0x00, 0x03, 0x40, 0x68, 0x04, 0x84, 0x44, 0x24,
|
||||||
|
0x48, 0xF5, 0x0F, 0x53, 0xF4, 0x89, 0xB5, 0x1A, 0x68, 0x19, 0x0C, 0x00, 0x41, 0x81, 0x31, 0x0C,
|
||||||
|
0x83, 0xD1, 0xA1, 0xC6, 0x4C, 0x9A, 0x31, 0x0D, 0x34, 0x30, 0x13, 0x43, 0x13, 0x46, 0x99, 0x31,
|
||||||
|
0x03, 0x23, 0x09, 0xA3, 0x4D, 0x30, 0x83, 0x26, 0x12, 0x7A, 0xA5, 0x28, 0x90, 0x0A, 0x7A, 0x8C,
|
||||||
|
0x00, 0x26, 0x4C, 0x86, 0x00, 0x00, 0x00, 0x09, 0x88, 0x32, 0x18, 0x21, 0x2A, 0x9A, 0x53, 0x6A,
|
||||||
|
0x9A, 0x32, 0x68, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x81, 0xA0, 0x34, 0x0A, 0x9A, 0x95,
|
||||||
|
0x4D, 0x12, 0x80, 0x1A, 0x34, 0x64, 0x00, 0x00, 0x68, 0x1A, 0x06, 0x4D, 0x00, 0x00, 0x00, 0x77,
|
||||||
|
0xBD, 0x8E, 0xD8, 0x28, 0x92, 0x6C, 0x8A, 0x26, 0xD6, 0x50, 0x0B, 0x64, 0x4D, 0xB2, 0x94, 0x1B,
|
||||||
|
0x9D, 0xB5, 0x73, 0x6C, 0x59, 0xB2, 0xA3, 0x13, 0x56, 0xA2, 0xAC, 0x6D, 0x45, 0xB5, 0x36, 0x6D,
|
||||||
|
0xDB, 0x11, 0x54, 0x63, 0x51, 0x45, 0x16, 0x92, 0xC9, 0xA5, 0xFC, 0x25, 0x33, 0x11, 0x28, 0x52,
|
||||||
|
0x94, 0x04, 0x3C, 0xB1, 0xA3, 0x4A, 0x9A, 0x21, 0x17, 0x67, 0x45, 0x32, 0xF0, 0x88, 0x80, 0x6C,
|
||||||
|
0xCD, 0x59, 0x54, 0x0E, 0x48, 0x25, 0x2D, 0x56, 0xB6, 0xD3, 0xE6, 0x6D, 0x64, 0xA3, 0x63, 0x06,
|
||||||
|
0xA2, 0x35, 0xA1, 0x11, 0xA5, 0x0A, 0x11, 0xA4, 0x8E, 0xEE, 0x35, 0x42, 0xD3, 0x54, 0xA5, 0x0A,
|
||||||
|
0x6B, 0x1D, 0x15, 0x85, 0x1B, 0x2B, 0x65, 0x1B, 0x50, 0xD6, 0xB5, 0x1B, 0xEC, 0x4D, 0x5E, 0x37,
|
||||||
|
0x97, 0x9D, 0xAA, 0x28, 0xD5, 0xD2, 0x94, 0x2D, 0xAE, 0x12, 0x73, 0x9B, 0x95, 0x14, 0x21, 0x6D,
|
||||||
|
0x1D, 0x95, 0x8D, 0xAB, 0x9B, 0x14,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0x47, 0x15, 0x58, 0xDC, 0xB7, 0x58, 0x6B, 0x24, 0xA6, 0x34, 0xD0,
|
||||||
|
0xD4, 0x85, 0x8C, 0x9A, 0xCB, 0xBA, 0xEE, 0xD7, 0x44, 0x9A, 0x33, 0xB8, 0xAE, 0x44, 0x62, 0x8D,
|
||||||
|
0x17, 0x31, 0x77, 0x2E, 0x2A, 0x77, 0x5B, 0xA6, 0x10, 0x09, 0x38, 0xEE, 0x69, 0x0B, 0x64, 0xCC,
|
||||||
|
0x91, 0x62, 0x9A, 0xD6, 0x43, 0x49, 0x5A, 0x36, 0xDA, 0x35, 0xA0, 0x68, 0x2D, 0x6A, 0xA7, 0x10,
|
||||||
|
0xEA, 0x26, 0xD6, 0x71, 0xB2, 0x1A, 0x76, 0x32, 0x61, 0x73, 0x73, 0x63, 0xC7, 0x79, 0xD3, 0x2D,
|
||||||
|
0x73, 0x5E, 0x28, 0xAD, 0x6A, 0xF0, 0xC8, 0xDA, 0xAB, 0xC5, 0xB7, 0x35, 0x46, 0xB8, 0x5B, 0xA4,
|
||||||
|
0xC3, 0x46, 0xAD, 0xC3, 0xBB, 0x96, 0x44, 0x53, 0x9B, 0x91, 0x77, 0x72, 0xC5, 0xA8, 0x8D, 0x4A,
|
||||||
|
0x69, 0xB3, 0x26, 0xA2, 0x23, 0x54, 0x92, 0x54, 0xC4, 0x48, 0xB6, 0x46, 0x98, 0xC1, 0x83, 0x9D,
|
||||||
|
0x32, 0x69, 0x94, 0x62, 0xAD, 0xB1, 0xB0, 0x52, 0x04, 0x48, 0x52, 0x2D, 0x0A, 0x8E, 0x91, 0x26,
|
||||||
|
0x8D, 0xB0, 0x5A, 0xB6, 0x76, 0xC6, 0xC3, 0x6A, 0x62, 0x26, 0x26, 0x34, 0xE8, 0xA3, 0x11, 0x89,
|
||||||
|
0xAC, 0x49, 0x92, 0x92, 0x25, 0x8D, 0x28, 0x4C, 0xBB, 0x77, 0x69, 0x36, 0x77, 0x45, 0xA3, 0x62,
|
||||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x72, 0xBD, 0xC5, 0x55, 0x5E, 0x92, 0xA8, 0x15,
|
||||||
|
0x41, 0x54, 0x94, 0x50, 0x52, 0x34, 0x2C, 0x04, 0x6A, 0x2B, 0x08, 0x91, 0x51, 0x1A, 0x44, 0x2D,
|
||||||
|
0x15, 0x1B, 0x54, 0x54, 0xCA, 0x0A, 0x22, 0xD0, 0x54, 0x6D, 0x8A, 0x02, 0xD1, 0xAA, 0x48, 0x92,
|
||||||
|
0x22, 0x2D, 0x51, 0x98, 0xC8, 0xC6, 0x2D, 0xB2, 0x5B, 0x4C, 0x13, 0x51, 0x0D, 0x88, 0x10, 0x1A,
|
||||||
|
0x12, 0xD5, 0x1A, 0xD8, 0x9A, 0x21, 0x18, 0x93, 0x08, 0x51, 0x52, 0x6B, 0x5A, 0x4D, 0x46, 0xC4,
|
||||||
|
0xD4, 0x8C, 0xC8, 0xB6, 0x1E, 0x20, 0xA8, 0x08, 0xA1, 0x38, 0x22, 0x99, 0x24, 0x96, 0x09, 0x99,
|
||||||
|
0x20, 0x98, 0x20, 0x36, 0x18, 0xB1, 0xB2, 0x64, 0x03, 0x25, 0x0D, 0x04, 0x49, 0x30, 0x0D, 0x14,
|
||||||
|
0x4D, 0x2C, 0xCA, 0x45, 0x25, 0x98, 0x34, 0x62, 0xA4, 0xC4, 0x8A, 0x98, 0x32, 0xCC, 0x65, 0x49,
|
||||||
|
0xB1, 0xB5, 0x95, 0x81, 0x55, 0x1A, 0x35, 0x93, 0x1A, 0x2A, 0x31, 0x68, 0x8C, 0x18, 0xD0, 0x54,
|
||||||
|
0x54, 0x5A, 0xA3, 0x5B, 0x05, 0x26, 0xB6, 0x0C, 0x64, 0x21, 0x36, 0x8D, 0x92, 0xD8, 0xD4, 0x62,
|
||||||
|
0xDB, 0x26, 0x35, 0x21, 0xA4, 0xD8, 0xD1, 0xA8, 0xB1, 0xAB, 0x1A, 0xD4, 0x54, 0xCB, 0x09, 0x80,
|
||||||
|
0x31, 0xB0, 0x6D, 0x49, 0x62, 0xB6, 0x0A, 0x31, 0xA3, 0x6A, 0x0A, 0xC5, 0x8C, 0x46, 0xD4, 0x9A,
|
||||||
|
0x88, 0x93, 0x15, 0x82, 0x36, 0x11, 0x4C, 0x98, 0xA5, 0x99, 0x48, 0xAD, 0x32, 0x8D, 0x26, 0xD4,
|
||||||
|
0x26, 0x34, 0x9A, 0x88, 0xC6, 0xA9, 0x35, 0x88, 0x8A, 0x89, 0x2B, 0x68, 0xDA, 0xC6, 0xDB, 0x41,
|
||||||
|
0x56, 0x8B, 0x6D, 0x14, 0x59, 0x65, 0xA4, 0xC1, 0xA4, 0xDA, 0x99, 0xAD, 0x13, 0x2B, 0x1A, 0xB2,
|
||||||
|
0x11, 0xAA, 0x44, 0x90, 0x22, 0xB3, 0x34, 0x2A, 0x4D, 0x16, 0xA9, 0x46, 0x88, 0x5A, 0x0A, 0x32,
|
||||||
|
0x54, 0x2C, 0xD4, 0x59, 0x22, 0xB4, 0xDB, 0x6B, 0x6A, 0x0B, 0x14, 0x6A, 0xC5, 0xA9, 0x20, 0xB4,
|
||||||
|
0x51, 0x92, 0x0B, 0x63, 0x6D, 0xB4, 0xC4, 0xDA, 0x36, 0xC9, 0x29, 0xAB, 0x66, 0xD4, 0x15, 0xB6,
|
||||||
|
0x32, 0xAB, 0x06, 0x96, 0x64, 0x6A, 0x4C, 0x51, 0xAC, 0x16, 0x28, 0x96, 0x31, 0x25, 0x24, 0xC9,
|
||||||
|
0x69, 0x66, 0xA3, 0x26, 0xD8, 0xB6, 0x8D, 0xAA, 0x12, 0x65, 0x48, 0x19, 0xA1, 0xA2, 0x92, 0xA4,
|
||||||
|
0x98, 0xD3, 0x6D, 0x5A, 0xC1, 0x68, 0x36, 0xC9, 0x83, 0x1A, 0x31, 0x88, 0xDA, 0x34, 0x56, 0x36,
|
||||||
|
0xAC, 0x63, 0x62, 0xD1, 0x60, 0xD1, 0xB4, 0x6B, 0x6D, 0x19, 0x28, 0x4B, 0x44, 0x10, 0x91, 0xB5,
|
||||||
|
0x1B, 0x58, 0xA3, 0x5A, 0x4D, 0x12, 0x5A, 0x64, 0x50, 0x5A, 0xB5, 0x1B, 0x68, 0xB6, 0x8D, 0xA3,
|
||||||
|
0x63, 0x68, 0xB1, 0x15, 0x16, 0x8D, 0xB5, 0x45, 0x63, 0x49, 0x86, 0x62, 0xA3, 0x4A, 0x30, 0xD4,
|
||||||
|
0x0A, 0xC2, 0xB6, 0x64, 0x98, 0xA6, 0xA6, 0x48, 0xA6, 0x50, 0x56, 0xAD, 0xB1, 0x2C, 0x51, 0xB6,
|
||||||
|
0x56, 0xCA, 0xC9, 0x34, 0x15, 0x16, 0x35, 0x68, 0xD4, 0x5A, 0x2A, 0x36, 0x82, 0xC6, 0xB4, 0x14,
|
||||||
|
0x32, 0xB5, 0x63, 0x5B, 0x18, 0xD8, 0xD0, 0x58, 0xA2, 0xC6, 0xB6, 0x30, 0x5B, 0x54, 0x51, 0x15,
|
||||||
|
0xA2, 0xA4, 0x88, 0x89, 0x2A, 0xD0, 0x0A, 0x44, 0x29, 0x30, 0x44, 0x82, 0xD5, 0x34, 0x8C, 0x92,
|
||||||
|
0x91, 0x45, 0x61, 0xB2, 0xD6, 0x42, 0xD8, 0xD4, 0x95, 0xAD, 0x5E, 0x6D, 0x7B, 0x76, 0xD8, 0x66,
|
||||||
|
0xC5, 0x9E, 0x5B, 0x3D, 0xA9, 0xBC, 0xAC, 0x0A, 0x15, 0x98, 0xA6, 0x3D, 0x7B, 0x6D, 0x73, 0x7B,
|
||||||
|
0xA9, 0x39, 0x06, 0x6B, 0x51, 0x8D, 0x66, 0x48, 0x95, 0x49, 0xA3, 0x03, 0x52, 0xA8, 0x31, 0xA6,
|
||||||
|
0x40, 0x44, 0x6C, 0x6B, 0xA9, 0x3D, 0xBF, 0x6B, 0x9E, 0x31, 0x69, 0x45, 0x4B, 0x7A, 0xCB, 0x93,
|
||||||
|
0xD3, 0xBE, 0x1A, 0xDF, 0xD7, 0xC7, 0x22, 0x1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|
||||||
|
0x88, 0xF7, 0xBD, 0x5C, 0x1F, 0x7F, 0x87, 0x81, 0xFF, 0x3B, 0x38, 0xEC, 0xCB, 0xD2, 0xFE, 0xE1,
|
||||||
|
0xD2, 0x1E, 0xFC, 0xE9, 0x0A, 0x77, 0xF5, 0x5F, 0xFC, 0xB6, 0xDF, 0x17, 0x52, 0x86, 0x63, 0x1A,
|
||||||
|
0x49, 0x26, 0x23, 0x15, 0x76, 0xED, 0x54, 0xD0, 0x15, 0x45, 0x6D, 0x92, 0xDB, 0x4F, 0x41, 0x47,
|
||||||
|
0xFD, 0x00, 0x57, 0xD7, 0x03, 0x5A, 0xDB, 0xF8, 0x5B, 0xD9, 0x00, 0xA4, 0x8A, 0x04, 0x22, 0xCD,
|
||||||
|
0x36, 0x44, 0xC8, 0x24, 0xC6, 0xA1, 0x22, 0x36, 0x2B, 0x29, 0x12, 0xD6, 0x22, 0x89, 0x8C, 0xC9,
|
||||||
|
0x98, 0x49, 0x2C, 0xD0, 0x34, 0x2A, 0x52, 0x00, 0xE1, 0x5C, 0x02, 0xA7, 0xFC, 0x2A, 0x8A, 0x30,
|
||||||
|
0x02, 0xA9, 0x95, 0x20, 0x05, 0x60, 0x1E, 0xBA, 0x9C, 0x4B, 0x48, 0x14, 0x83, 0x10, 0x80, 0x74,
|
||||||
|
0x85, 0x5A, 0x45, 0x34, 0x23, 0x42, 0xAE, 0x84, 0x29, 0x12, 0x81, 0x41, 0xD0, 0x0B, 0xA5, 0x0D,
|
||||||
|
0xB6, 0xEC, 0xA1, 0x0D, 0x68, 0x2B, 0x73, 0x12, 0x58, 0x23, 0x6E, 0xA6, 0x8C, 0x8A, 0x5A, 0xB9,
|
||||||
|
0x63, 0x49, 0x49, 0xD3, 0x13, 0x2A, 0x2B, 0x86, 0x94, 0xC9, 0x6B, 0x97, 0x0A, 0xE3, 0x31, 0xD1,
|
||||||
|
0xDC, 0x5C, 0xAE, 0x9A, 0x35, 0x48, 0xD2, 0xD2, 0xED, 0x8D, 0x3A, 0x17, 0x41, 0x4B, 0xA2, 0x36,
|
||||||
|
0x00, 0xEE, 0xED, 0xA8, 0xDC, 0x97, 0x73, 0xA1, 0xAB, 0xA7, 0x59, 0x45, 0x49, 0x94, 0x6B, 0x43,
|
||||||
|
0x6C, 0x81, 0x6C, 0xA3, 0x40, 0x50, 0xB4, 0x0E, 0x85, 0x0A, 0x35, 0xAD, 0xBB, 0x36, 0xE5, 0x45,
|
||||||
|
0x44, 0xEB, 0xA9, 0x37, 0x0C, 0x5B, 0x9A, 0x4B, 0x6B, 0x9D, 0x33, 0xBB, 0x60, 0x8D, 0x70, 0x8A,
|
||||||
|
0x88, 0xDA, 0xC6, 0xB9, 0x53, 0xBB, 0x1C, 0xAC, 0x1B, 0x64, 0xD4, 0x6C, 0x72, 0xD7, 0x5D, 0xD6,
|
||||||
|
0x11, 0x42, 0x48, 0xC9, 0x6E, 0x6B, 0x98, 0xD0, 0x92, 0x6C, 0x96, 0x83, 0x21, 0x12, 0xD2, 0xC5,
|
||||||
|
0x30, 0x9A, 0xCD, 0x5D, 0x33, 0xAC, 0xE7, 0x76, 0x3B, 0xBB, 0x05, 0x69, 0xD1, 0xB6, 0x14, 0xAB,
|
||||||
|
0x60, 0x4E, 0x49, 0xDE, 0x51, 0x00, 0x14, 0x93, 0xB9, 0xCE, 0x40, 0x69, 0x03, 0xAF, 0x20, 0x52,
|
||||||
|
0x14, 0x40, 0x96, 0xCA, 0x98, 0x54, 0xC0, 0x92, 0xA9, 0x6C, 0xCA, 0x63, 0x6F, 0x23, 0xC6, 0x0C,
|
||||||
|
0x28, 0x66, 0xC2, 0x37, 0x9F, 0xEB, 0x40, 0x86, 0xA8, 0xFA, 0xE0, 0x1E, 0x50, 0xA0, 0xFE, 0xBE,
|
||||||
|
0x47, 0x73, 0xF9, 0xEB, 0x73, 0xAF, 0x72, 0x47, 0xAA, 0x04, 0xA0, 0x46, 0x91, 0x3A, 0xA4, 0x03,
|
||||||
|
0x42, 0x0B, 0x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0x69, 0x65, 0x91, 0xA0, 0x69,
|
||||||
|
0xA0, 0x97, 0x45, 0x00, 0x66, 0xCE, 0x1A, 0x00, 0xB5, 0xC1, 0x9A, 0x17, 0xBE, 0xB3, 0x78, 0x4D,
|
||||||
|
0x8F, 0x11, 0x27, 0x20, 0xD9, 0xC6, 0xE3, 0x54, 0xC3, 0x5C, 0x6D, 0x46, 0x72, 0x63, 0xB1, 0x93,
|
||||||
|
0x1D, 0x6E, 0xAC, 0xBD, 0x57, 0x16, 0xB4, 0x36, 0xB7, 0x2A, 0xB4, 0xF2, 0xD5, 0x9B, 0xAF, 0xB8,
|
||||||
|
0x91, 0xE0, 0x9B, 0x87, 0xC6, 0x77, 0x33, 0xD3, 0xD6, 0xE2, 0x52, 0xAD, 0x25, 0x95, 0x94, 0xD1,
|
||||||
|
0x51, 0x62, 0xC9, 0xA4, 0x61, 0xB1, 0x98, 0xB6, 0x36, 0x92, 0x9B, 0x18, 0x82, 0x23, 0x66, 0x94,
|
||||||
|
0x69, 0x48, 0x16, 0x31, 0x02, 0x92, 0x65, 0xA1, 0x53, 0x54, 0xC9, 0x09, 0xA3, 0x41, 0xB4, 0x14,
|
||||||
|
0x92, 0xD8, 0x33, 0x68, 0xC8, 0xB0, 0xC9, 0xB6, 0x35, 0x86, 0xB1, 0x51, 0x52, 0x65, 0x64, 0xC5,
|
||||||
|
0xA4, 0x05, 0x34, 0xD0, 0xD3, 0x0C, 0x4B, 0x56, 0xA6, 0x6A, 0x6A, 0xA6, 0xAC, 0x91, 0x90, 0x87,
|
||||||
|
0xC7, 0xE3, 0x6D, 0x05, 0xA2, 0xDB, 0xA1, 0xD2, 0xE6, 0xB7, 0x31, 0xB9, 0xC8, 0xE1, 0x74, 0x80,
|
||||||
|
0xA1, 0x35, 0x36, 0x97, 0x54, 0x31, 0x05, 0x21, 0x5E, 0x0D, 0xD3, 0xA6, 0x7B, 0xED, 0x9D, 0x74,
|
||||||
|
0xE3, 0xA7, 0x97, 0xAC, 0x8F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A3, 0x12, 0x26, 0xC1,
|
||||||
|
0x8A, 0xC4, 0x64, 0x8B, 0x44, 0x48, 0x96, 0x26, 0xEE, 0xB9, 0x62, 0x93, 0x48, 0x06, 0x42, 0x44,
|
||||||
|
0x26, 0x6D, 0x30, 0x11, 0x49, 0x34, 0x9B, 0x63, 0x31, 0x48, 0x42, 0xB0, 0xCD, 0x21, 0x8A, 0x28,
|
||||||
|
0xD2, 0x59, 0x22, 0x91, 0x81, 0x51, 0x46, 0x4D, 0xA3, 0x18, 0x29, 0x24, 0x4D, 0x5D, 0x0E, 0xEE,
|
||||||
|
0x9A, 0x19, 0xCA, 0xB8, 0x43, 0x0C, 0xC9, 0x60, 0x58, 0x8D, 0xAD, 0x1A, 0xD5, 0x10, 0x69, 0xD0,
|
||||||
|
0x03, 0xA4, 0xD1, 0xB1, 0x9B, 0x3A, 0xE5, 0xD2, 0x77, 0x75, 0x86, 0x45, 0xCD, 0xCA, 0x52, 0x6B,
|
||||||
|
0xBA, 0xE1, 0x14, 0xD0, 0xC7, 0x73, 0xB7, 0x13, 0xBB, 0x71, 0x9A, 0x13, 0x12, 0x24, 0x84, 0xA5,
|
||||||
|
0x14, 0x9A, 0x1A, 0x50, 0x95, 0x13, 0x24, 0x89, 0x8C, 0x88, 0x91, 0x83, 0x49, 0x15, 0x1B, 0x31,
|
||||||
|
0x88, 0xC8, 0xD3, 0x41, 0x04, 0x40, 0x62, 0xC5, 0x06, 0x48, 0x89, 0x28, 0x14, 0xA8, 0x8B, 0x32,
|
||||||
|
0x87, 0x3B, 0x2E, 0x5C, 0x72, 0xE2, 0x6E, 0xEA, 0x4C, 0xDB, 0x9D, 0x55, 0xB8, 0x72, 0x23, 0x9C,
|
||||||
|
0xB8, 0x6E, 0x3B, 0x89, 0xB0, 0xC1, 0x10, 0xD2, 0x0A, 0x29, 0xA3, 0x73, 0x8C, 0xDD, 0xD5, 0x74,
|
||||||
|
0xB0, 0x14, 0x94, 0x29, 0x19, 0xB3, 0x48, 0x3B, 0xAE, 0xC4, 0x8A, 0x22, 0xA8, 0xDB, 0x3B, 0x18,
|
||||||
|
0x05, 0xD6, 0x22, 0x18, 0xD9, 0xA0, 0xC3, 0x44, 0x14, 0x04, 0x11, 0x8C, 0xA1, 0x9A, 0x28, 0xC8,
|
||||||
|
0x73, 0xAA, 0xB3, 0x3B, 0xBB, 0x10, 0xC6, 0x58, 0xD4, 0xC3, 0x7F, 0x9D, 0xB6, 0x97, 0x3C, 0x95,
|
||||||
|
0xB9, 0xA6, 0x12, 0x24, 0xA8, 0x94, 0xC0, 0xAE, 0x6E, 0xF8, 0x6D, 0x6D, 0x57, 0xF7, 0x17, 0x72,
|
||||||
|
0x45, 0x38, 0x50, 0x90, 0xE5, 0x00, 0x24, 0xC9,
|
||||||
|
};
|
194
font.h
Normal file
194
font.h
Normal file
@ -0,0 +1,194 @@
|
|||||||
|
#define FONT_H 10
|
||||||
|
char font_data[] = {
|
||||||
|
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x03, 0xC7, 0x31, 0x0C, 0x02, 0x70, 0x04, 0x00, 0x00,
|
||||||
|
0x05, 0xCC, 0x74, 0x23, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x06, 0x00, 0x80, 0x19, 0xCC, 0xE0, 0x3F, 0xCC, 0xF0, 0x2F, 0xCC, 0x90, 0x09, 0x00, 0x00, 0x00,
|
||||||
|
0x06, 0x30, 0xD0, 0x3F, 0x33, 0xE1, 0x07, 0xF4, 0x12, 0x33, 0xFF, 0x00, 0x03, 0x00, 0x00, 0x00,
|
||||||
|
0x07, 0x2D, 0xCE, 0xCC, 0xE1, 0x1D, 0xC0, 0x03, 0x74, 0x4B, 0x33, 0xB3, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x06, 0x7D, 0x30, 0x0C, 0x13, 0xD0, 0x32, 0xB3, 0x33, 0x1C, 0x7D, 0x07, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x03, 0x4C, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x04, 0x34, 0x1D, 0x07, 0x03, 0x07, 0x1D, 0x34, 0x00, 0x00, 0x00,
|
||||||
|
0x04, 0x07, 0x1D, 0x34, 0x30, 0x34, 0x1D, 0x07, 0x00, 0x00, 0x00,
|
||||||
|
0x06, 0x44, 0xD0, 0x1C, 0x64, 0xF0, 0x3F, 0x64, 0xD0, 0x1C, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x06, 0x00, 0x00, 0x02, 0x30, 0xE0, 0x2F, 0x30, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0D, 0x03, 0x00,
|
||||||
|
0x05, 0x00, 0x00, 0x00, 0xC0, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x03, 0x00, 0x00, 0x00, 0x40, 0x70, 0x00, 0x00, 0x00,
|
||||||
|
0x06, 0x80, 0x02, 0x0C, 0xA0, 0x00, 0x03, 0x28, 0xC0, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x06, 0xF8, 0xE0, 0x39, 0x07, 0x33, 0x32, 0x03, 0xB3, 0x38, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x05, 0x30, 0xF0, 0x60, 0x03, 0x0C, 0x30, 0xC0, 0x40, 0x07, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x06, 0xFC, 0xB1, 0x34, 0x41, 0x03, 0x0A, 0x2C, 0x70, 0x00, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x06, 0xFC, 0x71, 0x34, 0x01, 0x03, 0x1E, 0x00, 0x33, 0x34, 0xFE, 0x01, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x06, 0xC0, 0x03, 0x37, 0x1C, 0x73, 0x34, 0xBF, 0x03, 0x30, 0x40, 0x03, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x06, 0xFF, 0x33, 0x00, 0x57, 0xE0, 0x2F, 0x00, 0x13, 0x30, 0xFE, 0x01, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x06, 0xF4, 0xD3, 0x00, 0x07, 0xF0, 0x1F, 0x03, 0x33, 0x34, 0xFD, 0x01, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x06, 0xFF, 0x07, 0x34, 0x80, 0x03, 0x0E, 0x38, 0xD0, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x06, 0xFC, 0xB1, 0x34, 0x03, 0xD3, 0x1F, 0x03, 0x73, 0x34, 0xFD, 0x01, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x06, 0xFC, 0xB1, 0x34, 0x03, 0xC3, 0x3F, 0x40, 0x23, 0x30, 0xFD, 0x01, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x03, 0x00, 0x70, 0x04, 0x40, 0x70, 0x00, 0x00, 0x00,
|
||||||
|
0x04, 0x00, 0x00, 0x1C, 0x04, 0x00, 0x0C, 0x0D, 0x03, 0x00, 0x00,
|
||||||
|
0x06, 0x00, 0x00, 0x00, 0xC0, 0xC3, 0x0B, 0x1B, 0xC0, 0x0B, 0xC0, 0x03, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x06, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x3F, 0x00, 0xF0, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x06, 0x00, 0x00, 0x00, 0x0F, 0x80, 0x0F, 0x90, 0x83, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x06, 0xFD, 0x71, 0x30, 0x81, 0x03, 0x0E, 0x34, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x08, 0xF8, 0x0F, 0x1D, 0x30, 0xE7, 0x37, 0x73, 0x1C, 0xE3, 0x2F, 0x07, 0x00, 0xFD, 0x1B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x06, 0x74, 0xD0, 0x1D, 0x47, 0x33, 0x30, 0xFF, 0x33, 0x30, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x06, 0xBF, 0x30, 0x38, 0x43, 0xF3, 0x1F, 0x43, 0x33, 0x34, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x06, 0xF4, 0xD1, 0x34, 0x03, 0x31, 0x00, 0x03, 0x70, 0x34, 0xFD, 0x01, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x06, 0x7F, 0x30, 0x1D, 0x43, 0x33, 0x30, 0x03, 0x33, 0x34, 0xFF, 0x01, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x06, 0xFF, 0x32, 0x00, 0x03, 0xF0, 0x0B, 0x03, 0x30, 0x10, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x06, 0xFF, 0x33, 0x10, 0x03, 0xF0, 0x0B, 0x03, 0x30, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x06, 0xF4, 0xD1, 0x34, 0x03, 0x30, 0x3E, 0x03, 0x73, 0x34, 0xFD, 0x01, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x06, 0x47, 0x33, 0x30, 0x03, 0xF3, 0x3F, 0x03, 0x33, 0x30, 0x47, 0x03, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x04, 0x1D, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1D, 0x00, 0x00, 0x00,
|
||||||
|
0x06, 0xD0, 0x01, 0x0C, 0xC0, 0x00, 0x0C, 0xC0, 0x10, 0x0D, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x07, 0x47, 0xC3, 0x34, 0x70, 0x03, 0xBC, 0x00, 0xB3, 0xC0, 0xB0, 0x70, 0xB4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x06, 0x07, 0x30, 0x00, 0x03, 0x30, 0x00, 0x03, 0x30, 0x10, 0xFF, 0x02, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x08, 0x03, 0x30, 0x1F, 0x3D, 0x7B, 0x3B, 0xE3, 0x32, 0x83, 0x30, 0x03, 0x30, 0x03, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x07, 0x07, 0xCD, 0x03, 0x73, 0xC3, 0x8C, 0x32, 0xC3, 0xCD, 0xC0, 0x33, 0xD0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x07, 0xF4, 0x41, 0xC7, 0x71, 0xD0, 0x0C, 0x30, 0x03, 0xCD, 0xD1, 0xD1, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x06, 0x7F, 0x30, 0x1D, 0x43, 0x73, 0x34, 0xFF, 0x31, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x07, 0xF4, 0x41, 0xD3, 0x71, 0xD0, 0x0C, 0x30, 0xC3, 0xCD, 0xD1, 0xD1, 0xDF, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x06, 0xFF, 0x31, 0x34, 0x03, 0xF3, 0x0F, 0xD7, 0x30, 0x34, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x06, 0xFC, 0xB1, 0x31, 0x07, 0xD0, 0x0F, 0x90, 0x23, 0x34, 0xFE, 0x01, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x06, 0xFF, 0x13, 0x13, 0x30, 0x00, 0x03, 0x30, 0x00, 0x03, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x07, 0x03, 0xCC, 0x00, 0x33, 0xC0, 0x0C, 0x30, 0x03, 0xCD, 0xD2, 0xD1, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x06, 0x03, 0x33, 0x30, 0x03, 0xB3, 0x38, 0xCD, 0xC1, 0x0D, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x08, 0x03, 0x30, 0x43, 0x30, 0xC7, 0x34, 0xCD, 0x1C, 0xED, 0x1E, 0x2C, 0x0E, 0x0C, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x07, 0x03, 0x4C, 0xC3, 0x81, 0x3B, 0xD0, 0x03, 0xDC, 0x42, 0xC3, 0x31, 0xC0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x06, 0x03, 0xB3, 0x38, 0xDC, 0x40, 0x07, 0x30, 0x00, 0x03, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x07, 0xFF, 0x0F, 0xD0, 0x02, 0x2C, 0xC0, 0x02, 0x2D, 0xC0, 0x06, 0xF0, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x04, 0x2F, 0x03, 0x03, 0x03, 0x03, 0x03, 0x2F, 0x00, 0x00, 0x00,
|
||||||
|
0x05, 0x03, 0x28, 0xC0, 0x00, 0x0A, 0x30, 0x80, 0x02, 0x0C, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x04, 0x3E, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3E, 0x00, 0x00, 0x00,
|
||||||
|
0x04, 0x1D, 0x37, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x03, 0x83, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x05, 0x00, 0x00, 0xD0, 0x47, 0x30, 0xFC, 0x0C, 0xD3, 0x1F, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x05, 0x07, 0x0C, 0xF0, 0xC7, 0x35, 0xC3, 0x0C, 0xF3, 0x07, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x05, 0x00, 0x00, 0xD0, 0xC3, 0x25, 0x03, 0x4C, 0xD2, 0x03, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x05, 0xD0, 0x00, 0x83, 0x8F, 0x33, 0xC3, 0x1C, 0xD3, 0x1F, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x05, 0x00, 0x00, 0xD0, 0xC7, 0x30, 0xBF, 0x0C, 0xD0, 0x0B, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x04, 0x3D, 0x07, 0x03, 0x2F, 0x03, 0x03, 0x07, 0x00, 0x00, 0x00,
|
||||||
|
0x05, 0x00, 0x00, 0xC0, 0xCB, 0x32, 0xC3, 0xF4, 0x03, 0x4C, 0x30, 0x7E, 0x00, 0x00,
|
||||||
|
0x05, 0x03, 0x0C, 0xF0, 0xC7, 0x39, 0xC3, 0x0C, 0x73, 0x1C, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x04, 0x04, 0x1C, 0x00, 0x0D, 0x0C, 0x0C, 0x1D, 0x00, 0x00, 0x00,
|
||||||
|
0x04, 0x00, 0x30, 0x00, 0x34, 0x30, 0x30, 0x30, 0x30, 0x1E, 0x00,
|
||||||
|
0x05, 0x03, 0x0C, 0x31, 0xCE, 0x0E, 0x1F, 0xCC, 0x31, 0x1C, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x47, 0x3D, 0x00, 0x00, 0x00,
|
||||||
|
0x06, 0x00, 0x00, 0x00, 0x9B, 0x71, 0x37, 0x33, 0x33, 0x32, 0x43, 0x03, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x05, 0x00, 0x00, 0xF0, 0xC7, 0x31, 0xC3, 0x0C, 0x33, 0x0D, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x05, 0x00, 0x00, 0xD0, 0xC7, 0x31, 0xC3, 0x4C, 0xD3, 0x07, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x05, 0x00, 0x00, 0xF0, 0xC7, 0x31, 0xC3, 0x4C, 0xF3, 0xC7, 0x00, 0x03, 0x00, 0x00,
|
||||||
|
0x05, 0x00, 0x00, 0xD0, 0xDF, 0x31, 0xC3, 0x4C, 0xD3, 0x0F, 0x30, 0xC0, 0x00, 0x05,
|
||||||
|
0x03, 0x00, 0x30, 0x7F, 0xC7, 0x30, 0x00, 0x00, 0x00,
|
||||||
|
0x05, 0x00, 0x00, 0xC0, 0xC7, 0x10, 0x3C, 0x04, 0xF3, 0x03, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x04, 0x0C, 0x0C, 0x3F, 0x0C, 0x0C, 0x1C, 0x74, 0x00, 0x00, 0x00,
|
||||||
|
0x05, 0x00, 0x00, 0x70, 0xDC, 0x30, 0xC3, 0x4C, 0xD3, 0x1F, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x05, 0x00, 0x00, 0x30, 0xCC, 0x30, 0xD3, 0xDC, 0xC2, 0x02, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x06, 0x00, 0x00, 0x00, 0x47, 0x33, 0x32, 0x33, 0x73, 0x37, 0xCD, 0x01, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x05, 0x00, 0x00, 0x30, 0xCD, 0x32, 0x7D, 0x8C, 0x73, 0x0C, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x05, 0x00, 0x00, 0x30, 0xCC, 0x30, 0xC7, 0x74, 0x43, 0x07, 0x0C, 0x1F, 0x00, 0x00,
|
||||||
|
0x05, 0x00, 0x00, 0xF0, 0x4F, 0x2C, 0x2C, 0x2C, 0xF1, 0x0F, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x04, 0x38, 0x0C, 0x0C, 0x03, 0x0C, 0x0C, 0x38, 0x00, 0x00, 0x00,
|
||||||
|
0x02, 0x32, 0x33, 0x33, 0x13, 0x00,
|
||||||
|
0x04, 0x0B, 0x0C, 0x0C, 0x30, 0x0C, 0x0C, 0x0B, 0x00, 0x00, 0x00,
|
||||||
|
0x06, 0x00, 0x00, 0x00, 0x1D, 0x72, 0x37, 0xD2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x04, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x08, 0x07, 0x00, 0x1F, 0x00, 0x7F, 0x00, 0xFF, 0x01, 0xFF, 0x07, 0xFF, 0x1F, 0xFF, 0x7F, 0xFF, 0x1B, 0xBF, 0x01, 0x1B, 0x00,
|
||||||
|
0x0C, 0x00, 0x40, 0xFF, 0x00, 0x00, 0xF8, 0xF0, 0x3F, 0xEE, 0x2C, 0x30, 0xCB, 0x0B, 0x30, 0x42, 0xC3, 0x33, 0x00, 0x03, 0x30, 0x00, 0xF3, 0x33, 0x00, 0x03, 0x30, 0x00, 0xFF, 0x3F, 0x00,
|
||||||
|
0x0C, 0xC2, 0x00, 0x00, 0xCB, 0x00, 0x00, 0xEE, 0xC0, 0xFF, 0xF8, 0xB0, 0xC0, 0xFF, 0x2C, 0xC0, 0x00, 0x0C, 0xCF, 0x00, 0x0C, 0xC0, 0x00, 0xCC, 0xCF, 0x00, 0x0C, 0xC0, 0x00, 0xFC, 0xFF,
|
||||||
|
0x0A, 0x00, 0x00, 0x0D, 0x00, 0x70, 0x00, 0x00, 0xF3, 0xFF, 0xD3, 0x03, 0xE0, 0x3C, 0x3F, 0x38, 0x03, 0xD0, 0x33, 0xFF,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 0x07, 0xB0, 0xC5, 0x00, 0x17, 0x0C, 0x70, 0xD0, 0x00, 0x0C, 0x03, 0xBC, 0xEF, 0xB3, 0x11, 0xE0, 0x07, 0x05, 0x3C, 0x52, 0xC8,
|
||||||
|
0x0A, 0x00, 0x00, 0x00, 0xF0, 0x00, 0xC0, 0x3F, 0x00, 0xFC, 0x03, 0xC0, 0x3F, 0x00, 0xF0, 0x00, 0xC0, 0x30, 0xC0, 0xFF, 0x3F, 0xFC, 0xFF, 0xC3, 0xFF, 0x3F,
|
||||||
|
0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x00, 0xFC, 0xFF, 0x0F, 0xFC, 0xFF, 0x3F, 0xFC, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x06, 0x00, 0x00, 0x00, 0xB8, 0xE0, 0x2F, 0xFF, 0xE3, 0x2F, 0xB8, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x0A, 0xD0, 0x7F, 0x80, 0xFF, 0x2F, 0xFD, 0xFF, 0xF7, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDF, 0xFF, 0x7F, 0xF8, 0xFF, 0x02, 0xFD, 0x07,
|
||||||
|
0x0A, 0x40, 0x01, 0x00, 0x02, 0x00, 0xC8, 0x07, 0x10, 0xC3, 0x00, 0x31, 0x0D, 0x00, 0xFD, 0x01, 0x00, 0x74, 0x00, 0x00, 0x1D, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x0A, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0xF0, 0xF0, 0x00, 0x0F, 0x0F, 0xF0, 0xF0, 0x00, 0x0F, 0x0F, 0xF0, 0xF0, 0x00, 0x0F, 0x0F, 0xF0, 0xF0, 0x00, 0x00, 0x00,
|
||||||
|
0x0A, 0x40, 0x05, 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E, 0xE0, 0xBF, 0x80, 0xFF, 0xAA, 0xFE, 0xFF, 0xE2, 0xFF, 0x02, 0x02, 0x00, 0x00,
|
||||||
|
0x09, 0x00, 0x80, 0x04, 0xD0, 0xE2, 0xFF, 0x02, 0x00, 0x00, 0xFF, 0x6F, 0x00, 0x40, 0xE6, 0xAF, 0x50, 0x00, 0x09, 0x00, 0x20, 0x00, 0x64, 0x00,
|
||||||
|
0x09, 0xE0, 0x3F, 0x70, 0x60, 0x63, 0xC0, 0xE4, 0x80, 0xC2, 0x03, 0x07, 0x0F, 0x1E, 0x6C, 0xFF, 0x27, 0xFF, 0x3F, 0xE0, 0x2F, 0x00, 0x00, 0x00,
|
||||||
|
0x09, 0x44, 0x44, 0x00, 0x12, 0x41, 0x88, 0x04, 0x21, 0x21, 0x84, 0x48, 0x20, 0x23, 0xC2, 0xCC, 0x08, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x09, 0x00, 0x1D, 0x00, 0x1D, 0x00, 0x78, 0x00, 0xB4, 0x07, 0xF0, 0x2F, 0xC0, 0xFB, 0x00, 0xBE, 0x02, 0xF4, 0x07, 0xFD, 0xFF, 0x01, 0x00, 0x00,
|
||||||
|
0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x01, 0x00, 0x19, 0x00, 0xA8, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x3F, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x00, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0xFC, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x3F, 0x00, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0xF0, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x09, 0x00, 0x00, 0xFC, 0xFF, 0x3F, 0x00, 0xF0, 0xDC, 0xCB, 0x03, 0x00, 0xFF, 0xFF, 0x4F, 0x07, 0x40, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x09, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0x0F, 0xFF, 0x3F, 0xFC, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x0A, 0xFF, 0xFF, 0x3F, 0x00, 0xC0, 0x07, 0x00, 0xBD, 0x02, 0xE8, 0xB3, 0xE0, 0x3C, 0xAC, 0xC3, 0x03, 0x0F, 0x3C, 0x00, 0xC0, 0x03, 0x00, 0xFC, 0xFF, 0xFF,
|
||||||
|
0x0B, 0xC0, 0xC8, 0xC0, 0x91, 0x1B, 0xCD, 0x36, 0xE7, 0x00, 0x47, 0x03, 0xA7, 0x80, 0x36, 0xFD, 0xFF, 0xC1, 0x9B, 0xF9, 0xB8, 0xB8, 0xB8, 0xB7, 0x99, 0xF7, 0xFF, 0xFF, 0x0F,
|
||||||
|
0x0B, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0xF0, 0x03, 0x00, 0xFC, 0x00, 0xC0, 0xFF, 0x00, 0xF0, 0x3F, 0x00, 0xFF, 0x3F, 0xF0, 0xFF, 0x3F, 0xFC, 0xFF, 0xCF, 0xFF, 0xFF, 0x0F,
|
||||||
|
0x08, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x1F, 0xCB, 0x30, 0xC3, 0x3F, 0xC7, 0x00, 0x7E, 0x2F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x0A, 0xFC, 0xFF, 0xC3, 0xFF, 0x3F, 0x0C, 0x00, 0xC3, 0xFC, 0x33, 0x0C, 0x24, 0xC3, 0xC0, 0x31, 0x0C, 0x06, 0xC3, 0x30, 0x30, 0x0C, 0x00, 0xC3, 0xFF, 0x3F,
|
||||||
|
0x0A, 0xFF, 0x3F, 0x30, 0x00, 0x03, 0xC3, 0x30, 0x30, 0x3F, 0xFF, 0xFF, 0x3F, 0x3C, 0x00, 0xFF, 0xFF, 0xFF, 0x0C, 0x0C, 0xC3, 0xC0, 0x00, 0x0C, 0xFC, 0xFF,
|
||||||
|
0x0A, 0x00, 0x00, 0xC0, 0xFF, 0x00, 0xFC, 0x0F, 0xC0, 0xFF, 0x00, 0xFC, 0x0F, 0xC0, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x03, 0x00, 0x3C, 0x00, 0xC0, 0x03, 0xF0, 0x3F, 0x00, 0xFF, 0x03, 0x00, 0x00,
|
||||||
|
0x09, 0xE0, 0x2F, 0xF0, 0xFF, 0xE3, 0xB8, 0xEC, 0x9B, 0xF9, 0xBF, 0xF8, 0xBF, 0x99, 0xEF, 0xB8, 0x2C, 0xFF, 0x3F, 0xE0, 0x2F, 0x00, 0x00, 0x00,
|
||||||
|
0x04, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
|
||||||
|
0x03, 0x87, 0x87, 0xC3, 0x30, 0x0C, 0xE3, 0xDE, 0x01,
|
||||||
|
0x03, 0x74, 0xBB, 0x0C, 0xC3, 0x30, 0x2C, 0x2D, 0x0D,
|
||||||
|
0x05, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x0F,
|
||||||
|
0x05, 0x00, 0x00, 0xD0, 0xC7, 0x34, 0xC3, 0x0C, 0x73, 0x4C, 0x1F, 0x00, 0x00, 0x00,
|
||||||
|
0x05, 0x00, 0x00, 0x00, 0x03, 0x0F, 0x39, 0xC0, 0x00, 0x43, 0x2F, 0x00, 0x00, 0x00,
|
||||||
|
0x05, 0x00, 0x00, 0xD0, 0x87, 0x30, 0x60, 0x60, 0x60, 0xC0, 0x3F, 0x00, 0x00, 0x00,
|
||||||
|
0x05, 0x00, 0x00, 0xD0, 0x87, 0x30, 0xB8, 0x00, 0x23, 0x4C, 0x1F, 0x00, 0x00, 0x00,
|
||||||
|
0x05, 0x00, 0x00, 0x00, 0x0E, 0x36, 0xC6, 0xFC, 0x03, 0x0C, 0x30, 0x00, 0x00, 0x00,
|
||||||
|
0x05, 0x00, 0x00, 0xF0, 0xCB, 0x00, 0x7F, 0x40, 0x13, 0x8C, 0x1F, 0x00, 0x00, 0x00,
|
||||||
|
0x05, 0x00, 0x00, 0xD0, 0xCB, 0x10, 0x2F, 0x4C, 0x33, 0x4C, 0x1F, 0x00, 0x00, 0x00,
|
||||||
|
0x05, 0x00, 0x00, 0xF0, 0x0F, 0x30, 0x60, 0x60, 0xC0, 0x00, 0x03, 0x00, 0x00, 0x00,
|
||||||
|
0x05, 0x00, 0x00, 0xD0, 0xC7, 0x30, 0x7D, 0x4C, 0x33, 0x4C, 0x1F, 0x00, 0x00, 0x00,
|
||||||
|
0x05, 0x00, 0x00, 0xD0, 0xC7, 0x30, 0xC6, 0xE0, 0x03, 0x8C, 0x1F, 0x00, 0x00, 0x00,
|
||||||
|
0x04, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00,
|
||||||
|
0x03, 0xC0, 0xF0, 0x3C, 0xCF, 0xF3, 0x3C, 0x03, 0x00,
|
||||||
|
0x03, 0x00, 0xCC, 0xF3, 0x3C, 0xCF, 0xF3, 0x30, 0x00,
|
||||||
|
0x05, 0x00, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0x00,
|
||||||
|
};
|
||||||
|
short font_ptrs[] = {
|
||||||
|
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||||
|
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||||
|
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||||
|
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||||
|
0x0000, 0x000E, 0x0017, 0x0025, 0x0035, 0x0045, 0x0058, 0x0068,
|
||||||
|
0x0071, 0x007C, 0x0087, 0x0097, 0x00A7, 0x00B2, 0x00C0, 0x00C9,
|
||||||
|
0x00D9, 0x00E9, 0x00F7, 0x0107, 0x0117, 0x0127, 0x0137, 0x0147,
|
||||||
|
0x0157, 0x0167, 0x0177, 0x0180, 0x018B, 0x019B, 0x01AB, 0x01BB,
|
||||||
|
0x01CB, 0x01E0, 0x01F0, 0x0200, 0x0210, 0x0220, 0x0230, 0x0240,
|
||||||
|
0x0250, 0x0260, 0x026B, 0x027B, 0x028E, 0x029E, 0x02B3, 0x02C6,
|
||||||
|
0x02D9, 0x02E9, 0x02FC, 0x030C, 0x031C, 0x032C, 0x033F, 0x034F,
|
||||||
|
0x0364, 0x0377, 0x0387, 0x039A, 0x03A5, 0x03B3, 0x03BE, 0x03C9,
|
||||||
|
0x03D9, 0x03E2, 0x03F0, 0x03FE, 0x040C, 0x041A, 0x0428, 0x0433,
|
||||||
|
0x0441, 0x044F, 0x045A, 0x0465, 0x0473, 0x047E, 0x048E, 0x049C,
|
||||||
|
0x04AA, 0x04B8, 0x04C6, 0x04CF, 0x04DD, 0x04E8, 0x04F6, 0x0504,
|
||||||
|
0x0514, 0x0522, 0x0530, 0x053E, 0x0549, 0x054F, 0x055A, 0x056A,
|
||||||
|
0x0575, 0x058A, 0x05A9, 0x05C8, 0x05E2, 0x0601, 0x061B, 0x0635,
|
||||||
|
0x064F, 0x0669, 0x0683, 0x069D, 0x06B7, 0x06D6, 0x06E6, 0x0700,
|
||||||
|
0x071A, 0x0734, 0x074E, 0x0763, 0x0780, 0x079D, 0x07BC, 0x07DB,
|
||||||
|
0x07F3, 0x080B, 0x0823, 0x083B, 0x0853, 0x086B, 0x0883, 0x089B,
|
||||||
|
0x08B3, 0x08CB, 0x08E3, 0x08FD, 0x091A, 0x0937, 0x094C, 0x0966,
|
||||||
|
0x0980, 0x099A, 0x09B4, 0x09CC, 0x09D7, 0x09E0, 0x09E9, 0x09F7,
|
||||||
|
0x0A05, 0x0A13, 0x0A21, 0x0A2F, 0x0A3D, 0x0A4B, 0x0A59, 0x0A67,
|
||||||
|
0x0A75, 0x0A83, 0x0A8E, 0x0A97, 0x0AA0, 0x0AAE, 0x0AAE, 0x0AAE,
|
||||||
|
0x0AAE, 0x0AAE, 0x0AAE, 0x0AAE, 0x0AAE, 0x0AAE, 0x0AAE, 0x0AAE,
|
||||||
|
0x0AAE, 0x0AAE, 0x0AAE, 0x0AAE, 0x0AAE, 0x0AAE, 0x0AAE, 0x0AAE,
|
||||||
|
0x0AAE, 0x0AAE, 0x0AAE, 0x0AAE, 0x0AAE, 0x0AAE, 0x0AAE, 0x0AAE,
|
||||||
|
0x0AAE, 0x0AAE, 0x0AAE, 0x0AAE, 0x0AAE, 0x0AAE, 0x0AAE, 0x0AAE,
|
||||||
|
0x0AAE, 0x0AAE, 0x0AAE, 0x0AAE, 0x0AAE, 0x0AAE, 0x0AAE, 0x0AAE,
|
||||||
|
0x0AAE, 0x0AAE, 0x0AAE, 0x0AAE, 0x0AAE, 0x0AAE, 0x0AAE, 0x0AAE,
|
||||||
|
0x0AAE, 0x0AAE, 0x0AAE, 0x0AAE, 0x0AAE, 0x0AAE, 0x0AAE, 0x0AAE,
|
||||||
|
0x0AAE, 0x0AAE, 0x0AAE, 0x0AAE, 0x0AAE, 0x0AAE, 0x0AAE, 0x0AAE,
|
||||||
|
};
|
5
font/Makefile
Normal file
5
font/Makefile
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
editor: editor.c
|
||||||
|
gcc -oeditor -DSCALE=2 editor.c -lSDL -lm -O3 -ffast-math -march=k8 -Wall -std=c99
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f editor packer
|
284
font/editor.c
Normal file
284
font/editor.c
Normal file
@ -0,0 +1,284 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <math.h>
|
||||||
|
#include <SDL/SDL.h>
|
||||||
|
|
||||||
|
#define CELLW 12
|
||||||
|
#define CELLH 10
|
||||||
|
|
||||||
|
#define XRES 800
|
||||||
|
#define YRES 600
|
||||||
|
|
||||||
|
char xsize=CELLW, ysize=CELLH;
|
||||||
|
char base=7, top=2;
|
||||||
|
char font[256][CELLH][CELLW];
|
||||||
|
char width[256];
|
||||||
|
|
||||||
|
void blendpixel(unsigned *vid, int x, int y, int r, int g, int b, int a)
|
||||||
|
{
|
||||||
|
int t;
|
||||||
|
if(x<0 || y<0 || x>=XRES || y>=YRES)
|
||||||
|
return;
|
||||||
|
if(a!=255) {
|
||||||
|
t = vid[y*XRES+x];
|
||||||
|
r = (a*r + (255-a)*((t>>16)&255)) >> 8;
|
||||||
|
g = (a*g + (255-a)*((t>>8)&255)) >> 8;
|
||||||
|
b = (a*b + (255-a)*(t&255)) >> 8;
|
||||||
|
}
|
||||||
|
vid[y*XRES+x] = (r<<16)|(g<<8)|b;
|
||||||
|
}
|
||||||
|
|
||||||
|
int drawchar(unsigned *vid, int x, int y, int c, int r, int g, int b)
|
||||||
|
{
|
||||||
|
int i, j;
|
||||||
|
for(j=0; j<CELLH; j++)
|
||||||
|
for(i=0; i<width[c]; i++)
|
||||||
|
blendpixel(vid, x+i, y+j, r, g, b, (font[c][j][i]*255)/3);
|
||||||
|
return x + width[c];
|
||||||
|
}
|
||||||
|
|
||||||
|
int drawtext(unsigned *vid, int x, int y, char *s, int r, int g, int b)
|
||||||
|
{
|
||||||
|
for(;*s;s++)
|
||||||
|
x = drawchar(vid, x, y, *s, r, g, b);
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
void drawline(unsigned *vid, int x1, int y1, int x2, int y2, int r, int g, int b, int a)
|
||||||
|
{
|
||||||
|
int cp=abs(y2-y1)>abs(x2-x1), x, y, dx, dy, sy;
|
||||||
|
float e, de;
|
||||||
|
if(cp) {
|
||||||
|
y = x1;
|
||||||
|
x1 = y1;
|
||||||
|
y1 = y;
|
||||||
|
y = x2;
|
||||||
|
x2 = y2;
|
||||||
|
y2 = y;
|
||||||
|
}
|
||||||
|
if(x1 > x2) {
|
||||||
|
y = x1;
|
||||||
|
x1 = x2;
|
||||||
|
x2 = y;
|
||||||
|
y = y1;
|
||||||
|
y1 = y2;
|
||||||
|
y2 = y;
|
||||||
|
}
|
||||||
|
dx = x2 - x1;
|
||||||
|
dy = abs(y2 - y1);
|
||||||
|
e = 0.0f;
|
||||||
|
de = dy/(float)dx;
|
||||||
|
y = y1;
|
||||||
|
sy = (y1<y2) ? 1 : -1;
|
||||||
|
for(x=x1; x<=x2; x++) {
|
||||||
|
if(cp)
|
||||||
|
blendpixel(vid, y, x, r, g, b, a);
|
||||||
|
else
|
||||||
|
blendpixel(vid, x, y, r, g, b, a);
|
||||||
|
e += de;
|
||||||
|
if(e >= 0.5f) {
|
||||||
|
y += sy;
|
||||||
|
e -= 1.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void drawcell(unsigned *vid, int i, int j, int c, int m)
|
||||||
|
{
|
||||||
|
int x,y,x0=i*32+64,y0=j*32+64;
|
||||||
|
for(y=1;y<32;y++)
|
||||||
|
for(x=1;x<32;x++)
|
||||||
|
blendpixel(vid, x0+x, y0+y, 127*m, 127*m, 127*m, c);
|
||||||
|
for(x=0;x<32;x+=2) {
|
||||||
|
if(!j)
|
||||||
|
blendpixel(vid, x0+x, y0, 64*m, 64*m, 64*m, 255);
|
||||||
|
if(!i)
|
||||||
|
blendpixel(vid, x0, y0+x, 64*m, 64*m, 64*m, 255);
|
||||||
|
blendpixel(vid, x0+x, y0+32, 64*m, 64*m, 64*m, 255);
|
||||||
|
blendpixel(vid, x0+32, y0+x, 64*m, 64*m, 64*m, 255);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************************************
|
||||||
|
* SDL OUTPUT *
|
||||||
|
***********************************************************/
|
||||||
|
|
||||||
|
SDL_Surface *sdl_scrn;
|
||||||
|
int sdl_key;
|
||||||
|
void sdl_open(void)
|
||||||
|
{
|
||||||
|
if(SDL_Init(SDL_INIT_VIDEO)<0) {
|
||||||
|
fprintf(stderr, "Initializing SDL: %s\n", SDL_GetError());
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
atexit(SDL_Quit);
|
||||||
|
sdl_scrn=SDL_SetVideoMode(XRES*SCALE,YRES*SCALE + 40*SCALE,32,SDL_SWSURFACE);
|
||||||
|
if(!sdl_scrn) {
|
||||||
|
fprintf(stderr, "Creating window: %s\n", SDL_GetError());
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void sdl_blit(int x, int y, int w, int h, unsigned int *src, int pitch)
|
||||||
|
{
|
||||||
|
unsigned *dst,i,j,k;
|
||||||
|
if(SDL_MUSTLOCK(sdl_scrn))
|
||||||
|
if(SDL_LockSurface(sdl_scrn)<0)
|
||||||
|
return;
|
||||||
|
dst=(unsigned *)sdl_scrn->pixels+y*sdl_scrn->pitch/4+x;
|
||||||
|
for(j=0;j<h;j++) {
|
||||||
|
for(k=0;k<SCALE;k++) {
|
||||||
|
for(i=0;i<w*SCALE;i++)
|
||||||
|
dst[i]=src[i/SCALE];
|
||||||
|
dst+=sdl_scrn->pitch/4;
|
||||||
|
}
|
||||||
|
src+=pitch/4;
|
||||||
|
}
|
||||||
|
if(SDL_MUSTLOCK(sdl_scrn))
|
||||||
|
SDL_UnlockSurface(sdl_scrn);
|
||||||
|
SDL_UpdateRect(sdl_scrn,0,0,0,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int frame_idx=0;
|
||||||
|
void dump_frame(unsigned int *src, int w, int h, int pitch)
|
||||||
|
{
|
||||||
|
char frame_name[32];
|
||||||
|
unsigned j,i,c;
|
||||||
|
FILE *f;
|
||||||
|
sprintf(frame_name,"frame%04d.ppm",frame_idx);
|
||||||
|
f=fopen(frame_name,"w");
|
||||||
|
fprintf(f,"P6\n%d %d\n255\n",w,h);
|
||||||
|
for(j=0;j<h;j++) {
|
||||||
|
for(i=0;i<w;i++) {
|
||||||
|
c=((src[i]&0xFF0000)>>16)|(src[i]&0x00FF00)|((src[i]&0x0000FF)<<16);
|
||||||
|
fwrite(&c,3,1,f);
|
||||||
|
}
|
||||||
|
src+=pitch/4;
|
||||||
|
}
|
||||||
|
fclose(f);
|
||||||
|
frame_idx++;
|
||||||
|
}
|
||||||
|
|
||||||
|
int sdl_poll(void)
|
||||||
|
{
|
||||||
|
SDL_Event event;
|
||||||
|
sdl_key=0;
|
||||||
|
while(SDL_PollEvent(&event)) {
|
||||||
|
switch (event.type) {
|
||||||
|
case SDL_KEYDOWN:
|
||||||
|
sdl_key=event.key.keysym.sym;
|
||||||
|
break;
|
||||||
|
case SDL_QUIT:
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************************************
|
||||||
|
* MAIN PROGRAM *
|
||||||
|
***********************************************************/
|
||||||
|
|
||||||
|
char *tag = "(c) 2008 Stanislaw Skowronek";
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
unsigned *vid_buf = calloc(XRES*YRES, sizeof(unsigned));
|
||||||
|
int x, y, b = 0, lb, c = 0xA0, i, j, dc = 0;
|
||||||
|
int mode = 0;
|
||||||
|
FILE *f;
|
||||||
|
|
||||||
|
f = fopen("font.bin", "r");
|
||||||
|
if(f) {
|
||||||
|
fread(&xsize, 1, 1, f);
|
||||||
|
fread(&ysize, 1, 1, f);
|
||||||
|
fread(&base, 1, 1, f);
|
||||||
|
fread(&top, 1, 1, f);
|
||||||
|
fread(width, 1, 256, f);
|
||||||
|
fread(font, CELLW*CELLH, 256, f);
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
|
|
||||||
|
sdl_open();
|
||||||
|
while(!sdl_poll()) {
|
||||||
|
if(sdl_key=='q' || sdl_key==SDLK_ESCAPE)
|
||||||
|
break;
|
||||||
|
if(sdl_key==' ' || sdl_key=='=') {
|
||||||
|
c++;
|
||||||
|
printf("Current: %02X '%c'\n", c, c);
|
||||||
|
}
|
||||||
|
if(sdl_key=='\b' || sdl_key=='-') {
|
||||||
|
c--;
|
||||||
|
printf("Current: %02X '%c'\n", c, c);
|
||||||
|
}
|
||||||
|
|
||||||
|
lb = b;
|
||||||
|
b = SDL_GetMouseState(&x, &y);
|
||||||
|
if(b) {
|
||||||
|
x /= SCALE;
|
||||||
|
y /= SCALE;
|
||||||
|
}
|
||||||
|
|
||||||
|
i = x/32-2;
|
||||||
|
j = y/32-2;
|
||||||
|
if(!lb && b && (i<0 || i>=CELLW)) {
|
||||||
|
if(abs(j-base) < abs(j-top))
|
||||||
|
mode = 2; // BASE
|
||||||
|
else
|
||||||
|
mode = 3; // TOP
|
||||||
|
} else if(!lb && b && (j<0 || j>=CELLH))
|
||||||
|
mode = 4; // LEFT
|
||||||
|
else if(!lb && b) {
|
||||||
|
mode = 1; // DRAW
|
||||||
|
if(b==1)
|
||||||
|
dc = (font[c][j][i]+3)%4;
|
||||||
|
else
|
||||||
|
dc = (font[c][j][i]+1)%4;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(b)
|
||||||
|
switch(mode) {
|
||||||
|
case 1:
|
||||||
|
if(i>=0 && j>=0 && i<CELLW && j<CELLH)
|
||||||
|
font[c][j][i] = dc;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
base = j;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
top = j;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
width[c] = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(vid_buf, 0, XRES*YRES*4);
|
||||||
|
for(j=0; j<CELLH; j++)
|
||||||
|
for(i=0; i<CELLW; i++)
|
||||||
|
drawcell(vid_buf, i, j, (font[c][j][i]*255)/3, i>=width[c]?1:2);
|
||||||
|
drawline(vid_buf, 32, 64+base*32, 128+32*CELLW, 64+base*32, 128, 255, 128, 255);
|
||||||
|
drawline(vid_buf, 32, 64+top*32, 128+32*CELLW, 64+top*32, 128, 128, 255, 255);
|
||||||
|
drawline(vid_buf, 64+width[c]*32, 32, 64+width[c]*32, 128+32*CELLH, 255, 128, 128, 255);
|
||||||
|
|
||||||
|
drawtext(vid_buf, 64, 192+32*CELLH, "A quick brown fox jumps over the lazy dog.", 255, 255, 255);
|
||||||
|
drawtext(vid_buf, 64, 192+33*CELLH, "A QUICK BROWN FOX JUMPS OVER THE LAZY DOG.", 255, 255, 255);
|
||||||
|
drawtext(vid_buf, 64, 192+34*CELLH, "0123456789 ~`!@#$%^&*()-=_+[]{}\\|;:'\",./<>?", 255, 255, 255);
|
||||||
|
|
||||||
|
drawchar(vid_buf, 32, 192+32*CELLH, c, 255, 255, 255);
|
||||||
|
|
||||||
|
sdl_blit(0, 0, XRES, YRES, vid_buf, XRES*4);
|
||||||
|
}
|
||||||
|
|
||||||
|
f = fopen("font.bin", "w");
|
||||||
|
fwrite(&xsize, 1, 1, f);
|
||||||
|
fwrite(&ysize, 1, 1, f);
|
||||||
|
fwrite(&base, 1, 1, f);
|
||||||
|
fwrite(&top, 1, 1, f);
|
||||||
|
fwrite(width, 1, 256, f);
|
||||||
|
fwrite(font, CELLW*CELLH, 256, f);
|
||||||
|
fclose(f);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
BIN
font/font.bin
Normal file
BIN
font/font.bin
Normal file
Binary file not shown.
100
font/packer.c
Normal file
100
font/packer.c
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
#define CELLW 12
|
||||||
|
#define CELLH 10
|
||||||
|
|
||||||
|
char xsize=CELLW, ysize=CELLH;
|
||||||
|
char base=7, top=2;
|
||||||
|
char font[256][CELLH][CELLW];
|
||||||
|
char width[256];
|
||||||
|
|
||||||
|
int bits_n = 0, bits_a = 0;
|
||||||
|
int flush_bits(void)
|
||||||
|
{
|
||||||
|
if(bits_n) {
|
||||||
|
bits_a >>= 8-bits_n;
|
||||||
|
printf("0x%02X, ", bits_a);
|
||||||
|
bits_a = 0;
|
||||||
|
bits_n = 0;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int stock_bits(int b, int nb)
|
||||||
|
{
|
||||||
|
bits_a >>= nb;
|
||||||
|
bits_a |= b << (8-nb);
|
||||||
|
bits_n += nb;
|
||||||
|
if(bits_n >= 8) {
|
||||||
|
printf("0x%02X, ", bits_a);
|
||||||
|
bits_a = 0;
|
||||||
|
bits_n = 0;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int save_char(int c)
|
||||||
|
{
|
||||||
|
int nb = 1;
|
||||||
|
int x, y;
|
||||||
|
|
||||||
|
if(!width[c])
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
printf(" 0x%02X, ", width[c]);
|
||||||
|
|
||||||
|
for(y=0; y<CELLH; y++)
|
||||||
|
for(x=0; x<width[c]; x++)
|
||||||
|
nb += stock_bits(font[c][y][x]&3, 2);
|
||||||
|
nb += flush_bits();
|
||||||
|
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
return nb;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *tag = "(c) 2008 Stanislaw Skowronek";
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
FILE *f;
|
||||||
|
int c, p[256], n = 0;
|
||||||
|
|
||||||
|
memset(p, 0, 256*4);
|
||||||
|
|
||||||
|
f = fopen("font.bin", "r");
|
||||||
|
fread(&xsize, 1, 1, f);
|
||||||
|
fread(&ysize, 1, 1, f);
|
||||||
|
fread(&base, 1, 1, f);
|
||||||
|
fread(&top, 1, 1, f);
|
||||||
|
fread(width, 1, 256, f);
|
||||||
|
fread(font, CELLW*CELLH, 256, f);
|
||||||
|
fclose(f);
|
||||||
|
|
||||||
|
printf("#define FONT_H %d\n", ysize);
|
||||||
|
|
||||||
|
printf("char font_data[] = {\n");
|
||||||
|
for(c=0; c<256; c++) {
|
||||||
|
p[c] = n;
|
||||||
|
n += save_char(c);
|
||||||
|
}
|
||||||
|
printf("};\n");
|
||||||
|
|
||||||
|
printf("short font_ptrs[] = {\n");
|
||||||
|
for(c=0; c<256; c++) {
|
||||||
|
if(!(c%8))
|
||||||
|
printf(" ");
|
||||||
|
printf("0x%04X,", p[c]);
|
||||||
|
if((c%8)==7)
|
||||||
|
printf("\n");
|
||||||
|
else
|
||||||
|
printf(" ");
|
||||||
|
}
|
||||||
|
printf("};\n");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
856
http.c
Normal file
856
http.c
Normal file
@ -0,0 +1,856 @@
|
|||||||
|
/**
|
||||||
|
* Powder Toy - HTTP library
|
||||||
|
*
|
||||||
|
* Powder Toy is the legal property of Stanislaw Skowronek.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#ifndef MACOSX
|
||||||
|
#include <malloc.h>
|
||||||
|
#endif
|
||||||
|
#include <time.h>
|
||||||
|
#ifdef WIN32
|
||||||
|
#define _WIN32_WINNT 0x0501
|
||||||
|
#include <winsock2.h>
|
||||||
|
#include <ws2tcpip.h>
|
||||||
|
#else
|
||||||
|
#include <errno.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <netdb.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "http.h"
|
||||||
|
#include "md5.h"
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
#define PERROR SOCKET_ERROR
|
||||||
|
#define PERRNO WSAGetLastError()
|
||||||
|
#define PEAGAIN WSAEWOULDBLOCK
|
||||||
|
#define PEINTR WSAEINTR
|
||||||
|
#define PEINPROGRESS WSAEINPROGRESS
|
||||||
|
#define PEALREADY WSAEALREADY
|
||||||
|
#define PCLOSE closesocket
|
||||||
|
#else
|
||||||
|
#define PERROR -1
|
||||||
|
#define PERRNO errno
|
||||||
|
#define PEAGAIN EAGAIN
|
||||||
|
#define PEINTR EINTR
|
||||||
|
#define PEINPROGRESS EINPROGRESS
|
||||||
|
#define PEALREADY EALREADY
|
||||||
|
#define PCLOSE close
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static int http_up = 0;
|
||||||
|
static long http_timeout = 15;
|
||||||
|
static int http_use_proxy = 0;
|
||||||
|
static struct sockaddr_in http_proxy;
|
||||||
|
|
||||||
|
static char *mystrdup(char *s)
|
||||||
|
{
|
||||||
|
char *x;
|
||||||
|
if(s) {
|
||||||
|
x = malloc(strlen(s)+1);
|
||||||
|
strcpy(x, s);
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int splituri(char *uri, char **host, char **path)
|
||||||
|
{
|
||||||
|
char *p=uri,*q,*x,*y;
|
||||||
|
if(!strncmp(p, "http://", 7))
|
||||||
|
p += 7;
|
||||||
|
q = strchr(p, '/');
|
||||||
|
if(!q)
|
||||||
|
q = p + strlen(p);
|
||||||
|
x = malloc(q-p+1);
|
||||||
|
if(*q)
|
||||||
|
y = mystrdup(q);
|
||||||
|
else
|
||||||
|
y = mystrdup("/");
|
||||||
|
strncpy(x, p, q-p);
|
||||||
|
x[q-p] = 0;
|
||||||
|
if(q==p || x[q-p-1]==':') {
|
||||||
|
free(x);
|
||||||
|
free(y);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
*host = x;
|
||||||
|
*path = y;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *getserv(char *host)
|
||||||
|
{
|
||||||
|
char *q, *x = mystrdup(host);
|
||||||
|
q = strchr(x, ':');
|
||||||
|
if(q)
|
||||||
|
*q = 0;
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *getport(char *host)
|
||||||
|
{
|
||||||
|
char *p, *q;
|
||||||
|
q = strchr(host, ':');
|
||||||
|
if(q)
|
||||||
|
p = mystrdup(q+1);
|
||||||
|
else
|
||||||
|
p = mystrdup("80");
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int resolve(char *dns, char *srv, struct sockaddr_in *addr)
|
||||||
|
{
|
||||||
|
struct addrinfo hnt, *res = 0;
|
||||||
|
if(http_use_proxy) {
|
||||||
|
memcpy(addr, &http_proxy, sizeof(struct sockaddr_in));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
memset(&hnt, 0, sizeof(hnt));
|
||||||
|
hnt.ai_family = AF_INET;
|
||||||
|
hnt.ai_socktype = SOCK_STREAM;
|
||||||
|
if(getaddrinfo(dns, srv, &hnt, &res))
|
||||||
|
return 1;
|
||||||
|
if(res) {
|
||||||
|
if(res->ai_family != AF_INET) {
|
||||||
|
freeaddrinfo(res);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
memcpy(addr, res->ai_addr, res->ai_addrlen);
|
||||||
|
freeaddrinfo(res);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void http_init(char *proxy)
|
||||||
|
{
|
||||||
|
char *host, *port;
|
||||||
|
#ifdef WIN32
|
||||||
|
WSADATA wsadata;
|
||||||
|
if(!WSAStartup(MAKEWORD(2,2), &wsadata))
|
||||||
|
http_up = 1;
|
||||||
|
#else
|
||||||
|
signal(SIGPIPE, SIG_IGN);
|
||||||
|
http_up = 1;
|
||||||
|
#endif
|
||||||
|
if(proxy) {
|
||||||
|
host = getserv(proxy);
|
||||||
|
port = getport(proxy);
|
||||||
|
if(resolve(host, port, &http_proxy))
|
||||||
|
http_up = 0;
|
||||||
|
else
|
||||||
|
http_use_proxy = 1;
|
||||||
|
free(host);
|
||||||
|
free(port);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void http_done(void)
|
||||||
|
{
|
||||||
|
#ifdef WIN32
|
||||||
|
WSACleanup();
|
||||||
|
#endif
|
||||||
|
http_up = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define CHUNK 4096
|
||||||
|
|
||||||
|
#define HTS_STRT 0
|
||||||
|
#define HTS_RSLV 1
|
||||||
|
#define HTS_CONN 2
|
||||||
|
#define HTS_IDLE 3
|
||||||
|
#define HTS_XMIT 4
|
||||||
|
#define HTS_RECV 5
|
||||||
|
#define HTS_DONE 6
|
||||||
|
struct http_ctx {
|
||||||
|
int state;
|
||||||
|
long last;
|
||||||
|
int keep;
|
||||||
|
int ret;
|
||||||
|
char *host, *path;
|
||||||
|
char *thdr;
|
||||||
|
int thlen;
|
||||||
|
char *txd;
|
||||||
|
int txdl;
|
||||||
|
struct sockaddr_in addr;
|
||||||
|
char *tbuf;
|
||||||
|
int tlen, tptr;
|
||||||
|
char *hbuf;
|
||||||
|
int hlen, hptr;
|
||||||
|
char *rbuf;
|
||||||
|
int rlen, rptr;
|
||||||
|
int chunked, chunkhdr, rxtogo, contlen, cclose;
|
||||||
|
int fd;
|
||||||
|
char *fdhost;
|
||||||
|
};
|
||||||
|
void *http_async_req_start(void *ctx, char *uri, char *data, int dlen, int keep)
|
||||||
|
{
|
||||||
|
struct http_ctx *cx = ctx;
|
||||||
|
if(!ctx) {
|
||||||
|
ctx = calloc(1, sizeof(struct http_ctx));
|
||||||
|
cx = ctx;
|
||||||
|
cx->fd = PERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!cx->hbuf) {
|
||||||
|
cx->hbuf = malloc(256);
|
||||||
|
cx->hlen = 256;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!http_up) {
|
||||||
|
cx->ret = 604;
|
||||||
|
cx->state = HTS_DONE;
|
||||||
|
return ctx;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(cx->state!=HTS_STRT && cx->state!=HTS_IDLE) {
|
||||||
|
fprintf(stderr, "HTTP: unclean request restart state.\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
cx->keep = keep;
|
||||||
|
cx->ret = 600;
|
||||||
|
if(splituri(uri, &cx->host, &cx->path)) {
|
||||||
|
cx->ret = 601;
|
||||||
|
cx->state = HTS_DONE;
|
||||||
|
return ctx;
|
||||||
|
}
|
||||||
|
if(http_use_proxy) {
|
||||||
|
free(cx->path);
|
||||||
|
cx->path = mystrdup(uri);
|
||||||
|
}
|
||||||
|
if(cx->fdhost && strcmp(cx->host, cx->fdhost)) {
|
||||||
|
free(cx->fdhost);
|
||||||
|
cx->fdhost = NULL;
|
||||||
|
PCLOSE(cx->fd);
|
||||||
|
cx->fd = PERROR;
|
||||||
|
cx->state = HTS_STRT;
|
||||||
|
}
|
||||||
|
if(data) {
|
||||||
|
if(!dlen)
|
||||||
|
dlen = strlen(data);
|
||||||
|
cx->txd = malloc(dlen);
|
||||||
|
memcpy(cx->txd, data, dlen);
|
||||||
|
cx->txdl = dlen;
|
||||||
|
} else
|
||||||
|
cx->txdl = 0;
|
||||||
|
|
||||||
|
cx->contlen = 0;
|
||||||
|
cx->chunked = 0;
|
||||||
|
cx->chunkhdr = 0;
|
||||||
|
cx->rxtogo = 0;
|
||||||
|
cx->cclose = 0;
|
||||||
|
|
||||||
|
cx->tptr = 0;
|
||||||
|
cx->tlen = 0;
|
||||||
|
|
||||||
|
cx->last = time(NULL);
|
||||||
|
|
||||||
|
return ctx;
|
||||||
|
}
|
||||||
|
|
||||||
|
void http_async_add_header(void *ctx, char *name, char *data)
|
||||||
|
{
|
||||||
|
struct http_ctx *cx = ctx;
|
||||||
|
cx->thdr = realloc(cx->thdr, cx->thlen + strlen(name) + strlen(data) + 4);
|
||||||
|
cx->thlen += sprintf(cx->thdr+cx->thlen, "%s: %s\n", name, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void process_header(struct http_ctx *cx, char *str)
|
||||||
|
{
|
||||||
|
char *p;
|
||||||
|
if(cx->chunkhdr) {
|
||||||
|
p = strchr(str, ';');
|
||||||
|
if(p)
|
||||||
|
*p = 0;
|
||||||
|
cx->rxtogo = strtoul(str, NULL, 16);
|
||||||
|
cx->chunkhdr = 0;
|
||||||
|
if(!cx->rxtogo)
|
||||||
|
cx->chunked = 0;
|
||||||
|
}
|
||||||
|
if(!str[0]) {
|
||||||
|
cx->rxtogo = cx->contlen;
|
||||||
|
cx->chunkhdr = cx->chunked;
|
||||||
|
if(!cx->contlen && !cx->chunked && cx->ret!=100)
|
||||||
|
cx->state = HTS_DONE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(!strncmp(str, "HTTP/", 5)) {
|
||||||
|
p = strchr(str, ' ');
|
||||||
|
if(!p) {
|
||||||
|
cx->ret = 603;
|
||||||
|
cx->state = HTS_DONE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
p++;
|
||||||
|
cx->ret = atoi(p);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(!strncmp(str, "Content-Length: ", 16)) {
|
||||||
|
cx->contlen = atoi(str+16);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(!strcmp(str, "Transfer-Encoding: chunked")) {
|
||||||
|
cx->chunked = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(!strcmp(str, "Connection: close")) {
|
||||||
|
cx->cclose = 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void process_byte(struct http_ctx *cx, char ch)
|
||||||
|
{
|
||||||
|
if(cx->rxtogo) {
|
||||||
|
cx->rxtogo--;
|
||||||
|
|
||||||
|
if(!cx->rbuf) {
|
||||||
|
cx->rbuf = malloc(256);
|
||||||
|
cx->rlen = 256;
|
||||||
|
}
|
||||||
|
if(cx->rptr >= cx->rlen-1) {
|
||||||
|
cx->rlen *= 2;
|
||||||
|
cx->rbuf = realloc(cx->rbuf, cx->rlen);
|
||||||
|
}
|
||||||
|
cx->rbuf[cx->rptr++] = ch;
|
||||||
|
|
||||||
|
if(!cx->rxtogo && !cx->chunked)
|
||||||
|
cx->state = HTS_DONE;
|
||||||
|
} else {
|
||||||
|
if(ch == '\n') {
|
||||||
|
cx->hbuf[cx->hptr] = 0;
|
||||||
|
process_header(cx, cx->hbuf);
|
||||||
|
cx->hptr = 0;
|
||||||
|
} else if(ch != '\r') {
|
||||||
|
if(cx->hptr >= cx->hlen-1) {
|
||||||
|
cx->hlen *= 2;
|
||||||
|
cx->hbuf = realloc(cx->hbuf, cx->hlen);
|
||||||
|
}
|
||||||
|
cx->hbuf[cx->hptr++] = ch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int http_async_req_status(void *ctx)
|
||||||
|
{
|
||||||
|
struct http_ctx *cx = ctx;
|
||||||
|
char *dns,*srv,buf[CHUNK];
|
||||||
|
int tmp, i;
|
||||||
|
long now = time(NULL);
|
||||||
|
#ifdef WIN32
|
||||||
|
unsigned long tmp2;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
switch(cx->state) {
|
||||||
|
case HTS_STRT:
|
||||||
|
dns = getserv(cx->host);
|
||||||
|
srv = getport(cx->host);
|
||||||
|
if(resolve(dns, srv, &cx->addr)) {
|
||||||
|
free(dns);
|
||||||
|
free(srv);
|
||||||
|
cx->state = HTS_DONE;
|
||||||
|
cx->ret = 602;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
free(dns);
|
||||||
|
free(srv);
|
||||||
|
cx->state = HTS_RSLV;
|
||||||
|
return 0;
|
||||||
|
case HTS_RSLV:
|
||||||
|
cx->state = HTS_CONN;
|
||||||
|
cx->last = now;
|
||||||
|
return 0;
|
||||||
|
case HTS_CONN:
|
||||||
|
if(cx->fd == PERROR) {
|
||||||
|
cx->fd = socket(AF_INET, SOCK_STREAM, 0);
|
||||||
|
if(cx->fd == PERROR)
|
||||||
|
goto fail;
|
||||||
|
cx->fdhost = mystrdup(cx->host);
|
||||||
|
#ifdef WIN32
|
||||||
|
tmp2 = 1;
|
||||||
|
if(ioctlsocket(cx->fd, FIONBIO, &tmp2) == SOCKET_ERROR)
|
||||||
|
goto fail;
|
||||||
|
#else
|
||||||
|
tmp = fcntl(cx->fd, F_GETFL);
|
||||||
|
if(tmp < 0)
|
||||||
|
goto fail;
|
||||||
|
if(fcntl(cx->fd, F_SETFL, tmp|O_NONBLOCK) < 0)
|
||||||
|
goto fail;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
if(!connect(cx->fd, (struct sockaddr *)&cx->addr, sizeof(cx->addr)))
|
||||||
|
cx->state = HTS_IDLE;
|
||||||
|
#ifdef WIN32
|
||||||
|
else if(PERRNO==WSAEISCONN)
|
||||||
|
cx->state = HTS_IDLE;
|
||||||
|
#endif
|
||||||
|
#ifdef MACOSX
|
||||||
|
else if(PERRNO==EISCONN)
|
||||||
|
cx->state = HTS_IDLE;
|
||||||
|
#endif
|
||||||
|
else if(PERRNO!=PEINPROGRESS && PERRNO!=PEALREADY
|
||||||
|
#ifdef WIN32
|
||||||
|
&& PERRNO!=PEAGAIN && PERRNO!=WSAEINVAL
|
||||||
|
#endif
|
||||||
|
)
|
||||||
|
goto fail;
|
||||||
|
if(now-cx->last>http_timeout)
|
||||||
|
goto timeout;
|
||||||
|
return 0;
|
||||||
|
case HTS_IDLE:
|
||||||
|
if(cx->txdl) {
|
||||||
|
// generate POST
|
||||||
|
cx->tbuf = malloc(strlen(cx->host) + strlen(cx->path) + 96 + cx->txdl + cx->thlen);
|
||||||
|
cx->tptr = 0;
|
||||||
|
cx->tlen = 0;
|
||||||
|
cx->tlen += sprintf(cx->tbuf+cx->tlen, "POST %s HTTP/1.1\n", cx->path);
|
||||||
|
cx->tlen += sprintf(cx->tbuf+cx->tlen, "Host: %s\n", cx->host);
|
||||||
|
if(!cx->keep)
|
||||||
|
cx->tlen += sprintf(cx->tbuf+cx->tlen, "Connection: close\n");
|
||||||
|
if(cx->thdr) {
|
||||||
|
memcpy(cx->tbuf+cx->tlen, cx->thdr, cx->thlen);
|
||||||
|
cx->tlen += cx->thlen;
|
||||||
|
free(cx->thdr);
|
||||||
|
cx->thdr = NULL;
|
||||||
|
cx->thlen = 0;
|
||||||
|
}
|
||||||
|
cx->tlen += sprintf(cx->tbuf+cx->tlen, "Content-Length: %d\n", cx->txdl);
|
||||||
|
cx->tlen += sprintf(cx->tbuf+cx->tlen, "\n");
|
||||||
|
memcpy(cx->tbuf+cx->tlen, cx->txd, cx->txdl);
|
||||||
|
cx->tlen += cx->txdl;
|
||||||
|
free(cx->txd);
|
||||||
|
cx->txd = NULL;
|
||||||
|
cx->txdl = 0;
|
||||||
|
} else {
|
||||||
|
// generate GET
|
||||||
|
cx->tbuf = malloc(strlen(cx->host) + strlen(cx->path) + 64 + cx->thlen);
|
||||||
|
cx->tptr = 0;
|
||||||
|
cx->tlen = 0;
|
||||||
|
cx->tlen += sprintf(cx->tbuf+cx->tlen, "GET %s HTTP/1.1\n", cx->path);
|
||||||
|
cx->tlen += sprintf(cx->tbuf+cx->tlen, "Host: %s\n", cx->host);
|
||||||
|
if(cx->thdr) {
|
||||||
|
memcpy(cx->tbuf+cx->tlen, cx->thdr, cx->thlen);
|
||||||
|
cx->tlen += cx->thlen;
|
||||||
|
free(cx->thdr);
|
||||||
|
cx->thdr = NULL;
|
||||||
|
cx->thlen = 0;
|
||||||
|
}
|
||||||
|
if(!cx->keep)
|
||||||
|
cx->tlen += sprintf(cx->tbuf+cx->tlen, "Connection: close\n");
|
||||||
|
cx->tlen += sprintf(cx->tbuf+cx->tlen, "\n");
|
||||||
|
}
|
||||||
|
cx->state = HTS_XMIT;
|
||||||
|
cx->last = now;
|
||||||
|
return 0;
|
||||||
|
case HTS_XMIT:
|
||||||
|
tmp = send(cx->fd, cx->tbuf+cx->tptr, cx->tlen-cx->tptr, 0);
|
||||||
|
if(tmp==PERROR && PERRNO!=PEAGAIN && PERRNO!=PEINTR)
|
||||||
|
goto fail;
|
||||||
|
if(tmp!=PERROR) {
|
||||||
|
cx->tptr += tmp;
|
||||||
|
if(cx->tptr == cx->tlen) {
|
||||||
|
cx->tptr = 0;
|
||||||
|
cx->tlen = 0;
|
||||||
|
free(cx->tbuf);
|
||||||
|
cx->state = HTS_RECV;
|
||||||
|
}
|
||||||
|
cx->last = now;
|
||||||
|
}
|
||||||
|
if(now-cx->last>http_timeout)
|
||||||
|
goto timeout;
|
||||||
|
return 0;
|
||||||
|
case HTS_RECV:
|
||||||
|
tmp = recv(cx->fd, buf, CHUNK, 0);
|
||||||
|
if(tmp==PERROR && PERRNO!=PEAGAIN && PERRNO!=PEINTR)
|
||||||
|
goto fail;
|
||||||
|
if(tmp!=PERROR) {
|
||||||
|
for(i=0;i<tmp;i++) {
|
||||||
|
process_byte(cx, buf[i]);
|
||||||
|
if(cx->state == HTS_DONE)
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
cx->last = now;
|
||||||
|
}
|
||||||
|
if(now-cx->last>http_timeout)
|
||||||
|
goto timeout;
|
||||||
|
return 0;
|
||||||
|
case HTS_DONE:
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
fail:
|
||||||
|
cx->ret = 600;
|
||||||
|
cx->state = HTS_DONE;
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
timeout:
|
||||||
|
cx->ret = 605;
|
||||||
|
cx->state = HTS_DONE;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *http_async_req_stop(void *ctx, int *ret, int *len)
|
||||||
|
{
|
||||||
|
struct http_ctx *cx = ctx;
|
||||||
|
char *rxd;
|
||||||
|
|
||||||
|
if(cx->state != HTS_DONE)
|
||||||
|
while(!http_async_req_status(ctx)) ;
|
||||||
|
|
||||||
|
if(cx->host) {
|
||||||
|
free(cx->host);
|
||||||
|
cx->host = NULL;
|
||||||
|
}
|
||||||
|
if(cx->path) {
|
||||||
|
free(cx->path);
|
||||||
|
cx->path = NULL;
|
||||||
|
}
|
||||||
|
if(cx->txd) {
|
||||||
|
free(cx->txd);
|
||||||
|
cx->txd = NULL;
|
||||||
|
cx->txdl = 0;
|
||||||
|
}
|
||||||
|
if(cx->hbuf) {
|
||||||
|
free(cx->hbuf);
|
||||||
|
cx->hbuf = NULL;
|
||||||
|
}
|
||||||
|
if(cx->thdr) {
|
||||||
|
free(cx->thdr);
|
||||||
|
cx->thdr = NULL;
|
||||||
|
cx->thlen = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ret)
|
||||||
|
*ret = cx->ret;
|
||||||
|
if(len)
|
||||||
|
*len = cx->rptr;
|
||||||
|
if(cx->rbuf)
|
||||||
|
cx->rbuf[cx->rptr] = 0;
|
||||||
|
rxd = cx->rbuf;
|
||||||
|
cx->rbuf = NULL;
|
||||||
|
cx->rlen = 0;
|
||||||
|
cx->rptr = 0;
|
||||||
|
cx->contlen = 0;
|
||||||
|
|
||||||
|
if(!cx->keep)
|
||||||
|
http_async_req_close(ctx);
|
||||||
|
else if(cx->cclose) {
|
||||||
|
PCLOSE(cx->fd);
|
||||||
|
cx->fd = PERROR;
|
||||||
|
if(cx->fdhost) {
|
||||||
|
free(cx->fdhost);
|
||||||
|
cx->fdhost = NULL;
|
||||||
|
}
|
||||||
|
cx->state = HTS_STRT;
|
||||||
|
} else
|
||||||
|
cx->state = HTS_IDLE;
|
||||||
|
|
||||||
|
return rxd;
|
||||||
|
}
|
||||||
|
|
||||||
|
void http_async_get_length(void *ctx, int *total, int *done)
|
||||||
|
{
|
||||||
|
struct http_ctx *cx = ctx;
|
||||||
|
if(done)
|
||||||
|
*done = cx->rptr;
|
||||||
|
if(total)
|
||||||
|
*total = cx->contlen;
|
||||||
|
}
|
||||||
|
|
||||||
|
void http_async_req_close(void *ctx)
|
||||||
|
{
|
||||||
|
struct http_ctx *cx = ctx;
|
||||||
|
void *tmp;
|
||||||
|
if(cx->host) {
|
||||||
|
cx->keep = 1;
|
||||||
|
tmp = http_async_req_stop(ctx, NULL, NULL);
|
||||||
|
if(tmp)
|
||||||
|
free(tmp);
|
||||||
|
}
|
||||||
|
if(cx->fdhost)
|
||||||
|
free(cx->fdhost);
|
||||||
|
PCLOSE(cx->fd);
|
||||||
|
free(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *http_simple_get(char *uri, int *ret, int *len)
|
||||||
|
{
|
||||||
|
void *ctx = http_async_req_start(NULL, uri, NULL, 0, 0);
|
||||||
|
if(!ctx) {
|
||||||
|
if(ret)
|
||||||
|
*ret = 600;
|
||||||
|
if(len)
|
||||||
|
*len = 0;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return http_async_req_stop(ctx, ret, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *http_simple_post(char *uri, char *data, int dlen, int *ret, int *len)
|
||||||
|
{
|
||||||
|
void *ctx = http_async_req_start(NULL, uri, data, dlen, 0);
|
||||||
|
if(!ctx) {
|
||||||
|
if(ret)
|
||||||
|
*ret = 600;
|
||||||
|
if(len)
|
||||||
|
*len = 0;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return http_async_req_stop(ctx, ret, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *http_ret_text(int ret)
|
||||||
|
{
|
||||||
|
switch(ret) {
|
||||||
|
case 100: return "Continue";
|
||||||
|
case 101: return "Switching Protocols";
|
||||||
|
case 102: return "Processing";
|
||||||
|
|
||||||
|
case 200: return "OK";
|
||||||
|
case 201: return "Created";
|
||||||
|
case 202: return "Accepted";
|
||||||
|
case 203: return "Non-Authoritative Information";
|
||||||
|
case 204: return "No Content";
|
||||||
|
case 205: return "Reset Content";
|
||||||
|
case 206: return "Partial Content";
|
||||||
|
case 207: return "Multi-Status";
|
||||||
|
|
||||||
|
case 300: return "Multiple Choices";
|
||||||
|
case 301: return "Moved Permanently";
|
||||||
|
case 302: return "Found";
|
||||||
|
case 303: return "See Other";
|
||||||
|
case 304: return "Not Modified";
|
||||||
|
case 305: return "Use Proxy";
|
||||||
|
case 306: return "Switch Proxy";
|
||||||
|
case 307: return "Temporary Redirect";
|
||||||
|
|
||||||
|
case 400: return "Bad Request";
|
||||||
|
case 401: return "Unauthorized";
|
||||||
|
case 402: return "Payment Required";
|
||||||
|
case 403: return "Forbidden";
|
||||||
|
case 404: return "Not Found";
|
||||||
|
case 405: return "Method Not Allowed";
|
||||||
|
case 406: return "Not Acceptable";
|
||||||
|
case 407: return "Proxy Authentication Required";
|
||||||
|
case 408: return "Request Timeout";
|
||||||
|
case 409: return "Conflict";
|
||||||
|
case 410: return "Gone";
|
||||||
|
case 411: return "Length Required";
|
||||||
|
case 412: return "Precondition Failed";
|
||||||
|
case 413: return "Request Entity Too Large";
|
||||||
|
case 414: return "Request URI Too Long";
|
||||||
|
case 415: return "Unsupported Media Type";
|
||||||
|
case 416: return "Requested Range Not Satisfiable";
|
||||||
|
case 417: return "Expectation Failed";
|
||||||
|
case 422: return "Unprocessable Entity";
|
||||||
|
case 423: return "Locked";
|
||||||
|
case 424: return "Failed Dependency";
|
||||||
|
case 425: return "Unordered Collection";
|
||||||
|
case 426: return "Upgrade Required";
|
||||||
|
|
||||||
|
case 500: return "Internal Server Error";
|
||||||
|
case 501: return "Not Implemented";
|
||||||
|
case 502: return "Bad Gateway";
|
||||||
|
case 503: return "Service Unavailable";
|
||||||
|
case 504: return "Gateway Timeout";
|
||||||
|
case 505: return "HTTP Version Not Supported";
|
||||||
|
case 506: return "Variant Also Negotiates";
|
||||||
|
case 507: return "Insufficient Storage";
|
||||||
|
case 509: return "Bandwidth Limit Exceeded";
|
||||||
|
case 510: return "Not Extended";
|
||||||
|
|
||||||
|
case 600: return "Internal Client Error";
|
||||||
|
case 601: return "Unsupported Protocol";
|
||||||
|
case 602: return "Server Not Found";
|
||||||
|
case 603: return "Malformed Response";
|
||||||
|
case 604: return "Network Not Available";
|
||||||
|
case 605: return "Request Timed Out";
|
||||||
|
default: return "Unknown Status Code";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static char hex[] = "0123456789abcdef";
|
||||||
|
char *http_multipart_post(char *uri, char **names, char **parts, int *plens, char *user, char *pass, int *ret, int *len)
|
||||||
|
{
|
||||||
|
void *ctx;
|
||||||
|
char *data = NULL, *tmp, *p;
|
||||||
|
int dlen = 0, i, j, m;
|
||||||
|
unsigned char hash[16];
|
||||||
|
unsigned char boundary[32], ch;
|
||||||
|
int blen = 0;
|
||||||
|
unsigned int map[62];
|
||||||
|
struct md5_context md5;
|
||||||
|
int own_plen = 0;
|
||||||
|
|
||||||
|
if(names) {
|
||||||
|
if(!plens) {
|
||||||
|
own_plen = 1;
|
||||||
|
for(i=0;names[i];i++) ;
|
||||||
|
plens = calloc(i, sizeof(int));
|
||||||
|
for(i=0;names[i];i++)
|
||||||
|
plens[i] = strlen(parts[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
retry:
|
||||||
|
if(blen >= 31)
|
||||||
|
goto fail;
|
||||||
|
memset(map, 0, 62*sizeof(int));
|
||||||
|
for(i=0;names[i];i++) {
|
||||||
|
for(j=0;j<plens[i]-blen;j++)
|
||||||
|
if(!blen || !memcmp(parts[i]+j, boundary, blen)) {
|
||||||
|
ch = parts[i][j+blen];
|
||||||
|
if(ch>='0' && ch<='9')
|
||||||
|
map[ch-'0']++;
|
||||||
|
else if(ch>='A' && ch<='Z')
|
||||||
|
map[ch-'A'+10]++;
|
||||||
|
else if(ch>='a' && ch<='z')
|
||||||
|
map[ch-'a'+36]++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m = ~0;
|
||||||
|
j = 61;
|
||||||
|
for(i=0;i<62;i++)
|
||||||
|
if(map[i]<m) {
|
||||||
|
m = map[i];
|
||||||
|
j = i;
|
||||||
|
}
|
||||||
|
if(j<10)
|
||||||
|
boundary[blen] = '0'+j;
|
||||||
|
else if(j<36)
|
||||||
|
boundary[blen] = 'A'+(j-10);
|
||||||
|
else
|
||||||
|
boundary[blen] = 'a'+(j-36);
|
||||||
|
blen++;
|
||||||
|
if(map[j])
|
||||||
|
goto retry;
|
||||||
|
boundary[blen] = 0;
|
||||||
|
|
||||||
|
for(i=0;names[i];i++)
|
||||||
|
dlen += blen+strlen(names[i])+plens[i]+128;
|
||||||
|
dlen += blen+8;
|
||||||
|
data = malloc(dlen);
|
||||||
|
dlen = 0;
|
||||||
|
for(i=0;names[i];i++) {
|
||||||
|
dlen += sprintf(data+dlen, "--%s\r\n", boundary);
|
||||||
|
dlen += sprintf(data+dlen, "Content-transfer-encoding: binary\r\n");
|
||||||
|
if(strchr(names[i], ':')) {
|
||||||
|
tmp = mystrdup(names[i]);
|
||||||
|
p = strchr(tmp, ':');
|
||||||
|
*p = 0;
|
||||||
|
dlen += sprintf(data+dlen, "content-disposition: form-data; name=\"%s\"; ", tmp);
|
||||||
|
free(tmp);
|
||||||
|
p = strchr(names[i], ':');
|
||||||
|
dlen += sprintf(data+dlen, "filename=\"%s\"\r\n\r\n", p+1);
|
||||||
|
} else
|
||||||
|
dlen += sprintf(data+dlen, "content-disposition: form-data; name=\"%s\"\r\n\r\n", names[i]);
|
||||||
|
memcpy(data+dlen, parts[i], plens[i]);
|
||||||
|
dlen += plens[i];
|
||||||
|
dlen += sprintf(data+dlen, "\r\n");
|
||||||
|
}
|
||||||
|
dlen += sprintf(data+dlen, "--%s--\r\n", boundary);
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx = http_async_req_start(NULL, uri, data, dlen, 0);
|
||||||
|
if(!ctx)
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
if(user) {
|
||||||
|
http_async_add_header(ctx, "X-Auth-User", user);
|
||||||
|
if(pass) {
|
||||||
|
md5_init(&md5);
|
||||||
|
md5_update(&md5, (unsigned char *)user, strlen(user));
|
||||||
|
md5_update(&md5, (unsigned char *)"-", 1);
|
||||||
|
m = 0;
|
||||||
|
if(names) {
|
||||||
|
for(i=0;names[i];i++) {
|
||||||
|
md5_update(&md5, (unsigned char *)parts[i], plens[i]);
|
||||||
|
md5_update(&md5, (unsigned char *)"-", 1);
|
||||||
|
p = strchr(names[i], ':');
|
||||||
|
if(p)
|
||||||
|
m += (p - names[i]) + 1;
|
||||||
|
else
|
||||||
|
m += strlen(names[i])+1;
|
||||||
|
}
|
||||||
|
|
||||||
|
tmp = malloc(m);
|
||||||
|
m = 0;
|
||||||
|
for(i=0;names[i];i++) {
|
||||||
|
p = strchr(names[i], ':');
|
||||||
|
if(m) {
|
||||||
|
tmp[m] = ' ';
|
||||||
|
m ++;
|
||||||
|
}
|
||||||
|
if(p) {
|
||||||
|
memcpy(tmp+m, names[i], p-names[i]);
|
||||||
|
m += p - names[i];
|
||||||
|
} else {
|
||||||
|
strcpy(tmp+m, names[i]);
|
||||||
|
m += strlen(names[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tmp[m] = 0;
|
||||||
|
http_async_add_header(ctx, "X-Auth-Objects", tmp);
|
||||||
|
free(tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
md5_update(&md5, (unsigned char *)pass, strlen(pass));
|
||||||
|
md5_final(hash, &md5);
|
||||||
|
tmp = malloc(33);
|
||||||
|
for(i=0;i<16;i++) {
|
||||||
|
tmp[i*2] = hex[hash[i]>>4];
|
||||||
|
tmp[i*2+1] = hex[hash[i]&15];
|
||||||
|
}
|
||||||
|
tmp[32] = 0;
|
||||||
|
http_async_add_header(ctx, "X-Auth-Hash", tmp);
|
||||||
|
free(tmp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(data) {
|
||||||
|
tmp = malloc(32+strlen((char *)boundary));
|
||||||
|
sprintf(tmp, "multipart/form-data, boundary=%s", boundary);
|
||||||
|
http_async_add_header(ctx, "Content-type", tmp);
|
||||||
|
free(tmp);
|
||||||
|
free(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(own_plen)
|
||||||
|
free(plens);
|
||||||
|
return http_async_req_stop(ctx, ret, len);
|
||||||
|
|
||||||
|
fail:
|
||||||
|
if(data)
|
||||||
|
free(data);
|
||||||
|
if(own_plen)
|
||||||
|
free(plens);
|
||||||
|
if(ret)
|
||||||
|
*ret = 600;
|
||||||
|
if(len)
|
||||||
|
*len = 0;
|
||||||
|
return NULL;
|
||||||
|
}
|
21
http.h
Normal file
21
http.h
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#ifndef HTTP_H
|
||||||
|
#define HTTP_H
|
||||||
|
|
||||||
|
void http_init(char *proxy);
|
||||||
|
void http_done(void);
|
||||||
|
|
||||||
|
char *http_simple_get(char *uri, int *ret, int *len);
|
||||||
|
char *http_simple_post(char *uri, char *data, int dlen, int *ret, int *len);
|
||||||
|
|
||||||
|
void *http_async_req_start(void *ctx, char *uri, char *data, int dlen, int keep);
|
||||||
|
void http_async_add_header(void *ctx, char *name, char *data);
|
||||||
|
int http_async_req_status(void *ctx);
|
||||||
|
void http_async_get_length(void *ctx, int *total, int *done);
|
||||||
|
char *http_async_req_stop(void *ctx, int *ret, int *len);
|
||||||
|
void http_async_req_close(void *ctx);
|
||||||
|
|
||||||
|
char *http_multipart_post(char *uri, char **names, char **parts, int *plens, char *user, char *pass, int *ret, int *len);
|
||||||
|
|
||||||
|
char *http_ret_text(int ret);
|
||||||
|
|
||||||
|
#endif
|
309
icon.h
Normal file
309
icon.h
Normal file
@ -0,0 +1,309 @@
|
|||||||
|
static unsigned char app_icon[] = {
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,
|
||||||
|
0x01,0x00,0x0b,0x02,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x0a,0x00,0x00,0x16,0x02,
|
||||||
|
0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x08,0x00,0x00,0x1b,0x02,0x00,0x0e,0x01,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x19,0x01,0x00,
|
||||||
|
0x62,0x09,0x02,0x4b,0x07,0x01,0x06,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x04,0x00,0x00,0x30,0x01,0x00,0x80,0x04,0x00,0x6c,
|
||||||
|
0x04,0x01,0x23,0x01,0x00,0x03,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x09,0x00,0x00,0x4d,
|
||||||
|
0x01,0x00,0xbc,0x08,0x01,0xdf,0x13,0x04,0x74,0x08,
|
||||||
|
0x01,0x0e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
|
||||||
|
0x00,0x00,0x15,0x00,0x00,0x78,0x04,0x00,0xf7,0x12,
|
||||||
|
0x02,0xfe,0x15,0x02,0xa2,0x06,0x00,0x28,0x00,0x00,
|
||||||
|
0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x24,0x00,
|
||||||
|
0x00,0xa7,0x08,0x01,0xff,0x28,0x07,0xff,0x26,0x06,
|
||||||
|
0xea,0x14,0x04,0x65,0x03,0x00,0x0e,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x04,0x00,0x00,0x32,0x00,0x00,0xc0,0x0e,0x01,
|
||||||
|
0xff,0x3e,0x0a,0xff,0x42,0x0a,0xff,0x2e,0x07,0x97,
|
||||||
|
0x09,0x01,0x1c,0x00,0x00,0x01,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,
|
||||||
|
0x3f,0x00,0x00,0xca,0x14,0x01,0xff,0x46,0x05,0xff,
|
||||||
|
0x57,0x07,0xfe,0x33,0x02,0x9f,0x06,0x00,0x28,0x00,
|
||||||
|
0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x09,0x00,0x00,0x46,0x01,0x00,0xd2,
|
||||||
|
0x1f,0x02,0xff,0x5e,0x08,0xff,0x75,0x0c,0xff,0x4e,
|
||||||
|
0x08,0xae,0x0f,0x00,0x32,0x00,0x00,0x04,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0a,
|
||||||
|
0x00,0x00,0x4a,0x02,0x00,0xd5,0x26,0x01,0xff,0x72,
|
||||||
|
0x0a,0xff,0x9e,0x12,0xff,0x7c,0x0d,0xc1,0x26,0x01,
|
||||||
|
0x39,0x02,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x0a,0x00,0x00,0x4b,0x04,
|
||||||
|
0x00,0xd7,0x37,0x02,0xff,0x90,0x0a,0xff,0xc5,0x15,
|
||||||
|
0xff,0xad,0x14,0xca,0x3f,0x03,0x42,0x05,0x00,0x08,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x0a,0x00,0x00,0x4b,0x08,0x00,0xd7,0x48,0x02,
|
||||||
|
0xff,0xb5,0x10,0xff,0xf4,0x20,0xff,0xd2,0x19,0xcd,
|
||||||
|
0x56,0x03,0x48,0x0c,0x00,0x0b,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0a,0x00,0x00,
|
||||||
|
0x48,0x0c,0x00,0xd4,0x58,0x04,0xff,0xdc,0x1b,0xff,
|
||||||
|
0xff,0x2c,0xff,0xe7,0x1c,0xcb,0x69,0x03,0x4c,0x15,
|
||||||
|
0x00,0x0d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x08,0x00,0x00,0x3f,0x0e,0x00,0xbc,
|
||||||
|
0x56,0x01,0xfe,0xd6,0x16,0xff,0xff,0x36,0xff,0xea,
|
||||||
|
0x20,0xc9,0x72,0x02,0x4d,0x1c,0x00,0x0e,0x01,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,
|
||||||
|
0x00,0x00,0x33,0x0d,0x00,0x96,0x51,0x02,0xfa,0xd5,
|
||||||
|
0x1f,0xff,0xff,0x4f,0xff,0xf1,0x32,0xca,0x7c,0x05,
|
||||||
|
0x50,0x21,0x00,0x10,0x01,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x28,0x0d,
|
||||||
|
0x00,0x84,0x50,0x04,0xf6,0xdd,0x32,0xff,0xff,0x75,
|
||||||
|
0xff,0xf7,0x51,0xd0,0x89,0x0f,0x53,0x28,0x00,0x11,
|
||||||
|
0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x02,0x00,0x00,0x22,0x0c,0x00,0x79,0x4e,0x07,
|
||||||
|
0xf3,0xd7,0x3c,0xff,0xff,0x87,0xff,0xfc,0x6d,0xd5,
|
||||||
|
0x9b,0x20,0x5a,0x32,0x02,0x14,0x06,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,
|
||||||
|
0x1d,0x0d,0x00,0x72,0x53,0x0d,0xf2,0xde,0x55,0xff,
|
||||||
|
0xff,0xb1,0xff,0xff,0x9e,0xe5,0xbc,0x41,0x72,0x48,
|
||||||
|
0x0b,0x1f,0x0b,0x00,0x02,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x01,0x00,0x00,0x18,0x0e,0x00,0x69,
|
||||||
|
0x56,0x14,0xef,0xe4,0x74,0xff,0xff,0xeb,0xff,0xff,
|
||||||
|
0xe8,0xfd,0xe9,0x83,0xad,0x74,0x25,0x37,0x19,0x02,
|
||||||
|
0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x11,0x0b,0x00,0x60,0x51,0x17,0xec,0xe5,
|
||||||
|
0x84,0xff,0xff,0xfa,0xff,0xff,0xfe,0xff,0xff,0xca,
|
||||||
|
0xe6,0xab,0x46,0x46,0x21,0x04,0x07,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0a,0x06,
|
||||||
|
0x00,0x4c,0x3c,0x0f,0xdc,0xca,0x63,0xff,0xff,0xd6,
|
||||||
|
0xff,0xff,0xdc,0xff,0xfb,0x9c,0xb7,0x79,0x2a,0x30,
|
||||||
|
0x18,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x04,0x02,0x00,0x2c,0x1c,0x03,
|
||||||
|
0x8e,0x66,0x22,0xfb,0xf3,0x7f,0xff,0xfb,0x86,0xfb,
|
||||||
|
0xf0,0x6c,0x5f,0x32,0x0a,0x13,0x07,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x01,0x00,0x00,0x0c,0x04,0x00,0x2f,0x19,0x02,0xec,
|
||||||
|
0xc4,0x44,0xfa,0xd4,0x4b,0xe9,0xb9,0x40,0x1a,0x09,
|
||||||
|
0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x06,0x02,0x00,0xbc,0x97,0x38,0xcb,0xa3,
|
||||||
|
0x3c,0xbe,0x99,0x3a,0x01,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0xb2,0x94,0x3b,0xc0,0xa0,0x40,0xb8,0x99,0x3d,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xb2,0x94,0x3c,
|
||||||
|
0xc0,0xa0,0x40,0xb8,0x9a,0x3e,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x74,0x61,0x26,0x86,0x70,0x2c,0x79,
|
||||||
|
0x64,0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||||
|
0x00,0x00};
|
225
md5.c
Normal file
225
md5.c
Normal file
@ -0,0 +1,225 @@
|
|||||||
|
// based on public-domain code from Colin Plumb (1993)
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include "md5.h"
|
||||||
|
|
||||||
|
static unsigned getu32(const unsigned char *addr)
|
||||||
|
{
|
||||||
|
return (((((unsigned long)addr[3] << 8) | addr[2]) << 8) | addr[1]) << 8 | addr[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
static void putu32(unsigned data, unsigned char *addr)
|
||||||
|
{
|
||||||
|
addr[0] = (unsigned char)data;
|
||||||
|
addr[1] = (unsigned char)(data >> 8);
|
||||||
|
addr[2] = (unsigned char)(data >> 16);
|
||||||
|
addr[3] = (unsigned char)(data >> 24);
|
||||||
|
}
|
||||||
|
|
||||||
|
void md5_init(struct md5_context *ctx)
|
||||||
|
{
|
||||||
|
ctx->buf[0] = 0x67452301;
|
||||||
|
ctx->buf[1] = 0xefcdab89;
|
||||||
|
ctx->buf[2] = 0x98badcfe;
|
||||||
|
ctx->buf[3] = 0x10325476;
|
||||||
|
|
||||||
|
ctx->bits[0] = 0;
|
||||||
|
ctx->bits[1] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void md5_update(struct md5_context *ctx, unsigned char const *buf, unsigned len)
|
||||||
|
{
|
||||||
|
unsigned t;
|
||||||
|
|
||||||
|
// update bit count
|
||||||
|
t = ctx->bits[0];
|
||||||
|
if((ctx->bits[0] = (t + ((unsigned)len << 3)) & 0xffffffff) < t)
|
||||||
|
ctx->bits[1]++; // carry
|
||||||
|
ctx->bits[1] += len >> 29;
|
||||||
|
|
||||||
|
t = (t >> 3) & 0x3f;
|
||||||
|
|
||||||
|
// use leading data to top up the buffer
|
||||||
|
|
||||||
|
if(t) {
|
||||||
|
unsigned char *p = ctx->in + t;
|
||||||
|
|
||||||
|
t = 64-t;
|
||||||
|
if (len < t) {
|
||||||
|
memcpy(p, buf, len);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
memcpy(p, buf, t);
|
||||||
|
md5_transform(ctx->buf, ctx->in);
|
||||||
|
buf += t;
|
||||||
|
len -= t;
|
||||||
|
}
|
||||||
|
|
||||||
|
// following 64-byte chunks
|
||||||
|
|
||||||
|
while(len >= 64) {
|
||||||
|
memcpy(ctx->in, buf, 64);
|
||||||
|
md5_transform(ctx->buf, ctx->in);
|
||||||
|
buf += 64;
|
||||||
|
len -= 64;
|
||||||
|
}
|
||||||
|
|
||||||
|
// save rest of bytes for later
|
||||||
|
|
||||||
|
memcpy(ctx->in, buf, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
void md5_final(unsigned char digest[16], struct md5_context *ctx)
|
||||||
|
{
|
||||||
|
unsigned count;
|
||||||
|
unsigned char *p;
|
||||||
|
|
||||||
|
// #bytes mod64
|
||||||
|
count = (ctx->bits[0] >> 3) & 0x3F;
|
||||||
|
|
||||||
|
// first char of padding = 0x80
|
||||||
|
p = ctx->in + count;
|
||||||
|
*p++ = 0x80;
|
||||||
|
|
||||||
|
// calculate # of bytes to pad
|
||||||
|
count = 64 - 1 - count;
|
||||||
|
|
||||||
|
// Pad out to 56 mod 64
|
||||||
|
if(count < 8) {
|
||||||
|
// we need to finish a whole block before padding
|
||||||
|
memset(p, 0, count);
|
||||||
|
md5_transform(ctx->buf, ctx->in);
|
||||||
|
memset(ctx->in, 0, 56);
|
||||||
|
} else {
|
||||||
|
// just pad to 56 bytes
|
||||||
|
memset(p, 0, count-8);
|
||||||
|
}
|
||||||
|
|
||||||
|
// append length & final transform
|
||||||
|
putu32(ctx->bits[0], ctx->in + 56);
|
||||||
|
putu32(ctx->bits[1], ctx->in + 60);
|
||||||
|
|
||||||
|
md5_transform(ctx->buf, ctx->in);
|
||||||
|
putu32(ctx->buf[0], digest);
|
||||||
|
putu32(ctx->buf[1], digest + 4);
|
||||||
|
putu32(ctx->buf[2], digest + 8);
|
||||||
|
putu32(ctx->buf[3], digest + 12);
|
||||||
|
memset(ctx, 0, sizeof(ctx));
|
||||||
|
}
|
||||||
|
|
||||||
|
#define F1(x, y, z) (z ^ (x & (y ^ z)))
|
||||||
|
#define F2(x, y, z) F1(z, x, y)
|
||||||
|
#define F3(x, y, z) (x ^ y ^ z)
|
||||||
|
#define F4(x, y, z) (y ^ (x | ~z))
|
||||||
|
|
||||||
|
#define MD5STEP(f, w, x, y, z, data, s) \
|
||||||
|
( w += f(x, y, z) + data, w &= 0xffffffff, w = w<<s | w>>(32-s), w += x )
|
||||||
|
|
||||||
|
void md5_transform(unsigned buf[4], const unsigned char inraw[64])
|
||||||
|
{
|
||||||
|
unsigned a, b, c, d;
|
||||||
|
unsigned in[16];
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < 16; ++i)
|
||||||
|
in[i] = getu32 (inraw + 4 * i);
|
||||||
|
|
||||||
|
a = buf[0];
|
||||||
|
b = buf[1];
|
||||||
|
c = buf[2];
|
||||||
|
d = buf[3];
|
||||||
|
|
||||||
|
MD5STEP(F1, a, b, c, d, in[ 0]+0xd76aa478, 7);
|
||||||
|
MD5STEP(F1, d, a, b, c, in[ 1]+0xe8c7b756, 12);
|
||||||
|
MD5STEP(F1, c, d, a, b, in[ 2]+0x242070db, 17);
|
||||||
|
MD5STEP(F1, b, c, d, a, in[ 3]+0xc1bdceee, 22);
|
||||||
|
MD5STEP(F1, a, b, c, d, in[ 4]+0xf57c0faf, 7);
|
||||||
|
MD5STEP(F1, d, a, b, c, in[ 5]+0x4787c62a, 12);
|
||||||
|
MD5STEP(F1, c, d, a, b, in[ 6]+0xa8304613, 17);
|
||||||
|
MD5STEP(F1, b, c, d, a, in[ 7]+0xfd469501, 22);
|
||||||
|
MD5STEP(F1, a, b, c, d, in[ 8]+0x698098d8, 7);
|
||||||
|
MD5STEP(F1, d, a, b, c, in[ 9]+0x8b44f7af, 12);
|
||||||
|
MD5STEP(F1, c, d, a, b, in[10]+0xffff5bb1, 17);
|
||||||
|
MD5STEP(F1, b, c, d, a, in[11]+0x895cd7be, 22);
|
||||||
|
MD5STEP(F1, a, b, c, d, in[12]+0x6b901122, 7);
|
||||||
|
MD5STEP(F1, d, a, b, c, in[13]+0xfd987193, 12);
|
||||||
|
MD5STEP(F1, c, d, a, b, in[14]+0xa679438e, 17);
|
||||||
|
MD5STEP(F1, b, c, d, a, in[15]+0x49b40821, 22);
|
||||||
|
|
||||||
|
MD5STEP(F2, a, b, c, d, in[ 1]+0xf61e2562, 5);
|
||||||
|
MD5STEP(F2, d, a, b, c, in[ 6]+0xc040b340, 9);
|
||||||
|
MD5STEP(F2, c, d, a, b, in[11]+0x265e5a51, 14);
|
||||||
|
MD5STEP(F2, b, c, d, a, in[ 0]+0xe9b6c7aa, 20);
|
||||||
|
MD5STEP(F2, a, b, c, d, in[ 5]+0xd62f105d, 5);
|
||||||
|
MD5STEP(F2, d, a, b, c, in[10]+0x02441453, 9);
|
||||||
|
MD5STEP(F2, c, d, a, b, in[15]+0xd8a1e681, 14);
|
||||||
|
MD5STEP(F2, b, c, d, a, in[ 4]+0xe7d3fbc8, 20);
|
||||||
|
MD5STEP(F2, a, b, c, d, in[ 9]+0x21e1cde6, 5);
|
||||||
|
MD5STEP(F2, d, a, b, c, in[14]+0xc33707d6, 9);
|
||||||
|
MD5STEP(F2, c, d, a, b, in[ 3]+0xf4d50d87, 14);
|
||||||
|
MD5STEP(F2, b, c, d, a, in[ 8]+0x455a14ed, 20);
|
||||||
|
MD5STEP(F2, a, b, c, d, in[13]+0xa9e3e905, 5);
|
||||||
|
MD5STEP(F2, d, a, b, c, in[ 2]+0xfcefa3f8, 9);
|
||||||
|
MD5STEP(F2, c, d, a, b, in[ 7]+0x676f02d9, 14);
|
||||||
|
MD5STEP(F2, b, c, d, a, in[12]+0x8d2a4c8a, 20);
|
||||||
|
|
||||||
|
MD5STEP(F3, a, b, c, d, in[ 5]+0xfffa3942, 4);
|
||||||
|
MD5STEP(F3, d, a, b, c, in[ 8]+0x8771f681, 11);
|
||||||
|
MD5STEP(F3, c, d, a, b, in[11]+0x6d9d6122, 16);
|
||||||
|
MD5STEP(F3, b, c, d, a, in[14]+0xfde5380c, 23);
|
||||||
|
MD5STEP(F3, a, b, c, d, in[ 1]+0xa4beea44, 4);
|
||||||
|
MD5STEP(F3, d, a, b, c, in[ 4]+0x4bdecfa9, 11);
|
||||||
|
MD5STEP(F3, c, d, a, b, in[ 7]+0xf6bb4b60, 16);
|
||||||
|
MD5STEP(F3, b, c, d, a, in[10]+0xbebfbc70, 23);
|
||||||
|
MD5STEP(F3, a, b, c, d, in[13]+0x289b7ec6, 4);
|
||||||
|
MD5STEP(F3, d, a, b, c, in[ 0]+0xeaa127fa, 11);
|
||||||
|
MD5STEP(F3, c, d, a, b, in[ 3]+0xd4ef3085, 16);
|
||||||
|
MD5STEP(F3, b, c, d, a, in[ 6]+0x04881d05, 23);
|
||||||
|
MD5STEP(F3, a, b, c, d, in[ 9]+0xd9d4d039, 4);
|
||||||
|
MD5STEP(F3, d, a, b, c, in[12]+0xe6db99e5, 11);
|
||||||
|
MD5STEP(F3, c, d, a, b, in[15]+0x1fa27cf8, 16);
|
||||||
|
MD5STEP(F3, b, c, d, a, in[ 2]+0xc4ac5665, 23);
|
||||||
|
|
||||||
|
MD5STEP(F4, a, b, c, d, in[ 0]+0xf4292244, 6);
|
||||||
|
MD5STEP(F4, d, a, b, c, in[ 7]+0x432aff97, 10);
|
||||||
|
MD5STEP(F4, c, d, a, b, in[14]+0xab9423a7, 15);
|
||||||
|
MD5STEP(F4, b, c, d, a, in[ 5]+0xfc93a039, 21);
|
||||||
|
MD5STEP(F4, a, b, c, d, in[12]+0x655b59c3, 6);
|
||||||
|
MD5STEP(F4, d, a, b, c, in[ 3]+0x8f0ccc92, 10);
|
||||||
|
MD5STEP(F4, c, d, a, b, in[10]+0xffeff47d, 15);
|
||||||
|
MD5STEP(F4, b, c, d, a, in[ 1]+0x85845dd1, 21);
|
||||||
|
MD5STEP(F4, a, b, c, d, in[ 8]+0x6fa87e4f, 6);
|
||||||
|
MD5STEP(F4, d, a, b, c, in[15]+0xfe2ce6e0, 10);
|
||||||
|
MD5STEP(F4, c, d, a, b, in[ 6]+0xa3014314, 15);
|
||||||
|
MD5STEP(F4, b, c, d, a, in[13]+0x4e0811a1, 21);
|
||||||
|
MD5STEP(F4, a, b, c, d, in[ 4]+0xf7537e82, 6);
|
||||||
|
MD5STEP(F4, d, a, b, c, in[11]+0xbd3af235, 10);
|
||||||
|
MD5STEP(F4, c, d, a, b, in[ 2]+0x2ad7d2bb, 15);
|
||||||
|
MD5STEP(F4, b, c, d, a, in[ 9]+0xeb86d391, 21);
|
||||||
|
|
||||||
|
buf[0] += a;
|
||||||
|
buf[1] += b;
|
||||||
|
buf[2] += c;
|
||||||
|
buf[3] += d;
|
||||||
|
}
|
||||||
|
|
||||||
|
static char hex[] = "0123456789abcdef";
|
||||||
|
void md5_ascii(char *result, unsigned char const *buf, unsigned len)
|
||||||
|
{
|
||||||
|
struct md5_context md5;
|
||||||
|
unsigned char hash[16];
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if(len==0)
|
||||||
|
len = strlen((char *)buf);
|
||||||
|
|
||||||
|
md5_init(&md5);
|
||||||
|
md5_update(&md5, buf, len);
|
||||||
|
md5_final(hash, &md5);
|
||||||
|
|
||||||
|
for(i=0;i<16;i++) {
|
||||||
|
result[i*2] = hex[hash[i]>>4];
|
||||||
|
result[i*2+1] = hex[hash[i]&15];
|
||||||
|
}
|
||||||
|
result[32] = 0;
|
||||||
|
}
|
17
md5.h
Normal file
17
md5.h
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#ifndef MD5_H
|
||||||
|
#define MD5_H
|
||||||
|
|
||||||
|
struct md5_context {
|
||||||
|
unsigned buf[4];
|
||||||
|
unsigned bits[2];
|
||||||
|
unsigned char in[64];
|
||||||
|
};
|
||||||
|
|
||||||
|
void md5_init(struct md5_context *context);
|
||||||
|
void md5_update(struct md5_context *context, unsigned char const *buf, unsigned len);
|
||||||
|
void md5_final(unsigned char digest[16], struct md5_context *context);
|
||||||
|
void md5_transform(unsigned buf[4], const unsigned char in[64]);
|
||||||
|
|
||||||
|
void md5_ascii(char *result, unsigned char const *buf, unsigned len);
|
||||||
|
|
||||||
|
#endif
|
2
powder-res.rc
Normal file
2
powder-res.rc
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
#define IDI_ICON1 101
|
||||||
|
IDI_ICON1 ICON DISCARDABLE "powder.ico"
|
BIN
powder.ico
Normal file
BIN
powder.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
188
update.c
Normal file
188
update.c
Normal file
@ -0,0 +1,188 @@
|
|||||||
|
/**
|
||||||
|
* Powder Toy - Update helper
|
||||||
|
*
|
||||||
|
* Powder Toy is the legal property of Stanislaw Skowronek.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#ifndef MACOSX
|
||||||
|
#include <malloc.h>
|
||||||
|
#endif
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
#include <windows.h>
|
||||||
|
int __cdecl _stricmp(const char*, const char*);
|
||||||
|
#else
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#endif
|
||||||
|
#ifdef MACOSX
|
||||||
|
#include <mach-o/dyld.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <sys/param.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "update.h"
|
||||||
|
|
||||||
|
static char *exe_name(void)
|
||||||
|
{
|
||||||
|
#if defined WIN32
|
||||||
|
char *name=malloc(64), max=64, res;
|
||||||
|
while((res = GetModuleFileName(NULL, name, max)) >= max) {
|
||||||
|
#elif defined MACOSX
|
||||||
|
char *fn=malloc(64),*name=malloc(PATH_MAX), max=64, res;
|
||||||
|
if(_NSGetExecutablePath(fn, &max) != 0) {
|
||||||
|
fn = realloc(fn, max);
|
||||||
|
_NSGetExecutablePath(fn, &max);
|
||||||
|
}
|
||||||
|
if(realpath(fn, name) == NULL) {
|
||||||
|
free(fn);
|
||||||
|
free(name);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
res = 1;
|
||||||
|
#else
|
||||||
|
char fn[64], *name=malloc(64), max=64, res;
|
||||||
|
sprintf(fn, "/proc/self/exe");
|
||||||
|
memset(name, 0, max);
|
||||||
|
while((res = readlink(fn, name, max)) >= max-1) {
|
||||||
|
#endif
|
||||||
|
#ifndef MACOSX
|
||||||
|
max *= 2;
|
||||||
|
name = realloc(name, max);
|
||||||
|
memset(name, 0, max);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
if(res <= 0) {
|
||||||
|
free(name);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
int update_start(char *data, int len)
|
||||||
|
{
|
||||||
|
char *self=exe_name(), *temp;
|
||||||
|
#ifdef WIN32
|
||||||
|
char *p;
|
||||||
|
#endif
|
||||||
|
FILE *f;
|
||||||
|
int res = 1;
|
||||||
|
|
||||||
|
if(!self)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
temp = malloc(strlen(self)+12);
|
||||||
|
strcpy(temp, self);
|
||||||
|
p = temp + strlen(temp) - 4;
|
||||||
|
if(_stricmp(p, ".exe"))
|
||||||
|
p += 4;
|
||||||
|
strcpy(p, "_update.exe");
|
||||||
|
|
||||||
|
if(!MoveFile(self, temp))
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
f = fopen(self, "wb");
|
||||||
|
if(!f)
|
||||||
|
goto fail;
|
||||||
|
if(fwrite(data, 1, len, f) != len) {
|
||||||
|
fclose(f);
|
||||||
|
DeleteFile(self);
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
fclose(f);
|
||||||
|
|
||||||
|
if((int)ShellExecute(NULL, "open", self, NULL, NULL, SW_SHOWNORMAL) <= 32) {
|
||||||
|
DeleteFile(self);
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
#else
|
||||||
|
temp = malloc(strlen(self)+8);
|
||||||
|
strcpy(temp, self);
|
||||||
|
strcat(temp, "-update");
|
||||||
|
|
||||||
|
f = fopen(temp, "w");
|
||||||
|
if(!f)
|
||||||
|
goto fail;
|
||||||
|
if(fwrite(data, 1, len, f) != len) {
|
||||||
|
fclose(f);
|
||||||
|
unlink(temp);
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
fclose(f);
|
||||||
|
|
||||||
|
if(chmod(temp, 0755)) {
|
||||||
|
unlink(temp);
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(rename(temp, self)) {
|
||||||
|
unlink(temp);
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
execl(self, "powder-update", NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
fail:
|
||||||
|
free(temp);
|
||||||
|
free(self);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
int update_finish(void)
|
||||||
|
{
|
||||||
|
#ifdef WIN32
|
||||||
|
char *temp, *self=exe_name(), *p;
|
||||||
|
int timeout = 60, err;
|
||||||
|
|
||||||
|
temp = malloc(strlen(self)+12);
|
||||||
|
strcpy(temp, self);
|
||||||
|
p = temp + strlen(temp) - 4;
|
||||||
|
if(_stricmp(p, ".exe"))
|
||||||
|
p += 4;
|
||||||
|
strcpy(p, "_update.exe");
|
||||||
|
|
||||||
|
while(!DeleteFile(temp)) {
|
||||||
|
err = GetLastError();
|
||||||
|
if(err == ERROR_FILE_NOT_FOUND) {
|
||||||
|
// just as well, then
|
||||||
|
free(temp);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
Sleep(500);
|
||||||
|
timeout--;
|
||||||
|
if(timeout <= 0) {
|
||||||
|
free(temp);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free(temp);
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void update_cleanup(void)
|
||||||
|
{
|
||||||
|
#ifdef WIN32
|
||||||
|
update_finish();
|
||||||
|
#endif
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user