PackageManager.hpp 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. Copyright (c) 2009-2010 Christopher A. Taylor. All rights reserved.
  3. Redistribution and use in source and binary forms, with or without
  4. modification, are permitted provided that the following conditions are met:
  5. * Redistributions of source code must retain the above copyright notice,
  6. this list of conditions and the following disclaimer.
  7. * Redistributions in binary form must reproduce the above copyright notice,
  8. this list of conditions and the following disclaimer in the documentation
  9. and/or other materials provided with the distribution.
  10. * Neither the name of LibCat nor the names of its contributors may be used
  11. to endorse or promote products derived from this software without
  12. specific prior written permission.
  13. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  14. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  15. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  16. ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
  17. LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  18. CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  19. SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  20. INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  21. CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  22. ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  23. POSSIBILITY OF SUCH DAMAGE.
  24. */
  25. #ifndef CAT_PACKAGE_MANAGER_HPP
  26. #define CAT_PACKAGE_MANAGER_HPP
  27. #include <cat/Platform.hpp>
  28. #include <cat/port/FastDelegate.h>
  29. namespace cat {
  30. // Package resource identifier macro
  31. #define CAT_UNCAGE(packagePath, offset, size) offset, size
  32. /*
  33. All file resources are packed into one large file and each is
  34. assigned a unique identifying number, starting from 0.
  35. The client source code is preprocessed by a tool that replaces the
  36. arguments of the CAT_UNPACK() macro with the correct ID number based
  37. on the string given as the first argument.
  38. CAT_UNPACK("world1/lightmap3.png")
  39. -> CAT_UNPACK("world1/lightmap3.png", 15241, 256, 0xdecryptionkey)
  40. At runtime the client application will not be aware of the string
  41. name of a resource in the package, only where to go to get it.
  42. Resources that are used together during tuning will have identifiers
  43. that are close together so that disk seek time is minimized.
  44. */
  45. /*
  46. Kennel files are simple concatenations of all of the game resources.
  47. The goal is to reduce access time to data by cutting the operating
  48. system's file-system out completely. Furthermore, data that are
  49. accessed together are stored together on disk and in the same order
  50. that they are accessed.
  51. Textures are compressed with modified JPEG-LS, providing the fastest
  52. possible access time.
  53. Sounds compression hasn't been investigated yet.
  54. Each resource (sound/texture) is obfuscated with a 64-bit key, making
  55. it necessary to reverse-engineer the game client to decode in-game
  56. resources outside of the game.
  57. The KennelFile object implements optimized algorithms for performing
  58. in-place modification to a large datafile (>4 GB).
  59. */
  60. class KennelPatchFile : AsyncFile
  61. {
  62. public:
  63. KennelPatchFile();
  64. ~KennelPatchFile();
  65. public:
  66. void Insert
  67. };
  68. // Kennel Patch Callback (param=bool: true on successful patch, false on error)
  69. typedef fastdelegate::FastDelegate1<bool, void> KennelPatchCallback;
  70. class KennelFile : AsyncFile
  71. {
  72. public:
  73. KennelFile();
  74. virtual ~KennelFile();
  75. public:
  76. bool Move(u64 dest, u32 region_size, u64 src, KennelPatchCallback OnComplete);
  77. };
  78. } // namespace cat
  79. #endif // CAT_PACKAGE_MANAGER_HPP
粤ICP备19079148号