Shadowrun: Awakened 29 September 2011 - Build 871
PackageManager.hpp
Go to the documentation of this file.
00001 /*
00002     Copyright (c) 2009-2010 Christopher A. Taylor.  All rights reserved.
00003 
00004     Redistribution and use in source and binary forms, with or without
00005     modification, are permitted provided that the following conditions are met:
00006 
00007     * Redistributions of source code must retain the above copyright notice,
00008       this list of conditions and the following disclaimer.
00009     * Redistributions in binary form must reproduce the above copyright notice,
00010       this list of conditions and the following disclaimer in the documentation
00011       and/or other materials provided with the distribution.
00012     * Neither the name of LibCat nor the names of its contributors may be used
00013       to endorse or promote products derived from this software without
00014       specific prior written permission.
00015 
00016     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00017     AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00018     IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00019     ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
00020     LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00021     CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00022     SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00023     INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00024     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00025     ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00026     POSSIBILITY OF SUCH DAMAGE.
00027 */
00028 
00029 #ifndef CAT_PACKAGE_MANAGER_HPP
00030 #define CAT_PACKAGE_MANAGER_HPP
00031 
00032 #include <cat/Platform.hpp>
00033 #include <cat/port/FastDelegate.h>
00034 
00035 namespace cat {
00036 
00037 
00038 // Package resource identifier macro
00039 #define CAT_UNCAGE(packagePath, offset, size) offset, size
00040 
00041 /*
00042     All file resources are packed into one large file and each is
00043     assigned a unique identifying number, starting from 0.
00044 
00045     The client source code is preprocessed by a tool that replaces the
00046     arguments of the CAT_UNPACK() macro with the correct ID number based
00047     on the string given as the first argument.
00048 
00049     CAT_UNPACK("world1/lightmap3.png")
00050     -> CAT_UNPACK("world1/lightmap3.png", 15241, 256, 0xdecryptionkey)
00051 
00052     At runtime the client application will not be aware of the string
00053     name of a resource in the package, only where to go to get it.
00054 
00055     Resources that are used together during tuning will have identifiers
00056     that are close together so that disk seek time is minimized.
00057 */
00058 
00059 
00060 /*
00061     Kennel files are simple concatenations of all of the game resources.
00062 
00063     The goal is to reduce access time to data by cutting the operating
00064     system's file-system out completely.  Furthermore, data that are
00065     accessed together are stored together on disk and in the same order
00066     that they are accessed.
00067 
00068     Textures are compressed with modified JPEG-LS, providing the fastest
00069     possible access time.
00070     Sounds compression hasn't been investigated yet.
00071 
00072     Each resource (sound/texture) is obfuscated with a 64-bit key, making
00073     it necessary to reverse-engineer the game client to decode in-game
00074     resources outside of the game.
00075 
00076     The KennelFile object implements optimized algorithms for performing
00077     in-place modification to a large datafile (>4 GB).
00078 */
00079 
00080 class KennelPatchFile : AsyncFile
00081 {
00082 public:
00083     KennelPatchFile();
00084     ~KennelPatchFile();
00085 
00086 public:
00087     void Insert
00088 };
00089 
00090 
00091 // Kennel Patch Callback (param=bool: true on successful patch, false on error)
00092 typedef fastdelegate::FastDelegate1<bool, void> KennelPatchCallback;
00093 
00094 class KennelFile : AsyncFile
00095 {
00096 public:
00097     KennelFile();
00098     virtual ~KennelFile();
00099 
00100 public:
00101     bool Move(u64 dest, u32 region_size, u64 src, KennelPatchCallback OnComplete);
00102 };
00103 
00104 
00105 } // namespace cat
00106 
00107 #endif // CAT_PACKAGE_MANAGER_HPP

Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.

GNU Lesser General Public License 3 Sourceforge.net