00001 // Filename: patcher.cxx 00002 // Created by: mike (09Jan97) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #include "config_downloader.h" 00020 #include <filename.h> 00021 #include "patcher.h" 00022 00023 //////////////////////////////////////////////////////////////////// 00024 // Defines 00025 //////////////////////////////////////////////////////////////////// 00026 00027 //////////////////////////////////////////////////////////////////// 00028 // Function: Patcher::Constructor 00029 // Access: Public 00030 // Description: 00031 //////////////////////////////////////////////////////////////////// 00032 Patcher:: 00033 Patcher(void) { 00034 PT(Buffer) buffer = new Buffer(patcher_buffer_size); 00035 init(buffer); 00036 } 00037 00038 //////////////////////////////////////////////////////////////////// 00039 // Function: Patcher::Constructor 00040 // Access: Public 00041 // Description: 00042 //////////////////////////////////////////////////////////////////// 00043 Patcher:: 00044 Patcher(PT(Buffer) buffer) { 00045 init(buffer); 00046 } 00047 00048 //////////////////////////////////////////////////////////////////// 00049 // Function: Patcher::Constructor 00050 // Access: Private 00051 // Description: 00052 //////////////////////////////////////////////////////////////////// 00053 void Patcher:: 00054 init(PT(Buffer) buffer) { 00055 nassertv(!buffer.is_null()); 00056 _buffer = buffer; 00057 00058 _patchfile = NULL; 00059 _patchfile = new Patchfile(_buffer); 00060 } 00061 00062 //////////////////////////////////////////////////////////////////// 00063 // Function: Patcher::Destructor 00064 // Access: Public 00065 // Description: 00066 //////////////////////////////////////////////////////////////////// 00067 Patcher:: 00068 ~Patcher(void) { 00069 delete _patchfile; 00070 } 00071 00072 //////////////////////////////////////////////////////////////////// 00073 // Function: Patcher::initiate 00074 // Access: Public 00075 // Description: 00076 //////////////////////////////////////////////////////////////////// 00077 int Patcher:: 00078 initiate(Filename &patch, Filename &infile) { 00079 return _patchfile->initiate(patch, infile); 00080 } 00081 00082 //////////////////////////////////////////////////////////////////// 00083 // Function: Patcher::run 00084 // Access: Public 00085 // Description: 00086 //////////////////////////////////////////////////////////////////// 00087 int Patcher:: 00088 run(void) { 00089 return _patchfile->run(); 00090 }