| 1 | /* This is a cut-down version of UNP64 with only the bare minimum |
| 2 | * needed to decompress a number of Commodore 64 adventure games. |
| 3 | * It is distributed under the zlib License by kind permission of |
| 4 | * the original authors Magnus Lind and iAN CooG. |
| 5 | */ |
| 6 | |
| 7 | /* |
| 8 | UNP64 - generic Commodore 64 prg unpacker |
| 9 | (C) 2008-2022 iAN CooG/HVSC Crew^C64Intros |
| 10 | original source and idea: testrun.c, taken from exo20b7 |
| 11 | |
| 12 | Follows original disclaimer |
| 13 | */ |
| 14 | |
| 15 | /* |
| 16 | * Copyright (c) 2002 - 2023 Magnus Lind. |
| 17 | * |
| 18 | * |
| 19 | * This software is provided 'as-is', without any express or implied |
| 20 | * warranty. In no event will the authors be held liable for any damages |
| 21 | * arising from the use of this software. |
| 22 | * |
| 23 | * Permission is granted to anyone to use this software for any purpose, |
| 24 | * including commercial applications, and to alter it and redistribute it |
| 25 | * freely, subject to the following restrictions: |
| 26 | * |
| 27 | * 1. The origin of this software must not be misrepresented; you must not |
| 28 | * claim that you wrote the original software. If you use this software |
| 29 | * in a product, an acknowledgment in the product documentation would be |
| 30 | * appreciated but is not required. |
| 31 | * 2. Altered source versions must be plainly marked as such, and must not be |
| 32 | * misrepresented as being the original software. |
| 33 | * 3. This notice may not be removed or altered from any source distribution. |
| 34 | * |
| 35 | */ |
| 36 | |
| 37 | /* |
| 38 | C++ version based on code adapted to ScummVM by Avijeet Maurya |
| 39 | */ |
| 40 | |
| 41 | #include "unp64.h" |
| 42 | |
| 43 | namespace Unp64 { |
| 44 | |
| 45 | void scnAbuzeCrunch(UnpStr *unp); |
| 46 | void scnActionPacker(UnpStr *unp); |
| 47 | void scnByteBoiler(UnpStr *unp); |
| 48 | void scnCaution(UnpStr *unp); |
| 49 | void scnCCS(UnpStr *unp); |
| 50 | void scnCruel(UnpStr *unp); |
| 51 | void scnECA(UnpStr *unp); |
| 52 | void scnExpert(UnpStr *unp); |
| 53 | void scnExomizer(UnpStr *unp); |
| 54 | void scnFinalSuperComp(UnpStr *unp); |
| 55 | void scnIntros(UnpStr *unp); |
| 56 | void scnMasterCompressor(UnpStr *unp); |
| 57 | void scnMegabyte(UnpStr *unp); |
| 58 | void scnMrCross(UnpStr *unp); |
| 59 | void scnMrZ(UnpStr *unp); |
| 60 | void scnPuCrunch(UnpStr *unp); |
| 61 | void scnSection8(UnpStr *unp); |
| 62 | void scnTBCMultiComp(UnpStr *unp); |
| 63 | void scnTCScrunch(UnpStr *unp); |
| 64 | void scnTimeCruncher(UnpStr *unp); |
| 65 | void scnXTC(UnpStr *unp); |
| 66 | |
| 67 | Scnptr g_scanFunc[] = { |
| 68 | scnAbuzeCrunch, |
| 69 | scnByteBoiler, |
| 70 | scnECA, |
| 71 | scnExpert, |
| 72 | scnFinalSuperComp, |
| 73 | scnIntros, |
| 74 | scnCruel, |
| 75 | scnPuCrunch, |
| 76 | scnMasterCompressor, |
| 77 | scnMrCross, |
| 78 | scnMrZ, |
| 79 | scnTCScrunch, |
| 80 | scnTBCMultiComp, |
| 81 | scnTimeCruncher, |
| 82 | scnXTC, |
| 83 | scnCCS, |
| 84 | scnMegabyte, |
| 85 | scnSection8, |
| 86 | scnCaution, |
| 87 | scnActionPacker, |
| 88 | scnExomizer |
| 89 | }; |
| 90 | |
| 91 | void scanners(UnpStr *unp) { |
| 92 | int x, y; |
| 93 | y = sizeof(g_scanFunc) / sizeof(*g_scanFunc); |
| 94 | for (x = 0; x < y; x++) { |
| 95 | (g_scanFunc[x])(unp); |
| 96 | if (unp->_idFlag) |
| 97 | break; |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | } // End of namespace Unp64 |