aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CATSFC/system/Pictochat-16.odfbin104365 -> 0 bytes
-rw-r--r--CATSFC/system/gui/backo.bmpbin574 -> 0 bytes
-rw-r--r--CATSFC/system/gui/boot.bmpbin98358 -> 0 bytes
-rw-r--r--CATSFC/system/gui/chtfile.bmpbin568 -> 0 bytes
-rw-r--r--CATSFC/system/gui/directory.bmpbin568 -> 0 bytes
-rw-r--r--CATSFC/system/gui/fdoto.bmpbin568 -> 0 bytes
-rw-r--r--CATSFC/system/gui/nbacko.bmpbin574 -> 0 bytes
-rw-r--r--CATSFC/system/gui/savo.bmpbin5462 -> 0 bytes
-rw-r--r--CATSFC/system/gui/sbutto.bmpbin2486 -> 0 bytes
-rw-r--r--CATSFC/system/gui/scheato.bmpbin5462 -> 0 bytes
-rw-r--r--CATSFC/system/gui/semptyo.bmpbin342 -> 0 bytes
-rw-r--r--CATSFC/system/gui/sexito.bmpbin5462 -> 0 bytes
-rw-r--r--CATSFC/system/gui/sfcfile.bmpbin566 -> 0 bytes
-rw-r--r--CATSFC/system/gui/sfullo.bmpbin342 -> 0 bytes
-rw-r--r--CATSFC/system/gui/smaini.bmpbin6590 -> 0 bytes
-rw-r--r--CATSFC/system/gui/smaybgo.bmpbin98358 -> 0 bytes
-rw-r--r--CATSFC/system/gui/smnsel.bmpbin2454 -> 0 bytes
-rw-r--r--CATSFC/system/gui/smsel.bmpbin3654 -> 0 bytes
-rw-r--r--CATSFC/system/gui/smsgfr.bmpbin43122 -> 0 bytes
-rw-r--r--CATSFC/system/gui/snavo.bmpbin5462 -> 0 bytes
-rw-r--r--CATSFC/system/gui/sncheato.bmpbin5462 -> 0 bytes
-rw-r--r--CATSFC/system/gui/snemptyo.bmpbin342 -> 0 bytes
-rw-r--r--CATSFC/system/gui/snexito.bmpbin5462 -> 0 bytes
-rw-r--r--CATSFC/system/gui/snfullo.bmpbin342 -> 0 bytes
-rw-r--r--CATSFC/system/gui/snmaini.bmpbin6590 -> 0 bytes
-rw-r--r--CATSFC/system/gui/snother.bmpbin5462 -> 0 bytes
-rw-r--r--CATSFC/system/gui/snsaveo.bmpbin5462 -> 0 bytes
-rw-r--r--CATSFC/system/gui/sntoolo.bmpbin5462 -> 0 bytes
-rw-r--r--CATSFC/system/gui/sother.bmpbin5462 -> 0 bytes
-rw-r--r--CATSFC/system/gui/ssaveo.bmpbin5462 -> 0 bytes
-rw-r--r--CATSFC/system/gui/ssubbg.bmpbin98358 -> 0 bytes
-rw-r--r--CATSFC/system/gui/sticon.bmpbin834 -> 0 bytes
-rw-r--r--CATSFC/system/gui/stitle.bmpbin16950 -> 0 bytes
-rw-r--r--CATSFC/system/gui/stoolo.bmpbin5462 -> 0 bytes
-rw-r--r--CATSFC/system/gui/subsela.bmpbin10878 -> 0 bytes
-rw-r--r--CATSFC/system/gui/sunnof.bmpbin568 -> 0 bytes
-rw-r--r--CATSFC/system/gui/uicolors.txt6
-rw-r--r--CATSFC/system/gui/zipfile.bmpbin568 -> 0 bytes
-rw-r--r--CATSFC/system/language.msg1801
-rw-r--r--CATSFC/system/song.odfbin709993 -> 0 bytes
-rw-r--r--Makefile.org124
-rw-r--r--catsfc.bmpbin3414 -> 0 bytes
-rw-r--r--catsfc.ini3
-rw-r--r--installation.txt3
-rw-r--r--libretro.cpp6
-rwxr-xr-xsdk-modifications/include/archdefs.h2356
-rwxr-xr-xsdk-modifications/include/bit_ops.h58
-rwxr-xr-xsdk-modifications/include/console.h9
-rwxr-xr-xsdk-modifications/include/directory.h172
-rwxr-xr-xsdk-modifications/include/ds2_cpu.h57
-rw-r--r--sdk-modifications/include/ds2_cpuclock.h21
-rw-r--r--sdk-modifications/include/ds2_dma.h142
-rwxr-xr-xsdk-modifications/include/ds2_excpt.h55
-rwxr-xr-xsdk-modifications/include/ds2_fcntl.h51
-rwxr-xr-xsdk-modifications/include/ds2_malloc.h32
-rwxr-xr-xsdk-modifications/include/ds2_mmc_api.h56
-rwxr-xr-xsdk-modifications/include/ds2_timer.h50
-rwxr-xr-xsdk-modifications/include/ds2_types.h37
-rwxr-xr-xsdk-modifications/include/ds2io.h285
-rwxr-xr-xsdk-modifications/include/fat.h118
-rwxr-xr-xsdk-modifications/include/fatdir.h81
-rwxr-xr-xsdk-modifications/include/fatdir_ex.h18
-rwxr-xr-xsdk-modifications/include/fatfile.h89
-rwxr-xr-xsdk-modifications/include/fatfile_ex.h19
-rwxr-xr-xsdk-modifications/include/file_allocation_table.h64
-rwxr-xr-xsdk-modifications/include/filetime.h44
-rwxr-xr-xsdk-modifications/include/fs_api.h151
-rwxr-xr-xsdk-modifications/include/fs_cache.h118
-rwxr-xr-xsdk-modifications/include/fs_common.h116
-rwxr-xr-xsdk-modifications/include/fs_unicode.h16
-rwxr-xr-xsdk-modifications/include/mem_allocate.h47
-rwxr-xr-xsdk-modifications/include/mips.h820
-rwxr-xr-xsdk-modifications/include/mipsregs.h985
-rwxr-xr-xsdk-modifications/include/mmc_api.h56
-rwxr-xr-xsdk-modifications/include/partition.h131
-rwxr-xr-xsdk-modifications/include/tcm.h10
-rw-r--r--sdk-modifications/libsrc/Makefile70
-rw-r--r--sdk-modifications/libsrc/changes_bag.txt28
-rwxr-xr-xsdk-modifications/libsrc/console/console.c484
-rwxr-xr-xsdk-modifications/libsrc/console/console.h9
-rwxr-xr-xsdk-modifications/libsrc/console/console.mk10
-rwxr-xr-xsdk-modifications/libsrc/console/font_dot.h75
-rw-r--r--sdk-modifications/libsrc/core/core.mk11
-rw-r--r--sdk-modifications/libsrc/core/ds2_cpuclock.c272
-rw-r--r--sdk-modifications/libsrc/core/ds2_cpuclock.h22
-rw-r--r--sdk-modifications/libsrc/core/ds2_dma.c34
-rw-r--r--sdk-modifications/libsrc/core/ds2_dma.h142
-rwxr-xr-xsdk-modifications/libsrc/fs/bit_ops.h58
-rwxr-xr-xsdk-modifications/libsrc/fs/cache.c273
-rwxr-xr-xsdk-modifications/libsrc/fs/directory.c1035
-rwxr-xr-xsdk-modifications/libsrc/fs/directory.h180
-rwxr-xr-xsdk-modifications/libsrc/fs/disc_io/disc.c194
-rwxr-xr-xsdk-modifications/libsrc/fs/disc_io/disc.h128
-rwxr-xr-xsdk-modifications/libsrc/fs/disc_io/disc_io.h83
-rwxr-xr-xsdk-modifications/libsrc/fs/disc_io/io_ds2_mmcf.c13
-rwxr-xr-xsdk-modifications/libsrc/fs/disc_io/io_ds2_mmcf.h63
-rwxr-xr-xsdk-modifications/libsrc/fs/ds2_fcntl.c126
-rwxr-xr-xsdk-modifications/libsrc/fs/ds2_fcntl.h51
-rwxr-xr-xsdk-modifications/libsrc/fs/ds2_unistd.c18
-rwxr-xr-xsdk-modifications/libsrc/fs/ds2_unistd.h22
-rwxr-xr-xsdk-modifications/libsrc/fs/fat.h118
-rw-r--r--sdk-modifications/libsrc/fs/fat_misc.c140
-rwxr-xr-xsdk-modifications/libsrc/fs/fat_misc.h38
-rw-r--r--sdk-modifications/libsrc/fs/fatdir.c672
-rwxr-xr-xsdk-modifications/libsrc/fs/fatdir.h85
-rwxr-xr-xsdk-modifications/libsrc/fs/fatdir_ex.c183
-rwxr-xr-xsdk-modifications/libsrc/fs/fatdir_ex.h18
-rwxr-xr-xsdk-modifications/libsrc/fs/fatfile.c889
-rwxr-xr-xsdk-modifications/libsrc/fs/fatfile.h89
-rwxr-xr-xsdk-modifications/libsrc/fs/fatfile_ex.c47
-rwxr-xr-xsdk-modifications/libsrc/fs/fatfile_ex.h19
-rw-r--r--sdk-modifications/libsrc/fs/file_allocation_table.c330
-rwxr-xr-xsdk-modifications/libsrc/fs/file_allocation_table.h64
-rwxr-xr-xsdk-modifications/libsrc/fs/filetime.c146
-rwxr-xr-xsdk-modifications/libsrc/fs/filetime.h44
-rw-r--r--sdk-modifications/libsrc/fs/fs.mk24
-rwxr-xr-xsdk-modifications/libsrc/fs/fs_api.c452
-rwxr-xr-xsdk-modifications/libsrc/fs/fs_api.h130
-rwxr-xr-xsdk-modifications/libsrc/fs/fs_cache.h125
-rwxr-xr-xsdk-modifications/libsrc/fs/fs_common.h116
-rwxr-xr-xsdk-modifications/libsrc/fs/fs_unicode.c173
-rwxr-xr-xsdk-modifications/libsrc/fs/fs_unicode.h16
-rwxr-xr-xsdk-modifications/libsrc/fs/libfat.c174
-rwxr-xr-xsdk-modifications/libsrc/fs/mem_allocate.h47
-rwxr-xr-xsdk-modifications/libsrc/fs/partition.c501
-rwxr-xr-xsdk-modifications/libsrc/fs/partition.h131
-rwxr-xr-xsdk-modifications/libsrc/key/key.c145
-rwxr-xr-xsdk-modifications/libsrc/key/key.h31
-rwxr-xr-xsdk-modifications/libsrc/key/key.mk10
-rw-r--r--sdk-modifications/libsrc/zlib/README8
-rwxr-xr-xsdk-modifications/libsrc/zlib/adler32.c179
-rwxr-xr-xsdk-modifications/libsrc/zlib/compress.c80
-rwxr-xr-xsdk-modifications/libsrc/zlib/crc32.c447
-rwxr-xr-xsdk-modifications/libsrc/zlib/crc32.h441
-rwxr-xr-xsdk-modifications/libsrc/zlib/deflate.c1965
-rwxr-xr-xsdk-modifications/libsrc/zlib/deflate.h346
-rwxr-xr-xsdk-modifications/libsrc/zlib/gzclose.c25
-rwxr-xr-xsdk-modifications/libsrc/zlib/gzguts.h196
-rwxr-xr-xsdk-modifications/libsrc/zlib/gzlib.c564
-rwxr-xr-xsdk-modifications/libsrc/zlib/gzread.c584
-rwxr-xr-xsdk-modifications/libsrc/zlib/gzwrite.c593
-rwxr-xr-xsdk-modifications/libsrc/zlib/infback.c640
-rwxr-xr-xsdk-modifications/libsrc/zlib/inffast.c340
-rwxr-xr-xsdk-modifications/libsrc/zlib/inffast.h11
-rwxr-xr-xsdk-modifications/libsrc/zlib/inffixed.h94
-rwxr-xr-xsdk-modifications/libsrc/zlib/inflate.c1501
-rwxr-xr-xsdk-modifications/libsrc/zlib/inflate.h122
-rwxr-xr-xsdk-modifications/libsrc/zlib/inftrees.c306
-rwxr-xr-xsdk-modifications/libsrc/zlib/inftrees.h62
-rwxr-xr-xsdk-modifications/libsrc/zlib/trees.c1224
-rwxr-xr-xsdk-modifications/libsrc/zlib/trees.h128
-rwxr-xr-xsdk-modifications/libsrc/zlib/uncompr.c59
-rw-r--r--sdk-modifications/libsrc/zlib/zconf.h468
-rwxr-xr-xsdk-modifications/libsrc/zlib/zlib.h1732
-rwxr-xr-xsdk-modifications/libsrc/zlib/zlib.mk10
-rwxr-xr-xsdk-modifications/libsrc/zlib/zutil.c301
-rwxr-xr-xsdk-modifications/libsrc/zlib/zutil.h254
-rw-r--r--source.txt1
-rw-r--r--source/doc/porting.txt725
-rw-r--r--source/font/Pictochat-16.bdf2802
-rw-r--r--source/font/README.txt40
-rw-r--r--source/images/applications-system.svg247
-rw-r--r--source/images/boot.psdbin91600 -> 0 bytes
-rw-r--r--source/images/catsfc.psdbin14189 -> 0 bytes
-rw-r--r--source/images/hotkeys-preview.psdbin57903 -> 0 bytes
-rw-r--r--source/images/interface-preview.psdbin92763 -> 0 bytes
-rw-r--r--source/images/key.svg111
-rw-r--r--source/images/manage.svg391
-rw-r--r--source/images/media-flash.svg477
-rw-r--r--source/images/sbutto.svg14
-rw-r--r--source/images/slide-audio.svg158
-rw-r--r--source/images/smaini.svg14
-rw-r--r--source/images/smnsel.svg14
-rw-r--r--source/images/smsel.svg14
-rw-r--r--source/images/smsgfr.svg16
-rw-r--r--source/images/snmaini.svg14
-rw-r--r--source/images/stitle.svg11
-rw-r--r--source/images/subsela.svg14
-rw-r--r--source/images/system-log-out.svg457
-rw-r--r--source/memmap.cpp2
-rw-r--r--source/nds/bdf_font.c1086
-rw-r--r--source/nds/bdf_font.h64
-rw-r--r--source/nds/bitmap.c224
-rw-r--r--source/nds/bitmap.h111
-rw-r--r--source/nds/cheatgrp.c100
-rw-r--r--source/nds/cheatgrp.h27
-rw-r--r--source/nds/displaymodes.cpp88
-rw-r--r--source/nds/dma_adj.c26
-rw-r--r--source/nds/dma_adj.h29
-rw-r--r--source/nds/draw.c1315
-rw-r--r--source/nds/draw.h207
-rw-r--r--source/nds/ds2_main.c68
-rw-r--r--source/nds/ds2sound.h24
-rw-r--r--source/nds/entry.cpp1595
-rw-r--r--source/nds/entry.h20
-rw-r--r--source/nds/font_dot.h93
-rw-r--r--source/nds/gcheat.c128
-rw-r--r--source/nds/gcheat.h38
-rw-r--r--source/nds/gui.c4936
-rw-r--r--source/nds/gui.h202
-rw-r--r--source/nds/message.h169
-rw-r--r--source/unzip/explode.c1120
-rw-r--r--source/unzip/unreduce.c217
-rw-r--r--source/unzip/unshrink.c177
-rw-r--r--source/unzip/unz.h994
-rw-r--r--source/unzip/unzip.c1224
-rw-r--r--source/unzip/unzip.h285
-rw-r--r--source/unzip/unzipP.h125
208 files changed, 4 insertions, 49455 deletions
diff --git a/CATSFC/system/Pictochat-16.odf b/CATSFC/system/Pictochat-16.odf
deleted file mode 100644
index a52b219..0000000
--- a/CATSFC/system/Pictochat-16.odf
+++ /dev/null
Binary files differ
diff --git a/CATSFC/system/gui/backo.bmp b/CATSFC/system/gui/backo.bmp
deleted file mode 100644
index 6567f4c..0000000
--- a/CATSFC/system/gui/backo.bmp
+++ /dev/null
Binary files differ
diff --git a/CATSFC/system/gui/boot.bmp b/CATSFC/system/gui/boot.bmp
deleted file mode 100644
index b8acf01..0000000
--- a/CATSFC/system/gui/boot.bmp
+++ /dev/null
Binary files differ
diff --git a/CATSFC/system/gui/chtfile.bmp b/CATSFC/system/gui/chtfile.bmp
deleted file mode 100644
index e081093..0000000
--- a/CATSFC/system/gui/chtfile.bmp
+++ /dev/null
Binary files differ
diff --git a/CATSFC/system/gui/directory.bmp b/CATSFC/system/gui/directory.bmp
deleted file mode 100644
index b821fd1..0000000
--- a/CATSFC/system/gui/directory.bmp
+++ /dev/null
Binary files differ
diff --git a/CATSFC/system/gui/fdoto.bmp b/CATSFC/system/gui/fdoto.bmp
deleted file mode 100644
index e34482b..0000000
--- a/CATSFC/system/gui/fdoto.bmp
+++ /dev/null
Binary files differ
diff --git a/CATSFC/system/gui/nbacko.bmp b/CATSFC/system/gui/nbacko.bmp
deleted file mode 100644
index 45c37dd..0000000
--- a/CATSFC/system/gui/nbacko.bmp
+++ /dev/null
Binary files differ
diff --git a/CATSFC/system/gui/savo.bmp b/CATSFC/system/gui/savo.bmp
deleted file mode 100644
index 3263cf9..0000000
--- a/CATSFC/system/gui/savo.bmp
+++ /dev/null
Binary files differ
diff --git a/CATSFC/system/gui/sbutto.bmp b/CATSFC/system/gui/sbutto.bmp
deleted file mode 100644
index 7e907b2..0000000
--- a/CATSFC/system/gui/sbutto.bmp
+++ /dev/null
Binary files differ
diff --git a/CATSFC/system/gui/scheato.bmp b/CATSFC/system/gui/scheato.bmp
deleted file mode 100644
index 272d438..0000000
--- a/CATSFC/system/gui/scheato.bmp
+++ /dev/null
Binary files differ
diff --git a/CATSFC/system/gui/semptyo.bmp b/CATSFC/system/gui/semptyo.bmp
deleted file mode 100644
index 2dd61b4..0000000
--- a/CATSFC/system/gui/semptyo.bmp
+++ /dev/null
Binary files differ
diff --git a/CATSFC/system/gui/sexito.bmp b/CATSFC/system/gui/sexito.bmp
deleted file mode 100644
index b004d51..0000000
--- a/CATSFC/system/gui/sexito.bmp
+++ /dev/null
Binary files differ
diff --git a/CATSFC/system/gui/sfcfile.bmp b/CATSFC/system/gui/sfcfile.bmp
deleted file mode 100644
index 12ab36e..0000000
--- a/CATSFC/system/gui/sfcfile.bmp
+++ /dev/null
Binary files differ
diff --git a/CATSFC/system/gui/sfullo.bmp b/CATSFC/system/gui/sfullo.bmp
deleted file mode 100644
index ffc857e..0000000
--- a/CATSFC/system/gui/sfullo.bmp
+++ /dev/null
Binary files differ
diff --git a/CATSFC/system/gui/smaini.bmp b/CATSFC/system/gui/smaini.bmp
deleted file mode 100644
index fffdd18..0000000
--- a/CATSFC/system/gui/smaini.bmp
+++ /dev/null
Binary files differ
diff --git a/CATSFC/system/gui/smaybgo.bmp b/CATSFC/system/gui/smaybgo.bmp
deleted file mode 100644
index 138439b..0000000
--- a/CATSFC/system/gui/smaybgo.bmp
+++ /dev/null
Binary files differ
diff --git a/CATSFC/system/gui/smnsel.bmp b/CATSFC/system/gui/smnsel.bmp
deleted file mode 100644
index c608145..0000000
--- a/CATSFC/system/gui/smnsel.bmp
+++ /dev/null
Binary files differ
diff --git a/CATSFC/system/gui/smsel.bmp b/CATSFC/system/gui/smsel.bmp
deleted file mode 100644
index 9c75454..0000000
--- a/CATSFC/system/gui/smsel.bmp
+++ /dev/null
Binary files differ
diff --git a/CATSFC/system/gui/smsgfr.bmp b/CATSFC/system/gui/smsgfr.bmp
deleted file mode 100644
index e4a3646..0000000
--- a/CATSFC/system/gui/smsgfr.bmp
+++ /dev/null
Binary files differ
diff --git a/CATSFC/system/gui/snavo.bmp b/CATSFC/system/gui/snavo.bmp
deleted file mode 100644
index 4886c1e..0000000
--- a/CATSFC/system/gui/snavo.bmp
+++ /dev/null
Binary files differ
diff --git a/CATSFC/system/gui/sncheato.bmp b/CATSFC/system/gui/sncheato.bmp
deleted file mode 100644
index e171f46..0000000
--- a/CATSFC/system/gui/sncheato.bmp
+++ /dev/null
Binary files differ
diff --git a/CATSFC/system/gui/snemptyo.bmp b/CATSFC/system/gui/snemptyo.bmp
deleted file mode 100644
index 8ae8365..0000000
--- a/CATSFC/system/gui/snemptyo.bmp
+++ /dev/null
Binary files differ
diff --git a/CATSFC/system/gui/snexito.bmp b/CATSFC/system/gui/snexito.bmp
deleted file mode 100644
index 530fa43..0000000
--- a/CATSFC/system/gui/snexito.bmp
+++ /dev/null
Binary files differ
diff --git a/CATSFC/system/gui/snfullo.bmp b/CATSFC/system/gui/snfullo.bmp
deleted file mode 100644
index 1b838dc..0000000
--- a/CATSFC/system/gui/snfullo.bmp
+++ /dev/null
Binary files differ
diff --git a/CATSFC/system/gui/snmaini.bmp b/CATSFC/system/gui/snmaini.bmp
deleted file mode 100644
index 35ab559..0000000
--- a/CATSFC/system/gui/snmaini.bmp
+++ /dev/null
Binary files differ
diff --git a/CATSFC/system/gui/snother.bmp b/CATSFC/system/gui/snother.bmp
deleted file mode 100644
index 72bde2c..0000000
--- a/CATSFC/system/gui/snother.bmp
+++ /dev/null
Binary files differ
diff --git a/CATSFC/system/gui/snsaveo.bmp b/CATSFC/system/gui/snsaveo.bmp
deleted file mode 100644
index c298db0..0000000
--- a/CATSFC/system/gui/snsaveo.bmp
+++ /dev/null
Binary files differ
diff --git a/CATSFC/system/gui/sntoolo.bmp b/CATSFC/system/gui/sntoolo.bmp
deleted file mode 100644
index 10ac2b1..0000000
--- a/CATSFC/system/gui/sntoolo.bmp
+++ /dev/null
Binary files differ
diff --git a/CATSFC/system/gui/sother.bmp b/CATSFC/system/gui/sother.bmp
deleted file mode 100644
index 23017a1..0000000
--- a/CATSFC/system/gui/sother.bmp
+++ /dev/null
Binary files differ
diff --git a/CATSFC/system/gui/ssaveo.bmp b/CATSFC/system/gui/ssaveo.bmp
deleted file mode 100644
index 45cc612..0000000
--- a/CATSFC/system/gui/ssaveo.bmp
+++ /dev/null
Binary files differ
diff --git a/CATSFC/system/gui/ssubbg.bmp b/CATSFC/system/gui/ssubbg.bmp
deleted file mode 100644
index 6f4d327..0000000
--- a/CATSFC/system/gui/ssubbg.bmp
+++ /dev/null
Binary files differ
diff --git a/CATSFC/system/gui/sticon.bmp b/CATSFC/system/gui/sticon.bmp
deleted file mode 100644
index c0108f3..0000000
--- a/CATSFC/system/gui/sticon.bmp
+++ /dev/null
Binary files differ
diff --git a/CATSFC/system/gui/stitle.bmp b/CATSFC/system/gui/stitle.bmp
deleted file mode 100644
index 7b120fe..0000000
--- a/CATSFC/system/gui/stitle.bmp
+++ /dev/null
Binary files differ
diff --git a/CATSFC/system/gui/stoolo.bmp b/CATSFC/system/gui/stoolo.bmp
deleted file mode 100644
index 7600d16..0000000
--- a/CATSFC/system/gui/stoolo.bmp
+++ /dev/null
Binary files differ
diff --git a/CATSFC/system/gui/subsela.bmp b/CATSFC/system/gui/subsela.bmp
deleted file mode 100644
index 71f7458..0000000
--- a/CATSFC/system/gui/subsela.bmp
+++ /dev/null
Binary files differ
diff --git a/CATSFC/system/gui/sunnof.bmp b/CATSFC/system/gui/sunnof.bmp
deleted file mode 100644
index 5065ffa..0000000
--- a/CATSFC/system/gui/sunnof.bmp
+++ /dev/null
Binary files differ
diff --git a/CATSFC/system/gui/uicolors.txt b/CATSFC/system/gui/uicolors.txt
deleted file mode 100644
index e2e7e76..0000000
--- a/CATSFC/system/gui/uicolors.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-Background: #000000
-InactiveItem: #461F99
-ActiveItem: #FFFFFF
-MessageText: #461F99
-InactiveMain: #FFFFFF
-ActiveMain: #FFFFFF
diff --git a/CATSFC/system/gui/zipfile.bmp b/CATSFC/system/gui/zipfile.bmp
deleted file mode 100644
index 8d254ef..0000000
--- a/CATSFC/system/gui/zipfile.bmp
+++ /dev/null
Binary files differ
diff --git a/CATSFC/system/language.msg b/CATSFC/system/language.msg
deleted file mode 100644
index ef76f7d..0000000
--- a/CATSFC/system/language.msg
+++ /dev/null
@@ -1,1801 +0,0 @@
-STARTCOMMENT
-
-STARTVERSION
-1.0
-# 1. Lines starting with a # are comments.
-# 2. No line may be longer than 250 bytes. As this file is UTF-8 encoded,
-# characters above U+007F take up 2 or more bytes.
-# 3. If a line exceeds 250 characters, add the text "\n", without quotes,
-# then a newline. You may continue the text on the next line.
-# 4. See the comment line ABOVE a message for its context. For example:
-# > #MSG_MAIN_MENU_SAVED_STATES
-# > Saved states
-# 5. You may use *<Letter> in your message to insert a pictogram representing
-# a DS key. These replacements are case-sensitive.
-# Definitions are as follows:
-# *A (A Button) inserts a circle containing the letter A
-# *B (B Button) a circle containing the letter B
-# *X (X Button) a circle containing the letter X
-# *Y (Y Button) a circle containing the letter Y
-# *L (L shoulder button) a cut rectangle containing the letter L
-# *R (R shoulder button) a cut rectangle containing the letter R
-# *S (START button) a smaller ST
-# *s (SELECT button) a smaller SEL
-# *u (Up direction) an arrow pointing upwards
-# *d (Down direction) an arrow pointing downwards
-# *l (Left direction) an arrow pointing to the left
-# *r (Right direction) an arrow pointing to the right
-ENDVERSION
-
-ENDCOMMENT
-
-STARTENGLISH
-#MSG_MAIN_MENU_NEW_GAME
-New game
-#MSG_MAIN_MENU_RETURN_TO_GAME
-Return to game
-#MSG_MAIN_MENU_RESET_GAME
-Reset game
-#MSG_MAIN_MENU_VIDEO_AUDIO
-Video & audio
-#MSG_MAIN_MENU_SAVED_STATES
-Saved states
-#MSG_MAIN_MENU_CHEATS
-Cheats
-#MSG_MAIN_MENU_TOOLS
-Tools
-#MSG_MAIN_MENU_OPTIONS
-Options
-#MSG_MAIN_MENU_EXIT
-Exit
-#MSG_FILE_MENU_LOADING_LIST
-Loading...
-#MSG_FILE_MENU_SORTING_LIST
-Sorting...
-#FMT_VIDEO_AUDIO_FLUIDITY_PREFERENCE
-Fluidity %s
-#MSG_VIDEO_AUDIO_FLUIDITY_PREFER_VIDEO
-Prefer fluid video
-#MSG_VIDEO_AUDIO_FLUIDITY_PREFER_AUDIO
-Prefer fluid audio
-#FMT_VIDEO_ASPECT_RATIO
-Aspect ratio %s
-#FMT_VIDEO_FAST_FORWARD
-Fast-forward %s
-#FMT_VIDEO_FRAME_SKIPPING
-Frame skipping %s
-#FMT_VIDEO_GAME_SCREEN
-Game screen %s
-#FMT_AUDIO_SOUND
-Sound %s
-#FMT_AUDIO_RETRO_SOUND
-Retro sound %s
-#FMT_SAVED_STATE_CREATE
-Create saved state %d
-#FMT_SAVED_STATE_LOAD
-Load saved state %d
-#MSG_SAVED_STATE_DELETE_GENERAL
-Delete saved states...
-#FMT_CHEAT_PAGE
-Cheat code page %d
-#MSG_CHEAT_LOAD_FROM_FILE
-Load cheat file
-#MSG_TOOLS_SCREENSHOT_GENERAL
-Screenshots...
-#MSG_TOOLS_GLOBAL_HOTKEY_GENERAL
-Global hotkeys...
-#MSG_TOOLS_GAME_HOTKEY_GENERAL
-Game-specific hotkey overrides...
-#FMT_OPTIONS_LANGUAGE
-Language %s
-#FMT_OPTIONS_CPU_FREQUENCY
-CPU frequency %s
-#MSG_OPTIONS_CPU_FREQUENCY_0
-[0] 240 MHz
-#MSG_OPTIONS_CPU_FREQUENCY_1
-[1] 300 MHz
-#MSG_OPTIONS_CPU_FREQUENCY_2
-[2] 336 MHz
-#MSG_OPTIONS_CPU_FREQUENCY_3
-[3] 360 MHz
-#MSG_OPTIONS_CPU_FREQUENCY_4
-[4] 384 MHz
-#MSG_OPTIONS_CPU_FREQUENCY_5
-[5] 396 MHz
-#MSG_OPTIONS_CARD_CAPACITY
-Card capacity
-#MSG_OPTIONS_RESET
-Restore default settings
-#MSG_OPTIONS_VERSION
-Version information
-#MSG_SCREENSHOT_CREATE
-Save a screenshot
-#MSG_SCREENSHOT_BROWSE
-Screenshot slideshow
-#MSG_HOTKEY_MAIN_MENU
-Go to main menu
-#MSG_HOTKEY_TEMPORARY_FAST_FORWARD
-Temporary fast-forward
-#MSG_HOTKEY_SOUND_TOGGLE
-Toggle sound
-#MSG_HOTKEY_QUICK_LOAD_STATE
-Load saved state 1
-#MSG_HOTKEY_QUICK_SAVE_STATE
-Create saved state 1
-#MSG_HOTKEY_FULL_SCREEN_TOGGLE
-Toggle full-screen
-#MSG_PROGRESS_HOTKEY_WAITING_FOR_KEYS
-Press the buttons you wish to use to perform this action.
-#MSG_HOTKEY_DELETE_WITH_A
-*A Clear
-#MSG_HOTKEY_CANCEL_WITH_B
-*B Cancel
-#MSG_LOAD_GAME_RECENTLY_PLAYED
-Recently played...
-#MSG_LOAD_GAME_FROM_CARD
-Select a game...
-#MSG_LOAD_GAME_MENU_TITLE
-New game
-#MSG_VIDEO_ASPECT_RATIO_0
-[0] Entire screen
-#MSG_VIDEO_ASPECT_RATIO_1
-[1] Bottom, square pixels
-#MSG_VIDEO_ASPECT_RATIO_2
-[2] Top, square pixels
-#MSG_VIDEO_ASPECT_RATIO_3
-[3] Middle, square pixels
-#MSG_VIDEO_ASPECT_RATIO_4
-[4] Entire screen, smoothed
-#MSG_VIDEO_FRAME_SKIPPING_AUTOMATIC
-[-] Keep up with the game
-#MSG_VIDEO_FRAME_SKIPPING_0
-[0] Show all frames
-#MSG_VIDEO_FRAME_SKIPPING_1
-[1] Show 1 in 2 frames
-#MSG_VIDEO_FRAME_SKIPPING_2
-[2] Show 1 in 3 frames
-#MSG_VIDEO_FRAME_SKIPPING_3
-[3] Show 1 in 4 frames
-#MSG_VIDEO_FRAME_SKIPPING_4
-[4] Show 1 in 5 frames
-#MSG_VIDEO_FRAME_SKIPPING_5
-[5] Show 1 in 6 frames
-#MSG_VIDEO_FRAME_SKIPPING_6
-[6] Show 1 in 7 frames
-#MSG_VIDEO_FRAME_SKIPPING_7
-[7] Show 1 in 8 frames
-#MSG_VIDEO_FRAME_SKIPPING_8
-[8] Show 1 in 9 frames
-#MSG_VIDEO_FRAME_SKIPPING_9
-[9] Show 1 in 10 frames
-#MSG_VIDEO_FRAME_SKIPPING_10
-[10] Show 1 in 11 frames
-#MSG_VIDEO_GAME_SCREEN_TOP
-Upper Screen
-#MSG_VIDEO_GAME_SCREEN_BOTTOM
-Lower Screen
-#MSG_GENERAL_OFF
-Off
-#MSG_GENERAL_ON
-On
-#MSG_GENERAL_CONFIRM_WITH_A
-*A Confirm
-#MSG_GENERAL_CANCEL_WITH_B
-*B Cancel
-#MSG_AUDIO_ENABLED
-On
-#MSG_AUDIO_MUTED
-Mute
-#MSG_TOP_SCREEN_NO_GAME_LOADED
-No game is currently loaded
-#MSG_CHEAT_ELEMENT_NOT_LOADED
-<None loaded here>
-#MSG_SAVESTATE_FULL
-The current slot holds a state. Do you wish to overwrite it?
-#MSG_PROGRESS_SAVED_STATE_CREATING
-Saving state...
-#MSG_PROGRESS_SAVED_STATE_CREATION_FAILED
-Failed!
-#MSG_PROGRESS_SAVED_STATE_CREATION_SUCCEEDED
-OK!
-#MSG_TOP_SCREEN_NO_SAVED_STATE_IN_SLOT
-No saved state here
-#MSG_PROGRESS_SAVED_STATE_CORRUPTED
-The game state file is not found or is corrupt.
-#MSG_PROGRESS_SAVED_STATE_LOADING
-Loading...
-#MSG_PROGRESS_SAVED_STATE_LOAD_FAILED
-Failed!
-#MSG_PROGRESS_SAVED_STATE_LOAD_SUCCEEDED
-OK!
-#MSG_SAVED_STATE_DELETE_ALL
-Delete all saved states
-#FMT_SAVED_STATE_DELETE_ONE
-Delete saved state %d
-#MSG_DIALOG_SAVE_STATE_DELETE_ALL
-Really delete all saved states?
-#FMT_DIALOG_SAVED_STATE_DELETE_ONE
-Really delete saved state %d?
-#MSG_PROGRESS_SAVED_STATE_ALREADY_EMPTY
-There's already nothing here.
-#MSG_PROGRESS_SCREENSHOT_CREATING
-Saving a screenshot...
-#MSG_PROGRESS_SCREENSHOT_CREATION_SUCCEEDED
-OK!
-#MSG_PROGRESS_SCREENSHOT_CREATION_FAILED
-Failed!
-#MSG_NO_SLIDE
-No screenshots found
-#MSG_PLAYING_SLIDE
-Playing...
-#MSG_PAUSE_SLIDE
-Pause...
-#MSG_SCREENSHOT_SLIDESHOW_KEYS
-*u Speed up\n
-*d Slow down\n
-*l Previous image\n
-*r Next image\n
-*A Pause\n
-*B Return to the menu
-#MSG_PROGRESS_LOADING_GAME
-Loading...
-#MSG_EMULATOR_NAME
-CATSFC SNES emulator
-#MSG_WORD_EMULATOR_VERSION
-Version
-#MSG_DIALOG_RESET
-Reset all settings to defaults?
-#MSG_PROGRESS_RESETTING
-Please wait...
-
-ENDENGLISH
-
-STARTCHINESESIM
-#MSG_MAIN_MENU_NEW_GAME
-新游戏
-#MSG_MAIN_MENU_RETURN_TO_GAME
-返回游戏
-#MSG_MAIN_MENU_RESET_GAME
-重置游戏
-#MSG_MAIN_MENU_VIDEO_AUDIO
-图像声音
-#MSG_MAIN_MENU_SAVED_STATES
-存档
-#MSG_MAIN_MENU_CHEATS
-作弊器
-#MSG_MAIN_MENU_TOOLS
-工具
-#MSG_MAIN_MENU_OPTIONS
-综合设置
-#MSG_MAIN_MENU_EXIT
-退出模拟器
-#MSG_FILE_MENU_LOADING_LIST
-装载...
-#MSG_FILE_MENU_SORTING_LIST
-列表进行排序...
-#FMT_VIDEO_AUDIO_FLUIDITY_PREFERENCE
-流畅度 %s
-#MSG_VIDEO_AUDIO_FLUIDITY_PREFER_VIDEO
-视频优先
-#MSG_VIDEO_AUDIO_FLUIDITY_PREFER_AUDIO
-音频优先
-#FMT_VIDEO_ASPECT_RATIO
-画面 %s
-#FMT_VIDEO_FAST_FORWARD
-游戏快进 %s
-#FMT_VIDEO_FRAME_SKIPPING
-跳帧方式 %s
-#FMT_VIDEO_GAME_SCREEN
-游戏屏幕 %s
-#FMT_AUDIO_SOUND
-声音开关 %s
-#FMT_AUDIO_RETRO_SOUND
-Retro sound %s
-#FMT_SAVED_STATE_CREATE
-写入存档 %d
-#FMT_SAVED_STATE_LOAD
-读取存档 %d
-#MSG_SAVED_STATE_DELETE_GENERAL
-删除存档
-#FMT_CHEAT_PAGE
-作弊代码页 %d
-#MSG_CHEAT_LOAD_FROM_FILE
-加载作弊代码文件
-#MSG_TOOLS_SCREENSHOT_GENERAL
-屏幕快照
-#MSG_TOOLS_GLOBAL_HOTKEY_GENERAL
-全局热键
-#MSG_TOOLS_GAME_HOTKEY_GENERAL
-特定游戏热键
-#FMT_OPTIONS_LANGUAGE
-语言 %s
-#FMT_OPTIONS_CPU_FREQUENCY
-CPU 主频 %s
-#MSG_OPTIONS_CPU_FREQUENCY_0
-[0] 240 MHz
-#MSG_OPTIONS_CPU_FREQUENCY_1
-[1] 300 MHz
-#MSG_OPTIONS_CPU_FREQUENCY_2
-[2] 336 MHz
-#MSG_OPTIONS_CPU_FREQUENCY_3
-[3] 360 MHz
-#MSG_OPTIONS_CPU_FREQUENCY_4
-[4] 384 MHz
-#MSG_OPTIONS_CPU_FREQUENCY_5
-[5] 396 MHz
-#MSG_OPTIONS_CARD_CAPACITY
-卡带容量
-#MSG_OPTIONS_RESET
-缺省设置
-#MSG_OPTIONS_VERSION
-版本信息
-#MSG_SCREENSHOT_CREATE
-保存屏幕快照
-#MSG_SCREENSHOT_BROWSE
-浏览屏幕快照
-#MSG_HOTKEY_MAIN_MENU
-返回主菜单
-#MSG_HOTKEY_TEMPORARY_FAST_FORWARD
-临时加速
-#MSG_HOTKEY_SOUND_TOGGLE
-音频开关
-#MSG_HOTKEY_QUICK_LOAD_STATE
-读取即时存档 1
-#MSG_HOTKEY_QUICK_SAVE_STATE
-保存即时存档 1
-#MSG_HOTKEY_FULL_SCREEN_TOGGLE
-全屏开关
-#MSG_PROGRESS_HOTKEY_WAITING_FOR_KEYS
-按下你想要设置的热键组合。
-#MSG_HOTKEY_DELETE_WITH_A
-*A 清除
-#MSG_HOTKEY_CANCEL_WITH_B
-*B 取消
-#MSG_LOAD_GAME_RECENTLY_PLAYED
-最近玩过的游戏
-#MSG_LOAD_GAME_FROM_CARD
-新游戏
-#MSG_LOAD_GAME_MENU_TITLE
-装载游戏
-#MSG_VIDEO_ASPECT_RATIO_0
-显示模式 0
-#MSG_VIDEO_ASPECT_RATIO_1
-显示模式 1
-#MSG_VIDEO_ASPECT_RATIO_2
-显示模式 2
-#MSG_VIDEO_ASPECT_RATIO_3
-显示模式 3
-#MSG_VIDEO_ASPECT_RATIO_4
-显示模式 4
-#MSG_VIDEO_FRAME_SKIPPING_AUTOMATIC
-[-] 和游戏同步
-#MSG_VIDEO_FRAME_SKIPPING_0
-[0] 不跳帧
-#MSG_VIDEO_FRAME_SKIPPING_1
-[1] 显示 1/2
-#MSG_VIDEO_FRAME_SKIPPING_2
-[2] 显示 1/3
-#MSG_VIDEO_FRAME_SKIPPING_3
-[3] 显示 1/4
-#MSG_VIDEO_FRAME_SKIPPING_4
-[4] 显示 1/5
-#MSG_VIDEO_FRAME_SKIPPING_5
-[5] 显示 1/6
-#MSG_VIDEO_FRAME_SKIPPING_6
-[6] 显示 1/7
-#MSG_VIDEO_FRAME_SKIPPING_7
-[7] 显示 1/8
-#MSG_VIDEO_FRAME_SKIPPING_8
-[8] 显示 1/9
-#MSG_VIDEO_FRAME_SKIPPING_9
-[9] 显示 1/10
-#MSG_VIDEO_FRAME_SKIPPING_10
-[10] 显示 1/11
-#MSG_VIDEO_GAME_SCREEN_TOP
-上屏
-#MSG_VIDEO_GAME_SCREEN_BOTTOM
-下屏
-#MSG_GENERAL_OFF
-关
-#MSG_GENERAL_ON
-开
-#MSG_GENERAL_CONFIRM_WITH_A
-*A 确认
-#MSG_GENERAL_CANCEL_WITH_B
-*B 取消
-#MSG_AUDIO_ENABLED
-开
-#MSG_AUDIO_MUTED
-静音
-#MSG_TOP_SCREEN_NO_GAME_LOADED
-没有加载游戏
-#MSG_CHEAT_ELEMENT_NOT_LOADED
-<没有加载>
-#MSG_SAVESTATE_FULL
-当前存档槽已有存档文件,覆盖现有存档吗?
-#MSG_PROGRESS_SAVED_STATE_CREATING
-正在写入...
-#MSG_PROGRESS_SAVED_STATE_CREATION_FAILED
-存档写入失败!
-#MSG_PROGRESS_SAVED_STATE_CREATION_SUCCEEDED
-存档写入成功!
-#MSG_TOP_SCREEN_NO_SAVED_STATE_IN_SLOT
-没有游戏截图
-#MSG_PROGRESS_SAVED_STATE_CORRUPTED
-存档文件不存在或者已损坏!
-#MSG_PROGRESS_SAVED_STATE_LOADING
-正在加载...
-#MSG_PROGRESS_SAVED_STATE_LOAD_FAILED
-存档加载失败
-#MSG_PROGRESS_SAVED_STATE_LOAD_SUCCEEDED
-存档加载成功
-#MSG_SAVED_STATE_DELETE_ALL
-删除当前游戏的所有存档
-#FMT_SAVED_STATE_DELETE_ONE
-删除当前游戏的一个存档 %d
-#MSG_DIALOG_SAVED_STATE_DELETE_ALL
-确定要删除所有存档吗?
-#FMT_DIALOG_SAVED_STATE_DELETE_ONE
-确定要删除存档槽 %d 的存档吗?
-#MSG_PROGRESS_SAVED_STATE_ALREADY_EMPTY
-没有存档可删除
-#MSG_PROGRESS_SCREENSHOT_CREATING
-正在保存屏幕快照...
-#MSG_PROGRESS_SCREENSHOT_CREATION_SUCCEEDED
-完成!
-#MSG_PROGRESS_SCREENSHOT_CREATION_FAILED
-失败!
-#MSG_NO_SLIDE
-此目录没有屏幕快照,取消放映
-#MSG_PLAYING_SLIDE
-正在播放
-#MSG_PAUSE_SLIDE
-已暂停
-#MSG_SCREENSHOT_SLIDESHOW_KEYS
-*u 加快播放\n
-*d 减慢播放\n
-*l 上一帧 \n
-*r 下一帧 \n
-*A 暂停 \n
-*B 返回菜单
-#MSG_PROGRESS_LOADING_GAME
-正在装载游戏...
-#MSG_EMULATOR_NAME
-SFC 模拟器
-#MSG_WORD_EMULATOR_VERSION
-版本
-#MSG_DIALOG_RESET
-确定将 SFC 模拟器恢复为出厂设置吗?
-#MSG_PROGRESS_RESETTING
-正在设置,请稍候...
-
-ENDCHINESESIM
-
-STARTFRENCH
-#MSG_MAIN_MENU_NEW_GAME
-Nouveau jeu
-#MSG_MAIN_MENU_RETURN_TO_GAME
-Retour au jeu
-#MSG_MAIN_MENU_RESET_GAME
-Redémarrer jeu
-#MSG_MAIN_MENU_VIDEO_AUDIO
-Vidéo & audio
-#MSG_MAIN_MENU_SAVED_STATES
-Sauvegardes
-#MSG_MAIN_MENU_CHEATS
-Triche
-#MSG_MAIN_MENU_TOOLS
-Outils
-#MSG_MAIN_MENU_OPTIONS
-Options
-#MSG_MAIN_MENU_EXIT
-Quitter
-#MSG_FILE_MENU_LOADING_LIST
-Chargement...
-#MSG_FILE_MENU_SORTING_LIST
-Tri...
-#FMT_VIDEO_AUDIO_FLUIDITY_PREFERENCE
-Fluidité %s
-#MSG_VIDEO_AUDIO_FLUIDITY_PREFER_VIDEO
-Préférer la vidéo fluide
-#MSG_VIDEO_AUDIO_FLUIDITY_PREFER_AUDIO
-Préférer l'audio fluide
-#FMT_VIDEO_ASPECT_RATIO
-Format d'image %s
-#FMT_VIDEO_FAST_FORWARD
-Avance rapide %s
-#FMT_VIDEO_FRAME_SKIPPING
-Omission d'images %s
-#FMT_VIDEO_GAME_SCREEN
-Écran de jeu %s
-#FMT_AUDIO_SOUND
-Son %s
-#FMT_AUDIO_RETRO_SOUND
-Son rétro %s
-#FMT_SAVED_STATE_CREATE
-Créer la sauvegarde %d
-#FMT_SAVED_STATE_LOAD
-Charger la sauvegarde %d
-#MSG_SAVED_STATE_DELETE_GENERAL
-Supprimer une/des sauvegardes...
-#FMT_CHEAT_PAGE
-Page de codes de triche : %d
-#MSG_CHEAT_LOAD_FROM_FILE
-Charger un fichier de triche
-#MSG_TOOLS_SCREENSHOT_GENERAL
-Captures d'écran...
-#MSG_TOOLS_GLOBAL_HOTKEY_GENERAL
-Raccourcis globaux...
-#MSG_TOOLS_GAME_HOTKEY_GENERAL
-Raccourcis pour le jeu actuel...
-#FMT_OPTIONS_LANGUAGE
-Langue %s
-#FMT_OPTIONS_CPU_FREQUENCY
-Fréquence CPU %s
-#MSG_OPTIONS_CPU_FREQUENCY_0
-[0] 240 MHz
-#MSG_OPTIONS_CPU_FREQUENCY_1
-[1] 300 MHz
-#MSG_OPTIONS_CPU_FREQUENCY_2
-[2] 336 MHz
-#MSG_OPTIONS_CPU_FREQUENCY_3
-[3] 360 MHz
-#MSG_OPTIONS_CPU_FREQUENCY_4
-[4] 384 MHz
-#MSG_OPTIONS_CPU_FREQUENCY_5
-[5] 396 MHz
-#MSG_OPTIONS_CARD_CAPACITY
-Capacité de la carte
-#MSG_OPTIONS_RESET
-Remettre les paramètres à zéro
-#MSG_OPTIONS_VERSION
-Version
-#MSG_SCREENSHOT_CREATE
-Créer une capture d'écran
-#MSG_SCREENSHOT_BROWSE
-Diaporama de captures d'écran
-#MSG_HOTKEY_MAIN_MENU
-Menu principal
-#MSG_HOTKEY_TEMPORARY_FAST_FORWARD
-Avance rapide temporaire
-#MSG_HOTKEY_SOUND_TOGGLE
-(Dés)activer le son
-#MSG_HOTKEY_QUICK_LOAD_STATE
-Charger la sauvegarde 1
-#MSG_HOTKEY_QUICK_SAVE_STATE
-Créer la sauvegarde 1
-#MSG_HOTKEY_FULL_SCREEN_TOGGLE
-(Dés)activer le plein écran
-#MSG_PROGRESS_HOTKEY_WAITING_FOR_KEYS
-Appuyez sur les boutons que vous voulez utiliser pour effectuer cette action.
-#MSG_HOTKEY_DELETE_WITH_A
-*A Effacer
-#MSG_HOTKEY_CANCEL_WITH_B
-*B Annuler
-#MSG_LOAD_GAME_RECENTLY_PLAYED
-Récemment joués...
-#MSG_LOAD_GAME_FROM_CARD
-Sélectionner un jeu...
-#MSG_LOAD_GAME_MENU_TITLE
-Nouveau jeu
-#MSG_VIDEO_ASPECT_RATIO_0
-[0] Écran entier
-#MSG_VIDEO_ASPECT_RATIO_1
-[1] Bas, pixels carrés
-#MSG_VIDEO_ASPECT_RATIO_2
-[2] Haut, pixels carrés
-#MSG_VIDEO_ASPECT_RATIO_3
-[3] Milieu, pixels carrés
-#MSG_VIDEO_ASPECT_RATIO_4
-[4] Écran entier lissé
-#MSG_VIDEO_FRAME_SKIPPING_AUTOMATIC
-[-] Suivre le jeu
-#MSG_VIDEO_FRAME_SKIPPING_0
-[0] N'omettre aucune image
-#MSG_VIDEO_FRAME_SKIPPING_1
-[1] Montrer 1 image sur 2
-#MSG_VIDEO_FRAME_SKIPPING_2
-[2] Montrer 1 image sur 3
-#MSG_VIDEO_FRAME_SKIPPING_3
-[3] Montrer 1 image sur 4
-#MSG_VIDEO_FRAME_SKIPPING_4
-[4] Montrer 1 image sur 5
-#MSG_VIDEO_FRAME_SKIPPING_5
-[5] Montrer 1 image sur 6
-#MSG_VIDEO_FRAME_SKIPPING_6
-[6] Montrer 1 image sur 7
-#MSG_VIDEO_FRAME_SKIPPING_7
-[7] Montrer 1 image sur 8
-#MSG_VIDEO_FRAME_SKIPPING_8
-[8] Montrer 1 image sur 9
-#MSG_VIDEO_FRAME_SKIPPING_9
-[9] Montrer 1 image sur 10
-#MSG_VIDEO_FRAME_SKIPPING_10
-[10] Montrer 1 image sur 11
-#MSG_VIDEO_GAME_SCREEN_TOP
-Écran supérieur
-#MSG_VIDEO_GAME_SCREEN_BOTTOM
-Écran inférieur
-#MSG_GENERAL_OFF
-Hors fonction
-#MSG_GENERAL_ON
-En fonction
-#MSG_GENERAL_CONFIRM_WITH_A
-*A Confirmer
-#MSG_GENERAL_CANCEL_WITH_B
-*B Annuler
-#MSG_AUDIO_ENABLED
-Activé
-#MSG_AUDIO_MUTED
-Muet
-#MSG_TOP_SCREEN_NO_GAME_LOADED
-Aucun jeu n'est actuellement chargé
-#MSG_CHEAT_ELEMENT_NOT_LOADED
-<Aucun chargé ici>
-#MSG_SAVESTATE_FULL
-Il y a une sauvegarde dans cet emplacement. Voulez-vous l'écraser?
-#MSG_PROGRESS_SAVED_STATE_CREATING
-Sauvegarde en cours...
-#MSG_PROGRESS_SAVED_STATE_CREATION_FAILED
-Échec!
-#MSG_PROGRESS_SAVED_STATE_CREATION_SUCCEEDED
-Terminé!
-#MSG_TOP_SCREEN_NO_SAVED_STATE_IN_SLOT
-Aucune sauvegarde ici
-#MSG_PROGRESS_SAVED_STATE_CORRUPTED
-Le fichier de sauvegarde est introuvable ou corrompu.
-#MSG_PROGRESS_SAVED_STATE_LOADING
-Chargement en cours...
-#MSG_PROGRESS_SAVED_STATE_LOAD_FAILED
-Échec!
-#MSG_PROGRESS_SAVED_STATE_LOAD_SUCCEEDED
-Terminé!
-#MSG_SAVED_STATE_DELETE_ALL
-Supprimer toutes les sauvegardes
-#FMT_SAVED_STATE_DELETE_ONE
-Supprimer l'emplacement %d
-#MSG_DIALOG_SAVE_STATE_DELETE_ALL
-Supprimer toutes les sauvegardes?
-#FMT_DIALOG_SAVED_STATE_DELETE_ONE
-Supprimer l'emplacement %d?
-#MSG_PROGRESS_SAVED_STATE_ALREADY_EMPTY
-Cet emplacement est déjà vide.
-#MSG_PROGRESS_SCREENSHOT_CREATING
-Capture de l'écran...
-#MSG_PROGRESS_SCREENSHOT_CREATION_SUCCEEDED
-Terminé!
-#MSG_PROGRESS_SCREENSHOT_CREATION_FAILED
-Échec!
-#MSG_NO_SLIDE
-Aucune capture d'écran trouvée
-#MSG_PLAYING_SLIDE
-En cours...
-#MSG_PAUSE_SLIDE
-Pause...
-#MSG_SCREENSHOT_SLIDESHOW_KEYS
-*u Accélérer\n
-*d Ralentir\n
-*l Précédente\n
-*r Suivante\n
-*A Pause\n
-*B Retour au menu
-#MSG_PROGRESS_LOADING_GAME
-Chargement...
-#MSG_EMULATOR_NAME
-Émulateur SNES CATSFC
-#MSG_WORD_EMULATOR_VERSION
-Version
-#MSG_DIALOG_RESET
-Remettre tous les paramètres à zéro?
-#MSG_PROGRESS_RESETTING
-Veuillez patienter...
-
-ENDFRENCH
-
-STARTGERMAN
-
-#MSG_MAIN_MENU_NEW_GAME
-Neues Spiel
-#MSG_MAIN_MENU_RETURN_TO_GAME
-Zurück zum Spiel
-#MSG_MAIN_MENU_RESET_GAME
-Reset
-#MSG_MAIN_MENU_VIDEO_AUDIO
-Video & Audio
-#MSG_MAIN_MENU_SAVED_STATES
-Spielstände
-#MSG_MAIN_MENU_CHEATS
-Cheats
-#MSG_MAIN_MENU_TOOLS
-Tools
-#MSG_MAIN_MENU_OPTIONS
-Optionen
-#MSG_MAIN_MENU_EXIT
-Beenden
-#MSG_FILE_MENU_LOADING_LIST
-Laden...
-#MSG_FILE_MENU_SORTING_LIST
-Sortieren...
-#FMT_VIDEO_AUDIO_FLUIDITY_PREFERENCE
-Flüssigkeit %s
-#MSG_VIDEO_AUDIO_FLUIDITY_PREFER_VIDEO
-Bevorzuge flüssiges Video
-#MSG_VIDEO_AUDIO_FLUIDITY_PREFER_AUDIO
-Bevorzuge flüssiges Audio
-#FMT_VIDEO_ASPECT_RATIO
-Bildformat %s
-#FMT_VIDEO_FAST_FORWARD
-Schnellvorlauf %s
-#FMT_VIDEO_FRAME_SKIPPING
-Frames übersp. %s
-#FMT_VIDEO_GAME_SCREEN
-Bildschirm %s
-#FMT_AUDIO_SOUND
-Ton %s
-#FMT_AUDIO_RETRO_SOUND
-Retro-Ton %s
-#FMT_SAVED_STATE_CREATE
-Speicherstand erstellen %d
-#FMT_SAVED_STATE_LOAD
-Speicherstand laden %d
-#MSG_SAVED_STATE_DELETE_GENERAL
-Speicherstände löschen...
-#FMT_CHEAT_PAGE
-Cheatseite %d
-#MSG_CHEAT_LOAD_FROM_FILE
-Cheatdatei laden
-#MSG_TOOLS_SCREENSHOT_GENERAL
-Screenshots...
-#MSG_TOOLS_GLOBAL_HOTKEY_GENERAL
-Globale Hotkeys...
-#MSG_TOOLS_GAME_HOTKEY_GENERAL
-Spielspezifische Hotkeys...
-#FMT_OPTIONS_LANGUAGE
-Sprache %s
-#FMT_OPTIONS_CPU_FREQUENCY
-CPU Frequenz %s
-#MSG_OPTIONS_CPU_FREQUENCY_0
-[0] 240 MHz
-#MSG_OPTIONS_CPU_FREQUENCY_1
-[1] 300 MHz
-#MSG_OPTIONS_CPU_FREQUENCY_2
-[2] 336 MHz
-#MSG_OPTIONS_CPU_FREQUENCY_3
-[3] 360 MHz
-#MSG_OPTIONS_CPU_FREQUENCY_4
-[4] 384 MHz
-#MSG_OPTIONS_CPU_FREQUENCY_5
-[5] 396 MHz
-#MSG_OPTIONS_CARD_CAPACITY
-Kartengröße
-#MSG_OPTIONS_RESET
-Werkseinstellungen
-#MSG_OPTIONS_VERSION
-Versionsinformation
-#MSG_SCREENSHOT_CREATE
-Screenshot speichern
-#MSG_SCREENSHOT_BROWSE
-Screenshots durchsuchen
-#MSG_HOTKEY_MAIN_MENU
-Hauptmenü
-#MSG_HOTKEY_TEMPORARY_FAST_FORWARD
-Temp. Schnellvorlauf
-#MSG_HOTKEY_SOUND_TOGGLE
-Audio umschalten
-#MSG_HOTKEY_QUICK_LOAD_STATE
-Speicherstand 1 laden
-#MSG_HOTKEY_QUICK_SAVE_STATE
-Speicherstand 1 erstellen
-#MSG_HOTKEY_FULL_SCREEN_TOGGLE
-Vollbild umschalten
-#MSG_PROGRESS_HOTKEY_WAITING_FOR_KEYS
-Knöpfe für dieses Ereignis drücken.
-#MSG_HOTKEY_DELETE_WITH_A
-*A Löschen
-#MSG_HOTKEY_CANCEL_WITH_B
-*B Abbrechen
-#MSG_LOAD_GAME_RECENTLY_PLAYED
-Zuletzt gespielt...
-#MSG_LOAD_GAME_FROM_CARD
-Wähle ein Spiel
-#MSG_LOAD_GAME_MENU_TITLE
-Neues Spiel
-#MSG_VIDEO_ASPECT_RATIO_0
-[0] Vollbild
-#MSG_VIDEO_ASPECT_RATIO_1
-[1] Unten, quadratische Pixel
-#MSG_VIDEO_ASPECT_RATIO_2
-[2] Oben, quadratische Pixel
-#MSG_VIDEO_ASPECT_RATIO_3
-[3] Mitte, quadratische Pixel
-#MSG_VIDEO_ASPECT_RATIO_4
-[4] Vollbild, geglättet
-#MSG_VIDEO_FRAME_SKIPPING_AUTOMATIC
-[-] Automatisch
-#MSG_VIDEO_FRAME_SKIPPING_0
-[0] Alle Frames anzeigen
-#MSG_VIDEO_FRAME_SKIPPING_1
-[1] Zeige 1 von 2 Frames
-#MSG_VIDEO_FRAME_SKIPPING_2
-[2] Zeige 1 von 3 Frames
-#MSG_VIDEO_FRAME_SKIPPING_3
-[3] Zeige 1 von 4 Frames
-#MSG_VIDEO_FRAME_SKIPPING_4
-[4] Zeige 1 von 5 Frames
-#MSG_VIDEO_FRAME_SKIPPING_5
-[5] Zeige 1 von 6 Frames
-#MSG_VIDEO_FRAME_SKIPPING_6
-[6] Zeige 1 von 7 Frames
-#MSG_VIDEO_FRAME_SKIPPING_7
-[7] Zeige 1 von 8 Frames
-#MSG_VIDEO_FRAME_SKIPPING_8
-[8] Zeige 1 von 9 Frames
-#MSG_VIDEO_FRAME_SKIPPING_9
-[9] Zeige 1 von 10 Frames
-#MSG_VIDEO_FRAME_SKIPPING_10
-[10] Zeige 1 von 11 Frames
-#MSG_VIDEO_GAME_SCREEN_TOP
-Oberer Bildschirm
-#MSG_VIDEO_GAME_SCREEN_BOTTOM
-Unterer Bildschirm
-#MSG_GENERAL_OFF
-Aus
-#MSG_GENERAL_ON
-An
-#MSG_GENERAL_CONFIRM_WITH_A
-*A Bestätigen
-#MSG_GENERAL_CANCEL_WITH_B
-*B Abbrechen
-#MSG_AUDIO_ENABLED
-An
-#MSG_AUDIO_MUTED
-Stumm
-#MSG_TOP_SCREEN_NO_GAME_LOADED
-Kein Spiel geladen
-#MSG_CHEAT_ELEMENT_NOT_LOADED
-<Nichts geladen>
-#MSG_SAVESTATE_FULL
-An dieser Stelle existiert bereits ein Speicherstand. Überschreiben?
-#MSG_PROGRESS_SAVED_STATE_CREATING
-Speichern...
-#MSG_PROGRESS_SAVED_STATE_CREATION_FAILED
-Fehlgeschlagen!
-#MSG_PROGRESS_SAVED_STATE_CREATION_SUCCEEDED
-OK!
-#MSG_TOP_SCREEN_NO_SAVED_STATE_IN_SLOT
-Kein Speicherstand
-#MSG_PROGRESS_SAVED_STATE_CORRUPTED
-Der Speicherstand ist nicht vorhanden oder kaputt.
-#MSG_PROGRESS_SAVED_STATE_LOADING
-Laden...
-#MSG_PROGRESS_SAVED_STATE_LOAD_FAILED
-Fehlgeschlagen!
-#MSG_PROGRESS_SAVED_STATE_LOAD_SUCCEEDED
-OK!
-#MSG_SAVED_STATE_DELETE_ALL
-Alle Speicherstände löschen
-#FMT_SAVED_STATE_DELETE_ONE
-Lösche Speicherstand %d
-#MSG_DIALOG_SAVE_STATE_DELETE_ALL
-Wirklich alle Speicherstände löschen?
-#FMT_DIALOG_SAVED_STATE_DELETE_ONE
-Wirklich Speicherstand %d löschen?
-#MSG_PROGRESS_SAVED_STATE_ALREADY_EMPTY
-Hier ist bereits nichts.
-#MSG_PROGRESS_SCREENSHOT_CREATING
-Speichere Screenshot...
-#MSG_PROGRESS_SCREENSHOT_CREATION_SUCCEEDED
-OK!
-#MSG_PROGRESS_SCREENSHOT_CREATION_FAILED
-Fehlgeschlagen!
-#MSG_NO_SLIDE
-Keine Screenshots gefunden
-#MSG_PLAYING_SLIDE
-Zeigen...
-#MSG_PAUSE_SLIDE
-Pause...
-#MSG_SCREENSHOT_SLIDESHOW_KEYS
-*u Geschw. hoch\n
-*d Geschw. runter\n
-*l Voriges Bild\n
-*r Nächstes Bild\n
-*A Pause\n
-*B Zurück zum Menü
-#MSG_PROGRESS_LOADING_GAME
-Laden...
-#MSG_EMULATOR_NAME
-CATSFC SNES emulator
-#MSG_WORD_EMULATOR_VERSION
-Version
-#MSG_DIALOG_RESET
-Alle Einstellungen zurücksetzen?
-#MSG_PROGRESS_RESETTING
-Bitte warten...
-
-ENDGERMAN
-
-STARTDUTCH
-
-#MSG_MAIN_MENU_NEW_GAME
-Nieuw spel
-#MSG_MAIN_MENU_RETURN_TO_GAME
-Terug naar spel
-#MSG_MAIN_MENU_RESET_GAME
-Herstart spel
-#MSG_MAIN_MENU_VIDEO_AUDIO
-Video & audio
-#MSG_MAIN_MENU_SAVED_STATES
-Spelstaten
-#MSG_MAIN_MENU_CHEATS
-Valsspelen
-#MSG_MAIN_MENU_TOOLS
-Hulpmiddelen
-#MSG_MAIN_MENU_OPTIONS
-Opties
-#MSG_MAIN_MENU_EXIT
-Afsluiten
-#MSG_FILE_MENU_LOADING_LIST
-Laden...
-#MSG_FILE_MENU_SORTING_LIST
-Sorteren...
-#FMT_VIDEO_AUDIO_FLUIDITY_PREFERENCE
-Fluïditeit %s
-#MSG_VIDEO_AUDIO_FLUIDITY_PREFER_VIDEO
-Prefereer fluïde video
-#MSG_VIDEO_AUDIO_FLUIDITY_PREFER_AUDIO
-Prefereer fluïde audio
-#FMT_VIDEO_ASPECT_RATIO
-Beeldverhouding %s
-#FMT_VIDEO_FAST_FORWARD
-Vooruitspoelen %s
-#FMT_VIDEO_FRAME_SKIPPING
-Beeld overslaan %s
-#FMT_VIDEO_GAME_SCREEN
-Spelscherm %s
-#FMT_AUDIO_SOUND
-Geluid %s
-#FMT_AUDIO_RETRO_SOUND
-Retro geluid %s
-#FMT_SAVED_STATE_CREATE
-Creëer spelstaat %d
-#FMT_SAVED_STATE_LOAD
-Laad spelstaat %d
-#MSG_SAVED_STATE_DELETE_GENERAL
-Verwijder spelstaten...
-#FMT_CHEAT_PAGE
-Valsspeelpagina %d
-#MSG_CHEAT_LOAD_FROM_FILE
-Laad valsspeelbestand
-#MSG_TOOLS_SCREENSHOT_GENERAL
-Beeldschermafdrukken...
-#MSG_TOOLS_GLOBAL_HOTKEY_GENERAL
-Globale sneltoetsen...
-#MSG_TOOLS_GAME_HOTKEY_GENERAL
-Spel-specifieke sneltoetsen...
-#FMT_OPTIONS_LANGUAGE
-Taal %s
-#FMT_OPTIONS_CPU_FREQUENCY
-CPU frequentie %s
-#MSG_OPTIONS_CPU_FREQUENCY_0
-[0] 240 MHz
-#MSG_OPTIONS_CPU_FREQUENCY_1
-[1] 300 MHz
-#MSG_OPTIONS_CPU_FREQUENCY_2
-[2] 336 MHz
-#MSG_OPTIONS_CPU_FREQUENCY_3
-[3] 360 MHz
-#MSG_OPTIONS_CPU_FREQUENCY_4
-[4] 384 MHz
-#MSG_OPTIONS_CPU_FREQUENCY_5
-[5] 396 MHz
-#MSG_OPTIONS_CARD_CAPACITY
-Kaartcapaciteit
-#MSG_OPTIONS_RESET
-Herstel standaardinstellingen
-#MSG_OPTIONS_VERSION
-Versie-informatie
-#MSG_SCREENSHOT_CREATE
-Maak beeldschermafdruk
-#MSG_SCREENSHOT_BROWSE
-Diavoorstelling
-#MSG_HOTKEY_MAIN_MENU
-Ga naar het hoofdmenu
-#MSG_HOTKEY_TEMPORARY_FAST_FORWARD
-Tijdelijk vooruitspoelen
-#MSG_HOTKEY_SOUND_TOGGLE
-Schakel geluid aan/uit
-#MSG_HOTKEY_QUICK_LOAD_STATE
-Laad spelstaat 1
-#MSG_HOTKEY_QUICK_SAVE_STATE
-Sla spelstaat 1 op
-#MSG_HOTKEY_FULL_SCREEN_TOGGLE
-Schakel naar volledig scherm
-#MSG_PROGRESS_HOTKEY_WAITING_FOR_KEYS
-Druk op de gewenste toetsencombinatie.
-#MSG_HOTKEY_DELETE_WITH_A
-*A Wissen
-#MSG_HOTKEY_CANCEL_WITH_B
-*B Annuleren
-#MSG_LOAD_GAME_RECENTLY_PLAYED
-Recent gespeelde spellen...
-#MSG_LOAD_GAME_FROM_CARD
-Selecteer een spel...
-#MSG_LOAD_GAME_MENU_TITLE
-Nieuw spel
-#MSG_VIDEO_ASPECT_RATIO_0
-[0] Volledig scherm
-#MSG_VIDEO_ASPECT_RATIO_1
-[1] Onder, vierkante pixels
-#MSG_VIDEO_ASPECT_RATIO_2
-[2] Boven, vierkante pixels
-#MSG_VIDEO_ASPECT_RATIO_3
-[3] Midden, vierkante pixels
-#MSG_VIDEO_ASPECT_RATIO_4
-[4] Volledig scherm, glad
-#MSG_VIDEO_FRAME_SKIPPING_AUTOMATIC
-[-] Speltempo bijhouden
-#MSG_VIDEO_FRAME_SKIPPING_0
-[0] Toon alle beelden
-#MSG_VIDEO_FRAME_SKIPPING_1
-[1] 1 uit 2 beelden tonen
-#MSG_VIDEO_FRAME_SKIPPING_2
-[2] 1 uit 3 beelden tonen
-#MSG_VIDEO_FRAME_SKIPPING_3
-[3] 1 uit 4 beelden tonen
-#MSG_VIDEO_FRAME_SKIPPING_4
-[4] 1 uit 5 beelden tonen
-#MSG_VIDEO_FRAME_SKIPPING_5
-[5] 1 uit 6 beelden tonen
-#MSG_VIDEO_FRAME_SKIPPING_6
-[6] 1 uit 7 beelden tonen
-#MSG_VIDEO_FRAME_SKIPPING_7
-[7] 1 uit 8 beelden tonen
-#MSG_VIDEO_FRAME_SKIPPING_8
-[8] 1 uit 9 beelden tonen
-#MSG_VIDEO_FRAME_SKIPPING_9
-[9] 1 uit 10 beelden tonen
-#MSG_VIDEO_FRAME_SKIPPING_10
-[10] 1 uit 11 beelden tonen
-#MSG_VIDEO_GAME_SCREEN_TOP
-Bovenste scherm
-#MSG_VIDEO_GAME_SCREEN_BOTTOM
-Onderste scherm
-#MSG_GENERAL_OFF
-Uit
-#MSG_GENERAL_ON
-Aan
-#MSG_GENERAL_CONFIRM_WITH_A
-*A Bevestig
-#MSG_GENERAL_CANCEL_WITH_B
-*B Annuleer
-#MSG_AUDIO_ENABLED
-Aan
-#MSG_AUDIO_MUTED
-Gedempt
-#MSG_TOP_SCREEN_NO_GAME_LOADED
-Er is geen spel geladen!
-#MSG_CHEAT_ELEMENT_NOT_LOADED
-<Leeg>
-#MSG_SAVESTATE_FULL
-Het huidige slot bevat al een spelstaat. Deze spelstaat overschrijven?
-#MSG_PROGRESS_SAVED_STATE_CREATING
-Opslaan...
-#MSG_PROGRESS_SAVED_STATE_CREATION_FAILED
-Opslaan mislukt!
-#MSG_PROGRESS_SAVED_STATE_CREATION_SUCCEEDED
-Opslaan geslaagd!
-#MSG_TOP_SCREEN_NO_SAVED_STATE_IN_SLOT
-Geen spelstaat in slot.
-#MSG_PROGRESS_SAVED_STATE_CORRUPTED
-Staat niet gevonden of corrupt.
-#MSG_PROGRESS_SAVED_STATE_LOADING
-Laden...
-#MSG_PROGRESS_SAVED_STATE_LOAD_FAILED
-Laden mislukt!
-#MSG_PROGRESS_SAVED_STATE_LOAD_SUCCEEDED
-Laden geslaagd!
-#MSG_SAVED_STATE_DELETE_ALL
-Verwijder alle spelstaten
-#FMT_SAVED_STATE_DELETE_ONE
-Verwijder spelstaat %d
-#MSG_DIALOG_SAVE_STATE_DELETE_ALL
-Werkelijk alle spelstaten verwijderen?
-#FMT_DIALOG_SAVED_STATE_DELETE_ONE
-Werkelijk spelstaat %d verwijderen?
-#MSG_PROGRESS_SAVED_STATE_ALREADY_EMPTY
-De spelstaat is al leeg.
-#MSG_PROGRESS_SCREENSHOT_CREATING
-Beeldschermafdruk opslaan...
-#MSG_PROGRESS_SCREENSHOT_CREATION_SUCCEEDED
-Opslaan geslaagd!
-#MSG_PROGRESS_SCREENSHOT_CREATION_FAILED
-Opslaan mislukt!
-#MSG_NO_SLIDE
-Geen beeldschermafdrukken gevonden.
-#MSG_PLAYING_SLIDE
-Aan het afspelen...
-#MSG_PAUSE_SLIDE
-Pauzeren...
-#MSG_SCREENSHOT_SLIDESHOW_KEYS
-*u Sneller\n
-*d Langzamer\n
-*l Vorige afbeelding\n
-*r Volgende afbeelding\n
-*A Pauzeren\n
-*B Terug naar het menu
-#MSG_PROGRESS_LOADING_GAME
-Laden...
-#MSG_EMULATOR_NAME
-CATSFC SNES emulator
-#MSG_WORD_EMULATOR_VERSION
-Versie
-#MSG_DIALOG_RESET
-Alle standaardinstellingen herstellen?
-#MSG_PROGRESS_RESETTING
-Even geduld A.U.B.
-
-ENDDUTCH
-
-STARTSPANISH
-
-#MSG_MAIN_MENU_NEW_GAME
-Nuevo juego
-#MSG_MAIN_MENU_RETURN_TO_GAME
-Volver al juego
-#MSG_MAIN_MENU_RESET_GAME
-Reiniciar juego
-#MSG_MAIN_MENU_VIDEO_AUDIO
-Vídeo y audio
-#MSG_MAIN_MENU_SAVED_STATES
-Partidas
-#MSG_MAIN_MENU_CHEATS
-Trucos
-#MSG_MAIN_MENU_TOOLS
-Herramientas
-#MSG_MAIN_MENU_OPTIONS
-Opciones
-#MSG_MAIN_MENU_EXIT
-Salir
-#MSG_FILE_MENU_LOADING_LIST
-Cargando...
-#MSG_FILE_MENU_SORTING_LIST
-Ordenando...
-#FMT_VIDEO_AUDIO_FLUIDITY_PREFERENCE
-Fluidez %s
-#MSG_VIDEO_AUDIO_FLUIDITY_PREFER_VIDEO
-Vídeo fluido
-#MSG_VIDEO_AUDIO_FLUIDITY_PREFER_AUDIO
-Audio fluido
-#FMT_VIDEO_ASPECT_RATIO
-Modo de pantalla %s
-#FMT_VIDEO_FAST_FORWARD
-Modo avance rápido %s
-#FMT_VIDEO_FRAME_SKIPPING
-Salto de fotogramas %s
-#FMT_VIDEO_GAME_SCREEN
-Pantalla de juego %s
-#FMT_AUDIO_SOUND
-Sonido %s
-#FMT_AUDIO_RETRO_SOUND
-Sonido retro %s
-#FMT_SAVED_STATE_CREATE
-Grabar partida %d
-#FMT_SAVED_STATE_LOAD
-Cargar partida %d
-#MSG_SAVED_STATE_DELETE_GENERAL
-Borrar partidas...
-#FMT_CHEAT_PAGE
-Página de trucos %d
-#MSG_CHEAT_LOAD_FROM_FILE
-Cargar archivo de trucos
-#MSG_TOOLS_SCREENSHOT_GENERAL
-Capturas de pantalla...
-#MSG_TOOLS_GLOBAL_HOTKEY_GENERAL
-Teclas de atajo globales...
-#MSG_TOOLS_GAME_HOTKEY_GENERAL
-Teclas de atajo para el juego...
-#FMT_OPTIONS_LANGUAGE
-Idioma %s
-#FMT_OPTIONS_CPU_FREQUENCY
-Frecuencia CPU %s
-#MSG_OPTIONS_CPU_FREQUENCY_0
-[0] 240 MHz
-#MSG_OPTIONS_CPU_FREQUENCY_1
-[1] 300 MHz
-#MSG_OPTIONS_CPU_FREQUENCY_2
-[2] 336 MHz
-#MSG_OPTIONS_CPU_FREQUENCY_3
-[3] 360 MHz
-#MSG_OPTIONS_CPU_FREQUENCY_4
-[4] 384 MHz
-#MSG_OPTIONS_CPU_FREQUENCY_5
-[5] 396 MHz
-#MSG_OPTIONS_CARD_CAPACITY
-Capacidad de la tarjeta
-#MSG_OPTIONS_RESET
-Restaurar valores iniciales
-#MSG_OPTIONS_VERSION
-Información de versión
-#MSG_SCREENSHOT_CREATE
-Salvar captura
-#MSG_SCREENSHOT_BROWSE
-Mostrar capturas
-#MSG_HOTKEY_MAIN_MENU
-Ir al menú principal
-#MSG_HOTKEY_TEMPORARY_FAST_FORWARD
-Avance rápido temporal
-#MSG_HOTKEY_SOUND_TOGGLE
-Alternar sonido
-#MSG_HOTKEY_QUICK_LOAD_STATE
-Cargar partida 1
-#MSG_HOTKEY_QUICK_SAVE_STATE
-Grabar partida 1
-#MSG_HOTKEY_FULL_SCREEN_TOGGLE
-Alternar pantalla completa
-#MSG_PROGRESS_HOTKEY_WAITING_FOR_KEYS
-Presione la tecla para esta acción.
-#MSG_HOTKEY_DELETE_WITH_A
-*A Borrar
-#MSG_HOTKEY_CANCEL_WITH_B
-*B Cancelar
-#MSG_LOAD_GAME_RECENTLY_PLAYED
-Recientemente jugados...
-#MSG_LOAD_GAME_FROM_CARD
-Seleccionar un juego...
-#MSG_LOAD_GAME_MENU_TITLE
-Nuevo juego
-#MSG_VIDEO_ASPECT_RATIO_0
-[0] Pantalla completa
-#MSG_VIDEO_ASPECT_RATIO_1
-[1] Alinear abajo
-#MSG_VIDEO_ASPECT_RATIO_2
-[2] Alinear arriba
-#MSG_VIDEO_ASPECT_RATIO_3
-[3] Centrar
-#MSG_VIDEO_ASPECT_RATIO_4
-[4] Completa+Suavizado
-#MSG_VIDEO_FRAME_SKIPPING_AUTOMATIC
-[-] Automático
-#MSG_VIDEO_FRAME_SKIPPING_0
-[0] Mostrar todos
-#MSG_VIDEO_FRAME_SKIPPING_1
-[1] Mostrar 1/2
-#MSG_VIDEO_FRAME_SKIPPING_2
-[2] Mostrar 1/3
-#MSG_VIDEO_FRAME_SKIPPING_3
-[3] Mostrar 1/4
-#MSG_VIDEO_FRAME_SKIPPING_4
-[4] Mostrar 1/5
-#MSG_VIDEO_FRAME_SKIPPING_5
-[5] Mostrar 1/6
-#MSG_VIDEO_FRAME_SKIPPING_6
-[6] Mostrar 1/7
-#MSG_VIDEO_FRAME_SKIPPING_7
-[7] Mostrar 1/8
-#MSG_VIDEO_FRAME_SKIPPING_8
-[8] Mostrar 1/9
-#MSG_VIDEO_FRAME_SKIPPING_9
-[9] Mostrar 1/10
-#MSG_VIDEO_FRAME_SKIPPING_10
-[10] Mostrar 1/11
-#MSG_VIDEO_GAME_SCREEN_TOP
-Pantalla superior
-#MSG_VIDEO_GAME_SCREEN_BOTTOM
-Pantalla inferior
-#MSG_GENERAL_OFF
-Apagado
-#MSG_GENERAL_ON
-Encendido
-#MSG_GENERAL_CONFIRM_WITH_A
-*A Aceptar
-#MSG_GENERAL_CANCEL_WITH_B
-*B Cancelar
-#MSG_AUDIO_ENABLED
-Encendido
-#MSG_AUDIO_MUTED
-Apagado
-#MSG_TOP_SCREEN_NO_GAME_LOADED
-No hay juego cargado
-#MSG_CHEAT_ELEMENT_NOT_LOADED
-<Vacío>
-#MSG_SAVESTATE_FULL
-Posición actual en uso. ¿Sobreescribirla?
-#MSG_PROGRESS_SAVED_STATE_CREATING
-Salvando la partida...
-#MSG_PROGRESS_SAVED_STATE_CREATION_FAILED
-¡Error al salvar!
-#MSG_PROGRESS_SAVED_STATE_CREATION_SUCCEEDED
-¡Salvado correcto!
-#MSG_TOP_SCREEN_NO_SAVED_STATE_IN_SLOT
-No hay partida aquí
-#MSG_PROGRESS_SAVED_STATE_CORRUPTED
-¡Partida no encontrada/corrupta!
-#MSG_PROGRESS_SAVED_STATE_LOADING
-Cargando...
-#MSG_PROGRESS_SAVED_STATE_LOAD_FAILED
-¡Error al cargar!
-#MSG_PROGRESS_SAVED_STATE_LOAD_SUCCEEDED
-¡Carga correcta!
-#MSG_SAVED_STATE_DELETE_ALL
-Borrar todas las partidas
-#FMT_SAVED_STATE_DELETE_ONE
-Borrar partida %d
-#MSG_DELETE_ALL_SAVESTATE_WARING
-¿Borrar todas las partidas?
-#FMT_DIALOG_SAVED_STATE_DELETE_ONE
-¿Borrar la partida %d?
-#MSG_PROGRESS_SAVED_STATE_ALREADY_EMPTY
-¡No hay partida!
-#MSG_PROGRESS_SCREENSHOT_CREATING
-Salvando la captura...
-#MSG_PROGRESS_SCREENSHOT_CREATION_SUCCEEDED
-¡Completado!
-#MSG_PROGRESS_SCREENSHOT_CREATION_FAILED
-¡Error al salvar!
-#MSG_NO_SLIDE
-¡Captura no encontrada!
-#MSG_PLAYING_SLIDE
-Ejecutando...
-#MSG_PAUSE_SLIDE
-Pausa...
-#MSG_SCREENSHOT_SLIDESHOW_KEYS
-*u Velocidad +\n
-*d Velocidad -\n
-*l Anterior\n
-*r Siguiente\n
-*A Pausa\n
-*B Volver al menú
-#MSG_PROGRESS_LOADING_GAME
-Cargando el juego...
-#MSG_EMULATOR_NAME
-CATSFC Emulador SNES
-#MSG_WORD_EMULATOR_VERSION
-Versión
-#MSG_DIALOG_RESET
-¿Cargar valores iniciales?
-#MSG_PROGRESS_RESETTING
-Espere un momento...
-
-ENDSPANISH
-
-STARTITALIAN
-#MSG_MAIN_MENU_NEW_GAME
-Nuovo gioco
-#MSG_MAIN_MENU_RETURN_TO_GAME
-Ritorna al gioco
-#MSG_MAIN_MENU_RESET_GAME
-Riavvia gioco
-#MSG_MAIN_MENU_VIDEO_AUDIO
-Video & audio
-#MSG_MAIN_MENU_SAVED_STATES
-Salvataggi
-#MSG_MAIN_MENU_CHEATS
-Trucchi
-#MSG_MAIN_MENU_TOOLS
-Strumenti
-#MSG_MAIN_MENU_OPTIONS
-Opzioni
-#MSG_MAIN_MENU_EXIT
-Uscita
-#MSG_FILE_MENU_LOADING_LIST
-Caricando...
-#MSG_FILE_MENU_SORTING_LIST
-Ordinamento...
-#FMT_VIDEO_AUDIO_FLUIDITY_PREFERENCE
-Fluidità %s
-#MSG_VIDEO_AUDIO_FLUIDITY_PREFER_VIDEO
-Fluidità video
-#MSG_VIDEO_AUDIO_FLUIDITY_PREFER_AUDIO
-Fluidità audio
-#FMT_VIDEO_ASPECT_RATIO
-Modalità video %s
-#FMT_VIDEO_FAST_FORWARD
-Avanzamento rapido %s
-#FMT_VIDEO_FRAME_SKIPPING
-Salto fotogrammi %s
-#FMT_VIDEO_GAME_SCREEN
-Game screen %s
-#FMT_AUDIO_SOUND
-Audio %s
-#FMT_AUDIO_RETRO_SOUND
-Audio retro %s
-#FMT_SAVED_STATE_CREATE
-Crea salvataggio %d
-#FMT_SAVED_STATE_LOAD
-Carica salvataggio %d
-#MSG_SAVED_STATE_DELETE_GENERAL
-Cancella salvataggio...
-#FMT_CHEAT_PAGE
-Pagina dei trucchi %d
-#MSG_CHEAT_LOAD_FROM_FILE
-Carica file del trucco
-#MSG_TOOLS_SCREENSHOT_GENERAL
-Cattura schermata...
-#MSG_TOOLS_GLOBAL_HOTKEY_GENERAL
-Tasti di scelta rapida globali...
-#MSG_TOOLS_GAME_HOTKEY_GENERAL
-Tasti di scelta rapida del gioco...
-#FMT_OPTIONS_LANGUAGE
-Lingua %s
-#FMT_OPTIONS_CPU_FREQUENCY
-Frequenza CPU %s
-#MSG_OPTIONS_CPU_FREQUENCY_0
-[0] 240 MHz
-#MSG_OPTIONS_CPU_FREQUENCY_1
-[1] 300 MHz
-#MSG_OPTIONS_CPU_FREQUENCY_2
-[2] 336 MHz
-#MSG_OPTIONS_CPU_FREQUENCY_3
-[3] 360 MHz
-#MSG_OPTIONS_CPU_FREQUENCY_4
-[4] 384 MHz
-#MSG_OPTIONS_CPU_FREQUENCY_5
-[5] 396 MHz
-#MSG_OPTIONS_CARD_CAPACITY
-Capacità della card
-#MSG_OPTIONS_RESET
-Ripristina impostazioni predefinite
-#MSG_OPTIONS_VERSION
-Informazioni sulla versione
-#MSG_SCREENSHOT_CREATE
-Salva schermata
-#MSG_SCREENSHOT_BROWSE
-Sfoglia schermate
-#MSG_HOTKEY_MAIN_MENU
-Vai al menu principale
-#MSG_HOTKEY_TEMPORARY_FAST_FORWARD
-Avanzamento rapido temp.
-#MSG_HOTKEY_SOUND_TOGGLE
-(Dis)attiva audio
-#MSG_HOTKEY_QUICK_LOAD_STATE
-Carica salvataggio 1
-#MSG_HOTKEY_QUICK_SAVE_STATE
-Crea salvataggio 1
-#MSG_HOTKEY_FULL_SCREEN_TOGGLE
-(Dis)attiva schermo intero
-#MSG_PROGRESS_HOTKEY_WAITING_FOR_KEYS
-Premi il pulsante che vuoi utilizzare per questa azione.
-#MSG_HOTKEY_DELETE_WITH_A
-*A Elimina
-#MSG_HOTKEY_CANCEL_WITH_B
-*B Annulla
-#MSG_LOAD_GAME_RECENTLY_PLAYED
-Giochi recenti...
-#MSG_LOAD_GAME_FROM_CARD
-Seleziona gioco...
-#MSG_LOAD_GAME_MENU_TITLE
-Nuovo gioco
-#MSG_VIDEO_ASPECT_RATIO_0
-[0] Schermo intero
-#MSG_VIDEO_ASPECT_RATIO_1
-[1] Allinea in basso
-#MSG_VIDEO_ASPECT_RATIO_2
-[2] Allinea in alto
-#MSG_VIDEO_ASPECT_RATIO_3
-[3] Centrato
-#MSG_VIDEO_ASPECT_RATIO_4
-[4] Schermo intero, Smussato
-#MSG_VIDEO_FRAME_SKIPPING_AUTOMATIC
-[-] Automatico
-#MSG_VIDEO_FRAME_SKIPPING_0
-[0] Mostra tutti i fotogrammi
-#MSG_VIDEO_FRAME_SKIPPING_1
-[1] Mostra 1 su 2 fotogrammi
-#MSG_VIDEO_FRAME_SKIPPING_2
-[2] Mostra 1 su 3 fotogrammi
-#MSG_VIDEO_FRAME_SKIPPING_3
-[3] Mostra 1 su 4 fotogrammi
-#MSG_VIDEO_FRAME_SKIPPING_4
-[4] Mostra 1 su 5 fotogrammi
-#MSG_VIDEO_FRAME_SKIPPING_5
-[5] Mostra 1 su 6 fotogrammi
-#MSG_VIDEO_FRAME_SKIPPING_6
-[6] Mostra 1 su 7 fotogrammi
-#MSG_VIDEO_FRAME_SKIPPING_7
-[7] Mostra 1 su 8 fotogrammi
-#MSG_VIDEO_FRAME_SKIPPING_8
-[8] Mostra 1 su 9 fotogrammi
-#MSG_VIDEO_FRAME_SKIPPING_9
-[9] Mostra 1 su 10 fotogrammi
-#MSG_VIDEO_FRAME_SKIPPING_10
-[10] Mostra 1 su 11 fotogrammi
-#MSG_VIDEO_GAME_SCREEN_TOP
-Upper Screen
-#MSG_VIDEO_GAME_SCREEN_BOTTOM
-Lower Screen
-#MSG_GENERAL_OFF
-Disabilita
-#MSG_GENERAL_ON
-Abilita
-#MSG_GENERAL_CONFIRM_WITH_A
-*A Conferma
-#MSG_GENERAL_CANCEL_WITH_B
-*B Annulla
-#MSG_AUDIO_ENABLED
-Abilita
-#MSG_AUDIO_MUTED
-Muto
-#MSG_TOP_SCREEN_NO_GAME_LOADED
-Nessun gioco caricato
-#MSG_CHEAT_ELEMENT_NOT_LOADED
-<Nessun elemento caricato>
-#MSG_SAVESTATE_FULL
-Lo slot contiene un salvataggio. Vuoi sovrascriverlo?
-#MSG_PROGRESS_SAVED_STATE_CREATING
-Slavataggio stato...
-#MSG_PROGRESS_SAVED_STATE_CREATION_FAILED
-Fallito!
-#MSG_PROGRESS_SAVED_STATE_CREATION_SUCCEEDED
-OK!
-#MSG_TOP_SCREEN_NO_SAVED_STATE_IN_SLOT
-Nessun salvataggio.
-#MSG_PROGRESS_SAVED_STATE_CORRUPTED
-Il file di salvataggio non è stato trovato o è corrotto.
-#MSG_PROGRESS_SAVED_STATE_LOADING
-Caricando...
-#MSG_PROGRESS_SAVED_STATE_LOAD_FAILED
-Fallito!
-#MSG_PROGRESS_SAVED_STATE_LOAD_SUCCEEDED
-OK!
-#MSG_SAVED_STATE_DELETE_ALL
-Cancella tutti i salvataggi
-#FMT_SAVED_STATE_DELETE_ONE
-Cancella il salvataggio %d
-#MSG_DELETE_ALL_SAVESTATE_WARING
-Sicuro di voler cancellare tutti i salvataggi?
-#FMT_DIALOG_SAVED_STATE_DELETE_ONE
-Sicuro di voler cancellare il salvataggio %d?
-#MSG_PROGRESS_SAVED_STATE_ALREADY_EMPTY
-Non c'è nulla qui.
-#MSG_PROGRESS_SCREENSHOT_CREATING
-Salvataggio screenshot...
-#MSG_PROGRESS_SCREENSHOT_CREATION_SUCCEEDED
-OK!
-#MSG_PROGRESS_SCREENSHOT_CREATION_FAILED
-Fallito!
-#MSG_NO_SLIDE
-Nessuna schermata trovata
-#MSG_PLAYING_SLIDE
-In Esecuzione...
-#MSG_PAUSE_SLIDE
-Pausa...
-#MSG_SCREENSHOT_SLIDESHOW_KEYS
-*u Aumenta velocità\n
-*d Diminuisci velocità\n
-*l Ultima immagine\n
-*r Prossima immagine\n
-*A Pausa\n
-*B Ritorna al menù principale
-#MSG_PROGRESS_LOADING_GAME
-Caricando...
-#MSG_EMULATOR_NAME
-CATSFC SNES emulator
-#MSG_WORD_EMULATOR_VERSION
-Versione
-#MSG_DIALOG_RESET
-Ripristinare le impostazioni predefinite?
-#MSG_PROGRESS_RESETTING
-Attendere...
-
-ENDITALIAN
-
-STARTPORTUGUESEBR
-#MSG_MAIN_MENU_NEW_GAME
-Novo jogo
-#MSG_MAIN_MENU_RETURN_TO_GAME
-Voltar ao jogo
-#MSG_MAIN_MENU_RESET_GAME
-Reiniciar o jogo
-#MSG_MAIN_MENU_VIDEO_AUDIO
-Áudio & Vídeo
-#MSG_MAIN_MENU_SAVED_STATES
-Estados salvos
-#MSG_MAIN_MENU_CHEATS
-Trapaças
-#MSG_MAIN_MENU_TOOLS
-Ferramentas
-#MSG_MAIN_MENU_OPTIONS
-Opções
-#MSG_MAIN_MENU_EXIT
-Sair
-#MSG_FILE_MENU_LOADING_LIST
-Carregando...
-#MSG_FILE_MENU_SORTING_LIST
-Classificando...
-#FMT_VIDEO_AUDIO_FLUIDITY_PREFERENCE
-Fluidez %s
-#MSG_VIDEO_AUDIO_FLUIDITY_PREFER_VIDEO
-Preferir vídeo fluído
-#MSG_VIDEO_AUDIO_FLUIDITY_PREFER_AUDIO
-Preferir áudio fluído
-#FMT_VIDEO_ASPECT_RATIO
-Proporção %s
-#FMT_VIDEO_FAST_FORWARD
-Avanço de quadro %s
-#FMT_VIDEO_FRAME_SKIPPING
-Pulo de quadros %s
-#FMT_VIDEO_GAME_SCREEN
-Tela de jogo %s
-#FMT_AUDIO_SOUND
-Som %s
-#FMT_AUDIO_RETRO_SOUND
-Som retrô %s
-#FMT_SAVED_STATE_CREATE
-Criar estado %d
-#FMT_SAVED_STATE_LOAD
-Carregar estado %d
-#MSG_SAVED_STATE_DELETE_GENERAL
-Deletar estados...
-#FMT_CHEAT_PAGE
-Página de trapaça %d
-#MSG_CHEAT_LOAD_FROM_FILE
-Carregar arquivo de trapaça
-#MSG_TOOLS_SCREENSHOT_GENERAL
-Foto...
-#MSG_TOOLS_GLOBAL_HOTKEY_GENERAL
-Atalhos de botões globais...
-#MSG_TOOLS_GAME_HOTKEY_GENERAL
-Atalhos de botões do jogo atual...
-#FMT_OPTIONS_LANGUAGE
-Idioma %s
-#FMT_OPTIONS_CPU_FREQUENCY
-Frequência da CPU %s
-#MSG_OPTIONS_CPU_FREQUENCY_0
-[0] 240 MHz
-#MSG_OPTIONS_CPU_FREQUENCY_1
-[1] 300 MHz
-#MSG_OPTIONS_CPU_FREQUENCY_2
-[2] 336 MHz
-#MSG_OPTIONS_CPU_FREQUENCY_3
-[3] 360 MHz
-#MSG_OPTIONS_CPU_FREQUENCY_4
-[4] 384 MHz
-#MSG_OPTIONS_CPU_FREQUENCY_5
-[5] 396 MHz
-#MSG_OPTIONS_CARD_CAPACITY
-Capacidade do cartão SD
-#MSG_OPTIONS_RESET
-Restaurar configuração padrão
-#MSG_OPTIONS_VERSION
-Informações desta versão
-#MSG_SCREENSHOT_CREATE
-Tirar uma foto
-#MSG_SCREENSHOT_BROWSE
-Slideshow de fotos
-#MSG_HOTKEY_MAIN_MENU
-Voltar ao menu principal
-#MSG_HOTKEY_TEMPORARY_FAST_FORWARD
-Avanço de quadro temp.
-#MSG_HOTKEY_SOUND_TOGGLE
-Ativar som
-#MSG_HOTKEY_QUICK_LOAD_STATE
-Carregar estado 1
-#MSG_HOTKEY_QUICK_SAVE_STATE
-Criar estado 1
-#MSG_HOTKEY_FULL_SCREEN_TOGGLE
-Ativar tela-cheia
-#MSG_PROGRESS_HOTKEY_WAITING_FOR_KEYS
-Aperte os botões que você deseja para realizar esta ação.
-#MSG_HOTKEY_DELETE_WITH_A
-*A Limpar
-#MSG_HOTKEY_CANCEL_WITH_B
-*B Cancelar
-#MSG_LOAD_GAME_RECENTLY_PLAYED
-Jogado recentemente...
-#MSG_LOAD_GAME_FROM_CARD
-Selecione um jogo...
-#MSG_LOAD_GAME_MENU_TITLE
-Novo jogo
-#MSG_VIDEO_ASPECT_RATIO_0
-[0] Toda a tela
-#MSG_VIDEO_ASPECT_RATIO_1
-[1] Abaixo, pixels exatos
-#MSG_VIDEO_ASPECT_RATIO_2
-[2] Acima, pixels exatos
-#MSG_VIDEO_ASPECT_RATIO_3
-[3] Meio, pixels exatos
-#MSG_VIDEO_ASPECT_RATIO_4
-[4] Toda a tela, suavizado
-#MSG_VIDEO_FRAME_SKIPPING_AUTOMATIC
-[-] Variar conforme o jogo
-#MSG_VIDEO_FRAME_SKIPPING_0
-[0] Mostrar todos os frames
-#MSG_VIDEO_FRAME_SKIPPING_1
-[1] Mostrar 1 em 2 frames
-#MSG_VIDEO_FRAME_SKIPPING_2
-[2] Mostrar 1 em 3 frames
-#MSG_VIDEO_FRAME_SKIPPING_3
-[3] Mostrar 1 em 4 frames
-#MSG_VIDEO_FRAME_SKIPPING_4
-[4] Mostrar 1 em 5 frames
-#MSG_VIDEO_FRAME_SKIPPING_5
-[5] Mostrar 1 em 6 frames
-#MSG_VIDEO_FRAME_SKIPPING_6
-[6] Mostrar 1 em 7 frames
-#MSG_VIDEO_FRAME_SKIPPING_7
-[7] Mostrar 1 em 8 frames
-#MSG_VIDEO_FRAME_SKIPPING_8
-[8] Mostrar 1 em 9 frames
-#MSG_VIDEO_FRAME_SKIPPING_9
-[9] Mostrar 1 em 10 frames
-#MSG_VIDEO_FRAME_SKIPPING_10
-[10] Mostrar 1 em 11 frames
-#MSG_VIDEO_GAME_SCREEN_TOP
-Tela superior
-#MSG_VIDEO_GAME_SCREEN_BOTTOM
-Tela inferior
-#MSG_GENERAL_OFF
-Desligado
-#MSG_GENERAL_ON
-Ligado
-#MSG_GENERAL_CONFIRM_WITH_A
-*A Confirma
-#MSG_GENERAL_CANCEL_WITH_B
-*B Cancela
-#MSG_AUDIO_ENABLED
-Ligado
-#MSG_AUDIO_MUTED
-Mudo
-#MSG_TOP_SCREEN_NO_GAME_LOADED
-Nenhum jogo carregado no momento
-#MSG_CHEAT_ELEMENT_NOT_LOADED
-<Nada carregado aqui>
-#MSG_SAVESTATE_FULL
-O slot atual contém um estado. Deseja sobrescrevê-lo?
-#MSG_PROGRESS_SAVED_STATE_CREATING
-Salvando estado...
-#MSG_PROGRESS_SAVED_STATE_CREATION_FAILED
-Falhou!
-#MSG_PROGRESS_SAVED_STATE_CREATION_SUCCEEDED
-OK!
-#MSG_TOP_SCREEN_NO_SAVED_STATE_IN_SLOT
-Nenhum estado salvo aqui
-#MSG_PROGRESS_SAVED_STATE_CORRUPTED
-O arquivo de estado deste jogo não foi encontrado ou está corrompido.
-#MSG_PROGRESS_SAVED_STATE_LOADING
-Carregando...
-#MSG_PROGRESS_SAVED_STATE_LOAD_FAILED
-Falhou!
-#MSG_PROGRESS_SAVED_STATE_LOAD_SUCCEEDED
-OK!
-#MSG_SAVED_STATE_DELETE_ALL
-Delete todos os estados salvos
-#FMT_SAVED_STATE_DELETE_ONE
-Delete o estado salvo %d
-#MSG_DIALOG_SAVE_STATE_DELETE_ALL
-Deseja realmente deletear todos os estados?
-#FMT_DIALOG_SAVED_STATE_DELETE_ONE
-Deseja realmente deletear o estado %d?
-#MSG_PROGRESS_SAVED_STATE_ALREADY_EMPTY
-Já não existe nada aqui.
-#MSG_PROGRESS_SCREENSHOT_CREATING
-Salvando uma foto...
-#MSG_PROGRESS_SCREENSHOT_CREATION_SUCCEEDED
-OK!
-#MSG_PROGRESS_SCREENSHOT_CREATION_FAILED
-Falhou!
-#MSG_NO_SLIDE
-Nenhuma foto encontrada
-#MSG_PLAYING_SLIDE
-Executando...
-#MSG_PAUSE_SLIDE
-Pausar...
-#MSG_SCREENSHOT_SLIDESHOW_KEYS
-*u Acelerar\n
-*d Desacelerar\n
-*l Foto anterior\n
-*r Próxima foto\n
-*A Pausar\n
-*B Voltar ao menu
-#MSG_PROGRESS_LOADING_GAME
-Carregando...
-#MSG_EMULATOR_NAME
-CATSFC SNES emulator
-#MSG_WORD_EMULATOR_VERSION
-Versão
-#MSG_DIALOG_RESET
-Reiniciar todas as configurações para seus padrões?
-#MSG_PROGRESS_RESETTING
-Por favor, espere...
-
-ENDPORTUGUESEBR
diff --git a/CATSFC/system/song.odf b/CATSFC/system/song.odf
deleted file mode 100644
index ba89668..0000000
--- a/CATSFC/system/song.odf
+++ /dev/null
Binary files differ
diff --git a/Makefile.org b/Makefile.org
deleted file mode 100644
index 3458e7a..0000000
--- a/Makefile.org
+++ /dev/null
@@ -1,124 +0,0 @@
-# - - - Modifiable paths - - -
-DS2SDKPATH := /opt/ds2sdk
-CROSS := /opt/mipsel-4.1.2-nopic/bin/mipsel-linux-
-
-# - - - Libraries and includes - - -
-FS_DIR = $(DS2SDKPATH)/libsrc/fs
-CONSOLE_DIR = $(DS2SDKPATH)/libsrc/console
-KEY_DIR = $(DS2SDKPATH)/libsrc/key
-ZLIB_DIR = $(DS2SDKPATH)/libsrc/zlib
-CORE_DIR = $(DS2SDKPATH)/libsrc/core
-
-LIBS := $(DS2SDKPATH)/lib/libds2b.a -lc -lm -lgcc
-EXTLIBS := $(DS2SDKPATH)/lib/libds2a.a
-
-INCLUDE := -Isource -Isource/unzip -Isource/nds -I$(DS2SDKPATH)/include \
- -I$(FS_DIR) -I$(CONSOLE_DIR) -I$(KEY_DIR) -I$(ZLIB_DIR) \
- -I$(CORE_DIR)
-
-LINK_SPEC := $(DS2SDKPATH)/specs/link.xn
-START_ASM := $(DS2SDKPATH)/specs/start.S
-START_O := start.o
-
-# - - - Names - - -
-OUTPUT := catsfc
-PLUGIN_DIR := CATSFC
-
-# - - - Tools - - -
-CC = $(CROSS)gcc
-AR = $(CROSS)ar rcsv
-LD = $(CROSS)ld
-OBJCOPY = $(CROSS)objcopy
-NM = $(CROSS)nm
-OBJDUMP = $(CROSS)objdump
-
-# - - - Sources and objects - - -
-C_SOURCES = source/unzip/explode.c source/unzip/unreduce.c \
- source/unzip/unshrink.c source/unzip/unzip.c \
- source/nds/bdf_font.c source/nds/bitmap.c \
- source/nds/draw.c source/nds/ds2_main.c source/nds/gcheat.c \
- source/nds/gui.c source/nds/dma_adj.c source/nds/cheatgrp.c
-CPP_SOURCES = source/apu.cpp source/apudebug.cpp source/c4.cpp \
- source/c4emu.cpp source/cheats2.cpp source/cheats.cpp \
- source/clip.cpp source/cpu.cpp source/cpuexec.cpp \
- source/cpuops.cpp source/data.cpp source/debug.cpp \
- source/dma.cpp source/dsp1.cpp \
- source/fxdbg.cpp source/fxemu.cpp source/fxinst.cpp \
- source/gfx.cpp source/globals.cpp source/loadzip.cpp \
- source/memmap.cpp source/movie.cpp \
- source/obc1.cpp source/ppu.cpp \
- source/sa1.cpp source/sa1cpu.cpp source/screenshot.cpp \
- source/sdd1.cpp source/sdd1emu.cpp \
- source/seta010.cpp source/seta011.cpp source/seta018.cpp \
- source/seta.cpp source/snaporig.cpp source/snapshot.cpp \
- source/soundux.cpp \
- source/spc700.cpp source/spc7110.cpp \
- source/srtc.cpp \
- source/tile.cpp \
- source/nds/displaymodes.cpp source/nds/entry.cpp
-SOURCES = $(C_SOURCES) $(CPP_SOURCES)
-C_OBJECTS = $(C_SOURCES:.c=.o)
-CPP_OBJECTS = $(CPP_SOURCES:.cpp=.o)
-OBJECTS = $(C_OBJECTS) $(CPP_OBJECTS)
-
-# - - - Compilation flags - - -
-CFLAGS := -mips32 -mno-abicalls -fno-pic -fno-builtin \
- -fno-exceptions -ffunction-sections -mno-long-calls \
- -msoft-float -G 4 \
- -O3 -fomit-frame-pointer -fgcse-sm -fgcse-las -fgcse-after-reload \
- -fweb -fpeel-loops
-
-DEFS := -DSPC700_C -DEXECUTE_SUPERFX_PER_LINE -DSDD1_DECOMP \
- -DVAR_CYCLES -DCPU_SHUTDOWN -DSPC700_SHUTDOWN \
- -DNO_INLINE_SET_GET -DNOASM -DHAVE_MKSTEMP '-DACCEPT_SIZE_T=size_t' \
- -DUNZIP_SUPPORT -DFOREVER_16_BIT_SOUND -DFOREVER_STEREO \
- -DFOREVER_FORWARD_STEREO -DNO_VOLATILE_SOUND \
- -DDS2_DMA
-
-.PHONY: clean makedirs
-.SUFFIXES: .elf .dat .plg
-
-all: $(OUTPUT).plg makedirs
-
-release: all
- -rm -f $(OUTPUT).zip
- zip -r $(OUTPUT).zip $(PLUGIN_DIR) $(OUTPUT).plg $(OUTPUT).bmp $(OUTPUT).ini copyright installation.txt README.md source.txt version
-
-# $< is the source (OUTPUT.dat); $@ is the target (OUTPUT.plg)
-.dat.plg:
- $(DS2SDKPATH)/tools/makeplug $< $@
-
-# $< is the source (OUTPUT.elf); $@ is the target (OUTPUT.dat)
-.elf.dat:
- $(OBJCOPY) -x -O binary $< $@
-
-$(OUTPUT).elf: Makefile $(OBJECTS) $(START_O) $(LINK_SPEC) $(EXTLIBS)
- $(CC) -nostdlib -static -T $(LINK_SPEC) -o $@ $(START_O) $(OBJECTS) $(EXTLIBS) $(LIBS)
-
-$(EXTLIBS):
- $(MAKE) -C $(DS2SDKPATH)/source/
-
-$(START_O): $(START_ASM)
- $(CC) $(CFLAGS) $(INCLUDE) -o $@ -c $<
-
-makedirs:
- -mkdir $(PLUGIN_DIR)/gamepak
- -mkdir $(PLUGIN_DIR)/gamecht
- -mkdir $(PLUGIN_DIR)/gamerts
- -mkdir $(PLUGIN_DIR)/gamepic
-
-clean:
- -rm -rf $(OUTPUT).plg $(OUTPUT).dat $(OUTPUT).elf depend $(OBJECTS) $(START_O)
-
-.c.o:
- $(CC) $(CFLAGS) $(INCLUDE) $(DEFS) -o $@ -c $<
-.cpp.o:
- $(CC) $(CFLAGS) $(INCLUDE) $(DEFS) -fno-rtti -o $@ -c $<
-
-Makefile: depend
-
-depend: $(SOURCES)
- $(CC) -MM $(CFLAGS) $(INCLUDE) $(DEFS) $(SOURCES) > $@
- touch Makefile
-
--include depend
diff --git a/catsfc.bmp b/catsfc.bmp
deleted file mode 100644
index b47a9f6..0000000
--- a/catsfc.bmp
+++ /dev/null
Binary files differ
diff --git a/catsfc.ini b/catsfc.ini
deleted file mode 100644
index 0673299..0000000
--- a/catsfc.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[plug setting]
-icon=fat1:/_dstwoplug/CATSFC.bmp
-name=CATSFC
diff --git a/installation.txt b/installation.txt
deleted file mode 100644
index 92c739d..0000000
--- a/installation.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-To install:
-
-Place catsfc.plg, catsfc.bmp, and catsfc.ini in the _dstwoplug folder of your DSTWO. Place the CATSFC folder in your dstwo's root folder (the one that contains _dstwo, _dstwoplug, etc).
diff --git a/libretro.cpp b/libretro.cpp
index d94ffce..8b21594 100644
--- a/libretro.cpp
+++ b/libretro.cpp
@@ -623,10 +623,11 @@ void retro_run (void)
{
int i, port;
- bool updated = false;
+// IPPU.RenderThisFrame = FALSE;
+// video_cb(GFX.Screen, 256, 224, 512);
+
poll_cb();
-// so.sound_switch = 0;
S9xSetPlaybackRate(32040);
so.mute_sound = FALSE;
SoundData.echo_enable = FALSE;
@@ -650,6 +651,7 @@ void retro_run (void)
// if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated)
// check_variables();
+
}
diff --git a/sdk-modifications/include/archdefs.h b/sdk-modifications/include/archdefs.h
deleted file mode 100755
index 37c61b8..0000000
--- a/sdk-modifications/include/archdefs.h
+++ /dev/null
@@ -1,2356 +0,0 @@
-/**************************************************************************
-* *
-* PROJECT : MIPS port for uC/OS-II *
-* *
-* MODULE : ARCHDEFS.h *
-* *
-* AUTHOR : Michael Anburaj *
-* URL : http://geocities.com/michaelanburaj/ *
-* EMAIL: michaelanburaj@hotmail.com *
-* *
-* PROCESSOR : MIPS 4Kc (32 bit RISC) - ATLAS board *
-* *
-* TOOL-CHAIN : SDE & Cygnus *
-* *
-* DESCRIPTION : *
-* Architecture definitions. *
-* *
-**************************************************************************/
-
-
-#ifndef __ARCHDEFS_H__
-#define __ARCHDEFS_H__
-
-
-/* ********************************************************************* */
-/* Module configuration */
-
-
-/* ********************************************************************* */
-/* Interface macro & data definition */
-
-/*
- * Utility defines for cross platform handling of 64bit constants.
- */
-
-#if !defined(Append)
- #define Append(c,s) (c##s)
-#endif
-
-#if !defined(__assembler) && !defined(MIPSAVPENV)
- #if defined(NT)
- #if !defined(UNS64Const)
- #define UNS64Const(c) Append(c,ui64)
- #endif
-
- #if !defined(INT64Const)
- #define INT64Const(c) Append(c,i64)
- #endif
- #else
- #if !defined(UNS64Const)
- #define UNS64Const(c) Append(c,ull)
- #endif
-
- #if !defined(INT64Const)
- #define INT64Const(c) Append(c,ll)
- #endif
- #endif
-#else /* Not C or C++ */
- #if !defined(UNS64Const)
- #define UNS64Const(c) c
- #endif
-
- #if !defined(INT64Const)
- #define INT64Const(c) c
- #endif
-#endif /* C or C++ */
-
-
-/*
- ************************************************************************
- * I N S T R U C T I O N F O R M A T S *
- ************************************************************************
- *
- * The following definitions describe each field in an instruction. There
- * is one diagram for each type of instruction, with field definitions
- * following the diagram for that instruction. Note that if a field of
- * the same name and position is defined in an earlier diagram, it is
- * not defined again in the subsequent diagram. Only new fields are
- * defined for each diagram.
- *
- * R-Type (operate)
- *
- * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | | rs | rt | rd | sa | |
- * | Opcode | | | Tcode | func |
- * | | Bcode | | sel |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define S_InstnOpcode 26
-#define M_InstnOpcode (0x3f << S_InstnOpcode)
-#define S_InstnRS 21
-#define M_InstnRS (0x1f << S_InstnRS)
-#define S_InstnRT 16
-#define M_InstnRT (0x1f << S_InstnRT)
-#define S_InstnRD 11
-#define M_InstnRD (0x1f << S_InstnRD)
-#define S_InstnSA 6
-#define M_InstnSA (0x1f << S_InstnSA)
-#define S_InstnTcode 6
-#define M_InstnTcode (0x3ff << S_InstnTcode)
-#define S_InstnBcode 6
-#define M_InstnBcode (0xfffff << S_InstnBcode)
-#define S_InstnFunc 0
-#define M_InstnFunc (0x3f << S_InstnFunc)
-#define S_InstnSel 0
-#define M_InstnSel (0x7 << S_InstnSel)
-
-/*
- * I-Type (load, store, branch, immediate)
- *
- * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Opcode | rs | rt | Offset |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define S_InstnOffset 0
-#define M_InstnOffset (0xffff << S_InstnOffset)
-
-/*
- * I-Type (pref)
- *
- * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Opcode | rs | hint | Offset |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define S_InstnHint S_InstnRT
-#define M_InstnHint M_InstnRT
-
-/*
- * J-Type (jump)
- *
- * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Opcode | JIndex |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define S_InstnJIndex 0
-#define M_InstnJIndex (0x03ffffff << S_InstnJIndex)
-
-/*
- * FP R-Type (operate)
- *
- * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Opcode | fmt | ft | fs | fd | func |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define S_InstnFmt S_InstnRS
-#define M_InstnFmt M_InstnRS
-#define S_InstnFT S_InstnRT
-#define M_InstnFT M_InstnRT
-#define S_InstnFS S_InstnRD
-#define M_InstnFS M_InstnRD
-#define S_InstnFD S_InstnSA
-#define M_InstnFD M_InstnSA
-
-/*
- * FP R-Type (cpu <-> cpu data movement))
- *
- * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Opcode | sub | rt | fs | 0 |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define S_InstnSub S_InstnRS
-#define M_InstnSub M_InstnRS
-
-/*
- * FP R-Type (compare)
- * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | | | | | | |C| |
- * | Opcode | fmt | ft | fs | cc |0|A| func |
- * | | | | | | |B| |
- * | | | | | | |S| |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define S_InstnCCcmp 8
-#define M_InstnCCcmp (0x7 << S_InstnCCcmp)
-#define S_InstnCABS 6
-#define M_InstnCABS (0x1 << S_InstnCABS)
-
-/*
- * FP R-Type (FPR conditional move on FP cc)
- *
- * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Opcode | fmt | cc |n|t| fs | fd | func |
- * | | | |d|f| | | |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define S_InstnCC 18
-#define M_InstnCC (0x7 << S_InstnCC)
-#define S_InstnND 17
-#define M_InstnND (0x1 << S_InstnND)
-#define S_InstnTF 16
-#define M_InstnTF (0x1 << S_InstnTF)
-
-/*
- * FP R-Type (3-operand operate)
- *
- * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Opcode | fr | ft | fs | fd | op4 | fmt3|
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define S_InstnFR S_InstnRS
-#define M_InstnFR M_InstnRS
-#define S_InstnOp4 3
-#define M_InstnOp4 (0x7 << S_InstnOp4)
-#define S_InstnFmt3 0
-#define M_InstnFmt3 (0x7 << S_InstnFmt3)
-
-/*
- * FP R-Type (Indexed load, store)
- *
- * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Opcode | rs | rt | 0 | fd | func |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-/*
- * FP R-Type (prefx)
- *
- * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Opcode | rs | rt | hint | 0 | func |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define S_InstnHintX S_InstnRD
-#define M_InstnHintX M_InstnRD
-
-/*
- * FP R-Type (GPR conditional move on FP cc)
- *
- * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Opcode | rs | cc |n|t| rd | 0 | func |
- * | | | |d|f| | | |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-/*
- * FP I-Type (load, store)
- *
- * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Opcode | rs | ft | Offset |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-/*
- * FP I-Type (branch)
- *
- * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Opcode | fmt | cc |n|t| Offset |
- * | | | |d|f| |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-
-/*
- *************************************************************************
- * V I R T U A L A D D R E S S D E F I N I T I O N S *
- *************************************************************************
- */
-
-#ifdef MIPSADDR64
-#define A_K0BASE UNS64Const(0xffffffff80000000)
-#define A_K1BASE UNS64Const(0xffffffffa0000000)
-#define A_K2BASE UNS64Const(0xffffffffc0000000)
-#define A_K3BASE UNS64Const(0xffffffffe0000000)
-#define A_REGION UNS64Const(0xc000000000000000)
-#define A_XKPHYS_ATTR UNS64Const(0x3800000000000000)
-#else
-#define A_K0BASE 0x80000000
-#define A_K1BASE 0xa0000000
-#define A_K2BASE 0xc0000000
-#define A_K3BASE 0xe0000000
-#endif
-#define M_KMAPPED 0x40000000 /* KnSEG address is mapped if bit is one */
-
-
-#ifdef MIPS_Model64
-
-#define S_VMAP64 62
-#define M_VMAP64 UNS64Const(0xc000000000000000)
-
-#define K_VMode11 3
-#define K_VMode10 2
-#define K_VMode01 1
-#define K_VMode00 0
-
-#define S_KSEG3 29
-#define M_KSEG3 (0x7 << S_KSEG3)
-#define K_KSEG3 7
-
-#define S_SSEG 29
-#define M_SSEG (0x7 << S_KSEG3)
-#define K_SSEG 6
-
-#define S_KSSEG 29
-#define M_KSSEG (0x7 << S_KSEG3)
-#define K_KSSEG 6
-
-#define S_KSEG1 29
-#define M_KSEG1 (0x7 << S_KSEG3)
-#define K_KSEG1 5
-
-#define S_KSEG0 29
-#define M_KSEG0 (0x7 << S_KSEG3)
-#define K_KSEG0 4
-
-#define S_XKSEG 29
-#define M_XKSEG (0x7 << S_KSEG3)
-#define K_XKSEG 3
-
-#define S_USEG 31
-#define M_USEG (0x1 << S_USEG)
-#define K_USEG 0
-
-#define S_EjtagProbeMem 20
-#define M_EjtagProbeMem (0x1 << S_EjtagProbeMem)
-#define K_EjtagProbeMem 0
-
-
-
-#else
-
-#define S_KSEG3 29
-#define M_KSEG3 (0x7 << S_KSEG3)
-#define K_KSEG3 7
-
-#define S_KSSEG 29
-#define M_KSSEG (0x7 << S_KSSEG)
-#define K_KSSEG 6
-
-#define S_SSEG 29
-#define M_SSEG (0x7 << S_SSEG)
-#define K_SSEG 6
-
-#define S_KSEG1 29
-#define M_KSEG1 (0x7 << S_KSEG1)
-#define K_KSEG1 5
-
-#define S_KSEG0 29
-#define M_KSEG0 (0x7 << S_KSEG0)
-#define K_KSEG0 4
-
-#define S_KUSEG 31
-#define M_KUSEG (0x1 << S_KUSEG)
-#define K_KUSEG 0
-
-#define S_SUSEG 31
-#define M_SUSEG (0x1 << S_SUSEG)
-#define K_SUSEG 0
-
-#define S_USEG 31
-#define M_USEG (0x1 << S_USEG)
-#define K_USEG 0
-
-#define K_EjtagLower 0xff200000
-#define K_EjtagUpper 0xff3fffff
-
-#define S_EjtagProbeMem 20
-#define M_EjtagProbeMem (0x1 << S_EjtagProbeMem)
-#define K_EjtagProbeMem 0
-
-#endif
-
-
-
-/*
- *************************************************************************
- * C A C H E I N S T R U C T I O N O P E R A T I O N C O D E S *
- *************************************************************************
- */
-
-/*
- * Cache encodings
- */
-#define K_CachePriI 0 /* Primary Icache */
-#define K_CachePriD 1 /* Primary Dcache */
-#define K_CachePriU 1 /* Unified primary */
-#define K_CacheTerU 2 /* Unified Tertiary */
-#define K_CacheSecU 3 /* Unified secondary */
-
-
-/*
- * Function encodings
- */
-#define S_CacheFunc 2 /* Amount to shift function encoding within 5-bit field */
-#define K_CacheIndexInv 0 /* Index invalidate */
-#define K_CacheIndexWBInv 0 /* Index writeback invalidate */
-#define K_CacheIndexLdTag 1 /* Index load tag */
-#define K_CacheIndexStTag 2 /* Index store tag */
-#define K_CacheHitInv 4 /* Hit Invalidate */
-#define K_CacheFill 5 /* Fill (Icache only) */
-#define K_CacheHitWBInv 5 /* Hit writeback invalidate */
-#define K_CacheHitWB 6 /* Hit writeback */
-#define K_CacheFetchLock 7 /* Fetch and lock */
-
-#define ICIndexInv ((K_CacheIndexInv << S_CacheFunc) | K_CachePriI)
-#define DCIndexWBInv ((K_CacheIndexWBInv << S_CacheFunc) | K_CachePriD)
-#define DCIndexInv DCIndexWBInv
-#define ICIndexLdTag ((K_CacheIndexLdTag << S_CacheFunc) | K_CachePriI)
-#define DCIndexLdTag ((K_CacheIndexLdTag << S_CacheFunc) | K_CachePriD)
-#define ICIndexStTag ((K_CacheIndexStTag << S_CacheFunc) | K_CachePriI)
-#define DCIndexStTag ((K_CacheIndexStTag << S_CacheFunc) | K_CachePriD)
-#define ICHitInv ((K_CacheHitInv << S_CacheFunc) | K_CachePriI)
-#define DCHitInv ((K_CacheHitInv << S_CacheFunc) | K_CachePriD)
-#define ICFill ((K_CacheFill << S_CacheFunc) | K_CachePriI)
-#define DCHitWBInv ((K_CacheHitWBInv << S_CacheFunc) | K_CachePriD)
-#define DCHitWB ((K_CacheHitWB << S_CacheFunc) | K_CachePriD)
-#define ICFetchLock ((K_CacheFetchLock << S_CacheFunc) | K_CachePriI)
-#define DCFetchLock ((K_CacheFetchLock << S_CacheFunc) | K_CachePriD)
-
-
-/*
- *************************************************************************
- * P R E F E T C H I N S T R U C T I O N H I N T S *
- *************************************************************************
- */
-
-#define PrefLoad 0
-#define PrefStore 1
-#define PrefLoadStreamed 4
-#define PrefStoreStreamed 5
-#define PrefLoadRetained 6
-#define PrefStoreRetained 7
-#define PrefWBInval 25
-#define PrefNudge 25
-
-
-/*
- *************************************************************************
- * C P U R E G I S T E R D E F I N I T I O N S *
- *************************************************************************
- */
-
-
-/*
- *************************************************************************
- * S O F T W A R E G P R N A M E S *
- *************************************************************************
- */
-
-#define zero $0
-#define AT $1
-#define v0 $2
-#define v1 $3
-#define a0 $4
-#define a1 $5
-#define a2 $6
-#define a3 $7
-#define t0 $8
-#define t1 $9
-#define t2 $10
-#define t3 $11
-#define t4 $12
-#define t5 $13
-#define t6 $14
-#define t7 $15
-#define s0 $16
-#define s1 $17
-#define s2 $18
-#define s3 $19
-#define s4 $20
-#define s5 $21
-#define s6 $22
-#define s7 $23
-#define t8 $24
-#define t9 $25
-#define k0 $26
-#define k1 $27
-#define gp $28
-#define sp $29
-#define fp $30
-#define ra $31
-
-/*
- * The following registers are used by the AVP environment and
- * are not part of the normal software definitions.
- */
-
-#ifdef MIPSAVPENV
-#define repc $25 /* Expected exception PC */
-#define tid $30 /* Current test case address */
-#endif
-
-
-/*
- *************************************************************************
- * H A R D W A R E G P R N A M E S *
- *************************************************************************
- *
- * In the AVP environment, several of the `r' names are removed from the
- * name space because they are used by the kernel for special purposes.
- * Removing them causes assembly rather than runtime errors for tests that
- * use the `r' names.
- *
- * - r25 (repc) is used as the expected PC on an exception
- * - r26-r27 (k0, k1) are used in the exception handler
- * - r30 (tid) is used as the current test address
- */
-
-#define r0 $0
-#define r1 $1
-#define r2 $2
-#define r3 $3
-#define r4 $4
-#define r5 $5
-#define r6 $6
-#define r7 $7
-#define r8 $8
-#define r9 $9
-#define r10 $10
-#define r11 $11
-#define r12 $12
-#define r13 $13
-#define r14 $14
-#define r15 $15
-#define r16 $16
-#define r17 $17
-#define r18 $18
-#define r19 $19
-#define r20 $20
-#define r21 $21
-#define r22 $22
-#define r23 $23
-#define r24 $24
-#ifdef MIPSAVPENV
-#define r25 r25_unknown
-#define r26 r26_unknown
-#define r27 r27_unknown
-#else
-#define r25 $25
-#define r26 $26
-#define r27 $27
-#endif
-#define r28 $28
-#define r29 $29
-#ifdef MIPSAVPENV
-#define r30 r30_unknown
-#else
-#define r30 $30
-#endif
-#define r31 $31
-
-
-/*
- *************************************************************************
- * H A R D W A R E G P R I N D I C E S *
- *************************************************************************
- *
- * These definitions provide the index (number) of the GPR, as opposed
- * to the assembler register name ($n).
- */
-
-#define R_r0 0
-#define R_r1 1
-#define R_r2 2
-#define R_r3 3
-#define R_r4 4
-#define R_r5 5
-#define R_r6 6
-#define R_r7 7
-#define R_r8 8
-#define R_r9 9
-#define R_r10 10
-#define R_r11 11
-#define R_r12 12
-#define R_r13 13
-#define R_r14 14
-#define R_r15 15
-#define R_r16 16
-#define R_r17 17
-#define R_r18 18
-#define R_r19 19
-#define R_r20 20
-#define R_r21 21
-#define R_r22 22
-#define R_r23 23
-#define R_r24 24
-#define R_r25 25
-#define R_r26 26
-#define R_r27 27
-#define R_r28 28
-#define R_r29 29
-#define R_r30 30
-#define R_r31 31
-#define R_hi 32 /* Hi register */
-#define R_lo 33 /* Lo register */
-
-
-/*
- *************************************************************************
- * S O F T W A R E G P R M A S K S *
- *************************************************************************
- *
- * These definitions provide the bit mask corresponding to the GPR number
- */
-
-#define M_AT (1<<1)
-#define M_v0 (1<<2)
-#define M_v1 (1<<3)
-#define M_a0 (1<<4)
-#define M_a1 (1<<5)
-#define M_a2 (1<<6)
-#define M_a3 (1<<7)
-#define M_t0 (1<<8)
-#define M_t1 (1<<9)
-#define M_t2 (1<<10)
-#define M_t3 (1<<11)
-#define M_t4 (1<<12)
-#define M_t5 (1<<13)
-#define M_t6 (1<<14)
-#define M_t7 (1<<15)
-#define M_s0 (1<<16)
-#define M_s1 (1<<17)
-#define M_s2 (1<<18)
-#define M_s3 (1<<19)
-#define M_s4 (1<<20)
-#define M_s5 (1<<21)
-#define M_s6 (1<<22)
-#define M_s7 (1<<23)
-#define M_t8 (1<<24)
-#define M_t9 (1<<25)
-#define M_k0 (1<<26)
-#define M_k1 (1<<27)
-#define M_gp (1<<28)
-#define M_sp (1<<29)
-#define M_fp (1<<30)
-#define M_ra (1<<31)
-
-
-/*
- *************************************************************************
- * C P 0 R E G I S T E R D E F I N I T I O N S *
- *************************************************************************
- * Each register has the following definitions:
- *
- * C0_rrr The register number (as a $n value)
- * R_C0_rrr The register index (as an integer corresponding
- * to the register number)
- *
- * Each field in a register has the following definitions:
- *
- * S_rrrfff The shift count required to right-justify
- * the field. This corresponds to the bit
- * number of the right-most bit in the field.
- * M_rrrfff The Mask required to isolate the field.
- *
- * Register diagrams included below as comments correspond to the
- * MIPS32 and MIPS64 architecture specifications. Refer to other
- * sources for register diagrams for older architectures.
- */
-
-
-/*
- ************************************************************************
- * I N D E X R E G I S T E R ( 0 ) *
- ************************************************************************
- *
- * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * |P| 0 | Index | Index
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define C0_Index $0
-#define R_C0_Index 0
-#define C0_INX C0_Index /* OBSOLETE - DO NOT USE IN NEW CODE */
-
-#define S_IndexP 31 /* Probe failure (R)*/
-#define M_IndexP (0x1 << S_IndexP)
-
-#define S_IndexIndex 0 /* TLB index (R/W)*/
-#define M_IndexIndex (0x3f << S_IndexIndex)
-
-#define M_Index0Fields 0x7fffffc0
-#define M_IndexRFields 0x80000000
-
-
-/*
- ************************************************************************
- * R A N D O M R E G I S T E R ( 1 ) *
- ************************************************************************
- *
- * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | 0 | Index | Random
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define C0_Random $1
-#define R_C0_Random 1
-#define C0_RAND $1 /* OBSOLETE - DO NOT USE IN NEW CODE */
-
-#define S_RandomIndex 0 /* TLB random index (R)*/
-#define M_RandomIndex (0x3f << S_RandomIndex)
-
-#define M_Random0Fields 0xffffffc0
-#define M_RandomRFields 0x0000003f
-
-
-/*
- ************************************************************************
- * E N T R Y L O 0 R E G I S T E R ( 2 ) *
- ************************************************************************
- *
- * 6 6 6 6 5 // 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 3 2 1 0 9 // 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Fill (0) //| 0 | PFN | C |D|V|G| EntryLo0
- * +-+-+-+-+-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define C0_EntryLo0 $2
-#define R_C0_EntryLo0 2
-#define C0_TLBLO_0 C0_EntryLo0 /* OBSOLETE - DO NOT USE IN NEW CODE */
-
-#define S_EntryLoPFN 6 /* PFN (R/W) */
-#define M_EntryLoPFN (0xffffff << S_EntryLoPFN)
-#define S_EntryLoC 3 /* Coherency attribute (R/W) */
-#define M_EntryLoC (0x7 << S_EntryLoC)
-#define S_EntryLoD 2 /* Dirty (R/W) */
-#define M_EntryLoD (0x1 << S_EntryLoD)
-#define S_EntryLoV 1 /* Valid (R/W) */
-#define M_EntryLoV (0x1 << S_EntryLoV)
-#define S_EntryLoG 0 /* Global (R/W) */
-#define M_EntryLoG (0x1 << S_EntryLoG)
-#define M_EntryLoOddPFN (0x1 << S_EntryLoPFN) /* Odd PFN bit */
-#define S_EntryLo_RS K_PageAlign /* Right-justify PFN */
-#define S_EntryLo_LS S_EntryLoPFN /* Position PFN to appropriate position */
-
-#define M_EntryLo0Fields 0x00000000
-#define M_EntryLoRFields 0xc0000000
-#define M_EntryLo0Fields64 UNS64Const(0x0000000000000000)
-#define M_EntryLoRFields64 UNS64Const(0xffffffffc0000000)
-
-/*
- * Cache attribute values in the C field of EntryLo and the
- * K0 field of Config
- */
-#define K_CacheAttrCWTnWA 0 /* Cacheable, write-thru, no write allocate */
-#define K_CacheAttrCWTWA 1 /* Cacheable, write-thru, write allocate */
-#define K_CacheAttrU 2 /* Uncached */
-#define K_CacheAttrC 3 /* Cacheable */
-#define K_CacheAttrCN 3 /* Cacheable, non-coherent */
-#define K_CacheAttrCCE 4 /* Cacheable, coherent, exclusive */
-#define K_CacheAttrCCS 5 /* Cacheable, coherent, shared */
-#define K_CacheAttrCCU 6 /* Cacheable, coherent, update */
-#define K_CacheAttrUA 7 /* Uncached accelerated */
-
-
-/*
- ************************************************************************
- * E N T R Y L O 1 R E G I S T E R ( 3 ) *
- ************************************************************************
- *
- * 6 6 6 6 5 // 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 3 2 1 0 9 // 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Fill (0) //| 0 | PFN | C |D|V|G| EntryLo1
- * +-+-+-+-+-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define C0_EntryLo1 $3
-#define R_C0_EntryLo1 3
-#define C0_TLBLO_1 C0_EntryLo1 /* OBSOLETE - DO NOT USE IN NEW CODE */
-
-/*
- * Field definitions are as given for EntryLo0 above
- */
-
-
-/*
- ************************************************************************
- * C O N T E X T R E G I S T E R ( 4 ) *
- ************************************************************************
- *
- * 6 // 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 3 // 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | // PTEBase | BadVPN<31:13> | 0 | Context
- * +-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define C0_Context $4
-#define R_C0_Context 4
-#define C0_CTXT C0_Context /* OBSOLETE - DO NOT USE IN NEW CODE */
-
-#define S_ContextPTEBase 23 /* PTE base (R/W) */
-#define M_ContextPTEBase (0x1ff << S_ContextPTEBase)
-#define S_ContextBadVPN 4 /* BadVPN2 (R) */
-#define M_ContextBadVPN (0x7ffff << S_ContextBadVPN)
-#define S_ContextBadVPN_LS 9 /* Position BadVPN to bit 31 */
-#define S_ContextBadVPN_RS 13 /* Right-justify shifted BadVPN field */
-
-#define M_Context0Fields 0x0000000f
-#define M_ContextRFields 0x007ffff0
-#define M_Context0Fields64 UNS64Const(0x000000000000000f)
-#define M_ContextRFields64 UNS64Const(0x00000000007ffff0)
-
-
-/*
- ************************************************************************
- * P A G E M A S K R E G I S T E R ( 5 ) *
- ************************************************************************
- *
- * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | 0 | Mask | 0 | PageMask
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define C0_PageMask $5
-#define R_C0_PageMask 5 /* Mask (R/W) */
-#define C0_PGMASK C0_PageMask /* OBSOLETE - DO NOT USE IN NEW CODE */
-
-#define S_PageMaskMask 13
-#define M_PageMaskMask (0xfff << S_PageMaskMask)
-
-#define M_PageMask0Fields 0xfe001fff
-#define M_PageMaskRFields 0x00000000
-
-/*
- * Values in the Mask field
- */
-#define K_PageMask4K 0x000 /* K_PageMasknn values are values for use */
-#define K_PageMask16K 0x003 /* with KReqPageAttributes or KReqPageMask macros */
-#define K_PageMask64K 0x00f
-#define K_PageMask256K 0x03f
-#define K_PageMask1M 0x0ff
-#define K_PageMask4M 0x3ff
-#define K_PageMask16M 0xfff
-
-#define M_PageMask4K (K_PageMask4K << S_PageMaskMask) /* M_PageMasknn values are masks */
-#define M_PageMask16K (K_PageMask16K << S_PageMaskMask) /* in position in the PageMask register */
-#define M_PageMask64K (K_PageMask64K << S_PageMaskMask)
-#define M_PageMask256K (K_PageMask256K << S_PageMaskMask)
-#define M_PageMask1M (K_PageMask1M << S_PageMaskMask)
-#define M_PageMask4M (K_PageMask4M << S_PageMaskMask)
-#define M_PageMask16M (K_PageMask16M << S_PageMaskMask)
-
-
-/*
- ************************************************************************
- * W I R E D R E G I S T E R ( 6 ) *
- ************************************************************************
- *
- * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | 0 | Index | Wired
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define C0_Wired $6
-#define R_C0_Wired 6
-#define C0_TLBWIRED C0_Wired /* OBSOLETE - DO NOT USE IN NEW CODE */
-
-#define S_WiredIndex 0 /* TLB wired boundary (R/W) */
-#define M_WiredIndex (0x3f << S_WiredIndex)
-
-#define M_Wired0Fields 0xffffffc0
-#define M_WiredRFields 0x00000000
-
-
-/*
- ************************************************************************
- * B A D V A D D R R E G I S T E R ( 8 ) *
- ************************************************************************
- *
- * 6 // 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 3 // 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | // Bad Virtual Address | BadVAddr
- * +-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define C0_BadVAddr $8
-#define R_C0_BadVAddr 8
-#define C0_BADVADDR C0_BadVAddr /* OBSOLETE - DO NOT USE IN NEW CODE */
-
-#define M_BadVAddrOddPage K_PageSize /* Even/Odd VA bit for pair of PAs */
-
-#define M_BadVAddr0Fields 0x00000000
-#define M_BadVAddrRFields 0xffffffff
-#define M_BadVAddr0Fields64 UNS64Const(0x0000000000000000)
-#define M_BadVAddrRFields64 UNS64Const(0xffffffffffffffff)
-
-/*
- ************************************************************************
- * C O U N T R E G I S T E R ( 9 ) *
- ************************************************************************
- *
- * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Count Value | Count
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define C0_Count $9
-#define R_C0_Count 9
-#define C0_COUNT C0_Count /* OBSOLETE - DO NOT USE IN NEW CODE */
-
-#define M_Count0Fields 0x00000000
-#define M_CountRFields 0x00000000
-
-
-/*
- ************************************************************************
- * E N T R Y H I R E G I S T E R ( 1 0 ) *
- ************************************************************************
- *
- * 6 6 6 6 5 // 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 3 2 1 0 9 // 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | R | Fill // VPN2 | 0 | ASID | EntryHi
- * +-+-+-+-+-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define C0_EntryHi $10
-#define R_C0_EntryHi 10
-#define C0_TLBHI C0_EntryHi /* OBSOLETE - DO NOT USE IN NEW CODE */
-
-#define S_EntryHiR64 62 /* Region (R/W) */
-#define M_EntryHiR64 UNS64Const(0xc000000000000000)
-#define S_EntryHiVPN2 13 /* VPN/2 (R/W) */
-#define M_EntryHiVPN2 (0x7ffff << S_EntryHiVPN2)
-#define M_EntryHiVPN264 UNS64Const(0x000000ffffffe000)
-#define S_EntryHiASID 0 /* ASID (R/W) */
-#define M_EntryHiASID (0xff << S_EntryHiASID)
-#define S_EntryHiVPN_Shf S_EntryHiVPN2
-
-#define M_EntryHi0Fields 0x00001f00
-#define M_EntryHiRFields 0x00000000
-#define M_EntryHi0Fields64 UNS64Const(0x0000000000001f00)
-#define M_EntryHiRFields64 UNS64Const(0x3fffff0000000000)
-
-
-/*
- ************************************************************************
- * C O M P A R E R E G I S T E R ( 1 1 ) *
- ************************************************************************
- *
- * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Compare Value | Compare
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define C0_Compare $11
-#define R_C0_Compare 11
-#define C0_COMPARE C0_Compare /* OBSOLETE - DO NOT USE IN NEW CODE */
-
-#define M_Compare0Fields 0x00000000
-#define M_CompareRFields 0x00000000
-
-
-/*
- ************************************************************************
- * S T A T U S R E G I S T E R ( 1 2 ) *
- ************************************************************************
- *
- * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * |C|C|C|C|R|F|R|M|P|B|T|S|M| | R |I|I|I|I|I|I|I|I|K|S|U|U|R|E|E|I|
- * |U|U|U|U|P|R|E|X|X|E|S|R|M| | s |M|M|M|M|M|M|M|M|X|X|X|M|s|R|X|E| Status
- * |3|2|1|0| | | | | |V| | |I| | v |7|6|5|4|3|2|1|0| | | | |v|L|L| |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define C0_Status $12
-#define R_C0_Status 12
-#define C0_SR C0_Status /* OBSOLETE - DO NOT USE IN NEW CODE */
-
-#define S_StatusCU 28 /* Coprocessor enable (R/W) */
-#define M_StatusCU (0xf << S_StatusCU)
-#define S_StatusCU3 31
-#define M_StatusCU3 (0x1 << S_StatusCU3)
-#define S_StatusCU2 30
-#define M_StatusCU2 (0x1 << S_StatusCU2)
-#define S_StatusCU1 29
-#define M_StatusCU1 (0x1 << S_StatusCU1)
-#define S_StatusCU0 28
-#define M_StatusCU0 (0x1 << S_StatusCU0)
-#define S_StatusRP 27 /* Enable reduced power mode (R/W) */
-#define M_StatusRP (0x1 << S_StatusRP)
-#define S_StatusFR 26 /* Enable 64-bit FPRs (MIPS64 only) (R/W) */
-#define M_StatusFR (0x1 << S_StatusFR)
-#define S_StatusRE 25 /* Enable reverse endian (R/W) */
-#define M_StatusRE (0x1 << S_StatusRE)
-#define S_StatusMX 24 /* Enable access to MDMX resources (MIPS64 only) (R/W) */
-#define M_StatusMX (0x1 << S_StatusMX)
-#define S_StatusPX 23 /* Enable access to 64-bit instructions/data (MIPS64 only) (R/W) */
-#define M_StatusPX (0x1 << S_StatusPX)
-#define S_StatusBEV 22 /* Enable Boot Exception Vectors (R/W) */
-#define M_StatusBEV (0x1 << S_StatusBEV)
-#define S_StatusTS 21 /* Denote TLB shutdown (R/W) */
-#define M_StatusTS (0x1 << S_StatusTS)
-#define S_StatusSR 20 /* Denote soft reset (R/W) */
-#define M_StatusSR (0x1 << S_StatusSR)
-#define S_StatusNMI 19
-#define M_StatusNMI (0x1 << S_StatusNMI) /* Denote NMI (R/W) */
-#define S_StatusIM 8 /* Interrupt mask (R/W) */
-#define M_StatusIM (0xff << S_StatusIM)
-#define S_StatusIM7 15
-#define M_StatusIM7 (0x1 << S_StatusIM7)
-#define S_StatusIM6 14
-#define M_StatusIM6 (0x1 << S_StatusIM6)
-#define S_StatusIM5 13
-#define M_StatusIM5 (0x1 << S_StatusIM5)
-#define S_StatusIM4 12
-#define M_StatusIM4 (0x1 << S_StatusIM4)
-#define S_StatusIM3 11
-#define M_StatusIM3 (0x1 << S_StatusIM3)
-#define S_StatusIM2 10
-#define M_StatusIM2 (0x1 << S_StatusIM2)
-#define S_StatusIM1 9
-#define M_StatusIM1 (0x1 << S_StatusIM1)
-#define S_StatusIM0 8
-#define M_StatusIM0 (0x1 << S_StatusIM0)
-#define S_StatusKX 7 /* Enable access to extended kernel addresses (MIPS64 only) (R/W) */
-#define M_StatusKX (0x1 << S_StatusKX)
-#define S_StatusSX 6 /* Enable access to extended supervisor addresses (MIPS64 only) (R/W) */
-#define M_StatusSX (0x1 << S_StatusSX)
-#define S_StatusUX 5 /* Enable access to extended user addresses (MIPS64 only) (R/W) */
-#define M_StatusUX (0x1 << S_StatusUX)
-#define S_StatusKSU 3 /* Two-bit current mode (R/W) */
-#define M_StatusKSU (0x3 << S_StatusKSU)
-#define S_StatusUM 4 /* User mode if supervisor mode not implemented (R/W) */
-#define M_StatusUM (0x1 << S_StatusUM)
-#define S_StatusSM 3 /* Supervisor mode (R/W) */
-#define M_StatusSM (0x1 << S_StatusSM)
-#define S_StatusERL 2 /* Denotes error level (R/W) */
-#define M_StatusERL (0x1 << S_StatusERL)
-#define S_StatusEXL 1 /* Denotes exception level (R/W) */
-#define M_StatusEXL (0x1 << S_StatusEXL)
-#define S_StatusIE 0 /* Enables interrupts (R/W) */
-#define M_StatusIE (0x1 << S_StatusIE)
-
-#define M_Status0Fields 0x00040000
-#define M_StatusRFields 0x058000e0 /* FR, MX, PX, KX, SX, UX unused in MIPS32 */
-#define M_Status0Fields64 0x00040000
-#define M_StatusRFields64 0x00000000
-
-/*
- * Values in the KSU field
- */
-#define K_StatusKSU_U 2 /* User mode in KSU field */
-#define K_StatusKSU_S 1 /* Supervisor mode in KSU field */
-#define K_StatusKSU_K 0 /* Kernel mode in KSU field */
-
-
-/*
- ************************************************************************
- * C A U S E R E G I S T E R ( 1 3 ) *
- ************************************************************************
- *
- * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * |B| | C | |I|W| |I|I|I|I|I|I|I|I| | | R |
- * |D| | E | Rsvd |V|P| Rsvd |P|P|P|P|P|P|P|P| | ExcCode | s | Cause
- * | | | | | | | |7|6|5|4|3|2|1|0| | | v |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define C0_Cause $13
-#define R_C0_Cause 13
-#define C0_CAUSE C0_Cause /* OBSOLETE - DO NOT USE IN NEW CODE */
-
-#define S_CauseBD 31
-#define M_CauseBD (0x1 << S_CauseBD)
-#define S_CauseCE 28
-#define M_CauseCE (0x3<< S_CauseCE)
-#define S_CauseIV 23
-#define M_CauseIV (0x1 << S_CauseIV)
-#define S_CauseWP 22
-#define M_CauseWP (0x1 << S_CauseWP)
-#define S_CauseIP 8
-#define M_CauseIP (0xff << S_CauseIP)
-#define S_CauseIPEXT 10
-#define M_CauseIPEXT (0x3f << S_CauseIPEXT)
-#define S_CauseIP7 15
-#define M_CauseIP7 (0x1 << S_CauseIP7)
-#define S_CauseIP6 14
-#define M_CauseIP6 (0x1 << S_CauseIP6)
-#define S_CauseIP5 13
-#define M_CauseIP5 (0x1 << S_CauseIP5)
-#define S_CauseIP4 12
-#define M_CauseIP4 (0x1 << S_CauseIP4)
-#define S_CauseIP3 11
-#define M_CauseIP3 (0x1 << S_CauseIP3)
-#define S_CauseIP2 10
-#define M_CauseIP2 (0x1 << S_CauseIP2)
-#define S_CauseIP1 9
-#define M_CauseIP1 (0x1 << S_CauseIP1)
-#define S_CauseIP0 8
-#define M_CauseIP0 (0x1 << S_CauseIP0)
-#define S_CauseExcCode 2
-#define M_CauseExcCode (0x1f << S_CauseExcCode)
-
-#define M_Cause0Fields 0x4f3f0083
-#define M_CauseRFields 0xb000fc7c
-
-/*
- * Values in the CE field
- */
-#define K_CauseCE0 0 /* Coprocessor 0 in the CE field */
-#define K_CauseCE1 1 /* Coprocessor 1 in the CE field */
-#define K_CauseCE2 2 /* Coprocessor 2 in the CE field */
-#define K_CauseCE3 3 /* Coprocessor 3 in the CE field */
-
-/*
- * Values in the ExcCode field
- */
-#define EX_INT 0 /* Interrupt */
-#define EXC_INT (EX_INT << S_CauseExcCode)
-#define EX_MOD 1 /* TLB modified */
-#define EXC_MOD (EX_MOD << S_CauseExcCode)
-#define EX_TLBL 2 /* TLB exception (load or ifetch) */
-#define EXC_TLBL (EX_TLBL << S_CauseExcCode)
-#define EX_TLBS 3 /* TLB exception (store) */
-#define EXC_TLBS (EX_TLBS << S_CauseExcCode)
-#define EX_ADEL 4 /* Address error (load or ifetch) */
-#define EXC_ADEL (EX_ADEL << S_CauseExcCode)
-#define EX_ADES 5 /* Address error (store) */
-#define EXC_ADES (EX_ADES << S_CauseExcCode)
-#define EX_IBE 6 /* Instruction Bus Error */
-#define EXC_IBE (EX_IBE << S_CauseExcCode)
-#define EX_DBE 7 /* Data Bus Error */
-#define EXC_DBE (EX_DBE << S_CauseExcCode)
-#define EX_SYS 8 /* Syscall */
-#define EXC_SYS (EX_SYS << S_CauseExcCode)
-#define EX_SYSCALL EX_SYS
-#define EXC_SYSCALL EXC_SYS
-#define EX_BP 9 /* Breakpoint */
-#define EXC_BP (EX_BP << S_CauseExcCode)
-#define EX_BREAK EX_BP
-#define EXC_BREAK EXC_BP
-#define EX_RI 10 /* Reserved instruction */
-#define EXC_RI (EX_RI << S_CauseExcCode)
-#define EX_CPU 11 /* CoProcessor Unusable */
-#define EXC_CPU (EX_CPU << S_CauseExcCode)
-#define EX_OV 12 /* OVerflow */
-#define EXC_OV (EX_OV << S_CauseExcCode)
-#define EX_TR 13 /* Trap instruction */
-#define EXC_TR (EX_TR << S_CauseExcCode)
-#define EX_TRAP EX_TR
-#define EXC_TRAP EXC_TR
-#define EX_FPE 15 /* floating point exception */
-#define EXC_FPE (EX_FPE << S_CauseExcCode)
-#define EX_C2E 18 /* COP2 exception */
-#define EXC_C2E (EX_C2E << S_CauseExcCode)
-#define EX_MDMX 22 /* MDMX exception */
-#define EXC_MDMX (EX_MDMX << S_CauseExcCode)
-#define EX_WATCH 23 /* Watch exception */
-#define EXC_WATCH (EX_WATCH << S_CauseExcCode)
-#define EX_MCHECK 24 /* Machine check exception */
-#define EXC_MCHECK (EX_MCHECK << S_CauseExcCode)
-#define EX_CacheErr 30 /* Cache error caused re-entry to Debug Mode */
-#define EXC_CacheErr (EX_CacheErr << S_CauseExcCode)
-
-
-/*
- ************************************************************************
- * E P C R E G I S T E R ( 1 4 ) *
- ************************************************************************
- *
- * 6 // 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 3 // 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | // Exception PC | EPC
- * +-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define C0_EPC $14
-#define R_C0_EPC 14
-
-#define M_EPC0Fields 0x00000000
-#define M_EPCRFields 0x00000000
-#define M_EPC0Fields64 UNS64Const(0x0000000000000000)
-#define M_EPCRFields64 UNS64Const(0x0000000000000000)
-
-/*
- ************************************************************************
- * P R I D R E G I S T E R ( 1 5 ) *
- ************************************************************************
- *
- * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Company Opts | Company ID | Procesor ID | Revision | PRId
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define C0_PRId $15
-#define R_C0_PRId 15
-#define C0_PRID C0_PRID /* OBSOLETE - DO NOT USE IN NEW CODE */
-
-#define S_PRIdCoOpt 24 /* Company options (R) */
-#define M_PRIdCoOpt (0xff << S_PRIdCoOpt)
-#define S_PRIdCoID 16 /* Company ID (R) */
-#define M_PRIdCoID (0xff << S_PRIdCoID)
-#define S_PRIdImp 8 /* Implementation ID (R) */
-#define M_PRIdImp (0xff << S_PRIdImp)
-#define S_PRIdRev 0 /* Revision (R) */
-#define M_PRIdRev (0xff << S_PRIdRev)
-
-#define M_PRId0Fields 0x00000000
-#define M_PRIdRFields 0xffffffff
-/*
- * Values in the Company ID field
- */
-#define K_PRIdCoID_MIPS 1
-#define K_PRIdCoID_Broadcom 2
-#define K_PRIdCoID_Alchemy 3
-#define K_PRIdCoID_SiByte 4
-#define K_PRIdCoID_SandCraft 5
-#define K_PRIdCoID_Philips 6
-#define K_PRIdCoID_NextAvailable 7 /* Next available encoding */
-
-
-/*
- * Values in the implementation number field
- */
-#define K_PRIdImp_Jade 0x80
-#define K_PRIdImp_Opal 0x81
-#define K_PRIdImp_Ruby 0x82
-#define K_PRIdImp_JadeLite 0x83
-#define K_PRIdImp_4KEc 0x84 /* Emerald with TLB MMU */
-#define K_PRIdImp_4KEmp 0x85 /* Emerald with FM MMU */
-#define K_PRIdImp_4KSc 0x86 /* Coral */
-
-#define K_PRIdImp_R3000 0x01
-#define K_PRIdImp_R4000 0x04
-#define K_PRIdImp_R10000 0x09
-#define K_PRIdImp_R4300 0x0b
-#define K_PRIdImp_R5000 0x23
-#define K_PRIdImp_R5200 0x28
-#define K_PRIdImp_R5400 0x54
-
-/*
- ************************************************************************
- * C O N F I G R E G I S T E R ( 1 6 ) *
- ************************************************************************
- *
- * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * |M| |B| A | A | | K | Config
- * | | Reserved for Implementations|E| T | R | Reserved | 0 |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define C0_Config $16
-#define R_C0_Config 16
-#define C0_CONFIG C0_Config /* OBSOLETE - DO NOT USE IN NEW CODE */
-
-#define S_ConfigMore 31 /* Additional config registers present (R) */
-#define M_ConfigMore (0x1 << S_ConfigMore)
-#define S_ConfigImpl 16 /* Implementation-specific fields */
-#define M_ConfigImpl (0x7fff << S_ConfigImpl)
-#define S_ConfigBE 15 /* Denotes big-endian operation (R) */
-#define M_ConfigBE (0x1 << S_ConfigBE)
-#define S_ConfigAT 13 /* Architecture type (R) */
-#define M_ConfigAT (0x3 << S_ConfigAT)
-#define S_ConfigAR 10 /* Architecture revision (R) */
-#define M_ConfigAR (0x7 << S_ConfigAR)
-#define S_ConfigMT 7 /* MMU Type (R) */
-#define M_ConfigMT (0x7 << S_ConfigMT)
-#define S_ConfigK0 0 /* Kseg0 coherency algorithm (R/W) */
-#define M_ConfigK0 (0x7 << S_ConfigK0)
-
-/*
- * The following definitions are technically part of the "reserved for
- * implementations" field, but are the semi-standard definition used in
- * fixed-mapping MMUs to control the cacheability of kuseg and kseg2/3
- * references. For that reason, they are included here, but may be
- * overridden by true implementation-specific definitions
- */
-#define S_ConfigK23 28 /* Kseg2/3 coherency algorithm (FM MMU only) (R/W) */
-#define M_ConfigK23 (0x7 << S_ConfigK23)
-#define S_ConfigKU 25 /* Kuseg coherency algorithm (FM MMU only) (R/W) */
-#define M_ConfigKU (0x7 << S_ConfigKU)
-
-#define M_Config0Fields 0x00000078
-#define M_ConfigRFields 0x8000ff80
-
-/*
- * Values in the AT field
- */
-#define K_ConfigAT_MIPS32 0 /* MIPS32 */
-#define K_ConfigAT_MIPS64S 1 /* MIPS64 with 32-bit addresses */
-#define K_ConfigAT_MIPS64 2 /* MIPS64 with 32/64-bit addresses */
-
-/*
- * Values in the MT field
- */
-#define K_ConfigMT_NoMMU 0 /* No MMU */
-#define K_ConfigMT_TLBMMU 1 /* Standard TLB MMU */
-#define K_ConfigMT_BATMMU 2 /* Standard BAT MMU */
-#define K_ConfigMT_FMMMU 3 /* Standard Fixed Mapping MMU */
-
-
-/*
- ************************************************************************
- * C O N F I G 1 R E G I S T E R ( 1 6, SELECT 1 ) *
- ************************************************************************
- *
- * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * |M| MMU Size | IS | IL | IA | DS | DL | DA |C|M|P|W|C|E|F| Config1
- * | | | | | | | | |2|D|C|R|A|P|P|
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define C0_Config1 $16,1
-#define R_C0_Config1 16
-
-#define S_Config1More 31 /* Additional Config registers present (R) */
-#define M_Config1More (0x1 << S_Config1More)
-#define S_Config1MMUSize 25 /* Number of MMU entries - 1 (R) */
-#define M_Config1MMUSize (0x3f << S_Config1MMUSize)
-#define S_Config1IS 22 /* Icache sets per way (R) */
-#define M_Config1IS (0x7 << S_Config1IS)
-#define S_Config1IL 19 /* Icache line size (R) */
-#define M_Config1IL (0x7 << S_Config1IL)
-#define S_Config1IA 16 /* Icache associativity - 1 (R) */
-#define M_Config1IA (0x7 << S_Config1IA)
-#define S_Config1DS 13 /* Dcache sets per way (R) */
-#define M_Config1DS (0x7 << S_Config1DS)
-#define S_Config1DL 10 /* Dcache line size (R) */
-#define M_Config1DL (0x7 << S_Config1DL)
-#define S_Config1DA 7 /* Dcache associativity (R) */
-#define M_Config1DA (0x7 << S_Config1DA)
-#define S_Config1C2 6 /* Coprocessor 2 present (R) */
-#define M_Config1C2 (0x1 << S_Config1C2)
-#define S_Config1MD 5 /* Denotes MDMX present (R) */
-#define M_Config1MD (0x1 << S_Config1MD)
-#define S_Config1PC 4 /* Denotes performance counters present (R) */
-#define M_Config1PC (0x1 << S_Config1PC)
-#define S_Config1WR 3 /* Denotes watch registers present (R) */
-#define M_Config1WR (0x1 << S_Config1WR)
-#define S_Config1CA 2 /* Denotes MIPS-16 present (R) */
-#define M_Config1CA (0x1 << S_Config1CA)
-#define S_Config1EP 1 /* Denotes EJTAG present (R) */
-#define M_Config1EP (0x1 << S_Config1EP)
-#define S_Config1FP 0 /* Denotes floating point present (R) */
-#define M_Config1FP (0x1 << S_Config1FP)
-
-#define M_Config10Fields 0x00000060
-#define M_Config1RFields 0x7fffff9f
-
-/*
- * The following macro generates a table that is indexed
- * by the Icache or Dcache sets field in Config1 and
- * contains the decoded value of sets per way
- */
-#define Config1CacheSets() \
- HALF(64); \
- HALF(128); \
- HALF(256); \
- HALF(512); \
- HALF(1024); \
- HALF(2048); \
- HALF(4096); \
- HALF(8192);
-
-/*
- * The following macro generates a table that is indexed
- * by the Icache or Dcache line size field in Config1 and
- * contains the decoded value of the cache line size, in bytes
- */
-#define Config1CacheLineSize() \
- HALF(0); \
- HALF(4); \
- HALF(8); \
- HALF(16); \
- HALF(32); \
- HALF(64); \
- HALF(128); \
- HALF(256);
-
-
-/*
- ************************************************************************
- * C O N F I G 2 R E G I S T E R ( 1 6, SELECT 2 ) *
- ************************************************************************
- *
- * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * |M| | | | | | | | | | | | |S|T| Config1
- * | | | | | | | | | | | | | |M|L|
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define C0_Config2 $16,2
-#define R_C0_Config2 16
-
-#define S_Config2More 31 /* Additional Config registers present (R) */
-#define M_Config2More (0x1 << S_Config2More)
-#define S_Config2SM 1 /* Denotes SmartMIPS ASE present (R) */
-#define M_Config2SM (0x1 << S_Config2SM)
-#define S_Config2TL 0 /* Denotes Tracing Logic present (R) */
-#define M_Config2TL (0x1 << S_Config2TL)
-
-#define M_Config20Fields 0xfffffffc
-#define M_Config2RFields 0x00000003
-
-/*
- ************************************************************************
- * L L A D D R R E G I S T E R ( 1 7 ) *
- ************************************************************************
- *
- * 6 6 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | // LL Physical Address | LLAddr
- * +-+-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define C0_LLAddr $17
-#define R_C0_LLAddr 17
-#define C0_LLADDR C0_LLAddr /* OBSOLETE - DO NOT USE IN NEW CODE */
-
-#define M_LLAddr0Fields 0x00000000
-#define M_LLAddrRFields 0x00000000
-#define M_LLAddr0Fields64 UNS64Const(0x0000000000000000)
-#define M_LLAddrRFields64 UNS64Const(0x0000000000000000)
-
-
-/*
- ************************************************************************
- * W A T C H L O R E G I S T E R ( 1 8 ) *
- ************************************************************************
- *
- * 6 // 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 3 // 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | // Watch Virtual Address |I|R|W| WatchLo
- * +-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define C0_WatchLo $18
-#define R_C0_WatchLo 18
-#define C0_WATCHLO C0_WatchLo /* OBSOLETE - DO NOT USE IN NEW CODE */
-
-#define S_WatchLoVAddr 3 /* Watch virtual address (R/W) */
-#define M_WatchLoVAddr (0x1fffffff << S_WatchLoVAddr)
-#define S_WatchLoI 2 /* Enable Istream watch (R/W) */
-#define M_WatchLoI (0x1 << S_WatchLoI)
-#define S_WatchLoR 1 /* Enable data read watch (R/W) */
-#define M_WatchLoR (0x1 << S_WatchLoR)
-#define S_WatchLoW 0 /* Enable data write watch (R/W) */
-#define M_WatchLoW (0x1 << S_WatchLoW)
-
-#define M_WatchLo0Fields 0x00000000
-#define M_WatchLoRFields 0x00000000
-#define M_WatchLo0Fields64 UNS64Const(0x0000000000000000)
-#define M_WatchLoRFields64 UNS64Const(0x0000000000000000)
-
-#define M_WatchLoEnables (M_WatchLoI | M_WatchLoR | M_WatchLoW)
-
-
-/*
- ************************************************************************
- * W A T C H H I R E G I S T E R ( 1 9 ) *
- ************************************************************************
- *
- * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * |M|G| Rsvd | ASID | Rsvd | Mask | 0 | WatchHi
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define C0_WatchHi $19
-#define R_C0_WatchHi 19
-#define C0_WATCHHI C0_WatchHi /* OBSOLETE - DO NOT USE IN NEW CODE */
-
-#define S_WatchHiM 31 /* Denotes additional Watch registers present (R) */
-#define M_WatchHiM (0x1 << S_WatchHiM)
-#define S_WatchHiG 30 /* Enable ASID-independent Watch match (R/W) */
-#define M_WatchHiG (0x1 << S_WatchHiG)
-#define S_WatchHiASID 16 /* ASID value to match (R/W) */
-#define M_WatchHiASID (0xff << S_WatchHiASID)
-#define S_WatchHiMask 3 /* Address inhibit mask (R/W) */
-#define M_WatchHiMask (0x1ff << S_WatchHiMask)
-
-#define M_WatchHi0Fields 0x3f00f007
-#define M_WatchHiRFields 0x80000000
-
-
-/*
- ************************************************************************
- * X C O N T E X T R E G I S T E R ( 2 0 ) *
- ************************************************************************
- *
- * 6 // 3 3 3 3 3 3 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 3 // 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | // PTEBase | R | BadVPN2<39:13> | 0 | XContext
- * +-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define C0_XContext $20
-#define R_C0_XContext 20
-#define C0_EXTCTXT C0_XContext /* OBSOLETE - DO NOT USE IN NEW CODE */
-
-#define S_XContextBadVPN2 4 /* BadVPN2 (R) */
-#define S_XContextBadVPN S_XContextBadVPN2
-
-#define M_XContext0Fields 0x0000000f
-
-
-/*
- ************************************************************************
- * D E B U G R E G I S T E R ( 2 3 ) *
- ************************************************************************
- *
- * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * |D|D|N|L|D|H|C|I|M|C|D|I|D|D| | |N|S| |D|D|D|D|D|D|
- * |B|M|o|S|o|a|o|B|C|a|B|E|D|D|EJTAG|DExcCode |o|S| |I|I|D|D|B|S|
- * |D| |D|N|z|l|u|u|h|c|u|X|B|B| ver | |S|t| |N|B|B|B|p|S|
- * | | |C|M|e|t|n|s|e|h|s|I|S|L| | |S| | 0 |T| |S|L| | | Debug
- * | | |R| | | |t|E|c|e|E| |I|I| | |t| | | | | | | | |
- * | | | | | | |D|P|k|E|P| |m|m| | | | | | | | | | | |
- * | | | | | | |M| |P|P| | |p|p| | | | | | | | | | | |
- * | | | | | | | | | | | | |r|r| | | | | | | | | | | |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define C0_Debug $23 /* EJTAG */
-#define R_C0_Debug 23
-
-#define S_DebugDBD 31 /* Debug branch delay (R) */
-#define M_DebugDBD (0x1 << S_DebugDBD)
-#define S_DebugDM 30 /* Debug mode (R) */
-#define M_DebugDM (0x1 << S_DebugDM)
-#define S_DebugNoDCR 29 /* No debug control register present (R) */
-#define M_DebugNoDCR (0x1 << S_DebugNoDCR)
-#define S_DebugLSNM 28 /* Load/Store Normal Memory (R/W) */
-#define M_DebugLSNM (0x1 << S_DebugLSNM)
-#define S_DebugDoze 27 /* Doze (R) */
-#define M_DebugDoze (0x1 << S_DebugDoze)
-#define S_DebugHalt 26 /* Halt (R) */
-#define M_DebugHalt (0x1 << S_DebugHalt)
-#define S_DebugCountDM 25 /* Count register behavior in debug mode (R/W) */
-#define M_DebugCountDM (0x1 << S_DebugCountDM)
-#define S_DebugIBusEP 24 /* Imprecise Instn Bus Error Pending (R/W) */
-#define M_DebugIBusEP (0x1 << S_DebugIBusEP)
-#define S_DebugMCheckP 23 /* Imprecise Machine Check Pending (R/W) */
-#define M_DebugMCheckP (0x1 << S_DebugMCheckP)
-#define S_DebugCacheEP 22 /* Imprecise Cache Error Pending (R/W) */
-#define M_DebugCacheEP (0x1 << S_DebugCacheEP)
-#define S_DebugDBusEP 21 /* Imprecise Data Bus Error Pending (R/W) */
-#define M_DebugDBusEP (0x1 << S_DebugDBusEP)
-#define S_DebugIEXI 20 /* Imprecise Exception Inhibit (R/W) */
-#define M_DebugIEXI (0x1 << S_DebugIEXI)
-#define S_DebugDDBSImpr 19 /* Debug data break store imprecise (R) */
-#define M_DebugDDBSImpr (0x1 << S_DebugDDBSImpr)
-#define S_DebugDDBLImpr 18 /* Debug data break load imprecise (R) */
-#define M_DebugDDBLImpr (0x1 << S_DebugDDBLImpr)
-#define S_DebugEJTAGver 15 /* EJTAG version number (R) */
-#define M_DebugEJTAGver (0x7 << S_DebugEJTAGver)
-#define S_DebugDExcCode 10 /* Debug exception code (R) */
-#define M_DebugDExcCode (0x1f << S_DebugDExcCode)
-#define S_DebugNoSSt 9 /* No single step implemented (R) */
-#define M_DebugNoSSt (0x1 << S_DebugNoSSt)
-#define S_DebugSSt 8 /* Single step enable (R/W) */
-#define M_DebugSSt (0x1 << S_DebugSSt)
-#define S_DebugDINT 5 /* Debug interrupt (R) */
-#define M_DebugDINT (0x1 << S_DebugDINT)
-#define S_DebugDIB 4 /* Debug instruction break (R) */
-#define M_DebugDIB (0x1 << S_DebugDIB)
-#define S_DebugDDBS 3 /* Debug data break store (R) */
-#define M_DebugDDBS (0x1 << S_DebugDDBS)
-#define S_DebugDDBL 2 /* Debug data break load (R) */
-#define M_DebugDDBL (0x1 << S_DebugDDBL)
-#define S_DebugDBp 1 /* Debug breakpoint (R) */
-#define M_DebugDBp (0x1 << S_DebugDBp)
-#define S_DebugDSS 0 /* Debug single step (R) */
-#define M_DebugDSS (0x1 << S_DebugDSS)
-
-#define M_Debug0Fields 0x01f000c0
-#define M_DebugRFields 0xec0ffe3f
-
-
-/*
- ************************************************************************
- * D E P C R E G I S T E R ( 2 4 ) *
- ************************************************************************
- *
- * 6 // 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 3 // 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | // EJTAG Debug Exception PC | DEPC
- * +-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-
-#define C0_DEPC $24
-#define R_C0_DEPC 24
-
-#define M_DEEPC0Fields 0x00000000
-#define M_DEEPCRFields 0x00000000
-#define M_DEEPC0Fields64 UNS64Const(0x0000000000000000)
-#define M_DEEPCRFields64 UNS64Const(0x0000000000000000)
-
-
-/*
- ************************************************************************
- * P E R F C N T R E G I S T E R ( 2 5 ) *
- ************************************************************************
- *
- * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | | | |I| | | |E|
- * |M| 0 | Event |E|U|S|K|X| PerfCnt
- * | | | | | | | |L|
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- *
- *
- * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Event Count | PerfCnt
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define C0_PerfCnt $25
-#define R_C0_PerfCnt 25
-#define C0_PRFCNT0 C0_PerfCnt /* OBSOLETE - DO NOT USE IN NEW CODE */
-#define C0_PRFCNT1 C0_PerfCnt /* OBSOLETE - DO NOT USE IN NEW CODE */
-
-#define S_PerfCntM 31 /* More performance counters exist (R) */
-#define M_PerfCntM (1 << S_PerfCntM)
-#define S_PerfCntEvent 5 /* Enabled event (R/W) */
-#define M_PerfCntEvent (0x3f << S_PerfCntEvent)
-#define S_PerfCntIE 4 /* Interrupt Enable (R/W) */
-#define M_PerfCntIE (1 << S_PerfCntIE)
-#define S_PerfCntU 3 /* Enable counting in User Mode (R/W) */
-#define M_PerfCntU (1 << S_PerfCntU)
-#define S_PerfCntS 2 /* Enable counting in Supervisor Mode (R/W) */
-#define M_PerfCntS (1 << S_PerfCntS)
-#define S_PerfCntK 1 /* Enable counting in Kernel Mode (R/W) */
-#define M_PerfCntK (1 << S_PerfCntK)
-#define S_PerfCntEXL 0 /* Enable counting while EXL==1 (R/W) */
-#define M_PerfCntEXL (1 << S_PerfCntEXL)
-
-#define M_PerfCnt0Fields 0x7ffff800
-#define M_PerfCntRFields 0x80000000
-
-
-/*
- ************************************************************************
- * E R R C T L R E G I S T E R ( 2 6 ) *
- ************************************************************************
- *
- * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Error Control | ErrCtl
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define C0_ErrCtl $26
-#define R_C0_ErrCtl 26
-#define C0_ECC $26 /* OBSOLETE - DO NOT USE IN NEW CODE */
-#define R_C0_ECC 26 /* OBSOLETE - DO NOT USE IN NEW CODE */
-
-#define M_ErrCtl0Fields 0x00000000
-#define M_ErrCtlRFields 0x00000000
-
-
-/*
- ************************************************************************
- * C A C H E E R R R E G I S T E R ( 2 7 ) * CacheErr
- ************************************************************************
- *
- * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | Cache Error Control | CacheErr
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define C0_CacheErr $27
-#define R_C0_CacheErr 27
-#define C0_CACHE_ERR C0_CacheErr /* OBSOLETE - DO NOT USE IN NEW CODE */
-
-#define M_CacheErr0Fields 0x00000000
-#define M_CachErrRFields 0x00000000
-
-
-/*
- ************************************************************************
- * T A G L O R E G I S T E R ( 2 8 ) * TagLo
- ************************************************************************
- *
- * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | TagLo | TagLo
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define C0_TagLo $28
-#define R_C0_TagLo 28
-#define C0_TAGLO C0_TagLo /* OBSOLETE - DO NOT USE IN NEW CODE */
-
-/*
- * Some implementations use separate TagLo registers for the
- * instruction and data caches. In those cases, the following
- * definitions can be used in relevant code
- */
-
-#define C0_ITagLo $28,0
-#define C0_DTagLo $28,2
-
-#define M_TagLo0Fields 0x00000000
-#define M_TagLoRFields 0x00000000
-
-
-/*
- ************************************************************************
- * D A T A L O R E G I S T E R ( 2 8, SELECT 1 ) * DataLo
- ************************************************************************
- *
- * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | DataLo | DataLo
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define C0_DataLo $28,1
-#define R_C0_DataLo 28
-
-/*
- * Some implementations use separate DataLo registers for the
- * instruction and data caches. In those cases, the following
- * definitions can be used in relevant code
- */
-
-#define C0_IDataLo $28,1
-#define C0_DDataLo $28,3
-
-#define M_DataLo0Fields 0x00000000
-#define M_DataLoRFields 0xffffffff
-
-
-/*
- ************************************************************************
- * T A G H I R E G I S T E R ( 2 9 ) * TagHi
- ************************************************************************
- *
- * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | TagHi | TagHi
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define C0_TagHi $29
-#define R_C0_TagHi 29
-#define C0_TAGHI C0_TagHi /* OBSOLETE - DO NOT USE IN NEW CODE */
-
-/*
- * Some implementations use separate TagHi registers for the
- * instruction and data caches. In those cases, the following
- * definitions can be used in relevant code
- */
-
-#define C0_ITagHi $29,0
-#define C0_DTagHi $29,2
-
-#define M_TagHi0Fields 0x00000000
-#define M_TagHiRFields 0x00000000
-
-
-/*
- ************************************************************************
- * D A T A H I R E G I S T E R ( 2 9, SELECT 1 ) * DataHi
- ************************************************************************
- *
- * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | DataHi | DataHi
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define C0_DataHi $29,1
-#define R_C0_DataHi 29
-
-/*
- * Some implementations use separate DataHi registers for the
- * instruction and data caches. In those cases, the following
- * definitions can be used in relevant code
- */
-
-#define C0_IDataHi $29,1
-#define C0_DDataHi $29,3
-
-#define M_DataHi0Fields 0x00000000
-#define M_DataHiRFields 0xffffffff
-
-
-/*
- ************************************************************************
- * E R R O R E P C R E G I S T E R ( 3 0 ) *
- ************************************************************************
- *
- * 6 // 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 3 // 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | // Error PC | ErrorEPC
- * +-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define C0_ErrorEPC $30
-#define R_C0_ErrorEPC 30
-#define C0_ERROR_EPC C0_ErrorEPC /* OBSOLETE - DO NOT USE IN NEW CODE */
-
-#define M_ErrorEPC0Fields 0x00000000
-#define M_ErrorEPCRFields 0x00000000
-#define M_ErrorEPC0Fields64 UNS64Const(0x0000000000000000)
-#define M_ErrorEPCRFields64 UNS64Const(0x0000000000000000)
-
-
-/*
- ************************************************************************
- * D E S A V E R E G I S T E R ( 3 1 ) *
- ************************************************************************
- *
- * 6 // 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 3 // 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | // EJTAG Register Save Value | DESAVE
- * +-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define C0_DESAVE $31
-#define R_C0_DESAVE 31
-
-#define M_DESAVE0Fields 0x00000000
-#define M_DESAVERFields 0x00000000
-#define M_DESAVE0Fields64 UNS64Const(0x0000000000000000)
-#define M_DESAVERFields64 UNS64Const(0x0000000000000000)
-
-
-/*
- *************************************************************************
- * C P 1 R E G I S T E R D E F I N I T I O N S *
- *************************************************************************
- */
-
-
-/*
- *************************************************************************
- * H A R D W A R E F P R N A M E S *
- *************************************************************************
- */
-
-#define fp0 $f0
-#define fp1 $f1
-#define fp2 $f2
-#define fp3 $f3
-#define fp4 $f4
-#define fp5 $f5
-#define fp6 $f6
-#define fp7 $f7
-#define fp8 $f8
-#define fp9 $f9
-#define fp10 $f10
-#define fp11 $f11
-#define fp12 $f12
-#define fp13 $f13
-#define fp14 $f14
-#define fp15 $f15
-#define fp16 $f16
-#define fp17 $f17
-#define fp18 $f18
-#define fp19 $f19
-#define fp20 $f20
-#define fp21 $f21
-#define fp22 $f22
-#define fp23 $f23
-#define fp24 $f24
-#define fp25 $f25
-#define fp26 $f26
-#define fp27 $f27
-#define fp28 $f28
-#define fp29 $f29
-#define fp30 $f30
-#define fp31 $f31
-
-/*
- * The following definitions are used to convert an FPR name
- * into the corresponding even or odd name, respectively.
- * This is used in macro substitution in the AVPs.
- */
-
-#define fp1_even $f0
-#define fp3_even $f2
-#define fp5_even $f4
-#define fp7_even $f6
-#define fp9_even $f8
-#define fp11_even $f10
-#define fp13_even $f12
-#define fp15_even $f14
-#define fp17_even $f16
-#define fp19_even $f18
-#define fp21_even $f20
-#define fp23_even $f22
-#define fp25_even $f24
-#define fp27_even $f26
-#define fp29_even $f28
-#define fp31_even $f30
-
-#define fp0_odd $f1
-#define fp2_odd $f3
-#define fp4_odd $f5
-#define fp6_odd $f7
-#define fp8_odd $f9
-#define fp10_odd $f11
-#define fp12_odd $f13
-#define fp14_odd $f15
-#define fp16_odd $f17
-#define fp18_odd $f19
-#define fp20_odd $f21
-#define fp22_odd $f23
-#define fp24_odd $f25
-#define fp26_odd $f27
-#define fp28_odd $f29
-#define fp30_odd $f31
-
-
-/*
- *************************************************************************
- * H A R D W A R E F P R I N D I C E S *
- *************************************************************************
- *
- * These definitions provide the index (number) of the FPR, as opposed
- * to the assembler register name ($n).
- */
-
-#define R_fp0 0
-#define R_fp1 1
-#define R_fp2 2
-#define R_fp3 3
-#define R_fp4 4
-#define R_fp5 5
-#define R_fp6 6
-#define R_fp7 7
-#define R_fp8 8
-#define R_fp9 9
-#define R_fp10 10
-#define R_fp11 11
-#define R_fp12 12
-#define R_fp13 13
-#define R_fp14 14
-#define R_fp15 15
-#define R_fp16 16
-#define R_fp17 17
-#define R_fp18 18
-#define R_fp19 19
-#define R_fp20 20
-#define R_fp21 21
-#define R_fp22 22
-#define R_fp23 23
-#define R_fp24 24
-#define R_fp25 25
-#define R_fp26 26
-#define R_fp27 27
-#define R_fp28 28
-#define R_fp29 29
-#define R_fp30 30
-#define R_fp31 31
-
-
-/*
- *************************************************************************
- * H A R D W A R E F C R N A M E S *
- *************************************************************************
- */
-
-#define fc0 $0
-#define fc25 $25
-#define fc26 $26
-#define fc28 $28
-#define fc31 $31
-
-
-/*
- *************************************************************************
- * H A R D W A R E F C R I N D I C E S *
- *************************************************************************
- *
- * These definitions provide the index (number) of the FCR, as opposed
- * to the assembler register name ($n).
- */
-
-#define R_fc0 0
-#define R_fc25 25
-#define R_fc26 26
-#define R_fc28 28
-#define R_fc31 31
-
-
-/*
- *************************************************************************
- * H A R D W A R E F C C N A M E S *
- *************************************************************************
- */
-
-#define cc0 $fcc0
-#define cc1 $fcc1
-#define cc2 $fcc2
-#define cc3 $fcc3
-#define cc4 $fcc4
-#define cc5 $fcc5
-#define cc6 $fcc6
-#define cc7 $fcc7
-
-
-/*
- *************************************************************************
- * H A R D W A R E F C C I N D I C E S *
- *************************************************************************
- *
- * These definitions provide the index (number) of the CC, as opposed
- * to the assembler register name ($n).
- */
-
-#define R_cc0 0
-#define R_cc1 1
-#define R_cc2 2
-#define R_cc3 3
-#define R_cc4 4
-#define R_cc5 5
-#define R_cc6 6
-#define R_cc7 7
-
-
-/*
- ************************************************************************
- * I M P L E M E N T A T I O N R E G I S T E R *
- ************************************************************************
- *
- * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * |Reserved for Additional|3|P|D|S| Implementation| Revision | FIR
- * | Configuration Bits |D|S| | | | |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define C1_FIR $0
-#define R_C1_FIR 0
-
-#define S_FIRConfigS 16
-#define M_FIRConfigS (0x1 << S_FIRConfigS)
-#define S_FIRConfigD 17
-#define M_FIRConfigD (0x1 << S_FIRConfigD)
-#define S_FIRConfigPS 18
-#define M_FIRConfigPS (0x1 << S_FIRConfigPS)
-#define S_FIRConfig3D 19
-#define M_FIRConfig3D (0x1 << S_FIRConfig3D)
-#define M_FIRConfigAll (M_FIRConfigS|M_FIRConfigD|M_FIRConfigPS|M_FIRConfig3D)
-
-#define S_FIRImp 8
-#define M_FIRImp (0xff << S_FIRImp)
-
-#define S_FIRRev 0
-#define M_FIRRev (0xff << S_FIRRev)
-
-#define M_FIR0Fields 0xfff00000
-#define M_FIRRFields 0x000fffff
-
-/*
- ************************************************************************
- * C O N D I T I O N C O D E S R E G I S T E R *
- ************************************************************************
- *
- * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | 0 | CC | FCCR
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define C1_FCCR $25
-#define R_C1_FCCR 25
-
-#define S_FCCRCC 0
-#define M_FCCRCC (0xff << S_FCCRCC)
-#define S_FCCRCC7 7
-#define M_FCCRCC7 (0x1 << S_FCCRCC7)
-#define S_FCCRCC6 6
-#define M_FCCRCC6 (0x1 << S_FCCRCC6)
-#define S_FCCRCC5 5
-#define M_FCCRCC5 (0x1 << S_FCCRCC5)
-#define S_FCCRCC4 4
-#define M_FCCRCC4 (0x1 << S_FCCRCC4)
-#define S_FCCRCC3 3
-#define M_FCCRCC3 (0x1 << S_FCCRCC3)
-#define S_FCCRCC2 2
-#define M_FCCRCC2 (0x1 << S_FCCRCC2)
-#define S_FCCRCC1 1
-#define M_FCCRCC1 (0x1 << S_FCCRCC1)
-#define S_FCCRCC0 0
-#define M_FCCRCC0 (0x1 << S_FCCRCC0)
-
-#define M_FCCR0Fields 0xffffff00
-#define M_FCCRRFields 0x000000ff
-
-
-/*
- ************************************************************************
- * E X C E P T I O N S R E G I S T E R *
- ************************************************************************
- *
- * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | 0 | Cause | 0 | Flags | 0 | FEXR
- * | |E|V|Z|O|U|I| |V|Z|O|U|I| |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define C1_FEXR $26
-#define R_C1_FEXR 26
-
-#define S_FEXRExc 12
-#define M_FEXRExc (0x3f << S_FEXRExc)
-#define S_FEXRExcE 17
-#define M_FEXRExcE (0x1 << S_FEXRExcE)
-#define S_FEXRExcV 16
-#define M_FEXRExcV (0x1 << S_FEXRExcV)
-#define S_FEXRExcZ 15
-#define M_FEXRExcZ (0x1 << S_FEXRExcZ)
-#define S_FEXRExcO 14
-#define M_FEXRExcO (0x1 << S_FEXRExcO)
-#define S_FEXRExcU 13
-#define M_FEXRExcU (0x1 << S_FEXRExcU)
-#define S_FEXRExcI 12
-#define M_FEXRExcI (0x1 << S_FEXRExcI)
-
-#define S_FEXRFlg 2
-#define M_FEXRFlg (0x1f << S_FEXRFlg)
-#define S_FEXRFlgV 6
-#define M_FEXRFlgV (0x1 << S_FEXRFlgV)
-#define S_FEXRFlgZ 5
-#define M_FEXRFlgZ (0x1 << S_FEXRFlgZ)
-#define S_FEXRFlgO 4
-#define M_FEXRFlgO (0x1 << S_FEXRFlgO)
-#define S_FEXRFlgU 3
-#define M_FEXRFlgU (0x1 << S_FEXRFlgU)
-#define S_FEXRFlgI 2
-#define M_FEXRFlgI (0x1 << S_FEXRFlgI)
-
-#define M_FEXR0Fields 0xfffc0f83
-#define M_FEXRRFields 0x00000000
-
-
-/*
- ************************************************************************
- * E N A B L E S R E G I S T E R *
- ************************************************************************
- *
- * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | 0 | Enables | 0 |F|RM | FENR
- * | |V|Z|O|U|I| |S| |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define C1_FENR $28
-#define R_C1_FENR 28
-
-#define S_FENREna 7
-#define M_FENREna (0x1f << S_FENREna)
-#define S_FENREnaV 11
-#define M_FENREnaV (0x1 << S_FENREnaV)
-#define S_FENREnaZ 10
-#define M_FENREnaZ (0x1 << S_FENREnaZ)
-#define S_FENREnaO 9
-#define M_FENREnaO (0x1 << S_FENREnaO)
-#define S_FENREnaU 8
-#define M_FENREnaU (0x1 << S_FENREnaU)
-#define S_FENREnaI 7
-#define M_FENREnaI (0x1 << S_FENREnaI)
-
-#define S_FENRFS 2
-#define M_FENRFS (0x1 << S_FENRFS)
-
-#define S_FENRRM 0
-#define M_FENRRM (0x3 << S_FENRRM)
-
-#define M_FENR0Fields 0xfffff078
-#define M_FENRRFields 0x00000000
-
-
-/*
- ************************************************************************
- * C O N T R O L / S T A T U S R E G I S T E R *
- ************************************************************************
- *
- * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
- * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- * | FCC |F|C|Imp| 0 | Cause | Enables | Flags | RM| FCSR
- * |7|6|5|4|3|2|1|S|C| | |E|V|Z|O|U|I|V|Z|O|U|I|V|Z|O|U|I| |
- * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- */
-
-#define C1_FCSR $31
-#define R_C1_FCSR 31
-
-#define S_FCSRFCC7_1 25 /* Floating point condition codes 7..1 (R/W) */
-#define M_FCSRFCC7_1 (0x7f << S_FCSRFCC7_1)
-#define S_FCSRCC7 31
-#define M_FCSRCC7 (0x1 << S_FCSRCC7)
-#define S_FCSRCC6 30
-#define M_FCSRCC6 (0x1 << S_FCSRCC6)
-#define S_FCSRCC5 29
-#define M_FCSRCC5 (0x1 << S_FCSRCC5)
-#define S_FCSRCC4 28
-#define M_FCSRCC4 (0x1 << S_FCSRCC4)
-#define S_FCSRCC3 27
-#define M_FCSRCC3 (0x1 << S_FCSRCC3)
-#define S_FCSRCC2 26
-#define M_FCSRCC2 (0x1 << S_FCSRCC2)
-#define S_FCSRCC1 25
-#define M_FCSRCC1 (0x1 << S_FCSRCC1)
-
-#define S_FCSRFS 24 /* Flush denorms to zero (R/W) */
-#define M_FCSRFS (0x1 << S_FCSRFS)
-
-#define S_FCSRCC0 23 /* Floating point condition code 0 (R/W) */
-#define M_FCSRCC0 (0x1 << S_FCSRCC0)
-#define S_FCSRCC S_FCSRCC0
-#define M_FCSRCC M_FCSRCC0
-
-#define S_FCSRImpl 21 /* Implementation-specific control bits (R/W) */
-#define M_FCSRImpl (0x3 << S_FCSRImpl)
-
-#define S_FCSRExc 12 /* Exception cause (R/W) */
-#define M_FCSRExc (0x3f << S_FCSRExc)
-#define S_FCSRExcE 17
-#define M_FCSRExcE (0x1 << S_FCSRExcE)
-#define S_FCSRExcV 16
-#define M_FCSRExcV (0x1 << S_FCSRExcV)
-#define S_FCSRExcZ 15
-#define M_FCSRExcZ (0x1 << S_FCSRExcZ)
-#define S_FCSRExcO 14
-#define M_FCSRExcO (0x1 << S_FCSRExcO)
-#define S_FCSRExcU 13
-#define M_FCSRExcU (0x1 << S_FCSRExcU)
-#define S_FCSRExcI 12
-#define M_FCSRExcI (0x1 << S_FCSRExcI)
-
-#define S_FCSREna 7 /* Exception enable (R/W) */
-#define M_FCSREna (0x1f << S_FCSREna)
-#define S_FCSREnaV 11
-#define M_FCSREnaV (0x1 << S_FCSREnaV)
-#define S_FCSREnaZ 10
-#define M_FCSREnaZ (0x1 << S_FCSREnaZ)
-#define S_FCSREnaO 9
-#define M_FCSREnaO (0x1 << S_FCSREnaO)
-#define S_FCSREnaU 8
-#define M_FCSREnaU (0x1 << S_FCSREnaU)
-#define S_FCSREnaI 7
-#define M_FCSREnaI (0x1 << S_FCSREnaI)
-
-#define S_FCSRFlg 2 /* Exception flags (R/W) */
-#define M_FCSRFlg (0x1f << S_FCSRFlg)
-#define S_FCSRFlgV 6
-#define M_FCSRFlgV (0x1 << S_FCSRFlgV)
-#define S_FCSRFlgZ 5
-#define M_FCSRFlgZ (0x1 << S_FCSRFlgZ)
-#define S_FCSRFlgO 4
-#define M_FCSRFlgO (0x1 << S_FCSRFlgO)
-#define S_FCSRFlgU 3
-#define M_FCSRFlgU (0x1 << S_FCSRFlgU)
-#define S_FCSRFlgI 2
-#define M_FCSRFlgI (0x1 << S_FCSRFlgI)
-
-#define S_FCSRRM 0 /* Rounding mode (R/W) */
-#define M_FCSRRM (0x3 << S_FCSRRM)
-
-#define M_FCSR0Fields 0x001c0000
-#define M_FCSRRFields 0x00000000
-
-/*
- * Values in the rounding mode field (of both FCSR and FCCR)
- */
-#define K_FCSRRM_RN 0
-#define K_FCSRRM_RZ 1
-#define K_FCSRRM_RP 2
-#define K_FCSRRM_RM 3
-
-
-/* ********************************************************************* */
-/* Interface function definition */
-
-
-/* ********************************************************************* */
-
-#endif /* __ARCHDEFS_H__ */
diff --git a/sdk-modifications/include/bit_ops.h b/sdk-modifications/include/bit_ops.h
deleted file mode 100755
index f823db7..0000000
--- a/sdk-modifications/include/bit_ops.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- bit_ops.h
- Functions for dealing with conversion of data between types
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-*/
-
-#ifndef _BIT_OPS_H
-#define _BIT_OPS_H
-
-/*-----------------------------------------------------------------
-Functions to deal with little endian values stored in u8 arrays
------------------------------------------------------------------*/
-static inline u16 u8array_to_u16 (const u8* item, int offset) {
- return ( item[offset] | (item[offset + 1] << 8));
-}
-
-static inline u32 u8array_to_u32 (const u8* item, int offset) {
- return ( item[offset] | (item[offset + 1] << 8) | (item[offset + 2] << 16) | (item[offset + 3] << 24));
-}
-
-static inline void u16_to_u8array (u8* item, int offset, u16 value) {
- item[offset] = (u8)value;
- item[offset + 1] = (u8)(value >> 8);
-}
-
-static inline void u32_to_u8array (u8* item, int offset, u32 value) {
- item[offset] = (u8)value;
- item[offset + 1] = (u8)(value >> 8);
- item[offset + 2] = (u8)(value >> 16);
- item[offset + 3] = (u8)(value >> 24);
-}
-
-#endif // _BIT_OPS_H
diff --git a/sdk-modifications/include/console.h b/sdk-modifications/include/console.h
deleted file mode 100755
index f6d74a4..0000000
--- a/sdk-modifications/include/console.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef __CONSOLE_H__
-#define __CONSOLE_H__
-#include "ds2io.h"
-
-extern int ConsoleInit(unsigned short front_color, unsigned short background_color, enum SCREEN_ID screen, unsigned int buf_size);
-
-extern int cprintf(const char *format, ...);
-
-#endif //__CONSOLE_H__
diff --git a/sdk-modifications/include/directory.h b/sdk-modifications/include/directory.h
deleted file mode 100755
index 00046a9..0000000
--- a/sdk-modifications/include/directory.h
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- directory.h
- Reading, writing and manipulation of the directory structure on
- a FAT partition
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-*/
-
-#ifndef _DIRECTORY_H
-#define _DIRECTORY_H
-
-#include <sys/stat.h>
-
-#include "fs_common.h"
-#include "partition.h"
-
-#define DIR_ENTRY_DATA_SIZE 0x20
-#define MAX_FILENAME_LENGTH 256
-#define MAX_ALIAS_LENGTH 13
-#define LFN_ENTRY_LENGTH 13
-#define FAT16_ROOT_DIR_CLUSTER 0
-
-#define DIR_SEPARATOR '/'
-
-// File attributes
-#define ATTRIB_ARCH 0x20 // Archive
-#define ATTRIB_DIR 0x10 // Directory
-#define ATTRIB_LFN 0x0F // Long file name
-#define ATTRIB_VOL 0x08 // Volume
-#define ATTRIB_SYS 0x04 // System
-#define ATTRIB_HID 0x02 // Hidden
-#define ATTRIB_RO 0x01 // Read only
-
-typedef enum {FT_DIRECTORY, FT_FILE} FILE_TYPE;
-
-typedef struct {
- u32 cluster;
- u32 sector;
- s32 offset;
-} DIR_ENTRY_POSITION;
-
-typedef struct {
- u8 entryData[DIR_ENTRY_DATA_SIZE];
- DIR_ENTRY_POSITION dataStart; // Points to the start of the LFN entries of a file, or the alias for no LFN
- DIR_ENTRY_POSITION dataEnd; // Always points to the file/directory's alias entry
- char d_name[MAX_FILENAME_LENGTH + MAX_FILENAME_LENGTH*2]; //Store name string using UTF8 coding
- //u16 unicodeFilename[MAX_FILENAME_LENGTH];
-} DIR_ENTRY;
-
-// Directory entry offsets
-enum DIR_ENTRY_offset {
- DIR_ENTRY_name = 0x00,
- DIR_ENTRY_extension = 0x08,
- DIR_ENTRY_attributes = 0x0B,
- DIR_ENTRY_reserved = 0x0C,
- DIR_ENTRY_cTime_ms = 0x0D,
- DIR_ENTRY_cTime = 0x0E,
- DIR_ENTRY_cDate = 0x10,
- DIR_ENTRY_aDate = 0x12,
- DIR_ENTRY_clusterHigh = 0x14,
- DIR_ENTRY_mTime = 0x16,
- DIR_ENTRY_mDate = 0x18,
- DIR_ENTRY_cluster = 0x1A,
- DIR_ENTRY_fileSize = 0x1C
-};
-
-/*
-Returns true if the file specified by entry is a directory
-*/
-static inline bool _FAT_directory_isDirectory (DIR_ENTRY* entry) {
- return ((entry->entryData[DIR_ENTRY_attributes] & ATTRIB_DIR) != 0);
-}
-
-static inline bool _FAT_directory_isWritable (DIR_ENTRY* entry) {
- return ((entry->entryData[DIR_ENTRY_attributes] & ATTRIB_RO) == 0);
-}
-
-static inline bool _FAT_directory_isDot (DIR_ENTRY* entry) {
- return ((entry->d_name[0] == '.') && ((entry->d_name[1] == '\0') ||
- ((entry->d_name[1] == '.') && entry->d_name[2] == '\0')));
-}
-
-/*
-Reads the first directory entry from the directory starting at dirCluster
-Places result in entry
-entry will be destroyed even if no directory entry is found
-Returns true on success, false on failure
-*/
-bool _FAT_directory_getFirstEntry (PARTITION* partition, DIR_ENTRY* entry, u32 dirCluster);
-
-/*
-Reads the next directory entry after the one already pointed to by entry
-Places result in entry
-entry will be destroyed even if no directory entry is found
-Returns true on success, false on failure
-*/
-bool _FAT_directory_getNextEntry (PARTITION* partition, DIR_ENTRY* entry);
-
-/*
-Gets the directory entry corrsponding to the supplied path
-entry will be destroyed even if no directory entry is found
-pathEnd specifies the end of the path string, for cutting strings short if needed
- specify NULL to use the full length of path
- pathEnd is only a suggestion, and the path string will be searched up until the next PATH_SEPARATOR
- after pathEND.
-Returns true on success, false on failure
-*/
-bool _FAT_directory_entryFromPath (PARTITION* partition, DIR_ENTRY* entry, const char* path, const char* pathEnd);
-
-/*
-Changes the current directory to the one specified by path
-Returns true on success, false on failure
-*/
-bool _FAT_directory_chdir (PARTITION* partition, const char* path);
-
-/*
-Removes the directory entry specified by entry
-Assumes that entry is valid
-Returns true on success, false on failure
-*/
-bool _FAT_directory_removeEntry (PARTITION* partition, DIR_ENTRY* entry);
-
-/*
-Add a directory entry to the directory specified by dirCluster
-The fileData, dataStart and dataEnd elements of the DIR_ENTRY struct are
-updated with the new directory entry position and alias.
-Returns true on success, false on failure
-*/
-bool _FAT_directory_addEntry (PARTITION* partition, DIR_ENTRY* entry, u32 dirCluster);
-
-/*
-Get the start cluster of a file from it's entry data
-*/
-u32 _FAT_directory_entryGetCluster (const u8* entryData);
-
-/*
-Fill in the file name and entry data of DIR_ENTRY* entry.
-Assumes that the entry's dataStart and dataEnd are correct
-Returns true on success, false on failure
-*/
-bool _FAT_directory_entryFromPosition (PARTITION* partition, DIR_ENTRY* entry);
-
-/*
-Fill in a stat struct based on a file entry
-*/
-void _FAT_directory_entryStat (PARTITION* partition, DIR_ENTRY* entry, struct stat *st);
-
-#endif // _DIRECTORY_H
diff --git a/sdk-modifications/include/ds2_cpu.h b/sdk-modifications/include/ds2_cpu.h
deleted file mode 100755
index d4b7144..0000000
--- a/sdk-modifications/include/ds2_cpu.h
+++ /dev/null
@@ -1,57 +0,0 @@
-#ifndef __DS2_CPU_H__
-#define __DS2_CPU_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-//exception handle
-
-
-//cache operationr
-//invalidate instruction cache
-extern void __icache_invalidate_all(void);
-
-//invalidate data cache
-extern void __dcache_invalidate_all(void);
-
-//data cache writeback
-extern void __dcache_writeback_all(void);
-
-//data cache writeback and invalidate
-extern void _dcache_wback_inv(unsigned long addr, unsigned long size);
-
-
-//interruption operation
-//clear CPU's interrupt state and enable global interrupt
-extern void sti(void);
-
-//disable global interrupt
-extern void cli(void);
-
-//disable global interrupt and store the global interrupt state
-//return: interrupt state
-extern unsigned int spin_lock_irqsave(void);
-
-//restore global interrupt state
-extern void spin_unlock_irqrestore(unsigned int val);
-
-
-//CPU frequence
-//There are 14 levels, 0 to 13, 13 level have the highest clock frequence
-extern int ds2_setCPUclocklevel(unsigned int num);
-
-//print colock frequence CPU
-extern void printf_clock(void);
-
-//delay n us
-extern void udelay(unsigned int usec);
-
-//delay n ms
-extern void mdelay(unsigned int msec);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //__DS2_CPU_H__
diff --git a/sdk-modifications/include/ds2_cpuclock.h b/sdk-modifications/include/ds2_cpuclock.h
deleted file mode 100644
index 3263ed0..0000000
--- a/sdk-modifications/include/ds2_cpuclock.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef _DS2_CPUCLOCK_H__
-#define _DS2_CPUCLOCK_H__
-
-
-#define CPU_MAX_LEVEL_EX 18
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern int ds2_getCPUClock(void);
-extern int ds2_setCPULevel(unsigned int level);
-extern void ds2_udelay(unsigned int usec);
-extern void ds2_mdelay(unsigned int msec);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //__DS2_CPUCLOCK_H__
diff --git a/sdk-modifications/include/ds2_dma.h b/sdk-modifications/include/ds2_dma.h
deleted file mode 100644
index 9a306cf..0000000
--- a/sdk-modifications/include/ds2_dma.h
+++ /dev/null
@@ -1,142 +0,0 @@
-#ifndef _DS2_DMA_H__
-#define _DS2_DMA_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-#define MAX_DMA_NUM 6 /* max 6 channels */
-
-
-// DMA request source register
-#define DMAC_DRSR_RS_BIT 0
-#define DMAC_DRSR_RS_AUTO (8 << DMAC_DRSR_RS_BIT)
-
-
-// DMA channel command register
-#define DMAC_DCMD_SAI (1 << 23) /* source address increment */
-#define DMAC_DCMD_DAI (1 << 22) /* dest address increment */
-
-#define DMAC_DCMD_SWDH_BIT 14 /* source port width */
-#define DMAC_DCMD_SWDH_32 (0 << DMAC_DCMD_SWDH_BIT)
-#define DMAC_DCMD_SWDH_8 (1 << DMAC_DCMD_SWDH_BIT)
-#define DMAC_DCMD_SWDH_16 (2 << DMAC_DCMD_SWDH_BIT)
-
-#define DMAC_DCMD_DWDH_BIT 12 /* dest port width */
-#define DMAC_DCMD_DWDH_32 (0 << DMAC_DCMD_DWDH_BIT)
-#define DMAC_DCMD_DWDH_8 (1 << DMAC_DCMD_DWDH_BIT)
- #define DMAC_DCMD_DWDH_16 (2 << DMAC_DCMD_DWDH_BIT)
-
-#define DMAC_DCMD_DS_BIT 8 /* transfer data size of a data unit */
-#define DMAC_DCMD_DS_32BIT (0 << DMAC_DCMD_DS_BIT)
-#define DMAC_DCMD_DS_8BIT (1 << DMAC_DCMD_DS_BIT)
-#define DMAC_DCMD_DS_16BIT (2 << DMAC_DCMD_DS_BIT)
-#define DMAC_DCMD_DS_16BYTE (3 << DMAC_DCMD_DS_BIT)
-#define DMAC_DCMD_DS_32BYTE (4 << DMAC_DCMD_DS_BIT)
-
-#define DMAC_DCMD_TM (1 << 7) /* transfer mode: 0-single 1-block */
-
-
-//detect if channel has completed job
-#define DMAC_DCCSR_TT (1 << 3) /* transfer terminated */
-#define DMAC_BASE 0xB3020000
-#define REG32(addr) *((volatile u32 *)(addr))
-#define DMAC_DCCSR(n) (DMAC_BASE + (0x10 + (n) * 0x20)) /* DMA control/status */
-#define REG_DMAC_DCCSR(n) REG32(DMAC_DCCSR((n)))
-
-#define ds2_DMA_isBusy(n) \
- !( REG_DMAC_DCCSR((n)) & DMAC_DCCSR_TT )
-
-
-/*
-Copy modes
-
-*/
-
-#define DMA_MODE32BYTE DMAC_DCMD_SWDH_32 | DMAC_DCMD_DWDH_32 | \
- DMAC_DCMD_DS_32BYTE | DMAC_DCMD_TM
-
-#define DMA_MODE16BYTE DMAC_DCMD_SWDH_16 | DMAC_DCMD_DWDH_16 | \
- DMAC_DCMD_DS_16BYTE | DMAC_DCMD_TM
-
-#define DMA_MODE32BIT DMAC_DCMD_SWDH_32 | DMAC_DCMD_DWDH_32 | \
- DMAC_DCMD_DS_32BIT
-
-#define DMA_MODE16BIT DMAC_DCMD_SWDH_16 | DMAC_DCMD_DWDH_16 | \
- DMAC_DCMD_DS_16BIT
-
-#define DMA_MODE8BIT DMAC_DCMD_SWDH_8 | DMAC_DCMD_DWDH_8 | \
- DMAC_DCMD_DS_8BIT | DMAC_DCMD_TM
-
-#define DMA_MODECOPY DMAC_DCMD_SAI
-
-
-
-extern int _dmaCopy(int ch, void *dest, void *src, unsigned int size, unsigned int flags);
-
-/*
- * Copy 'size' bytes from src to dest, in blocks of 32 bytes.
- * size is in bytes and must be a multiple of 32.
- * Both src and dest must be aligned to 32 bytes.
- * Returns 0 on failure, non-zero on success.
- */
-#define ds2_DMAcopy_32Byte(ch, dest, src, size)\
- _dmaCopy(ch, dest, src, size, DMA_MODECOPY | DMA_MODE32BYTE)
-
-/*
- * Copy 'size' bytes from src to dest, in blocks of 16 bytes.
- * size is in bytes and must be a multiple of 16.
- * Both src and dest must be aligned to 16 bytes.
- * Returns 0 on failure, non-zero on success.
- */
-#define ds2_DMAcopy_16Byte(ch, dest, src, size)\
- _dmaCopy(ch, dest, src, size, DMA_MODECOPY | DMA_MODE16BYTE);
-
-/*
- * Copy 'size' bytes from src to dest, in blocks of 32 bits (4 bytes).
- * size is in bytes and must be a multiple of 4.
- * Both src and dest must be aligned to 32 bits (4 bytes).
- * Returns 0 on failure, non-zero on success.
- */
-#define ds2_DMAcopy_32Bit(ch, dest, src, size)\
- _dmaCopy(ch, dest, src, size, DMA_MODECOPY | DMA_MODE32BIT);
-
-/*
- * Copy 'size' bytes from src to dest, in blocks of 16 bits (2 bytes).
- * size is in bytes and must be a multiple of 2.
- * Both src and dest must be aligned to 16 bits (2 bytes).
- * Returns 0 on failure, non-zero on success.
- */
-#define ds2_DMAcopy_16Bit(ch, dest, src, size)\
- _dmaCopy(ch, dest, src, size, DMA_MODECOPY | DMA_MODE16BIT)
-
-/*
- * Copy 'size' individual bytes (8 bits at a time) from src to dest.
- * Returns 0 on failure, non-zero on success.
- */
-#define ds2_DMAcopy_8Bit(ch, dest, src, size)\
- _dmaCopy(ch, dest, src, size, DMA_MODECOPY | DMA_MODE8BIT)
-
-
-
-//Stop DMA transfer
-extern void dma_stop(int ch);
-
-#define ds2_DMA_stop(ch)\
- dma_stop(ch)
-
-//Wait DMA transfer over
-extern int dma_wait_finish(int ch);
-
-#define ds2_DMA_wait(ch)\
- dma_wait_finish(ch)
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //__DMA_H__
-
diff --git a/sdk-modifications/include/ds2_excpt.h b/sdk-modifications/include/ds2_excpt.h
deleted file mode 100755
index 08fe77e..0000000
--- a/sdk-modifications/include/ds2_excpt.h
+++ /dev/null
@@ -1,55 +0,0 @@
-#ifndef __DS2_EXCPT_H__
-#define __DS2_EXCPT_H__
-
-#include <mipsregs.h>
-extern unsigned int Process_RA;
-extern unsigned int Process_SP;
-
-#define SAVE_PROCESS_REGISTER() \
- do{ unsigned int sr ; \
- sr = read_c0_status(); \
- write_c0_status((sr&(~1))); \
- __asm__ __volatile__( \
- "sw $31,0x00(%0)\n\t" \
- "sw $29,0x00(%1)\n\t" \
- : \
- : "r" (&Process_RA),"r" (&Process_SP)); \
- write_c0_status(sr); \
- }while(0)
-
-#define RESTORE_PROCESS_REGISTER() \
- __asm__ __volatile__( \
- "lw $31,0x00(%0)\n\t" \
- "lw $29,0x00(%1)\n\t" \
- : \
- : "r" (&Process_RA),"r" (&Process_SP))
-
-inline static void excpt_exit(x) \
-{
- unsigned int sr;
- sr = read_c0_status();
- write_c0_status(sr & (~1));
- __asm__ __volatile__("lw $2,0x00(%0)\n\t" :: "r" (&x));
- RESTORE_PROCESS_REGISTER();
- write_c0_status(sr);
- __asm__ __volatile__(
- "jr $31\n\t"
- "nop\n\t"
- );
-}
-
-typedef void (*PFun_Exception_Handler)(unsigned int);
-
-//Setup handle to process the exception
-//except_index: exception number
-//except_handle: handle to process the exception
-//arg: argument to the handle
-extern int Setup_except_handle(unsigned int except_index, PFun_Exception_Handler except_handle, unsigned int arg);
-
-//Add a write watched exception, if the CPU write the addr, a exception will
-// generated, the watch exception's number is 23
-//addr: address to be watched
-extern void add_watch_point(unsigned int addr);
-
-#endif //__DS2_EXCPT_H__
-
diff --git a/sdk-modifications/include/ds2_fcntl.h b/sdk-modifications/include/ds2_fcntl.h
deleted file mode 100755
index 2c69221..0000000
--- a/sdk-modifications/include/ds2_fcntl.h
+++ /dev/null
@@ -1,51 +0,0 @@
-#ifndef __libc_fcntl_h__
-#define __libc_fcntl_h__
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#define O_RDONLY (1 << 0)
-#define O_WRONLY (2 << 0)
-#define O_RDWR (3 << 0)
-#define O_APPEND (1 << 2)
-#define O_CREAT (1 << 3)
-#define O_DSYNC (1 << 4)
-#define O_EXCL (1 << 5)
-#define O_NOCTTY (1 << 6)
-#define O_NONBLOCK (1 << 7)
-#define O_RSYNC (1 << 8)
-#define O_SYNC (1 << 9)
-#define O_TRUNC (1 << 10)
-#define O_CREATE O_CREAT
-
-#define O_ACCMODE 0x3
-
-#define F_CLOEXEC (1 << 11)
-
-#define F_DUPFD 1
-#define F_GETFD 2
-#define F_SETFD 3
-#define F_GETFL 4
-#define F_SETFL 5
-#define F_GETLK 6
-#define F_SETLK 7
-#define F_SETLKW 8
-#define F_GETOWN 9
-#define F_SETOWN 10
-#define _F_LAST F_SETOWN
-
-#define _F_FILE_DESC (F_CLOEXEC)
-#define _O_FILE_CREATE (O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC)
-#define _O_FILE_STATUS (O_APPEND | O_DSYNC | O_NONBLOCK | O_RSYNC | O_SYNC)
-#define _O_UNSUPPORTED (0)
-
-extern int open(const char* path, int oflag, ...);
-extern int fcntl(int fildes, int cmd, ...);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/sdk-modifications/include/ds2_malloc.h b/sdk-modifications/include/ds2_malloc.h
deleted file mode 100755
index 5f158f7..0000000
--- a/sdk-modifications/include/ds2_malloc.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef __DS2_MALLOC_H__
-#define __DS2_MALLOC_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern void heapInit(unsigned int start, unsigned int end);
-
-extern void* Drv_alloc(unsigned int nbytes);
-extern void Drv_deAlloc(void* address);
-extern void* Drv_realloc(void* address, unsigned int nbytes);
-extern void* Drv_calloc(unsigned int nmem, unsigned int size);
-
-#ifdef __cplusplus
-}
-#endif
-
-#define malloc Drv_alloc
-#define calloc Drv_calloc
-#define realloc Drv_realloc
-#define free Drv_deAlloc
-
-#ifdef __cplusplus
-#include <stdio.h>
-inline void* operator new ( size_t s ) { return malloc( s ); }
-inline void* operator new[] ( size_t s ) { return malloc( s ); }
-inline void operator delete ( void* p ) { free( p ); }
-inline void operator delete[] ( void* p ) { free( p ); }
-#endif
-
-#endif //__DS2_MALLOC_H__
diff --git a/sdk-modifications/include/ds2_mmc_api.h b/sdk-modifications/include/ds2_mmc_api.h
deleted file mode 100755
index 28e75ef..0000000
--- a/sdk-modifications/include/ds2_mmc_api.h
+++ /dev/null
@@ -1,56 +0,0 @@
-#ifndef __MMC_API_H__
-#define __MMC_API_H__
-
-/* Error codes */
-enum mmc_result_t {
- MMC_NO_RESPONSE = -1,
- MMC_NO_ERROR = 0,
- MMC_ERROR_OUT_OF_RANGE,
- MMC_ERROR_ADDRESS,
- MMC_ERROR_BLOCK_LEN,
- MMC_ERROR_ERASE_SEQ,
- MMC_ERROR_ERASE_PARAM,
- MMC_ERROR_WP_VIOLATION,
- MMC_ERROR_CARD_IS_LOCKED,
- MMC_ERROR_LOCK_UNLOCK_FAILED,
- MMC_ERROR_COM_CRC,
- MMC_ERROR_ILLEGAL_COMMAND,
- MMC_ERROR_CARD_ECC_FAILED,
- MMC_ERROR_CC,
- MMC_ERROR_GENERAL,
- MMC_ERROR_UNDERRUN,
- MMC_ERROR_OVERRUN,
- MMC_ERROR_CID_CSD_OVERWRITE,
- MMC_ERROR_STATE_MISMATCH,
- MMC_ERROR_HEADER_MISMATCH,
- MMC_ERROR_TIMEOUT,
- MMC_ERROR_CRC,
- MMC_ERROR_DRIVER_FAILURE,
-};
-
-
-/* Get card's sectors*/
-
-extern unsigned int MMC_GetSize(void);
-
-
-/* initialize MMC/SD card */
-extern int MMC_Initialize(void);
-
-/* read a single block from MMC/SD card */
-extern int MMC_ReadBlock(unsigned int blockaddr, unsigned char *recbuf);
-
-/* read multi blocks from MMC/SD card */
-extern int MMC_ReadMultiBlock(unsigned int blockaddr, unsigned int blocknum, unsigned char *recbuf);
-
-/* write a block to MMC/SD card */
-extern int MMC_WriteBlock(unsigned int blockaddr, unsigned char *recbuf);
-
-/* write multi blocks to MMC/SD card */
-extern int MMC_WriteMultiBlock(unsigned int blockaddr, unsigned int blocknum, unsigned char *recbuf);
-
-/* detect MMC/SD card */
-extern int MMC_DetectStatus(void);
-
-#endif /* __MMC_API_H__ */
-
diff --git a/sdk-modifications/include/ds2_timer.h b/sdk-modifications/include/ds2_timer.h
deleted file mode 100755
index 3e5c3bc..0000000
--- a/sdk-modifications/include/ds2_timer.h
+++ /dev/null
@@ -1,50 +0,0 @@
-#ifndef __DS2_TIMER_H__
-#define __DS2_TIMER_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
-* Function: register a timer interruptting periodly
-* channel: timer id, from 0 to 1
-* period: interrupt period, unit is us, period < 2.5s
-* handle: interrupt handle, if handle = NULL, the timer will not generate interrupt
-* arg: argument to the interrupt handle
-*/
-extern int initTimer(unsigned int channel, unsigned int period, void (*handle)(unsigned int), int arg);
-
-/*
-* Function: set the timer run
-*/
-extern void runTimer(unsigned int channel);
-
-/*
-* Function: stop timer
-*/
-extern void stopTimer(unsigned int channel);
-
-/*
-* Function: reset timer
-*/
-extern void resetTimer(unsigned int channel);
-
-/*
-* Function: read value of timer
-*/
-extern unsigned int readTimer(unsigned int channel);
-
-
-#define SYSTIME_UNIT 42667
-/*
-* Function: get the elapsed time since DS2 started
-* it's uint is 42.667us, it will overflow after 50.9 horus since DS2 started
-*/
-extern unsigned int getSysTime(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //__DS2_TIMER_H__
-
diff --git a/sdk-modifications/include/ds2_types.h b/sdk-modifications/include/ds2_types.h
deleted file mode 100755
index ae66737..0000000
--- a/sdk-modifications/include/ds2_types.h
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef __DS2_TYPES_H__
-#define __DS2_TYPES_H__
-
-typedef unsigned char u8;
-typedef char s8;
-
-typedef unsigned short u16;
-typedef short s16;
-
-typedef unsigned int u32;
-typedef int s32;
-
-typedef unsigned long long u64;
-typedef long long s64;
-
-typedef volatile unsigned char vu8;
-typedef volatile char vs8;
-
-typedef volatile unsigned short vu16;
-typedef volatile short vs16;
-
-typedef volatile unsigned int vu32;
-typedef volatile int vs32;
-
-typedef volatile unsigned long long vu64;
-typedef volatile long long vs64;
-
-#ifndef NULL
-#define NULL 0
-#endif
-
-#ifndef TRUE
-#define TRUE 1
-#define FALSE 0
-#endif
-
-#endif //__DS2_TYPES_H__
diff --git a/sdk-modifications/include/ds2io.h b/sdk-modifications/include/ds2io.h
deleted file mode 100755
index e715cef..0000000
--- a/sdk-modifications/include/ds2io.h
+++ /dev/null
@@ -1,285 +0,0 @@
-#ifndef __DS2IO_H__
-#define __DS2IO_H__
-
-#ifndef BIT
-#define BIT(a) (1<<a)
-#endif
-
-#define SCREEN_WIDTH 256
-#define SCREEN_HEIGHT 192
-
-#define AUDIO_BUFFER_COUNT 4 // in 1.2, that's 4, but in 0.13 it would be 16 [Neb]
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct touchPosition {
- signed short x;
- signed short y;
-} touchPosition;
-
-typedef struct T_INPUT
-{
- unsigned int keysHeld;
- unsigned int keysUp;
- unsigned int keysDown;
- unsigned int keysDownRepeat;
- touchPosition touchPt;
- touchPosition movedPt;
- int touchDown;
- int touchUp;
- int touchHeld;
- int touchMoved;
-}INPUT;
-
-typedef enum KEYPAD_BITS {
- KEY_A = BIT(0), //!< Keypad A button.
- KEY_B = BIT(1), //!< Keypad B button.
- KEY_SELECT = BIT(2), //!< Keypad SELECT button.
- KEY_START = BIT(3), //!< Keypad START button.
- KEY_RIGHT = BIT(4), //!< Keypad RIGHT button.
- KEY_LEFT = BIT(5), //!< Keypad LEFT button.
- KEY_UP = BIT(6), //!< Keypad UP button.
- KEY_DOWN = BIT(7), //!< Keypad DOWN button.
- KEY_R = BIT(8), //!< Right shoulder button.
- KEY_L = BIT(9), //!< Left shoulder button.
- KEY_X = BIT(10), //!< Keypad X button.
- KEY_Y = BIT(11), //!< Keypad Y button.
- KEY_TOUCH = BIT(12), //!< Touchscreen pendown.
- KEY_LID = BIT(13) //!< Lid state.
-} KEYPAD_BITS;
-
-struct rtc{
- volatile unsigned char year; //add 2000 to get 4 digit year
- volatile unsigned char month; //1 to 12
- volatile unsigned char day; //1 to (days in month)
-
- volatile unsigned char weekday; // day of week
- volatile unsigned char hours; //0 to 11 for AM, 52 to 63 for PM
- volatile unsigned char minutes; //0 to 59
- volatile unsigned char seconds; //0 to 59
-};
-
-struct key_buf
-{
- unsigned short key;
- unsigned short x;
- unsigned short y;
-};
-
-typedef enum SCREEN_ID
-{
- UP_SCREEN = 1,
- DOWN_SCREEN = 2,
- DUAL_SCREEN = 3,
- JOINTUSE_SCREEN = 3
-} SCREEN_ID;
-
-#define UP_MASK 0x1
-#define DOWN_MASK 0x2
-#define DUAL_MASK 0x3
-
-//video buffer address of up screen
-extern void* up_screen_addr;
-
-//video buffer address of down screen
-extern void* down_screen_addr;
-
-//every time call ds2_updateAudio() function, the ds2io layer will transfer
-//audio_samples_per_trans *4 bytes audio data to NDS
-extern unsigned int audio_samples_per_trans;
-
-/*
-* Function: initialize ds2 I/O(DS2 Input and Output) layer
-* audio_samples_lenght: ds2io layer's audio buffer length, it unit is sample
-* which is fixed 4(ds2io use stereo and 16-bit audio) bytes,
-* audio_samples_lenght sholud be 128*n, 128 <= audio_samples_lenght <= 4096
-* NOTE: the audio sampling frequence be fixed to 44.1KHz, 2 channels 16-bit
-*/
-extern int ds2io_init(int audio_samples_lenght);
-
-/*
-* Function: initialize ds2 I/O(DS2 Input and Output) layer (b version)
-* audio_samples_lenght: ds2io layer's audio buffer length, it unit is sample
-* which is fixed 4(ds2io use stereo and 16-bit audio) bytes,
-* audio_samples_lenght sholud be 128*n, 128 <= audio_samples_lenght <= 4096
-* audio_samples_freq: audio samples frequence, it should be among 44100, 22050,
-* 11025
-* reserved1: reserved for future using
-* reserved2: reserved for future using
-* NOTE: the audio samples are 2 channels 16-bit
-*/
-extern int ds2io_initb(int audio_samples_lenght, int audio_samples_freq, int reserved1,
- int reserved2);
-
-/*
-* Function: update video data from buffer to screen, the ds2io layer have 2 video
-* buffers for up screen and 2 video buffers for down screen, everytime
-* ds2_flipScreen is called, up_screen_addr and/or down_buffer_addr
-* point to the other buffer, but not always do so, see below.
-* screen_num: UP_SCREEN, only update up screen
-* DOWN_SCREEN, only update down screen
-* DUAL_SCREEN, update both up screen and down screen
-* done: after updating video data, the up_screen_addr and/or down_buffer_addr
-* are ready to point the other buffer, but if the other buffer is busy:
-* when done = 0, ds2_flipScreen returns without change up_screen_addr
-* and/or down_buffer_addr pointer. it will not sure the graphic just
-* updated will appear on the screen
-* when done = 1, it will WAIT untill the other buffer idle and change
-* the pointers and returns. the graphic just updated will appear on
-* the screen, but please noting the word "WAIT"
-* when done = 2, it will WAIT untill the other buffer idle, then return
-* without change the pointers, it is convenient for GUI drawing
-*/
-extern void ds2_flipScreen(enum SCREEN_ID screen_num, int done);
-
-/*
-* Function: set the video buffer to a single color
-* screen_num: UP_SCREEN, only set up screen buffer
-* DOWN_SCREEN, only set down screen buffer
-* DUAL_SCREEN, set both up screen and down screen buffer
-*/
-extern void ds2_clearScreen(enum SCREEN_ID screen_num, unsigned short color);
-
-
-/*
-* Function: there are AUDIO_BUFFER_COUNT audio buffers on the ds2io layer, this function to
-* check how many buffers are occupied
-*/
-extern int ds2_checkAudiobuff(void);
-
-/*
-* Function: get audio buffer address
-* NOTE: ds2_getAudiobuff may return NULL, even if ds2_checkAudiobuff() < AUDIO_BUFFER_COUNT.
-* The fact are that, AUDIO_BUFFER_COUNT audio buffers are on NDS, the ds2io layer using
-* 2 other buffers transfering data to the AUDIO_BUFFER_COUNT audio buffers alternately,
-* this function checks the 2 buffers in ds2io layers whether are occupied,
-* it will return the address of the idle buffer, else it return NULL
-*/
-extern void* ds2_getAudiobuff(void);
-
-/*
-* Function: flush audio data from buffer to ds2io layer
- NOTE: execution of the function ds2_updateAudio() only put audio data transfer request to wait queue,
- it is not equal that the audio data reach NDS buffer.
-*/
-extern void ds2_updateAudio(void);
-
-
-/*
-* Function: set audio info
-* audio_samples_freq: default freq 44100Hz
-* audio_sample_bit: 16bit
-* audio_samples_lenght: sholud be 128*n, 128 <= audio_samples_lenght <= 4096
-* channels: 2
-* data_format: 0: interleave(L R L R L R L R ...) 1: group(L L L L ...R R R R ...)
-*/
-void ds2_setAudio( unsigned int audio_samples_freq, int audio_sample_bit, unsigned int audio_samples_lenght, int channels, int data_format );
-
-
-#ifndef RGB15
-#define RGB15(r,g,b) (((r)|((g)<<5)|((b)<<10))|BIT(15))
-#endif
-
-/*
-* Functin: get time
-*/
-extern void ds2_getTime(struct rtc *time);
-
-/*
-* Function: get brightness of the screens
-* return: fours levels 0, 1, 2, 3
-*/
-extern int ds2_getBrightness(void);
-
-/*
-* Function: set brightness of the screens
-* Input: level, there are 4 levels, 0, 1, 2 and 3
-*/
-extern void ds2_setBrightness(int level);
-
-/*
-* Function: get the swaping state of the screens
-*/
-extern int ds2_getSwap(void);
-
-/*
-* Funciotn: swap up screen and down screen
-*/
-extern void ds2_setSwap(int swap);
-
-/*
-* Function: get backlight status
-* input bit0 = 0 set down screen's backlight off
-* bit0 = 1 set down screen's backlight on
-* bit1 = 0 set up screen's backlight off
-* bit1 = 1 set up screen's backlight on
-*/
-extern void ds2_setBacklight(int backlight);
-
-/*
-* Function: get backlight status
-* return bit0 = 0 the down screen's backlight is off
-* bit0 = 1 the down screen's backlight is on
-* bit1 = 0 the up screen's backlight is off
-* bit1 = 1 the up screen's backlight is on
-*/
-extern int ds2_getBacklight(void);
-
-/*
-* Function: system suspend
-*/
-extern void ds2_setSupend(void);
-
-/*
-* Function: system wakeup
-*/
-extern void ds2_wakeup(void);
-
-/*
-* Function: NDS power offf
-*/
-extern void ds2_shutdown(void);
-
-/*
-* Function: set volume of NDS
-* Input: volume 0- mute
-* 1 - 127 hardware adjust the volume
-* 128-255 software adjust the volume, when close to 255, the sound may
-* be saturation distortion
-*/
-extern void ds2_setVolume(int volume);
-
-/*
-* Funciton: get key value and touch screen position value
-*/
-extern void ds2_getrawInput(struct key_buf *input);
-
-/*
-* Function: system exit, return to DSTWO Menu
-*/
-extern void ds2_plug_exit(void);
-
-/*
-* Function: return ds2sdk version string
-*/
-extern const char* ds2_getVersion(void);
-
-/*
-* Function: Register a function for debug purpos, such as CONSOLE. when keys
-* pressed, function fun will be called in the interruption
-*/
-extern void regist_escape_key(void (*fun)(void), unsigned int keys);
-
-/*
-* Function: release the function fointer registered by regist_escape_key
-*/
-extern void release_escape_key(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //__DS2IO_H__
-
diff --git a/sdk-modifications/include/fat.h b/sdk-modifications/include/fat.h
deleted file mode 100755
index 52ec499..0000000
--- a/sdk-modifications/include/fat.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- fat.h
- Simple functionality for startup, mounting and unmounting of FAT-based devices.
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-
- 2006-07-14
- * fatInitialise renamed to fatInit
-
- 2006-07-16 - Chishm
- * Added fatInitDefault
-*/
-
-
-#ifndef _LIBFAT_H
-#define _LIBFAT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// When compiling for NDS, make sure NDS is defined
-#ifndef NDS
- #define NDS
-#endif
-
-#include <nds/jtypes.h>
-#include "partition.h"
-#include "directory.h"
-#include "file_allocation_table.h"
-//#include "unicode/unicode.h"
-#include "fatdir_ex.h"
-#include "fatfile_ex.h"
-
-//typedef enum {PI_DEFAULT, PI_SLOT_1, PI_SLOT_2, PI_CUSTOM} PARTITION_INTERFACE;
-
-struct IO_INTERFACE_STRUCT ;
-
-/*
-Initialise any inserted block-devices.
-Add the fat device driver to the devoptab, making it available for standard file functions.
-cacheSize: The number of pages to allocate for each inserted block-device
-setAsDefaultDevice: if true, make this the default device driver for file operations
-*/
-bool fatInit (u32 cacheSize, bool setAsDefaultDevice);
-
-/*
-Calls fatInit with setAsDefaultDevice = true and cacheSize optimised for the host system.
-*/
-bool fatInitDefault (void);
-
-/*
-Special initialize for RPG card
-*/
-bool fatInitRPG (void);
-
-/*
-Mount the device specified by partitionNumber
-PD_DEFAULT is not allowed, use _FAT_partition_setDefaultDevice
-PD_CUSTOM is not allowed, use _FAT_partition_mountCustomDevice
-*/
-bool fatMountNormalInterface (PARTITION_INTERFACE partitionNumber, u32 cacheSize);
-
-/*
-Mount a partition on a custom device
-*/
-bool fatMountCustomInterface (struct IO_INTERFACE_STRUCT* device, u32 cacheSize);
-
-/*
-Unmount the partition specified by partitionNumber
-If there are open files, it will fail
-*/
-bool fatUnmount (PARTITION_INTERFACE partitionNumber);
-
-
-/*
-Forcibly unmount the partition specified by partitionNumber
-Any open files on the partition will become invalid
-The cache will be invalidated, and any unflushed writes will be lost
-*/
-bool fatUnsafeUnmount (PARTITION_INTERFACE partitionNumber);
-
-/*
-Set the default device for access by fat: and fat0:
-PD_DEFAULT is unallowed.
-Doesn't do anything useful on GBA, since there is only one device
-*/
-bool fatSetDefaultInterface (PARTITION_INTERFACE partitionNumber);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // _LIBFAT_H
diff --git a/sdk-modifications/include/fatdir.h b/sdk-modifications/include/fatdir.h
deleted file mode 100755
index 529e401..0000000
--- a/sdk-modifications/include/fatdir.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- fatdir.h
-
- Functions used by the newlib disc stubs to interface with
- this library
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-08-13 - Chishm
- * Moved all externally visible directory related functions to fatdir
- * Added _FAT_mkdir_r
-
- 2006-08-14 - Chishm
- * Added directory iterator functions
-
- 2007-01-10 - Chishm
- * Updated directory iterator functions for DevkitPro r20
-*/
-
-
-#ifndef _FATDIR_H
-#define _FATDIR_H
-
-//#include <sys/reent.h>
-#include <sys/stat.h>
-//#include <sys/iosupport.h>
-#include "fs_common.h"
-#include "directory.h"
-
-typedef struct {
- PARTITION* partition;
- DIR_ENTRY currentEntry;
- u32 startCluster;
- u32 posEntry;
- bool inUse;
- bool validEntry;
-} DIR_STATE_STRUCT;
-
-extern int _FAT_stat_r (struct _reent *r, const char *path, struct stat *st);
-
-extern int _FAT_link_r (struct _reent *r, const char *existing, const char *newLink);
-
-extern int _FAT_unlink_r (struct _reent *r, const char *name);
-
-extern int _FAT_chdir_r (struct _reent *r, const char *name);
-
-extern int _FAT_rename_r (struct _reent *r, const char *oldName, const char *newName);
-
-extern int _FAT_mkdir_r (struct _reent *r, const char *path, int mode);
-
-/*
-Directory iterator functions
-*/
-extern DIR_STATE_STRUCT* _FAT_diropen_r(struct _reent *r, DIR_STATE_STRUCT *dirState, const char *path);
-extern int _FAT_dirreset_r (struct _reent *r, DIR_STATE_STRUCT *dirState);
-extern int _FAT_dirnext_r (struct _reent *r, DIR_STATE_STRUCT *dirState, struct stat *filestat);
-extern int _FAT_dirclose_r (struct _reent *r, DIR_STATE_STRUCT *dirState);
-
-
-#endif // _FATDIR_H
diff --git a/sdk-modifications/include/fatdir_ex.h b/sdk-modifications/include/fatdir_ex.h
deleted file mode 100755
index fbac46f..0000000
--- a/sdk-modifications/include/fatdir_ex.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef _FATDIR_EX_H_
-#define _FATDIR_EX_H_
-
-#include "fatdir.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int dirnextl (DIR_ITER *dirState, char *filename, char *longFilename, struct stat *filestat);
-int renamex( const char *oldName, const char *newName );
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif//_FATDIR_EX_H_
diff --git a/sdk-modifications/include/fatfile.h b/sdk-modifications/include/fatfile.h
deleted file mode 100755
index 4869562..0000000
--- a/sdk-modifications/include/fatfile.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- fatfile.h
-
- Functions used by the newlib disc stubs to interface with
- this library
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-
- 2006-07-17 - Chishm
- * Made all path inputs const char*
- * Added _FAT_rename_r
-
- 2006-07-24 - Chishm
- * Removed padding workaround from FILE_STRUCT
-
- 2006-08-13 - Chishm
- * Moved all externally visible directory related functions to fatdir
-*/
-
-
-#ifndef _FATFILE_H
-#define _FATFILE_H
-
-//#include <sys/reent.h>
-#include <sys/stat.h>
-
-#include "fs_common.h"
-#include "partition.h"
-#include "directory.h"
-
-typedef struct {
- u32 cluster;
- u32 sector;
- s32 byte;
-} FILE_POSITION;
-
-typedef struct {
- int fd;
- u32 filesize;
- u32 startCluster;
- u32 currentPosition;
- FILE_POSITION rwPosition;
- FILE_POSITION appendPosition;
- bool read;
- bool write;
- bool append;
- bool inUse;
- PARTITION* partition;
- DIR_ENTRY_POSITION dirEntryStart; // Points to the start of the LFN entries of a file, or the alias for no LFN
- DIR_ENTRY_POSITION dirEntryEnd; // Always points to the file's alias entry
-} FILE_STRUCT;
-
-extern int _FAT_open_r (struct _reent *r, void *fileStruct, const char *path, int flags);
-
-extern int _FAT_close_r (struct _reent *r, int fd);
-
-extern int _FAT_write_r (struct _reent *r,int fd, const char *ptr, int len);
-
-extern int _FAT_read_r (struct _reent *r, int fd, char *ptr, int len);
-
-extern int _FAT_seek_r (struct _reent *r, int fd,int pos, int dir);
-
-extern int _FAT_fstat_r (struct _reent *r, int fd, struct stat *st);
-
-#endif // _FATFILE_H
diff --git a/sdk-modifications/include/fatfile_ex.h b/sdk-modifications/include/fatfile_ex.h
deleted file mode 100755
index c434b63..0000000
--- a/sdk-modifications/include/fatfile_ex.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef _FATFILE_EX_H_
-#define _FATFILE_EX_H_
-
-#include <stdio.h>
-#include "fatfile.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int freadex( void * buffer, int _size, int _n, FILE * f );
-int fwritex( const void * buffer, int _size, int _n, FILE * f );
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif//_FATFILE_EX_H_
diff --git a/sdk-modifications/include/file_allocation_table.h b/sdk-modifications/include/file_allocation_table.h
deleted file mode 100755
index 4fb4149..0000000
--- a/sdk-modifications/include/file_allocation_table.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- file_allocation_table.h
- Reading, writing and manipulation of the FAT structure on
- a FAT partition
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-
- 2006-10-01 - Chishm
- * Added _FAT_fat_linkFreeClusterCleared to clear a cluster when it is allocated
-*/
-
-#ifndef _FAT_H
-#define _FAT_H
-
-#include "fs_common.h"
-#include "partition.h"
-
-#define CLUSTER_EOF_16 0xFFFF
-#define CLUSTER_EOF 0x0FFFFFFF
-#define CLUSTER_FREE 0x0000
-#define CLUSTER_FIRST 0x0002
-
-#define CLUSTERS_PER_FAT12 4085
-#define CLUSTERS_PER_FAT16 65525
-
-
-u32 _FAT_fat_nextCluster(PARTITION* partition, u32 cluster);
-
-u32 _FAT_fat_linkFreeCluster(PARTITION* partition, u32 cluster);
-u32 _FAT_fat_linkFreeClusterCleared (PARTITION* partition, u32 cluster);
-
-bool _FAT_fat_clearLinks (PARTITION* partition, u32 cluster);
-
-u32 _FAT_fat_lastCluster (PARTITION* partition, u32 cluster);
-
-static inline u32 _FAT_fat_clusterToSector (PARTITION* partition, u32 cluster) {
- return (cluster >= 2) ? ((cluster - 2) * partition->sectorsPerCluster) + partition->dataStart : partition->rootDirStart;
-}
-
-#endif // _FAT_H
diff --git a/sdk-modifications/include/filetime.h b/sdk-modifications/include/filetime.h
deleted file mode 100755
index fa651a7..0000000
--- a/sdk-modifications/include/filetime.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- filetime.h
- Conversion of file time and date values to various other types
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-*/
-
-#ifndef _FILETIME_H
-#define _FILETIME_H
-
-#include "fs_common.h"
-#include <sys/types.h>
-
-u16 _FAT_filetime_getTimeFromRTC (void);
-u16 _FAT_filetime_getDateFromRTC (void);
-
-time_t _FAT_filetime_to_time_t (u16 time, u16 date);
-
-
-#endif // _FILETIME_H
diff --git a/sdk-modifications/include/fs_api.h b/sdk-modifications/include/fs_api.h
deleted file mode 100755
index b3431b6..0000000
--- a/sdk-modifications/include/fs_api.h
+++ /dev/null
@@ -1,151 +0,0 @@
-#ifndef __FS_API_H__
-#define __FS_API_H__
-//v1.0
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "sys/stat.h"
-#include "fatfile.h"
-#include "fatdir.h"
-
-
-#define mode_t unsigned int
-#define size_t unsigned int
-
-extern int fat_init(void);
-
-extern FILE_STRUCT* fat_fopen(const char *file, const char *mode);
-
-extern size_t fat_fread(void *buf, size_t size, size_t count, FILE_STRUCT *fp);
-
-extern size_t fat_fwrite(const void *buf, size_t size, size_t count, FILE_STRUCT *fp);
-
-extern int fat_fclose(FILE_STRUCT *fp);
-
-extern int fat_fseek(FILE_STRUCT *fp, long offset, int whence);
-
-extern long fat_ftell(FILE_STRUCT *fp);
-
-extern int fat_feof(FILE_STRUCT *fp);
-
-extern int fat_ferror(FILE_STRUCT *fp);
-
-extern void fat_clearerr(FILE_STRUCT *fp);
-
-extern int fat_fflush(FILE_STRUCT *fp);
-
-extern int fat_fgetc(FILE_STRUCT *fp);
-
-extern char* fat_fgets(char *buf, int n, FILE_STRUCT *fp);
-
-extern int fat_fputc(int ch, FILE_STRUCT *fp);
-
-extern int fat_fputs(const char *s, FILE_STRUCT *fp);
-
-extern int fat_remove(const char *filename);
-
-extern int fat_rename(const char *oldName, const char *newName);
-
-extern int fat_setHidden(const char *name, unsigned char hide);
-
-extern int fat_isHidden(struct stat *st);
-
-extern int fat_getShortName(const char *fullName, char *outName);
-
-extern void fat_rewind(FILE_STRUCT *fp);
-
-extern int fat_fstat(int fildes, struct stat *buf);
-
-extern int fat_fprintf(void* fp, const char *format, ...);
-
-extern int fat_fscanf(FILE_STRUCT *fp, const char *format, ...);
-
-extern DIR_STATE_STRUCT* fat_opendir(const char *name);
-
-extern DIR_ENTRY* fat_readdir(DIR_STATE_STRUCT *dirp);
-
-extern long fat_telldir(DIR_STATE_STRUCT *dirp);
-
-extern void fat_seekdir(DIR_STATE_STRUCT *dirp, long int loc);
-
-extern int fat_closedir(DIR_STATE_STRUCT *dirp);
-
-extern int fat_chdir(const char *path);
-
-extern char* fat_getcwd(char *buf, size_t size);
-
-extern int fat_mkdir(const char *path, mode_t mode);
-
-extern int fat_rmdir(const char *path);
-
-extern int fat_lstat(const char *path, struct stat *buf);
-
-extern DIR_ENTRY* fat_readdir_ex(DIR_STATE_STRUCT *dirp, struct stat *statbuf);
-
-#ifndef SEEK_SET
-#define SEEK_SET 0 /* Seek from beginning of file. */
-#endif
-
-#ifndef SEEK_CUR
-#define SEEK_CUR 1 /* Seek from current position. */
-#endif
-
-#ifndef SEEK_END
-#define SEEK_END 2 /* Seek from end of file. */
-#endif
-
-//#define S_ISDIR(st) (st.st_mode & S_IFDIR)
-
-#define FILE FILE_STRUCT
-#define fopen fat_fopen
-#define fread fat_fread
-#define fwrite fat_fwrite
-#define fclose fat_fclose
-#define fgets fat_fgets
-#define fseek fat_fseek
-#define ftell fat_ftell
-#define feof fat_feof
-#define ferror fat_ferror
-#define fclearerr fat_clearerr
-#define fflush fat_fflush
-#define fgetc fat_fgetc
-#define fgets fat_fgets
-#define fputc fat_fputc
-#define fputs fat_fputs
-#define fprintf fat_fprintf
-#define fscanf fat_fscanf
-#define remove fat_remove
-
-#define DIR DIR_STATE_STRUCT
-#define dirent DIR_ENTRY
-#define opendir fat_opendir
-#define readdir fat_readdir
-#define telldir fat_telldir
-#define seekdir fat_seekdir
-#define closedir fat_closedir
-#define chdir fat_chdir
-#define getcwd fat_getcwd
-#define mkdir fat_mkdir
-#define rmdir fat_rmdir
-
-#define lstat fat_lstat
-#define fstat fat_fstat
-
-#define S_ISHID(st_mode) ((st_mode & S_IHIDDEN) != 0)
-
-//the extended version of readdir_ex
-#define readdir_ex fat_readdir_ex
-
-#define MAX_PATH 512
-#define MAX_FILE 512
-
-//Misc function
-extern bool fat_getDiskSpaceInfo( char * diskName, unsigned int *total, unsigned int *used, unsigned int *freeSpace );
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //__FS_API_H__
diff --git a/sdk-modifications/include/fs_cache.h b/sdk-modifications/include/fs_cache.h
deleted file mode 100755
index b0ab9be..0000000
--- a/sdk-modifications/include/fs_cache.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- cache.h
- The cache is not visible to the user. It should be flushed
- when any file is closed or changes are made to the filesystem.
-
- This cache implements a least-used-page replacement policy. This will
- distribute sectors evenly over the pages, so if less than the maximum
- pages are used at once, they should all eventually remain in the cache.
- This also has the benefit of throwing out old sectors, so as not to keep
- too many stale pages around.
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-*/
-
-#ifndef _CACHE_H
-#define _CACHE_H
-
-#include "fs_common.h"
-#include "disc_io/disc_io.h"
-
-#define CACHE_PAGE_SIZE BYTES_PER_READ
-
-typedef struct {
- u32 sector;
- u32 count;
- bool dirty;
-} CACHE_ENTRY;
-
-typedef struct {
- const IO_INTERFACE* disc;
- u32 numberOfPages;
- CACHE_ENTRY* cacheEntries;
- u8* pages;
-} CACHE;
-
-
-/*
-Read data from a sector in the cache
-If the sector is not in the cache, it will be swapped in
-offset is the position to start reading from
-size is the amount of data to read
-Precondition: offset + size <= BYTES_PER_READ
-*/
-bool _FAT_cache_readPartialSector (CACHE* cache, void* buffer, u32 sector, u32 offset, u32 size);
-
-/*
-Write data to a sector in the cache
-If the sector is not in the cache, it will be swapped in.
-When the sector is swapped out, the data will be written to the disc
-offset is the position to start reading from
-size is the amount of data to read
-Precondition: offset + size <= BYTES_PER_READ
-*/
-bool _FAT_cache_writePartialSector (CACHE* cache, const void* buffer, u32 sector, u32 offset, u32 size);
-
-/*
-Write data to a sector in the cache, zeroing the sector first
-If the sector is not in the cache, it will be swapped in.
-When the sector is swapped out, the data will be written to the disc
-offset is the position to start reading from
-size is the amount of data to read
-Precondition: offset + size <= BYTES_PER_READ
-*/
-bool _FAT_cache_eraseWritePartialSector (CACHE* cache, const void* buffer, u32 sector, u32 offset, u32 size);
-
-/*
-Read a full sector from the cache
-*/
-static inline bool _FAT_cache_readSector (CACHE* cache, void* buffer, u32 sector) {
- return _FAT_cache_readPartialSector (cache, buffer, sector, 0, BYTES_PER_READ);
-}
-
-/*
-Write a full sector to the cache
-*/
-static inline bool _FAT_cache_writeSector (CACHE* cache, const void* buffer, u32 sector) {
- return _FAT_cache_writePartialSector (cache, buffer, sector, 0, BYTES_PER_READ);
-}
-
-/*
-Write any dirty sectors back to disc and clear out the contents of the cache
-*/
-bool _FAT_cache_flush (CACHE* cache);
-
-/*
-Clear out the contents of the cache without writing any dirty sectors first
-*/
-void _FAT_cache_invalidate (CACHE* cache);
-
-CACHE* _FAT_cache_constructor (u32 numberOfPages, const IO_INTERFACE* discInterface);
-
-void _FAT_cache_destructor (CACHE* cache);
-
-#endif // _CACHE_H
diff --git a/sdk-modifications/include/fs_common.h b/sdk-modifications/include/fs_common.h
deleted file mode 100755
index db47d9a..0000000
--- a/sdk-modifications/include/fs_common.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- common.h
- Common definitions and included files for the FATlib
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-*/
-
-#ifndef _COMMON_H
-#define _COMMON_H
-
-// When compiling for NDS, make sure NDS is defined
-#ifndef NDS
- #if defined ARM9 || defined ARM7
- #define NDS
- #endif
-#endif
-
-#if 0
-#ifdef NDS
- #include <nds/jtypes.h>
-#else
- #include "gba_types.h"
-#endif
-#endif
-
-#define BYTES_PER_READ 512
-
-// MODIFICATION START [Neb]
-// In libfat by Chishm, some types are #define'd here. In the DS2 SDK,
-// these types are defined by another header.
-#include "ds2_types.h"
-
-#ifndef bool
-#define bool int
-#endif
-
-#ifndef false
-#define false 0
-#endif
-
-#ifndef true
-#define true 1
-#endif
-
-// MODIFICATION END [Neb]
-
-struct _reent
-{
- /* FILE is a big struct and may change over time. To try to achieve binary
- compatibility with future versions, put stdin,stdout,stderr here.
- These are pointers into member __sf defined below. */
-// __FILE *_stdin, *_stdout, *_stderr; /* XXX */
-
- int _errno; /* local copy of errno */
-
-// int _inc; /* used by tmpnam */
-
-// char *_emergency;
-
-// int __sdidinit; /* 1 means stdio has been init'd */
-
-// int _current_category; /* unused */
-// _CONST char *_current_locale; /* unused */
-
-// struct _mprec *_mp;
-
-// void _EXFNPTR(__cleanup, (struct _reent *));
-
-// int _gamma_signgam;
-
- /* used by some fp conversion routines */
-// int _cvtlen; /* should be size_t */
-// char *_cvtbuf;
-
-// struct _rand48 *_r48;
-// struct __tm *_localtime_buf;
-// char *_asctime_buf;
-
- /* signal info */
-// void (**(_sig_func))(int);
-
- /* atexit stuff */
-// struct _atexit *_atexit;
-// struct _atexit _atexit0;
-
-// struct _glue __sglue; /* root of glue chain */
-// __FILE *__sf; /* file descriptors */
-// struct _misc_reent *_misc; /* strtok, multibyte states */
-// char *_signal_buf; /* strsignal */
-};
-
-#endif // _COMMON_H
diff --git a/sdk-modifications/include/fs_unicode.h b/sdk-modifications/include/fs_unicode.h
deleted file mode 100755
index 45e9d0a..0000000
--- a/sdk-modifications/include/fs_unicode.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef __FS_UNICODE_H__
-#define __FS_UNICODE_H__
-
-extern void _FAT_utf8_to_unicode16( const char* src, u16* dest );
-
-extern void _FAT_unicode16_to_utf8( const u16* src, char* dest);
-
-extern u32 _unistrnlen( const u16* unistr, u32 maxlen );
-
-extern int _unistrncmp( const u16 * src, const u16 * dest, u32 maxlen );
-
-extern const u16 * _unistrchr( const u16 * str, u16 unichar );
-
-int _uniisalnum( u8 ch );
-
-#endif //__FS_UNICODE_H__
diff --git a/sdk-modifications/include/mem_allocate.h b/sdk-modifications/include/mem_allocate.h
deleted file mode 100755
index 844f6df..0000000
--- a/sdk-modifications/include/mem_allocate.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- mem_allocate.h
- Memory allocation and destruction calls
- Replace these calls with custom allocators if
- malloc is unavailable
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-*/
-
-#ifndef _MEM_ALLOCATE_H
-#define _MEM_ALLOCATE_H
-
-#include "ds2_malloc.h"
-
-static inline void* _FAT_mem_allocate (size_t size) {
- return ((void*)malloc (size));
-}
-
-static inline void _FAT_mem_free (void* mem) {
- return (free ((void*)mem));
-}
-
-#endif // _MEM_ALLOCATE_H
diff --git a/sdk-modifications/include/mips.h b/sdk-modifications/include/mips.h
deleted file mode 100755
index 3792565..0000000
--- a/sdk-modifications/include/mips.h
+++ /dev/null
@@ -1,820 +0,0 @@
-/**************************************************************************
-* *
-* PROJECT : MIPS port for uC/OS-II *
-* *
-* MODULE : MIPS.h *
-* *
-* AUTHOR : Michael Anburaj *
-* URL : http://geocities.com/michaelanburaj/ *
-* EMAIL: michaelanburaj@hotmail.com *
-* *
-* PROCESSOR : MIPS 4Kc (32 bit RISC) - ATLAS board *
-* *
-* TOOL-CHAIN : SDE & Cygnus *
-* *
-* DESCRIPTION : *
-* MIPS processor definitions. *
-* The basic CPU definitions are found in the file archdefs.h, which *
-* is included by mips.h. *
-* *
-* mips.h implements aliases for some of the definitions in archdefs.h *
-* and adds various definitions. *
-* *
-**************************************************************************/
-
-
-#ifndef __MIPS_H__
-#define __MIPS_H__
-
-#include "archdefs.h"
-
-
-/* ********************************************************************* */
-/* Module configuration */
-
-
-/* ********************************************************************* */
-/* Interface macro & data definition */
-
-#ifndef MSK
-#define MSK(n) ((1 << (n)) - 1)
-#endif
-
-/* CPU registers */
-#define SYS_CPUREG_ZERO 0
-#define SYS_CPUREG_AT 1
-#define SYS_CPUREG_V0 2
-#define SYS_CPUREG_V1 3
-#define SYS_CPUREG_A0 4
-#define SYS_CPUREG_A1 5
-#define SYS_CPUREG_A2 6
-#define SYS_CPUREG_A3 7
-#define SYS_CPUREG_T0 8
-#define SYS_CPUREG_T1 9
-#define SYS_CPUREG_T2 10
-#define SYS_CPUREG_T3 11
-#define SYS_CPUREG_T4 12
-#define SYS_CPUREG_T5 13
-#define SYS_CPUREG_T6 14
-#define SYS_CPUREG_T7 15
-#define SYS_CPUREG_S0 16
-#define SYS_CPUREG_S1 17
-#define SYS_CPUREG_S2 18
-#define SYS_CPUREG_S3 19
-#define SYS_CPUREG_S4 20
-#define SYS_CPUREG_S5 21
-#define SYS_CPUREG_S6 22
-#define SYS_CPUREG_S7 23
-#define SYS_CPUREG_T8 24
-#define SYS_CPUREG_T9 25
-#define SYS_CPUREG_K0 26
-#define SYS_CPUREG_K1 27
-#define SYS_CPUREG_GP 28
-#define SYS_CPUREG_SP 29
-#define SYS_CPUREG_S8 30
-#define SYS_CPUREG_FP SYS_CPUREG_S8
-#define SYS_CPUREG_RA 31
-
-
-/* CPU register fp ($30) has an alias s8 */
-#define s8 fp
-
-
-/* Aliases for System Control Coprocessor (CP0) registers */
-#define C0_INDEX C0_Index
-#define C0_RANDOM C0_Random
-#define C0_ENTRYLO0 C0_EntryLo0
-#define C0_ENTRYLO1 C0_EntryLo1
-#define C0_CONTEXT C0_Context
-#define C0_PAGEMASK C0_PageMask
-#define C0_WIRED C0_Wired
-#define C0_BADVADDR C0_BadVAddr
-#define C0_COUNT C0_Count
-#define C0_ENTRYHI C0_EntryHi
-#define C0_COMPARE C0_Compare
-#define C0_STATUS C0_Status
-#define C0_CAUSE C0_Cause
-
-#ifdef C0_PRID /* ArchDefs has an obsolete def. of C0_PRID */
-#undef C0_PRID
-#endif
-#define C0_PRID C0_PRId
-
-#define C0_CONFIG C0_Config
-#define C0_CONFIG1 C0_Config1
-#define C0_LLADDR C0_LLAddr
-#define C0_WATCHLO C0_WatchLo
-#define C0_WATCHHI C0_WatchHi
-#define C0_DEBUG C0_Debug
-#define C0_PERFCNT C0_PerfCnt
-#define C0_ERRCTL C0_ErrCtl
-#define C0_CACHEERR C0_CacheErr
-#define C0_TAGLO C0_TagLo
-#define C0_DATALO C0_DataLo
-#define C0_TAGHI C0_TagHi
-#define C0_DATAHI C0_DataHi
-#define C0_ERROREPC C0_ErrorEPC
-#if 0
-#define C0_DESAVE C0_DESAVE
-#define C0_EPC C0_EPC
-#define C0_DEPC C0_DEPC
-#endif
-
-/* System Control Coprocessor (CP0) registers select fields */
-#define C0_INDEX_SEL 0 /* TLB Index */
-#define C0_RANDOM_SEL 0 /* TLB Random */
-#define C0_TLBLO0_SEL 0 /* TLB EntryLo0 */
-#define C0_TLBLO1_SEL 0 /* TLB EntryLo1 */
-#define C0_CONTEXT_SEL 0 /* Context */
-#define C0_PAGEMASK_SEL 0 /* TLB PageMask */
-#define C0_WIRED_SEL 0 /* TLB Wired */
-#define C0_BADVADDR_SEL 0 /* Bad Virtual Address */
-#define C0_COUNT_SEL 0 /* Count */
-#define C0_ENTRYHI_SEL 0 /* TLB EntryHi */
-#define C0_COMPARE_SEL 0 /* Compare */
-#define C0_STATUS_SEL 0 /* Processor Status */
-#define C0_CAUSE_SEL 0 /* Exception Cause */
-#define C0_EPC_SEL 0 /* Exception PC */
-#define C0_PRID_SEL 0 /* Processor Revision Indentifier */
-#define C0_CONFIG_SEL 0 /* Config */
-#define C0_CONFIG1_SEL 1 /* Config1 */
-#define C0_LLADDR_SEL 0 /* LLAddr */
-#define C0_WATCHLO_SEL 0 /* WatchpointLo */
-#define C0_WATCHHI_SEL 0 /* WatchpointHi */
-#define C0_DEBUG_SEL 0 /* EJTAG Debug Register */
-#define C0_DEPC_SEL 0 /* Program counter at last EJTAG debug exception */
-#define C0_PERFCNT_SEL 0 /* Performance counter interface */
-#define C0_ERRCTL_SEL 0 /* ERRCTL */
-#define C0_CACHEERR_SEL 0 /* CacheErr */
-#define C0_TAGLO_SEL 0 /* TagLo */
-#define C0_DATALO_SEL 1 /* DataLo */
-#define C0_DTAGLO_SEL 2 /* DTagLo */
-#define C0_TAGHI_SEL 0 /* TagHi */
-#define C0_DATAHI_SEL 1 /* DataHi */
-#define C0_DTAGHI_SEL 2 /* DTagHi */
-#define C0_ERROREPC_SEL 0 /* ErrorEPC */
-#define C0_DESAVE_SEL 0 /* EJTAG dbg exc. save register */
-
-
-/* C0_CONFIG register encoding */
-
-#define C0_CONFIG_M_SHF S_ConfigMore
-#define C0_CONFIG_M_MSK M_ConfigMore
-#define C0_CONFIG_M_BIT C0_CONFIG_M_MSK
-
-#define C0_CONFIG_BE_SHF S_ConfigBE
-#define C0_CONFIG_BE_MSK M_ConfigBE
-#define C0_CONFIG_BE_BIT C0_CONFIG_BE_MSK
-
-#define C0_CONFIG_AT_SHF S_ConfigAT
-#define C0_CONFIG_AT_MSK M_ConfigAT
-#define C0_CONFIG_AT_MIPS32 K_ConfigAT_MIPS32
-#define C0_CONFIG_AT_MIPS64_32ADDR K_ConfigAT_MIPS64S
-#define C0_CONFIG_AT_MIPS64 K_ConfigAT_MIPS64
-
-#define C0_CONFIG_AR_SHF S_ConfigAR
-#define C0_CONFIG_AR_MSK M_ConfigAR
-
-#define C0_CONFIG_MT_SHF S_ConfigMT
-#define C0_CONFIG_MT_MSK M_ConfigMT
-#define C0_CONFIG_MT_NONE K_ConfigMT_NoMMU
-#define C0_CONFIG_MT_TLB K_ConfigMT_TLBMMU
-#define C0_CONFIG_MT_BAT K_ConfigMT_BATMMU
-#define C0_CONFIG_MT_NON_STD K_ConfigMT_FMMMU
-
-#define C0_CONFIG_K0_SHF S_ConfigK0
-#define C0_CONFIG_K0_MSK M_ConfigK0
-#define C0_CONFIG_K0_WTHRU_NOALLOC K_CacheAttrCWTnWA
-#define C0_CONFIG_K0_WTHRU_ALLOC K_CacheAttrCWTWA
-#define C0_CONFIG_K0_UNCACHED K_CacheAttrU
-#define C0_CONFIG_K0_NONCOHERENT K_CacheAttrCN
-#define C0_CONFIG_K0_COHERENTXCL K_CacheAttrCCE
-#define C0_CONFIG_K0_COHERENTXCLW K_CacheAttrCCS
-#define C0_CONFIG_K0_COHERENTUPD K_CacheAttrCCU
-#define C0_CONFIG_K0_UNCACHED_ACCEL K_CacheAttrUA
-
-
-/* WC field.
- *
- * This feature is present specifically to support configuration
- * testing of the core in a lead vehicle, and is not supported
- * in any other environment. Attempting to use this feature
- * outside of the scope of a lead vehicle is a violation of the
- * MIPS Architecture, and may cause unpredictable operation of
- * the processor.
- */
-#define C0_CONFIG_WC_SHF 19
-#define C0_CONFIG_WC_MSK (MSK(1) << C0_CONFIG_WC_SHF)
-#define C0_CONFIG_WC_BIT C0_CONFIG_WC_MSK
-
-
-/* C0_CONFIG1 register encoding */
-
-#define C0_CONFIG1_MMUSIZE_SHF S_Config1MMUSize
-#define C0_CONFIG1_MMUSIZE_MSK M_Config1MMUSize
-
-#define C0_CONFIG1_IS_SHF S_Config1IS
-#define C0_CONFIG1_IS_MSK M_Config1IS
-
-#define C0_CONFIG1_IL_SHF S_Config1IL
-#define C0_CONFIG1_IL_MSK M_Config1IL
-
-#define C0_CONFIG1_IA_SHF S_Config1IA
-#define C0_CONFIG1_IA_MSK M_Config1IA
-
-#define C0_CONFIG1_DS_SHF S_Config1DS
-#define C0_CONFIG1_DS_MSK M_Config1DS
-
-#define C0_CONFIG1_DL_SHF S_Config1DL
-#define C0_CONFIG1_DL_MSK M_Config1DL
-
-#define C0_CONFIG1_DA_SHF S_Config1DA
-#define C0_CONFIG1_DA_MSK M_Config1DA
-
-#define C0_CONFIG1_WR_SHF S_Config1WR
-#define C0_CONFIG1_WR_MSK M_Config1WR
-#define C0_CONFIG1_WR_BIT C0_CONFIG1_WR_MSK
-
-#define C0_CONFIG1_CA_SHF S_Config1CA
-#define C0_CONFIG1_CA_MSK M_Config1CA
-#define C0_CONFIG1_CA_BIT C0_CONFIG1_CA_MSK
-
-#define C0_CONFIG1_EP_SHF S_Config1EP
-#define C0_CONFIG1_EP_MSK M_Config1EP
-#define C0_CONFIG1_EP_BIT C0_CONFIG1_EP_MSK
-
-#define C0_CONFIG1_FP_SHF S_Config1FP
-#define C0_CONFIG1_FP_MSK M_Config1FP
-#define C0_CONFIG1_FP_BIT C0_CONFIG1_FP_MSK
-
-
-/* C0_STATUS register encoding */
-
-#define C0_STATUS_CU3_SHF S_StatusCU3
-#define C0_STATUS_CU3_MSK M_StatusCU3
-#define C0_STATUS_CU3_BIT C0_STATUS_CU3_MSK
-
-#define C0_STATUS_CU2_SHF S_StatusCU2
-#define C0_STATUS_CU2_MSK M_StatusCU2
-#define C0_STATUS_CU2_BIT C0_STATUS_CU2_MSK
-
-#define C0_STATUS_CU1_SHF S_StatusCU1
-#define C0_STATUS_CU1_MSK M_StatusCU1
-#define C0_STATUS_CU1_BIT C0_STATUS_CU1_MSK
-
-#define C0_STATUS_CU0_SHF S_StatusCU1
-#define C0_STATUS_CU0_MSK M_StatusCU1
-#define C0_STATUS_CU0_BIT C0_STATUS_CU0_MSK
-
-#define C0_STATUS_RP_SHF S_StatusRP
-#define C0_STATUS_RP_MSK M_StatusRP
-#define C0_STATUS_RP_BIT C0_STATUS_RP_MSK
-
-#define C0_STATUS_FR_SHF S_StatusFR
-#define C0_STATUS_FR_MSK M_StatusFR
-#define C0_STATUS_FR_BIT C0_STATUS_FR_MSK
-
-#define C0_STATUS_RE_SHF S_StatusRE
-#define C0_STATUS_RE_MSK M_StatusRE
-#define C0_STATUS_RE_BIT C0_STATUS_RE_MSK
-
-#define C0_STATUS_BEV_SHF S_StatusBEV
-#define C0_STATUS_BEV_MSK M_StatusBEV
-#define C0_STATUS_BEV_BIT C0_STATUS_BEV_MSK
-
-#define C0_STATUS_TS_SHF S_StatusTS
-#define C0_STATUS_TS_MSK M_StatusTS
-#define C0_STATUS_TS_BIT C0_STATUS_TS_MSK
-
-#define C0_STATUS_SR_SHF S_StatusSR
-#define C0_STATUS_SR_MSK M_StatusSR
-#define C0_STATUS_SR_BIT C0_STATUS_SR_MSK
-
-#define C0_STATUS_NMI_SHF S_StatusNMI
-#define C0_STATUS_NMI_MSK M_StatusNMI
-#define C0_STATUS_NMI_BIT C0_STATUS_NMI_MSK
-
-#define C0_STATUS_IM_SHF S_StatusIM
-#define C0_STATUS_IM_MSK M_StatusIM
-/* Note that the the definitions below indicate the interrupt number
- * rather than the mask.
- * (0..1 for SW interrupts and 2...7 for HW interrupts)
- */
-#define C0_STATUS_IM_SW0 (S_StatusIM0 - S_StatusIM)
-#define C0_STATUS_IM_SW1 (S_StatusIM1 - S_StatusIM)
-#define C0_STATUS_IM_HW0 (S_StatusIM2 - S_StatusIM)
-#define C0_STATUS_IM_HW1 (S_StatusIM3 - S_StatusIM)
-#define C0_STATUS_IM_HW2 (S_StatusIM4 - S_StatusIM)
-#define C0_STATUS_IM_HW3 (S_StatusIM5 - S_StatusIM)
-#define C0_STATUS_IM_HW4 (S_StatusIM6 - S_StatusIM)
-#define C0_STATUS_IM_HW5 (S_StatusIM7 - S_StatusIM)
-
-/* Max interrupt code */
-#define C0_STATUS_IM_MAX C0_STATUS_IM_HW5
-
-#define C0_STATUS_KSU_SHF S_StatusKSU
-#define C0_STATUS_KSU_MSK M_StatusKSU
-
-#define C0_STATUS_UM_SHF S_StatusUM
-#define C0_STATUS_UM_MSK M_StatusUM
-#define C0_STATUS_UM_BIT C0_STATUS_UM_MSK
-
-#define C0_STATUS_ERL_SHF S_StatusERL
-#define C0_STATUS_ERL_MSK M_StatusERL
-#define C0_STATUS_ERL_BIT C0_STATUS_ERL_MSK
-
-#define C0_STATUS_EXL_SHF S_StatusEXL
-#define C0_STATUS_EXL_MSK M_StatusEXL
-#define C0_STATUS_EXL_BIT C0_STATUS_EXL_MSK
-
-#define C0_STATUS_IE_SHF S_StatusIE
-#define C0_STATUS_IE_MSK M_StatusIE
-#define C0_STATUS_IE_BIT C0_STATUS_IE_MSK
-
-
-/* C0_PRID register encoding */
-
-#define C0_PRID_OPT_SHF S_PRIdCoOpt
-#define C0_PRID_OPT_MSK M_PRIdCoOpt
-
-#define C0_PRID_COMP_SHF S_PRIdCoID
-#define C0_PRID_COMP_MSK M_PRIdCoID
-#define C0_PRID_COMP_MIPS K_PRIdCoID_MIPS
-#define C0_PRID_COMP_NOT_MIPS32_64 0
-
-#define C0_PRID_PRID_SHF S_PRIdImp
-#define C0_PRID_PRID_MSK M_PRIdImp
-
-/* Jade */
-#define C0_PRID_PRID_4Kc K_PRIdImp_Jade
-#define C0_PRID_PRID_4Kmp K_PRIdImp_JadeLite /* 4Km/4Kp */
-/* Emerald */
-#define C0_PRID_PRID_4KEc K_PRIdImp_4KEc
-#define C0_PRID_PRID_4KEmp K_PRIdImp_4KEmp
-/* Coral */
-#define C0_PRID_PRID_4KSc K_PRIdImp_4KSc
-/* Opal */
-#define C0_PRID_PRID_5K K_PRIdImp_Opal
-/* Ruby */
-#define C0_PRID_PRID_20Kc K_PRIdImp_Ruby
-/* Other CPUs */
-#define C0_PRID_PRID_R4000 K_PRIdImp_R4000
-#define C0_PRID_PRID_RM52XX K_PRIdImp_R5200
-#define C0_PRID_PRID_RM70XX 0x27
-
-#define C0_PRID_REV_SHF S_PRIdRev
-#define C0_PRID_REV_MSK M_PRIdRev
-
-
-#define MIPS_4Kc ( (C0_PRID_COMP_MIPS << \
- C0_PRID_COMP_SHF) | \
- (C0_PRID_PRID_4Kc << \
- C0_PRID_PRID_SHF) \
- )
-
-#define MIPS_4Kmp ( (C0_PRID_COMP_MIPS << \
- C0_PRID_COMP_SHF) | \
- (C0_PRID_PRID_4Kmp << \
- C0_PRID_PRID_SHF) \
- )
-
-#define MIPS_4KEc ( (C0_PRID_COMP_MIPS << \
- C0_PRID_COMP_SHF) | \
- (C0_PRID_PRID_4KEc << \
- C0_PRID_PRID_SHF) \
- )
-
-#define MIPS_4KEmp ( (C0_PRID_COMP_MIPS << \
- C0_PRID_COMP_SHF) | \
- (C0_PRID_PRID_4KEmp << \
- C0_PRID_PRID_SHF) \
- )
-
-#define MIPS_4KSc ( (C0_PRID_COMP_MIPS << \
- C0_PRID_COMP_SHF) | \
- (C0_PRID_PRID_4KSc << \
- C0_PRID_PRID_SHF) \
- )
-
-#define MIPS_5K ( (C0_PRID_COMP_MIPS << \
- C0_PRID_COMP_SHF) | \
- (C0_PRID_PRID_5K << \
- C0_PRID_PRID_SHF) \
- )
-
-#define MIPS_20Kc ( (C0_PRID_COMP_MIPS << \
- C0_PRID_COMP_SHF) | \
- (C0_PRID_PRID_20Kc << \
- C0_PRID_PRID_SHF) \
- )
-
-#define QED_RM52XX ( (C0_PRID_COMP_NOT_MIPS32_64 << \
- C0_PRID_COMP_SHF) | \
- (C0_PRID_PRID_RM52XX << \
- C0_PRID_PRID_SHF) \
- )
-
-#define QED_RM70XX ( (C0_PRID_COMP_NOT_MIPS32_64 << \
- C0_PRID_COMP_SHF) | \
- (C0_PRID_PRID_RM70XX << \
- C0_PRID_PRID_SHF) \
- )
-
-/* C0_ENTRYHI register encoding */
-
-#define C0_ENTRYHI_VPN2_SHF S_EntryHiVPN2
-#define C0_ENTRYHI_VPN2_MSK M_EntryHiVPN2
-
-#define C0_ENTRYHI_ASID_SHF S_EntryHiASID
-#define C0_ENTRYHI_ASID_MSK M_EntryHiASID
-
-
-/* C0_CAUSE register encoding */
-
-#define C0_CAUSE_BD_SHF S_CauseBD
-#define C0_CAUSE_BD_MSK M_CauseBD
-#define C0_CAUSE_BD_BIT C0_CAUSE_BD_MSK
-
-#define C0_CAUSE_CE_SHF S_CauseCE
-#define C0_CAUSE_CE_MSK M_CauseCE
-
-#define C0_CAUSE_IV_SHF S_CauseIV
-#define C0_CAUSE_IV_MSK M_CauseIV
-#define C0_CAUSE_IV_BIT C0_CAUSE_IV_MSK
-
-#define C0_CAUSE_WP_SHF S_CauseWP
-#define C0_CAUSE_WP_MSK M_CauseWP
-#define C0_CAUSE_WP_BIT C0_CAUSE_WP_MSK
-
-#define C0_CAUSE_IP_SHF S_CauseIP
-#define C0_CAUSE_IP_MSK M_CauseIP
-
-#define C0_CAUSE_CODE_SHF S_CauseExcCode
-#define C0_CAUSE_CODE_MSK M_CauseExcCode
-
-#define C0_CAUSE_CODE_INT EX_INT
-#define C0_CAUSE_CODE_MOD EX_MOD
-#define C0_CAUSE_CODE_TLBL EX_TLBL
-#define C0_CAUSE_CODE_TLBS EX_TLBS
-#define C0_CAUSE_CODE_ADEL EX_ADEL
-#define C0_CAUSE_CODE_ADES EX_ADES
-#define C0_CAUSE_CODE_IBE EX_IBE
-#define C0_CAUSE_CODE_DBE EX_DBE
-#define C0_CAUSE_CODE_SYS EX_SYS
-#define C0_CAUSE_CODE_BP EX_BP
-#define C0_CAUSE_CODE_RI EX_RI
-#define C0_CAUSE_CODE_CPU EX_CPU
-#define C0_CAUSE_CODE_OV EX_OV
-#define C0_CAUSE_CODE_TR EV_TR
-#define C0_CAUSE_CODE_FPE EX_FPE
-#define C0_CAUSE_CODE_WATCH EX_WATCH
-#define C0_CAUSE_CODE_MCHECK EX_MCHECK
-
-/* Max cause code */
-#define C0_CAUSE_CODE_MAX EX_MCHECK
-
-
-/* C0_PAGEMASK register encoding */
-#define C0_PAGEMASK_MASK_SHF S_PageMaskMask
-#define C0_PAGEMASK_MASK_MSK M_PageMaskMask
-#define C0_PAGEMASK_MASK_4K K_PageMask4K
-#define C0_PAGEMASK_MASK_16K K_PageMask16K
-#define C0_PAGEMASK_MASK_64K K_PageMask64K
-#define C0_PAGEMASK_MASK_256K K_PageMask256K
-#define C0_PAGEMASK_MASK_1M K_PageMask1M
-#define C0_PAGEMASK_MASK_4M K_PageMask4M
-#define C0_PAGEMASK_MASK_16M K_PageMask16M
-
-
-/* C0_ENTRYLO0 register encoding (equiv. to C0_ENTRYLO1) */
-#define C0_ENTRYLO0_PFN_SHF S_EntryLoPFN
-#define C0_ENTRYLO0_PFN_MSK M_EntryLoPFN
-
-#define C0_ENTRYLO0_C_SHF S_EntryLoC
-#define C0_ENTRYLO0_C_MSK M_EntryLoC
-
-#define C0_ENTRYLO0_D_SHF S_EntryLoD
-#define C0_ENTRYLO0_D_MSK M_EntryLoD
-
-#define C0_ENTRYLO0_V_SHF S_EntryLoV
-#define C0_ENTRYLO0_V_MSK M_EntryLoV
-
-#define C0_ENTRYLO0_G_SHF S_EntryLoG
-#define C0_ENTRYLO0_G_MSK M_EntryLoG
-
-
-/* FPU (CP1) FIR register encoding */
-#define C1_FIR_3D_SHF S_FIRConfig3D
-#define C1_FIR_3D_MSK M_FIRConfig3D
-
-#define C1_FIR_PS_SHF S_FIRConfigPS
-#define C1_FIR_PS_MSK M_FIRConfigPS
-
-#define C1_FIR_D_SHF S_FIRConfigD
-#define C1_FIR_D_MSK M_FIRConfigD
-
-#define C1_FIR_S_SHF S_FIRConfigS
-#define C1_FIR_S_MSK M_FIRConfigS
-
-#define C1_FIR_PRID_SHF S_FIRImp
-#define C1_FIR_PRID_MSK M_FIRImp
-
-#define C1_FIR_REV_SHF S_FIRRev
-#define C1_FIR_REV_MSK M_FIRRev
-
-
-/* FPU (CP1) FCSR control/status register */
-#define C1_FCSR_FCC_SHF S_FCSRFCC7_1
-#define C1_FCSR_FCC_MSK M_FCSRFCC7_1
-
-#define C1_FCSR_FS_SHF S_FCSRFS
-#define C1_FCSR_FS_MSK M_FCSRFS
-#define C1_FCSR_FS_BIT C1_FCSR_FS_MSK
-
-#define C1_FCSR_CC_SHF S_FCSRCC
-#define C1_FCSR_CC_MSK M_FCSRCC
-
-#define C1_FCSR_IMPL_SHF S_FCSRImpl
-#define C1_FCSR_IMPL_MSK M_FCSRImpl
-
-#define C1_FCSR_EXC_SHF S_FCSRExc
-#define C1_FCSR_EXC_MSK M_FCSRExc
-
-#define C1_FCSR_ENA_SHF S_FCSREna
-#define C1_FCSR_ENA_MSK M_FCSREna
-
-#define C1_FCSR_FLG_SHF S_FCSRFlg
-#define C1_FCSR_FLG_MSK M_FCSRFlg
-
-#define C1_FCSR_RM_SHF S_FCSRRM
-#define C1_FCSR_RM_MSK M_FCSRRM
-#define C1_FCSR_RM_RN K_FCSRRM_RN
-#define C1_FCSR_RM_RZ K_FCSRRM_RZ
-#define C1_FCSR_RM_RP K_FCSRRM_RP
-#define C1_FCSR_RM_RM K_FCSRRM_RM
-
-
-
-/* cache operations */
-
-#define CACHE_OP( code, type ) ( ((code) << 2) | (type) )
-
-#define ICACHE_INDEX_INVALIDATE CACHE_OP(0x0, 0)
-#define ICACHE_INDEX_LOAD_TAG CACHE_OP(0x1, 0)
-#define ICACHE_INDEX_STORE_TAG CACHE_OP(0x2, 0)
-#define DCACHE_INDEX_WRITEBACK_INVALIDATE CACHE_OP(0x0, 1)
-#define DCACHE_INDEX_LOAD_TAG CACHE_OP(0x1, 1)
-#define DCACHE_INDEX_STORE_TAG CACHE_OP(0x2, 1)
-#define SCACHE_INDEX_STORE_TAG CACHE_OP(0x2, 3)
-
-#define ICACHE_ADDR_HIT_INVALIDATE CACHE_OP(0x4, 0)
-#define ICACHE_ADDR_FILL CACHE_OP(0x5, 0)
-#define ICACHE_ADDR_FETCH_LOCK CACHE_OP(0x7, 0)
-#define DCACHE_ADDR_HIT_INVALIDATE CACHE_OP(0x4, 1)
-#define DCACHE_ADDR_HIT_WRITEBACK_INVALIDATE CACHE_OP(0x5, 1)
-#define DCACHE_ADDR_HIT_WRITEBACK CACHE_OP(0x6, 1)
-#define DCACHE_ADDR_FETCH_LOCK CACHE_OP(0x7, 1)
-
-#define SCACHE_ADDR_HIT_WRITEBACK_INVALIDATE CACHE_OP(0x5, 3)
-
-/* Workaround for bug in early revisions of MIPS 4K family of
- * processors. Only relevant in early engineering samples of test
- * chips (RTL revision <= 3.0).
- *
- * The bug is described in :
- *
- * MIPS32 4K(tm) Processor Core Family RTL Errata Sheet
- * MIPS Document No: MD00003
- *
- * The bug is identified as : C16
- */
-#ifndef SET_MIPS0
-#define SET_MIPS0()
-#define SET_PUSH()
-#define SET_POP()
-#endif
-#define ICACHE_INVALIDATE_WORKAROUND(reg) \
-SET_PUSH(); \
-SET_MIPS0(); \
- la reg, 999f; \
-SET_POP(); \
- cache ICACHE_ADDR_FILL, 0(reg); \
- sync; \
- nop; nop; nop; nop; \
-999:
-
-/* EMPTY_PIPELINE is used for the below cache invalidation operations.
- * When $I is invalidated, there will still be operations in the
- * pipeline. We make sure these are 'nop' operations.
- */
-#define EMPTY_PIPELINE nop; nop; nop; nop
-
-#define ICACHE_INDEX_INVALIDATE_OP(index,scratch) \
- ICACHE_INVALIDATE_WORKAROUND(scratch); \
- cache ICACHE_INDEX_INVALIDATE, 0(index); \
- EMPTY_PIPELINE
-
-#define ICACHE_ADDR_INVALIDATE_OP(addr,scratch) \
- ICACHE_INVALIDATE_WORKAROUND(scratch); \
- cache ICACHE_ADDR_HIT_INVALIDATE, 0(addr); \
- EMPTY_PIPELINE
-
-/* The sync used in the below macro is there in case we are installing
- * a new instruction (flush $D, sync, invalidate $I sequence).
- */
-#define SCACHE_ADDR_HIT_WB_INVALIDATE_OP(reg) \
- cache SCACHE_ADDR_HIT_WRITEBACK_INVALIDATE, 0(reg); \
- sync; \
- EMPTY_PIPELINE
-
-/* Config1 cache field decoding */
-#define CACHE_CALC_SPW(s) ( 64 << (s) )
-#define CACHE_CALC_LS(l) ( (l) ? 2 << (l) : 0 )
-#define CACHE_CALC_BPW(l,s) ( CACHE_CALC_LS(l) * CACHE_CALC_SPW(s) )
-#define CACHE_CALC_ASSOC(a) ( (a) + 1 )
-
-
-/**** Move from/to Coprocessor operations ****/
-
-/* We use ssnop instead of nop operations in order to handle
- * superscalar CPUs.
- * The "sll zero,zero,1" notation is compiler backwards compatible.
- */
-#define SSNOP sll zero,zero,1
-#define NOPS SSNOP; SSNOP; SSNOP; SSNOP
-
-#define MFLO(dst) \
- mflo dst;\
- NOPS
-
-/* Workaround for bug in early revisions of MIPS 4K family of
- * processors.
- *
- * This concerns the nop instruction before mtc0 in the
- * MTC0 macro below.
- *
- * The bug is described in :
- *
- * MIPS32 4K(tm) Processor Core Family RTL Errata Sheet
- * MIPS Document No: MD00003
- *
- * The bug is identified as : C27
- */
-
-#define MTC0(src, dst) \
- nop; \
- mtc0 src,dst;\
- NOPS
-
-#define DMTC0(src, dst) \
- nop; \
- dmtc0 src,dst;\
- NOPS
-
-#define MFC0(dst, src) \
- mfc0 dst,src;\
- NOPS
-
-#define DMFC0(dst, src) \
- dmfc0 dst,src;\
- NOPS
-
-#define MFC0_SEL_OPCODE(dst, src, sel)\
- .##word (0x40000000 | ((dst)<<16) | ((src)<<11) | (sel));\
- NOPS
-
-#define MTC0_SEL_OPCODE(dst, src, sel)\
- .##word (0x40800000 | ((dst)<<16) | ((src)<<11) | (sel));\
- NOPS
-
-#define LDC1(dst, src, offs)\
- .##word (0xd4000000 | ((src)<<21) | ((dst)<<16) | (offs))
-
-#define SDC1(src, dst, offs)\
- .##word (0xf4000000 | ((dst)<<21) | ((src)<<16) | (offs))
-
-
-/* Instruction opcode fields */
-#define OPC_SPECIAL 0x0
-#define OPC_REGIM 0x1
-#define OPC_J 0x2
-#define OPC_JAL 0x3
-#define OPC_BEQ 0x4
-#define OPC_BNE 0x5
-#define OPC_BLEZ 0x6
-#define OPC_BGTZ 0x7
-#define OPC_COP1 0x11
-#define OPC_JALX 0x1D
-#define OPC_BEQL 0x14
-#define OPC_BNEL 0x15
-#define OPC_BLEZL 0x16
-#define OPC_BGTZL 0x17
-
-/* Instruction function fields */
-#define FUNC_JR 0x8
-#define FUNC_JALR 0x9
-
-/* Instruction rt fields */
-#define RT_BLTZ 0x0
-#define RT_BGEZ 0x1
-#define RT_BLTZL 0x2
-#define RT_BGEZL 0x3
-#define RT_BLTZAL 0x10
-#define RT_BGEZAL 0x11
-#define RT_BLTZALL 0x12
-#define RT_BGEZALL 0x13
-
-/* Instruction rs fields */
-#define RS_BC1 0x08
-
-/* Access macros for instruction fields */
-#define MIPS_OPCODE( instr) ((instr) >> 26)
-#define MIPS_FUNCTION(instr) ((instr) & MSK(6))
-#define MIPS_RT(instr) (((instr) >> 16) & MSK(5))
-#define MIPS_RS(instr) (((instr) >> 21) & MSK(5))
-#define MIPS_OFFSET(instr) ((instr) & 0xFFFF)
-#define MIPS_TARGET(instr) ((instr) & MSK(26))
-
-/* Instructions */
-#define OPCODE_DERET 0x4200001f
-#define OPCODE_BREAK 0x0005000d
-#define OPCODE_NOP 0
-#define OPCODE_JUMP(addr) ( (OPC_J << 26) | (((addr) >> 2) & 0x3FFFFFF) )
-
-#define DERET .##word OPCODE_DERET
-
-/* MIPS16e opcodes and instruction field access macros */
-
-#define MIPS16E_OPCODE(inst) (((inst) >> 11) & 0x1f)
-#define MIPS16E_I8_FUNCTION(inst) (((inst) >> 8) & 0x7)
-#define MIPS16E_X(inst) (((inst) >> 26) & 0x1)
-#define MIPS16E_RR_FUNCTION(inst) (((inst) >> 0) & 0x1f)
-#define MIPS16E_RY(inst) (((inst) >> 5) & 0x3)
-#define MIPS16E_OPC_EXTEND 0x1e
-#define MIPS16E_OPC_JAL_X 0x03
-#define MIPS16E_OPC_B 0x02
-#define MIPS16E_OPC_BEQZ 0x04
-#define MIPS16E_OPC_BNEZ 0x05
-#define MIPS16E_OPC_I8 0x0c
-#define MIPS16E_I8_FUNC_BTEQZ 0x00
-#define MIPS16E_I8_FUNC_BTNEZ 0x01
-#define MIPS16E_X_JALX 0x01
-#define MIPS16E_OPC_RR 0x1d
-#define MIPS16E_RR_FUNC_JALRC 0x00
-#define MIPS16E_RR_RY_JRRX 0x00
-#define MIPS16E_RR_RY_JRRA 0x01
-#define MIPS16E_RR_RY_JALR 0x02
-#define MIPS16E_RR_RY_JRCRX 0x04
-#define MIPS16E_RR_RY_JRCRA 0x05
-#define MIPS16E_RR_RY_JALRC 0x06
-
-#define MIPS16E_OPCODE_BREAK 0xE805
-#define MIPS16E_OPCODE_NOP 0x6500
-
-/* MIPS reset vector */
-#define MIPS_RESET_VECTOR 0x1fc00000
-
-/* Clock periods per count register increment */
-#define MIPS4K_COUNT_CLK_PER_CYCLE 2
-#define MIPS5K_COUNT_CLK_PER_CYCLE 2
-#define MIPS20Kc_COUNT_CLK_PER_CYCLE 1
-
-
-/**** MIPS 4K/5K families specific fields of CONFIG register ****/
-
-#define C0_CONFIG_MIPS4K5K_K23_SHF S_ConfigK23
-#define C0_CONFIG_MIPS4K5K_K23_MSK (MSK(3) << C0_CONFIG_MIPS4K5K_K23_SHF)
-
-#define C0_CONFIG_MIPS4K5K_KU_SHF S_ConfigKU
-#define C0_CONFIG_MIPS4K5K_KU_MSK (MSK(3) << C0_CONFIG_MIPS4K5K_KU_SHF)
-
-
-/**** MIPS 20Kc specific fields of CONFIG register ****/
-
-#define C0_CONFIG_MIPS20KC_EC_SHF 28
-#define C0_CONFIG_MIPS20KC_EC_MSK (MSK(3) << C0_CONFIG_MIPS20KC_EC_SHF)
-
-#define C0_CONFIG_MIPS20KC_DD_SHF 27
-#define C0_CONFIG_MIPS20KC_DD_MSK (MSK(1) << C0_CONFIG_MIPS20KC_DD_SHF)
-#define C0_CONFIG_MIPS20KC_DD_BIT C0_CONFIG_MIPS20KC_DD_MSK
-
-#define C0_CONFIG_MIPS20KC_LP_SHF 26
-#define C0_CONFIG_MIPS20KC_LP_MSK (MSK(1) << C0_CONFIG_MIPS20KC_LP_SHF)
-#define C0_CONFIG_MIPS20KC_LP_BIT C0_CONFIG_MIPS20KC_LP_MSK
-
-#define C0_CONFIG_MIPS20KC_SP_SHF 25
-#define C0_CONFIG_MIPS20KC_SP_MSK (MSK(1) << C0_CONFIG_MIPS20KC_SP_SHF)
-#define C0_CONFIG_MIPS20KC_SP_BIT C0_CONFIG_MIPS20KC_SP_MSK
-
-#define C0_CONFIG_MIPS20KC_TI_SHF 24
-#define C0_CONFIG_MIPS20KC_TI_MSK (MSK(1) << C0_CONFIG_MIPS20KC_TI_SHF)
-#define C0_CONFIG_MIPS20KC_TI_BIT C0_CONFIG_MIPS20KC_TI_MSK
-
-
-/* ********************************************************************* */
-/* Interface function definition */
-
-
-/* ********************************************************************* */
-
-#endif /* #ifndef __MIPS_H__ */
diff --git a/sdk-modifications/include/mipsregs.h b/sdk-modifications/include/mipsregs.h
deleted file mode 100755
index 5eaac44..0000000
--- a/sdk-modifications/include/mipsregs.h
+++ /dev/null
@@ -1,985 +0,0 @@
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 1994, 1995, 1996, 1997, 2000, 2001 by Ralf Baechle
- * Copyright (C) 2000 Silicon Graphics, Inc.
- * Modified for further R[236]000 support by Paul M. Antoine, 1996.
- * Kevin D. Kissell, kevink@mips.com and Carsten Langgaard, carstenl@mips.com
- * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
- * Copyright (C) 2003 Maciej W. Rozycki
- */
-#ifndef _ASM_MIPSREGS_H
-#define _ASM_MIPSREGS_H
-
-#include <linux/config.h>
-#include <linux/linkage.h>
-
-/*
- * The following macros are especially useful for __asm__
- * inline assembler.
- */
-#ifndef __STR
-#define __STR(x) #x
-#endif
-#ifndef STR
-#define STR(x) __STR(x)
-#endif
-
-/*
- * Configure language
- */
-#ifdef __ASSEMBLY__
-#define _ULCAST_
-#else
-#define _ULCAST_ (unsigned long)
-#endif
-
-/*
- * Coprocessor 0 register names
- */
-#define CP0_INDEX $0
-#define CP0_RANDOM $1
-#define CP0_ENTRYLO0 $2
-#define CP0_ENTRYLO1 $3
-#define CP0_CONF $3
-#define CP0_CONTEXT $4
-#define CP0_PAGEMASK $5
-#define CP0_WIRED $6
-#define CP0_INFO $7
-#define CP0_BADVADDR $8
-#define CP0_COUNT $9
-#define CP0_ENTRYHI $10
-#define CP0_COMPARE $11
-#define CP0_STATUS $12
-#define CP0_CAUSE $13
-#define CP0_EPC $14
-#define CP0_PRID $15
-#define CP0_CONFIG $16
-#define CP0_LLADDR $17
-#define CP0_WATCHLO $18
-#define CP0_WATCHHI $19
-#define CP0_XCONTEXT $20
-#define CP0_FRAMEMASK $21
-#define CP0_DIAGNOSTIC $22
-#define CP0_DEBUG $23
-#define CP0_DEPC $24
-#define CP0_PERFORMANCE $25
-#define CP0_ECC $26
-#define CP0_CACHEERR $27
-#define CP0_TAGLO $28
-#define CP0_TAGHI $29
-#define CP0_ERROREPC $30
-#define CP0_DESAVE $31
-
-/*
- * R4640/R4650 cp0 register names. These registers are listed
- * here only for completeness; without MMU these CPUs are not useable
- * by Linux. A future ELKS port might take make Linux run on them
- * though ...
- */
-#define CP0_IBASE $0
-#define CP0_IBOUND $1
-#define CP0_DBASE $2
-#define CP0_DBOUND $3
-#define CP0_CALG $17
-#define CP0_IWATCH $18
-#define CP0_DWATCH $19
-
-/*
- * Coprocessor 0 Set 1 register names
- */
-#define CP0_S1_DERRADDR0 $26
-#define CP0_S1_DERRADDR1 $27
-#define CP0_S1_INTCONTROL $20
-
-/*
- * TX39 Series
- */
-#define CP0_TX39_CACHE $7
-
-/*
- * Coprocessor 1 (FPU) register names
- */
-#define CP1_REVISION $0
-#define CP1_STATUS $31
-
-/*
- * FPU Status Register Values
- */
-/*
- * Status Register Values
- */
-
-#define FPU_CSR_FLUSH 0x01000000 /* flush denormalised results to 0 */
-#define FPU_CSR_COND 0x00800000 /* $fcc0 */
-#define FPU_CSR_COND0 0x00800000 /* $fcc0 */
-#define FPU_CSR_COND1 0x02000000 /* $fcc1 */
-#define FPU_CSR_COND2 0x04000000 /* $fcc2 */
-#define FPU_CSR_COND3 0x08000000 /* $fcc3 */
-#define FPU_CSR_COND4 0x10000000 /* $fcc4 */
-#define FPU_CSR_COND5 0x20000000 /* $fcc5 */
-#define FPU_CSR_COND6 0x40000000 /* $fcc6 */
-#define FPU_CSR_COND7 0x80000000 /* $fcc7 */
-
-/*
- * X the exception cause indicator
- * E the exception enable
- * S the sticky/flag bit
-*/
-#define FPU_CSR_ALL_X 0x0003f000
-#define FPU_CSR_UNI_X 0x00020000
-#define FPU_CSR_INV_X 0x00010000
-#define FPU_CSR_DIV_X 0x00008000
-#define FPU_CSR_OVF_X 0x00004000
-#define FPU_CSR_UDF_X 0x00002000
-#define FPU_CSR_INE_X 0x00001000
-
-#define FPU_CSR_ALL_E 0x00000f80
-#define FPU_CSR_INV_E 0x00000800
-#define FPU_CSR_DIV_E 0x00000400
-#define FPU_CSR_OVF_E 0x00000200
-#define FPU_CSR_UDF_E 0x00000100
-#define FPU_CSR_INE_E 0x00000080
-
-#define FPU_CSR_ALL_S 0x0000007c
-#define FPU_CSR_INV_S 0x00000040
-#define FPU_CSR_DIV_S 0x00000020
-#define FPU_CSR_OVF_S 0x00000010
-#define FPU_CSR_UDF_S 0x00000008
-#define FPU_CSR_INE_S 0x00000004
-
-/* rounding mode */
-#define FPU_CSR_RN 0x0 /* nearest */
-#define FPU_CSR_RZ 0x1 /* towards zero */
-#define FPU_CSR_RU 0x2 /* towards +Infinity */
-#define FPU_CSR_RD 0x3 /* towards -Infinity */
-
-
-/*
- * Values for PageMask register
- */
-#ifdef CONFIG_CPU_VR41XX
-
-/* Why doesn't stupidity hurt ... */
-
-#define PM_1K 0x00000000
-#define PM_4K 0x00001800
-#define PM_16K 0x00007800
-#define PM_64K 0x0001f800
-#define PM_256K 0x0007f800
-
-#else
-
-#define PM_4K 0x00000000
-#define PM_16K 0x00006000
-#define PM_64K 0x0001e000
-#define PM_256K 0x0007e000
-#define PM_1M 0x001fe000
-#define PM_4M 0x007fe000
-#define PM_16M 0x01ffe000
-#define PM_64M 0x07ffe000
-#define PM_256M 0x1fffe000
-
-#endif
-
-/*
- * Values used for computation of new tlb entries
- */
-#define PL_4K 12
-#define PL_16K 14
-#define PL_64K 16
-#define PL_256K 18
-#define PL_1M 20
-#define PL_4M 22
-#define PL_16M 24
-#define PL_64M 26
-#define PL_256M 28
-
-/*
- * R4x00 interrupt enable / cause bits
- */
-#define IE_SW0 (_ULCAST_(1) << 8)
-#define IE_SW1 (_ULCAST_(1) << 9)
-#define IE_IRQ0 (_ULCAST_(1) << 10)
-#define IE_IRQ1 (_ULCAST_(1) << 11)
-#define IE_IRQ2 (_ULCAST_(1) << 12)
-#define IE_IRQ3 (_ULCAST_(1) << 13)
-#define IE_IRQ4 (_ULCAST_(1) << 14)
-#define IE_IRQ5 (_ULCAST_(1) << 15)
-
-/*
- * R4x00 interrupt cause bits
- */
-#define C_SW0 (_ULCAST_(1) << 8)
-#define C_SW1 (_ULCAST_(1) << 9)
-#define C_IRQ0 (_ULCAST_(1) << 10)
-#define C_IRQ1 (_ULCAST_(1) << 11)
-#define C_IRQ2 (_ULCAST_(1) << 12)
-#define C_IRQ3 (_ULCAST_(1) << 13)
-#define C_IRQ4 (_ULCAST_(1) << 14)
-#define C_IRQ5 (_ULCAST_(1) << 15)
-
-/*
- * Bitfields in the R4xx0 cp0 status register
- */
-#define ST0_IE 0x00000001
-#define ST0_EXL 0x00000002
-#define ST0_ERL 0x00000004
-#define ST0_KSU 0x00000018
-# define KSU_USER 0x00000010
-# define KSU_SUPERVISOR 0x00000008
-# define KSU_KERNEL 0x00000000
-#define ST0_UX 0x00000020
-#define ST0_SX 0x00000040
-#define ST0_KX 0x00000080
-#define ST0_DE 0x00010000
-#define ST0_CE 0x00020000
-
-/*
- * Bitfields in the R[23]000 cp0 status register.
- */
-#define ST0_IEC 0x00000001
-#define ST0_KUC 0x00000002
-#define ST0_IEP 0x00000004
-#define ST0_KUP 0x00000008
-#define ST0_IEO 0x00000010
-#define ST0_KUO 0x00000020
-/* bits 6 & 7 are reserved on R[23]000 */
-#define ST0_ISC 0x00010000
-#define ST0_SWC 0x00020000
-#define ST0_CM 0x00080000
-
-/*
- * Bits specific to the R4640/R4650
- */
-#define ST0_UM (_ULCAST_(1) << 4)
-#define ST0_IL (_ULCAST_(1) << 23)
-#define ST0_DL (_ULCAST_(1) << 24)
-
-/*
- * Bitfields in the TX39 family CP0 Configuration Register 3
- */
-#define TX39_CONF_ICS_SHIFT 19
-#define TX39_CONF_ICS_MASK 0x00380000
-#define TX39_CONF_ICS_1KB 0x00000000
-#define TX39_CONF_ICS_2KB 0x00080000
-#define TX39_CONF_ICS_4KB 0x00100000
-#define TX39_CONF_ICS_8KB 0x00180000
-#define TX39_CONF_ICS_16KB 0x00200000
-
-#define TX39_CONF_DCS_SHIFT 16
-#define TX39_CONF_DCS_MASK 0x00070000
-#define TX39_CONF_DCS_1KB 0x00000000
-#define TX39_CONF_DCS_2KB 0x00010000
-#define TX39_CONF_DCS_4KB 0x00020000
-#define TX39_CONF_DCS_8KB 0x00030000
-#define TX39_CONF_DCS_16KB 0x00040000
-
-#define TX39_CONF_CWFON 0x00004000
-#define TX39_CONF_WBON 0x00002000
-#define TX39_CONF_RF_SHIFT 10
-#define TX39_CONF_RF_MASK 0x00000c00
-#define TX39_CONF_DOZE 0x00000200
-#define TX39_CONF_HALT 0x00000100
-#define TX39_CONF_LOCK 0x00000080
-#define TX39_CONF_ICE 0x00000020
-#define TX39_CONF_DCE 0x00000010
-#define TX39_CONF_IRSIZE_SHIFT 2
-#define TX39_CONF_IRSIZE_MASK 0x0000000c
-#define TX39_CONF_DRSIZE_SHIFT 0
-#define TX39_CONF_DRSIZE_MASK 0x00000003
-
-/*
- * Status register bits available in all MIPS CPUs.
- */
-#define ST0_IM 0x0000ff00
-#define STATUSB_IP0 8
-#define STATUSF_IP0 (_ULCAST_(1) << 8)
-#define STATUSB_IP1 9
-#define STATUSF_IP1 (_ULCAST_(1) << 9)
-#define STATUSB_IP2 10
-#define STATUSF_IP2 (_ULCAST_(1) << 10)
-#define STATUSB_IP3 11
-#define STATUSF_IP3 (_ULCAST_(1) << 11)
-#define STATUSB_IP4 12
-#define STATUSF_IP4 (_ULCAST_(1) << 12)
-#define STATUSB_IP5 13
-#define STATUSF_IP5 (_ULCAST_(1) << 13)
-#define STATUSB_IP6 14
-#define STATUSF_IP6 (_ULCAST_(1) << 14)
-#define STATUSB_IP7 15
-#define STATUSF_IP7 (_ULCAST_(1) << 15)
-#define STATUSB_IP8 0
-#define STATUSF_IP8 (_ULCAST_(1) << 0)
-#define STATUSB_IP9 1
-#define STATUSF_IP9 (_ULCAST_(1) << 1)
-#define STATUSB_IP10 2
-#define STATUSF_IP10 (_ULCAST_(1) << 2)
-#define STATUSB_IP11 3
-#define STATUSF_IP11 (_ULCAST_(1) << 3)
-#define STATUSB_IP12 4
-#define STATUSF_IP12 (_ULCAST_(1) << 4)
-#define STATUSB_IP13 5
-#define STATUSF_IP13 (_ULCAST_(1) << 5)
-#define STATUSB_IP14 6
-#define STATUSF_IP14 (_ULCAST_(1) << 6)
-#define STATUSB_IP15 7
-#define STATUSF_IP15 (_ULCAST_(1) << 7)
-#define ST0_CH 0x00040000
-#define ST0_SR 0x00100000
-#define ST0_TS 0x00200000
-#define ST0_BEV 0x00400000
-#define ST0_RE 0x02000000
-#define ST0_FR 0x04000000
-#define ST0_CU 0xf0000000
-#define ST0_CU0 0x10000000
-#define ST0_CU1 0x20000000
-#define ST0_CU2 0x40000000
-#define ST0_CU3 0x80000000
-#define ST0_XX 0x80000000 /* MIPS IV naming */
-
-/*
- * Bitfields and bit numbers in the coprocessor 0 cause register.
- *
- * Refer to your MIPS R4xx0 manual, chapter 5 for explanation.
- */
-#define CAUSEB_EXCCODE 2
-#define CAUSEF_EXCCODE (_ULCAST_(31) << 2)
-#define CAUSEB_IP 8
-#define CAUSEF_IP (_ULCAST_(255) << 8)
-#define CAUSEB_IP0 8
-#define CAUSEF_IP0 (_ULCAST_(1) << 8)
-#define CAUSEB_IP1 9
-#define CAUSEF_IP1 (_ULCAST_(1) << 9)
-#define CAUSEB_IP2 10
-#define CAUSEF_IP2 (_ULCAST_(1) << 10)
-#define CAUSEB_IP3 11
-#define CAUSEF_IP3 (_ULCAST_(1) << 11)
-#define CAUSEB_IP4 12
-#define CAUSEF_IP4 (_ULCAST_(1) << 12)
-#define CAUSEB_IP5 13
-#define CAUSEF_IP5 (_ULCAST_(1) << 13)
-#define CAUSEB_IP6 14
-#define CAUSEF_IP6 (_ULCAST_(1) << 14)
-#define CAUSEB_IP7 15
-#define CAUSEF_IP7 (_ULCAST_(1) << 15)
-#define CAUSEB_IV 23
-#define CAUSEF_IV (_ULCAST_(1) << 23)
-#define CAUSEB_CE 28
-#define CAUSEF_CE (_ULCAST_(3) << 28)
-#define CAUSEB_BD 31
-#define CAUSEF_BD (_ULCAST_(1) << 31)
-
-/*
- * Bits in the coprocessor 0 config register.
- */
-/* Generic bits. */
-#define CONF_CM_CACHABLE_NO_WA 0
-#define CONF_CM_CACHABLE_WA 1
-#define CONF_CM_UNCACHED 2
-#define CONF_CM_CACHABLE_NONCOHERENT 3
-#define CONF_CM_CACHABLE_CE 4
-#define CONF_CM_CACHABLE_COW 5
-#define CONF_CM_CACHABLE_CUW 6
-#define CONF_CM_CACHABLE_ACCELERATED 7
-#define CONF_CM_CMASK 7
-#define CONF_BE (_ULCAST_(1) << 15)
-
-/* Bits common to various processors. */
-#define CONF_CU (_ULCAST_(1) << 3)
-#define CONF_DB (_ULCAST_(1) << 4)
-#define CONF_IB (_ULCAST_(1) << 5)
-#define CONF_DC (_ULCAST_(7) << 6)
-#define CONF_IC (_ULCAST_(7) << 9)
-#define CONF_EB (_ULCAST_(1) << 13)
-#define CONF_EM (_ULCAST_(1) << 14)
-#define CONF_SM (_ULCAST_(1) << 16)
-#define CONF_SC (_ULCAST_(1) << 17)
-#define CONF_EW (_ULCAST_(3) << 18)
-#define CONF_EP (_ULCAST_(15)<< 24)
-#define CONF_EC (_ULCAST_(7) << 28)
-#define CONF_CM (_ULCAST_(1) << 31)
-
-/* Bits specific to the R4xx0. */
-#define R4K_CONF_SW (_ULCAST_(1) << 20)
-#define R4K_CONF_SS (_ULCAST_(1) << 21)
-#define R4K_CONF_SB (_ULCAST_(3) << 22)
-
-/* Bits specific to the R5000. */
-#define R5K_CONF_SE (_ULCAST_(1) << 12)
-#define R5K_CONF_SS (_ULCAST_(3) << 20)
-
-/* Bits specific to the R10000. */
-#define R10K_CONF_DN (_ULCAST_(3) << 3)
-#define R10K_CONF_CT (_ULCAST_(1) << 5)
-#define R10K_CONF_PE (_ULCAST_(1) << 6)
-#define R10K_CONF_PM (_ULCAST_(3) << 7)
-#define R10K_CONF_EC (_ULCAST_(15)<< 9)
-#define R10K_CONF_SB (_ULCAST_(1) << 13)
-#define R10K_CONF_SK (_ULCAST_(1) << 14)
-#define R10K_CONF_SS (_ULCAST_(7) << 16)
-#define R10K_CONF_SC (_ULCAST_(7) << 19)
-#define R10K_CONF_DC (_ULCAST_(7) << 26)
-#define R10K_CONF_IC (_ULCAST_(7) << 29)
-
-/* Bits specific to the VR41xx. */
-#define VR41_CONF_CS (_ULCAST_(1) << 12)
-#define VR41_CONF_M16 (_ULCAST_(1) << 20)
-#define VR41_CONF_AD (_ULCAST_(1) << 23)
-
-/* Bits specific to the R30xx. */
-#define R30XX_CONF_FDM (_ULCAST_(1) << 19)
-#define R30XX_CONF_REV (_ULCAST_(1) << 22)
-#define R30XX_CONF_AC (_ULCAST_(1) << 23)
-#define R30XX_CONF_RF (_ULCAST_(1) << 24)
-#define R30XX_CONF_HALT (_ULCAST_(1) << 25)
-#define R30XX_CONF_FPINT (_ULCAST_(7) << 26)
-#define R30XX_CONF_DBR (_ULCAST_(1) << 29)
-#define R30XX_CONF_SB (_ULCAST_(1) << 30)
-#define R30XX_CONF_LOCK (_ULCAST_(1) << 31)
-
-/* Bits specific to the TX49. */
-#define TX49_CONF_DC (_ULCAST_(1) << 16)
-#define TX49_CONF_IC (_ULCAST_(1) << 17) /* conflict with CONF_SC */
-#define TX49_CONF_HALT (_ULCAST_(1) << 18)
-#define TX49_CONF_CWFON (_ULCAST_(1) << 27)
-
-/* Bits specific to the MIPS32/64 PRA. */
-#define MIPS_CONF_MT (_ULCAST_(7) << 7)
-#define MIPS_CONF_AR (_ULCAST_(7) << 10)
-#define MIPS_CONF_AT (_ULCAST_(3) << 13)
-#define MIPS_CONF_M (_ULCAST_(1) << 31)
-
-/*
- * R10000 performance counter definitions.
- *
- * FIXME: The R10000 performance counter opens a nice way to implement CPU
- * time accounting with a precission of one cycle. I don't have
- * R10000 silicon but just a manual, so ...
- */
-
-/*
- * Events counted by counter #0
- */
-#define CE0_CYCLES 0
-#define CE0_INSN_ISSUED 1
-#define CE0_LPSC_ISSUED 2
-#define CE0_S_ISSUED 3
-#define CE0_SC_ISSUED 4
-#define CE0_SC_FAILED 5
-#define CE0_BRANCH_DECODED 6
-#define CE0_QW_WB_SECONDARY 7
-#define CE0_CORRECTED_ECC_ERRORS 8
-#define CE0_ICACHE_MISSES 9
-#define CE0_SCACHE_I_MISSES 10
-#define CE0_SCACHE_I_WAY_MISSPREDICTED 11
-#define CE0_EXT_INTERVENTIONS_REQ 12
-#define CE0_EXT_INVALIDATE_REQ 13
-#define CE0_VIRTUAL_COHERENCY_COND 14
-#define CE0_INSN_GRADUATED 15
-
-/*
- * Events counted by counter #1
- */
-#define CE1_CYCLES 0
-#define CE1_INSN_GRADUATED 1
-#define CE1_LPSC_GRADUATED 2
-#define CE1_S_GRADUATED 3
-#define CE1_SC_GRADUATED 4
-#define CE1_FP_INSN_GRADUATED 5
-#define CE1_QW_WB_PRIMARY 6
-#define CE1_TLB_REFILL 7
-#define CE1_BRANCH_MISSPREDICTED 8
-#define CE1_DCACHE_MISS 9
-#define CE1_SCACHE_D_MISSES 10
-#define CE1_SCACHE_D_WAY_MISSPREDICTED 11
-#define CE1_EXT_INTERVENTION_HITS 12
-#define CE1_EXT_INVALIDATE_REQ 13
-#define CE1_SP_HINT_TO_CEXCL_SC_BLOCKS 14
-#define CE1_SP_HINT_TO_SHARED_SC_BLOCKS 15
-
-/*
- * These flags define in which priviledge mode the counters count events
- */
-#define CEB_USER 8 /* Count events in user mode, EXL = ERL = 0 */
-#define CEB_SUPERVISOR 4 /* Count events in supvervisor mode EXL = ERL = 0 */
-#define CEB_KERNEL 2 /* Count events in kernel mode EXL = ERL = 0 */
-#define CEB_EXL 1 /* Count events with EXL = 1, ERL = 0 */
-
-#ifndef __ASSEMBLY__
-
-#define CAUSE_EXCCODE(x) ((CAUSEF_EXCCODE & (x->cp0_cause)) >> CAUSEB_EXCCODE)
-#define CAUSE_EPC(x) (x->cp0_epc + (((x->cp0_cause & CAUSEF_BD) >> CAUSEB_BD) << 2))
-
-/*
- * Functions to access the r10k performance counter and control registers
- */
-#define read_r10k_perf_cntr(counter) \
-({ unsigned int __res; \
- __asm__ __volatile__( \
- "mfpc\t%0, "STR(counter) \
- : "=r" (__res)); \
- __res;})
-
-#define write_r10k_perf_cntr(counter,val) \
- __asm__ __volatile__( \
- "mtpc\t%0, "STR(counter) \
- : : "r" (val));
-
-#define read_r10k_perf_cntl(counter) \
-({ unsigned int __res; \
- __asm__ __volatile__( \
- "mfps\t%0, "STR(counter) \
- : "=r" (__res)); \
- __res;})
-
-#define write_r10k_perf_cntl(counter,val) \
- __asm__ __volatile__( \
- "mtps\t%0, "STR(counter) \
- : : "r" (val));
-
-/*
- * Macros to access the system control coprocessor
- */
-
-#define __read_32bit_c0_register(source, sel) \
-({ int __res; \
- if (sel == 0) \
- __asm__ __volatile__( \
- "mfc0\t%0, " #source "\n\t" \
- : "=r" (__res)); \
- else \
- __asm__ __volatile__( \
- ".set\tmips32\n\t" \
- "mfc0\t%0, " #source ", " #sel "\n\t" \
- ".set\tmips0\n\t" \
- : "=r" (__res)); \
- __res; \
-})
-
-#define __read_64bit_c0_register(source, sel) \
-({ unsigned long __res; \
- if (sel == 0) \
- __asm__ __volatile__( \
- ".set\tmips3\n\t" \
- "dmfc0\t%0, " #source "\n\t" \
- ".set\tmips0" \
- : "=r" (__res)); \
- else \
- __asm__ __volatile__( \
- ".set\tmips64\n\t" \
- "dmfc0\t%0, " #source ", " #sel "\n\t" \
- ".set\tmips0" \
- : "=r" (__res)); \
- __res; \
-})
-
-#define __write_32bit_c0_register(register, sel, value) \
-do { \
- if (sel == 0) \
- __asm__ __volatile__( \
- "mtc0\t%z0, " #register "\n\t" \
- : : "Jr" (value)); \
- else \
- __asm__ __volatile__( \
- ".set\tmips32\n\t" \
- "mtc0\t%z0, " #register ", " #sel "\n\t" \
- ".set\tmips0" \
- : : "Jr" (value)); \
-} while (0)
-
-#define __write_64bit_c0_register(register, sel, value) \
-do { \
- if (sel == 0) \
- __asm__ __volatile__( \
- ".set\tmips3\n\t" \
- "dmtc0\t%z0, " #register "\n\t" \
- ".set\tmips0" \
- : : "Jr" (value)); \
- else \
- __asm__ __volatile__( \
- ".set\tmips64\n\t" \
- "dmtc0\t%z0, " #register ", " #sel "\n\t" \
- ".set\tmips0" \
- : : "Jr" (value)); \
-} while (0)
-
-#define __read_ulong_c0_register(reg, sel) \
- ((sizeof(unsigned long) == 4) ? \
- __read_32bit_c0_register(reg, sel) : \
- __read_64bit_c0_register(reg, sel))
-
-#define __write_ulong_c0_register(reg, sel, val) \
-do { \
- if (sizeof(unsigned long) == 4) \
- __write_32bit_c0_register(reg, sel, val); \
- else \
- __write_64bit_c0_register(reg, sel, val); \
-} while (0)
-
-/*
- * These versions are only needed for systems with more than 38 bits of
- * physical address space running the 32-bit kernel. That's none atm :-)
- */
-#define __read_64bit_c0_split(source, sel) \
-({ \
- unsigned long long val; \
- unsigned long flags; \
- \
- local_irq_save(flags); \
- if (sel == 0) \
- __asm__ __volatile__( \
- ".set\tmips64\n\t" \
- "dmfc0\t%M0, " #source "\n\t" \
- "dsll\t%L0, %M0, 32\n\t" \
- "dsrl\t%M0, %M0, 32\n\t" \
- "dsrl\t%L0, %L0, 32\n\t" \
- ".set\tmips0" \
- : "=r" (val)); \
- else \
- __asm__ __volatile__( \
- ".set\tmips64\n\t" \
- "dmfc0\t%M0, " #source ", " #sel "\n\t" \
- "dsll\t%L0, %M0, 32\n\t" \
- "dsrl\t%M0, %M0, 32\n\t" \
- "dsrl\t%L0, %L0, 32\n\t" \
- ".set\tmips0" \
- : "=r" (val)); \
- local_irq_restore(flags); \
- \
- val; \
-})
-
-#define __write_64bit_c0_split(source, sel, val) \
-do { \
- unsigned long flags; \
- \
- local_irq_save(flags); \
- if (sel == 0) \
- __asm__ __volatile__( \
- ".set\tmips64\n\t" \
- "dsll\t%L0, %L0, 32\n\t" \
- "dsrl\t%L0, %L0, 32\n\t" \
- "dsll\t%M0, %M0, 32\n\t" \
- "or\t%L0, %L0, %M0\n\t" \
- "dmtc0\t%L0, " #source "\n\t" \
- ".set\tmips0" \
- : : "r" (val)); \
- else \
- __asm__ __volatile__( \
- ".set\tmips64\n\t" \
- "dsll\t%L0, %L0, 32\n\t" \
- "dsrl\t%L0, %L0, 32\n\t" \
- "dsll\t%M0, %M0, 32\n\t" \
- "or\t%L0, %L0, %M0\n\t" \
- "dmtc0\t%L0, " #source ", " #sel "\n\t" \
- ".set\tmips0" \
- : : "r" (val)); \
- local_irq_restore(flags); \
-} while (0)
-
-#define read_c0_index() __read_32bit_c0_register($0, 0)
-#define write_c0_index(val) __write_32bit_c0_register($0, 0, val)
-
-#define read_c0_entrylo0() __read_ulong_c0_register($2, 0)
-#define write_c0_entrylo0(val) __write_ulong_c0_register($2, 0, val)
-
-#define read_c0_entrylo1() __read_ulong_c0_register($3, 0)
-#define write_c0_entrylo1(val) __write_ulong_c0_register($3, 0, val)
-
-#define read_c0_conf() __read_32bit_c0_register($3, 0)
-#define write_c0_conf(val) __write_32bit_c0_register($3, 0, val)
-
-#define read_c0_context() __read_ulong_c0_register($4, 0)
-#define write_c0_context(val) __write_ulong_c0_register($4, 0, val)
-
-#define read_c0_pagemask() __read_32bit_c0_register($5, 0)
-#define write_c0_pagemask(val) __write_32bit_c0_register($5, 0, val)
-
-#define read_c0_wired() __read_32bit_c0_register($6, 0)
-#define write_c0_wired(val) __write_32bit_c0_register($6, 0, val)
-
-#define read_c0_info() __read_32bit_c0_register($7, 0)
-
-#define read_c0_cache() __read_32bit_c0_register($7, 0) /* TX39xx */
-#define write_c0_cache(val) __write_32bit_c0_register($7, 0, val)
-
-#define read_c0_count() __read_32bit_c0_register($9, 0)
-#define write_c0_count(val) __write_32bit_c0_register($9, 0, val)
-
-#define read_c0_entryhi() __read_ulong_c0_register($10, 0)
-#define write_c0_entryhi(val) __write_ulong_c0_register($10, 0, val)
-
-#define read_c0_compare() __read_32bit_c0_register($11, 0)
-#define write_c0_compare(val) __write_32bit_c0_register($11, 0, val)
-
-#define read_c0_status() __read_32bit_c0_register($12, 0)
-#define write_c0_status(val) __write_32bit_c0_register($12, 0, val)
-
-#define read_c0_cause() __read_32bit_c0_register($13, 0)
-#define write_c0_cause(val) __write_32bit_c0_register($13, 0, val)
-
-#define read_c0_prid() __read_32bit_c0_register($15, 0)
-
-#define read_c0_config() __read_32bit_c0_register($16, 0)
-#define read_c0_config1() __read_32bit_c0_register($16, 1)
-#define read_c0_config2() __read_32bit_c0_register($16, 2)
-#define read_c0_config3() __read_32bit_c0_register($16, 3)
-#define write_c0_config(val) __write_32bit_c0_register($16, 0, val)
-#define write_c0_config1(val) __write_32bit_c0_register($16, 1, val)
-#define write_c0_config2(val) __write_32bit_c0_register($16, 2, val)
-#define write_c0_config3(val) __write_32bit_c0_register($16, 3, val)
-
-/*
- * The WatchLo register. There may be upto 8 of them.
- */
-#define read_c0_watchlo0() __read_ulong_c0_register($18, 0)
-#define read_c0_watchlo1() __read_ulong_c0_register($18, 1)
-#define read_c0_watchlo2() __read_ulong_c0_register($18, 2)
-#define read_c0_watchlo3() __read_ulong_c0_register($18, 3)
-#define read_c0_watchlo4() __read_ulong_c0_register($18, 4)
-#define read_c0_watchlo5() __read_ulong_c0_register($18, 5)
-#define read_c0_watchlo6() __read_ulong_c0_register($18, 6)
-#define read_c0_watchlo7() __read_ulong_c0_register($18, 7)
-#define write_c0_watchlo0(val) __write_ulong_c0_register($18, 0, val)
-#define write_c0_watchlo1(val) __write_ulong_c0_register($18, 1, val)
-#define write_c0_watchlo2(val) __write_ulong_c0_register($18, 2, val)
-#define write_c0_watchlo3(val) __write_ulong_c0_register($18, 3, val)
-#define write_c0_watchlo4(val) __write_ulong_c0_register($18, 4, val)
-#define write_c0_watchlo5(val) __write_ulong_c0_register($18, 5, val)
-#define write_c0_watchlo6(val) __write_ulong_c0_register($18, 6, val)
-#define write_c0_watchlo7(val) __write_ulong_c0_register($18, 7, val)
-
-/*
- * The WatchHi register. There may be upto 8 of them.
- */
-#define read_c0_watchhi0() __read_32bit_c0_register($19, 0)
-#define read_c0_watchhi1() __read_32bit_c0_register($19, 1)
-#define read_c0_watchhi2() __read_32bit_c0_register($19, 2)
-#define read_c0_watchhi3() __read_32bit_c0_register($19, 3)
-#define read_c0_watchhi4() __read_32bit_c0_register($19, 4)
-#define read_c0_watchhi5() __read_32bit_c0_register($19, 5)
-#define read_c0_watchhi6() __read_32bit_c0_register($19, 6)
-#define read_c0_watchhi7() __read_32bit_c0_register($19, 7)
-
-#define write_c0_watchhi0(val) __write_32bit_c0_register($19, 0, val)
-#define write_c0_watchhi1(val) __write_32bit_c0_register($19, 1, val)
-#define write_c0_watchhi2(val) __write_32bit_c0_register($19, 2, val)
-#define write_c0_watchhi3(val) __write_32bit_c0_register($19, 3, val)
-#define write_c0_watchhi4(val) __write_32bit_c0_register($19, 4, val)
-#define write_c0_watchhi5(val) __write_32bit_c0_register($19, 5, val)
-#define write_c0_watchhi6(val) __write_32bit_c0_register($19, 6, val)
-#define write_c0_watchhi7(val) __write_32bit_c0_register($19, 7, val)
-
-#define read_c0_xcontext() __read_ulong_c0_register($20, 0)
-#define write_c0_xcontext(val) __write_ulong_c0_register($20, 0, val)
-
-#define read_c0_intcontrol() __read_32bit_c0_register($20, 1)
-#define write_c0_intcontrol(val) __write_32bit_c0_register($20, 1, val)
-
-#define read_c0_framemask() __read_32bit_c0_register($21, 0)
-#define write_c0_framemask(val) __write_32bit_c0_register($21, 0, val)
-
-#define read_c0_debug() __read_32bit_c0_register($23, 0)
-#define write_c0_debug(val) __write_32bit_c0_register($23, 0, val)
-
-#define read_c0_depc() __read_ulong_c0_register($24, 0)
-#define write_c0_depc(val) __write_ulong_c0_register($24, 0, val)
-
-#define read_c0_ecc() __read_32bit_c0_register($26, 0)
-#define write_c0_ecc(val) __write_32bit_c0_register($26, 0, val)
-
-#define read_c0_derraddr0() __read_ulong_c0_register($26, 1)
-#define write_c0_derraddr0(val) __write_ulong_c0_register($26, 1, val)
-
-#define read_c0_cacheerr() __read_32bit_c0_register($27, 0)
-
-#define read_c0_derraddr1() __read_ulong_c0_register($27, 1)
-#define write_c0_derraddr1(val) __write_ulong_c0_register($27, 1, val)
-
-#define read_c0_taglo() __read_32bit_c0_register($28, 0)
-#define write_c0_taglo(val) __write_32bit_c0_register($28, 0, val)
-
-#define read_c0_taghi() __read_32bit_c0_register($29, 0)
-#define write_c0_taghi(val) __write_32bit_c0_register($29, 0, val)
-
-#define read_c0_errorepc() __read_ulong_c0_register($30, 0)
-#define write_c0_errorepc(val) __write_ulong_c0_register($30, 0, val)
-
-#define read_c0_epc() __read_ulong_c0_register($14, 0)
-#define write_c0_epc(val) __write_ulong_c0_register($14, 0, val)
-
-#if 1
-/*
- * Macros to access the system control coprocessor
- */
-#define read_32bit_cp0_register(source) \
-({ int __res; \
- __asm__ __volatile__( \
- ".set\tpush\n\t" \
- ".set\treorder\n\t" \
- "mfc0\t%0,"STR(source)"\n\t" \
- ".set\tpop" \
- : "=r" (__res)); \
- __res;})
-
-#define read_32bit_cp0_set1_register(source) \
-({ int __res; \
- __asm__ __volatile__( \
- ".set\tpush\n\t" \
- ".set\treorder\n\t" \
- "cfc0\t%0,"STR(source)"\n\t" \
- ".set\tpop" \
- : "=r" (__res)); \
- __res;})
-
-/*
- * For now use this only with interrupts disabled!
- */
-#define read_64bit_cp0_register(source) \
-({ int __res; \
- __asm__ __volatile__( \
- ".set\tmips3\n\t" \
- "dmfc0\t%0,"STR(source)"\n\t" \
- ".set\tmips0" \
- : "=r" (__res)); \
- __res;})
-
-#define write_32bit_cp0_register(register,value) \
- __asm__ __volatile__( \
- "mtc0\t%0,"STR(register)"\n\t" \
- "nop" \
- : : "r" (value));
-
-#define write_32bit_cp0_set1_register(register,value) \
- __asm__ __volatile__( \
- "ctc0\t%0,"STR(register)"\n\t" \
- "nop" \
- : : "r" (value));
-
-#define write_64bit_cp0_register(register,value) \
- __asm__ __volatile__( \
- ".set\tmips3\n\t" \
- "dmtc0\t%0,"STR(register)"\n\t" \
- ".set\tmips0" \
- : : "r" (value))
-
-/*
- * This should be changed when we get a compiler that support the MIPS32 ISA.
- */
-#define read_mips32_cp0_config1() \
-({ int __res; \
- __asm__ __volatile__( \
- ".set\tnoreorder\n\t" \
- ".set\tnoat\n\t" \
- "#.set\tmips64\n\t" \
- "#mfc0\t$1, $16, 1\n\t" \
- "#.set\tmips0\n\t" \
- ".word\t0x40018001\n\t" \
- "move\t%0,$1\n\t" \
- ".set\tat\n\t" \
- ".set\treorder" \
- :"=r" (__res)); \
- __res;})
-
-#endif
-/*
- * Macros to access the floating point coprocessor control registers
- */
-#define read_32bit_cp1_register(source) \
-({ int __res; \
- __asm__ __volatile__( \
- ".set\tpush\n\t" \
- ".set\treorder\n\t" \
- "cfc1\t%0,"STR(source)"\n\t" \
- ".set\tpop" \
- : "=r" (__res)); \
- __res;})
-
-/* TLB operations. */
-static inline void tlb_probe(void)
-{
- __asm__ __volatile__(
- ".set noreorder\n\t"
- "tlbp\n\t"
- ".set reorder");
-}
-
-static inline void tlb_read(void)
-{
- __asm__ __volatile__(
- ".set noreorder\n\t"
- "tlbr\n\t"
- ".set reorder");
-}
-
-static inline void tlb_write_indexed(void)
-{
- __asm__ __volatile__(
- ".set noreorder\n\t"
- "tlbwi\n\t"
- ".set reorder");
-}
-
-static inline void tlb_write_random(void)
-{
- __asm__ __volatile__(
- ".set noreorder\n\t"
- "tlbwr\n\t"
- ".set reorder");
-}
-
-/*
- * Manipulate bits in a c0 register.
- */
-#define __BUILD_SET_C0(name,register) \
-static inline unsigned int \
-set_c0_##name(unsigned int set) \
-{ \
- unsigned int res; \
- \
- res = read_c0_##name(); \
- res |= set; \
- write_c0_##name(res); \
- \
- return res; \
-} \
- \
-static inline unsigned int \
-clear_c0_##name(unsigned int clear) \
-{ \
- unsigned int res; \
- \
- res = read_c0_##name(); \
- res &= ~clear; \
- write_c0_##name(res); \
- \
- return res; \
-} \
- \
-static inline unsigned int \
-change_c0_##name(unsigned int change, unsigned int new) \
-{ \
- unsigned int res; \
- \
- res = read_c0_##name(); \
- res &= ~change; \
- res |= (new & change); \
- write_c0_##name(res); \
- \
- return res; \
-}
-
-__BUILD_SET_C0(status,CP0_STATUS)
-__BUILD_SET_C0(cause,CP0_CAUSE)
-__BUILD_SET_C0(config,CP0_CONFIG)
-
-#define set_cp0_status(x) set_c0_status(x)
-#define set_cp0_cause(x) set_c0_cause(x)
-#define set_cp0_config(x) set_c0_config(x)
-
-#endif /* !__ASSEMBLY__ */
-
-#endif /* _ASM_MIPSREGS_H */
diff --git a/sdk-modifications/include/mmc_api.h b/sdk-modifications/include/mmc_api.h
deleted file mode 100755
index 28e75ef..0000000
--- a/sdk-modifications/include/mmc_api.h
+++ /dev/null
@@ -1,56 +0,0 @@
-#ifndef __MMC_API_H__
-#define __MMC_API_H__
-
-/* Error codes */
-enum mmc_result_t {
- MMC_NO_RESPONSE = -1,
- MMC_NO_ERROR = 0,
- MMC_ERROR_OUT_OF_RANGE,
- MMC_ERROR_ADDRESS,
- MMC_ERROR_BLOCK_LEN,
- MMC_ERROR_ERASE_SEQ,
- MMC_ERROR_ERASE_PARAM,
- MMC_ERROR_WP_VIOLATION,
- MMC_ERROR_CARD_IS_LOCKED,
- MMC_ERROR_LOCK_UNLOCK_FAILED,
- MMC_ERROR_COM_CRC,
- MMC_ERROR_ILLEGAL_COMMAND,
- MMC_ERROR_CARD_ECC_FAILED,
- MMC_ERROR_CC,
- MMC_ERROR_GENERAL,
- MMC_ERROR_UNDERRUN,
- MMC_ERROR_OVERRUN,
- MMC_ERROR_CID_CSD_OVERWRITE,
- MMC_ERROR_STATE_MISMATCH,
- MMC_ERROR_HEADER_MISMATCH,
- MMC_ERROR_TIMEOUT,
- MMC_ERROR_CRC,
- MMC_ERROR_DRIVER_FAILURE,
-};
-
-
-/* Get card's sectors*/
-
-extern unsigned int MMC_GetSize(void);
-
-
-/* initialize MMC/SD card */
-extern int MMC_Initialize(void);
-
-/* read a single block from MMC/SD card */
-extern int MMC_ReadBlock(unsigned int blockaddr, unsigned char *recbuf);
-
-/* read multi blocks from MMC/SD card */
-extern int MMC_ReadMultiBlock(unsigned int blockaddr, unsigned int blocknum, unsigned char *recbuf);
-
-/* write a block to MMC/SD card */
-extern int MMC_WriteBlock(unsigned int blockaddr, unsigned char *recbuf);
-
-/* write multi blocks to MMC/SD card */
-extern int MMC_WriteMultiBlock(unsigned int blockaddr, unsigned int blocknum, unsigned char *recbuf);
-
-/* detect MMC/SD card */
-extern int MMC_DetectStatus(void);
-
-#endif /* __MMC_API_H__ */
-
diff --git a/sdk-modifications/include/partition.h b/sdk-modifications/include/partition.h
deleted file mode 100755
index 0777b54..0000000
--- a/sdk-modifications/include/partition.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- partition.h
- Functions for mounting and dismounting partitions
- on various block devices.
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-*/
-
-#ifndef _PARTITION_H
-#define _PARTITION_H
-
-#include "fs_common.h"
-
-#include "disc_io/disc.h"
-#include "fs_cache.h"
-
-// Device name
-extern const char* DEVICE_NAME;
-
-// Filesystem type
-typedef enum {FS_UNKNOWN, FS_FAT12, FS_FAT16, FS_FAT32} FS_TYPE;
-
-#ifdef NDS
-typedef enum {PI_DEFAULT, PI_SLOT_1, PI_SLOT_2, PI_CUSTOM} PARTITION_INTERFACE;
-#else
-typedef enum {PI_CART_SLOT} PARTITION_INTERFACE;
-#endif
-
-typedef struct {
- u32 fatStart;
- u32 sectorsPerFat;
- u32 lastCluster;
- u32 firstFree;
-} FAT;
-
-typedef struct {
- const IO_INTERFACE* disc;
- CACHE* cache;
- // Info about the partition
- bool readOnly; // If this is set, then do not try writing to the disc
- FS_TYPE filesysType;
- u32 totalSize;
- u32 rootDirStart;
- u32 rootDirCluster;
- u32 numberOfSectors;
- u32 dataStart;
- u32 bytesPerSector;
- u32 sectorsPerCluster;
- u32 bytesPerCluster;
- FAT fat;
- // Values that may change after construction
- u32 cwdCluster; // Current working directory cluser
- u32 openFileCount;
-} PARTITION;
-
-/*
-Mount the device specified by partitionDevice
-PD_DEFAULT is not allowed, use _FAT_partition_setDefaultDevice
-PD_CUSTOM is not allowed, use _FAT_partition_mountCustomDevice
-*/
-bool _FAT_partition_mount (PARTITION_INTERFACE partitionNumber, u32 cacheSize);
-
-/*
-Mount a partition on a custom device
-*/
-bool _FAT_partition_mountCustomInterface (const IO_INTERFACE* device, u32 cacheSize);
-
-
-/*
-Free Mount a partition on a custom device
-*/
-bool _FAT_partition_freeMount( int partitionNumber, const IO_INTERFACE* device, u32 cacheSize);
-
-
-/*
-Unmount the partition specified by partitionNumber
-If there are open files, it will fail
-*/
-bool _FAT_partition_unmount (PARTITION_INTERFACE partitionNumber);
-
-/*
-Forcibly unmount the partition specified by partitionNumber
-Any open files on the partition will become invalid
-The cache will be invalidated, and any unflushed writes will be lost
-*/
-bool _FAT_partition_unsafeUnmount (PARTITION_INTERFACE partitionNumber);
-
-/*
-Set the default device for access by fat: and fat0:,
-based on the device number
-*/
-bool _FAT_partition_setDefaultInterface (PARTITION_INTERFACE partitionNumber);
-
-/*
-Set the default device for access by fat: and fat0:,
-based on the partition pointer
-*/
-bool _FAT_partition_setDefaultPartition (PARTITION* partition);
-
-/*
-Return the partition specified in a path
-For instance, "fat0:", "fat:", "/" and "fat:/" will all
-return the default partition
-*/
-PARTITION* _FAT_partition_getPartitionFromPath (const char* path);
-
-#endif // _PARTITION_H
diff --git a/sdk-modifications/include/tcm.h b/sdk-modifications/include/tcm.h
deleted file mode 100755
index 4de3333..0000000
--- a/sdk-modifications/include/tcm.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef __TCM_H
-#define __TCM_H
-
-/*
-* Function: makes cpu to idle state. It will be waken up by RTC in the next second.
-* Of course, it can be waken up by keys at any time.
-*/
-int enable_enter_idle(void);
-
-#endif
diff --git a/sdk-modifications/libsrc/Makefile b/sdk-modifications/libsrc/Makefile
deleted file mode 100644
index 3d63b76..0000000
--- a/sdk-modifications/libsrc/Makefile
+++ /dev/null
@@ -1,70 +0,0 @@
-
-CURR_DIR = ${shell pwd}
-#CROSS :=#
-#CROSS := /opt/mipsel-4.1.2-nopic/bin/
-CROSS := /opt/mipsel-4.1.2-nopic/bin/
-
-
-CC = $(CROSS)mipsel-linux-gcc
-AR = $(CROSS)mipsel-linux-ar rcsv
-
-TOPDIR = .
-CONSOLE_DIR = $(TOPDIR)/console
-FS_DIR = $(TOPDIR)/fs
-KEY_DIR = $(TOPDIR)/key
-ZLIB_DIR = $(TOPDIR)/zlib
-CORE_DIR = $(TOPDIR)/core
-
-SRC :=
-
-SSRC :=
-
-INCLUDES := -I../include
-
-INC := $(INCLUDES)
-
-CFLAGS := -mips32 -O3 -mno-abicalls -fno-pic -fno-builtin \
- -fno-exceptions -ffunction-sections -mno-long-calls\
- -fomit-frame-pointer -msoft-float -G 4 \
- -fgcse-sm -fgcse-las -fgcse-after-reload \
- -fweb -fpeel-loops
-
-
-include $(CONSOLE_DIR)/console.mk
-include $(FS_DIR)/fs.mk
-include $(KEY_DIR)/key.mk
-include $(ZLIB_DIR)/zlib.mk
-include $(CORE_DIR)/core.mk
-
-#OBJS := $(addsuffix .o , $(basename $(notdir $(SRC))))
-#SOBJS := $(addsuffix .o , $(basename $(notdir $(SSRC))))
-
-OBJS := $(SRC:.c=.o)
-SOBJS := $(SSRC:.S=.o)
-
-all : depend libds2a.a
-
-libds2a.a : $(OBJS) $(SOBJS)
- $(AR) $@ $(OBJS) $(SOBJS)
- cp $@ ../lib
-
-clrscreen:
- @clear
- @clear
-
-clean :
- rm -rf $(OBJS) $(SOBJS) *.a
- rm -f depend
-
-.c.o :
- $(CC) $(CFLAGS) $(INC) -o $@ -c $<
-.cpp.o :
- $(CC) $(CFLAGS) $(INC) -fno-rtti -fvtable-gc -o $@ -c $<
-.S.o :
- $(CC) $(CFLAGS) $(INC) -D_ASSEMBLER_ -D__ASSEMBLY__ -o $@ -c $<
-
-depend : Makefile
- $(CC) -MM $(CFLAGS) $(INC) $(SSRC) $(SRC) > $@
-
-sinclude depend
-
diff --git a/sdk-modifications/libsrc/changes_bag.txt b/sdk-modifications/libsrc/changes_bag.txt
deleted file mode 100644
index 63b82a9..0000000
--- a/sdk-modifications/libsrc/changes_bag.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-Unofficial libds2a by BassAceGold
- Based on 0.13 beta Supercard SDK release, contains full lib with changes
-
-
-
-release 1:
- -inclusion of ds2_unistd.h and ds2_fcntl.h
- -updated zlib to 1.5.2
-
-release 2:
- -mkdir no longer freezes
- -faster fopen times for file reading
- (no longer searches for the next cluster to write to with read only mode)
- -makes DS2's DMA (direct memory access hardware) features publically available
- -adds extra cpu clock speeds (may be unstable)
- ds2_setCPULevel(level)
- -can now get the current CPU clock speed as an integer value
- ds2_getCPUClock()
-
-release 2 fix 1:
- -added ds2_udelay and ds2_mdelay variant functions.
- must be used with ds2_setCPULevel for accurate timings,
- old functions, udelay and mdelay, should not be used with the new
- cpu clock functions
- -added further optimizations to makefile
-
-release 2 fix 2:
- -fat_getDiskSpaceInfo no longer freezes
diff --git a/sdk-modifications/libsrc/console/console.c b/sdk-modifications/libsrc/console/console.c
deleted file mode 100755
index f455ac5..0000000
--- a/sdk-modifications/libsrc/console/console.c
+++ /dev/null
@@ -1,484 +0,0 @@
-//console.c
-
-#include <stdio.h>
-#include <stdarg.h>
-#include "ds2io.h"
-#include "memory.h"
-#include "font_dot.h"
-
-#define STRING_SIZE 2048
-
-#define CONSOLE_WIDTH 32
-#define CONSOLE_HEIGHT 24
-#define TAB_SIZE 3
-
-static void ConsoleView(void);
-static void ConsoleDrawfontall(void);
-
-static int console_init_done = 0;
-static unsigned short f_color;
-static unsigned short b_color;
-static enum SCREEN_ID console_id;
-
-static int print_row;
-static int print_col;
-static int print_row_saved;
-static int print_col_saved;
-
-static unsigned char* console_buf;
-static unsigned int console_buf_size;
-static unsigned char* console_buf_front;
-static unsigned char* console_buf_end;
-static unsigned char* console_print_header;
-static unsigned short* console_screen;
-static unsigned char* print_header_saved;
-
-static void ConsoleFlush(void)
-{
- unsigned short* screen_addr;
- enum SCREEN_ID id;
-
- if(console_id & UP_MASK) {
- screen_addr = up_screen_addr;
- id = UP_SCREEN;
- }
- else {
- screen_addr = down_screen_addr;
- id = DOWN_SCREEN;
- }
-
- memcpy((void*)screen_addr, (void*)console_screen, SCREEN_WIDTH*SCREEN_HEIGHT*2);
- ds2_flipScreen(id, 1);
-}
-
-static void ConsoleClearscreen(void)
-{
- unsigned short *scr;
- unsigned int i;
-
- scr = console_screen;
- i = 0;
- while(i < SCREEN_WIDTH*SCREEN_HEIGHT)
- scr[i++] = b_color;
-}
-
-static void ConsoleMovewin(int dir, int sw_screen)
-{
- unsigned char *pt;
-
- if(dir || sw_screen)
- ConsoleClearscreen();
-
- //switch to another screen to dispaly text
- if(sw_screen)
- {
- ConsoleFlush();
- //now up screen
- if(console_id & UP_MASK) {
- console_screen = down_screen_addr;
- console_id = DOWN_SCREEN;
- }
- //switch to up screen
- else
- {
- console_screen = up_screen_addr;
- console_id = UP_SCREEN;
- }
- }
-
- pt = console_print_header + dir*CONSOLE_WIDTH;
-
- //screen scroll down
- if(dir > 0)
- {
- if(console_buf_end > console_print_header) {
- if(pt > console_buf_end)
- pt = console_buf_end;
- console_print_header = pt;
- }
- else if(console_buf_end < console_print_header) {
- if((pt - console_buf) >= console_buf_size) {
- pt -= console_buf_size;
- if(pt > console_buf_end)
- pt = console_buf_end;
- }
- console_print_header = pt;
- }
- }
- //screen scroll up
- else if(dir < 0)
- {
- if(console_buf_front > console_print_header) {
- if(pt < console_buf) {
- pt += console_buf_size;
- if(pt < console_buf_front)
- pt = console_buf_front;
- }
- console_print_header = pt;
- }
- else if(console_buf_front < console_print_header) {
- if(pt < console_buf_front)
- pt = console_buf_front;
- console_print_header = pt;
- }
- }
-
- if(dir || sw_screen)
- {
- print_row_saved = 0; //redraw entire screen
- print_col_saved = 0;
-
- ConsoleDrawfontall();
- ConsoleFlush();
- }
-}
-
-void ConsoleClr(int mode)
-{
- unsigned char *pt, *pt_end;
- unsigned int i;
-
- //Clear current screen buffer
- if(0 == mode)
- {
- if(print_col > 0) {
- console_buf_end += CONSOLE_WIDTH;
- if((console_buf_end - console_buf) >= console_buf_size)
- console_buf_end -= console_buf_size;
- }
-
- console_print_header = console_buf_end;
- print_row = 0;
- print_col = 0;
- print_row_saved = 0;
- print_col_saved = 0;
- }
- //Clear all
- else if(1 == mode)
- {
- console_buf_front = console_buf;
- console_buf_end = console_buf;
- console_print_header = console_buf;
- print_row = 0;
- print_col = 0;
- print_row_saved = 0;
- print_col_saved = 0;
-
- pt = console_buf;
- pt_end = console_buf + console_buf_size;
- while(pt < pt_end)
- {
- pt[0] = '\0';
- pt += CONSOLE_WIDTH;
- }
- }
-
- ConsoleClearscreen();
- ConsoleFlush();
-}
-
-//Draw part of the screen
-static void ConsoleDrawfont(void)
-{
- unsigned char *pt, *dot_map;
- unsigned char ch, dot;
- unsigned short *dst, *pt_r;
- unsigned int row, col;
- unsigned int x, j, k;
-
- pt_r = console_screen;
- row = print_row_saved;
- col = print_col_saved;
- x = col*8;
-
- pt = console_print_header + row * CONSOLE_WIDTH;
-
- while(row != print_row || col != print_col)
- {
- ch = pt[col++] & 0x7F;
- //'\n'
- if('\n' == ch || '\0' == ch || col > CONSOLE_WIDTH) {
- pt += CONSOLE_WIDTH;
- if((pt - console_buf) >= console_buf_size) pt -= console_buf_size;
- col = 0;
- row += 1;
- x = 0;
- }
- //character not '\n' nor '\0'
- else {
- dot_map = (unsigned char*)font_map[ch];
-
- for(j= 0; j < 8; j++)
- {
- dot = *dot_map++;
- dst = pt_r + (row*8+j)*SCREEN_WIDTH + x;
- for(k = 0; k < 8; k++)
- *dst++ = (dot & (0x80>>k)) ? f_color : b_color;
- }
- x += 8;
- }
- }
-}
-
-//Redraw the hole screen
-static void ConsoleDrawfontall(void)
-{
- unsigned char *pt, *end_pt, *dot_map;
- unsigned int i, j, k;
- unsigned char ch, dot;
- unsigned short *dst, *pt_r;
- unsigned int x, y;
-
- //Clear screen to b_color
- pt_r = console_screen;
- i = 0;
- while(i < SCREEN_WIDTH*SCREEN_HEIGHT)
- pt_r[i++] = b_color;
-
- pt = console_print_header;
- end_pt = console_buf_end;
- x = 0;
- y = 0;
- i = 0;
- while(pt != end_pt)
- {
- ch = pt[i++] & 0x7F;
- //'\n'
- if('\n' == ch || '\0' == ch || i > CONSOLE_WIDTH) {
- pt += CONSOLE_WIDTH;
- if((pt - console_buf) >= console_buf_size) pt -= console_buf_size;
- i = 0;
- x = 0;
- y += 1;
- if(y >= CONSOLE_HEIGHT) break;
- }
- //character not '\n' nor '\0'
- else {
- dot_map = (unsigned char*)font_map[ch];
-
- for(j= 0; j < 8; j++)
- {
- dot = *dot_map++;
- dst = pt_r + (y*8+j)*SCREEN_WIDTH + x;
- for(k = 0; k < 8; k++)
- *dst++ = (dot & (0x80>>k)) ? f_color : b_color;
- }
- x += 8;
- }
- }
-}
-
-static void ConsoleNewline(void)
-{
- print_row += 1;
- if(print_row >= CONSOLE_HEIGHT)
- {
- print_row -= 1;
- console_print_header += CONSOLE_WIDTH;
- if((console_print_header - console_buf) >= console_buf_size)
- console_print_header = console_buf;
-
- print_row_saved = 0;
- print_col_saved = 0;
-
- ConsoleClearscreen();
- }
-
- console_buf_end += CONSOLE_WIDTH;
- if((console_buf_end - console_buf) >= console_buf_size)
- console_buf_end = console_buf;
-
- //scrollback
- if(console_buf_end == console_buf_front)
- {
- console_buf_front += CONSOLE_WIDTH;
- if((console_buf_front - console_buf) >= console_buf_size)
- console_buf_front = console_buf;
-
- console_buf_end[0] = '\0';
- }
-}
-
-static void ConsolePrintchar(unsigned char ch)
-{
- int i;
-
- if(print_col >= CONSOLE_WIDTH) {
- print_col = 0;
- ConsoleNewline();
- }
-
- switch(ch) {
- case 9: //'\t'
- if((print_col + TAB_SIZE) < CONSOLE_WIDTH)
- {
- i = print_col % TAB_SIZE;
- i = TAB_SIZE - i;
- while(i--)
- {
- console_buf_end[print_col] = ' ';
- print_col += 1;
- }
- }
- break;
- case 10: //'\n'
- case 13: //'\r'
- console_buf_end[print_col] = '\n';
- print_col = 0;
- ConsoleNewline();
- break;
- default:
- console_buf_end[print_col] = ch;
- if(ch != '\0')
- print_col += 1;
- break;
- }
-}
-
-void ConsolePrintstring(unsigned char* string)
-{
- unsigned char *pt;
- unsigned char ch;
-
- print_row_saved = print_row;
- print_col_saved = print_col;
- console_print_header = print_header_saved;
-//cprintf("print_row %d; print_col %d; [%s]\n", print_row, print_col, string);
- pt = string;
- do
- {
- ch = *pt++;
- ConsolePrintchar(ch);
- }
- while ('\0' != ch);
-
- print_header_saved = console_print_header;
-
- ConsoleDrawfont();
- ConsoleFlush();
-}
-
-//---------------------------------------------------------------------------------
-//parameter:
-// front_color: color of character
-// background_color: background color
-// screen: UP-up screen used as output, DOWN-down screen used as output,
-// using only one screen at a time
-// buf_size: buffer size to hold the output, it's unit is screen
-//---------------------------------------------------------------------------------
-int ConsoleInit(unsigned short front_color, unsigned short background_color, enum SCREEN_ID screen, unsigned int buf_size)
-{
- unsigned char *pt;
- unsigned int size;
- unsigned short **scr_ppt;
-
- console_init_done = 0;
- f_color = front_color;
- b_color = background_color;
-
-
- //Using only one screen at a time
- if(screen & UP_MASK)
- console_id = UP_SCREEN;
- else
- console_id = DOWN_SCREEN;
-
- if(!buf_size) buf_size = 1;
- size = buf_size *CONSOLE_WIDTH *CONSOLE_HEIGHT;
-
- pt = (unsigned char*)Drv_alloc(size);
- if(NULL == pt)
- return -1; //there is something error
-
- console_buf = pt;
- memset(console_buf, 0, size);
-
- print_row = 0;
- print_col = 0;
- print_row_saved = print_row;
- print_col_saved = print_col;
- console_buf_size = size;
- console_buf_front = console_buf;
- console_buf_end = console_buf;
- console_print_header = console_buf;
- print_header_saved = console_print_header;
-
- console_screen = (unsigned short*)Drv_alloc(SCREEN_WIDTH * SCREEN_HEIGHT*2);
- if(NULL == console_screen) {
- Drv_deAlloc((void*)console_buf);
- return -1;
- }
-
- ConsoleClr(1);
-
- console_init_done = 1;
-
- regist_escape_key(ConsoleView, (KEY_L | KEY_R | KEY_A | KEY_B | KEY_X));
- return 0;
-}
-
-void ConsoleView(void)
-{
- unsigned int key;
-
-cprintf("enter console mode\n");
-
- do {
- key = getKey();
-
- switch(key)
- {
- //screen scroll down 1 line
- case KEY_UP:
- ConsoleMovewin(-1, 0);
- break;
-
- //screen scroll up 1 line
- case KEY_DOWN:
- ConsoleMovewin(1, 0);
- break;
-
- //screen scroll done (CONSOLE_HEIGHT-1) line
- case KEY_LEFT:
- ConsoleMovewin(-(CONSOLE_HEIGHT-1), 0);
- break;
-
- //screen scroll up (CONSOLE_HEIGHT-1) line
- case KEY_RIGHT:
- ConsoleMovewin(CONSOLE_HEIGHT-1, 0);
- break;
-
- //switch screen
- case KEY_B:
-cprintf("switch to another screen\n");
- ConsoleMovewin(0, 1);
- break;
-
- default: break;
- }
-
- mdelay(20);
- } while(key != KEY_Y);
-
-cprintf("exit console mode\n");
-}
-
-int printf(const char *format, ...)
-{
- char string[STRING_SIZE];
- int ret;
- va_list ap;
-
- if(!console_init_done)
- return 0;
-
- va_start (ap, format);
- ret = vsnprintf(string, STRING_SIZE, format, ap);
- va_end (ap);
-
- ConsolePrintstring(string);
-
- return ret;
-}
-
-
diff --git a/sdk-modifications/libsrc/console/console.h b/sdk-modifications/libsrc/console/console.h
deleted file mode 100755
index f6d74a4..0000000
--- a/sdk-modifications/libsrc/console/console.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef __CONSOLE_H__
-#define __CONSOLE_H__
-#include "ds2io.h"
-
-extern int ConsoleInit(unsigned short front_color, unsigned short background_color, enum SCREEN_ID screen, unsigned int buf_size);
-
-extern int cprintf(const char *format, ...);
-
-#endif //__CONSOLE_H__
diff --git a/sdk-modifications/libsrc/console/console.mk b/sdk-modifications/libsrc/console/console.mk
deleted file mode 100755
index b8a436e..0000000
--- a/sdk-modifications/libsrc/console/console.mk
+++ /dev/null
@@ -1,10 +0,0 @@
-#console.mk
-
-SRC += $(CONSOLE_DIR)/console.c
-
-SSRC +=
-
-INC += -I$(CONSOLE_DIR)
-
-CFLAGS +=
-
diff --git a/sdk-modifications/libsrc/console/font_dot.h b/sdk-modifications/libsrc/console/font_dot.h
deleted file mode 100755
index cdf6067..0000000
--- a/sdk-modifications/libsrc/console/font_dot.h
+++ /dev/null
@@ -1,75 +0,0 @@
-#ifndef __FONT_DOT_H__
-#define __FONT_DOT_H__
-
-//version 0.1
-//modified ''', '(',')',';','?','[',']','^','_''`','{','}','~'
-
-const unsigned char font_map[128][8] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x08, 0x08, 0x08, 0x08,
- 0x00, 0x00, 0x00, 0x78, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x00, 0x00, 0x00, 0x00,
- 0x08, 0x08, 0x08, 0x78, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
- 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00,
- 0x7c, 0x64, 0x44, 0x44, 0x64, 0x7c, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x08, 0x10, 0x70, 0x50, 0x50, 0x70, 0x00,
- 0x24, 0x24, 0x1c, 0x08, 0x3f, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x16, 0x1a, 0x12, 0x12, 0x16, 0x34, 0x20, 0x00, 0x3c, 0x24, 0x24, 0x66, 0x24, 0x3c, 0x08, 0x08,
- 0x08, 0x08, 0x08, 0x7f, 0x08, 0x08, 0x08, 0x08, 0x0c, 0x1c, 0x3c, 0x3c, 0x1c, 0x0c, 0x04, 0x00,
- 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x1c, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x00, 0x00,
- 0x54, 0x54, 0x34, 0x14, 0x14, 0x14, 0x14, 0x14, 0x08, 0x08, 0x08, 0x7f, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x7f, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x78, 0x08, 0x08, 0x08, 0x08,
- 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, 0x08, 0x08, 0x08,
- 0x00, 0x00, 0x08, 0x7c, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x7c, 0x20, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10, 0x00,
- 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x14, 0x7e, 0x28, 0x7e, 0x28, 0x28, 0x00,
- 0x1c, 0x2c, 0x28, 0x18, 0x0c, 0x2c, 0x3c, 0x08, 0x64, 0x68, 0x68, 0x7c, 0x1c, 0x1c, 0x2c, 0x00,
- 0x30, 0x30, 0x3c, 0x28, 0x58, 0x50, 0x3c, 0x00, 0x30, 0x30, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, //'''
- 0x04, 0x08, 0x10, 0x10, 0x10, 0x10, 0x08, 0x04, 0x40, 0x20, 0x10, 0x10, 0x10, 0x10, 0x20, 0x40,
- 0x10, 0x54, 0x38, 0x38, 0x54, 0x10, 0x00, 0x00, 0x10, 0x10, 0x7c, 0x10, 0x10, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x40, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x20, 0x40,
- 0x18, 0x24, 0x24, 0x24, 0x24, 0x24, 0x18, 0x00, 0x10, 0x30, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00,
- 0x18, 0x24, 0x04, 0x08, 0x10, 0x20, 0x3c, 0x00, 0x18, 0x24, 0x04, 0x18, 0x04, 0x24, 0x18, 0x00,
- 0x08, 0x18, 0x28, 0x48, 0x7c, 0x08, 0x08, 0x00, 0x3c, 0x20, 0x38, 0x04, 0x04, 0x24, 0x18, 0x00,
- 0x38, 0x40, 0x40, 0x78, 0x44, 0x44, 0x38, 0x00, 0x3c, 0x08, 0x08, 0x10, 0x10, 0x10, 0x10, 0x00,
- 0x18, 0x24, 0x24, 0x18, 0x24, 0x24, 0x18, 0x00, 0x18, 0x24, 0x24, 0x1c, 0x04, 0x04, 0x18, 0x00,
- 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x10, 0x20, //';'
- 0x04, 0x08, 0x10, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x7c, 0x00, 0x00,
- 0x20, 0x10, 0x08, 0x04, 0x08, 0x10, 0x20, 0x00, 0x10, 0x24, 0x24, 0x08, 0x10, 0x10, 0x00, 0x10, //'?'
- 0x38, 0x4c, 0x54, 0x5c, 0x54, 0x44, 0x38, 0x00, 0x10, 0x10, 0x28, 0x28, 0x38, 0x28, 0x6c, 0x00,
- 0x78, 0x24, 0x38, 0x24, 0x24, 0x24, 0x78, 0x00, 0x3c, 0x44, 0x40, 0x40, 0x40, 0x44, 0x38, 0x00,
- 0x78, 0x24, 0x24, 0x24, 0x24, 0x24, 0x78, 0x00, 0x7c, 0x24, 0x20, 0x38, 0x20, 0x24, 0x7c, 0x00,
- 0x7c, 0x24, 0x28, 0x38, 0x28, 0x20, 0x70, 0x00, 0x38, 0x40, 0x40, 0x40, 0x5c, 0x48, 0x30, 0x00,
- 0x76, 0x24, 0x24, 0x3c, 0x24, 0x24, 0x76, 0x00, 0x38, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00,
- 0x38, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x60, 0x74, 0x28, 0x30, 0x30, 0x28, 0x28, 0x6c, 0x00,
- 0x70, 0x20, 0x20, 0x20, 0x20, 0x24, 0x7c, 0x00, 0x66, 0x3c, 0x3c, 0x3c, 0x34, 0x24, 0x66, 0x00,
- 0x6e, 0x24, 0x34, 0x34, 0x2c, 0x24, 0x74, 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00,
- 0x78, 0x24, 0x24, 0x38, 0x20, 0x20, 0x70, 0x00, 0x38, 0x44, 0x44, 0x44, 0x74, 0x4c, 0x38, 0x0c,
- 0x78, 0x24, 0x38, 0x28, 0x24, 0x24, 0x76, 0x00, 0x1c, 0x24, 0x20, 0x18, 0x04, 0x24, 0x38, 0x00,
- 0x7c, 0x54, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x66, 0x24, 0x24, 0x24, 0x24, 0x24, 0x18, 0x00,
- 0x6c, 0x28, 0x28, 0x28, 0x28, 0x10, 0x10, 0x00, 0x7e, 0x52, 0x52, 0x2c, 0x2c, 0x24, 0x24, 0x00,
- 0x6c, 0x28, 0x28, 0x10, 0x28, 0x28, 0x6c, 0x00, 0x6c, 0x28, 0x28, 0x10, 0x10, 0x10, 0x38, 0x00,
- 0x7c, 0x48, 0x10, 0x10, 0x20, 0x24, 0x7c, 0x00, 0x00, 0x1c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1c,
- 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x08, 0x04, 0x00, 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x38, //']'
- 0x10, 0x28, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C,
- 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x48, 0x38, 0x48, 0x3c, 0x00, //'a'
- 0x60, 0x20, 0x38, 0x24, 0x24, 0x24, 0x38, 0x00, 0x00, 0x00, 0x1c, 0x24, 0x20, 0x20, 0x1c, 0x00,
- 0x0c, 0x04, 0x1c, 0x24, 0x24, 0x24, 0x1e, 0x00, 0x00, 0x00, 0x18, 0x24, 0x3c, 0x20, 0x1c, 0x00,
- 0x0c, 0x10, 0x3c, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, 0x3c, 0x28, 0x38, 0x20, 0x3c, 0x3c,
- 0x60, 0x20, 0x38, 0x24, 0x24, 0x24, 0x76, 0x00, 0x10, 0x00, 0x30, 0x10, 0x10, 0x10, 0x38, 0x00,
- 0x08, 0x00, 0x18, 0x08, 0x08, 0x08, 0x08, 0x38, 0x60, 0x20, 0x2c, 0x28, 0x30, 0x28, 0x6c, 0x00,
- 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, 0x78, 0x54, 0x54, 0x54, 0x54, 0x00,
- 0x00, 0x00, 0x78, 0x24, 0x24, 0x24, 0x76, 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00,
- 0x00, 0x00, 0x78, 0x24, 0x24, 0x24, 0x38, 0x70, 0x00, 0x00, 0x1c, 0x24, 0x24, 0x24, 0x1c, 0x0e,
- 0x00, 0x00, 0x34, 0x18, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, 0x3c, 0x20, 0x18, 0x04, 0x3c, 0x00,
- 0x10, 0x10, 0x38, 0x10, 0x10, 0x10, 0x08, 0x00, 0x00, 0x00, 0x6c, 0x24, 0x24, 0x24, 0x1e, 0x00,
- 0x00, 0x00, 0x6c, 0x28, 0x28, 0x28, 0x10, 0x00, 0x00, 0x00, 0x6f, 0x2a, 0x2a, 0x36, 0x14, 0x00,
- 0x00, 0x00, 0x7c, 0x28, 0x10, 0x28, 0x7c, 0x00, 0x00, 0x00, 0x7c, 0x28, 0x10, 0x10, 0x20, 0x60,
- 0x00, 0x00, 0x3c, 0x08, 0x08, 0x10, 0x3c, 0x00, 0x00, 0x08, 0x10, 0x10, 0x20, 0x10, 0x10, 0x08,
- 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x20, 0x10, 0x10, 0x08, 0x10, 0x10, 0x20,
- 0x00, 0x00, 0x20, 0x54, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- };
-
-#endif //__FONT_DOT_H__
-
diff --git a/sdk-modifications/libsrc/core/core.mk b/sdk-modifications/libsrc/core/core.mk
deleted file mode 100644
index 4ed3ca8..0000000
--- a/sdk-modifications/libsrc/core/core.mk
+++ /dev/null
@@ -1,11 +0,0 @@
-#fs.mk
-
-SRC += $(CORE_DIR)/ds2_dma.c \
- $(CORE_DIR)/ds2_cpuclock.c
-
-SSRC +=
-
-INC += -I$(CORE_DIR)
-
-CFLAGS +=
-
diff --git a/sdk-modifications/libsrc/core/ds2_cpuclock.c b/sdk-modifications/libsrc/core/ds2_cpuclock.c
deleted file mode 100644
index 145218d..0000000
--- a/sdk-modifications/libsrc/core/ds2_cpuclock.c
+++ /dev/null
@@ -1,272 +0,0 @@
-#include <ds2_types.h>
-
-#include "ds2_cpuclock.h"
-
-#define REG8(addr) *((volatile u8 *)(addr))
-#define REG16(addr) *((volatile u16 *)(addr))
-#define REG32(addr) *((volatile u32 *)(addr))
-
-#define SDRAM_TRAS 50 /* RAS# Active Time */
-#define SDRAM_RCD 23 /* RAS# to CAS# Delay */
-#define SDRAM_TPC 23 /* RAS# Precharge Time */
-#define SDRAM_TRWL 7 /* Write Latency Time */
-#define SDRAM_TREF 7813 /* Refresh period: 8192 refresh cycles/64ms */
-
-#define EMC_BASE 0xB3010000
-#define EMC_DMCR (EMC_BASE + 0x80) /* DRAM Control Register */
-#define REG_EMC_DMCR REG32(EMC_DMCR)
-#define EMC_RTCSR (EMC_BASE + 0x84) /* Refresh Time Control/Status Register */
-#define REG_EMC_RTCSR REG16(EMC_RTCSR)
-#define EMC_RTCOR (EMC_BASE + 0x8c) /* Refresh Time Constant Register */
-#define REG_EMC_RTCOR REG16(EMC_RTCOR)
-#define EMC_RTCNT (EMC_BASE + 0x88) /* Refresh Timer Counter */
-#define REG_EMC_RTCNT REG16(EMC_RTCNT)
-
-
-
-#define CPM_BASE 0xB0000000
-#define CPM_CPCCR (CPM_BASE+0x00)
-#define CPM_CPPCR (CPM_BASE+0x10)
-//#define CPM_RSR (CPM_BASE+0x08)
-#define REG_CPM_CPCCR REG32(CPM_CPCCR)
-#define REG_CPM_CPPCR REG32(CPM_CPPCR)
-#define CPM_CPCCR_CE (1 << 22)
-
-
-
-
-
-
-#define EMC_DMCR_TRAS_BIT 13
-#define EMC_DMCR_TRAS_MASK (0x07 << EMC_DMCR_TRAS_BIT)
-#define EMC_DMCR_RCD_BIT 11
-#define EMC_DMCR_RCD_MASK (0x03 << EMC_DMCR_RCD_BIT)
-#define EMC_DMCR_TPC_BIT 8
-#define EMC_DMCR_TPC_MASK (0x07 << EMC_DMCR_TPC_BIT)
-#define EMC_DMCR_TRWL_BIT 5
-#define EMC_DMCR_TRWL_MASK (0x03 << EMC_DMCR_TRWL_BIT)
-#define EMC_DMCR_TRC_BIT 2
-#define EMC_DMCR_TRC_MASK (0x07 << EMC_DMCR_TRC_BIT)
-
-#define EMC_RTCSR_CKS_BIT 0
-#define EMC_RTCSR_CKS_MASK (0x07 << EMC_RTCSR_CKS_BIT)
-
-
-#define CPM_CPCCR_LDIV_BIT 16
-#define CPM_CPCCR_LDIV_MASK (0x1f << CPM_CPCCR_LDIV_BIT)
-#define CPM_CPCCR_MDIV_BIT 12
-#define CPM_CPCCR_MDIV_MASK (0x0f << CPM_CPCCR_MDIV_BIT)
-#define CPM_CPCCR_PDIV_BIT 8
-#define CPM_CPCCR_PDIV_MASK (0x0f << CPM_CPCCR_PDIV_BIT)
-#define CPM_CPCCR_HDIV_BIT 4
-#define CPM_CPCCR_HDIV_MASK (0x0f << CPM_CPCCR_HDIV_BIT)
-#define CPM_CPCCR_CDIV_BIT 0
-#define CPM_CPCCR_CDIV_MASK (0x0f << CPM_CPCCR_CDIV_BIT)
-
-
-#define CPM_CPPCR_PLLM_BIT 23
-#define CPM_CPPCR_PLLM_MASK (0x1ff << CPM_CPPCR_PLLM_BIT)
-#define CPM_CPPCR_PLLN_BIT 18
-#define CPM_CPPCR_PLLN_MASK (0x1f << CPM_CPPCR_PLLN_BIT)
-#define CPM_CPPCR_PLLOD_BIT 16
-#define CPM_CPPCR_PLLOD_MASK (0x03 << CPM_CPPCR_PLLOD_BIT)
-#define CPM_CPPCR_PLLS (1 << 10)
-#define CPM_CPPCR_PLLBP (1 << 9)
-#define CPM_CPPCR_PLLEN (1 << 8)
-#define CPM_CPPCR_PLLST_BIT 0
-#define CPM_CPPCR_PLLST_MASK (0xff << CPM_CPPCR_PLLST_BIT)
-
-
-#define PLL_M 0
-#define PLL_N 1
-#define PLL_CCLK 2
-#define PLL_HCLK 3
-#define PLL_MCLK 4
-#define PLL_PCLK 5
-
-#define CFG_EXTAL 24000000
-#define EXTAL_CLK CFG_EXTAL
-
-
-#define __cpm_get_pllm() \
- ((REG_CPM_CPPCR & CPM_CPPCR_PLLM_MASK) >> CPM_CPPCR_PLLM_BIT)
-
-#define __cpm_get_plln() \
- ((REG_CPM_CPPCR & CPM_CPPCR_PLLN_MASK) >> CPM_CPPCR_PLLN_BIT)
-
-#define __cpm_get_cdiv() \
- ((REG_CPM_CPCCR & CPM_CPCCR_CDIV_MASK) >> CPM_CPCCR_CDIV_BIT)
-
-
-static unsigned char pll_m_n[CPU_MAX_LEVEL_EX + 1][6] = {
- //M, N, CCLK, HCLK, MCLK, PCLK, EXT_CLK=24MHz
- {10-2, 2-2, 1, 1, 1, 1}, //0 60, 60, 1/1
- {10-2, 2-2, 0, 1, 1, 1}, //1 120, 60, 1/2
- {10-2, 2-2, 0, 0, 0, 0}, //2 120, 120, 1/1
- {12-2, 2-2, 0, 1, 1, 1}, //3 144, 72, 1/2
- {16-2, 2-2, 0, 1, 1, 1}, //4 192, 96, 1/2
- {17-2, 2-2, 0, 0, 1, 1}, //5 204, 102, 1/2
- {20-2, 2-2, 0, 1, 1, 1}, //6 240, 120, 1/2
- {22-2, 2-2, 0, 2, 2, 2}, //7 264, 88, 1/3
- {24-2, 2-2, 0, 2, 2, 2}, //8 288, 96, 1/3
- {25-2, 2-2, 0, 2, 2, 2}, //9 300, 100, 1/3
- {28-2, 2-2, 0, 2, 2, 2}, //10 336, 112, 1/3
- {30-2, 2-2, 0, 2, 2, 2}, //11 360, 120, 1/3
- {32-2, 2-2, 0, 2, 2, 2}, //12 384, 128, 1/3
- {33-2, 2-2, 0, 2, 2, 2}, //13 396, 132, 1/3
-
- {34-2, 2-2, 0, 2, 2, 2}, //14 404, 132, 1/3
- {35-2, 2-2, 0, 2, 2, 2}, //15 420, 132, 1/3
- {36-2, 2-2, 0, 2, 2, 2}, //16 438, 132, 1/3
- {37-2, 2-2, 0, 2, 2, 2}, //17 444, 132, 1/3
- {38-2, 2-2, 0, 2, 2, 2}, //18 456, 132, 1/3
- //{39-2, 2-2, 0, 2, 2, 2}, //468, instant crash!
- };
-
-static int _sdram_convert(unsigned int pllin,unsigned int *sdram_dmcr, unsigned int *sdram_div, unsigned int *sdram_tref)
-{
- register unsigned int ns, dmcr,tmp;
-
- dmcr = ~(EMC_DMCR_TRAS_MASK | EMC_DMCR_RCD_MASK | EMC_DMCR_TPC_MASK |
- EMC_DMCR_TRWL_MASK | EMC_DMCR_TRC_MASK) & REG_EMC_DMCR;
-
- /* Set sdram operation parameter */
- //pllin unit is KHz
- ns = 1000000*1024 / pllin;
- tmp = SDRAM_TRAS*1024/ns;
- if (tmp < 4) tmp = 4;
- if (tmp > 11) tmp = 11;
- dmcr |= ((tmp-4) << EMC_DMCR_TRAS_BIT);
-
- tmp = SDRAM_RCD*1024/ns;
- if (tmp > 3) tmp = 3;
- dmcr |= (tmp << EMC_DMCR_RCD_BIT);
-
- tmp = SDRAM_TPC*1024/ns;
- if (tmp > 7) tmp = 7;
- dmcr |= (tmp << EMC_DMCR_TPC_BIT);
-
- tmp = SDRAM_TRWL*1024/ns;
- if (tmp > 3) tmp = 3;
- dmcr |= (tmp << EMC_DMCR_TRWL_BIT);
-
- tmp = (SDRAM_TRAS + SDRAM_TPC)*1024/ns;
- if (tmp > 14) tmp = 14;
- dmcr |= (((tmp + 1) >> 1) << EMC_DMCR_TRC_BIT);
-
- *sdram_dmcr = dmcr;
-
- /* Set refresh registers */
- unsigned int div;
- tmp = SDRAM_TREF*1024/ns;
- div = (tmp + 254)/255;
- if(div <= 4) div = 1; // 1/4
- else if(div <= 16) div = 2; // 1/16
- else div = 3; // 1/64
-
- *sdram_div = ~EMC_RTCSR_CKS_MASK & REG_EMC_RTCSR | div;
-
- unsigned int divm= 4;
- while(--div) divm *= 4;
-
- tmp = tmp/divm + 1;
- *sdram_tref = tmp;
-
- return 0;
-}
-
-
-const static int FR2n[] = {
- 1, 2, 3, 4, 6, 8, 12, 16, 24, 32
-};
-
-static unsigned int _pllout;
-static unsigned int _iclk;
-
-static void detect_clockNew(void){
- _pllout = (__cpm_get_pllm() + 2)* EXTAL_CLK / (__cpm_get_plln() + 2);
- _iclk = _pllout / FR2n[__cpm_get_cdiv()];
-}
-
-
-//udelay overclock
-void ds2_udelay(unsigned int usec)
-{
- unsigned int i = usec * (_iclk / 2000000);
-
- __asm__ __volatile__ (
- "\t.set noreorder\n"
- "1:\n\t"
- "bne\t%0, $0, 1b\n\t"
- "addi\t%0, %0, -1\n\t"
- ".set reorder\n"
- : "=r" (i)
- : "0" (i)
- );
-}
-
-//mdelay overclock
-void ds2_mdelay(unsigned int msec)
-{
- int i;
- for(i=0;i<msec;i++)
- {
- ds2_udelay(1000);
- }
-}
-
-
-
-
-int ds2_getCPUClock(void){
- return (_pllout/1000/1000);
-}
-
-
-
-/* convert pll while program is running */
-int ds2_setCPULevel(unsigned int level){
- unsigned int freq_b;
- unsigned int dmcr;
- unsigned int rtcsr;
- unsigned int tref;
- unsigned int cpccr;
- unsigned int cppcr;
-
- if(level > CPU_MAX_LEVEL_EX) return -1;
-
- freq_b = (pll_m_n[level][PLL_M]+2)*(EXTAL_CLK/1000)/(pll_m_n[level][PLL_N]+2);
-
- //freq_b unit is KHz
- _sdram_convert(freq_b/pll_m_n[level][PLL_MCLK], &dmcr, &rtcsr, &tref);
-
- cpccr = REG_CPM_CPCCR;
- cppcr = REG_CPM_CPPCR;
-
- REG_CPM_CPCCR = ~CPM_CPCCR_CE & cpccr;
-
- cppcr &= ~(CPM_CPPCR_PLLM_MASK | CPM_CPPCR_PLLN_MASK);
- cppcr |= (pll_m_n[level][PLL_M] << CPM_CPPCR_PLLM_BIT) | (pll_m_n[level][PLL_N] << CPM_CPPCR_PLLN_BIT);
-
- cpccr &= ~(CPM_CPCCR_CDIV_MASK | CPM_CPCCR_HDIV_MASK | CPM_CPCCR_PDIV_MASK |
- CPM_CPCCR_MDIV_MASK | CPM_CPCCR_LDIV_MASK);
- cpccr |= (pll_m_n[level][PLL_CCLK] << CPM_CPCCR_CDIV_BIT) | (pll_m_n[level][PLL_HCLK] << CPM_CPCCR_HDIV_BIT) |
- (pll_m_n[level][PLL_MCLK] << CPM_CPCCR_MDIV_BIT) | (pll_m_n[level][PLL_PCLK] << CPM_CPCCR_PDIV_BIT) |
- (31 << CPM_CPCCR_LDIV_BIT);
-
- REG_CPM_CPCCR = cpccr;
- REG_CPM_CPPCR = cppcr;
-
- REG_CPM_CPCCR |= CPM_CPCCR_CE;
- //Wait PLL stable
- while(!(CPM_CPPCR_PLLS & REG_CPM_CPPCR));
-
- //REG_EMC_DMCR = dmcr;
- REG_EMC_RTCOR = tref;
- REG_EMC_RTCNT = tref;
-
- detect_clockNew();
- return 0;
-}
-
-
diff --git a/sdk-modifications/libsrc/core/ds2_cpuclock.h b/sdk-modifications/libsrc/core/ds2_cpuclock.h
deleted file mode 100644
index c28635b..0000000
--- a/sdk-modifications/libsrc/core/ds2_cpuclock.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef _DS2_CPUCLOCK_H__
-#define _DS2_CPUCLOCK_H__
-
-
-#define CPU_MAX_LEVEL_EX 18
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern int ds2_getCPUClock(void);
-extern int ds2_setCPULevel(unsigned int level);
-extern void udelayOC(unsigned int usec);
-extern void mdelayOC(unsigned int msec);
-
-//#define ds2_setCPUclocklevel ds2_setCPULevel
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //__DS2_CPUCLOCK_H__
diff --git a/sdk-modifications/libsrc/core/ds2_dma.c b/sdk-modifications/libsrc/core/ds2_dma.c
deleted file mode 100644
index 0b0eca1..0000000
--- a/sdk-modifications/libsrc/core/ds2_dma.c
+++ /dev/null
@@ -1,34 +0,0 @@
-#include "ds2_dma.h"
-
-
-
-//register a DMA transfer request
-//ch: channel id request, there are 6 channles,
-//irq_handler: the DMA interruption handle
-//arg: argument to the handle
-//mode: DMA mode, such as port width, address increased/fixed, and so on
-//type: DMA request type
-extern int dma_request(int ch, void (*irq_handler)(unsigned int), unsigned int arg,
- unsigned int mode, unsigned int type);
-
-//start DMA transfer, must request a DMA first
-//ch: channel id
-//srcAddr: DMA source address
-//dstAddr: DMA destination address
-//count: DMA transfer count, the total bytes due the mode in dma_request
-extern void dma_start(int ch, unsigned int srcAddr, unsigned int dstAddr,
- unsigned int count);
-
-
-int _dmaCopy(int ch, void *dest, void *src, unsigned int size, unsigned int flags){
- int test = 0;
- if(!(test = dma_request(ch, 0, 0,
- //increment dest addr
- DMAC_DCMD_DAI | flags,
- //auto request type
- DMAC_DRSR_RS_AUTO)))
- {
- dma_start(ch, (unsigned int)src, (unsigned int)dest, size);
- }
- return test;
-}
diff --git a/sdk-modifications/libsrc/core/ds2_dma.h b/sdk-modifications/libsrc/core/ds2_dma.h
deleted file mode 100644
index 9a306cf..0000000
--- a/sdk-modifications/libsrc/core/ds2_dma.h
+++ /dev/null
@@ -1,142 +0,0 @@
-#ifndef _DS2_DMA_H__
-#define _DS2_DMA_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-#define MAX_DMA_NUM 6 /* max 6 channels */
-
-
-// DMA request source register
-#define DMAC_DRSR_RS_BIT 0
-#define DMAC_DRSR_RS_AUTO (8 << DMAC_DRSR_RS_BIT)
-
-
-// DMA channel command register
-#define DMAC_DCMD_SAI (1 << 23) /* source address increment */
-#define DMAC_DCMD_DAI (1 << 22) /* dest address increment */
-
-#define DMAC_DCMD_SWDH_BIT 14 /* source port width */
-#define DMAC_DCMD_SWDH_32 (0 << DMAC_DCMD_SWDH_BIT)
-#define DMAC_DCMD_SWDH_8 (1 << DMAC_DCMD_SWDH_BIT)
-#define DMAC_DCMD_SWDH_16 (2 << DMAC_DCMD_SWDH_BIT)
-
-#define DMAC_DCMD_DWDH_BIT 12 /* dest port width */
-#define DMAC_DCMD_DWDH_32 (0 << DMAC_DCMD_DWDH_BIT)
-#define DMAC_DCMD_DWDH_8 (1 << DMAC_DCMD_DWDH_BIT)
- #define DMAC_DCMD_DWDH_16 (2 << DMAC_DCMD_DWDH_BIT)
-
-#define DMAC_DCMD_DS_BIT 8 /* transfer data size of a data unit */
-#define DMAC_DCMD_DS_32BIT (0 << DMAC_DCMD_DS_BIT)
-#define DMAC_DCMD_DS_8BIT (1 << DMAC_DCMD_DS_BIT)
-#define DMAC_DCMD_DS_16BIT (2 << DMAC_DCMD_DS_BIT)
-#define DMAC_DCMD_DS_16BYTE (3 << DMAC_DCMD_DS_BIT)
-#define DMAC_DCMD_DS_32BYTE (4 << DMAC_DCMD_DS_BIT)
-
-#define DMAC_DCMD_TM (1 << 7) /* transfer mode: 0-single 1-block */
-
-
-//detect if channel has completed job
-#define DMAC_DCCSR_TT (1 << 3) /* transfer terminated */
-#define DMAC_BASE 0xB3020000
-#define REG32(addr) *((volatile u32 *)(addr))
-#define DMAC_DCCSR(n) (DMAC_BASE + (0x10 + (n) * 0x20)) /* DMA control/status */
-#define REG_DMAC_DCCSR(n) REG32(DMAC_DCCSR((n)))
-
-#define ds2_DMA_isBusy(n) \
- !( REG_DMAC_DCCSR((n)) & DMAC_DCCSR_TT )
-
-
-/*
-Copy modes
-
-*/
-
-#define DMA_MODE32BYTE DMAC_DCMD_SWDH_32 | DMAC_DCMD_DWDH_32 | \
- DMAC_DCMD_DS_32BYTE | DMAC_DCMD_TM
-
-#define DMA_MODE16BYTE DMAC_DCMD_SWDH_16 | DMAC_DCMD_DWDH_16 | \
- DMAC_DCMD_DS_16BYTE | DMAC_DCMD_TM
-
-#define DMA_MODE32BIT DMAC_DCMD_SWDH_32 | DMAC_DCMD_DWDH_32 | \
- DMAC_DCMD_DS_32BIT
-
-#define DMA_MODE16BIT DMAC_DCMD_SWDH_16 | DMAC_DCMD_DWDH_16 | \
- DMAC_DCMD_DS_16BIT
-
-#define DMA_MODE8BIT DMAC_DCMD_SWDH_8 | DMAC_DCMD_DWDH_8 | \
- DMAC_DCMD_DS_8BIT | DMAC_DCMD_TM
-
-#define DMA_MODECOPY DMAC_DCMD_SAI
-
-
-
-extern int _dmaCopy(int ch, void *dest, void *src, unsigned int size, unsigned int flags);
-
-/*
- * Copy 'size' bytes from src to dest, in blocks of 32 bytes.
- * size is in bytes and must be a multiple of 32.
- * Both src and dest must be aligned to 32 bytes.
- * Returns 0 on failure, non-zero on success.
- */
-#define ds2_DMAcopy_32Byte(ch, dest, src, size)\
- _dmaCopy(ch, dest, src, size, DMA_MODECOPY | DMA_MODE32BYTE)
-
-/*
- * Copy 'size' bytes from src to dest, in blocks of 16 bytes.
- * size is in bytes and must be a multiple of 16.
- * Both src and dest must be aligned to 16 bytes.
- * Returns 0 on failure, non-zero on success.
- */
-#define ds2_DMAcopy_16Byte(ch, dest, src, size)\
- _dmaCopy(ch, dest, src, size, DMA_MODECOPY | DMA_MODE16BYTE);
-
-/*
- * Copy 'size' bytes from src to dest, in blocks of 32 bits (4 bytes).
- * size is in bytes and must be a multiple of 4.
- * Both src and dest must be aligned to 32 bits (4 bytes).
- * Returns 0 on failure, non-zero on success.
- */
-#define ds2_DMAcopy_32Bit(ch, dest, src, size)\
- _dmaCopy(ch, dest, src, size, DMA_MODECOPY | DMA_MODE32BIT);
-
-/*
- * Copy 'size' bytes from src to dest, in blocks of 16 bits (2 bytes).
- * size is in bytes and must be a multiple of 2.
- * Both src and dest must be aligned to 16 bits (2 bytes).
- * Returns 0 on failure, non-zero on success.
- */
-#define ds2_DMAcopy_16Bit(ch, dest, src, size)\
- _dmaCopy(ch, dest, src, size, DMA_MODECOPY | DMA_MODE16BIT)
-
-/*
- * Copy 'size' individual bytes (8 bits at a time) from src to dest.
- * Returns 0 on failure, non-zero on success.
- */
-#define ds2_DMAcopy_8Bit(ch, dest, src, size)\
- _dmaCopy(ch, dest, src, size, DMA_MODECOPY | DMA_MODE8BIT)
-
-
-
-//Stop DMA transfer
-extern void dma_stop(int ch);
-
-#define ds2_DMA_stop(ch)\
- dma_stop(ch)
-
-//Wait DMA transfer over
-extern int dma_wait_finish(int ch);
-
-#define ds2_DMA_wait(ch)\
- dma_wait_finish(ch)
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //__DMA_H__
-
diff --git a/sdk-modifications/libsrc/fs/bit_ops.h b/sdk-modifications/libsrc/fs/bit_ops.h
deleted file mode 100755
index f823db7..0000000
--- a/sdk-modifications/libsrc/fs/bit_ops.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- bit_ops.h
- Functions for dealing with conversion of data between types
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-*/
-
-#ifndef _BIT_OPS_H
-#define _BIT_OPS_H
-
-/*-----------------------------------------------------------------
-Functions to deal with little endian values stored in u8 arrays
------------------------------------------------------------------*/
-static inline u16 u8array_to_u16 (const u8* item, int offset) {
- return ( item[offset] | (item[offset + 1] << 8));
-}
-
-static inline u32 u8array_to_u32 (const u8* item, int offset) {
- return ( item[offset] | (item[offset + 1] << 8) | (item[offset + 2] << 16) | (item[offset + 3] << 24));
-}
-
-static inline void u16_to_u8array (u8* item, int offset, u16 value) {
- item[offset] = (u8)value;
- item[offset + 1] = (u8)(value >> 8);
-}
-
-static inline void u32_to_u8array (u8* item, int offset, u32 value) {
- item[offset] = (u8)value;
- item[offset + 1] = (u8)(value >> 8);
- item[offset + 2] = (u8)(value >> 16);
- item[offset + 3] = (u8)(value >> 24);
-}
-
-#endif // _BIT_OPS_H
diff --git a/sdk-modifications/libsrc/fs/cache.c b/sdk-modifications/libsrc/fs/cache.c
deleted file mode 100755
index 2c66e1f..0000000
--- a/sdk-modifications/libsrc/fs/cache.c
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- cache.c
- The cache is not visible to the user. It should be flushed
- when any file is closed or changes are made to the filesystem.
-
- This cache implements a least-used-page replacement policy. This will
- distribute sectors evenly over the pages, so if less than the maximum
- pages are used at once, they should all eventually remain in the cache.
- This also has the benefit of throwing out old sectors, so as not to keep
- too many stale pages around.
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <string.h>
-
-#include "fs_common.h"
-#include "fs_cache.h"
-#include "disc_io/disc.h"
-
-#include "mem_allocate.h"
-
-#define CACHE_FREE 0xFFFFFFFF
-
-CACHE* _FAT_cache_constructor (u32 numberOfPages, const IO_INTERFACE* discInterface) {
- CACHE* cache;
- u32 i;
- CACHE_ENTRY* cacheEntries;
-
- if (numberOfPages < 2) {
- numberOfPages = 2;
- }
-
- cache = (CACHE*) _FAT_mem_allocate (sizeof(CACHE));
- if (cache == NULL) {
- return NULL;
- }
-
- cache->disc = discInterface;
- cache->numberOfPages = numberOfPages;
-
-
- cacheEntries = (CACHE_ENTRY*) _FAT_mem_allocate ( sizeof(CACHE_ENTRY) * numberOfPages);
- if (cacheEntries == NULL) {
- _FAT_mem_free (cache);
- return NULL;
- }
-
- for (i = 0; i < numberOfPages; i++) {
- cacheEntries[i].sector = CACHE_FREE;
- cacheEntries[i].count = 0;
- cacheEntries[i].dirty = 0;
- }
-
- cache->cacheEntries = cacheEntries;
-
- cache->pages = (u8*) _FAT_mem_allocate ( CACHE_PAGE_SIZE * numberOfPages);
- if (cache->pages == NULL) {
- _FAT_mem_free (cache->cacheEntries);
- _FAT_mem_free (cache);
- return NULL;
- }
-
- return cache;
-}
-
-void _FAT_cache_destructor (CACHE* cache) {
- // Clear out cache before destroying it
- _FAT_cache_flush(cache);
-
- // Free memory in reverse allocation order
- _FAT_mem_free (cache->pages);
- _FAT_mem_free (cache->cacheEntries);
- _FAT_mem_free (cache);
-
- return;
-}
-
-/*
-Retrieve a sector's page from the cache. If it is not found in the cache,
-load it into the cache and return the page it was loaded to.
-Return CACHE_FREE on error.
-*/
-static u32 _FAT_cache_getSector (CACHE* cache, u32 sector) {
- u32 i;
- CACHE_ENTRY* cacheEntries = cache->cacheEntries;
- u32 numberOfPages = cache->numberOfPages;
-
- u32 leastUsed = 0;
- u32 lowestCount = 0xFFFFFFFF;
-
- for (i = 0; (i < numberOfPages) && (cacheEntries[i].sector != sector); i++) {
- // While searching for the desired sector, also search for the leased used page
- if ( (cacheEntries[i].sector == CACHE_FREE) || (cacheEntries[i].count < lowestCount) ) {
- leastUsed = i;
- lowestCount = cacheEntries[i].count;
- }
- }
-
- // If it found the sector in the cache, return it
- if ((i < numberOfPages) && (cacheEntries[i].sector == sector)) {
- // Increment usage counter
- cacheEntries[i].count += 1;
- return i;
- }
-
- // If it didn't, replace the least used cache page with the desired sector
- if ((cacheEntries[leastUsed].sector != CACHE_FREE) && (0xC33CA55A == cacheEntries[leastUsed].dirty)) {
- // Write the page back to disc if it has been written to
- if (!_FAT_disc_writeSectors (cache->disc, cacheEntries[leastUsed].sector, 1, cache->pages + CACHE_PAGE_SIZE * leastUsed)) {
- return CACHE_FREE;
- }
- cacheEntries[leastUsed].dirty = 0;
- }
-
- // Load the new sector into the cache
- if (!_FAT_disc_readSectors (cache->disc, sector, 1, cache->pages + CACHE_PAGE_SIZE * leastUsed)) {
- return CACHE_FREE;
- }
- cacheEntries[leastUsed].sector = sector;
- // Increment the usage count, don't reset it
- // This creates a paging policy of least used PAGE, not sector
- cacheEntries[leastUsed].count += 1;
- return leastUsed;
-}
-
-/*
-Reads some data from a cache page, determined by the sector number
-*/
-bool _FAT_cache_readPartialSector (CACHE* cache, void* buffer, u32 sector, u32 offset, u32 size) {
- u32 page;
-
- if (offset + size > BYTES_PER_READ) {
- return false;
- }
-
- page = _FAT_cache_getSector (cache, sector);
- if (page == CACHE_FREE) {
- return false;
- }
-
- memcpy (buffer, cache->pages + (CACHE_PAGE_SIZE * page) + offset, size);
- return true;
-}
-
-/*
-Writes some data to a cache page, making sure it is loaded into memory first.
-*/
-bool _FAT_cache_writePartialSector (CACHE* cache, const void* buffer, u32 sector, u32 offset, u32 size) {
- u32 page;
-
- if (offset + size > BYTES_PER_READ) {
- return false;
- }
-
- page = _FAT_cache_getSector (cache, sector);
- if (page == CACHE_FREE) {
- return false;
- }
-
- memcpy (cache->pages + (CACHE_PAGE_SIZE * page) + offset, buffer, size);
- cache->cacheEntries[page].dirty = 0xC33CA55A;
-
- return true;
-}
-
-/*
-some where call _FAT_cache_writePartialSector to cache sector m , but later, another
-place(in fwrite function) directly write data to sector m, in this case, need to
-cancel the dirty state of sector m
-*/
-void _FAT_cache_writePartialSector_check (CACHE* cache, u32 sector, u32 num, const void* buffer)
-{
- u32 i, m;
- CACHE_ENTRY* cacheEntries = cache->cacheEntries;
- u32 numberOfPages = cache->numberOfPages;
-
- m = 0;
- while(m++ < num)
- {
- for (i = 0; i < numberOfPages; i++)
- {
- if(cacheEntries[i].sector == sector)
- break;
- }
-
- if(i >= numberOfPages)
- return;
-
- //cache the data
- memcpy (cache->pages + (CACHE_PAGE_SIZE * i), buffer, CACHE_PAGE_SIZE);
- //cancel the dirty state
- cache->cacheEntries[i].dirty = 0;
-
- sector += 1;
- buffer += CACHE_PAGE_SIZE;
- }
-}
-
-/*
-Writes some data to a cache page, zeroing out the page first
-*/
-bool _FAT_cache_eraseWritePartialSector (CACHE* cache, const void* buffer, u32 sector, u32 offset, u32 size) {
- u32 page;
-
- if (offset + size > BYTES_PER_READ) {
- return false;
- }
-
- page = _FAT_cache_getSector (cache, sector);
- if (page == CACHE_FREE) {
- return false;
- }
-
- memset (cache->pages + (CACHE_PAGE_SIZE * page), 0, CACHE_PAGE_SIZE);
- memcpy (cache->pages + (CACHE_PAGE_SIZE * page) + offset, buffer, size);
- cache->cacheEntries[page].dirty = 0xC33CA55A;
-
- return true;
-}
-
-
-/*
-Flushes all dirty pages to disc, clearing the dirty flag.
-Also resets all pages' page count to 0.
-*/
-bool _FAT_cache_flush (CACHE* cache) {
- u32 i;
-
- for (i = 0; i < cache->numberOfPages; i++) {
- if (0xC33CA55A == cache->cacheEntries[i].dirty) {
- if (!_FAT_disc_writeSectors (cache->disc, cache->cacheEntries[i].sector, 1, cache->pages + CACHE_PAGE_SIZE * i)) {
- return CACHE_FREE;
- }
- }
- cache->cacheEntries[i].count = 0;
- cache->cacheEntries[i].dirty = 0;
- }
-
- _FAT_disc_clearStatus( cache->disc );
- return true;
-}
-
-void _FAT_cache_invalidate (CACHE* cache) {
- int i;
- for (i = 0; i < cache->numberOfPages; i++) {
- cache->cacheEntries[i].sector = CACHE_FREE;
- cache->cacheEntries[i].count = 0;
- cache->cacheEntries[i].dirty = 0;
- }
-}
-
diff --git a/sdk-modifications/libsrc/fs/directory.c b/sdk-modifications/libsrc/fs/directory.c
deleted file mode 100755
index 124daf8..0000000
--- a/sdk-modifications/libsrc/fs/directory.c
+++ /dev/null
@@ -1,1035 +0,0 @@
-/*
- directory.c
- Reading, writing and manipulation of the directory structure on
- a FAT partition
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-08-14 - Chishm
- * entryFromPath correctly finds "" and "." now
-
- 2006-08-17 - Chishm
- * entryFromPath doesn't look for "" anymore - use "." to refer to the current directory
-
- 2006-08-19 - Chishm
- * Fixed entryFromPath bug when looking for "." in root directory
-
- 2006-10-01 - Chishm
- * Now clears the whole new cluster when linking in more clusters for a directory
-
- 2006-10-28 - Chishm
- * stat returns the hostType for the st_dev value
-*/
-//version 1.1
-//Note: fix bug in _FAT_directory_isValidAlias()
-
-#include <string.h>
-#include <ctype.h>
-
-#include "directory.h"
-#include "fs_common.h"
-#include "partition.h"
-#include "file_allocation_table.h"
-#include "bit_ops.h"
-#include "filetime.h"
-#include "fs_unicode.h"
-
-// Directory entry codes
-#define DIR_ENTRY_LAST 0x00
-#define DIR_ENTRY_FREE 0xE5
-
-
-// Long file name directory entry
-enum LFN_offset {
- LFN_offset_ordinal = 0x00, // Position within LFN
- LFN_offset_char0 = 0x01,
- LFN_offset_char1 = 0x03,
- LFN_offset_char2 = 0x05,
- LFN_offset_char3 = 0x07,
- LFN_offset_char4 = 0x09,
- LFN_offset_flag = 0x0B, // Should be equal to ATTRIB_LFN
- LFN_offset_reserved1 = 0x0C, // Always 0x00
- LFN_offset_checkSum = 0x0D, // Checksum of short file name (alias)
- LFN_offset_char5 = 0x0E,
- LFN_offset_char6 = 0x10,
- LFN_offset_char7 = 0x12,
- LFN_offset_char8 = 0x14,
- LFN_offset_char9 = 0x16,
- LFN_offset_char10 = 0x18,
- LFN_offset_reserved2 = 0x1A, // Always 0x0000
- LFN_offset_char11 = 0x1C,
- LFN_offset_char12 = 0x1E
-};
-const int LFN_offset_table[13]={0x01,0x03,0x05,0x07,0x09,0x0E,0x10,0x12,0x14,0x16,0x18,0x1C,0x1E};
-
-#define LFN_END 0x40
-#define LFN_DEL 0x80
-
-static char* strupr(char* a)
-{
- char *str;
-
- str = a;
- while(*str)
- {
- if(*str >= 'a' && *str <= 'z') *str -= 0x20;
- str += 1;
- }
-
- return a;
-}
-
-static char* strlwr(char *a){
- char *str;
-
- str = a;
- while(*str)
- {
- if((*str) >= 'A' && (*str) <= 'Z') (*str) = ((*str) -'A' + 'a');
- str++;
- }
- return a;
-}
-
-bool _FAT_directory_isValidLfn (const char* name) {
- u32 i;
- u32 nameLength;
- // Make sure the name is short enough to be valid
- if ( strnlen(name, MAX_FILENAME_LENGTH) >= MAX_FILENAME_LENGTH) {
- return false;
- }
- // Make sure it doesn't contain any invalid characters
- if (strpbrk (name, "\\/:*?\"<>|") != NULL) {
- return false;
- }
-
- nameLength = strnlen(name, MAX_FILENAME_LENGTH);
- // Make sure the name doesn't contain any control codes
- for (i = 0; i < nameLength; i++) {
- if ((unsigned char)name[i] < 0x20) {
- return false;
- }
- }
- // Otherwise it is valid
- return true;
-}
-bool _FAT_directory_isValidAlias (const char* name) {
- //return false;//disables this function to preserve file name casing
-
- u32 i;
- u32 nameLength;
- const char* dot;
-
- // Make sure the name is short enough to be valid
- if ( strnlen(name, MAX_ALIAS_LENGTH) >= MAX_ALIAS_LENGTH) {
- return false;
- }
- // Make sure it doesn't contain any invalid characters
- if (strpbrk (name, "\\/:;*?\"<>|&+,=[]") != NULL) {
- return false;
- }
-
- //
- if (strpbrk (name, " ") != NULL) {
- return false;
- }
-
- nameLength = strnlen(name, MAX_ALIAS_LENGTH);
- // Make sure the name doesn't contain any control codes
- //if name isn't all capitals, then it is not a valid short name
- for (i = 0; i < nameLength; i++) {
- if (name[i] > 0x5A && name[i]!= 0x20) {
- return false;
- }
- }
-
- dot = strchr ( name, '.');
- // Make sure there is only one '.'
- if ((dot != NULL) && (strrchr ( name, '.') != dot)) {
- return false;
- }
- // If there is a '.':
- if (dot != NULL) {
- // Make sure the filename portion is 1-8 characters long
- if (((dot - 1 - name) > 8) || ((dot - 1 - name) < 1)) {
- return false;
- }
- // Make sure the extension is 1-3 characters long, if it exists
- if ((strnlen(dot + 1, MAX_ALIAS_LENGTH) > 3) || (strnlen(dot + 1, MAX_ALIAS_LENGTH) < 1)) {
- return false;
- }
- } else {
- // Make sure the entire file name is 1-8 characters long
- if ((nameLength > 8) || (nameLength < 1)) {
- return false;
- }
- }
-
- // Since we made it through all those tests, it must be valid
- return true;
-}
-
-static bool _FAT_directory_entryGetAlias (const u8* entryData, char* destName) {
- int i=0;
- int j=0;
-
- destName[0] = '\0';
- if (entryData[0] != DIR_ENTRY_FREE) {
- if (entryData[0] == '.') {
- destName[0] = '.';
- if (entryData[1] == '.') {
- destName[1] = '.';
- destName[2] = '\0';
- } else {
- destName[1] = '\0';
- }
- } else {
- // Copy the filename from the dirEntry to the string
- for (i = 0; (i < 8) && (entryData[DIR_ENTRY_name + i] != ' '); i++) {
- destName[i] = entryData[DIR_ENTRY_name + i];
- }
- // Copy the extension from the dirEntry to the string
- if (entryData[DIR_ENTRY_extension] != ' ') {
- destName[i++] = '.';
- for ( j = 0; (j < 3) && (entryData[DIR_ENTRY_extension + j] != ' '); j++) {
- destName[i++] = entryData[DIR_ENTRY_extension + j];
- }
- }
- destName[i] = '\0';
- }
- }
-
- return (destName[0] != '\0');
-}
-
-u32 _FAT_directory_entryGetCluster (const u8* entryData) {
- return u8array_to_u16(entryData,DIR_ENTRY_cluster) | (u8array_to_u16(entryData, DIR_ENTRY_clusterHigh) << 16);
-}
-
-static bool _FAT_directory_incrementDirEntryPosition (PARTITION* partition, DIR_ENTRY_POSITION* entryPosition, bool extendDirectory) {
- DIR_ENTRY_POSITION position;
- position = *entryPosition;
- u32 tempCluster;
-
- // Increment offset, wrapping at the end of a sector
- ++ position.offset;
- if (position.offset == BYTES_PER_READ / DIR_ENTRY_DATA_SIZE) {
- position.offset = 0;
- // Increment sector when wrapping
- ++ position.sector;
- // But wrap at the end of a cluster
- if ((position.sector == partition->sectorsPerCluster) && (position.cluster != FAT16_ROOT_DIR_CLUSTER)) {
- position.sector = 0;
- // Move onto the next cluster, making sure there is another cluster to go to
- tempCluster = _FAT_fat_nextCluster(partition, position.cluster);
- if (tempCluster == CLUSTER_EOF) {
- if (extendDirectory) {
- tempCluster = _FAT_fat_linkFreeClusterCleared (partition, position.cluster);
- if (tempCluster == CLUSTER_FREE) {
- return false; // This will only happen if the disc is full
- }
- } else {
- return false; // Got to the end of the directory, not extending it
- }
- }
- position.cluster = tempCluster;
- } else if ((position.cluster == FAT16_ROOT_DIR_CLUSTER) && (position.sector == (partition->dataStart - partition->rootDirStart))) {
- return false; // Got to end of root directory, can't extend it
- }
- }
- *entryPosition = position;
- return true;
-}
-
-bool _FAT_directory_getNextEntry (PARTITION* partition, DIR_ENTRY* entry) {
- DIR_ENTRY_POSITION entryStart;
- DIR_ENTRY_POSITION entryEnd;
-
- u8 entryData[0x20];
-
- bool notFound, found;
- u32 maxSectors;
- int lfnPos;
- u8 lfnChkSum, chkSum;
- char* filename;
- u16 unicodeFilename[256];
- bool lfnExists;
-
- int i;
-
- lfnChkSum = 0;
-
- entryStart = entry->dataEnd;
-
- // Make sure we are using the correct root directory, in case of FAT32
- if (entryStart.cluster == FAT16_ROOT_DIR_CLUSTER) {
- entryStart.cluster = partition->rootDirCluster;
- }
-
- entryEnd = entryStart;
- filename = entry->d_name;
- //unicodeFilename = entry->unicodeFilename;
- memset( unicodeFilename, 0, 512 );
-
- // Can only be FAT16_ROOT_DIR_CLUSTER if it is the root directory on a FAT12 or FAT16 partition
- if (entryStart.cluster == FAT16_ROOT_DIR_CLUSTER) {
- maxSectors = partition->dataStart - partition->rootDirStart;
- } else {
- maxSectors = partition->sectorsPerCluster;
- }
-
- lfnExists = false;
-
- found = false;
- notFound = false;
-
- while (!found && !notFound) {
- if (_FAT_directory_incrementDirEntryPosition (partition, &entryEnd, false) == false) {
- notFound = true;
- }
-
- _FAT_cache_readPartialSector (partition->cache, entryData, _FAT_fat_clusterToSector(partition, entryEnd.cluster) + entryEnd.sector, entryEnd.offset * DIR_ENTRY_DATA_SIZE, DIR_ENTRY_DATA_SIZE);
-
- if (entryData[DIR_ENTRY_attributes] == ATTRIB_LFN) {
- // It's an LFN
- if (entryData[LFN_offset_ordinal] & LFN_DEL) {
- lfnExists = false;
- } else if (entryData[LFN_offset_ordinal] & LFN_END) {
- // Last part of LFN, make sure it isn't deleted using previous if(Thanks MoonLight)
- entryStart = entryEnd; // This is the start of a directory entry
- lfnExists = true;
- //filename[(entryData[LFN_offset_ordinal] & ~LFN_END) * 13] = '\0'; // Set end of lfn to null character
- unicodeFilename[(entryData[LFN_offset_ordinal] & ~LFN_END) * 13] = 0x0000;
- lfnChkSum = entryData[LFN_offset_checkSum];
- } if (lfnChkSum != entryData[LFN_offset_checkSum]) {
- lfnExists = false;
- }
- //unicodeFilename[0] = 0x0000;
- if (lfnExists) {
- lfnPos = ((entryData[LFN_offset_ordinal] & ~LFN_END) - 1) * 13;
- for (i = 0; i < 13; i++) {
- unicodeFilename[lfnPos + i] = u8array_to_u16( entryData, LFN_offset_table[i]);
- // | entryData[LFN_offset_table[i]+1]<<8; // modify this for unicode support;
- }
- }
- } else if (entryData[DIR_ENTRY_attributes] & ATTRIB_VOL) {
- // This is a volume name, don't bother with it
- } else if (entryData[0] == DIR_ENTRY_LAST) {
- notFound = true;
- } else if ((entryData[0] != DIR_ENTRY_FREE) && (entryData[0] > 0x20) && !(entryData[DIR_ENTRY_attributes] & ATTRIB_VOL)) {
- if (lfnExists) {
- // Calculate file checksum
- chkSum = 0;
- for (i=0; i < 11; i++) {
- // NOTE: The operation is an unsigned char rotate right
- chkSum = ((chkSum & 1) ? 0x80 : 0) + (chkSum >> 1) + entryData[i];
- }
- if (chkSum != lfnChkSum) {
- lfnExists = false;
- //filename[0] = '\0';
- //unicodeFilename[0] = 0x0000; // move this line to below(1)
- }
- }
- //short name
- if (!lfnExists) {
- entryStart = entryEnd;
- unicodeFilename[0] = 0x0000; // (1)make sure clear previous search junk
- // get alias anyway
- _FAT_directory_entryGetAlias (entryData, filename);
- strlwr(filename);//convert to lowercase characters
- }
- //long name
- else
- {
- _FAT_unicode16_to_utf8 (unicodeFilename, filename);
- }
-
- found = true;
- }
- }
-
- // If no file is found, return false
- if (notFound) {
- return false;
- } else {
- // Fill in the directory entry struct
- entry->dataStart = entryStart;
- entry->dataEnd = entryEnd;
- memcpy (entry->entryData, entryData, DIR_ENTRY_DATA_SIZE);
- return true;
- }
-}
-
-bool _FAT_directory_getFirstEntry (PARTITION* partition, DIR_ENTRY* entry, u32 dirCluster) {
- entry->dataStart.cluster = dirCluster;
- entry->dataStart.sector = 0;
- entry->dataStart.offset = -1; // Start before the beginning of the directory
-
- entry->dataEnd = entry->dataStart;
-
- return _FAT_directory_getNextEntry (partition, entry);
-}
-
-bool _FAT_directory_getRootEntry (PARTITION* partition, DIR_ENTRY* entry) {
- entry->dataStart.cluster = 0;
- entry->dataStart.sector = 0;
- entry->dataStart.offset = 0;
-
- entry->dataEnd = entry->dataStart;
-
- memset (entry->d_name, '\0', MAX_FILENAME_LENGTH);
- entry->d_name[0] = '.';
-
- memset (entry->entryData, 0, DIR_ENTRY_DATA_SIZE);
- memset (entry->entryData, ' ', 11);
- entry->entryData[0] = '.';
-
- entry->entryData[DIR_ENTRY_attributes] = ATTRIB_DIR;
-
- u16_to_u8array (entry->entryData, DIR_ENTRY_cluster, partition->rootDirCluster);
- u16_to_u8array (entry->entryData, DIR_ENTRY_clusterHigh, partition->rootDirCluster >> 16);
-
- return true;
-}
-
-bool _FAT_directory_entryFromPosition (PARTITION* partition, DIR_ENTRY* entry) {
- DIR_ENTRY_POSITION entryStart;
- DIR_ENTRY_POSITION entryEnd;
- entryStart = entry->dataStart;
- entryEnd = entry->dataEnd;
- bool entryStillValid;
- bool finished;
-
- int i;
- int lfnPos;
-
- u8 entryData[DIR_ENTRY_DATA_SIZE];
-
- memset (entry->d_name, '\0', MAX_FILENAME_LENGTH);
-
- // Create an empty directory entry to overwrite the old ones with
- for ( entryStillValid = true, finished = false;
- entryStillValid && !finished;
- entryStillValid = _FAT_directory_incrementDirEntryPosition (partition, &entryStart, false))
- {
- _FAT_cache_readPartialSector (partition->cache, entryData,
- _FAT_fat_clusterToSector(partition, entryStart.cluster) + entryStart.sector,
- entryStart.offset * DIR_ENTRY_DATA_SIZE, DIR_ENTRY_DATA_SIZE);
-
- if ((entryStart.cluster == entryEnd.cluster)
- && (entryStart.sector == entryEnd.sector)
- && (entryStart.offset == entryEnd.offset)) {
- // Copy the entry data and stop, since this is the last section of the directory entry
- memcpy (entry->entryData, entryData, DIR_ENTRY_DATA_SIZE);
- finished = true;
- } else {
- // Copy the long file name data
- lfnPos = ((entryData[LFN_offset_ordinal] & ~LFN_END) - 1) * 13;
- for (i = 0; i < 13; i++) {
- entry->d_name[lfnPos + i] = entryData[LFN_offset_table[i]]; // modify this for unicode support;
- }
- }
- }
-
- if (!entryStillValid) {
- return false;
- }
-
- if ((entryStart.cluster == entryEnd.cluster)
- && (entryStart.sector == entryEnd.sector)
- && (entryStart.offset == entryEnd.offset)) {
- // Since the entry doesn't have a long file name, extract the short filename
- if (!_FAT_directory_entryGetAlias (entry->entryData, entry->d_name)) {
- return false;
- }
- }
-
- return true;
-}
-
-bool _FAT_directory_entryFromPath (PARTITION* partition, DIR_ENTRY* entry, const char* path, const char* pathEnd) {
- size_t dirnameLength;
- const char* pathPosition;
- const char* nextPathPosition;
-
- //size_t uniDirnameLength;
- //u16 uniPath[MAX_FILENAME_LENGTH];
- //const u16 * uniPathPosition;
- //const u16 * uniNextPathPosition;
-
- u32 dirCluster;
- bool foundFile;
-
- //char alias[MAX_ALIAS_LENGTH];
-
- bool found, notFound;
-
- //_FAT_utf8_to_unicode16( path, uniPath );
- pathPosition = path;
- //uniPathPosition = uniPath;
-
- found = false;
- notFound = false;
-
- if (pathEnd == NULL) {
- // Set pathEnd to the end of the path string
- pathEnd = strchr (path, '\0');
- }
-
- if (pathPosition[0] == DIR_SEPARATOR) {
- // Start at root directory
- dirCluster = partition->rootDirCluster;
- // Consume separator(s)
- while (pathPosition[0] == DIR_SEPARATOR) {
- pathPosition++;
- }
-
- //while (uniPathPosition[0] == (unsigned short)DIR_SEPARATOR) {
- // uniPathPosition++;
- //}
-
- if (pathPosition >= pathEnd) {
- _FAT_directory_getRootEntry (partition, entry);
- found = true;
- }
- } else {
- // Start in current working directory
- dirCluster = partition->cwdCluster;
- }
-
- // If the path is only specifying a directory in the form "."
- // and this is the root directory, return it
- //if ((dirCluster == partition->rootDirCluster) && (strncasecmp(".", pathPosition, 2) == 0)) {
- if ((dirCluster == partition->rootDirCluster) && strlen(pathPosition) == 1 && (strcasecmp(".", pathPosition) == 0)) {
- _FAT_directory_getRootEntry (partition, entry);
- found = true;
- }
-
- while (!found && !notFound) {
- // Get the name of the next required subdirectory within the path
- nextPathPosition = strchr (pathPosition, DIR_SEPARATOR);
- //uniNextPathPosition = _unistrchr( uniPathPosition, (unsigned short)DIR_SEPARATOR );
- if (nextPathPosition != NULL) {
- dirnameLength = nextPathPosition - pathPosition;
- } else {
- dirnameLength = strlen(pathPosition);
- }
- //if (uniNextPathPosition != 0x0000) {
- // uniDirnameLength = uniNextPathPosition - uniPathPosition;
- //} else {
- // uniDirnameLength = _unistrnlen(uniPathPosition, MAX_FILENAME_LENGTH);
- //}
-
- if (dirnameLength > MAX_FILENAME_LENGTH) {
- // The path is too long to bother with
- return false;
- }
- //if( uniDirnameLength > MAX_FILENAME_LENGTH ) {
- // return false;
- //}
-
- // Look for the directory within the path
- foundFile = _FAT_directory_getFirstEntry (partition, entry, dirCluster);
-
- while (foundFile && !found && !notFound) { // It hasn't already found the file
- // Check if the filename matches
- //if ((uniDirnameLength == _unistrnlen(entry->unicodeFilename, MAX_FILENAME_LENGTH))
- // && (_unistrncmp(entry->unicodeFilename, uniPathPosition, uniDirnameLength) == 0)) {
- // found = true;
- //}
-
- //if(!strncasecmp(entry->d_name, pathPosition, dirnameLength))
- if(strlen(entry->d_name) == dirnameLength && !strncasecmp(entry->d_name, pathPosition, dirnameLength))
- found = true;
-
- // Check if the alias matches
- //_FAT_directory_entryGetAlias (entry->entryData, alias);
- //if ((dirnameLength == strnlen(alias, MAX_ALIAS_LENGTH))
- // && (strncasecmp(alias, pathPosition, dirnameLength) == 0)) {
- // found = true;
- //}
-
- if (found && !(entry->entryData[DIR_ENTRY_attributes] & ATTRIB_DIR) && (nextPathPosition != NULL)) {
- // Make sure that we aren't trying to follow a file instead of a directory in the path
- found = false;
- }
-
- if (!found) {
- foundFile = _FAT_directory_getNextEntry (partition, entry);
- }
- }
-
- if (!foundFile) {
- // Check that the search didn't get to the end of the directory
- notFound = true;
- found = false;
- } else if ((nextPathPosition == NULL) || (nextPathPosition >= pathEnd)) {
- // Check that we reached the end of the path
- found = true;
- } else if (entry->entryData[DIR_ENTRY_attributes] & ATTRIB_DIR) {
- dirCluster = _FAT_directory_entryGetCluster (entry->entryData);
- pathPosition = nextPathPosition;
- //uniPathPosition = uniNextPathPosition;
- // Consume separator(s)
- while (pathPosition[0] == DIR_SEPARATOR) {
- pathPosition++;
- }
- //while (uniPathPosition[0] == (unsigned short)DIR_SEPARATOR) {
- // uniPathPosition++;
- //}
- // The requested directory was found
- if (pathPosition >= pathEnd) {
- found = true;
- } else {
- found = false;
- }
- }
- }
-
- if (found && !notFound) {
- return true;
- } else {
- return false;
- }
-}
-
-bool _FAT_directory_removeEntry (PARTITION* partition, DIR_ENTRY* entry) {
- DIR_ENTRY_POSITION entryStart;
- DIR_ENTRY_POSITION entryEnd;
- entryStart = entry->dataStart;
- entryEnd = entry->dataEnd;
- bool entryStillValid;
- bool finished;
-
- u8 entryData[DIR_ENTRY_DATA_SIZE];
-
- // Create an empty directory entry to overwrite the old ones with
- for ( entryStillValid = true, finished = false;
- entryStillValid && !finished;
- entryStillValid = _FAT_directory_incrementDirEntryPosition (partition, &entryStart, false))
- {
- _FAT_cache_readPartialSector (partition->cache, entryData, _FAT_fat_clusterToSector(partition, entryStart.cluster) + entryStart.sector, entryStart.offset * DIR_ENTRY_DATA_SIZE, DIR_ENTRY_DATA_SIZE);
- entryData[0] = DIR_ENTRY_FREE;
- _FAT_cache_writePartialSector (partition->cache, entryData, _FAT_fat_clusterToSector(partition, entryStart.cluster) + entryStart.sector, entryStart.offset * DIR_ENTRY_DATA_SIZE, DIR_ENTRY_DATA_SIZE);
- if ((entryStart.cluster == entryEnd.cluster) && (entryStart.sector == entryEnd.sector) && (entryStart.offset == entryEnd.offset)) {
- finished = true;
- }
- }
-
- if (!entryStillValid) {
- return false;
- }
-
- return true;
-}
-
-static bool _FAT_directory_findEntryGap (PARTITION* partition, DIR_ENTRY* entry, u32 dirCluster, u32 size) {
- DIR_ENTRY_POSITION gapStart;
- DIR_ENTRY_POSITION gapEnd;
-
- u8 entryData[DIR_ENTRY_DATA_SIZE];
-
- u32 dirEntryRemain;
-
- bool endOfDirectory, entryStillValid;
-
- // Scan Dir for free entry
- gapEnd.offset = 0;
- gapEnd.sector = 0;
- gapEnd.cluster = dirCluster;
-
- gapStart = gapEnd;
-
- entryStillValid = true;
- dirEntryRemain = size;
- endOfDirectory = false;
-
- while (entryStillValid && !endOfDirectory && (dirEntryRemain > 0)) {
- _FAT_cache_readPartialSector (partition->cache, entryData, _FAT_fat_clusterToSector(partition, gapEnd.cluster) + gapEnd.sector, gapEnd.offset * DIR_ENTRY_DATA_SIZE, DIR_ENTRY_DATA_SIZE);
- if (entryData[0] == DIR_ENTRY_LAST) {
- gapStart = gapEnd;
- -- dirEntryRemain;
- endOfDirectory = true;
- } else if (entryData[0] == DIR_ENTRY_FREE) {
- if (dirEntryRemain == size) {
- gapStart = gapEnd;
- }
- -- dirEntryRemain;
- } else {
- dirEntryRemain = size;
- }
-
- if (!endOfDirectory && (dirEntryRemain > 0)) {
- entryStillValid = _FAT_directory_incrementDirEntryPosition (partition, &gapEnd, true);
- }
- }
-
- // Make sure the scanning didn't fail
- if (!entryStillValid) {
- return false;
- }
-
- // Save the start entry, since we know it is valid
- entry->dataStart = gapStart;
-
- if (endOfDirectory) {
- memset (entryData, DIR_ENTRY_LAST, DIR_ENTRY_DATA_SIZE);
- dirEntryRemain += 1; // Increase by one to take account of End Of Directory Marker
- while ((dirEntryRemain > 0) && entryStillValid) {
- // Get the gapEnd before incrementing it, so the second to last one is saved
- entry->dataEnd = gapEnd;
- // Increment gapEnd, moving onto the next entry
- entryStillValid = _FAT_directory_incrementDirEntryPosition (partition, &gapEnd, true);
- -- dirEntryRemain;
- // Fill the entry with blanks
- _FAT_cache_writePartialSector (partition->cache, entryData, _FAT_fat_clusterToSector(partition, gapEnd.cluster) + gapEnd.sector, gapEnd.offset * DIR_ENTRY_DATA_SIZE, DIR_ENTRY_DATA_SIZE);
- }
- if (!entryStillValid) {
- return false;
- }
- } else {
- entry->dataEnd = gapEnd;
- }
-
- return true;
-}
-
-static bool _FAT_directory_entryExists (PARTITION* partition, const char* name, u32 dirCluster) {
- DIR_ENTRY tempEntry;
- bool foundFile;
- //char alias[MAX_ALIAS_LENGTH];
- u32 dirnameLength;
- //u16 unicodeName[MAX_FILENAME_LENGTH];
-
- dirnameLength = strnlen(name, MAX_FILENAME_LENGTH);
-
- if (dirnameLength >= MAX_FILENAME_LENGTH) {
- return false;
- }
-
- //_FAT_utf8_to_unicode16( name, unicodeName );
-
- // Make sure the entry doesn't already exist
- foundFile = _FAT_directory_getFirstEntry (partition, &tempEntry, dirCluster);
-
- while (foundFile) { // It hasn't already found the file
- // Check if the filename matches
- //if (/*(dirnameLength == _unistrnlen(tempEntry.unicodeFilename, MAX_FILENAME_LENGTH))*/
- // //&& (strcasecmp(tempEntry.filename, name) == 0)) {
- // /*&&*/ (_unistrncmp( unicodeName, tempEntry.unicodeFilename, MAX_FILENAME_LENGTH ) == 0 ))
- //{
- // return true;
- //}
- //if(!strncasecmp(name, tempEntry.d_name, dirnameLength))
- if(!strcasecmp(name, tempEntry.d_name))
- return true;
-
- // Check if the alias matches
- //_FAT_directory_entryGetAlias (tempEntry.entryData, alias);
- //if ((dirnameLength == strnlen(alias, MAX_ALIAS_LENGTH))
- // && (strcasecmp(alias, name) == 0)) {
- // return true;
- //}
- foundFile = _FAT_directory_getNextEntry (partition, &tempEntry);
- }
- return false;
-}
-
-//a fix for checking if a short file name is already in use.
-static bool _FAT_directory_entryExistsSFN (PARTITION* partition, const char* name, u32 dirCluster) {
- DIR_ENTRY tempEntry;
- bool foundFile;
- char alias[MAX_ALIAS_LENGTH];
- u32 dirnameLength;
-
- dirnameLength = strnlen(name, MAX_FILENAME_LENGTH);
-
- if (dirnameLength >= MAX_FILENAME_LENGTH) {
- return false;
- }
-
-
- // Make sure the entry doesn't already exist
- foundFile = _FAT_directory_getFirstEntry (partition, &tempEntry, dirCluster);
-
- while (foundFile) { // It hasn't already found the file
- if(!strcasecmp(name, tempEntry.d_name))
- return true;
-
- // Check if the alias matches
- _FAT_directory_entryGetAlias (tempEntry.entryData, alias);
- if ((dirnameLength == strnlen(alias, MAX_ALIAS_LENGTH))
- && (strcasecmp(alias, name) == 0)) {
- return true;
- }
- foundFile = _FAT_directory_getNextEntry (partition, &tempEntry);
- }
- return false;
-}
-
-bool _FAT_directory_addEntry (PARTITION* partition, DIR_ENTRY* entry, u32 dirCluster) {
- u32 entrySize;
- u8 lfnEntry[DIR_ENTRY_DATA_SIZE];
- s32 i,j; // Must be signed for use when decrementing in for loop
- char *tmpCharPtr;
- DIR_ENTRY_POSITION curEntryPos;
- bool entryStillValid;
- u8 aliasCheckSum = 0;
- char alias [MAX_ALIAS_LENGTH];
- u16 unicodeFilename[256];
-
- // Make sure the filename is not 0 length
- if (strnlen (entry->d_name, MAX_FILENAME_LENGTH) < 1) {
- return false;
- }
- // Make sure the filename is at least a valid LFN
- if ( !(_FAT_directory_isValidLfn (entry->d_name))) {
- return false;
- }
-
- // Remove trailing spaces
- for (i = strlen (entry->d_name) - 1; (i > 0) && (entry->d_name[i] == ' '); --i) {
- entry->d_name[i] = '\0';
- }
- // Remove leading spaces
- for (i = 0; (i < strlen (entry->d_name)) && (entry->d_name[i] == ' '); ++i) ;
- if (i > 0) {
- memmove (entry->d_name, entry->d_name + i, strlen (entry->d_name + i));
- }
-
- // Remove junk in filename
- i = strlen (entry->d_name);
- memset (entry->d_name + i, '\0', MAX_FILENAME_LENGTH - i);
-
- // Make sure the entry doesn't already exist
- if (_FAT_directory_entryExists (partition, entry->d_name, dirCluster)) {
- return false;
- }
-
- // Clear out alias, so we can generate a new one
- memset (entry->entryData, ' ', 11);
-
- if ( strncmp(entry->d_name, ".", MAX_FILENAME_LENGTH) == 0) {
- // "." entry
- entry->entryData[0] = '.';
- entrySize = 1;
- } else if ( strncmp(entry->d_name, "..", MAX_FILENAME_LENGTH) == 0) {
- // ".." entry
- entry->entryData[0] = '.';
- entry->entryData[1] = '.';
- entrySize = 1;
- }else if (_FAT_directory_isValidAlias (entry->d_name)) {
- entrySize = 1;
- // Copy into alias
- for (i = 0, j = 0; (j < 8) && (entry->d_name[i] != '.') && (entry->d_name[i] != '\0'); i++, j++) {
- entry->entryData[j] = entry->d_name[i];
- }
- while (j < 8) {
- entry->entryData[j] = ' ';
- ++ j;
- }
- if (entry->d_name[i] == '.') {
- // Copy extension
- ++ i;
- while ((entry->d_name[i] != '\0') && (j < 11)) {
- entry->entryData[j] = entry->d_name[i];
- ++ i;
- ++ j;
- }
- }
- while (j < 11) {
- entry->entryData[j] = ' ';
- ++ j;
- }
- // Short filename
- strupr (entry->entryData);
- }else {
- // Long filename needed
- //memset( entry->unicodeFilename, 0, 512 );
- //_FAT_utf8_to_unicode16( (const char*)entry->d_name, entry->unicodeFilename );
- memset( unicodeFilename, 0, 512 );
- _FAT_utf8_to_unicode16( (const char*)entry->d_name, unicodeFilename );
-
- //entrySize = ((strnlen (entry->filename, MAX_FILENAME_LENGTH) + LFN_ENTRY_LENGTH - 1) / LFN_ENTRY_LENGTH) + 1;
- //entrySize = ((_unistrnlen( entry->unicodeFilename, MAX_FILENAME_LENGTH ) + LFN_ENTRY_LENGTH - 1) / LFN_ENTRY_LENGTH) + 1;
- entrySize = ((_unistrnlen( unicodeFilename, MAX_FILENAME_LENGTH ) + LFN_ENTRY_LENGTH - 1) / LFN_ENTRY_LENGTH) + 1;
-
- // Generate alias
- tmpCharPtr = strrchr (entry->d_name, '.');
- if (tmpCharPtr == NULL) {
- tmpCharPtr = strrchr (entry->d_name, '\0');
- }
- for (i = 0, j = 0; (j < 6) && (entry->d_name + i < tmpCharPtr); i++) {
- if ( _uniisalnum((u8)(entry->d_name[i]))) {
- alias[j] = entry->d_name[i];
- ++ j;
- }
- }
- while (j < 8) {
- alias[j] = '_';
- ++ j;
- }
- tmpCharPtr = strrchr (entry->d_name, '.');
- if (tmpCharPtr != NULL) {
- alias[8] = '.';
- // Copy extension
- while ((tmpCharPtr != '\0') && (j < 12)) {
- alias[j] = tmpCharPtr[0];
- ++ tmpCharPtr;
- ++ j;
- }
- alias[j] = '\0';
- } else {
- for (j = 8; j < MAX_ALIAS_LENGTH; j++) {
- alias[j] = '\0';
- }
- }
-
- // Get a valid tail number
- alias[5] = '~';
- i = 0;
- do {
- i++;
- alias[6] = '0' + ((i / 10) % 10); // 10's digit
- alias[7] = '0' + (i % 10); // 1's digit
- } while (_FAT_directory_entryExistsSFN (partition, alias, dirCluster) && (i < 100));
- if (i == 100) {
- // Couldn't get a tail number
- return false;
- }
-
- // Make it upper case
- strupr (alias);
-
- // Now copy it into the directory entry data
- memcpy (entry->entryData, alias, 8);
- memcpy (entry->entryData + 8, alias + 9, 3);
- for (i = 0; i < 10; i++) {
- if (entry->entryData[i] < 0x20) {
- // Replace null and control characters with spaces
- entry->entryData[i] = 0x20;
- }
- }
- // Generate alias checksum
- for (i=0; i < 11; i++)
- {
- // NOTE: The operation is an unsigned char rotate right
- aliasCheckSum = ((aliasCheckSum & 1) ? 0x80 : 0) + (aliasCheckSum >> 1) + entry->entryData[i];
- }
-
- }
-
- // Find or create space for the entry
- if (_FAT_directory_findEntryGap (partition, entry, dirCluster, entrySize) == false) {
- return false;
- }
-
- // Write out directory entry
- curEntryPos = entry->dataStart;
-
- for (entryStillValid = true, i = entrySize; entryStillValid && i > 0;
- entryStillValid = _FAT_directory_incrementDirEntryPosition (partition, &curEntryPos, false), -- i )
- {
- if (i > 1) {
- // Long filename entry
- lfnEntry[LFN_offset_ordinal] = (i - 1) | (i == entrySize ? LFN_END : 0);
- for (j = 0; j < 13; j++) {
- //if (entry->unicodeFilename[(i - 2) * 13 + j] == '\0') {
- if (unicodeFilename[(i - 2) * 13 + j] == '\0') {
- //if ((j > 1) && (entry->unicodeFilename[(i - 2) * 13 + (j-1)] == '\0')) {
- if ((j > 1) && (unicodeFilename[(i - 2) * 13 + (j-1)] == '\0')) {
- u16_to_u8array (lfnEntry, LFN_offset_table[j], 0xffff); // Padding
- } else {
- u16_to_u8array (lfnEntry, LFN_offset_table[j], 0x0000); // Terminating null character
- }
- } else {
- //u16_to_u8array (lfnEntry, LFN_offset_table[j], entry->unicodeFilename[(i - 2) * 13 + j]);
- u16_to_u8array (lfnEntry, LFN_offset_table[j], unicodeFilename[(i - 2) * 13 + j]);
- }
- }
-
- lfnEntry[LFN_offset_checkSum] = aliasCheckSum;
- lfnEntry[LFN_offset_flag] = ATTRIB_LFN;
- lfnEntry[LFN_offset_reserved1] = 0;
- u16_to_u8array (lfnEntry, LFN_offset_reserved2, 0);
- _FAT_cache_writePartialSector (partition->cache, lfnEntry, _FAT_fat_clusterToSector(partition, curEntryPos.cluster) + curEntryPos.sector, curEntryPos.offset * DIR_ENTRY_DATA_SIZE, DIR_ENTRY_DATA_SIZE);
- } else {
- // Alias & file data
- _FAT_cache_writePartialSector (partition->cache, entry->entryData, _FAT_fat_clusterToSector(partition, curEntryPos.cluster) + curEntryPos.sector, curEntryPos.offset * DIR_ENTRY_DATA_SIZE, DIR_ENTRY_DATA_SIZE);
- }
- }
-
- return true;
-}
-
-bool _FAT_directory_chdir (PARTITION* partition, const char* path) {
- DIR_ENTRY entry;
-
- if (!_FAT_directory_entryFromPath (partition, &entry, path, NULL)) {
- return false;
- }
-
- if (!(entry.entryData[DIR_ENTRY_attributes] & ATTRIB_DIR)) {
- return false;
- }
-
- partition->cwdCluster = _FAT_directory_entryGetCluster (entry.entryData);
-
- return true;
-}
-
-void _FAT_directory_entryStat (PARTITION* partition, DIR_ENTRY* entry, struct stat *st) {
- // Fill in the stat struct
- // Some of the values are faked for the sake of compatibility
- st->st_dev = _FAT_disc_hostType(partition->disc); // The device is the 32bit ioType value
- st->st_ino = (ino_t)(_FAT_directory_entryGetCluster(entry->entryData)); // The file serial number is the start cluster
- st->st_mode = (_FAT_directory_isDirectory(entry) ? S_IFDIR : S_IFREG) |
- (S_IRUSR | S_IRGRP | S_IROTH) |
- (_FAT_directory_isWritable (entry) ? (S_IWUSR | S_IWGRP | S_IWOTH) : 0) |
- (_FAT_directory_isHidden (entry) ? S_IHIDDEN : 0); // Mode bits based on dirEntry ATTRIB byte
- st->st_nlink = 1; // Always one hard link on a FAT file
- st->st_uid = 1; // Faked for FAT
- st->st_gid = 2; // Faked for FAT
- st->st_rdev = st->st_dev;
- st->st_size = u8array_to_u32 (entry->entryData, DIR_ENTRY_fileSize); // File size
- st->st_atime = _FAT_filetime_to_time_t (
- 0,
- u8array_to_u16 (entry->entryData, DIR_ENTRY_aDate)
- );
- //st->st_spare1 = _FAT_directory_isHidden (entry);
- st->st_mtime = _FAT_filetime_to_time_t (
- u8array_to_u16 (entry->entryData, DIR_ENTRY_mTime),
- u8array_to_u16 (entry->entryData, DIR_ENTRY_mDate)
- );
- //st->st_spare2 = 0;
- st->st_ctime = _FAT_filetime_to_time_t (
- u8array_to_u16 (entry->entryData, DIR_ENTRY_cTime),
- u8array_to_u16 (entry->entryData, DIR_ENTRY_cDate)
- );
- //st->st_spare3 = 0;
- st->st_blksize = BYTES_PER_READ; // Prefered file I/O block size
- st->st_blocks = (st->st_size + BYTES_PER_READ - 1) / BYTES_PER_READ; // File size in blocks
-// st->st_spare4[0] = 0;
-// st->st_spare4[1] = 0;
-}
diff --git a/sdk-modifications/libsrc/fs/directory.h b/sdk-modifications/libsrc/fs/directory.h
deleted file mode 100755
index 654c5d2..0000000
--- a/sdk-modifications/libsrc/fs/directory.h
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- directory.h
- Reading, writing and manipulation of the directory structure on
- a FAT partition
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-*/
-
-#ifndef _DIRECTORY_H
-#define _DIRECTORY_H
-
-#include <sys/stat.h>
-
-#include "fs_common.h"
-#include "partition.h"
-
-#define DIR_ENTRY_DATA_SIZE 0x20
-#define MAX_FILENAME_LENGTH 256
-#define MAX_ALIAS_LENGTH 13
-#define LFN_ENTRY_LENGTH 13
-#define FAT16_ROOT_DIR_CLUSTER 0
-
-#define DIR_SEPARATOR '/'
-
-// File attributes
-#define S_IHIDDEN 0x00200000
-
-
-#define ATTRIB_ARCH 0x20 // Archive
-#define ATTRIB_DIR 0x10 // Directory
-#define ATTRIB_LFN 0x0F // Long file name
-#define ATTRIB_VOL 0x08 // Volume
-#define ATTRIB_SYS 0x04 // System
-#define ATTRIB_HID 0x02 // Hidden
-#define ATTRIB_RO 0x01 // Read only
-
-typedef enum {FT_DIRECTORY, FT_FILE} FILE_TYPE;
-
-typedef struct {
- u32 cluster;
- u32 sector;
- s32 offset;
-} DIR_ENTRY_POSITION;
-
-typedef struct {
- u8 entryData[DIR_ENTRY_DATA_SIZE];
- DIR_ENTRY_POSITION dataStart; // Points to the start of the LFN entries of a file, or the alias for no LFN
- DIR_ENTRY_POSITION dataEnd; // Always points to the file/directory's alias entry
- char d_name[MAX_FILENAME_LENGTH + MAX_FILENAME_LENGTH*2]; //Store name string using UTF8 coding
- //u16 unicodeFilename[MAX_FILENAME_LENGTH];
-} DIR_ENTRY;
-
-// Directory entry offsets
-enum DIR_ENTRY_offset {
- DIR_ENTRY_name = 0x00,
- DIR_ENTRY_extension = 0x08,
- DIR_ENTRY_attributes = 0x0B,
- DIR_ENTRY_reserved = 0x0C,
- DIR_ENTRY_cTime_ms = 0x0D,
- DIR_ENTRY_cTime = 0x0E,
- DIR_ENTRY_cDate = 0x10,
- DIR_ENTRY_aDate = 0x12,
- DIR_ENTRY_clusterHigh = 0x14,
- DIR_ENTRY_mTime = 0x16,
- DIR_ENTRY_mDate = 0x18,
- DIR_ENTRY_cluster = 0x1A,
- DIR_ENTRY_fileSize = 0x1C
-};
-
-/*
-Returns true if the file specified by entry is a directory
-*/
-static inline bool _FAT_directory_isDirectory (DIR_ENTRY* entry) {
- return ((entry->entryData[DIR_ENTRY_attributes] & ATTRIB_DIR) != 0);
-}
-
-static inline bool _FAT_directory_isWritable (DIR_ENTRY* entry) {
- return ((entry->entryData[DIR_ENTRY_attributes] & ATTRIB_RO) == 0);
-}
-
-static inline bool _FAT_directory_isDot (DIR_ENTRY* entry) {
- return ((entry->d_name[0] == '.') && ((entry->d_name[1] == '\0') ||
- ((entry->d_name[1] == '.') && entry->d_name[2] == '\0')));
-}
-
-static inline bool _FAT_directory_isHidden (DIR_ENTRY* entry) {
- return ((entry->entryData[DIR_ENTRY_attributes] & ATTRIB_HID) != 0);
-}
-
-
-/*
-Reads the first directory entry from the directory starting at dirCluster
-Places result in entry
-entry will be destroyed even if no directory entry is found
-Returns true on success, false on failure
-*/
-bool _FAT_directory_getFirstEntry (PARTITION* partition, DIR_ENTRY* entry, u32 dirCluster);
-
-/*
-Reads the next directory entry after the one already pointed to by entry
-Places result in entry
-entry will be destroyed even if no directory entry is found
-Returns true on success, false on failure
-*/
-bool _FAT_directory_getNextEntry (PARTITION* partition, DIR_ENTRY* entry);
-
-/*
-Gets the directory entry corrsponding to the supplied path
-entry will be destroyed even if no directory entry is found
-pathEnd specifies the end of the path string, for cutting strings short if needed
- specify NULL to use the full length of path
- pathEnd is only a suggestion, and the path string will be searched up until the next PATH_SEPARATOR
- after pathEND.
-Returns true on success, false on failure
-*/
-bool _FAT_directory_entryFromPath (PARTITION* partition, DIR_ENTRY* entry, const char* path, const char* pathEnd);
-
-/*
-Changes the current directory to the one specified by path
-Returns true on success, false on failure
-*/
-bool _FAT_directory_chdir (PARTITION* partition, const char* path);
-
-/*
-Removes the directory entry specified by entry
-Assumes that entry is valid
-Returns true on success, false on failure
-*/
-bool _FAT_directory_removeEntry (PARTITION* partition, DIR_ENTRY* entry);
-
-/*
-Add a directory entry to the directory specified by dirCluster
-The fileData, dataStart and dataEnd elements of the DIR_ENTRY struct are
-updated with the new directory entry position and alias.
-Returns true on success, false on failure
-*/
-bool _FAT_directory_addEntry (PARTITION* partition, DIR_ENTRY* entry, u32 dirCluster);
-
-/*
-Get the start cluster of a file from it's entry data
-*/
-u32 _FAT_directory_entryGetCluster (const u8* entryData);
-
-/*
-Fill in the file name and entry data of DIR_ENTRY* entry.
-Assumes that the entry's dataStart and dataEnd are correct
-Returns true on success, false on failure
-*/
-bool _FAT_directory_entryFromPosition (PARTITION* partition, DIR_ENTRY* entry);
-
-/*
-Fill in a stat struct based on a file entry
-*/
-void _FAT_directory_entryStat (PARTITION* partition, DIR_ENTRY* entry, struct stat *st);
-
-#endif // _DIRECTORY_H
diff --git a/sdk-modifications/libsrc/fs/disc_io/disc.c b/sdk-modifications/libsrc/fs/disc_io/disc.c
deleted file mode 100755
index 8b50953..0000000
--- a/sdk-modifications/libsrc/fs/disc_io/disc.c
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
-
- disc.c
-
- uniformed io-interface to work with Chishm's FAT library
-
- Written by MightyMax
-
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2005-11-06 - Chishm
- * Added WAIT_CR modifications for NDS
-
- 2006-02-03 www.neoflash.com
- * Added SUPPORT_* defines, comment out any of the SUPPORT_* defines in disc_io.h to remove support
- for the given interface and stop code being linked to the binary
-
- * Added support for MK2 MMC interface
-
- * Added disc_Cache* functions
-
- 2006-02-05 - Chishm
- * Added Supercard SD support
-
- 2006-02-26 - Cytex
- * Added EFA2 support
-
- 2006-05-18 - Chishm
- * Rewritten for FATlib disc.c
-
- 2006-06-19 - Chishm
- * Changed read and write interface to accept a u32 instead of a u8 for the number of sectors
-
- 2006-07-11 - Chishm
- * Removed disc_Cache* functions, since there is now a proper unified cache
- * Removed SUPPORT_* defines
- * Rewrote device detection functions
- * First libfat release
-
- 2006-07-25 - Chishm
- * Changed IO_INTERFACEs to const
-
- 2006-08-02 - Chishm
- * Added NinjaDS
-*/
-
-#include "disc.h"
-#include "disc_io.h"
-
-// Include known io-interfaces:
-//#include "io_dldi.h"
-//#include "io_mpcf.h"
-//#include "io_m3cf.h"
-//#include "io_m3sd.h"
-//#include "io_sccf.h"
-//#include "io_scsd.h"
-//#include "io_fcsr.h"
-//#include "io_nmmc.h"
-//#include "io_efa2.h"
-//#include "io_mmcf.h"
-//#include "io_njsd.h"
-//#include "io_acekard.h"
-//#include "io_rpg_nand.h"
-//#include "io_rpg_sd.h"
-//#include "iointerface_sc.h"
-#include "io_ds2_mmcf.h"
-
-const IO_INTERFACE* ioInterfaces[] = {
- //&_io_dldi,
- //&_io_fcsr,
-#ifdef NDS
- // Place Slot 1 (DS Card) interfaces here
- //&_io_rpg_sd, //&_io_rpg_nand, /*&_io_acekard, */
- // Place Slot 2 (GBA Cart) interfaces here
- //&_io_scsd, &_io_mpcf, &_io_m3cf, &_io_sccf, &_io_m3sd, &_io_fcsr
- // Experimental Slot 2 interfaces
- //, &_io_mmcf, &_io_efa2
- &_io_ds2_mmcf,
-#endif
-};
-
-/*
-
- Hardware level disc funtions
-
-*/
-
-
-const IO_INTERFACE* _FAT_disc_gbaSlotFindInterface (void)
-{
- // If running on an NDS, make sure the correct CPU can access
- // the GBA cart. First implemented by SaTa.
-#ifdef NDS
- #ifdef ARM9
- REG_EXMEMCNT &= ~ARM7_OWNS_ROM;
- #endif
- #ifdef ARM7
- REG_EXMEMCNT |= ARM7_OWNS_ROM;
- #endif
-#endif
-
- int i;
-
- for (i = 0; i < (sizeof(ioInterfaces) / sizeof(IO_INTERFACE*)); i++) {
- if ((ioInterfaces[i]->features & FEATURE_SLOT_GBA) && (ioInterfaces[i]->fn_startup())) {
- return ioInterfaces[i];
- }
- }
- return NULL;
-}
-
-#ifdef NDS
-/*
- * Check the DS card slot for a valid memory card interface
- * If an interface is found, it is set as the default interace
- * and it returns true. Otherwise the default interface is left
- * untouched and it returns false.
- */
-const IO_INTERFACE* _FAT_disc_dsSlotFindInterface (void)
-{
-#ifdef ARM9
- REG_EXMEMCNT &= ~ARM7_OWNS_CARD;
-#endif
-#ifdef ARM7
- REG_EXMEMCNT |= ARM7_OWNS_CARD;
-#endif
- int i;
-
- for (i = 0; i < (sizeof(ioInterfaces) / sizeof(IO_INTERFACE*)); i++) {
- if ((ioInterfaces[i]->features & FEATURE_SLOT_NDS) && (ioInterfaces[i]->fn_startup())) {
- return ioInterfaces[i];
- }
- }
-
- return NULL;
-}
-#endif
-
-/*
- * When running on an NDS, check the either slot for a valid memory
- * card interface.
- * When running on a GBA, call _FAT_disc_gbaSlotFindInterface
- * If an interface is found, it is set as the default interace
- * and it returns true. Otherwise the default interface is left
- * untouched and it returns false.
- */
-#ifdef NDS
-const IO_INTERFACE* _FAT_disc_findInterface (void)
-{
-#ifdef ARM9
- REG_EXMEMCNT &= ~(ARM7_OWNS_CARD | ARM7_OWNS_ROM);
-#endif
-#ifdef ARM7
- REG_EXMEMCNT |= (ARM7_OWNS_CARD | ARM7_OWNS_ROM);
-#endif
-
- int i;
-
- for (i = 0; i < (sizeof(ioInterfaces) / sizeof(IO_INTERFACE*)); i++) {
- if (ioInterfaces[i]->fn_startup()) {
- return ioInterfaces[i];
- }
- }
-
- return NULL;
-}
-#else
-const IO_INTERFACE* _FAT_disc_findInterface (void)
-{
- return _FAT_disc_gbaSlotFindInterface();
-}
-#endif
diff --git a/sdk-modifications/libsrc/fs/disc_io/disc.h b/sdk-modifications/libsrc/fs/disc_io/disc.h
deleted file mode 100755
index 2129359..0000000
--- a/sdk-modifications/libsrc/fs/disc_io/disc.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- disc.h
- Interface to the low level disc functions. Used by the higher level
- file system code.
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-
-*/
-#ifndef _DISC_H
-#define _DISC_H
-
-#include "../fs_common.h"
-#include "disc_io.h"
-
-/*
-Search for a block based device in the GBA slot.
-Return a pointer to a usable interface if one is found,
-NULL if not.
-*/
-extern const IO_INTERFACE* _FAT_disc_gbaSlotFindInterface (void);
-
-/*
-Search for a block based device in the DS slot.
-Return a pointer to a usable interface if one is found,
-NULL if not.
-*/
-#ifdef NDS
-extern const IO_INTERFACE* _FAT_disc_dsSlotFindInterface (void);
-#endif
-
-/*
-Search for a block based device in the both slots.
-Return a pointer to a usable interface if one is found,
-NULL if not.
-*/
-extern const IO_INTERFACE* _FAT_disc_findInterface (void);
-
-/*
-Check if a disc is inserted
-Return true if a disc is inserted and ready, false otherwise
-*/
-static inline bool _FAT_disc_isInserted (const IO_INTERFACE* disc) {
- return disc->fn_isInserted();
-}
-
-/*
-Read numSectors sectors from a disc, starting at sector.
-numSectors is between 1 and 256
-sector is from 0 to 2^28
-buffer is a pointer to the memory to fill
-*/
-//return non-zero is sucess
-static inline bool _FAT_disc_readSectors (const IO_INTERFACE* disc, unsigned long sector, unsigned long numSectors, void* buffer) {
- return disc->fn_readSectors (sector, numSectors, buffer);
-}
-
-/*
-Write numSectors sectors to a disc, starting at sector.
-numSectors is between 1 and 256
-sector is from 0 to 2^28
-buffer is a pointer to the memory to read from
-*/
-//return non-zero is sucess
-static inline bool _FAT_disc_writeSectors (const IO_INTERFACE* disc, unsigned long sector, unsigned long numSectors, const void* buffer) {
- return disc->fn_writeSectors (sector, numSectors, buffer);
-}
-
-/*
-Reset the card back to a ready state
-*/
-static inline bool _FAT_disc_clearStatus (const IO_INTERFACE* disc) {
- return disc->fn_clearStatus();
-}
-
-/*
-Initialise the disc to a state ready for data reading or writing
-*/
-static inline bool _FAT_disc_startup (const IO_INTERFACE* disc) {
- return disc->fn_startup();
-}
-
-/*
-Put the disc in a state ready for power down.
-Complete any pending writes and disable the disc if necessary
-*/
-static inline bool _FAT_disc_shutdown (const IO_INTERFACE* disc) {
- return disc->fn_shutdown();
-}
-
-/*
-Return a 32 bit value unique to each type of interface
-*/
-static inline unsigned long _FAT_disc_hostType (const IO_INTERFACE* disc) {
- return disc->ioType;
-}
-
-/*
-Return a 32 bit value that specifies the capabilities of the disc
-*/
-static inline unsigned long _FAT_disc_features (const IO_INTERFACE* disc) {
- return disc->features;
-}
-
-#endif // _DISC_H
diff --git a/sdk-modifications/libsrc/fs/disc_io/disc_io.h b/sdk-modifications/libsrc/fs/disc_io/disc_io.h
deleted file mode 100755
index 6ac0c31..0000000
--- a/sdk-modifications/libsrc/fs/disc_io/disc_io.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- disc_io.h
- Interface template for low level disc functions.
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-
- 2006-07-16 - Chishm
- * Renamed _CF_USE_DMA to _IO_USE_DMA
- * Renamed _CF_ALLOW_UNALIGNED to _IO_ALLOW_UNALIGNED
-*/
-
-#ifndef _DISC_IO_H
-#define _DISC_IO_H
-
-#include "../fs_common.h"
-
-//----------------------------------------------------------------------
-// Customisable features
-
-// Use DMA to read the card, remove this line to use normal reads/writes
-// #define _IO_USE_DMA
-
-// Allow buffers not alligned to 16 bits when reading files.
-// Note that this will slow down access speed, so only use if you have to.
-// It is also incompatible with DMA
-//#define _IO_ALLOW_UNALIGNED
-
-#define _IO_USE_DMA
-
-#if defined _IO_USE_DMA && defined _IO_ALLOW_UNALIGNED
- #error You can't use both DMA and unaligned memory
-#endif
-
-#define FEATURE_MEDIUM_CANREAD 0x00000001
-#define FEATURE_MEDIUM_CANWRITE 0x00000002
-#define FEATURE_SLOT_GBA 0x00000010
-#define FEATURE_SLOT_NDS 0x00000020
-
-typedef bool (* FN_MEDIUM_STARTUP)(void) ;
-typedef bool (* FN_MEDIUM_ISINSERTED)(void) ;
-typedef bool (* FN_MEDIUM_READSECTORS)(unsigned long sector, unsigned long numSectors, void* buffer) ;
-typedef bool (* FN_MEDIUM_WRITESECTORS)(unsigned long sector, unsigned long numSectors, const void* buffer) ;
-typedef bool (* FN_MEDIUM_CLEARSTATUS)(void) ;
-typedef bool (* FN_MEDIUM_SHUTDOWN)(void) ;
-
-struct IO_INTERFACE_STRUCT {
- unsigned long ioType ;
- unsigned long features ;
- FN_MEDIUM_STARTUP fn_startup ;
- FN_MEDIUM_ISINSERTED fn_isInserted ;
- FN_MEDIUM_READSECTORS fn_readSectors ;
- FN_MEDIUM_WRITESECTORS fn_writeSectors ;
- FN_MEDIUM_CLEARSTATUS fn_clearStatus ;
- FN_MEDIUM_SHUTDOWN fn_shutdown ;
-} ;
-
-typedef struct IO_INTERFACE_STRUCT IO_INTERFACE ;
-
-#endif // define _DISC_IO_H
diff --git a/sdk-modifications/libsrc/fs/disc_io/io_ds2_mmcf.c b/sdk-modifications/libsrc/fs/disc_io/io_ds2_mmcf.c
deleted file mode 100755
index c432d84..0000000
--- a/sdk-modifications/libsrc/fs/disc_io/io_ds2_mmcf.c
+++ /dev/null
@@ -1,13 +0,0 @@
-//io_ds2_mmcf.c
-#include "io_ds2_mmcf.h"
-
-const IO_INTERFACE _io_ds2_mmcf = {
- DEVICE_TYPE_DS2_MMCF,
- FEATURE_MEDIUM_CANREAD | FEATURE_MEDIUM_CANWRITE,
- (FN_MEDIUM_STARTUP)&_MMC_StartUp,
- (FN_MEDIUM_ISINSERTED)&_MMC_IsInserted,
- (FN_MEDIUM_READSECTORS)&_MMC_ReadSectors,
- (FN_MEDIUM_WRITESECTORS)&_MMC_WriteSectors,
- (FN_MEDIUM_CLEARSTATUS)&_MMC_ClearStatus,
- (FN_MEDIUM_SHUTDOWN)&_MMC_ShutDown
-};
diff --git a/sdk-modifications/libsrc/fs/disc_io/io_ds2_mmcf.h b/sdk-modifications/libsrc/fs/disc_io/io_ds2_mmcf.h
deleted file mode 100755
index 334a9bc..0000000
--- a/sdk-modifications/libsrc/fs/disc_io/io_ds2_mmcf.h
+++ /dev/null
@@ -1,63 +0,0 @@
-#ifndef __IO_DS2_H__
-#define __IO_DS2_H__
-
-// 'DS2F'
-#define DEVICE_TYPE_DS2_MMCF 0x46434D4D
-
-#include "disc_io.h"
-#include "ds2_mmc_api.h"
-
-// export interface
-extern const IO_INTERFACE _io_ds2_mmcf ;
-
-/* initialize MMC/SD card */
-static inline bool _MMC_StartUp(void)
-{
- return MMC_Initialize();
-}
-
-/* read multi blocks from MMC/SD card */
-/* read a single block from MMC/SD card */
-static inline bool _MMC_ReadSectors(u32 sector, u32 numSectors, void* buffer)
-{
- int flag;
-
- if(numSectors > 1)
- flag= MMC_ReadMultiBlock(sector, numSectors, (unsigned char*)buffer);
- else
- flag= MMC_ReadBlock(sector, (unsigned char*)buffer);
- return (flag==MMC_NO_ERROR);
-}
-
-/* write multi blocks from MMC/SD card */
-/* write a single block from MMC/SD card */
-static inline bool _MMC_WriteSectors(u32 sector, u32 numSectors, const void* buffer)
-{
- int flag;
-
- if(numSectors > 1)
- flag= MMC_WriteMultiBlock(sector, numSectors, (unsigned char*)buffer);
- else
- flag= MMC_WriteBlock(sector, (unsigned char*)buffer);
-
- return (flag==MMC_NO_ERROR);
-}
-
-static inline bool _MMC_ClearStatus(void)
-{
- return true;
-}
-
-static inline bool _MMC_ShutDown(void)
-{
- return true;
-}
-
-static inline bool _MMC_IsInserted(void)
-{
- return true;
-}
-
-
-#endif //__IO_DS2_H__
-
diff --git a/sdk-modifications/libsrc/fs/ds2_fcntl.c b/sdk-modifications/libsrc/fs/ds2_fcntl.c
deleted file mode 100755
index 0fc00d7..0000000
--- a/sdk-modifications/libsrc/fs/ds2_fcntl.c
+++ /dev/null
@@ -1,126 +0,0 @@
-#include <stdarg.h>
-#include <errno.h>
-#include "ds2_fcntl.h"
-#include "fs_api.h"
-#include "ds2_malloc.h"
-
-
-/*typedef struct {
- FILE_STRUCT* stream;
- int flags;
-} _fd_t;
-
-_fd_t* _fd_list = NULL;
-int _fd_count = 0;*/
-
-int open(const char* path, int oflag, ... ) {
- if(oflag & _O_UNSUPPORTED) {
- errno = EINVAL;
- return -1;
- }
- // TODO - Deal more correctly with certain flags.
- FILE_STRUCT* tempFile = fat_fopen(path, "rb");
- if(oflag & O_CREAT) {
- if(tempFile == NULL)
- tempFile = fat_fopen(path, "wb");
- if(tempFile == NULL)
- return -1;
- } else if(tempFile == NULL) {
- return -1;
- } else if(oflag & O_TRUNC) {
- tempFile = fat_fopen(path, "wb");
- if(tempFile == NULL)
- return -1;
- }
- fat_fclose(tempFile);
-
- char tempMode[16];
- if((oflag & 0x3) == O_RDONLY) {
- sprintf(tempMode, "rb");
- } else if((oflag & 0x3) == O_WRONLY) {
- if(oflag & O_APPEND)
- sprintf(tempMode, "ab");
- else
- sprintf(tempMode, "wb");
- } else if((oflag & 0x3) == O_RDWR) {
- if(oflag & O_APPEND)
- sprintf(tempMode, "ab+");
- else
- sprintf(tempMode, "rb+");
- }
-
- tempFile = fat_fopen(path, tempMode);
- if(tempFile == NULL)
- return -1;
-
- return tempFile -> fd;
-}
-
-int fcntl(int fildes, int cmd, ...) {
- /*if((fildes < 0) || (fildes >= _fd_count) || (_fd_list[fildes].stream == NULL)) {
- errno = EINVAL;
- return -1;
- }
- if((cmd <= 0) || (cmd > _F_LAST)) {
- errno = EINVAL;
- return -1;
- }
-
- va_list ap;
-
- int arg;
- void* flock;
- switch(cmd) {
- case F_SETFD:
- case F_SETOWN:
- va_start(ap, cmd);
- arg = va_arg(ap, int);
- va_end(ap);
- break;
- case F_GETLK:
- case F_SETLK:
- va_start(ap, cmd);
- flock = va_arg(ap, void*);
- va_end(ap);
- break;
- }
-
- switch(cmd) {
- case F_DUPFD: // Duplicate file descriptors not supported.
- errno = EINVAL;
- return -1;
- case F_GETFD:
- return (_fd_list[fildes].flags & _F_FILE_DESC);
- case F_SETFD:
- arg &= _F_FILE_DESC;
- _fd_list[fildes].flags &= ~_F_FILE_DESC;
- _fd_list[fildes].flags |= arg;
- return 0;
- case F_GETFL:
- return (_fd_list[fildes].flags & (O_ACCMODE | _O_FILE_STATUS));
- case F_SETFL:
- arg &= (O_ACCMODE | _O_FILE_STATUS);
- if(arg & _O_UNSUPPORTED) {
- errno = EINVAL;
- return -1;
- }
- if((arg & O_ACCMODE) != (_fd_list[fildes].flags & O_ACCMODE)) {
- errno = EINVAL;
- return -1;
- }
- _fd_list[fildes].flags &= ~(O_ACCMODE | _O_FILE_STATUS);
- _fd_list[fildes].flags |= arg;
- return 0;
- case F_GETOWN:
- case F_SETOWN:
- errno = -1;
- return -1;
- case F_GETLK:
- case F_SETLK:
- case F_SETLKW:
- return -1;
- }
-
- errno = EINVAL;*/
- return -1;
-}
diff --git a/sdk-modifications/libsrc/fs/ds2_fcntl.h b/sdk-modifications/libsrc/fs/ds2_fcntl.h
deleted file mode 100755
index 2c69221..0000000
--- a/sdk-modifications/libsrc/fs/ds2_fcntl.h
+++ /dev/null
@@ -1,51 +0,0 @@
-#ifndef __libc_fcntl_h__
-#define __libc_fcntl_h__
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#define O_RDONLY (1 << 0)
-#define O_WRONLY (2 << 0)
-#define O_RDWR (3 << 0)
-#define O_APPEND (1 << 2)
-#define O_CREAT (1 << 3)
-#define O_DSYNC (1 << 4)
-#define O_EXCL (1 << 5)
-#define O_NOCTTY (1 << 6)
-#define O_NONBLOCK (1 << 7)
-#define O_RSYNC (1 << 8)
-#define O_SYNC (1 << 9)
-#define O_TRUNC (1 << 10)
-#define O_CREATE O_CREAT
-
-#define O_ACCMODE 0x3
-
-#define F_CLOEXEC (1 << 11)
-
-#define F_DUPFD 1
-#define F_GETFD 2
-#define F_SETFD 3
-#define F_GETFL 4
-#define F_SETFL 5
-#define F_GETLK 6
-#define F_SETLK 7
-#define F_SETLKW 8
-#define F_GETOWN 9
-#define F_SETOWN 10
-#define _F_LAST F_SETOWN
-
-#define _F_FILE_DESC (F_CLOEXEC)
-#define _O_FILE_CREATE (O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC)
-#define _O_FILE_STATUS (O_APPEND | O_DSYNC | O_NONBLOCK | O_RSYNC | O_SYNC)
-#define _O_UNSUPPORTED (0)
-
-extern int open(const char* path, int oflag, ...);
-extern int fcntl(int fildes, int cmd, ...);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/sdk-modifications/libsrc/fs/ds2_unistd.c b/sdk-modifications/libsrc/fs/ds2_unistd.c
deleted file mode 100755
index 8625eba..0000000
--- a/sdk-modifications/libsrc/fs/ds2_unistd.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include "ds2_unistd.h"
-#include "fs_api.h"
-
-int close(int fildes) {
- return _FAT_close_r (&__REENT, fildes);
-}
-
-int lseek(int fildes, int offset, int whence) {
- return _FAT_seek_r (&__REENT, fildes, (int)offset, whence);
-}
-
-int read(int fildes, void* buf, size_t len) {
- return _FAT_read_r (&__REENT, fildes, (char*)buf, len);
-}
-
-int write(int fildes, const void* buf, size_t len) {
- return _FAT_write_r (&__REENT, fildes, (const char*)buf, len);
-}
diff --git a/sdk-modifications/libsrc/fs/ds2_unistd.h b/sdk-modifications/libsrc/fs/ds2_unistd.h
deleted file mode 100755
index f5efdb1..0000000
--- a/sdk-modifications/libsrc/fs/ds2_unistd.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef __libc_unistd_h__
-#define __libc_unistd_h__
-
-#include "fs_common.h"
-#include "fatfile.h"
-#include "fs_api.h"
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-extern int close(int fildes);
-extern int lseek(int fildes, int offset, int whence);
-extern int read(int fildes, void* buf, size_t len);
-extern int write(int fildes, const void* buf, size_t len);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/sdk-modifications/libsrc/fs/fat.h b/sdk-modifications/libsrc/fs/fat.h
deleted file mode 100755
index 3ddbac3..0000000
--- a/sdk-modifications/libsrc/fs/fat.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- fat.h
- Simple functionality for startup, mounting and unmounting of FAT-based devices.
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-
- 2006-07-14
- * fatInitialise renamed to fatInit
-
- 2006-07-16 - Chishm
- * Added fatInitDefault
-*/
-
-
-#ifndef _LIBFAT_H
-#define _LIBFAT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// When compiling for NDS, make sure NDS is defined
-#ifndef NDS
- #define NDS
-#endif
-
-#include <nds/jtypes.h>
-#include "partition.h"
-#include "directory.h"
-#include "file_allocation_table.h"
-#include "unicode/unicode.h"
-#include "fatdir_ex.h"
-#include "fatfile_ex.h"
-
-//typedef enum {PI_DEFAULT, PI_SLOT_1, PI_SLOT_2, PI_CUSTOM} PARTITION_INTERFACE;
-
-struct IO_INTERFACE_STRUCT ;
-
-/*
-Initialise any inserted block-devices.
-Add the fat device driver to the devoptab, making it available for standard file functions.
-cacheSize: The number of pages to allocate for each inserted block-device
-setAsDefaultDevice: if true, make this the default device driver for file operations
-*/
-bool fatInit (u32 cacheSize, bool setAsDefaultDevice);
-
-/*
-Calls fatInit with setAsDefaultDevice = true and cacheSize optimised for the host system.
-*/
-bool fatInitDefault (void);
-
-/*
-Special initialize for RPG card
-*/
-bool fatInitRPG (void);
-
-/*
-Mount the device specified by partitionNumber
-PD_DEFAULT is not allowed, use _FAT_partition_setDefaultDevice
-PD_CUSTOM is not allowed, use _FAT_partition_mountCustomDevice
-*/
-bool fatMountNormalInterface (PARTITION_INTERFACE partitionNumber, u32 cacheSize);
-
-/*
-Mount a partition on a custom device
-*/
-bool fatMountCustomInterface (struct IO_INTERFACE_STRUCT* device, u32 cacheSize);
-
-/*
-Unmount the partition specified by partitionNumber
-If there are open files, it will fail
-*/
-bool fatUnmount (PARTITION_INTERFACE partitionNumber);
-
-
-/*
-Forcibly unmount the partition specified by partitionNumber
-Any open files on the partition will become invalid
-The cache will be invalidated, and any unflushed writes will be lost
-*/
-bool fatUnsafeUnmount (PARTITION_INTERFACE partitionNumber);
-
-/*
-Set the default device for access by fat: and fat0:
-PD_DEFAULT is unallowed.
-Doesn't do anything useful on GBA, since there is only one device
-*/
-bool fatSetDefaultInterface (PARTITION_INTERFACE partitionNumber);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // _LIBFAT_H
diff --git a/sdk-modifications/libsrc/fs/fat_misc.c b/sdk-modifications/libsrc/fs/fat_misc.c
deleted file mode 100644
index 335ab59..0000000
--- a/sdk-modifications/libsrc/fs/fat_misc.c
+++ /dev/null
@@ -1,140 +0,0 @@
-//fat_misc.c
-//v1.0
-
-#include "fat_misc.h"
-#include "fs_api.h"
-
-static unsigned int _usedSecNums;
-
-static int strFindFromEnd( char *str,char strValue )
-{
- int pos = 0,i = 0,strNum = 0;
- while(1)
- {
- if( (*str)!=0 )
- {
- strNum++;
- str++;
- }
- else
- {
- break;
- }
- }
- pos = strNum;
- for( i=0;i<strNum;i++ )
- {
- str--;
- pos--;
- if( (*str) == strValue||(*str) == ':' )
- {
- return pos;
- }
- if( (*str)== 0 )
- {
- return -1;
- }
- }
- return -1;
-}
-
-int getDirSize( const char * path, int includeSubdirs, unsigned int * dirSize )
-{
- char dirPath[MAX_FILENAME_LENGTH];
- unsigned int size = 0;
- if( "" == path ){
- return false;
- }
-
- memset( dirPath,0,MAX_FILENAME_LENGTH );
- strcpy( dirPath,path );
-
- if( dirPath[strlen(dirPath)-1] != '/' )
- dirPath[strlen(dirPath)] = '/';
- if( strlen(dirPath) > MAX_FILENAME_LENGTH )
- return false;
-
- DIR_STATE_STRUCT *dir;
- dir = fat_opendir((const char*)dirPath);
- if (dir == NULL)
- return false;
-
- struct stat stat_buf;
- DIR_ENTRY *currentEntry;
- char* filename;
-
- while((currentEntry = fat_readdir_ex(dir, &stat_buf)) != NULL)
- {
- filename = currentEntry->d_name;
-
- if (strcmp(filename, ".") == 0 || strcmp(filename, "..") == 0)
- continue;
-
- if (!(stat_buf.st_mode & S_IFDIR)) {
- size += (stat_buf.st_size+511)/512;
- _usedSecNums +=(stat_buf.st_size+511)/512;
- }
- else if (includeSubdirs)
- {
- // calculate the size recursively
- unsigned int subDirSize = 0;
- char dirPathBuffer[MAX_FILENAME_LENGTH];
-
- memset( dirPathBuffer,0,MAX_FILENAME_LENGTH );
- strcpy( dirPathBuffer,dirPath );
- memset( dirPath,0,MAX_FILENAME_LENGTH );
- sprintf( dirPath,"%s%s",dirPathBuffer,filename );
- int succ = getDirSize( dirPath, includeSubdirs, &subDirSize );
- if( succ ) {
- size += (subDirSize+511)/512;
- _usedSecNums +=(subDirSize+511)/512;
- }
- memset( dirPath,0,MAX_FILENAME_LENGTH );
- strcpy( dirPath,dirPathBuffer );
- }
- }
-
- fat_closedir(dir);
-
- *dirSize = size;
- return true;
-}
-
-int fat_getDiskTotalSpace( char * diskName, unsigned int * diskSpace )
-{
- if( !strcmp("",diskName) )
- return false;
-
- unsigned int len = strlen(diskName);
- if( *(diskName+len-1) != '/' ){
- *(diskName+len) = '/';
- }
-
- PARTITION * diskPartition = _FAT_partition_getPartitionFromPath( diskName );
- if( NULL == diskPartition )
- return false;
-
- *diskSpace = (unsigned int)diskPartition->numberOfSectors;
- return true;
-}
-
-int fat_getDiskSpaceInfo( char * diskName, unsigned int * total, unsigned int * used, unsigned int * freeSpace )
-{
- _usedSecNums = 0;
-
- if( !strcmp("",diskName) )
- return -1;
- if( !fat_getDiskTotalSpace(diskName, total) )
- return -1;
- if( !getDirSize(diskName, true, used) )
- return -1;
-
- *used = _usedSecNums;
- if( *total <= *used ){
- *freeSpace = 0;
- }else{
- *freeSpace = *total - *used;
- }
-
- return 0;
-}
diff --git a/sdk-modifications/libsrc/fs/fat_misc.h b/sdk-modifications/libsrc/fs/fat_misc.h
deleted file mode 100755
index 05db0bb..0000000
--- a/sdk-modifications/libsrc/fs/fat_misc.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*--------------------------------------------------------------------------------
-Copyright (C) 2007 Acekard, www.acekard.com
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
-
----------------------------------------------------------------------------------*/
-#ifndef __FAT_MISC_H__
-#define __FAT_MISC_H__
-
-#include "fs_common.h"
-#include "directory.h"
- typedef enum _SRC_FILE_MODE
-{
- SFM_COPY = 0,
- SFM_CUT = 1
-}SRC_FILE_MODE;
-
-
-extern bool fat_getDiskSpaceInfo( char * diskName, unsigned int *total, unsigned int *used, unsigned int *freeSpace );
-
-#endif //__FAT_MISC_H__
diff --git a/sdk-modifications/libsrc/fs/fatdir.c b/sdk-modifications/libsrc/fs/fatdir.c
deleted file mode 100644
index dc9b914..0000000
--- a/sdk-modifications/libsrc/fs/fatdir.c
+++ /dev/null
@@ -1,672 +0,0 @@
-/*
- fatdir.c
-
- Functions used by the newlib disc stubs to interface with
- this library
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-08-13 - Chishm
- * Moved all externally visible directory related functions to fatdir
- * Added _FAT_mkdir_r
-
- 2006-08-14 - Chishm
- * Added directory iterator functions
-
- 2006-08-19 - Chishm
- * Updated dirnext return values to return correctly
-
- 2006-10-01 - Chishm
- * Now clears the whole cluster when creating a new directory, bug found by Hermes
-
- 2007-01-10 - Chishm
- * Updated directory iterator functions for DevkitPro r20
-*/
-
-/*
- 2010.06.30
- * Modify _FAT_diropen_r,
-*/
-
-#include <string.h>
-#include <errno.h>
-#include <ctype.h>
-#include <unistd.h>
-#include <sys/dir.h>
-
-#include "fatdir.h"
-
-#include "fs_cache.h"
-#include "file_allocation_table.h"
-#include "partition.h"
-#include "directory.h"
-#include "bit_ops.h"
-#include "filetime.h"
-#include "fs_unicode.h"
-
-
-int _FAT_stat_r (struct _reent *r, const char *path, struct stat *st) {
- PARTITION* partition = NULL;
-
- DIR_ENTRY dirEntry;
-
- // Get the partition this file is on
- partition = _FAT_partition_getPartitionFromPath (path);
-
- if (partition == NULL) {
- r->_errno = ENODEV;
- return -1;
- }
-
- // Move the path pointer to the start of the actual path
- if (strchr (path, ':') != NULL) {
- path = strchr (path, ':') + 1;
- }
- if (strchr (path, ':') != NULL) {
- r->_errno = EINVAL;
- return -1;
- }
-
- // Search for the file on the disc
- if (!_FAT_directory_entryFromPath (partition, &dirEntry, path, NULL)) {
- r->_errno = ENOENT;
- return -1;
- }
-
- // Fill in the stat struct
- _FAT_directory_entryStat (partition, &dirEntry, st);
-
- return 0;
-}
-
-int _FAT_getshortname_r (struct _reent *r, const char *name, char *outName) {
- PARTITION* partition = NULL;
- DIR_ENTRY DirEntry;
- u32 dirCluster;
-
- // Get the partition this directory is on
- partition = _FAT_partition_getPartitionFromPath (name);
-
- if (partition == NULL) {
- r->_errno = ENODEV;
- return 1;
- }
-
- // Move the path pointer to the start of the actual path
- if (strchr (name, ':') != NULL) {
- name = strchr (name, ':') + 1;
- }
- if (strchr (name, ':') != NULL) {
- r->_errno = EINVAL;
- return 1;
- }
-
- // Search for the file on the disc
- if (!_FAT_directory_entryFromPath (partition, &DirEntry, name, NULL)) {
- r->_errno = ENOENT;
- return 1;
- }
-
- strcpy(outName, DirEntry.entryData);
- return 1;
-}
-
-int _FAT_link_r (struct _reent *r, const char *existing, const char *newLink) {
- r->_errno = ENOTSUP;
- return -1;
-}
-
-int _FAT_unlink_r (struct _reent *r, const char *path) {
- PARTITION* partition = NULL;
- DIR_ENTRY dirEntry;
- DIR_ENTRY dirContents;
- u32 cluster;
- bool nextEntry;
- bool errorOccured = false;
-
- // Get the partition this directory is on
- partition = _FAT_partition_getPartitionFromPath (path);
-
- if (partition == NULL) {
- r->_errno = ENODEV;
- return -1;
- }
-
- // Make sure we aren't trying to write to a read-only disc
- if (partition->readOnly) {
- r->_errno = EROFS;
- return -1;
- }
-
- // Move the path pointer to the start of the actual path
- if (strchr (path, ':') != NULL) {
- path = strchr (path, ':') + 1;
- }
- if (strchr (path, ':') != NULL) {
- r->_errno = EINVAL;
- return -1;
- }
-
- // Search for the file on the disc
- if (!_FAT_directory_entryFromPath (partition, &dirEntry, path, NULL)) {
- r->_errno = ENOENT;
- return -1;
- }
-
- cluster = _FAT_directory_entryGetCluster (dirEntry.entryData);
-
-
- // If this is a directory, make sure it is empty
- if (_FAT_directory_isDirectory (&dirEntry)) {
- nextEntry = _FAT_directory_getFirstEntry (partition, &dirContents, cluster);
-
- while (nextEntry) {
- if (!_FAT_directory_isDot (&dirContents)) {
- // The directory had something in it that isn't a reference to itself or it's parent
- r->_errno = EPERM;
- return -1;
- }
- nextEntry = _FAT_directory_getNextEntry (partition, &dirContents);
- }
- }
-
- if (cluster != CLUSTER_FREE) {
- // Remove the cluster chain for this file
- if (!_FAT_fat_clearLinks (partition, cluster)) {
- r->_errno = EIO;
- errorOccured = true;
- }
- }
-
- // Remove the directory entry for this file
- if (!_FAT_directory_removeEntry (partition, &dirEntry)) {
- r->_errno = EIO;
- errorOccured = true;
- }
-
- // Flush any sectors in the disc cache
- if (!_FAT_cache_flush(partition->cache)) {
- r->_errno = EIO;
- errorOccured = true;
- }
-
- if (errorOccured) {
- return -1;
- } else {
- return 0;
- }
-}
-
-int _FAT_chdir_r (struct _reent *r, const char *path) {
- PARTITION* partition = NULL;
-
- // Get the partition this directory is on
- partition = _FAT_partition_getPartitionFromPath (path);
-
- if (partition == NULL) {
- r->_errno = ENODEV;
- return -1;
- }
-
- // Move the path pointer to the start of the actual path
- if (strchr (path, ':') != NULL) {
- path = strchr (path, ':') + 1;
- }
- if (strchr (path, ':') != NULL) {
- r->_errno = EINVAL;
- return -1;
- }
-
- // Set the default device to match this one
- if (!_FAT_partition_setDefaultPartition (partition)) {
- r->_errno = ENOENT;
- return -1;
- }
-
- // Try changing directory
- if (_FAT_directory_chdir (partition, path)) {
- // Successful
- return 0;
- } else {
- // Failed
- r->_errno = ENOTDIR;
- return -1;
- }
-}
-
-int _FAT_rename_r (struct _reent *r, const char *oldName, const char *newName) {
- PARTITION* partition = NULL;
- DIR_ENTRY oldDirEntry;
- DIR_ENTRY newDirEntry;
- const char *pathEnd;
- u32 dirCluster;
-
- // Get the partition this directory is on
- partition = _FAT_partition_getPartitionFromPath (oldName);
-
- if (partition == NULL) {
- r->_errno = ENODEV;
- return -1;
- }
-
- // Make sure the same partition is used for the old and new names
- if (partition != _FAT_partition_getPartitionFromPath (newName)) {
- r->_errno = EXDEV;
- return -1;
- }
-
- // Make sure we aren't trying to write to a read-only disc
- if (partition->readOnly) {
- r->_errno = EROFS;
- return -1;
- }
-
- // Move the path pointer to the start of the actual path
- if (strchr (oldName, ':') != NULL) {
- oldName = strchr (oldName, ':') + 1;
- }
- if (strchr (oldName, ':') != NULL) {
- r->_errno = EINVAL;
- return -1;
- }
- if (strchr (newName, ':') != NULL) {
- newName = strchr (newName, ':') + 1;
- }
- if (strchr (newName, ':') != NULL) {
- r->_errno = EINVAL;
- return -1;
- }
-
- // Search for the file on the disc
- if (!_FAT_directory_entryFromPath (partition, &oldDirEntry, oldName, NULL)) {
- r->_errno = ENOENT;
- return -1;
- }
-
- // Make sure there is no existing file / directory with the new name
- if (_FAT_directory_entryFromPath (partition, &newDirEntry, newName, NULL)) {
- r->_errno = EEXIST;
- return -1;
- }
-
- // Create the new file entry
- // Get the directory it has to go in
- pathEnd = strrchr (newName, DIR_SEPARATOR);
- if (pathEnd == NULL) {
- // No path was specified
- dirCluster = partition->cwdCluster;
- pathEnd = newName;
- } else {
- // Path was specified -- get the right dirCluster
- // Recycling newDirEntry, since it needs to be recreated anyway
- if (!_FAT_directory_entryFromPath (partition, &newDirEntry, newName, pathEnd) ||
- !_FAT_directory_isDirectory(&newDirEntry)) {
- r->_errno = ENOTDIR;
- return -1;
- }
- dirCluster = _FAT_directory_entryGetCluster (newDirEntry.entryData);
- // Move the pathEnd past the last DIR_SEPARATOR
- pathEnd += 1;
- }
-
- // Copy the entry data
- memcpy (&newDirEntry, &oldDirEntry, sizeof(DIR_ENTRY));
-
- // Set the new name
- strncpy (newDirEntry.d_name, pathEnd, MAX_FILENAME_LENGTH - 1);
-
- // Write the new entry
- if (!_FAT_directory_addEntry (partition, &newDirEntry, dirCluster)) {
- r->_errno = ENOSPC;
- return -1;
- }
-
- // Remove the old entry
- if (!_FAT_directory_removeEntry (partition, &oldDirEntry)) {
- r->_errno = EIO;
- return -1;
- }
-
- // Flush any sectors in the disc cache
- if (!_FAT_cache_flush (partition->cache)) {
- r->_errno = EIO;
- return -1;
- }
-
- return 0;
-}
-
-int _FAT_hideAttrib_r (struct _reent *r, const char *name, u8 hide) {
- PARTITION* partition = NULL;
- DIR_ENTRY oldDirEntry;
- DIR_ENTRY newDirEntry;
- u32 dirCluster;
-
- // Get the partition this directory is on
- partition = _FAT_partition_getPartitionFromPath (name);
-
- if (partition == NULL) {
- r->_errno = ENODEV;
- return -1;
- }
-
- // Make sure we aren't trying to write to a read-only disc
- if (partition->readOnly) {
- r->_errno = EROFS;
- return -1;
- }
-
- // Move the path pointer to the start of the actual path
- if (strchr (name, ':') != NULL) {
- name = strchr (name, ':') + 1;
- }
- if (strchr (name, ':') != NULL) {
- r->_errno = EINVAL;
- return -1;
- }
-
- // Search for the file on the disc
- if (!_FAT_directory_entryFromPath (partition, &oldDirEntry, name, NULL)) {
- r->_errno = ENOENT;
- return -1;
- }
-
- // Create the new file entry
- // Get the directory it has to go in
- memcpy (&newDirEntry, &oldDirEntry, sizeof(DIR_ENTRY));
-
- // No path was specified
- dirCluster = partition->cwdCluster;
-
- // Remove the old entry hopefully doesn't screw things up...
- if (!_FAT_directory_removeEntry (partition, &oldDirEntry)) {
- r->_errno = EIO;
- return -1;
- }
-
- // Set the new attribute
- if(hide)
- newDirEntry.entryData[DIR_ENTRY_attributes] |= ATTRIB_HID;
- else
- newDirEntry.entryData[DIR_ENTRY_attributes] &= ~ATTRIB_HID;
-
- // Write the new entry
- if (!_FAT_directory_addEntry (partition, &newDirEntry, dirCluster)) {
- r->_errno = ENOSPC;
- return -1;
- }
-
- // Flush any sectors in the disc cache
- if (!_FAT_cache_flush (partition->cache)) {
- r->_errno = EIO;
- return -1;
- }
-
- return 0;
-}
-
-int _FAT_mkdir_r (struct _reent *r, const char *path, int mode) {
- PARTITION* partition = NULL;
- bool fileExists;
- DIR_ENTRY dirEntry;
- const char* pathEnd;
- u32 parentCluster, dirCluster;
- u8 newEntryData[DIR_ENTRY_DATA_SIZE];
-
- partition = _FAT_partition_getPartitionFromPath (path);
- if (partition == NULL) {
- r->_errno = ENODEV;
- return -1;
- }
-
- // Move the path pointer to the start of the actual path
- if (strchr (path, ':') != NULL) {
- path = strchr (path, ':') + 1;
- }
- if (strchr (path, ':') != NULL) {
- r->_errno = EINVAL;
- return -1;
- }
-
- // Search for the file/directory on the disc
- fileExists = _FAT_directory_entryFromPath (partition, &dirEntry, path, NULL);
-
- // Make sure it doesn't exist
- if (fileExists) {
- r->_errno = EEXIST;
- return -1;
- }
-
- if (partition->readOnly) {
- // We can't write to a read-only partition
- r->_errno = EROFS;
- return -1;
- }
-
- // Get the directory it has to go in
- pathEnd = strrchr (path, DIR_SEPARATOR);
- if (pathEnd == NULL) {
- // No path was specified
- parentCluster = partition->cwdCluster;
- pathEnd = path;
- } else {
- // Path was specified -- get the right parentCluster
- // Recycling dirEntry, since it needs to be recreated anyway
- if (!_FAT_directory_entryFromPath (partition, &dirEntry, path, pathEnd) ||
- !_FAT_directory_isDirectory(&dirEntry)) {
- r->_errno = ENOTDIR;
- return -1;
- }
- parentCluster = _FAT_directory_entryGetCluster (dirEntry.entryData);
- // Move the pathEnd past the last DIR_SEPARATOR
- pathEnd += 1;
- }
-
- // Create the entry data
- strncpy (dirEntry.d_name, pathEnd, MAX_FILENAME_LENGTH - 1);
- memset (dirEntry.entryData, 0, DIR_ENTRY_DATA_SIZE);
-
- // Set the creation time and date
- dirEntry.entryData[DIR_ENTRY_cTime_ms] = 0;
- u16_to_u8array (dirEntry.entryData, DIR_ENTRY_cTime, _FAT_filetime_getTimeFromRTC());
- u16_to_u8array (dirEntry.entryData, DIR_ENTRY_cDate, _FAT_filetime_getDateFromRTC());
-
- // Set the directory attribute
- dirEntry.entryData[DIR_ENTRY_attributes] = ATTRIB_DIR;
-
- // Get a cluster for the new directory
- dirCluster = _FAT_fat_linkFreeClusterCleared (partition, CLUSTER_FREE);
- if (dirCluster == CLUSTER_FREE) {
- // No space left on disc for the cluster
- r->_errno = ENOSPC;
- return -1;
- }
- u16_to_u8array (dirEntry.entryData, DIR_ENTRY_cluster, dirCluster);
- u16_to_u8array (dirEntry.entryData, DIR_ENTRY_clusterHigh, dirCluster >> 16);
-
- // Write the new directory's entry to it's parent
- if (!_FAT_directory_addEntry (partition, &dirEntry, parentCluster)) {
- r->_errno = ENOSPC;
- return -1;
- }
-
- // Create the dot entry within the directory
- memset (newEntryData, 0, DIR_ENTRY_DATA_SIZE);
- memset (newEntryData, ' ', 11);
- newEntryData[DIR_ENTRY_name] = '.';
- newEntryData[DIR_ENTRY_attributes] = ATTRIB_DIR;
- u16_to_u8array (newEntryData, DIR_ENTRY_cluster, dirCluster);
- u16_to_u8array (newEntryData, DIR_ENTRY_clusterHigh, dirCluster >> 16);
-
- // Write it to the directory, erasing that sector in the process
- _FAT_cache_eraseWritePartialSector ( partition->cache, newEntryData,
- _FAT_fat_clusterToSector (partition, dirCluster), 0, DIR_ENTRY_DATA_SIZE);
-
-
- // Create the double dot entry within the directory
- newEntryData[DIR_ENTRY_name + 1] = '.';
- u16_to_u8array (newEntryData, DIR_ENTRY_cluster, parentCluster);
- u16_to_u8array (newEntryData, DIR_ENTRY_clusterHigh, parentCluster >> 16);
-
- // Write it to the directory
- _FAT_cache_writePartialSector ( partition->cache, newEntryData,
- _FAT_fat_clusterToSector (partition, dirCluster), DIR_ENTRY_DATA_SIZE, DIR_ENTRY_DATA_SIZE);
-
- // Flush any sectors in the disc cache
- if (!_FAT_cache_flush(partition->cache)) {
- r->_errno = EIO;
- return -1;
- }
-
- return 0;
-}
-
-DIR_STATE_STRUCT* _FAT_diropen_r(struct _reent *r, DIR_STATE_STRUCT *dirState, const char *path) {
- DIR_ENTRY dirEntry;
- DIR_STATE_STRUCT* state = dirState;
- bool fileExists;
- const char* root_path= "/";
-
- state->partition = _FAT_partition_getPartitionFromPath (path);
- if (state->partition == NULL) {
- r->_errno = ENODEV;
- return NULL;
- }
-
- // Move the path pointer to the start of the actual path
- if (strchr (path, ':') != NULL) {
- path = strchr (path, ':') + 1;
- }
- if (strchr (path, ':') != NULL) {
- r->_errno = EINVAL;
- return NULL;
- }
-
- if('\0' == path[0]) path = root_path;
-
- // Get the start cluster of the directory
- fileExists = _FAT_directory_entryFromPath (state->partition, &dirEntry, path, NULL);
- if (!fileExists) {
- r->_errno = ENOENT;
- return NULL;
- }
-
- // Make sure it is a directory
- if (! _FAT_directory_isDirectory (&dirEntry)) {
- r->_errno = ENOTDIR;
- return NULL;
- }
-
- // Save the start cluster for use when resetting the directory data
- state->startCluster = _FAT_directory_entryGetCluster (dirEntry.entryData);
-
- //Entry location pointer
- state->posEntry = 0;
-
-// // Get the first entry for use with a call to dirnext
-// state->validEntry =
-// _FAT_directory_getFirstEntry (state->partition, &(state->currentEntry), state->startCluster);
- state->validEntry = false;
-
- // We are now using this entry
- state->inUse = true;
- return state;
-}
-
-int _FAT_dirreset_r (struct _reent *r, DIR_STATE_STRUCT *dirState) {
- DIR_STATE_STRUCT* state = dirState;
-
- // Make sure we are still using this entry
- if (!state->inUse) {
- r->_errno = EBADF;
- return -1;
- }
-
- // Get the first entry for use with a call to dirnext
-// state->validEntry =
-// _FAT_directory_getFirstEntry (state->partition, &(state->currentEntry), state->startCluster);
-
- state->posEntry = 0;
-
- return 0;
-}
-
-int _FAT_dirnext_r (struct _reent *r, DIR_STATE_STRUCT *dirState, struct stat *filestat) {
- DIR_STATE_STRUCT* state = dirState;
-
- // Make sure we are still using this entry
- if (!state->inUse) {
- r->_errno = EBADF;
- return -1;
- }
-
- // Make sure there is another file to report on
-// if (!state->validEntry) {
-// r->_errno = ENOENT;
-// return -1;
-// }
-
- if(0 == state->posEntry) {
- state->validEntry = _FAT_directory_getFirstEntry (state->partition, &(state->currentEntry), state->startCluster);
- }
- else
- state->validEntry = _FAT_directory_getNextEntry (state->partition, &(state->currentEntry));
-
- state->posEntry += 1;
-
- if(!state->validEntry)
- {
- r->_errno = ENOENT;
- return -1;
- }
-
- if (filestat != NULL) {
- _FAT_directory_entryStat (state->partition, &(state->currentEntry), filestat);
- }
-
- return 0;
-/*
- // Get the filename
- strncpy (filename, state->currentEntry.d_name, MAX_FILENAME_LENGTH);
- // Get the stats, if requested
- if (filestat != NULL) {
- _FAT_directory_entryStat (state->partition, &(state->currentEntry), filestat);
- }
-
- // Look for the next entry for use next time
- state->validEntry =
- _FAT_directory_getNextEntry (state->partition, &(state->currentEntry));
-
- return 0;
-*/
-}
-
-int _FAT_dirclose_r (struct _reent *r, DIR_STATE_STRUCT *dirState) {
- DIR_STATE_STRUCT* state = dirState;
-
- // We are no longer using this entry
- state->inUse = false;
-
- return 0;
-}
diff --git a/sdk-modifications/libsrc/fs/fatdir.h b/sdk-modifications/libsrc/fs/fatdir.h
deleted file mode 100755
index 7c419ee..0000000
--- a/sdk-modifications/libsrc/fs/fatdir.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- fatdir.h
-
- Functions used by the newlib disc stubs to interface with
- this library
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-08-13 - Chishm
- * Moved all externally visible directory related functions to fatdir
- * Added _FAT_mkdir_r
-
- 2006-08-14 - Chishm
- * Added directory iterator functions
-
- 2007-01-10 - Chishm
- * Updated directory iterator functions for DevkitPro r20
-*/
-
-
-#ifndef _FATDIR_H
-#define _FATDIR_H
-
-//#include <sys/reent.h>
-#include <sys/stat.h>
-//#include <sys/iosupport.h>
-#include "fs_common.h"
-#include "directory.h"
-
-typedef struct {
- PARTITION* partition;
- DIR_ENTRY currentEntry;
- u32 startCluster;
- u32 posEntry;
- bool inUse;
- bool validEntry;
-} DIR_STATE_STRUCT;
-
-extern int _FAT_stat_r (struct _reent *r, const char *path, struct stat *st);
-
-extern int _FAT_link_r (struct _reent *r, const char *existing, const char *newLink);
-
-extern int _FAT_unlink_r (struct _reent *r, const char *name);
-
-extern int _FAT_chdir_r (struct _reent *r, const char *name);
-
-extern int _FAT_rename_r (struct _reent *r, const char *oldName, const char *newName);
-
-extern int _FAT_getshortname_r (struct _reent *r, const char *name, char *outName);
-
-extern int _FAT_hideAttrib_r (struct _reent *r, const char *name, u8 hide);
-
-extern int _FAT_mkdir_r (struct _reent *r, const char *path, int mode);
-
-/*
-Directory iterator functions
-*/
-extern DIR_STATE_STRUCT* _FAT_diropen_r(struct _reent *r, DIR_STATE_STRUCT *dirState, const char *path);
-extern int _FAT_dirreset_r (struct _reent *r, DIR_STATE_STRUCT *dirState);
-extern int _FAT_dirnext_r (struct _reent *r, DIR_STATE_STRUCT *dirState, struct stat *filestat);
-extern int _FAT_dirclose_r (struct _reent *r, DIR_STATE_STRUCT *dirState);
-
-
-#endif // _FATDIR_H
diff --git a/sdk-modifications/libsrc/fs/fatdir_ex.c b/sdk-modifications/libsrc/fs/fatdir_ex.c
deleted file mode 100755
index b773255..0000000
--- a/sdk-modifications/libsrc/fs/fatdir_ex.c
+++ /dev/null
@@ -1,183 +0,0 @@
-#include <string.h>
-
-#include <errno.h>
-
-#include <ctype.h>
-
-#include <unistd.h>
-
-#include <sys/dir.h>
-
-
-#include "fatdir.h"
-
-#include "fatdir_ex.h"
-
-
-#include "cache.h"
-
-#include "file_allocation_table.h"
-
-#include "partition.h"
-
-#include "directory.h"
-
-#include "bit_ops.h"
-
-#include "filetime.h"
-
-#include "unicode/unicode.h"
-
-int dirnextl (DIR_ITER *dirState, char *filename, char *longFilename, struct stat *filestat)
-{
- DIR_STATE_STRUCT* state = (DIR_STATE_STRUCT*) (dirState->dirStruct);
-
-
- // Make sure we are still using this entry
-
- if (!state->inUse) {
-
- errno = EBADF;
- return -1;
-
- }
-
-
- // Make sure there is another file to report on
-
- if (! state->validEntry) {
- errno = ENOENT;
-
- return -1;
-
- }
-
-
- // Get the filename
-
- strncpy (filename, state->currentEntry.d_name, MAX_FILENAME_LENGTH);
-
- // Get long filename
- _FAT_unicode_unicode_to_local( state->currentEntry.unicodeFilename, (u8 *)longFilename );
-
-
- // Get the stats, if requested
-
- if (filestat != NULL) {
-
- _FAT_directory_entryStat (state->partition, &(state->currentEntry), filestat);
-
- }
-
-
- // Look for the next entry for use next time
-
- state->validEntry =
-_FAT_directory_getNextEntry (state->partition, &(state->currentEntry));
-
-
- return 0;
-}
-
-int renamex( const char *oldName, const char *newName )
-{
- PARTITION* partition = NULL;
- DIR_ENTRY oldDirEntry;
- DIR_ENTRY newDirEntry;
- const char *pathEnd;
- u32 dirCluster;
-
- // Get the partition this directory is on
- partition = _FAT_partition_getPartitionFromPath (oldName);
-
- if (partition == NULL) {
- errno = ENODEV;
- return -1;
- }
-
- // Make sure the same partition is used for the old and new names
- if (partition != _FAT_partition_getPartitionFromPath (newName)) {
- errno = EXDEV;
- return -1;
- }
-
- // Make sure we aren't trying to write to a read-only disc
- if (partition->readOnly) {
- errno = EROFS;
- return -1;
- }
-
- // Move the path pointer to the start of the actual path
- if (strchr (oldName, ':') != NULL) {
- oldName = strchr (oldName, ':') + 1;
- }
- if (strchr (oldName, ':') != NULL) {
- errno = EINVAL;
- return -1;
- }
- if (strchr (newName, ':') != NULL) {
- newName = strchr (newName, ':') + 1;
- }
- if (strchr (newName, ':') != NULL) {
- errno = EINVAL;
- return -1;
- }
-
- // Search for the file on the disc
- if (!_FAT_directory_entryFromPath (partition, &oldDirEntry, oldName, NULL)) {
- errno = ENOENT;
- return -1;
- }
-
- // Make sure there is no existing file / directory with the new name
- if (_FAT_directory_entryFromPath (partition, &newDirEntry, newName, NULL)) {
- errno = EEXIST;
- return -1;
- }
-
- // Create the new file entry
- // Get the directory it has to go in
- pathEnd = strrchr (newName, DIR_SEPARATOR);
- if (pathEnd == NULL) {
- // No path was specified
- dirCluster = partition->cwdCluster;
- pathEnd = newName;
- } else {
- // Path was specified -- get the right dirCluster
- // Recycling newDirEntry, since it needs to be recreated anyway
- if (!_FAT_directory_entryFromPath (partition, &newDirEntry, newName, pathEnd) ||
- !_FAT_directory_isDirectory(&newDirEntry)) {
- errno = ENOTDIR;
- return -1;
- }
- dirCluster = _FAT_directory_entryGetCluster (newDirEntry.entryData);
- // Move the pathEnd past the last DIR_SEPARATOR
- pathEnd += 1;
- }
-
- // Copy the entry data
- memcpy (&newDirEntry, &oldDirEntry, sizeof(DIR_ENTRY));
-
- // Set the new name
- strncpy (newDirEntry.d_name, pathEnd, MAX_FILENAME_LENGTH - 1);
-
- // Write the new entry
- if (!_FAT_directory_addEntry (partition, &newDirEntry, dirCluster)) {
- errno = ENOSPC;
- return -1;
- }
-
- // Remove the old entry
- if (!_FAT_directory_removeEntry (partition, &oldDirEntry)) {
- errno = EIO;
- return -1;
- }
-
- // Flush any sectors in the disc cache
- if (!_FAT_cache_flush (partition->cache)) {
- errno = EIO;
- return -1;
- }
-
- return 0;
-}
diff --git a/sdk-modifications/libsrc/fs/fatdir_ex.h b/sdk-modifications/libsrc/fs/fatdir_ex.h
deleted file mode 100755
index fbac46f..0000000
--- a/sdk-modifications/libsrc/fs/fatdir_ex.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef _FATDIR_EX_H_
-#define _FATDIR_EX_H_
-
-#include "fatdir.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int dirnextl (DIR_ITER *dirState, char *filename, char *longFilename, struct stat *filestat);
-int renamex( const char *oldName, const char *newName );
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif//_FATDIR_EX_H_
diff --git a/sdk-modifications/libsrc/fs/fatfile.c b/sdk-modifications/libsrc/fs/fatfile.c
deleted file mode 100755
index 304da34..0000000
--- a/sdk-modifications/libsrc/fs/fatfile.c
+++ /dev/null
@@ -1,889 +0,0 @@
-/*
- fatfile.c
-
- Functions used by the newlib disc stubs to interface with
- this library
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-
- 2006-07-17 - Chishm
- * Made all path inputs const char*
- * Added _FAT_rename_r
-
- 2006-08-02 - Chishm
- * Fixed _FAT_seek_r
-
- 2006-08-13 - Chishm
- * Moved all externally visible directory related functions to fatdir
-*/
-//version 1.12
-
-#include "fatfile.h"
-
-#include <fcntl.h>
-#include <string.h>
-#include <errno.h>
-#include <ctype.h>
-#include <unistd.h>
-
-#include "fs_cache.h"
-#include "file_allocation_table.h"
-#include "bit_ops.h"
-#include "filetime.h"
-
-
-int _FAT_open_r (struct _reent *r, void *fileStruct, const char *path, int flags) {
- PARTITION* partition = NULL;
- bool fileExists;
- DIR_ENTRY dirEntry;
- const char* pathEnd;
- u32 dirCluster;
- FILE_STRUCT* file = (FILE_STRUCT*) fileStruct;
-
-
-
- partition = _FAT_partition_getPartitionFromPath (path);
-
- if (partition == NULL) {
- r->_errno = ENODEV;
- return -1;
- }
-
-
- // Move the path pointer to the start of the actual path
- if (strchr (path, ':') != NULL) {
- path = strchr (path, ':') + 1;
- }
- if (strchr (path, ':') != NULL) {
- r->_errno = EINVAL;
- return -1;
- }
-
- // Determine which mode the file is openned for
- if ((flags & 0x03) == O_RDONLY) {
- // Open the file for read-only access
- file->read = true;
- file->write = false;
- file->append = false;
- } else if ((flags & 0x03) == O_WRONLY) {
- // Open file for write only access
- file->read = false;
- file->write = true;
- file->append = false;
- } else if ((flags & 0x03) == O_RDWR) {
- // Open file for read/write access
- file->read = true;
- file->write = true;
- file->append = false;
- } else {
- r->_errno = EACCES;
- return -1;
- }
-
- // Make sure we aren't trying to write to a read-only disc
- if (file->write && partition->readOnly) {
- r->_errno = EROFS;
- return -1;
- }
-
- // Search for the file on the disc
- fileExists = _FAT_directory_entryFromPath (partition, &dirEntry, path, NULL);
-
- // The file shouldn't exist if we are trying to create it
- if ((flags & O_CREAT) && (flags & O_EXCL) && fileExists) {
- r->_errno = EEXIST;
- return -1;
- }
-
- // It should not be a directory if we're openning a file,
- if (fileExists && _FAT_directory_isDirectory(&dirEntry)) {
- r->_errno = EISDIR;
- return -1;
- }
- // If the file doesn't exist, create it if we're allowed to
- if (!fileExists) {
- if (flags & O_CREAT) {
- if (partition->readOnly) {
- // We can't write to a read-only partition
- r->_errno = EROFS;
- return -1;
- }
- // Create the file
- // Get the directory it has to go in
- pathEnd = strrchr (path, DIR_SEPARATOR);
- if (pathEnd == NULL) {
- // No path was specified
- dirCluster = partition->cwdCluster;
- pathEnd = path;
- } else {
- // Path was specified -- get the right dirCluster
- // Recycling dirEntry, since it needs to be recreated anyway
- if (!_FAT_directory_entryFromPath (partition, &dirEntry, path, pathEnd) ||
- !_FAT_directory_isDirectory(&dirEntry)) {
- r->_errno = ENOTDIR;
- return -1;
- }
- dirCluster = _FAT_directory_entryGetCluster (dirEntry.entryData);
- // Move the pathEnd past the last DIR_SEPARATOR
- pathEnd += 1;
- }
- // Create the entry data
- strncpy (dirEntry.d_name, pathEnd, MAX_FILENAME_LENGTH - 1);
- memset (dirEntry.entryData, 0, DIR_ENTRY_DATA_SIZE);
-
- // Set the creation time and date
- dirEntry.entryData[DIR_ENTRY_cTime_ms] = 0;
- u16_to_u8array (dirEntry.entryData, DIR_ENTRY_cTime, _FAT_filetime_getTimeFromRTC());
- u16_to_u8array (dirEntry.entryData, DIR_ENTRY_cDate, _FAT_filetime_getDateFromRTC());
-
- if (!_FAT_directory_addEntry (partition, &dirEntry, dirCluster)) {
- r->_errno = ENOSPC;
- return -1;
- }
- } else {
- // file doesn't exist, and we aren't creating it
- r->_errno = ENOENT;
- return -1;
- }
- }
-
- file->filesize = u8array_to_u32 (dirEntry.entryData, DIR_ENTRY_fileSize);
- /* Allow LARGEFILEs with undefined results
- // Make sure that the file size can fit in the available space
- if (!(flags & O_LARGEFILE) && (file->filesize >= (1<<31))) {
- r->_errno = EFBIG;
- return -1;
- }
- */
-
- // Make sure we aren't trying to write to a read-only file
- if (file->write && !_FAT_directory_isWritable(&dirEntry)) {
- r->_errno = EROFS;
- return -1;
- }
-
- // Associate this file with a particular partition
- file->partition = partition;
- file->startCluster = _FAT_directory_entryGetCluster (dirEntry.entryData);
-
- // Truncate the file if requested
- if ((flags & O_TRUNC) && file->write && (file->startCluster != 0)) {
- _FAT_fat_clearLinks (partition, file->startCluster);
- file->startCluster = 0;
- file->filesize = 0;
- }
-
- // Get a new cluster for the file if required
- if (file->startCluster == 0) {
- file->startCluster = _FAT_fat_linkFreeCluster (partition, CLUSTER_FREE);
- }
-
- // Remember the position of this file's directory entry
- file->dirEntryStart = dirEntry.dataStart; // Points to the start of the LFN entries of a file, or the alias for no LFN
- file->dirEntryEnd = dirEntry.dataEnd;
-
- file->currentPosition = 0;
-
- file->rwPosition.cluster = file->startCluster;
- file->rwPosition.sector = 0;
- file->rwPosition.byte = 0;
-
-
- if (flags & O_APPEND) {
- file->append = true;
- file->appendPosition.cluster = _FAT_fat_lastCluster (partition, file->startCluster);
- file->appendPosition.sector = (file->filesize % partition->bytesPerCluster) / BYTES_PER_READ;
- file->appendPosition.byte = file->filesize % BYTES_PER_READ;
-
- // Check if the end of the file is on the end of a cluster
- if ( (file->filesize > 0) && ((file->filesize % partition->bytesPerCluster)==0) ){
- // Set flag to allocate a new cluster
- file->appendPosition.sector = partition->sectorsPerCluster;
- file->appendPosition.byte = 0;
- }
- } else{
- file->append = false;
- file->appendPosition = file->rwPosition;
- }
-
- file->inUse = true;
-
- partition->openFileCount += 1;
-
- return (int) file;
-}
-
-int _FAT_close_r (struct _reent *r, int fd) {
- FILE_STRUCT* file = (FILE_STRUCT*) fd;
- u8 dirEntryData[DIR_ENTRY_DATA_SIZE];
-
- if (!file->inUse) {
- r->_errno = EBADF;
- return -1;
- }
- if (file->write) {
- // Load the old entry
- _FAT_cache_readPartialSector (file->partition->cache, dirEntryData,
- _FAT_fat_clusterToSector(file->partition, file->dirEntryEnd.cluster) + file->dirEntryEnd.sector,
- file->dirEntryEnd.offset * DIR_ENTRY_DATA_SIZE, DIR_ENTRY_DATA_SIZE);
-
- // Write new data to the directory entry
- // File size
- u32_to_u8array (dirEntryData, DIR_ENTRY_fileSize, file->filesize);
-
- // Start cluster
- u16_to_u8array (dirEntryData, DIR_ENTRY_cluster, file->startCluster);
- u16_to_u8array (dirEntryData, DIR_ENTRY_clusterHigh, file->startCluster >> 16);
-
- // Modification time and date
- u16_to_u8array (dirEntryData, DIR_ENTRY_mTime, _FAT_filetime_getTimeFromRTC());
- u16_to_u8array (dirEntryData, DIR_ENTRY_mDate, _FAT_filetime_getDateFromRTC());
-
- // Access date
- u16_to_u8array (dirEntryData, DIR_ENTRY_aDate, _FAT_filetime_getDateFromRTC());
-
- // Write the new entry
- _FAT_cache_writePartialSector (file->partition->cache, dirEntryData,
- _FAT_fat_clusterToSector(file->partition, file->dirEntryEnd.cluster) + file->dirEntryEnd.sector,
- file->dirEntryEnd.offset * DIR_ENTRY_DATA_SIZE, DIR_ENTRY_DATA_SIZE);
-
- // Flush any sectors in the disc cache
- if (!_FAT_cache_flush(file->partition->cache)) {
- r->_errno = EIO;
- return -1;
- }
- }
-
- file->inUse = false;
- file->partition->openFileCount -= 1;
-
- return 0;
-}
-
-int _FAT_read_r (struct _reent *r, int fd, char *ptr, int len) {
- FILE_STRUCT* file = (FILE_STRUCT*) fd;
- PARTITION* partition;
- CACHE* cache;
-
- FILE_POSITION position;
- u32 tempNextCluster;
-
- int tempVar;
-
- u32 remain;
-
- bool flagNoError = true;
-
- // Make sure we can actually read from the file
- if ((file == NULL) || !file->inUse || !file->read) {
- r->_errno = EBADF;
- return 0;
- }
-
- // Don't try to read if the read pointer is past the end of file
- if (file->currentPosition >= file->filesize) {
- return 0;
- }
-
- // Don't read past end of file
- if (len + file->currentPosition > file->filesize) {
- r->_errno = EOVERFLOW;
- len = file->filesize - file->currentPosition;
- }
-
- remain = len; //Assume len > 0
-
- position = file->rwPosition;
-
- partition = file->partition;
- cache = file->partition->cache;
-
- // Move onto next cluster if needed
- if (position.sector >= partition->sectorsPerCluster) {
- tempNextCluster = _FAT_fat_nextCluster(partition, position.cluster);
- if (tempNextCluster == CLUSTER_EOF) {
- position.sector = partition->sectorsPerCluster;
- } else if (tempNextCluster == CLUSTER_FREE) {
- r->_errno = EIO;
- return 0;
- } else {
- position.sector = 0;
- position.cluster = tempNextCluster;
- }
- }
-
- // Align to sector
- tempVar = BYTES_PER_READ - position.byte;
- if (tempVar > remain) {
- tempVar = remain;
- }
-
- if (tempVar < BYTES_PER_READ)
- {
- _FAT_cache_readPartialSector ( cache, ptr, _FAT_fat_clusterToSector (partition, position.cluster) + position.sector,
- position.byte, tempVar);
-
- remain -= tempVar;
- ptr += tempVar;
-
- position.byte += tempVar;
- if (position.byte >= BYTES_PER_READ) {
- position.byte = 0;
- position.sector++;
- }
- }
-
- // Align to cluster
- //remaining more than 1 sector and read part of cluster
- if((remain >= BYTES_PER_READ) && (position.sector < partition->sectorsPerCluster))
- {
- // tempVar is number of sectors to write
- tempVar = remain / BYTES_PER_READ;
- if(tempVar > (partition->sectorsPerCluster - position.sector))
- tempVar = partition->sectorsPerCluster - position.sector;
-
- // read several sectors from disk
- _FAT_disc_readSectors (partition->disc, _FAT_fat_clusterToSector (partition, position.cluster) + position.sector,
- tempVar, ptr);
-
- ptr += tempVar * BYTES_PER_READ;
- remain -= tempVar * BYTES_PER_READ;
- position.sector += tempVar;
- }
-
- // Move onto next cluster
- // It should get to here without reading anything if a cluster is due to be allocated
- if ((remain>0) && (position.sector >= partition->sectorsPerCluster)) {
- tempNextCluster = _FAT_fat_nextCluster(partition, position.cluster);
- if (tempNextCluster == CLUSTER_EOF) {
- position.sector = partition->sectorsPerCluster;
- } else if (tempNextCluster == CLUSTER_FREE) {
- r->_errno = EIO;
- flagNoError = false;
- } else {
- position.sector = 0;
- position.cluster = tempNextCluster;
- }
- }
-
- // Read in whole clusters
- while ((remain >= partition->bytesPerCluster) && flagNoError) {
- _FAT_disc_readSectors (partition->disc, _FAT_fat_clusterToSector (partition, position.cluster), partition->sectorsPerCluster, ptr);
- ptr += partition->bytesPerCluster;
- remain -= partition->bytesPerCluster;
-
- // Advance to next cluster
- tempNextCluster = _FAT_fat_nextCluster(partition, position.cluster);
- if ((remain == 0) && (tempNextCluster == CLUSTER_EOF)) {
- position.sector = partition->sectorsPerCluster;
- } else if (tempNextCluster == CLUSTER_FREE) {
- r->_errno = EIO;
- flagNoError = false;
- } else {
- position.sector = 0;
- position.cluster = tempNextCluster;
- }
- }
-
- // Read remaining sectors
- tempVar = remain / BYTES_PER_READ; // Number of sectors left
- if ((tempVar > 0) && flagNoError) {
- _FAT_disc_readSectors (partition->disc, _FAT_fat_clusterToSector (partition, position.cluster),
- tempVar, ptr);
- ptr += tempVar * BYTES_PER_READ;
- remain -= tempVar * BYTES_PER_READ;
- position.sector += tempVar;
- }
-
- // Last remaining sector
- // Check if anything is left
- if ((remain > 0) && flagNoError) {
- _FAT_cache_readPartialSector ( cache, ptr,
- _FAT_fat_clusterToSector (partition, position.cluster) + position.sector, 0, remain);
- position.byte += remain;
- remain = 0;
- }
-
- // Length read is the wanted length minus the stuff not read
- len = len - remain;
-
- // Update file information
- file->rwPosition = position;
- file->currentPosition += len;
-
- return len;
-}
-
-/*
-Extend a file so that the size is the same as the rwPosition
-*/
-static bool file_extend_r (struct _reent *r, FILE_STRUCT* file) {
- PARTITION* partition = file->partition;
- CACHE* cache = file->partition->cache;
-
- FILE_POSITION position;
-
- u32 remain;
-
- u8 zeroBuffer [BYTES_PER_READ] = {0};
-
- u32 tempNextCluster;
-
- position.byte = file->filesize % BYTES_PER_READ;
-
- u32 partCluster = file->filesize % partition->bytesPerCluster;
- if(0 == partCluster && 0 != file->filesize) //integer cluster
- partCluster = partition->bytesPerCluster;
- //position.sector = (file->filesize % partition->bytesPerCluster) / BYTES_PER_READ;
- position.sector = partCluster / BYTES_PER_READ;
-
- //This function index the last Cluster currently used, when file size equal Cluster size, will cause problem
- position.cluster = _FAT_fat_lastCluster (partition, file->startCluster);
-
- remain = file->currentPosition - file->filesize;
-
- // Move onto next cluster if needed
- if (position.sector >= partition->sectorsPerCluster) {
- //Because _FAT_fat_lastCluster point to the last cluster currently used, so
- //position.sector == partition->sectorsPerCluster means, the last cluster all used
- //move to next cluster
- position.sector = 0;
- tempNextCluster = _FAT_fat_nextCluster(partition, position.cluster);
- if ((tempNextCluster == CLUSTER_EOF) || (tempNextCluster == CLUSTER_FREE)) {
- // Ran out of clusters so get a new one
- tempNextCluster = _FAT_fat_linkFreeCluster(partition, position.cluster);
- }
- if (tempNextCluster == CLUSTER_FREE) {
- // Couldn't get a cluster, so abort
- r->_errno = ENOSPC;
- return false;
- } else {
- position.cluster = tempNextCluster;
- }
- }
-
- // Only need to clear to the end of the sector
- if (remain + position.byte < BYTES_PER_READ) {
- _FAT_cache_writePartialSector (cache, zeroBuffer,
- _FAT_fat_clusterToSector (partition, position.cluster) + position.sector, position.byte, remain);
- position.byte += remain;
- } else {
- if (position.byte > 0) {
- _FAT_cache_writePartialSector (cache, zeroBuffer,
- _FAT_fat_clusterToSector (partition, position.cluster) + position.sector, position.byte,
- BYTES_PER_READ - position.byte);
- remain -= (BYTES_PER_READ - position.byte);
- position.byte = 0;
- position.sector ++;
- }
-
- while (remain >= BYTES_PER_READ) {
- if (position.sector >= partition->sectorsPerCluster) {
- position.sector = 0;
- tempNextCluster = _FAT_fat_nextCluster(partition, position.cluster);
- if ((tempNextCluster == CLUSTER_EOF) || (tempNextCluster == CLUSTER_FREE)) {
- // Ran out of clusters so get a new one
- tempNextCluster = _FAT_fat_linkFreeCluster(partition, position.cluster);
- }
- if (tempNextCluster == CLUSTER_FREE) {
- // Couldn't get a cluster, so abort
- r->_errno = ENOSPC;
- return false;
- } else {
- position.cluster = tempNextCluster;
- }
- }
-
- _FAT_disc_writeSectors (partition->disc,
- _FAT_fat_clusterToSector (partition, position.cluster) + position.sector, 1, zeroBuffer);
- //cancel the dirty state of cahced sctor, not necessary here, the sector haven't allocated yet
- //_FAT_cache_writePartialSector_check(cache,
- // _FAT_fat_clusterToSector (partition, position.cluster) + position.sector, 1, zeroBuffer);
-
- remain -= BYTES_PER_READ;
- position.sector ++;
- }
-
- if (position.sector >= partition->sectorsPerCluster) {
- position.sector = 0;
- tempNextCluster = _FAT_fat_nextCluster(partition, position.cluster);
- if ((tempNextCluster == CLUSTER_EOF) || (tempNextCluster == CLUSTER_FREE)) {
- // Ran out of clusters so get a new one
- tempNextCluster = _FAT_fat_linkFreeCluster(partition, position.cluster);
- }
- if (tempNextCluster == CLUSTER_FREE) {
- // Couldn't get a cluster, so abort
- r->_errno = ENOSPC;
- return false;
- } else {
- position.cluster = tempNextCluster;
- }
- }
-
- if (remain > 0) {
- _FAT_cache_writePartialSector (cache, zeroBuffer,
- _FAT_fat_clusterToSector (partition, position.cluster) + position.sector, 0, remain);
- position.byte = remain;
- }
- }
-
- file->rwPosition = position;
- file->filesize = file->currentPosition;
- return true;
-}
-
-
-int _FAT_write_r (struct _reent *r,int fd, const char *ptr, int len) {
- FILE_STRUCT* file = (FILE_STRUCT*) fd;
-
- PARTITION* partition;
- CACHE* cache;
-
- FILE_POSITION position;
- u32 tempNextCluster;
-
- int tempVar;
-
- u32 remain;
-
- bool flagNoError = true;
- bool flagAppending = false;
-
- // Make sure we can actually write to the file
- if ((file == NULL) || !file->inUse || !file->write) {
- r->_errno = EBADF;
- return -1;
- }
-
- partition = file->partition;
- cache = file->partition->cache;
- remain = len;
-
- if (file->append) {
- position = file->appendPosition;
- flagAppending = true;
- } else {
- // If the write pointer is past the end of the file, extend the file to that size,
- // the extended area set to zero
- if (file->currentPosition > file->filesize) { //This may accure when fseek called before
- if (!file_extend_r (r, file)) { //the function have done Cluster moving
- return 0;
- }
- }
-
- // Write at current read pointer
- position = file->rwPosition;
-
- // If it is writing past the current end of file, set appending flag
- if (len + file->currentPosition > file->filesize) {
- flagAppending = true;
- }
- }
-
- // Move onto next cluster if needed
- if (position.sector >= partition->sectorsPerCluster) {
- position.sector = 0;
- tempNextCluster = _FAT_fat_nextCluster(partition, position.cluster);
- if ((tempNextCluster == CLUSTER_EOF) || (tempNextCluster == CLUSTER_FREE)) {
- // Ran out of clusters so get a new one
- tempNextCluster = _FAT_fat_linkFreeCluster(partition, position.cluster);
- }
- if (tempNextCluster == CLUSTER_FREE) {
- // Couldn't get a cluster, so abort
- r->_errno = ENOSPC;
- flagNoError = false;
- } else {
- position.cluster = tempNextCluster;
- }
- }
-
- // Align to sector
- if(flagNoError && (position.byte > 0))
- {
- tempVar = BYTES_PER_READ - position.byte;
- if (tempVar > remain) {
- tempVar = remain;
- }
-
- // Write partial sector to disk
- _FAT_cache_writePartialSector (cache, ptr,
- _FAT_fat_clusterToSector (partition, position.cluster) + position.sector, position.byte, tempVar);
-
- remain -= tempVar;
- ptr += tempVar;
- position.byte += tempVar;
-
- // Move onto next sector
- if (position.byte >= BYTES_PER_READ) {
- position.byte = 0;
- position.sector ++; //here may be needed move to next cluster
- }
- }
-
- // Align to cluster
- //remaining more than 1 sector and used part of cluster
- if(flagNoError && (remain >= BYTES_PER_READ) && (position.sector < partition->sectorsPerCluster))
- {
- // tempVar is number of sectors to write
- tempVar = remain / BYTES_PER_READ;
- if(tempVar > (partition->sectorsPerCluster - position.sector))
- tempVar = partition->sectorsPerCluster - position.sector;
-
- // write several sectors to disk
- _FAT_disc_writeSectors (partition->disc,
- _FAT_fat_clusterToSector (partition, position.cluster) + position.sector, tempVar, ptr);
- //cancel the dirty state of cached sctor
- _FAT_cache_writePartialSector_check(cache,
- _FAT_fat_clusterToSector (partition, position.cluster) + position.sector, tempVar, ptr);
-
- ptr += tempVar * BYTES_PER_READ;
- remain -= tempVar * BYTES_PER_READ;
- position.sector += tempVar;
- }
-
- // Move onto next cluster if needed
- if (flagNoError && (position.sector >= partition->sectorsPerCluster) && (remain > 0)) {
- position.sector = 0;
- tempNextCluster = _FAT_fat_nextCluster(partition, position.cluster);
- if ((tempNextCluster == CLUSTER_EOF) || (tempNextCluster == CLUSTER_FREE)) {
- // Ran out of clusters so get a new one
- tempNextCluster = _FAT_fat_linkFreeCluster(partition, position.cluster);
- }
- if (tempNextCluster == CLUSTER_FREE) {
- // Couldn't get a cluster, so abort
- r->_errno = ENOSPC;
- flagNoError = false;
- } else {
- position.cluster = tempNextCluster;
- }
- }
-
- // Write whole clusters
- while ((remain >= partition->bytesPerCluster) && flagNoError) {
- _FAT_disc_writeSectors (partition->disc, _FAT_fat_clusterToSector(partition, position.cluster),
- partition->sectorsPerCluster, ptr);
- //cancel the dirty state of cahced sctor
- _FAT_cache_writePartialSector_check(cache, _FAT_fat_clusterToSector(partition, position.cluster),
- partition->sectorsPerCluster, ptr);
-
- ptr += partition->bytesPerCluster;
- remain -= partition->bytesPerCluster;
- if (remain > 0) {
- tempNextCluster = _FAT_fat_nextCluster(partition, position.cluster);
- if ((tempNextCluster == CLUSTER_EOF) || (tempNextCluster == CLUSTER_FREE)) {
- // Ran out of clusters so get a new one
- tempNextCluster = _FAT_fat_linkFreeCluster(partition, position.cluster);
- }
- if (tempNextCluster == CLUSTER_FREE) {
- // Couldn't get a cluster, so abort
- r->_errno = ENOSPC;
- flagNoError = false;
- } else {
- position.cluster = tempNextCluster;
- }
- } else {
- // Allocate a new cluster when next writing the file
- position.sector = partition->sectorsPerCluster;
- }
- }
-
- // Write remaining sectors
- // Number of sectors left
- tempVar = remain / BYTES_PER_READ;
- if ((tempVar > 0) && flagNoError) {
- _FAT_disc_writeSectors (partition->disc, _FAT_fat_clusterToSector (partition, position.cluster),
- tempVar, ptr);
- //cancel the dirty state of cahced sctor
- _FAT_cache_writePartialSector_check(cache, _FAT_fat_clusterToSector (partition, position.cluster),
- tempVar, ptr);
-
- ptr += tempVar * BYTES_PER_READ;
- remain -= tempVar * BYTES_PER_READ;
- position.sector += tempVar;
- }
-
- // Last remaining partial sector
- if ((remain > 0) && flagNoError) {
- if (flagAppending) {
- //allocated new sector, erasing remaing unused part
- //Actually, no necessary. when using fwrite to increase the file size, valid data area end at currentPosition
- //when using fseek to increase file size, valid data area end at rwPosition, the increased zero area will valid
- //at next fwrite, fread before this can not read out the increased zero area, the file size also not changed
- //before next fwrite called
- _FAT_cache_eraseWritePartialSector ( cache, ptr,
- _FAT_fat_clusterToSector (partition, position.cluster) + position.sector, 0, remain);
- } else {
- _FAT_cache_writePartialSector ( cache, ptr,
- _FAT_fat_clusterToSector (partition, position.cluster) + position.sector, 0, remain);
- }
- position.byte += remain;
- remain = 0;
- }
-
- // Amount read is the originally requested amount minus stuff remaining
- len = len - remain;
-
- // Update file information
- if (file->append) {
- // Appending doesn't affect the read pointer
- file->appendPosition = position;
- file->filesize += len;
- } else {
- // Writing also shifts the read pointer
- file->rwPosition = position;
- file->currentPosition += len;
- if (file->filesize < file->currentPosition) {
- file->filesize = file->currentPosition;
- }
- }
-
- return len;
-}
-
-#include "ds2io.h"
-int _FAT_seek_r (struct _reent *r, int fd, int pos, int dir) {
- FILE_STRUCT* file = (FILE_STRUCT*) fd;
-
- PARTITION* partition;
-
- u32 cluster, nextCluster;
- int clusCount;
- int position;
-
- if ((file == NULL) || (file->inUse == false)) {
- // invalid file
- r->_errno = EBADF;
- return -1;
- }
-
- partition = file->partition;
-
- switch (dir) {
- case SEEK_SET:
- position = pos;
- break;
- case SEEK_CUR:
- position = file->currentPosition + pos;
- break;
- case SEEK_END:
- position = file->filesize + pos;
- break;
- default:
- r->_errno = EINVAL;
- return -1;
- }
-
- if ((pos > 0) && (position < 0)) {
- r->_errno = EOVERFLOW;
- return -1;
- }
-
- if (position < 0) {
- r->_errno = EINVAL;
- return -1;
- }
-
- // Only change the read/write position if it is within or at the bounds of the current filesize
- if (file->filesize >= position) {
-
- // Calculate where the correct cluster is
- if (position >= file->currentPosition) {
- clusCount = (position / partition->bytesPerCluster) - (file->currentPosition / partition->bytesPerCluster);
- cluster = file->rwPosition.cluster;
- //When last reading, it stop at the cluster boundary,
- //file->rwPosition.sector == partition->bytesPerCluster, but
- //file->rwPosition.cluster did not move to next cluster
- if(file->rwPosition.sector >= partition->sectorsPerCluster)
- clusCount += 1;
- } else {
- clusCount = position / partition->bytesPerCluster;
- cluster = file->startCluster;
- }
-
- // Calculate the sector and byte of the current position, and store them
- file->rwPosition.sector = (position % partition->bytesPerCluster) / BYTES_PER_READ;
- file->rwPosition.byte = position % BYTES_PER_READ;
-
- nextCluster = _FAT_fat_nextCluster (partition, cluster);
- while ((clusCount > 0) && (nextCluster != CLUSTER_FREE) && (nextCluster != CLUSTER_EOF)) {
- clusCount--;
- cluster = nextCluster;
- nextCluster = _FAT_fat_nextCluster (partition, cluster);
- }
-
- // Check if ran out of clusters, and the file is being written to
- if ((clusCount > 0) && (file->write || file->append)) {
- // Set flag to allocate a new cluster
- file->rwPosition.sector = partition->sectorsPerCluster;
- file->rwPosition.byte = 0;
- }
-
- file->rwPosition.cluster = cluster;
- }
-
- // Save position
- file->currentPosition = position;
-
- return position;
-}
-
-
-
-int _FAT_fstat_r (struct _reent *r, int fd, struct stat *st) {
- FILE_STRUCT* file = (FILE_STRUCT*) fd;
-
- PARTITION* partition;
-
- DIR_ENTRY fileEntry;
-
- if ((file == NULL) || (file->inUse == false)) {
- // invalid file
- r->_errno = EBADF;
- return -1;
- }
-
- partition = file->partition;
-
- // Get the file's entry data
- fileEntry.dataStart = file->dirEntryStart;
- fileEntry.dataEnd = file->dirEntryEnd;
-
- if (!_FAT_directory_entryFromPosition (partition, &fileEntry)) {
- r->_errno = EIO;
- return -1;
- }
-
- // Fill in the stat struct
- _FAT_directory_entryStat (partition, &fileEntry, st);
-
- // Fix stats that have changed since the file was openned
- st->st_ino = (ino_t)(file->startCluster); // The file serial number is the start cluster
- st->st_size = file->filesize; // File size
-
- return 0;
-}
-
diff --git a/sdk-modifications/libsrc/fs/fatfile.h b/sdk-modifications/libsrc/fs/fatfile.h
deleted file mode 100755
index 4869562..0000000
--- a/sdk-modifications/libsrc/fs/fatfile.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- fatfile.h
-
- Functions used by the newlib disc stubs to interface with
- this library
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-
- 2006-07-17 - Chishm
- * Made all path inputs const char*
- * Added _FAT_rename_r
-
- 2006-07-24 - Chishm
- * Removed padding workaround from FILE_STRUCT
-
- 2006-08-13 - Chishm
- * Moved all externally visible directory related functions to fatdir
-*/
-
-
-#ifndef _FATFILE_H
-#define _FATFILE_H
-
-//#include <sys/reent.h>
-#include <sys/stat.h>
-
-#include "fs_common.h"
-#include "partition.h"
-#include "directory.h"
-
-typedef struct {
- u32 cluster;
- u32 sector;
- s32 byte;
-} FILE_POSITION;
-
-typedef struct {
- int fd;
- u32 filesize;
- u32 startCluster;
- u32 currentPosition;
- FILE_POSITION rwPosition;
- FILE_POSITION appendPosition;
- bool read;
- bool write;
- bool append;
- bool inUse;
- PARTITION* partition;
- DIR_ENTRY_POSITION dirEntryStart; // Points to the start of the LFN entries of a file, or the alias for no LFN
- DIR_ENTRY_POSITION dirEntryEnd; // Always points to the file's alias entry
-} FILE_STRUCT;
-
-extern int _FAT_open_r (struct _reent *r, void *fileStruct, const char *path, int flags);
-
-extern int _FAT_close_r (struct _reent *r, int fd);
-
-extern int _FAT_write_r (struct _reent *r,int fd, const char *ptr, int len);
-
-extern int _FAT_read_r (struct _reent *r, int fd, char *ptr, int len);
-
-extern int _FAT_seek_r (struct _reent *r, int fd,int pos, int dir);
-
-extern int _FAT_fstat_r (struct _reent *r, int fd, struct stat *st);
-
-#endif // _FATFILE_H
diff --git a/sdk-modifications/libsrc/fs/fatfile_ex.c b/sdk-modifications/libsrc/fs/fatfile_ex.c
deleted file mode 100755
index aa23fb3..0000000
--- a/sdk-modifications/libsrc/fs/fatfile_ex.c
+++ /dev/null
@@ -1,47 +0,0 @@
-#include <fcntl.h>
-#include <string.h>
-#include <errno.h>
-#include <ctype.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <iorpg.h>
-
-#include "cache.h"
-#include "file_allocation_table.h"
-#include "bit_ops.h"
-#include "filetime.h"
-#include "fatfile.h"
-
-// origin fread/fwrite do not take advantage of continuous read/write function of SD/NAND,
-// it looks like the third parameter to _FAT_read_r()/_FAT_write_r() is a fixed '2'
-// so they are much slower than these two....
-
-// due to behavior of _FAT_read_r()/_FAT_write_r(),
-// FAT should have a at least 8192 cluster size to get better performance,
-// 16K or larger cluster size can get the best performance.
-
-
-
-int freadex( void * buffer, int _size, int _n, FILE * f )
-{
- if( 0 == _n )
- return 0;
- dbg_printf("freadx %d\n", _n );
- struct _reent r;
- int ret = _FAT_read_r( &r, (int)f->_file + 8, buffer, _size * _n );
- errno = r._errno;
- return ret;
-}
-
-
-int fwriteex( const void * buffer, int _size, int _n, FILE * f )
-{
- if( 0 == _n )
- return 0;
- dbg_printf("fwritex new %d\n", _n );
- struct _reent r;
- int ret = _FAT_write_r( &r, (int)f->_file + 8, buffer, _size * _n );
- errno = r._errno;
- return ret;
-}
-
diff --git a/sdk-modifications/libsrc/fs/fatfile_ex.h b/sdk-modifications/libsrc/fs/fatfile_ex.h
deleted file mode 100755
index c434b63..0000000
--- a/sdk-modifications/libsrc/fs/fatfile_ex.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef _FATFILE_EX_H_
-#define _FATFILE_EX_H_
-
-#include <stdio.h>
-#include "fatfile.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int freadex( void * buffer, int _size, int _n, FILE * f );
-int fwritex( const void * buffer, int _size, int _n, FILE * f );
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif//_FATFILE_EX_H_
diff --git a/sdk-modifications/libsrc/fs/file_allocation_table.c b/sdk-modifications/libsrc/fs/file_allocation_table.c
deleted file mode 100644
index f382b52..0000000
--- a/sdk-modifications/libsrc/fs/file_allocation_table.c
+++ /dev/null
@@ -1,330 +0,0 @@
-/*
- file_allocation_table.c
- Reading, writing and manipulation of the FAT structure on
- a FAT partition
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-
- 2006-07-11 - Chishm
- * Made several fixes related to free clusters, thanks to Loopy
-
- 2006-10-01 - Chishm
- * Added _FAT_fat_linkFreeClusterCleared to clear a cluster when it is allocated
-*/
-
-
-#include "file_allocation_table.h"
-#include "partition.h"
-#include <string.h>
-
-/*
-Gets the cluster linked from input cluster
-*/
-u32 _FAT_fat_nextCluster(PARTITION* partition, u32 cluster)
-{
- u32 nextCluster = CLUSTER_FREE;
- u32 sector;
- int offset;
-
- switch (partition->filesysType)
- {
- case FS_UNKNOWN:
- nextCluster = CLUSTER_FREE;
- break;
-
- case FS_FAT12:
- sector = partition->fat.fatStart + (((cluster * 3) / 2) / BYTES_PER_READ);
- offset = ((cluster * 3) / 2) % BYTES_PER_READ;
-
-
- _FAT_cache_readPartialSector (partition->cache, &nextCluster, sector, offset, sizeof(u8));
-
- offset++;
-
- if (offset >= BYTES_PER_READ) {
- offset = 0;
- sector++;
- }
-
- _FAT_cache_readPartialSector (partition->cache, ((u8*)&nextCluster) + sizeof(u8), sector, offset, sizeof(u8));
-
- if (cluster & 0x01) {
- nextCluster = nextCluster >> 4;
- } else {
- nextCluster &= 0x0FFF;
- }
-
- if (nextCluster >= 0x0FF7)
- {
- nextCluster = CLUSTER_EOF;
- }
-
- break;
-
- case FS_FAT16:
- sector = partition->fat.fatStart + ((cluster << 1) / BYTES_PER_READ);
- offset = (cluster % (BYTES_PER_READ >> 1)) << 1;
-
- _FAT_cache_readPartialSector (partition->cache, &nextCluster, sector, offset, sizeof(u16));
-
- if (nextCluster >= 0xFFF7)
- {
- nextCluster = CLUSTER_EOF;
- }
- break;
-
- case FS_FAT32:
- sector = partition->fat.fatStart + ((cluster << 2) / BYTES_PER_READ);
- offset = (cluster % (BYTES_PER_READ >> 2)) << 2;
-
- _FAT_cache_readPartialSector (partition->cache, &nextCluster, sector, offset, sizeof(u32));
-
- if (nextCluster >= 0x0FFFFFF7)
- {
- nextCluster = CLUSTER_EOF;
- }
- break;
-
- default:
- nextCluster = CLUSTER_FREE;
- break;
- }
-
- return nextCluster;
-}
-
-/*
-writes value into the correct offset within a partition's FAT, based
-on the cluster number.
-*/
-static bool _FAT_fat_writeFatEntry (PARTITION* partition, u32 cluster, u32 value) {
- u32 sector;
- int offset;
- u8 oldValue;
-
- if ((cluster < 0x0002) || (cluster > partition->fat.lastCluster))
- {
- return false;
- }
-
- switch (partition->filesysType)
- {
- case FS_UNKNOWN:
- return false;
- break;
-
- case FS_FAT12:
- sector = partition->fat.fatStart + (((cluster * 3) / 2) / BYTES_PER_READ);
- offset = ((cluster * 3) / 2) % BYTES_PER_READ;
-
- if (cluster & 0x01) {
-
- _FAT_cache_readPartialSector (partition->cache, &oldValue, sector, offset, sizeof(u8));
-
- value = (value << 4) | (oldValue & 0x0F);
-
- _FAT_cache_writePartialSector (partition->cache, &value, sector, offset, sizeof(u8));
-
- offset++;
- if (offset >= BYTES_PER_READ) {
- offset = 0;
- sector++;
- }
-
- _FAT_cache_writePartialSector (partition->cache, ((u8*)&value) + sizeof(u8), sector, offset, sizeof(u8));
-
- } else {
-
- _FAT_cache_writePartialSector (partition->cache, &value, sector, offset, sizeof(u8));
-
- offset++;
- if (offset >= BYTES_PER_READ) {
- offset = 0;
- sector++;
- }
-
- _FAT_cache_readPartialSector (partition->cache, &oldValue, sector, offset, sizeof(u8));
-
- value = ((value >> 8) & 0x0F) | (oldValue & 0xF0);
-
- _FAT_cache_writePartialSector (partition->cache, &value, sector, offset, sizeof(u8));
- }
-
- break;
-
- case FS_FAT16:
- sector = partition->fat.fatStart + ((cluster << 1) / BYTES_PER_READ);
- offset = (cluster % (BYTES_PER_READ >> 1)) << 1;
-
- _FAT_cache_writePartialSector (partition->cache, &value, sector, offset, sizeof(u16));
-
- break;
-
- case FS_FAT32:
- sector = partition->fat.fatStart + ((cluster << 2) / BYTES_PER_READ);
- offset = (cluster % (BYTES_PER_READ >> 2)) << 2;
-
- _FAT_cache_writePartialSector (partition->cache, &value, sector, offset, sizeof(u32));
-
- break;
-
- default:
- return false;
- break;
- }
-
- return true;
-}
-
-/*-----------------------------------------------------------------
-gets the first available free cluster, sets it
-to end of file, links the input cluster to it then returns the
-cluster number
-If an error occurs, return CLUSTER_FREE
------------------------------------------------------------------*/
-u32 _FAT_fat_linkFreeCluster(PARTITION* partition, u32 cluster) {
- u32 firstFree;
- u32 curLink;
- u32 lastCluster;
- bool loopedAroundFAT = false;
-
- lastCluster = partition->fat.lastCluster;
-
- if (cluster > lastCluster) {
- return CLUSTER_FREE;
- }
-
- // Check if the cluster already has a link, and return it if so
- curLink = _FAT_fat_nextCluster(partition, cluster);
- if ((curLink >= CLUSTER_FIRST) && (curLink <= lastCluster)) {
- return curLink; // Return the current link - don't allocate a new one
- }
-
- // Get a free cluster
- firstFree = partition->fat.firstFree;
- // Start at first valid cluster
- if (firstFree < CLUSTER_FIRST) {
- firstFree = CLUSTER_FIRST;
- }
-
- // Search until a free cluster is found
- while (_FAT_fat_nextCluster(partition, firstFree) != CLUSTER_FREE) {
- firstFree++;
- if (firstFree > lastCluster) {
- if (loopedAroundFAT) {
- // If couldn't get a free cluster then return, saying this fact
- partition->fat.firstFree = firstFree;
- return CLUSTER_FREE;
- } else {
- // Try looping back to the beginning of the FAT
- // This was suggested by loopy
- firstFree = CLUSTER_FIRST;
- loopedAroundFAT = true;
- }
- }
- }
- partition->fat.firstFree = firstFree;
-
- if ((cluster >= CLUSTER_FIRST) && (cluster < lastCluster))
- {
- // Update the linked from FAT entry
- _FAT_fat_writeFatEntry (partition, cluster, firstFree);
- }
- // Create the linked to FAT entry
- _FAT_fat_writeFatEntry (partition, firstFree, CLUSTER_EOF);
-
- return firstFree;
-}
-
-/*-----------------------------------------------------------------
-gets the first available free cluster, sets it
-to end of file, links the input cluster to it, clears the new
-cluster to 0 valued bytes, then returns the cluster number
-If an error occurs, return CLUSTER_FREE
------------------------------------------------------------------*/
-u32 _FAT_fat_linkFreeClusterCleared (PARTITION* partition, u32 cluster) {
- u32 newCluster;
- int i;
- u8 emptySector[BYTES_PER_READ];
-
- // Link the cluster
- newCluster = _FAT_fat_linkFreeCluster(partition, cluster);
- if (newCluster == CLUSTER_FREE) {
- return CLUSTER_FREE;
- }
-
- // Clear all the sectors within the cluster
- memset (emptySector, 0, BYTES_PER_READ);
- for (i = 0; i < partition->sectorsPerCluster; i++) {
- _FAT_disc_writeSectors (partition->disc,
- _FAT_fat_clusterToSector (partition, newCluster) + i,
- 1, emptySector);
- }
-
- return newCluster;
-}
-
-
-/*-----------------------------------------------------------------
-_FAT_fat_clearLinks
-frees any cluster used by a file
------------------------------------------------------------------*/
-bool _FAT_fat_clearLinks (PARTITION* partition, u32 cluster) {
- u32 nextCluster;
-
- if ((cluster < 0x0002) || (cluster > partition->fat.lastCluster))
- return false;
-
- // If this clears up more space in the FAT before the current free pointer, move it backwards
- if (cluster < partition->fat.firstFree) {
- partition->fat.firstFree = cluster;
- }
-
- while ((cluster != CLUSTER_EOF) && (cluster != CLUSTER_FREE)) {
- // Store next cluster before erasing the link
- nextCluster = _FAT_fat_nextCluster (partition, cluster);
-
- // Erase the link
- _FAT_fat_writeFatEntry (partition, cluster, CLUSTER_FREE);
-
- // Move onto next cluster
- cluster = nextCluster;
- }
-
- return true;
-}
-
-/*-----------------------------------------------------------------
-_FAT_fat_lastCluster
-Trace the cluster links until the last one is found
------------------------------------------------------------------*/
-u32 _FAT_fat_lastCluster (PARTITION* partition, u32 cluster) {
- while ((_FAT_fat_nextCluster(partition, cluster) != CLUSTER_FREE) && (_FAT_fat_nextCluster(partition, cluster) != CLUSTER_EOF)) {
- cluster = _FAT_fat_nextCluster(partition, cluster);
- }
- return cluster;
-}
diff --git a/sdk-modifications/libsrc/fs/file_allocation_table.h b/sdk-modifications/libsrc/fs/file_allocation_table.h
deleted file mode 100755
index 4fb4149..0000000
--- a/sdk-modifications/libsrc/fs/file_allocation_table.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- file_allocation_table.h
- Reading, writing and manipulation of the FAT structure on
- a FAT partition
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-
- 2006-10-01 - Chishm
- * Added _FAT_fat_linkFreeClusterCleared to clear a cluster when it is allocated
-*/
-
-#ifndef _FAT_H
-#define _FAT_H
-
-#include "fs_common.h"
-#include "partition.h"
-
-#define CLUSTER_EOF_16 0xFFFF
-#define CLUSTER_EOF 0x0FFFFFFF
-#define CLUSTER_FREE 0x0000
-#define CLUSTER_FIRST 0x0002
-
-#define CLUSTERS_PER_FAT12 4085
-#define CLUSTERS_PER_FAT16 65525
-
-
-u32 _FAT_fat_nextCluster(PARTITION* partition, u32 cluster);
-
-u32 _FAT_fat_linkFreeCluster(PARTITION* partition, u32 cluster);
-u32 _FAT_fat_linkFreeClusterCleared (PARTITION* partition, u32 cluster);
-
-bool _FAT_fat_clearLinks (PARTITION* partition, u32 cluster);
-
-u32 _FAT_fat_lastCluster (PARTITION* partition, u32 cluster);
-
-static inline u32 _FAT_fat_clusterToSector (PARTITION* partition, u32 cluster) {
- return (cluster >= 2) ? ((cluster - 2) * partition->sectorsPerCluster) + partition->dataStart : partition->rootDirStart;
-}
-
-#endif // _FAT_H
diff --git a/sdk-modifications/libsrc/fs/filetime.c b/sdk-modifications/libsrc/fs/filetime.c
deleted file mode 100755
index f2de6ef..0000000
--- a/sdk-modifications/libsrc/fs/filetime.c
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- filetime.c
- Conversion of file time and date values to various other types
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-
- 2006-09-30 - Chishm
- * Validity checks performed on the time supplied by the IPC
- * Cleaned up magic numbers
-
- 2006-10-01 - Chishm
- * Fixed incorrect use of bitwise-or instead of logical-or
-*/
-
-
-#include "filetime.h"
-
-#ifdef NDS
-//#include <nds/ipc.h>
-#include "ds2io.h"
-#endif
-
-#define HOUR_PM_INDICATOR 40
-
-#define MAX_HOUR 23
-#define MAX_MINUTE 59
-#define MAX_SECOND 59
-
-#define MAX_YEAR 99
-#define MIN_YEAR 6 // The date is invalid if it's before this year
-#define MAX_MONTH 12
-#define MIN_MONTH 1
-#define MAX_DAY 31
-#define MIN_DAY 1
-
-// Second values are averages, so time value won't be 100% accurate,
-// but should be within the correct month.
-#define SECONDS_PER_MINUTE 60
-#define SECONDS_PER_HOUR 3600
-#define SECONDS_PER_DAY 86400
-#define SECONDS_PER_MONTH 2629743
-#define SECONDS_PER_YEAR 31556926
-
-u16 _FAT_filetime_getTimeFromRTC (void) {
-#ifdef NDS
- int hour, minute, second;
- struct rtc time;
-
- ds2_getTime(&time);
-
- hour = (time.hours >= HOUR_PM_INDICATOR ? time.hours - HOUR_PM_INDICATOR : time.hours);
- minute = time.minutes;
- second = time.seconds;
-
- // Check that the values are all in range.
- // If they are not, return 0 (no timestamp)
- if ((hour < 0) || (hour > MAX_HOUR)) return 0;
- if ((minute < 0) || (minute > MAX_MINUTE)) return 0;
- if ((second < 0) || (second > MAX_SECOND)) return 0;
-
- return (
- ((hour & 0x1F) << 11) |
- ((minute & 0x3F) << 5) |
- ((second >> 1) & 0x1F)
- );
-#else
- return 0;
-#endif
-}
-
-
-u16 _FAT_filetime_getDateFromRTC (void) {
-#ifdef NDS
- int year, month, day;
- struct rtc time;
-
- ds2_getTime(&time);
-
- year = time.year;
- month = time.month;
- day = time.day;
-
- if ((year < MIN_YEAR) || (year > MAX_YEAR)) return 0;
- if ((month < MIN_MONTH) || (month > MAX_MONTH)) return 0;
- if ((day < MIN_DAY) || (day > MAX_DAY)) return 0;
-
- return (
- (((year + 20) & 0x7F) <<9) | // Adjust for MS-FAT base year (1980 vs 2000 for DS clock)
- ((month & 0xF) << 5) |
- (day & 0x1F)
- );
-#else
- return 0;
-#endif
-}
-
-time_t _FAT_filetime_to_time_t (u16 time, u16 date) {
- int hour, minute, second;
- int day, month, year;
-
- time_t result;
-
- hour = time >> 11;
- minute = (time >> 5) & 0x3F;
- second = (time & 0x1F) << 1;
-
- day = date & 0x1F;
- month = (date >> 5) & 0x0F;
- year = date >> 9;
-
- // Second values are averages, so time value won't be 100% accurate,
- // but should be within the correct month.
- result = second
- + minute * SECONDS_PER_MINUTE
- + hour * SECONDS_PER_HOUR
- + day * SECONDS_PER_DAY
- + month * SECONDS_PER_MONTH
- + year * SECONDS_PER_YEAR
- ;
-
- return result;
-}
diff --git a/sdk-modifications/libsrc/fs/filetime.h b/sdk-modifications/libsrc/fs/filetime.h
deleted file mode 100755
index fa651a7..0000000
--- a/sdk-modifications/libsrc/fs/filetime.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- filetime.h
- Conversion of file time and date values to various other types
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-*/
-
-#ifndef _FILETIME_H
-#define _FILETIME_H
-
-#include "fs_common.h"
-#include <sys/types.h>
-
-u16 _FAT_filetime_getTimeFromRTC (void);
-u16 _FAT_filetime_getDateFromRTC (void);
-
-time_t _FAT_filetime_to_time_t (u16 time, u16 date);
-
-
-#endif // _FILETIME_H
diff --git a/sdk-modifications/libsrc/fs/fs.mk b/sdk-modifications/libsrc/fs/fs.mk
deleted file mode 100644
index 3fee249..0000000
--- a/sdk-modifications/libsrc/fs/fs.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-#fs.mk
-
-SRC += $(FS_DIR)/cache.c \
- $(FS_DIR)/directory.c \
- $(FS_DIR)/fatdir.c \
- $(FS_DIR)/fatfile.c \
- $(FS_DIR)/file_allocation_table.c \
- $(FS_DIR)/filetime.c \
- $(FS_DIR)/fs_api.c \
- $(FS_DIR)/fs_unicode.c \
- $(FS_DIR)/libfat.c \
- $(FS_DIR)/partition.c \
- $(FS_DIR)/fat_misc.c \
- $(FS_DIR)/disc_io/disc.c \
- $(FS_DIR)/disc_io/io_ds2_mmcf.c \
- $(FS_DIR)/ds2_fcntl.c \
- $(FS_DIR)/ds2_unistd.c
-
-SSRC +=
-
-INC += -I$(FS_DIR) -I$(FS_DIR)/disc_io
-
-CFLAGS += -DNDS
-
diff --git a/sdk-modifications/libsrc/fs/fs_api.c b/sdk-modifications/libsrc/fs/fs_api.c
deleted file mode 100755
index b23a450..0000000
--- a/sdk-modifications/libsrc/fs/fs_api.c
+++ /dev/null
@@ -1,452 +0,0 @@
-//fs_api.c
-
-#include <stdio.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <string.h>
-#include <sys/stat.h>
-#include "fs_common.h"
-#include "fatfile.h"
-#include "fatdir.h"
-
-typedef unsigned int size_t;
-typedef unsigned int mode_t;
-
-typedef struct {
- const char* mode; /* mode string */
- unsigned int flag; /* mode flag */
-// unsigned char mode_r; /* READ */
-// unsigned char mode_w; /* WRITE */
-// unsigned char mode_a; /* APPEND */
-// unsigned char mode_c; /* CREATE */
-} _fat_mode_type;
-
-static const _fat_mode_type _fat_valid_mode[] = {
- { "r" , O_RDONLY },
- { "w" , O_WRONLY | O_TRUNC | O_CREAT },
- { "a" , O_WRONLY | O_APPEND | O_CREAT },
- { "rb" , O_RDONLY },
- { "wb" , O_WRONLY | O_TRUNC | O_CREAT },
- { "ab" , O_WRONLY | O_APPEND | O_CREAT },
- { "r+" , O_RDWR },
- { "w+" , O_RDWR | O_TRUNC | O_CREAT },
- { "a+" , O_RDWR | O_APPEND | O_CREAT },
- { "r+b" , O_RDWR },
- { "rb+" , O_RDWR },
- { "w+b" , O_RDWR | O_TRUNC | O_CREAT },
- { "wb+" , O_RDWR | O_TRUNC | O_CREAT },
- { "a+b" , O_RDWR | O_APPEND | O_CREAT },
- { "ab+" , O_RDWR | O_APPEND | O_CREAT }
-};
-
-#define MAX_OPEN_FILE 16
-#define MAX_OPEN_DIR 32
-#define MAX_PWD_LEN 512
-#define MAX_STDIO_BUF_SIZE 2048
-
-#define FAT_VALID_MODE_NUM (sizeof(_fat_valid_mode)/sizeof(_fat_mode_type))
-
-static FILE_STRUCT __FILEs[MAX_OPEN_FILE];
-struct _reent __REENT;
-static DIR_STATE_STRUCT __DIRs[MAX_OPEN_DIR];
-static char __PWD[MAX_PWD_LEN];
-
-int fat_init(void)
-{
- int i, flag;
-
- for(i= 0; i < MAX_OPEN_FILE; i++)
- __FILEs[i].inUse = false;
-
- for(i= 0; i < MAX_OPEN_DIR; i++)
- __DIRs[i].inUse = false;
-
- flag = -1;
- if(_FAT_Init() == true) //success
- flag = 0;
-
- return flag;
-}
-
-FILE_STRUCT* fat_fopen(const char *file, const char *mode)
-{
- int i, k;
- int fd;
- FILE_STRUCT* fp;
-
- for(i= 0; i < MAX_OPEN_FILE; i++)
- if(false == __FILEs[i].inUse) break;
-
- if(i >= MAX_OPEN_FILE)
- {
- __REENT._errno = EMFILE; /* Too many open files */
- return NULL;
- }
-
- for(k = 0; k < FAT_VALID_MODE_NUM; k++)
- if(!strcasecmp(_fat_valid_mode[k].mode, mode)) break;
-
- if(k >= FAT_VALID_MODE_NUM)
- {
- __REENT._errno = EINVAL;
- return NULL;
- }
-
- fd = _FAT_open_r(&__REENT, (void*)&__FILEs[i], file, _fat_valid_mode[k].flag);
- if(-1 == fd) return NULL;
-
- fp = &__FILEs[i];
- fp -> fd = fd;
-
- return fp;
-}
-
-size_t fat_fread(void *buf, size_t size, size_t count, FILE_STRUCT *fp)
-{
- if(0 == size || 0 == count)
- return 0;
-
- int len = _FAT_read_r(&__REENT, fp->fd, (char*)buf, size*count);
- len /= size;
- return len;
-}
-
-size_t fat_fwrite(const void *buf, size_t size, size_t count, FILE_STRUCT *fp)
-{
- if(0 == size || 0 == count)
- return 0;
-
- int len = _FAT_write_r(&__REENT, fp->fd, (const char*)buf, size*count);
- len /= size;
-
- return len;
-}
-
-int fat_fclose(FILE_STRUCT *fp)
-{
- return( _FAT_close_r(&__REENT, fp->fd) );
-}
-
-int fat_fseek(FILE_STRUCT *fp, long offset, int whence)
-{
- int flag;
-
- //When success, _FAT_seek_r return file position pointer
- flag = _FAT_seek_r (&__REENT, fp->fd, (int)offset, whence);
- if(flag > 0) flag = 0;
-
- return flag;
-}
-
-long fat_ftell(FILE_STRUCT *fp)
-{
- return( (long)fp->currentPosition );
-}
-
-int fat_feof(FILE_STRUCT *fp)
-{
- int result;
-
- result = 0;
- if((fp->currentPosition +1) >= (fp->filesize))
- result = -1;
-
- return result;
-}
-
-int fat_ferror(FILE_STRUCT *fp)
-{
- return( __REENT._errno );
-}
-
-void fat_clearerr(FILE_STRUCT *fp)
-{
- fp = fp;
-
- __REENT._errno = 0;
-}
-
-int fat_fflush(FILE_STRUCT *fp)
-{
- return(_FAT_cache_flush(fp->partition->cache));
-}
-
-int fat_fgetc(FILE_STRUCT *fp)
-{
- char ch;
- int result;
-
- result = _FAT_read_r(&__REENT, fp->fd, &ch, 1);
- if(0 == result)
- return EOF;
-
- return ( (int)ch );
-}
-
-char* fat_fgets(char* buf, int n, FILE_STRUCT* fp)
-{
- int m;
- char *s;
-
- buf[0] = '\0';
- if(n <= 1) return buf;
-
- n -= 1;
- m = _FAT_read_r(&__REENT, fp->fd, buf, n);
- if(0 == m) return NULL;
-
- buf[m] = '\0';
- s = strchr((const char*)buf, 0x0A);
-
- if(NULL != s)
- {
- *(++s)= '\0';
- m -= s - buf;
-
- //fix reading pointer
- _FAT_seek_r (&__REENT, fp->fd, -m, SEEK_CUR);
- }
- else if(m == n)
- {
- if(0x0D == buf[n-1]) //0x0D,0x0A
- {
- buf[n-1] = '\0';
- _FAT_seek_r (&__REENT, fp->fd, -1, SEEK_CUR);
- }
- }
-
- return buf;
-}
-
-int fat_fputc(int ch, FILE_STRUCT *fp)
-{
- return( _FAT_write_r(&__REENT, fp->fd, (const char*)&ch, 1) );
-}
-
-int fat_fputs(const char *s, FILE_STRUCT *fp)
-{
- unsigned int len;
-
- len = strlen(s);
- return( _FAT_write_r(&__REENT, fp->fd, s, len) );
-}
-
-int fat_remove(const char *filename)
-{
- return( _FAT_unlink_r (&__REENT, (const char*)filename) );
-}
-
-int fat_rename(const char *oldName, const char *newName)
-{
- return( _FAT_rename_r(&__REENT, oldName, newName) );
-}
-
-int fat_setHidden(const char *name, unsigned char hide){
- return(_FAT_hideAttrib_r (&__REENT, name, hide));
-}
-
-#define S_ISHID(st_mode) ((st_mode & S_IHIDDEN) != 0)
-int fat_isHidden(struct stat *st){
- return S_ISHID(st->st_mode);
-}
-
-int fat_getShortName(const char *fullName, char *outName){
- return(_FAT_getshortname_r (&__REENT, fullName, outName));
-}
-
-
-void fat_rewind(FILE_STRUCT *fp)
-{
- _FAT_seek_r (&__REENT, fp->fd, 0, SEEK_SET);
-}
-
-int fat_fstat(int fildes, struct stat *buf)
-{
- return( _FAT_fstat_r (&__REENT, fildes, buf) );
-}
-
-//int fat_fprintf(FILE_STRUCT *fp, const char *format, ...)
-int fat_fprintf(void* fp, const char *format, ...)
-{
- int ret;
- va_list ap;
- char buf[MAX_STDIO_BUF_SIZE];
-
- if(NULL == fp)
- {
- __REENT._errno = EINVAL;
- return -1;
- }
-
- //FIXME: stderr, stdout
- if((void*)stderr == fp) return 0;
- if((void*)stdout == fp) return 0;
-
- memset(buf, 0, MAX_STDIO_BUF_SIZE);
-
- va_start (ap, format);
- ret = vsnprintf (buf, MAX_STDIO_BUF_SIZE, format, ap);
- va_end (ap);
-
- //if output string too long, it will not put out to file
- if(ret >= MAX_STDIO_BUF_SIZE)
- return -1;
-
- return( _FAT_write_r(&__REENT, ((FILE_STRUCT*)fp)->fd, (const char*)buf, strlen(buf)) );
-}
-
-int fat_fscanf(FILE_STRUCT *fp, const char *format, ...)
-{
- int ret;
- va_list ap;
- char buf[MAX_STDIO_BUF_SIZE];
- char *pt;
-
- if(NULL == fp)
- {
- __REENT._errno = EINVAL;
- return -1;
- }
-
- pt = fat_fgets(buf, MAX_STDIO_BUF_SIZE, fp);
- if(NULL == pt)
- return -1;
-
- va_start (ap, format);
- ret = vsscanf (buf, format, ap);
-
- return ret;
-}
-
-DIR_STATE_STRUCT* fat_opendir(const char *name)
-{
- int i;
-
- for(i = 0; i < MAX_OPEN_DIR; i++)
- {
- if(false == __DIRs[i].inUse) break;
- }
-
- if(i>= MAX_OPEN_DIR)
- {
- __REENT._errno = EMFILE; /* Too many open files */
- return NULL;
- }
-
- return( _FAT_diropen_r(&__REENT, &__DIRs[i], name) );
-}
-
-DIR_ENTRY* fat_readdir(DIR_STATE_STRUCT *dirp)
-{
- int isValid;
-
- isValid = _FAT_dirnext_r (&__REENT, dirp, NULL);
- if(0 != isValid)
- return NULL;
-
- return( &(dirp->currentEntry) );
-}
-
-long int fat_telldir(DIR_STATE_STRUCT *dirp)
-{
- return( dirp->posEntry );
-}
-
-void fat_seekdir(DIR_STATE_STRUCT *dirp, long int loc)
-{
- if (!dirp->inUse) {
- __REENT._errno = EBADF;
- return;
- }
-
- if(0 == loc)
- {
- dirp->posEntry = 0;
- }
- else if(loc > 0)
- {
- while(dirp->posEntry < loc)
- {
- dirp->validEntry = _FAT_directory_getNextEntry (dirp->partition, &(dirp->currentEntry));
- dirp->posEntry += 1;
-
- if(!dirp->validEntry) break;
- }
- }
-
- return;
-}
-
-int fat_closedir(DIR_STATE_STRUCT *dirp)
-{
- return(_FAT_dirclose_r (&__REENT, dirp));
-}
-
-int fat_chdir(const char *path)
-{
- int ret;
- char *pt;
-
- ret = _FAT_chdir_r (&__REENT, path);
- if(0 != ret) return -1;
-
- pt = strchr(path, ':');
- if(pt == NULL)
- strcat(__PWD, path);
- else
- strcpy(__PWD, path);
-
- pt = strchr(__PWD, '\0');
- while(pt-- != __PWD)
- {
- if(pt[0] != DIR_SEPARATOR) break;
- }
-
- pt[1] = DIR_SEPARATOR;
- pt[2] = '\0';
-
- return 0;
-}
-
-char* fat_getcwd(char *buf, size_t size)
-{
- int len;
-
- len = strlen(__PWD);
- if(len >= size)
- {
- __REENT._errno = ERANGE;
- return NULL;
- }
-
- strcpy(buf, __PWD);
- return buf;
-}
-
-int fat_mkdir(const char *path, mode_t mode)
-{
- return( _FAT_mkdir_r(&__REENT, path, mode) );
-}
-
-int fat_rmdir(const char *path)
-{
- return( _FAT_unlink_r(&__REENT, path) );
-}
-
-int fat_lstat(const char *path, struct stat *buf)
-{
- return( _FAT_stat_r (&__REENT, path, buf) );
-}
-
-DIR_ENTRY* fat_readdir_ex(DIR_STATE_STRUCT *dirp, struct stat *statbuf)
-{
- int isValid;
-
- isValid = _FAT_dirnext_r (&__REENT, dirp, statbuf);
- if(0 != isValid)
- return NULL;
-
- return( &(dirp->currentEntry) );
-}
-
diff --git a/sdk-modifications/libsrc/fs/fs_api.h b/sdk-modifications/libsrc/fs/fs_api.h
deleted file mode 100755
index fa4ae07..0000000
--- a/sdk-modifications/libsrc/fs/fs_api.h
+++ /dev/null
@@ -1,130 +0,0 @@
-#ifndef __FS_API_H__
-#define __FS_API_H__
-//v1.0
-
-#include "sys/stat.h"
-#include "fatfile.h"
-#include "fatdir.h"
-
-extern struct _reent __REENT;
-typedef unsigned int mode_t;
-
-extern int fat_init(void);
-
-extern FILE_STRUCT* fat_fopen(const char *file, const char *mode);
-
-extern size_t fat_fread(void *buf, size_t size, size_t count, FILE_STRUCT *fp);
-
-extern size_t fat_fwrite(const void *buf, size_t size, size_t count, FILE_STRUCT *fp);
-
-extern int fat_fclose(FILE_STRUCT *fp);
-
-extern int fat_fseek(FILE_STRUCT *fp, long offset, int whence);
-
-extern long fat_ftell(FILE_STRUCT *fp);
-
-extern int fat_feof(FILE_STRUCT *fp);
-
-extern int fat_ferror(FILE_STRUCT *fp);
-
-extern void fat_clearerr(FILE_STRUCT *fp);
-
-extern int fat_fflush(FILE_STRUCT *fp);
-
-extern int fat_fgetc(FILE_STRUCT *fp);
-
-extern char* fat_fgets(char *buf, int n, FILE_STRUCT *fp);
-
-extern int fat_fputc(int ch, FILE_STRUCT *fp);
-
-extern int fat_fputs(const char *s, FILE_STRUCT *fp);
-
-extern int fat_remove(const char *filename);
-
-extern int fat_rename(const char *oldName, const char *newName);
-
-extern int fat_setHidden(const char *name, unsigned char hide);
-
-extern int fat_isHidden(struct stat *st);
-
-extern int fat_getShortName(const char *fullName, char *outName);
-
-extern void fat_rewind(FILE_STRUCT *fp);
-
-extern int fat_fstat(int fildes, struct stat *buf);
-
-extern int fat_fprintf(void* fp, const char *format, ...);
-
-extern int fat_fscanf(FILE_STRUCT *fp, const char *format, ...);
-
-extern DIR_STATE_STRUCT* fat_opendir(const char *name);
-
-extern DIR_ENTRY* fat_readdir(DIR_STATE_STRUCT *dirp);
-
-extern long fat_telldir(DIR_STATE_STRUCT *dirp);
-
-extern void fat_seekdir(DIR_STATE_STRUCT *dirp, long int loc);
-
-extern int fat_closedir(DIR_STATE_STRUCT *dirp);
-
-extern int fat_chdir(const char *path);
-
-extern char* fat_getcwd(char *buf, size_t size);
-
-extern int fat_mkdir(const char *path, mode_t mode);
-
-extern int fat_rmdir(const char *path);
-
-extern int fat_lstat(const char *path, struct stat *buf);
-
-extern DIR_ENTRY* fat_readdir_ex(DIR_STATE_STRUCT *dirp, struct stat *statbuf);
-
-//#define S_ISDIR(st) (st.st_mode & S_IFDIR)
-
-#define FILE FILE_STRUCT
-#define fopen fat_fopen
-#define fread fat_fread
-#define fwrite fat_fwrite
-#define fclose fat_fclose
-#define fseek fat_fseek
-#define ftell fat_ftell
-#define feof fat_feof
-#define ferror fat_ferror
-#define fclearerr fat_clearerr
-#define fflush fat_fflush
-#define fgetc fat_fgetc
-#define fgets fat_fgets
-#define fputc fat_fputc
-#define fputs fat_fputs
-#define fprintf fat_fprintf
-#define fscanf fat_fscanf
-#define remove fat_remove
-#define fhidden fat_isHidden
-
-#define DIR DIR_STATE_STRUCT
-#define dirent DIR_ENTRY
-#define opendir fat_opendir
-#define readdir fat_readdir
-#define telldir fat_telldir
-#define seekdir fat_seekdir
-#define closedir fat_closedir
-#define chdir fat_chdir
-#define getcwd fat_getcwd
-#define mkdir fat_mkdir
-#define rmdir fat_rmdir
-
-#define lstat fat_lstat
-#define fstat fat_fstat
-
-#define S_ISHID(st_mode) ((st_mode & S_IHIDDEN) != 0)
-
-//the extended version of readdir_ex
-#define readdir_ex fat_readdir_ex
-
-#define MAX_PATH 512
-#define MAX_FILE 512
-
-//Misc function
-extern bool fat_getDiskSpaceInfo( char * diskName, unsigned int *total, unsigned int *used, unsigned int *freeSpace );
-
-#endif //__FS_API_H__
diff --git a/sdk-modifications/libsrc/fs/fs_cache.h b/sdk-modifications/libsrc/fs/fs_cache.h
deleted file mode 100755
index 1abae66..0000000
--- a/sdk-modifications/libsrc/fs/fs_cache.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- cache.h
- The cache is not visible to the user. It should be flushed
- when any file is closed or changes are made to the filesystem.
-
- This cache implements a least-used-page replacement policy. This will
- distribute sectors evenly over the pages, so if less than the maximum
- pages are used at once, they should all eventually remain in the cache.
- This also has the benefit of throwing out old sectors, so as not to keep
- too many stale pages around.
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-*/
-
-#ifndef _CACHE_H
-#define _CACHE_H
-
-#include "fs_common.h"
-#include "disc_io/disc_io.h"
-
-#define CACHE_PAGE_SIZE BYTES_PER_READ
-
-typedef struct {
- u32 sector;
- u32 count;
- bool dirty;
-} CACHE_ENTRY;
-
-typedef struct {
- const IO_INTERFACE* disc;
- u32 numberOfPages;
- CACHE_ENTRY* cacheEntries;
- u8* pages;
-} CACHE;
-
-
-/*
-Read data from a sector in the cache
-If the sector is not in the cache, it will be swapped in
-offset is the position to start reading from
-size is the amount of data to read
-Precondition: offset + size <= BYTES_PER_READ
-*/
-bool _FAT_cache_readPartialSector (CACHE* cache, void* buffer, u32 sector, u32 offset, u32 size);
-
-/*
-Write data to a sector in the cache
-If the sector is not in the cache, it will be swapped in.
-When the sector is swapped out, the data will be written to the disc
-offset is the position to start reading from
-size is the amount of data to read
-Precondition: offset + size <= BYTES_PER_READ
-*/
-bool _FAT_cache_writePartialSector (CACHE* cache, const void* buffer, u32 sector, u32 offset, u32 size);
-
-/*
-some where call _FAT_cache_writePartialSector to cache sector m , but later, another
-place(in fwrite function) directly write data to sector m, in this case, need to
-cancel the dirty state of sector m
-*/
-void _FAT_cache_writePartialSector_check (CACHE* cache, u32 sector, u32 num, const void* buffer);
-
-/*
-Write data to a sector in the cache, zeroing the sector first
-If the sector is not in the cache, it will be swapped in.
-When the sector is swapped out, the data will be written to the disc
-offset is the position to start reading from
-size is the amount of data to read
-Precondition: offset + size <= BYTES_PER_READ
-*/
-bool _FAT_cache_eraseWritePartialSector (CACHE* cache, const void* buffer, u32 sector, u32 offset, u32 size);
-
-/*
-Read a full sector from the cache
-*/
-static inline bool _FAT_cache_readSector (CACHE* cache, void* buffer, u32 sector) {
- return _FAT_cache_readPartialSector (cache, buffer, sector, 0, BYTES_PER_READ);
-}
-
-/*
-Write a full sector to the cache
-*/
-static inline bool _FAT_cache_writeSector (CACHE* cache, const void* buffer, u32 sector) {
- return _FAT_cache_writePartialSector (cache, buffer, sector, 0, BYTES_PER_READ);
-}
-
-/*
-Write any dirty sectors back to disc and clear out the contents of the cache
-*/
-bool _FAT_cache_flush (CACHE* cache);
-
-/*
-Clear out the contents of the cache without writing any dirty sectors first
-*/
-void _FAT_cache_invalidate (CACHE* cache);
-
-CACHE* _FAT_cache_constructor (u32 numberOfPages, const IO_INTERFACE* discInterface);
-
-void _FAT_cache_destructor (CACHE* cache);
-
-#endif // _CACHE_H
diff --git a/sdk-modifications/libsrc/fs/fs_common.h b/sdk-modifications/libsrc/fs/fs_common.h
deleted file mode 100755
index db47d9a..0000000
--- a/sdk-modifications/libsrc/fs/fs_common.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- common.h
- Common definitions and included files for the FATlib
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-*/
-
-#ifndef _COMMON_H
-#define _COMMON_H
-
-// When compiling for NDS, make sure NDS is defined
-#ifndef NDS
- #if defined ARM9 || defined ARM7
- #define NDS
- #endif
-#endif
-
-#if 0
-#ifdef NDS
- #include <nds/jtypes.h>
-#else
- #include "gba_types.h"
-#endif
-#endif
-
-#define BYTES_PER_READ 512
-
-// MODIFICATION START [Neb]
-// In libfat by Chishm, some types are #define'd here. In the DS2 SDK,
-// these types are defined by another header.
-#include "ds2_types.h"
-
-#ifndef bool
-#define bool int
-#endif
-
-#ifndef false
-#define false 0
-#endif
-
-#ifndef true
-#define true 1
-#endif
-
-// MODIFICATION END [Neb]
-
-struct _reent
-{
- /* FILE is a big struct and may change over time. To try to achieve binary
- compatibility with future versions, put stdin,stdout,stderr here.
- These are pointers into member __sf defined below. */
-// __FILE *_stdin, *_stdout, *_stderr; /* XXX */
-
- int _errno; /* local copy of errno */
-
-// int _inc; /* used by tmpnam */
-
-// char *_emergency;
-
-// int __sdidinit; /* 1 means stdio has been init'd */
-
-// int _current_category; /* unused */
-// _CONST char *_current_locale; /* unused */
-
-// struct _mprec *_mp;
-
-// void _EXFNPTR(__cleanup, (struct _reent *));
-
-// int _gamma_signgam;
-
- /* used by some fp conversion routines */
-// int _cvtlen; /* should be size_t */
-// char *_cvtbuf;
-
-// struct _rand48 *_r48;
-// struct __tm *_localtime_buf;
-// char *_asctime_buf;
-
- /* signal info */
-// void (**(_sig_func))(int);
-
- /* atexit stuff */
-// struct _atexit *_atexit;
-// struct _atexit _atexit0;
-
-// struct _glue __sglue; /* root of glue chain */
-// __FILE *__sf; /* file descriptors */
-// struct _misc_reent *_misc; /* strtok, multibyte states */
-// char *_signal_buf; /* strsignal */
-};
-
-#endif // _COMMON_H
diff --git a/sdk-modifications/libsrc/fs/fs_unicode.c b/sdk-modifications/libsrc/fs/fs_unicode.c
deleted file mode 100755
index 2f1c1ed..0000000
--- a/sdk-modifications/libsrc/fs/fs_unicode.c
+++ /dev/null
@@ -1,173 +0,0 @@
-//fs_unicode.c
-
-#include <string.h>
-#include "fs_common.h"
-
-//void _FAT_unicode_init_default() // ANSI CODE PAGE
-//{
-// _L2UTable = NULL;
-// _U2LTable = NULL;
-// _ankTable = NULL;
-//}
-
-static inline const char* _FAT_utf8decode(const char* utf8, u16 *ucs)
-{
- unsigned char c = *utf8++;
- unsigned long code;
- int tail = 0;
-
- if ((c <= 0x7f) || (c >= 0xc2)) {
- /* Start of new character. */
- if (c < 0x80) { /* U-00000000 - U-0000007F, 1 byte */
- code = c;
- } else if (c < 0xe0) { /* U-00000080 - U-000007FF, 2 bytes */
- tail = 1;
- code = c & 0x1f;
- } else if (c < 0xf0) { /* U-00000800 - U-0000FFFF, 3 bytes */
- tail = 2;
- code = c & 0x0f;
- } else if (c < 0xf5) { /* U-00010000 - U-001FFFFF, 4 bytes */
- tail = 3;
- code = c & 0x07;
- } else {
- /* Invalid size. */
- code = 0;
- }
-
- while (tail-- && ((c = *utf8++) != 0)) {
- if ((c & 0xc0) == 0x80) {
- /* Valid continuation character. */
- code = (code << 6) | (c & 0x3f);
-
- } else {
- /* Invalid continuation char */
- code = 0xfffd;
- utf8--;
- break;
- }
- }
- } else {
- /* Invalid UTF-8 char */
- code = 0;
- }
- /* currently we don't support chars above U-FFFF */
- *ucs = (code < 0x10000) ? code : 0;
- return utf8;
-}
-
-void _FAT_utf8_to_unicode16( const char* src, unsigned short* dest )
-{
- while('\0' != *src)
- {
- src = _FAT_utf8decode(src, dest++);
- }
-
- *dest = '\0';
-}
-
-#if 0
-static inline int _FAT_utf8coding(const u16* ucs, char* dest)
-{
- int len= 0;
-
- if (*ucs < 0x80) //one byte
- {
- dest[len++] = *ucs;
- }
- else if (*ucs < 0x800) //two bytes
- {
- dest[len++] = 0xC0 | (*ucs >> 6 & 0x1F);
- dest[len++] = 0x80 | (*ucs & 0x3F);
- }
- else //if(*ucs < 0x10000) //three bytes
- {
- dest[len++] = 0xE0 | (*ucs >> 12);
- dest[len++] = 0x80 | (*ucs >>6 & 0x3F);
- dest[len++] = 0x80 | (*ucs &0x3F);
- }
-
- return len;
-}
-#endif
-
-void _FAT_unicode16_to_utf8( const u16* src, char* dest)
-{
- int len=0;
- while(*src)
- {
- if (*src < 0x80) //1 byte
- {
- dest[len++] = *src;
- }
- else if (*src < 0x800) //2 bytes
- {
- dest[len++] = 0xC0 | (*src >> 6 & 0x1F);
- dest[len++] = 0x80 | (*src & 0x3F);
- }
- else //if(*src < 0x10000) //3 bytes
- {
- dest[len++] = 0xE0 | (*src >> 12);
- dest[len++] = 0x80 | (*src >>6 & 0x3F);
- dest[len++] = 0x80 | (*src &0x3F);
- }
- src ++;
- }
- dest[len] = 0;
-}
-
-u32 _unistrnlen( const u16* unistr, u32 maxlen )
-{
- const u16 * pstr = NULL;
- u32 len = 0;
- if( NULL == unistr )
- return 0;
-
- if( 0 == maxlen )
- return 0;
-
- pstr = unistr;
-
- while( len < maxlen && *pstr != 0x0000 )
- {
- ++len;
- ++pstr;
- }
- return len;
-}
-
-int _unistrncmp( const u16* src, const u16* dest, u32 maxlen )
-{
- if( NULL == src || NULL == dest )
- {
- if( src == dest ) return 0;
- return (NULL == src ) ? -1 : 1;
- }
-
- while( *src == *dest && maxlen && *src != 0x0000 && *dest != 0x0000 )
- {
- ++src;
- ++dest;
- --maxlen;
- }
- if( 0 == maxlen ) return 0;
-
- return *src > *dest ? 1 : -1;
-}
-
-const u16 * _unistrchr( const u16 * str, u16 unichar )
-{
- if( NULL == str )
- return NULL;
-
- while( *str != unichar && *str != 0x0000 )
- {
- ++str;
- }
- return str;
-}
-
-int _uniisalnum( u8 ch )
-{
- return isalnum( ch );
-}
-
diff --git a/sdk-modifications/libsrc/fs/fs_unicode.h b/sdk-modifications/libsrc/fs/fs_unicode.h
deleted file mode 100755
index 45e9d0a..0000000
--- a/sdk-modifications/libsrc/fs/fs_unicode.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef __FS_UNICODE_H__
-#define __FS_UNICODE_H__
-
-extern void _FAT_utf8_to_unicode16( const char* src, u16* dest );
-
-extern void _FAT_unicode16_to_utf8( const u16* src, char* dest);
-
-extern u32 _unistrnlen( const u16* unistr, u32 maxlen );
-
-extern int _unistrncmp( const u16 * src, const u16 * dest, u32 maxlen );
-
-extern const u16 * _unistrchr( const u16 * str, u16 unichar );
-
-int _uniisalnum( u8 ch );
-
-#endif //__FS_UNICODE_H__
diff --git a/sdk-modifications/libsrc/fs/libfat.c b/sdk-modifications/libsrc/fs/libfat.c
deleted file mode 100755
index 1956d13..0000000
--- a/sdk-modifications/libsrc/fs/libfat.c
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- libfat.c
- Simple functionality for startup, mounting and unmounting of FAT-based devices.
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-
- 2006-08-13 - Chishm
- * Moved all externally visible directory related functions to fatdir
-
- 2006-08-14 - Chishm
- * Added extended devoptab_t functions
-
- 2007-01-10 - Chishm
- * fatInit now sets the correct path when setAsDefaultDevice
-
- 2007-01-11 - Chishm
- * Added missing #include <unistd.h>
-*/
-
-/*
-
-*/
-
-#include <unistd.h>
-
-#include "fs_common.h"
-#include "partition.h"
-#include "fatfile.h"
-#include "fatdir.h"
-#include "fs_unicode.h"
-#include "io_ds2_mmcf.h"
-
-#define GBA_DEFAULT_CACHE_PAGES 2
-#define NDS_DEFAULT_CACHE_PAGES 8
-
-#if 0
-const devoptab_t dotab_fat = {
- "fat",
- sizeof (FILE_STRUCT),
- _FAT_open_r,
- _FAT_close_r,
- _FAT_write_r,
- _FAT_read_r,
- _FAT_seek_r,
- _FAT_fstat_r,
- _FAT_stat_r,
- _FAT_link_r,
- _FAT_unlink_r,
- _FAT_chdir_r,
- _FAT_rename_r,
- _FAT_mkdir_r,
- sizeof (DIR_STATE_STRUCT),
- _FAT_diropen_r,
- _FAT_dirreset_r,
- _FAT_dirnext_r,
- _FAT_dirclose_r
-};
-#endif
-
-#if 0
-bool fatInit (u32 cacheSize, bool setAsDefaultDevice)
-{
-#ifdef NDS
- bool slot1Device, slot2Device;
-
- // add unicode suppport
- //file name string coding are set to UTF8, other coding needed conveted to UTF8 by the caller
- //_FAT_unicode_init_default();
-
- // Try mounting both slots
- slot1Device = _FAT_partition_mount (PI_SLOT_1, cacheSize);
- slot2Device = _FAT_partition_mount (PI_SLOT_2, cacheSize);
-
- // Choose the default device
- if (slot1Device) {
- _FAT_partition_setDefaultInterface (PI_SLOT_1);
- } else if (slot2Device) {
- _FAT_partition_setDefaultInterface (PI_SLOT_2);
- } else {
- return false;
- }
-
-#else // not defined NDS
- bool cartSlotDevice;
-
- cartSlotDevice = _FAT_partition_mount (PI_CART_SLOT, cacheSize);
-
- if (cartSlotDevice) {
- _FAT_partition_setDefaultInterface (PI_CART_SLOT);
- } else {
- return false;
- }
-
-#endif // defined NDS
-
- AddDevice (&dotab_fat);
-
- if (setAsDefaultDevice) {
- chdir ("fat:/");
- }
-
- return true;
-}
-#endif
-
-#if 0
-bool fatInitDefault (void) {
-#ifdef NDS
- return fatInit (NDS_DEFAULT_CACHE_PAGES, true);
-#else
- return fatInit (GBA_DEFAULT_CACHE_PAGES, true);
-#endif
-}
-#endif
-
-bool _FAT_Init(void)
-{
- // Try mounting sd/mmc
- bool sdOK = false;
- if( _io_ds2_mmcf.fn_startup() == 0) //NO ERROR
- sdOK = _FAT_partition_freeMount( PI_DEFAULT, &_io_ds2_mmcf, 8);
- else
- return false;
-
- if(sdOK == true)
- fat_chdir ("fat:/");
-
- return sdOK;
-}
-
-bool fatMountNormalInterface (PARTITION_INTERFACE partitionNumber, u32 cacheSize) {
- return _FAT_partition_mount (partitionNumber, cacheSize);
-}
-
-bool fatMountCustomInterface (const IO_INTERFACE* device, u32 cacheSize) {
- return _FAT_partition_mountCustomInterface (device, cacheSize);
-}
-
-bool fatUnmount (PARTITION_INTERFACE partitionNumber) {
- return _FAT_partition_unmount (partitionNumber);
-}
-
-
-bool fatUnsafeUnmount (PARTITION_INTERFACE partitionNumber) {
- return _FAT_partition_unsafeUnmount (partitionNumber);
-}
-
-bool fatSetDefaultInterface (PARTITION_INTERFACE partitionNumber) {
- return _FAT_partition_setDefaultInterface (partitionNumber);
-}
diff --git a/sdk-modifications/libsrc/fs/mem_allocate.h b/sdk-modifications/libsrc/fs/mem_allocate.h
deleted file mode 100755
index 7bbe8de..0000000
--- a/sdk-modifications/libsrc/fs/mem_allocate.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- mem_allocate.h
- Memory allocation and destruction calls
- Replace these calls with custom allocators if
- malloc is unavailable
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-*/
-
-#ifndef _MEM_ALLOCATE_H
-#define _MEM_ALLOCATE_H
-
-#include "ds2_malloc.h"
-
-static inline void* _FAT_mem_allocate (size_t size) {
- return ((void*)malloc (size));
-}
-
-static inline void _FAT_mem_free (void* mem) {
- return (free ((void*)mem));
-}
-
-#endif // _MEM_ALLOCATE_H
diff --git a/sdk-modifications/libsrc/fs/partition.c b/sdk-modifications/libsrc/fs/partition.c
deleted file mode 100755
index 1791b40..0000000
--- a/sdk-modifications/libsrc/fs/partition.c
+++ /dev/null
@@ -1,501 +0,0 @@
-/*
- partition.c
- Functions for mounting and dismounting partitions
- on various block devices.
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-
- 2006-08-10 - Chishm
- * Fixed problem when openning files starting with "fat"
-
- 2006-10-28 - Chishm
- * _partitions changed to _FAT_partitions to maintain the same style of naming as the functions
-*/
-//version 1.1
-//Note: fix bug in _FAT_partition_setDefaultPartition() function
-
-#include "partition.h"
-#include "bit_ops.h"
-#include "file_allocation_table.h"
-#include "directory.h"
-
-#include <string.h>
-#include <ctype.h>
-
-#include "mem_allocate.h"
-
-/*
-This device name, as known by DevKitPro
-*/
-const char* DEVICE_NAME = "fat";
-
-/*
-Data offsets
-*/
-
-// BIOS Parameter Block offsets
-enum BPB {
- BPB_jmpBoot = 0x00,
- BPB_OEMName = 0x03,
- // BIOS Parameter Block
- BPB_bytesPerSector = 0x0B,
- BPB_sectorsPerCluster = 0x0D,
- BPB_reservedSectors = 0x0E,
- BPB_numFATs = 0x10,
- BPB_rootEntries = 0x11,
- BPB_numSectorsSmall = 0x13,
- BPB_mediaDesc = 0x15,
- BPB_sectorsPerFAT = 0x16,
- BPB_sectorsPerTrk = 0x18,
- BPB_numHeads = 0x1A,
- BPB_numHiddenSectors = 0x1C,
- BPB_numSectors = 0x20,
- // Ext BIOS Parameter Block for FAT16
- BPB_FAT16_driveNumber = 0x24,
- BPB_FAT16_reserved1 = 0x25,
- BPB_FAT16_extBootSig = 0x26,
- BPB_FAT16_volumeID = 0x27,
- BPB_FAT16_volumeLabel = 0x2B,
- BPB_FAT16_fileSysType = 0x36,
- // Bootcode
- BPB_FAT16_bootCode = 0x3E,
- // FAT32 extended block
- BPB_FAT32_sectorsPerFAT32 = 0x24,
- BPB_FAT32_extFlags = 0x28,
- BPB_FAT32_fsVer = 0x2A,
- BPB_FAT32_rootClus = 0x2C,
- BPB_FAT32_fsInfo = 0x30,
- BPB_FAT32_bkBootSec = 0x32,
- // Ext BIOS Parameter Block for FAT32
- BPB_FAT32_driveNumber = 0x40,
- BPB_FAT32_reserved1 = 0x41,
- BPB_FAT32_extBootSig = 0x42,
- BPB_FAT32_volumeID = 0x43,
- BPB_FAT32_volumeLabel = 0x47,
- BPB_FAT32_fileSysType = 0x52,
- // Bootcode
- BPB_FAT32_bootCode = 0x5A,
- BPB_bootSig_55 = 0x1FE,
- BPB_bootSig_AA = 0x1FF
-};
-
-
-#ifdef NDS
-#define MAXIMUM_PARTITIONS 4
-PARTITION* _FAT_partitions[MAXIMUM_PARTITIONS] = {NULL};
-#else // not defined NDS
-#define MAXIMUM_PARTITIONS 1
-PARTITION* _FAT_partitions[MAXIMUM_PARTITIONS] = {NULL};
-#endif // defined NDS
-
-// Use a single static buffer for the partitions
-
-
-static PARTITION* _FAT_partition_constructor ( const IO_INTERFACE* disc, u32 cacheSize) {
- PARTITION* partition;
- int i;
- u32 bootSector;
- u8 sectorBuffer[BYTES_PER_READ] = {0};
-
- // Read first sector of disc
- if ( !_FAT_disc_readSectors (disc, 0, 1, sectorBuffer)) {
- return NULL;
- }
-
- // Make sure it is a valid MBR or boot sector
- if ( (sectorBuffer[BPB_bootSig_55] != 0x55) || (sectorBuffer[BPB_bootSig_AA] != 0xAA)) {
- return NULL;
- }
-
- // Check if there is a FAT string, which indicates this is a boot sector
- if ((sectorBuffer[0x36] == 'F') && (sectorBuffer[0x37] == 'A') && (sectorBuffer[0x38] == 'T')) {
- bootSector = 0;
- } else if ((sectorBuffer[0x52] == 'F') && (sectorBuffer[0x53] == 'A') && (sectorBuffer[0x54] == 'T')) {
- // Check for FAT32
- bootSector = 0;
- } else {
- // This is an MBR
- // Find first valid partition from MBR
- // First check for an active partition
- for (i=0x1BE; (i < 0x1FE) && (sectorBuffer[i] != 0x80); i+= 0x10);
- // If it didn't find an active partition, search for any valid partition
- if (i == 0x1FE) {
- for (i=0x1BE; (i < 0x1FE) && (sectorBuffer[i+0x04] == 0x00); i+= 0x10);
- }
-
- // Go to first valid partition
- if ( i != 0x1FE) {
- // Make sure it found a partition
- bootSector = u8array_to_u32(sectorBuffer, 0x8 + i);
- } else {
- bootSector = 0; // No partition found, assume this is a MBR free disk
- }
- }
-
- // Read in boot sector
- if ( !_FAT_disc_readSectors (disc, bootSector, 1, sectorBuffer)) {
- return NULL;
- }
-
- partition = (PARTITION*) _FAT_mem_allocate (sizeof(PARTITION));
- if (partition == NULL) {
- return NULL;
- }
-
- // Set partition's disc interface
- partition->disc = disc;
-
- // Store required information about the file system
- partition->fat.sectorsPerFat = u8array_to_u16(sectorBuffer, BPB_sectorsPerFAT);
- if (partition->fat.sectorsPerFat == 0) {
- partition->fat.sectorsPerFat = u8array_to_u32( sectorBuffer, BPB_FAT32_sectorsPerFAT32);
- }
-
- partition->numberOfSectors = u8array_to_u16( sectorBuffer, BPB_numSectorsSmall);
- if (partition->numberOfSectors == 0) {
- partition->numberOfSectors = u8array_to_u32( sectorBuffer, BPB_numSectors);
- }
-
- partition->bytesPerSector = BYTES_PER_READ; // Sector size is redefined to be 512 bytes
- partition->sectorsPerCluster = sectorBuffer[BPB_sectorsPerCluster] * u8array_to_u16(sectorBuffer, BPB_bytesPerSector) / BYTES_PER_READ;
- partition->bytesPerCluster = partition->bytesPerSector * partition->sectorsPerCluster;
- partition->fat.fatStart = bootSector + u8array_to_u16(sectorBuffer, BPB_reservedSectors);
-
- partition->rootDirStart = partition->fat.fatStart + (sectorBuffer[BPB_numFATs] * partition->fat.sectorsPerFat);
- partition->dataStart = partition->rootDirStart + (( u8array_to_u16(sectorBuffer, BPB_rootEntries) * DIR_ENTRY_DATA_SIZE) / partition->bytesPerSector);
-
- partition->totalSize = (partition->numberOfSectors - partition->dataStart) * partition->bytesPerSector;
-
- // Store info about FAT
- partition->fat.lastCluster = (partition->numberOfSectors - partition->dataStart) / partition->sectorsPerCluster;
- partition->fat.firstFree = CLUSTER_FIRST;
-
- if (partition->fat.lastCluster < CLUSTERS_PER_FAT12) {
- partition->filesysType = FS_FAT12; // FAT12 volume
- } else if (partition->fat.lastCluster < CLUSTERS_PER_FAT16) {
- partition->filesysType = FS_FAT16; // FAT16 volume
- } else {
- partition->filesysType = FS_FAT32; // FAT32 volume
- }
-
- if (partition->filesysType != FS_FAT32) {
- partition->rootDirCluster = FAT16_ROOT_DIR_CLUSTER;
- } else {
- // Set up for the FAT32 way
- partition->rootDirCluster = u8array_to_u32(sectorBuffer, BPB_FAT32_rootClus);
- // Check if FAT mirroring is enabled
- if (!(sectorBuffer[BPB_FAT32_extFlags] & 0x80)) {
- // Use the active FAT
- partition->fat.fatStart = partition->fat.fatStart + ( partition->fat.sectorsPerFat * (sectorBuffer[BPB_FAT32_extFlags] & 0x0F));
- }
- }
-
- // Create a cache to use
- partition->cache = _FAT_cache_constructor (cacheSize, partition->disc);
-
- // Set current directory to the root
- partition->cwdCluster = partition->rootDirCluster;
-
- // Check if this disc is writable, and set the readOnly property appropriately
- partition->readOnly = !(_FAT_disc_features(disc) & FEATURE_MEDIUM_CANWRITE);
-
- // There are currently no open files on this partition
- partition->openFileCount = 0;
-
- return partition;
-}
-
-static void _FAT_partition_destructor (PARTITION* partition) {
- _FAT_cache_destructor (partition->cache);
- _FAT_disc_shutdown (partition->disc);
- _FAT_mem_free (partition);
-}
-
-bool _FAT_partition_mount (PARTITION_INTERFACE partitionNumber, u32 cacheSize)
-{
-#ifdef NDS
- int i;
- const IO_INTERFACE* disc = NULL;
-
- if (_FAT_partitions[partitionNumber] != NULL) {
- return false;
- }
-
- switch (partitionNumber) {
- case PI_SLOT_1:
- // Mount the disc in slot 1
- disc = _FAT_disc_dsSlotFindInterface ();
- break;
- case PI_SLOT_2:
- // Mount the disc in slot 2
- disc = _FAT_disc_gbaSlotFindInterface ();
- break;
- case PI_DEFAULT:
- case PI_CUSTOM:
- default:
- // Anything else has to be handled specially
- return false;
- break;
- }
-
- if (disc == NULL) {
- return false;
- }
-
- // See if that disc is already in use, if so, then just copy the partition pointer
- for (i = 0; i < MAXIMUM_PARTITIONS; i++) {
- if ((_FAT_partitions[i] != NULL) && (_FAT_partitions[i]->disc == disc)) {
- _FAT_partitions[partitionNumber] = _FAT_partitions[i];
- return true;
- }
- }
-
- _FAT_partitions[partitionNumber] = _FAT_partition_constructor (disc, cacheSize);
-
- if (_FAT_partitions[partitionNumber] == NULL) {
- return false;
- }
-
-#else // not defined NDS
- const IO_INTERFACE* disc = NULL;
-
- if (_FAT_partitions[partitionNumber] != NULL) {
- return false;
- }
-
- // Only ever one partition on GBA
- disc = _FAT_disc_gbaSlotFindInterface ();
- _FAT_partitions[partitionNumber] = _FAT_partition_constructor (disc, cacheSize);
-
-#endif // defined NDS
-
- return true;
-}
-
-bool _FAT_partition_mountCustomInterface (const IO_INTERFACE* device, u32 cacheSize) {
-#ifdef NDS
- int i;
-
- if (_FAT_partitions[PI_CUSTOM] != NULL) {
- return false;
- }
-
- if (device == NULL) {
- return false;
- }
-
- // See if that disc is already in use, if so, then just copy the partition pointer
- for (i = 0; i < MAXIMUM_PARTITIONS; i++) {
- if ((_FAT_partitions[i] != NULL) && (_FAT_partitions[i]->disc == device)) {
- _FAT_partitions[PI_CUSTOM] = _FAT_partitions[i];
- return true;
- }
- }
-
- _FAT_partitions[PI_CUSTOM] = _FAT_partition_constructor (device, cacheSize);
-
- if (_FAT_partitions[PI_CUSTOM] == NULL) {
- return false;
- }
-
-#else // not defined NDS
- if (_FAT_partitions[PI_CART_SLOT] != NULL) {
- return false;
- }
-
- if (device == NULL) {
- return false;
- }
-
- // Only ever one partition on GBA
- _FAT_partitions[PI_CART_SLOT] = _FAT_partition_constructor (device, cacheSize);
-
-#endif // defined NDS
-
- return true;
-}
-
-bool _FAT_partition_setDefaultInterface (PARTITION_INTERFACE partitionNumber)
-{
-#ifdef NDS // Can only set the default partition when there is more than 1, so doesn't apply to GBA
- if ((partitionNumber < 1) || (partitionNumber >= MAXIMUM_PARTITIONS)) {
- return false;
- }
-
- if (_FAT_partitions[partitionNumber] == NULL) {
- return false;
- }
-
- _FAT_partitions[PI_DEFAULT] = _FAT_partitions[partitionNumber];
-#endif
- return true;
-}
-
-bool _FAT_partition_setDefaultPartition (PARTITION* partition) {
-#ifdef NDS // Can only set the default partition when there is more than 1, so doesn't apply to GBA
- int i;
-
- if (partition == NULL) {
- return false;
- }
-
- if(_FAT_partitions[PI_DEFAULT] == partition) //Already is the default partition
- return true;
-
- // Ensure that this device is already in the list
- for (i = 1; i < MAXIMUM_PARTITIONS; i++) {
- if (_FAT_partitions[i] == partition) {
- break;
- }
- }
-
- // It wasn't in the list, so fail
- if (i == MAXIMUM_PARTITIONS) {
- return false;
- }
-
- // Change the default partition / device to this one
- _FAT_partitions[PI_DEFAULT] = partition;
-
-#endif
- return true;
-}
-
-bool _FAT_partition_unmount (PARTITION_INTERFACE partitionNumber) {
- int i;
- PARTITION* partition = _FAT_partitions[partitionNumber];
-
- if (partition == NULL) {
- return false;
- }
-
- if (partition->openFileCount > 0) {
- // There are still open files that need closing
- return false;
- }
-
- // Remove all references to this partition
- for (i = 0; i < MAXIMUM_PARTITIONS; i++) {
- if (_FAT_partitions[i] == partition) {
- _FAT_partitions[i] = NULL;
- }
- }
-
- _FAT_partition_destructor (partition);
- return true;
-}
-
-bool _FAT_partition_unsafeUnmount (PARTITION_INTERFACE partitionNumber) {
- int i;
- PARTITION* partition = _FAT_partitions[partitionNumber];
-
- if (partition == NULL) {
- return false;
- }
-
- // Remove all references to this partition
- for (i = 0; i < MAXIMUM_PARTITIONS; i++) {
- if (_FAT_partitions[i] == partition) {
- _FAT_partitions[i] = NULL;
- }
- }
-
- _FAT_cache_invalidate (partition->cache);
- _FAT_partition_destructor (partition);
- return true;
-}
-
-PARTITION* _FAT_partition_getPartitionFromPath (const char* path) {
-#ifdef NDS
- int namelen;
- int partitionNumber;
-
- // Device name extraction code taken from DevKitPro
- namelen = strlen(DEVICE_NAME);
- if (strchr (path, ':') == NULL) {
- // No device specified
- partitionNumber = PI_DEFAULT;
- } else if( strncmp(DEVICE_NAME, path, namelen) == 0 ) {
- if ( path[namelen] == ':' ) {
- // Only the device name is specified
- partitionNumber = PI_DEFAULT;
- } else if (isdigit(path[namelen]) && path[namelen+1] ==':' ) {
- // Device name and number specified
- partitionNumber = path[namelen] - '0';
- } else {
- // Incorrect device name
- return NULL;
- }
- } else {
- // Incorrect device name
- return NULL;
- }
-
- if ((partitionNumber < 0) || (partitionNumber >= MAXIMUM_PARTITIONS)) {
- return NULL;
- }
-
- return _FAT_partitions[partitionNumber];
-#else // not defined NDS
- // Only one possible partition on GBA
- return _FAT_partitions[PI_CART_SLOT];
-#endif // defined NDS
-}
-
-bool _FAT_partition_freeMount( int partitionNumber, const IO_INTERFACE* device, u32 cacheSize) {
-
- if( partitionNumber < 0 || partitionNumber > 3 )
- return false;
- int i;
-
- if (device == NULL) {
- return false;
- }
-
- if (_FAT_partitions[partitionNumber] != NULL) {
- if(_FAT_partitions[partitionNumber] -> disc == device)
- return true;
-
- return false;
- }
-
- // See if that disc is already in use, if so, then just copy the partition pointer
- for (i = 0; i < MAXIMUM_PARTITIONS; i++) {
- if ((_FAT_partitions[i] != NULL) && (_FAT_partitions[i]->disc == device)) {
- _FAT_partitions[partitionNumber] = _FAT_partitions[i];
- return true;
- }
- }
-
- _FAT_partitions[partitionNumber] = _FAT_partition_constructor (device, cacheSize);
-
- if (_FAT_partitions[partitionNumber] == NULL) {
- return false;
- }
-
- return true;
-}
diff --git a/sdk-modifications/libsrc/fs/partition.h b/sdk-modifications/libsrc/fs/partition.h
deleted file mode 100755
index 0777b54..0000000
--- a/sdk-modifications/libsrc/fs/partition.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- partition.h
- Functions for mounting and dismounting partitions
- on various block devices.
-
- Copyright (c) 2006 Michael "Chishm" Chisholm
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or
- other materials provided with the distribution.
- 3. The name of the author may not be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- 2006-07-11 - Chishm
- * Original release
-*/
-
-#ifndef _PARTITION_H
-#define _PARTITION_H
-
-#include "fs_common.h"
-
-#include "disc_io/disc.h"
-#include "fs_cache.h"
-
-// Device name
-extern const char* DEVICE_NAME;
-
-// Filesystem type
-typedef enum {FS_UNKNOWN, FS_FAT12, FS_FAT16, FS_FAT32} FS_TYPE;
-
-#ifdef NDS
-typedef enum {PI_DEFAULT, PI_SLOT_1, PI_SLOT_2, PI_CUSTOM} PARTITION_INTERFACE;
-#else
-typedef enum {PI_CART_SLOT} PARTITION_INTERFACE;
-#endif
-
-typedef struct {
- u32 fatStart;
- u32 sectorsPerFat;
- u32 lastCluster;
- u32 firstFree;
-} FAT;
-
-typedef struct {
- const IO_INTERFACE* disc;
- CACHE* cache;
- // Info about the partition
- bool readOnly; // If this is set, then do not try writing to the disc
- FS_TYPE filesysType;
- u32 totalSize;
- u32 rootDirStart;
- u32 rootDirCluster;
- u32 numberOfSectors;
- u32 dataStart;
- u32 bytesPerSector;
- u32 sectorsPerCluster;
- u32 bytesPerCluster;
- FAT fat;
- // Values that may change after construction
- u32 cwdCluster; // Current working directory cluser
- u32 openFileCount;
-} PARTITION;
-
-/*
-Mount the device specified by partitionDevice
-PD_DEFAULT is not allowed, use _FAT_partition_setDefaultDevice
-PD_CUSTOM is not allowed, use _FAT_partition_mountCustomDevice
-*/
-bool _FAT_partition_mount (PARTITION_INTERFACE partitionNumber, u32 cacheSize);
-
-/*
-Mount a partition on a custom device
-*/
-bool _FAT_partition_mountCustomInterface (const IO_INTERFACE* device, u32 cacheSize);
-
-
-/*
-Free Mount a partition on a custom device
-*/
-bool _FAT_partition_freeMount( int partitionNumber, const IO_INTERFACE* device, u32 cacheSize);
-
-
-/*
-Unmount the partition specified by partitionNumber
-If there are open files, it will fail
-*/
-bool _FAT_partition_unmount (PARTITION_INTERFACE partitionNumber);
-
-/*
-Forcibly unmount the partition specified by partitionNumber
-Any open files on the partition will become invalid
-The cache will be invalidated, and any unflushed writes will be lost
-*/
-bool _FAT_partition_unsafeUnmount (PARTITION_INTERFACE partitionNumber);
-
-/*
-Set the default device for access by fat: and fat0:,
-based on the device number
-*/
-bool _FAT_partition_setDefaultInterface (PARTITION_INTERFACE partitionNumber);
-
-/*
-Set the default device for access by fat: and fat0:,
-based on the partition pointer
-*/
-bool _FAT_partition_setDefaultPartition (PARTITION* partition);
-
-/*
-Return the partition specified in a path
-For instance, "fat0:", "fat:", "/" and "fat:/" will all
-return the default partition
-*/
-PARTITION* _FAT_partition_getPartitionFromPath (const char* path);
-
-#endif // _PARTITION_H
diff --git a/sdk-modifications/libsrc/key/key.c b/sdk-modifications/libsrc/key/key.c
deleted file mode 100755
index 8a6ad5f..0000000
--- a/sdk-modifications/libsrc/key/key.c
+++ /dev/null
@@ -1,145 +0,0 @@
-#include "ds2_timer.h"
-#include "ds2io.h"
-
-#define KEY_REPEAT_TIME 200 //5 times/second
-#define KEY_REPEAT_TIME_N (KEY_REPEAT_TIME*1000000/SYSTIME_UNIT)
-
-#define INPUT_REPEAT_TIME 100
-#define INPUT_REPEAT_TIME_N (INPUT_REPEAT_TIME*1000000/SYSTIME_UNIT)
-
-static unsigned int _last_key = 0;
-static unsigned int _last_key_timestamp = 0;
-
-/*
-* Function: only detect the key pressed or not
-*/
-unsigned int getKey(void)
-{
- struct key_buf input;
- unsigned int new_key, hold_key, ret_key, timestamp;
- int flag;
-
- ds2_getrawInput(&input);
- timestamp = getSysTime();
- flag = ((timestamp - _last_key_timestamp) >= KEY_REPEAT_TIME_N) ? 1 : 0;
-
- input.key &= 0x3FFF;
- new_key = (_last_key ^ input.key) & input.key;
- hold_key = _last_key & input.key;
-
- ret_key = 0;
- if(hold_key) {
- if(flag)
- {
- ret_key = hold_key;
- _last_key_timestamp = timestamp;
- }
- }
-
- if(new_key)
- {
- ret_key |= new_key;
- _last_key_timestamp = timestamp;
-
- _last_key = input.key;
- }
-
- return ret_key;
-}
-
-/*
-* Function: can get the detail information about key pressed, hold, or release
-*/
-unsigned int getKey1(void)
-{
- struct key_buf input;
- unsigned int new_key, hold_key, ret_key, timestamp;
- int flag;
-
- ds2_getrawInput(&input);
- timestamp = getSysTime();
- flag = ((timestamp - _last_key_timestamp) >= KEY_REPEAT_TIME_N) ? 1 : 0;
-
- input.key &= 0x3FFF;
- new_key = _last_key ^ input.key;
- hold_key = _last_key & input.key;
- //ret_key[31:16] = last key;
- //ret_key[15:0] = new key;
-
- ret_key = 0;
- if(hold_key) {
- if(flag)
- {
- ret_key = (hold_key << 16) | hold_key;
- _last_key_timestamp = timestamp;
- }
- }
-
- if(new_key)
- {
- unsigned int tmp_key;
-
- //have new key pressed
- if(new_key & input.key)
- {
- ret_key |= new_key & input.key;
- _last_key_timestamp = timestamp;
- }
- else
- {
- ret_key |= (new_key & ~input.key) << 16;
- }
-
- _last_key = input.key;
- }
-
- return ret_key;
-}
-
-static unsigned int _last_input = 0;
-static unsigned int _last_input_timestamp = 0;
-
-/*
-* Function: only detect the key pressed or not and touch position
-*/
-unsigned int getInput(struct key_buf *input) {
- struct key_buf rawin;
- unsigned int timestamp, new, hold;
- int flag, ret;
-
- ds2_getrawInput(&rawin);
- timestamp = getSysTime();
- flag = ((timestamp - _last_input_timestamp) >= INPUT_REPEAT_TIME_N) ? 1 : 0;
-
- rawin.key &= 0x3FFF;
- new = (rawin.key ^ _last_input) & rawin.key;
- hold = rawin.key & _last_input;
-
- ret = 0;
- if(hold && flag)
- {
- ret = hold;
- input->x = rawin.x;
- input->y = rawin.y;
-
- _last_input_timestamp = timestamp;
- }
-
- if(new)
- {
- ret |= new;
- input->x = rawin.x;
- input->y = rawin.y;
-
- _last_input_timestamp = timestamp;
- _last_input = rawin.key;
- }
-
- input->key = ret;
- return ret > 0;
-}
-
-
-
-
-
diff --git a/sdk-modifications/libsrc/key/key.h b/sdk-modifications/libsrc/key/key.h
deleted file mode 100755
index 21674ec..0000000
--- a/sdk-modifications/libsrc/key/key.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef __KEY_H__
-#define __KEY_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define KEY_PRESS(key, key_id) (!(key & (key_id<<16)) && (key & key_id))
-#define KEY_HOLD(key, key_id) ((key & (key_id<<16)) && (key & key_id))
-#define KEY_RELEASE(key, key_id) ((key & (key_id<<16)) && !(key & key_id))
-
-/*
-* Function: only detect the key pressed or not
-*/
-unsigned int getKey(void);
-
-/*
-* Function: can get the detail information about key pressed, hold, or release
-*/
-unsigned int getKey1(void);
-
-/*
-* Function: detect the key pressed or not and touched position
-*/
-extern unsigned int getInput(struct key_buf *input);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //__KEY_H__
diff --git a/sdk-modifications/libsrc/key/key.mk b/sdk-modifications/libsrc/key/key.mk
deleted file mode 100755
index fa08d7c..0000000
--- a/sdk-modifications/libsrc/key/key.mk
+++ /dev/null
@@ -1,10 +0,0 @@
-#key.mk
-
-SRC += $(KEY_DIR)/key.c
-
-SSRC +=
-
-INC += -I$(KEY_DIR)
-
-CFLAGS +=
-
diff --git a/sdk-modifications/libsrc/zlib/README b/sdk-modifications/libsrc/zlib/README
deleted file mode 100644
index 90f3327..0000000
--- a/sdk-modifications/libsrc/zlib/README
+++ /dev/null
@@ -1,8 +0,0 @@
-This is a modified source release of zlib.
-
-Changes:
- zconf.h removes a reference to sys/types.h, which creates type conflicts on the DS2 SDK.
- gzguts.h removes standard c library includes for DS2 SDK equivalents
-
-
-For a pristine source release of zlib, please visit <http://zlib.net>. \ No newline at end of file
diff --git a/sdk-modifications/libsrc/zlib/adler32.c b/sdk-modifications/libsrc/zlib/adler32.c
deleted file mode 100755
index a868f07..0000000
--- a/sdk-modifications/libsrc/zlib/adler32.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/* adler32.c -- compute the Adler-32 checksum of a data stream
- * Copyright (C) 1995-2011 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* @(#) $Id$ */
-
-#include "zutil.h"
-
-#define local static
-
-local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
-
-#define BASE 65521 /* largest prime smaller than 65536 */
-#define NMAX 5552
-/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
-
-#define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;}
-#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1);
-#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2);
-#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4);
-#define DO16(buf) DO8(buf,0); DO8(buf,8);
-
-/* use NO_DIVIDE if your processor does not do division in hardware --
- try it both ways to see which is faster */
-#ifdef NO_DIVIDE
-/* note that this assumes BASE is 65521, where 65536 % 65521 == 15
- (thank you to John Reiser for pointing this out) */
-# define CHOP(a) \
- do { \
- unsigned long tmp = a >> 16; \
- a &= 0xffffUL; \
- a += (tmp << 4) - tmp; \
- } while (0)
-# define MOD28(a) \
- do { \
- CHOP(a); \
- if (a >= BASE) a -= BASE; \
- } while (0)
-# define MOD(a) \
- do { \
- CHOP(a); \
- MOD28(a); \
- } while (0)
-# define MOD63(a) \
- do { /* this assumes a is not negative */ \
- z_off64_t tmp = a >> 32; \
- a &= 0xffffffffL; \
- a += (tmp << 8) - (tmp << 5) + tmp; \
- tmp = a >> 16; \
- a &= 0xffffL; \
- a += (tmp << 4) - tmp; \
- tmp = a >> 16; \
- a &= 0xffffL; \
- a += (tmp << 4) - tmp; \
- if (a >= BASE) a -= BASE; \
- } while (0)
-#else
-# define MOD(a) a %= BASE
-# define MOD28(a) a %= BASE
-# define MOD63(a) a %= BASE
-#endif
-
-/* ========================================================================= */
-uLong ZEXPORT adler32(adler, buf, len)
- uLong adler;
- const Bytef *buf;
- uInt len;
-{
- unsigned long sum2;
- unsigned n;
-
- /* split Adler-32 into component sums */
- sum2 = (adler >> 16) & 0xffff;
- adler &= 0xffff;
-
- /* in case user likes doing a byte at a time, keep it fast */
- if (len == 1) {
- adler += buf[0];
- if (adler >= BASE)
- adler -= BASE;
- sum2 += adler;
- if (sum2 >= BASE)
- sum2 -= BASE;
- return adler | (sum2 << 16);
- }
-
- /* initial Adler-32 value (deferred check for len == 1 speed) */
- if (buf == Z_NULL)
- return 1L;
-
- /* in case short lengths are provided, keep it somewhat fast */
- if (len < 16) {
- while (len--) {
- adler += *buf++;
- sum2 += adler;
- }
- if (adler >= BASE)
- adler -= BASE;
- MOD28(sum2); /* only added so many BASE's */
- return adler | (sum2 << 16);
- }
-
- /* do length NMAX blocks -- requires just one modulo operation */
- while (len >= NMAX) {
- len -= NMAX;
- n = NMAX / 16; /* NMAX is divisible by 16 */
- do {
- DO16(buf); /* 16 sums unrolled */
- buf += 16;
- } while (--n);
- MOD(adler);
- MOD(sum2);
- }
-
- /* do remaining bytes (less than NMAX, still just one modulo) */
- if (len) { /* avoid modulos if none remaining */
- while (len >= 16) {
- len -= 16;
- DO16(buf);
- buf += 16;
- }
- while (len--) {
- adler += *buf++;
- sum2 += adler;
- }
- MOD(adler);
- MOD(sum2);
- }
-
- /* return recombined sums */
- return adler | (sum2 << 16);
-}
-
-/* ========================================================================= */
-local uLong adler32_combine_(adler1, adler2, len2)
- uLong adler1;
- uLong adler2;
- z_off64_t len2;
-{
- unsigned long sum1;
- unsigned long sum2;
- unsigned rem;
-
- /* for negative len, return invalid adler32 as a clue for debugging */
- if (len2 < 0)
- return 0xffffffffUL;
-
- /* the derivation of this formula is left as an exercise for the reader */
- MOD63(len2); /* assumes len2 >= 0 */
- rem = (unsigned)len2;
- sum1 = adler1 & 0xffff;
- sum2 = rem * sum1;
- MOD(sum2);
- sum1 += (adler2 & 0xffff) + BASE - 1;
- sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem;
- if (sum1 >= BASE) sum1 -= BASE;
- if (sum1 >= BASE) sum1 -= BASE;
- if (sum2 >= (BASE << 1)) sum2 -= (BASE << 1);
- if (sum2 >= BASE) sum2 -= BASE;
- return sum1 | (sum2 << 16);
-}
-
-/* ========================================================================= */
-uLong ZEXPORT adler32_combine(adler1, adler2, len2)
- uLong adler1;
- uLong adler2;
- z_off_t len2;
-{
- return adler32_combine_(adler1, adler2, len2);
-}
-
-uLong ZEXPORT adler32_combine64(adler1, adler2, len2)
- uLong adler1;
- uLong adler2;
- z_off64_t len2;
-{
- return adler32_combine_(adler1, adler2, len2);
-}
diff --git a/sdk-modifications/libsrc/zlib/compress.c b/sdk-modifications/libsrc/zlib/compress.c
deleted file mode 100755
index ea4dfbe..0000000
--- a/sdk-modifications/libsrc/zlib/compress.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/* compress.c -- compress a memory buffer
- * Copyright (C) 1995-2005 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* @(#) $Id$ */
-
-#define ZLIB_INTERNAL
-#include "zlib.h"
-
-/* ===========================================================================
- Compresses the source buffer into the destination buffer. The level
- parameter has the same meaning as in deflateInit. sourceLen is the byte
- length of the source buffer. Upon entry, destLen is the total size of the
- destination buffer, which must be at least 0.1% larger than sourceLen plus
- 12 bytes. Upon exit, destLen is the actual size of the compressed buffer.
-
- compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
- memory, Z_BUF_ERROR if there was not enough room in the output buffer,
- Z_STREAM_ERROR if the level parameter is invalid.
-*/
-int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
- Bytef *dest;
- uLongf *destLen;
- const Bytef *source;
- uLong sourceLen;
- int level;
-{
- z_stream stream;
- int err;
-
- stream.next_in = (Bytef*)source;
- stream.avail_in = (uInt)sourceLen;
-#ifdef MAXSEG_64K
- /* Check for source > 64K on 16-bit machine: */
- if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
-#endif
- stream.next_out = dest;
- stream.avail_out = (uInt)*destLen;
- if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
-
- stream.zalloc = (alloc_func)0;
- stream.zfree = (free_func)0;
- stream.opaque = (voidpf)0;
-
- err = deflateInit(&stream, level);
- if (err != Z_OK) return err;
-
- err = deflate(&stream, Z_FINISH);
- if (err != Z_STREAM_END) {
- deflateEnd(&stream);
- return err == Z_OK ? Z_BUF_ERROR : err;
- }
- *destLen = stream.total_out;
-
- err = deflateEnd(&stream);
- return err;
-}
-
-/* ===========================================================================
- */
-int ZEXPORT compress (dest, destLen, source, sourceLen)
- Bytef *dest;
- uLongf *destLen;
- const Bytef *source;
- uLong sourceLen;
-{
- return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
-}
-
-/* ===========================================================================
- If the default memLevel or windowBits for deflateInit() is changed, then
- this function needs to be updated.
- */
-uLong ZEXPORT compressBound (sourceLen)
- uLong sourceLen;
-{
- return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
- (sourceLen >> 25) + 13;
-}
diff --git a/sdk-modifications/libsrc/zlib/crc32.c b/sdk-modifications/libsrc/zlib/crc32.c
deleted file mode 100755
index c12471e..0000000
--- a/sdk-modifications/libsrc/zlib/crc32.c
+++ /dev/null
@@ -1,447 +0,0 @@
-/* crc32.c -- compute the CRC-32 of a data stream
- * Copyright (C) 1995-2006, 2010, 2011 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- *
- * Thanks to Rodney Brown <rbrown64@csc.com.au> for his contribution of faster
- * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing
- * tables for updating the shift register in one step with three exclusive-ors
- * instead of four steps with four exclusive-ors. This results in about a
- * factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3.
- */
-
-/* @(#) $Id$ */
-
-/*
- Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore
- protection on the static variables used to control the first-use generation
- of the crc tables. Therefore, if you #define DYNAMIC_CRC_TABLE, you should
- first call get_crc_table() to initialize the tables before allowing more than
- one thread to use crc32().
-
- DYNAMIC_CRC_TABLE and MAKECRCH can be #defined to write out crc32.h.
- */
-
-#ifdef MAKECRCH
-# include <stdio.h>
-# ifndef DYNAMIC_CRC_TABLE
-# define DYNAMIC_CRC_TABLE
-# endif /* !DYNAMIC_CRC_TABLE */
-#endif /* MAKECRCH */
-
-#include "zutil.h" /* for STDC and FAR definitions */
-
-#define local static
-
-/* Find a four-byte integer type for crc32_little() and crc32_big(). */
-#ifndef NOBYFOUR
-# ifdef STDC /* need ANSI C limits.h to determine sizes */
-# include <limits.h>
-# define BYFOUR
-# if (UINT_MAX == 0xffffffffUL)
- typedef unsigned int u4;
-# else
-# if (ULONG_MAX == 0xffffffffUL)
- typedef unsigned long u4;
-# else
-# if (USHRT_MAX == 0xffffffffUL)
- typedef unsigned short u4;
-# else
-# undef BYFOUR /* can't find a four-byte integer type! */
-# endif
-# endif
-# endif
-# endif /* STDC */
-#endif /* !NOBYFOUR */
-
-/* Definitions for doing the crc four data bytes at a time. */
-#ifdef BYFOUR
- typedef u4 crc_table_t;
-# define REV(w) ((((w)>>24)&0xff)+(((w)>>8)&0xff00)+ \
- (((w)&0xff00)<<8)+(((w)&0xff)<<24))
- local unsigned long crc32_little OF((unsigned long,
- const unsigned char FAR *, unsigned));
- local unsigned long crc32_big OF((unsigned long,
- const unsigned char FAR *, unsigned));
-# define TBLS 8
-#else
- typedef unsigned long crc_table_t;
-# define TBLS 1
-#endif /* BYFOUR */
-
-/* Local functions for crc concatenation */
-local unsigned long gf2_matrix_times OF((unsigned long *mat,
- unsigned long vec));
-local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat));
-local uLong crc32_combine_ OF((uLong crc1, uLong crc2, z_off64_t len2));
-
-
-#ifdef DYNAMIC_CRC_TABLE
-
-local volatile int crc_table_empty = 1;
-local crc_table_t FAR crc_table[TBLS][256];
-local void make_crc_table OF((void));
-#ifdef MAKECRCH
- local void write_table OF((FILE *, const crc_table_t FAR *));
-#endif /* MAKECRCH */
-/*
- Generate tables for a byte-wise 32-bit CRC calculation on the polynomial:
- x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1.
-
- Polynomials over GF(2) are represented in binary, one bit per coefficient,
- with the lowest powers in the most significant bit. Then adding polynomials
- is just exclusive-or, and multiplying a polynomial by x is a right shift by
- one. If we call the above polynomial p, and represent a byte as the
- polynomial q, also with the lowest power in the most significant bit (so the
- byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p,
- where a mod b means the remainder after dividing a by b.
-
- This calculation is done using the shift-register method of multiplying and
- taking the remainder. The register is initialized to zero, and for each
- incoming bit, x^32 is added mod p to the register if the bit is a one (where
- x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by
- x (which is shifting right by one and adding x^32 mod p if the bit shifted
- out is a one). We start with the highest power (least significant bit) of
- q and repeat for all eight bits of q.
-
- The first table is simply the CRC of all possible eight bit values. This is
- all the information needed to generate CRCs on data a byte at a time for all
- combinations of CRC register values and incoming bytes. The remaining tables
- allow for word-at-a-time CRC calculation for both big-endian and little-
- endian machines, where a word is four bytes.
-*/
-local void make_crc_table()
-{
- crc_table_t c;
- int n, k;
- crc_table_t poly; /* polynomial exclusive-or pattern */
- /* terms of polynomial defining this crc (except x^32): */
- static volatile int first = 1; /* flag to limit concurrent making */
- static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26};
-
- /* See if another task is already doing this (not thread-safe, but better
- than nothing -- significantly reduces duration of vulnerability in
- case the advice about DYNAMIC_CRC_TABLE is ignored) */
- if (first) {
- first = 0;
-
- /* make exclusive-or pattern from polynomial (0xedb88320UL) */
- poly = 0;
- for (n = 0; n < (int)(sizeof(p)/sizeof(unsigned char)); n++)
- poly |= (crc_table_t)1 << (31 - p[n]);
-
- /* generate a crc for every 8-bit value */
- for (n = 0; n < 256; n++) {
- c = (crc_table_t)n;
- for (k = 0; k < 8; k++)
- c = c & 1 ? poly ^ (c >> 1) : c >> 1;
- crc_table[0][n] = c;
- }
-
-#ifdef BYFOUR
- /* generate crc for each value followed by one, two, and three zeros,
- and then the byte reversal of those as well as the first table */
- for (n = 0; n < 256; n++) {
- c = crc_table[0][n];
- crc_table[4][n] = REV(c);
- for (k = 1; k < 4; k++) {
- c = crc_table[0][c & 0xff] ^ (c >> 8);
- crc_table[k][n] = c;
- crc_table[k + 4][n] = REV(c);
- }
- }
-#endif /* BYFOUR */
-
- crc_table_empty = 0;
- }
- else { /* not first */
- /* wait for the other guy to finish (not efficient, but rare) */
- while (crc_table_empty)
- ;
- }
-
-#ifdef MAKECRCH
- /* write out CRC tables to crc32.h */
- {
- FILE *out;
-
- out = fopen("crc32.h", "w");
- if (out == NULL) return;
- fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n");
- fprintf(out, " * Generated automatically by crc32.c\n */\n\n");
- fprintf(out, "local const crc_table_t FAR ");
- fprintf(out, "crc_table[TBLS][256] =\n{\n {\n");
- write_table(out, crc_table[0]);
-# ifdef BYFOUR
- fprintf(out, "#ifdef BYFOUR\n");
- for (k = 1; k < 8; k++) {
- fprintf(out, " },\n {\n");
- write_table(out, crc_table[k]);
- }
- fprintf(out, "#endif\n");
-# endif /* BYFOUR */
- fprintf(out, " }\n};\n");
- fclose(out);
- }
-#endif /* MAKECRCH */
-}
-
-#ifdef MAKECRCH
-local void write_table(out, table)
- FILE *out;
- const crc_table_t FAR *table;
-{
- int n;
-
- for (n = 0; n < 256; n++)
- fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : " ",
- (unsigned long)(table[n]),
- n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", "));
-}
-#endif /* MAKECRCH */
-
-#else /* !DYNAMIC_CRC_TABLE */
-/* ========================================================================
- * Tables of CRC-32s of all single-byte values, made by make_crc_table().
- */
-#include "crc32.h"
-#endif /* DYNAMIC_CRC_TABLE */
-
-/* =========================================================================
- * This function can be used by asm versions of crc32()
- */
-const unsigned long FAR * ZEXPORT get_crc_table()
-{
-#ifdef DYNAMIC_CRC_TABLE
- if (crc_table_empty)
- make_crc_table();
-#endif /* DYNAMIC_CRC_TABLE */
- return (const unsigned long FAR *)crc_table;
-}
-
-/* ========================================================================= */
-#define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8)
-#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1
-
-/* ========================================================================= */
-unsigned long ZEXPORT crc32(crc, buf, len)
- unsigned long crc;
- const unsigned char FAR *buf;
- uInt len;
-{
- if (buf == Z_NULL) return 0UL;
-
-#ifdef DYNAMIC_CRC_TABLE
- if (crc_table_empty)
- make_crc_table();
-#endif /* DYNAMIC_CRC_TABLE */
-
-#ifdef BYFOUR
- if (sizeof(void *) == sizeof(ptrdiff_t)) {
- u4 endian;
-
- endian = 1;
- if (*((unsigned char *)(&endian)))
- return crc32_little(crc, buf, len);
- else
- return crc32_big(crc, buf, len);
- }
-#endif /* BYFOUR */
- crc = crc ^ 0xffffffffUL;
- while (len >= 8) {
- DO8;
- len -= 8;
- }
- if (len) do {
- DO1;
- } while (--len);
- return crc ^ 0xffffffffUL;
-}
-
-#ifdef BYFOUR
-
-/* ========================================================================= */
-#define DOLIT4 c ^= *buf4++; \
- c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \
- crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24]
-#define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4
-
-/* ========================================================================= */
-local unsigned long crc32_little(crc, buf, len)
- unsigned long crc;
- const unsigned char FAR *buf;
- unsigned len;
-{
- register u4 c;
- register const u4 FAR *buf4;
-
- c = (u4)crc;
- c = ~c;
- while (len && ((ptrdiff_t)buf & 3)) {
- c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);
- len--;
- }
-
- buf4 = (const u4 FAR *)(const void FAR *)buf;
- while (len >= 32) {
- DOLIT32;
- len -= 32;
- }
- while (len >= 4) {
- DOLIT4;
- len -= 4;
- }
- buf = (const unsigned char FAR *)buf4;
-
- if (len) do {
- c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8);
- } while (--len);
- c = ~c;
- return (unsigned long)c;
-}
-
-/* ========================================================================= */
-#define DOBIG4 c ^= *++buf4; \
- c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \
- crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24]
-#define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4
-
-/* ========================================================================= */
-local unsigned long crc32_big(crc, buf, len)
- unsigned long crc;
- const unsigned char FAR *buf;
- unsigned len;
-{
- register u4 c;
- register const u4 FAR *buf4;
-
- c = REV((u4)crc);
- c = ~c;
- while (len && ((ptrdiff_t)buf & 3)) {
- c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);
- len--;
- }
-
- buf4 = (const u4 FAR *)(const void FAR *)buf;
- buf4--;
- while (len >= 32) {
- DOBIG32;
- len -= 32;
- }
- while (len >= 4) {
- DOBIG4;
- len -= 4;
- }
- buf4++;
- buf = (const unsigned char FAR *)buf4;
-
- if (len) do {
- c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8);
- } while (--len);
- c = ~c;
- return (unsigned long)(REV(c));
-}
-
-#endif /* BYFOUR */
-
-#define GF2_DIM 32 /* dimension of GF(2) vectors (length of CRC) */
-
-/* ========================================================================= */
-local unsigned long gf2_matrix_times(mat, vec)
- unsigned long *mat;
- unsigned long vec;
-{
- unsigned long sum;
-
- sum = 0;
- while (vec) {
- if (vec & 1)
- sum ^= *mat;
- vec >>= 1;
- mat++;
- }
- return sum;
-}
-
-/* ========================================================================= */
-local void gf2_matrix_square(square, mat)
- unsigned long *square;
- unsigned long *mat;
-{
- int n;
-
- for (n = 0; n < GF2_DIM; n++)
- square[n] = gf2_matrix_times(mat, mat[n]);
-}
-
-/* ========================================================================= */
-local uLong crc32_combine_(crc1, crc2, len2)
- uLong crc1;
- uLong crc2;
- z_off64_t len2;
-{
- int n;
- unsigned long row;
- unsigned long even[GF2_DIM]; /* even-power-of-two zeros operator */
- unsigned long odd[GF2_DIM]; /* odd-power-of-two zeros operator */
-
- /* degenerate case (also disallow negative lengths) */
- if (len2 <= 0)
- return crc1;
-
- /* put operator for one zero bit in odd */
- odd[0] = 0xedb88320UL; /* CRC-32 polynomial */
- row = 1;
- for (n = 1; n < GF2_DIM; n++) {
- odd[n] = row;
- row <<= 1;
- }
-
- /* put operator for two zero bits in even */
- gf2_matrix_square(even, odd);
-
- /* put operator for four zero bits in odd */
- gf2_matrix_square(odd, even);
-
- /* apply len2 zeros to crc1 (first square will put the operator for one
- zero byte, eight zero bits, in even) */
- do {
- /* apply zeros operator for this bit of len2 */
- gf2_matrix_square(even, odd);
- if (len2 & 1)
- crc1 = gf2_matrix_times(even, crc1);
- len2 >>= 1;
-
- /* if no more bits set, then done */
- if (len2 == 0)
- break;
-
- /* another iteration of the loop with odd and even swapped */
- gf2_matrix_square(odd, even);
- if (len2 & 1)
- crc1 = gf2_matrix_times(odd, crc1);
- len2 >>= 1;
-
- /* if no more bits set, then done */
- } while (len2 != 0);
-
- /* return combined crc */
- crc1 ^= crc2;
- return crc1;
-}
-
-/* ========================================================================= */
-uLong ZEXPORT crc32_combine(crc1, crc2, len2)
- uLong crc1;
- uLong crc2;
- z_off_t len2;
-{
- return crc32_combine_(crc1, crc2, len2);
-}
-
-uLong ZEXPORT crc32_combine64(crc1, crc2, len2)
- uLong crc1;
- uLong crc2;
- z_off64_t len2;
-{
- return crc32_combine_(crc1, crc2, len2);
-}
diff --git a/sdk-modifications/libsrc/zlib/crc32.h b/sdk-modifications/libsrc/zlib/crc32.h
deleted file mode 100755
index c3e7171..0000000
--- a/sdk-modifications/libsrc/zlib/crc32.h
+++ /dev/null
@@ -1,441 +0,0 @@
-/* crc32.h -- tables for rapid CRC calculation
- * Generated automatically by crc32.c
- */
-
-local const crc_table_t FAR crc_table[TBLS][256] =
-{
- {
- 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL,
- 0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL,
- 0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL,
- 0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL,
- 0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL,
- 0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL,
- 0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL,
- 0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL,
- 0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL,
- 0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL,
- 0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL,
- 0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL,
- 0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL,
- 0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL,
- 0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL,
- 0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL,
- 0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL,
- 0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL,
- 0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL,
- 0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL,
- 0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL,
- 0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL,
- 0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL,
- 0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL,
- 0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL,
- 0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL,
- 0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL,
- 0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL,
- 0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL,
- 0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL,
- 0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL,
- 0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL,
- 0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL,
- 0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL,
- 0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL,
- 0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL,
- 0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL,
- 0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL,
- 0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL,
- 0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL,
- 0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL,
- 0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL,
- 0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL,
- 0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL,
- 0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL,
- 0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL,
- 0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL,
- 0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL,
- 0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL,
- 0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL,
- 0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL,
- 0x2d02ef8dUL
-#ifdef BYFOUR
- },
- {
- 0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL,
- 0x7d77f445UL, 0x565aa786UL, 0x4f4196c7UL, 0xc8d98a08UL, 0xd1c2bb49UL,
- 0xfaefe88aUL, 0xe3f4d9cbUL, 0xacb54f0cUL, 0xb5ae7e4dUL, 0x9e832d8eUL,
- 0x87981ccfUL, 0x4ac21251UL, 0x53d92310UL, 0x78f470d3UL, 0x61ef4192UL,
- 0x2eaed755UL, 0x37b5e614UL, 0x1c98b5d7UL, 0x05838496UL, 0x821b9859UL,
- 0x9b00a918UL, 0xb02dfadbUL, 0xa936cb9aUL, 0xe6775d5dUL, 0xff6c6c1cUL,
- 0xd4413fdfUL, 0xcd5a0e9eUL, 0x958424a2UL, 0x8c9f15e3UL, 0xa7b24620UL,
- 0xbea97761UL, 0xf1e8e1a6UL, 0xe8f3d0e7UL, 0xc3de8324UL, 0xdac5b265UL,
- 0x5d5daeaaUL, 0x44469febUL, 0x6f6bcc28UL, 0x7670fd69UL, 0x39316baeUL,
- 0x202a5aefUL, 0x0b07092cUL, 0x121c386dUL, 0xdf4636f3UL, 0xc65d07b2UL,
- 0xed705471UL, 0xf46b6530UL, 0xbb2af3f7UL, 0xa231c2b6UL, 0x891c9175UL,
- 0x9007a034UL, 0x179fbcfbUL, 0x0e848dbaUL, 0x25a9de79UL, 0x3cb2ef38UL,
- 0x73f379ffUL, 0x6ae848beUL, 0x41c51b7dUL, 0x58de2a3cUL, 0xf0794f05UL,
- 0xe9627e44UL, 0xc24f2d87UL, 0xdb541cc6UL, 0x94158a01UL, 0x8d0ebb40UL,
- 0xa623e883UL, 0xbf38d9c2UL, 0x38a0c50dUL, 0x21bbf44cUL, 0x0a96a78fUL,
- 0x138d96ceUL, 0x5ccc0009UL, 0x45d73148UL, 0x6efa628bUL, 0x77e153caUL,
- 0xbabb5d54UL, 0xa3a06c15UL, 0x888d3fd6UL, 0x91960e97UL, 0xded79850UL,
- 0xc7cca911UL, 0xece1fad2UL, 0xf5facb93UL, 0x7262d75cUL, 0x6b79e61dUL,
- 0x4054b5deUL, 0x594f849fUL, 0x160e1258UL, 0x0f152319UL, 0x243870daUL,
- 0x3d23419bUL, 0x65fd6ba7UL, 0x7ce65ae6UL, 0x57cb0925UL, 0x4ed03864UL,
- 0x0191aea3UL, 0x188a9fe2UL, 0x33a7cc21UL, 0x2abcfd60UL, 0xad24e1afUL,
- 0xb43fd0eeUL, 0x9f12832dUL, 0x8609b26cUL, 0xc94824abUL, 0xd05315eaUL,
- 0xfb7e4629UL, 0xe2657768UL, 0x2f3f79f6UL, 0x362448b7UL, 0x1d091b74UL,
- 0x04122a35UL, 0x4b53bcf2UL, 0x52488db3UL, 0x7965de70UL, 0x607eef31UL,
- 0xe7e6f3feUL, 0xfefdc2bfUL, 0xd5d0917cUL, 0xcccba03dUL, 0x838a36faUL,
- 0x9a9107bbUL, 0xb1bc5478UL, 0xa8a76539UL, 0x3b83984bUL, 0x2298a90aUL,
- 0x09b5fac9UL, 0x10aecb88UL, 0x5fef5d4fUL, 0x46f46c0eUL, 0x6dd93fcdUL,
- 0x74c20e8cUL, 0xf35a1243UL, 0xea412302UL, 0xc16c70c1UL, 0xd8774180UL,
- 0x9736d747UL, 0x8e2de606UL, 0xa500b5c5UL, 0xbc1b8484UL, 0x71418a1aUL,
- 0x685abb5bUL, 0x4377e898UL, 0x5a6cd9d9UL, 0x152d4f1eUL, 0x0c367e5fUL,
- 0x271b2d9cUL, 0x3e001cddUL, 0xb9980012UL, 0xa0833153UL, 0x8bae6290UL,
- 0x92b553d1UL, 0xddf4c516UL, 0xc4eff457UL, 0xefc2a794UL, 0xf6d996d5UL,
- 0xae07bce9UL, 0xb71c8da8UL, 0x9c31de6bUL, 0x852aef2aUL, 0xca6b79edUL,
- 0xd37048acUL, 0xf85d1b6fUL, 0xe1462a2eUL, 0x66de36e1UL, 0x7fc507a0UL,
- 0x54e85463UL, 0x4df36522UL, 0x02b2f3e5UL, 0x1ba9c2a4UL, 0x30849167UL,
- 0x299fa026UL, 0xe4c5aeb8UL, 0xfdde9ff9UL, 0xd6f3cc3aUL, 0xcfe8fd7bUL,
- 0x80a96bbcUL, 0x99b25afdUL, 0xb29f093eUL, 0xab84387fUL, 0x2c1c24b0UL,
- 0x350715f1UL, 0x1e2a4632UL, 0x07317773UL, 0x4870e1b4UL, 0x516bd0f5UL,
- 0x7a468336UL, 0x635db277UL, 0xcbfad74eUL, 0xd2e1e60fUL, 0xf9ccb5ccUL,
- 0xe0d7848dUL, 0xaf96124aUL, 0xb68d230bUL, 0x9da070c8UL, 0x84bb4189UL,
- 0x03235d46UL, 0x1a386c07UL, 0x31153fc4UL, 0x280e0e85UL, 0x674f9842UL,
- 0x7e54a903UL, 0x5579fac0UL, 0x4c62cb81UL, 0x8138c51fUL, 0x9823f45eUL,
- 0xb30ea79dUL, 0xaa1596dcUL, 0xe554001bUL, 0xfc4f315aUL, 0xd7626299UL,
- 0xce7953d8UL, 0x49e14f17UL, 0x50fa7e56UL, 0x7bd72d95UL, 0x62cc1cd4UL,
- 0x2d8d8a13UL, 0x3496bb52UL, 0x1fbbe891UL, 0x06a0d9d0UL, 0x5e7ef3ecUL,
- 0x4765c2adUL, 0x6c48916eUL, 0x7553a02fUL, 0x3a1236e8UL, 0x230907a9UL,
- 0x0824546aUL, 0x113f652bUL, 0x96a779e4UL, 0x8fbc48a5UL, 0xa4911b66UL,
- 0xbd8a2a27UL, 0xf2cbbce0UL, 0xebd08da1UL, 0xc0fdde62UL, 0xd9e6ef23UL,
- 0x14bce1bdUL, 0x0da7d0fcUL, 0x268a833fUL, 0x3f91b27eUL, 0x70d024b9UL,
- 0x69cb15f8UL, 0x42e6463bUL, 0x5bfd777aUL, 0xdc656bb5UL, 0xc57e5af4UL,
- 0xee530937UL, 0xf7483876UL, 0xb809aeb1UL, 0xa1129ff0UL, 0x8a3fcc33UL,
- 0x9324fd72UL
- },
- {
- 0x00000000UL, 0x01c26a37UL, 0x0384d46eUL, 0x0246be59UL, 0x0709a8dcUL,
- 0x06cbc2ebUL, 0x048d7cb2UL, 0x054f1685UL, 0x0e1351b8UL, 0x0fd13b8fUL,
- 0x0d9785d6UL, 0x0c55efe1UL, 0x091af964UL, 0x08d89353UL, 0x0a9e2d0aUL,
- 0x0b5c473dUL, 0x1c26a370UL, 0x1de4c947UL, 0x1fa2771eUL, 0x1e601d29UL,
- 0x1b2f0bacUL, 0x1aed619bUL, 0x18abdfc2UL, 0x1969b5f5UL, 0x1235f2c8UL,
- 0x13f798ffUL, 0x11b126a6UL, 0x10734c91UL, 0x153c5a14UL, 0x14fe3023UL,
- 0x16b88e7aUL, 0x177ae44dUL, 0x384d46e0UL, 0x398f2cd7UL, 0x3bc9928eUL,
- 0x3a0bf8b9UL, 0x3f44ee3cUL, 0x3e86840bUL, 0x3cc03a52UL, 0x3d025065UL,
- 0x365e1758UL, 0x379c7d6fUL, 0x35dac336UL, 0x3418a901UL, 0x3157bf84UL,
- 0x3095d5b3UL, 0x32d36beaUL, 0x331101ddUL, 0x246be590UL, 0x25a98fa7UL,
- 0x27ef31feUL, 0x262d5bc9UL, 0x23624d4cUL, 0x22a0277bUL, 0x20e69922UL,
- 0x2124f315UL, 0x2a78b428UL, 0x2bbade1fUL, 0x29fc6046UL, 0x283e0a71UL,
- 0x2d711cf4UL, 0x2cb376c3UL, 0x2ef5c89aUL, 0x2f37a2adUL, 0x709a8dc0UL,
- 0x7158e7f7UL, 0x731e59aeUL, 0x72dc3399UL, 0x7793251cUL, 0x76514f2bUL,
- 0x7417f172UL, 0x75d59b45UL, 0x7e89dc78UL, 0x7f4bb64fUL, 0x7d0d0816UL,
- 0x7ccf6221UL, 0x798074a4UL, 0x78421e93UL, 0x7a04a0caUL, 0x7bc6cafdUL,
- 0x6cbc2eb0UL, 0x6d7e4487UL, 0x6f38fadeUL, 0x6efa90e9UL, 0x6bb5866cUL,
- 0x6a77ec5bUL, 0x68315202UL, 0x69f33835UL, 0x62af7f08UL, 0x636d153fUL,
- 0x612bab66UL, 0x60e9c151UL, 0x65a6d7d4UL, 0x6464bde3UL, 0x662203baUL,
- 0x67e0698dUL, 0x48d7cb20UL, 0x4915a117UL, 0x4b531f4eUL, 0x4a917579UL,
- 0x4fde63fcUL, 0x4e1c09cbUL, 0x4c5ab792UL, 0x4d98dda5UL, 0x46c49a98UL,
- 0x4706f0afUL, 0x45404ef6UL, 0x448224c1UL, 0x41cd3244UL, 0x400f5873UL,
- 0x4249e62aUL, 0x438b8c1dUL, 0x54f16850UL, 0x55330267UL, 0x5775bc3eUL,
- 0x56b7d609UL, 0x53f8c08cUL, 0x523aaabbUL, 0x507c14e2UL, 0x51be7ed5UL,
- 0x5ae239e8UL, 0x5b2053dfUL, 0x5966ed86UL, 0x58a487b1UL, 0x5deb9134UL,
- 0x5c29fb03UL, 0x5e6f455aUL, 0x5fad2f6dUL, 0xe1351b80UL, 0xe0f771b7UL,
- 0xe2b1cfeeUL, 0xe373a5d9UL, 0xe63cb35cUL, 0xe7fed96bUL, 0xe5b86732UL,
- 0xe47a0d05UL, 0xef264a38UL, 0xeee4200fUL, 0xeca29e56UL, 0xed60f461UL,
- 0xe82fe2e4UL, 0xe9ed88d3UL, 0xebab368aUL, 0xea695cbdUL, 0xfd13b8f0UL,
- 0xfcd1d2c7UL, 0xfe976c9eUL, 0xff5506a9UL, 0xfa1a102cUL, 0xfbd87a1bUL,
- 0xf99ec442UL, 0xf85cae75UL, 0xf300e948UL, 0xf2c2837fUL, 0xf0843d26UL,
- 0xf1465711UL, 0xf4094194UL, 0xf5cb2ba3UL, 0xf78d95faUL, 0xf64fffcdUL,
- 0xd9785d60UL, 0xd8ba3757UL, 0xdafc890eUL, 0xdb3ee339UL, 0xde71f5bcUL,
- 0xdfb39f8bUL, 0xddf521d2UL, 0xdc374be5UL, 0xd76b0cd8UL, 0xd6a966efUL,
- 0xd4efd8b6UL, 0xd52db281UL, 0xd062a404UL, 0xd1a0ce33UL, 0xd3e6706aUL,
- 0xd2241a5dUL, 0xc55efe10UL, 0xc49c9427UL, 0xc6da2a7eUL, 0xc7184049UL,
- 0xc25756ccUL, 0xc3953cfbUL, 0xc1d382a2UL, 0xc011e895UL, 0xcb4dafa8UL,
- 0xca8fc59fUL, 0xc8c97bc6UL, 0xc90b11f1UL, 0xcc440774UL, 0xcd866d43UL,
- 0xcfc0d31aUL, 0xce02b92dUL, 0x91af9640UL, 0x906dfc77UL, 0x922b422eUL,
- 0x93e92819UL, 0x96a63e9cUL, 0x976454abUL, 0x9522eaf2UL, 0x94e080c5UL,
- 0x9fbcc7f8UL, 0x9e7eadcfUL, 0x9c381396UL, 0x9dfa79a1UL, 0x98b56f24UL,
- 0x99770513UL, 0x9b31bb4aUL, 0x9af3d17dUL, 0x8d893530UL, 0x8c4b5f07UL,
- 0x8e0de15eUL, 0x8fcf8b69UL, 0x8a809decUL, 0x8b42f7dbUL, 0x89044982UL,
- 0x88c623b5UL, 0x839a6488UL, 0x82580ebfUL, 0x801eb0e6UL, 0x81dcdad1UL,
- 0x8493cc54UL, 0x8551a663UL, 0x8717183aUL, 0x86d5720dUL, 0xa9e2d0a0UL,
- 0xa820ba97UL, 0xaa6604ceUL, 0xaba46ef9UL, 0xaeeb787cUL, 0xaf29124bUL,
- 0xad6fac12UL, 0xacadc625UL, 0xa7f18118UL, 0xa633eb2fUL, 0xa4755576UL,
- 0xa5b73f41UL, 0xa0f829c4UL, 0xa13a43f3UL, 0xa37cfdaaUL, 0xa2be979dUL,
- 0xb5c473d0UL, 0xb40619e7UL, 0xb640a7beUL, 0xb782cd89UL, 0xb2cddb0cUL,
- 0xb30fb13bUL, 0xb1490f62UL, 0xb08b6555UL, 0xbbd72268UL, 0xba15485fUL,
- 0xb853f606UL, 0xb9919c31UL, 0xbcde8ab4UL, 0xbd1ce083UL, 0xbf5a5edaUL,
- 0xbe9834edUL
- },
- {
- 0x00000000UL, 0xb8bc6765UL, 0xaa09c88bUL, 0x12b5afeeUL, 0x8f629757UL,
- 0x37def032UL, 0x256b5fdcUL, 0x9dd738b9UL, 0xc5b428efUL, 0x7d084f8aUL,
- 0x6fbde064UL, 0xd7018701UL, 0x4ad6bfb8UL, 0xf26ad8ddUL, 0xe0df7733UL,
- 0x58631056UL, 0x5019579fUL, 0xe8a530faUL, 0xfa109f14UL, 0x42acf871UL,
- 0xdf7bc0c8UL, 0x67c7a7adUL, 0x75720843UL, 0xcdce6f26UL, 0x95ad7f70UL,
- 0x2d111815UL, 0x3fa4b7fbUL, 0x8718d09eUL, 0x1acfe827UL, 0xa2738f42UL,
- 0xb0c620acUL, 0x087a47c9UL, 0xa032af3eUL, 0x188ec85bUL, 0x0a3b67b5UL,
- 0xb28700d0UL, 0x2f503869UL, 0x97ec5f0cUL, 0x8559f0e2UL, 0x3de59787UL,
- 0x658687d1UL, 0xdd3ae0b4UL, 0xcf8f4f5aUL, 0x7733283fUL, 0xeae41086UL,
- 0x525877e3UL, 0x40edd80dUL, 0xf851bf68UL, 0xf02bf8a1UL, 0x48979fc4UL,
- 0x5a22302aUL, 0xe29e574fUL, 0x7f496ff6UL, 0xc7f50893UL, 0xd540a77dUL,
- 0x6dfcc018UL, 0x359fd04eUL, 0x8d23b72bUL, 0x9f9618c5UL, 0x272a7fa0UL,
- 0xbafd4719UL, 0x0241207cUL, 0x10f48f92UL, 0xa848e8f7UL, 0x9b14583dUL,
- 0x23a83f58UL, 0x311d90b6UL, 0x89a1f7d3UL, 0x1476cf6aUL, 0xaccaa80fUL,
- 0xbe7f07e1UL, 0x06c36084UL, 0x5ea070d2UL, 0xe61c17b7UL, 0xf4a9b859UL,
- 0x4c15df3cUL, 0xd1c2e785UL, 0x697e80e0UL, 0x7bcb2f0eUL, 0xc377486bUL,
- 0xcb0d0fa2UL, 0x73b168c7UL, 0x6104c729UL, 0xd9b8a04cUL, 0x446f98f5UL,
- 0xfcd3ff90UL, 0xee66507eUL, 0x56da371bUL, 0x0eb9274dUL, 0xb6054028UL,
- 0xa4b0efc6UL, 0x1c0c88a3UL, 0x81dbb01aUL, 0x3967d77fUL, 0x2bd27891UL,
- 0x936e1ff4UL, 0x3b26f703UL, 0x839a9066UL, 0x912f3f88UL, 0x299358edUL,
- 0xb4446054UL, 0x0cf80731UL, 0x1e4da8dfUL, 0xa6f1cfbaUL, 0xfe92dfecUL,
- 0x462eb889UL, 0x549b1767UL, 0xec277002UL, 0x71f048bbUL, 0xc94c2fdeUL,
- 0xdbf98030UL, 0x6345e755UL, 0x6b3fa09cUL, 0xd383c7f9UL, 0xc1366817UL,
- 0x798a0f72UL, 0xe45d37cbUL, 0x5ce150aeUL, 0x4e54ff40UL, 0xf6e89825UL,
- 0xae8b8873UL, 0x1637ef16UL, 0x048240f8UL, 0xbc3e279dUL, 0x21e91f24UL,
- 0x99557841UL, 0x8be0d7afUL, 0x335cb0caUL, 0xed59b63bUL, 0x55e5d15eUL,
- 0x47507eb0UL, 0xffec19d5UL, 0x623b216cUL, 0xda874609UL, 0xc832e9e7UL,
- 0x708e8e82UL, 0x28ed9ed4UL, 0x9051f9b1UL, 0x82e4565fUL, 0x3a58313aUL,
- 0xa78f0983UL, 0x1f336ee6UL, 0x0d86c108UL, 0xb53aa66dUL, 0xbd40e1a4UL,
- 0x05fc86c1UL, 0x1749292fUL, 0xaff54e4aUL, 0x322276f3UL, 0x8a9e1196UL,
- 0x982bbe78UL, 0x2097d91dUL, 0x78f4c94bUL, 0xc048ae2eUL, 0xd2fd01c0UL,
- 0x6a4166a5UL, 0xf7965e1cUL, 0x4f2a3979UL, 0x5d9f9697UL, 0xe523f1f2UL,
- 0x4d6b1905UL, 0xf5d77e60UL, 0xe762d18eUL, 0x5fdeb6ebUL, 0xc2098e52UL,
- 0x7ab5e937UL, 0x680046d9UL, 0xd0bc21bcUL, 0x88df31eaUL, 0x3063568fUL,
- 0x22d6f961UL, 0x9a6a9e04UL, 0x07bda6bdUL, 0xbf01c1d8UL, 0xadb46e36UL,
- 0x15080953UL, 0x1d724e9aUL, 0xa5ce29ffUL, 0xb77b8611UL, 0x0fc7e174UL,
- 0x9210d9cdUL, 0x2aacbea8UL, 0x38191146UL, 0x80a57623UL, 0xd8c66675UL,
- 0x607a0110UL, 0x72cfaefeUL, 0xca73c99bUL, 0x57a4f122UL, 0xef189647UL,
- 0xfdad39a9UL, 0x45115eccUL, 0x764dee06UL, 0xcef18963UL, 0xdc44268dUL,
- 0x64f841e8UL, 0xf92f7951UL, 0x41931e34UL, 0x5326b1daUL, 0xeb9ad6bfUL,
- 0xb3f9c6e9UL, 0x0b45a18cUL, 0x19f00e62UL, 0xa14c6907UL, 0x3c9b51beUL,
- 0x842736dbUL, 0x96929935UL, 0x2e2efe50UL, 0x2654b999UL, 0x9ee8defcUL,
- 0x8c5d7112UL, 0x34e11677UL, 0xa9362eceUL, 0x118a49abUL, 0x033fe645UL,
- 0xbb838120UL, 0xe3e09176UL, 0x5b5cf613UL, 0x49e959fdUL, 0xf1553e98UL,
- 0x6c820621UL, 0xd43e6144UL, 0xc68bceaaUL, 0x7e37a9cfUL, 0xd67f4138UL,
- 0x6ec3265dUL, 0x7c7689b3UL, 0xc4caeed6UL, 0x591dd66fUL, 0xe1a1b10aUL,
- 0xf3141ee4UL, 0x4ba87981UL, 0x13cb69d7UL, 0xab770eb2UL, 0xb9c2a15cUL,
- 0x017ec639UL, 0x9ca9fe80UL, 0x241599e5UL, 0x36a0360bUL, 0x8e1c516eUL,
- 0x866616a7UL, 0x3eda71c2UL, 0x2c6fde2cUL, 0x94d3b949UL, 0x090481f0UL,
- 0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL,
- 0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL,
- 0xde0506f1UL
- },
- {
- 0x00000000UL, 0x96300777UL, 0x2c610eeeUL, 0xba510999UL, 0x19c46d07UL,
- 0x8ff46a70UL, 0x35a563e9UL, 0xa395649eUL, 0x3288db0eUL, 0xa4b8dc79UL,
- 0x1ee9d5e0UL, 0x88d9d297UL, 0x2b4cb609UL, 0xbd7cb17eUL, 0x072db8e7UL,
- 0x911dbf90UL, 0x6410b71dUL, 0xf220b06aUL, 0x4871b9f3UL, 0xde41be84UL,
- 0x7dd4da1aUL, 0xebe4dd6dUL, 0x51b5d4f4UL, 0xc785d383UL, 0x56986c13UL,
- 0xc0a86b64UL, 0x7af962fdUL, 0xecc9658aUL, 0x4f5c0114UL, 0xd96c0663UL,
- 0x633d0ffaUL, 0xf50d088dUL, 0xc8206e3bUL, 0x5e10694cUL, 0xe44160d5UL,
- 0x727167a2UL, 0xd1e4033cUL, 0x47d4044bUL, 0xfd850dd2UL, 0x6bb50aa5UL,
- 0xfaa8b535UL, 0x6c98b242UL, 0xd6c9bbdbUL, 0x40f9bcacUL, 0xe36cd832UL,
- 0x755cdf45UL, 0xcf0dd6dcUL, 0x593dd1abUL, 0xac30d926UL, 0x3a00de51UL,
- 0x8051d7c8UL, 0x1661d0bfUL, 0xb5f4b421UL, 0x23c4b356UL, 0x9995bacfUL,
- 0x0fa5bdb8UL, 0x9eb80228UL, 0x0888055fUL, 0xb2d90cc6UL, 0x24e90bb1UL,
- 0x877c6f2fUL, 0x114c6858UL, 0xab1d61c1UL, 0x3d2d66b6UL, 0x9041dc76UL,
- 0x0671db01UL, 0xbc20d298UL, 0x2a10d5efUL, 0x8985b171UL, 0x1fb5b606UL,
- 0xa5e4bf9fUL, 0x33d4b8e8UL, 0xa2c90778UL, 0x34f9000fUL, 0x8ea80996UL,
- 0x18980ee1UL, 0xbb0d6a7fUL, 0x2d3d6d08UL, 0x976c6491UL, 0x015c63e6UL,
- 0xf4516b6bUL, 0x62616c1cUL, 0xd8306585UL, 0x4e0062f2UL, 0xed95066cUL,
- 0x7ba5011bUL, 0xc1f40882UL, 0x57c40ff5UL, 0xc6d9b065UL, 0x50e9b712UL,
- 0xeab8be8bUL, 0x7c88b9fcUL, 0xdf1ddd62UL, 0x492dda15UL, 0xf37cd38cUL,
- 0x654cd4fbUL, 0x5861b24dUL, 0xce51b53aUL, 0x7400bca3UL, 0xe230bbd4UL,
- 0x41a5df4aUL, 0xd795d83dUL, 0x6dc4d1a4UL, 0xfbf4d6d3UL, 0x6ae96943UL,
- 0xfcd96e34UL, 0x468867adUL, 0xd0b860daUL, 0x732d0444UL, 0xe51d0333UL,
- 0x5f4c0aaaUL, 0xc97c0dddUL, 0x3c710550UL, 0xaa410227UL, 0x10100bbeUL,
- 0x86200cc9UL, 0x25b56857UL, 0xb3856f20UL, 0x09d466b9UL, 0x9fe461ceUL,
- 0x0ef9de5eUL, 0x98c9d929UL, 0x2298d0b0UL, 0xb4a8d7c7UL, 0x173db359UL,
- 0x810db42eUL, 0x3b5cbdb7UL, 0xad6cbac0UL, 0x2083b8edUL, 0xb6b3bf9aUL,
- 0x0ce2b603UL, 0x9ad2b174UL, 0x3947d5eaUL, 0xaf77d29dUL, 0x1526db04UL,
- 0x8316dc73UL, 0x120b63e3UL, 0x843b6494UL, 0x3e6a6d0dUL, 0xa85a6a7aUL,
- 0x0bcf0ee4UL, 0x9dff0993UL, 0x27ae000aUL, 0xb19e077dUL, 0x44930ff0UL,
- 0xd2a30887UL, 0x68f2011eUL, 0xfec20669UL, 0x5d5762f7UL, 0xcb676580UL,
- 0x71366c19UL, 0xe7066b6eUL, 0x761bd4feUL, 0xe02bd389UL, 0x5a7ada10UL,
- 0xcc4add67UL, 0x6fdfb9f9UL, 0xf9efbe8eUL, 0x43beb717UL, 0xd58eb060UL,
- 0xe8a3d6d6UL, 0x7e93d1a1UL, 0xc4c2d838UL, 0x52f2df4fUL, 0xf167bbd1UL,
- 0x6757bca6UL, 0xdd06b53fUL, 0x4b36b248UL, 0xda2b0dd8UL, 0x4c1b0aafUL,
- 0xf64a0336UL, 0x607a0441UL, 0xc3ef60dfUL, 0x55df67a8UL, 0xef8e6e31UL,
- 0x79be6946UL, 0x8cb361cbUL, 0x1a8366bcUL, 0xa0d26f25UL, 0x36e26852UL,
- 0x95770cccUL, 0x03470bbbUL, 0xb9160222UL, 0x2f260555UL, 0xbe3bbac5UL,
- 0x280bbdb2UL, 0x925ab42bUL, 0x046ab35cUL, 0xa7ffd7c2UL, 0x31cfd0b5UL,
- 0x8b9ed92cUL, 0x1daede5bUL, 0xb0c2649bUL, 0x26f263ecUL, 0x9ca36a75UL,
- 0x0a936d02UL, 0xa906099cUL, 0x3f360eebUL, 0x85670772UL, 0x13570005UL,
- 0x824abf95UL, 0x147ab8e2UL, 0xae2bb17bUL, 0x381bb60cUL, 0x9b8ed292UL,
- 0x0dbed5e5UL, 0xb7efdc7cUL, 0x21dfdb0bUL, 0xd4d2d386UL, 0x42e2d4f1UL,
- 0xf8b3dd68UL, 0x6e83da1fUL, 0xcd16be81UL, 0x5b26b9f6UL, 0xe177b06fUL,
- 0x7747b718UL, 0xe65a0888UL, 0x706a0fffUL, 0xca3b0666UL, 0x5c0b0111UL,
- 0xff9e658fUL, 0x69ae62f8UL, 0xd3ff6b61UL, 0x45cf6c16UL, 0x78e20aa0UL,
- 0xeed20dd7UL, 0x5483044eUL, 0xc2b30339UL, 0x612667a7UL, 0xf71660d0UL,
- 0x4d476949UL, 0xdb776e3eUL, 0x4a6ad1aeUL, 0xdc5ad6d9UL, 0x660bdf40UL,
- 0xf03bd837UL, 0x53aebca9UL, 0xc59ebbdeUL, 0x7fcfb247UL, 0xe9ffb530UL,
- 0x1cf2bdbdUL, 0x8ac2bacaUL, 0x3093b353UL, 0xa6a3b424UL, 0x0536d0baUL,
- 0x9306d7cdUL, 0x2957de54UL, 0xbf67d923UL, 0x2e7a66b3UL, 0xb84a61c4UL,
- 0x021b685dUL, 0x942b6f2aUL, 0x37be0bb4UL, 0xa18e0cc3UL, 0x1bdf055aUL,
- 0x8def022dUL
- },
- {
- 0x00000000UL, 0x41311b19UL, 0x82623632UL, 0xc3532d2bUL, 0x04c56c64UL,
- 0x45f4777dUL, 0x86a75a56UL, 0xc796414fUL, 0x088ad9c8UL, 0x49bbc2d1UL,
- 0x8ae8effaUL, 0xcbd9f4e3UL, 0x0c4fb5acUL, 0x4d7eaeb5UL, 0x8e2d839eUL,
- 0xcf1c9887UL, 0x5112c24aUL, 0x1023d953UL, 0xd370f478UL, 0x9241ef61UL,
- 0x55d7ae2eUL, 0x14e6b537UL, 0xd7b5981cUL, 0x96848305UL, 0x59981b82UL,
- 0x18a9009bUL, 0xdbfa2db0UL, 0x9acb36a9UL, 0x5d5d77e6UL, 0x1c6c6cffUL,
- 0xdf3f41d4UL, 0x9e0e5acdUL, 0xa2248495UL, 0xe3159f8cUL, 0x2046b2a7UL,
- 0x6177a9beUL, 0xa6e1e8f1UL, 0xe7d0f3e8UL, 0x2483dec3UL, 0x65b2c5daUL,
- 0xaaae5d5dUL, 0xeb9f4644UL, 0x28cc6b6fUL, 0x69fd7076UL, 0xae6b3139UL,
- 0xef5a2a20UL, 0x2c09070bUL, 0x6d381c12UL, 0xf33646dfUL, 0xb2075dc6UL,
- 0x715470edUL, 0x30656bf4UL, 0xf7f32abbUL, 0xb6c231a2UL, 0x75911c89UL,
- 0x34a00790UL, 0xfbbc9f17UL, 0xba8d840eUL, 0x79dea925UL, 0x38efb23cUL,
- 0xff79f373UL, 0xbe48e86aUL, 0x7d1bc541UL, 0x3c2ade58UL, 0x054f79f0UL,
- 0x447e62e9UL, 0x872d4fc2UL, 0xc61c54dbUL, 0x018a1594UL, 0x40bb0e8dUL,
- 0x83e823a6UL, 0xc2d938bfUL, 0x0dc5a038UL, 0x4cf4bb21UL, 0x8fa7960aUL,
- 0xce968d13UL, 0x0900cc5cUL, 0x4831d745UL, 0x8b62fa6eUL, 0xca53e177UL,
- 0x545dbbbaUL, 0x156ca0a3UL, 0xd63f8d88UL, 0x970e9691UL, 0x5098d7deUL,
- 0x11a9ccc7UL, 0xd2fae1ecUL, 0x93cbfaf5UL, 0x5cd76272UL, 0x1de6796bUL,
- 0xdeb55440UL, 0x9f844f59UL, 0x58120e16UL, 0x1923150fUL, 0xda703824UL,
- 0x9b41233dUL, 0xa76bfd65UL, 0xe65ae67cUL, 0x2509cb57UL, 0x6438d04eUL,
- 0xa3ae9101UL, 0xe29f8a18UL, 0x21cca733UL, 0x60fdbc2aUL, 0xafe124adUL,
- 0xeed03fb4UL, 0x2d83129fUL, 0x6cb20986UL, 0xab2448c9UL, 0xea1553d0UL,
- 0x29467efbUL, 0x687765e2UL, 0xf6793f2fUL, 0xb7482436UL, 0x741b091dUL,
- 0x352a1204UL, 0xf2bc534bUL, 0xb38d4852UL, 0x70de6579UL, 0x31ef7e60UL,
- 0xfef3e6e7UL, 0xbfc2fdfeUL, 0x7c91d0d5UL, 0x3da0cbccUL, 0xfa368a83UL,
- 0xbb07919aUL, 0x7854bcb1UL, 0x3965a7a8UL, 0x4b98833bUL, 0x0aa99822UL,
- 0xc9fab509UL, 0x88cbae10UL, 0x4f5def5fUL, 0x0e6cf446UL, 0xcd3fd96dUL,
- 0x8c0ec274UL, 0x43125af3UL, 0x022341eaUL, 0xc1706cc1UL, 0x804177d8UL,
- 0x47d73697UL, 0x06e62d8eUL, 0xc5b500a5UL, 0x84841bbcUL, 0x1a8a4171UL,
- 0x5bbb5a68UL, 0x98e87743UL, 0xd9d96c5aUL, 0x1e4f2d15UL, 0x5f7e360cUL,
- 0x9c2d1b27UL, 0xdd1c003eUL, 0x120098b9UL, 0x533183a0UL, 0x9062ae8bUL,
- 0xd153b592UL, 0x16c5f4ddUL, 0x57f4efc4UL, 0x94a7c2efUL, 0xd596d9f6UL,
- 0xe9bc07aeUL, 0xa88d1cb7UL, 0x6bde319cUL, 0x2aef2a85UL, 0xed796bcaUL,
- 0xac4870d3UL, 0x6f1b5df8UL, 0x2e2a46e1UL, 0xe136de66UL, 0xa007c57fUL,
- 0x6354e854UL, 0x2265f34dUL, 0xe5f3b202UL, 0xa4c2a91bUL, 0x67918430UL,
- 0x26a09f29UL, 0xb8aec5e4UL, 0xf99fdefdUL, 0x3accf3d6UL, 0x7bfde8cfUL,
- 0xbc6ba980UL, 0xfd5ab299UL, 0x3e099fb2UL, 0x7f3884abUL, 0xb0241c2cUL,
- 0xf1150735UL, 0x32462a1eUL, 0x73773107UL, 0xb4e17048UL, 0xf5d06b51UL,
- 0x3683467aUL, 0x77b25d63UL, 0x4ed7facbUL, 0x0fe6e1d2UL, 0xccb5ccf9UL,
- 0x8d84d7e0UL, 0x4a1296afUL, 0x0b238db6UL, 0xc870a09dUL, 0x8941bb84UL,
- 0x465d2303UL, 0x076c381aUL, 0xc43f1531UL, 0x850e0e28UL, 0x42984f67UL,
- 0x03a9547eUL, 0xc0fa7955UL, 0x81cb624cUL, 0x1fc53881UL, 0x5ef42398UL,
- 0x9da70eb3UL, 0xdc9615aaUL, 0x1b0054e5UL, 0x5a314ffcUL, 0x996262d7UL,
- 0xd85379ceUL, 0x174fe149UL, 0x567efa50UL, 0x952dd77bUL, 0xd41ccc62UL,
- 0x138a8d2dUL, 0x52bb9634UL, 0x91e8bb1fUL, 0xd0d9a006UL, 0xecf37e5eUL,
- 0xadc26547UL, 0x6e91486cUL, 0x2fa05375UL, 0xe836123aUL, 0xa9070923UL,
- 0x6a542408UL, 0x2b653f11UL, 0xe479a796UL, 0xa548bc8fUL, 0x661b91a4UL,
- 0x272a8abdUL, 0xe0bccbf2UL, 0xa18dd0ebUL, 0x62defdc0UL, 0x23efe6d9UL,
- 0xbde1bc14UL, 0xfcd0a70dUL, 0x3f838a26UL, 0x7eb2913fUL, 0xb924d070UL,
- 0xf815cb69UL, 0x3b46e642UL, 0x7a77fd5bUL, 0xb56b65dcUL, 0xf45a7ec5UL,
- 0x370953eeUL, 0x763848f7UL, 0xb1ae09b8UL, 0xf09f12a1UL, 0x33cc3f8aUL,
- 0x72fd2493UL
- },
- {
- 0x00000000UL, 0x376ac201UL, 0x6ed48403UL, 0x59be4602UL, 0xdca80907UL,
- 0xebc2cb06UL, 0xb27c8d04UL, 0x85164f05UL, 0xb851130eUL, 0x8f3bd10fUL,
- 0xd685970dUL, 0xe1ef550cUL, 0x64f91a09UL, 0x5393d808UL, 0x0a2d9e0aUL,
- 0x3d475c0bUL, 0x70a3261cUL, 0x47c9e41dUL, 0x1e77a21fUL, 0x291d601eUL,
- 0xac0b2f1bUL, 0x9b61ed1aUL, 0xc2dfab18UL, 0xf5b56919UL, 0xc8f23512UL,
- 0xff98f713UL, 0xa626b111UL, 0x914c7310UL, 0x145a3c15UL, 0x2330fe14UL,
- 0x7a8eb816UL, 0x4de47a17UL, 0xe0464d38UL, 0xd72c8f39UL, 0x8e92c93bUL,
- 0xb9f80b3aUL, 0x3cee443fUL, 0x0b84863eUL, 0x523ac03cUL, 0x6550023dUL,
- 0x58175e36UL, 0x6f7d9c37UL, 0x36c3da35UL, 0x01a91834UL, 0x84bf5731UL,
- 0xb3d59530UL, 0xea6bd332UL, 0xdd011133UL, 0x90e56b24UL, 0xa78fa925UL,
- 0xfe31ef27UL, 0xc95b2d26UL, 0x4c4d6223UL, 0x7b27a022UL, 0x2299e620UL,
- 0x15f32421UL, 0x28b4782aUL, 0x1fdeba2bUL, 0x4660fc29UL, 0x710a3e28UL,
- 0xf41c712dUL, 0xc376b32cUL, 0x9ac8f52eUL, 0xada2372fUL, 0xc08d9a70UL,
- 0xf7e75871UL, 0xae591e73UL, 0x9933dc72UL, 0x1c259377UL, 0x2b4f5176UL,
- 0x72f11774UL, 0x459bd575UL, 0x78dc897eUL, 0x4fb64b7fUL, 0x16080d7dUL,
- 0x2162cf7cUL, 0xa4748079UL, 0x931e4278UL, 0xcaa0047aUL, 0xfdcac67bUL,
- 0xb02ebc6cUL, 0x87447e6dUL, 0xdefa386fUL, 0xe990fa6eUL, 0x6c86b56bUL,
- 0x5bec776aUL, 0x02523168UL, 0x3538f369UL, 0x087faf62UL, 0x3f156d63UL,
- 0x66ab2b61UL, 0x51c1e960UL, 0xd4d7a665UL, 0xe3bd6464UL, 0xba032266UL,
- 0x8d69e067UL, 0x20cbd748UL, 0x17a11549UL, 0x4e1f534bUL, 0x7975914aUL,
- 0xfc63de4fUL, 0xcb091c4eUL, 0x92b75a4cUL, 0xa5dd984dUL, 0x989ac446UL,
- 0xaff00647UL, 0xf64e4045UL, 0xc1248244UL, 0x4432cd41UL, 0x73580f40UL,
- 0x2ae64942UL, 0x1d8c8b43UL, 0x5068f154UL, 0x67023355UL, 0x3ebc7557UL,
- 0x09d6b756UL, 0x8cc0f853UL, 0xbbaa3a52UL, 0xe2147c50UL, 0xd57ebe51UL,
- 0xe839e25aUL, 0xdf53205bUL, 0x86ed6659UL, 0xb187a458UL, 0x3491eb5dUL,
- 0x03fb295cUL, 0x5a456f5eUL, 0x6d2fad5fUL, 0x801b35e1UL, 0xb771f7e0UL,
- 0xeecfb1e2UL, 0xd9a573e3UL, 0x5cb33ce6UL, 0x6bd9fee7UL, 0x3267b8e5UL,
- 0x050d7ae4UL, 0x384a26efUL, 0x0f20e4eeUL, 0x569ea2ecUL, 0x61f460edUL,
- 0xe4e22fe8UL, 0xd388ede9UL, 0x8a36abebUL, 0xbd5c69eaUL, 0xf0b813fdUL,
- 0xc7d2d1fcUL, 0x9e6c97feUL, 0xa90655ffUL, 0x2c101afaUL, 0x1b7ad8fbUL,
- 0x42c49ef9UL, 0x75ae5cf8UL, 0x48e900f3UL, 0x7f83c2f2UL, 0x263d84f0UL,
- 0x115746f1UL, 0x944109f4UL, 0xa32bcbf5UL, 0xfa958df7UL, 0xcdff4ff6UL,
- 0x605d78d9UL, 0x5737bad8UL, 0x0e89fcdaUL, 0x39e33edbUL, 0xbcf571deUL,
- 0x8b9fb3dfUL, 0xd221f5ddUL, 0xe54b37dcUL, 0xd80c6bd7UL, 0xef66a9d6UL,
- 0xb6d8efd4UL, 0x81b22dd5UL, 0x04a462d0UL, 0x33cea0d1UL, 0x6a70e6d3UL,
- 0x5d1a24d2UL, 0x10fe5ec5UL, 0x27949cc4UL, 0x7e2adac6UL, 0x494018c7UL,
- 0xcc5657c2UL, 0xfb3c95c3UL, 0xa282d3c1UL, 0x95e811c0UL, 0xa8af4dcbUL,
- 0x9fc58fcaUL, 0xc67bc9c8UL, 0xf1110bc9UL, 0x740744ccUL, 0x436d86cdUL,
- 0x1ad3c0cfUL, 0x2db902ceUL, 0x4096af91UL, 0x77fc6d90UL, 0x2e422b92UL,
- 0x1928e993UL, 0x9c3ea696UL, 0xab546497UL, 0xf2ea2295UL, 0xc580e094UL,
- 0xf8c7bc9fUL, 0xcfad7e9eUL, 0x9613389cUL, 0xa179fa9dUL, 0x246fb598UL,
- 0x13057799UL, 0x4abb319bUL, 0x7dd1f39aUL, 0x3035898dUL, 0x075f4b8cUL,
- 0x5ee10d8eUL, 0x698bcf8fUL, 0xec9d808aUL, 0xdbf7428bUL, 0x82490489UL,
- 0xb523c688UL, 0x88649a83UL, 0xbf0e5882UL, 0xe6b01e80UL, 0xd1dadc81UL,
- 0x54cc9384UL, 0x63a65185UL, 0x3a181787UL, 0x0d72d586UL, 0xa0d0e2a9UL,
- 0x97ba20a8UL, 0xce0466aaUL, 0xf96ea4abUL, 0x7c78ebaeUL, 0x4b1229afUL,
- 0x12ac6fadUL, 0x25c6adacUL, 0x1881f1a7UL, 0x2feb33a6UL, 0x765575a4UL,
- 0x413fb7a5UL, 0xc429f8a0UL, 0xf3433aa1UL, 0xaafd7ca3UL, 0x9d97bea2UL,
- 0xd073c4b5UL, 0xe71906b4UL, 0xbea740b6UL, 0x89cd82b7UL, 0x0cdbcdb2UL,
- 0x3bb10fb3UL, 0x620f49b1UL, 0x55658bb0UL, 0x6822d7bbUL, 0x5f4815baUL,
- 0x06f653b8UL, 0x319c91b9UL, 0xb48adebcUL, 0x83e01cbdUL, 0xda5e5abfUL,
- 0xed3498beUL
- },
- {
- 0x00000000UL, 0x6567bcb8UL, 0x8bc809aaUL, 0xeeafb512UL, 0x5797628fUL,
- 0x32f0de37UL, 0xdc5f6b25UL, 0xb938d79dUL, 0xef28b4c5UL, 0x8a4f087dUL,
- 0x64e0bd6fUL, 0x018701d7UL, 0xb8bfd64aUL, 0xddd86af2UL, 0x3377dfe0UL,
- 0x56106358UL, 0x9f571950UL, 0xfa30a5e8UL, 0x149f10faUL, 0x71f8ac42UL,
- 0xc8c07bdfUL, 0xada7c767UL, 0x43087275UL, 0x266fcecdUL, 0x707fad95UL,
- 0x1518112dUL, 0xfbb7a43fUL, 0x9ed01887UL, 0x27e8cf1aUL, 0x428f73a2UL,
- 0xac20c6b0UL, 0xc9477a08UL, 0x3eaf32a0UL, 0x5bc88e18UL, 0xb5673b0aUL,
- 0xd00087b2UL, 0x6938502fUL, 0x0c5fec97UL, 0xe2f05985UL, 0x8797e53dUL,
- 0xd1878665UL, 0xb4e03addUL, 0x5a4f8fcfUL, 0x3f283377UL, 0x8610e4eaUL,
- 0xe3775852UL, 0x0dd8ed40UL, 0x68bf51f8UL, 0xa1f82bf0UL, 0xc49f9748UL,
- 0x2a30225aUL, 0x4f579ee2UL, 0xf66f497fUL, 0x9308f5c7UL, 0x7da740d5UL,
- 0x18c0fc6dUL, 0x4ed09f35UL, 0x2bb7238dUL, 0xc518969fUL, 0xa07f2a27UL,
- 0x1947fdbaUL, 0x7c204102UL, 0x928ff410UL, 0xf7e848a8UL, 0x3d58149bUL,
- 0x583fa823UL, 0xb6901d31UL, 0xd3f7a189UL, 0x6acf7614UL, 0x0fa8caacUL,
- 0xe1077fbeUL, 0x8460c306UL, 0xd270a05eUL, 0xb7171ce6UL, 0x59b8a9f4UL,
- 0x3cdf154cUL, 0x85e7c2d1UL, 0xe0807e69UL, 0x0e2fcb7bUL, 0x6b4877c3UL,
- 0xa20f0dcbUL, 0xc768b173UL, 0x29c70461UL, 0x4ca0b8d9UL, 0xf5986f44UL,
- 0x90ffd3fcUL, 0x7e5066eeUL, 0x1b37da56UL, 0x4d27b90eUL, 0x284005b6UL,
- 0xc6efb0a4UL, 0xa3880c1cUL, 0x1ab0db81UL, 0x7fd76739UL, 0x9178d22bUL,
- 0xf41f6e93UL, 0x03f7263bUL, 0x66909a83UL, 0x883f2f91UL, 0xed589329UL,
- 0x546044b4UL, 0x3107f80cUL, 0xdfa84d1eUL, 0xbacff1a6UL, 0xecdf92feUL,
- 0x89b82e46UL, 0x67179b54UL, 0x027027ecUL, 0xbb48f071UL, 0xde2f4cc9UL,
- 0x3080f9dbUL, 0x55e74563UL, 0x9ca03f6bUL, 0xf9c783d3UL, 0x176836c1UL,
- 0x720f8a79UL, 0xcb375de4UL, 0xae50e15cUL, 0x40ff544eUL, 0x2598e8f6UL,
- 0x73888baeUL, 0x16ef3716UL, 0xf8408204UL, 0x9d273ebcUL, 0x241fe921UL,
- 0x41785599UL, 0xafd7e08bUL, 0xcab05c33UL, 0x3bb659edUL, 0x5ed1e555UL,
- 0xb07e5047UL, 0xd519ecffUL, 0x6c213b62UL, 0x094687daUL, 0xe7e932c8UL,
- 0x828e8e70UL, 0xd49eed28UL, 0xb1f95190UL, 0x5f56e482UL, 0x3a31583aUL,
- 0x83098fa7UL, 0xe66e331fUL, 0x08c1860dUL, 0x6da63ab5UL, 0xa4e140bdUL,
- 0xc186fc05UL, 0x2f294917UL, 0x4a4ef5afUL, 0xf3762232UL, 0x96119e8aUL,
- 0x78be2b98UL, 0x1dd99720UL, 0x4bc9f478UL, 0x2eae48c0UL, 0xc001fdd2UL,
- 0xa566416aUL, 0x1c5e96f7UL, 0x79392a4fUL, 0x97969f5dUL, 0xf2f123e5UL,
- 0x05196b4dUL, 0x607ed7f5UL, 0x8ed162e7UL, 0xebb6de5fUL, 0x528e09c2UL,
- 0x37e9b57aUL, 0xd9460068UL, 0xbc21bcd0UL, 0xea31df88UL, 0x8f566330UL,
- 0x61f9d622UL, 0x049e6a9aUL, 0xbda6bd07UL, 0xd8c101bfUL, 0x366eb4adUL,
- 0x53090815UL, 0x9a4e721dUL, 0xff29cea5UL, 0x11867bb7UL, 0x74e1c70fUL,
- 0xcdd91092UL, 0xa8beac2aUL, 0x46111938UL, 0x2376a580UL, 0x7566c6d8UL,
- 0x10017a60UL, 0xfeaecf72UL, 0x9bc973caUL, 0x22f1a457UL, 0x479618efUL,
- 0xa939adfdUL, 0xcc5e1145UL, 0x06ee4d76UL, 0x6389f1ceUL, 0x8d2644dcUL,
- 0xe841f864UL, 0x51792ff9UL, 0x341e9341UL, 0xdab12653UL, 0xbfd69aebUL,
- 0xe9c6f9b3UL, 0x8ca1450bUL, 0x620ef019UL, 0x07694ca1UL, 0xbe519b3cUL,
- 0xdb362784UL, 0x35999296UL, 0x50fe2e2eUL, 0x99b95426UL, 0xfcdee89eUL,
- 0x12715d8cUL, 0x7716e134UL, 0xce2e36a9UL, 0xab498a11UL, 0x45e63f03UL,
- 0x208183bbUL, 0x7691e0e3UL, 0x13f65c5bUL, 0xfd59e949UL, 0x983e55f1UL,
- 0x2106826cUL, 0x44613ed4UL, 0xaace8bc6UL, 0xcfa9377eUL, 0x38417fd6UL,
- 0x5d26c36eUL, 0xb389767cUL, 0xd6eecac4UL, 0x6fd61d59UL, 0x0ab1a1e1UL,
- 0xe41e14f3UL, 0x8179a84bUL, 0xd769cb13UL, 0xb20e77abUL, 0x5ca1c2b9UL,
- 0x39c67e01UL, 0x80fea99cUL, 0xe5991524UL, 0x0b36a036UL, 0x6e511c8eUL,
- 0xa7166686UL, 0xc271da3eUL, 0x2cde6f2cUL, 0x49b9d394UL, 0xf0810409UL,
- 0x95e6b8b1UL, 0x7b490da3UL, 0x1e2eb11bUL, 0x483ed243UL, 0x2d596efbUL,
- 0xc3f6dbe9UL, 0xa6916751UL, 0x1fa9b0ccUL, 0x7ace0c74UL, 0x9461b966UL,
- 0xf10605deUL
-#endif
- }
-};
diff --git a/sdk-modifications/libsrc/zlib/deflate.c b/sdk-modifications/libsrc/zlib/deflate.c
deleted file mode 100755
index 8bd480e..0000000
--- a/sdk-modifications/libsrc/zlib/deflate.c
+++ /dev/null
@@ -1,1965 +0,0 @@
-/* deflate.c -- compress data using the deflation algorithm
- * Copyright (C) 1995-2012 Jean-loup Gailly and Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/*
- * ALGORITHM
- *
- * The "deflation" process depends on being able to identify portions
- * of the input text which are identical to earlier input (within a
- * sliding window trailing behind the input currently being processed).
- *
- * The most straightforward technique turns out to be the fastest for
- * most input files: try all possible matches and select the longest.
- * The key feature of this algorithm is that insertions into the string
- * dictionary are very simple and thus fast, and deletions are avoided
- * completely. Insertions are performed at each input character, whereas
- * string matches are performed only when the previous match ends. So it
- * is preferable to spend more time in matches to allow very fast string
- * insertions and avoid deletions. The matching algorithm for small
- * strings is inspired from that of Rabin & Karp. A brute force approach
- * is used to find longer strings when a small match has been found.
- * A similar algorithm is used in comic (by Jan-Mark Wams) and freeze
- * (by Leonid Broukhis).
- * A previous version of this file used a more sophisticated algorithm
- * (by Fiala and Greene) which is guaranteed to run in linear amortized
- * time, but has a larger average cost, uses more memory and is patented.
- * However the F&G algorithm may be faster for some highly redundant
- * files if the parameter max_chain_length (described below) is too large.
- *
- * ACKNOWLEDGEMENTS
- *
- * The idea of lazy evaluation of matches is due to Jan-Mark Wams, and
- * I found it in 'freeze' written by Leonid Broukhis.
- * Thanks to many people for bug reports and testing.
- *
- * REFERENCES
- *
- * Deutsch, L.P.,"DEFLATE Compressed Data Format Specification".
- * Available in http://tools.ietf.org/html/rfc1951
- *
- * A description of the Rabin and Karp algorithm is given in the book
- * "Algorithms" by R. Sedgewick, Addison-Wesley, p252.
- *
- * Fiala,E.R., and Greene,D.H.
- * Data Compression with Finite Windows, Comm.ACM, 32,4 (1989) 490-595
- *
- */
-
-/* @(#) $Id$ */
-
-#include "deflate.h"
-
-const char deflate_copyright[] =
- " deflate 1.2.6 Copyright 1995-2012 Jean-loup Gailly and Mark Adler ";
-/*
- If you use the zlib library in a product, an acknowledgment is welcome
- in the documentation of your product. If for some reason you cannot
- include such an acknowledgment, I would appreciate that you keep this
- copyright string in the executable of your product.
- */
-
-/* ===========================================================================
- * Function prototypes.
- */
-typedef enum {
- need_more, /* block not completed, need more input or more output */
- block_done, /* block flush performed */
- finish_started, /* finish started, need only more output at next deflate */
- finish_done /* finish done, accept no more input or output */
-} block_state;
-
-typedef block_state (*compress_func) OF((deflate_state *s, int flush));
-/* Compression function. Returns the block state after the call. */
-
-local void fill_window OF((deflate_state *s));
-local block_state deflate_stored OF((deflate_state *s, int flush));
-local block_state deflate_fast OF((deflate_state *s, int flush));
-#ifndef FASTEST
-local block_state deflate_slow OF((deflate_state *s, int flush));
-#endif
-local block_state deflate_rle OF((deflate_state *s, int flush));
-local block_state deflate_huff OF((deflate_state *s, int flush));
-local void lm_init OF((deflate_state *s));
-local void putShortMSB OF((deflate_state *s, uInt b));
-local void flush_pending OF((z_streamp strm));
-local int read_buf OF((z_streamp strm, Bytef *buf, unsigned size));
-#ifdef ASMV
- void match_init OF((void)); /* asm code initialization */
- uInt longest_match OF((deflate_state *s, IPos cur_match));
-#else
-local uInt longest_match OF((deflate_state *s, IPos cur_match));
-#endif
-
-#ifdef DEBUG
-local void check_match OF((deflate_state *s, IPos start, IPos match,
- int length));
-#endif
-
-/* ===========================================================================
- * Local data
- */
-
-#define NIL 0
-/* Tail of hash chains */
-
-#ifndef TOO_FAR
-# define TOO_FAR 4096
-#endif
-/* Matches of length 3 are discarded if their distance exceeds TOO_FAR */
-
-/* Values for max_lazy_match, good_match and max_chain_length, depending on
- * the desired pack level (0..9). The values given below have been tuned to
- * exclude worst case performance for pathological files. Better values may be
- * found for specific files.
- */
-typedef struct config_s {
- ush good_length; /* reduce lazy search above this match length */
- ush max_lazy; /* do not perform lazy search above this match length */
- ush nice_length; /* quit search above this match length */
- ush max_chain;
- compress_func func;
-} config;
-
-#ifdef FASTEST
-local const config configuration_table[2] = {
-/* good lazy nice chain */
-/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */
-/* 1 */ {4, 4, 8, 4, deflate_fast}}; /* max speed, no lazy matches */
-#else
-local const config configuration_table[10] = {
-/* good lazy nice chain */
-/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */
-/* 1 */ {4, 4, 8, 4, deflate_fast}, /* max speed, no lazy matches */
-/* 2 */ {4, 5, 16, 8, deflate_fast},
-/* 3 */ {4, 6, 32, 32, deflate_fast},
-
-/* 4 */ {4, 4, 16, 16, deflate_slow}, /* lazy matches */
-/* 5 */ {8, 16, 32, 32, deflate_slow},
-/* 6 */ {8, 16, 128, 128, deflate_slow},
-/* 7 */ {8, 32, 128, 256, deflate_slow},
-/* 8 */ {32, 128, 258, 1024, deflate_slow},
-/* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* max compression */
-#endif
-
-/* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4
- * For deflate_fast() (levels <= 3) good is ignored and lazy has a different
- * meaning.
- */
-
-#define EQUAL 0
-/* result of memcmp for equal strings */
-
-#ifndef NO_DUMMY_DECL
-struct static_tree_desc_s {int dummy;}; /* for buggy compilers */
-#endif
-
-/* rank Z_BLOCK between Z_NO_FLUSH and Z_PARTIAL_FLUSH */
-#define RANK(f) (((f) << 1) - ((f) > 4 ? 9 : 0))
-
-/* ===========================================================================
- * Update a hash value with the given input byte
- * IN assertion: all calls to to UPDATE_HASH are made with consecutive
- * input characters, so that a running hash key can be computed from the
- * previous key instead of complete recalculation each time.
- */
-#define UPDATE_HASH(s,h,c) (h = (((h)<<s->hash_shift) ^ (c)) & s->hash_mask)
-
-
-/* ===========================================================================
- * Insert string str in the dictionary and set match_head to the previous head
- * of the hash chain (the most recent string with same hash key). Return
- * the previous length of the hash chain.
- * If this file is compiled with -DFASTEST, the compression level is forced
- * to 1, and no hash chains are maintained.
- * IN assertion: all calls to to INSERT_STRING are made with consecutive
- * input characters and the first MIN_MATCH bytes of str are valid
- * (except for the last MIN_MATCH-1 bytes of the input file).
- */
-#ifdef FASTEST
-#define INSERT_STRING(s, str, match_head) \
- (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
- match_head = s->head[s->ins_h], \
- s->head[s->ins_h] = (Pos)(str))
-#else
-#define INSERT_STRING(s, str, match_head) \
- (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \
- match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \
- s->head[s->ins_h] = (Pos)(str))
-#endif
-
-/* ===========================================================================
- * Initialize the hash table (avoiding 64K overflow for 16 bit systems).
- * prev[] will be initialized on the fly.
- */
-#define CLEAR_HASH(s) \
- s->head[s->hash_size-1] = NIL; \
- zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head));
-
-/* ========================================================================= */
-int ZEXPORT deflateInit_(strm, level, version, stream_size)
- z_streamp strm;
- int level;
- const char *version;
- int stream_size;
-{
- return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL,
- Z_DEFAULT_STRATEGY, version, stream_size);
- /* To do: ignore strm->next_in if we use it as window */
-}
-
-/* ========================================================================= */
-int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
- version, stream_size)
- z_streamp strm;
- int level;
- int method;
- int windowBits;
- int memLevel;
- int strategy;
- const char *version;
- int stream_size;
-{
- deflate_state *s;
- int wrap = 1;
- static const char my_version[] = ZLIB_VERSION;
-
- ushf *overlay;
- /* We overlay pending_buf and d_buf+l_buf. This works since the average
- * output size for (length,distance) codes is <= 24 bits.
- */
-
- if (version == Z_NULL || version[0] != my_version[0] ||
- stream_size != sizeof(z_stream)) {
- return Z_VERSION_ERROR;
- }
- if (strm == Z_NULL) return Z_STREAM_ERROR;
-
- strm->msg = Z_NULL;
- if (strm->zalloc == (alloc_func)0) {
-#ifdef Z_SOLO
- return Z_STREAM_ERROR;
-#else
- strm->zalloc = zcalloc;
- strm->opaque = (voidpf)0;
-#endif
- }
- if (strm->zfree == (free_func)0)
-#ifdef Z_SOLO
- return Z_STREAM_ERROR;
-#else
- strm->zfree = zcfree;
-#endif
-
-#ifdef FASTEST
- if (level != 0) level = 1;
-#else
- if (level == Z_DEFAULT_COMPRESSION) level = 6;
-#endif
-
- if (windowBits < 0) { /* suppress zlib wrapper */
- wrap = 0;
- windowBits = -windowBits;
- }
-#ifdef GZIP
- else if (windowBits > 15) {
- wrap = 2; /* write gzip wrapper instead */
- windowBits -= 16;
- }
-#endif
- if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED ||
- windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||
- strategy < 0 || strategy > Z_FIXED) {
- return Z_STREAM_ERROR;
- }
- if (windowBits == 8) windowBits = 9; /* until 256-byte window bug fixed */
- s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state));
- if (s == Z_NULL) return Z_MEM_ERROR;
- strm->state = (struct internal_state FAR *)s;
- s->strm = strm;
-
- s->wrap = wrap;
- s->gzhead = Z_NULL;
- s->w_bits = windowBits;
- s->w_size = 1 << s->w_bits;
- s->w_mask = s->w_size - 1;
-
- s->hash_bits = memLevel + 7;
- s->hash_size = 1 << s->hash_bits;
- s->hash_mask = s->hash_size - 1;
- s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH);
-
- s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte));
- s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos));
- s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos));
-
- s->high_water = 0; /* nothing written to s->window yet */
-
- s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */
-
- overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);
- s->pending_buf = (uchf *) overlay;
- s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L);
-
- if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
- s->pending_buf == Z_NULL) {
- s->status = FINISH_STATE;
- strm->msg = (char*)ERR_MSG(Z_MEM_ERROR);
- deflateEnd (strm);
- return Z_MEM_ERROR;
- }
- s->d_buf = overlay + s->lit_bufsize/sizeof(ush);
- s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize;
-
- s->level = level;
- s->strategy = strategy;
- s->method = (Byte)method;
-
- return deflateReset(strm);
-}
-
-/* ========================================================================= */
-int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
- z_streamp strm;
- const Bytef *dictionary;
- uInt dictLength;
-{
- deflate_state *s;
- uInt str, n;
- int wrap;
- unsigned avail;
- unsigned char *next;
-
- if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL)
- return Z_STREAM_ERROR;
- s = strm->state;
- wrap = s->wrap;
- if (wrap == 2 || (wrap == 1 && s->status != INIT_STATE) || s->lookahead)
- return Z_STREAM_ERROR;
-
- /* when using zlib wrappers, compute Adler-32 for provided dictionary */
- if (wrap == 1)
- strm->adler = adler32(strm->adler, dictionary, dictLength);
- s->wrap = 0; /* avoid computing Adler-32 in read_buf */
-
- /* if dictionary would fill window, just replace the history */
- if (dictLength >= s->w_size) {
- if (wrap == 0) { /* already empty otherwise */
- CLEAR_HASH(s);
- s->strstart = 0;
- s->block_start = 0L;
- s->insert = 0;
- }
- dictionary += dictLength - s->w_size; /* use the tail */
- dictLength = s->w_size;
- }
-
- /* insert dictionary into window and hash */
- avail = strm->avail_in;
- next = strm->next_in;
- strm->avail_in = dictLength;
- strm->next_in = (Bytef *)dictionary;
- fill_window(s);
- while (s->lookahead >= MIN_MATCH) {
- str = s->strstart;
- n = s->lookahead - (MIN_MATCH-1);
- do {
- UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]);
-#ifndef FASTEST
- s->prev[str & s->w_mask] = s->head[s->ins_h];
-#endif
- s->head[s->ins_h] = (Pos)str;
- str++;
- } while (--n);
- s->strstart = str;
- s->lookahead = MIN_MATCH-1;
- fill_window(s);
- }
- s->strstart += s->lookahead;
- s->block_start = (long)s->strstart;
- s->insert = s->lookahead;
- s->lookahead = 0;
- s->match_length = s->prev_length = MIN_MATCH-1;
- s->match_available = 0;
- strm->next_in = next;
- strm->avail_in = avail;
- s->wrap = wrap;
- return Z_OK;
-}
-
-/* ========================================================================= */
-int ZEXPORT deflateResetKeep (strm)
- z_streamp strm;
-{
- deflate_state *s;
-
- if (strm == Z_NULL || strm->state == Z_NULL ||
- strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) {
- return Z_STREAM_ERROR;
- }
-
- strm->total_in = strm->total_out = 0;
- strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */
- strm->data_type = Z_UNKNOWN;
-
- s = (deflate_state *)strm->state;
- s->pending = 0;
- s->pending_out = s->pending_buf;
-
- if (s->wrap < 0) {
- s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */
- }
- s->status = s->wrap ? INIT_STATE : BUSY_STATE;
- strm->adler =
-#ifdef GZIP
- s->wrap == 2 ? crc32(0L, Z_NULL, 0) :
-#endif
- adler32(0L, Z_NULL, 0);
- s->last_flush = Z_NO_FLUSH;
-
- _tr_init(s);
-
- return Z_OK;
-}
-
-/* ========================================================================= */
-int ZEXPORT deflateReset (strm)
- z_streamp strm;
-{
- int ret;
-
- ret = deflateResetKeep(strm);
- if (ret == Z_OK)
- lm_init(strm->state);
- return ret;
-}
-
-/* ========================================================================= */
-int ZEXPORT deflateSetHeader (strm, head)
- z_streamp strm;
- gz_headerp head;
-{
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- if (strm->state->wrap != 2) return Z_STREAM_ERROR;
- strm->state->gzhead = head;
- return Z_OK;
-}
-
-/* ========================================================================= */
-int ZEXPORT deflatePending (strm, pending, bits)
- unsigned *pending;
- int *bits;
- z_streamp strm;
-{
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- if (pending != Z_NULL)
- *pending = strm->state->pending;
- if (bits != Z_NULL)
- *bits = strm->state->bi_valid;
- return Z_OK;
-}
-
-/* ========================================================================= */
-int ZEXPORT deflatePrime (strm, bits, value)
- z_streamp strm;
- int bits;
- int value;
-{
- deflate_state *s;
- int put;
-
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- s = strm->state;
- if ((Bytef *)(s->d_buf) < s->pending_out + ((Buf_size + 7) >> 3))
- return Z_BUF_ERROR;
- do {
- put = Buf_size - s->bi_valid;
- if (put > bits)
- put = bits;
- s->bi_buf |= (ush)((value & ((1 << put) - 1)) << s->bi_valid);
- s->bi_valid += put;
- _tr_flush_bits(s);
- value >>= put;
- bits -= put;
- } while (bits);
- return Z_OK;
-}
-
-/* ========================================================================= */
-int ZEXPORT deflateParams(strm, level, strategy)
- z_streamp strm;
- int level;
- int strategy;
-{
- deflate_state *s;
- compress_func func;
- int err = Z_OK;
-
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- s = strm->state;
-
-#ifdef FASTEST
- if (level != 0) level = 1;
-#else
- if (level == Z_DEFAULT_COMPRESSION) level = 6;
-#endif
- if (level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) {
- return Z_STREAM_ERROR;
- }
- func = configuration_table[s->level].func;
-
- if ((strategy != s->strategy || func != configuration_table[level].func) &&
- strm->total_in != 0) {
- /* Flush the last buffer: */
- err = deflate(strm, Z_BLOCK);
- }
- if (s->level != level) {
- s->level = level;
- s->max_lazy_match = configuration_table[level].max_lazy;
- s->good_match = configuration_table[level].good_length;
- s->nice_match = configuration_table[level].nice_length;
- s->max_chain_length = configuration_table[level].max_chain;
- }
- s->strategy = strategy;
- return err;
-}
-
-/* ========================================================================= */
-int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain)
- z_streamp strm;
- int good_length;
- int max_lazy;
- int nice_length;
- int max_chain;
-{
- deflate_state *s;
-
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- s = strm->state;
- s->good_match = good_length;
- s->max_lazy_match = max_lazy;
- s->nice_match = nice_length;
- s->max_chain_length = max_chain;
- return Z_OK;
-}
-
-/* =========================================================================
- * For the default windowBits of 15 and memLevel of 8, this function returns
- * a close to exact, as well as small, upper bound on the compressed size.
- * They are coded as constants here for a reason--if the #define's are
- * changed, then this function needs to be changed as well. The return
- * value for 15 and 8 only works for those exact settings.
- *
- * For any setting other than those defaults for windowBits and memLevel,
- * the value returned is a conservative worst case for the maximum expansion
- * resulting from using fixed blocks instead of stored blocks, which deflate
- * can emit on compressed data for some combinations of the parameters.
- *
- * This function could be more sophisticated to provide closer upper bounds for
- * every combination of windowBits and memLevel. But even the conservative
- * upper bound of about 14% expansion does not seem onerous for output buffer
- * allocation.
- */
-uLong ZEXPORT deflateBound(strm, sourceLen)
- z_streamp strm;
- uLong sourceLen;
-{
- deflate_state *s;
- uLong complen, wraplen;
- Bytef *str;
-
- /* conservative upper bound for compressed data */
- complen = sourceLen +
- ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 5;
-
- /* if can't get parameters, return conservative bound plus zlib wrapper */
- if (strm == Z_NULL || strm->state == Z_NULL)
- return complen + 6;
-
- /* compute wrapper length */
- s = strm->state;
- switch (s->wrap) {
- case 0: /* raw deflate */
- wraplen = 0;
- break;
- case 1: /* zlib wrapper */
- wraplen = 6 + (s->strstart ? 4 : 0);
- break;
- case 2: /* gzip wrapper */
- wraplen = 18;
- if (s->gzhead != Z_NULL) { /* user-supplied gzip header */
- if (s->gzhead->extra != Z_NULL)
- wraplen += 2 + s->gzhead->extra_len;
- str = s->gzhead->name;
- if (str != Z_NULL)
- do {
- wraplen++;
- } while (*str++);
- str = s->gzhead->comment;
- if (str != Z_NULL)
- do {
- wraplen++;
- } while (*str++);
- if (s->gzhead->hcrc)
- wraplen += 2;
- }
- break;
- default: /* for compiler happiness */
- wraplen = 6;
- }
-
- /* if not default parameters, return conservative bound */
- if (s->w_bits != 15 || s->hash_bits != 8 + 7)
- return complen + wraplen;
-
- /* default settings: return tight bound for that case */
- return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
- (sourceLen >> 25) + 13 - 6 + wraplen;
-}
-
-/* =========================================================================
- * Put a short in the pending buffer. The 16-bit value is put in MSB order.
- * IN assertion: the stream state is correct and there is enough room in
- * pending_buf.
- */
-local void putShortMSB (s, b)
- deflate_state *s;
- uInt b;
-{
- put_byte(s, (Byte)(b >> 8));
- put_byte(s, (Byte)(b & 0xff));
-}
-
-/* =========================================================================
- * Flush as much pending output as possible. All deflate() output goes
- * through this function so some applications may wish to modify it
- * to avoid allocating a large strm->next_out buffer and copying into it.
- * (See also read_buf()).
- */
-local void flush_pending(strm)
- z_streamp strm;
-{
- unsigned len;
- deflate_state *s = strm->state;
-
- _tr_flush_bits(s);
- len = s->pending;
- if (len > strm->avail_out) len = strm->avail_out;
- if (len == 0) return;
-
- zmemcpy(strm->next_out, s->pending_out, len);
- strm->next_out += len;
- s->pending_out += len;
- strm->total_out += len;
- strm->avail_out -= len;
- s->pending -= len;
- if (s->pending == 0) {
- s->pending_out = s->pending_buf;
- }
-}
-
-/* ========================================================================= */
-int ZEXPORT deflate (strm, flush)
- z_streamp strm;
- int flush;
-{
- int old_flush; /* value of flush param for previous deflate call */
- deflate_state *s;
-
- if (strm == Z_NULL || strm->state == Z_NULL ||
- flush > Z_BLOCK || flush < 0) {
- return Z_STREAM_ERROR;
- }
- s = strm->state;
-
- if (strm->next_out == Z_NULL ||
- (strm->next_in == Z_NULL && strm->avail_in != 0) ||
- (s->status == FINISH_STATE && flush != Z_FINISH)) {
- ERR_RETURN(strm, Z_STREAM_ERROR);
- }
- if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR);
-
- s->strm = strm; /* just in case */
- old_flush = s->last_flush;
- s->last_flush = flush;
-
- /* Write the header */
- if (s->status == INIT_STATE) {
-#ifdef GZIP
- if (s->wrap == 2) {
- strm->adler = crc32(0L, Z_NULL, 0);
- put_byte(s, 31);
- put_byte(s, 139);
- put_byte(s, 8);
- if (s->gzhead == Z_NULL) {
- put_byte(s, 0);
- put_byte(s, 0);
- put_byte(s, 0);
- put_byte(s, 0);
- put_byte(s, 0);
- put_byte(s, s->level == 9 ? 2 :
- (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ?
- 4 : 0));
- put_byte(s, OS_CODE);
- s->status = BUSY_STATE;
- }
- else {
- put_byte(s, (s->gzhead->text ? 1 : 0) +
- (s->gzhead->hcrc ? 2 : 0) +
- (s->gzhead->extra == Z_NULL ? 0 : 4) +
- (s->gzhead->name == Z_NULL ? 0 : 8) +
- (s->gzhead->comment == Z_NULL ? 0 : 16)
- );
- put_byte(s, (Byte)(s->gzhead->time & 0xff));
- put_byte(s, (Byte)((s->gzhead->time >> 8) & 0xff));
- put_byte(s, (Byte)((s->gzhead->time >> 16) & 0xff));
- put_byte(s, (Byte)((s->gzhead->time >> 24) & 0xff));
- put_byte(s, s->level == 9 ? 2 :
- (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ?
- 4 : 0));
- put_byte(s, s->gzhead->os & 0xff);
- if (s->gzhead->extra != Z_NULL) {
- put_byte(s, s->gzhead->extra_len & 0xff);
- put_byte(s, (s->gzhead->extra_len >> 8) & 0xff);
- }
- if (s->gzhead->hcrc)
- strm->adler = crc32(strm->adler, s->pending_buf,
- s->pending);
- s->gzindex = 0;
- s->status = EXTRA_STATE;
- }
- }
- else
-#endif
- {
- uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8;
- uInt level_flags;
-
- if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2)
- level_flags = 0;
- else if (s->level < 6)
- level_flags = 1;
- else if (s->level == 6)
- level_flags = 2;
- else
- level_flags = 3;
- header |= (level_flags << 6);
- if (s->strstart != 0) header |= PRESET_DICT;
- header += 31 - (header % 31);
-
- s->status = BUSY_STATE;
- putShortMSB(s, header);
-
- /* Save the adler32 of the preset dictionary: */
- if (s->strstart != 0) {
- putShortMSB(s, (uInt)(strm->adler >> 16));
- putShortMSB(s, (uInt)(strm->adler & 0xffff));
- }
- strm->adler = adler32(0L, Z_NULL, 0);
- }
- }
-#ifdef GZIP
- if (s->status == EXTRA_STATE) {
- if (s->gzhead->extra != Z_NULL) {
- uInt beg = s->pending; /* start of bytes to update crc */
-
- while (s->gzindex < (s->gzhead->extra_len & 0xffff)) {
- if (s->pending == s->pending_buf_size) {
- if (s->gzhead->hcrc && s->pending > beg)
- strm->adler = crc32(strm->adler, s->pending_buf + beg,
- s->pending - beg);
- flush_pending(strm);
- beg = s->pending;
- if (s->pending == s->pending_buf_size)
- break;
- }
- put_byte(s, s->gzhead->extra[s->gzindex]);
- s->gzindex++;
- }
- if (s->gzhead->hcrc && s->pending > beg)
- strm->adler = crc32(strm->adler, s->pending_buf + beg,
- s->pending - beg);
- if (s->gzindex == s->gzhead->extra_len) {
- s->gzindex = 0;
- s->status = NAME_STATE;
- }
- }
- else
- s->status = NAME_STATE;
- }
- if (s->status == NAME_STATE) {
- if (s->gzhead->name != Z_NULL) {
- uInt beg = s->pending; /* start of bytes to update crc */
- int val;
-
- do {
- if (s->pending == s->pending_buf_size) {
- if (s->gzhead->hcrc && s->pending > beg)
- strm->adler = crc32(strm->adler, s->pending_buf + beg,
- s->pending - beg);
- flush_pending(strm);
- beg = s->pending;
- if (s->pending == s->pending_buf_size) {
- val = 1;
- break;
- }
- }
- val = s->gzhead->name[s->gzindex++];
- put_byte(s, val);
- } while (val != 0);
- if (s->gzhead->hcrc && s->pending > beg)
- strm->adler = crc32(strm->adler, s->pending_buf + beg,
- s->pending - beg);
- if (val == 0) {
- s->gzindex = 0;
- s->status = COMMENT_STATE;
- }
- }
- else
- s->status = COMMENT_STATE;
- }
- if (s->status == COMMENT_STATE) {
- if (s->gzhead->comment != Z_NULL) {
- uInt beg = s->pending; /* start of bytes to update crc */
- int val;
-
- do {
- if (s->pending == s->pending_buf_size) {
- if (s->gzhead->hcrc && s->pending > beg)
- strm->adler = crc32(strm->adler, s->pending_buf + beg,
- s->pending - beg);
- flush_pending(strm);
- beg = s->pending;
- if (s->pending == s->pending_buf_size) {
- val = 1;
- break;
- }
- }
- val = s->gzhead->comment[s->gzindex++];
- put_byte(s, val);
- } while (val != 0);
- if (s->gzhead->hcrc && s->pending > beg)
- strm->adler = crc32(strm->adler, s->pending_buf + beg,
- s->pending - beg);
- if (val == 0)
- s->status = HCRC_STATE;
- }
- else
- s->status = HCRC_STATE;
- }
- if (s->status == HCRC_STATE) {
- if (s->gzhead->hcrc) {
- if (s->pending + 2 > s->pending_buf_size)
- flush_pending(strm);
- if (s->pending + 2 <= s->pending_buf_size) {
- put_byte(s, (Byte)(strm->adler & 0xff));
- put_byte(s, (Byte)((strm->adler >> 8) & 0xff));
- strm->adler = crc32(0L, Z_NULL, 0);
- s->status = BUSY_STATE;
- }
- }
- else
- s->status = BUSY_STATE;
- }
-#endif
-
- /* Flush as much pending output as possible */
- if (s->pending != 0) {
- flush_pending(strm);
- if (strm->avail_out == 0) {
- /* Since avail_out is 0, deflate will be called again with
- * more output space, but possibly with both pending and
- * avail_in equal to zero. There won't be anything to do,
- * but this is not an error situation so make sure we
- * return OK instead of BUF_ERROR at next call of deflate:
- */
- s->last_flush = -1;
- return Z_OK;
- }
-
- /* Make sure there is something to do and avoid duplicate consecutive
- * flushes. For repeated and useless calls with Z_FINISH, we keep
- * returning Z_STREAM_END instead of Z_BUF_ERROR.
- */
- } else if (strm->avail_in == 0 && RANK(flush) <= RANK(old_flush) &&
- flush != Z_FINISH) {
- ERR_RETURN(strm, Z_BUF_ERROR);
- }
-
- /* User must not provide more input after the first FINISH: */
- if (s->status == FINISH_STATE && strm->avail_in != 0) {
- ERR_RETURN(strm, Z_BUF_ERROR);
- }
-
- /* Start a new block or continue the current one.
- */
- if (strm->avail_in != 0 || s->lookahead != 0 ||
- (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) {
- block_state bstate;
-
- bstate = s->strategy == Z_HUFFMAN_ONLY ? deflate_huff(s, flush) :
- (s->strategy == Z_RLE ? deflate_rle(s, flush) :
- (*(configuration_table[s->level].func))(s, flush));
-
- if (bstate == finish_started || bstate == finish_done) {
- s->status = FINISH_STATE;
- }
- if (bstate == need_more || bstate == finish_started) {
- if (strm->avail_out == 0) {
- s->last_flush = -1; /* avoid BUF_ERROR next call, see above */
- }
- return Z_OK;
- /* If flush != Z_NO_FLUSH && avail_out == 0, the next call
- * of deflate should use the same flush parameter to make sure
- * that the flush is complete. So we don't have to output an
- * empty block here, this will be done at next call. This also
- * ensures that for a very small output buffer, we emit at most
- * one empty block.
- */
- }
- if (bstate == block_done) {
- if (flush == Z_PARTIAL_FLUSH) {
- _tr_align(s);
- } else if (flush != Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */
- _tr_stored_block(s, (char*)0, 0L, 0);
- /* For a full flush, this empty block will be recognized
- * as a special marker by inflate_sync().
- */
- if (flush == Z_FULL_FLUSH) {
- CLEAR_HASH(s); /* forget history */
- if (s->lookahead == 0) {
- s->strstart = 0;
- s->block_start = 0L;
- s->insert = 0;
- }
- }
- }
- flush_pending(strm);
- if (strm->avail_out == 0) {
- s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */
- return Z_OK;
- }
- }
- }
- Assert(strm->avail_out > 0, "bug2");
-
- if (flush != Z_FINISH) return Z_OK;
- if (s->wrap <= 0) return Z_STREAM_END;
-
- /* Write the trailer */
-#ifdef GZIP
- if (s->wrap == 2) {
- put_byte(s, (Byte)(strm->adler & 0xff));
- put_byte(s, (Byte)((strm->adler >> 8) & 0xff));
- put_byte(s, (Byte)((strm->adler >> 16) & 0xff));
- put_byte(s, (Byte)((strm->adler >> 24) & 0xff));
- put_byte(s, (Byte)(strm->total_in & 0xff));
- put_byte(s, (Byte)((strm->total_in >> 8) & 0xff));
- put_byte(s, (Byte)((strm->total_in >> 16) & 0xff));
- put_byte(s, (Byte)((strm->total_in >> 24) & 0xff));
- }
- else
-#endif
- {
- putShortMSB(s, (uInt)(strm->adler >> 16));
- putShortMSB(s, (uInt)(strm->adler & 0xffff));
- }
- flush_pending(strm);
- /* If avail_out is zero, the application will call deflate again
- * to flush the rest.
- */
- if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */
- return s->pending != 0 ? Z_OK : Z_STREAM_END;
-}
-
-/* ========================================================================= */
-int ZEXPORT deflateEnd (strm)
- z_streamp strm;
-{
- int status;
-
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
-
- status = strm->state->status;
- if (status != INIT_STATE &&
- status != EXTRA_STATE &&
- status != NAME_STATE &&
- status != COMMENT_STATE &&
- status != HCRC_STATE &&
- status != BUSY_STATE &&
- status != FINISH_STATE) {
- return Z_STREAM_ERROR;
- }
-
- /* Deallocate in reverse order of allocations: */
- TRY_FREE(strm, strm->state->pending_buf);
- TRY_FREE(strm, strm->state->head);
- TRY_FREE(strm, strm->state->prev);
- TRY_FREE(strm, strm->state->window);
-
- ZFREE(strm, strm->state);
- strm->state = Z_NULL;
-
- return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK;
-}
-
-/* =========================================================================
- * Copy the source state to the destination state.
- * To simplify the source, this is not supported for 16-bit MSDOS (which
- * doesn't have enough memory anyway to duplicate compression states).
- */
-int ZEXPORT deflateCopy (dest, source)
- z_streamp dest;
- z_streamp source;
-{
-#ifdef MAXSEG_64K
- return Z_STREAM_ERROR;
-#else
- deflate_state *ds;
- deflate_state *ss;
- ushf *overlay;
-
-
- if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) {
- return Z_STREAM_ERROR;
- }
-
- ss = source->state;
-
- zmemcpy((voidpf)dest, (voidpf)source, sizeof(z_stream));
-
- ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state));
- if (ds == Z_NULL) return Z_MEM_ERROR;
- dest->state = (struct internal_state FAR *) ds;
- zmemcpy((voidpf)ds, (voidpf)ss, sizeof(deflate_state));
- ds->strm = dest;
-
- ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte));
- ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos));
- ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos));
- overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2);
- ds->pending_buf = (uchf *) overlay;
-
- if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL ||
- ds->pending_buf == Z_NULL) {
- deflateEnd (dest);
- return Z_MEM_ERROR;
- }
- /* following zmemcpy do not work for 16-bit MSDOS */
- zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte));
- zmemcpy((voidpf)ds->prev, (voidpf)ss->prev, ds->w_size * sizeof(Pos));
- zmemcpy((voidpf)ds->head, (voidpf)ss->head, ds->hash_size * sizeof(Pos));
- zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size);
-
- ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);
- ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush);
- ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize;
-
- ds->l_desc.dyn_tree = ds->dyn_ltree;
- ds->d_desc.dyn_tree = ds->dyn_dtree;
- ds->bl_desc.dyn_tree = ds->bl_tree;
-
- return Z_OK;
-#endif /* MAXSEG_64K */
-}
-
-/* ===========================================================================
- * Read a new buffer from the current input stream, update the adler32
- * and total number of bytes read. All deflate() input goes through
- * this function so some applications may wish to modify it to avoid
- * allocating a large strm->next_in buffer and copying from it.
- * (See also flush_pending()).
- */
-local int read_buf(strm, buf, size)
- z_streamp strm;
- Bytef *buf;
- unsigned size;
-{
- unsigned len = strm->avail_in;
-
- if (len > size) len = size;
- if (len == 0) return 0;
-
- strm->avail_in -= len;
-
- zmemcpy(buf, strm->next_in, len);
- if (strm->state->wrap == 1) {
- strm->adler = adler32(strm->adler, buf, len);
- }
-#ifdef GZIP
- else if (strm->state->wrap == 2) {
- strm->adler = crc32(strm->adler, buf, len);
- }
-#endif
- strm->next_in += len;
- strm->total_in += len;
-
- return (int)len;
-}
-
-/* ===========================================================================
- * Initialize the "longest match" routines for a new zlib stream
- */
-local void lm_init (s)
- deflate_state *s;
-{
- s->window_size = (ulg)2L*s->w_size;
-
- CLEAR_HASH(s);
-
- /* Set the default configuration parameters:
- */
- s->max_lazy_match = configuration_table[s->level].max_lazy;
- s->good_match = configuration_table[s->level].good_length;
- s->nice_match = configuration_table[s->level].nice_length;
- s->max_chain_length = configuration_table[s->level].max_chain;
-
- s->strstart = 0;
- s->block_start = 0L;
- s->lookahead = 0;
- s->insert = 0;
- s->match_length = s->prev_length = MIN_MATCH-1;
- s->match_available = 0;
- s->ins_h = 0;
-#ifndef FASTEST
-#ifdef ASMV
- match_init(); /* initialize the asm code */
-#endif
-#endif
-}
-
-#ifndef FASTEST
-/* ===========================================================================
- * Set match_start to the longest match starting at the given string and
- * return its length. Matches shorter or equal to prev_length are discarded,
- * in which case the result is equal to prev_length and match_start is
- * garbage.
- * IN assertions: cur_match is the head of the hash chain for the current
- * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1
- * OUT assertion: the match length is not greater than s->lookahead.
- */
-#ifndef ASMV
-/* For 80x86 and 680x0, an optimized version will be provided in match.asm or
- * match.S. The code will be functionally equivalent.
- */
-local uInt longest_match(s, cur_match)
- deflate_state *s;
- IPos cur_match; /* current match */
-{
- unsigned chain_length = s->max_chain_length;/* max hash chain length */
- register Bytef *scan = s->window + s->strstart; /* current string */
- register Bytef *match; /* matched string */
- register int len; /* length of current match */
- int best_len = s->prev_length; /* best match length so far */
- int nice_match = s->nice_match; /* stop if match long enough */
- IPos limit = s->strstart > (IPos)MAX_DIST(s) ?
- s->strstart - (IPos)MAX_DIST(s) : NIL;
- /* Stop when cur_match becomes <= limit. To simplify the code,
- * we prevent matches with the string of window index 0.
- */
- Posf *prev = s->prev;
- uInt wmask = s->w_mask;
-
-#ifdef UNALIGNED_OK
- /* Compare two bytes at a time. Note: this is not always beneficial.
- * Try with and without -DUNALIGNED_OK to check.
- */
- register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1;
- register ush scan_start = *(ushf*)scan;
- register ush scan_end = *(ushf*)(scan+best_len-1);
-#else
- register Bytef *strend = s->window + s->strstart + MAX_MATCH;
- register Byte scan_end1 = scan[best_len-1];
- register Byte scan_end = scan[best_len];
-#endif
-
- /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
- * It is easy to get rid of this optimization if necessary.
- */
- Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
-
- /* Do not waste too much time if we already have a good match: */
- if (s->prev_length >= s->good_match) {
- chain_length >>= 2;
- }
- /* Do not look for matches beyond the end of the input. This is necessary
- * to make deflate deterministic.
- */
- if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;
-
- Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
-
- do {
- Assert(cur_match < s->strstart, "no future");
- match = s->window + cur_match;
-
- /* Skip to next match if the match length cannot increase
- * or if the match length is less than 2. Note that the checks below
- * for insufficient lookahead only occur occasionally for performance
- * reasons. Therefore uninitialized memory will be accessed, and
- * conditional jumps will be made that depend on those values.
- * However the length of the match is limited to the lookahead, so
- * the output of deflate is not affected by the uninitialized values.
- */
-#if (defined(UNALIGNED_OK) && MAX_MATCH == 258)
- /* This code assumes sizeof(unsigned short) == 2. Do not use
- * UNALIGNED_OK if your compiler uses a different size.
- */
- if (*(ushf*)(match+best_len-1) != scan_end ||
- *(ushf*)match != scan_start) continue;
-
- /* It is not necessary to compare scan[2] and match[2] since they are
- * always equal when the other bytes match, given that the hash keys
- * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at
- * strstart+3, +5, ... up to strstart+257. We check for insufficient
- * lookahead only every 4th comparison; the 128th check will be made
- * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is
- * necessary to put more guard bytes at the end of the window, or
- * to check more often for insufficient lookahead.
- */
- Assert(scan[2] == match[2], "scan[2]?");
- scan++, match++;
- do {
- } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
- *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
- *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
- *(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
- scan < strend);
- /* The funny "do {}" generates better code on most compilers */
-
- /* Here, scan <= window+strstart+257 */
- Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
- if (*scan == *match) scan++;
-
- len = (MAX_MATCH - 1) - (int)(strend-scan);
- scan = strend - (MAX_MATCH-1);
-
-#else /* UNALIGNED_OK */
-
- if (match[best_len] != scan_end ||
- match[best_len-1] != scan_end1 ||
- *match != *scan ||
- *++match != scan[1]) continue;
-
- /* The check at best_len-1 can be removed because it will be made
- * again later. (This heuristic is not always a win.)
- * It is not necessary to compare scan[2] and match[2] since they
- * are always equal when the other bytes match, given that
- * the hash keys are equal and that HASH_BITS >= 8.
- */
- scan += 2, match++;
- Assert(*scan == *match, "match[2]?");
-
- /* We check for insufficient lookahead only every 8th comparison;
- * the 256th check will be made at strstart+258.
- */
- do {
- } while (*++scan == *++match && *++scan == *++match &&
- *++scan == *++match && *++scan == *++match &&
- *++scan == *++match && *++scan == *++match &&
- *++scan == *++match && *++scan == *++match &&
- scan < strend);
-
- Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
-
- len = MAX_MATCH - (int)(strend - scan);
- scan = strend - MAX_MATCH;
-
-#endif /* UNALIGNED_OK */
-
- if (len > best_len) {
- s->match_start = cur_match;
- best_len = len;
- if (len >= nice_match) break;
-#ifdef UNALIGNED_OK
- scan_end = *(ushf*)(scan+best_len-1);
-#else
- scan_end1 = scan[best_len-1];
- scan_end = scan[best_len];
-#endif
- }
- } while ((cur_match = prev[cur_match & wmask]) > limit
- && --chain_length != 0);
-
- if ((uInt)best_len <= s->lookahead) return (uInt)best_len;
- return s->lookahead;
-}
-#endif /* ASMV */
-
-#else /* FASTEST */
-
-/* ---------------------------------------------------------------------------
- * Optimized version for FASTEST only
- */
-local uInt longest_match(s, cur_match)
- deflate_state *s;
- IPos cur_match; /* current match */
-{
- register Bytef *scan = s->window + s->strstart; /* current string */
- register Bytef *match; /* matched string */
- register int len; /* length of current match */
- register Bytef *strend = s->window + s->strstart + MAX_MATCH;
-
- /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
- * It is easy to get rid of this optimization if necessary.
- */
- Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
-
- Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
-
- Assert(cur_match < s->strstart, "no future");
-
- match = s->window + cur_match;
-
- /* Return failure if the match length is less than 2:
- */
- if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1;
-
- /* The check at best_len-1 can be removed because it will be made
- * again later. (This heuristic is not always a win.)
- * It is not necessary to compare scan[2] and match[2] since they
- * are always equal when the other bytes match, given that
- * the hash keys are equal and that HASH_BITS >= 8.
- */
- scan += 2, match += 2;
- Assert(*scan == *match, "match[2]?");
-
- /* We check for insufficient lookahead only every 8th comparison;
- * the 256th check will be made at strstart+258.
- */
- do {
- } while (*++scan == *++match && *++scan == *++match &&
- *++scan == *++match && *++scan == *++match &&
- *++scan == *++match && *++scan == *++match &&
- *++scan == *++match && *++scan == *++match &&
- scan < strend);
-
- Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
-
- len = MAX_MATCH - (int)(strend - scan);
-
- if (len < MIN_MATCH) return MIN_MATCH - 1;
-
- s->match_start = cur_match;
- return (uInt)len <= s->lookahead ? (uInt)len : s->lookahead;
-}
-
-#endif /* FASTEST */
-
-#ifdef DEBUG
-/* ===========================================================================
- * Check that the match at match_start is indeed a match.
- */
-local void check_match(s, start, match, length)
- deflate_state *s;
- IPos start, match;
- int length;
-{
- /* check that the match is indeed a match */
- if (zmemcmp(s->window + match,
- s->window + start, length) != EQUAL) {
- fprintf(stderr, " start %u, match %u, length %d\n",
- start, match, length);
- do {
- fprintf(stderr, "%c%c", s->window[match++], s->window[start++]);
- } while (--length != 0);
- z_error("invalid match");
- }
- if (z_verbose > 1) {
- fprintf(stderr,"\\[%d,%d]", start-match, length);
- do { putc(s->window[start++], stderr); } while (--length != 0);
- }
-}
-#else
-# define check_match(s, start, match, length)
-#endif /* DEBUG */
-
-/* ===========================================================================
- * Fill the window when the lookahead becomes insufficient.
- * Updates strstart and lookahead.
- *
- * IN assertion: lookahead < MIN_LOOKAHEAD
- * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD
- * At least one byte has been read, or avail_in == 0; reads are
- * performed for at least two bytes (required for the zip translate_eol
- * option -- not supported here).
- */
-local void fill_window(s)
- deflate_state *s;
-{
- register unsigned n, m;
- register Posf *p;
- unsigned more; /* Amount of free space at the end of the window. */
- uInt wsize = s->w_size;
-
- Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead");
-
- do {
- more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart);
-
- /* Deal with !@#$% 64K limit: */
- if (sizeof(int) <= 2) {
- if (more == 0 && s->strstart == 0 && s->lookahead == 0) {
- more = wsize;
-
- } else if (more == (unsigned)(-1)) {
- /* Very unlikely, but possible on 16 bit machine if
- * strstart == 0 && lookahead == 1 (input done a byte at time)
- */
- more--;
- }
- }
-
- /* If the window is almost full and there is insufficient lookahead,
- * move the upper half to the lower one to make room in the upper half.
- */
- if (s->strstart >= wsize+MAX_DIST(s)) {
-
- zmemcpy(s->window, s->window+wsize, (unsigned)wsize);
- s->match_start -= wsize;
- s->strstart -= wsize; /* we now have strstart >= MAX_DIST */
- s->block_start -= (long) wsize;
-
- /* Slide the hash table (could be avoided with 32 bit values
- at the expense of memory usage). We slide even when level == 0
- to keep the hash table consistent if we switch back to level > 0
- later. (Using level 0 permanently is not an optimal usage of
- zlib, so we don't care about this pathological case.)
- */
- n = s->hash_size;
- p = &s->head[n];
- do {
- m = *--p;
- *p = (Pos)(m >= wsize ? m-wsize : NIL);
- } while (--n);
-
- n = wsize;
-#ifndef FASTEST
- p = &s->prev[n];
- do {
- m = *--p;
- *p = (Pos)(m >= wsize ? m-wsize : NIL);
- /* If n is not on any hash chain, prev[n] is garbage but
- * its value will never be used.
- */
- } while (--n);
-#endif
- more += wsize;
- }
- if (s->strm->avail_in == 0) break;
-
- /* If there was no sliding:
- * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 &&
- * more == window_size - lookahead - strstart
- * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1)
- * => more >= window_size - 2*WSIZE + 2
- * In the BIG_MEM or MMAP case (not yet supported),
- * window_size == input_size + MIN_LOOKAHEAD &&
- * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD.
- * Otherwise, window_size == 2*WSIZE so more >= 2.
- * If there was sliding, more >= WSIZE. So in all cases, more >= 2.
- */
- Assert(more >= 2, "more < 2");
-
- n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more);
- s->lookahead += n;
-
- /* Initialize the hash value now that we have some input: */
- if (s->lookahead + s->insert >= MIN_MATCH) {
- uInt str = s->strstart - s->insert;
- s->ins_h = s->window[str];
- UPDATE_HASH(s, s->ins_h, s->window[str + 1]);
-#if MIN_MATCH != 3
- Call UPDATE_HASH() MIN_MATCH-3 more times
-#endif
- while (s->insert) {
- UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]);
-#ifndef FASTEST
- s->prev[str & s->w_mask] = s->head[s->ins_h];
-#endif
- s->head[s->ins_h] = (Pos)str;
- str++;
- s->insert--;
- if (s->lookahead + s->insert < MIN_MATCH)
- break;
- }
- }
- /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage,
- * but this is not important since only literal bytes will be emitted.
- */
-
- } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0);
-
- /* If the WIN_INIT bytes after the end of the current data have never been
- * written, then zero those bytes in order to avoid memory check reports of
- * the use of uninitialized (or uninitialised as Julian writes) bytes by
- * the longest match routines. Update the high water mark for the next
- * time through here. WIN_INIT is set to MAX_MATCH since the longest match
- * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.
- */
- if (s->high_water < s->window_size) {
- ulg curr = s->strstart + (ulg)(s->lookahead);
- ulg init;
-
- if (s->high_water < curr) {
- /* Previous high water mark below current data -- zero WIN_INIT
- * bytes or up to end of window, whichever is less.
- */
- init = s->window_size - curr;
- if (init > WIN_INIT)
- init = WIN_INIT;
- zmemzero(s->window + curr, (unsigned)init);
- s->high_water = curr + init;
- }
- else if (s->high_water < (ulg)curr + WIN_INIT) {
- /* High water mark at or above current data, but below current data
- * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up
- * to end of window, whichever is less.
- */
- init = (ulg)curr + WIN_INIT - s->high_water;
- if (init > s->window_size - s->high_water)
- init = s->window_size - s->high_water;
- zmemzero(s->window + s->high_water, (unsigned)init);
- s->high_water += init;
- }
- }
-
- Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD,
- "not enough room for search");
-}
-
-/* ===========================================================================
- * Flush the current block, with given end-of-file flag.
- * IN assertion: strstart is set to the end of the current match.
- */
-#define FLUSH_BLOCK_ONLY(s, last) { \
- _tr_flush_block(s, (s->block_start >= 0L ? \
- (charf *)&s->window[(unsigned)s->block_start] : \
- (charf *)Z_NULL), \
- (ulg)((long)s->strstart - s->block_start), \
- (last)); \
- s->block_start = s->strstart; \
- flush_pending(s->strm); \
- Tracev((stderr,"[FLUSH]")); \
-}
-
-/* Same but force premature exit if necessary. */
-#define FLUSH_BLOCK(s, last) { \
- FLUSH_BLOCK_ONLY(s, last); \
- if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \
-}
-
-/* ===========================================================================
- * Copy without compression as much as possible from the input stream, return
- * the current block state.
- * This function does not insert new strings in the dictionary since
- * uncompressible data is probably not useful. This function is used
- * only for the level=0 compression option.
- * NOTE: this function should be optimized to avoid extra copying from
- * window to pending_buf.
- */
-local block_state deflate_stored(s, flush)
- deflate_state *s;
- int flush;
-{
- /* Stored blocks are limited to 0xffff bytes, pending_buf is limited
- * to pending_buf_size, and each stored block has a 5 byte header:
- */
- ulg max_block_size = 0xffff;
- ulg max_start;
-
- if (max_block_size > s->pending_buf_size - 5) {
- max_block_size = s->pending_buf_size - 5;
- }
-
- /* Copy as much as possible from input to output: */
- for (;;) {
- /* Fill the window as much as possible: */
- if (s->lookahead <= 1) {
-
- Assert(s->strstart < s->w_size+MAX_DIST(s) ||
- s->block_start >= (long)s->w_size, "slide too late");
-
- fill_window(s);
- if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more;
-
- if (s->lookahead == 0) break; /* flush the current block */
- }
- Assert(s->block_start >= 0L, "block gone");
-
- s->strstart += s->lookahead;
- s->lookahead = 0;
-
- /* Emit a stored block if pending_buf will be full: */
- max_start = s->block_start + max_block_size;
- if (s->strstart == 0 || (ulg)s->strstart >= max_start) {
- /* strstart == 0 is possible when wraparound on 16-bit machine */
- s->lookahead = (uInt)(s->strstart - max_start);
- s->strstart = (uInt)max_start;
- FLUSH_BLOCK(s, 0);
- }
- /* Flush if we may have to slide, otherwise block_start may become
- * negative and the data will be gone:
- */
- if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) {
- FLUSH_BLOCK(s, 0);
- }
- }
- s->insert = 0;
- if (flush == Z_FINISH) {
- FLUSH_BLOCK(s, 1);
- return finish_done;
- }
- if ((long)s->strstart > s->block_start)
- FLUSH_BLOCK(s, 0);
- return block_done;
-}
-
-/* ===========================================================================
- * Compress as much as possible from the input stream, return the current
- * block state.
- * This function does not perform lazy evaluation of matches and inserts
- * new strings in the dictionary only for unmatched strings or for short
- * matches. It is used only for the fast compression options.
- */
-local block_state deflate_fast(s, flush)
- deflate_state *s;
- int flush;
-{
- IPos hash_head; /* head of the hash chain */
- int bflush; /* set if current block must be flushed */
-
- for (;;) {
- /* Make sure that we always have enough lookahead, except
- * at the end of the input file. We need MAX_MATCH bytes
- * for the next match, plus MIN_MATCH bytes to insert the
- * string following the next match.
- */
- if (s->lookahead < MIN_LOOKAHEAD) {
- fill_window(s);
- if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
- return need_more;
- }
- if (s->lookahead == 0) break; /* flush the current block */
- }
-
- /* Insert the string window[strstart .. strstart+2] in the
- * dictionary, and set hash_head to the head of the hash chain:
- */
- hash_head = NIL;
- if (s->lookahead >= MIN_MATCH) {
- INSERT_STRING(s, s->strstart, hash_head);
- }
-
- /* Find the longest match, discarding those <= prev_length.
- * At this point we have always match_length < MIN_MATCH
- */
- if (hash_head != NIL && s->strstart - hash_head <= MAX_DIST(s)) {
- /* To simplify the code, we prevent matches with the string
- * of window index 0 (in particular we have to avoid a match
- * of the string with itself at the start of the input file).
- */
- s->match_length = longest_match (s, hash_head);
- /* longest_match() sets match_start */
- }
- if (s->match_length >= MIN_MATCH) {
- check_match(s, s->strstart, s->match_start, s->match_length);
-
- _tr_tally_dist(s, s->strstart - s->match_start,
- s->match_length - MIN_MATCH, bflush);
-
- s->lookahead -= s->match_length;
-
- /* Insert new strings in the hash table only if the match length
- * is not too large. This saves time but degrades compression.
- */
-#ifndef FASTEST
- if (s->match_length <= s->max_insert_length &&
- s->lookahead >= MIN_MATCH) {
- s->match_length--; /* string at strstart already in table */
- do {
- s->strstart++;
- INSERT_STRING(s, s->strstart, hash_head);
- /* strstart never exceeds WSIZE-MAX_MATCH, so there are
- * always MIN_MATCH bytes ahead.
- */
- } while (--s->match_length != 0);
- s->strstart++;
- } else
-#endif
- {
- s->strstart += s->match_length;
- s->match_length = 0;
- s->ins_h = s->window[s->strstart];
- UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]);
-#if MIN_MATCH != 3
- Call UPDATE_HASH() MIN_MATCH-3 more times
-#endif
- /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not
- * matter since it will be recomputed at next deflate call.
- */
- }
- } else {
- /* No match, output a literal byte */
- Tracevv((stderr,"%c", s->window[s->strstart]));
- _tr_tally_lit (s, s->window[s->strstart], bflush);
- s->lookahead--;
- s->strstart++;
- }
- if (bflush) FLUSH_BLOCK(s, 0);
- }
- s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1;
- if (flush == Z_FINISH) {
- FLUSH_BLOCK(s, 1);
- return finish_done;
- }
- if (s->last_lit)
- FLUSH_BLOCK(s, 0);
- return block_done;
-}
-
-#ifndef FASTEST
-/* ===========================================================================
- * Same as above, but achieves better compression. We use a lazy
- * evaluation for matches: a match is finally adopted only if there is
- * no better match at the next window position.
- */
-local block_state deflate_slow(s, flush)
- deflate_state *s;
- int flush;
-{
- IPos hash_head; /* head of hash chain */
- int bflush; /* set if current block must be flushed */
-
- /* Process the input block. */
- for (;;) {
- /* Make sure that we always have enough lookahead, except
- * at the end of the input file. We need MAX_MATCH bytes
- * for the next match, plus MIN_MATCH bytes to insert the
- * string following the next match.
- */
- if (s->lookahead < MIN_LOOKAHEAD) {
- fill_window(s);
- if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) {
- return need_more;
- }
- if (s->lookahead == 0) break; /* flush the current block */
- }
-
- /* Insert the string window[strstart .. strstart+2] in the
- * dictionary, and set hash_head to the head of the hash chain:
- */
- hash_head = NIL;
- if (s->lookahead >= MIN_MATCH) {
- INSERT_STRING(s, s->strstart, hash_head);
- }
-
- /* Find the longest match, discarding those <= prev_length.
- */
- s->prev_length = s->match_length, s->prev_match = s->match_start;
- s->match_length = MIN_MATCH-1;
-
- if (hash_head != NIL && s->prev_length < s->max_lazy_match &&
- s->strstart - hash_head <= MAX_DIST(s)) {
- /* To simplify the code, we prevent matches with the string
- * of window index 0 (in particular we have to avoid a match
- * of the string with itself at the start of the input file).
- */
- s->match_length = longest_match (s, hash_head);
- /* longest_match() sets match_start */
-
- if (s->match_length <= 5 && (s->strategy == Z_FILTERED
-#if TOO_FAR <= 32767
- || (s->match_length == MIN_MATCH &&
- s->strstart - s->match_start > TOO_FAR)
-#endif
- )) {
-
- /* If prev_match is also MIN_MATCH, match_start is garbage
- * but we will ignore the current match anyway.
- */
- s->match_length = MIN_MATCH-1;
- }
- }
- /* If there was a match at the previous step and the current
- * match is not better, output the previous match:
- */
- if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) {
- uInt max_insert = s->strstart + s->lookahead - MIN_MATCH;
- /* Do not insert strings in hash table beyond this. */
-
- check_match(s, s->strstart-1, s->prev_match, s->prev_length);
-
- _tr_tally_dist(s, s->strstart -1 - s->prev_match,
- s->prev_length - MIN_MATCH, bflush);
-
- /* Insert in hash table all strings up to the end of the match.
- * strstart-1 and strstart are already inserted. If there is not
- * enough lookahead, the last two strings are not inserted in
- * the hash table.
- */
- s->lookahead -= s->prev_length-1;
- s->prev_length -= 2;
- do {
- if (++s->strstart <= max_insert) {
- INSERT_STRING(s, s->strstart, hash_head);
- }
- } while (--s->prev_length != 0);
- s->match_available = 0;
- s->match_length = MIN_MATCH-1;
- s->strstart++;
-
- if (bflush) FLUSH_BLOCK(s, 0);
-
- } else if (s->match_available) {
- /* If there was no match at the previous position, output a
- * single literal. If there was a match but the current match
- * is longer, truncate the previous match to a single literal.
- */
- Tracevv((stderr,"%c", s->window[s->strstart-1]));
- _tr_tally_lit(s, s->window[s->strstart-1], bflush);
- if (bflush) {
- FLUSH_BLOCK_ONLY(s, 0);
- }
- s->strstart++;
- s->lookahead--;
- if (s->strm->avail_out == 0) return need_more;
- } else {
- /* There is no previous match to compare with, wait for
- * the next step to decide.
- */
- s->match_available = 1;
- s->strstart++;
- s->lookahead--;
- }
- }
- Assert (flush != Z_NO_FLUSH, "no flush?");
- if (s->match_available) {
- Tracevv((stderr,"%c", s->window[s->strstart-1]));
- _tr_tally_lit(s, s->window[s->strstart-1], bflush);
- s->match_available = 0;
- }
- s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1;
- if (flush == Z_FINISH) {
- FLUSH_BLOCK(s, 1);
- return finish_done;
- }
- if (s->last_lit)
- FLUSH_BLOCK(s, 0);
- return block_done;
-}
-#endif /* FASTEST */
-
-/* ===========================================================================
- * For Z_RLE, simply look for runs of bytes, generate matches only of distance
- * one. Do not maintain a hash table. (It will be regenerated if this run of
- * deflate switches away from Z_RLE.)
- */
-local block_state deflate_rle(s, flush)
- deflate_state *s;
- int flush;
-{
- int bflush; /* set if current block must be flushed */
- uInt prev; /* byte at distance one to match */
- Bytef *scan, *strend; /* scan goes up to strend for length of run */
-
- for (;;) {
- /* Make sure that we always have enough lookahead, except
- * at the end of the input file. We need MAX_MATCH bytes
- * for the longest run, plus one for the unrolled loop.
- */
- if (s->lookahead <= MAX_MATCH) {
- fill_window(s);
- if (s->lookahead <= MAX_MATCH && flush == Z_NO_FLUSH) {
- return need_more;
- }
- if (s->lookahead == 0) break; /* flush the current block */
- }
-
- /* See how many times the previous byte repeats */
- s->match_length = 0;
- if (s->lookahead >= MIN_MATCH && s->strstart > 0) {
- scan = s->window + s->strstart - 1;
- prev = *scan;
- if (prev == *++scan && prev == *++scan && prev == *++scan) {
- strend = s->window + s->strstart + MAX_MATCH;
- do {
- } while (prev == *++scan && prev == *++scan &&
- prev == *++scan && prev == *++scan &&
- prev == *++scan && prev == *++scan &&
- prev == *++scan && prev == *++scan &&
- scan < strend);
- s->match_length = MAX_MATCH - (int)(strend - scan);
- if (s->match_length > s->lookahead)
- s->match_length = s->lookahead;
- }
- Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan");
- }
-
- /* Emit match if have run of MIN_MATCH or longer, else emit literal */
- if (s->match_length >= MIN_MATCH) {
- check_match(s, s->strstart, s->strstart - 1, s->match_length);
-
- _tr_tally_dist(s, 1, s->match_length - MIN_MATCH, bflush);
-
- s->lookahead -= s->match_length;
- s->strstart += s->match_length;
- s->match_length = 0;
- } else {
- /* No match, output a literal byte */
- Tracevv((stderr,"%c", s->window[s->strstart]));
- _tr_tally_lit (s, s->window[s->strstart], bflush);
- s->lookahead--;
- s->strstart++;
- }
- if (bflush) FLUSH_BLOCK(s, 0);
- }
- s->insert = 0;
- if (flush == Z_FINISH) {
- FLUSH_BLOCK(s, 1);
- return finish_done;
- }
- if (s->last_lit)
- FLUSH_BLOCK(s, 0);
- return block_done;
-}
-
-/* ===========================================================================
- * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table.
- * (It will be regenerated if this run of deflate switches away from Huffman.)
- */
-local block_state deflate_huff(s, flush)
- deflate_state *s;
- int flush;
-{
- int bflush; /* set if current block must be flushed */
-
- for (;;) {
- /* Make sure that we have a literal to write. */
- if (s->lookahead == 0) {
- fill_window(s);
- if (s->lookahead == 0) {
- if (flush == Z_NO_FLUSH)
- return need_more;
- break; /* flush the current block */
- }
- }
-
- /* Output a literal byte */
- s->match_length = 0;
- Tracevv((stderr,"%c", s->window[s->strstart]));
- _tr_tally_lit (s, s->window[s->strstart], bflush);
- s->lookahead--;
- s->strstart++;
- if (bflush) FLUSH_BLOCK(s, 0);
- }
- s->insert = 0;
- if (flush == Z_FINISH) {
- FLUSH_BLOCK(s, 1);
- return finish_done;
- }
- if (s->last_lit)
- FLUSH_BLOCK(s, 0);
- return block_done;
-}
diff --git a/sdk-modifications/libsrc/zlib/deflate.h b/sdk-modifications/libsrc/zlib/deflate.h
deleted file mode 100755
index fbac44d..0000000
--- a/sdk-modifications/libsrc/zlib/deflate.h
+++ /dev/null
@@ -1,346 +0,0 @@
-/* deflate.h -- internal compression state
- * Copyright (C) 1995-2012 Jean-loup Gailly
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* WARNING: this file should *not* be used by applications. It is
- part of the implementation of the compression library and is
- subject to change. Applications should only use zlib.h.
- */
-
-/* @(#) $Id$ */
-
-#ifndef DEFLATE_H
-#define DEFLATE_H
-
-#include "zutil.h"
-
-/* define NO_GZIP when compiling if you want to disable gzip header and
- trailer creation by deflate(). NO_GZIP would be used to avoid linking in
- the crc code when it is not needed. For shared libraries, gzip encoding
- should be left enabled. */
-#ifndef NO_GZIP
-# define GZIP
-#endif
-
-/* ===========================================================================
- * Internal compression state.
- */
-
-#define LENGTH_CODES 29
-/* number of length codes, not counting the special END_BLOCK code */
-
-#define LITERALS 256
-/* number of literal bytes 0..255 */
-
-#define L_CODES (LITERALS+1+LENGTH_CODES)
-/* number of Literal or Length codes, including the END_BLOCK code */
-
-#define D_CODES 30
-/* number of distance codes */
-
-#define BL_CODES 19
-/* number of codes used to transfer the bit lengths */
-
-#define HEAP_SIZE (2*L_CODES+1)
-/* maximum heap size */
-
-#define MAX_BITS 15
-/* All codes must not exceed MAX_BITS bits */
-
-#define Buf_size 16
-/* size of bit buffer in bi_buf */
-
-#define INIT_STATE 42
-#define EXTRA_STATE 69
-#define NAME_STATE 73
-#define COMMENT_STATE 91
-#define HCRC_STATE 103
-#define BUSY_STATE 113
-#define FINISH_STATE 666
-/* Stream status */
-
-
-/* Data structure describing a single value and its code string. */
-typedef struct ct_data_s {
- union {
- ush freq; /* frequency count */
- ush code; /* bit string */
- } fc;
- union {
- ush dad; /* father node in Huffman tree */
- ush len; /* length of bit string */
- } dl;
-} FAR ct_data;
-
-#define Freq fc.freq
-#define Code fc.code
-#define Dad dl.dad
-#define Len dl.len
-
-typedef struct static_tree_desc_s static_tree_desc;
-
-typedef struct tree_desc_s {
- ct_data *dyn_tree; /* the dynamic tree */
- int max_code; /* largest code with non zero frequency */
- static_tree_desc *stat_desc; /* the corresponding static tree */
-} FAR tree_desc;
-
-typedef ush Pos;
-typedef Pos FAR Posf;
-typedef unsigned IPos;
-
-/* A Pos is an index in the character window. We use short instead of int to
- * save space in the various tables. IPos is used only for parameter passing.
- */
-
-typedef struct internal_state {
- z_streamp strm; /* pointer back to this zlib stream */
- int status; /* as the name implies */
- Bytef *pending_buf; /* output still pending */
- ulg pending_buf_size; /* size of pending_buf */
- Bytef *pending_out; /* next pending byte to output to the stream */
- uInt pending; /* nb of bytes in the pending buffer */
- int wrap; /* bit 0 true for zlib, bit 1 true for gzip */
- gz_headerp gzhead; /* gzip header information to write */
- uInt gzindex; /* where in extra, name, or comment */
- Byte method; /* STORED (for zip only) or DEFLATED */
- int last_flush; /* value of flush param for previous deflate call */
-
- /* used by deflate.c: */
-
- uInt w_size; /* LZ77 window size (32K by default) */
- uInt w_bits; /* log2(w_size) (8..16) */
- uInt w_mask; /* w_size - 1 */
-
- Bytef *window;
- /* Sliding window. Input bytes are read into the second half of the window,
- * and move to the first half later to keep a dictionary of at least wSize
- * bytes. With this organization, matches are limited to a distance of
- * wSize-MAX_MATCH bytes, but this ensures that IO is always
- * performed with a length multiple of the block size. Also, it limits
- * the window size to 64K, which is quite useful on MSDOS.
- * To do: use the user input buffer as sliding window.
- */
-
- ulg window_size;
- /* Actual size of window: 2*wSize, except when the user input buffer
- * is directly used as sliding window.
- */
-
- Posf *prev;
- /* Link to older string with same hash index. To limit the size of this
- * array to 64K, this link is maintained only for the last 32K strings.
- * An index in this array is thus a window index modulo 32K.
- */
-
- Posf *head; /* Heads of the hash chains or NIL. */
-
- uInt ins_h; /* hash index of string to be inserted */
- uInt hash_size; /* number of elements in hash table */
- uInt hash_bits; /* log2(hash_size) */
- uInt hash_mask; /* hash_size-1 */
-
- uInt hash_shift;
- /* Number of bits by which ins_h must be shifted at each input
- * step. It must be such that after MIN_MATCH steps, the oldest
- * byte no longer takes part in the hash key, that is:
- * hash_shift * MIN_MATCH >= hash_bits
- */
-
- long block_start;
- /* Window position at the beginning of the current output block. Gets
- * negative when the window is moved backwards.
- */
-
- uInt match_length; /* length of best match */
- IPos prev_match; /* previous match */
- int match_available; /* set if previous match exists */
- uInt strstart; /* start of string to insert */
- uInt match_start; /* start of matching string */
- uInt lookahead; /* number of valid bytes ahead in window */
-
- uInt prev_length;
- /* Length of the best match at previous step. Matches not greater than this
- * are discarded. This is used in the lazy match evaluation.
- */
-
- uInt max_chain_length;
- /* To speed up deflation, hash chains are never searched beyond this
- * length. A higher limit improves compression ratio but degrades the
- * speed.
- */
-
- uInt max_lazy_match;
- /* Attempt to find a better match only when the current match is strictly
- * smaller than this value. This mechanism is used only for compression
- * levels >= 4.
- */
-# define max_insert_length max_lazy_match
- /* Insert new strings in the hash table only if the match length is not
- * greater than this length. This saves time but degrades compression.
- * max_insert_length is used only for compression levels <= 3.
- */
-
- int level; /* compression level (1..9) */
- int strategy; /* favor or force Huffman coding*/
-
- uInt good_match;
- /* Use a faster search when the previous match is longer than this */
-
- int nice_match; /* Stop searching when current match exceeds this */
-
- /* used by trees.c: */
- /* Didn't use ct_data typedef below to suppress compiler warning */
- struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */
- struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
- struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */
-
- struct tree_desc_s l_desc; /* desc. for literal tree */
- struct tree_desc_s d_desc; /* desc. for distance tree */
- struct tree_desc_s bl_desc; /* desc. for bit length tree */
-
- ush bl_count[MAX_BITS+1];
- /* number of codes at each bit length for an optimal tree */
-
- int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */
- int heap_len; /* number of elements in the heap */
- int heap_max; /* element of largest frequency */
- /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
- * The same heap array is used to build all trees.
- */
-
- uch depth[2*L_CODES+1];
- /* Depth of each subtree used as tie breaker for trees of equal frequency
- */
-
- uchf *l_buf; /* buffer for literals or lengths */
-
- uInt lit_bufsize;
- /* Size of match buffer for literals/lengths. There are 4 reasons for
- * limiting lit_bufsize to 64K:
- * - frequencies can be kept in 16 bit counters
- * - if compression is not successful for the first block, all input
- * data is still in the window so we can still emit a stored block even
- * when input comes from standard input. (This can also be done for
- * all blocks if lit_bufsize is not greater than 32K.)
- * - if compression is not successful for a file smaller than 64K, we can
- * even emit a stored file instead of a stored block (saving 5 bytes).
- * This is applicable only for zip (not gzip or zlib).
- * - creating new Huffman trees less frequently may not provide fast
- * adaptation to changes in the input data statistics. (Take for
- * example a binary file with poorly compressible code followed by
- * a highly compressible string table.) Smaller buffer sizes give
- * fast adaptation but have of course the overhead of transmitting
- * trees more frequently.
- * - I can't count above 4
- */
-
- uInt last_lit; /* running index in l_buf */
-
- ushf *d_buf;
- /* Buffer for distances. To simplify the code, d_buf and l_buf have
- * the same number of elements. To use different lengths, an extra flag
- * array would be necessary.
- */
-
- ulg opt_len; /* bit length of current block with optimal trees */
- ulg static_len; /* bit length of current block with static trees */
- uInt matches; /* number of string matches in current block */
- uInt insert; /* bytes at end of window left to insert */
-
-#ifdef DEBUG
- ulg compressed_len; /* total bit length of compressed file mod 2^32 */
- ulg bits_sent; /* bit length of compressed data sent mod 2^32 */
-#endif
-
- ush bi_buf;
- /* Output buffer. bits are inserted starting at the bottom (least
- * significant bits).
- */
- int bi_valid;
- /* Number of valid bits in bi_buf. All bits above the last valid bit
- * are always zero.
- */
-
- ulg high_water;
- /* High water mark offset in window for initialized bytes -- bytes above
- * this are set to zero in order to avoid memory check warnings when
- * longest match routines access bytes past the input. This is then
- * updated to the new high water mark.
- */
-
-} FAR deflate_state;
-
-/* Output a byte on the stream.
- * IN assertion: there is enough room in pending_buf.
- */
-#define put_byte(s, c) {s->pending_buf[s->pending++] = (c);}
-
-
-#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
-/* Minimum amount of lookahead, except at the end of the input file.
- * See deflate.c for comments about the MIN_MATCH+1.
- */
-
-#define MAX_DIST(s) ((s)->w_size-MIN_LOOKAHEAD)
-/* In order to simplify the code, particularly on 16 bit machines, match
- * distances are limited to MAX_DIST instead of WSIZE.
- */
-
-#define WIN_INIT MAX_MATCH
-/* Number of bytes after end of data in window to initialize in order to avoid
- memory checker errors from longest match routines */
-
- /* in trees.c */
-void ZLIB_INTERNAL _tr_init OF((deflate_state *s));
-int ZLIB_INTERNAL _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc));
-void ZLIB_INTERNAL _tr_flush_block OF((deflate_state *s, charf *buf,
- ulg stored_len, int last));
-void ZLIB_INTERNAL _tr_flush_bits OF((deflate_state *s));
-void ZLIB_INTERNAL _tr_align OF((deflate_state *s));
-void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
- ulg stored_len, int last));
-
-#define d_code(dist) \
- ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
-/* Mapping from a distance to a distance code. dist is the distance - 1 and
- * must not have side effects. _dist_code[256] and _dist_code[257] are never
- * used.
- */
-
-#ifndef DEBUG
-/* Inline versions of _tr_tally for speed: */
-
-#if defined(GEN_TREES_H) || !defined(STDC)
- extern uch ZLIB_INTERNAL _length_code[];
- extern uch ZLIB_INTERNAL _dist_code[];
-#else
- extern const uch ZLIB_INTERNAL _length_code[];
- extern const uch ZLIB_INTERNAL _dist_code[];
-#endif
-
-# define _tr_tally_lit(s, c, flush) \
- { uch cc = (c); \
- s->d_buf[s->last_lit] = 0; \
- s->l_buf[s->last_lit++] = cc; \
- s->dyn_ltree[cc].Freq++; \
- flush = (s->last_lit == s->lit_bufsize-1); \
- }
-# define _tr_tally_dist(s, distance, length, flush) \
- { uch len = (length); \
- ush dist = (distance); \
- s->d_buf[s->last_lit] = dist; \
- s->l_buf[s->last_lit++] = len; \
- dist--; \
- s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
- s->dyn_dtree[d_code(dist)].Freq++; \
- flush = (s->last_lit == s->lit_bufsize-1); \
- }
-#else
-# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
-# define _tr_tally_dist(s, distance, length, flush) \
- flush = _tr_tally(s, distance, length)
-#endif
-
-#endif /* DEFLATE_H */
diff --git a/sdk-modifications/libsrc/zlib/gzclose.c b/sdk-modifications/libsrc/zlib/gzclose.c
deleted file mode 100755
index caeb99a..0000000
--- a/sdk-modifications/libsrc/zlib/gzclose.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/* gzclose.c -- zlib gzclose() function
- * Copyright (C) 2004, 2010 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-#include "gzguts.h"
-
-/* gzclose() is in a separate file so that it is linked in only if it is used.
- That way the other gzclose functions can be used instead to avoid linking in
- unneeded compression or decompression routines. */
-int ZEXPORT gzclose(file)
- gzFile file;
-{
-#ifndef NO_GZCOMPRESS
- gz_statep state;
-
- if (file == NULL)
- return Z_STREAM_ERROR;
- state = (gz_statep)file;
-
- return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file);
-#else
- return gzclose_r(file);
-#endif
-}
diff --git a/sdk-modifications/libsrc/zlib/gzguts.h b/sdk-modifications/libsrc/zlib/gzguts.h
deleted file mode 100755
index 5405749..0000000
--- a/sdk-modifications/libsrc/zlib/gzguts.h
+++ /dev/null
@@ -1,196 +0,0 @@
-/* gzguts.h -- zlib internal header definitions for gz* operations
- * Copyright (C) 2004, 2005, 2010, 2011, 2012 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-#ifdef _LARGEFILE64_SOURCE
-# ifndef _LARGEFILE_SOURCE
-# define _LARGEFILE_SOURCE 1
-# endif
-# ifdef _FILE_OFFSET_BITS
-# undef _FILE_OFFSET_BITS
-# endif
-#endif
-
-#if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ)
-# define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
-#else
-# define ZLIB_INTERNAL
-#endif
-
-//#include <stdio.h>
-#include "zlib.h"
-
-#include <ds2_malloc.h>
-#include <fs_api.h>
-#include <ds2_unistd.h>
-#include <ds2_fcntl.h>
-
-#ifdef STDC
-//# include <string.h>
-//# include <stdlib.h>
-//# include <limits.h>
-#endif
-//#include <fcntl.h>
-
-#ifdef __TURBOC__
-# include <io.h>
-#endif
-
-#ifdef NO_DEFLATE /* for compatibility with old definition */
-# define NO_GZCOMPRESS
-#endif
-
-#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550)
-# ifndef HAVE_VSNPRINTF
-# define HAVE_VSNPRINTF
-# endif
-#endif
-
-#if defined(__CYGWIN__)
-# ifndef HAVE_VSNPRINTF
-# define HAVE_VSNPRINTF
-# endif
-#endif
-
-#if defined(MSDOS) && defined(__BORLANDC__) && (BORLANDC > 0x410)
-# ifndef HAVE_VSNPRINTF
-# define HAVE_VSNPRINTF
-# endif
-#endif
-
-#ifndef HAVE_VSNPRINTF
-# ifdef MSDOS
-/* vsnprintf may exist on some MS-DOS compilers (DJGPP?),
- but for now we just assume it doesn't. */
-# define NO_vsnprintf
-# endif
-# ifdef __TURBOC__
-# define NO_vsnprintf
-# endif
-# ifdef WIN32
-/* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */
-# if !defined(vsnprintf) && !defined(NO_vsnprintf)
-# if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 )
-# include <io.h>
-# define vsnprintf _vsnprintf
-# endif
-# endif
-# endif
-# ifdef __SASC
-# define NO_vsnprintf
-# endif
-# ifdef VMS
-# define NO_vsnprintf
-# endif
-# ifdef __OS400__
-# define NO_vsnprintf
-# endif
-# ifdef __MVS__
-# define NO_vsnprintf
-# endif
-#endif
-
-#ifndef local
-# define local static
-#endif
-/* compile with -Dlocal if your debugger can't find static symbols */
-
-/* gz* functions always use library allocation functions */
-#ifndef STDC
- extern voidp malloc OF((uInt size));
- extern void free OF((voidpf ptr));
-#endif
-
-/* get errno and strerror definition */
-#if defined UNDER_CE
-# include <windows.h>
-# define zstrerror() gz_strwinerror((DWORD)GetLastError())
-#else
-# ifdef STDC
-# // include <errno.h>
-# define zstrerror() strerror(errno)
-# else
-# define zstrerror() "stdio error (consult errno)"
-# endif
-#endif
-
-/* provide prototypes for these when building zlib without LFS */
-#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0
- ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
- ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
- ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
- ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
-#endif
-
-/* default memLevel */
-#if MAX_MEM_LEVEL >= 8
-# define DEF_MEM_LEVEL 8
-#else
-# define DEF_MEM_LEVEL MAX_MEM_LEVEL
-#endif
-
-/* default i/o buffer size -- double this for output when reading */
-#define GZBUFSIZE 8192
-
-/* gzip modes, also provide a little integrity check on the passed structure */
-#define GZ_NONE 0
-#define GZ_READ 7247
-#define GZ_WRITE 31153
-#define GZ_APPEND 1 /* mode set to GZ_WRITE after the file is opened */
-
-/* values for gz_state how */
-#define LOOK 0 /* look for a gzip header */
-#define COPY 1 /* copy input directly */
-#define GZIP 2 /* decompress a gzip stream */
-
-/* internal gzip file state data structure */
-typedef struct {
- /* exposed contents for gzgetc() macro */
- struct gzFile_s x; /* "x" for exposed */
- /* x.have: number of bytes available at x.next */
- /* x.next: next output data to deliver or write */
- /* x.pos: current position in uncompressed data */
- /* used for both reading and writing */
- int mode; /* see gzip modes above */
- int fd; /* file descriptor */
- char *path; /* path or fd for error messages */
- unsigned size; /* buffer size, zero if not allocated yet */
- unsigned want; /* requested buffer size, default is GZBUFSIZE */
- unsigned char *in; /* input buffer */
- unsigned char *out; /* output buffer (double-sized when reading) */
- int direct; /* 0 if processing gzip, 1 if transparent */
- /* just for reading */
- int how; /* 0: get header, 1: copy, 2: decompress */
- z_off64_t start; /* where the gzip data started, for rewinding */
- int eof; /* true if end of input file reached */
- int past; /* true if read requested past end */
- /* just for writing */
- int level; /* compression level */
- int strategy; /* compression strategy */
- /* seek request */
- z_off64_t skip; /* amount to skip (already rewound if backwards) */
- int seek; /* true if seek request pending */
- /* error information */
- int err; /* error code */
- char *msg; /* error message */
- /* zlib inflate or deflate stream */
- z_stream strm; /* stream structure in-place (not a pointer) */
-} gz_state;
-typedef gz_state FAR *gz_statep;
-
-/* shared functions */
-void ZLIB_INTERNAL gz_error OF((gz_statep, int, const char *));
-#if defined UNDER_CE
-char ZLIB_INTERNAL *gz_strwinerror OF((DWORD error));
-#endif
-
-/* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t
- value -- needed when comparing unsigned to z_off64_t, which is signed
- (possible z_off64_t types off_t, off64_t, and long are all signed) */
-#ifdef INT_MAX
-# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX)
-#else
-unsigned ZLIB_INTERNAL gz_intmax OF((void));
-# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax())
-#endif
diff --git a/sdk-modifications/libsrc/zlib/gzlib.c b/sdk-modifications/libsrc/zlib/gzlib.c
deleted file mode 100755
index 7aedab8..0000000
--- a/sdk-modifications/libsrc/zlib/gzlib.c
+++ /dev/null
@@ -1,564 +0,0 @@
-/* gzlib.c -- zlib functions common to reading and writing gzip files
- * Copyright (C) 2004, 2010, 2011 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-#include "gzguts.h"
-
-#if defined(_WIN32) && !defined(__BORLANDC__)
-# define LSEEK _lseeki64
-#else
-#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
-# define LSEEK lseek64
-#else
-# define LSEEK lseek
-#endif
-#endif
-
-/* Local functions */
-local void gz_reset OF((gz_statep));
-local gzFile gz_open OF((const char *, int, const char *));
-
-#if defined UNDER_CE
-
-/* Map the Windows error number in ERROR to a locale-dependent error message
- string and return a pointer to it. Typically, the values for ERROR come
- from GetLastError.
-
- The string pointed to shall not be modified by the application, but may be
- overwritten by a subsequent call to gz_strwinerror
-
- The gz_strwinerror function does not change the current setting of
- GetLastError. */
-char ZLIB_INTERNAL *gz_strwinerror (error)
- DWORD error;
-{
- static char buf[1024];
-
- wchar_t *msgbuf;
- DWORD lasterr = GetLastError();
- DWORD chars = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM
- | FORMAT_MESSAGE_ALLOCATE_BUFFER,
- NULL,
- error,
- 0, /* Default language */
- (LPVOID)&msgbuf,
- 0,
- NULL);
- if (chars != 0) {
- /* If there is an \r\n appended, zap it. */
- if (chars >= 2
- && msgbuf[chars - 2] == '\r' && msgbuf[chars - 1] == '\n') {
- chars -= 2;
- msgbuf[chars] = 0;
- }
-
- if (chars > sizeof (buf) - 1) {
- chars = sizeof (buf) - 1;
- msgbuf[chars] = 0;
- }
-
- wcstombs(buf, msgbuf, chars + 1);
- LocalFree(msgbuf);
- }
- else {
- sprintf(buf, "unknown win32 error (%ld)", error);
- }
-
- SetLastError(lasterr);
- return buf;
-}
-
-#endif /* UNDER_CE */
-
-/* Reset gzip file state */
-local void gz_reset(state)
- gz_statep state;
-{
- state->x.have = 0; /* no output data available */
- if (state->mode == GZ_READ) { /* for reading ... */
- state->eof = 0; /* not at end of file */
- state->past = 0; /* have not read past end yet */
- state->how = LOOK; /* look for gzip header */
- }
- state->seek = 0; /* no seek request pending */
- gz_error(state, Z_OK, NULL); /* clear error */
- state->x.pos = 0; /* no uncompressed data yet */
- state->strm.avail_in = 0; /* no input data yet */
-}
-
-/* Open a gzip file either by name or file descriptor. */
-local gzFile gz_open(path, fd, mode)
- const char *path;
- int fd;
- const char *mode;
-{
- gz_statep state;
-
- /* check input */
- if (path == NULL)
- return NULL;
-
- /* allocate gzFile structure to return */
- state = malloc(sizeof(gz_state));
- if (state == NULL)
- return NULL;
- state->size = 0; /* no buffers allocated yet */
- state->want = GZBUFSIZE; /* requested buffer size */
- state->msg = NULL; /* no error message yet */
-
- /* interpret mode */
- state->mode = GZ_NONE;
- state->level = Z_DEFAULT_COMPRESSION;
- state->strategy = Z_DEFAULT_STRATEGY;
- state->direct = 0;
- while (*mode) {
- if (*mode >= '0' && *mode <= '9')
- state->level = *mode - '0';
- else
- switch (*mode) {
- case 'r':
- state->mode = GZ_READ;
- break;
-#ifndef NO_GZCOMPRESS
- case 'w':
- state->mode = GZ_WRITE;
- break;
- case 'a':
- state->mode = GZ_APPEND;
- break;
-#endif
- case '+': /* can't read and write at the same time */
- free(state);
- return NULL;
- case 'b': /* ignore -- will request binary anyway */
- break;
- case 'f':
- state->strategy = Z_FILTERED;
- break;
- case 'h':
- state->strategy = Z_HUFFMAN_ONLY;
- break;
- case 'R':
- state->strategy = Z_RLE;
- break;
- case 'F':
- state->strategy = Z_FIXED;
- case 'T':
- state->direct = 1;
- default: /* could consider as an error, but just ignore */
- ;
- }
- mode++;
- }
-
- /* must provide an "r", "w", or "a" */
- if (state->mode == GZ_NONE) {
- free(state);
- return NULL;
- }
-
- /* can't force transparent read */
- if (state->mode == GZ_READ) {
- if (state->direct) {
- free(state);
- return NULL;
- }
- state->direct = 1; /* for empty file */
- }
-
- /* save the path name for error messages */
- state->path = malloc(strlen(path) + 1);
- if (state->path == NULL) {
- free(state);
- return NULL;
- }
- strcpy(state->path, path);
-
- /* open the file with the appropriate mode (or just use fd) */
- state->fd = fd != -1 ? fd :
- open(path,
-#ifdef O_LARGEFILE
- O_LARGEFILE |
-#endif
-#ifdef O_BINARY
- O_BINARY |
-#endif
- (state->mode == GZ_READ ?
- O_RDONLY :
- (O_WRONLY | O_CREAT | (
- state->mode == GZ_WRITE ?
- O_TRUNC :
- O_APPEND))),
- 0666);
- if (state->fd == -1) {
- free(state->path);
- free(state);
- return NULL;
- }
- if (state->mode == GZ_APPEND)
- state->mode = GZ_WRITE; /* simplify later checks */
-
- /* save the current position for rewinding (only if reading) */
- if (state->mode == GZ_READ) {
- state->start = LSEEK(state->fd, 0, SEEK_CUR);
- if (state->start == -1) state->start = 0;
- }
-
- /* initialize stream */
- gz_reset(state);
-
- /* return stream */
- return (gzFile)state;
-}
-
-/* -- see zlib.h -- */
-gzFile ZEXPORT gzopen(path, mode)
- const char *path;
- const char *mode;
-{
- return gz_open(path, -1, mode);
-}
-
-/* -- see zlib.h -- */
-gzFile ZEXPORT gzopen64(path, mode)
- const char *path;
- const char *mode;
-{
- return gz_open(path, -1, mode);
-}
-
-/* -- see zlib.h -- */
-gzFile ZEXPORT gzdopen(fd, mode)
- int fd;
- const char *mode;
-{
- char *path; /* identifier for error messages */
- gzFile gz;
-
- if (fd == -1 || (path = malloc(7 + 3 * sizeof(int))) == NULL)
- return NULL;
- sprintf(path, "<fd:%d>", fd); /* for debugging */
- gz = gz_open(path, fd, mode);
- free(path);
- return gz;
-}
-
-/* -- see zlib.h -- */
-int ZEXPORT gzbuffer(file, size)
- gzFile file;
- unsigned size;
-{
- gz_statep state;
-
- /* get internal structure and check integrity */
- if (file == NULL)
- return -1;
- state = (gz_statep)file;
- if (state->mode != GZ_READ && state->mode != GZ_WRITE)
- return -1;
-
- /* make sure we haven't already allocated memory */
- if (state->size != 0)
- return -1;
-
- /* check and set requested size */
- if (size < 2)
- size = 2; /* need two bytes to check magic header */
- state->want = size;
- return 0;
-}
-
-/* -- see zlib.h -- */
-int ZEXPORT gzrewind(file)
- gzFile file;
-{
- gz_statep state;
-
- /* get internal structure */
- if (file == NULL)
- return -1;
- state = (gz_statep)file;
-
- /* check that we're reading and that there's no error */
- if (state->mode != GZ_READ ||
- (state->err != Z_OK && state->err != Z_BUF_ERROR))
- return -1;
-
- /* back up and start over */
- if (LSEEK(state->fd, state->start, SEEK_SET) == -1)
- return -1;
- gz_reset(state);
- return 0;
-}
-
-/* -- see zlib.h -- */
-z_off64_t ZEXPORT gzseek64(file, offset, whence)
- gzFile file;
- z_off64_t offset;
- int whence;
-{
- unsigned n;
- z_off64_t ret;
- gz_statep state;
-
- /* get internal structure and check integrity */
- if (file == NULL)
- return -1;
- state = (gz_statep)file;
- if (state->mode != GZ_READ && state->mode != GZ_WRITE)
- return -1;
-
- /* check that there's no error */
- if (state->err != Z_OK && state->err != Z_BUF_ERROR)
- return -1;
-
- /* can only seek from start or relative to current position */
- if (whence != SEEK_SET && whence != SEEK_CUR)
- return -1;
-
- /* normalize offset to a SEEK_CUR specification */
- if (whence == SEEK_SET)
- offset -= state->x.pos;
- else if (state->seek)
- offset += state->skip;
- state->seek = 0;
-
- /* if within raw area while reading, just go there */
- if (state->mode == GZ_READ && state->how == COPY &&
- state->x.pos + offset >= 0) {
- ret = LSEEK(state->fd, offset - state->x.have, SEEK_CUR);
- if (ret == -1)
- return -1;
- state->x.have = 0;
- state->eof = 0;
- state->past = 0;
- state->seek = 0;
- gz_error(state, Z_OK, NULL);
- state->strm.avail_in = 0;
- state->x.pos += offset;
- return state->x.pos;
- }
-
- /* calculate skip amount, rewinding if needed for back seek when reading */
- if (offset < 0) {
- if (state->mode != GZ_READ) /* writing -- can't go backwards */
- return -1;
- offset += state->x.pos;
- if (offset < 0) /* before start of file! */
- return -1;
- if (gzrewind(file) == -1) /* rewind, then skip to offset */
- return -1;
- }
-
- /* if reading, skip what's in output buffer (one less gzgetc() check) */
- if (state->mode == GZ_READ) {
- n = GT_OFF(state->x.have) || (z_off64_t)state->x.have > offset ?
- (unsigned)offset : state->x.have;
- state->x.have -= n;
- state->x.next += n;
- state->x.pos += n;
- offset -= n;
- }
-
- /* request skip (if not zero) */
- if (offset) {
- state->seek = 1;
- state->skip = offset;
- }
- return state->x.pos + offset;
-}
-
-/* -- see zlib.h -- */
-z_off_t ZEXPORT gzseek(file, offset, whence)
- gzFile file;
- z_off_t offset;
- int whence;
-{
- z_off64_t ret;
-
- ret = gzseek64(file, (z_off64_t)offset, whence);
- return ret == (z_off_t)ret ? (z_off_t)ret : -1;
-}
-
-/* -- see zlib.h -- */
-z_off64_t ZEXPORT gztell64(file)
- gzFile file;
-{
- gz_statep state;
-
- /* get internal structure and check integrity */
- if (file == NULL)
- return -1;
- state = (gz_statep)file;
- if (state->mode != GZ_READ && state->mode != GZ_WRITE)
- return -1;
-
- /* return position */
- return state->x.pos + (state->seek ? state->skip : 0);
-}
-
-/* -- see zlib.h -- */
-z_off_t ZEXPORT gztell(file)
- gzFile file;
-{
- z_off64_t ret;
-
- ret = gztell64(file);
- return ret == (z_off_t)ret ? (z_off_t)ret : -1;
-}
-
-/* -- see zlib.h -- */
-z_off64_t ZEXPORT gzoffset64(file)
- gzFile file;
-{
- z_off64_t offset;
- gz_statep state;
-
- /* get internal structure and check integrity */
- if (file == NULL)
- return -1;
- state = (gz_statep)file;
- if (state->mode != GZ_READ && state->mode != GZ_WRITE)
- return -1;
-
- /* compute and return effective offset in file */
- offset = LSEEK(state->fd, 0, SEEK_CUR);
- if (offset == -1)
- return -1;
- if (state->mode == GZ_READ) /* reading */
- offset -= state->strm.avail_in; /* don't count buffered input */
- return offset;
-}
-
-/* -- see zlib.h -- */
-z_off_t ZEXPORT gzoffset(file)
- gzFile file;
-{
- z_off64_t ret;
-
- ret = gzoffset64(file);
- return ret == (z_off_t)ret ? (z_off_t)ret : -1;
-}
-
-/* -- see zlib.h -- */
-int ZEXPORT gzeof(file)
- gzFile file;
-{
- gz_statep state;
-
- /* get internal structure and check integrity */
- if (file == NULL)
- return 0;
- state = (gz_statep)file;
- if (state->mode != GZ_READ && state->mode != GZ_WRITE)
- return 0;
-
- /* return end-of-file state */
- return state->mode == GZ_READ ? state->past : 0;
-}
-
-/* -- see zlib.h -- */
-const char * ZEXPORT gzerror(file, errnum)
- gzFile file;
- int *errnum;
-{
- gz_statep state;
-
- /* get internal structure and check integrity */
- if (file == NULL)
- return NULL;
- state = (gz_statep)file;
- if (state->mode != GZ_READ && state->mode != GZ_WRITE)
- return NULL;
-
- /* return error information */
- if (errnum != NULL)
- *errnum = state->err;
- return state->msg == NULL ? "" : state->msg;
-}
-
-/* -- see zlib.h -- */
-void ZEXPORT gzclearerr(file)
- gzFile file;
-{
- gz_statep state;
-
- /* get internal structure and check integrity */
- if (file == NULL)
- return;
- state = (gz_statep)file;
- if (state->mode != GZ_READ && state->mode != GZ_WRITE)
- return;
-
- /* clear error and end-of-file */
- if (state->mode == GZ_READ) {
- state->eof = 0;
- state->past = 0;
- }
- gz_error(state, Z_OK, NULL);
-}
-
-/* Create an error message in allocated memory and set state->err and
- state->msg accordingly. Free any previous error message already there. Do
- not try to free or allocate space if the error is Z_MEM_ERROR (out of
- memory). Simply save the error message as a static string. If there is an
- allocation failure constructing the error message, then convert the error to
- out of memory. */
-void ZLIB_INTERNAL gz_error(state, err, msg)
- gz_statep state;
- int err;
- const char *msg;
-{
- /* free previously allocated message and clear */
- if (state->msg != NULL) {
- if (state->err != Z_MEM_ERROR)
- free(state->msg);
- state->msg = NULL;
- }
-
- /* if fatal, set state->x.have to 0 so that the gzgetc() macro fails */
- if (err != Z_OK && err != Z_BUF_ERROR)
- state->x.have = 0;
-
- /* set error code, and if no message, then done */
- state->err = err;
- if (msg == NULL)
- return;
-
- /* for an out of memory error, save as static string */
- if (err == Z_MEM_ERROR) {
- state->msg = (char *)msg;
- return;
- }
-
- /* construct error message with path */
- if ((state->msg = malloc(strlen(state->path) + strlen(msg) + 3)) == NULL) {
- state->err = Z_MEM_ERROR;
- state->msg = (char *)"out of memory";
- return;
- }
- strcpy(state->msg, state->path);
- strcat(state->msg, ": ");
- strcat(state->msg, msg);
- return;
-}
-
-#ifndef INT_MAX
-/* portably return maximum value for an int (when limits.h presumed not
- available) -- we need to do this to cover cases where 2's complement not
- used, since C standard permits 1's complement and sign-bit representations,
- otherwise we could just use ((unsigned)-1) >> 1 */
-unsigned ZLIB_INTERNAL gz_intmax()
-{
- unsigned p, q;
-
- p = 1;
- do {
- q = p;
- p <<= 1;
- p++;
- } while (p > q);
- return q >> 1;
-}
-#endif
diff --git a/sdk-modifications/libsrc/zlib/gzread.c b/sdk-modifications/libsrc/zlib/gzread.c
deleted file mode 100755
index 4632e8f..0000000
--- a/sdk-modifications/libsrc/zlib/gzread.c
+++ /dev/null
@@ -1,584 +0,0 @@
-/* gzread.c -- zlib functions for reading gzip files
- * Copyright (C) 2004, 2005, 2010, 2011 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-#include "gzguts.h"
-
-/* Local functions */
-local int gz_load OF((gz_statep, unsigned char *, unsigned, unsigned *));
-local int gz_avail OF((gz_statep));
-local int gz_look OF((gz_statep));
-local int gz_decomp OF((gz_statep));
-local int gz_fetch OF((gz_statep));
-local int gz_skip OF((gz_statep, z_off64_t));
-
-/* Use read() to load a buffer -- return -1 on error, otherwise 0. Read from
- state->fd, and update state->eof, state->err, and state->msg as appropriate.
- This function needs to loop on read(), since read() is not guaranteed to
- read the number of bytes requested, depending on the type of descriptor. */
-local int gz_load(state, buf, len, have)
- gz_statep state;
- unsigned char *buf;
- unsigned len;
- unsigned *have;
-{
- int ret;
-
- *have = 0;
- do {
- ret = read(state->fd, buf + *have, len - *have);
- if (ret <= 0)
- break;
- *have += ret;
- } while (*have < len);
- if (ret < 0) {
- gz_error(state, Z_ERRNO, "Load Error");
- return -1;
- }
- if (ret == 0)
- state->eof = 1;
- return 0;
-}
-
-/* Load up input buffer and set eof flag if last data loaded -- return -1 on
- error, 0 otherwise. Note that the eof flag is set when the end of the input
- file is reached, even though there may be unused data in the buffer. Once
- that data has been used, no more attempts will be made to read the file.
- If strm->avail_in != 0, then the current data is moved to the beginning of
- the input buffer, and then the remainder of the buffer is loaded with the
- available data from the input file. */
-local int gz_avail(state)
- gz_statep state;
-{
- unsigned got;
- z_streamp strm = &(state->strm);
-
- if (state->err != Z_OK && state->err != Z_BUF_ERROR)
- return -1;
- if (state->eof == 0) {
- if (strm->avail_in)
- memmove(state->in, strm->next_in, strm->avail_in);
- if (gz_load(state, state->in + strm->avail_in,
- state->size - strm->avail_in, &got) == -1)
- return -1;
- strm->avail_in += got;
- strm->next_in = state->in;
- }
- return 0;
-}
-
-/* Look for gzip header, set up for inflate or copy. state->x.have must be 0.
- If this is the first time in, allocate required memory. state->how will be
- left unchanged if there is no more input data available, will be set to COPY
- if there is no gzip header and direct copying will be performed, or it will
- be set to GZIP for decompression. If direct copying, then leftover input
- data from the input buffer will be copied to the output buffer. In that
- case, all further file reads will be directly to either the output buffer or
- a user buffer. If decompressing, the inflate state will be initialized.
- gz_look() will return 0 on success or -1 on failure. */
-local int gz_look(state)
- gz_statep state;
-{
- z_streamp strm = &(state->strm);
-
- /* allocate read buffers and inflate memory */
- if (state->size == 0) {
- /* allocate buffers */
- state->in = malloc(state->want);
- state->out = malloc(state->want << 1);
- if (state->in == NULL || state->out == NULL) {
- if (state->out != NULL)
- free(state->out);
- if (state->in != NULL)
- free(state->in);
- gz_error(state, Z_MEM_ERROR, "out of memory");
- return -1;
- }
- state->size = state->want;
-
- /* allocate inflate memory */
- state->strm.zalloc = Z_NULL;
- state->strm.zfree = Z_NULL;
- state->strm.opaque = Z_NULL;
- state->strm.avail_in = 0;
- state->strm.next_in = Z_NULL;
- if (inflateInit2(&(state->strm), 15 + 16) != Z_OK) { /* gunzip */
- free(state->out);
- free(state->in);
- state->size = 0;
- gz_error(state, Z_MEM_ERROR, "out of memory");
- return -1;
- }
- }
-
- /* get at least the magic bytes in the input buffer */
- if (strm->avail_in < 2) {
- if (gz_avail(state) == -1)
- return -1;
- if (strm->avail_in == 0)
- return 0;
- }
-
- /* look for gzip magic bytes -- if there, do gzip decoding (note: there is
- a logical dilemma here when considering the case of a partially written
- gzip file, to wit, if a single 31 byte is written, then we cannot tell
- whether this is a single-byte file, or just a partially written gzip
- file -- for here we assume that if a gzip file is being written, then
- the header will be written in a single operation, so that reading a
- single byte is sufficient indication that it is not a gzip file) */
- if (strm->avail_in > 1 &&
- strm->next_in[0] == 31 && strm->next_in[1] == 139) {
- inflateReset(strm);
- state->how = GZIP;
- state->direct = 0;
- return 0;
- }
-
- /* no gzip header -- if we were decoding gzip before, then this is trailing
- garbage. Ignore the trailing garbage and finish. */
- if (state->direct == 0) {
- strm->avail_in = 0;
- state->eof = 1;
- state->x.have = 0;
- return 0;
- }
-
- /* doing raw i/o, copy any leftover input to output -- this assumes that
- the output buffer is larger than the input buffer, which also assures
- space for gzungetc() */
- state->x.next = state->out;
- if (strm->avail_in) {
- memcpy(state->x.next, strm->next_in, strm->avail_in);
- state->x.have = strm->avail_in;
- strm->avail_in = 0;
- }
- state->how = COPY;
- state->direct = 1;
- return 0;
-}
-
-/* Decompress from input to the provided next_out and avail_out in the state.
- On return, state->x.have and state->x.next point to the just decompressed
- data. If the gzip stream completes, state->how is reset to LOOK to look for
- the next gzip stream or raw data, once state->x.have is depleted. Returns 0
- on success, -1 on failure. */
-local int gz_decomp(state)
- gz_statep state;
-{
- int ret = Z_OK;
- unsigned had;
- z_streamp strm = &(state->strm);
-
- /* fill output buffer up to end of deflate stream */
- had = strm->avail_out;
- do {
- /* get more input for inflate() */
- if (strm->avail_in == 0 && gz_avail(state) == -1)
- return -1;
- if (strm->avail_in == 0) {
- gz_error(state, Z_BUF_ERROR, "unexpected end of file");
- break;
- }
-
- /* decompress and handle errors */
- ret = inflate(strm, Z_NO_FLUSH);
- if (ret == Z_STREAM_ERROR || ret == Z_NEED_DICT) {
- gz_error(state, Z_STREAM_ERROR,
- "internal error: inflate stream corrupt");
- return -1;
- }
- if (ret == Z_MEM_ERROR) {
- gz_error(state, Z_MEM_ERROR, "out of memory");
- return -1;
- }
- if (ret == Z_DATA_ERROR) { /* deflate stream invalid */
- gz_error(state, Z_DATA_ERROR,
- strm->msg == NULL ? "compressed data error" : strm->msg);
- return -1;
- }
- } while (strm->avail_out && ret != Z_STREAM_END);
-
- /* update available output */
- state->x.have = had - strm->avail_out;
- state->x.next = strm->next_out - state->x.have;
-
- /* if the gzip stream completed successfully, look for another */
- if (ret == Z_STREAM_END)
- state->how = LOOK;
-
- /* good decompression */
- return 0;
-}
-
-/* Fetch data and put it in the output buffer. Assumes state->x.have is 0.
- Data is either copied from the input file or decompressed from the input
- file depending on state->how. If state->how is LOOK, then a gzip header is
- looked for to determine whether to copy or decompress. Returns -1 on error,
- otherwise 0. gz_fetch() will leave state->how as COPY or GZIP unless the
- end of the input file has been reached and all data has been processed. */
-local int gz_fetch(state)
- gz_statep state;
-{
- z_streamp strm = &(state->strm);
-
- do {
- switch(state->how) {
- case LOOK: /* -> LOOK, COPY (only if never GZIP), or GZIP */
- if (gz_look(state) == -1)
- return -1;
- if (state->how == LOOK)
- return 0;
- break;
- case COPY: /* -> COPY */
- if (gz_load(state, state->out, state->size << 1, &(state->x.have))
- == -1)
- return -1;
- state->x.next = state->out;
- return 0;
- case GZIP: /* -> GZIP or LOOK (if end of gzip stream) */
- strm->avail_out = state->size << 1;
- strm->next_out = state->out;
- if (gz_decomp(state) == -1)
- return -1;
- }
- } while (state->x.have == 0 && (!state->eof || strm->avail_in));
- return 0;
-}
-
-/* Skip len uncompressed bytes of output. Return -1 on error, 0 on success. */
-local int gz_skip(state, len)
- gz_statep state;
- z_off64_t len;
-{
- unsigned n;
-
- /* skip over len bytes or reach end-of-file, whichever comes first */
- while (len)
- /* skip over whatever is in output buffer */
- if (state->x.have) {
- n = GT_OFF(state->x.have) || (z_off64_t)state->x.have > len ?
- (unsigned)len : state->x.have;
- state->x.have -= n;
- state->x.next += n;
- state->x.pos += n;
- len -= n;
- }
-
- /* output buffer empty -- return if we're at the end of the input */
- else if (state->eof && state->strm.avail_in == 0)
- break;
-
- /* need more data to skip -- load up output buffer */
- else {
- /* get more output, looking for header if required */
- if (gz_fetch(state) == -1)
- return -1;
- }
- return 0;
-}
-
-/* -- see zlib.h -- */
-int ZEXPORT gzread(file, buf, len)
- gzFile file;
- voidp buf;
- unsigned len;
-{
- unsigned got, n;
- gz_statep state;
- z_streamp strm;
-
- /* get internal structure */
- if (file == NULL)
- return -1;
- state = (gz_statep)file;
- strm = &(state->strm);
-
- /* check that we're reading and that there's no (serious) error */
- if (state->mode != GZ_READ ||
- (state->err != Z_OK && state->err != Z_BUF_ERROR))
- return -1;
-
- /* since an int is returned, make sure len fits in one, otherwise return
- with an error (this avoids the flaw in the interface) */
- if ((int)len < 0) {
- gz_error(state, Z_DATA_ERROR, "requested length does not fit in int");
- return -1;
- }
-
- /* if len is zero, avoid unnecessary operations */
- if (len == 0)
- return 0;
-
- /* process a skip request */
- if (state->seek) {
- state->seek = 0;
- if (gz_skip(state, state->skip) == -1)
- return -1;
- }
-
- /* get len bytes to buf, or less than len if at the end */
- got = 0;
- do {
- /* first just try copying data from the output buffer */
- if (state->x.have) {
- n = state->x.have > len ? len : state->x.have;
- memcpy(buf, state->x.next, n);
- state->x.next += n;
- state->x.have -= n;
- }
-
- /* output buffer empty -- return if we're at the end of the input */
- else if (state->eof && strm->avail_in == 0) {
- state->past = 1; /* tried to read past end */
- break;
- }
-
- /* need output data -- for small len or new stream load up our output
- buffer */
- else if (state->how == LOOK || len < (state->size << 1)) {
- /* get more output, looking for header if required */
- if (gz_fetch(state) == -1)
- return -1;
- continue; /* no progress yet -- go back to memcpy() above */
- /* the copy above assures that we will leave with space in the
- output buffer, allowing at least one gzungetc() to succeed */
- }
-
- /* large len -- read directly into user buffer */
- else if (state->how == COPY) { /* read directly */
- if (gz_load(state, buf, len, &n) == -1)
- return -1;
- }
-
- /* large len -- decompress directly into user buffer */
- else { /* state->how == GZIP */
- strm->avail_out = len;
- strm->next_out = buf;
- if (gz_decomp(state) == -1)
- return -1;
- n = state->x.have;
- state->x.have = 0;
- }
-
- /* update progress */
- len -= n;
- buf = (char *)buf + n;
- got += n;
- state->x.pos += n;
- } while (len);
-
- /* return number of bytes read into user buffer (will fit in int) */
- return (int)got;
-}
-
-/* -- see zlib.h -- */
-int ZEXPORT gzgetc_(file)
- gzFile file;
-{
- int ret;
- unsigned char buf[1];
- gz_statep state;
-
- /* get internal structure */
- if (file == NULL)
- return -1;
- state = (gz_statep)file;
-
- /* check that we're reading and that there's no (serious) error */
- if (state->mode != GZ_READ ||
- (state->err != Z_OK && state->err != Z_BUF_ERROR))
- return -1;
-
- /* try output buffer (no need to check for skip request) */
- if (state->x.have) {
- state->x.have--;
- state->x.pos++;
- return *(state->x.next)++;
- }
-
- /* nothing there -- try gzread() */
- ret = gzread(file, buf, 1);
- return ret < 1 ? -1 : buf[0];
-}
-
-#undef gzgetc
-int ZEXPORT gzgetc(file)
-gzFile file;
-{
- return gzgetc_(file);
-}
-
-/* -- see zlib.h -- */
-int ZEXPORT gzungetc(c, file)
- int c;
- gzFile file;
-{
- gz_statep state;
-
- /* get internal structure */
- if (file == NULL)
- return -1;
- state = (gz_statep)file;
-
- /* check that we're reading and that there's no (serious) error */
- if (state->mode != GZ_READ ||
- (state->err != Z_OK && state->err != Z_BUF_ERROR))
- return -1;
-
- /* process a skip request */
- if (state->seek) {
- state->seek = 0;
- if (gz_skip(state, state->skip) == -1)
- return -1;
- }
-
- /* can't push EOF */
- if (c < 0)
- return -1;
-
- /* if output buffer empty, put byte at end (allows more pushing) */
- if (state->x.have == 0) {
- state->x.have = 1;
- state->x.next = state->out + (state->size << 1) - 1;
- state->x.next[0] = c;
- state->x.pos--;
- state->past = 0;
- return c;
- }
-
- /* if no room, give up (must have already done a gzungetc()) */
- if (state->x.have == (state->size << 1)) {
- gz_error(state, Z_DATA_ERROR, "out of room to push characters");
- return -1;
- }
-
- /* slide output data if needed and insert byte before existing data */
- if (state->x.next == state->out) {
- unsigned char *src = state->out + state->x.have;
- unsigned char *dest = state->out + (state->size << 1);
- while (src > state->out)
- *--dest = *--src;
- state->x.next = dest;
- }
- state->x.have++;
- state->x.next--;
- state->x.next[0] = c;
- state->x.pos--;
- state->past = 0;
- return c;
-}
-
-/* -- see zlib.h -- */
-char * ZEXPORT gzgets(file, buf, len)
- gzFile file;
- char *buf;
- int len;
-{
- unsigned left, n;
- char *str;
- unsigned char *eol;
- gz_statep state;
-
- /* check parameters and get internal structure */
- if (file == NULL || buf == NULL || len < 1)
- return NULL;
- state = (gz_statep)file;
-
- /* check that we're reading and that there's no (serious) error */
- if (state->mode != GZ_READ ||
- (state->err != Z_OK && state->err != Z_BUF_ERROR))
- return NULL;
-
- /* process a skip request */
- if (state->seek) {
- state->seek = 0;
- if (gz_skip(state, state->skip) == -1)
- return NULL;
- }
-
- /* copy output bytes up to new line or len - 1, whichever comes first --
- append a terminating zero to the string (we don't check for a zero in
- the contents, let the user worry about that) */
- str = buf;
- left = (unsigned)len - 1;
- if (left) do {
- /* assure that something is in the output buffer */
- if (state->x.have == 0 && gz_fetch(state) == -1)
- return NULL; /* error */
- if (state->x.have == 0) { /* end of file */
- state->past = 1; /* read past end */
- break; /* return what we have */
- }
-
- /* look for end-of-line in current output buffer */
- n = state->x.have > left ? left : state->x.have;
- eol = (char*)memchr(state->x.next, '\n', n);
- if (eol != NULL)
- n = (unsigned)(eol - state->x.next) + 1;
-
- /* copy through end-of-line, or remainder if not found */
- memcpy(buf, state->x.next, n);
- state->x.have -= n;
- state->x.next += n;
- state->x.pos += n;
- left -= n;
- buf += n;
- } while (left && eol == NULL);
-
- /* return terminated string, or if nothing, end of file */
- if (buf == str)
- return NULL;
- buf[0] = 0;
- return str;
-}
-
-/* -- see zlib.h -- */
-int ZEXPORT gzdirect(file)
- gzFile file;
-{
- gz_statep state;
-
- /* get internal structure */
- if (file == NULL)
- return 0;
- state = (gz_statep)file;
-
- /* if the state is not known, but we can find out, then do so (this is
- mainly for right after a gzopen() or gzdopen()) */
- if (state->mode == GZ_READ && state->how == LOOK && state->x.have == 0)
- (void)gz_look(state);
-
- /* return 1 if transparent, 0 if processing a gzip stream */
- return state->direct;
-}
-
-/* -- see zlib.h -- */
-int ZEXPORT gzclose_r(file)
- gzFile file;
-{
- int ret, err;
- gz_statep state;
-
- /* get internal structure */
- if (file == NULL)
- return Z_STREAM_ERROR;
- state = (gz_statep)file;
-
- /* check that we're reading */
- if (state->mode != GZ_READ)
- return Z_STREAM_ERROR;
-
- /* free memory and close file */
- if (state->size) {
- inflateEnd(&(state->strm));
- free(state->out);
- free(state->in);
- }
- err = state->err == Z_BUF_ERROR ? Z_BUF_ERROR : Z_OK;
- gz_error(state, Z_OK, NULL);
- free(state->path);
- ret = close(state->fd);
- free(state);
- return ret ? Z_ERRNO : err;
-}
diff --git a/sdk-modifications/libsrc/zlib/gzwrite.c b/sdk-modifications/libsrc/zlib/gzwrite.c
deleted file mode 100755
index c346a64..0000000
--- a/sdk-modifications/libsrc/zlib/gzwrite.c
+++ /dev/null
@@ -1,593 +0,0 @@
-/* gzwrite.c -- zlib functions for writing gzip files
- * Copyright (C) 2004, 2005, 2010, 2011, 2012 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-#include "gzguts.h"
-
-/* Local functions */
-local int gz_init OF((gz_statep));
-local int gz_comp OF((gz_statep, int));
-local int gz_zero OF((gz_statep, z_off64_t));
-
-/* Initialize state for writing a gzip file. Mark initialization by setting
- state->size to non-zero. Return -1 on failure or 0 on success. */
-local int gz_init(state)
- gz_statep state;
-{
- int ret;
- z_streamp strm = &(state->strm);
-
- /* allocate input buffer */
- state->in = malloc(state->want);
- if (state->in == NULL) {
- gz_error(state, Z_MEM_ERROR, "out of memory");
- return -1;
- }
-
- /* only need output buffer and deflate state if compressing */
- if (!state->direct) {
- /* allocate output buffer */
- state->out = malloc(state->want);
- if (state->out == NULL) {
- free(state->in);
- gz_error(state, Z_MEM_ERROR, "out of memory");
- return -1;
- }
-
- /* allocate deflate memory, set up for gzip compression */
- strm->zalloc = Z_NULL;
- strm->zfree = Z_NULL;
- strm->opaque = Z_NULL;
- ret = deflateInit2(strm, state->level, Z_DEFLATED,
- MAX_WBITS + 16, DEF_MEM_LEVEL, state->strategy);
- if (ret != Z_OK) {
- free(state->out);
- free(state->in);
- gz_error(state, Z_MEM_ERROR, "out of memory");
- return -1;
- }
- }
-
- /* mark state as initialized */
- state->size = state->want;
-
- /* initialize write buffer if compressing */
- if (!state->direct) {
- strm->avail_out = state->size;
- strm->next_out = state->out;
- state->x.next = strm->next_out;
- }
- return 0;
-}
-
-/* Compress whatever is at avail_in and next_in and write to the output file.
- Return -1 if there is an error writing to the output file, otherwise 0.
- flush is assumed to be a valid deflate() flush value. If flush is Z_FINISH,
- then the deflate() state is reset to start a new gzip stream. If gz->direct
- is true, then simply write to the output file without compressing, and
- ignore flush. */
-local int gz_comp(state, flush)
- gz_statep state;
- int flush;
-{
- int ret, got;
- unsigned have;
- z_streamp strm = &(state->strm);
-
- /* allocate memory if this is the first time through */
- if (state->size == 0 && gz_init(state) == -1)
- return -1;
-
- /* write directly if requested */
- if (state->direct) {
- got = write(state->fd, strm->next_in, strm->avail_in);
- if (got < 0 || (unsigned)got != strm->avail_in) {
- gz_error(state, Z_ERRNO, "Write Error");
- return -1;
- }
- strm->avail_in = 0;
- return 0;
- }
-
- /* run deflate() on provided input until it produces no more output */
- ret = Z_OK;
- do {
- /* write out current buffer contents if full, or if flushing, but if
- doing Z_FINISH then don't write until we get to Z_STREAM_END */
- if (strm->avail_out == 0 || (flush != Z_NO_FLUSH &&
- (flush != Z_FINISH || ret == Z_STREAM_END))) {
- have = (unsigned)(strm->next_out - state->x.next);
- if (have && ((got = write(state->fd, state->x.next, have)) < 0 ||
- (unsigned)got != have)) {
- gz_error(state, Z_ERRNO, "Flush Error");
- return -1;
- }
- if (strm->avail_out == 0) {
- strm->avail_out = state->size;
- strm->next_out = state->out;
- }
- state->x.next = strm->next_out;
- }
-
- /* compress */
- have = strm->avail_out;
- ret = deflate(strm, flush);
- if (ret == Z_STREAM_ERROR) {
- gz_error(state, Z_STREAM_ERROR,
- "internal error: deflate stream corrupt");
- return -1;
- }
- have -= strm->avail_out;
- } while (have);
-
- /* if that completed a deflate stream, allow another to start */
- if (flush == Z_FINISH)
- deflateReset(strm);
-
- /* all done, no errors */
- return 0;
-}
-
-/* Compress len zeros to output. Return -1 on error, 0 on success. */
-local int gz_zero(state, len)
- gz_statep state;
- z_off64_t len;
-{
- int first;
- unsigned n;
- z_streamp strm = &(state->strm);
-
- /* consume whatever's left in the input buffer */
- if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1)
- return -1;
-
- /* compress len zeros (len guaranteed > 0) */
- first = 1;
- while (len) {
- n = GT_OFF(state->size) || (z_off64_t)state->size > len ?
- (unsigned)len : state->size;
- if (first) {
- memset(state->in, 0, n);
- first = 0;
- }
- strm->avail_in = n;
- strm->next_in = state->in;
- state->x.pos += n;
- if (gz_comp(state, Z_NO_FLUSH) == -1)
- return -1;
- len -= n;
- }
- return 0;
-}
-
-/* -- see zlib.h -- */
-int ZEXPORT gzwrite(file, buf, len)
- gzFile file;
- voidpc buf;
- unsigned len;
-{
- unsigned put = len;
- unsigned n;
- gz_statep state;
- z_streamp strm;
-
- /* get internal structure */
- if (file == NULL)
- return 0;
- state = (gz_statep)file;
- strm = &(state->strm);
-
- /* check that we're writing and that there's no error */
- if (state->mode != GZ_WRITE || state->err != Z_OK)
- return 0;
-
- /* since an int is returned, make sure len fits in one, otherwise return
- with an error (this avoids the flaw in the interface) */
- if ((int)len < 0) {
- gz_error(state, Z_DATA_ERROR, "requested length does not fit in int");
- return 0;
- }
-
- /* if len is zero, avoid unnecessary operations */
- if (len == 0)
- return 0;
-
- /* allocate memory if this is the first time through */
- if (state->size == 0 && gz_init(state) == -1)
- return 0;
-
- /* check for seek request */
- if (state->seek) {
- state->seek = 0;
- if (gz_zero(state, state->skip) == -1)
- return 0;
- }
-
- /* for small len, copy to input buffer, otherwise compress directly */
- if (len < state->size) {
- /* copy to input buffer, compress when full */
- do {
- if (strm->avail_in == 0)
- strm->next_in = state->in;
- n = state->size - strm->avail_in;
- if (n > len)
- n = len;
- memcpy(strm->next_in + strm->avail_in, buf, n);
- strm->avail_in += n;
- state->x.pos += n;
- buf = (char *)buf + n;
- len -= n;
- if (len && gz_comp(state, Z_NO_FLUSH) == -1)
- return 0;
- } while (len);
- }
- else {
- /* consume whatever's left in the input buffer */
- if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1)
- return 0;
-
- /* directly compress user buffer to file */
- strm->avail_in = len;
- strm->next_in = (voidp)buf;
- state->x.pos += len;
- if (gz_comp(state, Z_NO_FLUSH) == -1)
- return 0;
- }
-
- /* input was all buffered or compressed (put will fit in int) */
- return (int)put;
-}
-
-/* -- see zlib.h -- */
-int ZEXPORT gzputc(file, c)
- gzFile file;
- int c;
-{
- unsigned char buf[1];
- gz_statep state;
- z_streamp strm;
-
- /* get internal structure */
- if (file == NULL)
- return -1;
- state = (gz_statep)file;
- strm = &(state->strm);
-
- /* check that we're writing and that there's no error */
- if (state->mode != GZ_WRITE || state->err != Z_OK)
- return -1;
-
- /* check for seek request */
- if (state->seek) {
- state->seek = 0;
- if (gz_zero(state, state->skip) == -1)
- return -1;
- }
-
- /* try writing to input buffer for speed (state->size == 0 if buffer not
- initialized) */
- if (strm->avail_in < state->size) {
- if (strm->avail_in == 0)
- strm->next_in = state->in;
- strm->next_in[strm->avail_in++] = c;
- state->x.pos++;
- return c & 0xff;
- }
-
- /* no room in buffer or not initialized, use gz_write() */
- buf[0] = c;
- if (gzwrite(file, buf, 1) != 1)
- return -1;
- return c & 0xff;
-}
-
-/* -- see zlib.h -- */
-int ZEXPORT gzputs(file, str)
- gzFile file;
- const char *str;
-{
- int ret;
- unsigned len;
-
- /* write string */
- len = (unsigned)strlen(str);
- ret = gzwrite(file, str, len);
- return ret == 0 && len != 0 ? -1 : ret;
-}
-
-#if defined(STDC) || defined(Z_HAVE_STDARG_H)
-#include <stdarg.h>
-
-/* -- see zlib.h -- */
-int ZEXPORTVA gzprintf (gzFile file, const char *format, ...)
-{
- int size, len;
- gz_statep state;
- z_streamp strm;
- va_list va;
-
- /* get internal structure */
- if (file == NULL)
- return -1;
- state = (gz_statep)file;
- strm = &(state->strm);
-
- /* check that we're writing and that there's no error */
- if (state->mode != GZ_WRITE || state->err != Z_OK)
- return 0;
-
- /* make sure we have some buffer space */
- if (state->size == 0 && gz_init(state) == -1)
- return 0;
-
- /* check for seek request */
- if (state->seek) {
- state->seek = 0;
- if (gz_zero(state, state->skip) == -1)
- return 0;
- }
-
- /* consume whatever's left in the input buffer */
- if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1)
- return 0;
-
- /* do the printf() into the input buffer, put length in len */
- size = (int)(state->size);
- state->in[size - 1] = 0;
- va_start(va, format);
-#ifdef NO_vsnprintf
-# ifdef HAS_vsprintf_void
- (void)vsprintf(state->in, format, va);
- va_end(va);
- for (len = 0; len < size; len++)
- if (state->in[len] == 0) break;
-# else
- len = vsprintf(state->in, format, va);
- va_end(va);
-# endif
-#else
-# ifdef HAS_vsnprintf_void
- (void)vsnprintf(state->in, size, format, va);
- va_end(va);
- len = strlen(state->in);
-# else
- len = vsnprintf((char *)(state->in), size, format, va);
- va_end(va);
-# endif
-#endif
-
- /* check that printf() results fit in buffer */
- if (len <= 0 || len >= (int)size || state->in[size - 1] != 0)
- return 0;
-
- /* update buffer and position, defer compression until needed */
- strm->avail_in = (unsigned)len;
- strm->next_in = state->in;
- state->x.pos += len;
- return len;
-}
-
-#else /* !STDC && !Z_HAVE_STDARG_H */
-
-/* -- see zlib.h -- */
-int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
- a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
- gzFile file;
- const char *format;
- int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
- a11, a12, a13, a14, a15, a16, a17, a18, a19, a20;
-{
- int size, len;
- gz_statep state;
- z_streamp strm;
-
- /* get internal structure */
- if (file == NULL)
- return -1;
- state = (gz_statep)file;
- strm = &(state->strm);
-
- /* check that can really pass pointer in ints */
- if (sizeof(int) != sizeof(void *))
- return 0;
-
- /* check that we're writing and that there's no error */
- if (state->mode != GZ_WRITE || state->err != Z_OK)
- return 0;
-
- /* make sure we have some buffer space */
- if (state->size == 0 && gz_init(state) == -1)
- return 0;
-
- /* check for seek request */
- if (state->seek) {
- state->seek = 0;
- if (gz_zero(state, state->skip) == -1)
- return 0;
- }
-
- /* consume whatever's left in the input buffer */
- if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1)
- return 0;
-
- /* do the printf() into the input buffer, put length in len */
- size = (int)(state->size);
- state->in[size - 1] = 0;
-#ifdef NO_snprintf
-# ifdef HAS_sprintf_void
- sprintf(state->in, format, a1, a2, a3, a4, a5, a6, a7, a8,
- a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
- for (len = 0; len < size; len++)
- if (state->in[len] == 0) break;
-# else
- len = sprintf(state->in, format, a1, a2, a3, a4, a5, a6, a7, a8,
- a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
-# endif
-#else
-# ifdef HAS_snprintf_void
- snprintf(state->in, size, format, a1, a2, a3, a4, a5, a6, a7, a8,
- a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
- len = strlen(state->in);
-# else
- len = snprintf(state->in, size, format, a1, a2, a3, a4, a5, a6, a7, a8,
- a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
-# endif
-#endif
-
- /* check that printf() results fit in buffer */
- if (len <= 0 || len >= (int)size || state->in[size - 1] != 0)
- return 0;
-
- /* update buffer and position, defer compression until needed */
- strm->avail_in = (unsigned)len;
- strm->next_in = state->in;
- state->x.pos += len;
- return len;
-}
-
-#endif
-
-/* -- see zlib.h -- */
-int ZEXPORT gzflush(file, flush)
- gzFile file;
- int flush;
-{
- gz_statep state;
-
- /* get internal structure */
- if (file == NULL)
- return -1;
- state = (gz_statep)file;
-
- /* check that we're writing and that there's no error */
- if (state->mode != GZ_WRITE || state->err != Z_OK)
- return Z_STREAM_ERROR;
-
- /* check flush parameter */
- if (flush < 0 || flush > Z_FINISH)
- return Z_STREAM_ERROR;
-
- /* check for seek request */
- if (state->seek) {
- state->seek = 0;
- if (gz_zero(state, state->skip) == -1)
- return -1;
- }
-
- /* compress remaining data with requested flush */
- gz_comp(state, flush);
- return state->err;
-}
-
-/* -- see zlib.h -- */
-int ZEXPORT gzsetparams(file, level, strategy)
- gzFile file;
- int level;
- int strategy;
-{
- gz_statep state;
- z_streamp strm;
-
- /* get internal structure */
- if (file == NULL)
- return Z_STREAM_ERROR;
- state = (gz_statep)file;
- strm = &(state->strm);
-
- /* check that we're writing and that there's no error */
- if (state->mode != GZ_WRITE || state->err != Z_OK)
- return Z_STREAM_ERROR;
-
- /* if no change is requested, then do nothing */
- if (level == state->level && strategy == state->strategy)
- return Z_OK;
-
- /* check for seek request */
- if (state->seek) {
- state->seek = 0;
- if (gz_zero(state, state->skip) == -1)
- return -1;
- }
-
- /* change compression parameters for subsequent input */
- if (state->size) {
- /* flush previous input with previous parameters before changing */
- if (strm->avail_in && gz_comp(state, Z_PARTIAL_FLUSH) == -1)
- return state->err;
- deflateParams(strm, level, strategy);
- }
- state->level = level;
- state->strategy = strategy;
- return Z_OK;
-}
-
-/* -- see zlib.h -- */
-int ZEXPORT gzclose_w(file)
- gzFile file;
-{
- int ret = Z_OK;
- gz_statep state;
-
- /* get internal structure */
- if (file == NULL)
- return Z_STREAM_ERROR;
- state = (gz_statep)file;
-
- /* check that we're writing */
- if (state->mode != GZ_WRITE)
- return Z_STREAM_ERROR;
-
- /* check for seek request */
- if (state->seek) {
- state->seek = 0;
- if (gz_zero(state, state->skip) == -1)
- ret = state->err;
- }
-
- /* flush, free memory, and close file */
- if (gz_comp(state, Z_FINISH) == -1)
- ret = state->err;
- if (!state->direct) {
- (void)deflateEnd(&(state->strm));
- free(state->out);
- }
- free(state->in);
- gz_error(state, Z_OK, NULL);
- free(state->path);
- if (close(state->fd) == -1)
- ret = Z_ERRNO;
- free(state);
- return ret;
-}
-
-/* used by zlibVersion() to get the vsnprintf story from the horse's mouth */
-unsigned long ZEXPORT gzflags()
-{
- unsigned long flags = 0;
-#if defined(STDC) || defined(Z_HAVE_STDARG_H)
-# ifdef NO_vsnprintf
- flags += 1L << 25;
-# ifdef HAS_vsprintf_void
- flags += 1L << 26;
-# endif
-# else
-# ifdef HAS_vsnprintf_void
- flags += 1L << 26;
-# endif
-# endif
-#else
- flags += 1L << 24;
-# ifdef NO_snprintf
- flags += 1L << 25;
-# ifdef HAS_sprintf_void
- flags += 1L << 26;
-# endif
-# else
-# ifdef HAS_snprintf_void
- flags += 1L << 26;
-# endif
-# endif
-#endif
- return flags;
-}
diff --git a/sdk-modifications/libsrc/zlib/infback.c b/sdk-modifications/libsrc/zlib/infback.c
deleted file mode 100755
index 981aff1..0000000
--- a/sdk-modifications/libsrc/zlib/infback.c
+++ /dev/null
@@ -1,640 +0,0 @@
-/* infback.c -- inflate using a call-back interface
- * Copyright (C) 1995-2011 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/*
- This code is largely copied from inflate.c. Normally either infback.o or
- inflate.o would be linked into an application--not both. The interface
- with inffast.c is retained so that optimized assembler-coded versions of
- inflate_fast() can be used with either inflate.c or infback.c.
- */
-
-#include "zutil.h"
-#include "inftrees.h"
-#include "inflate.h"
-#include "inffast.h"
-
-/* function prototypes */
-local void fixedtables OF((struct inflate_state FAR *state));
-
-/*
- strm provides memory allocation functions in zalloc and zfree, or
- Z_NULL to use the library memory allocation functions.
-
- windowBits is in the range 8..15, and window is a user-supplied
- window and output buffer that is 2**windowBits bytes.
- */
-int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size)
-z_streamp strm;
-int windowBits;
-unsigned char FAR *window;
-const char *version;
-int stream_size;
-{
- struct inflate_state FAR *state;
-
- if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
- stream_size != (int)(sizeof(z_stream)))
- return Z_VERSION_ERROR;
- if (strm == Z_NULL || window == Z_NULL ||
- windowBits < 8 || windowBits > 15)
- return Z_STREAM_ERROR;
- strm->msg = Z_NULL; /* in case we return an error */
- if (strm->zalloc == (alloc_func)0) {
-#ifdef Z_SOLO
- return Z_STREAM_ERROR;
-#else
- strm->zalloc = zcalloc;
- strm->opaque = (voidpf)0;
-#endif
- }
- if (strm->zfree == (free_func)0)
-#ifdef Z_SOLO
- return Z_STREAM_ERROR;
-#else
- strm->zfree = zcfree;
-#endif
- state = (struct inflate_state FAR *)ZALLOC(strm, 1,
- sizeof(struct inflate_state));
- if (state == Z_NULL) return Z_MEM_ERROR;
- Tracev((stderr, "inflate: allocated\n"));
- strm->state = (struct internal_state FAR *)state;
- state->dmax = 32768U;
- state->wbits = windowBits;
- state->wsize = 1U << windowBits;
- state->window = window;
- state->wnext = 0;
- state->whave = 0;
- return Z_OK;
-}
-
-/*
- Return state with length and distance decoding tables and index sizes set to
- fixed code decoding. Normally this returns fixed tables from inffixed.h.
- If BUILDFIXED is defined, then instead this routine builds the tables the
- first time it's called, and returns those tables the first time and
- thereafter. This reduces the size of the code by about 2K bytes, in
- exchange for a little execution time. However, BUILDFIXED should not be
- used for threaded applications, since the rewriting of the tables and virgin
- may not be thread-safe.
- */
-local void fixedtables(state)
-struct inflate_state FAR *state;
-{
-#ifdef BUILDFIXED
- static int virgin = 1;
- static code *lenfix, *distfix;
- static code fixed[544];
-
- /* build fixed huffman tables if first call (may not be thread safe) */
- if (virgin) {
- unsigned sym, bits;
- static code *next;
-
- /* literal/length table */
- sym = 0;
- while (sym < 144) state->lens[sym++] = 8;
- while (sym < 256) state->lens[sym++] = 9;
- while (sym < 280) state->lens[sym++] = 7;
- while (sym < 288) state->lens[sym++] = 8;
- next = fixed;
- lenfix = next;
- bits = 9;
- inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
-
- /* distance table */
- sym = 0;
- while (sym < 32) state->lens[sym++] = 5;
- distfix = next;
- bits = 5;
- inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
-
- /* do this just once */
- virgin = 0;
- }
-#else /* !BUILDFIXED */
-# include "inffixed.h"
-#endif /* BUILDFIXED */
- state->lencode = lenfix;
- state->lenbits = 9;
- state->distcode = distfix;
- state->distbits = 5;
-}
-
-/* Macros for inflateBack(): */
-
-/* Load returned state from inflate_fast() */
-#define LOAD() \
- do { \
- put = strm->next_out; \
- left = strm->avail_out; \
- next = strm->next_in; \
- have = strm->avail_in; \
- hold = state->hold; \
- bits = state->bits; \
- } while (0)
-
-/* Set state from registers for inflate_fast() */
-#define RESTORE() \
- do { \
- strm->next_out = put; \
- strm->avail_out = left; \
- strm->next_in = next; \
- strm->avail_in = have; \
- state->hold = hold; \
- state->bits = bits; \
- } while (0)
-
-/* Clear the input bit accumulator */
-#define INITBITS() \
- do { \
- hold = 0; \
- bits = 0; \
- } while (0)
-
-/* Assure that some input is available. If input is requested, but denied,
- then return a Z_BUF_ERROR from inflateBack(). */
-#define PULL() \
- do { \
- if (have == 0) { \
- have = in(in_desc, &next); \
- if (have == 0) { \
- next = Z_NULL; \
- ret = Z_BUF_ERROR; \
- goto inf_leave; \
- } \
- } \
- } while (0)
-
-/* Get a byte of input into the bit accumulator, or return from inflateBack()
- with an error if there is no input available. */
-#define PULLBYTE() \
- do { \
- PULL(); \
- have--; \
- hold += (unsigned long)(*next++) << bits; \
- bits += 8; \
- } while (0)
-
-/* Assure that there are at least n bits in the bit accumulator. If there is
- not enough available input to do that, then return from inflateBack() with
- an error. */
-#define NEEDBITS(n) \
- do { \
- while (bits < (unsigned)(n)) \
- PULLBYTE(); \
- } while (0)
-
-/* Return the low n bits of the bit accumulator (n < 16) */
-#define BITS(n) \
- ((unsigned)hold & ((1U << (n)) - 1))
-
-/* Remove n bits from the bit accumulator */
-#define DROPBITS(n) \
- do { \
- hold >>= (n); \
- bits -= (unsigned)(n); \
- } while (0)
-
-/* Remove zero to seven bits as needed to go to a byte boundary */
-#define BYTEBITS() \
- do { \
- hold >>= bits & 7; \
- bits -= bits & 7; \
- } while (0)
-
-/* Assure that some output space is available, by writing out the window
- if it's full. If the write fails, return from inflateBack() with a
- Z_BUF_ERROR. */
-#define ROOM() \
- do { \
- if (left == 0) { \
- put = state->window; \
- left = state->wsize; \
- state->whave = left; \
- if (out(out_desc, put, left)) { \
- ret = Z_BUF_ERROR; \
- goto inf_leave; \
- } \
- } \
- } while (0)
-
-/*
- strm provides the memory allocation functions and window buffer on input,
- and provides information on the unused input on return. For Z_DATA_ERROR
- returns, strm will also provide an error message.
-
- in() and out() are the call-back input and output functions. When
- inflateBack() needs more input, it calls in(). When inflateBack() has
- filled the window with output, or when it completes with data in the
- window, it calls out() to write out the data. The application must not
- change the provided input until in() is called again or inflateBack()
- returns. The application must not change the window/output buffer until
- inflateBack() returns.
-
- in() and out() are called with a descriptor parameter provided in the
- inflateBack() call. This parameter can be a structure that provides the
- information required to do the read or write, as well as accumulated
- information on the input and output such as totals and check values.
-
- in() should return zero on failure. out() should return non-zero on
- failure. If either in() or out() fails, than inflateBack() returns a
- Z_BUF_ERROR. strm->next_in can be checked for Z_NULL to see whether it
- was in() or out() that caused in the error. Otherwise, inflateBack()
- returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format
- error, or Z_MEM_ERROR if it could not allocate memory for the state.
- inflateBack() can also return Z_STREAM_ERROR if the input parameters
- are not correct, i.e. strm is Z_NULL or the state was not initialized.
- */
-int ZEXPORT inflateBack(strm, in, in_desc, out, out_desc)
-z_streamp strm;
-in_func in;
-void FAR *in_desc;
-out_func out;
-void FAR *out_desc;
-{
- struct inflate_state FAR *state;
- unsigned char FAR *next; /* next input */
- unsigned char FAR *put; /* next output */
- unsigned have, left; /* available input and output */
- unsigned long hold; /* bit buffer */
- unsigned bits; /* bits in bit buffer */
- unsigned copy; /* number of stored or match bytes to copy */
- unsigned char FAR *from; /* where to copy match bytes from */
- code here; /* current decoding table entry */
- code last; /* parent table entry */
- unsigned len; /* length to copy for repeats, bits to drop */
- int ret; /* return code */
- static const unsigned short order[19] = /* permutation of code lengths */
- {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
-
- /* Check that the strm exists and that the state was initialized */
- if (strm == Z_NULL || strm->state == Z_NULL)
- return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
-
- /* Reset the state */
- strm->msg = Z_NULL;
- state->mode = TYPE;
- state->last = 0;
- state->whave = 0;
- next = strm->next_in;
- have = next != Z_NULL ? strm->avail_in : 0;
- hold = 0;
- bits = 0;
- put = state->window;
- left = state->wsize;
-
- /* Inflate until end of block marked as last */
- for (;;)
- switch (state->mode) {
- case TYPE:
- /* determine and dispatch block type */
- if (state->last) {
- BYTEBITS();
- state->mode = DONE;
- break;
- }
- NEEDBITS(3);
- state->last = BITS(1);
- DROPBITS(1);
- switch (BITS(2)) {
- case 0: /* stored block */
- Tracev((stderr, "inflate: stored block%s\n",
- state->last ? " (last)" : ""));
- state->mode = STORED;
- break;
- case 1: /* fixed block */
- fixedtables(state);
- Tracev((stderr, "inflate: fixed codes block%s\n",
- state->last ? " (last)" : ""));
- state->mode = LEN; /* decode codes */
- break;
- case 2: /* dynamic block */
- Tracev((stderr, "inflate: dynamic codes block%s\n",
- state->last ? " (last)" : ""));
- state->mode = TABLE;
- break;
- case 3:
- strm->msg = (char *)"invalid block type";
- state->mode = BAD;
- }
- DROPBITS(2);
- break;
-
- case STORED:
- /* get and verify stored block length */
- BYTEBITS(); /* go to byte boundary */
- NEEDBITS(32);
- if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
- strm->msg = (char *)"invalid stored block lengths";
- state->mode = BAD;
- break;
- }
- state->length = (unsigned)hold & 0xffff;
- Tracev((stderr, "inflate: stored length %u\n",
- state->length));
- INITBITS();
-
- /* copy stored block from input to output */
- while (state->length != 0) {
- copy = state->length;
- PULL();
- ROOM();
- if (copy > have) copy = have;
- if (copy > left) copy = left;
- zmemcpy(put, next, copy);
- have -= copy;
- next += copy;
- left -= copy;
- put += copy;
- state->length -= copy;
- }
- Tracev((stderr, "inflate: stored end\n"));
- state->mode = TYPE;
- break;
-
- case TABLE:
- /* get dynamic table entries descriptor */
- NEEDBITS(14);
- state->nlen = BITS(5) + 257;
- DROPBITS(5);
- state->ndist = BITS(5) + 1;
- DROPBITS(5);
- state->ncode = BITS(4) + 4;
- DROPBITS(4);
-#ifndef PKZIP_BUG_WORKAROUND
- if (state->nlen > 286 || state->ndist > 30) {
- strm->msg = (char *)"too many length or distance symbols";
- state->mode = BAD;
- break;
- }
-#endif
- Tracev((stderr, "inflate: table sizes ok\n"));
-
- /* get code length code lengths (not a typo) */
- state->have = 0;
- while (state->have < state->ncode) {
- NEEDBITS(3);
- state->lens[order[state->have++]] = (unsigned short)BITS(3);
- DROPBITS(3);
- }
- while (state->have < 19)
- state->lens[order[state->have++]] = 0;
- state->next = state->codes;
- state->lencode = (code const FAR *)(state->next);
- state->lenbits = 7;
- ret = inflate_table(CODES, state->lens, 19, &(state->next),
- &(state->lenbits), state->work);
- if (ret) {
- strm->msg = (char *)"invalid code lengths set";
- state->mode = BAD;
- break;
- }
- Tracev((stderr, "inflate: code lengths ok\n"));
-
- /* get length and distance code code lengths */
- state->have = 0;
- while (state->have < state->nlen + state->ndist) {
- for (;;) {
- here = state->lencode[BITS(state->lenbits)];
- if ((unsigned)(here.bits) <= bits) break;
- PULLBYTE();
- }
- if (here.val < 16) {
- DROPBITS(here.bits);
- state->lens[state->have++] = here.val;
- }
- else {
- if (here.val == 16) {
- NEEDBITS(here.bits + 2);
- DROPBITS(here.bits);
- if (state->have == 0) {
- strm->msg = (char *)"invalid bit length repeat";
- state->mode = BAD;
- break;
- }
- len = (unsigned)(state->lens[state->have - 1]);
- copy = 3 + BITS(2);
- DROPBITS(2);
- }
- else if (here.val == 17) {
- NEEDBITS(here.bits + 3);
- DROPBITS(here.bits);
- len = 0;
- copy = 3 + BITS(3);
- DROPBITS(3);
- }
- else {
- NEEDBITS(here.bits + 7);
- DROPBITS(here.bits);
- len = 0;
- copy = 11 + BITS(7);
- DROPBITS(7);
- }
- if (state->have + copy > state->nlen + state->ndist) {
- strm->msg = (char *)"invalid bit length repeat";
- state->mode = BAD;
- break;
- }
- while (copy--)
- state->lens[state->have++] = (unsigned short)len;
- }
- }
-
- /* handle error breaks in while */
- if (state->mode == BAD) break;
-
- /* check for end-of-block code (better have one) */
- if (state->lens[256] == 0) {
- strm->msg = (char *)"invalid code -- missing end-of-block";
- state->mode = BAD;
- break;
- }
-
- /* build code tables -- note: do not change the lenbits or distbits
- values here (9 and 6) without reading the comments in inftrees.h
- concerning the ENOUGH constants, which depend on those values */
- state->next = state->codes;
- state->lencode = (code const FAR *)(state->next);
- state->lenbits = 9;
- ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
- &(state->lenbits), state->work);
- if (ret) {
- strm->msg = (char *)"invalid literal/lengths set";
- state->mode = BAD;
- break;
- }
- state->distcode = (code const FAR *)(state->next);
- state->distbits = 6;
- ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
- &(state->next), &(state->distbits), state->work);
- if (ret) {
- strm->msg = (char *)"invalid distances set";
- state->mode = BAD;
- break;
- }
- Tracev((stderr, "inflate: codes ok\n"));
- state->mode = LEN;
-
- case LEN:
- /* use inflate_fast() if we have enough input and output */
- if (have >= 6 && left >= 258) {
- RESTORE();
- if (state->whave < state->wsize)
- state->whave = state->wsize - left;
- inflate_fast(strm, state->wsize);
- LOAD();
- break;
- }
-
- /* get a literal, length, or end-of-block code */
- for (;;) {
- here = state->lencode[BITS(state->lenbits)];
- if ((unsigned)(here.bits) <= bits) break;
- PULLBYTE();
- }
- if (here.op && (here.op & 0xf0) == 0) {
- last = here;
- for (;;) {
- here = state->lencode[last.val +
- (BITS(last.bits + last.op) >> last.bits)];
- if ((unsigned)(last.bits + here.bits) <= bits) break;
- PULLBYTE();
- }
- DROPBITS(last.bits);
- }
- DROPBITS(here.bits);
- state->length = (unsigned)here.val;
-
- /* process literal */
- if (here.op == 0) {
- Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
- "inflate: literal '%c'\n" :
- "inflate: literal 0x%02x\n", here.val));
- ROOM();
- *put++ = (unsigned char)(state->length);
- left--;
- state->mode = LEN;
- break;
- }
-
- /* process end of block */
- if (here.op & 32) {
- Tracevv((stderr, "inflate: end of block\n"));
- state->mode = TYPE;
- break;
- }
-
- /* invalid code */
- if (here.op & 64) {
- strm->msg = (char *)"invalid literal/length code";
- state->mode = BAD;
- break;
- }
-
- /* length code -- get extra bits, if any */
- state->extra = (unsigned)(here.op) & 15;
- if (state->extra != 0) {
- NEEDBITS(state->extra);
- state->length += BITS(state->extra);
- DROPBITS(state->extra);
- }
- Tracevv((stderr, "inflate: length %u\n", state->length));
-
- /* get distance code */
- for (;;) {
- here = state->distcode[BITS(state->distbits)];
- if ((unsigned)(here.bits) <= bits) break;
- PULLBYTE();
- }
- if ((here.op & 0xf0) == 0) {
- last = here;
- for (;;) {
- here = state->distcode[last.val +
- (BITS(last.bits + last.op) >> last.bits)];
- if ((unsigned)(last.bits + here.bits) <= bits) break;
- PULLBYTE();
- }
- DROPBITS(last.bits);
- }
- DROPBITS(here.bits);
- if (here.op & 64) {
- strm->msg = (char *)"invalid distance code";
- state->mode = BAD;
- break;
- }
- state->offset = (unsigned)here.val;
-
- /* get distance extra bits, if any */
- state->extra = (unsigned)(here.op) & 15;
- if (state->extra != 0) {
- NEEDBITS(state->extra);
- state->offset += BITS(state->extra);
- DROPBITS(state->extra);
- }
- if (state->offset > state->wsize - (state->whave < state->wsize ?
- left : 0)) {
- strm->msg = (char *)"invalid distance too far back";
- state->mode = BAD;
- break;
- }
- Tracevv((stderr, "inflate: distance %u\n", state->offset));
-
- /* copy match from window to output */
- do {
- ROOM();
- copy = state->wsize - state->offset;
- if (copy < left) {
- from = put + copy;
- copy = left - copy;
- }
- else {
- from = put - state->offset;
- copy = left;
- }
- if (copy > state->length) copy = state->length;
- state->length -= copy;
- left -= copy;
- do {
- *put++ = *from++;
- } while (--copy);
- } while (state->length != 0);
- break;
-
- case DONE:
- /* inflate stream terminated properly -- write leftover output */
- ret = Z_STREAM_END;
- if (left < state->wsize) {
- if (out(out_desc, state->window, state->wsize - left))
- ret = Z_BUF_ERROR;
- }
- goto inf_leave;
-
- case BAD:
- ret = Z_DATA_ERROR;
- goto inf_leave;
-
- default: /* can't happen, but makes compilers happy */
- ret = Z_STREAM_ERROR;
- goto inf_leave;
- }
-
- /* Return unused input */
- inf_leave:
- strm->next_in = next;
- strm->avail_in = have;
- return ret;
-}
-
-int ZEXPORT inflateBackEnd(strm)
-z_streamp strm;
-{
- if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
- return Z_STREAM_ERROR;
- ZFREE(strm, strm->state);
- strm->state = Z_NULL;
- Tracev((stderr, "inflate: end\n"));
- return Z_OK;
-}
diff --git a/sdk-modifications/libsrc/zlib/inffast.c b/sdk-modifications/libsrc/zlib/inffast.c
deleted file mode 100755
index 2f1d60b..0000000
--- a/sdk-modifications/libsrc/zlib/inffast.c
+++ /dev/null
@@ -1,340 +0,0 @@
-/* inffast.c -- fast decoding
- * Copyright (C) 1995-2008, 2010 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-#include "zutil.h"
-#include "inftrees.h"
-#include "inflate.h"
-#include "inffast.h"
-
-#ifndef ASMINF
-
-/* Allow machine dependent optimization for post-increment or pre-increment.
- Based on testing to date,
- Pre-increment preferred for:
- - PowerPC G3 (Adler)
- - MIPS R5000 (Randers-Pehrson)
- Post-increment preferred for:
- - none
- No measurable difference:
- - Pentium III (Anderson)
- - M68060 (Nikl)
- */
-#ifdef POSTINC
-# define OFF 0
-# define PUP(a) *(a)++
-#else
-# define OFF 1
-# define PUP(a) *++(a)
-#endif
-
-/*
- Decode literal, length, and distance codes and write out the resulting
- literal and match bytes until either not enough input or output is
- available, an end-of-block is encountered, or a data error is encountered.
- When large enough input and output buffers are supplied to inflate(), for
- example, a 16K input buffer and a 64K output buffer, more than 95% of the
- inflate execution time is spent in this routine.
-
- Entry assumptions:
-
- state->mode == LEN
- strm->avail_in >= 6
- strm->avail_out >= 258
- start >= strm->avail_out
- state->bits < 8
-
- On return, state->mode is one of:
-
- LEN -- ran out of enough output space or enough available input
- TYPE -- reached end of block code, inflate() to interpret next block
- BAD -- error in block data
-
- Notes:
-
- - The maximum input bits used by a length/distance pair is 15 bits for the
- length code, 5 bits for the length extra, 15 bits for the distance code,
- and 13 bits for the distance extra. This totals 48 bits, or six bytes.
- Therefore if strm->avail_in >= 6, then there is enough input to avoid
- checking for available input while decoding.
-
- - The maximum bytes that a single length/distance pair can output is 258
- bytes, which is the maximum length that can be coded. inflate_fast()
- requires strm->avail_out >= 258 for each loop to avoid checking for
- output space.
- */
-void ZLIB_INTERNAL inflate_fast(strm, start)
-z_streamp strm;
-unsigned start; /* inflate()'s starting value for strm->avail_out */
-{
- struct inflate_state FAR *state;
- unsigned char FAR *in; /* local strm->next_in */
- unsigned char FAR *last; /* while in < last, enough input available */
- unsigned char FAR *out; /* local strm->next_out */
- unsigned char FAR *beg; /* inflate()'s initial strm->next_out */
- unsigned char FAR *end; /* while out < end, enough space available */
-#ifdef INFLATE_STRICT
- unsigned dmax; /* maximum distance from zlib header */
-#endif
- unsigned wsize; /* window size or zero if not using window */
- unsigned whave; /* valid bytes in the window */
- unsigned wnext; /* window write index */
- unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */
- unsigned long hold; /* local strm->hold */
- unsigned bits; /* local strm->bits */
- code const FAR *lcode; /* local strm->lencode */
- code const FAR *dcode; /* local strm->distcode */
- unsigned lmask; /* mask for first level of length codes */
- unsigned dmask; /* mask for first level of distance codes */
- code here; /* retrieved table entry */
- unsigned op; /* code bits, operation, extra bits, or */
- /* window position, window bytes to copy */
- unsigned len; /* match length, unused bytes */
- unsigned dist; /* match distance */
- unsigned char FAR *from; /* where to copy match from */
-
- /* copy state to local variables */
- state = (struct inflate_state FAR *)strm->state;
- in = strm->next_in - OFF;
- last = in + (strm->avail_in - 5);
- out = strm->next_out - OFF;
- beg = out - (start - strm->avail_out);
- end = out + (strm->avail_out - 257);
-#ifdef INFLATE_STRICT
- dmax = state->dmax;
-#endif
- wsize = state->wsize;
- whave = state->whave;
- wnext = state->wnext;
- window = state->window;
- hold = state->hold;
- bits = state->bits;
- lcode = state->lencode;
- dcode = state->distcode;
- lmask = (1U << state->lenbits) - 1;
- dmask = (1U << state->distbits) - 1;
-
- /* decode literals and length/distances until end-of-block or not enough
- input data or output space */
- do {
- if (bits < 15) {
- hold += (unsigned long)(PUP(in)) << bits;
- bits += 8;
- hold += (unsigned long)(PUP(in)) << bits;
- bits += 8;
- }
- here = lcode[hold & lmask];
- dolen:
- op = (unsigned)(here.bits);
- hold >>= op;
- bits -= op;
- op = (unsigned)(here.op);
- if (op == 0) { /* literal */
- Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
- "inflate: literal '%c'\n" :
- "inflate: literal 0x%02x\n", here.val));
- PUP(out) = (unsigned char)(here.val);
- }
- else if (op & 16) { /* length base */
- len = (unsigned)(here.val);
- op &= 15; /* number of extra bits */
- if (op) {
- if (bits < op) {
- hold += (unsigned long)(PUP(in)) << bits;
- bits += 8;
- }
- len += (unsigned)hold & ((1U << op) - 1);
- hold >>= op;
- bits -= op;
- }
- Tracevv((stderr, "inflate: length %u\n", len));
- if (bits < 15) {
- hold += (unsigned long)(PUP(in)) << bits;
- bits += 8;
- hold += (unsigned long)(PUP(in)) << bits;
- bits += 8;
- }
- here = dcode[hold & dmask];
- dodist:
- op = (unsigned)(here.bits);
- hold >>= op;
- bits -= op;
- op = (unsigned)(here.op);
- if (op & 16) { /* distance base */
- dist = (unsigned)(here.val);
- op &= 15; /* number of extra bits */
- if (bits < op) {
- hold += (unsigned long)(PUP(in)) << bits;
- bits += 8;
- if (bits < op) {
- hold += (unsigned long)(PUP(in)) << bits;
- bits += 8;
- }
- }
- dist += (unsigned)hold & ((1U << op) - 1);
-#ifdef INFLATE_STRICT
- if (dist > dmax) {
- strm->msg = (char *)"invalid distance too far back";
- state->mode = BAD;
- break;
- }
-#endif
- hold >>= op;
- bits -= op;
- Tracevv((stderr, "inflate: distance %u\n", dist));
- op = (unsigned)(out - beg); /* max distance in output */
- if (dist > op) { /* see if copy from window */
- op = dist - op; /* distance back in window */
- if (op > whave) {
- if (state->sane) {
- strm->msg =
- (char *)"invalid distance too far back";
- state->mode = BAD;
- break;
- }
-#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
- if (len <= op - whave) {
- do {
- PUP(out) = 0;
- } while (--len);
- continue;
- }
- len -= op - whave;
- do {
- PUP(out) = 0;
- } while (--op > whave);
- if (op == 0) {
- from = out - dist;
- do {
- PUP(out) = PUP(from);
- } while (--len);
- continue;
- }
-#endif
- }
- from = window - OFF;
- if (wnext == 0) { /* very common case */
- from += wsize - op;
- if (op < len) { /* some from window */
- len -= op;
- do {
- PUP(out) = PUP(from);
- } while (--op);
- from = out - dist; /* rest from output */
- }
- }
- else if (wnext < op) { /* wrap around window */
- from += wsize + wnext - op;
- op -= wnext;
- if (op < len) { /* some from end of window */
- len -= op;
- do {
- PUP(out) = PUP(from);
- } while (--op);
- from = window - OFF;
- if (wnext < len) { /* some from start of window */
- op = wnext;
- len -= op;
- do {
- PUP(out) = PUP(from);
- } while (--op);
- from = out - dist; /* rest from output */
- }
- }
- }
- else { /* contiguous in window */
- from += wnext - op;
- if (op < len) { /* some from window */
- len -= op;
- do {
- PUP(out) = PUP(from);
- } while (--op);
- from = out - dist; /* rest from output */
- }
- }
- while (len > 2) {
- PUP(out) = PUP(from);
- PUP(out) = PUP(from);
- PUP(out) = PUP(from);
- len -= 3;
- }
- if (len) {
- PUP(out) = PUP(from);
- if (len > 1)
- PUP(out) = PUP(from);
- }
- }
- else {
- from = out - dist; /* copy direct from output */
- do { /* minimum length is three */
- PUP(out) = PUP(from);
- PUP(out) = PUP(from);
- PUP(out) = PUP(from);
- len -= 3;
- } while (len > 2);
- if (len) {
- PUP(out) = PUP(from);
- if (len > 1)
- PUP(out) = PUP(from);
- }
- }
- }
- else if ((op & 64) == 0) { /* 2nd level distance code */
- here = dcode[here.val + (hold & ((1U << op) - 1))];
- goto dodist;
- }
- else {
- strm->msg = (char *)"invalid distance code";
- state->mode = BAD;
- break;
- }
- }
- else if ((op & 64) == 0) { /* 2nd level length code */
- here = lcode[here.val + (hold & ((1U << op) - 1))];
- goto dolen;
- }
- else if (op & 32) { /* end-of-block */
- Tracevv((stderr, "inflate: end of block\n"));
- state->mode = TYPE;
- break;
- }
- else {
- strm->msg = (char *)"invalid literal/length code";
- state->mode = BAD;
- break;
- }
- } while (in < last && out < end);
-
- /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
- len = bits >> 3;
- in -= len;
- bits -= len << 3;
- hold &= (1U << bits) - 1;
-
- /* update state and return */
- strm->next_in = in + OFF;
- strm->next_out = out + OFF;
- strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));
- strm->avail_out = (unsigned)(out < end ?
- 257 + (end - out) : 257 - (out - end));
- state->hold = hold;
- state->bits = bits;
- return;
-}
-
-/*
- inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe):
- - Using bit fields for code structure
- - Different op definition to avoid & for extra bits (do & for table bits)
- - Three separate decoding do-loops for direct, window, and wnext == 0
- - Special case for distance > 1 copies to do overlapped load and store copy
- - Explicit branch predictions (based on measured branch probabilities)
- - Deferring match copy and interspersed it with decoding subsequent codes
- - Swapping literal/length else
- - Swapping window/direct else
- - Larger unrolled copy loops (three is about right)
- - Moving len -= 3 statement into middle of loop
- */
-
-#endif /* !ASMINF */
diff --git a/sdk-modifications/libsrc/zlib/inffast.h b/sdk-modifications/libsrc/zlib/inffast.h
deleted file mode 100755
index e5c1aa4..0000000
--- a/sdk-modifications/libsrc/zlib/inffast.h
+++ /dev/null
@@ -1,11 +0,0 @@
-/* inffast.h -- header to use inffast.c
- * Copyright (C) 1995-2003, 2010 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* WARNING: this file should *not* be used by applications. It is
- part of the implementation of the compression library and is
- subject to change. Applications should only use zlib.h.
- */
-
-void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start));
diff --git a/sdk-modifications/libsrc/zlib/inffixed.h b/sdk-modifications/libsrc/zlib/inffixed.h
deleted file mode 100755
index d628327..0000000
--- a/sdk-modifications/libsrc/zlib/inffixed.h
+++ /dev/null
@@ -1,94 +0,0 @@
- /* inffixed.h -- table for decoding fixed codes
- * Generated automatically by makefixed().
- */
-
- /* WARNING: this file should *not* be used by applications.
- It is part of the implementation of this library and is
- subject to change. Applications should only use zlib.h.
- */
-
- static const code lenfix[512] = {
- {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48},
- {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128},
- {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59},
- {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176},
- {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20},
- {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100},
- {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8},
- {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216},
- {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76},
- {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114},
- {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2},
- {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148},
- {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42},
- {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86},
- {0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15},
- {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236},
- {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62},
- {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142},
- {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31},
- {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162},
- {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25},
- {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105},
- {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4},
- {0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202},
- {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69},
- {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125},
- {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13},
- {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195},
- {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35},
- {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91},
- {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19},
- {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246},
- {16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55},
- {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135},
- {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99},
- {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190},
- {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16},
- {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96},
- {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6},
- {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209},
- {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72},
- {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116},
- {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4},
- {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153},
- {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44},
- {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82},
- {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11},
- {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229},
- {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58},
- {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138},
- {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51},
- {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173},
- {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30},
- {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110},
- {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0},
- {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195},
- {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65},
- {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121},
- {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9},
- {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258},
- {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37},
- {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93},
- {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23},
- {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251},
- {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51},
- {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131},
- {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67},
- {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183},
- {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23},
- {64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103},
- {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9},
- {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223},
- {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79},
- {0,9,255}
- };
-
- static const code distfix[32] = {
- {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025},
- {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193},
- {18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385},
- {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577},
- {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073},
- {22,5,193},{64,5,0}
- };
diff --git a/sdk-modifications/libsrc/zlib/inflate.c b/sdk-modifications/libsrc/zlib/inflate.c
deleted file mode 100755
index cc89517..0000000
--- a/sdk-modifications/libsrc/zlib/inflate.c
+++ /dev/null
@@ -1,1501 +0,0 @@
-/* inflate.c -- zlib decompression
- * Copyright (C) 1995-2011 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/*
- * Change history:
- *
- * 1.2.beta0 24 Nov 2002
- * - First version -- complete rewrite of inflate to simplify code, avoid
- * creation of window when not needed, minimize use of window when it is
- * needed, make inffast.c even faster, implement gzip decoding, and to
- * improve code readability and style over the previous zlib inflate code
- *
- * 1.2.beta1 25 Nov 2002
- * - Use pointers for available input and output checking in inffast.c
- * - Remove input and output counters in inffast.c
- * - Change inffast.c entry and loop from avail_in >= 7 to >= 6
- * - Remove unnecessary second byte pull from length extra in inffast.c
- * - Unroll direct copy to three copies per loop in inffast.c
- *
- * 1.2.beta2 4 Dec 2002
- * - Change external routine names to reduce potential conflicts
- * - Correct filename to inffixed.h for fixed tables in inflate.c
- * - Make hbuf[] unsigned char to match parameter type in inflate.c
- * - Change strm->next_out[-state->offset] to *(strm->next_out - state->offset)
- * to avoid negation problem on Alphas (64 bit) in inflate.c
- *
- * 1.2.beta3 22 Dec 2002
- * - Add comments on state->bits assertion in inffast.c
- * - Add comments on op field in inftrees.h
- * - Fix bug in reuse of allocated window after inflateReset()
- * - Remove bit fields--back to byte structure for speed
- * - Remove distance extra == 0 check in inflate_fast()--only helps for lengths
- * - Change post-increments to pre-increments in inflate_fast(), PPC biased?
- * - Add compile time option, POSTINC, to use post-increments instead (Intel?)
- * - Make MATCH copy in inflate() much faster for when inflate_fast() not used
- * - Use local copies of stream next and avail values, as well as local bit
- * buffer and bit count in inflate()--for speed when inflate_fast() not used
- *
- * 1.2.beta4 1 Jan 2003
- * - Split ptr - 257 statements in inflate_table() to avoid compiler warnings
- * - Move a comment on output buffer sizes from inffast.c to inflate.c
- * - Add comments in inffast.c to introduce the inflate_fast() routine
- * - Rearrange window copies in inflate_fast() for speed and simplification
- * - Unroll last copy for window match in inflate_fast()
- * - Use local copies of window variables in inflate_fast() for speed
- * - Pull out common wnext == 0 case for speed in inflate_fast()
- * - Make op and len in inflate_fast() unsigned for consistency
- * - Add FAR to lcode and dcode declarations in inflate_fast()
- * - Simplified bad distance check in inflate_fast()
- * - Added inflateBackInit(), inflateBack(), and inflateBackEnd() in new
- * source file infback.c to provide a call-back interface to inflate for
- * programs like gzip and unzip -- uses window as output buffer to avoid
- * window copying
- *
- * 1.2.beta5 1 Jan 2003
- * - Improved inflateBack() interface to allow the caller to provide initial
- * input in strm.
- * - Fixed stored blocks bug in inflateBack()
- *
- * 1.2.beta6 4 Jan 2003
- * - Added comments in inffast.c on effectiveness of POSTINC
- * - Typecasting all around to reduce compiler warnings
- * - Changed loops from while (1) or do {} while (1) to for (;;), again to
- * make compilers happy
- * - Changed type of window in inflateBackInit() to unsigned char *
- *
- * 1.2.beta7 27 Jan 2003
- * - Changed many types to unsigned or unsigned short to avoid warnings
- * - Added inflateCopy() function
- *
- * 1.2.0 9 Mar 2003
- * - Changed inflateBack() interface to provide separate opaque descriptors
- * for the in() and out() functions
- * - Changed inflateBack() argument and in_func typedef to swap the length
- * and buffer address return values for the input function
- * - Check next_in and next_out for Z_NULL on entry to inflate()
- *
- * The history for versions after 1.2.0 are in ChangeLog in zlib distribution.
- */
-
-#include "zutil.h"
-#include "inftrees.h"
-#include "inflate.h"
-#include "inffast.h"
-
-#ifdef MAKEFIXED
-# ifndef BUILDFIXED
-# define BUILDFIXED
-# endif
-#endif
-
-/* function prototypes */
-local void fixedtables OF((struct inflate_state FAR *state));
-local int updatewindow OF((z_streamp strm, unsigned out));
-#ifdef BUILDFIXED
- void makefixed OF((void));
-#endif
-local unsigned syncsearch OF((unsigned FAR *have, unsigned char FAR *buf,
- unsigned len));
-
-int ZEXPORT inflateResetKeep(strm)
-z_streamp strm;
-{
- struct inflate_state FAR *state;
-
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
- strm->total_in = strm->total_out = state->total = 0;
- strm->msg = Z_NULL;
- if (state->wrap) /* to support ill-conceived Java test suite */
- strm->adler = state->wrap & 1;
- state->mode = HEAD;
- state->last = 0;
- state->havedict = 0;
- state->dmax = 32768U;
- state->head = Z_NULL;
- state->hold = 0;
- state->bits = 0;
- state->lencode = state->distcode = state->next = state->codes;
- state->sane = 1;
- state->back = -1;
- Tracev((stderr, "inflate: reset\n"));
- return Z_OK;
-}
-
-int ZEXPORT inflateReset(strm)
-z_streamp strm;
-{
- struct inflate_state FAR *state;
-
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
- state->wsize = 0;
- state->whave = 0;
- state->wnext = 0;
- return inflateResetKeep(strm);
-}
-
-int ZEXPORT inflateReset2(strm, windowBits)
-z_streamp strm;
-int windowBits;
-{
- int wrap;
- struct inflate_state FAR *state;
-
- /* get the state */
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
-
- /* extract wrap request from windowBits parameter */
- if (windowBits < 0) {
- wrap = 0;
- windowBits = -windowBits;
- }
- else {
- wrap = (windowBits >> 4) + 1;
-#ifdef GUNZIP
- if (windowBits < 48)
- windowBits &= 15;
-#endif
- }
-
- /* set number of window bits, free window if different */
- if (windowBits && (windowBits < 8 || windowBits > 15))
- return Z_STREAM_ERROR;
- if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) {
- ZFREE(strm, state->window);
- state->window = Z_NULL;
- }
-
- /* update state and reset the rest of it */
- state->wrap = wrap;
- state->wbits = (unsigned)windowBits;
- return inflateReset(strm);
-}
-
-int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size)
-z_streamp strm;
-int windowBits;
-const char *version;
-int stream_size;
-{
- int ret;
- struct inflate_state FAR *state;
-
- if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
- stream_size != (int)(sizeof(z_stream)))
- return Z_VERSION_ERROR;
- if (strm == Z_NULL) return Z_STREAM_ERROR;
- strm->msg = Z_NULL; /* in case we return an error */
- if (strm->zalloc == (alloc_func)0) {
-#ifdef Z_SOLO
- return Z_STREAM_ERROR;
-#else
- strm->zalloc = zcalloc;
- strm->opaque = (voidpf)0;
-#endif
- }
- if (strm->zfree == (free_func)0)
-#ifdef Z_SOLO
- return Z_STREAM_ERROR;
-#else
- strm->zfree = zcfree;
-#endif
- state = (struct inflate_state FAR *)
- ZALLOC(strm, 1, sizeof(struct inflate_state));
- if (state == Z_NULL) return Z_MEM_ERROR;
- Tracev((stderr, "inflate: allocated\n"));
- strm->state = (struct internal_state FAR *)state;
- state->window = Z_NULL;
- ret = inflateReset2(strm, windowBits);
- if (ret != Z_OK) {
- ZFREE(strm, state);
- strm->state = Z_NULL;
- }
- return ret;
-}
-
-int ZEXPORT inflateInit_(strm, version, stream_size)
-z_streamp strm;
-const char *version;
-int stream_size;
-{
- return inflateInit2_(strm, DEF_WBITS, version, stream_size);
-}
-
-int ZEXPORT inflatePrime(strm, bits, value)
-z_streamp strm;
-int bits;
-int value;
-{
- struct inflate_state FAR *state;
-
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
- if (bits < 0) {
- state->hold = 0;
- state->bits = 0;
- return Z_OK;
- }
- if (bits > 16 || state->bits + bits > 32) return Z_STREAM_ERROR;
- value &= (1L << bits) - 1;
- state->hold += value << state->bits;
- state->bits += bits;
- return Z_OK;
-}
-
-/*
- Return state with length and distance decoding tables and index sizes set to
- fixed code decoding. Normally this returns fixed tables from inffixed.h.
- If BUILDFIXED is defined, then instead this routine builds the tables the
- first time it's called, and returns those tables the first time and
- thereafter. This reduces the size of the code by about 2K bytes, in
- exchange for a little execution time. However, BUILDFIXED should not be
- used for threaded applications, since the rewriting of the tables and virgin
- may not be thread-safe.
- */
-local void fixedtables(state)
-struct inflate_state FAR *state;
-{
-#ifdef BUILDFIXED
- static int virgin = 1;
- static code *lenfix, *distfix;
- static code fixed[544];
-
- /* build fixed huffman tables if first call (may not be thread safe) */
- if (virgin) {
- unsigned sym, bits;
- static code *next;
-
- /* literal/length table */
- sym = 0;
- while (sym < 144) state->lens[sym++] = 8;
- while (sym < 256) state->lens[sym++] = 9;
- while (sym < 280) state->lens[sym++] = 7;
- while (sym < 288) state->lens[sym++] = 8;
- next = fixed;
- lenfix = next;
- bits = 9;
- inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
-
- /* distance table */
- sym = 0;
- while (sym < 32) state->lens[sym++] = 5;
- distfix = next;
- bits = 5;
- inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
-
- /* do this just once */
- virgin = 0;
- }
-#else /* !BUILDFIXED */
-# include "inffixed.h"
-#endif /* BUILDFIXED */
- state->lencode = lenfix;
- state->lenbits = 9;
- state->distcode = distfix;
- state->distbits = 5;
-}
-
-#ifdef MAKEFIXED
-#include <stdio.h>
-
-/*
- Write out the inffixed.h that is #include'd above. Defining MAKEFIXED also
- defines BUILDFIXED, so the tables are built on the fly. makefixed() writes
- those tables to stdout, which would be piped to inffixed.h. A small program
- can simply call makefixed to do this:
-
- void makefixed(void);
-
- int main(void)
- {
- makefixed();
- return 0;
- }
-
- Then that can be linked with zlib built with MAKEFIXED defined and run:
-
- a.out > inffixed.h
- */
-void makefixed()
-{
- unsigned low, size;
- struct inflate_state state;
-
- fixedtables(&state);
- puts(" /* inffixed.h -- table for decoding fixed codes");
- puts(" * Generated automatically by makefixed().");
- puts(" */");
- puts("");
- puts(" /* WARNING: this file should *not* be used by applications.");
- puts(" It is part of the implementation of this library and is");
- puts(" subject to change. Applications should only use zlib.h.");
- puts(" */");
- puts("");
- size = 1U << 9;
- printf(" static const code lenfix[%u] = {", size);
- low = 0;
- for (;;) {
- if ((low % 7) == 0) printf("\n ");
- printf("{%u,%u,%d}", (low & 127) == 99 ? 64 : state.lencode[low].op,
- state.lencode[low].bits, state.lencode[low].val);
- if (++low == size) break;
- putchar(',');
- }
- puts("\n };");
- size = 1U << 5;
- printf("\n static const code distfix[%u] = {", size);
- low = 0;
- for (;;) {
- if ((low % 6) == 0) printf("\n ");
- printf("{%u,%u,%d}", state.distcode[low].op, state.distcode[low].bits,
- state.distcode[low].val);
- if (++low == size) break;
- putchar(',');
- }
- puts("\n };");
-}
-#endif /* MAKEFIXED */
-
-/*
- Update the window with the last wsize (normally 32K) bytes written before
- returning. If window does not exist yet, create it. This is only called
- when a window is already in use, or when output has been written during this
- inflate call, but the end of the deflate stream has not been reached yet.
- It is also called to create a window for dictionary data when a dictionary
- is loaded.
-
- Providing output buffers larger than 32K to inflate() should provide a speed
- advantage, since only the last 32K of output is copied to the sliding window
- upon return from inflate(), and since all distances after the first 32K of
- output will fall in the output data, making match copies simpler and faster.
- The advantage may be dependent on the size of the processor's data caches.
- */
-local int updatewindow(strm, out)
-z_streamp strm;
-unsigned out;
-{
- struct inflate_state FAR *state;
- unsigned copy, dist;
-
- state = (struct inflate_state FAR *)strm->state;
-
- /* if it hasn't been done already, allocate space for the window */
- if (state->window == Z_NULL) {
- state->window = (unsigned char FAR *)
- ZALLOC(strm, 1U << state->wbits,
- sizeof(unsigned char));
- if (state->window == Z_NULL) return 1;
- }
-
- /* if window not in use yet, initialize */
- if (state->wsize == 0) {
- state->wsize = 1U << state->wbits;
- state->wnext = 0;
- state->whave = 0;
- }
-
- /* copy state->wsize or less output bytes into the circular window */
- copy = out - strm->avail_out;
- if (copy >= state->wsize) {
- zmemcpy(state->window, strm->next_out - state->wsize, state->wsize);
- state->wnext = 0;
- state->whave = state->wsize;
- }
- else {
- dist = state->wsize - state->wnext;
- if (dist > copy) dist = copy;
- zmemcpy(state->window + state->wnext, strm->next_out - copy, dist);
- copy -= dist;
- if (copy) {
- zmemcpy(state->window, strm->next_out - copy, copy);
- state->wnext = copy;
- state->whave = state->wsize;
- }
- else {
- state->wnext += dist;
- if (state->wnext == state->wsize) state->wnext = 0;
- if (state->whave < state->wsize) state->whave += dist;
- }
- }
- return 0;
-}
-
-/* Macros for inflate(): */
-
-/* check function to use adler32() for zlib or crc32() for gzip */
-#ifdef GUNZIP
-# define UPDATE(check, buf, len) \
- (state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
-#else
-# define UPDATE(check, buf, len) adler32(check, buf, len)
-#endif
-
-/* check macros for header crc */
-#ifdef GUNZIP
-# define CRC2(check, word) \
- do { \
- hbuf[0] = (unsigned char)(word); \
- hbuf[1] = (unsigned char)((word) >> 8); \
- check = crc32(check, hbuf, 2); \
- } while (0)
-
-# define CRC4(check, word) \
- do { \
- hbuf[0] = (unsigned char)(word); \
- hbuf[1] = (unsigned char)((word) >> 8); \
- hbuf[2] = (unsigned char)((word) >> 16); \
- hbuf[3] = (unsigned char)((word) >> 24); \
- check = crc32(check, hbuf, 4); \
- } while (0)
-#endif
-
-/* Load registers with state in inflate() for speed */
-#define LOAD() \
- do { \
- put = strm->next_out; \
- left = strm->avail_out; \
- next = strm->next_in; \
- have = strm->avail_in; \
- hold = state->hold; \
- bits = state->bits; \
- } while (0)
-
-/* Restore state from registers in inflate() */
-#define RESTORE() \
- do { \
- strm->next_out = put; \
- strm->avail_out = left; \
- strm->next_in = next; \
- strm->avail_in = have; \
- state->hold = hold; \
- state->bits = bits; \
- } while (0)
-
-/* Clear the input bit accumulator */
-#define INITBITS() \
- do { \
- hold = 0; \
- bits = 0; \
- } while (0)
-
-/* Get a byte of input into the bit accumulator, or return from inflate()
- if there is no input available. */
-#define PULLBYTE() \
- do { \
- if (have == 0) goto inf_leave; \
- have--; \
- hold += (unsigned long)(*next++) << bits; \
- bits += 8; \
- } while (0)
-
-/* Assure that there are at least n bits in the bit accumulator. If there is
- not enough available input to do that, then return from inflate(). */
-#define NEEDBITS(n) \
- do { \
- while (bits < (unsigned)(n)) \
- PULLBYTE(); \
- } while (0)
-
-/* Return the low n bits of the bit accumulator (n < 16) */
-#define BITS(n) \
- ((unsigned)hold & ((1U << (n)) - 1))
-
-/* Remove n bits from the bit accumulator */
-#define DROPBITS(n) \
- do { \
- hold >>= (n); \
- bits -= (unsigned)(n); \
- } while (0)
-
-/* Remove zero to seven bits as needed to go to a byte boundary */
-#define BYTEBITS() \
- do { \
- hold >>= bits & 7; \
- bits -= bits & 7; \
- } while (0)
-
-/* Reverse the bytes in a 32-bit value */
-#define REVERSE(q) \
- ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
- (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
-
-/*
- inflate() uses a state machine to process as much input data and generate as
- much output data as possible before returning. The state machine is
- structured roughly as follows:
-
- for (;;) switch (state) {
- ...
- case STATEn:
- if (not enough input data or output space to make progress)
- return;
- ... make progress ...
- state = STATEm;
- break;
- ...
- }
-
- so when inflate() is called again, the same case is attempted again, and
- if the appropriate resources are provided, the machine proceeds to the
- next state. The NEEDBITS() macro is usually the way the state evaluates
- whether it can proceed or should return. NEEDBITS() does the return if
- the requested bits are not available. The typical use of the BITS macros
- is:
-
- NEEDBITS(n);
- ... do something with BITS(n) ...
- DROPBITS(n);
-
- where NEEDBITS(n) either returns from inflate() if there isn't enough
- input left to load n bits into the accumulator, or it continues. BITS(n)
- gives the low n bits in the accumulator. When done, DROPBITS(n) drops
- the low n bits off the accumulator. INITBITS() clears the accumulator
- and sets the number of available bits to zero. BYTEBITS() discards just
- enough bits to put the accumulator on a byte boundary. After BYTEBITS()
- and a NEEDBITS(8), then BITS(8) would return the next byte in the stream.
-
- NEEDBITS(n) uses PULLBYTE() to get an available byte of input, or to return
- if there is no input available. The decoding of variable length codes uses
- PULLBYTE() directly in order to pull just enough bytes to decode the next
- code, and no more.
-
- Some states loop until they get enough input, making sure that enough
- state information is maintained to continue the loop where it left off
- if NEEDBITS() returns in the loop. For example, want, need, and keep
- would all have to actually be part of the saved state in case NEEDBITS()
- returns:
-
- case STATEw:
- while (want < need) {
- NEEDBITS(n);
- keep[want++] = BITS(n);
- DROPBITS(n);
- }
- state = STATEx;
- case STATEx:
-
- As shown above, if the next state is also the next case, then the break
- is omitted.
-
- A state may also return if there is not enough output space available to
- complete that state. Those states are copying stored data, writing a
- literal byte, and copying a matching string.
-
- When returning, a "goto inf_leave" is used to update the total counters,
- update the check value, and determine whether any progress has been made
- during that inflate() call in order to return the proper return code.
- Progress is defined as a change in either strm->avail_in or strm->avail_out.
- When there is a window, goto inf_leave will update the window with the last
- output written. If a goto inf_leave occurs in the middle of decompression
- and there is no window currently, goto inf_leave will create one and copy
- output to the window for the next call of inflate().
-
- In this implementation, the flush parameter of inflate() only affects the
- return code (per zlib.h). inflate() always writes as much as possible to
- strm->next_out, given the space available and the provided input--the effect
- documented in zlib.h of Z_SYNC_FLUSH. Furthermore, inflate() always defers
- the allocation of and copying into a sliding window until necessary, which
- provides the effect documented in zlib.h for Z_FINISH when the entire input
- stream available. So the only thing the flush parameter actually does is:
- when flush is set to Z_FINISH, inflate() cannot return Z_OK. Instead it
- will return Z_BUF_ERROR if it has not reached the end of the stream.
- */
-
-int ZEXPORT inflate(strm, flush)
-z_streamp strm;
-int flush;
-{
- struct inflate_state FAR *state;
- unsigned char FAR *next; /* next input */
- unsigned char FAR *put; /* next output */
- unsigned have, left; /* available input and output */
- unsigned long hold; /* bit buffer */
- unsigned bits; /* bits in bit buffer */
- unsigned in, out; /* save starting available input and output */
- unsigned copy; /* number of stored or match bytes to copy */
- unsigned char FAR *from; /* where to copy match bytes from */
- code here; /* current decoding table entry */
- code last; /* parent table entry */
- unsigned len; /* length to copy for repeats, bits to drop */
- int ret; /* return code */
-#ifdef GUNZIP
- unsigned char hbuf[4]; /* buffer for gzip header crc calculation */
-#endif
- static const unsigned short order[19] = /* permutation of code lengths */
- {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
-
- if (strm == Z_NULL || strm->state == Z_NULL || strm->next_out == Z_NULL ||
- (strm->next_in == Z_NULL && strm->avail_in != 0))
- return Z_STREAM_ERROR;
-
- state = (struct inflate_state FAR *)strm->state;
- if (state->mode == TYPE) state->mode = TYPEDO; /* skip check */
- LOAD();
- in = have;
- out = left;
- ret = Z_OK;
- for (;;)
- switch (state->mode) {
- case HEAD:
- if (state->wrap == 0) {
- state->mode = TYPEDO;
- break;
- }
- NEEDBITS(16);
-#ifdef GUNZIP
- if ((state->wrap & 2) && hold == 0x8b1f) { /* gzip header */
- state->check = crc32(0L, Z_NULL, 0);
- CRC2(state->check, hold);
- INITBITS();
- state->mode = FLAGS;
- break;
- }
- state->flags = 0; /* expect zlib header */
- if (state->head != Z_NULL)
- state->head->done = -1;
- if (!(state->wrap & 1) || /* check if zlib header allowed */
-#else
- if (
-#endif
- ((BITS(8) << 8) + (hold >> 8)) % 31) {
- strm->msg = (char *)"incorrect header check";
- state->mode = BAD;
- break;
- }
- if (BITS(4) != Z_DEFLATED) {
- strm->msg = (char *)"unknown compression method";
- state->mode = BAD;
- break;
- }
- DROPBITS(4);
- len = BITS(4) + 8;
- if (state->wbits == 0)
- state->wbits = len;
- else if (len > state->wbits) {
- strm->msg = (char *)"invalid window size";
- state->mode = BAD;
- break;
- }
- state->dmax = 1U << len;
- Tracev((stderr, "inflate: zlib header ok\n"));
- strm->adler = state->check = adler32(0L, Z_NULL, 0);
- state->mode = hold & 0x200 ? DICTID : TYPE;
- INITBITS();
- break;
-#ifdef GUNZIP
- case FLAGS:
- NEEDBITS(16);
- state->flags = (int)(hold);
- if ((state->flags & 0xff) != Z_DEFLATED) {
- strm->msg = (char *)"unknown compression method";
- state->mode = BAD;
- break;
- }
- if (state->flags & 0xe000) {
- strm->msg = (char *)"unknown header flags set";
- state->mode = BAD;
- break;
- }
- if (state->head != Z_NULL)
- state->head->text = (int)((hold >> 8) & 1);
- if (state->flags & 0x0200) CRC2(state->check, hold);
- INITBITS();
- state->mode = TIME;
- case TIME:
- NEEDBITS(32);
- if (state->head != Z_NULL)
- state->head->time = hold;
- if (state->flags & 0x0200) CRC4(state->check, hold);
- INITBITS();
- state->mode = OS;
- case OS:
- NEEDBITS(16);
- if (state->head != Z_NULL) {
- state->head->xflags = (int)(hold & 0xff);
- state->head->os = (int)(hold >> 8);
- }
- if (state->flags & 0x0200) CRC2(state->check, hold);
- INITBITS();
- state->mode = EXLEN;
- case EXLEN:
- if (state->flags & 0x0400) {
- NEEDBITS(16);
- state->length = (unsigned)(hold);
- if (state->head != Z_NULL)
- state->head->extra_len = (unsigned)hold;
- if (state->flags & 0x0200) CRC2(state->check, hold);
- INITBITS();
- }
- else if (state->head != Z_NULL)
- state->head->extra = Z_NULL;
- state->mode = EXTRA;
- case EXTRA:
- if (state->flags & 0x0400) {
- copy = state->length;
- if (copy > have) copy = have;
- if (copy) {
- if (state->head != Z_NULL &&
- state->head->extra != Z_NULL) {
- len = state->head->extra_len - state->length;
- zmemcpy(state->head->extra + len, next,
- len + copy > state->head->extra_max ?
- state->head->extra_max - len : copy);
- }
- if (state->flags & 0x0200)
- state->check = crc32(state->check, next, copy);
- have -= copy;
- next += copy;
- state->length -= copy;
- }
- if (state->length) goto inf_leave;
- }
- state->length = 0;
- state->mode = NAME;
- case NAME:
- if (state->flags & 0x0800) {
- if (have == 0) goto inf_leave;
- copy = 0;
- do {
- len = (unsigned)(next[copy++]);
- if (state->head != Z_NULL &&
- state->head->name != Z_NULL &&
- state->length < state->head->name_max)
- state->head->name[state->length++] = len;
- } while (len && copy < have);
- if (state->flags & 0x0200)
- state->check = crc32(state->check, next, copy);
- have -= copy;
- next += copy;
- if (len) goto inf_leave;
- }
- else if (state->head != Z_NULL)
- state->head->name = Z_NULL;
- state->length = 0;
- state->mode = COMMENT;
- case COMMENT:
- if (state->flags & 0x1000) {
- if (have == 0) goto inf_leave;
- copy = 0;
- do {
- len = (unsigned)(next[copy++]);
- if (state->head != Z_NULL &&
- state->head->comment != Z_NULL &&
- state->length < state->head->comm_max)
- state->head->comment[state->length++] = len;
- } while (len && copy < have);
- if (state->flags & 0x0200)
- state->check = crc32(state->check, next, copy);
- have -= copy;
- next += copy;
- if (len) goto inf_leave;
- }
- else if (state->head != Z_NULL)
- state->head->comment = Z_NULL;
- state->mode = HCRC;
- case HCRC:
- if (state->flags & 0x0200) {
- NEEDBITS(16);
- if (hold != (state->check & 0xffff)) {
- strm->msg = (char *)"header crc mismatch";
- state->mode = BAD;
- break;
- }
- INITBITS();
- }
- if (state->head != Z_NULL) {
- state->head->hcrc = (int)((state->flags >> 9) & 1);
- state->head->done = 1;
- }
- strm->adler = state->check = crc32(0L, Z_NULL, 0);
- state->mode = TYPE;
- break;
-#endif
- case DICTID:
- NEEDBITS(32);
- strm->adler = state->check = REVERSE(hold);
- INITBITS();
- state->mode = DICT;
- case DICT:
- if (state->havedict == 0) {
- RESTORE();
- return Z_NEED_DICT;
- }
- strm->adler = state->check = adler32(0L, Z_NULL, 0);
- state->mode = TYPE;
- case TYPE:
- if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
- case TYPEDO:
- if (state->last) {
- BYTEBITS();
- state->mode = CHECK;
- break;
- }
- NEEDBITS(3);
- state->last = BITS(1);
- DROPBITS(1);
- switch (BITS(2)) {
- case 0: /* stored block */
- Tracev((stderr, "inflate: stored block%s\n",
- state->last ? " (last)" : ""));
- state->mode = STORED;
- break;
- case 1: /* fixed block */
- fixedtables(state);
- Tracev((stderr, "inflate: fixed codes block%s\n",
- state->last ? " (last)" : ""));
- state->mode = LEN_; /* decode codes */
- if (flush == Z_TREES) {
- DROPBITS(2);
- goto inf_leave;
- }
- break;
- case 2: /* dynamic block */
- Tracev((stderr, "inflate: dynamic codes block%s\n",
- state->last ? " (last)" : ""));
- state->mode = TABLE;
- break;
- case 3:
- strm->msg = (char *)"invalid block type";
- state->mode = BAD;
- }
- DROPBITS(2);
- break;
- case STORED:
- BYTEBITS(); /* go to byte boundary */
- NEEDBITS(32);
- if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
- strm->msg = (char *)"invalid stored block lengths";
- state->mode = BAD;
- break;
- }
- state->length = (unsigned)hold & 0xffff;
- Tracev((stderr, "inflate: stored length %u\n",
- state->length));
- INITBITS();
- state->mode = COPY_;
- if (flush == Z_TREES) goto inf_leave;
- case COPY_:
- state->mode = COPY;
- case COPY:
- copy = state->length;
- if (copy) {
- if (copy > have) copy = have;
- if (copy > left) copy = left;
- if (copy == 0) goto inf_leave;
- zmemcpy(put, next, copy);
- have -= copy;
- next += copy;
- left -= copy;
- put += copy;
- state->length -= copy;
- break;
- }
- Tracev((stderr, "inflate: stored end\n"));
- state->mode = TYPE;
- break;
- case TABLE:
- NEEDBITS(14);
- state->nlen = BITS(5) + 257;
- DROPBITS(5);
- state->ndist = BITS(5) + 1;
- DROPBITS(5);
- state->ncode = BITS(4) + 4;
- DROPBITS(4);
-#ifndef PKZIP_BUG_WORKAROUND
- if (state->nlen > 286 || state->ndist > 30) {
- strm->msg = (char *)"too many length or distance symbols";
- state->mode = BAD;
- break;
- }
-#endif
- Tracev((stderr, "inflate: table sizes ok\n"));
- state->have = 0;
- state->mode = LENLENS;
- case LENLENS:
- while (state->have < state->ncode) {
- NEEDBITS(3);
- state->lens[order[state->have++]] = (unsigned short)BITS(3);
- DROPBITS(3);
- }
- while (state->have < 19)
- state->lens[order[state->have++]] = 0;
- state->next = state->codes;
- state->lencode = (code const FAR *)(state->next);
- state->lenbits = 7;
- ret = inflate_table(CODES, state->lens, 19, &(state->next),
- &(state->lenbits), state->work);
- if (ret) {
- strm->msg = (char *)"invalid code lengths set";
- state->mode = BAD;
- break;
- }
- Tracev((stderr, "inflate: code lengths ok\n"));
- state->have = 0;
- state->mode = CODELENS;
- case CODELENS:
- while (state->have < state->nlen + state->ndist) {
- for (;;) {
- here = state->lencode[BITS(state->lenbits)];
- if ((unsigned)(here.bits) <= bits) break;
- PULLBYTE();
- }
- if (here.val < 16) {
- DROPBITS(here.bits);
- state->lens[state->have++] = here.val;
- }
- else {
- if (here.val == 16) {
- NEEDBITS(here.bits + 2);
- DROPBITS(here.bits);
- if (state->have == 0) {
- strm->msg = (char *)"invalid bit length repeat";
- state->mode = BAD;
- break;
- }
- len = state->lens[state->have - 1];
- copy = 3 + BITS(2);
- DROPBITS(2);
- }
- else if (here.val == 17) {
- NEEDBITS(here.bits + 3);
- DROPBITS(here.bits);
- len = 0;
- copy = 3 + BITS(3);
- DROPBITS(3);
- }
- else {
- NEEDBITS(here.bits + 7);
- DROPBITS(here.bits);
- len = 0;
- copy = 11 + BITS(7);
- DROPBITS(7);
- }
- if (state->have + copy > state->nlen + state->ndist) {
- strm->msg = (char *)"invalid bit length repeat";
- state->mode = BAD;
- break;
- }
- while (copy--)
- state->lens[state->have++] = (unsigned short)len;
- }
- }
-
- /* handle error breaks in while */
- if (state->mode == BAD) break;
-
- /* check for end-of-block code (better have one) */
- if (state->lens[256] == 0) {
- strm->msg = (char *)"invalid code -- missing end-of-block";
- state->mode = BAD;
- break;
- }
-
- /* build code tables -- note: do not change the lenbits or distbits
- values here (9 and 6) without reading the comments in inftrees.h
- concerning the ENOUGH constants, which depend on those values */
- state->next = state->codes;
- state->lencode = (code const FAR *)(state->next);
- state->lenbits = 9;
- ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
- &(state->lenbits), state->work);
- if (ret) {
- strm->msg = (char *)"invalid literal/lengths set";
- state->mode = BAD;
- break;
- }
- state->distcode = (code const FAR *)(state->next);
- state->distbits = 6;
- ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
- &(state->next), &(state->distbits), state->work);
- if (ret) {
- strm->msg = (char *)"invalid distances set";
- state->mode = BAD;
- break;
- }
- Tracev((stderr, "inflate: codes ok\n"));
- state->mode = LEN_;
- if (flush == Z_TREES) goto inf_leave;
- case LEN_:
- state->mode = LEN;
- case LEN:
- if (have >= 6 && left >= 258) {
- RESTORE();
- inflate_fast(strm, out);
- LOAD();
- if (state->mode == TYPE)
- state->back = -1;
- break;
- }
- state->back = 0;
- for (;;) {
- here = state->lencode[BITS(state->lenbits)];
- if ((unsigned)(here.bits) <= bits) break;
- PULLBYTE();
- }
- if (here.op && (here.op & 0xf0) == 0) {
- last = here;
- for (;;) {
- here = state->lencode[last.val +
- (BITS(last.bits + last.op) >> last.bits)];
- if ((unsigned)(last.bits + here.bits) <= bits) break;
- PULLBYTE();
- }
- DROPBITS(last.bits);
- state->back += last.bits;
- }
- DROPBITS(here.bits);
- state->back += here.bits;
- state->length = (unsigned)here.val;
- if ((int)(here.op) == 0) {
- Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
- "inflate: literal '%c'\n" :
- "inflate: literal 0x%02x\n", here.val));
- state->mode = LIT;
- break;
- }
- if (here.op & 32) {
- Tracevv((stderr, "inflate: end of block\n"));
- state->back = -1;
- state->mode = TYPE;
- break;
- }
- if (here.op & 64) {
- strm->msg = (char *)"invalid literal/length code";
- state->mode = BAD;
- break;
- }
- state->extra = (unsigned)(here.op) & 15;
- state->mode = LENEXT;
- case LENEXT:
- if (state->extra) {
- NEEDBITS(state->extra);
- state->length += BITS(state->extra);
- DROPBITS(state->extra);
- state->back += state->extra;
- }
- Tracevv((stderr, "inflate: length %u\n", state->length));
- state->was = state->length;
- state->mode = DIST;
- case DIST:
- for (;;) {
- here = state->distcode[BITS(state->distbits)];
- if ((unsigned)(here.bits) <= bits) break;
- PULLBYTE();
- }
- if ((here.op & 0xf0) == 0) {
- last = here;
- for (;;) {
- here = state->distcode[last.val +
- (BITS(last.bits + last.op) >> last.bits)];
- if ((unsigned)(last.bits + here.bits) <= bits) break;
- PULLBYTE();
- }
- DROPBITS(last.bits);
- state->back += last.bits;
- }
- DROPBITS(here.bits);
- state->back += here.bits;
- if (here.op & 64) {
- strm->msg = (char *)"invalid distance code";
- state->mode = BAD;
- break;
- }
- state->offset = (unsigned)here.val;
- state->extra = (unsigned)(here.op) & 15;
- state->mode = DISTEXT;
- case DISTEXT:
- if (state->extra) {
- NEEDBITS(state->extra);
- state->offset += BITS(state->extra);
- DROPBITS(state->extra);
- state->back += state->extra;
- }
-#ifdef INFLATE_STRICT
- if (state->offset > state->dmax) {
- strm->msg = (char *)"invalid distance too far back";
- state->mode = BAD;
- break;
- }
-#endif
- Tracevv((stderr, "inflate: distance %u\n", state->offset));
- state->mode = MATCH;
- case MATCH:
- if (left == 0) goto inf_leave;
- copy = out - left;
- if (state->offset > copy) { /* copy from window */
- copy = state->offset - copy;
- if (copy > state->whave) {
- if (state->sane) {
- strm->msg = (char *)"invalid distance too far back";
- state->mode = BAD;
- break;
- }
-#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
- Trace((stderr, "inflate.c too far\n"));
- copy -= state->whave;
- if (copy > state->length) copy = state->length;
- if (copy > left) copy = left;
- left -= copy;
- state->length -= copy;
- do {
- *put++ = 0;
- } while (--copy);
- if (state->length == 0) state->mode = LEN;
- break;
-#endif
- }
- if (copy > state->wnext) {
- copy -= state->wnext;
- from = state->window + (state->wsize - copy);
- }
- else
- from = state->window + (state->wnext - copy);
- if (copy > state->length) copy = state->length;
- }
- else { /* copy from output */
- from = put - state->offset;
- copy = state->length;
- }
- if (copy > left) copy = left;
- left -= copy;
- state->length -= copy;
- do {
- *put++ = *from++;
- } while (--copy);
- if (state->length == 0) state->mode = LEN;
- break;
- case LIT:
- if (left == 0) goto inf_leave;
- *put++ = (unsigned char)(state->length);
- left--;
- state->mode = LEN;
- break;
- case CHECK:
- if (state->wrap) {
- NEEDBITS(32);
- out -= left;
- strm->total_out += out;
- state->total += out;
- if (out)
- strm->adler = state->check =
- UPDATE(state->check, put - out, out);
- out = left;
- if ((
-#ifdef GUNZIP
- state->flags ? hold :
-#endif
- REVERSE(hold)) != state->check) {
- strm->msg = (char *)"incorrect data check";
- state->mode = BAD;
- break;
- }
- INITBITS();
- Tracev((stderr, "inflate: check matches trailer\n"));
- }
-#ifdef GUNZIP
- state->mode = LENGTH;
- case LENGTH:
- if (state->wrap && state->flags) {
- NEEDBITS(32);
- if (hold != (state->total & 0xffffffffUL)) {
- strm->msg = (char *)"incorrect length check";
- state->mode = BAD;
- break;
- }
- INITBITS();
- Tracev((stderr, "inflate: length matches trailer\n"));
- }
-#endif
- state->mode = DONE;
- case DONE:
- ret = Z_STREAM_END;
- goto inf_leave;
- case BAD:
- ret = Z_DATA_ERROR;
- goto inf_leave;
- case MEM:
- return Z_MEM_ERROR;
- case SYNC:
- default:
- return Z_STREAM_ERROR;
- }
-
- /*
- Return from inflate(), updating the total counts and the check value.
- If there was no progress during the inflate() call, return a buffer
- error. Call updatewindow() to create and/or update the window state.
- Note: a memory error from inflate() is non-recoverable.
- */
- inf_leave:
- RESTORE();
- if (state->wsize || (out != strm->avail_out && state->mode < BAD &&
- (state->mode < CHECK || flush != Z_FINISH)))
- if (updatewindow(strm, out)) {
- state->mode = MEM;
- return Z_MEM_ERROR;
- }
- in -= strm->avail_in;
- out -= strm->avail_out;
- strm->total_in += in;
- strm->total_out += out;
- state->total += out;
- if (state->wrap && out)
- strm->adler = state->check =
- UPDATE(state->check, strm->next_out - out, out);
- strm->data_type = state->bits + (state->last ? 64 : 0) +
- (state->mode == TYPE ? 128 : 0) +
- (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0);
- if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
- ret = Z_BUF_ERROR;
- return ret;
-}
-
-int ZEXPORT inflateEnd(strm)
-z_streamp strm;
-{
- struct inflate_state FAR *state;
- if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0)
- return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
- if (state->window != Z_NULL) ZFREE(strm, state->window);
- ZFREE(strm, strm->state);
- strm->state = Z_NULL;
- Tracev((stderr, "inflate: end\n"));
- return Z_OK;
-}
-
-int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength)
-z_streamp strm;
-const Bytef *dictionary;
-uInt dictLength;
-{
- struct inflate_state FAR *state;
- unsigned long id;
- unsigned char *next;
- unsigned avail;
- int ret;
-
- /* check state */
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
- if (state->wrap != 0 && state->mode != DICT)
- return Z_STREAM_ERROR;
-
- /* check for correct dictionary id */
- if (state->mode == DICT) {
- id = adler32(0L, Z_NULL, 0);
- id = adler32(id, dictionary, dictLength);
- if (id != state->check)
- return Z_DATA_ERROR;
- }
-
- /* copy dictionary to window using updatewindow(), which will amend the
- existing dictionary if appropriate */
- next = strm->next_out;
- avail = strm->avail_out;
- strm->next_out = (Bytef *)dictionary + dictLength;
- strm->avail_out = 0;
- ret = updatewindow(strm, dictLength);
- strm->avail_out = avail;
- strm->next_out = next;
- if (ret) {
- state->mode = MEM;
- return Z_MEM_ERROR;
- }
- state->havedict = 1;
- Tracev((stderr, "inflate: dictionary set\n"));
- return Z_OK;
-}
-
-int ZEXPORT inflateGetHeader(strm, head)
-z_streamp strm;
-gz_headerp head;
-{
- struct inflate_state FAR *state;
-
- /* check state */
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
- if ((state->wrap & 2) == 0) return Z_STREAM_ERROR;
-
- /* save header structure */
- state->head = head;
- head->done = 0;
- return Z_OK;
-}
-
-/*
- Search buf[0..len-1] for the pattern: 0, 0, 0xff, 0xff. Return when found
- or when out of input. When called, *have is the number of pattern bytes
- found in order so far, in 0..3. On return *have is updated to the new
- state. If on return *have equals four, then the pattern was found and the
- return value is how many bytes were read including the last byte of the
- pattern. If *have is less than four, then the pattern has not been found
- yet and the return value is len. In the latter case, syncsearch() can be
- called again with more data and the *have state. *have is initialized to
- zero for the first call.
- */
-local unsigned syncsearch(have, buf, len)
-unsigned FAR *have;
-unsigned char FAR *buf;
-unsigned len;
-{
- unsigned got;
- unsigned next;
-
- got = *have;
- next = 0;
- while (next < len && got < 4) {
- if ((int)(buf[next]) == (got < 2 ? 0 : 0xff))
- got++;
- else if (buf[next])
- got = 0;
- else
- got = 4 - got;
- next++;
- }
- *have = got;
- return next;
-}
-
-int ZEXPORT inflateSync(strm)
-z_streamp strm;
-{
- unsigned len; /* number of bytes to look at or looked at */
- unsigned long in, out; /* temporary to save total_in and total_out */
- unsigned char buf[4]; /* to restore bit buffer to byte string */
- struct inflate_state FAR *state;
-
- /* check parameters */
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
- if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR;
-
- /* if first time, start search in bit buffer */
- if (state->mode != SYNC) {
- state->mode = SYNC;
- state->hold <<= state->bits & 7;
- state->bits -= state->bits & 7;
- len = 0;
- while (state->bits >= 8) {
- buf[len++] = (unsigned char)(state->hold);
- state->hold >>= 8;
- state->bits -= 8;
- }
- state->have = 0;
- syncsearch(&(state->have), buf, len);
- }
-
- /* search available input */
- len = syncsearch(&(state->have), strm->next_in, strm->avail_in);
- strm->avail_in -= len;
- strm->next_in += len;
- strm->total_in += len;
-
- /* return no joy or set up to restart inflate() on a new block */
- if (state->have != 4) return Z_DATA_ERROR;
- in = strm->total_in; out = strm->total_out;
- inflateReset(strm);
- strm->total_in = in; strm->total_out = out;
- state->mode = TYPE;
- return Z_OK;
-}
-
-/*
- Returns true if inflate is currently at the end of a block generated by
- Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP
- implementation to provide an additional safety check. PPP uses
- Z_SYNC_FLUSH but removes the length bytes of the resulting empty stored
- block. When decompressing, PPP checks that at the end of input packet,
- inflate is waiting for these length bytes.
- */
-int ZEXPORT inflateSyncPoint(strm)
-z_streamp strm;
-{
- struct inflate_state FAR *state;
-
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
- return state->mode == STORED && state->bits == 0;
-}
-
-int ZEXPORT inflateCopy(dest, source)
-z_streamp dest;
-z_streamp source;
-{
- struct inflate_state FAR *state;
- struct inflate_state FAR *copy;
- unsigned char FAR *window;
- unsigned wsize;
-
- /* check input */
- if (dest == Z_NULL || source == Z_NULL || source->state == Z_NULL ||
- source->zalloc == (alloc_func)0 || source->zfree == (free_func)0)
- return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)source->state;
-
- /* allocate space */
- copy = (struct inflate_state FAR *)
- ZALLOC(source, 1, sizeof(struct inflate_state));
- if (copy == Z_NULL) return Z_MEM_ERROR;
- window = Z_NULL;
- if (state->window != Z_NULL) {
- window = (unsigned char FAR *)
- ZALLOC(source, 1U << state->wbits, sizeof(unsigned char));
- if (window == Z_NULL) {
- ZFREE(source, copy);
- return Z_MEM_ERROR;
- }
- }
-
- /* copy state */
- zmemcpy((voidpf)dest, (voidpf)source, sizeof(z_stream));
- zmemcpy((voidpf)copy, (voidpf)state, sizeof(struct inflate_state));
- if (state->lencode >= state->codes &&
- state->lencode <= state->codes + ENOUGH - 1) {
- copy->lencode = copy->codes + (state->lencode - state->codes);
- copy->distcode = copy->codes + (state->distcode - state->codes);
- }
- copy->next = copy->codes + (state->next - state->codes);
- if (window != Z_NULL) {
- wsize = 1U << state->wbits;
- zmemcpy(window, state->window, wsize);
- }
- copy->window = window;
- dest->state = (struct internal_state FAR *)copy;
- return Z_OK;
-}
-
-int ZEXPORT inflateUndermine(strm, subvert)
-z_streamp strm;
-int subvert;
-{
- struct inflate_state FAR *state;
-
- if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
- state = (struct inflate_state FAR *)strm->state;
- state->sane = !subvert;
-#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
- return Z_OK;
-#else
- state->sane = 1;
- return Z_DATA_ERROR;
-#endif
-}
-
-long ZEXPORT inflateMark(strm)
-z_streamp strm;
-{
- struct inflate_state FAR *state;
-
- if (strm == Z_NULL || strm->state == Z_NULL) return -1L << 16;
- state = (struct inflate_state FAR *)strm->state;
- return ((long)(state->back) << 16) +
- (state->mode == COPY ? state->length :
- (state->mode == MATCH ? state->was - state->length : 0));
-}
diff --git a/sdk-modifications/libsrc/zlib/inflate.h b/sdk-modifications/libsrc/zlib/inflate.h
deleted file mode 100755
index 95f4986..0000000
--- a/sdk-modifications/libsrc/zlib/inflate.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/* inflate.h -- internal inflate state definition
- * Copyright (C) 1995-2009 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* WARNING: this file should *not* be used by applications. It is
- part of the implementation of the compression library and is
- subject to change. Applications should only use zlib.h.
- */
-
-/* define NO_GZIP when compiling if you want to disable gzip header and
- trailer decoding by inflate(). NO_GZIP would be used to avoid linking in
- the crc code when it is not needed. For shared libraries, gzip decoding
- should be left enabled. */
-#ifndef NO_GZIP
-# define GUNZIP
-#endif
-
-/* Possible inflate modes between inflate() calls */
-typedef enum {
- HEAD, /* i: waiting for magic header */
- FLAGS, /* i: waiting for method and flags (gzip) */
- TIME, /* i: waiting for modification time (gzip) */
- OS, /* i: waiting for extra flags and operating system (gzip) */
- EXLEN, /* i: waiting for extra length (gzip) */
- EXTRA, /* i: waiting for extra bytes (gzip) */
- NAME, /* i: waiting for end of file name (gzip) */
- COMMENT, /* i: waiting for end of comment (gzip) */
- HCRC, /* i: waiting for header crc (gzip) */
- DICTID, /* i: waiting for dictionary check value */
- DICT, /* waiting for inflateSetDictionary() call */
- TYPE, /* i: waiting for type bits, including last-flag bit */
- TYPEDO, /* i: same, but skip check to exit inflate on new block */
- STORED, /* i: waiting for stored size (length and complement) */
- COPY_, /* i/o: same as COPY below, but only first time in */
- COPY, /* i/o: waiting for input or output to copy stored block */
- TABLE, /* i: waiting for dynamic block table lengths */
- LENLENS, /* i: waiting for code length code lengths */
- CODELENS, /* i: waiting for length/lit and distance code lengths */
- LEN_, /* i: same as LEN below, but only first time in */
- LEN, /* i: waiting for length/lit/eob code */
- LENEXT, /* i: waiting for length extra bits */
- DIST, /* i: waiting for distance code */
- DISTEXT, /* i: waiting for distance extra bits */
- MATCH, /* o: waiting for output space to copy string */
- LIT, /* o: waiting for output space to write literal */
- CHECK, /* i: waiting for 32-bit check value */
- LENGTH, /* i: waiting for 32-bit length (gzip) */
- DONE, /* finished check, done -- remain here until reset */
- BAD, /* got a data error -- remain here until reset */
- MEM, /* got an inflate() memory error -- remain here until reset */
- SYNC /* looking for synchronization bytes to restart inflate() */
-} inflate_mode;
-
-/*
- State transitions between above modes -
-
- (most modes can go to BAD or MEM on error -- not shown for clarity)
-
- Process header:
- HEAD -> (gzip) or (zlib) or (raw)
- (gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME -> COMMENT ->
- HCRC -> TYPE
- (zlib) -> DICTID or TYPE
- DICTID -> DICT -> TYPE
- (raw) -> TYPEDO
- Read deflate blocks:
- TYPE -> TYPEDO -> STORED or TABLE or LEN_ or CHECK
- STORED -> COPY_ -> COPY -> TYPE
- TABLE -> LENLENS -> CODELENS -> LEN_
- LEN_ -> LEN
- Read deflate codes in fixed or dynamic block:
- LEN -> LENEXT or LIT or TYPE
- LENEXT -> DIST -> DISTEXT -> MATCH -> LEN
- LIT -> LEN
- Process trailer:
- CHECK -> LENGTH -> DONE
- */
-
-/* state maintained between inflate() calls. Approximately 10K bytes. */
-struct inflate_state {
- inflate_mode mode; /* current inflate mode */
- int last; /* true if processing last block */
- int wrap; /* bit 0 true for zlib, bit 1 true for gzip */
- int havedict; /* true if dictionary provided */
- int flags; /* gzip header method and flags (0 if zlib) */
- unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */
- unsigned long check; /* protected copy of check value */
- unsigned long total; /* protected copy of output count */
- gz_headerp head; /* where to save gzip header information */
- /* sliding window */
- unsigned wbits; /* log base 2 of requested window size */
- unsigned wsize; /* window size or zero if not using window */
- unsigned whave; /* valid bytes in the window */
- unsigned wnext; /* window write index */
- unsigned char FAR *window; /* allocated sliding window, if needed */
- /* bit accumulator */
- unsigned long hold; /* input bit accumulator */
- unsigned bits; /* number of bits in "in" */
- /* for string and stored block copying */
- unsigned length; /* literal or length of data to copy */
- unsigned offset; /* distance back to copy string from */
- /* for table and code decoding */
- unsigned extra; /* extra bits needed */
- /* fixed and dynamic code tables */
- code const FAR *lencode; /* starting table for length/literal codes */
- code const FAR *distcode; /* starting table for distance codes */
- unsigned lenbits; /* index bits for lencode */
- unsigned distbits; /* index bits for distcode */
- /* dynamic table building */
- unsigned ncode; /* number of code length code lengths */
- unsigned nlen; /* number of length code lengths */
- unsigned ndist; /* number of distance code lengths */
- unsigned have; /* number of code lengths in lens[] */
- code FAR *next; /* next available space in codes[] */
- unsigned short lens[320]; /* temporary storage for code lengths */
- unsigned short work[288]; /* work area for code table building */
- code codes[ENOUGH]; /* space for code tables */
- int sane; /* if false, allow invalid distance too far */
- int back; /* bits back of last unprocessed length/lit */
- unsigned was; /* initial length of match */
-};
diff --git a/sdk-modifications/libsrc/zlib/inftrees.c b/sdk-modifications/libsrc/zlib/inftrees.c
deleted file mode 100755
index 60bbd58..0000000
--- a/sdk-modifications/libsrc/zlib/inftrees.c
+++ /dev/null
@@ -1,306 +0,0 @@
-/* inftrees.c -- generate Huffman trees for efficient decoding
- * Copyright (C) 1995-2012 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-#include "zutil.h"
-#include "inftrees.h"
-
-#define MAXBITS 15
-
-const char inflate_copyright[] =
- " inflate 1.2.6 Copyright 1995-2012 Mark Adler ";
-/*
- If you use the zlib library in a product, an acknowledgment is welcome
- in the documentation of your product. If for some reason you cannot
- include such an acknowledgment, I would appreciate that you keep this
- copyright string in the executable of your product.
- */
-
-/*
- Build a set of tables to decode the provided canonical Huffman code.
- The code lengths are lens[0..codes-1]. The result starts at *table,
- whose indices are 0..2^bits-1. work is a writable array of at least
- lens shorts, which is used as a work area. type is the type of code
- to be generated, CODES, LENS, or DISTS. On return, zero is success,
- -1 is an invalid code, and +1 means that ENOUGH isn't enough. table
- on return points to the next available entry's address. bits is the
- requested root table index bits, and on return it is the actual root
- table index bits. It will differ if the request is greater than the
- longest code or if it is less than the shortest code.
- */
-int ZLIB_INTERNAL inflate_table(type, lens, codes, table, bits, work)
-codetype type;
-unsigned short FAR *lens;
-unsigned codes;
-code FAR * FAR *table;
-unsigned FAR *bits;
-unsigned short FAR *work;
-{
- unsigned len; /* a code's length in bits */
- unsigned sym; /* index of code symbols */
- unsigned min, max; /* minimum and maximum code lengths */
- unsigned root; /* number of index bits for root table */
- unsigned curr; /* number of index bits for current table */
- unsigned drop; /* code bits to drop for sub-table */
- int left; /* number of prefix codes available */
- unsigned used; /* code entries in table used */
- unsigned huff; /* Huffman code */
- unsigned incr; /* for incrementing code, index */
- unsigned fill; /* index for replicating entries */
- unsigned low; /* low bits for current root entry */
- unsigned mask; /* mask for low root bits */
- code here; /* table entry for duplication */
- code FAR *next; /* next available space in table */
- const unsigned short FAR *base; /* base value table to use */
- const unsigned short FAR *extra; /* extra bits table to use */
- int end; /* use base and extra for symbol > end */
- unsigned short count[MAXBITS+1]; /* number of codes of each length */
- unsigned short offs[MAXBITS+1]; /* offsets in table for each length */
- static const unsigned short lbase[31] = { /* Length codes 257..285 base */
- 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
- 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
- static const unsigned short lext[31] = { /* Length codes 257..285 extra */
- 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
- 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 203, 69};
- static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
- 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
- 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
- 8193, 12289, 16385, 24577, 0, 0};
- static const unsigned short dext[32] = { /* Distance codes 0..29 extra */
- 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
- 23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
- 28, 28, 29, 29, 64, 64};
-
- /*
- Process a set of code lengths to create a canonical Huffman code. The
- code lengths are lens[0..codes-1]. Each length corresponds to the
- symbols 0..codes-1. The Huffman code is generated by first sorting the
- symbols by length from short to long, and retaining the symbol order
- for codes with equal lengths. Then the code starts with all zero bits
- for the first code of the shortest length, and the codes are integer
- increments for the same length, and zeros are appended as the length
- increases. For the deflate format, these bits are stored backwards
- from their more natural integer increment ordering, and so when the
- decoding tables are built in the large loop below, the integer codes
- are incremented backwards.
-
- This routine assumes, but does not check, that all of the entries in
- lens[] are in the range 0..MAXBITS. The caller must assure this.
- 1..MAXBITS is interpreted as that code length. zero means that that
- symbol does not occur in this code.
-
- The codes are sorted by computing a count of codes for each length,
- creating from that a table of starting indices for each length in the
- sorted table, and then entering the symbols in order in the sorted
- table. The sorted table is work[], with that space being provided by
- the caller.
-
- The length counts are used for other purposes as well, i.e. finding
- the minimum and maximum length codes, determining if there are any
- codes at all, checking for a valid set of lengths, and looking ahead
- at length counts to determine sub-table sizes when building the
- decoding tables.
- */
-
- /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */
- for (len = 0; len <= MAXBITS; len++)
- count[len] = 0;
- for (sym = 0; sym < codes; sym++)
- count[lens[sym]]++;
-
- /* bound code lengths, force root to be within code lengths */
- root = *bits;
- for (max = MAXBITS; max >= 1; max--)
- if (count[max] != 0) break;
- if (root > max) root = max;
- if (max == 0) { /* no symbols to code at all */
- here.op = (unsigned char)64; /* invalid code marker */
- here.bits = (unsigned char)1;
- here.val = (unsigned short)0;
- *(*table)++ = here; /* make a table to force an error */
- *(*table)++ = here;
- *bits = 1;
- return 0; /* no symbols, but wait for decoding to report error */
- }
- for (min = 1; min < max; min++)
- if (count[min] != 0) break;
- if (root < min) root = min;
-
- /* check for an over-subscribed or incomplete set of lengths */
- left = 1;
- for (len = 1; len <= MAXBITS; len++) {
- left <<= 1;
- left -= count[len];
- if (left < 0) return -1; /* over-subscribed */
- }
- if (left > 0 && (type == CODES || max != 1))
- return -1; /* incomplete set */
-
- /* generate offsets into symbol table for each length for sorting */
- offs[1] = 0;
- for (len = 1; len < MAXBITS; len++)
- offs[len + 1] = offs[len] + count[len];
-
- /* sort symbols by length, by symbol order within each length */
- for (sym = 0; sym < codes; sym++)
- if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym;
-
- /*
- Create and fill in decoding tables. In this loop, the table being
- filled is at next and has curr index bits. The code being used is huff
- with length len. That code is converted to an index by dropping drop
- bits off of the bottom. For codes where len is less than drop + curr,
- those top drop + curr - len bits are incremented through all values to
- fill the table with replicated entries.
-
- root is the number of index bits for the root table. When len exceeds
- root, sub-tables are created pointed to by the root entry with an index
- of the low root bits of huff. This is saved in low to check for when a
- new sub-table should be started. drop is zero when the root table is
- being filled, and drop is root when sub-tables are being filled.
-
- When a new sub-table is needed, it is necessary to look ahead in the
- code lengths to determine what size sub-table is needed. The length
- counts are used for this, and so count[] is decremented as codes are
- entered in the tables.
-
- used keeps track of how many table entries have been allocated from the
- provided *table space. It is checked for LENS and DIST tables against
- the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in
- the initial root table size constants. See the comments in inftrees.h
- for more information.
-
- sym increments through all symbols, and the loop terminates when
- all codes of length max, i.e. all codes, have been processed. This
- routine permits incomplete codes, so another loop after this one fills
- in the rest of the decoding tables with invalid code markers.
- */
-
- /* set up for code type */
- switch (type) {
- case CODES:
- base = extra = work; /* dummy value--not used */
- end = 19;
- break;
- case LENS:
- base = lbase;
- base -= 257;
- extra = lext;
- extra -= 257;
- end = 256;
- break;
- default: /* DISTS */
- base = dbase;
- extra = dext;
- end = -1;
- }
-
- /* initialize state for loop */
- huff = 0; /* starting code */
- sym = 0; /* starting code symbol */
- len = min; /* starting code length */
- next = *table; /* current table to fill in */
- curr = root; /* current table index bits */
- drop = 0; /* current bits to drop from code for index */
- low = (unsigned)(-1); /* trigger new sub-table when len > root */
- used = 1U << root; /* use root table entries */
- mask = used - 1; /* mask for comparing low */
-
- /* check available table space */
- if ((type == LENS && used >= ENOUGH_LENS) ||
- (type == DISTS && used >= ENOUGH_DISTS))
- return 1;
-
- /* process all codes and make table entries */
- for (;;) {
- /* create table entry */
- here.bits = (unsigned char)(len - drop);
- if ((int)(work[sym]) < end) {
- here.op = (unsigned char)0;
- here.val = work[sym];
- }
- else if ((int)(work[sym]) > end) {
- here.op = (unsigned char)(extra[work[sym]]);
- here.val = base[work[sym]];
- }
- else {
- here.op = (unsigned char)(32 + 64); /* end of block */
- here.val = 0;
- }
-
- /* replicate for those indices with low len bits equal to huff */
- incr = 1U << (len - drop);
- fill = 1U << curr;
- min = fill; /* save offset to next table */
- do {
- fill -= incr;
- next[(huff >> drop) + fill] = here;
- } while (fill != 0);
-
- /* backwards increment the len-bit code huff */
- incr = 1U << (len - 1);
- while (huff & incr)
- incr >>= 1;
- if (incr != 0) {
- huff &= incr - 1;
- huff += incr;
- }
- else
- huff = 0;
-
- /* go to next symbol, update count, len */
- sym++;
- if (--(count[len]) == 0) {
- if (len == max) break;
- len = lens[work[sym]];
- }
-
- /* create new sub-table if needed */
- if (len > root && (huff & mask) != low) {
- /* if first time, transition to sub-tables */
- if (drop == 0)
- drop = root;
-
- /* increment past last table */
- next += min; /* here min is 1 << curr */
-
- /* determine length of next table */
- curr = len - drop;
- left = (int)(1 << curr);
- while (curr + drop < max) {
- left -= count[curr + drop];
- if (left <= 0) break;
- curr++;
- left <<= 1;
- }
-
- /* check for enough space */
- used += 1U << curr;
- if ((type == LENS && used >= ENOUGH_LENS) ||
- (type == DISTS && used >= ENOUGH_DISTS))
- return 1;
-
- /* point entry in root table to sub-table */
- low = huff & mask;
- (*table)[low].op = (unsigned char)curr;
- (*table)[low].bits = (unsigned char)root;
- (*table)[low].val = (unsigned short)(next - *table);
- }
- }
-
- /* fill in remaining table entry if code is incomplete (guaranteed to have
- at most one remaining entry, since if the code is incomplete, the
- maximum code length that was allowed to get this far is one bit) */
- if (huff != 0) {
- here.op = (unsigned char)64; /* invalid code marker */
- here.bits = (unsigned char)(len - drop);
- here.val = (unsigned short)0;
- next[huff] = here;
- }
-
- /* set return parameters */
- *table += used;
- *bits = root;
- return 0;
-}
diff --git a/sdk-modifications/libsrc/zlib/inftrees.h b/sdk-modifications/libsrc/zlib/inftrees.h
deleted file mode 100755
index baa53a0..0000000
--- a/sdk-modifications/libsrc/zlib/inftrees.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* inftrees.h -- header to use inftrees.c
- * Copyright (C) 1995-2005, 2010 Mark Adler
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* WARNING: this file should *not* be used by applications. It is
- part of the implementation of the compression library and is
- subject to change. Applications should only use zlib.h.
- */
-
-/* Structure for decoding tables. Each entry provides either the
- information needed to do the operation requested by the code that
- indexed that table entry, or it provides a pointer to another
- table that indexes more bits of the code. op indicates whether
- the entry is a pointer to another table, a literal, a length or
- distance, an end-of-block, or an invalid code. For a table
- pointer, the low four bits of op is the number of index bits of
- that table. For a length or distance, the low four bits of op
- is the number of extra bits to get after the code. bits is
- the number of bits in this code or part of the code to drop off
- of the bit buffer. val is the actual byte to output in the case
- of a literal, the base length or distance, or the offset from
- the current table to the next table. Each entry is four bytes. */
-typedef struct {
- unsigned char op; /* operation, extra bits, table bits */
- unsigned char bits; /* bits in this part of the code */
- unsigned short val; /* offset in table or code value */
-} code;
-
-/* op values as set by inflate_table():
- 00000000 - literal
- 0000tttt - table link, tttt != 0 is the number of table index bits
- 0001eeee - length or distance, eeee is the number of extra bits
- 01100000 - end of block
- 01000000 - invalid code
- */
-
-/* Maximum size of the dynamic table. The maximum number of code structures is
- 1444, which is the sum of 852 for literal/length codes and 592 for distance
- codes. These values were found by exhaustive searches using the program
- examples/enough.c found in the zlib distribtution. The arguments to that
- program are the number of symbols, the initial root table size, and the
- maximum bit length of a code. "enough 286 9 15" for literal/length codes
- returns returns 852, and "enough 30 6 15" for distance codes returns 592.
- The initial root table size (9 or 6) is found in the fifth argument of the
- inflate_table() calls in inflate.c and infback.c. If the root table size is
- changed, then these maximum sizes would be need to be recalculated and
- updated. */
-#define ENOUGH_LENS 852
-#define ENOUGH_DISTS 592
-#define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS)
-
-/* Type of code to build for inflate_table() */
-typedef enum {
- CODES,
- LENS,
- DISTS
-} codetype;
-
-int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens,
- unsigned codes, code FAR * FAR *table,
- unsigned FAR *bits, unsigned short FAR *work));
diff --git a/sdk-modifications/libsrc/zlib/trees.c b/sdk-modifications/libsrc/zlib/trees.c
deleted file mode 100755
index 8c32b21..0000000
--- a/sdk-modifications/libsrc/zlib/trees.c
+++ /dev/null
@@ -1,1224 +0,0 @@
-/* trees.c -- output deflated data using Huffman coding
- * Copyright (C) 1995-2012 Jean-loup Gailly
- * detect_data_type() function provided freely by Cosmin Truta, 2006
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/*
- * ALGORITHM
- *
- * The "deflation" process uses several Huffman trees. The more
- * common source values are represented by shorter bit sequences.
- *
- * Each code tree is stored in a compressed form which is itself
- * a Huffman encoding of the lengths of all the code strings (in
- * ascending order by source values). The actual code strings are
- * reconstructed from the lengths in the inflate process, as described
- * in the deflate specification.
- *
- * REFERENCES
- *
- * Deutsch, L.P.,"'Deflate' Compressed Data Format Specification".
- * Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc
- *
- * Storer, James A.
- * Data Compression: Methods and Theory, pp. 49-50.
- * Computer Science Press, 1988. ISBN 0-7167-8156-5.
- *
- * Sedgewick, R.
- * Algorithms, p290.
- * Addison-Wesley, 1983. ISBN 0-201-06672-6.
- */
-
-/* @(#) $Id$ */
-
-/* #define GEN_TREES_H */
-
-#include "deflate.h"
-
-#ifdef DEBUG
-# include <ctype.h>
-#endif
-
-/* ===========================================================================
- * Constants
- */
-
-#define MAX_BL_BITS 7
-/* Bit length codes must not exceed MAX_BL_BITS bits */
-
-#define END_BLOCK 256
-/* end of block literal code */
-
-#define REP_3_6 16
-/* repeat previous bit length 3-6 times (2 bits of repeat count) */
-
-#define REPZ_3_10 17
-/* repeat a zero length 3-10 times (3 bits of repeat count) */
-
-#define REPZ_11_138 18
-/* repeat a zero length 11-138 times (7 bits of repeat count) */
-
-local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */
- = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0};
-
-local const int extra_dbits[D_CODES] /* extra bits for each distance code */
- = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13};
-
-local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */
- = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7};
-
-local const uch bl_order[BL_CODES]
- = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15};
-/* The lengths of the bit length codes are sent in order of decreasing
- * probability, to avoid transmitting the lengths for unused bit length codes.
- */
-
-/* ===========================================================================
- * Local data. These are initialized only once.
- */
-
-#define DIST_CODE_LEN 512 /* see definition of array dist_code below */
-
-#if defined(GEN_TREES_H) || !defined(STDC)
-/* non ANSI compilers may not accept trees.h */
-
-local ct_data static_ltree[L_CODES+2];
-/* The static literal tree. Since the bit lengths are imposed, there is no
- * need for the L_CODES extra codes used during heap construction. However
- * The codes 286 and 287 are needed to build a canonical tree (see _tr_init
- * below).
- */
-
-local ct_data static_dtree[D_CODES];
-/* The static distance tree. (Actually a trivial tree since all codes use
- * 5 bits.)
- */
-
-uch _dist_code[DIST_CODE_LEN];
-/* Distance codes. The first 256 values correspond to the distances
- * 3 .. 258, the last 256 values correspond to the top 8 bits of
- * the 15 bit distances.
- */
-
-uch _length_code[MAX_MATCH-MIN_MATCH+1];
-/* length code for each normalized match length (0 == MIN_MATCH) */
-
-local int base_length[LENGTH_CODES];
-/* First normalized length for each code (0 = MIN_MATCH) */
-
-local int base_dist[D_CODES];
-/* First normalized distance for each code (0 = distance of 1) */
-
-#else
-# include "trees.h"
-#endif /* GEN_TREES_H */
-
-struct static_tree_desc_s {
- const ct_data *static_tree; /* static tree or NULL */
- const intf *extra_bits; /* extra bits for each code or NULL */
- int extra_base; /* base index for extra_bits */
- int elems; /* max number of elements in the tree */
- int max_length; /* max bit length for the codes */
-};
-
-local static_tree_desc static_l_desc =
-{static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS};
-
-local static_tree_desc static_d_desc =
-{static_dtree, extra_dbits, 0, D_CODES, MAX_BITS};
-
-local static_tree_desc static_bl_desc =
-{(const ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS};
-
-/* ===========================================================================
- * Local (static) routines in this file.
- */
-
-local void tr_static_init OF((void));
-local void init_block OF((deflate_state *s));
-local void pqdownheap OF((deflate_state *s, ct_data *tree, int k));
-local void gen_bitlen OF((deflate_state *s, tree_desc *desc));
-local void gen_codes OF((ct_data *tree, int max_code, ushf *bl_count));
-local void build_tree OF((deflate_state *s, tree_desc *desc));
-local void scan_tree OF((deflate_state *s, ct_data *tree, int max_code));
-local void send_tree OF((deflate_state *s, ct_data *tree, int max_code));
-local int build_bl_tree OF((deflate_state *s));
-local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes,
- int blcodes));
-local void compress_block OF((deflate_state *s, ct_data *ltree,
- ct_data *dtree));
-local int detect_data_type OF((deflate_state *s));
-local unsigned bi_reverse OF((unsigned value, int length));
-local void bi_windup OF((deflate_state *s));
-local void bi_flush OF((deflate_state *s));
-local void copy_block OF((deflate_state *s, charf *buf, unsigned len,
- int header));
-
-#ifdef GEN_TREES_H
-local void gen_trees_header OF((void));
-#endif
-
-#ifndef DEBUG
-# define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len)
- /* Send a code of the given tree. c and tree must not have side effects */
-
-#else /* DEBUG */
-# define send_code(s, c, tree) \
- { if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \
- send_bits(s, tree[c].Code, tree[c].Len); }
-#endif
-
-/* ===========================================================================
- * Output a short LSB first on the stream.
- * IN assertion: there is enough room in pendingBuf.
- */
-#define put_short(s, w) { \
- put_byte(s, (uch)((w) & 0xff)); \
- put_byte(s, (uch)((ush)(w) >> 8)); \
-}
-
-/* ===========================================================================
- * Send a value on a given number of bits.
- * IN assertion: length <= 16 and value fits in length bits.
- */
-#ifdef DEBUG
-local void send_bits OF((deflate_state *s, int value, int length));
-
-local void send_bits(s, value, length)
- deflate_state *s;
- int value; /* value to send */
- int length; /* number of bits */
-{
- Tracevv((stderr," l %2d v %4x ", length, value));
- Assert(length > 0 && length <= 15, "invalid length");
- s->bits_sent += (ulg)length;
-
- /* If not enough room in bi_buf, use (valid) bits from bi_buf and
- * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid))
- * unused bits in value.
- */
- if (s->bi_valid > (int)Buf_size - length) {
- s->bi_buf |= (ush)value << s->bi_valid;
- put_short(s, s->bi_buf);
- s->bi_buf = (ush)value >> (Buf_size - s->bi_valid);
- s->bi_valid += length - Buf_size;
- } else {
- s->bi_buf |= (ush)value << s->bi_valid;
- s->bi_valid += length;
- }
-}
-#else /* !DEBUG */
-
-#define send_bits(s, value, length) \
-{ int len = length;\
- if (s->bi_valid > (int)Buf_size - len) {\
- int val = value;\
- s->bi_buf |= (ush)val << s->bi_valid;\
- put_short(s, s->bi_buf);\
- s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
- s->bi_valid += len - Buf_size;\
- } else {\
- s->bi_buf |= (ush)(value) << s->bi_valid;\
- s->bi_valid += len;\
- }\
-}
-#endif /* DEBUG */
-
-
-/* the arguments must not have side effects */
-
-/* ===========================================================================
- * Initialize the various 'constant' tables.
- */
-local void tr_static_init()
-{
-#if defined(GEN_TREES_H) || !defined(STDC)
- static int static_init_done = 0;
- int n; /* iterates over tree elements */
- int bits; /* bit counter */
- int length; /* length value */
- int code; /* code value */
- int dist; /* distance index */
- ush bl_count[MAX_BITS+1];
- /* number of codes at each bit length for an optimal tree */
-
- if (static_init_done) return;
-
- /* For some embedded targets, global variables are not initialized: */
-#ifdef NO_INIT_GLOBAL_POINTERS
- static_l_desc.static_tree = static_ltree;
- static_l_desc.extra_bits = extra_lbits;
- static_d_desc.static_tree = static_dtree;
- static_d_desc.extra_bits = extra_dbits;
- static_bl_desc.extra_bits = extra_blbits;
-#endif
-
- /* Initialize the mapping length (0..255) -> length code (0..28) */
- length = 0;
- for (code = 0; code < LENGTH_CODES-1; code++) {
- base_length[code] = length;
- for (n = 0; n < (1<<extra_lbits[code]); n++) {
- _length_code[length++] = (uch)code;
- }
- }
- Assert (length == 256, "tr_static_init: length != 256");
- /* Note that the length 255 (match length 258) can be represented
- * in two different ways: code 284 + 5 bits or code 285, so we
- * overwrite length_code[255] to use the best encoding:
- */
- _length_code[length-1] = (uch)code;
-
- /* Initialize the mapping dist (0..32K) -> dist code (0..29) */
- dist = 0;
- for (code = 0 ; code < 16; code++) {
- base_dist[code] = dist;
- for (n = 0; n < (1<<extra_dbits[code]); n++) {
- _dist_code[dist++] = (uch)code;
- }
- }
- Assert (dist == 256, "tr_static_init: dist != 256");
- dist >>= 7; /* from now on, all distances are divided by 128 */
- for ( ; code < D_CODES; code++) {
- base_dist[code] = dist << 7;
- for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) {
- _dist_code[256 + dist++] = (uch)code;
- }
- }
- Assert (dist == 256, "tr_static_init: 256+dist != 512");
-
- /* Construct the codes of the static literal tree */
- for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0;
- n = 0;
- while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++;
- while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++;
- while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++;
- while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++;
- /* Codes 286 and 287 do not exist, but we must include them in the
- * tree construction to get a canonical Huffman tree (longest code
- * all ones)
- */
- gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count);
-
- /* The static distance tree is trivial: */
- for (n = 0; n < D_CODES; n++) {
- static_dtree[n].Len = 5;
- static_dtree[n].Code = bi_reverse((unsigned)n, 5);
- }
- static_init_done = 1;
-
-# ifdef GEN_TREES_H
- gen_trees_header();
-# endif
-#endif /* defined(GEN_TREES_H) || !defined(STDC) */
-}
-
-/* ===========================================================================
- * Genererate the file trees.h describing the static trees.
- */
-#ifdef GEN_TREES_H
-# ifndef DEBUG
-# include <stdio.h>
-# endif
-
-# define SEPARATOR(i, last, width) \
- ((i) == (last)? "\n};\n\n" : \
- ((i) % (width) == (width)-1 ? ",\n" : ", "))
-
-void gen_trees_header()
-{
- FILE *header = fopen("trees.h", "w");
- int i;
-
- Assert (header != NULL, "Can't open trees.h");
- fprintf(header,
- "/* header created automatically with -DGEN_TREES_H */\n\n");
-
- fprintf(header, "local const ct_data static_ltree[L_CODES+2] = {\n");
- for (i = 0; i < L_CODES+2; i++) {
- fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code,
- static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5));
- }
-
- fprintf(header, "local const ct_data static_dtree[D_CODES] = {\n");
- for (i = 0; i < D_CODES; i++) {
- fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code,
- static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5));
- }
-
- fprintf(header, "const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {\n");
- for (i = 0; i < DIST_CODE_LEN; i++) {
- fprintf(header, "%2u%s", _dist_code[i],
- SEPARATOR(i, DIST_CODE_LEN-1, 20));
- }
-
- fprintf(header,
- "const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= {\n");
- for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) {
- fprintf(header, "%2u%s", _length_code[i],
- SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20));
- }
-
- fprintf(header, "local const int base_length[LENGTH_CODES] = {\n");
- for (i = 0; i < LENGTH_CODES; i++) {
- fprintf(header, "%1u%s", base_length[i],
- SEPARATOR(i, LENGTH_CODES-1, 20));
- }
-
- fprintf(header, "local const int base_dist[D_CODES] = {\n");
- for (i = 0; i < D_CODES; i++) {
- fprintf(header, "%5u%s", base_dist[i],
- SEPARATOR(i, D_CODES-1, 10));
- }
-
- fclose(header);
-}
-#endif /* GEN_TREES_H */
-
-/* ===========================================================================
- * Initialize the tree data structures for a new zlib stream.
- */
-void ZLIB_INTERNAL _tr_init(s)
- deflate_state *s;
-{
- tr_static_init();
-
- s->l_desc.dyn_tree = s->dyn_ltree;
- s->l_desc.stat_desc = &static_l_desc;
-
- s->d_desc.dyn_tree = s->dyn_dtree;
- s->d_desc.stat_desc = &static_d_desc;
-
- s->bl_desc.dyn_tree = s->bl_tree;
- s->bl_desc.stat_desc = &static_bl_desc;
-
- s->bi_buf = 0;
- s->bi_valid = 0;
-#ifdef DEBUG
- s->compressed_len = 0L;
- s->bits_sent = 0L;
-#endif
-
- /* Initialize the first block of the first file: */
- init_block(s);
-}
-
-/* ===========================================================================
- * Initialize a new block.
- */
-local void init_block(s)
- deflate_state *s;
-{
- int n; /* iterates over tree elements */
-
- /* Initialize the trees. */
- for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0;
- for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0;
- for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0;
-
- s->dyn_ltree[END_BLOCK].Freq = 1;
- s->opt_len = s->static_len = 0L;
- s->last_lit = s->matches = 0;
-}
-
-#define SMALLEST 1
-/* Index within the heap array of least frequent node in the Huffman tree */
-
-
-/* ===========================================================================
- * Remove the smallest element from the heap and recreate the heap with
- * one less element. Updates heap and heap_len.
- */
-#define pqremove(s, tree, top) \
-{\
- top = s->heap[SMALLEST]; \
- s->heap[SMALLEST] = s->heap[s->heap_len--]; \
- pqdownheap(s, tree, SMALLEST); \
-}
-
-/* ===========================================================================
- * Compares to subtrees, using the tree depth as tie breaker when
- * the subtrees have equal frequency. This minimizes the worst case length.
- */
-#define smaller(tree, n, m, depth) \
- (tree[n].Freq < tree[m].Freq || \
- (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m]))
-
-/* ===========================================================================
- * Restore the heap property by moving down the tree starting at node k,
- * exchanging a node with the smallest of its two sons if necessary, stopping
- * when the heap property is re-established (each father smaller than its
- * two sons).
- */
-local void pqdownheap(s, tree, k)
- deflate_state *s;
- ct_data *tree; /* the tree to restore */
- int k; /* node to move down */
-{
- int v = s->heap[k];
- int j = k << 1; /* left son of k */
- while (j <= s->heap_len) {
- /* Set j to the smallest of the two sons: */
- if (j < s->heap_len &&
- smaller(tree, s->heap[j+1], s->heap[j], s->depth)) {
- j++;
- }
- /* Exit if v is smaller than both sons */
- if (smaller(tree, v, s->heap[j], s->depth)) break;
-
- /* Exchange v with the smallest son */
- s->heap[k] = s->heap[j]; k = j;
-
- /* And continue down the tree, setting j to the left son of k */
- j <<= 1;
- }
- s->heap[k] = v;
-}
-
-/* ===========================================================================
- * Compute the optimal bit lengths for a tree and update the total bit length
- * for the current block.
- * IN assertion: the fields freq and dad are set, heap[heap_max] and
- * above are the tree nodes sorted by increasing frequency.
- * OUT assertions: the field len is set to the optimal bit length, the
- * array bl_count contains the frequencies for each bit length.
- * The length opt_len is updated; static_len is also updated if stree is
- * not null.
- */
-local void gen_bitlen(s, desc)
- deflate_state *s;
- tree_desc *desc; /* the tree descriptor */
-{
- ct_data *tree = desc->dyn_tree;
- int max_code = desc->max_code;
- const ct_data *stree = desc->stat_desc->static_tree;
- const intf *extra = desc->stat_desc->extra_bits;
- int base = desc->stat_desc->extra_base;
- int max_length = desc->stat_desc->max_length;
- int h; /* heap index */
- int n, m; /* iterate over the tree elements */
- int bits; /* bit length */
- int xbits; /* extra bits */
- ush f; /* frequency */
- int overflow = 0; /* number of elements with bit length too large */
-
- for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0;
-
- /* In a first pass, compute the optimal bit lengths (which may
- * overflow in the case of the bit length tree).
- */
- tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */
-
- for (h = s->heap_max+1; h < HEAP_SIZE; h++) {
- n = s->heap[h];
- bits = tree[tree[n].Dad].Len + 1;
- if (bits > max_length) bits = max_length, overflow++;
- tree[n].Len = (ush)bits;
- /* We overwrite tree[n].Dad which is no longer needed */
-
- if (n > max_code) continue; /* not a leaf node */
-
- s->bl_count[bits]++;
- xbits = 0;
- if (n >= base) xbits = extra[n-base];
- f = tree[n].Freq;
- s->opt_len += (ulg)f * (bits + xbits);
- if (stree) s->static_len += (ulg)f * (stree[n].Len + xbits);
- }
- if (overflow == 0) return;
-
- Trace((stderr,"\nbit length overflow\n"));
- /* This happens for example on obj2 and pic of the Calgary corpus */
-
- /* Find the first bit length which could increase: */
- do {
- bits = max_length-1;
- while (s->bl_count[bits] == 0) bits--;
- s->bl_count[bits]--; /* move one leaf down the tree */
- s->bl_count[bits+1] += 2; /* move one overflow item as its brother */
- s->bl_count[max_length]--;
- /* The brother of the overflow item also moves one step up,
- * but this does not affect bl_count[max_length]
- */
- overflow -= 2;
- } while (overflow > 0);
-
- /* Now recompute all bit lengths, scanning in increasing frequency.
- * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all
- * lengths instead of fixing only the wrong ones. This idea is taken
- * from 'ar' written by Haruhiko Okumura.)
- */
- for (bits = max_length; bits != 0; bits--) {
- n = s->bl_count[bits];
- while (n != 0) {
- m = s->heap[--h];
- if (m > max_code) continue;
- if ((unsigned) tree[m].Len != (unsigned) bits) {
- Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits));
- s->opt_len += ((long)bits - (long)tree[m].Len)
- *(long)tree[m].Freq;
- tree[m].Len = (ush)bits;
- }
- n--;
- }
- }
-}
-
-/* ===========================================================================
- * Generate the codes for a given tree and bit counts (which need not be
- * optimal).
- * IN assertion: the array bl_count contains the bit length statistics for
- * the given tree and the field len is set for all tree elements.
- * OUT assertion: the field code is set for all tree elements of non
- * zero code length.
- */
-local void gen_codes (tree, max_code, bl_count)
- ct_data *tree; /* the tree to decorate */
- int max_code; /* largest code with non zero frequency */
- ushf *bl_count; /* number of codes at each bit length */
-{
- ush next_code[MAX_BITS+1]; /* next code value for each bit length */
- ush code = 0; /* running code value */
- int bits; /* bit index */
- int n; /* code index */
-
- /* The distribution counts are first used to generate the code values
- * without bit reversal.
- */
- for (bits = 1; bits <= MAX_BITS; bits++) {
- next_code[bits] = code = (code + bl_count[bits-1]) << 1;
- }
- /* Check that the bit counts in bl_count are consistent. The last code
- * must be all ones.
- */
- Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,
- "inconsistent bit counts");
- Tracev((stderr,"\ngen_codes: max_code %d ", max_code));
-
- for (n = 0; n <= max_code; n++) {
- int len = tree[n].Len;
- if (len == 0) continue;
- /* Now reverse the bits */
- tree[n].Code = bi_reverse(next_code[len]++, len);
-
- Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ",
- n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1));
- }
-}
-
-/* ===========================================================================
- * Construct one Huffman tree and assigns the code bit strings and lengths.
- * Update the total bit length for the current block.
- * IN assertion: the field freq is set for all tree elements.
- * OUT assertions: the fields len and code are set to the optimal bit length
- * and corresponding code. The length opt_len is updated; static_len is
- * also updated if stree is not null. The field max_code is set.
- */
-local void build_tree(s, desc)
- deflate_state *s;
- tree_desc *desc; /* the tree descriptor */
-{
- ct_data *tree = desc->dyn_tree;
- const ct_data *stree = desc->stat_desc->static_tree;
- int elems = desc->stat_desc->elems;
- int n, m; /* iterate over heap elements */
- int max_code = -1; /* largest code with non zero frequency */
- int node; /* new node being created */
-
- /* Construct the initial heap, with least frequent element in
- * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1].
- * heap[0] is not used.
- */
- s->heap_len = 0, s->heap_max = HEAP_SIZE;
-
- for (n = 0; n < elems; n++) {
- if (tree[n].Freq != 0) {
- s->heap[++(s->heap_len)] = max_code = n;
- s->depth[n] = 0;
- } else {
- tree[n].Len = 0;
- }
- }
-
- /* The pkzip format requires that at least one distance code exists,
- * and that at least one bit should be sent even if there is only one
- * possible code. So to avoid special checks later on we force at least
- * two codes of non zero frequency.
- */
- while (s->heap_len < 2) {
- node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0);
- tree[node].Freq = 1;
- s->depth[node] = 0;
- s->opt_len--; if (stree) s->static_len -= stree[node].Len;
- /* node is 0 or 1 so it does not have extra bits */
- }
- desc->max_code = max_code;
-
- /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree,
- * establish sub-heaps of increasing lengths:
- */
- for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n);
-
- /* Construct the Huffman tree by repeatedly combining the least two
- * frequent nodes.
- */
- node = elems; /* next internal node of the tree */
- do {
- pqremove(s, tree, n); /* n = node of least frequency */
- m = s->heap[SMALLEST]; /* m = node of next least frequency */
-
- s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */
- s->heap[--(s->heap_max)] = m;
-
- /* Create a new node father of n and m */
- tree[node].Freq = tree[n].Freq + tree[m].Freq;
- s->depth[node] = (uch)((s->depth[n] >= s->depth[m] ?
- s->depth[n] : s->depth[m]) + 1);
- tree[n].Dad = tree[m].Dad = (ush)node;
-#ifdef DUMP_BL_TREE
- if (tree == s->bl_tree) {
- fprintf(stderr,"\nnode %d(%d), sons %d(%d) %d(%d)",
- node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq);
- }
-#endif
- /* and insert the new node in the heap */
- s->heap[SMALLEST] = node++;
- pqdownheap(s, tree, SMALLEST);
-
- } while (s->heap_len >= 2);
-
- s->heap[--(s->heap_max)] = s->heap[SMALLEST];
-
- /* At this point, the fields freq and dad are set. We can now
- * generate the bit lengths.
- */
- gen_bitlen(s, (tree_desc *)desc);
-
- /* The field len is now set, we can generate the bit codes */
- gen_codes ((ct_data *)tree, max_code, s->bl_count);
-}
-
-/* ===========================================================================
- * Scan a literal or distance tree to determine the frequencies of the codes
- * in the bit length tree.
- */
-local void scan_tree (s, tree, max_code)
- deflate_state *s;
- ct_data *tree; /* the tree to be scanned */
- int max_code; /* and its largest code of non zero frequency */
-{
- int n; /* iterates over all tree elements */
- int prevlen = -1; /* last emitted length */
- int curlen; /* length of current code */
- int nextlen = tree[0].Len; /* length of next code */
- int count = 0; /* repeat count of the current code */
- int max_count = 7; /* max repeat count */
- int min_count = 4; /* min repeat count */
-
- if (nextlen == 0) max_count = 138, min_count = 3;
- tree[max_code+1].Len = (ush)0xffff; /* guard */
-
- for (n = 0; n <= max_code; n++) {
- curlen = nextlen; nextlen = tree[n+1].Len;
- if (++count < max_count && curlen == nextlen) {
- continue;
- } else if (count < min_count) {
- s->bl_tree[curlen].Freq += count;
- } else if (curlen != 0) {
- if (curlen != prevlen) s->bl_tree[curlen].Freq++;
- s->bl_tree[REP_3_6].Freq++;
- } else if (count <= 10) {
- s->bl_tree[REPZ_3_10].Freq++;
- } else {
- s->bl_tree[REPZ_11_138].Freq++;
- }
- count = 0; prevlen = curlen;
- if (nextlen == 0) {
- max_count = 138, min_count = 3;
- } else if (curlen == nextlen) {
- max_count = 6, min_count = 3;
- } else {
- max_count = 7, min_count = 4;
- }
- }
-}
-
-/* ===========================================================================
- * Send a literal or distance tree in compressed form, using the codes in
- * bl_tree.
- */
-local void send_tree (s, tree, max_code)
- deflate_state *s;
- ct_data *tree; /* the tree to be scanned */
- int max_code; /* and its largest code of non zero frequency */
-{
- int n; /* iterates over all tree elements */
- int prevlen = -1; /* last emitted length */
- int curlen; /* length of current code */
- int nextlen = tree[0].Len; /* length of next code */
- int count = 0; /* repeat count of the current code */
- int max_count = 7; /* max repeat count */
- int min_count = 4; /* min repeat count */
-
- /* tree[max_code+1].Len = -1; */ /* guard already set */
- if (nextlen == 0) max_count = 138, min_count = 3;
-
- for (n = 0; n <= max_code; n++) {
- curlen = nextlen; nextlen = tree[n+1].Len;
- if (++count < max_count && curlen == nextlen) {
- continue;
- } else if (count < min_count) {
- do { send_code(s, curlen, s->bl_tree); } while (--count != 0);
-
- } else if (curlen != 0) {
- if (curlen != prevlen) {
- send_code(s, curlen, s->bl_tree); count--;
- }
- Assert(count >= 3 && count <= 6, " 3_6?");
- send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2);
-
- } else if (count <= 10) {
- send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3);
-
- } else {
- send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7);
- }
- count = 0; prevlen = curlen;
- if (nextlen == 0) {
- max_count = 138, min_count = 3;
- } else if (curlen == nextlen) {
- max_count = 6, min_count = 3;
- } else {
- max_count = 7, min_count = 4;
- }
- }
-}
-
-/* ===========================================================================
- * Construct the Huffman tree for the bit lengths and return the index in
- * bl_order of the last bit length code to send.
- */
-local int build_bl_tree(s)
- deflate_state *s;
-{
- int max_blindex; /* index of last bit length code of non zero freq */
-
- /* Determine the bit length frequencies for literal and distance trees */
- scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code);
- scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code);
-
- /* Build the bit length tree: */
- build_tree(s, (tree_desc *)(&(s->bl_desc)));
- /* opt_len now includes the length of the tree representations, except
- * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.
- */
-
- /* Determine the number of bit length codes to send. The pkzip format
- * requires that at least 4 bit length codes be sent. (appnote.txt says
- * 3 but the actual value used is 4.)
- */
- for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) {
- if (s->bl_tree[bl_order[max_blindex]].Len != 0) break;
- }
- /* Update opt_len to include the bit length tree and counts */
- s->opt_len += 3*(max_blindex+1) + 5+5+4;
- Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld",
- s->opt_len, s->static_len));
-
- return max_blindex;
-}
-
-/* ===========================================================================
- * Send the header for a block using dynamic Huffman trees: the counts, the
- * lengths of the bit length codes, the literal tree and the distance tree.
- * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.
- */
-local void send_all_trees(s, lcodes, dcodes, blcodes)
- deflate_state *s;
- int lcodes, dcodes, blcodes; /* number of codes for each tree */
-{
- int rank; /* index in bl_order */
-
- Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes");
- Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,
- "too many codes");
- Tracev((stderr, "\nbl counts: "));
- send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */
- send_bits(s, dcodes-1, 5);
- send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */
- for (rank = 0; rank < blcodes; rank++) {
- Tracev((stderr, "\nbl code %2d ", bl_order[rank]));
- send_bits(s, s->bl_tree[bl_order[rank]].Len, 3);
- }
- Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent));
-
- send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */
- Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent));
-
- send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */
- Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent));
-}
-
-/* ===========================================================================
- * Send a stored block
- */
-void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last)
- deflate_state *s;
- charf *buf; /* input block */
- ulg stored_len; /* length of input block */
- int last; /* one if this is the last block for a file */
-{
- send_bits(s, (STORED_BLOCK<<1)+last, 3); /* send block type */
-#ifdef DEBUG
- s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L;
- s->compressed_len += (stored_len + 4) << 3;
-#endif
- copy_block(s, buf, (unsigned)stored_len, 1); /* with header */
-}
-
-/* ===========================================================================
- * Flush the bits in the bit buffer to pending output (leaves at most 7 bits)
- */
-void ZLIB_INTERNAL _tr_flush_bits(s)
- deflate_state *s;
-{
- bi_flush(s);
-}
-
-/* ===========================================================================
- * Send one empty static block to give enough lookahead for inflate.
- * This takes 10 bits, of which 7 may remain in the bit buffer.
- */
-void ZLIB_INTERNAL _tr_align(s)
- deflate_state *s;
-{
- send_bits(s, STATIC_TREES<<1, 3);
- send_code(s, END_BLOCK, static_ltree);
-#ifdef DEBUG
- s->compressed_len += 10L; /* 3 for block type, 7 for EOB */
-#endif
- bi_flush(s);
-}
-
-/* ===========================================================================
- * Determine the best encoding for the current block: dynamic trees, static
- * trees or store, and output the encoded block to the zip file.
- */
-void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
- deflate_state *s;
- charf *buf; /* input block, or NULL if too old */
- ulg stored_len; /* length of input block */
- int last; /* one if this is the last block for a file */
-{
- ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */
- int max_blindex = 0; /* index of last bit length code of non zero freq */
-
- /* Build the Huffman trees unless a stored block is forced */
- if (s->level > 0) {
-
- /* Check if the file is binary or text */
- if (s->strm->data_type == Z_UNKNOWN)
- s->strm->data_type = detect_data_type(s);
-
- /* Construct the literal and distance trees */
- build_tree(s, (tree_desc *)(&(s->l_desc)));
- Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len,
- s->static_len));
-
- build_tree(s, (tree_desc *)(&(s->d_desc)));
- Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len,
- s->static_len));
- /* At this point, opt_len and static_len are the total bit lengths of
- * the compressed block data, excluding the tree representations.
- */
-
- /* Build the bit length tree for the above two trees, and get the index
- * in bl_order of the last bit length code to send.
- */
- max_blindex = build_bl_tree(s);
-
- /* Determine the best encoding. Compute the block lengths in bytes. */
- opt_lenb = (s->opt_len+3+7)>>3;
- static_lenb = (s->static_len+3+7)>>3;
-
- Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
- opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
- s->last_lit));
-
- if (static_lenb <= opt_lenb) opt_lenb = static_lenb;
-
- } else {
- Assert(buf != (char*)0, "lost buf");
- opt_lenb = static_lenb = stored_len + 5; /* force a stored block */
- }
-
-#ifdef FORCE_STORED
- if (buf != (char*)0) { /* force stored block */
-#else
- if (stored_len+4 <= opt_lenb && buf != (char*)0) {
- /* 4: two words for the lengths */
-#endif
- /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.
- * Otherwise we can't have processed more than WSIZE input bytes since
- * the last block flush, because compression would have been
- * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to
- * transform a block into a stored block.
- */
- _tr_stored_block(s, buf, stored_len, last);
-
-#ifdef FORCE_STATIC
- } else if (static_lenb >= 0) { /* force static trees */
-#else
- } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) {
-#endif
- send_bits(s, (STATIC_TREES<<1)+last, 3);
- compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree);
-#ifdef DEBUG
- s->compressed_len += 3 + s->static_len;
-#endif
- } else {
- send_bits(s, (DYN_TREES<<1)+last, 3);
- send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1,
- max_blindex+1);
- compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree);
-#ifdef DEBUG
- s->compressed_len += 3 + s->opt_len;
-#endif
- }
- Assert (s->compressed_len == s->bits_sent, "bad compressed size");
- /* The above check is made mod 2^32, for files larger than 512 MB
- * and uLong implemented on 32 bits.
- */
- init_block(s);
-
- if (last) {
- bi_windup(s);
-#ifdef DEBUG
- s->compressed_len += 7; /* align on byte boundary */
-#endif
- }
- Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3,
- s->compressed_len-7*last));
-}
-
-/* ===========================================================================
- * Save the match info and tally the frequency counts. Return true if
- * the current block must be flushed.
- */
-int ZLIB_INTERNAL _tr_tally (s, dist, lc)
- deflate_state *s;
- unsigned dist; /* distance of matched string */
- unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */
-{
- s->d_buf[s->last_lit] = (ush)dist;
- s->l_buf[s->last_lit++] = (uch)lc;
- if (dist == 0) {
- /* lc is the unmatched char */
- s->dyn_ltree[lc].Freq++;
- } else {
- s->matches++;
- /* Here, lc is the match length - MIN_MATCH */
- dist--; /* dist = match distance - 1 */
- Assert((ush)dist < (ush)MAX_DIST(s) &&
- (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&
- (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match");
-
- s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++;
- s->dyn_dtree[d_code(dist)].Freq++;
- }
-
-#ifdef TRUNCATE_BLOCK
- /* Try to guess if it is profitable to stop the current block here */
- if ((s->last_lit & 0x1fff) == 0 && s->level > 2) {
- /* Compute an upper bound for the compressed length */
- ulg out_length = (ulg)s->last_lit*8L;
- ulg in_length = (ulg)((long)s->strstart - s->block_start);
- int dcode;
- for (dcode = 0; dcode < D_CODES; dcode++) {
- out_length += (ulg)s->dyn_dtree[dcode].Freq *
- (5L+extra_dbits[dcode]);
- }
- out_length >>= 3;
- Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ",
- s->last_lit, in_length, out_length,
- 100L - out_length*100L/in_length));
- if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1;
- }
-#endif
- return (s->last_lit == s->lit_bufsize-1);
- /* We avoid equality with lit_bufsize because of wraparound at 64K
- * on 16 bit machines and because stored blocks are restricted to
- * 64K-1 bytes.
- */
-}
-
-/* ===========================================================================
- * Send the block data compressed using the given Huffman trees
- */
-local void compress_block(s, ltree, dtree)
- deflate_state *s;
- ct_data *ltree; /* literal tree */
- ct_data *dtree; /* distance tree */
-{
- unsigned dist; /* distance of matched string */
- int lc; /* match length or unmatched char (if dist == 0) */
- unsigned lx = 0; /* running index in l_buf */
- unsigned code; /* the code to send */
- int extra; /* number of extra bits to send */
-
- if (s->last_lit != 0) do {
- dist = s->d_buf[lx];
- lc = s->l_buf[lx++];
- if (dist == 0) {
- send_code(s, lc, ltree); /* send a literal byte */
- Tracecv(isgraph(lc), (stderr," '%c' ", lc));
- } else {
- /* Here, lc is the match length - MIN_MATCH */
- code = _length_code[lc];
- send_code(s, code+LITERALS+1, ltree); /* send the length code */
- extra = extra_lbits[code];
- if (extra != 0) {
- lc -= base_length[code];
- send_bits(s, lc, extra); /* send the extra length bits */
- }
- dist--; /* dist is now the match distance - 1 */
- code = d_code(dist);
- Assert (code < D_CODES, "bad d_code");
-
- send_code(s, code, dtree); /* send the distance code */
- extra = extra_dbits[code];
- if (extra != 0) {
- dist -= base_dist[code];
- send_bits(s, dist, extra); /* send the extra distance bits */
- }
- } /* literal or match pair ? */
-
- /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */
- Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx,
- "pendingBuf overflow");
-
- } while (lx < s->last_lit);
-
- send_code(s, END_BLOCK, ltree);
-}
-
-/* ===========================================================================
- * Check if the data type is TEXT or BINARY, using the following algorithm:
- * - TEXT if the two conditions below are satisfied:
- * a) There are no non-portable control characters belonging to the
- * "black list" (0..6, 14..25, 28..31).
- * b) There is at least one printable character belonging to the
- * "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).
- * - BINARY otherwise.
- * - The following partially-portable control characters form a
- * "gray list" that is ignored in this detection algorithm:
- * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).
- * IN assertion: the fields Freq of dyn_ltree are set.
- */
-local int detect_data_type(s)
- deflate_state *s;
-{
- /* black_mask is the bit mask of black-listed bytes
- * set bits 0..6, 14..25, and 28..31
- * 0xf3ffc07f = binary 11110011111111111100000001111111
- */
- unsigned long black_mask = 0xf3ffc07fUL;
- int n;
-
- /* Check for non-textual ("black-listed") bytes. */
- for (n = 0; n <= 31; n++, black_mask >>= 1)
- if ((black_mask & 1) && (s->dyn_ltree[n].Freq != 0))
- return Z_BINARY;
-
- /* Check for textual ("white-listed") bytes. */
- if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0
- || s->dyn_ltree[13].Freq != 0)
- return Z_TEXT;
- for (n = 32; n < LITERALS; n++)
- if (s->dyn_ltree[n].Freq != 0)
- return Z_TEXT;
-
- /* There are no "black-listed" or "white-listed" bytes:
- * this stream either is empty or has tolerated ("gray-listed") bytes only.
- */
- return Z_BINARY;
-}
-
-/* ===========================================================================
- * Reverse the first len bits of a code, using straightforward code (a faster
- * method would use a table)
- * IN assertion: 1 <= len <= 15
- */
-local unsigned bi_reverse(code, len)
- unsigned code; /* the value to invert */
- int len; /* its bit length */
-{
- register unsigned res = 0;
- do {
- res |= code & 1;
- code >>= 1, res <<= 1;
- } while (--len > 0);
- return res >> 1;
-}
-
-/* ===========================================================================
- * Flush the bit buffer, keeping at most 7 bits in it.
- */
-local void bi_flush(s)
- deflate_state *s;
-{
- if (s->bi_valid == 16) {
- put_short(s, s->bi_buf);
- s->bi_buf = 0;
- s->bi_valid = 0;
- } else if (s->bi_valid >= 8) {
- put_byte(s, (Byte)s->bi_buf);
- s->bi_buf >>= 8;
- s->bi_valid -= 8;
- }
-}
-
-/* ===========================================================================
- * Flush the bit buffer and align the output on a byte boundary
- */
-local void bi_windup(s)
- deflate_state *s;
-{
- if (s->bi_valid > 8) {
- put_short(s, s->bi_buf);
- } else if (s->bi_valid > 0) {
- put_byte(s, (Byte)s->bi_buf);
- }
- s->bi_buf = 0;
- s->bi_valid = 0;
-#ifdef DEBUG
- s->bits_sent = (s->bits_sent+7) & ~7;
-#endif
-}
-
-/* ===========================================================================
- * Copy a stored block, storing first the length and its
- * one's complement if requested.
- */
-local void copy_block(s, buf, len, header)
- deflate_state *s;
- charf *buf; /* the input data */
- unsigned len; /* its length */
- int header; /* true if block header must be written */
-{
- bi_windup(s); /* align on byte boundary */
-
- if (header) {
- put_short(s, (ush)len);
- put_short(s, (ush)~len);
-#ifdef DEBUG
- s->bits_sent += 2*16;
-#endif
- }
-#ifdef DEBUG
- s->bits_sent += (ulg)len<<3;
-#endif
- while (len--) {
- put_byte(s, *buf++);
- }
-}
diff --git a/sdk-modifications/libsrc/zlib/trees.h b/sdk-modifications/libsrc/zlib/trees.h
deleted file mode 100755
index d35639d..0000000
--- a/sdk-modifications/libsrc/zlib/trees.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/* header created automatically with -DGEN_TREES_H */
-
-local const ct_data static_ltree[L_CODES+2] = {
-{{ 12},{ 8}}, {{140},{ 8}}, {{ 76},{ 8}}, {{204},{ 8}}, {{ 44},{ 8}},
-{{172},{ 8}}, {{108},{ 8}}, {{236},{ 8}}, {{ 28},{ 8}}, {{156},{ 8}},
-{{ 92},{ 8}}, {{220},{ 8}}, {{ 60},{ 8}}, {{188},{ 8}}, {{124},{ 8}},
-{{252},{ 8}}, {{ 2},{ 8}}, {{130},{ 8}}, {{ 66},{ 8}}, {{194},{ 8}},
-{{ 34},{ 8}}, {{162},{ 8}}, {{ 98},{ 8}}, {{226},{ 8}}, {{ 18},{ 8}},
-{{146},{ 8}}, {{ 82},{ 8}}, {{210},{ 8}}, {{ 50},{ 8}}, {{178},{ 8}},
-{{114},{ 8}}, {{242},{ 8}}, {{ 10},{ 8}}, {{138},{ 8}}, {{ 74},{ 8}},
-{{202},{ 8}}, {{ 42},{ 8}}, {{170},{ 8}}, {{106},{ 8}}, {{234},{ 8}},
-{{ 26},{ 8}}, {{154},{ 8}}, {{ 90},{ 8}}, {{218},{ 8}}, {{ 58},{ 8}},
-{{186},{ 8}}, {{122},{ 8}}, {{250},{ 8}}, {{ 6},{ 8}}, {{134},{ 8}},
-{{ 70},{ 8}}, {{198},{ 8}}, {{ 38},{ 8}}, {{166},{ 8}}, {{102},{ 8}},
-{{230},{ 8}}, {{ 22},{ 8}}, {{150},{ 8}}, {{ 86},{ 8}}, {{214},{ 8}},
-{{ 54},{ 8}}, {{182},{ 8}}, {{118},{ 8}}, {{246},{ 8}}, {{ 14},{ 8}},
-{{142},{ 8}}, {{ 78},{ 8}}, {{206},{ 8}}, {{ 46},{ 8}}, {{174},{ 8}},
-{{110},{ 8}}, {{238},{ 8}}, {{ 30},{ 8}}, {{158},{ 8}}, {{ 94},{ 8}},
-{{222},{ 8}}, {{ 62},{ 8}}, {{190},{ 8}}, {{126},{ 8}}, {{254},{ 8}},
-{{ 1},{ 8}}, {{129},{ 8}}, {{ 65},{ 8}}, {{193},{ 8}}, {{ 33},{ 8}},
-{{161},{ 8}}, {{ 97},{ 8}}, {{225},{ 8}}, {{ 17},{ 8}}, {{145},{ 8}},
-{{ 81},{ 8}}, {{209},{ 8}}, {{ 49},{ 8}}, {{177},{ 8}}, {{113},{ 8}},
-{{241},{ 8}}, {{ 9},{ 8}}, {{137},{ 8}}, {{ 73},{ 8}}, {{201},{ 8}},
-{{ 41},{ 8}}, {{169},{ 8}}, {{105},{ 8}}, {{233},{ 8}}, {{ 25},{ 8}},
-{{153},{ 8}}, {{ 89},{ 8}}, {{217},{ 8}}, {{ 57},{ 8}}, {{185},{ 8}},
-{{121},{ 8}}, {{249},{ 8}}, {{ 5},{ 8}}, {{133},{ 8}}, {{ 69},{ 8}},
-{{197},{ 8}}, {{ 37},{ 8}}, {{165},{ 8}}, {{101},{ 8}}, {{229},{ 8}},
-{{ 21},{ 8}}, {{149},{ 8}}, {{ 85},{ 8}}, {{213},{ 8}}, {{ 53},{ 8}},
-{{181},{ 8}}, {{117},{ 8}}, {{245},{ 8}}, {{ 13},{ 8}}, {{141},{ 8}},
-{{ 77},{ 8}}, {{205},{ 8}}, {{ 45},{ 8}}, {{173},{ 8}}, {{109},{ 8}},
-{{237},{ 8}}, {{ 29},{ 8}}, {{157},{ 8}}, {{ 93},{ 8}}, {{221},{ 8}},
-{{ 61},{ 8}}, {{189},{ 8}}, {{125},{ 8}}, {{253},{ 8}}, {{ 19},{ 9}},
-{{275},{ 9}}, {{147},{ 9}}, {{403},{ 9}}, {{ 83},{ 9}}, {{339},{ 9}},
-{{211},{ 9}}, {{467},{ 9}}, {{ 51},{ 9}}, {{307},{ 9}}, {{179},{ 9}},
-{{435},{ 9}}, {{115},{ 9}}, {{371},{ 9}}, {{243},{ 9}}, {{499},{ 9}},
-{{ 11},{ 9}}, {{267},{ 9}}, {{139},{ 9}}, {{395},{ 9}}, {{ 75},{ 9}},
-{{331},{ 9}}, {{203},{ 9}}, {{459},{ 9}}, {{ 43},{ 9}}, {{299},{ 9}},
-{{171},{ 9}}, {{427},{ 9}}, {{107},{ 9}}, {{363},{ 9}}, {{235},{ 9}},
-{{491},{ 9}}, {{ 27},{ 9}}, {{283},{ 9}}, {{155},{ 9}}, {{411},{ 9}},
-{{ 91},{ 9}}, {{347},{ 9}}, {{219},{ 9}}, {{475},{ 9}}, {{ 59},{ 9}},
-{{315},{ 9}}, {{187},{ 9}}, {{443},{ 9}}, {{123},{ 9}}, {{379},{ 9}},
-{{251},{ 9}}, {{507},{ 9}}, {{ 7},{ 9}}, {{263},{ 9}}, {{135},{ 9}},
-{{391},{ 9}}, {{ 71},{ 9}}, {{327},{ 9}}, {{199},{ 9}}, {{455},{ 9}},
-{{ 39},{ 9}}, {{295},{ 9}}, {{167},{ 9}}, {{423},{ 9}}, {{103},{ 9}},
-{{359},{ 9}}, {{231},{ 9}}, {{487},{ 9}}, {{ 23},{ 9}}, {{279},{ 9}},
-{{151},{ 9}}, {{407},{ 9}}, {{ 87},{ 9}}, {{343},{ 9}}, {{215},{ 9}},
-{{471},{ 9}}, {{ 55},{ 9}}, {{311},{ 9}}, {{183},{ 9}}, {{439},{ 9}},
-{{119},{ 9}}, {{375},{ 9}}, {{247},{ 9}}, {{503},{ 9}}, {{ 15},{ 9}},
-{{271},{ 9}}, {{143},{ 9}}, {{399},{ 9}}, {{ 79},{ 9}}, {{335},{ 9}},
-{{207},{ 9}}, {{463},{ 9}}, {{ 47},{ 9}}, {{303},{ 9}}, {{175},{ 9}},
-{{431},{ 9}}, {{111},{ 9}}, {{367},{ 9}}, {{239},{ 9}}, {{495},{ 9}},
-{{ 31},{ 9}}, {{287},{ 9}}, {{159},{ 9}}, {{415},{ 9}}, {{ 95},{ 9}},
-{{351},{ 9}}, {{223},{ 9}}, {{479},{ 9}}, {{ 63},{ 9}}, {{319},{ 9}},
-{{191},{ 9}}, {{447},{ 9}}, {{127},{ 9}}, {{383},{ 9}}, {{255},{ 9}},
-{{511},{ 9}}, {{ 0},{ 7}}, {{ 64},{ 7}}, {{ 32},{ 7}}, {{ 96},{ 7}},
-{{ 16},{ 7}}, {{ 80},{ 7}}, {{ 48},{ 7}}, {{112},{ 7}}, {{ 8},{ 7}},
-{{ 72},{ 7}}, {{ 40},{ 7}}, {{104},{ 7}}, {{ 24},{ 7}}, {{ 88},{ 7}},
-{{ 56},{ 7}}, {{120},{ 7}}, {{ 4},{ 7}}, {{ 68},{ 7}}, {{ 36},{ 7}},
-{{100},{ 7}}, {{ 20},{ 7}}, {{ 84},{ 7}}, {{ 52},{ 7}}, {{116},{ 7}},
-{{ 3},{ 8}}, {{131},{ 8}}, {{ 67},{ 8}}, {{195},{ 8}}, {{ 35},{ 8}},
-{{163},{ 8}}, {{ 99},{ 8}}, {{227},{ 8}}
-};
-
-local const ct_data static_dtree[D_CODES] = {
-{{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}},
-{{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}},
-{{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}},
-{{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}},
-{{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}},
-{{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}}
-};
-
-const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {
- 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8,
- 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10,
-10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
-11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
-12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13,
-13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
-14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
-14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
-14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15,
-15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
-15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
-15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 16, 17,
-18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22,
-23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
-24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
-26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
-26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27,
-27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
-27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
-28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
-28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
-28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
-29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
-29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
-29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29
-};
-
-const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= {
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12,
-13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16,
-17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19,
-19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
-21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22,
-22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23,
-23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
-24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
-25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
-25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26,
-26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
-26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
-27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28
-};
-
-local const int base_length[LENGTH_CODES] = {
-0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56,
-64, 80, 96, 112, 128, 160, 192, 224, 0
-};
-
-local const int base_dist[D_CODES] = {
- 0, 1, 2, 3, 4, 6, 8, 12, 16, 24,
- 32, 48, 64, 96, 128, 192, 256, 384, 512, 768,
- 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576
-};
-
diff --git a/sdk-modifications/libsrc/zlib/uncompr.c b/sdk-modifications/libsrc/zlib/uncompr.c
deleted file mode 100755
index ad98be3..0000000
--- a/sdk-modifications/libsrc/zlib/uncompr.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/* uncompr.c -- decompress a memory buffer
- * Copyright (C) 1995-2003, 2010 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* @(#) $Id$ */
-
-#define ZLIB_INTERNAL
-#include "zlib.h"
-
-/* ===========================================================================
- Decompresses the source buffer into the destination buffer. sourceLen is
- the byte length of the source buffer. Upon entry, destLen is the total
- size of the destination buffer, which must be large enough to hold the
- entire uncompressed data. (The size of the uncompressed data must have
- been saved previously by the compressor and transmitted to the decompressor
- by some mechanism outside the scope of this compression library.)
- Upon exit, destLen is the actual size of the compressed buffer.
-
- uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
- enough memory, Z_BUF_ERROR if there was not enough room in the output
- buffer, or Z_DATA_ERROR if the input data was corrupted.
-*/
-int ZEXPORT uncompress (dest, destLen, source, sourceLen)
- Bytef *dest;
- uLongf *destLen;
- const Bytef *source;
- uLong sourceLen;
-{
- z_stream stream;
- int err;
-
- stream.next_in = (Bytef*)source;
- stream.avail_in = (uInt)sourceLen;
- /* Check for source > 64K on 16-bit machine: */
- if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
-
- stream.next_out = dest;
- stream.avail_out = (uInt)*destLen;
- if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
-
- stream.zalloc = (alloc_func)0;
- stream.zfree = (free_func)0;
-
- err = inflateInit(&stream);
- if (err != Z_OK) return err;
-
- err = inflate(&stream, Z_FINISH);
- if (err != Z_STREAM_END) {
- inflateEnd(&stream);
- if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0))
- return Z_DATA_ERROR;
- return err;
- }
- *destLen = stream.total_out;
-
- err = inflateEnd(&stream);
- return err;
-}
diff --git a/sdk-modifications/libsrc/zlib/zconf.h b/sdk-modifications/libsrc/zlib/zconf.h
deleted file mode 100644
index 587a87c..0000000
--- a/sdk-modifications/libsrc/zlib/zconf.h
+++ /dev/null
@@ -1,468 +0,0 @@
-/* zconf.h -- configuration of the zlib compression library
- * Copyright (C) 1995-2011 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* @(#) $Id$ */
-
-#ifndef ZCONF_H
-#define ZCONF_H
-
-/*
- * If you *really* need a unique prefix for all types and library functions,
- * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
- * Even better than compiling with -DZ_PREFIX would be to use configure to set
- * this permanently in zconf.h using "./configure --zprefix".
- */
-#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */
-# define Z_PREFIX_SET
-
-/* all linked symbols */
-# define _dist_code z__dist_code
-# define _length_code z__length_code
-# define _tr_align z__tr_align
-# define _tr_flush_block z__tr_flush_block
-# define _tr_init z__tr_init
-# define _tr_stored_block z__tr_stored_block
-# define _tr_tally z__tr_tally
-# define adler32 z_adler32
-# define adler32_combine z_adler32_combine
-# define adler32_combine64 z_adler32_combine64
-# ifndef Z_SOLO
-# define compress z_compress
-# define compress2 z_compress2
-# define compressBound z_compressBound
-# endif
-# define crc32 z_crc32
-# define crc32_combine z_crc32_combine
-# define crc32_combine64 z_crc32_combine64
-# define deflate z_deflate
-# define deflateBound z_deflateBound
-# define deflateCopy z_deflateCopy
-# define deflateEnd z_deflateEnd
-# define deflateInit2_ z_deflateInit2_
-# define deflateInit_ z_deflateInit_
-# define deflateParams z_deflateParams
-# define deflatePending z_deflatePending
-# define deflatePrime z_deflatePrime
-# define deflateReset z_deflateReset
-# define deflateResetKeep z_deflateResetKeep
-# define deflateSetDictionary z_deflateSetDictionary
-# define deflateSetHeader z_deflateSetHeader
-# define deflateTune z_deflateTune
-# define deflate_copyright z_deflate_copyright
-# define get_crc_table z_get_crc_table
-# ifndef Z_SOLO
-# define gz_error z_gz_error
-# define gz_intmax z_gz_intmax
-# define gz_strwinerror z_gz_strwinerror
-# define gzbuffer z_gzbuffer
-# define gzclearerr z_gzclearerr
-# define gzclose z_gzclose
-# define gzclose_r z_gzclose_r
-# define gzclose_w z_gzclose_w
-# define gzdirect z_gzdirect
-# define gzdopen z_gzdopen
-# define gzeof z_gzeof
-# define gzerror z_gzerror
-# define gzflags z_gzflags
-# define gzflush z_gzflush
-# define gzgetc z_gzgetc
-# define gzgetc_ z_gzgetc_
-# define gzgets z_gzgets
-# define gzoffset z_gzoffset
-# define gzoffset64 z_gzoffset64
-# define gzopen z_gzopen
-# define gzopen64 z_gzopen64
-# define gzprintf z_gzprintf
-# define gzputc z_gzputc
-# define gzputs z_gzputs
-# define gzread z_gzread
-# define gzrewind z_gzrewind
-# define gzseek z_gzseek
-# define gzseek64 z_gzseek64
-# define gzsetparams z_gzsetparams
-# define gztell z_gztell
-# define gztell64 z_gztell64
-# define gzungetc z_gzungetc
-# define gzwrite z_gzwrite
-# endif
-# define inflate z_inflate
-# define inflateBack z_inflateBack
-# define inflateBackEnd z_inflateBackEnd
-# define inflateBackInit_ z_inflateBackInit_
-# define inflateCopy z_inflateCopy
-# define inflateEnd z_inflateEnd
-# define inflateGetHeader z_inflateGetHeader
-# define inflateInit2_ z_inflateInit2_
-# define inflateInit_ z_inflateInit_
-# define inflateMark z_inflateMark
-# define inflatePrime z_inflatePrime
-# define inflateReset z_inflateReset
-# define inflateReset2 z_inflateReset2
-# define inflateSetDictionary z_inflateSetDictionary
-# define inflateSync z_inflateSync
-# define inflateSyncPoint z_inflateSyncPoint
-# define inflateUndermine z_inflateUndermine
-# define inflateResetKeep z_inflateResetKeep
-# define inflate_copyright z_inflate_copyright
-# define inflate_fast z_inflate_fast
-# define inflate_table z_inflate_table
-# ifndef Z_SOLO
-# define uncompress z_uncompress
-# endif
-# define zError z_zError
-# ifndef Z_SOLO
-# define zcalloc z_zcalloc
-# define zcfree z_zcfree
-# endif
-# define zlibCompileFlags z_zlibCompileFlags
-# define zlibVersion z_zlibVersion
-
-/* all zlib typedefs in zlib.h and zconf.h */
-# define Byte z_Byte
-# define Bytef z_Bytef
-# define alloc_func z_alloc_func
-# define charf z_charf
-# define free_func z_free_func
-# ifndef Z_SOLO
-# define gzFile z_gzFile
-# define gz_header z_gz_header
-# define gz_headerp z_gz_headerp
-# endif
-# define in_func z_in_func
-# define intf z_intf
-# define out_func z_out_func
-# define uInt z_uInt
-# define uIntf z_uIntf
-# define uLong z_uLong
-# define uLongf z_uLongf
-# define voidp z_voidp
-# define voidpc z_voidpc
-# define voidpf z_voidpf
-
-/* all zlib structs in zlib.h and zconf.h */
-# ifndef Z_SOLO
-# define gz_header_s z_gz_header_s
-# endif
-# define internal_state z_internal_state
-
-#endif
-
-#if defined(__MSDOS__) && !defined(MSDOS)
-# define MSDOS
-#endif
-#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
-# define OS2
-#endif
-#if defined(_WINDOWS) && !defined(WINDOWS)
-# define WINDOWS
-#endif
-#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
-# ifndef WIN32
-# define WIN32
-# endif
-#endif
-#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
-# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
-# ifndef SYS16BIT
-# define SYS16BIT
-# endif
-# endif
-#endif
-
-/*
- * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
- * than 64k bytes at a time (needed on systems with 16-bit int).
- */
-#ifdef SYS16BIT
-# define MAXSEG_64K
-#endif
-#ifdef MSDOS
-# define UNALIGNED_OK
-#endif
-
-#ifdef __STDC_VERSION__
-# ifndef STDC
-# define STDC
-# endif
-# if __STDC_VERSION__ >= 199901L
-# ifndef STDC99
-# define STDC99
-# endif
-# endif
-#endif
-#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
-# define STDC
-#endif
-#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
-# define STDC
-#endif
-#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
-# define STDC
-#endif
-#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
-# define STDC
-#endif
-
-#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
-# define STDC
-#endif
-
-#ifndef STDC
-# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
-# define const /* note: need a more gentle solution here */
-# endif
-#endif
-
-#if defined(ZLIB_CONST) && !defined(z_const)
-# define z_const const
-#else
-# define z_const
-#endif
-
-/* Some Mac compilers merge all .h files incorrectly: */
-#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
-# define NO_DUMMY_DECL
-#endif
-
-/* Maximum value for memLevel in deflateInit2 */
-#ifndef MAX_MEM_LEVEL
-# ifdef MAXSEG_64K
-# define MAX_MEM_LEVEL 8
-# else
-# define MAX_MEM_LEVEL 9
-# endif
-#endif
-
-/* Maximum value for windowBits in deflateInit2 and inflateInit2.
- * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
- * created by gzip. (Files created by minigzip can still be extracted by
- * gzip.)
- */
-#ifndef MAX_WBITS
-# define MAX_WBITS 15 /* 32K LZ77 window */
-#endif
-
-/* The memory requirements for deflate are (in bytes):
- (1 << (windowBits+2)) + (1 << (memLevel+9))
- that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
- plus a few kilobytes for small objects. For example, if you want to reduce
- the default memory requirements from 256K to 128K, compile with
- make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
- Of course this will generally degrade compression (there's no free lunch).
-
- The memory requirements for inflate are (in bytes) 1 << windowBits
- that is, 32K for windowBits=15 (default value) plus a few kilobytes
- for small objects.
-*/
-
- /* Type declarations */
-
-#ifndef OF /* function prototypes */
-# ifdef STDC
-# define OF(args) args
-# else
-# define OF(args) ()
-# endif
-#endif
-
-#ifndef Z_ARG /* function prototypes for stdarg */
-# if defined(STDC) || defined(Z_HAVE_STDARG_H)
-# define Z_ARG(args) args
-# else
-# define Z_ARG(args) ()
-# endif
-#endif
-
-/* The following definitions for FAR are needed only for MSDOS mixed
- * model programming (small or medium model with some far allocations).
- * This was tested only with MSC; for other MSDOS compilers you may have
- * to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
- * just define FAR to be empty.
- */
-#ifdef SYS16BIT
-# if defined(M_I86SM) || defined(M_I86MM)
- /* MSC small or medium model */
-# define SMALL_MEDIUM
-# ifdef _MSC_VER
-# define FAR _far
-# else
-# define FAR far
-# endif
-# endif
-# if (defined(__SMALL__) || defined(__MEDIUM__))
- /* Turbo C small or medium model */
-# define SMALL_MEDIUM
-# ifdef __BORLANDC__
-# define FAR _far
-# else
-# define FAR far
-# endif
-# endif
-#endif
-
-#if defined(WINDOWS) || defined(WIN32)
- /* If building or using zlib as a DLL, define ZLIB_DLL.
- * This is not mandatory, but it offers a little performance increase.
- */
-# ifdef ZLIB_DLL
-# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
-# ifdef ZLIB_INTERNAL
-# define ZEXTERN extern __declspec(dllexport)
-# else
-# define ZEXTERN extern __declspec(dllimport)
-# endif
-# endif
-# endif /* ZLIB_DLL */
- /* If building or using zlib with the WINAPI/WINAPIV calling convention,
- * define ZLIB_WINAPI.
- * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
- */
-# ifdef ZLIB_WINAPI
-# ifdef FAR
-# undef FAR
-# endif
-# include <windows.h>
- /* No need for _export, use ZLIB.DEF instead. */
- /* For complete Windows compatibility, use WINAPI, not __stdcall. */
-# define ZEXPORT WINAPI
-# ifdef WIN32
-# define ZEXPORTVA WINAPIV
-# else
-# define ZEXPORTVA FAR CDECL
-# endif
-# endif
-#endif
-
-#if defined (__BEOS__)
-# ifdef ZLIB_DLL
-# ifdef ZLIB_INTERNAL
-# define ZEXPORT __declspec(dllexport)
-# define ZEXPORTVA __declspec(dllexport)
-# else
-# define ZEXPORT __declspec(dllimport)
-# define ZEXPORTVA __declspec(dllimport)
-# endif
-# endif
-#endif
-
-#ifndef ZEXTERN
-# define ZEXTERN extern
-#endif
-#ifndef ZEXPORT
-# define ZEXPORT
-#endif
-#ifndef ZEXPORTVA
-# define ZEXPORTVA
-#endif
-
-#ifndef FAR
-# define FAR
-#endif
-
-#if !defined(__MACTYPES__)
-typedef unsigned char Byte; /* 8 bits */
-#endif
-typedef unsigned int uInt; /* 16 bits or more */
-typedef unsigned long uLong; /* 32 bits or more */
-
-#ifdef SMALL_MEDIUM
- /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
-# define Bytef Byte FAR
-#else
- typedef Byte FAR Bytef;
-#endif
-typedef char FAR charf;
-typedef int FAR intf;
-typedef uInt FAR uIntf;
-typedef uLong FAR uLongf;
-
-#ifdef STDC
- typedef void const *voidpc;
- typedef void FAR *voidpf;
- typedef void *voidp;
-#else
- typedef Byte const *voidpc;
- typedef Byte FAR *voidpf;
- typedef Byte *voidp;
-#endif
-
-#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */
-# define Z_HAVE_UNISTD_H
-#endif
-
-#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */
-# define Z_HAVE_STDARG_H
-#endif
-
-#ifdef STDC
-# ifndef Z_SOLO
-// # include <sys/types.h> /* for off_t */
-// Doesn't work on the DS2 SDK, because there are type conflicts between
-// sys/types.h and the filesystem API.//# include <sys/types.h> /* for off_t */
-# endif
-#endif
-
-/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
- * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
- * though the former does not conform to the LFS document), but considering
- * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
- * equivalently requesting no 64-bit operations
- */
-#if -_LARGEFILE64_SOURCE - -1 == 1
-# undef _LARGEFILE64_SOURCE
-#endif
-
-#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
-# define Z_LARGE
-#endif
-
-#if (defined(Z_HAVE_UNISTD_H) || defined(Z_LARGE)) && !defined(Z_SOLO)
-# include <unistd.h> /* for SEEK_* and off_t */
-# ifdef VMS
-# include <unixio.h> /* for off_t */
-# endif
-# ifndef z_off_t
-# define z_off_t off_t
-# endif
-#endif
-
-#if !defined(SEEK_SET) && !defined(Z_SOLO)
-# define SEEK_SET 0 /* Seek from beginning of file. */
-# define SEEK_CUR 1 /* Seek from current position. */
-# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
-#endif
-
-#ifndef z_off_t
-# define z_off_t long
-#endif
-
-#if !defined(_WIN32) && (defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0)
-# define z_off64_t off64_t
-#else
-# if defined(_WIN32)
-# define z_off64_t __int64
-# else
-# define z_off64_t z_off_t
-#endif
-#endif
-
-/* MVS linker does not support external names larger than 8 bytes */
-#if defined(__MVS__)
- #pragma map(deflateInit_,"DEIN")
- #pragma map(deflateInit2_,"DEIN2")
- #pragma map(deflateEnd,"DEEND")
- #pragma map(deflateBound,"DEBND")
- #pragma map(inflateInit_,"ININ")
- #pragma map(inflateInit2_,"ININ2")
- #pragma map(inflateEnd,"INEND")
- #pragma map(inflateSync,"INSY")
- #pragma map(inflateSetDictionary,"INSEDI")
- #pragma map(compressBound,"CMBND")
- #pragma map(inflate_table,"INTABL")
- #pragma map(inflate_fast,"INFA")
- #pragma map(inflate_copyright,"INCOPY")
-#endif
-
-#endif /* ZCONF_H */
diff --git a/sdk-modifications/libsrc/zlib/zlib.h b/sdk-modifications/libsrc/zlib/zlib.h
deleted file mode 100755
index 79142d1..0000000
--- a/sdk-modifications/libsrc/zlib/zlib.h
+++ /dev/null
@@ -1,1732 +0,0 @@
-/* zlib.h -- interface of the 'zlib' general purpose compression library
- version 1.2.6, January 29th, 2012
-
- Copyright (C) 1995-2012 Jean-loup Gailly and Mark Adler
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
- Jean-loup Gailly Mark Adler
- jloup@gzip.org madler@alumni.caltech.edu
-
-
- The data format used by the zlib library is described by RFCs (Request for
- Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950
- (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format).
-*/
-
-#ifndef ZLIB_H
-#define ZLIB_H
-
-#include "zconf.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define ZLIB_VERSION "1.2.6"
-#define ZLIB_VERNUM 0x1260
-#define ZLIB_VER_MAJOR 1
-#define ZLIB_VER_MINOR 2
-#define ZLIB_VER_REVISION 6
-#define ZLIB_VER_SUBREVISION 0
-
-/*
- The 'zlib' compression library provides in-memory compression and
- decompression functions, including integrity checks of the uncompressed data.
- This version of the library supports only one compression method (deflation)
- but other algorithms will be added later and will have the same stream
- interface.
-
- Compression can be done in a single step if the buffers are large enough,
- or can be done by repeated calls of the compression function. In the latter
- case, the application must provide more input and/or consume the output
- (providing more output space) before each call.
-
- The compressed data format used by default by the in-memory functions is
- the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped
- around a deflate stream, which is itself documented in RFC 1951.
-
- The library also supports reading and writing files in gzip (.gz) format
- with an interface similar to that of stdio using the functions that start
- with "gz". The gzip format is different from the zlib format. gzip is a
- gzip wrapper, documented in RFC 1952, wrapped around a deflate stream.
-
- This library can optionally read and write gzip streams in memory as well.
-
- The zlib format was designed to be compact and fast for use in memory
- and on communications channels. The gzip format was designed for single-
- file compression on file systems, has a larger header than zlib to maintain
- directory information, and uses a different, slower check method than zlib.
-
- The library does not install any signal handler. The decoder checks
- the consistency of the compressed data, so the library should never crash
- even in case of corrupted input.
-*/
-
-typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
-typedef void (*free_func) OF((voidpf opaque, voidpf address));
-
-struct internal_state;
-
-typedef struct z_stream_s {
- z_const Bytef *next_in; /* next input byte */
- uInt avail_in; /* number of bytes available at next_in */
- uLong total_in; /* total number of input bytes read so far */
-
- Bytef *next_out; /* next output byte should be put there */
- uInt avail_out; /* remaining free space at next_out */
- uLong total_out; /* total number of bytes output so far */
-
- z_const char *msg; /* last error message, NULL if no error */
- struct internal_state FAR *state; /* not visible by applications */
-
- alloc_func zalloc; /* used to allocate the internal state */
- free_func zfree; /* used to free the internal state */
- voidpf opaque; /* private data object passed to zalloc and zfree */
-
- int data_type; /* best guess about the data type: binary or text */
- uLong adler; /* adler32 value of the uncompressed data */
- uLong reserved; /* reserved for future use */
-} z_stream;
-
-typedef z_stream FAR *z_streamp;
-
-/*
- gzip header information passed to and from zlib routines. See RFC 1952
- for more details on the meanings of these fields.
-*/
-typedef struct gz_header_s {
- int text; /* true if compressed data believed to be text */
- uLong time; /* modification time */
- int xflags; /* extra flags (not used when writing a gzip file) */
- int os; /* operating system */
- Bytef *extra; /* pointer to extra field or Z_NULL if none */
- uInt extra_len; /* extra field length (valid if extra != Z_NULL) */
- uInt extra_max; /* space at extra (only when reading header) */
- Bytef *name; /* pointer to zero-terminated file name or Z_NULL */
- uInt name_max; /* space at name (only when reading header) */
- Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */
- uInt comm_max; /* space at comment (only when reading header) */
- int hcrc; /* true if there was or will be a header crc */
- int done; /* true when done reading gzip header (not used
- when writing a gzip file) */
-} gz_header;
-
-typedef gz_header FAR *gz_headerp;
-
-/*
- The application must update next_in and avail_in when avail_in has dropped
- to zero. It must update next_out and avail_out when avail_out has dropped
- to zero. The application must initialize zalloc, zfree and opaque before
- calling the init function. All other fields are set by the compression
- library and must not be updated by the application.
-
- The opaque value provided by the application will be passed as the first
- parameter for calls of zalloc and zfree. This can be useful for custom
- memory management. The compression library attaches no meaning to the
- opaque value.
-
- zalloc must return Z_NULL if there is not enough memory for the object.
- If zlib is used in a multi-threaded application, zalloc and zfree must be
- thread safe.
-
- On 16-bit systems, the functions zalloc and zfree must be able to allocate
- exactly 65536 bytes, but will not be required to allocate more than this if
- the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, pointers
- returned by zalloc for objects of exactly 65536 bytes *must* have their
- offset normalized to zero. The default allocation function provided by this
- library ensures this (see zutil.c). To reduce memory requirements and avoid
- any allocation of 64K objects, at the expense of compression ratio, compile
- the library with -DMAX_WBITS=14 (see zconf.h).
-
- The fields total_in and total_out can be used for statistics or progress
- reports. After compression, total_in holds the total size of the
- uncompressed data and may be saved for use in the decompressor (particularly
- if the decompressor wants to decompress everything in a single step).
-*/
-
- /* constants */
-
-#define Z_NO_FLUSH 0
-#define Z_PARTIAL_FLUSH 1
-#define Z_SYNC_FLUSH 2
-#define Z_FULL_FLUSH 3
-#define Z_FINISH 4
-#define Z_BLOCK 5
-#define Z_TREES 6
-/* Allowed flush values; see deflate() and inflate() below for details */
-
-#define Z_OK 0
-#define Z_STREAM_END 1
-#define Z_NEED_DICT 2
-#define Z_ERRNO (-1)
-#define Z_STREAM_ERROR (-2)
-#define Z_DATA_ERROR (-3)
-#define Z_MEM_ERROR (-4)
-#define Z_BUF_ERROR (-5)
-#define Z_VERSION_ERROR (-6)
-/* Return codes for the compression/decompression functions. Negative values
- * are errors, positive values are used for special but normal events.
- */
-
-#define Z_NO_COMPRESSION 0
-#define Z_BEST_SPEED 1
-#define Z_BEST_COMPRESSION 9
-#define Z_DEFAULT_COMPRESSION (-1)
-/* compression levels */
-
-#define Z_FILTERED 1
-#define Z_HUFFMAN_ONLY 2
-#define Z_RLE 3
-#define Z_FIXED 4
-#define Z_DEFAULT_STRATEGY 0
-/* compression strategy; see deflateInit2() below for details */
-
-#define Z_BINARY 0
-#define Z_TEXT 1
-#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */
-#define Z_UNKNOWN 2
-/* Possible values of the data_type field (though see inflate()) */
-
-#define Z_DEFLATED 8
-/* The deflate compression method (the only one supported in this version) */
-
-#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */
-
-#define zlib_version zlibVersion()
-/* for compatibility with versions < 1.0.2 */
-
-
- /* basic functions */
-
-ZEXTERN const char * ZEXPORT zlibVersion OF((void));
-/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
- If the first character differs, the library code actually used is not
- compatible with the zlib.h header file used by the application. This check
- is automatically made by deflateInit and inflateInit.
- */
-
-/*
-ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));
-
- Initializes the internal stream state for compression. The fields
- zalloc, zfree and opaque must be initialized before by the caller. If
- zalloc and zfree are set to Z_NULL, deflateInit updates them to use default
- allocation functions.
-
- The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
- 1 gives best speed, 9 gives best compression, 0 gives no compression at all
- (the input data is simply copied a block at a time). Z_DEFAULT_COMPRESSION
- requests a default compromise between speed and compression (currently
- equivalent to level 6).
-
- deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
- memory, Z_STREAM_ERROR if level is not a valid compression level, or
- Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
- with the version assumed by the caller (ZLIB_VERSION). msg is set to null
- if there is no error message. deflateInit does not perform any compression:
- this will be done by deflate().
-*/
-
-
-ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));
-/*
- deflate compresses as much data as possible, and stops when the input
- buffer becomes empty or the output buffer becomes full. It may introduce
- some output latency (reading input without producing any output) except when
- forced to flush.
-
- The detailed semantics are as follows. deflate performs one or both of the
- following actions:
-
- - Compress more input starting at next_in and update next_in and avail_in
- accordingly. If not all input can be processed (because there is not
- enough room in the output buffer), next_in and avail_in are updated and
- processing will resume at this point for the next call of deflate().
-
- - Provide more output starting at next_out and update next_out and avail_out
- accordingly. This action is forced if the parameter flush is non zero.
- Forcing flush frequently degrades the compression ratio, so this parameter
- should be set only when necessary (in interactive applications). Some
- output may be provided even if flush is not set.
-
- Before the call of deflate(), the application should ensure that at least
- one of the actions is possible, by providing more input and/or consuming more
- output, and updating avail_in or avail_out accordingly; avail_out should
- never be zero before the call. The application can consume the compressed
- output when it wants, for example when the output buffer is full (avail_out
- == 0), or after each call of deflate(). If deflate returns Z_OK and with
- zero avail_out, it must be called again after making room in the output
- buffer because there might be more output pending.
-
- Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to
- decide how much data to accumulate before producing output, in order to
- maximize compression.
-
- If the parameter flush is set to Z_SYNC_FLUSH, all pending output is
- flushed to the output buffer and the output is aligned on a byte boundary, so
- that the decompressor can get all input data available so far. (In
- particular avail_in is zero after the call if enough output space has been
- provided before the call.) Flushing may degrade compression for some
- compression algorithms and so it should be used only when necessary. This
- completes the current deflate block and follows it with an empty stored block
- that is three bits plus filler bits to the next byte, followed by four bytes
- (00 00 ff ff).
-
- If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the
- output buffer, but the output is not aligned to a byte boundary. All of the
- input data so far will be available to the decompressor, as for Z_SYNC_FLUSH.
- This completes the current deflate block and follows it with an empty fixed
- codes block that is 10 bits long. This assures that enough bytes are output
- in order for the decompressor to finish the block before the empty fixed code
- block.
-
- If flush is set to Z_BLOCK, a deflate block is completed and emitted, as
- for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to
- seven bits of the current block are held to be written as the next byte after
- the next deflate block is completed. In this case, the decompressor may not
- be provided enough bits at this point in order to complete decompression of
- the data provided so far to the compressor. It may need to wait for the next
- block to be emitted. This is for advanced applications that need to control
- the emission of deflate blocks.
-
- If flush is set to Z_FULL_FLUSH, all output is flushed as with
- Z_SYNC_FLUSH, and the compression state is reset so that decompression can
- restart from this point if previous compressed data has been damaged or if
- random access is desired. Using Z_FULL_FLUSH too often can seriously degrade
- compression.
-
- If deflate returns with avail_out == 0, this function must be called again
- with the same value of the flush parameter and more output space (updated
- avail_out), until the flush is complete (deflate returns with non-zero
- avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that
- avail_out is greater than six to avoid repeated flush markers due to
- avail_out == 0 on return.
-
- If the parameter flush is set to Z_FINISH, pending input is processed,
- pending output is flushed and deflate returns with Z_STREAM_END if there was
- enough output space; if deflate returns with Z_OK, this function must be
- called again with Z_FINISH and more output space (updated avail_out) but no
- more input data, until it returns with Z_STREAM_END or an error. After
- deflate has returned Z_STREAM_END, the only possible operations on the stream
- are deflateReset or deflateEnd.
-
- Z_FINISH can be used immediately after deflateInit if all the compression
- is to be done in a single step. In this case, avail_out must be at least the
- value returned by deflateBound (see below). Then deflate is guaranteed to
- return Z_STREAM_END. If not enough output space is provided, deflate will
- not return Z_STREAM_END, and it must be called again as described above.
-
- deflate() sets strm->adler to the adler32 checksum of all input read
- so far (that is, total_in bytes).
-
- deflate() may update strm->data_type if it can make a good guess about
- the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered
- binary. This field is only for information purposes and does not affect the
- compression algorithm in any manner.
-
- deflate() returns Z_OK if some progress has been made (more input
- processed or more output produced), Z_STREAM_END if all input has been
- consumed and all output has been produced (only when flush is set to
- Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
- if next_in or next_out was Z_NULL), Z_BUF_ERROR if no progress is possible
- (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not
- fatal, and deflate() can be called again with more input and more output
- space to continue compressing.
-*/
-
-
-ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));
-/*
- All dynamically allocated data structures for this stream are freed.
- This function discards any unprocessed input and does not flush any pending
- output.
-
- deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
- stream state was inconsistent, Z_DATA_ERROR if the stream was freed
- prematurely (some input or output was discarded). In the error case, msg
- may be set but then points to a static string (which must not be
- deallocated).
-*/
-
-
-/*
-ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));
-
- Initializes the internal stream state for decompression. The fields
- next_in, avail_in, zalloc, zfree and opaque must be initialized before by
- the caller. If next_in is not Z_NULL and avail_in is large enough (the
- exact value depends on the compression method), inflateInit determines the
- compression method from the zlib header and allocates all data structures
- accordingly; otherwise the allocation will be deferred to the first call of
- inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to
- use default allocation functions.
-
- inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough
- memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
- version assumed by the caller, or Z_STREAM_ERROR if the parameters are
- invalid, such as a null pointer to the structure. msg is set to null if
- there is no error message. inflateInit does not perform any decompression
- apart from possibly reading the zlib header if present: actual decompression
- will be done by inflate(). (So next_in and avail_in may be modified, but
- next_out and avail_out are unused and unchanged.) The current implementation
- of inflateInit() does not process any header information -- that is deferred
- until inflate() is called.
-*/
-
-
-ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));
-/*
- inflate decompresses as much data as possible, and stops when the input
- buffer becomes empty or the output buffer becomes full. It may introduce
- some output latency (reading input without producing any output) except when
- forced to flush.
-
- The detailed semantics are as follows. inflate performs one or both of the
- following actions:
-
- - Decompress more input starting at next_in and update next_in and avail_in
- accordingly. If not all input can be processed (because there is not
- enough room in the output buffer), next_in is updated and processing will
- resume at this point for the next call of inflate().
-
- - Provide more output starting at next_out and update next_out and avail_out
- accordingly. inflate() provides as much output as possible, until there is
- no more input data or no more space in the output buffer (see below about
- the flush parameter).
-
- Before the call of inflate(), the application should ensure that at least
- one of the actions is possible, by providing more input and/or consuming more
- output, and updating the next_* and avail_* values accordingly. The
- application can consume the uncompressed output when it wants, for example
- when the output buffer is full (avail_out == 0), or after each call of
- inflate(). If inflate returns Z_OK and with zero avail_out, it must be
- called again after making room in the output buffer because there might be
- more output pending.
-
- The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH,
- Z_BLOCK, or Z_TREES. Z_SYNC_FLUSH requests that inflate() flush as much
- output as possible to the output buffer. Z_BLOCK requests that inflate()
- stop if and when it gets to the next deflate block boundary. When decoding
- the zlib or gzip format, this will cause inflate() to return immediately
- after the header and before the first block. When doing a raw inflate,
- inflate() will go ahead and process the first block, and will return when it
- gets to the end of that block, or when it runs out of data.
-
- The Z_BLOCK option assists in appending to or combining deflate streams.
- Also to assist in this, on return inflate() will set strm->data_type to the
- number of unused bits in the last byte taken from strm->next_in, plus 64 if
- inflate() is currently decoding the last block in the deflate stream, plus
- 128 if inflate() returned immediately after decoding an end-of-block code or
- decoding the complete header up to just before the first byte of the deflate
- stream. The end-of-block will not be indicated until all of the uncompressed
- data from that block has been written to strm->next_out. The number of
- unused bits may in general be greater than seven, except when bit 7 of
- data_type is set, in which case the number of unused bits will be less than
- eight. data_type is set as noted here every time inflate() returns for all
- flush options, and so can be used to determine the amount of currently
- consumed input in bits.
-
- The Z_TREES option behaves as Z_BLOCK does, but it also returns when the
- end of each deflate block header is reached, before any actual data in that
- block is decoded. This allows the caller to determine the length of the
- deflate block header for later use in random access within a deflate block.
- 256 is added to the value of strm->data_type when inflate() returns
- immediately after reaching the end of the deflate block header.
-
- inflate() should normally be called until it returns Z_STREAM_END or an
- error. However if all decompression is to be performed in a single step (a
- single call of inflate), the parameter flush should be set to Z_FINISH. In
- this case all pending input is processed and all pending output is flushed;
- avail_out must be large enough to hold all the uncompressed data. (The size
- of the uncompressed data may have been saved by the compressor for this
- purpose.) The next operation on this stream must be inflateEnd to deallocate
- the decompression state. The use of Z_FINISH is not required to perform an
- inflation in one step. However it may be used to inform inflate that a
- faster approach can be used for the single inflate() call. Z_FINISH also
- informs inflate to not maintain a sliding window if the stream completes,
- which reduces inflate's memory footprint.
-
- In this implementation, inflate() always flushes as much output as
- possible to the output buffer, and always uses the faster approach on the
- first call. So the effects of the flush parameter in this implementation are
- on the return value of inflate() as noted below, when inflate() returns early
- when Z_BLOCK or Z_TREES is used, and when inflate() avoids the allocation of
- memory for a sliding window when Z_FINISH is used.
-
- If a preset dictionary is needed after this call (see inflateSetDictionary
- below), inflate sets strm->adler to the Adler-32 checksum of the dictionary
- chosen by the compressor and returns Z_NEED_DICT; otherwise it sets
- strm->adler to the Adler-32 checksum of all output produced so far (that is,
- total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described
- below. At the end of the stream, inflate() checks that its computed adler32
- checksum is equal to that saved by the compressor and returns Z_STREAM_END
- only if the checksum is correct.
-
- inflate() can decompress and check either zlib-wrapped or gzip-wrapped
- deflate data. The header type is detected automatically, if requested when
- initializing with inflateInit2(). Any information contained in the gzip
- header is not retained, so applications that need that information should
- instead use raw inflate, see inflateInit2() below, or inflateBack() and
- perform their own processing of the gzip header and trailer. When processing
- gzip-wrapped deflate data, strm->adler32 is set to the CRC-32 of the output
- producted so far. The CRC-32 is checked against the gzip trailer.
-
- inflate() returns Z_OK if some progress has been made (more input processed
- or more output produced), Z_STREAM_END if the end of the compressed data has
- been reached and all uncompressed output has been produced, Z_NEED_DICT if a
- preset dictionary is needed at this point, Z_DATA_ERROR if the input data was
- corrupted (input stream not conforming to the zlib format or incorrect check
- value), Z_STREAM_ERROR if the stream structure was inconsistent (for example
- next_in or next_out was Z_NULL), Z_MEM_ERROR if there was not enough memory,
- Z_BUF_ERROR if no progress is possible or if there was not enough room in the
- output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and
- inflate() can be called again with more input and more output space to
- continue decompressing. If Z_DATA_ERROR is returned, the application may
- then call inflateSync() to look for a good compression block if a partial
- recovery of the data is desired.
-*/
-
-
-ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));
-/*
- All dynamically allocated data structures for this stream are freed.
- This function discards any unprocessed input and does not flush any pending
- output.
-
- inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state
- was inconsistent. In the error case, msg may be set but then points to a
- static string (which must not be deallocated).
-*/
-
-
- /* Advanced functions */
-
-/*
- The following functions are needed only in some special applications.
-*/
-
-/*
-ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,
- int level,
- int method,
- int windowBits,
- int memLevel,
- int strategy));
-
- This is another version of deflateInit with more compression options. The
- fields next_in, zalloc, zfree and opaque must be initialized before by the
- caller.
-
- The method parameter is the compression method. It must be Z_DEFLATED in
- this version of the library.
-
- The windowBits parameter is the base two logarithm of the window size
- (the size of the history buffer). It should be in the range 8..15 for this
- version of the library. Larger values of this parameter result in better
- compression at the expense of memory usage. The default value is 15 if
- deflateInit is used instead.
-
- windowBits can also be -8..-15 for raw deflate. In this case, -windowBits
- determines the window size. deflate() will then generate raw deflate data
- with no zlib header or trailer, and will not compute an adler32 check value.
-
- windowBits can also be greater than 15 for optional gzip encoding. Add
- 16 to windowBits to write a simple gzip header and trailer around the
- compressed data instead of a zlib wrapper. The gzip header will have no
- file name, no extra data, no comment, no modification time (set to zero), no
- header crc, and the operating system will be set to 255 (unknown). If a
- gzip stream is being written, strm->adler is a crc32 instead of an adler32.
-
- The memLevel parameter specifies how much memory should be allocated
- for the internal compression state. memLevel=1 uses minimum memory but is
- slow and reduces compression ratio; memLevel=9 uses maximum memory for
- optimal speed. The default value is 8. See zconf.h for total memory usage
- as a function of windowBits and memLevel.
-
- The strategy parameter is used to tune the compression algorithm. Use the
- value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
- filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no
- string match), or Z_RLE to limit match distances to one (run-length
- encoding). Filtered data consists mostly of small values with a somewhat
- random distribution. In this case, the compression algorithm is tuned to
- compress them better. The effect of Z_FILTERED is to force more Huffman
- coding and less string matching; it is somewhat intermediate between
- Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as
- fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data. The
- strategy parameter only affects the compression ratio but not the
- correctness of the compressed output even if it is not set appropriately.
- Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler
- decoder for special applications.
-
- deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
- memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid
- method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is
- incompatible with the version assumed by the caller (ZLIB_VERSION). msg is
- set to null if there is no error message. deflateInit2 does not perform any
- compression: this will be done by deflate().
-*/
-
-ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,
- const Bytef *dictionary,
- uInt dictLength));
-/*
- Initializes the compression dictionary from the given byte sequence
- without producing any compressed output. When using the zlib format, this
- function must be called immediately after deflateInit, deflateInit2 or
- deflateReset, and before any call of deflate. When doing raw deflate, this
- function must be called either before any call of deflate, or immediately
- after the completion of a deflate block, i.e. after all input has been
- consumed and all output has been delivered when using any of the flush
- options Z_BLOCK, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, or Z_FULL_FLUSH. The
- compressor and decompressor must use exactly the same dictionary (see
- inflateSetDictionary).
-
- The dictionary should consist of strings (byte sequences) that are likely
- to be encountered later in the data to be compressed, with the most commonly
- used strings preferably put towards the end of the dictionary. Using a
- dictionary is most useful when the data to be compressed is short and can be
- predicted with good accuracy; the data can then be compressed better than
- with the default empty dictionary.
-
- Depending on the size of the compression data structures selected by
- deflateInit or deflateInit2, a part of the dictionary may in effect be
- discarded, for example if the dictionary is larger than the window size
- provided in deflateInit or deflateInit2. Thus the strings most likely to be
- useful should be put at the end of the dictionary, not at the front. In
- addition, the current implementation of deflate will use at most the window
- size minus 262 bytes of the provided dictionary.
-
- Upon return of this function, strm->adler is set to the adler32 value
- of the dictionary; the decompressor may later use this value to determine
- which dictionary has been used by the compressor. (The adler32 value
- applies to the whole dictionary even if only a subset of the dictionary is
- actually used by the compressor.) If a raw deflate was requested, then the
- adler32 value is not computed and strm->adler is not set.
-
- deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
- parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is
- inconsistent (for example if deflate has already been called for this stream
- or if not at a block boundary for raw deflate). deflateSetDictionary does
- not perform any compression: this will be done by deflate().
-*/
-
-ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,
- z_streamp source));
-/*
- Sets the destination stream as a complete copy of the source stream.
-
- This function can be useful when several compression strategies will be
- tried, for example when there are several ways of pre-processing the input
- data with a filter. The streams that will be discarded should then be freed
- by calling deflateEnd. Note that deflateCopy duplicates the internal
- compression state which can be quite large, so this strategy is slow and can
- consume lots of memory.
-
- deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
- enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
- (such as zalloc being Z_NULL). msg is left unchanged in both source and
- destination.
-*/
-
-ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
-/*
- This function is equivalent to deflateEnd followed by deflateInit,
- but does not free and reallocate all the internal compression state. The
- stream will keep the same compression level and any other attributes that
- may have been set by deflateInit2.
-
- deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent (such as zalloc or state being Z_NULL).
-*/
-
-ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
- int level,
- int strategy));
-/*
- Dynamically update the compression level and compression strategy. The
- interpretation of level and strategy is as in deflateInit2. This can be
- used to switch between compression and straight copy of the input data, or
- to switch to a different kind of input data requiring a different strategy.
- If the compression level is changed, the input available so far is
- compressed with the old level (and may be flushed); the new level will take
- effect only at the next call of deflate().
-
- Before the call of deflateParams, the stream state must be set as for
- a call of deflate(), since the currently available input may have to be
- compressed and flushed. In particular, strm->avail_out must be non-zero.
-
- deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
- stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR if
- strm->avail_out was zero.
-*/
-
-ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm,
- int good_length,
- int max_lazy,
- int nice_length,
- int max_chain));
-/*
- Fine tune deflate's internal compression parameters. This should only be
- used by someone who understands the algorithm used by zlib's deflate for
- searching for the best matching string, and even then only by the most
- fanatic optimizer trying to squeeze out the last compressed bit for their
- specific input data. Read the deflate.c source code for the meaning of the
- max_lazy, good_length, nice_length, and max_chain parameters.
-
- deflateTune() can be called after deflateInit() or deflateInit2(), and
- returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream.
- */
-
-ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,
- uLong sourceLen));
-/*
- deflateBound() returns an upper bound on the compressed size after
- deflation of sourceLen bytes. It must be called after deflateInit() or
- deflateInit2(), and after deflateSetHeader(), if used. This would be used
- to allocate an output buffer for deflation in a single pass, and so would be
- called before deflate(). If that first deflate() call is provided the
- sourceLen input bytes, an output buffer allocated to the size returned by
- deflateBound(), and the flush value Z_FINISH, then deflate() is guaranteed
- to return Z_STREAM_END. Note that it is possible for the compressed size to
- be larger than the value returned by deflateBound() if flush options other
- than Z_FINISH or Z_NO_FLUSH are used.
-*/
-
-ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm,
- unsigned *pending,
- int *bits));
-/*
- deflatePending() returns the number of bytes and bits of output that have
- been generated, but not yet provided in the available output. The bytes not
- provided would be due to the available output space having being consumed.
- The number of bits of output not provided are between 0 and 7, where they
- await more bits to join them in order to fill out a full byte. If pending
- or bits are Z_NULL, then those values are not set.
-
- deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent.
- */
-
-ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,
- int bits,
- int value));
-/*
- deflatePrime() inserts bits in the deflate output stream. The intent
- is that this function is used to start off the deflate output with the bits
- leftover from a previous deflate stream when appending to it. As such, this
- function can only be used for raw deflate, and must be used before the first
- deflate() call after a deflateInit2() or deflateReset(). bits must be less
- than or equal to 16, and that many of the least significant bits of value
- will be inserted in the output.
-
- deflatePrime returns Z_OK if success, Z_BUF_ERROR if there was not enough
- room in the internal buffer to insert the bits, or Z_STREAM_ERROR if the
- source stream state was inconsistent.
-*/
-
-ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm,
- gz_headerp head));
-/*
- deflateSetHeader() provides gzip header information for when a gzip
- stream is requested by deflateInit2(). deflateSetHeader() may be called
- after deflateInit2() or deflateReset() and before the first call of
- deflate(). The text, time, os, extra field, name, and comment information
- in the provided gz_header structure are written to the gzip header (xflag is
- ignored -- the extra flags are set according to the compression level). The
- caller must assure that, if not Z_NULL, name and comment are terminated with
- a zero byte, and that if extra is not Z_NULL, that extra_len bytes are
- available there. If hcrc is true, a gzip header crc is included. Note that
- the current versions of the command-line version of gzip (up through version
- 1.3.x) do not support header crc's, and will report that it is a "multi-part
- gzip file" and give up.
-
- If deflateSetHeader is not used, the default gzip header has text false,
- the time set to zero, and os set to 255, with no extra, name, or comment
- fields. The gzip header is returned to the default state by deflateReset().
-
- deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent.
-*/
-
-/*
-ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,
- int windowBits));
-
- This is another version of inflateInit with an extra parameter. The
- fields next_in, avail_in, zalloc, zfree and opaque must be initialized
- before by the caller.
-
- The windowBits parameter is the base two logarithm of the maximum window
- size (the size of the history buffer). It should be in the range 8..15 for
- this version of the library. The default value is 15 if inflateInit is used
- instead. windowBits must be greater than or equal to the windowBits value
- provided to deflateInit2() while compressing, or it must be equal to 15 if
- deflateInit2() was not used. If a compressed stream with a larger window
- size is given as input, inflate() will return with the error code
- Z_DATA_ERROR instead of trying to allocate a larger window.
-
- windowBits can also be zero to request that inflate use the window size in
- the zlib header of the compressed stream.
-
- windowBits can also be -8..-15 for raw inflate. In this case, -windowBits
- determines the window size. inflate() will then process raw deflate data,
- not looking for a zlib or gzip header, not generating a check value, and not
- looking for any check values for comparison at the end of the stream. This
- is for use with other formats that use the deflate compressed data format
- such as zip. Those formats provide their own check values. If a custom
- format is developed using the raw deflate format for compressed data, it is
- recommended that a check value such as an adler32 or a crc32 be applied to
- the uncompressed data as is done in the zlib, gzip, and zip formats. For
- most applications, the zlib format should be used as is. Note that comments
- above on the use in deflateInit2() applies to the magnitude of windowBits.
-
- windowBits can also be greater than 15 for optional gzip decoding. Add
- 32 to windowBits to enable zlib and gzip decoding with automatic header
- detection, or add 16 to decode only the gzip format (the zlib format will
- return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a
- crc32 instead of an adler32.
-
- inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
- memory, Z_VERSION_ERROR if the zlib library version is incompatible with the
- version assumed by the caller, or Z_STREAM_ERROR if the parameters are
- invalid, such as a null pointer to the structure. msg is set to null if
- there is no error message. inflateInit2 does not perform any decompression
- apart from possibly reading the zlib header if present: actual decompression
- will be done by inflate(). (So next_in and avail_in may be modified, but
- next_out and avail_out are unused and unchanged.) The current implementation
- of inflateInit2() does not process any header information -- that is
- deferred until inflate() is called.
-*/
-
-ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,
- const Bytef *dictionary,
- uInt dictLength));
-/*
- Initializes the decompression dictionary from the given uncompressed byte
- sequence. This function must be called immediately after a call of inflate,
- if that call returned Z_NEED_DICT. The dictionary chosen by the compressor
- can be determined from the adler32 value returned by that call of inflate.
- The compressor and decompressor must use exactly the same dictionary (see
- deflateSetDictionary). For raw inflate, this function can be called at any
- time to set the dictionary. If the provided dictionary is smaller than the
- window and there is already data in the window, then the provided dictionary
- will amend what's there. The application must insure that the dictionary
- that was used for compression is provided.
-
- inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
- parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is
- inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
- expected one (incorrect adler32 value). inflateSetDictionary does not
- perform any decompression: this will be done by subsequent calls of
- inflate().
-*/
-
-ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));
-/*
- Skips invalid compressed data until a possible full flush point (see above
- for the description of deflate with Z_FULL_FLUSH) can be found, or until all
- available input is skipped. No output is provided.
-
- inflateSync searches for a 00 00 FF FF pattern in the compressed data.
- All full flush points have this pattern, but not all occurences of this
- pattern are full flush points.
-
- inflateSync returns Z_OK if a possible full flush point has been found,
- Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point
- has been found, or Z_STREAM_ERROR if the stream structure was inconsistent.
- In the success case, the application may save the current current value of
- total_in which indicates where valid compressed data was found. In the
- error case, the application may repeatedly call inflateSync, providing more
- input each time, until success or end of the input data.
-*/
-
-ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,
- z_streamp source));
-/*
- Sets the destination stream as a complete copy of the source stream.
-
- This function can be useful when randomly accessing a large stream. The
- first pass through the stream can periodically record the inflate state,
- allowing restarting inflate at those points when randomly accessing the
- stream.
-
- inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
- enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
- (such as zalloc being Z_NULL). msg is left unchanged in both source and
- destination.
-*/
-
-ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));
-/*
- This function is equivalent to inflateEnd followed by inflateInit,
- but does not free and reallocate all the internal decompression state. The
- stream will keep attributes that may have been set by inflateInit2.
-
- inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent (such as zalloc or state being Z_NULL).
-*/
-
-ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm,
- int windowBits));
-/*
- This function is the same as inflateReset, but it also permits changing
- the wrap and window size requests. The windowBits parameter is interpreted
- the same as it is for inflateInit2.
-
- inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent (such as zalloc or state being Z_NULL), or if
- the windowBits parameter is invalid.
-*/
-
-ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm,
- int bits,
- int value));
-/*
- This function inserts bits in the inflate input stream. The intent is
- that this function is used to start inflating at a bit position in the
- middle of a byte. The provided bits will be used before any bytes are used
- from next_in. This function should only be used with raw inflate, and
- should be used before the first inflate() call after inflateInit2() or
- inflateReset(). bits must be less than or equal to 16, and that many of the
- least significant bits of value will be inserted in the input.
-
- If bits is negative, then the input stream bit buffer is emptied. Then
- inflatePrime() can be called again to put bits in the buffer. This is used
- to clear out bits leftover after feeding inflate a block description prior
- to feeding inflate codes.
-
- inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent.
-*/
-
-ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm));
-/*
- This function returns two values, one in the lower 16 bits of the return
- value, and the other in the remaining upper bits, obtained by shifting the
- return value down 16 bits. If the upper value is -1 and the lower value is
- zero, then inflate() is currently decoding information outside of a block.
- If the upper value is -1 and the lower value is non-zero, then inflate is in
- the middle of a stored block, with the lower value equaling the number of
- bytes from the input remaining to copy. If the upper value is not -1, then
- it is the number of bits back from the current bit position in the input of
- the code (literal or length/distance pair) currently being processed. In
- that case the lower value is the number of bytes already emitted for that
- code.
-
- A code is being processed if inflate is waiting for more input to complete
- decoding of the code, or if it has completed decoding but is waiting for
- more output space to write the literal or match data.
-
- inflateMark() is used to mark locations in the input data for random
- access, which may be at bit positions, and to note those cases where the
- output of a code may span boundaries of random access blocks. The current
- location in the input stream can be determined from avail_in and data_type
- as noted in the description for the Z_BLOCK flush parameter for inflate.
-
- inflateMark returns the value noted above or -1 << 16 if the provided
- source stream state was inconsistent.
-*/
-
-ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm,
- gz_headerp head));
-/*
- inflateGetHeader() requests that gzip header information be stored in the
- provided gz_header structure. inflateGetHeader() may be called after
- inflateInit2() or inflateReset(), and before the first call of inflate().
- As inflate() processes the gzip stream, head->done is zero until the header
- is completed, at which time head->done is set to one. If a zlib stream is
- being decoded, then head->done is set to -1 to indicate that there will be
- no gzip header information forthcoming. Note that Z_BLOCK or Z_TREES can be
- used to force inflate() to return immediately after header processing is
- complete and before any actual data is decompressed.
-
- The text, time, xflags, and os fields are filled in with the gzip header
- contents. hcrc is set to true if there is a header CRC. (The header CRC
- was valid if done is set to one.) If extra is not Z_NULL, then extra_max
- contains the maximum number of bytes to write to extra. Once done is true,
- extra_len contains the actual extra field length, and extra contains the
- extra field, or that field truncated if extra_max is less than extra_len.
- If name is not Z_NULL, then up to name_max characters are written there,
- terminated with a zero unless the length is greater than name_max. If
- comment is not Z_NULL, then up to comm_max characters are written there,
- terminated with a zero unless the length is greater than comm_max. When any
- of extra, name, or comment are not Z_NULL and the respective field is not
- present in the header, then that field is set to Z_NULL to signal its
- absence. This allows the use of deflateSetHeader() with the returned
- structure to duplicate the header. However if those fields are set to
- allocated memory, then the application will need to save those pointers
- elsewhere so that they can be eventually freed.
-
- If inflateGetHeader is not used, then the header information is simply
- discarded. The header is always checked for validity, including the header
- CRC if present. inflateReset() will reset the process to discard the header
- information. The application would need to call inflateGetHeader() again to
- retrieve the header from the next gzip stream.
-
- inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
- stream state was inconsistent.
-*/
-
-/*
-ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
- unsigned char FAR *window));
-
- Initialize the internal stream state for decompression using inflateBack()
- calls. The fields zalloc, zfree and opaque in strm must be initialized
- before the call. If zalloc and zfree are Z_NULL, then the default library-
- derived memory allocation routines are used. windowBits is the base two
- logarithm of the window size, in the range 8..15. window is a caller
- supplied buffer of that size. Except for special applications where it is
- assured that deflate was used with small window sizes, windowBits must be 15
- and a 32K byte window must be supplied to be able to decompress general
- deflate streams.
-
- See inflateBack() for the usage of these routines.
-
- inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of
- the parameters are invalid, Z_MEM_ERROR if the internal state could not be
- allocated, or Z_VERSION_ERROR if the version of the library does not match
- the version of the header file.
-*/
-
-typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *));
-typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));
-
-ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
- in_func in, void FAR *in_desc,
- out_func out, void FAR *out_desc));
-/*
- inflateBack() does a raw inflate with a single call using a call-back
- interface for input and output. This is more efficient than inflate() for
- file i/o applications in that it avoids copying between the output and the
- sliding window by simply making the window itself the output buffer. This
- function trusts the application to not change the output buffer passed by
- the output function, at least until inflateBack() returns.
-
- inflateBackInit() must be called first to allocate the internal state
- and to initialize the state with the user-provided window buffer.
- inflateBack() may then be used multiple times to inflate a complete, raw
- deflate stream with each call. inflateBackEnd() is then called to free the
- allocated state.
-
- A raw deflate stream is one with no zlib or gzip header or trailer.
- This routine would normally be used in a utility that reads zip or gzip
- files and writes out uncompressed files. The utility would decode the
- header and process the trailer on its own, hence this routine expects only
- the raw deflate stream to decompress. This is different from the normal
- behavior of inflate(), which expects either a zlib or gzip header and
- trailer around the deflate stream.
-
- inflateBack() uses two subroutines supplied by the caller that are then
- called by inflateBack() for input and output. inflateBack() calls those
- routines until it reads a complete deflate stream and writes out all of the
- uncompressed data, or until it encounters an error. The function's
- parameters and return types are defined above in the in_func and out_func
- typedefs. inflateBack() will call in(in_desc, &buf) which should return the
- number of bytes of provided input, and a pointer to that input in buf. If
- there is no input available, in() must return zero--buf is ignored in that
- case--and inflateBack() will return a buffer error. inflateBack() will call
- out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out()
- should return zero on success, or non-zero on failure. If out() returns
- non-zero, inflateBack() will return with an error. Neither in() nor out()
- are permitted to change the contents of the window provided to
- inflateBackInit(), which is also the buffer that out() uses to write from.
- The length written by out() will be at most the window size. Any non-zero
- amount of input may be provided by in().
-
- For convenience, inflateBack() can be provided input on the first call by
- setting strm->next_in and strm->avail_in. If that input is exhausted, then
- in() will be called. Therefore strm->next_in must be initialized before
- calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called
- immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in
- must also be initialized, and then if strm->avail_in is not zero, input will
- initially be taken from strm->next_in[0 .. strm->avail_in - 1].
-
- The in_desc and out_desc parameters of inflateBack() is passed as the
- first parameter of in() and out() respectively when they are called. These
- descriptors can be optionally used to pass any information that the caller-
- supplied in() and out() functions need to do their job.
-
- On return, inflateBack() will set strm->next_in and strm->avail_in to
- pass back any unused input that was provided by the last in() call. The
- return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR
- if in() or out() returned an error, Z_DATA_ERROR if there was a format error
- in the deflate stream (in which case strm->msg is set to indicate the nature
- of the error), or Z_STREAM_ERROR if the stream was not properly initialized.
- In the case of Z_BUF_ERROR, an input or output error can be distinguished
- using strm->next_in which will be Z_NULL only if in() returned an error. If
- strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning
- non-zero. (in() will always be called before out(), so strm->next_in is
- assured to be defined if out() returns non-zero.) Note that inflateBack()
- cannot return Z_OK.
-*/
-
-ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm));
-/*
- All memory allocated by inflateBackInit() is freed.
-
- inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream
- state was inconsistent.
-*/
-
-ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));
-/* Return flags indicating compile-time options.
-
- Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other:
- 1.0: size of uInt
- 3.2: size of uLong
- 5.4: size of voidpf (pointer)
- 7.6: size of z_off_t
-
- Compiler, assembler, and debug options:
- 8: DEBUG
- 9: ASMV or ASMINF -- use ASM code
- 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention
- 11: 0 (reserved)
-
- One-time table building (smaller code, but not thread-safe if true):
- 12: BUILDFIXED -- build static block decoding tables when needed
- 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed
- 14,15: 0 (reserved)
-
- Library content (indicates missing functionality):
- 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking
- deflate code when not needed)
- 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect
- and decode gzip streams (to avoid linking crc code)
- 18-19: 0 (reserved)
-
- Operation variations (changes in library functionality):
- 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate
- 21: FASTEST -- deflate algorithm with only one, lowest compression level
- 22,23: 0 (reserved)
-
- The sprintf variant used by gzprintf (zero is best):
- 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format
- 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure!
- 26: 0 = returns value, 1 = void -- 1 means inferred string length returned
-
- Remainder:
- 27-31: 0 (reserved)
- */
-
-#ifndef Z_SOLO
-
- /* utility functions */
-
-/*
- The following utility functions are implemented on top of the basic
- stream-oriented functions. To simplify the interface, some default options
- are assumed (compression level and memory usage, standard memory allocation
- functions). The source code of these utility functions can be modified if
- you need special options.
-*/
-
-ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen,
- const Bytef *source, uLong sourceLen));
-/*
- Compresses the source buffer into the destination buffer. sourceLen is
- the byte length of the source buffer. Upon entry, destLen is the total size
- of the destination buffer, which must be at least the value returned by
- compressBound(sourceLen). Upon exit, destLen is the actual size of the
- compressed buffer.
-
- compress returns Z_OK if success, Z_MEM_ERROR if there was not
- enough memory, Z_BUF_ERROR if there was not enough room in the output
- buffer.
-*/
-
-ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen,
- const Bytef *source, uLong sourceLen,
- int level));
-/*
- Compresses the source buffer into the destination buffer. The level
- parameter has the same meaning as in deflateInit. sourceLen is the byte
- length of the source buffer. Upon entry, destLen is the total size of the
- destination buffer, which must be at least the value returned by
- compressBound(sourceLen). Upon exit, destLen is the actual size of the
- compressed buffer.
-
- compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
- memory, Z_BUF_ERROR if there was not enough room in the output buffer,
- Z_STREAM_ERROR if the level parameter is invalid.
-*/
-
-ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen));
-/*
- compressBound() returns an upper bound on the compressed size after
- compress() or compress2() on sourceLen bytes. It would be used before a
- compress() or compress2() call to allocate the destination buffer.
-*/
-
-ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen,
- const Bytef *source, uLong sourceLen));
-/*
- Decompresses the source buffer into the destination buffer. sourceLen is
- the byte length of the source buffer. Upon entry, destLen is the total size
- of the destination buffer, which must be large enough to hold the entire
- uncompressed data. (The size of the uncompressed data must have been saved
- previously by the compressor and transmitted to the decompressor by some
- mechanism outside the scope of this compression library.) Upon exit, destLen
- is the actual size of the uncompressed buffer.
-
- uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
- enough memory, Z_BUF_ERROR if there was not enough room in the output
- buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. In
- the case where there is not enough room, uncompress() will fill the output
- buffer with the uncompressed data up to that point.
-*/
-
- /* gzip file access functions */
-
-/*
- This library supports reading and writing files in gzip (.gz) format with
- an interface similar to that of stdio, using the functions that start with
- "gz". The gzip format is different from the zlib format. gzip is a gzip
- wrapper, documented in RFC 1952, wrapped around a deflate stream.
-*/
-
-typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */
-
-/*
-ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
-
- Opens a gzip (.gz) file for reading or writing. The mode parameter is as
- in fopen ("rb" or "wb") but can also include a compression level ("wb9") or
- a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only
- compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F'
- for fixed code compression as in "wb9F". (See the description of
- deflateInit2 for more information about the strategy parameter.) 'T' will
- request transparent writing or appending with no compression and not using
- the gzip format.
-
- "a" can be used instead of "w" to request that the gzip stream that will
- be written be appended to the file. "+" will result in an error, since
- reading and writing to the same gzip file is not supported.
-
- These functions, as well as gzip, will read and decode a sequence of gzip
- streams in a file. The append function of gzopen() can be used to create
- such a file. (Also see gzflush() for another way to do this.) When
- appending, gzopen does not test whether the file begins with a gzip stream,
- nor does it look for the end of the gzip streams to begin appending. gzopen
- will simply append a gzip stream to the existing file.
-
- gzopen can be used to read a file which is not in gzip format; in this
- case gzread will directly read from the file without decompression. When
- reading, this will be detected automatically by looking for the magic two-
- byte gzip header.
-
- gzopen returns NULL if the file could not be opened, if there was
- insufficient memory to allocate the gzFile state, or if an invalid mode was
- specified (an 'r', 'w', or 'a' was not provided, or '+' was provided).
- errno can be checked to determine if the reason gzopen failed was that the
- file could not be opened.
-*/
-
-ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
-/*
- gzdopen associates a gzFile with the file descriptor fd. File descriptors
- are obtained from calls like open, dup, creat, pipe or fileno (if the file
- has been previously opened with fopen). The mode parameter is as in gzopen.
-
- The next call of gzclose on the returned gzFile will also close the file
- descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor
- fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd,
- mode);. The duplicated descriptor should be saved to avoid a leak, since
- gzdopen does not close fd if it fails. If you are using fileno() to get the
- file descriptor from a FILE *, then you will have to use dup() to avoid
- double-close()ing the file descriptor. Both gzclose() and fclose() will
- close the associated file descriptor, so they need to have different file
- descriptors.
-
- gzdopen returns NULL if there was insufficient memory to allocate the
- gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not
- provided, or '+' was provided), or if fd is -1. The file descriptor is not
- used until the next gz* read, write, seek, or close operation, so gzdopen
- will not detect if fd is invalid (unless fd is -1).
-*/
-
-ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size));
-/*
- Set the internal buffer size used by this library's functions. The
- default buffer size is 8192 bytes. This function must be called after
- gzopen() or gzdopen(), and before any other calls that read or write the
- file. The buffer memory allocation is always deferred to the first read or
- write. Two buffers are allocated, either both of the specified size when
- writing, or one of the specified size and the other twice that size when
- reading. A larger buffer size of, for example, 64K or 128K bytes will
- noticeably increase the speed of decompression (reading).
-
- The new buffer size also affects the maximum length for gzprintf().
-
- gzbuffer() returns 0 on success, or -1 on failure, such as being called
- too late.
-*/
-
-ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
-/*
- Dynamically update the compression level or strategy. See the description
- of deflateInit2 for the meaning of these parameters.
-
- gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not
- opened for writing.
-*/
-
-ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
-/*
- Reads the given number of uncompressed bytes from the compressed file. If
- the input file is not in gzip format, gzread copies the given number of
- bytes into the buffer directly from the file.
-
- After reaching the end of a gzip stream in the input, gzread will continue
- to read, looking for another gzip stream. Any number of gzip streams may be
- concatenated in the input file, and will all be decompressed by gzread().
- If something other than a gzip stream is encountered after a gzip stream,
- that remaining trailing garbage is ignored (and no error is returned).
-
- gzread can be used to read a gzip file that is being concurrently written.
- Upon reaching the end of the input, gzread will return with the available
- data. If the error code returned by gzerror is Z_OK or Z_BUF_ERROR, then
- gzclearerr can be used to clear the end of file indicator in order to permit
- gzread to be tried again. Z_OK indicates that a gzip stream was completed
- on the last gzread. Z_BUF_ERROR indicates that the input file ended in the
- middle of a gzip stream. Note that gzread does not return -1 in the event
- of an incomplete gzip stream. This error is deferred until gzclose(), which
- will return Z_BUF_ERROR if the last gzread ended in the middle of a gzip
- stream. Alternatively, gzerror can be used before gzclose to detect this
- case.
-
- gzread returns the number of uncompressed bytes actually read, less than
- len for end of file, or -1 for error.
-*/
-
-ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
- voidpc buf, unsigned len));
-/*
- Writes the given number of uncompressed bytes into the compressed file.
- gzwrite returns the number of uncompressed bytes written or 0 in case of
- error.
-*/
-
-ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...));
-/*
- Converts, formats, and writes the arguments to the compressed file under
- control of the format string, as in fprintf. gzprintf returns the number of
- uncompressed bytes actually written, or 0 in case of error. The number of
- uncompressed bytes written is limited to 8191, or one less than the buffer
- size given to gzbuffer(). The caller should assure that this limit is not
- exceeded. If it is exceeded, then gzprintf() will return an error (0) with
- nothing written. In this case, there may also be a buffer overflow with
- unpredictable consequences, which is possible only if zlib was compiled with
- the insecure functions sprintf() or vsprintf() because the secure snprintf()
- or vsnprintf() functions were not available. This can be determined using
- zlibCompileFlags().
-*/
-
-ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
-/*
- Writes the given null-terminated string to the compressed file, excluding
- the terminating null character.
-
- gzputs returns the number of characters written, or -1 in case of error.
-*/
-
-ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
-/*
- Reads bytes from the compressed file until len-1 characters are read, or a
- newline character is read and transferred to buf, or an end-of-file
- condition is encountered. If any characters are read or if len == 1, the
- string is terminated with a null character. If no characters are read due
- to an end-of-file or len < 1, then the buffer is left untouched.
-
- gzgets returns buf which is a null-terminated string, or it returns NULL
- for end-of-file or in case of error. If there was an error, the contents at
- buf are indeterminate.
-*/
-
-ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c));
-/*
- Writes c, converted to an unsigned char, into the compressed file. gzputc
- returns the value that was written, or -1 in case of error.
-*/
-
-ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
-/*
- Reads one byte from the compressed file. gzgetc returns this byte or -1
- in case of end of file or error. This is implemented as a macro for speed.
- As such, it does not do all of the checking the other functions do. I.e.
- it does not check to see if file is NULL, nor whether the structure file
- points to has been clobbered or not.
-*/
-
-ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file));
-/*
- Push one character back onto the stream to be read as the first character
- on the next read. At least one character of push-back is allowed.
- gzungetc() returns the character pushed, or -1 on failure. gzungetc() will
- fail if c is -1, and may fail if a character has been pushed but not read
- yet. If gzungetc is used immediately after gzopen or gzdopen, at least the
- output buffer size of pushed characters is allowed. (See gzbuffer above.)
- The pushed character will be discarded if the stream is repositioned with
- gzseek() or gzrewind().
-*/
-
-ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
-/*
- Flushes all pending output into the compressed file. The parameter flush
- is as in the deflate() function. The return value is the zlib error number
- (see function gzerror below). gzflush is only permitted when writing.
-
- If the flush parameter is Z_FINISH, the remaining data is written and the
- gzip stream is completed in the output. If gzwrite() is called again, a new
- gzip stream will be started in the output. gzread() is able to read such
- concatented gzip streams.
-
- gzflush should be called only when strictly necessary because it will
- degrade compression if called too often.
-*/
-
-/*
-ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
- z_off_t offset, int whence));
-
- Sets the starting position for the next gzread or gzwrite on the given
- compressed file. The offset represents a number of bytes in the
- uncompressed data stream. The whence parameter is defined as in lseek(2);
- the value SEEK_END is not supported.
-
- If the file is opened for reading, this function is emulated but can be
- extremely slow. If the file is opened for writing, only forward seeks are
- supported; gzseek then compresses a sequence of zeroes up to the new
- starting position.
-
- gzseek returns the resulting offset location as measured in bytes from
- the beginning of the uncompressed stream, or -1 in case of error, in
- particular if the file is opened for writing and the new starting position
- would be before the current position.
-*/
-
-ZEXTERN int ZEXPORT gzrewind OF((gzFile file));
-/*
- Rewinds the given file. This function is supported only for reading.
-
- gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
-*/
-
-/*
-ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file));
-
- Returns the starting position for the next gzread or gzwrite on the given
- compressed file. This position represents a number of bytes in the
- uncompressed data stream, and is zero when starting, even if appending or
- reading a gzip stream from the middle of a file using gzdopen().
-
- gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
-*/
-
-/*
-ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file));
-
- Returns the current offset in the file being read or written. This offset
- includes the count of bytes that precede the gzip stream, for example when
- appending or when using gzdopen() for reading. When reading, the offset
- does not include as yet unused buffered input. This information can be used
- for a progress indicator. On error, gzoffset() returns -1.
-*/
-
-ZEXTERN int ZEXPORT gzeof OF((gzFile file));
-/*
- Returns true (1) if the end-of-file indicator has been set while reading,
- false (0) otherwise. Note that the end-of-file indicator is set only if the
- read tried to go past the end of the input, but came up short. Therefore,
- just like feof(), gzeof() may return false even if there is no more data to
- read, in the event that the last read request was for the exact number of
- bytes remaining in the input file. This will happen if the input file size
- is an exact multiple of the buffer size.
-
- If gzeof() returns true, then the read functions will return no more data,
- unless the end-of-file indicator is reset by gzclearerr() and the input file
- has grown since the previous end of file was detected.
-*/
-
-ZEXTERN int ZEXPORT gzdirect OF((gzFile file));
-/*
- Returns true (1) if file is being copied directly while reading, or false
- (0) if file is a gzip stream being decompressed.
-
- If the input file is empty, gzdirect() will return true, since the input
- does not contain a gzip stream.
-
- If gzdirect() is used immediately after gzopen() or gzdopen() it will
- cause buffers to be allocated to allow reading the file to determine if it
- is a gzip file. Therefore if gzbuffer() is used, it should be called before
- gzdirect().
-
- When writing, gzdirect() returns true (1) if transparent writing was
- requested ("wT" for the gzopen() mode), or false (0) otherwise. (Note:
- gzdirect() is not needed when writing. Transparent writing must be
- explicitly requested, so the application already knows the answer. When
- linking statically, using gzdirect() will include all of the zlib code for
- gzip file reading and decompression, which may not be desired.)
-*/
-
-ZEXTERN int ZEXPORT gzclose OF((gzFile file));
-/*
- Flushes all pending output if necessary, closes the compressed file and
- deallocates the (de)compression state. Note that once file is closed, you
- cannot call gzerror with file, since its structures have been deallocated.
- gzclose must not be called more than once on the same file, just as free
- must not be called more than once on the same allocation.
-
- gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a
- file operation error, Z_MEM_ERROR if out of memory, Z_BUF_ERROR if the
- last read ended in the middle of a gzip stream, or Z_OK on success.
-*/
-
-ZEXTERN int ZEXPORT gzclose_r OF((gzFile file));
-ZEXTERN int ZEXPORT gzclose_w OF((gzFile file));
-/*
- Same as gzclose(), but gzclose_r() is only for use when reading, and
- gzclose_w() is only for use when writing or appending. The advantage to
- using these instead of gzclose() is that they avoid linking in zlib
- compression or decompression code that is not used when only reading or only
- writing respectively. If gzclose() is used, then both compression and
- decompression code will be included the application when linking to a static
- zlib library.
-*/
-
-ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
-/*
- Returns the error message for the last error which occurred on the given
- compressed file. errnum is set to zlib error number. If an error occurred
- in the file system and not in the compression library, errnum is set to
- Z_ERRNO and the application may consult errno to get the exact error code.
-
- The application must not modify the returned string. Future calls to
- this function may invalidate the previously returned string. If file is
- closed, then the string previously returned by gzerror will no longer be
- available.
-
- gzerror() should be used to distinguish errors from end-of-file for those
- functions above that do not distinguish those cases in their return values.
-*/
-
-ZEXTERN void ZEXPORT gzclearerr OF((gzFile file));
-/*
- Clears the error and end-of-file flags for file. This is analogous to the
- clearerr() function in stdio. This is useful for continuing to read a gzip
- file that is being written concurrently.
-*/
-
-#endif /* !Z_SOLO */
-
- /* checksum functions */
-
-/*
- These functions are not related to compression but are exported
- anyway because they might be useful in applications using the compression
- library.
-*/
-
-ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
-/*
- Update a running Adler-32 checksum with the bytes buf[0..len-1] and
- return the updated checksum. If buf is Z_NULL, this function returns the
- required initial value for the checksum.
-
- An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
- much faster.
-
- Usage example:
-
- uLong adler = adler32(0L, Z_NULL, 0);
-
- while (read_buffer(buffer, length) != EOF) {
- adler = adler32(adler, buffer, length);
- }
- if (adler != original_adler) error();
-*/
-
-/*
-ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
- z_off_t len2));
-
- Combine two Adler-32 checksums into one. For two sequences of bytes, seq1
- and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for
- each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of
- seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. Note
- that the z_off_t type (like off_t) is a signed integer. If len2 is
- negative, the result has no meaning or utility.
-*/
-
-ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len));
-/*
- Update a running CRC-32 with the bytes buf[0..len-1] and return the
- updated CRC-32. If buf is Z_NULL, this function returns the required
- initial value for the for the crc. Pre- and post-conditioning (one's
- complement) is performed within this function so it shouldn't be done by the
- application.
-
- Usage example:
-
- uLong crc = crc32(0L, Z_NULL, 0);
-
- while (read_buffer(buffer, length) != EOF) {
- crc = crc32(crc, buffer, length);
- }
- if (crc != original_crc) error();
-*/
-
-/*
-ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));
-
- Combine two CRC-32 check values into one. For two sequences of bytes,
- seq1 and seq2 with lengths len1 and len2, CRC-32 check values were
- calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32
- check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and
- len2.
-*/
-
-
- /* various hacks, don't look :) */
-
-/* deflateInit and inflateInit are macros to allow checking the zlib version
- * and the compiler's view of z_stream:
- */
-ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
- const char *version, int stream_size));
-ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
- const char *version, int stream_size));
-ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method,
- int windowBits, int memLevel,
- int strategy, const char *version,
- int stream_size));
-ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits,
- const char *version, int stream_size));
-ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
- unsigned char FAR *window,
- const char *version,
- int stream_size));
-#define deflateInit(strm, level) \
- deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream))
-#define inflateInit(strm) \
- inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream))
-#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
- deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
- (strategy), ZLIB_VERSION, (int)sizeof(z_stream))
-#define inflateInit2(strm, windowBits) \
- inflateInit2_((strm), (windowBits), ZLIB_VERSION, \
- (int)sizeof(z_stream))
-#define inflateBackInit(strm, windowBits, window) \
- inflateBackInit_((strm), (windowBits), (window), \
- ZLIB_VERSION, (int)sizeof(z_stream))
-
-#ifndef Z_SOLO
-
-/* gzgetc() macro and its supporting function and exposed data structure. Note
- * that the real internal state is much larger than the exposed structure.
- * This abbreviated structure exposes just enough for the gzgetc() macro. The
- * user should not mess with these exposed elements, since their names or
- * behavior could change in the future, perhaps even capriciously. They can
- * only be used by the gzgetc() macro. You have been warned.
- */
-struct gzFile_s {
- unsigned have;
- unsigned char *next;
- z_off64_t pos;
-};
-ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file));
-#define gzgetc(g) \
- ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc_(g))
-
-/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or
- * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if
- * both are true, the application gets the *64 functions, and the regular
- * functions are changed to 64 bits) -- in case these are set on systems
- * without large file support, _LFS64_LARGEFILE must also be true
- */
-#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
- ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
- ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
- ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
- ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
- ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t));
- ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t));
-#endif
-
-#if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS-0 == 64 && _LFS64_LARGEFILE-0
-# ifdef Z_PREFIX_SET
-# define z_gzopen z_gzopen64
-# define z_gzseek z_gzseek64
-# define z_gztell z_gztell64
-# define z_gzoffset z_gzoffset64
-# define z_adler32_combine z_adler32_combine64
-# define z_crc32_combine z_crc32_combine64
-# else
-# define gzopen gzopen64
-# define gzseek gzseek64
-# define gztell gztell64
-# define gzoffset gzoffset64
-# define adler32_combine adler32_combine64
-# define crc32_combine crc32_combine64
-# endif
-# ifndef _LARGEFILE64_SOURCE
- ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
- ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int));
- ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile));
- ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile));
- ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
- ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
-# endif
-#else
- ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *));
- ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int));
- ZEXTERN z_off_t ZEXPORT gztell OF((gzFile));
- ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile));
- ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));
- ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
-#endif
-
-#else /* Z_SOLO */
-
- ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));
- ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
-
-#endif /* !Z_SOLO */
-
-/* hack for buggy compilers */
-#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL)
- struct internal_state {int dummy;};
-#endif
-
-/* undocumented functions */
-ZEXTERN const char * ZEXPORT zError OF((int));
-ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp));
-ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void));
-ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int));
-ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp));
-ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp));
-#ifndef Z_SOLO
- ZEXTERN unsigned long ZEXPORT gzflags OF((void));
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* ZLIB_H */
diff --git a/sdk-modifications/libsrc/zlib/zlib.mk b/sdk-modifications/libsrc/zlib/zlib.mk
deleted file mode 100755
index 94ea103..0000000
--- a/sdk-modifications/libsrc/zlib/zlib.mk
+++ /dev/null
@@ -1,10 +0,0 @@
-# zlib.mk
-
-SRC += $(wildcard $(ZLIB_DIR)/*.c)
-
-SSRC +=
-
-INC += -I$(ZLIB_DIR)
-
-CFLAGS +=
-
diff --git a/sdk-modifications/libsrc/zlib/zutil.c b/sdk-modifications/libsrc/zlib/zutil.c
deleted file mode 100755
index 8a1d242..0000000
--- a/sdk-modifications/libsrc/zlib/zutil.c
+++ /dev/null
@@ -1,301 +0,0 @@
-/* zutil.c -- target dependent utility functions for the compression library
- * Copyright (C) 1995-2005, 2010, 2011 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* @(#) $Id$ */
-
-#include "zutil.h"
-
-#ifndef NO_DUMMY_DECL
-struct internal_state {int dummy;}; /* for buggy compilers */
-#endif
-
-const char * const z_errmsg[10] = {
-"need dictionary", /* Z_NEED_DICT 2 */
-"stream end", /* Z_STREAM_END 1 */
-"", /* Z_OK 0 */
-"file error", /* Z_ERRNO (-1) */
-"stream error", /* Z_STREAM_ERROR (-2) */
-"data error", /* Z_DATA_ERROR (-3) */
-"insufficient memory", /* Z_MEM_ERROR (-4) */
-"buffer error", /* Z_BUF_ERROR (-5) */
-"incompatible version",/* Z_VERSION_ERROR (-6) */
-""};
-
-
-const char * ZEXPORT zlibVersion()
-{
- return ZLIB_VERSION;
-}
-
-uLong ZEXPORT zlibCompileFlags()
-{
- uLong flags;
-
- flags = 0;
- switch ((int)(sizeof(uInt))) {
- case 2: break;
- case 4: flags += 1; break;
- case 8: flags += 2; break;
- default: flags += 3;
- }
- switch ((int)(sizeof(uLong))) {
- case 2: break;
- case 4: flags += 1 << 2; break;
- case 8: flags += 2 << 2; break;
- default: flags += 3 << 2;
- }
- switch ((int)(sizeof(voidpf))) {
- case 2: break;
- case 4: flags += 1 << 4; break;
- case 8: flags += 2 << 4; break;
- default: flags += 3 << 4;
- }
- switch ((int)(sizeof(z_off_t))) {
- case 2: break;
- case 4: flags += 1 << 6; break;
- case 8: flags += 2 << 6; break;
- default: flags += 3 << 6;
- }
-#ifdef DEBUG
- flags += 1 << 8;
-#endif
-#if defined(ASMV) || defined(ASMINF)
- flags += 1 << 9;
-#endif
-#ifdef ZLIB_WINAPI
- flags += 1 << 10;
-#endif
-#ifdef BUILDFIXED
- flags += 1 << 12;
-#endif
-#ifdef DYNAMIC_CRC_TABLE
- flags += 1 << 13;
-#endif
-#ifdef NO_GZCOMPRESS
- flags += 1L << 16;
-#endif
-#ifdef NO_GZIP
- flags += 1L << 17;
-#endif
-#ifdef PKZIP_BUG_WORKAROUND
- flags += 1L << 20;
-#endif
-#ifdef FASTEST
- flags += 1L << 21;
-#endif
-#ifdef Z_SOLO
- return flags;
-#else
- return flags + gzflags();
-#endif
-}
-
-#ifdef DEBUG
-
-# ifndef verbose
-# define verbose 0
-# endif
-int ZLIB_INTERNAL z_verbose = verbose;
-
-void ZLIB_INTERNAL z_error (m)
- char *m;
-{
- fprintf(stderr, "%s\n", m);
- exit(1);
-}
-#endif
-
-/* exported to allow conversion of error code to string for compress() and
- * uncompress()
- */
-const char * ZEXPORT zError(err)
- int err;
-{
- return ERR_MSG(err);
-}
-
-#if defined(_WIN32_WCE)
- /* The Microsoft C Run-Time Library for Windows CE doesn't have
- * errno. We define it as a global variable to simplify porting.
- * Its value is always 0 and should not be used.
- */
- int errno = 0;
-#endif
-
-#ifndef HAVE_MEMCPY
-
-void ZLIB_INTERNAL zmemcpy(dest, source, len)
- Bytef* dest;
- const Bytef* source;
- uInt len;
-{
- if (len == 0) return;
- do {
- *dest++ = *source++; /* ??? to be unrolled */
- } while (--len != 0);
-}
-
-int ZLIB_INTERNAL zmemcmp(s1, s2, len)
- const Bytef* s1;
- const Bytef* s2;
- uInt len;
-{
- uInt j;
-
- for (j = 0; j < len; j++) {
- if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1;
- }
- return 0;
-}
-
-void ZLIB_INTERNAL zmemzero(dest, len)
- Bytef* dest;
- uInt len;
-{
- if (len == 0) return;
- do {
- *dest++ = 0; /* ??? to be unrolled */
- } while (--len != 0);
-}
-#endif
-
-#ifndef Z_SOLO
-
-#ifdef SYS16BIT
-
-#ifdef __TURBOC__
-/* Turbo C in 16-bit mode */
-
-# define MY_ZCALLOC
-
-/* Turbo C malloc() does not allow dynamic allocation of 64K bytes
- * and farmalloc(64K) returns a pointer with an offset of 8, so we
- * must fix the pointer. Warning: the pointer must be put back to its
- * original form in order to free it, use zcfree().
- */
-
-#define MAX_PTR 10
-/* 10*64K = 640K */
-
-local int next_ptr = 0;
-
-typedef struct ptr_table_s {
- voidpf org_ptr;
- voidpf new_ptr;
-} ptr_table;
-
-local ptr_table table[MAX_PTR];
-/* This table is used to remember the original form of pointers
- * to large buffers (64K). Such pointers are normalized with a zero offset.
- * Since MSDOS is not a preemptive multitasking OS, this table is not
- * protected from concurrent access. This hack doesn't work anyway on
- * a protected system like OS/2. Use Microsoft C instead.
- */
-
-voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size)
-{
- voidpf buf = opaque; /* just to make some compilers happy */
- ulg bsize = (ulg)items*size;
-
- /* If we allocate less than 65520 bytes, we assume that farmalloc
- * will return a usable pointer which doesn't have to be normalized.
- */
- if (bsize < 65520L) {
- buf = farmalloc(bsize);
- if (*(ush*)&buf != 0) return buf;
- } else {
- buf = farmalloc(bsize + 16L);
- }
- if (buf == NULL || next_ptr >= MAX_PTR) return NULL;
- table[next_ptr].org_ptr = buf;
-
- /* Normalize the pointer to seg:0 */
- *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4;
- *(ush*)&buf = 0;
- table[next_ptr++].new_ptr = buf;
- return buf;
-}
-
-void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
-{
- int n;
- if (*(ush*)&ptr != 0) { /* object < 64K */
- farfree(ptr);
- return;
- }
- /* Find the original pointer */
- for (n = 0; n < next_ptr; n++) {
- if (ptr != table[n].new_ptr) continue;
-
- farfree(table[n].org_ptr);
- while (++n < next_ptr) {
- table[n-1] = table[n];
- }
- next_ptr--;
- return;
- }
- ptr = opaque; /* just to make some compilers happy */
- Assert(0, "zcfree: ptr not found");
-}
-
-#endif /* __TURBOC__ */
-
-
-#ifdef M_I86
-/* Microsoft C in 16-bit mode */
-
-# define MY_ZCALLOC
-
-#if (!defined(_MSC_VER) || (_MSC_VER <= 600))
-# define _halloc halloc
-# define _hfree hfree
-#endif
-
-voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, uInt items, uInt size)
-{
- if (opaque) opaque = 0; /* to make compiler happy */
- return _halloc((long)items, size);
-}
-
-void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
-{
- if (opaque) opaque = 0; /* to make compiler happy */
- _hfree(ptr);
-}
-
-#endif /* M_I86 */
-
-#endif /* SYS16BIT */
-
-
-#ifndef MY_ZCALLOC /* Any system without a special alloc function */
-
-#ifndef STDC
-extern voidp malloc OF((uInt size));
-extern voidp calloc OF((uInt items, uInt size));
-extern void free OF((voidpf ptr));
-#endif
-
-voidpf ZLIB_INTERNAL zcalloc (opaque, items, size)
- voidpf opaque;
- unsigned items;
- unsigned size;
-{
- if (opaque) items += size - size; /* make compiler happy */
- return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
- (voidpf)calloc(items, size);
-}
-
-void ZLIB_INTERNAL zcfree (opaque, ptr)
- voidpf opaque;
- voidpf ptr;
-{
- free(ptr);
- if (opaque) return; /* make compiler happy */
-}
-
-#endif /* MY_ZCALLOC */
-
-#endif /* !Z_SOLO */
diff --git a/sdk-modifications/libsrc/zlib/zutil.h b/sdk-modifications/libsrc/zlib/zutil.h
deleted file mode 100755
index d8575e0..0000000
--- a/sdk-modifications/libsrc/zlib/zutil.h
+++ /dev/null
@@ -1,254 +0,0 @@
-/* zutil.h -- internal interface and configuration of the compression library
- * Copyright (C) 1995-2011 Jean-loup Gailly.
- * For conditions of distribution and use, see copyright notice in zlib.h
- */
-
-/* WARNING: this file should *not* be used by applications. It is
- part of the implementation of the compression library and is
- subject to change. Applications should only use zlib.h.
- */
-
-/* @(#) $Id$ */
-
-#ifndef ZUTIL_H
-#define ZUTIL_H
-
-#if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ)
-# define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
-#else
-# define ZLIB_INTERNAL
-#endif
-
-#include "zlib.h"
-
-#include <ds2_malloc.h>
-#include <fs_api.h>
-#include <ds2_unistd.h>
-
-# include <stddef.h>
-
-#if defined(STDC) && !defined(Z_SOLO)
-# if !(defined(_WIN32_WCE) && defined(_MSC_VER))
-//# include <stddef.h>
-# endif
-//# include <string.h>
-//# include <stdlib.h>
-#endif
-
-#ifdef Z_SOLO
- typedef long ptrdiff_t; /* guess -- will be caught if guess is wrong */
-#endif
-
-#ifndef local
-# define local static
-#endif
-/* compile with -Dlocal if your debugger can't find static symbols */
-
-typedef unsigned char uch;
-typedef uch FAR uchf;
-typedef unsigned short ush;
-typedef ush FAR ushf;
-typedef unsigned long ulg;
-
-extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
-/* (size given to avoid silly warnings with Visual C++) */
-
-#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
-
-#define ERR_RETURN(strm,err) \
- return (strm->msg = (char*)ERR_MSG(err), (err))
-/* To be used only when the state is known to be valid */
-
- /* common constants */
-
-#ifndef DEF_WBITS
-# define DEF_WBITS MAX_WBITS
-#endif
-/* default windowBits for decompression. MAX_WBITS is for compression only */
-
-#if MAX_MEM_LEVEL >= 8
-# define DEF_MEM_LEVEL 8
-#else
-# define DEF_MEM_LEVEL MAX_MEM_LEVEL
-#endif
-/* default memLevel */
-
-#define STORED_BLOCK 0
-#define STATIC_TREES 1
-#define DYN_TREES 2
-/* The three kinds of block type */
-
-#define MIN_MATCH 3
-#define MAX_MATCH 258
-/* The minimum and maximum match lengths */
-
-#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
-
- /* target dependencies */
-
-#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32))
-# define OS_CODE 0x00
-# ifndef Z_SOLO
-# if defined(__TURBOC__) || defined(__BORLANDC__)
-# if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
- /* Allow compilation with ANSI keywords only enabled */
- void _Cdecl farfree( void *block );
- void *_Cdecl farmalloc( unsigned long nbytes );
-# else
-# include <alloc.h>
-# endif
-# else /* MSC or DJGPP */
-# include <malloc.h>
-# endif
-# endif
-#endif
-
-#ifdef AMIGA
-# define OS_CODE 0x01
-#endif
-
-#if defined(VAXC) || defined(VMS)
-# define OS_CODE 0x02
-# define F_OPEN(name, mode) \
- fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
-#endif
-
-#if defined(ATARI) || defined(atarist)
-# define OS_CODE 0x05
-#endif
-
-#ifdef OS2
-# define OS_CODE 0x06
-# if defined(M_I86) && !defined(Z_SOLO)
-# include <malloc.h>
-# endif
-#endif
-
-#if defined(MACOS) || defined(TARGET_OS_MAC)
-# define OS_CODE 0x07
-# ifndef Z_SOLO
-# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
-# include <unix.h> /* for fdopen */
-# else
-# ifndef fdopen
-# define fdopen(fd,mode) NULL /* No fdopen() */
-# endif
-# endif
-# endif
-#endif
-
-#ifdef TOPS20
-# define OS_CODE 0x0a
-#endif
-
-#ifdef WIN32
-# ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */
-# define OS_CODE 0x0b
-# endif
-#endif
-
-#ifdef __50SERIES /* Prime/PRIMOS */
-# define OS_CODE 0x0f
-#endif
-
-#if defined(_BEOS_) || defined(RISCOS)
-# define fdopen(fd,mode) NULL /* No fdopen() */
-#endif
-
-#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX
-# if defined(_WIN32_WCE)
-# define fdopen(fd,mode) NULL /* No fdopen() */
-# ifndef _PTRDIFF_T_DEFINED
- typedef int ptrdiff_t;
-# define _PTRDIFF_T_DEFINED
-# endif
-# else
-# define fdopen(fd,type) _fdopen(fd,type)
-# endif
-#endif
-
-#if defined(__BORLANDC__) && !defined(MSDOS)
- #pragma warn -8004
- #pragma warn -8008
- #pragma warn -8066
-#endif
-
-/* provide prototypes for these when building zlib without LFS */
-#if !defined(_WIN32) && (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
- ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
- ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
-#endif
-
- /* common defaults */
-
-#ifndef OS_CODE
-# define OS_CODE 0x03 /* assume Unix */
-#endif
-
-#ifndef F_OPEN
-# define F_OPEN(name, mode) fopen((name), (mode))
-#endif
-
- /* functions */
-
-#if defined(pyr) || defined(Z_SOLO)
-# define NO_MEMCPY
-#endif
-#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
- /* Use our own functions for small and medium model with MSC <= 5.0.
- * You may have to use the same strategy for Borland C (untested).
- * The __SC__ check is for Symantec.
- */
-# define NO_MEMCPY
-#endif
-#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
-# define HAVE_MEMCPY
-#endif
-#ifdef HAVE_MEMCPY
-# ifdef SMALL_MEDIUM /* MSDOS small or medium model */
-# define zmemcpy _fmemcpy
-# define zmemcmp _fmemcmp
-# define zmemzero(dest, len) _fmemset(dest, 0, len)
-# else
-# define zmemcpy memcpy
-# define zmemcmp memcmp
-# define zmemzero(dest, len) memset(dest, 0, len)
-# endif
-#else
- void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
- int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));
- void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len));
-#endif
-
-/* Diagnostic functions */
-#ifdef DEBUG
-# include <stdio.h>
- extern int ZLIB_INTERNAL z_verbose;
- extern void ZLIB_INTERNAL z_error OF((char *m));
-# define Assert(cond,msg) {if(!(cond)) z_error(msg);}
-# define Trace(x) {if (z_verbose>=0) fprintf x ;}
-# define Tracev(x) {if (z_verbose>0) fprintf x ;}
-# define Tracevv(x) {if (z_verbose>1) fprintf x ;}
-# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}
-# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}
-#else
-# define Assert(cond,msg)
-# define Trace(x)
-# define Tracev(x)
-# define Tracevv(x)
-# define Tracec(c,x)
-# define Tracecv(c,x)
-#endif
-
-#ifndef Z_SOLO
- voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items,
- unsigned size));
- void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr));
-#endif
-
-#define ZALLOC(strm, items, size) \
- (*((strm)->zalloc))((strm)->opaque, (items), (size))
-#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
-#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
-
-#endif /* ZUTIL_H */
diff --git a/source.txt b/source.txt
deleted file mode 100644
index 969df87..0000000
--- a/source.txt
+++ /dev/null
@@ -1 +0,0 @@
-The source for CATSFC is not bundled with the download to keep the download size as small as possible, since few users, if any, have any use for the source. If you are interested in viewing the source or making contributions to CATSFC, you can find the source on GITHUB at https://github.com/ShadauxCat/CATSFC. \ No newline at end of file
diff --git a/source/doc/porting.txt b/source/doc/porting.txt
deleted file mode 100644
index 3d28eec..0000000
--- a/source/doc/porting.txt
+++ /dev/null
@@ -1,725 +0,0 @@
- How to Port Snes9x to a New Platform
- ====================================
-
-Version: 1.01
-Date: 23-December-1998
-
-(c) Copyright 1998 Gary Henderson (gary@daniver.demon.co.uk)
-
-Introduction
-============
-
-This is brief description of the steps involved in porting Snes9x, the Super
-Nintendo Entertainment System emulator, to new hardware which is at least
-similar to Workstation or PC. It describes what code you have to write and
-what functions exist that you can make use of. It also gives some insights as
-to how Snes9x actually works, although that will be subject of another
-document yet to be written.
-
-Host System Requirements
-========================
-
-A C++ compiler, so you can compile the emulator! Snes9x really isn't written
-in C++, it just uses the C++ compiler as a 'better C' compiler to get inline
-functions and so on. With some modification, it could be converted to be
-compiled with an ordinary C compiler. Snes9x isn't very C type safe and
-will probably not work on a system who's integers are less than 32-bits wide
-without lots of editing.
-
-If the host system uses a CPU that implements the i386 instruction set then
-you will also want to use the three assembler CPU cores, although I recently
-scrapped the SPC700 assembler code (too many bugs) and replaced it with
-compiler generated assembler code that I haven't got around to optimising
-yet. The 65c816 and SPC700 code needs to be assembled using the GNU
-assembler that comes with gcc and the Super FX code assembled with NASM
-v0.97 or higher. gcc is available from lots of sites. NASM is available from
-http://www.cryogen.com/Nasm
-
-A fast CPU. SNES emulation is very compute intensive: two, or sometimes three
-CPUs to emulate, an 8-channel 16-bit stereo sound digital signal processor
-with real-time sample decompression, filter and echo effects, two custom
-graphics processor chips that can produce transparency, scaling, rotation
-and window effects in 32768 colors, and finally hardware DMA all take their
-toll on the host CPU.
-
-Lots of RAM. The SNES itself has 128k work RAM, 64k V-RAM and 64k sound CPU
-RAM. If a Super FX game is being emulated, that usually comes with another
-64k inside the game pack. Snes9x itself needs 4Mb to load SNES ROM images
-into (or 6Mb if I ever figure out the SNES memory map of the 48Mbit ROM
-images out there), 256k to cache decompressed sound samples in, 512k to
-cache converted SNES tiles in, and another 64k for S-RAM emulation. And
-that's not counting a few large lookup tables that the graphics code needs
-for speeding up transparency effects plus few other tables used by the ZSNES
-Super FX code. It all adds up to 7Mb (ish). Add to that RAM needed to
-store the actual emulator code and RAM required by the host operating system
-and any other process that is running; that's lots of RAM. Well, it is if
-your host system only has a few mega-bytes of RAM available.
-
-An 8-bit, 256 color (one byte per pixel) or deeper display, at least 256x239
-pixels in resolution, or 512x478 if you're going to support the SNES'
-hi-res. background screen modes. Ideally, a 16-bit, 65536 color screen mode
-is required if you want to support transparency at speed, as that is what the
-code renders internally. Any other format screen, with transparency enabled,
-will require picture format conversion before you can place the rendered
-SNES image on to the screen.
-
-Sound output requires spooling 8-bit or 16-bit, mono or stereo digital sound
-data to the host computer's sound hardware. The DOS port uses interrupts
-from the sound card to know when more sound data is required, most other
-ports have to periodically poll the host sound hardware to see if more data
-is required; if it is then the SNES sound mixing code provided by Snes9x is
-called to fill an area of system memory with ready mixed SNES sound data,
-which then can be passed on to the host sound hardware. Sound data is
-generated as an array of bytes (uint8) for 8-bit sound or shorts (int16) for
-16-bit data. Stereo sound data generates twice as many samples, with each
-channel's samples interleaved, first left's then right's.
-
-For the user to be able to control and play SNES games, some form of input
-device is required, a joystick or keyboard, for example. The real SNES can
-have 2 eight-button digital joy-pads connected to it or 5 joy-pads when an
-optional multi-player adaptor was purchased, although most games only require
-a single joy-pad. Access to all eight buttons and the direction pad, of
-course, are usually required by most games. Snes9x does emulate the
-multi-player adaptor hardware, if you were wondering, but its still up to
-you to provide the emulation of the individual joy-pads.
-
-The SNES also had a mouse and light gun available as optional extras,
-Snes9x can emulate both of these using some form of pointing device,
-usually the host system's mouse.
-
-If an accurate, constant SNES play rate is required, then a real-time timer
-will be needed that can time intervals of 16.7ms (NTSC frame time) or 20ms
-(PAL frame time).
-
-Some SNES game packs contained a small amount of extra RAM and a battery so
-ROMs could save a player's progress through a game for games that takes many
-hours to play from start to finish. Snes9x simulates this S-RAM by saving
-the contents of the area of memory normally occupied by the S-RAM into file
-then automatically restoring it again the next time the user plays the same
-game. If the hardware you're porting to doesn't have a hard disk available
-then you could be in trouble.
-
-Snes9x also implements freeze-game files which can record the state of the
-SNES hardware and RAM at a particular point in time and can restore it to
-that exact state at a later date - the result is that users can save a game
-at any point, not just at save-game or password points provided by the
-original game coders. Each freeze file is over 400k in size. To help save
-disk space, Snes9x can be compiled with zlib, which is used to compress the
-freeze files, reducing the size to typically below 100k. Download zlib from
-its homepage at http://www.cdrom.com/pub/infozip/zlib/, compile Snes9x with
-ZLIB defined and link with zlib. zlib is also used to load any compressed
-ROM images Snes9x my encounter, compressed with gzip or compress.
-
-Porting
-=======
-
-In theory you will only need to edit port.h, then in a separate file write
-all the initialisation code and interface routines that Snes9x expects the
-you to implement. You, no doubt, will discover otherwise....
-
-There are several compile-time only options available:
-
-DEBUGGER
---------
-
-Enables extra code to assist me in debugging SNES ROMs. The debugger has only
-ever been a quick-hack by me and user-interface to debugger facilities is
-virtually non-existent. Most of the debugger information is output via
-stdout and enabling the compile-time options slows the whole emulator down
-slightly. However, the debugger options available are very powerful; you
-could use it to help get your port working. You probably still want to ship
-the finished version with the debugger disabled, it will only confuse
-non-technical users.
-
-VAR_CYCLES
-----------
-
-I recommend you define this. The main CPU in the SNES actually varies in
-speed depending on what area of memory its accessing and the ROM access
-speed of the game pack; defining VAR_CYCLES causes Snes9x to emulate this,
-using a good approximation, rather than fixed cycle length as ZSNES does. The
-resultant code is slightly slower. Leaving it undefined results in many more
-emulation timing errors appearing while playing games.
-
-CPU_SHUTDOWN and SPC700_SHUTDOWN
---------------------------------
-
-Again I recommend defining both of these. They are both speed up hacks.
-When defined, Snes9x starts watching for when either the main or sound CPUs
-are in simply loops waiting for a known event to happen - like the end of
-the current scan-line, and interrupt or a sound timer to reach a particular
-value. If Snes9x spots either CPU in such a loop it uses its insider
-knowledge to simply skip the emulation of that CPU's instructions until the
-event happens. It can be a big win with lots of SNES games.
-
-I'm constantly amazed at the ingenuity of some programmers who are able to
-produce complex code to do simple things: some ROM's wait loops are so
-complex Snes9x fails to spot the CPU is in such a loop and the shutdown
-speed up hacks don't work.
-
-You might be wondering why VAR_CYCLES, and the two SHUTDOWN options have to
-be enabled with defines, well, in the past they sometimes introduced
-problems with some ROMs, so I kept them as options. I think I've fixed all
-the problems now, but you never know...
-
-SPC700_C
---------
-
-Define this if you are using the C/C++ version of the SPC700 CPU core. It
-enables a ROM compatibility feature that executes SPC700 instructions during
-SNES DMA, it allows several games to start that would otherwise lock up and
-fixes music pauses when ROMs do lots of DMA, usually when switching between
-game screens.
-
-ZLIB
-----
-
-Define this if you have the zlib library available and you want it to
-compress freeze-game files to save disk space. The library is also used to
-support compressed ROM images.
-
-NO_INLINE_SET_GET
------------------
-
-Define this to stop several of the memory access routines from being
-defined in-line. Whether the C++ compiler actually in-lines when this symbol
-is not defined is up to the compiler itself. In-lines functions can speed up
-the C++ CPU emulations on some architectures at the cost of increased code
-size. Try fiddling with this option once you've got port working to see if
-it helps the speed of your port.
-
-EXECUTE_SUPERFX_PER_LINE and ZSNES_FX
--------------------------------------
-
-Define these if you're going to be using the ZSNES Super FX i386 assembler
-code, otherwise leave them both undefined. In theory,
-EXECUTE_SUPERFX_PER_LINE can also be defined when using the C++ Super FX
-emulation code, but the code is still buggy and enabling the option
-introduces more problems than it fixes. Any takers for fixing the C++ code?
-
-JOYSTICK_SUPPORT, SIDEWINDER_SUPPORT and GRIP_SUPPORT
------------------------------------------------------
-
-These options enable support for various input devices in the UNIX and MS-DOS
-port code. They're only of interest if you're able to use the existing UNIX
-or MS-DOS port specific code.
-
-port.h
-======
-
-If the byte ordering of the target system is least significant byte first,
-make sure LSB_FIRST is defined in this header, otherwise, make sure its not
-defined.
-
-If you're going to support 16-bit screen rendering (required if you want
-transparency effects) and your system doesn't use RGB 565 - 5 bits for red,
-6 bits for green and 5 bits for blue - then you'll need make sure RGB555,
-BGR565 or BGR555 is defined instead. You might want to take a look at the
-*_LOW_BIT_MASKs, *_HI_BIT_MASKs and BUILD_PIXEL macros to make sure they're
-correct, because I've only every tested the RGB565 version, though the Mac
-port uses the RGB555 option. If your system is 24 or 32-bit only, then
-don't define anything; instead write a conversion routine that will take a
-complete rendered 16-bit SNES screen in RGB565 format and convert to the
-format required to be displayed on your hardware.
-
-port.h also typedefs some types, uint8 for an unsigned, 8-bit quantity,
-uint16 for an unsigned, 16-bit quantity, uint32 for a 32-bit, unsigned
-quantity and bool8 for a true/false type. Signed versions are also
-typedef'ed.
-
-The CHECK_SOUND macro can be defined to invoke some code that polls the
-host system's sound hardware to see if it can accept any more sound data.
-Snes9x makes calls to this macro several times when it is rendering the SNES
-screen, during large SNES DMAs and after every emulated CPU instruction.
-
-Since this CHECK_SOUND macro is invoked often, the code should only take a
-very small amount of time to execute or it will slow down the emulator's
-performance. The Linux and UNIX ports use a system timer and set a variable
-when it has expired; the CHECK_SOUND only has to check to see if the
-variable is set. On the MS-DOS and Mac ports, the sound hardware is not
-polled at all, instead it is driven by interrupts or callbacks and the
-CHECK_SOUND macro is defined to be empty.
-
-Initialisation Code
--------------------
-
-This is what the Linux, UNIX and MS-DOS ports do, I suspect your code
-might be similar:
-
-- The Settings structure is initialised to some sensible default values -
- check the main function in unix.cpp for the values it uses.
-
-- The command line is parsed, options specified override default values in
- the Settings structure and specify a ROM image filename that the user
- wants loaded. Your port could load user preferences from a file or some
- other source at this point. Most values, with a little care, can be changed
- via a GUI once the emulator is running.
-
-- Some Settings structure value validation takes place, for example if
- transparency effects are requested the code also makes sure 16-bit
- screen rendering is turned on as well.
-
-- Memory.Init() and S9xInitAPU() are called, checking neither failed. The
- only reason they would fail is if memory allocation failed.
-
-- Memory.LoadROM (filename) is called to load the specified ROM image into
- memory. If that worked Memory.LoadSRAM (sram_filename) is called to load
- the ROM's S-RAM file, if one exists. The all current ports base the
- sram_filename on the filename of the ROM image, changing the file's
- extension (the .smc or whatever bit) and changing the directory where its
- located - you won't be able to save S-RAM files onto a CD if that's where
- the ROM image is located!
-
- If your port has a GUI, you can delay this step until the user picks an
- image to load.
-
- SNES roms images come in all shapes and sizes, some with headers, some
- without, some have been mangled by the copier device in one of two ways, and
- some split into several pieces; plus the SNES itself has several different
- memory map models. The code tries to auto-detect all these various types,
- but sometimes the SNES ROM header information has been manually edited by
- someone at some stage and the code guesses wrong. To help it out it these
- situations, the Settings structure contains several options to force a
- particular ROM image format; these values must be initialised prior to each
- call to Memory.LoadROM(filename).
-
-- The Linux and UNIX ports now do some more operating system initialisation
- ready for a system timer to be started.
-
-- The host display hardware is now initialised. The actual screen depth and
- resolution should be picked based on the user preferences if possible.
- The X Window System port can't control the screen depth or resolution, if
- the user requests transparency effects but the display hardware is only
- set to 8-bit, it has to invoke an extra step of converting the 16-bit SNES
- rendered screen to a fixed palette 8-bit display just before the SNES
- screen is copied to the display hardware.
-
- The GFX.Screen pointer needs to be initialised to point to an array of
- uint8 for 8-bit screen rendering or uint16 for 16-bit rendering, cast to
- an array of uint8. The array needs to be at least 256x239 bytes or shorts
- in size for lo-res only support (Settings.SupportHiRes = FALSE) or
- 512x478 for lo-res and hi-res support. If transparency effects are
- required, the GFX.SubScreen array also needs to be initialised to another
- identically sized array of the same type, otherwise it can be just
- initialised to NULL.
-
- The GFX.Pitch variable needs to be set to the number of bytes on each line
- of the arrays, e.g. 256 for lo-res only support, up to 1024 for 16-bit
- hi-res support. If GFX.Screen is pointing into an existing array, one
- created by the library function rather than just calling malloc or new,
- then set GFX.Pitch to the number of bytes per line of that array,
- including any padding the library function may have added.
-
- If the target hardware supports fast access to video RAM, the screen is in
- 16-bit format supported by the SNES rendering code and you can double
- buffer the display, you might want to point GFX.Screen directly at the
- video buffer RAM. You will need to recompute the GFX.Delta value every
- time you change the GFX.Screen value to double-buffer the rendering and
- display.
-
-- A call to S9xGraphicsInit() is made; make sure all your graphics rendering
- options are setup correctly by now. If later, you want to change some
- settings, for example 16-bit to 8-bit rendering, call S9xGraphicsDeinit()
- first, change your settings, GFX.Screen and GFX.SubScreen arrays, etc.,
- then call S9xGraphicsInit() again.
-
-- S9xInitSound(int playbackrate, bool8 stereo, int sound_buffer_size)
- is now called, which in turn will call your S9xOpenSoundDevice function -
- see below.
-
-- The display is switched to graphics mode using a call to S9xGraphicsMode().
-
-- The system timer is started; its used for keeping the emulator speed
- relatively constant on the MS-DOS port and noting when the sound hardware
- sound should be able to accept more sound data on the Linux and UNIX ports.
-
-- A main loop is entered which is just a loop constantly calling
- S9xMainLoop() then polling the operating system for any pending events
- such as key presses and releases, joystick updates, mouse position
- updates, GUI user interaction, etc.
-
- Pause functionality can be implemented by skipping the call to S9xMainLoop
- and muting the sound output by calling S9xSetSoundMute (TRUE).
-
- Don't enter the main loop until a SNES ROM image has been loaded, or at
- least skip calling S9xMainLoop inside the loop until one is and make sure
- S9xReset is called instead before entering the main loop. The Mac port
- implements this technique by starting in pause mode and refusing to unpause
- until a ROM image is loaded.
-
- S9xMainLoop processes SNES CPU emulation, SNES screen rendering, DMA and
- H-DMA emulation, until emulated scan-line 0 is reached, then it returns.
- Now is your chance to process any system events pending, scan the
- keyboard, read joystick values, etc.
-
- If DEBUGGER compile-time support is enabled and the CPU emulation has hit
- a break point or single-stepping is switched on, or the DEBUG_MODE_FLAG is
- set in the CPU.Flags variable, then the S9xMainLoop routine returns early,
- allowing you to act on the event in some way. The Linux, DOS and UNIX ports
- respond to the DEBUG_MODE_FLAG being set by calling S9xDoDebug(), which in
- turn outputs the current instruction and loops reading commands from stdin
- and outputting debug information, currently via stdout. The debugger
- desperately needs rewriting to support a GUI interface, more descriptive
- commands and better error handling; maybe one day...
-
-Existing Interface Routines
----------------------------
-
-These are routines already written that you will either need to call or
-might find useful.
-
--> bool8 Memory.Init ()
-
-Allocates and initialises several major lumps of memory, for example
-the SNES ROM and RAM arrays, tile cache arrays, etc. Returns FALSE if
-memory allocation fails.
-
--> void Memory.Deinit ()
-
-Undoes the memory allocations made by Memory.Init.
-
--> bool8 S9xGraphicsInit ()
-
-Allocated and initialises several lookup tables used to speed up SNES
-graphics rendering. Call after you have initialised the GFX.Screen,
-GFX.SubScreen and GFX.Pitch values. If Settings.Transparency is false it
-does not allocate tables used to speed up transparency effects. If you
-want to provide the user with option to turn the effects on and off during
-game play, make sure Settings.Transparency is true when this function is
-called, it can later be set to FALSE.
-
-Returns FALSE if memory allocation fails.
-
--> void S9xGraphicsDeinit ()
-
-Undoes the memory allocations made by S9xGraphicsInit.
-
--> bool8 S9xInitAPU ()
-
-Allocates and initialises several arrays used by the sound CPU and sound
-generation code.
-
--> void S9xDeinitAPU ()
-
-Undoes the allocations made by S9xInitAPU.
-
--> bool8 S9xInitSound (int mode, bool8 stereo, int buffer_size)
-
-Does more sound code initialisation and opens the host system's sound hardware
-by calling the S9xOpenSoundDevice function provided by you.
-
--> void S9xReset ()
-
-Resets the SNES emulated hardware back to the state it was in at 'switch-on'
-except the S-RAM area is presevered. The effect is it resets the current game
-back to the start. This function is automatically called by Memory.LoROM.
-
--> bool8 Memory.LoadROM (const char *filename)
-
-Attempts to load the specified ROM image filename into the emulated ROM area.
-There are many different SNES ROM image formats and the code attempts to
-auto-detect as many different types as it can and in a vast majority of the
-cases gets it right. However, some ROM images have been edited by someone at
-some stage or have been mangled by the ROM copier that produced them and
-LoadROM needs help. Inparticular, it can't auto-detect the odd way in which
-some Super FX games have been mangled and needs to be told, via
-Settings.Interleaved2, that the ROM image is in that format, or that
-odd-sized ROM images have a 512 byte copier header.
-
-There are several other ROM image options in the Settings structure;
-allow the user to set them before calling LoadROM, or make sure they all
-reset to default values before each call to LoadROM.
-
--> bool8 Memory.LoadSRAM (const char *filename)
-
-Call this routine to load the associated S-RAM save file (if any). The
-filename should be based on the ROM image name to allow easy linkage.
-The current ports change the directory and the filename extension of the ROM
-filename to derive the S-RAM filename.
-
--> bool8 Memory.SaveSRAM (const char *filename)
-
-Call this routine to save the emulated S-RAM area into a file so it can
-be restored again the next time the user wants to play the game. Remember
-to call this when just before the emulator exits or when the user has been
-playing a game and is about to load another one.
-
--> void S9xMainLoop()
-
-The emulator main loop. Call this from your own main loop that calls this
-function (if a ROM image is loaded and the game is not paused), processes
-any pending host system events, then goes back around the loop again until
-the emulator exits.
-
-S9xMainLoop normally returns control to your main loop once every emulated
-frame, when it reaches the start of scan-line zero. However, the routine
-can return more often if the DEBUGGER compile-time flag is defined and the
-CPU has hit a break point, or the DEBUG_MODE_FLAG bit is set in CPU.Flags
-or instruction single-stepping is enabled.
-
--> void S9xMixSamples (uint8 *buffer, int sample_count)
-
-Call this routine from your host sound hardware handling code to fill the
-specified buffer with ready mixed SNES sound data. If 16-bit sound mode is
-choosen, then the buffer will be filled with an array of sample_count int16,
-otherwise an array of sample_count uint8. If stereo sound generation is
-selected the buffer is filled with the same number of samples, but in pairs,
-first a left channel sample followed by the right channel sample.
-
-There is a limit on how much data S9xMixSamples can deal with in one go and
-hence a limit on the sample_count value; the limit is the value of the
-MAX_BUFFER_SIZE symbol, normally 4096 bytes.
-
--> bool8 S9xSetSoundMute (bool8 mute)
-
-Call with a TRUE parmeter to prevent S9xMixSamples from processing SNES
-sample data and instead just filling the return buffer with silent sound
-data. Useful if your sound system is interrupt or callback driven and the
-game has been paused either directly or indirectly because the user
-interacting with the emulator's user interface in some way.
-
--> bool8 S9xFreezeGame (const char *filename)
-
-Call this routine to record the current SNES hardware state into a file,
-the file can be loaded back using S9xUnfreezeGame at a later date effectively
-restoring the current game to exact same spot. Call this routine while
-you're processing any pending system events when S9xMainLoop has returned
-control to you in your main loop.
-
--> bool8 S9xUnfreezeGame (const char *filename)
-
-Restore the SNES hardware back to the exactly the state it was in when
-S9xFreezeGame was used to generate the file specified. You have to arrange
-the correct ROM is already loaded using Memory.LoadROM, an easy way to
-arrange this is to base freeze-game filenames on the ROM image name. The
-Linux, UNIX and DOS ports load freeze-game files when the user presses a
-function key, with the names romfilename.000 for F1, romfilename.001 for F2,
-etc. Games are frozen in the first place when the user presses Shift-function
-key. You could choose some other scheme.
-
--> void S9xNextController ()
-
-The real SNES allows several different types of devices to be plugged into
-the game controller ports. The devices Snes9x emulates are a joy-pad,
-multi-player adaptor (allowing a further 4 joy-pads to be plugged in),
-a 2-button mouse and a light gun known as the SuperScope.
-
-Each call to S9xNextController will step the current emulated device on to
-the next device in the sequence multi-player, joy-pad, mouse on port 1,
-mouse on port 2, light gun then back to multi-player again. Defines
-allocating a number of each device type are in snes9x.h. The currently
-selected device is stored in IPPU.Controller if you want to give some
-feedback to the user. The initial value of IPPU.Controller (set when
-S9xReset is called) is obtained from Settings.ControllerOption based on
-currently enabled options.
-
-Some ROMs object to certain non-joy-pad devices being plugged into the real
-SNES while they are running, all Super FX games should only allow joy-pads to
-be plugged in because the Super FX chip and any other device would overload
-the SNES power supply. Tetris and Dr. Mario also objects for reasons best
-known to itself. For this reason there are switches in the Settings
-structure to enable and display the emulation of the various devices.
-
-const char *S9xGameGenieToRaw (const char *code, uint32 &address, uint8 &byte)
-
-const char *S9xProActionReplayToRaw (const char *code, uint32 &address,
- uint8 &byte)
-
-const char *S9xGoldFingerToRaw (const char *code, uint32 &address, bool8 &sram,
- uint8 &num_bytes, uint8 bytes[3])
-
-void S9xApplyCheats (bool8 apply)
-
-void S9xRemoveCheats ()
-
-void S9xAddCheat (uint32 address, bool8 cpu_address, bool8 sram, uint8 num_bytes,
- uint8 byte1, uint8 byte2, uint8 byte3)
-
-void S9xDeleteCheats ()
-
-void S9xDoDebug ()
-
-Interface Routines You Need to Implement
-----------------------------------------
-
-bool8 S9xOpenSnapshotFile (const char *base, bool8 read_only, STREAM *file)
-***************************************************************************
-void S9xCloseSnapshotFile (STREAM file)
-***************************************
-
-Routines to open and close freeze-game files. STREAM is defined as a
-gzFile if ZLIB is defined else its defined as FILE *. The read_only parameter
-is set to TRUE when reading a freeze-game file and FALSE when writing a
-freeze-game file.
-
-void S9xExit ()
-***************
-
-Called when some fatal error situation arises or when the 'q' debugger
-command is used. The Mac port just beeps and drops back to the GUI when
-S9xExit is called, the MS-DOS, Linux and Solaris ports all call exit () to
-terminate the emulator process.
-
-void S9xParseArg (char **argv, int &index, int argc)
-****************************************************
-
-void S9xExtraUsage ()
-*********************
-
-If you're going to be using the simple command line parser, when it
-encounters an unknown option it calls S9xUsage which is supposed to report
-all options the generic parse knows about (I haven't been keeping it up to
-date of late). S9xUsage then, in turn calls S9xExtraUsage which you
-implement to report any port-specific options available.
-
-void S9xGraphicsMode ()
-***********************
-void S9xTextMode ()
-*******************
-
-The SNES debugger calls these routines to switch from a graphics screen
-mode used to display the SNES game to a debugger screen used to display
-debugger output. If the SNES screen can be displayed at the same time as
-a text display, as would be the case when the host system implements a
-graphical window system, or you're not going to support the SNES debugger,
-then these routines should do nothing.
-
-On the X Window System UNIX/Linux port, these routines do nothing where as
-on the MS-DOS port they switch between a graphics screen mode and a text-only
-screen mode.
-
-bool8 S9xInitUpdate ()
-**********************
-
-Called just before Snes9x starts to render a SNES screen. The Windows port
-uses this call to lock Direct X screen area to allow exclusive access; on
-other existing ports its implemented as an empty function.
-
-bool8 S9xDeinitDisplay (int width, int height, bool8 sixteen_bit)
-*****************************************************************
-
-Called once a complete SNES screen has been rendered into the GFX.Screen
-memory buffer, now is your chance to copy the SNES rendered screen to the
-host computer's screen memory. The problem is that you have to cope with
-different sized SNES rendered screens. Width is always 256, unless you're
-supporting SNES hi-res. screen modes (Settings.SupportHiRes is TRUE), in
-which case it can be 256 or 512. The height parameter can be either 224 or
-239 if you're only supporting SNES lo-res. screen modes, or 224, 239, 448 or
-478 if hi-res. SNES screen modes are being supported.
-
-All current ports support scaling the SNES screen to fill the host system's
-screen, the many ports even supports interpolation - blending the colours of
-adjacent pixels to help hide the fact they've been scaled - and scan-line
-simulation - slightly darkening every other horizontal line.
-
-Don't forget that if you're just placing the SNES image centerally in the
-screen then you might need to clear areas of the screen if the SNES image
-changes size between calls to S9xDeinitDisplay. The MS-DOS and UNIX ports
-currently don't do this which results in junk being left on the screen if
-the ROM changes SNES screen modes.
-
-The sixteen_bit is just a copy of the Settings.SixteenBit setting and if
-TRUE indicates a 16-bit SNES screen image has been rendered, 8-bit otherwise.
-
-void S9xMessage (int type, int number, const char *message)
-***********************************************************
-
-I've started work on converting all the old printfs into calls to this
-routine. When Snes9x wants to display an error, information or warning
-message, it calls this routine. Check in messages.h for the types and
-individual message numbers that Snes9x currently passes as parameters.
-
-The idea is display the message string so the user can see it, but you
-choose not to display anything at all, or change the message based on the
-message number or message type.
-
-Eventually all debug output will also go via this function, trace information
-already does.
-
-bool8 S9xOpenSoundDevice(int mode, bool8 stereo, int buffer_size)
-*****************************************************************
-
-S9xInitSound calls this function to actually open the host operating system's
-sound device, or initialise the sound card in MS-DOS port.
-
-The mode parameter is the value passed in on the command line with the -r
-command line flag, assuming you're using the Snes9x parser. Its meant to
-indicate what playback the sound hardware should be set to, value 1 to 7.
-I think the real SNES sound chip playback rate is 30kHz, but such high
-playback rates take a lot of native CPU power to emulate. The default
-playback rate is 22kHz for the MS-DOS and UNIX ports.
-
-The stereo flag indicates if the user wants stereo sound. Again, stereo
-sound takes more CPU to power to emulate compared to mono sound.
-
-The buffer_size value indicates what sample buffer size the user wants,
-usually zero, meaning you should pick the value best suited to the current
-playback rate. Sound data is normally passed to the sound hardware in
-blocks, the smaller the block the less latency between the SNES game playing
-a sound and it being heard by the user. But if you pick a too smaller value,
-and you're having to periodically poll the operating system to see if it can
-accept more sound data, then the sound output will break up because other
-actions such as rendering the SNES screen can prevent you from polling the
-hardware often enough and the operating system runs out of sound data to
-play.
-
-The MS-DOS port uses a buffer size of 128 samples since the sound card
-sends an interrupt when more data is required which is acted upon promptly,
-where as the Linux and Solaris ports use a buffer size of 512 samples or
-more depending on the playback rate. Stereo and 16-bit sound both double the
-actual size of the buffer in bytes.
-
-uint32 S9xReadJoypad (int which1_0_to_4)
-****************************************
-
-This function is called to return a bit-wise mask of the state of one of the
-five emulated SNES controllers. Return 0 if you're not supporting controllers
-past a certain number or return the mask representing the current state of
-the controller number passed as a parameter or'ed with 0x80000000.
-
-Symbolic constants are defined in snes9x.h indicating the bit positions of
-the various SNES buttons and direction indicators; they're all in the form
-SNES_X_MASK where X is the SNES controller button name.
-
-The MS-DOS and X Window System ports record what keys are currently pressed
-and use that to build up a mask, the Windows port polls the operating system
-when S9xReadJoypad is called to find out what keys are pressed. All ports
-also implement host joysticks and joy-pads via this interface.
-
-bool8 S9xReadMousePosition (int which1_0_to_1, int &x, int &y, uint32 &buttons)
-*******************************************************************************
-
-Used by Snes9x to get the current position of the host pointing device,
-usually a mouse, used to emulated the SNES mouse. Snes9x converts the x and
-y values to delta values required by the SNES mouse, so the actual x and y
-values are unimportant, only the change in value since the last call to
-this function is used.
-
-Graphical windowing systems normally restrict the movement of the pointer on
-the screen, if you're porting to such an environment you might want to make
-a note of the change in position in the mouse since the last time you asked
-the operating system the mouse position, add this change in value to some
-saved x and y value, the reposition the pointer back to the centre of the
-SNES display window. The saved x and y values will be the values returned
-by this function.
-
-The buttons return value is a bit-wise mask of the two SNES mouse buttons,
-bit 0 for button 1 (left) and bit 1 for button 2 (right).
-
-bool8 S9xReadSuperScopePosition (int &x, int &y, uint32 &buttons)
-*****************************************************************
-
-void S9xSetPalette ()
-*********************
-
-void S9xSyncSpeed ()
-S9xUnixProcessSound
-void _makepath(char *, char const *, char const *, char const *, char const *)
-void _splitpath(char const *, char *, char *, char *, char *)
-
-
-Sound Generation
-----------------
-
-Settings
---------
diff --git a/source/font/Pictochat-16.bdf b/source/font/Pictochat-16.bdf
deleted file mode 100644
index a512814..0000000
--- a/source/font/Pictochat-16.bdf
+++ /dev/null
@@ -1,2802 +0,0 @@
-STARTFONT 2.1
-FONT -FontForge-Pictochat-Book-R-Normal--16-150-75-75-P-53-ISO10646-1
-SIZE 15 75 75
-FONTBOUNDINGBOX 12 13 0 -1
-COMMENT "Generated by fontforge, http://fontforge.sourceforge.net"
-STARTPROPERTIES 37
-FAMILY_NAME "Pictochat"
-WEIGHT_NAME "Book"
-SLANT "R"
-SETWIDTH_NAME "Normal"
-ADD_STYLE_NAME ""
-PIXEL_SIZE 16
-POINT_SIZE 150
-RESOLUTION_X 75
-RESOLUTION_Y 75
-SPACING "P"
-AVERAGE_WIDTH 53
-CHARSET_REGISTRY "ISO10646"
-CHARSET_ENCODING "1"
-FONTNAME_REGISTRY ""
-CHARSET_COLLECTIONS "ISO10646-1"
-FONT_NAME "Pictochat"
-FACE_NAME "Pictochat Regular"
-FONT_VERSION "1.0"
-FONT_ASCENT 13
-FONT_DESCENT 3
-UNDERLINE_POSITION 2
-UNDERLINE_THICKNESS 1
-X_HEIGHT 5
-CAP_HEIGHT 8
-RAW_ASCENT 799
-RAW_DESCENT 200
-NORM_SPACE 2
-RELATIVE_WEIGHT 40
-RELATIVE_SETWIDTH 50
-SUPERSCRIPT_X 0
-SUPERSCRIPT_Y 8
-SUPERSCRIPT_SIZE 8
-SUBSCRIPT_X 0
-SUBSCRIPT_Y 0
-SUBSCRIPT_SIZE 8
-AVG_LOWERCASE_WIDTH 55
-AVG_UPPERCASE_WIDTH 56
-ENDPROPERTIES
-CHARS 184
-STARTCHAR space
-ENCODING 32
-SWIDTH 187 0
-DWIDTH 3 0
-BBX 1 1 0 0
-BITMAP
-00
-ENDCHAR
-STARTCHAR exclam
-ENCODING 33
-SWIDTH 125 0
-DWIDTH 2 0
-BBX 1 9 0 0
-BITMAP
-80
-80
-80
-80
-80
-80
-00
-80
-80
-ENDCHAR
-STARTCHAR quotedbl
-ENCODING 34
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 3 0 6
-BITMAP
-28
-50
-A0
-ENDCHAR
-STARTCHAR numbersign
-ENCODING 35
-SWIDTH 500 0
-DWIDTH 8 0
-BBX 7 9 0 0
-BITMAP
-14
-14
-7E
-28
-28
-28
-FC
-50
-50
-ENDCHAR
-STARTCHAR dollar
-ENCODING 36
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-20
-70
-A8
-A0
-70
-28
-A8
-70
-20
-ENDCHAR
-STARTCHAR percent
-ENCODING 37
-SWIDTH 500 0
-DWIDTH 8 0
-BBX 7 9 0 0
-BITMAP
-44
-A4
-A8
-48
-10
-24
-2A
-4A
-44
-ENDCHAR
-STARTCHAR ampersand
-ENCODING 38
-SWIDTH 437 0
-DWIDTH 7 0
-BBX 6 9 0 0
-BITMAP
-20
-50
-50
-50
-20
-54
-88
-88
-74
-ENDCHAR
-STARTCHAR quotesingle
-ENCODING 39
-SWIDTH 187 0
-DWIDTH 3 0
-BBX 1 2 1 7
-BITMAP
-80
-80
-ENDCHAR
-STARTCHAR parenleft
-ENCODING 40
-SWIDTH 250 0
-DWIDTH 4 0
-BBX 3 9 0 0
-BITMAP
-20
-40
-40
-80
-80
-80
-40
-40
-20
-ENDCHAR
-STARTCHAR parenright
-ENCODING 41
-SWIDTH 250 0
-DWIDTH 4 0
-BBX 3 9 0 0
-BITMAP
-80
-40
-40
-20
-20
-20
-40
-40
-80
-ENDCHAR
-STARTCHAR asterisk
-ENCODING 42
-SWIDTH 500 0
-DWIDTH 8 0
-BBX 7 7 0 1
-BITMAP
-10
-92
-54
-38
-54
-92
-10
-ENDCHAR
-STARTCHAR plus
-ENCODING 43
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 5 0 2
-BITMAP
-20
-20
-F8
-20
-20
-ENDCHAR
-STARTCHAR comma
-ENCODING 44
-SWIDTH 312 0
-DWIDTH 5 0
-BBX 2 2 0 -1
-BITMAP
-40
-80
-ENDCHAR
-STARTCHAR hyphen
-ENCODING 45
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 1 0 4
-BITMAP
-F8
-ENDCHAR
-STARTCHAR period
-ENCODING 46
-SWIDTH 250 0
-DWIDTH 4 0
-BBX 1 1 0 0
-BITMAP
-80
-ENDCHAR
-STARTCHAR slash
-ENCODING 47
-SWIDTH 250 0
-DWIDTH 4 0
-BBX 3 9 0 0
-BITMAP
-20
-20
-20
-40
-40
-40
-80
-80
-80
-ENDCHAR
-STARTCHAR zero
-ENCODING 48
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-70
-88
-98
-98
-A8
-C8
-C8
-88
-70
-ENDCHAR
-STARTCHAR one
-ENCODING 49
-SWIDTH 187 0
-DWIDTH 3 0
-BBX 2 9 0 0
-BITMAP
-C0
-40
-40
-40
-40
-40
-40
-40
-40
-ENDCHAR
-STARTCHAR two
-ENCODING 50
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-F0
-08
-08
-08
-70
-80
-80
-80
-F8
-ENDCHAR
-STARTCHAR three
-ENCODING 51
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-F0
-08
-08
-08
-70
-08
-08
-08
-F0
-ENDCHAR
-STARTCHAR four
-ENCODING 52
-SWIDTH 437 0
-DWIDTH 7 0
-BBX 6 9 0 0
-BITMAP
-88
-88
-88
-88
-88
-7C
-08
-08
-08
-ENDCHAR
-STARTCHAR five
-ENCODING 53
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-F8
-80
-80
-80
-F0
-08
-08
-08
-F0
-ENDCHAR
-STARTCHAR six
-ENCODING 54
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-70
-80
-80
-80
-F0
-88
-88
-88
-70
-ENDCHAR
-STARTCHAR seven
-ENCODING 55
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-F8
-08
-08
-10
-20
-20
-20
-20
-20
-ENDCHAR
-STARTCHAR eight
-ENCODING 56
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-70
-88
-88
-88
-70
-88
-88
-88
-70
-ENDCHAR
-STARTCHAR nine
-ENCODING 57
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-70
-88
-88
-88
-78
-08
-08
-08
-70
-ENDCHAR
-STARTCHAR colon
-ENCODING 58
-SWIDTH 125 0
-DWIDTH 2 0
-BBX 1 5 0 2
-BITMAP
-80
-00
-00
-00
-80
-ENDCHAR
-STARTCHAR semicolon
-ENCODING 59
-SWIDTH 187 0
-DWIDTH 3 0
-BBX 2 6 0 1
-BITMAP
-40
-00
-00
-00
-40
-80
-ENDCHAR
-STARTCHAR less
-ENCODING 60
-SWIDTH 250 0
-DWIDTH 4 0
-BBX 3 5 0 2
-BITMAP
-20
-40
-80
-40
-20
-ENDCHAR
-STARTCHAR equal
-ENCODING 61
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 3 0 3
-BITMAP
-F8
-00
-F8
-ENDCHAR
-STARTCHAR greater
-ENCODING 62
-SWIDTH 250 0
-DWIDTH 4 0
-BBX 3 5 0 2
-BITMAP
-80
-40
-20
-40
-80
-ENDCHAR
-STARTCHAR question
-ENCODING 63
-SWIDTH 312 0
-DWIDTH 5 0
-BBX 4 9 0 0
-BITMAP
-E0
-10
-10
-20
-40
-40
-00
-40
-40
-ENDCHAR
-STARTCHAR at
-ENCODING 64
-SWIDTH 500 0
-DWIDTH 8 0
-BBX 7 9 0 0
-BITMAP
-38
-44
-9A
-AA
-AA
-AA
-9C
-40
-3C
-ENDCHAR
-STARTCHAR A
-ENCODING 65
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-20
-20
-50
-50
-50
-F8
-88
-88
-88
-ENDCHAR
-STARTCHAR B
-ENCODING 66
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-F0
-88
-88
-88
-F0
-88
-88
-88
-F0
-ENDCHAR
-STARTCHAR C
-ENCODING 67
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-78
-80
-80
-80
-80
-80
-80
-80
-78
-ENDCHAR
-STARTCHAR D
-ENCODING 68
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-F0
-88
-88
-88
-88
-88
-88
-88
-F0
-ENDCHAR
-STARTCHAR E
-ENCODING 69
-SWIDTH 312 0
-DWIDTH 5 0
-BBX 4 9 0 0
-BITMAP
-F0
-80
-80
-80
-F0
-80
-80
-80
-F0
-ENDCHAR
-STARTCHAR F
-ENCODING 70
-SWIDTH 312 0
-DWIDTH 5 0
-BBX 4 9 0 0
-BITMAP
-F0
-80
-80
-80
-F0
-80
-80
-80
-80
-ENDCHAR
-STARTCHAR G
-ENCODING 71
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-78
-80
-80
-80
-B8
-88
-88
-88
-70
-ENDCHAR
-STARTCHAR H
-ENCODING 72
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-88
-88
-88
-88
-F8
-88
-88
-88
-88
-ENDCHAR
-STARTCHAR I
-ENCODING 73
-SWIDTH 125 0
-DWIDTH 2 0
-BBX 1 9 0 0
-BITMAP
-80
-80
-80
-80
-80
-80
-80
-80
-80
-ENDCHAR
-STARTCHAR J
-ENCODING 74
-SWIDTH 312 0
-DWIDTH 5 0
-BBX 4 9 0 0
-BITMAP
-10
-10
-10
-10
-10
-10
-10
-10
-E0
-ENDCHAR
-STARTCHAR K
-ENCODING 75
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-88
-90
-90
-A0
-C0
-A0
-90
-90
-88
-ENDCHAR
-STARTCHAR L
-ENCODING 76
-SWIDTH 312 0
-DWIDTH 5 0
-BBX 4 9 0 0
-BITMAP
-80
-80
-80
-80
-80
-80
-80
-80
-F0
-ENDCHAR
-STARTCHAR M
-ENCODING 77
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-88
-88
-D8
-D8
-A8
-A8
-88
-88
-88
-ENDCHAR
-STARTCHAR N
-ENCODING 78
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-88
-C8
-C8
-A8
-A8
-98
-98
-88
-88
-ENDCHAR
-STARTCHAR O
-ENCODING 79
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-70
-88
-88
-88
-88
-88
-88
-88
-70
-ENDCHAR
-STARTCHAR P
-ENCODING 80
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-F0
-88
-88
-88
-F0
-80
-80
-80
-80
-ENDCHAR
-STARTCHAR Q
-ENCODING 81
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 10 0 -1
-BITMAP
-70
-88
-88
-88
-88
-88
-88
-A8
-70
-18
-ENDCHAR
-STARTCHAR R
-ENCODING 82
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-F0
-88
-88
-88
-F0
-90
-90
-88
-88
-ENDCHAR
-STARTCHAR S
-ENCODING 83
-SWIDTH 312 0
-DWIDTH 5 0
-BBX 4 9 0 0
-BITMAP
-70
-80
-80
-80
-60
-10
-10
-10
-E0
-ENDCHAR
-STARTCHAR T
-ENCODING 84
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-F8
-20
-20
-20
-20
-20
-20
-20
-20
-ENDCHAR
-STARTCHAR U
-ENCODING 85
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-88
-88
-88
-88
-88
-88
-88
-88
-70
-ENDCHAR
-STARTCHAR V
-ENCODING 86
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-88
-88
-88
-50
-50
-50
-50
-20
-20
-ENDCHAR
-STARTCHAR W
-ENCODING 87
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-88
-88
-A8
-A8
-A8
-A8
-50
-50
-50
-ENDCHAR
-STARTCHAR X
-ENCODING 88
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-88
-88
-50
-50
-20
-50
-50
-88
-88
-ENDCHAR
-STARTCHAR Y
-ENCODING 89
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-88
-88
-50
-50
-20
-20
-20
-20
-20
-ENDCHAR
-STARTCHAR Z
-ENCODING 90
-SWIDTH 312 0
-DWIDTH 5 0
-BBX 4 9 0 0
-BITMAP
-F0
-10
-20
-20
-60
-40
-40
-80
-F0
-ENDCHAR
-STARTCHAR bracketleft
-ENCODING 91
-SWIDTH 250 0
-DWIDTH 4 0
-BBX 3 9 0 0
-BITMAP
-E0
-80
-80
-80
-80
-80
-80
-80
-E0
-ENDCHAR
-STARTCHAR backslash
-ENCODING 92
-SWIDTH 250 0
-DWIDTH 4 0
-BBX 3 9 0 0
-BITMAP
-80
-80
-80
-40
-40
-40
-20
-20
-20
-ENDCHAR
-STARTCHAR bracketright
-ENCODING 93
-SWIDTH 250 0
-DWIDTH 4 0
-BBX 3 9 0 0
-BITMAP
-E0
-20
-20
-20
-20
-20
-20
-20
-E0
-ENDCHAR
-STARTCHAR asciicircum
-ENCODING 94
-SWIDTH 250 0
-DWIDTH 4 0
-BBX 3 2 0 7
-BITMAP
-40
-A0
-ENDCHAR
-STARTCHAR underscore
-ENCODING 95
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 1 0 0
-BITMAP
-F8
-ENDCHAR
-STARTCHAR grave
-ENCODING 96
-SWIDTH 187 0
-DWIDTH 3 0
-BBX 2 2 0 7
-BITMAP
-80
-40
-ENDCHAR
-STARTCHAR a
-ENCODING 97
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 6 0 0
-BITMAP
-F0
-08
-78
-88
-88
-78
-ENDCHAR
-STARTCHAR b
-ENCODING 98
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-80
-80
-80
-F0
-88
-88
-88
-88
-F0
-ENDCHAR
-STARTCHAR c
-ENCODING 99
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 6 0 0
-BITMAP
-78
-80
-80
-80
-80
-78
-ENDCHAR
-STARTCHAR d
-ENCODING 100
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-08
-08
-08
-78
-88
-88
-88
-88
-78
-ENDCHAR
-STARTCHAR e
-ENCODING 101
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 6 0 0
-BITMAP
-70
-88
-F8
-80
-80
-78
-ENDCHAR
-STARTCHAR f
-ENCODING 102
-SWIDTH 312 0
-DWIDTH 5 0
-BBX 4 9 0 0
-BITMAP
-30
-40
-40
-F0
-40
-40
-40
-40
-40
-ENDCHAR
-STARTCHAR g
-ENCODING 103
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 7 0 -1
-BITMAP
-78
-88
-88
-88
-78
-08
-F0
-ENDCHAR
-STARTCHAR h
-ENCODING 104
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-80
-80
-80
-F0
-88
-88
-88
-88
-88
-ENDCHAR
-STARTCHAR i
-ENCODING 105
-SWIDTH 125 0
-DWIDTH 2 0
-BBX 1 8 0 0
-BITMAP
-80
-00
-80
-80
-80
-80
-80
-80
-ENDCHAR
-STARTCHAR j
-ENCODING 106
-SWIDTH 250 0
-DWIDTH 4 0
-BBX 3 9 0 -1
-BITMAP
-20
-00
-20
-20
-20
-20
-20
-20
-C0
-ENDCHAR
-STARTCHAR k
-ENCODING 107
-SWIDTH 312 0
-DWIDTH 5 0
-BBX 4 9 0 0
-BITMAP
-80
-80
-80
-90
-A0
-C0
-A0
-90
-90
-ENDCHAR
-STARTCHAR l
-ENCODING 108
-SWIDTH 187 0
-DWIDTH 3 0
-BBX 2 9 0 0
-BITMAP
-80
-80
-80
-80
-80
-80
-80
-80
-40
-ENDCHAR
-STARTCHAR m
-ENCODING 109
-SWIDTH 500 0
-DWIDTH 8 0
-BBX 7 6 0 0
-BITMAP
-FC
-92
-92
-92
-92
-92
-ENDCHAR
-STARTCHAR n
-ENCODING 110
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 6 0 0
-BITMAP
-F0
-88
-88
-88
-88
-88
-ENDCHAR
-STARTCHAR o
-ENCODING 111
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 6 0 0
-BITMAP
-70
-88
-88
-88
-88
-70
-ENDCHAR
-STARTCHAR p
-ENCODING 112
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 7 0 -1
-BITMAP
-F0
-88
-88
-88
-F0
-80
-80
-ENDCHAR
-STARTCHAR q
-ENCODING 113
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 7 0 -1
-BITMAP
-78
-88
-88
-88
-78
-08
-08
-ENDCHAR
-STARTCHAR r
-ENCODING 114
-SWIDTH 312 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-B0
-C0
-80
-80
-80
-80
-ENDCHAR
-STARTCHAR s
-ENCODING 115
-SWIDTH 312 0
-DWIDTH 5 0
-BBX 4 6 0 0
-BITMAP
-70
-80
-60
-10
-10
-E0
-ENDCHAR
-STARTCHAR t
-ENCODING 116
-SWIDTH 312 0
-DWIDTH 5 0
-BBX 4 8 0 0
-BITMAP
-40
-40
-F0
-40
-40
-40
-40
-30
-ENDCHAR
-STARTCHAR u
-ENCODING 117
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 6 0 0
-BITMAP
-88
-88
-88
-88
-88
-78
-ENDCHAR
-STARTCHAR v
-ENCODING 118
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 6 0 0
-BITMAP
-88
-88
-50
-50
-20
-20
-ENDCHAR
-STARTCHAR w
-ENCODING 119
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 6 0 0
-BITMAP
-88
-A8
-A8
-A8
-50
-50
-ENDCHAR
-STARTCHAR x
-ENCODING 120
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 6 0 0
-BITMAP
-88
-50
-20
-20
-50
-88
-ENDCHAR
-STARTCHAR y
-ENCODING 121
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 7 0 -1
-BITMAP
-88
-88
-50
-50
-20
-20
-C0
-ENDCHAR
-STARTCHAR z
-ENCODING 122
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 6 0 0
-BITMAP
-F8
-10
-20
-40
-80
-F8
-ENDCHAR
-STARTCHAR braceleft
-ENCODING 123
-SWIDTH 312 0
-DWIDTH 5 0
-BBX 4 9 0 0
-BITMAP
-30
-40
-40
-40
-80
-40
-40
-40
-30
-ENDCHAR
-STARTCHAR bar
-ENCODING 124
-SWIDTH 187 0
-DWIDTH 3 0
-BBX 1 9 1 0
-BITMAP
-80
-80
-80
-80
-80
-80
-80
-80
-80
-ENDCHAR
-STARTCHAR braceright
-ENCODING 125
-SWIDTH 312 0
-DWIDTH 5 0
-BBX 4 9 0 0
-BITMAP
-C0
-20
-20
-20
-10
-20
-20
-20
-C0
-ENDCHAR
-STARTCHAR asciitilde
-ENCODING 126
-SWIDTH 625 0
-DWIDTH 10 0
-BBX 9 2 0 4
-BITMAP
-7880
-8700
-ENDCHAR
-STARTCHAR exclamdown
-ENCODING 161
-SWIDTH 125 0
-DWIDTH 2 0
-BBX 1 9 0 0
-BITMAP
-80
-80
-00
-80
-80
-80
-80
-80
-80
-ENDCHAR
-STARTCHAR cent
-ENCODING 162
-SWIDTH 437 0
-DWIDTH 7 0
-BBX 6 9 0 0
-BITMAP
-10
-78
-94
-A0
-A0
-A0
-C4
-78
-40
-ENDCHAR
-STARTCHAR sterling
-ENCODING 163
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-30
-48
-40
-20
-F8
-20
-40
-80
-F8
-ENDCHAR
-STARTCHAR yen
-ENCODING 165
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-88
-88
-50
-50
-F8
-20
-F8
-20
-20
-ENDCHAR
-STARTCHAR brokenbar
-ENCODING 166
-SWIDTH 125 0
-DWIDTH 2 0
-BBX 1 9 0 0
-BITMAP
-80
-80
-80
-80
-00
-80
-80
-80
-80
-ENDCHAR
-STARTCHAR copyright
-ENCODING 169
-SWIDTH 625 0
-DWIDTH 10 0
-BBX 9 9 0 0
-BITMAP
-3E00
-4100
-9C80
-A280
-A080
-A280
-9C80
-4100
-3E00
-ENDCHAR
-STARTCHAR registered
-ENCODING 174
-SWIDTH 625 0
-DWIDTH 10 0
-BBX 9 9 0 0
-BITMAP
-3E00
-4100
-BC80
-A280
-BC80
-A480
-A280
-4100
-3E00
-ENDCHAR
-STARTCHAR degree
-ENCODING 176
-SWIDTH 250 0
-DWIDTH 4 0
-BBX 3 3 0 6
-BITMAP
-40
-A0
-40
-ENDCHAR
-STARTCHAR plusminus
-ENCODING 177
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 7 0 1
-BITMAP
-20
-20
-F8
-20
-20
-00
-F8
-ENDCHAR
-STARTCHAR acute
-ENCODING 180
-SWIDTH 187 0
-DWIDTH 3 0
-BBX 2 2 0 7
-BITMAP
-40
-80
-ENDCHAR
-STARTCHAR periodcentered
-ENCODING 183
-SWIDTH 250 0
-DWIDTH 4 0
-BBX 2 2 1 3
-BITMAP
-C0
-C0
-ENDCHAR
-STARTCHAR questiondown
-ENCODING 191
-SWIDTH 312 0
-DWIDTH 5 0
-BBX 4 9 0 0
-BITMAP
-20
-20
-00
-20
-20
-40
-80
-80
-70
-ENDCHAR
-STARTCHAR Agrave
-ENCODING 192
-SWIDTH 1000 0
-DWIDTH 6 0
-BBX 5 11 0 0
-BITMAP
-20
-10
-00
-20
-50
-50
-50
-F8
-88
-88
-88
-ENDCHAR
-STARTCHAR Aacute
-ENCODING 193
-SWIDTH 1000 0
-DWIDTH 6 0
-BBX 5 11 0 0
-BITMAP
-20
-40
-00
-20
-50
-50
-50
-F8
-88
-88
-88
-ENDCHAR
-STARTCHAR Acircumflex
-ENCODING 194
-SWIDTH 1000 0
-DWIDTH 6 0
-BBX 5 12 0 0
-BITMAP
-20
-50
-00
-20
-20
-50
-50
-50
-F8
-88
-88
-88
-ENDCHAR
-STARTCHAR Atilde
-ENCODING 195
-SWIDTH 1000 0
-DWIDTH 6 0
-BBX 5 11 0 0
-BITMAP
-28
-50
-00
-20
-50
-50
-50
-F8
-88
-88
-88
-ENDCHAR
-STARTCHAR Adieresis
-ENCODING 196
-SWIDTH 1000 0
-DWIDTH 6 0
-BBX 5 11 0 0
-BITMAP
-50
-00
-20
-20
-50
-50
-50
-F8
-88
-88
-88
-ENDCHAR
-STARTCHAR Aring
-ENCODING 197
-SWIDTH 1000 0
-DWIDTH 6 0
-BBX 5 12 0 0
-BITMAP
-20
-50
-20
-00
-20
-50
-50
-50
-F8
-88
-88
-88
-ENDCHAR
-STARTCHAR Ccedilla
-ENCODING 199
-SWIDTH 312 0
-DWIDTH 5 0
-BBX 4 10 0 -1
-BITMAP
-70
-80
-80
-80
-80
-80
-80
-70
-20
-40
-ENDCHAR
-STARTCHAR Egrave
-ENCODING 200
-SWIDTH 1000 0
-DWIDTH 5 0
-BBX 4 11 0 0
-BITMAP
-40
-20
-00
-F0
-80
-80
-F0
-80
-80
-80
-F0
-ENDCHAR
-STARTCHAR Eacute
-ENCODING 201
-SWIDTH 1000 0
-DWIDTH 5 0
-BBX 4 11 0 0
-BITMAP
-20
-40
-00
-F0
-80
-80
-F0
-80
-80
-80
-F0
-ENDCHAR
-STARTCHAR Ecircumflex
-ENCODING 202
-SWIDTH 1000 0
-DWIDTH 5 0
-BBX 4 11 0 0
-BITMAP
-20
-50
-00
-F0
-80
-80
-F0
-80
-80
-80
-F0
-ENDCHAR
-STARTCHAR Edieresis
-ENCODING 203
-SWIDTH 1000 0
-DWIDTH 5 0
-BBX 4 10 0 0
-BITMAP
-50
-00
-F0
-80
-80
-F0
-80
-80
-80
-F0
-ENDCHAR
-STARTCHAR Igrave
-ENCODING 204
-SWIDTH 250 0
-DWIDTH 4 0
-BBX 2 11 0 0
-BITMAP
-80
-40
-00
-40
-40
-40
-40
-40
-40
-40
-40
-ENDCHAR
-STARTCHAR Iacute
-ENCODING 205
-SWIDTH 250 0
-DWIDTH 4 0
-BBX 2 11 1 0
-BITMAP
-40
-80
-00
-80
-80
-80
-80
-80
-80
-80
-80
-ENDCHAR
-STARTCHAR Icircumflex
-ENCODING 206
-SWIDTH 250 0
-DWIDTH 4 0
-BBX 3 11 0 0
-BITMAP
-40
-A0
-00
-40
-40
-40
-40
-40
-40
-40
-40
-ENDCHAR
-STARTCHAR Idieresis
-ENCODING 207
-SWIDTH 250 0
-DWIDTH 4 0
-BBX 3 10 0 0
-BITMAP
-A0
-00
-40
-40
-40
-40
-40
-40
-40
-40
-ENDCHAR
-STARTCHAR Ntilde
-ENCODING 209
-SWIDTH 1000 0
-DWIDTH 6 0
-BBX 5 11 0 0
-BITMAP
-28
-50
-00
-88
-C8
-C8
-A8
-A8
-98
-98
-88
-ENDCHAR
-STARTCHAR Ograve
-ENCODING 210
-SWIDTH 1000 0
-DWIDTH 6 0
-BBX 5 11 0 0
-BITMAP
-40
-20
-00
-70
-88
-88
-88
-88
-88
-88
-70
-ENDCHAR
-STARTCHAR Oacute
-ENCODING 211
-SWIDTH 1000 0
-DWIDTH 6 0
-BBX 5 11 0 0
-BITMAP
-10
-20
-00
-70
-88
-88
-88
-88
-88
-88
-70
-ENDCHAR
-STARTCHAR Ocircumflex
-ENCODING 212
-SWIDTH 1000 0
-DWIDTH 6 0
-BBX 5 11 0 0
-BITMAP
-20
-50
-00
-70
-88
-88
-88
-88
-88
-88
-70
-ENDCHAR
-STARTCHAR Otilde
-ENCODING 213
-SWIDTH 1000 0
-DWIDTH 6 0
-BBX 5 11 0 0
-BITMAP
-28
-50
-00
-70
-88
-88
-88
-88
-88
-88
-70
-ENDCHAR
-STARTCHAR Odieresis
-ENCODING 214
-SWIDTH 1000 0
-DWIDTH 6 0
-BBX 5 11 0 0
-BITMAP
-50
-00
-00
-70
-88
-88
-88
-88
-88
-88
-70
-ENDCHAR
-STARTCHAR multiply
-ENCODING 215
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 5 0 2
-BITMAP
-88
-50
-20
-50
-88
-ENDCHAR
-STARTCHAR Ugrave
-ENCODING 217
-SWIDTH 1000 0
-DWIDTH 6 0
-BBX 5 11 0 0
-BITMAP
-40
-20
-00
-88
-88
-88
-88
-88
-88
-88
-70
-ENDCHAR
-STARTCHAR Uacute
-ENCODING 218
-SWIDTH 1000 0
-DWIDTH 6 0
-BBX 5 11 0 0
-BITMAP
-10
-20
-00
-88
-88
-88
-88
-88
-88
-88
-70
-ENDCHAR
-STARTCHAR Ucircumflex
-ENCODING 219
-SWIDTH 1000 0
-DWIDTH 6 0
-BBX 5 11 0 0
-BITMAP
-20
-50
-00
-88
-88
-88
-88
-88
-88
-88
-70
-ENDCHAR
-STARTCHAR Udieresis
-ENCODING 220
-SWIDTH 1000 0
-DWIDTH 6 0
-BBX 5 10 0 0
-BITMAP
-50
-00
-88
-88
-88
-88
-88
-88
-88
-70
-ENDCHAR
-STARTCHAR Thorn
-ENCODING 222
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-80
-80
-F0
-88
-88
-88
-F0
-80
-80
-ENDCHAR
-STARTCHAR germandbls
-ENCODING 223
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-70
-88
-88
-B0
-88
-88
-88
-B0
-80
-ENDCHAR
-STARTCHAR agrave
-ENCODING 224
-SWIDTH 1000 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-20
-10
-00
-F0
-08
-78
-88
-88
-78
-ENDCHAR
-STARTCHAR aacute
-ENCODING 225
-SWIDTH 1000 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-10
-20
-00
-F0
-08
-78
-88
-88
-78
-ENDCHAR
-STARTCHAR acircumflex
-ENCODING 226
-SWIDTH 1000 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-20
-50
-00
-F0
-08
-78
-88
-88
-78
-ENDCHAR
-STARTCHAR atilde
-ENCODING 227
-SWIDTH 1000 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-28
-50
-00
-F0
-08
-78
-88
-88
-78
-ENDCHAR
-STARTCHAR adieresis
-ENCODING 228
-SWIDTH 1000 0
-DWIDTH 6 0
-BBX 5 8 0 0
-BITMAP
-50
-00
-F0
-08
-78
-88
-88
-78
-ENDCHAR
-STARTCHAR aring
-ENCODING 229
-SWIDTH 1000 0
-DWIDTH 6 0
-BBX 5 10 0 0
-BITMAP
-20
-50
-20
-00
-F0
-08
-78
-88
-88
-78
-ENDCHAR
-STARTCHAR ccedilla
-ENCODING 231
-SWIDTH 312 0
-DWIDTH 5 0
-BBX 4 7 0 -1
-BITMAP
-70
-80
-80
-80
-70
-20
-40
-ENDCHAR
-STARTCHAR egrave
-ENCODING 232
-SWIDTH 1000 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-40
-20
-00
-70
-88
-F8
-80
-80
-78
-ENDCHAR
-STARTCHAR eacute
-ENCODING 233
-SWIDTH 1000 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-10
-20
-00
-70
-88
-F8
-80
-80
-78
-ENDCHAR
-STARTCHAR ecircumflex
-ENCODING 234
-SWIDTH 1000 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-20
-50
-00
-70
-88
-F8
-80
-80
-78
-ENDCHAR
-STARTCHAR edieresis
-ENCODING 235
-SWIDTH 1000 0
-DWIDTH 6 0
-BBX 5 8 0 0
-BITMAP
-50
-00
-70
-88
-F8
-80
-80
-78
-ENDCHAR
-STARTCHAR igrave
-ENCODING 236
-SWIDTH 250 0
-DWIDTH 4 0
-BBX 2 9 0 0
-BITMAP
-80
-40
-00
-40
-40
-40
-40
-40
-40
-ENDCHAR
-STARTCHAR iacute
-ENCODING 237
-SWIDTH 250 0
-DWIDTH 4 0
-BBX 2 9 1 0
-BITMAP
-40
-80
-00
-80
-80
-80
-80
-80
-80
-ENDCHAR
-STARTCHAR icircumflex
-ENCODING 238
-SWIDTH 250 0
-DWIDTH 4 0
-BBX 3 9 0 0
-BITMAP
-40
-A0
-00
-40
-40
-40
-40
-40
-40
-ENDCHAR
-STARTCHAR idieresis
-ENCODING 239
-SWIDTH 250 0
-DWIDTH 4 0
-BBX 3 8 0 0
-BITMAP
-A0
-00
-40
-40
-40
-40
-40
-40
-ENDCHAR
-STARTCHAR ntilde
-ENCODING 241
-SWIDTH 1000 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-28
-50
-00
-F0
-88
-88
-88
-88
-88
-ENDCHAR
-STARTCHAR ograve
-ENCODING 242
-SWIDTH 1000 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-40
-20
-00
-70
-88
-88
-88
-88
-70
-ENDCHAR
-STARTCHAR oacute
-ENCODING 243
-SWIDTH 1000 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-10
-20
-00
-70
-88
-88
-88
-88
-70
-ENDCHAR
-STARTCHAR ocircumflex
-ENCODING 244
-SWIDTH 1000 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-20
-50
-00
-70
-88
-88
-88
-88
-70
-ENDCHAR
-STARTCHAR otilde
-ENCODING 245
-SWIDTH 1000 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-28
-50
-00
-70
-88
-88
-88
-88
-70
-ENDCHAR
-STARTCHAR odieresis
-ENCODING 246
-SWIDTH 1000 0
-DWIDTH 6 0
-BBX 5 8 0 0
-BITMAP
-50
-00
-70
-88
-88
-88
-88
-70
-ENDCHAR
-STARTCHAR divide
-ENCODING 247
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 5 0 2
-BITMAP
-20
-00
-F8
-00
-20
-ENDCHAR
-STARTCHAR ugrave
-ENCODING 249
-SWIDTH 1000 0
-DWIDTH 6 0
-BBX 5 8 0 0
-BITMAP
-40
-20
-88
-88
-88
-88
-88
-78
-ENDCHAR
-STARTCHAR uacute
-ENCODING 250
-SWIDTH 1000 0
-DWIDTH 6 0
-BBX 5 8 0 0
-BITMAP
-10
-20
-88
-88
-88
-88
-88
-78
-ENDCHAR
-STARTCHAR ucircumflex
-ENCODING 251
-SWIDTH 1000 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-20
-50
-00
-88
-88
-88
-88
-88
-78
-ENDCHAR
-STARTCHAR udieresis
-ENCODING 252
-SWIDTH 1000 0
-DWIDTH 6 0
-BBX 5 8 0 0
-BITMAP
-50
-00
-88
-88
-88
-88
-88
-78
-ENDCHAR
-STARTCHAR yacute
-ENCODING 253
-SWIDTH 1000 0
-DWIDTH 6 0
-BBX 5 10 0 -1
-BITMAP
-10
-20
-00
-88
-88
-50
-50
-20
-20
-C0
-ENDCHAR
-STARTCHAR thorn
-ENCODING 254
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 9 0 -1
-BITMAP
-80
-80
-F0
-88
-88
-88
-F0
-80
-80
-ENDCHAR
-STARTCHAR ydieresis
-ENCODING 255
-SWIDTH 1000 0
-DWIDTH 6 0
-BBX 5 9 0 -1
-BITMAP
-50
-00
-88
-88
-50
-50
-20
-20
-C0
-ENDCHAR
-STARTCHAR OE
-ENCODING 338
-SWIDTH 500 0
-DWIDTH 8 0
-BBX 7 9 0 0
-BITMAP
-6E
-90
-90
-90
-9E
-90
-90
-90
-6E
-ENDCHAR
-STARTCHAR oe
-ENCODING 339
-SWIDTH 500 0
-DWIDTH 8 0
-BBX 7 6 0 0
-BITMAP
-6C
-92
-9E
-90
-90
-6E
-ENDCHAR
-STARTCHAR uni05C8
-ENCODING 1480
-SWIDTH 625 0
-DWIDTH 10 0
-BBX 9 9 0 0
-BITMAP
-3E00
-7F00
-F780
-EB80
-EB80
-C180
-DD80
-7F00
-3E00
-ENDCHAR
-STARTCHAR uni05C9
-ENCODING 1481
-SWIDTH 1000 0
-DWIDTH 10 0
-BBX 9 9 0 0
-BITMAP
-3E00
-7F00
-C380
-DD80
-C380
-DD80
-C380
-7F00
-3E00
-ENDCHAR
-STARTCHAR uni05CA
-ENCODING 1482
-SWIDTH 1000 0
-DWIDTH 10 0
-BBX 9 9 0 0
-BITMAP
-3E00
-7F00
-DD80
-EB80
-F780
-EB80
-DD80
-7F00
-3E00
-ENDCHAR
-STARTCHAR uni05CB
-ENCODING 1483
-SWIDTH 1000 0
-DWIDTH 10 0
-BBX 9 9 0 0
-BITMAP
-3E00
-7F00
-DD80
-EB80
-F780
-F780
-F780
-7F00
-3E00
-ENDCHAR
-STARTCHAR uni05CC
-ENCODING 1484
-SWIDTH 625 0
-DWIDTH 10 0
-BBX 9 9 0 0
-BITMAP
-1F80
-3F80
-6F80
-EF80
-EF80
-EF80
-E180
-FF80
-FF80
-ENDCHAR
-STARTCHAR uni05CD
-ENCODING 1485
-SWIDTH 625 0
-DWIDTH 10 0
-BBX 9 9 0 0
-BITMAP
-FC00
-FE00
-C300
-DD80
-C380
-DB80
-DD80
-FF80
-FF80
-ENDCHAR
-STARTCHAR uni05CE
-ENCODING 1486
-SWIDTH 625 0
-DWIDTH 10 0
-BBX 7 5 1 2
-BITMAP
-6E
-84
-44
-24
-C4
-ENDCHAR
-STARTCHAR uni05CF
-ENCODING 1487
-SWIDTH 875 0
-DWIDTH 14 0
-BBX 11 5 1 2
-BITMAP
-6E80
-8880
-4C80
-2880
-CEE0
-ENDCHAR
-STARTCHAR quotedblleft
-ENCODING 8220
-SWIDTH 312 0
-DWIDTH 5 0
-BBX 4 2 0 7
-BITMAP
-50
-A0
-ENDCHAR
-STARTCHAR quotedblright
-ENCODING 8221
-SWIDTH 312 0
-DWIDTH 5 0
-BBX 4 2 0 7
-BITMAP
-50
-A0
-ENDCHAR
-STARTCHAR bullet
-ENCODING 8226
-SWIDTH 312 0
-DWIDTH 5 0
-BBX 4 4 0 2
-BITMAP
-60
-F0
-F0
-60
-ENDCHAR
-STARTCHAR ellipsis
-ENCODING 8230
-SWIDTH 500 0
-DWIDTH 8 0
-BBX 5 1 0 0
-BITMAP
-A8
-ENDCHAR
-STARTCHAR Euro
-ENCODING 8364
-SWIDTH 437 0
-DWIDTH 7 0
-BBX 6 9 0 0
-BITMAP
-18
-24
-40
-F0
-40
-F0
-40
-24
-18
-ENDCHAR
-STARTCHAR trademark
-ENCODING 8482
-SWIDTH 625 0
-DWIDTH 10 0
-BBX 9 4 0 5
-BITMAP
-E880
-4D80
-4A80
-4880
-ENDCHAR
-STARTCHAR arrowleft
-ENCODING 8592
-SWIDTH 625 0
-DWIDTH 10 0
-BBX 9 5 0 2
-BITMAP
-2000
-4000
-FF80
-4000
-2000
-ENDCHAR
-STARTCHAR arrowup
-ENCODING 8593
-SWIDTH 375 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-20
-70
-A8
-20
-20
-20
-20
-20
-20
-ENDCHAR
-STARTCHAR arrowright
-ENCODING 8594
-SWIDTH 1000 0
-DWIDTH 10 0
-BBX 9 5 0 2
-BITMAP
-0200
-0100
-FF80
-0100
-0200
-ENDCHAR
-STARTCHAR arrowdown
-ENCODING 8595
-SWIDTH 1000 0
-DWIDTH 6 0
-BBX 5 9 0 0
-BITMAP
-20
-20
-20
-20
-20
-20
-A8
-70
-20
-ENDCHAR
-ENDFONT
diff --git a/source/font/README.txt b/source/font/README.txt
deleted file mode 100644
index c417cb8..0000000
--- a/source/font/README.txt
+++ /dev/null
@@ -1,40 +0,0 @@
-In this directory, you will find the source file for the main font used by
-CATSFC. It's an Adobe BDF file, which is fed into the emulator when running
-in "font dump" mode to produce a more efficient representation in an "ODF"
-format. The font is based on the one used by Pictochat, with a few more
-characters that Pictochat does not have (but no Japanese characters).
-
-You can edit the font in an application that reads BDF bitmap fonts, such as
-FontForge. Open the font in the application then export it again as BDF.
-One case where you would want to do this is to add new glyphs to support a
-new language.
-
-To include the more efficient representation (ODF) in CATSFC/system after
-editing the BDF file:
-
- 1. If your font added characters beyond U+2193 DOWNWARDS ARROW, adjust the
- maximum codepoint in source/nds/bdf_font.c, after the first instance of
- > #ifndef HAVE_ODF
- 2. In source/nds/bdf_font.c,
- > #define DUMP_ODF
- and
- > // #define HAVE_ODF
- This will make the plugin read the BDF source and write an ODF file.
- 3. make
- 4. Copy the new plugin to your card, under /_dstwoplug.
- 5. Copy the .bdf file to your card, under /CATSFC/system, as Pictochat-16.bdf.
- 6. Run the plugin on the Supercard DSTWO. It will briefly load, then display
- "Font library initialisation error -1, press any key to exit". This is
- because it tries to load the Chinese font's source, Song.bdf, which you
- don't have. Regardless, it does dump an ODF file for Pictochat-16.bdf.
- 7. Copy the .odf font somewhere on your hard drive if you want to keep a copy
- of it. Delete the .bdf file from your card.
- 8. Reverse the changes made in step 2.
- 9. make
-10. Copy the new plugin to your card, under /_dstwoplug.
-
-And you can use your new font!
-
-Finally, you may want to send your .bdf source file to a CATSFC developer
-or commit it to a fork on Github, for inclusion in the plugin. You may also
-want to send your changes to CATSFC/system/language.msg for the same reason. \ No newline at end of file
diff --git a/source/images/applications-system.svg b/source/images/applications-system.svg
deleted file mode 100644
index 9d76774..0000000
--- a/source/images/applications-system.svg
+++ /dev/null
@@ -1,247 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- width="48.000000px"
- height="48.000000px"
- id="svg53383"
- sodipodi:version="0.32"
- inkscape:version="0.46"
- sodipodi:docbase="/home/jimmac/src/cvs/tango-icon-theme/scalable/categories"
- sodipodi:docname="applications-system.svg"
- inkscape:output_extension="org.inkscape.output.svg.inkscape">
- <defs
- id="defs3">
- <inkscape:perspective
- sodipodi:type="inkscape:persp3d"
- inkscape:vp_x="0 : 24 : 1"
- inkscape:vp_y="0 : 1000 : 0"
- inkscape:vp_z="48 : 24 : 1"
- inkscape:persp3d-origin="24 : 16 : 1"
- id="perspective31" />
- <linearGradient
- id="linearGradient3264">
- <stop
- style="stop-color:#c9c9c9;stop-opacity:1;"
- offset="0"
- id="stop3266" />
- <stop
- id="stop3276"
- offset="0.25"
- style="stop-color:#f8f8f8;stop-opacity:1;" />
- <stop
- id="stop3272"
- offset="0.5"
- style="stop-color:#e2e2e2;stop-opacity:1;" />
- <stop
- style="stop-color:#b0b0b0;stop-opacity:1;"
- offset="0.75"
- id="stop3274" />
- <stop
- style="stop-color:#c9c9c9;stop-opacity:1;"
- offset="1"
- id="stop3268" />
- </linearGradient>
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3264"
- id="linearGradient3281"
- gradientUnits="userSpaceOnUse"
- x1="14.462892"
- y1="12.284524"
- x2="34.534348"
- y2="39.684914"
- gradientTransform="matrix(1.241935,0,0,1.241935,-5.027508,-7.208988)" />
- <linearGradient
- id="linearGradient2300">
- <stop
- id="stop2302"
- offset="0.0000000"
- style="stop-color:#000000;stop-opacity:0.32673267;" />
- <stop
- id="stop2304"
- offset="1"
- style="stop-color:#000000;stop-opacity:0;" />
- </linearGradient>
- <linearGradient
- id="aigrd1"
- gradientUnits="userSpaceOnUse"
- x1="99.7773"
- y1="15.4238"
- x2="153.0005"
- y2="248.6311">
- <stop
- offset="0"
- style="stop-color:#184375"
- id="stop53300" />
- <stop
- offset="1"
- style="stop-color:#C8BDDC"
- id="stop53302" />
- </linearGradient>
- <linearGradient
- inkscape:collect="always"
- xlink:href="#aigrd1"
- id="linearGradient53551"
- gradientUnits="userSpaceOnUse"
- x1="99.7773"
- y1="15.4238"
- x2="153.0005"
- y2="248.6311"
- gradientTransform="matrix(0.200685,0.000000,0.000000,0.200685,-0.585758,-1.050787)" />
- <radialGradient
- gradientUnits="userSpaceOnUse"
- r="11.689870"
- fy="72.568001"
- fx="14.287618"
- cy="68.872971"
- cx="14.287618"
- gradientTransform="matrix(1.399258,-2.234445e-7,8.196178e-8,0.513264,4.365074,4.839285)"
- id="radialGradient2308"
- xlink:href="#linearGradient2300"
- inkscape:collect="always" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient3264"
- id="linearGradient3760"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(1.241935,0,0,1.241935,-5.027508,-7.208988)"
- x1="14.462892"
- y1="12.284524"
- x2="34.534348"
- y2="39.684914" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#aigrd1"
- id="linearGradient3773"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.200685,0,0,0.200685,-54.33576,-1.050787)"
- x1="99.7773"
- y1="15.4238"
- x2="153.0005"
- y2="248.6311" />
- </defs>
- <sodipodi:namedview
- inkscape:showpageshadow="false"
- id="base"
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="0.11764706"
- inkscape:pageopacity="0.0"
- inkscape:pageshadow="2"
- inkscape:zoom="5.6568542"
- inkscape:cx="43.652227"
- inkscape:cy="21.164787"
- inkscape:current-layer="layer1"
- showgrid="false"
- inkscape:grid-bbox="true"
- inkscape:document-units="px"
- inkscape:window-width="872"
- inkscape:window-height="697"
- inkscape:window-x="562"
- inkscape:window-y="151" />
- <metadata
- id="metadata4">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title>System Applications</dc:title>
- <dc:creator>
- <cc:Agent>
- <dc:title>Jakub Steiner</dc:title>
- </cc:Agent>
- </dc:creator>
- <dc:source>http://jimmac.musichall.cz/</dc:source>
- <dc:subject>
- <rdf:Bag>
- <rdf:li>system</rdf:li>
- <rdf:li>applications</rdf:li>
- <rdf:li>group</rdf:li>
- <rdf:li>category</rdf:li>
- <rdf:li>admin</rdf:li>
- <rdf:li>root</rdf:li>
- </rdf:Bag>
- </dc:subject>
- <cc:license
- rdf:resource="http://creativecommons.org/licenses/publicdomain/" />
- </cc:Work>
- <cc:License
- rdf:about="http://creativecommons.org/licenses/publicdomain/">
- <cc:permits
- rdf:resource="http://creativecommons.org/ns#Reproduction" />
- <cc:permits
- rdf:resource="http://creativecommons.org/ns#Distribution" />
- <cc:permits
- rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
- </cc:License>
- </rdf:RDF>
- </metadata>
- <g
- inkscape:label="shadow"
- id="layer2"
- inkscape:groupmode="layer">
- <path
- transform="matrix(1.186380,0.000000,0.000000,1.186380,-4.539687,-7.794678)"
- d="M 44.285715 38.714287 A 19.928572 9.8372450 0 1 1 4.4285717,38.714287 A 19.928572 9.8372450 0 1 1 44.285715 38.714287 z"
- sodipodi:ry="9.8372450"
- sodipodi:rx="19.928572"
- sodipodi:cy="38.714287"
- sodipodi:cx="24.357143"
- id="path1538"
- style="color:#000000;fill:url(#radialGradient2308);fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:0.50000042;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-dashoffset:0.0000000;stroke-opacity:1.0000000;marker:none;marker-start:none;marker-mid:none;marker-end:none;visibility:visible;display:inline;overflow:visible"
- sodipodi:type="arc" />
- </g>
- <g
- id="layer1"
- inkscape:label="Layer 1"
- inkscape:groupmode="layer">
- <path
- inkscape:r_cy="true"
- inkscape:r_cx="true"
- style="opacity:1;color:#000000;fill:url(#linearGradient3773);fill-opacity:1;fill-rule:nonzero;stroke:#3f4561;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- d="M 22.699525,0.94746963 C 22.22635,0.97984519 21.766437,1.0531317 21.301673,1.1063165 L 21.269903,1.1063165 L 20.157975,7.1742671 C 18.345621,7.5870046 16.640562,8.2874574 15.106644,9.2392765 L 10.118853,5.6493371 C 8.770521,6.6961412 7.543552,7.9170049 6.465374,9.2392765 L 9.928236,14.290607 C 8.876814,15.89739 8.086153,17.732094 7.640841,19.659632 C 7.640765,19.668743 7.640779,19.689813 7.640841,19.691401 L 1.60466,20.644482 C 1.494303,21.545851 1.445813,22.477386 1.445813,23.408418 C 1.445813,24.170171 1.466846,24.921747 1.541121,25.664043 L 7.577303,26.744202 C 8.0066,28.840363 8.822112,30.797987 9.960006,32.526228 L 6.370066,37.450482 C 7.398201,38.726866 8.585171,39.888962 9.864698,40.913343 L 14.947798,37.418712 C 16.724273,38.551956 18.707343,39.346604 20.856901,39.737877 L 21.809983,45.742288 C 22.487237,45.803935 23.181758,45.805827 23.874992,45.805827 C 24.853677,45.805826 25.788512,45.768738 26.734236,45.64698 L 27.877933,39.515491 C 29.91886,39.007587 31.836112,38.126493 33.501113,36.942172 L 38.393596,40.500342 C 39.662366,39.420897 40.822583,38.180154 41.824689,36.846863 L 38.266519,31.700225 C 39.230125,30.036028 39.897817,28.199859 40.23622,26.235892 L 46.240632,25.282811 C 46.29329,24.656221 46.30417,24.048546 46.30417,23.408418 C 46.30417,22.296018 46.174875,21.205317 46.018246,20.136172 L 39.918526,19.024244 C 39.440518,17.259164 38.656214,15.612364 37.662901,14.13176 L 41.25284,9.2075071 C 40.140075,7.8466524 38.870718,6.5895264 37.472284,5.5222596 L 32.293876,9.0804296 C 30.805549,8.200202 29.203897,7.5248159 27.464931,7.1424978 L 26.51185,1.1063165 C 25.644369,1.0042729 24.769749,0.94746963 23.874992,0.94746963 C 23.633166,0.94746964 23.384286,0.93986063 23.144296,0.94746963 C 23.027301,0.95117908 22.911525,0.94066346 22.794833,0.94746963 C 22.763228,0.94931296 22.73107,0.94531125 22.699525,0.94746963 z M 23.525529,16.387386 C 23.641592,16.381497 23.757473,16.387386 23.874992,16.387386 C 27.635598,16.387386 30.705408,19.457196 30.705408,23.217802 C 30.705409,26.978407 27.635597,30.016448 23.874992,30.016448 C 20.114387,30.016449 17.076346,26.978407 17.076346,23.217802 C 17.076347,19.574716 19.927558,16.569963 23.525529,16.387386 z "
- id="path3243" />
- <path
- inkscape:r_cy="true"
- inkscape:r_cx="true"
- sodipodi:type="arc"
- style="opacity:0.64772728;color:#000000;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:1.62180054;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- id="path3283"
- sodipodi:cx="23.511301"
- sodipodi:cy="23.781593"
- sodipodi:rx="12.727922"
- sodipodi:ry="12.727922"
- d="M 36.239223 23.781593 A 12.727922 12.727922 0 1 1 10.783379,23.781593 A 12.727922 12.727922 0 1 1 36.239223 23.781593 z"
- transform="matrix(0.616598,0,0,0.616598,9.38202,8.539674)" />
- <path
- inkscape:r_cy="true"
- inkscape:r_cx="true"
- id="path3285"
- d="M 21.995808,2.1484671 L 21.103024,8.0235243 C 19.404254,8.4103946 16.279442,9.5936035 14.841657,10.485771 L 10.091975,6.9406268 C 8.828145,7.9218257 8.741474,7.9883656 7.730867,9.2277688 L 11.165063,14.320988 C 10.179537,15.827071 8.995796,18.510982 8.570778,20.42893 C 8.570778,20.42893 2.552988,21.443355 2.552988,21.443355 C 2.449547,22.288234 2.49926,24.096528 2.56888,24.792303 L 8.317097,25.82782 C 8.71949,27.79261 10.225324,30.955232 11.291904,32.575161 L 7.656902,37.377719 C 8.620601,38.57411 8.813474,38.683589 10.01281,39.64377 L 14.873441,36.082733 C 16.538581,37.144954 19.84373,38.437109 21.858571,38.80386 L 22.656299,44.604952 C 23.291109,44.662736 25.044829,44.824827 25.931283,44.710701 L 26.824066,38.671821 C 28.737084,38.195749 32.042539,36.838896 33.603191,35.728798 L 38.458624,39.236958 C 39.647878,38.225166 39.658533,38.072709 40.597835,36.822978 L 36.999815,31.708667 C 37.90303,30.148767 39.070902,27.098068 39.388097,25.257187 L 45.279046,24.279744 C 45.328399,23.692424 45.330802,22.054578 45.18399,21.052439 L 39.182092,20.016922 C 38.73404,18.362463 37.196418,15.381153 36.265359,13.993342 L 40.080075,9.1907857 C 39.037052,7.915218 38.64924,7.7402002 37.338448,6.7398212 L 32.313994,10.337839 C 30.918941,9.5127782 28.137095,8.2550417 26.507114,7.8966842 L 25.619528,2.1484671 C 24.806414,2.0528187 22.460488,2.0952921 21.995808,2.1484671 z "
- style="opacity:0.34659089;color:#000000;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:0.99999923;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- sodipodi:nodetypes="ccccccccccccccccccccccccccccccccc" />
- <path
- style="opacity:0.5;color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- d="M 10.102903,6.2970655 C 8.7545689,7.3438694 8.1656464,7.9719226 7.0874684,9.2941942 L 10.489927,14.259153 C 9.4385072,15.857755 8.3316275,18.426114 8.1423859,19.987706 C 8.1423859,19.987706 2.0798859,21.0319 2.0798859,21.0319 C 2.0109129,21.595256 1.90625,22.884803 1.90625,22.884803 L 2.0830267,24.447303 C 2.5107567,24.535638 2.9231817,24.617818 3.3642767,24.666053 L 3.8642767,23.134803 C 4.2083177,23.163279 4.5439297,23.197303 4.8955267,23.197303 C 5.2467347,23.197303 5.6139847,23.163473 5.9580267,23.134803 L 6.4267767,24.666053 C 6.8680647,24.617818 7.3115487,24.535638 7.7392767,24.447303 L 7.7392767,22.884803 C 8.4250337,22.72518 9.0712777,22.497045 9.7080267,22.228553 L 10.645527,23.509803 C 11.047878,23.327709 11.421123,23.133984 11.801777,22.916053 L 11.301777,21.416053 C 11.89901,21.053803 12.463529,20.620706 12.989277,20.166053 L 14.270527,21.103553 C 14.596162,20.806973 14.91164,20.491691 15.208027,20.166053 L 14.270527,18.916053 C 14.725373,18.390305 15.127027,17.826171 15.489277,17.228553 L 16.989277,17.697303 C 17.207208,17.316456 17.432571,16.943209 17.614277,16.541053 L 16.333027,15.603553 C 16.601517,14.966804 16.798016,14.320561 16.958027,13.634803 L 18.551777,13.634803 C 18.640112,13.207076 18.691236,12.763591 18.739277,12.322303 L 17.239277,11.853553 C 17.268139,11.509705 17.301777,11.142456 17.301777,10.791053 C 17.301776,10.43965 17.267753,10.104039 17.239277,9.7598034 L 18.739277,9.2910534 C 18.69373,8.8711662 18.633686,8.4490548 18.551777,8.0410534 C 17.404349,8.4403544 15.999117,9.1941729 14.983265,9.8245243 L 10.102903,6.2970655 z "
- id="path3767"
- inkscape:r_cx="true"
- inkscape:r_cy="true"
- sodipodi:nodetypes="cccccccccsccccccccccccccccccccsccccc" />
- <path
- style="opacity:0.5;color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- d="M 37.236641,17.217754 C 36.85286,17.39913 36.490003,17.603509 36.123236,17.813295 L 36.692886,19.548136 C 35.995792,19.970436 35.338156,20.467825 34.725008,20.998151 L 33.249099,19.910639 C 32.869013,20.256538 32.507327,20.618223 32.161588,20.998151 L 33.249099,22.474059 C 32.718773,23.087371 32.221547,23.745002 31.799084,24.441937 L 31.255328,24.260685 C 31.207646,24.960968 31.018949,25.62217 30.737466,26.228563 L 30.841038,26.306242 C 30.527881,27.048922 30.27649,27.83664 30.090137,28.636624 L 28.614229,28.636624 C 28.477946,28.722076 28.343676,28.821684 28.199938,28.895555 C 28.121568,29.310822 28.065026,29.712881 28.018687,30.138426 L 29.77942,30.708074 C 29.746033,31.10935 29.727633,31.515269 29.727633,31.925052 C 29.727631,32.334993 29.746034,32.740753 29.77942,33.142029 L 28.018687,33.711677 C 28.074705,34.226432 28.148678,34.740347 28.251725,35.239372 L 30.090137,35.213479 C 30.218255,35.763466 30.393202,36.320918 30.582107,36.844746 C 31.327023,36.557466 32.05594,36.214561 32.731236,35.809021 C 32.319649,34.59298 32.083908,33.279913 32.083908,31.925052 C 32.083909,26.727119 35.376289,22.288397 39.981313,20.583861 L 38.893802,20.402608 C 38.671014,19.579946 38.382478,18.774017 38.013435,18.020441 C 38.002581,17.998277 37.99851,17.96486 37.987542,17.942761 L 37.935756,17.890975 L 37.236641,17.217754 z "
- id="path3770"
- inkscape:r_cx="true"
- inkscape:r_cy="true" />
- </g>
-</svg>
diff --git a/source/images/boot.psd b/source/images/boot.psd
deleted file mode 100644
index fe168aa..0000000
--- a/source/images/boot.psd
+++ /dev/null
Binary files differ
diff --git a/source/images/catsfc.psd b/source/images/catsfc.psd
deleted file mode 100644
index 420bb03..0000000
--- a/source/images/catsfc.psd
+++ /dev/null
Binary files differ
diff --git a/source/images/hotkeys-preview.psd b/source/images/hotkeys-preview.psd
deleted file mode 100644
index a718ab9..0000000
--- a/source/images/hotkeys-preview.psd
+++ /dev/null
Binary files differ
diff --git a/source/images/interface-preview.psd b/source/images/interface-preview.psd
deleted file mode 100644
index ec26be0..0000000
--- a/source/images/interface-preview.psd
+++ /dev/null
Binary files differ
diff --git a/source/images/key.svg b/source/images/key.svg
deleted file mode 100644
index 0fc1678..0000000
--- a/source/images/key.svg
+++ /dev/null
@@ -1,111 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="210mm" height="297mm" id="svg2" version="1.1" inkscape:version="0.48.0 r9654">
- <defs id="defs4">
- <linearGradient inkscape:collect="always" id="linearGradient3813">
- <stop style="stop-color:#000000;stop-opacity:1;" offset="0" id="stop3815"/>
- <stop style="stop-color:#000000;stop-opacity:0;" offset="1" id="stop3817"/>
- </linearGradient>
- <linearGradient inkscape:collect="always" id="linearGradient3784">
- <stop style="stop-color:#000000;stop-opacity:1;" offset="0" id="stop3786"/>
- <stop style="stop-color:#000000;stop-opacity:0;" offset="1" id="stop3788"/>
- </linearGradient>
- <linearGradient inkscape:collect="always" id="linearGradient3774">
- <stop style="stop-color:#ffffff;stop-opacity:1;" offset="0" id="stop3776"/>
- <stop style="stop-color:#ffffff;stop-opacity:0;" offset="1" id="stop3778"/>
- </linearGradient>
- <linearGradient inkscape:collect="always" id="linearGradient3821">
- <stop style="stop-color:#ffffff;stop-opacity:1;" offset="0" id="stop3823"/>
- <stop style="stop-color:#ffffff;stop-opacity:0;" offset="1" id="stop3825"/>
- </linearGradient>
- <linearGradient inkscape:collect="always" id="linearGradient3809">
- <stop style="stop-color:#000000;stop-opacity:1;" offset="0" id="stop3811"/>
- <stop style="stop-color:#000000;stop-opacity:0;" offset="1" id="stop3813"/>
- </linearGradient>
- <linearGradient inkscape:collect="always" id="linearGradient3796">
- <stop style="stop-color:#000000;stop-opacity:1;" offset="0" id="stop3798"/>
- <stop style="stop-color:#000000;stop-opacity:0;" offset="1" id="stop3800"/>
- </linearGradient>
- <linearGradient inkscape:collect="always" xlink:href="#linearGradient3796" id="linearGradient3802" x1="491.42859" y1="533.79071" x2="397.14282" y2="612.36218" gradientUnits="userSpaceOnUse" gradientTransform="translate(-8.5714286,12.857143)"/>
- <linearGradient inkscape:collect="always" xlink:href="#linearGradient3809" id="linearGradient3817" x1="451.4375" y1="387.35266" x2="70" y2="264.49554" gradientUnits="userSpaceOnUse"/>
- <linearGradient inkscape:collect="always" xlink:href="#linearGradient3821" id="linearGradient3827" x1="291.02759" y1="456.15002" x2="559.2226" y2="784.44958" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.83333333,0,0,0.89559246,41.428572,48.08126)"/>
- <linearGradient inkscape:collect="always" xlink:href="#linearGradient3774" id="linearGradient3780" x1="154.54454" y1="316.20752" x2="339.69678" y2="375.80652" gradientUnits="userSpaceOnUse"/>
- <linearGradient inkscape:collect="always" xlink:href="#linearGradient3784" id="linearGradient3790" x1="310.11683" y1="619.51182" x2="492.95444" y2="619.51182" gradientUnits="userSpaceOnUse"/>
- <radialGradient inkscape:collect="always" xlink:href="#linearGradient3813" id="radialGradient3819" cx="162.63455" cy="473.54477" fx="162.63455" fy="473.54477" r="403.05087" gradientTransform="matrix(1,0,0,0.23308269,0,363.16968)" gradientUnits="userSpaceOnUse"/>
- <filter inkscape:collect="always" id="filter3821" x="-0.041358053" width="1.0827161" y="-0.1774394" height="1.3548788">
- <feGaussianBlur inkscape:collect="always" stdDeviation="13.891166" id="feGaussianBlur3823"/>
- </filter>
- <linearGradient inkscape:collect="always" xlink:href="#linearGradient3784" id="linearGradient5873" gradientUnits="userSpaceOnUse" x1="310.11683" y1="619.51182" x2="492.95444" y2="619.51182"/>
- <linearGradient inkscape:collect="always" xlink:href="#linearGradient3774" id="linearGradient5876" gradientUnits="userSpaceOnUse" x1="154.54454" y1="316.20752" x2="339.69678" y2="375.80652"/>
- <linearGradient inkscape:collect="always" xlink:href="#linearGradient3821" id="linearGradient5879" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.83333333,0,0,0.89559246,41.428572,48.08126)" x1="291.02759" y1="456.15002" x2="559.2226" y2="784.44958"/>
- <linearGradient inkscape:collect="always" xlink:href="#linearGradient3809" id="linearGradient5882" gradientUnits="userSpaceOnUse" x1="451.4375" y1="387.35266" x2="70" y2="264.49554"/>
- <linearGradient inkscape:collect="always" xlink:href="#linearGradient3796" id="linearGradient5885" gradientUnits="userSpaceOnUse" gradientTransform="translate(-8.5714286,12.857143)" x1="491.42859" y1="533.79071" x2="397.14282" y2="612.36218"/>
- </defs>
- <sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="0.35" inkscape:cx="183.47351" inkscape:cy="630.2247" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="false" showguides="true" inkscape:guide-bbox="true" inkscape:snap-global="false" inkscape:window-width="1271" inkscape:window-height="702" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="0">
- <sodipodi:guide orientation="0,1" position="-237.14286,948.57143" id="guide2987"/>
- <sodipodi:guide orientation="0,1" position="-182.85714,234.28571" id="guide2989"/>
- <sodipodi:guide orientation="1,0" position="11.428571,157.14286" id="guide2993"/>
- <sodipodi:guide orientation="1,0" position="725.71429,345.71429" id="guide2995"/>
- </sodipodi:namedview>
- <metadata id="metadata7">
- <rdf:RDF>
- <cc:Work rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
- <dc:title>key</dc:title>
- <dc:date>Mar 2011</dc:date>
- <dc:creator>
- <cc:Agent>
- <dc:title>Franziska Sponsel</dc:title>
- </cc:Agent>
- </dc:creator>
- <dc:rights>
- <cc:Agent>
- <dc:title>Franziska Sponsel</dc:title>
- </cc:Agent>
- </dc:rights>
- <dc:publisher>
- <cc:Agent>
- <dc:title>RRZE</dc:title>
- </cc:Agent>
- </dc:publisher>
- <dc:subject>
- <rdf:Bag>
- <rdf:li>key</rdf:li>
- <rdf:li>lock</rdf:li>
- <rdf:li>chain</rdf:li>
- <rdf:li>secure</rdf:li>
- <rdf:li>save</rdf:li>
- </rdf:Bag>
- </dc:subject>
- <dc:contributor>
- <cc:Agent>
- <dc:title>Beate Kaspar, Hendrik Eggers</dc:title>
- </cc:Agent>
- </dc:contributor>
- <cc:license rdf:resource="http://creativecommons.org/licenses/by-sa/3.0/"/>
- </cc:Work>
- <cc:License rdf:about="http://creativecommons.org/licenses/by-sa/3.0/">
- <cc:permits rdf:resource="http://creativecommons.org/ns#Reproduction"/>
- <cc:permits rdf:resource="http://creativecommons.org/ns#Distribution"/>
- <cc:requires rdf:resource="http://creativecommons.org/ns#Notice"/>
- <cc:requires rdf:resource="http://creativecommons.org/ns#Attribution"/>
- <cc:permits rdf:resource="http://creativecommons.org/ns#DerivativeWorks"/>
- <cc:requires rdf:resource="http://creativecommons.org/ns#ShareAlike"/>
- </cc:License>
- </rdf:RDF>
- </metadata>
- <g inkscape:label="Ebene 1" inkscape:groupmode="layer" id="layer1">
- <g id="g6659">
- <path transform="matrix(0.78703889,0,0,0.50001477,250.80749,512.53703)" d="m 565.68542,473.54477 a 403.05087,93.944183 0 1 1 -806.10174,0 403.05087,93.944183 0 1 1 806.10174,0 z" sodipodi:ry="93.944183" sodipodi:rx="403.05087" sodipodi:cy="473.54477" sodipodi:cx="162.63455" id="path3811" style="opacity:0.67295598;fill:url(#radialGradient3819);fill-opacity:1;stroke:none;filter:url(#filter3821)" sodipodi:type="arc"/>
- <rect y="103.79076" x="11.428572" height="714.28571" width="714.28571" id="rect2985" style="fill:none;stroke:none"/>
- <path sodipodi:nodetypes="ssscccccccccccccccccccccsssssss" inkscape:connector-curvature="0" id="path3765" d="m 240,189.5 c -88.36556,0 -160,71.63444 -160,160 0,74.01072 51.08528,133.42284 118.49765,154.56619 28.76063,9.02054 65.10031,3.78277 68.69777,4.48537 l -18.56502,21.66877 27.05314,3.51253 -10.31899,28.23625 44.73064,0.86845 -17.84433,26.01022 39.2217,-4.21803 -5.11585,27.44772 28.42454,-6.4704 17.77455,40.78089 37.64027,23.35189 -28.57265,31.19477 c 2.02311,1.37812 44.72926,6.83324 44.72926,6.83324 l -0.24554,28.95536 21.34376,14.22767 30.60714,3.37947 57.55357,-33.66518 0.25,-46.66072 -112.44643,-175.66964 -3.75893,-37.17411 -35.42857,-33.07589 C 387.0643,416.159 401.42857,396.57961 400,349.5 c -2.68011,-88.32491 -71.63444,-160 -160,-160 z m -24.28125,75.71875 c 23.66935,0 42.84375,19.1744 42.84375,42.84375 0,23.66935 -19.1744,42.875 -42.84375,42.875 -23.66935,0 -42.875,-19.20565 -42.875,-42.875 0,-23.66935 19.20565,-42.84375 42.875,-42.84375 z" style="fill:#c4a000;stroke:#000000;stroke-width:13;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"/>
- <path sodipodi:nodetypes="ccccccc" inkscape:connector-curvature="0" id="path3792" d="M 351.42857,468.07647 368.57142,500.93361 490,685.21932 514.28571,713.79075 507.14285,682.36218 382.85714,488.07646 z" style="fill:#ffffff;fill-opacity:1;stroke:none;opacity:0.59433962"/>
- <path style="opacity:0.66465411;fill:url(#linearGradient5885);fill-opacity:1;stroke:none" d="m 351.42858,468.07647 17.14285,32.85714 121.42858,184.28571 24.28571,28.57143 -15.22408,-29.91334 -121.76033,-187.21465 z" id="path3794" inkscape:connector-curvature="0" sodipodi:nodetypes="ccccccc"/>
- <path id="path3804" d="m 240.71875,209.5 c -76.92538,0 -139.28125,62.35587 -139.28125,139.28125 0,76.92538 62.35587,139.28125 139.28125,139.28125 C 317.64413,488.0625 380,425.70663 380,348.78125 380,271.85587 317.64413,209.5 240.71875,209.5 z m -26.4375,58.5625 c 21.30241,0 38.5625,17.29134 38.5625,38.59375 0,21.30241 -17.26009,38.5625 -38.5625,38.5625 -21.30241,0 -38.5625,-17.26009 -38.5625,-38.5625 0,-21.30241 17.26009,-38.59375 38.5625,-38.59375 z" style="opacity:0.61320759;fill:url(#linearGradient5882);fill-opacity:1;stroke:none" inkscape:connector-curvature="0"/>
- <path sodipodi:nodetypes="cccccc" inkscape:connector-curvature="0" id="path3819" d="m 248.57143,495.43421 c 30.96868,0.78722 47.28356,9.8516 87.07517,-24.91902 l 162.92482,249.68882 -14.88154,11.71002 C 434.27974,660.85127 361.25763,568.58045 309.22589,502.82691 c -30.07132,13.01986 -37.53909,-0.11886 -60.65446,-7.3927 z" style="opacity:0.7295598;fill:url(#linearGradient5879);fill-opacity:1;stroke:none"/>
- <path sodipodi:nodetypes="czczc" inkscape:connector-curvature="0" id="path3772" d="m 164.65486,306.86961 c 0,0 10.21318,55.82918 60.60915,48.48731 50.39597,-7.34186 37.37565,-70.71067 37.37565,-70.71067 0,0 23.33506,78.18103 -38.3858,84.85282 -61.72087,6.67179 -59.599,-62.62946 -59.599,-62.62946 z" style="opacity:0.59748427;fill:url(#linearGradient5876);fill-opacity:1;stroke:none"/>
- <path sodipodi:nodetypes="cccccc" inkscape:connector-curvature="0" id="path3782" d="m 310.11683,504.8595 6.06092,36.36549 139.40105,174.7564 27.27412,18.18274 3.03045,-4.04061 z" style="opacity:0.5251572;fill:url(#linearGradient5873);fill-opacity:1;stroke:none"/>
- </g>
- </g>
-</svg>
diff --git a/source/images/manage.svg b/source/images/manage.svg
deleted file mode 100644
index 063dd65..0000000
--- a/source/images/manage.svg
+++ /dev/null
@@ -1,391 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" height="297mm" id="svg2" inkscape:export-xdpi="76.235291" inkscape:export-ydpi="76.235291" inkscape:output_extension="org.inkscape.output.svg.inkscape" inkscape:version="0.48.0 r9654" sodipodi:version="0.32" width="290mm" version="1.1">
- <title id="title12945">manage</title>
- <defs id="defs4">
- <inkscape:perspective id="perspective14608" inkscape:persp3d-origin="372.04724 : 350.78739 : 1" inkscape:vp_x="0 : 526.18109 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_z="744.09448 : 526.18109 : 1" sodipodi:type="inkscape:persp3d"/>
- <linearGradient id="linearGradient2265">
- <stop id="stop2267" offset="0" style="stop-color:#000000;stop-opacity:1;"/>
- <stop id="stop2269" offset="1" style="stop-color:#000000;stop-opacity:0;"/>
- </linearGradient>
- <linearGradient gradientTransform="matrix(0.878099,-1.73237e-2,1.73237e-2,0.878099,1021.3138,469.27875)" gradientUnits="userSpaceOnUse" id="linearGradient2271" inkscape:collect="always" x1="14.017542" x2="15.415793" xlink:href="#linearGradient2265" y1="36.942543" y2="38.268368"/>
- <linearGradient id="linearGradient2257" inkscape:collect="always">
- <stop id="stop2259" offset="0" style="stop-color:#ffffff;stop-opacity:1;"/>
- <stop id="stop2261" offset="1" style="stop-color:#ffffff;stop-opacity:0;"/>
- </linearGradient>
- <linearGradient gradientTransform="matrix(1.007254,-2.636526e-2,2.636526e-2,1.007254,1020.7435,465.29004)" gradientUnits="userSpaceOnUse" id="linearGradient2263" inkscape:collect="always" x1="12.004697" x2="10.650805" xlink:href="#linearGradient2257" y1="35.688461" y2="33.194965"/>
- <linearGradient id="linearGradient3087">
- <stop id="stop3089" offset="0" style="stop-color:#3465a4;stop-opacity:1;"/>
- <stop id="stop3095" offset="0" style="stop-color:#729fcf;stop-opacity:1;"/>
- <stop id="stop2242" offset="0" style="stop-color:#3465a4;stop-opacity:1;"/>
- <stop id="stop2244" offset="0.75" style="stop-color:#729fcf;stop-opacity:1;"/>
- <stop id="stop3091" offset="1" style="stop-color:#386eb4;stop-opacity:1;"/>
- </linearGradient>
- <linearGradient gradientTransform="matrix(0.87827,0,0,0.87827,1021.6871,470.17853)" gradientUnits="userSpaceOnUse" id="linearGradient3093" inkscape:collect="always" x1="9.7503242" x2="16.915297" xlink:href="#linearGradient3087" y1="32.28376" y2="39.443218"/>
- <linearGradient id="linearGradient2250" inkscape:collect="always">
- <stop id="stop2252" offset="0" style="stop-color:#ffffff;stop-opacity:1;"/>
- <stop id="stop2254" offset="1" style="stop-color:#ffffff;stop-opacity:0;"/>
- </linearGradient>
- <linearGradient gradientTransform="translate(1019.1501,465.21085)" gradientUnits="userSpaceOnUse" id="linearGradient2256" inkscape:collect="always" x1="31.177404" x2="40.859177" xlink:href="#linearGradient2250" y1="19.821514" y2="9.6568537"/>
- <linearGradient id="linearGradient3077">
- <stop id="stop3079" offset="0" style="stop-color:#888a85;stop-opacity:1;"/>
- <stop id="stop3081" offset="1" style="stop-color:#d3d7cf;stop-opacity:1;"/>
- </linearGradient>
- <linearGradient gradientTransform="matrix(0.87827,0,0,0.87827,1021.9976,470.79956)" gradientUnits="userSpaceOnUse" id="linearGradient3083" inkscape:collect="always" x1="38.227654" x2="37.53537" xlink:href="#linearGradient3077" y1="13.602527" y2="6.6285896"/>
- <linearGradient id="linearGradient3061">
- <stop id="stop3063" offset="0" style="stop-color:#ffffff;stop-opacity:1;"/>
- <stop id="stop3065" offset="1" style="stop-color:#000000;stop-opacity:1;"/>
- </linearGradient>
- <linearGradient gradientTransform="matrix(0.8782699,0,0,0.8782699,1049.7965,-403.53398)" gradientUnits="userSpaceOnUse" id="linearGradient3067" inkscape:collect="always" x1="50.152931" x2="25.291086" xlink:href="#linearGradient3061" y1="-3.6324477" y2="-4.3002653"/>
- <linearGradient id="linearGradient3049">
- <stop id="stop3051" offset="0" style="stop-color:#888a85;stop-opacity:1;"/>
- <stop id="stop2262" offset="0.5" style="stop-color:#d3d7cf;stop-opacity:1;"/>
- <stop id="stop2264" offset="0.67612958" style="stop-color:#eeeeec;stop-opacity:1;"/>
- <stop id="stop2268" offset="0.84051722" style="stop-color:#babdb6;stop-opacity:1;"/>
- <stop id="stop2266" offset="0.875" style="stop-color:#d3d7cf;stop-opacity:1;"/>
- <stop id="stop3053" offset="1" style="stop-color:#babdb6;stop-opacity:1;"/>
- </linearGradient>
- <linearGradient gradientTransform="matrix(0.87827,0,0,0.87827,1021.6871,470.17853)" gradientUnits="userSpaceOnUse" id="linearGradient3055" inkscape:collect="always" x1="19.648342" x2="20.631224" xlink:href="#linearGradient3049" y1="42.253601" y2="6.7758031"/>
- <radialGradient cx="24.8125" cy="39.125" fx="24.8125" fy="39.125" gradientTransform="matrix(1,0,0,0.374558,0,24.47041)" gradientUnits="userSpaceOnUse" id="radialGradient3047" inkscape:collect="always" r="17.6875" xlink:href="#linearGradient3041"/>
- <linearGradient id="linearGradient3041" inkscape:collect="always">
- <stop id="stop3043" offset="0" style="stop-color:#000000;stop-opacity:1;"/>
- <stop id="stop3045" offset="1" style="stop-color:#000000;stop-opacity:0;"/>
- </linearGradient>
- <radialGradient cx="24.8125" cy="39.125" fx="24.8125" fy="39.125" gradientTransform="matrix(1,0,0,0.374558,0,24.47041)" gradientUnits="userSpaceOnUse" id="radialGradient2260" inkscape:collect="always" r="17.6875" xlink:href="#linearGradient3041"/>
- <linearGradient gradientTransform="translate(131.91072,132.23618)" gradientUnits="userSpaceOnUse" id="SVGID_1_" x1="43.944302" x2="411.3941" y1="733.39258" y2="425.06561">
- <stop id="stop2170" offset="0.0562" style="stop-color:#003F90"/>
- <stop id="stop2172" offset="0.5674" style="stop-color:#0093D2"/>
- <stop id="stop2174" offset="0.9551" style="stop-color:#EDF3F7"/>
- </linearGradient>
- <linearGradient gradientTransform="matrix(0.9169564,0,0,0.9120098,60.201795,153.71221)" gradientUnits="userSpaceOnUse" id="SVGID_2_" x1="43.943802" x2="411.39359" y1="733.39258" y2="425.06561">
- <stop id="stop2179" offset="0.0562" style="stop-color:#2e3436;stop-opacity:1;"/>
- <stop id="stop2181" offset="0.56739998" style="stop-color:#888a85;stop-opacity:1;"/>
- <stop id="stop2183" offset="0.9551" style="stop-color:#d3d7cf;stop-opacity:1;"/>
- </linearGradient>
- <radialGradient cx="605.71429" cy="486.64789" fx="605.71429" fy="486.64789" gradientTransform="matrix(-2.774389,0,0,1.969706,112.7623,-872.8854)" gradientUnits="userSpaceOnUse" id="radialGradient5020" inkscape:collect="always" r="117.14286" xlink:href="#linearGradient5060"/>
- <linearGradient gradientTransform="matrix(2.774389,0,0,1.969706,-1892.179,-872.8854)" gradientUnits="userSpaceOnUse" id="linearGradient5016" inkscape:collect="always" x1="302.85715" x2="302.85715" xlink:href="#linearGradient5048" y1="366.64789" y2="609.50507"/>
- <radialGradient cx="605.71429" cy="486.64789" fx="605.71429" fy="486.64789" gradientTransform="matrix(2.774389,0,0,1.969706,-1891.633,-872.8854)" gradientUnits="userSpaceOnUse" id="radialGradient5013" inkscape:collect="always" r="117.14286" xlink:href="#linearGradient5060"/>
- <linearGradient id="linearGradient2795">
- <stop id="stop2797" offset="0.0000000" style="stop-color:#000000;stop-opacity:0.068627454;"/>
- <stop id="stop2799" offset="1.0000000" style="stop-color:#ffffff;stop-opacity:1.0000000;"/>
- </linearGradient>
- <linearGradient id="linearGradient2803">
- <stop id="stop2805" offset="0" style="stop-color:#ffffff;stop-opacity:1;"/>
- <stop id="stop2807" offset="1.0000000" style="stop-color:#cbcbcb;stop-opacity:1.0000000;"/>
- </linearGradient>
- <linearGradient id="linearGradient2094">
- <stop id="stop2096" offset="0.0000000" style="stop-color:#d6e3f0;stop-opacity:1.0000000;"/>
- <stop id="stop2098" offset="1.0000000" style="stop-color:#95b1cf;stop-opacity:1.0000000;"/>
- </linearGradient>
- <linearGradient id="linearGradient12512">
- <stop id="stop12513" offset="0.0000000" style="stop-color:#ffffff;stop-opacity:1.0000000;"/>
- <stop id="stop12517" offset="0.50000000" style="stop-color:#fff520;stop-opacity:0.89108908;"/>
- <stop id="stop12514" offset="1.0000000" style="stop-color:#fff300;stop-opacity:0.0000000;"/>
- </linearGradient>
- <linearGradient id="linearGradient5048">
- <stop id="stop5050" offset="0" style="stop-color:black;stop-opacity:0;"/>
- <stop id="stop5056" offset="0.5" style="stop-color:black;stop-opacity:1;"/>
- <stop id="stop5052" offset="1" style="stop-color:black;stop-opacity:0;"/>
- </linearGradient>
- <linearGradient id="linearGradient5060" inkscape:collect="always">
- <stop id="stop5062" offset="0" style="stop-color:black;stop-opacity:1;"/>
- <stop id="stop5064" offset="1" style="stop-color:black;stop-opacity:0;"/>
- </linearGradient>
- <linearGradient id="linearGradient2994">
- <stop id="stop2996" offset="0" style="stop-color:#000000;stop-opacity:1;"/>
- <stop id="stop2998" offset="1" style="stop-color:#c9c9c9;stop-opacity:1;"/>
- </linearGradient>
- <linearGradient id="linearGradient2974">
- <stop id="stop2976" offset="0" style="stop-color:#c1c1c1;stop-opacity:1;"/>
- <stop id="stop2978" offset="1" style="stop-color:#acacac;stop-opacity:1;"/>
- </linearGradient>
- <linearGradient id="linearGradient2966">
- <stop id="stop2968" offset="0" style="stop-color:#ffd1d1;stop-opacity:1;"/>
- <stop id="stop3006" offset="0.5" style="stop-color:#ff1d1d;stop-opacity:1;"/>
- <stop id="stop2970" offset="1" style="stop-color:#6f0000;stop-opacity:1;"/>
- </linearGradient>
- <linearGradient id="linearGradient2846">
- <stop id="stop2848" offset="0.0000000" style="stop-color:#8a8a8a;stop-opacity:1.0000000;"/>
- <stop id="stop2850" offset="1.0000000" style="stop-color:#484848;stop-opacity:1.0000000;"/>
- </linearGradient>
- <linearGradient id="linearGradient2366">
- <stop id="stop2368" offset="0" style="stop-color:#ffffff;stop-opacity:1;"/>
- <stop id="stop2374" offset="0.50000000" style="stop-color:#ffffff;stop-opacity:0.21904762;"/>
- <stop id="stop2370" offset="1.0000000" style="stop-color:#ffffff;stop-opacity:1.0000000;"/>
- </linearGradient>
- <linearGradient id="linearGradient4467">
- <stop id="stop4469" offset="0" style="stop-color:#ffffff;stop-opacity:1;"/>
- <stop id="stop4471" offset="1.0000000" style="stop-color:#ffffff;stop-opacity:0.24761905;"/>
- </linearGradient>
- <linearGradient id="linearGradient4454">
- <stop id="stop4456" offset="0.0000000" style="stop-color:#729fcf;stop-opacity:0.20784314;"/>
- <stop id="stop4458" offset="1.0000000" style="stop-color:#729fcf;stop-opacity:0.67619050;"/>
- </linearGradient>
- <linearGradient id="linearGradient4440">
- <stop id="stop4442" offset="0" style="stop-color:#7d7d7d;stop-opacity:1;"/>
- <stop id="stop4448" offset="0.50000000" style="stop-color:#b1b1b1;stop-opacity:1.0000000;"/>
- <stop id="stop4444" offset="1.0000000" style="stop-color:#686868;stop-opacity:1.0000000;"/>
- </linearGradient>
- <radialGradient cx="24.306795" cy="42.07798" fx="24.306795" fy="42.07798" gradientTransform="matrix(1.000000,0.000000,0.000000,0.284916,0.000000,30.08928)" gradientUnits="userSpaceOnUse" id="radialGradient4548" inkscape:collect="always" r="15.821514" xlink:href="#linearGradient4542"/>
- <linearGradient id="linearGradient259">
- <stop id="stop260" offset="0.0000000" style="stop-color:#fafafa;stop-opacity:1.0000000;"/>
- <stop id="stop261" offset="1.0000000" style="stop-color:#bbbbbb;stop-opacity:1.0000000;"/>
- </linearGradient>
- <linearGradient id="linearGradient269">
- <stop id="stop270" offset="0.0000000" style="stop-color:#a3a3a3;stop-opacity:1.0000000;"/>
- <stop id="stop271" offset="1.0000000" style="stop-color:#4c4c4c;stop-opacity:1.0000000;"/>
- </linearGradient>
- <radialGradient cx="20.8921" cy="114.5684" fx="20.8921" fy="114.5684" gradientUnits="userSpaceOnUse" id="aigrd2" r="5.256">
- <stop id="stop15566" offset="0" style="stop-color:#F0F0F0"/>
- <stop id="stop15568" offset="1.0000000" style="stop-color:#9a9a9a;stop-opacity:1.0000000;"/>
- </radialGradient>
- <radialGradient cx="20.8921" cy="64.5679" fx="20.8921" fy="64.5679" gradientUnits="userSpaceOnUse" id="aigrd3" r="5.257">
- <stop id="stop15573" offset="0" style="stop-color:#F0F0F0"/>
- <stop id="stop15575" offset="1.0000000" style="stop-color:#9a9a9a;stop-opacity:1.0000000;"/>
- </radialGradient>
- <linearGradient id="linearGradient15662">
- <stop id="stop15664" offset="0.0000000" style="stop-color:#ffffff;stop-opacity:1.0000000;"/>
- <stop id="stop15666" offset="1.0000000" style="stop-color:#f8f8f8;stop-opacity:1.0000000;"/>
- </linearGradient>
- <linearGradient id="linearGradient4542" inkscape:collect="always">
- <stop id="stop4544" offset="0" style="stop-color:#000000;stop-opacity:1;"/>
- <stop id="stop4546" offset="1" style="stop-color:#000000;stop-opacity:0;"/>
- </linearGradient>
- <linearGradient gradientTransform="matrix(2.774389,0,0,1.969706,-1892.179,-872.8854)" gradientUnits="userSpaceOnUse" id="linearGradient2659" inkscape:collect="always" x1="302.85715" x2="302.85715" xlink:href="#linearGradient5048" y1="366.64789" y2="609.50507"/>
- <linearGradient id="linearGradient2651">
- <stop id="stop2653" offset="0" style="stop-color:black;stop-opacity:0;"/>
- <stop id="stop2655" offset="0.5" style="stop-color:black;stop-opacity:1;"/>
- <stop id="stop2657" offset="1" style="stop-color:black;stop-opacity:0;"/>
- </linearGradient>
- <radialGradient cx="605.71429" cy="486.64789" fx="605.71429" fy="486.64789" gradientTransform="matrix(2.774389,0,0,1.969706,-1891.633,-872.8854)" gradientUnits="userSpaceOnUse" id="radialGradient2649" inkscape:collect="always" r="117.14286" xlink:href="#linearGradient5060"/>
- <radialGradient cx="605.71429" cy="486.64789" fx="605.71429" fy="486.64789" gradientTransform="matrix(-2.774389,0,0,1.969706,112.7623,-872.8854)" gradientUnits="userSpaceOnUse" id="radialGradient2641" inkscape:collect="always" r="117.14286" xlink:href="#linearGradient5060"/>
- <linearGradient gradientUnits="userSpaceOnUse" id="linearGradient2408" inkscape:collect="always" x1="18.935766" x2="53.588622" xlink:href="#linearGradient2402" y1="23.667896" y2="26.649362"/>
- <linearGradient gradientUnits="userSpaceOnUse" id="linearGradient2386" inkscape:collect="always" x1="62.513836" x2="15.984863" xlink:href="#linearGradient2380" y1="36.061237" y2="20.60858"/>
- <linearGradient gradientUnits="userSpaceOnUse" id="linearGradient1501" inkscape:collect="always" x1="46.834816" x2="45.380436" xlink:href="#linearGradient2871" y1="45.264122" y2="50.939667"/>
- <linearGradient id="linearGradient2831">
- <stop id="stop2833" offset="0" style="stop-color:#1d5e23;stop-opacity:1;"/>
- <stop id="stop2855" offset="0.33333334" style="stop-color:#329652;stop-opacity:1;"/>
- <stop id="stop2835" offset="1" style="stop-color:#83d8ab;stop-opacity:0;"/>
- </linearGradient>
- <linearGradient id="linearGradient2871" inkscape:collect="always">
- <stop id="stop2873" offset="0" style="stop-color:#3465a4;stop-opacity:1;"/>
- <stop id="stop2875" offset="1" style="stop-color:#3465a4;stop-opacity:1"/>
- </linearGradient>
- <linearGradient id="linearGradient2380">
- <stop id="stop2382" offset="0" style="stop-color:#b9e7c9;stop-opacity:1;"/>
- <stop id="stop2384" offset="1" style="stop-color:#72cf79;stop-opacity:1;"/>
- </linearGradient>
- <linearGradient id="linearGradient2402">
- <stop id="stop2404" offset="0" style="stop-color:#72cf7b;stop-opacity:1;"/>
- <stop id="stop2406" offset="1" style="stop-color:#57c552;stop-opacity:1;"/>
- </linearGradient>
- <linearGradient id="linearGradient2682">
- <stop id="stop2684" offset="0" style="stop-color:#3977c3;stop-opacity:1;"/>
- <stop id="stop2686" offset="1" style="stop-color:#89aedc;stop-opacity:0;"/>
- </linearGradient>
- <linearGradient id="linearGradient2690">
- <stop id="stop2692" offset="0" style="stop-color:#57be6f;stop-opacity:1;"/>
- <stop id="stop2694" offset="1" style="stop-color:#c4ebca;stop-opacity:0;"/>
- </linearGradient>
- <linearGradient gradientUnits="userSpaceOnUse" id="linearGradient5903" inkscape:collect="always" x1="62.513836" x2="15.984863" xlink:href="#linearGradient2380" y1="36.061237" y2="20.60858"/>
- <linearGradient gradientTransform="matrix(-6.0935847,-5.1483414,-5.1483414,6.0935847,846.16404,624.52042)" gradientUnits="userSpaceOnUse" id="linearGradient5908" inkscape:collect="always" x1="62.513836" x2="15.984863" xlink:href="#linearGradient2380" y1="36.061237" y2="20.60858"/>
- <linearGradient gradientUnits="userSpaceOnUse" id="linearGradient7848" inkscape:collect="always" x1="18.935766" x2="53.588622" xlink:href="#linearGradient2402" y1="23.667896" y2="26.649362"/>
- <linearGradient gradientUnits="userSpaceOnUse" id="linearGradient7850" inkscape:collect="always" x1="46.834816" x2="45.380436" xlink:href="#linearGradient2871" y1="45.264122" y2="50.939667"/>
- <linearGradient gradientTransform="matrix(-0.493304,-0.716654,0.716654,-0.493304,-9.26781,79.4192)" gradientUnits="userSpaceOnUse" id="linearGradient9972" inkscape:collect="always" x1="28.244684" x2="28.244684" xlink:href="#linearGradient9910" y1="60.445503" y2="68.224884"/>
- <linearGradient gradientTransform="matrix(-0.493304,-0.716654,0.716654,-0.493304,-9.26781,79.4192)" gradientUnits="userSpaceOnUse" id="linearGradient9968" inkscape:collect="always" x1="28.244684" x2="28.244684" xlink:href="#linearGradient9920" y1="60.445503" y2="68.224884"/>
- <linearGradient gradientTransform="matrix(-0.493304,-0.716654,0.716654,-0.493304,-9.26781,79.4192)" gradientUnits="userSpaceOnUse" id="linearGradient9965" inkscape:collect="always" x1="28.244684" x2="28.244684" xlink:href="#linearGradient9910" y1="60.445503" y2="68.224884"/>
- <linearGradient gradientTransform="matrix(-0.493304,-0.716654,0.716654,-0.493304,-9.26781,79.4192)" gradientUnits="userSpaceOnUse" id="linearGradient9961" inkscape:collect="always" x1="55.876038" x2="38.061356" xlink:href="#linearGradient9952" y1="62.401989" y2="62.827091"/>
- <linearGradient gradientUnits="userSpaceOnUse" id="linearGradient6401" inkscape:collect="always" x1="20.064156" x2="20.682873" xlink:href="#linearGradient6395" y1="27.140348" y2="44.110912"/>
- <radialGradient cx="23.25" cy="37.75" fx="23.25" fy="37.75" gradientTransform="matrix(1,0,0,0.420168,0,21.88866)" gradientUnits="userSpaceOnUse" id="radialGradient6353" inkscape:collect="always" r="14.875" xlink:href="#linearGradient5048"/>
- <linearGradient gradientTransform="matrix(5.259571e-3,0.999987,0.999987,-5.259571e-3,48.6929,-14.14491)" gradientUnits="userSpaceOnUse" id="linearGradient6349" inkscape:collect="always" x1="25.71875" x2="25.514589" xlink:href="#linearGradient2994" y1="31.046875" y2="30.703125"/>
- <radialGradient cx="29.053354" cy="27.640751" fx="29.053354" fy="27.640751" gradientTransform="matrix(1.53767e-2,2.923527,2.029691,-1.067544e-2,20.39098,-69.72665)" gradientUnits="userSpaceOnUse" id="radialGradient6347" inkscape:collect="always" r="3.2408545" xlink:href="#linearGradient2984"/>
- <linearGradient gradientTransform="matrix(5.259571e-3,0.999987,0.999987,-5.259571e-3,42.99552,-2.496241)" gradientUnits="userSpaceOnUse" id="linearGradient6345" inkscape:collect="always" x1="46" x2="47.6875" xlink:href="#linearGradient2974" y1="19.8125" y2="22.625"/>
- <linearGradient gradientTransform="matrix(5.259571e-3,0.999987,0.999987,-5.259571e-3,42.9955,-2.496241)" gradientUnits="userSpaceOnUse" id="linearGradient6343" inkscape:collect="always" x1="48.90625" x2="50.988335" xlink:href="#linearGradient2966" y1="17.376184" y2="22.250591"/>
- <linearGradient gradientUnits="userSpaceOnUse" id="linearGradient5074" inkscape:collect="always" x1="11.75" x2="37.625" xlink:href="#linearGradient5068" y1="14.1875" y2="14.1875"/>
- <linearGradient gradientTransform="translate(0,5.625)" gradientUnits="userSpaceOnUse" id="linearGradient5064" inkscape:collect="always" x1="30.875" x2="15.625" xlink:href="#linearGradient5058" y1="19.4596" y2="19.0846"/>
- <radialGradient cx="23.25" cy="37.75" fx="23.25" fy="37.75" gradientTransform="matrix(1,0,0,0.420168,0,21.88866)" gradientUnits="userSpaceOnUse" id="radialGradient5054" inkscape:collect="always" r="14.875" xlink:href="#linearGradient5048"/>
- <linearGradient gradientTransform="translate(0,5.625)" gradientUnits="userSpaceOnUse" id="linearGradient5042" inkscape:collect="always" x1="15.375" x2="34.250416" xlink:href="#linearGradient5036" y1="26.0846" y2="26.0846"/>
- <linearGradient id="linearGradient5036">
- <stop id="stop5038" offset="0" style="stop-color:#f5f5f5;stop-opacity:0.09;"/>
- <stop id="stop5044" offset="0.2631579" style="stop-color:#ffffff;stop-opacity:0.89999998;"/>
- <stop id="stop5088" offset="0.74792242" style="stop-color:#c7c7c7;stop-opacity:0.46000001;"/>
- <stop id="stop5040" offset="1" style="stop-color:#ffffff;stop-opacity:0.78039217;"/>
- </linearGradient>
- <linearGradient id="linearGradient5058">
- <stop id="stop5060" offset="0" style="stop-color:#959791;stop-opacity:1;"/>
- <stop id="stop5066" offset="0.5" style="stop-color:#f8f8f8;stop-opacity:1;"/>
- <stop id="stop3430" offset="1" style="stop-color:#8c8c8c;stop-opacity:1;"/>
- </linearGradient>
- <linearGradient id="linearGradient5068">
- <stop id="stop5070" offset="0" style="stop-color:#ffffff;stop-opacity:1;"/>
- <stop id="stop5078" offset="0.32894737" style="stop-color:#ffffff;stop-opacity:0.69;"/>
- <stop id="stop5076" offset="0.65789473" style="stop-color:#c2c2c2;stop-opacity:0.34;"/>
- <stop id="stop5072" offset="1" style="stop-color:#ffffff;stop-opacity:0;"/>
- </linearGradient>
- <linearGradient id="linearGradient3414">
- <stop id="stop3416" offset="0" style="stop-color:#ffd1d1;stop-opacity:1;"/>
- <stop id="stop3418" offset="0.5" style="stop-color:#ff1d1d;stop-opacity:1;"/>
- <stop id="stop3420" offset="1" style="stop-color:#6f0000;stop-opacity:1;"/>
- </linearGradient>
- <linearGradient id="linearGradient3408">
- <stop id="stop3410" offset="0" style="stop-color:#c1c1c1;stop-opacity:1;"/>
- <stop id="stop3412" offset="1" style="stop-color:#acacac;stop-opacity:1;"/>
- </linearGradient>
- <linearGradient id="linearGradient2984" inkscape:collect="always">
- <stop id="stop2986" offset="0" style="stop-color:#e7e2b8;stop-opacity:1;"/>
- <stop id="stop2988" offset="1" style="stop-color:#e7e2b8;stop-opacity:0;"/>
- </linearGradient>
- <linearGradient id="linearGradient3399">
- <stop id="stop3401" offset="0" style="stop-color:#000000;stop-opacity:1;"/>
- <stop id="stop3403" offset="1" style="stop-color:#c9c9c9;stop-opacity:1;"/>
- </linearGradient>
- <linearGradient id="linearGradient6395" inkscape:collect="always">
- <stop id="stop6397" offset="0" style="stop-color:#ffffff;stop-opacity:1;"/>
- <stop id="stop6399" offset="1" style="stop-color:#ffffff;stop-opacity:0;"/>
- </linearGradient>
- <linearGradient id="linearGradient9910">
- <stop id="stop9912" offset="0" style="stop-color:#729fcf;stop-opacity:1;"/>
- <stop id="stop9918" offset="0.31578946" style="stop-color:#a5bfda;stop-opacity:1;"/>
- <stop id="stop9914" offset="1" style="stop-color:#376ca4;stop-opacity:1;"/>
- </linearGradient>
- <linearGradient id="linearGradient9920">
- <stop id="stop9922" offset="0" style="stop-color:#5b90c8;stop-opacity:1;"/>
- <stop id="stop9924" offset="0.31578946" style="stop-color:#8fb0d1;stop-opacity:1;"/>
- <stop id="stop9926" offset="1" style="stop-color:#34679d;stop-opacity:1;"/>
- </linearGradient>
- <linearGradient id="linearGradient9952" inkscape:collect="always">
- <stop id="stop9954" offset="0" style="stop-color:#ffffff;stop-opacity:1;"/>
- <stop id="stop9956" offset="1" style="stop-color:#ffffff;stop-opacity:0;"/>
- </linearGradient>
- <radialGradient cx="24.8125" cy="39.125" fx="24.8125" fy="39.125" gradientTransform="matrix(1,0,0,0.374558,0,24.47041)" gradientUnits="userSpaceOnUse" id="radialGradient2746" inkscape:collect="always" r="17.6875" xlink:href="#linearGradient3041"/>
- <radialGradient cx="24.8125" cy="39.125" fx="24.8125" fy="39.125" gradientTransform="matrix(1,0,0,0.374558,0,24.47041)" gradientUnits="userSpaceOnUse" id="radialGradient2748" inkscape:collect="always" r="17.6875" xlink:href="#linearGradient3041"/>
- <linearGradient gradientTransform="matrix(0.87827,0,0,0.87827,1021.6871,470.17853)" gradientUnits="userSpaceOnUse" id="linearGradient2750" inkscape:collect="always" x1="19.648342" x2="20.631224" xlink:href="#linearGradient3049" y1="42.253601" y2="6.7758031"/>
- <linearGradient gradientTransform="matrix(0.8782699,0,0,0.8782699,1049.7965,-403.53398)" gradientUnits="userSpaceOnUse" id="linearGradient2752" inkscape:collect="always" x1="50.152931" x2="25.291086" xlink:href="#linearGradient3061" y1="-3.6324477" y2="-4.3002653"/>
- <linearGradient gradientTransform="matrix(0.87827,0,0,0.87827,1021.9976,470.79956)" gradientUnits="userSpaceOnUse" id="linearGradient2754" inkscape:collect="always" x1="38.227654" x2="37.53537" xlink:href="#linearGradient3077" y1="13.602527" y2="6.6285896"/>
- <linearGradient gradientTransform="translate(1019.1501,465.21085)" gradientUnits="userSpaceOnUse" id="linearGradient2756" inkscape:collect="always" x1="31.177404" x2="40.859177" xlink:href="#linearGradient2250" y1="19.821514" y2="9.6568537"/>
- <linearGradient gradientTransform="matrix(0.87827,0,0,0.87827,1021.6871,470.17853)" gradientUnits="userSpaceOnUse" id="linearGradient2758" inkscape:collect="always" x1="9.7503242" x2="16.915297" xlink:href="#linearGradient3087" y1="32.28376" y2="39.443218"/>
- <linearGradient gradientTransform="matrix(1.007254,-2.636526e-2,2.636526e-2,1.007254,1020.7435,465.29004)" gradientUnits="userSpaceOnUse" id="linearGradient2760" inkscape:collect="always" x1="12.004697" x2="10.650805" xlink:href="#linearGradient2257" y1="35.688461" y2="33.194965"/>
- <linearGradient gradientTransform="matrix(0.878099,-1.73237e-2,1.73237e-2,0.878099,1021.3138,469.27875)" gradientUnits="userSpaceOnUse" id="linearGradient2762" inkscape:collect="always" x1="14.017542" x2="15.415793" xlink:href="#linearGradient2265" y1="36.942543" y2="38.268368"/>
- <radialGradient cx="24.8125" cy="39.125" fx="24.8125" fy="39.125" gradientTransform="matrix(1,0,0,0.374558,0,24.47041)" gradientUnits="userSpaceOnUse" id="radialGradient2777" inkscape:collect="always" r="17.6875" xlink:href="#linearGradient3041"/>
- <radialGradient cx="24.8125" cy="39.125" fx="24.8125" fy="39.125" gradientTransform="matrix(1,0,0,0.374558,0,24.47041)" gradientUnits="userSpaceOnUse" id="radialGradient2779" inkscape:collect="always" r="17.6875" xlink:href="#linearGradient3041"/>
- <linearGradient gradientTransform="matrix(0.87827,0,0,0.87827,1637.8992,1027.5871)" gradientUnits="userSpaceOnUse" id="linearGradient2781" inkscape:collect="always" x1="19.648342" x2="20.631224" xlink:href="#linearGradient3049" y1="42.253601" y2="6.7758031"/>
- <linearGradient gradientTransform="matrix(0.8782698,0,0,0.8782698,1879.0669,-455.80257)" gradientUnits="userSpaceOnUse" id="linearGradient2783" inkscape:collect="always" x1="50.152931" x2="25.291086" xlink:href="#linearGradient3061" y1="-3.6324477" y2="-4.3002653"/>
- <linearGradient gradientTransform="matrix(0.87827,0,0,0.87827,1638.2097,1028.2081)" gradientUnits="userSpaceOnUse" id="linearGradient2785" inkscape:collect="always" x1="38.227654" x2="37.53537" xlink:href="#linearGradient3077" y1="13.602527" y2="6.6285896"/>
- <linearGradient gradientTransform="translate(1635.3622,1022.6194)" gradientUnits="userSpaceOnUse" id="linearGradient2787" inkscape:collect="always" x1="31.177404" x2="40.859177" xlink:href="#linearGradient2250" y1="19.821514" y2="9.6568537"/>
- <linearGradient gradientTransform="matrix(0.87827,0,0,0.87827,1637.8992,1027.5871)" gradientUnits="userSpaceOnUse" id="linearGradient2789" inkscape:collect="always" x1="9.7503242" x2="16.915297" xlink:href="#linearGradient3087" y1="32.28376" y2="39.443218"/>
- <linearGradient gradientTransform="matrix(1.007254,-2.636526e-2,2.636526e-2,1.007254,1636.9556,1022.6986)" gradientUnits="userSpaceOnUse" id="linearGradient2791" inkscape:collect="always" x1="12.004697" x2="10.650805" xlink:href="#linearGradient2257" y1="35.688461" y2="33.194965"/>
- <linearGradient gradientTransform="matrix(0.878099,-1.73237e-2,1.73237e-2,0.878099,1637.5259,1026.6873)" gradientUnits="userSpaceOnUse" id="linearGradient2793" inkscape:collect="always" x1="14.017542" x2="15.415793" xlink:href="#linearGradient2265" y1="36.942543" y2="38.268368"/>
- <linearGradient gradientTransform="matrix(0.9169564,0,0,0.9120098,60.201795,153.71221)" gradientUnits="userSpaceOnUse" id="linearGradient14628" inkscape:collect="always" x1="43.943802" x2="411.39359" xlink:href="#SVGID_2_" y1="733.39258" y2="425.06561"/>
- <linearGradient gradientTransform="matrix(0.9169564,0,0,0.9120098,60.201795,153.71221)" gradientUnits="userSpaceOnUse" id="linearGradient144058" inkscape:collect="always" x1="43.943802" x2="411.39359" xlink:href="#SVGID_2_" y1="733.39258" y2="425.06561"/>
- <radialGradient cx="24.8125" cy="39.125" fx="24.8125" fy="39.125" gradientTransform="matrix(1,0,0,0.374558,0,24.47041)" gradientUnits="userSpaceOnUse" id="radialGradient144060" inkscape:collect="always" r="17.6875" xlink:href="#linearGradient3041"/>
- <radialGradient cx="24.8125" cy="39.125" fx="24.8125" fy="39.125" gradientTransform="matrix(1,0,0,0.374558,0,24.47041)" gradientUnits="userSpaceOnUse" id="radialGradient144062" inkscape:collect="always" r="17.6875" xlink:href="#linearGradient3041"/>
- <linearGradient gradientTransform="matrix(0.87827,0,0,0.87827,1637.8992,1027.5871)" gradientUnits="userSpaceOnUse" id="linearGradient144064" inkscape:collect="always" x1="19.648342" x2="20.631224" xlink:href="#linearGradient3049" y1="42.253601" y2="6.7758031"/>
- <linearGradient gradientTransform="matrix(0.8782698,0,0,0.8782698,1879.0669,-455.80257)" gradientUnits="userSpaceOnUse" id="linearGradient144066" inkscape:collect="always" x1="50.152931" x2="25.291086" xlink:href="#linearGradient3061" y1="-3.6324477" y2="-4.3002653"/>
- <linearGradient gradientTransform="matrix(0.87827,0,0,0.87827,1638.2097,1028.2081)" gradientUnits="userSpaceOnUse" id="linearGradient144068" inkscape:collect="always" x1="38.227654" x2="37.53537" xlink:href="#linearGradient3077" y1="13.602527" y2="6.6285896"/>
- <linearGradient gradientTransform="translate(1635.3622,1022.6194)" gradientUnits="userSpaceOnUse" id="linearGradient144070" inkscape:collect="always" x1="31.177404" x2="40.859177" xlink:href="#linearGradient2250" y1="19.821514" y2="9.6568537"/>
- <linearGradient gradientTransform="matrix(0.87827,0,0,0.87827,1637.8992,1027.5871)" gradientUnits="userSpaceOnUse" id="linearGradient144072" inkscape:collect="always" x1="9.7503242" x2="16.915297" xlink:href="#linearGradient3087" y1="32.28376" y2="39.443218"/>
- <linearGradient gradientTransform="matrix(1.007254,-2.636526e-2,2.636526e-2,1.007254,1636.9556,1022.6986)" gradientUnits="userSpaceOnUse" id="linearGradient144074" inkscape:collect="always" x1="12.004697" x2="10.650805" xlink:href="#linearGradient2257" y1="35.688461" y2="33.194965"/>
- <linearGradient gradientTransform="matrix(0.878099,-1.73237e-2,1.73237e-2,0.878099,1637.5259,1026.6873)" gradientUnits="userSpaceOnUse" id="linearGradient144076" inkscape:collect="always" x1="14.017542" x2="15.415793" xlink:href="#linearGradient2265" y1="36.942543" y2="38.268368"/>
- <linearGradient gradientTransform="matrix(0.87827,0,0,0.87827,1637.8992,1027.5871)" gradientUnits="userSpaceOnUse" id="linearGradient144103" inkscape:collect="always" x1="19.648342" x2="20.631224" xlink:href="#linearGradient3049" y1="42.253601" y2="6.7758031"/>
- <linearGradient gradientTransform="matrix(0.8782698,0,0,0.8782698,1879.0669,-455.80257)" gradientUnits="userSpaceOnUse" id="linearGradient144105" inkscape:collect="always" x1="50.152931" x2="25.291086" xlink:href="#linearGradient3061" y1="-3.6324477" y2="-4.3002653"/>
- <linearGradient gradientTransform="matrix(0.87827,0,0,0.87827,1638.2097,1028.2081)" gradientUnits="userSpaceOnUse" id="linearGradient144107" inkscape:collect="always" x1="38.227654" x2="37.53537" xlink:href="#linearGradient3077" y1="13.602527" y2="6.6285896"/>
- <linearGradient gradientTransform="translate(1635.3622,1022.6194)" gradientUnits="userSpaceOnUse" id="linearGradient144109" inkscape:collect="always" x1="31.177404" x2="40.859177" xlink:href="#linearGradient2250" y1="19.821514" y2="9.6568537"/>
- <linearGradient gradientTransform="matrix(0.87827,0,0,0.87827,1637.8992,1027.5871)" gradientUnits="userSpaceOnUse" id="linearGradient144111" inkscape:collect="always" x1="9.7503242" x2="16.915297" xlink:href="#linearGradient3087" y1="32.28376" y2="39.443218"/>
- <linearGradient gradientTransform="matrix(1.007254,-2.636526e-2,2.636526e-2,1.007254,1636.9556,1022.6986)" gradientUnits="userSpaceOnUse" id="linearGradient144113" inkscape:collect="always" x1="12.004697" x2="10.650805" xlink:href="#linearGradient2257" y1="35.688461" y2="33.194965"/>
- <linearGradient gradientTransform="matrix(0.878099,-1.73237e-2,1.73237e-2,0.878099,1637.5259,1026.6873)" gradientUnits="userSpaceOnUse" id="linearGradient144115" inkscape:collect="always" x1="14.017542" x2="15.415793" xlink:href="#linearGradient2265" y1="36.942543" y2="38.268368"/>
- <linearGradient gradientTransform="matrix(8.3498595,-0.1647314,0.1647314,8.3498595,9960.2178,4925.5768)" gradientUnits="userSpaceOnUse" id="linearGradient144118" inkscape:collect="always" x1="14.017542" x2="15.415793" xlink:href="#linearGradient2265" y1="36.942543" y2="38.268368"/>
- <linearGradient gradientTransform="matrix(9.5779968,-0.2507077,0.2507077,9.5779968,9954.7948,4887.6482)" gradientUnits="userSpaceOnUse" id="linearGradient144122" inkscape:collect="always" x1="12.004697" x2="10.650805" xlink:href="#linearGradient2257" y1="35.688461" y2="33.194965"/>
- <linearGradient gradientTransform="matrix(8.3514856,0,0,8.3514856,9963.7675,4934.133)" gradientUnits="userSpaceOnUse" id="linearGradient144127" inkscape:collect="always" x1="9.7503242" x2="16.915297" xlink:href="#linearGradient3087" y1="32.28376" y2="39.443218"/>
- <linearGradient gradientTransform="matrix(9.5090184,0,0,9.5090184,9939.6432,4886.8951)" gradientUnits="userSpaceOnUse" id="linearGradient144130" inkscape:collect="always" x1="31.177404" x2="40.859177" xlink:href="#linearGradient2250" y1="19.821514" y2="9.6568537"/>
- <linearGradient gradientTransform="matrix(8.3514856,0,0,8.3514856,9966.7201,4940.0381)" gradientUnits="userSpaceOnUse" id="linearGradient144133" inkscape:collect="always" x1="38.227654" x2="37.53537" xlink:href="#linearGradient3077" y1="13.602527" y2="6.6285896"/>
- <linearGradient gradientTransform="matrix(8.3514838,0,0,8.3514838,10487.711,-3691.9132)" gradientUnits="userSpaceOnUse" id="linearGradient144136" inkscape:collect="always" x1="50.152931" x2="25.291086" xlink:href="#linearGradient3061" y1="-3.6324477" y2="-4.3002653"/>
- <linearGradient gradientTransform="matrix(8.3514856,0,0,8.3514856,9963.7675,4934.133)" gradientUnits="userSpaceOnUse" id="linearGradient144140" inkscape:collect="always" x1="19.648342" x2="20.631224" xlink:href="#linearGradient3049" y1="42.253601" y2="6.7758031"/>
- <linearGradient gradientTransform="matrix(0.9169564,0,0,0.9120098,60.201795,153.71221)" gradientUnits="userSpaceOnUse" id="linearGradient144144" inkscape:collect="always" x1="43.943802" x2="411.39359" xlink:href="#SVGID_2_" y1="733.39258" y2="425.06561"/>
- <linearGradient gradientTransform="matrix(0.9169564,0,0,0.9120098,60.201795,153.71221)" gradientUnits="userSpaceOnUse" id="linearGradient144150" inkscape:collect="always" x1="43.943802" x2="411.39359" xlink:href="#SVGID_2_" y1="733.39258" y2="425.06561"/>
- <radialGradient inkscape:collect="always" xlink:href="#linearGradient3041" id="radialGradient12894" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1,0,0,0.374558,0,24.47041)" cx="24.8125" cy="39.125" fx="24.8125" fy="39.125" r="17.6875"/>
- <linearGradient inkscape:collect="always" xlink:href="#linearGradient3049" id="linearGradient12896" gradientUnits="userSpaceOnUse" gradientTransform="matrix(8.3514856,0,0,8.3514856,9963.7675,4934.133)" x1="19.648342" y1="42.253601" x2="20.631224" y2="6.7758031"/>
- <linearGradient inkscape:collect="always" xlink:href="#linearGradient3061" id="linearGradient12898" gradientUnits="userSpaceOnUse" gradientTransform="matrix(8.351484,0,0,8.351484,10487.711,-3691.9132)" x1="50.152931" y1="-3.6324477" x2="25.291086" y2="-4.3002653"/>
- <linearGradient inkscape:collect="always" xlink:href="#linearGradient3077" id="linearGradient12900" gradientUnits="userSpaceOnUse" gradientTransform="matrix(8.3514856,0,0,8.3514856,9966.7201,4940.0381)" x1="38.227654" y1="13.602527" x2="37.53537" y2="6.6285896"/>
- <linearGradient inkscape:collect="always" xlink:href="#linearGradient2250" id="linearGradient12902" gradientUnits="userSpaceOnUse" gradientTransform="matrix(9.5090184,0,0,9.5090184,9939.6432,4886.8951)" x1="31.177404" y1="19.821514" x2="40.859177" y2="9.6568537"/>
- <linearGradient inkscape:collect="always" xlink:href="#linearGradient3087" id="linearGradient12904" gradientUnits="userSpaceOnUse" gradientTransform="matrix(8.3514856,0,0,8.3514856,9963.7675,4934.133)" x1="9.7503242" y1="32.28376" x2="16.915297" y2="39.443218"/>
- <linearGradient inkscape:collect="always" xlink:href="#linearGradient2257" id="linearGradient12906" gradientUnits="userSpaceOnUse" gradientTransform="matrix(9.5779968,-0.2507077,0.2507077,9.5779968,9954.7948,4887.6482)" x1="12.004697" y1="35.688461" x2="10.650805" y2="33.194965"/>
- <linearGradient inkscape:collect="always" xlink:href="#linearGradient2265" id="linearGradient12908" gradientUnits="userSpaceOnUse" gradientTransform="matrix(8.3498595,-0.1647314,0.1647314,8.3498595,9960.2178,4925.5768)" x1="14.017542" y1="36.942543" x2="15.415793" y2="38.268368"/>
- </defs>
- <sodipodi:namedview bordercolor="#666666" borderopacity="1.0" id="base" inkscape:current-layer="layer1" inkscape:cx="-277.41277" inkscape:cy="430.03335" inkscape:document-units="px" inkscape:guide-bbox="true" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:window-height="756" inkscape:window-width="1276" inkscape:window-x="0" inkscape:window-y="0" inkscape:zoom="0.43901235" pagecolor="#ffffff" showgrid="false" showguides="true" inkscape:snap-global="false" inkscape:window-maximized="0">
- <sodipodi:guide id="guide2280" orientation="horizontal" position="545.21834"/>
- <sodipodi:guide id="guide2282" orientation="vertical" position="-66.057367,779.02136"/>
- <sodipodi:guide id="guide2284" orientation="vertical" position="712.54005"/>
- <sodipodi:guide id="guide2286" orientation="horizontal" position="-211.83914,88.83577"/>
- <sodipodi:guide id="guide2491" orientation="horizontal" position="348.50956,936.19234"/>
- <sodipodi:guide id="guide2495" orientation="vertical" position="785.85489,697.01912"/>
- <sodipodi:guide id="guide2497" orientation="horizontal" position="154.80103"/>
- </sodipodi:namedview>
- <metadata id="metadata7">
- <rdf:RDF>
- <cc:Work rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
- <cc:license rdf:resource="http://creativecommons.org/licenses/by-sa/3.0/"/>
- <dc:title>manage</dc:title>
- <dc:date>Sept 2012</dc:date>
- <dc:creator>
- <cc:Agent>
- <dc:title>Franziska Sponsel</dc:title>
- </cc:Agent>
- </dc:creator>
- <dc:rights>
- <cc:Agent>
- <dc:title>Franziska Sponsel</dc:title>
- </cc:Agent>
- </dc:rights>
- <dc:publisher>
- <cc:Agent>
- <dc:title>RRZE</dc:title>
- </cc:Agent>
- </dc:publisher>
- <dc:subject>
- <rdf:Bag>
- <rdf:li>manage</rdf:li>
- <rdf:li>tools</rdf:li>
- <rdf:li>administrate</rdf:li>
- <rdf:li>management</rdf:li>
- <rdf:li>administration</rdf:li>
- </rdf:Bag>
- </dc:subject>
- <dc:contributor>
- <cc:Agent>
- <dc:title>Hendrik Eggers, Frank Troeger</dc:title>
- </cc:Agent>
- </dc:contributor>
- <dc:description>uses &lt;http://ftp.uni-erlangen.de/pub/rrze/tango/rrze-icon-set/tango/16x16/categories/user-admin.png&gt;</dc:description>
- </cc:Work>
- <cc:License rdf:about="http://creativecommons.org/licenses/by-sa/3.0/">
- <cc:permits rdf:resource="http://creativecommons.org/ns#Reproduction"/>
- <cc:permits rdf:resource="http://creativecommons.org/ns#Distribution"/>
- <cc:requires rdf:resource="http://creativecommons.org/ns#Notice"/>
- <cc:requires rdf:resource="http://creativecommons.org/ns#Attribution"/>
- <cc:permits rdf:resource="http://creativecommons.org/ns#DerivativeWorks"/>
- <cc:requires rdf:resource="http://creativecommons.org/ns#ShareAlike"/>
- </cc:License>
- </rdf:RDF>
- </metadata>
- <g id="layer1" inkscape:groupmode="layer" inkscape:label="Ebene 1" transform="translate(80, 0)">
- <g id="g12910">
- <rect height="850" id="rect2300" style="fill:none;stroke:none" width="850" x="-64.879845" y="115.85568"/>
- <g transform="matrix(1.8906321,0,0,1.8906321,-591.22637,-769.37328)" id="g12880">
- <path transform="matrix(7.1423949,0,0,5.5028975,410.56814,647.32339)" style="opacity:0.19886367;fill:url(#radialGradient12894);fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible" sodipodi:type="arc" sodipodi:ry="6.625" sodipodi:rx="17.6875" sodipodi:cy="39.125" sodipodi:cx="24.8125" id="path2258" d="m 42.5,39.125 c 0,3.658886 -7.918963,6.625 -17.6875,6.625 -9.768537,0 -17.6875,-2.966114 -17.6875,-6.625 0,-3.658886 7.918963,-6.625 17.6875,-6.625 9.768537,0 17.6875,2.966114 17.6875,6.625 z"/>
- <path inkscape:connector-curvature="0" style="fill:url(#linearGradient12896);fill-opacity:1;fill-rule:nonzero;stroke:#2e3436;stroke-width:9.50901604;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" sodipodi:nodetypes="cczcccccccccsc" id="path2140" d="m 418.80143,664.93656 180.60088,184.77668 c 7.30759,8.35149 30.46224,14.80611 45.93322,0 14.93981,-14.29795 11.48328,-34.44993 -3.13179,-49.06501 L 468.91034,614.82765 C 490.30563,555.39629 447.0027,505.47803 391.13722,516.17567 l -12.00533,10.96133 37.58174,35.49384 2.0878,31.31814 -28.05959,25.6135 -33.53261,-3.69083 -34.44984,-32.36205 c 0,0 -12.07759,11.93287 -12.07759,11.93287 -5.61755,53.64342 50.4712,101.58703 108.11963,69.49409 z"/>
- <path inkscape:connector-curvature="0" style="opacity:0.42613639;fill:none;stroke:#ffffff;stroke-width:9.50901031;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" sodipodi:nodetypes="cczccccccccccc" id="path3057" d="m 420.80479,652.80715 182.60054,190.44291 c 5.65701,6.46508 23.5817,11.46179 35.55811,0 11.56544,-11.0684 8.88961,-26.66861 -2.42441,-37.98264 L 460.70273,618.68955 c 14.26352,-61.80862 -17.67527,-95.13431 -65.22036,-93.94568 l -2.56867,2.59958 34.26023,30.77375 1.23779,39.76471 -34.36484,31.36531 -40.3401,-4.35713 -30.20626,-28.44603 -3.35316,4.08944 c -2.97157,56.75696 61.72988,82.58364 100.65743,52.27365 z"/>
- <rect y="120.39947" x="773.19269" width="221.25844" transform="matrix(0.69793809,0.71615809,-0.71615809,0.69793809,0,0)" style="opacity:0.17045456;fill:none;stroke:url(#linearGradient12898);stroke-width:9.50899029;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" ry="4.4455171" rx="4.4455171" id="rect3059" height="19.545702"/>
- <path inkscape:connector-curvature="0" style="fill:url(#linearGradient12900);fill-opacity:1;fill-rule:nonzero;stroke:#2e3436;stroke-width:9.50901604;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" sodipodi:nodetypes="ccccccccc" id="path2144" d="m 462.4677,749.65916 c 7.92614,-6.79391 126.31618,-127.88213 126.31618,-127.88213 l 29.23015,-2.08789 45.93322,-63.68009 -38.26743,-34.09164 -59.5043,51.15281 0,29.23025 -121.09659,125.79423 c -5.74164,5.74164 10.08118,27.82805 17.38877,21.56446 z"/>
- <path inkscape:connector-curvature="0" style="opacity:0.53977272;fill:none;stroke:url(#linearGradient12902);stroke-width:9.50902081;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" sodipodi:nodetypes="ccccccccc" id="path3085" d="m 461.54713,739.77045 c 6.15015,-5.27161 123.84926,-125.80251 123.84926,-125.80251 l 27.84792,-2.35814 40.07024,-53.84073 -27.4785,-24.23839 -52.0769,44.85851 1.47638,27.10983 -120.53737,126.39691 c -4.45516,4.45517 1.17874,12.73467 6.84897,7.87452 z"/>
- <path inkscape:connector-curvature="0" style="fill:url(#linearGradient12904);fill-opacity:1;fill-rule:nonzero;stroke:#204a87;stroke-width:9.50901604;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" sodipodi:nodetypes="ccccccscc" id="path2142" d="m 329.02298,877.89949 c 12.51948,13.9329 47.29491,20.23672 62.71626,-6.75064 6.72382,-11.76674 19.91131,-44.71901 78.74532,-97.6696 9.8813,-8.88313 20.34844,-29.20352 11.47501,-40.16486 l -22.96656,-22.96656 c -9.39539,-10.43938 -35.51067,-5.5699 -46.22506,9.04184 -31.93841,43.70535 -84.11744,78.49581 -95.88428,82.69822 -22.51659,8.04169 -19.98234,41.23253 -5.08561,57.02074 l 17.22492,18.79086 z"/>
- <path transform="matrix(8.3514856,0,0,8.3514856,271.60658,511.47803)" style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#888a85;stroke-width:1.13860166;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:0.94117647;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" sodipodi:type="arc" sodipodi:ry="1.375" sodipodi:rx="1.375" sodipodi:cy="37.5" sodipodi:cx="41.875" id="path2146" d="m 43.25,37.5 c 0,0.759392 -0.615608,1.375 -1.375,1.375 -0.759392,0 -1.375,-0.615608 -1.375,-1.375 0,-0.759392 0.615608,-1.375 1.375,-1.375 0.759392,0 1.375,0.615608 1.375,1.375 z"/>
- <path transform="matrix(5.4284704,0,0,5.4284704,335.57983,570.18338)" style="opacity:0.60227272;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible" sodipodi:type="arc" sodipodi:ry="1.767767" sodipodi:rx="1.767767" sodipodi:cy="28.20101" sodipodi:cx="19.003494" id="path3101" d="m 20.771261,28.20101 c 0,0.97631 -0.791456,1.767767 -1.767767,1.767767 -0.97631,0 -1.767767,-0.791457 -1.767767,-1.767767 0,-0.976311 0.791457,-1.767767 1.767767,-1.767767 0.976311,0 1.767767,0.791456 1.767767,1.767767 z"/>
- <path inkscape:connector-curvature="0" style="fill:none;stroke:url(#linearGradient12906);stroke-width:21.81852913;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" sodipodi:nodetypes="cc" id="path3103" d="m 426.14429,744.89914 c 0,0 -68.17861,69.41222 -100.11713,81.17896"/>
- <path inkscape:connector-curvature="0" style="opacity:0.19886367;fill:none;stroke:#ffffff;stroke-width:9.50901318;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" sodipodi:nodetypes="csccccscc" id="path2270" d="m 332.26261,867.20309 c 13.70506,16.59903 43.73711,20.55117 53.16644,-3.52395 6.47859,-16.54103 31.69946,-53.8761 77.95104,-95.5025 7.76801,-6.98323 15.99654,-22.95781 9.02082,-31.57498 l -18.05477,-18.05477 c -7.38613,-8.20676 -27.9162,-4.37871 -36.3391,7.10809 -25.10799,34.35827 -80.66833,79.30102 -94.09887,83.73289 -20.79432,6.86181 -16.89752,30.6314 -5.18669,43.04305 l 13.54113,14.77217 z"/>
- <path inkscape:connector-curvature="0" style="opacity:0.27840911;fill:none;stroke:url(#linearGradient12908);stroke-width:21.81852913;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible" sodipodi:nodetypes="cc" id="path2247" d="m 446.5477,760.45798 c 0,0 -69.63226,62.92508 -84.76102,103.26842"/>
- </g>
- </g>
- </g>
-</svg>
diff --git a/source/images/media-flash.svg b/source/images/media-flash.svg
deleted file mode 100644
index 13f910f..0000000
--- a/source/images/media-flash.svg
+++ /dev/null
@@ -1,477 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- inkscape:export-ydpi="90.000000"
- inkscape:export-xdpi="90.000000"
- inkscape:export-filename="/home/jimmac/Desktop/wi-fi.png"
- width="48px"
- height="48px"
- id="svg11300"
- sodipodi:version="0.32"
- inkscape:version="0.46"
- sodipodi:docbase="/home/jimmac/src/cvs/tango-icon-theme-extras/scalable/devices"
- sodipodi:docname="media-flash.svg"
- inkscape:output_extension="org.inkscape.output.svg.inkscape">
- <defs
- id="defs3">
- <inkscape:perspective
- sodipodi:type="inkscape:persp3d"
- inkscape:vp_x="0 : 24 : 1"
- inkscape:vp_y="0 : 1000 : 0"
- inkscape:vp_z="48 : 24 : 1"
- inkscape:persp3d-origin="24 : 16 : 1"
- id="perspective71" />
- <linearGradient
- inkscape:collect="always"
- id="linearGradient6210">
- <stop
- style="stop-color:white;stop-opacity:1;"
- offset="0"
- id="stop6212" />
- <stop
- style="stop-color:white;stop-opacity:0;"
- offset="1"
- id="stop6214" />
- </linearGradient>
- <linearGradient
- id="linearGradient6196">
- <stop
- style="stop-color:#edd400;stop-opacity:1;"
- offset="0"
- id="stop6198" />
- <stop
- id="stop6204"
- offset="0.5"
- style="stop-color:#c3af07;stop-opacity:1;" />
- <stop
- style="stop-color:#ffeb3e;stop-opacity:1;"
- offset="1"
- id="stop6200" />
- </linearGradient>
- <linearGradient
- inkscape:collect="always"
- id="linearGradient6151">
- <stop
- style="stop-color:#2e3436;stop-opacity:1;"
- offset="0"
- id="stop6153" />
- <stop
- style="stop-color:#2e3436;stop-opacity:0;"
- offset="1"
- id="stop6155" />
- </linearGradient>
- <linearGradient
- inkscape:collect="always"
- id="linearGradient6125">
- <stop
- style="stop-color:black;stop-opacity:1;"
- offset="0"
- id="stop6127" />
- <stop
- style="stop-color:black;stop-opacity:0;"
- offset="1"
- id="stop6129" />
- </linearGradient>
- <linearGradient
- id="linearGradient6115">
- <stop
- style="stop-color:#555753;stop-opacity:1;"
- offset="0"
- id="stop6117" />
- <stop
- style="stop-color:#3e3f3c;stop-opacity:1;"
- offset="1"
- id="stop6119" />
- </linearGradient>
- <linearGradient
- id="linearGradient6099">
- <stop
- style="stop-color:#eeeeec;stop-opacity:1;"
- offset="0"
- id="stop6101" />
- <stop
- id="stop6107"
- offset="0.8918919"
- style="stop-color:#dededa;stop-opacity:1;" />
- <stop
- style="stop-color:#838375;stop-opacity:1;"
- offset="1"
- id="stop6103" />
- </linearGradient>
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient6099"
- id="linearGradient6105"
- x1="22.797205"
- y1="39.679859"
- x2="22.797205"
- y2="46.635937"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(1,0,0,0.934004,0,1.557982)" />
- <radialGradient
- inkscape:collect="always"
- xlink:href="#linearGradient6125"
- id="radialGradient6131"
- cx="24.218407"
- cy="45.25996"
- fx="24.218407"
- fy="45.25996"
- r="21.38998"
- gradientTransform="matrix(1,0,0,0.128099,9.432564e-16,39.4622)"
- gradientUnits="userSpaceOnUse" />
- <radialGradient
- inkscape:collect="always"
- xlink:href="#linearGradient6151"
- id="radialGradient6157"
- cx="33.45499"
- cy="28.603338"
- fx="33.45499"
- fy="28.603338"
- r="3.8890872"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(3.657239,1.232816e-15,-1.232816e-15,3.657239,-88.89792,-76.00592)" />
- <radialGradient
- inkscape:collect="always"
- xlink:href="#linearGradient6151"
- id="radialGradient6161"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(8.342154,-3.746956e-16,3.746956e-16,8.342154,-227.6289,-207.0663)"
- cx="29.61227"
- cy="27.974968"
- fx="29.61227"
- fy="27.974968"
- r="3.8890872" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient6196"
- id="linearGradient6202"
- x1="29.374996"
- y1="21.741114"
- x2="22.101643"
- y2="7.6786127"
- gradientUnits="userSpaceOnUse" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient6115"
- id="linearGradient6208"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(1,0,0,0.982516,0,-7.076703e-2)"
- x1="21.617008"
- y1="4.6076145"
- x2="26.443777"
- y2="47.007381" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient6210"
- id="linearGradient6216"
- x1="16.845879"
- y1="8.6784801"
- x2="30.507824"
- y2="78.505272"
- gradientUnits="userSpaceOnUse" />
- <filter
- inkscape:collect="always"
- id="filter5339"
- x="-0.068965518"
- width="1.137931"
- y="-0.62068962"
- height="2.2413792">
- <feGaussianBlur
- inkscape:collect="always"
- stdDeviation="1.1886709"
- id="feGaussianBlur5341" />
- </filter>
- </defs>
- <sodipodi:namedview
- stroke="#ef2929"
- fill="#eeeeec"
- id="base"
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="0.25490196"
- inkscape:pageopacity="0.0"
- inkscape:pageshadow="2"
- inkscape:zoom="1"
- inkscape:cx="200.83545"
- inkscape:cy="-11.195251"
- inkscape:current-layer="layer1"
- showgrid="true"
- inkscape:grid-bbox="true"
- inkscape:document-units="px"
- inkscape:showpageshadow="false"
- inkscape:window-width="663"
- inkscape:window-height="688"
- inkscape:window-x="355"
- inkscape:window-y="160">
- <inkscape:grid
- type="xygrid"
- id="grid4690" />
- </sodipodi:namedview>
- <metadata
- id="metadata4">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:creator>
- <cc:Agent>
- <dc:title>Jakub Steiner</dc:title>
- </cc:Agent>
- </dc:creator>
- <dc:source>http://jimmac.musichall.cz</dc:source>
- <cc:license
- rdf:resource="http://creativecommons.org/licenses/publicdomain/" />
- <dc:title>Generic Flash Media</dc:title>
- <dc:subject>
- <rdf:Bag>
- <rdf:li>flash</rdf:li>
- <rdf:li>memory</rdf:li>
- <rdf:li>removable</rdf:li>
- <rdf:li>photo</rdf:li>
- </rdf:Bag>
- </dc:subject>
- <dc:rights>
- <cc:Agent>
- <dc:title>Novell, Inc., Jakub Steiner</dc:title>
- </cc:Agent>
- </dc:rights>
- </cc:Work>
- <cc:License
- rdf:about="http://creativecommons.org/licenses/publicdomain/">
- <cc:permits
- rdf:resource="http://creativecommons.org/ns#Reproduction" />
- <cc:permits
- rdf:resource="http://creativecommons.org/ns#Distribution" />
- <cc:permits
- rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
- </cc:License>
- </rdf:RDF>
- </metadata>
- <g
- id="layer1"
- inkscape:label="Layer 1"
- inkscape:groupmode="layer">
- <rect
- style="opacity:0.43373497;color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.50843191px;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;filter:url(#filter5339);enable-background:accumulate"
- id="rect4692"
- width="41.365746"
- height="4.5961943"
- x="3.3587573"
- y="41.989594"
- rx="2.3794458"
- ry="2.2980971"
- transform="matrix(0.965812,0,0,1,0.8219361,0)" />
- <path
- style="opacity:1;color:black;fill:url(#linearGradient6208);fill-opacity:1;fill-rule:evenodd;stroke:#2e3436;stroke-width:0.99999976;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- d="M 5.4999978,3.2368595 L 5.4999978,43.618858 C 5.569704,44.669066 6.4987349,45.72121 7.8834214,45.616246 L 39.735278,45.616246 C 40.628844,45.573136 41.513052,44.830044 41.499984,43.358328 L 41.499984,6.4283398 C 41.499984,5.7118028 41.268737,5.2304363 40.743728,4.7146061 C 40.743728,4.7146061 37.994733,1.8791213 37.994733,1.8791213 C 37.707471,1.6077368 37.530774,1.4999993 36.735279,1.4999993 L 6.7352914,1.4999993 C 5.7977914,1.5614066 5.4374978,2.4999722 5.4999978,3.2368595 z "
- id="path4291"
- sodipodi:nodetypes="cccccccsccc" />
- <rect
- ry="1.8974454"
- rx="1.8974441"
- y="5.616117"
- x="9.4999952"
- height="16.999992"
- width="27.976646"
- id="rect6089"
- style="opacity:1;color:black;fill:#edd400;fill-opacity:1;fill-rule:evenodd;stroke:#2e3436;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
- <rect
- style="opacity:1;color:black;fill:url(#linearGradient6202);fill-opacity:1.0;fill-rule:evenodd;stroke:#c4a000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- id="rect4293"
- width="27.976646"
- height="16.999992"
- x="9.4999952"
- y="5.616117"
- rx="1.8974441"
- ry="1.8974454" />
- <rect
- ry="1.1461133"
- rx="1.1461439"
- y="6.6162395"
- x="10.578098"
- height="15.00028"
- width="26.000004"
- id="rect4295"
- style="opacity:0.44943824;color:black;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:white;stroke-width:1.0000087;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- transform="matrix(1,0,-5.5327e-3,0.999985,0,0)" />
- <path
- style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- d="M 12,6.116117 L 12,12.11612 C 19.204912,9.2558473 27.058025,16.094119 35,14.11612 L 35,6.1880393 L 36,6.1880393 L 36,22.11612 L 35,22.11612 L 35,16.11612 C 26.337016,18.056862 19.445696,11.070476 12,14.11612 L 12,22.11612 L 11,22.11612 L 11,6.116117 L 12,6.116117 z "
- id="path6043"
- sodipodi:nodetypes="ccccccccccccc" />
- <path
- style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- d="M 13,6.116117 L 13,10.850955 L 14,10.611733 L 14,6.116117 L 13,6.116117 z "
- id="path6045"
- sodipodi:nodetypes="ccccc" />
- <path
- style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- d="M 15,10.611732 L 15,6.116117 L 16,6.116117 L 16,10.523344 L 15,10.611732 z "
- id="path6047"
- sodipodi:nodetypes="ccccc" />
- <path
- style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- d="M 17,10.523344 L 17,6.116117 L 18,6.116117 L 18,10.674178 L 17,10.523344 z "
- id="path6049"
- sodipodi:nodetypes="ccccc" />
- <path
- style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- d="M 19,10.895149 L 19,6.116117 L 20,6.116117 L 20,11.11612 L 19,10.895149 z "
- id="path6051"
- sodipodi:nodetypes="ccccc" />
- <path
- style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- d="M 21,11.274645 L 21,6.116117 L 22,6.116117 L 22,11.451422 L 21,11.274645 z "
- id="path6053"
- sodipodi:nodetypes="ccccc" />
- <path
- id="path6055"
- d="M 23,11.804975 L 23,6.116117 L 24,6.116117 L 24,11.937558 L 23,11.804975 z "
- style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- sodipodi:nodetypes="ccccc" />
- <path
- style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- d="M 25,12.335305 L 25,6.116117 L 26,6.116117 L 26,12.512082 L 25,12.335305 z "
- id="path6057"
- sodipodi:nodetypes="ccccc" />
- <path
- id="path6059"
- d="M 27,12.733053 L 27,6.116117 L 28,6.116117 L 28,12.90983 L 27,12.733053 z "
- style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- sodipodi:nodetypes="ccccc" />
- <path
- style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- d="M 29,13.219189 L 29,6.116117 L 30,6.116117 L 30,13.307577 L 29,13.219189 z "
- id="path6061"
- sodipodi:nodetypes="ccccc" />
- <path
- id="path6063"
- d="M 31,13.395965 L 31,6.116117 L 32,6.116117 L 32,13.395966 L 31,13.395965 z "
- style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- sodipodi:nodetypes="ccccc" />
- <path
- style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- d="M 33,13.395965 L 33,6.116117 L 34,6.116117 L 34,13.263383 L 33,13.395965 z "
- id="path6065"
- sodipodi:nodetypes="ccccc" />
- <path
- id="path6067"
- d="M 13,22.070139 L 13,14.639459 L 14,14.525128 L 14,22.070139 L 13,22.070139 z "
- style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- sodipodi:nodetypes="ccccc" />
- <path
- id="path6069"
- d="M 15,14.480935 L 15,22.070139 L 16,22.070139 L 16,14.348352 L 15,14.480935 z "
- style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- sodipodi:nodetypes="ccccc" />
- <path
- id="path6071"
- d="M 17,14.348352 L 17,22.070139 L 18,22.070139 L 18,14.462683 L 17,14.348352 z "
- style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- sodipodi:nodetypes="ccccc" />
- <path
- id="path6073"
- d="M 19,14.772042 L 19,22.070139 L 20,22.070139 L 20,14.993013 L 19,14.772042 z "
- style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- sodipodi:nodetypes="ccccc" />
- <path
- id="path6075"
- d="M 21,15.232235 L 21,22.070139 L 22,22.070139 L 22,15.4974 L 21,15.232235 z "
- style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- sodipodi:nodetypes="ccccc" />
- <path
- style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- d="M 23,15.850954 L 23,22.070139 L 24,22.070139 L 24,16.204507 L 23,15.850954 z "
- id="path6077"
- sodipodi:nodetypes="ccccc" />
- <path
- id="path6079"
- d="M 25,16.381284 L 25,22.070139 L 26,22.070139 L 26,16.646449 L 25,16.381284 z "
- style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- sodipodi:nodetypes="ccccc" />
- <path
- style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- d="M 27,16.823226 L 27,22.070139 L 28,22.070139 L 28,17.000002 L 27,16.823226 z "
- id="path6081"
- sodipodi:nodetypes="ccccc" />
- <path
- id="path6083"
- d="M 29,17.176779 L 29,22.070139 L 30,22.070139 L 30,17.220973 L 29,17.176779 z "
- style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- sodipodi:nodetypes="ccccc" />
- <path
- style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- d="M 31,17.39775 L 31,22.070139 L 32,22.070139 L 32,17.265167 L 31,17.39775 z "
- id="path6085"
- sodipodi:nodetypes="ccccc" />
- <path
- id="path6087"
- d="M 33,17.353556 L 33,22.070139 L 34,22.070139 L 34,17.176779 L 33,17.353556 z "
- style="opacity:0.44943824;color:black;fill:white;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- sodipodi:nodetypes="ccccc" />
- <rect
- style="opacity:1;color:black;fill:#2e3436;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- id="rect6095"
- width="31"
- height="11"
- x="8"
- y="35.116135"
- rx="0.81717849"
- ry="0.81717849" />
- <rect
- ry="0.12967849"
- rx="0.12967849"
- y="36.116135"
- x="9"
- height="9"
- width="29"
- id="rect6097"
- style="opacity:1;color:black;fill:url(#linearGradient6105);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
- <rect
- style="opacity:1;color:black;fill:#8f5902;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.80000000000000004;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- id="rect6109"
- width="29"
- height="3.0000017"
- x="9"
- y="36.116135"
- rx="0.12967849"
- ry="0.12967849" />
- <rect
- style="opacity:1;color:black;fill:#e9b96e;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.80000000000000004;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- id="rect6111"
- width="10.036427"
- height="1.9999989"
- x="11"
- y="37.116135"
- rx="0.12967849"
- ry="0.12967849" />
- <rect
- ry="0.12967849"
- rx="0.12967849"
- y="37.116135"
- x="22.963573"
- height="1.9999989"
- width="4.0364265"
- id="rect6113"
- style="opacity:1;color:black;fill:#e9b96e;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.80000000000000004;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
- <path
- sodipodi:type="inkscape:offset"
- inkscape:radius="-1.000373"
- inkscape:original="M 6.75 1.5 C 5.8124999 1.5614073 5.4375 2.5131127 5.5 3.25 L 5.5 43.625 C 5.5697064 44.675208 6.4903135 45.729964 7.875 45.625 L 39.75 45.625 C 40.643565 45.581891 41.513068 44.815466 41.5 43.34375 L 41.5 6.4375 C 41.499999 5.7209628 41.275009 5.2345802 40.75 4.71875 C 40.749999 4.7187498 38 1.875 38 1.875 C 37.712739 1.6036155 37.545495 1.5 36.75 1.5 L 6.75 1.5 z "
- xlink:href="#path4291"
- style="opacity:0.17977528;color:black;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient6216);stroke-width:0.99999976;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0.8;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- id="path6206"
- inkscape:href="#path4291"
- d="M 6.8125,2.5 C 6.6714126,2.5092414 6.665484,2.505736 6.59375,2.625 C 6.522016,2.744264 6.486054,2.9918242 6.5,3.15625 C 6.501465,3.1874828 6.501465,3.2187672 6.5,3.25 L 6.5,43.5625 C 6.5340897,44.076101 6.9647984,44.689259 7.8125,44.625 C 7.8333282,44.624349 7.8541718,44.624349 7.875,44.625 L 39.6875,44.625 C 40.042231,44.607886 40.509542,44.418409 40.5,43.34375 L 40.5,6.4375 C 40.499999,5.9303711 40.465181,5.8331404 40.0625,5.4375 C 40.051855,5.4273147 40.041435,5.4168955 40.03125,5.40625 C 40.03125,5.40625 37.37257,2.6558683 37.3125,2.59375 C 37.252809,2.537358 37.283219,2.5655737 37.28125,2.5625 C 37.279281,2.5594263 37.249931,2.5312266 37.25,2.53125 C 37.250138,2.5312967 37.104314,2.5 36.75,2.5 L 6.8125,2.5 z " />
- </g>
-</svg>
diff --git a/source/images/sbutto.svg b/source/images/sbutto.svg
deleted file mode 100644
index 3f131f1..0000000
--- a/source/images/sbutto.svg
+++ /dev/null
@@ -1,14 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="76" height="16">
- <defs>
- <linearGradient id="interior" x1="0" x2="0" y1="0" y2="1">
- <stop offset="0" stop-color="#5c3e9a" />
- <stop offset="1" stop-color="#461f99" />
- </linearGradient>
- <linearGradient id="glass" x1="0" x2="0" y1="0" y2="1">
- <stop offset="0" stop-color="#ffffff" stop-opacity="0.2" />
- <stop offset="1" stop-color="#ffffff" stop-opacity="0.1" />
- </linearGradient>
- </defs>
- <rect x="0" y="0" width="76" height="16" rx="4" ry="4" stroke-width="1" stroke="#330099" fill="url(#interior)" />
- <rect x="1" y="1" width="74" height="8" stroke="none" fill="url(#glass)" />
-</svg>
diff --git a/source/images/slide-audio.svg b/source/images/slide-audio.svg
deleted file mode 100644
index 5a9be13..0000000
--- a/source/images/slide-audio.svg
+++ /dev/null
@@ -1,158 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="210mm" height="297mm" id="svg2" version="1.1" inkscape:version="0.47 r22583">
- <title id="title4032">slide audio</title>
- <defs id="defs4">
- <linearGradient inkscape:collect="always" id="linearGradient3877">
- <stop style="stop-color:#000000;stop-opacity:1;" offset="0" id="stop3879"/>
- <stop style="stop-color:#000000;stop-opacity:0;" offset="1" id="stop3881"/>
- </linearGradient>
- <linearGradient id="linearGradient3782">
- <stop style="stop-color:#ffffff;stop-opacity:1;" offset="0" id="stop3784"/>
- <stop style="stop-color:#ffffff;stop-opacity:0;" offset="1" id="stop3786"/>
- </linearGradient>
- <linearGradient inkscape:collect="always" id="linearGradient3718">
- <stop style="stop-color:#ffffff;stop-opacity:1;" offset="0" id="stop3720"/>
- <stop style="stop-color:#ffffff;stop-opacity:0;" offset="1" id="stop3722"/>
- </linearGradient>
- <linearGradient id="linearGradient3632">
- <stop style="stop-color:#555753;stop-opacity:1;" offset="0" id="stop3634"/>
- <stop style="stop-color:#555753;stop-opacity:0;" offset="1" id="stop3636"/>
- </linearGradient>
- <linearGradient id="linearGradient3622">
- <stop style="stop-color:#babdb6;stop-opacity:0.16384181;" offset="0" id="stop3624"/>
- <stop id="stop3630" offset="0.5" style="stop-color:#babdb6;stop-opacity:1;"/>
- <stop style="stop-color:#babdb6;stop-opacity:0.33898309;" offset="1" id="stop3626"/>
- </linearGradient>
- <inkscape:perspective sodipodi:type="inkscape:persp3d" inkscape:vp_x="0 : 526.18109 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_z="744.09448 : 526.18109 : 1" inkscape:persp3d-origin="372.04724 : 350.78739 : 1" id="perspective10"/>
- <radialGradient inkscape:collect="always" xlink:href="#linearGradient3877" id="radialGradient3883" cx="-91.428575" cy="-37.637817" fx="-91.428575" fy="-37.637817" r="468.57144" gradientTransform="matrix(1,0,0,0.11890244,457.14286,801.12313)" gradientUnits="userSpaceOnUse"/>
- <filter inkscape:collect="always" id="filter3897" x="-0.052189089" width="1.1043782" y="-0.43892363" height="1.8778473">
- <feGaussianBlur inkscape:collect="always" stdDeviation="20.378597" id="feGaussianBlur3899"/>
- </filter>
- <linearGradient inkscape:collect="always" xlink:href="#linearGradient3622" id="linearGradient3954" gradientUnits="userSpaceOnUse" x1="360.5" y1="718.79077" x2="383.5" y2="718.79077"/>
- <linearGradient inkscape:collect="always" xlink:href="#linearGradient3622" id="linearGradient3956" gradientUnits="userSpaceOnUse" x1="427.57562" y1="716.20416" x2="465.04242" y2="691.96051"/>
- <linearGradient inkscape:collect="always" xlink:href="#linearGradient3622" id="linearGradient3958" gradientUnits="userSpaceOnUse" gradientTransform="matrix(-1,0,0,1,743.62054,0)" x1="427.57562" y1="716.20416" x2="465.04242" y2="691.96051"/>
- <linearGradient inkscape:collect="always" xlink:href="#linearGradient3622" id="linearGradient3960" gradientUnits="userSpaceOnUse" x1="360.5" y1="718.79077" x2="383.5" y2="718.79077"/>
- <linearGradient inkscape:collect="always" xlink:href="#linearGradient3782" id="linearGradient3962" gradientUnits="userSpaceOnUse" x1="252.44557" y1="377.28876" x2="637.08942" y2="732.86249"/>
- <linearGradient inkscape:collect="always" xlink:href="#linearGradient3718" id="linearGradient3964" gradientUnits="userSpaceOnUse" x1="73.20138" y1="286.6479" x2="669.65576" y2="286.6479"/>
- <linearGradient inkscape:collect="always" xlink:href="#linearGradient3718" id="linearGradient3970" gradientUnits="userSpaceOnUse" x1="73.20138" y1="286.6479" x2="669.65576" y2="286.6479" gradientTransform="translate(0,-48)"/>
- <linearGradient inkscape:collect="always" xlink:href="#linearGradient3782" id="linearGradient3975" gradientUnits="userSpaceOnUse" x1="252.44557" y1="377.28876" x2="637.08942" y2="732.86249" gradientTransform="translate(0,-48)"/>
- <linearGradient inkscape:collect="always" xlink:href="#linearGradient3622" id="linearGradient3980" gradientUnits="userSpaceOnUse" x1="360.5" y1="718.79077" x2="383.5" y2="718.79077" gradientTransform="matrix(1,0,0,0.84207554,0,45.31159)"/>
- <linearGradient inkscape:collect="always" xlink:href="#linearGradient3622" id="linearGradient3984" gradientUnits="userSpaceOnUse" gradientTransform="matrix(-1,0,0,1,743.62054,-48)" x1="427.57562" y1="716.20416" x2="465.04242" y2="691.96051"/>
- <linearGradient inkscape:collect="always" xlink:href="#linearGradient3622" id="linearGradient3987" gradientUnits="userSpaceOnUse" x1="427.57562" y1="716.20416" x2="465.04242" y2="691.96051" gradientTransform="translate(0,-48)"/>
- <linearGradient inkscape:collect="always" xlink:href="#linearGradient3622" id="linearGradient3990" gradientUnits="userSpaceOnUse" x1="360.5" y1="718.79077" x2="383.5" y2="718.79077" gradientTransform="translate(0,-48)"/>
- <filter height="1.2103233" y="-0.10516165" width="1.0759758" x="-0.037987912" id="filter3689" inkscape:collect="always">
- <feGaussianBlur id="feGaussianBlur3691" stdDeviation="7.2590033" inkscape:collect="always"/>
- </filter>
- <radialGradient gradientUnits="userSpaceOnUse" gradientTransform="matrix(1,0,0,0.36262332,0,256.11321)" r="229.80462" fy="401.82394" fx="-17.172595" cy="401.82394" cx="-17.172595" id="radialGradient3679" xlink:href="#linearGradient3673" inkscape:collect="always"/>
- <radialGradient r="266.9534" fy="630.30914" fx="225.84628" cy="630.30914" cx="225.84628" gradientTransform="matrix(0.84100005,0.01828779,-0.01372882,0.63134684,44.562947,287.28151)" gradientUnits="userSpaceOnUse" id="radialGradient3668" xlink:href="#linearGradient3639" inkscape:collect="always"/>
- <radialGradient r="266.9534" fy="630.30914" fx="225.84628" cy="630.30914" cx="225.84628" gradientTransform="matrix(0.84100005,0.01828779,-0.01372882,0.63134684,44.562947,287.28151)" gradientUnits="userSpaceOnUse" id="radialGradient3661" xlink:href="#linearGradient3639" inkscape:collect="always"/>
- <radialGradient r="266.9534" fy="630.30914" fx="225.84628" cy="630.30914" cx="225.84628" gradientTransform="matrix(0.84100005,0.01828779,-0.01372882,0.63134684,44.562947,287.28151)" gradientUnits="userSpaceOnUse" id="radialGradient3657" xlink:href="#linearGradient3639" inkscape:collect="always"/>
- <radialGradient r="266.9534" fy="630.30914" fx="225.84628" cy="630.30914" cx="225.84628" gradientTransform="matrix(0.84100005,0.01828779,-0.01372882,0.63134684,44.562947,287.28151)" gradientUnits="userSpaceOnUse" id="radialGradient3653" xlink:href="#linearGradient3639" inkscape:collect="always"/>
- <radialGradient r="266.9534" fy="630.30914" fx="225.84628" cy="630.30914" cx="225.84628" gradientTransform="matrix(0.84100005,0.01828779,-0.01372882,0.63134684,44.562947,287.28151)" gradientUnits="userSpaceOnUse" id="radialGradient3649" xlink:href="#linearGradient3639" inkscape:collect="always"/>
- <radialGradient gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.84100005,0.01828779,-0.01372882,0.63134684,44.562947,287.28151)" r="266.9534" fy="630.30914" fx="225.84628" cy="630.30914" cx="225.84628" id="radialGradient3645" xlink:href="#linearGradient3639" inkscape:collect="always"/>
- <inkscape:perspective id="perspective10-4" inkscape:persp3d-origin="372.04724 : 350.78739 : 1" inkscape:vp_z="744.09448 : 526.18109 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_x="0 : 526.18109 : 1" sodipodi:type="inkscape:persp3d"/>
- <linearGradient id="linearGradient3639" inkscape:collect="always">
- <stop id="stop3641" offset="0" style="stop-color:#ffffff;stop-opacity:1;"/>
- <stop id="stop3643" offset="1" style="stop-color:#ffffff;stop-opacity:0;"/>
- </linearGradient>
- <linearGradient id="linearGradient3673" inkscape:collect="always">
- <stop id="stop3675" offset="0" style="stop-color:#000000;stop-opacity:1;"/>
- <stop id="stop3677" offset="1" style="stop-color:#000000;stop-opacity:0;"/>
- </linearGradient>
- <radialGradient inkscape:collect="always" xlink:href="#linearGradient3673" id="radialGradient3540" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1,0,0,0.36262332,0,256.11321)" cx="-17.172595" cy="401.82394" fx="-17.172595" fy="401.82394" r="229.80462"/>
- <radialGradient inkscape:collect="always" xlink:href="#linearGradient3639" id="radialGradient3542" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.84100005,0.01828779,-0.01372882,0.63134684,44.562947,287.28151)" cx="225.84628" cy="630.30914" fx="225.84628" fy="630.30914" r="266.9534"/>
- <radialGradient inkscape:collect="always" xlink:href="#linearGradient3673" id="radialGradient3557" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1,0,0,0.36262332,0,256.11321)" cx="-17.172595" cy="401.82394" fx="-17.172595" fy="401.82394" r="229.80462"/>
- <radialGradient inkscape:collect="always" xlink:href="#linearGradient3639" id="radialGradient3559" gradientUnits="userSpaceOnUse" gradientTransform="matrix(0.84100005,0.01828779,-0.01372882,0.63134684,44.562947,287.28151)" cx="225.84628" cy="630.30914" fx="225.84628" fy="630.30914" r="266.9534"/>
- </defs>
- <sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="0.35" inkscape:cx="-501.32201" inkscape:cy="338.27094" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="false" inkscape:snap-to-guides="false" inkscape:snap-grids="false" inkscape:snap-nodes="false" inkscape:snap-global="false" showguides="true" inkscape:guide-bbox="true" inkscape:window-width="1280" inkscape:window-height="750" inkscape:window-x="-8" inkscape:window-y="-8" inkscape:window-maximized="1">
- <sodipodi:guide orientation="0,1" position="-260,911.42857" id="guide3591"/>
- <sodipodi:guide orientation="0,1" position="-165.71429,188.57143" id="guide3593"/>
- <sodipodi:guide orientation="1,0" position="734.28571,82.857143" id="guide3595"/>
- <sodipodi:guide orientation="1,0" position="11.428571,-57.142857" id="guide3597"/>
- <sodipodi:guide orientation="1,0" position="371.42857,380" id="guide3608"/>
- <sodipodi:guide orientation="0,1" position="662.85714,457.14286" id="guide3618"/>
- </sodipodi:namedview>
- <metadata id="metadata7">
- <rdf:RDF>
- <cc:Work rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
- <dc:title>slide audio</dc:title>
- <dc:date>April 2010</dc:date>
- <dc:creator>
- <cc:Agent>
- <dc:title>Franziska Sponsel</dc:title>
- </cc:Agent>
- </dc:creator>
- <dc:rights>
- <cc:Agent>
- <dc:title>Franziska Sponsel</dc:title>
- </cc:Agent>
- </dc:rights>
- <dc:publisher>
- <cc:Agent>
- <dc:title>RRZE</dc:title>
- </cc:Agent>
- </dc:publisher>
- <dc:subject>
- <rdf:Bag>
- <rdf:li>slide</rdf:li>
- <rdf:li>transperancy</rdf:li>
- <rdf:li>flip chart</rdf:li>
- <rdf:li>chart</rdf:li>
- <rdf:li>audio</rdf:li>
- <rdf:li>audiovisual</rdf:li>
- </rdf:Bag>
- </dc:subject>
- <dc:contributor>
- <cc:Agent>
- <dc:title>Beate Kaspar, Hendrik Eggers</dc:title>
- </cc:Agent>
- </dc:contributor>
- <cc:license rdf:resource="http://creativecommons.org/licenses/by-sa/3.0/"/>
- </cc:Work>
- <cc:License rdf:about="http://creativecommons.org/licenses/by-sa/3.0/">
- <cc:permits rdf:resource="http://creativecommons.org/ns#Reproduction"/>
- <cc:permits rdf:resource="http://creativecommons.org/ns#Distribution"/>
- <cc:requires rdf:resource="http://creativecommons.org/ns#Notice"/>
- <cc:requires rdf:resource="http://creativecommons.org/ns#Attribution"/>
- <cc:permits rdf:resource="http://creativecommons.org/ns#DerivativeWorks"/>
- <cc:requires rdf:resource="http://creativecommons.org/ns#ShareAlike"/>
- </cc:License>
- </rdf:RDF>
- </metadata>
- <g inkscape:label="Ebene 1" inkscape:groupmode="layer" id="layer1">
- <g id="g3561">
- <g id="g4012">
- <path style="opacity:0.67383513;fill:url(#radialGradient3883);fill-opacity:1;fill-rule:evenodd;stroke:none;filter:url(#filter3897)" d="m 834.28573,796.6479 c 0,30.77015 -209.78658,55.71428 -468.57145,55.71428 -258.78486,0 -468.57144,-24.94413 -468.57144,-55.71428 0,-30.77015 209.78658,-55.71429 468.57144,-55.71429 258.78487,0 468.57145,24.94414 468.57145,55.71429 z" id="path3870" transform="matrix(0.69356999,0,0,0.83614625,124.92298,67.676603)"/>
- <path style="color:#000000;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" d="m 11.428572,140.93361 722.857118,0 0,722.85712 -722.857118,0 0,-722.85712 z" id="rect2816"/>
- <g id="g3995">
- <path sodipodi:nodetypes="cc" style="fill:none;stroke:#000000;stroke-width:23;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" d="m 360.57143,556.64789 -101.84498,160.483" id="path3612"/>
- <path id="path3616" d="m 383.01216,556.64789 101.84498,160.483" style="fill:none;stroke:#000000;stroke-width:23;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" sodipodi:nodetypes="cc"/>
- <path sodipodi:nodetypes="cc" style="fill:none;stroke:url(#linearGradient3987);stroke-width:23;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" d="m 383.01216,556.64789 101.84498,160.483" id="path3644"/>
- <path id="path3654" d="M 360.60838,556.64789 258.7634,717.13089" style="fill:none;stroke:url(#linearGradient3984);stroke-width:23;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" sodipodi:nodetypes="cc"/>
- <path style="fill:none;stroke:#000000;stroke-width:21.10587502;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" d="m 372,552.54605 0,196.08331" id="path3658"/>
- <path id="path3660" d="m 372,552.54605 0,196.08331" style="fill:none;stroke:url(#linearGradient3980);stroke-width:21.10587502;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"/>
- <path id="rect3603" d="m 621.59375,233.78125 c -167.85572,0.94631 -335.77808,-0.60629 -503.59375,0.875 -4.44378,2.98782 -1.84363,9.82763 -2.83738,14.40624 0.49245,103.81734 -0.84434,207.7618 0.58738,311.50001 5.49238,6.43755 15.13492,2.18184 22.375,3.12551 162.98952,-0.0584 326.06371,0.64237 489,-0.40676 6.98823,-5.66489 2.26238,-15.83285 3.22202,-23.40625 -0.001,-101.12276 1.0551,-202.42904 -0.59702,-303.4375 -1.90131,-2.31888 -5.32648,-2.73149 -8.15625,-2.65625 z" style="color:#000000;fill:#babdb6;fill-opacity:1;fill-rule:evenodd;stroke:#888a85;stroke-width:20;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"/>
- <path id="path3662" d="m 125.15625,246.0625 c 0,102.57292 0,205.14583 0,307.71875 165.13542,0 330.27083,0 495.40625,0 0,-103.23958 0,-206.47917 0,-309.71875 -165.13542,0 -330.27083,0 -495.40625,0 l 0,1 0,1 z" style="opacity:0.74910398;color:#000000;fill:none;stroke:none;stroke-width:14;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"/>
- <path id="path3780" d="m 605.75,241.6875 c -160.74855,0.98338 -321.50186,-0.30623 -482.25,0.78125 -0.36312,104.46819 -0.65599,208.93888 0.0625,313.40625 166.33289,-0.51972 332.66919,0.61763 499,-0.65625 -0.76039,-104.51931 1.25082,-209.0544 -1.03125,-313.5625 -5.26039,0.0131 -10.5211,-0.0309 -15.78125,0.0312 z" style="opacity:0.75627238;color:#000000;fill:url(#linearGradient3975);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:20;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"/>
- <path id="path3696" d="m 131.37715,274.63703 c -1.17032,19.56551 -0.16516,39.49915 -0.50057,59.20594 0,70.79971 0,141.59941 0,212.39912 3.61034,4.05882 11.65949,0.78851 17.01966,1.8412 154.98113,0 309.96227,0 464.94339,0 4.41399,-3.31983 0.85751,-10.7213 2.00232,-15.65016 0,-85.52927 0,-171.05854 0,-256.58781 -3.61034,-4.05882 -11.65949,-0.7885 -17.01966,-1.8412 -154.98113,0 -309.96227,0 -464.9434,0 l -0.91011,0.38357 -0.59163,0.24934 z" style="color:#000000;fill:none;stroke:#ffffff;stroke-width:13.44045448;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"/>
- <path style="color:#000000;fill:#888a85;fill-opacity:1;fill-rule:evenodd;stroke:#555753;stroke-width:13;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" d="m 79.70138,215.49213 583.45438,0 0,46.31154 -583.45438,0 0,-46.31154 z" id="path3606"/>
- <path id="path3716" d="m 89.6875,227.5 c 0,8.10417 0,16.20833 0,24.3125 187.82292,0 375.64583,0 563.46875,0 0,-8.77083 0,-17.54167 0,-26.3125 -187.82292,0 -375.64583,0 -563.46875,0 l 0,1 0,1 z" style="opacity:0.69360268;color:#000000;fill:url(#linearGradient3970);fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:7;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"/>
- <path transform="matrix(0.78442893,-0.01960833,0.01960833,0.78442893,135.9589,100.42494)" d="M 257.58891,420.0067 87.209212,415.33991 176.44062,270.12016 257.58891,420.0067 z" inkscape:randomized="0" inkscape:rounded="0" inkscape:flatsided="true" sodipodi:arg2="1.59818" sodipodi:arg1="0.55098249" sodipodi:r2="49.202827" sodipodi:r1="98.405655" sodipodi:cy="368.48892" sodipodi:cx="173.74625" sodipodi:sides="3" id="path3757" style="fill:#3465a4;fill-opacity:1;fill-rule:nonzero;stroke:#204a87;stroke-width:7;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" sodipodi:type="star"/>
- <path id="rect3759" d="m 421.23359,350.79348 104.04573,0 0,104.04573 -104.04573,0 0,-104.04573 z" style="color:#000000;fill:#edd400;fill-opacity:1;fill-rule:evenodd;stroke:#c4a000;stroke-width:7;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"/>
- <path id="path3754" d="m 424.78402,451.8236 c 0,30.963 -25.10047,56.06347 -56.06347,56.06347 -30.96299,0 -56.06346,-25.10047 -56.06346,-56.06347 0,-30.96299 25.10047,-56.06346 56.06346,-56.06346 30.963,0 56.06347,25.10047 56.06347,56.06346 z" style="fill:#cc0000;fill-rule:evenodd;stroke:#a40000;stroke-width:7;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"/>
- </g>
- </g>
- <g transform="matrix(0.7373169,0,0,0.7373169,1094.041,225.61903)" id="g3550">
- <path style="opacity:0.44444442;fill:url(#radialGradient3557);fill-opacity:1;fill-rule:evenodd;stroke:none;filter:url(#filter3689)" d="m 212.13203,401.82394 c 0,45.74714 -102.66318,82.83252 -229.304624,82.83252 -126.641446,0 -229.304626,-37.08538 -229.304626,-82.83252 0,-45.74713 102.66318,-82.83251 229.304626,-82.83251 126.641444,0 229.304624,37.08538 229.304624,82.83251 z" id="path3670" transform="matrix(1.1146383,0,0,0.71787424,-757.13212,498.47301)"/>
- <g id="g3663" transform="matrix(0.76986668,0,0,0.76986668,-1015.2744,140.47471)">
- <path id="path3601" d="m 407.15179,106.625 0,507.3125 c -33.25046,-32.31145 -84.32093,-53 -141.59375,-53 -100.20023,0 -181.406254,63.32866 -181.406254,141.4375 0,78.10885 81.206024,141.40625 181.406254,141.40625 100.20024,0 181.4375,-63.2974 181.4375,-141.40625 0,-5.67397 -0.44786,-11.28196 -1.28125,-16.78125 l 0,-482.625 c 9.52033,39.16067 85.38568,25.52752 114.71875,68.40625 34.94685,51.08489 1.64832,222.52484 -3.59375,243.5625 2.45499,-6.037 10.3844,-24.65688 35.03125,-80.71875 46.82039,-106.49793 30.7096,-233.63144 -47.125,-252.84375 -73.96717,-18.2577 -94.76446,-60.57628 -99.03125,-71.59375 l 0,-3.15625 -38.5625,0 z m 149.6875,408.3125 c -1.85384,4.55873 -0.6875,2.15625 -0.6875,2.15625 0.0594,0.0891 0.32169,-0.68817 0.6875,-2.15625 z" style="fill:#555753;fill-rule:evenodd;stroke:#2e3436;stroke-width:14;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"/>
- <path id="path3619" d="m 437,116.375 c -6.59735,0.66736 -13.23183,0.0664 -19.84375,0.21875 0.14237,165.55621 -0.33299,331.16278 0.25,496.6875 2.95995,8.29165 -9.24921,16.81846 -15.34375,9.78125 -46.27145,-45.66393 -116.54398,-60.24595 -179.1653,-48.04047 -48.54916,9.41681 -96.76138,37.50931 -118.86595,83.04047 -15.163182,32.27865 -12.673368,72.2909 7.40625,101.71875 27.821,43.13831 78.71561,66.76941 128.625,72.53125 56.63899,6.74704 117.46591,-8.82415 159.53125,-48.03125 25.06378,-23.7214 41.01361,-58.22899 36.91015,-93.12113 -1.70028,-49.77197 -0.22128,-99.58787 -0.77903,-149.37886 -0.0551,-114.4056 0.003,-228.89909 0.0876,-343.25001 1.49726,-8.10802 14.94817,-10.60531 17.75,-2.125 2.5768,11.48364 12.57457,19.80341 23.55496,22.77391 27.93929,10.97144 61.13655,14.08164 83.13254,36.50734 19.09363,18.86844 23.32736,47.21619 25.09461,72.87299 2.1674,35.93439 -0.46435,72.05333 -5.03211,107.65826 18.08379,-41.5745 29.57971,-86.60931 27.58791,-132.31133 -1.20008,-33.00266 -9.18004,-67.33124 -31.49416,-92.68867 C 563.97579,197.92551 546.71496,190.70326 529.16671,187.49544 491.42329,176.10381 454.76954,152.74389 437.5,116.3125 l -0.5,0.0625 z" style="opacity:0.4;fill:none;stroke:#ffffff;stroke-width:7;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"/>
- <path id="path3637" d="m 438.1875,114.21875 c -7.49499,0.98493 -15.3901,0.10916 -23.03125,0.40625 0.0833,166.18786 -0.16669,332.45613 0.125,498.59375 2.85665,6.59471 -6.58582,14.2273 -11.8125,8.40625 C 359.86657,578.46388 294.72924,562.81942 234.94809,570.98886 186.24344,577.5849 137.65908,601.50027 110,643.28125 c -21.064401,31.64268 -23.997862,74.8593 -5.63293,108.29375 21.33564,40.64881 63.33841,66.4016 106.78918,77.425 60.11447,15.42727 127.94687,4.93539 177.71875,-32.875 29.92014,-22.78466 52.3267,-59.41196 49.96875,-98.375 -2.15518,-39.28125 -0.60629,-78.64601 -1.0848,-117.96875 -0.13535,-126.03651 -0.0136,-252.11436 0.0223,-378.125 -1.64762,-7.67075 10.79778,-12.37774 13.875,-4.6875 2.67662,10.46827 10.64405,19.42591 21.15625,22.625 27.97503,11.99889 61.39465,14.15858 84.3125,35.84375 18.93531,17.22092 23.73944,43.88654 25.8971,68.30891 3.07953,42.07705 -0.73594,84.48111 -6.5221,126.03484 17.54183,-38.5001 31.34925,-79.2309 33.08147,-121.80932 2.28167,-38.96402 -3.29184,-80.51209 -26.83706,-112.46679 -12.27263,-15.68983 -30.59,-25.92536 -50.23718,-29.09236 C 493.94398,175.29593 455.87491,151.75526 438.75,114.25 c -0.15144,-0.0477 -0.32942,-0.11743 -0.5625,-0.0312 z" style="opacity:0.6939057;fill:url(#radialGradient3559);fill-opacity:1;fill-rule:evenodd;stroke:none"/>
- </g>
- </g>
- </g>
- </g>
-</svg>
diff --git a/source/images/smaini.svg b/source/images/smaini.svg
deleted file mode 100644
index 4f949ad..0000000
--- a/source/images/smaini.svg
+++ /dev/null
@@ -1,14 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="85" height="38">
- <defs>
- <linearGradient id="interior" x1="0" x2="0" y1="0" y2="1">
- <stop offset="0" stop-color="#5c3e9a" />
- <stop offset="1" stop-color="#461f99" />
- </linearGradient>
- <linearGradient id="glass" x1="0" x2="0" y1="0" y2="1">
- <stop offset="0" stop-color="#ffffff" stop-opacity="0.2" />
- <stop offset="1" stop-color="#ffffff" stop-opacity="0.1" />
- </linearGradient>
- </defs>
- <rect x="1" y="1" width="83" height="36" rx="4" ry="4" stroke-width="1" stroke="#330099" fill="url(#interior)" />
- <rect x="2" y="2" width="81" height="18" stroke="none" fill="url(#glass)" />
-</svg>
diff --git a/source/images/smnsel.svg b/source/images/smnsel.svg
deleted file mode 100644
index 8a71555..0000000
--- a/source/images/smnsel.svg
+++ /dev/null
@@ -1,14 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="79" height="15">
- <defs>
- <linearGradient id="interior" x1="0" x2="0" y1="0" y2="1">
- <stop offset="0" stop-color="#aa80ff" />
- <stop offset="1" stop-color="#884dff" />
- </linearGradient>
- <linearGradient id="glass" x1="0" x2="0" y1="0" y2="1">
- <stop offset="0" stop-color="#ffffff" stop-opacity="0.2" />
- <stop offset="1" stop-color="#ffffff" stop-opacity="0.1" />
- </linearGradient>
- </defs>
- <rect x="0" y="0" width="79" height="15" rx="4" ry="4" stroke-width="1" stroke="none" fill="url(#interior)" />
- <rect x="1" y="1" width="77" height="7" stroke="none" fill="url(#glass)" />
-</svg>
diff --git a/source/images/smsel.svg b/source/images/smsel.svg
deleted file mode 100644
index 043c8e7..0000000
--- a/source/images/smsel.svg
+++ /dev/null
@@ -1,14 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="79" height="15">
- <defs>
- <linearGradient id="interior" x1="0" x2="0" y1="0" y2="1">
- <stop offset="0" stop-color="#5c3e9a" />
- <stop offset="1" stop-color="#461f99" />
- </linearGradient>
- <linearGradient id="glass" x1="0" x2="0" y1="0" y2="1">
- <stop offset="0" stop-color="#ffffff" stop-opacity="0.2" />
- <stop offset="1" stop-color="#ffffff" stop-opacity="0.1" />
- </linearGradient>
- </defs>
- <rect x="0" y="0" width="79" height="15" rx="4" ry="4" stroke-width="1" stroke="none" fill="url(#interior)" />
- <rect x="1" y="1" width="77" height="7" stroke="none" fill="url(#glass)" />
-</svg>
diff --git a/source/images/smsgfr.svg b/source/images/smsgfr.svg
deleted file mode 100644
index 5f1156f..0000000
--- a/source/images/smsgfr.svg
+++ /dev/null
@@ -1,16 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="193" height="111">
- <defs>
- <linearGradient id="interior" x1="0" x2="0" y1="0" y2="1">
- <stop offset="0" stop-color="#5c3e9a" />
- <stop offset="1" stop-color="#461f99" />
- </linearGradient>
- <linearGradient id="glass" x1="0" x2="0" y1="0" y2="1">
- <stop offset="0" stop-color="#ffffff" stop-opacity="0.2" />
- <stop offset="1" stop-color="#ffffff" stop-opacity="0.1" />
- </linearGradient>
- </defs>
- <rect x="0.5" y="0.5" width="192" height="110" rx="6" ry="6" stroke-width="1" stroke="#330099" fill="#ffffff" />
- <rect x="1" y="1" width="191" height="26" rx="5.5" ry="5.5" stroke="none" fill="url(#interior)" />
- <rect x="2" y="2" width="190" height="10" stroke="none" fill="url(#glass)" />
- <rect x="1" y="22" width="191" height="5" stroke="none" fill="#ffffff" />
-</svg>
diff --git a/source/images/snmaini.svg b/source/images/snmaini.svg
deleted file mode 100644
index 6c8accb..0000000
--- a/source/images/snmaini.svg
+++ /dev/null
@@ -1,14 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="85" height="38">
- <defs>
- <linearGradient id="interior" x1="0" x2="0" y1="0" y2="1">
- <stop offset="0" stop-color="#aa80ff" />
- <stop offset="1" stop-color="#884dff" />
- </linearGradient>
- <linearGradient id="glass" x1="0" x2="0" y1="0" y2="1">
- <stop offset="0" stop-color="#ffffff" stop-opacity="0.2" />
- <stop offset="1" stop-color="#ffffff" stop-opacity="0.1" />
- </linearGradient>
- </defs>
- <rect x="1" y="1" width="83" height="36" rx="4" ry="4" stroke-width="1" stroke="#7734ff" fill="url(#interior)" />
- <rect x="2" y="2" width="81" height="18" stroke="none" fill="url(#glass)" />
-</svg>
diff --git a/source/images/stitle.svg b/source/images/stitle.svg
deleted file mode 100644
index 1f1b374..0000000
--- a/source/images/stitle.svg
+++ /dev/null
@@ -1,11 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="256" height="33">
- <defs>
- <linearGradient id="gradient" x1="0" x2="0" y1="0" y2="1">
- <stop offset="0" stop-color="#5c3e9a" />
- <stop offset="1" stop-color="#461f99" />
- </linearGradient>
- </defs>
- <rect x="0" y="0" width="256" height="33" stroke="none" fill="#ffffff" />
- <rect x="0" y="0" width="256" height="31" stroke-width="1" stroke="none" fill="url(#gradient)" />
- <line x1="0" x2="256" y1="32.5" y2="32.5" stroke="#461f99" stroke-width="1" />
-</svg>
diff --git a/source/images/subsela.svg b/source/images/subsela.svg
deleted file mode 100644
index 929afcc..0000000
--- a/source/images/subsela.svg
+++ /dev/null
@@ -1,14 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="245" height="22">
- <defs>
- <linearGradient id="interior" x1="0" x2="0" y1="0" y2="1">
- <stop offset="0" stop-color="#5c3e9a" />
- <stop offset="1" stop-color="#461f99" />
- </linearGradient>
- <linearGradient id="glass" x1="0" x2="0" y1="0" y2="1">
- <stop offset="0" stop-color="#ffffff" stop-opacity="0.2" />
- <stop offset="1" stop-color="#ffffff" stop-opacity="0.1" />
- </linearGradient>
- </defs>
- <rect x="1" y="1" width="243" height="20" rx="4" ry="4" stroke-width="1" stroke="#330099" fill="url(#interior)" />
- <rect x="2" y="2" width="241" height="10" stroke="none" fill="url(#glass)" />
-</svg>
diff --git a/source/images/system-log-out.svg b/source/images/system-log-out.svg
deleted file mode 100644
index adb9521..0000000
--- a/source/images/system-log-out.svg
+++ /dev/null
@@ -1,457 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- inkscape:export-ydpi="90.000000"
- inkscape:export-xdpi="90.000000"
- inkscape:export-filename="/home/jimmac/Desktop/wi-fi.png"
- width="48px"
- height="48px"
- id="svg11300"
- sodipodi:version="0.32"
- inkscape:version="0.46"
- sodipodi:docbase="/home/jimmac/src/cvs/tango-icon-theme/scalable/actions"
- sodipodi:docname="system-log-out.svg"
- inkscape:output_extension="org.inkscape.output.svg.inkscape"
- sodipodi:modified="true">
- <defs
- id="defs3">
- <inkscape:perspective
- sodipodi:type="inkscape:persp3d"
- inkscape:vp_x="0 : 24 : 1"
- inkscape:vp_y="0 : 1000 : 0"
- inkscape:vp_z="48 : 24 : 1"
- inkscape:persp3d-origin="24 : 16 : 1"
- id="perspective70" />
- <linearGradient
- inkscape:collect="always"
- id="linearGradient6467">
- <stop
- style="stop-color:#babdb6;stop-opacity:1;"
- offset="0"
- id="stop6469" />
- <stop
- style="stop-color:#babdb6;stop-opacity:0;"
- offset="1"
- id="stop6471" />
- </linearGradient>
- <linearGradient
- inkscape:collect="always"
- id="linearGradient6365">
- <stop
- style="stop-color:#ffffff;stop-opacity:1;"
- offset="0"
- id="stop6367" />
- <stop
- style="stop-color:#ffffff;stop-opacity:0;"
- offset="1"
- id="stop6369" />
- </linearGradient>
- <linearGradient
- id="linearGradient6347">
- <stop
- style="stop-color:#4e9a06;stop-opacity:1;"
- offset="0"
- id="stop6349" />
- <stop
- style="stop-color:#2d5903;stop-opacity:1;"
- offset="1"
- id="stop6351" />
- </linearGradient>
- <linearGradient
- id="linearGradient9896">
- <stop
- id="stop9898"
- offset="0"
- style="stop-color:#cecece;stop-opacity:1;" />
- <stop
- id="stop9900"
- offset="1.0000000"
- style="stop-color:#9e9e9e;stop-opacity:1.0000000;" />
- </linearGradient>
- <linearGradient
- id="linearGradient9888"
- inkscape:collect="always">
- <stop
- id="stop9890"
- offset="0"
- style="stop-color:#ffffff;stop-opacity:1;" />
- <stop
- id="stop9892"
- offset="1"
- style="stop-color:#ffffff;stop-opacity:0;" />
- </linearGradient>
- <linearGradient
- id="linearGradient9880"
- inkscape:collect="always">
- <stop
- id="stop9882"
- offset="0"
- style="stop-color:#525252;stop-opacity:1;" />
- <stop
- id="stop9884"
- offset="1"
- style="stop-color:#525252;stop-opacity:0;" />
- </linearGradient>
- <linearGradient
- id="linearGradient9868">
- <stop
- style="stop-color:#4e4e4e;stop-opacity:1.0000000;"
- offset="0.0000000"
- id="stop9870" />
- <stop
- style="stop-color:#616161;stop-opacity:0.0000000;"
- offset="1.0000000"
- id="stop9872" />
- </linearGradient>
- <linearGradient
- id="linearGradient9854">
- <stop
- id="stop9856"
- offset="0.0000000"
- style="stop-color:#4e4e4e;stop-opacity:1.0000000;" />
- <stop
- id="stop9858"
- offset="1.0000000"
- style="stop-color:#ababab;stop-opacity:1.0000000;" />
- </linearGradient>
- <linearGradient
- id="linearGradient9830">
- <stop
- id="stop9832"
- offset="0.0000000"
- style="stop-color:#505050;stop-opacity:1.0000000;" />
- <stop
- id="stop9834"
- offset="1.0000000"
- style="stop-color:#181818;stop-opacity:1.0000000;" />
- </linearGradient>
- <linearGradient
- inkscape:collect="always"
- id="linearGradient8662">
- <stop
- style="stop-color:#000000;stop-opacity:1;"
- offset="0"
- id="stop8664" />
- <stop
- style="stop-color:#000000;stop-opacity:0;"
- offset="1"
- id="stop8666" />
- </linearGradient>
- <linearGradient
- inkscape:collect="always"
- id="linearGradient8650">
- <stop
- style="stop-color:#ffffff;stop-opacity:1;"
- offset="0"
- id="stop8652" />
- <stop
- style="stop-color:#ffffff;stop-opacity:0;"
- offset="1"
- id="stop8654" />
- </linearGradient>
- <radialGradient
- inkscape:collect="always"
- xlink:href="#linearGradient8650"
- id="radialGradient8656"
- cx="19.701141"
- cy="2.8969381"
- fx="19.701141"
- fy="2.8969381"
- r="17.171415"
- gradientTransform="matrix(1.253442,-2.296195e-16,1.747460e-16,0.953900,-15.47908,11.27663)"
- gradientUnits="userSpaceOnUse" />
- <radialGradient
- r="15.644737"
- fy="36.421127"
- fx="24.837126"
- cy="36.421127"
- cx="24.837126"
- gradientTransform="matrix(1.000000,0.000000,0.000000,0.536723,1.673575e-15,16.87306)"
- gradientUnits="userSpaceOnUse"
- id="radialGradient9826"
- xlink:href="#linearGradient8662"
- inkscape:collect="always" />
- <linearGradient
- gradientUnits="userSpaceOnUse"
- y2="27.759069"
- x2="18.031221"
- y1="19.804117"
- x1="46.845825"
- id="linearGradient9864"
- xlink:href="#linearGradient9854"
- inkscape:collect="always"
- gradientTransform="translate(-12.020815,0)" />
- <radialGradient
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(2.565823,0,0,1.403262,-49.804045,-9.483303)"
- r="9.7227182"
- fy="7.1396070"
- fx="27.883883"
- cy="7.1396070"
- cx="27.883883"
- id="radialGradient9876"
- xlink:href="#linearGradient9868"
- inkscape:collect="always" />
- <linearGradient
- gradientTransform="translate(-13.136935,0)"
- gradientUnits="userSpaceOnUse"
- y2="24.764584"
- x2="34.007416"
- y1="19.107729"
- x1="31.852951"
- id="linearGradient9886"
- xlink:href="#linearGradient9880"
- inkscape:collect="always" />
- <linearGradient
- gradientUnits="userSpaceOnUse"
- y2="43.449947"
- x2="19.755548"
- y1="13.663074"
- x1="8.7600641"
- id="linearGradient9894"
- xlink:href="#linearGradient9888"
- inkscape:collect="always" />
- <linearGradient
- gradientUnits="userSpaceOnUse"
- y2="18.064039"
- x2="33.710651"
- y1="21.511185"
- x1="31.078955"
- id="linearGradient9902"
- xlink:href="#linearGradient9896"
- inkscape:collect="always"
- gradientTransform="translate(-12.020815,0)" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient6365"
- id="linearGradient6371"
- x1="40.25"
- y1="31.625"
- x2="40.25"
- y2="43.25"
- gradientUnits="userSpaceOnUse"
- gradientTransform="translate(-12.020815,0)" />
- <filter
- inkscape:collect="always"
- x="-0.14153846"
- width="1.2830769"
- y="-0.10415094"
- height="1.2083019"
- id="filter6421">
- <feGaussianBlur
- inkscape:collect="always"
- stdDeviation="2.07"
- id="feGaussianBlur6423" />
- </filter>
- <filter
- inkscape:collect="always"
- x="-0.066812893"
- width="1.1336258"
- y="-0.11952912"
- height="1.2390582"
- id="filter6451">
- <feGaussianBlur
- inkscape:collect="always"
- stdDeviation="0.76879489"
- id="feGaussianBlur6453" />
- </filter>
- <radialGradient
- inkscape:collect="always"
- xlink:href="#linearGradient8662"
- id="radialGradient6461"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(1,0,0,0.536723,0,16.87306)"
- cx="24.837126"
- cy="36.421127"
- fx="24.837126"
- fy="36.421127"
- r="15.644737" />
- <radialGradient
- inkscape:collect="always"
- xlink:href="#linearGradient8650"
- id="radialGradient6463"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(1.253442,0,0,0.9539,-15.47908,11.27663)"
- cx="19.701141"
- cy="2.8969381"
- fx="19.701141"
- fy="2.8969381"
- r="17.171415" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient9888"
- id="linearGradient6465"
- gradientUnits="userSpaceOnUse"
- x1="8.7600641"
- y1="13.663074"
- x2="19.755548"
- y2="43.449947"
- gradientTransform="matrix(0.968718,0,0,0.9689198,0.3616813,0.7378237)" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient6467"
- id="linearGradient6473"
- x1="18.729185"
- y1="44"
- x2="18.729185"
- y2="29.068014"
- gradientUnits="userSpaceOnUse" />
- </defs>
- <sodipodi:namedview
- stroke="#a40000"
- fill="#727e0a"
- id="base"
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="0.25490196"
- inkscape:pageopacity="0.0"
- inkscape:pageshadow="2"
- inkscape:zoom="1"
- inkscape:cx="-103.37653"
- inkscape:cy="5.4914491"
- inkscape:current-layer="layer1"
- showgrid="false"
- inkscape:grid-bbox="true"
- inkscape:document-units="px"
- inkscape:showpageshadow="false"
- inkscape:window-width="966"
- inkscape:window-height="762"
- inkscape:window-x="468"
- inkscape:window-y="86" />
- <metadata
- id="metadata4">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:creator>
- <cc:Agent>
- <dc:title>Jakub Steiner</dc:title>
- </cc:Agent>
- </dc:creator>
- <dc:source>http://jimmac.musichall.cz</dc:source>
- <cc:license
- rdf:resource="http://creativecommons.org/licenses/publicdomain/" />
- <dc:title>System Log Out</dc:title>
- <dc:subject>
- <rdf:Bag>
- <rdf:li>log out</rdf:li>
- <rdf:li>logout</rdf:li>
- <rdf:li>exit</rdf:li>
- </rdf:Bag>
- </dc:subject>
- </cc:Work>
- <cc:License
- rdf:about="http://creativecommons.org/licenses/publicdomain/">
- <cc:permits
- rdf:resource="http://creativecommons.org/ns#Reproduction" />
- <cc:permits
- rdf:resource="http://creativecommons.org/ns#Distribution" />
- <cc:permits
- rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
- </cc:License>
- </rdf:RDF>
- </metadata>
- <g
- id="layer1"
- inkscape:label="Layer 1"
- inkscape:groupmode="layer">
- <rect
- ry="0.7071048"
- rx="0.70710522"
- y="2.5692098"
- x="1.4809071"
- height="41.942028"
- width="31.99555"
- id="rect9828"
- style="opacity:1;color:#000000;fill:#eeeeec;fill-opacity:1;fill-rule:evenodd;stroke:#555753;stroke-width:1.00000048;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- inkscape:r_cx="true"
- inkscape:r_cy="true" />
- <rect
- y="17.240852"
- x="1.9791847"
- height="26.759148"
- width="30.999998"
- id="rect9840"
- style="opacity:1;color:#000000;fill:url(#linearGradient6473);fill-opacity:1.0;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- inkscape:r_cx="true"
- inkscape:r_cy="true" />
- <path
- style="opacity:0.55428569;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;filter:url(#filter6451)"
- d="M 2.1041847,43.875 L 23.479185,35 C 23.479185,35 26.992726,32.780416 23.729185,31.5 C 20.314184,30.16016 16.729185,32 16.729185,32 L 2.1041847,43.875 z "
- id="path6425"
- sodipodi:nodetypes="cczcc" />
- <path
- sodipodi:nodetypes="ccccc"
- id="path9852"
- d="M 2.0168467,43.944859 L 1.9780137,3.0545252 L 21.92031,3.0987194 L 21.964504,33.018175 L 2.0168467,43.944859 z "
- style="opacity:1;color:#000000;fill:url(#linearGradient9864);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
- <path
- style="opacity:0.42222224;color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:block;overflow:visible"
- d="M 1.9489857,43.944859 L 22.097088,33.062369 L 3.5355337,41.989592 L 3.5355337,3.0103306 L 1.9650707,3.0103306 L 1.9489857,43.944859 z "
- id="path1360"
- inkscape:r_cx="true"
- inkscape:r_cy="true"
- sodipodi:nodetypes="cccccc" />
- <path
- style="opacity:1;color:#000000;fill:url(#radialGradient9876);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- d="M 2.0239957,43.757359 L 1.9791847,3.0545252 L 21.92031,3.0545252 L 21.741064,33.681088 L 2.0239957,43.757359 z "
- id="path9866"
- sodipodi:nodetypes="ccccc"
- inkscape:r_cx="true"
- inkscape:r_cy="true" />
- <path
- sodipodi:nodetypes="cccsscc"
- id="path9878"
- d="M 17.62221,18.456195 L 19.544657,20.908971 L 18.086249,25.726136 C 18.086249,25.726136 18.351414,27.228738 19.124812,26.212272 C 19.89821,25.195806 22.097267,22.630218 21.710171,20.754291 C 21.422909,19.362175 20.627414,18.699263 20.627414,18.699263 L 17.62221,18.456195 z "
- style="opacity:1;color:#000000;fill:url(#linearGradient9886);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
- <path
- sodipodi:nodetypes="csccscs"
- id="path9862"
- d="M 19.456269,17.35134 C 19.456269,17.35134 21.619539,18.353058 21.688074,19.229593 C 21.789855,20.531315 17.445433,24.665476 17.445433,24.665476 C 16.9372,25.284194 16.097511,24.731767 16.56155,24.135146 C 16.56155,24.135146 20.028154,20.017173 19.809822,19.693631 C 19.536211,19.288174 17.843181,18.655068 17.843181,18.655068 C 16.826715,17.903768 18.110802,16.349605 19.456269,17.35134 z "
- style="opacity:1;color:#000000;fill:url(#linearGradient9902);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
- <path
- style="fill:url(#linearGradient6371);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;filter:url(#filter6421);opacity:0.87428571"
- d="M 22.229185,3.5 L 21.729185,33.25 L 3.7291847,43 L 32.979185,43.25 L 32.729185,3.5 L 22.229185,3.5 z "
- id="path6355" />
- <g
- id="g6455"
- transform="matrix(-1,0,0,1,48.201368,-4.7335e-2)">
- <path
- transform="matrix(0.77849,0,0,0.77849,-7.579815,1.598139)"
- d="M 40.481863 36.421127 A 15.644737 8.3968935 0 1 1 9.1923885,36.421127 A 15.644737 8.3968935 0 1 1 40.481863 36.421127 z"
- sodipodi:ry="8.3968935"
- sodipodi:rx="15.644737"
- sodipodi:cy="36.421127"
- sodipodi:cx="24.837126"
- id="path8660"
- style="opacity:0.29946522;color:#000000;fill:url(#radialGradient6461);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- sodipodi:type="arc" />
- <path
- sodipodi:nodetypes="cccccccc"
- id="path8643"
- d="M 1.7317981,17.593819 L 1.7317981,30.355364 L 9.6641034,30.355364 L 9.6641034,36.176147 L 21.887745,23.952503 L 9.5913424,11.656101 L 9.5913424,17.597067 L 1.7317981,17.593819 z "
- style="opacity:1;color:#000000;fill:#cc0000;fill-opacity:1;fill-rule:evenodd;stroke:#a40000;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
- <path
- sodipodi:nodetypes="cccccc"
- id="path8645"
- d="M 9.9240084,12.478043 L 9.9240084,18.115661 L 2.0746151,18.115661 L 2.0746151,24.53144 C 12.332521,20.703863 11.954992,27.773987 21.29428,23.94641 L 9.9240084,12.478043 z "
- style="opacity:0.5080214;color:#000000;fill:url(#radialGradient6463);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" />
- <path
- style="opacity:0.48128339;color:#000000;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient6465);stroke-width:1.00000012;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible"
- d="M 2.6834412,18.565933 L 2.6834412,29.355867 L 10.584702,29.355867 L 10.584702,33.481479 L 20.127982,23.941908 L 10.522155,13.997214 L 10.522155,18.568726 L 2.6834412,18.565933 z "
- id="path8658"
- sodipodi:nodetypes="cccccccc" />
- </g>
- </g>
-</svg>
diff --git a/source/memmap.cpp b/source/memmap.cpp
index 9ff1c02..037d357 100644
--- a/source/memmap.cpp
+++ b/source/memmap.cpp
@@ -111,8 +111,6 @@
#include "spc7110.h"
#include "seta.h"
-#include "unzip/unzip.h"
-
#ifdef DS2_DMA
//#include "ds2_cpu.h"
//#include "ds2_dma.h"
diff --git a/source/nds/bdf_font.c b/source/nds/bdf_font.c
deleted file mode 100644
index aff3b94..0000000
--- a/source/nds/bdf_font.c
+++ /dev/null
@@ -1,1086 +0,0 @@
-/* bdf_font.c
- *
- * Copyright (C) 2010 dking <dking024@gmail.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public Licens e as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-//v1.1
-
-#include "port.h"
-#include <string.h>
-#include "ds2_types.h"
-#include "ds2_malloc.h"
-#include "ds2io.h"
-#include "fs_api.h"
-#include "bdf_font.h"
-#include "gui.h"
-
-
-#define BDF_PICTOCHAT "SYSTEM/Pictochat-16.bdf"
-#define BDF_SONG "SYSTEM/song.bdf"
-#define ODF_PICTOCHAT "SYSTEM/Pictochat-16.odf"
-#define ODF_SONG "SYSTEM/song.odf"
-
-#define HAVE_ODF // Define this if you have generated Pictochat-16.odf [Neb]
-// #define DUMP_ODF // Define this if you want to regenerate Pictochat-16.odf [Neb]
-
-#define BDF_LIB_NUM 2
-#define ODF_VERSION "1.0"
-
-struct bdflibinfo bdflib_info[BDF_LIB_NUM];
-struct bdffont *bdf_font; //ASCII charactor
-struct bdffont *bdf_nasci; //non-ASCII charactor
-static u32 font_height;
-static u32 fonts_max_height;
-
-/*-----------------------------------------------------------------------------
-------------------------------------------------------------------------------*/
-static u32 bitmap_code(unsigned char *code, unsigned char *bitmap)
-{
- unsigned char *map;
- u8 a, b;
- u32 len;
-
- len= 0;
- map= (unsigned char*)bitmap;
- while(*map)
- {
- // One hex character represents the state of 4 successive pixels
- if(*map != 0x0A)
- {
- if (*map <= '9') a= *map - '0';
- else if (*map <= 'F') a= *map - 'A' + 10;
- else if (*map <= 'f') a= *map - 'a' + 10;
- map++;
-
- if (*map <= '9') b= *map - '0';
- else if (*map <= 'F') b= *map - 'A' + 10;
- else if (*map <= 'f') b= *map - 'a' + 10;
-
- *code++ = (a << 4) | b;
- len++;
- }
- map++;
- }
-
- return len;
-}
-
-/*-----------------------------------------------------------------------------
-------------------------------------------------------------------------------*/
-/*
-* example
-*
-* STARTCHAR <arbitrary number or name>
-* ENCODING 8804
-* SWIDTH 840 0
-* DWIDTH 14 0
-* BBX 10 12 2 1
-* BITMAP
-* 00C0
-* 0300
-* 1C00
-* 6000
-* 8000
-* 6000
-* 1C00
-* 0300
-* 00C0
-* 0000
-* 0000
-* FFC0
-* ENDCHAR
-*/
-
-/*-----------------------------------------------------------------------------
-* filename: bdf file's name, including path
-* start: the coding of first font to parse
-* span: number of fonts begin at start to parse
-* *bdflibinfop: font library information
-* method: font index method; 0-absolut sequence; 1-relative sequence; 2-compact;
-* others reserved
-* return: if error return < 0; else return= char numbers
-------------------------------------------------------------------------------*/
-static int parse_bdf(char *filename, u32 start, u32 span, struct bdflibinfo *bdflibinfop, u32 method)
-{
- FILE *fp;
- char string[256];
- char map[256];
- char *pt;
- unsigned char *bitbuff;
- int num, x_off, y_off, ret;
- u32 tmp, i, end, length, index;
- struct bdffont *bdffontp;
-
- //initial bdflibinfo
- bdflibinfop -> width= 0;
- bdflibinfop -> height= 0;
- bdflibinfop -> start= 0;
- bdflibinfop -> span= 0;
- bdflibinfop -> maplen= 0;
- bdflibinfop -> mapmem= NULL;
- bdflibinfop -> fonts= NULL;
-
- fp= fopen(filename, "r"); //Open bdf font library
- if(fp == NULL)
- return -1;
-
- ret= 0;
- //SIZE
- while(1)
- {
- pt= fgets(string, 255, fp);
- if(pt == NULL)
- {
- ret= -2;
- goto parse_bdf_error;
- }
- if(!(strncasecmp(string, "SIZE ", 5)))
- break;
- }
-
- //FONTBOUNDINGBOX
- pt= fgets(string, 255, fp);
- pt += 16;
- bdflibinfop -> width= atoi(pt);
- pt = 1 + strchr(pt, ' ');
- bdflibinfop -> height= atoi(pt);
- pt = 1 + strchr(pt, ' ');
- x_off= atoi(pt);
- pt = 1 + strchr(pt, ' ');
- y_off= atoi(pt);
-
- //CHARS
- while(1)
- {
- pt= fgets(string, 255, fp);
- if(pt == NULL)
- {
- ret= -3;
- goto parse_bdf_error;
- }
- if(!(strncasecmp(string, "CHARS ", 6)))
- break;
- }
- pt += 6;
- ret= atoi(pt);
-
- if (method == 1)
- bdflibinfop -> start= start;
- switch (method) {
- case 0:
- default:
- bdflibinfop -> span= span + start;
- break;
- case 1:
- bdflibinfop -> span= span;
- break;
- }
-
- //construct bdf font information
- bdffontp= (struct bdffont*)malloc(span * sizeof(struct bdffont));
- if(bdffontp == NULL)
- {
- ret= -4;
- goto parse_bdf_error;
- }
- bdflibinfop -> fonts= bdffontp;
-
- bitbuff= (unsigned char*)malloc((bdflibinfop -> width * bdflibinfop -> height * span) >> 3);
- if(bitbuff == NULL)
- {
- ret= -5;
- goto parse_bdf_error;
- }
- bdflibinfop -> mapmem= bitbuff;
-
- tmp= bdflibinfop -> width << 16;
- for(i= 0; i < span; i++)
- {
- bdffontp[i].dwidth= tmp;
- bdffontp[i].bbx= 0;
- }
-
- end= start + span;
- //STARTCHAR START
- while(1)
- {
- pt= fgets(string, 255, fp);
- if(pt == NULL)
- {
- ret= -6;
- goto parse_bdf_error;
- }
- if(!(strncasecmp(string, "STARTCHAR ", 10)))
- {
- break;
- }
- }
-
- i= 0;
- length= 0;
- while(1)
- {
- //ENCODING
- while(1)
- {
- pt= fgets(string, 255, fp);
- if(pt == NULL) goto parse_bdf_error;
- if(!(strncasecmp(string, "ENCODING ", 9))) break;
- }
-
- pt= string + 9;
- index= atoi(pt);
- if(index < start || index >= end) break;
-
- if(method == 0) i= index;
- else if(method == 1) i= index-start;
- else i++;
-
- //SWIDTH
- pt= fgets(string, 255, fp);
- if(pt == NULL) {ret= -8; goto parse_bdf_error;}
-
- //DWIDTH
- pt= fgets(string, 255, fp);
- if(pt == NULL) {ret= -9; goto parse_bdf_error;}
-
- pt += 7;
- num= atoi(pt);
- tmp= num << 16;
- pt= 1+ strchr(pt, ' ');
- num= atoi(pt);
- tmp |= num & 0xFFFF;
-
- bdffontp[i].dwidth= tmp;
-
- //BBX
- pt= fgets(string, 255, fp);
- if(pt == NULL) {ret= -10; goto parse_bdf_error;}
-
- pt += 4;
- num= atoi(pt);
- tmp= num & 0xFF;
-
- pt= 1+ strchr(pt, ' ');
- num= atoi(pt);
- tmp= tmp<<8 | (num & 0xFF);
-
- pt= 1+ strchr(pt, ' ');
- num= atoi(pt);
- num= num - x_off;
- tmp= tmp<<8 | (num & 0xFF);
-
- pt= 1+ strchr(pt, ' ');
- num= atoi(pt);
- num= num - y_off;
- tmp= tmp <<8 | (num & 0xFF);
-
- bdffontp[i].bbx= tmp;
-
- //BITMAP
- pt= fgets(string, 255, fp);
- if(pt == NULL) {ret= -11; goto parse_bdf_error;}
-
- map[0]= '\0';
- while(1)
- {
- pt= fgets(string, 255, fp);
- if(pt == NULL) {ret= -12; goto parse_bdf_error;}
- if(!strncasecmp(pt, "ENDCHAR", 7)) break;
- strcat(map, pt);
- }
-
- tmp = bitmap_code(bitbuff, (unsigned char*)map);
-
- if(tmp)
- bdffontp[i].bitmap = bitbuff;
- else
- bdffontp[i].bitmap = NULL;
-
- bitbuff += tmp;
- length += tmp;
- }
-
-parse_bdf_error:
- fclose(fp);
- if(ret < 0)
- {
- if(bdflibinfop -> fonts != NULL)
- free((void*)bdflibinfop -> fonts);
- if(bdflibinfop -> mapmem != NULL)
- free((void*)bdflibinfop -> mapmem);
- bdflibinfop -> fonts = NULL;
- bdflibinfop -> mapmem = NULL;
- }
- else
- {
- bdflibinfop -> maplen = length;
- bdflibinfop -> mapmem = (unsigned char*)realloc((void*)bdflibinfop -> mapmem, length);
- }
-
- return ret;
-}
-
-/*-----------------------------------------------------------------------------
-------------------------------------------------------------------------------*/
-int dump2odf(char *filename, struct bdflibinfo *bdflibinfop)
-{
- char *pt;
- char string[256];
- FILE *fp;
- u32 mapaddr;
- u32 fontaddr;
- u32 num;
- char buff[1024];
- u32 i, j;
-
-
- strcpy(string, filename);
- pt= strrchr(string, '.');
- if(!strcasecmp(pt, ".bdf"))
- strcpy(pt, ".odf");
- else
- return -1;
-
- fp= fopen(string, "wb");
- if(fp == NULL)
- return -2;
-
- pt= buff;
- strcpy(pt, "ODF");
- pt += 4;
- strcpy(pt, ODF_VERSION);
- pt += 4;
-
- struct bdflibinfo *bdflibinfo_i;
-
- memcpy(pt, (char*)bdflibinfop, sizeof(struct bdflibinfo));
- bdflibinfo_i= (struct bdflibinfo *)pt;
- bdflibinfo_i -> mapmem= NULL;
- bdflibinfo_i -> fonts= NULL;
- pt += sizeof(struct bdflibinfo);
-
- num= pt-buff;
- fwrite(buff, num, 1, fp); //write odf file header
-
- num= (u32)bdflibinfop -> span;
- mapaddr= (u32)bdflibinfop -> mapmem;
- fontaddr= (u32)bdflibinfop -> fonts;
-
- while(num)
- {
- struct bdffont *bdffontp;
-
- i= 1024/sizeof(struct bdffont);
- if(num > i) num -= i;
- else i= num, num= 0;
-
- memcpy(buff, (char*)fontaddr, i*sizeof(struct bdffont));
- fontaddr += i*sizeof(struct bdffont);
- bdffontp= (struct bdffont*)buff;
-
- for(j= 0; j< i; j++)
- bdffontp[j].bitmap -= mapaddr;
-
- fwrite(buff, i*sizeof(struct bdffont), 1, fp);
- }
-
- fwrite((char*)mapaddr, bdflibinfop -> maplen, 1, fp);
-
- fclose(fp);
- return 0;
-}
-
-/*-----------------------------------------------------------------------------
-------------------------------------------------------------------------------*/
-int init_from_odf(char *filename, struct bdflibinfo *bdflibinfop)
-{
- FILE *fp;
- char buff[512];
- char *pt;
- u32 len, tmp;
- u32 span, maplen;
- struct bdffont *bdffontp;
-
- //initial bdflibinfo
- bdflibinfop -> width= 0;
- bdflibinfop -> height= 0;
- bdflibinfop -> start= 0;
- bdflibinfop -> span= 0;
- bdflibinfop -> maplen= 0;
- bdflibinfop -> mapmem= NULL;
- bdflibinfop -> fonts= NULL;
-
- fp= fopen(filename, "rb");
- if(fp == NULL)
- return -1;
-
- tmp= 8 + sizeof(struct bdflibinfo);
- len= fread(buff, 1, tmp, fp);
- if(len < tmp)
- {
- fclose(fp);
- return -2;
- }
-
- pt= buff;
- if(strcmp(pt, "ODF"))
- {
- fclose(fp);
- return -2;
- }
-
- pt += 4;
- if(strcmp(pt, ODF_VERSION))
- {
- fclose(fp);
- return -3;
- }
-
- pt += 4;
- memcpy((char*)bdflibinfop, pt, sizeof(struct bdflibinfo));
-
- span= bdflibinfop -> span;
- if(span == 0)
- {
- fclose(fp);
- return -4;
- }
-
- maplen= bdflibinfop -> maplen;
- if(maplen == 0)
- {
- fclose(fp);
- return -5;
- }
-
- bdffontp= (struct bdffont*)malloc(span * sizeof(struct bdffont));
- if(bdffontp == NULL)
- {
- fclose(fp);
- return -6;
- }
-
- len= fread((char*)bdffontp, 1, span * sizeof(struct bdffont), fp);
- if(len != span * sizeof(struct bdffont))
- {
- free((void*)bdffontp);
- fclose(fp);
- return -7;
- }
-
- pt= (char*)malloc(maplen);
- len= fread(pt, 1, maplen, fp);
- if(len != maplen)
- {
- free((void*)bdffontp);
- free((void*)pt);
- fclose(fp);
- return -8;
- }
-
- bdflibinfop -> mapmem = (unsigned char*)pt;
- bdflibinfop -> fonts = bdffontp;
-
- u32 i, j;
- j= (u32)bdflibinfop -> mapmem;
- for(i= 0; i < span; i++)
- bdffontp[i].bitmap += j;
-
- fclose(fp);
- return 0;
-}
-
-int BDF_font_init(void)
-{
- int err;
- char tmp_path[MAX_PATH];
-
- fonts_max_height= 0;
-#ifndef HAVE_ODF
- sprintf(tmp_path, "%s/%s", main_path, BDF_PICTOCHAT);
- err= parse_bdf(tmp_path, 32 /* from SPACE */, 8564 /* to one past the last character, "DOWNWARDS ARROW" */, &bdflib_info[0], 1);
- if(err < 0)
- {
- printf("BDF 0 initial error: %d\n", err);
- return -1;
- }
-#else
- sprintf(tmp_path, "%s/%s", main_path, ODF_PICTOCHAT);
- err= init_from_odf(tmp_path, &bdflib_info[0]);
- if(err < 0)
- {
- printf("ODF 0 initial error: %d\n", err);
- return -1;
- }
-#endif
- bdf_font= bdflib_info[0].fonts;
- font_height= bdflib_info[0].height;
- if(fonts_max_height < bdflib_info[0].height)
- fonts_max_height = bdflib_info[0].height;
-
-#ifdef DUMP_ODF
- sprintf(tmp_path, "%s/%s", main_path, BDF_PICTOCHAT);
- err= dump2odf(tmp_path, &bdflib_info[0]);
- if(err < 0)
- {
- printf("BDF dump odf 0 error: %d\n", err);
- }
-#endif
-
-#ifndef HAVE_ODF
- sprintf(tmp_path, "%s/%s", main_path, BDF_SONG);
- err= parse_bdf(tmp_path, 0x4E00, 20902, &bdflib_info[1], 1);
- if(err < 0)
- {
- printf("BDF 1 initial error: %d\n", err);
- return -1;
- }
-#else
- sprintf(tmp_path, "%s/%s", main_path, ODF_SONG);
- err= init_from_odf(tmp_path, &bdflib_info[1]);
- if(err < 0)
- {
- printf("ODF 1 initial error: %d\n", err);
- return -1;
- }
-#endif
- bdf_nasci= bdflib_info[1].fonts;
- if(fonts_max_height < bdflib_info[1].height)
- fonts_max_height = bdflib_info[1].height;
-
-#ifdef DUMP_ODF
- sprintf(tmp_path, "%s/%s", main_path, BDF_SONG);
- err= dump2odf(tmp_path, &bdflib_info[1]);
- if(err < 0)
- {
- printf("BDF dump odf 1 error: %d\n", err);
- }
-#endif
-
- return 0;
-}
-
-/*-----------------------------------------------------------------------------
-// release resource of BDF fonts
-------------------------------------------------------------------------------*/
-void BDF_font_release(void)
-{
- u32 i;
-
- for(i= 0; i < BDF_LIB_NUM; i++)
- {
- if(bdflib_info[i].fonts)
- free((void*)bdflib_info[i].fonts);
- if(bdflib_info[i].mapmem)
- free((void*)bdflib_info[i].mapmem);
- }
-}
-
-/*----------------------------------------------------------------------------
-//16-bit color
-// Unicode Character
-// back is background, 0x8000 is transparence, other are visable colors
-------------------------------------------------------------------------------*/
-u32 BDF_render16_ucs(void* screen_address, u32 screen_w, u32 v_align, u32 back, u32 front, u16 ch)
-{
- unsigned short *screen, *screenp;
- unsigned char *map;
- u32 width, height, x_off, y_off, i, k, m, ret, fonts_height;
- unsigned char cc;
- struct bdffont *bdffontp;
-
- int font_num;
- bool found = 0;
- for (font_num = 0; font_num < BDF_LIB_NUM && !found; font_num++) {
- if(bdflib_info[font_num].fonts != NULL)
- {
- k = bdflib_info[font_num].start;
- if (ch < k)
- continue;
- m = k + bdflib_info[font_num].span;
- if (ch >= m)
- continue;
- ch -= k;
- bdffontp= bdflib_info[font_num].fonts;
- fonts_height= bdflib_info[font_num].height;
- found = 1;
- }
- }
- if (!found)
- return 8; // the width of an undefined character, not an error code
-
- width= bdffontp[ch].dwidth >> 16;
- ret= width;
- height= fonts_max_height;
- //if charactor is not transparent
- if(!(back & 0x8000))
- {
- for(k= 0; k < height; k++)
- {
- screenp= (unsigned short*)screen_address + k *screen_w;
- for(i= 0; i < width; i++)
- *screenp++ = back;
- }
- }
-
- width= bdffontp[ch].bbx >> 24;
- if(width == 0)
- return ret;
-
- height= (bdffontp[ch].bbx >> 16) & 0xFF;
- x_off= (bdffontp[ch].bbx >> 8) & 0xFF;
- y_off= bdffontp[ch].bbx & 0xFF;
-
- if(v_align== 0) //v align bottom
- screen= (unsigned short*)screen_address + x_off + (fonts_max_height - height - y_off) *screen_w;
- else if(v_align== 1) //v align center
- screen= (unsigned short*)screen_address + x_off + (fonts_max_height - height - y_off)/2 *screen_w;
- else //v align top
- screen= (unsigned short*)screen_address + x_off;
-
- x_off= width >> 3;
- y_off= width & 7;
-
- map= bdffontp[ch].bitmap;
- for(k= 0; k < height; k++)
- {
- screenp = screen + k *screen_w;
- i= x_off;
- while(i--)
- {
- m= 0x80;
- cc= *map++;
- while(m)
- {
- if(m & cc) *screenp = front;
- screenp++;
- m >>= 1;
- }
- }
-
- i= y_off;
- if(i)
- {
- i= 8 - y_off;
- cc= *map++;
- cc >>= i;
- m= 0x80 >> i;
- while(m)
- {
- if(m & cc) *screenp = front;
- screenp++;
- m >>= 1;
- }
- }
- }
-
- return ret;
-}
-
-/* Returns the width, in pixels, of a character given its UCS-16 codepoint. */
-u32 BDF_width16_ucs(u16 ch)
-{
- u32 k, ret;
-
- int font_num;
- for (font_num = 0; font_num < BDF_LIB_NUM; font_num++) {
- if(bdflib_info[font_num].fonts != NULL)
- {
- k = bdflib_info[font_num].start;
- if (ch < k)
- continue;
- if (ch > k + bdflib_info[font_num].span)
- continue;
- ch -= k;
- return bdflib_info[font_num].fonts[ch].dwidth >> 16;
- }
- }
- return 8; // the width of an undefined character, not an error code
-}
-
-/*-----------------------------------------------------------------------------
-//16-bit color
-// ASCII Character
-// back is background, 0x8000 is transparence, other are visable colors
-------------------------------------------------------------------------------*/
-static u32 BDF_render16_font(char *screen_address, u32 back, u32 front, u16 ch)
-{
- unsigned short *screen, *screenp;
- unsigned char *map;
- u32 width, height, x_off, y_off, i, k, m, ret;
- unsigned char cc;
-
- if(ch > 127)
- return 8;
-
- width= bdf_font[ch].dwidth >> 16;
- ret= width;
- height= font_height;
- //if charactor is not transparent
- if(!(back & 0x8000))
- {
- for(k= 0; k < height; k++)
- {
- screenp= (unsigned short*)screen_address + k *SCREEN_WIDTH;
- for(i= 0; i < width; i++)
- *screenp++ = back;
- }
- }
-
- width= bdf_font[ch].bbx >> 24;
- if(width == 0)
- return ret;
- height= (bdf_font[ch].bbx >> 16) & 0xFF;
- x_off= (bdf_font[ch].bbx >> 8) & 0xFF;
- y_off= bdf_font[ch].bbx & 0xFF;
- screen= (unsigned short*)screen_address + x_off + (font_height - height -y_off) *SCREEN_WIDTH;
-
- x_off= width >> 3;
- y_off= width & 7;
-
- map= bdf_font[ch].bitmap;
- for(k= 0; k < height; k++)
- {
- screenp = screen + k *SCREEN_WIDTH;
- i= x_off;
- while(i--)
- {
- m= 0x80;
- cc= *map++;
- while(m)
- {
- if(m & cc) *screenp = front;
- screenp++;
- m >>= 1;
- }
- }
-
- i= y_off;
- if(i)
- {
- i= 8 - y_off;
- cc= *map++;
- cc >>= i;
- m= 0x80 >> i;
- while(m)
- {
- if(m & cc) *screenp = front;
- screenp++;
- m >>= 1;
- }
- }
- }
-
- return ret;
-}
-
-/*-----------------------------------------------------------------------------
-// ASCII Code Only
-------------------------------------------------------------------------------*/
-void BDF_render_string(void* screen_address, u32 x, u32 y, u32 back, u32 front, char *string)
-{
- char *pt;
- u32 screenp, line_start;
- u32 width, line, cmp;
-
- pt= string;
- screenp= (u32)screen_address + (x + y *SCREEN_WIDTH)*2;
- line= 1 + y;
- line_start= (u32)screen_address + line *SCREEN_WIDTH *2;
-
- width= 0;
- while(*pt)
- {
- if(*pt == 0x0D)
- {
- pt++;
- continue;
- }
- if(*pt == 0x0A)
- {
- line += font_height;
- line_start= (u32)screen_address + line *SCREEN_WIDTH *2;
- screenp = line_start - SCREEN_WIDTH *2;
- pt++;
- continue;
- }
-
- cmp = (bdf_font[(u32)(*pt)].dwidth >> 16) << 1;
- if((screenp+cmp) >= line_start)
- {
- line += font_height;
- line_start= (u32)screen_address + line *SCREEN_WIDTH *2;
- screenp = line_start - SCREEN_WIDTH *2;
- }
- width= BDF_render16_font((char*)screenp, back, front, (u32)(*pt));
- screenp += width*2;
- pt++;
- }
-}
-
-/*-----------------------------------------------------------------------------
-------------------------------------------------------------------------------*/
-char* utf8decode(char *utf8, u16 *ucs)
-{
- unsigned char c = *utf8++;
- unsigned long code;
- int tail = 0;
-
- if ((c <= 0x7f) || (c >= 0xc2)) {
- /* Start of new character. */
- if (c < 0x80) { /* U-00000000 - U-0000007F, 1 byte */
- code = c;
- } else if (c < 0xe0) { /* U-00000080 - U-000007FF, 2 bytes */
- tail = 1;
- code = c & 0x1f;
- } else if (c < 0xf0) { /* U-00000800 - U-0000FFFF, 3 bytes */
- tail = 2;
- code = c & 0x0f;
- } else if (c < 0xf5) { /* U-00010000 - U-001FFFFF, 4 bytes */
- tail = 3;
- code = c & 0x07;
- } else {
- /* Invalid size. */
- code = 0;
- }
-
- while (tail-- && ((c = *utf8++) != 0)) {
- if ((c & 0xc0) == 0x80) {
- /* Valid continuation character. */
- code = (code << 6) | (c & 0x3f);
-
- } else {
- /* Invalid continuation char */
- code = 0xfffd;
- utf8--;
- break;
- }
- }
- } else {
- /* Invalid UTF-8 char */
- code = 0;
- }
- /* currently we don't support chars above U-FFFF */
- *ucs = (code < 0x10000) ? code : 0;
- return utf8;
-}
-
-unsigned char* skip_utf8_unit(unsigned char* utf8, unsigned int num)
-{
- while(num--)
- {
- unsigned char c = *utf8++;
- int tail = 0;
- if ((c <= 0x7f) || (c >= 0xc2)) {
- /* Start of new character. */
- if (c < 0x80) { /* U-00000000 - U-0000007F, 1 byte */
- } else if (c < 0xe0) { /* U-00000080 - U-000007FF, 2 bytes */
- tail = 1;
- } else if (c < 0xf0) { /* U-00000800 - U-0000FFFF, 3 bytes */
- tail = 2;
- } else if (c < 0xf5) { /* U-00010000 - U-001FFFFF, 4 bytes */
- tail = 3;
- } else { /* Invalid size. */
- }
-
- while (tail-- && ((c = *utf8++) != 0)) {
- if ((c & 0xc0) != 0x80) {
- /* Invalid continuation char */
- utf8--;
- break;
- }
- }
- }
- }
-
- /* currently we don't support chars above U-FFFF */
- return utf8;
-}
-
-/*-----------------------------------------------------------------------------
-// UTF8 Code String
-------------------------------------------------------------------------------*/
-void BDF_render_mix(void* screen_address, u32 screen_w, u32 x, u32 y, u32 v_align,
- u32 back, u32 front, char *string)
-{
- char *pt;
- u32 screenp, line_start;
- u32 width, line, cmp, start, end;
- u16 unicode;
- struct bdffont *bdf_fontp[2];
-
- bdf_fontp[0]= bdflib_info[0].fonts;
- start= bdflib_info[1].start;
- end= start + bdflib_info[1].span;
- bdf_fontp[1]= bdflib_info[1].fonts;
-
- pt= string;
- screenp= (u32)screen_address + (x + y *screen_w)*2;
- line= 1 + y;
- line_start= (u32)screen_address + line *screen_w *2;
-
- width= 0;
- while(*pt)
- {
- pt= utf8decode(pt, &unicode);
-
- if(unicode == 0x0D) continue;
- if(unicode == 0x0A)
- {
- line += font_height;
- line_start= (u32)screen_address + line *screen_w *2;
- screenp = line_start - screen_w *2;
- continue;
- }
-
- /* If the text would go beyond the end of the line, go back to the
- * start instead. */
- cmp = BDF_width16_ucs(unicode);
-
- if((screenp+cmp) >= line_start)
- {
- line += font_height;
- line_start= (u32)screen_address + line *screen_w *2;
- screenp = line_start - screen_w *2;
- }
-
- width= BDF_render16_ucs((unsigned short*)screenp, screen_w, v_align, back, front, unicode);
- screenp += width*2;
- }
-}
-
-/*-----------------------------------------------------------------------------
-- count UNICODE charactor numbers in width pixels, input are UTF8, not UNICODE-16
-- direction 0: count UNICODE charactor numbers in width pixels, from end,
-- return bytes numbers
-- direction 1: count UNICODE charactor numbers in width pixels, from front,
-- return bytes numbers
-- direction 2: count total pixel width of the string
-------------------------------------------------------------------------------*/
-u32 BDF_cut_string(char *string, u32 width, u32 direction)
-{
- char *pt;
- u16 unicode[256];
- u32 len, xw;
-
- if(direction > 2) return -1;
-
- pt= string;
- len= 0;
- while(*pt)
- {
- pt= utf8decode(pt, &unicode[len]);
- if(unicode[len] != 0x0A)
- {
- len++;
- if(len >= 256) break;
- }
- }
-
- if(len >= 256) return -1;
-
- u16 *unicodep;
- if(direction == 0)
- unicodep= &unicode[len-1];
- else
- unicodep= &unicode[0];
-
- if(direction == 2) direction = 3;
- xw= BDF_cut_unicode(unicodep, len, width, direction);
-
- if(direction < 2)
- {
- if(direction < 1)
- xw= len - xw;
-
- pt= string;
- while(xw)
- {
- pt= utf8decode(pt, unicodep);
- if(unicode[xw] != 0x0A) xw--;
- }
-
- xw= pt -string;
- }
-
- return xw;
-}
-
-/*-----------------------------------------------------------------------------
-- count UNICODE charactor numbers in width pixels
-- direction 0: count UNICODE charactor numbers in width pixels, from end
-- direction 1: count UNICODE charactor numbers in width pixels, from front
-- direction 2: conut total pixel width of len UNICODE charachtors, from end
-- direction 3: conut total pixel width of len UNICODE charachtors, from front
-------------------------------------------------------------------------------*/
-u32 BDF_cut_unicode(u16 *unicodes, u32 len, u32 width, u32 direction)
-{
- u32 i, lastSpace = 0, xw, num;
- u16 unicode;
- u32 start, end;
- struct bdffont *bdf_fontp[2];
-
- bdf_fontp[0]= bdflib_info[0].fonts;
- start= bdflib_info[1].start;
- end= start + bdflib_info[1].span;
- bdf_fontp[1]= bdflib_info[1].fonts;
-
- if(direction < 2)
- {
- if(direction < 1) direction = -1;
-
- i= 0;
- xw = 0;
- num= len;
- while(len > 0)
- {
- unicode= unicodes[i];
- if (unicode == 0x0A)
- return num - len;
- else if (unicode == ' ')
- lastSpace = len;
-
- xw += BDF_width16_ucs(unicode);
-
- if(xw > width) return num - lastSpace;
- i += direction;
- len--;
- }
-
- return num - len;
- }
- else
- {
- if(direction < 3) direction = -1;
- else direction = 1;
-
- i= 0;
- xw = 0;
- while(len-- > 0)
- {
- unicode= unicodes[i];
- xw += BDF_width16_ucs(unicode);
- i += direction;
- }
-
- num= xw;
-
- return num;
- }
-}
-
-
diff --git a/source/nds/bdf_font.h b/source/nds/bdf_font.h
deleted file mode 100644
index 074f5de..0000000
--- a/source/nds/bdf_font.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* bdf_font.h
- *
- * Copyright (C) 2010 dking <dking024@gmail.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public Licens e as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __BDF_FONT_H__
-#define __BDF_FONT_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct bdffont{
- unsigned int dwidth; //byte 3:2 x-distance; 1:0 y-distance
- unsigned int bbx; //byte 3 x-width; 2 y-height; 1 x-offset; 0 y-offset
- unsigned char *bitmap;
-};
-
-struct bdflibinfo{
- unsigned int width;
- unsigned int height;
- unsigned int start;
- unsigned int span;
- unsigned int maplen;
- unsigned char *mapmem;
- struct bdffont *fonts;
-};
-
-
-/*-----------------------------------------------------------------------------
-------------------------------------------------------------------------------*/
-extern int BDF_font_init(void);
-extern void BDF_render_string(void* screen_address, unsigned int x, unsigned int y, unsigned int back,
- unsigned int front, char *string);
-extern unsigned int BDF_render16_ucs(void* screen_address, unsigned int screen_w,
- unsigned int v_align, unsigned int back, unsigned int front, unsigned short ch);
-extern void BDF_render_mix(void* screen_address, unsigned int screen_w, unsigned int x,
- unsigned int y, unsigned int v_align, unsigned int back, unsigned int front, char *string);
-//extern unsigned int BDF_string_width(char *string, unsigned int *len);
-extern char* utf8decode(char *utf8, unsigned short *ucs);
-extern unsigned char* skip_utf8_unit(unsigned char* utf8, unsigned int num);
-extern unsigned int BDF_cut_unicode(unsigned short *unicodes, unsigned int len, unsigned int width, unsigned int direction);
-extern unsigned int BDF_cut_string(char *string, unsigned int width, unsigned int direction);
-extern void BDF_font_release(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //__BDF_FONT_H__
diff --git a/source/nds/bitmap.c b/source/nds/bitmap.c
deleted file mode 100644
index efeb11c..0000000
--- a/source/nds/bitmap.c
+++ /dev/null
@@ -1,224 +0,0 @@
-/* bitmap.c
- *
- * Copyright (C) 2010 dking <dking024@gmail.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public Licens e as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-//v1.1
-
-#include "fs_api.h"
-#include "bitmap.h"
-#include "ds2_malloc.h"
-
-int BMP_read(char* filename, char *buf, unsigned int width, unsigned int height, unsigned int* type)
-{
- FILE* fp;
- BMPHEADER bmp_header;
- int flag;
- u32 bytepixel;
- u32 x, y, sx, sy, m;
- unsigned char *dest;
- s32 fpos;
- unsigned short st[54/2];
-
- fp= fopen(filename, "rb");
- if(fp == NULL)
- return BMP_ERR_OPENFAILURE;
-
- flag= fread(st, sizeof(st), 1, fp);
- if(!flag) {
- fclose(fp);
- return BMP_ERR_FORMATE;
- }
-
- bmp_header.bfType= st[0];
- bmp_header.bfSize= st[1] | (st[2]<<16);
- bmp_header.bfReserved0= st[3];
- bmp_header.bfReserved1= st[4];
- bmp_header.bfImgoffst= st[5] | (st[6]<<16);
- bmp_header.bfImghead.imHeadsize= st[7] | (st[8]<<16);
- bmp_header.bfImghead.imBitmapW= st[9] | (st[10]<<16);
- bmp_header.bfImghead.imBitmapH= st[11] | (st[12]<<16);
- bmp_header.bfImghead.imPlanes= st[13];
- bmp_header.bfImghead.imBitpixel= st[14];
- bmp_header.bfImghead.imCompess= st[15] | (st[16]<<16);
- bmp_header.bfImghead.imImgsize= st[17] | (st[18]<<16);
- bmp_header.bfImghead.imHres= st[19] | (st[20]<<16);
- bmp_header.bfImghead.imVres= st[21] | (st[22]<<16);
- bmp_header.bfImghead.imColnum= st[23] | (st[24]<<16);
- bmp_header.bfImghead.imImcolnum= st[25] | (st[26]<<16);
-
- if(bmp_header.bfType != 0x4D42) { //"BM"
- fclose(fp);
- return BMP_ERR_FORMATE;
- }
-
- if(bmp_header.bfImghead.imCompess != BI_RGB &&
- bmp_header.bfImghead.imCompess != BI_BITFIELDS) {
- fclose(fp);
- return BMP_ERR_NEED_GO_ON; //This funciton now not support...
- }
-
- bytepixel= bmp_header.bfImghead.imBitpixel >> 3;
- if(bytepixel < 2) { //byte per pixel >= 2
- fclose(fp);
- return BMP_ERR_NEED_GO_ON; //This funciton now not support...
- }
-
- *type = bytepixel;
-
- x= width;
- y= height;
- sx= bmp_header.bfImghead.imBitmapW;
- sy= bmp_header.bfImghead.imBitmapH;
- if(x > sx)
- x= sx;
- if(y > sy)
- y= sy;
-
- // Expect a certain amount of bytes and read them all at once.
- unsigned int BytesPerLine = (sx * bytepixel + 3) & ~3;
- char* FileBuffer = (char*) malloc(BytesPerLine * (sy - 1) + sx * bytepixel);
- if (FileBuffer == NULL) {
- fclose(fp);
- return BMP_ERR_NEED_GO_ON; // Memory allocation error
- }
-
- fseek(fp, (s32) bmp_header.bfImgoffst, SEEK_SET);
- m = fread(FileBuffer, 1, BytesPerLine * (sy - 1) + sx * bytepixel, fp);
-
- if (m < BytesPerLine * (sy - 1) + sx * bytepixel) {
- free(FileBuffer);
- fclose(fp);
- return BMP_ERR_FORMATE; // incomplete file
- }
-
- // Reorder all the bytes, because scanlines are from bottom to top.
- for (m = 0; m < y; m++) {
- memcpy(buf + m * x * bytepixel, FileBuffer + (sy - m - 1) * BytesPerLine, x * bytepixel);
- }
-
- free(FileBuffer);
- fclose(fp);
-
- return BMP_OK;
-}
-
-/*
-* open BMP file
-*/
-int openBMP(BMPINFO* bmpInfo, const char* file)
-{
- FILE* fp;
- unsigned short st[54/2];
- int len;
-
- bmpInfo->fp = NULL;
-
- fp = fopen(file, "r");
- if(NULL == fp)
- return BMP_ERR_OPENFAILURE;
-
- len = fread((void*)st, 1, sizeof(BMPHEADER), fp);
- if(len < sizeof(BMPHEADER)) {
- fclose(fp);
- return BMP_ERR_FORMATE;
- }
-
- bmpInfo->bmpHead.bfType= st[0];
- bmpInfo->bmpHead.bfSize= st[1] | (st[2]<<16);
- bmpInfo->bmpHead.bfReserved0= st[3];
- bmpInfo->bmpHead.bfReserved1= st[4];
- bmpInfo->bmpHead.bfImgoffst= st[5] | (st[6]<<16);
- bmpInfo->bmpHead.bfImghead.imHeadsize= st[7] | (st[8]<<16);
- bmpInfo->bmpHead.bfImghead.imBitmapW= st[9] | (st[10]<<16);
- bmpInfo->bmpHead.bfImghead.imBitmapH= st[11] | (st[12]<<16);
- bmpInfo->bmpHead.bfImghead.imPlanes= st[13];
- bmpInfo->bmpHead.bfImghead.imBitpixel= st[14];
- bmpInfo->bmpHead.bfImghead.imCompess= st[15] | (st[16]<<16);
- bmpInfo->bmpHead.bfImghead.imImgsize= st[17] | (st[18]<<16);
- bmpInfo->bmpHead.bfImghead.imHres= st[19] | (st[20]<<16);
- bmpInfo->bmpHead.bfImghead.imVres= st[21] | (st[22]<<16);
- bmpInfo->bmpHead.bfImghead.imColnum= st[23] | (st[24]<<16);
- bmpInfo->bmpHead.bfImghead.imImcolnum= st[25] | (st[26]<<16);
-
- if(bmpInfo->bmpHead.bfType != 0x4D42) //"BM"
- {
- fclose(fp);
- return BMP_ERR_FORMATE;
- }
-
- if(bmpInfo->bmpHead.bfImghead.imCompess != BI_RGB &&
- bmpInfo->bmpHead.bfImghead.imCompess != BI_BITFIELDS)
- {
- fclose(fp);
- return BMP_ERR_NEED_GO_ON; //This funciton now not support...
- }
-
- bmpInfo->fp = fp;
-
- return BMP_OK;
-}
-
-/*
-* read pixel form BMP file
-*/
-int readBMP(BMPINFO* bmpInfo, unsigned int start_x, unsigned int start_y,
- unsigned int width, unsigned int height, void* buffer)
-{
- unsigned int m, n;
- unsigned int bmp_w, bmp_h;
- int fpos;
- unsigned char* dst;
- unsigned int bytepixel;
-
- bytepixel = bmpInfo->bmpHead.bfImghead.imBitpixel >> 3;
- if(bytepixel < 2) //Not support <2 bytes per pixel now
- return -1;
-
- //BMP scan from down to up
- bmp_w = bmpInfo->bmpHead.bfImghead.imBitmapW;
- bmp_h = bmpInfo->bmpHead.bfImghead.imBitmapH;
- if(((start_x +1) > bmp_w) || ((start_y+1) > bmp_h)) return -1;
- n = bmp_w - start_x;
- if(n > width) n = width; //start_x + width < bmp_w
- m = bmp_h - start_y;
- if(m > height) m = height; //start_y + height < bmp_h
-
- fpos = (int)bmpInfo->bmpHead.bfImgoffst;
-
- fpos += (((bmp_w*bytepixel+3)>>2)<<2)*(bmp_h - start_y -1) + start_x*bytepixel;
- dst = (unsigned char*)buffer;
- n *= bytepixel;
- while(m--) {
- fseek(bmpInfo->fp, fpos, SEEK_SET);
- fread(dst, 1, n, bmpInfo->fp);
- fpos -= ((bmp_w*bytepixel+3)>>2)<<2;
- dst += width*bytepixel;
- }
-
- return 0;
-}
-
-/*
-* close BMP file
-*/
-void closeBMP(BMPINFO* bmpInfo)
-{
- if(NULL != bmpInfo->fp)
- fclose(bmpInfo->fp);
-}
-
-
diff --git a/source/nds/bitmap.h b/source/nds/bitmap.h
deleted file mode 100644
index c8f9c52..0000000
--- a/source/nds/bitmap.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/* bitmap.c
- *
- * Copyright (C) 2010 dking <dking024@gmail.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public Licens e as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __BITMAP_H__
-#define __BITMAP_H__
-#include "ds2_types.h"
-#include "fs_api.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct _pixelmapheader{
- u32 imHeadsize; //Bitmap information header size
- u32 imBitmapW; //bitmap width in pixel
- u32 imBitmapH; //bitmap height in pixel
- u16 imPlanes; //bitmap planes numbers, must be set to 1
- u16 imBitpixel; //bits per pixel
- u32 imCompess; //compress method
- u32 imImgsize; //image size, times of 4-byte
- u32 imHres; //horizontal resolution, pixel/metel
- u32 imVres; //vertical resolution, pixel/metel
- u32 imColnum; //number of colors in color palette, 0 to exp(2)
- u32 imImcolnum; //important colors numbers used
-} IMAGEHEADER;
-
-
-typedef struct _bitmapfileheader{
- u16 bfType; //BMP file types
- u32 bfSize; //BMP file size(Not the pixel image size)
- u16 bfReserved0;//reserved area0
- u16 bfReserved1;//reserved area1
- u32 bfImgoffst; //pixel data area offset
- IMAGEHEADER bfImghead;
-} BMPHEADER;
-
-
-typedef struct _bitmapInfo{
- FILE* fp;
- BMPHEADER bmpHead;
-} BMPINFO;
-
-//#define NULL 0
-
-//compression method
-/* Value Identified by Compression method Comments
-* 0 BI_RGB none Most common
-* 1 BI_RLE8 RLE 8-bit/pixel Can be used only with 8-bit/pixel bitmaps
-* 2 BI_RLE4 RLE 4-bit/pixel Can be used only with 4-bit/pixel bitmaps
-* 3 BI_BITFIELDS Bit field Can be used only with 16 and 32-bit/pixel bitmaps.
-* 4 BI_JPEG JPEG The bitmap contains a JPEG image
-* 5 BI_PNG PNG The bitmap contains a PNG image
-*/
-#define BI_RGB 0
-#define BI_RLE8 1
-#define BI_RLE4 2
-#define BI_BITFIELDS 3
-#define BI_JPEG 4
-#define BI_PNG 5
-
-//error message
-#define BMP_OK 0
-#define BMP_ERR_OPENFAILURE 1
-#define BMP_ERR_FORMATE 2
-#define BMP_ERR_NOTSUPPORT 3
-#define BMP_ERR_NEED_GO_ON 4
-
-
-#define FILEOPENCHECK(fp) (fp!=NULL)
-
-
-extern int BMP_read(char* filename, char *buf, unsigned int width,
- unsigned int height, unsigned int *type);
-
-/*
-* open BMP file
-*/
-extern int openBMP(BMPINFO* bmpInfo, const char* file);
-
-/*
-* read pixel form BMP file
-*/
-extern int readBMP(BMPINFO* bmpInfo, unsigned int start_x, unsigned int start_y,
- unsigned int width, unsigned int height, void* buffer);
-
-/*
-* close BMP file
-*/
-extern void closeBMP(BMPINFO* bmpInfo);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //__BITMAP_H__
diff --git a/source/nds/cheatgrp.c b/source/nds/cheatgrp.c
deleted file mode 100644
index 75513e8..0000000
--- a/source/nds/cheatgrp.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/* cheatgrp.c
- *
- * Copyright (C) 2013 GBAtemp user Nebuleon.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "cheatgrp.h"
-#include "string.h"
-#include "ds2_malloc.h"
-
-extern struct SCheatData Cheat;
-
-/*
- * Obtains the names of cheat groups currently defined in the Snes9x cheat
- * data.
- * Cheats are grouped by name, because multipart codes share the same name
- * when loaded.
- * This function only handles consecutive codes with the same name. If two
- * runs of codes have the same name, two identically-named groups will be
- * written. Enabling or disabling either of these groups will also enable
- * or disable the other if using NDSSFCEnableCheatGroup or
- * NDSSFCDisableCheatGroup.
- * OUT: NamePointers, an array of MAX_CHEATS_T + 1 pointers which are updated
- * by this function. All pointers beyond the last group name are updated
- * to point to NULL.
- * NameMemory, an array of MAX_CHEATS_T * MAX_SFCCHEAT_NAME char values
- * which is updated to hold the names of the groups.
- */
-void NDSSFCGetCheatGroups (char** NamePointers, char* NameMemory)
-{
- unsigned int NameIndex = 0, cheat;
- char* dst = NameMemory;
- for (cheat = 0; cheat < Cheat.num_cheats; cheat++)
- {
- if (cheat == 0 || strcmp(Cheat.c [cheat].name, Cheat.c [cheat - 1].name) != 0)
- {
- memcpy(dst, Cheat.c [cheat].name, MAX_SFCCHEAT_NAME * sizeof (char));
- NamePointers[NameIndex] = dst;
- dst += MAX_SFCCHEAT_NAME;
- NameIndex++;
- }
- }
- for (; NameIndex < MAX_CHEATS_T + 1; NameIndex++)
- {
- NamePointers[NameIndex] = NULL;
- }
-}
-
-void NDSSFCEnableCheatGroup (char* GroupName)
-{
- uint32 cheat;
- for (cheat = 0; cheat < Cheat.num_cheats; cheat++)
- {
- if (strcmp(Cheat.c [cheat].name, GroupName) == 0)
- {
- S9xEnableCheat (cheat);
- }
- }
-}
-
-void NDSSFCDisableCheatGroup (char* GroupName)
-{
- uint32 cheat;
- for (cheat = 0; cheat < Cheat.num_cheats; cheat++)
- {
- if (strcmp(Cheat.c [cheat].name, GroupName) == 0)
- {
- S9xDisableCheat (cheat);
- }
- }
-}
-
-bool8 NDSSFCIsCheatGroupEnabled (char* GroupName)
-{
- bool8 NameFound = FALSE;
- uint32 cheat;
- for (cheat = 0; cheat < Cheat.num_cheats; cheat++)
- {
- if (strcmp(Cheat.c [cheat].name, GroupName) == 0)
- {
- if (!Cheat.c [cheat].enabled)
- return FALSE;
- NameFound = TRUE;
- }
- }
- return NameFound;
-}
diff --git a/source/nds/cheatgrp.h b/source/nds/cheatgrp.h
deleted file mode 100644
index d84549a..0000000
--- a/source/nds/cheatgrp.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* cheatgrp.h
- *
- * Copyright (C) 2013 GBAtemp user Nebuleon.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "port.h"
-#include "cheats.h"
-
-extern void NDSSFCGetCheatGroups (char** NamePointers, char* NameMemory);
-extern void NDSSFCEnableCheatGroup (char* GroupName);
-extern void NDSSFCDisableCheatGroup (char* GroupName);
-extern bool8 NDSSFCIsCheatGroupEnabled (char* GroupName);
-
diff --git a/source/nds/displaymodes.cpp b/source/nds/displaymodes.cpp
deleted file mode 100644
index 173ead3..0000000
--- a/source/nds/displaymodes.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/* displaymodes.cpp
- *
- * Copyright (C) 2012 GBAtemp user Nebuleon.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include <stdio.h>
-
-//#include "ds2_types.h"
-//#include "ds2io.h"
-
-#include "gfx.h"
-
-static uint16 SevenToSixScanlineResize (uint16 TopColour, uint16 BottomColour, uint8 TopFraction, uint8 BottomFraction)
-{
- // Speed hacks!
- if (TopColour == BottomColour) // Two colours identical (no calc)
- return TopColour;
- if (TopColour == 0x0000) // From black to a non-identical colour
- return
- // Red component
- ( ( ((BottomColour >> 10) & 0x1F) * BottomFraction / 7 ) << 10 )
- // Green component
- | ( ( ((BottomColour >> 5) & 0x1F) * BottomFraction / 7 ) << 5 )
- // Blue component
- | ( ( (BottomColour & 0x1F) * BottomFraction / 7 ) )
- ;
- if (BottomColour == 0x0000) // To black from a non-identical colour
- return
- // Red component
- ( ( ((TopColour >> 10) & 0x1F) * TopFraction / 7 ) << 10 )
- // Green component
- | ( ( ((TopColour >> 5) & 0x1F) * TopFraction / 7 ) << 5 )
- // Blue component
- | ( ( (TopColour & 0x1F) * TopFraction / 7 ) )
- ;
- return
- // Red component
- ( ( ((TopColour >> 10) & 0x1F) * TopFraction / 7 + ((BottomColour >> 10) & 0x1F) * BottomFraction / 7 ) << 10 )
- // Green component
- | ( ( ((TopColour >> 5) & 0x1F) * TopFraction / 7 + ((BottomColour >> 5) & 0x1F) * BottomFraction / 7 ) << 5 )
- // Blue component
- | ( ( (TopColour & 0x1F) * TopFraction / 7 + (BottomColour & 0x1F) * BottomFraction / 7 ) )
- ;
-}
-
-void NDSSFCDrawFrameAntialiased (void* screen_addr)
-{
- uint16 X, Y;
- uint16 *SrcTop = (uint16 *) GFX.Screen, *SrcBottom = SrcTop + 256, *Dest = (uint16 *) screen_addr;
-
- for (Y = 0; Y < 224; Y += 7)
- {
- for (X = 0; X < 256; X++)
- *Dest++ = SevenToSixScanlineResize (*SrcTop++, *SrcBottom++, 6, 1);
- // At the end of this loop, line 1 for this block of 6
- // has been drawn from the 2 first lines in the block
- // of 7. Do the rest.
- for (X = 0; X < 256; X++)
- *Dest++ = SevenToSixScanlineResize (*SrcTop++, *SrcBottom++, 5, 2);
- for (X = 0; X < 256; X++)
- *Dest++ = SevenToSixScanlineResize (*SrcTop++, *SrcBottom++, 4, 3);
- for (X = 0; X < 256; X++)
- *Dest++ = SevenToSixScanlineResize (*SrcTop++, *SrcBottom++, 3, 4);
- for (X = 0; X < 256; X++)
- *Dest++ = SevenToSixScanlineResize (*SrcTop++, *SrcBottom++, 2, 5);
- for (X = 0; X < 256; X++)
- *Dest++ = SevenToSixScanlineResize (*SrcTop++, *SrcBottom++, 1, 6);
- // At the end of these loops, SrcTop and SrcBottom point to
- // the first element in the 7th line of the current block and
- // the first element in the 1st line of the next.
- // We need to increase the pointer to start on lines 1 & 2.
- SrcTop += 256;
- SrcBottom += 256;
- }
-}
diff --git a/source/nds/dma_adj.c b/source/nds/dma_adj.c
deleted file mode 100644
index 8b6f9ad..0000000
--- a/source/nds/dma_adj.c
+++ /dev/null
@@ -1,26 +0,0 @@
-#include "ds2_malloc.h"
-#include "dma_adj.h"
-
-#ifdef DS2_DMA
-
-struct SPointerAdjustments PtrAdj;
-
-void* AlignedMalloc (unsigned int Size, unsigned int Alignment, unsigned int* Adjustment)
-{
- if (Alignment == 0) Alignment = 1;
-
- unsigned char* result = (unsigned char*) malloc(Size + Alignment);
- if (!result) {
- return result;
- } else {
- *Adjustment = Alignment - ((unsigned int) result & (Alignment - 1));
- return (void*) (result + *Adjustment);
- }
-}
-
-void AlignedFree (void* Memory, unsigned int Adjustment)
-{
- free((void*) ((unsigned char*) Memory - Adjustment));
-}
-
-#endif // DS2_DMA
diff --git a/source/nds/dma_adj.h b/source/nds/dma_adj.h
deleted file mode 100644
index 3852f09..0000000
--- a/source/nds/dma_adj.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef _DMA_ADJ_H_
-#define _DMA_ADJ_H_
-
-#ifdef DS2_DMA
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct SPointerAdjustments {
- /* These are used by the DSTWO-NDS side code. */
- unsigned int GFXScreen;
-
- /* These are used by Snes9x. */
- unsigned int ROM;
-};
-
-extern struct SPointerAdjustments PtrAdj;
-
-extern void* AlignedMalloc (unsigned int Size, unsigned int Alignment, unsigned int* Adjustment);
-extern void AlignedFree (void* Memory, unsigned int Adjustment);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // DS2_DMA
-
-#endif // !_DMA_ADJ_H_
diff --git a/source/nds/draw.c b/source/nds/draw.c
deleted file mode 100644
index 6344f5b..0000000
--- a/source/nds/draw.c
+++ /dev/null
@@ -1,1315 +0,0 @@
-/* draw.c
- *
- * Copyright (C) 2010 dking <dking024@gmail.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public Licens e as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-//v1.1
-
-/******************************************************************************
- * draw.cpp
- * basic program to draw some graphic
- ******************************************************************************/
-#include "port.h"
-#include <string.h>
-#include <stdio.h>
-#include "ds2_malloc.h"
-#include "ds2_cpu.h"
-#include "bdf_font.h"
-#include "gui.h"
-#include "bitmap.h"
-#include "draw.h"
-
-/******************************************************************************
- * macro definition
- ******************************************************************************/
-#define progress_sx (screen_width2 - SCREEN_WIDTH / 3) // Center -160/-80
-#define progress_ex (screen_width2 + SCREEN_WIDTH / 3) // Center +160/+80
-#define progress_sy (screen_height2 + 3) // Center +3
-#define progress_ey (screen_height2 + 13) // Center +13
-#define yesno_sx (screen_width2 - SCREEN_WIDTH / 3) // Center -160/-80
-#define yesno_ex (screen_width2 + SCREEN_WIDTH / 3) // Center +160/+80
-#define yesno_sy (screen_height2 + 3) // Center +3
-#define yesno_ey (screen_height2 + 13) // Center +13
-#define progress_color COLOR16(15,15,15)
-
-//#define progress_wait (0.5 * 1000 * 1000)
-#define progress_wait (OS_TICKS_PER_SEC/2) //0.5S
-
-#define FONTS_HEIGHT 14
-
-#define SCREEN_PITCH 256
-
-#define VRAM_POS(screen, x, y) ((unsigned short*)screen + (x + (y) * SCREEN_PITCH))
-
-#define BOOTLOGO "SYSTEM/GUI/boot.bmp"
-#define GUI_SOURCE_PATH "SYSTEM/GUI"
-#define GUI_PIC_BUFSIZE 1024*512
-
-char gui_picture[GUI_PIC_BUFSIZE];
-
-struct gui_iconlist gui_icon_list[]= {
- //file system
- /* 00 */ {"zipfile", 16, 16, NULL},
- /* 01 */ {"directory", 16, 16, NULL},
- /* 02 */ {"sfcfile", 16, 16, NULL},
-
- //title
- /* 03 */ {"stitle", 256, 33, NULL},
- //main menu
- /* 04 */ {"savo", 52, 52, NULL},
- /* 05 */ {"ssaveo", 52, 52, NULL},
- /* 06 */ {"stoolo", 52, 52, NULL},
- /* 07 */ {"scheato", 52, 52, NULL},
- /* 08 */ {"sother", 52, 52, NULL},
- /* 09 */ {"sexito", 52, 52, NULL},
- /* 10 */ {"smsel", 79, 15, NULL},
- /* 11 */ {"smnsel", 79, 15, NULL},
-
- /* 12 */ {"snavo", 52, 52, NULL},
- /* 13 */ {"snsaveo", 52, 52, NULL},
- /* 14 */ {"sntoolo", 52, 52, NULL},
- /* 15 */ {"sncheato", 52, 52, NULL},
- /* 16 */ {"snother", 52, 52, NULL},
- /* 17 */ {"snexito", 52, 52, NULL},
-
- /* 18 */ {"sunnof", 16, 16, NULL},
- /* 19 */ {"smaini", 85, 38, NULL},
- /* 20 */ {"snmaini", 85, 38, NULL},
- /* 21 */ {"smaybgo", 256, 192, NULL},
-
- /* 22 */ {"sticon", 29, 13, NULL},
- /* 23 */ {"ssubbg", 256, 192, NULL},
-
- /* 24 */ {"subsela", 245, 22, NULL},
- /* 25 */ {"sfullo", 12, 12, NULL},
- /* 26 */ {"snfullo", 12, 12, NULL},
- /* 27 */ {"semptyo", 12, 12, NULL},
- /* 28 */ {"snemptyo", 12, 12, NULL},
- /* 29 */ {"fdoto", 16, 16, NULL},
- /* 30 */ {"backo", 19, 13, NULL},
- /* 31 */ {"nbacko", 19, 13, NULL},
- /* 32 */ {"chtfile", 16, 15, NULL},
- /* 33 */ {"smsgfr", 193, 111, NULL},
- /* 34 */ {"sbutto", 76, 16, NULL}
- };
-
-u16 COLOR_BG = COLOR16( 0, 0, 0);
-u16 COLOR_INACTIVE_ITEM = COLOR16( 0, 0, 0);
-u16 COLOR_ACTIVE_ITEM = COLOR16(31, 31, 31);
-u16 COLOR_MSSG = COLOR16( 0, 0, 0);
-u16 COLOR_INACTIVE_MAIN = COLOR16(31, 31, 31);
-u16 COLOR_ACTIVE_MAIN = COLOR16(31, 31, 31);
-
-
-/*
-* Drawing string aroud center
-*/
-void print_string_center(void* screen_addr, u32 sy, u32 color, u32 bg_color, char *str)
-{
- int width = 0;//fbm_getwidth(str);
- u32 sx = (SCREEN_WIDTH - width) / 2;
-
- PRINT_STRING_BG(screen_addr, str, color, bg_color, sx, sy);
-}
-
-/*
-* Drawing string with shadow around center
-*/
-void print_string_shadow_center(void* screen_addr, u32 sy, u32 color, char *str)
-{
- int width = 0;//fbm_getwidth(str);
- u32 sx = (SCREEN_WIDTH - width) / 2;
-
- PRINT_STRING_SHADOW(screen_addr, str, color, sx, sy);
-}
-
-/*
-* Drawing horizontal line
-*/
-void drawhline(void* screen_addr, u32 sx, u32 ex, u32 y, u32 color)
-{
- u32 x;
- u32 width = (ex - sx) + 1;
- u16 *dst = VRAM_POS(screen_addr, sx, y);
-
- for (x = 0; x < width; x++)
- *dst++ = (u16)color;
-}
-
-/*
-* Drawing vertical line
-*/
-void drawvline(void* screen_addr, u32 x, u32 sy, u32 ey, u32 color)
-{
- int y;
- int height = (ey - sy) + 1;
- u16 *dst = VRAM_POS(screen_addr, x, sy);
-
- for (y = 0; y < height; y++)
- {
- *dst = (u16)color;
- dst += SCREEN_PITCH;
- }
-}
-
-/*
-* Drawing rectangle
-*/
-void drawbox(void* screen_addr, u32 sx, u32 sy, u32 ex, u32 ey, u32 color)
-{
- drawhline(screen_addr, sx, ex - 1, sy, color);
- drawvline(screen_addr, ex, sy, ey - 1, color);
- drawhline(screen_addr, sx + 1, ex, ey, color);
- drawvline(screen_addr, sx, sy + 1, ey, color);
-}
-
-/*
-* Filling a rectangle
-*/
-void drawboxfill(void* screen_addr, u32 sx, u32 sy, u32 ex, u32 ey, u32 color)
-{
- u32 x, y;
- u32 width = (ex - sx) + 1;
- u32 height = (ey - sy) + 1;
- u16 *dst = VRAM_POS(screen_addr, sx, sy);
-
- for (y = 0; y < height; y++)
- {
- for (x = 0; x < width; x++)
- {
- dst[x + y * SCREEN_PITCH] = (u16)color;
- }
- }
-}
-
-/*
-* Drawing a selection item
-- active 0 not fill
-- 1 fill with gray
-- 2 fill with color
-- 3 fill with color and most brithness
-- color 0 Red
-- 1 Green
-- 2 Blue
-------------------------------------------------------*/
-void draw_selitem(void* screen_addr, u32 x, u32 y, u32 color, u32 active)
-{
- u32 size;
- u32 color0, color1, color2, color3;
-
- size= 10;
-
- switch(active)
- {
- case 1:
- color0 = COLOR16(12, 12, 12);
- color1 = COLOR16(2, 2, 2);
- color2 = COLOR16(7, 7, 7);
- color3 = COLOR16(22, 22, 22);
- break;
- case 2:
- switch(color)
- {
- case 0: //Red
- color0 = COLOR16(12, 12, 12);
- color1 = COLOR16(8, 0, 0);
- color2 = COLOR16(16, 0, 0);
- color3 = COLOR16(24, 0, 0);
- break;
- case 1: //Green
- color0 = COLOR16(12, 12, 12);
- color1 = COLOR16(0, 8, 0);
- color2 = COLOR16(0, 16, 0);
- color3 = COLOR16(0, 24, 0);
- break;
- case 2: //Blue
- color0 = COLOR16(12, 12, 12);
- color1 = COLOR16(0, 0, 8);
- color2 = COLOR16(0, 0, 16);
- color3 = COLOR16(0, 0, 24);
- break;
- default:
- color0 = COLOR16(12, 12, 12);
- color1 = COLOR16(0, 8, 0);
- color2 = COLOR16(0, 16, 0);
- color3 = COLOR16(0, 24, 0);
- break;
- }
- break;
- case 3:
- switch(color)
- {
- case 0: //Red
- color0 = COLOR16(31, 31, 31);
- color1 = COLOR16(16, 0, 0);
- color2 = COLOR16(22, 0, 0);
- color3 = COLOR16(31, 0, 0);
- break;
- case 1: //Green
- color0 = COLOR16(31, 31, 31);
- color1 = COLOR16(0, 16, 0);
- color2 = COLOR16(0, 22, 0);
- color3 = COLOR16(0, 31, 0);
- break;
- case 2: //Blue
- color0 = COLOR16(31, 31, 31);
- color1 = COLOR16(0, 0, 16);
- color2 = COLOR16(0, 0, 22);
- color3 = COLOR16(0, 0, 31);
- break;
- default:
- color0 = COLOR16(31, 31, 31);
- color1 = COLOR16(0, 16, 0);
- color2 = COLOR16(0, 22, 0);
- color3 = COLOR16(0, 31, 0);
- break;
- }
- break;
- default:
- color0= COLOR16(18, 18, 18);
- color1= color2= color3= COLOR16(18, 18, 18);
- break;
- }
-
- drawbox(screen_addr, x, y, x+size-1, y+size-1, color0);
-
- if(active >0)
- {
- drawbox(screen_addr, x+1, y+1, x+size-2, y+size-2, color1);
- drawbox(screen_addr, x+2, y+2, x+size-3, y+size-3, color2);
- drawboxfill(screen_addr, x+3, y+3, x+size-4, y+size-4, color3);
- }
-}
-
-/*
-* Drawing message box
-* Note if color_fg is transparent, screen_bg can't be transparent
-*/
-void draw_message(void* screen_addr, u16 *screen_bg, u32 sx, u32 sy, u32 ex, u32 ey,
- u32 color_fg)
-{
- if(!(color_fg & 0x8000))
- {
-// drawbox(screen_addr, sx, sy, ex, ey, COLOR16(12, 12, 12));
-// drawboxfill(screen_addr, sx+1, sy+1, ex-1, ey-1, color_fg);
- show_icon(screen_addr, &ICON_MSG, (NDS_SCREEN_WIDTH - ICON_MSG.x) / 2, (NDS_SCREEN_HEIGHT - ICON_MSG.y) / 2);
- }
- else
- {
- u16 *screenp, *screenp1;
- u32 width, height, i, k;
- u32 tmp, tmp1, tmp2;
- u32 r, g, b;
-
- width= ex-sx;
- height= ey-sy;
- r= ((color_fg >> 10) & 0x1F) * 6/7;
- g= ((color_fg >> 5) & 0x1F) * 6/7;
- b= (color_fg & 0x1F) * 6/7;
- for(k= 0; k < height; k++)
- {
- screenp = VRAM_POS(screen_addr, sx, sy+k);
- screenp1 = screen_bg + sx + (sy + k) * SCREEN_PITCH;
- for(i= 0; i < width; i++)
- {
- tmp = *screenp1++;
- tmp1 = ((tmp >> 10) & 0x1F) *1/7 + r;
- tmp2 = (tmp1 > 31) ? 31 : tmp1;
- tmp1 = ((tmp >> 5) & 0x1F) *1/7 + g;
- tmp2 = (tmp2 << 5) | ((tmp1 > 31) ? 31 : tmp1);
- tmp1 = (tmp & 0x1F) *1/7 + b;
- tmp2 = (tmp2 << 5) | ((tmp1 > 31) ? 31 : tmp1);
- *screenp++ = tmp2;
- }
- }
- }
-}
-
-/*
-* Drawing string horizontal center aligned
-*/
-void draw_string_vcenter(void* screen_addr, u32 sx, u32 sy, u32 width, u32 color_fg, char *string)
-{
- u32 x, num, i, m;
- u16 *screenp;
- u16 unicode[256];
-
- num= 0;
- while(*string)
- {
- string= utf8decode(string, unicode+num);
- num++;
- }
-
- if(num== 0) return;
-
- screenp = (unsigned short*)screen_addr + sx + sy*SCREEN_WIDTH;
- i= 0;
- while(i < num)
- {
- m= BDF_cut_unicode(&unicode[i], num-i, width, 1);
- x= (width - BDF_cut_unicode(&unicode[i], m, 0, 3)) / 2;
- while(m--)
- {
- x += BDF_render16_ucs(screenp+x, SCREEN_WIDTH, 0, COLOR_TRANS,
- color_fg, unicode[i++]);
- }
- if (i < num && (unicode[i] == 0x0D || unicode[i] == 0x0A))
- i++;
- else {
- while (i < num && (unicode[i] == ' ')) i++;
- }
- screenp += FONTS_HEIGHT * SCREEN_WIDTH;
- }
-}
-
-/*------------------------------------------------------
- Drawing a scroll string
-------------------------------------------------------*/
-//limited
-// < 256 Unicodes
-// width < 256+128
-//#define MAX_SCROLL_STRING 8
-
-/*------------------------------------------------------
-- scroll_val < 0 scroll toward left
-- > 0 scroll toward right
-------------------------------------------------------*/
-struct scroll_string_info{
- u16 *screenp;
- u32 sx;
- u32 sy;
- u32 width;
- u32 height;
- u16 *unicode;
- u32 color_bg;
- u32 color_fg;
- u16 *buff_fonts;
- u32 buff_width;
- u16 *buff_bg;
- s32 pos_pixel;
- u32 str_start;
- u32 str_end;
- u32 str_len;
-};
-
-static struct scroll_string_info scroll_strinfo[MAX_SCROLL_STRING];
-static u32 scroll_string_num= 0;
-
-/*
- * Initialises a text scroller to display a certain string.
- * Input assertions: sx + width < NDS_SCREEN_WIDTH &&
- * sy + [text height] < NDS_SCREEN_HEIGHT && string != NULL &&
- * screen_addr != NULL.
- * Input: 'screen_addr', the address of the upper-left corner of the screen.
- * 'sx' and 'sy', the X and Y coordinates of the upper-left corner of
- * the text.
- * 'width', the width of the scroller's viewport.
- * 'color_bg', the RGB15 color of the background around the text, or
- * COLOR_TRANS for transparency.
- * 'color_fg', the RGB15 color of the text.
- * 'string', the text to be scrolled, encoded as UTF-8.
- * Output: the scroller's handle, to be used to scroll the text in
- * draw_hscroll.
- */
-u32 hscroll_init(void* screen_addr, u32 sx, u32 sy, u32 width,
- u32 color_bg, u32 color_fg, char *string)
-{
- u32 index, x, textWidth, num, len, i;
- u16 *unicode, *screenp;
-
- // 1. Which scroller should we use for this request?
- for(i= 0; i < MAX_SCROLL_STRING; i++)
- {
- if(scroll_strinfo[i].screenp == NULL)
- break;
- }
-
- if(i >= MAX_SCROLL_STRING)
- return -1;
-
- index= i;
-
- // 2. Convert to Unicode while calculating the width of the text.
- unicode= (u16*)malloc(strlen(string)*sizeof(u16));
- if(unicode == NULL)
- {
- scroll_strinfo[index].str_len = 0;
- return -3;
- }
-
- num= 0;
- textWidth = 0;
- while(*string)
- {
- string= utf8decode(string, unicode+num);
- if(unicode[num] != 0x0D && unicode[num] != 0x0A) {
- textWidth += BDF_width16_ucs(unicode[num]);
- num++;
- }
- }
- if (textWidth < width)
- textWidth = width;
-
- // 3. Allocate a rectangle of pixels for drawing the entire text into.
- screenp= (u16*)malloc(textWidth*FONTS_HEIGHT*sizeof(u16));
- if(screenp == NULL)
- {
- scroll_strinfo[index].str_len = 0;
- free((void*)unicode);
- return -2;
- }
-
- if(color_bg == COLOR_TRANS)
- memset(screenp, 0, textWidth*FONTS_HEIGHT*sizeof(u16));
-
- scroll_string_num += 1;
- scroll_strinfo[index].screenp = (unsigned short*)screen_addr;
- scroll_strinfo[index].sx= sx;
- scroll_strinfo[index].sy= sy;
- scroll_strinfo[index].color_bg= color_bg;
- scroll_strinfo[index].color_fg= color_fg;
- scroll_strinfo[index].width= width;
- scroll_strinfo[index].height= FONTS_HEIGHT;
- scroll_strinfo[index].unicode= unicode;
- scroll_strinfo[index].buff_fonts= screenp;
- scroll_strinfo[index].buff_bg= 0;
- scroll_strinfo[index].buff_width= textWidth;
- scroll_strinfo[index].pos_pixel= 0;
- scroll_strinfo[index].str_start= 0;
- scroll_strinfo[index].str_end= len-1;
-
- scroll_strinfo[index].str_len= num;
- if(num == 0)
- return index; // (1. Which scroller?)
-
- // 4. Render text into the allocation.
- i= 0;
- x= 0;
- while(i < num)
- {
- x += BDF_render16_ucs(screenp + x, textWidth, 0, color_bg, color_fg, unicode[i++]);
- }
-
- return index; // (1. Which scroller?)
-}
-
-u32 draw_hscroll_init(void* screen_addr, u32 sx, u32 sy, u32 width,
- u32 color_bg, u32 color_fg, char *string)
-{
- u32 ret = hscroll_init(screen_addr, sx, sy, width, color_bg, color_fg, string);
-
- draw_hscroll(ret, 0 /* stay on the left */);
-
- return ret;
-}
-
-/*
- * Scrolls an initialised scroller's text.
- * A scroller is never allowed to go past the beginning of the text when
- * scrolling to the left, or to go past the end when scrolling to the right.
- * Input assertions: index was returned by a previous call to
- * draw_hscroll_init and not used in a call to draw_hscroll_over.
- * Input: 'index', the scroller's handle.
- * 'scroll_val', the number of pixels to scroll. The sign affects the
- * direction. If scroll_val > 0, the scroller's viewport is moved to
- * the left; if < 0, the scroller's viewport is moved to the right.
- * Output: the number of pixels still available to scroll in the direction
- * specified by the sign of 'scroll_val'.
- *
- * Example: (assume each letter is 1 pixel; this won't be true in reality)
- * [some lengthy text shown in ] |
- * val -5 -> | [lengthy text shown in a scr]xxxxx -> to right, returns 5
- * val -5 -> | [hy text shown in a scroller] -> to right, returns 0
- * val 3 -> xxxxxxx[ngthy text shown in a scrol] | -> to left, returns 7
- * val 3 -> xxxx[ lengthy text shown in a sc] | -> to left, returns 4
- */
-u32 draw_hscroll(u32 index, s32 scroll_val)
-{
- u32 color_bg, color_fg, i, width, height;
- s32 xoff;
-
- if(index >= MAX_SCROLL_STRING) return -1;
- if(scroll_strinfo[index].screenp == NULL) return -2;
- if(scroll_strinfo[index].str_len == 0) return 0;
-
- width= scroll_strinfo[index].width;
- height= scroll_strinfo[index].height;
- color_bg= scroll_strinfo[index].color_bg;
- color_fg= scroll_strinfo[index].color_fg;
-
- // 1. Shift the scroller.
- scroll_strinfo[index].pos_pixel -= scroll_val;
- if (scroll_strinfo[index].pos_pixel < 0) // Reached the beginning
- scroll_strinfo[index].pos_pixel = 0;
- else if (scroll_strinfo[index].pos_pixel > scroll_strinfo[index].buff_width - width) // Reached the end
- scroll_strinfo[index].pos_pixel = scroll_strinfo[index].buff_width - width;
-
- // 2. Draw the scroller's text at its new position.
- u32 x, sx, sy, pixel;
- u16 *screenp, *screenp1;
-
- sx= scroll_strinfo[index].sx;
- sy= scroll_strinfo[index].sy;
-
- if(color_bg == COLOR_TRANS)
- {
- for(i= 0; i < height; i++)
- {
- screenp= scroll_strinfo[index].screenp + sx + (sy + i) * SCREEN_WIDTH;
- screenp1= scroll_strinfo[index].buff_fonts + scroll_strinfo[index].pos_pixel + i*scroll_strinfo[index].buff_width;
- for(x= 0; x < width; x++)
- {
- pixel= *screenp1++;
- if(pixel) *screenp = pixel;
- screenp ++;
- }
- }
- }
- else
- {
- for(i= 0; i < height; i++)
- {
- screenp= scroll_strinfo[index].screenp + sx + (sy + i) * SCREEN_WIDTH;
- screenp1= scroll_strinfo[index].buff_fonts + scroll_strinfo[index].pos_pixel + i*scroll_strinfo[index].buff_width;
- for(x= 0; x < width; x++)
- *screenp++ = *screenp1++;
- }
- }
-
- // 3. Return how many more pixels we can scroll in the same direction.
- if(scroll_val > 0)
- // Scrolling to the left: Return the number of pixels we can still go
- // to the left.
- return scroll_strinfo[index].pos_pixel;
- else
- // Scrolling to the right: Return the number of pixels we can still go
- // to the right.
- return scroll_strinfo[index].buff_width - scroll_strinfo[index].pos_pixel - width;
-}
-
-void draw_hscroll_over(u32 index)
-{
- if(scroll_strinfo[index].screenp== NULL)
- return;
-
- if(index < MAX_SCROLL_STRING && scroll_string_num > 0)
- {
- if(scroll_strinfo[index].unicode)
- {
- free((void*)scroll_strinfo[index].unicode);
- scroll_strinfo[index].unicode= NULL;
- }
- if(scroll_strinfo[index].buff_fonts)
- {
- free((void*)scroll_strinfo[index].buff_fonts);
- scroll_strinfo[index].buff_fonts= NULL;
- }
- scroll_strinfo[index].screenp= NULL;
- scroll_strinfo[index].str_len= 0;
-
- scroll_string_num -=1;
- }
-}
-
-/*
-* Drawing dialog
-*/
-/*
-void draw_dialog(void* screen_addr, u32 sx, u32 sy, u32 ex, u32 ey)
-{
- drawboxfill(screen_addr, sx + 5, sy + 5, ex + 5, ey + 5, COLOR_DIALOG_SHADOW);
-
- drawhline(screen_addr, sx, ex - 1, sy, COLOR_FRAME);
- drawvline(screen_addr, ex, sy, ey - 1, COLOR_FRAME);
- drawhline(screen_addr, sx + 1, ex, ey, COLOR_FRAME);
- drawvline(screen_addr, sx, sy + 1, ey, COLOR_FRAME);
-
- sx++;
- ex--;
- sy++;
- ey--;
-
- drawhline(screen_addr, sx, ex - 1, sy, COLOR_FRAME);
- drawvline(screen_addr, ex, sy, ey - 1, COLOR_FRAME);
- drawhline(screen_addr, sx + 1, ex, ey, COLOR_FRAME);
- drawvline(screen_addr, sx, sy + 1, ey, COLOR_FRAME);
-
- sx++;
- ex--;
- sy++;
- ey--;
-
- drawboxfill(screen_addr, sx, sy, ex, ey, COLOR_DIALOG);
-}
-*/
-
-/*
-* Draw yes or no dialog
-*/
-u32 draw_yesno_dialog(enum SCREEN_ID screen, u32 sy, char *yes, char *no)
-{
- u16 unicode[8];
- u32 len, width, box_width, i;
- char *string;
- void* screen_addr;
-
- len= 0;
- string= yes;
- while(*string)
- {
- string= utf8decode(string, &unicode[len]);
- if(unicode[len] != 0x0D && unicode[len] != 0x0A)
- {
- if(len < 8) len++;
- else break;
- }
- }
- width= BDF_cut_unicode(unicode, len, 0, 3);
-
- len= 0;
- string= no;
- while(*string)
- {
- string= utf8decode(string, &unicode[len]);
- if(unicode[len] != 0x0D && unicode[len] != 0x0A)
- {
- if(len < 8) len++;
- else break;
- }
- }
- i= BDF_cut_unicode(unicode, len, 0, 3);
-
- if(width < i) width= i;
- box_width= 64;
- if(box_width < (width +6)) box_width = width +6;
-
- if(screen & UP_MASK)
- screen_addr = up_screen_addr;
- else
- screen_addr = down_screen_addr;
-
- sy = (NDS_SCREEN_HEIGHT + ICON_MSG.y) / 2 - 8 - ICON_BUTTON.y;
-
- u32 left_sx = NDS_SCREEN_WIDTH / 2 - 8 - ICON_BUTTON.x,
- right_sx = NDS_SCREEN_WIDTH / 2 + 8;
-
- show_icon((unsigned short*)screen_addr, &ICON_BUTTON, left_sx, sy);
- draw_string_vcenter((unsigned short*)screen_addr, left_sx + 2, sy, ICON_BUTTON.x - 4, COLOR_WHITE, yes);
-
- show_icon((unsigned short*)screen_addr, &ICON_BUTTON, right_sx, sy);
- draw_string_vcenter((unsigned short*)screen_addr, right_sx + 2, sy, ICON_BUTTON.x - 4, COLOR_WHITE, no);
-
- ds2_flipScreen(screen, 2);
-
- gui_action_type gui_action = CURSOR_NONE;
- while((gui_action != CURSOR_SELECT) && (gui_action != CURSOR_BACK))
- {
- gui_action = get_gui_input();
- if (gui_action == CURSOR_TOUCH)
- {
- struct key_buf inputdata;
- ds2_getrawInput(&inputdata);
- // Turn it into a SELECT (A) or BACK (B) if the button is touched.
- if (inputdata.y >= sy && inputdata.y < sy + ICON_BUTTON.y)
- {
- if (inputdata.x >= left_sx && inputdata.x < left_sx + ICON_BUTTON.x)
- gui_action = CURSOR_SELECT;
- else if (inputdata.x >= right_sx && inputdata.x < right_sx + ICON_BUTTON.x)
- gui_action = CURSOR_BACK;
- }
- }
- mdelay(16);
- }
-
- if (gui_action == CURSOR_SELECT)
- return 1;
- else
- return 0;
-}
-
-/*
-* Draw hotkey dialog
-* Returns DS keys pressed, as in ds2io.h.
-*/
-u32 draw_hotkey_dialog(enum SCREEN_ID screen, u32 sy, char *clear, char *cancel)
-{
- u16 unicode[8];
- u32 len, width, box_width, i;
- char *string;
- void* screen_addr;
-
- len= 0;
- string= clear;
- while(*string)
- {
- string= utf8decode(string, &unicode[len]);
- if(unicode[len] != 0x0D && unicode[len] != 0x0A)
- {
- if(len < 8) len++;
- else break;
- }
- }
- width= BDF_cut_unicode(unicode, len, 0, 3);
-
- len= 0;
- string= cancel;
- while(*string)
- {
- string= utf8decode(string, &unicode[len]);
- if(unicode[len] != 0x0D && unicode[len] != 0x0A)
- {
- if(len < 8) len++;
- else break;
- }
- }
- i= BDF_cut_unicode(unicode, len, 0, 3);
-
- if(width < i) width= i;
- box_width= 64;
- if(box_width < (width +6)) box_width = width +6;
-
- if(screen & UP_MASK)
- screen_addr = up_screen_addr;
- else
- screen_addr = down_screen_addr;
-
- i= SCREEN_WIDTH/2 - box_width - 2;
- show_icon((unsigned short*)screen_addr, &ICON_BUTTON, 49, 128);
- draw_string_vcenter((unsigned short*)screen_addr, 51, 130, 73, COLOR_WHITE, clear);
-
- i= SCREEN_WIDTH/2 + 3;
- show_icon((unsigned short*)screen_addr, &ICON_BUTTON, 136, 128);
- draw_string_vcenter((unsigned short*)screen_addr, 138, 130, 73, COLOR_WHITE, cancel);
-
- ds2_flipScreen(screen, 2);
-
- // This function has been started by a key press. Wait for it to end.
- struct key_buf inputdata;
- do {
- mdelay(1);
- ds2_getrawInput(&inputdata);
- } while (inputdata.key != 0);
-
- // While there are no keys pressed, wait for keys.
- do {
- mdelay(1);
- ds2_getrawInput(&inputdata);
- } while (inputdata.key == 0);
-
- // Now, while there are keys pressed, keep a tally of keys that have
- // been pressed. (IGNORE TOUCH AND LID! Otherwise, closing the lid or
- // touching to get to the menu will do stuff the user doesn't expect.)
- u32 TotalKeys = 0;
-
- do {
- TotalKeys |= inputdata.key & ~(KEY_TOUCH | KEY_LID);
- // If there's a touch on either button, turn it into a
- // clear (A) or cancel (B) request.
- if (inputdata.key & KEY_TOUCH)
- {
- if (inputdata.y >= 128 && inputdata.y < 128 + ICON_BUTTON.y)
- {
- if (inputdata.x >= 49 && inputdata.x < 49 + ICON_BUTTON.x)
- return KEY_A;
- else if (inputdata.x >= 136 && inputdata.x < 136 + ICON_BUTTON.x)
- return KEY_B;
- }
- }
- mdelay(1);
- ds2_getrawInput(&inputdata);
- } while (inputdata.key != 0 || TotalKeys == 0);
-
- return TotalKeys;
-}
-
-/*
-* Drawing scroll bar
-*/
-#define SCROLLBAR_COLOR1 COLOR16( 0, 2, 8)
-#define SCROLLBAR_COLOR2 COLOR16(15,15,15)
-
-void scrollbar(void* screen_addr, u32 sx, u32 sy, u32 ex, u32 ey, u32 all, u32 view, u32 now)
-{
- u32 scrollbar_sy;
- u32 scrollbar_ey;
- u32 len;
-
- len = ey - sy - 2;
-
- if ((all != 0) && (all > now))
- scrollbar_sy = (u32)((float)len * (float)now / (float)all) +sy + 1;
- else
- scrollbar_sy = sy + 1;
-
- if ((all > (now + view)) && (all != 0))
- scrollbar_ey = (u32)((float)len * (float)(now + view) / (float)all ) + sy + 1;
- else
- scrollbar_ey = len + sy + 1;
-
- drawbox(screen_addr, sx, sy, ex, ey, COLOR_BLACK);
- drawboxfill(screen_addr, sx + 1, sy + 1, ex - 1, ey - 1, SCROLLBAR_COLOR1);
- drawboxfill(screen_addr, sx + 1, scrollbar_sy, ex - 1, scrollbar_ey, SCROLLBAR_COLOR2);
-}
-
-#if 0
-static struct background back_ground = {{0}, {0}};
-
-int show_background(void *screen, char *bgname)
-{
- int ret;
-
- if(strcasecmp(bgname, back_ground.bgname))
- {
- char *buff, *src;
- int x, y;
- unsigned short *dst;
- unsigned int type;
-
- buff= (char*)malloc(256*192*4);
-
- ret= BMP_read(bgname, buff, 256, 192, &type);
- if(ret != BMP_OK)
- {
- free((intptr_t)buff);
- return(-1);
- }
-
- src = buff;
-
- if(type ==2) //2 bytes per pixel
- {
- unsigned short *pt;
- pt = (unsigned short*)buff;
-// memcpy((char*)back_ground.bgbuffer, buff, 256*192*2);
- dst=(unsigned short*)back_ground.bgbuffer;
- for(y= 0; y< 192; y++)
- {
- for(x= 0; x< 256; x++)
- {
- *dst++= RGB16_15(pt);
- pt += 1;
- }
- }
- }
- else if(type ==3) //3 bytes per pixel
- {
- dst=(unsigned short*)back_ground.bgbuffer;
- for(y= 0; y< 192; y++)
- {
- for(x= 0; x< 256; x++)
- {
- *dst++= RGB24_15(buff);
- buff += 3;
- }
- }
- }
- else
- {
- free((intptr_t)buff);
- return(-1);
- }
-
- free((intptr_t)src);
- strcpy(back_ground.bgname, bgname);
- }
-
- memcpy((char*)screen, back_ground.bgbuffer, 256*192*2);
-
- return 0;
-}
-#endif
-
-/*
-* change GUI icon
-*/
-int gui_change_icon(u32 language_id)
-{
- char path[128];
- char fpath[8];
- u32 i, item;
- int err, ret;
- char *buff, *src;
- u32 x, y;
- char *icondst;
- unsigned int type;
-
- item= sizeof(gui_icon_list)/16;
- buff= (char*)malloc(256*192*4);
- if(buff == NULL)
- return -1;
-
- ret= 0;
- icondst= gui_picture;
-
- sprintf(fpath, "%d.bmp", language_id);
- for(i= 0; i< item; i++)
- {
- sprintf(path, "%s/%s/%s%s", main_path, GUI_SOURCE_PATH, gui_icon_list[i].iconname, fpath);
-
- src= buff;
- err= BMP_read(path, src, gui_icon_list[i].x, gui_icon_list[i].y, &type);
- if(err != BMP_OK)
- {
- sprintf(path, "%s/%s/%s%s", main_path, GUI_SOURCE_PATH, gui_icon_list[i].iconname, ".bmp");
- err= BMP_read(path, src, gui_icon_list[i].x, gui_icon_list[i].y, &type);
- }
-
- if(type < 2) //< 1 byte per pixels, not surpport now
- {
- if(!ret) ret = -(i+1);
- gui_icon_list[i].iconbuff= NULL;
- continue;
- }
-
- if(err == BMP_OK)
- {
- unsigned short *dst;
-
- if(icondst >= gui_picture + GUI_PIC_BUFSIZE -1)
- {
- ret = 1;
- break;
- }
-
- if(type == 2)
- {
- unsigned short *pt;
- pt = (unsigned short*)src;
-// memcpy((char*)icondst, src, 256*192*2);
- dst = (unsigned short*)icondst;
- for(y= 0; y< gui_icon_list[i].y; y++)
- {
- for(x= 0; x < gui_icon_list[i].x; x++)
- {
- *dst++ = RGB16_15(pt);
- pt += 1;
- }
- }
- }
-
- if(type == 3)
- {
- dst = (unsigned short*)icondst;
- for(y= 0; y< gui_icon_list[i].y; y++)
- {
- for(x= 0; x < gui_icon_list[i].x; x++)
- {
- *dst++ = RGB24_15(src);
- src += 3;
- }
- }
- }
-
- gui_icon_list[i].iconbuff= icondst;
- icondst += gui_icon_list[i].x*gui_icon_list[i].y*2;
- }
- else
- {
- if(!ret) ret = -(i+1);
- gui_icon_list[i].iconbuff= NULL;
- }
- }
-
- free((void*)buff);
-//printf("icon_buf: %08x\n", icondst - gui_picture );
- return ret;
-}
-
-/*************************************************************/
-int icon_init(u32 language_id)
-{
- u32 i;
- int ret;
-
-//Initial draw_scroll_string function
- scroll_string_num = 0;
- for(i= 0; i < MAX_SCROLL_STRING; i++)
- {
- scroll_strinfo[i].unicode= NULL;
- scroll_strinfo[i].buff_fonts= NULL;
- scroll_strinfo[i].screenp = NULL;
- scroll_strinfo[i].str_len = 0;
- }
-
- ret= gui_change_icon(language_id);
-
-//#define GUI_INIT_DEBUG
-#if 0
- item= sizeof(gui_icon_list)/12;
- buff= (char*)malloc(256*192*4);
- src= buff;
- ret= 0;
- icondst= gui_picture;
-
- for(i= 0; i< item; i++)
- {
- sprintf(path, "%s\\%s", GUI_SOURCE_PATH, gui_icon_list[i].iconname);
-
- err= BMP_read(path, buff, gui_icon_list[i].x, gui_icon_list[i].y);
- if(err == BMP_OK)
- {
- unsigned short *dst;
-
- if(icondst >= gui_picture + GUI_PIC_BUFSIZE -1)
- {
- ret = 1;
-#ifdef GUI_INIT_DEBUG
- printf("GUI Initial overflow\n");
-#endif
- break;
- }
-
- for(y= 0; y< gui_icon_list[i].y; y++)
- {
- dst= (unsigned short*)(icondst + (gui_icon_list[i].y - y -1)*gui_icon_list[i].x*2);
- for(x= 0; x < gui_icon_list[i].x; x++)
- {
- *dst++ = RGB24_15(buff);
- buff += 4;
- }
- }
-
- gui_icon_list[i].iconname= icondst;
- icondst += gui_icon_list[i].x*gui_icon_list[i].y*2;
- }
- else
- if(!ret)
- {
- ret = -(i+1);
- gui_icon_list[i].iconname= NULL;
-#ifdef GUI_INIT_DEBUG
- printf("GUI Initial: %s not open\n", path);
-#endif
- }
- }
-
-#ifdef GUI_INIT_DEBUG
- printf("GUI buff %d\n", icondst - gui_picture);
-#endif
-
- free((intptr_t)src);
-#endif
-
- return ret;
-}
-
-int color_init()
-{
- char path[MAX_PATH];
- char current_line[256];
- sprintf(path, "%s/%s/%s", main_path, GUI_SOURCE_PATH, "uicolors.txt");
- FILE* fp = fopen(path, "r");
- if (fp != NULL)
- {
- while(fgets(current_line, 256, fp))
- {
- char* colon = strchr(current_line, ':');
- if (colon)
- {
- *colon = '\0';
- u16* color = NULL;
- if (strcasecmp(current_line, "Background") == 0)
- color = &COLOR_BG;
- else if (strcasecmp(current_line, "ActiveItem") == 0)
- color = &COLOR_ACTIVE_ITEM;
- else if (strcasecmp(current_line, "InactiveItem") == 0)
- color = &COLOR_INACTIVE_ITEM;
- else if (strcasecmp(current_line, "MessageText") == 0)
- color = &COLOR_MSSG;
- else if (strcasecmp(current_line, "ActiveMain") == 0)
- color = &COLOR_ACTIVE_MAIN;
- else if (strcasecmp(current_line, "InactiveMain") == 0)
- color = &COLOR_INACTIVE_MAIN;
-
- if (color != NULL)
- {
- char* end = strchr(colon + 1, '\0') - 1;
- while (*end && (*end == '\r' || *end == '\n'))
- *end-- = '\0';
- char* ptr = colon + 1;
- while (*ptr && *ptr == ' ')
- ptr++;
- u32 color32;
- u8 r, g, b;
- if (strlen(ptr) == 7 && *ptr == '#')
- {
- color32 = strtol(ptr + 1, NULL, 16);
- r = (color32 >> 16) & 0xFF;
- g = (color32 >> 8) & 0xFF;
- b = color32 & 0xFF;
- *color = COLOR16(r >> 3, g >> 3, b >> 3);
- }
- }
- }
- }
- fclose(fp);
- return 0;
- }
- else
- return 1;
-}
-
-/*************************************************************/
-void show_icon(void* screen, struct gui_iconlist* icon, u32 x, u32 y)
-{
- u32 i, k;
- unsigned short *src, *dst;
-
- src= (unsigned short*)icon->iconbuff;
- dst = (unsigned short*)screen + y*NDS_SCREEN_WIDTH + x;
- if(NULL == src) return; //The icon may initialized failure
-
- if (icon->x == NDS_SCREEN_WIDTH && icon->y == NDS_SCREEN_HEIGHT && x == 0 && y == 0)
- {
- // Don't support transparency for a background.
- memcpy(dst, src, NDS_SCREEN_WIDTH * NDS_SCREEN_HEIGHT * sizeof(u16));
- }
- else
- {
- for(i= 0; i < icon->y; i++)
- {
- for(k= 0; k < icon->x; k++)
- {
- if(0x03E0 != *src) dst[k]= *src;
- src++;
- }
-
- dst += NDS_SCREEN_WIDTH;
- }
- }
-}
-
-/*************************************************************/
-void show_Vscrollbar(char *screen, u32 x, u32 y, u32 part, u32 total)
-{
-// show_icon((u16*)screen, ICON_VSCROL_UPAROW, x+235, y+55);
-// show_icon((u16*)screen, ICON_VSCROL_DWAROW, x+235, y+167);
-// show_icon((u16*)screen, ICON_VSCROL_SLIDER, x+239, y+64);
-// if(total <= 1)
-// show_icon((u16*)screen, ICON_VSCROL_BAR, x+236, y+64);
-// else
-// show_icon((u16*)screen, ICON_VSCROL_BAR, x+236, y+64+(part*90)/(total-1));
-}
-
-/*
-* display a log
-*/
-void show_log(void* screen_addr)
-{
- char tmp_path[MAX_PATH];
- char *buff;
- int x, y;
- unsigned short *dst;
- unsigned int type;
- int ret;
-
- sprintf(tmp_path, "%s/%s", main_path, BOOTLOGO);
- buff= (char*)malloc(256*192*4);
-
- ret= BMP_read(tmp_path, buff, 256, 192, &type);
- if(ret != BMP_OK)
- {
- free((void*)buff);
- return;
- }
-
- if(type ==2) //2 bytes per pixel
- {
- unsigned short *pt;
- pt = (unsigned short*)buff;
- dst=(unsigned short*)screen_addr;
- for(y= 0; y< 192; y++)
- {
- for(x= 0; x< 256; x++)
- {
- *dst++= RGB16_15(pt);
- pt += 1;
- }
- }
- }
- else if(type ==3) //3 bytes per pixel
- {
- unsigned char *pt;
- pt = (unsigned char*)buff;
- dst=(unsigned short*)screen_addr;
- for(y= 0; y< 192; y++)
- {
- for(x= 0; x< 256; x++)
- {
- *dst++= RGB24_15(pt);
- pt += 3;
- }
- }
- }
-
- free((void*)buff);
-}
-
-/*************************************************************/
-void err_msg(enum SCREEN_ID screen, char *msg)
-{
- // A wild console appeared!
- ConsoleInit(RGB15(31, 31, 31), RGB15(0, 0, 0), UP_SCREEN, 2);
- printf(msg);
-}
-
-/*
-* Copy screen
-*/
-void copy_screen(void* to, void *from, u32 x, u32 y, u32 w, u32 h)
-{
- u32 yy;
- unsigned short *src, *dst;
-
- //not check argument
- src = (unsigned short*)from;
- dst = (unsigned short*)to;
-
- src += y*256+x;
- dst += y*256+x;
- for(yy= 0; yy < h; yy++)
- {
- memcpy((void*)dst, (void*)src, w*2);
- src += 256;
- dst += 256;
- }
-}
-
-/*
-*
-*/
-void blit_to_screen(void* screen_addr, u16 *src, u32 w, u32 h, u32 dest_x, u32 dest_y)
-{
- u32 x, y;
- u16 *dst;
- u16 *screenp;
-
- if(w > NDS_SCREEN_WIDTH) w= NDS_SCREEN_WIDTH;
- if(h > NDS_SCREEN_HEIGHT) h= NDS_SCREEN_HEIGHT;
- if(dest_x == -1) //align center
- dest_x= (NDS_SCREEN_WIDTH - w)/2;
- if(dest_y == -1)
- dest_y= (NDS_SCREEN_HEIGHT - h)/2;
-
- screenp= (unsigned short*)screen_addr -16*256 -8;
- for(y= 0; y < h; y++)
- {
- dst= screenp + (y+dest_y)*256 + dest_x;
- for(x= 0; x < w; x++)
- *dst++ = *src++;
- }
-}
diff --git a/source/nds/draw.h b/source/nds/draw.h
deleted file mode 100644
index 473fc30..0000000
--- a/source/nds/draw.h
+++ /dev/null
@@ -1,207 +0,0 @@
-/* draw.h
- *
- * Copyright (C) 2010 dking <dking024@gmail.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public Licens e as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __DRAW_H__
-#define __DRAW_H__
-
-//#include "ds2_types.h"
-//#include "ds2io.h"
-#include <psptypes.h>
-
-#include "bdf_font.h"
-
-#define NDS_SCREEN_WIDTH 256
-#define NDS_SCREEN_HEIGHT 192
-#define NDS_SCREEN_SIZE (NDS_SCREEN_WIDTH*NDS_SCREEN_HEIGHT)
-
-#define COLOR16(red, green, blue) ((blue << 10) | (green << 5) | red)
-#define GET_R16(color) (color & 0x1f)
-#define GET_G16(color) ((color >> 5) & 0x1f)
-#define GET_B16(color) ((color >> 10)& 0x1f)
-#define COLOR32(red, green, blue) (0xff000000 | ((blue & 0xff) << 16) | ((green & 0xff) << 8) | (red & 0xff))
-
-#define RGB24_15(pixel) ((((*pixel) & 0xF8) << 7) |\
- (((*(pixel+1)) & 0xF8) << 2) |\
- (((*(pixel+2)) & 0xF8)>>3))
-
-#define RGB16_15(pixel) ((((*pixel)>>10) & 0x1F) |\
- (((*pixel) & 0x1F) << 10) |\
- ((*pixel) & 0x83E0))
-
-
-#define PRINT_STRING(screen, str, fg_color, x, y) \
- BDF_render_mix(screen, SCREEN_WIDTH, x, y, 0, COLOR_TRANS, fg_color, str) \
-
-#define PRINT_STRING_SHADOW(screen, str, fg_color, x, y) \
- BDF_render_mix(screen, SCREEN_WIDTH, x+1, y+1, 0, 0, 0, str); \
- BDF_render_mix(screen, SCREEN_WIDTH, x, y, 0, 0, 0, str) \
-
-#define PRINT_STRING_BG(screen, str, fg_color, bg_color, x, y) \
- BDF_render_mix(screen, SCREEN_WIDTH, x, y, 0, bg_color, fg_color, str) \
-
-// #define PRINT_STRING_BG_UTF8(screen, utf8, fg_color, bg_color, x, y) \
-// BDF_render_mix(screen, SCREEN_WIDTH, x, y, 0, bg_color, fg_color, utf8) \
-
-
-//colors
-#define COLOR_TRANS COLOR16(31, 31, 63)
-#define COLOR_WHITE COLOR16(31, 31, 31)
-#define COLOR_BLACK COLOR16( 0, 0, 0)
-//#define COLOR_TEXT COLOR16(31, 31, 31)
-//#define COLOR_PROGRESS_TEXT COLOR16( 0, 0, 0)
-//#define COLOR_PROGRESS_BAR COLOR16(15, 15, 15)
-//#define COLOR_ERROR COLOR16(31, 0, 0)
-//#define COLOR_BG COLOR16(2, 4, 10)
-//#define COLOR_BG32 COLOR32(2*8, 4*8, 10*8)
-//#define COLOR_ROM_INFO COLOR16(22, 18, 26)
-//#define COLOR_HELP_TEXT COLOR16(16, 20, 24)
-//#define COLOR_DIALOG COLOR16(31, 31, 31)
-//#define COLOR_DIALOG_SHADOW COLOR16( 0, 2, 8)
-//#define COLOR_FRAME COLOR16( 0, 0, 0)
-//#define COLOR_YESNO_TEXT COLOR16( 0, 0, 0)
-//#define COLOR_GREEN COLOR16( 0, 31, 0 )
-//#define COLOR_GREEN1 COLOR16( 0, 24, 0 )
-//#define COLOR_GREEN2 COLOR16( 0, 18, 0 )
-//#define COLOR_GREEN3 COLOR16( 0, 12, 0 )
-//#define COLOR_GREEN4 COLOR16( 0, 6, 0 )
-//#define COLOR_RED COLOR16( 31, 0, 0 )
-//#define COLOR_MSSG COLOR16( 16, 8, 29)
-/******************************************************************************
- *
- ******************************************************************************/
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern u16 COLOR_BG;
-extern u16 COLOR_INACTIVE_ITEM;
-extern u16 COLOR_ACTIVE_ITEM;
-extern u16 COLOR_MSSG;
-extern u16 COLOR_INACTIVE_MAIN;
-extern u16 COLOR_ACTIVE_MAIN;
-
-struct background{
- char bgname[128];
- char bgbuffer[256*192*2];
-};
-
-struct gui_iconlist{
- const char *iconname; //icon name
- u32 x; //picture size
- u32 y;
- char *iconbuff;
-};
-
-//extern struct background back_ground;
-extern struct gui_iconlist gui_icon_list[];
-
-#define ICON_ZIPFILE gui_icon_list[0]
-#define ICON_DIRECTORY gui_icon_list[1]
-#define ICON_SFCFILE gui_icon_list[2]
-#define ICON_TITLE gui_icon_list[3]
-
-#define ICON_AVO gui_icon_list[4]
-#define ICON_SAVO gui_icon_list[5]
-#define ICON_TOOL gui_icon_list[6]
-#define ICON_CHEAT gui_icon_list[7]
-#define ICON_OTHER gui_icon_list[8]
-#define ICON_EXIT gui_icon_list[9]
-#define ICON_MSEL gui_icon_list[10]
-#define ICON_MNSEL gui_icon_list[11]
-#define ICON_NAVO gui_icon_list[12]
-#define ICON_NSAVO gui_icon_list[13]
-#define ICON_NTOOL gui_icon_list[14]
-#define ICON_NCHEAT gui_icon_list[15]
-#define ICON_NOTHER gui_icon_list[16]
-#define ICON_NEXIT gui_icon_list[17]
-
-#define ICON_UNKNOW gui_icon_list[18]
-#define ICON_MAINITEM gui_icon_list[19]
-#define ICON_NMAINITEM gui_icon_list[20]
-#define ICON_MAINBG gui_icon_list[21]
-
-#define ICON_TITLEICON gui_icon_list[22]
-#define ICON_SUBBG gui_icon_list[23]
-
-#define ICON_SUBSELA gui_icon_list[24]
-#define ICON_STATEFULL gui_icon_list[25]
-#define ICON_NSTATEFULL gui_icon_list[26]
-#define ICON_STATEEMPTY gui_icon_list[27]
-#define ICON_NSTATEEMPTY gui_icon_list[28]
-#define ICON_DOTDIR gui_icon_list[29]
-#define ICON_BACK gui_icon_list[30]
-#define ICON_NBACK gui_icon_list[31]
-#define ICON_CHTFILE gui_icon_list[32]
-#define ICON_MSG gui_icon_list[33]
-#define ICON_BUTTON gui_icon_list[34]
-
-/******************************************************************************
- *
- ******************************************************************************/
-extern void print_string_center(void* screen_addr, u32 sy, u32 color, u32 bg_color, char *str);
-extern void print_string_shadow_center(void* screen_addr, u32 sy, u32 color, char *str);
-extern void hline(u32 sx, u32 ex, u32 y, u32 color);
-extern void hline_alpha(u32 sx, u32 ex, u32 y, u32 color, u32 alpha);
-extern void vline(u32 x, u32 sy, u32 ey, u32 color);
-extern void vline_alpha(u32 x, u32 sy, u32 ey, u32 color, u32 alpha);
-extern void drawbox(void* screen_address, u32 sx, u32 sy, u32 ex, u32 ey, u32 color);
-extern void drawboxfill(void* screen_address, u32 sx, u32 sy, u32 ex, u32 ey, u32 color);
-extern void draw_selitem(void* screen_address, u32 x, u32 y, u32 color, u32 active);
-extern void draw_message(void* screen_address, u16 *screen_bg, u32 sx, u32 sy, u32 ex, u32 ey,
- u32 color_fg);
-extern void draw_string_vcenter(void* screen_address, u32 sx, u32 sy, u32 width,
- u32 color_fg, char *string);
-
-#define MAX_SCROLL_STRING 16
-extern u32 hscroll_init(void* screen_address, u32 sx, u32 sy, u32 width,
- u32 color_bg, u32 color_fg, char *string);
-extern u32 draw_hscroll_init(void* screen_address, u32 sx, u32 sy, u32 width,
- u32 color_bg, u32 color_fg, char *string);
-extern u32 draw_hscroll(u32 index, s32 scroll_val);
-extern void draw_hscroll_over(u32 index);
-extern void boxfill_alpha(u32 sx, u32 sy, u32 ex, u32 ey, u32 color, u32 alpha);
-extern void scrollbar(void* screen_addr, u32 sx, u32 sy, u32 ex, u32 ey, u32 all, u32 view, u32 now);
-extern u32 yesno_dialog(char *text);
-//extern u32 draw_yesno_dialog(enum SCREEN_ID screen, u32 sy, char *yes, char *no);
-//extern u32 draw_hotkey_dialog(enum SCREEN_ID screen, u32 sy, char *clear, char *cancel);
-extern void msg_screen_init(const char *title);
-extern void msg_screen_draw();
-extern void msg_printf(const char *text, ...);
-extern void msg_screen_clear(void);
-extern void msg_set_text_color(u32 color);
-
-extern int icon_init(u32 language_id);
-extern int color_init(void);
-extern int gui_change_icon(u32 language_id);
-extern int show_background(void *screen, char *bgname);
-extern void show_icon(void* screen, struct gui_iconlist *icon, u32 x, u32 y);
-extern void show_Vscrollbar(char *screen, u32 x, u32 y, u32 part, u32 total);
-
-extern void show_log(void* screen_addr);
-extern void err_msg(enum SCREEN_ID screen, char *msg);
-
-extern void copy_screen(void* to, void *from, u32 x, u32 y, u32 w, u32 h);
-extern void blit_to_screen(void* screen_addr, u16 *src, u32 w, u32 h, u32 dest_x, u32 dest_y);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //__DRAW_H__
-
diff --git a/source/nds/ds2_main.c b/source/nds/ds2_main.c
deleted file mode 100644
index af81df3..0000000
--- a/source/nds/ds2_main.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/* ds2_main.c
- *
- * Copyright (C) 2010 dking <dking024@gmail.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public Licens e as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "port.h"
-
-#include <stdio.h>
-#include "console.h"
-#include "fs_api.h"
-#include "ds2io.h"
-#include "ds2_cpu.h"
-#include "ds2_timer.h"
-#include "ds2_malloc.h"
-#include "ds2sound.h"
-#include "gui.h"
-
-#define BLACK_COLOR RGB15(0, 0, 0)
-#define WHITE_COLOR RGB15(31, 31, 31)
-
-extern int sfc_main (int argc, char **argv);
-
-#if 0
-void ddump_mem(unsigned char* addr, unsigned int len)
-{
- unsigned int i;
-
- for(i= 0; i < len; i++)
- {
- if(i%16 == 0) cprintf("\n%08x: ", i);
- cprintf("%02x ", addr[i]);
- }
-}
-#endif
-
-void ds2_main(void)
-{
- int err;
- HighFrequencyCPU();
- //Initial video and audio and other input and output
- err = ds2io_initb(DS2_BUFFER_SIZE, SND_SAMPLE_RATE, 0, 0);
- if(err) goto _failure;
-
- //Initial file system
- err = fat_init();
- if(err) goto _failure;
-
- //go to user main funtion
- sfc_main (0, 0);
-
-_failure:
- ds2_plug_exit();
-}
-
diff --git a/source/nds/ds2sound.h b/source/nds/ds2sound.h
deleted file mode 100644
index 8c0e2bf..0000000
--- a/source/nds/ds2sound.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// The sound buffer sizes used on the DS2's side, for each value of
-// Settings.SoundPlaybackRate.
-// * Don't buffer too much, otherwise audio is delayed from video.
-// * Don't go below one frame (20 milliseconds).
-// * Buffer sizes must be multiples of 128.
-#define DS2_BUFFER_SIZE_4 512 /* tested working */
-#define DS2_BUFFER_SIZE_5 640 /* like the SNES! tested working */
-#define DS2_BUFFER_SIZE_6 896 /* tested working */
-#define DS2_BUFFER_SIZE_7 1024 /* tested working */
-
-// The sampling rate for the sound, in Hz, for each value of
-// Settings.SoundPlaybackRate.
-#define SND_SAMPLE_RATE_1 8000
-#define SND_SAMPLE_RATE_2 11025
-#define SND_SAMPLE_RATE_3 16000
-#define SND_SAMPLE_RATE_4 22050 /* NDSSFC 1.06 - CATSFC 1.28 used this one */
-#define SND_SAMPLE_RATE_5 32000 /* like the SNES! */
-#define SND_SAMPLE_RATE_6 44100
-#define SND_SAMPLE_RATE_7 48000 /* CATSFC 1.25 made using this one possible */
-
-// Settings in use. The number should match in all three settings.
-#define DS2_BUFFER_SIZE DS2_BUFFER_SIZE_5
-#define SND_SAMPLE_RATE SND_SAMPLE_RATE_5
-#define SNES9X_SRATE_ID 5
diff --git a/source/nds/entry.cpp b/source/nds/entry.cpp
deleted file mode 100644
index a6c1f7d..0000000
--- a/source/nds/entry.cpp
+++ /dev/null
@@ -1,1595 +0,0 @@
-//entry.c
-#include <stdio.h>
-
-//#include "ds2_types.h"
-//#include "ds2_cpu.h"
-//#include "ds2_timer.h"
-//#include "ds2io.h"
-//#include "fs_api.h"
-
-#include "snes9x.h"
-#include "soundux.h"
-#include "memmap.h"
-#include "apu.h"
-#include "cheats.h"
-#include "snapshot.h"
-#include "display.h"
-#include "gfx.h"
-#include "cpuexec.h"
-#include "spc7110.h"
-
-#include "draw.h"
-#include "gui.h"
-#include "entry.h"
-#include "ds2sound.h"
-
-#ifdef DS2_DMA
-#include "ds2_dma.h"
-#include "dma_adj.h"
-#endif
-
-void S9xProcessSound (unsigned int);
-
-char *rom_filename = NULL;
-char *SDD1_pack = NULL;
-
-/*
- * It is only safe to manipulate saved states between frames.
- */
-static bool8 LoadStateNeeded = FALSE;
-static bool8 SaveStateNeeded = FALSE;
-
-static u8 Buf[MAX_BUFFER_SIZE];
-
-#define FIXED_POINT 0x10000
-#define FIXED_POINT_SHIFT 16
-#define FIXED_POINT_REMAINDER 0xffff
-
-void S9xMessage (int /*type*/, int /*number*/, const char *message)
-{
-#if 1
-#define MAX_MESSAGE_LEN (36 * 3)
-
- static char buffer [MAX_MESSAGE_LEN + 1];
-
- printf ("%s\n", message);
- strncpy (buffer, message, MAX_MESSAGE_LEN);
- buffer [MAX_MESSAGE_LEN] = 0;
- S9xSetInfoString (buffer);
-#endif
-}
-
-void S9xExtraUsage ()
-{
- /*empty*/
-}
-
-/*
-* Release display device
-*/
-void S9xDeinitDisplay (void)
-{
-#ifdef DS2_DMA
- if(GFX.Screen) AlignedFree(GFX.Screen, PtrAdj.GFXScreen);
-#else
- if(GFX.Screen) free(GFX.Screen);
-#endif
- if(GFX.SubScreen) free(GFX.SubScreen);
- if(GFX.ZBuffer) free(GFX.ZBuffer);
- if(GFX.SubZBuffer) free(GFX.SubZBuffer);
-}
-
-void S9xInitDisplay (int, char **)
-{
- int h = IMAGE_HEIGHT;
-
- GFX.Pitch = IMAGE_WIDTH * 2;
-#ifdef DS2_DMA
- GFX.Screen = (unsigned char*) AlignedMalloc (GFX.Pitch * h, 32, &PtrAdj.GFXScreen);
-#else
- GFX.Screen = (unsigned char*) malloc (GFX.Pitch * h);
-#endif
- GFX.SubScreen = (unsigned char*) malloc (GFX.Pitch * h);
- GFX.ZBuffer = (unsigned char*) malloc ((GFX.Pitch >> 1) * h);
- GFX.SubZBuffer =(unsigned char*) malloc ((GFX.Pitch >> 1) * h);
- GFX.Delta = (GFX.SubScreen - GFX.Screen) >> 1;
-}
-
-void S9xParseArg (char **argv, int &i, int argc)
-{
-}
-
-void S9xParseDisplayArg (char **argv, int &ind, int)
-{
-}
-
-void S9xExit ()
-{
- HighFrequencyCPU(); // Crank it up to exit quickly
- if(Settings.SPC7110)
- (*CleanUp7110)();
-
- S9xSetSoundMute (TRUE);
- S9xDeinitDisplay ();
- Memory.SaveSRAM (S9xGetFilename (".srm"));
- // S9xSaveCheatFile (S9xGetFilename (".chb")); // cheat binary file
- // Do this when loading a cheat file!
- Memory.Deinit ();
- S9xDeinitAPU ();
-
-#ifdef _NETPLAY_SUPPORT
- if (Settings.NetPlay)
- S9xNetPlayDisconnect ();
-#endif
-
- exit(0);
-}
-
-const char *S9xBasename (const char *f)
-{
- const char *p;
- if ((p = strrchr (f, '/')) != NULL || (p = strrchr (f, '\\')) != NULL)
- return (p + 1);
-
- return (f);
-}
-
-bool8 S9xInitUpdate ()
-{
- return (TRUE);
-}
-
-
-extern void NDSSFCDrawFrameAntialiased(void* screen_addr);
-
-
-bool8 S9xDeinitUpdate (int Width, int Height, bool8 /*sixteen_bit*/)
-{
- void* screen_addr = emu_config.BottomScreenGame
- ? down_screen_addr
- : up_screen_addr;
- SCREEN_ID screen_num = emu_config.BottomScreenGame
- ? DOWN_SCREEN
- : UP_SCREEN;
-
- switch(game_config.graphic)
- {
- //Up
- case 1:
-#ifdef DS2_DMA
- __dcache_writeback_all();
- ds2_DMAcopy_32Byte(1 /* channel: graphics */, screen_addr, GFX.Screen + 256 * 32 * 2, 256 * 192 * 2);
- ds2_DMA_wait(1);
- ds2_DMA_stop(1);
-#else
- memcpy(screen_addr, GFX.Screen+256*32*2, 256*192*2);
-#endif
- break;
-
- //Down
- case 2:
-#ifdef DS2_DMA
- __dcache_writeback_all();
- ds2_DMAcopy_32Byte(1 /* channel: graphics */, screen_addr, GFX.Screen, 256 * 192 * 2);
- ds2_DMA_wait(1);
- ds2_DMA_stop(1);
-#else
- memcpy(screen_addr, GFX.Screen, 256*192*2);
-#endif
- break;
-
- //Both
- case 3:
-#ifdef DS2_DMA
- __dcache_writeback_all();
- ds2_DMAcopy_32Byte(1 /* channel: graphics */, screen_addr, GFX.Screen + 256 * 16 * 2, 256 * 192 * 2);
- ds2_DMA_wait(1);
- ds2_DMA_stop(1);
-#else
- memcpy(screen_addr, GFX.Screen+256*16*2, 256*192*2);
-#endif
- break;
-
- case 4:
- NDSSFCDrawFrameAntialiased (screen_addr);
- break;
-
-
- default:
- {
-#ifdef DS2_DMA
- __dcache_writeback_all();
-#endif
- register unsigned char *src, *dst;
- register unsigned int m;
-
- src = GFX.Screen;
- dst = (unsigned char*)screen_addr;
- for(m = 0; m < 32; m++)
- {
-#ifdef DS2_DMA
- ds2_DMAcopy_32Byte(1 /* channel: graphics */, dst, src, 256 * 6 * 2);
- ds2_DMA_wait(1);
- ds2_DMA_stop(1);
-#else
- memcpy(dst, src, 256*6*2);
-#endif
- dst += 256*6*2;
- src += 256*7*2;
- }
- }
- break;
- }
-
- ds2_flipScreen(screen_num, UP_SCREEN_UPDATE_METHOD);
- // A problem with update method 1 (wait, double buffer) means that, after
- // about 15 minutes of play time, the screen starts to half-redraw every
- // frame. With update method 0, this is mitigated. (Method 2 is too slow.)
-
- return (TRUE);
-}
-
-void _makepath (char *path, const char *, const char *dir,
- const char *fname, const char *ext)
-{
- if (dir && *dir)
- {
- strcpy (path, dir);
- strcat (path, "/");
- }
- else
- *path = 0;
- strcat (path, fname);
- if (ext && *ext)
- {
- strcat (path, ".");
- strcat (path, ext);
- }
-}
-
-void _splitpath (const char *path, char *drive, char *dir, char *fname,
- char *ext)
-{
- *drive = 0;
-
- char *slash = strrchr (path, '/');
- if (!slash)
- slash = strrchr (path, '\\');
-
- char *dot = strrchr (path, '.');
-
- if (dot && slash && dot < slash)
- dot = NULL;
-
- if (!slash)
- {
- strcpy (dir, "");
- strcpy (fname, path);
- if (dot)
- {
- *(fname + (dot - path)) = 0;
- strcpy (ext, dot + 1);
- }
- else
- strcpy (ext, "");
- }
- else
- {
- strcpy (dir, path);
- *(dir + (slash - path)) = 0;
- strcpy (fname, slash + 1);
- if (dot)
- {
- *(fname + (dot - slash) - 1) = 0;
- strcpy (ext, dot + 1);
- }
- else
- strcpy (ext, "");
- }
-}
-
-void S9xProcessEvents (bool8 block)
-{
-
-}
-
-void OutOfMemory ()
-{
-}
-
-
-const char *S9xGetROMDirectory ()
-{
- return ((const char*)g_default_rom_dir);
-}
-
-
-const char *S9xGetSnapshotDirectory ()
-{
- return ((const char*)DEFAULT_RTS_DIR);
-}
-
-const char *S9xGetFilename (const char *ex)
-{
- static char filename [PATH_MAX + 1];
- char drive [_MAX_DRIVE + 1];
- char dir [_MAX_DIR + 1];
- char fname [_MAX_FNAME + 1];
- char ext [_MAX_EXT + 1];
-
- _splitpath (Memory.ROMFilename, drive, dir, fname, ext);
- strcpy (filename, S9xGetSnapshotDirectory ());
- strcat (filename, SLASH_STR);
- strcat (filename, fname);
- strcat (filename, ex);
-
- return (filename);
-}
-
-const char *S9xGetFilenameInc (const char *e)
-{
- return e;
-#if 0
- static char filename [_MAX_PATH + 1];
- char drive [_MAX_DRIVE + 1];
- char dir [_MAX_DIR + 1];
- char fname [_MAX_FNAME + 1];
- char ext [_MAX_EXT + 1];
- char *ptr;
- struct stat buf;
-
- if (strlen (S9xGetSnapshotDirectory()))
- {
- _splitpath (Memory.ROMFilename, drive, dir, fname, ext);
- strcpy (filename, S9xGetSnapshotDirectory());
- strcat (filename, "/");
- strcat (filename, fname);
- ptr = filename + strlen (filename);
- strcat (filename, "00/");
- strcat (filename, e);
- }
- else
- {
- _splitpath (Memory.ROMFilename, drive, dir, fname, ext);
- strcat (fname, "00/");
- _makepath (filename, drive, dir, fname, e);
- ptr = strstr (filename, "00/");
- }
-
- do
- {
- if (++*(ptr + 2) > '9')
- {
- *(ptr + 2) = '0';
- if (++*(ptr + 1) > '9')
- {
- *(ptr + 1) = '0';
- if (++*ptr > '9')
- break;
- }
- }
- } while( stat(filename, &buf) == 0 );
-
- return (filename);
-#endif
-}
-
-void S9xInitInputDevices ()
-{
-#ifdef JOYSTICK_SUPPORT
- InitJoysticks ();
-#endif
-}
-
-
-
-void game_disableAudio()
-{
- if( game_enable_audio == 1)
- {
- S9xSetSoundMute (FALSE);
- }
- else
- {
- S9xSetSoundMute (TRUE);
- }
-}
-
-void game_set_frameskip()
-{
- if( game_config.frameskip_value == 0)
- {
- Settings.SkipFrames = AUTO_FRAMERATE;
- }
- else
- {
- Settings.SkipFrames = game_config.frameskip_value - 1 /* 1 -> 0 and so on */;
- }
-}
-
-void game_set_fluidity()
-{
- if( game_config.SoundSync == 1)
- {
- Settings.SoundSync = TRUE;
- }
- else
- {
- Settings.SoundSync = FALSE;
- }
-}
-
-void game_set_retro(void)
-{
- if (game_config.RetroSound == 1)
- {
- Settings.InterpolatedSound = FALSE;
- S9xSetEightBitConsoleSound (TRUE);
- }
- else
- {
- Settings.InterpolatedSound = TRUE;
- S9xSetEightBitConsoleSound (FALSE);
- }
-}
-
-void init_sfc_setting(void)
-{
- ZeroMemory (&Settings, sizeof (Settings));
-#ifdef JOYSTICK_SUPPORT
- Settings.JoystickEnabled = TRUE;
-#else
- Settings.JoystickEnabled = FALSE;
-#endif
-
- Settings.SoundPlaybackRate = SNES9X_SRATE_ID; // -> ds2sound.h for defs
-#ifndef FOREVER_STEREO
- Settings.Stereo = TRUE;
-#endif
- Settings.SoundBufferSize = DS2_BUFFER_SIZE;
- Settings.CyclesPercentage = 100;
- Settings.DisableSoundEcho = FALSE;
- //sound settings
- Settings.APUEnabled = Settings.NextAPUEnabled = TRUE;
- // Settings.FixFrequency = 1;
-
- Settings.H_Max = SNES_CYCLES_PER_SCANLINE;
- Settings.SkipFrames = AUTO_FRAMERATE;
- Settings.ShutdownMaster = TRUE;
- Settings.FrameTimePAL = 20000;
- Settings.FrameTimeNTSC = 16667;
- Settings.DisableMasterVolume = FALSE;
- Settings.Mouse = TRUE;
- Settings.SuperScope = TRUE;
- Settings.MultiPlayer5 = TRUE;
- Settings.ControllerOption = SNES_JOYPAD;
-
- Settings.Transparency = TRUE;
-#ifndef FOREVER_16_BIT
- Settings.SixteenBit = TRUE;
-#endif
-#ifndef FOREVER_16_BIT_SOUND
- Settings.SixteenBitSound = TRUE;
-#endif
-
- Settings.SupportHiRes = FALSE;
- Settings.ThreadSound = FALSE;
- Settings.SoundSync = TRUE;
- Settings.AutoSaveDelay = 0;
-#ifdef _NETPLAY_SUPPORT
- Settings.NetPlay = FALSE;
- Settings.ServerName [0] = 0;
- Settings.Port = NP_DEFAULT_PORT;
-#endif
- Settings.ApplyCheats = TRUE;
- Settings.TurboMode = FALSE;
- Settings.TurboSkipFrames = 10;
- Settings.StretchScreenshots = 1;
-
- Settings.HBlankStart = (256 * Settings.H_Max) / SNES_HCOUNTER_MAX;
-}
-
-void S9xAutoSaveSRAM ()
-{
- Memory.SaveSRAM (S9xGetFilename (".srm"));
-}
-
-int game_load_state(char* file)
-{
- int flag;
-
- flag = 0;
- if(S9xUnfreezeGame(file) == FALSE)
- flag = -1;
-
- return flag;
-}
-
-int game_save_state(char* file)
-{
- int flag;
-
- flag = 0;
- if(S9xFreezeGame(file) == FALSE)
- flag = -1;
-
- S9xAutoSaveSRAM ();
-
- return flag;
-}
-
-void game_restart(void)
-{
- CPU.Flags = 0;
- S9xReset ();
-}
-
-int load_gamepak(const char* file)
-{
- CPU.Flags = 0;
- // mdelay(50); // Delete this delay
- if (!Memory.LoadROM (file))
- return -1;
- S9xReset ();
-
- Settings.FrameTime = (Settings.PAL ? Settings.FrameTimePAL : Settings.FrameTimeNTSC);
-
- Memory.LoadSRAM (S9xGetFilename (".srm"));
- // mdelay(50); // Delete this delay
- S9xLoadCheatFile (S9xGetFilename (".chb")); // cheat binary file, as opposed to text
-
-#ifdef _NETPLAY_SUPPORT
- if (strlen (Settings.ServerName) == 0)
- {
- char *server = getenv ("S9XSERVER");
- if (server)
- {
- strncpy (Settings.ServerName, server, 127);
- Settings.ServerName [127] = 0;
- }
- }
- char *port = getenv ("S9XPORT");
- if (Settings.Port >= 0 && port)
- Settings.Port = atoi (port);
- else if (Settings.Port < 0)
- Settings.Port = -Settings.Port;
-
- if (Settings.NetPlay)
- {
- int player;
-
- if (!S9xNetPlayConnectToServer (Settings.ServerName, Settings.Port,
- Memory.ROMName, player))
- {
- fprintf (stderr, "Failed to connected to Snes9x netplay"
- " server \"%s\" on port %d.\n",
- Settings.ServerName, Settings.Port);
- S9xExit ();
- }
- fprintf (stderr, "Connected to \"%s\" on port %d as"
- " player #%d playing \"%s\"\n",
- Settings.ServerName, Settings.Port, player, Memory.ROMName);
- }
-
-#endif
-/*
- if (snapshot_filename)
- {
- int Flags = CPU.Flags & (DEBUG_MODE_FLAG | TRACE_FLAG);
- if (!S9xLoadSnapshot (snapshot_filename))
- exit (1);
- CPU.Flags |= Flags;
- }
-*/
-
- // mdelay(50); // Delete this delay
-
- return 0;
-}
-
-extern "C" int sfc_main (int argc, char **argv);
-
-int sfc_main (int argc, char **argv)
-{
- //Initialize GUI
- gui_init(0);
-
- init_sfc_setting();
-
- if (!Memory.Init () || !S9xInitAPU())
- OutOfMemory ();
-
- S9xInitDisplay (argc, argv);
- if (!S9xGraphicsInit())
- OutOfMemory ();
-
- S9xInitSound (Settings.SoundPlaybackRate,
-#ifndef FOREVER_STEREO
- Settings.Stereo,
-#else
- TRUE,
-#endif
- Settings.SoundBufferSize);
-#ifdef GFX_MULTI_FORMAT
-// S9xSetRenderPixelFormat (RGB565);
- S9xSetRenderPixelFormat (BGR555);
-#endif
-
-#ifdef JOYSTICK_SUPPORT
- uint32 JoypadSkip = 0;
-#endif
-
- Settings.Paused = 1;
- bool8 FirstInvocation = TRUE;
-
- while (1)
- {
- if (!Settings.Paused
-#ifdef DEBUGGER
- || (CPU.Flags & (DEBUG_MODE_FLAG | SINGLE_STEP_FLAG)
-#endif
- )
- S9xMainLoop ();
-
-
-#ifdef DEBUGGER
- if (CPU.Flags & DEBUG_MODE_FLAG)
- {
- S9xDoDebug ();
- }
- else
-#endif
- {
- if (SaveStateNeeded) {
- QuickSaveState ();
- SaveStateNeeded = FALSE;
- }
-
- if (LoadStateNeeded) {
- QuickLoadState ();
- LoadStateNeeded = FALSE;
- }
-
- if (Settings.Paused)
- {
- S9xSetSoundMute (TRUE);
- unsigned short screen[256*192];
-
- if (FirstInvocation) {
- memset(screen, 0, sizeof(screen));
- }
- else {
- S9xDeinitUpdate(256, 224, TRUE);
-
- void* screen_addr = emu_config.BottomScreenGame
- ? down_screen_addr
- : up_screen_addr;
-
- copy_screen((void*)screen, screen_addr, 0, 0, 256, 192);
- }
-
- menu(screen, FirstInvocation);
- FirstInvocation = FALSE;
- game_disableAudio();
- Settings.Paused = 0;
- }
- }
-
-#ifdef JOYSTICK_SUPPORT
- //if (Settings.JoystickEnabled && (JoypadSkip++ & 1) == 0)
- if (Settings.JoystickEnabled)
- ReadJoysticks ();
-#endif
-
- }
-
- return (0);
-}
-
-static unsigned int sync_last= 0;
-static unsigned int sync_next = 0;
-
-static unsigned int skip_rate= 0;
-
-void S9xSyncSpeed ()
-{
- uint32 syncnow;
- int32 syncdif;
-
-#if 0
- if (Settings.SoundSync == 2)
- {
- IPPU.RenderThisFrame = TRUE;
- IPPU.SkippedFrames = 0;
- return;
- }
-#endif
- syncnow = getSysTime();
-
- bool8 FastForward = game_fast_forward || temporary_fast_forward /* hotkey is held */;
-
- if (FastForward)
- {
- sync_last = syncnow;
- sync_next = syncnow;
-
- if(++skip_rate < Settings.TurboSkipFrames)
- IPPU.RenderThisFrame = false;
- else
- {
- skip_rate = 0;
- IPPU.RenderThisFrame = true;
- }
- }
- else
- {
- // Manual or automatic frame skipping, no fast-forward.
- if (Settings.SkipFrames == AUTO_FRAMERATE)
- {
- // frame_time is in getSysTime units: 42.667 microseconds.
- int32 frame_time = Settings.PAL ? 468 /* = 20.0 ms */ : 391 /* = 16.67 ms */;
- if (sync_last > syncnow) // Overflow occurred! (every 50 hrs)
- {
- // Render this frame regardless, set the
- // sync_next, and get the hell out.
- IPPU.RenderThisFrame = TRUE;
- sync_last = syncnow;
- sync_next = syncnow + frame_time;
- return;
- }
- sync_last = syncnow;
- // If this is positive, we have syncdif*42.66 microseconds to
- // spare.
- // If this is negative, we're late by syncdif*42.66
- // microseconds.
- syncdif = sync_next - syncnow;
- if(skip_rate < 2 /* did not skip 2 frames yet */)
- {
- // Skip a minimum of 2 frames between rendered frames.
- // This prevents the DSTwo-DS link from being too busy
- // to return button statuses.
- ++skip_rate;
- IPPU.RenderThisFrame = FALSE;
- sync_next += frame_time;
- }
- else if(syncdif < 0)
- {
- /*
- * If we're consistently late, delay up to 8 frames.
- *
- * That really helps with certain games, such as
- * Super Mario RPG and Yoshi's Island.
- */
- if(++skip_rate < 10)
- {
- if(syncdif >= -11719 /* not more than 500.0 ms late */)
- {
- IPPU.RenderThisFrame = FALSE;
- sync_next += frame_time;
- }
- else
- { //lag more than 0.5s, maybe paused
- IPPU.RenderThisFrame = TRUE;
- sync_next = syncnow + frame_time;
- }
- }
- else
- {
- skip_rate = 0;
- IPPU.RenderThisFrame = TRUE;
- sync_next = syncnow + frame_time;
- }
- }
- else // Early
- {
- skip_rate = 0;
- if (syncdif > 0)
- {
- do {
- S9xProcessSound (0);
-#ifdef ACCUMULATE_JOYPAD
-/*
- * This call allows NDSSFC to synchronise the DS controller more often.
- * If porting a later version of Snes9x into NDSSFC, it is essential to
- * preserve it.
- */
- NDSSFCAccumulateJoypad ();
-#endif
- syncdif = sync_next - getSysTime();
- } while (syncdif > 0);
- }
-
- IPPU.RenderThisFrame = TRUE;
- sync_next += frame_time;
- }
-#if 0
- if(++framenum >= 60)
- {
- syncdif = syncnow - sync_last;
- sync_last = syncnow;
- framenum = 0;
- //printf("T %d %d\n", syncdif*42667/1000, realframe);
- realframe = 0;
- }
-#endif
- }
- else /* if (Settings.SkipFrames != AUTO_FRAMERATE) */
- {
- // frame_time is in getSysTime units: 42.667 microseconds.
- uint32 frame_time = Settings.PAL ? 468 /* = 20.0 ms */ : 391 /* = 16.67 ms */;
- sync_last = syncnow;
- if (++skip_rate > Settings.SkipFrames)
- {
- skip_rate = 0;
- IPPU.RenderThisFrame = TRUE;
- // Are we early?
- syncdif = sync_next - syncnow;
- if (syncdif > 0)
- {
- do {
- S9xProcessSound (0);
-#ifdef ACCUMULATE_JOYPAD
-/*
- * This call allows NDSSFC to synchronise the DS controller more often.
- * If porting a later version of Snes9x into NDSSFC, it is essential to
- * preserve it.
- */
- NDSSFCAccumulateJoypad ();
-#endif
- syncdif = sync_next - getSysTime();
- } while (syncdif > 0);
- // After that little delay, what time is it?
- syncnow = getSysTime();
- }
- sync_next = syncnow + frame_time * (Settings.SkipFrames + 1);
- }
- else
- {
- IPPU.RenderThisFrame = FALSE;
- }
- }
- }
-
-#ifdef __sgi
- /* BS: saves on CPU usage */
- sginap(1);
-#endif
-
-#if 0
- /* Check events */
-
- static struct timeval next1 = {0, 0};
- struct timeval now;
-
- CHECK_SOUND();
-// S9xProcessEvents(FALSE);
-
- while (gettimeofday (&now, NULL) < 0) ;
-
- /* If there is no known "next" frame, initialize it now */
- if (next1.tv_sec == 0) { next1 = now; ++next1.tv_usec; }
-
- /* If we're on AUTO_FRAMERATE, we'll display frames always
- * only if there's excess time.
- * Otherwise we'll display the defined amount of frames.
- */
- unsigned limit = Settings.SkipFrames == AUTO_FRAMERATE
- ? (timercmp(&next1, &now, <) ? 10 : 1)
- : Settings.SkipFrames;
-
- IPPU.RenderThisFrame = ++IPPU.SkippedFrames >= limit;
- if(IPPU.RenderThisFrame)
- {
- IPPU.SkippedFrames = 0;
- }
- else
- {
- /* If we were behind the schedule, check how much it is */
- if(timercmp(&next1, &now, <))
- {
- unsigned lag =
- (now.tv_sec - next1.tv_sec) * 1000000
- + now.tv_usec - next1.tv_usec;
- if(lag >= 1000000)
- {
- /* More than a second behind means probably
- * pause. The next line prevents the magic
- * fast-forward effect.
- */
- next1 = now;
- }
- }
- }
-
- /* Delay until we're completed this frame */
-
- /* Can't use setitimer because the sound code already could
- * be using it. We don't actually need it either.
- */
-
- while(timercmp(&next1, &now, >))
- {
- /* If we're ahead of time, sleep a while */
- unsigned timeleft =
- (next1.tv_sec - now.tv_sec) * 1000000
- + next1.tv_usec - now.tv_usec;
- //fprintf(stderr, "<%u>", timeleft);
- usleep(timeleft);
-
- CHECK_SOUND();
-// S9xProcessEvents(FALSE);
-
- while (gettimeofday (&now, NULL) < 0) ;
- /* Continue with a while-loop because usleep()
- * could be interrupted by a signal
- */
- }
-
- /* Calculate the timestamp of the next frame. */
- next1.tv_usec += Settings.FrameTime;
- if (next1.tv_usec >= 1000000)
- {
- next1.tv_sec += next1.tv_usec / 1000000;
- next1.tv_usec %= 1000000;
- }
-#endif
-}
-
-bool8 S9xOpenSoundDevice (int mode, bool8 stereo, int buffer_size)
-{
-#ifndef FOREVER_16_BIT_SOUND
- so.sixteen_bit = TRUE;
-#endif
-#ifndef FOREVER_STEREO
- so.stereo = stereo;
-#endif
- so.playback_rate = SND_SAMPLE_RATE;
- S9xSetPlaybackRate (so.playback_rate);
-
- if (buffer_size == 0)
- buffer_size = DS2_BUFFER_SIZE;
-
- if (buffer_size > MAX_BUFFER_SIZE / 4)
- buffer_size = MAX_BUFFER_SIZE / 4;
-#ifndef FOREVER_16_BIT_SOUND
- if (so.sixteen_bit)
-#endif
- buffer_size *= 2;
-#ifndef FOREVER_STEREO
- if (so.stereo)
-#endif
- buffer_size *= 2;
-
- so.buffer_size = buffer_size;
-
- return (TRUE);
-}
-
-void S9xGenerateSound ()
-{
-#ifndef FOREVER_16_BIT_SOUND
- int bytes_so_far = so.sixteen_bit ? (so.samples_mixed_so_far << 1) :
- so.samples_mixed_so_far;
-#else
- int bytes_so_far = so.samples_mixed_so_far << 1;
-#endif
-
- if (bytes_so_far >= so.buffer_size)
- return;
-
- so.err_counter += so.err_rate;
- if (so.err_counter >= FIXED_POINT)
- {
- // Write this many samples overall
- int samples_to_write = so.err_counter >> FIXED_POINT_SHIFT;
-#ifndef FOREVER_STEREO
- if (so.stereo)
-#endif
- samples_to_write <<= 1;
- int byte_offset = (bytes_so_far + so.play_position) & SOUND_BUFFER_SIZE_MASK;
-
- so.err_counter &= FIXED_POINT_REMAINDER;
-
- do
- {
- int bytes_this_run = samples_to_write;
-#ifndef FOREVER_16_BIT_SOUND
- if (so.sixteen_bit)
-#endif
- bytes_this_run <<= 1;
-
- if (byte_offset + bytes_this_run > SOUND_BUFFER_SIZE)
- {
- bytes_this_run = SOUND_BUFFER_SIZE - byte_offset;
- }
-
- if (bytes_so_far + bytes_this_run > so.buffer_size)
- {
- bytes_this_run = so.buffer_size - bytes_so_far;
- if (bytes_this_run == 0)
- break;
- }
-
- int samples_this_run = bytes_this_run;
-#ifndef FOREVER_16_BIT_SOUND
- if (so.sixteen_bit)
-#endif
- samples_this_run >>= 1;
-
- S9xMixSamples (Buf + byte_offset, samples_this_run);
- so.samples_mixed_so_far += samples_this_run;
- samples_to_write -= samples_this_run;
-#ifndef FOREVER_16_BIT_SOUND
- bytes_so_far += so.sixteen_bit ? (samples_this_run << 1) :
- samples_this_run;
-#else
- bytes_so_far += samples_this_run << 1;
-#endif
- byte_offset = (byte_offset + bytes_this_run) & SOUND_BUFFER_SIZE_MASK;
- } while (samples_to_write > 0);
- }
-}
-
-#define SOUND_EMISSION_INTERVAL ((unsigned int) ((((unsigned long long) DS2_BUFFER_SIZE * 1000000) / SND_SAMPLE_RATE) * 3 / 128))
-#define TRUE_SOUND_EMISSION_INTERVAL ((((double) DS2_BUFFER_SIZE * 1000000) / SND_SAMPLE_RATE) * 3 / 128)
-#define SOUND_EMISSION_INTERVAL_ERROR ((int) ((TRUE_SOUND_EMISSION_INTERVAL - SOUND_EMISSION_INTERVAL) * FIXED_POINT))
-static unsigned int LastSoundEmissionTime = 0;
-
-/*
- * Accumulated error in the sound emission time. The unit is as follows:
- * FIXED_POINT = 42.667 microseconds.
- * As the error goes past FIXED_POINT, the new target for sound emission
- * becomes 42.667 microseconds LATER. This helps with sound buffer overruns,
- * correctly dealing with the fact that 42.667 microseconds does not fit
- * an integer number of times in 1/32000 second (or whatever sampling rate).
- */
-static unsigned int SoundEmissionTimeError = 0;
-
-void S9xProcessSound (unsigned int)
-{
- if (!game_enable_audio)
- return;
-
- unsigned int Now = getSysTime();
- if (Now - LastSoundEmissionTime >= SOUND_EMISSION_INTERVAL)
- {
- if(ds2_checkAudiobuff() > AUDIO_BUFFER_COUNT - 1)
- {
- LastSoundEmissionTime++;
- return;
- }
-
- unsigned short *audiobuff;
-
- if (Now - LastSoundEmissionTime >= 11719 /* 500 milliseconds */)
- {
- LastSoundEmissionTime = Now;
- // We were probably paused. Restart sending sound,
- // synchronising from now.
- }
- else
- {
- LastSoundEmissionTime += SOUND_EMISSION_INTERVAL;
- SoundEmissionTimeError += SOUND_EMISSION_INTERVAL_ERROR;
- if (SoundEmissionTimeError >= FIXED_POINT)
- {
- LastSoundEmissionTime += SoundEmissionTimeError >> FIXED_POINT_SHIFT;
- SoundEmissionTimeError &= FIXED_POINT_REMAINDER;
- }
- }
- /* Number of samples to generate now */
- int sample_count = so.buffer_size;
-#ifndef FOREVER_16_BIT_SOUND
- if (so.sixteen_bit)
- {
-#endif
- /* to prevent running out of buffer space,
- * create less samples
- */
- sample_count >>= 1;
-#ifndef FOREVER_16_BIT_SOUND
- }
-#endif
-
- audiobuff = (unsigned short*)ds2_getAudiobuff();
- while (audiobuff == NULL) //There are audio queue in sending or wait to send
- {
-#ifdef ACCUMULATE_JOYPAD
- NDSSFCAccumulateJoypad ();
-#endif
- audiobuff = (unsigned short*)ds2_getAudiobuff();
- }
-
- /* If we need more audio samples */
- if (so.samples_mixed_so_far < sample_count)
- {
- /* Where to put the samples to */
-#ifndef FOREVER_16_BIT_SOUND
- unsigned byte_offset = (so.play_position +
- (so.sixteen_bit ? (so.samples_mixed_so_far << 1) : so.samples_mixed_so_far)) & SOUND_BUFFER_SIZE_MASK;
-#else
- unsigned byte_offset = (so.play_position +
- (so.samples_mixed_so_far << 1)) & SOUND_BUFFER_SIZE_MASK;
-#endif
-
- if (Settings.SoundSync == 2)
- {
- /*memset (Buf + (byte_offset & SOUND_BUFFER_SIZE_MASK), 0,
- sample_count - so.samples_mixed_so_far);*/
- }
- else
- {
- /* Mix the missing samples */
-#ifndef FOREVER_16_BIT_SOUND
- int bytes_so_far = so.sixteen_bit ? (so.samples_mixed_so_far << 1) :
- so.samples_mixed_so_far;
-#else
- int bytes_so_far = so.samples_mixed_so_far << 1;
-#endif
-
- uint32 samples_to_write = sample_count - so.samples_mixed_so_far;
- do
- {
- int bytes_this_run = samples_to_write;
-#ifndef FOREVER_16_BIT_SOUND
- if (so.sixteen_bit)
-#endif
- bytes_this_run <<= 1;
-
- if (byte_offset + bytes_this_run > SOUND_BUFFER_SIZE)
- {
- bytes_this_run = SOUND_BUFFER_SIZE - byte_offset;
- }
-
- if (bytes_so_far + bytes_this_run > so.buffer_size)
- {
- bytes_this_run = so.buffer_size - bytes_so_far;
- if (bytes_this_run == 0)
- break;
- }
-
- int samples_this_run = bytes_this_run;
-#ifndef FOREVER_16_BIT_SOUND
- if (so.sixteen_bit)
-#endif
- samples_this_run >>= 1;
-
- S9xMixSamples (Buf + byte_offset, samples_this_run);
- so.samples_mixed_so_far += samples_this_run;
- samples_to_write -= samples_this_run;
-#ifndef FOREVER_16_BIT_SOUND
- bytes_so_far += so.sixteen_bit ? (samples_this_run << 1) :
- samples_this_run;
-#else
- bytes_so_far += samples_this_run << 1;
-#endif
- byte_offset = (byte_offset + bytes_this_run) & SOUND_BUFFER_SIZE_MASK;
- } while (samples_to_write > 0);
- }
- }
-
- // if (!so.mute_sound)
- {
- unsigned bytes_to_write = sample_count;
-#ifndef FOREVER_16_BIT_SOUND
- if(so.sixteen_bit)
-#endif
- bytes_to_write <<= 1;
-
- unsigned byte_offset = so.play_position;
- so.play_position = (so.play_position + bytes_to_write) & SOUND_BUFFER_SIZE_MASK; /* wrap to beginning */
-
- unsigned short *dst_pt = audiobuff;
- unsigned short *dst_pt1 = dst_pt + DS2_BUFFER_SIZE;
-
- /* Feed the samples to the soundcard until nothing is left */
- for(;;)
- {
- int I = bytes_to_write;
- if (byte_offset + I > SOUND_BUFFER_SIZE)
- {
- I = SOUND_BUFFER_SIZE - byte_offset;
- }
- if(I == 0) break;
-
- // memcpy(dst_pt, (char *) Buf + byte_offset, I);
- // dst_pt += I;
-
- unsigned short *src_pt= (unsigned short*)(Buf + byte_offset);
- for(int m= 0; m < I/4; m++)
- {
- *dst_pt++= *src_pt++;//(*src_pt++) <<1;
- *dst_pt1++= *src_pt++;//(*src_pt++) <<1;
- }
-
- bytes_to_write -= I;
- byte_offset = (byte_offset + I) & SOUND_BUFFER_SIZE_MASK; /* wrap */
- }
-
- ds2_updateAudio();
-
- /* All data sent. */
- }
-
- so.samples_mixed_so_far -= sample_count;
- }
-}
-
-/*
-const unsigned int keymap[12] = {
- 0x80, //KEY_A
- 0x8000, //KEY_B
- 0x2000, //KEY_SELECT
- 0x1000, //KEY_START
- 0x100, //KEY_RIGHT
- 0x200, //KEY_LEFT
- 0x800, //KEY_UP
- 0x400, //KEY_DOWN
- 0x10, //KEY_R
- 0x20, //KEY_L
- 0x40, //KEY_X
- 0x4000 //KEY_Y
- };
-*/
-
-static bool8 SoundToggleWasHeld = FALSE;
-static bool8 LoadStateWasHeld = FALSE;
-static bool8 SaveStateWasHeld = FALSE;
-static bool8 ToggleFullScreenWasHeld = FALSE;
-
-#ifdef ACCUMULATE_JOYPAD
-// These are kept as DS key bitfields until it's time to send them to Snes9x.
-static uint32 PreviousControls = 0x00000000;
-static uint32 ControlsPressed = 0x00000000;
-static uint32 ControlsReleased = 0x00000000;
-
-void NDSSFCAccumulateJoypad ()
-{
- struct key_buf inputdata;
- ds2_getrawInput(&inputdata);
-
- ControlsPressed |= inputdata.key & ~PreviousControls;
- ControlsReleased |= PreviousControls & ~inputdata.key;
-}
-#endif // ACCUMULATE_JOYPAD
-
-uint32 S9xReadJoypad (int which1)
-{
- if(which1 < 1)
- {
- uint32 Controls;
-#ifdef ACCUMULATE_JOYPAD
- Controls = (PreviousControls | ControlsPressed) & ~ControlsReleased;
- PreviousControls = Controls;
- ControlsPressed = ControlsReleased = 0x00000000;
-#else
- {
- struct key_buf inputdata;
- ds2_getrawInput(&inputdata);
-
- Controls = inputdata.key;
- }
-#endif
-
- if (Controls & KEY_LID)
- {
- LowFrequencyCPU();
- ds2_setSupend();
- struct key_buf inputdata;
- do {
- ds2_getrawInput(&inputdata);
- mdelay(1);
- } while (inputdata.key & KEY_LID);
- ds2_wakeup();
- // Before starting to emulate again, turn on only the
- // game screen's backlight.
- SCREEN_ID screen_num = emu_config.BottomScreenGame
- ? DOWN_SCREEN
- : UP_SCREEN;
- mdelay(100); // needed to avoid ds2_setBacklight crashing
- ds2_setBacklight(3 - screen_num);
- GameFrequencyCPU();
- }
-
- u32 HotkeyReturnToMenu = game_config.HotkeyReturnToMenu != 0 ? game_config.HotkeyReturnToMenu : emu_config.HotkeyReturnToMenu;
- u32 HotkeyTemporaryFastForward = game_config.HotkeyTemporaryFastForward != 0 ? game_config.HotkeyTemporaryFastForward : emu_config.HotkeyTemporaryFastForward;
- u32 HotkeyToggleSound = game_config.HotkeyToggleSound != 0 ? game_config.HotkeyToggleSound : emu_config.HotkeyToggleSound;
- u32 HotkeyQuickLoadState = game_config.HotkeyQuickLoadState != 0 ? game_config.HotkeyQuickLoadState : emu_config.HotkeyQuickLoadState;
- u32 HotkeyQuickSaveState = game_config.HotkeyQuickSaveState != 0 ? game_config.HotkeyQuickSaveState : emu_config.HotkeyQuickSaveState;
- u32 HotkeyToggleFullScreen = game_config.HotkeyToggleFullScreen != 0 ? game_config.HotkeyToggleFullScreen : emu_config.HotkeyToggleFullScreen;
-
- if(Controls & KEY_TOUCH ||
- (HotkeyReturnToMenu && ((Controls & HotkeyReturnToMenu) == HotkeyReturnToMenu))
- ) //Active menu
- Settings.Paused = 1;
-
- temporary_fast_forward =
- (HotkeyTemporaryFastForward && ((Controls & HotkeyTemporaryFastForward) == HotkeyTemporaryFastForward))
- ;
-
- bool8 SoundToggleIsHeld =
- (HotkeyToggleSound && ((Controls & HotkeyToggleSound) == HotkeyToggleSound))
- ;
-
- if (SoundToggleIsHeld && !SoundToggleWasHeld)
- {
- game_enable_audio = !game_enable_audio;
- game_disableAudio();
- }
-
- SoundToggleWasHeld = SoundToggleIsHeld;
-
- /* It is only safe to load/save a state between frames.
- * entry.cpp:sfc_main will pick this up. */
- bool8 LoadStateIsHeld =
- (HotkeyQuickLoadState && ((Controls & HotkeyQuickLoadState) == HotkeyQuickLoadState))
- ;
-
- if (LoadStateIsHeld && !LoadStateWasHeld)
- LoadStateNeeded = TRUE;
-
- LoadStateWasHeld = LoadStateIsHeld;
-
- bool8 SaveStateIsHeld =
- (HotkeyQuickSaveState && ((Controls & HotkeyQuickSaveState) == HotkeyQuickSaveState))
- ;
-
- if (SaveStateIsHeld && !SaveStateWasHeld)
- SaveStateNeeded = TRUE;
-
- SaveStateWasHeld = SaveStateIsHeld;
-
- /* Full-screen toggle? */
- bool8 ToggleFullScreenIsHeld =
- (HotkeyToggleFullScreen && ((Controls & HotkeyToggleFullScreen) == HotkeyToggleFullScreen))
- ;
-
- if (ToggleFullScreenIsHeld && !ToggleFullScreenWasHeld) {
- ToggleFullScreen ();
- }
-
- ToggleFullScreenWasHeld = ToggleFullScreenIsHeld;
-
- uint32 key = 0x80000000; // Required by Snes9x
-
- // DS -> SNES
- key |= (Controls & KEY_A ) << 7; // 0x0001 -> 0x0080
- key |= (Controls & KEY_B ) << 14; // 0x0002 -> 0x8000
- key |= (Controls & KEY_SELECT) << 11; // 0x0004 -> 0x2000
- key |= (Controls & KEY_START ) << 9; // 0x0008 -> 0x1000
- key |= (Controls & KEY_UP ) << 5; // 0x0040 -> 0x0800
- // 0x0010 -> 0x0100; 0x0020 -> 0x0200
- // 0x0030 -> 0x0300
- key |= (Controls & (KEY_RIGHT | KEY_LEFT)) << 4;
- // 0x0100 -> 0x0010; 0x0200 -> 0x0020; 0x0400 -> 0x0040
- // 0x0700 -> 0x0070
- key |= (Controls & (KEY_R | KEY_L | KEY_X)) >> 4;
- // 0x0080 -> 0x0400; 0x0800 -> 0x4000
- // 0x0880 -> 0x4400
- key |= (Controls & (KEY_DOWN | KEY_Y)) << 3;
-/*
- for(i= 0; i < 12; i++) //remap key
- {
- key |= (inputdata.key & (1<<i)) ? keymap[i] : 0;
- }
-*/
-
- return key;
- }
- else
- return 0;
-}
-
-static int S9xCompareSDD1IndexEntries (const void *p1, const void *p2)
-{
- return (*(uint32 *) p1 - *(uint32 *) p2);
-}
-
-void S9xLoadSDD1Data ()
-{
- char filename [_MAX_PATH + 1];
- char index [_MAX_PATH + 1];
- char data [_MAX_PATH + 1];
- char patch [_MAX_PATH + 1];
-
- Memory.FreeSDD1Data ();
-
- strcpy (filename, S9xGetSnapshotDirectory ());
-
- Settings.SDD1Pack=FALSE;
- if (strncmp (Memory.ROMName, "Star Ocean", 10) == 0){
- if(SDD1_pack) strcpy (filename, SDD1_pack);
-#ifdef SDD1_DECOMP
- else Settings.SDD1Pack=TRUE;
-#else
- strcat (filename, "/socnsdd1");
-#endif
- } else if(strncmp(Memory.ROMName, "STREET FIGHTER ALPHA2", 21)==0){
- if(SDD1_pack) strcpy (filename, SDD1_pack);
-#ifdef SDD1_DECOMP
- else Settings.SDD1Pack=TRUE;
-#else
- strcat (filename, "/sfa2sdd1");
-#endif
- } else {
- if(SDD1_pack) strcpy (filename, SDD1_pack);
-#ifdef SDD1_DECOMP
- else Settings.SDD1Pack=TRUE;
-#else
- S9xMessage(S9X_WARNING, S9X_ROM_INFO, "WARNING: No default SDD1 pack for this ROM");
-#endif
- }
-
- if(Settings.SDD1Pack) return;
-
- DIR *dir = opendir (filename);
-
- index [0] = 0;
- data [0] = 0;
- patch [0] = 0;
-
- if (dir)
- {
-// struct dirent *d;
- dirent *d;
-
- while ((d = readdir (dir)))
- {
- if (strcasecmp (d->d_name, "SDD1GFX.IDX") == 0)
- {
- strcpy (index, filename);
- strcat (index, "/");
- strcat (index, d->d_name);
- }
- else
- if (strcasecmp (d->d_name, "SDD1GFX.DAT") == 0)
- {
- strcpy (data, filename);
- strcat (data, "/");
- strcat (data, d->d_name);
- }
- if (strcasecmp (d->d_name, "SDD1GFX.PAT") == 0)
- {
- strcpy (patch, filename);
- strcat (patch, "/");
- strcat (patch, d->d_name);
- }
- }
- closedir (dir);
-
- if (strlen (index) && strlen (data))
- {
- FILE *fs = fopen (index, "rb");
- int len = 0;
-
- if (fs)
- {
- // Index is stored as a sequence of entries, each entry being
- // 12 bytes consisting of:
- // 4 byte key: (24bit address & 0xfffff * 16) | translated block
- // 4 byte ROM offset
- // 4 byte length
- fseek (fs, 0, SEEK_END);
- len = ftell (fs);
- //rewind (fs);
- fseek (fs, 0, SEEK_SET);
- Memory.SDD1Index = (uint8 *) malloc (len);
- fread (Memory.SDD1Index, 1, len, fs);
- fclose (fs);
- Memory.SDD1Entries = len / 12;
-
- if (!(fs = fopen (data, "rb")))
- {
- free ((char *) Memory.SDD1Index);
- Memory.SDD1Index = NULL;
- Memory.SDD1Entries = 0;
- }
- else
- {
- fseek (fs, 0, SEEK_END);
- len = ftell (fs);
- //rewind (fs);
- fseek (fs, 0, SEEK_SET);
- Memory.SDD1Data = (uint8 *) malloc (len);
- fread (Memory.SDD1Data, 1, len, fs);
- fclose (fs);
-
- if (strlen (patch) > 0 &&
- (fs = fopen (patch, "rb")))
- {
- fclose (fs);
- }
-#ifdef MSB_FIRST
- // Swap the byte order of the 32-bit value triplets on
- // MSBFirst machines.
- uint8 *ptr = Memory.SDD1Index;
- for (int i = 0; i < Memory.SDD1Entries; i++, ptr += 12)
- {
- SWAP_DWORD ((*(uint32 *) (ptr + 0)));
- SWAP_DWORD ((*(uint32 *) (ptr + 4)));
- SWAP_DWORD ((*(uint32 *) (ptr + 8)));
- }
-#endif
- qsort (Memory.SDD1Index, Memory.SDD1Entries, 12,
- S9xCompareSDD1IndexEntries);
- }
- }
- }
- else
- {
- fprintf (stderr, "Decompressed data pack not found in '%s'.\n",
- filename);
- }
- }
-}
-
-bool8 S9xReadMousePosition (int which1, int &x, int &y, uint32 &buttons)
-{
- return (FALSE);
-}
-
-bool8 S9xReadSuperScopePosition (int &x, int &y, uint32 &buttons)
-{
- return (TRUE);
-}
-
-bool JustifierOffscreen()
-{
- return (FALSE);
-}
-
-void JustifierButtons(uint32& justifiers)
-{
-}
-
-START_EXTERN_C
-char* osd_GetPackDir()
-{
- static char filename[_MAX_PATH];
- memset(filename, 0, _MAX_PATH);
-
- if(strlen(S9xGetSnapshotDirectory())!=0)
- strcpy (filename, S9xGetSnapshotDirectory());
- else
- {
- char dir [_MAX_DIR + 1];
- char drive [_MAX_DRIVE + 1];
- char name [_MAX_FNAME + 1];
- char ext [_MAX_EXT + 1];
- _splitpath(Memory.ROMFilename, drive, dir, name, ext);
- _makepath(filename, drive, dir, NULL, NULL);
- }
-
- if(!strncmp((char*)&Memory.ROM [0xffc0], "SUPER POWER LEAG 4 ", 21))
- {
- if (getenv("SPL4PACK"))
- return getenv("SPL4PACK");
- else
- strcat(filename, "/SPL4-SP7");
- }
- else if(!strncmp((char*)&Memory.ROM [0xffc0], "MOMOTETSU HAPPY ",21))
- {
- if (getenv("MDHPACK"))
- return getenv("MDHPACK");
- else
- strcat(filename, "/SMHT-SP7");
- }
- else if(!strncmp((char*)&Memory.ROM [0xffc0], "HU TENGAI MAKYO ZERO ", 21))
- {
- if (getenv("FEOEZPACK"))
- return getenv("FEOEZPACK");
- else
- strcat(filename, "/FEOEZSP7");
- }
- else if(!strncmp((char*)&Memory.ROM [0xffc0], "JUMP TENGAIMAKYO ZERO",21))
- {
- if (getenv("SJNSPACK"))
- return getenv("SJNSPACK");
- else
- strcat(filename, "/SJUMPSP7");
- } else strcat(filename, "/MISC-SP7");
- return filename;
-}
-END_EXTERN_C
-
-
diff --git a/source/nds/entry.h b/source/nds/entry.h
deleted file mode 100644
index e1646fb..0000000
--- a/source/nds/entry.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifdef __cplusplus
-extern "C" {
-#endif
- void game_disableAudio();
- void game_set_frameskip();
- void game_set_fluidity();
- void game_set_retro();
-
- int game_load_state(char* file);
- int game_save_state(char* file);
- void S9xAutoSaveSRAM ();
-
- void game_restart(void);
-
- int load_gamepak(const char* file);
-#ifdef __cplusplus
-}
-#endif
-
-const char *S9xGetFilename (const char *ex);
diff --git a/source/nds/font_dot.h b/source/nds/font_dot.h
deleted file mode 100644
index c3b534a..0000000
--- a/source/nds/font_dot.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/* font_dot.h
- *
- * Copyright (C) 2010 dking <dking024@gmail.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public Licens e as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __FONT_DOT_H__
-#define __FONT_DOT_H__
-
-//version 0.1
-
-const unsigned char font_map[128][8] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x08, 0x08, 0x08, 0x08,
- 0x00, 0x00, 0x00, 0x78, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x00, 0x00, 0x00, 0x00,
- 0x08, 0x08, 0x08, 0x78, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
- 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00,
- 0x7c, 0x64, 0x44, 0x44, 0x64, 0x7c, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x08, 0x10, 0x70, 0x50, 0x50, 0x70, 0x00,
- 0x24, 0x24, 0x1c, 0x08, 0x3f, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x16, 0x1a, 0x12, 0x12, 0x16, 0x34, 0x20, 0x00, 0x3c, 0x24, 0x24, 0x66, 0x24, 0x3c, 0x08, 0x08,
- 0x08, 0x08, 0x08, 0x7f, 0x08, 0x08, 0x08, 0x08, 0x0c, 0x1c, 0x3c, 0x3c, 0x1c, 0x0c, 0x04, 0x00,
- 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x1c, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x00, 0x00,
- 0x54, 0x54, 0x34, 0x14, 0x14, 0x14, 0x14, 0x14, 0x08, 0x08, 0x08, 0x7f, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x7f, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x78, 0x08, 0x08, 0x08, 0x08,
- 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, 0x08, 0x08, 0x08,
- 0x00, 0x00, 0x08, 0x7c, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x7c, 0x20, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10, 0x00,
- 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x14, 0x7e, 0x28, 0x7e, 0x28, 0x28, 0x00,
- 0x1c, 0x2c, 0x28, 0x18, 0x0c, 0x2c, 0x3c, 0x08, 0x64, 0x68, 0x68, 0x7c, 0x1c, 0x1c, 0x2c, 0x00,
- 0x30, 0x30, 0x3c, 0x28, 0x58, 0x50, 0x3c, 0x00, 0x30, 0x30, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x08, 0x10, 0x10, 0x10, 0x10, 0x08, 0x04, 0x40, 0x20, 0x10, 0x10, 0x10, 0x10, 0x20, 0x40,
- 0x10, 0x54, 0x38, 0x38, 0x54, 0x10, 0x00, 0x00, 0x10, 0x10, 0x7c, 0x10, 0x10, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x40, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x20, 0x40,
- 0x18, 0x24, 0x24, 0x24, 0x24, 0x24, 0x18, 0x00, 0x10, 0x30, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00,
- 0x18, 0x24, 0x04, 0x08, 0x10, 0x20, 0x3c, 0x00, 0x18, 0x24, 0x04, 0x18, 0x04, 0x24, 0x18, 0x00,
- 0x08, 0x18, 0x28, 0x48, 0x7c, 0x08, 0x08, 0x00, 0x3c, 0x20, 0x38, 0x04, 0x04, 0x24, 0x18, 0x00,
- 0x38, 0x40, 0x40, 0x78, 0x44, 0x44, 0x38, 0x00, 0x3c, 0x08, 0x08, 0x10, 0x10, 0x10, 0x10, 0x00,
- 0x18, 0x24, 0x24, 0x18, 0x24, 0x24, 0x18, 0x00, 0x18, 0x24, 0x24, 0x1c, 0x04, 0x04, 0x18, 0x00,
- 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x10, 0x20,
- 0x04, 0x08, 0x10, 0x20, 0x10, 0x08, 0x04, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x7c, 0x00, 0x00,
- 0x20, 0x10, 0x08, 0x04, 0x08, 0x10, 0x20, 0x00, 0x10, 0x24, 0x24, 0x08, 0x10, 0x10, 0x00, 0x10,
- 0x38, 0x4c, 0x54, 0x5c, 0x54, 0x44, 0x38, 0x00, 0x10, 0x10, 0x28, 0x28, 0x38, 0x28, 0x6c, 0x00,
- 0x78, 0x24, 0x38, 0x24, 0x24, 0x24, 0x78, 0x00, 0x3c, 0x44, 0x40, 0x40, 0x40, 0x44, 0x38, 0x00,
- 0x78, 0x24, 0x24, 0x24, 0x24, 0x24, 0x78, 0x00, 0x7c, 0x24, 0x20, 0x38, 0x20, 0x24, 0x7c, 0x00,
- 0x7c, 0x24, 0x28, 0x38, 0x28, 0x20, 0x70, 0x00, 0x38, 0x40, 0x40, 0x40, 0x5c, 0x48, 0x30, 0x00,
- 0x76, 0x24, 0x24, 0x3c, 0x24, 0x24, 0x76, 0x00, 0x38, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00,
- 0x38, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x60, 0x74, 0x28, 0x30, 0x30, 0x28, 0x28, 0x6c, 0x00,
- 0x70, 0x20, 0x20, 0x20, 0x20, 0x24, 0x7c, 0x00, 0x66, 0x3c, 0x3c, 0x3c, 0x34, 0x24, 0x66, 0x00,
- 0x6e, 0x24, 0x34, 0x34, 0x2c, 0x24, 0x74, 0x00, 0x38, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00,
- 0x78, 0x24, 0x24, 0x38, 0x20, 0x20, 0x70, 0x00, 0x38, 0x44, 0x44, 0x44, 0x74, 0x4c, 0x38, 0x0c,
- 0x78, 0x24, 0x38, 0x28, 0x24, 0x24, 0x76, 0x00, 0x1c, 0x24, 0x20, 0x18, 0x04, 0x24, 0x38, 0x00,
- 0x7c, 0x54, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x66, 0x24, 0x24, 0x24, 0x24, 0x24, 0x18, 0x00,
- 0x6c, 0x28, 0x28, 0x28, 0x28, 0x10, 0x10, 0x00, 0x7e, 0x52, 0x52, 0x2c, 0x2c, 0x24, 0x24, 0x00,
- 0x6c, 0x28, 0x28, 0x10, 0x28, 0x28, 0x6c, 0x00, 0x6c, 0x28, 0x28, 0x10, 0x10, 0x10, 0x38, 0x00,
- 0x7c, 0x48, 0x10, 0x10, 0x20, 0x24, 0x7c, 0x00, 0x00, 0x1c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1c,
- 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x08, 0x04, 0x00, 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x38,
- 0x10, 0x28, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C,
- 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x48, 0x38, 0x48, 0x3c, 0x00,
- 0x60, 0x20, 0x38, 0x24, 0x24, 0x24, 0x38, 0x00, 0x00, 0x00, 0x1c, 0x24, 0x20, 0x20, 0x1c, 0x00,
- 0x0c, 0x04, 0x1c, 0x24, 0x24, 0x24, 0x1e, 0x00, 0x00, 0x00, 0x18, 0x24, 0x3c, 0x20, 0x1c, 0x00,
- 0x0c, 0x10, 0x3c, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, 0x3c, 0x28, 0x38, 0x20, 0x3c, 0x3c,
- 0x60, 0x20, 0x38, 0x24, 0x24, 0x24, 0x76, 0x00, 0x10, 0x00, 0x30, 0x10, 0x10, 0x10, 0x38, 0x00,
- 0x08, 0x00, 0x18, 0x08, 0x08, 0x08, 0x08, 0x38, 0x60, 0x20, 0x2c, 0x28, 0x30, 0x28, 0x6c, 0x00,
- 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, 0x78, 0x54, 0x54, 0x54, 0x54, 0x00,
- 0x00, 0x00, 0x78, 0x24, 0x24, 0x24, 0x76, 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00,
- 0x00, 0x00, 0x78, 0x24, 0x24, 0x24, 0x38, 0x70, 0x00, 0x00, 0x1c, 0x24, 0x24, 0x24, 0x1c, 0x0e,
- 0x00, 0x00, 0x34, 0x18, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, 0x3c, 0x20, 0x18, 0x04, 0x3c, 0x00,
- 0x10, 0x10, 0x38, 0x10, 0x10, 0x10, 0x08, 0x00, 0x00, 0x00, 0x6c, 0x24, 0x24, 0x24, 0x1e, 0x00,
- 0x00, 0x00, 0x6c, 0x28, 0x28, 0x28, 0x10, 0x00, 0x00, 0x00, 0x6f, 0x2a, 0x2a, 0x36, 0x14, 0x00,
- 0x00, 0x00, 0x7c, 0x28, 0x10, 0x28, 0x7c, 0x00, 0x00, 0x00, 0x7c, 0x28, 0x10, 0x10, 0x20, 0x60,
- 0x00, 0x00, 0x3c, 0x08, 0x08, 0x10, 0x3c, 0x00, 0x00, 0x08, 0x10, 0x10, 0x20, 0x10, 0x10, 0x08,
- 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x20, 0x10, 0x10, 0x08, 0x10, 0x10, 0x20,
- 0x00, 0x00, 0x20, 0x54, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- };
-
-#endif //__FONT_DOT_H__
-
diff --git a/source/nds/gcheat.c b/source/nds/gcheat.c
deleted file mode 100644
index 93d89cc..0000000
--- a/source/nds/gcheat.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/* gcheat.c
- *
- * Copyright (C) 2012 GBAtemp user Nebuleon.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "port.h"
-#include "string.h"
-#include "fs_api.h"
-#include "ds2_malloc.h"
-#include "gcheat.h"
-#include "cheats.h"
-
-extern struct SCheatData Cheat;
-
-// Reads a cheat text file in BSNES's format.
-int NDSSFCLoadCheatFile(const char* filename)
-{
- FILE* fp = fopen(filename, "r");
- if (fp == NULL)
- return -1;
-
- S9xDeleteCheats();
-
- // The construction is "a","b","c" <newline>.
- // a is ignored. In BSNES, it decides whether the code is enabled.
- // b is a series of codes separated by +. Each of the codes is in the form
- // accepted by the Game Genie, Pro Action Replay, or the GoldFinger.
- // c is the cheat's description.
- char line[256], code[24];
- char *description, *codes_ptr;
- uint32 address;
- uint8 byte;
- uint8 bytes [3];
- bool8 sram;
- uint8 num_bytes;
-
- while (fgets(line, sizeof(line), fp))
- {
- char* ptr = &line[0];
- // Ignore a.
- while (*ptr && *ptr != ',')
- ptr++;
- // If there was no comma, declare a bad file.
- if (*ptr == '\0') {
- fclose(fp);
- return -2;
- }
- ptr++; // Past the comma
-
- if (*ptr && *ptr == '"')
- ptr++; // Starting quote of b.
- codes_ptr = ptr; // Save this for later.
- while (*ptr && *ptr != ',')
- ptr++;
- // If there was no comma, declare a bad file.
- if (*ptr == '\0') {
- fclose(fp);
- return -2;
- }
- *ptr = '\0'; // End the codes there
- ptr++; // Past the comma
-
- uint32 i = 0;
- description = ptr; // Skip starting " in description
- while (*description && *description == '"')
- description++;
- ptr = description;
- while (*ptr && !(*ptr == '\r' || *ptr == '\n' || *ptr == '"') && i < MAX_SFCCHEAT_NAME - 1) {
- ptr++; // Remove trailing newline/quote in description
- i++; // Clip the cheat name to MAX_SFCCHEAT_NAME chars
- }
- *ptr = '\0';
-
- uint32 c;
- // n is the number of cheat codes. Beware of MAX_CHEATS_T.
-
- // List of cheat codes having the same description.
- ptr = codes_ptr;
- while (*ptr && !(*ptr == ',' || *ptr == '"')) {
- if (Cheat.num_cheats >= MAX_CHEATS_T) {
- fclose(fp);
- return 0;
- }
- i = 0;
- while (*ptr && !(*ptr == '+' || *ptr == ',' || *ptr == '"') && i < sizeof(code) - 1)
- code[i++] = *ptr++;
- if (*ptr)
- ptr++; // Go past the + , or "
- code[i] = '\0';
- if (!S9xGameGenieToRaw (code, &address, &byte)) {
- S9xAddCheat (FALSE, FALSE, address, byte);
- strncpy (Cheat.c[Cheat.num_cheats - 1].name, description, MAX_SFCCHEAT_NAME);
- }
- else if (!S9xProActionReplayToRaw (code, &address, &byte)) {
- S9xAddCheat (FALSE, FALSE, address, byte);
- strncpy (Cheat.c[Cheat.num_cheats - 1].name, description, MAX_SFCCHEAT_NAME);
- }
- else if (!S9xGoldFingerToRaw (code, &address, &sram, &num_bytes, bytes))
- {
- for (c = 0; c < num_bytes; c++) {
- S9xAddCheat (FALSE, FALSE, address + c, bytes[c]);
- strncpy (Cheat.c[Cheat.num_cheats - 1].name, description, MAX_SFCCHEAT_NAME);
- }
- }
- else {
- fclose(fp);
- return -3; // Bad cheat format
- }
- }
- }
-
- fclose(fp);
- return 0;
-}
diff --git a/source/nds/gcheat.h b/source/nds/gcheat.h
deleted file mode 100644
index 65d480e..0000000
--- a/source/nds/gcheat.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* gcheat.h
- *
- * Copyright (C) 2010 dking <dking024@gmail.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public Licens e as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __GCHEAT_H__
-#define __GCHEAT_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "cheats.h"
-
-#define CHEATS_PER_PAGE 6
-#define MAX_CHEATS_PAGE (MAX_CHEATS_T / CHEATS_PER_PAGE)
-
-extern int NDSSFCLoadCheatFile(const char* filename);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //__GCHEAT_H__
diff --git a/source/nds/gui.c b/source/nds/gui.c
deleted file mode 100644
index 0d91d79..0000000
--- a/source/nds/gui.c
+++ /dev/null
@@ -1,4936 +0,0 @@
-/* gui.c
- *
- * Copyright (C) 2010 dking <dking024@gmail.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public Licens e as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "snes9x.h"
-
-#include <stdio.h>
-#include <string.h>
-#include <sys/stat.h>
-
-#include "port.h"
-#include "ds2_types.h"
-#include "ds2_timer.h"
-#include "ds2io.h"
-#include "ds2_malloc.h"
-#include "ds2_cpu.h"
-#include "fs_api.h"
-#include "key.h"
-#include "gui.h"
-#include "entry.h"
-#include "draw.h"
-#include "message.h"
-#include "bitmap.h"
-#include "gcheat.h"
-#include "cheatgrp.h"
-
-extern struct SCheatData Cheat;
-
-char main_path[MAX_PATH];
-char rom_path[MAX_PATH];
-char gamepak_name[MAX_PATH];
-char gcheat_filename[MAX_PATH];
-
-//program arguments
-char argv[2][MAX_PATH];
-
-// If adding a language, make sure you update the size of the array in
-// message.h too.
-char *lang[8] =
- {
- "English", // 0
- "简体中文", // 1
- "Français", // 2
- "Deutsch", // 3
- "Nederlands", // 4
- "Español", // 5
- "Italiano", // 6
- "Português (Br.)", // 7
- };
-
-char *language_options[] = { (char *) &lang[0], (char *) &lang[1], (char *) &lang[2], (char *) &lang[3], (char *) &lang[4], (char *) &lang[5], (char *) &lang[6], (char *) &lang[7] };
-
-/******************************************************************************
-* Macro definition
- ******************************************************************************/
-#define SUBMENU_ROW_NUM 8
-#define FILE_LIST_ROWS SUBMENU_ROW_NUM
-
-#define NDSSFC_VERSION "1.36"
-
-#define SAVE_STATE_SLOT_NUM 16
-
-#define LANGUAGE_PACK "SYSTEM/language.msg"
-#define EMU_CONFIG_FILENAME "SYSTEM/ndssfc.cfg"
-
-//emulator configure file's header
-#define EMU_CONFIG_HEADER "NSFC1.0"
-#define EMU_CONFIG_HEADER_SIZE 7
-EMU_CONFIG emu_config;
-
-//game configure file's header
-#define GAME_CONFIG_HEADER "GSFC1.1" // 1.1 removed cheat names
-#define GAME_CONFIG_HEADER_SIZE 7
-GAME_CONFIG game_config;
-
-//save state file map
-static uint32 savestate_index; // current selection in the saved states menu
-static int32 latest_save; // Slot number of the latest (in time) save for this game, or -1 if none
-static bool8 SavedStateExistenceCached [SAVE_STATE_SLOT_NUM]; // [I] == TRUE if Cache[I] is meaningful
-static bool8 SavedStateExistenceCache [SAVE_STATE_SLOT_NUM];
-
-// These are U+05C8 and subsequent codepoints encoded in UTF-8.
-const uint8 HOTKEY_A_DISPLAY[] = {0xD7, 0x88, 0x00};
-const uint8 HOTKEY_B_DISPLAY[] = {0xD7, 0x89, 0x00};
-const uint8 HOTKEY_X_DISPLAY[] = {0xD7, 0x8A, 0x00};
-const uint8 HOTKEY_Y_DISPLAY[] = {0xD7, 0x8B, 0x00};
-const uint8 HOTKEY_L_DISPLAY[] = {0xD7, 0x8C, 0x00};
-const uint8 HOTKEY_R_DISPLAY[] = {0xD7, 0x8D, 0x00};
-const uint8 HOTKEY_START_DISPLAY[] = {0xD7, 0x8E, 0x00};
-const uint8 HOTKEY_SELECT_DISPLAY[] = {0xD7, 0x8F, 0x00};
-// These are U+2190 and subsequent codepoints encoded in UTF-8.
-const uint8 HOTKEY_LEFT_DISPLAY[] = {0xE2, 0x86, 0x90, 0x00};
-const uint8 HOTKEY_UP_DISPLAY[] = {0xE2, 0x86, 0x91, 0x00};
-const uint8 HOTKEY_RIGHT_DISPLAY[] = {0xE2, 0x86, 0x92, 0x00};
-const uint8 HOTKEY_DOWN_DISPLAY[] = {0xE2, 0x86, 0x93, 0x00};
-
-#define MAKE_MENU(name, init_function, passive_function, key_function, end_function, \
- focus_option, screen_focus) \
- MENU_TYPE name##_menu = \
- { \
- init_function, \
- passive_function, \
- key_function, \
- end_function, \
- name##_options, \
- sizeof(name##_options) / sizeof(MENU_OPTION_TYPE), \
- focus_option, \
- screen_focus \
- } \
-
-#define INIT_MENU(name, init_functions, passive_functions, key, end, focus, screen)\
- { \
- name##_menu.init_function = init_functions, \
- name##_menu.passive_function = passive_functions, \
- name##_menu.key_function = key, \
- name##_menu.end_function = end, \
- name##_menu.options = name##_options, \
- name##_menu.num_options = sizeof(name##_options) / sizeof(MENU_OPTION_TYPE),\
- name##_menu.focus_option = focus, \
- name##_menu.screen_focus = screen; \
- } \
-
-#define CHEAT_OPTION(action_function, passive_function, number, line_number) \
-{ \
- action_function, \
- passive_function, \
- NULL, \
- &cheat_data_ptr[number], \
- NULL /* enable_disable_options */, \
- NULL, \
- 2, \
- NULL, \
- line_number, \
- ACTION_TYPE \
-} \
-
-#define ACTION_OPTION(action_function, passive_function, display_string, \
- help_string, line_number) \
-{ \
- action_function, \
- passive_function, \
- NULL, \
- display_string, \
- NULL, \
- NULL, \
- 0, \
- help_string, \
- line_number, \
- ACTION_TYPE \
-} \
-
-#define SUBMENU_OPTION(sub_menu, display_string, help_string, line_number) \
-{ \
- NULL, \
- NULL, \
- sub_menu, \
- display_string, \
- NULL, \
- NULL, \
- sizeof(sub_menu) / sizeof(MENU_OPTION_TYPE), \
- help_string, \
- line_number, \
- SUBMENU_TYPE \
-} \
-
-#define SELECTION_OPTION(passive_function, display_string, options, \
- option_ptr, num_options, help_string, line_number, type) \
-{ \
- NULL, \
- passive_function, \
- NULL, \
- display_string, \
- options, \
- option_ptr, \
- num_options, \
- help_string, \
- line_number, \
- type \
-} \
-
-#define ACTION_SELECTION_OPTION(action_function, passive_function, \
- display_string, options, option_ptr, num_options, help_string, line_number, \
- type) \
-{ \
- action_function, \
- passive_function, \
- NULL, \
- display_string, \
- options, \
- option_ptr, \
- num_options, \
- help_string, \
- line_number, \
- type | ACTION_TYPE \
-} \
-
-#define STRING_SELECTION_OPTION(action_function, passive_function, \
- display_string, options, option_ptr, num_options, help_string, action, line_number)\
-{ \
- action_function, \
- passive_function, \
- NULL, \
- display_string, \
- options, \
- option_ptr, \
- num_options, \
- help_string, \
- line_number, \
- STRING_SELECTION_TYPE | action \
-}
-
-#define NUMERIC_SELECTION_OPTION(passive_function, display_string, \
- option_ptr, num_options, help_string, line_number) \
- SELECTION_OPTION(passive_function, display_string, NULL, option_ptr, \
- num_options, help_string, line_number, NUMBER_SELECTION_TYPE) \
-
-#define STRING_SELECTION_HIDEN_OPTION(action_function, passive_function, \
- display_string, options, option_ptr, num_options, help_string, line_number) \
- ACTION_SELECTION_OPTION(action_function, passive_function, \
- display_string, options, option_ptr, num_options, help_string, \
- line_number, (STRING_SELECTION_TYPE | HIDEN_TYPE)) \
-
-#define NUMERIC_SELECTION_ACTION_OPTION(action_function, passive_function, \
- display_string, option_ptr, num_options, help_string, line_number) \
- ACTION_SELECTION_OPTION(action_function, passive_function, \
- display_string, NULL, option_ptr, num_options, help_string, \
- line_number, NUMBER_SELECTION_TYPE) \
-
-#define NUMERIC_SELECTION_HIDE_OPTION(action_function, passive_function, \
- display_string, option_ptr, num_options, help_string, line_number) \
- ACTION_SELECTION_OPTION(action_function, passive_function, \
- display_string, NULL, option_ptr, num_options, help_string, \
- line_number, NUMBER_SELECTION_TYPE) \
-
-
-typedef enum
-{
- NUMBER_SELECTION_TYPE = 0x01,
- STRING_SELECTION_TYPE = 0x02,
- SUBMENU_TYPE = 0x04,
- ACTION_TYPE = 0x08,
- HIDEN_TYPE = 0x10,
- PASSIVE_TYPE = 0x00,
-} MENU_OPTION_TYPE_ENUM;
-
-struct _MENU_OPTION_TYPE
-{
- void (* action_function)(); //Active option to process input
- void (* passive_function)(); //Passive function to process this option
- struct _MENU_TYPE *sub_menu; //Sub-menu of this option
- char **display_string; //Name and other things of this option
- void *options; //output value of this option
- u32 *current_option; //output values
- u32 num_options; //Total output values
- char **help_string; //Help string
- u32 line_number; //Order id of this option in it menu
- MENU_OPTION_TYPE_ENUM option_type; //Option types
-};
-
-struct _MENU_TYPE
-{
- void (* init_function)(); //Function to initialize this menu
- void (* passive_function)(); //Function to draw this menu
- void (* key_function)(); //Function to process input
- void (* end_function)(); //End process of this menu
- struct _MENU_OPTION_TYPE *options; //Options array
- u32 num_options; //Total options of this menu
- u32 focus_option; //Option which obtained focus
- u32 screen_focus; //screen positon of the focus option
-};
-
-typedef struct _MENU_OPTION_TYPE MENU_OPTION_TYPE;
-typedef struct _MENU_TYPE MENU_TYPE;
-
-/******************************************************************************
- ******************************************************************************/
-char g_default_rom_dir[MAX_PATH];
-char DEFAULT_RTS_DIR[MAX_PATH];
-char DEFAULT_CFG_DIR[MAX_PATH];
-char DEFAULT_SS_DIR[MAX_PATH];
-char DEFAULT_CHEAT_DIR[MAX_PATH];
-u32 game_fast_forward= 0;
-u32 temporary_fast_forward = 0;
-u32 game_enable_audio = 1;
-
-
-
-
-/******************************************************************************
- ******************************************************************************/
-static u32 menu_cheat_page = 0;
-u32 gamepad_config_menu;
-
-/******************************************************************************
- ******************************************************************************/
-static void get_savestate_filelist(void);
-static void get_savestate_filename(u32 slot, char *name_buffer);
-static uint8 SavedStateSquareX (u32 slot);
-static bool8 SavedStateFileExists (u32 slot);
-static void SavedStateCacheInvalidate (void);
-void get_newest_savestate(char *name_buffer);
-static u32 parse_line(char *current_line, char *current_str);
-static void get_timestamp_string(char *buffer, u16 msg_id, u16 year, u16 mon, u16 day, u16 wday, u16 hour, u16 min, u16 sec, u32 msec);
-static void get_time_string(char *buff, struct rtc *rtcp);
-static u32 save_ss_bmp(u16 *image);
-static u32 save_menu_ss_bmp(u16 *image);
-static void init_game_config(void);
-static void init_emulator_config(void);
-static void load_game_config_file(void);
-static int load_emu_config_file(void);
-static int save_game_config_file(void);
-static int save_emu_config_file(void);
-static void reorder_latest_file(void);
-static void quit(void);
-
-/*--------------------------------------------------------
- Get GUI input
---------------------------------------------------------*/
-#define BUTTON_REPEAT_START (21428 / 2)
-#define BUTTON_REPEAT_CONTINUE (21428 / 20)
-
-u32 button_repeat_timestamp;
-
-typedef enum
-{
- BUTTON_NOT_HELD,
- BUTTON_HELD_INITIAL,
- BUTTON_HELD_REPEAT
-} button_repeat_state_type;
-
-button_repeat_state_type button_repeat_state = BUTTON_NOT_HELD;
-unsigned int gui_button_repeat = 0;
-
-gui_action_type key_to_cursor(unsigned int key)
-{
- switch (key)
- {
- case KEY_UP: return CURSOR_UP;
- case KEY_DOWN: return CURSOR_DOWN;
- case KEY_LEFT: return CURSOR_LEFT;
- case KEY_RIGHT: return CURSOR_RIGHT;
- case KEY_L: return CURSOR_LTRIGGER;
- case KEY_R: return CURSOR_RTRIGGER;
- case KEY_A: return CURSOR_SELECT;
- case KEY_B: return CURSOR_BACK;
- case KEY_X: return CURSOR_EXIT;
- case KEY_TOUCH: return CURSOR_TOUCH;
- default: return CURSOR_NONE;
- }
-}
-
-static unsigned int gui_keys[] = {
- KEY_A, KEY_B, KEY_X, KEY_L, KEY_R, KEY_TOUCH, KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT
-};
-
-gui_action_type get_gui_input(void)
-{
- gui_action_type ret;
-
- struct key_buf inputdata;
- ds2_getrawInput(&inputdata);
-
- if (inputdata.key & KEY_LID)
- {
- ds2_setSupend();
- do {
- ds2_getrawInput(&inputdata);
- mdelay(1);
- } while (inputdata.key & KEY_LID);
- ds2_wakeup();
- // In the menu, the lower screen's backlight needs to be on,
- // and it is on right away after resuming from suspend.
- // mdelay(100); // needed to avoid ds2_setBacklight crashing
- // ds2_setBacklight(3);
- }
-
- if ((inputdata.key & (KEY_L | KEY_R)) == (KEY_L | KEY_R))
- {
- save_menu_ss_bmp(down_screen_addr);
- do {
- ds2_getrawInput(&inputdata);
- mdelay(1);
- } while ((inputdata.key & (KEY_L | KEY_R)) == (KEY_L | KEY_R));
- }
-
- unsigned int i;
- while (1)
- {
- switch (button_repeat_state)
- {
- case BUTTON_NOT_HELD:
- // Pick the first pressed button out of the gui_keys array.
- for (i = 0; i < sizeof(gui_keys) / sizeof(gui_keys[0]); i++)
- {
- if (inputdata.key & gui_keys[i])
- {
- button_repeat_state = BUTTON_HELD_INITIAL;
- button_repeat_timestamp = getSysTime();
- gui_button_repeat = gui_keys[i];
- return key_to_cursor(gui_keys[i]);
- }
- }
- return CURSOR_NONE;
- case BUTTON_HELD_INITIAL:
- case BUTTON_HELD_REPEAT:
- // If the key that was being held isn't anymore...
- if (!(inputdata.key & gui_button_repeat))
- {
- button_repeat_state = BUTTON_NOT_HELD;
- // Go see if another key is held (try #2)
- break;
- }
- else
- {
- unsigned int IsRepeatReady = getSysTime() - button_repeat_timestamp >= (button_repeat_state == BUTTON_HELD_INITIAL ? BUTTON_REPEAT_START : BUTTON_REPEAT_CONTINUE);
- if (!IsRepeatReady)
- {
- // Temporarily turn off the key.
- // It's not its turn to be repeated.
- inputdata.key &= ~gui_button_repeat;
- }
-
- // Pick the first pressed button out of the gui_keys array.
- for (i = 0; i < sizeof(gui_keys) / sizeof(gui_keys[0]); i++)
- {
- if (inputdata.key & gui_keys[i])
- {
- // If it's the held key,
- // it's now repeating quickly.
- button_repeat_state = gui_keys[i] == gui_button_repeat ? BUTTON_HELD_REPEAT : BUTTON_HELD_INITIAL;
- button_repeat_timestamp = getSysTime();
- gui_button_repeat = gui_keys[i];
- return key_to_cursor(gui_keys[i]);
- }
- }
- // If it was time for the repeat but it
- // didn't occur, stop repeating.
- if (IsRepeatReady) button_repeat_state = BUTTON_NOT_HELD;
- return CURSOR_NONE;
- }
- }
- }
-}
-
-/*--------------------------------------------------------
- Wait any key in [key_list] pressed
- if key_list == NULL, return at any key pressed
---------------------------------------------------------*/
-unsigned int wait_Anykey_press(unsigned int key_list)
-{
- unsigned int key;
-
- while(1)
- {
- key = getKey();
- if(key) {
- if(0 == key_list) break;
- else if(key & key_list) break;
- }
- }
-
- return key;
-}
-
-/*--------------------------------------------------------
- Wait all key in [key_list] released
- if key_list == NULL, return at all key released
---------------------------------------------------------*/
-void wait_Allkey_release(unsigned int key_list)
-{
- unsigned int key;
- struct key_buf inputdata;
-
- while(1)
- {
- ds2_getrawInput(&inputdata);
- key = inputdata.key;
-
- if(0 == key) break;
- else if(!key_list) continue;
- else if(0 == (key_list & key)) break;
- }
-}
-
-void change_ext(char *src, char *buffer, char *extension)
-{
- char *dot_position;
-
- strcpy(buffer, src);
- dot_position = strrchr(buffer, '.');
-
- if(dot_position)
- strcpy(dot_position, extension);
-}
-
-/*--------------------------------------------------------
- Sort function
---------------------------------------------------------*/
-static int nameSortFunction(char* a, char* b)
-{
- // ".." sorts before everything except itself.
- bool aIsParent = strcmp(a, "..") == 0;
- bool bIsParent = strcmp(b, "..") == 0;
-
- if (aIsParent && bIsParent)
- return 0;
- else if (aIsParent) // Sorts before
- return -1;
- else if (bIsParent) // Sorts after
- return 1;
- else
- return strcasecmp(a, b);
-}
-
-/*
- * Determines whether a portion of a vector is sorted.
- * Input assertions: 'from' and 'to' are valid indices into data. 'to' can be
- * the maximum value for the type 'unsigned int'.
- * Input: 'data', data vector, possibly sorted.
- * 'sortFunction', function determining the sort order of two elements.
- * 'from', index of the first element in the range to test.
- * 'to', index of the last element in the range to test.
- * Output: true if, for any valid index 'i' such as from <= i < to,
- * data[i] < data[i + 1].
- * true if the range is one or no elements, or if from > to.
- * false otherwise.
- */
-static bool isSorted(char** data, int (*sortFunction) (char*, char*), unsigned int from, unsigned int to)
-{
- if (from >= to)
- return true;
-
- char** prev = &data[from];
- unsigned int i;
- for (i = from + 1; i < to; i++)
- {
- if ((*sortFunction)(*prev, data[i]) > 0)
- return false;
- prev = &data[i];
- }
- if ((*sortFunction)(*prev, data[to]) > 0)
- return false;
-
- return true;
-}
-
-/*
- * Chooses a pivot for Quicksort. Uses the median-of-three search algorithm
- * first proposed by Robert Sedgewick.
- * Input assertions: 'from' and 'to' are valid indices into data. 'to' can be
- * the maximum value for the type 'unsigned int'.
- * Input: 'data', data vector.
- * 'sortFunction', function determining the sort order of two elements.
- * 'from', index of the first element in the range to be sorted.
- * 'to', index of the last element in the range to be sorted.
- * Output: a valid index into data, between 'from' and 'to' inclusive.
- */
-static unsigned int choosePivot(char** data, int (*sortFunction) (char*, char*), unsigned int from, unsigned int to)
-{
- // The highest of the two extremities is calculated first.
- unsigned int highest = ((*sortFunction)(data[from], data[to]) > 0)
- ? from
- : to;
- // Then the lowest of that highest extremity and the middle
- // becomes the pivot.
- return ((*sortFunction)(data[from + (to - from) / 2], data[highest]) < 0)
- ? (from + (to - from) / 2)
- : highest;
-}
-
-/*
- * Partition function for Quicksort. Moves elements such that those that are
- * less than the pivot end up before it in the data vector.
- * Input assertions: 'from', 'to' and 'pivotIndex' are valid indices into data.
- * 'to' can be the maximum value for the type 'unsigned int'.
- * Input: 'data', data vector.
- * 'metadata', data describing the values in 'data'.
- * 'sortFunction', function determining the sort order of two elements.
- * 'from', index of the first element in the range to sort.
- * 'to', index of the last element in the range to sort.
- * 'pivotIndex', index of the value chosen as the pivot.
- * Output: the index of the value chosen as the pivot after it has been moved
- * after all the values that are less than it.
- */
-static unsigned int partition(char** data, u8* metadata, int (*sortFunction) (char*, char*), unsigned int from, unsigned int to, unsigned int pivotIndex)
-{
- char* pivotValue = data[pivotIndex];
- data[pivotIndex] = data[to];
- data[to] = pivotValue;
- {
- u8 tM = metadata[pivotIndex];
- metadata[pivotIndex] = metadata[to];
- metadata[to] = tM;
- }
-
- unsigned int storeIndex = from;
- unsigned int i;
- for (i = from; i < to; i++)
- {
- if ((*sortFunction)(data[i], pivotValue) < 0)
- {
- char* tD = data[storeIndex];
- data[storeIndex] = data[i];
- data[i] = tD;
- u8 tM = metadata[storeIndex];
- metadata[storeIndex] = metadata[i];
- metadata[i] = tM;
- ++storeIndex;
- }
- }
-
- {
- char* tD = data[to];
- data[to] = data[storeIndex];
- data[storeIndex] = tD;
- u8 tM = metadata[to];
- metadata[to] = metadata[storeIndex];
- metadata[storeIndex] = tM;
- }
- return storeIndex;
-}
-
-/*
- * Sorts an array while keeping metadata in sync.
- * This sort is unstable and its average performance is
- * O(data.size() * log2(data.size()).
- * Input assertions: for any valid index 'i' in data, index 'i' is valid in
- * metadata. 'from' and 'to' are valid indices into data. 'to' can be
- * the maximum value for the type 'unsigned int'.
- * Invariant: index 'i' in metadata describes index 'i' in data.
- * Input: 'data', data to sort.
- * 'metadata', data describing the values in 'data'.
- * 'sortFunction', function determining the sort order of two elements.
- * 'from', index of the first element in the range to sort.
- * 'to', index of the last element in the range to sort.
- */
-static void quickSort(char** data, u8* metadata, int (*sortFunction) (char*, char*), unsigned int from, unsigned int to)
-{
- if (isSorted(data, sortFunction, from, to))
- return;
-
- unsigned int pivotIndex = choosePivot(data, sortFunction, from, to);
- unsigned int newPivotIndex = partition(data, metadata, sortFunction, from, to, pivotIndex);
- if (newPivotIndex > 0)
- quickSort(data, metadata, sortFunction, from, newPivotIndex - 1);
- if (newPivotIndex < to)
- quickSort(data, metadata, sortFunction, newPivotIndex + 1, to);
-}
-
-static void strupr(char *str)
-{
- while(*str)
- {
- if(*str <= 0x7A && *str >= 0x61) *str -= 0x20;
- str++;
- }
-}
-
-// ******************************************************************************
-// get file list
-// ******************************************************************************
-
-s32 load_file(char **wildcards, char *result, char *default_dir_name)
-{
- if (default_dir_name == NULL || *default_dir_name == '\0')
- return -4;
-
- char CurrentDirectory[MAX_PATH];
- u32 ContinueDirectoryRead = 1;
- u32 ReturnValue;
- u32 i;
-
- strcpy(CurrentDirectory, default_dir_name);
-
- while (ContinueDirectoryRead)
- {
- // Read the current directory. This loop is continued every time the
- // current directory changes.
- HighFrequencyCPU();
-
- show_icon(down_screen_addr, &ICON_SUBBG, 0, 0);
- show_icon(down_screen_addr, &ICON_TITLE, 0, 0);
- show_icon(down_screen_addr, &ICON_TITLEICON, TITLE_ICON_X, TITLE_ICON_Y);
- PRINT_STRING_BG(down_screen_addr, msg[MSG_FILE_MENU_LOADING_LIST], COLOR_WHITE, COLOR_TRANS, 49, 10);
- ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD);
-
- u32 LastCountDisplayTime = getSysTime();
-
- char** EntryNames = NULL;
- u8* EntryDirectoryFlags = NULL;
- DIR* CurrentDirHandle = NULL;
- u32 EntryCount = 1, EntryCapacity = 4 /* initial */;
-
- EntryNames = (char**) malloc(EntryCapacity * sizeof(char*));
- if (EntryNames == NULL)
- {
- ReturnValue = -2;
- ContinueDirectoryRead = 0;
- goto cleanup;
- }
-
- EntryDirectoryFlags = (u8*) malloc(EntryCapacity * sizeof(u8));
- if (EntryDirectoryFlags == NULL)
- {
- ReturnValue = -2;
- ContinueDirectoryRead = 0;
- goto cleanup;
- }
-
- CurrentDirHandle = opendir(CurrentDirectory);
- if(CurrentDirHandle == NULL) {
- ReturnValue = -1;
- ContinueDirectoryRead = 0;
- goto cleanup;
- }
-
- EntryNames[0] = "..";
- EntryDirectoryFlags[0] = 1;
-
- dirent* CurrentEntryHandle;
- struct stat Stat;
-
- while((CurrentEntryHandle = readdir_ex(CurrentDirHandle, &Stat)) != NULL)
- {
- u32 Now = getSysTime();
- u32 AddEntry = 0;
- char* Name = CurrentEntryHandle->d_name;
-
- if (Now >= LastCountDisplayTime + 5859 /* 250 ms */)
- {
- LastCountDisplayTime = Now;
-
- show_icon(down_screen_addr, &ICON_TITLE, 0, 0);
- show_icon(down_screen_addr, &ICON_TITLEICON, TITLE_ICON_X, TITLE_ICON_Y);
- char Line[384], Element[128];
- strcpy(Line, msg[MSG_FILE_MENU_LOADING_LIST]);
- sprintf(Element, " (%u)", EntryCount);
- strcat(Line, Element);
- PRINT_STRING_BG(down_screen_addr, Line, COLOR_WHITE, COLOR_TRANS, 49, 10);
- ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD);
- }
-
- if(S_ISDIR(Stat.st_mode))
- {
- // Add directories no matter what, except for the special
- // ones, "." and "..".
- if (!(Name[0] == '.' &&
- (Name[1] == '\0' || (Name[1] == '.' && Name[2] == '\0'))
- ))
- {
- AddEntry = 1;
- }
- }
- else
- {
- if (wildcards[0] == NULL) // Show every file
- AddEntry = 1;
- else
- {
- // Add files only if their extension is in the list.
- char* Extension = strrchr(Name, '.');
- if (Extension != NULL)
- {
- for(i = 0; wildcards[i] != NULL; i++)
- {
- if(strcasecmp(Extension, wildcards[i]) == 0)
- {
- AddEntry = 1;
- break;
- }
- }
- }
- }
- }
-
- if (AddEntry)
- {
- // Ensure we have enough capacity in the char* array first.
- if (EntryCount == EntryCapacity)
- {
- void* NewEntryNames = realloc(EntryNames, EntryCapacity * 2 * sizeof(char*));
- if (NewEntryNames == NULL)
- {
- ReturnValue = -2;
- ContinueDirectoryRead = 0;
- goto cleanup;
- }
- else
- EntryNames = NewEntryNames;
-
- void* NewEntryDirectoryFlags = realloc(EntryDirectoryFlags, EntryCapacity * 2 * sizeof(char*));
- if (NewEntryDirectoryFlags == NULL)
- {
- ReturnValue = -2;
- ContinueDirectoryRead = 0;
- goto cleanup;
- }
- else
- EntryDirectoryFlags = NewEntryDirectoryFlags;
-
- EntryCapacity *= 2;
- }
-
- // Then add the entry.
- EntryNames[EntryCount] = malloc(strlen(Name) + 1);
- if (EntryNames[EntryCount] == NULL)
- {
- ReturnValue = -2;
- ContinueDirectoryRead = 0;
- goto cleanup;
- }
-
- strcpy(EntryNames[EntryCount], Name);
- if (S_ISDIR(Stat.st_mode))
- EntryDirectoryFlags[EntryCount] = 1;
- else
- EntryDirectoryFlags[EntryCount] = 0;
-
- EntryCount++;
- }
- }
-
- show_icon(down_screen_addr, &ICON_TITLE, 0, 0);
- show_icon(down_screen_addr, &ICON_TITLEICON, TITLE_ICON_X, TITLE_ICON_Y);
- PRINT_STRING_BG(down_screen_addr, msg[MSG_FILE_MENU_SORTING_LIST], COLOR_WHITE, COLOR_TRANS, 49, 10);
- ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD);
-
- quickSort(EntryNames, EntryDirectoryFlags, nameSortFunction, 1, EntryCount - 1);
- LowFrequencyCPU();
-
- u32 ContinueInput = 1;
- s32 SelectedIndex = 0;
- u32 DirectoryScrollDirection = 0x8000; // First scroll to the left
- s32 EntryScrollValue = 0;
- u32 ModifyScrollers = 1;
- u32 ScrollerCount = 0;
-
- draw_hscroll_init(down_screen_addr, 49, 10, 199, COLOR_TRANS,
- COLOR_WHITE, CurrentDirectory);
- ScrollerCount++;
-
- // Show the current directory and get input. This loop is continued
- // every frame, because the current directory scrolls atop the screen.
-
- while (ContinueDirectoryRead && ContinueInput)
- {
- // Try to use a row set such that the selected entry is in the
- // middle of the screen.
- s32 LastEntry = SelectedIndex + FILE_LIST_ROWS / 2;
-
- // If the last row is out of bounds, put it back in bounds.
- // (In this case, the user has selected an entry in the last
- // FILE_LIST_ROWS / 2.)
- if (LastEntry >= EntryCount)
- LastEntry = EntryCount - 1;
-
- s32 FirstEntry = LastEntry - (FILE_LIST_ROWS - 1);
-
- // If the first row is out of bounds, put it back in bounds.
- // (In this case, the user has selected an entry in the first
- // FILE_LIST_ROWS / 2, or there are fewer than FILE_LIST_ROWS
- // entries.)
- if (FirstEntry < 0)
- {
- FirstEntry = 0;
-
- // If there are more than FILE_LIST_ROWS / 2 files,
- // we need to enlarge the first page.
- LastEntry = FILE_LIST_ROWS - 1;
- if (LastEntry >= EntryCount) // No...
- LastEntry = EntryCount - 1;
- }
-
- // Update scrollers.
- // a) If a different item has been selected, remake entry
- // scrollers, resetting the formerly selected entry to the
- // start and updating the selection color.
- if (ModifyScrollers)
- {
- // Preserve the directory scroller.
- for (; ScrollerCount > 1; ScrollerCount--)
- draw_hscroll_over(ScrollerCount - 1);
- for (i = FirstEntry; i <= LastEntry; i++)
- {
- u16 color = (SelectedIndex == i)
- ? COLOR_ACTIVE_ITEM
- : COLOR_INACTIVE_ITEM;
- if (hscroll_init(down_screen_addr, FILE_SELECTOR_NAME_X, GUI_ROW1_Y + (i - FirstEntry) * GUI_ROW_SY + TEXT_OFFSET_Y, FILE_SELECTOR_NAME_SX,
- COLOR_TRANS, color, EntryNames[i]) < 0)
- {
- ReturnValue = -2;
- ContinueDirectoryRead = 0;
- goto cleanupScrollers;
- }
- else
- {
- ScrollerCount++;
- }
- }
-
- ModifyScrollers = 0;
- }
-
- // b) Must we update the directory scroller?
- if ((DirectoryScrollDirection & 0xFF) >= 0x20)
- {
- if(DirectoryScrollDirection & 0x8000) //scroll left
- {
- if(draw_hscroll(0, -1) == 0) DirectoryScrollDirection = 0; //scroll right
- }
- else
- {
- if(draw_hscroll(0, 1) == 0) DirectoryScrollDirection = 0x8000; //scroll left
- }
- }
- else
- {
- // Wait one less frame before scrolling the directory again.
- DirectoryScrollDirection++;
- }
-
- // c) Must we scroll the current file as a result of user input?
- if (EntryScrollValue != 0)
- {
- draw_hscroll(SelectedIndex - FirstEntry + 1, EntryScrollValue);
- EntryScrollValue = 0;
- }
-
- // Draw.
- // a) The background.
- show_icon(down_screen_addr, &ICON_SUBBG, 0, 0);
- show_icon(down_screen_addr, &ICON_TITLE, 0, 0);
- show_icon(down_screen_addr, &ICON_TITLEICON, TITLE_ICON_X, TITLE_ICON_Y);
-
- // b) The selection background.
- show_icon(down_screen_addr, &ICON_SUBSELA, SUBSELA_X, GUI_ROW1_Y + (SelectedIndex - FirstEntry) * GUI_ROW_SY + SUBSELA_OFFSET_Y);
-
- // c) The scrollers.
- for (i = 0; i < ScrollerCount; i++)
- draw_hscroll(i, 0);
-
- // d) The icons.
- for (i = FirstEntry; i <= LastEntry; i++)
- {
- struct gui_iconlist* icon;
- if (i == 0)
- icon = &ICON_DOTDIR;
- else if (EntryDirectoryFlags[i])
- icon = &ICON_DIRECTORY;
- else
- {
- char* Extension = strrchr(EntryNames[i], '.');
- if (Extension != NULL)
- {
- if (strcasecmp(Extension, ".smc") == 0 || strcasecmp(Extension, ".sfc") == 0)
- icon = &ICON_SFCFILE;
- else if (strcasecmp(Extension, ".zip") == 0)
- icon = &ICON_ZIPFILE;
- else if (strcasecmp(Extension, ".cht") == 0)
- icon = &ICON_CHTFILE;
- else
- icon = &ICON_UNKNOW;
- }
- else
- icon = &ICON_UNKNOW;
- }
-
- show_icon(down_screen_addr, icon, FILE_SELECTOR_ICON_X, GUI_ROW1_Y + (i - FirstEntry) * GUI_ROW_SY + FILE_SELECTOR_ICON_Y);
- }
-
- ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD);
-
- // Delay before getting the input.
- mdelay(20);
-
- struct key_buf inputdata;
- gui_action_type gui_action = get_gui_input();
- ds2_getrawInput(&inputdata);
-
- // Get KEY_RIGHT and KEY_LEFT separately to allow scrolling
- // the selected file name faster.
- if (inputdata.key & KEY_RIGHT)
- EntryScrollValue = -3;
- else if (inputdata.key & KEY_LEFT)
- EntryScrollValue = 3;
-
- switch(gui_action)
- {
- case CURSOR_TOUCH:
- {
- wait_Allkey_release(0);
- // ___ 33 This screen has 6 possible rows. Touches
- // ___ 60 above or below these are ignored.
- // . . . (+27)
- // ___ 192
- if(inputdata.y <= GUI_ROW1_Y || inputdata.y > NDS_SCREEN_HEIGHT)
- break;
-
- u32 mod = (inputdata.y - GUI_ROW1_Y) / GUI_ROW_SY;
-
- if(mod >= LastEntry - FirstEntry + 1)
- break;
-
- SelectedIndex = FirstEntry + mod;
- /* fall through */
- }
-
- case CURSOR_SELECT:
- wait_Allkey_release(0);
- if (SelectedIndex == 0) // The parent directory
- {
- char* SlashPos = strrchr(CurrentDirectory, '/');
- if (SlashPos != NULL) // There's a parent
- {
- *SlashPos = '\0';
- ContinueInput = 0;
- }
- else // We're at the root
- {
- ReturnValue = -1;
- ContinueDirectoryRead = 0;
- }
- }
- else if (EntryDirectoryFlags[SelectedIndex])
- {
- strcat(CurrentDirectory, "/");
- strcat(CurrentDirectory, EntryNames[SelectedIndex]);
- ContinueInput = 0;
- }
- else
- {
- strcpy(default_dir_name, CurrentDirectory);
- strcpy(result, EntryNames[SelectedIndex]);
- ReturnValue = 0;
- ContinueDirectoryRead = 0;
- }
- break;
-
- case CURSOR_UP:
- SelectedIndex--;
- if (SelectedIndex < 0)
- SelectedIndex++;
- else
- ModifyScrollers = 1;
- break;
-
- case CURSOR_DOWN:
- SelectedIndex++;
- if (SelectedIndex >= EntryCount)
- SelectedIndex--;
- else
- ModifyScrollers = 1;
- break;
-
- //scroll page down
- case CURSOR_RTRIGGER:
- {
- u32 OldIndex = SelectedIndex;
- SelectedIndex += FILE_LIST_ROWS;
- if (SelectedIndex >= EntryCount)
- SelectedIndex = EntryCount - 1;
- if (SelectedIndex != OldIndex)
- ModifyScrollers = 1;
- break;
- }
-
- //scroll page up
- case CURSOR_LTRIGGER:
- {
- u32 OldIndex = SelectedIndex;
- SelectedIndex -= FILE_LIST_ROWS;
- if (SelectedIndex < 0)
- SelectedIndex = 0;
- if (SelectedIndex != OldIndex)
- ModifyScrollers = 1;
- break;
- }
-
- case CURSOR_BACK:
- {
- wait_Allkey_release(0);
- char* SlashPos = strrchr(CurrentDirectory, '/');
- if (SlashPos != NULL) // There's a parent
- {
- *SlashPos = '\0';
- ContinueInput = 0;
- }
- else // We're at the root
- {
- ReturnValue = -1;
- ContinueDirectoryRead = 0;
- }
- break;
- }
-
- case CURSOR_EXIT:
- wait_Allkey_release(0);
- ReturnValue = -1;
- ContinueDirectoryRead = 0;
- break;
-
- default:
- break;
- } // end switch
- } // end while
-
-cleanupScrollers:
- for (; ScrollerCount > 0; ScrollerCount--)
- draw_hscroll_over(ScrollerCount - 1);
-
-cleanup:
- if (CurrentDirHandle != NULL)
- closedir(CurrentDirHandle);
-
- if (EntryDirectoryFlags != NULL)
- free(EntryDirectoryFlags);
- if (EntryNames != NULL)
- {
- // EntryNames[0] is "..", a literal. Don't free it.
- for (; EntryCount > 1; EntryCount--)
- free(EntryNames[EntryCount - 1]);
- free(EntryNames);
- }
- } // end while
-
- return ReturnValue;
-}
-
-/*--------------------------------------------------------
- 放映幻灯片
---------------------------------------------------------*/
-
-u32 play_screen_snapshot(void)
-{
- s32 flag;
- u32 repeat, i;
- u16 *screenp;
- u32 color_bg;
-
- char** EntryNames = NULL;
- DIR* CurrentDirHandle = NULL;
- u32 EntryCount = 0, EntryCapacity = 4 /* initial */;
- u32 Failed = 0;
-
- EntryNames = (char**) malloc(EntryCapacity * sizeof(char*));
- if (EntryNames == NULL)
- {
- Failed = 1;
- goto cleanup;
- }
-
- CurrentDirHandle = opendir(DEFAULT_SS_DIR);
- if(CurrentDirHandle == NULL) {
- Failed = 1;
- goto cleanup;
- }
-
- dirent* CurrentEntryHandle;
- struct stat Stat;
-
- while((CurrentEntryHandle = readdir_ex(CurrentDirHandle, &Stat)) != NULL)
- {
- char* Name = CurrentEntryHandle->d_name;
- if(!S_ISDIR(Stat.st_mode))
- {
- // Add files only if their extension is in the list.
- char* Extension = strrchr(Name, '.');
- if (Extension != NULL)
- {
- if(strcasecmp(Extension, ".bmp") == 0)
- {
- // Ensure we have enough capacity in the char* array first.
- if (EntryCount == EntryCapacity)
- {
- void* NewEntryNames = realloc(EntryNames, EntryCapacity * 2 * sizeof(char*));
- if (NewEntryNames == NULL)
- {
- Failed = 1;
- goto cleanup;
- }
- else
- EntryNames = NewEntryNames;
-
- EntryCapacity *= 2;
- }
-
- // Then add the entry.
- EntryNames[EntryCount] = malloc(strlen(Name) + 1);
- if (EntryNames[EntryCount] == NULL)
- {
- Failed = 1;
- goto cleanup;
- }
-
- strcpy(EntryNames[EntryCount], Name);
-
- EntryCount++;
- }
- }
- }
- }
-
-cleanup:
- if (CurrentDirHandle != NULL)
- closedir(CurrentDirHandle);
-
- screenp= (u16*)malloc(256*192*2);
- if(screenp == NULL)
- {
- screenp = (u16*)down_screen_addr;
- color_bg = COLOR_BG;
- }
- else
- {
- memcpy(screenp, down_screen_addr, 256*192*2);
- color_bg = COLOR16(43, 11, 11);
- }
-
- if(Failed || EntryCount == 0)
- {
- draw_message(down_screen_addr, screenp, 28, 31, 227, 165, color_bg);
- draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_NO_SLIDE]);
- ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD);
-
- if(screenp) free((void*)screenp);
-
- if (EntryNames != NULL)
- {
- for (; EntryCount > 0; EntryCount--)
- free(EntryNames[EntryCount - 1]);
- free(EntryNames);
- }
-
- wait_Anykey_press(0);
- wait_Allkey_release(0);
-
- return 0;
- }
-
- char bmp_path[MAX_PATH];
- BMPINFO SbmpInfo;
-
- u32 buff[256*192];
- u32 time0= 10;
- u32 pause= 0;
- unsigned int type;
-
- draw_message(down_screen_addr, screenp, 28, 31, 227, 165, color_bg);
- draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_SCREENSHOT_SLIDESHOW_KEYS]);
- ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD);
-
- repeat= 1;
- i= 0;
- while(repeat)
- {
- sprintf(bmp_path, "%s/%s", DEFAULT_SS_DIR, EntryNames[i]);
-
- flag = openBMP(&SbmpInfo, (const char*)bmp_path);
- if(flag == BMP_OK)
- {
- type = SbmpInfo.bmpHead.bfImghead.imBitpixel >>3;
- if(2 == type || 3 == type) //2 bytes per pixel
- {
- u16 *dst, *dst0;
- u32 w, h, x, y;
-
- w= SbmpInfo.bmpHead.bfImghead.imBitmapW;
- h= SbmpInfo.bmpHead.bfImghead.imBitmapH;
- if(w > 256) w = 256;
- if(h > 192) h = 192;
-
- flag = readBMP(&SbmpInfo, 0, 0, w, h, (void*)buff);
- if(0 == flag)
- {
- ds2_clearScreen(UP_SCREEN, 0);
-
- dst= (unsigned short*)up_screen_addr + (192-h)/2*256 +(256-w)/2;
- dst0 = dst;
- if(2 == type) {
- unsigned short* pt;
-
- pt = (unsigned short*) buff;
- for(y= 0; y<h; y++) {
- for(x= 0; x < w; x++) {
- *dst++ = RGB16_15(pt);
- pt += 1;
- }
- dst0 += 256;
- dst = dst0;
- }
- }
- else {
- unsigned char* pt;
-
- pt= (char*)buff;
- for(y= 0; y< h; y++) {
- for(x= 0; x < w; x++) {
- *dst++ = RGB24_15(pt);
- pt += 3;
- }
- dst0 += 256;
- dst = dst0;
- }
- }
-
- ds2_flipScreen(UP_SCREEN, UP_SCREEN_UPDATE_METHOD);
- }
-
- closeBMP(&SbmpInfo);
- }
- else
- closeBMP(&SbmpInfo);
- }
-
- if(i+1 < EntryCount) i++;
- else i= 0;
-
- gui_action_type gui_action;
- u32 ticks= 0;
- u32 time1;
-
- time1= time0;
- while(ticks < time1)
- {
- gui_action = get_gui_input();
-
- switch(gui_action)
- {
- case CURSOR_UP:
- if(!pause)
- {
- if(time0 > 1) time0 -= 1;
- time1= time0;
- }
- break;
-
- case CURSOR_DOWN:
- if(!pause)
- {
- time0 += 1;
- time1= time0;
- }
- break;
-
- case CURSOR_LEFT:
- time1 = ticks;
- if(i > 1) i -= 2;
- else if(i == 1) i= EntryCount -1;
- else i= EntryCount -2;
- break;
-
- case CURSOR_RIGHT:
- time1 = ticks;
- break;
-
- case CURSOR_SELECT:
- if(!pause)
- {
- time1 = -1;
- pause= 1;
- }
- else
- {
- time1 = ticks;
- pause= 0;
- }
- break;
-
- case CURSOR_BACK:
- repeat = 0;
- break;
-
- default: gui_action= CURSOR_NONE;
- break;
- }
-
- if(gui_action != CURSOR_BACK)
- mdelay(100);
- if(!pause)
- ticks ++;
- }
- }
-
- if(screenp) free((void*)screenp);
-
- if (EntryNames != NULL)
- {
- for (; EntryCount > 0; EntryCount--)
- free(EntryNames[EntryCount - 1]);
- free(EntryNames);
- }
-
- return 0;
-}
-
-
-/*
-* Function: search directory on directory_path
-* directory: directory name will be searched
-* directory_path: path, note that the buffer which hold directory_path should
-* be large enough for nested
-* return: 0= found, directory lay on directory_path
-*/
-int search_dir(char *directory, char* directory_path)
-{
- DIR *current_dir;
- dirent *current_file;
- struct stat st;
- int directory_path_len;
-
- current_dir= opendir(directory_path);
- if(current_dir == NULL)
- return -1;
-
- directory_path_len = strlen(directory_path);
-
- //while((current_file = readdir(current_dir)) != NULL)
- while((current_file = readdir_ex(current_dir, &st)) != NULL)
- {
- //Is directory
- if(S_ISDIR(st.st_mode))
- {
- if(strcmp(".", current_file->d_name) || strcmp("..", current_file->d_name))
- continue;
-
- strcpy(directory_path+directory_path_len, current_file->d_name);
-
- if(!strcasecmp(current_file->d_name, directory))
- {//dirctory find
- closedir(current_dir);
- return 0;
- }
-
- if(search_dir(directory, directory_path) == 0)
- {//dirctory find
- closedir(current_dir);
- return 0;
- }
-
- directory_path[directory_path_len] = '\0';
- }
- }
-
- closedir(current_dir);
- return -1;
-}
-
-
-const u32 gamepad_config_map_init[MAX_GAMEPAD_MAP] =
-{
- BUTTON_ID_A, /* 0 A */
- BUTTON_ID_B, /* 1 B */
- BUTTON_ID_SELECT, /* 2 [SELECT] */
- BUTTON_ID_START, /* 3 [START] */
- BUTTON_ID_RIGHT, /* 4 → */
- BUTTON_ID_LEFT, /* 5 ← */
- BUTTON_ID_UP, /* 6 ↑ */
- BUTTON_ID_DOWN, /* 7 ↓ */
- BUTTON_ID_R, /* 8 [R] */
- BUTTON_ID_L, /* 9 [L] */
- BUTTON_ID_NONE, /* 10 FA */
- BUTTON_ID_NONE, /* 11 FB */
- BUTTON_ID_TOUCH, /* 12 MENU */
- BUTTON_ID_NONE, /* 13 NONE */
- BUTTON_ID_NONE, /* 14 NONE */
- BUTTON_ID_NONE /* 15 NONE */
-};
-
-u32 gamepad_config_map[MAX_GAMEPAD_MAP];
-
-#define BUTTON_MAP_A gamepad_config_map[0]
-#define BUTTON_MAP_B gamepad_config_map[1]
-#define BUTTON_MAP_FA gamepad_config_map[10]
-#define BUTTON_MAP_FB gamepad_config_map[11]
-#define BUTTON_MAP_MENU gamepad_config_map[12]
-
-int load_state(char* file)
-{
- int flag;
- FILE* fp;
- unsigned int n;
- char tmp_path[MAX_PATH];
-
- sprintf(tmp_path, "%s/%s", DEFAULT_RTS_DIR, file);
-
- flag = game_load_state(tmp_path);
- if(0 != flag)
- return -1;
-
- fp = fopen(tmp_path, "r");
- if(NULL == fp)
- return -1;
-
- n = 0;
- if(fread((void*)&n, 1, 4, fp) < 4)
- {
- fclose(fp);
- return -1;
- }
-
- fseek(fp, n+sizeof(struct rtc), SEEK_SET);
- fread(up_screen_addr, 1, 256*192*2, fp);
- fclose(fp);
-
- ds2_flipScreen(UP_SCREEN, UP_SCREEN_UPDATE_METHOD);
-
- return 0;
-}
-
-int load_game_stat_snapshot(char* file)
-{
- FILE* fp;
- char tmp_path[MAX_PATH];
- unsigned int n, m;
-
- sprintf(tmp_path, "%s/%s", DEFAULT_RTS_DIR, file);
- fp = fopen(tmp_path, "r");
- if(NULL == fp)
- return -1;
-
- m = fread((void*)&n, 1, 4, fp);
- if(m < 4)
- {
- fclose(fp);
- return - 2;
- }
-
- fseek(fp, n+sizeof(struct rtc), SEEK_SET);
-
- m = fread(up_screen_addr, 1, 256*192*2, fp);
- if(m < 256*192*2)
- {
- fclose(fp);
- return -4;
- }
-
- fclose(fp);
- ds2_flipScreen(UP_SCREEN, UP_SCREEN_UPDATE_METHOD);
- return 0;
-}
-
-#if 0
-int bak_file(char* file)
-{
- FILE *fp1, *fp2;
- char tmp_path[MAX_PATH];
- char buff[512];
- int m;
-
- fp1= fopen(file, "r");
- if(NULL == fp1)
- return -1;
-
- strcpy(tmp_path, file);
- strcat(tmp_path, ".bak");
- fp2 = fopen(tmp_path, "w");
- if(NULL == fp2)
- {
- fclose(fp1);
- return -2;
- }
-
- while(1)
- {
- m= fread(buff, 1, 512, fp1);
- if(m <= 0) break;
- fwrite(buff, 1, m, fp2);
- }
-
- fclose(fp1);
- fclose(fp2);
- return 0;
-}
-#endif
-
-int save_state(char* file, void* screen)
-{
- int flag;
- FILE *fp;
- unsigned int n;
- struct rtc time;
- char str[64];
- char tmp_path[MAX_PATH];
-
- sprintf(tmp_path, "%s/%s", DEFAULT_RTS_DIR, file);
-
- flag = game_save_state(tmp_path);
- if(0 != flag)
- return -1;
-
- fp = fopen(tmp_path, "r+");
- if(NULL == fp)
- return -1;
-
- fseek(fp, 0, SEEK_END);
- n = ftell(fp);
-
- ds2_getTime(&time);
- sprintf(str, "%04d-%02d-%02d %02d:%02d:%02d",
- time.year + 2000, time.month, time.day, time.hours, time.minutes, time.seconds);
-
- // A black outline in all four directions...
- PRINT_STRING_BG(screen, str, COLOR_BLACK, 0x8000, 0, 1);
- PRINT_STRING_BG(screen, str, COLOR_BLACK, 0x8000, 2, 1);
- PRINT_STRING_BG(screen, str, COLOR_BLACK, 0x8000, 1, 0);
- PRINT_STRING_BG(screen, str, COLOR_BLACK, 0x8000, 1, 2);
- // ... and white text.
- PRINT_STRING_BG(screen, str, COLOR_WHITE, 0x8000, 1, 1);
- fwrite((void*)&time, 1, sizeof(struct rtc), fp);
- fwrite(screen, 1, 256*192*2, fp);
-
- fseek(fp, 0, SEEK_SET);
- fwrite((void*)&n, 1, 4, fp);
-
- fclose(fp);
-
- return 0;
-}
-
-void LowFrequencyCPU()
-{
- ds2_setCPUclocklevel(0); // 60 MHz
-}
-
-void HighFrequencyCPU()
-{
- ds2_setCPUclocklevel(13); // 396 MHz
-}
-
-void GameFrequencyCPU()
-{
- u32 clock_speed_table[6] = {6, 9, 10, 11, 12, 13}; //240, 300, 336, 360, 384, 396
-
- if(game_config.clock_speed_number <= 5)
- ds2_setCPUclocklevel(clock_speed_table[game_config.clock_speed_number]);
-}
-
-void savefast_int(void)
-{
-
-}
-
-#if 1
-void dump_mem(unsigned char* addr, unsigned int len)
-{
- unsigned int i;
-
- for(i= 0; i < len; i++)
- {
- cprintf("%02x ", addr[i]);
- if((i+1)%16 == 0) cprintf("\n");
- }
-}
-#endif
-
-/*--------------------------------------------------------
- Main Menu
---------------------------------------------------------*/
-u32 menu(u16 *screen, bool8 FirstInvocation)
-{
- gui_action_type gui_action;
- u32 i;
- u32 repeat;
- u32 return_value = 0;
- u32 first_load = 0;
- char tmp_filename[MAX_FILE];
- char line_buffer[512];
- char cheat_data_str[MAX_CHEATS_T][5];
- // ^ Holds the index inside Cheat, as a number in an ASCIIZ string
- char* cheat_data_ptr[MAX_CHEATS_T];
-
- // For cheat groups
- char* cheat_group_name_ptr[MAX_CHEATS_T + 1];
- char cheat_group_names[MAX_CHEATS_T * MAX_SFCCHEAT_NAME];
-
- MENU_TYPE *current_menu = NULL;
- MENU_OPTION_TYPE *current_option = NULL;
- MENU_OPTION_TYPE *display_option = NULL;
-
- u32 current_option_num;
-// u32 parent_option_num;
- u32 string_select;
-
- u16 *bg_screenp;
- u32 bg_screenp_color;
-
- GAME_CONFIG PreviousGameConfig; // Compared with current settings to
- EMU_CONFIG PreviousEmuConfig; // determine if they need to be saved
-
- auto void choose_menu();
- auto void menu_return();
- auto void menu_exit();
- auto void menu_load();
- auto void menu_restart();
- auto void menu_save_state();
- auto void menu_load_state();
- auto void menu_load_cheat_file();
- auto void others_menu_init();
- auto void main_menu_passive();
- auto void main_menu_key();
- auto void delette_savestate();
- auto void save_screen_snapshot();
- auto void browse_screen_snapshot();
- auto void tools_menu_init();
- auto void obtain_hotkey (u32 *HotkeyBitfield);
- auto void set_global_hotkey_return_to_menu();
- auto void set_global_hotkey_temporary_fast_forward();
- auto void set_global_hotkey_toggle_sound();
- auto void set_global_hotkey_quick_load_state();
- auto void set_global_hotkey_quick_save_state();
- auto void set_global_hotkey_toggle_full_screen();
- auto void set_game_specific_hotkey_return_to_menu();
- auto void set_game_specific_hotkey_temporary_fast_forward();
- auto void set_game_specific_hotkey_toggle_sound();
- auto void set_game_specific_hotkey_quick_load_state();
- auto void set_game_specific_hotkey_quick_save_state();
- auto void set_game_specific_hotkey_toggle_full_screen();
- auto void global_hotkey_return_to_menu_passive();
- auto void global_hotkey_temporary_fast_forward_passive();
- auto void global_hotkey_toggle_sound_passive();
- auto void global_hotkey_quick_load_state_passive();
- auto void global_hotkey_quick_save_state_passive();
- auto void global_hotkey_toggle_full_screen_passive();
- auto void game_specific_hotkey_return_to_menu_passive();
- auto void game_specific_hotkey_temporary_fast_forward_passive();
- auto void game_specific_hotkey_toggle_sound_passive();
- auto void game_specific_hotkey_quick_load_state_passive();
- auto void game_specific_hotkey_quick_save_state_passive();
- auto void game_specific_hotkey_toggle_full_screen_passive();
- auto void load_default_setting();
- auto void check_gbaemu_version();
- auto void load_lastest_played();
- auto void latest_game_menu_passive();
- auto void latest_game_menu_init();
- auto void latest_game_menu_key();
- auto void latest_game_menu_end();
- auto void language_set();
- auto void game_fastforward();
-#ifdef ENABLE_FREE_SPACE
- auto void show_card_space();
-#endif
- auto void savestate_selitem(u32 sel, u32 y_pos);
- auto void game_state_menu_init();
- auto void game_state_menu_passive();
- auto void game_state_menu_end();
- auto void gamestate_delette_menu_init();
- auto void gamestate_delette_menu_passive();
- auto void gamestate_delette_menu_end();
- auto void cheat_menu_init();
- auto void cheat_menu_end();
- auto void reload_cheats_page();
- auto void cheat_option_action();
- auto void cheat_option_passive();
-
-//Local function definition
-
- void menu_exit()
- {
- HighFrequencyCPU(); // Crank it up, leave quickly
- if(gamepak_name[0] != 0)
- {
- S9xAutoSaveSRAM ();
- }
- quit();
- }
-
- void SaveConfigsIfNeeded()
- {
- if (memcmp(&PreviousGameConfig, &game_config, sizeof(GAME_CONFIG)) != 0)
- save_game_config_file();
- if (memcmp(&PreviousEmuConfig, &emu_config, sizeof(EMU_CONFIG)) != 0)
- save_emu_config_file();
- }
-
- void PreserveConfigs()
- {
- memcpy(&PreviousGameConfig, &game_config, sizeof(GAME_CONFIG));
- memcpy(&PreviousEmuConfig, &emu_config, sizeof(EMU_CONFIG));
- }
-
- int LoadGameAndItsData(char *filename){
- if (gamepak_name[0] != '\0') {
- S9xAutoSaveSRAM();
- }
-
- draw_message(down_screen_addr, bg_screenp, 28, 31, 227, 165, bg_screenp_color);
- draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_LOADING_GAME]);
- ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD);
-
- HighFrequencyCPU();
- int load_result = load_gamepak(filename);
- LowFrequencyCPU();
-
- if(load_result == -1)
- {
- first_load = 1;
- gamepak_name[0] = '\0';
- return 0;
- }
-
- char tempPath[MAX_PATH];
- strcpy(tempPath, filename);
-
- //update folders and names for settings/config uses
- char *dirEnd = strrchr(tempPath, '/');
- //make sure a valid path was provided
- if(!dirEnd)
- return 0;
-
- //copy file name as gamepak_name
- strcpy(gamepak_name, dirEnd+1);
- //then strip filename from directory path and set it
- *dirEnd = '\0';
- strcpy(g_default_rom_dir, tempPath);
-
- first_load = 0;
- load_game_config_file();
- PreserveConfigs(); // Make the emulator not save what we've JUST read
- // but it will save the emulator configuration below for latest files
-
- return_value = 1;
- repeat = 0;
-
- reorder_latest_file();
- get_savestate_filelist();
-
- game_fast_forward= 0;
- return 1;
- }
-
- void menu_load()
- {
- char *file_ext[] = { ".smc", ".sfc", ".zip", NULL };
-
- if(load_file(file_ext, tmp_filename, g_default_rom_dir) != -1)
- {
- strcpy(line_buffer, g_default_rom_dir);
- strcat(line_buffer, "/");
- strcat(line_buffer, tmp_filename);
-
- LoadGameAndItsData(line_buffer);
- }
- else
- {
- choose_menu(current_menu);
- }
- }
-
- void menu_restart()
- {
- if(!first_load)
- {
- game_restart();
- return_value = 1;
- repeat = 0;
- }
- }
-
- void menu_return()
- {
- if(!first_load)
- repeat = 0;
- }
-
- void clear_savestate_slot(u32 slot_index)
- {
- get_savestate_filename(slot_index, tmp_filename);
- sprintf(line_buffer, "%s/%s", DEFAULT_RTS_DIR, tmp_filename);
- remove(line_buffer);
- SavedStateCacheInvalidate ();
- }
-
- void savestate_selitem(u32 selected, u32 y_pos)
- {
- u32 k;
-
- for(k= 0; k < SAVE_STATE_SLOT_NUM; k++)
- {
- struct gui_iconlist *icon;
- bool8 Exists = SavedStateFileExists (k);
- uint8 X = SavedStateSquareX (k);
-
- if (selected == k && Exists)
- icon = &ICON_STATEFULL;
- else if (selected == k && !Exists)
- icon = &ICON_STATEEMPTY;
- else if (selected != k && Exists)
- icon = &ICON_NSTATEFULL;
- else if (selected != k && !Exists)
- icon = &ICON_NSTATEEMPTY;
-
- show_icon((unsigned short *) down_screen_addr, icon, X, y_pos);
- }
- }
-
- void game_state_menu_init()
- {
- if(first_load)
- {
- ds2_clearScreen(UP_SCREEN, 0);
- draw_string_vcenter(up_screen_addr, 0, 88, 256, COLOR_WHITE, msg[MSG_TOP_SCREEN_NO_GAME_LOADED]);
- ds2_flipScreen(UP_SCREEN, UP_SCREEN_UPDATE_METHOD);
- }
- else if(SavedStateFileExists(savestate_index))
- {
- get_savestate_filename(savestate_index, tmp_filename);
- sprintf(line_buffer, "%s/%s", DEFAULT_RTS_DIR, tmp_filename);
- load_game_stat_snapshot(tmp_filename);
- }
- else
- {
- ds2_clearScreen(UP_SCREEN, COLOR_BLACK);
- draw_string_vcenter(up_screen_addr, 0, 88, 256, COLOR_WHITE, msg[MSG_TOP_SCREEN_NO_SAVED_STATE_IN_SLOT]);
- ds2_flipScreen(UP_SCREEN, UP_SCREEN_UPDATE_METHOD);
- }
- }
-
- void game_state_menu_end()
- {
- if (!first_load)
- {
- copy_screen(up_screen_addr, (void*) screen, 0, 0, 256, 192);
- ds2_flipScreen(UP_SCREEN, UP_SCREEN_UPDATE_METHOD);
- }
- else
- {
- ds2_clearScreen(UP_SCREEN, 0);
- draw_string_vcenter(up_screen_addr, 0, 88, 256, COLOR_WHITE, msg[MSG_TOP_SCREEN_NO_GAME_LOADED]);
- ds2_flipScreen(UP_SCREEN, UP_SCREEN_UPDATE_METHOD);
- }
- }
-
- void game_state_menu_passive()
- {
- unsigned int line[3] = {0, 2, 4};
-
- //draw background
- show_icon(down_screen_addr, &ICON_SUBBG, 0, 0);
- show_icon(down_screen_addr, &ICON_TITLE, 0, 0);
- show_icon(down_screen_addr, &ICON_TITLEICON, TITLE_ICON_X, TITLE_ICON_Y);
-
- if(current_option_num == 0)
- show_icon(down_screen_addr, &ICON_BACK, BACK_BUTTON_X, BACK_BUTTON_Y);
- else
- show_icon(down_screen_addr, &ICON_NBACK, BACK_BUTTON_X, BACK_BUTTON_Y);
-
- strcpy(line_buffer, *(display_option->display_string));
- draw_string_vcenter(down_screen_addr, 0, 9, 256, COLOR_ACTIVE_ITEM, line_buffer);
-
- display_option += 1;
- for(i= 0; i < 3; i++, display_option++)
- {
- unsigned short color;
-
- if(display_option == current_option)
- show_icon(down_screen_addr, &ICON_SUBSELA, SUBSELA_X, GUI_ROW1_Y + line[i] * GUI_ROW_SY + SUBSELA_OFFSET_Y);
-
- if(display_option->option_type & NUMBER_SELECTION_TYPE)
- {
- sprintf(line_buffer, *(display_option->display_string),
- *(display_option->current_option)+1); //ADD 1 here
- }
- else if(display_option->option_type & STRING_SELECTION_TYPE)
- {
- sprintf(line_buffer, *(display_option->display_string),
- *((u32*)(((u32 *)display_option->options)[*(display_option->current_option)])));
- }
- else
- {
- strcpy(line_buffer, *(display_option->display_string));
- }
-
- if(display_option == current_option)
- color= COLOR_ACTIVE_ITEM;
- else
- color= COLOR_INACTIVE_ITEM;
-
- PRINT_STRING_BG(down_screen_addr, line_buffer, color, COLOR_TRANS, OPTION_TEXT_X, GUI_ROW1_Y + line[i] * GUI_ROW_SY + TEXT_OFFSET_Y);
- }
-
- unsigned int selected_write, selected_read;
-
- selected_write = -1;
- selected_read = -1;
-
- if(current_option_num == 1 /* write */)
- selected_write = savestate_index;
- if(current_option_num == 2 /* read */)
- selected_read = savestate_index;
-
- savestate_selitem(selected_write, GUI_ROW1_Y + 1 * GUI_ROW_SY + (GUI_ROW_SY - ICON_STATEFULL.y) / 2);
- savestate_selitem(selected_read, GUI_ROW1_Y + 3 * GUI_ROW_SY + (GUI_ROW_SY - ICON_STATEFULL.y) / 2);
- }
-
- u32 delette_savestate_num= 0;
-
- void gamestate_delette_menu_init()
- {
- if(first_load)
- {
- ds2_clearScreen(UP_SCREEN, 0);
- draw_string_vcenter(up_screen_addr, 0, 88, 256, COLOR_WHITE, msg[MSG_TOP_SCREEN_NO_GAME_LOADED]);
- ds2_flipScreen(UP_SCREEN, UP_SCREEN_UPDATE_METHOD);
- }
- else if(SavedStateFileExists(delette_savestate_num))
- {
- get_savestate_filename(delette_savestate_num, tmp_filename);
- sprintf(line_buffer, "%s/%s", DEFAULT_RTS_DIR, tmp_filename);
- load_game_stat_snapshot(tmp_filename);
- }
- else
- {
- ds2_clearScreen(UP_SCREEN, COLOR_BLACK);
- draw_string_vcenter(up_screen_addr, 0, 88, 256, COLOR_WHITE, msg[MSG_TOP_SCREEN_NO_SAVED_STATE_IN_SLOT]);
- ds2_flipScreen(UP_SCREEN, UP_SCREEN_UPDATE_METHOD);
- }
- }
-
- void gamestate_delette_menu_end()
- {
- if (!first_load)
- {
- copy_screen(up_screen_addr, (void*) screen, 0, 0, 256, 192);
- ds2_flipScreen(UP_SCREEN, UP_SCREEN_UPDATE_METHOD);
- }
- else
- {
- ds2_clearScreen(UP_SCREEN, 0);
- draw_string_vcenter(up_screen_addr, 0, 88, 256, COLOR_WHITE, msg[MSG_TOP_SCREEN_NO_GAME_LOADED]);
- ds2_flipScreen(UP_SCREEN, UP_SCREEN_UPDATE_METHOD);
- }
- }
-
- void gamestate_delette_menu_passive()
- {
- unsigned int line[2] = {0, 2};
-
- //draw background
- show_icon(down_screen_addr, &ICON_SUBBG, 0, 0);
- show_icon(down_screen_addr, &ICON_TITLE, 0, 0);
- show_icon(down_screen_addr, &ICON_TITLEICON, TITLE_ICON_X, TITLE_ICON_Y);
-
- if(current_option_num == 0)
- show_icon(down_screen_addr, &ICON_BACK, BACK_BUTTON_X, BACK_BUTTON_Y);
- else
- show_icon(down_screen_addr, &ICON_NBACK, BACK_BUTTON_X, BACK_BUTTON_Y);
-
- strcpy(line_buffer, *(display_option->display_string));
- draw_string_vcenter(down_screen_addr, 0, 9, 256, COLOR_ACTIVE_ITEM, line_buffer);
-
- display_option += 1;
- for(i= 0; i < 2; i++, display_option++)
- {
- unsigned short color;
-
- if(display_option == current_option)
- show_icon(down_screen_addr, &ICON_SUBSELA, SUBSELA_X, GUI_ROW1_Y + line[i] * GUI_ROW_SY + SUBSELA_OFFSET_Y);
-
- if(display_option->option_type & NUMBER_SELECTION_TYPE)
- {
- sprintf(line_buffer, *(display_option->display_string),
- *(display_option->current_option)+1);
- }
- else if(display_option->option_type & STRING_SELECTION_TYPE)
- {
- sprintf(line_buffer, *(display_option->display_string),
- *((u32*)(((u32 *)display_option->options)[*(display_option->current_option)])));
- }
- else
- {
- strcpy(line_buffer, *(display_option->display_string));
- }
-
- if(display_option == current_option)
- color= COLOR_ACTIVE_ITEM;
- else
- color= COLOR_INACTIVE_ITEM;
-
- PRINT_STRING_BG(down_screen_addr, line_buffer, color, COLOR_TRANS, OPTION_TEXT_X, GUI_ROW1_Y + line[i] * GUI_ROW_SY + TEXT_OFFSET_Y);
- }
-
- if(current_option_num == 1)
- savestate_selitem(delette_savestate_num, GUI_ROW1_Y + 1 * GUI_ROW_SY+ (GUI_ROW_SY - ICON_STATEFULL.y) / 2);
- else
- savestate_selitem(-1, GUI_ROW1_Y + 1 * GUI_ROW_SY + (GUI_ROW_SY - ICON_STATEFULL.y) / 2);
- }
-
- void menu_save_state()
- {
- if(!first_load)
- {
- if(gui_action == CURSOR_SELECT)
- {
- if (SavedStateFileExists (savestate_index))
- {
- draw_message(down_screen_addr, NULL, 28, 31, 227, 165, 0);
- draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_SAVESTATE_FULL]);
- if(draw_yesno_dialog(DOWN_SCREEN, 115, msg[MSG_GENERAL_CONFIRM_WITH_A], msg[MSG_GENERAL_CANCEL_WITH_B]) == 0)
- return;
-
- clear_savestate_slot(savestate_index);
- }
-
- get_savestate_filename(savestate_index, tmp_filename);
-
- draw_message(down_screen_addr, NULL, 28, 31, 227, 165, 0);
- draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_CREATING]);
- ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD);
-
- HighFrequencyCPU();
- int flag = save_state(tmp_filename, (void*)screen);
- LowFrequencyCPU();
- //clear message
- draw_message(down_screen_addr, NULL, 28, 31, 227, 96, 0);
- if(flag < 0)
- {
- draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_CREATION_FAILED]);
- }
- else
- {
- draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_CREATION_SUCCEEDED]);
- }
-
- ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD);
-
- SavedStateCacheInvalidate ();
-
- mdelay(500); // let the progress message linger
-
- // Now show the screen of what we just wrote.
- get_savestate_filename(savestate_index, tmp_filename);
- sprintf(line_buffer, "%s/%s", DEFAULT_RTS_DIR, tmp_filename);
- HighFrequencyCPU();
- load_game_stat_snapshot(tmp_filename);
- LowFrequencyCPU();
- }
- else //load screen snapshot
- {
- if(SavedStateFileExists(savestate_index))
- {
- get_savestate_filename(savestate_index, tmp_filename);
- sprintf(line_buffer, "%s/%s", DEFAULT_RTS_DIR, tmp_filename);
- HighFrequencyCPU();
- load_game_stat_snapshot(tmp_filename);
- LowFrequencyCPU();
- }
- else
- {
- ds2_clearScreen(UP_SCREEN, COLOR_BLACK);
- draw_string_vcenter(up_screen_addr, 0, 88, 256, COLOR_WHITE, msg[MSG_TOP_SCREEN_NO_SAVED_STATE_IN_SLOT]);
- ds2_flipScreen(UP_SCREEN, UP_SCREEN_UPDATE_METHOD);
- }
- }
- }
- }
-
- void menu_load_state()
- {
- if(!first_load)
- {
- FILE *fp= NULL;
-
- if(bg_screenp != NULL)
- {
- bg_screenp_color = COLOR16(43, 11, 11);
- memcpy(bg_screenp, down_screen_addr, 256*192*2);
- }
- else
- bg_screenp_color = COLOR_BG;
-
- if(SavedStateFileExists(savestate_index))
- {
- get_savestate_filename(savestate_index, tmp_filename);
- sprintf(line_buffer, "%s/%s", DEFAULT_RTS_DIR, tmp_filename);
-
- //right
- if(gui_action == CURSOR_SELECT)
- {
- draw_message(down_screen_addr, bg_screenp, 28, 31, 227, 165, bg_screenp_color);
- draw_string_vcenter(up_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_LOADING]);
-
- HighFrequencyCPU();
- int flag = load_state(tmp_filename);
- LowFrequencyCPU();
- if(0 == flag)
- {
- return_value = 1;
- repeat = 0;
- draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_LOAD_SUCCEEDED]);
- }
- else
- {
- draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_LOAD_FAILED]);
- mdelay(500); // let the failure show
- }
- }
- else //load screen snapshot
- {
- HighFrequencyCPU();
- load_game_stat_snapshot(tmp_filename);
- LowFrequencyCPU();
- }
- }
- else
- {
- ds2_clearScreen(UP_SCREEN, COLOR_BLACK);
- draw_string_vcenter(up_screen_addr, 0, 88, 256, COLOR_WHITE, msg[MSG_TOP_SCREEN_NO_SAVED_STATE_IN_SLOT]);
- ds2_flipScreen(UP_SCREEN, UP_SCREEN_UPDATE_METHOD);
- }
- }
- }
-
- void delette_savestate()
- {
- if(!first_load)
- {
- if (gui_action == CURSOR_SELECT)
- {
- if(bg_screenp != NULL)
- {
- bg_screenp_color = COLOR16(43, 11, 11);
- memcpy(bg_screenp, down_screen_addr, 256*192*2);
- }
- else
- bg_screenp_color = COLOR_BG;
-
- wait_Allkey_release(0);
- if(current_option_num == 2) //delette all
- {
- u32 i, flag;
-
- draw_message(down_screen_addr, bg_screenp, 28, 31, 227, 165, bg_screenp_color);
- draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_DIALOG_SAVED_STATE_DELETE_ALL]);
-
- flag= 0;
- for(i= 0; i < SAVE_STATE_SLOT_NUM; i++)
- if (SavedStateFileExists (i))
- {flag= 1; break;}
-
- if(flag)
- {
- if(draw_yesno_dialog(DOWN_SCREEN, 115, msg[MSG_GENERAL_CONFIRM_WITH_A], msg[MSG_GENERAL_CANCEL_WITH_B]))
- {
- wait_Allkey_release(0);
- for(i= 0; i < SAVE_STATE_SLOT_NUM; i++)
- {
- get_savestate_filename(i, tmp_filename);
- sprintf(line_buffer, "%s/%s", DEFAULT_RTS_DIR, tmp_filename);
- remove(line_buffer);
- SavedStateCacheInvalidate ();
- }
- savestate_index= 0;
- }
- }
- else
- {
- draw_message(down_screen_addr, bg_screenp, 28, 31, 227, 165, bg_screenp_color);
- draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_ALREADY_EMPTY]);
- ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD);
- mdelay(500);
- }
- }
- else if(current_option_num == 1) //delette single
- {
- draw_message(down_screen_addr, bg_screenp, 28, 31, 227, 165, bg_screenp_color);
-
- if(SavedStateFileExists(delette_savestate_num))
- {
- sprintf(line_buffer, msg[FMT_DIALOG_SAVED_STATE_DELETE_ONE], delette_savestate_num + 1);
- draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, line_buffer);
-
- if(draw_yesno_dialog(DOWN_SCREEN, 115, msg[MSG_GENERAL_CONFIRM_WITH_A], msg[MSG_GENERAL_CANCEL_WITH_B])) {
- wait_Allkey_release(0);
- clear_savestate_slot(delette_savestate_num);
- }
- }
- else
- {
- draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_ALREADY_EMPTY]);
- ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD);
- mdelay(500);
- }
- }
- }
- else //load screen snapshot
- {
- if(SavedStateFileExists(delette_savestate_num))
- {
- get_savestate_filename(delette_savestate_num, tmp_filename);
- sprintf(line_buffer, "%s/%s", DEFAULT_RTS_DIR, tmp_filename);
- HighFrequencyCPU();
- load_game_stat_snapshot(tmp_filename);
- LowFrequencyCPU();
- }
- else
- {
- ds2_clearScreen(UP_SCREEN, COLOR_BLACK);
- draw_string_vcenter(up_screen_addr, 0, 88, 256, COLOR_WHITE, msg[MSG_TOP_SCREEN_NO_SAVED_STATE_IN_SLOT]);
- ds2_flipScreen(UP_SCREEN, UP_SCREEN_UPDATE_METHOD);
- }
- }
- }
- }
-
- MENU_TYPE cheats_menu;
- MENU_TYPE *dynamic_cheat_menu = NULL;
- MENU_OPTION_TYPE *dynamic_cheat_options = NULL;
- unsigned char *dynamic_cheat_msg = NULL;
- unsigned char **dynamic_cheat_pt = NULL;
- unsigned int dynamic_cheat_active;
- int dynamic_cheat_scroll_value= 0;
-
- void cheat_menu_init()
- {
- for(i = 0; i < MAX_CHEATS_T; i++)
- {
- sprintf(cheat_data_str[i], "%d", i);
- cheat_data_ptr[i] = &cheat_data_str[i][0];
- }
-
- NDSSFCGetCheatGroups(cheat_group_name_ptr, cheat_group_names);
-
- reload_cheats_page();
- }
-
- void cheat_menu_end()
- {
- // Honour current cheat selections.
- uint32 i;
- for (i = 0; i < Cheat.num_cheats; i++) {
- if (Cheat.c[i].enabled)
- S9xApplyCheat(i);
- else
- S9xRemoveCheat(i);
- }
- // Save current cheat selections to the cheat binary file.
- S9xSaveCheatFile (S9xGetFilename (".chb"));
- }
-
- void cheat_option_action()
- {
- char tmp_buf[512];
- strcpy(tmp_buf, *(current_option->display_string));
- int i = atoi(tmp_buf);
- // 'i' is the cheat group index.
- if (cheat_group_name_ptr[i] == NULL)
- return;
- if (NDSSFCIsCheatGroupEnabled (cheat_group_name_ptr[i]))
- NDSSFCDisableCheatGroup (cheat_group_name_ptr[i]);
- else
- NDSSFCEnableCheatGroup (cheat_group_name_ptr[i]);
- }
-
- void cheat_option_passive()
- {
- unsigned short color;
- char tmp_buf[512];
- unsigned int len;
-
- if(display_option == current_option)
- color= COLOR_ACTIVE_ITEM;
- else
- color= COLOR_INACTIVE_ITEM;
-
- //sprintf("%A") will have problem ?
- strcpy(tmp_buf, *(display_option->display_string));
- // This is the number of the cheat to display
-
- int i = atoi(tmp_buf);
-
- sprintf(line_buffer, "%d.", i + 1);
- PRINT_STRING_BG(down_screen_addr, line_buffer, color, COLOR_TRANS, CHEAT_NUMBER_X, GUI_ROW1_Y + display_option-> line_number * GUI_ROW_SY + TEXT_OFFSET_Y);
-
- if (cheat_group_name_ptr[i] == NULL) {
- PRINT_STRING_BG(down_screen_addr, msg[MSG_CHEAT_ELEMENT_NOT_LOADED], color, COLOR_TRANS, CHEAT_DESC_X, GUI_ROW1_Y + display_option-> line_number * GUI_ROW_SY + TEXT_OFFSET_Y);
- }
- else {
- strcpy(line_buffer, cheat_group_name_ptr[i]);
- len = BDF_cut_string(line_buffer, 0, 2);
- if(len > CHEAT_DESC_SX)
- {
- len = BDF_cut_string(line_buffer, CHEAT_DESC_SX, 1);
- line_buffer[len] = '\0';
- strcat(line_buffer, "...");
- }
- PRINT_STRING_BG(down_screen_addr, line_buffer, color, COLOR_TRANS, CHEAT_DESC_X, GUI_ROW1_Y + display_option-> line_number * GUI_ROW_SY + TEXT_OFFSET_Y);
-
- if (NDSSFCIsCheatGroupEnabled (cheat_group_name_ptr[i]))
- strcpy(line_buffer, "+");
- else
- strcpy(line_buffer, "-");
- PRINT_STRING_BG(down_screen_addr, line_buffer, color, COLOR_TRANS, CHEAT_ACTIVE_X, GUI_ROW1_Y + display_option-> line_number * GUI_ROW_SY + TEXT_OFFSET_Y);
- }
- }
-
- void menu_load_cheat_file()
- {
- if (!first_load)
- {
- char *file_ext[] = { ".cht", NULL };
- int flag;
-
- if(load_file(file_ext, tmp_filename, DEFAULT_CHEAT_DIR) != -1)
- {
- sprintf(line_buffer, "%s/%s", DEFAULT_CHEAT_DIR, tmp_filename);
- flag = NDSSFCLoadCheatFile(line_buffer);
-
- S9xSaveCheatFile (S9xGetFilename (".chb")); // cheat binary
-
- if(0 != flag)
- { //load cheat file failure
- S9xDeleteCheats();
-
- cheat_menu_init();
- return;
- }
-
- menu_cheat_page = 0;
- cheat_menu_init();
-
- }
- }
- }
-
- void save_screen_snapshot()
- {
- if(bg_screenp != NULL)
- {
- bg_screenp_color = COLOR16(43, 11, 11);
- memcpy(bg_screenp, down_screen_addr, 256*192*2);
- }
- else
- bg_screenp_color = COLOR_BG;
-
- draw_message(down_screen_addr, bg_screenp, 28, 31, 227, 165, bg_screenp_color);
- if(!first_load)
- {
- draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SCREENSHOT_CREATING]);
- ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD);
- if(save_ss_bmp(screen)) {
- draw_message(down_screen_addr, bg_screenp, 28, 31, 227, 165, bg_screenp_color);
- draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SCREENSHOT_CREATION_SUCCEEDED]);
- }
- else {
- draw_message(down_screen_addr, bg_screenp, 28, 31, 227, 165, bg_screenp_color);
- draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SCREENSHOT_CREATION_FAILED]);
- }
- ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD);
- mdelay(500);
- }
- else
- {
- draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_TOP_SCREEN_NO_SAVED_STATE_IN_SLOT]);
- ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD);
- mdelay(500);
- }
- }
-
- void browse_screen_snapshot()
- {
- play_screen_snapshot();
- }
-
- MENU_TYPE latest_game_menu;
-
- void load_default_setting()
- {
- if(bg_screenp != NULL)
- {
- bg_screenp_color = COLOR16(43, 11, 11);
- memcpy(bg_screenp, down_screen_addr, 256*192*2);
- }
- else
- bg_screenp_color = COLOR_BG;
-
- draw_message(down_screen_addr, bg_screenp, 28, 31, 227, 165, bg_screenp_color);
- draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_DIALOG_RESET]);
-
- if(draw_yesno_dialog(DOWN_SCREEN, 115, msg[MSG_GENERAL_CONFIRM_WITH_A], msg[MSG_GENERAL_CANCEL_WITH_B]))
- {
- wait_Allkey_release(0);
- draw_message(down_screen_addr, bg_screenp, 28, 31, 227, 165, bg_screenp_color);
- draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_RESETTING]);
- ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD);
-
- sprintf(line_buffer, "%s/%s", main_path, EMU_CONFIG_FILENAME);
- remove(line_buffer);
-
- first_load= 1;
- latest_game_menu.focus_option = latest_game_menu.screen_focus = 0;
- init_emulator_config();
- init_game_config();
-
- ds2_clearScreen(UP_SCREEN, 0);
- draw_string_vcenter(up_screen_addr, 0, 88, 256, COLOR_WHITE, msg[MSG_TOP_SCREEN_NO_GAME_LOADED]);
- ds2_flipScreen(UP_SCREEN, UP_SCREEN_UPDATE_METHOD);
-
- // mdelay(500); // Delete this delay
- }
- }
-
- void check_gbaemu_version()
- {
- if(bg_screenp != NULL)
- {
- bg_screenp_color = COLOR16(43, 11, 11);
- memcpy(bg_screenp, down_screen_addr, 256*192*2);
- }
- else
- bg_screenp_color = COLOR_BG;
-
- draw_message(down_screen_addr, bg_screenp, 28, 31, 227, 165, bg_screenp_color);
- sprintf(line_buffer, "%s\n%s %s", msg[MSG_EMULATOR_NAME], msg[MSG_WORD_EMULATOR_VERSION], NDSSFC_VERSION);
- draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, line_buffer);
- ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD);
-
- wait_Allkey_release(0); // invoked from the menu
- wait_Anykey_press(0); // wait until the user presses something
- wait_Allkey_release(0); // don't give that button to the menu
- }
-
- void language_set()
- {
- if(gui_action == CURSOR_LEFT || gui_action == CURSOR_RIGHT)
- {
- HighFrequencyCPU(); // crank it up
-
- load_language_msg(LANGUAGE_PACK, emu_config.language);
-
- if(first_load)
- {
- ds2_clearScreen(UP_SCREEN, 0);
- draw_string_vcenter(up_screen_addr, 0, 88, 256, COLOR_WHITE, msg[MSG_TOP_SCREEN_NO_GAME_LOADED]);
- ds2_flipScreen(UP_SCREEN, UP_SCREEN_UPDATE_METHOD);
- }
-
- LowFrequencyCPU(); // and back down
- }
- }
-
-#ifdef ENABLE_FREE_SPACE
- unsigned int freespace;
- void show_card_space ()
- {
- u32 line_num;
- u32 num_byte;
-
- strcpy(line_buffer, *(display_option->display_string));
- line_num= display_option-> line_number;
- PRINT_STRING_BG(down_screen_addr, line_buffer, COLOR_INACTIVE_ITEM, COLOR_TRANS, OPTION_TEXT_X,
- GUI_ROW1_Y + (display_option->line_number) * GUI_ROW_SY + TEXT_OFFSET_Y);
-
- num_byte = freespace;
-
- if(num_byte <= 9999*2)
- { /* < 9999KB */
- sprintf(line_buffer, "%d", num_byte/2);
- if(num_byte & 1)
- strcat(line_buffer, ".5 KB");
- else
- strcat(line_buffer, ".0 KB");
- }
- else if(num_byte <= 9999*1024*2)
- { /* < 9999MB */
- num_byte /= 1024;
- sprintf(line_buffer, "%d", num_byte/2);
- if(num_byte & 1)
- strcat(line_buffer, ".5 MB");
- else
- strcat(line_buffer, ".0 MB");
- }
- else
- {
- num_byte /= 1024*1024;
- sprintf(line_buffer, "%d", num_byte/2);
- if(num_byte & 1)
- strcat(line_buffer, ".5 GB");
- else
- strcat(line_buffer, ".0 GB");
- }
-
- PRINT_STRING_BG(down_screen_addr, line_buffer, COLOR_INACTIVE_ITEM, COLOR_TRANS, 147,
- GUI_ROW1_Y + (display_option->line_number) * GUI_ROW_SY + TEXT_OFFSET_Y);
- }
-#endif
-
- char *screen_ratio_options[] = { (char*)&msg[MSG_VIDEO_ASPECT_RATIO_0],
- (char*)&msg[MSG_VIDEO_ASPECT_RATIO_1],
- (char*)&msg[MSG_VIDEO_ASPECT_RATIO_2],
- (char*)&msg[MSG_VIDEO_ASPECT_RATIO_3],
- (char*)&msg[MSG_VIDEO_ASPECT_RATIO_4]};
-
- char *frameskip_options[] = { (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_AUTOMATIC], (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_0], (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_1], (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_2], (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_3], (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_4], (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_5], (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_6], (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_7], (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_8], (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_9], (char*)&msg[MSG_VIDEO_FRAME_SKIPPING_10] };
-
- char *cpu_frequency_options[] = { (char*)&msg[MSG_OPTIONS_CPU_FREQUENCY_0], (char*)&msg[MSG_OPTIONS_CPU_FREQUENCY_1], (char*)&msg[MSG_OPTIONS_CPU_FREQUENCY_2], (char*)&msg[MSG_OPTIONS_CPU_FREQUENCY_3], (char*)&msg[MSG_OPTIONS_CPU_FREQUENCY_4], (char*)&msg[MSG_OPTIONS_CPU_FREQUENCY_5] };
-
- char *fluidity_options[] = { (char*)&msg[MSG_VIDEO_AUDIO_FLUIDITY_PREFER_VIDEO], (char*)&msg[MSG_VIDEO_AUDIO_FLUIDITY_PREFER_AUDIO] };
-
- char *on_off_options[] = { (char*)&msg[MSG_GENERAL_OFF], (char*)&msg[MSG_GENERAL_ON] };
-
- char *sound_seletion[] = { (char*)&msg[MSG_AUDIO_MUTED], (char*)&msg[MSG_AUDIO_ENABLED] };
-
- char *game_screen_options[] = { (char*)&msg[MSG_VIDEO_GAME_SCREEN_TOP], (char*)&msg[MSG_VIDEO_GAME_SCREEN_BOTTOM] };
-
-
-// char *snap_frame_options[] = { (char*)&msg[MSG_SNAP_FRAME_0], (char*)&msg[MSG_SNAP_FRAME_1] };
-
-// char *enable_disable_options[] = { (char*)&msg[MSG_EN_DIS_ABLE_0], (char*)&msg[MSG_EN_DIS_ABLE_1] };
-
- /*--------------------------------------------------------
- Video & Audio
- --------------------------------------------------------*/
- MENU_OPTION_TYPE graphics_options[] =
- {
- /* 00 */ SUBMENU_OPTION(NULL, &msg[MSG_MAIN_MENU_VIDEO_AUDIO], NULL, 0),
-
- /* 01 */ STRING_SELECTION_OPTION(NULL, NULL, &msg[FMT_VIDEO_ASPECT_RATIO], screen_ratio_options,
- &game_config.graphic, 5, NULL, PASSIVE_TYPE, 1),
-
- /* 02 */ STRING_SELECTION_OPTION(game_fastforward, NULL, &msg[FMT_VIDEO_FAST_FORWARD], on_off_options,
- &game_fast_forward, 2, NULL, ACTION_TYPE, 2),
-
- /* 03 */ STRING_SELECTION_OPTION(game_disableAudio, NULL, &msg[FMT_AUDIO_SOUND], sound_seletion,
- &game_enable_audio, 2, NULL, ACTION_TYPE, 3),
-
- /* 04 */ STRING_SELECTION_OPTION(game_set_fluidity, NULL, &msg[FMT_VIDEO_AUDIO_FLUIDITY_PREFERENCE], fluidity_options,
- &game_config.SoundSync, 2, NULL, ACTION_TYPE, 4),
-
- /* 05 */ STRING_SELECTION_OPTION(game_set_frameskip, NULL, &msg[FMT_VIDEO_FRAME_SKIPPING], frameskip_options,
- &game_config.frameskip_value, 12 /* auto (0) and 0..10 (1..11) make 12 option values */, NULL, ACTION_TYPE, 5),
-
- /* 06 */ STRING_SELECTION_OPTION(game_set_retro, NULL, &msg[FMT_AUDIO_RETRO_SOUND], on_off_options,
- &game_config.RetroSound, 2, NULL, ACTION_TYPE, 6),
-
- /* 07 */ STRING_SELECTION_OPTION(NULL, NULL, &msg[FMT_VIDEO_GAME_SCREEN], game_screen_options,
- &emu_config.BottomScreenGame, 2, NULL, PASSIVE_TYPE, 7)
-
- };
-
- MAKE_MENU(graphics, NULL, NULL, NULL, NULL, 1, 1);
-
- /*--------------------------------------------------------
- Game state -- delette
- --------------------------------------------------------*/
- MENU_TYPE game_state_menu;
-
- MENU_OPTION_TYPE gamestate_delette_options[] =
- {
- /* 00 */ SUBMENU_OPTION(&game_state_menu, &msg[MSG_SAVED_STATE_DELETE_GENERAL], NULL, 0),
-
- /* 01 */ NUMERIC_SELECTION_ACTION_OPTION(delette_savestate, NULL,
- &msg[FMT_SAVED_STATE_DELETE_ONE], &delette_savestate_num, SAVE_STATE_SLOT_NUM, NULL, 1),
-
- /* 02 */ ACTION_OPTION(delette_savestate, NULL, &msg[MSG_SAVED_STATE_DELETE_ALL], NULL, 2)
- };
-
- MAKE_MENU(gamestate_delette, gamestate_delette_menu_init, gamestate_delette_menu_passive, NULL, gamestate_delette_menu_end, 1, 1);
-
- /*--------------------------------------------------------
- Game state
- --------------------------------------------------------*/
- MENU_OPTION_TYPE game_state_options[] =
- {
- /* 00 */ SUBMENU_OPTION(NULL, &msg[MSG_MAIN_MENU_SAVED_STATES], NULL, 0),
-
- // savestate_index is still a signed int
- /* 01 */ NUMERIC_SELECTION_ACTION_OPTION(menu_save_state, NULL, &msg[FMT_SAVED_STATE_CREATE], (u32*) &savestate_index, SAVE_STATE_SLOT_NUM, NULL, 1),
-
- // savestate_index is still a signed int
- /* 02 */ NUMERIC_SELECTION_ACTION_OPTION(menu_load_state, NULL,
- &msg[FMT_SAVED_STATE_LOAD], (u32*) &savestate_index, SAVE_STATE_SLOT_NUM, NULL, 2),
-
- /* 03 */ SUBMENU_OPTION(&gamestate_delette_menu, &msg[MSG_SAVED_STATE_DELETE_GENERAL], NULL, 5),
- };
-
- INIT_MENU(game_state, game_state_menu_init, game_state_menu_passive, NULL, game_state_menu_end, 1, 1);
-
- /*--------------------------------------------------------
- Cheat options
- --------------------------------------------------------*/
- MENU_OPTION_TYPE cheats_options[] =
- {
- /* 00 */ SUBMENU_OPTION(NULL, &msg[MSG_MAIN_MENU_CHEATS], NULL,0),
-
- /* 01 */ CHEAT_OPTION(cheat_option_action, cheat_option_passive,
- ((CHEATS_PER_PAGE * menu_cheat_page) + 0), 1),
- /* 02 */ CHEAT_OPTION(cheat_option_action, cheat_option_passive,
- ((CHEATS_PER_PAGE * menu_cheat_page) + 1), 2),
- /* 03 */ CHEAT_OPTION(cheat_option_action, cheat_option_passive,
- ((CHEATS_PER_PAGE * menu_cheat_page) + 2), 3),
- /* 04 */ CHEAT_OPTION(cheat_option_action, cheat_option_passive,
- ((CHEATS_PER_PAGE * menu_cheat_page) + 3), 4),
- /* 03 */ CHEAT_OPTION(cheat_option_action, cheat_option_passive,
- ((CHEATS_PER_PAGE * menu_cheat_page) + 4), 5),
- /* 04 */ CHEAT_OPTION(cheat_option_action, cheat_option_passive,
- ((CHEATS_PER_PAGE * menu_cheat_page) + 5), 6),
-
- /* 05 */ NUMERIC_SELECTION_ACTION_OPTION(reload_cheats_page, NULL, &msg[FMT_CHEAT_PAGE],
- &menu_cheat_page, MAX_CHEATS_PAGE, NULL, 7),
-
- /* 06 */ ACTION_OPTION(menu_load_cheat_file, NULL, &msg[MSG_CHEAT_LOAD_FROM_FILE],
- NULL, 8)
- };
-
- INIT_MENU(cheats, cheat_menu_init, NULL, NULL, cheat_menu_end, 1, 1);
-
- /*--------------------------------------------------------
- Tools-screensanp
- --------------------------------------------------------*/
- MENU_TYPE tools_menu;
-
- MENU_OPTION_TYPE tools_screensnap_options[] =
- {
- /* 00 */ SUBMENU_OPTION(&tools_menu, &msg[MSG_TOOLS_SCREENSHOT_GENERAL], NULL, 0),
-
- /* 01 */ ACTION_OPTION(save_screen_snapshot, NULL, &msg[MSG_SCREENSHOT_CREATE], NULL, 1),
-
- /* 02 */ ACTION_OPTION(browse_screen_snapshot, NULL, &msg[MSG_SCREENSHOT_BROWSE], NULL, 2)
- };
-
- MAKE_MENU(tools_screensnap, NULL, NULL, NULL, NULL, 1, 1);
-
- /*--------------------------------------------------------
- Tools - Global hotkeys
- --------------------------------------------------------*/
- MENU_OPTION_TYPE tools_global_hotkeys_options[] =
- {
- /* 00 */ SUBMENU_OPTION(&tools_menu, &msg[MSG_TOOLS_GLOBAL_HOTKEY_GENERAL], NULL, 0),
-
- /* 01 */ ACTION_OPTION(set_global_hotkey_return_to_menu, global_hotkey_return_to_menu_passive, &msg[MSG_HOTKEY_MAIN_MENU], NULL, 1),
-
- /* 02 */ ACTION_OPTION(set_global_hotkey_temporary_fast_forward, global_hotkey_temporary_fast_forward_passive, &msg[MSG_HOTKEY_TEMPORARY_FAST_FORWARD], NULL, 2),
-
- /* 03 */ ACTION_OPTION(set_global_hotkey_toggle_sound, global_hotkey_toggle_sound_passive, &msg[MSG_HOTKEY_SOUND_TOGGLE], NULL, 3),
-
- /* 04 */ ACTION_OPTION(set_global_hotkey_quick_save_state, global_hotkey_quick_save_state_passive, &msg[MSG_HOTKEY_QUICK_SAVE_STATE], NULL, 4),
-
- /* 05 */ ACTION_OPTION(set_global_hotkey_quick_load_state, global_hotkey_quick_load_state_passive, &msg[MSG_HOTKEY_QUICK_LOAD_STATE], NULL, 5),
-
- /* 06 */ ACTION_OPTION(set_global_hotkey_toggle_full_screen, global_hotkey_toggle_full_screen_passive, &msg[MSG_HOTKEY_FULL_SCREEN_TOGGLE], NULL, 6)
- };
-
- MAKE_MENU(tools_global_hotkeys, NULL, NULL, NULL, NULL, 1, 1);
-
- /*--------------------------------------------------------
- Tools - Game-specific hotkey overrides
- --------------------------------------------------------*/
- MENU_OPTION_TYPE tools_game_specific_hotkeys_options[] =
- {
- /* 00 */ SUBMENU_OPTION(&tools_menu, &msg[MSG_TOOLS_GAME_HOTKEY_GENERAL], NULL, 0),
-
- /* 01 */ ACTION_OPTION(set_game_specific_hotkey_return_to_menu, game_specific_hotkey_return_to_menu_passive, &msg[MSG_HOTKEY_MAIN_MENU], NULL, 1),
-
- /* 02 */ ACTION_OPTION(set_game_specific_hotkey_temporary_fast_forward, game_specific_hotkey_temporary_fast_forward_passive, &msg[MSG_HOTKEY_TEMPORARY_FAST_FORWARD], NULL, 2),
-
- /* 03 */ ACTION_OPTION(set_game_specific_hotkey_toggle_sound, game_specific_hotkey_toggle_sound_passive, &msg[MSG_HOTKEY_SOUND_TOGGLE], NULL, 3),
-
- /* 04 */ ACTION_OPTION(set_game_specific_hotkey_quick_save_state, game_specific_hotkey_quick_save_state_passive, &msg[MSG_HOTKEY_QUICK_SAVE_STATE], NULL, 4),
-
- /* 05 */ ACTION_OPTION(set_game_specific_hotkey_quick_load_state, game_specific_hotkey_quick_load_state_passive, &msg[MSG_HOTKEY_QUICK_LOAD_STATE], NULL, 5),
-
- /* 06 */ ACTION_OPTION(set_game_specific_hotkey_toggle_full_screen, game_specific_hotkey_toggle_full_screen_passive, &msg[MSG_HOTKEY_FULL_SCREEN_TOGGLE], NULL, 6)
- };
-
- MAKE_MENU(tools_game_specific_hotkeys, NULL, NULL, NULL, NULL, 1, 1);
-
- /*--------------------------------------------------------
- Tools
- --------------------------------------------------------*/
- MENU_OPTION_TYPE tools_options[] =
- {
- /* 00 */ SUBMENU_OPTION(NULL, &msg[MSG_MAIN_MENU_TOOLS], NULL, 0),
-
- /* 01 */ SUBMENU_OPTION(&tools_screensnap_menu, &msg[MSG_TOOLS_SCREENSHOT_GENERAL], NULL, 1),
-
- /* 02 */ SUBMENU_OPTION(&tools_global_hotkeys_menu, &msg[MSG_TOOLS_GLOBAL_HOTKEY_GENERAL], NULL, 2),
-
- /* 03 */ SUBMENU_OPTION(&tools_game_specific_hotkeys_menu, &msg[MSG_TOOLS_GAME_HOTKEY_GENERAL], NULL, 3)
- };
-
- INIT_MENU(tools, tools_menu_init, NULL, NULL, NULL, 1, 1);
-
- /*--------------------------------------------------------
- Others
- --------------------------------------------------------*/
- u32 desert= 0;
- MENU_OPTION_TYPE others_options[] =
- {
- /* 00 */ SUBMENU_OPTION(NULL, &msg[MSG_MAIN_MENU_OPTIONS], NULL, 0),
-
- //CPU speed (string: shows MHz)
- /* 01 */ STRING_SELECTION_OPTION(NULL, NULL, &msg[FMT_OPTIONS_CPU_FREQUENCY], cpu_frequency_options,
- &game_config.clock_speed_number, 6, NULL, PASSIVE_TYPE, 1),
-
- /* 02 */ STRING_SELECTION_OPTION(language_set, NULL, &msg[FMT_OPTIONS_LANGUAGE], language_options,
- &emu_config.language, sizeof(language_options) / sizeof(language_options[0]) /* number of possible languages */, NULL, ACTION_TYPE, 2),
-
-#ifdef ENABLE_FREE_SPACE
- /* 03 */ STRING_SELECTION_OPTION(NULL, show_card_space, &msg[MSG_OPTIONS_CARD_CAPACITY], NULL,
- &desert, 2, NULL, PASSIVE_TYPE | HIDEN_TYPE, 3),
-#endif
-
- /* 04 */ ACTION_OPTION(load_default_setting, NULL, &msg[MSG_OPTIONS_RESET], NULL,
-#ifdef ENABLE_FREE_SPACE
- 4
-#else
- 3
-#endif
- ),
-
- /* 05 */ ACTION_OPTION(check_gbaemu_version, NULL, &msg[MSG_OPTIONS_VERSION], NULL,
-#ifdef ENABLE_FREE_SPACE
- 5
-#else
- 4
-#endif
- ),
- };
-
- MAKE_MENU(others, others_menu_init, NULL, NULL, NULL, 1, 1);
-
- /*--------------------------------------------------------
- Load_game
- --------------------------------------------------------*/
-
- MENU_OPTION_TYPE load_game_options[] =
- {
- /* 00 */ SUBMENU_OPTION(NULL, &msg[MSG_LOAD_GAME_MENU_TITLE], NULL, 0),
-
- /* 01 */ ACTION_OPTION(menu_load, NULL, &msg[MSG_LOAD_GAME_FROM_CARD], NULL, 1),
-
- /* 02 */ SUBMENU_OPTION(&latest_game_menu, &msg[MSG_LOAD_GAME_RECENTLY_PLAYED], NULL, 2)
- };
-
- MAKE_MENU(load_game, NULL, NULL, NULL, NULL, 1, 1);
-
- /*--------------------------------------------------------
- Latest game
- --------------------------------------------------------*/
- MENU_OPTION_TYPE latest_game_options[] =
- {
- /* 00 */ SUBMENU_OPTION(&load_game_menu, &msg[MSG_LOAD_GAME_RECENTLY_PLAYED], NULL, 0),
-
- /* 01 */ ACTION_OPTION(load_lastest_played, NULL, NULL, NULL, 1),
-
- /* 02 */ ACTION_OPTION(load_lastest_played, NULL, NULL, NULL, 2),
-
- /* 03 */ ACTION_OPTION(load_lastest_played, NULL, NULL, NULL, 3),
-
- /* 04 */ ACTION_OPTION(load_lastest_played, NULL, NULL, NULL, 4),
-
- /* 05 */ ACTION_OPTION(load_lastest_played, NULL, NULL, NULL, 5)
- };
-
- INIT_MENU(latest_game, latest_game_menu_init, latest_game_menu_passive,
- latest_game_menu_key, latest_game_menu_end, 0, 0);
-
- /*--------------------------------------------------------
- MAIN MENU
- --------------------------------------------------------*/
- MENU_OPTION_TYPE main_options[] =
- {
- /* 00 */ SUBMENU_OPTION(&graphics_menu, &msg[MSG_MAIN_MENU_VIDEO_AUDIO], NULL, 0),
-
- /* 01 */ SUBMENU_OPTION(&game_state_menu, &msg[MSG_MAIN_MENU_SAVED_STATES], NULL, 1),
-
- /* 02 */ SUBMENU_OPTION(&cheats_menu, &msg[MSG_MAIN_MENU_CHEATS], NULL, 2),
-
- /* 03 */ SUBMENU_OPTION(&tools_menu, &msg[MSG_MAIN_MENU_TOOLS], NULL, 3),
-
- /* 04 */ SUBMENU_OPTION(&others_menu, &msg[MSG_MAIN_MENU_OPTIONS], NULL, 4),
-
- /* 05 */ ACTION_OPTION(menu_exit, NULL, &msg[MSG_MAIN_MENU_EXIT], NULL, 5),
-
- /* 06 */ SUBMENU_OPTION(&load_game_menu, NULL, NULL, 6),
-
- /* 07 */ ACTION_OPTION(menu_return, NULL, NULL, NULL, 7),
-
- /* 08 */ ACTION_OPTION(menu_restart, NULL, NULL, NULL, 8)
- };
-
- MAKE_MENU(main, NULL, main_menu_passive, main_menu_key, NULL, 6, 0);
-
- void main_menu_passive()
- {
- u16 color;
- show_icon(down_screen_addr, &ICON_MAINBG, 0, 0);
-
- //Audio/Video
- strcpy(line_buffer, *(display_option->display_string));
- if(display_option++ == current_option) {
- show_icon(down_screen_addr, &ICON_AVO, 19, 2);
- show_icon(down_screen_addr, &ICON_MSEL, 5, 57);
- color = COLOR_ACTIVE_MAIN;
- }
- else {
- show_icon(down_screen_addr, &ICON_NAVO, 19, 2);
- show_icon(down_screen_addr, &ICON_MNSEL, 5, 57);
- color = COLOR_INACTIVE_MAIN;
- }
- draw_string_vcenter(down_screen_addr, 7, 57, 75, color, line_buffer);
-
- //Save
- strcpy(line_buffer, *(display_option->display_string));
- if(display_option++ == current_option) {
- show_icon(down_screen_addr, &ICON_SAVO, 103, 2);
- show_icon(down_screen_addr, &ICON_MSEL, 89, 57);
- color = COLOR_ACTIVE_MAIN;
- }
- else {
- show_icon(down_screen_addr, &ICON_NSAVO, 103, 2);
- show_icon(down_screen_addr, &ICON_MNSEL, 89, 57);
- color = COLOR_INACTIVE_MAIN;
- }
- draw_string_vcenter(down_screen_addr, 91, 57, 75, color, line_buffer);
-
- //Cheat
- strcpy(line_buffer, *(display_option->display_string));
- if(display_option++ == current_option) {
- show_icon(down_screen_addr, &ICON_CHEAT, 187, 2);
- show_icon(down_screen_addr, &ICON_MSEL, 173, 57);
- color = COLOR_ACTIVE_MAIN;
- }
- else {
- show_icon(down_screen_addr, &ICON_NCHEAT, 187, 2);
- show_icon(down_screen_addr, &ICON_MNSEL, 173, 57);
- color = COLOR_INACTIVE_MAIN;
- }
- draw_string_vcenter(down_screen_addr, 175, 57, 75, color, line_buffer);
-
- //Tools
- strcpy(line_buffer, *(display_option->display_string));
- if(display_option++ == current_option) {
- show_icon(down_screen_addr, &ICON_TOOL, 19, 75);
- show_icon(down_screen_addr, &ICON_MSEL, 5, 131);
- color = COLOR_ACTIVE_MAIN;
- }
- else {
- show_icon(down_screen_addr, &ICON_NTOOL, 19, 75);
- show_icon(down_screen_addr, &ICON_MNSEL, 5, 131);
- color = COLOR_INACTIVE_MAIN;
- }
- draw_string_vcenter(down_screen_addr, 7, 131, 75, color, line_buffer);
-
- //Other
- strcpy(line_buffer, *(display_option->display_string));
- if(display_option++ == current_option) {
- show_icon(down_screen_addr, &ICON_OTHER, 103, 75);
- show_icon(down_screen_addr, &ICON_MSEL, 89, 131);
- color = COLOR_ACTIVE_MAIN;
- }
- else {
- show_icon(down_screen_addr, &ICON_NOTHER, 103, 75);
- show_icon(down_screen_addr, &ICON_MNSEL, 89, 131);
- color = COLOR_INACTIVE_MAIN;
- }
- draw_string_vcenter(down_screen_addr, 91, 131, 75, color, line_buffer);
-
- //Exit
- strcpy(line_buffer, *(display_option->display_string));
- if(display_option++ == current_option) {
- show_icon(down_screen_addr, &ICON_EXIT, 187, 75);
- show_icon(down_screen_addr, &ICON_MSEL, 173, 131);
- color = COLOR_ACTIVE_MAIN;
- }
- else {
- show_icon(down_screen_addr, &ICON_NEXIT, 187, 75);
- show_icon(down_screen_addr, &ICON_MNSEL, 173, 131);
- color = COLOR_INACTIVE_MAIN;
- }
- draw_string_vcenter(down_screen_addr, 175, 131, 75, color, line_buffer);
-
- //New
- if(display_option++ == current_option) {
- show_icon(down_screen_addr, &ICON_MAINITEM, 0, 154);
- color = COLOR_ACTIVE_MAIN;
- }
- else {
- show_icon(down_screen_addr, &ICON_NMAINITEM, 0, 154);
- color = COLOR_INACTIVE_MAIN;
- }
- draw_string_vcenter(down_screen_addr, 0, 165, 85, color, msg[MSG_MAIN_MENU_NEW_GAME]);
-
- //Restart
- if(display_option++ == current_option) {
- show_icon(down_screen_addr, &ICON_MAINITEM, 85, 154);
- color = COLOR_ACTIVE_MAIN;
- }
- else {
- show_icon(down_screen_addr, &ICON_NMAINITEM, 85, 154);
- color = COLOR_INACTIVE_MAIN;
- }
- draw_string_vcenter(down_screen_addr, 85, 165, 85, color, msg[MSG_MAIN_MENU_RETURN_TO_GAME]);
-
- //Return
- if(display_option++ == current_option) {
- show_icon(down_screen_addr, &ICON_MAINITEM, 170, 154);
- color = COLOR_ACTIVE_MAIN;
- }
- else {
- show_icon(down_screen_addr, &ICON_NMAINITEM, 170, 154);
- color = COLOR_INACTIVE_MAIN;
- }
- draw_string_vcenter(down_screen_addr, 170, 165, 85, color, msg[MSG_MAIN_MENU_RESET_GAME]);
- }
-
- void main_menu_key()
- {
- switch(gui_action)
- {
- case CURSOR_DOWN:
- if(current_option_num < 6) current_option_num += 3;
- else current_option_num -= 6;
-
- current_option = current_menu->options + current_option_num;
- break;
-
- case CURSOR_UP:
- if(current_option_num < 3) current_option_num += 6;
- else current_option_num -= 3;
-
- current_option = current_menu->options + current_option_num;
- break;
-
- case CURSOR_RIGHT:
- if(current_option_num == 2) current_option_num -= 2;
- else if(current_option_num == 5) current_option_num -= 2;
- else if(current_option_num == 8) current_option_num -= 2;
- else current_option_num += 1;
-
- current_option = main_menu.options + current_option_num;
- break;
-
- case CURSOR_LEFT:
- if(current_option_num == 0) current_option_num += 2;
- else if(current_option_num == 3) current_option_num += 2;
- else if(current_option_num == 6) current_option_num += 2;
- else current_option_num -= 1;
-
- current_option = main_menu.options + current_option_num;
- break;
-
- default:
- break;
- }// end swith
- }
-
- void tools_menu_init()
- {
- /* if(game_config.backward)
- tools_options[4].option_type &= ~HIDEN_TYPE;
- else
- tools_options[4].option_type |= HIDEN_TYPE; */
- // OUT OF BOUNDS MEMORY ACCESS, REENABLE IF NEEDED [NEB]
- if (first_load)
- tools_options[3] /* game hotkeys */.option_type |= HIDEN_TYPE;
- else
- tools_options[3] /* game hotkeys */.option_type &= ~HIDEN_TYPE;
- }
-
- void obtain_hotkey (u32 *HotkeyBitfield)
- {
- draw_message(down_screen_addr, bg_screenp, 28, 31, 227, 165, bg_screenp_color);
- draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_HOTKEY_WAITING_FOR_KEYS]);
-
- u32 Keys = draw_hotkey_dialog(DOWN_SCREEN, 115, msg[MSG_HOTKEY_DELETE_WITH_A], msg[MSG_HOTKEY_CANCEL_WITH_B]);
- if (Keys == KEY_B)
- ; // unmodified
- else if (Keys == KEY_A)
- *HotkeyBitfield = 0; // clear
- else
- *HotkeyBitfield = Keys; // set
- }
-
- void set_global_hotkey_return_to_menu()
- {
- obtain_hotkey(&emu_config.HotkeyReturnToMenu);
- }
-
- void set_global_hotkey_temporary_fast_forward()
- {
- obtain_hotkey(&emu_config.HotkeyTemporaryFastForward);
- }
-
- void set_global_hotkey_toggle_sound()
- {
- obtain_hotkey(&emu_config.HotkeyToggleSound);
- }
-
- void set_global_hotkey_quick_load_state()
- {
- obtain_hotkey(&emu_config.HotkeyQuickLoadState);
- }
-
- void set_global_hotkey_quick_save_state()
- {
- obtain_hotkey(&emu_config.HotkeyQuickSaveState);
- }
-
- void set_global_hotkey_toggle_full_screen()
- {
- obtain_hotkey(&emu_config.HotkeyToggleFullScreen);
- }
-
- void set_game_specific_hotkey_return_to_menu()
- {
- obtain_hotkey(&game_config.HotkeyReturnToMenu);
- }
-
- void set_game_specific_hotkey_temporary_fast_forward()
- {
- obtain_hotkey(&game_config.HotkeyTemporaryFastForward);
- }
-
- void set_game_specific_hotkey_toggle_sound()
- {
- obtain_hotkey(&game_config.HotkeyToggleSound);
- }
-
- void set_game_specific_hotkey_quick_load_state()
- {
- obtain_hotkey(&game_config.HotkeyQuickLoadState);
- }
-
- void set_game_specific_hotkey_quick_save_state()
- {
- obtain_hotkey(&game_config.HotkeyQuickSaveState);
- }
-
- void set_game_specific_hotkey_toggle_full_screen()
- {
- obtain_hotkey(&game_config.HotkeyToggleFullScreen);
- }
-
-#define HOTKEY_CONTENT_X 156
- void hotkey_option_passive_common(u32 HotkeyBitfield)
- {
- unsigned short color;
- char tmp_buf[512];
- unsigned int len;
-
- if(display_option == current_option)
- color= COLOR_ACTIVE_ITEM;
- else
- color= COLOR_INACTIVE_ITEM;
-
- strcpy(tmp_buf, *(display_option->display_string));
- PRINT_STRING_BG(down_screen_addr, tmp_buf, color, COLOR_TRANS, OPTION_TEXT_X, GUI_ROW1_Y + display_option-> line_number * GUI_ROW_SY + TEXT_OFFSET_Y);
-
- // Construct a UTF-8 string showing the buttons in the
- // bitfield.
- tmp_buf[0] = '\0';
- if (HotkeyBitfield & KEY_L) strcpy(tmp_buf, HOTKEY_L_DISPLAY);
- if (HotkeyBitfield & KEY_R) strcat(tmp_buf, HOTKEY_R_DISPLAY);
- if (HotkeyBitfield & KEY_A) strcat(tmp_buf, HOTKEY_A_DISPLAY);
- if (HotkeyBitfield & KEY_B) strcat(tmp_buf, HOTKEY_B_DISPLAY);
- if (HotkeyBitfield & KEY_Y) strcat(tmp_buf, HOTKEY_Y_DISPLAY);
- if (HotkeyBitfield & KEY_X) strcat(tmp_buf, HOTKEY_X_DISPLAY);
- if (HotkeyBitfield & KEY_START) strcat(tmp_buf, HOTKEY_START_DISPLAY);
- if (HotkeyBitfield & KEY_SELECT) strcat(tmp_buf, HOTKEY_SELECT_DISPLAY);
- if (HotkeyBitfield & KEY_UP) strcat(tmp_buf, HOTKEY_UP_DISPLAY);
- if (HotkeyBitfield & KEY_DOWN) strcat(tmp_buf, HOTKEY_DOWN_DISPLAY);
- if (HotkeyBitfield & KEY_LEFT) strcat(tmp_buf, HOTKEY_LEFT_DISPLAY);
- if (HotkeyBitfield & KEY_RIGHT) strcat(tmp_buf, HOTKEY_RIGHT_DISPLAY);
-
- PRINT_STRING_BG(down_screen_addr, tmp_buf, color, COLOR_TRANS, HOTKEY_CONTENT_X, GUI_ROW1_Y + display_option-> line_number * GUI_ROW_SY + TEXT_OFFSET_Y);
- }
-
- void global_hotkey_return_to_menu_passive()
- {
- hotkey_option_passive_common(emu_config.HotkeyReturnToMenu);
- }
-
- void global_hotkey_temporary_fast_forward_passive()
- {
- hotkey_option_passive_common(emu_config.HotkeyTemporaryFastForward);
- }
-
- void global_hotkey_toggle_sound_passive()
- {
- hotkey_option_passive_common(emu_config.HotkeyToggleSound);
- }
-
- void global_hotkey_quick_load_state_passive()
- {
- hotkey_option_passive_common(emu_config.HotkeyQuickLoadState);
- }
-
- void global_hotkey_quick_save_state_passive()
- {
- hotkey_option_passive_common(emu_config.HotkeyQuickSaveState);
- }
-
- void global_hotkey_toggle_full_screen_passive()
- {
- hotkey_option_passive_common(emu_config.HotkeyToggleFullScreen);
- }
-
- void game_specific_hotkey_return_to_menu_passive()
- {
- hotkey_option_passive_common(game_config.HotkeyReturnToMenu);
- }
-
- void game_specific_hotkey_temporary_fast_forward_passive()
- {
- hotkey_option_passive_common(game_config.HotkeyTemporaryFastForward);
- }
-
- void game_specific_hotkey_toggle_sound_passive()
- {
- hotkey_option_passive_common(game_config.HotkeyToggleSound);
- }
-
- void game_specific_hotkey_quick_load_state_passive()
- {
- hotkey_option_passive_common(game_config.HotkeyQuickLoadState);
- }
-
- void game_specific_hotkey_quick_save_state_passive()
- {
- hotkey_option_passive_common(game_config.HotkeyQuickSaveState);
- }
-
- void game_specific_hotkey_toggle_full_screen_passive()
- {
- hotkey_option_passive_common(game_config.HotkeyToggleFullScreen);
- }
-
- int lastest_game_menu_scroll_value;
- void latest_game_menu_init()
- {
- u32 k;
- char *ext_pos;
-
- for(k= 0; k < 5; k++)
- {
- ext_pos= strrchr(emu_config.latest_file[k], '/');
- if(ext_pos != NULL)
- hscroll_init(down_screen_addr, OPTION_TEXT_X, GUI_ROW1_Y + k * GUI_ROW_SY + TEXT_OFFSET_Y, OPTION_TEXT_SX,
- COLOR_TRANS, k + 1 == latest_game_menu.focus_option ? COLOR_ACTIVE_ITEM : COLOR_INACTIVE_ITEM, ext_pos+1);
- else
- break;
- }
-
- if(k < 5)
- {
- latest_game_menu.num_options = k+1;
- }
- else
- latest_game_menu.num_options = 6;
-
- latest_game_menu.num_options = k+1;
-
- for(; k < 5; k++)
- {
- latest_game_options[k+1].option_type |= HIDEN_TYPE;
- }
-
- lastest_game_menu_scroll_value = 0;
- }
-
- void latest_game_menu_passive()
- {
- u32 k;
- //draw background
- show_icon(down_screen_addr, &ICON_SUBBG, 0, 0);
- show_icon(down_screen_addr, &ICON_TITLE, 0, 0);
- show_icon(down_screen_addr, &ICON_TITLEICON, TITLE_ICON_X, TITLE_ICON_Y);
-
- if(current_option_num == 0)
- show_icon(down_screen_addr, &ICON_BACK, BACK_BUTTON_X, BACK_BUTTON_Y);
- else
- {
- show_icon(down_screen_addr, &ICON_NBACK, BACK_BUTTON_X, BACK_BUTTON_Y);
- show_icon(down_screen_addr, &ICON_SUBSELA, SUBSELA_X, GUI_ROW1_Y + (current_option_num-1) * GUI_ROW_SY + SUBSELA_OFFSET_Y);
- }
-
- strcpy(line_buffer, *(display_option->display_string));
- draw_string_vcenter(down_screen_addr, 0, 9, 256, COLOR_ACTIVE_ITEM, line_buffer);
-
- for(k= 0; k<5; k++)
- if(emu_config.latest_file[k][0] != '\0')
- {
- if(current_option_num != k+1)
- draw_hscroll(k, 0);
- else
- {
- draw_hscroll(k, lastest_game_menu_scroll_value);
- lastest_game_menu_scroll_value = 0;
- }
- }
- }
-
- void latest_game_menu_end()
- {
- u32 k;
-
- for(k= 0; k < 5; k++)
- {
- if(emu_config.latest_file[k][0] != '\0')
- draw_hscroll_over(k);
- }
- }
-
- void latest_game_menu_key()
- {
- char *ext_pos;
-
- switch(gui_action)
- {
- case CURSOR_DOWN:
- //clear last option's bg
- if(current_option_num != 0)
- {
- draw_hscroll_over(current_option_num-1);
- ext_pos= strrchr(emu_config.latest_file[current_option_num-1], '/');
- hscroll_init(down_screen_addr, OPTION_TEXT_X, GUI_ROW1_Y + (current_option_num-1) * GUI_ROW_SY + TEXT_OFFSET_Y, OPTION_TEXT_SX,
- COLOR_TRANS, COLOR_INACTIVE_ITEM, ext_pos+1);
- }
-
- current_option_num += 1;
- if(current_option_num >= latest_game_menu.num_options)
- current_option_num = 0;
- current_option = current_menu->options + current_option_num;
-
- //Set current bg
- if(current_option_num != 0)
- {
- draw_hscroll_over(current_option_num-1);
- ext_pos= strrchr(emu_config.latest_file[current_option_num-1], '/');
- hscroll_init(down_screen_addr, OPTION_TEXT_X, GUI_ROW1_Y + (current_option_num-1) * GUI_ROW_SY + TEXT_OFFSET_Y, OPTION_TEXT_SX,
- COLOR_TRANS, COLOR_ACTIVE_ITEM, ext_pos+1);
- }
-
- break;
-
- case CURSOR_UP:
- //clear last option's bg
- if(current_option_num != 0)
- {
- draw_hscroll_over(current_option_num-1);
- ext_pos= strrchr(emu_config.latest_file[current_option_num-1], '/');
- hscroll_init(down_screen_addr, OPTION_TEXT_X, GUI_ROW1_Y + (current_option_num-1) * GUI_ROW_SY + TEXT_OFFSET_Y, OPTION_TEXT_SX,
- COLOR_TRANS, COLOR_INACTIVE_ITEM, ext_pos+1);
- }
-
- if(current_option_num > 0) current_option_num -= 1;
- else current_option_num = latest_game_menu.num_options -1;
- current_option = current_menu->options + current_option_num;
-
- //Set current bg
- if(current_option_num != 0)
- {
- draw_hscroll_over(current_option_num-1);
- ext_pos= strrchr(emu_config.latest_file[current_option_num-1], '/');
- hscroll_init(down_screen_addr, OPTION_TEXT_X, GUI_ROW1_Y + (current_option_num-1) * GUI_ROW_SY + TEXT_OFFSET_Y, OPTION_TEXT_SX,
- COLOR_TRANS, COLOR_ACTIVE_ITEM, ext_pos+1);
- }
-
- break;
-
- case CURSOR_RIGHT:
- lastest_game_menu_scroll_value = -5;
- break;
-
- case CURSOR_LEFT:
- lastest_game_menu_scroll_value = 5;
- break;
-
- default:
- break;
- }// end swith
- }
-
- void load_lastest_played()
- {
- char *ext_pos;
-
- if(bg_screenp != NULL) {
- bg_screenp_color = COLOR16(43, 11, 11);
- }
- else
- bg_screenp_color = COLOR_BG;
-
- ext_pos= strrchr(emu_config.latest_file[current_option_num -1], '/');
- *ext_pos= '\0';
- strcpy(rom_path, emu_config.latest_file[current_option_num -1]);
- *ext_pos= '/';
-
- ext_pos = emu_config.latest_file[current_option_num -1];
-
- LoadGameAndItsData(ext_pos);
-
- get_newest_savestate(tmp_filename);
- if(tmp_filename[0] != '\0')
- {
- load_state(tmp_filename);
- }
- }
-
- void game_fastforward()
- {
- }
-
-
-
- void reload_cheats_page()
- {
- for(i = 0; i < CHEATS_PER_PAGE; i++)
- {
- cheats_options[i+1].display_string = &cheat_data_ptr[(CHEATS_PER_PAGE * menu_cheat_page) + i];
- }
- }
-
- void others_menu_init()
- {
-#ifdef ENABLE_FREE_SPACE
- unsigned int total, used;
-
- //get card space info
- freespace = 0;
- fat_getDiskSpaceInfo("fat:", &total, &used, &freespace);
-#endif
- }
-
- void choose_menu(MENU_TYPE *new_menu)
- {
- if(new_menu == NULL)
- new_menu = &main_menu;
-
- if(NULL != current_menu) {
- if(current_menu->end_function)
- current_menu->end_function();
- SaveConfigsIfNeeded();
- current_menu->focus_option = current_menu->screen_focus = current_option_num;
- }
-
- current_menu = new_menu;
- current_option_num= current_menu -> focus_option;
- current_option = new_menu->options + current_option_num;
- PreserveConfigs();
- if(current_menu->init_function)
- current_menu->init_function();
- }
-
-//----------------------------------------------------------------------------//
-// Menu Start
- LowFrequencyCPU();
- if (!FirstInvocation)
- { // assume that the backlight is already at 3 when the emulator starts
- mdelay(100); // to prevent ds2_setBacklight() from crashing
- ds2_setBacklight(3);
- // also allow the user to press A for New Game right away
- wait_Allkey_release(0);
- }
-
- bg_screenp= (u16*)malloc(256*192*2);
-
- repeat = 1;
-
- if(gamepak_name[0] == 0)
- {
- first_load = 1;
- //try auto loading games passed through argv first
- if(strlen(argv[1]) > 0 && LoadGameAndItsData(argv[1]))
- repeat = 0;
- else
- {
- ds2_clearScreen(UP_SCREEN, COLOR_BLACK);
- draw_string_vcenter(up_screen_addr, 0, 88, 256, COLOR_WHITE, msg[MSG_TOP_SCREEN_NO_GAME_LOADED]);
- ds2_flipScreen(UP_SCREEN, UP_SCREEN_UPDATE_METHOD);
- }
- }
- else
- {
- copy_screen(up_screen_addr, (void*) screen, 0, 0, 256, 192);
- ds2_flipScreen(UP_SCREEN, 1);
- copy_screen(up_screen_addr, (void*) screen, 0, 0, 256, 192);
- ds2_flipScreen(UP_SCREEN, 1);
- }
-
- choose_menu(&main_menu);
-
-// Menu loop
-
- while(repeat)
- {
- display_option = current_menu->options;
- string_select= 0;
-
- if(current_menu -> passive_function)
- current_menu -> passive_function();
- else
- {
- u32 line_num, screen_focus, focus_option;
-
- //draw background
- show_icon(down_screen_addr, &ICON_SUBBG, 0, 0);
- show_icon(down_screen_addr, &ICON_TITLE, 0, 0);
- show_icon(down_screen_addr, &ICON_TITLEICON, TITLE_ICON_X, TITLE_ICON_Y);
-
- strcpy(line_buffer, *(display_option->display_string));
- draw_string_vcenter(down_screen_addr, 0, 9, 256, COLOR_ACTIVE_ITEM, line_buffer);
-
- line_num = current_option_num;
- screen_focus = current_menu -> screen_focus;
- focus_option = current_menu -> focus_option;
-
- if(focus_option < line_num) //focus next option
- {
- focus_option = line_num - focus_option;
- screen_focus += focus_option;
- if(screen_focus > SUBMENU_ROW_NUM) //Reach max row numbers can display
- screen_focus = SUBMENU_ROW_NUM;
-
- current_menu -> screen_focus = screen_focus;
- focus_option = line_num;
- }
- else if(focus_option > line_num) //focus last option
- {
- focus_option = focus_option - line_num;
- if(screen_focus > focus_option)
- screen_focus -= focus_option;
- else
- screen_focus = 0;
-
- if(screen_focus == 0 && line_num > 0)
- screen_focus = 1;
-
- current_menu -> screen_focus = screen_focus;
- focus_option = line_num;
- }
- current_menu -> focus_option = focus_option;
-
- i = focus_option - screen_focus;
- display_option += i +1;
-
- line_num = current_menu->num_options-1;
- if(line_num > SUBMENU_ROW_NUM)
- line_num = SUBMENU_ROW_NUM;
-
- if(focus_option == 0)
- show_icon(down_screen_addr, &ICON_BACK, BACK_BUTTON_X, BACK_BUTTON_Y);
- else
- show_icon(down_screen_addr, &ICON_NBACK, BACK_BUTTON_X, BACK_BUTTON_Y);
-
- for(i= 0; i < line_num; i++, display_option++)
- {
- unsigned short color;
-
- if(display_option == current_option)
- show_icon(down_screen_addr, &ICON_SUBSELA, SUBSELA_X, GUI_ROW1_Y + i * GUI_ROW_SY + SUBSELA_OFFSET_Y);
-
- if(display_option->passive_function)
- {
- display_option->line_number = i;
- display_option->passive_function();
- }
- else if(display_option->option_type & NUMBER_SELECTION_TYPE)
- {
- sprintf(line_buffer, *(display_option->display_string),
- *(display_option->current_option));
- }
- else if(display_option->option_type & STRING_SELECTION_TYPE)
- {
- sprintf(line_buffer, *(display_option->display_string),
- *((u32*)(((u32 *)display_option->options)[*(display_option->current_option)])));
- }
- else
- {
- strcpy(line_buffer, *(display_option->display_string));
- }
-
- if(display_option->passive_function == NULL)
- {
- if(display_option == current_option)
- color= COLOR_ACTIVE_ITEM;
- else
- color= COLOR_INACTIVE_ITEM;
-
- PRINT_STRING_BG(down_screen_addr, line_buffer, color, COLOR_TRANS, OPTION_TEXT_X, GUI_ROW1_Y + i * GUI_ROW_SY + TEXT_OFFSET_Y);
- }
- }
- }
-
- mdelay(20); // to prevent the DSTwo-DS link from being too clogged
- // to return button statuses
-
- struct key_buf inputdata;
- gui_action = get_gui_input();
-
- switch(gui_action)
- {
- case CURSOR_TOUCH:
- ds2_getrawInput(&inputdata);
- wait_Allkey_release(0);
- /* Back button at the top of every menu but the main one */
- if(current_menu != &main_menu && inputdata.x >= BACK_BUTTON_X && inputdata.y < BACK_BUTTON_Y + ICON_BACK.y)
- {
- choose_menu(current_menu->options->sub_menu);
- break;
- }
- /* Main menu */
- if(current_menu == &main_menu)
- {
- // 0 86 172 256
- // _____ _____ _____ 0
- // |0VID_|1SAV_|2CHT_| 80
- // |3TLS_|4OPT_|5EXI_| 160
- // |6NEW_|7RET_|8RST_| 192
-
- current_option_num = (inputdata.y / 80) * 3 + (inputdata.x / 86);
- current_option = current_menu->options + current_option_num;
-
- if(current_option -> option_type & HIDEN_TYPE)
- break;
- else if(current_option->option_type & ACTION_TYPE)
- current_option->action_function();
- else if(current_option->option_type & SUBMENU_TYPE)
- choose_menu(current_option->sub_menu);
- }
- /* This is the majority case, covering all menus except save states (and deletion thereof) */
- else if(current_menu != (main_menu.options + 1)->sub_menu
- && current_menu != ((main_menu.options +1)->sub_menu->options + 3)->sub_menu)
- {
- if (inputdata.y < GUI_ROW1_Y || inputdata.y >= GUI_ROW1_Y + SUBMENU_ROW_NUM * GUI_ROW_SY)
- break;
- // ___ 33 This screen has 6 possible rows. Touches
- // ___ 60 above or below these are ignored.
- // . . . (+27) The row between 33 and 60 is [1], though!
- // ___ 192
- u32 next_option_num = (inputdata.y - GUI_ROW1_Y) / GUI_ROW_SY + 1;
- struct _MENU_OPTION_TYPE *next_option = current_menu->options + next_option_num;
-
- if (next_option_num >= current_menu->num_options)
- break;
-
- if(!next_option)
- break;
-
- if(next_option -> option_type & HIDEN_TYPE)
- break;
-
- current_option_num = next_option_num;
- current_option = current_menu->options + current_option_num;
-
- if(current_option->option_type & (NUMBER_SELECTION_TYPE | STRING_SELECTION_TYPE))
- {
- gui_action = CURSOR_RIGHT;
- u32 current_option_val = *(current_option->current_option);
-
- if(current_option_val < current_option->num_options -1)
- current_option_val++;
- else
- current_option_val= 0;
- *(current_option->current_option) = current_option_val;
-
- if(current_option->action_function)
- current_option->action_function();
- }
- else if(current_option->option_type & ACTION_TYPE)
- current_option->action_function();
- else if(current_menu->key_function)
- {
- gui_action = CURSOR_RIGHT;
- current_menu->key_function();
- }
- else if(current_option->option_type & SUBMENU_TYPE)
- choose_menu(current_option->sub_menu);
- }
- /* Save states */
- else if(current_menu == (main_menu.options + 1)->sub_menu)
- {
- u32 next_option_num;
- if(inputdata.y < GUI_ROW1_Y + 1 * GUI_ROW_SY)
- break; // "Create saved state"
- else if(inputdata.y < GUI_ROW1_Y + 2 * GUI_ROW_SY) // Save cell
- next_option_num = 1;
- else if(inputdata.y < GUI_ROW1_Y + 3 * GUI_ROW_SY)
- break; // "Load saved state"
- else if(inputdata.y < GUI_ROW1_Y + 4 * GUI_ROW_SY) // Load cell
- next_option_num = 2;
- else if(inputdata.y < GUI_ROW1_Y + 5 * GUI_ROW_SY) // Del...
- next_option_num = 3;
- else
- break;
-
- struct _MENU_OPTION_TYPE *next_option = current_menu->options + next_option_num;
-
- if(next_option_num == 1 /* write */ || next_option_num == 2 /* read */)
- {
- u32 current_option_val = *(next_option->current_option);
- u32 old_option_val = current_option_val;
-
- // This row has SAVE_STATE_SLOT_NUM cells for save states, each ICON_STATEFULL.x pixels wide.
- // The left side of a square is at SavedStateSquareX(slot).
- bool8 found_state = FALSE;
- int i;
- for (i = 0; i < SAVE_STATE_SLOT_NUM; i++)
- {
- uint8 StartX = SavedStateSquareX (i);
- if (inputdata.x >= StartX && inputdata.x < StartX + ICON_STATEFULL.x)
- {
- current_option_val = i;
- found_state = TRUE;
- break;
- }
- }
- if(!found_state)
- break;
-
- current_option_num = next_option_num;
- current_option = next_option;
-
- *(current_option->current_option) = current_option_val;
-
- if(current_option_val == old_option_val)
- {
- gui_action = CURSOR_SELECT;
- if(current_option->option_type & ACTION_TYPE)
- current_option->action_function();
- else if(current_option->option_type & SUBMENU_TYPE)
- choose_menu(current_option->sub_menu);
- }
- else
- {
- // Initial selection of a saved state
- // needs to show its screenshot
- if(current_option->option_type & ACTION_TYPE)
- current_option->action_function();
- }
- break;
- }
-
- gui_action = CURSOR_SELECT;
- if(next_option -> option_type & HIDEN_TYPE)
- break;
-
- current_option_num = next_option_num;
- current_option = next_option;
-
- if(current_option->option_type & ACTION_TYPE)
- current_option->action_function();
- else if(current_option->option_type & SUBMENU_TYPE)
- choose_menu(current_option->sub_menu);
- }
- /* Delete state sub menu */
- else if(current_menu == ((main_menu.options + 1)->sub_menu->options + 3)->sub_menu)
- {
- u32 next_option_num;
- if(inputdata.y < GUI_ROW1_Y + 1 * GUI_ROW_SY)
- break;
- else if(inputdata.y < GUI_ROW1_Y + 2 * GUI_ROW_SY)
- next_option_num = 1;
- else if(inputdata.y < GUI_ROW1_Y + 3 * GUI_ROW_SY)
- next_option_num = 2;
- else
- break;
-
- struct _MENU_OPTION_TYPE *next_option = current_menu->options + next_option_num;
-
- if(next_option_num == 1)
- {
- u32 current_option_val = *(next_option->current_option);
- u32 old_option_val = current_option_val;
-
- // This row has SAVE_STATE_SLOT_NUM cells for save states, each ICON_STATEFULL.x pixels wide.
- // The left side of a square is at SavedStateSquareX(slot).
- bool8 found_state = FALSE;
- int i;
- for (i = 0; i < SAVE_STATE_SLOT_NUM; i++)
- {
- uint8 StartX = SavedStateSquareX (i);
- if (inputdata.x >= StartX && inputdata.x < StartX + ICON_STATEFULL.x)
- {
- current_option_val = i;
- found_state = TRUE;
- break;
- }
- }
- if(!found_state)
- break;
-
- current_option_num = next_option_num;
- current_option = next_option;
-
- *(current_option->current_option) = current_option_val;
-
- if(current_option_val == old_option_val)
- {
- gui_action = CURSOR_SELECT;
- if(current_option->option_type & ACTION_TYPE)
- current_option->action_function();
- else if(current_option->option_type & SUBMENU_TYPE)
- choose_menu(current_option->sub_menu);
- }
- break;
- }
-
- gui_action = CURSOR_SELECT;
- if(next_option -> option_type & HIDEN_TYPE)
- break;
-
- current_option_num = next_option_num;
- current_option = next_option;
-
- if(current_option->option_type & ACTION_TYPE)
- current_option->action_function();
- else if(current_option->option_type & SUBMENU_TYPE)
- choose_menu(current_option->sub_menu);
- }
- break;
- case CURSOR_DOWN:
- if(current_menu->key_function)
- current_menu->key_function();
- else
- {
- current_option_num = (current_option_num + 1) % current_menu->num_options;
- current_option = current_menu->options + current_option_num;
-
- while(current_option -> option_type & HIDEN_TYPE)
- {
- current_option_num = (current_option_num + 1) % current_menu->num_options;
- current_option = current_menu->options + current_option_num;
- }
- }
- break;
-
- case CURSOR_UP:
- if(current_menu->key_function)
- current_menu->key_function();
- else
- {
- if(current_option_num)
- current_option_num--;
- else
- current_option_num = current_menu->num_options - 1;
- current_option = current_menu->options + current_option_num;
-
- while(current_option -> option_type & HIDEN_TYPE)
- {
- if(current_option_num)
- current_option_num--;
- else
- current_option_num = current_menu->num_options - 1;
- current_option = current_menu->options + current_option_num;
- }
- }
- break;
-
- case CURSOR_RIGHT:
- if(current_menu->key_function)
- current_menu->key_function();
- else
- {
- if(current_option->option_type & (NUMBER_SELECTION_TYPE | STRING_SELECTION_TYPE))
- {
- u32 current_option_val = *(current_option->current_option);
-
- if(current_option_val < current_option->num_options -1)
- current_option_val++;
- else
- current_option_val= 0;
- *(current_option->current_option) = current_option_val;
-
- if(current_option->action_function)
- current_option->action_function();
- }
- }
- break;
-
- case CURSOR_LEFT:
- if(current_menu->key_function)
- current_menu->key_function();
- else
- {
- if(current_option->option_type & (NUMBER_SELECTION_TYPE | STRING_SELECTION_TYPE))
- {
- u32 current_option_val = *(current_option->current_option);
-
- if(current_option_val)
- current_option_val--;
- else
- current_option_val = current_option->num_options - 1;
- *(current_option->current_option) = current_option_val;
-
- if(current_option->action_function)
- current_option->action_function();
- }
- }
- break;
-
- case CURSOR_EXIT:
- wait_Allkey_release(0);
- break;
-
- case CURSOR_SELECT:
- wait_Allkey_release(0);
- if(current_option->option_type & ACTION_TYPE)
- current_option->action_function();
- else if(current_option->option_type & SUBMENU_TYPE)
- choose_menu(current_option->sub_menu);
- break;
-
- case CURSOR_BACK:
- wait_Allkey_release(0);
- if(current_menu != &main_menu)
- choose_menu(current_menu->options->sub_menu);
- else
- menu_return();
- break;
-
- default:
- break;
- } // end swith
-
- ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD);
- } // end while
-
- if (current_menu && current_menu->end_function)
- current_menu->end_function();
- SaveConfigsIfNeeded();
-
- if(bg_screenp != NULL) free((void*)bg_screenp);
-
- void* screen_addr;
- SCREEN_ID screen_num;
- if (emu_config.BottomScreenGame)
- {
- screen_addr = down_screen_addr;
- screen_num = DOWN_SCREEN;
- ds2_clearScreen(UP_SCREEN, 0);
- ds2_flipScreen(UP_SCREEN, DOWN_SCREEN_UPDATE_METHOD);
- }
- else
- {
- screen_addr = up_screen_addr;
- screen_num = UP_SCREEN;
- ds2_clearScreen(DOWN_SCREEN, 0);
- ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD);
- }
-
- copy_screen(screen_addr, (void*) screen, 0, 0, 256, 192);
- ds2_flipScreen(screen_num, UP_SCREEN_UPDATE_METHOD);
- copy_screen(screen_addr, (void*) screen, 0, 0, 256, 192);
- ds2_flipScreen(screen_num, UP_SCREEN_UPDATE_METHOD);
- wait_Allkey_release(0);
-
- mdelay(100); // to prevent ds2_setBacklight() from crashing
- ds2_setBacklight(3 - screen_num);
-
- GameFrequencyCPU();
-
- return return_value;
-}
-
-/*--------------------------------------------------------
- Initialize default path
---------------------------------------------------------*/
-void initial_path_config(void)
-{
- //Initial directory path
- sprintf(g_default_rom_dir, "%s/gamepak", main_path);
- sprintf(DEFAULT_RTS_DIR, "%s/gamerts", main_path);
- sprintf(DEFAULT_CFG_DIR, "%s/gamerts", main_path);
- sprintf(DEFAULT_SS_DIR, "%s/gamepic", main_path);
- sprintf(DEFAULT_CHEAT_DIR, "%s/gamecht", main_path);
-}
-
-/*--------------------------------------------------------
- Load language message
---------------------------------------------------------*/
-int load_language_msg(char *filename, u32 language)
-{
- FILE *fp;
- char msg_path[MAX_PATH];
- char string[256];
- char start[32];
- char end[32];
- char *pt, *dst;
- u32 loop, offset, len;
- int ret;
-
- sprintf(msg_path, "%s/%s", main_path, filename);
- fp = fopen(msg_path, "rb");
- if(fp == NULL)
- return -1;
-
- switch(language)
- {
- case ENGLISH:
- default:
- strcpy(start, "STARTENGLISH");
- strcpy(end, "ENDENGLISH");
- break;
- case CHINESE_SIMPLIFIED:
- strcpy(start, "STARTCHINESESIM");
- strcpy(end, "ENDCHINESESIM");
- break;
- case FRENCH:
- strcpy(start, "STARTFRENCH");
- strcpy(end, "ENDFRENCH");
- break;
- case GERMAN:
- strcpy(start, "STARTGERMAN");
- strcpy(end, "ENDGERMAN");
- break;
- case DUTCH:
- strcpy(start, "STARTDUTCH");
- strcpy(end, "ENDDUTCH");
- break;
- case SPANISH:
- strcpy(start, "STARTSPANISH");
- strcpy(end, "ENDSPANISH");
- break;
- case ITALIAN:
- strcpy(start, "STARTITALIAN");
- strcpy(end, "ENDITALIAN");
- break;
- case PORTUGUESE_BRAZILIAN:
- strcpy(start, "STARTPORTUGUESEBR");
- strcpy(end, "ENDPORTUGUESEBR");
- break;
- }
- u32 cmplen = strlen(start);
-
- //find the start flag
- ret= 0;
- while(1)
- {
- pt= fgets(string, 256, fp);
- if(pt == NULL)
- {
- ret= -2;
- goto load_language_msg_error;
- }
-
- if(!strncmp(pt, start, cmplen))
- break;
- }
-
- loop= 0;
- offset= 0;
- dst= msg_data;
- msg[0]= dst;
-
- while(loop != MSG_END)
- {
- while(1)
- {
- pt = fgets(string, 256, fp);
- if(pt[0] == '#' || pt[0] == '\r' || pt[0] == '\n')
- continue;
- if(pt != NULL)
- break;
- else
- {
- ret = -3;
- goto load_language_msg_error;
- }
- }
-
- if(!strncmp(pt, end, cmplen-2))
- break;
-
- len= strlen(pt);
- // memcpy(dst, pt, len);
-
- // Replace key definitions (*letter) with Pictochat icons
- // while copying.
- unsigned int srcChar, dstLen = 0;
- for (srcChar = 0; srcChar < len; srcChar++)
- {
- if (pt[srcChar] == '*')
- {
- switch (pt[srcChar + 1])
- {
- case 'A':
- memcpy(&dst[dstLen], HOTKEY_A_DISPLAY, sizeof (HOTKEY_A_DISPLAY) - 1);
- srcChar++;
- dstLen += sizeof (HOTKEY_A_DISPLAY) - 1;
- break;
- case 'B':
- memcpy(&dst[dstLen], HOTKEY_B_DISPLAY, sizeof (HOTKEY_B_DISPLAY) - 1);
- srcChar++;
- dstLen += sizeof (HOTKEY_B_DISPLAY) - 1;
- break;
- case 'X':
- memcpy(&dst[dstLen], HOTKEY_X_DISPLAY, sizeof (HOTKEY_X_DISPLAY) - 1);
- srcChar++;
- dstLen += sizeof (HOTKEY_X_DISPLAY) - 1;
- break;
- case 'Y':
- memcpy(&dst[dstLen], HOTKEY_Y_DISPLAY, sizeof (HOTKEY_Y_DISPLAY) - 1);
- srcChar++;
- dstLen += sizeof (HOTKEY_Y_DISPLAY) - 1;
- break;
- case 'L':
- memcpy(&dst[dstLen], HOTKEY_L_DISPLAY, sizeof (HOTKEY_L_DISPLAY) - 1);
- srcChar++;
- dstLen += sizeof (HOTKEY_L_DISPLAY) - 1;
- break;
- case 'R':
- memcpy(&dst[dstLen], HOTKEY_R_DISPLAY, sizeof (HOTKEY_R_DISPLAY) - 1);
- srcChar++;
- dstLen += sizeof (HOTKEY_R_DISPLAY) - 1;
- break;
- case 'S':
- memcpy(&dst[dstLen], HOTKEY_START_DISPLAY, sizeof (HOTKEY_START_DISPLAY) - 1);
- srcChar++;
- dstLen += sizeof (HOTKEY_START_DISPLAY) - 1;
- break;
- case 's':
- memcpy(&dst[dstLen], HOTKEY_SELECT_DISPLAY, sizeof (HOTKEY_SELECT_DISPLAY) - 1);
- srcChar++;
- dstLen += sizeof (HOTKEY_SELECT_DISPLAY) - 1;
- break;
- case 'u':
- memcpy(&dst[dstLen], HOTKEY_UP_DISPLAY, sizeof (HOTKEY_UP_DISPLAY) - 1);
- srcChar++;
- dstLen += sizeof (HOTKEY_UP_DISPLAY) - 1;
- break;
- case 'd':
- memcpy(&dst[dstLen], HOTKEY_DOWN_DISPLAY, sizeof (HOTKEY_DOWN_DISPLAY) - 1);
- srcChar++;
- dstLen += sizeof (HOTKEY_DOWN_DISPLAY) - 1;
- break;
- case 'l':
- memcpy(&dst[dstLen], HOTKEY_LEFT_DISPLAY, sizeof (HOTKEY_LEFT_DISPLAY) - 1);
- srcChar++;
- dstLen += sizeof (HOTKEY_LEFT_DISPLAY) - 1;
- break;
- case 'r':
- memcpy(&dst[dstLen], HOTKEY_RIGHT_DISPLAY, sizeof (HOTKEY_RIGHT_DISPLAY) - 1);
- srcChar++;
- dstLen += sizeof (HOTKEY_RIGHT_DISPLAY) - 1;
- break;
- case '\0':
- dst[dstLen] = pt[srcChar];
- dstLen++;
- break;
- default:
- memcpy(&dst[dstLen], &pt[srcChar], 2);
- srcChar++;
- dstLen += 2;
- break;
- }
- }
- else
- {
- dst[dstLen] = pt[srcChar];
- dstLen++;
- }
- }
-
- dst += dstLen;
- //at a line return, when "\n" paded, this message not end
- if(*(dst-1) == 0x0A)
- {
- pt = strrchr(pt, '\\');
- if((pt != NULL) && (*(pt+1) == 'n'))
- {
- if(*(dst-2) == 0x0D)
- {
- *(dst-4)= '\n';
- dst -= 3;
- }
- else
- {
- *(dst-3)= '\n';
- dst -= 2;
- }
- }
- else//a message end
- {
- if(*(dst-2) == 0x0D)
- dst -= 1;
- *(dst-1) = '\0';
- msg[++loop] = dst;
- }
- }
- }
-
- #if 0
- loop= 0;
- printf("------\n");
- while(loop != MSG_END)
- printf("%d: %s\n",loop, msg[loop++]);
- #endif
-
-load_language_msg_error:
- fclose(fp);
- return ret;
-}
-
-/*--------------------------------------------------------
---------------------------------------------------------*/
-
-
-/*--------------------------------------------------------
- Load font library
---------------------------------------------------------*/
-u32 load_font()
-{
- return (u32)BDF_font_init();
-}
-
-/*--------------------------------------------------------
- Game configure initialize
---------------------------------------------------------*/
-void init_game_config(void)
-{
- game_config.clock_speed_number = 5; // 396 MHz by default
- game_config.graphic = 3; // By default, have a good-looking aspect ratio
- game_config.frameskip_value = 0; // Automatic frame skipping
- game_config.SoundSync = 0; // Prefer fluid images by default
- game_config.RetroSound = 0; // Correct sound by default (else 8-bit)
-
- game_config.backward = 0; //time backward disable
- game_config.backward_time = 2; //time backward granularity 1s
-
- savestate_index= 0;
-}
-
-/*--------------------------------------------------------
- Emulator configure initialize
---------------------------------------------------------*/
-void init_emulator_config(void)
-{
- emu_config.language = 0; //defalut language= English
-
- emu_config.rom_file[0]= 0;
- emu_config.rom_path[0]= 0;
- memset(emu_config.latest_file, 0, sizeof(emu_config.latest_file));
-
- gamepak_name[0] = '\0';
-}
-
-/*--------------------------------------------------------
- Load game configure file
---------------------------------------------------------*/
-void load_game_config_file(void)
-{
- char game_config_filename[MAX_PATH];
- FILE* fp;
- char *pt;
-
- //Set default
- init_game_config();
-
- sprintf(game_config_filename, "%s/%s", DEFAULT_CFG_DIR, gamepak_name);
- pt= strrchr(game_config_filename, '.');
- if(NULL == pt)
- goto finalise;
- *pt= 0;
- strcat(game_config_filename, "_0.rts");
-
- fp = fopen(game_config_filename, "r");
- if(NULL == fp)
- goto finalise;
-
- //Check file header
- pt= game_config_filename;
- fread(pt, 1, GAME_CONFIG_HEADER_SIZE, fp);
-
- if (!strncmp(pt, GAME_CONFIG_HEADER, GAME_CONFIG_HEADER_SIZE))
- {
- fread(&game_config, 1, sizeof(GAME_CONFIG), fp);
- }
-
- fclose(fp);
-
-finalise: ;
- game_set_frameskip();
- game_set_fluidity();
- game_set_retro();
-}
-
-/*--------------------------------------------------------
- Load emulator configure file
---------------------------------------------------------*/
-int load_emu_config_file(void)
-{
- char tmp_path[MAX_PATH];
- FILE* fp;
- char *pt;
-
- sprintf(tmp_path, "%s/%s", main_path, EMU_CONFIG_FILENAME);
-
- fp = fopen(tmp_path, "r");
- if(NULL != fp)
- {
- // check the file header
- pt= tmp_path;
- fread(pt, 1, EMU_CONFIG_HEADER_SIZE, fp);
- pt[EMU_CONFIG_HEADER_SIZE]= 0;
- if(!strcmp(pt, EMU_CONFIG_HEADER))
- {
- memset(&emu_config, 0, sizeof(emu_config));
- fread(&emu_config, 1, sizeof(emu_config), fp);
- fclose(fp);
- return 0;
- }
- else
- {
- fclose(fp);
- }
- }
-
- //have no confiure file, set default
- init_emulator_config();
- return -1;
-}
-
-/*--------------------------------------------------------
- Save game configure file
---------------------------------------------------------*/
-int save_game_config_file(void)
-{
- char game_config_filename[MAX_PATH];
- FILE* fp;
- char *pt;
-
- if(gamepak_name[0] == 0) return -1;
-
- sprintf(game_config_filename, "%s/%s", DEFAULT_CFG_DIR, gamepak_name);
- pt = strrchr(game_config_filename, '.');
- if(NULL == pt)
- return -1;
-
- *pt = '\0';
- strcat(pt, "_0.rts");
-
- fp = fopen(game_config_filename, "w");
- if(NULL != fp)
- {
- fwrite(GAME_CONFIG_HEADER, 1, GAME_CONFIG_HEADER_SIZE, fp);
- fwrite(&game_config, 1, sizeof(game_config), fp);
- fclose(fp);
- return 0;
- }
-
- return -1;
-}
-
-/*--------------------------------------------------------
- Save emulator confiure file
---------------------------------------------------------*/
-int save_emu_config_file()
-{
- char tmp_path[MAX_PATH];
- FILE* fp;
-
- sprintf(tmp_path, "%s/%s", main_path, EMU_CONFIG_FILENAME);
- fp = fopen(tmp_path, "w");
- if(NULL != fp)
- {
- fwrite(EMU_CONFIG_HEADER, 1, EMU_CONFIG_HEADER_SIZE, fp);
- fwrite(&emu_config, 1, sizeof(emu_config), fp);
- fclose(fp);
- return 0;
- }
-
- return -1;
-}
-
-/*--------------------------------------------------------
- Reorder latest player game recorder
---------------------------------------------------------*/
-void reorder_latest_file(void)
-{
- s32 i, FoundIndex = -1;
-
- if(gamepak_name[0] == '\0')
- return;
-
- // Is the file's name already here?
- for (i = 0; i < 5; i++)
- {
- char* RecentFileName = strrchr(emu_config.latest_file[i], '/');
- if (RecentFileName)
- {
- if (strcasecmp(RecentFileName + 1, gamepak_name) == 0)
- {
- FoundIndex = i; // Yes.
- break;
- }
- }
- }
-
- if (FoundIndex > -1)
- {
- // Already here, move all of those until the existing one 1 down
- memmove(emu_config.latest_file[1],
- emu_config.latest_file[0],
- FoundIndex * sizeof(emu_config.latest_file[0]));
- }
- else
- {
- // Not here, move everything down
- memmove(emu_config.latest_file[1],
- emu_config.latest_file[0],
- 4 * sizeof(emu_config.latest_file[0]));
- }
-
- //Removing rom_path due to confusion, replacing with g_default_rom_dir
- sprintf(emu_config.latest_file[0], "%s/%s", g_default_rom_dir, gamepak_name);
-}
-
-/*--------------------------------------------------------
- Save state related
---------------------------------------------------------*/
-static int rtc_time_cmp(struct rtc *t1, struct rtc *t2)
-{
- int result;
-
- result= (int)((unsigned int)(t1 -> year) - (unsigned int)(t2 -> year));
- if(result != 0)
- return result;
- result= (int)((unsigned int)(t1 -> month) - (unsigned int)(t2 -> month));
- if(result != 0)
- return result;
- result= (int)((unsigned int)(t1 -> day) - (unsigned int)(t2 -> day));
- if(result != 0)
- return result;
- result= (int)((unsigned int)(t1 -> weekday) - (unsigned int)(t2 -> weekday));
- if(result != 0)
- return result;
- result= (int)((unsigned int)(t1 -> hours) - (unsigned int)(t2 -> hours));
- if(result != 0)
- return result;
- result= (int)((unsigned int)(t1 -> minutes) - (unsigned int)(t2 -> minutes));
- if(result != 0)
- return result;
- result= (int)((unsigned int)(t1 -> seconds) - (unsigned int)(t2 -> seconds));
-// if(result != 0)
- return result;
-}
-
-static void get_savestate_filelist(void)
-{
- int i;
- char savestate_path[MAX_PATH];
- char postdrix[8];
- char *pt;
- FILE *fp;
- unsigned int n, m;
- // Which is the latest?
- /* global */ latest_save = -1;
- struct rtc latest_save_time, current_time;
- memset(&latest_save_time, 0, sizeof (struct rtc));
-
- sprintf(savestate_path, "%s/%s", DEFAULT_RTS_DIR, gamepak_name);
- pt= strrchr(savestate_path, '.');
- for(i= 0; i < SAVE_STATE_SLOT_NUM; i++)
- {
- sprintf(postdrix, "_%d.rts", i+1);
- strcpy(pt, postdrix);
-
- fp= fopen(savestate_path, "r");
- if (fp != NULL)
- {
- SavedStateExistenceCache [i] = TRUE;
- m = fread((void*)&n, 1, 4, fp);
- if(m < 4) {
- fclose(fp);
- continue;
- }
-
- fseek(fp, n, SEEK_SET);
- /* Read back the time stamp */
- fread((char*)&current_time, 1, sizeof(struct rtc), fp);
- if (rtc_time_cmp (&current_time, &latest_save_time) > 0)
- {
- latest_save = i;
- latest_save_time = current_time;
- }
- fclose(fp);
- }
- else
- SavedStateExistenceCache [i] = FALSE;
-
- SavedStateExistenceCached [i] = TRUE;
- }
-
- if(latest_save < 0)
- savestate_index = 0;
- else
- savestate_index = latest_save;
-}
-
-static void get_savestate_filename(u32 slot, char *name_buffer)
-{
- char savestate_ext[16];
- char *pt;
-
- sprintf(savestate_ext, "_%d.rts", slot+1);
- pt = strrchr(gamepak_name, '/');
- if(NULL == pt)
- pt = gamepak_name;
- else
- pt += 1;
-
- change_ext(pt, name_buffer, savestate_ext);
-}
-
-uint8 SavedStateSquareX (u32 slot)
-{
- return (SCREEN_WIDTH * (slot + 1) / (SAVE_STATE_SLOT_NUM + 1))
- - ICON_STATEFULL.x / 2;
-}
-
-bool8 SavedStateFileExists (u32 slot)
-{
- if (SavedStateExistenceCached [slot])
- return SavedStateExistenceCache [slot];
-
- char BaseName [_MAX_PATH + 1];
- char FullName [_MAX_PATH + 1];
- get_savestate_filename(slot, BaseName);
- sprintf(FullName, "%s/%s", DEFAULT_RTS_DIR, BaseName);
- FILE *SavedStateFile = fopen(FullName, "r");
- bool8 Result = SavedStateFile != NULL;
- if (Result)
- {
- fclose(SavedStateFile);
- }
- SavedStateExistenceCache [slot] = Result;
- SavedStateExistenceCached [slot] = TRUE;
- return Result;
-}
-
-void SavedStateCacheInvalidate (void)
-{
- int i;
- for (i = 0; i < SAVE_STATE_SLOT_NUM; i++)
- SavedStateExistenceCached [i] = FALSE;
-}
-
-void QuickLoadState (void)
-{
- char BaseName[MAX_PATH + 1];
- get_savestate_filename(0, BaseName);
- SCREEN_ID screen_num = emu_config.BottomScreenGame
- ? DOWN_SCREEN
- : UP_SCREEN;
-
- mdelay(100); // needed to avoid ds2_setBacklight crashing
- ds2_setBacklight((3 - DOWN_SCREEN) | (3 - screen_num));
-
- ds2_clearScreen(DOWN_SCREEN, RGB15(0, 0, 0));
- draw_message(down_screen_addr, NULL, 28, 31, 227, 165, 0);
- draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_LOADING]);
- ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD);
-
- HighFrequencyCPU();
- int flag = load_state(BaseName);
- GameFrequencyCPU();
- if(0 != flag)
- {
- draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_LOAD_FAILED]);
- mdelay(500); // let the failure show
- }
-
- SavedStateCacheInvalidate ();
-
- ds2_clearScreen(DOWN_SCREEN, RGB15(0, 0, 0));
- ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD);
-
- mdelay(100); // needed to avoid ds2_setBacklight crashing
- ds2_setBacklight(3 - screen_num);
-}
-
-void QuickSaveState (void)
-{
- char BaseName[MAX_PATH + 1];
- get_savestate_filename(0, BaseName);
- void* screen_addr = emu_config.BottomScreenGame
- ? down_screen_addr
- : up_screen_addr;
- SCREEN_ID screen_num = emu_config.BottomScreenGame
- ? DOWN_SCREEN
- : UP_SCREEN;
-
- S9xDeinitUpdate(256, 224, TRUE);
- unsigned short screen[256*192];
- copy_screen((void*)screen, screen_addr, 0, 0, 256, 192);
-
- mdelay(100); // needed to avoid ds2_setBacklight crashing
- ds2_setBacklight((3 - DOWN_SCREEN) | (3 - screen_num));
-
- ds2_clearScreen(DOWN_SCREEN, RGB15(0, 0, 0));
- draw_message(down_screen_addr, NULL, 28, 31, 227, 165, 0);
- draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_CREATING]);
- ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD);
-
- HighFrequencyCPU();
- int flag = save_state(BaseName, screen);
- GameFrequencyCPU();
- if(flag < 0)
- {
- draw_string_vcenter(down_screen_addr, MESSAGE_BOX_TEXT_X, MESSAGE_BOX_TEXT_Y, MESSAGE_BOX_TEXT_SX, COLOR_MSSG, msg[MSG_PROGRESS_SAVED_STATE_CREATION_FAILED]);
- mdelay(500); // let the failure show
- }
-
- SavedStateCacheInvalidate ();
-
- ds2_clearScreen(DOWN_SCREEN, RGB15(0, 0, 0));
- ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD);
-
- mdelay(100); // needed to avoid ds2_setBacklight crashing
- ds2_setBacklight(3 - screen_num);
-}
-
-void ToggleFullScreen (void)
-{
- if (game_config.graphic == 0 /* full-screen ugly */
- || game_config.graphic == 4 /* full-screen smoothed */)
- game_config.graphic = 3 /* middle of the screen */;
- else
- game_config.graphic = 4 /* full-screen smoothed */;
- save_game_config_file();
-}
-
-void get_newest_savestate(char *name_buffer)
-{
- if (latest_save < 0)
- {
- name_buffer[0]= '\0';
- return;
- }
-
- get_savestate_filename(latest_save, name_buffer);
-}
-
-static void get_timestamp_string(char *buffer, u16 msg_id, u16 year, u16 mon,
- u16 day, u16 wday, u16 hour, u16 min, u16 sec, u32 msec)
-{
- char *weekday_strings[] =
- {
- "SUN", "MON", "TUE", "WED", "TUR", "FRI", "SAT"
- };
-
- sprintf(buffer, "%s %02d/%02d/%04d %02d:%02d:%02d", weekday_strings[wday],
- day, mon, year, hour, min, sec);
-}
-
-static u32 save_ss_bmp(u16 *image)
-{
- static unsigned char header[] ={ 'B', 'M', 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00,
- 0x28, 0x00, 0x00, 0x00, 0, 0x01, 0x00,
- 0x00, 192, 0x00, 0x00, 0x00, 0x01, 0x00,
- 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00};
-
- char ss_filename[MAX_FILE];
- char save_ss_path[MAX_PATH];
- struct rtc current_time;
- char rgb_data[256*192*3];
- unsigned int x,y;
- unsigned short col;
- unsigned char r,g,b;
-
- change_ext(gamepak_name, ss_filename, "_");
- ds2_getTime(&current_time);
- sprintf(save_ss_path, "%s/%s%02d%02d%02d%02d%02d.bmp", DEFAULT_SS_DIR, ss_filename,
- current_time.month, current_time.day, current_time.hours, current_time.minutes, current_time.seconds);
-
- for(y = 0; y < 192; y++)
- {
- for(x = 0; x < 256; x++)
- {
- col = image[x + y * 256];
- r = (col >> 10) & 0x1F;
- g = (col >> 5) & 0x1F;
- b = (col) & 0x1F;
-
- rgb_data[(191-y)*256*3+x*3+2] = b << 3;
- rgb_data[(191-y)*256*3+x*3+1] = g << 3;
- rgb_data[(191-y)*256*3+x*3+0] = r << 3;
- }
- }
-
- FILE *ss = fopen( save_ss_path, "wb" );
- if( ss == NULL ) return 0;
- fwrite( header, sizeof(header), 1, ss );
- fwrite( rgb_data, 1, 256*192*3, ss);
- fclose( ss );
-
- return 1;
-}
-
-u32 save_menu_ss_bmp(u16 *image)
-{
- static unsigned char header[] ={ 'B', 'M', 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00,
- 0x28, 0x00, 0x00, 0x00, 0x00, 1, 0x00, /* <00 01> == 256 */
- 0x00, 192, 0x00, 0x00, 0x00, 0x01, 0x00,
- 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00};
-
- char save_ss_path[MAX_PATH];
- struct rtc current_time;
- unsigned char rgb_data[NDS_SCREEN_WIDTH*NDS_SCREEN_HEIGHT*3];
- int x,y;
- unsigned short col;
- unsigned char r,g,b;
-
- ds2_getTime(&current_time);
- sprintf(save_ss_path, "%s/%s%02d%02d%02d%02d%02d.bmp", DEFAULT_SS_DIR, "gui_",
- current_time.month, current_time.day,
- current_time.hours, current_time.minutes, current_time.seconds);
-
- for(y = 0; y < NDS_SCREEN_HEIGHT; y++)
- {
- for(x = 0; x < NDS_SCREEN_WIDTH; x++)
- {
- col = image[y * NDS_SCREEN_WIDTH + x];
- r = (col >> 10) & 0x1F;
- g = (col >> 5) & 0x1F;
- b = (col) & 0x1F;
-
- rgb_data[(NDS_SCREEN_HEIGHT-y-1)*NDS_SCREEN_WIDTH*3+x*3+2] = b << 3;
- rgb_data[(NDS_SCREEN_HEIGHT-y-1)*NDS_SCREEN_WIDTH*3+x*3+1] = g << 3;
- rgb_data[(NDS_SCREEN_HEIGHT-y-1)*NDS_SCREEN_WIDTH*3+x*3+0] = r << 3;
- }
- }
-
- FILE *ss = fopen( save_ss_path, "wb" );
- if( ss == NULL ) return 0;
- fwrite( header, sizeof(header), 1, ss );
- fwrite( rgb_data, 1, sizeof(rgb_data), ss);
- fclose( ss );
-
- return 1;
-}
-
-void quit(void)
-{
-/*
- u32 reg_ra;
-
- __asm__ __volatile__("or %0, $0, $ra"
- : "=r" (reg_ra)
- :);
-
- dbg_printf("return address= %08x\n", reg_ra);
-*/
-
-#ifdef USE_DEBUG
- fclose(g_dbg_file);
-#endif
-
- ds2_plug_exit();
- while(1);
-}
-
-u32 file_length(FILE* file)
-{
- u32 pos, size;
- pos= ftell(file);
- fseek(file, 0, SEEK_END);
- size= ftell(file);
- fseek(file, pos, SEEK_SET);
-
- return size;
-}
-
-/*
-* GUI Initialize
-*/
-static bool Get_Args(char *file, char **filebuf){
- FILE* dat = fat_fopen(file, "rb");
- if(dat){
- int i = 0;
- while(!fat_feof (dat)){
- fat_fgets(filebuf[i], 512, dat);
- int len = strlen(filebuf[i]);
- if(filebuf[i][len - 1] == '\n')
- filebuf[i][len - 1] = '\0';
- i++;
- }
-
- fat_fclose(dat);
- fat_remove(file);
- return i;
- }
- return 0;
-}
-
-int CheckLoad_Arg(){
- argv[0][0] = '\0'; // Initialise the first byte to be a NULL in case
- argv[1][0] = '\0'; // there are no arguments to avoid uninit. memory
- char *argarray[2];
- argarray[0] = argv[0];
- argarray[1] = argv[1];
-
- if(!Get_Args("/plgargs.dat", argarray))
- return 0;
-
- fat_remove("plgargs.dat");
- return 1;
-}
-
-void gui_init(u32 lang_id)
-{
- int flag;
-
- HighFrequencyCPU(); // Crank it up. When the menu starts, -> 0.
-
- // Start with no saved state existing, as no game is loaded yet.
- int i;
- for (i = 0; i < SAVE_STATE_SLOT_NUM; i++)
- {
- SavedStateExistenceCached [i] = TRUE;
- SavedStateExistenceCached [i] = FALSE;
- }
-
- //Find the "CATSFC" system directory
- DIR *current_dir;
-
- if(CheckLoad_Arg()){
- //copy new folder location
- strcpy(main_path, "fat:");
- strcat(main_path, argv[0]);
- //strip off the binary name
- char *endStr = strrchr(main_path, '/');
- *endStr = '\0';
-
- //do a check to make sure the folder is a valid CATSFC folder
- char tempPath[MAX_PATH];
- strcpy(tempPath, main_path);
- strcat(tempPath, "/system/gui");
- DIR *testDir = opendir(tempPath);
- if(!testDir)
- //not a valid CATSFC install
- strcpy(main_path, "fat:/CATSFC");
- else //test was successful, do nothing
- closedir(testDir);
- }
- else
- strcpy(main_path, "fat:/CATSFC");
-
- current_dir = opendir(main_path);
- if(current_dir)
- closedir(current_dir);
- else
- {
- strcpy(main_path, "fat:/_SYSTEM/PLUGINS/CATSFC");
- current_dir = opendir(main_path);
- if(current_dir)
- closedir(current_dir);
- else
- {
- strcpy(main_path, "fat:");
- if(search_dir("CATSFC", main_path) == 0)
- {
- printf("Found CATSFC directory\nDossier CATSFC trouve\n\n%s\n", main_path);
- }
- else
- {
- err_msg(DOWN_SCREEN, "/CATSFC: Directory missing\nPress any key to return to\nthe menu\n\n/CATSFC: Dossier manquant\nAppuyer sur une touche pour\nretourner au menu");
- goto gui_init_err;
- }
- }
- }
-
- show_log(down_screen_addr);
- ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD);
-
- flag = icon_init(lang_id);
- if(0 != flag)
- {
- err_msg(DOWN_SCREEN, "Some icons are missing\nLoad them onto your card\nPress any key to return to\nthe menu\n\nDes icones sont manquantes\nChargez-les sur votre carte\nAppuyer sur une touche pour\nretourner au menu");
- goto gui_init_err;
- }
-
- flag = color_init();
- if(0 != flag)
- {
- char message[512];
- sprintf(message, "SYSTEM/GUI/uicolors.txt\nis missing\nPress any key to return to\nthe menu\n\nSYSTEM/GUI/uicolors.txt\nest manquant\nAppuyer sur une touche pour\nretourner au menu");
- err_msg(DOWN_SCREEN, message);
- goto gui_init_err;
- }
-
- flag = load_font();
- if(0 != flag)
- {
- char message[512];
- sprintf(message, "Font library initialisation\nerror (%d)\nPress any key to return to\nthe menu\n\nErreur d'initalisation de la\npolice de caracteres (%d)\nAppuyer sur une touche pour\nretourner au menu", flag, flag);
- err_msg(DOWN_SCREEN, message);
- goto gui_init_err;
- }
-
- load_emu_config_file();
- lang_id = emu_config.language;
-
- flag = load_language_msg(LANGUAGE_PACK, lang_id);
- if(0 != flag)
- {
- char message[512];
- sprintf(message, "Language pack initialisation\nerror (%d)\nPress any key to return to\nthe menu\n\nErreur d'initalisation du\npack de langue (%d)\nAppuyer sur une touche pour\nretourner au menu", flag, flag);
- err_msg(DOWN_SCREEN, message);
- goto gui_init_err;
- }
-
- initial_path_config();
-
- return;
-
-gui_init_err:
- ds2_flipScreen(DOWN_SCREEN, DOWN_SCREEN_UPDATE_METHOD);
- wait_Anykey_press(0);
- quit();
-}
diff --git a/source/nds/gui.h b/source/nds/gui.h
deleted file mode 100644
index 92dc81d..0000000
--- a/source/nds/gui.h
+++ /dev/null
@@ -1,202 +0,0 @@
-/* gui.h
- *
- * Copyright (C) 2010 dking <dking024@gmail.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public Licens e as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __GUI_H__
-#define __GUI_H__
-
-//#include "ds2_types.h"
-//#include "fs_api.h"
-#include "gcheat.h"
-
-#define UP_SCREEN_UPDATE_METHOD 0
-#define DOWN_SCREEN_UPDATE_METHOD 2
-
-// For general option text
-#define OPTION_TEXT_X 10
-#define OPTION_TEXT_SX 236
-
-// For option rows
-#define GUI_ROW1_Y 36
-#define GUI_ROW_SY 19
-// The following offset is added to the row's Y coordinate to provide
-// the Y coordinate for its text.
-#define TEXT_OFFSET_Y 2
-// The following offset is added to the row's Y coordinate to provide
-// the Y coordinate for its ICON_SUBSELA (sub-screen selection type A).
-#define SUBSELA_OFFSET_Y -2
-#define SUBSELA_X ((NDS_SCREEN_WIDTH - ICON_SUBSELA.x) / 2)
-
-// For message boxes
-#define MESSAGE_BOX_TEXT_X ((NDS_SCREEN_WIDTH - ICON_MSG.x) / 2 + 3)
-#define MESSAGE_BOX_TEXT_SX (ICON_MSG.x - 6)
-// Y is brought down by the "window title" that's part of ICON_MSG
-#define MESSAGE_BOX_TEXT_Y ((NDS_SCREEN_HEIGHT - ICON_MSG.y) / 2 + 24)
-
-// For cheats [ NUM. DESC . . . . . +/- ]
-#define CHEAT_NUMBER_X 10
-#define CHEAT_DESC_X 34
-#define CHEAT_DESC_SX 197
-#define CHEAT_ACTIVE_X 241
-
-// For the file selector
-#define FILE_SELECTOR_ICON_X 10
-#define FILE_SELECTOR_ICON_Y (TEXT_OFFSET_Y - 1)
-#define FILE_SELECTOR_NAME_X 32
-#define FILE_SELECTOR_NAME_SX 214
-
-// Back button
-#define BACK_BUTTON_X 229
-#define BACK_BUTTON_Y 10
-// Title icon
-#define TITLE_ICON_X 12
-#define TITLE_ICON_Y 9
-
-#define MAX_GAMEPAD_MAP 16
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-//
-struct _EMU_CONFIG
-{
- u32 language;
- char rom_file[256];
- char rom_path[256];
- char latest_file[5][512];
- u32 HotkeyReturnToMenu;
- u32 HotkeyTemporaryFastForward;
- u32 HotkeyToggleSound;
- u32 HotkeyQuickLoadState;
- u32 HotkeyQuickSaveState;
- u32 HotkeyToggleFullScreen;
- u32 BottomScreenGame;
- u32 Reserved[57];
-};
-
-struct _GAME_CONFIG
-{
- u32 clock_speed_number;
- u32 Reserved0;
- u32 frameskip_value;
- u32 graphic;
- u32 enable_audio;
- u32 Reserved1;
- u32 backward;
- u32 backward_time;
- u32 HotkeyReturnToMenu;
- u32 HotkeyTemporaryFastForward;
- u32 HotkeyToggleSound;
- u32 SoundSync;
- /*
- * PreviouslyUsed_20130206_1 was for a second meaning of
- * frameskip_value that is now dropped.
- * THIS VALUE IS NOT GUARANTEED TO BE RESERVED AND SET TO 0.
- */
- u32 PreviouslyUsed_20130206_1;
- /*
- * PreviouslyUsed_20130206_2 was for a second meaning of
- * clock_speed_number that is now dropped.
- * THIS VALUE IS NOT GUARANTEED TO BE RESERVED AND SET TO 0.
- */
- u32 PreviouslyUsed_20130206_2;
- u32 RetroSound;
- u32 HotkeyQuickLoadState;
- u32 HotkeyQuickSaveState;
- u32 HotkeyToggleFullScreen;
- u32 Reserved2[38];
-};
-
-typedef enum
-{
- CURSOR_NONE = 0,
- CURSOR_UP,
- CURSOR_DOWN,
- CURSOR_LEFT,
- CURSOR_RIGHT,
- CURSOR_SELECT,
- CURSOR_BACK,
- CURSOR_EXIT,
- CURSOR_RTRIGGER,
- CURSOR_LTRIGGER,
- CURSOR_KEY_SELECT,
- CURSOR_TOUCH
-} gui_action_type;
-
-typedef enum
-{
- BUTTON_ID_A = 0x01,
- BUTTON_ID_B = 0x02,
- BUTTON_ID_SELECT = 0x04,
- BUTTON_ID_START = 0x08,
- BUTTON_ID_RIGHT = 0x10,
- BUTTON_ID_LEFT = 0x20,
- BUTTON_ID_UP = 0x40,
- BUTTON_ID_DOWN = 0x80,
- BUTTON_ID_R = 0x100,
- BUTTON_ID_L = 0x200,
- BUTTON_ID_X = 0x400,
- BUTTON_ID_Y = 0x800,
- BUTTON_ID_TOUCH = 0x1000,
- BUTTON_ID_LID = 0x2000,
- BUTTON_ID_FA = 0x4000,
- BUTTON_ID_FB = 0x8000,
- BUTTON_ID_NONE = 0
-} input_buttons_id_type;
-
-extern char main_path[MAX_PATH];
-extern char rom_path[MAX_PATH];
-
-extern u32 game_enable_audio;
-extern u32 game_fast_forward;
-extern u32 temporary_fast_forward;
-
-/******************************************************************************
- ******************************************************************************/
-extern char g_default_rom_dir[MAX_PATH];
-extern char DEFAULT_RTS_DIR[MAX_PATH];
-extern char DEFAULT_CFG_DIR[MAX_PATH];
-extern char DEFAULT_SS_DIR[MAX_PATH];
-extern char DEFAULT_CHEAT_DIR[MAX_PATH];
-
-typedef struct _EMU_CONFIG EMU_CONFIG;
-typedef struct _GAME_CONFIG GAME_CONFIG;
-
-extern EMU_CONFIG emu_config;
-extern GAME_CONFIG game_config;
-
-/******************************************************************************
- ******************************************************************************/
-extern void gui_init(u32 lang_id);
-extern u32 menu(u16 *original_screen, bool8 FirstInvocation);
-extern void LowFrequencyCPU();
-extern void HighFrequencyCPU();
-extern void GameFrequencyCPU();
-
-extern void QuickSaveState();
-extern void QuickLoadState();
-extern void ToggleFullScreen();
-
-extern int load_language_msg(char *filename, u32 language);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //__GUI_H__
diff --git a/source/nds/message.h b/source/nds/message.h
deleted file mode 100644
index f2977e4..0000000
--- a/source/nds/message.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/* message.h
- *
- * Copyright (C) 2010 dking <dking024@gmail.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public Licens e as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef __MESSAGE_H__
-#define __MESSAGE_H__
-
-enum MSG
-{
- MSG_MAIN_MENU_NEW_GAME,
- MSG_MAIN_MENU_RETURN_TO_GAME,
- MSG_MAIN_MENU_RESET_GAME,
- MSG_MAIN_MENU_VIDEO_AUDIO,
- MSG_MAIN_MENU_SAVED_STATES,
- MSG_MAIN_MENU_CHEATS,
- MSG_MAIN_MENU_TOOLS,
- MSG_MAIN_MENU_OPTIONS,
- MSG_MAIN_MENU_EXIT,
-
- MSG_FILE_MENU_LOADING_LIST,
- MSG_FILE_MENU_SORTING_LIST,
-
- FMT_VIDEO_AUDIO_FLUIDITY_PREFERENCE,
- MSG_VIDEO_AUDIO_FLUIDITY_PREFER_VIDEO,
- MSG_VIDEO_AUDIO_FLUIDITY_PREFER_AUDIO,
- FMT_VIDEO_ASPECT_RATIO,
- FMT_VIDEO_FAST_FORWARD,
- FMT_VIDEO_FRAME_SKIPPING,
- FMT_VIDEO_GAME_SCREEN,
- FMT_AUDIO_SOUND,
- FMT_AUDIO_RETRO_SOUND,
- FMT_SAVED_STATE_CREATE,
- FMT_SAVED_STATE_LOAD,
- MSG_SAVED_STATE_DELETE_GENERAL,
- FMT_CHEAT_PAGE,
- MSG_CHEAT_LOAD_FROM_FILE,
- MSG_TOOLS_SCREENSHOT_GENERAL,
- MSG_TOOLS_GLOBAL_HOTKEY_GENERAL,
- MSG_TOOLS_GAME_HOTKEY_GENERAL,
- FMT_OPTIONS_LANGUAGE,
- FMT_OPTIONS_CPU_FREQUENCY,
- MSG_OPTIONS_CPU_FREQUENCY_0,
- MSG_OPTIONS_CPU_FREQUENCY_1,
- MSG_OPTIONS_CPU_FREQUENCY_2,
- MSG_OPTIONS_CPU_FREQUENCY_3,
- MSG_OPTIONS_CPU_FREQUENCY_4,
- MSG_OPTIONS_CPU_FREQUENCY_5,
- MSG_OPTIONS_CARD_CAPACITY /* unused if !defined(ENABLE_FREE_SPACE) */,
- MSG_OPTIONS_RESET,
- MSG_OPTIONS_VERSION,
- MSG_SCREENSHOT_CREATE,
- MSG_SCREENSHOT_BROWSE,
- MSG_HOTKEY_MAIN_MENU,
- MSG_HOTKEY_TEMPORARY_FAST_FORWARD,
- MSG_HOTKEY_SOUND_TOGGLE,
- MSG_HOTKEY_QUICK_LOAD_STATE,
- MSG_HOTKEY_QUICK_SAVE_STATE,
- MSG_HOTKEY_FULL_SCREEN_TOGGLE,
- MSG_PROGRESS_HOTKEY_WAITING_FOR_KEYS,
- MSG_HOTKEY_DELETE_WITH_A,
- MSG_HOTKEY_CANCEL_WITH_B,
- MSG_LOAD_GAME_RECENTLY_PLAYED,
- MSG_LOAD_GAME_FROM_CARD,
- MSG_LOAD_GAME_MENU_TITLE,
-
- MSG_VIDEO_ASPECT_RATIO_0,
- MSG_VIDEO_ASPECT_RATIO_1,
- MSG_VIDEO_ASPECT_RATIO_2,
- MSG_VIDEO_ASPECT_RATIO_3,
- MSG_VIDEO_ASPECT_RATIO_4,
-
- MSG_VIDEO_FRAME_SKIPPING_AUTOMATIC,
- MSG_VIDEO_FRAME_SKIPPING_0,
- MSG_VIDEO_FRAME_SKIPPING_1,
- MSG_VIDEO_FRAME_SKIPPING_2,
- MSG_VIDEO_FRAME_SKIPPING_3,
- MSG_VIDEO_FRAME_SKIPPING_4,
- MSG_VIDEO_FRAME_SKIPPING_5,
- MSG_VIDEO_FRAME_SKIPPING_6,
- MSG_VIDEO_FRAME_SKIPPING_7,
- MSG_VIDEO_FRAME_SKIPPING_8,
- MSG_VIDEO_FRAME_SKIPPING_9,
- MSG_VIDEO_FRAME_SKIPPING_10,
-
- MSG_VIDEO_GAME_SCREEN_TOP,
- MSG_VIDEO_GAME_SCREEN_BOTTOM,
-
- MSG_GENERAL_OFF,
- MSG_GENERAL_ON,
-
- MSG_GENERAL_CONFIRM_WITH_A,
- MSG_GENERAL_CANCEL_WITH_B,
-
- MSG_AUDIO_ENABLED,
- MSG_AUDIO_MUTED,
-
- MSG_TOP_SCREEN_NO_GAME_LOADED,
- MSG_CHEAT_ELEMENT_NOT_LOADED,
-
- MSG_SAVESTATE_FULL,
- MSG_PROGRESS_SAVED_STATE_CREATING,
- MSG_PROGRESS_SAVED_STATE_CREATION_FAILED,
- MSG_PROGRESS_SAVED_STATE_CREATION_SUCCEEDED,
- MSG_TOP_SCREEN_NO_SAVED_STATE_IN_SLOT,
- MSG_PROGRESS_SAVED_STATE_CORRUPTED,
- MSG_PROGRESS_SAVED_STATE_LOADING,
- MSG_PROGRESS_SAVED_STATE_LOAD_FAILED,
- MSG_PROGRESS_SAVED_STATE_LOAD_SUCCEEDED,
-
- MSG_SAVED_STATE_DELETE_ALL,
- FMT_SAVED_STATE_DELETE_ONE,
-
- MSG_DIALOG_SAVED_STATE_DELETE_ALL,
- FMT_DIALOG_SAVED_STATE_DELETE_ONE,
- MSG_PROGRESS_SAVED_STATE_ALREADY_EMPTY,
-
- MSG_PROGRESS_SCREENSHOT_CREATING,
- MSG_PROGRESS_SCREENSHOT_CREATION_SUCCEEDED,
- MSG_PROGRESS_SCREENSHOT_CREATION_FAILED,
-
- MSG_NO_SLIDE,
- MSG_PLAYING_SLIDE,
- MSG_PAUSE_SLIDE,
- MSG_SCREENSHOT_SLIDESHOW_KEYS,
-
- MSG_PROGRESS_LOADING_GAME,
-
- MSG_EMULATOR_NAME,
- MSG_WORD_EMULATOR_VERSION,
-
- MSG_DIALOG_RESET,
- MSG_PROGRESS_RESETTING,
-
- MSG_END
-};
-
-enum LANGUAGE {
- ENGLISH,
- CHINESE_SIMPLIFIED,
- FRENCH,
- GERMAN,
- DUTCH,
- SPANISH,
- ITALIAN,
- PORTUGUESE_BRAZILIAN
-};
-
-extern char* lang[8]; // Allocated in gui.c, needs to match the languages ^
-
-char *msg[MSG_END+1];
-char msg_data[32 * 1024];
-
-#endif //__MESSAGE_H__
-
diff --git a/source/unzip/explode.c b/source/unzip/explode.c
deleted file mode 100644
index 6558a7b..0000000
--- a/source/unzip/explode.c
+++ /dev/null
@@ -1,1120 +0,0 @@
-/* explode.c -- Not copyrighted 1992 by Mark Adler
- version c7, 27 June 1992 */
-
-
-/* You can do whatever you like with this source file, though I would
- prefer that if you modify it and redistribute it that you include
- comments to that effect with your name and the date. Thank you.
-
- History:
- vers date who what
- ---- --------- -------------- ------------------------------------
- c1 30 Mar 92 M. Adler explode that uses huft_build from inflate
- (this gives over a 70% speed improvement
- over the original unimplode.c, which
- decoded a bit at a time)
- c2 4 Apr 92 M. Adler fixed bug for file sizes a multiple of 32k.
- c3 10 Apr 92 M. Adler added a little memory tracking if DEBUG
- c4 11 Apr 92 M. Adler added NOMEMCPY do kill use of memcpy()
- c5 21 Apr 92 M. Adler added the WSIZE #define to allow reducing
- the 32K window size for specialized
- applications.
- c6 31 May 92 M. Adler added typecasts to eliminate some warnings
- c7 27 Jun 92 G. Roelofs added more typecasts
- */
-
-
-/*
- Explode imploded (PKZIP method 6 compressed) data. This compression
- method searches for as much of the current string of bytes (up to a length
- of ~320) in the previous 4K or 8K bytes. If it doesn't find any matches
- (of at least length 2 or 3), it codes the next byte. Otherwise, it codes
- the length of the matched string and its distance backwards from the
- current position. Single bytes ("literals") are preceded by a one (a
- single bit) and are either uncoded (the eight bits go directly into the
- compressed stream for a total of nine bits) or Huffman coded with a
- supplied literal code tree. If literals are coded, then the minimum match
- length is three, otherwise it is two.
-
- There are therefore four kinds of imploded streams: 8K search with coded
- literals (min match = 3), 4K search with coded literals (min match = 3),
- 8K with uncoded literals (min match = 2), and 4K with uncoded literals
- (min match = 2). The kind of stream is identified in two bits of a
- general purpose bit flag that is outside of the compressed stream.
-
- Distance-length pairs are always coded. Distance-length pairs for matched
- strings are preceded by a zero bit (to distinguish them from literals) and
- are always coded. The distance comes first and is either the low six (4K)
- or low seven (8K) bits of the distance (uncoded), followed by the high six
- bits of the distance coded. Then the length is six bits coded (0..63 +
- min match length), and if the maximum such length is coded, then it's
- followed by another eight bits (uncoded) to be added to the coded length.
- This gives a match length range of 2..320 or 3..321 bytes.
-
- The literal, length, and distance codes are all represented in a slightly
- compressed form themselves. What is sent are the lengths of the codes for
- each value, which is sufficient to construct the codes. Each byte of the
- code representation is the code length (the low four bits representing
- 1..16), and the number of values sequentially with that length (the high
- four bits also representing 1..16). There are 256 literal code values (if
- literals are coded), 64 length code values, and 64 distance code values,
- in that order at the beginning of the compressed stream. Each set of code
- values is preceded (redundantly) with a byte indicating how many bytes are
- in the code description that follows, in the range 1..256.
-
- The codes themselves are decoded using tables made by huft_build() from
- the bit lengths. That routine and its comments are in the inflate.c
- module.
- */
-
-#include "unz.h" /* this must supply the slide[] (byte) array */
-#include "unzipP.h"
-//#include <stdlib.h>
-#include "ds2_malloc.h"
-
-#ifndef WSIZE
-# define WSIZE 0x8000 /* window size--must be a power of two, and at least
- 8K for zip's implode method */
-#endif /* !WSIZE */
-
-
-struct huft {
- byte e; /* number of extra bits or operation */
- byte b; /* number of bits in this code or subcode */
- union {
- UWORD n; /* literal, length base, or distance base */
- struct huft *t; /* pointer to next level of table */
- } v;
-};
-
-/* Function prototypes */
-/* routines from inflate.c */
-extern unsigned hufts;
-int huft_build OF((unsigned *, unsigned, unsigned, UWORD *, UWORD *,
- struct huft **, int *));
-int huft_free OF((struct huft *));
-void flush OF((unsigned));
-
-/* routines here */
-int get_tree OF((unsigned *, unsigned));
-int explode_lit8 OF((struct huft *, struct huft *, struct huft *,
- int, int, int));
-int explode_lit4 OF((struct huft *, struct huft *, struct huft *,
- int, int, int));
-int explode_nolit8 OF((struct huft *, struct huft *, int, int));
-int explode_nolit4 OF((struct huft *, struct huft *, int, int));
-int explode ();
-
-extern file_in_zip_read_info_s *pfile_in_zip_read_info;
-extern unz_s *pUnzip;
-
-/* The implode algorithm uses a sliding 4K or 8K byte window on the
- uncompressed stream to find repeated byte strings. This is implemented
- here as a circular buffer. The index is updated simply by incrementing
- and then and'ing with 0x0fff (4K-1) or 0x1fff (8K-1). Here, the 32K
- buffer of inflate is used, and it works just as well to always have
- a 32K circular buffer, so the index is anded with 0x7fff. This is
- done to allow the window to also be used as the output buffer. */
-/* This must be supplied in an external module useable like "byte slide[8192];"
- or "byte *slide;", where the latter would be malloc'ed. In unzip, slide[]
- is actually a 32K area for use by inflate, which uses a 32K sliding window.
- */
-
-
-/* Tables for length and distance */
-UWORD cplen2[] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
- 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
- 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
- 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65};
-UWORD cplen3[] = {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
- 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
- 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
- 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66};
-UWORD extra[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 8};
-UWORD cpdist4[] = {1, 65, 129, 193, 257, 321, 385, 449, 513, 577, 641, 705,
- 769, 833, 897, 961, 1025, 1089, 1153, 1217, 1281, 1345, 1409, 1473,
- 1537, 1601, 1665, 1729, 1793, 1857, 1921, 1985, 2049, 2113, 2177,
- 2241, 2305, 2369, 2433, 2497, 2561, 2625, 2689, 2753, 2817, 2881,
- 2945, 3009, 3073, 3137, 3201, 3265, 3329, 3393, 3457, 3521, 3585,
- 3649, 3713, 3777, 3841, 3905, 3969, 4033};
-UWORD cpdist8[] = {1, 129, 257, 385, 513, 641, 769, 897, 1025, 1153, 1281,
- 1409, 1537, 1665, 1793, 1921, 2049, 2177, 2305, 2433, 2561, 2689,
- 2817, 2945, 3073, 3201, 3329, 3457, 3585, 3713, 3841, 3969, 4097,
- 4225, 4353, 4481, 4609, 4737, 4865, 4993, 5121, 5249, 5377, 5505,
- 5633, 5761, 5889, 6017, 6145, 6273, 6401, 6529, 6657, 6785, 6913,
- 7041, 7169, 7297, 7425, 7553, 7681, 7809, 7937, 8065};
-
-
-/* Macros for inflate() bit peeking and grabbing.
- The usage is:
-
- NEEDBITS(j)
- x = b & mask_bits[j];
- DUMPBITS(j)
-
- where NEEDBITS makes sure that b has at least j bits in it, and
- DUMPBITS removes the bits from b. The macros use the variable k
- for the number of bits in b. Normally, b and k are register
- variables for speed.
- */
-
-extern UWORD bytebuf; /* (use the one in inflate.c) */
-#define NEXTBYTE (ReadByte(&bytebuf), bytebuf)
-#define NEEDBITS(n) {while(k<(n)){b|=((ULONG)NEXTBYTE)<<k;k+=8;}}
-#define DUMPBITS(n) {b>>=(n);k-=(n);}
-
-/* HERE */
-UWORD mask_bits[] = {
- 0x0000,
- 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
- 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
-};
-union work area; /* see unzip.h for the definition of work */
-ULONG crc32val;
-ush bytebuf;
-ULONG bitbuf;
-int bits_left;
-boolean zipeof;
-
-int get_tree(l, n)
-unsigned *l; /* bit lengths */
-unsigned n; /* number expected */
-/* Get the bit lengths for a code representation from the compressed
- stream. If get_tree() returns 4, then there is an error in the data.
- Otherwise zero is returned. */
-{
- unsigned i; /* bytes remaining in list */
- unsigned k; /* lengths entered */
- unsigned j; /* number of codes */
- unsigned b; /* bit length for those codes */
-
-
- /* get bit lengths */
- ReadByte(&bytebuf);
- i = bytebuf + 1; /* length/count pairs to read */
- k = 0; /* next code */
- do {
- ReadByte(&bytebuf);
- b = ((j = bytebuf) & 0xf) + 1; /* bits in code (1..16) */
- j = ((j & 0xf0) >> 4) + 1; /* codes with those bits (1..16) */
- if (k + j > n)
- return 4; /* don't overflow l[] */
- do {
- l[k++] = b;
- } while (--j);
- } while (--i);
- return k != n ? 4 : 0; /* should have read n of them */
-}
-
-
-
-int explode_lit8(tb, tl, td, bb, bl, bd)
-struct huft *tb, *tl, *td; /* literal, length, and distance tables */
-int bb, bl, bd; /* number of bits decoded by those */
-/* Decompress the imploded data using coded literals and an 8K sliding
- window. */
-{
- longint s; /* bytes to decompress */
- register unsigned e; /* table entry flag/number of extra bits */
- unsigned n, d; /* length and index for copy */
- unsigned w; /* current window position */
- struct huft *t; /* pointer to table entry */
- unsigned mb, ml, md; /* masks for bb, bl, and bd bits */
- register ULONG b; /* bit buffer */
- register unsigned k; /* number of bits in bit buffer */
- unsigned u; /* true if unflushed */
-
-
- /* explode the coded data */
- b = k = w = 0; /* initialize bit buffer, window */
- u = 1; /* buffer unflushed */
- mb = mask_bits[bb]; /* precompute masks for speed */
- ml = mask_bits[bl];
- md = mask_bits[bd];
- s = pUnzip->pfile_in_zip_read->rest_read_uncompressed;
- while (s > 0) /* do until ucsize bytes uncompressed */
- {
- NEEDBITS(1)
- if (b & 1) /* then literal--decode it */
- {
- DUMPBITS(1)
- s--;
- NEEDBITS((unsigned)bb) /* get coded literal */
- if ((e = (t = tb + ((~(unsigned)b) & mb))->e) > 16)
- do {
- if (e == 99)
- return 1;
- DUMPBITS(t->b)
- e -= 16;
- NEEDBITS(e)
- } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16);
- DUMPBITS(t->b)
- slide[w++] = (byte)t->v.n;
- if (w == WSIZE)
- {
- flush(w);
- w = u = 0;
- }
- }
- else /* else distance/length */
- {
- DUMPBITS(1)
- NEEDBITS(7) /* get distance low bits */
- d = (unsigned)b & 0x7f;
- DUMPBITS(7)
- NEEDBITS((unsigned)bd) /* get coded distance high bits */
- if ((e = (t = td + ((~(unsigned)b) & md))->e) > 16)
- do {
- if (e == 99)
- return 1;
- DUMPBITS(t->b)
- e -= 16;
- NEEDBITS(e)
- } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16);
- DUMPBITS(t->b)
- d = w - d - t->v.n; /* construct offset */
- NEEDBITS((unsigned)bl) /* get coded length */
- if ((e = (t = tl + ((~(unsigned)b) & ml))->e) > 16)
- do {
- if (e == 99)
- return 1;
- DUMPBITS(t->b)
- e -= 16;
- NEEDBITS(e)
- } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16);
- DUMPBITS(t->b)
- n = t->v.n;
- if (e) /* get length extra bits */
- {
- NEEDBITS(8)
- n += (unsigned)b & 0xff;
- DUMPBITS(8)
- }
-
- /* do the copy */
- s -= n;
- do {
- n -= (e = (e = WSIZE - ((d &= WSIZE-1) > w ? d : w)) > n ? n : e);
- if (u && w <= d)
- {
- memset(slide + w, 0, e);
- w += e;
- d += e;
- }
- else
-#ifndef NOMEMCPY
- if (w - d >= e) /* (this test assumes unsigned comparison) */
- {
- memcpy(slide + w, slide + d, e);
- w += e;
- d += e;
- }
- else /* do it slow to avoid memcpy() overlap */
-#endif /* !NOMEMCPY */
- do {
- slide[w++] = slide[d++];
- } while (--e);
- if (w == WSIZE)
- {
- flush(w);
- w = u = 0;
- }
- } while (n);
- }
- }
-
- /* flush out slide */
- flush(w);
- return pfile_in_zip_read_info->rest_read_compressed ? 5 : 0; /* should have read csize bytes */
-}
-
-
-
-int explode_lit4(tb, tl, td, bb, bl, bd)
-struct huft *tb, *tl, *td; /* literal, length, and distance tables */
-int bb, bl, bd; /* number of bits decoded by those */
-/* Decompress the imploded data using coded literals and a 4K sliding
- window. */
-{
- longint s; /* bytes to decompress */
- register unsigned e; /* table entry flag/number of extra bits */
- unsigned n, d; /* length and index for copy */
- unsigned w; /* current window position */
- struct huft *t; /* pointer to table entry */
- unsigned mb, ml, md; /* masks for bb, bl, and bd bits */
- register ULONG b; /* bit buffer */
- register unsigned k; /* number of bits in bit buffer */
- unsigned u; /* true if unflushed */
-
-
- /* explode the coded data */
- b = k = w = 0; /* initialize bit buffer, window */
- u = 1; /* buffer unflushed */
- mb = mask_bits[bb]; /* precompute masks for speed */
- ml = mask_bits[bl];
- md = mask_bits[bd];
- s = pUnzip->pfile_in_zip_read->rest_read_uncompressed;
- while (s > 0) /* do until ucsize bytes uncompressed */
- {
- NEEDBITS(1)
- if (b & 1) /* then literal--decode it */
- {
- DUMPBITS(1)
- s--;
- NEEDBITS((unsigned)bb) /* get coded literal */
- if ((e = (t = tb + ((~(unsigned)b) & mb))->e) > 16)
- do {
- if (e == 99)
- return 1;
- DUMPBITS(t->b)
- e -= 16;
- NEEDBITS(e)
- } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16);
- DUMPBITS(t->b)
- slide[w++] = (byte)t->v.n;
- if (w == WSIZE)
- {
- flush(w);
- w = u = 0;
- }
- }
- else /* else distance/length */
- {
- DUMPBITS(1)
- NEEDBITS(6) /* get distance low bits */
- d = (unsigned)b & 0x3f;
- DUMPBITS(6)
- NEEDBITS((unsigned)bd) /* get coded distance high bits */
- if ((e = (t = td + ((~(unsigned)b) & md))->e) > 16)
- do {
- if (e == 99)
- return 1;
- DUMPBITS(t->b)
- e -= 16;
- NEEDBITS(e)
- } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16);
- DUMPBITS(t->b)
- d = w - d - t->v.n; /* construct offset */
- NEEDBITS((unsigned)bl) /* get coded length */
- if ((e = (t = tl + ((~(unsigned)b) & ml))->e) > 16)
- do {
- if (e == 99)
- return 1;
- DUMPBITS(t->b)
- e -= 16;
- NEEDBITS(e)
- } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16);
- DUMPBITS(t->b)
- n = t->v.n;
- if (e) /* get length extra bits */
- {
- NEEDBITS(8)
- n += (unsigned)b & 0xff;
- DUMPBITS(8)
- }
-
- /* do the copy */
- s -= n;
- do {
- n -= (e = (e = WSIZE - ((d &= WSIZE-1) > w ? d : w)) > n ? n : e);
- if (u && w <= d)
- {
- memset(slide + w, 0, e);
- w += e;
- d += e;
- }
- else
-#ifndef NOMEMCPY
- if (w - d >= e) /* (this test assumes unsigned comparison) */
- {
- memcpy(slide + w, slide + d, e);
- w += e;
- d += e;
- }
- else /* do it slow to avoid memcpy() overlap */
-#endif /* !NOMEMCPY */
- do {
- slide[w++] = slide[d++];
- } while (--e);
- if (w == WSIZE)
- {
- flush(w);
- w = u = 0;
- }
- } while (n);
- }
- }
-
- /* flush out slide */
- flush(w);
- return pfile_in_zip_read_info->rest_read_compressed ? 5 : 0; /* should have read csize bytes */
-}
-
-
-
-int explode_nolit8(tl, td, bl, bd)
-struct huft *tl, *td; /* length and distance decoder tables */
-int bl, bd; /* number of bits decoded by tl[] and td[] */
-/* Decompress the imploded data using uncoded literals and an 8K sliding
- window. */
-{
- longint s; /* bytes to decompress */
- register unsigned e; /* table entry flag/number of extra bits */
- unsigned n, d; /* length and index for copy */
- unsigned w; /* current window position */
- struct huft *t; /* pointer to table entry */
- unsigned ml, md; /* masks for bl and bd bits */
- register ULONG b; /* bit buffer */
- register unsigned k; /* number of bits in bit buffer */
- unsigned u; /* true if unflushed */
-
-
- /* explode the coded data */
- b = k = w = 0; /* initialize bit buffer, window */
- u = 1; /* buffer unflushed */
- ml = mask_bits[bl]; /* precompute masks for speed */
- md = mask_bits[bd];
- s = pUnzip->pfile_in_zip_read->rest_read_uncompressed;
- while (s > 0) /* do until ucsize bytes uncompressed */
- {
- NEEDBITS(1)
- if (b & 1) /* then literal--get eight bits */
- {
- DUMPBITS(1)
- s--;
- NEEDBITS(8)
- slide[w++] = (byte)b;
- if (w == WSIZE)
- {
- flush(w);
- w = u = 0;
- }
- DUMPBITS(8)
- }
- else /* else distance/length */
- {
- DUMPBITS(1)
- NEEDBITS(7) /* get distance low bits */
- d = (unsigned)b & 0x7f;
- DUMPBITS(7)
- NEEDBITS((unsigned)bd) /* get coded distance high bits */
- if ((e = (t = td + ((~(unsigned)b) & md))->e) > 16)
- do {
- if (e == 99)
- return 1;
- DUMPBITS(t->b)
- e -= 16;
- NEEDBITS(e)
- } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16);
- DUMPBITS(t->b)
- d = w - d - t->v.n; /* construct offset */
- NEEDBITS((unsigned)bl) /* get coded length */
- if ((e = (t = tl + ((~(unsigned)b) & ml))->e) > 16)
- do {
- if (e == 99)
- return 1;
- DUMPBITS(t->b)
- e -= 16;
- NEEDBITS(e)
- } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16);
- DUMPBITS(t->b)
- n = t->v.n;
- if (e) /* get length extra bits */
- {
- NEEDBITS(8)
- n += (unsigned)b & 0xff;
- DUMPBITS(8)
- }
-
- /* do the copy */
- s -= n;
- do {
- n -= (e = (e = WSIZE - ((d &= WSIZE-1) > w ? d : w)) > n ? n : e);
- if (u && w <= d)
- {
- memset(slide + w, 0, e);
- w += e;
- d += e;
- }
- else
-#ifndef NOMEMCPY
- if (w - d >= e) /* (this test assumes unsigned comparison) */
- {
- memcpy(slide + w, slide + d, e);
- w += e;
- d += e;
- }
- else /* do it slow to avoid memcpy() overlap */
-#endif /* !NOMEMCPY */
- do {
- slide[w++] = slide[d++];
- } while (--e);
- if (w == WSIZE)
- {
- flush(w);
- w = u = 0;
- }
- } while (n);
- }
- }
-
- /* flush out slide */
- flush(w);
- return pfile_in_zip_read_info->rest_read_compressed ? 5 : 0; /* should have read csize bytes */
-}
-
-
-
-int explode_nolit4(tl, td, bl, bd)
-struct huft *tl, *td; /* length and distance decoder tables */
-int bl, bd; /* number of bits decoded by tl[] and td[] */
-/* Decompress the imploded data using uncoded literals and a 4K sliding
- window. */
-{
- longint s; /* bytes to decompress */
- register unsigned e; /* table entry flag/number of extra bits */
- unsigned n, d; /* length and index for copy */
- unsigned w; /* current window position */
- struct huft *t; /* pointer to table entry */
- unsigned ml, md; /* masks for bl and bd bits */
- register ULONG b; /* bit buffer */
- register unsigned k; /* number of bits in bit buffer */
- unsigned u; /* true if unflushed */
-
-
- /* explode the coded data */
- b = k = w = 0; /* initialize bit buffer, window */
- u = 1; /* buffer unflushed */
- ml = mask_bits[bl]; /* precompute masks for speed */
- md = mask_bits[bd];
- s = pUnzip->pfile_in_zip_read->rest_read_uncompressed;
- while (s > 0) /* do until ucsize bytes uncompressed */
- {
- NEEDBITS(1)
- if (b & 1) /* then literal--get eight bits */
- {
- DUMPBITS(1)
- s--;
- NEEDBITS(8)
- slide[w++] = (byte)b;
- if (w == WSIZE)
- {
- flush(w);
- w = u = 0;
- }
- DUMPBITS(8)
- }
- else /* else distance/length */
- {
- DUMPBITS(1)
- NEEDBITS(6) /* get distance low bits */
- d = (unsigned)b & 0x3f;
- DUMPBITS(6)
- NEEDBITS((unsigned)bd) /* get coded distance high bits */
- if ((e = (t = td + ((~(unsigned)b) & md))->e) > 16)
- do {
- if (e == 99)
- return 1;
- DUMPBITS(t->b)
- e -= 16;
- NEEDBITS(e)
- } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16);
- DUMPBITS(t->b)
- d = w - d - t->v.n; /* construct offset */
- NEEDBITS((unsigned)bl) /* get coded length */
- if ((e = (t = tl + ((~(unsigned)b) & ml))->e) > 16)
- do {
- if (e == 99)
- return 1;
- DUMPBITS(t->b)
- e -= 16;
- NEEDBITS(e)
- } while ((e = (t = t->v.t + ((~(unsigned)b) & mask_bits[e]))->e) > 16);
- DUMPBITS(t->b)
- n = t->v.n;
- if (e) /* get length extra bits */
- {
- NEEDBITS(8)
- n += (unsigned)b & 0xff;
- DUMPBITS(8)
- }
-
- /* do the copy */
- s -= n;
- do {
- n -= (e = (e = WSIZE - ((d &= WSIZE-1) > w ? d : w)) > n ? n : e);
- if (u && w <= d)
- {
- memset(slide + w, 0, e);
- w += e;
- d += e;
- }
- else
-#ifndef NOMEMCPY
- if (w - d >= e) /* (this test assumes unsigned comparison) */
- {
- memcpy(slide + w, slide + d, e);
- w += e;
- d += e;
- }
- else /* do it slow to avoid memcpy() overlap */
-#endif /* !NOMEMCPY */
- do {
- slide[w++] = slide[d++];
- } while (--e);
- if (w == WSIZE)
- {
- flush(w);
- w = u = 0;
- }
- } while (n);
- }
- }
-
- /* flush out slide */
- flush(w);
- return pfile_in_zip_read_info->rest_read_compressed ? 5 : 0; /* should have read csize bytes */
-}
-
-
-
-int explode ()
-/* Explode an imploded compressed stream. Based on the general purpose
- bit flag, decide on coded or uncoded literals, and an 8K or 4K sliding
- window. Construct the literal (if any), length, and distance codes and
- the tables needed to decode them (using huft_build() from inflate.c),
- and call the appropriate routine for the type of data in the remainder
- of the stream. The four routines are nearly identical, differing only
- in whether the literal is decoded or simply read in, and in how many
- bits are read in, uncoded, for the low distance bits. */
-{
- unsigned r; /* return codes */
- struct huft *tb; /* literal code table */
- struct huft *tl; /* length code table */
- struct huft *td; /* distance code table */
- int bb; /* bits for tb */
- int bl; /* bits for tl */
- int bd; /* bits for td */
- unsigned l[256]; /* bit lengths for codes */
-
-
- /* Tune base table sizes. Note: I thought that to truly optimize speed,
- I would have to select different bl, bd, and bb values for different
- compressed file sizes. I was suprised to find out the the values of
- 7, 7, and 9 worked best over a very wide range of sizes, except that
- bd = 8 worked marginally better for large compressed sizes. */
- bl = 7;
- bd = pUnzip->pfile_in_zip_read->rest_read_compressed > 200000L ? 8 : 7;
-
-
- /* With literal tree--minimum match length is 3 */
- hufts = 0; /* initialze huft's malloc'ed */
- if (pUnzip->cur_file_info.flag & 4)
- {
- bb = 9; /* base table size for literals */
- if ((r = get_tree(l, 256)) != 0)
- return r;
- if ((r = huft_build(l, 256, 256, NULL, NULL, &tb, &bb)) != 0)
- {
- if (r == 1)
- huft_free(tb);
- return r;
- }
- if ((r = get_tree(l, 64)) != 0)
- return r;
- if ((r = huft_build(l, 64, 0, cplen3, extra, &tl, &bl)) != 0)
- {
- if (r == 1)
- huft_free(tl);
- huft_free(tb);
- return r;
- }
- if ((r = get_tree(l, 64)) != 0)
- return r;
- if (pUnzip->cur_file_info.flag & 2) /* true if 8K */
- {
- if ((r = huft_build(l, 64, 0, cpdist8, extra, &td, &bd)) != 0)
- {
- if (r == 1)
- huft_free(td);
- huft_free(tl);
- huft_free(tb);
- return r;
- }
- r = explode_lit8(tb, tl, td, bb, bl, bd);
- }
- else /* else 4K */
- {
- if ((r = huft_build(l, 64, 0, cpdist4, extra, &td, &bd)) != 0)
- {
- if (r == 1)
- huft_free(td);
- huft_free(tl);
- huft_free(tb);
- return r;
- }
- r = explode_lit4(tb, tl, td, bb, bl, bd);
- }
- huft_free(td);
- huft_free(tl);
- huft_free(tb);
- }
- else
-
-
- /* No literal tree--minimum match length is 2 */
- {
- if ((r = get_tree(l, 64)) != 0)
- return r;
- if ((r = huft_build(l, 64, 0, cplen2, extra, &tl, &bl)) != 0)
- {
- if (r == 1)
- huft_free(tl);
- return r;
- }
- if ((r = get_tree(l, 64)) != 0)
- return r;
- if (pUnzip->cur_file_info.flag & 2) /* true if 8K */
- {
- if ((r = huft_build(l, 64, 0, cpdist8, extra, &td, &bd)) != 0)
- {
- if (r == 1)
- huft_free(td);
- huft_free(tl);
- return r;
- }
- r = explode_nolit8(tl, td, bl, bd);
- }
- else /* else 4K */
- {
- if ((r = huft_build(l, 64, 0, cpdist4, extra, &td, &bd)) != 0)
- {
- if (r == 1)
- huft_free(td);
- huft_free(tl);
- return r;
- }
- r = explode_nolit4(tl, td, bl, bd);
- }
- huft_free(td);
- huft_free(tl);
- }
-#ifdef DEBUG
- fprintf(stderr, "<%u > ", hufts);
-#endif /* DEBUG */
- return r;
-}
-
-
-int ReadByte(x)
- UWORD *x;
-{
- /*
- * read a byte; return 8 if byte available, 0 if not
- */
-
- if (pfile_in_zip_read_info->stream.avail_in == 0)
- {
- unsigned int uReadThis = UNZ_BUFSIZE;
-
- if (pfile_in_zip_read_info->rest_read_compressed <= 0)
- return (0);
-
- if (pfile_in_zip_read_info->rest_read_compressed < uReadThis)
- uReadThis = (uInt) pfile_in_zip_read_info->rest_read_compressed;
- if (uReadThis == 0)
- return UNZ_EOF;
- if (fseek (pfile_in_zip_read_info->file,
- pfile_in_zip_read_info->pos_in_zipfile +
- pfile_in_zip_read_info->byte_before_the_zipfile, SEEK_SET) != 0)
- return UNZ_ERRNO;
- if (fread (pfile_in_zip_read_info->read_buffer, uReadThis, 1,
- pfile_in_zip_read_info->file) != 1)
- return UNZ_ERRNO;
- pfile_in_zip_read_info->pos_in_zipfile += uReadThis;
-
- pfile_in_zip_read_info->rest_read_compressed -= uReadThis;
-
- pfile_in_zip_read_info->stream.next_in =
- (Bytef *) pfile_in_zip_read_info->read_buffer;
- pfile_in_zip_read_info->stream.avail_in = (uInt) uReadThis;
- }
-
- *x = *pfile_in_zip_read_info->stream.next_in++;
- pfile_in_zip_read_info->stream.avail_in--;
-
- return 8;
-}
-
-/* If BMAX needs to be larger than 16, then h and x[] should be ulg. */
-#define BMAX 16 /* maximum bit length of any code (16 for explode) */
-#define N_MAX 288 /* maximum number of codes in any set */
-
-unsigned hufts; /* track memory usage */
-
-
-int huft_build(b, n, s, d, e, t, m)
-unsigned *b; /* code lengths in bits (all assumed <= BMAX) */
-unsigned n; /* number of codes (assumed <= N_MAX) */
-unsigned s; /* number of simple-valued codes (0..s-1) */
-ush *d; /* list of base values for non-simple codes */
-ush *e; /* list of extra bits for non-simple codes */
-struct huft **t; /* result: starting table */
-int *m; /* maximum lookup bits, returns actual */
-/* Given a list of code lengths and a maximum table size, make a set of
- tables to decode that set of codes. Return zero on success, one if
- the given code set is incomplete (the tables are still built in this
- case), two if the input is invalid (all zero length codes or an
- oversubscribed set of lengths), and three if not enough memory. */
-{
- unsigned a; /* counter for codes of length k */
- unsigned c[BMAX+1]; /* bit length count table */
- unsigned f; /* i repeats in table every f entries */
- int g; /* maximum code length */
- int h; /* table level */
- register unsigned i; /* counter, current code */
- register unsigned j; /* counter */
- register int k; /* number of bits in current code */
- int l; /* bits per table (returned in m) */
- register unsigned *p; /* pointer into c[], b[], or v[] */
- register struct huft *q; /* points to current table */
- struct huft r; /* table entry for structure assignment */
- struct huft *u[BMAX]; /* table stack */
- unsigned v[N_MAX]; /* values in order of bit length */
- register int w; /* bits before this table == (l * h) */
- unsigned x[BMAX+1]; /* bit offsets, then code stack */
- unsigned *xp; /* pointer into x */
- int y; /* number of dummy codes added */
- unsigned z; /* number of entries in current table */
-
-
- /* Generate counts for each bit length */
- memset(c, 0, sizeof(c));
- p = b; i = n;
- do {
- c[*p++]++; /* assume all entries <= BMAX */
- } while (--i);
- if (c[0] == n) /* null input--all zero length codes */
- {
- *t = (struct huft *)NULL;
- *m = 0;
- return 0;
- }
-
-
- /* Find minimum and maximum length, bound *m by those */
- l = *m;
- for (j = 1; j <= BMAX; j++)
- if (c[j])
- break;
- k = j; /* minimum code length */
- if ((unsigned)l < j)
- l = j;
- for (i = BMAX; i; i--)
- if (c[i])
- break;
- g = i; /* maximum code length */
- if ((unsigned)l > i)
- l = i;
- *m = l;
-
-
- /* Adjust last length count to fill out codes, if needed */
- for (y = 1 << j; j < i; j++, y <<= 1)
- if ((y -= c[j]) < 0)
- return 2; /* bad input: more codes than bits */
- if ((y -= c[i]) < 0)
- return 2;
- c[i] += y;
-
-
- /* Generate starting offsets into the value table for each length */
- x[1] = j = 0;
- p = c + 1; xp = x + 2;
- while (--i) { /* note that i == g from above */
- *xp++ = (j += *p++);
- }
-
-
- /* Make a table of values in order of bit lengths */
- p = b; i = 0;
- do {
- if ((j = *p++) != 0)
- v[x[j]++] = i;
- } while (++i < n);
-
-
- /* Generate the Huffman codes and for each, make the table entries */
- x[0] = i = 0; /* first Huffman code is zero */
- p = v; /* grab values in bit order */
- h = -1; /* no tables yet--level -1 */
- w = -l; /* bits decoded == (l * h) */
- u[0] = (struct huft *)NULL; /* just to keep compilers happy */
- q = (struct huft *)NULL; /* ditto */
- z = 0; /* ditto */
-
- /* go through the bit lengths (k already is bits in shortest code) */
- for (; k <= g; k++)
- {
- a = c[k];
- while (a--)
- {
- /* here i is the Huffman code of length k bits for value *p */
- /* make tables up to required level */
- while (k > w + l)
- {
- h++;
- w += l; /* previous table always l bits */
-
- /* compute minimum size table less than or equal to l bits */
- z = (z = g - w) > (unsigned)l ? l : z; /* upper limit on table size */
- if ((f = 1 << (j = k - w)) > a + 1) /* try a k-w bit table */
- { /* too few codes for k-w bit table */
- f -= a + 1; /* deduct codes from patterns left */
- xp = c + k;
- while (++j < z) /* try smaller tables up to z bits */
- {
- if ((f <<= 1) <= *++xp)
- break; /* enough codes to use up j bits */
- f -= *xp; /* else deduct codes from patterns */
- }
- }
- z = 1 << j; /* table entries for j-bit table */
-
- /* allocate and link in new table */
- if ((q = (struct huft *)malloc((z + 1)*sizeof(struct huft))) ==
- (struct huft *)NULL)
- {
- if (h)
- huft_free(u[0]);
- return 3; /* not enough memory */
- }
- hufts += z + 1; /* track memory usage */
- *t = q + 1; /* link to list for huft_free() */
- *(t = &(q->v.t)) = (struct huft *)NULL;
- u[h] = ++q; /* table starts after link */
-
- /* connect to last table, if there is one */
- if (h)
- {
- x[h] = i; /* save pattern for backing up */
- r.b = (uch)l; /* bits to dump before this table */
- r.e = (uch)(16 + j); /* bits in this table */
- r.v.t = q; /* pointer to this table */
- j = i >> (w - l); /* (get around Turbo C bug) */
- u[h-1][j] = r; /* connect to last table */
- }
- }
-
- /* set up table entry in r */
- r.b = (uch)(k - w);
- if (p >= v + n)
- r.e = 99; /* out of values--invalid code */
- else if (*p < s)
- {
- r.e = (uch)(*p < 256 ? 16 : 15); /* 256 is end-of-block code */
- r.v.n = *p++; /* simple code is just the value */
- }
- else
- {
- r.e = (uch)e[*p - s]; /* non-simple--look up in lists */
- r.v.n = d[*p++ - s];
- }
-
- /* fill code-like entries with r */
- f = 1 << (k - w);
- for (j = i >> w; j < z; j += f)
- q[j] = r;
-
- /* backwards increment the k-bit code i */
- for (j = 1 << (k - 1); i & j; j >>= 1)
- i ^= j;
- i ^= j;
-
- /* backup over finished tables */
- while ((i & ((1 << w) - 1)) != x[h])
- {
- h--; /* don't need to update q */
- w -= l;
- }
- }
- }
-
-
- /* Return true (1) if we were given an incomplete table */
- return y != 0 && g != 1;
-}
-
-
-int huft_free(t)
-struct huft *t; /* table to free */
-/* Free the malloc'ed tables built by huft_build(), which makes a linked
- list of the tables it made, with the links in a dummy first entry of
- each table. */
-{
- register struct huft *p, *q;
-
-
- /* Go through linked list, freeing from the malloced (t[-1]) address. */
- p = t;
- while (p != (struct huft *)NULL)
- {
- q = (--p)->v.t;
- free(p);
- p = q;
- }
- return 0;
-}
-
-void flush(w)
-unsigned w; /* number of bytes to flush */
-/* Do the equivalent of OUTB for the bytes slide[0..w-1]. */
-{
- memmove (pfile_in_zip_read_info->stream.next_out, slide, w);
- pfile_in_zip_read_info->crc32 = crc32 (pfile_in_zip_read_info->crc32,
- pfile_in_zip_read_info->stream.next_out,
- w);
- pfile_in_zip_read_info->stream.next_out += w;
- pfile_in_zip_read_info->stream.avail_out -= w;
- pfile_in_zip_read_info->stream.total_out += w;
-}
-
-void flush_stack(w)
-unsigned w; /* number of bytes to flush */
-/* Do the equivalent of OUTB for the bytes slide[0..w-1]. */
-{
- memmove (pfile_in_zip_read_info->stream.next_out, stack, w);
- pfile_in_zip_read_info->crc32 = crc32 (pfile_in_zip_read_info->crc32,
- pfile_in_zip_read_info->stream.next_out,
- w);
- pfile_in_zip_read_info->stream.next_out += w;
- pfile_in_zip_read_info->stream.avail_out -= w;
- pfile_in_zip_read_info->stream.total_out += w;
-}
-
-/****************************/
-/* Function FillBitBuffer() */
-/****************************/
-
-int FillBitBuffer()
-{
- /*
- * Fill bitbuf, which is 32 bits. This function is only used by the
- * READBIT and PEEKBIT macros (which are used by all of the uncompression
- * routines).
- */
- UWORD temp;
-
- zipeof = 1;
- while (bits_left < 25 && ReadByte(&temp) == 8)
- {
- bitbuf |= (ULONG)temp << bits_left;
- bits_left += 8;
- zipeof = 0;
- }
- return 0;
-}
-
diff --git a/source/unzip/unreduce.c b/source/unzip/unreduce.c
deleted file mode 100644
index e978746..0000000
--- a/source/unzip/unreduce.c
+++ /dev/null
@@ -1,217 +0,0 @@
-/*---------------------------------------------------------------------------
-
- unreduce.c
-
- The Reducing algorithm is actually a combination of two distinct algorithms.
- The first algorithm compresses repeated byte sequences, and the second al-
- gorithm takes the compressed stream from the first algorithm and applies a
- probabilistic compression method.
-
- ---------------------------------------------------------------------------*/
-
-
-#include "unz.h"
-#include "unzipP.h"
-
-/**************************************/
-/* UnReduce Defines, Typedefs, etc. */
-/**************************************/
-
-#define DLE 144
-
-typedef byte f_array[64]; /* for followers[256][64] */
-
-static void LoadFollowers ();
-void flush OF((unsigned)); /* routine from inflate.c */
-
-extern file_in_zip_read_info_s *pfile_in_zip_read_info;
-extern unz_s *pUnzip;
-
-/*******************************/
-/* UnReduce Global Variables */
-/*******************************/
-
-#if (defined(MACOS) || defined(MTS))
- f_array *followers; /* shared work space */
-#else
- f_array *followers = (f_array *) (slide + 0x4000);
-#endif
-
-byte Slen[256];
-int factor;
-
-int L_table[] =
-{0, 0x7f, 0x3f, 0x1f, 0x0f};
-
-int D_shift[] =
-{0, 0x07, 0x06, 0x05, 0x04};
-int D_mask[] =
-{0, 0x01, 0x03, 0x07, 0x0f};
-
-int B_table[] =
-{8, 1, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8};
-
-
-
-
-
-/*************************/
-/* Function unReduce() */
-/*************************/
-
-void unReduce() /* expand probabilistically reduced data */
-{
- register int lchar = 0;
- int nchar;
- int ExState = 0;
- int V = 0;
- int Len = 0;
- longint s = pUnzip->pfile_in_zip_read->rest_read_compressed;
- unsigned w = 0; /* position in output window slide[] */
- unsigned u = 1; /* true if slide[] unflushed */
-
-
-#if (defined(MACOS) || defined(MTS))
- followers = (f_array *) (slide + 0x4000);
-#endif
-
- factor = pUnzip->cur_file_info.compression_method;
- LoadFollowers();
-
- while (s > 0 /* && (!zipeof) */) {
- if (Slen[lchar] == 0)
- READBIT(8, nchar) /* ; */
- else {
- READBIT(1, nchar);
- if (nchar != 0)
- READBIT(8, nchar) /* ; */
- else {
- int follower;
- int bitsneeded = B_table[Slen[lchar]];
- READBIT(bitsneeded, follower);
- nchar = followers[lchar][follower];
- }
- }
- /* expand the resulting byte */
- switch (ExState) {
-
- case 0:
- if (nchar != DLE) {
- s--;
- slide[w++] = (byte) nchar;
- if (w == 0x4000) {
- flush(w);
- w = u = 0;
- }
- }
- else
- ExState = 1;
- break;
-
- case 1:
- if (nchar != 0) {
- V = nchar;
- Len = V & L_table[factor];
- if (Len == L_table[factor])
- ExState = 2;
- else
- ExState = 3;
- } else {
- s--;
- slide[w++] = DLE;
- if (w == 0x4000)
- {
- flush(w);
- w = u = 0;
- }
- ExState = 0;
- }
- break;
-
- case 2:{
- Len += nchar;
- ExState = 3;
- }
- break;
-
- case 3:{
- register unsigned e;
- register unsigned n = Len + 3;
- register unsigned d = w - ((((V >> D_shift[factor]) &
- D_mask[factor]) << 8) + nchar + 1);
-
- s -= n;
- do {
- n -= (e = (e = 0x4000 - ((d &= 0x3fff) > w ? d : w)) > n ?
- n : e);
- if (u && w <= d)
- {
- memset(slide + w, 0, e);
- w += e;
- d += e;
- }
- else
- if (w - d < e) /* (assume unsigned comparison) */
- do { /* slow to avoid memcpy() overlap */
- slide[w++] = slide[d++];
- } while (--e);
- else
- {
- memcpy(slide + w, slide + d, e);
- w += e;
- d += e;
- }
- if (w == 0x4000)
- {
- flush(w);
- w = u = 0;
- }
- } while (n);
-
- ExState = 0;
- }
- break;
- }
-
- /* store character for next iteration */
- lchar = nchar;
- }
-
- /* flush out slide */
- flush(w);
-}
-
-
-
-
-
-/******************************/
-/* Function LoadFollowers() */
-/******************************/
-
-static void LoadFollowers()
-{
- register int x;
- register int i;
-
- for (x = 255; x >= 0; x--) {
- READBIT(6, Slen[x]);
- for (i = 0; (byte) i < Slen[x]; i++) {
- READBIT(8, followers[x][i]);
- }
- }
-}
diff --git a/source/unzip/unshrink.c b/source/unzip/unshrink.c
deleted file mode 100644
index 6deb4d4..0000000
--- a/source/unzip/unshrink.c
+++ /dev/null
@@ -1,177 +0,0 @@
-/*---------------------------------------------------------------------------
-
- unshrink.c
-
- Shrinking is a Dynamic Lempel-Ziv-Welch compression algorithm with partial
- clearing.
-
- ---------------------------------------------------------------------------*/
-
-
-#include "unz.h"
-void flush_stack (int);
-
-/*************************************/
-/* UnShrink Defines, Globals, etc. */
-/*************************************/
-
-/* MAX_BITS 13 (in unzip.h; defines size of global work area) */
-#define INIT_BITS 9
-#define FIRST_ENT 257
-#define CLEAR 256
-#define GetCode(dest) READBIT(codesize,dest)
-
-static void partial_clear ();
-
-int codesize, maxcode, maxcodemax, free_ent;
-
-
-
-
-/*************************/
-/* Function unShrink() */
-/*************************/
-
-void unShrink()
-{
- register int code;
- register int stackp;
- int finchar;
- int oldcode;
- int incode;
-
-
- /* decompress the file */
- codesize = INIT_BITS;
- maxcode = (1 << codesize) - 1;
- maxcodemax = HSIZE; /* (1 << MAX_BITS) */
- free_ent = FIRST_ENT;
-
- code = maxcodemax;
- do {
- prefix_of[code] = -1;
- } while (--code > 255);
-/*
- OvdL: -Ox with SCO's 3.2.0 cc gives
- a. warning: overflow in constant multiplication
- b. segmentation fault (core dumped) when using the executable
- for (code = maxcodemax; code > 255; code--)
- prefix_of[code] = -1;
- */
-
- for (code = 255; code >= 0; code--) {
- prefix_of[code] = 0;
- suffix_of[code] = (byte) code;
- }
-
- GetCode(oldcode);
- if (zipeof)
- return;
- finchar = oldcode;
-
- stack[0] = finchar;
- flush_stack (1);
-
- stackp = HSIZE;
-
- while (!zipeof) {
- GetCode(code);
- if (zipeof)
- return;
-
- while (code == CLEAR) {
- GetCode(code);
- switch (code) {
- case 1:
- codesize++;
- if (codesize == MAX_BITS)
- maxcode = maxcodemax;
- else
- maxcode = (1 << codesize) - 1;
- break;
-
- case 2:
- partial_clear();
- break;
- }
-
- GetCode(code);
- if (zipeof)
- return;
- }
-
-
- /* special case for KwKwK string */
- incode = code;
- if (prefix_of[code] == -1) {
- stack[--stackp] = (byte) finchar;
- code = oldcode;
- }
- /* generate output characters in reverse order */
- while (code >= FIRST_ENT) {
- if (prefix_of[code] == -1) {
- stack[--stackp] = (byte) finchar;
- code = oldcode;
- } else {
- stack[--stackp] = suffix_of[code];
- code = prefix_of[code];
- }
- }
-
- finchar = suffix_of[code];
- stack[--stackp] = (byte) finchar;
-
- /* and put them out in forward order, block copy */
- flush_stack (HSIZE - stackp);
- stackp = HSIZE;
-
- /* generate new entry */
- code = free_ent;
- if (code < maxcodemax) {
- prefix_of[code] = oldcode;
- suffix_of[code] = (byte) finchar;
-
- do
- code++;
- while ((code < maxcodemax) && (prefix_of[code] != -1));
-
- free_ent = code;
- }
- /* remember previous code */
- oldcode = incode;
- }
-}
-
-
-
-/******************************/
-/* Function partial_clear() */
-/******************************/
-
-static void partial_clear()
-{
- register int pr;
- register int cd;
-
- /* mark all nodes as potentially unused */
- for (cd = FIRST_ENT; cd < free_ent; cd++)
- prefix_of[cd] |= 0x8000;
-
- /* unmark those that are used by other nodes */
- for (cd = FIRST_ENT; cd < free_ent; cd++) {
- pr = prefix_of[cd] & 0x7fff; /* reference to another node? */
- if (pr >= FIRST_ENT) /* flag node as referenced */
- prefix_of[pr] &= 0x7fff;
- }
-
- /* clear the ones that are still marked */
- for (cd = FIRST_ENT; cd < free_ent; cd++)
- if ((prefix_of[cd] & 0x8000) != 0)
- prefix_of[cd] = -1;
-
- /* find first cleared node as next free_ent */
- cd = FIRST_ENT;
- while ((cd < maxcodemax) && (prefix_of[cd] != -1))
- cd++;
- free_ent = cd;
-}
diff --git a/source/unzip/unz.h b/source/unzip/unz.h
deleted file mode 100644
index 1ea7478..0000000
--- a/source/unzip/unz.h
+++ /dev/null
@@ -1,994 +0,0 @@
-/*---------------------------------------------------------------------------
-
- unzip.h
-
- This header file is used by all of the unzip source files. Its contents
- are divided into seven more-or-less separate sections: predefined macros,
- OS-dependent includes, (mostly) OS-independent defines, typedefs, function
- prototypes (or "prototypes," in the case of non-ANSI compilers), macros,
- and global-variable declarations.
-
- ---------------------------------------------------------------------------*/
-
-#include "zlib.h"
-
-/*****************************************/
-/* Predefined, Machine-specific Macros */
-/*****************************************/
-
-#if (defined(__GO32__) && defined(unix)) /* DOS extender */
-# undef unix
-#endif
-
-#if defined(unix) || defined(__convexc__) || defined(M_XENIX)
-# ifndef UNIX
-# define UNIX
-# endif /* !UNIX */
-#endif /* unix || __convexc__ || M_XENIX */
-
-/* Much of the following is swiped from zip's tailor.h: */
-
-/* define MSDOS for Turbo C (unless OS/2) and Power C as well as Microsoft C */
-#ifdef __POWERC
-# define __TURBOC__
-# define MSDOS
-#endif /* __POWERC */
-#if (defined(__TURBOC__) && defined(__MSDOS__) && !defined(MSDOS))
-# define MSDOS
-#endif
-
-/* use prototypes and ANSI libraries if __STDC__, or Microsoft or Borland C,
- * or Silicon Graphics, or Convex, or IBM C Set/2, or GNU gcc under emx, or
- * or Watcom C, or Macintosh, or Windows NT.
- */
-#if (__STDC__ || defined(MSDOS) || defined(sgi) || defined(CONVEX) || defined(__sun))
-# ifndef PROTO
-# define PROTO
-# endif
-# define MODERN
-#endif
-#if (defined(__IBMC__) || defined(__EMX__) || defined(__WATCOMC__))
-# ifndef PROTO
-# define PROTO
-# endif
-# define MODERN
-#endif
-#if (defined(THINK_C) || defined(MPW) || defined(WIN32))
-# ifndef PROTO
-# define PROTO
-# endif
-# define MODERN
-#endif
-
-/* turn off prototypes if requested */
-#if (defined(NOPROTO) && defined(PROTO))
-# undef PROTO
-#endif
-
-#if (defined(ultrix) || defined(bsd4_2) || defined(sun) || defined(pyr))
-# if (!defined(BSD) && !defined(__SYSTEM_FIVE) && !defined(SYSV))
-# define BSD
-# endif /* !BSD && !__SYSTEM_FIVE && !SYSV */
-#endif /* ultrix || bsd4_2 || sun || pyr */
-
-#if (defined(CONVEX) || defined(CRAY) || defined(__SYSTEM_FIVE))
-# ifndef TERMIO
-# define TERMIO
-# endif /* !TERMIO */
-#endif /* CONVEX || CRAY || __SYSTEM_FIVE */
-
-#ifdef pyr /* Pyramid */
-# ifndef ZMEM
-# define ZMEM
-# endif /* !ZMEM */
-#endif /* pyr */
-
-#ifdef CRAY
-# ifdef ZMEM
-# undef ZMEM
-# endif /* ZMEM */
-#endif /* CRAY */
-
-/* the i386 test below is to catch SCO Unix (which has redefinition
- * warnings if param.h is included), but it probably doesn't hurt if
- * other 386 Unixes get nailed, too...except now that 386BSD and BSDI
- * exist. Sigh. <sys/param.h> is mostly included for "BSD", I think.
- * [An alternate fix for SCO Unix is below.]
- */
-#if (defined(MINIX) || (defined(i386) && defined(unix)))
-# define NO_PARAM_H
-#endif /* MINIX || (i386 && unix) */
-
-
-
-
-
-/***************************/
-/* OS-Dependent Includes */
-/***************************/
-
-#ifndef MINIX /* Minix needs it after all the other includes (?) */
-# include <stdio.h>
-#endif
-#include <ctype.h> /* skip for VMS, to use tolower() function? */
-#include <errno.h> /* used in mapname() */
-#ifndef NO_ERRNO
-# define DECLARE_ERRNO /* everybody except MSC 6.0, SCO cc, Watcom C/386 */
-#endif /* !NO_ERRNO */
-#ifdef VMS
-# include <types.h> /* (placed up here instead of in VMS section below */
-# include <stat.h> /* because types.h is used in some other headers) */
-#else /* !VMS */
-# if !defined(THINK_C) && !defined(MPW)
-# include <sys/types.h> /* off_t, time_t, dev_t, ... */
-# include <sys/stat.h>
-# endif /* !THINK_C && !MPW */
-#endif /* ?VMS */
-
-#ifdef MODERN
-# if (!defined(M_XENIX) && !(defined(__GNUC__) && defined(sun)))
-# include <stddef.h>
-# endif
-# if (!defined(__GNUC__) && !defined(apollo)) /* both define __STDC__ */
-# include <stdlib.h> /* standard library prototypes, malloc(), etc. */
-# else
-# ifdef __EMX__
-# include <stdlib.h> /* emx IS gcc but has stdlib.h */
-# endif
-# endif
-# include <string.h> /* defines strcpy, strcmp, memcpy, etc. */
- typedef size_t extent;
-#else /* !MODERN */
- char *malloc();
- char *strchr(), *strrchr();
- long lseek();
- typedef unsigned int extent;
-# define void int
-#endif /* ?MODERN */
-
-/* this include must be down here for SysV.4, for some reason... */
-#include <signal.h> /* used in unzip.c, file_io.c */
-
-
-
-/*---------------------------------------------------------------------------
- Next, a word from our Unix (mostly) sponsors:
- ---------------------------------------------------------------------------*/
-
-#ifdef UNIX
-# ifdef AMIGA
-# include <libraries/dos.h>
-# else /* !AMIGA */
-# ifndef NO_PARAM_H
-#if 0 /* [GRR: this is an alternate fix for SCO's redefinition bug] */
-# ifdef NGROUPS_MAX
-# undef NGROUPS_MAX /* SCO bug: defined again in <param.h> */
-# endif /* NGROUPS_MAX */
-#endif /* 0 */
-# include <sys/param.h> /* conflict with <sys/types.h>, some systems? */
-# endif /* !NO_PARAM_H */
-# endif /* ?AMIGA */
-
-# ifndef BSIZE
-# ifdef MINIX
-# define BSIZE 1024
-# else /* !MINIX */
-# define BSIZE DEV_BSIZE /* assume common for all Unix systems */
-# endif /* ?MINIX */
-# endif
-
-# ifndef BSD
-# if (!defined(AMIGA) && !defined(MINIX))
-# define NO_MKDIR /* for mapname() */
-# endif /* !AMIGA && !MINIX */
-# include <time.h>
- struct tm *gmtime(), *localtime();
-# else /* BSD */
-# include <sys/time.h>
-# include <sys/timeb.h>
-# ifdef _AIX
-# include <time.h>
-# endif
-# endif
-
-#else /* !UNIX */
-# define BSIZE 512 /* disk block size */
-#endif /* ?UNIX */
-
-#if (defined(V7) || defined(BSD))
-# define strchr index
-# define strrchr rindex
-#endif
-
-/*---------------------------------------------------------------------------
- And now, our MS-DOS and OS/2 corner:
- ---------------------------------------------------------------------------*/
-
-#ifdef __TURBOC__
-# define DOS_OS2
-# include <sys/timeb.h> /* for structure ftime */
-# ifndef __BORLANDC__ /* there appears to be a bug (?) in Borland's */
-# include <mem.h> /* MEM.H related to __STDC__ and far poin- */
-# endif /* ters. (dpk) [mem.h included for memcpy] */
-# include <dos.h> /* for REGS macro (at least for Turbo C 2.0) */
-#else /* NOT Turbo C (or Power C)... */
-# ifdef MSDOS /* but still MS-DOS, so we'll assume it's */
-# ifndef MSC /* Microsoft's compiler and fake the ID, if */
-# define MSC /* necessary (it is in 5.0; apparently not */
-# endif /* in 5.1 and 6.0) */
-# include <dos.h> /* for _dos_setftime() */
-# endif
-#endif
-
-#if (defined(__IBMC__) && defined(__OS2__))
-# define DOS_OS2
-# define S_IFMT 0xF000
-# define timezone _timezone
-#endif
-
-#ifdef __WATCOMC__
-# define DOS_OS2
-# define __32BIT__
-# ifdef DECLARE_ERRNO
-# undef DECLARE_ERRNO
-# endif
-# undef far
-# define far
-#endif
-
-#ifdef __EMX__
-# define DOS_OS2
-# define __32BIT__
-# define far
-#endif /* __EMX__ */
-
-#ifdef MSC /* defined for all versions of MSC now */
-# define DOS_OS2 /* Turbo C under DOS, MSC under DOS or OS/2 */
-# if (defined(_MSC_VER) && (_MSC_VER >= 600)) /* new with 5.1 or 6.0 ... */
-# undef DECLARE_ERRNO /* errno is now a function in a dynamic link */
-# endif /* library (or something)--incompatible with */
-#endif /* the usual "extern int errno" declaration */
-
-#ifdef DOS_OS2 /* defined for all MS-DOS and OS/2 compilers */
-# include <io.h> /* lseek(), open(), setftime(), dup(), creat() */
-# include <time.h> /* localtime() */
-#endif
-
-#ifdef OS2 /* defined for all OS/2 compilers */
-# ifdef isupper
-# undef isupper
-# endif
-# ifdef tolower
-# undef tolower
-# endif
-# define isupper(x) IsUpperNLS((unsigned char)(x))
-# define tolower(x) ToLowerNLS((unsigned char)(x))
-#endif
-
-#ifdef WIN32
-# include <io.h> /* read(), open(), etc. */
-# include <time.h>
-# include <memory.h>
-# include <direct.h> /* mkdir() */
-# ifdef FILE_IO_C
-# include <fcntl.h>
-# include <conio.h>
-# include <sys\types.h>
-# include <sys\utime.h>
-# include <windows.h>
-# define DOS_OS2
-# define getch() getchar()
-# endif
-#endif
-
-/*---------------------------------------------------------------------------
- Followed by some VMS (mostly) stuff:
- ---------------------------------------------------------------------------*/
-
-#ifdef VMS
-# include <time.h> /* the usual non-BSD time functions */
-# include <file.h> /* same things as fcntl.h has */
-# include <rms.h>
-# define _MAX_PATH NAM$C_MAXRSS /* to define FILNAMSIZ below */
-# define UNIX /* can share most of same code from now on */
-# define RETURN return_VMS /* VMS interprets return codes incorrectly */
-#else /* !VMS */
-# ifndef THINK_C
-# define RETURN return /* only used in main() */
-# else
-# define RETURN(v) { int n;\
- n = (v);\
- fprintf(stderr, "\npress <return> to continue ");\
- while (getc(stdin) != '\n');\
- putc('\n', stderr);\
- InitCursor();\
- goto start;\
- }
-# endif
-# ifdef V7
-# define O_RDONLY 0
-# define O_WRONLY 1
-# define O_RDWR 2
-# else /* !V7 */
-# ifdef MTS
-# include <sys/file.h> /* MTS uses this instead of fcntl.h */
-# include <timeb.h>
-# include <time.h>
-# else /* !MTS */
-# ifdef COHERENT /* Coherent 3.10/Mark Williams C */
-# include <sys/fcntl.h>
-# define SHORT_NAMES
-# define tzset settz
-# else /* !COHERENT */
-# include <fcntl.h> /* O_BINARY for open() w/o CR/LF translation */
-# endif /* ?COHERENT */
-# endif /* ?MTS */
-# endif /* ?V7 */
-#endif /* ?VMS */
-
-#if (defined(MSDOS) || defined(VMS))
-# define DOS_VMS
-#endif
-
-/*---------------------------------------------------------------------------
- And some Mac stuff for good measure:
- ---------------------------------------------------------------------------*/
-
-#ifdef THINK_C
-# define MACOS
-# ifndef __STDC__ /* if Think C hasn't defined __STDC__ ... */
-# define __STDC__ 1 /* make sure it's defined: it needs it */
-# else /* __STDC__ defined */
-# if !__STDC__ /* sometimes __STDC__ is defined as 0; */
-# undef __STDC__ /* it needs to be 1 or required header */
-# define __STDC__ 1 /* files are not properly included. */
-# endif /* !__STDC__ */
-# endif /* ?defined(__STDC__) */
-#endif /* THINK_C */
-
-#ifdef MPW
-# define MACOS
-# include <Errors.h>
-# include <Files.h>
-# include <Memory.h>
-# include <Quickdraw.h>
-# include <ToolUtils.h>
-# define CtoPstr c2pstr
-# define PtoCstr p2cstr
-# ifdef CR
-# undef CR
-# endif
-#endif /* MPW */
-
-#ifdef MACOS
-# define open(x,y) macopen(x,y, gnVRefNum, glDirID)
-# define close macclose
-# define read macread
-# define write macwrite
-# define lseek maclseek
-# define creat(x,y) maccreat(x, gnVRefNum, glDirID, gostCreator, gostType)
-# define stat(x,y) macstat(x,y,gnVRefNum, glDirID)
-
-# ifndef isascii
-# define isascii(c) ((unsigned char)(c) <= 0x3F)
-# endif
-
-# include "macstat.h"
-
-typedef struct _ZipExtraHdr {
- unsigned short header; /* 2 bytes */
- unsigned short data; /* 2 bytes */
-} ZIP_EXTRA_HEADER;
-
-typedef struct _MacInfoMin {
- unsigned short header; /* 2 bytes */
- unsigned short data; /* 2 bytes */
- unsigned long signature; /* 4 bytes */
- FInfo finfo; /* 16 bytes */
- unsigned long lCrDat; /* 4 bytes */
- unsigned long lMdDat; /* 4 bytes */
- unsigned long flags ; /* 4 bytes */
- unsigned long lDirID; /* 4 bytes */
- /*------------*/
-} MACINFOMIN; /* = 40 bytes for size of data */
-
-typedef struct _MacInfo {
- unsigned short header; /* 2 bytes */
- unsigned short data; /* 2 bytes */
- unsigned long signature; /* 4 bytes */
- FInfo finfo; /* 16 bytes */
- unsigned long lCrDat; /* 4 bytes */
- unsigned long lMdDat; /* 4 bytes */
- unsigned long flags ; /* 4 bytes */
- unsigned long lDirID; /* 4 bytes */
- char rguchVolName[28]; /* 28 bytes */
- /*------------*/
-} MACINFO; /* = 68 bytes for size of data */
-#endif /* MACOS */
-
-/*---------------------------------------------------------------------------
- And finally, some random extra stuff:
- ---------------------------------------------------------------------------*/
-
-#ifdef MINIX
-# include <stdio.h>
-#endif
-
-#ifdef SHORT_NAMES /* Mark Williams C, ...? */
-# define extract_or_test_files xtr_or_tst_files
-# define extract_or_test_member xtr_or_tst_member
-#endif
-
-#ifdef MTS
-# include <unix.h> /* Some important non-ANSI routines */
-# define mkdir(s,n) (-1) /* No "make directory" capability */
-# define EBCDIC /* Set EBCDIC conversion on */
-#endif
-
-
-
-
-
-/*************/
-/* Defines */
-/*************/
-
-#ifndef WSIZE
-# define WSIZE 0x8000 /* window size--must be a power of two, and */
-#endif /* !WSIZE */ /* at least 32K for zip's deflate method */
-
-#define DIR_BLKSIZ 64 /* number of directory entries per block
- * (should fit in 4096 bytes, usually) */
-#ifndef INBUFSIZ
-# define INBUFSIZ 2048 /* works for MS-DOS small model */
-#endif /* !INBUFSIZ */
-
-/*
- * If <limits.h> exists on most systems, should include that, since it may
- * define some or all of the following: NAME_MAX, PATH_MAX, _POSIX_NAME_MAX,
- * _POSIX_PATH_MAX.
- */
-#ifdef DOS_OS2
-# include <limits.h>
-#endif /* DOS_OS2 */
-
-#ifdef _MAX_PATH
-# define FILNAMSIZ (_MAX_PATH)
-#else /* !_MAX_PATH */
-# define FILNAMSIZ 1025
-#endif /* ?_MAX_PATH */
-
-#ifndef PATH_MAX
-# ifdef MAXPATHLEN /* defined in <sys/param.h> some systems */
-# define PATH_MAX MAXPATHLEN
-# else
-# if FILENAME_MAX > 255 /* used like PATH_MAX on some systems */
-# define PATH_MAX FILENAME_MAX
-# else
-# define PATH_MAX (FILNAMSIZ - 1)
-# endif
-# endif /* ?MAXPATHLEN */
-#endif /* !PATH_MAX */
-
-#define OUTBUFSIZ INBUFSIZ
-
-#define ZSUFX ".zip"
-#define CENTRAL_HDR_SIG "\113\001\002" /* the infamous "PK" signature */
-#define LOCAL_HDR_SIG "\113\003\004" /* bytes, sans "P" (so unzip */
-#define END_CENTRAL_SIG "\113\005\006" /* executable not mistaken for */
-#define EXTD_LOCAL_SIG "\113\007\010" /* zipfile itself) */
-
-#define SKIP 0 /* choice of activities for do_string() */
-#define DISPLAY 1
-#define FILENAME 2
-#define EXTRA_FIELD 3
-
-#define DOES_NOT_EXIST -1 /* return values for check_for_newer() */
-#define EXISTS_AND_OLDER 0
-#define EXISTS_AND_NEWER 1
-
-#define DOS_OS2_FAT_ 0 /* version_made_by codes (central dir) */
-#define AMIGA_ 1
-#define VMS_ 2 /* make sure these are not defined on */
-#define UNIX_ 3 /* the respective systems!! (like, for */
-#define VM_CMS_ 4 /* instance, "VMS", or "UNIX": CFLAGS = */
-#define ATARI_ 5 /* -O -DUNIX) */
-#define OS2_HPFS_ 6
-#define MAC_ 7
-#define Z_SYSTEM_ 8
-#define CPM_ 9
-/* #define TOPS20_ 10? (TOPS20_ is to be defined in PKZIP 2.0...) */
-#define NUM_HOSTS 10 /* index of last system + 1 */
-
-#define STORED 0 /* compression methods */
-#define SHRUNK 1
-#define REDUCED1 2
-#define REDUCED2 3
-#define REDUCED3 4
-#define REDUCED4 5
-#define IMPLODED 6
-#define TOKENIZED 7
-#define DEFLATED 8
-#define NUM_METHODS 9 /* index of last method + 1 */
-/* don't forget to update list_files() appropriately if NUM_METHODS changes */
-
-#define DF_MDY 0 /* date format 10/26/91 (USA only) */
-#define DF_DMY 1 /* date format 26/10/91 (most of the world) */
-#define DF_YMD 2 /* date format 91/10/26 (a few countries) */
-
-#define UNZIP_VERSION 20 /* compatible with PKUNZIP 2.0 */
-#define VMS_VERSION 42 /* if OS-needed-to-extract is VMS: can do */
-
-/*---------------------------------------------------------------------------
- True sizes of the various headers, as defined by PKWare--so it is not
- likely that these will ever change. But if they do, make sure both these
- defines AND the typedefs below get updated accordingly.
- ---------------------------------------------------------------------------*/
-#define LREC_SIZE 26 /* lengths of local file headers, central */
-#define CREC_SIZE 42 /* directory headers, and the end-of- */
-#define ECREC_SIZE 18 /* central-dir record, respectively */
-
-#define MAX_BITS 13 /* used in unShrink() */
-#define HSIZE (1 << MAX_BITS) /* size of global work area */
-
-#define LF 10 /* '\n' on ASCII machines. Must be 10 due to EBCDIC */
-#define CR 13 /* '\r' on ASCII machines. Must be 13 due to EBCDIC */
-#define CTRLZ 26 /* DOS & OS/2 EOF marker (used in file_io.c, vms.c) */
-
-#ifdef EBCDIC
-# define ascii_to_native(c) ebcdic[(c)]
-# define NATIVE "EBCDIC"
-#endif
-
-#if MPW
-# define FFLUSH putc('\n',stderr);
-#else /* !MPW */
-# define FFLUSH fflush(stderr);
-#endif /* ?MPW */
-
-#ifdef VMS
-# define ENV_UNZIP "UNZIP_OPTS" /* name of environment variable */
-# define ENV_ZIPINFO "ZIPINFO_OPTS"
-#else /* !VMS */
-# define ENV_UNZIP "UNZIP"
-# define ENV_ZIPINFO "ZIPINFO"
-#endif /* ?VMS */
-
-#ifdef CRYPT
-# define PWLEN 80
-# define DECRYPT(b) (update_keys(t=((b)&0xff)^decrypt_byte()),t)
-#endif /* CRYPT */
-
-#ifdef QQ /* Newtware version */
-# define QCOND (!quietflg) /* for no file comments with -vq or -vqq */
-#else /* (original) Bill Davidsen version */
-# define QCOND (which_hdr) /* no way to kill file comments with -v, -l */
-#endif
-
-#ifndef TRUE
-# define TRUE 1 /* sort of obvious */
-#endif
-#ifndef FALSE
-# define FALSE 0
-#endif
-
-#ifndef SEEK_SET /* These should all be declared in stdio.h! But */
-# define SEEK_SET 0 /* since they're not (in many cases), do so here. */
-# define SEEK_CUR 1
-# define SEEK_END 2
-#endif
-
-#ifndef S_IRUSR
-# define S_IRWXU 00700 /* read, write, execute: owner */
-# define S_IRUSR 00400 /* read permission: owner */
-# define S_IWUSR 00200 /* write permission: owner */
-# define S_IXUSR 00100 /* execute permission: owner */
-# define S_IRWXG 00070 /* read, write, execute: group */
-# define S_IRGRP 00040 /* read permission: group */
-# define S_IWGRP 00020 /* write permission: group */
-# define S_IXGRP 00010 /* execute permission: group */
-# define S_IRWXO 00007 /* read, write, execute: other */
-# define S_IROTH 00004 /* read permission: other */
-# define S_IWOTH 00002 /* write permission: other */
-# define S_IXOTH 00001 /* execute permission: other */
-#endif /* !S_IRUSR */
-
-#ifdef ZIPINFO /* these are individually checked because SysV doesn't */
-# ifndef S_IFBLK /* have some of them, Microsoft C others, etc. */
-# define S_IFBLK 0060000 /* block special */
-# endif
-# ifndef S_IFIFO /* in Borland C, not MSC */
-# define S_IFIFO 0010000 /* fifo */
-# endif
-# ifndef S_IFLNK /* in BSD, not SysV */
-# define S_IFLNK 0120000 /* symbolic link */
-# endif
-# ifndef S_IFSOCK /* in BSD, not SysV */
-# define S_IFSOCK 0140000 /* socket */
-# endif
-# ifndef S_ISUID
-# define S_ISUID 04000 /* set user id on execution */
-# endif
-# ifndef S_ISGID
-# define S_ISGID 02000 /* set group id on execution */
-# endif
-# ifndef S_ISVTX
-# define S_ISVTX 01000 /* directory permissions control */
-# endif
-# ifndef S_ENFMT
-# define S_ENFMT S_ISGID /* record locking enforcement flag */
-# endif
-#endif /* ZIPINFO */
-
-
-
-
-
-/**************/
-/* Typedefs */
-/**************/
-
-#ifndef _BULL_SOURCE /* Bull has it defined somewhere already */
- typedef unsigned char byte; /* code assumes UNSIGNED bytes */
-#endif /* !_BULL_SOURCE */
-
-typedef char boolean;
-typedef long longint;
-typedef unsigned short UWORD;
-typedef unsigned long ULONG;
-typedef unsigned char uch;
-typedef unsigned short ush;
-typedef unsigned long ulg;
-
-typedef struct min_info {
- unsigned unix_attr;
- unsigned dos_attr;
- int hostnum;
- longint offset;
- ULONG compr_size; /* compressed size (needed if extended header) */
- ULONG crc; /* crc (needed if extended header) */
- unsigned encrypted : 1; /* file encrypted: decrypt before uncompressing */
- unsigned ExtLocHdr : 1; /* use time instead of CRC for decrypt check */
- unsigned text : 1; /* file is text or binary */
- unsigned lcflag : 1; /* convert filename to lowercase */
-} min_info;
-
-typedef struct VMStimbuf {
- char *revdate; /* (both correspond to Unix modtime/st_mtime) */
- char *credate;
-} VMStimbuf;
-
-/*---------------------------------------------------------------------------
- Zipfile layout declarations. If these headers ever change, make sure the
- xxREC_SIZE defines (above) change with them!
- ---------------------------------------------------------------------------*/
-
- typedef byte local_byte_hdr[ LREC_SIZE ];
-# define L_VERSION_NEEDED_TO_EXTRACT_0 0
-# define L_VERSION_NEEDED_TO_EXTRACT_1 1
-# define L_GENERAL_PURPOSE_BIT_FLAG 2
-# define L_COMPRESSION_METHOD 4
-# define L_LAST_MOD_FILE_TIME 6
-# define L_LAST_MOD_FILE_DATE 8
-# define L_CRC32 10
-# define L_COMPRESSED_SIZE 14
-# define L_UNCOMPRESSED_SIZE 18
-# define L_FILENAME_LENGTH 22
-# define L_EXTRA_FIELD_LENGTH 24
-
- typedef byte cdir_byte_hdr[ CREC_SIZE ];
-# define C_VERSION_MADE_BY_0 0
-# define C_VERSION_MADE_BY_1 1
-# define C_VERSION_NEEDED_TO_EXTRACT_0 2
-# define C_VERSION_NEEDED_TO_EXTRACT_1 3
-# define C_GENERAL_PURPOSE_BIT_FLAG 4
-# define C_COMPRESSION_METHOD 6
-# define C_LAST_MOD_FILE_TIME 8
-# define C_LAST_MOD_FILE_DATE 10
-# define C_CRC32 12
-# define C_COMPRESSED_SIZE 16
-# define C_UNCOMPRESSED_SIZE 20
-# define C_FILENAME_LENGTH 24
-# define C_EXTRA_FIELD_LENGTH 26
-# define C_FILE_COMMENT_LENGTH 28
-# define C_DISK_NUMBER_START 30
-# define C_INTERNAL_FILE_ATTRIBUTES 32
-# define C_EXTERNAL_FILE_ATTRIBUTES 34
-# define C_RELATIVE_OFFSET_LOCAL_HEADER 38
-
- typedef byte ec_byte_rec[ ECREC_SIZE+4 ];
-/* define SIGNATURE 0 space-holder only */
-# define NUMBER_THIS_DISK 4
-# define NUM_DISK_WITH_START_CENTRAL_DIR 6
-# define NUM_ENTRIES_CENTRL_DIR_THS_DISK 8
-# define TOTAL_ENTRIES_CENTRAL_DIR 10
-# define SIZE_CENTRAL_DIRECTORY 12
-# define OFFSET_START_CENTRAL_DIRECTORY 16
-# define ZIPFILE_COMMENT_LENGTH 20
-
-
- typedef struct local_file_header { /* LOCAL */
- byte version_needed_to_extract[2];
- UWORD general_purpose_bit_flag;
- UWORD compression_method;
- UWORD last_mod_file_time;
- UWORD last_mod_file_date;
- ULONG crc32;
- ULONG compressed_size;
- ULONG uncompressed_size;
- UWORD filename_length;
- UWORD extra_field_length;
- } local_file_hdr;
-
- typedef struct central_directory_file_header { /* CENTRAL */
- byte version_made_by[2];
- byte version_needed_to_extract[2];
- UWORD general_purpose_bit_flag;
- UWORD compression_method;
- UWORD last_mod_file_time;
- UWORD last_mod_file_date;
- ULONG crc32;
- ULONG compressed_size;
- ULONG uncompressed_size;
- UWORD filename_length;
- UWORD extra_field_length;
- UWORD file_comment_length;
- UWORD disk_number_start;
- UWORD internal_file_attributes;
- ULONG external_file_attributes;
- ULONG relative_offset_local_header;
- } cdir_file_hdr;
-
- typedef struct end_central_dir_record { /* END CENTRAL */
- UWORD number_this_disk;
- UWORD num_disk_with_start_central_dir;
- UWORD num_entries_centrl_dir_ths_disk;
- UWORD total_entries_central_dir;
- ULONG size_central_directory;
- ULONG offset_start_central_directory;
- UWORD zipfile_comment_length;
- } ecdir_rec;
-
-
-
-
-
-/*************************/
-/* Function Prototypes */
-/*************************/
-
-#ifndef __
-# define __ OF
-#endif
-
-/*---------------------------------------------------------------------------
- Decompression functions:
- ---------------------------------------------------------------------------*/
-
-int explode ();
-void unReduce ();
-void unShrink ();
-
-/*---------------------------------------------------------------------------
- Functions in file_io.c and crypt.c:
- ---------------------------------------------------------------------------*/
-
-int FillBitBuffer ();
-int ReadByte __((UWORD *x)); /* file_io.c */
-
-/************/
-/* Macros */
-/************/
-
-#ifndef MAX
-# define MAX(a,b) ((a) > (b) ? (a) : (b))
-#endif
-
-#ifndef MIN
-# define MIN(a,b) ((a) < (b) ? (a) : (b))
-#endif
-
-
-#define LSEEK(abs_offset) {longint request=(abs_offset)+extra_bytes,\
- inbuf_offset=request%INBUFSIZ, bufstart=request-inbuf_offset;\
- if(request<0) {fprintf(stderr, SeekMsg, ReportMsg); return(3);}\
- else if(bufstart!=cur_zipfile_bufstart)\
- {cur_zipfile_bufstart=lseek(zipfd,bufstart,SEEK_SET);\
- if((incnt=read(zipfd,(char *)inbuf,INBUFSIZ))<=0) return(51);\
- inptr=inbuf+(int)inbuf_offset; incnt-=(int)inbuf_offset;} else\
- {incnt+=(inptr-inbuf)-(int)inbuf_offset; inptr=inbuf+(int)inbuf_offset;}}
-
-/*
- * Seek to the block boundary of the block which includes abs_offset,
- * then read block into input buffer and set pointers appropriately.
- * If block is already in the buffer, just set the pointers. This macro
- * is used by process_end_central_dir (unzip.c) and do_string (misc.c).
- * A slightly modified version is embedded within extract_or_test_files
- * (unzip.c). ReadByte and readbuf (file_io.c) are compatible.
- *
- * macro LSEEK(abs_offset)
- * ULONG abs_offset;
- * {
- * longint request = abs_offset + extra_bytes;
- * longint inbuf_offset = request % INBUFSIZ;
- * longint bufstart = request - inbuf_offset;
- *
- * if (request < 0) {
- * fprintf(stderr, SeekMsg, ReportMsg);
- * return(3); /-* 3: severe error in zipfile *-/
- * } else if (bufstart != cur_zipfile_bufstart) {
- * cur_zipfile_bufstart = lseek(zipfd, bufstart, SEEK_SET);
- * if ((incnt = read(zipfd,inbuf,INBUFSIZ)) <= 0)
- * return(51); /-* 51: unexpected EOF *-/
- * inptr = inbuf + (int)inbuf_offset;
- * incnt -= (int)inbuf_offset;
- * } else {
- * incnt += (inptr-inbuf) - (int)inbuf_offset;
- * inptr = inbuf + (int)inbuf_offset;
- * }
- * }
- *
- */
-
-
-#define SKIP_(length) if(length&&((error=do_string(length,SKIP))!=0))\
- {error_in_archive=error; if(error>1) return error;}
-
-/*
- * Skip a variable-length field, and report any errors. Used in zipinfo.c
- * and unzip.c in several functions.
- *
- * macro SKIP_(length)
- * UWORD length;
- * {
- * if (length && ((error = do_string(length, SKIP)) != 0)) {
- * error_in_archive = error; /-* might be warning *-/
- * if (error > 1) /-* fatal *-/
- * return (error);
- * }
- * }
- *
- */
-
-#define READBIT(nbits,zdest) {if(nbits>bits_left) FillBitBuffer();\
- zdest=(int)((UWORD)bitbuf&mask_bits[nbits]);bitbuf>>=nbits;bits_left-=nbits;}
-
-/*
- * macro READBIT(nbits,zdest)
- * {
- * if (nbits > bits_left)
- * FillBitBuffer();
- * zdest = (int)((UWORD)bitbuf & mask_bits[nbits]);
- * bitbuf >>= nbits;
- * bits_left -= nbits;
- * }
- *
- */
-
-
-#define PEEKBIT(nbits) (nbits>bits_left? (FillBitBuffer(),\
- (UWORD)bitbuf & mask_bits[nbits]) : (UWORD)bitbuf & mask_bits[nbits])
-
-
-#define NUKE_CRs(buf,len) {register int i,j; for (i=j=0; j<len;\
- (buf)[i++]=(buf)[j++]) if ((buf)[j]=='\r') ++j; len=i;}
-
-/*
- * Remove all the ASCII carriage returns from buffer buf (length len),
- * shortening as necessary (note that len gets modified in the process,
- * so it CANNOT be an expression). This macro is intended to be used
- * BEFORE A_TO_N(); hence the check for CR instead of '\r'. NOTE: The
- * if-test gets performed one time too many, but it doesn't matter.
- *
- * macro NUKE_CRs(buf,len)
- * {
- * register int i, j;
- *
- * for (i = j = 0; j < len; (buf)[i++] = (buf)[j++])
- * if ((buf)[j] == CR)
- * ++j;
- * len = i;
- * }
- *
- */
-
-
-#define TOLOWER(str1,str2) {char *ps1,*ps2; ps1=(str1)-1; ps2=(str2);\
- while(*++ps1) *ps2++=(char)(isupper((int)(*ps1))?tolower((int)(*ps1)):*ps1);\
- *ps2='\0';}
-
-/*
- * Copy the zero-terminated string in str1 into str2, converting any
- * uppercase letters to lowercase as we go. str2 gets zero-terminated
- * as well, of course. str1 and str2 may be the same character array.
- *
- * macro TOLOWER( str1, str2 )
- * {
- * char *ps1, *ps2;
- *
- * ps1 = (str1) - 1;
- * ps2 = (str2);
- * while (*++ps1)
- * *ps2++ = (char)(isupper((int)(*ps1))? tolower((int)(*ps1)) : *ps1);
- * *ps2='\0';
- * }
- *
- * NOTES: This macro makes no assumptions about the characteristics of
- * the tolower() function or macro (beyond its existence), nor does it
- * make assumptions about the structure of the character set (i.e., it
- * should work on EBCDIC machines, too). The fact that either or both
- * of isupper() and tolower() may be macros has been taken into account;
- * watch out for "side effects" (in the C sense) when modifying this
- * macro.
- */
-
-
-#ifndef ascii_to_native
-# define ascii_to_native(c) (c)
-# define A_TO_N(str1)
-#else
-# ifndef NATIVE
-# define NATIVE "native chars"
-# endif
-# define A_TO_N(str1) {register unsigned char *ps1;\
- for (ps1=str1; *ps1; ps1++) *ps1=ascii_to_native(*ps1);}
-#endif
-
-/*
- * Translate the zero-terminated string in str1 from ASCII to the native
- * character set. The translation is performed in-place and uses the
- * ascii_to_native macro to translate each character.
- *
- * macro A_TO_N( str1 )
- * {
- * register unsigned char *ps1;
- *
- * for (ps1 = str1; *ps1; ++ps1)
- * *ps1 = ascii_to_native(*ps1);
- * }
- *
- * NOTE: Using the ascii_to_native macro means that is it the only part of
- * unzip which knows which translation table (if any) is actually in use
- * to produce the native character set. This makes adding new character
- * set translation tables easy, insofar as all that is needed is an
- * appropriate ascii_to_native macro definition and the translation
- * table itself. Currently, the only non-ASCII native character set
- * implemented is EBCDIC, but this may not always be so.
- */
-
-/*************/
-/* Globals */
-/*************/
-
-#ifdef MACOS
- union work {
- struct {
- short *Prefix_of; /* (8193 * sizeof(short)) */
- byte *Suffix_of;
- byte *Stack;
- } shrink;
- byte *Slide;
- };
-#else
- union work {
- struct {
- short Prefix_of[HSIZE + 2]; /* (8194 * sizeof(short)) */
- byte Suffix_of[HSIZE + 2]; /* also s-f length_nodes (smaller) */
- byte Stack[HSIZE + 2]; /* also s-f distance_nodes (smaller) */
- } shrink;
- byte Slide[WSIZE];
- };
-#endif
- extern union work area;
-
-# define prefix_of area.shrink.Prefix_of
-# define suffix_of area.shrink.Suffix_of
-# define stack area.shrink.Stack
-# define slide area.Slide
-
- extern ULONG crc32val;
- extern UWORD mask_bits[];
- extern int bits_left;
- extern ULONG bitbuf;
- extern boolean zipeof;
-
diff --git a/source/unzip/unzip.c b/source/unzip/unzip.c
deleted file mode 100644
index 54695c2..0000000
--- a/source/unzip/unzip.c
+++ /dev/null
@@ -1,1224 +0,0 @@
-/*
- * unzip.c -- IO on .zip files using zlib Version 0.15 beta, Mar 19th, 1998,
- *
- * Read unzip.h for more info
- */
-
-
-//#include <stdio.h>
-//#include <stdlib.h>
-#include "fs_api.h"
-#include "ds2_malloc.h"
-#include <string.h>
-#include "zlib.h"
-#include "unzip.h"
-#include "unzipP.h"
-
-#ifdef STDC
-//#include <stddef.h>
-//#include <string.h>
-//#include <stdlib.h>
-#endif
-
-#ifdef NO_ERRNO_H
-extern int errno;
-#else
-#include <errno.h>
-#endif
-
-const char unz_copyright[] =
-" unzip 0.15 Copyright 1998 Gilles Vollant ";
-
-void unShrink ();
-void unReduce ();
-int explode ();
-
-/*
- * ===========================================================================
- * Read a byte from a gz_stream; update next_in and avail_in. Return EOF for
- * end of file. IN assertion: the stream s has been sucessfully opened for
- * reading.
- */
-
-
-local int
-unzlocal_getByte (FILE * fin, int *pi)
-{
- unsigned char c;
- int err = fread (&c, 1, 1, fin);
- if (err == 1)
- {
- *pi = (int) c;
- return UNZ_OK;
- } else
- {
- if (ferror (fin))
- return UNZ_ERRNO;
- else
- return UNZ_EOF;
- }
-}
-
-
-/*
- * ===========================================================================
- * Reads a long in LSB order from the given gz_stream. Sets
- */
-local int
-unzlocal_getShort (FILE * fin, uLong * pX)
-{
- uLong x;
- int i;
- int err;
-
- err = unzlocal_getByte (fin, &i);
- x = (uLong) i;
-
- if (err == UNZ_OK)
- err = unzlocal_getByte (fin, &i);
- x += ((uLong) i) << 8;
-
- if (err == UNZ_OK)
- *pX = x;
- else
- *pX = 0;
- return err;
-}
-
-local int
-unzlocal_getLong (FILE * fin, uLong * pX)
-{
- uLong x;
- int i;
- int err;
-
- err = unzlocal_getByte (fin, &i);
- x = (uLong) i;
-
- if (err == UNZ_OK)
- err = unzlocal_getByte (fin, &i);
- x += ((uLong) i) << 8;
-
- if (err == UNZ_OK)
- err = unzlocal_getByte (fin, &i);
- x += ((uLong) i) << 16;
-
- if (err == UNZ_OK)
- err = unzlocal_getByte (fin, &i);
- x += ((uLong) i) << 24;
-
- if (err == UNZ_OK)
- *pX = x;
- else
- *pX = 0;
- return err;
-}
-
-
-/* My own strcmpi / strcasecmp */
-local int
-strcmpcasenosensitive_internal (const char *fileName1, const char *fileName2)
-{
- for (;;)
- {
- char c1 = *(fileName1++);
- char c2 = *(fileName2++);
- if ((c1 >= 'a') && (c1 <= 'z'))
- c1 -= 0x20;
- if ((c2 >= 'a') && (c2 <= 'z'))
- c2 -= 0x20;
- if (c1 == '\0')
- return ((c2 == '\0') ? 0 : -1);
- if (c2 == '\0')
- return 1;
- if (c1 < c2)
- return -1;
- if (c1 > c2)
- return 1;
- }
-}
-
-
-#ifdef CASESENSITIVITYDEFAULT_NO
-#define CASESENSITIVITYDEFAULTVALUE 2
-#else
-#define CASESENSITIVITYDEFAULTVALUE 1
-#endif
-
-#ifndef STRCMPCASENOSENTIVEFUNCTION
-#define STRCMPCASENOSENTIVEFUNCTION strcmpcasenosensitive_internal
-#endif
-
-/*
- * Compare two filename (fileName1,fileName2). If iCaseSenisivity = 1,
- * comparision is case sensitivity (like strcmp) If iCaseSenisivity = 2,
- * comparision is not case sensitivity (like strcmpi or strcasecmp) If
- * iCaseSenisivity = 0, case sensitivity is defaut of your operating system
- * (like 1 on Unix, 2 on Windows)
- *
- */
-extern int ZEXPORT
-unzStringFileNameCompare (const char *fileName1, const char *fileName2, int iCaseSensitivity)
-{
- if (iCaseSensitivity == 0)
- iCaseSensitivity = CASESENSITIVITYDEFAULTVALUE;
-
- if (iCaseSensitivity == 1)
- return strcmp (fileName1, fileName2);
-
- return STRCMPCASENOSENTIVEFUNCTION (fileName1, fileName2);
-}
-
-#define BUFREADCOMMENT (0x400)
-
-/*
- * Locate the Central directory of a zipfile (at the end, just before the
- * global comment)
- */
-local uLong
-unzlocal_SearchCentralDir (FILE * fin)
-{
- unsigned char *buf;
- uLong uSizeFile;
- uLong uBackRead;
- uLong uMaxBack = 0xffff; /* maximum size of global comment */
- uLong uPosFound = 0;
-
- if (fseek (fin, 0, SEEK_END) != 0)
- return 0;
-
- uSizeFile = ftell (fin);
-
- if (uMaxBack > uSizeFile)
- uMaxBack = uSizeFile;
-
- buf = (unsigned char *) ALLOC (BUFREADCOMMENT + 4);
- if (buf == NULL)
- return 0;
-
- uBackRead = 4;
- while (uBackRead < uMaxBack)
- {
- uLong uReadSize, uReadPos;
- int i;
- if (uBackRead + BUFREADCOMMENT > uMaxBack)
- uBackRead = uMaxBack;
- else
- uBackRead += BUFREADCOMMENT;
- uReadPos = uSizeFile - uBackRead;
-
- uReadSize = ((BUFREADCOMMENT + 4) < (uSizeFile - uReadPos)) ?
- (BUFREADCOMMENT + 4) : (uSizeFile - uReadPos);
- if (fseek (fin, uReadPos, SEEK_SET) != 0)
- break;
-
- if (fread (buf, (uInt) uReadSize, 1, fin) != 1)
- break;
-
- for (i = 0; i < (int) uReadSize - 3; i++)
- if (((*(buf + i)) == 0x50) && ((*(buf + i + 1)) == 0x4b) &&
- ((*(buf + i + 2)) == 0x05) && ((*(buf + i + 3)) == 0x06))
- {
- uPosFound = uReadPos + i;
- break;
- }
- if (uPosFound != 0)
- break;
- }
- TRYFREE (buf);
- return uPosFound;
-}
-
-/*
- * Open a Zip file. path contain the full pathname (by example, on a Windows
- * NT computer "c:\\test\\zlib109.zip" or on an Unix computer
- * "zlib/zlib109.zip". If the zipfile cannot be opened (file don't exist or
- * in not valid), the return value is NULL. Else, the return value is a
- * unzFile Handle, usable with other function of this unzip package.
- */
-extern unzFile ZEXPORT
-unzOpen (const char *path)
-{
- unz_s us;
- unz_s *s;
- uLong central_pos, uL;
- FILE *fin;
-
- uLong number_disk;/* number of the current dist, used for
- * spaning ZIP, unsupported, always 0 */
- uLong number_disk_with_CD; /* number the the disk with
- * central dir, used for
- * spaning ZIP, unsupported,
- * always 0 */
- uLong number_entry_CD; /* total number of entries in the
- * central dir (same than
- * number_entry on nospan) */
-
- int err = UNZ_OK;
-
- if (unz_copyright[0] != ' ')
- return NULL;
-
- fin = fopen (path, "rb");
- if (fin == NULL)
- return NULL;
-
- central_pos = unzlocal_SearchCentralDir (fin);
- if (central_pos == 0)
- err = UNZ_ERRNO;
-
- if (fseek (fin, central_pos, SEEK_SET) != 0)
- err = UNZ_ERRNO;
-
- /* the signature, already checked */
- if (unzlocal_getLong (fin, &uL) != UNZ_OK)
- err = UNZ_ERRNO;
-
- /* number of this disk */
- if (unzlocal_getShort (fin, &number_disk) != UNZ_OK)
- err = UNZ_ERRNO;
-
- /* number of the disk with the start of the central directory */
- if (unzlocal_getShort (fin, &number_disk_with_CD) != UNZ_OK)
- err = UNZ_ERRNO;
-
- /* total number of entries in the central dir on this disk */
- if (unzlocal_getShort (fin, &us.gi.number_entry) != UNZ_OK)
- err = UNZ_ERRNO;
-
- /* total number of entries in the central dir */
- if (unzlocal_getShort (fin, &number_entry_CD) != UNZ_OK)
- err = UNZ_ERRNO;
-
- if ((number_entry_CD != us.gi.number_entry) ||
- (number_disk_with_CD != 0) ||
- (number_disk != 0))
- err = UNZ_BADZIPFILE;
-
- /* size of the central directory */
- if (unzlocal_getLong (fin, &us.size_central_dir) != UNZ_OK)
- err = UNZ_ERRNO;
-
- /*
- * offset of start of central directory with respect to the starting disk
- * number
- */
- if (unzlocal_getLong (fin, &us.offset_central_dir) != UNZ_OK)
- err = UNZ_ERRNO;
-
- /* zipfile comment length */
- if (unzlocal_getShort (fin, &us.gi.size_comment) != UNZ_OK)
- err = UNZ_ERRNO;
-
- if ((central_pos < us.offset_central_dir + us.size_central_dir) &&
- (err == UNZ_OK))
- err = UNZ_BADZIPFILE;
-
- if (err != UNZ_OK)
- {
- fclose (fin);
- return NULL;
- }
- us.file = fin;
- us.byte_before_the_zipfile = central_pos -
- (us.offset_central_dir + us.size_central_dir);
- us.central_pos = central_pos;
- us.pfile_in_zip_read = NULL;
-
-
- s = (unz_s *) ALLOC (sizeof (unz_s));
- *s = us;
- unzGoToFirstFile ((unzFile) s);
- return (unzFile) s;
-}
-
-
-/*
- * Close a ZipFile opened with unzipOpen. If there is files inside the .Zip
- * opened with unzipOpenCurrentFile (see later), these files MUST be closed
- * with unzipCloseCurrentFile before call unzipClose. return UNZ_OK if there
- * is no problem.
- */
-extern int ZEXPORT
-unzClose (unzFile file)
-{
- unz_s *s;
- if (file == NULL)
- return UNZ_PARAMERROR;
- s = (unz_s *) file;
-
- if (s->pfile_in_zip_read != NULL)
- unzCloseCurrentFile (file);
-
- fclose (s->file);
- TRYFREE (s);
- return UNZ_OK;
-}
-
-
-/*
- * Write info about the ZipFile in the *pglobal_info structure. No
- * preparation of the structure is needed return UNZ_OK if there is no
- * problem.
- */
-extern int ZEXPORT
-unzGetGlobalInfo (unzFile file, unz_global_info * pglobal_info)
-{
- unz_s *s;
- if (file == NULL)
- return UNZ_PARAMERROR;
- s = (unz_s *) file;
- *pglobal_info = s->gi;
- return UNZ_OK;
-}
-
-
-/*
- * Translate date/time from Dos format to tm_unz (readable more easilty)
- */
-local void
-unzlocal_DosDateToTmuDate (uLong ulDosDate, tm_unz * ptm)
-{
- uLong uDate;
- uDate = (uLong) (ulDosDate >> 16);
- ptm->tm_mday = (uInt) (uDate & 0x1f);
- ptm->tm_mon = (uInt) ((((uDate) & 0x1E0) / 0x20) - 1);
- ptm->tm_year = (uInt) (((uDate & 0x0FE00) / 0x0200) + 1980);
-
- ptm->tm_hour = (uInt) ((ulDosDate & 0xF800) / 0x800);
- ptm->tm_min = (uInt) ((ulDosDate & 0x7E0) / 0x20);
- ptm->tm_sec = (uInt) (2 * (ulDosDate & 0x1f));
-}
-
-/*
- * Get Info about the current file in the zipfile, with internal only info
- */
-local int unzlocal_GetCurrentFileInfoInternal
-OF ((unzFile file,
- unz_file_info * pfile_info,
- unz_file_info_internal
- * pfile_info_internal,
- char *szFileName,
- uLong fileNameBufferSize,
- void *extraField,
- uLong extraFieldBufferSize,
- char *szComment,
- uLong commentBufferSize));
-
- local int unzlocal_GetCurrentFileInfoInternal (
- unzFile file,
- unz_file_info * pfile_info,
- unz_file_info_internal * pfile_info_internal,
- char *szFileName,
- uLong fileNameBufferSize,
- void *extraField,
- uLong extraFieldBufferSize,
- char *szComment,
- uLong commentBufferSize)
-{
- unz_s *s;
- unz_file_info file_info;
- unz_file_info_internal file_info_internal;
- int err = UNZ_OK;
- uLong uMagic;
- long lSeek = 0;
-
- if (file == NULL)
- return UNZ_PARAMERROR;
- s = (unz_s *) file;
- if (fseek (s->file, s->pos_in_central_dir + s->byte_before_the_zipfile, SEEK_SET) != 0)
- err = UNZ_ERRNO;
-
-
- /* we check the magic */
- if (err == UNZ_OK)
- {
- if (unzlocal_getLong (s->file, &uMagic) != UNZ_OK)
- err = UNZ_ERRNO;
- else if (uMagic != 0x02014b50)
- err = UNZ_BADZIPFILE;
- }
- if (unzlocal_getShort (s->file, &file_info.version) != UNZ_OK)
- err = UNZ_ERRNO;
-
- if (unzlocal_getShort (s->file, &file_info.version_needed) != UNZ_OK)
- err = UNZ_ERRNO;
-
- if (unzlocal_getShort (s->file, &file_info.flag) != UNZ_OK)
- err = UNZ_ERRNO;
-
- if (unzlocal_getShort (s->file, &file_info.compression_method) != UNZ_OK)
- err = UNZ_ERRNO;
-
- if (unzlocal_getLong (s->file, &file_info.dosDate) != UNZ_OK)
- err = UNZ_ERRNO;
-
- unzlocal_DosDateToTmuDate (file_info.dosDate, &file_info.tmu_date);
-
- if (unzlocal_getLong (s->file, &file_info.crc) != UNZ_OK)
- err = UNZ_ERRNO;
-
- if (unzlocal_getLong (s->file, &file_info.compressed_size) != UNZ_OK)
- err = UNZ_ERRNO;
-
- if (unzlocal_getLong (s->file, &file_info.uncompressed_size) != UNZ_OK)
- err = UNZ_ERRNO;
-
- if (unzlocal_getShort (s->file, &file_info.size_filename) != UNZ_OK)
- err = UNZ_ERRNO;
-
- if (unzlocal_getShort (s->file, &file_info.size_file_extra) != UNZ_OK)
- err = UNZ_ERRNO;
-
- if (unzlocal_getShort (s->file, &file_info.size_file_comment) != UNZ_OK)
- err = UNZ_ERRNO;
-
- if (unzlocal_getShort (s->file, &file_info.disk_num_start) != UNZ_OK)
- err = UNZ_ERRNO;
-
- if (unzlocal_getShort (s->file, &file_info.internal_fa) != UNZ_OK)
- err = UNZ_ERRNO;
-
- if (unzlocal_getLong (s->file, &file_info.external_fa) != UNZ_OK)
- err = UNZ_ERRNO;
-
- if (unzlocal_getLong (s->file, &file_info_internal.offset_curfile) != UNZ_OK)
- err = UNZ_ERRNO;
-
- lSeek += file_info.size_filename;
- if ((err == UNZ_OK) && (szFileName != NULL))
- {
- uLong uSizeRead;
- if (file_info.size_filename < fileNameBufferSize)
- {
- *(szFileName + file_info.size_filename) = '\0';
- uSizeRead = file_info.size_filename;
- } else
- uSizeRead = fileNameBufferSize;
-
- if ((file_info.size_filename > 0) && (fileNameBufferSize > 0))
- if (fread (szFileName, (uInt) uSizeRead, 1, s->file) != 1)
- err = UNZ_ERRNO;
- lSeek -= uSizeRead;
- }
- if ((err == UNZ_OK) && (extraField != NULL))
- {
- uLong uSizeRead;
- if (file_info.size_file_extra < extraFieldBufferSize)
- uSizeRead = file_info.size_file_extra;
- else
- uSizeRead = extraFieldBufferSize;
-
- if (lSeek != 0)
- {
- if (fseek (s->file, lSeek, SEEK_CUR) == 0)
- lSeek = 0;
- else
- err = UNZ_ERRNO;
- }
- if ((file_info.size_file_extra > 0) && (extraFieldBufferSize > 0))
- if (fread (extraField, (uInt) uSizeRead, 1, s->file) != 1)
- err = UNZ_ERRNO;
- lSeek += file_info.size_file_extra - uSizeRead;
- } else
- lSeek += file_info.size_file_extra;
-
-
- if ((err == UNZ_OK) && (szComment != NULL))
- {
- uLong uSizeRead;
- if (file_info.size_file_comment < commentBufferSize)
- {
- *(szComment + file_info.size_file_comment) = '\0';
- uSizeRead = file_info.size_file_comment;
- } else
- uSizeRead = commentBufferSize;
-
- if (lSeek != 0)
- {
- if (fseek (s->file, lSeek, SEEK_CUR) == 0)
- lSeek = 0;
- else
- err = UNZ_ERRNO;
- }
- if ((file_info.size_file_comment > 0) && (commentBufferSize > 0))
- if (fread (szComment, (uInt) uSizeRead, 1, s->file) != 1)
- err = UNZ_ERRNO;
- lSeek += file_info.size_file_comment - uSizeRead;
- } else
- lSeek += file_info.size_file_comment;
-
- if ((err == UNZ_OK) && (pfile_info != NULL))
- *pfile_info = file_info;
-
- if ((err == UNZ_OK) && (pfile_info_internal != NULL))
- *pfile_info_internal = file_info_internal;
-
- return err;
-}
-
-
-
-/*
- * Write info about the ZipFile in the *pglobal_info structure. No
- * preparation of the structure is needed return UNZ_OK if there is no
- * problem.
- */
-extern int ZEXPORT
-unzGetCurrentFileInfo (
- unzFile file,
- unz_file_info * pfile_info,
- char *szFileName,
- uLong fileNameBufferSize,
- void *extraField,
- uLong extraFieldBufferSize,
- char *szComment,
- uLong commentBufferSize)
-{
- return unzlocal_GetCurrentFileInfoInternal (file, pfile_info, NULL,
- szFileName, fileNameBufferSize,
- extraField, extraFieldBufferSize,
- szComment, commentBufferSize);
-}
-
-/*
- * Set the current file of the zipfile to the first file. return UNZ_OK if
- * there is no problem
- */
-extern int ZEXPORT
-unzGoToFirstFile (unzFile file)
-{
- int err = UNZ_OK;
- unz_s *s;
- if (file == NULL)
- return UNZ_PARAMERROR;
- s = (unz_s *) file;
- s->pos_in_central_dir = s->offset_central_dir;
- s->num_file = 0;
- err = unzlocal_GetCurrentFileInfoInternal (file, &s->cur_file_info,
- &s->cur_file_info_internal,
- NULL, 0, NULL, 0, NULL, 0);
- s->current_file_ok = (err == UNZ_OK);
- return err;
-}
-
-
-/*
- * Set the current file of the zipfile to the next file. return UNZ_OK if
- * there is no problem return UNZ_END_OF_LIST_OF_FILE if the actual file was
- * the latest.
- */
-extern int ZEXPORT
-unzGoToNextFile (unzFile file)
-{
- unz_s *s;
- int err;
-
- if (file == NULL)
- return UNZ_PARAMERROR;
- s = (unz_s *) file;
- if (!s->current_file_ok)
- return UNZ_END_OF_LIST_OF_FILE;
- if (s->num_file + 1 == s->gi.number_entry)
- return UNZ_END_OF_LIST_OF_FILE;
-
- s->pos_in_central_dir += SIZECENTRALDIRITEM + s->cur_file_info.size_filename +
- s->cur_file_info.size_file_extra + s->cur_file_info.size_file_comment;
- s->num_file++;
- err = unzlocal_GetCurrentFileInfoInternal (file, &s->cur_file_info,
- &s->cur_file_info_internal,
- NULL, 0, NULL, 0, NULL, 0);
- s->current_file_ok = (err == UNZ_OK);
- return err;
-}
-
-
-/*
- * Try locate the file szFileName in the zipfile. For the iCaseSensitivity
- * signification, see unzipStringFileNameCompare
- *
- * return value : UNZ_OK if the file is found. It becomes the current file.
- * UNZ_END_OF_LIST_OF_FILE if the file is not found
- */
-extern int ZEXPORT
-unzLocateFile (
- unzFile file,
- const char *szFileName,
- int iCaseSensitivity)
-{
- unz_s *s;
- int err;
-
-
- uLong num_fileSaved;
- uLong pos_in_central_dirSaved;
-
-
- if (file == NULL)
- return UNZ_PARAMERROR;
-
- if (strlen (szFileName) >= UNZ_MAXFILENAMEINZIP)
- return UNZ_PARAMERROR;
-
- s = (unz_s *) file;
- if (!s->current_file_ok)
- return UNZ_END_OF_LIST_OF_FILE;
-
- num_fileSaved = s->num_file;
- pos_in_central_dirSaved = s->pos_in_central_dir;
-
- err = unzGoToFirstFile (file);
-
- while (err == UNZ_OK)
- {
- char szCurrentFileName[UNZ_MAXFILENAMEINZIP + 1];
- unzGetCurrentFileInfo (file, NULL,
- szCurrentFileName, sizeof (szCurrentFileName) - 1,
- NULL, 0, NULL, 0);
- if (unzStringFileNameCompare (szCurrentFileName,
- szFileName, iCaseSensitivity) == 0)
- return UNZ_OK;
- err = unzGoToNextFile (file);
- }
-
- s->num_file = num_fileSaved;
- s->pos_in_central_dir = pos_in_central_dirSaved;
- return err;
-}
-
-
-/*
- * Read the local header of the current zipfile Check the coherency of the
- * local header and info in the end of central directory about this file
- * store in *piSizeVar the size of extra info in local header (filename and
- * size of extra field data)
- */
-local int
-unzlocal_CheckCurrentFileCoherencyHeader (
- unz_s * s,
- uInt * piSizeVar,
- uLong * poffset_local_extrafield,
- uInt * psize_local_extrafield)
-{
- uLong uMagic, uData, uFlags;
- uLong size_filename;
- uLong size_extra_field;
- int err = UNZ_OK;
-
- *piSizeVar = 0;
- *poffset_local_extrafield = 0;
- *psize_local_extrafield = 0;
-
- if (fseek (s->file, s->cur_file_info_internal.offset_curfile +
- s->byte_before_the_zipfile, SEEK_SET) != 0)
- return UNZ_ERRNO;
-
-
- if (err == UNZ_OK)
- {
- if (unzlocal_getLong (s->file, &uMagic) != UNZ_OK)
- err = UNZ_ERRNO;
- else if (uMagic != 0x04034b50)
- err = UNZ_BADZIPFILE;
- }
-
- if (unzlocal_getShort (s->file, &uData) != UNZ_OK)
- err = UNZ_ERRNO;
- /*
- * else if ((err==UNZ_OK) && (uData!=s->cur_file_info.wVersion))
- * err=UNZ_BADZIPFILE;
- */
- if (unzlocal_getShort (s->file, &uFlags) != UNZ_OK)
- err = UNZ_ERRNO;
-
- if (unzlocal_getShort (s->file, &uData) != UNZ_OK)
- err = UNZ_ERRNO;
- else if ((err == UNZ_OK) && (uData != s->cur_file_info.compression_method))
- err = UNZ_BADZIPFILE;
-
- if ((err == UNZ_OK) &&
- s->cur_file_info.compression_method > Z_DEFLATED)
- err = UNZ_BADZIPFILE;
-
- if (unzlocal_getLong (s->file, &uData) != UNZ_OK) /* date/time */
- err = UNZ_ERRNO;
-
- if (unzlocal_getLong (s->file, &uData) != UNZ_OK) /* crc */
- err = UNZ_ERRNO;
- else if ((err == UNZ_OK) && (uData != s->cur_file_info.crc) &&
- ((uFlags & 8) == 0))
- err = UNZ_BADZIPFILE;
-
- if (unzlocal_getLong (s->file, &uData) != UNZ_OK) /* size compr */
- err = UNZ_ERRNO;
- else if ((err == UNZ_OK) && (uData != s->cur_file_info.compressed_size) &&
- ((uFlags & 8) == 0))
- err = UNZ_BADZIPFILE;
-
- if (unzlocal_getLong (s->file, &uData) != UNZ_OK) /* size uncompr */
- err = UNZ_ERRNO;
- else if ((err == UNZ_OK) && (uData != s->cur_file_info.uncompressed_size) &&
- ((uFlags & 8) == 0))
- err = UNZ_BADZIPFILE;
-
-
- if (unzlocal_getShort (s->file, &size_filename) != UNZ_OK)
- err = UNZ_ERRNO;
- else if ((err == UNZ_OK) && (size_filename != s->cur_file_info.size_filename))
- err = UNZ_BADZIPFILE;
-
- *piSizeVar += (uInt) size_filename;
-
- if (unzlocal_getShort (s->file, &size_extra_field) != UNZ_OK)
- err = UNZ_ERRNO;
- *poffset_local_extrafield = s->cur_file_info_internal.offset_curfile +
- SIZEZIPLOCALHEADER + size_filename;
- *psize_local_extrafield = (uInt) size_extra_field;
-
- *piSizeVar += (uInt) size_extra_field;
-
- return err;
-}
-
-/*
- * Open for reading data the current file in the zipfile. If there is no
- * error and the file is opened, the return value is UNZ_OK.
- */
-extern int ZEXPORT
-unzOpenCurrentFile (unzFile file)
-{
- int err = UNZ_OK;
- uInt iSizeVar;
- unz_s *s;
- file_in_zip_read_info_s *pfile_in_zip_read_info;
- uLong offset_local_extrafield; /* offset of the local extra
- * field */
- uInt size_local_extrafield; /* size of the local extra
- * field */
-
- if (file == NULL)
- return UNZ_PARAMERROR;
- s = (unz_s *) file;
- if (!s->current_file_ok)
- return UNZ_PARAMERROR;
-
- if (s->pfile_in_zip_read != NULL)
- unzCloseCurrentFile (file);
-
- if (unzlocal_CheckCurrentFileCoherencyHeader (s, &iSizeVar,
- &offset_local_extrafield, &size_local_extrafield) != UNZ_OK)
- return UNZ_BADZIPFILE;
-
- pfile_in_zip_read_info = (file_in_zip_read_info_s *)
- ALLOC (sizeof (file_in_zip_read_info_s));
- if (pfile_in_zip_read_info == NULL)
- return UNZ_INTERNALERROR;
-
- pfile_in_zip_read_info->read_buffer = (char *) ALLOC (UNZ_BUFSIZE);
- pfile_in_zip_read_info->offset_local_extrafield = offset_local_extrafield;
- pfile_in_zip_read_info->size_local_extrafield = size_local_extrafield;
- pfile_in_zip_read_info->pos_local_extrafield = 0;
-
- if (pfile_in_zip_read_info->read_buffer == NULL)
- {
- TRYFREE (pfile_in_zip_read_info);
- return UNZ_INTERNALERROR;
- }
- pfile_in_zip_read_info->stream_initialised = 0;
-
- if (s->cur_file_info.compression_method > Z_DEFLATED)
- err = UNZ_BADZIPFILE;
-
- pfile_in_zip_read_info->crc32_wait = s->cur_file_info.crc;
- pfile_in_zip_read_info->crc32 = 0;
- pfile_in_zip_read_info->compression_method =
- s->cur_file_info.compression_method;
- pfile_in_zip_read_info->file = s->file;
- pfile_in_zip_read_info->byte_before_the_zipfile = s->byte_before_the_zipfile;
-
- pfile_in_zip_read_info->stream.total_out = 0;
-
- switch (s->cur_file_info.compression_method)
- {
- case UNZ_STORED:
- break;
- case UNZ_SHRUNK:
- break;
- case UNZ_REDUCED1:
- case UNZ_REDUCED2:
- case UNZ_REDUCED3:
- case UNZ_REDUCED4:
- break;
- case UNZ_IMPLODED:
- break;
- case UNZ_DEFLATED:
- pfile_in_zip_read_info->stream.zalloc = (alloc_func) 0;
- pfile_in_zip_read_info->stream.zfree = (free_func) 0;
- pfile_in_zip_read_info->stream.opaque = (voidpf) 0;
-
- err = inflateInit2 (&pfile_in_zip_read_info->stream, -MAX_WBITS);
- if (err == Z_OK)
- pfile_in_zip_read_info->stream_initialised = 1;
- /*
- * windowBits is passed < 0 to tell that there is no zlib header.
- * Note that in this case inflate *requires* an extra "dummy" byte
- * after the compressed stream in order to complete decompression and
- * return Z_STREAM_END. In unzip, i don't wait absolutely
- * Z_STREAM_END because I known the size of both compressed and
- * uncompressed data
- */
- break;
- default:
- return UNZ_INTERNALERROR;
- break;
- }
- pfile_in_zip_read_info->rest_read_compressed =
- s->cur_file_info.compressed_size;
- pfile_in_zip_read_info->rest_read_uncompressed =
- s->cur_file_info.uncompressed_size;
-
- pfile_in_zip_read_info->pos_in_zipfile =
- s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER +
- iSizeVar;
-
- pfile_in_zip_read_info->stream.avail_in = (uInt) 0;
- s->pfile_in_zip_read = pfile_in_zip_read_info;
- return UNZ_OK;
-}
-
-
-/*
- * Read bytes from the current file. buf contain buffer where data must be
- * copied len the size of buf.
- *
- * return the number of byte copied if somes bytes are copied return 0 if the
- * end of file was reached return <0 with error code if there is an error
- * (UNZ_ERRNO for IO error, or zLib error for uncompress error)
- */
-
-file_in_zip_read_info_s *pfile_in_zip_read_info = NULL;
-unz_s *pUnzip = NULL;
-extern int ZEXPORT
-unzReadCurrentFile (
- unzFile file,
- voidp buf,
- unsigned len)
-{
- int err = UNZ_OK;
- uInt iRead = 0;
- unz_s *s;
- if (file == NULL)
- return UNZ_PARAMERROR;
- s = (unz_s *) file;
- pUnzip = s;
- pfile_in_zip_read_info = s->pfile_in_zip_read;
-
- if (pfile_in_zip_read_info == NULL)
- return UNZ_PARAMERROR;
-
-
- if ((pfile_in_zip_read_info->read_buffer == NULL))
- return UNZ_END_OF_LIST_OF_FILE;
- if (len == 0)
- return 0;
-
- pfile_in_zip_read_info->stream.next_out = (Bytef *) buf;
-
- pfile_in_zip_read_info->stream.avail_out = (uInt) len;
-
- if (len > pfile_in_zip_read_info->rest_read_uncompressed)
- pfile_in_zip_read_info->stream.avail_out =
- (uInt) pfile_in_zip_read_info->rest_read_uncompressed;
-
- while (pfile_in_zip_read_info->stream.avail_out > 0 && err == UNZ_OK)
- {
- switch (pfile_in_zip_read_info->compression_method)
- {
- case UNZ_STORED:
- case UNZ_DEFLATED:
- if ((pfile_in_zip_read_info->stream.avail_in == 0) &&
- (pfile_in_zip_read_info->rest_read_compressed > 0))
- {
- uInt uReadThis = UNZ_BUFSIZE;
- if (pfile_in_zip_read_info->rest_read_compressed < uReadThis)
- uReadThis = (uInt) pfile_in_zip_read_info->rest_read_compressed;
- if (uReadThis == 0)
- return UNZ_EOF;
- if (fseek (pfile_in_zip_read_info->file,
- pfile_in_zip_read_info->pos_in_zipfile +
- pfile_in_zip_read_info->byte_before_the_zipfile, SEEK_SET) != 0)
- return UNZ_ERRNO;
- if (fread (pfile_in_zip_read_info->read_buffer, uReadThis, 1,
- pfile_in_zip_read_info->file) != 1)
- return UNZ_ERRNO;
- pfile_in_zip_read_info->pos_in_zipfile += uReadThis;
-
- pfile_in_zip_read_info->rest_read_compressed -= uReadThis;
-
- pfile_in_zip_read_info->stream.next_in =
- (Bytef *) pfile_in_zip_read_info->read_buffer;
- pfile_in_zip_read_info->stream.avail_in = (uInt) uReadThis;
- }
- break;
- }
- switch (pfile_in_zip_read_info->compression_method)
- {
- case UNZ_STORED:
- {
- uInt uDoCopy, i;
- if (pfile_in_zip_read_info->stream.avail_out <
- pfile_in_zip_read_info->stream.avail_in)
- uDoCopy = pfile_in_zip_read_info->stream.avail_out;
- else
- uDoCopy = pfile_in_zip_read_info->stream.avail_in;
-
- for (i = 0; i < uDoCopy; i++)
- *(pfile_in_zip_read_info->stream.next_out + i) =
- *(pfile_in_zip_read_info->stream.next_in + i);
-
- pfile_in_zip_read_info->crc32 = crc32 (pfile_in_zip_read_info->crc32,
- pfile_in_zip_read_info->stream.next_out,
- uDoCopy);
- pfile_in_zip_read_info->rest_read_uncompressed -= uDoCopy;
- pfile_in_zip_read_info->stream.avail_in -= uDoCopy;
- pfile_in_zip_read_info->stream.avail_out -= uDoCopy;
- pfile_in_zip_read_info->stream.next_out += uDoCopy;
- pfile_in_zip_read_info->stream.next_in += uDoCopy;
- pfile_in_zip_read_info->stream.total_out += uDoCopy;
- iRead += uDoCopy;
- break;
- }
- case UNZ_SHRUNK:
- iRead = pfile_in_zip_read_info->rest_read_uncompressed;
- unShrink ();
- break;
- case UNZ_REDUCED1:
- case UNZ_REDUCED2:
- case UNZ_REDUCED3:
- case UNZ_REDUCED4:
- iRead = pfile_in_zip_read_info->rest_read_uncompressed;
- unReduce ();
- break;
- case UNZ_IMPLODED:
- iRead = pfile_in_zip_read_info->rest_read_uncompressed;
- err = explode ();
- break;
- case UNZ_DEFLATED:
- {
- uLong uTotalOutBefore, uTotalOutAfter;
- const Bytef *bufBefore;
- uLong uOutThis;
- int flush = Z_SYNC_FLUSH;
-
- uTotalOutBefore = pfile_in_zip_read_info->stream.total_out;
- bufBefore = pfile_in_zip_read_info->stream.next_out;
-
- /*
- * if ((pfile_in_zip_read_info->rest_read_uncompressed ==
- * pfile_in_zip_read_info->stream.avail_out) &&
- * (pfile_in_zip_read_info->rest_read_compressed == 0)) flush =
- * Z_FINISH;
- */
- err = inflate (&pfile_in_zip_read_info->stream, flush);
-
- uTotalOutAfter = pfile_in_zip_read_info->stream.total_out;
- uOutThis = uTotalOutAfter - uTotalOutBefore;
-
- pfile_in_zip_read_info->crc32 =
- crc32 (pfile_in_zip_read_info->crc32, bufBefore,
- (uInt) (uOutThis));
-
- pfile_in_zip_read_info->rest_read_uncompressed -=
- uOutThis;
-
- iRead += (uInt) (uTotalOutAfter - uTotalOutBefore);
-
- if (err == Z_STREAM_END)
- return (iRead == 0) ? UNZ_EOF : iRead;
- if (err != Z_OK)
- break;
- break;
- }
- default:
- return (UNZ_EOF);
- }
- }
-
- if (err == Z_OK)
- return iRead;
- return err;
-}
-
-
-/*
- * Give the current position in uncompressed data
- */
-extern z_off_t ZEXPORT
-unztell (unzFile file)
-{
- unz_s *s;
- file_in_zip_read_info_s *pfile_in_zip_read_info;
- if (file == NULL)
- return UNZ_PARAMERROR;
- s = (unz_s *) file;
- pfile_in_zip_read_info = s->pfile_in_zip_read;
-
- if (pfile_in_zip_read_info == NULL)
- return UNZ_PARAMERROR;
-
- return (z_off_t) pfile_in_zip_read_info->stream.total_out;
-}
-
-
-/*
- * return 1 if the end of file was reached, 0 elsewhere
- */
-extern int ZEXPORT
-unzeof (unzFile file)
-{
- unz_s *s;
- file_in_zip_read_info_s *pfile_in_zip_read_info;
- if (file == NULL)
- return UNZ_PARAMERROR;
- s = (unz_s *) file;
- pfile_in_zip_read_info = s->pfile_in_zip_read;
-
- if (pfile_in_zip_read_info == NULL)
- return UNZ_PARAMERROR;
-
- if (pfile_in_zip_read_info->rest_read_uncompressed == 0)
- return 1;
- else
- return 0;
-}
-
-
-
-/*
- * Read extra field from the current file (opened by unzOpenCurrentFile) This
- * is the local-header version of the extra field (sometimes, there is more
- * info in the local-header version than in the central-header)
- *
- * if buf==NULL, it return the size of the local extra field that can be read
- *
- * if buf!=NULL, len is the size of the buffer, the extra header is copied in
- * buf. the return value is the number of bytes copied in buf, or (if <0) the
- * error code
- */
-extern int ZEXPORT
-unzGetLocalExtrafield (
- unzFile file,
- voidp buf,
- unsigned len)
-{
- unz_s *s;
- file_in_zip_read_info_s *pfile_in_zip_read_info;
- uInt read_now;
- uLong size_to_read;
-
- if (file == NULL)
- return UNZ_PARAMERROR;
- s = (unz_s *) file;
- pfile_in_zip_read_info = s->pfile_in_zip_read;
-
- if (pfile_in_zip_read_info == NULL)
- return UNZ_PARAMERROR;
-
- size_to_read = (pfile_in_zip_read_info->size_local_extrafield -
- pfile_in_zip_read_info->pos_local_extrafield);
-
- if (buf == NULL)
- return (int) size_to_read;
-
- if (len > size_to_read)
- read_now = (uInt) size_to_read;
- else
- read_now = (uInt) len;
-
- if (read_now == 0)
- return 0;
-
- if (fseek (pfile_in_zip_read_info->file,
- pfile_in_zip_read_info->offset_local_extrafield +
- pfile_in_zip_read_info->pos_local_extrafield, SEEK_SET) != 0)
- return UNZ_ERRNO;
-
- if (fread (buf, (uInt) size_to_read, 1, pfile_in_zip_read_info->file) != 1)
- return UNZ_ERRNO;
-
- return (int) read_now;
-}
-
-/*
- * Close the file in zip opened with unzipOpenCurrentFile Return UNZ_CRCERROR
- * if all the file was read but the CRC is not good
- */
-extern int ZEXPORT
-unzCloseCurrentFile (unzFile file)
-{
- int err = UNZ_OK;
-
- unz_s *s;
- file_in_zip_read_info_s *pfile_in_zip_read_info;
- if (file == NULL)
- return UNZ_PARAMERROR;
- s = (unz_s *) file;
- pfile_in_zip_read_info = s->pfile_in_zip_read;
-
- if (pfile_in_zip_read_info == NULL)
- return UNZ_PARAMERROR;
-
-
- if (pfile_in_zip_read_info->rest_read_uncompressed == 0)
- {
- if (pfile_in_zip_read_info->crc32 != pfile_in_zip_read_info->crc32_wait)
- err = UNZ_CRCERROR;
- }
- TRYFREE (pfile_in_zip_read_info->read_buffer);
- pfile_in_zip_read_info->read_buffer = NULL;
- if (pfile_in_zip_read_info->stream_initialised)
- inflateEnd (&pfile_in_zip_read_info->stream);
-
- pfile_in_zip_read_info->stream_initialised = 0;
- TRYFREE (pfile_in_zip_read_info);
-
- s->pfile_in_zip_read = NULL;
-
- return err;
-}
-
-
-/*
- * Get the global comment string of the ZipFile, in the szComment buffer.
- * uSizeBuf is the size of the szComment buffer. return the number of byte
- * copied or an error code <0
- */
-extern int ZEXPORT
-unzGetGlobalComment (
- unzFile file,
- char *szComment,
- uLong uSizeBuf)
-{
- unz_s *s;
- uLong uReadThis;
- if (file == NULL)
- return UNZ_PARAMERROR;
- s = (unz_s *) file;
-
- uReadThis = uSizeBuf;
- if (uReadThis > s->gi.size_comment)
- uReadThis = s->gi.size_comment;
-
- if (fseek (s->file, s->central_pos + 22, SEEK_SET) != 0)
- return UNZ_ERRNO;
-
- if (uReadThis > 0)
- {
- *szComment = '\0';
- if (fread (szComment, (uInt) uReadThis, 1, s->file) != 1)
- return UNZ_ERRNO;
- }
- if ((szComment != NULL) && (uSizeBuf > s->gi.size_comment))
- *(szComment + s->gi.size_comment) = '\0';
- return (int) uReadThis;
-}
diff --git a/source/unzip/unzip.h b/source/unzip/unzip.h
deleted file mode 100644
index f629782..0000000
--- a/source/unzip/unzip.h
+++ /dev/null
@@ -1,285 +0,0 @@
-/* unzip.h -- IO for uncompress .zip files using zlib
- Version 0.15 beta, Mar 19th, 1998,
-
- Copyright (C) 1998 Gilles Vollant
-
- This unzip package allow extract file from .ZIP file, compatible with PKZip 2.04g
- WinZip, InfoZip tools and compatible.
- Encryption and multi volume ZipFile (span) are not supported.
- Old compressions used by old PKZip 1.x are not supported
-
- THIS IS AN ALPHA VERSION. AT THIS STAGE OF DEVELOPPEMENT, SOMES API OR STRUCTURE
- CAN CHANGE IN FUTURE VERSION !!
- I WAIT FEEDBACK at mail info@winimage.com
- Visit also http://www.winimage.com/zLibDll/unzip.htm for evolution
-
- Condition of use and distribution are the same than zlib :
-
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
-
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source distribution.
-
-
-*/
-/* for more info about .ZIP format, see
- ftp://ftp.cdrom.com/pub/infozip/doc/appnote-970311-iz.zip
- PkWare has also a specification at :
- ftp://ftp.pkware.com/probdesc.zip */
-
-#ifndef _unz_H
-#define _unz_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef _ZLIB_H
-#include "zlib.h"
-#endif
-
-#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP)
-/* like the STRICT of WIN32, we define a pointer that cannot be converted
- from (void*) without cast */
-typedef struct TagunzFile__ { int unused; } unzFile__;
-typedef unzFile__ *unzFile;
-#else
-typedef voidp unzFile;
-#endif
-
-
-#define UNZ_OK (0)
-#define UNZ_END_OF_LIST_OF_FILE (-100)
-#define UNZ_ERRNO (Z_ERRNO)
-#define UNZ_EOF (0)
-#define UNZ_PARAMERROR (-102)
-#define UNZ_BADZIPFILE (-103)
-#define UNZ_INTERNALERROR (-104)
-#define UNZ_CRCERROR (-105)
-
-#define UNZ_STORED 0 /* compression methods */
-#define UNZ_SHRUNK 1
-#define UNZ_REDUCED1 2
-#define UNZ_REDUCED2 3
-#define UNZ_REDUCED3 4
-#define UNZ_REDUCED4 5
-#define UNZ_IMPLODED 6
-#define UNZ_TOKENIZED 7
-#define UNZ_DEFLATED 8
-
-/* tm_unz contain date/time info */
-typedef struct tm_unz_s
-{
- uInt tm_sec; /* seconds after the minute - [0,59] */
- uInt tm_min; /* minutes after the hour - [0,59] */
- uInt tm_hour; /* hours since midnight - [0,23] */
- uInt tm_mday; /* day of the month - [1,31] */
- uInt tm_mon; /* months since January - [0,11] */
- uInt tm_year; /* years - [1980..2044] */
-} tm_unz;
-
-/* unz_global_info structure contain global data about the ZIPfile
- These data comes from the end of central dir */
-typedef struct unz_global_info_s
-{
- uLong number_entry; /* total number of entries in
- the central dir on this disk */
- uLong size_comment; /* size of the global comment of the zipfile */
-} unz_global_info;
-
-
-/* unz_file_info contain information about a file in the zipfile */
-typedef struct unz_file_info_s
-{
- uLong version; /* version made by 2 bytes */
- uLong version_needed; /* version needed to extract 2 bytes */
- uLong flag; /* general purpose bit flag 2 bytes */
- uLong compression_method; /* compression method 2 bytes */
- uLong dosDate; /* last mod file date in Dos fmt 4 bytes */
- uLong crc; /* crc-32 4 bytes */
- uLong compressed_size; /* compressed size 4 bytes */
- uLong uncompressed_size; /* uncompressed size 4 bytes */
- uLong size_filename; /* filename length 2 bytes */
- uLong size_file_extra; /* extra field length 2 bytes */
- uLong size_file_comment; /* file comment length 2 bytes */
-
- uLong disk_num_start; /* disk number start 2 bytes */
- uLong internal_fa; /* internal file attributes 2 bytes */
- uLong external_fa; /* external file attributes 4 bytes */
-
- tm_unz tmu_date;
-} unz_file_info;
-
-extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1,
- const char* fileName2,
- int iCaseSensitivity));
-/*
- Compare two filename (fileName1,fileName2).
- If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
- If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
- or strcasecmp)
- If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
- (like 1 on Unix, 2 on Windows)
-*/
-
-
-extern unzFile ZEXPORT unzOpen OF((const char *path));
-/*
- Open a Zip file. path contain the full pathname (by example,
- on a Windows NT computer "c:\\zlib\\zlib111.zip" or on an Unix computer
- "zlib/zlib111.zip".
- If the zipfile cannot be opened (file don't exist or in not valid), the
- return value is NULL.
- Else, the return value is a unzFile Handle, usable with other function
- of this unzip package.
-*/
-
-extern int ZEXPORT unzClose OF((unzFile file));
-/*
- Close a ZipFile opened with unzipOpen.
- If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
- these files MUST be closed with unzipCloseCurrentFile before call unzipClose.
- return UNZ_OK if there is no problem. */
-
-extern int ZEXPORT unzGetGlobalInfo OF((unzFile file,
- unz_global_info *pglobal_info));
-/*
- Write info about the ZipFile in the *pglobal_info structure.
- No preparation of the structure is needed
- return UNZ_OK if there is no problem. */
-
-
-extern int ZEXPORT unzGetGlobalComment OF((unzFile file,
- char *szComment,
- uLong uSizeBuf));
-/*
- Get the global comment string of the ZipFile, in the szComment buffer.
- uSizeBuf is the size of the szComment buffer.
- return the number of byte copied or an error code <0
-*/
-
-
-/***************************************************************************/
-/* Unzip package allow you browse the directory of the zipfile */
-
-extern int ZEXPORT unzGoToFirstFile OF((unzFile file));
-/*
- Set the current file of the zipfile to the first file.
- return UNZ_OK if there is no problem
-*/
-
-extern int ZEXPORT unzGoToNextFile OF((unzFile file));
-/*
- Set the current file of the zipfile to the next file.
- return UNZ_OK if there is no problem
- return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
-*/
-
-extern int ZEXPORT unzLocateFile OF((unzFile file,
- const char *szFileName,
- int iCaseSensitivity));
-/*
- Try locate the file szFileName in the zipfile.
- For the iCaseSensitivity signification, see unzStringFileNameCompare
-
- return value :
- UNZ_OK if the file is found. It becomes the current file.
- UNZ_END_OF_LIST_OF_FILE if the file is not found
-*/
-
-
-extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file,
- unz_file_info *pfile_info,
- char *szFileName,
- uLong fileNameBufferSize,
- void *extraField,
- uLong extraFieldBufferSize,
- char *szComment,
- uLong commentBufferSize));
-/*
- Get Info about the current file
- if pfile_info!=NULL, the *pfile_info structure will contain somes info about
- the current file
- if szFileName!=NULL, the filemane string will be copied in szFileName
- (fileNameBufferSize is the size of the buffer)
- if extraField!=NULL, the extra field information will be copied in extraField
- (extraFieldBufferSize is the size of the buffer).
- This is the Central-header version of the extra field
- if szComment!=NULL, the comment string of the file will be copied in szComment
- (commentBufferSize is the size of the buffer)
-*/
-
-/***************************************************************************/
-/* for reading the content of the current zipfile, you can open it, read data
- from it, and close it (you can close it before reading all the file)
- */
-
-extern int ZEXPORT unzOpenCurrentFile OF((unzFile file));
-/*
- Open for reading data the current file in the zipfile.
- If there is no error, the return value is UNZ_OK.
-*/
-
-extern int ZEXPORT unzCloseCurrentFile OF((unzFile file));
-/*
- Close the file in zip opened with unzOpenCurrentFile
- Return UNZ_CRCERROR if all the file was read but the CRC is not good
-*/
-
-
-extern int ZEXPORT unzReadCurrentFile OF((unzFile file,
- voidp buf,
- unsigned len));
-/*
- Read bytes from the current file (opened by unzOpenCurrentFile)
- buf contain buffer where data must be copied
- len the size of buf.
-
- return the number of byte copied if somes bytes are copied
- return 0 if the end of file was reached
- return <0 with error code if there is an error
- (UNZ_ERRNO for IO error, or zLib error for uncompress error)
-*/
-
-extern z_off_t ZEXPORT unztell OF((unzFile file));
-/*
- Give the current position in uncompressed data
-*/
-
-extern int ZEXPORT unzeof OF((unzFile file));
-/*
- return 1 if the end of file was reached, 0 elsewhere
-*/
-
-extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file,
- voidp buf,
- unsigned len));
-/*
- Read extra field from the current file (opened by unzOpenCurrentFile)
- This is the local-header version of the extra field (sometimes, there is
- more info in the local-header version than in the central-header)
-
- if buf==NULL, it return the size of the local extra field
-
- if buf!=NULL, len is the size of the buffer, the extra header is copied in
- buf.
- the return value is the number of bytes copied in buf, or (if <0)
- the error code
-*/
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _unz_H */
diff --git a/source/unzip/unzipP.h b/source/unzip/unzipP.h
deleted file mode 100644
index c44e3cb..0000000
--- a/source/unzip/unzipP.h
+++ /dev/null
@@ -1,125 +0,0 @@
-#ifndef _UNZIPP_H_
-#define _UNZIPP_H_
-
-#include "ds2_malloc.h"
-#include "unzip.h"
-
-#ifndef local
-#define local static
-#endif
-/* compile with -Dlocal if your debugger can't find static symbols */
-
-
-
-#if !defined(unix) && !defined(CASESENSITIVITYDEFAULT_YES) && \
- !defined(CASESENSITIVITYDEFAULT_NO)
-#define CASESENSITIVITYDEFAULT_NO
-#endif
-
-
-#ifndef UNZ_BUFSIZE
-#define UNZ_BUFSIZE (16384)
-#endif
-
-#ifndef UNZ_MAXFILENAMEINZIP
-#define UNZ_MAXFILENAMEINZIP (256)
-#endif
-
-#ifndef ALLOC
-#define ALLOC(size) (malloc(size))
-#endif
-#ifndef TRYFREE
-#define TRYFREE(p) {if (p) free(p);}
-#endif
-
-#define SIZECENTRALDIRITEM (0x2e)
-#define SIZEZIPLOCALHEADER (0x1e)
-
-
-/* I've found an old Unix (a SunOS 4.1.3_U1) without all SEEK_* defined.... */
-
-#ifndef SEEK_CUR
-#define SEEK_CUR 1
-#endif
-
-#ifndef SEEK_END
-#define SEEK_END 2
-#endif
-
-#ifndef SEEK_SET
-#define SEEK_SET 0
-#endif
-
-/* unz_file_info_interntal contain internal info about a file in zipfile */
-typedef struct unz_file_info_internal_s
-{
- uLong offset_curfile; /* relative offset of local header 4
- * bytes */
-} unz_file_info_internal;
-
-
-/*
- * file_in_zip_read_info_s contain internal information about a file in
- * zipfile, when reading and decompress it
- */
-typedef struct
-{
- char *read_buffer;/* internal buffer for compressed data */
- z_stream stream; /* zLib stream structure for inflate */
-
- uLong pos_in_zipfile; /* position in byte on the zipfile,
- * for fseek */
- uLong stream_initialised; /* flag set if stream structure is
- * initialised */
-
- uLong offset_local_extrafield; /* offset of the local extra
- * field */
- uInt size_local_extrafield; /* size of the local extra
- * field */
- uLong pos_local_extrafield; /* position in the local
- * extra field in read */
-
- uLong crc32; /* crc32 of all data uncompressed */
- uLong crc32_wait; /* crc32 we must obtain after decompress all */
- uLong rest_read_compressed; /* number of byte to be
- * decompressed */
- uLong rest_read_uncompressed; /* number of byte to be
- * obtained after decomp */
- FILE *file; /* io structore of the zipfile */
- uLong compression_method; /* compression method (0==store) */
- uLong byte_before_the_zipfile; /* byte before the zipfile,
- * (>0 for sfx) */
-} file_in_zip_read_info_s;
-
-
-/*
- * unz_s contain internal information about the zipfile
- */
-typedef struct
-{
- FILE *file; /* io structore of the zipfile */
- unz_global_info gi; /* public global information */
- uLong byte_before_the_zipfile; /* byte before the zipfile,
- * (>0 for sfx) */
- uLong num_file; /* number of the current file in the zipfile */
- uLong pos_in_central_dir; /* pos of the current file in the
- * central dir */
- uLong current_file_ok; /* flag about the usability of the
- * current file */
- uLong central_pos;/* position of the beginning of the central
- * dir */
-
- uLong size_central_dir; /* size of the central directory */
- uLong offset_central_dir; /* offset of start of central
- * directory with respect to the
- * starting disk number */
-
- unz_file_info cur_file_info; /* public info about the current file
- * in zip */
- unz_file_info_internal cur_file_info_internal; /* private info about it */
- file_in_zip_read_info_s *pfile_in_zip_read; /* structure about the
- * current file if we are
- * decompressing it */
-} unz_s;
-
-#endif